@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.
Files changed (133) hide show
  1. package/dist/src/index.d.ts +2 -0
  2. package/dist/src/index.d.ts.map +1 -0
  3. package/dist/src/index.js +8 -0
  4. package/dist/src/index.js.map +1 -0
  5. package/dist/src/lib/authorize.utils.d.ts +22 -0
  6. package/dist/src/lib/authorize.utils.d.ts.map +1 -0
  7. package/dist/src/lib/authorize.utils.js +47 -0
  8. package/dist/src/lib/authorize.utils.js.map +1 -0
  9. package/dist/src/lib/client.store.d.ts +351 -0
  10. package/dist/src/lib/client.store.d.ts.map +1 -0
  11. package/dist/src/lib/client.store.js +295 -0
  12. package/dist/src/lib/client.store.js.map +1 -0
  13. package/dist/src/lib/client.store.utils.d.ts +61 -0
  14. package/dist/src/lib/client.store.utils.d.ts.map +1 -0
  15. package/dist/src/lib/client.store.utils.js +35 -0
  16. package/dist/src/lib/client.store.utils.js.map +1 -0
  17. package/dist/src/lib/client.types.d.ts +17 -0
  18. package/dist/src/lib/client.types.d.ts.map +1 -0
  19. package/dist/src/lib/client.types.js +2 -0
  20. package/dist/src/lib/client.types.js.map +1 -0
  21. package/dist/src/lib/collector.types.d.ts +255 -0
  22. package/dist/src/lib/collector.types.d.ts.map +1 -0
  23. package/dist/src/lib/collector.types.js +11 -0
  24. package/dist/src/lib/collector.types.js.map +1 -0
  25. package/dist/src/lib/collector.utils.d.ts +100 -0
  26. package/dist/src/lib/collector.utils.d.ts.map +1 -0
  27. package/dist/src/lib/collector.utils.js +349 -0
  28. package/dist/src/lib/collector.utils.js.map +1 -0
  29. package/dist/src/lib/config.slice.d.ts +42 -0
  30. package/dist/src/lib/config.slice.d.ts.map +1 -0
  31. package/dist/src/lib/config.slice.js +59 -0
  32. package/dist/src/lib/config.slice.js.map +1 -0
  33. package/dist/src/lib/config.types.d.ts +12 -0
  34. package/dist/src/lib/config.types.d.ts.map +1 -0
  35. package/dist/src/lib/config.types.js +2 -0
  36. package/dist/src/lib/config.types.js.map +1 -0
  37. package/dist/src/lib/davinci.api.d.ts +29 -0
  38. package/dist/src/lib/davinci.api.d.ts.map +1 -0
  39. package/dist/src/lib/davinci.api.js +333 -0
  40. package/dist/src/lib/davinci.api.js.map +1 -0
  41. package/dist/src/lib/davinci.types.d.ts +239 -0
  42. package/dist/src/lib/davinci.types.d.ts.map +1 -0
  43. package/dist/src/lib/davinci.types.js +11 -0
  44. package/dist/src/lib/davinci.types.js.map +1 -0
  45. package/dist/src/lib/davinci.utils.d.ts +25 -0
  46. package/dist/src/lib/davinci.utils.d.ts.map +1 -0
  47. package/dist/src/lib/davinci.utils.js +185 -0
  48. package/dist/src/lib/davinci.utils.js.map +1 -0
  49. package/dist/src/lib/device.store.d.ts +126 -0
  50. package/dist/src/lib/device.store.d.ts.map +1 -0
  51. package/dist/src/lib/device.store.js +200 -0
  52. package/dist/src/lib/device.store.js.map +1 -0
  53. package/dist/src/lib/effects/request.effect.mock.d.ts +4 -0
  54. package/dist/src/lib/effects/request.effect.mock.d.ts.map +1 -0
  55. package/dist/src/lib/effects/request.effect.mock.js +106 -0
  56. package/dist/src/lib/effects/request.effect.mock.js.map +1 -0
  57. package/dist/src/lib/effects/request.effect.types.d.ts +20 -0
  58. package/dist/src/lib/effects/request.effect.types.d.ts.map +1 -0
  59. package/dist/src/lib/effects/request.effect.types.js +2 -0
  60. package/dist/src/lib/effects/request.effect.types.js.map +1 -0
  61. package/dist/src/lib/effects/request.effect.unions.d.ts +12 -0
  62. package/dist/src/lib/effects/request.effect.unions.d.ts.map +1 -0
  63. package/dist/src/lib/effects/request.effect.unions.js +16 -0
  64. package/dist/src/lib/effects/request.effect.unions.js.map +1 -0
  65. package/dist/src/lib/effects/request.effect.utils.d.ts +27 -0
  66. package/dist/src/lib/effects/request.effect.utils.d.ts.map +1 -0
  67. package/dist/src/lib/effects/request.effect.utils.js +57 -0
  68. package/dist/src/lib/effects/request.effect.utils.js.map +1 -0
  69. package/dist/src/lib/error.types.d.ts +6 -0
  70. package/dist/src/lib/error.types.d.ts.map +1 -0
  71. package/dist/src/lib/error.types.js +2 -0
  72. package/dist/src/lib/error.types.js.map +1 -0
  73. package/dist/src/lib/index.d.ts +3 -0
  74. package/dist/src/lib/index.d.ts.map +1 -0
  75. package/dist/src/lib/index.js +9 -0
  76. package/dist/src/lib/index.js.map +1 -0
  77. package/dist/src/lib/node.reducer.d.ts +27 -0
  78. package/dist/src/lib/node.reducer.d.ts.map +1 -0
  79. package/dist/src/lib/node.reducer.js +143 -0
  80. package/dist/src/lib/node.reducer.js.map +1 -0
  81. package/dist/src/lib/node.slice.d.ts +145 -0
  82. package/dist/src/lib/node.slice.d.ts.map +1 -0
  83. package/dist/src/lib/node.slice.js +231 -0
  84. package/dist/src/lib/node.slice.js.map +1 -0
  85. package/dist/src/lib/node.types.d.ts +118 -0
  86. package/dist/src/lib/node.types.d.ts.map +1 -0
  87. package/dist/src/lib/node.types.js +2 -0
  88. package/dist/src/lib/node.types.js.map +1 -0
  89. package/dist/src/lib/node.utils.d.ts +4 -0
  90. package/dist/src/lib/node.utils.d.ts.map +1 -0
  91. package/dist/src/lib/node.utils.js +32 -0
  92. package/dist/src/lib/node.utils.js.map +1 -0
  93. package/dist/src/lib/services/index.d.ts +24 -0
  94. package/dist/src/lib/services/index.d.ts.map +1 -0
  95. package/dist/src/lib/services/index.js +81 -0
  96. package/dist/src/lib/services/index.js.map +1 -0
  97. package/dist/src/lib/types/binding-device.types.d.ts +31 -0
  98. package/dist/src/lib/types/binding-device.types.d.ts.map +1 -0
  99. package/dist/src/lib/types/binding-device.types.js +2 -0
  100. package/dist/src/lib/types/binding-device.types.js.map +1 -0
  101. package/dist/src/lib/types/index.d.ts +6 -0
  102. package/dist/src/lib/types/index.d.ts.map +1 -0
  103. package/dist/src/lib/types/index.js +12 -0
  104. package/dist/src/lib/types/index.js.map +1 -0
  105. package/dist/src/lib/types/oath.types.d.ts +41 -0
  106. package/dist/src/lib/types/oath.types.d.ts.map +1 -0
  107. package/dist/src/lib/types/oath.types.js +2 -0
  108. package/dist/src/lib/types/oath.types.js.map +1 -0
  109. package/dist/src/lib/types/push-device.types.d.ts +84 -0
  110. package/dist/src/lib/types/push-device.types.d.ts.map +1 -0
  111. package/dist/src/lib/types/push-device.types.js +2 -0
  112. package/dist/src/lib/types/push-device.types.js.map +1 -0
  113. package/dist/src/lib/types/updateDeviceProfile.types.d.ts +58 -0
  114. package/dist/src/lib/types/updateDeviceProfile.types.d.ts.map +1 -0
  115. package/dist/src/lib/types/updateDeviceProfile.types.js +2 -0
  116. package/dist/src/lib/types/updateDeviceProfile.types.js.map +1 -0
  117. package/dist/src/lib/types/webauthn.types.d.ts +69 -0
  118. package/dist/src/lib/types/webauthn.types.d.ts.map +1 -0
  119. package/dist/src/lib/types/webauthn.types.js +2 -0
  120. package/dist/src/lib/types/webauthn.types.js.map +1 -0
  121. package/dist/src/lib/wellknown.api.d.ts +5 -0
  122. package/dist/src/lib/wellknown.api.d.ts.map +1 -0
  123. package/dist/src/lib/wellknown.api.js +22 -0
  124. package/dist/src/lib/wellknown.api.js.map +1 -0
  125. package/dist/src/lib/wellknown.types.d.ts +38 -0
  126. package/dist/src/lib/wellknown.types.d.ts.map +1 -0
  127. package/dist/src/lib/wellknown.types.js +2 -0
  128. package/dist/src/lib/wellknown.types.js.map +1 -0
  129. package/dist/src/types.d.ts +31 -0
  130. package/dist/src/types.d.ts.map +1 -0
  131. package/dist/src/types.js +8 -0
  132. package/dist/src/types.js.map +1 -0
  133. package/package.json +3 -2
@@ -0,0 +1,185 @@
1
+ import { nodeSlice } from './node.slice.js';
2
+ /**
3
+ * @function transformSubmitRequest - Transforms a NextNode into a DaVinciRequest for form submissions
4
+ * @param {ContinueNode} node - The node to transform into a DaVinciRequest
5
+ * @returns {DaVinciRequest} - The transformed request object
6
+ */
7
+ export function transformSubmitRequest(node) {
8
+ // Filter out ActionCollectors as they are not used in form submissions
9
+ const collectors = node.client?.collectors?.filter((collector) => collector.category === 'MultiValueCollector' ||
10
+ collector.category === 'SingleValueCollector' ||
11
+ collector.category === 'ValidatedSingleValueCollector');
12
+ const formData = collectors?.reduce((acc, collector) => {
13
+ acc[collector.input.key] = collector.input.value;
14
+ return acc;
15
+ }, {});
16
+ return {
17
+ id: node.server.id || '',
18
+ eventName: node.server.eventName || '',
19
+ interactionId: node.server.interactionId || '',
20
+ parameters: {
21
+ eventType: 'submit',
22
+ data: {
23
+ actionKey: node.client?.action || '',
24
+ formData: formData || {},
25
+ },
26
+ },
27
+ };
28
+ }
29
+ /**
30
+ * @function transformActionRequest - Transforms a NextNode into a DaVinciRequest for action requests
31
+ * @param {ContinueNode} node - The node to transform into a DaVinciRequest
32
+ * @param {string} action - The action to transform into a DaVinciRequest
33
+ * @returns {DaVinciRequest} - The transformed request object
34
+ */
35
+ export function transformActionRequest(node, action) {
36
+ return {
37
+ id: node.server.id || '',
38
+ eventName: node.server.eventName || '',
39
+ interactionId: node.server.interactionId || '',
40
+ parameters: {
41
+ eventType: 'action',
42
+ data: {
43
+ actionKey: action,
44
+ },
45
+ },
46
+ };
47
+ }
48
+ export function handleResponse(cacheEntry, dispatch, status) {
49
+ /**
50
+ * 5XX errors are treated as unrecoverable failures
51
+ */
52
+ if (cacheEntry.isError && cacheEntry.error.status >= 500) {
53
+ const data = cacheEntry.error.data;
54
+ const requestId = cacheEntry.requestId;
55
+ dispatch(nodeSlice.actions.failure({ data, requestId, httpStatus: cacheEntry.error.status }));
56
+ return; // Filter out 5XX's
57
+ }
58
+ /**
59
+ * Check for 4XX errors that are unrecoverable
60
+ */
61
+ if (cacheEntry.isError && cacheEntry.error.status >= 400 && cacheEntry.error.status < 500) {
62
+ const data = cacheEntry.error.data;
63
+ const requestId = cacheEntry.requestId;
64
+ // Filter out client-side "timeout" related unrecoverable failures
65
+ if (data.code === 1999 || data.code === 'requestTimedOut') {
66
+ dispatch(nodeSlice.actions.failure({ data, requestId, httpStatus: cacheEntry.error.status }));
67
+ return; // Filter out timeouts
68
+ }
69
+ // Filter our "PingOne Authentication Connector" unrecoverable failures
70
+ if (data.connectorId === 'pingOneAuthenticationConnector' &&
71
+ (data.capabilityName === 'returnSuccessResponseRedirect' ||
72
+ data.capabilityName === 'setSession')) {
73
+ dispatch(nodeSlice.actions.failure({ data, requestId, httpStatus: cacheEntry.error.status }));
74
+ return;
75
+ }
76
+ // If we're still here, we have a 4XX failure that should be recoverable
77
+ dispatch(nodeSlice.actions.error({ data, requestId, httpStatus: cacheEntry.error.status }));
78
+ return;
79
+ }
80
+ /**
81
+ * Check for 3XX errors that result in CORS errors, reported as FETCH_ERROR
82
+ */
83
+ if (cacheEntry.isError && cacheEntry.error.status === 'FETCH_ERROR') {
84
+ const data = {
85
+ code: cacheEntry.error.status,
86
+ message: 'Fetch Error: Please ensure a correct Client ID for your OAuth application.',
87
+ };
88
+ const requestId = cacheEntry.requestId;
89
+ dispatch(nodeSlice.actions.failure({ data, requestId, httpStatus: cacheEntry.error.status }));
90
+ return;
91
+ }
92
+ /**
93
+ * If the response's HTTP status is a success (2XX), but the DaVinci API has returned an error,
94
+ * we need to handle this as a failure or return as unknown.
95
+ */
96
+ if (cacheEntry.isSuccess && 'error' in cacheEntry.data) {
97
+ const data = cacheEntry.data;
98
+ const requestId = cacheEntry.requestId;
99
+ dispatch(nodeSlice.actions.failure({
100
+ data: data.error,
101
+ requestId,
102
+ httpStatus: status,
103
+ }));
104
+ return; // Filter out 2XX errors
105
+ }
106
+ /**
107
+ * If the response's HTTP status is a success (2XX), but the DaVinci API has returned an error,
108
+ * we need to handle this as a failure or return as unknown.
109
+ */
110
+ if (cacheEntry.isSuccess && 'status' in cacheEntry.data) {
111
+ const status = cacheEntry.data.status.toLowerCase();
112
+ if (status === 'failure') {
113
+ const data = cacheEntry.data;
114
+ const requestId = cacheEntry.requestId;
115
+ dispatch(nodeSlice.actions.failure({
116
+ data: data.error,
117
+ requestId,
118
+ httpStatus: status,
119
+ }));
120
+ return; // Filter out 2XX errors with 'failure' status
121
+ }
122
+ else {
123
+ // Do nothing
124
+ }
125
+ }
126
+ /**
127
+ * If we've made it here, we have a successful response and do not have an error property.
128
+ * Parse for state of the flow and dispatch appropriate action.
129
+ */
130
+ if (cacheEntry.isSuccess) {
131
+ const requestId = cacheEntry.requestId;
132
+ const hasNextUrl = () => {
133
+ const data = cacheEntry.data;
134
+ if ('_links' in data) {
135
+ if ('next' in data._links) {
136
+ if ('href' in data._links.next) {
137
+ return true;
138
+ }
139
+ }
140
+ }
141
+ return false;
142
+ };
143
+ if ('session' in cacheEntry.data || 'authorizeResponse' in cacheEntry.data) {
144
+ const data = cacheEntry.data;
145
+ dispatch(nodeSlice.actions.success({ data, requestId, httpStatus: status }));
146
+ }
147
+ else if (hasNextUrl()) {
148
+ const data = cacheEntry.data;
149
+ dispatch(nodeSlice.actions.next({ data, requestId, httpStatus: status }));
150
+ }
151
+ else {
152
+ // If we got here, the response type is unknown and therefore an unrecoverable failure
153
+ const data = cacheEntry.data;
154
+ dispatch(nodeSlice.actions.failure({ data, requestId, httpStatus: status }));
155
+ }
156
+ }
157
+ }
158
+ export function authorize(serverSlice, collector) {
159
+ if (serverSlice && '_links' in serverSlice) {
160
+ const continueUrl = serverSlice._links?.['continue']?.href ?? null;
161
+ if (continueUrl) {
162
+ window.localStorage.setItem('continueUrl', continueUrl);
163
+ if (collector.output.url) {
164
+ window.location.assign(collector.output.url);
165
+ }
166
+ }
167
+ else {
168
+ return {
169
+ error: {
170
+ message: 'No url found in collector, social login needs a url in the collector to navigate to',
171
+ type: 'network_error',
172
+ },
173
+ type: 'internal_error',
174
+ };
175
+ }
176
+ return {
177
+ error: {
178
+ message: 'No Continue Url found, social login needs a continue url to be saved in localStorage',
179
+ type: 'network_error',
180
+ },
181
+ type: 'internal_error',
182
+ };
183
+ }
184
+ }
185
+ //# sourceMappingURL=davinci.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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KAAK,EAAE;gBACL,OAAO,EACL,sFAAsF;gBACxF,IAAI,EAAE,eAAe;aACtB;YACD,IAAI,EAAE,gBAAgB;SACvB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,126 @@
1
+ import { type ConfigOptions } from '@forgerock/javascript-sdk';
2
+ import { DeleteOathQuery, OathDevice, RetrieveOathQuery } from './types/oath.types.js';
3
+ import { DeleteDeviceQuery, PushDeviceQuery } from './types/push-device.types.js';
4
+ import { WebAuthnBody, WebAuthnQuery, WebAuthnQueryWithUUID } from './types/webauthn.types.js';
5
+ import { BindingDeviceQuery } from './types/binding-device.types.js';
6
+ export declare const deviceClient: (config: ConfigOptions) => {
7
+ /**
8
+ * Oath device management methods.
9
+ *
10
+ * @type {OathManagement}
11
+ */
12
+ oath: {
13
+ /**
14
+ * Retrieves Oath devices based on the specified query.
15
+ *
16
+ * @async
17
+ * @function get
18
+ * @param {RetrieveOathQuery} query - The query used to retrieve Oath devices.
19
+ * @returns {Promise<OAthResponse>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
20
+ */
21
+ get: (query: RetrieveOathQuery) => Promise<import("./types/oath.types.js").OAthResponse | undefined>;
22
+ /**
23
+ * Deletes an Oath device based on the provided query and device information.
24
+ *
25
+ * @async
26
+ * @function delete
27
+ * @param {DeleteOathQuery & OathDevice} query - The query and device information used to delete the Oath device.
28
+ * @returns {Promise<DeletedOAthDevice>} - A promise that resolves to the response data or undefined if the response is not valid.
29
+ */
30
+ delete: (query: DeleteOathQuery & OathDevice) => Promise<import("./types/oath.types.js").DeletedOAthDevice | undefined>;
31
+ };
32
+ /**
33
+ * Push device management methods.
34
+ *
35
+ * @type {PushManagement}
36
+ */
37
+ push: {
38
+ /**
39
+ * Retrieves Push devices based on the specified query.
40
+ *
41
+ * @async
42
+ * @function get
43
+ * @param {PushDeviceQuery} query - The query used to retrieve Push devices.
44
+ * @returns {Promise<PushDevicesResponse | undefined>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
45
+ */
46
+ get: (query: PushDeviceQuery) => Promise<import("./types/push-device.types.js").PushDevicesResponse | undefined>;
47
+ /**
48
+ * Deletes a Push device based on the provided query.
49
+ *
50
+ * @async
51
+ * @function delete
52
+ * @param {DeleteDeviceQuery} query - The query used to delete the Push device.
53
+ * @returns {Promise<PushDevice>} - A promise that resolves to the response data or undefined if the response is not valid.
54
+ */
55
+ delete: (query: DeleteDeviceQuery) => Promise<import("./types/push-device.types.js").PushDevice | undefined>;
56
+ };
57
+ /**
58
+ * WebAuthn device management methods.
59
+ *
60
+ * @type {WebAuthnManagement}
61
+ */
62
+ webauthn: {
63
+ /**
64
+ * Retrieves WebAuthn devices based on the specified query.
65
+ *
66
+ * @async
67
+ * @function get
68
+ * @param {WebAuthnQuery} query - The query used to retrieve WebAuthn devices.
69
+ * @returns {Promise<WebAuthnDevicesResponse>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
70
+ */
71
+ get: (query: WebAuthnQuery) => Promise<import("./types/webauthn.types.js").WebAuthnDevicesResponse | undefined>;
72
+ /**
73
+ * Updates the name of a WebAuthn device based on the provided query and body.
74
+ *
75
+ * @async
76
+ * @function update
77
+ * @param {WebAuthnQueryWithUUID & WebAuthnBody} query - The query and body used to update the WebAuthn device name.
78
+ * @returns {Promise<UpdatedWebAuthnDevice | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
79
+ */
80
+ update: (query: WebAuthnQueryWithUUID & WebAuthnBody) => Promise<import("./types/webauthn.types.js").UpdatedWebAuthnDevice | undefined>;
81
+ /**
82
+ * Deletes a WebAuthn device based on the provided query and body.
83
+ *
84
+ * @async
85
+ * @function delete
86
+ * @param {WebAuthnQueryWithUUID & WebAuthnBody} query - The query and body used to delete the WebAuthn device.
87
+ * @returns {Promise<WebAuthnDevice | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
88
+ */
89
+ delete: (query: WebAuthnQueryWithUUID & WebAuthnBody) => Promise<import("./types/webauthn.types.js").WebAuthnDevice | undefined>;
90
+ };
91
+ /**
92
+ * Bound devices management methods.
93
+ *
94
+ * @type {BoundDevicesManagement}
95
+ */
96
+ boundDevices: {
97
+ /**
98
+ * Retrieves bound devices based on the specified query.
99
+ *
100
+ * @async
101
+ * @function get
102
+ * @param {BindingDeviceQuery} query - The query used to retrieve bound devices.
103
+ * @returns {Promise<DeviceResponse | undefined>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
104
+ */
105
+ get: (query: BindingDeviceQuery) => Promise<import("./types/binding-device.types.js").DeviceResponse | undefined>;
106
+ /**
107
+ * Deletes a bound device based on the provided query.
108
+ *
109
+ * @async
110
+ * @function delete
111
+ * @param {BindingDeviceQuery} query - The query used to delete the bound device.
112
+ * @returns {Promise<Device | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
113
+ */
114
+ delete: (query: BindingDeviceQuery) => Promise<import("./types/binding-device.types.js").Device | undefined>;
115
+ /**
116
+ * Updates the name of a bound device based on the provided query.
117
+ *
118
+ * @async
119
+ * @function update
120
+ * @param {BindingDeviceQuery} query - The query used to update the bound device name.
121
+ * @returns {Promise<Device | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
122
+ */
123
+ update: (query: BindingDeviceQuery) => Promise<import("./types/binding-device.types.js").Device | undefined>;
124
+ };
125
+ };
126
+ //# sourceMappingURL=device.store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.store.d.ts","sourceRoot":"","sources":["../../../../device-client/src/lib/device.store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,YAAY,WAAY,aAAa;IAmB9C;;;;OAIG;;QAED;;;;;;;WAOG;qBACyB,iBAAiB;QAU7C;;;;;;;WAOG;wBAC4B,eAAe,GAAG,UAAU;;IAW7D;;;;OAIG;;QAED;;;;;;;WAOG;qBACyB,eAAe;QAU3C;;;;;;;WAOG;wBAC4B,iBAAiB;;IAWlD;;;;OAIG;;QAED;;;;;;;WAOG;qBACyB,aAAa;QAUzC;;;;;;;WAOG;wBAC4B,qBAAqB,GAAG,YAAY;QAUnE;;;;;;;WAOG;wBAC4B,qBAAqB,GAAG,YAAY;;IAWrE;;;;OAIG;;QAED;;;;;;;WAOG;qBACyB,kBAAkB;QAU9C;;;;;;;WAOG;wBAC4B,kBAAkB;QAUjD;;;;;;;WAOG;wBAC4B,kBAAkB;;CAWtD,CAAC"}
@@ -0,0 +1,200 @@
1
+ import { configureStore } from '@reduxjs/toolkit';
2
+ import { deviceService } from './services/index.js';
3
+ export const deviceClient = (config) => {
4
+ const { middleware, reducerPath, reducer, endpoints } = deviceService({
5
+ baseUrl: config.serverConfig?.baseUrl ?? '',
6
+ realmPath: config?.realmPath ?? '',
7
+ });
8
+ const store = configureStore({
9
+ reducer: {
10
+ [reducerPath]: reducer,
11
+ },
12
+ middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(middleware),
13
+ });
14
+ /**
15
+ * Device management object containing methods for handling various device types.
16
+ *
17
+ * @type {DeviceManagement}
18
+ */
19
+ return {
20
+ /**
21
+ * Oath device management methods.
22
+ *
23
+ * @type {OathManagement}
24
+ */
25
+ oath: {
26
+ /**
27
+ * Retrieves Oath devices based on the specified query.
28
+ *
29
+ * @async
30
+ * @function get
31
+ * @param {RetrieveOathQuery} query - The query used to retrieve Oath devices.
32
+ * @returns {Promise<OAthResponse>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
33
+ */
34
+ get: async function (query) {
35
+ const response = await store.dispatch(endpoints.getOAthDevices.initiate(query));
36
+ if (!response || !response.data) {
37
+ return undefined;
38
+ }
39
+ return response.data;
40
+ },
41
+ /**
42
+ * Deletes an Oath device based on the provided query and device information.
43
+ *
44
+ * @async
45
+ * @function delete
46
+ * @param {DeleteOathQuery & OathDevice} query - The query and device information used to delete the Oath device.
47
+ * @returns {Promise<DeletedOAthDevice>} - A promise that resolves to the response data or undefined if the response is not valid.
48
+ */
49
+ delete: async function (query) {
50
+ const response = await store.dispatch(endpoints.deleteOathDevice.initiate(query));
51
+ if (!response || !response.data) {
52
+ return undefined;
53
+ }
54
+ return response.data;
55
+ },
56
+ },
57
+ /**
58
+ * Push device management methods.
59
+ *
60
+ * @type {PushManagement}
61
+ */
62
+ push: {
63
+ /**
64
+ * Retrieves Push devices based on the specified query.
65
+ *
66
+ * @async
67
+ * @function get
68
+ * @param {PushDeviceQuery} query - The query used to retrieve Push devices.
69
+ * @returns {Promise<PushDevicesResponse | undefined>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
70
+ */
71
+ get: async function (query) {
72
+ const response = await store.dispatch(endpoints.getPushDevices.initiate(query));
73
+ if (!response || !response.data) {
74
+ return undefined;
75
+ }
76
+ return response.data;
77
+ },
78
+ /**
79
+ * Deletes a Push device based on the provided query.
80
+ *
81
+ * @async
82
+ * @function delete
83
+ * @param {DeleteDeviceQuery} query - The query used to delete the Push device.
84
+ * @returns {Promise<PushDevice>} - A promise that resolves to the response data or undefined if the response is not valid.
85
+ */
86
+ delete: async function (query) {
87
+ const response = await store.dispatch(endpoints.deletePushDevice.initiate(query));
88
+ if (!response || !response.data) {
89
+ return undefined;
90
+ }
91
+ return response.data;
92
+ },
93
+ },
94
+ /**
95
+ * WebAuthn device management methods.
96
+ *
97
+ * @type {WebAuthnManagement}
98
+ */
99
+ webauthn: {
100
+ /**
101
+ * Retrieves WebAuthn devices based on the specified query.
102
+ *
103
+ * @async
104
+ * @function get
105
+ * @param {WebAuthnQuery} query - The query used to retrieve WebAuthn devices.
106
+ * @returns {Promise<WebAuthnDevicesResponse>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
107
+ */
108
+ get: async function (query) {
109
+ const response = await store.dispatch(endpoints.getWebAuthnDevices.initiate(query));
110
+ if (!response || !response.data) {
111
+ return undefined;
112
+ }
113
+ return response.data;
114
+ },
115
+ /**
116
+ * Updates the name of a WebAuthn device based on the provided query and body.
117
+ *
118
+ * @async
119
+ * @function update
120
+ * @param {WebAuthnQueryWithUUID & WebAuthnBody} query - The query and body used to update the WebAuthn device name.
121
+ * @returns {Promise<UpdatedWebAuthnDevice | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
122
+ */
123
+ update: async function (query) {
124
+ const response = await store.dispatch(endpoints.updateWebAuthnDeviceName.initiate(query));
125
+ if (!response || !response.data) {
126
+ return undefined;
127
+ }
128
+ return response.data;
129
+ },
130
+ /**
131
+ * Deletes a WebAuthn device based on the provided query and body.
132
+ *
133
+ * @async
134
+ * @function delete
135
+ * @param {WebAuthnQueryWithUUID & WebAuthnBody} query - The query and body used to delete the WebAuthn device.
136
+ * @returns {Promise<WebAuthnDevice | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
137
+ */
138
+ delete: async function (query) {
139
+ const response = await store.dispatch(endpoints.deleteWebAuthnDeviceName.initiate(query));
140
+ if (!response || !response.data) {
141
+ return undefined;
142
+ }
143
+ return response.data;
144
+ },
145
+ },
146
+ /**
147
+ * Bound devices management methods.
148
+ *
149
+ * @type {BoundDevicesManagement}
150
+ */
151
+ boundDevices: {
152
+ /**
153
+ * Retrieves bound devices based on the specified query.
154
+ *
155
+ * @async
156
+ * @function get
157
+ * @param {BindingDeviceQuery} query - The query used to retrieve bound devices.
158
+ * @returns {Promise<DeviceResponse | undefined>} - A promise that resolves to the retrieved data or undefined if the response is not valid.
159
+ */
160
+ get: async function (query) {
161
+ const response = await store.dispatch(endpoints.getBoundDevices.initiate(query));
162
+ if (!response || !response.data) {
163
+ return undefined;
164
+ }
165
+ return response.data;
166
+ },
167
+ /**
168
+ * Deletes a bound device based on the provided query.
169
+ *
170
+ * @async
171
+ * @function delete
172
+ * @param {BindingDeviceQuery} query - The query used to delete the bound device.
173
+ * @returns {Promise<Device | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
174
+ */
175
+ delete: async function (query) {
176
+ const response = await store.dispatch(endpoints.deleteBindingDevice.initiate(query));
177
+ if (!response || !response.data) {
178
+ return undefined;
179
+ }
180
+ return response.data;
181
+ },
182
+ /**
183
+ * Updates the name of a bound device based on the provided query.
184
+ *
185
+ * @async
186
+ * @function update
187
+ * @param {BindingDeviceQuery} query - The query used to update the bound device name.
188
+ * @returns {Promise<Device | undefined>} - A promise that resolves to the response data or undefined if the response is not valid.
189
+ */
190
+ update: async function (query) {
191
+ const response = await store.dispatch(endpoints.updateBindingDeviceName.initiate(query));
192
+ if (!response || !response.data) {
193
+ return undefined;
194
+ }
195
+ return response.data;
196
+ },
197
+ },
198
+ };
199
+ };
200
+ //# sourceMappingURL=device.store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.store.js","sourceRoot":"","sources":["../../../../device-client/src/lib/device.store.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAqB,EAAE,EAAE;IACpD,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC;QACpE,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,IAAI,EAAE;QAC3C,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,EAAE;KACnC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,cAAc,CAAC;QAC3B,OAAO,EAAE;YACP,CAAC,WAAW,CAAC,EAAE,OAAO;SACvB;QACD,UAAU,EAAE,CAAC,oBAAoB,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,CA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O,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;SACF;QAED;;;;WAIG;QACH,YAAY,EAAE;YACZ;;;;;;;eAOG;YACH,GAAG,EAAE,KAAK,WAAW,KAAyB;gBAC5C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBAEjF,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;oBAChC,OAAO,SAAS,CAAC;gBACnB,CAAC;gBAED,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAED;;;;;;;eAOG;YACH,MAAM,EAAE,KAAK,WAAW,KAAyB;gBAC/C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBAErF,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;oBAChC,OAAO,SAAS,CAAC;gBACnB,CAAC;gBAED,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAED;;;;;;;eAOG;YACH,MAAM,EAAE,KAAK,WAAW,KAAyB;gBAC/C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gBAEzF,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;oBAChC,OAAO,SAAS,CAAC;gBACnB,CAAC;gBAED,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RequestMiddleware } from './request.effect.types.js';
2
+ declare const middleware: RequestMiddleware[];
3
+ export default middleware;
4
+ //# sourceMappingURL=request.effect.mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.effect.mock.d.ts","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.mock.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAA6B,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAa9F,QAAA,MAAM,UAAU,EAAE,iBAAiB,EA2ElC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,106 @@
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
+ * @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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.effect.mock.js","sourceRoot":"","sources":["../../../../src/lib/effects/request.effect.mock.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;;;;;;;;GAQG;AAOH,MAAM,CAAC,GAAG,GAAkB,CAAC;AAC7B,MAAM,CAAC,GAAG,GAAkB,CAAC;AAC7B,MAAM,GAAG,GAAG,GAAkB,CAAC;AAC/B,MAAM,GAAG,GAAG,GAAkB,CAAC;AAC/B,MAAM,GAAG,GAAG,KAAoB,CAAC;AACjC,MAAM,YAAY,GAAG,cAA6B,CAAC;AACnD,MAAM,YAAY,GAAG,eAA8B,CAAC;AAEpD,MAAM,UAAU,GAAwB;IACtC,CAAC,GAAsB,EAAE,MAAc,EAAE,IAAY,EAAQ,EAAE;QAC7D,QAAQ,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