@uipath/cli 1.205.0-preview.281 → 1.206.0-preview.282

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 (76) hide show
  1. package/dist/{applicationinsights-s28k1t0d.js → applicationinsights-pwe8sf3y.js} +1269 -1269
  2. package/dist/{browser-strategy-6atc7v8s.js → browser-strategy-p5fhwxqj.js} +6 -7
  3. package/dist/cli-s27j1n5p.js +23 -0
  4. package/dist/contentStore-m1z06vbp.js +41 -0
  5. package/dist/environmentInfo-687282b3.js +71 -0
  6. package/dist/feedbackPrompts-t1enxv1x.js +144 -0
  7. package/dist/handlers-93z27zrr.js +805 -0
  8. package/dist/index-090cbg51.js +72 -0
  9. package/dist/index-16d4evd1.js +1051 -0
  10. package/dist/index-1vyte4ma.js +14 -0
  11. package/dist/index-1z45q8dr.js +365 -0
  12. package/dist/index-21kns9qg.js +10 -0
  13. package/dist/{index-30618bjs.js → index-2mm750yx.js} +174 -234
  14. package/dist/{index-622x1qb5.js → index-3fvbddpw.js} +7092 -7092
  15. package/dist/{index-d3w0wn6k.js → index-5gce5wfd.js} +16 -16
  16. package/dist/index-5j0bfd3e.js +4744 -0
  17. package/dist/index-5r4q8h0q.js +30 -0
  18. package/dist/index-68xmrb9x.js +237 -0
  19. package/dist/index-6wj58qka.js +59 -0
  20. package/dist/index-99emfvtm.js +13 -0
  21. package/dist/{index-pj3g8ftz.js → index-9db5vwx9.js} +2429 -1693
  22. package/dist/index-ayg25v46.js +151 -0
  23. package/dist/index-bf0e4evz.js +6180 -0
  24. package/dist/index-bpqx6f8h.js +92 -0
  25. package/dist/index-bpxh3fqv.js +392 -0
  26. package/dist/index-c6fsnn8s.js +200 -0
  27. package/dist/{index-m5nwse9v.js → index-cj4v0jct.js} +21 -69
  28. package/dist/index-ckafghar.js +274 -0
  29. package/dist/{index-469jgr1w.js → index-dsj3jrm0.js} +105 -106
  30. package/dist/{index-1yh8g550.js → index-epsr41wx.js} +8 -12
  31. package/dist/index-gbdz3pb5.js +668 -0
  32. package/dist/{index-yb4er9vd.js → index-jjejkkg4.js} +474 -528
  33. package/dist/index-jmz7bmca.js +1327 -0
  34. package/dist/{index-wwyf05nx.js → index-k9t8g78x.js} +331 -2595
  35. package/dist/index-kg1xrq51.js +171 -0
  36. package/dist/index-m8vqyv3g.js +72 -0
  37. package/dist/index-nht90rae.js +45 -0
  38. package/dist/index-nsrrst23.js +44 -0
  39. package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
  40. package/dist/index-qadhm1gn.js +271 -0
  41. package/dist/index-qwbyt2q5.js +95 -0
  42. package/dist/index-rr5hdtcy.js +95 -0
  43. package/dist/{index-qa9gftnj.js → index-xd2w5pct.js} +3 -3
  44. package/dist/{index-925304r7.js → index-y085rpen.js} +29 -25
  45. package/dist/index-y5ncb93a.js +240 -0
  46. package/dist/index-y7d0cth0.js +93 -0
  47. package/dist/{index-hdxtgckw.js → index-z070caqq.js} +56 -12
  48. package/dist/index-zdqbp34f.js +14 -0
  49. package/dist/index.js +38 -36
  50. package/dist/install-3gw33jcf.js +558 -0
  51. package/dist/{jmespath-e4a59c8w.js → jmespath-ab6tdc42.js} +1 -1
  52. package/dist/js-yaml-0c4svjwq.js +36 -0
  53. package/dist/{mcp-jssaz3wr.js → mcp-s50h6d56.js} +236 -472
  54. package/dist/{node-strategy-ggx3nmyj.js → node-strategy-p1n8wr5s.js} +16 -19
  55. package/dist/project-context-285hydnd.js +94 -0
  56. package/dist/prompt-yxpm7mfr.js +13 -0
  57. package/dist/{server-7jza1fyx.js → server-900wc6vc.js} +28 -43
  58. package/dist/skillCatalog-d1t2qec8.js +22 -0
  59. package/dist/skillsService-tpvbx5g8.js +29 -0
  60. package/dist/{stdio-tmngemcz.js → stdio-kpsab5bz.js} +2 -4
  61. package/dist/{telemetry-drain-r92f0e4r.js → telemetry-drain-bw59e8f5.js} +8 -9
  62. package/dist/tree-j4w7p0pg.js +17 -0
  63. package/dist/updateService-mt6d51p1.js +522 -0
  64. package/dist/updateService.skills-491vfgt8.js +22 -0
  65. package/dist/updateService.tools-f7tr6kc6.js +16 -0
  66. package/package.json +2 -2
  67. package/dist/cli-kyp49kdm.js +0 -19
  68. package/dist/index-0gctz400.js +0 -17
  69. package/dist/index-4cq44eth.js +0 -19427
  70. package/dist/index-7tshyfxx.js +0 -157
  71. package/dist/index-g8ck9tv6.js +0 -2
  72. package/dist/index-ngs0a2he.js +0 -15
  73. package/dist/index-pr8kzdte.js +0 -9867
  74. package/dist/index-yc4kw997.js +0 -13
  75. package/dist/js-yaml-69tsdrrf.js +0 -37
  76. package/dist/updateService-t3yq8936.js +0 -14
@@ -1,28 +1,28 @@
1
1
  import {
2
- getGlobalThis,
3
- isBrowser
4
- } from "./index-0gctz400.js";
2
+ UIPATH_HOME_DIR2,
3
+ AUTH_FILENAME,
4
+ DEFAULT_BASE_URL,
5
+ DEFAULT_REDIRECT_URI
6
+ } from "./index-99emfvtm.js";
5
7
  import {
6
- catchError
7
- } from "./index-qa9gftnj.js";
8
+ getFileSystem2
9
+ } from "./index-z070caqq.js";
8
10
  import {
9
- getFileSystem
10
- } from "./index-hdxtgckw.js";
11
+ isBrowser2,
12
+ getGlobalThis
13
+ } from "./index-zdqbp34f.js";
11
14
  import {
12
- AUTH_FILENAME,
13
- DEFAULT_BASE_URL,
14
- DEFAULT_REDIRECT_URI,
15
- UIPATH_HOME_DIR
16
- } from "./index-yc4kw997.js";
15
+ catchError2
16
+ } from "./index-xd2w5pct.js";
17
17
  import {
18
18
  __require
19
- } from "./index-1yh8g550.js";
19
+ } from "./index-epsr41wx.js";
20
20
 
21
21
  // ../auth/src/config.ts
22
22
  var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
23
23
  var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
24
24
  var globalSlot = globalThis;
