@uipath/traces-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-06kqhfc3.js";
6
+ } from "./tool-mqa1jqhm.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/traces-tool",
2114
2114
  license: "MIT",
2115
- version: "1.201.0-preview.115",
2115
+ version: "1.201.0-preview.121",
2116
2116
  description: "Query execution traces for UiPath jobs",
2117
2117
  private: false,
2118
2118
  keywords: [
@@ -2205,17 +2205,18 @@ var TLS_ERROR_CODES = new Set([
2205
2205
  ]);
2206
2206
  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.";
2207
2207
  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.";
2208
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
2209
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
2210
+ function localPermissionInstructions(code, path) {
2211
+ const target = path !== undefined ? `'${path}'` : "a local file or resource";
2212
+ if (code === "EROFS") {
2213
+ 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.";
2214
+ }
2215
+ 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.";
2216
+ 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}`;
2217
+ }
2208
2218
  function describeConnectivityError(error) {
2209
- const queue = [error];
2210
- const seen = new Set;
2211
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2212
- const current = queue.shift();
2213
- if (current === null || typeof current !== "object")
2214
- continue;
2215
- if (seen.has(current))
2216
- continue;
2217
- seen.add(current);
2218
- const cur = current;
2219
+ for (const cur of walkErrorGraph(error)) {
2219
2220
  const code = typeof cur.code === "string" ? cur.code : undefined;
2220
2221
  const message = typeof cur.message === "string" ? cur.message : undefined;
2221
2222
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -2234,6 +2235,49 @@ function describeConnectivityError(error) {
2234
2235
  instructions: NETWORK_INSTRUCTIONS
2235
2236
  };
2236
2237
  }
2238
+ }
2239
+ return;
2240
+ }
2241
+ function describePermissionError(error) {
2242
+ for (const cur of walkErrorGraph(error)) {
2243
+ const message = typeof cur.message === "string" ? cur.message : undefined;
2244
+ const code = matchLocalPermissionCode(cur.code, message);
2245
+ if (!code)
2246
+ continue;
2247
+ const path = localPermissionPath(cur.path, message);
2248
+ return {
2249
+ code,
2250
+ message: message ?? code,
2251
+ ...path !== undefined ? { path } : {},
2252
+ instructions: localPermissionInstructions(code, path)
2253
+ };
2254
+ }
2255
+ return;
2256
+ }
2257
+ function matchLocalPermissionCode(code, message) {
2258
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
2259
+ return code;
2260
+ }
2261
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
2262
+ return match ? match[1] : undefined;
2263
+ }
2264
+ function localPermissionPath(path, message) {
2265
+ if (typeof path === "string")
2266
+ return path;
2267
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
2268
+ }
2269
+ function* walkErrorGraph(error) {
2270
+ const queue = [error];
2271
+ const seen = new Set;
2272
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
2273
+ const current = queue.shift();
2274
+ if (current === null || typeof current !== "object")
2275
+ continue;
2276
+ if (seen.has(current))
2277
+ continue;
2278
+ seen.add(current);
2279
+ const cur = current;
2280
+ yield cur;
2237
2281
  if (cur.cause !== undefined)
2238
2282
  queue.push(cur.cause);
2239
2283
  if (Array.isArray(cur.errors))
@@ -2294,6 +2338,12 @@ function classifyError(status, error) {
2294
2338
  if (status !== undefined && status >= 500 && status < 600) {
2295
2339
  return { errorCode: "server_error", retry: "RetryLater" };
2296
2340
  }
2341
+ if (status === undefined && describePermissionError(error)) {
2342
+ return {
2343
+ errorCode: "local_permission_denied",
2344
+ retry: "RetryWillNotFix"
2345
+ };
2346
+ }
2297
2347
  const connectivity = describeConnectivityError(error);
2298
2348
  if (connectivity) {
2299
2349
  return {
@@ -2396,6 +2446,16 @@ async function extractErrorDetails(error, options) {
2396
2446
  message = `${message}: ${connectivity.message}`;
2397
2447
  }
2398
2448
  }
2449
+ const permission = status === undefined ? describePermissionError(error) : undefined;
2450
+ if (permission) {
2451
+ if (permission.message !== message && !message.includes(permission.message)) {
2452
+ message = `${message}: ${permission.message}`;
2453
+ }
2454
+ if (!message.includes(permission.instructions)) {
2455
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
2456
+ message = `${punctuated} ${permission.instructions}`;
2457
+ }
2458
+ }
2399
2459
  let details = rawMessage;
2400
2460
  if (rawBody) {
2401
2461
  if (parsedBody) {
@@ -2435,6 +2495,9 @@ async function extractErrorDetails(error, options) {
2435
2495
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
2436
2496
  context.traceId = parsedBody.traceId;
2437
2497
  }
2498
+ if (permission?.path !== undefined) {
2499
+ context.path = permission.path;
2500
+ }
2438
2501
  if (status === 429) {
2439
2502
  const resp = response;
2440
2503
  const headersObj = resp?.headers;
@@ -3668,6 +3731,7 @@ var CLI_ERROR_CODES = [
3668
3731
  "invalid_argument",
3669
3732
  "authentication_required",
3670
3733
  "permission_denied",
3734
+ "local_permission_denied",
3671
3735
  "not_found",
3672
3736
  "rate_limited",
3673
3737
  "network_error",
@@ -4103,12 +4167,16 @@ function defaultErrorCodeForHttpStatus(status) {
4103
4167
  return "server_error";
4104
4168
  return;
4105
4169
  }
4170
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
4106
4171
  function defaultErrorCodeForFailure(data) {
4107
4172
  if (data.Result === RESULTS.Failure) {
4108
4173
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
4109
4174
  const errorCode = defaultErrorCodeForHttpStatus(status);
4110
4175
  if (errorCode)
4111
4176
  return errorCode;
4177
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
4178
+ return "local_permission_denied";
4179
+ }
4112
4180
  }
4113
4181
  return defaultErrorCodeForResult(data.Result);
4114
4182
  }
@@ -4722,11 +4790,10 @@ function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
4722
4790
  function installSdkUserAgentHeader(BaseApiClass, userAgent) {
4723
4791
  installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
4724
4792
  }
4725
- // ../common/src/tool-provider.ts
4726
- var factorySlot = singleton("PackagerFactoryProvider");
4727
- var moduleSlot = singleton("ToolModuleProvider");
4728
4793
  // ../common/src/telemetry/ship-succeeded.ts
4729
4794
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
4795
+ // ../common/src/tool-provider.ts
4796
+ var factorySlot = singleton("PackagerFactoryProvider");
4730
4797
  // ../auth/src/config.ts
4731
4798
  var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
4732
4799
  var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
@@ -5999,6 +6066,9 @@ var getAuthContext = async (options = {}) => {
5999
6066
  tenantName
6000
6067
  };
6001
6068
  };
6069
+ // ../auth/src/tenantSelection.ts
6070
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
6071
+
6002
6072
  // ../auth/src/selectTenant.ts
6003
6073
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
6004
6074
  var INVALID_TENANT_CODE = "INVALID_TENANT";
@@ -10958,4 +11028,4 @@ var registerCommands = async (program2) => {
10958
11028
 
10959
11029
  export { Command, metadata, registerCommands };
10960
11030
 
10961
- //# debugId=9F4664D32AA8DB3564756E2164756E21
11031
+ //# debugId=05E0D17461660B9064756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-06kqhfc3.js";
4
+ } from "./tool-mqa1jqhm.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/traces-tool",
3
3
  "license": "MIT",
4
- "version": "1.201.0-preview.115",
4
+ "version": "1.201.0-preview.121",
5
5
  "description": "Query execution traces for UiPath jobs",
6
6
  "private": false,
7
7
  "keywords": [
@@ -21,5 +21,5 @@
21
21
  "publishConfig": {
22
22
  "registry": "https://registry.npmjs.org/"
23
23
  },
24
- "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
24
+ "gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
25
25
  }