@uipath/aops-tool 1.201.0-preview.115 → 1.201.0-preview.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-kb7r4gxr.js";
6
+ } from "./tool-kefvn9c5.js";
7
7
  import"./tool-9qecd4wb.js";
8
8
  import"./tool-7eva0peq.js";
9
9
  import"./tool-5arsyj36.js";
@@ -2112,7 +2112,7 @@ var require_commander = __commonJS((exports) => {
2112
2112
  var package_default = {
2113
2113
  name: "@uipath/aops-tool",
2114
2114
  license: "MIT",
2115
- version: "1.201.0-preview.115",
2115
+ version: "1.201.0-preview.121",
2116
2116
  description: "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
2117
2117
  private: false,
2118
2118
  repository: {
@@ -2213,17 +2213,18 @@ var TLS_ERROR_CODES = new Set([
2213
2213
  ]);
2214
2214
  var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
2215
2215
  var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
2216
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2217
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2218
+ function localPermissionInstructions(code, path) {
2219
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
2220
+ if (code === "EROFS") {
2221
+ return `The filesystem containing ${target} is read-only (EROFS), so the ` + "CLI could not write to it. This is a local environment problem, " + "not a UiPath service error — retrying will not help. Use a " + "writable location, or give this environment write access to the " + "path.";
2222
+ }
2223
+ const remedy = process.platform === "win32" ? "Re-run from an elevated terminal, close any program holding " + "the file open, or grant your user access to the path." : "Grant this user (or the sandbox the command runs in) access " + "to the path, or run the command outside the sandbox.";
2224
+ return `The operating system denied access to ${target} (${code}). This is ` + "a local permission problem, not a UiPath service error — retrying " + `without a permission change will not help. ${remedy}`;
2225
+ }
2216
2226
  function describeConnectivityError(error) {
2217
- const queue = [error];
2218
- const seen = new Set;
2219
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2220
- const current = queue.shift();
2221
- if (current === null || typeof current !== "object")
2222
- continue;
2223
- if (seen.has(current))
2224
- continue;
2225
- seen.add(current);
2226
- const cur = current;
2227
+ for (const cur of walkErrorGraph(error)) {
2227
2228
  const code = typeof cur.code === "string" ? cur.code : undefined;
2228
2229
  const message = typeof cur.message === "string" ? cur.message : undefined;
2229
2230
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -2242,6 +2243,49 @@ function describeConnectivityError(error) {
2242
2243
  instructions: NETWORK_INSTRUCTIONS
2243
2244
  };
2244
2245
  }
2246
+ }
2247
+ return;
2248
+ }
2249
+ function describePermissionError(error) {
2250
+ for (const cur of walkErrorGraph(error)) {
2251
+ const message = typeof cur.message === "string" ? cur.message : undefined;
2252
+ const code = matchLocalPermissionCode(cur.code, message);
2253
+ if (!code)
2254
+ continue;
2255
+ const path = localPermissionPath(cur.path, message);
2256
+ return {
2257
+ code,
2258
+ message: message ?? code,
2259
+ ...path !== undefined ? { path } : {},
2260
+ instructions: localPermissionInstructions(code, path)
2261
+ };
2262
+ }
2263
+ return;
2264
+ }
2265
+ function matchLocalPermissionCode(code, message) {
2266
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
2267
+ return code;
2268
+ }
2269
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
2270
+ return match ? match[1] : undefined;
2271
+ }
2272
+ function localPermissionPath(path, message) {
2273
+ if (typeof path === "string")
2274
+ return path;
2275
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2276
+ }
2277
+ function* walkErrorGraph(error) {
2278
+ const queue = [error];
2279
+ const seen = new Set;
2280
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2281
+ const current = queue.shift();
2282
+ if (current === null || typeof current !== "object")
2283
+ continue;
2284
+ if (seen.has(current))
2285
+ continue;
2286
+ seen.add(current);
2287
+ const cur = current;
2288
+ yield cur;
2245
2289
  if (cur.cause !== undefined)
2246
2290
  queue.push(cur.cause);
2247
2291
  if (Array.isArray(cur.errors))
@@ -2302,6 +2346,12 @@ function classifyError(status, error) {
2302
2346
  if (status !== undefined && status >= 500 && status < 600) {
2303
2347
  return { errorCode: "server_error", retry: "RetryLater" };
2304
2348
  }
2349
+ if (status === undefined && describePermissionError(error)) {
2350
+ return {
2351
+ errorCode: "local_permission_denied",
2352
+ retry: "RetryWillNotFix"
2353
+ };
2354
+ }
2305
2355
  const connectivity = describeConnectivityError(error);
2306
2356
  if (connectivity) {
2307
2357
  return {
@@ -2404,6 +2454,16 @@ async function extractErrorDetails(error, options) {
2404
2454
  message = `${message}: ${connectivity.message}`;
2405
2455
  }
2406
2456
  }
2457
+ const permission = status === undefined ? describePermissionError(error) : undefined;
2458
+ if (permission) {
2459
+ if (permission.message !== message && !message.includes(permission.message)) {
2460
+ message = `${message}: ${permission.message}`;
2461
+ }
2462
+ if (!message.includes(permission.instructions)) {
2463
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
2464
+ message = `${punctuated} ${permission.instructions}`;
2465
+ }
2466
+ }
2407
2467
  let details = rawMessage;
2408
2468
  if (rawBody) {
2409
2469
  if (parsedBody) {
@@ -2443,6 +2503,9 @@ async function extractErrorDetails(error, options) {
2443
2503
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
2444
2504
  context.traceId = parsedBody.traceId;
2445
2505
  }
2506
+ if (permission?.path !== undefined) {
2507
+ context.path = permission.path;
2508
+ }
2446
2509
  if (status === 429) {
2447
2510
  const resp = response;
2448
2511
  const headersObj = resp?.headers;
@@ -3676,6 +3739,7 @@ var CLI_ERROR_CODES = [
3676
3739
  "invalid_argument",
3677
3740
  "authentication_required",
3678
3741
  "permission_denied",
3742
+ "local_permission_denied",
3679
3743
  "not_found",
3680
3744
  "rate_limited",
3681
3745
  "network_error",
@@ -4111,12 +4175,16 @@ function defaultErrorCodeForHttpStatus(status) {
4111
4175
  return "server_error";
4112
4176
  return;
4113
4177
  }
4178
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
4114
4179
  function defaultErrorCodeForFailure(data) {
4115
4180
  if (data.Result === RESULTS.Failure) {
4116
4181
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
4117
4182
  const errorCode = defaultErrorCodeForHttpStatus(status);
4118
4183
  if (errorCode)
4119
4184
  return errorCode;
4185
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
4186
+ return "local_permission_denied";
4187
+ }
4120
4188
  }
4121
4189
  return defaultErrorCodeForResult(data.Result);
4122
4190
  }
@@ -5141,11 +5209,10 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
5141
5209
  function installSdkUserAgentHeader(BaseApiClass, userAgent) {
5142
5210
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
5143
5211
  }
5144
- // ../common/src/tool-provider.ts
5145
- var factorySlot = singleton("PackagerFactoryProvider");
5146
- var moduleSlot = singleton("ToolModuleProvider");
5147
5212
  // ../common/src/telemetry/ship-succeeded.ts
5148
5213
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
5214
+ // ../common/src/tool-provider.ts
5215
+ var factorySlot = singleton("PackagerFactoryProvider");
5149
5216
  // ../sc-sdk/generated/src/runtime.ts
5150
5217
  var BASE_PATH = "http://localhost".replace(/\/+$/, "");
5151
5218
 
@@ -7868,6 +7935,9 @@ var getAuthContext = async (options = {}) => {
7868
7935
  tenantName
7869
7936
  };
7870
7937
  };
7938
+ // ../auth/src/tenantSelection.ts
7939
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
7940
+
7871
7941
  // ../auth/src/selectTenant.ts
7872
7942
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
7873
7943
  var INVALID_TENANT_CODE = "INVALID_TENANT";
@@ -9710,11 +9780,13 @@ var registerConnectionCommand = (program2) => {
9710
9780
  return;
9711
9781
  }
9712
9782
  const data = pollResult.data;
9783
+ const rows = connectionId ? data?.target : data?.states;
9713
9784
  if (!data?.succeeded) {
9714
9785
  OutputFormatter.error({
9715
9786
  Result: RESULTS.Failure,
9716
9787
  Message: "Sync settled in a non-success state.",
9717
- Instructions: "Inspect the failureReason on the returned row(s) and retry, or recreate the connection in StudioAdmin."
9788
+ Instructions: "Inspect the sync state on the row(s) in Data — in the all-connections form they name which one failed — then retry, or recreate the connection in StudioAdmin.",
9789
+ ...rows ? { Data: rows } : {}
9718
9790
  });
9719
9791
  processContext.exit(1);
9720
9792
  return;
@@ -9723,7 +9795,7 @@ var registerConnectionCommand = (program2) => {
9723
9795
  OutputFormatter.success({
9724
9796
  Result: RESULTS.Success,
9725
9797
  Code: "ConnectionSynced",
9726
- Data: connectionId ? data.target : data.states
9798
+ Data: rows
9727
9799
  });
9728
9800
  });
9729
9801
  withLoginValidity(connection.command("delete").description([
@@ -10273,8 +10345,8 @@ var registerExecutionCommand = (program2) => {
10273
10345
  withLoginValidity(execution.command("details").description([
10274
10346
  "Fetch the underlying job-execution detail document for an execution.",
10275
10347
  "",
10276
- "Returns the JobDetailsDto — robot, machine, folder, queue context. Useful",
10277
- "when triaging a failure to see which runner / where it ran."
10348
+ "Returns the JobDetailsDto — robot, machine, release and host context.",
10349
+ "Useful when triaging a failure to see which runner / where it ran."
10278
10350
  ].join(`
10279
10351
  `)).argument("[execution-id]", "Pipeline execution identifier (from `pipeline executions <pipeline-id>`). Required unless `--job-key` is set.").option("--job-key <key>", "JobKey to use directly. Skips the executionId lookup.").examples(DETAILS_EXAMPLES)).trackedAction(processContext, async (executionId, options) => {
10280
10352
  const api = await getCicdApi(PipelineExecutionsApi, options);
@@ -10286,10 +10358,11 @@ var registerExecutionCommand = (program2) => {
10286
10358
  const [error, result] = await catchError2(api.pipelineExecutionsGetPipelineJobDetails({
10287
10359
  jobKey: resolved.jobKey
10288
10360
  }));
10289
- if (error) {
10361
+ if (error || !result?.key) {
10362
+ const unresolvable = !error || error instanceof SyntaxError || /unexpected end of json/i.test(error.message ?? "");
10290
10363
  OutputFormatter.error({
10291
10364
  Result: RESULTS.Failure,
10292
- Message: await extractErrorMessage(error),
10365
+ Message: unresolvable ? `Job details for '${resolved.jobKey}' not found.` : await extractErrorMessage(error),
10293
10366
  Instructions: "Verify the executionId / --job-key with 'uip aops execution get <execution-id>'."
10294
10367
  });
10295
10368
  processContext.exit(1);
@@ -10827,8 +10900,8 @@ var registerPipelineCommand = (program2) => {
10827
10900
  "single process with 'pipeline process <process-id>' for the",
10828
10901
  "full DTO including arguments and inputArguments.",
10829
10902
  "",
10830
- "Use the returned ProcessId inside the `automationProcessIdentifier`",
10831
- "field of the PipelineDto JSON when authoring a pipeline."
10903
+ "Use the returned ProcessId as the PipelineDto's `processIdentifier` when",
10904
+ "authoring a pipeline."
10832
10905
  ].join(`
10833
10906
  `)).examples(PROCESSES_EXAMPLES)).trackedAction(processContext, async (options) => {
10834
10907
  const api = await getCicdApi(PipelineApi, options);
@@ -11314,7 +11387,7 @@ var CONTENT_EXAMPLES = [
11314
11387
  Command: "uip aops project content --project-id 9999dddd-0000-0000-0000-000000000001 --path Main.xaml",
11315
11388
  Output: {
11316
11389
  Code: "ProjectFileContent",
11317
- Data: { content: "<xaml…>", encoding: "utf-8" }
11390
+ Data: { FileContent: "<xaml…>" }
11318
11391
  }
11319
11392
  },
11320
11393
  {
@@ -11322,7 +11395,7 @@ var CONTENT_EXAMPLES = [
11322
11395
  Command: "uip aops project content --project-id 9999dddd-0000-0000-0000-000000000001 --path Main.xaml --reference 0123456789abcdef0123456789abcdef01234567",
11323
11396
  Output: {
11324
11397
  Code: "ProjectFileContent",
11325
- Data: { content: "<xaml…>", encoding: "utf-8" }
11398
+ Data: { FileContent: "<xaml…>" }
11326
11399
  }
11327
11400
  }
11328
11401
  ];
@@ -11344,7 +11417,7 @@ var COMMIT_EXAMPLES = [
11344
11417
  Command: "uip aops project commit --project-id 9999dddd-0000-0000-0000-000000000001 --reference 0123456789abcdef0123456789abcdef01234567",
11345
11418
  Output: {
11346
11419
  Code: "ProjectCommit",
11347
- Data: { sha: SAMPLE_SHA, message: "Initial commit" }
11420
+ Data: { Reference: SAMPLE_SHA, Message: "Initial commit" }
11348
11421
  }
11349
11422
  }
11350
11423
  ];
@@ -11579,7 +11652,8 @@ var registerProjectCommand = (program2) => {
11579
11652
  "List the file tree of a project at a given reference.",
11580
11653
  "",
11581
11654
  "`--path` scopes to a subdirectory; `--reference` targets a non-default",
11582
- "branch / tag / commit. Returns one row per file with type, size, and path."
11655
+ "branch / tag / commit. Returns one row per entry with its name, path, type",
11656
+ "and buildable-unit type."
11583
11657
  ].join(`
11584
11658
  `)).requiredOption("--project-id <id>", "SC service UUID for the automation project, from `connection projects`.").option("--path <path>", "Subdirectory inside the project to list. Defaults to the project root.").option("--reference <ref>", "Branch name, tag, or commit SHA. Defaults to the default branch HEAD.").examples(FILES_EXAMPLES)).trackedAction(processContext, async (options) => {
11585
11659
  const api = await getScApi(ProjectsApi, options);
@@ -11611,7 +11685,7 @@ var registerProjectCommand = (program2) => {
11611
11685
  "`--path` is the file path relative to the project root. `--reference` picks",
11612
11686
  "a non-default branch / tag / SHA — leave it off for the default branch HEAD."
11613
11687
  ].join(`
11614
- `)).requiredOption("--project-id <id>", "SC service UUID for the automation project, from `connection projects`.").option("--path <path>", "Path to the file inside the project (relative to the project root).").option("--reference <ref>", "Branch name, tag, or commit SHA. Defaults to the default branch HEAD.").examples(CONTENT_EXAMPLES)).trackedAction(processContext, async (options) => {
11688
+ `)).requiredOption("--project-id <id>", "SC service UUID for the automation project, from `connection projects`.").requiredOption("--path <path>", "Path to the file inside the project (relative to the project root).").option("--reference <ref>", "Branch name, tag, or commit SHA. Defaults to the default branch HEAD.").examples(CONTENT_EXAMPLES)).trackedAction(processContext, async (options) => {
11615
11689
  const api = await getScApi(ProjectsApi, options);
11616
11690
  if (!api)
11617
11691
  return;
@@ -11630,7 +11704,7 @@ var registerProjectCommand = (program2) => {
11630
11704
  processContext.exit(1);
11631
11705
  return;
11632
11706
  }
11633
- if (!result) {
11707
+ if (result?.fileContent == null) {
11634
11708
  OutputFormatter.error({
11635
11709
  Result: RESULTS.Failure,
11636
11710
  Message: `Project file '${options.path}' not found.`,
@@ -11752,8 +11826,8 @@ var BRANCHES_EXAMPLES = [
11752
11826
  Output: {
11753
11827
  Code: "RepoBranches",
11754
11828
  Data: [
11755
- { name: "main", isDefault: true },
11756
- { name: "release", isDefault: false }
11829
+ { Name: "main", Main: true },
11830
+ { Name: "release", Main: false }
11757
11831
  ]
11758
11832
  }
11759
11833
  }
@@ -11788,7 +11862,7 @@ var registerRepoCommand = (program2) => {
11788
11862
  withLoginValidity(repo.command("branches").description([
11789
11863
  "List branches for a repository.",
11790
11864
  "",
11791
- "Returns one row per branch with its name and a `isDefault` flag. Use the",
11865
+ "Returns one row per branch with its `Name` and a `Main` flag. Use the",
11792
11866
  "branch name as `--reference` for `repo project-files`, `project content`,",
11793
11867
  "etc., when you need to inspect non-default branches."
11794
11868
  ].join(`
@@ -11995,4 +12069,4 @@ var registerCommands = async (program2) => {
11995
12069
 
11996
12070
  export { Command, metadata, registerCommands };
11997
12071
 
11998
- //# debugId=545EA0E4F5DEF0D464756E2164756E21
12072
+ //# debugId=85D641E61AC239C364756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-kb7r4gxr.js";
4
+ } from "./tool-kefvn9c5.js";
5
5
  import"./tool-9qecd4wb.js";
6
6
  import"./tool-7eva0peq.js";
7
7
  import"./tool-5arsyj36.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/aops-tool",
3
3
  "license": "MIT",
4
- "version": "1.201.0-preview.115",
4
+ "version": "1.201.0-preview.121",
5
5
  "description": "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
6
6
  "private": false,
7
7
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
- "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
29
+ "gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
30
30
  }