25
- var setAuthFileConfig = (cfg) => {
25
+ var setAuthFileConfig2 = (cfg) => {
26
26
  globalSlot[AUTH_FILE_CONFIG_KEY] = cfg ?? {};
27
27
  };
28
28
  var getAuthFileConfig = () => globalSlot[AUTH_FILE_CONFIG_KEY] ?? {};
@@ -61,7 +61,7 @@ var normalizeAndValidateBaseUrl = (rawUrl) => {
61
61
  baseUrl = `https://${baseUrl}`;
62
62
  }
63
63
  const resolvedBaseUrl = baseUrl;
64
- const [urlError, url] = catchError(() => new URL(resolvedBaseUrl));
64
+ const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
65
65
  if (urlError) {
66
66
  const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
67
67
  throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
@@ -289,14 +289,14 @@ function ClientSecretPost2(clientSecret) {
289
289
  return ClientSecretPost(clientSecret);
290
290
  }
291
291
  tbi ||= new WeakMap;
292
- return (as, client, body, headers2) => {
292
+ return (as, client, body, headers) => {
293
293
  let auth;
294
294
  if (!(auth = tbi.get(client))) {
295
295
  assertString2(client.client_secret, '"metadata.client_secret"');
296
296
  auth = ClientSecretPost(client.client_secret);
297
297
  tbi.set(client, auth);
298
298
  }
299
- return auth(as, client, body, headers2);
299
+ return auth(as, client, body, headers);
300
300
  };
301
301
  }
302
302
  function assertString2(input, it) {
@@ -463,7 +463,8 @@ var exchangeCodeForTokens = async ({
463
463
  };
464
464
 
465
465
  // ../auth/src/authProfile.ts
466
- var DEFAULT_AUTH_PROFILE = "default";
466
+ var DEFAULT_AUTH_PROFILE2 = "default";
467
+ var INHERITED_AUTH_PROFILE_ENV2 = "UIPATH_CLI_INHERITED_PROFILE";
467
468
  var PROFILE_DIR = "profiles";
468
469
  var PROFILE_NAME_RE = /^[A-Za-z0-9._-]+$/;
469
470
  var ACTIVE_AUTH_PROFILE_KEY = Symbol.for("@uipath/auth/ActiveAuthProfile");
@@ -473,7 +474,7 @@ function isAuthProfileStorage(value) {
473
474
  return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
474
475
  }
475
476
  function createProfileStorage() {
476
- const [error, mod] = catchError(() => __require("node:async_hooks"));
477
+ const [error, mod] = catchError2(() => __require("node:async_hooks"));
477
478
  if (error || typeof mod?.AsyncLocalStorage !== "function") {
478
479
  return {
479
480
  getStore: () => {
@@ -495,23 +496,23 @@ function getProfileStorage() {
495
496
  }
496
497
  var profileStorage = getProfileStorage();
497
498
 
498
- class AuthProfileValidationError extends Error {
499
+ class AuthProfileValidationError2 extends Error {
499
500
  constructor(message) {
500
501
  super(message);
501
502
  this.name = "AuthProfileValidationError";
502
503
  }
503
504
  }
504
- function normalizeAuthProfileName(profile) {
505
- if (profile === undefined || profile === DEFAULT_AUTH_PROFILE) {
505
+ function normalizeAuthProfileName2(profile) {
506
+ if (profile === undefined || profile === DEFAULT_AUTH_PROFILE2) {
506
507
  return;
507
508
  }
508
509
  if (profile.length === 0 || profile === "." || profile === ".." || !PROFILE_NAME_RE.test(profile)) {
509
- throw new AuthProfileValidationError(`Invalid profile name "${profile}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);
510
+ throw new AuthProfileValidationError2(`Invalid profile name "${profile}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);
510
511
  }
511
512
  return profile;
512
513
  }
513
- function setActiveAuthProfile(profile) {
514
- const normalized = normalizeAuthProfileName(profile);
514
+ function setActiveAuthProfile2(profile) {
515
+ const normalized = normalizeAuthProfileName2(profile);
515
516
  const scopedState = profileStorage.getStore();
516
517
  if (scopedState !== undefined) {
517
518
  if (normalized === undefined) {
@@ -527,62 +528,54 @@ function setActiveAuthProfile(profile) {
527
528
  }
528
529
  globalSlot2[ACTIVE_AUTH_PROFILE_KEY] = { profile: normalized };
529
530
  }
530
- function clearActiveAuthProfile() {
531
- const scopedState = profileStorage.getStore();
532
- if (scopedState !== undefined) {
533
- delete scopedState.profile;
534
- return;
535
- }
536
- delete globalSlot2[ACTIVE_AUTH_PROFILE_KEY];
537
- }
538
- function getActiveAuthProfile() {
531
+ function getActiveAuthProfile2() {
539
532
  const scopedState = profileStorage.getStore();
540
533
  if (scopedState !== undefined) {
541
534
  return scopedState.profile;
542
535
  }
543
536
  return globalSlot2[ACTIVE_AUTH_PROFILE_KEY]?.profile;
544
537
  }
545
- function runWithAuthProfile(profile, fn) {
546
- const normalized = normalizeAuthProfileName(profile);
538
+ function runWithAuthProfile2(profile, fn) {
539
+ const normalized = normalizeAuthProfileName2(profile);
547
540
  return profileStorage.run(normalized === undefined ? {} : { profile: normalized }, fn);
548
541
  }
549
542
  function resolveAuthProfileFilePath(profile) {
550
- const normalized = normalizeAuthProfileName(profile);
543
+ const normalized = normalizeAuthProfileName2(profile);
551
544
  if (normalized === undefined) {
552
- throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
545
+ throw new AuthProfileValidationError2(`"${DEFAULT_AUTH_PROFILE2}" is the built-in profile and does not have a profile file path.`);
553
546
  }
554
- const fs = getFileSystem();
555
- return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
547
+ const fs = getFileSystem2();
548
+ return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR2, PROFILE_DIR, normalized, AUTH_FILENAME);
556
549
  }
557
- function getActiveAuthProfileFilePath() {
558
- const profile = getActiveAuthProfile();
550
+ function getActiveAuthProfileFilePath2() {
551
+ const profile = getActiveAuthProfile2();
559
552
  return profile ? resolveAuthProfileFilePath(profile) : undefined;
560
553
  }
561
554
  function getAuthProfilesRootPath() {
562
- const fs = getFileSystem();
563
- return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR);
555
+ const fs = getFileSystem2();
556
+ return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR2, PROFILE_DIR);
564
557
  }
565
558
  function resolveAuthProfileDirPath(profile) {
566
- const normalized = normalizeAuthProfileName(profile);
559
+ const normalized = normalizeAuthProfileName2(profile);
567
560
  if (normalized === undefined) {
568
- throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile directory.`);
561
+ throw new AuthProfileValidationError2(`"${DEFAULT_AUTH_PROFILE2}" is the built-in profile and does not have a profile directory.`);
569
562
  }
570
- const fs = getFileSystem();
563
+ const fs = getFileSystem2();
571
564
  return fs.path.join(getAuthProfilesRootPath(), normalized);
572
565
  }
573
- async function listAuthProfileNamesAsync() {
574
- const fs = getFileSystem();
566
+ async function listAuthProfileNamesAsync2() {
567
+ const fs = getFileSystem2();
575
568
  const root = getAuthProfilesRootPath();
576
569
  if (!await fs.exists(root)) {
577
570
  return [];
578
571
  }
579
- const [readError, entries] = await catchError(fs.readdir(root));
572
+ const [readError, entries] = await catchError2(fs.readdir(root));
580
573
  if (readError || !entries) {
581
574
  return [];
582
575
  }
583
576
  const names = [];
584
577
  for (const entry of entries) {
585
- if (!PROFILE_NAME_RE.test(entry) || entry === DEFAULT_AUTH_PROFILE) {
578
+ if (!PROFILE_NAME_RE.test(entry) || entry === DEFAULT_AUTH_PROFILE2) {
586
579
  continue;
587
580
  }
588
581
  const stats = await fs.stat(fs.path.join(root, entry));
@@ -592,21 +585,21 @@ async function listAuthProfileNamesAsync() {
592
585
  }
593
586
  return names.sort((a, b) => a.localeCompare(b));
594
587
  }
595
- async function authProfileExistsAsync(profile) {
596
- const fs = getFileSystem();
597
- const [pathError, dir] = catchError(() => resolveAuthProfileDirPath(profile));
588
+ async function authProfileExistsAsync2(profile) {
589
+ const fs = getFileSystem2();
590
+ const [pathError, dir] = catchError2(() => resolveAuthProfileDirPath(profile));
598
591
  if (pathError || dir === undefined) {
599
592
  return false;
600
593
  }
601
594
  const stats = await fs.stat(dir);
602
595
  return stats?.isDirectory() === true;
603
596
  }
604
- async function deleteAuthProfileAsync(profile) {
597
+ async function deleteAuthProfileAsync2(profile) {
605
598
  const dir = resolveAuthProfileDirPath(profile);
606
- const fs = getFileSystem();
599
+ const fs = getFileSystem2();
607
600
  const relativeToRoot = fs.path.relative(getAuthProfilesRootPath(), dir);
608
601
  if (relativeToRoot === "" || relativeToRoot.startsWith("..") || fs.path.isAbsolute(relativeToRoot)) {
609
- throw new AuthProfileValidationError(`Refusing to delete "${profile}": resolved path escapes the profiles directory.`);
602
+ throw new AuthProfileValidationError2(`Refusing to delete "${profile}": resolved path escapes the profiles directory.`);
610
603
  }
611
604
  const stats = await fs.stat(dir);
612
605
  if (stats?.isDirectory() !== true) {
@@ -632,7 +625,7 @@ class InvalidIssuerError extends Error {
632
625
  this.name = "InvalidIssuerError";
633
626
  }
634
627
  }
635
- var parseJWT = (token) => {
628
+ var parseJWT2 = (token) => {
636
629
  try {
637
630
  const parts = token.split(".");
638
631
  const base64Url = parts[1];
@@ -641,7 +634,7 @@ var parseJWT = (token) => {
641
634
  }
642
635
  const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
643
636
  let decodedString;
644
- if (isBrowser() && typeof atob !== "undefined") {
637
+ if (isBrowser2() && typeof atob !== "undefined") {
645
638
  decodedString = atob(base64);
646
639
  } else {
647
640
  decodedString = Buffer.from(base64, "base64").toString();
@@ -656,7 +649,7 @@ var parseJWT = (token) => {
656
649
  var assertIssuerMatchesAuthority = (token, authority) => {
657
650
  let payload;
658
651
  try {
659
- payload = parseJWT(token);
652
+ payload = parseJWT2(token);
660
653
  } catch (error) {
661
654
  throw new InvalidIssuerError(`${authority.replace(/\/+$/, "")}/identity_`, `<unparseable: ${error instanceof Error ? error.message : "unknown error"}>`);
662
655
  }
@@ -688,9 +681,9 @@ var getTokenExpiration = (accessToken) => {
688
681
  };
689
682
 
690
683
  // ../auth/src/sessionIdentity.ts
691
- var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
684
+ var parseAuthFlow2 = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
692
685
  var decodeClaims = (accessToken) => {
693
- const [error, claims] = catchError(() => parseJWT(accessToken));
686
+ const [error, claims] = catchError2(() => parseJWT2(accessToken));
694
687
  return error ? undefined : claims;
695
688
  };
696
689
  var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
@@ -771,9 +764,9 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
771
764
  var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
772
765
 
773
766
  // ../auth/src/envAuth.ts
774
- var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
767
+ var ENV_AUTH_ENABLE_VAR2 = "UIPATH_CLI_ENABLE_ENV_AUTH";
775
768
  var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
776
- var ENV_AUTH_VARS = {
769
+ var ENV_AUTH_VARS2 = {
777
770
  token: "UIPATH_CLI_AUTH_TOKEN",
778
771
  organizationName: "UIPATH_CLI_ORGANIZATION_NAME",
779
772
  organizationId: "UIPATH_CLI_ORGANIZATION_ID",
@@ -781,50 +774,52 @@ var ENV_AUTH_VARS = {
781
774
  tenantId: "UIPATH_CLI_TENANT_ID"
782
775
  };
783
776
 
784
- class EnvAuthConfigError extends Error {
777
+ class EnvAuthConfigError2 extends Error {
778
+ errorCode = "configuration_error";
779
+ retry = "RetryWillNotFix";
785
780
  constructor(message) {
786
781
  super(message);
787
782
  this.name = "EnvAuthConfigError";
788
783
  }
789
784
  }
790
- var isEnvAuthEnabled = () => process.env[ENV_AUTH_ENABLE_VAR] === "true";
785
+ var isEnvAuthEnabled2 = () => process.env[ENV_AUTH_ENABLE_VAR2] === "true";
791
786
  var isRobotAuthEnforced = () => process.env[ENFORCE_ROBOT_AUTH_VAR] === "true";
792
787
  var requireEnv = (name) => {
793
788
  const value = process.env[name];
794
789
  if (!value) {
795
- throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true but ${name} is not set. ` + `Set ${name} to enable env-var authentication.`);
790
+ throw new EnvAuthConfigError2(`${ENV_AUTH_ENABLE_VAR2}=true but ${name} is not set. ` + `Set ${name} to enable env-var authentication.`);
796
791
  }
797
792
  return value;
798
793
  };
799
794
  var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
800
795
  var resolveBaseUrl = (rawUrl, failureContext) => {
801
- const [baseUrlError, baseUrl] = catchError(() => normalizeAndValidateBaseUrl(rawUrl));
796
+ const [baseUrlError, baseUrl] = catchError2(() => normalizeAndValidateBaseUrl(rawUrl));
802
797
  if (baseUrlError) {
803
798
  if (baseUrlError instanceof InvalidBaseUrlError) {
804
799
  throw baseUrlError;
805
800
  }
806
- throw new EnvAuthConfigError(`${failureContext}: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
801
+ throw new EnvAuthConfigError2(`${failureContext}: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
807
802
  }
808
803
  return baseUrl;
809
804
  };
810
- var readAuthFromEnv = () => {
811
- const accessToken = requireEnv(ENV_AUTH_VARS.token);
812
- const organizationName = requireEnv(ENV_AUTH_VARS.organizationName);
813
- const organizationId = requireEnv(ENV_AUTH_VARS.organizationId);
814
- const tenantName = requireEnv(ENV_AUTH_VARS.tenantName);
815
- const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
816
- const [parseError, payload] = catchError(() => parseJWT(accessToken));
805
+ var readAuthFromEnv2 = () => {
806
+ const accessToken = requireEnv(ENV_AUTH_VARS2.token);
807
+ const organizationName = requireEnv(ENV_AUTH_VARS2.organizationName);
808
+ const organizationId = requireEnv(ENV_AUTH_VARS2.organizationId);
809
+ const tenantName = requireEnv(ENV_AUTH_VARS2.tenantName);
810
+ const tenantId = requireEnv(ENV_AUTH_VARS2.tenantId);
811
+ const [parseError, payload] = catchError2(() => parseJWT2(accessToken));
817
812
  if (parseError) {
818
813
  const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
819
814
  const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
820
815
  if (!rawUrl) {
821
- 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}).`);
816
+ throw new EnvAuthConfigError2(`${ENV_AUTH_VARS2.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}).`);
822
817
  }
823
- const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
818
+ const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
824
819
  return {
825
820
  loginStatus: "Logged in",
826
821
  accessToken,
827
- baseUrl: baseUrl2,
822
+ baseUrl,
828
823
  organizationName,
829
824
  organizationId,
830
825
  tenantName,
@@ -835,7 +830,7 @@ var readAuthFromEnv = () => {
835
830
  }
836
831
  const iss = payload.iss;
837
832
  if (typeof iss !== "string" || iss.length === 0) {
838
- throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} has no 'iss' claim; cannot determine ` + `the UiPath server. Ensure the token was issued by a UiPath identity server.`);
833
+ throw new EnvAuthConfigError2(`${ENV_AUTH_VARS2.token} has no 'iss' claim; cannot determine ` + `the UiPath server. Ensure the token was issued by a UiPath identity server.`);
839
834
  }
840
835
  const baseUrl = resolveBaseUrl(iss, "Failed to derive server URL from token 'iss' claim");
841
836
  const expiration = getTokenExpiration(accessToken);
@@ -875,7 +870,7 @@ function breakerPathFor(authPath) {
875
870
  return `${authPath}${BREAKER_SUFFIX}`;
876
871
  }
877
872
  async function loadRefreshBreaker(authPath) {
878
- const fs = getFileSystem();
873
+ const fs = getFileSystem2();
879
874
  try {
880
875
  const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
881
876
  if (!content)
@@ -888,7 +883,7 @@ async function loadRefreshBreaker(authPath) {
888
883
  }
889
884
  async function saveRefreshBreaker(authPath, state) {
890
885
  try {
891
- const fs = getFileSystem();
886
+ const fs = getFileSystem2();
892
887
  const path = breakerPathFor(authPath);
893
888
  await fs.mkdir(fs.path.dirname(path));
894
889
  const tempPath = `${path}.tmp`;
@@ -897,7 +892,7 @@ async function saveRefreshBreaker(authPath, state) {
897
892
  } catch {}
898
893
  }
899
894
  async function clearRefreshBreaker(authPath) {
900
- const fs = getFileSystem();
895
+ const fs = getFileSystem2();
901
896
  const path = breakerPathFor(authPath);
902
897
  try {
903
898
  if (await fs.exists(path)) {
@@ -922,7 +917,7 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
922
917
  var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
923
918
  var PIPE_NAME_MAX_LENGTH = 103;
924
919
  var getRobotIpcPipeNames = async () => {
925
- const fs = getFileSystem();
920
+ const fs = getFileSystem2();
926
921
  const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
927
922
  if (!username) {
928
923
  throw new Error("Unable to determine current username");
@@ -934,13 +929,13 @@ var defaultIsRobotIpcAvailable = async () => {
934
929
  if (process.platform === "win32") {
935
930
  return true;
936
931
  }
937
- const [pipeNamesError, pipeNames] = await catchError(getRobotIpcPipeNames());
932
+ const [pipeNamesError, pipeNames] = await catchError2(getRobotIpcPipeNames());
938
933
  if (pipeNamesError || !pipeNames) {
939
934
  return false;
940
935
  }
941
- const fs = getFileSystem();
936
+ const fs = getFileSystem2();
942
937
  for (const pipeName of pipeNames) {
943
- const [existsError, exists] = await catchError(fs.exists(pipeName));
938
+ const [existsError, exists] = await catchError2(fs.exists(pipeName));
944
939
  if (!existsError && exists === true) {
945
940
  return true;
946
941
  }
@@ -958,7 +953,7 @@ var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
958
953
  });
959
954
  });
960
955
  var parseResourceUrl = (url) => {
961
- const [error, parsed] = catchError(() => new URL(url));
956
+ const [error, parsed] = catchError2(() => new URL(url));
962
957
  if (error || !parsed)
963
958
  return;
964
959
  const segments = parsed.pathname.split("/").filter(Boolean);
@@ -969,7 +964,7 @@ var parseResourceUrl = (url) => {
969
964
  };
970
965
  };
971
966
  var ROBOT_CLIENT_LOADER_KEY = Symbol.for("@uipath/auth/RobotClientLoader");
972
- var registerRobotClientLoader = (loader) => {
967
+ var registerRobotClientLoader2 = (loader) => {
973
968
  globalThis[ROBOT_CLIENT_LOADER_KEY] = loader;
974
969
  };
975
970
  var getRegisteredRobotClientLoader = () => {
@@ -981,14 +976,14 @@ var defaultLoadModule = async () => {
981
976
  if (!hostLoader) {
982
977
  return;
983
978
  }
984
- const [error, mod] = await catchError(() => hostLoader());
979
+ const [error, mod] = await catchError2(() => hostLoader());
985
980
  if (error || !mod) {
986
981
  return;
987
982
  }
988
983
  return mod;
989
984
  };
990
985
  var tryRobotClientFallback = async (options = {}) => {
991
- if (isBrowser())
986
+ if (isBrowser2())
992
987
  return;
993
988
  if (!options.force) {
994
989
  if (process.env.CI || process.env.GITHUB_ACTIONS) {
@@ -1007,7 +1002,7 @@ var tryRobotClientFallback = async (options = {}) => {
1007
1002
  const mod = await loadModule();
1008
1003
  if (!mod)
1009
1004
  return;
1010
- const [ctorError, proxy] = catchError(() => new mod.RobotProxyConstructor);
1005
+ const [ctorError, proxy] = catchError2(() => new mod.RobotProxyConstructor);
1011
1006
  if (ctorError || !proxy) {
1012
1007
  return;
1013
1008
  }
@@ -1030,7 +1025,7 @@ var tryRobotClientFallback = async (options = {}) => {
1030
1025
  let organizationIdFromToken;
1031
1026
  let tenantIdFromToken;
1032
1027
  let issuerFromToken;
1033
- const [jwtError, claims] = catchError(() => parseJWT(accessToken));
1028
+ const [jwtError, claims] = catchError2(() => parseJWT2(accessToken));
1034
1029
  if (!jwtError && claims) {
1035
1030
  const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
1036
1031
  if (typeof rawOrgId === "string" && rawOrgId.length > 0) {
@@ -1057,7 +1052,7 @@ var tryRobotClientFallback = async (options = {}) => {
1057
1052
  } catch {
1058
1053
  return;
1059
1054
  } finally {
1060
- await catchError(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
1055
+ await catchError2(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
1061
1056
  }
1062
1057
  };
1063
1058
 
@@ -1072,7 +1067,7 @@ var describeNonJsonResponse = (organizationId, response, parseError) => {
1072
1067
  const contentType = response.headers.get("content-type") ?? "unknown";
1073
1068
  return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
1074
1069
  };
1075
- var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId, signal) => {
1070
+ var fetchTenantsAndOrganizations2 = async (baseUrl, accessToken, organizationId, signal) => {
1076
1071
  const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
1077
1072
  const response = await fetch(url, {
1078
1073
  headers: {
@@ -1088,7 +1083,7 @@ var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId,
1088
1083
  const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
1089
1084
  throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
1090
1085
  }
1091
- const [parseError, data] = await catchError(response.json());
1086
+ const [parseError, data] = await catchError2(response.json());
1092
1087
  if (parseError) {
1093
1088
  throw new Error(describeNonJsonResponse(organizationId, response, parseError));
1094
1089
  }
@@ -1127,9 +1122,12 @@ var refreshAccessToken = async ({
1127
1122
  body: tokenParams
1128
1123
  });
1129
1124
  const tokenData = await tokenResponse.json();
1130
- if (!tokenResponse.ok) {
1125
+ if (tokenResponse.status === 400 || tokenResponse.status === 401) {
1131
1126
  throw new TokenRefreshOAuthError;
1132
1127
  }
1128
+ if (!tokenResponse.ok) {
1129
+ throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
1130
+ }
1133
1131
  const newAccessToken = tokenData.access_token;
1134
1132
  const newRefreshToken = tokenData.refresh_token;
1135
1133
  if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
@@ -1142,11 +1140,11 @@ var refreshAccessToken = async ({
1142
1140
  };
1143
1141
 
1144
1142
  // ../auth/src/types.ts
1145
- var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
1143
+ var AUTH_FLOW_ENV_VAR2 = "UIPATH_AUTH_FLOW";
1146
1144
 
1147
1145
  // ../auth/src/utils/envFile.ts
1148
- var DEFAULT_AUTH_FILENAME = AUTH_FILENAME;
1149
- var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
1146
+ var DEFAULT_AUTH_FILENAME2 = AUTH_FILENAME;
1147
+ var DEFAULT_ENV_FILENAME2 = `${UIPATH_HOME_DIR2}/${AUTH_FILENAME}`;
1150
1148
  var KNOWN_ERROR_CODES = new Set([
1151
1149
  "EISDIR",
1152
1150
  "EACCES",
@@ -1190,23 +1188,23 @@ var probeAsync = async (fs, candidate) => {
1190
1188
  };
1191
1189
  }
1192
1190
  };
1193
- var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
1194
- const fs = getFileSystem();
1191
+ var resolveEnvFileLocationAsync2 = async (envFilePath = DEFAULT_ENV_FILENAME2, opts) => {
1192
+ const fs = getFileSystem2();
1195
1193
  if (fs.path.isAbsolute(envFilePath)) {
1196
- const probe2 = await probeAsync(fs, envFilePath);
1197
- return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
1194
+ const probe = await probeAsync(fs, envFilePath);
1195
+ return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
1198
1196
  exists: false,
1199
1197
  absolutePath: envFilePath,
1200
1198
  source: "absolute",
1201
- ...probe2.unusable ? { unusable: probe2.unusable } : {}
1199
+ ...probe.unusable ? { unusable: probe.unusable } : {}
1202
1200
  };
1203
1201
  }
1204
1202
  const cwd = opts?.cwd ?? fs.env.cwd();
1205
1203
  let searchDir = cwd;
1206
1204
  while (true) {
1207
1205
  const candidate = fs.path.join(searchDir, envFilePath);
1208
- const probe2 = await probeAsync(fs, candidate);
1209
- if (probe2.exists) {
1206
+ const probe = await probeAsync(fs, candidate);
1207
+ if (probe.exists) {
1210
1208
  return {
1211
1209
  exists: true,
1212
1210
  absolutePath: candidate,
@@ -1231,8 +1229,8 @@ var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opt
1231
1229
  ...probe.unusable ? { unusable: probe.unusable } : {}
1232
1230
  };
1233
1231
  };
1234
- var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
1235
- const location = await resolveEnvFileLocationAsync(envFilePath, opts);
1232
+ var resolveEnvFilePathAsync2 = async (envFilePath = DEFAULT_ENV_FILENAME2, opts) => {
1233
+ const location = await resolveEnvFileLocationAsync2(envFilePath, opts);
1236
1234
  if (location.exists) {
1237
1235
  return { absolutePath: location.absolutePath };
1238
1236
  }
@@ -1262,8 +1260,8 @@ var parseEnvContent = (content) => {
1262
1260
  }
1263
1261
  return env;
1264
1262
  };
1265
- var loadEnvFileAsync = async ({ envPath }) => {
1266
- const fs = getFileSystem();
1263
+ var loadEnvFileAsync2 = async ({ envPath }) => {
1264
+ const fs = getFileSystem2();
1267
1265
  const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
1268
1266
  if (!await fs.exists(absolutePath)) {
1269
1267
  throw new Error(`Environment file not found: ${envPath}`);
@@ -1274,17 +1272,17 @@ var loadEnvFileAsync = async ({ envPath }) => {
1274
1272
  }
1275
1273
  return parseEnvContent(content);
1276
1274
  };
1277
- var saveEnvFileAsync = async ({
1275
+ var saveEnvFileAsync2 = async ({
1278
1276
  envPath,
1279
1277
  data,
1280
1278
  merge = true
1281
1279
  }) => {
1282
- const fs = getFileSystem();
1280
+ const fs = getFileSystem2();
1283
1281
  const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
1284
1282
  let existingData = {};
1285
1283
  if (merge && await fs.exists(absolutePath)) {
1286
1284
  try {
1287
- existingData = await loadEnvFileAsync({ envPath: absolutePath });
1285
+ existingData = await loadEnvFileAsync2({ envPath: absolutePath });
1288
1286
  } catch {}
1289
1287
  }
1290
1288
  const finalData = { ...existingData, ...data };
@@ -1308,27 +1306,27 @@ var saveEnvFileAsync = async ({
1308
1306
  };
1309
1307
 
1310
1308
  // ../auth/src/loginStatus.ts
1311
- var CredentialSource;
1312
- ((CredentialSource2) => {
1313
- CredentialSource2["SavedLogin"] = "saved-login";
1314
- CredentialSource2["Robot"] = "robot";
1315
- CredentialSource2["EnvironmentVariables"] = "env-vars";
1316
- })(CredentialSource ||= {});
1309
+ var CredentialSource2;
1310
+ ((CredentialSource) => {
1311
+ CredentialSource["SavedLogin"] = "saved-login";
1312
+ CredentialSource["Robot"] = "robot";
1313
+ CredentialSource["EnvironmentVariables"] = "env-vars";
1314
+ })(CredentialSource2 ||= {});
1317
1315
  var defaultRobotTenantIdCache = new Map;
1318
1316
  var ROBOT_TENANT_LOOKUP_TIMEOUT_MS = 5000;
1319
- var getLoginStatusAsync = async (options = {}) => {
1317
+ var getLoginStatusAsync2 = async (options = {}) => {
1320
1318
  return getLoginStatusWithDeps(options);
1321
1319
  };
1322
1320
  var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
1323
1321
  const {
1324
- resolveEnvFilePath = resolveEnvFilePathAsync,
1325
- loadEnvFile = loadEnvFileAsync,
1326
- saveEnvFile = saveEnvFileAsync,
1327
- getFs = getFileSystem,
1322
+ resolveEnvFilePath = resolveEnvFilePathAsync2,
1323
+ loadEnvFile = loadEnvFileAsync2,
1324
+ saveEnvFile = saveEnvFileAsync2,
1325
+ getFs = getFileSystem2,
1328
1326
  refreshToken: refreshTokenFn = refreshAccessToken,
1329
1327
  resolveConfig = resolveConfigAsync,
1330
1328
  robotFallback = tryRobotClientFallback,
1331
- fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
1329
+ fetchTenantsAndOrgs = fetchTenantsAndOrganizations2,
1332
1330
  robotTenantIdCache = defaultRobotTenantIdCache,
1333
1331
  robotTenantLookupTimeoutMs = ROBOT_TENANT_LOOKUP_TIMEOUT_MS,
1334
1332
  loadBreaker = loadRefreshBreaker,
@@ -1343,13 +1341,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
1343
1341
  if (isRobotAuthEnforced()) {
1344
1342
  return resolveRobotEnforcedStatus(robotFallback, robotDeps);
1345
1343
  }
1346
- if (isEnvAuthEnabled()) {
1347
- return readAuthFromEnv();
1344
+ if (isEnvAuthEnabled2()) {
1345
+ return readAuthFromEnv2();
1348
1346
  }
1349
- const activeProfile = getActiveAuthProfile();
1350
- const activeProfileFilePath = getActiveAuthProfileFilePath();
1347
+ const activeProfile = getActiveAuthProfile2();
1348
+ const activeProfileFilePath = getActiveAuthProfileFilePath2();
1351
1349
  const usingActiveProfile = activeProfile !== undefined && (options.envFilePath === undefined || options.envFilePath === activeProfileFilePath);
1352
- const envFilePath = options.envFilePath ?? activeProfileFilePath ?? DEFAULT_ENV_FILENAME;
1350
+ const envFilePath = options.envFilePath ?? activeProfileFilePath ?? DEFAULT_ENV_FILENAME2;
1353
1351
  const { ensureTokenValidityMinutes } = options;
1354
1352
  const { absolutePath } = await resolveEnvFilePath(envFilePath);
1355
1353
  if (absolutePath === undefined) {
@@ -1402,8 +1400,8 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
1402
1400
  return buildFileStatus(tokens, credentials, globalHint);
1403
1401
  };
1404
1402
  async function resolveRobotEnforcedStatus(robotFallback, deps) {
1405
- if (isEnvAuthEnabled()) {
1406
- throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
1403
+ if (isEnvAuthEnabled2()) {
1404
+ throw new EnvAuthConfigError2(`${ENV_AUTH_ENABLE_VAR2}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
1407
1405
  }
1408
1406
  const robotCreds = await robotFallback({ force: true });
1409
1407
  if (!robotCreds) {
@@ -1544,7 +1542,7 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1544
1542
  return result;
1545
1543
  }
1546
1544
  function identityFields(accessToken, credentials) {
1547
- const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
1545
+ const identity = resolveSessionIdentity(accessToken, parseAuthFlow2(credentials[AUTH_FLOW_ENV_VAR2]));
1548
1546
  const scopes = readTokenScopes(accessToken);
1549
1547
  return {
1550
1548
  ...identity ? { identity } : {},
@@ -1580,7 +1578,7 @@ async function resolveRobotTenantId(robotCreds, deps) {
1580
1578
  const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
1581
1579
  let pending = deps.cache.get(key);
1582
1580
  if (!pending) {
1583
- pending = catchError(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
1581
+ pending = catchError2(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
1584
1582
  const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
1585
1583
  if (!settled.tenantId) {
1586
1584
  deps.cache.delete(key);
@@ -1593,7 +1591,7 @@ async function resolveRobotTenantId(robotCreds, deps) {
1593
1591
  }
1594
1592
  async function lookupRobotTenantId(target, deps) {
1595
1593
  const { baseUrl, accessToken, organization, tenantName } = target;
1596
- const [error, data] = await catchError(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
1594
+ const [error, data] = await catchError2(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
1597
1595
  if (error) {
1598
1596
  const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
1599
1597
  return { hint: tenantLookupFailureHint(tenantName, reason) };
@@ -1615,7 +1613,7 @@ function tenantLookupFailureHint(tenantName, reason) {
1615
1613
  return `Could not resolve the id of tenant '${tenantName}' from the ` + `Robot session: ${reason} Commands that need the tenant id will ` + `fail until it can be resolved.`;
1616
1614
  }
1617
1615
  function decodePathSegment(segment) {
1618
- const [error, decoded] = catchError(() => decodeURIComponent(segment));
1616
+ const [error, decoded] = catchError2(() => decodeURIComponent(segment));
1619
1617
  return error ? segment : decoded;
1620
1618
  }
1621
1619
  var isFileNotFoundError = (error) => {
@@ -1853,67 +1851,6 @@ function normalizeTokenRefreshUnavailableFailure() {
1853
1851
  function errorMessage(error) {
1854
1852
  return error instanceof Error ? error.message : String(error);
1855
1853
  }
1856
-
1857
- // ../auth/src/authContext.ts
1858
- var getAuthContext = async (options = {}) => {
1859
- const status = await getLoginStatusAsync({
1860
- ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
1861
- envFilePath: options.envFilePath
1862
- });
1863
- if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
1864
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
1865
- }
1866
- const tenantName = options.tenant ?? status.tenantName;
1867
- if (options.requireOrganizationId && !status.organizationId) {
1868
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
1869
- }
1870
- if (options.requireOrganizationName && !status.organizationName) {
1871
- throw new Error("Organization name not available. Ensure you are logged in with an organization context.");
1872
- }
1873
- if (options.requireTenantId && !status.tenantId) {
1874
- throw new Error("Tenant ID not available. Ensure UIPATH_TENANT_ID is set.");
1875
- }
1876
- if (options.requireTenantName && tenantName === undefined) {
1877
- 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.");
1878
- }
1879
- return {
1880
- baseUrl: status.baseUrl,
1881
- accessToken: status.accessToken,
1882
- organizationId: status.organizationId,
1883
- organizationName: status.organizationName,
1884
- tenantId: status.tenantId,
1885
- tenantName,
1886
- identity: status.identity
1887
- };
1888
- };
1889
- var getAuthEnv = async (options = {}) => {
1890
- const authEnv = {};
1891
- let status;
1892
- try {
1893
- status = await getLoginStatusAsync(options);
1894
- } catch {
1895
- return { authEnv };
1896
- }
1897
- if (status.loginStatus === "Logged in" && status.accessToken) {
1898
- authEnv.UIPATH_ACCESS_TOKEN = status.accessToken;
1899
- if (status.baseUrl) {
1900
- const org = status.organizationName || status.organizationId;
1901
- const tenant = status.tenantName || status.tenantId;
1902
- if (org && tenant) {
1903
- authEnv.UIPATH_URL = `${status.baseUrl.replace(/\/+$/, "")}/${org}/${tenant}`;
1904
- }
1905
- }
1906
- if (status.organizationId)
1907
- authEnv.UIPATH_ORGANIZATION_ID = status.organizationId;
1908
- if (status.organizationName)
1909
- authEnv.UIPATH_ORGANIZATION_NAME = status.organizationName;
1910
- if (status.tenantId)
1911
- authEnv.UIPATH_TENANT_ID = status.tenantId;
1912
- if (status.tenantName)
1913
- authEnv.UIPATH_TENANT_NAME = status.tenantName;
1914
- }
1915
- return { authEnv, loginStatus: status };
1916
- };
1917
1854
  // ../auth/src/authProfileDetails.ts
1918
1855
  var ORGANIZATION_NAME_KEY = "UIPATH_ORGANIZATION_NAME";
1919
1856
  var TENANT_NAME_KEY = "UIPATH_TENANT_NAME";
@@ -1941,8 +1878,8 @@ async function describeAuthProfileAsync(name, filePath, active) {
1941
1878
  if (!filePath) {
1942
1879
  return { ...base, status: "Not logged in" };
1943
1880
  }
1944
- const fs = getFileSystem();
1945
- const [readError, content] = await catchError(fs.readFile(filePath, "utf-8"));
1881
+ const fs = getFileSystem2();
1882
+ const [readError, content] = await catchError2(fs.readFile(filePath, "utf-8"));
1946
1883
  if (readError) {
1947
1884
  return { ...base, status: "Unreadable" };
1948
1885
  }
@@ -1958,13 +1895,13 @@ async function describeAuthProfileAsync(name, filePath, active) {
1958
1895
  ...statusFromToken(values[ACCESS_TOKEN_KEY])
1959
1896
  };
1960
1897
  }
1961
- async function describeAuthProfilesAsync() {
1962
- const activeProfile = getActiveAuthProfile();
1963
- const [defaultPathError, defaultLocation] = await catchError(resolveEnvFilePathAsync());
1898
+ async function describeAuthProfilesAsync2() {
1899
+ const activeProfile = getActiveAuthProfile2();
1900
+ const [defaultPathError, defaultLocation] = await catchError2(resolveEnvFilePathAsync2());
1964
1901
  const rows = [
1965
- await describeAuthProfileAsync(DEFAULT_AUTH_PROFILE, defaultPathError ? undefined : defaultLocation?.absolutePath, activeProfile === undefined)
1902
+ await describeAuthProfileAsync(DEFAULT_AUTH_PROFILE2, defaultPathError ? undefined : defaultLocation?.absolutePath, activeProfile === undefined)
1966
1903
  ];
1967
- for (const name of await listAuthProfileNamesAsync()) {
1904
+ for (const name of await listAuthProfileNamesAsync2()) {
1968
1905
  rows.push(await describeAuthProfileAsync(name, resolveAuthProfileFilePath(name), activeProfile === name));
1969
1906
  }
1970
1907
  return rows;
@@ -1983,7 +1920,7 @@ var requestClientCredentialsToken = async ({
1983
1920
  },
1984
1921
  body: new URLSearchParams(params)
1985
1922
  });
1986
- const [parseError, tokenData] = await catchError(tokenResponse.json());
1923
+ const [parseError, tokenData] = await catchError2(tokenResponse.json());
1987
1924
  if (!tokenResponse.ok) {
1988
1925
  const data = parseError ? {} : tokenData ?? {};
1989
1926
  throw buildError({
@@ -2046,7 +1983,7 @@ Troubleshooting:` + `
2046
1983
  ` + `Error: ${errorType}
2047
1984
  ` + `Details: ${errorDesc}${troubleshooting}`, status);
2048
1985
  };
2049
- var clientCredentialsLogin = async ({
1986
+ var clientCredentialsLogin2 = async ({
2050
1987
  clientId,
2051
1988
  clientSecret,
2052
1989
  scope,
@@ -2176,7 +2113,7 @@ var TENANT_SELECTION_CODES = new Set([
2176
2113
  TENANT_SELECTION_REQUIRED_CODE,
2177
2114
  INVALID_TENANT_CODE
2178
2115
  ]);
2179
- function isTenantSelectionError(error) {
2116
+ function isTenantSelectionError2(error) {
2180
2117
  if (!(error instanceof Object) || !("code" in error)) {
2181
2118
  return false;
2182
2119
  }
@@ -2185,7 +2122,7 @@ function isTenantSelectionError(error) {
2185
2122
  }
2186
2123
  var selectTenantWithDeps = async (baseUrl, accessToken, organizationId, targetTenantName, interactive, deps = {}) => {
2187
2124
  const {
2188
- fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
2125
+ fetchTenantsAndOrgs = fetchTenantsAndOrganizations2,
2189
2126
  selectFromList
2190
2127
  } = deps;
2191
2128
  const data = await fetchTenantsAndOrgs(baseUrl, accessToken, organizationId);
@@ -2218,15 +2155,15 @@ var selectTenantWithDeps = async (baseUrl, accessToken, organizationId, targetTe
2218
2155
  var interactiveLoginWithDeps = async (options, deps) => {
2219
2156
  const {
2220
2157
  resolveConfig = resolveConfigAsync,
2221
- clientCredentials = clientCredentialsLogin,
2158
+ clientCredentials = clientCredentialsLogin2,
2222
2159
  federatedCredentials = federatedCredentialsLogin,
2223
- auth = authenticate,
2224
- saveEnvFile = saveEnvFileAsync,
2225
- loadEnvFile = loadEnvFileAsync,
2226
- getFs = getFileSystem,
2227
- jwtParser = parseJWT,
2160
+ auth = authenticate2,
2161
+ saveEnvFile = saveEnvFileAsync2,
2162
+ loadEnvFile = loadEnvFileAsync2,
2163
+ getFs = getFileSystem2,
2164
+ jwtParser = parseJWT2,
2228
2165
  issuerAsserter = assertIssuerMatchesAuthority,
2229
- tenantSelector = (baseUrl, accessToken, organizationId, tenantName, interactive2) => selectTenantWithDeps(baseUrl, accessToken, organizationId, tenantName, interactive2, { selectFromList: options.selectFromList })
2166
+ tenantSelector = (baseUrl, accessToken, organizationId, tenantName, interactive) => selectTenantWithDeps(baseUrl, accessToken, organizationId, tenantName, interactive, { selectFromList: options.selectFromList })
2230
2167
  } = deps;
2231
2168
  const {
2232
2169
  envFilePath,
@@ -2303,7 +2240,7 @@ var interactiveLoginWithDeps = async (options, deps) => {
2303
2240
  UIPATH_REFRESH_TOKEN: authTokens.refreshToken
2304
2241
  };
2305
2242
  })();
2306
- const [authError, tokens] = await catchError(authPromise);
2243
+ const [authError, tokens] = await catchError2(authPromise);
2307
2244
  if (authError) {
2308
2245
  throw authError;
2309
2246
  }
@@ -2311,7 +2248,7 @@ var interactiveLoginWithDeps = async (options, deps) => {
2311
2248
  const credentials = {
2312
2249
  ...tokens,
2313
2250
  UIPATH_URL: config.baseUrl,
2314
- [AUTH_FLOW_ENV_VAR]: authFlow
2251
+ [AUTH_FLOW_ENV_VAR2]: authFlow
2315
2252
  };
2316
2253
  if (authFlow !== "authorization_code") {
2317
2254
  credentials.UIPATH_REFRESH_TOKEN = undefined;
@@ -2331,7 +2268,7 @@ var interactiveLoginWithDeps = async (options, deps) => {
2331
2268
  credentials.UIPATH_TENANT_NAME = tenantName;
2332
2269
  credentials.UIPATH_TENANT_ID = tenantId;
2333
2270
  } catch (error) {
2334
- if (!isTenantSelectionError(error)) {
2271
+ if (!isTenantSelectionError2(error)) {
2335
2272
  emit({
2336
2273
  type: "tenant-fetch-failed",
2337
2274
  message: error instanceof Error ? error.message : String(error)
@@ -2340,7 +2277,7 @@ var interactiveLoginWithDeps = async (options, deps) => {
2340
2277
  throw error;
2341
2278
  }
2342
2279
  const fs = getFs();
2343
- const requestedPath = envFilePath ?? DEFAULT_ENV_FILENAME;
2280
+ const requestedPath = envFilePath ?? DEFAULT_ENV_FILENAME2;
2344
2281
  let savePath = requestedPath;
2345
2282
  let savedLocally = false;
2346
2283
  if (!fs.path.isAbsolute(savePath)) {
@@ -2366,8 +2303,12 @@ var interactiveLoginWithDeps = async (options, deps) => {
2366
2303
  searchDir = parentDir;
2367
2304
  }
2368
2305
  }
2306
+ if (!fs.path.isAbsolute(savePath)) {
2307
+ savePath = fs.path.join(fs.env.homedir(), savePath);
2308
+ }
2369
2309
  let saveRelease;
2370
2310
  try {
2311
+ await fs.mkdir(fs.path.dirname(savePath));
2371
2312
  if (typeof fs.acquireLock === "function") {
2372
2313
  saveRelease = await fs.acquireLock(savePath);
2373
2314
  }
@@ -2385,24 +2326,23 @@ var interactiveLoginWithDeps = async (options, deps) => {
2385
2326
  await saveRelease().catch(() => {});
2386
2327
  }
2387
2328
  }
2388
- const reportedPath = fs.path.isAbsolute(savePath) ? savePath : fs.path.join(fs.env.homedir(), savePath);
2389
2329
  emit({
2390
2330
  type: "saved",
2391
- path: reportedPath,
2331
+ path: savePath,
2392
2332
  locality: savedLocally ? "local" : "global"
2393
2333
  });
2394
2334
  return credentials;
2395
2335
  };
2396
- var interactiveLogin = async (options) => {
2336
+ var interactiveLogin2 = async (options) => {
2397
2337
  return interactiveLoginWithDeps(options, {});
2398
2338
  };
2399
2339
  // ../auth/src/logout.ts
2400
2340
  async function logoutWithDeps(options, deps = {}) {
2401
2341
  const {
2402
- resolveEnvFilePath = resolveEnvFilePathAsync,
2403
- getFileSystem: getFs = getFileSystem,
2342
+ resolveEnvFilePath = resolveEnvFilePathAsync2,
2343
+ getFileSystem: getFs = getFileSystem2,
2404
2344
  clearBreaker = clearRefreshBreaker,
2405
- getActiveProfileFilePath = getActiveAuthProfileFilePath
2345
+ getActiveProfileFilePath = getActiveAuthProfileFilePath2
2406
2346
  } = deps;
2407
2347
  const fs = getFs();
2408
2348
  const { absolutePath } = await resolveEnvFilePath(options.file ?? getActiveProfileFilePath());
@@ -2435,12 +2375,12 @@ async function logoutWithDeps(options, deps = {}) {
2435
2375
  reason: "no_credentials_file"
2436
2376
  };
2437
2377
  }
2438
- async function logout(options) {
2378
+ async function logout2(options) {
2439
2379
  return logoutWithDeps(options);
2440
2380
  }
2441
2381
 
2442
2382
  // ../auth/src/index.ts
2443
- var authenticate = async ({
2383
+ var authenticate2 = async ({
2444
2384
  baseUrl,
2445
2385
  clientId,
2446
2386
  clientSecret,
@@ -2470,7 +2410,7 @@ var authenticate = async ({
2470
2410
  let effectiveRedirectUri;
2471
2411
  if (redirectUri) {
2472
2412
  effectiveRedirectUri = redirectUri.toString();
2473
- } else if (isBrowser()) {
2413
+ } else if (isBrowser2()) {
2474
2414
  const origin = getGlobalThis()?.window?.location?.origin ?? "";
2475
2415
  effectiveRedirectUri = `${origin}/oidc/login`;
2476
2416
  } else {
@@ -2494,11 +2434,11 @@ var authenticate = async ({
2494
2434
  }
2495
2435
  const authUrl = `${authorizationEndpoint}?${authParams.toString()}`;
2496
2436
  let strategy;
2497
- if (isBrowser()) {
2498
- const { BrowserAuthStrategy } = await import("./browser-strategy-6atc7v8s.js");
2437
+ if (isBrowser2()) {
2438
+ const { BrowserAuthStrategy } = await import("./browser-strategy-p5fhwxqj.js");
2499
2439
  strategy = new BrowserAuthStrategy;
2500
2440
  } else {
2501
- const { NodeAuthStrategy } = await import("./node-strategy-ggx3nmyj.js");
2441
+ const { NodeAuthStrategy } = await import("./node-strategy-p1n8wr5s.js");
2502
2442
  strategy = new NodeAuthStrategy;
2503
2443
  }
2504
2444
  const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, {
@@ -2518,6 +2458,6 @@ var authenticate = async ({
2518
2458
  });
2519
2459
  };
2520
2460
 
2521
- export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, getAuthProfilesRootPath, resolveAuthProfileDirPath, listAuthProfileNamesAsync, authProfileExistsAsync, deleteAuthProfileAsync, parseJWT, parseAuthFlow, resolveSessionIdentity, readTokenScopes, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, fetchTenantsAndOrganizations, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, AUTH_FLOW_ENV_VAR, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, CredentialSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, describeAuthProfilesAsync, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2461
+ export { setAuthFileConfig2, DEFAULT_AUTH_PROFILE2, INHERITED_AUTH_PROFILE_ENV2, AuthProfileValidationError2, normalizeAuthProfileName2, setActiveAuthProfile2, getActiveAuthProfile2, runWithAuthProfile2, getActiveAuthProfileFilePath2, listAuthProfileNamesAsync2, authProfileExistsAsync2, deleteAuthProfileAsync2, parseJWT2, parseAuthFlow2, ENV_AUTH_ENABLE_VAR2, ENV_AUTH_VARS2, EnvAuthConfigError2, isEnvAuthEnabled2, readAuthFromEnv2, registerRobotClientLoader2, fetchTenantsAndOrganizations2, AUTH_FLOW_ENV_VAR2, DEFAULT_AUTH_FILENAME2, DEFAULT_ENV_FILENAME2, resolveEnvFileLocationAsync2, resolveEnvFilePathAsync2, loadEnvFileAsync2, saveEnvFileAsync2, CredentialSource2, getLoginStatusAsync2, describeAuthProfilesAsync2, clientCredentialsLogin2, isTenantSelectionError2, interactiveLogin2, logout2, authenticate2 };
2522
2462
 
2523
- //# debugId=40192C240CF134F264756E2164756E21
2463
+ //# debugId=AACB48AAE1655F8C64756E2164756E21