diff --git a/apps/docs/content/docs/cli/reference.mdx b/apps/docs/content/docs/cli/reference.mdx index a8d4c90eb38..76410565750 100644 --- a/apps/docs/content/docs/cli/reference.mdx +++ b/apps/docs/content/docs/cli/reference.mdx @@ -5891,7 +5891,7 @@ sim tables columns create [options] | Option | Required | Description | | --- | --- | --- | -| `--column ` | Yes | Column definition to add. (JSON, or @path / @- to read a file or stdin). | +| `--column ` | Yes | Column definition to add: {"name":"status","type":"string"}. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). | @@ -6797,7 +6797,7 @@ sim tables create [options] | --- | --- | --- | | `--name ` | Yes | Identifier: letters, numbers, and underscores; cannot start with a number. | | `--description ` | No | Optional table description. | -| `--schema ` | Yes | Table schema: {"columns":[{"name":"email","type":"string"}]} (JSON, or @path / @- to read a file or stdin). | +| `--schema ` | Yes | Initial table column definitions: {"columns":[{"name":"email","type":"string"}]}. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). | | `--folder ` | No | Folder path as shown in the app; the leading / is optional. | @@ -7773,7 +7773,9 @@ Edges: connections maps a source handle to its targets: {"source":""}, {"source":["",""]}, or {"source":{"block":"","handle":""}}; "success" is an alias of "source". An add's connections create the new block's edges. An edit's connections REPLACE every - outgoing edge of that block, on every handle: list again each edge to keep. + outgoing edge of that block, on every handle: list again each edge to keep; {} removes them all. + A block moved into or out of a loop or parallel (parentId) loses every edge that would cross the + container's boundary: to leave the loop, wire its loop-end-source (parallel-end-source). To remove one edge, edit its source block with {"removeEdges":[{"targetBlockId":"","sourceHandle":"source"}]} (sourceHandle defaults to "source"). @@ -7786,12 +7788,14 @@ Source handles: parallel-start-source, parallel-end-source the same for a parallel Renames: An edit's {"name":"New name"} also rewrites every reference to the block, in - other blocks' inputs and in a loop's or parallel's collection and condition. + other blocks' inputs and in a loop's or parallel's collection and condition. Edits run after the + batch's adds, so a block added in the same batch is rewritten too. Inputs: inputs takes the field ids `sim blocks get ` lists (inputSchema, operationInputSchema), or the name a pair of them shares (inputDefinitions: tableId for tableSelector and manualTableId; a string goes to the typed field). Add the type it answers with: `blocks get - table` answers table_v2, and an add of legacy table is refused. + table` answers table_v2, and an add of legacy table is refused. An edit's inputs replace each + field they name whole (a responseFormat schema too) and keep the fields they do not name. conditions (condition): [{"title":"if","value":" > 3"},{"title":"else if","value":"…"}, {"title":"else","value":""}]; the last entry is the else. Each entry's id comes from its position (-if, -else-if-0, …, -else): an id you pass is replaced. @@ -7800,14 +7804,16 @@ Inputs: Block settings, beside inputs in an add's or edit's params: "retry":{"enabled":true,"maxTries":3,"waitBetweenTriesMs":1000} retries a failed block; null clears it. An api block's retries input repeats the request after a timeout, reset, 429 or - 5xx, not when the host does not resolve or refuses the connection; "retry" covers that. + 5xx, not when the host does not resolve or refuses the connection; "retry" covers that. They + nest: every try of "retry" runs the request with its retries. Outputs: A block that fails outputs {"error":""}: connect its error handle and read there (without one, the run fails). A Function's error leads with the line and code that threw; its is the thrown message alone, the one to reply with. A Workflow block's result is the child's output; a child ending in a Response block gives {data, status, headers}, so read - . + . A Table block's row holds its cells under data: read a cell as + (). References: Inside a loop or parallel body read and , or and ; after it, . A reference to a block diff --git a/apps/docs/content/docs/cli/tables.mdx b/apps/docs/content/docs/cli/tables.mdx index 589050deb8a..a92649e37e3 100644 --- a/apps/docs/content/docs/cli/tables.mdx +++ b/apps/docs/content/docs/cli/tables.mdx @@ -68,7 +68,7 @@ sim tables create [options] | --- | --- | --- | | `--name ` | Yes | Identifier: letters, numbers, and underscores; cannot start with a number. | | `--description ` | No | Optional table description. | -| `--schema ` | Yes | Table schema: {"columns":[{"name":"email","type":"string"}]} (JSON, or @path / @- to read a file or stdin). | +| `--schema ` | Yes | Initial table column definitions: {"columns":[{"name":"email","type":"string"}]}. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). | | `--folder ` | No | Folder path as shown in the app; the leading / is optional. | @@ -624,7 +624,7 @@ sim tables columns create [options] | Option | Required | Description | | --- | --- | --- | -| `--column ` | Yes | Column definition to add. (JSON, or @path / @- to read a file or stdin). | +| `--column ` | Yes | Column definition to add: {"name":"status","type":"string"}. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options. (JSON, or @path / @- to read a file or stdin). | diff --git a/apps/docs/content/docs/cli/workflows.mdx b/apps/docs/content/docs/cli/workflows.mdx index cb40387b707..45d9a1c9ca4 100644 --- a/apps/docs/content/docs/cli/workflows.mdx +++ b/apps/docs/content/docs/cli/workflows.mdx @@ -342,7 +342,9 @@ Edges: connections maps a source handle to its targets: {"source":""}, {"source":["",""]}, or {"source":{"block":"","handle":""}}; "success" is an alias of "source". An add's connections create the new block's edges. An edit's connections REPLACE every - outgoing edge of that block, on every handle: list again each edge to keep. + outgoing edge of that block, on every handle: list again each edge to keep; {} removes them all. + A block moved into or out of a loop or parallel (parentId) loses every edge that would cross the + container's boundary: to leave the loop, wire its loop-end-source (parallel-end-source). To remove one edge, edit its source block with {"removeEdges":[{"targetBlockId":"","sourceHandle":"source"}]} (sourceHandle defaults to "source"). @@ -355,12 +357,14 @@ Source handles: parallel-start-source, parallel-end-source the same for a parallel Renames: An edit's {"name":"New name"} also rewrites every reference to the block, in - other blocks' inputs and in a loop's or parallel's collection and condition. + other blocks' inputs and in a loop's or parallel's collection and condition. Edits run after the + batch's adds, so a block added in the same batch is rewritten too. Inputs: inputs takes the field ids `sim blocks get ` lists (inputSchema, operationInputSchema), or the name a pair of them shares (inputDefinitions: tableId for tableSelector and manualTableId; a string goes to the typed field). Add the type it answers with: `blocks get - table` answers table_v2, and an add of legacy table is refused. + table` answers table_v2, and an add of legacy table is refused. An edit's inputs replace each + field they name whole (a responseFormat schema too) and keep the fields they do not name. conditions (condition): [{"title":"if","value":" > 3"},{"title":"else if","value":"…"}, {"title":"else","value":""}]; the last entry is the else. Each entry's id comes from its position (-if, -else-if-0, …, -else): an id you pass is replaced. @@ -369,14 +373,16 @@ Inputs: Block settings, beside inputs in an add's or edit's params: "retry":{"enabled":true,"maxTries":3,"waitBetweenTriesMs":1000} retries a failed block; null clears it. An api block's retries input repeats the request after a timeout, reset, 429 or - 5xx, not when the host does not resolve or refuses the connection; "retry" covers that. + 5xx, not when the host does not resolve or refuses the connection; "retry" covers that. They + nest: every try of "retry" runs the request with its retries. Outputs: A block that fails outputs {"error":""}: connect its error handle and read there (without one, the run fails). A Function's error leads with the line and code that threw; its is the thrown message alone, the one to reply with. A Workflow block's result is the child's output; a child ending in a Response block gives {data, status, headers}, so read - . + . A Table block's row holds its cells under data: read a cell as + (). References: Inside a loop or parallel body read and , or and ; after it, . A reference to a block diff --git a/apps/docs/openapi-v2-resources.json b/apps/docs/openapi-v2-resources.json index a627022e4f1..a62bb01b2a7 100644 --- a/apps/docs/openapi-v2-resources.json +++ b/apps/docs/openapi-v2-resources.json @@ -22253,11 +22253,47 @@ "properties": { "type": { "type": "string", - "description": "Value type of the output." + "description": "Value type of the output field." }, "description": { - "description": "What the output holds.", + "description": "What the field holds.", "type": "string" + }, + "properties": { + "description": "Members of an object-typed output, keyed by field name.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "description": "Nested output field, in this same shape." + } + }, + "items": { + "description": "Element shape of an array-typed output.", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Element value type." + }, + "description": { + "description": "What an element holds.", + "type": "string" + }, + "properties": { + "description": "Members of an object-typed element, keyed by field name.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "description": "Nested output field, in this same shape." + } + } + }, + "required": ["type"], + "additionalProperties": false } }, "required": ["type"], @@ -22381,11 +22417,47 @@ "properties": { "type": { "type": "string", - "description": "Value type of the output." + "description": "Value type of the output field." }, "description": { - "description": "What the output holds.", + "description": "What the field holds.", "type": "string" + }, + "properties": { + "description": "Members of an object-typed output, keyed by field name.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "description": "Nested output field, in this same shape." + } + }, + "items": { + "description": "Element shape of an array-typed output.", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Element value type." + }, + "description": { + "description": "What an element holds.", + "type": "string" + }, + "properties": { + "description": "Members of an object-typed element, keyed by field name.", + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "description": "Nested output field, in this same shape." + } + } + }, + "required": ["type"], + "additionalProperties": false } }, "required": ["type"], diff --git a/apps/docs/openapi-v2-tables.json b/apps/docs/openapi-v2-tables.json index e07534290df..3af6153b675 100644 --- a/apps/docs/openapi-v2-tables.json +++ b/apps/docs/openapi-v2-tables.json @@ -6422,7 +6422,7 @@ }, "required": ["columns"], "additionalProperties": false, - "description": "Initial table column definitions." + "description": "Initial table column definitions: {\"columns\":[{\"name\":\"email\",\"type\":\"string\"}]}. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options." }, "folderPath": { "description": "Folder in which to create the table.", @@ -6701,7 +6701,7 @@ }, "required": ["name", "type"], "additionalProperties": false, - "description": "Column definition to add." + "description": "Column definition to add: {\"name\":\"status\",\"type\":\"string\"}. A column's type is one of string, number, currency, boolean, date, json, select; a select column also takes options." } }, "required": ["workspaceId", "column"], diff --git a/apps/docs/scripts/fixtures/content-baseline.json b/apps/docs/scripts/fixtures/content-baseline.json index ffcc9397ea8..3dfaad6d2ae 100644 --- a/apps/docs/scripts/fixtures/content-baseline.json +++ b/apps/docs/scripts/fixtures/content-baseline.json @@ -12982,8 +12982,8 @@ { "lang": "text", "meta": null, - "sha256": "2143e5d8691f486425a8fb17938c12cc7875efc2b5aaf53d77685941a08835af", - "bytes": 3532, + "sha256": "6cf7c87da84d5ace685f6752652f51790aadb86153cc83330070235579ddb15d", + "bytes": 4141, "line": 7771 }, { @@ -17505,8 +17505,8 @@ { "lang": "text", "meta": null, - "sha256": "2143e5d8691f486425a8fb17938c12cc7875efc2b5aaf53d77685941a08835af", - "bytes": 3532, + "sha256": "6cf7c87da84d5ace685f6752652f51790aadb86153cc83330070235579ddb15d", + "bytes": 4141, "line": 340 }, { diff --git a/apps/sim/blocks/blocks/table.ts b/apps/sim/blocks/blocks/table.ts index 6c666870418..0eba39cf6bc 100644 --- a/apps/sim/blocks/blocks/table.ts +++ b/apps/sim/blocks/blocks/table.ts @@ -12,6 +12,8 @@ import { TABLE_IGNORED_COLUMNS_OUTPUT, TABLE_OUTPUT_COLUMNS_INPUT, TABLE_OUTPUT_COLUMNS_SUBBLOCK, + TABLE_ROW_OUTPUT, + TABLE_ROWS_OUTPUT, toolCallArg, } from '@/blocks/utils' import { TABLE_ID_PARAM } from '@/tools/table/params' @@ -816,24 +818,13 @@ Return ONLY the sort JSON:`, outputs: { success: { type: 'boolean', description: 'Operation success status' }, - row: { - type: 'json', - description: 'Single row data', - condition: { - field: 'operation', - value: ['get_row', 'insert_row', 'upsert_row', 'update_row'], - }, - }, + row: TABLE_ROW_OUTPUT, operation: { type: 'string', description: 'Operation performed (insert or update)', condition: { field: 'operation', value: 'upsert_row' }, }, - rows: { - type: 'array', - description: 'Array of rows', - condition: { field: 'operation', value: ['query_rows', 'batch_insert_rows'] }, - }, + rows: TABLE_ROWS_OUTPUT, rowCount: { type: 'number', description: 'Rows returned (query) or total rows in the table (get schema)', diff --git a/apps/sim/blocks/blocks/table_v2.ts b/apps/sim/blocks/blocks/table_v2.ts index a0e7a6735c6..7c260cc254e 100644 --- a/apps/sim/blocks/blocks/table_v2.ts +++ b/apps/sim/blocks/blocks/table_v2.ts @@ -19,6 +19,8 @@ import { TABLE_IGNORED_COLUMNS_OUTPUT, TABLE_OUTPUT_COLUMNS_INPUT, TABLE_OUTPUT_COLUMNS_SUBBLOCK, + TABLE_ROW_OUTPUT, + TABLE_ROWS_OUTPUT, toolCallArg, } from '@/blocks/utils' import { TABLE_ID_PARAM } from '@/tools/table/params' @@ -611,24 +613,13 @@ Return ONLY the JSON object:`, outputs: { success: { type: 'boolean', description: 'Operation success status' }, - row: { - type: 'json', - description: 'Single row data', - condition: { - field: 'operation', - value: ['get_row', 'insert_row', 'upsert_row', 'update_row'], - }, - }, + row: TABLE_ROW_OUTPUT, operation: { type: 'string', description: 'Operation performed (insert or update)', condition: { field: 'operation', value: 'upsert_row' }, }, - rows: { - type: 'array', - description: 'Array of rows', - condition: { field: 'operation', value: ['query_rows', 'batch_insert_rows'] }, - }, + rows: TABLE_ROWS_OUTPUT, rowCount: { type: 'number', description: 'Rows returned (query) or total rows in the table (get schema)', diff --git a/apps/sim/blocks/utils.ts b/apps/sim/blocks/utils.ts index 4761f882323..cc0bcff444e 100644 --- a/apps/sim/blocks/utils.ts +++ b/apps/sim/blocks/utils.ts @@ -942,6 +942,42 @@ export const TABLE_IGNORED_COLUMNS_OUTPUT = { }, } satisfies OutputFieldDefinition +/** + * One row as the Table blocks output it (`presentNamedTableRow` and `presentNamedTableQueryRow` + * in `lib/internal/table/presentation.ts`): its cells sit under `data`, keyed by column name. + */ +const TABLE_ROW_PROPERTIES = { + id: { type: 'string', description: 'Row ID' }, + data: { type: 'json', description: 'The row’s cells, keyed by column name' }, + position: { type: 'number', description: 'Row position in the table' }, + orderKey: { type: 'string', description: 'Sort key (query and insert results only)' }, + executions: { + type: 'json', + description: 'Workflow run state per column group (query and insert results only)', + }, + createdAt: { type: 'string', description: 'ISO timestamp when the row was created' }, + updatedAt: { type: 'string', description: 'ISO timestamp when the row was last updated' }, +} satisfies Record + +/** The `row` output of the Table blocks: a cell reads as `row.data.`. */ +export const TABLE_ROW_OUTPUT = { + type: 'json', + description: 'The row: its cells are row.data.', + condition: { + field: 'operation', + value: ['get_row', 'insert_row', 'upsert_row', 'update_row'], + }, + properties: TABLE_ROW_PROPERTIES, +} satisfies OutputFieldDefinition + +/** The `rows` output of the Table blocks: a cell reads as `rows[i].data.`. */ +export const TABLE_ROWS_OUTPUT = { + type: 'array', + description: 'The rows: a cell is rows[i].data.', + condition: { field: 'operation', value: ['query_rows', 'batch_insert_rows'] }, + items: { type: 'json', properties: TABLE_ROW_PROPERTIES }, +} satisfies OutputFieldDefinition + /** Block input entry for {@link TABLE_OUTPUT_COLUMNS_SUBBLOCK}. */ export const TABLE_OUTPUT_COLUMNS_INPUT = { type: 'array', diff --git a/apps/sim/lib/api/contracts/tables.ts b/apps/sim/lib/api/contracts/tables.ts index 1c61bda723b..b86c491f6db 100644 --- a/apps/sim/lib/api/contracts/tables.ts +++ b/apps/sim/lib/api/contracts/tables.ts @@ -49,13 +49,21 @@ import { export const domainObjectSchema = () => z.custom(isRecordLike) +/** Column types the server accepts but the public documents leave out. */ +const UNDOCUMENTED_COLUMN_TYPES: readonly string[] = ['ttl'] + /** * Column types are a fixed enum derived from `COLUMN_TYPES` so callers cannot * send arbitrary strings the server would reject downstream. */ export const columnTypeSchema = z .enum(COLUMN_TYPES) - .meta({ omitEnumValuesFromOpenApi: ['ttl'] as const }) + .meta({ omitEnumValuesFromOpenApi: UNDOCUMENTED_COLUMN_TYPES }) + +/** The sentence naming the public column types, for the column inputs' help. */ +export const COLUMN_TYPES_HELP = `A column's type is one of ${COLUMN_TYPES.filter( + (type) => !UNDOCUMENTED_COLUMN_TYPES.includes(type) +).join(', ')}; a select column also takes options.` /** One choice in a `select` column. `id` is the stable cell key. */ export const selectOptionSchema = z.object({ diff --git a/apps/sim/lib/api/contracts/v2/catalog.ts b/apps/sim/lib/api/contracts/v2/catalog.ts index 9d35456d248..7143c302379 100644 --- a/apps/sim/lib/api/contracts/v2/catalog.ts +++ b/apps/sim/lib/api/contracts/v2/catalog.ts @@ -303,11 +303,6 @@ export const v2BlockSummarySchema = z }) export type V2BlockSummary = z.output -const v2BlockOutputSchema = z.object({ - type: z.string().describe('Value type of the output.'), - description: z.string().optional().describe('What the output holds.'), -}) - /** Block-level input definition. */ const v2BlockInputDefinitionSchema = z.object({ type: z @@ -401,6 +396,14 @@ export const v2ToolOutputSchema = z }) export type V2ToolOutput = z.output +/** One declared output of a block, nesting the way a tool's output does. */ +const v2BlockOutputSchema = v2ToolOutputSchema.pick({ + type: true, + description: true, + properties: true, + items: true, +}) + const v2HostedApiKeySchema = z .enum(['always', 'conditional', 'none']) .describe( diff --git a/apps/sim/lib/api/contracts/v2/tables.ts b/apps/sim/lib/api/contracts/v2/tables.ts index 00d945a085a..3d0351222c3 100644 --- a/apps/sim/lib/api/contracts/v2/tables.ts +++ b/apps/sim/lib/api/contracts/v2/tables.ts @@ -7,6 +7,7 @@ import { import { addWorkflowGroupBodySchema, archivedTableIdParamsSchema, + COLUMN_TYPES_HELP, cancelTableRunsBodyBaseSchema, columnNameSchema, columnTypeSchema, @@ -517,7 +518,9 @@ export const v2CreateTableBodySchema = v1CreateTableBodySchema .describe('Initial table columns.'), }) .strict() - .describe('Initial table column definitions.'), + .describe( + `Initial table column definitions: {"columns":[{"name":"email","type":"string"}]}. ${COLUMN_TYPES_HELP}` + ), folderPath: v2FolderPathInputSchema.optional().describe('Folder in which to create the table.'), }) .strict() @@ -742,7 +745,9 @@ export const v2CreateTableColumnBodySchema = z }) .strict() .superRefine(refineColumnOptions) - .describe('Column definition to add.'), + .describe( + `Column definition to add: {"name":"status","type":"string"}. ${COLUMN_TYPES_HELP}` + ), }) .strict() diff --git a/apps/sim/lib/catalog/projection/block-detail.ts b/apps/sim/lib/catalog/projection/block-detail.ts index 92e4eb520f7..0ff9ac8796b 100644 --- a/apps/sim/lib/catalog/projection/block-detail.ts +++ b/apps/sim/lib/catalog/projection/block-detail.ts @@ -22,7 +22,12 @@ import { projectToolDetail, } from '@/lib/catalog/projection/tool' import { isCustomBlockType } from '@/blocks/custom/build-config' -import { type BlockConfig, isHiddenFromDisplay, type SubBlockConfig } from '@/blocks/types' +import { + type BlockConfig, + isHiddenFromDisplay, + type OutputFieldDefinition, + type SubBlockConfig, +} from '@/blocks/types' import { getTrigger, isTriggerValid } from '@/triggers' const logger = createLogger('CatalogBlockProjection') @@ -46,11 +51,11 @@ export interface CatalogInputDefinition { schema?: unknown } -/** A declared output of a block. */ -export interface CatalogBlockOutput { - type: string - description?: string -} +/** A declared output of a block, nesting the way a tool's output does. */ +export type CatalogBlockOutput = Pick< + CatalogToolOutput, + 'type' | 'description' | 'properties' | 'items' +> /** One operation a block exposes, resolved to the tool that performs it. */ export interface CatalogBlockOperation { @@ -328,25 +333,28 @@ export function resolveToolIdForOperation( /** Projects a block's declared outputs, dropping the ones hidden from display. */ export function projectBlockOutputs( - outputs: BlockConfig['outputs'] | undefined + outputs: Record | undefined ): Record { const projected: Record = {} for (const [key, definition] of Object.entries(outputs ?? {})) { if (isHiddenFromDisplay(definition)) continue - if (typeof definition === 'string') { - projected[key] = { type: definition } - continue - } - if (!definition || typeof definition !== 'object') continue - const entry: CatalogBlockOutput = { type: String(definition.type ?? 'any') } - if ('description' in definition && typeof definition.description === 'string') { - entry.description = definition.description - } - projected[key] = entry + projected[key] = projectBlockOutput(definition) } return projected } +function projectBlockOutput(definition: OutputFieldDefinition): CatalogBlockOutput { + if (typeof definition === 'string') return { type: definition } + const entry: CatalogBlockOutput = { type: definition.type } + if (definition.description !== undefined) entry.description = definition.description + if (definition.properties) entry.properties = projectBlockOutputs(definition.properties) + if (definition.items) { + const { items: _nested, ...element } = projectBlockOutput(definition.items) + entry.items = element + } + return entry +} + /** * Projects the triggers a block supports, with each trigger's configurable * fields. diff --git a/apps/sim/lib/catalog/projection/invariants.test.ts b/apps/sim/lib/catalog/projection/invariants.test.ts index 858cf330325..cb9361868e5 100644 --- a/apps/sim/lib/catalog/projection/invariants.test.ts +++ b/apps/sim/lib/catalog/projection/invariants.test.ts @@ -159,3 +159,36 @@ describe('a field publishes the value type its block declares, never a guessed o expect(field(detail.operationInputSchema.read ?? [], 'rowLimit')?.valueType).toBe('number') }) }) + +describe('a block output publishes its nested shape', () => { + it("keeps a json output's members and an array output's element shape", () => { + const row = { id: { type: 'string' }, data: { type: 'json', description: 'Cells' } } as const + const declared = { ...row, internal: { type: 'string', hiddenFromDisplay: true } } as const + const config = block({ + type: 'rows', + outputs: { + row: { + type: 'json', + description: 'One row', + condition: { field: 'operation', value: 'get_row' }, + properties: declared, + }, + rows: { type: 'array', items: { type: 'json', properties: declared } }, + }, + }) + expect(projectBlockDetail(config, { deployment: { hostedKeys: false } }).outputs).toEqual({ + row: { + type: 'json', + description: 'One row', + properties: row, + }, + rows: { + type: 'array', + items: { + type: 'json', + properties: row, + }, + }, + }) + }) +}) diff --git a/apps/sim/lib/workflows/blocks/jev-outputs.ts b/apps/sim/lib/workflows/blocks/jev-outputs.ts index e2545e4bda1..358c6b93651 100644 --- a/apps/sim/lib/workflows/blocks/jev-outputs.ts +++ b/apps/sim/lib/workflows/blocks/jev-outputs.ts @@ -1,6 +1,6 @@ import { isRecordLike } from '@sim/utils/object' +import type { OutputFieldDefinition } from '@sim/workflow-types/blocks' import type { JevAnswer } from '@/providers/typesafe/types' -import type { OutputProperty } from '@/tools/types' const ANSWER_FIELDS = { choice: { @@ -21,16 +21,17 @@ const ANSWER_FIELDS = { type: { type: 'string' }, }, } satisfies { - [Type in JevAnswer['type']]: Record, OutputProperty> + [Type in JevAnswer['type']]: Record< + keyof Extract, + OutputFieldDefinition + > } /** * Describes answers known from the editor's questions without requiring resolved inputs. * Keys containing reference syntax remain accessible through the whole answers object. */ -export function getJevAnswerOutput( - questions: unknown -): (OutputProperty & { type: 'json' }) | undefined { +export function getJevAnswerOutput(questions: unknown): OutputFieldDefinition | undefined { if (typeof questions === 'string') { try { questions = JSON.parse(questions) @@ -40,7 +41,7 @@ export function getJevAnswerOutput( } if (!isRecordLike(questions)) return undefined - const entries: Array<[string, OutputProperty]> = [] + const entries: Array<[string, OutputFieldDefinition]> = [] for (const [id, question] of Object.entries(questions)) { if (!/^[\w-]+$/.test(id) || !isRecordLike(question)) continue const { type } = question diff --git a/apps/sim/lib/workflows/blocks/outputs.ts b/apps/sim/lib/workflows/blocks/outputs.ts index 7ae11bace4a..423d86a3366 100644 --- a/apps/sim/lib/workflows/blocks/outputs.ts +++ b/apps/sim/lib/workflows/blocks/outputs.ts @@ -156,7 +156,7 @@ const CHAT_OUTPUTS: OutputDefinition = { files: { type: 'file[]', description: 'Uploaded files' }, } -const START_RUN_METADATA_OUTPUT = { +const START_RUN_METADATA_OUTPUT: OutputFieldDefinition = { type: 'json', description: 'Trusted run metadata (server-injected)', properties: { @@ -201,7 +201,7 @@ const START_RUN_METADATA_OUTPUT = { executionMode: { type: 'string', description: 'Execution mode: sync, stream, or async' }, startTime: { type: 'string', description: 'ISO timestamp when the execution started' }, }, -} as OutputFieldDefinition +} function applyInputFormatFields( inputFormat: InputFormatField[], diff --git a/apps/sim/lib/workflows/code/source-mistakes.test.ts b/apps/sim/lib/workflows/code/source-mistakes.test.ts index 888b859f153..5ffc02b12c7 100644 --- a/apps/sim/lib/workflows/code/source-mistakes.test.ts +++ b/apps/sim/lib/workflows/code/source-mistakes.test.ts @@ -146,4 +146,18 @@ export default workflow('Sync', {}, () => { "Save the token as a workspace credential and write credential: credential(''), so the token never sits in the workflow." ) }) + + it("names a table row's members when a cell is read off the row instead of its data", () => { + const result = compile( + probe('text: t`Answer: ${ask.content}`', 'text: t`Tier: ${save.row.tier}`') + ) + expect(findings(result)).toEqual(['W_UNKNOWN_OUTPUT_PATH 21: Save has no output row.tier.']) + expect(only(result, 'W_UNKNOWN_OUTPUT_PATH')?.hint).toBe( + 'row holds: id, data, position, orderKey, executions, createdAt, updatedAt.' + ) + const cell = compile( + probe('text: t`Answer: ${ask.content}`', 'text: t`Tier: ${save.row.data.tier}`') + ) + expect(findings(cell)).toEqual([]) + }) }) diff --git a/packages/sim-cli/src/commands/protocol/source-loop-help.ts b/packages/sim-cli/src/commands/protocol/source-loop-help.ts index 00aa7dda37a..a7904e1014d 100644 --- a/packages/sim-cli/src/commands/protocol/source-loop-help.ts +++ b/packages/sim-cli/src/commands/protocol/source-loop-help.ts @@ -44,6 +44,8 @@ run; --no-types skips it). For review, \`apply --dry-run\` prints the plan and w A new workflow: \`sim workflows source create --dir ./new --workspace \` writes a starter that records its workspace; edit and check it, then \`create --dir ./new --yes\` creates the workflow there, and the loop above goes on from there. +A workflow's source holds that workflow alone: a table, its columns and rows, and every other +workspace resource are edited with \`sim workspaces source\` (or the \`sim tables\` commands). ${WORKSPACE_LINE} ${RUN_LOGS_LINE} diff --git a/packages/sim-cli/src/commands/protocol/source-primer.ts b/packages/sim-cli/src/commands/protocol/source-primer.ts index 8fea762be25..abfa3743da4 100644 --- a/packages/sim-cli/src/commands/protocol/source-primer.ts +++ b/packages/sim-cli/src/commands/protocol/source-primer.ts @@ -40,12 +40,12 @@ const PARAMS_COMMAND = 'sim workflows source params' /** The rules every source directory shares, after the kind's own edit loop. */ function sharedRules(group: string, extraRenames = ''): string { - return `- **Identity**: a block is its entry in \`${SOURCE_LOCK_FILE}\`, which binds it by its const name or its display name. Change the display name (first argument) freely: references through the const follow it, and the apply rewrites every \`$ref.\` and \`\` for you. Renaming the const too keeps it when settings, neighbours or references still tie it to the old block; otherwise the apply refuses a delete (\`E_APPLY_BLOCK_DELETE\`). -- **References**: in \`${SOURCE_ENTRY_FILE}\` read an output as \`x.content\`, a loop or parallel item as \`p.currentItem\` (\`p.index\`), text as \`\` t\`…\` \`\`, env as \`env.NAME\`. In a function file (\`codeFile('./functions/x.js')\`) read an output as \`$ref..\`, the key: the display name lowercased, whitespace and dots removed ("Triage Agent" → \`$ref.triageagent.content\`); in a loop body \`$ref.loop.currentItem\` / \`$ref.loop.index\`, in a parallel \`$ref.parallel.currentItem\` / \`$ref.parallel.index\`; env as \`$env.NAME\`. In \`.py\`/\`.sh\` files write \`\` and \`{{NAME}}\`, not \`$ref\`/\`$env\`. Read an index or item only inside its container (\`E_APPLY_REF_OUT_OF_SCOPE\`), after it its \`.results\`. A \`$ref\` naming no block is an error in a function file you edited (\`E_APPLY_UNRESOLVED_REF\`). + return `- **Identity**: a block is its entry in \`${SOURCE_LOCK_FILE}\`, which binds it by its const name or its display name. Change the display name (first argument) freely: the apply rewrites every reference to it. Renaming the const too keeps it when settings, neighbours or references still tie it to the old block; otherwise the apply refuses a delete (\`E_APPLY_BLOCK_DELETE\`). +- **References**: in \`${SOURCE_ENTRY_FILE}\` read an output as \`x.content\`, a loop or parallel item as \`p.currentItem\` (\`p.index\`), a child workflow's response field as \`c.result.data.\`, text as \`\` t\`…\` \`\`, env as \`env.NAME\`. In a function file (\`codeFile('./functions/x.js')\`) read an output as \`$ref..\`, the key: the display name lowercased, whitespace and dots removed ("Triage Agent" → \`$ref.triageagent.content\`); in a loop body \`$ref.loop.currentItem\` / \`$ref.loop.index\` (a parallel: \`$ref.parallel.…\`); env as \`$env.NAME\`. In \`.py\`/\`.sh\` files write \`\` and \`{{NAME}}\`, not \`$ref\`/\`$env\`. Read an index or item only inside its container (\`E_APPLY_REF_OUT_OF_SCOPE\`), after it its \`.results\`. A \`$ref\` naming no block is an error in a function file you edited (\`E_APPLY_UNRESOLVED_REF\`). - **Renames**: one variable per apply (two at once read as a delete and an add).${extraRenames} - **Look up a builder**: \`${PARAMS_COMMAND} \` (a namespace like \`gmail\` lists them). - **Credentials**: \`sim credentials connect --name ""\`, give the owner its link, then \`credential('')\` (\`sim workflows source resources\`). -- **Failures**: \`x.onError(y)\` runs \`y\` when \`x\` fails, reading the message as \`x.error\` (a Function's \`x.errorMessage\` drops the line and code: reply with it). Retry is block meta (third argument): \`agent('Name', {…}, { retry: { enabled: true, maxTries: 3, waitBetweenTriesMs: 2000 } })\`. A reference to a block that did not run is \`null\` (a whole value, function code, a condition) or \`''\` in text. Branches may rejoin; only branches that end separately each need a \`response\`. +- **Failures**: \`x.onError(y)\` runs \`y\` when \`x\` fails, reading the message as \`x.error\` (a Function's \`x.errorMessage\` drops the line and code: reply with it). Retry is block meta (third argument): \`agent('Name', {…}, { retry: { enabled: true, maxTries: 3, waitBetweenTriesMs: 2000 } })\` reruns the whole block after a failure; an \`api\` block's \`retries\` repeat only the request (timeout, reset, 429, 5xx) inside each try. A reference to a block that did not run is \`null\` (a whole value, function code, a condition) or \`''\` in text. Branches may rejoin; only branches that end separately each need a \`response\`. - **Run and debug**: \`--manual\` runs the saved draft, without it the deployed version. Runs write real data (rows, emails): use test resources. With \`--dir \`, a failed run names the failing file and line; then \`sim logs get --trace --no-include-workflow-state\`; rows: \`sim tables rows list \`. - **Exit codes**: 0 ok, 1 errors, ${SOURCE_STALE_EXIT_CODE} stale (\`${group} get --dir \`, redo the edit there), ${RATE_LIMITED_EXIT_CODE} rate limited, ${SOURCE_BUSY_EXIT_CODE} busy, ${SOURCE_LOCAL_CHANGES_EXIT_CODE}/${SOURCE_DRIFT_EXIT_CODE} \`status\`: your edits / the server changed.` } @@ -54,7 +54,7 @@ const WORKFLOW_PRIMER = `# Sim workflow source: primer \`${SOURCE_ENTRY_FILE}\` is a Sim workflow as TypeScript; the server compiles it statically and nothing in it runs. Commands read the workflow id from \`${SOURCE_BASE_FILE}\`; run them from this directory. -**Edit loop**: write every file, then run one chained command and fix what it reports next: \`sim workflows source check --dir . && sim workflows source apply --dir . --yes && sim workflows run --manual --input '{…}'\`. A non-zero exit stops the chain. \`check\` compiles and type-checks (no separate \`tsc\`). Apply re-checks the source and its base, so \`apply --dry-run\` is only the review for people and CI. Apply saves the draft in canonical form: read \`${SOURCE_ENTRY_FILE}\` again before the next edit. +**Edit loop**: write every file, then run one chained command and fix what it reports next: \`sim workflows source check --dir . && sim workflows source apply --dir . --yes && sim workflows run --manual --input '{…}'\`. A non-zero exit stops the chain. \`check\` compiles and type-checks (no separate \`tsc\`). Apply re-checks, so \`apply --dry-run\` is only for review. Apply saves the draft in canonical form: read \`${SOURCE_ENTRY_FILE}\` again before the next edit. - **Deletes**: removing a block or a variable needs \`apply --allow-delete\` (\`E_APPLY_BLOCK_DELETE\` / \`E_APPLY_VARIABLE_DELETE\`). - **Deploy**: apply saves a draft; \`apply --deploy\` also deploys it, or \`sim workflows deploy \` publishes the saved draft later. @@ -69,9 +69,9 @@ const WORKSPACE_PRIMER = `# Sim workspace source: primer This directory is a Sim workspace as files (\`tables/\`, \`workflows//workflow.ts\`, …); nothing in it runs. Commands read the workspace id from \`${SOURCE_BASE_FILE}\`; run them from this directory. Every \`.ts\` file, \`deployments/\` too, starts with \`// @sim-sdk ${SDK_MAJOR}\`. -**Edit loop**: write every file, then run one chained command and fix what it reports next: \`sim workspaces source check --dir . && sim workspaces source apply --dir . --yes\` (add a \`sim workflows run\` to test). A non-zero exit stops the chain. \`check\` compiles and type-checks (no separate \`tsc\`). Apply re-checks the source and its base, so \`apply --dry-run\` is only the review for people and CI. Apply rewrites the directory: read a file again before the next edit. +**Edit loop**: write every file, then run one chained command and fix what it reports next: \`sim workspaces source check --dir . && sim workspaces source apply --dir . --yes\`; test with \`sim workflows run --manual --input '{…}'\`. A non-zero exit stops the chain. \`check\` compiles and type-checks (no separate \`tsc\`). Apply re-checks, so \`apply --dry-run\` is only for review. Apply rewrites files: read one again before editing it. -- **Deletes**: a file or folder missing from a kind's folder, or a removed table column, workflow block or variable, is a delete: refused without \`apply --allow-delete\`, and it cannot be undone. +- **Deletes**: removing a file, folder, table column, workflow block or variable is a delete: refused without \`apply --allow-delete\`, and it cannot be undone. - **Deploy**: \`deployments/.ts\` (\`defineDeployment({ live: 'draft' })\`) deploys that workflow on apply; without one, apply never deploys. - **Exit ${SOURCE_HELD_EXIT_CODE}**: written in part; changes using an unset secret or unbound credential were held back: set it, apply again. ${sharedRules('sim workspaces source', WORKSPACE_RENAMES)} diff --git a/packages/sim-cli/src/contract/commands.ts b/packages/sim-cli/src/contract/commands.ts index d9c5efd99f5..8ea7199d769 100644 --- a/packages/sim-cli/src/contract/commands.ts +++ b/packages/sim-cli/src/contract/commands.ts @@ -69,7 +69,9 @@ Edges: connections maps a source handle to its targets: {"source":""}, {"source":["",""]}, or {"source":{"block":"","handle":""}}; "success" is an alias of "source". An add's connections create the new block's edges. An edit's connections REPLACE every - outgoing edge of that block, on every handle: list again each edge to keep. + outgoing edge of that block, on every handle: list again each edge to keep; {} removes them all. + A block moved into or out of a loop or parallel (parentId) loses every edge that would cross the + container's boundary: to leave the loop, wire its loop-end-source (parallel-end-source). To remove one edge, edit its source block with {"removeEdges":[{"targetBlockId":"","sourceHandle":"source"}]} (sourceHandle defaults to "source"). @@ -82,12 +84,14 @@ Source handles: parallel-start-source, parallel-end-source the same for a parallel Renames: An edit's {"name":"New name"} also rewrites every reference to the block, in - other blocks' inputs and in a loop's or parallel's collection and condition. + other blocks' inputs and in a loop's or parallel's collection and condition. Edits run after the + batch's adds, so a block added in the same batch is rewritten too. Inputs: inputs takes the field ids \`sim blocks get \` lists (inputSchema, operationInputSchema), or the name a pair of them shares (inputDefinitions: tableId for tableSelector and manualTableId; a string goes to the typed field). Add the type it answers with: \`blocks get - table\` answers table_v2, and an add of legacy table is refused. + table\` answers table_v2, and an add of legacy table is refused. An edit's inputs replace each + field they name whole (a responseFormat schema too) and keep the fields they do not name. conditions (condition): [{"title":"if","value":" > 3"},{"title":"else if","value":"…"}, {"title":"else","value":""}]; the last entry is the else. Each entry's id comes from its position (-if, -else-if-0, …, -else): an id you pass is replaced. @@ -96,14 +100,16 @@ Inputs: Block settings, beside inputs in an add's or edit's params: "retry":{"enabled":true,"maxTries":3,"waitBetweenTriesMs":1000} retries a failed block; null clears it. An api block's retries input repeats the request after a timeout, reset, 429 or - 5xx, not when the host does not resolve or refuses the connection; "retry" covers that. + 5xx, not when the host does not resolve or refuses the connection; "retry" covers that. They + nest: every try of "retry" runs the request with its retries. Outputs: A block that fails outputs {"error":""}: connect its error handle and read there (without one, the run fails). A Function's error leads with the line and code that threw; its is the thrown message alone, the one to reply with. A Workflow block's result is the child's output; a child ending in a Response block gives {data, status, headers}, so read - . + . A Table block's row holds its cells under data: read a cell as + (). References: Inside a loop or parallel body read and , or and ; after it, . A reference to a block @@ -917,10 +923,7 @@ export const CLI_CONTRACT: CliContract = { flags: { name: { describe: TABLE_NAME_HELP }, folderPath: FOLDER_PATH_FLAG, - schema: { - json: true, - describe: 'Table schema: {"columns":[{"name":"email","type":"string"}]}', - }, + schema: { json: true }, }, }, updateTable: { diff --git a/packages/sim-cli/src/generated/v2-api.ts b/packages/sim-cli/src/generated/v2-api.ts index 1b9cc195655..5260bb25d56 100644 --- a/packages/sim-cli/src/generated/v2-api.ts +++ b/packages/sim-cli/src/generated/v2-api.ts @@ -7598,6 +7598,12 @@ type GetBlockResponseRef6 = { { type: string description?: string + properties?: Record + items?: { + type: string + description?: string + properties?: Record + } } > configFields: Record< @@ -7630,6 +7636,12 @@ type GetBlockResponseRef6 = { { type: string description?: string + properties?: Record + items?: { + type: string + description?: string + properties?: Record + } } > } @@ -20640,7 +20652,12 @@ export const V2_OPERATIONS = { summary: 'Add column', body: { workspaceId: { kind: 'string', required: true, describe: 'Workspace that owns the table.' }, - column: { kind: 'object', required: true, describe: 'Column definition to add.' }, + column: { + kind: 'object', + required: true, + describe: + 'Column definition to add: {"name":"status","type":"string"}. A column\'s type is one of string, number, currency, boolean, date, json, select; a select column also takes options.', + }, }, }, addWorkflowGroup: { @@ -22219,7 +22236,12 @@ export const V2_OPERATIONS = { name: { kind: 'string', required: true, describe: 'Table name.' }, description: { kind: 'string', describe: 'Optional table description.' }, workspaceId: { kind: 'string', required: true, describe: 'Unique workspace identifier.' }, - schema: { kind: 'object', required: true, describe: 'Initial table column definitions.' }, + schema: { + kind: 'object', + required: true, + describe: + 'Initial table column definitions: {"columns":[{"name":"email","type":"string"}]}. A column\'s type is one of string, number, currency, boolean, date, json, select; a select column also takes options.', + }, folderPath: { kind: 'string', describe: 'Folder in which to create the table.' }, }, }, diff --git a/packages/workflow-sdk/src/codegen/generate.test.ts b/packages/workflow-sdk/src/codegen/generate.test.ts index 86498133ce9..e3405496773 100644 --- a/packages/workflow-sdk/src/codegen/generate.test.ts +++ b/packages/workflow-sdk/src/codegen/generate.test.ts @@ -135,6 +135,16 @@ describe('the SDK layout', () => { expect(index).not.toContain("import './blocks/slack'\n") }) + it("names the params a special builder's core.d.ts declaration adds on its params type", () => { + const human = generateSdkTypes(loadCatalog()).find( + (file) => file.path === 'blocks/human_in_the_loop_v2.d.ts' + ) + + expect(human?.text).toMatch( + /\/\*\*[^/]*`inputFormat`[^/]*core\.d\.ts[^/]*\*\/\nexport type HumanParams = \{/ + ) + }) + it('lists the operations of a block in its namespace doc comment', () => { const slack = generateSdkTypes(loadCatalog()).find( (file) => file.path === 'blocks/slack_v2.d.ts' diff --git a/packages/workflow-sdk/src/codegen/generate.ts b/packages/workflow-sdk/src/codegen/generate.ts index 33cfd2b7339..84445c04fc7 100644 --- a/packages/workflow-sdk/src/codegen/generate.ts +++ b/packages/workflow-sdk/src/codegen/generate.ts @@ -123,9 +123,14 @@ const HEADER_PREFIX = '// @sim-sdk' * What a builder does at run time that its params cannot show, said in its doc comment and in * `sim workflows source params`. `table.upsertRow`: `upsertRow` in * `apps/sim/lib/table/rows/service.ts` writes the stored row's whole `data`, where the update - * builders merge cells (`jsonbMergePatch`). + * builders merge cells (`jsonbMergePatch`). `table.queryRows`: `rowQueryBodySchema` in + * `apps/sim/lib/api/contracts/tables.ts` bounds `limit` below only, and `queryRows` in the same + * service cuts a page at `TABLE_LIMITS.MAX_QUERY_RESULT_BYTES`, setting `nextCursor` while more + * rows match. */ const BUILDER_NOTES: Readonly> = { + 'table.queryRows': + '`limit` has no maximum and no default: omitted, every matching row comes back in one page, and the query fails past 5 MiB of rows. With a `limit`, a page can also end early at the byte budget, so page by passing `nextCursor` back as `cursor` until it is `null`; never stop on a short page.', 'table.upsertRow': 'Replaces the matched row: a column missing from `data` is cleared, not kept. To change some columns of existing rows, use `table.updateRowsByFilter` (or `table.updateRowById` for one row), which merge `data` into the stored row.', } @@ -492,7 +497,20 @@ export function builderTypes(catalog: BlockCatalog, entry: BuilderEntry): Builde const genericArgs = plan ? `<${plan.typeParameter.name}>` : '' const outputGeneric = plan && Object.keys(plan.outputOverrides).length > 0 const members = builderOutputs(outputs, context, plan?.outputOverrides ?? {}, nullable) - const paramsDeclaration = `export type ${paramsName}${generic} = ${renderParamsType(params, gate, candidates, context.pinned)}` + const coreParams = entry.special?.coreParams ?? [] + const paramsDoc = + coreParams.length > 0 + ? jsdoc( + [ + `\`${entry.key}()\` also takes ${coreParams.map((name) => `\`${name}\``).join(', ')}, typed on its declaration in core.d.ts.`, + ], + '' + ) + : [] + const paramsDeclaration = [ + ...paramsDoc, + `export type ${paramsName}${generic} = ${renderParamsType(params, gate, candidates, context.pinned)}`, + ].join('\n') const output: BuilderOutput = { name: outputName, typeParameters: outputGeneric ? generic : '', diff --git a/packages/workflow-sdk/test/fixtures/catalog.json b/packages/workflow-sdk/test/fixtures/catalog.json index b91ab6aa8f8..e4edcebb700 100644 --- a/packages/workflow-sdk/test/fixtures/catalog.json +++ b/packages/workflow-sdk/test/fixtures/catalog.json @@ -32001,7 +32001,7 @@ }, "row": { "type": "json", - "description": "Single row data", + "description": "The row: its cells are row.data.", "condition": { "field": "operation", "value": [ @@ -32010,6 +32010,36 @@ "upsert_row", "update_row" ] + }, + "properties": { + "id": { + "type": "string", + "description": "Row ID" + }, + "data": { + "type": "json", + "description": "The row’s cells, keyed by column name" + }, + "position": { + "type": "number", + "description": "Row position in the table" + }, + "orderKey": { + "type": "string", + "description": "Sort key (query and insert results only)" + }, + "executions": { + "type": "json", + "description": "Workflow run state per column group (query and insert results only)" + }, + "createdAt": { + "type": "string", + "description": "ISO timestamp when the row was created" + }, + "updatedAt": { + "type": "string", + "description": "ISO timestamp when the row was last updated" + } } }, "operation": { @@ -32022,13 +32052,46 @@ }, "rows": { "type": "array", - "description": "Array of rows", + "description": "The rows: a cell is rows[i].data.", "condition": { "field": "operation", "value": [ "query_rows", "batch_insert_rows" ] + }, + "items": { + "type": "json", + "properties": { + "id": { + "type": "string", + "description": "Row ID" + }, + "data": { + "type": "json", + "description": "The row’s cells, keyed by column name" + }, + "position": { + "type": "number", + "description": "Row position in the table" + }, + "orderKey": { + "type": "string", + "description": "Sort key (query and insert results only)" + }, + "executions": { + "type": "json", + "description": "Workflow run state per column group (query and insert results only)" + }, + "createdAt": { + "type": "string", + "description": "ISO timestamp when the row was created" + }, + "updatedAt": { + "type": "string", + "description": "ISO timestamp when the row was last updated" + } + } } }, "rowCount": { diff --git a/packages/workflow-types/src/blocks.ts b/packages/workflow-types/src/blocks.ts index 32fbe39d20d..2d0037061b5 100644 --- a/packages/workflow-types/src/blocks.ts +++ b/packages/workflow-types/src/blocks.ts @@ -90,6 +90,10 @@ export type OutputFieldDefinition = * Workflow source stores a bare reference to it in JSON text as untyped. */ mayBeText?: boolean + /** The members of a `json` output, keyed by field name. */ + properties?: Record + /** The element shape of an `array` output. */ + items?: OutputFieldDefinition } export function isHiddenFromDisplay(def: unknown): boolean {