@uipath/resourcecatalog-tool 1.201.0-preview.115 → 1.201.0-preview.122

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-2ts43bvr.js";
6
+ } from "./tool-0nnndpnq.js";
7
7
  import"./tool-eb3gcj08.js";
8
8
  import"./tool-31j9b09f.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/resourcecatalog-tool",
2114
2114
  license: "MIT",
2115
- version: "1.201.0-preview.115",
2115
+ version: "1.201.0-preview.122",
2116
2116
  description: "CLI plugin for the UiPath Resource Catalog Service.",
2117
2117
  private: false,
2118
2118
  repository: {
@@ -2211,17 +2211,18 @@ var TLS_ERROR_CODES = new Set([
2211
2211
  ]);
2212
2212
  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.";
2213
2213
  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.";
2214
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2215
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2216
+ function localPermissionInstructions(code, path) {
2217
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
2218
+ if (code === "EROFS") {
2219
+ 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.";
2220
+ }
2221
+ 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.";
2222
+ 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}`;
2223
+ }
2214
2224
  function describeConnectivityError(error) {
2215
- const queue = [error];
2216
- const seen = new Set;
2217
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2218
- const current = queue.shift();
2219
- if (current === null || typeof current !== "object")
2220
- continue;
2221
- if (seen.has(current))
2222
- continue;
2223
- seen.add(current);
2224
- const cur = current;
2225
+ for (const cur of walkErrorGraph(error)) {
2225
2226
  const code = typeof cur.code === "string" ? cur.code : undefined;
2226
2227
  const message = typeof cur.message === "string" ? cur.message : undefined;
2227
2228
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -2240,6 +2241,49 @@ function describeConnectivityError(error) {
2240
2241
  instructions: NETWORK_INSTRUCTIONS
2241
2242
  };
2242
2243
  }
2244
+ }
2245
+ return;
2246
+ }
2247
+ function describePermissionError(error) {
2248
+ for (const cur of walkErrorGraph(error)) {
2249
+ const message = typeof cur.message === "string" ? cur.message : undefined;
2250
+ const code = matchLocalPermissionCode(cur.code, message);
2251
+ if (!code)
2252
+ continue;
2253
+ const path = localPermissionPath(cur.path, message);
2254
+ return {
2255
+ code,
2256
+ message: message ?? code,
2257
+ ...path !== undefined ? { path } : {},
2258
+ instructions: localPermissionInstructions(code, path)
2259
+ };
2260
+ }
2261
+ return;
2262
+ }
2263
+ function matchLocalPermissionCode(code, message) {
2264
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
2265
+ return code;
2266
+ }
2267
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
2268
+ return match ? match[1] : undefined;
2269
+ }
2270
+ function localPermissionPath(path, message) {
2271
+ if (typeof path === "string")
2272
+ return path;
2273
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2274
+ }
2275
+ function* walkErrorGraph(error) {
2276
+ const queue = [error];
2277
+ const seen = new Set;
2278
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2279
+ const current = queue.shift();
2280
+ if (current === null || typeof current !== "object")
2281
+ continue;
2282
+ if (seen.has(current))
2283
+ continue;
2284
+ seen.add(current);
2285
+ const cur = current;
2286
+ yield cur;
2243
2287
  if (cur.cause !== undefined)
2244
2288
  queue.push(cur.cause);
2245
2289
  if (Array.isArray(cur.errors))
@@ -2300,6 +2344,12 @@ function classifyError(status, error) {
2300
2344
  if (status !== undefined && status >= 500 && status < 600) {
2301
2345
  return { errorCode: "server_error", retry: "RetryLater" };
2302
2346
  }
2347
+ if (status === undefined && describePermissionError(error)) {
2348
+ return {
2349
+ errorCode: "local_permission_denied",
2350
+ retry: "RetryWillNotFix"
2351
+ };
2352
+ }
2303
2353
  const connectivity = describeConnectivityError(error);
2304
2354
  if (connectivity) {
2305
2355
  return {
@@ -2402,6 +2452,16 @@ async function extractErrorDetails(error, options) {
2402
2452
  message = `${message}: ${connectivity.message}`;
2403
2453
  }
2404
2454
  }
2455
+ const permission = status === undefined ? describePermissionError(error) : undefined;
2456
+ if (permission) {
2457
+ if (permission.message !== message && !message.includes(permission.message)) {
2458
+ message = `${message}: ${permission.message}`;
2459
+ }
2460
+ if (!message.includes(permission.instructions)) {
2461
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
2462
+ message = `${punctuated} ${permission.instructions}`;
2463
+ }
2464
+ }
2405
2465
  let details = rawMessage;
2406
2466
  if (rawBody) {
2407
2467
  if (parsedBody) {
@@ -2441,6 +2501,9 @@ async function extractErrorDetails(error, options) {
2441
2501
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
2442
2502
  context.traceId = parsedBody.traceId;
2443
2503
  }
2504
+ if (permission?.path !== undefined) {
2505
+ context.path = permission.path;
2506
+ }
2444
2507
  if (status === 429) {
2445
2508
  const resp = response;
2446
2509
  const headersObj = resp?.headers;
@@ -3674,6 +3737,7 @@ var CLI_ERROR_CODES = [
3674
3737
  "invalid_argument",
3675
3738
  "authentication_required",
3676
3739
  "permission_denied",
3740
+ "local_permission_denied",
3677
3741
  "not_found",
3678
3742
  "rate_limited",
3679
3743
  "network_error",
@@ -4109,12 +4173,16 @@ function defaultErrorCodeForHttpStatus(status) {
4109
4173
  return "server_error";
4110
4174
  return;
4111
4175
  }
4176
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
4112
4177
  function defaultErrorCodeForFailure(data) {
4113
4178
  if (data.Result === RESULTS.Failure) {
4114
4179
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
4115
4180
  const errorCode = defaultErrorCodeForHttpStatus(status);
4116
4181
  if (errorCode)
4117
4182
  return errorCode;
4183
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
4184
+ return "local_permission_denied";
4185
+ }
4118
4186
  }
4119
4187
  return defaultErrorCodeForResult(data.Result);
4120
4188
  }
@@ -4716,11 +4784,10 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
4716
4784
  function installSdkUserAgentHeader(BaseApiClass, userAgent) {
4717
4785
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
4718
4786
  }
4719
- // ../../common/src/tool-provider.ts
4720
- var factorySlot = singleton("PackagerFactoryProvider");
4721
- var moduleSlot = singleton("ToolModuleProvider");
4722
4787
  // ../../common/src/telemetry/ship-succeeded.ts
4723
4788
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
4789
+ // ../../common/src/tool-provider.ts
4790
+ var factorySlot = singleton("PackagerFactoryProvider");
4724
4791
  // ../resourcecatalog-sdk/generated/src/runtime.ts
4725
4792
  var BASE_PATH = "http://localhost".replace(/\/+$/, "");
4726
4793
 
@@ -7601,6 +7668,9 @@ function normalizeTokenRefreshUnavailableFailure() {
7601
7668
  function errorMessage(error) {
7602
7669
  return error instanceof Error ? error.message : String(error);
7603
7670
  }
7671
+ // ../../auth/src/tenantSelection.ts
7672
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
7673
+
7604
7674
  // ../../auth/src/selectTenant.ts
7605
7675
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
7606
7676
  var INVALID_TENANT_CODE = "INVALID_TENANT";
@@ -7873,4 +7943,4 @@ var registerCommands = async (program2) => {
7873
7943
 
7874
7944
  export { Command, metadata, registerCommands };
7875
7945
 
7876
- //# debugId=37E313F69036D0D564756E2164756E21
7946
+ //# debugId=4CDE77C88505809E64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-2ts43bvr.js";
4
+ } from "./tool-0nnndpnq.js";
5
5
  import"./tool-eb3gcj08.js";
6
6
  import"./tool-31j9b09f.js";
7
7
  import"./tool-yy8n2117.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/resourcecatalog-tool",
3
3
  "license": "MIT",
4
- "version": "1.201.0-preview.115",
4
+ "version": "1.201.0-preview.122",
5
5
  "description": "CLI plugin for the UiPath Resource Catalog 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": "6c56f56100be96231fccbaa59e99d64d94808d58"
30
30
  }