@uipath/case-tool 1.207.0-preview.367 → 1.207.0-preview.370

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.
Files changed (39) hide show
  1. package/dist/{case-debug-solution-projects-f94wce3t.js → case-debug-solution-projects-ykqrz4xg.js} +1 -1
  2. package/dist/{case-debug-studio-web-service-jhjk3zk7.js → case-debug-studio-web-service-rppy1m6b.js} +2 -2
  3. package/dist/{case-pack-service-91evnry5.js → case-pack-service-kehnmz9n.js} +2 -2
  4. package/dist/{case-splice-service-hwjbt81f.js → case-splice-service-j9e214e7.js} +4 -4
  5. package/dist/{case-validate-service-jnfqzm01.js → case-validate-service-5dhf4qwk.js} +3 -3
  6. package/dist/{connector-enrichment-service-y61hzyd0.js → connector-enrichment-service-bdsgzrag.js} +6 -6
  7. package/dist/{connector-lookup-service-4h5hja8h.js → connector-lookup-service-kegnjatm.js} +2 -2
  8. package/dist/{connector-task-shape-qamydqnd.js → connector-task-shape-g6tyc4z5.js} +2 -4
  9. package/dist/{index-k8d1sfwe.js → index-dhmkcg02.js} +1 -1
  10. package/dist/{index-3cwyemy2.js → index-evkttmew.js} +4 -6
  11. package/dist/{index-yrwscv5n.js → index-q1x98d8x.js} +4 -4
  12. package/dist/index.js +2 -2
  13. package/dist/{init-entry-points-pnp9cdn2.js → init-entry-points-x0nvrtm9.js} +1 -1
  14. package/dist/{integration-service-fetcher-mcgkg5ze.js → integration-service-fetcher-x51g4gqs.js} +2 -2
  15. package/dist/{node-sync-service-qdw4m8w9.js → node-sync-service-294p6p3s.js} +3 -3
  16. package/dist/{packager-tool-69fsh63m.js → packager-tool-28xxfwrq.js} +4 -4
  17. package/dist/{packager-tool-pf2j47x6.js → packager-tool-3jtt23q2.js} +2 -2
  18. package/dist/{packager-tool-brgq2a72.js → packager-tool-3tsqa9c3.js} +4 -4
  19. package/dist/{packager-tool-3e8gv9sb.js → packager-tool-7n537ahp.js} +1 -1
  20. package/dist/{packager-tool-rpwperwp.js → packager-tool-gprkdj5x.js} +1 -1
  21. package/dist/{packager-tool-bz5zyx0v.js → packager-tool-kddfrfyg.js} +170 -3871
  22. package/dist/{packager-tool-w4qdchyq.js → packager-tool-kk3x20wv.js} +1 -1
  23. package/dist/{packager-tool-5ag6241s.js → packager-tool-na9g8het.js} +1 -1
  24. package/dist/{packager-tool-tntebxp7.js → packager-tool-ndwgf588.js} +1 -1
  25. package/dist/{packager-tool-jh6aqn96.js → packager-tool-p4dmd3dz.js} +2 -2
  26. package/dist/{packager-tool-cenyx45f.js → packager-tool-p4wps74z.js} +31 -27
  27. package/dist/packager-tool-rp66dp3a.js +30 -0
  28. package/dist/packager-tool-vqexp500.js +95 -0
  29. package/dist/{packager-tool-xne5nd2v.js → packager-tool-xg6hb40t.js} +1 -1
  30. package/dist/{resourcesSyncService-0nk4yqyw.js → resourcesSyncService-wtjf3bz6.js} +4 -4
  31. package/dist/{rule-type-declaration-8d70fcg1.js → rule-type-declaration-5t95xkbj.js} +1 -1
  32. package/dist/{sdd-convert-service-nv95qnp3.js → sdd-convert-service-m9spcya6.js} +3 -3
  33. package/dist/{sdd-resolve-siblings-egr75wkg.js → sdd-resolve-siblings-46kdk7pa.js} +1 -1
  34. package/dist/{strict-sdd-audit-cybg0wva.js → strict-sdd-audit-egqnhewp.js} +1 -1
  35. package/dist/tool.js +1 -1
  36. package/dist/{trigger-enrichment-service-vg26e453.js → trigger-enrichment-service-at3735se.js} +10 -10
  37. package/package.json +2 -2
  38. package/dist/packager-tool-07mv459d.js +0 -205
  39. package/dist/packager-tool-e1tx5mqg.js +0 -48
@@ -21,15 +21,15 @@ import {
21
21
  reportFailure,
22
22
  ScreenLogger
23
23
  } from "./packager-tool-gw963pj7.js";
24
- import {
25
- resolveCaseSchemaWriteVersion2
26
- } from "./packager-tool-8c9e9s5q.js";
27
24
  import {
28
25
  registerSharedIncidentCommands,
29
26
  registerSharedInstanceCommands,
30
27
  registerSharedProcessCommands,
31
28
  registerSharedProcessesCommands
32
29
  } from "./packager-tool-t557xpq8.js";
