@uipath/admin-tool 1.205.0-preview.277 → 1.206.0-preview.279

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.
@@ -1,5 +1,3 @@
1
- import"./tool-1yh8g550.js";
2
-
3
1
  // ../../../node_modules/open/index.js
4
2
  import process7 from "node:process";
5
3
  import path from "node:path";
@@ -548,22 +546,6 @@ var open = (target, options) => {
548
546
  target
549
547
  });
550
548
  };
551
- var openApp = (name, options) => {
552
- if (typeof name !== "string" && !Array.isArray(name)) {
553
- throw new TypeError("Expected a valid `name`");
554
- }
555
- const { arguments: appArguments = [] } = options ?? {};
556
- if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
557
- throw new TypeError("Expected `appArguments` as Array type");
558
- }
559
- return baseOpen({
560
- ...options,
561
- app: {
562
- name,
563
- arguments: appArguments
564
- }
565
- });
566
- };
567
549
  function detectArchBinary(binary) {
568
550
  if (typeof binary === "string" || Array.isArray(binary)) {
569
551
  return binary;
@@ -626,9 +608,7 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
626
608
  }));
627
609
  var open_default = open;
628
610
  export {
629
- apps,
630
- open_default as default,
631
- openApp
611
+ open_default as default
632
612
  };
633
613
 
634
- //# debugId=2C63615B31AE54A364756E2164756E21
614
+ //# debugId=BDC9DE891180DAF464756E2164756E21
@@ -1,20 +1,19 @@
1
1
  import {
2
- getLoginStatusAsync
3
- } from "./tool-nwbftwhg.js";
4
- import {
2
+ catchError,
3
+ extractErrorDetails,
4
+ instructionsFor,
5
+ RESULTS,
5
6
  InvalidArgumentError,
6
7
  Option,
7
8
  OutputFormatter,
8
- RESULTS,
9
- addSdkUserAgentHeader,
10
- catchError,
11
- extractErrorDetails,
9
+ processContext,
12
10
  getSdkUserAgentToken,
13
- installSdkUserAgentHeader,
14
- instructionsFor,
15
- processContext
16
- } from "./tool-2wtwtawb.js";
17
- import"./tool-1yh8g550.js";
11
+ addSdkUserAgentHeader,
12
+ installSdkUserAgentHeader
13
+ } from "./tool-zg1at4tw.js";
14
+ import {
15
+ getAuthContext
16
+ } from "./tool-1nnqcf86.js";
18
17
 
19
18
  // ../vpngateway-sdk/generated/src/runtime.ts
20
19
  var BASE_PATH = "http://localhost".replace(/\/+$/, "");
@@ -270,7 +269,7 @@ var package_default = {
270
269
  name: "@uipath/admin-vpngateway-sdk",
271
270
  author: "UiPath",
272
271
  license: "SEE LICENSE IN LICENSE.txt",
273
- version: "1.205.0",
272
+ version: "1.206.0",
274
273
  description: "SDK for the UiPath Hypervisor VPN Gateway management APIs.",
275
274
  repository: {
276
275
  type: "git",
@@ -1018,19 +1017,14 @@ class VpnGatewaysApi extends BaseAPI {
1018
1017
  }
1019
1018
  // ../vpngateway-sdk/src/client-factory.ts
1020
1019
  async function resolveConfig(options) {
1021
- const status = await getLoginStatusAsync();
1022
- if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
1023
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
1024
- }
1025
- if (!status.organizationId) {
1026
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
1027
- }
1028
- const tenant = options?.tenantName ?? status.tenantName;
1029
- if (!tenant) {
1030
- throw new Error("Tenant not available. Pass --tenant <name> or log in with a tenant context.");
1031
- }
1032
- const basePath = `${status.baseUrl}/${encodeURIComponent(status.organizationId)}/${encodeURIComponent(tenant)}/hypervisor_`;
1033
- const bearerToken = options?.s2sToken ?? status.accessToken;
1020
+ const auth = await getAuthContext({
1021
+ tenant: options?.tenantName,
1022
+ requireOrganizationId: true,
1023
+ requireTenantName: true
1024
+ });
1025
+ const tenant = auth.tenantName;
1026
+ const basePath = `${auth.baseUrl}/${encodeURIComponent(auth.organizationId)}/${encodeURIComponent(tenant)}/hypervisor_`;
1027
+ const bearerToken = options?.s2sToken ?? auth.accessToken;
1034
1028
  return {
1035
1029
  config: new Configuration({
1036
1030
  basePath,
@@ -1039,7 +1033,7 @@ async function resolveConfig(options) {
1039
1033
  "x-uipath-source": "UiPath.CLI"
1040
1034
  }, SDK_USER_AGENT)
1041
1035
  }),
1042
- organizationId: status.organizationId,
1036
+ organizationId: auth.organizationId,
1043
1037
  tenantName: tenant
1044
1038
  };
1045
1039
  }
