@uipath/gov-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.
Files changed (2) hide show
  1. package/dist/tool.js +94 -15
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -8166,7 +8166,7 @@ var init_dist = __esm(() => {
8166
8166
  var package_default = {
8167
8167
  name: "@uipath/gov-tool",
8168
8168
  license: "MIT",
8169
- version: "1.201.0-preview.115",
8169
+ version: "1.201.0-preview.121",
8170
8170
  description: "Manage UiPath governance — AOps policies, Access policies, and compliance packs.",
8171
8171
  private: false,
8172
8172
  repository: {
@@ -10462,6 +10462,8 @@ init_constants();
10462
10462
 
10463
10463
  // ../../auth/src/interactive.ts
10464
10464
  init_src();
10465
+ // ../../auth/src/tenantSelection.ts
10466
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
10465
10467
 
10466
10468
  // ../../auth/src/selectTenant.ts
10467
10469
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
@@ -10571,17 +10573,18 @@ var TLS_ERROR_CODES = new Set([
10571
10573
  ]);
10572
10574
  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.";
10573
10575
  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.";
10576
+ var LOCAL_PERMISSION_ERROR_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
10577
+ var LOCAL_PERMISSION_MESSAGE_PATTERN = /\b(EACCES|EPERM|EROFS)\b/;
10578
+ function localPermissionInstructions(code, path3) {
10579
+ const target = path3 !== undefined ? `'${path3}'` : "a local file or resource";
10580
+ if (code === "EROFS") {
10581
+ 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.";
10582
+ }
10583
+ 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.";
10584
+ 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}`;
10585
+ }
10574
10586
  function describeConnectivityError(error) {
10575
- const queue = [error];
10576
- const seen = new Set;
10577
- for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
10578
- const current = queue.shift();
10579
- if (current === null || typeof current !== "object")
10580
- continue;
10581
- if (seen.has(current))
10582
- continue;
10583
- seen.add(current);
10584
- const cur = current;
10587
+ for (const cur of walkErrorGraph(error)) {
10585
10588
  const code = typeof cur.code === "string" ? cur.code : undefined;
10586
10589
  const message = typeof cur.message === "string" ? cur.message : undefined;
10587
10590
  if (code && TLS_ERROR_CODES.has(code)) {
@@ -10600,6 +10603,49 @@ function describeConnectivityError(error) {
10600
10603
  instructions: NETWORK_INSTRUCTIONS
10601
10604
  };
10602
10605
  }
10606
+ }
10607
+ return;
10608
+ }
10609
+ function describePermissionError(error) {
10610
+ for (const cur of walkErrorGraph(error)) {
10611
+ const message = typeof cur.message === "string" ? cur.message : undefined;
10612
+ const code = matchLocalPermissionCode(cur.code, message);
10613
+ if (!code)
10614
+ continue;
10615
+ const path3 = localPermissionPath(cur.path, message);
10616
+ return {
10617
+ code,
10618
+ message: message ?? code,
10619
+ ...path3 !== undefined ? { path: path3 } : {},
10620
+ instructions: localPermissionInstructions(code, path3)
10621
+ };
10622
+ }
10623
+ return;
10624
+ }
10625
+ function matchLocalPermissionCode(code, message) {
10626
+ if (typeof code === "string" && LOCAL_PERMISSION_ERROR_CODES.has(code)) {
10627
+ return code;
10628
+ }
10629
+ const match = message ? LOCAL_PERMISSION_MESSAGE_PATTERN.exec(message) : null;
10630
+ return match ? match[1] : undefined;
10631
+ }
10632
+ function localPermissionPath(path3, message) {
10633
+ if (typeof path3 === "string")
10634
+ return path3;
10635
+ return message ? /'([^']+)'/.exec(message)?.[1] : undefined;
10636
+ }
10637
+ function* walkErrorGraph(error) {
10638
+ const queue = [error];
10639
+ const seen = new Set;
10640
+ for (let steps = 0;queue.length > 0 && steps < 32; steps++) {
10641
+ const current = queue.shift();
10642
+ if (current === null || typeof current !== "object")
10643
+ continue;
10644
+ if (seen.has(current))
10645
+ continue;
10646
+ seen.add(current);
10647
+ const cur = current;
10648
+ yield cur;
10603
10649
  if (cur.cause !== undefined)
10604
10650
  queue.push(cur.cause);
10605
10651
  if (Array.isArray(cur.errors))
@@ -10660,6 +10706,12 @@ function classifyError(status, error) {
10660
10706
  if (status !== undefined && status >= 500 && status < 600) {
10661
10707
  return { errorCode: "server_error", retry: "RetryLater" };
10662
10708
  }
10709
+ if (status === undefined && describePermissionError(error)) {
10710
+ return {
10711
+ errorCode: "local_permission_denied",
10712
+ retry: "RetryWillNotFix"
10713
+ };
10714
+ }
10663
10715
  const connectivity = describeConnectivityError(error);
10664
10716
  if (connectivity) {
10665
10717
  return {
@@ -10762,6 +10814,16 @@ async function extractErrorDetails(error, options) {
10762
10814
  message = `${message}: ${connectivity.message}`;
10763
10815
  }
10764
10816
  }
10817
+ const permission = status === undefined ? describePermissionError(error) : undefined;
10818
+ if (permission) {
10819
+ if (permission.message !== message && !message.includes(permission.message)) {
10820
+ message = `${message}: ${permission.message}`;
10821
+ }
10822
+ if (!message.includes(permission.instructions)) {
10823
+ const punctuated = message.endsWith(".") ? message : `${message}.`;
10824
+ message = `${punctuated} ${permission.instructions}`;
10825
+ }
10826
+ }
10765
10827
  let details = rawMessage;
10766
10828
  if (rawBody) {
10767
10829
  if (parsedBody) {
@@ -10801,6 +10863,9 @@ async function extractErrorDetails(error, options) {
10801
10863
  if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
10802
10864
  context.traceId = parsedBody.traceId;
10803
10865
  }
10866
+ if (permission?.path !== undefined) {
10867
+ context.path = permission.path;
10868
+ }
10804
10869
  if (status === 429) {
10805
10870
  const resp = response;
10806
10871
  const headersObj = resp?.headers;
@@ -12005,6 +12070,7 @@ var CLI_ERROR_CODES = [
12005
12070
  "invalid_argument",
12006
12071
  "authentication_required",
12007
12072
  "permission_denied",
12073
+ "local_permission_denied",
12008
12074
  "not_found",
12009
12075
  "rate_limited",
12010
12076
  "network_error",
@@ -12440,12 +12506,16 @@ function defaultErrorCodeForHttpStatus(status) {
12440
12506
  return "server_error";
12441
12507
  return;
12442
12508
  }
12509
+ var LOCAL_PERMISSION_TEXT_PATTERN = /(?:\b|\()(?:EACCES|EPERM|EROFS)(?::\s|\))/;
12443
12510
  function defaultErrorCodeForFailure(data) {
12444
12511
  if (data.Result === RESULTS.Failure) {
12445
12512
  const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
12446
12513
  const errorCode2 = defaultErrorCodeForHttpStatus(status);
12447
12514
  if (errorCode2)
12448
12515
  return errorCode2;
12516
+ if (status === undefined && (LOCAL_PERMISSION_TEXT_PATTERN.test(data.Message) || LOCAL_PERMISSION_TEXT_PATTERN.test(data.Instructions))) {
12517
+ return "local_permission_denied";
12518
+ }
12449
12519
  }
12450
12520
  return defaultErrorCodeForResult(data.Result);
12451
12521
  }
@@ -12947,11 +13017,10 @@ var ScreenLogger;
12947
13017
  }
12948
13018
  ScreenLogger.progress = progress;
12949
13019
  })(ScreenLogger ||= {});
12950
- // ../../common/src/tool-provider.ts
12951
- var factorySlot = singleton("PackagerFactoryProvider");
12952
- var moduleSlot = singleton("ToolModuleProvider");
12953
13020
  // ../../common/src/telemetry/ship-succeeded.ts
12954
13021
  var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
13022
+ // ../../common/src/tool-provider.ts
13023
+ var factorySlot = singleton("PackagerFactoryProvider");
12955
13024
  // src/commands/access-policy/policy.ts
12956
13025
  init_src();
12957
13026
  var RESOURCE_TYPES = Object.values(PolicyResourceType);
@@ -17138,6 +17207,12 @@ var registerDeploymentTenantCommands = (deployment) => {
17138
17207
  "modifies the tenant's assignments between the read and the save, their change will be lost.",
17139
17208
  "Avoid running concurrently against the same tenant.",
17140
17209
  "",
17210
+ "Cannot clear the LAST assignment: the governance service treats a save of an empty",
17211
+ "assignment list as a no-op, so the entries would survive while the call reported success.",
17212
+ "This command refuses that case instead. To stop a policy applying when it is the only",
17213
+ "assignment left, pin 'No Policy' with `deployment tenant configure` and",
17214
+ '"policyIdentifier": null.',
17215
+ "",
17141
17216
  "Output includes both the removed entries and the new tenantPolicies snapshot so you can audit the change."
17142
17217
  ].join(`
17143
17218
  `)).argument("<tenantIdentifier>", "Tenant GUID. From `deployment tenant list`.").requiredOption("--product-name <product-name>", "Product to unpin (e.g. StudioX). Matches the `productIdentifier` field on the tenant's saved entries.").option("--license-type <license-type>", "Narrow the removal to one license type. Omit to remove every license-type entry for the product.").option("--login-validity <minutes>", "Override the interactive-login token lifetime for this call. Rarely needed.", (v) => Number.parseInt(v, 10)).examples(REMOVE_EXAMPLES).trackedAction(processContext, async (tenantIdentifier, options) => {
@@ -17168,6 +17243,9 @@ var registerDeploymentTenantCommands = (deployment) => {
17168
17243
  if (removed.length === 0) {
17169
17244
  throw new Error("No matching policy assignment to remove.");
17170
17245
  }
17246
+ if (kept.length === 0) {
17247
+ throw new Error("Removing every remaining assignment is not supported by the governance service: " + "saving an empty assignment list is a no-op, so the tenant would keep them. " + "Pin 'No Policy' instead with `deployment tenant configure`, passing the entry " + 'with "policyIdentifier": null.');
17248
+ }
17171
17249
  const savedRaw = await tenantApi.tenantSaveTenantPoliciesRaw({
17172
17250
  tenantPolicyDto: kept
17173
17251
  });
@@ -23509,6 +23587,7 @@ function errorMessage2(error) {
23509
23587
  }
23510
23588
  init_constants2();
23511
23589
  init_src2();
23590
+ var IDENTIFIER_STATUSES2 = new Set([400, 403, 404]);
23512
23591
  var TENANT_SELECTION_REQUIRED_CODE2 = "TENANT_SELECTION_REQUIRED";
23513
23592
  var INVALID_TENANT_CODE2 = "INVALID_TENANT";
23514
23593
  var TENANT_SELECTION_CODES2 = new Set([
@@ -23999,4 +24078,4 @@ export {
23999
24078
  metadata
24000
24079
  };
24001
24080
 
24002
- //# debugId=2998D3F7C8475D0564756E2164756E21
24081
+ //# debugId=12A1BE759A55E4B164756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/gov-tool",
3
3
  "license": "MIT",
4
- "version": "1.201.0-preview.115",
4
+ "version": "1.201.0-preview.121",
5
5
  "description": "Manage UiPath governance — AOps policies, Access policies, and compliance packs.",
6
6
  "private": false,
7
7
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "files": [
24
24
  "dist"
25
25
  ],
26
- "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
26
+ "gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
27
27
  }