@forgerock/davinci-client 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/src/index.d.ts +2 -1
  2. package/dist/src/index.d.ts.map +1 -1
  3. package/dist/src/index.js +2 -1
  4. package/dist/src/index.js.map +1 -1
  5. package/dist/src/lib/client.store.d.ts +47 -46
  6. package/dist/src/lib/client.store.d.ts.map +1 -1
  7. package/dist/src/lib/client.store.js +99 -86
  8. package/dist/src/lib/client.store.js.map +1 -1
  9. package/dist/src/lib/client.store.utils.d.ts +27 -14
  10. package/dist/src/lib/client.store.utils.d.ts.map +1 -1
  11. package/dist/src/lib/client.store.utils.js +15 -2
  12. package/dist/src/lib/client.store.utils.js.map +1 -1
  13. package/dist/src/lib/client.types.d.ts +58 -4
  14. package/dist/src/lib/client.types.d.ts.map +1 -1
  15. package/dist/src/lib/collector.types.d.ts +204 -11
  16. package/dist/src/lib/collector.types.d.ts.map +1 -1
  17. package/dist/src/lib/collector.types.js +0 -3
  18. package/dist/src/lib/collector.types.js.map +1 -1
  19. package/dist/src/lib/collector.utils.d.ts +75 -21
  20. package/dist/src/lib/collector.utils.d.ts.map +1 -1
  21. package/dist/src/lib/collector.utils.js +318 -16
  22. package/dist/src/lib/collector.utils.js.map +1 -1
  23. package/dist/src/lib/config.types.d.ts +3 -3
  24. package/dist/src/lib/config.types.d.ts.map +1 -1
  25. package/dist/src/lib/davinci.api.d.ts +6 -4
  26. package/dist/src/lib/davinci.api.d.ts.map +1 -1
  27. package/dist/src/lib/davinci.api.js +32 -18
  28. package/dist/src/lib/davinci.api.js.map +1 -1
  29. package/dist/src/lib/davinci.types.d.ts +96 -7
  30. package/dist/src/lib/davinci.types.d.ts.map +1 -1
  31. package/dist/src/lib/davinci.utils.d.ts +4 -7
  32. package/dist/src/lib/davinci.utils.d.ts.map +1 -1
  33. package/dist/src/lib/davinci.utils.js +16 -31
  34. package/dist/src/lib/davinci.utils.js.map +1 -1
  35. package/dist/src/lib/fido/fido.d.ts +27 -0
  36. package/dist/src/lib/fido/fido.d.ts.map +1 -0
  37. package/dist/src/lib/fido/fido.js +108 -0
  38. package/dist/src/lib/fido/fido.js.map +1 -0
  39. package/dist/src/lib/fido/fido.utils.d.ts +31 -0
  40. package/dist/src/lib/fido/fido.utils.d.ts.map +1 -0
  41. package/dist/src/lib/fido/fido.utils.js +115 -0
  42. package/dist/src/lib/fido/fido.utils.js.map +1 -0
  43. package/dist/src/lib/node.reducer.d.ts +4 -4
  44. package/dist/src/lib/node.reducer.d.ts.map +1 -1
  45. package/dist/src/lib/node.reducer.js +95 -8
  46. package/dist/src/lib/node.reducer.js.map +1 -1
  47. package/dist/src/lib/node.slice.d.ts +44 -8
  48. package/dist/src/lib/node.slice.d.ts.map +1 -1
  49. package/dist/src/lib/node.slice.js +40 -10
  50. package/dist/src/lib/node.slice.js.map +1 -1
  51. package/dist/src/lib/node.types.d.ts +6 -5
  52. package/dist/src/lib/node.types.d.ts.map +1 -1
  53. package/dist/src/lib/node.utils.d.ts +2 -2
  54. package/dist/src/lib/node.utils.d.ts.map +1 -1
  55. package/dist/src/lib/wellknown.api.d.ts +1 -1
  56. package/dist/src/types.d.ts +18 -4
  57. package/dist/src/types.d.ts.map +1 -1
  58. package/dist/src/types.js +1 -2
  59. package/dist/src/types.js.map +1 -1
  60. package/package.json +11 -20
  61. package/dist/src/lib/authorize.utils.d.ts +0 -22
  62. package/dist/src/lib/authorize.utils.d.ts.map +0 -1
  63. package/dist/src/lib/authorize.utils.js +0 -47
  64. package/dist/src/lib/authorize.utils.js.map +0 -1
  65. package/dist/src/lib/effects/request.effect.mock.d.ts +0 -4
  66. package/dist/src/lib/effects/request.effect.mock.d.ts.map +0 -1
  67. package/dist/src/lib/effects/request.effect.mock.js +0 -106
  68. package/dist/src/lib/effects/request.effect.mock.js.map +0 -1
  69. package/dist/src/lib/effects/request.effect.types.d.ts +0 -20
  70. package/dist/src/lib/effects/request.effect.types.d.ts.map +0 -1
  71. package/dist/src/lib/effects/request.effect.types.js +0 -2
  72. package/dist/src/lib/effects/request.effect.types.js.map +0 -1
  73. package/dist/src/lib/effects/request.effect.unions.d.ts +0 -12
  74. package/dist/src/lib/effects/request.effect.unions.d.ts.map +0 -1
  75. package/dist/src/lib/effects/request.effect.unions.js +0 -16
  76. package/dist/src/lib/effects/request.effect.unions.js.map +0 -1
  77. package/dist/src/lib/effects/request.effect.utils.d.ts +0 -27
  78. package/dist/src/lib/effects/request.effect.utils.d.ts.map +0 -1
  79. package/dist/src/lib/effects/request.effect.utils.js +0 -57
  80. package/dist/src/lib/effects/request.effect.utils.js.map +0 -1
  81. package/dist/src/lib/error.types.d.ts +0 -6
  82. package/dist/src/lib/error.types.d.ts.map +0 -1
  83. package/dist/src/lib/error.types.js +0 -2
  84. package/dist/src/lib/error.types.js.map +0 -1
@@ -1,3 +1,4 @@
1
1
  import { davinci } from './lib/client.store.js';
2
- export { davinci };
2
+ import { fido } from './lib/fido/fido.js';
3
+ export { davinci, fido };
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/dist/src/index.js CHANGED
@@ -5,5 +5,6 @@
5
5
  * of the MIT license. See the LICENSE file for details.
6
6
  */
7
7
  import { davinci } from './lib/client.store.js';
8
- export { davinci };
8
+ import { fido } from './lib/fido/fido.js';
9
+ export { davinci, fido };
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -1,11 +1,16 @@
1
+ /**
2
+ * Import RTK slices and api
3
+ */
4
+ import { CustomLogger, LogLevel } from '@forgerock/sdk-logger';
5
+ import type { ActionTypes, RequestMiddleware } from '@forgerock/sdk-request-middleware';
1
6
  /**
2
7
  * Import the DaVinciRequest types
3
8
  */
4
9
  import type { DaVinciConfig } from './config.types.js';
5
10
  import type { DaVinciAction, DaVinciRequest, OutgoingQueryParams, StartOptions } from './davinci.types.js';
6
- import type { SingleValueCollectors, IdpCollector, MultiSelectCollector } from './collector.types.js';
7
- import type { InitFlow, Updater, Validator } from './client.types.js';
8
- import type { RequestMiddleware } from './effects/request.effect.types.js';
11
+ import type { SingleValueCollectors, MultiSelectCollector, ObjectValueCollectors, AutoCollectors, MultiValueCollectors } from './collector.types.js';
12
+ import type { InitFlow, InternalErrorResponse, NodeStates, Updater, Validator } from './client.types.js';
13
+ import type { ContinueNode, StartNode } from './node.types.js';
9
14
  /**
10
15
  * Create a client function that returns a set of methods
11
16
  * to interact with and normalize the DaVinci API.
@@ -14,9 +19,13 @@ import type { RequestMiddleware } from './effects/request.effect.types.js';
14
19
  * @param {ConfigurationOptions} options - the configuration options for the client
15
20
  * @returns {Observable} - an observable client for DaVinci flows
16
21
  */
