@uipath/auth 1.203.0-preview.233 → 1.203.0-preview.237

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";
@@ -18575,6 +18575,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
18575
18575
  identity.clientId = clientId;
18576
18576
  return identity;
18577
18577
  };
18578
+ var pickScopes = (claims) => {
18579
+ const raw = claims?.scope;
18580
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
18581
+ return scopes.length > 0 ? scopes : undefined;
18582
+ };
18583
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
18578
18584
 
18579
18585
  // src/envAuth.ts
18580
18586
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -19829,6 +19835,7 @@ export {
19829
19835
  normalizeAuthProfileName,
19830
19836
  parseAuthFlow,
19831
19837
  parseJWT,
19838
+ readTokenScopes,
19832
19839
  refreshAccessToken,
19833
19840
  resolveAuthProfileDirPath,
19834
19841
  resolveAuthProfileFilePath,
@@ -19841,4 +19848,4 @@ export {
19841
19848
  setAuthFileConfig
19842
19849
  };
19843
19850
 
19844
- //# debugId=BA72FB3851B49E2164756E2164756E21
19851
+ //# debugId=EFFF7E2FDCC23FB564756E2164756E21
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export * from "./logout";
12
12
  export { clearRefreshBreaker, loadRefreshBreaker, type RefreshBreakerState, refreshTokenFingerprint, saveRefreshBreaker, } from "./refreshCircuitBreaker";
13
13
  export { type RobotClientModuleLoader, registerRobotClientLoader, } from "./robotClientFallback";
14
14
  export { INVALID_TENANT_CODE, InvalidTenantError, isTenantSelectionError, type SelectFromList, selectTenantWithDeps, TENANT_SELECTION_REQUIRED_CODE, TenantSelectionError, TenantSelectionRequiredError, } from "./selectTenant";
15
- export { type IdentityType, parseAuthFlow, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity";
15
+ export { type IdentityType, parseAuthFlow, readTokenScopes, resolveSessionIdentity, type SessionIdentity, } from "./sessionIdentity";
16
16
  export { fetchTenantsAndOrganizations, type Tenant, type TenantsAndOrganizations, } from "./tenantSelection";
17
17
  export * from "./tokenRefresh";
18
18
  export { AUTH_FLOW_ENV_VAR, type AuthFlow, type BaseCredentials, } from "./types";
package/dist/index.js CHANGED
@@ -2238,6 +2238,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
2238
2238
  identity.clientId = clientId;
2239
2239
  return identity;
2240
2240
  };
2241
+ var pickScopes = (claims) => {
2242
+ const raw = claims?.scope;
2243
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
2244
+ return scopes.length > 0 ? scopes : undefined;
2245
+ };
2246
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
2241
2247
 
2242
2248
  // src/envAuth.ts
2243
2249
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -3989,6 +3995,7 @@ export {
3989
3995
  parseAuthFlow,
3990
3996
  parseJWT,
3991
3997
  readAuthFromEnv,
3998
+ readTokenScopes,
3992
3999
  refreshAccessToken,
3993
4000
  refreshTokenFingerprint,
3994
4001
  registerRobotClientLoader,
@@ -4005,4 +4012,4 @@ export {
4005
4012
  setAuthFileConfig
4006
4013
  };
4007
4014
 
4008
- //# debugId=07EEA08E9106212A64756E2164756E21
4015
+ //# debugId=BAFB53C69B0A805564756E2164756E21
@@ -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
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/auth",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.233",
5
+ "version": "1.203.0-preview.237",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/UiPath/cli.git",
@@ -38,5 +38,5 @@
38
38
  "mihaigirleanu",
39
39
  "vlad-uipath"
40
40
  ],
41
- "gitHead": "641614a6f9817662baaf51dabdebbfa2a9334b1b"
41
+ "gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
42
42
  }