@forgerock/device-client 0.0.0-beta-20260319165545 → 2.0.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.
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/device.store.d.ts +186 -0
- package/dist/src/lib/device.store.d.ts.map +1 -0
- package/dist/src/lib/device.store.js +306 -0
- package/dist/src/lib/device.store.js.map +1 -0
- package/dist/src/lib/device.store.utils.d.ts +4 -0
- package/dist/src/lib/device.store.utils.d.ts.map +1 -0
- package/dist/src/lib/device.store.utils.js +12 -0
- package/dist/src/lib/device.store.utils.js.map +1 -0
- package/dist/src/lib/services/index.d.ts +38 -0
- package/dist/src/lib/services/index.d.ts.map +1 -0
- package/dist/src/lib/services/index.js +98 -0
- package/dist/src/lib/services/index.js.map +1 -0
- package/dist/src/lib/types/bound-device.types.d.ts +35 -0
- package/dist/src/lib/types/bound-device.types.d.ts.map +1 -0
- package/dist/src/lib/types/bound-device.types.js +2 -0
- package/dist/src/lib/types/bound-device.types.js.map +1 -0
- package/dist/src/lib/types/index.d.ts +10 -0
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/src/lib/types/index.js +8 -0
- package/dist/src/lib/types/index.js.map +1 -0
- package/dist/src/lib/types/oath.types.d.ts +42 -0
- package/dist/src/lib/types/oath.types.d.ts.map +1 -0
- package/dist/src/lib/types/oath.types.js +2 -0
- package/dist/src/lib/types/oath.types.js.map +1 -0
- package/dist/src/lib/types/profile-device.types.d.ts +57 -0
- package/dist/src/lib/types/profile-device.types.d.ts.map +1 -0
- package/dist/src/lib/types/profile-device.types.js +2 -0
- package/dist/src/lib/types/profile-device.types.js.map +1 -0
- package/dist/src/lib/types/push-device.types.d.ts +99 -0
- package/dist/src/lib/types/push-device.types.d.ts.map +1 -0
- package/dist/src/lib/types/push-device.types.js +2 -0
- package/dist/src/lib/types/push-device.types.js.map +1 -0
- package/dist/src/lib/types/updateDeviceProfile.types.d.ts +58 -0
- package/dist/src/lib/types/updateDeviceProfile.types.d.ts.map +1 -0
- package/dist/src/lib/types/updateDeviceProfile.types.js +2 -0
- package/dist/src/lib/types/updateDeviceProfile.types.js.map +1 -0
- package/dist/src/lib/types/webauthn.types.d.ts +58 -0
- package/dist/src/lib/types/webauthn.types.d.ts.map +1 -0
- package/dist/src/lib/types/webauthn.types.js +2 -0
- package/dist/src/lib/types/webauthn.types.js.map +1 -0
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +8 -0
- package/dist/src/types.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
export * from './lib/device.store.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { type ConfigOptions } from '@forgerock/javascript-sdk';
|
|
2
|
+
import type { OathDevice, RetrieveOathQuery } from './types/oath.types.js';
|
|
3
|
+
import type { DeleteDeviceQuery, PushDevice, PushDeviceQuery } from './types/push-device.types.js';
|
|
4
|
+
import type { UpdatedWebAuthnDevice, WebAuthnDevice, WebAuthnQuery } from './types/webauthn.types.js';
|
|
5
|
+
import type { BoundDeviceQuery, Device, GetBoundDevicesQuery } from './types/bound-device.types.js';
|
|
6
|
+
import type { GetProfileDevices, ProfileDevice, ProfileDevicesQuery } from './types/profile-device.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* @function deviceClient
|
|
9
|
+
* @description Returns a device management object containing methods for handling various device types
|
|
10
|
+
* @param {ConfigOptions} config The configuration options for the device client
|
|
11
|
+
* @returns Methods for handling various device types
|
|
12
|
+
*/
|
|
13
|
+
export declare const deviceClient: (config: ConfigOptions) => {
|
|
14
|
+
/**
|
|
15
|
+
* Oath device management methods.
|
|
16
|
+
*/
|
|
17
|
+
oath: {
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves Oath devices based on the specified query.
|
|
20
|
+
*
|
|
21
|
+
* @async
|
|
22
|
+
* @function get
|
|
23
|
+
* @param {RetrieveOathQuery} query - The query used to retrieve Oath devices.
|
|
24
|
+
* @returns {Promise<OathDevice[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
25
|
+
*/
|
|
26
|
+
get: (query: RetrieveOathQuery) => Promise<OathDevice[] | {
|
|
27
|
+
error: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Deletes an Oath device based on the provided query and device information.
|
|
31
|
+
*
|
|
32
|
+
* @async
|
|
33
|
+
* @function delete
|
|
34
|
+
* @param {RetrieveOathQuery & { device: OathDevice }} query - The query and device information used to delete the Oath device.
|
|
35
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
36
|
+
*/
|
|
37
|
+
delete: (query: RetrieveOathQuery & {
|
|
38
|
+
device: OathDevice;
|
|
39
|
+
}) => Promise<null | {
|
|
40
|
+
error: unknown;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Push device management methods.
|
|
45
|
+
*/
|
|
46
|
+
push: {
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves Push devices based on the specified query.
|
|
49
|
+
*
|
|
50
|
+
* @async
|
|
51
|
+
* @function get
|
|
52
|
+
* @param {PushDeviceQuery} query - The query used to retrieve Push devices.
|
|
53
|
+
* @returns {Promise<PushDevice[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
54
|
+
*/
|
|
55
|
+
get: (query: PushDeviceQuery) => Promise<PushDevice[] | {
|
|
56
|
+
error: unknown;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Deletes a Push device based on the provided query.
|
|
60
|
+
*
|
|
61
|
+
* @async
|
|
62
|
+
* @function delete
|
|
63
|
+
* @param {DeleteDeviceQuery} query - The query used to delete the Push device.
|
|
64
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
65
|
+
*/
|
|
66
|
+
delete: (query: DeleteDeviceQuery) => Promise<null | {
|
|
67
|
+
error: unknown;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* WebAuthn device management methods.
|
|
72
|
+
*/
|
|
73
|
+
webAuthn: {
|
|
74
|
+
/**
|
|
75
|
+
* Retrieves WebAuthn devices based on the specified query.
|
|
76
|
+
*
|
|
77
|
+
* @async
|
|
78
|
+
* @function get
|
|
79
|
+
* @param {WebAuthnQuery} query - The query used to retrieve WebAuthn devices.
|
|
80
|
+
* @returns {Promise<WebAuthnDevice[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
81
|
+
*/
|
|
82
|
+
get: (query: WebAuthnQuery) => Promise<WebAuthnDevice[] | {
|
|
83
|
+
error: unknown;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Updates the name of a WebAuthn device based on the provided query and body.
|
|
87
|
+
*
|
|
88
|
+
* @async
|
|
89
|
+
* @function update
|
|
90
|
+
* @param {WebAuthnQuery & { device: WebAuthnDevice }} query - The query and body used to update the WebAuthn device name.
|
|
91
|
+
* @returns {Promise<UpdatedWebAuthnDevice | { error: unknown }>} - A promise that resolves to the response data or an error object if the response is not valid.
|
|
92
|
+
*/
|
|
93
|
+
update: (query: WebAuthnQuery & {
|
|
94
|
+
device: WebAuthnDevice;
|
|
95
|
+
}) => Promise<UpdatedWebAuthnDevice | {
|
|
96
|
+
error: unknown;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Deletes a WebAuthn device based on the provided query and body.
|
|
100
|
+
*
|
|
101
|
+
* @async
|
|
102
|
+
* @function delete
|
|
103
|
+
* @param {WebAuthnQuery & { device: WebAuthnDevice | UpdatedWebAuthnDevice }} query - The query and body used to delete the WebAuthn device.
|
|
104
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
105
|
+
*/
|
|
106
|
+
delete: (query: WebAuthnQuery & {
|
|
107
|
+
device: WebAuthnDevice | UpdatedWebAuthnDevice;
|
|
108
|
+
}) => Promise<null | {
|
|
109
|
+
error: unknown;
|
|
110
|
+
}>;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Bound devices management methods.
|
|
114
|
+
*/
|
|
115
|
+
bound: {
|
|
116
|
+
/**
|
|
117
|
+
* Retrieves bound devices based on the specified query.
|
|
118
|
+
*
|
|
119
|
+
* @async
|
|
120
|
+
* @function get
|
|
121
|
+
* @param {GetBoundDevicesQuery} query - The query used to retrieve bound devices.
|
|
122
|
+
* @returns {Promise<Device[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
123
|
+
*/
|
|
124
|
+
get: (query: GetBoundDevicesQuery) => Promise<Device[] | {
|
|
125
|
+
error: unknown;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Deletes a bound device based on the provided query.
|
|
129
|
+
*
|
|
130
|
+
* @async
|
|
131
|
+
* @function delete
|
|
132
|
+
* @param {BoundDeviceQuery} query - The query used to delete the bound device.
|
|
133
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
134
|
+
*/
|
|
135
|
+
delete: (query: BoundDeviceQuery) => Promise<null | {
|
|
136
|
+
error: unknown;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Updates the name of a bound device based on the provided query.
|
|
140
|
+
*
|
|
141
|
+
* @async
|
|
142
|
+
* @function update
|
|
143
|
+
* @param {BoundDeviceQuery} query - The query used to update the bound device name.
|
|
144
|
+
* @returns {Promise<Device | { error: unknown }>} - A promise that resolves to the response data or an error object if the response is not valid.
|
|
145
|
+
*/
|
|
146
|
+
update: (query: BoundDeviceQuery) => Promise<Device | {
|
|
147
|
+
error: unknown;
|
|
148
|
+
}>;
|
|
149
|
+
};
|
|
150
|
+
profile: {
|
|
151
|
+
/**
|
|
152
|
+
* Get profile devices
|
|
153
|
+
*
|
|
154
|
+
* @async
|
|
155
|
+
* @function get
|
|
156
|
+
* @param {GetProfileDevices} query - The query used to get profile devices
|
|
157
|
+
* @returns {Promise<ProfileDevice[] | { error: unknown }>} - A promise that resolves to the response data or an error object if the response is not valid.
|
|
158
|
+
*/
|
|
159
|
+
get: (query: GetProfileDevices) => Promise<ProfileDevice[] | {
|
|
160
|
+
error: unknown;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Update profile devices
|
|
164
|
+
*
|
|
165
|
+
* @async
|
|
166
|
+
* @function update
|
|
167
|
+
* @param {ProfileDevicesQuery} query - The query used to update a profile device
|
|
168
|
+
* @returns {Promise<ProfileDevice | { error: unknown }>} - A promise that resolves to the response data or or an error object if the response is not valid.
|
|
169
|
+
*/
|
|
170
|
+
update: (query: ProfileDevicesQuery) => Promise<ProfileDevice | {
|
|
171
|
+
error: unknown;
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* Delete profile devices
|
|
175
|
+
*
|
|
176
|
+
* @async
|
|
177
|
+
* @function delete
|
|
178
|
+
* @param {ProfileDevicesQuery} query - The query used to delete a profile device
|
|
179
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
180
|
+
*/
|
|
181
|
+
delete: (query: ProfileDevicesQuery) => Promise<null | {
|
|
182
|
+
error: unknown;
|
|
183
|
+
}>;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=device.store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.store.d.ts","sourceRoot":"","sources":["../../../src/lib/device.store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACd,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACpG,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAGzC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,aAAa;IAc9C;;OAEG;;QAED;;;;;;;WAOG;qBACyB,iBAAiB,KAAG,OAAO,CAAC,UAAU,EAAE,GAAG;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QAc1F;;;;;;;WAOG;wBAEM,iBAAiB,GAAG;YAAE,MAAM,EAAE,UAAU,CAAA;SAAE,KAChD,OAAO,CAAC,IAAI,GAAG;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;;IAevC;;OAEG;;QAED;;;;;;;WAOG;qBACyB,eAAe,KAAG,OAAO,CAAC,UAAU,EAAE,GAAG;YAAE,KAAK,EAAE,OA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A;SAAE,CAAC;;CAe5F,CAAC"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
+
import { deviceService } from './services/index.js';
|
|
3
|
+
import { handleError } from './device.store.utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* @function deviceClient
|
|
6
|
+
* @description Returns a device management object containing methods for handling various device types
|
|
7
|
+
* @param {ConfigOptions} config The configuration options for the device client
|
|
8
|
+
* @returns Methods for handling various device types
|
|
9
|
+
*/
|
|
10
|
+
export const deviceClient = (config) => {
|
|
11
|
+
const { middleware, reducerPath, reducer, endpoints } = deviceService({
|
|
12
|
+
baseUrl: config.serverConfig?.baseUrl ?? '',
|
|
13
|
+
realmPath: config?.realmPath ?? '',
|
|
14
|
+
});
|
|
15
|
+
const store = configureStore({
|
|
16
|
+
reducer: {
|
|
17
|
+
[reducerPath]: reducer,
|
|
18
|
+
},
|
|
19
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(middleware),
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
/**
|
|
23
|
+
* Oath device management methods.
|
|
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<OathDevice[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
33
|
+
*/
|
|
34
|
+
get: async function (query) {
|
|
35
|
+
try {
|
|
36
|
+
const response = await store.dispatch(endpoints.getOathDevices.initiate(query));
|
|
37
|
+
if (!response || !response.data || !response.data.result) {
|
|
38
|
+
throw new Error('response did not contain data');
|
|
39
|
+
}
|
|
40
|
+
return response.data.result;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return { error };
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Deletes an Oath device based on the provided query and device information.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function delete
|
|
51
|
+
* @param {RetrieveOathQuery & { device: OathDevice }} query - The query and device information used to delete the Oath device.
|
|
52
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
53
|
+
*/
|
|
54
|
+
delete: async function (query) {
|
|
55
|
+
try {
|
|
56
|
+
const { error } = await store.dispatch(endpoints.deleteOathDevice.initiate(query));
|
|
57
|
+
if (error) {
|
|
58
|
+
handleError(error, 'Failed to delete device: ');
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
return { error };
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* Push device management methods.
|
|
69
|
+
*/
|
|
70
|
+
push: {
|
|
71
|
+
/**
|
|
72
|
+
* Retrieves Push devices based on the specified query.
|
|
73
|
+
*
|
|
74
|
+
* @async
|
|
75
|
+
* @function get
|
|
76
|
+
* @param {PushDeviceQuery} query - The query used to retrieve Push devices.
|
|
77
|
+
* @returns {Promise<PushDevice[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
78
|
+
*/
|
|
79
|
+
get: async function (query) {
|
|
80
|
+
try {
|
|
81
|
+
const response = await store.dispatch(endpoints.getPushDevices.initiate(query));
|
|
82
|
+
if (!response || !response.data || !response.data.result) {
|
|
83
|
+
throw new Error('response did not contain data');
|
|
84
|
+
}
|
|
85
|
+
return response.data.result;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return { error };
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Deletes a Push device based on the provided query.
|
|
93
|
+
*
|
|
94
|
+
* @async
|
|
95
|
+
* @function delete
|
|
96
|
+
* @param {DeleteDeviceQuery} query - The query used to delete the Push device.
|
|
97
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
98
|
+
*/
|
|
99
|
+
delete: async function (query) {
|
|
100
|
+
try {
|
|
101
|
+
const { error } = await store.dispatch(endpoints.deletePushDevice.initiate(query));
|
|
102
|
+
if (error) {
|
|
103
|
+
handleError(error, 'Failed to delete device: ');
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return { error };
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* WebAuthn device management methods.
|
|
114
|
+
*/
|
|
115
|
+
webAuthn: {
|
|
116
|
+
/**
|
|
117
|
+
* Retrieves WebAuthn devices based on the specified query.
|
|
118
|
+
*
|
|
119
|
+
* @async
|
|
120
|
+
* @function get
|
|
121
|
+
* @param {WebAuthnQuery} query - The query used to retrieve WebAuthn devices.
|
|
122
|
+
* @returns {Promise<WebAuthnDevice[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
123
|
+
*/
|
|
124
|
+
get: async function (query) {
|
|
125
|
+
try {
|
|
126
|
+
const response = await store.dispatch(endpoints.getWebAuthnDevices.initiate(query));
|
|
127
|
+
if (!response || !response.data || !response.data.result) {
|
|
128
|
+
throw new Error('response did not contain data');
|
|
129
|
+
}
|
|
130
|
+
return response.data.result;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
return { error };
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* Updates the name of a WebAuthn device based on the provided query and body.
|
|
138
|
+
*
|
|
139
|
+
* @async
|
|
140
|
+
* @function update
|
|
141
|
+
* @param {WebAuthnQuery & { device: WebAuthnDevice }} query - The query and body used to update the WebAuthn device name.
|
|
142
|
+
* @returns {Promise<UpdatedWebAuthnDevice | { error: unknown }>} - A promise that resolves to the response data or an error object if the response is not valid.
|
|
143
|
+
*/
|
|
144
|
+
update: async function (query) {
|
|
145
|
+
try {
|
|
146
|
+
const response = await store.dispatch(endpoints.updateWebAuthnDeviceName.initiate(query));
|
|
147
|
+
if (!response || !response.data) {
|
|
148
|
+
throw new Error('response did not contain data');
|
|
149
|
+
}
|
|
150
|
+
return response.data;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
return { error };
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* Deletes a WebAuthn device based on the provided query and body.
|
|
158
|
+
*
|
|
159
|
+
* @async
|
|
160
|
+
* @function delete
|
|
161
|
+
* @param {WebAuthnQuery & { device: WebAuthnDevice | UpdatedWebAuthnDevice }} query - The query and body used to delete the WebAuthn device.
|
|
162
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
163
|
+
*/
|
|
164
|
+
delete: async function (query) {
|
|
165
|
+
try {
|
|
166
|
+
const { error } = await store.dispatch(endpoints.deleteWebAuthnDeviceName.initiate(query));
|
|
167
|
+
if (error) {
|
|
168
|
+
handleError(error, 'Failed to delete device: ');
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
return { error };
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Bound devices management methods.
|
|
179
|
+
*/
|
|
180
|
+
bound: {
|
|
181
|
+
/**
|
|
182
|
+
* Retrieves bound devices based on the specified query.
|
|
183
|
+
*
|
|
184
|
+
* @async
|
|
185
|
+
* @function get
|
|
186
|
+
* @param {GetBoundDevicesQuery} query - The query used to retrieve bound devices.
|
|
187
|
+
* @returns {Promise<Device[] | { error: unknown }>} - A promise that resolves to the retrieved data or an error object if the response is not valid.
|
|
188
|
+
*/
|
|
189
|
+
get: async function (query) {
|
|
190
|
+
try {
|
|
191
|
+
const response = await store.dispatch(endpoints.getBoundDevices.initiate(query));
|
|
192
|
+
if (!response || !response.data || !response.data.result) {
|
|
193
|
+
throw new Error('response did not contain data');
|
|
194
|
+
}
|
|
195
|
+
return response.data.result;
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
return { error };
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
202
|
+
* Deletes a bound device based on the provided query.
|
|
203
|
+
*
|
|
204
|
+
* @async
|
|
205
|
+
* @function delete
|
|
206
|
+
* @param {BoundDeviceQuery} query - The query used to delete the bound device.
|
|
207
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
208
|
+
*/
|
|
209
|
+
delete: async function (query) {
|
|
210
|
+
try {
|
|
211
|
+
const { error } = await store.dispatch(endpoints.deleteBoundDevice.initiate(query));
|
|
212
|
+
if (error) {
|
|
213
|
+
handleError(error, 'Failed to delete device: ');
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
return { error };
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
/**
|
|
222
|
+
* Updates the name of a bound device based on the provided query.
|
|
223
|
+
*
|
|
224
|
+
* @async
|
|
225
|
+
* @function update
|
|
226
|
+
* @param {BoundDeviceQuery} query - The query used to update the bound device name.
|
|
227
|
+
* @returns {Promise<Device | { error: unknown }>} - A promise that resolves to the response data or an error object if the response is not valid.
|
|
228
|
+
*/
|
|
229
|
+
update: async function (query) {
|
|
230
|
+
try {
|
|
231
|
+
const response = await store.dispatch(endpoints.updateBoundDevice.initiate(query));
|
|
232
|
+
if (!response || !response.data) {
|
|
233
|
+
throw new Error('response did not contain data');
|
|
234
|
+
}
|
|
235
|
+
return response.data;
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
return { error };
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
profile: {
|
|
243
|
+
/**
|
|
244
|
+
* Get profile devices
|
|
245
|
+
*
|
|
246
|
+
* @async
|
|
247
|
+
* @function get
|
|
248
|
+
* @param {GetProfileDevices} query - The query used to get profile devices
|
|
249
|
+
* @returns {Promise<ProfileDevice[] | { error: unknown }>} - A promise that resolves to the response data or an error object if the response is not valid.
|
|
250
|
+
*/
|
|
251
|
+
get: async function (query) {
|
|
252
|
+
try {
|
|
253
|
+
const response = await store.dispatch(endpoints.getDeviceProfiles.initiate(query));
|
|
254
|
+
if (!response || !response.data || !response.data.result) {
|
|
255
|
+
throw new Error('response did not contain data');
|
|
256
|
+
}
|
|
257
|
+
return response.data.result;
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
return { error };
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
/**
|
|
264
|
+
* Update profile devices
|
|
265
|
+
*
|
|
266
|
+
* @async
|
|
267
|
+
* @function update
|
|
268
|
+
* @param {ProfileDevicesQuery} query - The query used to update a profile device
|
|
269
|
+
* @returns {Promise<ProfileDevice | { error: unknown }>} - A promise that resolves to the response data or or an error object if the response is not valid.
|
|
270
|
+
*/
|
|
271
|
+
update: async function (query) {
|
|
272
|
+
try {
|
|
273
|
+
const response = await store.dispatch(endpoints.updateDeviceProfile.initiate(query));
|
|
274
|
+
if (!response || !response.data) {
|
|
275
|
+
throw new Error('response did not contain data');
|
|
276
|
+
}
|
|
277
|
+
return response.data;
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
return { error };
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
/**
|
|
284
|
+
* Delete profile devices
|
|
285
|
+
*
|
|
286
|
+
* @async
|
|
287
|
+
* @function delete
|
|
288
|
+
* @param {ProfileDevicesQuery} query - The query used to delete a profile device
|
|
289
|
+
* @returns {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid.
|
|
290
|
+
*/
|
|
291
|
+
delete: async function (query) {
|
|
292
|
+
try {
|
|
293
|
+
const { error } = await store.dispatch(endpoints.deleteDeviceProfile.initiate(query));
|
|
294
|
+
if (error) {
|
|
295
|
+
handleError(error, 'Failed to delete device profile: ');
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
return { error };
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
//# sourceMappingURL=device.store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.store.js","sourceRoot":"","sources":["../../../src/lib/device.store.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAcpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;;;;GAKG;AACH,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,CAAC,UAAU,CAAC;KAChF,CAAC,CAAC;IAEH,OAAO;QACL;;WAEG;QACH,IAAI,EAAE;YACJ;;;;;;;eAOG;YACH,GAAG,EAAE,KAAK,WAAW,KAAwB;gBAC3C,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,QAA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SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SerializedError } from '@reduxjs/toolkit';
|
|
2
|
+
import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
|
|
3
|
+
export declare function handleError(error: FetchBaseQueryError | SerializedError, message?: string): void;
|
|
4
|
+
//# sourceMappingURL=device.store.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.store.utils.d.ts","sourceRoot":"","sources":["../../../src/lib/device.store.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,wBAAgB,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,QAWzF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function handleError(error, message) {
|
|
2
|
+
/**
|
|
3
|
+
* Handle an RTK Query error after narrowing to either FetchBaseQueryError or SerializedError
|
|
4
|
+
* https://redux-toolkit.js.org/rtk-query/usage-with-typescript#type-safe-error-handling
|
|
5
|
+
*/
|
|
6
|
+
if ('status' in error) {
|
|
7
|
+
const errMsg = 'error' in error ? error.error : JSON.stringify(error.data);
|
|
8
|
+
throw new Error(`${message ?? ''}${errMsg}`);
|
|
9
|
+
}
|
|
10
|
+
throw new Error(`${message ?? ''}${error.message}`);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=device.store.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.store.utils.js","sourceRoot":"","sources":["../../../src/lib/device.store.utils.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,WAAW,CAAC,KAA4C,EAAE,OAAgB;IACxF;;;OAGG;IACH,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DeletedOathDevice, OathDevice, OathResponse, RetrieveOathQuery } from '../types/oath.types.js';
|
|
2
|
+
import { DeleteDeviceQuery, DeletedPushDevice, PushDevice, PushDeviceQuery } from '../types/push-device.types.js';
|
|
3
|
+
import { BoundDeviceQuery, Device, GetBoundDevicesQuery } from '../types/bound-device.types.js';
|
|
4
|
+
import { UpdatedWebAuthnDevice, WebAuthnDevice, WebAuthnQuery } from '../types/webauthn.types.js';
|
|
5
|
+
import { ProfileDevice, GetProfileDevices, ProfileDevicesQuery } from '../types/profile-device.types.js';
|
|
6
|
+
export interface GeneralResponse<T> {
|
|
7
|
+
pagedResultsCookie: string | null;
|
|
8
|
+
remainingPagedResults: number;
|
|
9
|
+
resultCount: number;
|
|
10
|
+
totalPagedResults: number;
|
|
11
|
+
totalPagedResultsPolicy: string;
|
|
12
|
+
result: T;
|
|
13
|
+
}
|
|
14
|
+
export declare const deviceService: ({ baseUrl, realmPath }: {
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
realmPath: string;
|
|
17
|
+
}) => 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>, {
|
|
18
|
+
getOathDevices: import("@reduxjs/toolkit/query").QueryDefinition<RetrieveOathQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, OathResponse, "deviceClient", unknown>;
|
|
19
|
+
deleteOathDevice: import("@reduxjs/toolkit/query").MutationDefinition<RetrieveOathQuery & {
|
|
20
|
+
device: OathDevice;
|
|
21
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, DeletedOathDevice, "deviceClient", unknown>;
|
|
22
|
+
getPushDevices: import("@reduxjs/toolkit/query").QueryDefinition<PushDeviceQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, GeneralResponse<PushDevice[]>, "deviceClient", unknown>;
|
|
23
|
+
deletePushDevice: import("@reduxjs/toolkit/query").MutationDefinition<DeleteDeviceQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, DeletedPushDevice, "deviceClient", unknown>;
|
|
24
|
+
getWebAuthnDevices: import("@reduxjs/toolkit/query").QueryDefinition<WebAuthnQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, GeneralResponse<WebAuthnDevice[]>, "deviceClient", unknown>;
|
|
25
|
+
updateWebAuthnDeviceName: import("@reduxjs/toolkit/query").MutationDefinition<WebAuthnQuery & {
|
|
26
|
+
device: WebAuthnDevice;
|
|
27
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, UpdatedWebAuthnDevice, "deviceClient", unknown>;
|
|
28
|
+
deleteWebAuthnDeviceName: import("@reduxjs/toolkit/query").MutationDefinition<WebAuthnQuery & {
|
|
29
|
+
device: UpdatedWebAuthnDevice | WebAuthnDevice;
|
|
30
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, UpdatedWebAuthnDevice, "deviceClient", unknown>;
|
|
31
|
+
getBoundDevices: import("@reduxjs/toolkit/query").MutationDefinition<GetBoundDevicesQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, GeneralResponse<Device[]>, "deviceClient", unknown>;
|
|
32
|
+
updateBoundDevice: import("@reduxjs/toolkit/query").MutationDefinition<BoundDeviceQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, Device, "deviceClient", unknown>;
|
|
33
|
+
deleteBoundDevice: import("@reduxjs/toolkit/query").MutationDefinition<BoundDeviceQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, GeneralResponse<Device>, "deviceClient", unknown>;
|
|
34
|
+
getDeviceProfiles: import("@reduxjs/toolkit/query").QueryDefinition<GetProfileDevices, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, GeneralResponse<ProfileDevice[]>, "deviceClient", unknown>;
|
|
35
|
+
updateDeviceProfile: import("@reduxjs/toolkit/query").MutationDefinition<Omit<ProfileDevicesQuery, "uuid">, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, ProfileDevice, "deviceClient", unknown>;
|
|
36
|
+
deleteDeviceProfile: import("@reduxjs/toolkit/query").MutationDefinition<ProfileDevicesQuery, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@reduxjs/toolkit/query").FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, never, ProfileDevice, "deviceClient", unknown>;
|
|
37
|
+
}, "deviceClient", never, typeof import("@reduxjs/toolkit/query").coreModuleName>;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,eAAe,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC;CACX;AAED,eAAO,MAAM,aAAa,GAAI,wBAAwB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;;;gBAwBtD,UAAU;;;;;;gBA8Bd,cAAc;;;gBAUd,qBAAqB,GAAG,cAAc;;;;;;;;iFA6CpE,CAAC"}
|