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