@zalosai/zalos-cli 0.2.22 → 0.2.23
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 +4 -0
- package/README.md +4 -0
- package/dist/commands/workflow-schedule.js +22 -3
- package/dist/commands/workflow.js +13 -3
- package/package.json +1 -1
package/PUBLISHING.md
CHANGED
|
@@ -59,6 +59,10 @@ 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.23 adds explicit `--include-internal` reads for workflow setup and
|
|
63
|
+
scheduled tasks. Deploy the schedule-preview visibility option first. The
|
|
64
|
+
existing server-side team-owner check remains authoritative.
|
|
65
|
+
|
|
62
66
|
Version 0.2.22 adds `workflow activate` and `workflow schedule
|
|
63
67
|
list/upsert/remove/preview/run`. Deploy the schedule-preview API and scoped-token
|
|
64
68
|
route grants before publishing. Schedule tests use the CLI caller, not the
|
package/README.md
CHANGED
|
@@ -146,6 +146,10 @@ return metadata only. No product command loads database credentials.
|
|
|
146
146
|
|
|
147
147
|
### Scheduled chat tasks
|
|
148
148
|
|
|
149
|
+
For internal workflows, team owners can add `--include-internal` to workflow
|
|
150
|
+
list/view/export and schedule commands. The default continues to hide internal
|
|
151
|
+
workflows, and the existing API owner check still applies.
|
|
152
|
+
|
|
149
153
|
Workers are workflows with one Chat Trigger. Manage their existing scheduled tasks
|
|
150
154
|
without exporting or replacing the full workflow graph:
|
|
151
155
|
|
|
@@ -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')
|
|
@@ -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);
|
|
@@ -218,16 +225,19 @@ export function registerWorkflowCommand(program) {
|
|
|
218
225
|
registerWorkflowScheduleCommand(cmd);
|
|
219
226
|
cmd
|
|
220
227
|
.command('list')
|
|
228
|
+
.option('--include-internal', 'Include internal workflows (team owners only)')
|
|
221
229
|
.option('--all-teams', 'List workflows across every team in the selected region')
|
|
222
230
|
.option('--limit <n>', 'Maximum results', '100')
|
|
223
231
|
.option('--offset <n>', 'Result offset', '0')
|
|
224
232
|
.action(async (o) => action(() => listWorkflowsAction({ ...o, ...fields(program) })));
|
|
225
233
|
cmd
|
|
226
234
|
.command('view <id>')
|
|
235
|
+
.option('--include-internal', 'Read an internal workflow (team owners only)')
|
|
227
236
|
.option('--published', 'Read the definition clients run (current when unprotected)')
|
|
228
237
|
.action(async (id, o) => action(() => viewWorkflowAction(id, { ...o, ...fields(program) })));
|
|
229
238
|
cmd
|
|
230
239
|
.command('export [id]')
|
|
240
|
+
.option('--include-internal', 'Export internal workflows (team owners only)')
|
|
231
241
|
.option('--all', 'Export every accessible workflow')
|
|
232
242
|
.option('--all-teams', 'Export workflows across every team in the selected region')
|
|
233
243
|
.option('--published', 'Export the definition clients run (current when unprotected); omits update checksum')
|