@velaro/cli 1.4.142 → 1.4.143
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/contacts.js +1 -1
- package/lib/commands/workflow.js +57 -1
- package/package.json +1 -1
package/lib/commands/contacts.js
CHANGED
|
@@ -79,7 +79,7 @@ async function timelineHandler(argv) {
|
|
|
79
79
|
}
|
|
80
80
|
console.log(`\nTimeline for contact #${argv.id} (${list.length} events)\n`);
|
|
81
81
|
for (const e of list) {
|
|
82
|
-
console.log(` [${e.timestamp ?? e.date ?? '—'}] ${e.type ?? e.eventType ?? 'event'}: ${e.summary ?? e.description
|
|
82
|
+
console.log(` [${e.timestamp ?? e.date ?? '—'}] ${e.type ?? e.eventType ?? 'event'}: ${e.title ?? e.summary ?? ''}${e.description ? ' - ' + e.description : ''}`);
|
|
83
83
|
}
|
|
84
84
|
console.log('');
|
|
85
85
|
}
|
package/lib/commands/workflow.js
CHANGED
|
@@ -18,11 +18,14 @@ export const workflowCommand = {
|
|
|
18
18
|
.command(workflowEnableCommand)
|
|
19
19
|
.command(workflowDisableCommand)
|
|
20
20
|
.command(workflowRunCommand)
|
|
21
|
+
.command(workflowVersionsCommand)
|
|
22
|
+
.command(workflowDownloadCommand)
|
|
23
|
+
.command(workflowRestoreCommand)
|
|
21
24
|
.command(workflowNodeOptionsCommand)
|
|
22
25
|
.command(workflowAiFollowupsCommand)
|
|
23
26
|
.command(workflowScheduleCommand)
|
|
24
27
|
.command(siteAiFollowupsCommand)
|
|
25
|
-
.demandCommand(1, 'Specify a subcommand: list, get, create, enable, disable, node-options, integrity-scan, ai-followups, ai-followups-site, schedule'),
|
|
28
|
+
.demandCommand(1, 'Specify a subcommand: list, get, create, enable, disable, versions, download, restore, node-options, integrity-scan, ai-followups, ai-followups-site, schedule'),
|
|
26
29
|
handler: () => {},
|
|
27
30
|
};
|
|
28
31
|
|
|
@@ -119,6 +122,59 @@ const workflowCreateCommand = {
|
|
|
119
122
|
}),
|
|
120
123
|
};
|
|
121
124
|
|
|
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
|
+
|
|
122
178
|
// ── enable / disable ──────────────────────────────────────────────────────────
|
|
123
179
|
|
|
124
180
|
// ── run ────────────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED