Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
286 changes: 286 additions & 0 deletions api/swagger/superplane.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,172 @@
]
}
},
"/api/v1/blobs": {
"get": {
"summary": "List blobs",
"description": "Lists blobs in the selected scope",
"operationId": "Canvases_ListBlobs",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CanvasesListBlobsResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "scopeType",
"in": "query",
"required": false,
"type": "string",
"enum": [
"SCOPE_TYPE_UNSPECIFIED",
"SCOPE_TYPE_ORGANIZATION",
"SCOPE_TYPE_CANVAS",
"SCOPE_TYPE_NODE",
"SCOPE_TYPE_EXECUTION"
],
"default": "SCOPE_TYPE_UNSPECIFIED"
},
{
"name": "canvasId",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "nodeId",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "executionId",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "limit",
"in": "query",
"required": false,
"type": "integer",
"format": "int64"
},
{
"name": "before",
"in": "query",
"required": false,
"type": "string",
"format": "date-time"
}
],
"tags": [
"Blob"
]
},
"post": {
"summary": "Store blob",
"description": "Stores a blob in the selected scope",
"operationId": "Canvases_StoreBlob",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CanvasesStoreBlobResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CanvasesStoreBlobRequest"
}
}
],
"tags": [
"Blob"
]
}
},
"/api/v1/blobs/{id}": {
"get": {
"summary": "Describe blob",
"description": "Describes a blob and returns its contents",
"operationId": "Canvases_DescribeBlob",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CanvasesDescribeBlobResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"Blob"
]
},
"delete": {
"summary": "Delete blob",
"description": "Deletes a blob",
"operationId": "Canvases_DeleteBlob",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CanvasesDeleteBlobResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"Blob"
]
}
},
"/api/v1/blueprints": {
"get": {
"summary": "List blueprints",
Expand Down Expand Up @@ -3984,6 +4150,17 @@
},
"title": "Common data structures"
},
"BlobScopeType": {
"type": "string",
"enum": [
"SCOPE_TYPE_UNSPECIFIED",
"SCOPE_TYPE_ORGANIZATION",
"SCOPE_TYPE_CANVAS",
"SCOPE_TYPE_NODE",
"SCOPE_TYPE_EXECUTION"
],
"default": "SCOPE_TYPE_UNSPECIFIED"
},
"BlueprintsBlueprint": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4153,6 +4330,46 @@
}
}
},
"CanvasesBlob": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"organizationId": {
"type": "string"
},
"scopeType": {
"$ref": "#/definitions/BlobScopeType"
},
"canvasId": {
"type": "string"
},
"nodeId": {
"type": "string"
},
"executionId": {
"type": "string"
},
"path": {
"type": "string"
},
"objectKey": {
"type": "string"
},
"sizeBytes": {
"type": "string",
"format": "int64"
},
"contentType": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
}
}
},
"CanvasesCancelExecutionBody": {
"type": "object"
},
Expand Down Expand Up @@ -4696,6 +4913,9 @@
}
}
},
"CanvasesDeleteBlobResponse": {
"type": "object"
},
"CanvasesDeleteCanvasMemoryResponse": {
"type": "object"
},
Expand All @@ -4705,6 +4925,18 @@
"CanvasesDeleteNodeQueueItemResponse": {
"type": "object"
},
"CanvasesDescribeBlobResponse": {
"type": "object",
"properties": {
"blob": {
"$ref": "#/definitions/CanvasesBlob"
},
"content": {
"type": "string",
"format": "byte"
}
}
},
"CanvasesDescribeCanvasChangeRequestResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4775,6 +5007,25 @@
}
}
},
"CanvasesListBlobsResponse": {
"type": "object",
"properties": {
"blobs": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/CanvasesBlob"
}
},
"hasNextPage": {
"type": "boolean"
},
"lastTimestamp": {
"type": "string",
"format": "date-time"
}
}
},
"CanvasesListCanvasChangeRequestsResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -5000,6 +5251,41 @@
"CanvasesResolveExecutionErrorsResponse": {
"type": "object"
},
"CanvasesStoreBlobRequest": {
"type": "object",
"properties": {
"scopeType": {
"$ref": "#/definitions/BlobScopeType"
},
"canvasId": {
"type": "string"
},
"nodeId": {
"type": "string"
},
"executionId": {
"type": "string"
},
"path": {
"type": "string"
},
"content": {
"type": "string",
"format": "byte"
},
"contentType": {
"type": "string"
}
}
},
"CanvasesStoreBlobResponse": {
"type": "object",
"properties": {
"blob": {
"$ref": "#/definitions/CanvasesBlob"
}
}
},
"CanvasesUpdateCanvasBody": {
"type": "object",
"properties": {
Expand Down
Empty file.
23 changes: 23 additions & 0 deletions db/migrations/20260326165158_add-blobs.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CREATE TABLE IF NOT EXISTS blobs (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
organization_id uuid NOT NULL,
scope_type varchar(32) NOT NULL,
canvas_id uuid NULL,
node_id varchar(255) NULL,
execution_id uuid NULL,
path text NOT NULL,
object_key text NOT NULL,
size_bytes bigint NOT NULL,
content_type text NULL,
created_by_user_id uuid NULL,
created_at timestamptz DEFAULT NOW(),
updated_at timestamptz DEFAULT NOW(),
CONSTRAINT blobs_scope_type_check
CHECK (scope_type IN ('organization', 'canvas', 'node', 'execution'))
);

CREATE UNIQUE INDEX IF NOT EXISTS idx_blobs_object_key ON blobs (object_key);
CREATE INDEX IF NOT EXISTS idx_blobs_org_scope_created_at ON blobs (organization_id, scope_type, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_blobs_canvas_scope ON blobs (organization_id, canvas_id, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_blobs_node_scope ON blobs (organization_id, canvas_id, node_id, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_blobs_execution_scope ON blobs (organization_id, execution_id, created_at DESC);
Loading