@uipath/orchestrator-tool 1.207.0 → 1.208.0-preview.410

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.
@@ -1,11 +1,6 @@
1
1
  import {
2
- getFileSystem2
3
- } from "./tool-x8dsz8c6.js";
4
- import {
5
- CommandDimensions,
6
- ShipDimensions
7
- } from "./tool-y0b5ktbt.js";
8
- import {
2
+ InvalidArgumentError,
3
+ Option,
9
4
  projectIdentityProperties,
10
5
  catchError,
11
6
  RESULTS,
@@ -17,8 +12,6 @@ import {
17
12
  extractErrorMessage,
18
13
  extractErrorMessageSync,
19
14
  resolveAttachmentInputs,
20
- InvalidArgumentError,
21
- Option,
22
15
  isPreviewBuild,
23
16
  getOutputSink,
24
17
  logger,
@@ -31,17 +24,20 @@ import {
31
24
  requireConfirmation,
32
25
  DEFAULT_PAGE_SIZE,
33
26
  isGuid,
27
+ jsonFileOptionHelp,
28
+ readJsonOptionWithText,
34
29
  warnDeprecatedOptionAlias,
35
30
  addDeprecatedOptionAlias,
36
31
  createHiddenDeprecatedTenantOption,
32
+ parseFilterValue,
33
+ parsePositiveInteger,
34
+ parseNonNegativeInteger,
35
+ parseGuid,
36
+ parseIsoDate,
37
37
  pollUntil,
38
38
  reportFailure,
39
39
  trackShipSucceeded,
40
- findSessionKind,
41
- reportFailure2,
42
- reportNotFound
43
- } from "./tool-7p157r8x.js";
44
- import {
40
+ reportUsageError,
45
41
  AssetDtoValueTypeEnum2,
46
42
  JobDtoToJSONTyped2,
47
43
  PackageFeedDtoPurposeEnum2,
@@ -82,7 +78,10 @@ import {
82
78
  WebhooksApi2,
83
79
  AttachmentFileApi2,
84
80
  blobAccessRequest2,
81
+ findSessionKind,
82
+ assertFolderKey,
85
83
  createApiClient2,
84
+ getFolderAccessMode2,
86
85
  resolveFolder2,
87
86
  requireFolder2,
88
87
  uploadJobAttachment2,
@@ -96,8 +95,20 @@ import {
96
95
  ROI_TIME_UNITS2,
97
96
  ROI_VOLUME_PERIODS2,
98
97
  ROI_EMPLOYEE_COST_PERIODS2,
99
- RoiConfigurationApi2
100
- } from "./tool-hp40ahgc.js";
98
+ RoiConfigurationApi2,
99
+ reportFailure2,
100
+ reportNotFound,
101
+ parseFolderKey,
102
+ parseFolderPath,
103
+ parseFolderKeyOrPath
104
+ } from "./tool-d95qndpx.js";
105
+ import {
106
+ getFileSystem2
107
+ } from "./tool-afmw3cc4.js";
108
+ import {
109
+ CommandDimensions,
110
+ ShipDimensions
111
+ } from "./tool-hf26vzy2.js";
101
112
  import {
102
113
  strFromU8,
103
114
  unzipSync
@@ -107,7 +118,7 @@ var package_default = {
107
118
  name: "@uipath/orchestrator-tool",
108
119
  author: "UiPath",
109
120
  license: "SEE LICENSE IN LICENSE.txt",
110
- version: "1.207.0",
121
+ version: "1.208.0-preview.410",
111
122
  description: "Manage Orchestrator folders, jobs, processes, and releases.",
112
123
  private: false,
113
124
  repository: {
@@ -361,6 +372,45 @@ async function resolveEntityOrFail(ApiClass, clientOptions, resolverFn, key, err
361
372
  return { api, entity };
362
373
  }
363
374
 
375
+ // src/utils/folder-scope.ts
376
+ function refuseListFolderScope(scope) {
377
+ if (refuseAllFoldersConflict(scope))
378
+ return true;
379
+ if (scope.allFolders !== true && scope.folderPath === undefined && scope.folderKey === undefined) {
380
+ reportUsageError("Missing required option --folder-path, --folder-key or --all-folders.", "Provide --folder-path <path> or --folder-key <key> to list one folder, or --all-folders to list every folder. Run 'uip or folders list' to find folder paths.");
381
+ return true;
382
+ }
383
+ return false;
384
+ }
385
+ function refuseAllFoldersConflict(scope) {
386
+ if (scope.allFolders === true && (scope.folderPath !== undefined || scope.folderKey !== undefined)) {
387
+ reportUsageError("--all-folders cannot be used with --folder-path or --folder-key.", "Use --all-folders by itself, or provide a single folder selector with --folder-path or --folder-key.");
388
+ return true;
389
+ }
390
+ return false;
391
+ }
392
+ function refuseBothFolderSelectors(scope) {
393
+ if (scope.folderPath !== undefined && scope.folderKey !== undefined) {
394
+ reportUsageError("Provide either --folder-path or --folder-key, not both.", "Name the folder once: --folder-path <path> or --folder-key <key>.");
395
+ return true;
396
+ }
397
+ return false;
398
+ }
399
+ async function assertEntityInFolder(kind, key, entityFolderIds, scope) {
400
+ if (scope.folderPath !== undefined && scope.folderKey !== undefined) {
401
+ throw Object.assign(new Error("Provide either --folder-path or --folder-key, not both. Name the folder once: --folder-path <path> or --folder-key <key>."), { errorCode: "invalid_argument", retry: "RetryWillNotFix" });
402
+ }
403
+ if (scope.folderPath === undefined && scope.folderKey === undefined) {
404
+ return;
405
+ }
406
+ const folder = await resolveFolder2({ folderPath: scope.folderPath, folderKey: scope.folderKey }, { tenant: scope.tenant });
407
+ if (folder !== undefined && entityFolderIds.includes(folder.id)) {
408
+ return folder.id;
409
+ }
410
+ const where = folder?.path ?? scope.folderPath ?? scope.folderKey;
411
+ throw Object.assign(new Error(`${kind} '${key}' was not found in folder '${where}'. ` + `Drop the folder option to look it up tenant-wide, or use '${kind.toLowerCase()}s list --folder-path <path>' to find it.`), { errorCode: "not_found", retry: "RetryWillNotFix" });
412
+ }
413
+
364
414
  // src/commands/assets.ts
365
415
  async function resolveCredentialStore(tenant, credentialStoreKey) {
366
416
  const [apiError, storesApi] = await catchError(createApiClient2(CredentialStoresApi2, { tenant }));
@@ -569,26 +619,9 @@ var ASSETS_UNSHARE_EXAMPLES = [
569
619
  ];
570
620
  var registerAssetsCommand = (program) => {
571
621
  const assets = program.command("assets").description("Manage Orchestrator assets (named configuration values used by automations at runtime: text, integer, boolean, credentials, secrets). " + "List and create require a folder; get, update, and delete resolve cross-folder by key.");
572
- assets.command("list").description("List assets in a folder, or across all accessible folders with --all-folders. " + "Returns name, key (GUID), type, value (secrets excluded), and scope. Use --type and --name to filter.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-folders", "List assets across all accessible folders").option("-n, --name <name>", "Filter by asset name (contains match)").option("--type <type>", "Filter by asset type (Text, Bool, Integer, Credential, Secret). Case-insensitive.").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(ASSETS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
573
- const hasFolderSelector = options.folderPath !== undefined || options.folderKey !== undefined;
574
- if (options.allFolders && hasFolderSelector) {
575
- OutputFormatter.error({
576
- Result: RESULTS.Failure,
577
- Message: "Error listing assets",
578
- Instructions: "Use --all-folders by itself, or provide a single folder selector with --folder-path or --folder-key."
579
- });
580
- processContext.exit(1);
581
- return;
582
- }
583
- if (!options.allFolders && !hasFolderSelector) {
584
- OutputFormatter.error({
585
- Result: RESULTS.Failure,
586
- Message: "Error listing assets",
587
- Instructions: "Provide --folder-path, --folder-key, or --all-folders."
588
- });
589
- processContext.exit(1);
622
+ assets.command("list").description("List assets in a folder, or across all accessible folders with --all-folders. " + "Returns name, key (GUID), type, value (secrets excluded), and scope. Use --type and --name to filter.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-folders", "List assets across all accessible folders").option("-n, --name <name>", "Filter by asset name (contains match)", parseFilterValue).option("--type <type>", "Filter by asset type (Text, Bool, Integer, Credential, Secret). Case-insensitive.", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(ASSETS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
623
+ if (refuseListFolderScope(options))
590
624
  return;
591
- }
592
625
  const [apiError, api] = await catchError(options.allFolders ? createApiClient2(AssetsApi2, { tenant: options.tenant }) : createApiClient2(AssetsApi2, {
593
626
  tenant: options.tenant,
594
627
  folderPath: options.folderPath,
@@ -660,7 +693,7 @@ var registerAssetsCommand = (program) => {
660
693
  Data: options.allFields ? asset : formatAssetDetail(asset)
661
694
  });
662
695
  });
663
- assets.command("create").description("Create a new asset in a folder. Pass --folder-path or --folder-key unless a folder is already selected for the session. Type defaults to Text. Bool values must be 'true' or 'false'; Integer a whole number; Credential and WindowsCredential use 'username:password' format. Scope defaults to Global.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").argument("<name>", "Asset name").argument("<value>", "Asset value").option("--type <type>", "Asset type (Text, Bool, Integer, Credential, Secret). Defaults to Text.", "Text").hook("preAction", (thisCommand) => {
696
+ assets.command("create").description("Create a new asset in a folder. Pass --folder-path or --folder-key unless a folder is already selected for the session. Type defaults to Text. Bool values must be 'true' or 'false'; Integer a whole number; Credential and WindowsCredential use 'username:password' format. Scope defaults to Global.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).argument("<name>", "Asset name").argument("<value>", "Asset value").option("--type <type>", "Asset type (Text, Bool, Integer, Credential, Secret). Defaults to Text.", "Text").hook("preAction", (thisCommand) => {
664
697
  const validTypes = {
665
698
  text: "Text",
666
699
  bool: "Bool",
@@ -818,7 +851,7 @@ var registerAssetsCommand = (program) => {
818
851
  }
819
852
  });
820
853
  });
821
- assets.command("update").description("Update an existing asset. Resolves cross-folder by key; pass --folder-path or --folder-key when the asset is shared with multiple folders. Only provided fields are changed. " + "Use 'assets list' to retrieve the key.").argument("<asset-key>", "Asset key (GUID)").argument("[value]", "New asset value").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).addOption(new Option("--folder-path <path>", "Folder path (e.g., 'Shared')").conflicts("folderKey")).option("--folder-key <key>", "Folder key (GUID)").option("--type <type>", "Asset type (Text, Bool, Integer, Credential, Secret)").option("-s, --scope <scope>", "Asset scope (Global, PerRobot)").option("-n, --name <name>", "New asset name").option("-d, --description <description>", "Asset description").option("--tags <tags>", "Comma-separated list of tag names").option("--credential-store-key <key>", "Credential store key (GUID) to use for Credential or Secret assets. Use 'credential-stores list' to find it.").examples(ASSETS_UPDATE_EXAMPLES).trackedAction(processContext, async (assetKey, value, options) => {
854
+ assets.command("update").description("Update an existing asset. Resolves cross-folder by key; pass --folder-path or --folder-key when the asset is shared with multiple folders. Only provided fields are changed. " + "Use 'assets list' to retrieve the key.").argument("<asset-key>", "Asset key (GUID)").argument("[value]", "New asset value").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).addOption(new Option("--folder-path <path>", "Folder path (e.g., 'Shared')").argParser(parseFolderPath).conflicts("folderKey")).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--type <type>", "Asset type (Text, Bool, Integer, Credential, Secret)").option("-s, --scope <scope>", "Asset scope (Global, PerRobot)").option("-n, --name <name>", "New asset name").option("-d, --description <description>", "Asset description").option("--tags <tags>", "Comma-separated list of tag names").option("--credential-store-key <key>", "Credential store key (GUID) to use for Credential or Secret assets. Use 'credential-stores list' to find it.").examples(ASSETS_UPDATE_EXAMPLES).trackedAction(processContext, async (assetKey, value, options) => {
822
855
  const [apiError, crossFolderApi] = await catchError(createApiClient2(AssetsApi2, { tenant: options.tenant }));
823
856
  if (apiError) {
824
857
  await reportFailure2("Error updating asset", apiError);
@@ -1006,7 +1039,7 @@ var registerAssetsCommand = (program) => {
1006
1039
  }
1007
1040
  });
1008
1041
  });
1009
- assets.command("delete").description("Delete an asset by key (GUID). Resolves cross-folder by key; pass --folder-path or --folder-key when the asset is shared with multiple folders. " + "Use 'assets list' to retrieve the key.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).addOption(new Option("--folder-path <path>", "Folder path (e.g., 'Shared')").conflicts("folderKey")).option("--folder-key <key>", "Folder key (GUID)").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(ASSETS_DELETE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1042
+ assets.command("delete").description("Delete an asset by key (GUID). Resolves cross-folder by key; pass --folder-path or --folder-key when the asset is shared with multiple folders. " + "Use 'assets list' to retrieve the key.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).addOption(new Option("--folder-path <path>", "Folder path (e.g., 'Shared')").argParser(parseFolderPath).conflicts("folderKey")).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(ASSETS_DELETE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1010
1043
  if (!requireConfirmation(options, `delete asset '${assetKey}'`))
1011
1044
  return;
1012
1045
  const [apiError, crossFolderApi] = await catchError(createApiClient2(AssetsApi2, { tenant: options.tenant }));
@@ -1066,7 +1099,7 @@ var registerAssetsCommand = (program) => {
1066
1099
  Data: result
1067
1100
  });
1068
1101
  });
1069
- assets.command("share").description("Share an asset with a folder. The asset becomes accessible in the target folder.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')").option("--folder-key <key>", "Target folder key (GUID)").examples(ASSETS_SHARE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1102
+ assets.command("share").description("Share an asset with a folder. The asset becomes accessible in the target folder.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Target folder key (GUID)", parseFolderKey).examples(ASSETS_SHARE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1070
1103
  const resolved = await resolveEntityOrFail(AssetsApi2, { tenant: options.tenant }, resolveAssetByKey, assetKey, "Error sharing asset");
1071
1104
  if (!resolved)
1072
1105
  return;
@@ -1113,7 +1146,7 @@ var registerAssetsCommand = (program) => {
1113
1146
  }
1114
1147
  });
1115
1148
  });
1116
- assets.command("unshare").description("Remove an asset from a folder. The asset is no longer accessible in that folder.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')").option("--folder-key <key>", "Target folder key (GUID)").examples(ASSETS_UNSHARE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1149
+ assets.command("unshare").description("Remove an asset from a folder. The asset is no longer accessible in that folder.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Target folder key (GUID)", parseFolderKey).examples(ASSETS_UNSHARE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1117
1150
  const resolved = await resolveEntityOrFail(AssetsApi2, { tenant: options.tenant }, resolveAssetByKey, assetKey, "Error unsharing asset");
1118
1151
  if (!resolved)
1119
1152
  return;
@@ -1160,7 +1193,7 @@ var registerAssetsCommand = (program) => {
1160
1193
  }
1161
1194
  });
1162
1195
  });
1163
- assets.command("get-asset-value").description("Returns the value of an asset. Defaults to the current user's value — pass --executor-key for an executor-scoped lookup (required only for credential-type assets served by an external store). Requires --folder-path or --folder-key. Use 'assets list' to retrieve the key.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--executor-key <key>", "Executor key — opt-in to the executor-runtime endpoint; only useful for credential-type assets or when running in an executor context").examples(ASSETS_GET_VALUE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1196
+ assets.command("get-asset-value").description("Returns the value of an asset. Defaults to the current user's value — pass --executor-key for an executor-scoped lookup (required only for credential-type assets served by an external store). Requires --folder-path or --folder-key. Use 'assets list' to retrieve the key.").argument("<asset-key>", "Asset key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--executor-key <key>", "Executor key — opt-in to the executor-runtime endpoint; only useful for credential-type assets or when running in an executor context").examples(ASSETS_GET_VALUE_EXAMPLES).trackedAction(processContext, async (assetKey, options) => {
1164
1197
  if (options.folderPath === undefined && options.folderKey === undefined) {
1165
1198
  OutputFormatter.error({
1166
1199
  Result: RESULTS.Failure,
@@ -1326,7 +1359,7 @@ async function downloadAttachment(attachmentId, outputPath, options) {
1326
1359
  if (bufferError) {
1327
1360
  throw new Error(`Failed to read attachment data: ${bufferError.message}`);
1328
1361
  }
1329
- const { getFileSystem } = await import("./index-3b7n9344.js");
1362
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
1330
1363
  const fs = getFileSystem();
1331
1364
  const [writeError] = await catchError(fs.writeFile(outputPath, Buffer.from(buffer)));
1332
1365
  if (writeError) {
@@ -1339,31 +1372,8 @@ async function downloadAttachment(attachmentId, outputPath, options) {
1339
1372
  };
1340
1373
  }
1341
1374
 
1342
- // src/utils/folder-scope.ts
1343
- function invalidArgument(message) {
1344
- return Object.assign(new Error(message), {
1345
- errorCode: "invalid_argument",
1346
- retry: "RetryWillNotFix"
1347
- });
1348
- }
1349
- function bothFolderSelectorsError(scope) {
1350
- return scope.folderPath !== undefined && scope.folderKey !== undefined ? invalidArgument("Provide either --folder-path or --folder-key, not both.") : undefined;
1351
- }
1352
- async function assertEntityInFolder(kind, key, entityFolderIds, scope) {
1353
- if (scope.folderPath === undefined && scope.folderKey === undefined) {
1354
- return;
1355
- }
1356
- const bothSelectors = bothFolderSelectorsError(scope);
1357
- if (bothSelectors) {
1358
- throw bothSelectors;
1359
- }
1360
- const folder = await resolveFolder2({ folderPath: scope.folderPath, folderKey: scope.folderKey }, { tenant: scope.tenant });
1361
- if (folder !== undefined && entityFolderIds.includes(folder.id)) {
1362
- return folder.id;
1363
- }
1364
- const where = folder?.path ?? scope.folderPath ?? scope.folderKey;
1365
- throw Object.assign(new Error(`${kind} '${key}' was not found in folder '${where}'. ` + `Drop the folder option to look it up tenant-wide, or use '${kind.toLowerCase()}s list --folder-path <path>' to find it.`), { errorCode: "not_found", retry: "RetryWillNotFix" });
1366
- }
1375
+ // src/utils/job-expand.ts
1376
+ var JOB_KEYS_EXPAND = "Release($select=Key),Machine($select=Key)";
1367
1377
 
1368
1378
  // src/utils/job-resolver.ts
1369
1379
  async function resolveJob(jobKey, options) {
@@ -1379,7 +1389,7 @@ async function resolveJob(jobKey, options) {
1379
1389
  if (jobInfo.id === undefined || jobInfo.id === null) {
1380
1390
  throw new Error(`Job '${jobKey}' has no numeric ID — cannot resolve.`);
1381
1391
  }
1382
- const [getError, job] = await catchError(api.jobsGetById({ key: jobInfo.id }));
1392
+ const [getError, job] = await catchError(api.jobsGetById({ key: jobInfo.id, $expand: JOB_KEYS_EXPAND }));
1383
1393
  if (getError) {
1384
1394
  const errorMessage = await extractErrorMessage(getError);
1385
1395
  throw new Error(`Failed to get job details: ${errorMessage}`, {
@@ -1443,7 +1453,7 @@ var ATTACHMENTS_LIST_EXAMPLES = [
1443
1453
  ];
1444
1454
  var registerAttachmentsCommand = (program) => {
1445
1455
  const attachments = program.command("attachments").description("Manage job attachments. " + "Download files attached to jobs (screenshots, reports, data files). " + "Attachments are tenant-scoped — no folder context needed, except to download one stored in a folder on a tenant with pre-signed URLs turned off.");
1446
- const download = attachments.command("download").description("Download a job attachment to local disk. " + "Asks Orchestrator where the attachment's file is stored, then downloads it from there. " + "Use job 'get' output to find attachment IDs.").argument("<attachment-id>", "Attachment ID (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-d, --destination <path>", "Output file path (defaults to attachment-<id> in current directory)").option("--folder-path <path>", "Folder of an attachment stored in a folder (e.g., 'Shared'). Needed only on tenants with pre-signed URLs turned off").option("--folder-key <key>", "Folder key (GUID) of an attachment stored in a folder. Needed only on tenants with pre-signed URLs turned off").examples(ATTACHMENTS_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (attachmentId, options) => {
1456
+ const download = attachments.command("download").description("Download a job attachment to local disk. " + "Asks Orchestrator where the attachment's file is stored, then downloads it from there. " + "Use job 'get' output to find attachment IDs.").argument("<attachment-id>", "Attachment ID (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-d, --destination <path>", "Output file path (defaults to attachment-<id> in current directory)").option("--folder-path <path>", "Folder of an attachment stored in a folder (e.g., 'Shared'). Needed only on tenants with pre-signed URLs turned off", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) of an attachment stored in a folder. Needed only on tenants with pre-signed URLs turned off", parseFolderKey).examples(ATTACHMENTS_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (attachmentId, options) => {
1447
1457
  const [apiError, api] = await catchError(createApiClient2(AttachmentFileApi2, {
1448
1458
  tenant: options.tenant,
1449
1459
  folderPath: options.folderPath,
@@ -1469,7 +1479,7 @@ var registerAttachmentsCommand = (program) => {
1469
1479
  return;
1470
1480
  }
1471
1481
  const fileName = options.destination || `attachment-${attachmentId}`;
1472
- const { getFileSystem } = await import("./index-3b7n9344.js");
1482
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
1473
1483
  const fs = getFileSystem();
1474
1484
  const [writeError] = await catchError(fs.writeFile(fileName, Buffer.from(buffer)));
1475
1485
  if (writeError) {
@@ -1720,7 +1730,7 @@ var AUDIT_LOGS_LIST_EXAMPLES = [
1720
1730
  ];
1721
1731
  var registerAuditLogsCommand = (program) => {
1722
1732
  const auditLogs = program.command("audit-logs").description("View audit logs for the tenant. " + "Shows who did what and when — tracks changes to users, processes, assets, jobs, and other entities.");
1723
- auditLogs.command("list").description("List audit log entries. " + "Filter by component (Users, Assets, Processes, etc.), action (Create, Update, Delete, StartJob, etc.), or user.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--component <component>", "Filter by component (Users, Assets, Processes, Queues, Jobs, Folders, Machines, Roles, Settings, Schedules, etc.)").option("--action <action>", "Filter by action (Create, Update, Delete, StartJob, StopJob, Upload, Download, etc.)").option("--user <username>", "Filter by username").option("--created-after <datetime>", "Show entries after this date (ISO 8601)").option("--created-before <datetime>", "Show entries before this date (ISO 8601)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field", "ExecutionTime desc").option("--export", "Export logs to CSV file instead of listing in terminal").option("-d, --destination <path>", "CSV export file path (only with --export)").addOption(new Option("-o, --output <path>", "Deprecated alias for --destination").hideHelp()).examples(AUDIT_LOGS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
1733
+ auditLogs.command("list").description("List audit log entries. " + "Filter by component (Users, Assets, Processes, etc.), action (Create, Update, Delete, StartJob, etc.), or user.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--component <component>", "Filter by component (Users, Assets, Processes, Queues, Jobs, Folders, Machines, Roles, Settings, Schedules, etc.)", parseFilterValue).option("--action <action>", "Filter by action (Create, Update, Delete, StartJob, StopJob, Upload, Download, etc.)", parseFilterValue).option("--user <username>", "Filter by username", parseFilterValue).option("--created-after <datetime>", "Show entries after this date (ISO 8601)", parseFilterValue).option("--created-before <datetime>", "Show entries before this date (ISO 8601)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field", "ExecutionTime desc").option("--export", "Export logs to CSV file instead of listing in terminal").option("-d, --destination <path>", "CSV export file path (only with --export)").addOption(new Option("-o, --output <path>", "Deprecated alias for --destination").hideHelp()).examples(AUDIT_LOGS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
1724
1734
  if (options.destination !== undefined && options.output !== undefined) {
1725
1735
  OutputFormatter.error({
1726
1736
  Result: RESULTS.Failure,
@@ -1873,6 +1883,79 @@ function rejectUnsafeBlobPath(path, errorMessage) {
1873
1883
  processContext.exit(1);
1874
1884
  return true;
1875
1885
  }
1886
+ function rejectRecursiveWithoutDirectory(options) {
1887
+ if (!options.recursive || options.directory !== undefined)
1888
+ return false;
1889
+ OutputFormatter.error({
1890
+ Result: RESULTS.ValidationError,
1891
+ ErrorCode: "invalid_argument",
1892
+ Message: "--recursive works only with --directory: without --directory the list already includes every sub-folder.",
1893
+ Instructions: "Drop --recursive to list the whole bucket (add --prefix <path> to narrow it), or add --directory <path> to list one directory and its sub-folders.",
1894
+ Retry: "RetryWillNotFix"
1895
+ });
1896
+ return true;
1897
+ }
1898
+ var BLOB_READ_HEADERS = { "Accept-Encoding": "identity" };
1899
+ function promisedBodyLength(response) {
1900
+ if (response.type === "cors" || response.type === "opaque") {
1901
+ return;
1902
+ }
1903
+ const encoding = response.headers.get("content-encoding")?.trim();
1904
+ if (encoding && encoding.toLowerCase() !== "identity") {
1905
+ return;
1906
+ }
1907
+ const length = response.headers.get("content-length")?.trim();
1908
+ if (length === undefined || !/^\d+$/.test(length)) {
1909
+ return;
1910
+ }
1911
+ return Number(length);
1912
+ }
1913
+ function reportIncompleteDownload(message) {
1914
+ OutputFormatter.error({
1915
+ Result: RESULTS.Failure,
1916
+ Message: message,
1917
+ ErrorCode: "network_error",
1918
+ Retry: "RetryLater",
1919
+ Instructions: "The download ended before the whole file arrived, so nothing was saved or printed. Run the command again."
1920
+ });
1921
+ }
1922
+ var BODY_TRANSPORT_ERROR_CODES = new Set([
1923
+ "UND_ERR_RES_CONTENT_LENGTH_MISMATCH",
1924
+ "UND_ERR_SOCKET",
1925
+ "UND_ERR_BODY_TIMEOUT",
1926
+ "ECONNRESET",
1927
+ "ETIMEDOUT",
1928
+ "EPIPE"
1929
+ ]);
1930
+ function bodyTransportErrorCode(error) {
1931
+ const cause = error?.cause;
1932
+ for (const candidate of [error, cause]) {
1933
+ const code = candidate?.code;
1934
+ if (typeof code === "string" && BODY_TRANSPORT_ERROR_CODES.has(code)) {
1935
+ return code;
1936
+ }
1937
+ }
1938
+ return;
1939
+ }
1940
+ async function readCompleteBody(response, msg) {
1941
+ const [bufferError, arrayBuffer] = await catchError(response.arrayBuffer());
1942
+ if (bufferError) {
1943
+ const transportCode = bodyTransportErrorCode(bufferError);
1944
+ if (transportCode === undefined) {
1945
+ await reportFailure2(msg, bufferError);
1946
+ } else {
1947
+ reportIncompleteDownload(`${msg}: the connection ended while the file was downloading (${transportCode})`);
1948
+ }
1949
+ return;
1950
+ }
1951
+ const buffer = new Uint8Array(arrayBuffer);
1952
+ const promised = promisedBodyLength(response);
1953
+ if (promised !== undefined && buffer.length !== promised) {
1954
+ reportIncompleteDownload(`${msg}: received ${buffer.length} of ${promised} bytes`);
1955
+ return;
1956
+ }
1957
+ return buffer;
1958
+ }
1876
1959
  function formatBlobItem(item) {
1877
1960
  return {
1878
1961
  FullPath: toForwardSlashes(item.fullPath),
@@ -1914,6 +1997,31 @@ var BUCKET_FILES_LIST_EXAMPLES = [
1914
1997
  continuationToken: ""
1915
1998
  }
1916
1999
  }
2000
+ },
2001
+ {
2002
+ Description: "List the files in one directory and all its sub-folders (without --recursive, only the files directly inside it)",
2003
+ Command: "uip or bucket-files list a1b2c3d4-0000-0000-0000-000000000001 --folder-path Shared --directory reports --recursive",
2004
+ Output: {
2005
+ Code: "BucketFileList",
2006
+ Data: {
2007
+ items: [
2008
+ {
2009
+ Id: "",
2010
+ FullPath: "reports/summary.csv",
2011
+ ContentType: "text/csv",
2012
+ Size: 2048,
2013
+ IsDirectory: false
2014
+ },
2015
+ {
2016
+ Id: "",
2017
+ FullPath: "reports/2026/details.csv",
2018
+ ContentType: "text/csv",
2019
+ Size: 8192,
2020
+ IsDirectory: false
2021
+ }
2022
+ ]
2023
+ }
2024
+ }
1917
2025
  }
1918
2026
  ];
1919
2027
  var BUCKET_FILES_LIST_DIRS_EXAMPLES = [
@@ -2056,13 +2164,15 @@ async function resolveBucketId(bucketKey, options, errorContext) {
2056
2164
  }
2057
2165
  var registerBucketFilesCommand = (program) => {
2058
2166
  const bucketFiles = program.command("bucket-files").description("Manage files inside buckets. List, inspect, delete files and retrieve pre-signed URLs.");
2059
- bucketFiles.command("list").description("List files in a bucket. Returns items with pre-signed download URLs and a continuation token for paging.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").addOption(new Option("--prefix <path>", "Filter results to files under this path prefix.").conflicts("directory")).addOption(new Option("-d, --directory <path>", "Directory path to list through Orchestrator's directory API.").conflicts([
2167
+ bucketFiles.command("list").description("List files in a bucket. By default lists every file in the bucket, sub-folders included, with a continuation token for paging. " + "With --directory, lists only the files directly inside that directory unless --recursive is given.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).addOption(new Option("--prefix <path>", "Filter results to files under this path prefix.").conflicts("directory").argParser(parseFilterValue)).addOption(new Option("-d, --directory <path>", "List only the files directly inside this directory ('/' for the bucket root); files in its sub-folders are left out. " + "Add --recursive to include them, or drop --directory to list the whole bucket (narrow it with --prefix).").conflicts([
2060
2168
  "prefix",
2061
2169
  "takeHint",
2062
2170
  "continuationToken",
2063
2171
  "expiryInMinutes"
2064
- ])).option("--take-hint <number>", "Hint for number of items to return per page (default: 500, max: 1000).").option("--continuation-token <token>", "Token returned from a previous list call to fetch the next page.").option("--expiry-in-minutes <number>", "Validity period in minutes for the pre-signed download URLs included in the response.").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(BUCKET_FILES_LIST_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2172
+ ])).option("--recursive", "With --directory, also list the files in every sub-folder below it. The whole subtree comes back in one response, unpaged; " + "to walk a large tree page by page, drop --directory and use --prefix. Without --directory the list already includes sub-folders.").option("--take-hint <number>", "Hint for number of items to return per page (default: 500, max: 1000).").option("--continuation-token <token>", "Token returned from a previous list call to fetch the next page.").option("--expiry-in-minutes <number>", "Validity period in minutes for the pre-signed download URLs included in the response.").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(BUCKET_FILES_LIST_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2065
2173
  const msg = "Error listing files in bucket";
2174
+ if (rejectRecursiveWithoutDirectory(options))
2175
+ return;
2066
2176
  const resolved = await resolveBucketId(bucketKey, options, msg);
2067
2177
  if (!resolved)
2068
2178
  return;
@@ -2070,7 +2180,8 @@ var registerBucketFilesCommand = (program) => {
2070
2180
  if (options.directory !== undefined) {
2071
2181
  const [listError, result] = await catchError(api.bucketsGetFilesByKey({
2072
2182
  key: bucketId,
2073
- directory: options.directory
2183
+ directory: options.directory,
2184
+ recursive: options.recursive
2074
2185
  }));
2075
2186
  if (listError) {
2076
2187
  await reportFailure2(msg, listError);
@@ -2115,7 +2226,7 @@ var registerBucketFilesCommand = (program) => {
2115
2226
  }
2116
2227
  });
2117
2228
  });
2118
- bucketFiles.command("list-dirs").description("List directories (virtual folders) inside a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-d, --directory <path>", "Directory path to list (lists root if omitted).").option("--file-name-glob <pattern>", "Glob pattern to filter entries (e.g., '*.csv').").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(BUCKET_FILES_LIST_DIRS_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2229
+ bucketFiles.command("list-dirs").description("List directories (virtual folders) inside a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-d, --directory <path>", "Directory path to list (lists root if omitted).").option("--file-name-glob <pattern>", "Glob pattern to filter entries (e.g., '*.csv').", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(BUCKET_FILES_LIST_DIRS_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2119
2230
  const msg = "Error listing directories in bucket";
2120
2231
  const resolved = await resolveBucketId(bucketKey, options, msg);
2121
2232
  if (!resolved)
@@ -2146,7 +2257,7 @@ var registerBucketFilesCommand = (program) => {
2146
2257
  Data: options.allFields ? dirItems : dirItems.map(formatBlobFile)
2147
2258
  });
2148
2259
  });
2149
- bucketFiles.command("get").description("Get metadata for a specific file in a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(BUCKET_FILES_GET_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2260
+ bucketFiles.command("get").description("Get metadata for a specific file in a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(BUCKET_FILES_GET_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2150
2261
  const msg = "Error getting file metadata from bucket";
2151
2262
  if (rejectUnsafeBlobPath(filePath, msg))
2152
2263
  return;
@@ -2165,7 +2276,7 @@ var registerBucketFilesCommand = (program) => {
2165
2276
  Data: options.allFields ? file : formatBlobFile(file)
2166
2277
  });
2167
2278
  });
2168
- bucketFiles.command("delete").description("Delete a file from a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file to delete (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(BUCKET_FILES_DELETE_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2279
+ bucketFiles.command("delete").description("Delete a file from a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file to delete (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(BUCKET_FILES_DELETE_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2169
2280
  const msg = "Error deleting file from bucket";
2170
2281
  if (rejectUnsafeBlobPath(filePath, msg))
2171
2282
  return;
@@ -2193,7 +2304,7 @@ var registerBucketFilesCommand = (program) => {
2193
2304
  }
2194
2305
  });
2195
2306
  });
2196
- bucketFiles.command("download").description("Download a file from a bucket. Saves to --destination if provided, otherwise writes content to stdout.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-d, --destination <file>", "Local file path to save the downloaded content. If omitted, content is written to stdout.").examples(BUCKET_FILES_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2307
+ bucketFiles.command("download").description("Download a file from a bucket. Saves to --destination if provided, otherwise writes content to stdout.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-d, --destination <file>", "Local file path to save the downloaded content. If omitted, content is written to stdout.").examples(BUCKET_FILES_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2197
2308
  const msg = "Error downloading file from bucket";
2198
2309
  if (rejectUnsafeBlobPath(filePath, msg))
2199
2310
  return;
@@ -2223,7 +2334,13 @@ var registerBucketFilesCommand = (program) => {
2223
2334
  await reportFailure2(msg, headersError);
2224
2335
  return;
2225
2336
  }
2226
- const [fetchError, response] = await catchError(fetch(readAccess.uri, readRequest));
2337
+ const [fetchError, response] = await catchError(fetch(readAccess.uri, {
2338
+ ...readRequest,
2339
+ headers: {
2340
+ ...BLOB_READ_HEADERS,
2341
+ ...readRequest.headers
2342
+ }
2343
+ }));
2227
2344
  if (fetchError) {
2228
2345
  await reportFailure2(msg, fetchError);
2229
2346
  return;
@@ -2237,13 +2354,10 @@ var registerBucketFilesCommand = (program) => {
2237
2354
  processContext.exit(1);
2238
2355
  return;
2239
2356
  }
2357
+ const buffer = await readCompleteBody(response, msg);
2358
+ if (!buffer)
2359
+ return;
2240
2360
  if (options.destination) {
2241
- const [bufferError, arrayBuffer] = await catchError(response.arrayBuffer());
2242
- if (bufferError) {
2243
- await reportFailure2(msg, bufferError);
2244
- return;
2245
- }
2246
- const buffer = new Uint8Array(arrayBuffer);
2247
2361
  const [writeError] = await catchError(getFileSystem2().writeFile(options.destination, buffer));
2248
2362
  if (writeError) {
2249
2363
  await reportFailure2(msg, writeError);
@@ -2260,15 +2374,10 @@ var registerBucketFilesCommand = (program) => {
2260
2374
  }
2261
2375
  });
2262
2376
  } else {
2263
- const [textError, text] = await catchError(response.text());
2264
- if (textError) {
2265
- await reportFailure2(msg, textError);
2266
- return;
2267
- }
2268
- getOutputSink().writeOut(text);
2377
+ getOutputSink().writeOut(new TextDecoder().decode(buffer));
2269
2378
  }
2270
2379
  });
2271
- bucketFiles.command("upload").description("Upload a local file to a bucket at the specified path. Use --content-type to set the MIME type.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Destination path inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").requiredOption("--file <local-file>", "Path to the local file to upload").option("--content-type <mime-type>", 'MIME type of the file (e.g. "text/csv", "application/json"). Auto-detected if omitted.').examples(BUCKET_FILES_UPLOAD_EXAMPLES).trackedAction(processContext, async (bucketKey, destPath, options) => {
2380
+ bucketFiles.command("upload").description("Upload a local file to a bucket at the specified path. Use --content-type to set the MIME type.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Destination path inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).requiredOption("--file <local-file>", "Path to the local file to upload").option("--content-type <mime-type>", 'MIME type of the file (e.g. "text/csv", "application/json"). Auto-detected if omitted.').examples(BUCKET_FILES_UPLOAD_EXAMPLES).trackedAction(processContext, async (bucketKey, destPath, options) => {
2272
2381
  const msg = "Error uploading file to bucket";
2273
2382
  if (rejectUnsafeBlobPath(destPath, msg))
2274
2383
  return;
@@ -2350,7 +2459,7 @@ var registerBucketFilesCommand = (program) => {
2350
2459
  }
2351
2460
  });
2352
2461
  });
2353
- bucketFiles.command("get-download-url").description("Get a pre-signed download URL for a file in a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--expiry-in-minutes <number>", "Validity period in minutes for the pre-signed URL.").examples(BUCKET_FILES_GET_DOWNLOAD_URL_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2462
+ bucketFiles.command("get-download-url").description("Get a pre-signed download URL for a file in a bucket.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Full path of the file inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--expiry-in-minutes <number>", "Validity period in minutes for the pre-signed URL.").examples(BUCKET_FILES_GET_DOWNLOAD_URL_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2354
2463
  const msg = "Error getting download URL for bucket file";
2355
2464
  if (rejectUnsafeBlobPath(filePath, msg))
2356
2465
  return;
@@ -2373,7 +2482,7 @@ var registerBucketFilesCommand = (program) => {
2373
2482
  Data: access
2374
2483
  });
2375
2484
  });
2376
- bucketFiles.command("get-upload-url").description("Get a pre-signed upload URL for writing a file to a bucket. To upload a local file end-to-end (presign + PUT with the required storage headers), use 'bucket-files upload' instead.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Destination path inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--expiry-in-minutes <number>", "Validity period in minutes for the pre-signed URL.").option("--content-type <mime-type>", 'MIME type of the file to upload (e.g. "text/csv", "application/json").').examples(BUCKET_FILES_GET_UPLOAD_URL_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2485
+ bucketFiles.command("get-upload-url").description("Get a pre-signed upload URL for writing a file to a bucket. To upload a local file end-to-end (presign + PUT with the required storage headers), use 'bucket-files upload' instead.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").argument("<path>", 'Destination path inside the bucket (e.g. "reports/summary.csv").').addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--expiry-in-minutes <number>", "Validity period in minutes for the pre-signed URL.").option("--content-type <mime-type>", 'MIME type of the file to upload (e.g. "text/csv", "application/json").').examples(BUCKET_FILES_GET_UPLOAD_URL_EXAMPLES).trackedAction(processContext, async (bucketKey, filePath, options) => {
2377
2486
  const msg = "Error getting upload URL for bucket file";
2378
2487
  if (rejectUnsafeBlobPath(filePath, msg))
2379
2488
  return;
@@ -2596,20 +2705,13 @@ var BUCKETS_LIST_FOLDERS_EXAMPLES = [
2596
2705
  ];
2597
2706
  var registerBucketsCommand = (program) => {
2598
2707
  const buckets = program.command("buckets").description("Manage Orchestrator buckets (storage containers for files used by automations). Bucket operations are folder-scoped.");
2599
- buckets.command("list").description("List buckets within a folder. " + "Pass --folder-key or --folder-path to scope to a folder, " + "or --all-folders to list buckets across every accessible folder.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-folders", "List buckets across every folder accessible to the caller").option("-n, --name <name>", "Filter by bucket name (contains match)").option("--exclude-folder-path <path>", "Folder path to exclude from results — only applies with --all-folders").option("--exclude-folder-key <key>", "Folder key (GUID) to exclude from results — only applies with --all-folders").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(BUCKETS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
2708
+ buckets.command("list").description("List buckets within a folder. " + "Pass --folder-key or --folder-path to scope to a folder, " + "or --all-folders to list buckets across every accessible folder.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-folders", "List buckets across every folder accessible to the caller").option("-n, --name <name>", "Filter by bucket name (contains match)", parseFilterValue).option("--exclude-folder-path <path>", "Folder path to exclude from results — only applies with --all-folders", parseFolderPath).option("--exclude-folder-key <key>", "Folder key (GUID) to exclude from results — only applies with --all-folders", parseFolderKey).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(BUCKETS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
2600
2709
  const $top = parseInt(options.limit, 10);
2601
2710
  const $skip = parseInt(options.offset || "0", 10);
2602
2711
  const $orderby = options.sortBy;
2603
2712
  const folderScoped = options.folderKey !== undefined || options.folderPath !== undefined;
2604
- if (!options.allFolders && !folderScoped) {
2605
- OutputFormatter.error({
2606
- Result: RESULTS.Failure,
2607
- Message: "Folder is required. Pass --folder-key or --folder-path to scope to a folder, or --all-folders to list across every accessible folder.",
2608
- Instructions: "Re-run with --folder-path <path>, --folder-key <key>, or --all-folders."
2609
- });
2610
- processContext.exit(1);
2713
+ if (refuseListFolderScope(options))
2611
2714
  return;
2612
- }
2613
2715
  if (folderScoped) {
2614
2716
  const [apiError, api] = await catchError(createApiClient2(BucketsApi2, {
2615
2717
  tenant: options.tenant,
@@ -2693,7 +2795,7 @@ var registerBucketsCommand = (program) => {
2693
2795
  Data: options.allFields ? items : items.map(formatBucket)
2694
2796
  });
2695
2797
  });
2696
- buckets.command("get").description("Get bucket details by key (GUID).").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(BUCKETS_GET_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2798
+ buckets.command("get").description("Get bucket details by key (GUID).").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(BUCKETS_GET_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2697
2799
  const [apiError, api] = await catchError(createApiClient2(BucketsApi2, {
2698
2800
  tenant: options.tenant,
2699
2801
  folderPath: options.folderPath,
@@ -2714,7 +2816,7 @@ var registerBucketsCommand = (program) => {
2714
2816
  Data: options.allFields ? bucket : formatBucketDetail(bucket)
2715
2817
  });
2716
2818
  });
2717
- buckets.command("create").description("Create a new bucket in a folder.").argument("<name>", "Name for the new bucket").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--identifier <guid>", "Stable unique identifier for the bucket (GUID). Auto-generated if omitted.").option("-d, --description <text>", "Description of the bucket").option("--storage-provider <provider>", "Storage provider name (e.g., 'Azure', 'Amazon', 'Minio', 'S3Compatible', 'FileSystem'). Omit for Orchestrator built-in.").option("--storage-parameters <params>", "Provider-specific connection string. Use $Password as placeholder for the secret.").option("--storage-container <container>", "Provider-specific container name (e.g., AWS bucket or Azure container). Omit for Orchestrator built-in.").option("--credential-store-key <key>", "Key (GUID) of the credential store holding the provider secret. Required for Azure and Amazon providers.").option("--external-name <name>", "External name of the password entry in the credential store. Defaults to bucket name if omitted.").option("--password <secret>", "Provider-specific secret inserted at the $Password placeholder in --storage-parameters.").option("--options <value>", "Bucket access options. One of: None, ReadOnly, AuditReadAccess, AccessDataThroughOrchestrator.").option("--tags <json>", `Tags as a JSON array, e.g. '[{"name":"env","value":"prod"}]'.`).examples(BUCKETS_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
2819
+ buckets.command("create").description("Create a new bucket in a folder.").argument("<name>", "Name for the new bucket").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--identifier <guid>", "Stable unique identifier for the bucket (GUID). Auto-generated if omitted.").option("-d, --description <text>", "Description of the bucket").option("--storage-provider <provider>", "Storage provider name (e.g., 'Azure', 'Amazon', 'Minio', 'S3Compatible', 'FileSystem'). Omit for Orchestrator built-in.").option("--storage-parameters <params>", "Provider-specific connection string. Use $Password as placeholder for the secret.").option("--storage-container <container>", "Provider-specific container name (e.g., AWS bucket or Azure container). Omit for Orchestrator built-in.").option("--credential-store-key <key>", "Key (GUID) of the credential store holding the provider secret. Required for Azure and Amazon providers.").option("--external-name <name>", "External name of the password entry in the credential store. Defaults to bucket name if omitted.").option("--password <secret>", "Provider-specific secret inserted at the $Password placeholder in --storage-parameters.").option("--options <value>", "Bucket access options. One of: None, ReadOnly, AuditReadAccess, AccessDataThroughOrchestrator.").option("--tags <json>", `Tags as a JSON array, e.g. '[{"name":"env","value":"prod"}]'.`).examples(BUCKETS_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
2718
2820
  if (EXTERNAL_PROVIDERS.includes(options.storageProvider ?? "") && !options.credentialStoreKey) {
2719
2821
  OutputFormatter.error({
2720
2822
  Result: RESULTS.Failure,
@@ -2778,7 +2880,7 @@ var registerBucketsCommand = (program) => {
2778
2880
  Data: bucket
2779
2881
  });
2780
2882
  });
2781
- buckets.command("update").description("Update bucket properties.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-n, --name <name>", "New bucket name").option("-d, --description <text>", "New bucket description").option("--storage-provider <provider>", "Storage provider name (e.g., 'Azure', 'Amazon', 'Minio', 'S3Compatible', 'FileSystem').").option("--storage-parameters <params>", "Provider-specific connection string. Use $Password as placeholder for the secret.").option("--storage-container <container>", "Provider-specific container name.").option("--credential-store-key <key>", "Key (GUID) of the credential store holding the provider secret. Required when changing to Azure or Amazon provider.").option("--external-name <name>", "External name of the password entry in the credential store.").option("--password <secret>", "Provider-specific secret inserted at the $Password placeholder in --storage-parameters.").option("--options <value>", "Bucket access options. One of: None, ReadOnly, AuditReadAccess, AccessDataThroughOrchestrator.").option("--tags <json>", `Tags as a JSON array, e.g. '[{"name":"env","value":"prod"}]'.`).examples(BUCKETS_UPDATE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2883
+ buckets.command("update").description("Update bucket properties.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-n, --name <name>", "New bucket name").option("-d, --description <text>", "New bucket description").option("--storage-provider <provider>", "Storage provider name (e.g., 'Azure', 'Amazon', 'Minio', 'S3Compatible', 'FileSystem').").option("--storage-parameters <params>", "Provider-specific connection string. Use $Password as placeholder for the secret.").option("--storage-container <container>", "Provider-specific container name.").option("--credential-store-key <key>", "Key (GUID) of the credential store holding the provider secret. Required when changing to Azure or Amazon provider.").option("--external-name <name>", "External name of the password entry in the credential store.").option("--password <secret>", "Provider-specific secret inserted at the $Password placeholder in --storage-parameters.").option("--options <value>", "Bucket access options. One of: None, ReadOnly, AuditReadAccess, AccessDataThroughOrchestrator.").option("--tags <json>", `Tags as a JSON array, e.g. '[{"name":"env","value":"prod"}]'.`).examples(BUCKETS_UPDATE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2782
2884
  const resolved = await resolveEntityOrFail(BucketsApi2, {
2783
2885
  tenant: options.tenant,
2784
2886
  folderPath: options.folderPath,
@@ -2845,7 +2947,7 @@ var registerBucketsCommand = (program) => {
2845
2947
  Data: result
2846
2948
  });
2847
2949
  });
2848
- buckets.command("delete").description("Delete a bucket by key (GUID). Refuses to delete a bucket that " + "still has files unless you pass --force (deleting the bucket " + "deletes its files too).").argument("<bucket-key>", "Bucket key (GUID) to delete. Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").option("-f, --force", "Delete the bucket even if it still has files (the files are deleted too; implies --yes)").examples(BUCKETS_DELETE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2950
+ buckets.command("delete").description("Delete a bucket by key (GUID). Refuses to delete a bucket that " + "still has files unless you pass --force (deleting the bucket " + "deletes its files too).").argument("<bucket-key>", "Bucket key (GUID) to delete. Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").option("-f, --force", "Delete the bucket even if it still has files (the files are deleted too; implies --yes)").examples(BUCKETS_DELETE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2849
2951
  if (!requireConfirmation(options, `delete bucket '${bucketKey}'`))
2850
2952
  return;
2851
2953
  const resolved = await resolveEntityOrFail(BucketsApi2, {
@@ -2885,7 +2987,7 @@ var registerBucketsCommand = (program) => {
2885
2987
  Data: { Key: bucketKey, Status: "Deleted successfully" }
2886
2988
  });
2887
2989
  });
2888
- buckets.command("share").description("Share a bucket with a folder. The bucket becomes accessible in the target folder.").argument("<bucket-key>", "Bucket key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')").option("--folder-key <key>", "Target folder key (GUID)").examples(BUCKETS_SHARE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2990
+ buckets.command("share").description("Share a bucket with a folder. The bucket becomes accessible in the target folder.").argument("<bucket-key>", "Bucket key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Target folder key (GUID)", parseFolderKey).examples(BUCKETS_SHARE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2889
2991
  const resolved = await resolveEntityOrFail(BucketsApi2, { tenant: options.tenant }, resolveBucketByKey, bucketKey, "Error sharing bucket");
2890
2992
  if (!resolved)
2891
2993
  return;
@@ -2932,7 +3034,7 @@ var registerBucketsCommand = (program) => {
2932
3034
  }
2933
3035
  });
2934
3036
  });
2935
- buckets.command("unshare").description("Remove a bucket from a folder. The bucket is no longer accessible in that folder.").argument("<bucket-key>", "Bucket key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')").option("--folder-key <key>", "Target folder key (GUID)").examples(BUCKETS_UNSHARE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
3037
+ buckets.command("unshare").description("Remove a bucket from a folder. The bucket is no longer accessible in that folder.").argument("<bucket-key>", "Bucket key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Target folder key (GUID)", parseFolderKey).examples(BUCKETS_UNSHARE_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2936
3038
  const resolved = await resolveEntityOrFail(BucketsApi2, { tenant: options.tenant }, resolveBucketByKey, bucketKey, "Error unsharing bucket");
2937
3039
  if (!resolved)
2938
3040
  return;
@@ -2979,7 +3081,7 @@ var registerBucketsCommand = (program) => {
2979
3081
  }
2980
3082
  });
2981
3083
  });
2982
- buckets.command("list-folders").description("List folders that a bucket is shared with.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").examples(BUCKETS_LIST_FOLDERS_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
3084
+ buckets.command("list-folders").description("List folders that a bucket is shared with.").argument("<bucket-key>", "Bucket key (GUID). Use 'buckets list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).examples(BUCKETS_LIST_FOLDERS_EXAMPLES).trackedAction(processContext, async (bucketKey, options) => {
2983
3085
  const resolved = await resolveEntityOrFail(BucketsApi2, {
2984
3086
  tenant: options.tenant,
2985
3087
  folderPath: options.folderPath,
@@ -3067,6 +3169,47 @@ function rejectTimeZoneOption(timeZone) {
3067
3169
  function hiddenTimeZoneOption() {
3068
3170
  return new Option("--time-zone <timezone>", "Not supported: calendars use the tenant time zone").hideHelp();
3069
3171
  }
3172
+ var EXCLUDED_DATE_FORMAT = /^\d{4}-\d{2}-\d{2}$/;
3173
+ function isExcludedDate(value) {
3174
+ if (!EXCLUDED_DATE_FORMAT.test(value)) {
3175
+ return false;
3176
+ }
3177
+ const parsed = new Date(`${value}T00:00:00Z`);
3178
+ return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(value);
3179
+ }
3180
+ function rejectInvalidExcludedDates(...lists) {
3181
+ const invalid = lists.flatMap((list) => list ?? []).filter((value) => !isExcludedDate(value));
3182
+ if (invalid.length === 0) {
3183
+ return false;
3184
+ }
3185
+ OutputFormatter.error({
3186
+ Result: RESULTS.ValidationError,
3187
+ ErrorCode: "invalid_argument",
3188
+ Message: `Invalid excluded date: ${invalid.join(", ")}.`,
3189
+ Instructions: "Pass each date as YYYY-MM-DD, separated by spaces, for example --excluded-dates 2026-12-25 2026-12-26.",
3190
+ Retry: "RetryWillNotFix"
3191
+ });
3192
+ return true;
3193
+ }
3194
+ function toExcludedDates(days) {
3195
+ return [...new Set(days)].sort((a, b) => a.localeCompare(b)).map((day) => new Date(`${day}T00:00:00Z`));
3196
+ }
3197
+ function applyExcludedDatesChange(current, change) {
3198
+ if (change.excludedDates !== undefined) {
3199
+ return toExcludedDates(change.excludedDates);
3200
+ }
3201
+ if (change.addExcludedDates === undefined && change.removeExcludedDates === undefined) {
3202
+ return;
3203
+ }
3204
+ const days = new Set((current ?? []).map((value) => new Date(value).toISOString().slice(0, 10)));
3205
+ for (const day of change.addExcludedDates ?? []) {
3206
+ days.add(day);
3207
+ }
3208
+ for (const day of change.removeExcludedDates ?? []) {
3209
+ days.delete(day);
3210
+ }
3211
+ return toExcludedDates(days);
3212
+ }
3070
3213
  var CALENDARS_LIST_EXAMPLES = [
3071
3214
  {
3072
3215
  Description: "List all calendars in the tenant",
@@ -3120,6 +3263,20 @@ var CALENDARS_CREATE_EXAMPLES = [
3120
3263
  Id: 1010
3121
3264
  }
3122
3265
  }
3266
+ },
3267
+ {
3268
+ Description: "Create a calendar with its non-working days",
3269
+ Command: 'uip or calendars create "EU Holidays" --excluded-dates 2026-12-25 2026-12-26',
3270
+ Output: {
3271
+ Code: "CalendarCreated",
3272
+ Data: {
3273
+ Name: "EU Holidays",
3274
+ TimeZoneId: "UTC",
3275
+ ExcludedDates: ["2026-12-25T00:00:00Z", "2026-12-26T00:00:00Z"],
3276
+ Key: "a1b2c3d4-0000-0000-0000-000000000010",
3277
+ Id: 1010
3278
+ }
3279
+ }
3123
3280
  }
3124
3281
  ];
3125
3282
  var CALENDARS_UPDATE_EXAMPLES = [
@@ -3136,6 +3293,20 @@ var CALENDARS_UPDATE_EXAMPLES = [
3136
3293
  Id: 1010
3137
3294
  }
3138
3295
  }
3296
+ },
3297
+ {
3298
+ Description: "Add a non-working day and drop another",
3299
+ Command: "uip or calendars update a1b2c3d4-0000-0000-0000-000000000010 --add-excluded-dates 2027-01-01 --remove-excluded-dates 2026-12-26",
3300
+ Output: {
3301
+ Code: "CalendarUpdated",
3302
+ Data: {
3303
+ Name: "EU Public Holidays",
3304
+ TimeZoneId: "UTC",
3305
+ ExcludedDates: ["2026-12-25T00:00:00Z", "2027-01-01T00:00:00Z"],
3306
+ Key: "a1b2c3d4-0000-0000-0000-000000000010",
3307
+ Id: 1010
3308
+ }
3309
+ }
3139
3310
  }
3140
3311
  ];
3141
3312
  var CALENDARS_DELETE_EXAMPLES = [
@@ -3206,10 +3377,11 @@ var registerCalendarsCommand = (program) => {
3206
3377
  Data: options.allFields ? resolved.calendar : formatCalendarDetail(resolved.calendar)
3207
3378
  });
3208
3379
  });
3209
- calendars.command("create").description("Create a new calendar. Calendars are tenant-scoped and use the tenant time zone; " + "change it with 'uip or settings update Abp.Timing.TimeZone <id>'.").argument("<name>", "Calendar name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).addOption(hiddenTimeZoneOption()).examples(CALENDARS_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
3210
- if (rejectTimeZoneOption(options.timeZone)) {
3380
+ calendars.command("create").description("Create a new calendar. Calendars are tenant-scoped and use the tenant time zone; " + "change it with 'uip or settings update Abp.Timing.TimeZone <id>'.").argument("<name>", "Calendar name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).addOption(hiddenTimeZoneOption()).option("--excluded-dates <dates...>", "Non-working days, as YYYY-MM-DD, separated by spaces").examples(CALENDARS_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
3381
+ if (rejectTimeZoneOption(options.timeZone) || rejectInvalidExcludedDates(options.excludedDates)) {
3211
3382
  return;
3212
3383
  }
3384
+ const excludedDates = applyExcludedDatesChange([], options);
3213
3385
  const [apiError, api] = await catchError(createApiClient2(CalendarsApi2, {
3214
3386
  tenant: options.tenant
3215
3387
  }));
@@ -3223,7 +3395,7 @@ var registerCalendarsCommand = (program) => {
3223
3395
  return;
3224
3396
  }
3225
3397
  const [error, result] = await catchError(api.calendarsPost({
3226
- body: { name }
3398
+ body: { name, ...excludedDates && { excludedDates } }
3227
3399
  }));
3228
3400
  if (error) {
3229
3401
  await reportFailure2("Error creating calendar", error);
@@ -3235,8 +3407,8 @@ var registerCalendarsCommand = (program) => {
3235
3407
  Data: result
3236
3408
  });
3237
3409
  });
3238
- calendars.command("update").description("Update a calendar by key (GUID). Only provided fields are changed. " + "Use 'calendars list' to retrieve the key.").argument("<calendar-key>", "Calendar key (GUID) — use 'calendars list' to find keys").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--name <name>", "New calendar name").addOption(hiddenTimeZoneOption()).examples(CALENDARS_UPDATE_EXAMPLES).trackedAction(processContext, async (calendarKey, options) => {
3239
- if (rejectTimeZoneOption(options.timeZone)) {
3410
+ calendars.command("update").description("Update a calendar by key (GUID). Only provided fields are changed. " + "Use 'calendars list' to retrieve the key.").argument("<calendar-key>", "Calendar key (GUID) — use 'calendars list' to find keys").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--name <name>", "New calendar name").addOption(hiddenTimeZoneOption()).addOption(new Option("--excluded-dates <dates...>", "Replace the non-working days with these, as YYYY-MM-DD, separated by spaces").conflicts(["addExcludedDates", "removeExcludedDates"])).option("--add-excluded-dates <dates...>", "Non-working days to add to the ones the calendar has, as YYYY-MM-DD").option("--remove-excluded-dates <dates...>", "Non-working days to remove from the calendar, as YYYY-MM-DD").examples(CALENDARS_UPDATE_EXAMPLES).trackedAction(processContext, async (calendarKey, options) => {
3411
+ if (rejectTimeZoneOption(options.timeZone) || rejectInvalidExcludedDates(options.excludedDates, options.addExcludedDates, options.removeExcludedDates)) {
3240
3412
  return;
3241
3413
  }
3242
3414
  const [resolveError, resolved] = await catchError(resolveCalendar(calendarKey, {
@@ -3263,11 +3435,13 @@ var registerCalendarsCommand = (program) => {
3263
3435
  processContext.exit(1);
3264
3436
  return;
3265
3437
  }
3438
+ const excludedDates = applyExcludedDatesChange(resolved.calendar.excludedDates, options);
3266
3439
  const [error, result] = await catchError(api.calendarsPutById({
3267
3440
  key: resolved.id,
3268
3441
  body: {
3269
3442
  ...resolved.calendar,
3270
- name: options.name ?? resolved.calendar.name
3443
+ name: options.name ?? resolved.calendar.name,
3444
+ ...excludedDates && { excludedDates }
3271
3445
  }
3272
3446
  }));
3273
3447
  if (error) {
@@ -3388,7 +3562,7 @@ var CREDENTIAL_STORES_GET_EXAMPLES = [
3388
3562
  ];
3389
3563
  var registerCredentialStoresCommand = (program) => {
3390
3564
  const credentialStores = program.command("credential-stores").description("Manage Orchestrator credential stores (tenant-scoped secure storage backends for credentials and assets).");
3391
- credentialStores.command("list").description("List all credential stores in the tenant. " + "Returns Key, Id, Name, Type, HostName, and ProxyType by default; " + "pass --all-fields for the raw DTO including details and defaultCredentialStores. " + "Use --name to filter by name. " + "Use the key with 'credential-stores get' to retrieve full details.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-n, --name <name>", "Filter by name (contains match)").option("--id <id>", "Filter by credential store key (exact match)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(CREDENTIAL_STORES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
3565
+ credentialStores.command("list").description("List all credential stores in the tenant. " + "Returns Key, Id, Name, Type, HostName, and ProxyType by default; " + "pass --all-fields for the raw DTO including details and defaultCredentialStores. " + "Use --name to filter by name. " + "Use the key with 'credential-stores get' to retrieve full details.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-n, --name <name>", "Filter by name (contains match)", parseFilterValue).option("--id <id>", "Filter by credential store key (exact match)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(CREDENTIAL_STORES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
3392
3566
  const [apiError, api] = await catchError(createApiClient2(CredentialStoresApi2, {
3393
3567
  tenant: options.tenant
3394
3568
  }));
@@ -3713,7 +3887,7 @@ var FOLDERS_STOP_EXPLORING_EXAMPLES = [
3713
3887
  ];
3714
3888
  var registerFoldersCommand = (program) => {
3715
3889
  const folders = program.command("folders").description("Manage UiPath Orchestrator folders. " + "Folders organize and scope resources (processes, jobs, assets, queues) with role-based access. " + "Most commands require --folder-path or --folder-key to target a specific folder.");
3716
- folders.command("list").description("List folders the current user has access to. " + "Use --all to list all folders in the tenant (supports filtering and sorting).").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-a, --all", "List all folders in the tenant (Standard and Solution). Enables filtering and sorting options").option("-n, --name <name>", "Filter by folder name (contains match). Requires --all").option("--path <path>", "Filter by folder path prefix (e.g., 'Shared' lists all under Shared). Requires --all. " + "Does not match Personal Workspaces or the folders in them; use '--all --type personal' to list Personal Workspaces").option("--type <type>", "Filter by folder type: standard, solution, personal. Requires --all").option("--top-level", "Show only root folders (no subfolders). Requires --all").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc'). Requires --all").examples(FOLDERS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
3890
+ folders.command("list").description("List folders the current user has access to. " + "For an external application whose token has no OR.Default scope, that is every folder its scopes reach, since Orchestrator applies those scopes in all folders. " + "Use --all to list all folders in the tenant (supports filtering and sorting).").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-a, --all", "List all folders in the tenant (Standard, Solution and DebugSolution; not Personal Workspaces or the folders in them). Enables filtering and sorting options").option("-n, --name <name>", "Filter by folder name (contains match). Requires --all", parseFilterValue).option("--path <path>", "Filter by folder path prefix (e.g., 'Shared' lists all under Shared). Requires --all. " + "Does not match Personal Workspaces or the folders in them; use '--all --type personal' to list Personal Workspaces", parseFilterValue).option("--type <type>", "Filter by folder type: standard, solution, personal. Requires --all", parseFilterValue).option("--top-level", "Show only root folders (no subfolders). Requires --all").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--login-validity <minutes>", "Minimum minutes before token expiration to trigger a refresh (default: 10)", parseInt, 10).option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc'). Requires --all").examples(FOLDERS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
3717
3891
  const allOnlyFlags = [
3718
3892
  { name: "--name", value: options.name },
3719
3893
  { name: "--path", value: options.path },
@@ -3775,11 +3949,13 @@ var registerFoldersCommand = (program) => {
3775
3949
  }
3776
3950
  if (options.all) {
3777
3951
  await listAllFolders(api, options);
3952
+ } else if (await folderAccessMode(options) === "scopes") {
3953
+ await listFoldersReachedByScopes(api, options);
3778
3954
  } else {
3779
3955
  await listCurrentUserFolders(api, options);
3780
3956
  }
3781
3957
  });
3782
- folders.command("create").description("Create a new folder. " + "Folders scope processes, jobs, and resources with separate permissions. " + "Use --parent to nest inside an existing folder.").argument("<name>", "Folder name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-d, --description <description>", "Folder description").option("-p, --parent <key-or-path>", "Parent folder key (GUID) or path (e.g., 'Shared') — use 'folders list' to find").option("--feed-type <type>", "Package feed scope for this folder. " + "'Processes' (default) — folder shares the tenant-level processes feed. " + "'FolderHierarchy' — folder uses its own folder-scoped feed, inherited by sub-folders. " + "'Libraries' — folder is backed by the tenant libraries feed (libraries instead of processes).", "Processes").option("--permission-model <model>", "Permission model: FineGrained (default), InheritFromTenant", "FineGrained").option("--provision-type <type>", "Provision type: Automatic (default), Manual", "Automatic").examples(FOLDERS_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
3958
+ folders.command("create").description("Create a new folder. " + "Folders scope processes, jobs, and resources with separate permissions. " + "Use --parent to nest inside an existing folder.").argument("<name>", "Folder name").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-d, --description <description>", "Folder description").option("-p, --parent <key-or-path>", "Parent folder key (GUID) or path (e.g., 'Shared') — use 'folders list' to find", parseFolderKeyOrPath).option("--feed-type <type>", "Package feed scope for this folder. " + "'Processes' (default) — folder shares the tenant-level processes feed. " + "'FolderHierarchy' — folder uses its own folder-scoped feed, inherited by sub-folders. " + "'Libraries' — folder is backed by the tenant libraries feed (libraries instead of processes).", "Processes").option("--permission-model <model>", "Permission model: FineGrained (default), InheritFromTenant", "FineGrained").option("--provision-type <type>", "Provision type: Automatic (default), Manual", "Automatic").examples(FOLDERS_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
3783
3959
  const [apiError, api] = await catchError(createApiClient2(FoldersApi2, {
3784
3960
  tenant: options.tenant
3785
3961
  }));
@@ -3867,12 +4043,7 @@ var registerFoldersCommand = (program) => {
3867
4043
  folders.command("get").description("Get folder details by key (GUID) or path. " + "Returns display name, key (GUID), path, type, and permissions. " + "Use 'folders list' to find folder keys.").argument("<folder-key-or-path>", "Folder key (GUID) or path — use 'folders list' to find").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(FOLDERS_GET_EXAMPLES).trackedAction(processContext, async (folderKeyArg, options) => {
3868
4044
  const [resolveError, resolved] = await catchError(resolveFolderArgument(folderKeyArg, options.tenant));
3869
4045
  if (resolveError) {
3870
- OutputFormatter.error({
3871
- Result: RESULTS.Failure,
3872
- Message: "Error resolving folder",
3873
- Instructions: resolveError.message
3874
- });
3875
- processContext.exit(1);
4046
+ await reportFailure2("Error resolving folder", resolveError);
3876
4047
  return;
3877
4048
  }
3878
4049
  const [apiError, api] = await catchError(createApiClient2(FoldersApi2, {
@@ -3912,12 +4083,7 @@ var registerFoldersCommand = (program) => {
3912
4083
  return;
3913
4084
  const [resolveError, resolved] = await catchError(resolveFolderArgument(folderKeyArg, options.tenant));
3914
4085
  if (resolveError) {
3915
- OutputFormatter.error({
3916
- Result: RESULTS.Failure,
3917
- Message: "Error resolving folder",
3918
- Instructions: resolveError.message
3919
- });
3920
- processContext.exit(1);
4086
+ await reportFailure2("Error resolving folder", resolveError);
3921
4087
  return;
3922
4088
  }
3923
4089
  const [apiError, api] = await catchError(createApiClient2(FoldersApi2, {
@@ -3942,15 +4108,10 @@ var registerFoldersCommand = (program) => {
3942
4108
  }
3943
4109
  });
3944
4110
  });
3945
- folders.command("move").description("Move a folder to a new parent in the folder hierarchy. " + "Provide the target parent folder path or key. " + "Use --root to move to the top level.").argument("<folder-key-or-path>", "Folder key (GUID) or path — use 'folders list' to find").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-p, --parent <key-or-path>", "Target parent folder (key or path, e.g., 'Shared')").option("--root", "Move to top-level (root) folder").examples(FOLDERS_MOVE_EXAMPLES).trackedAction(processContext, async (folderKeyArg, options) => {
4111
+ folders.command("move").description("Move a folder to a new parent in the folder hierarchy. " + "Provide the target parent folder path or key. " + "Use --root to move to the top level.").argument("<folder-key-or-path>", "Folder key (GUID) or path — use 'folders list' to find").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-p, --parent <key-or-path>", "Target parent folder (key or path, e.g., 'Shared')", parseFolderKeyOrPath).option("--root", "Move to top-level (root) folder").examples(FOLDERS_MOVE_EXAMPLES).trackedAction(processContext, async (folderKeyArg, options) => {
3946
4112
  const [sourceError, sourceFolder] = await catchError(resolveFolderArgument(folderKeyArg, options.tenant));
3947
4113
  if (sourceError) {
3948
- OutputFormatter.error({
3949
- Result: RESULTS.Failure,
3950
- Message: "Error resolving folder",
3951
- Instructions: sourceError.message
3952
- });
3953
- processContext.exit(1);
4114
+ await reportFailure2("Error resolving folder", sourceError);
3954
4115
  return;
3955
4116
  }
3956
4117
  if (!options.root && !options.parent) {
@@ -4037,12 +4198,7 @@ var registerFoldersCommand = (program) => {
4037
4198
  } else {
4038
4199
  const [resolveError, resolved] = await catchError(resolveFolderArgument(folderKeyArg, options.tenant));
4039
4200
  if (resolveError) {
4040
- OutputFormatter.error({
4041
- Result: RESULTS.Failure,
4042
- Message: "Error resolving folder",
4043
- Instructions: resolveError.message
4044
- });
4045
- processContext.exit(1);
4201
+ await reportFailure2("Error resolving folder", resolveError);
4046
4202
  return;
4047
4203
  }
4048
4204
  folderKey = resolved.key;
@@ -4073,7 +4229,7 @@ var registerFoldersCommand = (program) => {
4073
4229
  }
4074
4230
  });
4075
4231
  });
4076
- folders.command("runtimes").description("List runtime allocations for a folder. " + "Shows how many runtime slots of each type (Unattended, Attended, NonProduction, etc.) " + "are total, connected, and available in the specified folder. " + "Useful for checking capacity before starting jobs.").argument("[folder-key-or-path]", "Deprecated: use --folder-path or --folder-key instead").option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find").addOption(new Option("--process-type <type>", "Report the runtimes a job of this process type can use. The Local row then counts only that job's slot pool, as the Start Job dialog does").choices(VALID_RUNTIMES_PROCESS_TYPES).argParser((value) => {
4232
+ folders.command("runtimes").description("List runtime allocations for a folder. " + "Shows how many runtime slots of each type (Unattended, Attended, NonProduction, etc.) " + "are total, connected, and available in the specified folder. " + "Useful for checking capacity before starting jobs.").argument("[folder-key-or-path]", "Deprecated: use --folder-path or --folder-key instead").option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find", parseFolderKey).addOption(new Option("--process-type <type>", "Report the runtimes a job of this process type can use. The Local row then counts only that job's slot pool, as the Start Job dialog does").choices(VALID_RUNTIMES_PROCESS_TYPES).argParser((value) => {
4077
4233
  const matched = VALID_RUNTIMES_PROCESS_TYPES.find((v) => v.toLowerCase() === value.toLowerCase());
4078
4234
  if (!matched) {
4079
4235
  throw new InvalidArgumentError(`Allowed choices are ${VALID_RUNTIMES_PROCESS_TYPES.join(", ")}.`);
@@ -4103,12 +4259,7 @@ var registerFoldersCommand = (program) => {
4103
4259
  folderKey: options.folderKey
4104
4260
  } : resolveFolderInput(folderKeyArg), "Provide --folder-path or --folder-key.", { tenant: options.tenant }));
4105
4261
  if (folderError) {
4106
- OutputFormatter.error({
4107
- Result: RESULTS.Failure,
4108
- Message: "Error resolving folder",
4109
- Instructions: folderError.message
4110
- });
4111
- processContext.exit(1);
4262
+ await reportFailure2("Error resolving folder", folderError);
4112
4263
  return;
4113
4264
  }
4114
4265
  const [apiError, api] = await catchError(createApiClient2(MachinesApi2, {
@@ -4191,7 +4342,7 @@ async function exploreWorkspace(reference, options, action) {
4191
4342
  return;
4192
4343
  }
4193
4344
  const [refreshError] = await catchError((async () => {
4194
- const { refreshUserFolderAccess } = await import("./connections-enpe5p0d.js");
4345
+ const { refreshUserFolderAccess } = await import("./connections-eke6a1v8.js");
4195
4346
  return await refreshUserFolderAccess({ tenant: options.tenant });
4196
4347
  })());
4197
4348
  if (refreshError) {
@@ -4208,6 +4359,16 @@ async function exploreWorkspace(reference, options, action) {
4208
4359
  }
4209
4360
  });
4210
4361
  }
4362
+ function formatCurrentUserFolderRow(folder) {
4363
+ return {
4364
+ Key: folder.key || "",
4365
+ Name: folder.displayName || "",
4366
+ Path: folder.fullyQualifiedName || "",
4367
+ Description: folder.description || "",
4368
+ Type: folder.folderType || "",
4369
+ ParentKey: folder.parentKey || ""
4370
+ };
4371
+ }
4211
4372
  async function listCurrentUserFolders(api, options) {
4212
4373
  const [getError, result] = await catchError(api.foldersGetAllForCurrentUser({
4213
4374
  take: parseInt(options.limit || String(DEFAULT_PAGE_SIZE), 10),
@@ -4218,14 +4379,7 @@ async function listCurrentUserFolders(api, options) {
4218
4379
  return;
4219
4380
  }
4220
4381
  const items = result.pageItems ?? [];
4221
- const folders = items.map((folder) => ({
4222
- Key: folder.key || "",
4223
- Name: folder.displayName || "",
4224
- Path: folder.fullyQualifiedName || "",
4225
- Description: folder.description || "",
4226
- Type: folder.folderType || "",
4227
- ParentKey: folder.parentKey || ""
4228
- }));
4382
+ const folders = items.map(formatCurrentUserFolderRow);
4229
4383
  OutputFormatter.success({
4230
4384
  Result: RESULTS.Success,
4231
4385
  Code: "FolderList",
@@ -4237,6 +4391,108 @@ async function listCurrentUserFolders(api, options) {
4237
4391
  Data: folders
4238
4392
  });
4239
4393
  }
4394
+ async function folderAccessMode(options) {
4395
+ const [error, mode] = await catchError(getFolderAccessMode2({ tenant: options.tenant }));
4396
+ if (error) {
4397
+ logger.debug(`Could not read the session to choose a folder listing (${await extractErrorMessage(error)}); listing the current user's folders.`);
4398
+ return "assignments";
4399
+ }
4400
+ return mode;
4401
+ }
4402
+ function personalWorkspaceRows(own) {
4403
+ const byKey = new Map(own.map((folder) => [folder.key, folder]));
4404
+ const inWorkspace = (folder) => {
4405
+ const seen = new Set;
4406
+ let current = folder;
4407
+ while (current && !seen.has(current.key)) {
4408
+ if (current.folderType === "Personal" || current.folderType === "Virtual") {
4409
+ return true;
4410
+ }
4411
+ seen.add(current.key);
4412
+ current = current.parentKey ? byKey.get(current.parentKey) : undefined;
4413
+ }
4414
+ return false;
4415
+ };
4416
+ return own.filter(inWorkspace);
4417
+ }
4418
+ var SERVICE_ACCOUNT_PAGE_SIZE = 100;
4419
+ var SERVICE_ACCOUNT_MAX_PAGES = 100;
4420
+ async function readAllCurrentUserFolders(api) {
4421
+ const rows = [];
4422
+ for (let page = 0;page < SERVICE_ACCOUNT_MAX_PAGES; page++) {
4423
+ const result = await api.foldersGetAllForCurrentUser({
4424
+ take: SERVICE_ACCOUNT_PAGE_SIZE,
4425
+ skip: rows.length
4426
+ });
4427
+ const items = result.pageItems ?? [];
4428
+ rows.push(...items);
4429
+ if (items.length === 0 || typeof result.count === "number" && rows.length >= result.count) {
4430
+ return rows;
4431
+ }
4432
+ }
4433
+ logger.warn(`Stopped reading this session's own folders after ${rows.length}; the list may leave some out.`);
4434
+ return rows;
4435
+ }
4436
+ var TENANT_WALK_PAGE_SIZE = 500;
4437
+ var TENANT_WALK_MAX_PAGES = 200;
4438
+ async function readTenantWindow(api, skipKeys, start, count) {
4439
+ const rows = [];
4440
+ const counting = skipKeys.size > 0;
4441
+ let rawSkip = counting ? 0 : start;
4442
+ let toPass = counting ? start : 0;
4443
+ for (let page = 0;rows.length < count; page++) {
4444
+ if (page === TENANT_WALK_MAX_PAGES) {
4445
+ logger.warn(`Stopped reading folders after ${rawSkip} rows; the list may leave some out.`);
4446
+ break;
4447
+ }
4448
+ const result = await api.foldersGet({
4449
+ $top: counting ? TENANT_WALK_PAGE_SIZE : count - rows.length,
4450
+ $skip: rawSkip,
4451
+ $orderby: "FullyQualifiedName asc"
4452
+ });
4453
+ const items = result.value ?? [];
4454
+ if (items.length === 0)
4455
+ break;
4456
+ rawSkip += items.length;
4457
+ for (const folder of items) {
4458
+ if (skipKeys.has(folder.key))
4459
+ continue;
4460
+ if (toPass > 0) {
4461
+ toPass--;
4462
+ continue;
4463
+ }
4464
+ rows.push(folder);
4465
+ if (rows.length === count)
4466
+ break;
4467
+ }
4468
+ }
4469
+ return rows;
4470
+ }
4471
+ async function listFoldersReachedByScopes(api, options) {
4472
+ const limit = parseInt(options.limit || String(DEFAULT_PAGE_SIZE), 10);
4473
+ const offset = parseInt(options.offset || "0", 10);
4474
+ logger.info("This session is an application without the OR.Default scope, so Orchestrator applies its scopes in every folder; listing all folders they reach.");
4475
+ const [ownError, own] = await catchError(readAllCurrentUserFolders(api));
4476
+ if (ownError) {
4477
+ await reportFailure2("Error listing folders", ownError);
4478
+ return;
4479
+ }
4480
+ const ownOnly = personalWorkspaceRows(own);
4481
+ const ownOnlyKeys = new Set(ownOnly.map((folder) => folder.key));
4482
+ const fromOwn = ownOnly.slice(offset, offset + limit);
4483
+ const [getError, fromTenant] = await catchError(readTenantWindow(api, ownOnlyKeys, Math.max(0, offset - ownOnly.length), limit - fromOwn.length));
4484
+ if (getError) {
4485
+ await reportFailure2("Error listing folders", getError);
4486
+ return;
4487
+ }
4488
+ const rows = [...fromOwn, ...fromTenant].map(formatCurrentUserFolderRow);
4489
+ OutputFormatter.success({
4490
+ Result: RESULTS.Success,
4491
+ Code: "FolderList",
4492
+ Pagination: new Pagination({ returned: rows.length, limit, offset }),
4493
+ Data: rows
4494
+ });
4495
+ }
4240
4496
  async function listPersonalWorkspaces(api, options) {
4241
4497
  const filters = [];
4242
4498
  if (options.name) {
@@ -4332,7 +4588,7 @@ function resolveFolderArgument(keyOrPath, tenant) {
4332
4588
 
4333
4589
  // src/utils/attachment-uploader.ts
4334
4590
  async function uploadAttachment(filePath, name, options) {
4335
- const { getFileSystem } = await import("./index-3b7n9344.js");
4591
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
4336
4592
  const fs = getFileSystem();
4337
4593
  const [readError, fileBuffer] = await catchError(fs.readFile(filePath));
4338
4594
  if (readError) {
@@ -4376,7 +4632,7 @@ async function parseAttachmentArg(arg) {
4376
4632
  }
4377
4633
  return { name, path, named: true };
4378
4634
  }
4379
- const { getFileSystem } = await import("./index-3b7n9344.js");
4635
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
4380
4636
  const fs = getFileSystem();
4381
4637
  return { name: fs.path.basename(arg), path: arg, named: false };
4382
4638
  }
@@ -4425,6 +4681,69 @@ function findInvalidEnvVarLine(value) {
4425
4681
  return;
4426
4682
  }
4427
4683
 
4684
+ // src/utils/job-logs.ts
4685
+ var JOB_LOG_LEVELS = [
4686
+ "Trace",
4687
+ "Debug",
4688
+ "Info",
4689
+ "Warn",
4690
+ "Error",
4691
+ "Fatal"
4692
+ ];
4693
+ var JOB_LOG_LEVEL_ALIASES = {
4694
+ Warning: "Warn"
4695
+ };
4696
+ var JOB_LOG_LEVELS_HELP = `${JOB_LOG_LEVELS.join(", ")}; Warning is accepted for Warn`;
4697
+ function resolveJobLogLevel(raw) {
4698
+ if (JOB_LOG_LEVELS.includes(raw)) {
4699
+ return raw;
4700
+ }
4701
+ return Object.hasOwn(JOB_LOG_LEVEL_ALIASES, raw) ? JOB_LOG_LEVEL_ALIASES[raw] : undefined;
4702
+ }
4703
+ var ROBOT_LOGS_PAGE_SIZE = 1000;
4704
+ var JOB_START_SKEW_MS = 4 * 60 * 60 * 1000;
4705
+ async function readJobLogRows(api, query) {
4706
+ if (query.limit <= ROBOT_LOGS_PAGE_SIZE) {
4707
+ return readPages(api, query);
4708
+ }
4709
+ const newest = await api.robotLogsGet({
4710
+ $filter: query.filter,
4711
+ $orderby: "TimeStamp desc",
4712
+ $top: 1,
4713
+ $skip: 0
4714
+ });
4715
+ const newestAt = newest.value?.[0]?.timeStamp;
4716
+ if (newestAt === undefined) {
4717
+ return (newest.value ?? []).length === 0 ? [] : readPages(api, query);
4718
+ }
4719
+ const clauses = [
4720
+ query.filter,
4721
+ `TimeStamp lt ${new Date(newestAt.getTime() + 1).toISOString()}`
4722
+ ];
4723
+ if (query.jobStartedAt !== undefined) {
4724
+ const from = query.jobStartedAt.getTime() - JOB_START_SKEW_MS;
4725
+ clauses.push(`TimeStamp ge ${new Date(from).toISOString()}`);
4726
+ }
4727
+ return readPages(api, { ...query, filter: clauses.join(" and ") });
4728
+ }
4729
+ async function readPages(api, query) {
4730
+ const rows = [];
4731
+ while (rows.length < query.limit) {
4732
+ const top = Math.min(ROBOT_LOGS_PAGE_SIZE, query.limit - rows.length);
4733
+ const page = await api.robotLogsGet({
4734
+ $filter: query.filter,
4735
+ $orderby: "TimeStamp desc",
4736
+ $top: top,
4737
+ $skip: query.offset + rows.length
4738
+ });
4739
+ const value = page.value ?? [];
4740
+ rows.push(...value);
4741
+ if (value.length < top)
4742
+ break;
4743
+ }
4744
+ return rows;
4745
+ }
4746
+
4428
4747
  // src/utils/job-waiter.ts
4429
4748
  var TERMINAL_STATES = ["Successful", "Faulted", "Stopped"];
4430
4749
  var isTerminalJobState = (state) => TERMINAL_STATES.includes(state ?? "");
@@ -4459,6 +4778,35 @@ async function waitForJob(jobKey, options) {
4459
4778
  };
4460
4779
  }
4461
4780
 
4781
+ // src/utils/json-file-option.ts
4782
+ function reportJsonOptionUsageError(message, flags) {
4783
+ OutputFormatter.error({
4784
+ Result: RESULTS.ValidationError,
4785
+ ErrorCode: "invalid_argument",
4786
+ Message: message,
4787
+ Instructions: `Pass the JSON inline with ${flags.inlineFlag} '<json>', or put it in a file and pass ${flags.fileFlag} <path>.`,
4788
+ Retry: "RetryWillNotFix"
4789
+ });
4790
+ }
4791
+ async function resolveJsonFileOption(source) {
4792
+ if (source.inline === undefined && source.file === undefined) {
4793
+ return;
4794
+ }
4795
+ const [error, read] = await catchError(readJsonOptionWithText(source));
4796
+ if (error) {
4797
+ reportJsonOptionUsageError(error.message, source);
4798
+ return null;
4799
+ }
4800
+ if (read === undefined) {
4801
+ return;
4802
+ }
4803
+ return {
4804
+ value: read.value,
4805
+ text: read.text,
4806
+ flag: source.file === undefined ? source.inlineFlag : source.fileFlag
4807
+ };
4808
+ }
4809
+
4462
4810
  // src/utils/machine-resolver.ts
4463
4811
  async function resolveMachine(machineKey, options) {
4464
4812
  if (!isGuid(machineKey)) {
@@ -4537,17 +4885,15 @@ function toResolved(machine, inputKey) {
4537
4885
  }
4538
4886
 
4539
4887
  // src/utils/release-lookup.ts
4540
- async function reportReleaseLookupFailure(message, error, options) {
4888
+ async function reportReleaseLookupFailure(message, error) {
4541
4889
  if (!(error instanceof ReleaseNotFoundError2)) {
4542
4890
  await reportFailure2(message, error);
4543
4891
  return;
4544
4892
  }
4545
- const offerFolder = options?.canScopeToFolder !== false && !error.folderScoped;
4546
- reportNotFound(message, offerFolder ? `${error.message} Or re-run with --folder-path <path> or --folder-key <key> to look inside that folder.` : error.message);
4893
+ reportNotFound(message, error.folderScoped ? error.message : `${error.message} Or re-run with --folder-path <path> or --folder-key <key> to look inside that folder.`);
4547
4894
  }
4548
4895
 
4549
4896
  // src/commands/jobs.ts
4550
- var JOB_LOG_LEVELS = ["Fatal", "Error", "Warning", "Info", "Trace"];
4551
4897
  function resolveJobForCommand(jobKey, tenant, errorContext, folder) {
4552
4898
  return resolveOrReportError(resolveJob(jobKey, {
4553
4899
  tenant,
@@ -4577,12 +4923,18 @@ async function resolveJobWithJobsApi(jobKey, tenant, errorContext) {
4577
4923
  }
4578
4924
  return { api, resolved };
4579
4925
  }
4580
- function formatJob(job) {
4926
+ var INPUT_ARGUMENTS_FLAGS = {
4927
+ inlineFlag: "--input-arguments",
4928
+ fileFlag: "--input-arguments-file"
4929
+ };
4930
+ function formatJob(job, known = {}) {
4581
4931
  return {
4582
4932
  Key: job.key || "",
4583
4933
  State: job.state || "",
4584
4934
  ProcessName: job.releaseName || "",
4585
- ReleaseKey: job.release?.key || "",
4935
+ ReleaseKey: job.release?.key || known.releaseKey || "",
4936
+ FolderKey: job.folderKey || known.folderKey || "",
4937
+ FolderPath: job.organizationUnitFullyQualifiedName || known.folderPath || "",
4586
4938
  Source: job.sourceType || "",
4587
4939
  Type: job.type || "",
4588
4940
  Priority: job.jobPriority || "",
@@ -4593,13 +4945,21 @@ function formatJob(job) {
4593
4945
  CreationTime: job.creationTime ? new Date(job.creationTime).toISOString() : ""
4594
4946
  };
4595
4947
  }
4948
+ async function lookUpFolderForRows(folder, tenant, warning) {
4949
+ const [error, resolved] = await catchError(resolveFolder2(folder, { tenant }));
4950
+ if (error) {
4951
+ logger.warn(`${warning}: ${error.message}`);
4952
+ return;
4953
+ }
4954
+ return resolved;
4955
+ }
4596
4956
  function formatJobDetail(job) {
4597
4957
  return JobDtoToJSONTyped2(job);
4598
4958
  }
4599
4959
  var JOBS_LIST_EXAMPLES = [
4600
4960
  {
4601
4961
  Description: "List running jobs",
4602
- Command: "uip or jobs list --state Running --limit 2",
4962
+ Command: "uip or jobs list --folder-key a1b2c3d4-0000-0000-0000-000000000001 --state Running --limit 2",
4603
4963
  Output: {
4604
4964
  Code: "JobList",
4605
4965
  Data: [
@@ -4608,6 +4968,8 @@ var JOBS_LIST_EXAMPLES = [
4608
4968
  State: "Running",
4609
4969
  ProcessName: "InvoiceProcessing",
4610
4970
  ReleaseKey: "c3d4e5f6-0000-0000-0000-000000000001",
4971
+ FolderKey: "a1b2c3d4-0000-0000-0000-000000000001",
4972
+ FolderPath: "Finance/Invoices",
4611
4973
  Source: "Manual",
4612
4974
  Type: "Unattended",
4613
4975
  Priority: "Normal",
@@ -4622,6 +4984,8 @@ var JOBS_LIST_EXAMPLES = [
4622
4984
  State: "Running",
4623
4985
  ProcessName: "DataMigration",
4624
4986
  ReleaseKey: "c3d4e5f6-0000-0000-0000-000000000002",
4987
+ FolderKey: "a1b2c3d4-0000-0000-0000-000000000001",
4988
+ FolderPath: "Finance/Invoices",
4625
4989
  Source: "Schedule",
4626
4990
  Type: "Unattended",
4627
4991
  Priority: "Normal",
@@ -4678,6 +5042,8 @@ var JOBS_START_EXAMPLES = [
4678
5042
  State: "Pending",
4679
5043
  ProcessName: "InvoiceProcessing",
4680
5044
  ReleaseKey: "c3d4e5f6-0000-0000-0000-000000000001",
5045
+ FolderKey: "a1b2c3d4-0000-0000-0000-000000000001",
5046
+ FolderPath: "Finance/Invoices",
4681
5047
  Source: "Manual",
4682
5048
  Type: "Unattended",
4683
5049
  Priority: "Normal",
@@ -4715,6 +5081,31 @@ var JOBS_START_EXAMPLES = [
4715
5081
  ]
4716
5082
  }
4717
5083
  }
5084
+ },
5085
+ {
5086
+ Description: "Pass input arguments from a JSON file (avoids shell quoting, e.g. on Windows)",
5087
+ Command: "uip or jobs start c3d4e5f6-0000-0000-0000-000000000001 --input-arguments-file ./args.json",
5088
+ Output: {
5089
+ Code: "JobStarted",
5090
+ Data: {
5091
+ Jobs: [
5092
+ {
5093
+ Key: "b2c3d4e5-0000-0000-0000-000000000101",
5094
+ State: "Pending",
5095
+ ProcessName: "InvoiceProcessing",
5096
+ ReleaseKey: "c3d4e5f6-0000-0000-0000-000000000001",
5097
+ Source: "Manual",
5098
+ Type: "Unattended",
5099
+ Priority: "Normal",
5100
+ HostMachineName: "",
5101
+ MachineKey: "",
5102
+ StartTime: "",
5103
+ EndTime: "",
5104
+ CreationTime: "2025-04-15T10:32:40Z"
5105
+ }
5106
+ ]
5107
+ }
5108
+ }
4718
5109
  }
4719
5110
  ];
4720
5111
  var JOBS_STOP_EXAMPLES = [
@@ -4744,6 +5135,8 @@ var JOBS_RESTART_EXAMPLES = [
4744
5135
  State: "Pending",
4745
5136
  ProcessName: "InvoiceProcessing",
4746
5137
  ReleaseKey: "c3d4e5f6-0000-0000-0000-000000000001",
5138
+ FolderKey: "a1b2c3d4-0000-0000-0000-000000000001",
5139
+ FolderPath: "Finance/Invoices",
4747
5140
  Source: "Manual",
4748
5141
  Type: "Unattended",
4749
5142
  Priority: "Normal",
@@ -4772,6 +5165,19 @@ var JOBS_RESUME_EXAMPLES = [
4772
5165
  Status: "Resume requested"
4773
5166
  }
4774
5167
  }
5168
+ },
5169
+ {
5170
+ Description: "Resume a suspended job with input read from a JSON file (avoids shell quoting, e.g. on Windows)",
5171
+ Command: "uip or jobs resume b2c3d4e5-0000-0000-0000-000000000001 --input-arguments-file ./resume-args.json",
5172
+ Output: {
5173
+ Code: "JobResumed",
5174
+ Data: {
5175
+ Key: "b2c3d4e5-0000-0000-0000-000000000001",
5176
+ State: "Resumed",
5177
+ ProcessName: "ApprovalFlow",
5178
+ Status: "Resume requested"
5179
+ }
5180
+ }
4775
5181
  }
4776
5182
  ];
4777
5183
  var JOBS_LOGS_EXAMPLES = [
@@ -4851,26 +5257,9 @@ var JOBS_HISTORY_EXAMPLES = [
4851
5257
  ];
4852
5258
  var registerJobsCommand = (program) => {
4853
5259
  const jobs = program.command("jobs").description("Manage UiPath Orchestrator jobs (process executions). " + "Start jobs from processes, monitor execution and check logs. " + "Jobs are immutable audit records and cannot be deleted -- they age out per the binding process's retention period.");
4854
- jobs.command("list").description("List jobs in a folder, or across all accessible folders with --all-folders. " + "Returns job key, state, process name, timing, and machine info. " + "Use --state to filter by job state (Pending, Running, Successful, Faulted, Stopped, Stopping, Suspended, Resumed, Terminating).").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-folders", "List jobs across all accessible folders").option("--state <state>", "Filter by job state (Pending, Running, Successful, Faulted, Stopped, Stopping, Suspended, Resumed, Terminating)").option("--process-name <name>", "Filter by process name (contains match)").option("--source <source>", "Filter by job source type (e.g., Manual, Schedule, Queue, Agent)").option("--created-after <datetime>", "Jobs created on or after (ISO 8601)").option("--created-before <datetime>", "Jobs created before (ISO 8601)").option("--started-after <datetime>", "Jobs started on or after (ISO 8601)").option("--started-before <datetime>", "Jobs started before (ISO 8601)").option("--ended-after <datetime>", "Jobs ended on or after (ISO 8601)").option("--ended-before <datetime>", "Jobs ended before (ISO 8601)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(JOBS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
4855
- const hasFolderSelector = options.folderPath !== undefined || options.folderKey !== undefined;
4856
- if (options.allFolders && hasFolderSelector) {
4857
- OutputFormatter.error({
4858
- Result: RESULTS.Failure,
4859
- Message: "Error listing jobs",
4860
- Instructions: "Use --all-folders by itself, or provide a single folder selector with --folder-path or --folder-key."
4861
- });
4862
- processContext.exit(1);
4863
- return;
4864
- }
4865
- if (!options.allFolders && !hasFolderSelector) {
4866
- OutputFormatter.error({
4867
- Result: RESULTS.Failure,
4868
- Message: "Error listing jobs",
4869
- Instructions: "Provide --folder-path, --folder-key, or --all-folders."
4870
- });
4871
- processContext.exit(1);
5260
+ jobs.command("list").description("List jobs in a folder, or across all accessible folders with --all-folders. " + "Returns job key, state, process name, timing, and machine info. " + "Use --state to filter by job state (Pending, Running, Successful, Faulted, Stopped, Stopping, Suspended, Resumed, Terminating).").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-folders", "List jobs across all accessible folders").option("--state <state>", "Filter by job state (Pending, Running, Successful, Faulted, Stopped, Stopping, Suspended, Resumed, Terminating)", parseFilterValue).option("--process-name <name>", "Filter by process name (contains match)", parseFilterValue).option("--source <source>", "Filter by job source type (e.g., Manual, Schedule, Queue, Agent)", parseFilterValue).option("--created-after <datetime>", "Jobs created on or after (ISO 8601)", parseFilterValue).option("--created-before <datetime>", "Jobs created before (ISO 8601)", parseFilterValue).option("--started-after <datetime>", "Jobs started on or after (ISO 8601)", parseFilterValue).option("--started-before <datetime>", "Jobs started before (ISO 8601)", parseFilterValue).option("--ended-after <datetime>", "Jobs ended on or after (ISO 8601)", parseFilterValue).option("--ended-before <datetime>", "Jobs ended before (ISO 8601)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(JOBS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
5261
+ if (refuseListFolderScope(options))
4872
5262
  return;
4873
- }
4874
5263
  const [apiError, api] = await catchError(createApiClient2(JobsApi2, {
4875
5264
  tenant: options.tenant,
4876
5265
  folderPath: options.folderPath,
@@ -4972,7 +5361,7 @@ var registerJobsCommand = (program) => {
4972
5361
  }
4973
5362
  const [error, result] = await catchError(api.jobsGet({
4974
5363
  $filter: filters.length > 0 ? filters.join(" and ") : undefined,
4975
- $expand: "Release($select=Key),Machine($select=Key)",
5364
+ $expand: JOB_KEYS_EXPAND,
4976
5365
  $top: parseInt(options.limit || "50", 10),
4977
5366
  $skip: parseInt(options.offset || "0", 10),
4978
5367
  $orderby: options.sortBy
@@ -4982,7 +5371,14 @@ var registerJobsCommand = (program) => {
4982
5371
  return;
4983
5372
  }
4984
5373
  const items = result.value ?? [];
4985
- const jobList = options.allFields ? items : items.map(formatJob);
5374
+ let listFolderKey = options.folderKey;
5375
+ if (!options.allFields && options.folderPath !== undefined && !listFolderKey && items.some((job) => !job.folderKey)) {
5376
+ listFolderKey = (await lookUpFolderForRows({ folderPath: options.folderPath }, options.tenant, "Jobs listed, but their folder key could not be read"))?.key;
5377
+ }
5378
+ const jobList = options.allFields ? items : items.map((job) => formatJob(job, {
5379
+ folderKey: listFolderKey,
5380
+ folderPath: options.folderPath
5381
+ }));
4986
5382
  OutputFormatter.success({
4987
5383
  Result: RESULTS.Success,
4988
5384
  Code: "JobList",
@@ -4994,7 +5390,9 @@ var registerJobsCommand = (program) => {
4994
5390
  Data: jobList
4995
5391
  });
4996
5392
  });
4997
- jobs.command("get").description("Get a job by its key (GUID). " + "Returns state, input/output arguments, timing, machine info, and error details if faulted. " + "If the job is in Pending state, also includes diagnostic reasons (robot availability, capacity, etc.). " + "No folder context needed — the key is globally unique, so the lookup is tenant-wide; " + "pass --folder-path/--folder-key to require the job to be in that folder. " + "Use 'jobs list' to find job keys.").argument("<job-key>", "Job key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide").option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide").option("--output-dir <path>", "Directory for downloading OutputFile (default: current directory)").option("--no-download", "Skip automatic OutputFile download").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(JOBS_GET_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
5393
+ jobs.command("get").description("Get a job by its key (GUID). " + "Returns state, input/output arguments, timing, machine info, and error details if faulted. " + "If the job is in Pending state, also includes diagnostic reasons (robot availability, capacity, etc.). " + "No folder context needed — the key is globally unique, so the lookup is tenant-wide; " + "pass --folder-path/--folder-key to require the job to be in that folder. " + "Use 'jobs list' to find job keys.").argument("<job-key>", "Job key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide", parseFolderKey).option("--output-dir <path>", "Directory for downloading OutputFile (default: current directory)").option("--no-download", "Skip automatic OutputFile download").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(JOBS_GET_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
5394
+ if (refuseBothFolderSelectors(options))
5395
+ return;
4998
5396
  if (!isGuid(jobKey)) {
4999
5397
  OutputFormatter.error({
5000
5398
  Result: RESULTS.Failure,
@@ -5036,7 +5434,15 @@ var registerJobsCommand = (program) => {
5036
5434
  Data: data
5037
5435
  });
5038
5436
  });
5039
- jobs.command("start").description("Start a job for a process. Returns the created job(s) with keys. " + "The <process-key> is the GUID from 'processes list' (not 'packages list'). " + "Folder is optional — if not provided, it is inferred from the process. " + "Use 'packages entry-points' to see input/output argument schemas for the process.").argument("<process-key>", "Process key (GUID) from 'processes list'. Identifies which process to run.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (optional — inferred from process if not provided)").option("--folder-key <key>", "Folder key (optional — inferred from process if not provided)").option("--strategy <strategy>", "Execution strategy (ModernJobsCount, All, Specific, JobsCount). Specific runs the job on the robots of the users given with --user-keys and takes no --jobs-count or --machine-keys", "ModernJobsCount").option("--jobs-count <number>", "Number of jobs to create (for JobsCount/ModernJobsCount strategy)", "1").option("--entry-point <path>", "Entry point to run, by its path, for a process whose package has several. " + "Defaults to the entry point of the process. " + "Use 'packages entry-points' to list the paths.").option("--input-arguments <json>", "Input arguments as JSON string (mutually exclusive with --input-file). " + "Auto-offloads to InputFile if >10K chars. " + "Use 'packages entry-points' to see the expected schema.").option("--input-file <path>", "Upload a file as the job's InputFile (mutually exclusive with --input-arguments). " + "The file is uploaded as an attachment and its ID is set on the InputFile field.").option("--attachment <[name=]path>", "Upload a file and attach it to the job (repeatable). " + "Format: path (linked to the job only) or name=path (also sets input argument 'name' to the file; " + "'name' must not be a key in --input-arguments, and --input-file cannot be used). " + "Example: --attachment ./doc.pdf --attachment invoice=./report.pdf", (val, prev) => prev ? [...prev, val] : [val]).option("--attachment-id <guid>", "Attach an existing attachment by ID (repeatable). " + "Use 'attachments list --job-key <key>' to find IDs from a previous job.", (val, prev) => prev ? [...prev, val] : [val]).option("--runtime-type <type>", "Execution runtime (Unattended, Headless, Serverless, NonProduction, Development, TestAutomation, Local). Local runs Agent, Function and API workflow jobs on the folder machines' local slots. Defaults to folder configuration.").option("--user-keys <keys>", "Comma-separated user keys (GUIDs) to run as. Required with --strategy Specific. Use 'users list' to find keys.").option("--machine-keys <keys>", "Comma-separated machine keys (GUIDs) to target. Use 'machines list' to find keys.").option("--environment-variables <pairs>", "Environment variables as newline-separated KEY=VALUE pairs").option("--run-as-me", "Run job under the caller's identity").option("--healing-agent", "Enable Healing Agent (Autopilot for Robots) for this run. Use to recover from selector failures and similar runtime errors. Tenant-level Autopilot must already be enabled.").option("--job-priority <priority>", "Job priority (Low, Normal, High)").option("--reference <reference>", "User-specified reference for the job").option("--wait-for-completion", "Poll until the job reaches a terminal state (Successful, Faulted, Stopped) and return its output").option("--timeout <seconds>", "Maximum time to wait for completion in seconds (default: 300)", "300").option("--poll-interval <seconds>", "Seconds between status checks (default: 5)", "5").option("--output-dir <path>", "Directory for downloading OutputFile (default: current directory). Only with --wait-for-completion.").option("--no-download", "Skip automatic OutputFile download. Only with --wait-for-completion.").examples(JOBS_START_EXAMPLES).trackedAction(processContext, async (releaseKey, options) => {
5437
+ jobs.command("start").description("Start a job for a process. Returns the created job(s) with keys. " + "The <process-key> is the GUID from 'processes list' (not 'packages list'). " + "Folder is optional — if not provided, it is inferred from the process. " + "Use 'packages entry-points' to see input/output argument schemas for the process.").argument("<process-key>", "Process key (GUID) from 'processes list'. Identifies which process to run.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (optional — inferred from process if not provided)", parseFolderPath).option("--folder-key <key>", "Folder key (optional — inferred from process if not provided)", parseFolderKey).option("--strategy <strategy>", "Execution strategy (ModernJobsCount, All, Specific, JobsCount). Specific runs the job on the robots of the users given with --user-keys and takes no --jobs-count or --machine-keys", "ModernJobsCount").option("--jobs-count <number>", "Number of jobs to create (for JobsCount/ModernJobsCount strategy)", "1").option("--entry-point <path>", "Entry point to run, by its path, for a process whose package has several. " + "Defaults to the entry point of the process. " + "Use 'packages entry-points' to list the paths.").option("--input-arguments <json>", "Input arguments as JSON string (mutually exclusive with --input-file and --input-arguments-file). " + "Auto-offloads to InputFile if >10K chars. " + "Use 'packages entry-points' to see the expected schema.").addOption(new Option("--input-arguments-file <path>", `${jsonFileOptionHelp("--input-arguments")} Mutually exclusive with --input-file.`).conflicts(["inputArguments", "inputFile"])).option("--input-file <path>", "Upload a file as the job's InputFile (mutually exclusive with --input-arguments and --input-arguments-file). " + "The file is uploaded as an attachment and its ID is set on the InputFile field.").option("--attachment <[name=]path>", "Upload a file and attach it to the job (repeatable). " + "Format: path (linked to the job only) or name=path (also sets input argument 'name' to the file; " + "'name' must not be a key in --input-arguments, and --input-file cannot be used). " + "Example: --attachment ./doc.pdf --attachment invoice=./report.pdf", (val, prev) => prev ? [...prev, val] : [val]).option("--attachment-id <guid>", "Attach an existing attachment by ID (repeatable). " + "Use 'attachments list --job-key <key>' to find IDs from a previous job.", (val, prev) => prev ? [...prev, val] : [val]).option("--runtime-type <type>", "Execution runtime (Unattended, Headless, Serverless, NonProduction, Development, TestAutomation, Local). Local runs Agent, Function and API workflow jobs on the folder machines' local slots. Defaults to folder configuration.").option("--user-keys <keys>", "Comma-separated user keys (GUIDs) to run as. Required with --strategy Specific. Use 'users list' to find keys.").option("--machine-keys <keys>", "Comma-separated machine keys (GUIDs) to target. Use 'machines list' to find keys.").option("--environment-variables <pairs>", "Environment variables as newline-separated KEY=VALUE pairs").option("--run-as-me", "Run job under the caller's identity").option("--healing-agent", "Enable Healing Agent (Autopilot for Robots) for this run. Use to recover from selector failures and similar runtime errors. Tenant-level Autopilot must already be enabled.").option("--job-priority <priority>", "Job priority (Low, Normal, High)").option("--reference <reference>", "User-specified reference for the job").option("--wait-for-completion", "Poll until the job reaches a terminal state (Successful, Faulted, Stopped) and return its output").option("--timeout <seconds>", "Maximum time to wait for completion in seconds (default: 300)", "300").option("--poll-interval <seconds>", "Seconds between status checks (default: 5)", "5").option("--output-dir <path>", "Directory for downloading OutputFile (default: current directory). Only with --wait-for-completion.").option("--no-download", "Skip automatic OutputFile download. Only with --wait-for-completion.").examples(JOBS_START_EXAMPLES).trackedAction(processContext, async (releaseKey, options) => {
5438
+ const inputArguments = await resolveJsonFileOption({
5439
+ inline: options.inputArguments,
5440
+ file: options.inputArgumentsFile,
5441
+ ...INPUT_ARGUMENTS_FLAGS
5442
+ });
5443
+ if (inputArguments === null)
5444
+ return;
5445
+ options.inputArguments = inputArguments?.text;
5040
5446
  const validStrategies = [
5041
5447
  "ModernJobsCount",
5042
5448
  "All",
@@ -5089,19 +5495,6 @@ var registerJobsCommand = (program) => {
5089
5495
  return;
5090
5496
  }
5091
5497
  }
5092
- if (options.inputArguments !== undefined) {
5093
- const [parseError] = catchError(() => JSON.parse(options.inputArguments));
5094
- if (parseError) {
5095
- OutputFormatter.error({
5096
- Result: RESULTS.Failure,
5097
- Message: "Error starting job",
5098
- ErrorCode: "invalid_argument",
5099
- Instructions: `Invalid JSON in --input-arguments. Provide a valid JSON object, e.g. '{"key":"value"}'.`
5100
- });
5101
- processContext.exit(1);
5102
- return;
5103
- }
5104
- }
5105
5498
  const [attachmentParseError, attachmentArgs] = await catchError(Promise.all((options.attachment ?? []).map(parseAttachmentArg)));
5106
5499
  if (attachmentParseError) {
5107
5500
  OutputFormatter.error({
@@ -5322,7 +5715,15 @@ var registerJobsCommand = (program) => {
5322
5715
  if (!options.waitForCompletion || !jobKey) {
5323
5716
  const outputData = {};
5324
5717
  if (jobs.length > 0) {
5325
- outputData.Jobs = jobs.map(formatJob);
5718
+ let startedIn = folderPath || inferredRelease?.folderName;
5719
+ if (!startedIn && folderKey && jobs.some((job) => !job.organizationUnitFullyQualifiedName)) {
5720
+ startedIn = (await lookUpFolderForRows({ folderKey }, options.tenant, "Job started, but its folder path could not be read"))?.path;
5721
+ }
5722
+ outputData.Jobs = jobs.map((job) => formatJob(job, {
5723
+ releaseKey,
5724
+ folderKey,
5725
+ folderPath: startedIn
5726
+ }));
5326
5727
  } else {
5327
5728
  outputData.Status = "Job start requested";
5328
5729
  }
@@ -5480,12 +5881,25 @@ var registerJobsCommand = (program) => {
5480
5881
  Result: RESULTS.Success,
5481
5882
  Code: "JobRestarted",
5482
5883
  Data: {
5483
- Jobs: [formatJob(result)],
5884
+ Jobs: [
5885
+ formatJob(result, {
5886
+ folderKey: resolved.folderKey,
5887
+ folderPath: resolved.folderName,
5888
+ releaseKey: resolved.job.release?.key
5889
+ })
5890
+ ],
5484
5891
  Status: "Restart requested"
5485
5892
  }
5486
5893
  });
5487
5894
  });
5488
- jobs.command("resume").description("Resume a suspended job. Jobs become suspended when they use the 'Suspend' activity " + "(long-running workflows that wait for external input). " + "Optionally pass new --input-arguments to continue execution with updated data. " + "No folder context needed — resolved from job key.").argument("<job-key>", "Job key (GUID) to resume").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--input-arguments <json>", "Input arguments as JSON string").examples(JOBS_RESUME_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
5895
+ jobs.command("resume").description("Resume a suspended job. Jobs become suspended when they use the 'Suspend' activity " + "(long-running workflows that wait for external input). " + "Optionally pass new --input-arguments to continue execution with updated data. " + "No folder context needed — resolved from job key.").argument("<job-key>", "Job key (GUID) to resume").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--input-arguments <json>", "Input arguments as JSON string").addOption(new Option("--input-arguments-file <path>", jsonFileOptionHelp("--input-arguments")).conflicts("inputArguments")).examples(JOBS_RESUME_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
5896
+ const inputArguments = await resolveJsonFileOption({
5897
+ inline: options.inputArguments,
5898
+ file: options.inputArgumentsFile,
5899
+ ...INPUT_ARGUMENTS_FLAGS
5900
+ });
5901
+ if (inputArguments === null)
5902
+ return;
5489
5903
  const command = await resolveJobWithJobsApi(jobKey, options.tenant, "Error resuming job");
5490
5904
  if (command === null)
5491
5905
  return;
@@ -5493,7 +5907,7 @@ var registerJobsCommand = (program) => {
5493
5907
  const [error, result] = await catchError(api.jobsResumeJob({
5494
5908
  body: {
5495
5909
  jobKey,
5496
- inputArguments: options.inputArguments
5910
+ inputArguments: inputArguments?.text
5497
5911
  }
5498
5912
  }));
5499
5913
  if (error) {
@@ -5511,7 +5925,9 @@ var registerJobsCommand = (program) => {
5511
5925
  }
5512
5926
  });
5513
5927
  });
5514
- jobs.command("logs").description("Get robot execution logs for a job. " + "Filter by --level to quickly find errors. " + "Folder context is inferred from the job key; pass --folder-path/--folder-key to require the job to be in that folder. " + "Logs are returned newest-first.").argument("<job-key>", "Job key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide").option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide").option("--level <level>", `Filter by log level (${JOB_LOG_LEVELS.join(", ")})`).option("-l, --limit <number>", "Number of log entries to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of entries to skip", "0").option("--export", "Export logs to CSV file instead of listing in terminal").option("-d, --destination <path>", "CSV export file path (only with --export)").addOption(new Option("-o, --output <path>", "Deprecated alias for --destination").hideHelp()).examples(JOBS_LOGS_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
5928
+ jobs.command("logs").description("Get robot execution logs for a job. " + "Filter by --level to quickly find errors. " + "Folder context is inferred from the job key; pass --folder-path/--folder-key to require the job to be in that folder. " + "Logs are returned newest-first.").argument("<job-key>", "Job key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide", parseFolderKey).option("--level <level>", `Filter by log level (${JOB_LOG_LEVELS_HELP})`, parseFilterValue).option("-l, --limit <number>", `Number of log entries to return, read ${ROBOT_LOGS_PAGE_SIZE} per request. Automation Cloud reaches only the newest 10000 matching entries: keep --offset plus --limit at or below 10000`, String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of entries to skip", "0").option("--export", "Export logs to CSV file instead of listing in terminal").option("-d, --destination <path>", "CSV export file path (only with --export)").addOption(new Option("-o, --output <path>", "Deprecated alias for --destination").hideHelp()).examples(JOBS_LOGS_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
5929
+ if (refuseBothFolderSelectors(options))
5930
+ return;
5515
5931
  if (!isGuid(jobKey)) {
5516
5932
  OutputFormatter.error({
5517
5933
  Result: RESULTS.Failure,
@@ -5530,6 +5946,18 @@ var registerJobsCommand = (program) => {
5530
5946
  processContext.exit(1);
5531
5947
  return;
5532
5948
  }
5949
+ const level = options.level === undefined ? undefined : resolveJobLogLevel(options.level);
5950
+ if (options.level !== undefined && level === undefined) {
5951
+ return reportUsageError(`Invalid --level value '${options.level}'.`, `Use one of: ${JOB_LOG_LEVELS_HELP}.`);
5952
+ }
5953
+ const limit = parsePositiveInteger(options.limit);
5954
+ if (limit === undefined) {
5955
+ return reportUsageError(`Invalid --limit value '${options.limit}'.`, "Provide a positive integer for --limit.");
5956
+ }
5957
+ const offset = parseNonNegativeInteger(options.offset);
5958
+ if (offset === undefined) {
5959
+ return reportUsageError(`Invalid --offset value '${options.offset}'.`, "Provide zero or a positive integer for --offset.");
5960
+ }
5533
5961
  const resolved = await resolveJobForCommand(jobKey, options.tenant, "Error getting job logs", options);
5534
5962
  if (resolved === null)
5535
5963
  return;
@@ -5546,20 +5974,9 @@ var registerJobsCommand = (program) => {
5546
5974
  processContext.exit(1);
5547
5975
  return;
5548
5976
  }
5549
- if (options.level) {
5550
- if (!JOB_LOG_LEVELS.includes(options.level)) {
5551
- OutputFormatter.error({
5552
- Result: RESULTS.Failure,
5553
- Message: "Invalid --level value",
5554
- Instructions: `Valid levels: ${JOB_LOG_LEVELS.join(", ")}`
5555
- });
5556
- processContext.exit(1);
5557
- return;
5558
- }
5559
- }
5560
5977
  const filters = [`JobKey eq ${jobKey}`];
5561
- if (options.level) {
5562
- filters.push(`Level eq '${options.level}'`);
5978
+ if (level !== undefined) {
5979
+ filters.push(`Level eq '${level}'`);
5563
5980
  }
5564
5981
  const $filter = filters.join(" and ");
5565
5982
  if (options.export) {
@@ -5611,17 +6028,17 @@ var registerJobsCommand = (program) => {
5611
6028
  });
5612
6029
  return;
5613
6030
  }
5614
- const [error, result] = await catchError(api.robotLogsGet({
5615
- $filter,
5616
- $orderby: "TimeStamp desc",
5617
- $top: parseInt(options.limit || "50", 10),
5618
- $skip: parseInt(options.offset || "0", 10)
6031
+ const [error, rows] = await catchError(readJobLogRows(api, {
6032
+ filter: $filter,
6033
+ limit,
6034
+ offset,
6035
+ jobStartedAt: resolved.job.startTime ?? undefined
5619
6036
  }));
5620
6037
  if (error) {
5621
6038
  await reportFailure2("Error getting job logs", error);
5622
6039
  return;
5623
6040
  }
5624
- const logs = (result.value ?? []).map((log) => ({
6041
+ const logs = rows.map((log) => ({
5625
6042
  Level: log.level || "",
5626
6043
  TimeStamp: log.timeStamp ? new Date(log.timeStamp).toISOString() : "",
5627
6044
  Message: log.message || ""
@@ -5631,8 +6048,8 @@ var registerJobsCommand = (program) => {
5631
6048
  Code: "JobLogs",
5632
6049
  Pagination: new Pagination({
5633
6050
  returned: logs.length,
5634
- limit: parseInt(options.limit, 10),
5635
- offset: parseInt(options.offset || "0", 10)
6051
+ limit,
6052
+ offset
5636
6053
  }),
5637
6054
  Data: logs
5638
6055
  });
@@ -5647,7 +6064,7 @@ var registerJobsCommand = (program) => {
5647
6064
  });
5648
6065
  processContext.exit(1);
5649
6066
  });
5650
- const healingData = jobs.command("healing-data").description("Download healing agent (Autopilot for Robots) recovery data as a ZIP file. " + "Contains screenshots, UI element data, and recovery logs. " + "Only available for jobs where the healing agent was active. " + "Triggers an async export, polls until complete, then downloads the ZIP.").argument("<job-key>", "Job key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--directory-prefix <prefix>", "Path prefix to filter exported files").option("-d, --destination <path>", "Output file path (defaults to healing-agent-data-<job-key>.zip)").examples(JOBS_HEALING_DATA_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
6067
+ const healingData = jobs.command("healing-data").description("Download healing agent (Autopilot for Robots) recovery data as a ZIP file. " + "Contains screenshots, UI element data, and recovery logs. " + "Only available for jobs where the healing agent was active. " + "Triggers an async export, polls until complete, then downloads the ZIP.").argument("<job-key>", "Job key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--directory-prefix <prefix>", "Path prefix to filter exported files", parseFilterValue).option("-d, --destination <path>", "Output file path (defaults to healing-agent-data-<job-key>.zip)").examples(JOBS_HEALING_DATA_EXAMPLES).trackedAction(processContext, async (jobKey, options) => {
5651
6068
  const resolved = await resolveJobForCommand(jobKey, options.tenant, "Error getting healing data");
5652
6069
  if (resolved === null)
5653
6070
  return;
@@ -5778,7 +6195,7 @@ var registerJobsCommand = (program) => {
5778
6195
  return;
5779
6196
  }
5780
6197
  const fileName = options.destination || `healing-agent-data-${jobKey}.zip`;
5781
- const { getFileSystem } = await import("./index-3b7n9344.js");
6198
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
5782
6199
  const fs = getFileSystem();
5783
6200
  const [writeError] = await catchError(fs.writeFile(fileName, Buffer.from(buffer)));
5784
6201
  if (writeError) {
@@ -5840,7 +6257,7 @@ async function buildJobCompletionOutput(job, elapsedMs, options) {
5840
6257
  data.Duration = `${Math.round(elapsedMs / 1000)}s`;
5841
6258
  }
5842
6259
  if (job.outputFile && options.download !== false) {
5843
- const { getFileSystem } = await import("./index-3b7n9344.js");
6260
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
5844
6261
  const fsHelper = getFileSystem();
5845
6262
  const outputDir = options.outputDir || ".";
5846
6263
  const fileName = fsHelper.path.join(outputDir, `output-${job.key || "job"}.dat`);
@@ -6091,7 +6508,7 @@ var LIBRARIES_UPLOAD_EXAMPLES = [
6091
6508
  ];
6092
6509
  var registerLibrariesCommand = (program) => {
6093
6510
  const libraries = program.command("libraries").description("Manage Orchestrator libraries (reusable .nupkg packages containing shared activities and logic). Libraries are tenant-scoped.");
6094
- libraries.command("list").description("List libraries in the tenant feed. " + "No folder needed — libraries are tenant-scoped.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-s, --search <term>", "Search libraries by name (contains match)").option("--feed-id <feed-id>", "Target a specific feed by ID").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(LIBRARIES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
6511
+ libraries.command("list").description("List libraries in the tenant feed. " + "No folder needed — libraries are tenant-scoped.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-s, --search <term>", "Search libraries by name (contains match)", parseFilterValue).option("--feed-id <feed-id>", "Target a specific feed by ID").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(LIBRARIES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
6095
6512
  const [apiError, api] = await catchError(createApiClient2(LibrariesApi2, {
6096
6513
  tenant: options.tenant
6097
6514
  }));
@@ -7068,7 +7485,7 @@ var MACHINES_UNASSIGN_EXAMPLES = [
7068
7485
  ];
7069
7486
  var registerMachinesCommand = (program) => {
7070
7487
  const machines = program.command("machines").description("Manage UiPath Orchestrator machines (robot host definitions). " + "Machines define the hosts where robots execute automations, along with their license slot allocations. " + "Machines are tenant-scoped but can be assigned to specific folders.");
7071
- machines.command("list").description("List machines. " + "Without --folder-key or --folder-path, returns all machines in the tenant. " + "With --folder-key or --folder-path, returns machines assigned to that folder. " + "Use the machine key with 'machines get', 'machines update', or 'machines delete'.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find").option("--folder-path <path>", "Folder path (e.g., 'Shared', 'Production/SubFolder')").option("-n, --name <name>", "Filter by machine name (contains match)").option("--scope <scope>", "Filter by machine scope (Default, Serverless, AutomationCloudRobot, ElasticRobot)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(MACHINES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
7488
+ machines.command("list").description("List machines. " + "Without --folder-key or --folder-path, returns all machines in the tenant. " + "With --folder-key or --folder-path, returns machines assigned to that folder. " + "Use the machine key with 'machines get', 'machines update', or 'machines delete'.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find", parseFolderKey).option("--folder-path <path>", "Folder path (e.g., 'Shared', 'Production/SubFolder')", parseFolderPath).option("-n, --name <name>", "Filter by machine name (contains match)", parseFilterValue).option("--scope <scope>", "Filter by machine scope (Default, Serverless, AutomationCloudRobot, ElasticRobot)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(MACHINES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
7072
7489
  if (options.scope && !VALID_SCOPES.includes(options.scope)) {
7073
7490
  OutputFormatter.error({
7074
7491
  Result: RESULTS.Failure,
@@ -7318,7 +7735,7 @@ var registerMachinesCommand = (program) => {
7318
7735
  });
7319
7736
  }
7320
7737
  });
7321
- machines.command("assign").description("Assign one or more machines to a folder. " + "Machines must exist in the tenant before they can be assigned. " + "Requires --folder-path or --folder-key to specify the target folder. " + "Use 'folders list' to find available folders.").argument("<machine-keys...>", "One or more machine keys (GUIDs) to assign").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared') — required").option("--folder-key <key>", "Target folder key (GUID) — required").examples(MACHINES_ASSIGN_EXAMPLES).trackedAction(processContext, async (machineKeys, options) => {
7738
+ machines.command("assign").description("Assign one or more machines to a folder. " + "Machines must exist in the tenant before they can be assigned. " + "Requires --folder-path or --folder-key to specify the target folder. " + "Use 'folders list' to find available folders.").argument("<machine-keys...>", "One or more machine keys (GUIDs) to assign").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared') — required", parseFolderPath).option("--folder-key <key>", "Target folder key (GUID) — required", parseFolderKey).examples(MACHINES_ASSIGN_EXAMPLES).trackedAction(processContext, async (machineKeys, options) => {
7322
7739
  const command = await prepareFolderMachineCommand(machineKeys, options, "Error assigning machines");
7323
7740
  if (command === null)
7324
7741
  return;
@@ -7349,7 +7766,7 @@ var registerMachinesCommand = (program) => {
7349
7766
  }
7350
7767
  });
7351
7768
  });
7352
- machines.command("unassign").description("Remove one or more machines from a folder. " + "The machines are not deleted — only their folder assignment is removed. " + "Requires --folder-path or --folder-key to specify which folder to unassign from. " + "Use 'folders list' to find available folders.").argument("<machine-keys...>", "One or more machine keys (GUIDs) to unassign").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path to unassign from (e.g., 'Shared') — required").option("--folder-key <key>", "Folder key (GUID) to unassign from — required").examples(MACHINES_UNASSIGN_EXAMPLES).trackedAction(processContext, async (machineKeys, options) => {
7769
+ machines.command("unassign").description("Remove one or more machines from a folder. " + "The machines are not deleted — only their folder assignment is removed. " + "Requires --folder-path or --folder-key to specify which folder to unassign from. " + "Use 'folders list' to find available folders.").argument("<machine-keys...>", "One or more machine keys (GUIDs) to unassign").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path to unassign from (e.g., 'Shared') — required", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) to unassign from — required", parseFolderKey).examples(MACHINES_UNASSIGN_EXAMPLES).trackedAction(processContext, async (machineKeys, options) => {
7353
7770
  const command = await prepareFolderMachineCommand(machineKeys, options, "Error unassigning machines");
7354
7771
  if (command === null)
7355
7772
  return;
@@ -7382,6 +7799,7 @@ function toFolderFeedId(answer) {
7382
7799
  return !feedId || feedId === "null" ? undefined : feedId;
7383
7800
  }
7384
7801
  async function getFolderFeedId(api, folderKey) {
7802
+ assertFolderKey(folderKey);
7385
7803
  return toFolderFeedId(await api.packageFeedsGetFolderFeedByKey({ folderKey }));
7386
7804
  }
7387
7805
 
@@ -7781,7 +8199,7 @@ var PACKAGES_DOWNLOAD_EXAMPLES = [
7781
8199
  ];
7782
8200
  var registerPackagesCommand = (program) => {
7783
8201
  const packages = program.command("packages").description("Manage UiPath automation packages (.nupkg) in the Orchestrator feed. " + "Packages are uploaded code artifacts. Use 'processes' to manage runnable process bindings in folders.");
7784
- packages.command("list").description("List all automation packages in the feed. " + "Returns package key (format: PackageId:Version), title, version, and metadata. " + "Use --search to filter by name. Reads the tenant feed unless --feed-id, --folder-path or --folder-key names another; " + "a Personal Workspace feed needs a role on that workspace, which its owner's user session ('uip login') has.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-s, --search <term>", "Search packages by name").option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION).option("--all-fields", "Return all fields from the API response instead of a curated summary").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").examples(PACKAGES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
8202
+ packages.command("list").description("List all automation packages in the feed. " + "Returns package key (format: PackageId:Version), title, version, and metadata. " + "Use --search to filter by name. Reads the tenant feed unless --feed-id, --folder-path or --folder-key names another; " + "a Personal Workspace feed needs a role on that workspace, which its owner's user session ('uip login') has.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-s, --search <term>", "Search packages by name", parseFilterValue).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION, parseFolderKey).option("--all-fields", "Return all fields from the API response instead of a curated summary").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").examples(PACKAGES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
7785
8203
  const [targetError, target] = await catchError(resolvePackageFeedTarget(options));
7786
8204
  if (targetError) {
7787
8205
  await reportFailure2("Error resolving package feed", targetError);
@@ -7865,7 +8283,7 @@ var registerPackagesCommand = (program) => {
7865
8283
  }
7866
8284
  });
7867
8285
  });
7868
- packages.command("versions").description("List all available versions of a package. " + "For folder-feed versions, use --folder-path or --folder-key. " + "Use this to find specific versions before creating a process with 'processes create --package-version'.").argument("<package-id>", "Package ID (e.g., 'MyProcess')").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(PACKAGES_VERSIONS_EXAMPLES).trackedAction(processContext, async (packageId, options) => {
8286
+ packages.command("versions").description("List all available versions of a package. " + "For folder-feed versions, use --folder-path or --folder-key. " + "Use this to find specific versions before creating a process with 'processes create --package-version'.").argument("<package-id>", "Package ID (e.g., 'MyProcess')").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION, parseFolderKey).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(PACKAGES_VERSIONS_EXAMPLES).trackedAction(processContext, async (packageId, options) => {
7869
8287
  const [targetError, target] = await catchError(resolvePackageFeedTarget(options));
7870
8288
  if (targetError) {
7871
8289
  await reportFailure2("Error resolving package feed", targetError);
@@ -7944,7 +8362,7 @@ var registerPackagesCommand = (program) => {
7944
8362
  });
7945
8363
  }
7946
8364
  });
7947
- const upload = packages.command("upload").description("Upload a process .nupkg to the Orchestrator processes feed. " + "After upload, use 'processes create' to bind the package to a folder for execution. " + "Libraries (packed with --output-type Library) belong in the libraries feed instead — " + "upload those with 'libraries upload'.").argument("<file>", "Path to .nupkg file to upload").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION).option("--force", "Upload a library package to the processes feed anyway", false).examples(PACKAGES_UPLOAD_EXAMPLES).trackedAction(processContext, async (filePath, options, command) => {
8365
+ const upload = packages.command("upload").description("Upload a process .nupkg to the Orchestrator processes feed. " + "After upload, use 'processes create' to bind the package to a folder for execution. " + "Libraries (packed with --output-type Library) belong in the libraries feed instead — " + "upload those with 'libraries upload'.").argument("<file>", "Path to .nupkg file to upload").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION, parseFolderKey).option("--force", "Upload a library package to the processes feed anyway", false).examples(PACKAGES_UPLOAD_EXAMPLES).trackedAction(processContext, async (filePath, options, command) => {
7948
8366
  const [targetError, target] = await catchError(resolvePackageFeedTarget(options));
7949
8367
  if (targetError) {
7950
8368
  await reportFailure2("Error resolving package feed", targetError);
@@ -7963,7 +8381,7 @@ var registerPackagesCommand = (program) => {
7963
8381
  processContext.exit(1);
7964
8382
  return;
7965
8383
  }
7966
- const { getFileSystem } = await import("./index-3b7n9344.js");
8384
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
7967
8385
  const fs = getFileSystem();
7968
8386
  const [readError, fileBuffer] = await catchError(fs.readFile(filePath));
7969
8387
  if (readError || fileBuffer === null) {
@@ -8065,7 +8483,7 @@ var registerPackagesCommand = (program) => {
8065
8483
  }, getProjectTelemetryCapture(command));
8066
8484
  });
8067
8485
  configureProjectTelemetry(upload, packageIdentityFloor);
8068
- packages.command("delete").description("Delete a package version from the Orchestrator processes feed. " + "The key format is 'PackageId:Version' (e.g., 'MyProcess:1.0.0'). " + "Use 'packages list' or 'packages versions' to find the key. " + "Deleting a package a process is bound to leaves that process without a version to run.").argument("<key>", "Package version key (format: 'PackageId:Version', e.g., 'MyProcess:1.0.0')").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(PACKAGES_DELETE_EXAMPLES).trackedAction(processContext, async (key, options) => {
8486
+ packages.command("delete").description("Delete a package version from the Orchestrator processes feed. " + "The key format is 'PackageId:Version' (e.g., 'MyProcess:1.0.0'). " + "Use 'packages list' or 'packages versions' to find the key. " + "Deleting a package a process is bound to leaves that process without a version to run.").argument("<key>", "Package version key (format: 'PackageId:Version', e.g., 'MyProcess:1.0.0')").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION, parseFolderKey).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(PACKAGES_DELETE_EXAMPLES).trackedAction(processContext, async (key, options) => {
8069
8487
  if (!requireConfirmation(options, `delete package '${key}'`)) {
8070
8488
  return;
8071
8489
  }
@@ -8127,7 +8545,7 @@ var registerPackagesCommand = (program) => {
8127
8545
  }, target)
8128
8546
  });
8129
8547
  });
8130
- packages.command("download").description("Download a .nupkg automation package from the Orchestrator feed. " + "Use 'PackageId:Version' (e.g., 'MyProcess:1.0.0') or 'PackageId --version <version>'. " + "For folder-feed versions, use --folder-path or --folder-key. " + "Use 'packages list' or 'packages versions' to find the key.").argument("<key>", "Package ID or version key (e.g., 'MyProcess' or 'MyProcess:1.0.0')").option("--version <version>", "Package version to download").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION).requiredOption("-d, --destination <file>", "Destination file path to save the downloaded package").examples(PACKAGES_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (key, options) => {
8548
+ packages.command("download").description("Download a .nupkg automation package from the Orchestrator feed. " + "Use 'PackageId:Version' (e.g., 'MyProcess:1.0.0') or 'PackageId --version <version>'. " + "For folder-feed versions, use --folder-path or --folder-key. " + "Use 'packages list' or 'packages versions' to find the key.").argument("<key>", "Package ID or version key (e.g., 'MyProcess' or 'MyProcess:1.0.0')").option("--version <version>", "Package version to download").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--feed-id <feedId>", FEED_ID_OPTION_DESCRIPTION).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", FOLDER_KEY_OPTION_DESCRIPTION, parseFolderKey).requiredOption("-d, --destination <file>", "Destination file path to save the downloaded package").examples(PACKAGES_DOWNLOAD_EXAMPLES).trackedAction(processContext, async (key, options) => {
8131
8549
  const downloadKey = resolveDownloadKey(key, options.version);
8132
8550
  if (downloadKey === undefined) {
8133
8551
  return;
@@ -8176,7 +8594,7 @@ var registerPackagesCommand = (program) => {
8176
8594
  await reportFailure2("Error downloading package", bufferError);
8177
8595
  return;
8178
8596
  }
8179
- const { getFileSystem } = await import("./index-3b7n9344.js");
8597
+ const { getFileSystem } = await import("./index-2s4ngbj7.js");
8180
8598
  const fs = getFileSystem();
8181
8599
  const buffer = new Uint8Array(arrayBuffer);
8182
8600
  const [writeError] = await catchError(fs.writeFile(options.destination, buffer));
@@ -8226,7 +8644,7 @@ var QUEUE_ROI_KIND = {
8226
8644
  var DEFAULT_TIME_UNIT = "Minutes";
8227
8645
  var DEFAULT_VOLUME_PERIOD = "Month";
8228
8646
  var DEFAULT_COST_PERIOD = "Annual";
8229
- var parseNonNegativeInteger = (label) => (raw) => {
8647
+ var parseNonNegativeInteger2 = (label) => (raw) => {
8230
8648
  const normalized = raw.trim();
8231
8649
  if (!/^\d+$/.test(normalized) || !Number.isSafeInteger(Number(normalized))) {
8232
8650
  throw new InvalidArgumentError(`${label} must be a whole number of 0 or more, got '${raw}'.`);
@@ -8242,14 +8660,14 @@ var parseNonNegativeAmount = (label) => (raw) => {
8242
8660
  return value;
8243
8661
  };
8244
8662
  function addRoiScopeOptions(cmd, noun) {
8245
- return cmd.option("--folder-path <path>", `Folder path the ${noun} name is looked up in (e.g., 'Shared'); not needed for a key`).option("--folder-key <key>", `Folder key (GUID) the ${noun} name is looked up in; not needed for a key`);
8663
+ return cmd.option("--folder-path <path>", `Folder path the ${noun} name is looked up in (e.g., 'Shared'); not needed for a key`, parseFolderPath).option("--folder-key <key>", `Folder key (GUID) the ${noun} name is looked up in; not needed for a key`, parseFolderKey);
8246
8664
  }
8247
8665
  function addRoiValueOptions(cmd, mode) {
8248
- const manualTime = new Option("--manual-time <number>", "Manual time a human spends per item, in --time-unit (whole number, 0 or more)").argParser(parseNonNegativeInteger("--manual-time"));
8666
+ const manualTime = new Option("--manual-time <number>", "Manual time a human spends per item, in --time-unit (whole number, 0 or more)").argParser(parseNonNegativeInteger2("--manual-time"));
8249
8667
  if (mode === "create") {
8250
8668
  manualTime.makeOptionMandatory();
8251
8669
  }
8252
- cmd.addOption(manualTime).addOption(new Option("--time-unit <unit>", `Unit of --manual-time${mode === "create" ? ` (default: ${DEFAULT_TIME_UNIT})` : ""}`).choices(ROI_TIME_UNITS2)).option("--volume <number>", "Items processed per --volume-period (whole number, 0 or more)", parseNonNegativeInteger("--volume")).addOption(new Option("--volume-period <period>", `Period --volume is measured over (default: ${DEFAULT_VOLUME_PERIOD} when --volume is set)`).choices(ROI_VOLUME_PERIODS2)).option("--employee-cost <amount>", "Fully loaded cost of the employee doing the work, in USD, over --cost-period (0 or more)", parseNonNegativeAmount("--employee-cost")).addOption(new Option("--cost-period <period>", `Period --employee-cost is expressed over (default: ${DEFAULT_COST_PERIOD} when --employee-cost is set)`).choices(ROI_EMPLOYEE_COST_PERIODS2)).option("--cost-per-item <amount>", "Manual cost per item, in USD; when omitted the UI computes it from the other inputs", parseNonNegativeAmount("--cost-per-item"));
8670
+ cmd.addOption(manualTime).addOption(new Option("--time-unit <unit>", `Unit of --manual-time${mode === "create" ? ` (default: ${DEFAULT_TIME_UNIT})` : ""}`).choices(ROI_TIME_UNITS2)).option("--volume <number>", "Items processed per --volume-period (whole number, 0 or more)", parseNonNegativeInteger2("--volume")).addOption(new Option("--volume-period <period>", `Period --volume is measured over (default: ${DEFAULT_VOLUME_PERIOD} when --volume is set)`).choices(ROI_VOLUME_PERIODS2)).option("--employee-cost <amount>", "Fully loaded cost of the employee doing the work, in USD, over --cost-period (0 or more)", parseNonNegativeAmount("--employee-cost")).addOption(new Option("--cost-period <period>", `Period --employee-cost is expressed over (default: ${DEFAULT_COST_PERIOD} when --employee-cost is set)`).choices(ROI_EMPLOYEE_COST_PERIODS2)).option("--cost-per-item <amount>", "Manual cost per item, in USD; when omitted the UI computes it from the other inputs", parseNonNegativeAmount("--cost-per-item"));
8253
8671
  if (mode === "update") {
8254
8672
  cmd.option("--no-volume", "Clear the stored volume and its period").option("--no-employee-cost", "Clear the stored employee cost and its period").option("--no-cost-per-item", "Clear the manual cost per item so the UI computes it again").option("--enabled", "Turn ROI tracking on");
8255
8673
  }
@@ -8821,6 +9239,16 @@ async function resolvePlannedBucket(plan, flag, lookupBucketId) {
8821
9239
  }
8822
9240
 
8823
9241
  // src/commands/processes.ts
9242
+ function withReleaseFolderOptions(command) {
9243
+ return command.option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide", parseFolderKey);
9244
+ }
9245
+ function resolveScopedRelease(processKey, options) {
9246
+ return resolveRelease2(processKey, {
9247
+ tenant: options.tenant,
9248
+ folderPath: options.folderPath,
9249
+ folderKey: options.folderKey
9250
+ });
9251
+ }
8824
9252
  function formatProcess(release) {
8825
9253
  return {
8826
9254
  Key: release.key || "",
@@ -8841,7 +9269,59 @@ function formatProcessListRow(release, includeFolderId = false) {
8841
9269
  };
8842
9270
  return includeFolderId ? { ...row, FolderId: release.organizationUnitId ?? 0 } : row;
8843
9271
  }
8844
- function formatProcessDetail(release) {
9272
+ function pickSchemas(jsonSchemas, nameAndTypeList) {
9273
+ if (jsonSchemas?.inputArguments || jsonSchemas?.outputArguments) {
9274
+ return {
9275
+ input: jsonSchemas.inputArguments || "",
9276
+ output: jsonSchemas.outputArguments || ""
9277
+ };
9278
+ }
9279
+ return {
9280
+ input: nameAndTypeList?.input || "",
9281
+ output: nameAndTypeList?.output || ""
9282
+ };
9283
+ }
9284
+ async function readEntryPointArguments(release, clientOptions) {
9285
+ const fromRelease = {
9286
+ path: release.entryPointPath || release.entryPoint?.path || release.entryPointV2?.path || "",
9287
+ ...pickSchemas(release.entryPointV2, release.arguments)
9288
+ };
9289
+ const hasEntryPoint = release.entryPoint !== undefined || release.entryPointV2 !== undefined || Boolean(release.entryPointPath);
9290
+ if (hasEntryPoint) {
9291
+ return fromRelease;
9292
+ }
9293
+ const [packageError, fromPackage] = await catchError(readMainEntryPoint(release, clientOptions));
9294
+ if (packageError) {
9295
+ const packageKey = `${release.processKey}:${release.processVersion}`;
9296
+ const feedOption = release.feedId ? ` --feed-id ${release.feedId}` : "";
9297
+ logger.warn(`Could not read the main entry point of package ${packageKey} (${await extractErrorMessage(packageError)}), ` + "so EntryPointPath and the argument schemas may be empty or incomplete. " + `'uip or packages entry-points ${packageKey}${feedOption}' lists them for an identity that may view the package's feed.`);
9298
+ }
9299
+ return fromPackage ?? fromRelease;
9300
+ }
9301
+ async function readMainEntryPoint(release, clientOptions) {
9302
+ if (!release.processKey || !release.processVersion) {
9303
+ return;
9304
+ }
9305
+ const key = `${release.processKey}:${release.processVersion}`;
9306
+ const api = await createApiClient2(ProcessesApi2, clientOptions);
9307
+ const [entryPoints, packageVersion] = await Promise.all([
9308
+ api.processesGetPackageEntryPointsV2ByKey({
9309
+ key,
9310
+ feedId: release.feedId
9311
+ }),
9312
+ api.processesGetProcessVersionByKey({ key, feedId: release.feedId })
9313
+ ]);
9314
+ const candidates = entryPoints.value ?? [];
9315
+ const main = packageVersion.mainEntryPointPath ? candidates.find((entryPoint) => entryPoint.path === packageVersion.mainEntryPointPath) : candidates.length === 1 ? candidates[0] : undefined;
9316
+ if (main === undefined && !packageVersion.mainEntryPointPath) {
9317
+ return;
9318
+ }
9319
+ return {
9320
+ path: main?.path || packageVersion.mainEntryPointPath || "",
9321
+ ...pickSchemas(main, packageVersion.arguments)
9322
+ };
9323
+ }
9324
+ function formatProcessDetail(release, entryPoint) {
8845
9325
  return {
8846
9326
  Key: release.key || "",
8847
9327
  Name: release.name || "",
@@ -8850,8 +9330,10 @@ function formatProcessDetail(release) {
8850
9330
  Description: release.description || "",
8851
9331
  IsLatestVersion: release.isLatestVersion ?? "",
8852
9332
  ProcessType: release.processType || "",
8853
- EntryPointPath: release.entryPointPath || "",
9333
+ EntryPointPath: entryPoint.path,
8854
9334
  InputArguments: release.inputArguments || "",
9335
+ InputArgumentsSchema: entryPoint.input,
9336
+ OutputArgumentsSchema: entryPoint.output,
8855
9337
  FolderKey: release.folderKey || "",
8856
9338
  FolderPath: release.organizationUnitFullyQualifiedName || "",
8857
9339
  AutoUpdate: release.autoUpdate ?? "",
@@ -9020,7 +9502,9 @@ var PROCESSES_GET_EXAMPLES = [
9020
9502
  IsLatestVersion: true,
9021
9503
  ProcessType: "Process",
9022
9504
  EntryPointPath: "Main.xaml",
9023
- InputArguments: '{"invoicePath":"String"}',
9505
+ InputArguments: '{"invoicePath":"C:\\\\invoices\\\\inv-001.pdf"}',
9506
+ InputArgumentsSchema: '{"type":"object","properties":{"invoicePath":{"type":"string","description":"Full path of the invoice PDF"}},"required":["invoicePath"]}',
9507
+ OutputArgumentsSchema: '{"type":"object","properties":{"invoiceTotal":{"type":"number"}}}',
9024
9508
  FolderKey: "a1b2c3d4-0000-0000-0000-000000000001",
9025
9509
  FolderPath: "Shared",
9026
9510
  AutoUpdate: false,
@@ -9216,16 +9700,9 @@ var PROCESSES_DELETE_EXAMPLES = [
9216
9700
  ];
9217
9701
  var registerProcessesCommand = (program) => {
9218
9702
  const processes = program.command("processes").description("Manage UiPath processes (runnable bindings of packages to folders). " + "Processes are what you execute with 'jobs start'. " + "Use 'packages' to manage the uploaded automation code.");
9219
- processes.command("list").description("List processes in a folder, or use --all-folders for a tenant-wide audit. " + "Returns process key (GUID), name, version, and type. " + "Use the process key with 'jobs start' to execute a process.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-folders", "List processes across all folders in the tenant").option("-n, --name <name>", "Filter by process name (contains match)").option("--process-type <type>", "Filter by process type (Process, Agent, Flow, etc.)").option("--all-fields", "Return all fields from the API response instead of a curated summary").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").examples(PROCESSES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
9220
- if (options.allFolders && (options.folderPath !== undefined || options.folderKey !== undefined)) {
9221
- OutputFormatter.error({
9222
- Result: RESULTS.Failure,
9223
- Message: "Error listing processes",
9224
- Instructions: "Use either --all-folders for a tenant-wide list or one folder selector (--folder-path/--folder-key), not both."
9225
- });
9226
- processContext.exit(1);
9703
+ processes.command("list").description("List processes in a folder, or use --all-folders for a tenant-wide audit. " + "Returns process key (GUID), name, version, and type. " + "Use the process key with 'jobs start' to execute a process, and with 'processes get' to read the input and output arguments it takes.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-folders", "List processes across all folders in the tenant").option("-n, --name <name>", "Filter by process name (contains match)", parseFilterValue).option("--process-type <type>", "Filter by process type (Process, Agent, Flow, etc.)", parseFilterValue).option("--all-fields", "Return all fields from the API response instead of a curated summary").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").examples(PROCESSES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
9704
+ if (refuseAllFoldersConflict(options))
9227
9705
  return;
9228
- }
9229
9706
  const [apiError, api] = await catchError(createApiClient2(ReleasesApi2, options.allFolders ? { tenant: options.tenant } : {
9230
9707
  tenant: options.tenant,
9231
9708
  folderPath: options.folderPath,
@@ -9302,12 +9779,8 @@ var registerProcessesCommand = (program) => {
9302
9779
  Data: processList
9303
9780
  });
9304
9781
  });
9305
- processes.command("get").description("Get detailed process information by key (GUID). " + "Returns version, entry point, input/output argument schemas, process type, and configuration. " + "Resolves the key tenant-wide; pass --folder-path/--folder-key to scope the lookup to a folder, which a folder-only identity (such as an external app) needs. " + "Use 'processes list' to find process keys.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide").option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(PROCESSES_GET_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9306
- const [resolveError, resolved] = await catchError(resolveRelease2(processKey, {
9307
- tenant: options.tenant,
9308
- folderPath: options.folderPath,
9309
- folderKey: options.folderKey
9310
- }));
9782
+ withReleaseFolderOptions(processes.command("get").description("Get detailed process information by key (GUID). " + "Returns version, process type, configuration, and the entry point the process runs (EntryPointPath) with the schemas of its input and output arguments (InputArgumentsSchema, OutputArgumentsSchema: JSON Schema with argument descriptions, or the name-and-type list of a package that has none). " + "A schema field is empty when the entry point declares no arguments, or when they could not be read, which a warning on stderr then names. " + "InputArguments holds the input values set on the process itself. " + "Resolves the key tenant-wide; pass --folder-path/--folder-key to scope the lookup to a folder, which a folder-only identity (such as an external app) needs. " + "Use 'processes list' to find process keys.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"))).option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(PROCESSES_GET_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9783
+ const [resolveError, resolved] = await catchError(resolveScopedRelease(processKey, options));
9311
9784
  if (resolveError) {
9312
9785
  await reportReleaseLookupFailure("Error getting process", resolveError);
9313
9786
  return;
@@ -9335,13 +9808,16 @@ var registerProcessesCommand = (program) => {
9335
9808
  OutputFormatter.success({
9336
9809
  Result: RESULTS.Success,
9337
9810
  Code: "ProcessGet",
9338
- Data: options.allFields ? release : formatProcessDetail(release)
9811
+ Data: options.allFields ? release : formatProcessDetail(release, await readEntryPointArguments(release, {
9812
+ tenant: options.tenant,
9813
+ folderKey: resolved.folderKey
9814
+ }))
9339
9815
  });
9340
9816
  });
9341
- processes.command("resources").description("List package resources required by a process. " + "Resolves the process folder automatically and returns referenced queues, assets, buckets, connections, and other package requirements. " + "ResourceName, FolderPath and ResourceId report what the package declares; when the release rebinds a resource elsewhere, IsOverwritten is true and the Overwrite* fields carry the target it actually binds to.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(PROCESSES_RESOURCES_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9342
- const [resolveError, resolved] = await catchError(resolveRelease2(processKey, { tenant: options.tenant }));
9817
+ withReleaseFolderOptions(processes.command("resources").description("List package resources required by a process. " + "Resolves the process folder automatically and returns referenced queues, assets, buckets, connections, and other package requirements. " + "ResourceName, FolderPath and ResourceId report what the package declares; when the release rebinds a resource elsewhere, IsOverwritten is true and the Overwrite* fields carry the target it actually binds to. " + "Resolves the key tenant-wide; pass --folder-path/--folder-key to scope the lookup to a folder, which a folder-only identity (such as an external app) needs. " + "Use 'processes list' to find process keys.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"))).option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(PROCESSES_RESOURCES_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9818
+ const [resolveError, resolved] = await catchError(resolveScopedRelease(processKey, options));
9343
9819
  if (resolveError) {
9344
- await reportReleaseLookupFailure("Error listing process resources", resolveError, { canScopeToFolder: false });
9820
+ await reportReleaseLookupFailure("Error listing process resources", resolveError);
9345
9821
  return;
9346
9822
  }
9347
9823
  const [apiError, api] = await catchError(createApiClient2(ReleasesApi2, {
@@ -9382,7 +9858,7 @@ var registerProcessesCommand = (program) => {
9382
9858
  })) : merged.map(({ resource, overwrite }) => formatProcessResource(resource, overwrite))
9383
9859
  }, { preserveDataKeys: ["overwriteProperties"] });
9384
9860
  });
9385
- processes.command("version-history").description("List chronological package version history for a process. " + "Folder is optional; if not provided, it is inferred from the process key. " + "Returns versions previously associated with the process.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - skips auto-detection").option("--folder-key <key>", "Folder key (GUID) - skips auto-detection").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(PROCESSES_VERSION_HISTORY_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9861
+ processes.command("version-history").description("List chronological package version history for a process. " + "Folder is optional; if not provided, it is inferred from the process key. " + "Returns versions previously associated with the process.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - skips auto-detection", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) - skips auto-detection", parseFolderKey).option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(PROCESSES_VERSION_HISTORY_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9386
9862
  const folderOptions = await resolveFolderForRelease(processKey, options);
9387
9863
  if (folderOptions === null) {
9388
9864
  return;
@@ -9416,7 +9892,7 @@ var registerProcessesCommand = (program) => {
9416
9892
  Data: versionHistory
9417
9893
  });
9418
9894
  });
9419
- processes.command("create").description("Create a new process by binding a package to a folder. Requires --folder-path or --folder-key. " + "Use the package Id from 'packages list' or 'packages get', and 'packages versions' to find available versions. " + "Job retention defaults to Delete after 30 days; to archive instead, pass --retention-action Archive with --retention-bucket <bucket-key> " + "(and --stale-retention-action Archive with --stale-retention-period <days> and --stale-retention-bucket <bucket-key> for stale jobs). " + "After creation, start the process with 'jobs start <process-key>'.").requiredOption("--name <name>", "Process name (how it will appear in the folder)").requiredOption("--package-key <key>", "Package ID / process key from packages list/get output (Id field); pass the version separately with --package-version").requiredOption("--package-version <version>", "Package version (e.g., '1.0.0') — use 'packages versions' to list available versions").option("--description <desc>", "Process description").option("--entry-point <path>", "Entry point workflow path (for multi-entry-point packages — use 'packages entry-points' to list them)").option("--input-arguments <json>", "Default input arguments as JSON string").option("--job-priority <priority>", "Default job priority (Low, Normal, High)").option("--specific-priority <value>", "Specific priority value (1-100). Mutually exclusive with --job-priority.").option("--robot-size <size>", "Cloud serverless machine size: Small, Standard, Medium, Large").option("--tags <tags>", "Comma-separated list of tag names").option("--environment-variables <pairs>", "Environment variables as newline-separated KEY=VALUE pairs").option("--auto-update", "Enable auto-update to latest package version").option("--no-auto-update", "Disable auto-update to latest package version").option("--hidden-for-attended", "Hide from attended robot users").option("--visible-for-attended", "Show to attended robot users").option("--auto-create-triggers", "Auto-create connected triggers on deploy").option("--no-auto-create-triggers", "Disable auto-create connected triggers on deploy").option("--retention-period <days>", "Job retention period in days (1–180)", "30").option("--retention-action <action>", "Retention action when period expires (Delete, Archive, None). Archive requires --retention-bucket", "Delete").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived jobs (required when action is Archive). The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-period <days>", `Stale job retention period in days; needs --stale-retention-action. Required when that action is Archive; defaults to ${DEFAULT_STALE_RETENTION_PERIOD_DAYS} for Delete/None`).option("--stale-retention-action <action>", "Stale retention action (Delete, Archive, None). Archive requires --stale-retention-bucket").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived stale jobs (required when stale action is Archive). The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").examples(PROCESSES_CREATE_EXAMPLES).trackedAction(processContext, async (options) => {
9895
+ processes.command("create").description("Create a new process by binding a package to a folder. Requires --folder-path or --folder-key. " + "Use the package Id from 'packages list' or 'packages get', and 'packages versions' to find available versions. " + "Job retention defaults to Delete after 30 days; to archive instead, pass --retention-action Archive with --retention-bucket <bucket-key> " + "(and --stale-retention-action Archive with --stale-retention-period <days> and --stale-retention-bucket <bucket-key> for stale jobs). " + "After creation, start the process with 'jobs start <process-key>'.").requiredOption("--name <name>", "Process name (how it will appear in the folder)").requiredOption("--package-key <key>", "Package ID / process key from packages list/get output (Id field); pass the version separately with --package-version").requiredOption("--package-version <version>", "Package version (e.g., '1.0.0') — use 'packages versions' to list available versions").option("--description <desc>", "Process description").option("--entry-point <path>", "Entry point workflow path (for multi-entry-point packages — use 'packages entry-points' to list them)").option("--input-arguments <json>", "Default input arguments as JSON string").option("--job-priority <priority>", "Default job priority (Low, Normal, High)").option("--specific-priority <value>", "Specific priority value (1-100). Mutually exclusive with --job-priority.").option("--robot-size <size>", "Cloud serverless machine size: Small, Standard, Medium, Large").option("--tags <tags>", "Comma-separated list of tag names").option("--environment-variables <pairs>", "Environment variables as newline-separated KEY=VALUE pairs").option("--auto-update", "Enable auto-update to latest package version").option("--no-auto-update", "Disable auto-update to latest package version").option("--hidden-for-attended", "Hide from attended robot users").option("--visible-for-attended", "Show to attended robot users").option("--auto-create-triggers", "Auto-create connected triggers on deploy").option("--no-auto-create-triggers", "Disable auto-create connected triggers on deploy").option("--retention-period <days>", "Job retention period in days (1–180)", "30").option("--retention-action <action>", "Retention action when period expires (Delete, Archive, None). Archive requires --retention-bucket", "Delete").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived jobs (required when action is Archive). The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-period <days>", `Stale job retention period in days; needs --stale-retention-action. Required when that action is Archive; defaults to ${DEFAULT_STALE_RETENTION_PERIOD_DAYS} for Delete/None`).option("--stale-retention-action <action>", "Stale retention action (Delete, Archive, None). Archive requires --stale-retention-bucket").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived stale jobs (required when stale action is Archive). The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).examples(PROCESSES_CREATE_EXAMPLES).trackedAction(processContext, async (options) => {
9420
9896
  if (options.jobPriority && options.specificPriority) {
9421
9897
  OutputFormatter.error({
9422
9898
  Result: RESULTS.Failure,
@@ -9603,7 +10079,7 @@ var registerProcessesCommand = (program) => {
9603
10079
  }
9604
10080
  });
9605
10081
  });
9606
- processes.command("update-version").description("Update one or more processes to the latest package version, or a specific version with --package-version. " + "Folder is optional — if not provided, it is inferred from the process key. " + "Running jobs are not affected — only new jobs will use the updated version. " + "Accepts one or more process keys. Multiple keys use the bulk API. " + "Use --package-version only with a single key.").argument("<process-keys...>", "One or more process keys (GUIDs)").option("--package-version <version>", "Specific package version to update to").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') — skips auto-detection").option("--folder-key <key>", "Folder key (GUID) — skips auto-detection").examples(PROCESSES_UPDATE_VERSION_EXAMPLES).trackedAction(processContext, async (processKeys, options) => {
10082
+ processes.command("update-version").description("Update one or more processes to the latest package version, or a specific version with --package-version. " + "Folder is optional — if not provided, it is inferred from the process key. " + "Running jobs are not affected — only new jobs will use the updated version. " + "Accepts one or more process keys. Multiple keys use the bulk API. " + "Use --package-version only with a single key.").argument("<process-keys...>", "One or more process keys (GUIDs)").option("--package-version <version>", "Specific package version to update to").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') — skips auto-detection", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — skips auto-detection", parseFolderKey).examples(PROCESSES_UPDATE_VERSION_EXAMPLES).trackedAction(processContext, async (processKeys, options) => {
9607
10083
  const folderOptions = await resolveFolderForRelease(processKeys[0], options);
9608
10084
  if (folderOptions === null) {
9609
10085
  return;
@@ -9686,7 +10162,7 @@ var registerProcessesCommand = (program) => {
9686
10162
  });
9687
10163
  }
9688
10164
  });
9689
- processes.command("update").alias("edit").description("Update process settings by key (GUID). Resolves the key tenant-wide by default; " + "pass --folder-path/--folder-key to scope the lookup to a folder, which a folder-only identity (such as an external app) needs. " + "Only provided fields are updated (PATCH). " + "Archive retention needs a storage bucket (--retention-bucket / --stale-retention-bucket); the current bucket is kept while the action stays Archive and cleared when it changes. " + "Use 'processes get' to see current values.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide").option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide").option("-n, --name <name>", "Process display name").option("-d, --description <desc>", "Process description").option("--entry-point <path>", "Entry point workflow path (for multi-entry-point packages)").option("--input-arguments <json>", "Default input arguments as JSON string").option("--environment-variables <pairs>", "Environment variables as newline-separated KEY=VALUE pairs. Pass '' to clear them.").option("--job-priority <priority>", "Default job priority (Low, Normal, High)").option("--specific-priority <value>", "Specific priority value (1-100). Mutually exclusive with --job-priority.").option("--robot-size <size>", "Cloud serverless machine size: Small, Standard, Medium, Large").option("--auto-update", "Enable auto-update to latest package version").option("--no-auto-update", "Disable auto-update to latest package version").option("--hidden-for-attended", "Hide from attended robot users").option("--visible-for-attended", "Show to attended robot users").option("--auto-create-triggers", "Auto-create connected triggers on deploy").option("--no-auto-create-triggers", "Disable auto-create connected triggers on deploy").option("--healing-agent", "Enable Healing Agent (Autopilot for Robots) for this process. Future jobs use it by default; tenant-level Autopilot must already be enabled.").option("--no-healing-agent", "Disable Healing Agent (Autopilot for Robots) for this process").option("--retention-period <days>", "Job retention period in days (1–180)").option("--retention-action <action>", "Retention action (Delete, Archive, None). Switching to Archive requires --retention-bucket unless the process already archives").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived jobs. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-period <days>", `Stale job retention period in days. Omit to keep the current period (${DEFAULT_STALE_RETENTION_PERIOD_DAYS} for Delete/None when none is stored; Archive with none stored requires it)`).option("--stale-retention-action <action>", "Stale retention action (Delete, Archive, None). Archive requires --stale-retention-bucket").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived stale jobs. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").examples(PROCESSES_EDIT_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
10165
+ withReleaseFolderOptions(processes.command("update").alias("edit").description("Update process settings by key (GUID). Resolves the key tenant-wide by default; " + "pass --folder-path/--folder-key to scope the lookup to a folder, which a folder-only identity (such as an external app) needs. " + "Only provided fields are updated (PATCH). " + "Archive retention needs a storage bucket (--retention-bucket / --stale-retention-bucket); the current bucket is kept while the action stays Archive and cleared when it changes. " + "Use 'processes get' to see current values.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"))).option("-n, --name <name>", "Process display name").option("-d, --description <desc>", "Process description").option("--entry-point <path>", "Entry point workflow path (for multi-entry-point packages)").option("--input-arguments <json>", "Default input arguments as JSON string").option("--environment-variables <pairs>", "Environment variables as newline-separated KEY=VALUE pairs. Pass '' to clear them.").option("--job-priority <priority>", "Default job priority (Low, Normal, High)").option("--specific-priority <value>", "Specific priority value (1-100). Mutually exclusive with --job-priority.").option("--robot-size <size>", "Cloud serverless machine size: Small, Standard, Medium, Large").option("--auto-update", "Enable auto-update to latest package version").option("--no-auto-update", "Disable auto-update to latest package version").option("--hidden-for-attended", "Hide from attended robot users").option("--visible-for-attended", "Show to attended robot users").option("--auto-create-triggers", "Auto-create connected triggers on deploy").option("--no-auto-create-triggers", "Disable auto-create connected triggers on deploy").option("--healing-agent", "Enable Healing Agent (Autopilot for Robots) for this process. Future jobs use it by default; tenant-level Autopilot must already be enabled.").option("--no-healing-agent", "Disable Healing Agent (Autopilot for Robots) for this process").option("--retention-period <days>", "Job retention period in days (1–180)").option("--retention-action <action>", "Retention action (Delete, Archive, None). Switching to Archive requires --retention-bucket unless the process already archives").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived jobs. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-period <days>", `Stale job retention period in days. Omit to keep the current period (${DEFAULT_STALE_RETENTION_PERIOD_DAYS} for Delete/None when none is stored; Archive with none stored requires it)`).option("--stale-retention-action <action>", "Stale retention action (Delete, Archive, None). Archive requires --stale-retention-bucket").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived stale jobs. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the process's folder. Use 'buckets list' to retrieve the key").examples(PROCESSES_EDIT_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9690
10166
  if (options.hiddenForAttended && options.visibleForAttended) {
9691
10167
  OutputFormatter.error({
9692
10168
  Result: RESULTS.Failure,
@@ -9777,11 +10253,7 @@ var registerProcessesCommand = (program) => {
9777
10253
  reportRetentionFailure(bucketPrecheck);
9778
10254
  return;
9779
10255
  }
9780
- const [resolveError, resolved] = await catchError(resolveRelease2(processKey, {
9781
- tenant: options.tenant,
9782
- folderPath: options.folderPath,
9783
- folderKey: options.folderKey
9784
- }));
10256
+ const [resolveError, resolved] = await catchError(resolveScopedRelease(processKey, options));
9785
10257
  if (resolveError) {
9786
10258
  await reportReleaseLookupFailure("Error updating process", resolveError);
9787
10259
  return;
@@ -9936,10 +10408,10 @@ var registerProcessesCommand = (program) => {
9936
10408
  }
9937
10409
  });
9938
10410
  });
9939
- processes.command("delete").description("Delete a process binding by key (GUID). " + "This removes the release binding from its folder and does not delete the package. " + "Resolves the key tenant-wide; pass --folder-path/--folder-key to scope the lookup to a folder. " + "Use 'processes list' to find process keys.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide").option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(PROCESSES_DELETE_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
10411
+ withReleaseFolderOptions(processes.command("delete").description("Delete a process binding by key (GUID). " + "This removes the release binding from its folder and does not delete the package. " + "Resolves the key tenant-wide; pass --folder-path/--folder-key to scope the lookup to a folder. " + "Use 'processes list' to find process keys.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"))).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(PROCESSES_DELETE_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9940
10412
  if (!requireConfirmation(options, `delete process '${processKey}'`))
9941
10413
  return;
9942
- const [resolveError, resolved] = await catchError(resolveRelease2(processKey, options));
10414
+ const [resolveError, resolved] = await catchError(resolveScopedRelease(processKey, options));
9943
10415
  if (resolveError) {
9944
10416
  await reportReleaseLookupFailure("Error deleting process", resolveError);
9945
10417
  return;
@@ -9973,7 +10445,7 @@ var registerProcessesCommand = (program) => {
9973
10445
  }
9974
10446
  });
9975
10447
  });
9976
- processes.command("rollback").description("Rollback a process to its previous package version. " + "Folder is optional — if not provided, it is inferred from the process key. " + "Useful when a new version causes issues and you need to quickly revert.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') — skips auto-detection").option("--folder-key <key>", "Folder key (GUID) — skips auto-detection").examples(PROCESSES_ROLLBACK_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
10448
+ processes.command("rollback").description("Rollback a process to its previous package version. " + "Folder is optional — if not provided, it is inferred from the process key. " + "Useful when a new version causes issues and you need to quickly revert.").argument("<process-key>", "Process key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') — skips auto-detection", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — skips auto-detection", parseFolderKey).examples(PROCESSES_ROLLBACK_EXAMPLES).trackedAction(processContext, async (processKey, options) => {
9977
10449
  const folderOptions = await resolveFolderForRelease(processKey, options);
9978
10450
  if (folderOptions === null) {
9979
10451
  return;
@@ -10280,7 +10752,18 @@ var QUEUE_ITEMS_ADD_EXAMPLES = [
10280
10752
  var QUEUE_ITEMS_BULK_ADD_EXAMPLES = [
10281
10753
  {
10282
10754
  Description: "Add several items to a queue in one call",
10283
- Command: "uip or queue-items bulk-add InvoiceQueue --items ./invoices.json --folder-path Shared",
10755
+ Command: "uip or queue-items bulk-add InvoiceQueue --folder-path Shared " + `--queue-items '[{"specificContent":{"InvoiceId":"INV-001"}},{"specificContent":{"InvoiceId":"INV-002"}}]'`,
10756
+ Output: {
10757
+ Code: "QueueItemsBulkAdded",
10758
+ Data: {
10759
+ Count: 2,
10760
+ Status: "Added successfully"
10761
+ }
10762
+ }
10763
+ },
10764
+ {
10765
+ Description: "Add items listed in a JSON file (avoids shell quoting, e.g. on Windows)",
10766
+ Command: "uip or queue-items bulk-add InvoiceQueue --folder-path Shared --queue-items-file ./items.json",
10284
10767
  Output: {
10285
10768
  Code: "QueueItemsBulkAdded",
10286
10769
  Data: {
@@ -10321,7 +10804,7 @@ async function resolveItems(api, keys) {
10321
10804
  return resolved;
10322
10805
  }
10323
10806
  function addFolderOptions(cmd) {
10324
- return cmd.option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)");
10807
+ return cmd.option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey);
10325
10808
  }
10326
10809
  function requireFolder(options, errorContext) {
10327
10810
  if (options.folderPath === undefined && options.folderKey === undefined) {
@@ -10351,36 +10834,16 @@ function requireQueueItemKeys(keys, errorContext) {
10351
10834
  }
10352
10835
  var registerQueueItemsCommand = (program) => {
10353
10836
  const queueItems = program.command("queue-items").description("Manage queue items (individual work items/transactions inside queues). Items flow through states: New → InProgress → Successful/Failed. Queue items are folder-scoped.");
10354
- queueItems.command("list").description("List queue items in a folder, or across all accessible folders with --all-folders. " + "Filter by --queue-definition-key and/or --status (New, InProgress, Failed, Successful, Abandoned, Retried, Deleted).").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-folders", "List queue items across all accessible folders").option("--queue-definition-key <key>", "Filter by queue definition key (GUID). Use 'queues list' to retrieve the key.").option("--queue-name <name>", "Filter by queue name (exact match)").option("--status <status>", "Filter by status (New, InProgress, Failed, Successful, Abandoned, Retried, Deleted)").option("-l, --limit <number>", `Number of items to return (at most ${QUEUE_ITEMS_MAX_LIMIT}; page with --offset)`, String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUE_ITEMS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
10355
- const requestedLimit = parseInt(options.limit, 10);
10356
- if (requestedLimit > QUEUE_ITEMS_MAX_LIMIT) {
10357
- OutputFormatter.error({
10358
- Result: RESULTS.Failure,
10359
- Message: "Error listing queue items",
10360
- ErrorCode: "invalid_argument",
10361
- Instructions: `--limit ${requestedLimit} is above the maximum of ${QUEUE_ITEMS_MAX_LIMIT} for queue items. Use --limit ${QUEUE_ITEMS_MAX_LIMIT} and step --offset by ${QUEUE_ITEMS_MAX_LIMIT} to page through them.`
10362
- });
10363
- return;
10837
+ queueItems.command("list").description("List queue items in a folder, or across all accessible folders with --all-folders. " + "Filter by --queue-definition-key and/or --status (New, InProgress, Failed, Successful, Abandoned, Retried, Deleted).").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-folders", "List queue items across all accessible folders").option("--queue-definition-key <key>", "Filter by queue definition key (GUID). Use 'queues list' to retrieve the key.", parseFilterValue).option("--queue-name <name>", "Filter by queue name (exact match)", parseFilterValue).option("--status <status>", "Filter by status (New, InProgress, Failed, Successful, Abandoned, Retried, Deleted)", parseFilterValue).option("-l, --limit <number>", `Number of items to return (at most ${QUEUE_ITEMS_MAX_LIMIT}; page with --offset)`, String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUE_ITEMS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
10838
+ const requestedLimit = parsePositiveInteger(options.limit);
10839
+ if (requestedLimit === undefined) {
10840
+ return reportUsageError(`Invalid --limit value '${options.limit}'`, `Provide a positive integer up to ${QUEUE_ITEMS_MAX_LIMIT} for --limit.`);
10364
10841
  }
10365
- const hasFolderSelector = options.folderPath !== undefined || options.folderKey !== undefined;
10366
- if (options.allFolders && hasFolderSelector) {
10367
- OutputFormatter.error({
10368
- Result: RESULTS.Failure,
10369
- Message: "Error listing queue items",
10370
- Instructions: "Use --all-folders by itself, or provide a single folder selector with --folder-path or --folder-key."
10371
- });
10372
- processContext.exit(1);
10373
- return;
10842
+ if (requestedLimit > QUEUE_ITEMS_MAX_LIMIT) {
10843
+ return reportUsageError(`--limit ${requestedLimit} is above the maximum of ${QUEUE_ITEMS_MAX_LIMIT} for queue items.`, `Use --limit ${QUEUE_ITEMS_MAX_LIMIT} and step --offset by ${QUEUE_ITEMS_MAX_LIMIT} to page through them.`);
10374
10844
  }
10375
- if (!options.allFolders && !hasFolderSelector) {
10376
- OutputFormatter.error({
10377
- Result: RESULTS.Failure,
10378
- Message: "Error listing queue items",
10379
- Instructions: "Provide --folder-path, --folder-key, or --all-folders."
10380
- });
10381
- processContext.exit(1);
10845
+ if (refuseListFolderScope(options))
10382
10846
  return;
10383
- }
10384
10847
  const validStatuses = [
10385
10848
  "New",
10386
10849
  "InProgress",
@@ -10438,7 +10901,7 @@ var registerQueueItemsCommand = (program) => {
10438
10901
  const [listError, result] = await catchError(api.queueItemsGet({
10439
10902
  $filter: filters.length > 0 ? filters.join(" and ") : undefined,
10440
10903
  $orderby: options.sortBy,
10441
- $top: parseInt(options.limit, 10),
10904
+ $top: requestedLimit,
10442
10905
  $skip: parseInt(options.offset || "0", 10),
10443
10906
  $expand: "QueueDefinition"
10444
10907
  }));
@@ -10452,7 +10915,7 @@ var registerQueueItemsCommand = (program) => {
10452
10915
  Code: "QueueItemList",
10453
10916
  Pagination: new Pagination({
10454
10917
  returned: items.length,
10455
- limit: parseInt(options.limit, 10),
10918
+ limit: requestedLimit,
10456
10919
  offset: parseInt(options.offset || "0", 10)
10457
10920
  }),
10458
10921
  Data: options.allFields ? items : items.map(formatQueueItem)
@@ -10791,7 +11254,7 @@ var registerQueueItemsCommand = (program) => {
10791
11254
  Data: result
10792
11255
  });
10793
11256
  });
10794
- queueItems.command("get-reviewers").description("List users available as queue item reviewers. Supports --folder-path or --folder-key to scope the results. " + "Use returned user keys with 'queue-items set-reviewer --user-key'.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUE_ITEMS_GET_REVIEWERS_EXAMPLES).trackedAction(processContext, async (options) => {
11257
+ queueItems.command("get-reviewers").description("List users available as queue item reviewers. Supports --folder-path or --folder-key to scope the results. " + "Use returned user keys with 'queue-items set-reviewer --user-key'.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUE_ITEMS_GET_REVIEWERS_EXAMPLES).trackedAction(processContext, async (options) => {
10795
11258
  if (!requireFolder(options, "Error getting reviewers"))
10796
11259
  return;
10797
11260
  const [apiError, api] = await catchError(createApiClient2(QueueItemsApi2, {
@@ -10932,7 +11395,7 @@ var registerQueueItemsCommand = (program) => {
10932
11395
  }
10933
11396
  });
10934
11397
  });
10935
- queueItems.command("add").description("Add a new item to a queue by queue name. Requires --folder-path or --folder-key. " + "Requires --specific-content with the work data as a JSON object. " + "Optionally set --priority (High, Normal, Low), --reference, --defer-date, and --due-date.").argument("<queue-name>", "Name of the target queue").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-r, --reference <reference>", "A user-defined identifier for the queue item (max 128 chars). Useful for correlating items with external systems").option("-p, --priority <priority>", "Processing priority: High, Normal, or Low. Higher priority items are processed first", "Normal").option("--specific-content <json>", "Custom data payload as a JSON string of flat key-value pairs. " + `Example: '{"InvoiceId":"INV-001","Amount":1500.00,"Status":"Pending"}'`).option("--defer-date <datetime>", "Earliest date/time the item becomes available for processing (ISO 8601, e.g. 2026-03-15T09:00:00Z)").option("--due-date <datetime>", "Latest date/time by which the item should be processed (ISO 8601, e.g. 2026-03-20T17:00:00Z)").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUE_ITEMS_ADD_EXAMPLES).trackedAction(processContext, async (queueName, options) => {
11398
+ queueItems.command("add").description("Add a new item to a queue by queue name. Requires --folder-path or --folder-key. " + "Requires --specific-content with the work data as a JSON object. " + "Optionally set --priority (High, Normal, Low), --reference, --defer-date, and --due-date.").argument("<queue-name>", "Name of the target queue").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-r, --reference <reference>", "A user-defined identifier for the queue item (max 128 chars). Useful for correlating items with external systems").option("-p, --priority <priority>", "Processing priority: High, Normal, or Low. Higher priority items are processed first", "Normal").option("--specific-content <json>", "Custom data payload as a JSON string of flat key-value pairs. " + `Example: '{"InvoiceId":"INV-001","Amount":1500.00,"Status":"Pending"}'`).option("--defer-date <datetime>", "Earliest date/time the item becomes available for processing (ISO 8601, e.g. 2026-03-15T09:00:00Z)").option("--due-date <datetime>", "Latest date/time by which the item should be processed (ISO 8601, e.g. 2026-03-20T17:00:00Z)").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUE_ITEMS_ADD_EXAMPLES).trackedAction(processContext, async (queueName, options) => {
10936
11399
  if (!options.specificContent) {
10937
11400
  OutputFormatter.error({
10938
11401
  Result: RESULTS.Failure,
@@ -11019,26 +11482,27 @@ var registerQueueItemsCommand = (program) => {
11019
11482
  Data: options.allFields ? result : formatQueueItemDetail(result)
11020
11483
  });
11021
11484
  });
11022
- queueItems.command("bulk-add").description("Add multiple items to a queue in a single request. Requires --folder-path or --folder-key. " + "Provide items as a JSON array via --queue-items. Each object may include specificContent, priority, reference, deferDate, dueDate. " + "Use --commit-type to control failure handling (AllOrNothing, StopOnFirstFailure, ProcessAllIndependently).").argument("<queue-name>", "Name of the target queue").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--queue-items <json>", "JSON array of queue item data objects. Each object may contain: specificContent, priority, reference, deferDate, dueDate. " + `Example: '[{"specificContent":{"Id":"1"}},{"specificContent":{"Id":"2"}}]'`).option("--commit-type <type>", "How to handle partial failures: AllOrNothing, StopOnFirstFailure, or ProcessAllIndependently", "ProcessAllIndependently").examples(QUEUE_ITEMS_BULK_ADD_EXAMPLES).trackedAction(processContext, async (queueName, options) => {
11023
- if (!options.queueItems) {
11024
- OutputFormatter.error({
11025
- Result: RESULTS.Failure,
11026
- Message: "Error bulk adding queue items",
11027
- Instructions: "--queue-items is required."
11028
- });
11029
- processContext.exit(1);
11485
+ queueItems.command("bulk-add").description("Add multiple items to a queue in a single request. Requires --folder-path or --folder-key. " + "Provide items as a JSON array via --queue-items, or in a file via --queue-items-file. Each object may include specificContent, priority, reference, deferDate, dueDate. " + "Use --commit-type to control failure handling (AllOrNothing, StopOnFirstFailure, ProcessAllIndependently).").argument("<queue-name>", "Name of the target queue").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--queue-items <json>", "JSON array of queue item data objects. Each object may contain: specificContent, priority, reference, deferDate, dueDate. " + `Example: '[{"specificContent":{"Id":"1"}},{"specificContent":{"Id":"2"}}]'. ` + "Required unless --queue-items-file is given.").addOption(new Option("--queue-items-file <path>", jsonFileOptionHelp("--queue-items")).conflicts("queueItems")).option("--commit-type <type>", "How to handle partial failures: AllOrNothing, StopOnFirstFailure, or ProcessAllIndependently", "ProcessAllIndependently").examples(QUEUE_ITEMS_BULK_ADD_EXAMPLES).trackedAction(processContext, async (queueName, options) => {
11486
+ const queueItemsFlags = {
11487
+ inlineFlag: "--queue-items",
11488
+ fileFlag: "--queue-items-file"
11489
+ };
11490
+ const queueItemsInput = await resolveJsonFileOption({
11491
+ inline: options.queueItems,
11492
+ file: options.queueItemsFile,
11493
+ ...queueItemsFlags
11494
+ });
11495
+ if (queueItemsInput === null)
11496
+ return;
11497
+ if (queueItemsInput === undefined) {
11498
+ reportJsonOptionUsageError("bulk-add needs the queue items to add.", queueItemsFlags);
11030
11499
  return;
11031
11500
  }
11032
- const [parseError, parsedItems] = catchError(() => JSON.parse(options.queueItems));
11033
- if (parseError || !Array.isArray(parsedItems)) {
11034
- OutputFormatter.error({
11035
- Result: RESULTS.Failure,
11036
- Message: "Error bulk adding queue items",
11037
- Instructions: "Invalid JSON in --queue-items. Provide a valid JSON array of item objects."
11038
- });
11039
- processContext.exit(1);
11501
+ if (!Array.isArray(queueItemsInput.value)) {
11502
+ reportJsonOptionUsageError(`${queueItemsInput.flag} must be a JSON array of queue items.`, queueItemsFlags);
11040
11503
  return;
11041
11504
  }
11505
+ const parsedItems = queueItemsInput.value;
11042
11506
  const validCommitTypes = [
11043
11507
  "AllOrNothing",
11044
11508
  "StopOnFirstFailure",
@@ -11164,11 +11628,8 @@ function formatQueueStats(s) {
11164
11628
  var CROSS_FOLDER_MISS_HINT = " If the queue was just created, pass its folder with --folder-path or --folder-key: the lookup without a folder can take a while to list a queue in a new folder.";
11165
11629
  async function resolveQueueTarget(queueKey, options, errorMessage) {
11166
11630
  if (options.folderPath !== undefined || options.folderKey !== undefined) {
11167
- const bothSelectors = bothFolderSelectorsError(options);
11168
- if (bothSelectors) {
11169
- await reportFailure2(errorMessage, bothSelectors);
11631
+ if (refuseBothFolderSelectors(options))
11170
11632
  return;
11171
- }
11172
11633
  const scope = {
11173
11634
  tenant: options.tenant,
11174
11635
  folderPath: options.folderPath,
@@ -11198,6 +11659,22 @@ async function resolveQueueTarget(queueKey, options, errorMessage) {
11198
11659
  }
11199
11660
  };
11200
11661
  }
11662
+ var ONE_DAY_MS = 24 * 60 * 60 * 1000;
11663
+ function buildQueueStatsFilter(options) {
11664
+ const filters = [`QueueDefinitionKey eq ${options.key}`];
11665
+ if (options.name) {
11666
+ const sanitized = options.name.replace(/'/g, "''");
11667
+ filters.push(`contains(QueueDefinitionName, '${sanitized}')`);
11668
+ }
11669
+ if (options.from) {
11670
+ filters.push(`LastProcessed ge ${options.from.utc}`);
11671
+ }
11672
+ if (options.to) {
11673
+ const { date, utc, dateOnly } = options.to;
11674
+ filters.push(dateOnly ? `LastProcessed lt ${new Date(date.getTime() + ONE_DAY_MS).toISOString()}` : `LastProcessed le ${utc}`);
11675
+ }
11676
+ return filters.join(" and ");
11677
+ }
11201
11678
  var QUEUES_LIST_EXAMPLES = [
11202
11679
  {
11203
11680
  Description: "List queues in a folder",
@@ -11452,6 +11929,11 @@ var QUEUES_GET_STATS_EXAMPLES = [
11452
11929
  }
11453
11930
  ]
11454
11931
  }
11932
+ },
11933
+ {
11934
+ Description: "Get stats only if the queue was last processed in January 2026 (a date-only --to covers that whole day)",
11935
+ Command: "uip or queues get-stats --key a1b2c3d4-0000-0000-0000-000000000001 --from 2026-01-01 --to 2026-01-31",
11936
+ Output: { Code: "QueueStats", Data: [] }
11455
11937
  }
11456
11938
  ];
11457
11939
  var QUEUES_UNSHARE_EXAMPLES = [
@@ -11529,26 +12011,9 @@ function parseOptionalMinutes(value, optionName, errorMessage) {
11529
12011
  }
11530
12012
  var registerQueuesCommand = (program) => {
11531
12013
  const queues = program.command("queues").description("Manage Orchestrator queues (containers for work items that automations process as transactions). Queues are folder-scoped.");
11532
- queues.command("list").description("List queues in a folder, or across all accessible folders with --all-folders. " + "Returns name, key (GUID), item counts, and processing stats. Use --name to filter.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-folders", "List queues across all accessible folders").option("-n, --name <name>", "Filter by queue name (contains match)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
11533
- const hasFolderSelector = options.folderPath !== undefined || options.folderKey !== undefined;
11534
- if (options.allFolders && hasFolderSelector) {
11535
- OutputFormatter.error({
11536
- Result: RESULTS.Failure,
11537
- Message: "Error listing queues",
11538
- Instructions: "Use --all-folders by itself, or provide a single folder selector with --folder-path or --folder-key."
11539
- });
11540
- processContext.exit(1);
11541
- return;
11542
- }
11543
- if (!options.allFolders && !hasFolderSelector) {
11544
- OutputFormatter.error({
11545
- Result: RESULTS.Failure,
11546
- Message: "Error listing queues",
11547
- Instructions: "Provide --folder-path, --folder-key, or --all-folders."
11548
- });
11549
- processContext.exit(1);
12014
+ queues.command("list").description("List queues in a folder, or across all accessible folders with --all-folders. " + "Returns name, key (GUID), item counts, and processing stats. Use --name to filter.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-folders", "List queues across all accessible folders").option("-n, --name <name>", "Filter by queue name (contains match)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUES_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
12015
+ if (refuseListFolderScope(options))
11550
12016
  return;
11551
- }
11552
12017
  const [apiError, api] = await catchError(options.allFolders ? createApiClient2(QueueDefinitionsApi2, {
11553
12018
  tenant: options.tenant
11554
12019
  }) : createApiClient2(QueueDefinitionsApi2, {
@@ -11590,7 +12055,9 @@ var registerQueuesCommand = (program) => {
11590
12055
  Data: options.allFields ? items : items.map((q) => formatQueueRow(q))
11591
12056
  });
11592
12057
  });
11593
- queues.command("get").description("Get queue details by key (GUID). No folder needed -- resolves cross-folder; " + "pass --folder-path/--folder-key to require the queue to be in that folder. " + "Use 'queues list' to retrieve the key.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide").option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(QUEUES_GET_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
12058
+ queues.command("get").description("Get queue details by key (GUID). No folder needed -- resolves cross-folder; " + "pass --folder-path/--folder-key to require the queue to be in that folder. " + "Use 'queues list' to retrieve the key.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared') - scopes the lookup instead of resolving tenant-wide", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) - scopes the lookup instead of resolving tenant-wide", parseFolderKey).option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(QUEUES_GET_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
12059
+ if (refuseBothFolderSelectors(options))
12060
+ return;
11594
12061
  const resolved = await resolveEntityOrFail(QueueDefinitionsApi2, { tenant: options.tenant }, resolveQueueByKey, queueKey, "Error getting queue");
11595
12062
  if (!resolved)
11596
12063
  return;
@@ -11647,7 +12114,7 @@ var registerQueuesCommand = (program) => {
11647
12114
  Data: options.allFields ? queue : formatQueueDetail(queue)
11648
12115
  });
11649
12116
  });
11650
- queues.command("create").description("Create a new queue in a folder. Requires --folder-path or --folder-key. " + "Configurable retry, encryption, retention, and unique reference policies. " + "Retention defaults to Delete; Archive needs a storage bucket (--retention-bucket / --stale-retention-bucket <bucket-key>).").argument("<name>", "Name for the new queue").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-d, --description <text>", "Description of the queue").option("--max-retries <number>", "Maximum number of retry attempts for failed items").option("--sla-in-minutes <minutes>", "Queue item processing SLA in minutes").option("--risk-sla-in-minutes <minutes>", "Queue item processing risk SLA in minutes").option("--auto-retry", "Automatically retry items that fail with an ApplicationException (default: true)").option("--no-auto-retry", "Disable automatic retry of failed items").option("--retry-abandoned-items", "Automatically retry abandoned items").option("--no-retry-abandoned-items", "Disable automatic retry of abandoned items").option("--enforce-unique-reference", "Enforce unique reference values for queue items").option("--no-enforce-unique-reference", "Disable unique reference enforcement for queue items").option("--encrypted", "Store queue item data in encrypted format").option("--retention-action <action>", "Action for completed items, one of: Delete, Archive, None (e.g. --retention-action Archive). Archive requires --retention-bucket. Default: Delete", "Delete").option("--retention-period <days>", "Retention period in days for completed items (default: 30)", "30").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived completed items (required when --retention-action is Archive). The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-action <action>", "Action for uncompleted items, one of: Delete, Archive, None (e.g. --stale-retention-action Archive). Archive requires --stale-retention-bucket. Default: Delete", "Delete").option("--stale-retention-period <days>", "Retention period in days for uncompleted items (default: 180)", "180").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived uncompleted items (required when --stale-retention-action is Archive). The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").examples(QUEUES_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
12117
+ queues.command("create").description("Create a new queue in a folder. Requires --folder-path or --folder-key. " + "Configurable retry, encryption, retention, and unique reference policies. " + "Retention defaults to Delete; Archive needs a storage bucket (--retention-bucket / --stale-retention-bucket <bucket-key>).").argument("<name>", "Name for the new queue").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-d, --description <text>", "Description of the queue").option("--max-retries <number>", "Maximum number of retry attempts for failed items").option("--sla-in-minutes <minutes>", "Queue item processing SLA in minutes").option("--risk-sla-in-minutes <minutes>", "Queue item processing risk SLA in minutes").option("--auto-retry", "Automatically retry items that fail with an ApplicationException (default: true)").option("--no-auto-retry", "Disable automatic retry of failed items").option("--retry-abandoned-items", "Automatically retry abandoned items").option("--no-retry-abandoned-items", "Disable automatic retry of abandoned items").option("--enforce-unique-reference", "Enforce unique reference values for queue items").option("--no-enforce-unique-reference", "Disable unique reference enforcement for queue items").option("--encrypted", "Store queue item data in encrypted format").option("--retention-action <action>", "Action for completed items, one of: Delete, Archive, None (e.g. --retention-action Archive). Archive requires --retention-bucket. Default: Delete", "Delete").option("--retention-period <days>", "Retention period in days for completed items (default: 30)", "30").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived completed items (required when --retention-action is Archive). The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-action <action>", "Action for uncompleted items, one of: Delete, Archive, None (e.g. --stale-retention-action Archive). Archive requires --stale-retention-bucket. Default: Delete", "Delete").option("--stale-retention-period <days>", "Retention period in days for uncompleted items (default: 180)", "180").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived uncompleted items (required when --stale-retention-action is Archive). The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").examples(QUEUES_CREATE_EXAMPLES).trackedAction(processContext, async (name, options) => {
11651
12118
  const slaInMinutes = parseOptionalMinutes(options.slaInMinutes, "--sla-in-minutes", "Error creating queue");
11652
12119
  if (options.slaInMinutes !== undefined && slaInMinutes === undefined) {
11653
12120
  return;
@@ -11697,7 +12164,7 @@ var registerQueuesCommand = (program) => {
11697
12164
  Data: queue
11698
12165
  });
11699
12166
  });
11700
- queues.command("update").description("Update queue properties by key (GUID). No folder needed -- resolves cross-folder; pass --folder-path or --folder-key to look the key up in that folder instead. " + "Only provided fields are changed. " + "Archive retention needs a storage bucket (--retention-bucket / --stale-retention-bucket); the current bucket is kept while the action stays Archive and cleared when it changes. " + "Use 'queues list' to retrieve the key.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Path of the folder that holds the queue (e.g., 'Shared'). Looks the key up in that folder only").option("--folder-key <key>", "Key (GUID) of the folder that holds the queue. Looks the key up in that folder only").option("-n, --name <name>", "New queue name").option("-d, --description <text>", "Description of the queue").option("--max-retries <number>", "Maximum number of retry attempts for failed items").option("--sla-in-minutes <minutes>", "Queue item processing SLA in minutes").option("--risk-sla-in-minutes <minutes>", "Queue item processing risk SLA in minutes").option("--auto-retry", "Enable automatic retry of failed items").option("--no-auto-retry", "Disable automatic retry of failed items").option("--retry-abandoned-items", "Enable automatic retry of abandoned items").option("--no-retry-abandoned-items", "Disable automatic retry of abandoned items").option("--enforce-unique-reference", "Enforce unique reference values for queue items").option("--no-enforce-unique-reference", "Disable unique reference enforcement for queue items").option("--encrypted", "Store queue item data in encrypted format").option("--retention-action <action>", "Action for completed items, one of: Delete, Archive, None (e.g. --retention-action Archive). Switching to Archive requires --retention-bucket unless the queue already archives").option("--retention-period <days>", "Retention period in days for completed items").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived completed items. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-action <action>", "Action for uncompleted items, one of: Delete, Archive, None (e.g. --stale-retention-action Archive). Switching to Archive requires --stale-retention-bucket unless the queue already archives them").option("--stale-retention-period <days>", "Retention period in days for uncompleted items").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived uncompleted items. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").examples(QUEUES_UPDATE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
12167
+ queues.command("update").description("Update queue properties by key (GUID). No folder needed -- resolves cross-folder; pass --folder-path or --folder-key to look the key up in that folder instead. " + "Only provided fields are changed. " + "Archive retention needs a storage bucket (--retention-bucket / --stale-retention-bucket); the current bucket is kept while the action stays Archive and cleared when it changes. " + "Use 'queues list' to retrieve the key.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Path of the folder that holds the queue (e.g., 'Shared'). Looks the key up in that folder only", parseFolderPath).option("--folder-key <key>", "Key (GUID) of the folder that holds the queue. Looks the key up in that folder only", parseFolderKey).option("-n, --name <name>", "New queue name").option("-d, --description <text>", "Description of the queue").option("--max-retries <number>", "Maximum number of retry attempts for failed items").option("--sla-in-minutes <minutes>", "Queue item processing SLA in minutes").option("--risk-sla-in-minutes <minutes>", "Queue item processing risk SLA in minutes").option("--auto-retry", "Enable automatic retry of failed items").option("--no-auto-retry", "Disable automatic retry of failed items").option("--retry-abandoned-items", "Enable automatic retry of abandoned items").option("--no-retry-abandoned-items", "Disable automatic retry of abandoned items").option("--enforce-unique-reference", "Enforce unique reference values for queue items").option("--no-enforce-unique-reference", "Disable unique reference enforcement for queue items").option("--encrypted", "Store queue item data in encrypted format").option("--retention-action <action>", "Action for completed items, one of: Delete, Archive, None (e.g. --retention-action Archive). Switching to Archive requires --retention-bucket unless the queue already archives").option("--retention-period <days>", "Retention period in days for completed items").option("--retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived completed items. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").option("--stale-retention-action <action>", "Action for uncompleted items, one of: Delete, Archive, None (e.g. --stale-retention-action Archive). Switching to Archive requires --stale-retention-bucket unless the queue already archives them").option("--stale-retention-period <days>", "Retention period in days for uncompleted items").option("--stale-retention-bucket <bucket-key>", "Storage bucket key (GUID) for archived uncompleted items. Omit to keep the current bucket; it is cleared automatically when the action is no longer Archive. The bucket must be in, or shared to, the queue's folder. Use 'buckets list' to retrieve the key").examples(QUEUES_UPDATE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
11701
12168
  const slaInMinutes = parseOptionalMinutes(options.slaInMinutes, "--sla-in-minutes", "Error updating queue");
11702
12169
  if (options.slaInMinutes !== undefined && slaInMinutes === undefined) {
11703
12170
  return;
@@ -11784,7 +12251,7 @@ var registerQueuesCommand = (program) => {
11784
12251
  Data: updated
11785
12252
  });
11786
12253
  });
11787
- queues.command("delete").description("Delete a queue by key (GUID). No folder needed -- resolves cross-folder; pass --folder-path or --folder-key to look the key up in that folder instead. " + "Refuses to delete a queue that still has items unless you pass --force " + "(deleting the queue deletes its items too). " + "Use 'queues list' to retrieve the key.").argument("<queue-key>", "Queue key (GUID) to delete").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Path of the folder that holds the queue (e.g., 'Shared'). Looks the key up in that folder only").option("--folder-key <key>", "Key (GUID) of the folder that holds the queue. Looks the key up in that folder only").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").option("-f, --force", "Delete the queue even if it still has items (the items are deleted too; implies --yes)").examples(QUEUES_DELETE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
12254
+ queues.command("delete").description("Delete a queue by key (GUID). No folder needed -- resolves cross-folder; pass --folder-path or --folder-key to look the key up in that folder instead. " + "Refuses to delete a queue that still has items unless you pass --force " + "(deleting the queue deletes its items too). " + "Use 'queues list' to retrieve the key.").argument("<queue-key>", "Queue key (GUID) to delete").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Path of the folder that holds the queue (e.g., 'Shared'). Looks the key up in that folder only", parseFolderPath).option("--folder-key <key>", "Key (GUID) of the folder that holds the queue. Looks the key up in that folder only", parseFolderKey).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").option("-f, --force", "Delete the queue even if it still has items (the items are deleted too; implies --yes)").examples(QUEUES_DELETE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
11788
12255
  if (!requireConfirmation(options, `delete queue '${queueKey}'`))
11789
12256
  return;
11790
12257
  const target = await resolveQueueTarget(queueKey, options, "Error deleting queue");
@@ -11852,7 +12319,7 @@ var registerQueuesCommand = (program) => {
11852
12319
  Data: options.allFields ? result : formatQueueFolders(result)
11853
12320
  });
11854
12321
  });
11855
- queues.command("share").description("Share a queue with a folder. The queue becomes accessible in the target folder.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')").option("--folder-key <key>", "Target folder key (GUID)").examples(QUEUES_SHARE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
12322
+ queues.command("share").description("Share a queue with a folder. The queue becomes accessible in the target folder.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Target folder key (GUID)", parseFolderKey).examples(QUEUES_SHARE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
11856
12323
  const resolved = await resolveEntityOrFail(QueueDefinitionsApi2, { tenant: options.tenant }, resolveQueueByKey, queueKey, "Error sharing queue");
11857
12324
  if (!resolved)
11858
12325
  return;
@@ -11899,7 +12366,7 @@ var registerQueuesCommand = (program) => {
11899
12366
  }
11900
12367
  });
11901
12368
  });
11902
- queues.command("get-stats").description("Get processing statistics for a queue by key (GUID). " + "Returns item counts, exception counts, and processing times. " + "Use 'queues list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").requiredOption("--key <queue-key>", "Queue key (GUID) to get stats for").option("-n, --name <name>", "Filter by queue name (contains match)").option("--from <date>", "Filter queues last processed on or after this date (ISO 8601, e.g. 2026-01-01T00:00:00Z)").option("--to <date>", "Filter queues last processed on or before this date (ISO 8601, e.g. 2026-12-31T23:59:59Z)").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUES_GET_STATS_EXAMPLES).trackedAction(processContext, async (options) => {
12369
+ queues.command("get-stats").description("Get processing statistics for a queue by key (GUID). " + "Returns item counts, exception counts, and processing times. " + "Use 'queues list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).requiredOption("--key <queue-key>", "Queue key (GUID) to get stats for", parseGuid).option("-n, --name <name>", "Filter by queue name (contains match)", parseFilterValue).option("--from <date>", "Filter queues last processed on or after this date (ISO 8601, e.g. 2026-01-01 or 2026-01-01T00:00:00Z)", parseIsoDate).option("--to <date>", "Filter queues last processed on or before this date (ISO 8601, e.g. 2026-12-31T23:59:59Z). A date with no time covers that whole day.", parseIsoDate).option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(QUEUES_GET_STATS_EXAMPLES).trackedAction(processContext, async (options) => {
11903
12370
  const [apiError, api] = await catchError(createApiClient2(QueueProcessingRecordsApi2, {
11904
12371
  tenant: options.tenant,
11905
12372
  folderPath: options.folderPath,
@@ -11909,21 +12376,8 @@ var registerQueuesCommand = (program) => {
11909
12376
  await reportFailure2("Error getting queue stats", apiError);
11910
12377
  return;
11911
12378
  }
11912
- const filters = [];
11913
- const sanitizedKey = options.key.replace(/'/g, "''");
11914
- filters.push(`QueueDefinitionKey eq ${sanitizedKey}`);
11915
- if (options.name) {
11916
- const sanitized = options.name.replace(/'/g, "''");
11917
- filters.push(`contains(QueueDefinitionName, '${sanitized}')`);
11918
- }
11919
- if (options.from) {
11920
- filters.push(`LastProcessed ge ${options.from}`);
11921
- }
11922
- if (options.to) {
11923
- filters.push(`LastProcessed le ${options.to}`);
11924
- }
11925
12379
  const [statsError, result] = await catchError(api.queueProcessingRecordsRetrieveQueuesProcessingStatus({
11926
- $filter: filters.join(" and ")
12380
+ $filter: buildQueueStatsFilter(options)
11927
12381
  }));
11928
12382
  if (statsError) {
11929
12383
  await reportFailure2("Error getting queue stats", statsError);
@@ -11936,7 +12390,7 @@ var registerQueuesCommand = (program) => {
11936
12390
  Data: options.allFields ? statsRows : statsRows.map(formatQueueStats)
11937
12391
  });
11938
12392
  });
11939
- queues.command("unshare").description("Remove a queue from a folder. The queue is no longer accessible in that folder.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')").option("--folder-key <key>", "Target folder key (GUID)").examples(QUEUES_UNSHARE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
12393
+ queues.command("unshare").description("Remove a queue from a folder. The queue is no longer accessible in that folder.").argument("<queue-key>", "Queue key (GUID)").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Target folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Target folder key (GUID)", parseFolderKey).examples(QUEUES_UNSHARE_EXAMPLES).trackedAction(processContext, async (queueKey, options) => {
11940
12394
  const resolved = await resolveEntityOrFail(QueueDefinitionsApi2, { tenant: options.tenant }, resolveQueueByKey, queueKey, "Error unsharing queue");
11941
12395
  if (!resolved)
11942
12396
  return;
@@ -12900,7 +13354,7 @@ var registerRolesCommand = (program) => {
12900
13354
  });
12901
13355
  rolesCmd.command("assign").description("Assign folder-level roles to a user. Requires --folder-path or --folder-key. " + "The user must exist in the tenant. Use Folder-type roles only. " + `Use 'roles list' for role keys, 'users list' or 'users list-available' for user keys.
12902
13356
 
12903
- ` + "**CAUTION — destructive on roles.** The server REPLACES the user's folder-level role list in the target folder with the keys passed via --role-keys. Roles not in the payload are removed silently. To preserve existing folder roles, read them first via 'roles user-roles list <principal-name> --type <type>' and pass the full desired union to --role-keys.").requiredOption("--user-key <key>", "User key (GUID)").requiredOption("--role-keys <keys>", "Comma-separated role GUIDs to assign").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key").option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(ROLES_ASSIGN_EXAMPLES).trackedAction(processContext, async (options) => {
13357
+ ` + "**CAUTION — destructive on roles.** The server REPLACES the user's folder-level role list in the target folder with the keys passed via --role-keys. Roles not in the payload are removed silently. To preserve existing folder roles, read them first via 'roles user-roles list <principal-name> --type <type>' and pass the full desired union to --role-keys.").requiredOption("--user-key <key>", "User key (GUID)").requiredOption("--role-keys <keys>", "Comma-separated role GUIDs to assign").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path", parseFolderKey).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(ROLES_ASSIGN_EXAMPLES).trackedAction(processContext, async (options) => {
12904
13358
  const [resolveError, folder] = await catchError(resolveFolder2({
12905
13359
  folderPath: options.folderPath,
12906
13360
  folderKey: options.folderKey
@@ -12968,7 +13422,7 @@ var registerRolesCommand = (program) => {
12968
13422
  });
12969
13423
  });
12970
13424
  const userPermissionsGroup = rolesCmd.command("user-permissions").description("Inspect a user's effective permissions, optionally scoped to a folder.");
12971
- userPermissionsGroup.command("list").description("List effective permissions for a user. " + "Without --folder-path or --folder-key, shows tenant-level roles and permissions. " + "With a folder option, shows roles and permissions granted in that folder. " + "Returns the list of assigned roles and the deduplicated list of all permissions those roles grant.").argument("<username>", "Username to look up").option("--folder-path <path>", "Folder path (e.g., 'Shared') — show folder-level permissions instead of tenant").option("--folder-key <key>", "Folder key (GUID) — show folder-level permissions instead of tenant").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(ROLES_LIST_USER_PERMISSIONS_EXAMPLES).trackedAction(processContext, async (username, options) => {
13425
+ userPermissionsGroup.command("list").description("List effective permissions for a user. " + "Without --folder-path or --folder-key, shows tenant-level roles and permissions. " + "With a folder option, shows roles and permissions granted in that folder. " + "Returns the list of assigned roles and the deduplicated list of all permissions those roles grant.").argument("<username>", "Username to look up").option("--folder-path <path>", "Folder path (e.g., 'Shared') — show folder-level permissions instead of tenant", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — show folder-level permissions instead of tenant", parseFolderKey).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(ROLES_LIST_USER_PERMISSIONS_EXAMPLES).trackedAction(processContext, async (username, options) => {
12972
13426
  const folderScoped = !!(options.folderPath || options.folderKey);
12973
13427
  let resolvedFolderId;
12974
13428
  let resolvedFolderPath;
@@ -13352,7 +13806,7 @@ var registerSessionsCommand = (program) => {
13352
13806
  const attended = sessions.command("attended").description("List attended sessions (active host connections for attended runtimes).");
13353
13807
  const unattended = sessions.command("unattended").description("List unattended sessions (machine-mapped runtimes).");
13354
13808
  const machines = sessions.command("machines").description("Inspect runtimes for a specific machine.");
13355
- attended.command("list").description("List attended sessions. " + "Without --folder-key or --folder-path, returns sessions across all folders (global view). " + "With --folder-key or --folder-path, returns sessions within the specified folder.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find").option("--folder-path <path>", "Folder path (e.g., 'Shared', 'Production/SubFolder')").option("--state <state>", "Filter by session state (Available, Busy, Disconnected, Unknown)").option("--machine-name <name>", "Filter by machine name (contains match)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc', 'MachineName asc')", "Id desc").examples(SESSIONS_LIST_ATTENDED_EXAMPLES).trackedAction(processContext, async (options) => {
13809
+ attended.command("list").description("List attended sessions. " + "Without --folder-key or --folder-path, returns sessions across all folders (global view). " + "With --folder-key or --folder-path, returns sessions within the specified folder.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find", parseFolderKey).option("--folder-path <path>", "Folder path (e.g., 'Shared', 'Production/SubFolder')", parseFolderPath).option("--state <state>", "Filter by session state (Available, Busy, Disconnected, Unknown)", parseFilterValue).option("--machine-name <name>", "Filter by machine name (contains match)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc', 'MachineName asc')", "Id desc").examples(SESSIONS_LIST_ATTENDED_EXAMPLES).trackedAction(processContext, async (options) => {
13356
13810
  if (options.state && !VALID_STATES.includes(options.state)) {
13357
13811
  OutputFormatter.error({
13358
13812
  Result: RESULTS.Failure,
@@ -13408,7 +13862,7 @@ var registerSessionsCommand = (program) => {
13408
13862
  Data: items
13409
13863
  });
13410
13864
  });
13411
- machines.command("list").description("List sessions for a specific machine. " + "Accepts the machine key (GUID) — use 'machines list' to find machine keys. " + "Optionally scope to a folder with --folder-key or --folder-path.").argument("<machine-key>", "Machine key (GUID) — use 'machines list' to find").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) for folder context").option("--folder-path <path>", "Folder path for folder context").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc')", "Id desc").examples(SESSIONS_LIST_MACHINES_SESSIONS_EXAMPLES).trackedAction(processContext, async (machineKey, options) => {
13865
+ machines.command("list").description("List sessions for a specific machine. " + "Accepts the machine key (GUID) — use 'machines list' to find machine keys. " + "Optionally scope to a folder with --folder-key or --folder-path.").argument("<machine-key>", "Machine key (GUID) — use 'machines list' to find").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) for folder context", parseFolderKey).option("--folder-path <path>", "Folder path for folder context", parseFolderPath).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc')", "Id desc").examples(SESSIONS_LIST_MACHINES_SESSIONS_EXAMPLES).trackedAction(processContext, async (machineKey, options) => {
13412
13866
  const resolved = await resolveOrReportError(resolveMachine(machineKey, { tenant: options.tenant }), "Error resolving machine");
13413
13867
  if (resolved === null)
13414
13868
  return;
@@ -13474,7 +13928,7 @@ var registerSessionsCommand = (program) => {
13474
13928
  Data: items
13475
13929
  });
13476
13930
  });
13477
- unattended.command("list").description("List unattended sessions (machine runtime slot usage). " + "Without --folder-key or --folder-path, returns sessions across the tenant. " + "With --folder-key or --folder-path, returns sessions within the specified folder.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find").option("--folder-path <path>", "Folder path (e.g., 'Shared', 'Production/SubFolder')").option("--runtime-type <type>", "Filter by runtime type (e.g., Unattended, Attended, Headless, Serverless)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'SessionId desc')", "SessionId desc").examples(SESSIONS_LIST_UNATTENDED_EXAMPLES).trackedAction(processContext, async (options) => {
13931
+ unattended.command("list").description("List unattended sessions (machine runtime slot usage). " + "Without --folder-key or --folder-path, returns sessions across the tenant. " + "With --folder-key or --folder-path, returns sessions within the specified folder.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-key <key>", "Folder key (GUID) — use 'folders list' to find", parseFolderKey).option("--folder-path <path>", "Folder path (e.g., 'Shared', 'Production/SubFolder')", parseFolderPath).option("--runtime-type <type>", "Filter by runtime type (e.g., Unattended, Attended, Headless, Serverless)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'SessionId desc')", "SessionId desc").examples(SESSIONS_LIST_UNATTENDED_EXAMPLES).trackedAction(processContext, async (options) => {
13478
13932
  const $top = parseInt(options.limit || "50", 10);
13479
13933
  const $skip = parseInt(options.offset || "0", 10);
13480
13934
  const $orderby = options.sortBy;
@@ -13847,7 +14301,7 @@ var SETTINGS_TIMEZONES_EXAMPLES = [
13847
14301
  ];
13848
14302
  var registerSettingsCommand = (program) => {
13849
14303
  const settings = program.command("settings").description("Manage tenant settings. Settings are key-value pairs — use 'settings list' to discover keys. " + "Categories and common keys: " + "[General] Abp.Timing.TimeZone (timezone ID, e.g. 'UTC' — use 'settings timezones' to list valid IDs), " + "Abp.Localization.DefaultLanguageName (language code, e.g. 'en', 'fr', 'de'). " + "[Email] Alerts.Email.Enabled (true/false), " + "Abp.Net.Mail.Smtp.Host (hostname), .Port (integer, e.g. 587), .UserName, .Password, .EnableSsl (true/false), .UseDefaultCredentials (true/false), " + "Abp.Net.Mail.DefaultFromAddress (email address). " + "[Robot Security] Auth.Robot.EnforceAuthenticationToken (true/false — force token auth for robots), " + "Auth.UnattendedRobot.ForceClientCredentials (True/False), " + "AttendedRobot.RunDisconnectedHours (integer, 0=disabled, hours a robot can run disconnected). " + "[Deployment] DeploymentUrl (NuGet feed URL), NuGet.Packages.ApiKey (API key string), " + "Deployment.Libraries.Url, NuGet.Activities.ApiKey, Deployment.Processes.AuthenticationType (Secure/apiKey). " + "[Scalability] Scalability.SignalR.Enabled (true/false), " + "Scalability.SignalR.Transport (bitmask: 1=WebSockets, 2=SSE, 4=LongPolling, 7=all), " + "Scalability.Heartbeat.PeriodSeconds (integer, default 30, seconds between robot heartbeats), " + "Scalability.Heartbeat.FailureThreshold (integer, default 4, missed heartbeats before marking not responding). " + "[Triggers] Triggers.DisableWhenFailedCount (integer, default 10, consecutive failures to auto-disable), " + "Triggers.DisableWhenFailingSinceDays (integer, default 1), " + "Triggers.JobsCountStrategy (PERPROCESS/PERTRIGGER), " + "QueueTrigger.ActivationFrequencyInMinutes (integer, default 30), " + "ConnectedTriggers.AutoDisableJobFailuresThreshold (integer, default 5). " + "[Queue] inProgressMaxNumberOfMinutes (integer, default 1440=24h, max time an item stays InProgress). " + "[Jobs] Jobs.TerminatingJobsTimeout (integer, default 1440 minutes=24h, timeout for terminating jobs). " + "Use 'settings execution' for structured execution settings with display names and allowed values.");
13850
- settings.command("list").description("List all tenant settings.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--scope <scope>", "Filter by scope (Application, Tenant, User, All)").option("-l, --limit <number>", "Number of items to return", "100").option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(SETTINGS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
14304
+ settings.command("list").description("List all tenant settings.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--scope <scope>", "Filter by scope (Application, Tenant, User, All)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", "100").option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(SETTINGS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
13851
14305
  const [apiError, api] = await catchError(createApiClient2(SettingsApi2, {
13852
14306
  tenant: options.tenant
13853
14307
  }));
@@ -14081,7 +14535,7 @@ function buildScheduleUpdateBody(existing, options, queueDefinitionId, machineRo
14081
14535
  bindingKey: existing.bindingKey
14082
14536
  };
14083
14537
  }
14084
- function buildApiTriggerUpdateBody(existing, options) {
14538
+ function buildApiTriggerUpdateBody(existing, options, machineRobots, account) {
14085
14539
  return {
14086
14540
  id: existing.id,
14087
14541
  callingMode: options.callingMode ?? existing.callingMode,
@@ -14098,8 +14552,8 @@ function buildApiTriggerUpdateBody(existing, options) {
14098
14552
  externalReference: existing.externalReference,
14099
14553
  description: existing.description,
14100
14554
  jobPriority: existing.jobPriority,
14101
- runAsMe: existing.runAsMe,
14102
- runAsCaller: existing.runAsCaller,
14555
+ runAsMe: account.runAsMe,
14556
+ runAsCaller: account.runAsCaller,
14103
14557
  runtimeType: options.runtimeType ?? existing.runtimeType,
14104
14558
  targetFramework: existing.targetFramework,
14105
14559
  resumeOnSameContext: existing.resumeOnSameContext,
@@ -14114,7 +14568,7 @@ function buildApiTriggerUpdateBody(existing, options) {
14114
14568
  jobFailuresGracePeriodInHours: existing.jobFailuresGracePeriodInHours,
14115
14569
  inputArguments: existing.inputArguments,
14116
14570
  properties: existing.properties,
14117
- machineRobots: existing.machineRobots,
14571
+ machineRobots,
14118
14572
  tags: existing.tags,
14119
14573
  entryPointPath: options.entryPoint ?? existing.entryPointPath
14120
14574
  };
@@ -14133,6 +14587,7 @@ var VALID_API_RUNTIME_TYPES = [
14133
14587
  ];
14134
14588
  var VALID_RUNTIME_TYPES = [...VALID_API_RUNTIME_TYPES, "Local"];
14135
14589
  var VALID_HTTP_METHODS = ["Get", "Post", "Put", "Delete"];
14590
+ var TIME_ZONE_HELP = "Windows time zone ID, e.g. 'UTC' or 'GTB Standard Time' (Bucharest), not an IANA name like 'Europe/Bucharest' — 'settings timezones' lists valid IDs (applies to time-of-day fields)";
14136
14591
  var VALID_CALLING_MODES = [
14137
14592
  "AsyncRequestReply",
14138
14593
  "AsyncCallback",
@@ -14211,6 +14666,117 @@ function rejectExtraArguments(extra) {
14211
14666
  });
14212
14667
  return false;
14213
14668
  }
14669
+ function joinNames(names) {
14670
+ if (names.length <= 1)
14671
+ return names.join("");
14672
+ return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
14673
+ }
14674
+ function rejectApiOnlyRunAsForSchedule(options, triggerType) {
14675
+ const given = [
14676
+ options.runAsCaller !== undefined ? "--run-as-caller" : undefined,
14677
+ options.runAsAny !== undefined ? "--run-as-any" : undefined
14678
+ ].filter((name) => name !== undefined);
14679
+ if (given.length === 0)
14680
+ return true;
14681
+ const advice = [
14682
+ triggerType === "time" ? "If this is an API trigger, add --type api: --type defaults to time." : undefined,
14683
+ `Drop ${joinNames(given)}: a ${triggerType} trigger chooses its account with --run-as-me (you) or --target user=<key> (that account), and with neither the folder allocates one.`
14684
+ ].filter((line) => line !== undefined);
14685
+ OutputFormatter.error({
14686
+ Result: RESULTS.ValidationError,
14687
+ ErrorCode: "invalid_argument",
14688
+ Message: `${joinNames(given)} ${given.length > 1 ? "work" : "works"} only on API triggers, not on ${triggerType} triggers`,
14689
+ Instructions: advice.join(" "),
14690
+ Retry: "RetryWillNotFix"
14691
+ });
14692
+ return false;
14693
+ }
14694
+ function targetSpecsNameUser(specs) {
14695
+ return (specs ?? []).some((spec) => {
14696
+ const [err, parsed] = catchError(() => parseTargetSpec(spec));
14697
+ return !err && parsed.userKey !== undefined;
14698
+ });
14699
+ }
14700
+ function resolveApiAccount(options, current) {
14701
+ const picks = [];
14702
+ if (options.runAsCaller === true) {
14703
+ picks.push({
14704
+ flag: "--run-as-caller",
14705
+ account: { runAsCaller: true, runAsMe: false, stripUsers: true }
14706
+ });
14707
+ }
14708
+ if (options.runAsMe === true) {
14709
+ picks.push({
14710
+ flag: "--run-as-me",
14711
+ account: { runAsCaller: false, runAsMe: true, stripUsers: false }
14712
+ });
14713
+ }
14714
+ if (targetSpecsNameUser(options.target)) {
14715
+ picks.push({
14716
+ flag: "--target user=<key>",
14717
+ account: { runAsCaller: false, runAsMe: false, stripUsers: false }
14718
+ });
14719
+ }
14720
+ if (options.runAsAny === true) {
14721
+ picks.push({
14722
+ flag: "--run-as-any",
14723
+ account: { runAsCaller: false, runAsMe: false, stripUsers: true }
14724
+ });
14725
+ }
14726
+ if (picks.length === 1)
14727
+ return picks[0].account;
14728
+ if (picks.length === 0) {
14729
+ return {
14730
+ runAsCaller: current.runAsCaller ?? false,
14731
+ runAsMe: options.runAsMe === false ? false : current.runAsMe ?? false,
14732
+ stripUsers: false
14733
+ };
14734
+ }
14735
+ OutputFormatter.error({
14736
+ Result: RESULTS.ValidationError,
14737
+ ErrorCode: "invalid_argument",
14738
+ Message: `Cannot combine ${joinNames(picks.map((p) => p.flag))}: ${picks.length > 2 ? "each chooses" : "both choose"} the account the trigger's jobs run as`,
14739
+ Instructions: "Pass only one: --run-as-caller (whoever calls the endpoint), --run-as-me (you, the trigger's creator), --target user=<key> (that account) or --run-as-any (any account the folder allocates). To also choose a machine, add a --target with only machine=<key>.",
14740
+ Retry: "RetryWillNotFix"
14741
+ });
14742
+ return;
14743
+ }
14744
+ function withTargetUserKept(existing, targets) {
14745
+ const robots = new Map;
14746
+ for (const m of existing ?? []) {
14747
+ if (m.robotId != null) {
14748
+ robots.set(m.robotId, m.robotUserName ?? String(m.robotId));
14749
+ }
14750
+ }
14751
+ if (robots.size === 0)
14752
+ return targets;
14753
+ if (robots.size === 1) {
14754
+ const [robotId] = robots.keys();
14755
+ return targets.map((t) => ({ ...t, robotId }));
14756
+ }
14757
+ OutputFormatter.error({
14758
+ Result: RESULTS.ValidationError,
14759
+ ErrorCode: "invalid_argument",
14760
+ Message: `Cannot tell which account to keep on the new targets: the trigger's targets name ${robots.size} accounts (${joinNames([...robots.values()])})`,
14761
+ Instructions: "Add user=<key> to each --target to choose the account, or pass --run-as-any to run on any account the folder allocates. 'triggers get --type api' lists the current targets.",
14762
+ Retry: "RetryWillNotFix"
14763
+ });
14764
+ return;
14765
+ }
14766
+ function withoutTargetUsers(machineRobots) {
14767
+ const kept = [];
14768
+ for (const m of machineRobots ?? []) {
14769
+ if (m.machineId == null && m.sessionId == null)
14770
+ continue;
14771
+ const entry = {};
14772
+ if (m.machineId != null)
14773
+ entry.machineId = m.machineId;
14774
+ if (m.sessionId != null)
14775
+ entry.sessionId = m.sessionId;
14776
+ kept.push(entry);
14777
+ }
14778
+ return kept;
14779
+ }
14214
14780
  function resolveEnabledOption(options, fallback) {
14215
14781
  if (options.enabled)
14216
14782
  return true;
@@ -14276,7 +14842,14 @@ function formatHttpTriggerDetail(t) {
14276
14842
  EntryPointPath: t.entryPointPath ?? "",
14277
14843
  StopStrategy: t.stopStrategy ?? "",
14278
14844
  Description: t.description ?? "",
14279
- Tags: (t.tags ?? []).map((tag) => tag.name ?? "")
14845
+ Tags: (t.tags ?? []).map((tag) => tag.name ?? ""),
14846
+ RunAsCaller: t.runAsCaller ?? false,
14847
+ RunAsMe: t.runAsMe ?? false,
14848
+ Targets: (t.machineRobots ?? []).map((m) => ({
14849
+ MachineName: m.machineName ?? "",
14850
+ UserName: m.robotUserName ?? "",
14851
+ SessionName: m.sessionName ?? ""
14852
+ }))
14280
14853
  };
14281
14854
  }
14282
14855
  var TRIGGERS_LIST_EXAMPLES = [
@@ -14544,7 +15117,7 @@ function buildODataFilters(options) {
14544
15117
  }
14545
15118
  var registerTriggersCommand = (program) => {
14546
15119
  const triggers = program.command("triggers").description("Manage UiPath Orchestrator triggers (time, queue, API). " + "All trigger types are folder-scoped.");
14547
- triggers.command("list").description("List triggers by type. --type selects trigger type: time (default), queue, or api. " + "All types require --folder-path or --folder-key. " + "Returns key (GUID), name, enabled status, and release info.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-n, --name <name>", "Filter by trigger name (contains match)").option("--enabled", "Show only enabled triggers").option("--disabled", "Show only disabled triggers").option("-l, --limit <number>", "Number of items to return", "50").option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(TRIGGERS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
15120
+ triggers.command("list").description("List triggers by type. --type selects trigger type: time (default), queue, or api. " + "All types require --folder-path or --folder-key. " + "Returns key (GUID), name, enabled status, and release info.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-n, --name <name>", "Filter by trigger name (contains match)", parseFilterValue).option("--enabled", "Show only enabled triggers").option("--disabled", "Show only disabled triggers").option("-l, --limit <number>", "Number of items to return", "50").option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(TRIGGERS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
14548
15121
  const triggerType = validateTriggerType(options.type);
14549
15122
  if (!triggerType) {
14550
15123
  emitInvalidTypeError(options.type);
@@ -14637,7 +15210,7 @@ var registerTriggersCommand = (program) => {
14637
15210
  });
14638
15211
  }
14639
15212
  });
14640
- triggers.command("get").description("Get trigger details by key (GUID). --type selects trigger type: time (default), queue, or api. " + "All types require --folder-path or --folder-key. " + "Use 'triggers list' to retrieve the key.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(TRIGGERS_GET_EXAMPLES).trackedAction(processContext, async (triggerKey, options) => {
15213
+ triggers.command("get").description("Get trigger details by key (GUID). --type selects trigger type: time (default), queue, or api. " + "All types require --folder-path or --folder-key. " + "Use 'triggers list' to retrieve the key.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(TRIGGERS_GET_EXAMPLES).trackedAction(processContext, async (triggerKey, options) => {
14641
15214
  const triggerType = validateTriggerType(options.type);
14642
15215
  if (!triggerType) {
14643
15216
  emitInvalidTypeError(options.type);
@@ -14694,12 +15267,15 @@ var registerTriggersCommand = (program) => {
14694
15267
  });
14695
15268
  }
14696
15269
  });
14697
- triggers.command("create").description("Create a new trigger. --type selects trigger type: time (default), queue, or api. Requires --name, --release-key, --runtime-type. " + "Time triggers need --cron; queue triggers need --queue-key. " + "API triggers need --slug and --method. " + "Folder is inferred from --release-key; pass --folder-path or --folder-key when your identity only has a folder-level role (such as an external app), since it cannot look processes up tenant-wide. " + "Use 'processes list' to find the release key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).requiredOption("--name <name>", "Trigger name").option("-d, --description <text>", "Trigger description").requiredOption("--release-key <key>", "Release key (GUID) of the process to trigger").option("--entry-point <path>", "Entry point the trigger runs, by its path, for a process whose package has several. Defaults to the entry point of the process. Use 'packages entry-points' to list the paths.").option("--folder-path <path>", "Folder path of the process (e.g., 'Shared'). Optional — inferred from --release-key if not given").option("--folder-key <key>", "Folder key (GUID) of the process. Optional — inferred from --release-key if not given").option("--input-arguments <json>", `Input arguments as JSON string (e.g., '{"Arg1":"value"}')`).option("--calendar-key <key>", "Calendar key (GUID) for excluding non-working days. Use 'calendars list' to find keys.").option("--stop-strategy <strategy>", "How to stop running jobs: SoftStop or Kill").option("--kill-process-expression <expression>", "Cron expression for force-killing jobs (requires --stop-strategy Kill)").option("--cron <expression>", "Cron expression in Quartz 6-field format: 'sec min hour day month weekday' (e.g., '0 0 12 * * ?' for daily at noon). Note: standard Unix 5-field cron is not supported.").option("--time-zone <timezone>", "IANA time zone ID, e.g. 'UTC' or 'Europe/Bucharest' (applies to time-of-day fields)").option("--queue-key <key>", "Queue key (GUID) for queue trigger (queue only)").option("--items-threshold <number>", "Minimum queue items to trigger activation (queue only)", "1").option("--max-jobs <number>", "Maximum concurrent jobs for queue activation (queue only)", "1").option("--items-per-job <number>", "Target ratio of queue items per job (queue only)", "1").option("--activate-on-complete", "Re-trigger when a job completes (queue only)").option("--resume-on-same-context", "Resume suspended jobs on the same machine").option("--run-as-me", "Run job under the trigger creator's identity").option("--disabled", "Create the trigger in disabled state (default: enabled)").requiredOption("--runtime-type <type>", "Execution runtime (Serverless, Unattended, Headless, NonProduction, AgentService, Local, Flow). Local runs Agent, Function and API workflow jobs on the folder machines' local slots; Flow is the runtime a Maestro flow process's triggers report, and 'triggers get' shows it. API triggers accept Flow but not Local").requiredOption("--job-priority <priority>", "Job execution priority (Low, Normal, High)", "Normal").option("--slug <slug>", "URL slug for API trigger (api only)").option("--method <method>", "HTTP method: Get, Post, Put, Delete (api only)").option("--calling-mode <mode>", "Calling mode: AsyncRequestReply, AsyncCallback, LongPolling, FireAndForget (api only)").option("--target <spec>", "Run target as 'machine=<guid>,user=<guid>,session=<int>' (any field optional). Repeat for multiple targets. Use 'machines list' and 'users list' to find keys.", (val, prev) => prev ? [...prev, val] : [val]).option("--mapping-mode <mode>", "Validation mode for --target: 'dynamic' (default) allows any combination of machine/user/session (session requires machine); 'strict' requires both machine and user on every target (use when the folder has 'Enable account-machine mappings' turned on).", "dynamic").examples(TRIGGERS_CREATE_EXAMPLES).trackedAction(processContext, async (options) => {
15270
+ triggers.command("create").description("Create a new trigger. --type selects trigger type: time (default), queue, or api. Requires --name, --release-key, --runtime-type. " + "Time triggers need --cron; queue triggers need --queue-key. " + "API triggers need --slug and --method. " + "Folder is inferred from --release-key; pass --folder-path or --folder-key when your identity only has a folder-level role (such as an external app), since it cannot look processes up tenant-wide. " + "Use 'processes list' to find the release key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).requiredOption("--name <name>", "Trigger name").option("-d, --description <text>", "Trigger description").requiredOption("--release-key <key>", "Release key (GUID) of the process to trigger").option("--entry-point <path>", "Entry point the trigger runs, by its path, for a process whose package has several. Defaults to the entry point of the process. Use 'packages entry-points' to list the paths.").option("--folder-path <path>", "Folder path of the process (e.g., 'Shared'). Optional — inferred from --release-key if not given", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) of the process. Optional — inferred from --release-key if not given", parseFolderKey).option("--input-arguments <json>", `Input arguments as JSON string (e.g., '{"Arg1":"value"}')`).option("--calendar-key <key>", "Calendar key (GUID) for excluding non-working days. Use 'calendars list' to find keys.").option("--stop-strategy <strategy>", "How to stop running jobs: SoftStop or Kill").option("--kill-process-expression <expression>", "Cron expression for force-killing jobs (requires --stop-strategy Kill)").option("--cron <expression>", "Cron expression in Quartz 6-field format: 'sec min hour day month weekday' (e.g., '0 0 12 * * ?' for daily at noon). Note: standard Unix 5-field cron is not supported.").option("--time-zone <timezone>", TIME_ZONE_HELP).option("--queue-key <key>", "Queue key (GUID) for queue trigger (queue only)").option("--items-threshold <number>", "Minimum queue items to trigger activation (queue only)", "1").option("--max-jobs <number>", "Maximum concurrent jobs for queue activation (queue only)", "1").option("--items-per-job <number>", "Target ratio of queue items per job (queue only)", "1").option("--activate-on-complete", "Re-trigger when a job completes (queue only)").option("--resume-on-same-context", "Resume suspended jobs on the same machine").option("--run-as-me", "Run job under the trigger creator's identity").option("--disabled", "Create the trigger in disabled state (default: enabled)").requiredOption("--runtime-type <type>", "Execution runtime (Serverless, Unattended, Headless, NonProduction, AgentService, Local, Flow). Local runs Agent, Function and API workflow jobs on the folder machines' local slots; Flow is the runtime a Maestro flow process's triggers report, and 'triggers get' shows it. API triggers accept Flow but not Local").requiredOption("--job-priority <priority>", "Job execution priority (Low, Normal, High)", "Normal").option("--slug <slug>", "URL slug for API trigger (api only)").option("--method <method>", "HTTP method: Get, Post, Put, Delete (api only)").option("--calling-mode <mode>", "Calling mode: AsyncRequestReply, AsyncCallback, LongPolling, FireAndForget (api only)").option("--run-as-caller", "Run each job as the identity that calls the endpoint (api only; HTTP triggers, not time or queue). Picks the account like --run-as-me and a --target with user=, so pass only one of them; a --target with only machine= still applies. With none of them, jobs run on any account the folder allocates").option("--run-as-any", "Run each job on any account the folder allocates (api only; HTTP triggers, not time or queue). A new trigger gets this when none of --run-as-caller, --run-as-me or a --target with user= is given").option("--target <spec>", "Run target as 'machine=<guid>,user=<guid>,session=<int>' (any field optional). Repeat for multiple targets. Use 'machines list' and 'users list' to find keys.", (val, prev) => prev ? [...prev, val] : [val]).option("--mapping-mode <mode>", "Validation mode for --target: 'dynamic' (default) allows any combination of machine/user/session (session requires machine); 'strict' requires both machine and user on every target (use when the folder has 'Enable account-machine mappings' turned on).", "dynamic").examples(TRIGGERS_CREATE_EXAMPLES).trackedAction(processContext, async (options) => {
14698
15271
  const triggerType = validateTriggerType(options.type);
14699
15272
  if (!triggerType) {
14700
15273
  emitInvalidTypeError(options.type);
14701
15274
  return;
14702
15275
  }
15276
+ if (isScheduleType(triggerType) && !rejectApiOnlyRunAsForSchedule(options, triggerType)) {
15277
+ return;
15278
+ }
14703
15279
  if (triggerType === "time") {
14704
15280
  await createScheduleTrigger(options, true);
14705
15281
  } else if (triggerType === "queue") {
@@ -14708,7 +15284,7 @@ var registerTriggersCommand = (program) => {
14708
15284
  await createApiTrigger(options);
14709
15285
  }
14710
15286
  });
14711
- triggers.command("update").description("Update an existing trigger by key (GUID). --type defaults to time. Only provided fields are changed. " + "All types require --folder-path or --folder-key. " + "Use 'triggers list' to retrieve the key.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("--name <name>", "New trigger name").option("--release-key <key>", "Release key (GUID) of the process to schedule").option("--entry-point <path>", "Entry point the trigger runs, by its path. Use 'packages entry-points' to list the paths.").option("--cron <expression>", "Cron expression for scheduling (time only)").option("--time-zone <timezone>", "IANA time zone ID, e.g. 'UTC' or 'Europe/Bucharest' (applies to time-of-day fields)").option("--queue-key <key>", "Queue key (GUID) for queue-based trigger (queue only)").option("--runtime-type <type>", "Execution runtime (Serverless, Unattended, Headless, NonProduction, AgentService, Local, Flow). Local runs Agent, Function and API workflow jobs on the folder machines' local slots; Flow is the runtime a Maestro flow process's triggers report, and 'triggers get' shows it. API triggers accept Flow but not Local").option("--job-priority <priority>", "Job execution priority (Low, Normal, High)").option("--input-arguments <json>", `Input arguments as JSON string, replacing all of the trigger's current arguments (e.g., '{"Arg1":"value"}') (time and queue only)`).option("--items-threshold <number>", "Minimum queue items to trigger (queue only)").option("--max-jobs <number>", "Maximum concurrent jobs for queue activation (queue only)").option("--items-per-job <number>", "Target ratio of queue items per job (queue only)").option("--activate-on-complete", "Re-trigger when a job completes (queue only)").option("--no-activate-on-complete", "Disable re-trigger on job completion (queue only)").option("--resume-on-same-context", "Resume suspended jobs on same machine").option("--no-resume-on-same-context", "Disable resume on same context").option("--run-as-me", "Run under trigger creator's identity").option("--no-run-as-me", "Disable run-as-me").option("--slug <slug>", "URL slug (api only)").option("--method <method>", "HTTP method: Get, Post, Put, Delete (api only)").option("--calling-mode <mode>", "Calling mode (api only)").option("--target <spec>", "Run target as 'machine=<guid>,user=<guid>,session=<int>' (any field optional). Repeat for multiple targets. Use 'machines list' and 'users list' to find keys.", (val, prev) => prev ? [...prev, val] : [val]).option("--mapping-mode <mode>", "Validation mode for --target: 'dynamic' (default) allows any combination of machine/user/session (session requires machine); 'strict' requires both machine and user on every target (use when the folder has 'Enable account-machine mappings' turned on).", "dynamic").option("--enabled", "Enable the trigger").option("--disabled", "Disable the trigger").allowExcessArguments().examples(TRIGGERS_UPDATE_EXAMPLES).trackedAction(processContext, async (triggerKey, options, command) => {
15287
+ triggers.command("update").description("Update an existing trigger by key (GUID). --type defaults to time. Only provided fields are changed. " + "All types require --folder-path or --folder-key. " + "Use 'triggers list' to retrieve the key.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("--name <name>", "New trigger name").option("--release-key <key>", "Release key (GUID) of the process to schedule").option("--entry-point <path>", "Entry point the trigger runs, by its path. Use 'packages entry-points' to list the paths.").option("--cron <expression>", "Cron expression for scheduling (time only)").option("--time-zone <timezone>", TIME_ZONE_HELP).option("--queue-key <key>", "Queue key (GUID) for queue-based trigger (queue only)").option("--runtime-type <type>", "Execution runtime (Serverless, Unattended, Headless, NonProduction, AgentService, Local, Flow). Local runs Agent, Function and API workflow jobs on the folder machines' local slots; Flow is the runtime a Maestro flow process's triggers report, and 'triggers get' shows it. API triggers accept Flow but not Local").option("--job-priority <priority>", "Job execution priority (Low, Normal, High)").option("--input-arguments <json>", `Input arguments as JSON string, replacing all of the trigger's current arguments (e.g., '{"Arg1":"value"}') (time and queue only)`).option("--items-threshold <number>", "Minimum queue items to trigger (queue only)").option("--max-jobs <number>", "Maximum concurrent jobs for queue activation (queue only)").option("--items-per-job <number>", "Target ratio of queue items per job (queue only)").option("--activate-on-complete", "Re-trigger when a job completes (queue only)").option("--no-activate-on-complete", "Disable re-trigger on job completion (queue only)").option("--resume-on-same-context", "Resume suspended jobs on same machine").option("--no-resume-on-same-context", "Disable resume on same context").option("--run-as-me", "Run under trigger creator's identity").option("--no-run-as-me", "Disable run-as-me").option("--slug <slug>", "URL slug (api only)").option("--method <method>", "HTTP method: Get, Post, Put, Delete (api only)").option("--calling-mode <mode>", "Calling mode (api only)").option("--run-as-caller", "Run each job as the identity that calls the endpoint (api only; HTTP triggers, not time or queue). Triggers Orchestrator creates from a package start with this. One of four account choices with --run-as-me, a --target with user= and --run-as-any: pass one, and it replaces the trigger's current account. A --target with only machine= still applies").option("--run-as-any", "Run each job on any account the folder allocates, clearing the trigger's account (api only; HTTP triggers, not time or queue). Removes the user from the trigger's targets and keeps their machines").option("--target <spec>", "Run target as 'machine=<guid>,user=<guid>,session=<int>' (any field optional). Repeat for multiple targets. Use 'machines list' and 'users list' to find keys.", (val, prev) => prev ? [...prev, val] : [val]).option("--mapping-mode <mode>", "Validation mode for --target: 'dynamic' (default) allows any combination of machine/user/session (session requires machine); 'strict' requires both machine and user on every target (use when the folder has 'Enable account-machine mappings' turned on).", "dynamic").option("--enabled", "Enable the trigger").option("--disabled", "Disable the trigger").allowExcessArguments().examples(TRIGGERS_UPDATE_EXAMPLES).trackedAction(processContext, async (triggerKey, options, command) => {
14712
15288
  if (!rejectExtraArguments(command.args.slice(1)))
14713
15289
  return;
14714
15290
  const triggerType = validateTriggerType(options.type);
@@ -14728,13 +15304,16 @@ var registerTriggersCommand = (program) => {
14728
15304
  if (!requireTriggerFolder(options, "Error updating trigger")) {
14729
15305
  return;
14730
15306
  }
15307
+ if (isScheduleType(triggerType) && !rejectApiOnlyRunAsForSchedule(options, triggerType)) {
15308
+ return;
15309
+ }
14731
15310
  if (isScheduleType(triggerType)) {
14732
15311
  await updateScheduleTrigger(triggerKey, options, triggerType);
14733
15312
  } else {
14734
15313
  await updateApiTrigger(triggerKey, options);
14735
15314
  }
14736
15315
  });
14737
- triggers.command("delete").description("Delete a trigger by key (GUID). --type defaults to time. " + "All types require --folder-path or --folder-key. " + "Use 'triggers list' to retrieve the key.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(TRIGGERS_DELETE_EXAMPLES).trackedAction(processContext, async (triggerKey, options) => {
15316
+ triggers.command("delete").description("Delete a trigger by key (GUID). --type defaults to time. " + "All types require --folder-path or --folder-key. " + "Use 'triggers list' to retrieve the key.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").option("--type <type>", "Trigger type (time, queue, api)", "time").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-y, --yes", "Confirm this irreversible operation (required; the CLI never prompts)").examples(TRIGGERS_DELETE_EXAMPLES).trackedAction(processContext, async (triggerKey, options) => {
14738
15317
  if (!requireConfirmation(options, `delete trigger '${triggerKey}'`))
14739
15318
  return;
14740
15319
  const triggerType = validateTriggerType(options.type);
@@ -14793,7 +15372,7 @@ var registerTriggersCommand = (program) => {
14793
15372
  });
14794
15373
  }
14795
15374
  });
14796
- triggers.command("history").description("Show a trigger's failed fire attempts (fire log). " + "Shows why a trigger failed to fire (license missing, no machines, disabled, etc.); " + "an empty result means no recorded failures, not that the trigger never ran. " + "Works for time, queue, api and Integration Service event triggers, and fails if the key is not a trigger.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')").option("--folder-key <key>", "Folder key (GUID)").option("-l, --limit <number>", "Number of items to return", "50").option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field", "TimeStamp desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(TRIGGERS_HISTORY_EXAMPLES).trackedAction(processContext, async (triggerKey, options) => {
15375
+ triggers.command("history").description("Show a trigger's failed fire attempts (fire log). " + "Shows why a trigger failed to fire (license missing, no machines, disabled, etc.); " + "an empty result means no recorded failures, not that the trigger never ran. " + "Works for time, queue, api and Integration Service event triggers, and fails if the key is not a trigger.").argument("<trigger-key>", "Trigger key (GUID). Use 'triggers list' to retrieve the key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--folder-path <path>", "Folder path (e.g., 'Shared')", parseFolderPath).option("--folder-key <key>", "Folder key (GUID)", parseFolderKey).option("-l, --limit <number>", "Number of items to return", "50").option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field", "TimeStamp desc").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(TRIGGERS_HISTORY_EXAMPLES).trackedAction(processContext, async (triggerKey, options) => {
14797
15376
  const clientOptions = {
14798
15377
  tenant: options.tenant,
14799
15378
  folderPath: options.folderPath,
@@ -15095,6 +15674,12 @@ async function createApiTrigger(options) {
15095
15674
  }
15096
15675
  options.callingMode = matchedCallingMode;
15097
15676
  }
15677
+ const account = resolveApiAccount(options, {
15678
+ runAsCaller: false,
15679
+ runAsMe: false
15680
+ });
15681
+ if (!account)
15682
+ return;
15098
15683
  const [releaseError, release] = await catchError(resolveRelease2(options.releaseKey, {
15099
15684
  tenant: options.tenant,
15100
15685
  folderPath: options.folderPath,
@@ -15104,6 +15689,18 @@ async function createApiTrigger(options) {
15104
15689
  await reportReleaseLookupFailure("Error resolving release", releaseError);
15105
15690
  return;
15106
15691
  }
15692
+ let machineRobots = [];
15693
+ if (options.target && options.target.length > 0) {
15694
+ const resolved = await resolveTargets(options.target, options.mappingMode ?? "dynamic", {
15695
+ tenant: options.tenant,
15696
+ folderId: release.folderId || undefined,
15697
+ folderPath: options.folderPath,
15698
+ folderKey: options.folderKey
15699
+ });
15700
+ if (!resolved)
15701
+ return;
15702
+ machineRobots = resolved;
15703
+ }
15107
15704
  const [apiError, api] = await catchError(createApiClient2(HttpTriggersApi2, {
15108
15705
  tenant: options.tenant,
15109
15706
  folderId: release.folderId.toString()
@@ -15120,7 +15717,10 @@ async function createApiTrigger(options) {
15120
15717
  slug: options.slug,
15121
15718
  method: options.method,
15122
15719
  callingMode: options.callingMode,
15123
- runtimeType: options.runtimeType
15720
+ runtimeType: options.runtimeType,
15721
+ runAsCaller: account.runAsCaller,
15722
+ runAsMe: account.runAsMe,
15723
+ machineRobots
15124
15724
  };
15125
15725
  const [postError, result] = await catchError(api.httpTriggersPost({ body }));
15126
15726
  if (postError) {
@@ -15134,6 +15734,8 @@ async function createApiTrigger(options) {
15134
15734
  Key: result.id,
15135
15735
  Name: result.name,
15136
15736
  Type: "Api",
15737
+ RunAsCaller: result.runAsCaller ?? account.runAsCaller,
15738
+ RunAsMe: result.runAsMe ?? account.runAsMe,
15137
15739
  Status: "Created successfully"
15138
15740
  }
15139
15741
  });
@@ -15217,7 +15819,30 @@ async function updateApiTrigger(triggerKey, options) {
15217
15819
  await reportFailure2("Error updating API trigger", getError);
15218
15820
  return;
15219
15821
  }
15220
- const body = buildApiTriggerUpdateBody(existing, options);
15822
+ const account = resolveApiAccount(options, existing);
15823
+ if (!account)
15824
+ return;
15825
+ let machineRobots = existing.machineRobots;
15826
+ if (options.target && options.target.length > 0) {
15827
+ const resolved = await resolveTargets(options.target, options.mappingMode ?? "dynamic", {
15828
+ tenant: options.tenant,
15829
+ folderPath: options.folderPath,
15830
+ folderKey: options.folderKey
15831
+ });
15832
+ if (!resolved)
15833
+ return;
15834
+ if (account.stripUsers || targetSpecsNameUser(options.target)) {
15835
+ machineRobots = resolved;
15836
+ } else {
15837
+ const carried = withTargetUserKept(existing.machineRobots, resolved);
15838
+ if (!carried)
15839
+ return;
15840
+ machineRobots = carried;
15841
+ }
15842
+ }
15843
+ if (account.stripUsers)
15844
+ machineRobots = withoutTargetUsers(machineRobots);
15845
+ const body = buildApiTriggerUpdateBody(existing, options, machineRobots, account);
15221
15846
  const [putError] = await catchError(api.httpTriggersPutById({ key: triggerKey, body }));
15222
15847
  if (putError) {
15223
15848
  await reportFailure2("Error updating API trigger", putError);
@@ -15229,6 +15854,8 @@ async function updateApiTrigger(triggerKey, options) {
15229
15854
  Data: {
15230
15855
  Key: triggerKey,
15231
15856
  Name: body.name,
15857
+ RunAsCaller: account.runAsCaller,
15858
+ RunAsMe: account.runAsMe,
15232
15859
  Status: "Updated successfully"
15233
15860
  }
15234
15861
  });
@@ -15702,8 +16329,22 @@ var USERS_IMPORT_EXAMPLES = [
15702
16329
  AssignedRoleKeys: ["a1b2c3d4-0000-0000-0000-000000000001"]
15703
16330
  }
15704
16331
  }
16332
+ },
16333
+ {
16334
+ Description: "Import a robot account by its Identity Service ID (find it with 'uip admin robot-accounts list --search')",
16335
+ Command: "uip or users import --directory-id 0ba8d7ea-4af4-48d8-8aac-1f8ae3c7fa75 --type DirectoryRobot",
16336
+ Output: {
16337
+ Code: "UserImported",
16338
+ Data: {
16339
+ UserName: "my-robot-account",
16340
+ DirectoryId: "0ba8d7ea-4af4-48d8-8aac-1f8ae3c7fa75",
16341
+ Domain: "autogen",
16342
+ Type: "DirectoryRobot"
16343
+ }
16344
+ }
15705
16345
  }
15706
16346
  ];
16347
+ var IDENTITY_SERVICE_DOMAIN = "autogen";
15707
16348
  var USERS_ASSIGN_EXAMPLES = [
15708
16349
  {
15709
16350
  Description: "Assign a user to a folder",
@@ -15778,7 +16419,7 @@ var USERS_ASSIGN_ROLES_EXAMPLES = [
15778
16419
  ];
15779
16420
  var registerUsersCommand = (program) => {
15780
16421
  const users = program.command("users").description("Manage Orchestrator users (tenant-scoped). " + "List, import (from Identity Service), edit, and assign users. Manage folder roles per user. " + "Manage tenant-level role assignments. Use 'users list' to find user keys (GUIDs).");
15781
- users.command("list").description("List all users in the tenant. " + "Returns user key (GUID), username, full name, email, type, and active status. " + "Use --username or --email to filter. " + "Use the user key with 'users get', 'users assign', or 'users assign-roles'.").option("--key <key>", "Filter by user key (GUID, exact match)").option("--username <text>", "Filter by username (contains match)").option("--email <text>", "Filter by email address (contains match)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'UserName asc')").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(USERS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
16422
+ users.command("list").description("List all users in the tenant. " + "Returns user key (GUID), username, full name, email, type, and active status. " + "Use --username or --email to filter. " + "Use the user key with 'users get', 'users assign', or 'users assign-roles'.").option("--key <key>", "Filter by user key (GUID, exact match)", parseFilterValue).option("--username <text>", "Filter by username (contains match)", parseFilterValue).option("--email <text>", "Filter by email address (contains match)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'UserName asc')").option("--all-fields", "Return all fields from the API response instead of a curated summary").examples(USERS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
15782
16423
  const [apiError, api] = await catchError(createApiClient2(UsersApi2));
15783
16424
  if (apiError) {
15784
16425
  await reportFailure2("Error listing users", apiError);
@@ -15836,7 +16477,7 @@ var registerUsersCommand = (program) => {
15836
16477
  })
15837
16478
  });
15838
16479
  });
15839
- users.command("list-in-folder").description("List users assigned to a folder, with their folder-level roles. " + "Requires --folder-path or --folder-key. " + "Use --include-inherited to also show users inherited from parent folders.").option("--include-inherited", "Include inherited users", false).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc')", "Id desc").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key").option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(USERS_LIST_IN_FOLDER_EXAMPLES).trackedAction(processContext, async (options) => {
16480
+ users.command("list-in-folder").description("List users assigned to a folder, with their folder-level roles. " + "Requires --folder-path or --folder-key. " + "Use --include-inherited to also show users inherited from parent folders.").option("--include-inherited", "Include inherited users", false).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--sort-by <field>", "Sort results by field (e.g., 'Id desc')", "Id desc").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path", parseFolderKey).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(USERS_LIST_IN_FOLDER_EXAMPLES).trackedAction(processContext, async (options) => {
15840
16481
  const [resolveError, folder] = await catchError(resolveFolder2({
15841
16482
  folderPath: options.folderPath,
15842
16483
  folderKey: options.folderKey
@@ -15881,7 +16522,7 @@ var registerUsersCommand = (program) => {
15881
16522
  Data: users
15882
16523
  });
15883
16524
  });
15884
- users.command("list-available").description("List tenant users that can be assigned to a folder (not yet assigned). " + "Requires --folder-path or --folder-key. " + "Use --search to filter by username. " + "Use the returned user keys with 'users assign' or 'roles assign'.").option("-s, --search <text>", "Filter by username (contains match)").option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key").option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_LIST_AVAILABLE_EXAMPLES).trackedAction(processContext, async (options) => {
16525
+ users.command("list-available").description("List tenant users that can be assigned to a folder (not yet assigned). " + "Requires --folder-path or --folder-key. " + "Use --search to filter by username. " + "Use the returned user keys with 'users assign' or 'roles assign'.").option("-s, --search <text>", "Filter by username (contains match)", parseFilterValue).option("-l, --limit <number>", "Number of items to return", String(DEFAULT_PAGE_SIZE)).option("--offset <number>", "Number of items to skip", "0").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path", parseFolderKey).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_LIST_AVAILABLE_EXAMPLES).trackedAction(processContext, async (options) => {
15885
16526
  const [resolveError, folder] = await catchError(resolveFolder2({
15886
16527
  folderPath: options.folderPath,
15887
16528
  folderKey: options.folderKey
@@ -15962,23 +16603,25 @@ var registerUsersCommand = (program) => {
15962
16603
  }
15963
16604
  });
15964
16605
  });
15965
- users.command("import").description("Import a directory principal (Identity Service user, group, robot account, or external app) into this tenant. " + "References an existing IS principal by `--username` or `--directory-id`, plus `--type` to declare which kind of principal it is. " + "Optionally assigns folder roles in the same call with `--folder-key` / `--folder-path` and `--role-keys`. " + "`--directory-id` imports are idempotent when the principal is already imported into the tenant. " + "Robot accounts and external applications require `--directory-id` (the IS UUID); find it via 'uip admin robot-accounts list --search' or 'uip admin external-apps list'.").option("--username <username>", "Identity Service username (typically the user's email). Provide either --username or --directory-id.").option("--directory-id <id>", "Identity Service directory identifier (OIDC subject). Provide either --username or --directory-id.").option("--domain <domain>", "Directory domain name as configured in Identity Service. Only required for on-premises environments with configured AD domains.").requiredOption("--type <type>", "Directory principal type: DirectoryUser, DirectoryGroup, DirectoryRobot, or DirectoryExternalApplication. Required — the CLI refuses to guess. Find a principal's type via 'uip admin users list', 'uip admin groups list', 'uip admin robot-accounts list', or 'uip admin external-apps list'.").option("--folder-path <path>", "Folder path to assign the imported user to (e.g., 'Shared'). Use with --role-keys.").option("--folder-key <key>", "Folder key (GUID) to assign the imported user to. Use with --role-keys.").option("--role-keys <keys>", "Comma-separated role GUIDs (folder roles) to grant in the target folder. Use with --folder-path or --folder-key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_IMPORT_EXAMPLES).trackedAction(processContext, async (options) => {
16606
+ users.command("import").description("Import a directory principal (Identity Service user, group, robot account, or external app) into this tenant. " + "References an existing IS principal by `--username` or `--directory-id`, plus `--type` to declare which kind of principal it is. " + "Optionally assigns folder roles in the same call with `--folder-key` / `--folder-path` and `--role-keys`. " + "`--directory-id` imports are idempotent when the principal is already imported into the tenant. " + "Robot accounts and external applications require `--directory-id` (the IS UUID); find it via 'uip admin robot-accounts list --search' or 'uip admin external-apps list'.").option("--username <username>", "Identity Service username (typically the user's email). Provide either --username or --directory-id.").option("--directory-id <id>", "Identity Service directory identifier (OIDC subject). Provide either --username or --directory-id.").option("--domain <domain>", "Directory domain name as configured in Identity Service. Defaults to 'autogen' for DirectoryRobot and DirectoryExternalApplication. For DirectoryUser and DirectoryGroup, needed only for on-premises environments with configured AD domains.").requiredOption("--type <type>", "Directory principal type: DirectoryUser, DirectoryGroup, DirectoryRobot, or DirectoryExternalApplication. Required — the CLI refuses to guess. Find a principal's type via 'uip admin users list', 'uip admin groups list', 'uip admin robot-accounts list', or 'uip admin external-apps list'.").option("--folder-path <path>", "Folder path to assign the imported user to (e.g., 'Shared'). Use with --role-keys.", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) to assign the imported user to. Use with --role-keys.", parseFolderKey).option("--role-keys <keys>", "Comma-separated role GUIDs (folder roles) to grant in the target folder. Use with --folder-path or --folder-key.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_IMPORT_EXAMPLES).trackedAction(processContext, async (options) => {
15966
16607
  if (!options.username && !options.directoryId) {
15967
16608
  OutputFormatter.error({
15968
- Result: RESULTS.Failure,
16609
+ Result: RESULTS.ValidationError,
16610
+ ErrorCode: "invalid_argument",
15969
16611
  Message: "Missing directory identifier",
15970
- Instructions: "Provide either --username or --directory-id to identify the directory principal."
16612
+ Instructions: "Provide either --username or --directory-id to identify the directory principal.",
16613
+ Retry: "RetryWillNotFix"
15971
16614
  });
15972
- processContext.exit(1);
15973
16615
  return;
15974
16616
  }
15975
16617
  if (options.username && options.directoryId) {
15976
16618
  OutputFormatter.error({
15977
- Result: RESULTS.Failure,
16619
+ Result: RESULTS.ValidationError,
16620
+ ErrorCode: "invalid_argument",
15978
16621
  Message: "Conflicting directory identifiers",
15979
- Instructions: "Provide only one of --username or --directory-id, not both."
16622
+ Instructions: "Provide only one of --username or --directory-id, not both.",
16623
+ Retry: "RetryWillNotFix"
15980
16624
  });
15981
- processContext.exit(1);
15982
16625
  return;
15983
16626
  }
15984
16627
  const VALID_USER_TYPES = [
@@ -15990,23 +16633,26 @@ var registerUsersCommand = (program) => {
15990
16633
  const userType = options.type;
15991
16634
  if (!VALID_USER_TYPES.includes(userType)) {
15992
16635
  OutputFormatter.error({
15993
- Result: RESULTS.Failure,
16636
+ Result: RESULTS.ValidationError,
16637
+ ErrorCode: "invalid_argument",
15994
16638
  Message: "Invalid --type",
15995
- Instructions: "Use 'DirectoryUser', 'DirectoryGroup', 'DirectoryRobot', or 'DirectoryExternalApplication'."
16639
+ Instructions: "Use 'DirectoryUser', 'DirectoryGroup', 'DirectoryRobot', or 'DirectoryExternalApplication'.",
16640
+ Retry: "RetryWillNotFix"
15996
16641
  });
15997
- processContext.exit(1);
15998
16642
  return;
15999
16643
  }
16000
16644
  const needsKey = userType === "DirectoryRobot" || userType === "DirectoryExternalApplication";
16001
16645
  if (needsKey && !options.directoryId) {
16002
16646
  OutputFormatter.error({
16003
- Result: RESULTS.Failure,
16647
+ Result: RESULTS.ValidationError,
16648
+ ErrorCode: "invalid_argument",
16004
16649
  Message: "Missing --directory-id",
16005
- Instructions: `For --type ${userType}, --directory-id is required (the IS UUID — see 'uip admin robot-accounts list --search <name>' for DirectoryRobot or 'uip admin external-apps list' for DirectoryExternalApplication). Without it, POST /odata/Users returns HTTP 400 because the tenant record Key can't be matched to the IS identifier.`
16650
+ Instructions: `For --type ${userType}, --directory-id is required (the IS UUID — see 'uip admin robot-accounts list --search <name>' for DirectoryRobot or 'uip admin external-apps list' for DirectoryExternalApplication). Without it, Orchestrator does not look the principal up in Identity Service: it refuses a robot account, and creates an external app with no link to its Identity Service app.`,
16651
+ Retry: "RetryWillNotFix"
16006
16652
  });
16007
- processContext.exit(1);
16008
16653
  return;
16009
16654
  }
16655
+ const domain = options.domain ?? (needsKey ? IDENTITY_SERVICE_DOMAIN : undefined);
16010
16656
  const roleKeyList = options.roleKeys ? options.roleKeys.split(",").map((k) => k.trim()).filter(Boolean) : [];
16011
16657
  const folderRequested = Boolean(options.folderPath) || Boolean(options.folderKey);
16012
16658
  if (!folderRequested && roleKeyList.length > 0) {
@@ -16077,7 +16723,7 @@ var registerUsersCommand = (program) => {
16077
16723
  ...options.directoryId && {
16078
16724
  key: options.directoryId
16079
16725
  },
16080
- domain: options.domain,
16726
+ domain,
16081
16727
  userName: options.username,
16082
16728
  directoryIdentifier: options.directoryId,
16083
16729
  type: userType,
@@ -16157,7 +16803,7 @@ var registerUsersCommand = (program) => {
16157
16803
  DirectoryId: options.directoryId
16158
16804
  },
16159
16805
  ...alreadyImported && { AlreadyImported: true },
16160
- ...options.domain && { Domain: options.domain },
16806
+ ...domain && { Domain: domain },
16161
16807
  Type: userType,
16162
16808
  AssignedFolderKey: folder?.key,
16163
16809
  AssignedFolderPath: folder?.path,
@@ -16167,7 +16813,7 @@ var registerUsersCommand = (program) => {
16167
16813
  });
16168
16814
  users.command("assign").description("Assign a user to a folder, optionally with folder-level roles. " + "Requires --folder-path or --folder-key. " + `Use 'users list' for user keys, 'roles list' for role keys.
16169
16815
 
16170
- ` + "**CAUTION — destructive on roles.** The server replaces ALL of the user's existing roles in the target folder with the ones passed via --role-keys. Roles not in the payload are removed silently. To preserve existing roles, read them first via 'roles user-roles list <principal-name> --type <type>' and pass the full desired union to --role-keys. Use 'roles users set <role-key>' for additive tenant-level role membership.").requiredOption("--user-key <key>", "User key (GUID)").option("--role-keys <keys>", "Comma-separated role GUIDs to assign in the folder").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key").option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_ASSIGN_EXAMPLES).trackedAction(processContext, async (options) => {
16816
+ ` + "**CAUTION — destructive on roles.** The server replaces ALL of the user's existing roles in the target folder with the ones passed via --role-keys. Roles not in the payload are removed silently. To preserve existing roles, read them first via 'roles user-roles list <principal-name> --type <type>' and pass the full desired union to --role-keys. Use 'roles users set <role-key>' for additive tenant-level role membership.").requiredOption("--user-key <key>", "User key (GUID)").option("--role-keys <keys>", "Comma-separated role GUIDs to assign in the folder").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path", parseFolderKey).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_ASSIGN_EXAMPLES).trackedAction(processContext, async (options) => {
16171
16817
  const [resolveError, folder] = await catchError(resolveFolder2({
16172
16818
  folderPath: options.folderPath,
16173
16819
  folderKey: options.folderKey
@@ -16234,7 +16880,7 @@ var registerUsersCommand = (program) => {
16234
16880
  }
16235
16881
  });
16236
16882
  });
16237
- users.command("unassign").description("Remove a user from a folder. " + "The user is not deleted — only their folder assignment is removed. " + "Requires --folder-path or --folder-key. " + "Use 'users list-in-folder' to verify current folder assignments.").requiredOption("--user-key <key>", "User key (GUID)").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key").option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_UNASSIGN_EXAMPLES).trackedAction(processContext, async (options) => {
16883
+ users.command("unassign").description("Remove a user from a folder. " + "The user is not deleted — only their folder assignment is removed. " + "Requires --folder-path or --folder-key. " + "Use 'users list-in-folder' to verify current folder assignments.").requiredOption("--user-key <key>", "User key (GUID)").option("--folder-path <path>", "Folder path (e.g., 'Shared') — must provide this or --folder-key", parseFolderPath).option("--folder-key <key>", "Folder key (GUID) — must provide this or --folder-path", parseFolderKey).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(USERS_UNASSIGN_EXAMPLES).trackedAction(processContext, async (options) => {
16238
16884
  const [resolveError, folder] = await catchError(resolveFolder2({
16239
16885
  folderPath: options.folderPath,
16240
16886
  folderKey: options.folderKey
@@ -16578,7 +17224,7 @@ var WEBHOOKS_EVENT_TYPES_EXAMPLES = [
16578
17224
  ];
16579
17225
  var registerWebhooksCommand = (program) => {
16580
17226
  const webhooks = program.command("webhooks").description("Manage Orchestrator webhooks (HTTP callbacks triggered by events like job completion, queue item failure, etc.). Webhooks are tenant-scoped.");
16581
- webhooks.command("list").description("List webhooks in the tenant. " + "Use --enabled or --disabled to filter by state, and --name to filter by name.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-n, --name <name>", "Filter by webhook name (contains match)").option("--enabled", "Show only enabled webhooks").option("--disabled", "Show only disabled webhooks").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("-l, --limit <number>", "Number of items to return", "50").option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(WEBHOOKS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
17227
+ webhooks.command("list").description("List webhooks in the tenant. " + "Use --enabled or --disabled to filter by state, and --name to filter by name.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).option("-n, --name <name>", "Filter by webhook name (contains match)", parseFilterValue).option("--enabled", "Show only enabled webhooks").option("--disabled", "Show only disabled webhooks").option("--sort-by <field>", "Sort results by field (e.g., 'Name asc', 'Id desc')", "Id desc").option("-l, --limit <number>", "Number of items to return", "50").option("--offset <number>", "Number of items to skip", "0").option("--all-fields", "Return all fields from the API response (default: curated subset)").examples(WEBHOOKS_LIST_EXAMPLES).trackedAction(processContext, async (options) => {
16582
17228
  if (options.enabled && options.disabled) {
16583
17229
  OutputFormatter.error({
16584
17230
  Result: RESULTS.Failure,
@@ -16813,9 +17459,9 @@ var registerCommands2 = async (program) => {
16813
17459
  registerFoldersCommand(program);
16814
17460
  registerJobsCommand(program);
16815
17461
  if (isPreviewBuild()) {
16816
- const { registerKbCommand } = await import("./kb-k7qrr2f9.js");
17462
+ const { registerKbCommand } = await import("./kb-qz0daftp.js");
16817
17463
  registerKbCommand(program);
16818
- const { registerSkillBundlesCommand } = await import("./skill-bundles-ahy25bvs.js");
17464
+ const { registerSkillBundlesCommand } = await import("./skill-bundles-4svqq6jm.js");
16819
17465
  registerSkillBundlesCommand(program);
16820
17466
  }
16821
17467
  registerLibrariesCommand(program);
@@ -16837,4 +17483,4 @@ var registerCommands2 = async (program) => {
16837
17483
 
16838
17484
  export { metadata2, registerCommands2 };
16839
17485
 
16840
- //# debugId=6C1245AF3B96BE7B64756E2164756E21
17486
+ //# debugId=8A355EEB87D12FEA64756E2164756E21