@uipath/codedapp-tool 1.203.0-preview.212 → 1.204.0-preview.211

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.
@@ -0,0 +1,31 @@
1
+ // ../auth/src/catch-error.ts
2
+ function isPromiseLike(value) {
3
+ return value !== null && typeof value === "object" && typeof value.then === "function";
4
+ }
5
+ function catchError(fnOrPromise) {
6
+ if (isPromiseLike(fnOrPromise)) {
7
+ return settlePromiseLike(fnOrPromise);
8
+ }
9
+ try {
10
+ const result = fnOrPromise();
11
+ if (isPromiseLike(result)) {
12
+ return settlePromiseLike(result);
13
+ }
14
+ return [undefined, result];
15
+ } catch (error) {
16
+ return [
17
+ error instanceof Error ? error : new Error(String(error)),
18
+ undefined
19
+ ];
20
+ }
21
+ }
22
+ function settlePromiseLike(thenable) {
23
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
24
+ error instanceof Error ? error : new Error(String(error)),
25
+ undefined
26
+ ]);
27
+ }
28
+
29
+ export { catchError };
30
+
31
+ //# debugId=CD090F76722F72E364756E2164756E21
@@ -3,15 +3,17 @@ import {
3
3
  isBrowser
4
4
  } from "./packager-tool-0gctz400.js";
5
5
  import {
6
- catchError,
7
- getFileSystem
8
- } from "./packager-tool-qyctya2j.js";
6
+ catchError
7
+ } from "./packager-tool-qa9gftnj.js";
9
8
  import {
10
9
  AUTH_FILENAME,
11
10
  DEFAULT_BASE_URL,
12
11
  DEFAULT_REDIRECT_URI,
13
12
  UIPATH_HOME_DIR
14
13
  } from "./packager-tool-yc4kw997.js";
14
+ import {
15
+ getFileSystem
16
+ } from "./packager-tool-0v3s8r01.js";
15
17
  import {
16
18
  __require
17
19
  } from "./packager-tool-1yh8g550.js";
@@ -730,6 +732,11 @@ var pickName = (claims) => {
730
732
  const username = asString(claims?.preferred_username);
731
733
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
732
734
  };
735
+ var pickScopes = (claims) => {
736
+ const raw = claims?.scope;
737
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
738
+ return scopes.length > 0 ? scopes : undefined;
739
+ };
733
740
  var resolveSessionIdentity = (accessToken, authFlow) => {
734
741
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
735
742
  const email = pickEmail(claims);
@@ -755,6 +762,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
755
762
  identity.clientId = clientId;
756
763
  return identity;
757
764
  };
765
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
758
766
 
759
767
  // ../auth/src/envAuth.ts
760
768
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -827,6 +835,7 @@ var readAuthFromEnv = () => {
827
835
  const expiration = getTokenExpiration(accessToken);
828
836
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
829
837
  const identity = resolveSessionIdentity(accessToken);
838
+ const scopes = readTokenScopes(accessToken);
830
839
  return {
831
840
  loginStatus,
832
841
  accessToken,
@@ -837,7 +846,8 @@ var readAuthFromEnv = () => {
837
846
  tenantId,
838
847
  expiration,
839
848
  source: "env-vars" /* EnvironmentVariables */,
840
- ...identity ? { identity } : {}
849
+ ...identity ? { identity } : {},
850
+ ...scopes ? { scopes } : {}
841
851
  };
842
852
  };
843
853
 
@@ -1485,10 +1495,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1485
1495
  }
1486
1496
  function identityFields(accessToken, credentials) {
1487
1497
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
1488
- return identity ? { identity } : {};
1498
+ const scopes = readTokenScopes(accessToken);
1499
+ return {
1500
+ ...identity ? { identity } : {},
1501
+ ...scopes ? { scopes } : {}
1502
+ };
1489
1503
  }
1490
1504
  function buildRobotStatus(robotCreds) {
1491
1505
  const identity = resolveSessionIdentity(robotCreds.accessToken);
1506
+ const scopes = readTokenScopes(robotCreds.accessToken);
1492
1507
  return {
1493
1508
  loginStatus: "Logged in",
1494
1509
  accessToken: robotCreds.accessToken,
@@ -1500,7 +1515,8 @@ function buildRobotStatus(robotCreds) {
1500
1515
  issuer: robotCreds.issuer,
1501
1516
  expiration: getTokenExpiration(robotCreds.accessToken),
1502
1517
  source: "robot" /* Robot */,
1503
- ...identity ? { identity } : {}
1518
+ ...identity ? { identity } : {},
1519
+ ...scopes ? { scopes } : {}
1504
1520
  };
1505
1521
  }
1506
1522
  var isFileNotFoundError = (error) => {
@@ -1767,7 +1783,8 @@ var getAuthContext = async (options = {}) => {
1767
1783
  organizationId: status.organizationId,
1768
1784
  organizationName: status.organizationName,
1769
1785
  tenantId: status.tenantId,
1770
- tenantName
1786
+ tenantName,
1787
+ identity: status.identity
1771
1788
  };
1772
1789
  };
1773
1790
  var getAuthEnv = async (options = {}) => {
@@ -2415,7 +2432,7 @@ var authenticate = async ({
2415
2432
  const { BrowserAuthStrategy } = await import("./browser-strategy-6atc7v8s.js");
2416
2433
  strategy = new BrowserAuthStrategy;
2417
2434
  } else {
2418
- const { NodeAuthStrategy } = await import("./node-strategy-bpshtz02.js");
2435
+ const { NodeAuthStrategy } = await import("./node-strategy-gc4sg6a2.js");
2419
2436
  strategy = new NodeAuthStrategy;
2420
2437
  }
2421
2438
  const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, {
@@ -2435,6 +2452,6 @@ var authenticate = async ({
2435
2452
  });
2436
2453
  };
2437
2454
 
2438
- export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, getAuthProfilesRootPath, resolveAuthProfileDirPath, listAuthProfileNamesAsync, authProfileExistsAsync, deleteAuthProfileAsync, parseJWT, parseAuthFlow, resolveSessionIdentity, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, 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, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2455
+ 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, 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, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2439
2456
 
2440
- //# debugId=E7AC7F320178FAB464756E2164756E21
2457
+ //# debugId=13BF51602EF4AFD864756E2164756E21