@uipath/auth 1.202.1-preview.220 → 1.202.1-preview.239

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.
@@ -4,7 +4,7 @@ export * from "./clientCredentials";
4
4
  export { type AuthFileConfig, InvalidBaseUrlError, setAuthFileConfig, } from "./config";
5
5
  export * from "./loginStatus";
6
6
  export * from "./logout";
7
- export { type IdentityType, parseAuthFlow, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity";
7
+ export { type IdentityType, parseAuthFlow, readTokenScopes, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity";
8
8
  export { fetchTenantsAndOrganizations, type Tenant, type TenantsAndOrganizations, } from "./tenantSelection";
9
9
  export * from "./tokenRefresh";
10
10
  export { AUTH_FLOW_ENV_VAR, type AuthFlow, type BaseCredentials, } from "./types";
@@ -18518,6 +18518,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
18518
18518
  identity.clientId = clientId;
18519
18519
  return identity;
18520
18520
  };
18521
+ var pickScopes = (claims) => {
18522
+ const raw = claims?.scope;
18523
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
18524
+ return scopes.length > 0 ? scopes : undefined;
18525
+ };
18526
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
18521
18527
 
18522
18528
  // src/envAuth.ts
18523
18529
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -19765,6 +19771,7 @@ export {
19765
19771
  normalizeAuthProfileName,
19766
19772
  parseAuthFlow,
19767
19773
  parseJWT,
19774
+ readTokenScopes,
19768
19775
  refreshAccessToken,
19769
19776
  resolveAuthProfileFilePath,
19770
19777
  resolveEnvFileLocationAsync,
@@ -19776,4 +19783,4 @@ export {
19776
19783
  setAuthFileConfig
19777
19784
  };
19778
19785
 
19779
- //# debugId=2C66658C2F43E99364756E2164756E21
19786
+ //# debugId=F64954E7CFABA2DF64756E2164756E21
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export * from "./logout";
11
11
  export { clearRefreshBreaker, loadRefreshBreaker, type RefreshBreakerState, refreshTokenFingerprint, saveRefreshBreaker, } from "./refreshCircuitBreaker";
12
12
  export { type RobotClientModuleLoader, registerRobotClientLoader, } from "./robotClientFallback";
13
13
  export { INVALID_TENANT_CODE, InvalidTenantError, isTenantSelectionError, type SelectFromList, selectTenantWithDeps, TENANT_SELECTION_REQUIRED_CODE, TenantSelectionError, TenantSelectionRequiredError, } from "./selectTenant";
14
- export { type IdentityType, parseAuthFlow, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity";
14
+ export { type IdentityType, parseAuthFlow, readTokenScopes, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity";
15
15
  export { fetchTenantsAndOrganizations, type Tenant, type TenantsAndOrganizations, } from "./tenantSelection";
16
16
  export * from "./tokenRefresh";
17
17
  export { AUTH_FLOW_ENV_VAR, type AuthFlow, type BaseCredentials, } from "./types";
package/dist/index.js CHANGED
@@ -2181,6 +2181,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
2181
2181
  identity.clientId = clientId;
2182
2182
  return identity;
2183
2183
  };
2184
+ var pickScopes = (claims) => {
2185
+ const raw = claims?.scope;
2186
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
2187
+ return scopes.length > 0 ? scopes : undefined;
2188
+ };
2189
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
2184
2190
 
2185
2191
  // src/envAuth.ts
2186
2192
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -3868,6 +3874,7 @@ export {
3868
3874
  parseAuthFlow,
3869
3875
  parseJWT,
3870
3876
  readAuthFromEnv,
3877
+ readTokenScopes,
3871
3878
  refreshAccessToken,
3872
3879
  refreshTokenFingerprint,
3873
3880
  registerRobotClientLoader,
@@ -3883,4 +3890,4 @@ export {
3883
3890
  setAuthFileConfig
3884
3891
  };
3885
3892
 
3886
- //# debugId=8ECD0F0A4A5E19F264756E2164756E21
3893
+ //# debugId=1E63E8BE4956323C64756E2164756E21
@@ -33,3 +33,15 @@ export declare const parseAuthFlow: (value: string | undefined) => AuthFlow | un
33
33
  * omit the fields than to guess at who is acting.
34
34
  */
35
35
  export declare const resolveSessionIdentity: (accessToken: string | undefined, authFlow?: AuthFlow) => SessionIdentity | undefined;
36
+ /**
37
+ * Scopes carried by an access token, in the order Identity returned them.
38
+ *
39
+ * Deliberately independent of {@link resolveSessionIdentity}: a token can
40
+ * carry a `scope` claim while saying too little to name who is acting — no
41
+ * `sub_type`, no user claims, no known flow — and those are exactly the
42
+ * sessions that are hardest to diagnose.
43
+ *
44
+ * Read from an *unverified* claim (base64 decode, no signature check), for
45
+ * display only. Never branch on it for an authorization decision.
46
+ */
47
+ export declare const readTokenScopes: (accessToken: string | undefined) => string[] | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/auth",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.1-preview.220",
4
+ "version": "1.202.1-preview.239",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/UiPath/cli.git",
@@ -37,5 +37,5 @@
37
37
  "mihaigirleanu",
38
38
  "vlad-uipath"
39
39
  ],
40
- "gitHead": "a09041733b628c3f6b658a1f58349ea0f40bb492"
40
+ "gitHead": "97545a7857bdff7e6db62bbe13c6097607cf38f1"
41
41
  }