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 <csv>
- 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
This commit is contained in:
yeuimu
2026-08-12 03:59:12 +00:00
parent ef013690f3
commit 73998173a8
5 changed files with 67 additions and 17 deletions
+42 -10
View File
@@ -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 <workflowId>')
@@ -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 <type>', `Trigger type: ${TRIGGER_TYPES.join('|')}`)
.option('--table-id <id>', 'Table id (most record/button triggers)')
.option('--field-ids <json>', 'Field ids JSON array, e.g. \'["fldXXX"]\' (recordUpdated, buttonClick)')
.option('--form-id <id>', 'Form view id (formSubmitted)')
.option('--form-id <id>', 'Form view id (formSubmitted, legacy single). Prefer --form-ids.')
.option('--form-ids <csv>', 'Comma-separated form view ids (formSubmitted, multi-select)')
.option('--conditions <json>', 'Filter conditions JSON (recordCondition/recordCreated)')
.option('--schedule <json>', 'Schedule JSON {timing:{type,interval}} (scheduledTime)')
.option('--batch <json>', '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);