30
+ import {
31
+ resolveCaseSchemaWriteVersion2
32
+ } from "./packager-tool-8c9e9s5q.js";
33
33
  import {
34
34
  RESOURCE_TYPES,
35
35
  TYPECACHE_INDEX_TYPES,
@@ -41,33 +41,15 @@ import {
41
41
  import {
42
42
  issueLine
43
43
  } from "./packager-tool-n6h4bz4d.js";
44
- import {
45
- createTaskBindings
46
- } from "./packager-tool-e1tx5mqg.js";
47
44
  import {
48
45
  buildMinimalCaseDocument
49
- } from "./packager-tool-5ag6241s.js";
50
- import {
51
- prefixedId
52
- } from "./packager-tool-1h7abxw6.js";
46
+ } from "./packager-tool-na9g8het.js";
53
47
  import {
54
- VALID_TASK_ENTRY_RULE_TYPES,
55
- VALID_STAGE_ENTRY_RULE_TYPES,
56
- VALID_STAGE_COMPLETION_RULE_TYPES,
57
- VALID_STAGE_EXIT_RULE_TYPES,
58
- VALID_CASE_COMPLETION_RULE_TYPES,
59
- VALID_CASE_EXIT_RULE_TYPES,
60
- buildRule,
61
- isStageNode,
62
48
  requireStageNode,
63
49
  requireTask,
64
- DEFAULT_TRIGGER_ID,
65
50
  isAnyTriggerNode,
66
- findTriggerNodes,
67
- ensureRootBindings,
68
- findOrPushBinding,
69
- remapBindingRefs
70
- } from "./packager-tool-07mv459d.js";
51
+ ensureRootBindings
52
+ } from "./packager-tool-vqexp500.js";
71
53
  import {
72
54
  VALID_PROJECT_NAME_REGEX,
73
55
  formatTraceLine,
@@ -81,7 +63,7 @@ var package_default = {
81
63
  name: "@uipath/case-tool",
82
64
  author: "UiPath",
83
65
  license: "SEE LICENSE IN LICENSE.txt",
84
- version: "1.207.0-preview.367",
66
+ version: "1.207.0-preview.370",
85
67
  description: "Manage Case Management instances, processes, and incidents.",
86
68
  private: false,
87
69
  repository: {
@@ -215,58 +197,8 @@ async function readSchema(filePath) {
215
197
  }
216
198
  return JSON.parse(content);
217
199
  }
218
- async function writeSchema(filePath, schema) {
219
- const fs = getFileSystem2();
220
- await fs.writeFile(filePath, JSON.stringify(schema, null, 4));
221
- }
222
200
 
223
201
  // src/commands/case-exit-conditions.ts
224
- var CASE_EXIT_CONDITIONS_ADD_EXAMPLES = [
225
- {
226
- Description: "Add a case completion condition with an initial rule",
227
- Command: 'uip maestro case case-exit-conditions add case.json --display-name "Completed" --marks-case-complete true --rule-type required-stages-completed',
228
- Output: {
229
- Code: "CaseExitConditionAdded",
230
- Data: {
231
- File: "case.json",
232
- ConditionId: "Condition_a1b2c3d4",
233
- DisplayName: "Completed",
234
- MarksCaseComplete: true,
235
- Rules: [
236
- [
237
- {
238
- id: "Rule_e5f6a7b8",
239
- rule: "required-stages-completed"
240
- }
241
- ]
242
- ]
243
- }
244
- }
245
- }
246
- ];
247
- var CASE_EXIT_CONDITIONS_EDIT_EXAMPLES = [
248
- {
249
- Description: "Rename a case exit condition",
250
- Command: 'uip maestro case case-exit-conditions update case.json Condition_a1b2c3d4 --display-name "Completed with all stages"',
251
- Output: {
252
- Code: "CaseExitConditionUpdated",
253
- Data: {
254
- File: "case.json",
255
- ConditionId: "Condition_a1b2c3d4",
256
- DisplayName: "Completed with all stages",
257
- MarksCaseComplete: true,
258
- Rules: [
259
- [
260
- {
261
- id: "Rule_e5f6a7b8",
262
- rule: "required-stages-completed"
263
- }
264
- ]
265
- ]
266
- }
267
- }
268
- }
269
- ];
270
202
  var CASE_EXIT_CONDITIONS_GET_EXAMPLES = [
271
203
  {
272
204
  Description: "Print a case exit condition by ID",
@@ -291,19 +223,6 @@ var CASE_EXIT_CONDITIONS_GET_EXAMPLES = [
291
223
  }
292
224
  }
293
225
  ];
294
- var CASE_EXIT_CONDITIONS_REMOVE_EXAMPLES = [
295
- {
296
- Description: "Remove a case exit condition by ID",
297
- Command: "uip maestro case case-exit-conditions remove case.json Condition_a1b2c3d4",
298
- Output: {
299
- Code: "CaseExitConditionRemoved",
300
- Data: {
301
- File: "case.json",
302
- ConditionId: "Condition_a1b2c3d4"
303
- }
304
- }
305
- }
306
- ];
307
226
  function requireCaseExitCondition(metadata, conditionId) {
308
227
  const condition = (metadata?.caseExitRules ?? []).find((c) => c.id === conditionId);
309
228
  if (!condition) {
@@ -313,175 +232,8 @@ function requireCaseExitCondition(metadata, conditionId) {
313
232
  }
314
233
  var registerCaseExitConditionsCommand = (program) => {
315
234
  const caseExitConditions = program.command("case-exit-conditions").description("Manage exit conditions on a case within a case management definition JSON file");
316
- caseExitConditions.command("add", { hidden: true }).description("Add an exit condition to a case").argument("<file>", "Path to the case management JSON file").option("-d, --display-name <name>", "Display name for the condition").option("--marks-case-complete <bool>", "Whether this condition marks the case complete (true or false)").option("--rule-type <type>", `Initial rule type: For completion: ${VALID_CASE_COMPLETION_RULE_TYPES.join(", ")}, For exit: ${VALID_CASE_EXIT_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the initial rule").option("--selected-stage-id <id>", "Stage ID for selected-stage-* initial rules").examples(CASE_EXIT_CONDITIONS_ADD_EXAMPLES).trackedAction(processContext, async (file, options) => {
317
- if (options.ruleType !== undefined && (options.marksCaseComplete === "false" || options.marksCaseComplete === undefined) && !VALID_CASE_EXIT_RULE_TYPES.includes(options.ruleType)) {
318
- OutputFormatter.error({
319
- Result: RESULTS.Failure,
320
- Message: "Error adding case exit condition",
321
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_CASE_EXIT_RULE_TYPES.join(", ")}`
322
- });
323
- processContext.exit(1);
324
- return;
325
- }
326
- if (options.ruleType !== undefined && options.marksCaseComplete === "true" && !VALID_CASE_COMPLETION_RULE_TYPES.includes(options.ruleType)) {
327
- OutputFormatter.error({
328
- Result: RESULTS.Failure,
329
- Message: "Error adding case completion condition",
330
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_CASE_COMPLETION_RULE_TYPES.join(", ")}`
331
- });
332
- processContext.exit(1);
333
- return;
334
- }
335
- const [readError, schema] = await catchError2(readSchema(file));
336
- if (readError) {
337
- OutputFormatter.error({
338
- Result: RESULTS.Failure,
339
- Message: "Error adding case exit condition",
340
- Instructions: readError.message
341
- });
342
- processContext.exit(1);
343
- return;
344
- }
345
- const id = prefixedId("Condition_");
346
- const condition = {
347
- id,
348
- displayName: options.displayName,
349
- rules: []
350
- };
351
- if (options.marksCaseComplete !== undefined) {
352
- condition.marksCaseComplete = options.marksCaseComplete === "true";
353
- }
354
- if (options.ruleType !== undefined) {
355
- const rule = buildRule({
356
- id: prefixedId("Rule_"),
357
- ruleType: options.ruleType,
358
- conditionExpression: options.conditionExpression,
359
- selectedStageId: options.selectedStageId
360
- });
361
- condition.rules = [[rule]];
362
- }
363
- schema.metadata ??= {};
364
- schema.metadata.caseExitRules ??= [];
365
- schema.metadata.caseExitRules.push(condition);
366
- const [writeError] = await catchError2(writeSchema(file, schema));
367
- if (writeError) {
368
- OutputFormatter.error({
369
- Result: RESULTS.Failure,
370
- Message: "Error adding case exit condition",
371
- Instructions: writeError.message
372
- });
373
- processContext.exit(1);
374
- return;
375
- }
376
- OutputFormatter.success({
377
- Result: RESULTS.Success,
378
- Code: "CaseExitConditionAdded",
379
- Data: {
380
- File: file,
381
- ConditionId: id,
382
- DisplayName: options.displayName,
383
- MarksCaseComplete: condition.marksCaseComplete,
384
- Rules: condition.rules
385
- }
386
- });
387
- });
388
- caseExitConditions.command("update", { hidden: true }).description("Update an exit condition on a case").argument("<file>", "Path to the case management JSON file").argument("<condition-id>", "ID of the case exit condition to update").option("-d, --display-name <name>", "New display name for the condition").option("--marks-case-complete <bool>", "Set marks-case-complete (true or false)").option("--rule-type <type>", `Append a new rule with this type: For completion: ${VALID_CASE_COMPLETION_RULE_TYPES.join(", ")}, For exit: ${VALID_CASE_EXIT_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the new rule").option("--selected-stage-id <id>", "Stage ID for selected-stage-* rules").examples(CASE_EXIT_CONDITIONS_EDIT_EXAMPLES).trackedAction(processContext, async (file, conditionId, options) => {
389
- if (Object.values(options).every((v) => v === undefined)) {
390
- OutputFormatter.error({
391
- Result: RESULTS.Failure,
392
- Message: "Error editing case exit condition",
393
- Instructions: "No fields to update. Provide at least one of: --display-name, --marks-case-complete, --rule-type"
394
- });
395
- processContext.exit(1);
396
- return;
397
- }
398
- if (options.ruleType !== undefined && options.marksCaseComplete === "false" && !VALID_CASE_EXIT_RULE_TYPES.includes(options.ruleType)) {
399
- OutputFormatter.error({
400
- Result: RESULTS.Failure,
401
- Message: "Error editing case exit condition",
402
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_CASE_EXIT_RULE_TYPES.join(", ")}`
403
- });
404
- processContext.exit(1);
405
- return;
406
- }
407
- if (options.ruleType !== undefined && options.marksCaseComplete === "true" && !VALID_CASE_COMPLETION_RULE_TYPES.includes(options.ruleType)) {
408
- OutputFormatter.error({
409
- Result: RESULTS.Failure,
410
- Message: "Error editing case completion condition",
411
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_CASE_COMPLETION_RULE_TYPES.join(", ")}`
412
- });
413
- processContext.exit(1);
414
- return;
415
- }
416
- const [readError, schema] = await catchError2(readSchema(file));
417
- if (readError) {
418
- OutputFormatter.error({
419
- Result: RESULTS.Failure,
420
- Message: "Error editing case exit condition",
421
- Instructions: readError.message
422
- });
423
- processContext.exit(1);
424
- return;
425
- }
426
- const [findError, condition] = catchError2(() => requireCaseExitCondition(schema.metadata, conditionId));
427
- if (findError) {
428
- OutputFormatter.error({
429
- Result: RESULTS.Failure,
430
- Message: "Error editing case exit condition",
431
- Instructions: findError.message
432
- });
433
- processContext.exit(1);
434
- return;
435
- }
436
- if (options.displayName !== undefined) {
437
- condition.displayName = options.displayName;
438
- }
439
- if (options.marksCaseComplete !== undefined) {
440
- condition.marksCaseComplete = options.marksCaseComplete === "true";
441
- }
442
- if ((options.conditionExpression !== undefined || options.selectedStageId !== undefined) && options.ruleType === undefined) {
443
- OutputFormatter.error({
444
- Result: RESULTS.Failure,
445
- Message: "Error editing case exit condition",
446
- Instructions: "--condition-expression and --selected-stage-id require --rule-type"
447
- });
448
- processContext.exit(1);
449
- return;
450
- }
451
- if (options.ruleType !== undefined) {
452
- const rule = buildRule({
453
- id: prefixedId("Rule_"),
454
- ruleType: options.ruleType,
455
- conditionExpression: options.conditionExpression,
456
- selectedStageId: options.selectedStageId
457
- });
458
- if (!condition.rules) {
459
- condition.rules = [];
460
- }
461
- condition.rules.push([rule]);
462
- }
463
- const [writeError] = await catchError2(writeSchema(file, schema));
464
- if (writeError) {
465
- OutputFormatter.error({
466
- Result: RESULTS.Failure,
467
- Message: "Error editing case exit condition",
468
- Instructions: writeError.message
469
- });
470
- processContext.exit(1);
471
- return;
472
- }
473
- OutputFormatter.success({
474
- Result: RESULTS.Success,
475
- Code: "CaseExitConditionUpdated",
476
- Data: {
477
- File: file,
478
- ConditionId: conditionId,
479
- DisplayName: condition.displayName,
480
- MarksCaseComplete: condition.marksCaseComplete,
481
- Rules: condition.rules
482
- }
483
- });
484
- });
235
+ caseExitConditions.command("add", { hidden: true });
236
+ caseExitConditions.command("update", { hidden: true });
485
237
  caseExitConditions.command("get").description("Print an exit condition from a case").argument("<file>", "Path to the case management JSON file").argument("<condition-id>", "ID of the case exit condition to retrieve").examples(CASE_EXIT_CONDITIONS_GET_EXAMPLES).trackedAction(processContext, async (file, conditionId) => {
486
238
  const [readError, schema] = await catchError2(readSchema(file));
487
239
  if (readError) {
@@ -509,87 +261,10 @@ var registerCaseExitConditionsCommand = (program) => {
509
261
  Data: { Condition: condition }
510
262
  });
511
263
  });
512
- caseExitConditions.command("remove", { hidden: true }).description("Remove an exit condition from a case").argument("<file>", "Path to the case management JSON file").argument("<condition-id>", "ID of the case exit condition to remove").examples(CASE_EXIT_CONDITIONS_REMOVE_EXAMPLES).trackedAction(processContext, async (file, conditionId) => {
513
- const [readError, schema] = await catchError2(readSchema(file));
514
- if (readError) {
515
- OutputFormatter.error({
516
- Result: RESULTS.Failure,
517
- Message: "Error removing case exit condition",
518
- Instructions: readError.message
519
- });
520
- processContext.exit(1);
521
- return;
522
- }
523
- const [findError] = catchError2(() => requireCaseExitCondition(schema.metadata, conditionId));
524
- if (findError) {
525
- OutputFormatter.error({
526
- Result: RESULTS.Failure,
527
- Message: "Error removing case exit condition",
528
- Instructions: findError.message
529
- });
530
- processContext.exit(1);
531
- return;
532
- }
533
- schema.metadata ??= {};
534
- schema.metadata.caseExitRules = (schema.metadata.caseExitRules ?? []).filter((c) => c.id !== conditionId);
535
- const [writeError] = await catchError2(writeSchema(file, schema));
536
- if (writeError) {
537
- OutputFormatter.error({
538
- Result: RESULTS.Failure,
539
- Message: "Error removing case exit condition",
540
- Instructions: writeError.message
541
- });
542
- processContext.exit(1);
543
- return;
544
- }
545
- OutputFormatter.success({
546
- Result: RESULTS.Success,
547
- Code: "CaseExitConditionRemoved",
548
- Data: {
549
- File: file,
550
- ConditionId: conditionId
551
- }
552
- });
553
- });
264
+ caseExitConditions.command("remove", { hidden: true });
554
265
  };
555
266
 
556
267
  // src/commands/cases.ts
557
- var CASES_ADD_EXAMPLES = [
558
- {
559
- Description: "Create a new case management definition file",
560
- Command: 'uip maestro case cases add --name "Invoice Review" --file invoice-review.json',
561
- Output: {
562
- Code: "CaseCreated",
563
- Data: {
564
- File: "invoice-review.json",
565
- Id: "root",
566
- Name: "Invoice Review",
567
- CaseIdentifier: "Invoice Review",
568
- CaseIdentifierType: "constant",
569
- CaseAppEnabled: false,
570
- TriggerId: DEFAULT_TRIGGER_ID,
571
- Version: "32.0.3"
572
- }
573
- }
574
- }
575
- ];
576
- var CASES_EDIT_EXAMPLES = [
577
- {
578
- Description: "Rename an existing case management definition",
579
- Command: 'uip maestro case cases update invoice-review.json --name "Invoice Review v2"',
580
- Output: {
581
- Code: "CaseUpdated",
582
- Data: {
583
- File: "invoice-review.json",
584
- Id: "root",
585
- Name: "Invoice Review v2",
586
- CaseIdentifier: "Invoice Review",
587
- CaseIdentifierType: "constant",
588
- CaseAppEnabled: false
589
- }
590
- }
591
- }
592
- ];
593
268
  var CASES_GET_EXAMPLES = [
594
269
  {
595
270
  Description: "Show root metadata for an existing case management definition",
@@ -625,53 +300,9 @@ function formatRootMetadata(file, schema) {
625
300
  function getReadFailureInstructions(file, error) {
626
301
  return `Verify that '${file}' exists, is readable, and contains valid case management JSON. Details: ${error.message}`;
627
302
  }
628
- function getWriteFailureInstructions(file, error) {
629
- return `Verify that '${file}' is writable and that its parent directory exists. Details: ${error.message}`;
630
- }
631
303
  var registerCasesCommand = (program) => {
632
304
  const cases = program.command("cases").description("Manage local case management definition JSON files");
633
- cases.command("add", { hidden: true }).description("Create a new case management definition JSON file").requiredOption("-n, --name <name>", "Name of the case management definition").requiredOption("-f, --file <path>", "Output path for the new case JSON file").option("--case-identifier <caseIdentifier>", "Case identifier (defaults to name)").option("--identifier-type <type>", "Case identifier type: constant or external (default: constant)").option("--case-app-enabled", "Enable the case app for this definition").option("-d, --description <description>", "Description of the case management definition").examples(CASES_ADD_EXAMPLES).trackedAction(processContext, async (options) => {
634
- const fs = getFileSystem2();
635
- if (await fs.exists(options.file)) {
636
- OutputFormatter.error({
637
- Result: RESULTS.Failure,
638
- Message: `File already exists: ${options.file}. Use 'cases update' to modify it.`,
639
- Instructions: "Choose a different output path or use 'cases update'."
640
- });
641
- processContext.exit(1);
642
- return;
643
- }
644
- const schema = buildMinimalCaseDocument({
645
- ...options,
646
- schemaVersion: await resolveCaseSchemaWriteVersion2()
647
- });
648
- const triggerId = schema.nodes.find(isAnyTriggerNode)?.id;
649
- const [writeError] = await catchError2(writeSchema(options.file, schema));
650
- if (writeError) {
651
- OutputFormatter.error({
652
- Result: RESULTS.Failure,
653
- Message: "Error creating case",
654
- Instructions: getWriteFailureInstructions(options.file, writeError)
655
- });
656
- processContext.exit(1);
657
- return;
658
- }
659
- OutputFormatter.success({
660
- Result: RESULTS.Success,
661
- Code: "CaseCreated",
662
- Data: {
663
- File: options.file,
664
- Id: schema.id,
665
- Name: schema.name,
666
- CaseIdentifier: schema.metadata?.caseIdentifier,
667
- CaseIdentifierType: schema.metadata?.caseIdentifierType,
668
- CaseAppEnabled: schema.metadata?.caseAppEnabled,
669
- TriggerId: triggerId,
670
- Version: schema.version,
671
- Description: schema.description
672
- }
673
- });
674
- });
305
+ cases.command("add", { hidden: true });
675
306
  cases.command("get").description("Show root metadata from a case management JSON file").argument("<file>", "Path to the case management JSON file to read").examples(CASES_GET_EXAMPLES).trackedAction(processContext, async (file) => {
676
307
  const [readError, schema] = await catchError2(readSchema(file));
677
308
  if (readError) {
@@ -689,66 +320,7 @@ var registerCasesCommand = (program) => {
689
320
  Data: formatRootMetadata(file, schema)
690
321
  });
691
322
  });
692
- cases.command("update", { hidden: true }).description("Update an existing case management definition JSON file").argument("<file>", "Path to the case management JSON file to update").option("-n, --name <name>", "New name for the case management definition").option("--case-identifier <caseIdentifier>", "New case identifier string").option("--identifier-type <type>", "New case identifier type: constant or external").option("--case-app-enabled", "Enable the case app for this definition").option("-d, --description <description>", "New description for the case management definition").examples(CASES_EDIT_EXAMPLES).trackedAction(processContext, async (file, options) => {
693
- if (Object.values(options).every((v) => v === undefined)) {
694
- OutputFormatter.error({
695
- Result: RESULTS.Failure,
696
- Message: "No fields to update.",
697
- Instructions: "Provide at least one of: --name, --case-identifier, --identifier-type, --case-app-enabled, --description"
698
- });
699
- processContext.exit(1);
700
- return;
701
- }
702
- const [readError, schema] = await catchError2(readSchema(file));
703
- if (readError) {
704
- OutputFormatter.error({
705
- Result: RESULTS.Failure,
706
- Message: "Error reading case file",
707
- Instructions: getReadFailureInstructions(file, readError)
708
- });
709
- processContext.exit(1);
710
- return;
711
- }
712
- if (options.name !== undefined) {
713
- schema.name = options.name;
714
- }
715
- schema.metadata ??= {};
716
- if (options.caseIdentifier !== undefined) {
717
- schema.metadata.caseIdentifier = options.caseIdentifier;
718
- }
719
- if (options.identifierType !== undefined) {
720
- schema.metadata.caseIdentifierType = options.identifierType;
721
- }
722
- if (options.caseAppEnabled !== undefined) {
723
- schema.metadata.caseAppEnabled = options.caseAppEnabled;
724
- }
725
- if (options.description !== undefined) {
726
- schema.description = options.description;
727
- }
728
- const [writeError] = await catchError2(writeSchema(file, schema));
729
- if (writeError) {
730
- OutputFormatter.error({
731
- Result: RESULTS.Failure,
732
- Message: "Error editing case",
733
- Instructions: getWriteFailureInstructions(file, writeError)
734
- });
735
- processContext.exit(1);
736
- return;
737
- }
738
- OutputFormatter.success({
739
- Result: RESULTS.Success,
740
- Code: "CaseUpdated",
741
- Data: {
742
- File: file,
743
- Id: schema.id,
744
- Name: schema.name,
745
- CaseIdentifier: schema.metadata?.caseIdentifier,
746
- CaseIdentifierType: schema.metadata?.caseIdentifierType,
747
- CaseAppEnabled: schema.metadata?.caseAppEnabled,
748
- Description: schema.description
749
- }
750
- });
751
- });
323
+ cases.command("update", { hidden: true });
752
324
  };
753
325
 
754
326
  // src/commands/debug.ts
@@ -843,7 +415,7 @@ function registerDebugCommand(program) {
843
415
  logger.info(` Tenant: ${tenantName} (${tenantId})`);
844
416
  logger.info(` Base URL: ${baseUrl}`);
845
417
  const pollInterval = parseInt(options.pollInterval || "2000", 10);
846
- const { CaseDebugStudioWebService } = await import("./case-debug-studio-web-service-jhjk3zk7.js");
418
+ const { CaseDebugStudioWebService } = await import("./case-debug-studio-web-service-rppy1m6b.js");
847
419
  const {
848
420
  buildFaultedDebugFailureOutput,
849
421
  buildPollTimeoutFailureOutput,
@@ -875,7 +447,7 @@ function registerDebugCommand(program) {
875
447
  const {
876
448
  buildSolutionUploadFailureOutput,
877
449
  isSolutionUploadHttpError
878
- } = await import("./index-k8d1sfwe.js");
450
+ } = await import("./index-dhmkcg02.js");
879
451
  if (isSolutionUploadHttpError(executeError)) {
880
452
  OutputFormatter.error(buildSolutionUploadFailureOutput(executeError, {
881
453
  subject: "case",
@@ -920,46 +492,12 @@ function registerDebugCommand(program) {
920
492
  }
921
493
 
922
494
  // src/commands/edges.ts
923
- var EDGES_ADD_EXAMPLES = [
495
+ var EDGES_GET_EXAMPLES = [
924
496
  {
925
- Description: "Add an edge between two stages",
926
- Command: 'uip maestro case edges add case.json --source Stage_1 --target Stage_2 --label "Next"',
497
+ Description: "Print an edge by ID",
498
+ Command: "uip maestro case edges get case.json edge_a1b2c3d4",
927
499
  Output: {
928
- Code: "EdgeAdded",
929
- Data: {
930
- File: "case.json",
931
- EdgeId: "edge_a1b2c3d4",
932
- Type: "case-management:Edge",
933
- Source: "Stage_1",
934
- Target: "Stage_2",
935
- Label: "Next"
936
- }
937
- }
938
- }
939
- ];
940
- var EDGES_EDIT_EXAMPLES = [
941
- {
942
- Description: "Rename an edge label",
943
- Command: 'uip maestro case edges update case.json edge_a1b2c3d4 --label "Approve"',
944
- Output: {
945
- Code: "EdgeUpdated",
946
- Data: {
947
- File: "case.json",
948
- EdgeId: "edge_a1b2c3d4",
949
- Type: "case-management:Edge",
950
- Source: "Stage_1",
951
- Target: "Stage_2",
952
- Label: "Approve"
953
- }
954
- }
955
- }
956
- ];
957
- var EDGES_GET_EXAMPLES = [
958
- {
959
- Description: "Print an edge by ID",
960
- Command: "uip maestro case edges get case.json edge_a1b2c3d4",
961
- Output: {
962
- Code: "EdgeFound",
500
+ Code: "EdgeFound",
963
501
  Data: {
964
502
  Edge: {
965
503
  id: "edge_a1b2c3d4",
@@ -974,19 +512,6 @@ var EDGES_GET_EXAMPLES = [
974
512
  }
975
513
  }
976
514
  ];
977
- var EDGES_REMOVE_EXAMPLES = [
978
- {
979
- Description: "Remove an edge by ID",
980
- Command: "uip maestro case edges remove case.json edge_a1b2c3d4",
981
- Output: {
982
- Code: "EdgeRemoved",
983
- Data: {
984
- File: "case.json",
985
- EdgeId: "edge_a1b2c3d4"
986
- }
987
- }
988
- }
989
- ];
990
515
  function requireEdge(schema, edgeId) {
991
516
  const edge = schema.edges.find((e) => e.id === edgeId);
992
517
  if (!edge) {
@@ -994,159 +519,10 @@ function requireEdge(schema, edgeId) {
994
519
  }
995
520
  return edge;
996
521
  }
997
- function isTriggerSource(schema, sourceId) {
998
- const sourceNode = schema.nodes.find((n) => n.id === sourceId);
999
- return sourceNode !== undefined && isAnyTriggerNode(sourceNode);
1000
- }
1001
522
  var registerEdgesCommand = (program) => {
1002
523
  const edges = program.command("edges").description("Manage edges within a case management definition JSON file");
1003
- edges.command("add", { hidden: true }).description("Add a new edge between two stages. Type is inferred from the source node: Trigger→TriggerEdge, Stage→Edge.").argument("<file>", "Path to the case management JSON file").requiredOption("-s, --source <stageOrTriggerId>", "ID of the source stage or trigger").requiredOption("-t, --target <stageId>", "ID of the target stage").option("-l, --label <label>", "Display label for the edge").option("--source-handle <direction>", "Source direction: right, left, top, bottom (default: right)").option("--target-handle <direction>", "Target direction: right, left, top, bottom (default: left)").option("--z-index <number>", "Z-index layer for rendering order").examples(EDGES_ADD_EXAMPLES).trackedAction(processContext, async (file, options) => {
1004
- const [readError, schema] = await catchError2(readSchema(file));
1005
- if (readError) {
1006
- OutputFormatter.error({
1007
- Result: RESULTS.Failure,
1008
- Message: "Error adding edge",
1009
- Instructions: readError.message
1010
- });
1011
- processContext.exit(1);
1012
- return;
1013
- }
1014
- const sourceExists = schema.nodes.some((n) => n.id === options.source);
1015
- if (!sourceExists) {
1016
- OutputFormatter.error({
1017
- Result: RESULTS.Failure,
1018
- Message: "Error adding edge",
1019
- Instructions: `Source not found with id: ${options.source}`
1020
- });
1021
- processContext.exit(1);
1022
- return;
1023
- }
1024
- const targetExists = schema.nodes.some((n) => n.id === options.target);
1025
- if (!targetExists) {
1026
- OutputFormatter.error({
1027
- Result: RESULTS.Failure,
1028
- Message: "Error adding edge",
1029
- Instructions: `Target not found with id: ${options.target}`
1030
- });
1031
- processContext.exit(1);
1032
- return;
1033
- }
1034
- const id = prefixedId("edge_");
1035
- const isTrigger = isTriggerSource(schema, options.source);
1036
- const sourceDir = options.sourceHandle ?? "right";
1037
- const targetDir = options.targetHandle ?? "left";
1038
- const base = {
1039
- id,
1040
- source: options.source,
1041
- target: options.target,
1042
- sourceHandle: `${options.source}____source____${sourceDir}`,
1043
- targetHandle: `${options.target}____target____${targetDir}`,
1044
- zIndex: options.zIndex !== undefined ? Number(options.zIndex) : undefined,
1045
- data: {
1046
- label: options.label
1047
- }
1048
- };
1049
- let edge;
1050
- if (isTrigger) {
1051
- edge = {
1052
- ...base,
1053
- type: "case-management:TriggerEdge"
1054
- };
1055
- } else {
1056
- edge = {
1057
- ...base,
1058
- type: "case-management:Edge"
1059
- };
1060
- }
1061
- schema.edges.push(edge);
1062
- const [writeError] = await catchError2(writeSchema(file, schema));
1063
- if (writeError) {
1064
- OutputFormatter.error({
1065
- Result: RESULTS.Failure,
1066
- Message: "Error adding edge",
1067
- Instructions: writeError.message
1068
- });
1069
- processContext.exit(1);
1070
- return;
1071
- }
1072
- OutputFormatter.success({
1073
- Result: RESULTS.Success,
1074
- Code: "EdgeAdded",
1075
- Data: {
1076
- File: file,
1077
- EdgeId: id,
1078
- Type: edge.type,
1079
- Source: options.source,
1080
- Target: options.target,
1081
- Label: options.label
1082
- }
1083
- });
1084
- });
1085
- edges.command("update", { hidden: true }).description("Update an existing edge in a case management definition").argument("<file>", "Path to the case management JSON file").argument("<edge-id>", "ID of the edge to update").option("-l, --label <label>", "New display label for the edge").option("--source-handle <handle>", "New source handle identifier").option("--target-handle <handle>", "New target handle identifier").option("--z-index <number>", "New z-index layer for rendering order").examples(EDGES_EDIT_EXAMPLES).trackedAction(processContext, async (file, edgeId, options) => {
1086
- if (Object.values(options).every((v) => v === undefined)) {
1087
- OutputFormatter.error({
1088
- Result: RESULTS.Failure,
1089
- Message: "Error editing edge",
1090
- Instructions: "No fields to update. Provide at least one of: --label, --source-handle, --target-handle, --z-index"
1091
- });
1092
- processContext.exit(1);
1093
- return;
1094
- }
1095
- const [readError, schema] = await catchError2(readSchema(file));
1096
- if (readError) {
1097
- OutputFormatter.error({
1098
- Result: RESULTS.Failure,
1099
- Message: "Error editing edge",
1100
- Instructions: readError.message
1101
- });
1102
- processContext.exit(1);
1103
- return;
1104
- }
1105
- const [findError, edge] = catchError2(() => requireEdge(schema, edgeId));
1106
- if (findError) {
1107
- OutputFormatter.error({
1108
- Result: RESULTS.Failure,
1109
- Message: "Error editing edge",
1110
- Instructions: findError.message
1111
- });
1112
- processContext.exit(1);
1113
- return;
1114
- }
1115
- if (options.label !== undefined) {
1116
- edge.data.label = options.label;
1117
- }
1118
- if (options.sourceHandle !== undefined) {
1119
- edge.sourceHandle = options.sourceHandle;
1120
- }
1121
- if (options.targetHandle !== undefined) {
1122
- edge.targetHandle = options.targetHandle;
1123
- }
1124
- if (options.zIndex !== undefined) {
1125
- edge.zIndex = Number(options.zIndex);
1126
- }
1127
- const [writeError] = await catchError2(writeSchema(file, schema));
1128
- if (writeError) {
1129
- OutputFormatter.error({
1130
- Result: RESULTS.Failure,
1131
- Message: "Error editing edge",
1132
- Instructions: writeError.message
1133
- });
1134
- processContext.exit(1);
1135
- return;
1136
- }
1137
- OutputFormatter.success({
1138
- Result: RESULTS.Success,
1139
- Code: "EdgeUpdated",
1140
- Data: {
1141
- File: file,
1142
- EdgeId: edgeId,
1143
- Type: edge.type,
1144
- Source: edge.source,
1145
- Target: edge.target,
1146
- Label: edge.data.label
1147
- }
1148
- });
1149
- });
524
+ edges.command("add", { hidden: true });
525
+ edges.command("update", { hidden: true });
1150
526
  edges.command("get").description("Print an edge from a case management definition").argument("<file>", "Path to the case management JSON file").argument("<edge-id>", "ID of the edge to retrieve").examples(EDGES_GET_EXAMPLES).trackedAction(processContext, async (file, edgeId) => {
1151
527
  const [readError, schema] = await catchError2(readSchema(file));
1152
528
  if (readError) {
@@ -1174,44 +550,7 @@ var registerEdgesCommand = (program) => {
1174
550
  Data: { Edge: edge }
1175
551
  });
1176
552
  });
1177
- edges.command("remove", { hidden: true }).description("Remove an edge from a case management definition").argument("<file>", "Path to the case management JSON file").argument("<edge-id>", "ID of the edge to remove").examples(EDGES_REMOVE_EXAMPLES).trackedAction(processContext, async (file, edgeId) => {
1178
- const [readError, schema] = await catchError2(readSchema(file));
1179
- if (readError) {
1180
- OutputFormatter.error({
1181
- Result: RESULTS.Failure,
1182
- Message: "Error removing edge",
1183
- Instructions: readError.message
1184
- });
1185
- processContext.exit(1);
1186
- return;
1187
- }
1188
- const [findError] = catchError2(() => requireEdge(schema, edgeId));
1189
- if (findError) {
1190
- OutputFormatter.error({
1191
- Result: RESULTS.Failure,
1192
- Message: "Error removing edge",
1193
- Instructions: findError.message
1194
- });
1195
- processContext.exit(1);
1196
- return;
1197
- }
1198
- schema.edges = schema.edges.filter((e) => e.id !== edgeId);
1199
- const [writeError] = await catchError2(writeSchema(file, schema));
1200
- if (writeError) {
1201
- OutputFormatter.error({
1202
- Result: RESULTS.Failure,
1203
- Message: "Error removing edge",
1204
- Instructions: writeError.message
1205
- });
1206
- processContext.exit(1);
1207
- return;
1208
- }
1209
- OutputFormatter.success({
1210
- Result: RESULTS.Success,
1211
- Code: "EdgeRemoved",
1212
- Data: { File: file, EdgeId: edgeId }
1213
- });
1214
- });
553
+ edges.command("remove", { hidden: true });
1215
554
  };
1216
555
 
1217
556
  // src/commands/format.ts
@@ -1291,7 +630,7 @@ var initCaseProject = async (name, options) => {
1291
630
  throw new Error(`Invalid project name "${name}". Name can only contain letters, numbers, underscores (_), and hyphens (-).`);
1292
631
  }
1293
632
  const fs = getFileSystem2();
1294
- const { prepareProjectLocation, tryRegisterProjectInParentSolution } = await import("./index-k8d1sfwe.js");
633
+ const { prepareProjectLocation, tryRegisterProjectInParentSolution } = await import("./index-dhmkcg02.js");
1295
634
  const { projectDir, autoCreatedSolution } = await prepareProjectLocation(fs, fs.path.resolve(name), name, { skipRegistration: options.skipSolutionRegistration === true });
1296
635
  const projectDirExists = await fs.stat(projectDir).then((stat) => stat !== null).catch((err) => {
1297
636
  const code = err instanceof Error ? err.code : undefined;
@@ -1346,7 +685,7 @@ var initCaseProject = async (name, options) => {
1346
685
  }
1347
686
  return String(text);
1348
687
  };
1349
- const { entryPointsDocument, initEntryPoints } = await import("./init-entry-points-pnp9cdn2.js");
688
+ const { entryPointsDocument, initEntryPoints } = await import("./init-entry-points-x0nvrtm9.js");
1350
689
  const entryPoints = initEntryPoints({
1351
690
  sidecarFileName,
1352
691
  ...casePlanExists && {
@@ -1681,7 +1020,7 @@ var CASE_PACK_EXAMPLES = [
1681
1020
  var registerPackCommand = (program) => {
1682
1021
  const command = program.command("pack").description("Pack a Case project into a .nupkg file").argument("<project-path>", "Path to the Case project directory").argument("<output-path>", "Output directory where the .nupkg will be saved").option("-n, --name <name>", "Package name (default: project folder name)").option("-v, --version <version>", "Package version (default: 1.0.0)", "1.0.0");
1683
1022
  registerPackageMetadataOptions(command).examples(CASE_PACK_EXAMPLES).trackedAction(processContext, async (projectPath, outputPath, options) => {
1684
- const { CasePackService } = await import("./case-pack-service-91evnry5.js");
1023
+ const { CasePackService } = await import("./case-pack-service-kehnmz9n.js");
1685
1024
  const service = new CasePackService;
1686
1025
  const [error, result] = await catchError2(service.execute(projectPath, {
1687
1026
  output: outputPath,
@@ -2282,7 +1621,7 @@ Subcommands:
2282
1621
  search Find resources by keyword and/or field filters
2283
1622
  get Get full schema for a single resource`);
2284
1623
  registry.command("pull").description("Pull and sync data from Case registry").option("-f, --force", "Force refresh, ignore cache").option("-s, --solution-id <solutionId>", "Include the registry of the solution").examples(REGISTRY_PULL_EXAMPLES).trackedAction(processContext, async (options) => {
2285
- const { pullResources } = await import("./resourcesSyncService-0nk4yqyw.js");
1624
+ const { pullResources } = await import("./resourcesSyncService-wtjf3bz6.js");
2286
1625
  const [mapError, promises] = catchError2(() => RESOURCE_TYPES.map((type) => pullResources({
2287
1626
  force: options.force,
2288
1627
  solutionId: options.solutionId
@@ -2332,7 +1671,7 @@ Subcommands:
2332
1671
  processContext.exit(1);
2333
1672
  return;
2334
1673
  }
2335
- const { searchResources, searchResourcesWithFilters } = await import("./resourcesSyncService-0nk4yqyw.js");
1674
+ const { searchResources, searchResourcesWithFilters } = await import("./resourcesSyncService-wtjf3bz6.js");
2336
1675
  let searchResult;
2337
1676
  if (options.filter) {
2338
1677
  const [parseError, filters] = catchError2(() => parseFilterString(options.filter));
@@ -2380,7 +1719,7 @@ Subcommands:
2380
1719
  });
2381
1720
  });
2382
1721
  addListWindowOptions(registry.command("list").description("List all resources (use pull to update list)")).option("--local", "List only in-solution sibling project resources (requires a .uipx in the current directory, its parent, or grandparent). Skips the tenant cache.").examples(REGISTRY_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
2383
- const { listLocalResources, listResources } = await import("./resourcesSyncService-0nk4yqyw.js");
1722
+ const { listLocalResources, listResources } = await import("./resourcesSyncService-wtjf3bz6.js");
2384
1723
  let grouped;
2385
1724
  if (options.local) {
2386
1725
  const [localError, localGrouped] = await catchError2(listLocalResources());
@@ -2427,7 +1766,7 @@ Subcommands:
2427
1766
  });
2428
1767
  });
2429
1768
  registry.command("get").description("Get resource(s) by identifier (entityKey or id)").argument("<identifier>", "The entityKey (process-types) or id (action-apps) of the resource").addOption(new Option("-t, --type <type>", `Limit search to a specific resource type (${GET_SEARCHABLE_TYPES.map((t) => t.type).join(", ")})`).choices(GET_SEARCHABLE_TYPES.map((t) => t.type))).option("--connection-id <id>", "Connection ID for connector-specific IS field metadata (custom fields). Only applies to typecache-* activity / trigger results.").option("--local", "Resolve the identifier against in-solution sibling project resources (requires a .uipx in the current directory, its parent, or grandparent). Skips the tenant cache. The identifier is the sibling's resource key or .uipx project Id.").examples(REGISTRY_GET_EXAMPLES).trackedAction(processContext, async (identifier, options) => {
2430
- const { getResources } = await import("./resourcesSyncService-0nk4yqyw.js");
1769
+ const { getResources } = await import("./resourcesSyncService-wtjf3bz6.js");
2431
1770
  const [error, matches] = await catchError2(getResources(identifier, options.type, {
2432
1771
  local: options.local
2433
1772
  }));
@@ -2464,11 +1803,11 @@ Subcommands:
2464
1803
  const id = m.resource.uiPathActivityTypeId;
2465
1804
  if (typeof id !== "string")
2466
1805
  return m;
2467
- const { lookupTypeCacheEntry } = await import("./connector-lookup-service-4h5hja8h.js");
1806
+ const { lookupTypeCacheEntry } = await import("./connector-lookup-service-kegnjatm.js");
2468
1807
  const [lookupError, lookupResult] = await catchError2(lookupTypeCacheEntry(id, m.resourceType));
2469
1808
  if (lookupError)
2470
1809
  return m;
2471
- const { enrichConnectorRegistryEntry } = await import("./connector-enrichment-service-y61hzyd0.js");
1810
+ const { enrichConnectorRegistryEntry } = await import("./connector-enrichment-service-bdsgzrag.js");
2472
1811
  const [enrichError, definitions] = await catchError2(enrichConnectorRegistryEntry(lookupResult.config, options.connectionId));
2473
1812
  if (enrichError || definitions === null)
2474
1813
  return m;
@@ -2494,7 +1833,7 @@ Subcommands:
2494
1833
  });
2495
1834
  });
2496
1835
  registry.command("get-connector").description(`Look up a connector activity/trigger from the local TypeCache index. ${OUTPUT_CASING_HINT}`).addOption(new Option("-t, --type <type>", "Resource type").choices([...TYPECACHE_INDEX_TYPES]).makeOptionMandatory()).requiredOption("--activity-type-id <id>", "The uiPathActivityTypeId to look up").examples(REGISTRY_GET_CONNECTOR_EXAMPLES).trackedAction(processContext, async (options) => {
2497
- const { lookupTypeCacheEntry } = await import("./connector-lookup-service-4h5hja8h.js");
1836
+ const { lookupTypeCacheEntry } = await import("./connector-lookup-service-kegnjatm.js");
2498
1837
  const [error, result] = await catchError2(lookupTypeCacheEntry(options.activityTypeId, options.type));
2499
1838
  if (error) {
2500
1839
  await reportLookupFailure("Error looking up connector", error);
@@ -2510,7 +1849,7 @@ Subcommands:
2510
1849
  }, { preserveDataKeys: VERBATIM_REGISTRY_FIELDS });
2511
1850
  });
2512
1851
  registry.command("get-connection").description(`Look up a connector and fetch available connections from Integration Service. ${OUTPUT_CASING_HINT}`).addOption(new Option("-t, --type <type>", "Resource type").choices([...TYPECACHE_INDEX_TYPES]).makeOptionMandatory()).requiredOption("--activity-type-id <id>", "The uiPathActivityTypeId to look up").examples(REGISTRY_GET_CONNECTION_EXAMPLES).trackedAction(processContext, async (options) => {
2513
- const { fetchConnectorConnections, lookupTypeCacheEntry } = await import("./connector-lookup-service-4h5hja8h.js");
1852
+ const { fetchConnectorConnections, lookupTypeCacheEntry } = await import("./connector-lookup-service-kegnjatm.js");
2514
1853
  const [lookupError, lookupResult] = await catchError2(lookupTypeCacheEntry(options.activityTypeId, options.type));
2515
1854
  if (lookupError) {
2516
1855
  await reportLookupFailure("Error looking up connector", lookupError);
@@ -2564,7 +1903,7 @@ var registerRuleTypesCommand = (program) => {
2564
1903
  const ruleTypes = program.command("rule-types").description("The case condition rule types: which rule each condition slot takes.");
2565
1904
  ruleTypes.command("list").description("List the rule types each case condition slot takes (`Scopes`; an exit slot appears twice, once per `MarksComplete` value, since only a completion condition takes the `required-*` rules), and the rule types the case schema accepts that no slot lists (`Unscoped`). `Validated` says whether `case validate` reports a rule outside the list: stage entry on the default, --strict and --skeleton-v2 profiles, task entry on the default and --strict ones, and no exit slot on any. Reads nothing from the tenant.").examples(RULE_TYPES_LIST_EXAMPLES).trackedAction(processContext, async () => {
2566
1905
  const [error, declaration] = await catchError2((async () => {
2567
- const { ruleTypeDeclaration } = await import("./rule-type-declaration-8d70fcg1.js");
1906
+ const { ruleTypeDeclaration } = await import("./rule-type-declaration-5t95xkbj.js");
2568
1907
  return ruleTypeDeclaration();
2569
1908
  })());
2570
1909
  if (error) {
@@ -2700,7 +2039,7 @@ var registerSddCommand = (program) => {
2700
2039
  reportReadFailure(file, readError);
2701
2040
  return;
2702
2041
  }
2703
- const { parseSddToJson } = await import("./strict-sdd-audit-cybg0wva.js");
2042
+ const { parseSddToJson } = await import("./strict-sdd-audit-egqnhewp.js");
2704
2043
  const [parseError, model] = catchError2(() => parseSddToJson(text));
2705
2044
  if (parseError) {
2706
2045
  reportParseFailure(file, parseError);
@@ -2731,9 +2070,9 @@ var registerSddCommand = (program) => {
2731
2070
  reportReadFailure(file, readError);
2732
2071
  return;
2733
2072
  }
2734
- const { parseSddToJson } = await import("./strict-sdd-audit-cybg0wva.js");
2073
+ const { parseSddToJson } = await import("./strict-sdd-audit-egqnhewp.js");
2735
2074
  const { resolveCacheFiles, resolveSddResources } = await import("./sdd-resolve-service-540fmfhj.js");
2736
- const { loadSiblings } = await import("./sdd-resolve-siblings-egr75wkg.js");
2075
+ const { loadSiblings } = await import("./sdd-resolve-siblings-46kdk7pa.js");
2737
2076
  const [parseError, model] = catchError2(() => parseSddToJson(text));
2738
2077
  if (parseError) {
2739
2078
  reportParseFailure(file, parseError);
@@ -2831,8 +2170,8 @@ var registerSddCommand = (program) => {
2831
2170
  reportReadFailure(file, readError);
2832
2171
  return;
2833
2172
  }
2834
- const { parseSddToJson } = await import("./strict-sdd-audit-cybg0wva.js");
2835
- const { convertSddToCasePlan } = await import("./sdd-convert-service-nv95qnp3.js");
2173
+ const { parseSddToJson } = await import("./strict-sdd-audit-egqnhewp.js");
2174
+ const { convertSddToCasePlan } = await import("./sdd-convert-service-m9spcya6.js");
2836
2175
  let resolved;
2837
2176
  let resolvedEntries = [];
2838
2177
  if (options.resolved !== undefined) {
@@ -3046,22 +2385,6 @@ var registerSddCommand = (program) => {
3046
2385
  };
3047
2386
 
3048
2387
  // src/commands/sla.ts
3049
- var VALID_UNITS = ["min", "h", "d", "w", "m"];
3050
- var SLA_SET_EXAMPLES = [
3051
- {
3052
- Description: "Set root-level SLA to 2 days",
3053
- Command: "uip maestro case sla set case.json --count 2 --unit d",
3054
- Output: {
3055
- Code: "SlaSet",
3056
- Data: {
3057
- File: "case.json",
3058
- Target: "root",
3059
- Count: 2,
3060
- Unit: "d"
3061
- }
3062
- }
3063
- }
3064
- ];
3065
2388
  var SLA_GET_EXAMPLES = [
3066
2389
  {
3067
2390
  Description: "Get the current SLA settings at the case root",
@@ -3075,39 +2398,6 @@ var SLA_GET_EXAMPLES = [
3075
2398
  }
3076
2399
  }
3077
2400
  ];
3078
- var SLA_REMOVE_EXAMPLES = [
3079
- {
3080
- Description: "Remove the SLA settings at the case root",
3081
- Command: "uip maestro case sla remove case.json",
3082
- Output: {
3083
- Code: "SlaRemoved",
3084
- Data: {
3085
- File: "case.json",
3086
- Target: "root"
3087
- }
3088
- }
3089
- }
3090
- ];
3091
- var SLA_ESCALATION_ADD_EXAMPLES = [
3092
- {
3093
- Description: "Add an at-risk escalation notification to a user",
3094
- Command: 'uip maestro case sla escalation add case.json --trigger-type at-risk --at-risk-percentage 80 --recipient-scope User --recipient-target user@example.com --recipient-value "Jane Doe"',
3095
- Output: {
3096
- Code: "EscalationRuleAdded",
3097
- Data: {
3098
- File: "case.json",
3099
- Target: "root",
3100
- EscalationRuleId: "esc_a1b2c3d4",
3101
- TriggerType: "at-risk",
3102
- Recipient: {
3103
- scope: "User",
3104
- target: "user@example.com",
3105
- value: "Jane Doe"
3106
- }
3107
- }
3108
- }
3109
- }
3110
- ];
3111
2401
  var SLA_ESCALATION_LIST_EXAMPLES = [
3112
2402
  {
3113
2403
  Description: "List escalation rules on the root SLA",
@@ -3129,35 +2419,6 @@ var SLA_ESCALATION_LIST_EXAMPLES = [
3129
2419
  }
3130
2420
  }
3131
2421
  ];
3132
- var SLA_ESCALATION_REMOVE_EXAMPLES = [
3133
- {
3134
- Description: "Remove an escalation rule by ID",
3135
- Command: "uip maestro case sla escalation remove case.json esc_a1b2c3d4",
3136
- Output: {
3137
- Code: "EscalationRuleRemoved",
3138
- Data: {
3139
- File: "case.json",
3140
- Target: "root",
3141
- EscalationRuleId: "esc_a1b2c3d4"
3142
- }
3143
- }
3144
- }
3145
- ];
3146
- var SLA_RULES_ADD_EXAMPLES = [
3147
- {
3148
- Description: "Add a conditional SLA rule at the case root level",
3149
- Command: 'uip maestro case sla rules add case.json --expression "=js:amount>1000" --count 4 --unit h',
3150
- Output: {
3151
- Code: "SlaRuleAdded",
3152
- Data: {
3153
- File: "case.json",
3154
- Expression: "=js:amount>1000",
3155
- Count: 4,
3156
- Unit: "h"
3157
- }
3158
- }
3159
- }
3160
- ];
3161
2422
  var SLA_RULES_LIST_EXAMPLES = [
3162
2423
  {
3163
2424
  Description: "List all conditional SLA rules at the case root",
@@ -3177,38 +2438,7 @@ var SLA_RULES_LIST_EXAMPLES = [
3177
2438
  }
3178
2439
  }
3179
2440
  ];
3180
- var SLA_RULES_REMOVE_EXAMPLES = [
3181
- {
3182
- Description: "Remove a conditional SLA rule by index",
3183
- Command: "uip maestro case sla rules remove case.json 0",
3184
- Output: {
3185
- Code: "SlaRuleRemoved",
3186
- Data: {
3187
- File: "case.json",
3188
- Index: 0,
3189
- RemovedRule: {
3190
- expression: "=js:amount>1000",
3191
- count: 4,
3192
- unit: "h"
3193
- }
3194
- }
3195
- }
3196
- }
3197
- ];
3198
2441
  var DEFAULT_SLA_EXPRESSION = "=js:true";
3199
- function validateUnit(unit) {
3200
- if (!VALID_UNITS.includes(unit)) {
3201
- throw new Error(`Invalid SLA unit: "${unit}". Must be one of: ${VALID_UNITS.join(", ")}`);
3202
- }
3203
- return unit;
3204
- }
3205
- function validateCount(count) {
3206
- const n = Number(count);
3207
- if (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {
3208
- throw new Error(`Invalid SLA count: "${count}". Must be a positive integer.`);
3209
- }
3210
- return n;
3211
- }
3212
2442
  function ensureRootData(schema) {
3213
2443
  ensureRootBindings(schema);
3214
2444
  schema.metadata ??= {};
@@ -3224,20 +2454,6 @@ function requireStageForSla(schema, stageId) {
3224
2454
  }
3225
2455
  return node;
3226
2456
  }
3227
- function ensureSlaRules(data) {
3228
- if (!data.slaRules) {
3229
- data.slaRules = [];
3230
- }
3231
- return data.slaRules;
3232
- }
3233
- function getOrCreateDefaultRule(slaRules) {
3234
- const existing = slaRules.find((r) => r.expression === DEFAULT_SLA_EXPRESSION);
3235
- if (existing)
3236
- return existing;
3237
- const defaultRule = { expression: DEFAULT_SLA_EXPRESSION };
3238
- slaRules.push(defaultRule);
3239
- return defaultRule;
3240
- }
3241
2457
  function getTargetData(schema, stageId) {
3242
2458
  if (stageId) {
3243
2459
  return requireStageForSla(schema, stageId).data;
@@ -3246,65 +2462,7 @@ function getTargetData(schema, stageId) {
3246
2462
  }
3247
2463
  var registerSlaCommand = (program) => {
3248
2464
  const sla = program.command("sla").description("Manage SLA settings and escalation rules for case definitions");
3249
- sla.command("set", { hidden: true }).description("Set or update the SLA value on a case (root level) or a specific stage").argument("<file>", "Path to the case management JSON file").option("--stage-id <stageId>", "Stage ID to set the SLA on (omit for root-level SLA)").requiredOption("--count <count>", "SLA duration count (positive integer)").requiredOption("--unit <unit>", "SLA duration unit: min (minutes), h (hours), d (days), w (weeks), m (months)").examples(SLA_SET_EXAMPLES).trackedAction(processContext, async (file, options) => {
3250
- const [parseError, parsed] = catchError2(() => ({
3251
- count: validateCount(options.count),
3252
- unit: validateUnit(options.unit)
3253
- }));
3254
- if (parseError) {
3255
- OutputFormatter.error({
3256
- Result: RESULTS.Failure,
3257
- Message: "Invalid SLA options",
3258
- Instructions: parseError.message
3259
- });
3260
- processContext.exit(1);
3261
- return;
3262
- }
3263
- const [readError, schema] = await catchError2(readSchema(file));
3264
- if (readError) {
3265
- OutputFormatter.error({
3266
- Result: RESULTS.Failure,
3267
- Message: "Error setting SLA",
3268
- Instructions: readError.message
3269
- });
3270
- processContext.exit(1);
3271
- return;
3272
- }
3273
- const [findError, targetData] = catchError2(() => getTargetData(schema, options.stageId));
3274
- if (findError) {
3275
- OutputFormatter.error({
3276
- Result: RESULTS.Failure,
3277
- Message: "Error setting SLA",
3278
- Instructions: findError.message
3279
- });
3280
- processContext.exit(1);
3281
- return;
3282
- }
3283
- const slaRules = ensureSlaRules(targetData);
3284
- const defaultRule = getOrCreateDefaultRule(slaRules);
3285
- defaultRule.count = parsed.count;
3286
- defaultRule.unit = parsed.unit;
3287
- const [writeError] = await catchError2(writeSchema(file, schema));
3288
- if (writeError) {
3289
- OutputFormatter.error({
3290
- Result: RESULTS.Failure,
3291
- Message: "Error setting SLA",
3292
- Instructions: writeError.message
3293
- });
3294
- processContext.exit(1);
3295
- return;
3296
- }
3297
- OutputFormatter.success({
3298
- Result: RESULTS.Success,
3299
- Code: "SlaSet",
3300
- Data: {
3301
- File: file,
3302
- Target: options.stageId ?? "root",
3303
- Count: parsed.count,
3304
- Unit: parsed.unit
3305
- }
3306
- });
3307
- });
2465
+ sla.command("set", { hidden: true });
3308
2466
  sla.command("get").description("Get the current SLA settings for a case (root level) or a specific stage").argument("<file>", "Path to the case management JSON file").option("--stage-id <stageId>", "Stage ID to get the SLA from (omit for root-level SLA)").examples(SLA_GET_EXAMPLES).trackedAction(processContext, async (file, options) => {
3309
2467
  const [readError, schema] = await catchError2(readSchema(file));
3310
2468
  if (readError) {
@@ -3350,12 +2508,15 @@ var registerSlaCommand = (program) => {
3350
2508
  }
3351
2509
  });
3352
2510
  });
3353
- sla.command("remove", { hidden: true }).description("Remove the SLA value from a case (root level) or a specific stage").argument("<file>", "Path to the case management JSON file").option("--stage-id <stageId>", "Stage ID to remove the SLA from (omit for root-level SLA)").examples(SLA_REMOVE_EXAMPLES).trackedAction(processContext, async (file, options) => {
2511
+ sla.command("remove", { hidden: true });
2512
+ const escalation = sla.command("escalation").description("Manage escalation rules on an SLA (case root or stage level)");
2513
+ escalation.command("add", { hidden: true });
2514
+ addListWindowOptions(escalation.command("list").description("List all escalation rules on an SLA").argument("<file>", "Path to the case management JSON file")).option("--stage-id <stageId>", "Stage ID to list escalations from (omit for root-level SLA)").examples(SLA_ESCALATION_LIST_EXAMPLES).trackedAction(processContext, async (file, options) => {
3354
2515
  const [readError, schema] = await catchError2(readSchema(file));
3355
2516
  if (readError) {
3356
2517
  OutputFormatter.error({
3357
2518
  Result: RESULTS.Failure,
3358
- Message: "Error removing SLA",
2519
+ Message: "Error listing escalation rules",
3359
2520
  Instructions: readError.message
3360
2521
  });
3361
2522
  processContext.exit(1);
@@ -3365,288 +2526,32 @@ var registerSlaCommand = (program) => {
3365
2526
  if (findError) {
3366
2527
  OutputFormatter.error({
3367
2528
  Result: RESULTS.Failure,
3368
- Message: "Error removing SLA",
2529
+ Message: "Error listing escalation rules",
3369
2530
  Instructions: findError.message
3370
2531
  });
3371
2532
  processContext.exit(1);
3372
2533
  return;
3373
2534
  }
3374
- targetData.slaRules = undefined;
3375
- const [writeError] = await catchError2(writeSchema(file, schema));
3376
- if (writeError) {
3377
- OutputFormatter.error({
3378
- Result: RESULTS.Failure,
3379
- Message: "Error removing SLA",
3380
- Instructions: writeError.message
3381
- });
3382
- processContext.exit(1);
3383
- return;
3384
- }
2535
+ const defaultRule = targetData.slaRules?.find((r) => r.expression === DEFAULT_SLA_EXPRESSION);
3385
2536
  OutputFormatter.success({
3386
2537
  Result: RESULTS.Success,
3387
- Code: "SlaRemoved",
2538
+ Code: "EscalationRulesList",
3388
2539
  Data: {
3389
- File: file,
3390
- Target: options.stageId ?? "root"
2540
+ Target: options.stageId ?? "root",
2541
+ EscalationRules: listWindow(defaultRule?.escalationRule ?? [], options)
3391
2542
  }
3392
2543
  });
3393
2544
  });
3394
- const escalation = sla.command("escalation").description("Manage escalation rules on an SLA (case root or stage level)");
3395
- escalation.command("add", { hidden: true }).description("Add an escalation rule to an SLA").argument("<file>", "Path to the case management JSON file").option("--stage-id <stageId>", "Stage ID to add escalation to (omit for root-level SLA)").option("--display-name <displayName>", "Display name for the escalation rule").requiredOption("--trigger-type <triggerType>", "Escalation trigger type: at-risk or sla-breached").option("--at-risk-percentage <percentage>", "At-risk percentage threshold (required when trigger-type is at-risk)").requiredOption("--recipient-scope <scope>", "Recipient scope: User or UserGroup").requiredOption("--recipient-target <target>", "Recipient target identifier").requiredOption("--recipient-value <value>", "Recipient display value").examples(SLA_ESCALATION_ADD_EXAMPLES).trackedAction(processContext, async (file, options) => {
3396
- if (options.triggerType !== "at-risk" && options.triggerType !== "sla-breached") {
2545
+ escalation.command("remove", { hidden: true });
2546
+ const slaRules = sla.command("rules").description("Manage conditional SLA rules (expression-based) at the case root level");
2547
+ slaRules.command("add", { hidden: true });
2548
+ addListWindowOptions(slaRules.command("list").description("List all conditional SLA rules at the case root level").argument("<file>", "Path to the case management JSON file")).examples(SLA_RULES_LIST_EXAMPLES).trackedAction(processContext, async (file, options) => {
2549
+ const [readError, schema] = await catchError2(readSchema(file));
2550
+ if (readError) {
3397
2551
  OutputFormatter.error({
3398
2552
  Result: RESULTS.Failure,
3399
- Message: "Invalid escalation options",
3400
- Instructions: 'Trigger type must be "at-risk" or "sla-breached".'
3401
- });
3402
- processContext.exit(1);
3403
- return;
3404
- }
3405
- if (options.recipientScope !== "User" && options.recipientScope !== "UserGroup") {
3406
- OutputFormatter.error({
3407
- Result: RESULTS.Failure,
3408
- Message: "Invalid escalation options",
3409
- Instructions: 'Recipient scope must be "User" or "UserGroup".'
3410
- });
3411
- processContext.exit(1);
3412
- return;
3413
- }
3414
- if (options.triggerType === "at-risk" && options.atRiskPercentage === undefined) {
3415
- OutputFormatter.error({
3416
- Result: RESULTS.Failure,
3417
- Message: "Invalid escalation options",
3418
- Instructions: "--at-risk-percentage is required when trigger-type is at-risk."
3419
- });
3420
- processContext.exit(1);
3421
- return;
3422
- }
3423
- const [readError, schema] = await catchError2(readSchema(file));
3424
- if (readError) {
3425
- OutputFormatter.error({
3426
- Result: RESULTS.Failure,
3427
- Message: "Error adding escalation rule",
3428
- Instructions: readError.message
3429
- });
3430
- processContext.exit(1);
3431
- return;
3432
- }
3433
- const recipient = {
3434
- scope: options.recipientScope,
3435
- target: options.recipientTarget,
3436
- value: options.recipientValue
3437
- };
3438
- const escalationRule = {
3439
- id: prefixedId("esc_"),
3440
- displayName: options.displayName,
3441
- action: {
3442
- type: "notification",
3443
- recipients: [recipient]
3444
- },
3445
- triggerInfo: {
3446
- type: options.triggerType,
3447
- ...options.triggerType === "at-risk" && options.atRiskPercentage !== undefined ? {
3448
- atRiskPercentage: Number(options.atRiskPercentage)
3449
- } : {}
3450
- }
3451
- };
3452
- const [findError, targetData] = catchError2(() => getTargetData(schema, options.stageId));
3453
- if (findError) {
3454
- OutputFormatter.error({
3455
- Result: RESULTS.Failure,
3456
- Message: "Error adding escalation rule",
3457
- Instructions: findError.message
3458
- });
3459
- processContext.exit(1);
3460
- return;
3461
- }
3462
- const slaRules = ensureSlaRules(targetData);
3463
- const defaultRule = getOrCreateDefaultRule(slaRules);
3464
- if (!defaultRule.escalationRule) {
3465
- defaultRule.escalationRule = [];
3466
- }
3467
- defaultRule.escalationRule.push(escalationRule);
3468
- const [writeError] = await catchError2(writeSchema(file, schema));
3469
- if (writeError) {
3470
- OutputFormatter.error({
3471
- Result: RESULTS.Failure,
3472
- Message: "Error adding escalation rule",
3473
- Instructions: writeError.message
3474
- });
3475
- processContext.exit(1);
3476
- return;
3477
- }
3478
- OutputFormatter.success({
3479
- Result: RESULTS.Success,
3480
- Code: "EscalationRuleAdded",
3481
- Data: {
3482
- File: file,
3483
- Target: options.stageId ?? "root",
3484
- EscalationRuleId: escalationRule.id,
3485
- TriggerType: escalationRule.triggerInfo?.type,
3486
- Recipient: recipient
3487
- }
3488
- });
3489
- });
3490
- addListWindowOptions(escalation.command("list").description("List all escalation rules on an SLA").argument("<file>", "Path to the case management JSON file")).option("--stage-id <stageId>", "Stage ID to list escalations from (omit for root-level SLA)").examples(SLA_ESCALATION_LIST_EXAMPLES).trackedAction(processContext, async (file, options) => {
3491
- const [readError, schema] = await catchError2(readSchema(file));
3492
- if (readError) {
3493
- OutputFormatter.error({
3494
- Result: RESULTS.Failure,
3495
- Message: "Error listing escalation rules",
3496
- Instructions: readError.message
3497
- });
3498
- processContext.exit(1);
3499
- return;
3500
- }
3501
- const [findError, targetData] = catchError2(() => getTargetData(schema, options.stageId));
3502
- if (findError) {
3503
- OutputFormatter.error({
3504
- Result: RESULTS.Failure,
3505
- Message: "Error listing escalation rules",
3506
- Instructions: findError.message
3507
- });
3508
- processContext.exit(1);
3509
- return;
3510
- }
3511
- const defaultRule = targetData.slaRules?.find((r) => r.expression === DEFAULT_SLA_EXPRESSION);
3512
- OutputFormatter.success({
3513
- Result: RESULTS.Success,
3514
- Code: "EscalationRulesList",
3515
- Data: {
3516
- Target: options.stageId ?? "root",
3517
- EscalationRules: listWindow(defaultRule?.escalationRule ?? [], options)
3518
- }
3519
- });
3520
- });
3521
- escalation.command("remove", { hidden: true }).description("Remove an escalation rule from an SLA by its ID").argument("<file>", "Path to the case management JSON file").argument("<escalation-id>", "ID of the escalation rule to remove").option("--stage-id <stageId>", "Stage ID to remove escalation from (omit for root-level SLA)").examples(SLA_ESCALATION_REMOVE_EXAMPLES).trackedAction(processContext, async (file, escalationId, options) => {
3522
- const [readError, schema] = await catchError2(readSchema(file));
3523
- if (readError) {
3524
- OutputFormatter.error({
3525
- Result: RESULTS.Failure,
3526
- Message: "Error removing escalation rule",
3527
- Instructions: readError.message
3528
- });
3529
- processContext.exit(1);
3530
- return;
3531
- }
3532
- const [findError, targetData] = catchError2(() => getTargetData(schema, options.stageId));
3533
- if (findError) {
3534
- OutputFormatter.error({
3535
- Result: RESULTS.Failure,
3536
- Message: "Error removing escalation rule",
3537
- Instructions: findError.message
3538
- });
3539
- processContext.exit(1);
3540
- return;
3541
- }
3542
- const defaultRule = targetData.slaRules?.find((r) => r.expression === DEFAULT_SLA_EXPRESSION);
3543
- const escalationRules = defaultRule?.escalationRule;
3544
- if (!escalationRules || escalationRules.length === 0) {
3545
- OutputFormatter.error({
3546
- Result: RESULTS.Failure,
3547
- Message: "Error removing escalation rule",
3548
- Instructions: "No escalation rules found on the target SLA."
3549
- });
3550
- processContext.exit(1);
3551
- return;
3552
- }
3553
- const ruleIndex = escalationRules.findIndex((r) => r.id === escalationId);
3554
- if (ruleIndex === -1) {
3555
- OutputFormatter.error({
3556
- Result: RESULTS.Failure,
3557
- Message: "Error removing escalation rule",
3558
- Instructions: `Escalation rule not found with id: ${escalationId}`
3559
- });
3560
- processContext.exit(1);
3561
- return;
3562
- }
3563
- escalationRules.splice(ruleIndex, 1);
3564
- const [writeError] = await catchError2(writeSchema(file, schema));
3565
- if (writeError) {
3566
- OutputFormatter.error({
3567
- Result: RESULTS.Failure,
3568
- Message: "Error removing escalation rule",
3569
- Instructions: writeError.message
3570
- });
3571
- processContext.exit(1);
3572
- return;
3573
- }
3574
- OutputFormatter.success({
3575
- Result: RESULTS.Success,
3576
- Code: "EscalationRuleRemoved",
3577
- Data: {
3578
- File: file,
3579
- Target: options.stageId ?? "root",
3580
- EscalationRuleId: escalationId
3581
- }
3582
- });
3583
- });
3584
- const slaRules = sla.command("rules").description("Manage conditional SLA rules (expression-based) at the case root level");
3585
- slaRules.command("add", { hidden: true }).description("Add a conditional SLA rule to the case root").argument("<file>", "Path to the case management JSON file").requiredOption("--expression <expression>", "Condition expression for the SLA rule").requiredOption("--count <count>", "SLA duration count (positive integer)").requiredOption("--unit <unit>", "SLA duration unit: min (minutes), h (hours), d (days), w (weeks), m (months)").examples(SLA_RULES_ADD_EXAMPLES).trackedAction(processContext, async (file, options) => {
3586
- const [parseError, parsed] = catchError2(() => ({
3587
- count: validateCount(options.count),
3588
- unit: validateUnit(options.unit)
3589
- }));
3590
- if (parseError) {
3591
- OutputFormatter.error({
3592
- Result: RESULTS.Failure,
3593
- Message: "Invalid SLA rule options",
3594
- Instructions: parseError.message
3595
- });
3596
- processContext.exit(1);
3597
- return;
3598
- }
3599
- const [readError, schema] = await catchError2(readSchema(file));
3600
- if (readError) {
3601
- OutputFormatter.error({
3602
- Result: RESULTS.Failure,
3603
- Message: "Error adding SLA rule",
3604
- Instructions: readError.message
3605
- });
3606
- processContext.exit(1);
3607
- return;
3608
- }
3609
- const data = ensureRootData(schema);
3610
- const slaRules = ensureSlaRules(data);
3611
- const rule = {
3612
- expression: options.expression,
3613
- count: parsed.count,
3614
- unit: parsed.unit
3615
- };
3616
- const defaultIdx = slaRules.findIndex((r) => r.expression === DEFAULT_SLA_EXPRESSION);
3617
- if (defaultIdx >= 0) {
3618
- slaRules.splice(defaultIdx, 0, rule);
3619
- } else {
3620
- slaRules.unshift(rule);
3621
- }
3622
- const [writeError] = await catchError2(writeSchema(file, schema));
3623
- if (writeError) {
3624
- OutputFormatter.error({
3625
- Result: RESULTS.Failure,
3626
- Message: "Error adding SLA rule",
3627
- Instructions: writeError.message
3628
- });
3629
- processContext.exit(1);
3630
- return;
3631
- }
3632
- OutputFormatter.success({
3633
- Result: RESULTS.Success,
3634
- Code: "SlaRuleAdded",
3635
- Data: {
3636
- File: file,
3637
- Expression: rule.expression,
3638
- Count: rule.count,
3639
- Unit: rule.unit
3640
- }
3641
- });
3642
- });
3643
- addListWindowOptions(slaRules.command("list").description("List all conditional SLA rules at the case root level").argument("<file>", "Path to the case management JSON file")).examples(SLA_RULES_LIST_EXAMPLES).trackedAction(processContext, async (file, options) => {
3644
- const [readError, schema] = await catchError2(readSchema(file));
3645
- if (readError) {
3646
- OutputFormatter.error({
3647
- Result: RESULTS.Failure,
3648
- Message: "Error listing SLA rules",
3649
- Instructions: readError.message
2553
+ Message: "Error listing SLA rules",
2554
+ Instructions: readError.message
3650
2555
  });
3651
2556
  processContext.exit(1);
3652
2557
  return;
@@ -3659,68 +2564,7 @@ var registerSlaCommand = (program) => {
3659
2564
  }
3660
2565
  });
3661
2566
  });
3662
- slaRules.command("remove", { hidden: true }).description("Remove a conditional SLA rule from the case root by its index (0-based)").argument("<file>", "Path to the case management JSON file").argument("<index>", "Index of the SLA rule to remove (0-based)").examples(SLA_RULES_REMOVE_EXAMPLES).trackedAction(processContext, async (file, indexStr) => {
3663
- const index = Number(indexStr);
3664
- if (!Number.isFinite(index) || index < 0 || !Number.isInteger(index)) {
3665
- OutputFormatter.error({
3666
- Result: RESULTS.Failure,
3667
- Message: "Invalid index",
3668
- Instructions: "Index must be a non-negative integer."
3669
- });
3670
- processContext.exit(1);
3671
- return;
3672
- }
3673
- const [readError, schema] = await catchError2(readSchema(file));
3674
- if (readError) {
3675
- OutputFormatter.error({
3676
- Result: RESULTS.Failure,
3677
- Message: "Error removing SLA rule",
3678
- Instructions: readError.message
3679
- });
3680
- processContext.exit(1);
3681
- return;
3682
- }
3683
- const data = ensureRootData(schema);
3684
- const rules = data.slaRules;
3685
- if (!rules || rules.length === 0) {
3686
- OutputFormatter.error({
3687
- Result: RESULTS.Failure,
3688
- Message: "Error removing SLA rule",
3689
- Instructions: "No SLA rules found at the case root level."
3690
- });
3691
- processContext.exit(1);
3692
- return;
3693
- }
3694
- if (index >= rules.length) {
3695
- OutputFormatter.error({
3696
- Result: RESULTS.Failure,
3697
- Message: "Error removing SLA rule",
3698
- Instructions: `Index ${index} is out of range. There are ${rules.length} SLA rules (indices 0-${rules.length - 1}).`
3699
- });
3700
- processContext.exit(1);
3701
- return;
3702
- }
3703
- const removed = rules.splice(index, 1)[0];
3704
- const [writeError] = await catchError2(writeSchema(file, schema));
3705
- if (writeError) {
3706
- OutputFormatter.error({
3707
- Result: RESULTS.Failure,
3708
- Message: "Error removing SLA rule",
3709
- Instructions: writeError.message
3710
- });
3711
- processContext.exit(1);
3712
- return;
3713
- }
3714
- OutputFormatter.success({
3715
- Result: RESULTS.Success,
3716
- Code: "SlaRuleRemoved",
3717
- Data: {
3718
- File: file,
3719
- Index: index,
3720
- RemovedRule: removed
3721
- }
3722
- });
3723
- });
2567
+ slaRules.command("remove", { hidden: true });
3724
2568
  };
3725
2569
 
3726
2570
  // src/commands/spec.ts
@@ -3820,8 +2664,8 @@ var registerSpecCommand = (program) => {
3820
2664
  },
3821
2665
  { caseTypeCacheSource }
3822
2666
  ] = await Promise.all([
3823
- import("./index-3cwyemy2.js"),
3824
- import("./connector-lookup-service-4h5hja8h.js")
2667
+ import("./index-evkttmew.js"),
2668
+ import("./connector-lookup-service-kegnjatm.js")
3825
2669
  ]);
3826
2670
  const fetchOpts = {
3827
2671
  typeCache: caseTypeCacheSource,
@@ -4008,7 +2852,7 @@ var registerSpliceCommand = (program) => {
4008
2852
  processContext.exit(1);
4009
2853
  return;
4010
2854
  }
4011
- const { spliceConnectorShape, isSpliceFailure } = await import("./case-splice-service-hwjbt81f.js");
2855
+ const { spliceConnectorShape, isSpliceFailure } = await import("./case-splice-service-j9e214e7.js");
4012
2856
  const result = spliceConnectorShape(plan, caseShape, {
4013
2857
  taskId,
4014
2858
  connectionId: options.connectionId,
@@ -4027,7 +2871,7 @@ var registerSpliceCommand = (program) => {
4027
2871
  processContext.exit(1);
4028
2872
  return;
4029
2873
  }
4030
- const { designerShapeConnectorTasks } = await import("./connector-task-shape-qamydqnd.js");
2874
+ const { designerShapeConnectorTasks } = await import("./connector-task-shape-g6tyc4z5.js");
4031
2875
  designerShapeConnectorTasks(result.document, (task) => task.id === taskId);
4032
2876
  const target = options.out ?? file;
4033
2877
  await fs.writeFile(target, `${JSON.stringify(result.document, null, 4)}
@@ -4067,52 +2911,6 @@ var outputSpliced = (target, summary) => {
4067
2911
  };
4068
2912
 
4069
2913
  // src/commands/stage-entry-conditions.ts
4070
- var STAGE_ENTRY_CONDITIONS_ADD_EXAMPLES = [
4071
- {
4072
- Description: "Add an entry condition to a stage with an initial rule",
4073
- Command: 'uip maestro case stage-entry-conditions add case.json Stage_1 --display-name "Start" --rule-type case-entered',
4074
- Output: {
4075
- Code: "StageEntryConditionAdded",
4076
- Data: {
4077
- File: "case.json",
4078
- StageId: "Stage_1",
4079
- ConditionId: "Condition_a1b2c3d4",
4080
- DisplayName: "Start",
4081
- Rules: [
4082
- [
4083
- {
4084
- id: "Rule_e5f6a7b8",
4085
- rule: "case-entered"
4086
- }
4087
- ]
4088
- ]
4089
- }
4090
- }
4091
- }
4092
- ];
4093
- var STAGE_ENTRY_CONDITIONS_EDIT_EXAMPLES = [
4094
- {
4095
- Description: "Rename a stage entry condition",
4096
- Command: 'uip maestro case stage-entry-conditions update case.json Stage_1 Condition_a1b2c3d4 --display-name "Updated"',
4097
- Output: {
4098
- Code: "StageEntryConditionUpdated",
4099
- Data: {
4100
- File: "case.json",
4101
- StageId: "Stage_1",
4102
- ConditionId: "Condition_a1b2c3d4",
4103
- DisplayName: "Updated",
4104
- Rules: [
4105
- [
4106
- {
4107
- id: "Rule_e5f6a7b8",
4108
- rule: "case-entered"
4109
- }
4110
- ]
4111
- ]
4112
- }
4113
- }
4114
- }
4115
- ];
4116
2914
  var STAGE_ENTRY_CONDITIONS_GET_EXAMPLES = [
4117
2915
  {
4118
2916
  Description: "Print a stage entry condition by ID",
@@ -4136,20 +2934,6 @@ var STAGE_ENTRY_CONDITIONS_GET_EXAMPLES = [
4136
2934
  }
4137
2935
  }
4138
2936
  ];
4139
- var STAGE_ENTRY_CONDITIONS_REMOVE_EXAMPLES = [
4140
- {
4141
- Description: "Remove a stage entry condition by ID",
4142
- Command: "uip maestro case stage-entry-conditions remove case.json Stage_1 Condition_a1b2c3d4",
4143
- Output: {
4144
- Code: "StageEntryConditionRemoved",
4145
- Data: {
4146
- File: "case.json",
4147
- StageId: "Stage_1",
4148
- ConditionId: "Condition_a1b2c3d4"
4149
- }
4150
- }
4151
- }
4152
- ];
4153
2937
  function requireEntryCondition(node, conditionId) {
4154
2938
  const condition = (node.data.entryConditions ?? []).find((c) => c.id === conditionId);
4155
2939
  if (!condition) {
@@ -4159,186 +2943,14 @@ function requireEntryCondition(node, conditionId) {
4159
2943
  }
4160
2944
  var registerStageEntryConditionsCommand = (program) => {
4161
2945
  const entryConditions = program.command("stage-entry-conditions").description("Manage entry conditions on a stage within a case management definition JSON file");
4162
- entryConditions.command("add", { hidden: true }).description("Add an entry condition to a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").option("-d, --display-name <name>", "Display name for the condition").option("--is-interrupting <bool>", "Whether the condition is interrupting (true or false)").option("--rule-type <type>", `Initial rule type: ${VALID_STAGE_ENTRY_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the initial rule").option("--selected-stage-id <id>", "Stage ID for selected-stage-* initial rules").examples(STAGE_ENTRY_CONDITIONS_ADD_EXAMPLES).trackedAction(processContext, async (file, stageId, options) => {
4163
- if (options.ruleType !== undefined && !VALID_STAGE_ENTRY_RULE_TYPES.includes(options.ruleType)) {
4164
- OutputFormatter.error({
4165
- Result: RESULTS.Failure,
4166
- Message: "Error adding entry condition",
4167
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_STAGE_ENTRY_RULE_TYPES.join(", ")}`
4168
- });
4169
- processContext.exit(1);
4170
- return;
4171
- }
2946
+ entryConditions.command("add", { hidden: true });
2947
+ entryConditions.command("update", { hidden: true });
2948
+ entryConditions.command("get").description("Print an entry condition from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the entry condition to retrieve").examples(STAGE_ENTRY_CONDITIONS_GET_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId) => {
4172
2949
  const [readError, schema] = await catchError2(readSchema(file));
4173
2950
  if (readError) {
4174
2951
  OutputFormatter.error({
4175
2952
  Result: RESULTS.Failure,
4176
- Message: "Error adding entry condition",
4177
- Instructions: readError.message
4178
- });
4179
- processContext.exit(1);
4180
- return;
4181
- }
4182
- const [findError, node] = catchError2(() => requireStageNode(schema, stageId));
4183
- if (findError) {
4184
- OutputFormatter.error({
4185
- Result: RESULTS.Failure,
4186
- Message: "Error adding entry condition",
4187
- Instructions: findError.message
4188
- });
4189
- processContext.exit(1);
4190
- return;
4191
- }
4192
- const id = prefixedId("Condition_");
4193
- const condition = {
4194
- id,
4195
- displayName: options.displayName,
4196
- rules: []
4197
- };
4198
- if (options.isInterrupting !== undefined) {
4199
- condition.isInterrupting = options.isInterrupting === "true";
4200
- }
4201
- if (options.ruleType !== undefined) {
4202
- const rule = buildRule({
4203
- id: prefixedId("Rule_"),
4204
- ruleType: options.ruleType,
4205
- conditionExpression: options.conditionExpression,
4206
- selectedStageId: options.selectedStageId
4207
- });
4208
- condition.rules = [[rule]];
4209
- }
4210
- if (!node.data.entryConditions) {
4211
- node.data.entryConditions = [];
4212
- }
4213
- node.data.entryConditions.push(condition);
4214
- const [writeError] = await catchError2(writeSchema(file, schema));
4215
- if (writeError) {
4216
- OutputFormatter.error({
4217
- Result: RESULTS.Failure,
4218
- Message: "Error adding entry condition",
4219
- Instructions: writeError.message
4220
- });
4221
- processContext.exit(1);
4222
- return;
4223
- }
4224
- OutputFormatter.success({
4225
- Result: RESULTS.Success,
4226
- Code: "StageEntryConditionAdded",
4227
- Data: {
4228
- File: file,
4229
- StageId: stageId,
4230
- ConditionId: id,
4231
- DisplayName: options.displayName,
4232
- IsInterrupting: condition.isInterrupting,
4233
- Rules: condition.rules
4234
- }
4235
- });
4236
- });
4237
- entryConditions.command("update", { hidden: true }).description("Update an entry condition on a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the entry condition to update").option("-d, --display-name <name>", "New display name for the condition").option("--is-interrupting <bool>", "Set interrupting (true or false)").option("--rule-type <type>", `Append a new rule with this type: ${VALID_STAGE_ENTRY_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the new rule").option("--selected-stage-id <id>", "Stage ID for selected-stage-* rules").examples(STAGE_ENTRY_CONDITIONS_EDIT_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId, options) => {
4238
- if (Object.values(options).every((v) => v === undefined)) {
4239
- OutputFormatter.error({
4240
- Result: RESULTS.Failure,
4241
- Message: "Error editing entry condition",
4242
- Instructions: "No fields to update. Provide at least one of: --display-name, --is-interrupting, --rule-type"
4243
- });
4244
- processContext.exit(1);
4245
- return;
4246
- }
4247
- if (options.ruleType !== undefined && !VALID_STAGE_ENTRY_RULE_TYPES.includes(options.ruleType)) {
4248
- OutputFormatter.error({
4249
- Result: RESULTS.Failure,
4250
- Message: "Error editing entry condition",
4251
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_STAGE_ENTRY_RULE_TYPES.join(", ")}`
4252
- });
4253
- processContext.exit(1);
4254
- return;
4255
- }
4256
- const [readError, schema] = await catchError2(readSchema(file));
4257
- if (readError) {
4258
- OutputFormatter.error({
4259
- Result: RESULTS.Failure,
4260
- Message: "Error editing entry condition",
4261
- Instructions: readError.message
4262
- });
4263
- processContext.exit(1);
4264
- return;
4265
- }
4266
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
4267
- if (findStageError) {
4268
- OutputFormatter.error({
4269
- Result: RESULTS.Failure,
4270
- Message: "Error editing entry condition",
4271
- Instructions: findStageError.message
4272
- });
4273
- processContext.exit(1);
4274
- return;
4275
- }
4276
- const [findConditionError, condition] = catchError2(() => requireEntryCondition(node, conditionId));
4277
- if (findConditionError) {
4278
- OutputFormatter.error({
4279
- Result: RESULTS.Failure,
4280
- Message: "Error editing entry condition",
4281
- Instructions: findConditionError.message
4282
- });
4283
- processContext.exit(1);
4284
- return;
4285
- }
4286
- if (options.displayName !== undefined) {
4287
- condition.displayName = options.displayName;
4288
- }
4289
- if (options.isInterrupting !== undefined) {
4290
- condition.isInterrupting = options.isInterrupting === "true";
4291
- }
4292
- if ((options.conditionExpression !== undefined || options.selectedStageId !== undefined) && options.ruleType === undefined) {
4293
- OutputFormatter.error({
4294
- Result: RESULTS.Failure,
4295
- Message: "Error editing entry condition",
4296
- Instructions: "--condition-expression and --selected-stage-id require --rule-type"
4297
- });
4298
- processContext.exit(1);
4299
- return;
4300
- }
4301
- if (options.ruleType !== undefined) {
4302
- const rule = buildRule({
4303
- id: prefixedId("Rule_"),
4304
- ruleType: options.ruleType,
4305
- conditionExpression: options.conditionExpression,
4306
- selectedStageId: options.selectedStageId
4307
- });
4308
- if (!condition.rules) {
4309
- condition.rules = [];
4310
- }
4311
- condition.rules.push([rule]);
4312
- }
4313
- const [writeError] = await catchError2(writeSchema(file, schema));
4314
- if (writeError) {
4315
- OutputFormatter.error({
4316
- Result: RESULTS.Failure,
4317
- Message: "Error editing entry condition",
4318
- Instructions: writeError.message
4319
- });
4320
- processContext.exit(1);
4321
- return;
4322
- }
4323
- OutputFormatter.success({
4324
- Result: RESULTS.Success,
4325
- Code: "StageEntryConditionUpdated",
4326
- Data: {
4327
- File: file,
4328
- StageId: stageId,
4329
- ConditionId: conditionId,
4330
- DisplayName: condition.displayName,
4331
- IsInterrupting: condition.isInterrupting,
4332
- Rules: condition.rules
4333
- }
4334
- });
4335
- });
4336
- entryConditions.command("get").description("Print an entry condition from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the entry condition to retrieve").examples(STAGE_ENTRY_CONDITIONS_GET_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId) => {
4337
- const [readError, schema] = await catchError2(readSchema(file));
4338
- if (readError) {
4339
- OutputFormatter.error({
4340
- Result: RESULTS.Failure,
4341
- Message: "Error getting entry condition",
2953
+ Message: "Error getting entry condition",
4342
2954
  Instructions: readError.message
4343
2955
  });
4344
2956
  processContext.exit(1);
@@ -4370,109 +2982,10 @@ var registerStageEntryConditionsCommand = (program) => {
4370
2982
  Data: { Condition: condition }
4371
2983
  });
4372
2984
  });
4373
- entryConditions.command("remove", { hidden: true }).description("Remove an entry condition from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the entry condition to remove").examples(STAGE_ENTRY_CONDITIONS_REMOVE_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId) => {
4374
- const [readError, schema] = await catchError2(readSchema(file));
4375
- if (readError) {
4376
- OutputFormatter.error({
4377
- Result: RESULTS.Failure,
4378
- Message: "Error removing entry condition",
4379
- Instructions: readError.message
4380
- });
4381
- processContext.exit(1);
4382
- return;
4383
- }
4384
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
4385
- if (findStageError) {
4386
- OutputFormatter.error({
4387
- Result: RESULTS.Failure,
4388
- Message: "Error removing entry condition",
4389
- Instructions: findStageError.message
4390
- });
4391
- processContext.exit(1);
4392
- return;
4393
- }
4394
- const [findConditionError] = catchError2(() => requireEntryCondition(node, conditionId));
4395
- if (findConditionError) {
4396
- OutputFormatter.error({
4397
- Result: RESULTS.Failure,
4398
- Message: "Error removing entry condition",
4399
- Instructions: findConditionError.message
4400
- });
4401
- processContext.exit(1);
4402
- return;
4403
- }
4404
- node.data.entryConditions = (node.data.entryConditions ?? []).filter((c) => c.id !== conditionId);
4405
- const [writeError] = await catchError2(writeSchema(file, schema));
4406
- if (writeError) {
4407
- OutputFormatter.error({
4408
- Result: RESULTS.Failure,
4409
- Message: "Error removing entry condition",
4410
- Instructions: writeError.message
4411
- });
4412
- processContext.exit(1);
4413
- return;
4414
- }
4415
- OutputFormatter.success({
4416
- Result: RESULTS.Success,
4417
- Code: "StageEntryConditionRemoved",
4418
- Data: {
4419
- File: file,
4420
- StageId: stageId,
4421
- ConditionId: conditionId
4422
- }
4423
- });
4424
- });
2985
+ entryConditions.command("remove", { hidden: true });
4425
2986
  };
4426
2987
 
4427
2988
  // src/commands/stage-exit-conditions.ts
4428
- var STAGE_EXIT_CONDITIONS_ADD_EXAMPLES = [
4429
- {
4430
- Description: "Add an exit condition that marks the stage complete",
4431
- Command: 'uip maestro case stage-exit-conditions add case.json Stage_1 --display-name "Done" --marks-stage-complete true --rule-type required-tasks-completed',
4432
- Output: {
4433
- Code: "ExitConditionAdded",
4434
- Data: {
4435
- File: "case.json",
4436
- StageId: "Stage_1",
4437
- ConditionId: "Condition_a1b2c3d4",
4438
- DisplayName: "Done",
4439
- MarksStageComplete: true,
4440
- Rules: [
4441
- [
4442
- {
4443
- id: "Rule_e5f6a7b8",
4444
- rule: "required-tasks-completed"
4445
- }
4446
- ]
4447
- ]
4448
- }
4449
- }
4450
- }
4451
- ];
4452
- var STAGE_EXIT_CONDITIONS_EDIT_EXAMPLES = [
4453
- {
4454
- Description: "Rename a stage exit condition",
4455
- Command: 'uip maestro case stage-exit-conditions update case.json Stage_1 Condition_a1b2c3d4 --display-name "Completed"',
4456
- Output: {
4457
- Code: "ExitConditionUpdated",
4458
- Data: {
4459
- File: "case.json",
4460
- StageId: "Stage_1",
4461
- ConditionId: "Condition_a1b2c3d4",
4462
- DisplayName: "Completed",
4463
- MarksStageComplete: true,
4464
- Rules: [
4465
- [
4466
- {
4467
- id: "Rule_e5f6a7b8",
4468
- rule: "required-tasks-completed"
4469
- }
4470
- ]
4471
- ]
4472
- }
4473
- }
4474
- }
4475
- ];
4476
2989
  var STAGE_EXIT_CONDITIONS_GET_EXAMPLES = [
4477
2990
  {
4478
2991
  Description: "Print a stage exit condition by ID",
@@ -4497,25 +3010,6 @@ var STAGE_EXIT_CONDITIONS_GET_EXAMPLES = [
4497
3010
  }
4498
3011
  }
4499
3012
  ];
4500
- var STAGE_EXIT_CONDITIONS_REMOVE_EXAMPLES = [
4501
- {
4502
- Description: "Remove a stage exit condition by ID",
4503
- Command: "uip maestro case stage-exit-conditions remove case.json Stage_1 Condition_a1b2c3d4",
4504
- Output: {
4505
- Code: "ExitConditionRemoved",
4506
- Data: {
4507
- File: "case.json",
4508
- StageId: "Stage_1",
4509
- ConditionId: "Condition_a1b2c3d4"
4510
- }
4511
- }
4512
- }
4513
- ];
4514
- var VALID_EXIT_CONDITION_TYPES = [
4515
- "exit-only",
4516
- "wait-for-user",
4517
- "return-to-origin"
4518
- ];
4519
3013
  function requireExitCondition(node, conditionId) {
4520
3014
  const condition = (node.data.exitConditions ?? []).find((c) => c.id === conditionId);
4521
3015
  if (!condition) {
@@ -4525,590 +3019,97 @@ function requireExitCondition(node, conditionId) {
4525
3019
  }
4526
3020
  var registerStageExitConditionsCommand = (program) => {
4527
3021
  const exitConditions = program.command("stage-exit-conditions").description("Manage exit conditions on a stage within a case management definition JSON file");
4528
- exitConditions.command("add", { hidden: true }).description("Add an exit condition to a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").option("-d, --display-name <name>", "Display name for the condition").option("-t, --type <type>", "Exit type: exit-only, wait-for-user, or return-to-origin").option("--exit-to-stage-id <id>", "ID of the stage to transition to on exit").option("--marks-stage-complete <bool>", "Whether this condition marks the stage complete (true or false)").option("--rule-type <type>", `Initial rule type: For completion: ${VALID_STAGE_COMPLETION_RULE_TYPES.join(", ")}, For exit: ${VALID_STAGE_EXIT_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the initial rule").option("--selected-tasks-ids <ids>", "Comma-separated task IDs for selected-tasks-completed initial rule").examples(STAGE_EXIT_CONDITIONS_ADD_EXAMPLES).trackedAction(processContext, async (file, stageId, options) => {
4529
- if (options.ruleType !== undefined && (options.marksStageComplete === "false" || options.marksStageComplete === undefined) && !VALID_STAGE_EXIT_RULE_TYPES.includes(options.ruleType)) {
4530
- OutputFormatter.error({
4531
- Result: RESULTS.Failure,
4532
- Message: "Error adding exit condition",
4533
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_STAGE_EXIT_RULE_TYPES.join(", ")}`
4534
- });
4535
- processContext.exit(1);
4536
- return;
4537
- }
4538
- if (options.ruleType !== undefined && options.marksStageComplete === "true" && !VALID_STAGE_COMPLETION_RULE_TYPES.includes(options.ruleType)) {
4539
- OutputFormatter.error({
4540
- Result: RESULTS.Failure,
4541
- Message: "Error adding completion condition",
4542
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_STAGE_COMPLETION_RULE_TYPES.join(", ")}`
4543
- });
4544
- processContext.exit(1);
4545
- return;
4546
- }
3022
+ exitConditions.command("add", { hidden: true });
3023
+ exitConditions.command("update", { hidden: true });
3024
+ exitConditions.command("get").description("Print an exit condition from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the exit condition to retrieve").examples(STAGE_EXIT_CONDITIONS_GET_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId) => {
4547
3025
  const [readError, schema] = await catchError2(readSchema(file));
4548
3026
  if (readError) {
4549
3027
  OutputFormatter.error({
4550
3028
  Result: RESULTS.Failure,
4551
- Message: "Error adding exit condition",
3029
+ Message: "Error getting exit condition",
4552
3030
  Instructions: readError.message
4553
3031
  });
4554
3032
  processContext.exit(1);
4555
3033
  return;
4556
3034
  }
4557
- const [findError, node] = catchError2(() => requireStageNode(schema, stageId));
4558
- if (findError) {
4559
- OutputFormatter.error({
4560
- Result: RESULTS.Failure,
4561
- Message: "Error adding exit condition",
4562
- Instructions: findError.message
4563
- });
4564
- processContext.exit(1);
4565
- return;
4566
- }
4567
- if (options.type !== undefined && !VALID_EXIT_CONDITION_TYPES.includes(options.type)) {
3035
+ const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
3036
+ if (findStageError) {
4568
3037
  OutputFormatter.error({
4569
3038
  Result: RESULTS.Failure,
4570
- Message: "Error adding exit condition",
4571
- Instructions: `Invalid type: "${options.type}". Valid types: ${VALID_EXIT_CONDITION_TYPES.join(", ")}`
3039
+ Message: "Error getting exit condition",
3040
+ Instructions: findStageError.message
4572
3041
  });
4573
3042
  processContext.exit(1);
4574
3043
  return;
4575
3044
  }
4576
- const id = prefixedId("Condition_");
4577
- const condition = {
4578
- id,
4579
- displayName: options.displayName,
4580
- rules: [],
4581
- type: options.type,
4582
- exitToStageId: options.exitToStageId
4583
- };
4584
- if (options.marksStageComplete !== undefined) {
4585
- condition.marksStageComplete = options.marksStageComplete === "true";
4586
- }
4587
- if (options.ruleType !== undefined) {
4588
- const rule = buildRule({
4589
- id: prefixedId("Rule_"),
4590
- ruleType: options.ruleType,
4591
- conditionExpression: options.conditionExpression,
4592
- selectedTasksIds: options.selectedTasksIds?.split(",").map((s) => s.trim())
4593
- });
4594
- condition.rules = [[rule]];
4595
- }
4596
- if (!node.data.exitConditions) {
4597
- node.data.exitConditions = [];
4598
- }
4599
- node.data.exitConditions.push(condition);
4600
- const [writeError] = await catchError2(writeSchema(file, schema));
4601
- if (writeError) {
3045
+ const [findConditionError, condition] = catchError2(() => requireExitCondition(node, conditionId));
3046
+ if (findConditionError) {
4602
3047
  OutputFormatter.error({
4603
3048
  Result: RESULTS.Failure,
4604
- Message: "Error adding exit condition",
4605
- Instructions: writeError.message
3049
+ Message: "Error getting exit condition",
3050
+ Instructions: findConditionError.message
4606
3051
  });
4607
3052
  processContext.exit(1);
4608
3053
  return;
4609
3054
  }
4610
3055
  OutputFormatter.success({
4611
3056
  Result: RESULTS.Success,
4612
- Code: "ExitConditionAdded",
4613
- Data: {
4614
- File: file,
4615
- StageId: stageId,
4616
- ConditionId: id,
4617
- DisplayName: options.displayName,
4618
- Type: options.type,
4619
- ExitToStageId: options.exitToStageId,
4620
- MarksStageComplete: condition.marksStageComplete,
4621
- Rules: condition.rules
4622
- }
3057
+ Code: "ExitConditionFound",
3058
+ Data: { Condition: condition }
4623
3059
  });
4624
3060
  });
4625
- exitConditions.command("update", { hidden: true }).description("Update an exit condition on a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the exit condition to update").option("-d, --display-name <name>", "New display name for the condition").option("-t, --type <type>", "Exit type: exit-only, wait-for-user, or return-to-origin").option("--exit-to-stage-id <id>", "ID of the stage to transition to on exit").option("--marks-stage-complete <bool>", "Set marks-stage-complete (true or false)").option("--rule-type <type>", `Append a new rule with this type: For completion: ${VALID_STAGE_COMPLETION_RULE_TYPES.join(", ")}, For exit: ${VALID_STAGE_EXIT_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the new rule").option("--selected-tasks-ids <ids>", "Comma-separated task IDs for selected-tasks-completed rules").examples(STAGE_EXIT_CONDITIONS_EDIT_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId, options) => {
4626
- if (Object.values(options).every((v) => v === undefined)) {
3061
+ exitConditions.command("remove", { hidden: true });
3062
+ };
3063
+
3064
+ // src/commands/stages.ts
3065
+ var STAGES_GET_EXAMPLES = [
3066
+ {
3067
+ Description: "Print a stage and its connected edges",
3068
+ Command: "uip maestro case stages get case.json Stage_a1b2c3d4",
3069
+ Output: {
3070
+ Code: "StageFound",
3071
+ Data: {
3072
+ Stage: {
3073
+ id: "Stage_a1b2c3d4",
3074
+ type: "case-management:Stage",
3075
+ data: { label: "Review" }
3076
+ },
3077
+ ConnectedEdges: []
3078
+ }
3079
+ }
3080
+ }
3081
+ ];
3082
+ function requireStageOrTriggerNode(schema, stageId) {
3083
+ const node = schema.nodes.find((n) => n.id === stageId);
3084
+ if (!node) {
3085
+ throw new Error(`Stage not found with id: ${stageId}`);
3086
+ }
3087
+ if (node.type !== "case-management:Stage" && node.type !== "case-management:ExceptionStage" && !isAnyTriggerNode(node)) {
3088
+ throw new Error(`Node ${stageId} is not a stage or trigger (type: ${node.type})`);
3089
+ }
3090
+ return node;
3091
+ }
3092
+ var registerStagesCommand = (program) => {
3093
+ const stages = program.command("stages").description("Manage stages within a case management definition JSON file");
3094
+ stages.command("add", { hidden: true });
3095
+ stages.command("update", { hidden: true });
3096
+ stages.command("get").description("Print a stage from a case management definition").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage to retrieve").examples(STAGES_GET_EXAMPLES).trackedAction(processContext, async (file, stageId) => {
3097
+ const [readError, schema] = await catchError2(readSchema(file));
3098
+ if (readError) {
4627
3099
  OutputFormatter.error({
4628
3100
  Result: RESULTS.Failure,
4629
- Message: "Error editing exit condition",
4630
- Instructions: "No fields to update. Provide at least one of: --display-name, --type, --exit-to-stage-id, --marks-stage-complete, --rule-type"
3101
+ Message: "Error getting stage",
3102
+ Instructions: readError.message
4631
3103
  });
4632
3104
  processContext.exit(1);
4633
3105
  return;
4634
3106
  }
4635
- if (options.ruleType !== undefined && options.marksStageComplete === "false" && !VALID_STAGE_EXIT_RULE_TYPES.includes(options.ruleType)) {
3107
+ const [findError, node] = catchError2(() => requireStageOrTriggerNode(schema, stageId));
3108
+ if (findError) {
4636
3109
  OutputFormatter.error({
4637
3110
  Result: RESULTS.Failure,
4638
- Message: "Error editing exit condition",
4639
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_STAGE_EXIT_RULE_TYPES.join(", ")}`
4640
- });
4641
- processContext.exit(1);
4642
- return;
4643
- }
4644
- if (options.ruleType !== undefined && options.marksStageComplete === "true" && !VALID_STAGE_COMPLETION_RULE_TYPES.includes(options.ruleType)) {
4645
- OutputFormatter.error({
4646
- Result: RESULTS.Failure,
4647
- Message: "Error editing completion condition",
4648
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_STAGE_COMPLETION_RULE_TYPES.join(", ")}`
4649
- });
4650
- processContext.exit(1);
4651
- return;
4652
- }
4653
- if ((options.conditionExpression !== undefined || options.selectedTasksIds !== undefined) && options.ruleType === undefined) {
4654
- OutputFormatter.error({
4655
- Result: RESULTS.Failure,
4656
- Message: "Error editing exit condition",
4657
- Instructions: "--condition-expression and --selected-tasks-ids require --rule-type"
4658
- });
4659
- processContext.exit(1);
4660
- return;
4661
- }
4662
- const [readError, schema] = await catchError2(readSchema(file));
4663
- if (readError) {
4664
- OutputFormatter.error({
4665
- Result: RESULTS.Failure,
4666
- Message: "Error editing exit condition",
4667
- Instructions: readError.message
4668
- });
4669
- processContext.exit(1);
4670
- return;
4671
- }
4672
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
4673
- if (findStageError) {
4674
- OutputFormatter.error({
4675
- Result: RESULTS.Failure,
4676
- Message: "Error editing exit condition",
4677
- Instructions: findStageError.message
4678
- });
4679
- processContext.exit(1);
4680
- return;
4681
- }
4682
- const [findConditionError, condition] = catchError2(() => requireExitCondition(node, conditionId));
4683
- if (findConditionError) {
4684
- OutputFormatter.error({
4685
- Result: RESULTS.Failure,
4686
- Message: "Error editing exit condition",
4687
- Instructions: findConditionError.message
4688
- });
4689
- processContext.exit(1);
4690
- return;
4691
- }
4692
- if (options.displayName !== undefined) {
4693
- condition.displayName = options.displayName;
4694
- }
4695
- if (options.type !== undefined && !VALID_EXIT_CONDITION_TYPES.includes(options.type)) {
4696
- OutputFormatter.error({
4697
- Result: RESULTS.Failure,
4698
- Message: "Error editing exit condition",
4699
- Instructions: `Invalid type: "${options.type}". Valid types: ${VALID_EXIT_CONDITION_TYPES.join(", ")}`
4700
- });
4701
- processContext.exit(1);
4702
- return;
4703
- }
4704
- if (options.type !== undefined) {
4705
- condition.type = options.type;
4706
- }
4707
- if (options.exitToStageId !== undefined) {
4708
- condition.exitToStageId = options.exitToStageId;
4709
- }
4710
- if (options.marksStageComplete !== undefined) {
4711
- condition.marksStageComplete = options.marksStageComplete === "true";
4712
- }
4713
- if (options.ruleType !== undefined) {
4714
- const rule = buildRule({
4715
- id: prefixedId("Rule_"),
4716
- ruleType: options.ruleType,
4717
- conditionExpression: options.conditionExpression,
4718
- selectedTasksIds: options.selectedTasksIds?.split(",").map((s) => s.trim())
4719
- });
4720
- if (!condition.rules) {
4721
- condition.rules = [];
4722
- }
4723
- condition.rules.push([rule]);
4724
- }
4725
- const [writeError] = await catchError2(writeSchema(file, schema));
4726
- if (writeError) {
4727
- OutputFormatter.error({
4728
- Result: RESULTS.Failure,
4729
- Message: "Error editing exit condition",
4730
- Instructions: writeError.message
4731
- });
4732
- processContext.exit(1);
4733
- return;
4734
- }
4735
- OutputFormatter.success({
4736
- Result: RESULTS.Success,
4737
- Code: "ExitConditionUpdated",
4738
- Data: {
4739
- File: file,
4740
- StageId: stageId,
4741
- ConditionId: conditionId,
4742
- DisplayName: condition.displayName,
4743
- Type: condition.type,
4744
- ExitToStageId: condition.exitToStageId,
4745
- MarksStageComplete: condition.marksStageComplete,
4746
- Rules: condition.rules
4747
- }
4748
- });
4749
- });
4750
- exitConditions.command("get").description("Print an exit condition from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the exit condition to retrieve").examples(STAGE_EXIT_CONDITIONS_GET_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId) => {
4751
- const [readError, schema] = await catchError2(readSchema(file));
4752
- if (readError) {
4753
- OutputFormatter.error({
4754
- Result: RESULTS.Failure,
4755
- Message: "Error getting exit condition",
4756
- Instructions: readError.message
4757
- });
4758
- processContext.exit(1);
4759
- return;
4760
- }
4761
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
4762
- if (findStageError) {
4763
- OutputFormatter.error({
4764
- Result: RESULTS.Failure,
4765
- Message: "Error getting exit condition",
4766
- Instructions: findStageError.message
4767
- });
4768
- processContext.exit(1);
4769
- return;
4770
- }
4771
- const [findConditionError, condition] = catchError2(() => requireExitCondition(node, conditionId));
4772
- if (findConditionError) {
4773
- OutputFormatter.error({
4774
- Result: RESULTS.Failure,
4775
- Message: "Error getting exit condition",
4776
- Instructions: findConditionError.message
4777
- });
4778
- processContext.exit(1);
4779
- return;
4780
- }
4781
- OutputFormatter.success({
4782
- Result: RESULTS.Success,
4783
- Code: "ExitConditionFound",
4784
- Data: { Condition: condition }
4785
- });
4786
- });
4787
- exitConditions.command("remove", { hidden: true }).description("Remove an exit condition from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<condition-id>", "ID of the exit condition to remove").examples(STAGE_EXIT_CONDITIONS_REMOVE_EXAMPLES).trackedAction(processContext, async (file, stageId, conditionId) => {
4788
- const [readError, schema] = await catchError2(readSchema(file));
4789
- if (readError) {
4790
- OutputFormatter.error({
4791
- Result: RESULTS.Failure,
4792
- Message: "Error removing exit condition",
4793
- Instructions: readError.message
4794
- });
4795
- processContext.exit(1);
4796
- return;
4797
- }
4798
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
4799
- if (findStageError) {
4800
- OutputFormatter.error({
4801
- Result: RESULTS.Failure,
4802
- Message: "Error removing exit condition",
4803
- Instructions: findStageError.message
4804
- });
4805
- processContext.exit(1);
4806
- return;
4807
- }
4808
- const [findConditionError] = catchError2(() => requireExitCondition(node, conditionId));
4809
- if (findConditionError) {
4810
- OutputFormatter.error({
4811
- Result: RESULTS.Failure,
4812
- Message: "Error removing exit condition",
4813
- Instructions: findConditionError.message
4814
- });
4815
- processContext.exit(1);
4816
- return;
4817
- }
4818
- node.data.exitConditions = (node.data.exitConditions ?? []).filter((c) => c.id !== conditionId);
4819
- const [writeError] = await catchError2(writeSchema(file, schema));
4820
- if (writeError) {
4821
- OutputFormatter.error({
4822
- Result: RESULTS.Failure,
4823
- Message: "Error removing exit condition",
4824
- Instructions: writeError.message
4825
- });
4826
- processContext.exit(1);
4827
- return;
4828
- }
4829
- OutputFormatter.success({
4830
- Result: RESULTS.Success,
4831
- Code: "ExitConditionRemoved",
4832
- Data: {
4833
- File: file,
4834
- StageId: stageId,
4835
- ConditionId: conditionId
4836
- }
4837
- });
4838
- });
4839
- };
4840
-
4841
- // src/commands/stages.ts
4842
- var STAGES_ADD_EXAMPLES = [
4843
- {
4844
- Description: "Add a new stage to a case definition",
4845
- Command: 'uip maestro case stages add case.json --label "Review"',
4846
- Output: {
4847
- Code: "StageAdded",
4848
- Data: {
4849
- File: "case.json",
4850
- StageId: "Stage_a1b2c3d4",
4851
- Type: "case-management:Stage",
4852
- Label: "Review",
4853
- Position: { x: 100, y: 200 }
4854
- }
4855
- }
4856
- }
4857
- ];
4858
- var STAGES_EDIT_EXAMPLES = [
4859
- {
4860
- Description: "Rename an existing stage",
4861
- Command: 'uip maestro case stages update case.json Stage_a1b2c3d4 --label "Approval"',
4862
- Output: {
4863
- Code: "StageUpdated",
4864
- Data: {
4865
- File: "case.json",
4866
- StageId: "Stage_a1b2c3d4",
4867
- Type: "case-management:Stage",
4868
- Label: "Approval"
4869
- }
4870
- }
4871
- }
4872
- ];
4873
- var STAGES_GET_EXAMPLES = [
4874
- {
4875
- Description: "Print a stage and its connected edges",
4876
- Command: "uip maestro case stages get case.json Stage_a1b2c3d4",
4877
- Output: {
4878
- Code: "StageFound",
4879
- Data: {
4880
- Stage: {
4881
- id: "Stage_a1b2c3d4",
4882
- type: "case-management:Stage",
4883
- data: { label: "Review" }
4884
- },
4885
- ConnectedEdges: []
4886
- }
4887
- }
4888
- }
4889
- ];
4890
- var STAGES_REMOVE_EXAMPLES = [
4891
- {
4892
- Description: "Remove a stage and its connected edges",
4893
- Command: "uip maestro case stages remove case.json Stage_a1b2c3d4",
4894
- Output: {
4895
- Code: "StageRemoved",
4896
- Data: {
4897
- File: "case.json",
4898
- StageId: "Stage_a1b2c3d4",
4899
- RemovedEdges: 1
4900
- }
4901
- }
4902
- }
4903
- ];
4904
- function requireStageOrTriggerNode(schema, stageId) {
4905
- const node = schema.nodes.find((n) => n.id === stageId);
4906
- if (!node) {
4907
- throw new Error(`Stage not found with id: ${stageId}`);
4908
- }
4909
- if (node.type !== "case-management:Stage" && node.type !== "case-management:ExceptionStage" && !isAnyTriggerNode(node)) {
4910
- throw new Error(`Node ${stageId} is not a stage or trigger (type: ${node.type})`);
4911
- }
4912
- return node;
4913
- }
4914
- function requireStageNode2(schema, stageId) {
4915
- const node = requireStageOrTriggerNode(schema, stageId);
4916
- if (node.type === "uipath.case.trigger") {
4917
- throw new Error(`Node ${stageId} is a trigger in the current document format (type: ${node.type}); edit it in the case plan file directly.`);
4918
- }
4919
- return node;
4920
- }
4921
- function autoPosition(existingStageCount) {
4922
- return { x: 100 + existingStageCount * 500, y: 200 };
4923
- }
4924
- var registerStagesCommand = (program) => {
4925
- const stages = program.command("stages").description("Manage stages within a case management definition JSON file");
4926
- stages.command("add", { hidden: true }).description("Add a new stage to a case management definition").argument("<file>", "Path to the case management JSON file").option("-l, --label <label>", "Display label for the stage").option("-t, --type <type>", "Stage type: stage, exception, or trigger (default: stage)", "stage").option("--description <description>", "Description of the stage").option("--is-required", "Whether the stage is required").examples(STAGES_ADD_EXAMPLES).trackedAction(processContext, async (file, options) => {
4927
- const [readError, schema] = await catchError2(readSchema(file));
4928
- if (readError) {
4929
- OutputFormatter.error({
4930
- Result: RESULTS.Failure,
4931
- Message: "Error adding stage",
4932
- Instructions: readError.message
4933
- });
4934
- processContext.exit(1);
4935
- return;
4936
- }
4937
- const stageType = options.type ?? "stage";
4938
- const id = prefixedId("Stage_");
4939
- let node;
4940
- if (stageType === "trigger") {
4941
- node = {
4942
- id,
4943
- type: "case-management:Trigger",
4944
- position: { x: 200, y: 0 },
4945
- data: {
4946
- label: options.label,
4947
- ...options.description !== undefined && {
4948
- description: options.description
4949
- }
4950
- }
4951
- };
4952
- } else {
4953
- const existingStageCount = schema.nodes.filter(isStageNode).length;
4954
- const position = autoPosition(existingStageCount);
4955
- const parentElement = {
4956
- id: "root",
4957
- type: "case-management:root"
4958
- };
4959
- const defaultStyle = { width: 304, opacity: 0.8 };
4960
- const defaultMeasured = { width: 304, height: 128 };
4961
- if (stageType === "exception") {
4962
- node = {
4963
- id,
4964
- type: "case-management:ExceptionStage",
4965
- position,
4966
- style: defaultStyle,
4967
- measured: defaultMeasured,
4968
- width: 304,
4969
- zIndex: 1001,
4970
- data: {
4971
- label: options.label,
4972
- parentElement,
4973
- isInvalidDropTarget: false,
4974
- isPendingParent: false,
4975
- tasks: [],
4976
- entryConditions: [],
4977
- exitConditions: [],
4978
- ...options.description !== undefined && {
4979
- description: options.description
4980
- },
4981
- ...options.isRequired !== undefined && {
4982
- isRequired: options.isRequired
4983
- }
4984
- }
4985
- };
4986
- } else {
4987
- node = {
4988
- id,
4989
- type: "case-management:Stage",
4990
- position,
4991
- style: defaultStyle,
4992
- measured: defaultMeasured,
4993
- width: 304,
4994
- zIndex: 1001,
4995
- data: {
4996
- label: options.label,
4997
- parentElement,
4998
- isInvalidDropTarget: false,
4999
- isPendingParent: false,
5000
- tasks: [],
5001
- ...options.description !== undefined && {
5002
- description: options.description
5003
- },
5004
- ...options.isRequired !== undefined && {
5005
- isRequired: options.isRequired
5006
- }
5007
- }
5008
- };
5009
- }
5010
- }
5011
- schema.nodes.unshift(node);
5012
- const [writeError] = await catchError2(writeSchema(file, schema));
5013
- if (writeError) {
5014
- OutputFormatter.error({
5015
- Result: RESULTS.Failure,
5016
- Message: "Error adding stage",
5017
- Instructions: writeError.message
5018
- });
5019
- processContext.exit(1);
5020
- return;
5021
- }
5022
- OutputFormatter.success({
5023
- Result: RESULTS.Success,
5024
- Code: "StageAdded",
5025
- Data: {
5026
- File: file,
5027
- StageId: id,
5028
- Type: node.type,
5029
- Label: options.label,
5030
- Description: options.description,
5031
- Position: node.position
5032
- }
5033
- });
5034
- });
5035
- stages.command("update", { hidden: true }).description("Update an existing stage in a case management definition").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node to update").option("-l, --label <label>", "New display label for the stage").option("--description <description>", "New description for the stage").option("--is-required", "Whether the stage is required").examples(STAGES_EDIT_EXAMPLES).trackedAction(processContext, async (file, stageId, options) => {
5036
- if (Object.values(options).every((v) => v === undefined)) {
5037
- OutputFormatter.error({
5038
- Result: RESULTS.Failure,
5039
- Message: "Error editing stage",
5040
- Instructions: "No fields to update. Provide at least one of: --label, --description, --is-required"
5041
- });
5042
- processContext.exit(1);
5043
- return;
5044
- }
5045
- const [readError, schema] = await catchError2(readSchema(file));
5046
- if (readError) {
5047
- OutputFormatter.error({
5048
- Result: RESULTS.Failure,
5049
- Message: "Error editing stage",
5050
- Instructions: readError.message
5051
- });
5052
- processContext.exit(1);
5053
- return;
5054
- }
5055
- const [findError, node] = catchError2(() => requireStageNode2(schema, stageId));
5056
- if (findError) {
5057
- OutputFormatter.error({
5058
- Result: RESULTS.Failure,
5059
- Message: "Error editing stage",
5060
- Instructions: findError.message
5061
- });
5062
- processContext.exit(1);
5063
- return;
5064
- }
5065
- if (options.label !== undefined) {
5066
- node.data.label = options.label;
5067
- }
5068
- if (options.description !== undefined) {
5069
- node.data.description = options.description;
5070
- }
5071
- if (options.isRequired !== undefined && node.type !== "case-management:Trigger") {
5072
- node.data.isRequired = options.isRequired;
5073
- }
5074
- const [writeError] = await catchError2(writeSchema(file, schema));
5075
- if (writeError) {
5076
- OutputFormatter.error({
5077
- Result: RESULTS.Failure,
5078
- Message: "Error editing stage",
5079
- Instructions: writeError.message
5080
- });
5081
- processContext.exit(1);
5082
- return;
5083
- }
5084
- OutputFormatter.success({
5085
- Result: RESULTS.Success,
5086
- Code: "StageUpdated",
5087
- Data: {
5088
- File: file,
5089
- StageId: stageId,
5090
- Type: node.type,
5091
- Label: node.data.label
5092
- }
5093
- });
5094
- });
5095
- stages.command("get").description("Print a stage from a case management definition").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage to retrieve").examples(STAGES_GET_EXAMPLES).trackedAction(processContext, async (file, stageId) => {
5096
- const [readError, schema] = await catchError2(readSchema(file));
5097
- if (readError) {
5098
- OutputFormatter.error({
5099
- Result: RESULTS.Failure,
5100
- Message: "Error getting stage",
5101
- Instructions: readError.message
5102
- });
5103
- processContext.exit(1);
5104
- return;
5105
- }
5106
- const [findError, node] = catchError2(() => requireStageOrTriggerNode(schema, stageId));
5107
- if (findError) {
5108
- OutputFormatter.error({
5109
- Result: RESULTS.Failure,
5110
- Message: "Error getting stage",
5111
- Instructions: findError.message
3111
+ Message: "Error getting stage",
3112
+ Instructions: findError.message
5112
3113
  });
5113
3114
  processContext.exit(1);
5114
3115
  return;
@@ -5123,50 +3124,7 @@ var registerStagesCommand = (program) => {
5123
3124
  }
5124
3125
  });
5125
3126
  });
5126
- stages.command("remove", { hidden: true }).description("Remove a stage and its connected edges from a case management definition").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage to remove").examples(STAGES_REMOVE_EXAMPLES).trackedAction(processContext, async (file, stageId) => {
5127
- const [readError, schema] = await catchError2(readSchema(file));
5128
- if (readError) {
5129
- OutputFormatter.error({
5130
- Result: RESULTS.Failure,
5131
- Message: "Error removing stage",
5132
- Instructions: readError.message
5133
- });
5134
- processContext.exit(1);
5135
- return;
5136
- }
5137
- const [findError] = catchError2(() => requireStageNode2(schema, stageId));
5138
- if (findError) {
5139
- OutputFormatter.error({
5140
- Result: RESULTS.Failure,
5141
- Message: "Error removing stage",
5142
- Instructions: findError.message
5143
- });
5144
- processContext.exit(1);
5145
- return;
5146
- }
5147
- const removedEdges = schema.edges.filter((e) => e.source === stageId || e.target === stageId).length;
5148
- schema.nodes = schema.nodes.filter((n) => n.id !== stageId);
5149
- schema.edges = schema.edges.filter((e) => e.source !== stageId && e.target !== stageId);
5150
- const [writeError] = await catchError2(writeSchema(file, schema));
5151
- if (writeError) {
5152
- OutputFormatter.error({
5153
- Result: RESULTS.Failure,
5154
- Message: "Error removing stage",
5155
- Instructions: writeError.message
5156
- });
5157
- processContext.exit(1);
5158
- return;
5159
- }
5160
- OutputFormatter.success({
5161
- Result: RESULTS.Success,
5162
- Code: "StageRemoved",
5163
- Data: {
5164
- File: file,
5165
- StageId: stageId,
5166
- RemovedEdges: removedEdges
5167
- }
5168
- });
5169
- });
3127
+ stages.command("remove", { hidden: true });
5170
3128
  };
5171
3129
 
5172
3130
  // src/commands/sticky-notes.ts
@@ -5200,153 +3158,14 @@ function requireStickyNoteNode(schema, noteId) {
5200
3158
  throw new Error(`Sticky note not found with id: ${noteId}`);
5201
3159
  }
5202
3160
  if (node.type !== "case-management:StickyNote") {
5203
- throw new Error(`Node ${noteId} is not a sticky note (type: ${node.type})`);
5204
- }
5205
- return node;
5206
- }
5207
- function parsePosition(value) {
5208
- const parts = value.split(",");
5209
- if (parts.length !== 2) {
5210
- throw new Error(`Invalid position: "${value}". Use "x,y" format (e.g. 100,200).`);
5211
- }
5212
- const x = Number(parts[0].trim());
5213
- const y = Number(parts[1].trim());
5214
- if (Number.isNaN(x) || Number.isNaN(y)) {
5215
- throw new Error(`Invalid position: "${value}". Both x and y must be numbers.`);
5216
- }
5217
- return { x, y };
5218
- }
5219
- var registerStickyNotesCommand = (program) => {
5220
- const stickyNotes = program.command("sticky-notes").description("Manage sticky notes within a case management definition JSON file");
5221
- stickyNotes.command("add", { hidden: true }).description("Add a new sticky note to a case management definition").argument("<file>", "Path to the case management JSON file").option("-l, --label <label>", "Display label for the sticky note").option("--content <content>", "Text content of the sticky note").option("--color <color>", "Color of the sticky note").option("--position <x,y>", "Position as x,y coordinates (default: 0,0)").trackedAction(processContext, async (file, options) => {
5222
- const [readError, schema] = await catchError2(readSchema(file));
5223
- if (readError) {
5224
- OutputFormatter.error({
5225
- Result: RESULTS.Failure,
5226
- Message: "Error adding sticky note",
5227
- Instructions: readError.message
5228
- });
5229
- processContext.exit(1);
5230
- return;
5231
- }
5232
- let position = { x: 0, y: 0 };
5233
- if (options.position) {
5234
- const [posError, parsed] = catchError2(() => parsePosition(options.position));
5235
- if (posError) {
5236
- OutputFormatter.error({
5237
- Result: RESULTS.Failure,
5238
- Message: "Error adding sticky note",
5239
- Instructions: posError.message
5240
- });
5241
- processContext.exit(1);
5242
- return;
5243
- }
5244
- position = parsed;
5245
- }
5246
- const id = prefixedId("StickyNote_");
5247
- const node = {
5248
- id,
5249
- type: "case-management:StickyNote",
5250
- position,
5251
- data: {
5252
- label: options.label,
5253
- parentElement: {
5254
- id: "root",
5255
- type: "case-management:root"
5256
- },
5257
- ...options.content !== undefined && {
5258
- content: options.content
5259
- },
5260
- ...options.color !== undefined && {
5261
- color: options.color
5262
- }
5263
- }
5264
- };
5265
- schema.nodes.push(node);
5266
- const [writeError] = await catchError2(writeSchema(file, schema));
5267
- if (writeError) {
5268
- OutputFormatter.error({
5269
- Result: RESULTS.Failure,
5270
- Message: "Error adding sticky note",
5271
- Instructions: writeError.message
5272
- });
5273
- processContext.exit(1);
5274
- return;
5275
- }
5276
- OutputFormatter.success({
5277
- Result: RESULTS.Success,
5278
- Code: "StickyNoteAdded",
5279
- Data: {
5280
- File: file,
5281
- StickyNoteId: id,
5282
- Label: options.label,
5283
- Content: options.content,
5284
- Color: options.color,
5285
- Position: position
5286
- }
5287
- });
5288
- });
5289
- stickyNotes.command("update", { hidden: true }).description("Update an existing sticky note in a case management definition").argument("<file>", "Path to the case management JSON file").argument("<note-id>", "ID of the sticky note node to update").option("-l, --label <label>", "New display label for the sticky note").option("--content <content>", "New text content of the sticky note").option("--color <color>", "New color of the sticky note").trackedAction(processContext, async (file, noteId, options) => {
5290
- if (Object.values(options).every((v) => v === undefined)) {
5291
- OutputFormatter.error({
5292
- Result: RESULTS.Failure,
5293
- Message: "Error editing sticky note",
5294
- Instructions: "No fields to update. Provide at least one of: --label, --content, --color"
5295
- });
5296
- processContext.exit(1);
5297
- return;
5298
- }
5299
- const [readError, schema] = await catchError2(readSchema(file));
5300
- if (readError) {
5301
- OutputFormatter.error({
5302
- Result: RESULTS.Failure,
5303
- Message: "Error editing sticky note",
5304
- Instructions: readError.message
5305
- });
5306
- processContext.exit(1);
5307
- return;
5308
- }
5309
- const [findError, node] = catchError2(() => requireStickyNoteNode(schema, noteId));
5310
- if (findError) {
5311
- OutputFormatter.error({
5312
- Result: RESULTS.Failure,
5313
- Message: "Error editing sticky note",
5314
- Instructions: findError.message
5315
- });
5316
- processContext.exit(1);
5317
- return;
5318
- }
5319
- if (options.label !== undefined) {
5320
- node.data.label = options.label;
5321
- }
5322
- if (options.content !== undefined) {
5323
- node.data.content = options.content;
5324
- }
5325
- if (options.color !== undefined) {
5326
- node.data.color = options.color;
5327
- }
5328
- const [writeError] = await catchError2(writeSchema(file, schema));
5329
- if (writeError) {
5330
- OutputFormatter.error({
5331
- Result: RESULTS.Failure,
5332
- Message: "Error editing sticky note",
5333
- Instructions: writeError.message
5334
- });
5335
- processContext.exit(1);
5336
- return;
5337
- }
5338
- OutputFormatter.success({
5339
- Result: RESULTS.Success,
5340
- Code: "StickyNoteUpdated",
5341
- Data: {
5342
- File: file,
5343
- StickyNoteId: noteId,
5344
- Label: node.data.label,
5345
- Content: node.data.content,
5346
- Color: node.data.color
5347
- }
5348
- });
5349
- });
3161
+ throw new Error(`Node ${noteId} is not a sticky note (type: ${node.type})`);
3162
+ }
3163
+ return node;
3164
+ }
3165
+ var registerStickyNotesCommand = (program) => {
3166
+ const stickyNotes = program.command("sticky-notes").description("Manage sticky notes within a case management definition JSON file");
3167
+ stickyNotes.command("add", { hidden: true });
3168
+ stickyNotes.command("update", { hidden: true });
5350
3169
  stickyNotes.command("get").description("Print a sticky note from a case management definition").argument("<file>", "Path to the case management JSON file").argument("<note-id>", "ID of the sticky note to retrieve").examples(STICKY_NOTES_GET_EXAMPLES).trackedAction(processContext, async (file, noteId) => {
5351
3170
  const [readError, schema] = await catchError2(readSchema(file));
5352
3171
  if (readError) {
@@ -5376,91 +3195,10 @@ var registerStickyNotesCommand = (program) => {
5376
3195
  }
5377
3196
  });
5378
3197
  });
5379
- stickyNotes.command("remove", { hidden: true }).description("Remove a sticky note from a case management definition").argument("<file>", "Path to the case management JSON file").argument("<note-id>", "ID of the sticky note to remove").trackedAction(processContext, async (file, noteId) => {
5380
- const [readError, schema] = await catchError2(readSchema(file));
5381
- if (readError) {
5382
- OutputFormatter.error({
5383
- Result: RESULTS.Failure,
5384
- Message: "Error removing sticky note",
5385
- Instructions: readError.message
5386
- });
5387
- processContext.exit(1);
5388
- return;
5389
- }
5390
- const [findError] = catchError2(() => requireStickyNoteNode(schema, noteId));
5391
- if (findError) {
5392
- OutputFormatter.error({
5393
- Result: RESULTS.Failure,
5394
- Message: "Error removing sticky note",
5395
- Instructions: findError.message
5396
- });
5397
- processContext.exit(1);
5398
- return;
5399
- }
5400
- schema.nodes = schema.nodes.filter((n) => n.id !== noteId);
5401
- const [writeError] = await catchError2(writeSchema(file, schema));
5402
- if (writeError) {
5403
- OutputFormatter.error({
5404
- Result: RESULTS.Failure,
5405
- Message: "Error removing sticky note",
5406
- Instructions: writeError.message
5407
- });
5408
- processContext.exit(1);
5409
- return;
5410
- }
5411
- OutputFormatter.success({
5412
- Result: RESULTS.Success,
5413
- Code: "StickyNoteRemoved",
5414
- Data: {
5415
- File: file,
5416
- StickyNoteId: noteId
5417
- }
5418
- });
5419
- });
3198
+ stickyNotes.command("remove", { hidden: true });
5420
3199
  };
5421
3200
 
5422
3201
  // src/commands/task-entry-conditions.ts
5423
- var TASK_ENTRY_CONDITIONS_ADD_EXAMPLES = [
5424
- {
5425
- Description: "Add an entry condition to a task",
5426
- Command: 'uip maestro case task-entry-conditions add case.json Stage_1 Task_1 --display-name "Start" --rule-type current-stage-entered',
5427
- Output: {
5428
- Code: "TaskEntryConditionAdded",
5429
- Data: {
5430
- File: "case.json",
5431
- StageId: "Stage_1",
5432
- TaskId: "Task_1",
5433
- ConditionId: "Condition_a1b2c3d4",
5434
- DisplayName: "Start",
5435
- Rules: [
5436
- [
5437
- {
5438
- id: "Rule_e5f6a7b8",
5439
- rule: "current-stage-entered"
5440
- }
5441
- ]
5442
- ]
5443
- }
5444
- }
5445
- }
5446
- ];
5447
- var TASK_ENTRY_CONDITIONS_EDIT_EXAMPLES = [
5448
- {
5449
- Description: "Rename a task entry condition",
5450
- Command: 'uip maestro case task-entry-conditions update case.json Stage_1 Task_1 Condition_a1b2c3d4 --display-name "Updated"',
5451
- Output: {
5452
- Code: "TaskEntryConditionUpdated",
5453
- Data: {
5454
- File: "case.json",
5455
- StageId: "Stage_1",
5456
- TaskId: "Task_1",
5457
- ConditionId: "Condition_a1b2c3d4",
5458
- DisplayName: "Updated",
5459
- Rules: []
5460
- }
5461
- }
5462
- }
5463
- ];
5464
3202
  var TASK_ENTRY_CONDITIONS_GET_EXAMPLES = [
5465
3203
  {
5466
3204
  Description: "Print a task entry condition by ID",
@@ -5477,291 +3215,23 @@ var TASK_ENTRY_CONDITIONS_GET_EXAMPLES = [
5477
3215
  }
5478
3216
  }
5479
3217
  ];
5480
- var TASK_ENTRY_CONDITIONS_REMOVE_EXAMPLES = [
5481
- {
5482
- Description: "Remove a task entry condition by ID",
5483
- Command: "uip maestro case task-entry-conditions remove case.json Stage_1 Task_1 Condition_a1b2c3d4",
5484
- Output: {
5485
- Code: "TaskEntryConditionRemoved",
5486
- Data: {
5487
- File: "case.json",
5488
- StageId: "Stage_1",
5489
- TaskId: "Task_1",
5490
- ConditionId: "Condition_a1b2c3d4"
5491
- }
5492
- }
5493
- }
5494
- ];
5495
3218
  function requireTaskEntryCondition(task, conditionId, taskId) {
5496
3219
  const condition = (task.entryConditions ?? []).find((c) => c.id === conditionId);
5497
- if (!condition) {
5498
- throw new Error(`Entry condition not found with id: ${conditionId} in task: ${taskId}`);
5499
- }
5500
- return condition;
5501
- }
5502
- var registerTaskEntryConditionsCommand = (program) => {
5503
- const taskEntryConditions = program.command("task-entry-conditions").description("Manage entry conditions on a task within a case management definition JSON file");
5504
- taskEntryConditions.command("add", { hidden: true }).description("Add an entry condition to a task").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<task-id>", "ID of the task").option("-d, --display-name <name>", "Display name for the condition").option("--rule-type <type>", `Initial rule type: ${VALID_TASK_ENTRY_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the initial rule").option("--selected-tasks-ids <ids>", "Comma-separated task IDs for selected-tasks-completed initial rule").examples(TASK_ENTRY_CONDITIONS_ADD_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId, options) => {
5505
- if (options.ruleType !== undefined && !VALID_TASK_ENTRY_RULE_TYPES.includes(options.ruleType)) {
5506
- OutputFormatter.error({
5507
- Result: RESULTS.Failure,
5508
- Message: "Error adding task entry condition",
5509
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_TASK_ENTRY_RULE_TYPES.join(", ")}`
5510
- });
5511
- processContext.exit(1);
5512
- return;
5513
- }
5514
- const [readError, schema] = await catchError2(readSchema(file));
5515
- if (readError) {
5516
- OutputFormatter.error({
5517
- Result: RESULTS.Failure,
5518
- Message: "Error adding task entry condition",
5519
- Instructions: readError.message
5520
- });
5521
- processContext.exit(1);
5522
- return;
5523
- }
5524
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
5525
- if (findStageError) {
5526
- OutputFormatter.error({
5527
- Result: RESULTS.Failure,
5528
- Message: "Error adding task entry condition",
5529
- Instructions: findStageError.message
5530
- });
5531
- processContext.exit(1);
5532
- return;
5533
- }
5534
- const [findTaskError, found] = catchError2(() => requireTask(node.data.tasks ?? [], taskId, stageId));
5535
- if (findTaskError) {
5536
- OutputFormatter.error({
5537
- Result: RESULTS.Failure,
5538
- Message: "Error adding task entry condition",
5539
- Instructions: findTaskError.message
5540
- });
5541
- processContext.exit(1);
5542
- return;
5543
- }
5544
- const id = prefixedId("Condition_");
5545
- const condition = {
5546
- id,
5547
- displayName: options.displayName,
5548
- rules: []
5549
- };
5550
- if (options.ruleType !== undefined) {
5551
- if (options.ruleType === "selected-tasks-completed" && !options.selectedTasksIds) {
5552
- OutputFormatter.error({
5553
- Result: RESULTS.Failure,
5554
- Message: "Error adding task entry condition",
5555
- Instructions: "--selected-tasks-ids is required when --rule-type is selected-tasks-completed"
5556
- });
5557
- processContext.exit(1);
5558
- return;
5559
- }
5560
- const selectedTasksIds = options.selectedTasksIds ? options.selectedTasksIds.split(",").map((s) => s.trim()) : undefined;
5561
- const rule = buildRule({
5562
- id: prefixedId("Rule_"),
5563
- ruleType: options.ruleType,
5564
- conditionExpression: options.conditionExpression,
5565
- selectedTasksIds
5566
- });
5567
- condition.rules = [[rule]];
5568
- }
5569
- if (!found.task.entryConditions) {
5570
- found.task.entryConditions = [];
5571
- }
5572
- found.task.entryConditions.push(condition);
5573
- const [writeError] = await catchError2(writeSchema(file, schema));
5574
- if (writeError) {
5575
- OutputFormatter.error({
5576
- Result: RESULTS.Failure,
5577
- Message: "Error adding task entry condition",
5578
- Instructions: writeError.message
5579
- });
5580
- processContext.exit(1);
5581
- return;
5582
- }
5583
- OutputFormatter.success({
5584
- Result: RESULTS.Success,
5585
- Code: "TaskEntryConditionAdded",
5586
- Data: {
5587
- File: file,
5588
- StageId: stageId,
5589
- TaskId: taskId,
5590
- ConditionId: id,
5591
- DisplayName: options.displayName,
5592
- Rules: condition.rules
5593
- }
5594
- });
5595
- });
5596
- taskEntryConditions.command("update", { hidden: true }).description("Update an entry condition on a task").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<task-id>", "ID of the task").argument("<condition-id>", "ID of the entry condition to update").option("-d, --display-name <name>", "New display name for the condition").option("--rule-type <type>", `Append a new rule with this type: ${VALID_TASK_ENTRY_RULE_TYPES.join(", ")}`).option("--condition-expression <expr>", "Condition expression for the new rule").option("--selected-tasks-ids <ids>", "Comma-separated task IDs for selected-tasks-completed rules").examples(TASK_ENTRY_CONDITIONS_EDIT_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId, conditionId, options) => {
5597
- if (Object.values(options).every((v) => v === undefined)) {
5598
- OutputFormatter.error({
5599
- Result: RESULTS.Failure,
5600
- Message: "Error editing task entry condition",
5601
- Instructions: "No fields to update. Provide at least one of: --display-name, --rule-type"
5602
- });
5603
- processContext.exit(1);
5604
- return;
5605
- }
5606
- if (options.ruleType !== undefined && !VALID_TASK_ENTRY_RULE_TYPES.includes(options.ruleType)) {
5607
- OutputFormatter.error({
5608
- Result: RESULTS.Failure,
5609
- Message: "Error editing task entry condition",
5610
- Instructions: `Invalid rule type: "${options.ruleType}". Valid types: ${VALID_TASK_ENTRY_RULE_TYPES.join(", ")}`
5611
- });
5612
- processContext.exit(1);
5613
- return;
5614
- }
5615
- const [readError, schema] = await catchError2(readSchema(file));
5616
- if (readError) {
5617
- OutputFormatter.error({
5618
- Result: RESULTS.Failure,
5619
- Message: "Error editing task entry condition",
5620
- Instructions: readError.message
5621
- });
5622
- processContext.exit(1);
5623
- return;
5624
- }
5625
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
5626
- if (findStageError) {
5627
- OutputFormatter.error({
5628
- Result: RESULTS.Failure,
5629
- Message: "Error editing task entry condition",
5630
- Instructions: findStageError.message
5631
- });
5632
- processContext.exit(1);
5633
- return;
5634
- }
5635
- const [findTaskError, found] = catchError2(() => requireTask(node.data.tasks ?? [], taskId, stageId));
5636
- if (findTaskError) {
5637
- OutputFormatter.error({
5638
- Result: RESULTS.Failure,
5639
- Message: "Error editing task entry condition",
5640
- Instructions: findTaskError.message
5641
- });
5642
- processContext.exit(1);
5643
- return;
5644
- }
5645
- const [findConditionError, condition] = catchError2(() => requireTaskEntryCondition(found.task, conditionId, taskId));
5646
- if (findConditionError) {
5647
- OutputFormatter.error({
5648
- Result: RESULTS.Failure,
5649
- Message: "Error editing task entry condition",
5650
- Instructions: findConditionError.message
5651
- });
5652
- processContext.exit(1);
5653
- return;
5654
- }
5655
- if ((options.conditionExpression !== undefined || options.selectedTasksIds !== undefined) && options.ruleType === undefined) {
5656
- OutputFormatter.error({
5657
- Result: RESULTS.Failure,
5658
- Message: "Error editing task entry condition",
5659
- Instructions: "--condition-expression and --selected-tasks-ids require --rule-type"
5660
- });
5661
- processContext.exit(1);
5662
- return;
5663
- }
5664
- if (options.displayName !== undefined) {
5665
- condition.displayName = options.displayName;
5666
- }
5667
- if (options.ruleType !== undefined) {
5668
- if (options.ruleType === "selected-tasks-completed" && !options.selectedTasksIds) {
5669
- OutputFormatter.error({
5670
- Result: RESULTS.Failure,
5671
- Message: "Error editing task entry condition",
5672
- Instructions: "--selected-tasks-ids is required when --rule-type is selected-tasks-completed"
5673
- });
5674
- processContext.exit(1);
5675
- return;
5676
- }
5677
- const selectedTasksIds = options.selectedTasksIds ? options.selectedTasksIds.split(",").map((s) => s.trim()) : undefined;
5678
- const rule = buildRule({
5679
- id: prefixedId("Rule_"),
5680
- ruleType: options.ruleType,
5681
- conditionExpression: options.conditionExpression,
5682
- selectedTasksIds
5683
- });
5684
- if (!condition.rules) {
5685
- condition.rules = [];
5686
- }
5687
- condition.rules.push([rule]);
5688
- }
5689
- const [writeError] = await catchError2(writeSchema(file, schema));
5690
- if (writeError) {
5691
- OutputFormatter.error({
5692
- Result: RESULTS.Failure,
5693
- Message: "Error editing task entry condition",
5694
- Instructions: writeError.message
5695
- });
5696
- processContext.exit(1);
5697
- return;
5698
- }
5699
- OutputFormatter.success({
5700
- Result: RESULTS.Success,
5701
- Code: "TaskEntryConditionUpdated",
5702
- Data: {
5703
- File: file,
5704
- StageId: stageId,
5705
- TaskId: taskId,
5706
- ConditionId: conditionId,
5707
- DisplayName: condition.displayName,
5708
- Rules: condition.rules
5709
- }
5710
- });
5711
- });
5712
- taskEntryConditions.command("get").description("Print an entry condition from a task").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<task-id>", "ID of the task").argument("<condition-id>", "ID of the entry condition to retrieve").examples(TASK_ENTRY_CONDITIONS_GET_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId, conditionId) => {
5713
- const [readError, schema] = await catchError2(readSchema(file));
5714
- if (readError) {
5715
- OutputFormatter.error({
5716
- Result: RESULTS.Failure,
5717
- Message: "Error getting task entry condition",
5718
- Instructions: readError.message
5719
- });
5720
- processContext.exit(1);
5721
- return;
5722
- }
5723
- const [findStageError, node] = catchError2(() => requireStageNode(schema, stageId));
5724
- if (findStageError) {
5725
- OutputFormatter.error({
5726
- Result: RESULTS.Failure,
5727
- Message: "Error getting task entry condition",
5728
- Instructions: findStageError.message
5729
- });
5730
- processContext.exit(1);
5731
- return;
5732
- }
5733
- const [findTaskError, found] = catchError2(() => requireTask(node.data.tasks ?? [], taskId, stageId));
5734
- if (findTaskError) {
5735
- OutputFormatter.error({
5736
- Result: RESULTS.Failure,
5737
- Message: "Error getting task entry condition",
5738
- Instructions: findTaskError.message
5739
- });
5740
- processContext.exit(1);
5741
- return;
5742
- }
5743
- const [findConditionError, condition] = catchError2(() => requireTaskEntryCondition(found.task, conditionId, taskId));
5744
- if (findConditionError) {
5745
- OutputFormatter.error({
5746
- Result: RESULTS.Failure,
5747
- Message: "Error getting task entry condition",
5748
- Instructions: findConditionError.message
5749
- });
5750
- processContext.exit(1);
5751
- return;
5752
- }
5753
- OutputFormatter.success({
5754
- Result: RESULTS.Success,
5755
- Code: "TaskEntryConditionFound",
5756
- Data: { Condition: condition }
5757
- });
5758
- });
5759
- taskEntryConditions.command("remove", { hidden: true }).description("Remove an entry condition from a task").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<task-id>", "ID of the task").argument("<condition-id>", "ID of the entry condition to remove").examples(TASK_ENTRY_CONDITIONS_REMOVE_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId, conditionId) => {
3220
+ if (!condition) {
3221
+ throw new Error(`Entry condition not found with id: ${conditionId} in task: ${taskId}`);
3222
+ }
3223
+ return condition;
3224
+ }
3225
+ var registerTaskEntryConditionsCommand = (program) => {
3226
+ const taskEntryConditions = program.command("task-entry-conditions").description("Manage entry conditions on a task within a case management definition JSON file");
3227
+ taskEntryConditions.command("add", { hidden: true });
3228
+ taskEntryConditions.command("update", { hidden: true });
3229
+ taskEntryConditions.command("get").description("Print an entry condition from a task").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage node").argument("<task-id>", "ID of the task").argument("<condition-id>", "ID of the entry condition to retrieve").examples(TASK_ENTRY_CONDITIONS_GET_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId, conditionId) => {
5760
3230
  const [readError, schema] = await catchError2(readSchema(file));
5761
3231
  if (readError) {
5762
3232
  OutputFormatter.error({
5763
3233
  Result: RESULTS.Failure,
5764
- Message: "Error removing task entry condition",
3234
+ Message: "Error getting task entry condition",
5765
3235
  Instructions: readError.message
5766
3236
  });
5767
3237
  processContext.exit(1);
@@ -5771,7 +3241,7 @@ var registerTaskEntryConditionsCommand = (program) => {
5771
3241
  if (findStageError) {
5772
3242
  OutputFormatter.error({
5773
3243
  Result: RESULTS.Failure,
5774
- Message: "Error removing task entry condition",
3244
+ Message: "Error getting task entry condition",
5775
3245
  Instructions: findStageError.message
5776
3246
  });
5777
3247
  processContext.exit(1);
@@ -5781,44 +3251,29 @@ var registerTaskEntryConditionsCommand = (program) => {
5781
3251
  if (findTaskError) {
5782
3252
  OutputFormatter.error({
5783
3253
  Result: RESULTS.Failure,
5784
- Message: "Error removing task entry condition",
3254
+ Message: "Error getting task entry condition",
5785
3255
  Instructions: findTaskError.message
5786
3256
  });
5787
3257
  processContext.exit(1);
5788
3258
  return;
5789
3259
  }
5790
- const [findConditionError] = catchError2(() => requireTaskEntryCondition(found.task, conditionId, taskId));
3260
+ const [findConditionError, condition] = catchError2(() => requireTaskEntryCondition(found.task, conditionId, taskId));
5791
3261
  if (findConditionError) {
5792
3262
  OutputFormatter.error({
5793
3263
  Result: RESULTS.Failure,
5794
- Message: "Error removing task entry condition",
3264
+ Message: "Error getting task entry condition",
5795
3265
  Instructions: findConditionError.message
5796
3266
  });
5797
3267
  processContext.exit(1);
5798
3268
  return;
5799
3269
  }
5800
- found.task.entryConditions = (found.task.entryConditions ?? []).filter((c) => c.id !== conditionId);
5801
- const [writeError] = await catchError2(writeSchema(file, schema));
5802
- if (writeError) {
5803
- OutputFormatter.error({
5804
- Result: RESULTS.Failure,
5805
- Message: "Error removing task entry condition",
5806
- Instructions: writeError.message
5807
- });
5808
- processContext.exit(1);
5809
- return;
5810
- }
5811
3270
  OutputFormatter.success({
5812
3271
  Result: RESULTS.Success,
5813
- Code: "TaskEntryConditionRemoved",
5814
- Data: {
5815
- File: file,
5816
- StageId: stageId,
5817
- TaskId: taskId,
5818
- ConditionId: conditionId
5819
- }
3272
+ Code: "TaskEntryConditionFound",
3273
+ Data: { Condition: condition }
5820
3274
  });
5821
3275
  });
3276
+ taskEntryConditions.command("remove", { hidden: true });
5822
3277
  };
5823
3278
 
5824
3279
  // src/commands/task-types.ts
@@ -5879,58 +3334,6 @@ var registerTaskTypesCommand = (program, sources = { load: caseSchemaVersions })
5879
3334
  };
5880
3335
 
5881
3336
  // src/commands/tasks.ts
5882
- var TASKS_ADD_EXAMPLES = [
5883
- {
5884
- Description: "Add a process task to a stage",
5885
- Command: 'uip maestro case tasks add case.json Stage_1 --type process --display-name "Process invoice"',
5886
- Output: {
5887
- Code: "TaskAdded",
5888
- Data: {
5889
- File: "case.json",
5890
- StageId: "Stage_1",
5891
- TaskId: "ta1b2c3d",
5892
- Type: "process",
5893
- DisplayName: "Process invoice",
5894
- Lane: 0
5895
- }
5896
- }
5897
- }
5898
- ];
5899
- var TASKS_ADD_CONNECTOR_EXAMPLES = [
5900
- {
5901
- Description: "Add a connector activity task to a stage",
5902
- Command: "uip maestro case tasks add-connector case.json Stage_1 --type activity --type-id a1b2c3d4-0000-0000-0000-000000000001 --connection-id b2c3d4e5-0000-0000-0000-000000000001",
5903
- Output: {
5904
- Code: "ConnectorTaskAdded",
5905
- Data: {
5906
- File: "case.json",
5907
- StageId: "Stage_1",
5908
- TaskId: "ta1b2c3d",
5909
- ElementId: "Stage_1-ta1b2c3d",
5910
- Type: "execute-connector-activity",
5911
- DisplayName: "Jira - Add comment",
5912
- Lane: 0,
5913
- ServiceType: "Intsvc.ActivityExecution"
5914
- }
5915
- }
5916
- }
5917
- ];
5918
- var TASKS_EDIT_EXAMPLES = [
5919
- {
5920
- Description: "Rename an existing task within a stage",
5921
- Command: 'uip maestro case tasks update case.json Stage_1 ta1b2c3d --display-name "Updated"',
5922
- Output: {
5923
- Code: "TaskUpdated",
5924
- Data: {
5925
- File: "case.json",
5926
- StageId: "Stage_1",
5927
- TaskId: "ta1b2c3d",
5928
- Type: "process",
5929
- DisplayName: "Updated"
5930
- }
5931
- }
5932
- }
5933
- ];
5934
3337
  var TASKS_GET_EXAMPLES = [
5935
3338
  {
5936
3339
  Description: "Print a single task from a stage",
@@ -5950,21 +3353,6 @@ var TASKS_GET_EXAMPLES = [
5950
3353
  }
5951
3354
  }
5952
3355
  ];
5953
- var TASKS_REMOVE_EXAMPLES = [
5954
- {
5955
- Description: "Remove a task from a stage",
5956
- Command: "uip maestro case tasks remove case.json Stage_1 ta1b2c3d",
5957
- Output: {
5958
- Code: "TaskRemoved",
5959
- Data: {
5960
- File: "case.json",
5961
- StageId: "Stage_1",
5962
- TaskId: "ta1b2c3d",
5963
- Lane: 0
5964
- }
5965
- }
5966
- }
5967
- ];
5968
3356
  var TASKS_ENRICH_EXAMPLES = [
5969
3357
  {
5970
3358
  Description: "Enrich a process task with its input/output schema",
@@ -5994,21 +3382,9 @@ var TASKS_DESCRIBE_EXAMPLES = [
5994
3382
  }
5995
3383
  }
5996
3384
  ];
5997
- var loadConnectorEnrichment = () => import("./connector-enrichment-service-y61hzyd0.js");
5998
- var loadTriggerEnrichment = () => import("./trigger-enrichment-service-vg26e453.js");
3385
+ var loadConnectorEnrichment = () => import("./connector-enrichment-service-bdsgzrag.js");
3386
+ var loadTriggerEnrichment = () => import("./trigger-enrichment-service-at3735se.js");
5999
3387
  var loadEnrichment = () => import("./enrichment-service-ae9md530.js");
6000
- var TASK_TYPES = [
6001
- "process",
6002
- "action",
6003
- "agent",
6004
- "api-workflow",
6005
- "rpa",
6006
- "external-agent",
6007
- "wait-for-timer",
6008
- "wait-for-connector",
6009
- "execute-connector-activity",
6010
- "case-management"
6011
- ];
6012
3388
  var ENRICHABLE_TYPES = [
6013
3389
  "process",
6014
3390
  "agent",
@@ -6031,154 +3407,6 @@ var DESCRIBABLE_TYPES = [
6031
3407
  "external-workflow",
6032
3408
  "external-agent"
6033
3409
  ];
6034
- var CONNECTOR_TYPES = ["activity", "trigger"];
6035
- function buildTaskData(options) {
6036
- const data = {};
6037
- if (options.name !== undefined)
6038
- data.name = options.name;
6039
- if (options.folderPath !== undefined)
6040
- data.folderPath = options.folderPath;
6041
- return data;
6042
- }
6043
- function buildTask(options) {
6044
- const id = prefixedId("t", 8);
6045
- const base = {
6046
- id,
6047
- displayName: options.displayName,
6048
- ...options.shouldRunOnlyOnce !== undefined ? { shouldRunOnlyOnce: options.shouldRunOnlyOnce } : {},
6049
- ...options.description !== undefined ? { description: options.description } : {},
6050
- ...options.isRequired !== undefined ? { isRequired: options.isRequired } : {}
6051
- };
6052
- if (options.type === "wait-for-timer") {
6053
- return { ...base, type: "wait-for-timer", data: {} };
6054
- }
6055
- if (options.type === "action") {
6056
- return {
6057
- ...base,
6058
- type: "action",
6059
- data: {
6060
- ...buildTaskData(options),
6061
- ...options.taskTitle !== undefined ? { taskTitle: options.taskTitle } : {},
6062
- priority: options.priority ?? "Medium",
6063
- ...options.recipient !== undefined ? {
6064
- assignmentCriteria: "user",
6065
- recipient: {
6066
- Type: 2,
6067
- Value: options.recipient
6068
- }
6069
- } : {}
6070
- }
6071
- };
6072
- }
6073
- return {
6074
- ...base,
6075
- type: options.type,
6076
- data: buildTaskData(options)
6077
- };
6078
- }
6079
- function buildElementId(stageId, taskId) {
6080
- return `${stageId}-${taskId}`;
6081
- }
6082
- function resolveLane(tasks, lane) {
6083
- const laneIndex = Number(lane ?? 0);
6084
- if (Number.isNaN(laneIndex) || laneIndex < 0) {
6085
- return -1;
6086
- }
6087
- while (tasks.length <= laneIndex) {
6088
- tasks.push([]);
6089
- }
6090
- return laneIndex;
6091
- }
6092
- async function loadConnectorStage(file, stageId, lane) {
6093
- const [readError, schema] = await catchError2(readSchema(file));
6094
- if (readError)
6095
- throw readError;
6096
- const [findError, stageNode] = catchError2(() => requireStageNode(schema, stageId));
6097
- if (findError)
6098
- throw findError;
6099
- stageNode.data.tasks ??= [];
6100
- const lanes = stageNode.data.tasks;
6101
- const laneIndex = resolveLane(lanes, lane);
6102
- if (laneIndex < 0)
6103
- throw new Error(`Invalid lane index: ${lane}`);
6104
- return { schema, lanes, laneIndex };
6105
- }
6106
- function buildConnectorTask(params) {
6107
- const taskId = prefixedId("t", 8);
6108
- const elementId = buildElementId(params.stageId, taskId);
6109
- return {
6110
- id: taskId,
6111
- elementId,
6112
- displayName: params.displayName,
6113
- type: params.taskType,
6114
- data: {
6115
- serviceType: params.serviceType,
6116
- context: params.enrichment.context,
6117
- inputs: params.enrichment.inputs.map((i) => ({ ...i, elementId })),
6118
- outputs: params.enrichment.outputs.map((o) => ({
6119
- ...o,
6120
- elementId
6121
- })),
6122
- bindings: params.enrichment.bindings
6123
- },
6124
- entryConditions: [
6125
- {
6126
- id: prefixedId("c", 8),
6127
- displayName: "Entry rule 1",
6128
- rules: [
6129
- [
6130
- {
6131
- id: prefixedId("r", 8),
6132
- rule: "current-stage-entered"
6133
- }
6134
- ]
6135
- ]
6136
- }
6137
- ]
6138
- };
6139
- }
6140
- async function saveConnectorTask(params) {
6141
- const idRemap = new Map;
6142
- const usedBindings = params.enrichment.bindings.map((b) => {
6143
- const used = findOrPushBinding(params.schema, b);
6144
- if (used.id !== b.id)
6145
- idRemap.set(b.id, used.id);
6146
- return used;
6147
- });
6148
- if (idRemap.size > 0) {
6149
- remapBindingRefs(params.task.data, idRemap);
6150
- }
6151
- const taskData = params.task.data;
6152
- taskData.bindings = usedBindings;
6153
- params.lanes[params.laneIndex].push(params.task);
6154
- const { designerConnectorShape } = await import("./connector-task-shape-qamydqnd.js");
6155
- designerConnectorShape(params.task);
6156
- const [writeError] = await catchError2(writeSchema(params.file, params.schema));
6157
- if (writeError)
6158
- throw writeError;
6159
- }
6160
- function deepMerge(target, source, unsafeKeys) {
6161
- for (const [key, value] of Object.entries(source)) {
6162
- if (unsafeKeys.has(key))
6163
- continue;
6164
- if (typeof value === "object" && value !== null && !Array.isArray(value) && typeof target[key] === "object" && target[key] !== null && !Array.isArray(target[key])) {
6165
- target[key] = deepMerge(target[key], value, unsafeKeys);
6166
- } else {
6167
- target[key] = value;
6168
- }
6169
- }
6170
- return target;
6171
- }
6172
- async function applyInputValues(inputs, inputValues) {
6173
- const { nestDottedKeys, UNSAFE_KEYS } = await import("./index-3cwyemy2.js");
6174
- for (const input of inputs) {
6175
- const values = inputValues[input.name];
6176
- if (values && input.body) {
6177
- const nested = nestDottedKeys(values);
6178
- deepMerge(input.body, nested, UNSAFE_KEYS);
6179
- }
6180
- }
6181
- }
6182
3410
  async function describeConnectorActivity(id, connectionId, indexType = "typecache-activities") {
6183
3411
  const { enrichConnectorActivity, extractFieldDefinitions } = await loadConnectorEnrichment();
6184
3412
  const result = await enrichConnectorActivity(id, connectionId, indexType);
@@ -6279,304 +3507,13 @@ async function runDescribeTask(options) {
6279
3507
  return describeConnectorTrigger(options.id, options.connectionId);
6280
3508
  }
6281
3509
  return describeEnrichableTask(normalizedType, options.id);
6282
- }
6283
- var VERBATIM_TASK_IO_FIELDS = ["inputs", "outputs", "enrichment"];
6284
- var registerTasksCommand = (program) => {
6285
- const tasks = program.command("tasks").description("Manage tasks within a stage in a case management definition JSON file");
6286
- tasks.command("add", { hidden: true }).description("Add a new task to a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage to add the task to").requiredOption("-t, --type <type>", `Task type: ${TASK_TYPES.join(", ")}`).option("-d, --display-name <displayName>", "Display name for the task").option("-n, --name <name>", "Process or workflow name").option("--folder-path <folderPath>", "Folder path for the process or workflow").option("--lane <lane>", "Parallel lane index (default: 0)", "0").option("--task-type-id <taskTypeId>", "Task type ID to enrich with bindings, inputs, and outputs").option("--should-run-only-once", "Whether the task should run only once").option("--description <description>", "Description of the task").option("--is-required", "Whether the task is required").option("--task-title <taskTitle>", "Title for the action task (action type only)").option("--priority <priority>", "Priority for the action task: Low, Medium, High, Critical (action type only, default: Medium)").option("--recipient <email>", "Recipient email for the action task (action type only, sets assignmentCriteria to user)").examples(TASKS_ADD_EXAMPLES).trackedAction(processContext, async (file, stageId, options) => {
6287
- options.type = options.type.toLowerCase();
6288
- if (!TASK_TYPES.includes(options.type)) {
6289
- OutputFormatter.error({
6290
- Result: RESULTS.Failure,
6291
- Message: "Error adding task",
6292
- Instructions: `Invalid task type: "${options.type}". Valid types: ${TASK_TYPES.join(", ")}`
6293
- });
6294
- processContext.exit(1);
6295
- return;
6296
- }
6297
- const [readError, schema] = await catchError2(readSchema(file));
6298
- if (readError) {
6299
- OutputFormatter.error({
6300
- Result: RESULTS.Failure,
6301
- Message: "Error adding task",
6302
- Instructions: readError.message
6303
- });
6304
- processContext.exit(1);
6305
- return;
6306
- }
6307
- const [findError, stageNode] = catchError2(() => requireStageNode(schema, stageId));
6308
- if (findError) {
6309
- OutputFormatter.error({
6310
- Result: RESULTS.Failure,
6311
- Message: "Error adding task",
6312
- Instructions: findError.message
6313
- });
6314
- processContext.exit(1);
6315
- return;
6316
- }
6317
- if (!stageNode.data.tasks) {
6318
- stageNode.data.tasks = [];
6319
- }
6320
- const laneIndex = resolveLane(stageNode.data.tasks, options.lane);
6321
- if (laneIndex < 0) {
6322
- OutputFormatter.error({
6323
- Result: RESULTS.Failure,
6324
- Message: "Error adding task",
6325
- Instructions: `Invalid lane index: ${options.lane}`
6326
- });
6327
- processContext.exit(1);
6328
- return;
6329
- }
6330
- const task = buildTask(options);
6331
- if (options.taskTypeId) {
6332
- if (!ENRICHABLE_TYPES.includes(options.type)) {
6333
- OutputFormatter.error({
6334
- Result: RESULTS.Failure,
6335
- Message: "Error adding task",
6336
- Instructions: `Enrichment via --task-type-id is not supported for "${options.type}" tasks. Supported types: ${ENRICHABLE_TYPES.join(", ")}`
6337
- });
6338
- processContext.exit(1);
6339
- return;
6340
- }
6341
- const elementId = buildElementId(stageId, task.id);
6342
- const taskTypeId = options.taskTypeId;
6343
- const { enrichTask } = await loadEnrichment();
6344
- const [enrichError, enrichment] = await catchError2(enrichTask(options.type, taskTypeId, { elementId }));
6345
- if (enrichError) {
6346
- await reportFailure("Error adding task", enrichError);
6347
- return;
6348
- }
6349
- const effectiveName = options.name ?? enrichment.name;
6350
- const effectiveFolderPath = options.folderPath ?? enrichment.folderPath;
6351
- task.elementId = elementId;
6352
- const [nameBinding, folderPathBinding] = createTaskBindings(effectiveName, effectiveFolderPath, options.type);
6353
- const usedNameBinding = findOrPushBinding(schema, nameBinding);
6354
- const usedFolderBinding = findOrPushBinding(schema, folderPathBinding);
6355
- const data = task.data;
6356
- data.name = `=bindings.${usedNameBinding.id}`;
6357
- data.folderPath = `=bindings.${usedFolderBinding.id}`;
6358
- data.inputs = enrichment.inputs;
6359
- data.outputs = enrichment.outputs;
6360
- }
6361
- stageNode.data.tasks[laneIndex].push(task);
6362
- const [writeError] = await catchError2(writeSchema(file, schema));
6363
- if (writeError) {
6364
- OutputFormatter.error({
6365
- Result: RESULTS.Failure,
6366
- Message: "Error adding task",
6367
- Instructions: writeError.message
6368
- });
6369
- processContext.exit(1);
6370
- return;
6371
- }
6372
- OutputFormatter.success({
6373
- Result: RESULTS.Success,
6374
- Code: "TaskAdded",
6375
- Data: {
6376
- File: file,
6377
- StageId: stageId,
6378
- TaskId: task.id,
6379
- Type: task.type,
6380
- DisplayName: task.displayName,
6381
- Description: task.description,
6382
- Lane: laneIndex,
6383
- ...task.elementId ? { ElementId: task.elementId } : {},
6384
- ...options.taskTypeId ? { Enriched: true } : {}
6385
- }
6386
- });
6387
- });
6388
- tasks.command("add-connector", { hidden: true }).description("Add a connector activity or trigger task to a stage with full enrichment").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage to add the task to").requiredOption("-t, --type <type>", `Connector type: ${CONNECTOR_TYPES.join(", ")}`).requiredOption("--type-id <id>", "uiPathActivityTypeId UUID from the TypeCache").requiredOption("--connection-id <id>", "Connection UUID to bind to the task").option("-d, --display-name <displayName>", "Override display name for the task").option("--lane <lane>", "Parallel lane index (default: 0)", "0").option("--input-values <json>", [
6389
- "JSON object of input values keyed by input name.",
6390
- "Use `uip maestro case tasks describe` to discover available input names and fields.",
6391
- "",
6392
- "For --type activity: values are merged into enrichment input skeletons.",
6393
- "Keys match input names (body, pathParameters, queryParameters).",
6394
- `Example: '{"body":{"comment":"Hello"},"queryParameters":{"issueIdOrKey":"PROJ-123"}}'`,
6395
- "",
6396
- 'For --type trigger: values under "body" are treated as event parameters.',
6397
- "A filters.expression is auto-generated from them (e.g. (project == 'PROJ' && issuetype == 'Bug')).",
6398
- "They also populate queryParams and parameters in the trigger body.",
6399
- `Example: '{"body":{"project":"PROJ","issuetype":"Bug"}}'`
6400
- ].join(`
6401
- `)).examples(TASKS_ADD_CONNECTOR_EXAMPLES).trackedAction(processContext, async (file, stageId, options) => {
6402
- const connectorType = options.type.toLowerCase();
6403
- if (!CONNECTOR_TYPES.includes(connectorType)) {
6404
- OutputFormatter.error({
6405
- Result: RESULTS.Failure,
6406
- Message: "Error adding connector task",
6407
- Instructions: `Invalid connector type: "${options.type}". Valid types: ${CONNECTOR_TYPES.join(", ")}`
6408
- });
6409
- processContext.exit(1);
6410
- return;
6411
- }
6412
- if (options.inputValues) {
6413
- const [parseErr] = catchError2(() => JSON.parse(options.inputValues));
6414
- if (parseErr) {
6415
- OutputFormatter.error({
6416
- Result: RESULTS.Failure,
6417
- Message: "Error adding connector task",
6418
- Instructions: `Invalid --input-values JSON: ${parseErr.message}`
6419
- });
6420
- processContext.exit(1);
6421
- return;
6422
- }
6423
- }
6424
- const parsedInputValues = options.inputValues ? JSON.parse(options.inputValues) : undefined;
6425
- const isActivity = connectorType === "activity";
6426
- const [error, result] = await catchError2((async () => {
6427
- const ctx = await loadConnectorStage(file, stageId, options.lane);
6428
- let enrichment;
6429
- let taskType;
6430
- let serviceType;
6431
- if (isActivity) {
6432
- const { enrichConnectorActivity } = await loadConnectorEnrichment();
6433
- enrichment = await enrichConnectorActivity(options.typeId, options.connectionId);
6434
- if (parsedInputValues) {
6435
- await applyInputValues(enrichment.inputs, parsedInputValues);
6436
- }
6437
- taskType = "execute-connector-activity";
6438
- serviceType = "Intsvc.ActivityExecution";
6439
- } else {
6440
- const eventParams = parsedInputValues?.body ? Object.fromEntries(Object.entries(parsedInputValues.body).map(([k, v]) => [k, String(v)])) : undefined;
6441
- const { enrichConnectorTrigger } = await loadTriggerEnrichment();
6442
- enrichment = await enrichConnectorTrigger("wait-for", options.typeId, options.connectionId, eventParams);
6443
- taskType = "wait-for-connector";
6444
- serviceType = "Intsvc.WaitForEvent";
6445
- }
6446
- const task = buildConnectorTask({
6447
- stageId,
6448
- taskType,
6449
- serviceType,
6450
- displayName: options.displayName ?? enrichment.entry.displayName,
6451
- enrichment
6452
- });
6453
- await saveConnectorTask({
6454
- file,
6455
- ...ctx,
6456
- task,
6457
- enrichment
6458
- });
6459
- return { task, laneIndex: ctx.laneIndex, serviceType };
6460
- })());
6461
- if (error) {
6462
- OutputFormatter.error({
6463
- Result: RESULTS.Failure,
6464
- Message: "Error adding connector task",
6465
- Instructions: error.message
6466
- });
6467
- processContext.exit(1);
6468
- return;
6469
- }
6470
- OutputFormatter.success({
6471
- Result: RESULTS.Success,
6472
- Code: "ConnectorTaskAdded",
6473
- Data: {
6474
- File: file,
6475
- StageId: stageId,
6476
- TaskId: result.task.id,
6477
- ElementId: result.task.elementId,
6478
- Type: result.task.type,
6479
- DisplayName: result.task.displayName,
6480
- Lane: result.laneIndex,
6481
- ServiceType: result.serviceType
6482
- }
6483
- });
6484
- });
6485
- tasks.command("update", { hidden: true }).description("Update an existing task within a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage containing the task").argument("<task-id>", "ID of the task to update").option("-d, --display-name <displayName>", "New display name for the task").option("-n, --name <name>", "New process or workflow name").option("--folder-path <folderPath>", "New folder path for the process or workflow").option("--should-run-only-once", "Whether the task should run only once").option("--description <description>", "New description for the task").option("--is-required", "Whether the task is required").examples(TASKS_EDIT_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId, options) => {
6486
- if (Object.values(options).every((v) => v === undefined)) {
6487
- OutputFormatter.error({
6488
- Result: RESULTS.Failure,
6489
- Message: "Error editing task",
6490
- Instructions: "No fields to update. Provide at least one of: --display-name, --name, --folder-path, --should-run-only-once, --is-required, --description"
6491
- });
6492
- processContext.exit(1);
6493
- return;
6494
- }
6495
- const [readError, schema] = await catchError2(readSchema(file));
6496
- if (readError) {
6497
- OutputFormatter.error({
6498
- Result: RESULTS.Failure,
6499
- Message: "Error editing task",
6500
- Instructions: readError.message
6501
- });
6502
- processContext.exit(1);
6503
- return;
6504
- }
6505
- const [findStageError, stageNode] = catchError2(() => requireStageNode(schema, stageId));
6506
- if (findStageError) {
6507
- OutputFormatter.error({
6508
- Result: RESULTS.Failure,
6509
- Message: "Error editing task",
6510
- Instructions: findStageError.message
6511
- });
6512
- processContext.exit(1);
6513
- return;
6514
- }
6515
- const [findTaskError, found] = catchError2(() => requireTask(stageNode.data.tasks ?? [], taskId, stageId));
6516
- if (findTaskError) {
6517
- OutputFormatter.error({
6518
- Result: RESULTS.Failure,
6519
- Message: "Error editing task",
6520
- Instructions: findTaskError.message
6521
- });
6522
- processContext.exit(1);
6523
- return;
6524
- }
6525
- const { task } = found;
6526
- if (options.displayName !== undefined) {
6527
- task.displayName = options.displayName;
6528
- }
6529
- if (options.shouldRunOnlyOnce !== undefined) {
6530
- task.shouldRunOnlyOnce = options.shouldRunOnlyOnce;
6531
- }
6532
- if (options.isRequired !== undefined) {
6533
- task.isRequired = options.isRequired;
6534
- }
6535
- if (options.description !== undefined) {
6536
- task.description = options.description;
6537
- }
6538
- if (task.type !== "wait-for-timer") {
6539
- if (!task.data && (options.name !== undefined || options.folderPath !== undefined)) {
6540
- OutputFormatter.error({
6541
- Result: RESULTS.Failure,
6542
- Message: "Task has no data block; --name and --folder-path cannot be applied",
6543
- Instructions: "Verify the task definition in the schema file."
6544
- });
6545
- processContext.exit(1);
6546
- return;
6547
- }
6548
- if (task.data) {
6549
- if (options.name !== undefined) {
6550
- task.data.name = options.name;
6551
- }
6552
- if (options.folderPath !== undefined) {
6553
- task.data.folderPath = options.folderPath;
6554
- }
6555
- }
6556
- }
6557
- const [writeError] = await catchError2(writeSchema(file, schema));
6558
- if (writeError) {
6559
- OutputFormatter.error({
6560
- Result: RESULTS.Failure,
6561
- Message: "Error editing task",
6562
- Instructions: writeError.message
6563
- });
6564
- processContext.exit(1);
6565
- return;
6566
- }
6567
- OutputFormatter.success({
6568
- Result: RESULTS.Success,
6569
- Code: "TaskUpdated",
6570
- Data: {
6571
- File: file,
6572
- StageId: stageId,
6573
- TaskId: taskId,
6574
- Type: task.type,
6575
- DisplayName: task.displayName,
6576
- Description: task.description
6577
- }
6578
- });
6579
- });
3510
+ }
3511
+ var VERBATIM_TASK_IO_FIELDS = ["inputs", "outputs", "enrichment"];
3512
+ var registerTasksCommand = (program) => {
3513
+ const tasks = program.command("tasks").description("Manage tasks within a stage in a case management definition JSON file");
3514
+ tasks.command("add", { hidden: true });
3515
+ tasks.command("add-connector", { hidden: true });
3516
+ tasks.command("update", { hidden: true });
6580
3517
  tasks.command("get").description("Print a single task from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage containing the task").argument("<task-id>", "ID of the task to retrieve").examples(TASKS_GET_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId) => {
6581
3518
  const [readError, schema] = await catchError2(readSchema(file));
6582
3519
  if (readError) {
@@ -6620,67 +3557,7 @@ var registerTasksCommand = (program) => {
6620
3557
  }
6621
3558
  });
6622
3559
  });
6623
- tasks.command("remove", { hidden: true }).description("Remove a task from a stage").argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage containing the task").argument("<task-id>", "ID of the task to remove").examples(TASKS_REMOVE_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId) => {
6624
- const [readError, schema] = await catchError2(readSchema(file));
6625
- if (readError) {
6626
- OutputFormatter.error({
6627
- Result: RESULTS.Failure,
6628
- Message: "Error removing task",
6629
- Instructions: readError.message
6630
- });
6631
- processContext.exit(1);
6632
- return;
6633
- }
6634
- const [findStageError, stageNode] = catchError2(() => requireStageNode(schema, stageId));
6635
- if (findStageError) {
6636
- OutputFormatter.error({
6637
- Result: RESULTS.Failure,
6638
- Message: "Error removing task",
6639
- Instructions: findStageError.message
6640
- });
6641
- processContext.exit(1);
6642
- return;
6643
- }
6644
- if (!stageNode.data.tasks) {
6645
- stageNode.data.tasks = [];
6646
- }
6647
- const tasksList = stageNode.data.tasks;
6648
- const [findTaskError, found] = catchError2(() => requireTask(tasksList, taskId, stageId));
6649
- if (findTaskError) {
6650
- OutputFormatter.error({
6651
- Result: RESULTS.Failure,
6652
- Message: "Error removing task",
6653
- Instructions: findTaskError.message
6654
- });
6655
- processContext.exit(1);
6656
- return;
6657
- }
6658
- const { lane, index } = found;
6659
- tasksList[lane].splice(index, 1);
6660
- while (tasksList.length > 0 && tasksList[tasksList.length - 1].length === 0) {
6661
- tasksList.pop();
6662
- }
6663
- const [writeError] = await catchError2(writeSchema(file, schema));
6664
- if (writeError) {
6665
- OutputFormatter.error({
6666
- Result: RESULTS.Failure,
6667
- Message: "Error removing task",
6668
- Instructions: writeError.message
6669
- });
6670
- processContext.exit(1);
6671
- return;
6672
- }
6673
- OutputFormatter.success({
6674
- Result: RESULTS.Success,
6675
- Code: "TaskRemoved",
6676
- Data: {
6677
- File: file,
6678
- StageId: stageId,
6679
- TaskId: taskId,
6680
- Lane: lane
6681
- }
6682
- });
6683
- });
3560
+ tasks.command("remove", { hidden: true });
6684
3561
  tasks.command("enrich").description(`Enrich a task with input/output schemas from the API. ${OUTPUT_CASING_HINT}`).requiredOption("--type <type>", `Task type: ${ENRICHABLE_TYPES.join(", ")}`).requiredOption("--id <id>", "Unique ID of the task (entityKey or action-app id)").option("--element-id <elementId>", "Element ID for variable binding").examples(TASKS_ENRICH_EXAMPLES).trackedAction(processContext, async (options) => {
6685
3562
  const normalizedType = options.type.toLowerCase();
6686
3563
  if (!ENRICHABLE_TYPES.includes(normalizedType)) {
@@ -6728,369 +3605,11 @@ var registerTasksCommand = (program) => {
6728
3605
  };
6729
3606
 
6730
3607
  // src/commands/triggers.ts
6731
- var TRIGGERS_ADD_MANUAL_EXAMPLES = [
6732
- {
6733
- Description: "Add a manual trigger to a case definition",
6734
- Command: 'uip maestro case triggers add-manual case.json --display-name "Start"',
6735
- Output: {
6736
- Code: "TriggerAdded",
6737
- Data: {
6738
- File: "case.json",
6739
- TriggerId: "trigger_a1b2c3d4",
6740
- Type: "manual",
6741
- DisplayName: "Start"
6742
- }
6743
- }
6744
- }
6745
- ];
6746
- var TRIGGERS_ADD_TIMER_EXAMPLES = [
6747
- {
6748
- Description: "Add a timer trigger that fires every hour",
6749
- Command: "uip maestro case triggers add-timer case.json --every 1h",
6750
- Output: {
6751
- Code: "TriggerAdded",
6752
- Data: {
6753
- File: "case.json",
6754
- TriggerId: "trigger_a1b2c3d4",
6755
- Type: "timer",
6756
- DisplayName: "Trigger 1",
6757
- TimeCycle: "R/PT1H"
6758
- }
6759
- }
6760
- }
6761
- ];
6762
- var TRIGGERS_ADD_EVENT_EXAMPLES = [
6763
- {
6764
- Description: "Add a connector event trigger",
6765
- Command: "uip maestro case triggers add-event case.json --type-id a1b2c3d4-0000-0000-0000-000000000001 --connection-id b2c3d4e5-0000-0000-0000-000000000001",
6766
- Output: {
6767
- Code: "TriggerAdded",
6768
- Data: {
6769
- File: "case.json",
6770
- TriggerId: "trigger_a1b2c3d4",
6771
- Type: "event",
6772
- DisplayName: "Trigger 1"
6773
- }
6774
- }
6775
- }
6776
- ];
6777
- var TRIGGER_X = -100;
6778
- var TRIGGER_START_Y = 200;
6779
- var TRIGGER_Y_STEP = 140;
6780
- var TRIGGER_SIZE = 96;
6781
- var TIME_UNITS = {
6782
- s: "S",
6783
- m: "M",
6784
- h: "H"
6785
- };
6786
- var DATE_UNITS = {
6787
- d: "D",
6788
- w: "W",
6789
- mo: "M"
6790
- };
6791
- function parseDuration(value) {
6792
- if (/^P(\d+[YMWD])+(T(\d+[HMS])+)?$|^PT(\d+[HMS])+$/.test(value)) {
6793
- return value;
6794
- }
6795
- const match = value.match(/^(\d+)(mo|s|m|h|d|w)$/i);
6796
- if (!match) {
6797
- throw new Error(`Invalid duration: "${value}". Use a number with unit (10s, 5m, 1h, 2d, 1w, 3mo) or ISO 8601 (PT10S, P1D).`);
6798
- }
6799
- const suffix = match[2].toLowerCase();
6800
- const timeUnit = TIME_UNITS[suffix];
6801
- if (timeUnit) {
6802
- return `PT${match[1]}${timeUnit}`;
6803
- }
6804
- const dateUnit = DATE_UNITS[suffix];
6805
- return `P${match[1]}${dateUnit}`;
6806
- }
6807
- function buildTimeCycle(options) {
6808
- const duration = parseDuration(options.every);
6809
- if (options.repeat !== undefined && !/^\d+$/.test(options.repeat)) {
6810
- throw new Error(`Invalid --repeat value: "${options.repeat}". Must be a positive integer.`);
6811
- }
6812
- const repetition = options.repeat !== undefined ? `R${options.repeat}` : "R";
6813
- if (options.at) {
6814
- return `${repetition}/${options.at}/${duration}`;
6815
- }
6816
- return `${repetition}/${duration}`;
6817
- }
6818
- function computeTriggerPosition(existingTriggers) {
6819
- const ys = existingTriggers.flatMap((t) => t.position ? [t.position.y] : []);
6820
- if (ys.length === 0) {
6821
- return { x: TRIGGER_X, y: TRIGGER_START_Y };
6822
- }
6823
- return { x: TRIGGER_X, y: Math.max(...ys) + TRIGGER_Y_STEP };
6824
- }
6825
- function parsePosition2(value) {
6826
- const parts = value.split(",");
6827
- if (parts.length !== 2) {
6828
- throw new Error(`Invalid position: "${value}". Use "x,y" format (e.g. -100,200).`);
6829
- }
6830
- const x = Number(parts[0].trim());
6831
- const y = Number(parts[1].trim());
6832
- if (Number.isNaN(x) || Number.isNaN(y)) {
6833
- throw new Error(`Invalid position: "${value}". Both x and y must be numbers.`);
6834
- }
6835
- return { x, y };
6836
- }
6837
- function buildBaseTriggerNode(schema, displayName, explicitPosition, description) {
6838
- const existingTriggers = findTriggerNodes(schema);
6839
- const resolvedName = displayName ?? `Trigger ${existingTriggers.length + 1}`;
6840
- const triggerId = prefixedId("trigger_");
6841
- const position = explicitPosition ? parsePosition2(explicitPosition) : computeTriggerPosition(existingTriggers);
6842
- const node = {
6843
- id: triggerId,
6844
- type: "case-management:Trigger",
6845
- position,
6846
- style: { width: TRIGGER_SIZE, height: TRIGGER_SIZE },
6847
- measured: { width: TRIGGER_SIZE, height: TRIGGER_SIZE },
6848
- data: {
6849
- parentElement: { id: "root", type: "case-management:root" },
6850
- label: resolvedName,
6851
- ...description !== undefined && { description }
6852
- }
6853
- };
6854
- return { node, triggerId, resolvedName };
6855
- }
6856
- async function readAndBuildTrigger(file, displayName, position, description) {
6857
- const [readError, schema] = await catchError2(readSchema(file));
6858
- if (readError) {
6859
- OutputFormatter.error({
6860
- Result: RESULTS.Failure,
6861
- Message: "Error adding trigger",
6862
- Instructions: readError.message
6863
- });
6864
- processContext.exit(1);
6865
- return { error: true };
6866
- }
6867
- const [posError, buildResult] = catchError2(() => buildBaseTriggerNode(schema, displayName, position, description));
6868
- if (posError) {
6869
- OutputFormatter.error({
6870
- Result: RESULTS.Failure,
6871
- Message: "Error adding trigger",
6872
- Instructions: posError.message
6873
- });
6874
- processContext.exit(1);
6875
- return { error: true };
6876
- }
6877
- const { node, triggerId, resolvedName } = buildResult;
6878
- return { error: false, schema, node, triggerId, resolvedName };
6879
- }
6880
- async function appendEntryPoint(file, triggerId, displayName) {
6881
- const fs = getFileSystem2();
6882
- const dir = fs.path.dirname(fs.path.resolve(file));
6883
- const entryPointsPath = fs.path.join(dir, "entry-points.json");
6884
- const content = await fs.readFile(entryPointsPath, "utf-8");
6885
- if (content === null) {
6886
- throw new Error(`Failed to read entry-points.json in ${dir}.`);
6887
- }
6888
- const entryPointsJson = JSON.parse(content);
6889
- const bpmnFile = `${fs.path.basename(file)}.bpmn`;
6890
- entryPointsJson.entryPoints.push({
6891
- filePath: `/content/${bpmnFile}#${triggerId}`,
6892
- uniqueId: crypto.randomUUID(),
6893
- type: "CaseManagement",
6894
- input: { type: "object", properties: {} },
6895
- output: { type: "object", properties: {} },
6896
- displayName
6897
- });
6898
- await fs.writeFile(entryPointsPath, JSON.stringify(entryPointsJson, null, 4));
6899
- }
6900
- async function saveTrigger(file, schema, node) {
6901
- const fs = getFileSystem2();
6902
- const dir = fs.path.dirname(fs.path.resolve(file));
6903
- const entryPointsPath = fs.path.join(dir, "entry-points.json");
6904
- if (!await fs.exists(entryPointsPath)) {
6905
- OutputFormatter.error({
6906
- Result: RESULTS.Failure,
6907
- Message: "Error adding trigger",
6908
- Instructions: `entry-points.json not found in ${dir}. Run 'uip maestro case init' to create a project first.`
6909
- });
6910
- processContext.exit(1);
6911
- return false;
6912
- }
6913
- schema.nodes.push(node);
6914
- const [writeError] = await catchError2(writeSchema(file, schema));
6915
- if (writeError) {
6916
- OutputFormatter.error({
6917
- Result: RESULTS.Failure,
6918
- Message: "Error adding trigger",
6919
- Instructions: writeError.message
6920
- });
6921
- processContext.exit(1);
6922
- return false;
6923
- }
6924
- const [entryPointError] = await catchError2(appendEntryPoint(file, node.id, node.data.label ?? node.id));
6925
- if (entryPointError) {
6926
- OutputFormatter.error({
6927
- Result: RESULTS.Failure,
6928
- Message: "Error updating entry-points.json",
6929
- Instructions: entryPointError.message
6930
- });
6931
- processContext.exit(1);
6932
- return false;
6933
- }
6934
- return true;
6935
- }
6936
3608
  var registerTriggersCommand = (program) => {
6937
3609
  const triggers = program.command("triggers", { hidden: true }).description("Manage triggers in a case management definition JSON file");
6938
- triggers.command("add-manual", { hidden: true }).description("Add a manual trigger to a case management definition").argument("<file>", "Path to the case management JSON file").option("-d, --display-name <name>", "Display name for the trigger (auto: Trigger N)").option("--position <x,y>", "Explicit position (default: auto-stacked left of stages)").option("--description <description>", "Description of the trigger").examples(TRIGGERS_ADD_MANUAL_EXAMPLES).trackedAction(processContext, async (file, options) => {
6939
- const result = await readAndBuildTrigger(file, options.displayName, options.position, options.description);
6940
- if (result.error)
6941
- return;
6942
- const ok = await saveTrigger(file, result.schema, result.node);
6943
- if (!ok)
6944
- return;
6945
- OutputFormatter.success({
6946
- Result: RESULTS.Success,
6947
- Code: "TriggerAdded",
6948
- Data: {
6949
- File: file,
6950
- TriggerId: result.triggerId,
6951
- Type: "manual",
6952
- DisplayName: result.resolvedName
6953
- }
6954
- });
6955
- });
6956
- triggers.command("add-timer", { hidden: true }).description("Add a timer trigger to a case management definition").argument("<file>", "Path to the case management JSON file").option("--every <duration>", "Repeat interval: 10s, 5m, 1h, 2d, 1w, 3mo or ISO 8601 like PT10S (required unless --time-cycle is set)").option("--at <datetime>", "Start time as ISO 8601 datetime, e.g. 2026-04-26T10:40:00.000-07:00").option("--repeat <count>", "Number of repetitions (omit for infinite)").option("--time-cycle <expr>", "Raw ISO 8601 repeating interval (overrides --every/--at/--repeat)").option("-d, --display-name <name>", "Display name for the trigger (auto: Trigger N)").option("--position <x,y>", "Explicit position (default: auto-stacked left of stages)").option("--description <description>", "Description of the trigger").examples(TRIGGERS_ADD_TIMER_EXAMPLES).trackedAction(processContext, async (file, options) => {
6957
- let timeCycle;
6958
- if (!options.timeCycle && !options.every) {
6959
- OutputFormatter.error({
6960
- Result: RESULTS.Failure,
6961
- Message: "Error adding trigger",
6962
- Instructions: "Either --every or --time-cycle is required."
6963
- });
6964
- processContext.exit(1);
6965
- return;
6966
- }
6967
- if (options.timeCycle) {
6968
- timeCycle = options.timeCycle;
6969
- } else {
6970
- const [parseError, parsed] = catchError2(() => buildTimeCycle({
6971
- every: options.every,
6972
- at: options.at,
6973
- repeat: options.repeat
6974
- }));
6975
- if (parseError) {
6976
- OutputFormatter.error({
6977
- Result: RESULTS.Failure,
6978
- Message: "Error adding trigger",
6979
- Instructions: parseError.message
6980
- });
6981
- processContext.exit(1);
6982
- return;
6983
- }
6984
- timeCycle = parsed;
6985
- }
6986
- const result = await readAndBuildTrigger(file, options.displayName, options.position, options.description);
6987
- if (result.error)
6988
- return;
6989
- result.node.data.uipath = {
6990
- serviceType: "Intsvc.TimerTrigger",
6991
- timerType: "timeCycle",
6992
- timeCycle
6993
- };
6994
- const ok = await saveTrigger(file, result.schema, result.node);
6995
- if (!ok)
6996
- return;
6997
- OutputFormatter.success({
6998
- Result: RESULTS.Success,
6999
- Code: "TriggerAdded",
7000
- Data: {
7001
- File: file,
7002
- TriggerId: result.triggerId,
7003
- Type: "timer",
7004
- DisplayName: result.resolvedName,
7005
- TimeCycle: timeCycle
7006
- }
7007
- });
7008
- });
7009
- triggers.command("add-event", { hidden: true }).description("Add a connector event trigger to a case management definition").argument("<file>", "Path to the case management JSON file").requiredOption("--type-id <id>", "uiPathActivityTypeId from TypeCache triggers").requiredOption("--connection-id <id>", "Connection UUID to bind to the trigger").option("--event-params <json>", "JSON object of event parameter key/value pairs. A filters.expression is auto-generated from them.").option("-d, --display-name <name>", "Display name for the trigger (auto: Trigger N)").option("--position <x,y>", "Explicit position (default: auto-stacked left of stages)").option("--description <description>", "Description of the trigger").examples(TRIGGERS_ADD_EVENT_EXAMPLES).trackedAction(processContext, async (file, options) => {
7010
- let parsedEventParams;
7011
- if (options.eventParams) {
7012
- const [parseErr, parsed] = catchError2(() => JSON.parse(options.eventParams));
7013
- if (parseErr) {
7014
- OutputFormatter.error({
7015
- Result: RESULTS.Failure,
7016
- Message: "Error adding trigger",
7017
- Instructions: `Invalid --event-params JSON: ${parseErr.message}`
7018
- });
7019
- processContext.exit(1);
7020
- return;
7021
- }
7022
- parsedEventParams = parsed;
7023
- }
7024
- const result = await readAndBuildTrigger(file, options.displayName, options.position, options.description);
7025
- if (result.error)
7026
- return;
7027
- const { enrichConnectorTrigger } = await import("./trigger-enrichment-service-vg26e453.js");
7028
- const [enrichError, enrichment] = await catchError2(enrichConnectorTrigger("start", options.typeId, options.connectionId, parsedEventParams));
7029
- if (enrichError) {
7030
- OutputFormatter.error({
7031
- Result: RESULTS.Failure,
7032
- Message: "Error adding trigger",
7033
- Instructions: enrichError.message
7034
- });
7035
- processContext.exit(1);
7036
- return;
7037
- }
7038
- const inputs = enrichment.inputs.map(({ elementId: _, ...rest }) => rest);
7039
- const outputs = enrichment.outputs.map((output) => ({
7040
- name: output.name,
7041
- displayName: output.displayName,
7042
- type: output.type,
7043
- source: output.source,
7044
- _jsonSchema: null,
7045
- var: output.name === "Error" ? "error" : output.var,
7046
- value: output.name === "Error" ? "error" : output.value
7047
- }));
7048
- const idRemap = new Map;
7049
- for (const binding of enrichment.bindings) {
7050
- const used = findOrPushBinding(result.schema, binding);
7051
- if (used.id !== binding.id) {
7052
- idRemap.set(binding.id, used.id);
7053
- }
7054
- }
7055
- if (idRemap.size > 0) {
7056
- remapBindingRefs(enrichment.context, idRemap);
7057
- }
7058
- result.node.data.uipath = {
7059
- serviceType: "Intsvc.EventTrigger",
7060
- context: enrichment.context,
7061
- inputs,
7062
- outputs,
7063
- bindings: []
7064
- };
7065
- ensureRootBindings(result.schema);
7066
- result.schema.variables ??= {};
7067
- const variables = result.schema.variables;
7068
- variables.inputOutputs ??= [];
7069
- for (const output of enrichment.outputs) {
7070
- variables.inputOutputs.push({
7071
- id: output.var ?? output.value ?? output.name,
7072
- name: output.name,
7073
- type: output.type,
7074
- elementId: result.triggerId,
7075
- ...output.body ? {
7076
- body: output.body
7077
- } : {}
7078
- });
7079
- }
7080
- const ok = await saveTrigger(file, result.schema, result.node);
7081
- if (!ok)
7082
- return;
7083
- OutputFormatter.success({
7084
- Result: RESULTS.Success,
7085
- Code: "TriggerAdded",
7086
- Data: {
7087
- File: file,
7088
- TriggerId: result.triggerId,
7089
- Type: "event",
7090
- DisplayName: result.resolvedName
7091
- }
7092
- });
7093
- });
3610
+ triggers.command("add-manual", { hidden: true });
3611
+ triggers.command("add-timer", { hidden: true });
3612
+ triggers.command("add-event", { hidden: true });
7094
3613
  };
7095
3614
 
7096
3615
  // src/commands/validate.ts
@@ -7161,7 +3680,7 @@ var suppressedAudit = async (file, shown) => {
7161
3680
  const [lookupError, sdd] = await catchError2(Promise.resolve(findAdjacentSdd(file)));
7162
3681
  if (lookupError || sdd === undefined)
7163
3682
  return;
7164
- const { CaseValidateService } = await import("./case-validate-service-jnfqzm01.js");
3683
+ const { CaseValidateService } = await import("./case-validate-service-5dhf4qwk.js");
7165
3684
  const [auditError, audited] = await catchError2(new CaseValidateService().validateFileUsingSDK(file, {
7166
3685
  profile: "strict",
7167
3686
  sddPath: sdd
@@ -7177,7 +3696,7 @@ var suppressedAudit = async (file, shown) => {
7177
3696
  };
7178
3697
  };
7179
3698
  var executeCaseValidate = async (file, options = {}) => {
7180
- const { CaseValidateService } = await import("./case-validate-service-jnfqzm01.js");
3699
+ const { CaseValidateService } = await import("./case-validate-service-5dhf4qwk.js");
7181
3700
  const service = new CaseValidateService;
7182
3701
  const [error, result] = await catchError2(service.validateFileUsingSDK(file, {
7183
3702
  profile: resolveProfile(options),
@@ -7250,229 +3769,9 @@ var registerValidateCommand = (program) => {
7250
3769
  };
7251
3770
 
7252
3771
  // src/commands/var.ts
7253
- var VAR_BIND_EXAMPLES = [
7254
- {
7255
- Description: "Bind a task input to a literal value",
7256
- Command: 'uip maestro case var bind case.json Stage_1 ta1b2c3d body.body.body --value "Hello"',
7257
- Output: {
7258
- Code: "VariableBound",
7259
- Data: {
7260
- File: "case.json",
7261
- StageId: "Stage_1",
7262
- TaskId: "ta1b2c3d",
7263
- FieldPath: "body.body.body",
7264
- Value: "Hello"
7265
- }
7266
- }
7267
- }
7268
- ];
7269
- var ALLOWED_EXPRESSION_PREFIXES = [
7270
- "=vars.",
7271
- "=bindings.",
7272
- "=js:",
7273
- "=metadata.",
7274
- "=datafabric.",
7275
- "=orchestrator.JobAttachments",
7276
- "=response",
7277
- "=result",
7278
- "=Error",
7279
- "=jsonString:"
7280
- ];
7281
- function isValidExpressionValue(value) {
7282
- if (!value.startsWith("=")) {
7283
- return true;
7284
- }
7285
- return ALLOWED_EXPRESSION_PREFIXES.some((prefix) => value.startsWith(prefix));
7286
- }
7287
- var FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
7288
- function setNestedField(obj, path, value) {
7289
- for (const key of path) {
7290
- if (FORBIDDEN_KEYS.has(key)) {
7291
- throw new Error(`Path segment "${key}" is not allowed`);
7292
- }
7293
- }
7294
- let node = obj;
7295
- for (const key of path.slice(0, -1)) {
7296
- if (typeof node[key] !== "object" || node[key] === null) {
7297
- if (node[key] !== undefined && node[key] !== null) {
7298
- throw new Error(`Path segment "${key}" points to a non-object value (${typeof node[key]}); cannot traverse into it`);
7299
- }
7300
- node[key] = {};
7301
- }
7302
- node = node[key];
7303
- }
7304
- node[path[path.length - 1]] = value;
7305
- }
7306
- function taskVariables(task, key) {
7307
- if (task.type === "wait-for-timer")
7308
- return;
7309
- return task.data?.[key];
7310
- }
7311
- function failBind(instructions) {
7312
- OutputFormatter.error({
7313
- Result: RESULTS.Failure,
7314
- Message: "Error binding variable",
7315
- Instructions: instructions
7316
- });
7317
- processContext.exit(1);
7318
- }
7319
- function validateBindOptions(options, fieldKeys) {
7320
- const hasSourceOptions = options.sourceStage !== undefined || options.sourceTask !== undefined || options.sourceOutput !== undefined;
7321
- const hasValue = options.value !== undefined;
7322
- if (hasSourceOptions && hasValue) {
7323
- return "Cannot specify both --value and --source-* options. Use one or the other.";
7324
- }
7325
- if (!hasSourceOptions && !hasValue) {
7326
- return "Must specify either --value or all three --source-stage, --source-task, --source-output options.";
7327
- }
7328
- if (hasSourceOptions && (options.sourceStage === undefined || options.sourceTask === undefined || options.sourceOutput === undefined)) {
7329
- return "All three --source-stage, --source-task, and --source-output must be provided together.";
7330
- }
7331
- if (hasSourceOptions && fieldKeys.length > 0) {
7332
- return "--source-* can only wire to input.value. Use a plain <input-name> (no dots) with --source-*.";
7333
- }
7334
- return;
7335
- }
7336
- function resolveBindValue(schema, options) {
7337
- if (options.value !== undefined) {
7338
- if (!isValidExpressionValue(options.value)) {
7339
- throw new Error(`Unrecognized expression prefix in value: "${options.value}". Supported prefixes: ${ALLOWED_EXPRESSION_PREFIXES.join(", ")}`);
7340
- }
7341
- return { resolvedValue: options.value, sourceData: {} };
7342
- }
7343
- const sourceStageId = options.sourceStage;
7344
- const sourceTaskId = options.sourceTask;
7345
- const sourceOutputName = options.sourceOutput;
7346
- const srcStageNode = requireStageNode(schema, sourceStageId);
7347
- const srcFound = requireTask(srcStageNode.data.tasks ?? [], sourceTaskId, sourceStageId);
7348
- const srcOutputs = taskVariables(srcFound.task, "outputs") ?? [];
7349
- const srcOutput = srcOutputs.find((io) => io.name === sourceOutputName);
7350
- if (!srcOutput) {
7351
- throw new Error(`Output not found with name: ${sourceOutputName} in task: ${sourceTaskId}`);
7352
- }
7353
- const varId = srcOutput.var ?? srcOutput.id;
7354
- if (!varId) {
7355
- throw new Error(`Source output "${sourceOutputName}" has no var or id field`);
7356
- }
7357
- return {
7358
- resolvedValue: `=vars.${varId}`,
7359
- sourceData: {
7360
- SourceStage: sourceStageId,
7361
- SourceTask: sourceTaskId,
7362
- SourceOutput: sourceOutputName
7363
- }
7364
- };
7365
- }
7366
3772
  var registerVarCommand = (program) => {
7367
3773
  const varCmd = program.command("var", { hidden: true }).description("Manage variable bindings in a case management definition");
7368
- varCmd.command("bind", { hidden: true }).description([
7369
- "Bind a task input field using dot-path notation.",
7370
- "",
7371
- "FIELD-PATH",
7372
- " <input-name>[.<prop>[.<key>...]]",
7373
- "",
7374
- " Each dot segment is a literal property lookup on the input object.",
7375
- " No dots → sets input.value directly",
7376
- " With dots → traverses the input object property by property",
7377
- "",
7378
- "ACTIVITY INPUTS (execute-connector-activity)",
7379
- " Activities have multiple independent inputs (body, queryParameters, pathParameters).",
7380
- " Use 'uip maestro case tasks describe --type connector-activity' to discover all inputs.",
7381
- " Hierarchy: <input-name>.body.<field>",
7382
- " body request body input object",
7383
- " └── body the body property on the input",
7384
- " └── <field> e.g. body (comment text), visibility.identifier",
7385
- " queryParameters query string input object",
7386
- " └── body the body property on the input",
7387
- " └── <field> e.g. issueIdOrKey, expand",
7388
- " pathParameters URL path input object",
7389
- " └── body the body property on the input",
7390
- " └── <field> e.g. id",
7391
- " Examples:",
7392
- " body.body.body comment text for Add Comment",
7393
- " body.body.visibility.identifier role restriction",
7394
- " queryParameters.body.issueIdOrKey Jira issue key (required)",
7395
- " pathParameters.body.id resource path ID",
7396
- "",
7397
- "TRIGGER INPUTS (wait-for-connector)",
7398
- " Single 'body' input with nested body.queryParams and body.filters.",
7399
- " Use 'uip maestro case tasks describe --type connector-trigger' to discover fields.",
7400
- " Hierarchy: body.body.queryParams.<field> | body.body.filters.expression",
7401
- " body the only input object",
7402
- " └── body the body property on the input",
7403
- " ├── queryParams event filter parameters (raw values)",
7404
- " │ └── <field> e.g. project, issuetype (connector-specific)",
7405
- " └── filters",
7406
- " └── expression JMESPath: equality clauses from queryParams && user filter",
7407
- " Examples:",
7408
- " body.body.queryParams.project Jira project key (required)",
7409
- " body.body.queryParams.issuetype issue type filter (required)",
7410
- " body.body.filters.expression e.g. (project == 'PROJ') && ((fields.priority=`High`))"
7411
- ].join(`
7412
- `)).argument("<file>", "Path to the case management JSON file").argument("<stage-id>", "ID of the stage containing the target task").argument("<task-id>", "ID of the target task").argument("<field-path>", "Dot-separated path: <input-name>[.<key1>[.<key2>...]]").option("--source-stage <sourceStageId>", "Source stage ID — wire another task's output to input.value (no body path)").option("--source-task <sourceTaskId>", "Source task ID (requires --source-stage and --source-output)").option("--source-output <sourceOutputName>", "Source output name (requires --source-stage and --source-task)").option("--value <value>", "Value to set — literals or expressions: =metadata.X, =js:X, =vars.X, etc.").examples(VAR_BIND_EXAMPLES).trackedAction(processContext, async (file, stageId, taskId, fieldPath, options) => {
7413
- const parts = fieldPath.split(".");
7414
- const inputName = parts[0];
7415
- const fieldKeys = parts.slice(1);
7416
- const validationError = validateBindOptions(options, fieldKeys);
7417
- if (validationError) {
7418
- failBind(validationError);
7419
- return;
7420
- }
7421
- const [readError, schema] = await catchError2(readSchema(file));
7422
- if (readError) {
7423
- failBind(readError.message);
7424
- return;
7425
- }
7426
- const [findStageError, stageNode] = catchError2(() => requireStageNode(schema, stageId));
7427
- if (findStageError) {
7428
- failBind(findStageError.message);
7429
- return;
7430
- }
7431
- const [findTaskError, found] = catchError2(() => requireTask(stageNode.data.tasks ?? [], taskId, stageId));
7432
- if (findTaskError) {
7433
- failBind(findTaskError.message);
7434
- return;
7435
- }
7436
- const { task } = found;
7437
- const inputs = taskVariables(task, "inputs");
7438
- const input = inputs?.find((io) => io.name === inputName);
7439
- if (!input) {
7440
- failBind(`Input "${inputName}" not found in task "${taskId}". Available: ${inputs?.map((io) => io.name).join(", ") ?? "none"}`);
7441
- return;
7442
- }
7443
- const [resolveError, resolved] = catchError2(() => resolveBindValue(schema, options));
7444
- if (resolveError) {
7445
- failBind(resolveError.message);
7446
- return;
7447
- }
7448
- const { resolvedValue, sourceData } = resolved;
7449
- if (fieldKeys.length === 0) {
7450
- input.value = resolvedValue;
7451
- } else {
7452
- const [nestedError] = catchError2(() => setNestedField(input, fieldKeys, resolvedValue));
7453
- if (nestedError) {
7454
- failBind(nestedError.message);
7455
- return;
7456
- }
7457
- }
7458
- const [writeError] = await catchError2(writeSchema(file, schema));
7459
- if (writeError) {
7460
- failBind(writeError.message);
7461
- return;
7462
- }
7463
- OutputFormatter.success({
7464
- Result: RESULTS.Success,
7465
- Code: "VariableBound",
7466
- Data: {
7467
- File: file,
7468
- StageId: stageId,
7469
- TaskId: taskId,
7470
- FieldPath: fieldPath,
7471
- Value: resolvedValue,
7472
- ...sourceData
7473
- }
7474
- });
7475
- });
3774
+ varCmd.command("bind", { hidden: true });
7476
3775
  };
7477
3776
 
7478
3777
  // src/utils/deprecated-case-authoring-mutators.ts
@@ -7612,4 +3911,4 @@ var registerCommands2 = async (program) => {
7612
3911
 
7613
3912
  export { metadata2, registerCommands2 };
7614
3913
 
7615
- //# debugId=31DC0F1C8C5BA11D64756E2164756E21
3914
+ //# debugId=05C50785C83FBE4E64756E2164756E21