@zalosai/zalos-cli 0.2.22 → 0.2.24
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/PUBLISHING.md +8 -0
- package/README.md +7 -0
- package/dist/commands/file.js +40 -0
- package/dist/commands/workflow-eval.js +2 -1
- package/dist/commands/workflow-schedule.js +22 -3
- package/dist/commands/workflow.js +137 -5
- package/package.json +1 -1
package/PUBLISHING.md
CHANGED
|
@@ -59,6 +59,14 @@ Do not publish with uncommitted package changes or reuse an existing version.
|
|
|
59
59
|
|
|
60
60
|
## Central developer access release
|
|
61
61
|
|
|
62
|
+
Version 0.2.24 adds `zl file folder list` and `zl file folder create` for
|
|
63
|
+
organizing Team Files through the existing `/api/folders` API (`files` scope).
|
|
64
|
+
`create` accepts `--parent-folder-id` for nesting and `--dry-run` to preview.
|
|
65
|
+
|
|
66
|
+
Version 0.2.23 adds explicit `--include-internal` reads for workflow setup and
|
|
67
|
+
scheduled tasks. Deploy the schedule-preview visibility option first. The
|
|
68
|
+
existing server-side team-owner check remains authoritative.
|
|
69
|
+
|
|
62
70
|
Version 0.2.22 adds `workflow activate` and `workflow schedule
|
|
63
71
|
list/upsert/remove/preview/run`. Deploy the schedule-preview API and scoped-token
|
|
64
72
|
route grants before publishing. Schedule tests use the CLI caller, not the
|
package/README.md
CHANGED
|
@@ -124,6 +124,9 @@ zl workflow run <id>
|
|
|
124
124
|
zl template list
|
|
125
125
|
zl credential list
|
|
126
126
|
zl file list
|
|
127
|
+
zl file folder list [--parent-folder-id <folder-id>]
|
|
128
|
+
zl file folder create <name> [--parent-folder-id <folder-id>] [--dry-run]
|
|
129
|
+
zl file upload ./report.xlsx --folder-id <folder-id>
|
|
127
130
|
zl team list
|
|
128
131
|
zl team switch <team-ref>
|
|
129
132
|
zl team list --all-teams
|
|
@@ -146,6 +149,10 @@ return metadata only. No product command loads database credentials.
|
|
|
146
149
|
|
|
147
150
|
### Scheduled chat tasks
|
|
148
151
|
|
|
152
|
+
For internal workflows, team owners can add `--include-internal` to workflow
|
|
153
|
+
list/view/export and schedule commands. The default continues to hide internal
|
|
154
|
+
workflows, and the existing API owner check still applies.
|
|
155
|
+
|
|
149
156
|
Workers are workflows with one Chat Trigger. Manage their existing scheduled tasks
|
|
150
157
|
without exporting or replacing the full workflow graph:
|
|
151
158
|
|
package/dist/commands/file.js
CHANGED
|
@@ -8,6 +8,9 @@ import { downloadToNewFile } from '../utils/download-file.js';
|
|
|
8
8
|
import { filterSingle, printJson } from '../utils/output.js';
|
|
9
9
|
import { action, dataRow, dataRows, fields, isRow, printPage, resourceId, } from '../utils/product-api.js';
|
|
10
10
|
const FILE_FIELDS = 'id,name,fileName,mimeType,size,fileSize,folderId,createdAt,updatedAt';
|
|
11
|
+
const FOLDER_FIELDS = 'id,name,parentFolderId,createdAt,updatedAt';
|
|
12
|
+
// Team Files folders live in the `files` folder scope; workflow folders use `workflows`.
|
|
13
|
+
const FILES_FOLDER_SCOPE = 'files';
|
|
11
14
|
const MAX_FILE_SIZE_BYTES = 500 * 1024 * 1024;
|
|
12
15
|
const UPLOAD_TIMEOUT_MS = 15 * 60_000;
|
|
13
16
|
const MIME_TYPES = {
|
|
@@ -122,6 +125,29 @@ export async function uploadFileAction(localPath, options) {
|
|
|
122
125
|
form.append('file', file, basename(localPath));
|
|
123
126
|
printJson(dataRow(await client.postForm('/team-files/upload', form, { timeoutMs: UPLOAD_TIMEOUT_MS })));
|
|
124
127
|
}
|
|
128
|
+
export async function listFoldersAction(options) {
|
|
129
|
+
const parentFolderId = options.parentFolderId ? resourceId(options.parentFolderId) : 'root';
|
|
130
|
+
const rows = dataRows(await client.get('/folders', { scope: FILES_FOLDER_SCOPE, parentFolderId })).map((row) => filterSingle(row, FOLDER_FIELDS));
|
|
131
|
+
printPage(rows, options);
|
|
132
|
+
}
|
|
133
|
+
export async function createFolderAction(name, options) {
|
|
134
|
+
const trimmed = name.trim();
|
|
135
|
+
if (!trimmed)
|
|
136
|
+
throw new ValidationError('name', 'Folder name must not be empty');
|
|
137
|
+
if (/[\\/]/.test(trimmed)) {
|
|
138
|
+
throw new ValidationError('name', 'Folder name cannot contain / or \\; use --parent-folder-id');
|
|
139
|
+
}
|
|
140
|
+
const payload = {
|
|
141
|
+
name: trimmed,
|
|
142
|
+
scope: FILES_FOLDER_SCOPE,
|
|
143
|
+
...(options.parentFolderId ? { parentFolderId: resourceId(options.parentFolderId) } : {}),
|
|
144
|
+
};
|
|
145
|
+
if (options.dryRun) {
|
|
146
|
+
printJson({ dryRun: true, method: 'POST', path: '/folders', payload });
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
printJson(filterSingle(dataRow(await client.post('/folders', payload)), FOLDER_FIELDS));
|
|
150
|
+
}
|
|
125
151
|
export async function snapshotFilesAction(options) {
|
|
126
152
|
if (options.teamId) {
|
|
127
153
|
const snapshot = {
|
|
@@ -282,6 +308,20 @@ export function registerFileCommand(program) {
|
|
|
282
308
|
.option('--mime-type <type>', 'Override the detected MIME type')
|
|
283
309
|
.option('--overwrite', 'Replace an existing file with the same name')
|
|
284
310
|
.action(async (path, o) => action(() => uploadFileAction(path, o)));
|
|
311
|
+
const folder = cmd.command('folder').description('Manage Team Files folders');
|
|
312
|
+
folder
|
|
313
|
+
.command('list')
|
|
314
|
+
.description('List Team Files folders under a parent folder')
|
|
315
|
+
.option('--parent-folder-id <id>', 'Parent folder ID (defaults to root)')
|
|
316
|
+
.option('--limit <n>', 'Maximum results', '100')
|
|
317
|
+
.option('--offset <n>', 'Result offset', '0')
|
|
318
|
+
.action(async (o) => action(() => listFoldersAction({ ...o, ...fields(program) })));
|
|
319
|
+
folder
|
|
320
|
+
.command('create <name>')
|
|
321
|
+
.description('Create a Team Files folder in the selected team')
|
|
322
|
+
.option('--parent-folder-id <id>', 'Parent folder ID (defaults to root)')
|
|
323
|
+
.option('--dry-run', 'Preview the request without creating the folder')
|
|
324
|
+
.action(async (name, o) => action(() => createFolderAction(name, o)));
|
|
285
325
|
cmd
|
|
286
326
|
.command('snapshot')
|
|
287
327
|
.description('Snapshot metadata within a folder')
|
|
@@ -75,7 +75,7 @@ export async function evalSuiteSetAction(workflowId, options) {
|
|
|
75
75
|
}
|
|
76
76
|
if (!isRow(input) ||
|
|
77
77
|
typeof input.name !== 'string' ||
|
|
78
|
-
!['northwind_cash', 'ah_bill_reports'].includes(String(input.profile)) ||
|
|
78
|
+
!['northwind_cash', 'ah_bill_reports', 'configured'].includes(String(input.profile)) ||
|
|
79
79
|
!Array.isArray(input.cases) ||
|
|
80
80
|
typeof input.monitoringEnabled !== 'boolean')
|
|
81
81
|
throw new ValidationError('input', 'Expected a suite with name, profile, cases and monitoringEnabled');
|
|
@@ -97,6 +97,7 @@ export async function evalSuiteSetAction(workflowId, options) {
|
|
|
97
97
|
name: input.name,
|
|
98
98
|
profile: input.profile,
|
|
99
99
|
cases: input.cases,
|
|
100
|
+
...(input.rules === undefined ? {} : { rules: input.rules }),
|
|
100
101
|
monitoringEnabled: input.monitoringEnabled,
|
|
101
102
|
expectedRevision: revision,
|
|
102
103
|
};
|
|
@@ -8,6 +8,14 @@ import { parseWorkflowFile } from '../workflow-file.js';
|
|
|
8
8
|
function path(id) {
|
|
9
9
|
return `/workflows/${resourceId(id)}`;
|
|
10
10
|
}
|
|
11
|
+
function readPath(id, options) {
|
|
12
|
+
const query = new URLSearchParams();
|
|
13
|
+
if (options.published)
|
|
14
|
+
query.set('resolvePublished', 'true');
|
|
15
|
+
if (options.includeInternal)
|
|
16
|
+
query.set('includeInternal', 'true');
|
|
17
|
+
return `${path(id)}${query.size ? `?${query}` : ''}`;
|
|
18
|
+
}
|
|
11
19
|
function taskId(id) {
|
|
12
20
|
if (id.length > 100)
|
|
13
21
|
throw new ValidationError('taskId', 'Task IDs must be 1–100 characters');
|
|
@@ -35,12 +43,13 @@ function previewBody(options) {
|
|
|
35
43
|
throw new ValidationError('at', 'Use an ISO timestamp with an explicit timezone');
|
|
36
44
|
return {
|
|
37
45
|
published: options.published ?? false,
|
|
46
|
+
...(options.includeInternal ? { includeInternal: true } : {}),
|
|
38
47
|
count: integer(options.count, 3, 1, 10),
|
|
39
48
|
...(options.at ? { at: options.at } : {}),
|
|
40
49
|
};
|
|
41
50
|
}
|
|
42
51
|
export async function listWorkflowSchedulesAction(id, options) {
|
|
43
|
-
const workflow = dataRow(await client.get(
|
|
52
|
+
const workflow = dataRow(await client.get(readPath(id, options)));
|
|
44
53
|
if (options.published &&
|
|
45
54
|
workflow.publishedVersionId &&
|
|
46
55
|
workflow.versionId !== workflow.publishedVersionId)
|
|
@@ -70,7 +79,7 @@ export async function editWorkflowScheduleAction(id, options) {
|
|
|
70
79
|
taskId(options.remove);
|
|
71
80
|
else
|
|
72
81
|
throw new ValidationError('input', 'Provide a task file or a task ID to remove');
|
|
73
|
-
const workflow = dataRow(await client.get(
|
|
82
|
+
const workflow = dataRow(await client.get(readPath(id, options)));
|
|
74
83
|
// PUT is a full workflow replacement, not a settings patch. Validate the
|
|
75
84
|
// response graph and carry forward all editable fields before changing tasks.
|
|
76
85
|
parseWorkflowFile(JSON.stringify(workflow), id);
|
|
@@ -85,7 +94,11 @@ export async function editWorkflowScheduleAction(id, options) {
|
|
|
85
94
|
if (task)
|
|
86
95
|
tasks.splice(index < 0 ? tasks.length : index, 0, task);
|
|
87
96
|
// The server reuses the scheduler compiler, expression evaluator and chat input validator.
|
|
88
|
-
await preview(id, {
|
|
97
|
+
await preview(id, {
|
|
98
|
+
tasks,
|
|
99
|
+
count: 1,
|
|
100
|
+
...(options.includeInternal ? { includeInternal: true } : {}),
|
|
101
|
+
});
|
|
89
102
|
const content = Object.fromEntries([
|
|
90
103
|
'name',
|
|
91
104
|
'description',
|
|
@@ -124,6 +137,7 @@ export async function runWorkflowScheduleAction(id, selected, options) {
|
|
|
124
137
|
const result = await preview(id, {
|
|
125
138
|
...previewBody({
|
|
126
139
|
published: true,
|
|
140
|
+
includeInternal: options.includeInternal,
|
|
127
141
|
at: options.at ?? new Date().toISOString(),
|
|
128
142
|
count: '1',
|
|
129
143
|
}),
|
|
@@ -167,27 +181,32 @@ export function registerWorkflowScheduleCommand(workflow) {
|
|
|
167
181
|
.description('Manage workflow-owned scheduled chat tasks');
|
|
168
182
|
cmd
|
|
169
183
|
.command('list <id>')
|
|
184
|
+
.option('--include-internal', 'Read internal workflow tasks (team owners only)')
|
|
170
185
|
.option('--published', 'Read published tasks')
|
|
171
186
|
.action(async (id, o) => action(() => listWorkflowSchedulesAction(id, o)));
|
|
172
187
|
cmd
|
|
173
188
|
.command('upsert <id>')
|
|
189
|
+
.option('--include-internal', 'Edit internal workflow tasks (team owners only)')
|
|
174
190
|
.requiredOption('--input <file>', 'One scheduled chat task as JSON')
|
|
175
191
|
.option('--apply', 'Save schedule draft')
|
|
176
192
|
.option('--dry-run', 'Validate and preview only')
|
|
177
193
|
.action(async (id, o) => action(() => editWorkflowScheduleAction(id, o)));
|
|
178
194
|
cmd
|
|
179
195
|
.command('remove <id> <task-id>')
|
|
196
|
+
.option('--include-internal', 'Edit internal workflow tasks (team owners only)')
|
|
180
197
|
.option('--apply', 'Remove task from draft')
|
|
181
198
|
.option('--dry-run', 'Preview removal')
|
|
182
199
|
.action(async (id, selected, o) => action(() => editWorkflowScheduleAction(id, { ...o, remove: selected })));
|
|
183
200
|
cmd
|
|
184
201
|
.command('preview <id> <task-id>')
|
|
202
|
+
.option('--include-internal', 'Preview internal workflow tasks (team owners only)')
|
|
185
203
|
.option('--published', 'Preview published tasks')
|
|
186
204
|
.option('--at <timestamp>', 'Evaluate first occurrence at this ISO timestamp; otherwise use next fire time')
|
|
187
205
|
.option('--count <n>', 'Number of occurrences (1–10)', '3')
|
|
188
206
|
.action(async (id, selected, o) => action(() => previewWorkflowScheduleAction(id, selected, o)));
|
|
189
207
|
cmd
|
|
190
208
|
.command('run <id> <task-id>')
|
|
209
|
+
.option('--include-internal', 'Read the internal task definition (team owners only)')
|
|
191
210
|
.description('Test published task inputs as the CLI caller; does not test scheduler bot identity')
|
|
192
211
|
.option('--at <timestamp>', 'Evaluate inputs at this ISO timestamp (default now)')
|
|
193
212
|
.option('--apply', 'Start a real execution')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFile, stat } from 'node:fs/promises';
|
|
2
2
|
import { resolve, join } from 'node:path';
|
|
3
3
|
import { client } from '../client.js';
|
|
4
|
-
import { readWorkflowFile, serializeWorkflow } from '../workflow-file.js';
|
|
4
|
+
import { parseWorkflowFile, readWorkflowFile, serializeWorkflow } from '../workflow-file.js';
|
|
5
5
|
import { ApiError, ValidationError } from '../utils/errors.js';
|
|
6
6
|
import { filterSingle, printJson } from '../utils/output.js';
|
|
7
7
|
import { action, dataRow, dataRows, fields, isRow, printPage, resourceId, } from '../utils/product-api.js';
|
|
@@ -9,7 +9,12 @@ import { parseJson } from '../utils/validate.js';
|
|
|
9
9
|
import { registerWorkflowScheduleCommand } from './workflow-schedule.js';
|
|
10
10
|
import { registerWorkflowEvalCommand } from './workflow-eval.js';
|
|
11
11
|
async function readWorkflow(id, options) {
|
|
12
|
-
const
|
|
12
|
+
const query = new URLSearchParams();
|
|
13
|
+
if (options.published)
|
|
14
|
+
query.set('resolvePublished', 'true');
|
|
15
|
+
if (options.includeInternal)
|
|
16
|
+
query.set('includeInternal', 'true');
|
|
17
|
+
const workflow = dataRow(await client.get(`/workflows/${resourceId(id)}${query.size ? `?${query}` : ''}`));
|
|
13
18
|
if (!options.published)
|
|
14
19
|
return workflow;
|
|
15
20
|
if (workflow.publishedVersionId && workflow.versionId !== workflow.publishedVersionId) {
|
|
@@ -57,7 +62,9 @@ function warnIfWorkflowDraftIsUnpublished(workflow) {
|
|
|
57
62
|
})}\n`);
|
|
58
63
|
}
|
|
59
64
|
export async function listWorkflowsAction(options) {
|
|
60
|
-
const path = options.allTeams
|
|
65
|
+
const path = options.allTeams
|
|
66
|
+
? '/developer/workflows'
|
|
67
|
+
: `/workflows${options.includeInternal ? '?includeInternal=true' : ''}`;
|
|
61
68
|
printPage(dataRows(await client.get(path)), options);
|
|
62
69
|
}
|
|
63
70
|
export async function viewWorkflowAction(id, options) {
|
|
@@ -88,7 +95,7 @@ export async function exportWorkflowAction(id, options) {
|
|
|
88
95
|
else {
|
|
89
96
|
ids = id
|
|
90
97
|
? [id]
|
|
91
|
-
: dataRows(await client.get(
|
|
98
|
+
: dataRows(await client.get(`/workflows${options.includeInternal ? '?includeInternal=true' : ''}`)).map((row) => {
|
|
92
99
|
if (typeof row.id !== 'string')
|
|
93
100
|
throw new ValidationError('id', 'Workflow response is missing ID');
|
|
94
101
|
return resourceId(row.id);
|
|
@@ -140,8 +147,11 @@ export async function importWorkflowAction(path, options) {
|
|
|
140
147
|
printJson(dataRow(await client.post('/workflows', payload)));
|
|
141
148
|
}
|
|
142
149
|
export async function updateWorkflowAction(id, options) {
|
|
150
|
+
await saveWorkflowDraft(id, await readWorkflowFile(options.input, id), options);
|
|
151
|
+
}
|
|
152
|
+
async function saveWorkflowDraft(id, draft, options) {
|
|
143
153
|
const path = `/workflows/${resourceId(id)}`;
|
|
144
|
-
const { checksum, expectedChecksum, versionId: _versionId, publishedVersionId: _publishedVersionId, ...workflow } =
|
|
154
|
+
const { checksum, expectedChecksum, versionId: _versionId, publishedVersionId: _publishedVersionId, ...workflow } = draft;
|
|
145
155
|
for (const value of [checksum, expectedChecksum]) {
|
|
146
156
|
if (value !== undefined && (typeof value !== 'string' || !value.trim())) {
|
|
147
157
|
throw new ValidationError('checksum', 'Workflow checksum must be a nonempty string');
|
|
@@ -212,22 +222,144 @@ export async function runWorkflowAction(id, options) {
|
|
|
212
222
|
}
|
|
213
223
|
printJson(dataRow(await client.post(path, payload)));
|
|
214
224
|
}
|
|
225
|
+
function propertyContainer(draft, pointer, target) {
|
|
226
|
+
if (!pointer.startsWith('/') || /~(?![01])/.test(pointer))
|
|
227
|
+
throw new ValidationError('path', 'Use a JSON Pointer such as /instructions');
|
|
228
|
+
const segments = pointer
|
|
229
|
+
.slice(1)
|
|
230
|
+
.split('/')
|
|
231
|
+
.map((part) => part.replaceAll('~1', '/').replaceAll('~0', '~'));
|
|
232
|
+
if (segments.some((key) => ['__proto__', 'constructor', 'prototype'].includes(key)))
|
|
233
|
+
throw new ValidationError('path', 'Unsafe property name');
|
|
234
|
+
let current = draft;
|
|
235
|
+
if (target.node !== undefined) {
|
|
236
|
+
const matches = draft.nodes.filter((node) => node.id === target.node);
|
|
237
|
+
if (matches.length !== 1)
|
|
238
|
+
throw new ValidationError('node', 'Expected exactly one node with that ID');
|
|
239
|
+
current = matches[0].parameters;
|
|
240
|
+
}
|
|
241
|
+
for (const [index, key] of segments.entries()) {
|
|
242
|
+
if (Array.isArray(current)) {
|
|
243
|
+
if (!/^(0|[1-9]\d*)$/.test(key) || !Object.hasOwn(current, key))
|
|
244
|
+
throw new ValidationError('path', 'Array index must identify an existing element');
|
|
245
|
+
if (index === segments.length - 1)
|
|
246
|
+
return { container: current, key };
|
|
247
|
+
current = current[Number(key)];
|
|
248
|
+
}
|
|
249
|
+
else if (isRow(current)) {
|
|
250
|
+
if (index === segments.length - 1)
|
|
251
|
+
return { container: current, key };
|
|
252
|
+
current = Object.hasOwn(current, key) ? current[key] : undefined;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
throw new ValidationError('path', 'Parent property does not exist or is not an object or array');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
throw new ValidationError('path', 'Expected a property path');
|
|
259
|
+
}
|
|
260
|
+
export async function workflowPropertyAction(id, pointer, options) {
|
|
261
|
+
const path = `/workflows/${resourceId(id)}`;
|
|
262
|
+
const draft = dataRow(options.includeInternal
|
|
263
|
+
? await client.get(path, { includeInternal: 'true' })
|
|
264
|
+
: await client.get(path));
|
|
265
|
+
const { container, key } = propertyContainer(draft, pointer, options);
|
|
266
|
+
const previous = Array.isArray(container)
|
|
267
|
+
? container[Number(key)]
|
|
268
|
+
: Object.hasOwn(container, key)
|
|
269
|
+
? container[key]
|
|
270
|
+
: undefined;
|
|
271
|
+
if (options.json === undefined) {
|
|
272
|
+
if (previous === undefined)
|
|
273
|
+
throw new ValidationError('path', 'Property does not exist');
|
|
274
|
+
printJson(previous);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (!options.node &&
|
|
278
|
+
/^\/(?:id|checksum|expectedChecksum|versionId|publishedVersionId|createdAt|updatedAt|active)(?:\/|$)/.test(pointer))
|
|
279
|
+
throw new ValidationError('path', 'This workflow field cannot be changed with property set');
|
|
280
|
+
const value = parseJson(options.json);
|
|
281
|
+
if (Array.isArray(container))
|
|
282
|
+
container[Number(key)] = value;
|
|
283
|
+
else
|
|
284
|
+
container[key] = value;
|
|
285
|
+
const updated = parseWorkflowFile(JSON.stringify(draft), id);
|
|
286
|
+
if (!options.apply || options.dryRun) {
|
|
287
|
+
printJson({
|
|
288
|
+
dryRun: true,
|
|
289
|
+
workflowId: id,
|
|
290
|
+
nodeId: options.node,
|
|
291
|
+
path: pointer,
|
|
292
|
+
previous,
|
|
293
|
+
value,
|
|
294
|
+
checksum: draft.checksum,
|
|
295
|
+
});
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
await saveWorkflowDraft(id, updated, options);
|
|
299
|
+
}
|
|
215
300
|
export function registerWorkflowCommand(program) {
|
|
216
301
|
const cmd = program.command('workflow').description('Manage workflows through the regional API');
|
|
302
|
+
const property = cmd
|
|
303
|
+
.command('property')
|
|
304
|
+
.description('Inspect and edit workflow draft properties');
|
|
305
|
+
property
|
|
306
|
+
.command('get <id> <path>')
|
|
307
|
+
.description('Read a JSON Pointer from the workflow draft or selected node parameters')
|
|
308
|
+
.option('--node <id>', 'Resolve the pointer relative to this node’s parameters')
|
|
309
|
+
.option('--include-internal', 'Include internal workflows (team owners only)')
|
|
310
|
+
.action(async (id, path, o) => action(() => workflowPropertyAction(id, path, o)));
|
|
311
|
+
property
|
|
312
|
+
.command('set <id> <path>')
|
|
313
|
+
.description('Set a JSON Pointer on the workflow draft or selected node parameters')
|
|
314
|
+
.option('--node <id>', 'Resolve the pointer relative to this node’s parameters')
|
|
315
|
+
.option('--include-internal', 'Include internal workflows (team owners only)')
|
|
316
|
+
.requiredOption('--json <value>', 'New value as JSON')
|
|
317
|
+
.option('--apply', 'Save the draft')
|
|
318
|
+
.option('--dry-run', 'Preview the change')
|
|
319
|
+
.action(async (id, path, o) => action(() => workflowPropertyAction(id, path, o)));
|
|
320
|
+
cmd
|
|
321
|
+
.command('node-types [type]')
|
|
322
|
+
.description('Inspect node types and parameter definitions from the regional API')
|
|
323
|
+
.action(async (type) => action(async () => {
|
|
324
|
+
const types = dataRows(await client.get('/node-types'));
|
|
325
|
+
if (type === undefined) {
|
|
326
|
+
printJson(types.map(({ name, displayName }) => ({ name, displayName })));
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const definition = types.find((node) => node.name === type);
|
|
330
|
+
if (!definition)
|
|
331
|
+
throw new ValidationError('type', 'Unknown node type');
|
|
332
|
+
printJson(definition);
|
|
333
|
+
}));
|
|
334
|
+
property
|
|
335
|
+
.command('options <id> <node-id> <path>')
|
|
336
|
+
.description('List dynamic options for a JSON Pointer relative to the node parameters')
|
|
337
|
+
.option('--source <id>', 'List options within this source')
|
|
338
|
+
.option('--include-internal', 'Include internal workflows (team owners only)')
|
|
339
|
+
.action(async (id, nodeId, path, o) => action(async () => {
|
|
340
|
+
printJson(dataRows(await client.get(`/workflows/${resourceId(id)}/nodes/${resourceId(nodeId)}/property-options`, {
|
|
341
|
+
path,
|
|
342
|
+
...(o.source !== undefined ? { source: o.source } : {}),
|
|
343
|
+
...(o.includeInternal ? { includeInternal: 'true' } : {}),
|
|
344
|
+
})));
|
|
345
|
+
}));
|
|
217
346
|
registerWorkflowEvalCommand(cmd, program);
|
|
218
347
|
registerWorkflowScheduleCommand(cmd);
|
|
219
348
|
cmd
|
|
220
349
|
.command('list')
|
|
350
|
+
.option('--include-internal', 'Include internal workflows (team owners only)')
|
|
221
351
|
.option('--all-teams', 'List workflows across every team in the selected region')
|
|
222
352
|
.option('--limit <n>', 'Maximum results', '100')
|
|
223
353
|
.option('--offset <n>', 'Result offset', '0')
|
|
224
354
|
.action(async (o) => action(() => listWorkflowsAction({ ...o, ...fields(program) })));
|
|
225
355
|
cmd
|
|
226
356
|
.command('view <id>')
|
|
357
|
+
.option('--include-internal', 'Read an internal workflow (team owners only)')
|
|
227
358
|
.option('--published', 'Read the definition clients run (current when unprotected)')
|
|
228
359
|
.action(async (id, o) => action(() => viewWorkflowAction(id, { ...o, ...fields(program) })));
|
|
229
360
|
cmd
|
|
230
361
|
.command('export [id]')
|
|
362
|
+
.option('--include-internal', 'Export internal workflows (team owners only)')
|
|
231
363
|
.option('--all', 'Export every accessible workflow')
|
|
232
364
|
.option('--all-teams', 'Export workflows across every team in the selected region')
|
|
233
365
|
.option('--published', 'Export the definition clients run (current when unprotected); omits update checksum')
|