@forgerock/davinci-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.
- package/package.json +7 -6
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -9
- package/dist/src/index.js.map +0 -1
- package/dist/src/lib/client.store.d.ts +0 -352
- package/dist/src/lib/client.store.d.ts.map +0 -1
- package/dist/src/lib/client.store.js +0 -306
- package/dist/src/lib/client.store.js.map +0 -1
- package/dist/src/lib/client.store.utils.d.ts +0 -74
- package/dist/src/lib/client.store.utils.d.ts.map +0 -1
- package/dist/src/lib/client.store.utils.js +0 -48
- package/dist/src/lib/client.store.utils.js.map +0 -1
- package/dist/src/lib/client.types.d.ts +0 -21
- package/dist/src/lib/client.types.d.ts.map +0 -1
- package/dist/src/lib/client.types.js +0 -2
- package/dist/src/lib/client.types.js.map +0 -1
- package/dist/src/lib/collector.types.d.ts +0 -405
- package/dist/src/lib/collector.types.d.ts.map +0 -1
- package/dist/src/lib/collector.types.js +0 -8
- package/dist/src/lib/collector.types.js.map +0 -1
- package/dist/src/lib/collector.utils.d.ts +0 -132
- package/dist/src/lib/collector.utils.d.ts.map +0 -1
- package/dist/src/lib/collector.utils.js +0 -559
- package/dist/src/lib/collector.utils.js.map +0 -1
- package/dist/src/lib/config.slice.d.ts +0 -42
- package/dist/src/lib/config.slice.d.ts.map +0 -1
- package/dist/src/lib/config.slice.js +0 -59
- package/dist/src/lib/config.slice.js.map +0 -1
- package/dist/src/lib/config.types.d.ts +0 -12
- package/dist/src/lib/config.types.d.ts.map +0 -1
- package/dist/src/lib/config.types.js +0 -2
- package/dist/src/lib/config.types.js.map +0 -1
- package/dist/src/lib/davinci.api.d.ts +0 -31
- package/dist/src/lib/davinci.api.d.ts.map +0 -1
- package/dist/src/lib/davinci.api.js +0 -347
- package/dist/src/lib/davinci.api.js.map +0 -1
- package/dist/src/lib/davinci.types.d.ts +0 -285
- package/dist/src/lib/davinci.types.d.ts.map +0 -1
- package/dist/src/lib/davinci.types.js +0 -11
- package/dist/src/lib/davinci.types.js.map +0 -1
- package/dist/src/lib/davinci.utils.d.ts +0 -22
- package/dist/src/lib/davinci.utils.d.ts.map +0 -1
- package/dist/src/lib/davinci.utils.js +0 -169
- package/dist/src/lib/davinci.utils.js.map +0 -1
- package/dist/src/lib/index.d.ts +0 -3
- package/dist/src/lib/index.d.ts.map +0 -1
- package/dist/src/lib/index.js +0 -9
- package/dist/src/lib/index.js.map +0 -1
- package/dist/src/lib/node.reducer.d.ts +0 -27
- package/dist/src/lib/node.reducer.d.ts.map +0 -1
- package/dist/src/lib/node.reducer.js +0 -198
- package/dist/src/lib/node.reducer.js.map +0 -1
- package/dist/src/lib/node.slice.d.ts +0 -174
- package/dist/src/lib/node.slice.d.ts.map +0 -1
- package/dist/src/lib/node.slice.js +0 -261
- package/dist/src/lib/node.slice.js.map +0 -1
- package/dist/src/lib/node.types.d.ts +0 -119
- package/dist/src/lib/node.types.d.ts.map +0 -1
- package/dist/src/lib/node.types.js +0 -2
- package/dist/src/lib/node.types.js.map +0 -1
- package/dist/src/lib/node.utils.d.ts +0 -4
- package/dist/src/lib/node.utils.d.ts.map +0 -1
- package/dist/src/lib/node.utils.js +0 -32
- package/dist/src/lib/node.utils.js.map +0 -1
- package/dist/src/lib/wellknown.api.d.ts +0 -5
- package/dist/src/lib/wellknown.api.d.ts.map +0 -1
- package/dist/src/lib/wellknown.api.js +0 -22
- package/dist/src/lib/wellknown.api.js.map +0 -1
- package/dist/src/lib/wellknown.types.d.ts +0 -38
- package/dist/src/lib/wellknown.types.d.ts.map +0 -1
- package/dist/src/lib/wellknown.types.js +0 -2
- package/dist/src/lib/wellknown.types.js.map +0 -1
- package/dist/src/types.d.ts +0 -41
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -7
- package/dist/src/types.js.map +0 -1
|
@@ -1,198 +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 required utilities from Redux Toolkit
|
|
9
|
-
*/
|
|
10
|
-
import { createAction, createReducer } from '@reduxjs/toolkit';
|
|
11
|
-
/**
|
|
12
|
-
* Import the collector utilities
|
|
13
|
-
*/
|
|
14
|
-
import { returnActionCollector, returnFlowCollector, returnPasswordCollector, returnIdpCollector, returnSubmitCollector, returnTextCollector, returnSingleSelectCollector, returnMultiSelectCollector, returnReadOnlyCollector, returnObjectSelectCollector, returnObjectValueCollector, returnProtectCollector, returnUnknownCollector, } from './collector.utils.js';
|
|
15
|
-
/**
|
|
16
|
-
* @const nextCollectorValues - Action for setting the next collector values
|
|
17
|
-
* @see https://redux-toolkit.js.org/api/createAction
|
|
18
|
-
*
|
|
19
|
-
* This is for internal "collector" setup for handling the state of the current node
|
|
20
|
-
*/
|
|
21
|
-
export const nextCollectorValues = createAction('node/next');
|
|
22
|
-
export const updateCollectorValues = createAction('node/update');
|
|
23
|
-
/**
|
|
24
|
-
* @const initialCollectorValues - Initial state for the collector values
|
|
25
|
-
*/
|
|
26
|
-
const initialCollectorValues = [];
|
|
27
|
-
/**
|
|
28
|
-
* @const nodeCollectorReducer - Reducer for handling the collector values
|
|
29
|
-
* @see https://redux-toolkit.js.org/api/createReducer
|
|
30
|
-
*/
|
|
31
|
-
export const nodeCollectorReducer = createReducer(initialCollectorValues, (builder) => {
|
|
32
|
-
builder
|
|
33
|
-
/**
|
|
34
|
-
* Using the `nextCollectorValues` const (e.g. `'node/next'`) to add the case
|
|
35
|
-
* 'node/next' is essentially derived `createSlice` below. `node.next()` is
|
|
36
|
-
* transformed to `'node/next'` for the action type.
|
|
37
|
-
*/
|
|
38
|
-
.addCase(nextCollectorValues, (_, action) => {
|
|
39
|
-
const fields = action.payload.fields;
|
|
40
|
-
// Map the fields to the initial state with the schema of Generic Collector
|
|
41
|
-
const collectors = Array.isArray(fields)
|
|
42
|
-
? fields.map((field, idx) => {
|
|
43
|
-
/**
|
|
44
|
-
* Some collectors may not have the same properties as others;
|
|
45
|
-
* LABEL field types are one of them, so let's catch them first.
|
|
46
|
-
*/
|
|
47
|
-
if (field.type === 'LABEL') {
|
|
48
|
-
return returnReadOnlyCollector(field, idx);
|
|
49
|
-
}
|
|
50
|
-
// *Some* collectors may have default or existing data to display
|
|
51
|
-
const data = action.payload.formData &&
|
|
52
|
-
action.payload.formData.value &&
|
|
53
|
-
action.payload.formData.value[field.key];
|
|
54
|
-
// Match specific collectors
|
|
55
|
-
switch (field.type) {
|
|
56
|
-
case 'CHECKBOX':
|
|
57
|
-
case 'COMBOBOX': {
|
|
58
|
-
// Intentional fall-through
|
|
59
|
-
const strArr = data;
|
|
60
|
-
return returnMultiSelectCollector(field, idx, strArr);
|
|
61
|
-
}
|
|
62
|
-
case 'DROPDOWN':
|
|
63
|
-
case 'RADIO': {
|
|
64
|
-
// Intentional fall-through
|
|
65
|
-
const str = data;
|
|
66
|
-
return returnSingleSelectCollector(field, idx, str);
|
|
67
|
-
}
|
|
68
|
-
case 'FLOW_BUTTON':
|
|
69
|
-
case 'FLOW_LINK': {
|
|
70
|
-
// Intentional fall-through
|
|
71
|
-
// No data to send
|
|
72
|
-
return returnFlowCollector(field, idx);
|
|
73
|
-
}
|
|
74
|
-
case 'DEVICE_AUTHENTICATION':
|
|
75
|
-
case 'DEVICE_REGISTRATION': {
|
|
76
|
-
// Intentional fall-through
|
|
77
|
-
return returnObjectSelectCollector(field, idx);
|
|
78
|
-
}
|
|
79
|
-
case 'PASSWORD':
|
|
80
|
-
case 'PASSWORD_VERIFY': {
|
|
81
|
-
// No data to send
|
|
82
|
-
return returnPasswordCollector(field, idx);
|
|
83
|
-
}
|
|
84
|
-
case 'PHONE_NUMBER': {
|
|
85
|
-
const prefillData = data;
|
|
86
|
-
return returnObjectValueCollector(field, idx, prefillData);
|
|
87
|
-
}
|
|
88
|
-
case 'TEXT': {
|
|
89
|
-
const str = data;
|
|
90
|
-
return returnTextCollector(field, idx, str);
|
|
91
|
-
}
|
|
92
|
-
case 'SOCIAL_LOGIN_BUTTON': {
|
|
93
|
-
// No data to send
|
|
94
|
-
return returnIdpCollector(field, idx);
|
|
95
|
-
}
|
|
96
|
-
case 'SUBMIT_BUTTON': {
|
|
97
|
-
// No data to send
|
|
98
|
-
return returnSubmitCollector(field, idx);
|
|
99
|
-
}
|
|
100
|
-
case 'PROTECT': {
|
|
101
|
-
const str = data;
|
|
102
|
-
return returnProtectCollector(field, idx, str);
|
|
103
|
-
}
|
|
104
|
-
default:
|
|
105
|
-
// Default is handled below
|
|
106
|
-
}
|
|
107
|
-
// Generic Collectors
|
|
108
|
-
if (field.type.includes('BUTTON') || field.type.includes('LINK')) {
|
|
109
|
-
// No data to send
|
|
110
|
-
return returnActionCollector(field, idx, 'ActionCollector');
|
|
111
|
-
}
|
|
112
|
-
return returnUnknownCollector(field, idx);
|
|
113
|
-
})
|
|
114
|
-
: [];
|
|
115
|
-
return collectors || [];
|
|
116
|
-
})
|
|
117
|
-
/**
|
|
118
|
-
* Using the `updateCollectorValues` const (e.g. `'node/update'`) to add the case
|
|
119
|
-
* 'node/next' is essentially derived `createSlice` below. `node.next()` is
|
|
120
|
-
* transformed to `'node/next'` for the action type.
|
|
121
|
-
*/
|
|
122
|
-
.addCase(updateCollectorValues, (state, action) => {
|
|
123
|
-
const collector = state.find((collector) => collector.id === action.payload.id);
|
|
124
|
-
if (!collector) {
|
|
125
|
-
throw new Error('No collector found to update');
|
|
126
|
-
}
|
|
127
|
-
if (collector.category === 'ActionCollector') {
|
|
128
|
-
throw new Error('ActionCollectors are read-only');
|
|
129
|
-
}
|
|
130
|
-
if (collector.category === 'NoValueCollector') {
|
|
131
|
-
throw new Error('NoValueCollectors, like ReadOnlyCollectors, are read-only');
|
|
132
|
-
}
|
|
133
|
-
if (action.payload.value === undefined) {
|
|
134
|
-
throw new Error('Value argument cannot be undefined');
|
|
135
|
-
}
|
|
136
|
-
if (collector.category === 'SingleValueCollector' ||
|
|
137
|
-
collector.category === 'ValidatedSingleValueCollector' ||
|
|
138
|
-
collector.category === 'SingleValueAutoCollector') {
|
|
139
|
-
if (typeof action.payload.value !== 'string') {
|
|
140
|
-
throw new Error('Value argument must be a string');
|
|
141
|
-
}
|
|
142
|
-
collector.input.value = action.payload.value;
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
if (collector.category === 'MultiValueCollector') {
|
|
146
|
-
if (typeof action.payload.value !== 'string' && !Array.isArray(action.payload.value)) {
|
|
147
|
-
throw new Error('MultiValueCollector does not accept an object');
|
|
148
|
-
}
|
|
149
|
-
if (Array.isArray(action.payload.value)) {
|
|
150
|
-
collector.input.value = [...action.payload.value];
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
collector.input.value.push(action.payload.value);
|
|
154
|
-
}
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (collector.type === 'DeviceAuthenticationCollector') {
|
|
158
|
-
if (typeof action.payload.id !== 'string') {
|
|
159
|
-
throw new Error('Index argument must be a string');
|
|
160
|
-
}
|
|
161
|
-
// Iterate through the options object and find option to update
|
|
162
|
-
const option = collector.output.options.find((option) => option.value === action.payload.value);
|
|
163
|
-
if (!option) {
|
|
164
|
-
throw new Error('No option found matching value to update');
|
|
165
|
-
}
|
|
166
|
-
// Remap values back to DaVinci spec
|
|
167
|
-
collector.input.value = {
|
|
168
|
-
type: option.type,
|
|
169
|
-
id: option.value,
|
|
170
|
-
value: option.content,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
if (collector.type === 'DeviceRegistrationCollector') {
|
|
174
|
-
if (typeof action.payload.id !== 'string') {
|
|
175
|
-
throw new Error('Index argument must be a string');
|
|
176
|
-
}
|
|
177
|
-
// Iterate through the options object and find option to update
|
|
178
|
-
const option = collector.output.options.find((option) => option.value === action.payload.value);
|
|
179
|
-
if (!option) {
|
|
180
|
-
throw new Error('No option found matching value to update');
|
|
181
|
-
}
|
|
182
|
-
collector.input.value = option.type;
|
|
183
|
-
}
|
|
184
|
-
if (collector.type === 'PhoneNumberCollector') {
|
|
185
|
-
if (typeof action.payload.id !== 'string') {
|
|
186
|
-
throw new Error('Index argument must be a string');
|
|
187
|
-
}
|
|
188
|
-
if (typeof action.payload.value !== 'object') {
|
|
189
|
-
throw new Error('Value argument must be an object');
|
|
190
|
-
}
|
|
191
|
-
if (!('phoneNumber' in action.payload.value) || !('countryCode' in action.payload.value)) {
|
|
192
|
-
throw new Error('Value argument must contain a phoneNumber and countryCode property');
|
|
193
|
-
}
|
|
194
|
-
collector.input.value = action.payload.value;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
//# sourceMappingURL=node.reducer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.reducer.js","sourceRoot":"","sources":["../../../src/lib/node.reducer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;GAEG;AACH,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAuB9B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAG5C,WAAW,CAAC,CAAC;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAI9C,aAAa,CAAC,CAAC;AAElB;;GAEG;AACH,MAAM,sBAAsB,GAiBtB,EAAE,CA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AAC,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzF,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;YACxF,CAAC;YACD,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAC/C,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Import the needed reducers
|
|
3
|
-
*/
|
|
4
|
-
import { updateCollectorValues } from './node.reducer.js';
|
|
5
|
-
/**
|
|
6
|
-
* Import the types
|
|
7
|
-
*/
|
|
8
|
-
import type { PayloadAction } from '@reduxjs/toolkit';
|
|
9
|
-
import type { DavinciErrorResponse, DaVinciFailureResponse, DaVinciNextResponse, DaVinciSuccessResponse } from './davinci.types.js';
|
|
10
|
-
import type { ContinueNode, SuccessNode, ErrorNode, StartNode, FailureNode } from './node.types.js';
|
|
11
|
-
/**
|
|
12
|
-
* @const initialNodeState - Initial state for the node slice
|
|
13
|
-
*/
|
|
14
|
-
export declare const initialNodeState: {
|
|
15
|
-
cache: null;
|
|
16
|
-
client: {
|
|
17
|
-
status: "start";
|
|
18
|
-
};
|
|
19
|
-
error: null;
|
|
20
|
-
server: {
|
|
21
|
-
status: "start";
|
|
22
|
-
};
|
|
23
|
-
status: "start";
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* @const nodeSlice - Slice for handling the node state
|
|
27
|
-
* @see https://redux-toolkit.js.org/api/createSlice
|
|
28
|
-
*/
|
|
29
|
-
export declare const nodeSlice: import("@reduxjs/toolkit").Slice<ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode, {
|
|
30
|
-
/**
|
|
31
|
-
* @method error - Method for creating an error node
|
|
32
|
-
* @param {Object} state - The current state of the slice
|
|
33
|
-
* @param {PayloadAction<DaVinciErrorCacheEntry<DavinciErrorResponse>>} action - The action to be dispatched
|
|
34
|
-
* @returns {ErrorNode} - The error node
|
|
35
|
-
*/
|
|
36
|
-
error(state: import("immer").WritableDraft<ContinueNode> | import("immer").WritableDraft<ErrorNode> | import("immer").WritableDraft<FailureNode> | import("immer").WritableDraft<StartNode> | import("immer").WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
37
|
-
data: DavinciErrorResponse;
|
|
38
|
-
requestId: string;
|
|
39
|
-
httpStatus: number;
|
|
40
|
-
}>): import("immer").WritableDraft<ErrorNode>;
|
|
41
|
-
/**
|
|
42
|
-
* @method failure - Method for creating an error node
|
|
43
|
-
* @param {Object} state - The current state of the slice
|
|
44
|
-
* @param {PayloadAction<DaVinciFailureResponse>} action - The action to be dispatched
|
|
45
|
-
* @returns {FailureNode} - The error node
|
|
46
|
-
*/
|
|
47
|
-
failure(state: import("immer").WritableDraft<ContinueNode> | import("immer").WritableDraft<ErrorNode> | import("immer").WritableDraft<FailureNode> | import("immer").WritableDraft<StartNode> | import("immer").WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
48
|
-
data: DaVinciFailureResponse | unknown;
|
|
49
|
-
requestId: string;
|
|
50
|
-
httpStatus: number;
|
|
51
|
-
}>): import("immer").WritableDraft<FailureNode>;
|
|
52
|
-
/**
|
|
53
|
-
* @method next - Method for creating a next node
|
|
54
|
-
* @param {Object} state - The current state of the slice
|
|
55
|
-
* @param {PayloadAction<DaVinciNextResponse>} action - The action to be dispatched
|
|
56
|
-
* @returns {ContinueNode} - The next node
|
|
57
|
-
*/
|
|
58
|
-
next(state: import("immer").WritableDraft<ContinueNode> | import("immer").WritableDraft<ErrorNode> | import("immer").WritableDraft<FailureNode> | import("immer").WritableDraft<StartNode> | import("immer").WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
59
|
-
data: DaVinciNextResponse;
|
|
60
|
-
requestId: string;
|
|
61
|
-
httpStatus: number;
|
|
62
|
-
}>): import("immer").WritableDraft<ContinueNode>;
|
|
63
|
-
/**
|
|
64
|
-
* @method start - Method for creating a start node
|
|
65
|
-
* @param {Object} state - The current state of the slice
|
|
66
|
-
* @returns {StartNode} - The start node
|
|
67
|
-
*/
|
|
68
|
-
success(state: import("immer").WritableDraft<ContinueNode> | import("immer").WritableDraft<ErrorNode> | import("immer").WritableDraft<FailureNode> | import("immer").WritableDraft<StartNode> | import("immer").WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
69
|
-
data: DaVinciSuccessResponse;
|
|
70
|
-
requestId: string;
|
|
71
|
-
httpStatus: number;
|
|
72
|
-
}>): import("immer").WritableDraft<SuccessNode>;
|
|
73
|
-
/**
|
|
74
|
-
* @method update - Method for updating collector values with the node
|
|
75
|
-
* @param {Object} state - The current state of the slice
|
|
76
|
-
* @param {PayloadAction<unknown>} action - The action to be dispatched
|
|
77
|
-
* @returns {ContinueNode} - The next node
|
|
78
|
-
*/
|
|
79
|
-
update(state: import("immer").WritableDraft<ContinueNode> | import("immer").WritableDraft<ErrorNode> | import("immer").WritableDraft<FailureNode> | import("immer").WritableDraft<StartNode> | import("immer").WritableDraft<SuccessNode>, action: ReturnType<typeof updateCollectorValues>): import("immer").WritableDraft<ContinueNode>;
|
|
80
|
-
}, "node", "node", {
|
|
81
|
-
selectClient: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => {
|
|
82
|
-
action: string;
|
|
83
|
-
collectors: import("./node.types.js").Collectors[];
|
|
84
|
-
description?: string;
|
|
85
|
-
name?: string;
|
|
86
|
-
status: "continue";
|
|
87
|
-
} | {
|
|
88
|
-
action: string;
|
|
89
|
-
collectors: import("./node.types.js").Collectors[];
|
|
90
|
-
description?: string;
|
|
91
|
-
name?: string;
|
|
92
|
-
status: "error";
|
|
93
|
-
} | {
|
|
94
|
-
status: "failure";
|
|
95
|
-
} | {
|
|
96
|
-
status: "start";
|
|
97
|
-
} | {
|
|
98
|
-
authorization?: {
|
|
99
|
-
code?: string;
|
|
100
|
-
state?: string;
|
|
101
|
-
};
|
|
102
|
-
status: "success";
|
|
103
|
-
} | null;
|
|
104
|
-
selectCollectors: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => {
|
|
105
|
-
error: null;
|
|
106
|
-
state: import("./node.types.js").Collectors[];
|
|
107
|
-
} | {
|
|
108
|
-
error: {
|
|
109
|
-
readonly code: "unknown";
|
|
110
|
-
readonly type: "state_error";
|
|
111
|
-
readonly message: "`collectors` are only available on nodes with `status` of continue or error";
|
|
112
|
-
};
|
|
113
|
-
state: never[];
|
|
114
|
-
};
|
|
115
|
-
selectCollector: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode, id: string) => {
|
|
116
|
-
error: null;
|
|
117
|
-
state: import("./node.types.js").Collectors | undefined;
|
|
118
|
-
} | {
|
|
119
|
-
error: {
|
|
120
|
-
readonly code: "unknown";
|
|
121
|
-
readonly type: "state_error";
|
|
122
|
-
readonly message: "`collectors` are only available on nodes with `status` of continue or error";
|
|
123
|
-
};
|
|
124
|
-
state: null;
|
|
125
|
-
};
|
|
126
|
-
selectError: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => import("./node.types.js").DaVinciError | null;
|
|
127
|
-
selectErrorCollectors: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => {
|
|
128
|
-
error: null;
|
|
129
|
-
state: import("./node.types.js").CollectorErrors[];
|
|
130
|
-
} | {
|
|
131
|
-
error: {
|
|
132
|
-
readonly code: "unknown";
|
|
133
|
-
readonly type: "state_error";
|
|
134
|
-
readonly message: "`errorCollectors` are only available on nodes with `status` of error";
|
|
135
|
-
};
|
|
136
|
-
state: never[];
|
|
137
|
-
};
|
|
138
|
-
selectServer: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => {
|
|
139
|
-
_links?: import("./davinci.types.js").Links;
|
|
140
|
-
id?: string;
|
|
141
|
-
interactionId?: string;
|
|
142
|
-
interactionToken?: string;
|
|
143
|
-
href?: string;
|
|
144
|
-
eventName?: string;
|
|
145
|
-
status: "continue";
|
|
146
|
-
} | {
|
|
147
|
-
_links?: import("./davinci.types.js").Links;
|
|
148
|
-
eventName?: string;
|
|
149
|
-
id?: string;
|
|
150
|
-
interactionId?: string;
|
|
151
|
-
interactionToken?: string;
|
|
152
|
-
status: "error";
|
|
153
|
-
} | {
|
|
154
|
-
_links?: import("./davinci.types.js").Links;
|
|
155
|
-
eventName?: string;
|
|
156
|
-
href?: string;
|
|
157
|
-
id?: string;
|
|
158
|
-
interactionId?: string;
|
|
159
|
-
interactionToken?: string;
|
|
160
|
-
status: "failure";
|
|
161
|
-
} | {
|
|
162
|
-
status: "start";
|
|
163
|
-
} | {
|
|
164
|
-
_links?: import("./davinci.types.js").Links;
|
|
165
|
-
eventName?: string;
|
|
166
|
-
id?: string;
|
|
167
|
-
interactionId?: string;
|
|
168
|
-
interactionToken?: string;
|
|
169
|
-
href?: string;
|
|
170
|
-
session?: string;
|
|
171
|
-
status: "success";
|
|
172
|
-
} | null;
|
|
173
|
-
}>;
|
|
174
|
-
//# sourceMappingURL=node.slice.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.slice.d.ts","sourceRoot":"","sources":["../../../src/lib/node.slice.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,OAAO,EAAwB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGhF;;GAEG;AACH,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAWpG;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUR,CAAC;AAItB;;;GAGG;AACH,eAAO,MAAM,SAAS;IAIlB;;;;;OAKG;sPAGO,aAAa,CAAC;QAAE,IAAI,EAAE,oBAAoB,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAsC9F;;;;;OAKG;wPAGO,aAAa,CAAC;QACpB,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC;QACvC,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IA2CJ;;;;;OAKG;qPAGO,aAAa,CAAC;QACpB,IAAI,EAAE,mBAAmB,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IA8CJ;;;;OAIG;wPAGO,aAAa,CAAC;QACpB,IAAI,EAAE,sBAAsB,CAAC;QAC7B,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IA+BJ;;;;;OAKG;uPACmB,UAAU,CAAC,OAAO,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;gBAzK5D,CAAN;iBAEW,CAAC;;;;;;;;;;;;;;;mGAmMqB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCrC,CAAC"}
|
|
@@ -1,261 +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 required utilities from Redux Toolkit
|
|
9
|
-
*/
|
|
10
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
11
|
-
/**
|
|
12
|
-
* Import the needed reducers
|
|
13
|
-
*/
|
|
14
|
-
import { nodeCollectorReducer } from './node.reducer.js';
|
|
15
|
-
import { getCollectorErrors } from './node.utils.js';
|
|
16
|
-
/**
|
|
17
|
-
* The possible statuses for the four types of nodes
|
|
18
|
-
*/
|
|
19
|
-
const CONTINUE_STATUS = 'continue';
|
|
20
|
-
const ERROR_STATUS = 'error';
|
|
21
|
-
const FAILURE_STATUS = 'failure';
|
|
22
|
-
const SUCCESS_STATUS = 'success';
|
|
23
|
-
const START_STATUS = 'start';
|
|
24
|
-
/**
|
|
25
|
-
* @const initialNodeState - Initial state for the node slice
|
|
26
|
-
*/
|
|
27
|
-
export const initialNodeState = {
|
|
28
|
-
cache: null,
|
|
29
|
-
client: {
|
|
30
|
-
status: START_STATUS,
|
|
31
|
-
},
|
|
32
|
-
error: null,
|
|
33
|
-
server: {
|
|
34
|
-
status: START_STATUS,
|
|
35
|
-
},
|
|
36
|
-
status: START_STATUS,
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* @const nodeSlice - Slice for handling the node state
|
|
40
|
-
* @see https://redux-toolkit.js.org/api/createSlice
|
|
41
|
-
*/
|
|
42
|
-
export const nodeSlice = createSlice({
|
|
43
|
-
name: 'node',
|
|
44
|
-
initialState: initialNodeState,
|
|
45
|
-
reducers: {
|
|
46
|
-
/**
|
|
47
|
-
* @method error - Method for creating an error node
|
|
48
|
-
* @param {Object} state - The current state of the slice
|
|
49
|
-
* @param {PayloadAction<DaVinciErrorCacheEntry<DavinciErrorResponse>>} action - The action to be dispatched
|
|
50
|
-
* @returns {ErrorNode} - The error node
|
|
51
|
-
*/
|
|
52
|
-
error(state, action) {
|
|
53
|
-
const newState = state;
|
|
54
|
-
// Reference to the original response from DaVinci in the cache
|
|
55
|
-
newState.cache = {
|
|
56
|
-
key: action.payload.requestId,
|
|
57
|
-
};
|
|
58
|
-
// Data for the client to consume
|
|
59
|
-
newState.client = {
|
|
60
|
-
...state.client,
|
|
61
|
-
status: ERROR_STATUS,
|
|
62
|
-
};
|
|
63
|
-
newState.error = {
|
|
64
|
-
code: action.payload.data.code,
|
|
65
|
-
collectors: getCollectorErrors(action.payload.data),
|
|
66
|
-
message: action.payload.data.message,
|
|
67
|
-
internalHttpStatus: action.payload.data.httpResponseCode,
|
|
68
|
-
status: 'error',
|
|
69
|
-
type: 'davinci_error',
|
|
70
|
-
};
|
|
71
|
-
newState.httpStatus = action.payload.httpStatus;
|
|
72
|
-
// Data that the server users
|
|
73
|
-
newState.server = {
|
|
74
|
-
...state.server,
|
|
75
|
-
status: ERROR_STATUS,
|
|
76
|
-
};
|
|
77
|
-
// Used to help detect the node type
|
|
78
|
-
newState.status = ERROR_STATUS;
|
|
79
|
-
return newState;
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* @method failure - Method for creating an error node
|
|
83
|
-
* @param {Object} state - The current state of the slice
|
|
84
|
-
* @param {PayloadAction<DaVinciFailureResponse>} action - The action to be dispatched
|
|
85
|
-
* @returns {FailureNode} - The error node
|
|
86
|
-
*/
|
|
87
|
-
failure(state, action) {
|
|
88
|
-
const newState = state;
|
|
89
|
-
newState.cache = {
|
|
90
|
-
key: action.payload.requestId,
|
|
91
|
-
};
|
|
92
|
-
newState.client = {
|
|
93
|
-
status: FAILURE_STATUS,
|
|
94
|
-
};
|
|
95
|
-
if (action.payload.data && typeof action.payload.data === 'object') {
|
|
96
|
-
const data = action.payload.data;
|
|
97
|
-
newState.error = {
|
|
98
|
-
code: data['code'] || 'unknown',
|
|
99
|
-
message: data['message'] || data['errorMessage'] || '',
|
|
100
|
-
internalHttpStatus: typeof data['httpResponseCode'] === 'number' ? data['httpResponseCode'] : 0,
|
|
101
|
-
status: FAILURE_STATUS,
|
|
102
|
-
type: 'davinci_error',
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
newState.error = {
|
|
107
|
-
code: 'unknown',
|
|
108
|
-
message: 'An unknown error occurred',
|
|
109
|
-
status: FAILURE_STATUS,
|
|
110
|
-
type: 'network_error',
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
newState.httpStatus = action.payload.httpStatus;
|
|
114
|
-
newState.server = {
|
|
115
|
-
status: FAILURE_STATUS,
|
|
116
|
-
};
|
|
117
|
-
newState.status = FAILURE_STATUS;
|
|
118
|
-
return newState;
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* @method next - Method for creating a next node
|
|
122
|
-
* @param {Object} state - The current state of the slice
|
|
123
|
-
* @param {PayloadAction<DaVinciNextResponse>} action - The action to be dispatched
|
|
124
|
-
* @returns {ContinueNode} - The next node
|
|
125
|
-
*/
|
|
126
|
-
next(state, action) {
|
|
127
|
-
const newState = state;
|
|
128
|
-
const collectors = nodeCollectorReducer([], {
|
|
129
|
-
type: action.type,
|
|
130
|
-
payload: {
|
|
131
|
-
fields: action.payload.data?.form?.components?.fields,
|
|
132
|
-
formData: action.payload.data?.formData,
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
const submitCollector = collectors.filter((collector) => collector.type === 'SubmitCollector')[0];
|
|
136
|
-
newState.cache = {
|
|
137
|
-
key: action.payload.requestId,
|
|
138
|
-
};
|
|
139
|
-
newState.client = {
|
|
140
|
-
action: submitCollector?.output.key,
|
|
141
|
-
description: action.payload.data?.form?.description,
|
|
142
|
-
collectors,
|
|
143
|
-
name: action.payload.data.form?.name,
|
|
144
|
-
status: CONTINUE_STATUS,
|
|
145
|
-
};
|
|
146
|
-
newState.error = null;
|
|
147
|
-
newState.httpStatus = action.payload.httpStatus;
|
|
148
|
-
newState.server = {
|
|
149
|
-
_links: action.payload.data._links,
|
|
150
|
-
id: action.payload.data.id,
|
|
151
|
-
interactionId: action.payload.data.interactionId,
|
|
152
|
-
interactionToken: action.payload.data.interactionToken,
|
|
153
|
-
eventName: action.payload.data.eventName || 'continue',
|
|
154
|
-
status: CONTINUE_STATUS,
|
|
155
|
-
};
|
|
156
|
-
// Used to help detect the node type
|
|
157
|
-
newState.status = CONTINUE_STATUS;
|
|
158
|
-
return newState;
|
|
159
|
-
},
|
|
160
|
-
/**
|
|
161
|
-
* @method start - Method for creating a start node
|
|
162
|
-
* @param {Object} state - The current state of the slice
|
|
163
|
-
* @returns {StartNode} - The start node
|
|
164
|
-
*/
|
|
165
|
-
success(state, action) {
|
|
166
|
-
const newState = state;
|
|
167
|
-
newState.cache = {
|
|
168
|
-
key: action.payload.requestId,
|
|
169
|
-
};
|
|
170
|
-
newState.client = {
|
|
171
|
-
authorization: {
|
|
172
|
-
code: action.payload.data.authorizeResponse?.code,
|
|
173
|
-
state: action.payload.data.authorizeResponse?.state,
|
|
174
|
-
},
|
|
175
|
-
status: SUCCESS_STATUS,
|
|
176
|
-
};
|
|
177
|
-
newState.httpStatus = action.payload.httpStatus;
|
|
178
|
-
newState.server = {
|
|
179
|
-
id: action.payload.data.id,
|
|
180
|
-
interactionId: action.payload.data.interactionId,
|
|
181
|
-
interactionToken: action.payload.data.interactionToken,
|
|
182
|
-
session: action.payload.data.session?.id,
|
|
183
|
-
status: SUCCESS_STATUS,
|
|
184
|
-
};
|
|
185
|
-
newState.error = null;
|
|
186
|
-
newState.status = SUCCESS_STATUS;
|
|
187
|
-
return newState;
|
|
188
|
-
},
|
|
189
|
-
/**
|
|
190
|
-
* @method update - Method for updating collector values with the node
|
|
191
|
-
* @param {Object} state - The current state of the slice
|
|
192
|
-
* @param {PayloadAction<unknown>} action - The action to be dispatched
|
|
193
|
-
* @returns {ContinueNode} - The next node
|
|
194
|
-
*/
|
|
195
|
-
update(state, action) {
|
|
196
|
-
const newState = state;
|
|
197
|
-
newState.client.collectors = nodeCollectorReducer(newState.client.collectors, action);
|
|
198
|
-
return newState;
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
selectors: {
|
|
202
|
-
selectClient: (state) => {
|
|
203
|
-
return state.client;
|
|
204
|
-
},
|
|
205
|
-
selectCollectors: (state) => {
|
|
206
|
-
if (state.client && 'collectors' in state.client) {
|
|
207
|
-
return {
|
|
208
|
-
error: null,
|
|
209
|
-
state: state?.client.collectors,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
return {
|
|
213
|
-
error: {
|
|
214
|
-
code: 'unknown',
|
|
215
|
-
type: 'state_error',
|
|
216
|
-
message: `\`collectors\` are only available on nodes with \`status\` of ${CONTINUE_STATUS} or ${ERROR_STATUS}`,
|
|
217
|
-
},
|
|
218
|
-
state: [],
|
|
219
|
-
};
|
|
220
|
-
},
|
|
221
|
-
selectCollector: (state, id) => {
|
|
222
|
-
if (state.client && 'collectors' in state.client) {
|
|
223
|
-
return {
|
|
224
|
-
error: null,
|
|
225
|
-
state: state.client.collectors?.find((collector) => collector.id === id),
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
return {
|
|
229
|
-
error: {
|
|
230
|
-
code: 'unknown',
|
|
231
|
-
type: 'state_error',
|
|
232
|
-
message: `\`collectors\` are only available on nodes with \`status\` of ${CONTINUE_STATUS} or ${ERROR_STATUS}`,
|
|
233
|
-
},
|
|
234
|
-
state: null,
|
|
235
|
-
};
|
|
236
|
-
},
|
|
237
|
-
selectError: (state) => {
|
|
238
|
-
return state.error;
|
|
239
|
-
},
|
|
240
|
-
selectErrorCollectors: (state) => {
|
|
241
|
-
if (state.status === ERROR_STATUS) {
|
|
242
|
-
return {
|
|
243
|
-
error: null,
|
|
244
|
-
state: state.error?.collectors || [],
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
return {
|
|
248
|
-
error: {
|
|
249
|
-
code: 'unknown',
|
|
250
|
-
type: 'state_error',
|
|
251
|
-
message: `\`errorCollectors\` are only available on nodes with \`status\` of ${ERROR_STATUS}`,
|
|
252
|
-
},
|
|
253
|
-
state: [],
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
selectServer: (state) => {
|
|
257
|
-
return state.server;
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
//# sourceMappingURL=node.slice.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.slice.js","sourceRoot":"","sources":["../../../src/lib/node.slice.ts"],"names":[],"mappings":"AAAA;;;;;GAK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