authula 0.5.4 → 0.7.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/README.md +79 -739
- package/dist/custom-fetch-Ce6_l1Qb.js +118 -0
- package/dist/custom-fetch-Ce6_l1Qb.js.map +1 -0
- package/dist/index-BdPCSdtc.d.ts +2015 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +30 -17
- package/dist/index.js.map +1 -1
- package/dist/plugins/index.d.ts +2935 -738
- package/dist/plugins/index.js +4090 -523
- package/dist/plugins/index.js.map +1 -1
- package/dist/rolldown-runtime-w6R9maHv.js +18 -0
- package/package.json +19 -18
- package/dist/fetch-BnZpQ0Yq.js +0 -128
- package/dist/fetch-BnZpQ0Yq.js.map +0 -1
- package/dist/fetch-CEj1gBkL.cjs +0 -163
- package/dist/fetch-CEj1gBkL.cjs.map +0 -1
- package/dist/index.cjs +0 -60
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -2
- package/dist/plugins/index.cjs +0 -696
- package/dist/plugins/index.cjs.map +0 -1
- package/dist/plugins/index.d.cts +0 -825
- package/dist/sdk-7eSlhCrf.d.cts +0 -167
- package/dist/sdk-7eSlhCrf.d.ts +0 -167
package/dist/plugins/index.js
CHANGED
|
@@ -1,154 +1,2399 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-w6R9maHv.js";
|
|
2
|
+
import { n as customFetch } from "../custom-fetch-Ce6_l1Qb.js";
|
|
3
|
+
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
4
|
|
|
5
|
+
//#region src/utils/wrap-generated.ts
|
|
6
|
+
function isHookKey(key) {
|
|
7
|
+
return key.startsWith("use") && key[3] === key[3]?.toUpperCase();
|
|
8
|
+
}
|
|
9
|
+
function wrapGenerated(mod, client) {
|
|
10
|
+
const baseUrl = client.config.url.replace(/\/+$/, "");
|
|
11
|
+
const cookies = client.config.cookies;
|
|
12
|
+
const onBeforeFetch = (ctx) => client.runBeforeFetch(ctx);
|
|
13
|
+
const onAfterFetch = (ctx, res) => client.runAfterFetch(ctx, res);
|
|
14
|
+
const wrapped = {};
|
|
15
|
+
for (const [key, value] of Object.entries(mod)) {
|
|
16
|
+
if (typeof value !== "function") {
|
|
17
|
+
wrapped[key] = value;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (isHookKey(key)) wrapped[key] = (options, ...rest) => value({
|
|
21
|
+
...options,
|
|
22
|
+
request: {
|
|
23
|
+
...options?.request,
|
|
24
|
+
baseUrl,
|
|
25
|
+
cookies,
|
|
26
|
+
onBeforeFetch,
|
|
27
|
+
onAfterFetch
|
|
28
|
+
}
|
|
29
|
+
}, ...rest);
|
|
30
|
+
else wrapped[key] = (...args) => {
|
|
31
|
+
const ctx = {
|
|
32
|
+
baseUrl,
|
|
33
|
+
cookies,
|
|
34
|
+
onBeforeFetch,
|
|
35
|
+
onAfterFetch
|
|
36
|
+
};
|
|
37
|
+
const optionsIdx = value.length - 1;
|
|
38
|
+
while (args.length < optionsIdx) args.push(void 0);
|
|
39
|
+
if (optionsIdx >= 0 && args.length === optionsIdx) args.push(ctx);
|
|
40
|
+
else if (optionsIdx >= 0) args[optionsIdx] = {
|
|
41
|
+
...args[optionsIdx],
|
|
42
|
+
...ctx
|
|
43
|
+
};
|
|
44
|
+
return value(...args);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return wrapped;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/gen/endpoints/access-control/access-control.ts
|
|
52
|
+
var access_control_exports = /* @__PURE__ */ __exportAll({
|
|
53
|
+
addRolePermission: () => addRolePermission,
|
|
54
|
+
assignUserRole: () => assignUserRole,
|
|
55
|
+
checkUserPermissions: () => checkUserPermissions,
|
|
56
|
+
createPermission: () => createPermission,
|
|
57
|
+
createRole: () => createRole,
|
|
58
|
+
deletePermission: () => deletePermission,
|
|
59
|
+
deleteRole: () => deleteRole,
|
|
60
|
+
getAddRolePermissionMutationOptions: () => getAddRolePermissionMutationOptions,
|
|
61
|
+
getAddRolePermissionUrl: () => getAddRolePermissionUrl,
|
|
62
|
+
getAssignUserRoleMutationOptions: () => getAssignUserRoleMutationOptions,
|
|
63
|
+
getAssignUserRoleUrl: () => getAssignUserRoleUrl,
|
|
64
|
+
getCheckUserPermissionsMutationOptions: () => getCheckUserPermissionsMutationOptions,
|
|
65
|
+
getCheckUserPermissionsUrl: () => getCheckUserPermissionsUrl,
|
|
66
|
+
getCreatePermissionMutationOptions: () => getCreatePermissionMutationOptions,
|
|
67
|
+
getCreatePermissionUrl: () => getCreatePermissionUrl,
|
|
68
|
+
getCreateRoleMutationOptions: () => getCreateRoleMutationOptions,
|
|
69
|
+
getCreateRoleUrl: () => getCreateRoleUrl,
|
|
70
|
+
getDeletePermissionMutationOptions: () => getDeletePermissionMutationOptions,
|
|
71
|
+
getDeletePermissionUrl: () => getDeletePermissionUrl,
|
|
72
|
+
getDeleteRoleMutationOptions: () => getDeleteRoleMutationOptions,
|
|
73
|
+
getDeleteRoleUrl: () => getDeleteRoleUrl,
|
|
74
|
+
getGetPermissionQueryKey: () => getGetPermissionQueryKey,
|
|
75
|
+
getGetPermissionQueryOptions: () => getGetPermissionQueryOptions,
|
|
76
|
+
getGetPermissionUrl: () => getGetPermissionUrl,
|
|
77
|
+
getGetRoleByNameQueryKey: () => getGetRoleByNameQueryKey,
|
|
78
|
+
getGetRoleByNameQueryOptions: () => getGetRoleByNameQueryOptions,
|
|
79
|
+
getGetRoleByNameUrl: () => getGetRoleByNameUrl,
|
|
80
|
+
getGetRoleQueryKey: () => getGetRoleQueryKey,
|
|
81
|
+
getGetRoleQueryOptions: () => getGetRoleQueryOptions,
|
|
82
|
+
getGetRoleUrl: () => getGetRoleUrl,
|
|
83
|
+
getGetUserPermissionsQueryKey: () => getGetUserPermissionsQueryKey,
|
|
84
|
+
getGetUserPermissionsQueryOptions: () => getGetUserPermissionsQueryOptions,
|
|
85
|
+
getGetUserPermissionsUrl: () => getGetUserPermissionsUrl,
|
|
86
|
+
getListPermissionsQueryKey: () => getListPermissionsQueryKey,
|
|
87
|
+
getListPermissionsQueryOptions: () => getListPermissionsQueryOptions,
|
|
88
|
+
getListPermissionsUrl: () => getListPermissionsUrl,
|
|
89
|
+
getListRolePermissionsQueryKey: () => getListRolePermissionsQueryKey,
|
|
90
|
+
getListRolePermissionsQueryOptions: () => getListRolePermissionsQueryOptions,
|
|
91
|
+
getListRolePermissionsUrl: () => getListRolePermissionsUrl,
|
|
92
|
+
getListRolesQueryKey: () => getListRolesQueryKey,
|
|
93
|
+
getListRolesQueryOptions: () => getListRolesQueryOptions,
|
|
94
|
+
getListRolesUrl: () => getListRolesUrl,
|
|
95
|
+
getListUserRolesQueryKey: () => getListUserRolesQueryKey,
|
|
96
|
+
getListUserRolesQueryOptions: () => getListUserRolesQueryOptions,
|
|
97
|
+
getListUserRolesUrl: () => getListUserRolesUrl,
|
|
98
|
+
getPermission: () => getPermission,
|
|
99
|
+
getRemoveRolePermissionMutationOptions: () => getRemoveRolePermissionMutationOptions,
|
|
100
|
+
getRemoveRolePermissionUrl: () => getRemoveRolePermissionUrl,
|
|
101
|
+
getRemoveUserRoleMutationOptions: () => getRemoveUserRoleMutationOptions,
|
|
102
|
+
getRemoveUserRoleUrl: () => getRemoveUserRoleUrl,
|
|
103
|
+
getReplaceRolePermissionsMutationOptions: () => getReplaceRolePermissionsMutationOptions,
|
|
104
|
+
getReplaceRolePermissionsUrl: () => getReplaceRolePermissionsUrl,
|
|
105
|
+
getReplaceUserRolesMutationOptions: () => getReplaceUserRolesMutationOptions,
|
|
106
|
+
getReplaceUserRolesUrl: () => getReplaceUserRolesUrl,
|
|
107
|
+
getRole: () => getRole,
|
|
108
|
+
getRoleByName: () => getRoleByName,
|
|
109
|
+
getUpdatePermissionMutationOptions: () => getUpdatePermissionMutationOptions,
|
|
110
|
+
getUpdatePermissionUrl: () => getUpdatePermissionUrl,
|
|
111
|
+
getUpdateRoleMutationOptions: () => getUpdateRoleMutationOptions,
|
|
112
|
+
getUpdateRoleUrl: () => getUpdateRoleUrl,
|
|
113
|
+
getUserPermissions: () => getUserPermissions,
|
|
114
|
+
listPermissions: () => listPermissions,
|
|
115
|
+
listRolePermissions: () => listRolePermissions,
|
|
116
|
+
listRoles: () => listRoles,
|
|
117
|
+
listUserRoles: () => listUserRoles,
|
|
118
|
+
removeRolePermission: () => removeRolePermission,
|
|
119
|
+
removeUserRole: () => removeUserRole,
|
|
120
|
+
replaceRolePermissions: () => replaceRolePermissions,
|
|
121
|
+
replaceUserRoles: () => replaceUserRoles,
|
|
122
|
+
updatePermission: () => updatePermission,
|
|
123
|
+
updateRole: () => updateRole,
|
|
124
|
+
useAddRolePermission: () => useAddRolePermission,
|
|
125
|
+
useAssignUserRole: () => useAssignUserRole,
|
|
126
|
+
useCheckUserPermissions: () => useCheckUserPermissions,
|
|
127
|
+
useCreatePermission: () => useCreatePermission,
|
|
128
|
+
useCreateRole: () => useCreateRole,
|
|
129
|
+
useDeletePermission: () => useDeletePermission,
|
|
130
|
+
useDeleteRole: () => useDeleteRole,
|
|
131
|
+
useGetPermission: () => useGetPermission,
|
|
132
|
+
useGetRole: () => useGetRole,
|
|
133
|
+
useGetRoleByName: () => useGetRoleByName,
|
|
134
|
+
useGetUserPermissions: () => useGetUserPermissions,
|
|
135
|
+
useListPermissions: () => useListPermissions,
|
|
136
|
+
useListRolePermissions: () => useListRolePermissions,
|
|
137
|
+
useListRoles: () => useListRoles,
|
|
138
|
+
useListUserRoles: () => useListUserRoles,
|
|
139
|
+
useRemoveRolePermission: () => useRemoveRolePermission,
|
|
140
|
+
useRemoveUserRole: () => useRemoveUserRole,
|
|
141
|
+
useReplaceRolePermissions: () => useReplaceRolePermissions,
|
|
142
|
+
useReplaceUserRoles: () => useReplaceUserRoles,
|
|
143
|
+
useUpdatePermission: () => useUpdatePermission,
|
|
144
|
+
useUpdateRole: () => useUpdateRole
|
|
145
|
+
});
|
|
146
|
+
const withQueryKey$13 = (query, queryKey) => {
|
|
147
|
+
const result = { queryKey };
|
|
148
|
+
for (const key of Object.keys(query)) {
|
|
149
|
+
if (key === "queryKey") continue;
|
|
150
|
+
Object.defineProperty(result, key, {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
configurable: true,
|
|
153
|
+
get: () => query[key]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
157
|
+
};
|
|
158
|
+
const getListPermissionsUrl = () => {
|
|
159
|
+
return `/access-control/permissions`;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Lists all permissions.
|
|
163
|
+
* @summary List permissions
|
|
164
|
+
*/
|
|
165
|
+
const listPermissions = async (options) => {
|
|
166
|
+
return customFetch(getListPermissionsUrl(), {
|
|
167
|
+
...options,
|
|
168
|
+
method: "GET"
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
const getListPermissionsQueryKey = () => {
|
|
172
|
+
return [`/access-control/permissions`];
|
|
173
|
+
};
|
|
174
|
+
const getListPermissionsQueryOptions = (options) => {
|
|
175
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
176
|
+
const queryKey = queryOptions?.queryKey ?? getListPermissionsQueryKey();
|
|
177
|
+
const queryFn = ({ signal }) => listPermissions({
|
|
178
|
+
signal,
|
|
179
|
+
...requestOptions
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
queryKey,
|
|
183
|
+
queryFn,
|
|
184
|
+
...queryOptions
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* @summary List permissions
|
|
189
|
+
*/
|
|
190
|
+
function useListPermissions(options, queryClient) {
|
|
191
|
+
const queryOptions = getListPermissionsQueryOptions(options);
|
|
192
|
+
const query = useQuery(queryOptions, queryClient);
|
|
193
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
194
|
+
}
|
|
195
|
+
const getCreatePermissionUrl = () => {
|
|
196
|
+
return `/access-control/permissions`;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Creates a new permission.
|
|
200
|
+
* @summary Create permission
|
|
201
|
+
*/
|
|
202
|
+
const createPermission = async (createPermissionRequest, options) => {
|
|
203
|
+
return customFetch(getCreatePermissionUrl(), {
|
|
204
|
+
...options,
|
|
205
|
+
method: "POST",
|
|
206
|
+
headers: {
|
|
207
|
+
"Content-Type": "application/json",
|
|
208
|
+
...options?.headers
|
|
209
|
+
},
|
|
210
|
+
body: JSON.stringify(createPermissionRequest)
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
const getCreatePermissionMutationOptions = (options) => {
|
|
214
|
+
const mutationKey = ["createPermission"];
|
|
215
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
216
|
+
...options,
|
|
217
|
+
mutation: {
|
|
218
|
+
...options.mutation,
|
|
219
|
+
mutationKey
|
|
220
|
+
}
|
|
221
|
+
} : {
|
|
222
|
+
mutation: { mutationKey },
|
|
223
|
+
request: void 0
|
|
224
|
+
};
|
|
225
|
+
const mutationFn = (props) => {
|
|
226
|
+
const { data } = props ?? {};
|
|
227
|
+
return createPermission(data, requestOptions);
|
|
228
|
+
};
|
|
229
|
+
return {
|
|
230
|
+
mutationFn,
|
|
231
|
+
...mutationOptions
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* @summary Create permission
|
|
236
|
+
*/
|
|
237
|
+
const useCreatePermission = (options, queryClient) => {
|
|
238
|
+
return useMutation(getCreatePermissionMutationOptions(options), queryClient);
|
|
239
|
+
};
|
|
240
|
+
const getGetPermissionUrl = (permissionId) => {
|
|
241
|
+
return `/access-control/permissions/${permissionId}`;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Retrieves a permission by its ID.
|
|
245
|
+
* @summary Get permission by ID
|
|
246
|
+
*/
|
|
247
|
+
const getPermission = async (permissionId, options) => {
|
|
248
|
+
return customFetch(getGetPermissionUrl(permissionId), {
|
|
249
|
+
...options,
|
|
250
|
+
method: "GET"
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
const getGetPermissionQueryKey = (permissionId) => {
|
|
254
|
+
return [`/access-control/permissions/${permissionId}`];
|
|
255
|
+
};
|
|
256
|
+
const getGetPermissionQueryOptions = (permissionId, options) => {
|
|
257
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
258
|
+
const queryKey = queryOptions?.queryKey ?? getGetPermissionQueryKey(permissionId);
|
|
259
|
+
const queryFn = ({ signal }) => getPermission(permissionId, {
|
|
260
|
+
signal,
|
|
261
|
+
...requestOptions
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
queryKey,
|
|
265
|
+
queryFn,
|
|
266
|
+
enabled: permissionId !== null && permissionId !== void 0,
|
|
267
|
+
...queryOptions
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* @summary Get permission by ID
|
|
272
|
+
*/
|
|
273
|
+
function useGetPermission(permissionId, options, queryClient) {
|
|
274
|
+
const queryOptions = getGetPermissionQueryOptions(permissionId, options);
|
|
275
|
+
const query = useQuery(queryOptions, queryClient);
|
|
276
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
277
|
+
}
|
|
278
|
+
const getDeletePermissionUrl = (permissionId) => {
|
|
279
|
+
return `/access-control/permissions/${permissionId}`;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Deletes a permission.
|
|
283
|
+
* @summary Delete permission
|
|
284
|
+
*/
|
|
285
|
+
const deletePermission = async (permissionId, options) => {
|
|
286
|
+
return customFetch(getDeletePermissionUrl(permissionId), {
|
|
287
|
+
...options,
|
|
288
|
+
method: "DELETE"
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
const getDeletePermissionMutationOptions = (options) => {
|
|
292
|
+
const mutationKey = ["deletePermission"];
|
|
293
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
294
|
+
...options,
|
|
295
|
+
mutation: {
|
|
296
|
+
...options.mutation,
|
|
297
|
+
mutationKey
|
|
298
|
+
}
|
|
299
|
+
} : {
|
|
300
|
+
mutation: { mutationKey },
|
|
301
|
+
request: void 0
|
|
302
|
+
};
|
|
303
|
+
const mutationFn = (props) => {
|
|
304
|
+
const { permissionId } = props ?? {};
|
|
305
|
+
return deletePermission(permissionId, requestOptions);
|
|
306
|
+
};
|
|
307
|
+
return {
|
|
308
|
+
mutationFn,
|
|
309
|
+
...mutationOptions
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* @summary Delete permission
|
|
314
|
+
*/
|
|
315
|
+
const useDeletePermission = (options, queryClient) => {
|
|
316
|
+
return useMutation(getDeletePermissionMutationOptions(options), queryClient);
|
|
317
|
+
};
|
|
318
|
+
const getUpdatePermissionUrl = (permissionId) => {
|
|
319
|
+
return `/access-control/permissions/${permissionId}`;
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Updates a permission's description.
|
|
323
|
+
* @summary Update permission
|
|
324
|
+
*/
|
|
325
|
+
const updatePermission = async (permissionId, updatePermissionRequest, options) => {
|
|
326
|
+
return customFetch(getUpdatePermissionUrl(permissionId), {
|
|
327
|
+
...options,
|
|
328
|
+
method: "PATCH",
|
|
329
|
+
headers: {
|
|
330
|
+
"Content-Type": "application/json",
|
|
331
|
+
...options?.headers
|
|
332
|
+
},
|
|
333
|
+
body: JSON.stringify(updatePermissionRequest)
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
const getUpdatePermissionMutationOptions = (options) => {
|
|
337
|
+
const mutationKey = ["updatePermission"];
|
|
338
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
339
|
+
...options,
|
|
340
|
+
mutation: {
|
|
341
|
+
...options.mutation,
|
|
342
|
+
mutationKey
|
|
343
|
+
}
|
|
344
|
+
} : {
|
|
345
|
+
mutation: { mutationKey },
|
|
346
|
+
request: void 0
|
|
347
|
+
};
|
|
348
|
+
const mutationFn = (props) => {
|
|
349
|
+
const { permissionId, data } = props ?? {};
|
|
350
|
+
return updatePermission(permissionId, data, requestOptions);
|
|
351
|
+
};
|
|
352
|
+
return {
|
|
353
|
+
mutationFn,
|
|
354
|
+
...mutationOptions
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* @summary Update permission
|
|
359
|
+
*/
|
|
360
|
+
const useUpdatePermission = (options, queryClient) => {
|
|
361
|
+
return useMutation(getUpdatePermissionMutationOptions(options), queryClient);
|
|
362
|
+
};
|
|
363
|
+
const getListRolesUrl = () => {
|
|
364
|
+
return `/access-control/roles`;
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Lists all roles.
|
|
368
|
+
* @summary List roles
|
|
369
|
+
*/
|
|
370
|
+
const listRoles = async (options) => {
|
|
371
|
+
return customFetch(getListRolesUrl(), {
|
|
372
|
+
...options,
|
|
373
|
+
method: "GET"
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
const getListRolesQueryKey = () => {
|
|
377
|
+
return [`/access-control/roles`];
|
|
378
|
+
};
|
|
379
|
+
const getListRolesQueryOptions = (options) => {
|
|
380
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
381
|
+
const queryKey = queryOptions?.queryKey ?? getListRolesQueryKey();
|
|
382
|
+
const queryFn = ({ signal }) => listRoles({
|
|
383
|
+
signal,
|
|
384
|
+
...requestOptions
|
|
385
|
+
});
|
|
386
|
+
return {
|
|
387
|
+
queryKey,
|
|
388
|
+
queryFn,
|
|
389
|
+
...queryOptions
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
* @summary List roles
|
|
394
|
+
*/
|
|
395
|
+
function useListRoles(options, queryClient) {
|
|
396
|
+
const queryOptions = getListRolesQueryOptions(options);
|
|
397
|
+
const query = useQuery(queryOptions, queryClient);
|
|
398
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
399
|
+
}
|
|
400
|
+
const getCreateRoleUrl = () => {
|
|
401
|
+
return `/access-control/roles`;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Creates a new role.
|
|
405
|
+
* @summary Create role
|
|
406
|
+
*/
|
|
407
|
+
const createRole = async (createRoleRequest, options) => {
|
|
408
|
+
return customFetch(getCreateRoleUrl(), {
|
|
409
|
+
...options,
|
|
410
|
+
method: "POST",
|
|
411
|
+
headers: {
|
|
412
|
+
"Content-Type": "application/json",
|
|
413
|
+
...options?.headers
|
|
414
|
+
},
|
|
415
|
+
body: JSON.stringify(createRoleRequest)
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
const getCreateRoleMutationOptions = (options) => {
|
|
419
|
+
const mutationKey = ["createRole"];
|
|
420
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
421
|
+
...options,
|
|
422
|
+
mutation: {
|
|
423
|
+
...options.mutation,
|
|
424
|
+
mutationKey
|
|
425
|
+
}
|
|
426
|
+
} : {
|
|
427
|
+
mutation: { mutationKey },
|
|
428
|
+
request: void 0
|
|
429
|
+
};
|
|
430
|
+
const mutationFn = (props) => {
|
|
431
|
+
const { data } = props ?? {};
|
|
432
|
+
return createRole(data, requestOptions);
|
|
433
|
+
};
|
|
434
|
+
return {
|
|
435
|
+
mutationFn,
|
|
436
|
+
...mutationOptions
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* @summary Create role
|
|
441
|
+
*/
|
|
442
|
+
const useCreateRole = (options, queryClient) => {
|
|
443
|
+
return useMutation(getCreateRoleMutationOptions(options), queryClient);
|
|
444
|
+
};
|
|
445
|
+
const getGetRoleByNameUrl = (roleName) => {
|
|
446
|
+
return `/access-control/roles/by-name/${roleName}`;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* Retrieves a role by its name.
|
|
450
|
+
* @summary Get role by name
|
|
451
|
+
*/
|
|
452
|
+
const getRoleByName = async (roleName, options) => {
|
|
453
|
+
return customFetch(getGetRoleByNameUrl(roleName), {
|
|
454
|
+
...options,
|
|
455
|
+
method: "GET"
|
|
456
|
+
});
|
|
457
|
+
};
|
|
458
|
+
const getGetRoleByNameQueryKey = (roleName) => {
|
|
459
|
+
return [`/access-control/roles/by-name/${roleName}`];
|
|
460
|
+
};
|
|
461
|
+
const getGetRoleByNameQueryOptions = (roleName, options) => {
|
|
462
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
463
|
+
const queryKey = queryOptions?.queryKey ?? getGetRoleByNameQueryKey(roleName);
|
|
464
|
+
const queryFn = ({ signal }) => getRoleByName(roleName, {
|
|
465
|
+
signal,
|
|
466
|
+
...requestOptions
|
|
467
|
+
});
|
|
468
|
+
return {
|
|
469
|
+
queryKey,
|
|
470
|
+
queryFn,
|
|
471
|
+
enabled: roleName !== null && roleName !== void 0,
|
|
472
|
+
...queryOptions
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
/**
|
|
476
|
+
* @summary Get role by name
|
|
477
|
+
*/
|
|
478
|
+
function useGetRoleByName(roleName, options, queryClient) {
|
|
479
|
+
const queryOptions = getGetRoleByNameQueryOptions(roleName, options);
|
|
480
|
+
const query = useQuery(queryOptions, queryClient);
|
|
481
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
482
|
+
}
|
|
483
|
+
const getGetRoleUrl = (roleId) => {
|
|
484
|
+
return `/access-control/roles/${roleId}`;
|
|
485
|
+
};
|
|
486
|
+
/**
|
|
487
|
+
* Retrieves a role by its ID, including its permissions.
|
|
488
|
+
* @summary Get role by ID
|
|
489
|
+
*/
|
|
490
|
+
const getRole = async (roleId, options) => {
|
|
491
|
+
return customFetch(getGetRoleUrl(roleId), {
|
|
492
|
+
...options,
|
|
493
|
+
method: "GET"
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
const getGetRoleQueryKey = (roleId) => {
|
|
497
|
+
return [`/access-control/roles/${roleId}`];
|
|
498
|
+
};
|
|
499
|
+
const getGetRoleQueryOptions = (roleId, options) => {
|
|
500
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
501
|
+
const queryKey = queryOptions?.queryKey ?? getGetRoleQueryKey(roleId);
|
|
502
|
+
const queryFn = ({ signal }) => getRole(roleId, {
|
|
503
|
+
signal,
|
|
504
|
+
...requestOptions
|
|
505
|
+
});
|
|
506
|
+
return {
|
|
507
|
+
queryKey,
|
|
508
|
+
queryFn,
|
|
509
|
+
enabled: roleId !== null && roleId !== void 0,
|
|
510
|
+
...queryOptions
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* @summary Get role by ID
|
|
515
|
+
*/
|
|
516
|
+
function useGetRole(roleId, options, queryClient) {
|
|
517
|
+
const queryOptions = getGetRoleQueryOptions(roleId, options);
|
|
518
|
+
const query = useQuery(queryOptions, queryClient);
|
|
519
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
520
|
+
}
|
|
521
|
+
const getDeleteRoleUrl = (roleId) => {
|
|
522
|
+
return `/access-control/roles/${roleId}`;
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* Deletes a role.
|
|
526
|
+
* @summary Delete role
|
|
527
|
+
*/
|
|
528
|
+
const deleteRole = async (roleId, options) => {
|
|
529
|
+
return customFetch(getDeleteRoleUrl(roleId), {
|
|
530
|
+
...options,
|
|
531
|
+
method: "DELETE"
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
const getDeleteRoleMutationOptions = (options) => {
|
|
535
|
+
const mutationKey = ["deleteRole"];
|
|
536
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
537
|
+
...options,
|
|
538
|
+
mutation: {
|
|
539
|
+
...options.mutation,
|
|
540
|
+
mutationKey
|
|
541
|
+
}
|
|
542
|
+
} : {
|
|
543
|
+
mutation: { mutationKey },
|
|
544
|
+
request: void 0
|
|
545
|
+
};
|
|
546
|
+
const mutationFn = (props) => {
|
|
547
|
+
const { roleId } = props ?? {};
|
|
548
|
+
return deleteRole(roleId, requestOptions);
|
|
549
|
+
};
|
|
550
|
+
return {
|
|
551
|
+
mutationFn,
|
|
552
|
+
...mutationOptions
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
/**
|
|
556
|
+
* @summary Delete role
|
|
557
|
+
*/
|
|
558
|
+
const useDeleteRole = (options, queryClient) => {
|
|
559
|
+
return useMutation(getDeleteRoleMutationOptions(options), queryClient);
|
|
560
|
+
};
|
|
561
|
+
const getUpdateRoleUrl = (roleId) => {
|
|
562
|
+
return `/access-control/roles/${roleId}`;
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Updates a role's attributes.
|
|
566
|
+
* @summary Update role
|
|
567
|
+
*/
|
|
568
|
+
const updateRole = async (roleId, updateRoleRequest, options) => {
|
|
569
|
+
return customFetch(getUpdateRoleUrl(roleId), {
|
|
570
|
+
...options,
|
|
571
|
+
method: "PATCH",
|
|
572
|
+
headers: {
|
|
573
|
+
"Content-Type": "application/json",
|
|
574
|
+
...options?.headers
|
|
575
|
+
},
|
|
576
|
+
body: JSON.stringify(updateRoleRequest)
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
const getUpdateRoleMutationOptions = (options) => {
|
|
580
|
+
const mutationKey = ["updateRole"];
|
|
581
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
582
|
+
...options,
|
|
583
|
+
mutation: {
|
|
584
|
+
...options.mutation,
|
|
585
|
+
mutationKey
|
|
586
|
+
}
|
|
587
|
+
} : {
|
|
588
|
+
mutation: { mutationKey },
|
|
589
|
+
request: void 0
|
|
590
|
+
};
|
|
591
|
+
const mutationFn = (props) => {
|
|
592
|
+
const { roleId, data } = props ?? {};
|
|
593
|
+
return updateRole(roleId, data, requestOptions);
|
|
594
|
+
};
|
|
595
|
+
return {
|
|
596
|
+
mutationFn,
|
|
597
|
+
...mutationOptions
|
|
598
|
+
};
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* @summary Update role
|
|
602
|
+
*/
|
|
603
|
+
const useUpdateRole = (options, queryClient) => {
|
|
604
|
+
return useMutation(getUpdateRoleMutationOptions(options), queryClient);
|
|
605
|
+
};
|
|
606
|
+
const getListRolePermissionsUrl = (roleId) => {
|
|
607
|
+
return `/access-control/roles/${roleId}/permissions`;
|
|
608
|
+
};
|
|
609
|
+
/**
|
|
610
|
+
* Lists all permissions assigned to a role.
|
|
611
|
+
* @summary List role permissions
|
|
612
|
+
*/
|
|
613
|
+
const listRolePermissions = async (roleId, options) => {
|
|
614
|
+
return customFetch(getListRolePermissionsUrl(roleId), {
|
|
615
|
+
...options,
|
|
616
|
+
method: "GET"
|
|
617
|
+
});
|
|
618
|
+
};
|
|
619
|
+
const getListRolePermissionsQueryKey = (roleId) => {
|
|
620
|
+
return [`/access-control/roles/${roleId}/permissions`];
|
|
621
|
+
};
|
|
622
|
+
const getListRolePermissionsQueryOptions = (roleId, options) => {
|
|
623
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
624
|
+
const queryKey = queryOptions?.queryKey ?? getListRolePermissionsQueryKey(roleId);
|
|
625
|
+
const queryFn = ({ signal }) => listRolePermissions(roleId, {
|
|
626
|
+
signal,
|
|
627
|
+
...requestOptions
|
|
628
|
+
});
|
|
629
|
+
return {
|
|
630
|
+
queryKey,
|
|
631
|
+
queryFn,
|
|
632
|
+
enabled: roleId !== null && roleId !== void 0,
|
|
633
|
+
...queryOptions
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* @summary List role permissions
|
|
638
|
+
*/
|
|
639
|
+
function useListRolePermissions(roleId, options, queryClient) {
|
|
640
|
+
const queryOptions = getListRolePermissionsQueryOptions(roleId, options);
|
|
641
|
+
const query = useQuery(queryOptions, queryClient);
|
|
642
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
643
|
+
}
|
|
644
|
+
const getReplaceRolePermissionsUrl = (roleId) => {
|
|
645
|
+
return `/access-control/roles/${roleId}/permissions`;
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* Replaces all permissions assigned to a role with a new set.
|
|
649
|
+
* @summary Replace role permissions
|
|
650
|
+
*/
|
|
651
|
+
const replaceRolePermissions = async (roleId, replaceRolePermissionsRequest, options) => {
|
|
652
|
+
return customFetch(getReplaceRolePermissionsUrl(roleId), {
|
|
653
|
+
...options,
|
|
654
|
+
method: "PUT",
|
|
655
|
+
headers: {
|
|
656
|
+
"Content-Type": "application/json",
|
|
657
|
+
...options?.headers
|
|
658
|
+
},
|
|
659
|
+
body: JSON.stringify(replaceRolePermissionsRequest)
|
|
660
|
+
});
|
|
661
|
+
};
|
|
662
|
+
const getReplaceRolePermissionsMutationOptions = (options) => {
|
|
663
|
+
const mutationKey = ["replaceRolePermissions"];
|
|
664
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
665
|
+
...options,
|
|
666
|
+
mutation: {
|
|
667
|
+
...options.mutation,
|
|
668
|
+
mutationKey
|
|
669
|
+
}
|
|
670
|
+
} : {
|
|
671
|
+
mutation: { mutationKey },
|
|
672
|
+
request: void 0
|
|
673
|
+
};
|
|
674
|
+
const mutationFn = (props) => {
|
|
675
|
+
const { roleId, data } = props ?? {};
|
|
676
|
+
return replaceRolePermissions(roleId, data, requestOptions);
|
|
677
|
+
};
|
|
678
|
+
return {
|
|
679
|
+
mutationFn,
|
|
680
|
+
...mutationOptions
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
/**
|
|
684
|
+
* @summary Replace role permissions
|
|
685
|
+
*/
|
|
686
|
+
const useReplaceRolePermissions = (options, queryClient) => {
|
|
687
|
+
return useMutation(getReplaceRolePermissionsMutationOptions(options), queryClient);
|
|
688
|
+
};
|
|
689
|
+
const getAddRolePermissionUrl = (roleId) => {
|
|
690
|
+
return `/access-control/roles/${roleId}/permissions`;
|
|
691
|
+
};
|
|
692
|
+
/**
|
|
693
|
+
* Assigns a permission to a role.
|
|
694
|
+
* @summary Assign permission to role
|
|
695
|
+
*/
|
|
696
|
+
const addRolePermission = async (roleId, addRolePermissionRequest, options) => {
|
|
697
|
+
return customFetch(getAddRolePermissionUrl(roleId), {
|
|
698
|
+
...options,
|
|
699
|
+
method: "POST",
|
|
700
|
+
headers: {
|
|
701
|
+
"Content-Type": "application/json",
|
|
702
|
+
...options?.headers
|
|
703
|
+
},
|
|
704
|
+
body: JSON.stringify(addRolePermissionRequest)
|
|
705
|
+
});
|
|
706
|
+
};
|
|
707
|
+
const getAddRolePermissionMutationOptions = (options) => {
|
|
708
|
+
const mutationKey = ["addRolePermission"];
|
|
709
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
710
|
+
...options,
|
|
711
|
+
mutation: {
|
|
712
|
+
...options.mutation,
|
|
713
|
+
mutationKey
|
|
714
|
+
}
|
|
715
|
+
} : {
|
|
716
|
+
mutation: { mutationKey },
|
|
717
|
+
request: void 0
|
|
718
|
+
};
|
|
719
|
+
const mutationFn = (props) => {
|
|
720
|
+
const { roleId, data } = props ?? {};
|
|
721
|
+
return addRolePermission(roleId, data, requestOptions);
|
|
722
|
+
};
|
|
723
|
+
return {
|
|
724
|
+
mutationFn,
|
|
725
|
+
...mutationOptions
|
|
726
|
+
};
|
|
727
|
+
};
|
|
728
|
+
/**
|
|
729
|
+
* @summary Assign permission to role
|
|
730
|
+
*/
|
|
731
|
+
const useAddRolePermission = (options, queryClient) => {
|
|
732
|
+
return useMutation(getAddRolePermissionMutationOptions(options), queryClient);
|
|
733
|
+
};
|
|
734
|
+
const getRemoveRolePermissionUrl = (roleId, permissionId) => {
|
|
735
|
+
return `/access-control/roles/${roleId}/permissions/${permissionId}`;
|
|
736
|
+
};
|
|
737
|
+
/**
|
|
738
|
+
* Removes a permission from a role.
|
|
739
|
+
* @summary Remove role permission
|
|
740
|
+
*/
|
|
741
|
+
const removeRolePermission = async (roleId, permissionId, options) => {
|
|
742
|
+
return customFetch(getRemoveRolePermissionUrl(roleId, permissionId), {
|
|
743
|
+
...options,
|
|
744
|
+
method: "DELETE"
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
const getRemoveRolePermissionMutationOptions = (options) => {
|
|
748
|
+
const mutationKey = ["removeRolePermission"];
|
|
749
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
750
|
+
...options,
|
|
751
|
+
mutation: {
|
|
752
|
+
...options.mutation,
|
|
753
|
+
mutationKey
|
|
754
|
+
}
|
|
755
|
+
} : {
|
|
756
|
+
mutation: { mutationKey },
|
|
757
|
+
request: void 0
|
|
758
|
+
};
|
|
759
|
+
const mutationFn = (props) => {
|
|
760
|
+
const { roleId, permissionId } = props ?? {};
|
|
761
|
+
return removeRolePermission(roleId, permissionId, requestOptions);
|
|
762
|
+
};
|
|
763
|
+
return {
|
|
764
|
+
mutationFn,
|
|
765
|
+
...mutationOptions
|
|
766
|
+
};
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* @summary Remove role permission
|
|
770
|
+
*/
|
|
771
|
+
const useRemoveRolePermission = (options, queryClient) => {
|
|
772
|
+
return useMutation(getRemoveRolePermissionMutationOptions(options), queryClient);
|
|
773
|
+
};
|
|
774
|
+
const getGetUserPermissionsUrl = (userId) => {
|
|
775
|
+
return `/access-control/users/${userId}/permissions`;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Retrieves all permissions granted to a user through their roles.
|
|
779
|
+
* @summary Get user permissions
|
|
780
|
+
*/
|
|
781
|
+
const getUserPermissions = async (userId, options) => {
|
|
782
|
+
return customFetch(getGetUserPermissionsUrl(userId), {
|
|
783
|
+
...options,
|
|
784
|
+
method: "GET"
|
|
785
|
+
});
|
|
786
|
+
};
|
|
787
|
+
const getGetUserPermissionsQueryKey = (userId) => {
|
|
788
|
+
return [`/access-control/users/${userId}/permissions`];
|
|
789
|
+
};
|
|
790
|
+
const getGetUserPermissionsQueryOptions = (userId, options) => {
|
|
791
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
792
|
+
const queryKey = queryOptions?.queryKey ?? getGetUserPermissionsQueryKey(userId);
|
|
793
|
+
const queryFn = ({ signal }) => getUserPermissions(userId, {
|
|
794
|
+
signal,
|
|
795
|
+
...requestOptions
|
|
796
|
+
});
|
|
797
|
+
return {
|
|
798
|
+
queryKey,
|
|
799
|
+
queryFn,
|
|
800
|
+
enabled: userId !== null && userId !== void 0,
|
|
801
|
+
...queryOptions
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* @summary Get user permissions
|
|
806
|
+
*/
|
|
807
|
+
function useGetUserPermissions(userId, options, queryClient) {
|
|
808
|
+
const queryOptions = getGetUserPermissionsQueryOptions(userId, options);
|
|
809
|
+
const query = useQuery(queryOptions, queryClient);
|
|
810
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
811
|
+
}
|
|
812
|
+
const getCheckUserPermissionsUrl = (userId) => {
|
|
813
|
+
return `/access-control/users/${userId}/permissions/check`;
|
|
814
|
+
};
|
|
815
|
+
/**
|
|
816
|
+
* Checks whether a user has all the specified permissions.
|
|
817
|
+
* @summary Check user permissions
|
|
818
|
+
*/
|
|
819
|
+
const checkUserPermissions = async (userId, checkUserPermissionsRequest, options) => {
|
|
820
|
+
return customFetch(getCheckUserPermissionsUrl(userId), {
|
|
821
|
+
...options,
|
|
822
|
+
method: "POST",
|
|
823
|
+
headers: {
|
|
824
|
+
"Content-Type": "application/json",
|
|
825
|
+
...options?.headers
|
|
826
|
+
},
|
|
827
|
+
body: JSON.stringify(checkUserPermissionsRequest)
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
const getCheckUserPermissionsMutationOptions = (options) => {
|
|
831
|
+
const mutationKey = ["checkUserPermissions"];
|
|
832
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
833
|
+
...options,
|
|
834
|
+
mutation: {
|
|
835
|
+
...options.mutation,
|
|
836
|
+
mutationKey
|
|
837
|
+
}
|
|
838
|
+
} : {
|
|
839
|
+
mutation: { mutationKey },
|
|
840
|
+
request: void 0
|
|
841
|
+
};
|
|
842
|
+
const mutationFn = (props) => {
|
|
843
|
+
const { userId, data } = props ?? {};
|
|
844
|
+
return checkUserPermissions(userId, data, requestOptions);
|
|
845
|
+
};
|
|
846
|
+
return {
|
|
847
|
+
mutationFn,
|
|
848
|
+
...mutationOptions
|
|
849
|
+
};
|
|
850
|
+
};
|
|
851
|
+
/**
|
|
852
|
+
* @summary Check user permissions
|
|
853
|
+
*/
|
|
854
|
+
const useCheckUserPermissions = (options, queryClient) => {
|
|
855
|
+
return useMutation(getCheckUserPermissionsMutationOptions(options), queryClient);
|
|
856
|
+
};
|
|
857
|
+
const getListUserRolesUrl = (userId) => {
|
|
858
|
+
return `/access-control/users/${userId}/roles`;
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* Lists all roles assigned to a user.
|
|
862
|
+
* @summary List user roles
|
|
863
|
+
*/
|
|
864
|
+
const listUserRoles = async (userId, options) => {
|
|
865
|
+
return customFetch(getListUserRolesUrl(userId), {
|
|
866
|
+
...options,
|
|
867
|
+
method: "GET"
|
|
868
|
+
});
|
|
869
|
+
};
|
|
870
|
+
const getListUserRolesQueryKey = (userId) => {
|
|
871
|
+
return [`/access-control/users/${userId}/roles`];
|
|
872
|
+
};
|
|
873
|
+
const getListUserRolesQueryOptions = (userId, options) => {
|
|
874
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
875
|
+
const queryKey = queryOptions?.queryKey ?? getListUserRolesQueryKey(userId);
|
|
876
|
+
const queryFn = ({ signal }) => listUserRoles(userId, {
|
|
877
|
+
signal,
|
|
878
|
+
...requestOptions
|
|
879
|
+
});
|
|
880
|
+
return {
|
|
881
|
+
queryKey,
|
|
882
|
+
queryFn,
|
|
883
|
+
enabled: userId !== null && userId !== void 0,
|
|
884
|
+
...queryOptions
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* @summary List user roles
|
|
889
|
+
*/
|
|
890
|
+
function useListUserRoles(userId, options, queryClient) {
|
|
891
|
+
const queryOptions = getListUserRolesQueryOptions(userId, options);
|
|
892
|
+
const query = useQuery(queryOptions, queryClient);
|
|
893
|
+
return withQueryKey$13(query, queryOptions.queryKey);
|
|
894
|
+
}
|
|
895
|
+
const getReplaceUserRolesUrl = (userId) => {
|
|
896
|
+
return `/access-control/users/${userId}/roles`;
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* Replaces all roles assigned to a user with a new set.
|
|
900
|
+
* @summary Replace user roles
|
|
901
|
+
*/
|
|
902
|
+
const replaceUserRoles = async (userId, replaceUserRolesRequest, options) => {
|
|
903
|
+
return customFetch(getReplaceUserRolesUrl(userId), {
|
|
904
|
+
...options,
|
|
905
|
+
method: "PUT",
|
|
906
|
+
headers: {
|
|
907
|
+
"Content-Type": "application/json",
|
|
908
|
+
...options?.headers
|
|
909
|
+
},
|
|
910
|
+
body: JSON.stringify(replaceUserRolesRequest)
|
|
911
|
+
});
|
|
912
|
+
};
|
|
913
|
+
const getReplaceUserRolesMutationOptions = (options) => {
|
|
914
|
+
const mutationKey = ["replaceUserRoles"];
|
|
915
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
916
|
+
...options,
|
|
917
|
+
mutation: {
|
|
918
|
+
...options.mutation,
|
|
919
|
+
mutationKey
|
|
920
|
+
}
|
|
921
|
+
} : {
|
|
922
|
+
mutation: { mutationKey },
|
|
923
|
+
request: void 0
|
|
924
|
+
};
|
|
925
|
+
const mutationFn = (props) => {
|
|
926
|
+
const { userId, data } = props ?? {};
|
|
927
|
+
return replaceUserRoles(userId, data, requestOptions);
|
|
928
|
+
};
|
|
929
|
+
return {
|
|
930
|
+
mutationFn,
|
|
931
|
+
...mutationOptions
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* @summary Replace user roles
|
|
936
|
+
*/
|
|
937
|
+
const useReplaceUserRoles = (options, queryClient) => {
|
|
938
|
+
return useMutation(getReplaceUserRolesMutationOptions(options), queryClient);
|
|
939
|
+
};
|
|
940
|
+
const getAssignUserRoleUrl = (userId) => {
|
|
941
|
+
return `/access-control/users/${userId}/roles`;
|
|
942
|
+
};
|
|
943
|
+
/**
|
|
944
|
+
* Assigns a role to a user.
|
|
945
|
+
* @summary Assign role to user
|
|
946
|
+
*/
|
|
947
|
+
const assignUserRole = async (userId, assignUserRoleRequest, options) => {
|
|
948
|
+
return customFetch(getAssignUserRoleUrl(userId), {
|
|
949
|
+
...options,
|
|
950
|
+
method: "POST",
|
|
951
|
+
headers: {
|
|
952
|
+
"Content-Type": "application/json",
|
|
953
|
+
...options?.headers
|
|
954
|
+
},
|
|
955
|
+
body: JSON.stringify(assignUserRoleRequest)
|
|
956
|
+
});
|
|
957
|
+
};
|
|
958
|
+
const getAssignUserRoleMutationOptions = (options) => {
|
|
959
|
+
const mutationKey = ["assignUserRole"];
|
|
960
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
961
|
+
...options,
|
|
962
|
+
mutation: {
|
|
963
|
+
...options.mutation,
|
|
964
|
+
mutationKey
|
|
965
|
+
}
|
|
966
|
+
} : {
|
|
967
|
+
mutation: { mutationKey },
|
|
968
|
+
request: void 0
|
|
969
|
+
};
|
|
970
|
+
const mutationFn = (props) => {
|
|
971
|
+
const { userId, data } = props ?? {};
|
|
972
|
+
return assignUserRole(userId, data, requestOptions);
|
|
973
|
+
};
|
|
974
|
+
return {
|
|
975
|
+
mutationFn,
|
|
976
|
+
...mutationOptions
|
|
977
|
+
};
|
|
978
|
+
};
|
|
979
|
+
/**
|
|
980
|
+
* @summary Assign role to user
|
|
981
|
+
*/
|
|
982
|
+
const useAssignUserRole = (options, queryClient) => {
|
|
983
|
+
return useMutation(getAssignUserRoleMutationOptions(options), queryClient);
|
|
984
|
+
};
|
|
985
|
+
const getRemoveUserRoleUrl = (userId, roleId) => {
|
|
986
|
+
return `/access-control/users/${userId}/roles/${roleId}`;
|
|
987
|
+
};
|
|
988
|
+
/**
|
|
989
|
+
* Removes a role from a user.
|
|
990
|
+
* @summary Remove user role
|
|
991
|
+
*/
|
|
992
|
+
const removeUserRole = async (userId, roleId, options) => {
|
|
993
|
+
return customFetch(getRemoveUserRoleUrl(userId, roleId), {
|
|
994
|
+
...options,
|
|
995
|
+
method: "DELETE"
|
|
996
|
+
});
|
|
997
|
+
};
|
|
998
|
+
const getRemoveUserRoleMutationOptions = (options) => {
|
|
999
|
+
const mutationKey = ["removeUserRole"];
|
|
1000
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1001
|
+
...options,
|
|
1002
|
+
mutation: {
|
|
1003
|
+
...options.mutation,
|
|
1004
|
+
mutationKey
|
|
1005
|
+
}
|
|
1006
|
+
} : {
|
|
1007
|
+
mutation: { mutationKey },
|
|
1008
|
+
request: void 0
|
|
1009
|
+
};
|
|
1010
|
+
const mutationFn = (props) => {
|
|
1011
|
+
const { userId, roleId } = props ?? {};
|
|
1012
|
+
return removeUserRole(userId, roleId, requestOptions);
|
|
1013
|
+
};
|
|
1014
|
+
return {
|
|
1015
|
+
mutationFn,
|
|
1016
|
+
...mutationOptions
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
/**
|
|
1020
|
+
* @summary Remove user role
|
|
1021
|
+
*/
|
|
1022
|
+
const useRemoveUserRole = (options, queryClient) => {
|
|
1023
|
+
return useMutation(getRemoveUserRoleMutationOptions(options), queryClient);
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
//#endregion
|
|
5
1027
|
//#region src/plugins/access-control/plugin.ts
|
|
6
1028
|
var AccessControlPlugin = class {
|
|
7
1029
|
id = "accessControl";
|
|
8
1030
|
constructor() {}
|
|
9
1031
|
init(client) {
|
|
10
|
-
return
|
|
11
|
-
createRole: async (data) => {
|
|
12
|
-
return wrappedFetch(client, `/access-control/roles`, {
|
|
13
|
-
method: "POST",
|
|
14
|
-
body: data
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
getAllRoles: async () => {
|
|
18
|
-
return wrappedFetch(client, `/access-control/roles`, { method: "GET" });
|
|
19
|
-
},
|
|
20
|
-
getRoleByName: async (roleName) => {
|
|
21
|
-
return wrappedFetch(client, `/access-control/roles/by-name/${roleName}`, { method: "GET" });
|
|
22
|
-
},
|
|
23
|
-
getRoleById: async (roleId) => {
|
|
24
|
-
return wrappedFetch(client, `/access-control/roles/${roleId}`, { method: "GET" });
|
|
25
|
-
},
|
|
26
|
-
updateRole: async (roleId, data) => {
|
|
27
|
-
return wrappedFetch(client, `/access-control/roles/${roleId}`, {
|
|
28
|
-
method: "PATCH",
|
|
29
|
-
body: data
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
deleteRole: async (roleId) => {
|
|
33
|
-
return wrappedFetch(client, `/access-control/roles/${roleId}`, { method: "DELETE" });
|
|
34
|
-
},
|
|
35
|
-
createPermission: async (data) => {
|
|
36
|
-
return wrappedFetch(client, `/access-control/permissions`, {
|
|
37
|
-
method: "POST",
|
|
38
|
-
body: data
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
getAllPermissions: async () => {
|
|
42
|
-
return wrappedFetch(client, `/access-control/permissions`, { method: "GET" });
|
|
43
|
-
},
|
|
44
|
-
getPermissionById: async (permissionId) => {
|
|
45
|
-
return wrappedFetch(client, `/access-control/permissions/${permissionId}`, { method: "GET" });
|
|
46
|
-
},
|
|
47
|
-
updatePermission: async (permissionId, data) => {
|
|
48
|
-
return wrappedFetch(client, `/access-control/permissions/${permissionId}`, {
|
|
49
|
-
method: "PATCH",
|
|
50
|
-
body: data
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
deletePermission: async (permissionId) => {
|
|
54
|
-
return wrappedFetch(client, `/access-control/permissions/${permissionId}`, { method: "DELETE" });
|
|
55
|
-
},
|
|
56
|
-
addRolePermission: async (roleId, data) => {
|
|
57
|
-
return wrappedFetch(client, `/access-control/roles/${roleId}/permissions`, {
|
|
58
|
-
method: "POST",
|
|
59
|
-
body: data
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
getRolePermissions: async (roleId) => {
|
|
63
|
-
return wrappedFetch(client, `/access-control/roles/${roleId}/permissions`, { method: "GET" });
|
|
64
|
-
},
|
|
65
|
-
replaceRolePermissions: async (roleId, data) => {
|
|
66
|
-
return wrappedFetch(client, `/access-control/roles/${roleId}/permissions`, {
|
|
67
|
-
method: "PUT",
|
|
68
|
-
body: data
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
removeRolePermission: async (roleId, permissionId) => {
|
|
72
|
-
return wrappedFetch(client, `/access-control/roles/${roleId}/permissions/${permissionId}`, { method: "DELETE" });
|
|
73
|
-
},
|
|
74
|
-
getUserRoles: async (userId) => {
|
|
75
|
-
return wrappedFetch(client, `/access-control/users/${userId}/roles`, { method: "GET" });
|
|
76
|
-
},
|
|
77
|
-
assignUserRole: async (userId, data) => {
|
|
78
|
-
return wrappedFetch(client, `/access-control/users/${userId}/roles`, {
|
|
79
|
-
method: "POST",
|
|
80
|
-
body: data
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
replaceUserRoles: async (userId, data) => {
|
|
84
|
-
return wrappedFetch(client, `/access-control/users/${userId}/roles`, {
|
|
85
|
-
method: "PUT",
|
|
86
|
-
body: data
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
removeUserRole: async (userId, roleId) => {
|
|
90
|
-
return wrappedFetch(client, `/access-control/users/${userId}/roles/${roleId}`, { method: "DELETE" });
|
|
91
|
-
},
|
|
92
|
-
getUserPermissions: async (userId) => {
|
|
93
|
-
return wrappedFetch(client, `/access-control/users/${userId}/permissions`, { method: "GET" });
|
|
94
|
-
},
|
|
95
|
-
checkUserPermissions: async (userId, data) => {
|
|
96
|
-
return wrappedFetch(client, `/access-control/users/${userId}/permissions/check`, {
|
|
97
|
-
method: "POST",
|
|
98
|
-
body: data
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
};
|
|
1032
|
+
return wrapGenerated(access_control_exports, client);
|
|
102
1033
|
}
|
|
103
1034
|
};
|
|
104
1035
|
|
|
105
1036
|
//#endregion
|
|
106
|
-
//#region src/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
1037
|
+
//#region src/gen/endpoints/admin-accounts/admin-accounts.ts
|
|
1038
|
+
var admin_accounts_exports = /* @__PURE__ */ __exportAll({
|
|
1039
|
+
createAccount: () => createAccount,
|
|
1040
|
+
deleteAccount: () => deleteAccount,
|
|
1041
|
+
getAccount: () => getAccount,
|
|
1042
|
+
getCreateAccountMutationOptions: () => getCreateAccountMutationOptions,
|
|
1043
|
+
getCreateAccountUrl: () => getCreateAccountUrl,
|
|
1044
|
+
getDeleteAccountMutationOptions: () => getDeleteAccountMutationOptions,
|
|
1045
|
+
getDeleteAccountUrl: () => getDeleteAccountUrl,
|
|
1046
|
+
getGetAccountQueryKey: () => getGetAccountQueryKey,
|
|
1047
|
+
getGetAccountQueryOptions: () => getGetAccountQueryOptions,
|
|
1048
|
+
getGetAccountUrl: () => getGetAccountUrl,
|
|
1049
|
+
getListUserAccountsQueryKey: () => getListUserAccountsQueryKey,
|
|
1050
|
+
getListUserAccountsQueryOptions: () => getListUserAccountsQueryOptions,
|
|
1051
|
+
getListUserAccountsUrl: () => getListUserAccountsUrl,
|
|
1052
|
+
getUpdateAccountMutationOptions: () => getUpdateAccountMutationOptions,
|
|
1053
|
+
getUpdateAccountUrl: () => getUpdateAccountUrl,
|
|
1054
|
+
listUserAccounts: () => listUserAccounts,
|
|
1055
|
+
updateAccount: () => updateAccount,
|
|
1056
|
+
useCreateAccount: () => useCreateAccount,
|
|
1057
|
+
useDeleteAccount: () => useDeleteAccount,
|
|
1058
|
+
useGetAccount: () => useGetAccount,
|
|
1059
|
+
useListUserAccounts: () => useListUserAccounts,
|
|
1060
|
+
useUpdateAccount: () => useUpdateAccount
|
|
115
1061
|
});
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
key
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
1062
|
+
const withQueryKey$12 = (query, queryKey) => {
|
|
1063
|
+
const result = { queryKey };
|
|
1064
|
+
for (const key of Object.keys(query)) {
|
|
1065
|
+
if (key === "queryKey") continue;
|
|
1066
|
+
Object.defineProperty(result, key, {
|
|
1067
|
+
enumerable: true,
|
|
1068
|
+
configurable: true,
|
|
1069
|
+
get: () => query[key]
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
return result;
|
|
1073
|
+
};
|
|
1074
|
+
const getGetAccountUrl = (id) => {
|
|
1075
|
+
return `/admin/accounts/${id}`;
|
|
1076
|
+
};
|
|
1077
|
+
/**
|
|
1078
|
+
* Retrieves an account by its ID.
|
|
1079
|
+
* @summary Get account by ID
|
|
1080
|
+
*/
|
|
1081
|
+
const getAccount = async (id, options) => {
|
|
1082
|
+
return customFetch(getGetAccountUrl(id), {
|
|
1083
|
+
...options,
|
|
1084
|
+
method: "GET"
|
|
1085
|
+
});
|
|
1086
|
+
};
|
|
1087
|
+
const getGetAccountQueryKey = (id) => {
|
|
1088
|
+
return [`/admin/accounts/${id}`];
|
|
1089
|
+
};
|
|
1090
|
+
const getGetAccountQueryOptions = (id, options) => {
|
|
1091
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1092
|
+
const queryKey = queryOptions?.queryKey ?? getGetAccountQueryKey(id);
|
|
1093
|
+
const queryFn = ({ signal }) => getAccount(id, {
|
|
1094
|
+
signal,
|
|
1095
|
+
...requestOptions
|
|
1096
|
+
});
|
|
1097
|
+
return {
|
|
1098
|
+
queryKey,
|
|
1099
|
+
queryFn,
|
|
1100
|
+
enabled: id !== null && id !== void 0,
|
|
1101
|
+
...queryOptions
|
|
1102
|
+
};
|
|
1103
|
+
};
|
|
1104
|
+
/**
|
|
1105
|
+
* @summary Get account by ID
|
|
1106
|
+
*/
|
|
1107
|
+
function useGetAccount(id, options, queryClient) {
|
|
1108
|
+
const queryOptions = getGetAccountQueryOptions(id, options);
|
|
1109
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1110
|
+
return withQueryKey$12(query, queryOptions.queryKey);
|
|
1111
|
+
}
|
|
1112
|
+
const getDeleteAccountUrl = (id) => {
|
|
1113
|
+
return `/admin/accounts/${id}`;
|
|
1114
|
+
};
|
|
1115
|
+
/**
|
|
1116
|
+
* Deletes an account.
|
|
1117
|
+
* @summary Delete account
|
|
1118
|
+
*/
|
|
1119
|
+
const deleteAccount = async (id, options) => {
|
|
1120
|
+
return customFetch(getDeleteAccountUrl(id), {
|
|
1121
|
+
...options,
|
|
1122
|
+
method: "DELETE"
|
|
1123
|
+
});
|
|
1124
|
+
};
|
|
1125
|
+
const getDeleteAccountMutationOptions = (options) => {
|
|
1126
|
+
const mutationKey = ["deleteAccount"];
|
|
1127
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1128
|
+
...options,
|
|
1129
|
+
mutation: {
|
|
1130
|
+
...options.mutation,
|
|
1131
|
+
mutationKey
|
|
1132
|
+
}
|
|
1133
|
+
} : {
|
|
1134
|
+
mutation: { mutationKey },
|
|
1135
|
+
request: void 0
|
|
1136
|
+
};
|
|
1137
|
+
const mutationFn = (props) => {
|
|
1138
|
+
const { id } = props ?? {};
|
|
1139
|
+
return deleteAccount(id, requestOptions);
|
|
1140
|
+
};
|
|
1141
|
+
return {
|
|
1142
|
+
mutationFn,
|
|
1143
|
+
...mutationOptions
|
|
1144
|
+
};
|
|
1145
|
+
};
|
|
1146
|
+
/**
|
|
1147
|
+
* @summary Delete account
|
|
1148
|
+
*/
|
|
1149
|
+
const useDeleteAccount = (options, queryClient) => {
|
|
1150
|
+
return useMutation(getDeleteAccountMutationOptions(options), queryClient);
|
|
1151
|
+
};
|
|
1152
|
+
const getUpdateAccountUrl = (id) => {
|
|
1153
|
+
return `/admin/accounts/${id}`;
|
|
1154
|
+
};
|
|
1155
|
+
/**
|
|
1156
|
+
* Updates an account's attributes.
|
|
1157
|
+
* @summary Update account
|
|
1158
|
+
*/
|
|
1159
|
+
const updateAccount = async (id, updateAccountRequest, options) => {
|
|
1160
|
+
return customFetch(getUpdateAccountUrl(id), {
|
|
1161
|
+
...options,
|
|
1162
|
+
method: "PATCH",
|
|
1163
|
+
headers: {
|
|
1164
|
+
"Content-Type": "application/json",
|
|
1165
|
+
...options?.headers
|
|
1166
|
+
},
|
|
1167
|
+
body: JSON.stringify(updateAccountRequest)
|
|
1168
|
+
});
|
|
1169
|
+
};
|
|
1170
|
+
const getUpdateAccountMutationOptions = (options) => {
|
|
1171
|
+
const mutationKey = ["updateAccount"];
|
|
1172
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1173
|
+
...options,
|
|
1174
|
+
mutation: {
|
|
1175
|
+
...options.mutation,
|
|
1176
|
+
mutationKey
|
|
1177
|
+
}
|
|
1178
|
+
} : {
|
|
1179
|
+
mutation: { mutationKey },
|
|
1180
|
+
request: void 0
|
|
1181
|
+
};
|
|
1182
|
+
const mutationFn = (props) => {
|
|
1183
|
+
const { id, data } = props ?? {};
|
|
1184
|
+
return updateAccount(id, data, requestOptions);
|
|
1185
|
+
};
|
|
1186
|
+
return {
|
|
1187
|
+
mutationFn,
|
|
1188
|
+
...mutationOptions
|
|
1189
|
+
};
|
|
1190
|
+
};
|
|
1191
|
+
/**
|
|
1192
|
+
* @summary Update account
|
|
1193
|
+
*/
|
|
1194
|
+
const useUpdateAccount = (options, queryClient) => {
|
|
1195
|
+
return useMutation(getUpdateAccountMutationOptions(options), queryClient);
|
|
1196
|
+
};
|
|
1197
|
+
const getListUserAccountsUrl = (userId) => {
|
|
1198
|
+
return `/admin/users/${userId}/accounts`;
|
|
1199
|
+
};
|
|
1200
|
+
/**
|
|
1201
|
+
* Lists all accounts for a user.
|
|
1202
|
+
* @summary List user accounts
|
|
1203
|
+
*/
|
|
1204
|
+
const listUserAccounts = async (userId, options) => {
|
|
1205
|
+
return customFetch(getListUserAccountsUrl(userId), {
|
|
1206
|
+
...options,
|
|
1207
|
+
method: "GET"
|
|
1208
|
+
});
|
|
1209
|
+
};
|
|
1210
|
+
const getListUserAccountsQueryKey = (userId) => {
|
|
1211
|
+
return [`/admin/users/${userId}/accounts`];
|
|
1212
|
+
};
|
|
1213
|
+
const getListUserAccountsQueryOptions = (userId, options) => {
|
|
1214
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1215
|
+
const queryKey = queryOptions?.queryKey ?? getListUserAccountsQueryKey(userId);
|
|
1216
|
+
const queryFn = ({ signal }) => listUserAccounts(userId, {
|
|
1217
|
+
signal,
|
|
1218
|
+
...requestOptions
|
|
1219
|
+
});
|
|
1220
|
+
return {
|
|
1221
|
+
queryKey,
|
|
1222
|
+
queryFn,
|
|
1223
|
+
enabled: userId !== null && userId !== void 0,
|
|
1224
|
+
...queryOptions
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
/**
|
|
1228
|
+
* @summary List user accounts
|
|
1229
|
+
*/
|
|
1230
|
+
function useListUserAccounts(userId, options, queryClient) {
|
|
1231
|
+
const queryOptions = getListUserAccountsQueryOptions(userId, options);
|
|
1232
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1233
|
+
return withQueryKey$12(query, queryOptions.queryKey);
|
|
1234
|
+
}
|
|
1235
|
+
const getCreateAccountUrl = (userId) => {
|
|
1236
|
+
return `/admin/users/${userId}/accounts`;
|
|
1237
|
+
};
|
|
1238
|
+
/**
|
|
1239
|
+
* Creates a new account for a user.
|
|
1240
|
+
* @summary Create account
|
|
1241
|
+
*/
|
|
1242
|
+
const createAccount = async (userId, createAccountRequest, options) => {
|
|
1243
|
+
return customFetch(getCreateAccountUrl(userId), {
|
|
1244
|
+
...options,
|
|
1245
|
+
method: "POST",
|
|
1246
|
+
headers: {
|
|
1247
|
+
"Content-Type": "application/json",
|
|
1248
|
+
...options?.headers
|
|
1249
|
+
},
|
|
1250
|
+
body: JSON.stringify(createAccountRequest)
|
|
1251
|
+
});
|
|
1252
|
+
};
|
|
1253
|
+
const getCreateAccountMutationOptions = (options) => {
|
|
1254
|
+
const mutationKey = ["createAccount"];
|
|
1255
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1256
|
+
...options,
|
|
1257
|
+
mutation: {
|
|
1258
|
+
...options.mutation,
|
|
1259
|
+
mutationKey
|
|
1260
|
+
}
|
|
1261
|
+
} : {
|
|
1262
|
+
mutation: { mutationKey },
|
|
1263
|
+
request: void 0
|
|
1264
|
+
};
|
|
1265
|
+
const mutationFn = (props) => {
|
|
1266
|
+
const { userId, data } = props ?? {};
|
|
1267
|
+
return createAccount(userId, data, requestOptions);
|
|
1268
|
+
};
|
|
1269
|
+
return {
|
|
1270
|
+
mutationFn,
|
|
1271
|
+
...mutationOptions
|
|
1272
|
+
};
|
|
1273
|
+
};
|
|
1274
|
+
/**
|
|
1275
|
+
* @summary Create account
|
|
1276
|
+
*/
|
|
1277
|
+
const useCreateAccount = (options, queryClient) => {
|
|
1278
|
+
return useMutation(getCreateAccountMutationOptions(options), queryClient);
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/gen/endpoints/admin-impersonation/admin-impersonation.ts
|
|
1283
|
+
var admin_impersonation_exports = /* @__PURE__ */ __exportAll({
|
|
1284
|
+
getGetImpersonationQueryKey: () => getGetImpersonationQueryKey,
|
|
1285
|
+
getGetImpersonationQueryOptions: () => getGetImpersonationQueryOptions,
|
|
1286
|
+
getGetImpersonationUrl: () => getGetImpersonationUrl,
|
|
1287
|
+
getImpersonation: () => getImpersonation,
|
|
1288
|
+
getListImpersonationsQueryKey: () => getListImpersonationsQueryKey,
|
|
1289
|
+
getListImpersonationsQueryOptions: () => getListImpersonationsQueryOptions,
|
|
1290
|
+
getListImpersonationsUrl: () => getListImpersonationsUrl,
|
|
1291
|
+
getStartImpersonationMutationOptions: () => getStartImpersonationMutationOptions,
|
|
1292
|
+
getStartImpersonationUrl: () => getStartImpersonationUrl,
|
|
1293
|
+
getStopImpersonationMutationOptions: () => getStopImpersonationMutationOptions,
|
|
1294
|
+
getStopImpersonationUrl: () => getStopImpersonationUrl,
|
|
1295
|
+
listImpersonations: () => listImpersonations,
|
|
1296
|
+
startImpersonation: () => startImpersonation,
|
|
1297
|
+
stopImpersonation: () => stopImpersonation,
|
|
1298
|
+
useGetImpersonation: () => useGetImpersonation,
|
|
1299
|
+
useListImpersonations: () => useListImpersonations,
|
|
1300
|
+
useStartImpersonation: () => useStartImpersonation,
|
|
1301
|
+
useStopImpersonation: () => useStopImpersonation
|
|
129
1302
|
});
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1303
|
+
const withQueryKey$11 = (query, queryKey) => {
|
|
1304
|
+
const result = { queryKey };
|
|
1305
|
+
for (const key of Object.keys(query)) {
|
|
1306
|
+
if (key === "queryKey") continue;
|
|
1307
|
+
Object.defineProperty(result, key, {
|
|
1308
|
+
enumerable: true,
|
|
1309
|
+
configurable: true,
|
|
1310
|
+
get: () => query[key]
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
return result;
|
|
1314
|
+
};
|
|
1315
|
+
const getListImpersonationsUrl = () => {
|
|
1316
|
+
return `/admin/impersonations`;
|
|
1317
|
+
};
|
|
1318
|
+
/**
|
|
1319
|
+
* Lists all impersonations.
|
|
1320
|
+
* @summary List impersonations
|
|
1321
|
+
*/
|
|
1322
|
+
const listImpersonations = async (options) => {
|
|
1323
|
+
return customFetch(getListImpersonationsUrl(), {
|
|
1324
|
+
...options,
|
|
1325
|
+
method: "GET"
|
|
1326
|
+
});
|
|
1327
|
+
};
|
|
1328
|
+
const getListImpersonationsQueryKey = () => {
|
|
1329
|
+
return [`/admin/impersonations`];
|
|
1330
|
+
};
|
|
1331
|
+
const getListImpersonationsQueryOptions = (options) => {
|
|
1332
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1333
|
+
const queryKey = queryOptions?.queryKey ?? getListImpersonationsQueryKey();
|
|
1334
|
+
const queryFn = ({ signal }) => listImpersonations({
|
|
1335
|
+
signal,
|
|
1336
|
+
...requestOptions
|
|
1337
|
+
});
|
|
1338
|
+
return {
|
|
1339
|
+
queryKey,
|
|
1340
|
+
queryFn,
|
|
1341
|
+
...queryOptions
|
|
1342
|
+
};
|
|
1343
|
+
};
|
|
1344
|
+
/**
|
|
1345
|
+
* @summary List impersonations
|
|
1346
|
+
*/
|
|
1347
|
+
function useListImpersonations(options, queryClient) {
|
|
1348
|
+
const queryOptions = getListImpersonationsQueryOptions(options);
|
|
1349
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1350
|
+
return withQueryKey$11(query, queryOptions.queryKey);
|
|
1351
|
+
}
|
|
1352
|
+
const getStartImpersonationUrl = () => {
|
|
1353
|
+
return `/admin/impersonations`;
|
|
1354
|
+
};
|
|
1355
|
+
/**
|
|
1356
|
+
* Starts an impersonation session as a target user.
|
|
1357
|
+
* @summary Start impersonation
|
|
1358
|
+
*/
|
|
1359
|
+
const startImpersonation = async (startImpersonationRequest, options) => {
|
|
1360
|
+
return customFetch(getStartImpersonationUrl(), {
|
|
1361
|
+
...options,
|
|
1362
|
+
method: "POST",
|
|
1363
|
+
headers: {
|
|
1364
|
+
"Content-Type": "application/json",
|
|
1365
|
+
...options?.headers
|
|
1366
|
+
},
|
|
1367
|
+
body: JSON.stringify(startImpersonationRequest)
|
|
1368
|
+
});
|
|
1369
|
+
};
|
|
1370
|
+
const getStartImpersonationMutationOptions = (options) => {
|
|
1371
|
+
const mutationKey = ["startImpersonation"];
|
|
1372
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1373
|
+
...options,
|
|
1374
|
+
mutation: {
|
|
1375
|
+
...options.mutation,
|
|
1376
|
+
mutationKey
|
|
1377
|
+
}
|
|
1378
|
+
} : {
|
|
1379
|
+
mutation: { mutationKey },
|
|
1380
|
+
request: void 0
|
|
1381
|
+
};
|
|
1382
|
+
const mutationFn = (props) => {
|
|
1383
|
+
const { data } = props ?? {};
|
|
1384
|
+
return startImpersonation(data, requestOptions);
|
|
1385
|
+
};
|
|
1386
|
+
return {
|
|
1387
|
+
mutationFn,
|
|
1388
|
+
...mutationOptions
|
|
1389
|
+
};
|
|
1390
|
+
};
|
|
1391
|
+
/**
|
|
1392
|
+
* @summary Start impersonation
|
|
1393
|
+
*/
|
|
1394
|
+
const useStartImpersonation = (options, queryClient) => {
|
|
1395
|
+
return useMutation(getStartImpersonationMutationOptions(options), queryClient);
|
|
1396
|
+
};
|
|
1397
|
+
const getGetImpersonationUrl = (impersonationId) => {
|
|
1398
|
+
return `/admin/impersonations/${impersonationId}`;
|
|
1399
|
+
};
|
|
1400
|
+
/**
|
|
1401
|
+
* Retrieves an impersonation by its ID.
|
|
1402
|
+
* @summary Get impersonation by ID
|
|
1403
|
+
*/
|
|
1404
|
+
const getImpersonation = async (impersonationId, options) => {
|
|
1405
|
+
return customFetch(getGetImpersonationUrl(impersonationId), {
|
|
1406
|
+
...options,
|
|
1407
|
+
method: "GET"
|
|
1408
|
+
});
|
|
1409
|
+
};
|
|
1410
|
+
const getGetImpersonationQueryKey = (impersonationId) => {
|
|
1411
|
+
return [`/admin/impersonations/${impersonationId}`];
|
|
1412
|
+
};
|
|
1413
|
+
const getGetImpersonationQueryOptions = (impersonationId, options) => {
|
|
1414
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1415
|
+
const queryKey = queryOptions?.queryKey ?? getGetImpersonationQueryKey(impersonationId);
|
|
1416
|
+
const queryFn = ({ signal }) => getImpersonation(impersonationId, {
|
|
1417
|
+
signal,
|
|
1418
|
+
...requestOptions
|
|
1419
|
+
});
|
|
1420
|
+
return {
|
|
1421
|
+
queryKey,
|
|
1422
|
+
queryFn,
|
|
1423
|
+
enabled: impersonationId !== null && impersonationId !== void 0,
|
|
1424
|
+
...queryOptions
|
|
1425
|
+
};
|
|
1426
|
+
};
|
|
1427
|
+
/**
|
|
1428
|
+
* @summary Get impersonation by ID
|
|
1429
|
+
*/
|
|
1430
|
+
function useGetImpersonation(impersonationId, options, queryClient) {
|
|
1431
|
+
const queryOptions = getGetImpersonationQueryOptions(impersonationId, options);
|
|
1432
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1433
|
+
return withQueryKey$11(query, queryOptions.queryKey);
|
|
1434
|
+
}
|
|
1435
|
+
const getStopImpersonationUrl = (impersonationId) => {
|
|
1436
|
+
return `/admin/impersonations/${impersonationId}/stop`;
|
|
1437
|
+
};
|
|
1438
|
+
/**
|
|
1439
|
+
* Stops an impersonation session and restores the original session.
|
|
1440
|
+
* @summary Stop impersonation
|
|
1441
|
+
*/
|
|
1442
|
+
const stopImpersonation = async (impersonationId, options) => {
|
|
1443
|
+
return customFetch(getStopImpersonationUrl(impersonationId), {
|
|
1444
|
+
...options,
|
|
1445
|
+
method: "POST"
|
|
1446
|
+
});
|
|
1447
|
+
};
|
|
1448
|
+
const getStopImpersonationMutationOptions = (options) => {
|
|
1449
|
+
const mutationKey = ["stopImpersonation"];
|
|
1450
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1451
|
+
...options,
|
|
1452
|
+
mutation: {
|
|
1453
|
+
...options.mutation,
|
|
1454
|
+
mutationKey
|
|
1455
|
+
}
|
|
1456
|
+
} : {
|
|
1457
|
+
mutation: { mutationKey },
|
|
1458
|
+
request: void 0
|
|
1459
|
+
};
|
|
1460
|
+
const mutationFn = (props) => {
|
|
1461
|
+
const { impersonationId } = props ?? {};
|
|
1462
|
+
return stopImpersonation(impersonationId, requestOptions);
|
|
1463
|
+
};
|
|
1464
|
+
return {
|
|
1465
|
+
mutationFn,
|
|
1466
|
+
...mutationOptions
|
|
1467
|
+
};
|
|
1468
|
+
};
|
|
1469
|
+
/**
|
|
1470
|
+
* @summary Stop impersonation
|
|
1471
|
+
*/
|
|
1472
|
+
const useStopImpersonation = (options, queryClient) => {
|
|
1473
|
+
return useMutation(getStopImpersonationMutationOptions(options), queryClient);
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
//#endregion
|
|
1477
|
+
//#region src/gen/endpoints/admin-session-state/admin-session-state.ts
|
|
1478
|
+
var admin_session_state_exports = /* @__PURE__ */ __exportAll({
|
|
1479
|
+
createSessionState: () => createSessionState,
|
|
1480
|
+
deleteSessionState: () => deleteSessionState,
|
|
1481
|
+
getCreateSessionStateMutationOptions: () => getCreateSessionStateMutationOptions,
|
|
1482
|
+
getCreateSessionStateUrl: () => getCreateSessionStateUrl,
|
|
1483
|
+
getDeleteSessionStateMutationOptions: () => getDeleteSessionStateMutationOptions,
|
|
1484
|
+
getDeleteSessionStateUrl: () => getDeleteSessionStateUrl,
|
|
1485
|
+
getGetSessionStateQueryKey: () => getGetSessionStateQueryKey,
|
|
1486
|
+
getGetSessionStateQueryOptions: () => getGetSessionStateQueryOptions,
|
|
1487
|
+
getGetSessionStateUrl: () => getGetSessionStateUrl,
|
|
1488
|
+
getListRevokedSessionStatesQueryKey: () => getListRevokedSessionStatesQueryKey,
|
|
1489
|
+
getListRevokedSessionStatesQueryOptions: () => getListRevokedSessionStatesQueryOptions,
|
|
1490
|
+
getListRevokedSessionStatesUrl: () => getListRevokedSessionStatesUrl,
|
|
1491
|
+
getRevokeSessionMutationOptions: () => getRevokeSessionMutationOptions,
|
|
1492
|
+
getRevokeSessionUrl: () => getRevokeSessionUrl,
|
|
1493
|
+
getSessionState: () => getSessionState,
|
|
1494
|
+
getUpdateSessionStateMutationOptions: () => getUpdateSessionStateMutationOptions,
|
|
1495
|
+
getUpdateSessionStateUrl: () => getUpdateSessionStateUrl,
|
|
1496
|
+
listRevokedSessionStates: () => listRevokedSessionStates,
|
|
1497
|
+
revokeSession: () => revokeSession,
|
|
1498
|
+
updateSessionState: () => updateSessionState,
|
|
1499
|
+
useCreateSessionState: () => useCreateSessionState,
|
|
1500
|
+
useDeleteSessionState: () => useDeleteSessionState,
|
|
1501
|
+
useGetSessionState: () => useGetSessionState,
|
|
1502
|
+
useListRevokedSessionStates: () => useListRevokedSessionStates,
|
|
1503
|
+
useRevokeSession: () => useRevokeSession,
|
|
1504
|
+
useUpdateSessionState: () => useUpdateSessionState
|
|
137
1505
|
});
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
1506
|
+
const withQueryKey$10 = (query, queryKey) => {
|
|
1507
|
+
const result = { queryKey };
|
|
1508
|
+
for (const key of Object.keys(query)) {
|
|
1509
|
+
if (key === "queryKey") continue;
|
|
1510
|
+
Object.defineProperty(result, key, {
|
|
1511
|
+
enumerable: true,
|
|
1512
|
+
configurable: true,
|
|
1513
|
+
get: () => query[key]
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
return result;
|
|
1517
|
+
};
|
|
1518
|
+
const getListRevokedSessionStatesUrl = () => {
|
|
1519
|
+
return `/admin/sessions/states/revoked`;
|
|
1520
|
+
};
|
|
1521
|
+
/**
|
|
1522
|
+
* Lists all revoked session states.
|
|
1523
|
+
* @summary List revoked session states
|
|
1524
|
+
*/
|
|
1525
|
+
const listRevokedSessionStates = async (options) => {
|
|
1526
|
+
return customFetch(getListRevokedSessionStatesUrl(), {
|
|
1527
|
+
...options,
|
|
1528
|
+
method: "GET"
|
|
1529
|
+
});
|
|
1530
|
+
};
|
|
1531
|
+
const getListRevokedSessionStatesQueryKey = () => {
|
|
1532
|
+
return [`/admin/sessions/states/revoked`];
|
|
1533
|
+
};
|
|
1534
|
+
const getListRevokedSessionStatesQueryOptions = (options) => {
|
|
1535
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1536
|
+
const queryKey = queryOptions?.queryKey ?? getListRevokedSessionStatesQueryKey();
|
|
1537
|
+
const queryFn = ({ signal }) => listRevokedSessionStates({
|
|
1538
|
+
signal,
|
|
1539
|
+
...requestOptions
|
|
1540
|
+
});
|
|
1541
|
+
return {
|
|
1542
|
+
queryKey,
|
|
1543
|
+
queryFn,
|
|
1544
|
+
...queryOptions
|
|
1545
|
+
};
|
|
1546
|
+
};
|
|
1547
|
+
/**
|
|
1548
|
+
* @summary List revoked session states
|
|
1549
|
+
*/
|
|
1550
|
+
function useListRevokedSessionStates(options, queryClient) {
|
|
1551
|
+
const queryOptions = getListRevokedSessionStatesQueryOptions(options);
|
|
1552
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1553
|
+
return withQueryKey$10(query, queryOptions.queryKey);
|
|
1554
|
+
}
|
|
1555
|
+
const getRevokeSessionUrl = (sessionId) => {
|
|
1556
|
+
return `/admin/sessions/${sessionId}/revoke`;
|
|
1557
|
+
};
|
|
1558
|
+
/**
|
|
1559
|
+
* Revokes a session.
|
|
1560
|
+
* @summary Revoke session
|
|
1561
|
+
*/
|
|
1562
|
+
const revokeSession = async (sessionId, revokeSessionRequest, options) => {
|
|
1563
|
+
return customFetch(getRevokeSessionUrl(sessionId), {
|
|
1564
|
+
...options,
|
|
1565
|
+
method: "POST",
|
|
1566
|
+
headers: {
|
|
1567
|
+
"Content-Type": "application/json",
|
|
1568
|
+
...options?.headers
|
|
1569
|
+
},
|
|
1570
|
+
body: JSON.stringify(revokeSessionRequest)
|
|
1571
|
+
});
|
|
1572
|
+
};
|
|
1573
|
+
const getRevokeSessionMutationOptions = (options) => {
|
|
1574
|
+
const mutationKey = ["revokeSession"];
|
|
1575
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1576
|
+
...options,
|
|
1577
|
+
mutation: {
|
|
1578
|
+
...options.mutation,
|
|
1579
|
+
mutationKey
|
|
1580
|
+
}
|
|
1581
|
+
} : {
|
|
1582
|
+
mutation: { mutationKey },
|
|
1583
|
+
request: void 0
|
|
1584
|
+
};
|
|
1585
|
+
const mutationFn = (props) => {
|
|
1586
|
+
const { sessionId, data } = props ?? {};
|
|
1587
|
+
return revokeSession(sessionId, data, requestOptions);
|
|
1588
|
+
};
|
|
1589
|
+
return {
|
|
1590
|
+
mutationFn,
|
|
1591
|
+
...mutationOptions
|
|
1592
|
+
};
|
|
1593
|
+
};
|
|
1594
|
+
/**
|
|
1595
|
+
* @summary Revoke session
|
|
1596
|
+
*/
|
|
1597
|
+
const useRevokeSession = (options, queryClient) => {
|
|
1598
|
+
return useMutation(getRevokeSessionMutationOptions(options), queryClient);
|
|
1599
|
+
};
|
|
1600
|
+
const getGetSessionStateUrl = (sessionId) => {
|
|
1601
|
+
return `/admin/sessions/${sessionId}/state`;
|
|
1602
|
+
};
|
|
1603
|
+
/**
|
|
1604
|
+
* Retrieves the state of a session.
|
|
1605
|
+
* @summary Get session state
|
|
1606
|
+
*/
|
|
1607
|
+
const getSessionState = async (sessionId, options) => {
|
|
1608
|
+
return customFetch(getGetSessionStateUrl(sessionId), {
|
|
1609
|
+
...options,
|
|
1610
|
+
method: "GET"
|
|
1611
|
+
});
|
|
1612
|
+
};
|
|
1613
|
+
const getGetSessionStateQueryKey = (sessionId) => {
|
|
1614
|
+
return [`/admin/sessions/${sessionId}/state`];
|
|
1615
|
+
};
|
|
1616
|
+
const getGetSessionStateQueryOptions = (sessionId, options) => {
|
|
1617
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1618
|
+
const queryKey = queryOptions?.queryKey ?? getGetSessionStateQueryKey(sessionId);
|
|
1619
|
+
const queryFn = ({ signal }) => getSessionState(sessionId, {
|
|
1620
|
+
signal,
|
|
1621
|
+
...requestOptions
|
|
1622
|
+
});
|
|
1623
|
+
return {
|
|
1624
|
+
queryKey,
|
|
1625
|
+
queryFn,
|
|
1626
|
+
enabled: sessionId !== null && sessionId !== void 0,
|
|
1627
|
+
...queryOptions
|
|
1628
|
+
};
|
|
1629
|
+
};
|
|
1630
|
+
/**
|
|
1631
|
+
* @summary Get session state
|
|
1632
|
+
*/
|
|
1633
|
+
function useGetSessionState(sessionId, options, queryClient) {
|
|
1634
|
+
const queryOptions = getGetSessionStateQueryOptions(sessionId, options);
|
|
1635
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1636
|
+
return withQueryKey$10(query, queryOptions.queryKey);
|
|
1637
|
+
}
|
|
1638
|
+
const getCreateSessionStateUrl = (sessionId) => {
|
|
1639
|
+
return `/admin/sessions/${sessionId}/state`;
|
|
1640
|
+
};
|
|
1641
|
+
/**
|
|
1642
|
+
* Creates the state for a session.
|
|
1643
|
+
* @summary Create session state
|
|
1644
|
+
*/
|
|
1645
|
+
const createSessionState = async (sessionId, createSessionStateRequest, options) => {
|
|
1646
|
+
return customFetch(getCreateSessionStateUrl(sessionId), {
|
|
1647
|
+
...options,
|
|
1648
|
+
method: "POST",
|
|
1649
|
+
headers: {
|
|
1650
|
+
"Content-Type": "application/json",
|
|
1651
|
+
...options?.headers
|
|
1652
|
+
},
|
|
1653
|
+
body: JSON.stringify(createSessionStateRequest)
|
|
1654
|
+
});
|
|
1655
|
+
};
|
|
1656
|
+
const getCreateSessionStateMutationOptions = (options) => {
|
|
1657
|
+
const mutationKey = ["createSessionState"];
|
|
1658
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1659
|
+
...options,
|
|
1660
|
+
mutation: {
|
|
1661
|
+
...options.mutation,
|
|
1662
|
+
mutationKey
|
|
1663
|
+
}
|
|
1664
|
+
} : {
|
|
1665
|
+
mutation: { mutationKey },
|
|
1666
|
+
request: void 0
|
|
1667
|
+
};
|
|
1668
|
+
const mutationFn = (props) => {
|
|
1669
|
+
const { sessionId, data } = props ?? {};
|
|
1670
|
+
return createSessionState(sessionId, data, requestOptions);
|
|
1671
|
+
};
|
|
1672
|
+
return {
|
|
1673
|
+
mutationFn,
|
|
1674
|
+
...mutationOptions
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
/**
|
|
1678
|
+
* @summary Create session state
|
|
1679
|
+
*/
|
|
1680
|
+
const useCreateSessionState = (options, queryClient) => {
|
|
1681
|
+
return useMutation(getCreateSessionStateMutationOptions(options), queryClient);
|
|
1682
|
+
};
|
|
1683
|
+
const getDeleteSessionStateUrl = (sessionId) => {
|
|
1684
|
+
return `/admin/sessions/${sessionId}/state`;
|
|
1685
|
+
};
|
|
1686
|
+
/**
|
|
1687
|
+
* Deletes the state of a session.
|
|
1688
|
+
* @summary Delete session state
|
|
1689
|
+
*/
|
|
1690
|
+
const deleteSessionState = async (sessionId, options) => {
|
|
1691
|
+
return customFetch(getDeleteSessionStateUrl(sessionId), {
|
|
1692
|
+
...options,
|
|
1693
|
+
method: "DELETE"
|
|
1694
|
+
});
|
|
1695
|
+
};
|
|
1696
|
+
const getDeleteSessionStateMutationOptions = (options) => {
|
|
1697
|
+
const mutationKey = ["deleteSessionState"];
|
|
1698
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1699
|
+
...options,
|
|
1700
|
+
mutation: {
|
|
1701
|
+
...options.mutation,
|
|
1702
|
+
mutationKey
|
|
1703
|
+
}
|
|
1704
|
+
} : {
|
|
1705
|
+
mutation: { mutationKey },
|
|
1706
|
+
request: void 0
|
|
1707
|
+
};
|
|
1708
|
+
const mutationFn = (props) => {
|
|
1709
|
+
const { sessionId } = props ?? {};
|
|
1710
|
+
return deleteSessionState(sessionId, requestOptions);
|
|
1711
|
+
};
|
|
1712
|
+
return {
|
|
1713
|
+
mutationFn,
|
|
1714
|
+
...mutationOptions
|
|
1715
|
+
};
|
|
1716
|
+
};
|
|
1717
|
+
/**
|
|
1718
|
+
* @summary Delete session state
|
|
1719
|
+
*/
|
|
1720
|
+
const useDeleteSessionState = (options, queryClient) => {
|
|
1721
|
+
return useMutation(getDeleteSessionStateMutationOptions(options), queryClient);
|
|
1722
|
+
};
|
|
1723
|
+
const getUpdateSessionStateUrl = (sessionId) => {
|
|
1724
|
+
return `/admin/sessions/${sessionId}/state`;
|
|
1725
|
+
};
|
|
1726
|
+
/**
|
|
1727
|
+
* Updates the state of a session.
|
|
1728
|
+
* @summary Update session state
|
|
1729
|
+
*/
|
|
1730
|
+
const updateSessionState = async (sessionId, upsertSessionStateRequest, options) => {
|
|
1731
|
+
return customFetch(getUpdateSessionStateUrl(sessionId), {
|
|
1732
|
+
...options,
|
|
1733
|
+
method: "PATCH",
|
|
1734
|
+
headers: {
|
|
1735
|
+
"Content-Type": "application/json",
|
|
1736
|
+
...options?.headers
|
|
1737
|
+
},
|
|
1738
|
+
body: JSON.stringify(upsertSessionStateRequest)
|
|
1739
|
+
});
|
|
1740
|
+
};
|
|
1741
|
+
const getUpdateSessionStateMutationOptions = (options) => {
|
|
1742
|
+
const mutationKey = ["updateSessionState"];
|
|
1743
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1744
|
+
...options,
|
|
1745
|
+
mutation: {
|
|
1746
|
+
...options.mutation,
|
|
1747
|
+
mutationKey
|
|
1748
|
+
}
|
|
1749
|
+
} : {
|
|
1750
|
+
mutation: { mutationKey },
|
|
1751
|
+
request: void 0
|
|
1752
|
+
};
|
|
1753
|
+
const mutationFn = (props) => {
|
|
1754
|
+
const { sessionId, data } = props ?? {};
|
|
1755
|
+
return updateSessionState(sessionId, data, requestOptions);
|
|
1756
|
+
};
|
|
1757
|
+
return {
|
|
1758
|
+
mutationFn,
|
|
1759
|
+
...mutationOptions
|
|
1760
|
+
};
|
|
1761
|
+
};
|
|
1762
|
+
/**
|
|
1763
|
+
* @summary Update session state
|
|
1764
|
+
*/
|
|
1765
|
+
const useUpdateSessionState = (options, queryClient) => {
|
|
1766
|
+
return useMutation(getUpdateSessionStateMutationOptions(options), queryClient);
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
//#endregion
|
|
1770
|
+
//#region src/gen/endpoints/admin-user-state/admin-user-state.ts
|
|
1771
|
+
var admin_user_state_exports = /* @__PURE__ */ __exportAll({
|
|
1772
|
+
banUser: () => banUser,
|
|
1773
|
+
createUserState: () => createUserState,
|
|
1774
|
+
deleteUserState: () => deleteUserState,
|
|
1775
|
+
getBanUserMutationOptions: () => getBanUserMutationOptions,
|
|
1776
|
+
getBanUserUrl: () => getBanUserUrl,
|
|
1777
|
+
getCreateUserStateMutationOptions: () => getCreateUserStateMutationOptions,
|
|
1778
|
+
getCreateUserStateUrl: () => getCreateUserStateUrl,
|
|
1779
|
+
getDeleteUserStateMutationOptions: () => getDeleteUserStateMutationOptions,
|
|
1780
|
+
getDeleteUserStateUrl: () => getDeleteUserStateUrl,
|
|
1781
|
+
getGetUserStateQueryKey: () => getGetUserStateQueryKey,
|
|
1782
|
+
getGetUserStateQueryOptions: () => getGetUserStateQueryOptions,
|
|
1783
|
+
getGetUserStateUrl: () => getGetUserStateUrl,
|
|
1784
|
+
getListBannedUserStatesQueryKey: () => getListBannedUserStatesQueryKey,
|
|
1785
|
+
getListBannedUserStatesQueryOptions: () => getListBannedUserStatesQueryOptions,
|
|
1786
|
+
getListBannedUserStatesUrl: () => getListBannedUserStatesUrl,
|
|
1787
|
+
getListUserSessionsQueryKey: () => getListUserSessionsQueryKey,
|
|
1788
|
+
getListUserSessionsQueryOptions: () => getListUserSessionsQueryOptions,
|
|
1789
|
+
getListUserSessionsUrl: () => getListUserSessionsUrl,
|
|
1790
|
+
getUnbanUserMutationOptions: () => getUnbanUserMutationOptions,
|
|
1791
|
+
getUnbanUserUrl: () => getUnbanUserUrl,
|
|
1792
|
+
getUpdateUserStateMutationOptions: () => getUpdateUserStateMutationOptions,
|
|
1793
|
+
getUpdateUserStateUrl: () => getUpdateUserStateUrl,
|
|
1794
|
+
getUserState: () => getUserState,
|
|
1795
|
+
listBannedUserStates: () => listBannedUserStates,
|
|
1796
|
+
listUserSessions: () => listUserSessions,
|
|
1797
|
+
unbanUser: () => unbanUser,
|
|
1798
|
+
updateUserState: () => updateUserState,
|
|
1799
|
+
useBanUser: () => useBanUser,
|
|
1800
|
+
useCreateUserState: () => useCreateUserState,
|
|
1801
|
+
useDeleteUserState: () => useDeleteUserState,
|
|
1802
|
+
useGetUserState: () => useGetUserState,
|
|
1803
|
+
useListBannedUserStates: () => useListBannedUserStates,
|
|
1804
|
+
useListUserSessions: () => useListUserSessions,
|
|
1805
|
+
useUnbanUser: () => useUnbanUser,
|
|
1806
|
+
useUpdateUserState: () => useUpdateUserState
|
|
145
1807
|
});
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
1808
|
+
const withQueryKey$9 = (query, queryKey) => {
|
|
1809
|
+
const result = { queryKey };
|
|
1810
|
+
for (const key of Object.keys(query)) {
|
|
1811
|
+
if (key === "queryKey") continue;
|
|
1812
|
+
Object.defineProperty(result, key, {
|
|
1813
|
+
enumerable: true,
|
|
1814
|
+
configurable: true,
|
|
1815
|
+
get: () => query[key]
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
return result;
|
|
1819
|
+
};
|
|
1820
|
+
const getListBannedUserStatesUrl = () => {
|
|
1821
|
+
return `/admin/users/states/banned`;
|
|
1822
|
+
};
|
|
1823
|
+
/**
|
|
1824
|
+
* Lists all banned user states.
|
|
1825
|
+
* @summary List banned user states
|
|
1826
|
+
*/
|
|
1827
|
+
const listBannedUserStates = async (options) => {
|
|
1828
|
+
return customFetch(getListBannedUserStatesUrl(), {
|
|
1829
|
+
...options,
|
|
1830
|
+
method: "GET"
|
|
1831
|
+
});
|
|
1832
|
+
};
|
|
1833
|
+
const getListBannedUserStatesQueryKey = () => {
|
|
1834
|
+
return [`/admin/users/states/banned`];
|
|
1835
|
+
};
|
|
1836
|
+
const getListBannedUserStatesQueryOptions = (options) => {
|
|
1837
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1838
|
+
const queryKey = queryOptions?.queryKey ?? getListBannedUserStatesQueryKey();
|
|
1839
|
+
const queryFn = ({ signal }) => listBannedUserStates({
|
|
1840
|
+
signal,
|
|
1841
|
+
...requestOptions
|
|
1842
|
+
});
|
|
1843
|
+
return {
|
|
1844
|
+
queryKey,
|
|
1845
|
+
queryFn,
|
|
1846
|
+
...queryOptions
|
|
1847
|
+
};
|
|
1848
|
+
};
|
|
1849
|
+
/**
|
|
1850
|
+
* @summary List banned user states
|
|
1851
|
+
*/
|
|
1852
|
+
function useListBannedUserStates(options, queryClient) {
|
|
1853
|
+
const queryOptions = getListBannedUserStatesQueryOptions(options);
|
|
1854
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1855
|
+
return withQueryKey$9(query, queryOptions.queryKey);
|
|
1856
|
+
}
|
|
1857
|
+
const getBanUserUrl = (userId) => {
|
|
1858
|
+
return `/admin/users/${userId}/ban`;
|
|
1859
|
+
};
|
|
1860
|
+
/**
|
|
1861
|
+
* Bans a user.
|
|
1862
|
+
* @summary Ban user
|
|
1863
|
+
*/
|
|
1864
|
+
const banUser = async (userId, banUserRequest, options) => {
|
|
1865
|
+
return customFetch(getBanUserUrl(userId), {
|
|
1866
|
+
...options,
|
|
1867
|
+
method: "POST",
|
|
1868
|
+
headers: {
|
|
1869
|
+
"Content-Type": "application/json",
|
|
1870
|
+
...options?.headers
|
|
1871
|
+
},
|
|
1872
|
+
body: JSON.stringify(banUserRequest)
|
|
1873
|
+
});
|
|
1874
|
+
};
|
|
1875
|
+
const getBanUserMutationOptions = (options) => {
|
|
1876
|
+
const mutationKey = ["banUser"];
|
|
1877
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1878
|
+
...options,
|
|
1879
|
+
mutation: {
|
|
1880
|
+
...options.mutation,
|
|
1881
|
+
mutationKey
|
|
1882
|
+
}
|
|
1883
|
+
} : {
|
|
1884
|
+
mutation: { mutationKey },
|
|
1885
|
+
request: void 0
|
|
1886
|
+
};
|
|
1887
|
+
const mutationFn = (props) => {
|
|
1888
|
+
const { userId, data } = props ?? {};
|
|
1889
|
+
return banUser(userId, data, requestOptions);
|
|
1890
|
+
};
|
|
1891
|
+
return {
|
|
1892
|
+
mutationFn,
|
|
1893
|
+
...mutationOptions
|
|
1894
|
+
};
|
|
1895
|
+
};
|
|
1896
|
+
/**
|
|
1897
|
+
* @summary Ban user
|
|
1898
|
+
*/
|
|
1899
|
+
const useBanUser = (options, queryClient) => {
|
|
1900
|
+
return useMutation(getBanUserMutationOptions(options), queryClient);
|
|
1901
|
+
};
|
|
1902
|
+
const getListUserSessionsUrl = (userId) => {
|
|
1903
|
+
return `/admin/users/${userId}/sessions`;
|
|
1904
|
+
};
|
|
1905
|
+
/**
|
|
1906
|
+
* Lists all sessions for a user.
|
|
1907
|
+
* @summary List user sessions
|
|
1908
|
+
*/
|
|
1909
|
+
const listUserSessions = async (userId, options) => {
|
|
1910
|
+
return customFetch(getListUserSessionsUrl(userId), {
|
|
1911
|
+
...options,
|
|
1912
|
+
method: "GET"
|
|
1913
|
+
});
|
|
1914
|
+
};
|
|
1915
|
+
const getListUserSessionsQueryKey = (userId) => {
|
|
1916
|
+
return [`/admin/users/${userId}/sessions`];
|
|
1917
|
+
};
|
|
1918
|
+
const getListUserSessionsQueryOptions = (userId, options) => {
|
|
1919
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1920
|
+
const queryKey = queryOptions?.queryKey ?? getListUserSessionsQueryKey(userId);
|
|
1921
|
+
const queryFn = ({ signal }) => listUserSessions(userId, {
|
|
1922
|
+
signal,
|
|
1923
|
+
...requestOptions
|
|
1924
|
+
});
|
|
1925
|
+
return {
|
|
1926
|
+
queryKey,
|
|
1927
|
+
queryFn,
|
|
1928
|
+
enabled: userId !== null && userId !== void 0,
|
|
1929
|
+
...queryOptions
|
|
1930
|
+
};
|
|
1931
|
+
};
|
|
1932
|
+
/**
|
|
1933
|
+
* @summary List user sessions
|
|
1934
|
+
*/
|
|
1935
|
+
function useListUserSessions(userId, options, queryClient) {
|
|
1936
|
+
const queryOptions = getListUserSessionsQueryOptions(userId, options);
|
|
1937
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1938
|
+
return withQueryKey$9(query, queryOptions.queryKey);
|
|
1939
|
+
}
|
|
1940
|
+
const getGetUserStateUrl = (userId) => {
|
|
1941
|
+
return `/admin/users/${userId}/state`;
|
|
1942
|
+
};
|
|
1943
|
+
/**
|
|
1944
|
+
* Retrieves the state of a user.
|
|
1945
|
+
* @summary Get user state
|
|
1946
|
+
*/
|
|
1947
|
+
const getUserState = async (userId, options) => {
|
|
1948
|
+
return customFetch(getGetUserStateUrl(userId), {
|
|
1949
|
+
...options,
|
|
1950
|
+
method: "GET"
|
|
1951
|
+
});
|
|
1952
|
+
};
|
|
1953
|
+
const getGetUserStateQueryKey = (userId) => {
|
|
1954
|
+
return [`/admin/users/${userId}/state`];
|
|
1955
|
+
};
|
|
1956
|
+
const getGetUserStateQueryOptions = (userId, options) => {
|
|
1957
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1958
|
+
const queryKey = queryOptions?.queryKey ?? getGetUserStateQueryKey(userId);
|
|
1959
|
+
const queryFn = ({ signal }) => getUserState(userId, {
|
|
1960
|
+
signal,
|
|
1961
|
+
...requestOptions
|
|
1962
|
+
});
|
|
1963
|
+
return {
|
|
1964
|
+
queryKey,
|
|
1965
|
+
queryFn,
|
|
1966
|
+
enabled: userId !== null && userId !== void 0,
|
|
1967
|
+
...queryOptions
|
|
1968
|
+
};
|
|
1969
|
+
};
|
|
1970
|
+
/**
|
|
1971
|
+
* @summary Get user state
|
|
1972
|
+
*/
|
|
1973
|
+
function useGetUserState(userId, options, queryClient) {
|
|
1974
|
+
const queryOptions = getGetUserStateQueryOptions(userId, options);
|
|
1975
|
+
const query = useQuery(queryOptions, queryClient);
|
|
1976
|
+
return withQueryKey$9(query, queryOptions.queryKey);
|
|
1977
|
+
}
|
|
1978
|
+
const getCreateUserStateUrl = (userId) => {
|
|
1979
|
+
return `/admin/users/${userId}/state`;
|
|
1980
|
+
};
|
|
1981
|
+
/**
|
|
1982
|
+
* Creates the state for a user.
|
|
1983
|
+
* @summary Create user state
|
|
1984
|
+
*/
|
|
1985
|
+
const createUserState = async (userId, createUserStateRequest, options) => {
|
|
1986
|
+
return customFetch(getCreateUserStateUrl(userId), {
|
|
1987
|
+
...options,
|
|
1988
|
+
method: "POST",
|
|
1989
|
+
headers: {
|
|
1990
|
+
"Content-Type": "application/json",
|
|
1991
|
+
...options?.headers
|
|
1992
|
+
},
|
|
1993
|
+
body: JSON.stringify(createUserStateRequest)
|
|
1994
|
+
});
|
|
1995
|
+
};
|
|
1996
|
+
const getCreateUserStateMutationOptions = (options) => {
|
|
1997
|
+
const mutationKey = ["createUserState"];
|
|
1998
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
1999
|
+
...options,
|
|
2000
|
+
mutation: {
|
|
2001
|
+
...options.mutation,
|
|
2002
|
+
mutationKey
|
|
2003
|
+
}
|
|
2004
|
+
} : {
|
|
2005
|
+
mutation: { mutationKey },
|
|
2006
|
+
request: void 0
|
|
2007
|
+
};
|
|
2008
|
+
const mutationFn = (props) => {
|
|
2009
|
+
const { userId, data } = props ?? {};
|
|
2010
|
+
return createUserState(userId, data, requestOptions);
|
|
2011
|
+
};
|
|
2012
|
+
return {
|
|
2013
|
+
mutationFn,
|
|
2014
|
+
...mutationOptions
|
|
2015
|
+
};
|
|
2016
|
+
};
|
|
2017
|
+
/**
|
|
2018
|
+
* @summary Create user state
|
|
2019
|
+
*/
|
|
2020
|
+
const useCreateUserState = (options, queryClient) => {
|
|
2021
|
+
return useMutation(getCreateUserStateMutationOptions(options), queryClient);
|
|
2022
|
+
};
|
|
2023
|
+
const getDeleteUserStateUrl = (userId) => {
|
|
2024
|
+
return `/admin/users/${userId}/state`;
|
|
2025
|
+
};
|
|
2026
|
+
/**
|
|
2027
|
+
* Deletes the state of a user.
|
|
2028
|
+
* @summary Delete user state
|
|
2029
|
+
*/
|
|
2030
|
+
const deleteUserState = async (userId, options) => {
|
|
2031
|
+
return customFetch(getDeleteUserStateUrl(userId), {
|
|
2032
|
+
...options,
|
|
2033
|
+
method: "DELETE"
|
|
2034
|
+
});
|
|
2035
|
+
};
|
|
2036
|
+
const getDeleteUserStateMutationOptions = (options) => {
|
|
2037
|
+
const mutationKey = ["deleteUserState"];
|
|
2038
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2039
|
+
...options,
|
|
2040
|
+
mutation: {
|
|
2041
|
+
...options.mutation,
|
|
2042
|
+
mutationKey
|
|
2043
|
+
}
|
|
2044
|
+
} : {
|
|
2045
|
+
mutation: { mutationKey },
|
|
2046
|
+
request: void 0
|
|
2047
|
+
};
|
|
2048
|
+
const mutationFn = (props) => {
|
|
2049
|
+
const { userId } = props ?? {};
|
|
2050
|
+
return deleteUserState(userId, requestOptions);
|
|
2051
|
+
};
|
|
2052
|
+
return {
|
|
2053
|
+
mutationFn,
|
|
2054
|
+
...mutationOptions
|
|
2055
|
+
};
|
|
2056
|
+
};
|
|
2057
|
+
/**
|
|
2058
|
+
* @summary Delete user state
|
|
2059
|
+
*/
|
|
2060
|
+
const useDeleteUserState = (options, queryClient) => {
|
|
2061
|
+
return useMutation(getDeleteUserStateMutationOptions(options), queryClient);
|
|
2062
|
+
};
|
|
2063
|
+
const getUpdateUserStateUrl = (userId) => {
|
|
2064
|
+
return `/admin/users/${userId}/state`;
|
|
2065
|
+
};
|
|
2066
|
+
/**
|
|
2067
|
+
* Updates the state of a user.
|
|
2068
|
+
* @summary Update user state
|
|
2069
|
+
*/
|
|
2070
|
+
const updateUserState = async (userId, upsertUserStateRequest, options) => {
|
|
2071
|
+
return customFetch(getUpdateUserStateUrl(userId), {
|
|
2072
|
+
...options,
|
|
2073
|
+
method: "PATCH",
|
|
2074
|
+
headers: {
|
|
2075
|
+
"Content-Type": "application/json",
|
|
2076
|
+
...options?.headers
|
|
2077
|
+
},
|
|
2078
|
+
body: JSON.stringify(upsertUserStateRequest)
|
|
2079
|
+
});
|
|
2080
|
+
};
|
|
2081
|
+
const getUpdateUserStateMutationOptions = (options) => {
|
|
2082
|
+
const mutationKey = ["updateUserState"];
|
|
2083
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2084
|
+
...options,
|
|
2085
|
+
mutation: {
|
|
2086
|
+
...options.mutation,
|
|
2087
|
+
mutationKey
|
|
2088
|
+
}
|
|
2089
|
+
} : {
|
|
2090
|
+
mutation: { mutationKey },
|
|
2091
|
+
request: void 0
|
|
2092
|
+
};
|
|
2093
|
+
const mutationFn = (props) => {
|
|
2094
|
+
const { userId, data } = props ?? {};
|
|
2095
|
+
return updateUserState(userId, data, requestOptions);
|
|
2096
|
+
};
|
|
2097
|
+
return {
|
|
2098
|
+
mutationFn,
|
|
2099
|
+
...mutationOptions
|
|
2100
|
+
};
|
|
2101
|
+
};
|
|
2102
|
+
/**
|
|
2103
|
+
* @summary Update user state
|
|
2104
|
+
*/
|
|
2105
|
+
const useUpdateUserState = (options, queryClient) => {
|
|
2106
|
+
return useMutation(getUpdateUserStateMutationOptions(options), queryClient);
|
|
2107
|
+
};
|
|
2108
|
+
const getUnbanUserUrl = (userId) => {
|
|
2109
|
+
return `/admin/users/${userId}/unban`;
|
|
2110
|
+
};
|
|
2111
|
+
/**
|
|
2112
|
+
* Unbans a user.
|
|
2113
|
+
* @summary Unban user
|
|
2114
|
+
*/
|
|
2115
|
+
const unbanUser = async (userId, options) => {
|
|
2116
|
+
return customFetch(getUnbanUserUrl(userId), {
|
|
2117
|
+
...options,
|
|
2118
|
+
method: "POST"
|
|
2119
|
+
});
|
|
2120
|
+
};
|
|
2121
|
+
const getUnbanUserMutationOptions = (options) => {
|
|
2122
|
+
const mutationKey = ["unbanUser"];
|
|
2123
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2124
|
+
...options,
|
|
2125
|
+
mutation: {
|
|
2126
|
+
...options.mutation,
|
|
2127
|
+
mutationKey
|
|
2128
|
+
}
|
|
2129
|
+
} : {
|
|
2130
|
+
mutation: { mutationKey },
|
|
2131
|
+
request: void 0
|
|
2132
|
+
};
|
|
2133
|
+
const mutationFn = (props) => {
|
|
2134
|
+
const { userId } = props ?? {};
|
|
2135
|
+
return unbanUser(userId, requestOptions);
|
|
2136
|
+
};
|
|
2137
|
+
return {
|
|
2138
|
+
mutationFn,
|
|
2139
|
+
...mutationOptions
|
|
2140
|
+
};
|
|
2141
|
+
};
|
|
2142
|
+
/**
|
|
2143
|
+
* @summary Unban user
|
|
2144
|
+
*/
|
|
2145
|
+
const useUnbanUser = (options, queryClient) => {
|
|
2146
|
+
return useMutation(getUnbanUserMutationOptions(options), queryClient);
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
//#endregion
|
|
2150
|
+
//#region src/gen/endpoints/admin-users/admin-users.ts
|
|
2151
|
+
var admin_users_exports = /* @__PURE__ */ __exportAll({
|
|
2152
|
+
createUser: () => createUser,
|
|
2153
|
+
deleteUser: () => deleteUser,
|
|
2154
|
+
getCreateUserMutationOptions: () => getCreateUserMutationOptions,
|
|
2155
|
+
getCreateUserUrl: () => getCreateUserUrl,
|
|
2156
|
+
getDeleteUserMutationOptions: () => getDeleteUserMutationOptions,
|
|
2157
|
+
getDeleteUserUrl: () => getDeleteUserUrl,
|
|
2158
|
+
getGetUserQueryKey: () => getGetUserQueryKey,
|
|
2159
|
+
getGetUserQueryOptions: () => getGetUserQueryOptions,
|
|
2160
|
+
getGetUserUrl: () => getGetUserUrl,
|
|
2161
|
+
getListUsersQueryKey: () => getListUsersQueryKey,
|
|
2162
|
+
getListUsersQueryOptions: () => getListUsersQueryOptions,
|
|
2163
|
+
getListUsersUrl: () => getListUsersUrl,
|
|
2164
|
+
getUpdateUserMutationOptions: () => getUpdateUserMutationOptions,
|
|
2165
|
+
getUpdateUserUrl: () => getUpdateUserUrl,
|
|
2166
|
+
getUser: () => getUser,
|
|
2167
|
+
listUsers: () => listUsers,
|
|
2168
|
+
updateUser: () => updateUser,
|
|
2169
|
+
useCreateUser: () => useCreateUser,
|
|
2170
|
+
useDeleteUser: () => useDeleteUser,
|
|
2171
|
+
useGetUser: () => useGetUser,
|
|
2172
|
+
useListUsers: () => useListUsers,
|
|
2173
|
+
useUpdateUser: () => useUpdateUser
|
|
149
2174
|
});
|
|
150
|
-
const
|
|
151
|
-
const
|
|
2175
|
+
const withQueryKey$8 = (query, queryKey) => {
|
|
2176
|
+
const result = { queryKey };
|
|
2177
|
+
for (const key of Object.keys(query)) {
|
|
2178
|
+
if (key === "queryKey") continue;
|
|
2179
|
+
Object.defineProperty(result, key, {
|
|
2180
|
+
enumerable: true,
|
|
2181
|
+
configurable: true,
|
|
2182
|
+
get: () => query[key]
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
return result;
|
|
2186
|
+
};
|
|
2187
|
+
const getListUsersUrl = (params) => {
|
|
2188
|
+
const normalizedParams = new URLSearchParams();
|
|
2189
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2190
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2191
|
+
});
|
|
2192
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2193
|
+
return stringifiedParams.length > 0 ? `/admin/users?${stringifiedParams}` : `/admin/users`;
|
|
2194
|
+
};
|
|
2195
|
+
/**
|
|
2196
|
+
* Lists users with cursor-based pagination.
|
|
2197
|
+
* @summary List users
|
|
2198
|
+
*/
|
|
2199
|
+
const listUsers = async (params, options) => {
|
|
2200
|
+
return customFetch(getListUsersUrl(params), {
|
|
2201
|
+
...options,
|
|
2202
|
+
method: "GET"
|
|
2203
|
+
});
|
|
2204
|
+
};
|
|
2205
|
+
const getListUsersQueryKey = (params) => {
|
|
2206
|
+
return [`/admin/users`, ...params ? [params] : []];
|
|
2207
|
+
};
|
|
2208
|
+
const getListUsersQueryOptions = (params, options) => {
|
|
2209
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
2210
|
+
const queryKey = queryOptions?.queryKey ?? getListUsersQueryKey(params);
|
|
2211
|
+
const queryFn = ({ signal }) => listUsers(params, {
|
|
2212
|
+
signal,
|
|
2213
|
+
...requestOptions
|
|
2214
|
+
});
|
|
2215
|
+
return {
|
|
2216
|
+
queryKey,
|
|
2217
|
+
queryFn,
|
|
2218
|
+
...queryOptions
|
|
2219
|
+
};
|
|
2220
|
+
};
|
|
2221
|
+
/**
|
|
2222
|
+
* @summary List users
|
|
2223
|
+
*/
|
|
2224
|
+
function useListUsers(params, options, queryClient) {
|
|
2225
|
+
const queryOptions = getListUsersQueryOptions(params, options);
|
|
2226
|
+
const query = useQuery(queryOptions, queryClient);
|
|
2227
|
+
return withQueryKey$8(query, queryOptions.queryKey);
|
|
2228
|
+
}
|
|
2229
|
+
const getCreateUserUrl = () => {
|
|
2230
|
+
return `/admin/users`;
|
|
2231
|
+
};
|
|
2232
|
+
/**
|
|
2233
|
+
* Creates a new user with the specified attributes.
|
|
2234
|
+
* @summary Create user
|
|
2235
|
+
*/
|
|
2236
|
+
const createUser = async (createUserRequest, options) => {
|
|
2237
|
+
return customFetch(getCreateUserUrl(), {
|
|
2238
|
+
...options,
|
|
2239
|
+
method: "POST",
|
|
2240
|
+
headers: {
|
|
2241
|
+
"Content-Type": "application/json",
|
|
2242
|
+
...options?.headers
|
|
2243
|
+
},
|
|
2244
|
+
body: JSON.stringify(createUserRequest)
|
|
2245
|
+
});
|
|
2246
|
+
};
|
|
2247
|
+
const getCreateUserMutationOptions = (options) => {
|
|
2248
|
+
const mutationKey = ["createUser"];
|
|
2249
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2250
|
+
...options,
|
|
2251
|
+
mutation: {
|
|
2252
|
+
...options.mutation,
|
|
2253
|
+
mutationKey
|
|
2254
|
+
}
|
|
2255
|
+
} : {
|
|
2256
|
+
mutation: { mutationKey },
|
|
2257
|
+
request: void 0
|
|
2258
|
+
};
|
|
2259
|
+
const mutationFn = (props) => {
|
|
2260
|
+
const { data } = props ?? {};
|
|
2261
|
+
return createUser(data, requestOptions);
|
|
2262
|
+
};
|
|
2263
|
+
return {
|
|
2264
|
+
mutationFn,
|
|
2265
|
+
...mutationOptions
|
|
2266
|
+
};
|
|
2267
|
+
};
|
|
2268
|
+
/**
|
|
2269
|
+
* @summary Create user
|
|
2270
|
+
*/
|
|
2271
|
+
const useCreateUser = (options, queryClient) => {
|
|
2272
|
+
return useMutation(getCreateUserMutationOptions(options), queryClient);
|
|
2273
|
+
};
|
|
2274
|
+
const getGetUserUrl = (userId) => {
|
|
2275
|
+
return `/admin/users/${userId}`;
|
|
2276
|
+
};
|
|
2277
|
+
/**
|
|
2278
|
+
* Retrieves a user by their ID.
|
|
2279
|
+
* @summary Get user by ID
|
|
2280
|
+
*/
|
|
2281
|
+
const getUser = async (userId, options) => {
|
|
2282
|
+
return customFetch(getGetUserUrl(userId), {
|
|
2283
|
+
...options,
|
|
2284
|
+
method: "GET"
|
|
2285
|
+
});
|
|
2286
|
+
};
|
|
2287
|
+
const getGetUserQueryKey = (userId) => {
|
|
2288
|
+
return [`/admin/users/${userId}`];
|
|
2289
|
+
};
|
|
2290
|
+
const getGetUserQueryOptions = (userId, options) => {
|
|
2291
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
2292
|
+
const queryKey = queryOptions?.queryKey ?? getGetUserQueryKey(userId);
|
|
2293
|
+
const queryFn = ({ signal }) => getUser(userId, {
|
|
2294
|
+
signal,
|
|
2295
|
+
...requestOptions
|
|
2296
|
+
});
|
|
2297
|
+
return {
|
|
2298
|
+
queryKey,
|
|
2299
|
+
queryFn,
|
|
2300
|
+
enabled: userId !== null && userId !== void 0,
|
|
2301
|
+
...queryOptions
|
|
2302
|
+
};
|
|
2303
|
+
};
|
|
2304
|
+
/**
|
|
2305
|
+
* @summary Get user by ID
|
|
2306
|
+
*/
|
|
2307
|
+
function useGetUser(userId, options, queryClient) {
|
|
2308
|
+
const queryOptions = getGetUserQueryOptions(userId, options);
|
|
2309
|
+
const query = useQuery(queryOptions, queryClient);
|
|
2310
|
+
return withQueryKey$8(query, queryOptions.queryKey);
|
|
2311
|
+
}
|
|
2312
|
+
const getDeleteUserUrl = (userId) => {
|
|
2313
|
+
return `/admin/users/${userId}`;
|
|
2314
|
+
};
|
|
2315
|
+
/**
|
|
2316
|
+
* Deletes a user.
|
|
2317
|
+
* @summary Delete user
|
|
2318
|
+
*/
|
|
2319
|
+
const deleteUser = async (userId, options) => {
|
|
2320
|
+
return customFetch(getDeleteUserUrl(userId), {
|
|
2321
|
+
...options,
|
|
2322
|
+
method: "DELETE"
|
|
2323
|
+
});
|
|
2324
|
+
};
|
|
2325
|
+
const getDeleteUserMutationOptions = (options) => {
|
|
2326
|
+
const mutationKey = ["deleteUser"];
|
|
2327
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2328
|
+
...options,
|
|
2329
|
+
mutation: {
|
|
2330
|
+
...options.mutation,
|
|
2331
|
+
mutationKey
|
|
2332
|
+
}
|
|
2333
|
+
} : {
|
|
2334
|
+
mutation: { mutationKey },
|
|
2335
|
+
request: void 0
|
|
2336
|
+
};
|
|
2337
|
+
const mutationFn = (props) => {
|
|
2338
|
+
const { userId } = props ?? {};
|
|
2339
|
+
return deleteUser(userId, requestOptions);
|
|
2340
|
+
};
|
|
2341
|
+
return {
|
|
2342
|
+
mutationFn,
|
|
2343
|
+
...mutationOptions
|
|
2344
|
+
};
|
|
2345
|
+
};
|
|
2346
|
+
/**
|
|
2347
|
+
* @summary Delete user
|
|
2348
|
+
*/
|
|
2349
|
+
const useDeleteUser = (options, queryClient) => {
|
|
2350
|
+
return useMutation(getDeleteUserMutationOptions(options), queryClient);
|
|
2351
|
+
};
|
|
2352
|
+
const getUpdateUserUrl = (userId) => {
|
|
2353
|
+
return `/admin/users/${userId}`;
|
|
2354
|
+
};
|
|
2355
|
+
/**
|
|
2356
|
+
* Updates a user's attributes.
|
|
2357
|
+
* @summary Update user
|
|
2358
|
+
*/
|
|
2359
|
+
const updateUser = async (userId, updateUserRequest, options) => {
|
|
2360
|
+
return customFetch(getUpdateUserUrl(userId), {
|
|
2361
|
+
...options,
|
|
2362
|
+
method: "PATCH",
|
|
2363
|
+
headers: {
|
|
2364
|
+
"Content-Type": "application/json",
|
|
2365
|
+
...options?.headers
|
|
2366
|
+
},
|
|
2367
|
+
body: JSON.stringify(updateUserRequest)
|
|
2368
|
+
});
|
|
2369
|
+
};
|
|
2370
|
+
const getUpdateUserMutationOptions = (options) => {
|
|
2371
|
+
const mutationKey = ["updateUser"];
|
|
2372
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2373
|
+
...options,
|
|
2374
|
+
mutation: {
|
|
2375
|
+
...options.mutation,
|
|
2376
|
+
mutationKey
|
|
2377
|
+
}
|
|
2378
|
+
} : {
|
|
2379
|
+
mutation: { mutationKey },
|
|
2380
|
+
request: void 0
|
|
2381
|
+
};
|
|
2382
|
+
const mutationFn = (props) => {
|
|
2383
|
+
const { userId, data } = props ?? {};
|
|
2384
|
+
return updateUser(userId, data, requestOptions);
|
|
2385
|
+
};
|
|
2386
|
+
return {
|
|
2387
|
+
mutationFn,
|
|
2388
|
+
...mutationOptions
|
|
2389
|
+
};
|
|
2390
|
+
};
|
|
2391
|
+
/**
|
|
2392
|
+
* @summary Update user
|
|
2393
|
+
*/
|
|
2394
|
+
const useUpdateUser = (options, queryClient) => {
|
|
2395
|
+
return useMutation(getUpdateUserMutationOptions(options), queryClient);
|
|
2396
|
+
};
|
|
152
2397
|
|
|
153
2398
|
//#endregion
|
|
154
2399
|
//#region src/plugins/admin/plugin.ts
|
|
@@ -157,170 +2402,322 @@ var AdminPlugin = class {
|
|
|
157
2402
|
constructor() {}
|
|
158
2403
|
init(client) {
|
|
159
2404
|
return {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
getAllUsers: async (limit) => {
|
|
167
|
-
const urlSearchParams = new URLSearchParams();
|
|
168
|
-
if (limit) urlSearchParams.append("limit", limit.toString());
|
|
169
|
-
return wrappedFetch(client, `/admin/users${urlSearchParams.toString() ? `?${urlSearchParams.toString()}` : ""}`, { method: "GET" });
|
|
170
|
-
},
|
|
171
|
-
getUserById: async (userId) => {
|
|
172
|
-
return wrappedFetch(client, `/admin/users/${userId}`, { method: "GET" });
|
|
173
|
-
},
|
|
174
|
-
updateUser: async (userId, data) => {
|
|
175
|
-
return wrappedFetch(client, `/admin/users/${userId}`, {
|
|
176
|
-
method: "PATCH",
|
|
177
|
-
body: data
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
deleteUser: async (userId) => {
|
|
181
|
-
return wrappedFetch(client, `/admin/users/${userId}`, { method: "DELETE" });
|
|
182
|
-
},
|
|
183
|
-
createAccount: async (userId, data) => {
|
|
184
|
-
return wrappedFetch(client, `/admin/users/${userId}/accounts`, {
|
|
185
|
-
method: "POST",
|
|
186
|
-
body: data
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
getUserAccounts: async (userId) => {
|
|
190
|
-
return wrappedFetch(client, `/admin/users/${userId}/accounts`, { method: "GET" });
|
|
191
|
-
},
|
|
192
|
-
getAccountById: async (id) => {
|
|
193
|
-
return wrappedFetch(client, `/admin/accounts/${id}`, { method: "GET" });
|
|
194
|
-
},
|
|
195
|
-
updateAccount: async (id, data) => {
|
|
196
|
-
return wrappedFetch(client, `/admin/accounts/${id}`, {
|
|
197
|
-
method: "PATCH",
|
|
198
|
-
body: data
|
|
199
|
-
});
|
|
200
|
-
},
|
|
201
|
-
deleteAccount: async (id) => {
|
|
202
|
-
return wrappedFetch(client, `/admin/accounts/${id}`, { method: "DELETE" });
|
|
203
|
-
},
|
|
204
|
-
getUserState: async (userId) => {
|
|
205
|
-
return wrappedFetch(client, `/admin/users/${userId}/state`, { method: "GET" });
|
|
206
|
-
},
|
|
207
|
-
createUserState: async (userId, data) => {
|
|
208
|
-
return wrappedFetch(client, `/admin/users/${userId}/state`, {
|
|
209
|
-
method: "POST",
|
|
210
|
-
body: data
|
|
211
|
-
});
|
|
212
|
-
},
|
|
213
|
-
updateUserState: async (userId, data) => {
|
|
214
|
-
return wrappedFetch(client, `/admin/users/${userId}/state`, {
|
|
215
|
-
method: "PATCH",
|
|
216
|
-
body: data
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
deleteUserState: async (userId) => {
|
|
220
|
-
return wrappedFetch(client, `/admin/users/${userId}/state`, { method: "DELETE" });
|
|
221
|
-
},
|
|
222
|
-
getBannedUserStates: async () => {
|
|
223
|
-
return wrappedFetch(client, `/admin/users/states/banned`, { method: "GET" });
|
|
224
|
-
},
|
|
225
|
-
banUser: async (userId, data) => {
|
|
226
|
-
return wrappedFetch(client, `/admin/users/${userId}/ban`, {
|
|
227
|
-
method: "POST",
|
|
228
|
-
body: data
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
unbanUser: async (userId) => {
|
|
232
|
-
return wrappedFetch(client, `/admin/users/${userId}/unban`, { method: "POST" });
|
|
233
|
-
},
|
|
234
|
-
getUserAdminSessions: async (userId) => {
|
|
235
|
-
return wrappedFetch(client, `/admin/users/${userId}/sessions`, { method: "GET" });
|
|
236
|
-
},
|
|
237
|
-
getSessionState: async (sessionId) => {
|
|
238
|
-
return wrappedFetch(client, `/admin/sessions/${sessionId}/state`, { method: "GET" });
|
|
239
|
-
},
|
|
240
|
-
createSessionState: async (sessionId, data) => {
|
|
241
|
-
return wrappedFetch(client, `/admin/sessions/${sessionId}/state`, {
|
|
242
|
-
method: "POST",
|
|
243
|
-
body: data
|
|
244
|
-
});
|
|
245
|
-
},
|
|
246
|
-
updateSessionState: async (sessionId, data) => {
|
|
247
|
-
return wrappedFetch(client, `/admin/sessions/${sessionId}/state`, {
|
|
248
|
-
method: "PATCH",
|
|
249
|
-
body: data
|
|
250
|
-
});
|
|
251
|
-
},
|
|
252
|
-
deleteSessionState: async (sessionId) => {
|
|
253
|
-
return wrappedFetch(client, `/admin/sessions/${sessionId}/state`, { method: "DELETE" });
|
|
254
|
-
},
|
|
255
|
-
getRevokedSessionStates: async () => {
|
|
256
|
-
return wrappedFetch(client, `/admin/sessions/states/revoked`, { method: "GET" });
|
|
257
|
-
},
|
|
258
|
-
revokeSession: async (sessionId, data) => {
|
|
259
|
-
return wrappedFetch(client, `/admin/sessions/${sessionId}/revoke`, {
|
|
260
|
-
method: "POST",
|
|
261
|
-
body: data
|
|
262
|
-
});
|
|
263
|
-
},
|
|
264
|
-
getAllImpersonations: async () => {
|
|
265
|
-
return wrappedFetch(client, "/admin/impersonations", { method: "GET" });
|
|
266
|
-
},
|
|
267
|
-
getImpersonationById: async (impersonationId) => {
|
|
268
|
-
return wrappedFetch(client, `/admin/impersonations/${impersonationId}`, { method: "GET" });
|
|
269
|
-
},
|
|
270
|
-
startImpersonation: async (data) => {
|
|
271
|
-
return wrappedFetch(client, "/admin/impersonations", {
|
|
272
|
-
method: "POST",
|
|
273
|
-
body: data
|
|
274
|
-
});
|
|
275
|
-
},
|
|
276
|
-
stopImpersonation: async (impersonationId) => {
|
|
277
|
-
return wrappedFetch(client, `/admin/impersonations/${impersonationId}/stop`, { method: "POST" });
|
|
278
|
-
}
|
|
2405
|
+
...wrapGenerated(admin_users_exports, client),
|
|
2406
|
+
...wrapGenerated(admin_accounts_exports, client),
|
|
2407
|
+
...wrapGenerated(admin_user_state_exports, client),
|
|
2408
|
+
...wrapGenerated(admin_session_state_exports, client),
|
|
2409
|
+
...wrapGenerated(admin_impersonation_exports, client)
|
|
279
2410
|
};
|
|
280
2411
|
}
|
|
281
2412
|
};
|
|
282
2413
|
|
|
283
2414
|
//#endregion
|
|
284
|
-
//#region src/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
actorUserId: z.string().nonempty(),
|
|
313
|
-
targetUserId: z.string().nonempty(),
|
|
314
|
-
actorSessionId: z.string().nullable(),
|
|
315
|
-
impersonationSessionId: z.string().nullable(),
|
|
316
|
-
reason: z.string().nonempty(),
|
|
317
|
-
startedAt: z.iso.datetime(),
|
|
318
|
-
expiresAt: z.iso.datetime(),
|
|
319
|
-
endedAt: z.iso.datetime().nullable(),
|
|
320
|
-
endedByUserId: z.string().nullable(),
|
|
321
|
-
createdAt: z.iso.datetime(),
|
|
322
|
-
updatedAt: z.iso.datetime()
|
|
2415
|
+
//#region src/gen/endpoints/api-keys/api-keys.ts
|
|
2416
|
+
var api_keys_exports = /* @__PURE__ */ __exportAll({
|
|
2417
|
+
createApiKey: () => createApiKey,
|
|
2418
|
+
deleteApiKey: () => deleteApiKey,
|
|
2419
|
+
getApiKey: () => getApiKey,
|
|
2420
|
+
getCreateApiKeyMutationOptions: () => getCreateApiKeyMutationOptions,
|
|
2421
|
+
getCreateApiKeyUrl: () => getCreateApiKeyUrl,
|
|
2422
|
+
getDeleteApiKeyMutationOptions: () => getDeleteApiKeyMutationOptions,
|
|
2423
|
+
getDeleteApiKeyUrl: () => getDeleteApiKeyUrl,
|
|
2424
|
+
getGetApiKeyQueryKey: () => getGetApiKeyQueryKey,
|
|
2425
|
+
getGetApiKeyQueryOptions: () => getGetApiKeyQueryOptions,
|
|
2426
|
+
getGetApiKeyUrl: () => getGetApiKeyUrl,
|
|
2427
|
+
getListApiKeysQueryKey: () => getListApiKeysQueryKey,
|
|
2428
|
+
getListApiKeysQueryOptions: () => getListApiKeysQueryOptions,
|
|
2429
|
+
getListApiKeysUrl: () => getListApiKeysUrl,
|
|
2430
|
+
getUpdateApiKeyMutationOptions: () => getUpdateApiKeyMutationOptions,
|
|
2431
|
+
getUpdateApiKeyUrl: () => getUpdateApiKeyUrl,
|
|
2432
|
+
getVerifyApiKeyMutationOptions: () => getVerifyApiKeyMutationOptions,
|
|
2433
|
+
getVerifyApiKeyUrl: () => getVerifyApiKeyUrl,
|
|
2434
|
+
listApiKeys: () => listApiKeys,
|
|
2435
|
+
updateApiKey: () => updateApiKey,
|
|
2436
|
+
useCreateApiKey: () => useCreateApiKey,
|
|
2437
|
+
useDeleteApiKey: () => useDeleteApiKey,
|
|
2438
|
+
useGetApiKey: () => useGetApiKey,
|
|
2439
|
+
useListApiKeys: () => useListApiKeys,
|
|
2440
|
+
useUpdateApiKey: () => useUpdateApiKey,
|
|
2441
|
+
useVerifyApiKey: () => useVerifyApiKey,
|
|
2442
|
+
verifyApiKey: () => verifyApiKey
|
|
323
2443
|
});
|
|
2444
|
+
const withQueryKey$7 = (query, queryKey) => {
|
|
2445
|
+
const result = { queryKey };
|
|
2446
|
+
for (const key of Object.keys(query)) {
|
|
2447
|
+
if (key === "queryKey") continue;
|
|
2448
|
+
Object.defineProperty(result, key, {
|
|
2449
|
+
enumerable: true,
|
|
2450
|
+
configurable: true,
|
|
2451
|
+
get: () => query[key]
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
return result;
|
|
2455
|
+
};
|
|
2456
|
+
const getListApiKeysUrl = (params) => {
|
|
2457
|
+
const normalizedParams = new URLSearchParams();
|
|
2458
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2459
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2460
|
+
});
|
|
2461
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2462
|
+
return stringifiedParams.length > 0 ? `/api-keys?${stringifiedParams}` : `/api-keys`;
|
|
2463
|
+
};
|
|
2464
|
+
/**
|
|
2465
|
+
* Lists API keys with pagination, optionally filtered by owner.
|
|
2466
|
+
* @summary List API keys
|
|
2467
|
+
*/
|
|
2468
|
+
const listApiKeys = async (params, options) => {
|
|
2469
|
+
return customFetch(getListApiKeysUrl(params), {
|
|
2470
|
+
...options,
|
|
2471
|
+
method: "GET"
|
|
2472
|
+
});
|
|
2473
|
+
};
|
|
2474
|
+
const getListApiKeysQueryKey = (params) => {
|
|
2475
|
+
return [`/api-keys`, ...params ? [params] : []];
|
|
2476
|
+
};
|
|
2477
|
+
const getListApiKeysQueryOptions = (params, options) => {
|
|
2478
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
2479
|
+
const queryKey = queryOptions?.queryKey ?? getListApiKeysQueryKey(params);
|
|
2480
|
+
const queryFn = ({ signal }) => listApiKeys(params, {
|
|
2481
|
+
signal,
|
|
2482
|
+
...requestOptions
|
|
2483
|
+
});
|
|
2484
|
+
return {
|
|
2485
|
+
queryKey,
|
|
2486
|
+
queryFn,
|
|
2487
|
+
...queryOptions
|
|
2488
|
+
};
|
|
2489
|
+
};
|
|
2490
|
+
/**
|
|
2491
|
+
* @summary List API keys
|
|
2492
|
+
*/
|
|
2493
|
+
function useListApiKeys(params, options, queryClient) {
|
|
2494
|
+
const queryOptions = getListApiKeysQueryOptions(params, options);
|
|
2495
|
+
const query = useQuery(queryOptions, queryClient);
|
|
2496
|
+
return withQueryKey$7(query, queryOptions.queryKey);
|
|
2497
|
+
}
|
|
2498
|
+
const getCreateApiKeyUrl = () => {
|
|
2499
|
+
return `/api-keys`;
|
|
2500
|
+
};
|
|
2501
|
+
/**
|
|
2502
|
+
* Creates a new API key for the specified owner.
|
|
2503
|
+
* @summary Create API key
|
|
2504
|
+
*/
|
|
2505
|
+
const createApiKey = async (createApiKeyRequest, options) => {
|
|
2506
|
+
return customFetch(getCreateApiKeyUrl(), {
|
|
2507
|
+
...options,
|
|
2508
|
+
method: "POST",
|
|
2509
|
+
headers: {
|
|
2510
|
+
"Content-Type": "application/json",
|
|
2511
|
+
...options?.headers
|
|
2512
|
+
},
|
|
2513
|
+
body: JSON.stringify(createApiKeyRequest)
|
|
2514
|
+
});
|
|
2515
|
+
};
|
|
2516
|
+
const getCreateApiKeyMutationOptions = (options) => {
|
|
2517
|
+
const mutationKey = ["createApiKey"];
|
|
2518
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2519
|
+
...options,
|
|
2520
|
+
mutation: {
|
|
2521
|
+
...options.mutation,
|
|
2522
|
+
mutationKey
|
|
2523
|
+
}
|
|
2524
|
+
} : {
|
|
2525
|
+
mutation: { mutationKey },
|
|
2526
|
+
request: void 0
|
|
2527
|
+
};
|
|
2528
|
+
const mutationFn = (props) => {
|
|
2529
|
+
const { data } = props ?? {};
|
|
2530
|
+
return createApiKey(data, requestOptions);
|
|
2531
|
+
};
|
|
2532
|
+
return {
|
|
2533
|
+
mutationFn,
|
|
2534
|
+
...mutationOptions
|
|
2535
|
+
};
|
|
2536
|
+
};
|
|
2537
|
+
/**
|
|
2538
|
+
* @summary Create API key
|
|
2539
|
+
*/
|
|
2540
|
+
const useCreateApiKey = (options, queryClient) => {
|
|
2541
|
+
return useMutation(getCreateApiKeyMutationOptions(options), queryClient);
|
|
2542
|
+
};
|
|
2543
|
+
const getVerifyApiKeyUrl = () => {
|
|
2544
|
+
return `/api-keys/verify`;
|
|
2545
|
+
};
|
|
2546
|
+
/**
|
|
2547
|
+
* Verifies an API key by its raw value and returns the associated key details.
|
|
2548
|
+
* @summary Verify API key
|
|
2549
|
+
*/
|
|
2550
|
+
const verifyApiKey = async (verifyApiKeyRequest, options) => {
|
|
2551
|
+
return customFetch(getVerifyApiKeyUrl(), {
|
|
2552
|
+
...options,
|
|
2553
|
+
method: "POST",
|
|
2554
|
+
headers: {
|
|
2555
|
+
"Content-Type": "application/json",
|
|
2556
|
+
...options?.headers
|
|
2557
|
+
},
|
|
2558
|
+
body: JSON.stringify(verifyApiKeyRequest)
|
|
2559
|
+
});
|
|
2560
|
+
};
|
|
2561
|
+
const getVerifyApiKeyMutationOptions = (options) => {
|
|
2562
|
+
const mutationKey = ["verifyApiKey"];
|
|
2563
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2564
|
+
...options,
|
|
2565
|
+
mutation: {
|
|
2566
|
+
...options.mutation,
|
|
2567
|
+
mutationKey
|
|
2568
|
+
}
|
|
2569
|
+
} : {
|
|
2570
|
+
mutation: { mutationKey },
|
|
2571
|
+
request: void 0
|
|
2572
|
+
};
|
|
2573
|
+
const mutationFn = (props) => {
|
|
2574
|
+
const { data } = props ?? {};
|
|
2575
|
+
return verifyApiKey(data, requestOptions);
|
|
2576
|
+
};
|
|
2577
|
+
return {
|
|
2578
|
+
mutationFn,
|
|
2579
|
+
...mutationOptions
|
|
2580
|
+
};
|
|
2581
|
+
};
|
|
2582
|
+
/**
|
|
2583
|
+
* @summary Verify API key
|
|
2584
|
+
*/
|
|
2585
|
+
const useVerifyApiKey = (options, queryClient) => {
|
|
2586
|
+
return useMutation(getVerifyApiKeyMutationOptions(options), queryClient);
|
|
2587
|
+
};
|
|
2588
|
+
const getGetApiKeyUrl = (id) => {
|
|
2589
|
+
return `/api-keys/${id}`;
|
|
2590
|
+
};
|
|
2591
|
+
/**
|
|
2592
|
+
* Retrieves an API key by its ID.
|
|
2593
|
+
* @summary Get API key by ID
|
|
2594
|
+
*/
|
|
2595
|
+
const getApiKey = async (id, options) => {
|
|
2596
|
+
return customFetch(getGetApiKeyUrl(id), {
|
|
2597
|
+
...options,
|
|
2598
|
+
method: "GET"
|
|
2599
|
+
});
|
|
2600
|
+
};
|
|
2601
|
+
const getGetApiKeyQueryKey = (id) => {
|
|
2602
|
+
return [`/api-keys/${id}`];
|
|
2603
|
+
};
|
|
2604
|
+
const getGetApiKeyQueryOptions = (id, options) => {
|
|
2605
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
2606
|
+
const queryKey = queryOptions?.queryKey ?? getGetApiKeyQueryKey(id);
|
|
2607
|
+
const queryFn = ({ signal }) => getApiKey(id, {
|
|
2608
|
+
signal,
|
|
2609
|
+
...requestOptions
|
|
2610
|
+
});
|
|
2611
|
+
return {
|
|
2612
|
+
queryKey,
|
|
2613
|
+
queryFn,
|
|
2614
|
+
enabled: id !== null && id !== void 0,
|
|
2615
|
+
...queryOptions
|
|
2616
|
+
};
|
|
2617
|
+
};
|
|
2618
|
+
/**
|
|
2619
|
+
* @summary Get API key by ID
|
|
2620
|
+
*/
|
|
2621
|
+
function useGetApiKey(id, options, queryClient) {
|
|
2622
|
+
const queryOptions = getGetApiKeyQueryOptions(id, options);
|
|
2623
|
+
const query = useQuery(queryOptions, queryClient);
|
|
2624
|
+
return withQueryKey$7(query, queryOptions.queryKey);
|
|
2625
|
+
}
|
|
2626
|
+
const getDeleteApiKeyUrl = (id) => {
|
|
2627
|
+
return `/api-keys/${id}`;
|
|
2628
|
+
};
|
|
2629
|
+
/**
|
|
2630
|
+
* Deletes an API key.
|
|
2631
|
+
* @summary Delete API key
|
|
2632
|
+
*/
|
|
2633
|
+
const deleteApiKey = async (id, options) => {
|
|
2634
|
+
return customFetch(getDeleteApiKeyUrl(id), {
|
|
2635
|
+
...options,
|
|
2636
|
+
method: "DELETE"
|
|
2637
|
+
});
|
|
2638
|
+
};
|
|
2639
|
+
const getDeleteApiKeyMutationOptions = (options) => {
|
|
2640
|
+
const mutationKey = ["deleteApiKey"];
|
|
2641
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2642
|
+
...options,
|
|
2643
|
+
mutation: {
|
|
2644
|
+
...options.mutation,
|
|
2645
|
+
mutationKey
|
|
2646
|
+
}
|
|
2647
|
+
} : {
|
|
2648
|
+
mutation: { mutationKey },
|
|
2649
|
+
request: void 0
|
|
2650
|
+
};
|
|
2651
|
+
const mutationFn = (props) => {
|
|
2652
|
+
const { id } = props ?? {};
|
|
2653
|
+
return deleteApiKey(id, requestOptions);
|
|
2654
|
+
};
|
|
2655
|
+
return {
|
|
2656
|
+
mutationFn,
|
|
2657
|
+
...mutationOptions
|
|
2658
|
+
};
|
|
2659
|
+
};
|
|
2660
|
+
/**
|
|
2661
|
+
* @summary Delete API key
|
|
2662
|
+
*/
|
|
2663
|
+
const useDeleteApiKey = (options, queryClient) => {
|
|
2664
|
+
return useMutation(getDeleteApiKeyMutationOptions(options), queryClient);
|
|
2665
|
+
};
|
|
2666
|
+
const getUpdateApiKeyUrl = (id) => {
|
|
2667
|
+
return `/api-keys/${id}`;
|
|
2668
|
+
};
|
|
2669
|
+
/**
|
|
2670
|
+
* Updates an API key's attributes.
|
|
2671
|
+
* @summary Update API key
|
|
2672
|
+
*/
|
|
2673
|
+
const updateApiKey = async (id, updateApiKeyRequest, options) => {
|
|
2674
|
+
return customFetch(getUpdateApiKeyUrl(id), {
|
|
2675
|
+
...options,
|
|
2676
|
+
method: "PATCH",
|
|
2677
|
+
headers: {
|
|
2678
|
+
"Content-Type": "application/json",
|
|
2679
|
+
...options?.headers
|
|
2680
|
+
},
|
|
2681
|
+
body: JSON.stringify(updateApiKeyRequest)
|
|
2682
|
+
});
|
|
2683
|
+
};
|
|
2684
|
+
const getUpdateApiKeyMutationOptions = (options) => {
|
|
2685
|
+
const mutationKey = ["updateApiKey"];
|
|
2686
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2687
|
+
...options,
|
|
2688
|
+
mutation: {
|
|
2689
|
+
...options.mutation,
|
|
2690
|
+
mutationKey
|
|
2691
|
+
}
|
|
2692
|
+
} : {
|
|
2693
|
+
mutation: { mutationKey },
|
|
2694
|
+
request: void 0
|
|
2695
|
+
};
|
|
2696
|
+
const mutationFn = (props) => {
|
|
2697
|
+
const { id, data } = props ?? {};
|
|
2698
|
+
return updateApiKey(id, data, requestOptions);
|
|
2699
|
+
};
|
|
2700
|
+
return {
|
|
2701
|
+
mutationFn,
|
|
2702
|
+
...mutationOptions
|
|
2703
|
+
};
|
|
2704
|
+
};
|
|
2705
|
+
/**
|
|
2706
|
+
* @summary Update API key
|
|
2707
|
+
*/
|
|
2708
|
+
const useUpdateApiKey = (options, queryClient) => {
|
|
2709
|
+
return useMutation(getUpdateApiKeyMutationOptions(options), queryClient);
|
|
2710
|
+
};
|
|
2711
|
+
|
|
2712
|
+
//#endregion
|
|
2713
|
+
//#region src/plugins/api-key/plugin.ts
|
|
2714
|
+
var ApiKeyPlugin = class {
|
|
2715
|
+
id = "apiKey";
|
|
2716
|
+
constructor() {}
|
|
2717
|
+
init(client) {
|
|
2718
|
+
return wrapGenerated(api_keys_exports, client);
|
|
2719
|
+
}
|
|
2720
|
+
};
|
|
324
2721
|
|
|
325
2722
|
//#endregion
|
|
326
2723
|
//#region src/plugins/bearer/plugin.ts
|
|
@@ -375,6 +2772,124 @@ var BearerPlugin = class {
|
|
|
375
2772
|
}
|
|
376
2773
|
};
|
|
377
2774
|
|
|
2775
|
+
//#endregion
|
|
2776
|
+
//#region src/gen/endpoints/core/core.ts
|
|
2777
|
+
var core_exports = /* @__PURE__ */ __exportAll({
|
|
2778
|
+
getGetMeQueryKey: () => getGetMeQueryKey,
|
|
2779
|
+
getGetMeQueryOptions: () => getGetMeQueryOptions,
|
|
2780
|
+
getGetMeUrl: () => getGetMeUrl,
|
|
2781
|
+
getMe: () => getMe,
|
|
2782
|
+
getSignOutMutationOptions: () => getSignOutMutationOptions,
|
|
2783
|
+
getSignOutUrl: () => getSignOutUrl,
|
|
2784
|
+
signOut: () => signOut,
|
|
2785
|
+
useGetMe: () => useGetMe,
|
|
2786
|
+
useSignOut: () => useSignOut
|
|
2787
|
+
});
|
|
2788
|
+
const withQueryKey$6 = (query, queryKey) => {
|
|
2789
|
+
const result = { queryKey };
|
|
2790
|
+
for (const key of Object.keys(query)) {
|
|
2791
|
+
if (key === "queryKey") continue;
|
|
2792
|
+
Object.defineProperty(result, key, {
|
|
2793
|
+
enumerable: true,
|
|
2794
|
+
configurable: true,
|
|
2795
|
+
get: () => query[key]
|
|
2796
|
+
});
|
|
2797
|
+
}
|
|
2798
|
+
return result;
|
|
2799
|
+
};
|
|
2800
|
+
const getGetMeUrl = () => {
|
|
2801
|
+
return `/me`;
|
|
2802
|
+
};
|
|
2803
|
+
/**
|
|
2804
|
+
* Retrieves the authenticated user's profile and current session.
|
|
2805
|
+
* @summary Get current user
|
|
2806
|
+
*/
|
|
2807
|
+
const getMe = async (options) => {
|
|
2808
|
+
return customFetch(getGetMeUrl(), {
|
|
2809
|
+
...options,
|
|
2810
|
+
method: "GET"
|
|
2811
|
+
});
|
|
2812
|
+
};
|
|
2813
|
+
const getGetMeQueryKey = () => {
|
|
2814
|
+
return [`/me`];
|
|
2815
|
+
};
|
|
2816
|
+
const getGetMeQueryOptions = (options) => {
|
|
2817
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
2818
|
+
const queryKey = queryOptions?.queryKey ?? getGetMeQueryKey();
|
|
2819
|
+
const queryFn = ({ signal }) => getMe({
|
|
2820
|
+
signal,
|
|
2821
|
+
...requestOptions
|
|
2822
|
+
});
|
|
2823
|
+
return {
|
|
2824
|
+
queryKey,
|
|
2825
|
+
queryFn,
|
|
2826
|
+
...queryOptions
|
|
2827
|
+
};
|
|
2828
|
+
};
|
|
2829
|
+
/**
|
|
2830
|
+
* @summary Get current user
|
|
2831
|
+
*/
|
|
2832
|
+
function useGetMe(options, queryClient) {
|
|
2833
|
+
const queryOptions = getGetMeQueryOptions(options);
|
|
2834
|
+
const query = useQuery(queryOptions, queryClient);
|
|
2835
|
+
return withQueryKey$6(query, queryOptions.queryKey);
|
|
2836
|
+
}
|
|
2837
|
+
const getSignOutUrl = () => {
|
|
2838
|
+
return `/sign-out`;
|
|
2839
|
+
};
|
|
2840
|
+
/**
|
|
2841
|
+
* Signs out the authenticated user. Optionally sign out a specific session or all sessions.
|
|
2842
|
+
* @summary Sign out
|
|
2843
|
+
*/
|
|
2844
|
+
const signOut = async (signOutRequest, options) => {
|
|
2845
|
+
return customFetch(getSignOutUrl(), {
|
|
2846
|
+
...options,
|
|
2847
|
+
method: "POST",
|
|
2848
|
+
headers: {
|
|
2849
|
+
"Content-Type": "application/json",
|
|
2850
|
+
...options?.headers
|
|
2851
|
+
},
|
|
2852
|
+
body: JSON.stringify(signOutRequest)
|
|
2853
|
+
});
|
|
2854
|
+
};
|
|
2855
|
+
const getSignOutMutationOptions = (options) => {
|
|
2856
|
+
const mutationKey = ["signOut"];
|
|
2857
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2858
|
+
...options,
|
|
2859
|
+
mutation: {
|
|
2860
|
+
...options.mutation,
|
|
2861
|
+
mutationKey
|
|
2862
|
+
}
|
|
2863
|
+
} : {
|
|
2864
|
+
mutation: { mutationKey },
|
|
2865
|
+
request: void 0
|
|
2866
|
+
};
|
|
2867
|
+
const mutationFn = (props) => {
|
|
2868
|
+
const { data } = props ?? {};
|
|
2869
|
+
return signOut(data, requestOptions);
|
|
2870
|
+
};
|
|
2871
|
+
return {
|
|
2872
|
+
mutationFn,
|
|
2873
|
+
...mutationOptions
|
|
2874
|
+
};
|
|
2875
|
+
};
|
|
2876
|
+
/**
|
|
2877
|
+
* @summary Sign out
|
|
2878
|
+
*/
|
|
2879
|
+
const useSignOut = (options, queryClient) => {
|
|
2880
|
+
return useMutation(getSignOutMutationOptions(options), queryClient);
|
|
2881
|
+
};
|
|
2882
|
+
|
|
2883
|
+
//#endregion
|
|
2884
|
+
//#region src/plugins/core/plugin.ts
|
|
2885
|
+
var CorePlugin = class {
|
|
2886
|
+
id = "core";
|
|
2887
|
+
constructor() {}
|
|
2888
|
+
init(client) {
|
|
2889
|
+
return wrapGenerated(core_exports, client);
|
|
2890
|
+
}
|
|
2891
|
+
};
|
|
2892
|
+
|
|
378
2893
|
//#endregion
|
|
379
2894
|
//#region src/plugins/csrf/plugin.ts
|
|
380
2895
|
var CSRFPlugin = class {
|
|
@@ -385,290 +2900,1342 @@ var CSRFPlugin = class {
|
|
|
385
2900
|
}
|
|
386
2901
|
init(client) {
|
|
387
2902
|
client.registerBeforeFetch(async (ctx) => {
|
|
388
|
-
if (
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
ctx.init.headers.set(this.options.headerName, value);
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
if (this.cookies) {
|
|
401
|
-
if ([
|
|
402
|
-
"OPTIONS",
|
|
403
|
-
"HEAD",
|
|
404
|
-
"GET"
|
|
405
|
-
].includes(ctx.init.method || "GET")) return;
|
|
406
|
-
const cookie = (await this.cookies()).get(this.options.cookieName);
|
|
407
|
-
if (!cookie) return;
|
|
408
|
-
ctx.init.headers = new Headers(ctx.init.headers);
|
|
409
|
-
ctx.init.headers.set(this.options.headerName, cookie.value);
|
|
410
|
-
}
|
|
2903
|
+
if ([
|
|
2904
|
+
"OPTIONS",
|
|
2905
|
+
"HEAD",
|
|
2906
|
+
"GET"
|
|
2907
|
+
].includes(ctx.init.method || "GET")) return;
|
|
2908
|
+
const value = ctx.cookies?.[this.options.cookieName] ?? await client.getCookie(this.options.cookieName);
|
|
2909
|
+
if (!value) return;
|
|
2910
|
+
ctx.init.headers = new Headers(ctx.init.headers);
|
|
2911
|
+
ctx.init.headers.set(this.options.headerName, value);
|
|
411
2912
|
});
|
|
412
2913
|
return {};
|
|
413
2914
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
//#endregion
|
|
2918
|
+
//#region src/gen/endpoints/email-password-plugin/email-password-plugin.ts
|
|
2919
|
+
var email_password_plugin_exports = /* @__PURE__ */ __exportAll({
|
|
2920
|
+
changePassword: () => changePassword,
|
|
2921
|
+
getChangePasswordMutationOptions: () => getChangePasswordMutationOptions,
|
|
2922
|
+
getChangePasswordUrl: () => getChangePasswordUrl,
|
|
2923
|
+
getRequestEmailChangeMutationOptions: () => getRequestEmailChangeMutationOptions,
|
|
2924
|
+
getRequestEmailChangeUrl: () => getRequestEmailChangeUrl,
|
|
2925
|
+
getRequestPasswordResetMutationOptions: () => getRequestPasswordResetMutationOptions,
|
|
2926
|
+
getRequestPasswordResetUrl: () => getRequestPasswordResetUrl,
|
|
2927
|
+
getSendEmailVerificationMutationOptions: () => getSendEmailVerificationMutationOptions,
|
|
2928
|
+
getSendEmailVerificationUrl: () => getSendEmailVerificationUrl,
|
|
2929
|
+
getSignInMutationOptions: () => getSignInMutationOptions,
|
|
2930
|
+
getSignInUrl: () => getSignInUrl,
|
|
2931
|
+
getSignUpMutationOptions: () => getSignUpMutationOptions,
|
|
2932
|
+
getSignUpUrl: () => getSignUpUrl,
|
|
2933
|
+
getVerifyEmailQueryKey: () => getVerifyEmailQueryKey,
|
|
2934
|
+
getVerifyEmailQueryOptions: () => getVerifyEmailQueryOptions,
|
|
2935
|
+
getVerifyEmailUrl: () => getVerifyEmailUrl,
|
|
2936
|
+
requestEmailChange: () => requestEmailChange,
|
|
2937
|
+
requestPasswordReset: () => requestPasswordReset,
|
|
2938
|
+
sendEmailVerification: () => sendEmailVerification,
|
|
2939
|
+
signIn: () => signIn,
|
|
2940
|
+
signUp: () => signUp,
|
|
2941
|
+
useChangePassword: () => useChangePassword,
|
|
2942
|
+
useRequestEmailChange: () => useRequestEmailChange,
|
|
2943
|
+
useRequestPasswordReset: () => useRequestPasswordReset,
|
|
2944
|
+
useSendEmailVerification: () => useSendEmailVerification,
|
|
2945
|
+
useSignIn: () => useSignIn,
|
|
2946
|
+
useSignUp: () => useSignUp,
|
|
2947
|
+
useVerifyEmail: () => useVerifyEmail,
|
|
2948
|
+
verifyEmail: () => verifyEmail
|
|
2949
|
+
});
|
|
2950
|
+
const withQueryKey$5 = (query, queryKey) => {
|
|
2951
|
+
const result = { queryKey };
|
|
2952
|
+
for (const key of Object.keys(query)) {
|
|
2953
|
+
if (key === "queryKey") continue;
|
|
2954
|
+
Object.defineProperty(result, key, {
|
|
2955
|
+
enumerable: true,
|
|
2956
|
+
configurable: true,
|
|
2957
|
+
get: () => query[key]
|
|
2958
|
+
});
|
|
417
2959
|
}
|
|
2960
|
+
return result;
|
|
2961
|
+
};
|
|
2962
|
+
const getChangePasswordUrl = () => {
|
|
2963
|
+
return `/email-password/change-password`;
|
|
2964
|
+
};
|
|
2965
|
+
/**
|
|
2966
|
+
* Changes the user's password using a reset token
|
|
2967
|
+
* @summary Change password
|
|
2968
|
+
*/
|
|
2969
|
+
const changePassword = async (changePasswordRequest, options) => {
|
|
2970
|
+
return customFetch(getChangePasswordUrl(), {
|
|
2971
|
+
...options,
|
|
2972
|
+
method: "POST",
|
|
2973
|
+
headers: {
|
|
2974
|
+
"Content-Type": "application/json",
|
|
2975
|
+
...options?.headers
|
|
2976
|
+
},
|
|
2977
|
+
body: JSON.stringify(changePasswordRequest)
|
|
2978
|
+
});
|
|
2979
|
+
};
|
|
2980
|
+
const getChangePasswordMutationOptions = (options) => {
|
|
2981
|
+
const mutationKey = ["changePassword"];
|
|
2982
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
2983
|
+
...options,
|
|
2984
|
+
mutation: {
|
|
2985
|
+
...options.mutation,
|
|
2986
|
+
mutationKey
|
|
2987
|
+
}
|
|
2988
|
+
} : {
|
|
2989
|
+
mutation: { mutationKey },
|
|
2990
|
+
request: void 0
|
|
2991
|
+
};
|
|
2992
|
+
const mutationFn = (props) => {
|
|
2993
|
+
const { data } = props ?? {};
|
|
2994
|
+
return changePassword(data, requestOptions);
|
|
2995
|
+
};
|
|
2996
|
+
return {
|
|
2997
|
+
mutationFn,
|
|
2998
|
+
...mutationOptions
|
|
2999
|
+
};
|
|
3000
|
+
};
|
|
3001
|
+
/**
|
|
3002
|
+
* @summary Change password
|
|
3003
|
+
*/
|
|
3004
|
+
const useChangePassword = (options, queryClient) => {
|
|
3005
|
+
return useMutation(getChangePasswordMutationOptions(options), queryClient);
|
|
3006
|
+
};
|
|
3007
|
+
const getRequestEmailChangeUrl = () => {
|
|
3008
|
+
return `/email-password/request-email-change`;
|
|
3009
|
+
};
|
|
3010
|
+
/**
|
|
3011
|
+
* Requests to change the authenticated user's email address
|
|
3012
|
+
* @summary Request email change
|
|
3013
|
+
*/
|
|
3014
|
+
const requestEmailChange = async (requestEmailChangeRequest, options) => {
|
|
3015
|
+
return customFetch(getRequestEmailChangeUrl(), {
|
|
3016
|
+
...options,
|
|
3017
|
+
method: "POST",
|
|
3018
|
+
headers: {
|
|
3019
|
+
"Content-Type": "application/json",
|
|
3020
|
+
...options?.headers
|
|
3021
|
+
},
|
|
3022
|
+
body: JSON.stringify(requestEmailChangeRequest)
|
|
3023
|
+
});
|
|
418
3024
|
};
|
|
3025
|
+
const getRequestEmailChangeMutationOptions = (options) => {
|
|
3026
|
+
const mutationKey = ["requestEmailChange"];
|
|
3027
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3028
|
+
...options,
|
|
3029
|
+
mutation: {
|
|
3030
|
+
...options.mutation,
|
|
3031
|
+
mutationKey
|
|
3032
|
+
}
|
|
3033
|
+
} : {
|
|
3034
|
+
mutation: { mutationKey },
|
|
3035
|
+
request: void 0
|
|
3036
|
+
};
|
|
3037
|
+
const mutationFn = (props) => {
|
|
3038
|
+
const { data } = props ?? {};
|
|
3039
|
+
return requestEmailChange(data, requestOptions);
|
|
3040
|
+
};
|
|
3041
|
+
return {
|
|
3042
|
+
mutationFn,
|
|
3043
|
+
...mutationOptions
|
|
3044
|
+
};
|
|
3045
|
+
};
|
|
3046
|
+
/**
|
|
3047
|
+
* @summary Request email change
|
|
3048
|
+
*/
|
|
3049
|
+
const useRequestEmailChange = (options, queryClient) => {
|
|
3050
|
+
return useMutation(getRequestEmailChangeMutationOptions(options), queryClient);
|
|
3051
|
+
};
|
|
3052
|
+
const getRequestPasswordResetUrl = () => {
|
|
3053
|
+
return `/email-password/request-password-reset`;
|
|
3054
|
+
};
|
|
3055
|
+
/**
|
|
3056
|
+
* Requests a password reset link to be sent to the user's email
|
|
3057
|
+
* @summary Request password reset
|
|
3058
|
+
*/
|
|
3059
|
+
const requestPasswordReset = async (requestPasswordResetRequest, options) => {
|
|
3060
|
+
return customFetch(getRequestPasswordResetUrl(), {
|
|
3061
|
+
...options,
|
|
3062
|
+
method: "POST",
|
|
3063
|
+
headers: {
|
|
3064
|
+
"Content-Type": "application/json",
|
|
3065
|
+
...options?.headers
|
|
3066
|
+
},
|
|
3067
|
+
body: JSON.stringify(requestPasswordResetRequest)
|
|
3068
|
+
});
|
|
3069
|
+
};
|
|
3070
|
+
const getRequestPasswordResetMutationOptions = (options) => {
|
|
3071
|
+
const mutationKey = ["requestPasswordReset"];
|
|
3072
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3073
|
+
...options,
|
|
3074
|
+
mutation: {
|
|
3075
|
+
...options.mutation,
|
|
3076
|
+
mutationKey
|
|
3077
|
+
}
|
|
3078
|
+
} : {
|
|
3079
|
+
mutation: { mutationKey },
|
|
3080
|
+
request: void 0
|
|
3081
|
+
};
|
|
3082
|
+
const mutationFn = (props) => {
|
|
3083
|
+
const { data } = props ?? {};
|
|
3084
|
+
return requestPasswordReset(data, requestOptions);
|
|
3085
|
+
};
|
|
3086
|
+
return {
|
|
3087
|
+
mutationFn,
|
|
3088
|
+
...mutationOptions
|
|
3089
|
+
};
|
|
3090
|
+
};
|
|
3091
|
+
/**
|
|
3092
|
+
* @summary Request password reset
|
|
3093
|
+
*/
|
|
3094
|
+
const useRequestPasswordReset = (options, queryClient) => {
|
|
3095
|
+
return useMutation(getRequestPasswordResetMutationOptions(options), queryClient);
|
|
3096
|
+
};
|
|
3097
|
+
const getSendEmailVerificationUrl = () => {
|
|
3098
|
+
return `/email-password/send-email-verification`;
|
|
3099
|
+
};
|
|
3100
|
+
/**
|
|
3101
|
+
* Sends a verification email to the authenticated user
|
|
3102
|
+
* @summary Send email verification
|
|
3103
|
+
*/
|
|
3104
|
+
const sendEmailVerification = async (sendEmailVerificationRequest, options) => {
|
|
3105
|
+
return customFetch(getSendEmailVerificationUrl(), {
|
|
3106
|
+
...options,
|
|
3107
|
+
method: "POST",
|
|
3108
|
+
headers: {
|
|
3109
|
+
"Content-Type": "application/json",
|
|
3110
|
+
...options?.headers
|
|
3111
|
+
},
|
|
3112
|
+
body: JSON.stringify(sendEmailVerificationRequest)
|
|
3113
|
+
});
|
|
3114
|
+
};
|
|
3115
|
+
const getSendEmailVerificationMutationOptions = (options) => {
|
|
3116
|
+
const mutationKey = ["sendEmailVerification"];
|
|
3117
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3118
|
+
...options,
|
|
3119
|
+
mutation: {
|
|
3120
|
+
...options.mutation,
|
|
3121
|
+
mutationKey
|
|
3122
|
+
}
|
|
3123
|
+
} : {
|
|
3124
|
+
mutation: { mutationKey },
|
|
3125
|
+
request: void 0
|
|
3126
|
+
};
|
|
3127
|
+
const mutationFn = (props) => {
|
|
3128
|
+
const { data } = props ?? {};
|
|
3129
|
+
return sendEmailVerification(data, requestOptions);
|
|
3130
|
+
};
|
|
3131
|
+
return {
|
|
3132
|
+
mutationFn,
|
|
3133
|
+
...mutationOptions
|
|
3134
|
+
};
|
|
3135
|
+
};
|
|
3136
|
+
/**
|
|
3137
|
+
* @summary Send email verification
|
|
3138
|
+
*/
|
|
3139
|
+
const useSendEmailVerification = (options, queryClient) => {
|
|
3140
|
+
return useMutation(getSendEmailVerificationMutationOptions(options), queryClient);
|
|
3141
|
+
};
|
|
3142
|
+
const getSignInUrl = () => {
|
|
3143
|
+
return `/email-password/sign-in`;
|
|
3144
|
+
};
|
|
3145
|
+
/**
|
|
3146
|
+
* Authenticates a user with email and password
|
|
3147
|
+
* @summary Sign in
|
|
3148
|
+
*/
|
|
3149
|
+
const signIn = async (signInRequest, options) => {
|
|
3150
|
+
return customFetch(getSignInUrl(), {
|
|
3151
|
+
...options,
|
|
3152
|
+
method: "POST",
|
|
3153
|
+
headers: {
|
|
3154
|
+
"Content-Type": "application/json",
|
|
3155
|
+
...options?.headers
|
|
3156
|
+
},
|
|
3157
|
+
body: JSON.stringify(signInRequest)
|
|
3158
|
+
});
|
|
3159
|
+
};
|
|
3160
|
+
const getSignInMutationOptions = (options) => {
|
|
3161
|
+
const mutationKey = ["signIn"];
|
|
3162
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3163
|
+
...options,
|
|
3164
|
+
mutation: {
|
|
3165
|
+
...options.mutation,
|
|
3166
|
+
mutationKey
|
|
3167
|
+
}
|
|
3168
|
+
} : {
|
|
3169
|
+
mutation: { mutationKey },
|
|
3170
|
+
request: void 0
|
|
3171
|
+
};
|
|
3172
|
+
const mutationFn = (props) => {
|
|
3173
|
+
const { data } = props ?? {};
|
|
3174
|
+
return signIn(data, requestOptions);
|
|
3175
|
+
};
|
|
3176
|
+
return {
|
|
3177
|
+
mutationFn,
|
|
3178
|
+
...mutationOptions
|
|
3179
|
+
};
|
|
3180
|
+
};
|
|
3181
|
+
/**
|
|
3182
|
+
* @summary Sign in
|
|
3183
|
+
*/
|
|
3184
|
+
const useSignIn = (options, queryClient) => {
|
|
3185
|
+
return useMutation(getSignInMutationOptions(options), queryClient);
|
|
3186
|
+
};
|
|
3187
|
+
const getSignUpUrl = () => {
|
|
3188
|
+
return `/email-password/sign-up`;
|
|
3189
|
+
};
|
|
3190
|
+
/**
|
|
3191
|
+
* Registers a new user with email and password
|
|
3192
|
+
* @summary Register new user
|
|
3193
|
+
*/
|
|
3194
|
+
const signUp = async (signUpRequest, options) => {
|
|
3195
|
+
return customFetch(getSignUpUrl(), {
|
|
3196
|
+
...options,
|
|
3197
|
+
method: "POST",
|
|
3198
|
+
headers: {
|
|
3199
|
+
"Content-Type": "application/json",
|
|
3200
|
+
...options?.headers
|
|
3201
|
+
},
|
|
3202
|
+
body: JSON.stringify(signUpRequest)
|
|
3203
|
+
});
|
|
3204
|
+
};
|
|
3205
|
+
const getSignUpMutationOptions = (options) => {
|
|
3206
|
+
const mutationKey = ["signUp"];
|
|
3207
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3208
|
+
...options,
|
|
3209
|
+
mutation: {
|
|
3210
|
+
...options.mutation,
|
|
3211
|
+
mutationKey
|
|
3212
|
+
}
|
|
3213
|
+
} : {
|
|
3214
|
+
mutation: { mutationKey },
|
|
3215
|
+
request: void 0
|
|
3216
|
+
};
|
|
3217
|
+
const mutationFn = (props) => {
|
|
3218
|
+
const { data } = props ?? {};
|
|
3219
|
+
return signUp(data, requestOptions);
|
|
3220
|
+
};
|
|
3221
|
+
return {
|
|
3222
|
+
mutationFn,
|
|
3223
|
+
...mutationOptions
|
|
3224
|
+
};
|
|
3225
|
+
};
|
|
3226
|
+
/**
|
|
3227
|
+
* @summary Register new user
|
|
3228
|
+
*/
|
|
3229
|
+
const useSignUp = (options, queryClient) => {
|
|
3230
|
+
return useMutation(getSignUpMutationOptions(options), queryClient);
|
|
3231
|
+
};
|
|
3232
|
+
const getVerifyEmailUrl = () => {
|
|
3233
|
+
return `/email-password/verify-email`;
|
|
3234
|
+
};
|
|
3235
|
+
/**
|
|
3236
|
+
* Verifies an email address or processes a password reset token using a verification token
|
|
3237
|
+
* @summary Verify email
|
|
3238
|
+
*/
|
|
3239
|
+
const verifyEmail = async (options) => {
|
|
3240
|
+
return customFetch(getVerifyEmailUrl(), {
|
|
3241
|
+
...options,
|
|
3242
|
+
method: "GET"
|
|
3243
|
+
});
|
|
3244
|
+
};
|
|
3245
|
+
const getVerifyEmailQueryKey = () => {
|
|
3246
|
+
return [`/email-password/verify-email`];
|
|
3247
|
+
};
|
|
3248
|
+
const getVerifyEmailQueryOptions = (options) => {
|
|
3249
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
3250
|
+
const queryKey = queryOptions?.queryKey ?? getVerifyEmailQueryKey();
|
|
3251
|
+
const queryFn = ({ signal }) => verifyEmail({
|
|
3252
|
+
signal,
|
|
3253
|
+
...requestOptions
|
|
3254
|
+
});
|
|
3255
|
+
return {
|
|
3256
|
+
queryKey,
|
|
3257
|
+
queryFn,
|
|
3258
|
+
...queryOptions
|
|
3259
|
+
};
|
|
3260
|
+
};
|
|
3261
|
+
/**
|
|
3262
|
+
* @summary Verify email
|
|
3263
|
+
*/
|
|
3264
|
+
function useVerifyEmail(options, queryClient) {
|
|
3265
|
+
const queryOptions = getVerifyEmailQueryOptions(options);
|
|
3266
|
+
const query = useQuery(queryOptions, queryClient);
|
|
3267
|
+
return withQueryKey$5(query, queryOptions.queryKey);
|
|
3268
|
+
}
|
|
419
3269
|
|
|
420
3270
|
//#endregion
|
|
421
3271
|
//#region src/plugins/email-password/plugin.ts
|
|
422
3272
|
var EmailPasswordPlugin = class {
|
|
423
3273
|
id = "emailPassword";
|
|
424
3274
|
init(client) {
|
|
425
|
-
return
|
|
426
|
-
signUp: async (data) => {
|
|
427
|
-
return wrappedFetch(client, "/email-password/sign-up", {
|
|
428
|
-
method: "POST",
|
|
429
|
-
body: data
|
|
430
|
-
});
|
|
431
|
-
},
|
|
432
|
-
signIn: async (data) => {
|
|
433
|
-
return wrappedFetch(client, "/email-password/sign-in", {
|
|
434
|
-
method: "POST",
|
|
435
|
-
body: data
|
|
436
|
-
});
|
|
437
|
-
},
|
|
438
|
-
sendEmailVerification: async (data) => {
|
|
439
|
-
return wrappedFetch(client, `/email-password/send-email-verification`, {
|
|
440
|
-
method: "POST",
|
|
441
|
-
body: data
|
|
442
|
-
});
|
|
443
|
-
},
|
|
444
|
-
requestPasswordReset: async (data) => {
|
|
445
|
-
return wrappedFetch(client, `/email-password/request-password-reset`, {
|
|
446
|
-
method: "POST",
|
|
447
|
-
body: data
|
|
448
|
-
});
|
|
449
|
-
},
|
|
450
|
-
changePassword: async (data) => {
|
|
451
|
-
return wrappedFetch(client, `/email-password/change-password`, {
|
|
452
|
-
method: "POST",
|
|
453
|
-
body: data
|
|
454
|
-
});
|
|
455
|
-
},
|
|
456
|
-
requestEmailChange: async (data) => {
|
|
457
|
-
return wrappedFetch(client, `/email-password/request-email-change`, {
|
|
458
|
-
method: "POST",
|
|
459
|
-
body: data
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
};
|
|
3275
|
+
return wrapGenerated(email_password_plugin_exports, client);
|
|
463
3276
|
}
|
|
464
3277
|
};
|
|
465
3278
|
|
|
3279
|
+
//#endregion
|
|
3280
|
+
//#region src/gen/endpoints/jwt-plugin/jwt-plugin.ts
|
|
3281
|
+
var jwt_plugin_exports = /* @__PURE__ */ __exportAll({
|
|
3282
|
+
getGetJWKSQueryKey: () => getGetJWKSQueryKey,
|
|
3283
|
+
getGetJWKSQueryOptions: () => getGetJWKSQueryOptions,
|
|
3284
|
+
getGetJWKSUrl: () => getGetJWKSUrl,
|
|
3285
|
+
getJWKS: () => getJWKS,
|
|
3286
|
+
getRefreshTokenMutationOptions: () => getRefreshTokenMutationOptions,
|
|
3287
|
+
getRefreshTokenUrl: () => getRefreshTokenUrl,
|
|
3288
|
+
refreshToken: () => refreshToken,
|
|
3289
|
+
useGetJWKS: () => useGetJWKS,
|
|
3290
|
+
useRefreshToken: () => useRefreshToken
|
|
3291
|
+
});
|
|
3292
|
+
const withQueryKey$4 = (query, queryKey) => {
|
|
3293
|
+
const result = { queryKey };
|
|
3294
|
+
for (const key of Object.keys(query)) {
|
|
3295
|
+
if (key === "queryKey") continue;
|
|
3296
|
+
Object.defineProperty(result, key, {
|
|
3297
|
+
enumerable: true,
|
|
3298
|
+
configurable: true,
|
|
3299
|
+
get: () => query[key]
|
|
3300
|
+
});
|
|
3301
|
+
}
|
|
3302
|
+
return result;
|
|
3303
|
+
};
|
|
3304
|
+
const getGetJWKSUrl = () => {
|
|
3305
|
+
return `/.well-known/jwks.json`;
|
|
3306
|
+
};
|
|
3307
|
+
/**
|
|
3308
|
+
* Returns the JSON Web Key Set (JWKS) containing the public keys used to verify JWT signatures.
|
|
3309
|
+
* @summary Get JWKS
|
|
3310
|
+
*/
|
|
3311
|
+
const getJWKS = async (options) => {
|
|
3312
|
+
return customFetch(getGetJWKSUrl(), {
|
|
3313
|
+
...options,
|
|
3314
|
+
method: "GET"
|
|
3315
|
+
});
|
|
3316
|
+
};
|
|
3317
|
+
const getGetJWKSQueryKey = () => {
|
|
3318
|
+
return [`/.well-known/jwks.json`];
|
|
3319
|
+
};
|
|
3320
|
+
const getGetJWKSQueryOptions = (options) => {
|
|
3321
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
3322
|
+
const queryKey = queryOptions?.queryKey ?? getGetJWKSQueryKey();
|
|
3323
|
+
const queryFn = ({ signal }) => getJWKS({
|
|
3324
|
+
signal,
|
|
3325
|
+
...requestOptions
|
|
3326
|
+
});
|
|
3327
|
+
return {
|
|
3328
|
+
queryKey,
|
|
3329
|
+
queryFn,
|
|
3330
|
+
...queryOptions
|
|
3331
|
+
};
|
|
3332
|
+
};
|
|
3333
|
+
/**
|
|
3334
|
+
* @summary Get JWKS
|
|
3335
|
+
*/
|
|
3336
|
+
function useGetJWKS(options, queryClient) {
|
|
3337
|
+
const queryOptions = getGetJWKSQueryOptions(options);
|
|
3338
|
+
const query = useQuery(queryOptions, queryClient);
|
|
3339
|
+
return withQueryKey$4(query, queryOptions.queryKey);
|
|
3340
|
+
}
|
|
3341
|
+
const getRefreshTokenUrl = () => {
|
|
3342
|
+
return `/token/refresh`;
|
|
3343
|
+
};
|
|
3344
|
+
/**
|
|
3345
|
+
* Exchanges a valid refresh token for a new access token and refresh token pair.
|
|
3346
|
+
* @summary Refresh JWT token
|
|
3347
|
+
*/
|
|
3348
|
+
const refreshToken = async (refreshTokenRequest, options) => {
|
|
3349
|
+
return customFetch(getRefreshTokenUrl(), {
|
|
3350
|
+
...options,
|
|
3351
|
+
method: "POST",
|
|
3352
|
+
headers: {
|
|
3353
|
+
"Content-Type": "application/json",
|
|
3354
|
+
...options?.headers
|
|
3355
|
+
},
|
|
3356
|
+
body: JSON.stringify(refreshTokenRequest)
|
|
3357
|
+
});
|
|
3358
|
+
};
|
|
3359
|
+
const getRefreshTokenMutationOptions = (options) => {
|
|
3360
|
+
const mutationKey = ["refreshToken"];
|
|
3361
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3362
|
+
...options,
|
|
3363
|
+
mutation: {
|
|
3364
|
+
...options.mutation,
|
|
3365
|
+
mutationKey
|
|
3366
|
+
}
|
|
3367
|
+
} : {
|
|
3368
|
+
mutation: { mutationKey },
|
|
3369
|
+
request: void 0
|
|
3370
|
+
};
|
|
3371
|
+
const mutationFn = (props) => {
|
|
3372
|
+
const { data } = props ?? {};
|
|
3373
|
+
return refreshToken(data, requestOptions);
|
|
3374
|
+
};
|
|
3375
|
+
return {
|
|
3376
|
+
mutationFn,
|
|
3377
|
+
...mutationOptions
|
|
3378
|
+
};
|
|
3379
|
+
};
|
|
3380
|
+
/**
|
|
3381
|
+
* @summary Refresh JWT token
|
|
3382
|
+
*/
|
|
3383
|
+
const useRefreshToken = (options, queryClient) => {
|
|
3384
|
+
return useMutation(getRefreshTokenMutationOptions(options), queryClient);
|
|
3385
|
+
};
|
|
3386
|
+
|
|
466
3387
|
//#endregion
|
|
467
3388
|
//#region src/plugins/jwt/plugin.ts
|
|
468
3389
|
var JWTPlugin = class {
|
|
469
3390
|
id = "jwt";
|
|
470
3391
|
constructor() {}
|
|
471
3392
|
init(client) {
|
|
472
|
-
return
|
|
473
|
-
refreshToken: async (data) => {
|
|
474
|
-
return wrappedFetch(client, "/token/refresh", {
|
|
475
|
-
method: "POST",
|
|
476
|
-
body: data
|
|
477
|
-
});
|
|
478
|
-
},
|
|
479
|
-
getJWKSKeys: async () => {
|
|
480
|
-
return wrappedFetch(client, "/.well-known/jwks.json", { method: "GET" });
|
|
481
|
-
}
|
|
482
|
-
};
|
|
3393
|
+
return wrapGenerated(jwt_plugin_exports, client);
|
|
483
3394
|
}
|
|
484
3395
|
};
|
|
485
3396
|
|
|
3397
|
+
//#endregion
|
|
3398
|
+
//#region src/gen/endpoints/magic-link-plugin/magic-link-plugin.ts
|
|
3399
|
+
var magic_link_plugin_exports = /* @__PURE__ */ __exportAll({
|
|
3400
|
+
exchangeMagicLink: () => exchangeMagicLink,
|
|
3401
|
+
getExchangeMagicLinkMutationOptions: () => getExchangeMagicLinkMutationOptions,
|
|
3402
|
+
getExchangeMagicLinkUrl: () => getExchangeMagicLinkUrl,
|
|
3403
|
+
getSignInWithMagicLinkMutationOptions: () => getSignInWithMagicLinkMutationOptions,
|
|
3404
|
+
getSignInWithMagicLinkUrl: () => getSignInWithMagicLinkUrl,
|
|
3405
|
+
getVerifyMagicLinkQueryKey: () => getVerifyMagicLinkQueryKey,
|
|
3406
|
+
getVerifyMagicLinkQueryOptions: () => getVerifyMagicLinkQueryOptions,
|
|
3407
|
+
getVerifyMagicLinkUrl: () => getVerifyMagicLinkUrl,
|
|
3408
|
+
signInWithMagicLink: () => signInWithMagicLink,
|
|
3409
|
+
useExchangeMagicLink: () => useExchangeMagicLink,
|
|
3410
|
+
useSignInWithMagicLink: () => useSignInWithMagicLink,
|
|
3411
|
+
useVerifyMagicLink: () => useVerifyMagicLink,
|
|
3412
|
+
verifyMagicLink: () => verifyMagicLink
|
|
3413
|
+
});
|
|
3414
|
+
const withQueryKey$3 = (query, queryKey) => {
|
|
3415
|
+
const result = { queryKey };
|
|
3416
|
+
for (const key of Object.keys(query)) {
|
|
3417
|
+
if (key === "queryKey") continue;
|
|
3418
|
+
Object.defineProperty(result, key, {
|
|
3419
|
+
enumerable: true,
|
|
3420
|
+
configurable: true,
|
|
3421
|
+
get: () => query[key]
|
|
3422
|
+
});
|
|
3423
|
+
}
|
|
3424
|
+
return result;
|
|
3425
|
+
};
|
|
3426
|
+
const getExchangeMagicLinkUrl = () => {
|
|
3427
|
+
return `/magic-link/exchange`;
|
|
3428
|
+
};
|
|
3429
|
+
/**
|
|
3430
|
+
* Exchanges a verified magic link token for an authenticated user session.
|
|
3431
|
+
* @summary Exchange magic link token for session
|
|
3432
|
+
*/
|
|
3433
|
+
const exchangeMagicLink = async (magicLinkExchangeRequest, options) => {
|
|
3434
|
+
return customFetch(getExchangeMagicLinkUrl(), {
|
|
3435
|
+
...options,
|
|
3436
|
+
method: "POST",
|
|
3437
|
+
headers: {
|
|
3438
|
+
"Content-Type": "application/json",
|
|
3439
|
+
...options?.headers
|
|
3440
|
+
},
|
|
3441
|
+
body: JSON.stringify(magicLinkExchangeRequest)
|
|
3442
|
+
});
|
|
3443
|
+
};
|
|
3444
|
+
const getExchangeMagicLinkMutationOptions = (options) => {
|
|
3445
|
+
const mutationKey = ["exchangeMagicLink"];
|
|
3446
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3447
|
+
...options,
|
|
3448
|
+
mutation: {
|
|
3449
|
+
...options.mutation,
|
|
3450
|
+
mutationKey
|
|
3451
|
+
}
|
|
3452
|
+
} : {
|
|
3453
|
+
mutation: { mutationKey },
|
|
3454
|
+
request: void 0
|
|
3455
|
+
};
|
|
3456
|
+
const mutationFn = (props) => {
|
|
3457
|
+
const { data } = props ?? {};
|
|
3458
|
+
return exchangeMagicLink(data, requestOptions);
|
|
3459
|
+
};
|
|
3460
|
+
return {
|
|
3461
|
+
mutationFn,
|
|
3462
|
+
...mutationOptions
|
|
3463
|
+
};
|
|
3464
|
+
};
|
|
3465
|
+
/**
|
|
3466
|
+
* @summary Exchange magic link token for session
|
|
3467
|
+
*/
|
|
3468
|
+
const useExchangeMagicLink = (options, queryClient) => {
|
|
3469
|
+
return useMutation(getExchangeMagicLinkMutationOptions(options), queryClient);
|
|
3470
|
+
};
|
|
3471
|
+
const getSignInWithMagicLinkUrl = () => {
|
|
3472
|
+
return `/magic-link/sign-in`;
|
|
3473
|
+
};
|
|
3474
|
+
/**
|
|
3475
|
+
* Sends a magic link to the given email address if an account exists. Optionally creates a new account if sign-up is enabled.
|
|
3476
|
+
* @summary Sign in with magic link
|
|
3477
|
+
*/
|
|
3478
|
+
const signInWithMagicLink = async (magicLinkSignInRequest, options) => {
|
|
3479
|
+
return customFetch(getSignInWithMagicLinkUrl(), {
|
|
3480
|
+
...options,
|
|
3481
|
+
method: "POST",
|
|
3482
|
+
headers: {
|
|
3483
|
+
"Content-Type": "application/json",
|
|
3484
|
+
...options?.headers
|
|
3485
|
+
},
|
|
3486
|
+
body: JSON.stringify(magicLinkSignInRequest)
|
|
3487
|
+
});
|
|
3488
|
+
};
|
|
3489
|
+
const getSignInWithMagicLinkMutationOptions = (options) => {
|
|
3490
|
+
const mutationKey = ["signInWithMagicLink"];
|
|
3491
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3492
|
+
...options,
|
|
3493
|
+
mutation: {
|
|
3494
|
+
...options.mutation,
|
|
3495
|
+
mutationKey
|
|
3496
|
+
}
|
|
3497
|
+
} : {
|
|
3498
|
+
mutation: { mutationKey },
|
|
3499
|
+
request: void 0
|
|
3500
|
+
};
|
|
3501
|
+
const mutationFn = (props) => {
|
|
3502
|
+
const { data } = props ?? {};
|
|
3503
|
+
return signInWithMagicLink(data, requestOptions);
|
|
3504
|
+
};
|
|
3505
|
+
return {
|
|
3506
|
+
mutationFn,
|
|
3507
|
+
...mutationOptions
|
|
3508
|
+
};
|
|
3509
|
+
};
|
|
3510
|
+
/**
|
|
3511
|
+
* @summary Sign in with magic link
|
|
3512
|
+
*/
|
|
3513
|
+
const useSignInWithMagicLink = (options, queryClient) => {
|
|
3514
|
+
return useMutation(getSignInWithMagicLinkMutationOptions(options), queryClient);
|
|
3515
|
+
};
|
|
3516
|
+
const getVerifyMagicLinkUrl = (params) => {
|
|
3517
|
+
const normalizedParams = new URLSearchParams();
|
|
3518
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
3519
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
3520
|
+
});
|
|
3521
|
+
const stringifiedParams = normalizedParams.toString();
|
|
3522
|
+
return stringifiedParams.length > 0 ? `/magic-link/verify?${stringifiedParams}` : `/magic-link/verify`;
|
|
3523
|
+
};
|
|
3524
|
+
/**
|
|
3525
|
+
* Verifies a magic link token. If a callback_url is provided and trusted, redirects the user with an exchange token appended. Otherwise returns the exchange token in the JSON response.
|
|
3526
|
+
* @summary Verify magic link token
|
|
3527
|
+
*/
|
|
3528
|
+
const verifyMagicLink = async (params, options) => {
|
|
3529
|
+
return customFetch(getVerifyMagicLinkUrl(params), {
|
|
3530
|
+
...options,
|
|
3531
|
+
method: "GET"
|
|
3532
|
+
});
|
|
3533
|
+
};
|
|
3534
|
+
const getVerifyMagicLinkQueryKey = (params) => {
|
|
3535
|
+
return [`/magic-link/verify`, ...params ? [params] : []];
|
|
3536
|
+
};
|
|
3537
|
+
const getVerifyMagicLinkQueryOptions = (params, options) => {
|
|
3538
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
3539
|
+
const queryKey = queryOptions?.queryKey ?? getVerifyMagicLinkQueryKey(params);
|
|
3540
|
+
const queryFn = ({ signal }) => verifyMagicLink(params, {
|
|
3541
|
+
signal,
|
|
3542
|
+
...requestOptions
|
|
3543
|
+
});
|
|
3544
|
+
return {
|
|
3545
|
+
queryKey,
|
|
3546
|
+
queryFn,
|
|
3547
|
+
...queryOptions
|
|
3548
|
+
};
|
|
3549
|
+
};
|
|
3550
|
+
/**
|
|
3551
|
+
* @summary Verify magic link token
|
|
3552
|
+
*/
|
|
3553
|
+
function useVerifyMagicLink(params, options, queryClient) {
|
|
3554
|
+
const queryOptions = getVerifyMagicLinkQueryOptions(params, options);
|
|
3555
|
+
const query = useQuery(queryOptions, queryClient);
|
|
3556
|
+
return withQueryKey$3(query, queryOptions.queryKey);
|
|
3557
|
+
}
|
|
3558
|
+
|
|
486
3559
|
//#endregion
|
|
487
3560
|
//#region src/plugins/magic-link/plugin.ts
|
|
488
3561
|
var MagicLinkPlugin = class {
|
|
489
3562
|
id = "magicLink";
|
|
490
3563
|
constructor() {}
|
|
491
3564
|
init(client) {
|
|
492
|
-
return
|
|
493
|
-
signIn: async (data) => {
|
|
494
|
-
return wrappedFetch(client, "/magic-link/sign-in", {
|
|
495
|
-
method: "POST",
|
|
496
|
-
body: data
|
|
497
|
-
});
|
|
498
|
-
},
|
|
499
|
-
verify: async (data) => {
|
|
500
|
-
const searchParams = new URLSearchParams();
|
|
501
|
-
searchParams.append("token", data.token);
|
|
502
|
-
if (data.callbackUrl) searchParams.append("callback_url", data.callbackUrl);
|
|
503
|
-
return wrappedFetch(client, `/magic-link/verify?${searchParams.toString()}`, { method: "GET" });
|
|
504
|
-
},
|
|
505
|
-
exchange: async (data) => {
|
|
506
|
-
return wrappedFetch(client, "/magic-link/exchange", {
|
|
507
|
-
method: "POST",
|
|
508
|
-
body: data
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
};
|
|
3565
|
+
return wrapGenerated(magic_link_plugin_exports, client);
|
|
512
3566
|
}
|
|
513
3567
|
};
|
|
514
3568
|
|
|
3569
|
+
//#endregion
|
|
3570
|
+
//#region src/gen/endpoints/oauth2-plugin/oauth2-plugin.ts
|
|
3571
|
+
var oauth2_plugin_exports = /* @__PURE__ */ __exportAll({
|
|
3572
|
+
getOauthAuthorizeQueryKey: () => getOauthAuthorizeQueryKey,
|
|
3573
|
+
getOauthAuthorizeQueryOptions: () => getOauthAuthorizeQueryOptions,
|
|
3574
|
+
getOauthAuthorizeUrl: () => getOauthAuthorizeUrl,
|
|
3575
|
+
getOauthCallbackQueryKey: () => getOauthCallbackQueryKey,
|
|
3576
|
+
getOauthCallbackQueryOptions: () => getOauthCallbackQueryOptions,
|
|
3577
|
+
getOauthCallbackUrl: () => getOauthCallbackUrl,
|
|
3578
|
+
oauthAuthorize: () => oauthAuthorize,
|
|
3579
|
+
oauthCallback: () => oauthCallback,
|
|
3580
|
+
useOauthAuthorize: () => useOauthAuthorize,
|
|
3581
|
+
useOauthCallback: () => useOauthCallback
|
|
3582
|
+
});
|
|
3583
|
+
const withQueryKey$2 = (query, queryKey) => {
|
|
3584
|
+
const result = { queryKey };
|
|
3585
|
+
for (const key of Object.keys(query)) {
|
|
3586
|
+
if (key === "queryKey") continue;
|
|
3587
|
+
Object.defineProperty(result, key, {
|
|
3588
|
+
enumerable: true,
|
|
3589
|
+
configurable: true,
|
|
3590
|
+
get: () => query[key]
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
return result;
|
|
3594
|
+
};
|
|
3595
|
+
const getOauthAuthorizeUrl = (provider, params) => {
|
|
3596
|
+
const normalizedParams = new URLSearchParams();
|
|
3597
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
3598
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
3599
|
+
});
|
|
3600
|
+
const stringifiedParams = normalizedParams.toString();
|
|
3601
|
+
return stringifiedParams.length > 0 ? `/oauth2/authorize/${provider}?${stringifiedParams}` : `/oauth2/authorize/${provider}`;
|
|
3602
|
+
};
|
|
3603
|
+
/**
|
|
3604
|
+
* Initiates the OAuth2 authorization flow with the specified provider. Returns the provider's authorization URL to redirect the user to.
|
|
3605
|
+
* @summary Authorize with OAuth2 provider
|
|
3606
|
+
*/
|
|
3607
|
+
const oauthAuthorize = async (provider, params, options) => {
|
|
3608
|
+
return customFetch(getOauthAuthorizeUrl(provider, params), {
|
|
3609
|
+
...options,
|
|
3610
|
+
method: "GET"
|
|
3611
|
+
});
|
|
3612
|
+
};
|
|
3613
|
+
const getOauthAuthorizeQueryKey = (provider, params) => {
|
|
3614
|
+
return [`/oauth2/authorize/${provider}`, ...params ? [params] : []];
|
|
3615
|
+
};
|
|
3616
|
+
const getOauthAuthorizeQueryOptions = (provider, params, options) => {
|
|
3617
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
3618
|
+
const queryKey = queryOptions?.queryKey ?? getOauthAuthorizeQueryKey(provider, params);
|
|
3619
|
+
const queryFn = ({ signal }) => oauthAuthorize(provider, params, {
|
|
3620
|
+
signal,
|
|
3621
|
+
...requestOptions
|
|
3622
|
+
});
|
|
3623
|
+
return {
|
|
3624
|
+
queryKey,
|
|
3625
|
+
queryFn,
|
|
3626
|
+
enabled: provider !== null && provider !== void 0,
|
|
3627
|
+
...queryOptions
|
|
3628
|
+
};
|
|
3629
|
+
};
|
|
3630
|
+
/**
|
|
3631
|
+
* @summary Authorize with OAuth2 provider
|
|
3632
|
+
*/
|
|
3633
|
+
function useOauthAuthorize(provider, params, options, queryClient) {
|
|
3634
|
+
const queryOptions = getOauthAuthorizeQueryOptions(provider, params, options);
|
|
3635
|
+
const query = useQuery(queryOptions, queryClient);
|
|
3636
|
+
return withQueryKey$2(query, queryOptions.queryKey);
|
|
3637
|
+
}
|
|
3638
|
+
const getOauthCallbackUrl = (provider, params) => {
|
|
3639
|
+
const normalizedParams = new URLSearchParams();
|
|
3640
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
3641
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
3642
|
+
});
|
|
3643
|
+
const stringifiedParams = normalizedParams.toString();
|
|
3644
|
+
return stringifiedParams.length > 0 ? `/oauth2/callback/${provider}?${stringifiedParams}` : `/oauth2/callback/${provider}`;
|
|
3645
|
+
};
|
|
3646
|
+
/**
|
|
3647
|
+
* Handles the OAuth2 callback from the provider. Exchanges the authorization code for tokens, creates or links a user account, and returns the authenticated user and session.
|
|
3648
|
+
* @summary OAuth2 callback
|
|
3649
|
+
*/
|
|
3650
|
+
const oauthCallback = async (provider, params, options) => {
|
|
3651
|
+
return customFetch(getOauthCallbackUrl(provider, params), {
|
|
3652
|
+
...options,
|
|
3653
|
+
method: "GET"
|
|
3654
|
+
});
|
|
3655
|
+
};
|
|
3656
|
+
const getOauthCallbackQueryKey = (provider, params) => {
|
|
3657
|
+
return [`/oauth2/callback/${provider}`, ...params ? [params] : []];
|
|
3658
|
+
};
|
|
3659
|
+
const getOauthCallbackQueryOptions = (provider, params, options) => {
|
|
3660
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
3661
|
+
const queryKey = queryOptions?.queryKey ?? getOauthCallbackQueryKey(provider, params);
|
|
3662
|
+
const queryFn = ({ signal }) => oauthCallback(provider, params, {
|
|
3663
|
+
signal,
|
|
3664
|
+
...requestOptions
|
|
3665
|
+
});
|
|
3666
|
+
return {
|
|
3667
|
+
queryKey,
|
|
3668
|
+
queryFn,
|
|
3669
|
+
enabled: provider !== null && provider !== void 0,
|
|
3670
|
+
...queryOptions
|
|
3671
|
+
};
|
|
3672
|
+
};
|
|
3673
|
+
/**
|
|
3674
|
+
* @summary OAuth2 callback
|
|
3675
|
+
*/
|
|
3676
|
+
function useOauthCallback(provider, params, options, queryClient) {
|
|
3677
|
+
const queryOptions = getOauthCallbackQueryOptions(provider, params, options);
|
|
3678
|
+
const query = useQuery(queryOptions, queryClient);
|
|
3679
|
+
return withQueryKey$2(query, queryOptions.queryKey);
|
|
3680
|
+
}
|
|
3681
|
+
|
|
515
3682
|
//#endregion
|
|
516
3683
|
//#region src/plugins/oauth2/plugin.ts
|
|
517
3684
|
var OAuth2Plugin = class {
|
|
518
3685
|
id = "oauth2";
|
|
519
3686
|
init(client) {
|
|
520
|
-
return
|
|
521
|
-
return wrappedFetch(client, `/oauth2/authorize/${data.provider}?redirect_to=${data.redirectTo}`, { method: "GET" });
|
|
522
|
-
} };
|
|
3687
|
+
return wrapGenerated(oauth2_plugin_exports, client);
|
|
523
3688
|
}
|
|
524
3689
|
};
|
|
525
3690
|
|
|
3691
|
+
//#endregion
|
|
3692
|
+
//#region src/gen/endpoints/organizations/organizations.ts
|
|
3693
|
+
var organizations_exports = /* @__PURE__ */ __exportAll({
|
|
3694
|
+
createOrganization: () => createOrganization,
|
|
3695
|
+
deleteOrganization: () => deleteOrganization,
|
|
3696
|
+
getCreateOrganizationMutationOptions: () => getCreateOrganizationMutationOptions,
|
|
3697
|
+
getCreateOrganizationUrl: () => getCreateOrganizationUrl,
|
|
3698
|
+
getDeleteOrganizationMutationOptions: () => getDeleteOrganizationMutationOptions,
|
|
3699
|
+
getDeleteOrganizationUrl: () => getDeleteOrganizationUrl,
|
|
3700
|
+
getGetOrganizationQueryKey: () => getGetOrganizationQueryKey,
|
|
3701
|
+
getGetOrganizationQueryOptions: () => getGetOrganizationQueryOptions,
|
|
3702
|
+
getGetOrganizationUrl: () => getGetOrganizationUrl,
|
|
3703
|
+
getListOrganizationsQueryKey: () => getListOrganizationsQueryKey,
|
|
3704
|
+
getListOrganizationsQueryOptions: () => getListOrganizationsQueryOptions,
|
|
3705
|
+
getListOrganizationsUrl: () => getListOrganizationsUrl,
|
|
3706
|
+
getOrganization: () => getOrganization,
|
|
3707
|
+
getUpdateOrganizationMutationOptions: () => getUpdateOrganizationMutationOptions,
|
|
3708
|
+
getUpdateOrganizationUrl: () => getUpdateOrganizationUrl,
|
|
3709
|
+
listOrganizations: () => listOrganizations,
|
|
3710
|
+
updateOrganization: () => updateOrganization,
|
|
3711
|
+
useCreateOrganization: () => useCreateOrganization,
|
|
3712
|
+
useDeleteOrganization: () => useDeleteOrganization,
|
|
3713
|
+
useGetOrganization: () => useGetOrganization,
|
|
3714
|
+
useListOrganizations: () => useListOrganizations,
|
|
3715
|
+
useUpdateOrganization: () => useUpdateOrganization
|
|
3716
|
+
});
|
|
3717
|
+
const withQueryKey$1 = (query, queryKey) => {
|
|
3718
|
+
const result = { queryKey };
|
|
3719
|
+
for (const key of Object.keys(query)) {
|
|
3720
|
+
if (key === "queryKey") continue;
|
|
3721
|
+
Object.defineProperty(result, key, {
|
|
3722
|
+
enumerable: true,
|
|
3723
|
+
configurable: true,
|
|
3724
|
+
get: () => query[key]
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
return result;
|
|
3728
|
+
};
|
|
3729
|
+
const getListOrganizationsUrl = () => {
|
|
3730
|
+
return `/organizations`;
|
|
3731
|
+
};
|
|
3732
|
+
/**
|
|
3733
|
+
* Lists all organizations owned by the authenticated user.
|
|
3734
|
+
* @summary List organizations
|
|
3735
|
+
*/
|
|
3736
|
+
const listOrganizations = async (options) => {
|
|
3737
|
+
return customFetch(getListOrganizationsUrl(), {
|
|
3738
|
+
...options,
|
|
3739
|
+
method: "GET"
|
|
3740
|
+
});
|
|
3741
|
+
};
|
|
3742
|
+
const getListOrganizationsQueryKey = () => {
|
|
3743
|
+
return [`/organizations`];
|
|
3744
|
+
};
|
|
3745
|
+
const getListOrganizationsQueryOptions = (options) => {
|
|
3746
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
3747
|
+
const queryKey = queryOptions?.queryKey ?? getListOrganizationsQueryKey();
|
|
3748
|
+
const queryFn = ({ signal }) => listOrganizations({
|
|
3749
|
+
signal,
|
|
3750
|
+
...requestOptions
|
|
3751
|
+
});
|
|
3752
|
+
return {
|
|
3753
|
+
queryKey,
|
|
3754
|
+
queryFn,
|
|
3755
|
+
...queryOptions
|
|
3756
|
+
};
|
|
3757
|
+
};
|
|
3758
|
+
/**
|
|
3759
|
+
* @summary List organizations
|
|
3760
|
+
*/
|
|
3761
|
+
function useListOrganizations(options, queryClient) {
|
|
3762
|
+
const queryOptions = getListOrganizationsQueryOptions(options);
|
|
3763
|
+
const query = useQuery(queryOptions, queryClient);
|
|
3764
|
+
return withQueryKey$1(query, queryOptions.queryKey);
|
|
3765
|
+
}
|
|
3766
|
+
const getCreateOrganizationUrl = () => {
|
|
3767
|
+
return `/organizations`;
|
|
3768
|
+
};
|
|
3769
|
+
/**
|
|
3770
|
+
* Creates a new organization with the authenticated user as the owner.
|
|
3771
|
+
* @summary Create organization
|
|
3772
|
+
*/
|
|
3773
|
+
const createOrganization = async (createOrganizationRequest, options) => {
|
|
3774
|
+
return customFetch(getCreateOrganizationUrl(), {
|
|
3775
|
+
...options,
|
|
3776
|
+
method: "POST",
|
|
3777
|
+
headers: {
|
|
3778
|
+
"Content-Type": "application/json",
|
|
3779
|
+
...options?.headers
|
|
3780
|
+
},
|
|
3781
|
+
body: JSON.stringify(createOrganizationRequest)
|
|
3782
|
+
});
|
|
3783
|
+
};
|
|
3784
|
+
const getCreateOrganizationMutationOptions = (options) => {
|
|
3785
|
+
const mutationKey = ["createOrganization"];
|
|
3786
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3787
|
+
...options,
|
|
3788
|
+
mutation: {
|
|
3789
|
+
...options.mutation,
|
|
3790
|
+
mutationKey
|
|
3791
|
+
}
|
|
3792
|
+
} : {
|
|
3793
|
+
mutation: { mutationKey },
|
|
3794
|
+
request: void 0
|
|
3795
|
+
};
|
|
3796
|
+
const mutationFn = (props) => {
|
|
3797
|
+
const { data } = props ?? {};
|
|
3798
|
+
return createOrganization(data, requestOptions);
|
|
3799
|
+
};
|
|
3800
|
+
return {
|
|
3801
|
+
mutationFn,
|
|
3802
|
+
...mutationOptions
|
|
3803
|
+
};
|
|
3804
|
+
};
|
|
3805
|
+
/**
|
|
3806
|
+
* @summary Create organization
|
|
3807
|
+
*/
|
|
3808
|
+
const useCreateOrganization = (options, queryClient) => {
|
|
3809
|
+
return useMutation(getCreateOrganizationMutationOptions(options), queryClient);
|
|
3810
|
+
};
|
|
3811
|
+
const getGetOrganizationUrl = (organizationId) => {
|
|
3812
|
+
return `/organizations/${organizationId}`;
|
|
3813
|
+
};
|
|
3814
|
+
/**
|
|
3815
|
+
* Retrieves an organization by its ID.
|
|
3816
|
+
* @summary Get organization
|
|
3817
|
+
*/
|
|
3818
|
+
const getOrganization = async (organizationId, options) => {
|
|
3819
|
+
return customFetch(getGetOrganizationUrl(organizationId), {
|
|
3820
|
+
...options,
|
|
3821
|
+
method: "GET"
|
|
3822
|
+
});
|
|
3823
|
+
};
|
|
3824
|
+
const getGetOrganizationQueryKey = (organizationId) => {
|
|
3825
|
+
return [`/organizations/${organizationId}`];
|
|
3826
|
+
};
|
|
3827
|
+
const getGetOrganizationQueryOptions = (organizationId, options) => {
|
|
3828
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
3829
|
+
const queryKey = queryOptions?.queryKey ?? getGetOrganizationQueryKey(organizationId);
|
|
3830
|
+
const queryFn = ({ signal }) => getOrganization(organizationId, {
|
|
3831
|
+
signal,
|
|
3832
|
+
...requestOptions
|
|
3833
|
+
});
|
|
3834
|
+
return {
|
|
3835
|
+
queryKey,
|
|
3836
|
+
queryFn,
|
|
3837
|
+
enabled: organizationId !== null && organizationId !== void 0,
|
|
3838
|
+
...queryOptions
|
|
3839
|
+
};
|
|
3840
|
+
};
|
|
3841
|
+
/**
|
|
3842
|
+
* @summary Get organization
|
|
3843
|
+
*/
|
|
3844
|
+
function useGetOrganization(organizationId, options, queryClient) {
|
|
3845
|
+
const queryOptions = getGetOrganizationQueryOptions(organizationId, options);
|
|
3846
|
+
const query = useQuery(queryOptions, queryClient);
|
|
3847
|
+
return withQueryKey$1(query, queryOptions.queryKey);
|
|
3848
|
+
}
|
|
3849
|
+
const getDeleteOrganizationUrl = (organizationId) => {
|
|
3850
|
+
return `/organizations/${organizationId}`;
|
|
3851
|
+
};
|
|
3852
|
+
/**
|
|
3853
|
+
* Deletes an organization.
|
|
3854
|
+
* @summary Delete organization
|
|
3855
|
+
*/
|
|
3856
|
+
const deleteOrganization = async (organizationId, options) => {
|
|
3857
|
+
return customFetch(getDeleteOrganizationUrl(organizationId), {
|
|
3858
|
+
...options,
|
|
3859
|
+
method: "DELETE"
|
|
3860
|
+
});
|
|
3861
|
+
};
|
|
3862
|
+
const getDeleteOrganizationMutationOptions = (options) => {
|
|
3863
|
+
const mutationKey = ["deleteOrganization"];
|
|
3864
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3865
|
+
...options,
|
|
3866
|
+
mutation: {
|
|
3867
|
+
...options.mutation,
|
|
3868
|
+
mutationKey
|
|
3869
|
+
}
|
|
3870
|
+
} : {
|
|
3871
|
+
mutation: { mutationKey },
|
|
3872
|
+
request: void 0
|
|
3873
|
+
};
|
|
3874
|
+
const mutationFn = (props) => {
|
|
3875
|
+
const { organizationId } = props ?? {};
|
|
3876
|
+
return deleteOrganization(organizationId, requestOptions);
|
|
3877
|
+
};
|
|
3878
|
+
return {
|
|
3879
|
+
mutationFn,
|
|
3880
|
+
...mutationOptions
|
|
3881
|
+
};
|
|
3882
|
+
};
|
|
3883
|
+
/**
|
|
3884
|
+
* @summary Delete organization
|
|
3885
|
+
*/
|
|
3886
|
+
const useDeleteOrganization = (options, queryClient) => {
|
|
3887
|
+
return useMutation(getDeleteOrganizationMutationOptions(options), queryClient);
|
|
3888
|
+
};
|
|
3889
|
+
const getUpdateOrganizationUrl = (organizationId) => {
|
|
3890
|
+
return `/organizations/${organizationId}`;
|
|
3891
|
+
};
|
|
3892
|
+
/**
|
|
3893
|
+
* Updates an existing organization.
|
|
3894
|
+
* @summary Update organization
|
|
3895
|
+
*/
|
|
3896
|
+
const updateOrganization = async (organizationId, updateOrganizationRequest, options) => {
|
|
3897
|
+
return customFetch(getUpdateOrganizationUrl(organizationId), {
|
|
3898
|
+
...options,
|
|
3899
|
+
method: "PATCH",
|
|
3900
|
+
headers: {
|
|
3901
|
+
"Content-Type": "application/json",
|
|
3902
|
+
...options?.headers
|
|
3903
|
+
},
|
|
3904
|
+
body: JSON.stringify(updateOrganizationRequest)
|
|
3905
|
+
});
|
|
3906
|
+
};
|
|
3907
|
+
const getUpdateOrganizationMutationOptions = (options) => {
|
|
3908
|
+
const mutationKey = ["updateOrganization"];
|
|
3909
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
3910
|
+
...options,
|
|
3911
|
+
mutation: {
|
|
3912
|
+
...options.mutation,
|
|
3913
|
+
mutationKey
|
|
3914
|
+
}
|
|
3915
|
+
} : {
|
|
3916
|
+
mutation: { mutationKey },
|
|
3917
|
+
request: void 0
|
|
3918
|
+
};
|
|
3919
|
+
const mutationFn = (props) => {
|
|
3920
|
+
const { organizationId, data } = props ?? {};
|
|
3921
|
+
return updateOrganization(organizationId, data, requestOptions);
|
|
3922
|
+
};
|
|
3923
|
+
return {
|
|
3924
|
+
mutationFn,
|
|
3925
|
+
...mutationOptions
|
|
3926
|
+
};
|
|
3927
|
+
};
|
|
3928
|
+
/**
|
|
3929
|
+
* @summary Update organization
|
|
3930
|
+
*/
|
|
3931
|
+
const useUpdateOrganization = (options, queryClient) => {
|
|
3932
|
+
return useMutation(getUpdateOrganizationMutationOptions(options), queryClient);
|
|
3933
|
+
};
|
|
3934
|
+
|
|
526
3935
|
//#endregion
|
|
527
3936
|
//#region src/plugins/organizations/plugin.ts
|
|
528
3937
|
var OrganizationsPlugin = class {
|
|
529
3938
|
id = "organizations";
|
|
530
3939
|
init(client) {
|
|
531
|
-
return
|
|
532
|
-
createOrganization: async (data) => {
|
|
533
|
-
return wrappedFetch(client, "/organizations", {
|
|
534
|
-
method: "POST",
|
|
535
|
-
body: data
|
|
536
|
-
});
|
|
537
|
-
},
|
|
538
|
-
getAllOrganizations: async () => {
|
|
539
|
-
return wrappedFetch(client, "/organizations", { method: "GET" });
|
|
540
|
-
},
|
|
541
|
-
getOrganizationById: async (organizationId) => {
|
|
542
|
-
return wrappedFetch(client, `/organizations/${organizationId}`, { method: "GET" });
|
|
543
|
-
},
|
|
544
|
-
updateOrganization: async (organizationId, data) => {
|
|
545
|
-
return wrappedFetch(client, `/organizations/${organizationId}`, {
|
|
546
|
-
method: "PATCH",
|
|
547
|
-
body: data
|
|
548
|
-
});
|
|
549
|
-
},
|
|
550
|
-
deleteOrganization: async (organizationId) => {
|
|
551
|
-
return wrappedFetch(client, `/organizations/${organizationId}`, { method: "DELETE" });
|
|
552
|
-
},
|
|
553
|
-
createOrganizationInvitation: async (organizationId, data) => {
|
|
554
|
-
return wrappedFetch(client, `/organizations/${organizationId}/invitations`, {
|
|
555
|
-
method: "POST",
|
|
556
|
-
body: data
|
|
557
|
-
});
|
|
558
|
-
},
|
|
559
|
-
getAllOrganizationInvitations: async (organizationId) => {
|
|
560
|
-
return wrappedFetch(client, `/organizations/${organizationId}/invitations`, { method: "GET" });
|
|
561
|
-
},
|
|
562
|
-
getOrganizationInvitation: async (organizationId, invitationId) => {
|
|
563
|
-
return wrappedFetch(client, `/organizations/${organizationId}/invitations/${invitationId}`, { method: "GET" });
|
|
564
|
-
},
|
|
565
|
-
revokeOrganizationInvitation: async (organizationId, invitationId) => {
|
|
566
|
-
return wrappedFetch(client, `/organizations/${organizationId}/invitations/${invitationId}`, { method: "PATCH" });
|
|
567
|
-
},
|
|
568
|
-
acceptOrganizationInvitation: async (organizationId, invitationId, data) => {
|
|
569
|
-
return wrappedFetch(client, `/organizations/${organizationId}/invitations/${invitationId}/accept`, {
|
|
570
|
-
method: "POST",
|
|
571
|
-
body: data
|
|
572
|
-
});
|
|
573
|
-
},
|
|
574
|
-
rejectOrganizationInvitation: async (organizationId, invitationId) => {
|
|
575
|
-
return wrappedFetch(client, `/organizations/${organizationId}/invitations/${invitationId}/reject`, { method: "POST" });
|
|
576
|
-
},
|
|
577
|
-
addOrganizationMember: async (organizationId, data) => {
|
|
578
|
-
return wrappedFetch(client, `/organizations/${organizationId}/members`, {
|
|
579
|
-
method: "POST",
|
|
580
|
-
body: data
|
|
581
|
-
});
|
|
582
|
-
},
|
|
583
|
-
getAllOrganizationMembers: async (organizationId) => {
|
|
584
|
-
return wrappedFetch(client, `/organizations/${organizationId}/members`, { method: "GET" });
|
|
585
|
-
},
|
|
586
|
-
getOrganizationMember: async (organizationId, memberId) => {
|
|
587
|
-
return wrappedFetch(client, `/organizations/${organizationId}/members/${memberId}`, { method: "GET" });
|
|
588
|
-
},
|
|
589
|
-
updateOrganizationMember: async (organizationId, memberId, data) => {
|
|
590
|
-
return wrappedFetch(client, `/organizations/${organizationId}/members/${memberId}`, {
|
|
591
|
-
method: "PATCH",
|
|
592
|
-
body: data
|
|
593
|
-
});
|
|
594
|
-
},
|
|
595
|
-
deleteOrganizationMember: async (organizationId, memberId) => {
|
|
596
|
-
return wrappedFetch(client, `/organizations/${organizationId}/members/${memberId}`, { method: "DELETE" });
|
|
597
|
-
},
|
|
598
|
-
createOrganizationTeam: async (organizationId, data) => {
|
|
599
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams`, {
|
|
600
|
-
method: "POST",
|
|
601
|
-
body: data
|
|
602
|
-
});
|
|
603
|
-
},
|
|
604
|
-
getAllOrganizationTeams: async (organizationId) => {
|
|
605
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams`, { method: "GET" });
|
|
606
|
-
},
|
|
607
|
-
getOrganizationTeam: async (organizationId, teamId) => {
|
|
608
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams/${teamId}`, { method: "GET" });
|
|
609
|
-
},
|
|
610
|
-
updateOrganizationTeam: async (organizationId, teamId, data) => {
|
|
611
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams/${teamId}`, {
|
|
612
|
-
method: "PATCH",
|
|
613
|
-
body: data
|
|
614
|
-
});
|
|
615
|
-
},
|
|
616
|
-
deleteOrganizationTeam: async (organizationId, teamId) => {
|
|
617
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams/${teamId}`, { method: "DELETE" });
|
|
618
|
-
},
|
|
619
|
-
addOrganizationTeamMember: async (organizationId, teamId, data) => {
|
|
620
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams/${teamId}/members`, {
|
|
621
|
-
method: "POST",
|
|
622
|
-
body: data
|
|
623
|
-
});
|
|
624
|
-
},
|
|
625
|
-
getAllOrganizationTeamMembers: async (organizationId, teamId) => {
|
|
626
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams/${teamId}/members`, { method: "GET" });
|
|
627
|
-
},
|
|
628
|
-
getOrganizationTeamMember: async (organizationId, teamId, memberId) => {
|
|
629
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams/${teamId}/members/${memberId}`, { method: "GET" });
|
|
630
|
-
},
|
|
631
|
-
deleteOrganizationTeamMember: async (organizationId, teamId, memberId) => {
|
|
632
|
-
return wrappedFetch(client, `/organizations/${organizationId}/teams/${teamId}/members/${memberId}`, { method: "DELETE" });
|
|
633
|
-
}
|
|
634
|
-
};
|
|
3940
|
+
return wrapGenerated(organizations_exports, client);
|
|
635
3941
|
}
|
|
636
3942
|
};
|
|
637
3943
|
|
|
3944
|
+
//#endregion
|
|
3945
|
+
//#region src/gen/endpoints/totp-plugin/totp-plugin.ts
|
|
3946
|
+
var totp_plugin_exports = /* @__PURE__ */ __exportAll({
|
|
3947
|
+
disableTotp: () => disableTotp,
|
|
3948
|
+
enableTotp: () => enableTotp,
|
|
3949
|
+
generateTotpBackupCodes: () => generateTotpBackupCodes,
|
|
3950
|
+
getDisableTotpMutationOptions: () => getDisableTotpMutationOptions,
|
|
3951
|
+
getDisableTotpUrl: () => getDisableTotpUrl,
|
|
3952
|
+
getEnableTotpMutationOptions: () => getEnableTotpMutationOptions,
|
|
3953
|
+
getEnableTotpUrl: () => getEnableTotpUrl,
|
|
3954
|
+
getGenerateTotpBackupCodesMutationOptions: () => getGenerateTotpBackupCodesMutationOptions,
|
|
3955
|
+
getGenerateTotpBackupCodesUrl: () => getGenerateTotpBackupCodesUrl,
|
|
3956
|
+
getGetTotpURIQueryKey: () => getGetTotpURIQueryKey,
|
|
3957
|
+
getGetTotpURIQueryOptions: () => getGetTotpURIQueryOptions,
|
|
3958
|
+
getGetTotpURIUrl: () => getGetTotpURIUrl,
|
|
3959
|
+
getTotpURI: () => getTotpURI,
|
|
3960
|
+
getVerifyTotpBackupCodeMutationOptions: () => getVerifyTotpBackupCodeMutationOptions,
|
|
3961
|
+
getVerifyTotpBackupCodeUrl: () => getVerifyTotpBackupCodeUrl,
|
|
3962
|
+
getVerifyTotpMutationOptions: () => getVerifyTotpMutationOptions,
|
|
3963
|
+
getVerifyTotpUrl: () => getVerifyTotpUrl,
|
|
3964
|
+
useDisableTotp: () => useDisableTotp,
|
|
3965
|
+
useEnableTotp: () => useEnableTotp,
|
|
3966
|
+
useGenerateTotpBackupCodes: () => useGenerateTotpBackupCodes,
|
|
3967
|
+
useGetTotpURI: () => useGetTotpURI,
|
|
3968
|
+
useVerifyTotp: () => useVerifyTotp,
|
|
3969
|
+
useVerifyTotpBackupCode: () => useVerifyTotpBackupCode,
|
|
3970
|
+
verifyTotp: () => verifyTotp,
|
|
3971
|
+
verifyTotpBackupCode: () => verifyTotpBackupCode
|
|
3972
|
+
});
|
|
3973
|
+
const withQueryKey = (query, queryKey) => {
|
|
3974
|
+
const result = { queryKey };
|
|
3975
|
+
for (const key of Object.keys(query)) {
|
|
3976
|
+
if (key === "queryKey") continue;
|
|
3977
|
+
Object.defineProperty(result, key, {
|
|
3978
|
+
enumerable: true,
|
|
3979
|
+
configurable: true,
|
|
3980
|
+
get: () => query[key]
|
|
3981
|
+
});
|
|
3982
|
+
}
|
|
3983
|
+
return result;
|
|
3984
|
+
};
|
|
3985
|
+
const getDisableTotpUrl = () => {
|
|
3986
|
+
return `/totp/disable`;
|
|
3987
|
+
};
|
|
3988
|
+
/**
|
|
3989
|
+
* Disables TOTP two-factor authentication for the authenticated user.
|
|
3990
|
+
* @summary Disable TOTP
|
|
3991
|
+
*/
|
|
3992
|
+
const disableTotp = async (options) => {
|
|
3993
|
+
return customFetch(getDisableTotpUrl(), {
|
|
3994
|
+
...options,
|
|
3995
|
+
method: "POST"
|
|
3996
|
+
});
|
|
3997
|
+
};
|
|
3998
|
+
const getDisableTotpMutationOptions = (options) => {
|
|
3999
|
+
const mutationKey = ["disableTotp"];
|
|
4000
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
4001
|
+
...options,
|
|
4002
|
+
mutation: {
|
|
4003
|
+
...options.mutation,
|
|
4004
|
+
mutationKey
|
|
4005
|
+
}
|
|
4006
|
+
} : {
|
|
4007
|
+
mutation: { mutationKey },
|
|
4008
|
+
request: void 0
|
|
4009
|
+
};
|
|
4010
|
+
const mutationFn = () => {
|
|
4011
|
+
return disableTotp(requestOptions);
|
|
4012
|
+
};
|
|
4013
|
+
return {
|
|
4014
|
+
mutationFn,
|
|
4015
|
+
...mutationOptions
|
|
4016
|
+
};
|
|
4017
|
+
};
|
|
4018
|
+
/**
|
|
4019
|
+
* @summary Disable TOTP
|
|
4020
|
+
*/
|
|
4021
|
+
const useDisableTotp = (options, queryClient) => {
|
|
4022
|
+
return useMutation(getDisableTotpMutationOptions(options), queryClient);
|
|
4023
|
+
};
|
|
4024
|
+
const getEnableTotpUrl = () => {
|
|
4025
|
+
return `/totp/enable`;
|
|
4026
|
+
};
|
|
4027
|
+
/**
|
|
4028
|
+
* Enables TOTP two-factor authentication for the authenticated user. Returns the TOTP URI and backup codes.
|
|
4029
|
+
* @summary Enable TOTP
|
|
4030
|
+
*/
|
|
4031
|
+
const enableTotp = async (options) => {
|
|
4032
|
+
return customFetch(getEnableTotpUrl(), {
|
|
4033
|
+
...options,
|
|
4034
|
+
method: "POST"
|
|
4035
|
+
});
|
|
4036
|
+
};
|
|
4037
|
+
const getEnableTotpMutationOptions = (options) => {
|
|
4038
|
+
const mutationKey = ["enableTotp"];
|
|
4039
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
4040
|
+
...options,
|
|
4041
|
+
mutation: {
|
|
4042
|
+
...options.mutation,
|
|
4043
|
+
mutationKey
|
|
4044
|
+
}
|
|
4045
|
+
} : {
|
|
4046
|
+
mutation: { mutationKey },
|
|
4047
|
+
request: void 0
|
|
4048
|
+
};
|
|
4049
|
+
const mutationFn = () => {
|
|
4050
|
+
return enableTotp(requestOptions);
|
|
4051
|
+
};
|
|
4052
|
+
return {
|
|
4053
|
+
mutationFn,
|
|
4054
|
+
...mutationOptions
|
|
4055
|
+
};
|
|
4056
|
+
};
|
|
4057
|
+
/**
|
|
4058
|
+
* @summary Enable TOTP
|
|
4059
|
+
*/
|
|
4060
|
+
const useEnableTotp = (options, queryClient) => {
|
|
4061
|
+
return useMutation(getEnableTotpMutationOptions(options), queryClient);
|
|
4062
|
+
};
|
|
4063
|
+
const getGenerateTotpBackupCodesUrl = () => {
|
|
4064
|
+
return `/totp/generate-backup-codes`;
|
|
4065
|
+
};
|
|
4066
|
+
/**
|
|
4067
|
+
* Generates a new set of backup codes for the authenticated user. Previous backup codes are invalidated.
|
|
4068
|
+
* @summary Generate backup codes
|
|
4069
|
+
*/
|
|
4070
|
+
const generateTotpBackupCodes = async (options) => {
|
|
4071
|
+
return customFetch(getGenerateTotpBackupCodesUrl(), {
|
|
4072
|
+
...options,
|
|
4073
|
+
method: "POST"
|
|
4074
|
+
});
|
|
4075
|
+
};
|
|
4076
|
+
const getGenerateTotpBackupCodesMutationOptions = (options) => {
|
|
4077
|
+
const mutationKey = ["generateTotpBackupCodes"];
|
|
4078
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
4079
|
+
...options,
|
|
4080
|
+
mutation: {
|
|
4081
|
+
...options.mutation,
|
|
4082
|
+
mutationKey
|
|
4083
|
+
}
|
|
4084
|
+
} : {
|
|
4085
|
+
mutation: { mutationKey },
|
|
4086
|
+
request: void 0
|
|
4087
|
+
};
|
|
4088
|
+
const mutationFn = () => {
|
|
4089
|
+
return generateTotpBackupCodes(requestOptions);
|
|
4090
|
+
};
|
|
4091
|
+
return {
|
|
4092
|
+
mutationFn,
|
|
4093
|
+
...mutationOptions
|
|
4094
|
+
};
|
|
4095
|
+
};
|
|
4096
|
+
/**
|
|
4097
|
+
* @summary Generate backup codes
|
|
4098
|
+
*/
|
|
4099
|
+
const useGenerateTotpBackupCodes = (options, queryClient) => {
|
|
4100
|
+
return useMutation(getGenerateTotpBackupCodesMutationOptions(options), queryClient);
|
|
4101
|
+
};
|
|
4102
|
+
const getGetTotpURIUrl = () => {
|
|
4103
|
+
return `/totp/get-uri`;
|
|
4104
|
+
};
|
|
4105
|
+
/**
|
|
4106
|
+
* Returns the current TOTP URI for the authenticated user's authenticator app configuration.
|
|
4107
|
+
* @summary Get TOTP URI
|
|
4108
|
+
*/
|
|
4109
|
+
const getTotpURI = async (options) => {
|
|
4110
|
+
return customFetch(getGetTotpURIUrl(), {
|
|
4111
|
+
...options,
|
|
4112
|
+
method: "GET"
|
|
4113
|
+
});
|
|
4114
|
+
};
|
|
4115
|
+
const getGetTotpURIQueryKey = () => {
|
|
4116
|
+
return [`/totp/get-uri`];
|
|
4117
|
+
};
|
|
4118
|
+
const getGetTotpURIQueryOptions = (options) => {
|
|
4119
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
4120
|
+
const queryKey = queryOptions?.queryKey ?? getGetTotpURIQueryKey();
|
|
4121
|
+
const queryFn = ({ signal }) => getTotpURI({
|
|
4122
|
+
signal,
|
|
4123
|
+
...requestOptions
|
|
4124
|
+
});
|
|
4125
|
+
return {
|
|
4126
|
+
queryKey,
|
|
4127
|
+
queryFn,
|
|
4128
|
+
...queryOptions
|
|
4129
|
+
};
|
|
4130
|
+
};
|
|
4131
|
+
/**
|
|
4132
|
+
* @summary Get TOTP URI
|
|
4133
|
+
*/
|
|
4134
|
+
function useGetTotpURI(options, queryClient) {
|
|
4135
|
+
const queryOptions = getGetTotpURIQueryOptions(options);
|
|
4136
|
+
const query = useQuery(queryOptions, queryClient);
|
|
4137
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
4138
|
+
}
|
|
4139
|
+
const getVerifyTotpUrl = () => {
|
|
4140
|
+
return `/totp/verify`;
|
|
4141
|
+
};
|
|
4142
|
+
/**
|
|
4143
|
+
* Verifies a TOTP code from the authenticator app and completes authentication. Requires a pending TOTP cookie set during sign-in.
|
|
4144
|
+
* @summary Verify TOTP code
|
|
4145
|
+
*/
|
|
4146
|
+
const verifyTotp = async (verifyTOTPRequest, options) => {
|
|
4147
|
+
return customFetch(getVerifyTotpUrl(), {
|
|
4148
|
+
...options,
|
|
4149
|
+
method: "POST",
|
|
4150
|
+
headers: {
|
|
4151
|
+
"Content-Type": "application/json",
|
|
4152
|
+
...options?.headers
|
|
4153
|
+
},
|
|
4154
|
+
body: JSON.stringify(verifyTOTPRequest)
|
|
4155
|
+
});
|
|
4156
|
+
};
|
|
4157
|
+
const getVerifyTotpMutationOptions = (options) => {
|
|
4158
|
+
const mutationKey = ["verifyTotp"];
|
|
4159
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
4160
|
+
...options,
|
|
4161
|
+
mutation: {
|
|
4162
|
+
...options.mutation,
|
|
4163
|
+
mutationKey
|
|
4164
|
+
}
|
|
4165
|
+
} : {
|
|
4166
|
+
mutation: { mutationKey },
|
|
4167
|
+
request: void 0
|
|
4168
|
+
};
|
|
4169
|
+
const mutationFn = (props) => {
|
|
4170
|
+
const { data } = props ?? {};
|
|
4171
|
+
return verifyTotp(data, requestOptions);
|
|
4172
|
+
};
|
|
4173
|
+
return {
|
|
4174
|
+
mutationFn,
|
|
4175
|
+
...mutationOptions
|
|
4176
|
+
};
|
|
4177
|
+
};
|
|
4178
|
+
/**
|
|
4179
|
+
* @summary Verify TOTP code
|
|
4180
|
+
*/
|
|
4181
|
+
const useVerifyTotp = (options, queryClient) => {
|
|
4182
|
+
return useMutation(getVerifyTotpMutationOptions(options), queryClient);
|
|
4183
|
+
};
|
|
4184
|
+
const getVerifyTotpBackupCodeUrl = () => {
|
|
4185
|
+
return `/totp/verify-backup-code`;
|
|
4186
|
+
};
|
|
4187
|
+
/**
|
|
4188
|
+
* Verifies a backup code as an alternative to TOTP verification. Completes authentication if the code is valid.
|
|
4189
|
+
* @summary Verify backup code
|
|
4190
|
+
*/
|
|
4191
|
+
const verifyTotpBackupCode = async (verifyBackupCodeRequest, options) => {
|
|
4192
|
+
return customFetch(getVerifyTotpBackupCodeUrl(), {
|
|
4193
|
+
...options,
|
|
4194
|
+
method: "POST",
|
|
4195
|
+
headers: {
|
|
4196
|
+
"Content-Type": "application/json",
|
|
4197
|
+
...options?.headers
|
|
4198
|
+
},
|
|
4199
|
+
body: JSON.stringify(verifyBackupCodeRequest)
|
|
4200
|
+
});
|
|
4201
|
+
};
|
|
4202
|
+
const getVerifyTotpBackupCodeMutationOptions = (options) => {
|
|
4203
|
+
const mutationKey = ["verifyTotpBackupCode"];
|
|
4204
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
4205
|
+
...options,
|
|
4206
|
+
mutation: {
|
|
4207
|
+
...options.mutation,
|
|
4208
|
+
mutationKey
|
|
4209
|
+
}
|
|
4210
|
+
} : {
|
|
4211
|
+
mutation: { mutationKey },
|
|
4212
|
+
request: void 0
|
|
4213
|
+
};
|
|
4214
|
+
const mutationFn = (props) => {
|
|
4215
|
+
const { data } = props ?? {};
|
|
4216
|
+
return verifyTotpBackupCode(data, requestOptions);
|
|
4217
|
+
};
|
|
4218
|
+
return {
|
|
4219
|
+
mutationFn,
|
|
4220
|
+
...mutationOptions
|
|
4221
|
+
};
|
|
4222
|
+
};
|
|
4223
|
+
/**
|
|
4224
|
+
* @summary Verify backup code
|
|
4225
|
+
*/
|
|
4226
|
+
const useVerifyTotpBackupCode = (options, queryClient) => {
|
|
4227
|
+
return useMutation(getVerifyTotpBackupCodeMutationOptions(options), queryClient);
|
|
4228
|
+
};
|
|
4229
|
+
|
|
638
4230
|
//#endregion
|
|
639
4231
|
//#region src/plugins/totp/plugin.ts
|
|
640
4232
|
var TOTPPlugin = class {
|
|
641
4233
|
id = "totp";
|
|
642
4234
|
init(client) {
|
|
643
|
-
return
|
|
644
|
-
enable: async () => {
|
|
645
|
-
return wrappedFetch(client, "/totp/enable", { method: "POST" });
|
|
646
|
-
},
|
|
647
|
-
disable: async () => {
|
|
648
|
-
return wrappedFetch(client, "/totp/disable", { method: "POST" });
|
|
649
|
-
},
|
|
650
|
-
getUri: async () => {
|
|
651
|
-
return wrappedFetch(client, "/totp/get-uri", { method: "GET" });
|
|
652
|
-
},
|
|
653
|
-
verify: async (data) => {
|
|
654
|
-
return wrappedFetch(client, "/totp/verify", {
|
|
655
|
-
method: "POST",
|
|
656
|
-
body: data
|
|
657
|
-
});
|
|
658
|
-
},
|
|
659
|
-
verifyBackupCode: async (data) => {
|
|
660
|
-
return wrappedFetch(client, "/totp/verify-backup-code", {
|
|
661
|
-
method: "POST",
|
|
662
|
-
body: data
|
|
663
|
-
});
|
|
664
|
-
},
|
|
665
|
-
generateBackupCodes: async () => {
|
|
666
|
-
return wrappedFetch(client, "/totp/generate-backup-codes", { method: "POST" });
|
|
667
|
-
}
|
|
668
|
-
};
|
|
4235
|
+
return wrapGenerated(totp_plugin_exports, client);
|
|
669
4236
|
}
|
|
670
4237
|
};
|
|
671
4238
|
|
|
672
4239
|
//#endregion
|
|
673
|
-
export { AccessControlPlugin, AdminPlugin, BearerPlugin, CSRFPlugin, EmailPasswordPlugin, JWTPlugin, MagicLinkPlugin, OAuth2Plugin, OrganizationsPlugin, TOTPPlugin
|
|
4240
|
+
export { AccessControlPlugin, AdminPlugin, ApiKeyPlugin, BearerPlugin, CSRFPlugin, CorePlugin, EmailPasswordPlugin, JWTPlugin, MagicLinkPlugin, OAuth2Plugin, OrganizationsPlugin, TOTPPlugin };
|
|
674
4241
|
//# sourceMappingURL=index.js.map
|