@uipath/apms-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-njy4p249.js";
6
+ } from "./tool-jszchmp4.js";
7
7
  import"./tool-eb3gcj08.js";
8
8
  import"./tool-rr9mn0nz.js";
9
9
  import"./tool-yy8n2117.js";
@@ -2112,7 +2112,7 @@ var require_commander = __commonJS((exports) => {
2112
2112
  var package_default = {
2113
2113
  name: "@uipath/apms-tool",
2114
2114
  license: "MIT",
2115
- version: "1.201.0-preview.115",
2115
+ version: "1.201.0-preview.121",
2116
2116
  description: "CLI plugin for the UiPath Access Policy Management Service.",
2117
2117
  private: false,
2118
2118
  repository: {
@@ -4786,6 +4786,9 @@ function normalizeTokenRefreshUnavailableFailure() {
4786
4786
  function errorMessage(error) {
4787
4787
  return error instanceof Error ? error.message : String(error);
4788
4788
  }
4789
+ // ../../auth/src/tenantSelection.ts
4790
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
4791
+
4789
4792
  // ../../auth/src/selectTenant.ts
4790
4793
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
4791
4794
  var INVALID_TENANT_CODE = "INVALID_TENANT";
@@ -4893,17 +4896,18 @@ var TLS_ERROR_CODES = new Set([
4893
4896
  ]);
4894
4897
  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.";
4895
4898
  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.";
4899
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
4900
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
4901
+ function localPermissionInstructions(code, path) {
4902
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
4903
+ if (code === "EROFS") {
4904
+ 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.";
4905
+ }
4906
+ 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.";
4907
+ 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}`;
4908
+ }
4896
4909
  function describeConnectivityError(error) {
4897
- const queue = [error];
4898
- const seen = new Set;
4899
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
4900
- const current = queue.shift();
4901
- if (current === null || typeof current !== "object")
4902
- continue;
4903
- if (seen.has(current))
4904
- continue;
4905
- seen.add(current);
4906
- const cur = current;
4910
+ for (const cur of walkErrorGraph(error)) {
4907
4911
  const code = typeof cur.code === "string" ? cur.code : undefined;
4908
4912
  const message = typeof cur.message === "string" ? cur.message : undefined;
4909
4913
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -4922,6 +4926,49 @@ function describeConnectivityError(error) {
4922
4926
  instructions: NETWORK_INSTRUCTIONS
4923
4927
  };
4924
4928
  }
4929
+ }
4930
+ return;
4931
+ }
4932
+ function describePermissionError(error) {
4933
+ for (const cur of walkErrorGraph(error)) {
4934
+ const message = typeof cur.message === "string" ? cur.message : undefined;
4935
+ const code = matchLocalPermissionCode(cur.code, message);
4936
+ if (!code)
4937
+ continue;
4938
+ const path = localPermissionPath(cur.path, message);
4939
+ return {
4940
+ code,
4941
+ message: message ?? code,
4942
+ ...path !== undefined ? { path } : {},
4943
+ instructions: localPermissionInstructions(code, path)
4944
+ };
4945
+ }
4946
+ return;
4947
+ }
4948
+ function matchLocalPermissionCode(code, message) {
4949
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
4950
+ return code;
4951
+ }
4952
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
4953
+ return match ? match[1] : undefined;
4954
+ }
4955
+ function localPermissionPath(path, message) {
4956
+ if (typeof path === "string")
4957
+ return path;
4958
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
4959
+ }
4960
+ function* walkErrorGraph(error) {
4961
+ const queue = [error];
4962
+ const seen = new Set;
4963
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
4964
+ const current = queue.shift();
4965
+ if (current === null || typeof current !== "object")
4966
+ continue;
4967
+ if (seen.has(current))
4968
+ continue;
4969
+ seen.add(current);
4970
+ const cur = current;
4971
+ yield cur;
4925
4972
  if (cur.cause !== undefined)
4926
4973
  queue.push(cur.cause);
4927
4974
  if (Array.isArray(cur.errors))
@@ -4982,6 +5029,12 @@ function classifyError(status, error) {
4982
5029
  if (status !== undefined && status >= 500 && status < 600) {
4983
5030
  return { errorCode: "server_error", retry: "RetryLater" };
4984
5031
  }
5032
+ if (status === undefined && describePermissionError(error)) {
5033
+ return {
5034
+ errorCode: "local_permission_denied",
5035
+ retry: "RetryWillNotFix"
5036
+ };
5037
+ }
4985
5038
  const connectivity = describeConnectivityError(error);
4986
5039
  if (connectivity) {
4987
5040
  return {
@@ -5084,6 +5137,16 @@ async function extractErrorDetails(error, options) {
5084
5137
  message = `${message}: ${connectivity.message}`;
5085
5138
  }
5086
5139
  }
5140
+ const permission = status === undefined ? describePermissionError(error) : undefined;
5141
+ if (permission) {
5142
+ if (permission.message !== message && !message.includes(permission.message)) {
5143
+ message = `${message}: ${permission.message}`;
5144
+ }
5145
+ if (!message.includes(permission.instructions)) {
5146
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
5147
+ message = `${punctuated} ${permission.instructions}`;
5148
+ }
5149
+ }
5087
5150
  let details = rawMessage;
5088
5151
  if (rawBody) {
5089
5152
  if (parsedBody) {
@@ -5123,6 +5186,9 @@ async function extractErrorDetails(error, options) {
5123
5186
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
5124
5187
  context.traceId = parsedBody.traceId;
5125
5188
  }
5189
+ if (permission?.path !== undefined) {
5190
+ context.path = permission.path;
5191
+ }
5126
5192
  if (status === 429) {
5127
5193
  const resp = response;
5128
5194
  const headersObj = resp?.headers;
@@ -6320,6 +6386,7 @@ var CLI_ERROR_CODES = [
6320
6386
  "invalid_argument",
6321
6387
  "authentication_required",
6322
6388
  "permission_denied",
6389
+ "local_permission_denied",
6323
6390
  "not_found",
6324
6391
  "rate_limited",
6325
6392
  "network_error",
@@ -6755,12 +6822,16 @@ function defaultErrorCodeForHttpStatus(status) {
6755
6822
  return "server_error";
6756
6823
  return;
6757
6824
  }
6825
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
6758
6826
  function defaultErrorCodeForFailure(data) {
6759
6827
  if (data.Result === RESULTS.Failure) {
6760
6828
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
6761
6829
  const errorCode2 = defaultErrorCodeForHttpStatus(status);
6762
6830
  if (errorCode2)
6763
6831
  return errorCode2;
6832
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
6833
+ return "local_permission_denied";
6834
+ }
6764
6835
  }
6765
6836
  return defaultErrorCodeForResult(data.Result);
6766
6837
  }
@@ -7247,11 +7318,10 @@ var ScreenLogger;
7247
7318
  }
7248
7319
  ScreenLogger.progress = progress;
7249
7320
  })(ScreenLogger ||= {});
7250
- // ../../common/src/tool-provider.ts
7251
- var factorySlot = singleton("PackagerFactoryProvider");
7252
- var moduleSlot = singleton("ToolModuleProvider");
7253
7321
  // ../../common/src/telemetry/ship-succeeded.ts
7254
7322
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
7323
+ // ../../common/src/tool-provider.ts
7324
+ var factorySlot = singleton("PackagerFactoryProvider");
7255
7325
  // src/commands/_shared.ts
7256
7326
  var LOGIN_INSTRUCTIONS = "Ensure you are logged in with 'uip login' and have access to the Access Policy Management service.";
7257
7327
  var NON_NEGATIVE_INTEGER_RE = /^\d+$/;
@@ -8393,4 +8463,4 @@ var registerCommands = async (program2) => {
8393
8463
 
8394
8464
  export { Command, metadata, registerCommands };
8395
8465
 
8396
- //# debugId=37AB1C471CED417C64756E2164756E21
8466
+ //# debugId=E9552189F0AB5CDF64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-njy4p249.js";
4
+ } from "./tool-jszchmp4.js";
5
5
  import"./tool-eb3gcj08.js";
6
6
  import"./tool-rr9mn0nz.js";
7
7
  import"./tool-yy8n2117.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/apms-tool",
3
3
  "license": "MIT",
4
- "version": "1.201.0-preview.115",
4
+ "version": "1.201.0-preview.121",
5
5
  "description": "CLI plugin for the UiPath Access Policy Management Service.",
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
  }