@parall/cli 1.60.0 → 1.62.0
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/dist/commands/agents.d.ts +9 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +288 -8
- package/dist/commands/approvals.d.ts.map +1 -1
- package/dist/commands/approvals.js +19 -0
- package/dist/commands/chats.d.ts.map +1 -1
- package/dist/commands/chats.js +84 -0
- package/dist/commands/clip.d.ts.map +1 -1
- package/dist/commands/clip.js +21 -18
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -1
- package/dist/commands/comments.js +44 -1
- package/dist/commands/labels.d.ts +5 -0
- package/dist/commands/labels.d.ts.map +1 -0
- package/dist/commands/labels.js +114 -0
- package/dist/commands/messages.d.ts.map +1 -1
- package/dist/commands/messages.js +35 -0
- package/dist/commands/projects.d.ts.map +1 -1
- package/dist/commands/projects.js +4 -2
- package/dist/commands/search.d.ts +5 -0
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +28 -1
- package/dist/commands/tasks.d.ts +13 -3
- package/dist/commands/tasks.d.ts.map +1 -1
- package/dist/commands/tasks.js +214 -8
- package/dist/commands/triggers.d.ts +19 -0
- package/dist/commands/triggers.d.ts.map +1 -0
- package/dist/commands/{external-triggers.js → triggers.js} +96 -95
- package/dist/commands/wiki-comments.d.ts +6 -0
- package/dist/commands/wiki-comments.d.ts.map +1 -0
- package/dist/commands/wiki-comments.js +108 -0
- package/dist/commands/wiki.d.ts.map +1 -1
- package/dist/commands/wiki.js +2 -98
- package/dist/index.js +4 -2
- package/package.json +4 -4
- package/dist/commands/external-triggers.d.ts +0 -19
- package/dist/commands/external-triggers.d.ts.map +0 -1
|
@@ -3,7 +3,7 @@ import { resolveCredentials } from '../lib/client.js';
|
|
|
3
3
|
import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
|
|
4
4
|
const connectionStatuses = ['active', 'disabled'];
|
|
5
5
|
const triggerStatuses = ['active', 'paused'];
|
|
6
|
-
export const
|
|
6
|
+
export const TRIGGERS_FLAG = 'external-triggers';
|
|
7
7
|
function stripUndefined(obj) {
|
|
8
8
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
|
|
9
9
|
}
|
|
@@ -54,15 +54,15 @@ export function isFeatureFlagEnabled(value) {
|
|
|
54
54
|
(typeof value === 'string' && value !== '') ||
|
|
55
55
|
(typeof value === 'number' && value !== 0));
|
|
56
56
|
}
|
|
57
|
-
export async function
|
|
57
|
+
export async function requireTriggersEnabled(client, orgId) {
|
|
58
58
|
const res = await client.getFeatureFlags(orgId);
|
|
59
|
-
if (!isFeatureFlagEnabled(res.flags[
|
|
60
|
-
throw new Error('
|
|
59
|
+
if (!isFeatureFlagEnabled(res.flags[TRIGGERS_FLAG])) {
|
|
60
|
+
throw new Error('Triggers are disabled for this organization.');
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
async function
|
|
63
|
+
async function resolveTriggerCommandContext() {
|
|
64
64
|
const ctx = resolveCredentials();
|
|
65
|
-
await
|
|
65
|
+
await requireTriggersEnabled(ctx.client, ctx.orgId);
|
|
66
66
|
return ctx;
|
|
67
67
|
}
|
|
68
68
|
export function validateIngressTokenOutputOptions(opts) {
|
|
@@ -106,19 +106,20 @@ async function resolveTemplate(opts) {
|
|
|
106
106
|
throw new Error('Provide --template or --template-file.');
|
|
107
107
|
return undefined;
|
|
108
108
|
}
|
|
109
|
-
export function
|
|
110
|
-
const
|
|
111
|
-
.command('
|
|
112
|
-
.
|
|
113
|
-
|
|
109
|
+
export function registerTriggerCommands(program) {
|
|
110
|
+
const triggers = program
|
|
111
|
+
.command('triggers')
|
|
112
|
+
.alias('external-triggers')
|
|
113
|
+
.description('Manage Triggers (incoming platform triggers for agents)');
|
|
114
|
+
triggers
|
|
114
115
|
.command('connections')
|
|
115
|
-
.description('List
|
|
116
|
+
.description('List Trigger Connections in the organization')
|
|
116
117
|
.option('--limit <n>', 'Maximum number of connections to return', '50')
|
|
117
118
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
118
119
|
.action(async (opts) => {
|
|
119
120
|
try {
|
|
120
|
-
const { client, orgId } = await
|
|
121
|
-
const result = await client.
|
|
121
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
122
|
+
const result = await client.listTriggerConnections(orgId, stripUndefined({
|
|
122
123
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
123
124
|
cursor: opts.cursor,
|
|
124
125
|
}));
|
|
@@ -128,17 +129,17 @@ export function registerExternalTriggerCommands(program) {
|
|
|
128
129
|
printError(err);
|
|
129
130
|
}
|
|
130
131
|
});
|
|
131
|
-
|
|
132
|
+
triggers
|
|
132
133
|
.command('create-connection')
|
|
133
|
-
.description('Create
|
|
134
|
+
.description('Create a Trigger Connection and return its incoming endpoint')
|
|
134
135
|
.requiredOption('--name <name>', 'Connection display name')
|
|
135
136
|
.option('--token-file <path>', 'Write the one-time token to a file with mode 0600')
|
|
136
137
|
.option('--show-token', 'Print the one-time token to stdout')
|
|
137
138
|
.action(async (opts) => {
|
|
138
139
|
try {
|
|
139
140
|
validateIngressTokenOutputOptions(opts);
|
|
140
|
-
const { client, orgId } = await
|
|
141
|
-
const result = await client.
|
|
141
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
142
|
+
const result = await client.createTriggerConnection(orgId, {
|
|
142
143
|
display_name: opts.name,
|
|
143
144
|
});
|
|
144
145
|
printJson(await connectionTokenOutput(result, opts));
|
|
@@ -148,29 +149,29 @@ export function registerExternalTriggerCommands(program) {
|
|
|
148
149
|
printError(err);
|
|
149
150
|
}
|
|
150
151
|
});
|
|
151
|
-
|
|
152
|
+
triggers
|
|
152
153
|
.command('connection')
|
|
153
|
-
.description('Get
|
|
154
|
-
.argument('<connectionId>', '
|
|
154
|
+
.description('Get a Trigger Connection by ID')
|
|
155
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
155
156
|
.action(async (connectionId) => {
|
|
156
157
|
try {
|
|
157
|
-
const { client, orgId } = await
|
|
158
|
-
const result = await client.
|
|
158
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
159
|
+
const result = await client.getTriggerConnection(orgId, stripPrllScheme(connectionId));
|
|
159
160
|
printJson(result);
|
|
160
161
|
}
|
|
161
162
|
catch (err) {
|
|
162
163
|
printError(err);
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
|
-
|
|
166
|
+
triggers
|
|
166
167
|
.command('update-connection')
|
|
167
|
-
.description('Update
|
|
168
|
-
.argument('<connectionId>', '
|
|
168
|
+
.description('Update a Trigger Connection')
|
|
169
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
169
170
|
.option('--name <name>', 'Connection display name')
|
|
170
171
|
.option('--status <status>', 'active | disabled')
|
|
171
172
|
.action(async (connectionId, opts) => {
|
|
172
173
|
try {
|
|
173
|
-
const { client, orgId } = await
|
|
174
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
174
175
|
const patch = stripUndefined({
|
|
175
176
|
display_name: opts.name,
|
|
176
177
|
status: parseEnum(opts.status, connectionStatuses, '--status'),
|
|
@@ -179,24 +180,24 @@ export function registerExternalTriggerCommands(program) {
|
|
|
179
180
|
printError(new Error('No fields to update. Provide at least one option.'));
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
|
-
const result = await client.
|
|
183
|
+
const result = await client.updateTriggerConnection(orgId, stripPrllScheme(connectionId), patch);
|
|
183
184
|
printJson(result);
|
|
184
185
|
}
|
|
185
186
|
catch (err) {
|
|
186
187
|
printError(err);
|
|
187
188
|
}
|
|
188
189
|
});
|
|
189
|
-
|
|
190
|
+
triggers
|
|
190
191
|
.command('regenerate-connection-token')
|
|
191
192
|
.description('Regenerate a connection ingress token; old webhook URLs stop working')
|
|
192
|
-
.argument('<connectionId>', '
|
|
193
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
193
194
|
.option('--token-file <path>', 'Write the one-time token to a file with mode 0600')
|
|
194
195
|
.option('--show-token', 'Print the one-time token to stdout')
|
|
195
196
|
.action(async (connectionId, opts) => {
|
|
196
197
|
try {
|
|
197
198
|
validateIngressTokenOutputOptions(opts);
|
|
198
|
-
const { client, orgId } = await
|
|
199
|
-
const result = await client.
|
|
199
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
200
|
+
const result = await client.regenerateTriggerConnectionIngressToken(orgId, stripPrllScheme(connectionId));
|
|
200
201
|
printJson(await connectionTokenOutput(result, opts));
|
|
201
202
|
printRefHint(result.id, 'Regenerated');
|
|
202
203
|
}
|
|
@@ -204,45 +205,45 @@ export function registerExternalTriggerCommands(program) {
|
|
|
204
205
|
printError(err);
|
|
205
206
|
}
|
|
206
207
|
});
|
|
207
|
-
|
|
208
|
+
triggers
|
|
208
209
|
.command('delete-connection')
|
|
209
|
-
.description('Archive
|
|
210
|
-
.argument('<connectionId>', '
|
|
210
|
+
.description('Archive a Trigger Connection')
|
|
211
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
211
212
|
.action(async (connectionId) => {
|
|
212
213
|
try {
|
|
213
|
-
const { client, orgId } = await
|
|
214
|
-
await client.
|
|
214
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
215
|
+
await client.deleteTriggerConnection(orgId, stripPrllScheme(connectionId));
|
|
215
216
|
printJson({ ok: true });
|
|
216
217
|
}
|
|
217
218
|
catch (err) {
|
|
218
219
|
printError(err);
|
|
219
220
|
}
|
|
220
221
|
});
|
|
221
|
-
|
|
222
|
+
triggers
|
|
222
223
|
.command('schema')
|
|
223
224
|
.description('Inspect CEL/template variables supported by a connection')
|
|
224
|
-
.argument('<connectionId>', '
|
|
225
|
+
.argument('<connectionId>', 'Trigger Connection ID')
|
|
225
226
|
.action(async (connectionId) => {
|
|
226
227
|
try {
|
|
227
|
-
const { client, orgId } = await
|
|
228
|
-
const result = await client.
|
|
228
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
229
|
+
const result = await client.getTriggerSchema(orgId, stripPrllScheme(connectionId));
|
|
229
230
|
printJson(result);
|
|
230
231
|
}
|
|
231
232
|
catch (err) {
|
|
232
233
|
printError(err);
|
|
233
234
|
}
|
|
234
235
|
});
|
|
235
|
-
|
|
236
|
+
triggers
|
|
236
237
|
.command('list')
|
|
237
|
-
.description('List
|
|
238
|
-
.option('--connection <connectionId>', 'Filter by
|
|
238
|
+
.description('List Triggers in the organization')
|
|
239
|
+
.option('--connection <connectionId>', 'Filter by Trigger Connection ID')
|
|
239
240
|
.option('--creator-id <id>', 'Filter by creator user ID')
|
|
240
241
|
.option('--limit <n>', 'Maximum number of triggers to return', '50')
|
|
241
242
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
242
243
|
.action(async (opts) => {
|
|
243
244
|
try {
|
|
244
|
-
const { client, orgId } = await
|
|
245
|
-
const result = await client.
|
|
245
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
246
|
+
const result = await client.listTriggers(orgId, stripUndefined({
|
|
246
247
|
connection_id: opts.connection ? stripPrllScheme(opts.connection) : undefined,
|
|
247
248
|
creator_id: opts.creatorId ? stripPrllScheme(opts.creatorId) : undefined,
|
|
248
249
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
@@ -254,10 +255,10 @@ export function registerExternalTriggerCommands(program) {
|
|
|
254
255
|
printError(err);
|
|
255
256
|
}
|
|
256
257
|
});
|
|
257
|
-
|
|
258
|
+
triggers
|
|
258
259
|
.command('create')
|
|
259
|
-
.description('Create
|
|
260
|
-
.requiredOption('--connection <connectionId>', '
|
|
260
|
+
.description('Create a Trigger targeting one or more agents')
|
|
261
|
+
.requiredOption('--connection <connectionId>', 'Trigger Connection ID')
|
|
261
262
|
.requiredOption('--name <name>', 'Trigger name')
|
|
262
263
|
.requiredOption('--target-ids <ids>', 'Comma-separated target agent user IDs')
|
|
263
264
|
.option('--description <text>', 'Human-facing trigger description')
|
|
@@ -271,7 +272,7 @@ export function registerExternalTriggerCommands(program) {
|
|
|
271
272
|
.option('--client-context-json <json>', 'JSON object stored with the trigger')
|
|
272
273
|
.action(async (opts) => {
|
|
273
274
|
try {
|
|
274
|
-
const { client, orgId } = await
|
|
275
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
275
276
|
const agentInputTemplate = await resolveTemplate({ ...opts, required: true });
|
|
276
277
|
const data = {
|
|
277
278
|
connection_id: stripPrllScheme(opts.connection),
|
|
@@ -288,7 +289,7 @@ export function registerExternalTriggerCommands(program) {
|
|
|
288
289
|
client_context: parseJsonObject(opts.clientContextJson, '--client-context-json'),
|
|
289
290
|
}),
|
|
290
291
|
};
|
|
291
|
-
const result = await client.
|
|
292
|
+
const result = await client.createTrigger(orgId, data);
|
|
292
293
|
printJson(result);
|
|
293
294
|
printRefHint(result.id);
|
|
294
295
|
}
|
|
@@ -296,24 +297,24 @@ export function registerExternalTriggerCommands(program) {
|
|
|
296
297
|
printError(err);
|
|
297
298
|
}
|
|
298
299
|
});
|
|
299
|
-
|
|
300
|
+
triggers
|
|
300
301
|
.command('get')
|
|
301
|
-
.description('Get
|
|
302
|
-
.argument('<triggerId>', '
|
|
302
|
+
.description('Get a Trigger by ID')
|
|
303
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
303
304
|
.action(async (triggerId) => {
|
|
304
305
|
try {
|
|
305
|
-
const { client, orgId } = await
|
|
306
|
-
const result = await client.
|
|
306
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
307
|
+
const result = await client.getTrigger(orgId, stripPrllScheme(triggerId));
|
|
307
308
|
printJson(result);
|
|
308
309
|
}
|
|
309
310
|
catch (err) {
|
|
310
311
|
printError(err);
|
|
311
312
|
}
|
|
312
313
|
});
|
|
313
|
-
|
|
314
|
+
triggers
|
|
314
315
|
.command('update')
|
|
315
|
-
.description('Update
|
|
316
|
-
.argument('<triggerId>', '
|
|
316
|
+
.description('Update a Trigger')
|
|
317
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
317
318
|
.option('--name <name>', 'Trigger name')
|
|
318
319
|
.option('--description <text>', 'Human-facing trigger description')
|
|
319
320
|
.option('--status <status>', 'active | paused')
|
|
@@ -331,7 +332,7 @@ export function registerExternalTriggerCommands(program) {
|
|
|
331
332
|
.option('--client-context-json <json>', 'JSON object stored with the trigger')
|
|
332
333
|
.action(async (triggerId, opts) => {
|
|
333
334
|
try {
|
|
334
|
-
const { client, orgId } = await
|
|
335
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
335
336
|
const conflicts = [
|
|
336
337
|
[opts.attachedToUri, opts.clearAttachedTo, '--attached-to-uri', '--clear-attached-to'],
|
|
337
338
|
[opts.maxRuns, opts.clearMaxRuns, '--max-runs', '--clear-max-runs'],
|
|
@@ -364,21 +365,21 @@ export function registerExternalTriggerCommands(program) {
|
|
|
364
365
|
printError(new Error('No fields to update. Provide at least one option.'));
|
|
365
366
|
return;
|
|
366
367
|
}
|
|
367
|
-
const result = await client.
|
|
368
|
+
const result = await client.updateTrigger(orgId, stripPrllScheme(triggerId), patch);
|
|
368
369
|
printJson(result);
|
|
369
370
|
}
|
|
370
371
|
catch (err) {
|
|
371
372
|
printError(err);
|
|
372
373
|
}
|
|
373
374
|
});
|
|
374
|
-
|
|
375
|
+
triggers
|
|
375
376
|
.command('pause')
|
|
376
|
-
.description('Pause
|
|
377
|
-
.argument('<triggerId>', '
|
|
377
|
+
.description('Pause a Trigger')
|
|
378
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
378
379
|
.action(async (triggerId) => {
|
|
379
380
|
try {
|
|
380
|
-
const { client, orgId } = await
|
|
381
|
-
const result = await client.
|
|
381
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
382
|
+
const result = await client.updateTrigger(orgId, stripPrllScheme(triggerId), {
|
|
382
383
|
status: 'paused',
|
|
383
384
|
});
|
|
384
385
|
printJson(result);
|
|
@@ -387,14 +388,14 @@ export function registerExternalTriggerCommands(program) {
|
|
|
387
388
|
printError(err);
|
|
388
389
|
}
|
|
389
390
|
});
|
|
390
|
-
|
|
391
|
+
triggers
|
|
391
392
|
.command('resume')
|
|
392
|
-
.description('Resume a paused
|
|
393
|
-
.argument('<triggerId>', '
|
|
393
|
+
.description('Resume a paused Trigger')
|
|
394
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
394
395
|
.action(async (triggerId) => {
|
|
395
396
|
try {
|
|
396
|
-
const { client, orgId } = await
|
|
397
|
-
const result = await client.
|
|
397
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
398
|
+
const result = await client.updateTrigger(orgId, stripPrllScheme(triggerId), {
|
|
398
399
|
status: 'active',
|
|
399
400
|
});
|
|
400
401
|
printJson(result);
|
|
@@ -403,30 +404,30 @@ export function registerExternalTriggerCommands(program) {
|
|
|
403
404
|
printError(err);
|
|
404
405
|
}
|
|
405
406
|
});
|
|
406
|
-
|
|
407
|
+
triggers
|
|
407
408
|
.command('delete')
|
|
408
|
-
.description('Archive
|
|
409
|
-
.argument('<triggerId>', '
|
|
409
|
+
.description('Archive a Trigger')
|
|
410
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
410
411
|
.action(async (triggerId) => {
|
|
411
412
|
try {
|
|
412
|
-
const { client, orgId } = await
|
|
413
|
-
await client.
|
|
413
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
414
|
+
await client.deleteTrigger(orgId, stripPrllScheme(triggerId));
|
|
414
415
|
printJson({ ok: true });
|
|
415
416
|
}
|
|
416
417
|
catch (err) {
|
|
417
418
|
printError(err);
|
|
418
419
|
}
|
|
419
420
|
});
|
|
420
|
-
|
|
421
|
+
triggers
|
|
421
422
|
.command('runs')
|
|
422
|
-
.description('List run history for
|
|
423
|
-
.argument('<triggerId>', '
|
|
423
|
+
.description('List run history for a Trigger')
|
|
424
|
+
.argument('<triggerId>', 'Trigger ID')
|
|
424
425
|
.option('--limit <n>', 'Maximum number of runs to return', '50')
|
|
425
426
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
426
427
|
.action(async (triggerId, opts) => {
|
|
427
428
|
try {
|
|
428
|
-
const { client, orgId } = await
|
|
429
|
-
const result = await client.
|
|
429
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
430
|
+
const result = await client.listTriggerRuns(orgId, stripUndefined({
|
|
430
431
|
trigger_id: stripPrllScheme(triggerId),
|
|
431
432
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
432
433
|
cursor: opts.cursor,
|
|
@@ -437,30 +438,30 @@ export function registerExternalTriggerCommands(program) {
|
|
|
437
438
|
printError(err);
|
|
438
439
|
}
|
|
439
440
|
});
|
|
440
|
-
|
|
441
|
+
triggers
|
|
441
442
|
.command('run')
|
|
442
|
-
.description('Get a single
|
|
443
|
-
.argument('<runId>', '
|
|
443
|
+
.description('Get a single Trigger run')
|
|
444
|
+
.argument('<runId>', 'Trigger Run ID (xrn_...)')
|
|
444
445
|
.action(async (runId) => {
|
|
445
446
|
try {
|
|
446
|
-
const { client, orgId } = await
|
|
447
|
-
const result = await client.
|
|
447
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
448
|
+
const result = await client.getTriggerRun(orgId, stripPrllScheme(runId));
|
|
448
449
|
printJson(result);
|
|
449
450
|
}
|
|
450
451
|
catch (err) {
|
|
451
452
|
printError(err);
|
|
452
453
|
}
|
|
453
454
|
});
|
|
454
|
-
|
|
455
|
+
triggers
|
|
455
456
|
.command('events')
|
|
456
|
-
.description('List incoming events received by
|
|
457
|
-
.option('--connection <connectionId>', 'Filter by
|
|
457
|
+
.description('List incoming events received by Trigger Connections')
|
|
458
|
+
.option('--connection <connectionId>', 'Filter by Trigger Connection ID')
|
|
458
459
|
.option('--limit <n>', 'Maximum number of events to return', '50')
|
|
459
460
|
.option('--cursor <cursor>', 'Pagination cursor')
|
|
460
461
|
.action(async (opts) => {
|
|
461
462
|
try {
|
|
462
|
-
const { client, orgId } = await
|
|
463
|
-
const result = await client.
|
|
463
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
464
|
+
const result = await client.listTriggerIngressEvents(orgId, stripUndefined({
|
|
464
465
|
connection_id: opts.connection ? stripPrllScheme(opts.connection) : undefined,
|
|
465
466
|
limit: parsePositiveInt(opts.limit, '--limit'),
|
|
466
467
|
cursor: opts.cursor,
|
|
@@ -471,14 +472,14 @@ export function registerExternalTriggerCommands(program) {
|
|
|
471
472
|
printError(err);
|
|
472
473
|
}
|
|
473
474
|
});
|
|
474
|
-
|
|
475
|
+
triggers
|
|
475
476
|
.command('event')
|
|
476
477
|
.description('Get a single incoming event by ID')
|
|
477
|
-
.argument('<eventId>', '
|
|
478
|
+
.argument('<eventId>', 'Trigger Event ID (xin_...)')
|
|
478
479
|
.action(async (eventId) => {
|
|
479
480
|
try {
|
|
480
|
-
const { client, orgId } = await
|
|
481
|
-
const result = await client.
|
|
481
|
+
const { client, orgId } = await resolveTriggerCommandContext();
|
|
482
|
+
const result = await client.getTriggerIngressEvent(orgId, stripPrllScheme(eventId));
|
|
482
483
|
printJson(result);
|
|
483
484
|
}
|
|
484
485
|
catch (err) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
/** Wiki comment commands (`parall wiki comment …`), extracted from wiki.ts to
|
|
3
|
+
* respect the file-size ratchet. Registered by registerWikiCommands on the
|
|
4
|
+
* `wiki` command group. */
|
|
5
|
+
export declare function registerWikiCommentCommands(wiki: Command): void;
|
|
6
|
+
//# sourceMappingURL=wiki-comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki-comments.d.ts","sourceRoot":"","sources":["../../src/commands/wiki-comments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC;;2BAE2B;AAC3B,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,QA6HxD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printError, printJson, stripPrllScheme } from '../lib/output.js';
|
|
3
|
+
import { BODY_FILE_OPTION_DESC, BODY_OPTION_DESC, resolveCommentBody } from '../lib/text-input.js';
|
|
4
|
+
/** Wiki comment commands (`parall wiki comment …`), extracted from wiki.ts to
|
|
5
|
+
* respect the file-size ratchet. Registered by registerWikiCommands on the
|
|
6
|
+
* `wiki` command group. */
|
|
7
|
+
export function registerWikiCommentCommands(wiki) {
|
|
8
|
+
const comment = wiki.command('comment').description('Manage wiki comments');
|
|
9
|
+
comment
|
|
10
|
+
.command('list')
|
|
11
|
+
.description('List comments on a wiki target')
|
|
12
|
+
.argument('[wiki]', 'Wiki ID or slug')
|
|
13
|
+
.requiredOption('--target-type <type>', 'Target type (changeset or page)')
|
|
14
|
+
.requiredOption('--target-id <id>', 'Target ID (changeset ID or page path)')
|
|
15
|
+
.option('--limit <n>', 'Maximum number of comments to return', '50')
|
|
16
|
+
.option('--cursor <cursor>', 'Pagination cursor')
|
|
17
|
+
.option('--order <order>', 'Sort order (asc or desc)')
|
|
18
|
+
.action(async (wikiRef, opts) => {
|
|
19
|
+
try {
|
|
20
|
+
const ctx = resolveCredentials();
|
|
21
|
+
const { resolveWikiRefOrDefault } = await import('../lib/wiki.js');
|
|
22
|
+
const { COMMENT_TARGET } = await import('@parall/sdk');
|
|
23
|
+
const w = await resolveWikiRefOrDefault(ctx, wikiRef);
|
|
24
|
+
if (opts.targetType !== 'changeset' && opts.targetType !== 'page') {
|
|
25
|
+
throw new Error('--target-type must be "changeset" or "page"');
|
|
26
|
+
}
|
|
27
|
+
const targetUri = opts.targetType === 'changeset'
|
|
28
|
+
? COMMENT_TARGET.changeset(opts.targetId, w.id)
|
|
29
|
+
: COMMENT_TARGET.wikiPage(w.id, opts.targetId);
|
|
30
|
+
const result = await ctx.client.getComments(ctx.orgId, {
|
|
31
|
+
target_uri: targetUri,
|
|
32
|
+
limit: Number(opts.limit),
|
|
33
|
+
cursor: opts.cursor,
|
|
34
|
+
order: opts.order,
|
|
35
|
+
});
|
|
36
|
+
printJson(result);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
printError(err);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
comment
|
|
43
|
+
.command('add')
|
|
44
|
+
.description('Add a comment to a wiki target, or reply into an existing thread with --parent')
|
|
45
|
+
.argument('[wiki]', 'Wiki ID or slug')
|
|
46
|
+
.requiredOption('--target-type <type>', 'Target type (changeset or page)')
|
|
47
|
+
.requiredOption('--target-id <id>', 'Target ID (changeset ID or page path)')
|
|
48
|
+
.option('--body <text>', BODY_OPTION_DESC)
|
|
49
|
+
.option('--body-file <path>', BODY_FILE_OPTION_DESC)
|
|
50
|
+
.option('--parent <id>', 'Root comment ID — post as a threaded reply under it')
|
|
51
|
+
.action(async (wikiRef, opts) => {
|
|
52
|
+
try {
|
|
53
|
+
const body = resolveCommentBody(opts);
|
|
54
|
+
const ctx = resolveCredentials();
|
|
55
|
+
const { resolveWikiRefOrDefault } = await import('../lib/wiki.js');
|
|
56
|
+
const { COMMENT_TARGET } = await import('@parall/sdk');
|
|
57
|
+
const w = await resolveWikiRefOrDefault(ctx, wikiRef);
|
|
58
|
+
if (opts.targetType !== 'changeset' && opts.targetType !== 'page') {
|
|
59
|
+
throw new Error('--target-type must be "changeset" or "page"');
|
|
60
|
+
}
|
|
61
|
+
const targetUri = opts.targetType === 'changeset'
|
|
62
|
+
? COMMENT_TARGET.changeset(opts.targetId, w.id)
|
|
63
|
+
: COMMENT_TARGET.wikiPage(w.id, opts.targetId);
|
|
64
|
+
const result = await ctx.client.createComment(ctx.orgId, {
|
|
65
|
+
target_uri: targetUri,
|
|
66
|
+
body,
|
|
67
|
+
parent_id: opts.parent ? stripPrllScheme(opts.parent) : undefined,
|
|
68
|
+
});
|
|
69
|
+
printJson(result);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
printError(err);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
comment
|
|
76
|
+
.command('update')
|
|
77
|
+
.description('Update a wiki comment')
|
|
78
|
+
.argument('<commentId>', 'Comment ID')
|
|
79
|
+
.option('--body <text>', BODY_OPTION_DESC)
|
|
80
|
+
.option('--body-file <path>', BODY_FILE_OPTION_DESC)
|
|
81
|
+
.action(async (commentId, opts) => {
|
|
82
|
+
try {
|
|
83
|
+
const body = resolveCommentBody(opts);
|
|
84
|
+
const ctx = resolveCredentials();
|
|
85
|
+
const result = await ctx.client.updateComment(ctx.orgId, stripPrllScheme(commentId), {
|
|
86
|
+
body,
|
|
87
|
+
});
|
|
88
|
+
printJson(result);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
printError(err);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
comment
|
|
95
|
+
.command('delete')
|
|
96
|
+
.description('Delete a wiki comment')
|
|
97
|
+
.argument('<commentId>', 'Comment ID')
|
|
98
|
+
.action(async (commentId) => {
|
|
99
|
+
try {
|
|
100
|
+
const ctx = resolveCredentials();
|
|
101
|
+
await ctx.client.deleteComment(ctx.orgId, stripPrllScheme(commentId));
|
|
102
|
+
printJson({ ok: true });
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
printError(err);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAy4BpD"}
|