@forgerock/davinci-client 1.1.0 → 1.2.0
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.
- package/dist/src/lib/client.store.d.ts +43 -42
- package/dist/src/lib/client.store.d.ts.map +1 -1
- package/dist/src/lib/client.store.js +87 -82
- package/dist/src/lib/client.store.js.map +1 -1
- package/dist/src/lib/client.store.utils.d.ts +27 -14
- package/dist/src/lib/client.store.utils.d.ts.map +1 -1
- package/dist/src/lib/client.store.utils.js +15 -2
- package/dist/src/lib/client.store.utils.js.map +1 -1
- package/dist/src/lib/client.types.d.ts +3 -1
- package/dist/src/lib/client.types.d.ts.map +1 -1
- package/dist/src/lib/collector.types.d.ts +112 -7
- package/dist/src/lib/collector.types.d.ts.map +1 -1
- package/dist/src/lib/collector.types.js +0 -3
- package/dist/src/lib/collector.types.js.map +1 -1
- package/dist/src/lib/collector.utils.d.ts +36 -19
- package/dist/src/lib/collector.utils.d.ts.map +1 -1
- package/dist/src/lib/collector.utils.js +123 -9
- package/dist/src/lib/collector.utils.js.map +1 -1
- package/dist/src/lib/config.types.d.ts +3 -3
- package/dist/src/lib/config.types.d.ts.map +1 -1
- package/dist/src/lib/davinci.api.d.ts +6 -4
- package/dist/src/lib/davinci.api.d.ts.map +1 -1
- package/dist/src/lib/davinci.api.js +31 -18
- package/dist/src/lib/davinci.api.js.map +1 -1
- package/dist/src/lib/davinci.types.d.ts +46 -7
- package/dist/src/lib/davinci.types.d.ts.map +1 -1
- package/dist/src/lib/davinci.utils.d.ts +4 -7
- package/dist/src/lib/davinci.utils.d.ts.map +1 -1
- package/dist/src/lib/davinci.utils.js +14 -31
- package/dist/src/lib/davinci.utils.js.map +1 -1
- package/dist/src/lib/node.reducer.d.ts +4 -4
- package/dist/src/lib/node.reducer.d.ts.map +1 -1
- package/dist/src/lib/node.reducer.js +54 -4
- package/dist/src/lib/node.reducer.js.map +1 -1
- package/dist/src/lib/node.slice.d.ts +25 -7
- package/dist/src/lib/node.slice.d.ts.map +1 -1
- package/dist/src/lib/node.slice.js +40 -10
- package/dist/src/lib/node.slice.js.map +1 -1
- package/dist/src/lib/node.types.d.ts +3 -3
- package/dist/src/lib/node.types.d.ts.map +1 -1
- package/dist/src/lib/node.utils.d.ts +2 -2
- package/dist/src/lib/node.utils.d.ts.map +1 -1
- package/dist/src/lib/wellknown.api.d.ts +1 -1
- package/dist/src/types.d.ts +12 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -2
- package/dist/src/types.js.map +1 -1
- package/package.json +10 -20
- package/dist/src/lib/authorize.utils.d.ts +0 -22
- package/dist/src/lib/authorize.utils.d.ts.map +0 -1
- package/dist/src/lib/authorize.utils.js +0 -47
- package/dist/src/lib/authorize.utils.js.map +0 -1
- package/dist/src/lib/effects/request.effect.mock.d.ts +0 -4
- package/dist/src/lib/effects/request.effect.mock.d.ts.map +0 -1
- package/dist/src/lib/effects/request.effect.mock.js +0 -106
- package/dist/src/lib/effects/request.effect.mock.js.map +0 -1
- package/dist/src/lib/effects/request.effect.types.d.ts +0 -20
- package/dist/src/lib/effects/request.effect.types.d.ts.map +0 -1
- package/dist/src/lib/effects/request.effect.types.js +0 -2
- package/dist/src/lib/effects/request.effect.types.js.map +0 -1
- package/dist/src/lib/effects/request.effect.unions.d.ts +0 -12
- package/dist/src/lib/effects/request.effect.unions.d.ts.map +0 -1
- package/dist/src/lib/effects/request.effect.unions.js +0 -16
- package/dist/src/lib/effects/request.effect.unions.js.map +0 -1
- package/dist/src/lib/effects/request.effect.utils.d.ts +0 -27
- package/dist/src/lib/effects/request.effect.utils.d.ts.map +0 -1
- package/dist/src/lib/effects/request.effect.utils.js +0 -57
- package/dist/src/lib/effects/request.effect.utils.js.map +0 -1
package/dist/src/types.d.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import 'immer';
|
|
2
|
+
import type { RequestMiddleware } from '@forgerock/sdk-request-middleware';
|
|
2
3
|
import type * as collectors from './lib/collector.types.js';
|
|
3
4
|
import type * as config from './lib/config.types.js';
|
|
4
5
|
import type * as nodes from './lib/node.types.js';
|
|
5
6
|
import type * as client from './lib/client.types.js';
|
|
6
|
-
import
|
|
7
|
+
import { davinci } from './lib/client.store.js';
|
|
8
|
+
import { nodeSlice } from './lib/node.slice.js';
|
|
9
|
+
export type { CustomLogger } from '@forgerock/sdk-logger/types';
|
|
7
10
|
export type DaVinciConfig = config.DaVinciConfig;
|
|
11
|
+
export type DavinciClient = Awaited<ReturnType<typeof davinci>>;
|
|
8
12
|
export type Updater = client.Updater;
|
|
9
13
|
export type InitFlow = client.InitFlow;
|
|
10
14
|
export type Validator = client.Validator;
|
|
15
|
+
export type GetClient = ReturnType<typeof nodeSlice.selectors.selectClient>;
|
|
11
16
|
export type StartNode = nodes.StartNode;
|
|
12
17
|
export type ContinueNode = nodes.ContinueNode;
|
|
13
18
|
export type ErrorNode = nodes.ErrorNode;
|
|
14
19
|
export type SuccessNode = nodes.SuccessNode;
|
|
15
20
|
export type FailureNode = nodes.FailureNode;
|
|
16
|
-
export type NodeStates =
|
|
21
|
+
export type NodeStates = ContinueNode | ErrorNode | StartNode | SuccessNode | FailureNode;
|
|
17
22
|
export type Collectors = nodes.Collectors;
|
|
18
23
|
export type DaVinciValidationError = nodes.DaVinciError;
|
|
19
24
|
export type ActionCollector<T extends collectors.ActionCollectorTypes> = collectors.ActionCollector<T>;
|
|
@@ -27,5 +32,9 @@ export type ValidatedTextCollector = collectors.ValidatedTextCollector;
|
|
|
27
32
|
export type ReadOnlyCollector = collectors.ReadOnlyCollector;
|
|
28
33
|
export type MultiSelectCollector = collectors.MultiSelectCollector;
|
|
29
34
|
export type SingleSelectCollector = collectors.SingleSelectCollector;
|
|
30
|
-
export type
|
|
35
|
+
export type DeviceRegistrationCollector = collectors.DeviceRegistrationCollector;
|
|
36
|
+
export type DeviceAuthenticationCollector = collectors.DeviceAuthenticationCollector;
|
|
37
|
+
export type PhoneNumberCollector = collectors.PhoneNumberCollector;
|
|
38
|
+
export type InternalErrorResponse = client.InternalErrorResponse;
|
|
39
|
+
export type { RequestMiddleware };
|
|
31
40
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,KAAK,UAAU,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC;AAChE,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AACrC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AACvC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AACzC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AAC5E,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,KA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AC,6BAA6B,CAAC;AACrF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,oBAAoB,CAAC;AAEnE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACjE,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dist/src/types.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
1
|
+
/* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
|
|
3
2
|
*
|
|
4
3
|
* This software may be modified and distributed under the terms
|
|
5
4
|
* of the MIT license. See the LICENSE file for details.
|
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,OAAO,CAAC,CAAC,yDAAyD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgerock/davinci-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ForgeRock/ping-javascript-sdk.git",
|
|
@@ -23,9 +23,13 @@
|
|
|
23
23
|
"./LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"@reduxjs/toolkit": "^2.8.2",
|
|
27
|
+
"immer": "^10.1.1",
|
|
28
|
+
"@forgerock/sdk-logger": "1.2.0",
|
|
29
|
+
"@forgerock/sdk-oidc": "1.2.0",
|
|
30
|
+
"@forgerock/sdk-request-middleware": "1.2.0",
|
|
31
|
+
"@forgerock/storage": "1.2.0",
|
|
32
|
+
"@forgerock/sdk-types": "1.2.0"
|
|
29
33
|
},
|
|
30
34
|
"devDependencies": {
|
|
31
35
|
"vitest": "^3.0.4"
|
|
@@ -36,24 +40,10 @@
|
|
|
36
40
|
"nx": {
|
|
37
41
|
"tags": [
|
|
38
42
|
"scope:package"
|
|
39
|
-
]
|
|
40
|
-
"targets": {
|
|
41
|
-
"build": {
|
|
42
|
-
"executor": "@nx/js:tsc",
|
|
43
|
-
"outputs": [
|
|
44
|
-
"{options.outputPath}"
|
|
45
|
-
],
|
|
46
|
-
"options": {
|
|
47
|
-
"outputPath": "packages/davinci-client/dist",
|
|
48
|
-
"main": "packages/davinci-client/src/index.ts",
|
|
49
|
-
"tsConfig": "packages/davinci-client/tsconfig.lib.json",
|
|
50
|
-
"generatePackageJson": false,
|
|
51
|
-
"assets": []
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
43
|
+
]
|
|
55
44
|
},
|
|
56
45
|
"scripts": {
|
|
46
|
+
"build": "pnpm nx nxBuild",
|
|
57
47
|
"lint": "pnpm nx nxLint",
|
|
58
48
|
"test": "pnpm nx nxTest",
|
|
59
49
|
"test:watch": "pnpm nx nxTest --watch"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define the options for the authorization URL
|
|
3
|
-
* @param clientId The client ID of the application
|
|
4
|
-
* @param redirectUri The redirect URI of the application
|
|
5
|
-
* @param responseType The response type of the authorization request
|
|
6
|
-
* @param scope The scope of the authorization request
|
|
7
|
-
*/
|
|
8
|
-
export interface GetAuthorizationUrlOptions {
|
|
9
|
-
clientId: string;
|
|
10
|
-
login: 'redirect';
|
|
11
|
-
redirectUri: string;
|
|
12
|
-
responseType: string;
|
|
13
|
-
scope: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @function createAuthorizeUrl - Create authorization URL for initial call to DaVinci
|
|
17
|
-
* @param baseUrl {string}
|
|
18
|
-
* @param options {GetAuthorizationUrlOptions}
|
|
19
|
-
* @returns {Promise<string>} - the authorization URL
|
|
20
|
-
*/
|
|
21
|
-
export declare function createAuthorizeUrl(authorizeUrl: string, options: GetAuthorizationUrlOptions): Promise<string>;
|
|
22
|
-
//# sourceMappingURL=authorize.utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/authorize.utils.ts"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAkCjB"}
|
|
@@ -1,47 +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
|
-
/**
|
|
8
|
-
* Import the PKCE and ResponseType utilities from the JavaScript SDK
|
|
9
|
-
*/
|
|
10
|
-
import { PKCE, ResponseType } from '@forgerock/javascript-sdk';
|
|
11
|
-
import { generateAndStoreAuthUrlValues } from '@forgerock/javascript-sdk/src/oauth2-client/state-pkce';
|
|
12
|
-
/**
|
|
13
|
-
* @function createAuthorizeUrl - Create authorization URL for initial call to DaVinci
|
|
14
|
-
* @param baseUrl {string}
|
|
15
|
-
* @param options {GetAuthorizationUrlOptions}
|
|
16
|
-
* @returns {Promise<string>} - the authorization URL
|
|
17
|
-
*/
|
|
18
|
-
export async function createAuthorizeUrl(authorizeUrl, options) {
|
|
19
|
-
/**
|
|
20
|
-
* Generate state and verifier for PKCE
|
|
21
|
-
*/
|
|
22
|
-
const baseUrl = new URL(authorizeUrl).origin;
|
|
23
|
-
const [authorizeUrlOptions, storeOptions] = generateAndStoreAuthUrlValues({
|
|
24
|
-
clientId: options.clientId,
|
|
25
|
-
login: options.login,
|
|
26
|
-
// this type fails when module resolution is Node16
|
|
27
|
-
// Probably because the javascript-sdk is set to bundler
|
|
28
|
-
// so we need to make this correct with .js extensions if possible
|
|
29
|
-
serverConfig: { baseUrl },
|
|
30
|
-
responseType: ResponseType.Code,
|
|
31
|
-
});
|
|
32
|
-
const challenge = await PKCE.createChallenge(authorizeUrlOptions.verifier);
|
|
33
|
-
const requestParams = new URLSearchParams({
|
|
34
|
-
code_challenge: challenge,
|
|
35
|
-
code_challenge_method: 'S256',
|
|
36
|
-
client_id: options.clientId,
|
|
37
|
-
redirect_uri: options.redirectUri,
|
|
38
|
-
response_mode: 'pi.flow',
|
|
39
|
-
response_type: options.responseType,
|
|
40
|
-
scope: options.scope,
|
|
41
|
-
state: authorizeUrlOptions.state,
|
|
42
|
-
});
|
|
43
|
-
const url = new URL(`${authorizeUrl}?${requestParams.toString()}`);
|
|
44
|
-
storeOptions();
|
|
45
|
-
return url.toString();
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=authorize.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.utils.js","sourceRoot":"","sources":["../../../src/lib/authorize.utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wDAAwD,CAAC;AAiBvG;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,YAAoB,EACpB,OAAmC;IAEnC;;OAEG;IACH,MAAM,OAAO,GAAG,IAAI,GAAG,CAA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 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
|
-
/*
|
|
8
|
-
* @forgerock/javascript-sdk
|
|
9
|
-
*
|
|
10
|
-
* middleware.mock.data.ts
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) 2020 ForgeRock. All rights reserved.
|
|
13
|
-
* This software may be modified and distributed under the terms
|
|
14
|
-
* of the MIT license. See the LICENSE file for details.
|
|
15
|
-
*/
|
|
16
|
-
const a = 'a';
|
|
17
|
-
const b = 'b';
|
|
18
|
-
const one = '1';
|
|
19
|
-
const two = '2';
|
|
20
|
-
const add = 'ADD';
|
|
21
|
-
const reassignment = 'REASSIGNMENT';
|
|
22
|
-
const mutateAction = 'MUTATE-ACTION';
|
|
23
|
-
const middleware = [
|
|
24
|
-
(req, action, next) => {
|
|
25
|
-
switch (action.type) {
|
|
26
|
-
case a:
|
|
27
|
-
case b:
|
|
28
|
-
req.url.searchParams.set('letter', 'true');
|
|
29
|
-
if (req.headers)
|
|
30
|
-
req.headers.set('x-letter', 'true');
|
|
31
|
-
break;
|
|
32
|
-
case one:
|
|
33
|
-
case two:
|
|
34
|
-
req.url.searchParams.set('letter', 'false');
|
|
35
|
-
if (req.headers)
|
|
36
|
-
req.headers.set('x-letter', 'false');
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
next();
|
|
40
|
-
},
|
|
41
|
-
(req, action, next) => {
|
|
42
|
-
switch (action.type) {
|
|
43
|
-
case a:
|
|
44
|
-
req.url.searchParams.set('char', 'a');
|
|
45
|
-
if (req.headers)
|
|
46
|
-
req.headers.set('x-char', 'a');
|
|
47
|
-
break;
|
|
48
|
-
case b:
|
|
49
|
-
req.url.searchParams.set('char', 'b');
|
|
50
|
-
if (req.headers)
|
|
51
|
-
req.headers.set('x-char', 'b');
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
next();
|
|
55
|
-
},
|
|
56
|
-
(req, action, next) => {
|
|
57
|
-
switch (action.type) {
|
|
58
|
-
case one:
|
|
59
|
-
req.url.searchParams.set('char', '1');
|
|
60
|
-
if (req.headers)
|
|
61
|
-
req.headers.set('x-char', '1');
|
|
62
|
-
break;
|
|
63
|
-
case two:
|
|
64
|
-
req.url.searchParams.set('char', '2');
|
|
65
|
-
if (req.headers)
|
|
66
|
-
req.headers.set('x-char', '2');
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
next();
|
|
70
|
-
},
|
|
71
|
-
(req, action, next) => {
|
|
72
|
-
switch (action.type) {
|
|
73
|
-
case add:
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
75
|
-
// @ts-ignore
|
|
76
|
-
req.headers?.set('x-char', 'a,' + action.payload);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
next();
|
|
80
|
-
},
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
(req, action, next) => {
|
|
84
|
-
switch (action.type) {
|
|
85
|
-
case reassignment:
|
|
86
|
-
req = {
|
|
87
|
-
url: new URL('https://bad.com'),
|
|
88
|
-
headers: new Headers({ 'x-bad': 'true' }),
|
|
89
|
-
};
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
next();
|
|
93
|
-
},
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
(req, action, next) => {
|
|
97
|
-
switch (action.type) {
|
|
98
|
-
case mutateAction:
|
|
99
|
-
action.type = 'hello';
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
next();
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
export default middleware;
|
|
106
|
-
//# sourceMappingURL=request.effect.mock.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.effect.m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CAAC;QACD,IAAI,EAAE,CAAC;IACT,CAAC;IACD,6DAA6D;IAC7D,aAAa;IACb,CAAC,GAAsB,EAAE,MAAc,EAAE,IAAY,EAAQ,EAAE;QAC7D,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,YAAY;gBACf,GAAG,GAAG;oBACJ,GAAG,EAAE,IAAI,GAAG,CAAC,iBAAiB,CAAC;oBAC/B,OAAO,EAAE,IAAI,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;iBAC1C,CAAC;gBACF,MAAM;QACV,CAAC;QACD,IAAI,EAAE,CAAC;IACT,CAAC;IACD,6DAA6D;IAC7D,aAAa;IACb,CAAC,GAAsB,EAAE,MAAc,EAAE,IAAY,EAAQ,EAAE;QAC7D,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,YAAY;gBACf,MAAM,CAAC,IAAI,GAAG,OAAsB,CAAC;gBACrC,MAAM;QACV,CAAC;QACD,IAAI,EAAE,CAAC;IACT,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta, QueryReturnValue } from '@reduxjs/toolkit/query';
|
|
2
|
-
import type { ActionTypes } from './request.effect.unions.js';
|
|
3
|
-
export interface Action {
|
|
4
|
-
type: ActionTypes;
|
|
5
|
-
payload: any;
|
|
6
|
-
}
|
|
7
|
-
export interface ModifiedFetchArgs extends Omit<FetchArgs, 'url'> {
|
|
8
|
-
url: URL;
|
|
9
|
-
headers?: Headers;
|
|
10
|
-
}
|
|
11
|
-
export type RequestMiddleware = (req: ModifiedFetchArgs, action: Action, next: () => ModifiedFetchArgs) => void;
|
|
12
|
-
export interface RequestObj {
|
|
13
|
-
url: URL;
|
|
14
|
-
init: RequestInit;
|
|
15
|
-
}
|
|
16
|
-
export interface QueryApi {
|
|
17
|
-
applyMiddleware(middleware: RequestMiddleware[]): QueryApi;
|
|
18
|
-
applyQuery(callback: (request: FetchArgs) => Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>): Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=request.effect.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.effect.types.d.ts","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.types.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,WAAW,CAAC;IAElB,OAAO,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC;IAC/D,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC9B,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,iBAAiB,KAC1B,IAAI,CAAC;AAEV,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,eAAe,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,QAAQ,CAAC;IAC3D,UAAU,CACR,QAAQ,EAAE,CACR,OAAO,EAAE,SAAS,KACf,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC,GAC/E,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC,CAAC;CAChF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.effect.types.js","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const actionTypes: {
|
|
2
|
-
readonly start: "DAVINCI_START";
|
|
3
|
-
readonly next: "DAVINCI_NEXT";
|
|
4
|
-
readonly flow: "DAVINCI_FLOW";
|
|
5
|
-
readonly success: "DAVINCI_SUCCESS";
|
|
6
|
-
readonly error: "DAVINCI_ERROR";
|
|
7
|
-
readonly failure: "DAVINCI_FAILURE";
|
|
8
|
-
readonly resume: "DAVINCI_RESUME";
|
|
9
|
-
};
|
|
10
|
-
export type ActionTypes = (typeof actionTypes)[keyof typeof actionTypes];
|
|
11
|
-
export type EndpointTypes = keyof typeof actionTypes;
|
|
12
|
-
//# sourceMappingURL=request.effect.unions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.effect.unions.d.ts","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.unions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;;;;;CAQd,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -1,16 +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 const actionTypes = {
|
|
8
|
-
start: 'DAVINCI_START',
|
|
9
|
-
next: 'DAVINCI_NEXT',
|
|
10
|
-
flow: 'DAVINCI_FLOW',
|
|
11
|
-
success: 'DAVINCI_SUCCESS',
|
|
12
|
-
error: 'DAVINCI_ERROR',
|
|
13
|
-
failure: 'DAVINCI_FAILURE',
|
|
14
|
-
resume: 'DAVINCI_RESUME',
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=request.effect.unions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.effect.unions.js","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.unions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,iBAAiB;IAC1B,KAAK,EAAE,eAAe;IACtB,OAAO,EAAE,iBAAiB;IAC1B,MAAM,EAAE,gBAAgB;CAChB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta, QueryReturnValue } from '@reduxjs/toolkit/query';
|
|
2
|
-
import type { ActionTypes, EndpointTypes } from './request.effect.unions.js';
|
|
3
|
-
import type { ModifiedFetchArgs, RequestMiddleware } from './request.effect.types.js';
|
|
4
|
-
/**
|
|
5
|
-
* @function middlewareWrapper - A "Node" and "Redux" style middleware that is called just before
|
|
6
|
-
* the request is made from the SDK. This allows you access to the request for modification.
|
|
7
|
-
* @param request - A request object container of the URL and the Request Init object
|
|
8
|
-
* @param action - The action object that is passed into the middleware communicating intent
|
|
9
|
-
* @param action.type - A "Redux" style type that contains the serialized action
|
|
10
|
-
* @param action.payload - The payload of the action that can contain metadata
|
|
11
|
-
* @returns {function} - Function that takes middleware parameter & runs middleware against request
|
|
12
|
-
*/
|
|
13
|
-
export declare function middlewareWrapper(request: ModifiedFetchArgs, { type, payload }: {
|
|
14
|
-
type: ActionTypes;
|
|
15
|
-
payload?: any;
|
|
16
|
-
}): (middleware: RequestMiddleware[] | undefined) => ModifiedFetchArgs;
|
|
17
|
-
/**
|
|
18
|
-
* @function initQuery - Initializes a query object with the provided request object
|
|
19
|
-
* @param {FetchArgs} fetchArgs - The request object to initialize the query with
|
|
20
|
-
* @param {string} endpoint - The endpoint to be used for the query
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
export declare function initQuery(fetchArgs: FetchArgs, endpoint: EndpointTypes): {
|
|
24
|
-
applyMiddleware(middleware: RequestMiddleware[] | undefined): /*elided*/ any;
|
|
25
|
-
applyQuery(callback: (request: FetchArgs) => Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>): Promise<QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>>;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=request.effect.utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.effect.utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.utils.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEtF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,EAE1B,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,GACtD,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,SAAS,KAAK,iBAAiB,CAoBpE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa;gCAOvC,iBAAiB,EAAE,GAAG,SAAS;yBAS/C,CACR,OAAO,EAAE,SAAS,KACf,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;EAOrF"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { actionTypes } from './request.effect.unions.js';
|
|
2
|
-
/**
|
|
3
|
-
* @function middlewareWrapper - A "Node" and "Redux" style middleware that is called just before
|
|
4
|
-
* the request is made from the SDK. This allows you access to the request for modification.
|
|
5
|
-
* @param request - A request object container of the URL and the Request Init object
|
|
6
|
-
* @param action - The action object that is passed into the middleware communicating intent
|
|
7
|
-
* @param action.type - A "Redux" style type that contains the serialized action
|
|
8
|
-
* @param action.payload - The payload of the action that can contain metadata
|
|
9
|
-
* @returns {function} - Function that takes middleware parameter & runs middleware against request
|
|
10
|
-
*/
|
|
11
|
-
export function middlewareWrapper(request,
|
|
12
|
-
// eslint-disable-next-line
|
|
13
|
-
{ type, payload }) {
|
|
14
|
-
// no mutation and no reassignment
|
|
15
|
-
const actionCopy = Object.freeze({ type, payload });
|
|
16
|
-
return (middleware) => {
|
|
17
|
-
if (!Array.isArray(middleware)) {
|
|
18
|
-
return request;
|
|
19
|
-
}
|
|
20
|
-
// Copy middleware so the `shift` below doesn't mutate source
|
|
21
|
-
const mwareCopy = middleware.map((fn) => fn);
|
|
22
|
-
function iterator() {
|
|
23
|
-
const nextMiddlewareToBeCalled = mwareCopy.shift();
|
|
24
|
-
if (nextMiddlewareToBeCalled)
|
|
25
|
-
nextMiddlewareToBeCalled(request, actionCopy, iterator);
|
|
26
|
-
return request;
|
|
27
|
-
}
|
|
28
|
-
return iterator();
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @function initQuery - Initializes a query object with the provided request object
|
|
33
|
-
* @param {FetchArgs} fetchArgs - The request object to initialize the query with
|
|
34
|
-
* @param {string} endpoint - The endpoint to be used for the query
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
export function initQuery(fetchArgs, endpoint) {
|
|
38
|
-
let modifiedRequest = {
|
|
39
|
-
...fetchArgs,
|
|
40
|
-
url: new URL(fetchArgs.url),
|
|
41
|
-
headers: new Headers(fetchArgs.headers),
|
|
42
|
-
};
|
|
43
|
-
const queryApi = {
|
|
44
|
-
applyMiddleware(middleware) {
|
|
45
|
-
// Iterates and executes provided middleware functions
|
|
46
|
-
// Allow middleware to mutate `request` argument
|
|
47
|
-
const runMiddleware = middlewareWrapper(modifiedRequest, { type: actionTypes[endpoint] });
|
|
48
|
-
modifiedRequest = runMiddleware(middleware);
|
|
49
|
-
return queryApi;
|
|
50
|
-
},
|
|
51
|
-
async applyQuery(callback) {
|
|
52
|
-
return await callback({ ...modifiedRequest, url: modifiedRequest.url.toString() });
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
return queryApi;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=request.effect.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request.effect.utils.js","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.utils.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA0B;AAC1B,2BAA2B;AAC3B,EAAE,IAAI,EAAE,OAAO,EAAwC;IAEvD,kCAAkC;IAClC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAEpD,OAAO,CAAC,UAA2C,EAAE,EAAE;QACrD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,6DAA6D;QAC7D,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;QAE7C,SAAS,QAAQ;YACf,MAAM,w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