@forgerock/oidc-client 0.0.0-beta-20251003204059 → 0.0.0-beta-20251124184351

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 (75) hide show
  1. package/README.md +8 -7
  2. package/package.json +8 -12
  3. package/dist/src/index.d.ts +0 -2
  4. package/dist/src/index.d.ts.map +0 -1
  5. package/dist/src/index.js +0 -8
  6. package/dist/src/index.js.map +0 -1
  7. package/dist/src/lib/authorize.request.d.ts +0 -17
  8. package/dist/src/lib/authorize.request.d.ts.map +0 -1
  9. package/dist/src/lib/authorize.request.js +0 -124
  10. package/dist/src/lib/authorize.request.js.map +0 -1
  11. package/dist/src/lib/authorize.request.types.d.ts +0 -47
  12. package/dist/src/lib/authorize.request.types.d.ts.map +0 -1
  13. package/dist/src/lib/authorize.request.types.js +0 -2
  14. package/dist/src/lib/authorize.request.types.js.map +0 -1
  15. package/dist/src/lib/authorize.request.utils.d.ts +0 -40
  16. package/dist/src/lib/authorize.request.utils.d.ts.map +0 -1
  17. package/dist/src/lib/authorize.request.utils.js +0 -104
  18. package/dist/src/lib/authorize.request.utils.js.map +0 -1
  19. package/dist/src/lib/authorize.slice.d.ts +0 -5
  20. package/dist/src/lib/authorize.slice.d.ts.map +0 -1
  21. package/dist/src/lib/authorize.slice.js +0 -21
  22. package/dist/src/lib/authorize.slice.js.map +0 -1
  23. package/dist/src/lib/client.store.d.ts +0 -115
  24. package/dist/src/lib/client.store.d.ts.map +0 -1
  25. package/dist/src/lib/client.store.js +0 -433
  26. package/dist/src/lib/client.store.js.map +0 -1
  27. package/dist/src/lib/client.store.utils.d.ts +0 -108
  28. package/dist/src/lib/client.store.utils.d.ts.map +0 -1
  29. package/dist/src/lib/client.store.utils.js +0 -92
  30. package/dist/src/lib/client.store.utils.js.map +0 -1
  31. package/dist/src/lib/client.types.d.ts +0 -31
  32. package/dist/src/lib/client.types.d.ts.map +0 -1
  33. package/dist/src/lib/client.types.js +0 -2
  34. package/dist/src/lib/client.types.js.map +0 -1
  35. package/dist/src/lib/config.types.d.ts +0 -22
  36. package/dist/src/lib/config.types.d.ts.map +0 -1
  37. package/dist/src/lib/config.types.js +0 -2
  38. package/dist/src/lib/config.types.js.map +0 -1
  39. package/dist/src/lib/exchange.request.d.ts +0 -18
  40. package/dist/src/lib/exchange.request.d.ts.map +0 -1
  41. package/dist/src/lib/exchange.request.js +0 -22
  42. package/dist/src/lib/exchange.request.js.map +0 -1
  43. package/dist/src/lib/exchange.types.d.ts +0 -21
  44. package/dist/src/lib/exchange.types.d.ts.map +0 -1
  45. package/dist/src/lib/exchange.types.js +0 -2
  46. package/dist/src/lib/exchange.types.js.map +0 -1
  47. package/dist/src/lib/exchange.utils.d.ts +0 -28
  48. package/dist/src/lib/exchange.utils.d.ts.map +0 -1
  49. package/dist/src/lib/exchange.utils.js +0 -55
  50. package/dist/src/lib/exchange.utils.js.map +0 -1
  51. package/dist/src/lib/logout.request.d.ts +0 -14
  52. package/dist/src/lib/logout.request.d.ts.map +0 -1
  53. package/dist/src/lib/logout.request.js +0 -47
  54. package/dist/src/lib/logout.request.js.map +0 -1
  55. package/dist/src/lib/oidc.api.d.ts +0 -33
  56. package/dist/src/lib/oidc.api.d.ts.map +0 -1
  57. package/dist/src/lib/oidc.api.js +0 -289
  58. package/dist/src/lib/oidc.api.js.map +0 -1
  59. package/dist/src/lib/oidc.api.utils.d.ts +0 -3
  60. package/dist/src/lib/oidc.api.utils.d.ts.map +0 -1
  61. package/dist/src/lib/oidc.api.utils.js +0 -9
  62. package/dist/src/lib/oidc.api.utils.js.map +0 -1
  63. package/dist/src/lib/token.utils.d.ts +0 -2
  64. package/dist/src/lib/token.utils.d.ts.map +0 -1
  65. package/dist/src/lib/token.utils.js +0 -15
  66. package/dist/src/lib/token.utils.js.map +0 -1
  67. package/dist/src/lib/wellknown.api.d.ts +0 -7
  68. package/dist/src/lib/wellknown.api.d.ts.map +0 -1
  69. package/dist/src/lib/wellknown.api.js +0 -22
  70. package/dist/src/lib/wellknown.api.js.map +0 -1
  71. package/dist/src/types.d.ts +0 -6
  72. package/dist/src/types.d.ts.map +0 -1
  73. package/dist/src/types.js +0 -5
  74. package/dist/src/types.js.map +0 -1
  75. package/dist/tsconfig.lib.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -4,21 +4,22 @@ A generic OpenID Connect (OIDC) client library for JavaScript and TypeScript, de
