@velaro/cli 1.4.141 → 1.4.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/workflow.js +1 -57
- package/package.json +1 -1
package/lib/commands/workflow.js
CHANGED
|
@@ -18,14 +18,11 @@ export const workflowCommand = {
|
|
|
18
18
|
.command(workflowEnableCommand)
|
|
19
19
|
.command(workflowDisableCommand)
|
|
20
20
|
.command(workflowRunCommand)
|
|
21
|
-
.command(workflowVersionsCommand)
|
|
22
|
-
.command(workflowDownloadCommand)
|
|
23
|
-
.command(workflowRestoreCommand)
|
|
24
21
|
.command(workflowNodeOptionsCommand)
|
|
25
22
|
.command(workflowAiFollowupsCommand)
|
|
26
23
|
.command(workflowScheduleCommand)
|
|
27
24
|
.command(siteAiFollowupsCommand)
|
|
28
|
-
.demandCommand(1, 'Specify a subcommand: list, get, create, enable, disable,
|
|
25
|
+
.demandCommand(1, 'Specify a subcommand: list, get, create, enable, disable, node-options, integrity-scan, ai-followups, ai-followups-site, schedule'),
|
|
29
26
|
handler: () => {},
|
|
30
27
|
};
|
|
31
28
|
|
|
@@ -122,59 +119,6 @@ const workflowCreateCommand = {
|
|
|
122
119
|
}),
|
|
123
120
|
};
|
|
124
121
|
|
|
125
|
-
// ── versions / download / restore ─────────────────────────────────────────────
|
|
126
|
-
// Every save of a workflow (editor, API, MCP, Moshky, SiteSync) keeps the PRIOR state as a version;
|
|
127
|
-
// the newest 5 per workflow are kept. Restoring first saves the current state as a new version, so a
|
|
128
|
-
// restore can itself be undone. Enabled state is not changed by a restore.
|
|
129
|
-
|
|
130
|
-
const workflowVersionsCommand = {
|
|
131
|
-
command: 'versions <id>',
|
|
132
|
-
describe: 'List the last 5 prior versions of a workflow (newest first)',
|
|
133
|
-
builder: (y) => y.positional('id', { type: 'number', describe: 'Workflow ID' }),
|
|
134
|
-
handler: runCommand(async (argv) => {
|
|
135
|
-
await requireFeature('enableAutomation', 'Workflows');
|
|
136
|
-
const r = await messagingGet(`/Workflows/${argv.id}/versions`);
|
|
137
|
-
const rows = r?.versions ?? [];
|
|
138
|
-
if (!rows.length) { console.log(`No prior versions saved for workflow ${argv.id} yet.`); return; }
|
|
139
|
-
console.log(`
|
|
140
|
-
version saved (UTC) by source nodes name`);
|
|
141
|
-
for (const v of rows) {
|
|
142
|
-
console.log(`${String(v.id).padStart(7)} ${String(v.createdAt).slice(0, 19).padEnd(21)} ${String(v.savedBy ?? '').padEnd(25)} ${String(v.source ?? '').padEnd(21)} ${String(v.nodeCount).padStart(5)} ${v.name ?? ''}`);
|
|
143
|
-
}
|
|
144
|
-
console.log(`
|
|
145
|
-
${rows.length} version(s). Download: velaro workflow download ${argv.id} <version> Restore: velaro workflow restore ${argv.id} <version>`);
|
|
146
|
-
}),
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const workflowDownloadCommand = {
|
|
150
|
-
command: 'download <id> <version>',
|
|
151
|
-
describe: 'Download one prior workflow version as JSON (stdout, or --out file)',
|
|
152
|
-
builder: (y) => y
|
|
153
|
-
.positional('id', { type: 'number', describe: 'Workflow ID' })
|
|
154
|
-
.positional('version', { type: 'number', describe: 'Version id from "workflow versions"' })
|
|
155
|
-
.option('out', { type: 'string', describe: 'Write the JSON to this file instead of stdout' }),
|
|
156
|
-
handler: runCommand(async (argv) => {
|
|
157
|
-
await requireFeature('enableAutomation', 'Workflows');
|
|
158
|
-
const v = await messagingGet(`/Workflows/${argv.id}/versions/${argv.version}`);
|
|
159
|
-
const json = JSON.stringify(v, null, 2);
|
|
160
|
-
if (argv.out) { fs.writeFileSync(argv.out, json); console.log(`Saved version ${argv.version} of workflow ${argv.id} to ${argv.out}`); }
|
|
161
|
-
else console.log(json);
|
|
162
|
-
}),
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const workflowRestoreCommand = {
|
|
166
|
-
command: 'restore <id> <version>',
|
|
167
|
-
describe: 'Restore a prior workflow version (the current state is saved as a new version first)',
|
|
168
|
-
builder: (y) => y
|
|
169
|
-
.positional('id', { type: 'number', describe: 'Workflow ID' })
|
|
170
|
-
.positional('version', { type: 'number', describe: 'Version id from "workflow versions"' }),
|
|
171
|
-
handler: runCommand(async (argv) => {
|
|
172
|
-
await requireFeature('enableAutomation', 'Workflows');
|
|
173
|
-
const r = await messagingPost(`/Workflows/${argv.id}/versions/${argv.version}/restore`, null);
|
|
174
|
-
console.log(`Workflow ${argv.id} restored to version ${argv.version} (${r?.name ?? ''}). Enabled state unchanged (${r?.enabled ? 'enabled' : 'disabled'}). The replaced state is saved as a new version.`);
|
|
175
|
-
}),
|
|
176
|
-
};
|
|
177
|
-
|
|
178
122
|
// ── enable / disable ──────────────────────────────────────────────────────────
|
|
179
123
|
|
|
180
124
|
// ── run ────────────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED