From 73998173a8a2f2ba752410f16fa0b76ae48a826b Mon Sep 17 00:00:00 2001 From: yeuimu <2197651308@qq.com> Date: Wed, 12 Aug 2026 03:59:12 +0000 Subject: [PATCH] docs(skill): update formSubmitted trigger docs for multi-form support Reflect the formId(formId) -> formIds[] change across skill + CLI + docs: - skill api-reference/trigger-types.md: formIds array config + legacy note - skill guides (automation-guide.md, cli-reference.md): --form-ids - inkreach-cli: add --form-ids option (csv parse), keep --form-id legacy - docs/automation/triggers.md: P1 formSubmitted marked done - docs/automation/README.md: formSubmitted config fields updated --- .../api-reference/trigger-types.md | 11 ++-- .../guides/automation-guide.md | 2 +- .../inkreach-teable/guides/cli-reference.md | 2 +- dist/commands/workflow.js | 52 +++++++++++++++---- src/commands/workflow.ts | 17 +++++- 5 files changed, 67 insertions(+), 17 deletions(-) diff --git a/.agents/skills/inkreach-teable/api-reference/trigger-types.md b/.agents/skills/inkreach-teable/api-reference/trigger-types.md index c90d417..f6660e9 100644 --- a/.agents/skills/inkreach-teable/api-reference/trigger-types.md +++ b/.agents/skills/inkreach-teable/api-reference/trigger-types.md @@ -122,14 +122,19 @@ inkreach-teable trigger set --type recordCreatedOrUpdated --table-id tblX ## 5. formSubmitted — When a form is submitted ```bash -inkreach-teable trigger set --type formSubmitted --table-id tblXXX --form-id viwXXX +inkreach-teable trigger set --type formSubmitted --table-id tblXXX --form-ids 'viwXXX1,viwXXX2' ``` **Config:** ```json -{ "tableId": "tblXXX", "formId": "viwXXX" } +{ "tableId": "tblXXX", "formIds": ["viwXXX1", "viwXXX2"] } ``` -- `formId` is the **form view's id** (a view of type `form`). +- `formIds` is an array of **form view ids** (views of type `form`). The trigger + fires when **any** of the listed forms is submitted. +- **Legacy compatibility:** the older single-string `formId` key is still + accepted (migrated to `[formId]` automatically), so existing workflows keep + working. +- An empty `formIds` array means the trigger never fires. **Output:** `record.id`, `record.fields.*`, `user`, `tableId`, `formId`. diff --git a/.agents/skills/inkreach-teable/guides/automation-guide.md b/.agents/skills/inkreach-teable/guides/automation-guide.md index 0e4d078..bc58361 100644 --- a/.agents/skills/inkreach-teable/guides/automation-guide.md +++ b/.agents/skills/inkreach-teable/guides/automation-guide.md @@ -44,7 +44,7 @@ Automations (workflows) are event-driven: a **trigger** fires, then **actions** | React to record changes | `recordUpdated` | `--table-id`, `--field-ids` (empty = all) | | React when a condition matches | `recordCondition` | `--table-id`, `--conditions` (required) | | React to create OR update | `recordCreatedOrUpdated` | `--table-id`, `--conditions` (optional) | -| Form submission | `formSubmitted` | `--table-id`, `--form-id` | +| Form submission | `formSubmitted` | `--table-id`, `--form-ids ` | | Schedule (only type+interval work) | `scheduledTime` | `--schedule '{"timing":{"type":"minutes","interval":5}}'` | | Button field click | `buttonClick` | `--table-id`, `--field-ids` | | External HTTP POST | `webhook` | (none; auth backend-ignored) | diff --git a/.agents/skills/inkreach-teable/guides/cli-reference.md b/.agents/skills/inkreach-teable/guides/cli-reference.md index bdd79a4..e751829 100644 --- a/.agents/skills/inkreach-teable/guides/cli-reference.md +++ b/.agents/skills/inkreach-teable/guides/cli-reference.md @@ -93,7 +93,7 @@ inkreach-teable trigger set --type [options] [--base-id ] | `recordUpdated` | `--table-id`, `--field-ids ''` | | `recordCondition` | `--table-id`, `--conditions ''` | | `recordCreatedOrUpdated` | `--table-id` | -| `formSubmitted` | `--table-id`, `--form-id ` | +| `formSubmitted` | `--table-id`, `--form-ids ` | | `scheduledTime` | `--schedule '{"timing":{"type":"minutes","interval":5}}'` | | `buttonClick` | `--table-id`, `--field-ids ''` | | `webhook` | (none) | diff --git a/dist/commands/workflow.js b/dist/commands/workflow.js index dd71a0d..2ec46a9 100644 --- a/dist/commands/workflow.js +++ b/dist/commands/workflow.js @@ -158,7 +158,10 @@ function workflowCommand() { if (ctx.json) (0, output_1.printJson)({ ok: true, ...res }); else - (0, output_1.printKv)([['snapshotId', res.snapshotId], ['status', 'activated']]); + (0, output_1.printKv)([ + ['snapshotId', res.snapshotId], + ['status', 'activated'], + ]); })); cmd .command('deactivate ') @@ -206,8 +209,14 @@ function workflowCommand() { exports.workflowCommand = workflowCommand; // ===================== trigger ===================== const TRIGGER_TYPES = [ - 'recordCreated', 'recordUpdated', 'recordCondition', 'recordCreatedOrUpdated', - 'formSubmitted', 'scheduledTime', 'buttonClick', 'webhook', + 'recordCreated', + 'recordUpdated', + 'recordCondition', + 'recordCreatedOrUpdated', + 'formSubmitted', + 'scheduledTime', + 'buttonClick', + 'webhook', ]; function triggerCommand() { const cmd = new commander_1.Command('trigger'); @@ -218,7 +227,8 @@ function triggerCommand() { .requiredOption('--type ', `Trigger type: ${TRIGGER_TYPES.join('|')}`) .option('--table-id ', 'Table id (most record/button triggers)') .option('--field-ids ', 'Field ids JSON array, e.g. \'["fldXXX"]\' (recordUpdated, buttonClick)') - .option('--form-id ', 'Form view id (formSubmitted)') + .option('--form-id ', 'Form view id (formSubmitted, legacy single). Prefer --form-ids.') + .option('--form-ids ', 'Comma-separated form view ids (formSubmitted, multi-select)') .option('--conditions ', 'Filter conditions JSON (recordCondition/recordCreated)') .option('--schedule ', 'Schedule JSON {timing:{type,interval}} (scheduledTime)') .option('--batch ', 'Batch config JSON {enabled,batchWindow,batchSize}') @@ -228,12 +238,15 @@ function triggerCommand() { const opts = o; const baseId = (0, ctx_1.requireBaseId)(ctx, opts.baseId); if (!TRIGGER_TYPES.includes(opts.type)) { - throw Object.assign(new Error(`Invalid trigger type: ${opts.type}`), { code: 'INVALID_TYPE' }); + throw Object.assign(new Error(`Invalid trigger type: ${opts.type}`), { + code: 'INVALID_TYPE', + }); } const config = buildTriggerConfig(opts.type, { tableId: opts.tableId, fieldIds: opts.fieldIds, formId: opts.formId, + formIds: opts.formIds, conditions: opts.conditions, schedule: opts.schedule, batch: opts.batch, @@ -295,14 +308,25 @@ function buildTriggerConfig(type, opts) { if (opts.tableId) config.tableId = opts.tableId; // conditions is required for recordCondition - config.conditions = opts.conditions ? parse(opts.conditions) : { conjunction: 'and', filterSet: [] }; + config.conditions = opts.conditions + ? parse(opts.conditions) + : { conjunction: 'and', filterSet: [] }; break; } case 'formSubmitted': { if (opts.tableId) config.tableId = opts.tableId; - if (opts.formId) + // Prefer --form-ids (csv) which populates formIds:string[]. Fall back to + // legacy --form-id (single string) for backward compatibility. + if (opts.formIds) { + config.formIds = opts.formIds + .split(',') + .map((s) => s.trim()) + .filter((s) => s.length > 0); + } + else if (opts.formId) { config.formId = opts.formId; + } break; } case 'scheduledTime': { @@ -328,7 +352,8 @@ function buildTriggerConfig(type, opts) { default: break; } - if (opts.batch && ['recordCreated', 'recordUpdated', 'recordCondition', 'recordCreatedOrUpdated'].includes(type)) { + if (opts.batch && + ['recordCreated', 'recordUpdated', 'recordCondition', 'recordCreatedOrUpdated'].includes(type)) { config.batch = parse(opts.batch); } return config; @@ -336,7 +361,12 @@ function buildTriggerConfig(type, opts) { exports.buildTriggerConfig = buildTriggerConfig; // ===================== action ===================== const ACTION_TYPES = [ - 'script', 'sendEmail', 'httpRequest', 'createRecord', 'updateRecord', 'getRecords', + 'script', + 'sendEmail', + 'httpRequest', + 'createRecord', + 'updateRecord', + 'getRecords', ]; function actionCommand() { const cmd = new commander_1.Command('action'); @@ -367,7 +397,9 @@ function actionCommand() { const opts = o; const baseId = (0, ctx_1.requireBaseId)(ctx, opts.baseId); if (!ACTION_TYPES.includes(opts.type)) { - throw Object.assign(new Error(`Invalid action type: ${opts.type}`), { code: 'INVALID_TYPE' }); + throw Object.assign(new Error(`Invalid action type: ${opts.type}`), { + code: 'INVALID_TYPE', + }); } const config = opts.config ? JSON.parse(opts.config) : buildActionConfig(opts); const wf = await ctx.client.getWorkflowInBase(baseId, workflowId); diff --git a/src/commands/workflow.ts b/src/commands/workflow.ts index d4652eb..f62e20e 100644 --- a/src/commands/workflow.ts +++ b/src/commands/workflow.ts @@ -261,7 +261,8 @@ export function triggerCommand(): Command { '--field-ids ', 'Field ids JSON array, e.g. \'["fldXXX"]\' (recordUpdated, buttonClick)' ) - .option('--form-id ', 'Form view id (formSubmitted)') + .option('--form-id ', 'Form view id (formSubmitted, legacy single). Prefer --form-ids.') + .option('--form-ids ', 'Comma-separated form view ids (formSubmitted, multi-select)') .option('--conditions ', 'Filter conditions JSON (recordCondition/recordCreated)') .option('--schedule ', 'Schedule JSON {timing:{type,interval}} (scheduledTime)') .option('--batch ', 'Batch config JSON {enabled,batchWindow,batchSize}') @@ -274,6 +275,7 @@ export function triggerCommand(): Command { tableId?: string; fieldIds?: string; formId?: string; + formIds?: string; conditions?: string; schedule?: string; batch?: string; @@ -289,6 +291,7 @@ export function triggerCommand(): Command { tableId: opts.tableId, fieldIds: opts.fieldIds, formId: opts.formId, + formIds: opts.formIds, conditions: opts.conditions, schedule: opts.schedule, batch: opts.batch, @@ -332,6 +335,7 @@ export function buildTriggerConfig( tableId?: string; fieldIds?: string; formId?: string; + formIds?: string; conditions?: string; schedule?: string; batch?: string; @@ -362,7 +366,16 @@ export function buildTriggerConfig( } case 'formSubmitted': { if (opts.tableId) config.tableId = opts.tableId; - if (opts.formId) config.formId = opts.formId; + // Prefer --form-ids (csv) which populates formIds:string[]. Fall back to + // legacy --form-id (single string) for backward compatibility. + if (opts.formIds) { + config.formIds = opts.formIds + .split(',') + .map((s) => s.trim()) + .filter((s) => s.length > 0); + } else if (opts.formId) { + config.formId = opts.formId; + } break; } case 'scheduledTime': {