17
- export declare function davinci({ config, requestMiddleware, }: {
22
+ export declare function davinci<ActionType extends ActionTypes = ActionTypes>({ config, requestMiddleware, logger, }: {
18
23
  config: DaVinciConfig;
19
- requestMiddleware?: RequestMiddleware[];
24
+ requestMiddleware?: RequestMiddleware<ActionType>[];
25
+ logger?: {
26
+ level: LogLevel;
27
+ custom?: CustomLogger;
28
+ };
20
29
  }): Promise<{
21
30
  subscribe: (listener: () => void) => import("@reduxjs/toolkit").Unsubscribe;
22
31
  /**
@@ -26,8 +35,8 @@ export declare function davinci({ config, requestMiddleware, }: {
26
35
  * for the social login being started.
27
36
  *
28
37
  * This method will save the `continueUrl`
29
- * and then replace the window with the authenticate
30
- * url from the collector
38
+ * and then the app developer can use the url
39
+ * from the collector to redirect their application
31
40
  *
32
41
  * Can return an error when no continue url is found
33
42
  * or no authenticate url is found in the collectors
@@ -36,7 +45,7 @@ export declare function davinci({ config, requestMiddleware, }: {
36
45
  * @param collector IdpCollector
37
46
  * @returns {function}
38
47
  */
39
- externalIdp: (collector: IdpCollector) => () => void | import("./client.types.js").InternalErrorResponse;
48
+ externalIdp: () => (() => Promise<void | InternalErrorResponse>);
40
49
  /**
41
50
  * @method flow - Method for initiating a new flow, different than current flow
42
51
  * @param {DaVinciAction} action - the action to initiate the flow
@@ -48,42 +57,32 @@ export declare function davinci({ config, requestMiddleware, }: {
48
57
  * @param {DaVinciRequest} args - the arguments to pass to the next
49
58
  * @returns {Promise} - a promise that resolves to the next node
50
59
  */
51
- next: (args?: DaVinciRequest) => Promise<import("./node.types.js").ContinueNode | import("./node.types.js").ErrorNode | import("./node.types.js").FailureNode | import("./node.types.js").StartNode | import("./node.types.js").SuccessNode | {
52
- error: string;
53
- cache: null;
54
- client: {
55
- status: "start";
56
- };
57
- server: {
58
- status: "start";
59
- };
60
- status: "start";
61
- }>;
60
+ next: (args?: DaVinciRequest) => Promise<NodeStates>;
62
61
  /**
63
62
  * @method: resume - Resume a social login flow when returned to application
64
63
  * @returns unknown
65
64
  */
66
- resume: ({ continueToken }: {
65
+ resume: ({ continueToken, }: {
67
66
  continueToken: string;
68
- }) => Promise<import("./node.types.js").ContinueNode | import("./node.types.js").ErrorNode | import("./node.types.js").FailureNode | import("./node.types.js").StartNode | import("./node.types.js").SuccessNode>;
67
+ }) => Promise<InternalErrorResponse | NodeStates>;
69
68
  /**
70
69
  * @method start - Method for initiating a DaVinci flow
71
70
  * @returns {Promise} - a promise that initiates a DaVinci flow and returns a node
72
71
  */
73
- start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(options?: StartOptions<QueryParams> | undefined) => Promise<import("./node.types.js").ContinueNode | import("./node.types.js").ErrorNode | import("./node.types.js").FailureNode | import("./node.types.js").StartNode | import("./node.types.js").SuccessNode>;
72
+ start: <QueryParams extends OutgoingQueryParams = OutgoingQueryParams>(options?: StartOptions<QueryParams> | undefined) => Promise<ContinueNode | import("./node.types.js").ErrorNode | import("./node.types.js").FailureNode | StartNode | import("./node.types.js").SuccessNode>;
74
73
  /**
75
74
  * @method update - Exclusive method for updating the current node with user provided values
76
- * @param {SingleValueCollector} collector - the collector to update
75
+ * @param {SingleValueCollector | MultiSelectCollector | ObjectValueCollectors | AutoCollectors} collector - the collector to update
77
76
  * @returns {function} - a function to call for updating collector value
78
77
  */
79
- update: (collector: SingleValueCollectors | MultiSelectCollector) => Updater;
78
+ update: <T extends SingleValueCollectors | MultiSelectCollector | ObjectValueCollectors | AutoCollectors>(collector: T) => Updater<T>;
80
79
  /**
81
80
  * @method validate - Method for validating the value against validation rules
82
- * @param {SingleValueCollector} collector - the collector to validate
81
+ * @param {SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors} collector - the collector to validate
83
82
  * @returns {function} - a function to call for validating collector value
84
- * @throws {Error} - if the collector is not a SingleValueCollector
83
+ * @throws {Error} - if the collector cannot be validated
85
84
  */
86
- validate: (collector: SingleValueCollectors) => Validator;
85
+ validate: (collector: SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors) => Validator;
87
86
  /**
88
87
  * @method client - Selector to get the node.client from state
89
88
  * @returns {Node.client} - the client property from the current node
@@ -122,7 +121,7 @@ export declare function davinci({ config, requestMiddleware, }: {
122
121
  * @method node - Selector to get the node from state
123
122
  * @returns {Node} - the current node from state
124
123
  */
125
- getNode: () => import("./node.types.js").ContinueNode | import("./node.types.js").ErrorNode | import("./node.types.js").FailureNode | import("./node.types.js").StartNode | import("./node.types.js").SuccessNode;
124
+ getNode: () => ContinueNode | import("./node.types.js").ErrorNode | import("./node.types.js").FailureNode | StartNode | import("./node.types.js").SuccessNode;
126
125
  /**
127
126
  * @method server - Selector to get the node.server from state
128
127
  * @returns {Node.server} - the server property from the current node
@@ -167,12 +166,13 @@ export declare function davinci({ config, requestMiddleware, }: {
167
166
  */
168
167
  cache: {
169
168
  getLatestResponse: () => ((state: import("@reduxjs/toolkit/query").RootState<{
170
- flow: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
171
- next: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
172
- start: import("@reduxjs/toolkit/query").MutationDefinition<StartOptions<OutgoingQueryParams> | undefined, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
169
+ flow: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", any>;
170
+ next: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", any>;
171
+ start: import("@reduxjs/toolkit/query").MutationDefinition<StartOptions<OutgoingQueryParams> | undefined, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", unknown>;
173
172
  resume: import("@reduxjs/toolkit/query").QueryDefinition<{
173
+ serverInfo: ContinueNode["server"];
174
174
  continueToken: string;
175
- }, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
175
+ }, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", unknown>;
176
176
  }, never, "davinci">) => ({
177
177
  requestId?: undefined;
178
178
  status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
@@ -192,14 +192,14 @@ export declare function davinci({ config, requestMiddleware, }: {
192
192
  } & Omit<{
193
193
  requestId: string;
194
194
  data?: unknown;
195
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
195
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
196
196
  endpointName: string;
197
197
  startedTimeStamp: number;
198
198
  fulfilledTimeStamp?: number;
199
199
  }, "data" | "fulfilledTimeStamp"> & Required<Pick<{
200
200
  requestId: string;
201
201
  data?: unknown;
202
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
202
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
203
203
  endpointName: string;
204
204
  startedTimeStamp: number;
205
205
  fulfilledTimeStamp?: number;
@@ -216,7 +216,7 @@ export declare function davinci({ config, requestMiddleware, }: {
216
216
  } & {
217
217
  requestId: string;
218
218
  data?: unknown;
219
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
219
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
220
220
  endpointName: string;
221
221
  startedTimeStamp: number;
222
222
  fulfilledTimeStamp?: number;
@@ -233,14 +233,14 @@ export declare function davinci({ config, requestMiddleware, }: {
233
233
  } & Omit<{
234
234
  requestId: string;
235
235
  data?: unknown;
236
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
236
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
237
237
  endpointName: string;
238
238
  startedTimeStamp: number;
239
239
  fulfilledTimeStamp?: number;
240
240
  }, "error"> & Required<Pick<{
241
241
  requestId: string;
242
242
  data?: unknown;
243
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
243
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
244
244
  endpointName: string;
245
245
  startedTimeStamp: number;
246
246
  fulfilledTimeStamp?: number;
@@ -257,12 +257,13 @@ export declare function davinci({ config, requestMiddleware, }: {
257
257
  };
258
258
  };
259
259
  getResponseWithId: (requestId: string) => ((state: import("@reduxjs/toolkit/query").RootState<{
260
- flow: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
261
- next: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
262
- start: import("@reduxjs/toolkit/query").MutationDefinition<StartOptions<OutgoingQueryParams> | undefined, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
260
+ flow: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", any>;
261
+ next: import("@reduxjs/toolkit/query").MutationDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", any>;
262
+ start: import("@reduxjs/toolkit/query").MutationDefinition<StartOptions<OutgoingQueryParams> | undefined, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", unknown>;
263
263
  resume: import("@reduxjs/toolkit/query").QueryDefinition<{
264
+ serverInfo: ContinueNode["server"];
264
265
  continueToken: string;
265
- }, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci">;
266
+ }, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, unknown, "davinci", unknown>;
266
267
  }, never, "davinci">) => ({
267
268
  requestId?: undefined;
268
269
  status: import("@reduxjs/toolkit/query").QueryStatus.uninitialized;
@@ -282,14 +283,14 @@ export declare function davinci({ config, requestMiddleware, }: {
282
283
  } & Omit<{
283
284
  requestId: string;
284
285
  data?: unknown;
285
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
286
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
286
287
  endpointName: string;
287
288
  startedTimeStamp: number;
288
289
  fulfilledTimeStamp?: number;
289
290
  }, "data" | "fulfilledTimeStamp"> & Required<Pick<{
290
291
  requestId: string;
291
292
  data?: unknown;
292
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
293
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
293
294
  endpointName: string;
294
295
  startedTimeStamp: number;
295
296
  fulfilledTimeStamp?: number;
@@ -306,7 +307,7 @@ export declare function davinci({ config, requestMiddleware, }: {
306
307
  } & {
307
308
  requestId: string;
308
309
  data?: unknown;
309
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
310
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
310
311
  endpointName: string;
311
312
  startedTimeStamp: number;
312
313
  fulfilledTimeStamp?: number;
@@ -323,14 +324,14 @@ export declare function davinci({ config, requestMiddleware, }: {
323
324
  } & Omit<{
324
325
  requestId: string;
325
326
  data?: unknown;
326
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
327
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
327
328
  endpointName: string;
328
329
  startedTimeStamp: number;
329
330
  fulfilledTimeStamp?: number;
330
331
  }, "error"> & Required<Pick<{
331
332
  requestId: string;
332
333
  data?: unknown;
333
- error?: import("@reduxjs/toolkit/query").FetchBaseQueryError | import("@reduxjs/toolkit").SerializedError | undefined;
334
+ error?: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError | undefined;
334
335
  endpointName: string;
335
336
  startedTimeStamp: number;
336
337
  fulfilledTimeStamp?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"client.store.d.ts","sourceRoot":"","sources":["../../../src/lib/client.store.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,EAC5B,MAAM,EACN,iBAAiB,GAClB,EAAE;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;;IAyBG;;;;;;;;;;;;;;;;OAgBG;6BACsB,YAAY;IAQrC;;;;OAIG;mBACY,aAAa,KAAG,QAAQ;IAkBvC;;;;OAIG;kBACiB,cAAc;;;;;;;;;;;IAclC;;;OAGG;gCAC+B;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE;IAQ3D;;;OAGG;YACW,WAAW,SAAS,mBAAmB,kCACzC,YAAY,CAAC,WAAW,CAAC,GAAG,SAAS;IAMjD;;;;OAIG;wBACiB,qBAAqB,GAAG,oBAAoB,KAAG,OAAO;IA6D1E;;;;;OAKG;0BACmB,qBAAqB,KAAG,SAAS;IAkDvD;;;OAGG;;;;;;;;;;;;;;;;;;;gBA/MC,CAAC;iBACJ,CAAJ;;;;IAiNG;;;OAGG;;;;IAsBH;;;OAGG;;IAKH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAgB8B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAc1C"}
1
+ {"version":3,"file":"client.store.d.ts","sourceRoot":"","sources":["../../../src/lib/client.store.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAsB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AASnF,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACxF;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EAErB,cAAc,EACd,oBAAoB,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,UAAU,EACV,OAAO,EACP,SAAS,EACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAAC,UAAU,SAAS,WAAW,GAAG,WAAW,EAAE,EAC1E,MAAM,EACN,iBAAiB,EACjB,MAAM,GACP,EAAE;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;IACpD,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,QAAQ,CAAC;QAChB,MAAM,CAAC,EAAE,YAAY,CAAC;KACvB,CAAC;CACH;;IAqCG;;;;;;;;;;;;;;;;OAgBG;uBACc,CAAC,MAAM,OAAO,CAAC,IAAI,GAAG,qBAAqB,CAAC,CAAC;IAoB9D;;;;OAIG;mBACY,aAAa,KAAG,QAAQ;IAkBvC;;;;OAIG;kBACiB,cAAc,KAAG,OAAO,CAAC,UAAU,CAAC;IAkBxD;;;OAGG;iCAGA;QACD,aAAa,EAAE,MAAM,CAAC;KACvB,KAAG,OAAO,CAAC,qBAAqB,GAAG,UAAU,CAAC;IAwB/C;;;OAGG;YACW,WAAW,SAAS,mBAAmB,kCACzC,YAAY,CAAC,WAAW,CAAC,GAAG,SAAS;IAMjD;;;;OAIG;aAED,CAAC,SACG,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,cAAc,aAEP,CAAC,KACX,OAAO,CAAC,CAAC,CAAC;IA4Db;;;;;OAKG;0BAGG,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,cAAc,KACjB,SAAS;IA+CZ;;;OAGG;;;;;;;;;;;;;;;;;;;gBA3QqB,CAAC;iBAAqB,CAAC;;;;IA8Q/C;;;OAGG;;;;IAgCH;;;OAGG;;IAKH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAgB8B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAc1C"}
@@ -7,13 +7,14 @@
7
7
  /**
8
8
  * Import RTK slices and api
9
9
  */
10
- import { createClientStore } from './client.store.utils.js';
10
+ import { logger as loggerFn } from '@forgerock/sdk-logger';
11
+ import { createStorage } from '@forgerock/storage';
12
+ import { createClientStore, handleUpdateValidateError } from './client.store.utils.js';
11
13
  import { nodeSlice } from './node.slice.js';
12
14
  import { davinciApi } from './davinci.api.js';
13
15
  import { configSlice } from './config.slice.js';
14
16
  import { wellknownApi } from './wellknown.api.js';
15
17
  import { returnValidator } from './collector.utils.js';
16
- import { authorize } from './davinci.utils.js';
17
18
  /**
18
19
  * Create a client function that returns a set of methods
19
20
  * to interact with and normalize the DaVinci API.
@@ -22,17 +23,28 @@ import { authorize } from './davinci.utils.js';
22
23
  * @param {ConfigurationOptions} options - the configuration options for the client
23
24
  * @returns {Observable} - an observable client for DaVinci flows
24
25
  */
25
- export async function davinci({ config, requestMiddleware, }) {
26
- const store = createClientStore({ requestMiddleware });
26
+ export async function davinci({ config, requestMiddleware, logger, }) {
27
+ const log = loggerFn({ level: logger?.level || 'error', custom: logger?.custom });
28
+ const store = createClientStore({ requestMiddleware, logger: log });
29
+ const serverInfo = createStorage({
30
+ type: 'localStorage',
31
+ name: 'serverInfo',
32
+ });
27
33
  if (!config.serverConfig.wellknown) {
28
- throw new Error('`wellknown` property is a required as part of the `config.serverOptions`');
34
+ const error = new Error('`wellknown` property is a required as part of the `config.serverConfig`');
35
+ log.error(error.message);
36
+ throw error;
29
37
  }
30
38
  if (!config.clientId) {
31
- throw new Error('`clientId` property is a required as part of the `config`');
39
+ const error = new Error('`clientId` property is a required as part of the `config`');
40
+ log.error(error.message);
41
+ throw error;
32
42
  }
33
43
  const { data: openIdResponse } = await store.dispatch(wellknownApi.endpoints.wellknown.initiate(config.serverConfig.wellknown));
34
44
  if (!openIdResponse) {
35
- throw new Error('error fetching `wellknown` response for OpenId Configuration');
45
+ const error = new Error('error fetching `wellknown` response for OpenId Configuration');
46
+ log.error(error.message);
47
+ throw error;
36
48
  }
37
49
  store.dispatch(configSlice.actions.set({ ...config, wellknownResponse: openIdResponse }));
38
50
  return {
@@ -45,8 +57,8 @@ export async function davinci({ config, requestMiddleware, }) {
45
57
  * for the social login being started.
46
58
  *
47
59
  * This method will save the `continueUrl`
48
- * and then replace the window with the authenticate
49
- * url from the collector
60
+ * and then the app developer can use the url
61
+ * from the collector to redirect their application
50
62
  *
51
63
  * Can return an error when no continue url is found
52
64
  * or no authenticate url is found in the collectors
@@ -55,10 +67,22 @@ export async function davinci({ config, requestMiddleware, }) {
55
67
  * @param collector IdpCollector
56
68
  * @returns {function}
57
69
  */
58
- externalIdp: (collector) => {
70
+ externalIdp: () => {
59
71
  const rootState = store.getState();
60
72
  const serverSlice = nodeSlice.selectors.selectServer(rootState);
61
- return () => authorize(serverSlice, collector);
73
+ if (serverSlice && serverSlice.status === 'continue') {
74
+ return async () => {
75
+ await serverInfo.set(serverSlice);
76
+ };
77
+ }
78
+ return async () => {
79
+ return {
80
+ error: {
81
+ message: 'Not in a continue node state, must be in a continue node to use external idp method',
82
+ type: 'state_error',
83
+ },
84
+ };
85
+ };
62
86
  },
63
87
  /**
64
88
  * @method flow - Method for initiating a new flow, different than current flow
@@ -67,7 +91,7 @@ export async function davinci({ config, requestMiddleware, }) {
67
91
  */
68
92
  flow: (action) => {
69
93
  if (!action.action) {
70
- console.error('Missing `argument.action`');
94
+ log.error('Missing `argument.action`');
71
95
  return async function () {
72
96
  return {
73
97
  error: { message: 'Missing argument.action', type: 'argument_error' },
@@ -91,7 +115,11 @@ export async function davinci({ config, requestMiddleware, }) {
91
115
  if (nodeCheck.status === 'start') {
92
116
  return {
93
117
  ...nodeCheck,
94
- error: 'Please use `start` before calling `next`',
118
+ error: {
119
+ status: 'error',
120
+ type: 'state_error',
121
+ message: 'Please use `start` before calling `next`',
122
+ },
95
123
  };
96
124
  }
97
125
  await store.dispatch(davinciApi.endpoints.next.initiate(args));
@@ -102,10 +130,24 @@ export async function davinci({ config, requestMiddleware, }) {
102
130
  * @method: resume - Resume a social login flow when returned to application
103
131
  * @returns unknown
104
132
  */
105
- resume: async ({ continueToken }) => {
106
- await store.dispatch(davinciApi.endpoints.resume.initiate({ continueToken }));
107
- const node = nodeSlice.selectSlice(store.getState());
108
- return node;
133
+ resume: async ({ continueToken, }) => {
134
+ try {
135
+ const storedServerInfo = (await serverInfo.get());
136
+ await store.dispatch(davinciApi.endpoints.resume.initiate({ continueToken, serverInfo: storedServerInfo }));
137
+ await serverInfo.remove();
138
+ const node = nodeSlice.selectSlice(store.getState());
139
+ return node;
140
+ }
141
+ catch {
142
+ // logger.error('No url found in collector, social login needs a url in the collector');
143
+ return {
144
+ error: {
145
+ message: 'No url found in storage, social login needs a continue url which is saved in local storage. You may have cleared your browser data',
146
+ type: 'internal_error',
147
+ },
148
+ type: 'internal_error',
149
+ };
150
+ }
109
151
  },
110
152
  /**
111
153
  * @method start - Method for initiating a DaVinci flow
@@ -117,46 +159,28 @@ export async function davinci({ config, requestMiddleware, }) {
117
159
  },
118
160
  /**
119
161
  * @method update - Exclusive method for updating the current node with user provided values
120
- * @param {SingleValueCollector} collector - the collector to update
162
+ * @param {SingleValueCollector | MultiSelectCollector | ObjectValueCollectors | AutoCollectors} collector - the collector to update
121
163
  * @returns {function} - a function to call for updating collector value
122
164
  */
123
165
  update: (collector) => {
124
166
  if (!collector.id) {
125
- console.error('Argument for `collector` has no ID');
126
- return function () {
127
- return {
128
- error: {
129
- message: 'Argument for `collector` has no ID',
130
- type: 'argument_error',
131
- },
132
- type: 'internal_error',
133
- };
134
- };
167
+ return handleUpdateValidateError('Argument for `collector` has no ID', 'argument_error', log.error);
135
168
  }
136
169
  const { id } = collector;
137
- const collectorToUpdate = nodeSlice.selectors.selectCollector(store.getState(), id);
170
+ const { error, state: collectorToUpdate } = nodeSlice.selectors.selectCollector(store.getState(), id);
171
+ if (error) {
172
+ return handleUpdateValidateError(error.message, 'state_error', log.error);
173
+ }
138
174
  if (!collectorToUpdate) {
139
- return function () {
140
- console.error('Collector not found');
141
- return {
142
- type: 'internal_error',
143
- error: { message: 'Collector not found', type: 'state_error' },
144
- };
145
- };
175
+ return handleUpdateValidateError('Collector not found', 'state_error', log.error);
146
176
  }
147
177
  if (collectorToUpdate.category !== 'MultiValueCollector' &&
148
178
  collectorToUpdate.category !== 'SingleValueCollector' &&
149
- collectorToUpdate.category !== 'ValidatedSingleValueCollector') {
150
- console.error('Collector is not a MultiValueCollector, SingleValueCollector or ValidatedSingleValueCollector and cannot be updated');
151
- return function () {
152
- return {
153
- type: 'internal_error',
154
- error: {
155
- message: 'Collector is not a SingleValueCollector or ValidatedSingleValueCollector and cannot be updated',
156
- type: 'state_error',
157
- },
158
- };
159
- };
179
+ collectorToUpdate.category !== 'ValidatedSingleValueCollector' &&
180
+ collectorToUpdate.category !== 'ObjectValueCollector' &&
181
+ collectorToUpdate.category !== 'SingleValueAutoCollector' &&
182
+ collectorToUpdate.category !== 'ObjectValueAutoCollector') {
183
+ return handleUpdateValidateError('Collector does not fall into a category that can be updated', 'state_error', log.error);
160
184
  }
161
185
  return function (value, index) {
162
186
  try {
@@ -174,51 +198,30 @@ export async function davinci({ config, requestMiddleware, }) {
174
198
  },
175
199
  /**
176
200
  * @method validate - Method for validating the value against validation rules
177
- * @param {SingleValueCollector} collector - the collector to validate
201
+ * @param {SingleValueCollectors | ObjectValueCollectors | MultiValueCollectors | AutoCollectors} collector - the collector to validate
178
202
  * @returns {function} - a function to call for validating collector value
179
- * @throws {Error} - if the collector is not a SingleValueCollector
203
+ * @throws {Error} - if the collector cannot be validated
180
204
  */
181
205
  validate: (collector) => {
182
206
  if (!collector.id) {
183
- console.error('Argument for `collector` has no ID');
184
- return function () {
185
- return {
186
- error: { message: 'Argument for `collector` has no ID', type: 'argument_error' },
187
- type: 'internal_error',
188
- };
189
- };
207
+ return handleUpdateValidateError('Argument for `collector` has no ID', 'argument_error', log.error);
190
208
  }
191
209
  const { id } = collector;
192
- const collectorToUpdate = nodeSlice.selectors.selectCollector(store.getState(), id);
210
+ const { error, state: collectorToUpdate } = nodeSlice.selectors.selectCollector(store.getState(), id);
211
+ if (error) {
212
+ return handleUpdateValidateError(error.message, 'state_error', log.error);
213
+ }
193
214
  if (!collectorToUpdate) {
194
- return function () {
195
- console.error('Collector not found');
196
- return {
197
- type: 'internal_error',
198
- error: { message: 'Collector not found', type: 'state_error' },
199
- };
200
- };
215
+ return handleUpdateValidateError('Collector not found', 'state_error', log.error);
201
216
  }
202
- if (collectorToUpdate.category !== 'ValidatedSingleValueCollector') {
203
- console.error('Collector is not a SingleValueCollector and cannot be validated');
204
- return function () {
205
- return {
206
- type: 'internal_error',
207
- error: {
208
- message: 'Collector is not a SingleValueCollector and cannot be validated',
209
- type: 'state_error',
210
- },
211
- };
212
- };
217
+ if (collectorToUpdate.category !== 'ValidatedSingleValueCollector' &&
218
+ collectorToUpdate.category !== 'ObjectValueCollector' &&
219
+ collectorToUpdate.category !== 'MultiValueCollector' &&
220
+ collectorToUpdate.category !== 'ObjectValueAutoCollector') {
221
+ return handleUpdateValidateError('Collector does not fall into a category that can be validated', 'state_error', log.error);
213
222
  }
214
223
  if (!('validation' in collectorToUpdate.input)) {
215
- console.error('Collector has no validation rules');
216
- return function () {
217
- return {
218
- type: 'internal_error',
219
- error: { message: 'Collector has no validation rules', type: 'state_error' },
220
- };
221
- };
224
+ return handleUpdateValidateError('Collector has no validation rules', 'state_error', log.error);
222
225
  }
223
226
  return returnValidator(collectorToUpdate);
224
227
  },
@@ -236,7 +239,12 @@ export async function davinci({ config, requestMiddleware, }) {
236
239
  const client = nodeSlice.selectors.selectClient(state);
237
240
  // Let's check if the node has a client and collectors
238
241
  if (client && 'collectors' in client) {
239
- return nodeSlice.selectors.selectCollectors(state) || [];
242
+ const { error, state: collectors } = nodeSlice.selectors.selectCollectors(state) || [];
243
+ if (error) {
244
+ log.error(error.message);
245
+ return [];
246
+ }
247
+ return collectors;
240
248
  }
241
249
  // Return an empty array if no client or collectors are found
242
250
  return [];
@@ -247,7 +255,12 @@ export async function davinci({ config, requestMiddleware, }) {
247
255
  },
248
256
  getErrorCollectors: () => {
249
257
  const state = store.getState();
250
- return nodeSlice.selectors.selectErrorCollectors(state);
258
+ const { error, state: collectors } = nodeSlice.selectors.selectErrorCollectors(state);
259
+ if (error) {
260
+ log.error(error.message);
261
+ return [];
262
+ }
263
+ return collectors;
251
264
  },
252
265
  /**
253
266
  * @method node - Selector to get the node from state
@@ -271,7 +284,7 @@ export async function davinci({ config, requestMiddleware, }) {
271
284
  getLatestResponse: () => {
272
285
  const node = nodeSlice.selectSlice(store.getState());
273
286
  if (!node.cache?.key) {
274
- console.error(`Cannot find current node's cache key or no current node`);
287
+ log.error(`Cannot find current node's cache key or no current node`);
275
288
  return { error: { message: 'Cannot find current node', type: 'state_error' } };
276
289
  }
277
290
  const flowItem = davinciApi.endpoints.flow.select(node.cache.key);
@@ -281,7 +294,7 @@ export async function davinci({ config, requestMiddleware, }) {
281
294
  },
282
295
  getResponseWithId: (requestId) => {
283
296
  if (!requestId) {
284
- console.error('Please provide the cache key');
297
+ log.error('Please provide the cache key');
285
298
  return { error: { message: 'Please provide the cache key', type: 'argument_error' } };
286
299
  }
287
300
  const flowItem = davinciApi.endpoints.flow.select(requestId);