@@ -2243,4 +2237,4 @@ export {
2243
2237
  registerCommands
2244
2238
  };
2245
2239
 
2246
- //# debugId=F7B7DA646F9E6FE964756E2164756E21
2240
+ //# debugId=F310845D137A348E64756E2164756E21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __commonJS
3
- } from "./tool-1yh8g550.js";
3
+ } from "./tool-zg1at4tw.js";
4
4
 
5
5
  // ../../../node_modules/jmespath/jmespath.js
6
6
  var require_jmespath = __commonJS(function(exports) {
@@ -1,5 +1,3 @@
1
- import"./tool-1yh8g550.js";
2
-
3
1
  // ../../../node_modules/js-yaml/dist/js-yaml.mjs
4
2
  function getDefaultExportFromCjs(x) {
5
3
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -3150,4 +3148,4 @@ export {
3150
3148
  types
3151
3149
  };
3152
3150
 
3153
- //# debugId=87463FE309AE7C9C64756E2164756E21
3151
+ //# debugId=C1B3553ECA3A832664756E2164756E21
@@ -1,9 +1,7 @@
1
1
  import {
2
+ __require,
2
3
  getFileSystem
3
- } from "./tool-2wtwtawb.js";
4
- import {
5
- __require
6
- } from "./tool-1yh8g550.js";
4
+ } from "./tool-zg1at4tw.js";
7
5
 
8
6
  // ../../auth/src/catch-error.ts
9
7
  function isPromiseLike(value) {
@@ -366,6 +364,8 @@ var ENV_AUTH_VARS = {
366
364
  };
367
365
 
368
366
  class EnvAuthConfigError extends Error {
367
+ errorCode = "configuration_error";
368
+ retry = "RetryWillNotFix";
369
369
  constructor(message) {
370
370
  super(message);
371
371
  this.name = "EnvAuthConfigError";
@@ -404,11 +404,11 @@ var readAuthFromEnv = () => {
404
404
  if (!rawUrl) {
405
405
  throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
406
406
  }
407
- const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
407
+ const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
408
408
  return {
409
409
  loginStatus: "Logged in",
410
410
  accessToken,
411
- baseUrl: baseUrl2,
411
+ baseUrl,
412
412
  organizationName,
413
413
  organizationId,
414
414
  tenantName,
@@ -708,9 +708,12 @@ var refreshAccessToken = async ({
708
708
  body: tokenParams
709
709
  });
710
710
  const tokenData = await tokenResponse.json();
711
- if (!tokenResponse.ok) {
711
+ if (tokenResponse.status === 400 || tokenResponse.status === 401) {
712
712
  throw new TokenRefreshOAuthError;
713
713
  }
714
+ if (!tokenResponse.ok) {
715
+ throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
716
+ }
714
717
  const newAccessToken = tokenData.access_token;
715
718
  const newRefreshToken = tokenData.refresh_token;
716
719
  if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
@@ -773,20 +776,20 @@ var probeAsync = async (fs, candidate) => {
773
776
  var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
774
777
  const fs = getFileSystem();
775
778
  if (fs.path.isAbsolute(envFilePath)) {
776
- const probe2 = await probeAsync(fs, envFilePath);
777
- return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
779
+ const probe = await probeAsync(fs, envFilePath);
780
+ return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
778
781
  exists: false,
779
782
  absolutePath: envFilePath,
780
783
  source: "absolute",
781
- ...probe2.unusable ? { unusable: probe2.unusable } : {}
784
+ ...probe.unusable ? { unusable: probe.unusable } : {}
782
785
  };
783
786
  }
784
787
  const cwd = opts?.cwd ?? fs.env.cwd();
785
788
  let searchDir = cwd;
786
789
  while (true) {
787
790
  const candidate = fs.path.join(searchDir, envFilePath);
788
- const probe2 = await probeAsync(fs, candidate);
789
- if (probe2.exists) {
791
+ const probe = await probeAsync(fs, candidate);
792
+ if (probe.exists) {
790
793
  return {
791
794
  exists: true,
792
795
  absolutePath: candidate,
@@ -1429,26 +1432,38 @@ function errorMessage(error) {
1429
1432
  }
1430
1433
 
1431
1434
  // ../../auth/src/authContext.ts
1435
+ class AuthContextUnavailableError extends Error {
1436
+ instructionContext;
1437
+ sessionHint;
1438
+ errorCode = "authentication_required";
1439
+ retry = "RetryWillNotFix";
1440
+ constructor(message, instructionContext = "auth", sessionHint) {
1441
+ super(message);
1442
+ this.instructionContext = instructionContext;
1443
+ this.sessionHint = sessionHint;
1444
+ this.name = "AuthContextUnavailableError";
1445
+ }
1446
+ }
1432
1447
  var getAuthContext = async (options = {}) => {
1433
1448
  const status = await getLoginStatusAsync({
1434
1449
  ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
1435
1450
  envFilePath: options.envFilePath
1436
1451
  });
1437
1452
  if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
1438
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
1453
+ throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
1439
1454
  }
1440
- const tenantName = options.tenant ?? status.tenantName;
1455
+ const tenantName = options.tenant || status.tenantName;
1441
1456
  if (options.requireOrganizationId && !status.organizationId) {
1442
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
1457
+ throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
1443
1458
  }
1444
1459
  if (options.requireOrganizationName && !status.organizationName) {
1445
- throw new Error("Organization name not available. Ensure you are logged in with an organization context.");
1460
+ throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
1446
1461
  }
1447
1462
  if (options.requireTenantId && !status.tenantId) {
1448
- throw new Error("Tenant ID not available. Ensure UIPATH_TENANT_ID is set.");
1463
+ throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
1449
1464
  }
1450
- if (options.requireTenantName && tenantName === undefined) {
1451
- throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
1465
+ if (options.requireTenantName && !tenantName) {
1466
+ throw new AuthContextUnavailableError("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.", "identity");
1452
1467
  }
1453
1468
  return {
1454
1469
  baseUrl: status.baseUrl,
@@ -1467,6 +1482,6 @@ var TENANT_SELECTION_CODES = new Set([
1467
1482
  TENANT_SELECTION_REQUIRED_CODE,
1468
1483
  INVALID_TENANT_CODE
1469
1484
  ]);
1470
- export { getLoginStatusAsync, getAuthContext };
1485
+ export { getAuthContext };
1471
1486
 
1472
- //# debugId=F3581BB00728E2A764756E2164756E21
1487
+ //# debugId=7D6E6CA9B0054FEF64756E2164756E21
@@ -1,24 +1,24 @@
1
1
  import {
2
- getLoginStatusAsync
3
- } from "./tool-nwbftwhg.js";
4
- import {
5
- OutputFormatter,
6
- RESULTS,
7
- addSdkUserAgentHeader,
2
+ getFileSystem,
8
3
  catchError,
9
4
  extractErrorMessage,
10
- getFileSystem,
5
+ RESULTS,
6
+ authContextFailure,
7
+ OutputFormatter,
8
+ processContext,
11
9
  getSdkUserAgentToken,
12
- installSdkUserAgentHeader,
13
- processContext
14
- } from "./tool-2wtwtawb.js";
15
- import"./tool-1yh8g550.js";
10
+ addSdkUserAgentHeader,
11
+ installSdkUserAgentHeader
12
+ } from "./tool-zg1at4tw.js";
13
+ import {
14
+ getAuthContext
15
+ } from "./tool-1nnqcf86.js";
16
16
  // ../apms-tool/package.json
17
17
  var package_default = {
18
18
  name: "@uipath/apms-tool",
19
19
  author: "UiPath",
20
20
  license: "SEE LICENSE IN LICENSE.txt",
21
- version: "1.205.0-preview.277",
21
+ version: "1.206.0-preview.279",
22
22
  description: "CLI plugin for the UiPath Access Policy Management Service.",
23
23
  private: false,
24
24
  repository: {
@@ -45,6 +45,7 @@ var package_default = {
45
45
  ],
46
46
  scripts: {
47
47
  build: "bun ../../../tools/build-tool.ts",
48
+ typecheck: "tsc --noEmit",
48
49
  package: "bun run build && bun pm pack",
49
50
  lint: "biome check .",
50
51
  "lint:fix": "biome check --write .",
@@ -316,7 +317,7 @@ var package_default2 = {
316
317
  name: "@uipath/apms-sdk",
317
318
  author: "UiPath",
318
319
  license: "SEE LICENSE IN LICENSE.txt",
319
- version: "1.205.0",
320
+ version: "1.206.0",
320
321
  description: "SDK for the UiPath Access Policy Management Service API.",
321
322
  repository: {
322
323
  type: "git",
@@ -347,8 +348,10 @@ var package_default2 = {
347
348
  private: true,
348
349
  scripts: {
349
350
  build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
351
+ typecheck: "tsc --noEmit",
350
352
  generate: "bun run src/scripts/generate-sdk.ts",
351
- lint: "biome check ."
353
+ lint: "biome check .",
354
+ test: "vitest run"
352
355
  },
353
356
  devDependencies: {
354
357
  "@openapitools/openapi-generator-cli": "^2.31.1",
@@ -364,11 +367,6 @@ var package_default2 = {
364
367
  var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
365
368
  installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
366
369
 
367
- // ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainDataStatus.ts
368
- function UiPathPlatformServiceAccessPolicyManagementDomainDataStatusToJSON(value) {
369
- return value;
370
- }
371
-
372
370
  // ../apms-sdk/generated/src/models/UiPathPlatformServiceAccessPolicyManagementDomainDataType.ts
373
371
  function UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSON(json) {
374
372
  return UiPathPlatformServiceAccessPolicyManagementDomainDataTypeFromJSONTyped(json, false);
@@ -407,7 +405,7 @@ function UiPathPlatformServiceAccessPolicyManagementDomainRequestsAddIpConfigura
407
405
  return value;
408
406
  }
409
407
  return {
410
- status: UiPathPlatformServiceAccessPolicyManagementDomainDataStatusToJSON(value["status"])
408
+ status: value["status"]
411
409
  };
412
410
  }
413
411
 
@@ -469,7 +467,7 @@ function UiPathPlatformServiceAccessPolicyManagementDomainRequestsUpdateIpConfig
469
467
  return value;
470
468
  }
471
469
  return {
472
- status: UiPathPlatformServiceAccessPolicyManagementDomainDataStatusToJSON(value["status"]),
470
+ status: value["status"],
473
471
  updatedOn: value["updatedOn"] == null ? value["updatedOn"] : value["updatedOn"].toISOString()
474
472
  };
475
473
  }
@@ -1348,17 +1346,12 @@ function rewriteApmsUrl(url) {
1348
1346
  return url.replace(STRIP_PREFIX_RE, "/accesspolicy_");
1349
1347
  }
1350
1348
  async function resolveConfig(options) {
1351
- const status = await getLoginStatusAsync({
1352
- ensureTokenValidityMinutes: options?.loginValidity
1349
+ const auth = await getAuthContext({
1350
+ ensureTokenValidityMinutes: options?.loginValidity,
1351
+ requireOrganizationId: true
1353
1352
  });
1354
- if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
1355
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
1356
- }
1357
- if (!status.organizationId) {
1358
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
1359
- }
1360
- const basePath = `${status.baseUrl}/${status.organizationId}/accesspolicy_`;
1361
- const bearerToken = options?.s2sToken ?? status.accessToken;
1353
+ const basePath = `${auth.baseUrl}/${encodeURIComponent(auth.organizationId)}/accesspolicy_`;
1354
+ const bearerToken = options?.s2sToken ?? auth.accessToken;
1362
1355
  const fetchApi = (input, init) => {
1363
1356
  if (typeof input === "string") {
1364
1357
  return fetch(rewriteApmsUrl(input), init);
@@ -1375,7 +1368,7 @@ async function resolveConfig(options) {
1375
1368
  headers: addSdkUserAgentHeader(undefined, SDK_USER_AGENT),
1376
1369
  fetchApi
1377
1370
  }),
1378
- organizationId: status.organizationId
1371
+ organizationId: auth.organizationId
1379
1372
  };
1380
1373
  }
1381
1374
  async function createApiClient(ApiClass, options) {
@@ -1436,6 +1429,11 @@ var emitLoadError = (err) => {
1436
1429
  processContext.exit(1);
1437
1430
  };
1438
1431
  var emitFailure = async (error, instructions) => {
1432
+ if (error instanceof Error && (error.name === "AuthContextUnavailableError" || error.name === "EnvAuthConfigError")) {
1433
+ OutputFormatter.error(await authContextFailure(error, instructions));
1434
+ processContext.exit(1);
1435
+ return;
1436
+ }
1439
1437
  OutputFormatter.error({
1440
1438
  Result: RESULTS.Failure,
1441
1439
  Message: await extractErrorMessage(error),
@@ -1458,16 +1456,14 @@ async function extractResponseData(response) {
1458
1456
  return;
1459
1457
  }
1460
1458
  async function fetchCurrentIp(loginValidity) {
1461
- const status = await getLoginStatusAsync({
1462
- ensureTokenValidityMinutes: loginValidity
1459
+ const auth = await getAuthContext({
1460
+ ensureTokenValidityMinutes: loginValidity,
1461
+ requireOrganizationId: true
1463
1462
  });
1464
- if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken || !status.organizationId) {
1465
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
1466
- }
1467
- const url = `${status.baseUrl}/${status.organizationId}/portal_/api/accesspolicy/ip`;
1463
+ const url = `${auth.baseUrl}/${encodeURIComponent(auth.organizationId)}/portal_/api/accesspolicy/ip`;
1468
1464
  const res = await fetch(url, {
1469
1465
  method: "GET",
1470
- headers: { Authorization: `Bearer ${status.accessToken}` }
1466
+ headers: { Authorization: `Bearer ${auth.accessToken}` }
1471
1467
  });
1472
1468
  const text = (await res.text()).trim();
1473
1469
  if (!res.ok) {
@@ -2524,8 +2520,7 @@ var registerCommands = async (program) => {
2524
2520
  registerIpRestrictionCommand(program);
2525
2521
  };
2526
2522
  export {
2527
- metadata,
2528
2523
  registerCommands
2529
2524
  };
2530
2525
 
2531
- //# debugId=9B4340496183544A64756E2164756E21
2526
+ //# debugId=9458E5BB7D16AA0364756E2164756E21