@forgerock/davinci-client 0.1.3
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/README.md +354 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/lib/authorize.utils.d.ts +22 -0
- package/dist/lib/authorize.utils.d.ts.map +1 -0
- package/dist/lib/authorize.utils.js +23 -0
- package/dist/lib/client.store.d.ts +149 -0
- package/dist/lib/client.store.d.ts.map +1 -0
- package/dist/lib/client.store.js +131 -0
- package/dist/lib/client.store.utils.d.ts +46 -0
- package/dist/lib/client.store.utils.d.ts.map +1 -0
- package/dist/lib/client.store.utils.js +19 -0
- package/dist/lib/client.types.d.ts +9 -0
- package/dist/lib/client.types.d.ts.map +1 -0
- package/dist/lib/collector.types.d.ts +78 -0
- package/dist/lib/collector.types.d.ts.map +1 -0
- package/dist/lib/collector.utils.d.ts +54 -0
- package/dist/lib/collector.utils.d.ts.map +1 -0
- package/dist/lib/collector.utils.js +88 -0
- package/dist/lib/config.slice.d.ts +35 -0
- package/dist/lib/config.slice.d.ts.map +1 -0
- package/dist/lib/config.slice.js +40 -0
- package/dist/lib/config.types.d.ts +9 -0
- package/dist/lib/config.types.d.ts.map +1 -0
- package/dist/lib/davinci.api.d.ts +20 -0
- package/dist/lib/davinci.api.d.ts.map +1 -0
- package/dist/lib/davinci.api.js +172 -0
- package/dist/lib/davinci.types.d.ts +185 -0
- package/dist/lib/davinci.types.d.ts.map +1 -0
- package/dist/lib/davinci.utils.d.ts +18 -0
- package/dist/lib/davinci.utils.d.ts.map +1 -0
- package/dist/lib/davinci.utils.js +102 -0
- package/dist/lib/error.types.d.ts +6 -0
- package/dist/lib/error.types.d.ts.map +1 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/node.reducer.d.ts +22 -0
- package/dist/lib/node.reducer.d.ts.map +1 -0
- package/dist/lib/node.reducer.js +31 -0
- package/dist/lib/node.slice.d.ts +134 -0
- package/dist/lib/node.slice.d.ts.map +1 -0
- package/dist/lib/node.slice.js +160 -0
- package/dist/lib/node.types.d.ts +109 -0
- package/dist/lib/node.types.d.ts.map +1 -0
- package/dist/lib/wellknown.api.d.ts +5 -0
- package/dist/lib/wellknown.api.d.ts.map +1 -0
- package/dist/lib/wellknown.api.js +15 -0
- package/dist/lib/wellknown.types.d.ts +38 -0
- package/dist/lib/wellknown.types.d.ts.map +1 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { updateCollectorValues } from './node.reducer';
|
|
2
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
3
|
+
import { SubmitCollector } from './collector.types';
|
|
4
|
+
import { DavinciErrorResponse, DaVinciFailureResponse, DaVinciNextResponse, DaVinciSuccessResponse } from './davinci.types';
|
|
5
|
+
import { ContinueNode, SuccessNode, ErrorNode, StartNode, FailureNode } from './node.types';
|
|
6
|
+
/**
|
|
7
|
+
* @const initialNodeState - Initial state for the node slice
|
|
8
|
+
*/
|
|
9
|
+
export declare const initialNodeState: {
|
|
10
|
+
cache: null;
|
|
11
|
+
client: {
|
|
12
|
+
status: string;
|
|
13
|
+
};
|
|
14
|
+
error: null;
|
|
15
|
+
server: {
|
|
16
|
+
status: string;
|
|
17
|
+
};
|
|
18
|
+
status: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @const nodeSlice - Slice for handling the node state
|
|
22
|
+
* @see https://redux-toolkit.js.org/api/createSlice
|
|
23
|
+
*/
|
|
24
|
+
export declare const nodeSlice: import('@reduxjs/toolkit').Slice<ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode, {
|
|
25
|
+
/**
|
|
26
|
+
* @method error - Method for creating an error node
|
|
27
|
+
* @param {Object} state - The current state of the slice
|
|
28
|
+
* @param {PayloadAction<DaVinciErrorCacheEntry<DavinciErrorResponse>>} action - The action to be dispatched
|
|
29
|
+
* @returns {ErrorNode} - The error node
|
|
30
|
+
*/
|
|
31
|
+
error(state: import('immer').WritableDraft<ContinueNode> | import('immer').WritableDraft<ErrorNode> | import('immer').WritableDraft<FailureNode> | import('immer').WritableDraft<StartNode> | import('immer').WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
32
|
+
data: DavinciErrorResponse;
|
|
33
|
+
requestId: string;
|
|
34
|
+
httpStatus: number;
|
|
35
|
+
}>): import('immer').WritableDraft<ErrorNode>;
|
|
36
|
+
/**
|
|
37
|
+
* @method failure - Method for creating an error node
|
|
38
|
+
* @param {Object} state - The current state of the slice
|
|
39
|
+
* @param {PayloadAction<DaVinciFailureResponse>} action - The action to be dispatched
|
|
40
|
+
* @returns {FailureNode} - The error node
|
|
41
|
+
*/
|
|
42
|
+
failure(state: import('immer').WritableDraft<ContinueNode> | import('immer').WritableDraft<ErrorNode> | import('immer').WritableDraft<FailureNode> | import('immer').WritableDraft<StartNode> | import('immer').WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
43
|
+
data: DaVinciFailureResponse | unknown;
|
|
44
|
+
requestId: string;
|
|
45
|
+
httpStatus: number;
|
|
46
|
+
}>): import('immer').WritableDraft<FailureNode>;
|
|
47
|
+
/**
|
|
48
|
+
* @method next - Method for creating a next node
|
|
49
|
+
* @param {Object} state - The current state of the slice
|
|
50
|
+
* @param {PayloadAction<DaVinciNextResponse>} action - The action to be dispatched
|
|
51
|
+
* @returns {ContinueNode} - The next node
|
|
52
|
+
*/
|
|
53
|
+
next(state: import('immer').WritableDraft<ContinueNode> | import('immer').WritableDraft<ErrorNode> | import('immer').WritableDraft<FailureNode> | import('immer').WritableDraft<StartNode> | import('immer').WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
54
|
+
data: DaVinciNextResponse;
|
|
55
|
+
requestId: string;
|
|
56
|
+
httpStatus: number;
|
|
57
|
+
}>): import('immer').WritableDraft<ContinueNode>;
|
|
58
|
+
/**
|
|
59
|
+
* @method start - Method for creating a start node
|
|
60
|
+
* @param {Object} state - The current state of the slice
|
|
61
|
+
* @returns {StartNode} - The start node
|
|
62
|
+
*/
|
|
63
|
+
success(state: import('immer').WritableDraft<ContinueNode> | import('immer').WritableDraft<ErrorNode> | import('immer').WritableDraft<FailureNode> | import('immer').WritableDraft<StartNode> | import('immer').WritableDraft<SuccessNode>, action: PayloadAction<{
|
|
64
|
+
data: DaVinciSuccessResponse;
|
|
65
|
+
requestId: string;
|
|
66
|
+
httpStatus: number;
|
|
67
|
+
}>): import('immer').WritableDraft<SuccessNode>;
|
|
68
|
+
/**
|
|
69
|
+
* @method update - Method for updating collector values with the node
|
|
70
|
+
* @param {Object} state - The current state of the slice
|
|
71
|
+
* @param {PayloadAction<unknown>} action - The action to be dispatched
|
|
72
|
+
* @returns {ContinueNode} - The next node
|
|
73
|
+
*/
|
|
74
|
+
update(state: import('immer').WritableDraft<ContinueNode> | import('immer').WritableDraft<ErrorNode> | import('immer').WritableDraft<FailureNode> | import('immer').WritableDraft<StartNode> | import('immer').WritableDraft<SuccessNode>, action: ReturnType<typeof updateCollectorValues>): import('immer').WritableDraft<ContinueNode>;
|
|
75
|
+
}, "node", "node", {
|
|
76
|
+
selectClient: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => {
|
|
77
|
+
action: string;
|
|
78
|
+
collectors: import('./node.types').Collectors[];
|
|
79
|
+
description?: string;
|
|
80
|
+
name?: string;
|
|
81
|
+
status: "continue";
|
|
82
|
+
} | {
|
|
83
|
+
status: "error";
|
|
84
|
+
} | {
|
|
85
|
+
status: "failure";
|
|
86
|
+
} | {
|
|
87
|
+
status: "start";
|
|
88
|
+
} | {
|
|
89
|
+
authorization?: {
|
|
90
|
+
code?: string;
|
|
91
|
+
state?: string;
|
|
92
|
+
};
|
|
93
|
+
status: "success";
|
|
94
|
+
} | null;
|
|
95
|
+
selectCollectors: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => import('./node.types').Collectors[];
|
|
96
|
+
selectCollector: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode, id: string) => import('./collector.types').ActionCollectorNoUrl<"ActionCollector"> | import('./collector.types').FlowCollector | import('./collector.types').PasswordCollector | import('./collector.types').TextCollector | import('./collector.types').SocialLoginCollector | SubmitCollector | import('./collector.types').SingleValueCollectorNoValue<"SingleValueCollector"> | undefined;
|
|
97
|
+
selectError: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => import('./node.types').DaVinciError | null;
|
|
98
|
+
selectServer: (state: ContinueNode | ErrorNode | FailureNode | StartNode | SuccessNode) => {
|
|
99
|
+
_links?: import('./davinci.types').Links;
|
|
100
|
+
id?: string;
|
|
101
|
+
interactionId?: string;
|
|
102
|
+
interactionToken?: string;
|
|
103
|
+
href?: string;
|
|
104
|
+
eventName?: string;
|
|
105
|
+
status: "continue";
|
|
106
|
+
} | {
|
|
107
|
+
_links?: import('./davinci.types').Links;
|
|
108
|
+
eventName?: string;
|
|
109
|
+
id?: string;
|
|
110
|
+
interactionId?: string;
|
|
111
|
+
interactionToken?: string;
|
|
112
|
+
status: "error";
|
|
113
|
+
} | {
|
|
114
|
+
_links?: import('./davinci.types').Links;
|
|
115
|
+
eventName?: string;
|
|
116
|
+
href?: string;
|
|
117
|
+
id?: string;
|
|
118
|
+
interactionId?: string;
|
|
119
|
+
interactionToken?: string;
|
|
120
|
+
status: "failure";
|
|
121
|
+
} | {
|
|
122
|
+
status: "start";
|
|
123
|
+
} | {
|
|
124
|
+
_links?: import('./davinci.types').Links;
|
|
125
|
+
eventName?: string;
|
|
126
|
+
id?: string;
|
|
127
|
+
interactionId?: string;
|
|
128
|
+
interactionToken?: string;
|
|
129
|
+
href?: string;
|
|
130
|
+
session?: string;
|
|
131
|
+
status: "success";
|
|
132
|
+
} | null;
|
|
133
|
+
}>;
|
|
134
|
+
//# sourceMappingURL=node.slice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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L3D,CAAC;iBACA,CAAJ;;;;;mGA0M6B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBrC,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { createSlice as i } from "@reduxjs/toolkit";
|
|
2
|
+
import { nodeCollectorReducer as c } from "./node.reducer.js";
|
|
3
|
+
const s = "continue", d = "error", o = "failure", l = "success", n = "start", y = {
|
|
4
|
+
cache: null,
|
|
5
|
+
client: {
|
|
6
|
+
status: n
|
|
7
|
+
},
|
|
8
|
+
error: null,
|
|
9
|
+
server: {
|
|
10
|
+
status: n
|
|
11
|
+
},
|
|
12
|
+
status: n
|
|
13
|
+
}, m = i({
|
|
14
|
+
name: "node",
|
|
15
|
+
initialState: y,
|
|
16
|
+
reducers: {
|
|
17
|
+
/**
|
|
18
|
+
* @method error - Method for creating an error node
|
|
19
|
+
* @param {Object} state - The current state of the slice
|
|
20
|
+
* @param {PayloadAction<DaVinciErrorCacheEntry<DavinciErrorResponse>>} action - The action to be dispatched
|
|
21
|
+
* @returns {ErrorNode} - The error node
|
|
22
|
+
*/
|
|
23
|
+
error(a, t) {
|
|
24
|
+
const e = a;
|
|
25
|
+
return e.cache = {
|
|
26
|
+
key: t.payload.requestId
|
|
27
|
+
}, e.client = {
|
|
28
|
+
status: d
|
|
29
|
+
}, e.error = {
|
|
30
|
+
code: t.payload.data.code,
|
|
31
|
+
details: t.payload.data.details,
|
|
32
|
+
message: t.payload.data.message,
|
|
33
|
+
internalHttpStatus: t.payload.data.httpResponseCode,
|
|
34
|
+
status: "error",
|
|
35
|
+
type: "davinci_error"
|
|
36
|
+
}, e.httpStatus = t.payload.httpStatus, e.server = {
|
|
37
|
+
id: t.payload.data.id,
|
|
38
|
+
interactionId: t.payload.data.interactionId,
|
|
39
|
+
interactionToken: t.payload.data.interactionToken,
|
|
40
|
+
status: d
|
|
41
|
+
}, e.status = d, e;
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* @method failure - Method for creating an error node
|
|
45
|
+
* @param {Object} state - The current state of the slice
|
|
46
|
+
* @param {PayloadAction<DaVinciFailureResponse>} action - The action to be dispatched
|
|
47
|
+
* @returns {FailureNode} - The error node
|
|
48
|
+
*/
|
|
49
|
+
failure(a, t) {
|
|
50
|
+
const e = a;
|
|
51
|
+
if (e.cache = {
|
|
52
|
+
key: t.payload.requestId
|
|
53
|
+
}, e.client = {
|
|
54
|
+
status: o
|
|
55
|
+
}, t.payload.data && typeof t.payload.data == "object") {
|
|
56
|
+
const r = t.payload.data;
|
|
57
|
+
e.error = {
|
|
58
|
+
code: r.code || "unknown",
|
|
59
|
+
message: r.message || r.errorMessage || "",
|
|
60
|
+
internalHttpStatus: typeof r.httpResponseCode == "number" ? r.httpResponseCode : 0,
|
|
61
|
+
status: o,
|
|
62
|
+
type: "davinci_error"
|
|
63
|
+
};
|
|
64
|
+
} else
|
|
65
|
+
e.error = {
|
|
66
|
+
code: "unknown",
|
|
67
|
+
message: "An unknown error occurred",
|
|
68
|
+
status: o,
|
|
69
|
+
type: "network_error"
|
|
70
|
+
};
|
|
71
|
+
return e.httpStatus = t.payload.httpStatus, e.server = {
|
|
72
|
+
status: o
|
|
73
|
+
}, e.status = o, e;
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* @method next - Method for creating a next node
|
|
77
|
+
* @param {Object} state - The current state of the slice
|
|
78
|
+
* @param {PayloadAction<DaVinciNextResponse>} action - The action to be dispatched
|
|
79
|
+
* @returns {ContinueNode} - The next node
|
|
80
|
+
*/
|
|
81
|
+
next(a, t) {
|
|
82
|
+
const e = a, r = c([], {
|
|
83
|
+
type: t.type,
|
|
84
|
+
payload: t.payload.data?.form?.components?.fields
|
|
85
|
+
}), u = r.filter(
|
|
86
|
+
(p) => p.type === "SubmitCollector"
|
|
87
|
+
)[0];
|
|
88
|
+
return e.cache = {
|
|
89
|
+
key: t.payload.requestId
|
|
90
|
+
}, e.client = {
|
|
91
|
+
action: u?.output.key,
|
|
92
|
+
description: t.payload.data?.form?.description,
|
|
93
|
+
collectors: r,
|
|
94
|
+
name: t.payload.data.form?.name,
|
|
95
|
+
status: s
|
|
96
|
+
}, e.httpStatus = t.payload.httpStatus, e.server = {
|
|
97
|
+
_links: t.payload.data._links,
|
|
98
|
+
id: t.payload.data.id,
|
|
99
|
+
interactionId: t.payload.data.interactionId,
|
|
100
|
+
interactionToken: t.payload.data.interactionToken,
|
|
101
|
+
eventName: t.payload.data.eventName,
|
|
102
|
+
status: s
|
|
103
|
+
}, e.status = s, e;
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* @method start - Method for creating a start node
|
|
107
|
+
* @param {Object} state - The current state of the slice
|
|
108
|
+
* @returns {StartNode} - The start node
|
|
109
|
+
*/
|
|
110
|
+
success(a, t) {
|
|
111
|
+
const e = a;
|
|
112
|
+
return e.cache = {
|
|
113
|
+
key: t.payload.requestId
|
|
114
|
+
}, e.client = {
|
|
115
|
+
authorization: {
|
|
116
|
+
code: t.payload.data.authorizeResponse?.code,
|
|
117
|
+
state: t.payload.data.authorizeResponse?.state
|
|
118
|
+
},
|
|
119
|
+
status: l
|
|
120
|
+
}, e.httpStatus = t.payload.httpStatus, e.server = {
|
|
121
|
+
id: t.payload.data.id,
|
|
122
|
+
interactionId: t.payload.data.interactionId,
|
|
123
|
+
interactionToken: t.payload.data.interactionToken,
|
|
124
|
+
session: t.payload.data.session?.id,
|
|
125
|
+
status: l
|
|
126
|
+
}, e.status = l, e;
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* @method update - Method for updating collector values with the node
|
|
130
|
+
* @param {Object} state - The current state of the slice
|
|
131
|
+
* @param {PayloadAction<unknown>} action - The action to be dispatched
|
|
132
|
+
* @returns {ContinueNode} - The next node
|
|
133
|
+
*/
|
|
134
|
+
update(a, t) {
|
|
135
|
+
const e = a;
|
|
136
|
+
return e.client.collectors = c(e.client.collectors, t), e;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
selectors: {
|
|
140
|
+
selectClient: (a) => a.client,
|
|
141
|
+
selectCollectors: (a) => a.status !== s ? (console.error(
|
|
142
|
+
`\`collectors are only available on nodes with \`status\` of ${s}`
|
|
143
|
+
), []) : a.client.collectors || [],
|
|
144
|
+
selectCollector: (a, t) => {
|
|
145
|
+
if (a.status !== s) {
|
|
146
|
+
console.error(
|
|
147
|
+
`\`collectors are only available on nodes with \`status\` of ${s}`
|
|
148
|
+
);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
return a.client.collectors?.find((e) => e.id === t);
|
|
152
|
+
},
|
|
153
|
+
selectError: (a) => a.error,
|
|
154
|
+
selectServer: (a) => a.server
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
export {
|
|
158
|
+
y as initialNodeState,
|
|
159
|
+
m as nodeSlice
|
|
160
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { FlowCollector, PasswordCollector, TextCollector, SocialLoginCollector, SubmitCollector, ActionCollector, SingleValueCollector } from './collector.types.js';
|
|
2
|
+
import { ErrorDetail, Links } from './davinci.types.js';
|
|
3
|
+
import { GenericError } from './error.types.js';
|
|
4
|
+
export interface DaVinciError extends GenericError {
|
|
5
|
+
details?: ErrorDetail[];
|
|
6
|
+
internalHttpStatus?: number;
|
|
7
|
+
status: 'error' | 'failure' | 'unknown';
|
|
8
|
+
}
|
|
9
|
+
export type Collectors = FlowCollector | PasswordCollector | TextCollector | SocialLoginCollector | SubmitCollector | ActionCollector<'ActionCollector'> | SingleValueCollector<'SingleValueCollector'>;
|
|
10
|
+
export interface ContinueNode {
|
|
11
|
+
cache: {
|
|
12
|
+
key: string;
|
|
13
|
+
};
|
|
14
|
+
client: {
|
|
15
|
+
action: string;
|
|
16
|
+
collectors: Collectors[];
|
|
17
|
+
description?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
status: 'continue';
|
|
20
|
+
};
|
|
21
|
+
error: null;
|
|
22
|
+
httpStatus: number;
|
|
23
|
+
server: {
|
|
24
|
+
_links?: Links;
|
|
25
|
+
id?: string;
|
|
26
|
+
interactionId?: string;
|
|
27
|
+
interactionToken?: string;
|
|
28
|
+
href?: string;
|
|
29
|
+
eventName?: string;
|
|
30
|
+
status: 'continue';
|
|
31
|
+
};
|
|
32
|
+
status: 'continue';
|
|
33
|
+
}
|
|
34
|
+
export interface ErrorNode {
|
|
35
|
+
cache: {
|
|
36
|
+
key: string;
|
|
37
|
+
};
|
|
38
|
+
client: {
|
|
39
|
+
status: 'error';
|
|
40
|
+
};
|
|
41
|
+
error: DaVinciError;
|
|
42
|
+
httpStatus: number;
|
|
43
|
+
server: {
|
|
44
|
+
_links?: Links;
|
|
45
|
+
eventName?: string;
|
|
46
|
+
id?: string;
|
|
47
|
+
interactionId?: string;
|
|
48
|
+
interactionToken?: string;
|
|
49
|
+
status: 'error';
|
|
50
|
+
} | null;
|
|
51
|
+
status: 'error';
|
|
52
|
+
}
|
|
53
|
+
export interface FailureNode {
|
|
54
|
+
cache: {
|
|
55
|
+
key: string;
|
|
56
|
+
};
|
|
57
|
+
client: {
|
|
58
|
+
status: 'failure';
|
|
59
|
+
};
|
|
60
|
+
error: DaVinciError;
|
|
61
|
+
httpStatus: number;
|
|
62
|
+
server: {
|
|
63
|
+
_links?: Links;
|
|
64
|
+
eventName?: string;
|
|
65
|
+
href?: string;
|
|
66
|
+
id?: string;
|
|
67
|
+
interactionId?: string;
|
|
68
|
+
interactionToken?: string;
|
|
69
|
+
status: 'failure';
|
|
70
|
+
} | null;
|
|
71
|
+
status: 'failure';
|
|
72
|
+
}
|
|
73
|
+
export interface StartNode {
|
|
74
|
+
cache: null;
|
|
75
|
+
client: {
|
|
76
|
+
status: 'start';
|
|
77
|
+
};
|
|
78
|
+
error: null;
|
|
79
|
+
server: {
|
|
80
|
+
status: 'start';
|
|
81
|
+
};
|
|
82
|
+
status: 'start';
|
|
83
|
+
}
|
|
84
|
+
export interface SuccessNode {
|
|
85
|
+
cache: {
|
|
86
|
+
key: string;
|
|
87
|
+
};
|
|
88
|
+
client: {
|
|
89
|
+
authorization?: {
|
|
90
|
+
code?: string;
|
|
91
|
+
state?: string;
|
|
92
|
+
};
|
|
93
|
+
status: 'success';
|
|
94
|
+
} | null;
|
|
95
|
+
error: null;
|
|
96
|
+
httpStatus: number;
|
|
97
|
+
server: {
|
|
98
|
+
_links?: Links;
|
|
99
|
+
eventName?: string;
|
|
100
|
+
id?: string;
|
|
101
|
+
interactionId?: string;
|
|
102
|
+
interactionToken?: string;
|
|
103
|
+
href?: string;
|
|
104
|
+
session?: string;
|
|
105
|
+
status: 'success';
|
|
106
|
+
};
|
|
107
|
+
status: 'success';
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=node.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.types.d.ts","sourceRoot":"","sources":["../../src/lib/node.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,MAAM,UAAU,GAClB,aAAa,GACb,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,eAAe,GACf,eAAe,CAAC,iBAAiB,CAAC,GAClC,oBAAoB,CAAC,sBAAsB,CAAC,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAC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SAAS,CAAC;CACnB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { WellknownResponse } from './wellknown.types';
|
|
2
|
+
export declare const wellknownApi: import('@reduxjs/toolkit/query').Api<import('@reduxjs/toolkit/query').BaseQueryFn<string | import('@reduxjs/toolkit/query').FetchArgs, unknown, import('@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('@reduxjs/toolkit/query').FetchBaseQueryMeta>, {
|
|
3
|
+
wellknown: import('@reduxjs/toolkit/query').QueryDefinition<string, import('@reduxjs/toolkit/query').BaseQueryFn<string | import('@reduxjs/toolkit/query').FetchArgs, unknown, import('@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, WellknownResponse, "wellknown">;
|
|
4
|
+
}, "wellknown", never, typeof import('@reduxjs/toolkit/query').coreModuleName>;
|
|
5
|
+
//# sourceMappingURL=wellknown.api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wellknown.api.d.ts","sourceRoot":"","sources":["../../src/lib/wellknown.api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,eAAO,MAAM,YAAY;;8EAavB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createApi as n, fetchBaseQuery as t } from "@reduxjs/toolkit/query";
|
|
2
|
+
const p = n({
|
|
3
|
+
reducerPath: "wellknown",
|
|
4
|
+
baseQuery: t({
|
|
5
|
+
prepareHeaders: (e) => (e.set("Accept", "application/json"), e)
|
|
6
|
+
}),
|
|
7
|
+
endpoints: (e) => ({
|
|
8
|
+
wellknown: e.query({
|
|
9
|
+
query: (r) => ({ url: r })
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
p as wellknownApi
|
|
15
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface WellknownResponse {
|
|
2
|
+
issuer: string;
|
|
3
|
+
authorization_endpoint: string;
|
|
4
|
+
pushed_authorization_request_endpoint: string;
|
|
5
|
+
token_endpoint: string;
|
|
6
|
+
userinfo_endpoint: string;
|
|
7
|
+
jwks_uri: string;
|
|
8
|
+
end_session_endpoint: string;
|
|
9
|
+
check_session_iframe: string;
|
|
10
|
+
introspection_endpoint: string;
|
|
11
|
+
revocation_endpoint: string;
|
|
12
|
+
device_authorization_endpoint: string;
|
|
13
|
+
claims_parameter_supported: string;
|
|
14
|
+
request_parameter_supported: string;
|
|
15
|
+
request_uri_parameter_supported: string;
|
|
16
|
+
require_pushed_authorization_requests: string;
|
|
17
|
+
scopes_supported: string[];
|
|
18
|
+
response_types_supported: string[];
|
|
19
|
+
response_modes_supported: string[];
|
|
20
|
+
grant_types_supported: string[];
|
|
21
|
+
subject_types_supported: string[];
|
|
22
|
+
id_token_signing_alg_values_supported: string[];
|
|
23
|
+
userinfo_signing_alg_values_supported: string[];
|
|
24
|
+
request_object_signing_alg_values_supported: string[];
|
|
25
|
+
token_endpoint_auth_methods_supported: string[];
|
|
26
|
+
token_endpoint_auth_signing_alg_values_supported: string[];
|
|
27
|
+
claim_types_supported: string[];
|
|
28
|
+
claims_supported: string[];
|
|
29
|
+
code_challenge_methods_supported: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface Endpoints {
|
|
32
|
+
authorize: string;
|
|
33
|
+
issuer: string;
|
|
34
|
+
introspection: string;
|
|
35
|
+
tokens: string;
|
|
36
|
+
userinfo: string;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=wellknown.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wellknown.types.d.ts","sourceRoot":"","sources":["../../src/lib/wellknown.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qCAAqC,EAAE,MAAM,CAAC;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,6BAA6B,EAAE,MAAM,CAAC;IACtC,0BAA0B,EAAE,MAAM,CAAC;IACnC,2BAA2B,EAAE,MAAM,CAAC;IACpC,+BAA+B,EAAE,MAAM,CAAC;IACxC,qCAAqC,EAAE,MAAM,CAAC;IAC9C,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC,qCAAqC,EAAE,MAAM,EAAE,CAAC;IAChD,qCAAqC,EAAE,MAAM,EAAE,CAAC;IAChD,2CAA2C,EAAE,MAAM,EAAE,CAAC;IACtD,qCAAqC,EAAE,MAAM,EAAE,CAAC;IAChD,gDAAgD,EAAE,MAAM,EAAE,CAAC;IAC3D,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gCAAgC,EAAE,MAAM,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as collectors from './lib/collector.types.js';
|
|
2
|
+
import type * as config from './lib/config.types.js';
|
|
3
|
+
import type * as nodes from './lib/node.types.js';
|
|
4
|
+
import type * as client from './lib/client.types.js';
|
|
5
|
+
export type DaVinciConfig = config.DaVinciConfig;
|
|
6
|
+
export type Updater = client.Updater;
|
|
7
|
+
export type InitFlow = client.InitFlow;
|
|
8
|
+
export type StartNode = nodes.StartNode;
|
|
9
|
+
export type ContinueNode = nodes.ContinueNode;
|
|
10
|
+
export type ErrorNode = nodes.ErrorNode;
|
|
11
|
+
export type SuccessNode = nodes.SuccessNode;
|
|
12
|
+
export type FailureNode = nodes.FailureNode;
|
|
13
|
+
export type NodeStates = StartNode | ContinueNode | ErrorNode | SuccessNode | FailureNode;
|
|
14
|
+
export type Collectors = nodes.Collectors;
|
|
15
|
+
export type DaVinciValidationError = nodes.DaVinciError;
|
|
16
|
+
export type ActionCollector<T extends collectors.ActionCollectorTypes> = collectors.ActionCollector<T>;
|
|
17
|
+
export type SingleValueCollector<T extends collectors.SingleValueCollectorTypes> = collectors.SingleValueCollector<T>;
|
|
18
|
+
export type FlowCollector = collectors.FlowCollector;
|
|
19
|
+
export type PasswordCollector = collectors.PasswordCollector;
|
|
20
|
+
export type TextCollector = collectors.TextCollector;
|
|
21
|
+
export type SocialLoginCollector = collectors.SocialLoginCollector;
|
|
22
|
+
export type SubmitCollector = collectors.SubmitCollector;
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;AAEf,OAAO,KAAK,KAAK,UAAU,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;AAEjD,MAAM,MAAM,OAAO,GAAG,MAA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",
|
|
6
|
+
"typings": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com:ForgeRock/forgerock-javascript-sdk.git",
|
|
14
|
+
"directory": "packages/davinci-client"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@reduxjs/toolkit": "2.3.0",
|
|
21
|
+
"vitest": "^1.4.0",
|
|
22
|
+
"immer": "10.1.1",
|
|
23
|
+
"@forgerock/javascript-sdk": "4.6.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"vitest": "^1.4.0",
|
|
27
|
+
"immer": "10.1.1"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./types": "./dist/types.d.ts"
|
|
35
|
+
}
|
|
36
|
+
}
|