@forgerock/davinci-client 0.0.0-beta-20250414111925 → 0.0.0-beta-20250414113129
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/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/authorize.utils.d.ts +22 -0
- package/dist/src/lib/authorize.utils.d.ts.map +1 -0
- package/dist/src/lib/authorize.utils.js +47 -0
- package/dist/src/lib/authorize.utils.js.map +1 -0
- package/dist/src/lib/client.store.d.ts +351 -0
- package/dist/src/lib/client.store.d.ts.map +1 -0
- package/dist/src/lib/client.store.js +295 -0
- package/dist/src/lib/client.store.js.map +1 -0
- package/dist/src/lib/client.store.utils.d.ts +61 -0
- package/dist/src/lib/client.store.utils.d.ts.map +1 -0
- package/dist/src/lib/client.store.utils.js +35 -0
- package/dist/src/lib/client.store.utils.js.map +1 -0
- package/dist/src/lib/client.types.d.ts +17 -0
- package/dist/src/lib/client.types.d.ts.map +1 -0
- package/dist/src/lib/client.types.js +2 -0
- package/dist/src/lib/client.types.js.map +1 -0
- package/dist/src/lib/collector.types.d.ts +255 -0
- package/dist/src/lib/collector.types.d.ts.map +1 -0
- package/dist/src/lib/collector.types.js +11 -0
- package/dist/src/lib/collector.types.js.map +1 -0
- package/dist/src/lib/collector.utils.d.ts +100 -0
- package/dist/src/lib/collector.utils.d.ts.map +1 -0
- package/dist/src/lib/collector.utils.js +349 -0
- package/dist/src/lib/collector.utils.js.map +1 -0
- package/dist/src/lib/config.slice.d.ts +42 -0
- package/dist/src/lib/config.slice.d.ts.map +1 -0
- package/dist/src/lib/config.slice.js +59 -0
- package/dist/src/lib/config.slice.js.map +1 -0
- package/dist/src/lib/config.types.d.ts +12 -0
- package/dist/src/lib/config.types.d.ts.map +1 -0
- package/dist/src/lib/config.types.js +2 -0
- package/dist/src/lib/config.types.js.map +1 -0
- package/dist/src/lib/davinci.api.d.ts +29 -0
- package/dist/src/lib/davinci.api.d.ts.map +1 -0
- package/dist/src/lib/davinci.api.js +333 -0
- package/dist/src/lib/davinci.api.js.map +1 -0
- package/dist/src/lib/davinci.types.d.ts +239 -0
- package/dist/src/lib/davinci.types.d.ts.map +1 -0
- package/dist/src/lib/davinci.types.js +11 -0
- package/dist/src/lib/davinci.types.js.map +1 -0
- package/dist/src/lib/davinci.utils.d.ts +25 -0
- package/dist/src/lib/davinci.utils.d.ts.map +1 -0
- package/dist/src/lib/davinci.utils.js +185 -0
- package/dist/src/lib/davinci.utils.js.map +1 -0
- package/dist/src/lib/device.store.d.ts +126 -0
- package/dist/src/lib/device.store.d.ts.map +1 -0
- package/dist/src/lib/device.store.js +200 -0
- package/dist/src/lib/device.store.js.map +1 -0
- package/dist/src/lib/effects/request.effect.mock.d.ts +4 -0
- package/dist/src/lib/effects/request.effect.mock.d.ts.map +1 -0
- package/dist/src/lib/effects/request.effect.mock.js +106 -0
- package/dist/src/lib/effects/request.effect.mock.js.map +1 -0
- package/dist/src/lib/effects/request.effect.types.d.ts +20 -0
- package/dist/src/lib/effects/request.effect.types.d.ts.map +1 -0
- package/dist/src/lib/effects/request.effect.types.js +2 -0
- package/dist/src/lib/effects/request.effect.types.js.map +1 -0
- package/dist/src/lib/effects/request.effect.unions.d.ts +12 -0
- package/dist/src/lib/effects/request.effect.unions.d.ts.map +1 -0
- package/dist/src/lib/effects/request.effect.unions.js +16 -0
- package/dist/src/lib/effects/request.effect.unions.js.map +1 -0
- package/dist/src/lib/effects/request.effect.utils.d.ts +27 -0
- package/dist/src/lib/effects/request.effect.utils.d.ts.map +1 -0
- package/dist/src/lib/effects/request.effect.utils.js +57 -0
- package/dist/src/lib/effects/request.effect.utils.js.map +1 -0
- package/dist/src/lib/error.types.d.ts +6 -0
- package/dist/src/lib/error.types.d.ts.map +1 -0
- package/dist/src/lib/error.types.js +2 -0
- package/dist/src/lib/error.types.js.map +1 -0
- package/dist/src/lib/index.d.ts +3 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +9 -0
- package/dist/src/lib/index.js.map +1 -0
- package/dist/src/lib/node.reducer.d.ts +27 -0
- package/dist/src/lib/node.reducer.d.ts.map +1 -0
- package/dist/src/lib/node.reducer.js +143 -0
- package/dist/src/lib/node.reducer.js.map +1 -0
- package/dist/src/lib/node.slice.d.ts +145 -0
- package/dist/src/lib/node.slice.d.ts.map +1 -0
- package/dist/src/lib/node.slice.js +231 -0
- package/dist/src/lib/node.slice.js.map +1 -0
- package/dist/src/lib/node.types.d.ts +118 -0
- package/dist/src/lib/node.types.d.ts.map +1 -0
- package/dist/src/lib/node.types.js +2 -0
- package/dist/src/lib/node.types.js.map +1 -0
- package/dist/src/lib/node.utils.d.ts +4 -0
- package/dist/src/lib/node.utils.d.ts.map +1 -0
- package/dist/src/lib/node.utils.js +32 -0
- package/dist/src/lib/node.utils.js.map +1 -0
- package/dist/src/lib/services/index.d.ts +24 -0
- package/dist/src/lib/services/index.d.ts.map +1 -0
- package/dist/src/lib/services/index.js +81 -0
- package/dist/src/lib/services/index.js.map +1 -0
- package/dist/src/lib/types/binding-device.types.d.ts +31 -0
- package/dist/src/lib/types/binding-device.types.d.ts.map +1 -0
- package/dist/src/lib/types/binding-device.types.js +2 -0
- package/dist/src/lib/types/binding-device.types.js.map +1 -0
- package/dist/src/lib/types/index.d.ts +6 -0
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/src/lib/types/index.js +12 -0
- package/dist/src/lib/types/index.js.map +1 -0
- package/dist/src/lib/types/oath.types.d.ts +41 -0
- package/dist/src/lib/types/oath.types.d.ts.map +1 -0
- package/dist/src/lib/types/oath.types.js +2 -0
- package/dist/src/lib/types/oath.types.js.map +1 -0
- package/dist/src/lib/types/push-device.types.d.ts +84 -0
- package/dist/src/lib/types/push-device.types.d.ts.map +1 -0
- package/dist/src/lib/types/push-device.types.js +2 -0
- package/dist/src/lib/types/push-device.types.js.map +1 -0
- package/dist/src/lib/types/updateDeviceProfile.types.d.ts +58 -0
- package/dist/src/lib/types/updateDeviceProfile.types.d.ts.map +1 -0
- package/dist/src/lib/types/updateDeviceProfile.types.js +2 -0
- package/dist/src/lib/types/updateDeviceProfile.types.js.map +1 -0
- package/dist/src/lib/types/webauthn.types.d.ts +69 -0
- package/dist/src/lib/types/webauthn.types.d.ts.map +1 -0
- package/dist/src/lib/types/webauthn.types.js +2 -0
- package/dist/src/lib/types/webauthn.types.js.map +1 -0
- package/dist/src/lib/wellknown.api.d.ts +5 -0
- package/dist/src/lib/wellknown.api.d.ts.map +1 -0
- package/dist/src/lib/wellknown.api.js +22 -0
- package/dist/src/lib/wellknown.api.js.map +1 -0
- package/dist/src/lib/wellknown.types.d.ts +38 -0
- package/dist/src/lib/wellknown.types.d.ts.map +1 -0
- package/dist/src/lib/wellknown.types.js +2 -0
- package/dist/src/lib/wellknown.types.js.map +1 -0
- package/dist/src/types.d.ts +31 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +8 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @function returnActionCollector - Creates an ActionCollector object based on the provided field and index.
|
|
3
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
4
|
+
* @param {number} idx - The index to be used in the id of the ActionCollector.
|
|
5
|
+
* @param {ActionCollectorTypes} [collectorType] - Optional type of the ActionCollector.
|
|
6
|
+
* @returns {ActionCollector} The constructed ActionCollector object.
|
|
7
|
+
*/
|
|
8
|
+
export function returnActionCollector(field, idx, collectorType) {
|
|
9
|
+
let error = '';
|
|
10
|
+
if (!('label' in field)) {
|
|
11
|
+
error = `${error}Label is not found in the field object. `;
|
|
12
|
+
}
|
|
13
|
+
if (!('type' in field)) {
|
|
14
|
+
error = `${error}Type is not found in the field object. `;
|
|
15
|
+
}
|
|
16
|
+
if (collectorType === 'IdpCollector') {
|
|
17
|
+
let link;
|
|
18
|
+
if (!('links' in field)) {
|
|
19
|
+
error = `${error}Links property is not found in the field object. `;
|
|
20
|
+
link = null;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
link = field.links?.['authenticate']?.href || null;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
category: 'ActionCollector',
|
|
27
|
+
error: error || null,
|
|
28
|
+
type: collectorType,
|
|
29
|
+
id: `${field.key || field.type}-${idx}`,
|
|
30
|
+
name: field.key || field.type,
|
|
31
|
+
output: {
|
|
32
|
+
key: `${field.key || field.type}-${idx}`,
|
|
33
|
+
label: field.label,
|
|
34
|
+
type: field.type,
|
|
35
|
+
url: link,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
if (!('key' in field)) {
|
|
41
|
+
error = `${error}Key is not found in the field object. `;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
category: 'ActionCollector',
|
|
45
|
+
error: error || null,
|
|
46
|
+
type: collectorType || 'ActionCollector',
|
|
47
|
+
id: `${field.key}-${idx}`,
|
|
48
|
+
name: field.key,
|
|
49
|
+
output: {
|
|
50
|
+
key: field.key,
|
|
51
|
+
label: field.label,
|
|
52
|
+
type: field.type,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @function returnFlowCollector - Returns a flow collector object
|
|
59
|
+
* @param {DaVinciField} field - The field representing the flow button
|
|
60
|
+
* @param {number} idx - The index of the field in the form
|
|
61
|
+
* @returns {FlowCollector} - The flow collector object
|
|
62
|
+
*/
|
|
63
|
+
export function returnFlowCollector(field, idx) {
|
|
64
|
+
return returnActionCollector(field, idx, 'FlowCollector');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @function returnIdpCollector - Returns a social login collector object
|
|
68
|
+
* @param {DaVinciField} field - The field representing the social login button
|
|
69
|
+
* @param {number} idx - The index of the field in the form
|
|
70
|
+
* @returns {SocialLoginCollector} - The social login collector object
|
|
71
|
+
*/
|
|
72
|
+
export function returnIdpCollector(field, idx) {
|
|
73
|
+
return returnActionCollector(field, idx, 'IdpCollector');
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @function returnSubmitCollector - Returns a submit collector object
|
|
77
|
+
* @param {DaVinciField} field - The field representing the submit button
|
|
78
|
+
* @param {number} idx - The index of the field in the form
|
|
79
|
+
* @returns {ActionCollector} - The submit collector object
|
|
80
|
+
*/
|
|
81
|
+
export function returnSubmitCollector(field, idx) {
|
|
82
|
+
return returnActionCollector(field, idx, 'SubmitCollector');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @function returnSingleValueCollector - Creates a SingleValueCollector object based on the provided field, index, and optional collector type.
|
|
86
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
87
|
+
* @param {number} idx - The index to be used in the id of the SingleValueCollector.
|
|
88
|
+
* @param {SingleValueCollectorTypes} [collectorType] - Optional type of the SingleValueCollector.
|
|
89
|
+
* @returns {SingleValueCollector} The constructed SingleValueCollector object.
|
|
90
|
+
*/
|
|
91
|
+
export function returnSingleValueCollector(field, idx, collectorType, data) {
|
|
92
|
+
let error = '';
|
|
93
|
+
if (!('key' in field)) {
|
|
94
|
+
error = `${error}Key is not found in the field object. `;
|
|
95
|
+
}
|
|
96
|
+
if (!('label' in field)) {
|
|
97
|
+
error = `${error}Label is not found in the field object. `;
|
|
98
|
+
}
|
|
99
|
+
if (!('type' in field)) {
|
|
100
|
+
error = `${error}Type is not found in the field object. `;
|
|
101
|
+
}
|
|
102
|
+
if (collectorType === 'PasswordCollector') {
|
|
103
|
+
return {
|
|
104
|
+
category: 'SingleValueCollector',
|
|
105
|
+
error: error || null,
|
|
106
|
+
type: collectorType,
|
|
107
|
+
id: `${field?.key}-${idx}`,
|
|
108
|
+
name: field.key,
|
|
109
|
+
input: {
|
|
110
|
+
key: field.key,
|
|
111
|
+
value: '',
|
|
112
|
+
type: field.type,
|
|
113
|
+
},
|
|
114
|
+
output: {
|
|
115
|
+
key: field.key,
|
|
116
|
+
label: field.label,
|
|
117
|
+
type: field.type,
|
|
118
|
+
// No default or existing value is passed
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
else if (collectorType === 'SingleSelectCollector') {
|
|
123
|
+
/**
|
|
124
|
+
* Check if options are present in the field object first
|
|
125
|
+
* If found, return existing error, which should be ''
|
|
126
|
+
* If not found, add additional message to error string
|
|
127
|
+
*/
|
|
128
|
+
const err = 'options' in field ? error : `${error}Options are not found in the field object. `;
|
|
129
|
+
const options = 'options' in field ? field.options : []; // Fallback to ensure type consistency
|
|
130
|
+
return {
|
|
131
|
+
category: 'SingleValueCollector',
|
|
132
|
+
error: err || null,
|
|
133
|
+
type: collectorType,
|
|
134
|
+
id: `${field.key}-${idx}`,
|
|
135
|
+
name: field.key,
|
|
136
|
+
input: {
|
|
137
|
+
key: field.key,
|
|
138
|
+
value: '',
|
|
139
|
+
type: field.type,
|
|
140
|
+
},
|
|
141
|
+
output: {
|
|
142
|
+
key: field.key,
|
|
143
|
+
label: field.label,
|
|
144
|
+
type: field.type,
|
|
145
|
+
value: data || '',
|
|
146
|
+
options: options,
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
else if ('validation' in field || 'required' in field) {
|
|
151
|
+
const validationArray = [];
|
|
152
|
+
if ('validation' in field) {
|
|
153
|
+
validationArray.push({
|
|
154
|
+
type: 'regex',
|
|
155
|
+
message: field.validation?.errorMessage || '',
|
|
156
|
+
rule: field.validation?.regex || '',
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if ('required' in field) {
|
|
160
|
+
validationArray.push({
|
|
161
|
+
type: 'required',
|
|
162
|
+
message: 'Value cannot be empty',
|
|
163
|
+
rule: true,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
category: 'ValidatedSingleValueCollector',
|
|
168
|
+
error: error || null,
|
|
169
|
+
type: 'TextCollector',
|
|
170
|
+
id: `${field.key}-${idx}`,
|
|
171
|
+
name: field.key,
|
|
172
|
+
input: {
|
|
173
|
+
key: field.key,
|
|
174
|
+
value: '',
|
|
175
|
+
type: field.type,
|
|
176
|
+
validation: validationArray,
|
|
177
|
+
},
|
|
178
|
+
output: {
|
|
179
|
+
key: field.key,
|
|
180
|
+
label: field.label,
|
|
181
|
+
type: field.type,
|
|
182
|
+
value: data || '',
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return {
|
|
188
|
+
category: 'SingleValueCollector',
|
|
189
|
+
error: error || null,
|
|
190
|
+
type: collectorType || 'SingleValueCollector',
|
|
191
|
+
id: `${field.key}-${idx}`,
|
|
192
|
+
name: field.key,
|
|
193
|
+
input: {
|
|
194
|
+
key: field.key,
|
|
195
|
+
value: '',
|
|
196
|
+
type: field.type,
|
|
197
|
+
},
|
|
198
|
+
output: {
|
|
199
|
+
key: field.key,
|
|
200
|
+
label: field.label,
|
|
201
|
+
type: field.type,
|
|
202
|
+
value: data || '',
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* @function returnPasswordCollector - Creates a PasswordCollector object based on the provided field and index.
|
|
209
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
210
|
+
* @param {number} idx - The index to be used in the id of the PasswordCollector.
|
|
211
|
+
* @returns {PasswordCollector} The constructed PasswordCollector object.
|
|
212
|
+
*/
|
|
213
|
+
export function returnPasswordCollector(field, idx) {
|
|
214
|
+
return returnSingleValueCollector(field, idx, 'PasswordCollector');
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* @function returnTextCollector - Creates a TextCollector object based on the provided field and index.
|
|
218
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
219
|
+
* @param {number} idx - The index to be used in the id of the TextCollector.
|
|
220
|
+
* @returns {TextCollector} The constructed TextCollector object.
|
|
221
|
+
*/
|
|
222
|
+
export function returnTextCollector(field, idx, data) {
|
|
223
|
+
return returnSingleValueCollector(field, idx, 'TextCollector', data);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @function returnSingleSelectCollector - Creates a SingleCollector object based on the provided field and index.
|
|
227
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
228
|
+
* @param {number} idx - The index to be used in the id of the SingleCollector.
|
|
229
|
+
* @returns {SingleValueCollector} The constructed SingleCollector object.
|
|
230
|
+
*/
|
|
231
|
+
export function returnSingleSelectCollector(field, idx, data) {
|
|
232
|
+
return returnSingleValueCollector(field, idx, 'SingleSelectCollector', data);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @function returnMultiValueCollector - Creates a MultiValueCollector object based on the provided field, index, and optional collector type.
|
|
236
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
237
|
+
* @param {number} idx - The index to be used in the id of the MultiValueCollector.
|
|
238
|
+
* @param {MultiValueCollectorTypes} [collectorType] - Optional type of the MultiValueCollector.
|
|
239
|
+
* @returns {MultiValueCollector} The constructed MultiValueCollector object.
|
|
240
|
+
*/
|
|
241
|
+
export function returnMultiValueCollector(field, idx, collectorType, data) {
|
|
242
|
+
let error = '';
|
|
243
|
+
if (!('key' in field)) {
|
|
244
|
+
error = `${error}Key is not found in the field object. `;
|
|
245
|
+
}
|
|
246
|
+
if (!('label' in field)) {
|
|
247
|
+
error = `${error}Label is not found in the field object. `;
|
|
248
|
+
}
|
|
249
|
+
if (!('type' in field)) {
|
|
250
|
+
error = `${error}Type is not found in the field object. `;
|
|
251
|
+
}
|
|
252
|
+
if (!('options' in field)) {
|
|
253
|
+
error = `${error}Options are not found in the field object. `;
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
category: 'MultiValueCollector',
|
|
257
|
+
error: error || null,
|
|
258
|
+
type: collectorType || 'MultiValueCollector',
|
|
259
|
+
id: `${field.key}-${idx}`,
|
|
260
|
+
name: field.key,
|
|
261
|
+
input: {
|
|
262
|
+
key: field.key,
|
|
263
|
+
value: [],
|
|
264
|
+
type: field.type,
|
|
265
|
+
},
|
|
266
|
+
output: {
|
|
267
|
+
key: field.key,
|
|
268
|
+
label: field.label,
|
|
269
|
+
type: field.type,
|
|
270
|
+
value: data || [],
|
|
271
|
+
options: field.options || [],
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* @function returnMultiSelectCollector - Creates a DropDownCollector object based on the provided field and index.
|
|
277
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
278
|
+
* @param {number} idx - The index to be used in the id of the DropDownCollector.
|
|
279
|
+
* @returns {SingleValueCollector} The constructed DropDownCollector object.
|
|
280
|
+
*/
|
|
281
|
+
export function returnMultiSelectCollector(field, idx, data) {
|
|
282
|
+
return returnMultiValueCollector(field, idx, 'MultiSelectCollector', data);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* @function returnMultiValueCollector - Creates a MultiValueCollector object based on the provided field, index, and optional collector type.
|
|
286
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
287
|
+
* @param {number} idx - The index to be used in the id of the MultiValueCollector.
|
|
288
|
+
* @param {MultiValueCollectorTypes} [collectorType] - Optional type of the MultiValueCollector.
|
|
289
|
+
* @returns {MultiValueCollector} The constructed MultiValueCollector object.
|
|
290
|
+
*/
|
|
291
|
+
export function returnNoValueCollector(field, idx, collectorType) {
|
|
292
|
+
let error = '';
|
|
293
|
+
if (!('content' in field)) {
|
|
294
|
+
error = `${error}Content is not found in the field object. `;
|
|
295
|
+
}
|
|
296
|
+
if (!('type' in field)) {
|
|
297
|
+
error = `${error}Type is not found in the field object. `;
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
category: 'NoValueCollector',
|
|
301
|
+
error: error || null,
|
|
302
|
+
type: collectorType || 'NoValueCollector',
|
|
303
|
+
id: `${field.key || field.type}-${idx}`,
|
|
304
|
+
name: `${field.key || field.type}-${idx}`,
|
|
305
|
+
output: {
|
|
306
|
+
key: `${field.key || field.type}-${idx}`,
|
|
307
|
+
label: field.content,
|
|
308
|
+
type: field.type,
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* @function returnMultiSelectCollector - Creates a DropDownCollector object based on the provided field and index.
|
|
314
|
+
* @param {DaVinciField} field - The field object containing key, label, type, and links.
|
|
315
|
+
* @param {number} idx - The index to be used in the id of the DropDownCollector.
|
|
316
|
+
* @returns {SingleValueCollector} The constructed DropDownCollector object.
|
|
317
|
+
*/
|
|
318
|
+
export function returnReadOnlyCollector(field, idx) {
|
|
319
|
+
return returnNoValueCollector(field, idx, 'ReadOnlyCollector');
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* @function returnValidator - Creates a validator function based on the provided collector
|
|
323
|
+
* @param collector {ValidatedTextCollector} - The collector to which the value will be validated
|
|
324
|
+
* @returns {function} - A "validator" function that validates the input value
|
|
325
|
+
*/
|
|
326
|
+
export function returnValidator(collector) {
|
|
327
|
+
const rules = collector.input.validation;
|
|
328
|
+
return (value) => {
|
|
329
|
+
return rules.reduce((acc, next) => {
|
|
330
|
+
if (next.type === 'required' && !value) {
|
|
331
|
+
acc.push(next.message);
|
|
332
|
+
}
|
|
333
|
+
else if (next.type === 'regex') {
|
|
334
|
+
try {
|
|
335
|
+
const result = new RegExp(next.rule).test(value);
|
|
336
|
+
if (!result) {
|
|
337
|
+
acc.push(next.message);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
catch (err) {
|
|
341
|
+
const error = err;
|
|
342
|
+
acc.push(error.message);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return acc;
|
|
346
|
+
}, []);
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=collector.utils.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AAa,EAAE,EAAE;QACvB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAChC,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,KAAK,EAAE,CAAC;gBACvC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC;iBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBACjC,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACjD,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACzB,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,KAAK,GAAG,GAAY,CAAC;oBAC3B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAc,CAAC,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import the createSlice and PayloadAction utilities from Redux Toolkit
|
|
3
|
+
* @see https://redux-toolkit.js.org/api/createslice
|
|
4
|
+
*/
|
|
5
|
+
import { type PayloadAction } from '@reduxjs/toolkit';
|
|
6
|
+
/**
|
|
7
|
+
* Import the types
|
|
8
|
+
*/
|
|
9
|
+
import type { InternalDaVinciConfig } from './config.types.js';
|
|
10
|
+
import { Endpoints } from './wellknown.types.js';
|
|
11
|
+
/**
|
|
12
|
+
* @const configSlice - Define the configuration slice for Redux state management
|
|
13
|
+
* @see https://redux-toolkit.js.org/api/createslice
|
|
14
|
+
*/
|
|
15
|
+
export declare const configSlice: import("@reduxjs/toolkit").Slice<{
|
|
16
|
+
endpoints: Endpoints;
|
|
17
|
+
clientId: string;
|
|
18
|
+
redirectUri: string;
|
|
19
|
+
responseType: string;
|
|
20
|
+
scope: string;
|
|
21
|
+
}, {
|
|
22
|
+
/**
|
|
23
|
+
* @method set - Set the configuration for the DaVinci client
|
|
24
|
+
* @param {Object} state - The current state of the slice
|
|
25
|
+
* @param {PayloadAction<InternalDaVinciConfig>} action - The action to be dispatched
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
set(state: import("immer").WritableDraft<{
|
|
29
|
+
endpoints: Endpoints;
|
|
30
|
+
clientId: string;
|
|
31
|
+
redirectUri: string;
|
|
32
|
+
responseType: string;
|
|
33
|
+
scope: string;
|
|
34
|
+
}>, action: PayloadAction<InternalDaVinciConfig>): void;
|
|
35
|
+
}, "config", "config", import("@reduxjs/toolkit").SliceSelectors<{
|
|
36
|
+
endpoints: Endpoints;
|
|
37
|
+
clientId: string;
|
|
38
|
+
redirectUri: string;
|
|
39
|
+
responseType: string;
|
|
40
|
+
scope: string;
|
|
41
|
+
}>>;
|
|
42
|
+
//# sourceMappingURL=config.slice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.slice.d.ts","sourceRoot":"","sources":["../../../src/lib/config.slice.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEnE;;GAEG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAcjD;;;GAGG;AACH,eAAO,MAAM,WAAW;eAXL,SAAS;;;;;;IAgBxB;;;;;OAKG;;mBArBY,SAAS;;;;;gBAsBL,aAAa,CAAC,qBAAqB,CAAC;;eAtBxC,SAAS;;;;;GAkD1B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 createSlice and PayloadAction utilities from Redux Toolkit
|
|
9
|
+
* @see https://redux-toolkit.js.org/api/createslice
|
|
10
|
+
*/
|
|
11
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
12
|
+
/**
|
|
13
|
+
* @const initialState - The initial state of the configuration slice
|
|
14
|
+
* NOTE: The clientId, redirectUri, responseType, and scope are set to empty strings
|
|
15
|
+
*/
|
|
16
|
+
const initialState = {
|
|
17
|
+
endpoints: {},
|
|
18
|
+
clientId: '',
|
|
19
|
+
redirectUri: '',
|
|
20
|
+
responseType: '',
|
|
21
|
+
scope: '',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @const configSlice - Define the configuration slice for Redux state management
|
|
25
|
+
* @see https://redux-toolkit.js.org/api/createslice
|
|
26
|
+
*/
|
|
27
|
+
export const configSlice = createSlice({
|
|
28
|
+
name: 'config',
|
|
29
|
+
initialState,
|
|
30
|
+
reducerPath: 'config',
|
|
31
|
+
reducers: {
|
|
32
|
+
/**
|
|
33
|
+
* @method set - Set the configuration for the DaVinci client
|
|
34
|
+
* @param {Object} state - The current state of the slice
|
|
35
|
+
* @param {PayloadAction<InternalDaVinciConfig>} action - The action to be dispatched
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
set(state, action) {
|
|
39
|
+
state.clientId = action.payload.clientId || '';
|
|
40
|
+
state.redirectUri = action.payload.redirectUri || `${location.origin}/handle-redirect`;
|
|
41
|
+
if ('responseType' in action.payload && action.payload.responseType) {
|
|
42
|
+
state.responseType = action.payload.responseType;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
state.responseType = 'code';
|
|
46
|
+
}
|
|
47
|
+
state.scope = action.payload.scope || 'openid';
|
|
48
|
+
const { authorization_endpoint: authorize, issuer: issuer, introspection_endpoint: introspection, token_endpoint: tokens, userinfo_endpoint: userinfo, } = action.payload.wellknownResponse;
|
|
49
|
+
state.endpoints = {
|
|
50
|
+
authorize,
|
|
51
|
+
issuer,
|
|
52
|
+
introspection,
|
|
53
|
+
tokens,
|
|
54
|
+
userinfo,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=config.slice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.slice.js","sourceRoot":"","sources":["../../../src/lib/config.slice.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAsB,MAAM,kBAAkB,CAAC;AAQnE;;;GAGG;AACH,MAAM,YAAY,GAAG;IACnB,SAAS,EAAE,EAAe;IAC1B,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,EAAE;IAChB,KAAK,EAAE,EAAE;CACV,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;IACrC,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,WAAW,EAAE,QAAQ;IACrB,QAAQ,EAAE;QACR;;;;;WAKG;QACH,GAAG,CAAC,KAAK,EAAE,MAA4C;YACrD,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;YAC/C,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,GAAG,QAAQ,CAAC,MAAM,kBAAkB,CAAC;YACvF,IAAI,cAAc,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBACpE,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC;YAC9B,CAAC;YAED,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC;YAE/C,MAAM,EACJ,sBAAsB,EAAE,SAAS,EACjC,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,aAAa,EACrC,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,QAAQ,GAC5B,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC;YAErC,KAAK,CAAC,SAAS,GAAG;gBAChB,SAAS;gBACT,MAAM;gBACN,aAAa;gBACb,MAAM;gBACN,QAAQ;aACT,CAAC;QACJ,CAAC;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import ConfigOptions type from the JavaScript SDK
|
|
3
|
+
*/
|
|
4
|
+
import type { AsyncConfigOptions } from '@forgerock/javascript-sdk/src/config/interfaces';
|
|
5
|
+
import { WellknownResponse } from './wellknown.types.js';
|
|
6
|
+
export interface DaVinciConfig extends AsyncConfigOptions {
|
|
7
|
+
responseType?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface InternalDaVinciConfig extends DaVinciConfig {
|
|
10
|
+
wellknownResponse: WellknownResponse;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=config.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../../src/lib/config.types.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,iBAAiB,EAAE,iBAAiB,CAAC;CACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.types.js","sourceRoot":"","sources":["../../../src/lib/config.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import the RTK Query library from Redux Toolkit
|
|
3
|
+
* @see https://redux-toolkit.js.org/rtk-query/overview
|
|
4
|
+
*/
|
|
5
|
+
import { FetchArgs, FetchBaseQueryError, FetchBaseQueryMeta } from '@reduxjs/toolkit/query';
|
|
6
|
+
import type { OutgoingQueryParams, StartOptions } from './davinci.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* @const davinciApi - Define the DaVinci API for Redux state management
|
|
9
|
+
* @see https://redux-toolkit.js.org/rtk-query/overview
|
|
10
|
+
*/
|
|
11
|
+
export declare const davinciApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, {
|
|
12
|
+
/**
|
|
13
|
+
* @method flow - method for initiating a new flow with the DaVinci API
|
|
14
|
+
*/
|
|
15
|
+
flow: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, unknown, "davinci">;
|
|
16
|
+
/**
|
|
17
|
+
* @method next - method for initiating the next node in the current flow
|
|
18
|
+
*/
|
|
19
|
+
next: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, unknown, "davinci">;
|
|
20
|
+
/**
|
|
21
|
+
* @method start - method for initiating a DaVinci flow
|
|
22
|
+
* @param - needs no arguments, but need to declare types to make it explicit
|
|
23
|
+
*/
|
|
24
|
+
start: import("@reduxjs/toolkit/query").MutationDefinition<StartOptions<OutgoingQueryParams> | undefined, import("@reduxjs/toolkit/query").BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, unknown, "davinci">;
|
|
25
|
+
resume: import("@reduxjs/toolkit/query").QueryDefinition<{
|
|
26
|
+
continueToken: string;
|
|
27
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, unknown, "davinci">;
|
|
28
|
+
}, "davinci", never, typeof import("@reduxjs/toolkit/query").coreModuleName>;
|
|
29
|
+
//# sourceMappingURL=davinci.api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"davinci.api.d.ts","sourceRoot":"","sources":["../../../src/lib/davinci.api.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,OAAO,EAEL,SAAS,EAET,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAYhC,OAAO,KAAK,EAEV,mBAAmB,EACnB,YAAY,EAEb,MAAM,oBAAoB,CAAC;AAc5B;;;GAGG;AACH,eAAO,MAAM,UAAU;IAYnB;;OAEG;;IAyEH;;OAEG;;IA+EH;;;OAGG;;;uBAwG6C,MAAM;;4EAmExD,CAAC"}
|