@forgerock/device-client 0.0.0-beta-20251222204813 → 0.0.0-beta-20260316200422
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 +14 -15
- package/package.json +1 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -8
- package/dist/src/index.js.map +0 -1
- package/dist/src/lib/device.store.d.ts +0 -186
- package/dist/src/lib/device.store.d.ts.map +0 -1
- package/dist/src/lib/device.store.js +0 -306
- package/dist/src/lib/device.store.js.map +0 -1
- package/dist/src/lib/device.store.utils.d.ts +0 -4
- package/dist/src/lib/device.store.utils.d.ts.map +0 -1
- package/dist/src/lib/device.store.utils.js +0 -12
- package/dist/src/lib/device.store.utils.js.map +0 -1
- package/dist/src/lib/services/index.d.ts +0 -38
- package/dist/src/lib/services/index.d.ts.map +0 -1
- package/dist/src/lib/services/index.js +0 -98
- package/dist/src/lib/services/index.js.map +0 -1
- package/dist/src/lib/types/bound-device.types.d.ts +0 -35
- package/dist/src/lib/types/bound-device.types.d.ts.map +0 -1
- package/dist/src/lib/types/bound-device.types.js +0 -2
- package/dist/src/lib/types/bound-device.types.js.map +0 -1
- package/dist/src/lib/types/index.d.ts +0 -8
- package/dist/src/lib/types/index.d.ts.map +0 -1
- package/dist/src/lib/types/index.js +0 -14
- package/dist/src/lib/types/index.js.map +0 -1
- package/dist/src/lib/types/oath.types.d.ts +0 -42
- package/dist/src/lib/types/oath.types.d.ts.map +0 -1
- package/dist/src/lib/types/oath.types.js +0 -2
- package/dist/src/lib/types/oath.types.js.map +0 -1
- package/dist/src/lib/types/profile-device.types.d.ts +0 -57
- package/dist/src/lib/types/profile-device.types.d.ts.map +0 -1
- package/dist/src/lib/types/profile-device.types.js +0 -2
- package/dist/src/lib/types/profile-device.types.js.map +0 -1
- package/dist/src/lib/types/push-device.types.d.ts +0 -99
- package/dist/src/lib/types/push-device.types.d.ts.map +0 -1
- package/dist/src/lib/types/push-device.types.js +0 -2
- package/dist/src/lib/types/push-device.types.js.map +0 -1
- package/dist/src/lib/types/updateDeviceProfile.types.d.ts +0 -58
- package/dist/src/lib/types/updateDeviceProfile.types.d.ts.map +0 -1
- package/dist/src/lib/types/updateDeviceProfile.types.js +0 -2
- package/dist/src/lib/types/updateDeviceProfile.types.js.map +0 -1
- package/dist/src/lib/types/webauthn.types.d.ts +0 -58
- package/dist/src/lib/types/webauthn.types.d.ts.map +0 -1
- package/dist/src/lib/types/webauthn.types.js +0 -2
- package/dist/src/lib/types/webauthn.types.js.map +0 -1
- package/dist/src/types.d.ts +0 -2
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -8
- package/dist/src/types.js.map +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@ The `deviceClient` API provides a structured interface for managing various type
|
|
|
8
8
|
2. [Installation](#installation)
|
|
9
9
|
3. [Configuration](#configuration)
|
|
10
10
|
4. [API Methods](#api-methods)
|
|
11
|
-
|
|
12
11
|
- [OATH Management](#oath-management)
|
|
13
12
|
- [PUSH Management](#push-management)
|
|
14
13
|
- [WebAuthn Management](#webauthn-management)
|
|
@@ -37,7 +36,7 @@ To configure the `deviceClient`, you need to provide a `ConfigOptions` object th
|
|
|
37
36
|
|
|
38
37
|
```typescript
|
|
39
38
|
import { deviceClient } from '@forgerock/device-client';
|
|
40
|
-
import {
|
|
39
|
+
import type { ConfigOptions } from '@forgerock/device-client/types';
|
|
41
40
|
|
|
42
41
|
const config: ConfigOptions = {
|
|
43
42
|
serverConfig: {
|
|
@@ -59,59 +58,59 @@ const apiClient = deviceClient(config);
|
|
|
59
58
|
|
|
60
59
|
#### Methods
|
|
61
60
|
|
|
62
|
-
- **get(query: RetrieveOathQuery): Promise<OathDevice[]>**
|
|
61
|
+
- **get(query: RetrieveOathQuery): Promise<OathDevice[] | { error: unknown }>**
|
|
63
62
|
- Retrieves Oath devices based on the specified query.
|
|
64
63
|
|
|
65
|
-
- **delete(query: RetrieveOathQuery & { device: OathDevice }): Promise
|
|
64
|
+
- **delete(query: RetrieveOathQuery & { device: OathDevice }): Promise<null | { error: unknown }>**
|
|
66
65
|
- Deletes an Oath device based on the provided query and device information.
|
|
67
66
|
|
|
68
67
|
### PUSH Management
|
|
69
68
|
|
|
70
69
|
#### Methods
|
|
71
70
|
|
|
72
|
-
- **get(query: PushDeviceQuery): Promise<PushDevice[]>**
|
|
71
|
+
- **get(query: PushDeviceQuery): Promise<PushDevice[] | { error: unknown }>**
|
|
73
72
|
- Retrieves Push devices based on the specified query.
|
|
74
73
|
|
|
75
|
-
- **delete(query: DeleteDeviceQuery): Promise
|
|
74
|
+
- **delete(query: DeleteDeviceQuery): Promise<null | { error: unknown }>**
|
|
76
75
|
- Deletes a Push device based on the provided query.
|
|
77
76
|
|
|
78
77
|
### WebAuthn Management
|
|
79
78
|
|
|
80
79
|
#### Methods
|
|
81
80
|
|
|
82
|
-
- **get(query: WebAuthnQuery): Promise<WebAuthnDevice[]>**
|
|
81
|
+
- **get(query: WebAuthnQuery): Promise<WebAuthnDevice[] | { error: unknown }>**
|
|
83
82
|
- Retrieves WebAuthn devices based on the specified query.
|
|
84
83
|
|
|
85
|
-
- **update(query: WebAuthnQuery & { device: WebAuthnDevice }): Promise
|
|
84
|
+
- **update(query: WebAuthnQuery & { device: WebAuthnDevice }): Promise<UpdatedWebAuthnDevice | { error: unknown }>**
|
|
86
85
|
- Updates the name of a WebAuthn device based on the provided query and body.
|
|
87
86
|
|
|
88
|
-
- **delete(query: WebAuthnQuery & { device: WebAuthnDevice | UpdatedWebAuthnDevice }): Promise
|
|
87
|
+
- **delete(query: WebAuthnQuery & { device: WebAuthnDevice | UpdatedWebAuthnDevice }): Promise<null | { error: unknown }>**
|
|
89
88
|
- Deletes a WebAuthn device based on the provided query and body.
|
|
90
89
|
|
|
91
90
|
### Bound Devices Management
|
|
92
91
|
|
|
93
92
|
#### Methods
|
|
94
93
|
|
|
95
|
-
- **get(query: GetBoundDevicesQuery): Promise
|
|
94
|
+
- **get(query: GetBoundDevicesQuery): Promise<Device[] | { error: unknown }>**
|
|
96
95
|
- Retrieves bound devices based on the specified query.
|
|
97
96
|
|
|
98
|
-
- **update(query: BoundDeviceQuery): Promise
|
|
97
|
+
- **update(query: BoundDeviceQuery): Promise<Device | { error: unknown }>**
|
|
99
98
|
- Updates the name of a bound device based on the provided query.
|
|
100
99
|
|
|
101
|
-
- **delete(query: BoundDeviceQuery): Promise
|
|
100
|
+
- **delete(query: BoundDeviceQuery): Promise<null | { error: unknown }>**
|
|
102
101
|
- Deletes a bound device based on the provided query.
|
|
103
102
|
|
|
104
103
|
### Device Profiling Management
|
|
105
104
|
|
|
106
105
|
#### Methods
|
|
107
106
|
|
|
108
|
-
- **get(query: GetProfileDevices): Promise
|
|
107
|
+
- **get(query: GetProfileDevices): Promise<ProfileDevice[] | { error: unknown }>**
|
|
109
108
|
- Retrieves device profiles based on the specified query.
|
|
110
109
|
|
|
111
|
-
- **update(query: ProfileDevicesQuery): Promise
|
|
110
|
+
- **update(query: ProfileDevicesQuery): Promise<ProfileDevice | { error: unknown }>**
|
|
112
111
|
- Updates the name of a device profile based on the provided query.
|
|
113
112
|
|
|
114
|
-
- **delete(query: ProfileDevicesQuery): Promise
|
|
113
|
+
- **delete(query: ProfileDevicesQuery): Promise<null | { error: unknown }>**
|
|
115
114
|
- Deletes a device profile based on the provided query.
|
|
116
115
|
|
|
117
116
|
## Example Usage
|
package/package.json
CHANGED
package/dist/src/index.d.ts
DELETED
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,uBAAuB,CAAC"}
|
package/dist/src/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { type ConfigOptions } from '@forgerock/javascript-sdk';
|
|
2
|
-
import { OathDevice, RetrieveOathQuery } from './types/oath.types.js';
|
|
3
|
-
import { DeleteDeviceQuery, PushDevice, PushDeviceQuery } from './types/push-device.types.js';
|
|
4
|
-
import { UpdatedWebAuthnDevice, WebAuthnDevice, WebAuthnQuery } from './types/webauthn.types.js';
|
|
5
|
-
import { BoundDeviceQuery, Device, GetBoundDevicesQuery } from './types/bound-device.types.js';
|
|
6
|
-
import { 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 update
|
|
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
|
-
* Get 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
|
-
* Get profile devices
|
|
175
|
-
*
|
|
176
|
-
* @async
|
|
177
|
-
* @function update
|
|
178
|
-
* @param {ProfileDevicesQuery} query - The query used to update 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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,+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czF;;;;;;;WAOG;wBAC4B,gBAAgB,KAAG,OAAO,CAAC,IAAI,GAAG;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QAcpF;;;;;;;WAOG;wBAC4B,gBAAgB,KAAG,OAAO,CAAC,MAAM,GAAG;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;;;QAetF;;;;;;;WAOG;qBAEM,iBAAiB,KACvB,OAAO,CAAC,aAAa,EAAE,GAAG;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QAahD;;;;;;;WAOG;wBAEM,mBAAmB,KACzB,OAAO,CAAC,aAAa,GAAG;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QAa9C;;;;;;;WAOG;wBAC4B,mBAAmB,KAAG,OAAO,CAAC,IAAI,GAAG;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;;CAe5F,CAAC"}
|
|
@@ -1,306 +0,0 @@
|
|
|
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 update
|
|
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
|
-
* Get 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
|
-
* Get profile devices
|
|
285
|
-
*
|
|
286
|
-
* @async
|
|
287
|
-
* @function update
|
|
288
|
-
* @param {ProfileDevicesQuery} query - The query used to update 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
|
|
@@ -1 +0,0 @@
|
|
|
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;AAUpD,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,O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B,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,EAAE,KAAK,EAAE,CAAC;gBACnB,CAAC;YACH,CAAC;YACD;;;;;;;eAOG;YACH,MAAM,EAAE,KAAK,WAAW,KAA0B;gBAChD,IAAI,CAAC;oBACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;oBAEtF,IAAI,KAAK,EAAE,CAAC;wBACV,WAAW,CAAC,KAAK,EAAE,mCAAmC,CAAC,CAAC;oBAC1D,CAAC;oBAED,OAAO,IAAI,CAAC;gBACd,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,EAAE,KAAK,EAAE,CAAC;gBACnB,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|