@uipath/function-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.
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  getGlobalThis,
3
- isBrowser,
4
- isNode
3
+ isBrowser
5
4
  } from "./packager-tool-0gctz400.js";
6
5
  import {
7
6
  catchError
@@ -10,11 +9,7 @@ import {
10
9
  getFileSystem
11
10
  } from "./packager-tool-g0hcxnae.js";
12
11
  import {
13
- AUTH_CANCELLED_ERROR_CODE,
14
12
  AUTH_FILENAME,
15
- AUTH_RECLAIMED_ERROR_CODE,
16
- AUTH_TIMEOUT_ERROR_CODE,
17
- DEFAULT_AUTH_TIMEOUT_MS,
18
13
  DEFAULT_BASE_URL,
19
14
  DEFAULT_REDIRECT_URI,
20
15
  UIPATH_HOME_DIR
@@ -737,6 +732,11 @@ var pickName = (claims) => {
737
732
  const username = asString(claims?.preferred_username);
738
733
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
739
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
+ };
740
740
  var resolveSessionIdentity = (accessToken, authFlow) => {
741
741
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
742
742
  const email = pickEmail(claims);
@@ -762,6 +762,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
762
762
  identity.clientId = clientId;
763
763
  return identity;
764
764
  };
765
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
765
766
 
766
767
  // ../auth/src/envAuth.ts
767
768
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -834,6 +835,7 @@ var readAuthFromEnv = () => {
834
835
  const expiration = getTokenExpiration(accessToken);
835
836
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
836
837
  const identity = resolveSessionIdentity(accessToken);
838
+ const scopes = readTokenScopes(accessToken);
837
839
  return {
838
840
  loginStatus,
839
841
  accessToken,
@@ -844,7 +846,8 @@ var readAuthFromEnv = () => {
844
846
  tenantId,
845
847
  expiration,
846
848
  source: "env-vars" /* EnvironmentVariables */,
847
- ...identity ? { identity } : {}
849
+ ...identity ? { identity } : {},
850
+ ...scopes ? { scopes } : {}
848
851
  };
849
852
  };
850
853
 
@@ -1492,10 +1495,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1492
1495
  }
1493
1496
  function identityFields(accessToken, credentials) {
1494
1497
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
1495
- return identity ? { identity } : {};
1498
+ const scopes = readTokenScopes(accessToken);
1499
+ return {
1500
+ ...identity ? { identity } : {},
1501
+ ...scopes ? { scopes } : {}
1502
+ };
1496
1503
  }
1497
1504
  function buildRobotStatus(robotCreds) {
1498
1505
  const identity = resolveSessionIdentity(robotCreds.accessToken);
1506
+ const scopes = readTokenScopes(robotCreds.accessToken);
1499
1507
  return {
1500
1508
  loginStatus: "Logged in",
1501
1509
  accessToken: robotCreds.accessToken,
@@ -1507,7 +1515,8 @@ function buildRobotStatus(robotCreds) {
1507
1515
  issuer: robotCreds.issuer,
1508
1516
  expiration: getTokenExpiration(robotCreds.accessToken),
1509
1517
  source: "robot" /* Robot */,
1510
- ...identity ? { identity } : {}
1518
+ ...identity ? { identity } : {},
1519
+ ...scopes ? { scopes } : {}
1511
1520
  };
1512
1521
  }
1513
1522
  var isFileNotFoundError = (error) => {
@@ -1774,7 +1783,8 @@ var getAuthContext = async (options = {}) => {
1774
1783
  organizationId: status.organizationId,
1775
1784
  organizationName: status.organizationName,
1776
1785
  tenantId: status.tenantId,
1777
- tenantName
1786
+ tenantName,
1787
+ identity: status.identity
1778
1788
  };
1779
1789
  };
1780
1790
  var getAuthEnv = async (options = {}) => {
@@ -2441,78 +2451,7 @@ var authenticate = async ({
2441
2451
  tokenEndpoint
2442
2452
  });
2443
2453
  };
2444
- export {
2445
- AUTH_CANCELLED_ERROR_CODE,
2446
- AUTH_FLOW_ENV_VAR,
2447
- AUTH_RECLAIMED_ERROR_CODE,
2448
- AUTH_TIMEOUT_ERROR_CODE,
2449
- AuthProfileValidationError,
2450
- ClientCredentialsAuthenticationError,
2451
- CredentialSource,
2452
- DEFAULT_AUTH_FILENAME,
2453
- DEFAULT_AUTH_PROFILE,
2454
- DEFAULT_AUTH_TIMEOUT_MS,
2455
- DEFAULT_ENV_FILENAME,
2456
- ENFORCE_ROBOT_AUTH_VAR,
2457
- ENV_AUTH_ENABLE_VAR,
2458
- ENV_AUTH_VARS,
2459
- EnvAuthConfigError,
2460
- FederatedCredentialsAuthenticationError,
2461
- INVALID_TENANT_CODE,
2462
- InvalidBaseUrlError,
2463
- InvalidTenantError,
2464
- JWT_BEARER_ASSERTION_TYPE,
2465
- TENANT_SELECTION_REQUIRED_CODE,
2466
- TenantSelectionError,
2467
- TenantSelectionRequiredError,
2468
- TokenRefreshOAuthError,
2469
- authProfileExistsAsync,
2470
- authenticate,
2471
- clearActiveAuthProfile,
2472
- clearRefreshBreaker,
2473
- clientCredentialsLogin,
2474
- deleteAuthProfileAsync,
2475
- describeAuthProfilesAsync,
2476
- federatedCredentialsLogin,
2477
- fetchTenantsAndOrganizations,
2478
- getActiveAuthProfile,
2479
- getActiveAuthProfileFilePath,
2480
- getAuthContext,
2481
- getAuthEnv,
2482
- getAuthProfilesRootPath,
2483
- getLoginStatusAsync,
2484
- getLoginStatusWithDeps,
2485
- interactiveLogin,
2486
- interactiveLoginWithDeps,
2487
- isBrowser,
2488
- isEnvAuthEnabled,
2489
- isNode,
2490
- isRobotAuthEnforced,
2491
- isTenantSelectionError,
2492
- isTokenRefreshOAuthFailure,
2493
- listAuthProfileNamesAsync,
2494
- loadEnvFileAsync,
2495
- loadRefreshBreaker,
2496
- logout,
2497
- logoutWithDeps,
2498
- normalizeAuthProfileName,
2499
- parseAuthFlow,
2500
- parseJWT,
2501
- readAuthFromEnv,
2502
- refreshAccessToken,
2503
- refreshTokenFingerprint,
2504
- registerRobotClientLoader,
2505
- resolveAuthProfileDirPath,
2506
- resolveAuthProfileFilePath,
2507
- resolveEnvFileLocationAsync,
2508
- resolveEnvFilePathAsync,
2509
- resolveSessionIdentity,
2510
- runWithAuthProfile,
2511
- saveEnvFileAsync,
2512
- saveRefreshBreaker,
2513
- selectTenantWithDeps,
2514
- setActiveAuthProfile,
2515
- setAuthFileConfig
2516
- };
2517
2454
 
2518
- //# debugId=7A3E8DCE180A960B64756E2164756E21
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 };
2456
+
2457
+ //# debugId=C2A7396F2D34604964756E2164756E21