4
4
 
5
5
  ```js
6
6
  // Initialize OIDC Client
7
- const oidcClient = oidc({
7
+ const oidcClient = await oidc({
8
8
  /* config */
9
9
  });
10
10
 
11
11
  // Authorize API
12
- const authResponse = oidcClient.authorize.background(); // Returns code and state if successful, error and Auth URL if not
13
- const authUrl = oidcClient.authorize.url(); // Returns Auth URL or error
12
+ const authResponse = await oidcClient.authorize.background(); // Returns code and state if successful, error if not
13
+ const authUrl = await oidcClient.authorize.url(); // Returns Auth URL or error
14
14
 
15
15
  // Tokens API
16
- const newTokens = oidcClient.token.exchange({
16
+ const newTokens = await oidcClient.token.exchange({
17
17
  /* code, state */
18
18
  }); // Returns new tokens or error
19
- const existingTokens = oidcClient.token.get(); // Returns existing tokens or error
19
+ const existingTokens = await oidcClient.token.get(); // Returns existing tokens or error
20
+ const response = await oidcClient.token.revoke(); // Revokes an access token and returns the response or an error
20
21
 
21
22
  // User API
22
- const user = oidcClient.user.info(); // Returns user object or error
23
- const logoutResponse = oidcClient.user.logout(); // Returns null or error
23
+ const user = await oidcClient.user.info(); // Returns user object or error
24
+ const logoutResponse = await oidcClient.user.logout(); // Logs the user out and returns the response or an error
24
25
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgerock/oidc-client",
3
- "version": "0.0.0-beta-20251003204059",
3
+ "version": "0.0.0-beta-20251124184351",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ForgeRock/ping-javascript-sdk.git",
@@ -9,11 +9,7 @@
9
9
  "sideEffects": false,
10
10
  "type": "module",
11
11
  "exports": {
12
- ".": {
13
- "types": "./dist/src/index.d.ts",
14
- "import": "./dist/src/index.js",
15
- "default": "./dist/src/index.js"
16
- },
12
+ ".": "./dist/src/index.js",
17
13
  "./package.json": "./package.json",
18
14
  "./types": "./dist/src/types.d.ts"
19
15
  },
@@ -26,12 +22,12 @@
26
22
  "dependencies": {
27
23
  "@reduxjs/toolkit": "^2.8.2",
28
24
  "effect": "^3.17.2",
29
- "@forgerock/iframe-manager": "0.0.0-beta-20251003204059",
30
- "@forgerock/sdk-request-middleware": "0.0.0-beta-20251003204059",
31
- "@forgerock/sdk-oidc": "0.0.0-beta-20251003204059",
32
- "@forgerock/sdk-types": "0.0.0-beta-20251003204059",
33
- "@forgerock/sdk-logger": "0.0.0-beta-20251003204059",
34
- "@forgerock/storage": "0.0.0-beta-20251003204059"
25
+ "@forgerock/iframe-manager": "0.0.0-beta-20251124184351",
26
+ "@forgerock/sdk-logger": "0.0.0-beta-20251124184351",
27
+ "@forgerock/sdk-request-middleware": "0.0.0-beta-20251124184351",
28
+ "@forgerock/sdk-oidc": "0.0.0-beta-20251124184351",
29
+ "@forgerock/storage": "0.0.0-beta-20251124184351",
30
+ "@forgerock/sdk-types": "0.0.0-beta-20251124184351"
35
31
  },
36
32
  "devDependencies": {
37
33
  "@effect/vitest": "^0.23.9",
@@ -1,2 +0,0 @@
1
- export * from './lib/client.store.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,uBAAuB,CAAC"}
package/dist/src/index.js DELETED
@@ -1,8 +0,0 @@
1
- /*
2
- * Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
3
- *
4
- * This software may be modified and distributed under the terms
5
- * of the MIT license. See the LICENSE file for details.
6
- */
7
- export * from './lib/client.store.js';
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,uBAAuB,CAAC"}
@@ -1,17 +0,0 @@
1
- import { CustomLogger } from '@forgerock/sdk-logger';
2
- import { Micro } from 'effect';
3
- import type { GetAuthorizationUrlOptions, WellKnownResponse } from '@forgerock/sdk-types';
4
- import type { AuthorizationError, AuthorizationSuccess } from './authorize.request.types.js';
5
- import type { createClientStore } from './client.store.utils.js';
6
- import type { OidcConfig } from './config.types.js';
7
- /**
8
- * @function authorizeµ
9
- * @description Creates an authorization URL for the OIDC client.
10
- * @param {WellKnownResponse} wellknown - The well-known configuration for the OIDC server.
11
- * @param {OidcConfig} config - The OIDC client configuration.
12
- * @param {CustomLogger} log - The logger instance for logging debug information.
13
- * @param {GetAuthorizationUrlOptions} options - Optional parameters for the authorization request.
14
- * @returns {Micro.Micro<AuthorizationSuccess, AuthorizationError, never>} - A micro effect that resolves to the authorization response.
15
- */
16
- export declare function authorizeµ(wellknown: WellKnownResponse, config: OidcConfig, log: CustomLogger, store: ReturnType<typeof createClientStore>, options?: GetAuthorizationUrlOptions): Micro.Micro<AuthorizationSuccess, AuthorizationError, never>;
17
- //# sourceMappingURL=authorize.request.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.request.d.ts","sourceRoot":"","sources":["../../../src/lib/authorize.request.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAQ/B,OAAO,KAAK,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,EAC3C,OAAO,CAAC,EAAE,0BAA0B,gEA8IrC"}
@@ -1,124 +0,0 @@
1
- import { Micro } from 'effect';
2
- import { createAuthorizeUrlµ, buildAuthorizeOptionsµ, createAuthorizeErrorµ, } from './authorize.request.utils.js';
3
- import { oidcApi } from './oidc.api.js';
4
- /**
5
- * @function authorizeµ
6
- * @description Creates an authorization URL for the OIDC client.
7
- * @param {WellKnownResponse} wellknown - The well-known configuration for the OIDC server.
8
- * @param {OidcConfig} config - The OIDC client configuration.
9
- * @param {CustomLogger} log - The logger instance for logging debug information.
10
- * @param {GetAuthorizationUrlOptions} options - Optional parameters for the authorization request.
11
- * @returns {Micro.Micro<AuthorizationSuccess, AuthorizationError, never>} - A micro effect that resolves to the authorization response.
12
- */
13
- export function authorizeµ(wellknown, config, log, store, options) {
14
- return buildAuthorizeOptionsµ(wellknown, config, options).pipe(Micro.flatMap(([url, config, options]) => createAuthorizeUrlµ(url, config, options)), Micro.tap((url) => log.debug('Authorize URL created', url)), Micro.tapError((url) => Micro.sync(() => log.error('Error creating authorize URL', url))), Micro.flatMap(([url, options]) => {
15
- if (options.responseMode === 'pi.flow') {
16
- /**
17
- * If we support the pi.flow field, this means we are using a PingOne server.
18
- * PingOne servers do not support redirection through iframes because they
19
- * set iframe's to DENY.
20
- *
21
- * We do not use RTK Query for this because we don't want caching, or store
22
- * updates, and want the request to be made similar to the iframe method below.
23
- *
24
- * This returns a Micro that resolves to the parsed response JSON.
25
- */
26
- return Micro.promise(() => store.dispatch(oidcApi.endpoints.authorizeFetch.initiate({ url }))).pipe(Micro.flatMap(({ error, data }) => {
27
- if (error) {
28
- // Check for serialized error
29
- if (!('status' in error)) {
30
- // This is a network or fetch error, so return it as-is
31
- return Micro.fail({
32
- error: error.code || 'Unknown_Error',
33
- error_description: error.message || 'An unknown error occurred during authorization',
34
- type: 'unknown_error',
35
- });
36
- }
37
- // If there is no data, this is an unknown error
38
- if (!('data' in error)) {
39
- return Micro.fail({
40
- error: 'Unknown_Error',
41
- error_description: 'An unknown error occurred during authorization',
42
- type: 'unknown_error',
43
- });
44
- }
45
- const errorDetails = error.data;
46
- // If the error is a configuration issue, return it as-is
47
- if ('statusText' in error && error.statusText === 'CONFIGURATION_ERROR') {
48
- return Micro.fail(errorDetails);
49
- }
50
- // If the error is not a configuration issue, we build a new Authorize URL
51
- // For redirection, we need to remove `pi.flow` from the options
52
- const redirectOptions = options;
53
- delete redirectOptions.responseMode;
54
- // Create an error with a new Authorize URL
55
- return createAuthorizeErrorµ(errorDetails, wellknown, options);
56
- }
57
- log.debug('Received success response', data);
58
- if (data.authorizeResponse) {
59
- // Authorization was successful
60
- return Micro.succeed(data.authorizeResponse);
61
- }
62
- else {
63
- // This should never be reached, but just in case
64
- return Micro.fail({
65
- error: 'Unknown_Error',
66
- error_description: 'Response schema was not recognized',
67
- type: 'unknown_error',
68
- });
69
- }
70
- }));
71
- }
72
- else {
73
- /**
74
- * If the response mode is not pi.flow, then we are likely using a traditional
75
- * redirect based server supporting iframes. An example would be PingAM.
76
- *
77
- * This returns a Micro that's either the success URL parameters or error URL
78
- * parameters.
79
- */
80
- return Micro.promise(() => store.dispatch(oidcApi.endpoints.authorizeIframe.initiate({ url }))).pipe(Micro.flatMap(({ error, data }) => {
81
- if (error) {
82
- // Check for serialized error
83
- if (!('status' in error)) {
84
- // This is a network or fetch error, so return it as-is
85
- return Micro.fail({
86
- error: error.code || 'Unknown_Error',
87
- error_description: error.message || 'An unknown error occurred during authorization',
88
- type: 'unknown_error',
89
- });
90
- }
91
- // If there is no data, this is an unknown error
92
- if (!('data' in error)) {
93
- return Micro.fail({
94
- error: 'Unknown_Error',
95
- error_description: 'An unknown error occurred during authorization',
96
- type: 'unknown_error',
97
- });
98
- }
99
- const errorDetails = error.data;
100
- // If the error is a configuration issue, return it as-is
101
- if ('statusText' in error && error.statusText === 'CONFIGURATION_ERROR') {
102
- return Micro.fail(errorDetails);
103
- }
104
- // This is an expected error, so combine error with a new Authorize URL
105
- return createAuthorizeErrorµ(errorDetails, wellknown, options);
106
- }
107
- log.debug('Received success response', data);
108
- if (data) {
109
- // Authorization was successful
110
- return Micro.succeed(data);
111
- }
112
- else {
113
- // This should never be reached, but just in case
114
- return Micro.fail({
115
- error: 'Unknown_Error',
116
- error_description: 'Redirect parameters was not recognized',
117
- type: 'unknown_error',
118
- });
119
- }
120
- }));
121
- }
122
- }));
123
- }
124
- //# sourceMappingURL=authorize.request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.request.js","sourceRoot":"","sources":["../../../src/lib/authorize.request.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,SAA4B,EAC5B,MAAkB,EAClB,GAAiB,EACjB,KAA2C,EAC3C,OAAoC;IAEpC,OAAO,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAC5D,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,EACpF,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC,EAC3D,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAA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AC,CAAC;oBACL,CAAC;oBAED,gDAAgD;oBAChD,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;wBACvB,OAAO,KAAK,CAAC,IAAI,CAAC;4BAChB,KAAK,EAAE,eAAe;4BACtB,iBAAiB,EAAE,gDAAgD;4BACnE,IAAI,EAAE,eAAe;yBACtB,CAAC,CAAC;oBACL,CAAC;oBAED,MAAM,YAAY,GAAG,KAAK,CAAC,IAA0B,CAAC;oBAEtD,yDAAyD;oBACzD,IAAI,YAAY,IAAI,KAAK,IAAI,KAAK,CAAC,UAAU,KAAK,qBAAqB,EAAE,CAAC;wBACxE,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;oBAClC,CAAC;oBAED,uEAAuE;oBACvE,OAAO,qBAAqB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;gBACjE,CAAC;gBAED,GAAG,CAAC,KAAK,CAAC,2BAA2B,EAAE,IAAI,CAAC,CAAC;gBAE7C,IAAI,IAAI,EAAE,CAAC;oBACT,+BAA+B;oBAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC7B,CAAC;qBAAM,CAAC;oBACN,iDAAiD;oBACjD,OAAO,KAAK,CAAC,IAAI,CAAC;wBAChB,KAAK,EAAE,eAAe;wBACtB,iBAAiB,EAAE,wCAAwC;wBAC3D,IAAI,EAAE,eAAe;qBACtB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CACF,CAAC;AACJ,CAAC"}
@@ -1,47 +0,0 @@
1
- export interface AuthorizeErrorResponse {
2
- id?: string;
3
- code?: string;
4
- message?: string;
5
- details?: [
6
- {
7
- code: string;
8
- message: string;
9
- }
10
- ];
11
- }
12
- export interface AuthorizeSuccessResponse {
13
- _links?: {
14
- [key: string]: {
15
- href: string;
16
- };
17
- };
18
- _embedded?: {
19
- [key: string]: unknown;
20
- };
21
- id?: string;
22
- environment?: {
23
- id: string;
24
- };
25
- session?: {
26
- id: string;
27
- };
28
- resumeUrl?: string;
29
- status?: string;
30
- createdAt?: string;
31
- expiresAt?: string;
32
- authorizeResponse?: {
33
- code: string;
34
- state: string;
35
- };
36
- }
37
- export interface AuthorizationSuccess {
38
- code: string;
39
- state: string;
40
- }
41
- export interface AuthorizationError {
42
- error: string;
43
- error_description: string;
44
- redirectUrl?: string;
45
- type: 'auth_error' | 'argument_error' | 'network_error' | 'unknown_error' | 'wellknown_error';
46
- }
47
- //# sourceMappingURL=authorize.request.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.request.types.d.ts","sourceRoot":"","sources":["../../../src/lib/authorize.request.types.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,sBAAsB;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR;YACE,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;SACjB;KACF,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,SAAS,CAAC,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE;QACZ,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,OAAO,CAAC,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,YAAY,GAAG,gBAAgB,GAAG,eAAe,GAAG,eAAe,GAAG,iBAAiB,CAAC;CAC/F"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=authorize.request.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.request.types.js","sourceRoot":"","sources":["../../../src/lib/authorize.request.types.ts"],"names":[],"mappings":""}
@@ -1,40 +0,0 @@
1
- import { Micro } from 'effect';
2
- import type { WellKnownResponse, GetAuthorizationUrlOptions } from '@forgerock/sdk-types';
3
- import type { AuthorizationError, AuthorizationSuccess } from './authorize.request.types.js';
4
- import type { OidcConfig } from './config.types.js';
5
- type BuildAuthorizationData = [string, OidcConfig, GetAuthorizationUrlOptions];
6
- export type OptionalAuthorizeOptions = Partial<GetAuthorizationUrlOptions>;
7
- /**
8
- * @function buildAuthorizeOptionsµ
9
- * @description Builds the authorization options for the OIDC client.
10
- * @param {WellKnownResponse} wellknown - The well-known configuration for the OIDC server.
11
- * @param {OidcConfig} config - The OIDC client configuration.
12
- * @param {OptionalAuthorizeOptions} options - Optional parameters for the authorization request.
13
- * @returns {Micro.Micro<BuildAuthorizationData, AuthorizeErrorResponse, never>}
14
- */
15
- export declare function buildAuthorizeOptionsµ(wellknown: WellKnownResponse, config: OidcConfig, options?: OptionalAuthorizeOptions): Micro.Micro<BuildAuthorizationData, AuthorizationError, never>;
16
- /**
17
- * @function createAuthorizeErrorµ
18
- * @description Creates an error response with new Authorize URL for the authorization request.
19
- * @param { error: string; error_description: string } res - The error response from the authorization request.
20
- * @param {WellKnownResponse} wellknown- The well-known configuration for the OIDC server.
21
- * @param { OidcConfig } config- The OIDC client configuration.
22
- * @param { GetAuthorizationUrlOptions } options- Optional parameters for the authorization request.
23
- * @returns { Micro.Micro<never, AuthorizeErrorResponse, never> }
24
- */
25
- export declare function createAuthorizeErrorµ(res: {
26
- error: string;
27
- error_description: string;
28
- }, wellknown: WellKnownResponse, options: GetAuthorizationUrlOptions): Micro.Micro<never, AuthorizationError, never>;
29
- /**
30
- * @function createAuthorizeUrlµ
31
- * @description Creates an authorization URL and related options/config for the Authorize request.
32
- * @param {string} path - The path to the authorization endpoint.
33
- * @param { OidcConfig } config - The OIDC client configuration.
34
- * @param { GetAuthorizationUrlOptions } options - Optional parameters for the authorization request.
35
- * @returns { Micro.Micro<[string, OidcConfig, GetAuthorizationUrlOptions], AuthorizationError, never> }
36
- */
37
- export declare function createAuthorizeUrlµ(path: string, config: OidcConfig, options: GetAuthorizationUrlOptions): Micro.Micro<[string, GetAuthorizationUrlOptions], AuthorizationError, never>;
38
- export declare function handleResponseµ(response: AuthorizationSuccess | AuthorizationError, wellknown: WellKnownResponse, config: OidcConfig, options: GetAuthorizationUrlOptions): Micro.Micro<AuthorizationSuccess, AuthorizationError, never>;
39
- export {};
40
- //# sourceMappingURL=authorize.request.utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.request.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/authorize.request.utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,KAAK,sBAAsB,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,0BAA0B,CAAC,CAAC;AAC/E,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,wBAAwB,GACjC,KAAK,CAAC,KAAK,CAAC,sBAAsB,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAgBhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,EACjD,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,0BAA0B,GAClC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,CAAC,CA2B/C;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,0BAA0B,GAClC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,0BAA0B,CAAC,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAqB9E;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,oBAAoB,GAAG,kBAAkB,EACnD,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,0BAA0B,GAClC,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAM9D"}
@@ -1,104 +0,0 @@
1
- /*
2
- * Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
3
- *
4
- * This software may be modified and distributed under the terms
5
- * of the MIT license. See the LICENSE file for details.
6
- */
7
- import { createAuthorizeUrl } from '@forgerock/sdk-oidc';
8
- import { Micro } from 'effect';
9
- /**
10
- * @function buildAuthorizeOptionsµ
11
- * @description Builds the authorization options for the OIDC client.
12
- * @param {WellKnownResponse} wellknown - The well-known configuration for the OIDC server.
13
- * @param {OidcConfig} config - The OIDC client configuration.
14
- * @param {OptionalAuthorizeOptions} options - Optional parameters for the authorization request.
15
- * @returns {Micro.Micro<BuildAuthorizationData, AuthorizeErrorResponse, never>}
16
- */
17
- export function buildAuthorizeOptionsµ(wellknown, config, options) {
18
- const isPiFlow = wellknown.response_modes_supported?.includes('pi.flow');
19
- return Micro.sync(() => [
20
- wellknown.authorization_endpoint,
21
- config,
22
- {
23
- clientId: config.clientId,
24
- redirectUri: config.redirectUri,
25
- scope: config.scope || 'openid',
26
- responseType: config.responseType || 'code',
27
- ...(isPiFlow && { responseMode: 'pi.flow' }),
28
- ...options,
29
- },
30
- ]);
31
- }
32
- /**
33
- * @function createAuthorizeErrorµ
34
- * @description Creates an error response with new Authorize URL for the authorization request.
35
- * @param { error: string; error_description: string } res - The error response from the authorization request.
36
- * @param {WellKnownResponse} wellknown- The well-known configuration for the OIDC server.
37
- * @param { OidcConfig } config- The OIDC client configuration.
38
- * @param { GetAuthorizationUrlOptions } options- Optional parameters for the authorization request.
39
- * @returns { Micro.Micro<never, AuthorizeErrorResponse, never> }
40
- */
41
- export function createAuthorizeErrorµ(res, wellknown, options) {
42
- return Micro.tryPromise({
43
- try: () => createAuthorizeUrl(wellknown.authorization_endpoint, {
44
- ...options,
45
- }),
46
- catch: (error) => {
47
- let message = 'Error creating authorization URL';
48
- if (error instanceof Error) {
49
- message = error.message;
50
- }
51
- return {
52
- error: 'AuthorizationUrlError',
53
- error_description: message,
54
- type: 'auth_error',
55
- };
56
- },
57
- }).pipe(Micro.flatMap((url) => {
58
- return Micro.fail({
59
- error: res.error,
60
- error_description: res.error_description,
61
- type: 'auth_error',
62
- redirectUrl: url,
63
- });
64
- }));
65
- }
66
- /**
67
- * @function createAuthorizeUrlµ
68
- * @description Creates an authorization URL and related options/config for the Authorize request.
69
- * @param {string} path - The path to the authorization endpoint.
70
- * @param { OidcConfig } config - The OIDC client configuration.
71
- * @param { GetAuthorizationUrlOptions } options - Optional parameters for the authorization request.
72
- * @returns { Micro.Micro<[string, OidcConfig, GetAuthorizationUrlOptions], AuthorizationError, never> }
73
- */
74
- export function createAuthorizeUrlµ(path, config, options) {
75
- return Micro.tryPromise({
76
- try: async () => [
77
- await createAuthorizeUrl(path, {
78
- ...options,
79
- prompt: 'none',
80
- }),
81
- options,
82
- ],
83
- catch: (error) => {
84
- let message = 'Error creating authorization URL';
85
- if (error instanceof Error) {
86
- message = error.message;
87
- }
88
- return {
89
- error: 'AuthorizationUrlError',
90
- error_description: message,
91
- type: 'auth_error',
92
- };
93
- },
94
- });
95
- }
96
- export function handleResponseµ(response, wellknown, config, options) {
97
- if ('code' in response) {
98
- return Micro.sync(() => response);
99
- }
100
- else {
101
- return createAuthorizeErrorµ(response, wellknown, options);
102
- }
103
- }
104
- //# sourceMappingURL=authorize.request.utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.request.utils.js","sourceRoot":"","sources":["../../../src/lib/authorize.request.utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAU/B;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAA4B,EAC5B,MAAkB,EAClB,OAAkC;IAElC,MAAM,QAAQ,GAAG,SAAS,CAAC,wBAAwB,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC,IAAI,CACf,GAA2B,EAAE,CAAC;QAC5B,SAAS,CAAC,sBAAsB;QAChC,MAAM;QACN;YACE,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,QAAQ;YAC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C;YACF,OAAO;SACR;QACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;YACf,IAAI,OAAO,GAAG,kCAAkC,CAAC;YACjD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;YAC1B,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,uBAAuB;gBAC9B,iBAAiB,EAAE,OAAO;gBAC1B,IAAI,EAAE,YAAY;aACV,CAAC;QACb,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,QAAmD,EACnD,SAA4B,EAC5B,MAAkB,EAClB,OAAmC;IAEnC,IAAI,MAAM,IAAI,QAAQ,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,OAAO,qBAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
@@ -1,5 +0,0 @@
1
- declare const authorizeSlice: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, {
2
- handleAuthorize: import("@reduxjs/toolkit/query").QueryDefinition<string, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, string, "authorizeSlice", unknown>;
3
- }, "authorizeSlice", never, typeof import("@reduxjs/toolkit/query").coreModuleName>;
4
- export { authorizeSlice };
5
- //# sourceMappingURL=authorize.slice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.slice.d.ts","sourceRoot":"","sources":["../../../src/lib/authorize.slice.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc;;mFAkBlB,CAAC;AAEH,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,21 +0,0 @@
1
- import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query';
2
- const authorizeSlice = createApi({
3
- reducerPath: 'authorizeSlice',
4
- baseQuery: fetchBaseQuery({
5
- credentials: 'include',
6
- prepareHeaders: (headers) => {
7
- headers.set('Content-Type', 'application/json');
8
- headers.set('Accept', 'application/json');
9
- headers.set('x-requested-with', 'ping-sdk');
10
- headers.set('x-requested-platform', 'javascript');
11
- return headers;
12
- },
13
- }),
14
- endpoints: (builder) => ({
15
- handleAuthorize: builder.query({
16
- query: (authorizeUrl) => authorizeUrl,
17
- }),
18
- }),
19
- });
20
- export { authorizeSlice };
21
- //# sourceMappingURL=authorize.slice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorize.slice.js","sourceRoot":"","sources":["../../../src/lib/authorize.slice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE,MAAM,cAAc,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,gBAAgB;IAC7B,SAAS,EAAE,cAAc,CAAC;QACxB,WAAW,EAAE,SAAS;QACtB,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE;YAC1B,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;YAElD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;IACF,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACvB,eAAe,EAAE,OAAO,CAAC,KAAK,CAAiB;YAC7C,KAAK,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY;SACtC,CAAC;KACH,CAAC;CACH,CAAC,CAAC;AAEH,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,115 +0,0 @@
1
- import { CustomLogger, LogLevel } from '@forgerock/sdk-logger';
2
- import { StorageConfig } from '@forgerock/storage';
3
- import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware';
4
- import type { GenericError, GetAuthorizationUrlOptions } from '@forgerock/sdk-types';
5
- import type { GetTokensOptions, LogoutErrorResult, LogoutSuccessResult, RevokeErrorResult, RevokeSuccessResult, UserInfoResponse } from './client.types.js';
6
- import type { OauthTokens, OidcConfig } from './config.types.js';
7
- import type { AuthorizationError, AuthorizationSuccess } from './authorize.request.types.js';
8
- import type { TokenExchangeErrorResponse } from './exchange.types.js';
9
- /**
10
- * @function oidc
11
- * @description Factory function to create an OIDC client with methods for authorization, token exchange,
12
- * user info retrieval, and logout. It initializes the client with the provided configuration,
13
- * request middleware, logger, and storage options.
14
- * @param param - configuration object containing the OIDC client configuration, request middleware, logger,
15
- * @param {OidcConfig} param.config - OIDC configuration including server details, client ID, redirect URI,
16
- * storage options, scope, and response type.
17
- * @param {RequestMiddleware} param.requestMiddleware - optional array of request middleware functions to process requests.
18
- * @param {{ level: LogLevel, custom: CustomLogger }} param.logger - optional logger configuration with log level and custom logger.
19
- * @param {Partial<StorageConfig>} param.storage - optional storage configuration for persisting OIDC tokens.
20
- * @returns {ReturnType<typeof oidc>} - Returns an object with methods for authorization, token exchange, user info retrieval, and logout.
21
- */
22
- export declare function oidc<ActionType extends ActionTypes = ActionTypes>({ config, requestMiddleware, logger, storage, }: {
23
- config: OidcConfig;
24
- requestMiddleware?: RequestMiddleware<ActionType>[];
25
- logger?: {
26
- level: LogLevel;
27
- custom?: CustomLogger;
28
- };
29
- storage?: Partial<StorageConfig>;
30
- }): Promise<{
31
- error: string;
32
- type: string;
33
- /**
34
- * An object containing methods for the creation, and background use, of the authorization URL
35
- */
36
- authorize?: undefined;
37
- /**
38
- * An object containing methods for token management
39
- */
40
- token?: undefined;
41
- /**
42
- * An object containing methods for user info retrieval and logout
43
- */
44
- user?: undefined;
45
- } | {
46
- /**
47
- * An object containing methods for the creation, and background use, of the authorization URL
48
- */
49
- authorize: {
50
- /**
51
- * @method url
52
- * @description Creates an authorization URL with the provided options or defaults from the configuration.
53
- * @param {GetAuthorizationUrlOptions} options - Optional parameters to customize the authorization URL.
54
- * @returns {Promise<string | GenericError>} - Returns a promise that resolves to the authorization URL or an error.
55
- */
56
- url: (options?: GetAuthorizationUrlOptions) => Promise<string | GenericError>;
57
- /**
58
- * @function background - Initiates the authorization process in the background, returning an authorization URL or an error.
59
- * @param {GetAuthorizationUrlOptions} options - Optional parameters to customize the authorization URL.
60
- * @returns {Promise<AuthorizeErrorResponse | AuthorizeSuccessResponse>} - Returns a promise that resolves to the authorization URL or an error response.
61
- */
62
- background: (options?: GetAuthorizationUrlOptions) => Promise<AuthorizationSuccess | AuthorizationError>;
63
- };
64
- /**
65
- * An object containing methods for token management
66
- */
67
- token: {
68
- /**
69
- * @method exchange
70
- * @description Exchanges an authorization code for tokens using the token endpoint from the wellknown
71
- * configuration and stores them in the configured storage.
72
- * @param {string} code - The authorization code received from the authorization server.
73
- * @param {string} state - The state parameter from the authorization URL creation.
74
- * @param {Partial<StorageConfig>} options - Optional storage configuration for persisting tokens.
75
- * @returns {Promise<OauthTokens | GenericError | TokenExchangeErrorResponse>}
76
- */
77
- exchange: (code: string, state: string, options?: Partial<StorageConfig>) => Promise<OauthTokens | TokenExchangeErrorResponse | GenericError>;
78
- /**
79
- * @method get
80
- * @description Retrieves the current OAuth tokens from storage, or auto-renew if backgroundRenew is true.
81
- * @param {GetTokensOptions} param - An object containing options for the token retrieval.
82
- * @returns {Promise<OauthTokens | TokenExchangeErrorResponse | AuthorizationError | GenericError>}
83
- */
84
- get: (options?: GetTokensOptions) => Promise<OauthTokens | TokenExchangeErrorResponse | AuthorizationError | GenericError>;
85
- /**
86
- * @method revoke
87
- * @description Revokes an access token using the revocation endpoint from the wellknown configuration.
88
- * It requires an access token stored in the configured storage.
89
- * @returns {Promise<GenericError | RevokeSuccessResult | RevokeErrorResult>} - Returns a promise that resolves to the revoke response or an error response.
90
- */
91
- revoke: () => Promise<GenericError | RevokeSuccessResult | RevokeErrorResult>;
92
- };
93
- /**
94
- * An object containing methods for user info retrieval and logout
95
- */
96
- user: {
97
- /**
98
- * @method info
99
- * @description Retrieves user information using the userinfo endpoint from the wellknown configuration.
100
- * It requires an access token stored in the configured storage.
101
- * @returns {Promise<GenericError | UserInfoResponse>} - Returns a promise that resolves to user information or an error response.
102
- */
103
- info: () => Promise<GenericError | UserInfoResponse>;
104
- /**
105
- * @method logout
106
- * @description Logs out the user by revoking tokens and clearing the storage.
107
- * It uses the end session endpoint from the wellknown configuration.
108
- * @returns {Promise<GenericError | LogoutSuccessResult | LogoutErrorResult>} - Returns a promise that resolves to the logout response or an error.
109
- */
110
- logout: () => Promise<GenericError | LogoutSuccessResult | LogoutErrorResult>;
111
- };
112
- error?: undefined;
113
- type?: undefined;
114
- }>;
115
- //# sourceMappingURL=client.store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.store.d.ts","sourceRoot":"","sources":["../../../src/lib/client.store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAsB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEnF,OAAO,EAAiB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUlE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,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