authula 0.7.16 → 0.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of authula might be problematic. Click here for more details.

Files changed (40) hide show
  1. package/README.md +196 -40
  2. package/dist/{index.js → core-Csdt31Tx.js} +6 -17
  3. package/dist/core-Csdt31Tx.js.map +1 -0
  4. package/dist/core.d.ts +2 -0
  5. package/dist/core.js +4 -0
  6. package/dist/{custom-fetch-CXJ4-i7I.js → custom-fetch-DJxn7nVP.js} +26 -10
  7. package/dist/custom-fetch-DJxn7nVP.js.map +1 -0
  8. package/dist/framework-client-CsGjKPXl.d.ts +8 -0
  9. package/dist/framework-client-D-yGjqAx.js +50 -0
  10. package/dist/framework-client-D-yGjqAx.js.map +1 -0
  11. package/dist/{index-xeVPFZn7.d.ts → index-Cuok0NWW.d.ts} +2 -448
  12. package/dist/models.d.ts +2 -0
  13. package/dist/models.js +11 -0
  14. package/dist/models.js.map +1 -0
  15. package/dist/plugins.d.ts +513 -0
  16. package/dist/plugins.js +2472 -0
  17. package/dist/plugins.js.map +1 -0
  18. package/dist/react.d.ts +3728 -0
  19. package/dist/{plugins/index.js → react.js} +975 -1256
  20. package/dist/react.js.map +1 -0
  21. package/dist/{rolldown-runtime-w6R9maHv.js → rolldown-runtime-CNh9ExCG.js} +1 -2
  22. package/dist/sdk-Cu28BXFh.d.ts +102 -0
  23. package/dist/solid.d.ts +3955 -0
  24. package/dist/solid.js +5461 -0
  25. package/dist/solid.js.map +1 -0
  26. package/dist/svelte.d.ts +3368 -0
  27. package/dist/svelte.js +5500 -0
  28. package/dist/svelte.js.map +1 -0
  29. package/dist/vue.d.ts +3289 -0
  30. package/dist/vue.js +5644 -0
  31. package/dist/vue.js.map +1 -0
  32. package/dist/zod.d.ts +3862 -0
  33. package/dist/zod.js +1480 -0
  34. package/dist/zod.js.map +1 -0
  35. package/package.json +61 -9
  36. package/dist/custom-fetch-CXJ4-i7I.js.map +0 -1
  37. package/dist/index.d.ts +0 -2
  38. package/dist/index.js.map +0 -1
  39. package/dist/plugins/index.d.ts +0 -4908
  40. package/dist/plugins/index.js.map +0 -1
@@ -0,0 +1,2472 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-CNh9ExCG.js";
2
+ import { n as customFetch } from "./custom-fetch-DJxn7nVP.js";
3
+
4
+ // src/core/utils/wrap-generated.ts
5
+ function wrapGenerated(mod, client) {
6
+ const baseUrl = client.config.url.replace(/\/+$/, "");
7
+ const cookies = client.config.cookies;
8
+ const onBeforeFetch = (ctx) => client.runBeforeFetch(ctx);
9
+ const onAfterFetch = (ctx, res) => client.runAfterFetch(ctx, res);
10
+ const wrapped = {};
11
+ for (const [key, value] of Object.entries(mod)) {
12
+ if (typeof value !== "function") {
13
+ wrapped[key] = value;
14
+ continue;
15
+ }
16
+ wrapped[key] = (...args) => {
17
+ const ctx = {
18
+ baseUrl,
19
+ cookies,
20
+ onBeforeFetch,
21
+ onAfterFetch
22
+ };
23
+ const optionsIdx = value.length - 1;
24
+ while (args.length < optionsIdx) args.push(void 0);
25
+ if (optionsIdx >= 0 && args.length === optionsIdx) args.push(ctx);
26
+ else if (optionsIdx >= 0) args[optionsIdx] = {
27
+ ...args[optionsIdx],
28
+ ...ctx
29
+ };
30
+ return value(...args);
31
+ };
32
+ }
33
+ return wrapped;
34
+ }
35
+
36
+ // src/gen/endpoints/access-control/access-control.ts
37
+ var access_control_exports = /* @__PURE__ */ __exportAll({
38
+ addRolePermission: () => addRolePermission,
39
+ assignUserRole: () => assignUserRole,
40
+ checkUserPermissions: () => checkUserPermissions,
41
+ createPermission: () => createPermission,
42
+ createRole: () => createRole,
43
+ deletePermission: () => deletePermission,
44
+ deleteRole: () => deleteRole,
45
+ getAddRolePermissionUrl: () => getAddRolePermissionUrl,
46
+ getAssignUserRoleUrl: () => getAssignUserRoleUrl,
47
+ getCheckUserPermissionsUrl: () => getCheckUserPermissionsUrl,
48
+ getCreatePermissionUrl: () => getCreatePermissionUrl,
49
+ getCreateRoleUrl: () => getCreateRoleUrl,
50
+ getDeletePermissionUrl: () => getDeletePermissionUrl,
51
+ getDeleteRoleUrl: () => getDeleteRoleUrl,
52
+ getGetPermissionByKeyUrl: () => getGetPermissionByKeyUrl,
53
+ getGetPermissionUrl: () => getGetPermissionUrl,
54
+ getGetRoleByNameUrl: () => getGetRoleByNameUrl,
55
+ getGetRoleUrl: () => getGetRoleUrl,
56
+ getGetUserPermissionsUrl: () => getGetUserPermissionsUrl,
57
+ getListPermissionsUrl: () => getListPermissionsUrl,
58
+ getListRolePermissionsUrl: () => getListRolePermissionsUrl,
59
+ getListRolesUrl: () => getListRolesUrl,
60
+ getListUserRolesUrl: () => getListUserRolesUrl,
61
+ getPermission: () => getPermission,
62
+ getPermissionByKey: () => getPermissionByKey,
63
+ getRemoveRolePermissionUrl: () => getRemoveRolePermissionUrl,
64
+ getRemoveUserRoleUrl: () => getRemoveUserRoleUrl,
65
+ getReplaceRolePermissionsUrl: () => getReplaceRolePermissionsUrl,
66
+ getReplaceUserRolesUrl: () => getReplaceUserRolesUrl,
67
+ getRole: () => getRole,
68
+ getRoleByName: () => getRoleByName,
69
+ getUpdatePermissionUrl: () => getUpdatePermissionUrl,
70
+ getUpdateRoleUrl: () => getUpdateRoleUrl,
71
+ getUserPermissions: () => getUserPermissions,
72
+ listPermissions: () => listPermissions,
73
+ listRolePermissions: () => listRolePermissions,
74
+ listRoles: () => listRoles,
75
+ listUserRoles: () => listUserRoles,
76
+ removeRolePermission: () => removeRolePermission,
77
+ removeUserRole: () => removeUserRole,
78
+ replaceRolePermissions: () => replaceRolePermissions,
79
+ replaceUserRoles: () => replaceUserRoles,
80
+ updatePermission: () => updatePermission,
81
+ updateRole: () => updateRole
82
+ });
83
+ const getListPermissionsUrl = () => {
84
+ return `/access-control/permissions`;
85
+ };
86
+ /**
87
+ * Lists all permissions.
88
+ * @summary List permissions
89
+ */
90
+ const listPermissions = async (options) => {
91
+ return customFetch(getListPermissionsUrl(), {
92
+ ...options,
93
+ method: "GET"
94
+ });
95
+ };
96
+ const getCreatePermissionUrl = () => {
97
+ return `/access-control/permissions`;
98
+ };
99
+ /**
100
+ * Creates a new permission.
101
+ * @summary Create permission
102
+ */
103
+ const createPermission = async (createPermissionRequest, options) => {
104
+ const getHeaders = (h) => {
105
+ if (!h) return {};
106
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
107
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
108
+ const headers = {};
109
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
110
+ return headers;
111
+ };
112
+ return customFetch(getCreatePermissionUrl(), {
113
+ ...options,
114
+ method: "POST",
115
+ headers: {
116
+ "Content-Type": "application/json",
117
+ ...getHeaders(options?.headers)
118
+ },
119
+ body: JSON.stringify(createPermissionRequest)
120
+ });
121
+ };
122
+ const getGetPermissionByKeyUrl = (permissionKey) => {
123
+ return `/access-control/permissions/by-key/${permissionKey}`;
124
+ };
125
+ /**
126
+ * Retrieves a permission by its key.
127
+ * @summary Get permission by key
128
+ */
129
+ const getPermissionByKey = async (permissionKey, options) => {
130
+ return customFetch(getGetPermissionByKeyUrl(permissionKey), {
131
+ ...options,
132
+ method: "GET"
133
+ });
134
+ };
135
+ const getGetPermissionUrl = (permissionId) => {
136
+ return `/access-control/permissions/${permissionId}`;
137
+ };
138
+ /**
139
+ * Retrieves a permission by its ID.
140
+ * @summary Get permission by ID
141
+ */
142
+ const getPermission = async (permissionId, options) => {
143
+ return customFetch(getGetPermissionUrl(permissionId), {
144
+ ...options,
145
+ method: "GET"
146
+ });
147
+ };
148
+ const getDeletePermissionUrl = (permissionId) => {
149
+ return `/access-control/permissions/${permissionId}`;
150
+ };
151
+ /**
152
+ * Deletes a permission.
153
+ * @summary Delete permission
154
+ */
155
+ const deletePermission = async (permissionId, options) => {
156
+ return customFetch(getDeletePermissionUrl(permissionId), {
157
+ ...options,
158
+ method: "DELETE"
159
+ });
160
+ };
161
+ const getUpdatePermissionUrl = (permissionId) => {
162
+ return `/access-control/permissions/${permissionId}`;
163
+ };
164
+ /**
165
+ * Updates a permission's description.
166
+ * @summary Update permission
167
+ */
168
+ const updatePermission = async (permissionId, updatePermissionRequest, options) => {
169
+ const getHeaders = (h) => {
170
+ if (!h) return {};
171
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
172
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
173
+ const headers = {};
174
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
175
+ return headers;
176
+ };
177
+ return customFetch(getUpdatePermissionUrl(permissionId), {
178
+ ...options,
179
+ method: "PATCH",
180
+ headers: {
181
+ "Content-Type": "application/json",
182
+ ...getHeaders(options?.headers)
183
+ },
184
+ body: JSON.stringify(updatePermissionRequest)
185
+ });
186
+ };
187
+ const getListRolesUrl = () => {
188
+ return `/access-control/roles`;
189
+ };
190
+ /**
191
+ * Lists all roles.
192
+ * @summary List roles
193
+ */
194
+ const listRoles = async (options) => {
195
+ return customFetch(getListRolesUrl(), {
196
+ ...options,
197
+ method: "GET"
198
+ });
199
+ };
200
+ const getCreateRoleUrl = () => {
201
+ return `/access-control/roles`;
202
+ };
203
+ /**
204
+ * Creates a new role.
205
+ * @summary Create role
206
+ */
207
+ const createRole = async (createRoleRequest, options) => {
208
+ const getHeaders = (h) => {
209
+ if (!h) return {};
210
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
211
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
212
+ const headers = {};
213
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
214
+ return headers;
215
+ };
216
+ return customFetch(getCreateRoleUrl(), {
217
+ ...options,
218
+ method: "POST",
219
+ headers: {
220
+ "Content-Type": "application/json",
221
+ ...getHeaders(options?.headers)
222
+ },
223
+ body: JSON.stringify(createRoleRequest)
224
+ });
225
+ };
226
+ const getGetRoleByNameUrl = (roleName) => {
227
+ return `/access-control/roles/by-name/${roleName}`;
228
+ };
229
+ /**
230
+ * Retrieves a role by its name.
231
+ * @summary Get role by name
232
+ */
233
+ const getRoleByName = async (roleName, options) => {
234
+ return customFetch(getGetRoleByNameUrl(roleName), {
235
+ ...options,
236
+ method: "GET"
237
+ });
238
+ };
239
+ const getGetRoleUrl = (roleId) => {
240
+ return `/access-control/roles/${roleId}`;
241
+ };
242
+ /**
243
+ * Retrieves a role by its ID, including its permissions.
244
+ * @summary Get role by ID
245
+ */
246
+ const getRole = async (roleId, options) => {
247
+ return customFetch(getGetRoleUrl(roleId), {
248
+ ...options,
249
+ method: "GET"
250
+ });
251
+ };
252
+ const getDeleteRoleUrl = (roleId) => {
253
+ return `/access-control/roles/${roleId}`;
254
+ };
255
+ /**
256
+ * Deletes a role.
257
+ * @summary Delete role
258
+ */
259
+ const deleteRole = async (roleId, options) => {
260
+ return customFetch(getDeleteRoleUrl(roleId), {
261
+ ...options,
262
+ method: "DELETE"
263
+ });
264
+ };
265
+ const getUpdateRoleUrl = (roleId) => {
266
+ return `/access-control/roles/${roleId}`;
267
+ };
268
+ /**
269
+ * Updates a role's attributes.
270
+ * @summary Update role
271
+ */
272
+ const updateRole = async (roleId, updateRoleRequest, options) => {
273
+ const getHeaders = (h) => {
274
+ if (!h) return {};
275
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
276
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
277
+ const headers = {};
278
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
279
+ return headers;
280
+ };
281
+ return customFetch(getUpdateRoleUrl(roleId), {
282
+ ...options,
283
+ method: "PATCH",
284
+ headers: {
285
+ "Content-Type": "application/json",
286
+ ...getHeaders(options?.headers)
287
+ },
288
+ body: JSON.stringify(updateRoleRequest)
289
+ });
290
+ };
291
+ const getListRolePermissionsUrl = (roleId) => {
292
+ return `/access-control/roles/${roleId}/permissions`;
293
+ };
294
+ /**
295
+ * Lists all permissions assigned to a role.
296
+ * @summary List role permissions
297
+ */
298
+ const listRolePermissions = async (roleId, options) => {
299
+ return customFetch(getListRolePermissionsUrl(roleId), {
300
+ ...options,
301
+ method: "GET"
302
+ });
303
+ };
304
+ const getReplaceRolePermissionsUrl = (roleId) => {
305
+ return `/access-control/roles/${roleId}/permissions`;
306
+ };
307
+ /**
308
+ * Replaces all permissions assigned to a role with a new set.
309
+ * @summary Replace role permissions
310
+ */
311
+ const replaceRolePermissions = async (roleId, replaceRolePermissionsRequest, options) => {
312
+ const getHeaders = (h) => {
313
+ if (!h) return {};
314
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
315
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
316
+ const headers = {};
317
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
318
+ return headers;
319
+ };
320
+ return customFetch(getReplaceRolePermissionsUrl(roleId), {
321
+ ...options,
322
+ method: "PUT",
323
+ headers: {
324
+ "Content-Type": "application/json",
325
+ ...getHeaders(options?.headers)
326
+ },
327
+ body: JSON.stringify(replaceRolePermissionsRequest)
328
+ });
329
+ };
330
+ const getAddRolePermissionUrl = (roleId) => {
331
+ return `/access-control/roles/${roleId}/permissions`;
332
+ };
333
+ /**
334
+ * Assigns a permission to a role.
335
+ * @summary Assign permission to role
336
+ */
337
+ const addRolePermission = async (roleId, addRolePermissionRequest, options) => {
338
+ const getHeaders = (h) => {
339
+ if (!h) return {};
340
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
341
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
342
+ const headers = {};
343
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
344
+ return headers;
345
+ };
346
+ return customFetch(getAddRolePermissionUrl(roleId), {
347
+ ...options,
348
+ method: "POST",
349
+ headers: {
350
+ "Content-Type": "application/json",
351
+ ...getHeaders(options?.headers)
352
+ },
353
+ body: JSON.stringify(addRolePermissionRequest)
354
+ });
355
+ };
356
+ const getRemoveRolePermissionUrl = (roleId, permissionId) => {
357
+ return `/access-control/roles/${roleId}/permissions/${permissionId}`;
358
+ };
359
+ /**
360
+ * Removes a permission from a role.
361
+ * @summary Remove role permission
362
+ */
363
+ const removeRolePermission = async (roleId, permissionId, options) => {
364
+ return customFetch(getRemoveRolePermissionUrl(roleId, permissionId), {
365
+ ...options,
366
+ method: "DELETE"
367
+ });
368
+ };
369
+ const getGetUserPermissionsUrl = (userId) => {
370
+ return `/access-control/users/${userId}/permissions`;
371
+ };
372
+ /**
373
+ * Retrieves all permissions granted to a user through their roles.
374
+ * @summary Get user permissions
375
+ */
376
+ const getUserPermissions = async (userId, options) => {
377
+ return customFetch(getGetUserPermissionsUrl(userId), {
378
+ ...options,
379
+ method: "GET"
380
+ });
381
+ };
382
+ const getCheckUserPermissionsUrl = (userId) => {
383
+ return `/access-control/users/${userId}/permissions/check`;
384
+ };
385
+ /**
386
+ * Checks whether a user has all the specified permissions.
387
+ * @summary Check user permissions
388
+ */
389
+ const checkUserPermissions = async (userId, checkUserPermissionsRequest, options) => {
390
+ const getHeaders = (h) => {
391
+ if (!h) return {};
392
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
393
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
394
+ const headers = {};
395
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
396
+ return headers;
397
+ };
398
+ return customFetch(getCheckUserPermissionsUrl(userId), {
399
+ ...options,
400
+ method: "POST",
401
+ headers: {
402
+ "Content-Type": "application/json",
403
+ ...getHeaders(options?.headers)
404
+ },
405
+ body: JSON.stringify(checkUserPermissionsRequest)
406
+ });
407
+ };
408
+ const getListUserRolesUrl = (userId) => {
409
+ return `/access-control/users/${userId}/roles`;
410
+ };
411
+ /**
412
+ * Lists all roles assigned to a user.
413
+ * @summary List user roles
414
+ */
415
+ const listUserRoles = async (userId, options) => {
416
+ return customFetch(getListUserRolesUrl(userId), {
417
+ ...options,
418
+ method: "GET"
419
+ });
420
+ };
421
+ const getReplaceUserRolesUrl = (userId) => {
422
+ return `/access-control/users/${userId}/roles`;
423
+ };
424
+ /**
425
+ * Replaces all roles assigned to a user with a new set.
426
+ * @summary Replace user roles
427
+ */
428
+ const replaceUserRoles = async (userId, replaceUserRolesRequest, options) => {
429
+ const getHeaders = (h) => {
430
+ if (!h) return {};
431
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
432
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
433
+ const headers = {};
434
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
435
+ return headers;
436
+ };
437
+ return customFetch(getReplaceUserRolesUrl(userId), {
438
+ ...options,
439
+ method: "PUT",
440
+ headers: {
441
+ "Content-Type": "application/json",
442
+ ...getHeaders(options?.headers)
443
+ },
444
+ body: JSON.stringify(replaceUserRolesRequest)
445
+ });
446
+ };
447
+ const getAssignUserRoleUrl = (userId) => {
448
+ return `/access-control/users/${userId}/roles`;
449
+ };
450
+ /**
451
+ * Assigns a role to a user.
452
+ * @summary Assign role to user
453
+ */
454
+ const assignUserRole = async (userId, assignUserRoleRequest, options) => {
455
+ const getHeaders = (h) => {
456
+ if (!h) return {};
457
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
458
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
459
+ const headers = {};
460
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
461
+ return headers;
462
+ };
463
+ return customFetch(getAssignUserRoleUrl(userId), {
464
+ ...options,
465
+ method: "POST",
466
+ headers: {
467
+ "Content-Type": "application/json",
468
+ ...getHeaders(options?.headers)
469
+ },
470
+ body: JSON.stringify(assignUserRoleRequest)
471
+ });
472
+ };
473
+ const getRemoveUserRoleUrl = (userId, roleId) => {
474
+ return `/access-control/users/${userId}/roles/${roleId}`;
475
+ };
476
+ /**
477
+ * Removes a role from a user.
478
+ * @summary Remove user role
479
+ */
480
+ const removeUserRole = async (userId, roleId, options) => {
481
+ return customFetch(getRemoveUserRoleUrl(userId, roleId), {
482
+ ...options,
483
+ method: "DELETE"
484
+ });
485
+ };
486
+
487
+ // src/plugins/access-control/plugin.ts
488
+ var AccessControlPlugin = class {
489
+ id = "accessControl";
490
+ constructor() {}
491
+ init(client) {
492
+ return wrapGenerated(access_control_exports, client);
493
+ }
494
+ };
495
+
496
+ // src/gen/endpoints/admin-accounts/admin-accounts.ts
497
+ var admin_accounts_exports = /* @__PURE__ */ __exportAll({
498
+ createAccount: () => createAccount,
499
+ deleteAccount: () => deleteAccount,
500
+ getAccount: () => getAccount,
501
+ getCreateAccountUrl: () => getCreateAccountUrl,
502
+ getDeleteAccountUrl: () => getDeleteAccountUrl,
503
+ getGetAccountUrl: () => getGetAccountUrl,
504
+ getListUserAccountsUrl: () => getListUserAccountsUrl,
505
+ getUpdateAccountUrl: () => getUpdateAccountUrl,
506
+ listUserAccounts: () => listUserAccounts,
507
+ updateAccount: () => updateAccount
508
+ });
509
+ const getGetAccountUrl = (id) => {
510
+ return `/admin/accounts/${id}`;
511
+ };
512
+ /**
513
+ * Retrieves an account by its ID.
514
+ * @summary Get account by ID
515
+ */
516
+ const getAccount = async (id, options) => {
517
+ return customFetch(getGetAccountUrl(id), {
518
+ ...options,
519
+ method: "GET"
520
+ });
521
+ };
522
+ const getDeleteAccountUrl = (id) => {
523
+ return `/admin/accounts/${id}`;
524
+ };
525
+ /**
526
+ * Deletes an account.
527
+ * @summary Delete account
528
+ */
529
+ const deleteAccount = async (id, options) => {
530
+ return customFetch(getDeleteAccountUrl(id), {
531
+ ...options,
532
+ method: "DELETE"
533
+ });
534
+ };
535
+ const getUpdateAccountUrl = (id) => {
536
+ return `/admin/accounts/${id}`;
537
+ };
538
+ /**
539
+ * Updates an account's attributes.
540
+ * @summary Update account
541
+ */
542
+ const updateAccount = async (id, updateAccountRequest, options) => {
543
+ const getHeaders = (h) => {
544
+ if (!h) return {};
545
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
546
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
547
+ const headers = {};
548
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
549
+ return headers;
550
+ };
551
+ return customFetch(getUpdateAccountUrl(id), {
552
+ ...options,
553
+ method: "PATCH",
554
+ headers: {
555
+ "Content-Type": "application/json",
556
+ ...getHeaders(options?.headers)
557
+ },
558
+ body: JSON.stringify(updateAccountRequest)
559
+ });
560
+ };
561
+ const getListUserAccountsUrl = (userId) => {
562
+ return `/admin/users/${userId}/accounts`;
563
+ };
564
+ /**
565
+ * Lists all accounts for a user.
566
+ * @summary List user accounts
567
+ */
568
+ const listUserAccounts = async (userId, options) => {
569
+ return customFetch(getListUserAccountsUrl(userId), {
570
+ ...options,
571
+ method: "GET"
572
+ });
573
+ };
574
+ const getCreateAccountUrl = (userId) => {
575
+ return `/admin/users/${userId}/accounts`;
576
+ };
577
+ /**
578
+ * Creates a new account for a user.
579
+ * @summary Create account
580
+ */
581
+ const createAccount = async (userId, createAccountRequest, options) => {
582
+ const getHeaders = (h) => {
583
+ if (!h) return {};
584
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
585
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
586
+ const headers = {};
587
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
588
+ return headers;
589
+ };
590
+ return customFetch(getCreateAccountUrl(userId), {
591
+ ...options,
592
+ method: "POST",
593
+ headers: {
594
+ "Content-Type": "application/json",
595
+ ...getHeaders(options?.headers)
596
+ },
597
+ body: JSON.stringify(createAccountRequest)
598
+ });
599
+ };
600
+
601
+ // src/gen/endpoints/admin-impersonation/admin-impersonation.ts
602
+ var admin_impersonation_exports = /* @__PURE__ */ __exportAll({
603
+ getGetImpersonationUrl: () => getGetImpersonationUrl,
604
+ getImpersonation: () => getImpersonation,
605
+ getListImpersonationsUrl: () => getListImpersonationsUrl,
606
+ getStartImpersonationUrl: () => getStartImpersonationUrl,
607
+ getStopImpersonationUrl: () => getStopImpersonationUrl,
608
+ listImpersonations: () => listImpersonations,
609
+ startImpersonation: () => startImpersonation,
610
+ stopImpersonation: () => stopImpersonation
611
+ });
612
+ const getListImpersonationsUrl = () => {
613
+ return `/admin/impersonations`;
614
+ };
615
+ /**
616
+ * Lists all impersonations.
617
+ * @summary List impersonations
618
+ */
619
+ const listImpersonations = async (options) => {
620
+ return customFetch(getListImpersonationsUrl(), {
621
+ ...options,
622
+ method: "GET"
623
+ });
624
+ };
625
+ const getStartImpersonationUrl = () => {
626
+ return `/admin/impersonations`;
627
+ };
628
+ /**
629
+ * Starts an impersonation session as a target user.
630
+ * @summary Start impersonation
631
+ */
632
+ const startImpersonation = async (startImpersonationRequest, options) => {
633
+ const getHeaders = (h) => {
634
+ if (!h) return {};
635
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
636
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
637
+ const headers = {};
638
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
639
+ return headers;
640
+ };
641
+ return customFetch(getStartImpersonationUrl(), {
642
+ ...options,
643
+ method: "POST",
644
+ headers: {
645
+ "Content-Type": "application/json",
646
+ ...getHeaders(options?.headers)
647
+ },
648
+ body: JSON.stringify(startImpersonationRequest)
649
+ });
650
+ };
651
+ const getGetImpersonationUrl = (impersonationId) => {
652
+ return `/admin/impersonations/${impersonationId}`;
653
+ };
654
+ /**
655
+ * Retrieves an impersonation by its ID.
656
+ * @summary Get impersonation by ID
657
+ */
658
+ const getImpersonation = async (impersonationId, options) => {
659
+ return customFetch(getGetImpersonationUrl(impersonationId), {
660
+ ...options,
661
+ method: "GET"
662
+ });
663
+ };
664
+ const getStopImpersonationUrl = (impersonationId) => {
665
+ return `/admin/impersonations/${impersonationId}/stop`;
666
+ };
667
+ /**
668
+ * Stops an impersonation session and restores the original session.
669
+ * @summary Stop impersonation
670
+ */
671
+ const stopImpersonation = async (impersonationId, options) => {
672
+ return customFetch(getStopImpersonationUrl(impersonationId), {
673
+ ...options,
674
+ method: "POST"
675
+ });
676
+ };
677
+
678
+ // src/gen/endpoints/admin-session-state/admin-session-state.ts
679
+ var admin_session_state_exports = /* @__PURE__ */ __exportAll({
680
+ createSessionState: () => createSessionState,
681
+ deleteSessionState: () => deleteSessionState,
682
+ getCreateSessionStateUrl: () => getCreateSessionStateUrl,
683
+ getDeleteSessionStateUrl: () => getDeleteSessionStateUrl,
684
+ getGetSessionStateUrl: () => getGetSessionStateUrl,
685
+ getListRevokedSessionStatesUrl: () => getListRevokedSessionStatesUrl,
686
+ getRevokeSessionUrl: () => getRevokeSessionUrl,
687
+ getSessionState: () => getSessionState,
688
+ getUpdateSessionStateUrl: () => getUpdateSessionStateUrl,
689
+ listRevokedSessionStates: () => listRevokedSessionStates,
690
+ revokeSession: () => revokeSession,
691
+ updateSessionState: () => updateSessionState
692
+ });
693
+ const getListRevokedSessionStatesUrl = () => {
694
+ return `/admin/sessions/states/revoked`;
695
+ };
696
+ /**
697
+ * Lists all revoked session states.
698
+ * @summary List revoked session states
699
+ */
700
+ const listRevokedSessionStates = async (options) => {
701
+ return customFetch(getListRevokedSessionStatesUrl(), {
702
+ ...options,
703
+ method: "GET"
704
+ });
705
+ };
706
+ const getRevokeSessionUrl = (sessionId) => {
707
+ return `/admin/sessions/${sessionId}/revoke`;
708
+ };
709
+ /**
710
+ * Revokes a session.
711
+ * @summary Revoke session
712
+ */
713
+ const revokeSession = async (sessionId, revokeSessionRequest, options) => {
714
+ const getHeaders = (h) => {
715
+ if (!h) return {};
716
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
717
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
718
+ const headers = {};
719
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
720
+ return headers;
721
+ };
722
+ return customFetch(getRevokeSessionUrl(sessionId), {
723
+ ...options,
724
+ method: "POST",
725
+ headers: {
726
+ "Content-Type": "application/json",
727
+ ...getHeaders(options?.headers)
728
+ },
729
+ body: JSON.stringify(revokeSessionRequest)
730
+ });
731
+ };
732
+ const getGetSessionStateUrl = (sessionId) => {
733
+ return `/admin/sessions/${sessionId}/state`;
734
+ };
735
+ /**
736
+ * Retrieves the state of a session.
737
+ * @summary Get session state
738
+ */
739
+ const getSessionState = async (sessionId, options) => {
740
+ return customFetch(getGetSessionStateUrl(sessionId), {
741
+ ...options,
742
+ method: "GET"
743
+ });
744
+ };
745
+ const getCreateSessionStateUrl = (sessionId) => {
746
+ return `/admin/sessions/${sessionId}/state`;
747
+ };
748
+ /**
749
+ * Creates the state for a session.
750
+ * @summary Create session state
751
+ */
752
+ const createSessionState = async (sessionId, createSessionStateRequest, options) => {
753
+ const getHeaders = (h) => {
754
+ if (!h) return {};
755
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
756
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
757
+ const headers = {};
758
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
759
+ return headers;
760
+ };
761
+ return customFetch(getCreateSessionStateUrl(sessionId), {
762
+ ...options,
763
+ method: "POST",
764
+ headers: {
765
+ "Content-Type": "application/json",
766
+ ...getHeaders(options?.headers)
767
+ },
768
+ body: JSON.stringify(createSessionStateRequest)
769
+ });
770
+ };
771
+ const getDeleteSessionStateUrl = (sessionId) => {
772
+ return `/admin/sessions/${sessionId}/state`;
773
+ };
774
+ /**
775
+ * Deletes the state of a session.
776
+ * @summary Delete session state
777
+ */
778
+ const deleteSessionState = async (sessionId, options) => {
779
+ return customFetch(getDeleteSessionStateUrl(sessionId), {
780
+ ...options,
781
+ method: "DELETE"
782
+ });
783
+ };
784
+ const getUpdateSessionStateUrl = (sessionId) => {
785
+ return `/admin/sessions/${sessionId}/state`;
786
+ };
787
+ /**
788
+ * Updates the state of a session.
789
+ * @summary Update session state
790
+ */
791
+ const updateSessionState = async (sessionId, upsertSessionStateRequest, options) => {
792
+ const getHeaders = (h) => {
793
+ if (!h) return {};
794
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
795
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
796
+ const headers = {};
797
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
798
+ return headers;
799
+ };
800
+ return customFetch(getUpdateSessionStateUrl(sessionId), {
801
+ ...options,
802
+ method: "PATCH",
803
+ headers: {
804
+ "Content-Type": "application/json",
805
+ ...getHeaders(options?.headers)
806
+ },
807
+ body: JSON.stringify(upsertSessionStateRequest)
808
+ });
809
+ };
810
+
811
+ // src/gen/endpoints/admin-user-state/admin-user-state.ts
812
+ var admin_user_state_exports = /* @__PURE__ */ __exportAll({
813
+ banUser: () => banUser,
814
+ createUserState: () => createUserState,
815
+ deleteUserState: () => deleteUserState,
816
+ getBanUserUrl: () => getBanUserUrl,
817
+ getCreateUserStateUrl: () => getCreateUserStateUrl,
818
+ getDeleteUserStateUrl: () => getDeleteUserStateUrl,
819
+ getGetUserStateUrl: () => getGetUserStateUrl,
820
+ getListBannedUserStatesUrl: () => getListBannedUserStatesUrl,
821
+ getListUserSessionsUrl: () => getListUserSessionsUrl,
822
+ getUnbanUserUrl: () => getUnbanUserUrl,
823
+ getUpdateUserStateUrl: () => getUpdateUserStateUrl,
824
+ getUserState: () => getUserState,
825
+ listBannedUserStates: () => listBannedUserStates,
826
+ listUserSessions: () => listUserSessions,
827
+ unbanUser: () => unbanUser,
828
+ updateUserState: () => updateUserState
829
+ });
830
+ const getListBannedUserStatesUrl = () => {
831
+ return `/admin/users/states/banned`;
832
+ };
833
+ /**
834
+ * Lists all banned user states.
835
+ * @summary List banned user states
836
+ */
837
+ const listBannedUserStates = async (options) => {
838
+ return customFetch(getListBannedUserStatesUrl(), {
839
+ ...options,
840
+ method: "GET"
841
+ });
842
+ };
843
+ const getBanUserUrl = (userId) => {
844
+ return `/admin/users/${userId}/ban`;
845
+ };
846
+ /**
847
+ * Bans a user.
848
+ * @summary Ban user
849
+ */
850
+ const banUser = async (userId, banUserRequest, options) => {
851
+ const getHeaders = (h) => {
852
+ if (!h) return {};
853
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
854
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
855
+ const headers = {};
856
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
857
+ return headers;
858
+ };
859
+ return customFetch(getBanUserUrl(userId), {
860
+ ...options,
861
+ method: "POST",
862
+ headers: {
863
+ "Content-Type": "application/json",
864
+ ...getHeaders(options?.headers)
865
+ },
866
+ body: JSON.stringify(banUserRequest)
867
+ });
868
+ };
869
+ const getListUserSessionsUrl = (userId) => {
870
+ return `/admin/users/${userId}/sessions`;
871
+ };
872
+ /**
873
+ * Lists all sessions for a user.
874
+ * @summary List user sessions
875
+ */
876
+ const listUserSessions = async (userId, options) => {
877
+ return customFetch(getListUserSessionsUrl(userId), {
878
+ ...options,
879
+ method: "GET"
880
+ });
881
+ };
882
+ const getGetUserStateUrl = (userId) => {
883
+ return `/admin/users/${userId}/state`;
884
+ };
885
+ /**
886
+ * Retrieves the state of a user.
887
+ * @summary Get user state
888
+ */
889
+ const getUserState = async (userId, options) => {
890
+ return customFetch(getGetUserStateUrl(userId), {
891
+ ...options,
892
+ method: "GET"
893
+ });
894
+ };
895
+ const getCreateUserStateUrl = (userId) => {
896
+ return `/admin/users/${userId}/state`;
897
+ };
898
+ /**
899
+ * Creates the state for a user.
900
+ * @summary Create user state
901
+ */
902
+ const createUserState = async (userId, createUserStateRequest, options) => {
903
+ const getHeaders = (h) => {
904
+ if (!h) return {};
905
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
906
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
907
+ const headers = {};
908
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
909
+ return headers;
910
+ };
911
+ return customFetch(getCreateUserStateUrl(userId), {
912
+ ...options,
913
+ method: "POST",
914
+ headers: {
915
+ "Content-Type": "application/json",
916
+ ...getHeaders(options?.headers)
917
+ },
918
+ body: JSON.stringify(createUserStateRequest)
919
+ });
920
+ };
921
+ const getDeleteUserStateUrl = (userId) => {
922
+ return `/admin/users/${userId}/state`;
923
+ };
924
+ /**
925
+ * Deletes the state of a user.
926
+ * @summary Delete user state
927
+ */
928
+ const deleteUserState = async (userId, options) => {
929
+ return customFetch(getDeleteUserStateUrl(userId), {
930
+ ...options,
931
+ method: "DELETE"
932
+ });
933
+ };
934
+ const getUpdateUserStateUrl = (userId) => {
935
+ return `/admin/users/${userId}/state`;
936
+ };
937
+ /**
938
+ * Updates the state of a user.
939
+ * @summary Update user state
940
+ */
941
+ const updateUserState = async (userId, upsertUserStateRequest, options) => {
942
+ const getHeaders = (h) => {
943
+ if (!h) return {};
944
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
945
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
946
+ const headers = {};
947
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
948
+ return headers;
949
+ };
950
+ return customFetch(getUpdateUserStateUrl(userId), {
951
+ ...options,
952
+ method: "PATCH",
953
+ headers: {
954
+ "Content-Type": "application/json",
955
+ ...getHeaders(options?.headers)
956
+ },
957
+ body: JSON.stringify(upsertUserStateRequest)
958
+ });
959
+ };
960
+ const getUnbanUserUrl = (userId) => {
961
+ return `/admin/users/${userId}/unban`;
962
+ };
963
+ /**
964
+ * Unbans a user.
965
+ * @summary Unban user
966
+ */
967
+ const unbanUser = async (userId, options) => {
968
+ return customFetch(getUnbanUserUrl(userId), {
969
+ ...options,
970
+ method: "POST"
971
+ });
972
+ };
973
+
974
+ // src/gen/endpoints/admin-users/admin-users.ts
975
+ var admin_users_exports = /* @__PURE__ */ __exportAll({
976
+ createUser: () => createUser,
977
+ deleteUser: () => deleteUser,
978
+ getCreateUserUrl: () => getCreateUserUrl,
979
+ getDeleteUserUrl: () => getDeleteUserUrl,
980
+ getGetUserUrl: () => getGetUserUrl,
981
+ getListUsersUrl: () => getListUsersUrl,
982
+ getUpdateUserUrl: () => getUpdateUserUrl,
983
+ getUser: () => getUser,
984
+ listUsers: () => listUsers,
985
+ updateUser: () => updateUser
986
+ });
987
+ const getListUsersUrl = (params) => {
988
+ const normalizedParams = new URLSearchParams();
989
+ Object.entries(params || {}).forEach(([key, value]) => {
990
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
991
+ });
992
+ const stringifiedParams = normalizedParams.toString();
993
+ return stringifiedParams.length > 0 ? `/admin/users?${stringifiedParams}` : `/admin/users`;
994
+ };
995
+ /**
996
+ * Lists users with cursor-based pagination.
997
+ * @summary List users
998
+ */
999
+ const listUsers = async (params, options) => {
1000
+ return customFetch(getListUsersUrl(params), {
1001
+ ...options,
1002
+ method: "GET"
1003
+ });
1004
+ };
1005
+ const getCreateUserUrl = () => {
1006
+ return `/admin/users`;
1007
+ };
1008
+ /**
1009
+ * Creates a new user with the specified attributes.
1010
+ * @summary Create user
1011
+ */
1012
+ const createUser = async (createUserRequest, options) => {
1013
+ const getHeaders = (h) => {
1014
+ if (!h) return {};
1015
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1016
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1017
+ const headers = {};
1018
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1019
+ return headers;
1020
+ };
1021
+ return customFetch(getCreateUserUrl(), {
1022
+ ...options,
1023
+ method: "POST",
1024
+ headers: {
1025
+ "Content-Type": "application/json",
1026
+ ...getHeaders(options?.headers)
1027
+ },
1028
+ body: JSON.stringify(createUserRequest)
1029
+ });
1030
+ };
1031
+ const getGetUserUrl = (userId) => {
1032
+ return `/admin/users/${userId}`;
1033
+ };
1034
+ /**
1035
+ * Retrieves a user by their ID.
1036
+ * @summary Get user by ID
1037
+ */
1038
+ const getUser = async (userId, options) => {
1039
+ return customFetch(getGetUserUrl(userId), {
1040
+ ...options,
1041
+ method: "GET"
1042
+ });
1043
+ };
1044
+ const getDeleteUserUrl = (userId) => {
1045
+ return `/admin/users/${userId}`;
1046
+ };
1047
+ /**
1048
+ * Deletes a user.
1049
+ * @summary Delete user
1050
+ */
1051
+ const deleteUser = async (userId, options) => {
1052
+ return customFetch(getDeleteUserUrl(userId), {
1053
+ ...options,
1054
+ method: "DELETE"
1055
+ });
1056
+ };
1057
+ const getUpdateUserUrl = (userId) => {
1058
+ return `/admin/users/${userId}`;
1059
+ };
1060
+ /**
1061
+ * Updates a user's attributes.
1062
+ * @summary Update user
1063
+ */
1064
+ const updateUser = async (userId, updateUserRequest, options) => {
1065
+ const getHeaders = (h) => {
1066
+ if (!h) return {};
1067
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1068
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1069
+ const headers = {};
1070
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1071
+ return headers;
1072
+ };
1073
+ return customFetch(getUpdateUserUrl(userId), {
1074
+ ...options,
1075
+ method: "PATCH",
1076
+ headers: {
1077
+ "Content-Type": "application/json",
1078
+ ...getHeaders(options?.headers)
1079
+ },
1080
+ body: JSON.stringify(updateUserRequest)
1081
+ });
1082
+ };
1083
+
1084
+ // src/plugins/admin/plugin.ts
1085
+ var AdminPlugin = class {
1086
+ id = "admin";
1087
+ constructor() {}
1088
+ init(client) {
1089
+ return {
1090
+ ...wrapGenerated(admin_users_exports, client),
1091
+ ...wrapGenerated(admin_accounts_exports, client),
1092
+ ...wrapGenerated(admin_user_state_exports, client),
1093
+ ...wrapGenerated(admin_session_state_exports, client),
1094
+ ...wrapGenerated(admin_impersonation_exports, client)
1095
+ };
1096
+ }
1097
+ };
1098
+
1099
+ // src/gen/endpoints/api-keys/api-keys.ts
1100
+ var api_keys_exports = /* @__PURE__ */ __exportAll({
1101
+ createApiKey: () => createApiKey,
1102
+ deleteApiKey: () => deleteApiKey,
1103
+ getApiKey: () => getApiKey,
1104
+ getCreateApiKeyUrl: () => getCreateApiKeyUrl,
1105
+ getDeleteApiKeyUrl: () => getDeleteApiKeyUrl,
1106
+ getGetApiKeyUrl: () => getGetApiKeyUrl,
1107
+ getListApiKeysUrl: () => getListApiKeysUrl,
1108
+ getUpdateApiKeyUrl: () => getUpdateApiKeyUrl,
1109
+ getVerifyApiKeyUrl: () => getVerifyApiKeyUrl,
1110
+ listApiKeys: () => listApiKeys,
1111
+ updateApiKey: () => updateApiKey,
1112
+ verifyApiKey: () => verifyApiKey
1113
+ });
1114
+ const getListApiKeysUrl = (params) => {
1115
+ const normalizedParams = new URLSearchParams();
1116
+ Object.entries(params || {}).forEach(([key, value]) => {
1117
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1118
+ });
1119
+ const stringifiedParams = normalizedParams.toString();
1120
+ return stringifiedParams.length > 0 ? `/api-keys?${stringifiedParams}` : `/api-keys`;
1121
+ };
1122
+ /**
1123
+ * Lists API keys with pagination, optionally filtered by owner.
1124
+ * @summary List API keys
1125
+ */
1126
+ const listApiKeys = async (params, options) => {
1127
+ return customFetch(getListApiKeysUrl(params), {
1128
+ ...options,
1129
+ method: "GET"
1130
+ });
1131
+ };
1132
+ const getCreateApiKeyUrl = () => {
1133
+ return `/api-keys`;
1134
+ };
1135
+ /**
1136
+ * Creates a new API key for the specified owner.
1137
+ * @summary Create API key
1138
+ */
1139
+ const createApiKey = async (createApiKeyRequest, options) => {
1140
+ const getHeaders = (h) => {
1141
+ if (!h) return {};
1142
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1143
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1144
+ const headers = {};
1145
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1146
+ return headers;
1147
+ };
1148
+ return customFetch(getCreateApiKeyUrl(), {
1149
+ ...options,
1150
+ method: "POST",
1151
+ headers: {
1152
+ "Content-Type": "application/json",
1153
+ ...getHeaders(options?.headers)
1154
+ },
1155
+ body: JSON.stringify(createApiKeyRequest)
1156
+ });
1157
+ };
1158
+ const getVerifyApiKeyUrl = () => {
1159
+ return `/api-keys/verify`;
1160
+ };
1161
+ /**
1162
+ * Verifies an API key by its raw value and returns the associated key details.
1163
+ * @summary Verify API key
1164
+ */
1165
+ const verifyApiKey = async (verifyApiKeyRequest, options) => {
1166
+ const getHeaders = (h) => {
1167
+ if (!h) return {};
1168
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1169
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1170
+ const headers = {};
1171
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1172
+ return headers;
1173
+ };
1174
+ return customFetch(getVerifyApiKeyUrl(), {
1175
+ ...options,
1176
+ method: "POST",
1177
+ headers: {
1178
+ "Content-Type": "application/json",
1179
+ ...getHeaders(options?.headers)
1180
+ },
1181
+ body: JSON.stringify(verifyApiKeyRequest)
1182
+ });
1183
+ };
1184
+ const getGetApiKeyUrl = (id) => {
1185
+ return `/api-keys/${id}`;
1186
+ };
1187
+ /**
1188
+ * Retrieves an API key by its ID.
1189
+ * @summary Get API key by ID
1190
+ */
1191
+ const getApiKey = async (id, options) => {
1192
+ return customFetch(getGetApiKeyUrl(id), {
1193
+ ...options,
1194
+ method: "GET"
1195
+ });
1196
+ };
1197
+ const getDeleteApiKeyUrl = (id) => {
1198
+ return `/api-keys/${id}`;
1199
+ };
1200
+ /**
1201
+ * Deletes an API key.
1202
+ * @summary Delete API key
1203
+ */
1204
+ const deleteApiKey = async (id, options) => {
1205
+ return customFetch(getDeleteApiKeyUrl(id), {
1206
+ ...options,
1207
+ method: "DELETE"
1208
+ });
1209
+ };
1210
+ const getUpdateApiKeyUrl = (id) => {
1211
+ return `/api-keys/${id}`;
1212
+ };
1213
+ /**
1214
+ * Updates an API key's attributes.
1215
+ * @summary Update API key
1216
+ */
1217
+ const updateApiKey = async (id, updateApiKeyRequest, options) => {
1218
+ const getHeaders = (h) => {
1219
+ if (!h) return {};
1220
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1221
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1222
+ const headers = {};
1223
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1224
+ return headers;
1225
+ };
1226
+ return customFetch(getUpdateApiKeyUrl(id), {
1227
+ ...options,
1228
+ method: "PATCH",
1229
+ headers: {
1230
+ "Content-Type": "application/json",
1231
+ ...getHeaders(options?.headers)
1232
+ },
1233
+ body: JSON.stringify(updateApiKeyRequest)
1234
+ });
1235
+ };
1236
+
1237
+ // src/plugins/api-key/plugin.ts
1238
+ var ApiKeyPlugin = class {
1239
+ id = "apiKey";
1240
+ constructor() {}
1241
+ init(client) {
1242
+ return wrapGenerated(api_keys_exports, client);
1243
+ }
1244
+ };
1245
+
1246
+ // src/plugins/bearer/plugin.ts
1247
+ var BearerPlugin = class {
1248
+ options;
1249
+ id = "bearer";
1250
+ refreshPromise = null;
1251
+ constructor(options) {
1252
+ this.options = options;
1253
+ }
1254
+ init(client) {
1255
+ client.registerBeforeFetch(async (ctx) => {
1256
+ if (typeof document === "undefined") return;
1257
+ const headerName = this.options?.headerName ?? "Authorization";
1258
+ const token = localStorage.getItem("accessToken");
1259
+ if (token) {
1260
+ if (!(ctx.init.headers instanceof Headers)) ctx.init.headers = new Headers(ctx.init.headers);
1261
+ ctx.init.headers.set(headerName, `Bearer ${token}`);
1262
+ }
1263
+ });
1264
+ client.registerAfterFetch(async (ctx, res) => {
1265
+ if (typeof document === "undefined") return;
1266
+ if (res.status !== 401) return;
1267
+ if (ctx.meta.retry) return;
1268
+ const refreshToken = localStorage.getItem("refreshToken");
1269
+ if (!refreshToken) return;
1270
+ if (!client.jwt) {
1271
+ console.warn("JWT Plugin is required for Bearer token refresh.");
1272
+ return;
1273
+ }
1274
+ if (!this.refreshPromise) this.refreshPromise = (async () => {
1275
+ try {
1276
+ const response = await client.jwt.refreshToken({ refreshToken });
1277
+ if (!response) return null;
1278
+ localStorage.setItem("accessToken", response.accessToken);
1279
+ localStorage.setItem("refreshToken", response.refreshToken);
1280
+ return response;
1281
+ } finally {
1282
+ this.refreshPromise = null;
1283
+ }
1284
+ })();
1285
+ const refreshed = await this.refreshPromise;
1286
+ if (!refreshed) return;
1287
+ const headerName = this.options?.headerName ?? "Authorization";
1288
+ if (!(ctx.init.headers instanceof Headers)) ctx.init.headers = new Headers(ctx.init.headers);
1289
+ ctx.init.headers.set(headerName, `Bearer ${refreshed.accessToken}`);
1290
+ return "retry";
1291
+ });
1292
+ return {};
1293
+ }
1294
+ };
1295
+
1296
+ // src/gen/endpoints/core/core.ts
1297
+ var core_exports = /* @__PURE__ */ __exportAll({
1298
+ getGetMeUrl: () => getGetMeUrl,
1299
+ getMe: () => getMe,
1300
+ getSignOutUrl: () => getSignOutUrl,
1301
+ signOut: () => signOut
1302
+ });
1303
+ const getGetMeUrl = () => {
1304
+ return `/me`;
1305
+ };
1306
+ /**
1307
+ * Retrieves the authenticated user's profile and current session.
1308
+ * @summary Get current user
1309
+ */
1310
+ const getMe = async (options) => {
1311
+ return customFetch(getGetMeUrl(), {
1312
+ ...options,
1313
+ method: "GET"
1314
+ });
1315
+ };
1316
+ const getSignOutUrl = () => {
1317
+ return `/sign-out`;
1318
+ };
1319
+ /**
1320
+ * Signs out the authenticated user. With no body, revokes the session that authenticated the request (400 if the request carries no session id). Pass session_id to revoke one of your own sessions (404 if it does not exist, 403 if it belongs to another user), or sign_out_all to revoke every session.
1321
+ * @summary Sign out
1322
+ */
1323
+ const signOut = async (signOutRequest, options) => {
1324
+ const getHeaders = (h) => {
1325
+ if (!h) return {};
1326
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1327
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1328
+ const headers = {};
1329
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1330
+ return headers;
1331
+ };
1332
+ return customFetch(getSignOutUrl(), {
1333
+ ...options,
1334
+ method: "POST",
1335
+ headers: {
1336
+ "Content-Type": "application/json",
1337
+ ...getHeaders(options?.headers)
1338
+ },
1339
+ body: JSON.stringify(signOutRequest)
1340
+ });
1341
+ };
1342
+
1343
+ // src/plugins/core/plugin.ts
1344
+ var CorePlugin = class {
1345
+ id = "core";
1346
+ constructor() {}
1347
+ init(client) {
1348
+ return wrapGenerated(core_exports, client);
1349
+ }
1350
+ };
1351
+
1352
+ // src/plugins/csrf/plugin.ts
1353
+ var CSRFPlugin = class {
1354
+ options;
1355
+ id = "csrf";
1356
+ constructor(options) {
1357
+ this.options = options;
1358
+ }
1359
+ init(client) {
1360
+ client.registerBeforeFetch(async (ctx) => {
1361
+ if ([
1362
+ "OPTIONS",
1363
+ "HEAD",
1364
+ "GET"
1365
+ ].includes(ctx.init.method || "GET")) return;
1366
+ const value = ctx.cookies?.[this.options.cookieName] ?? await client.getCookie(this.options.cookieName);
1367
+ if (!value) return;
1368
+ ctx.init.headers = new Headers(ctx.init.headers);
1369
+ ctx.init.headers.set(this.options.headerName, value);
1370
+ });
1371
+ return {};
1372
+ }
1373
+ };
1374
+
1375
+ // src/gen/endpoints/email-password-plugin/email-password-plugin.ts
1376
+ var email_password_plugin_exports = /* @__PURE__ */ __exportAll({
1377
+ changePassword: () => changePassword,
1378
+ getChangePasswordUrl: () => getChangePasswordUrl,
1379
+ getRequestEmailChangeUrl: () => getRequestEmailChangeUrl,
1380
+ getRequestPasswordResetUrl: () => getRequestPasswordResetUrl,
1381
+ getSendEmailVerificationUrl: () => getSendEmailVerificationUrl,
1382
+ getSignInUrl: () => getSignInUrl,
1383
+ getSignUpUrl: () => getSignUpUrl,
1384
+ getVerifyEmailUrl: () => getVerifyEmailUrl,
1385
+ requestEmailChange: () => requestEmailChange,
1386
+ requestPasswordReset: () => requestPasswordReset,
1387
+ sendEmailVerification: () => sendEmailVerification,
1388
+ signIn: () => signIn,
1389
+ signUp: () => signUp,
1390
+ verifyEmail: () => verifyEmail
1391
+ });
1392
+ const getChangePasswordUrl = () => {
1393
+ return `/email-password/change-password`;
1394
+ };
1395
+ /**
1396
+ * Changes the user's password using a reset token
1397
+ * @summary Change password
1398
+ */
1399
+ const changePassword = async (changePasswordRequest, options) => {
1400
+ const getHeaders = (h) => {
1401
+ if (!h) return {};
1402
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1403
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1404
+ const headers = {};
1405
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1406
+ return headers;
1407
+ };
1408
+ return customFetch(getChangePasswordUrl(), {
1409
+ ...options,
1410
+ method: "POST",
1411
+ headers: {
1412
+ "Content-Type": "application/json",
1413
+ ...getHeaders(options?.headers)
1414
+ },
1415
+ body: JSON.stringify(changePasswordRequest)
1416
+ });
1417
+ };
1418
+ const getRequestEmailChangeUrl = () => {
1419
+ return `/email-password/request-email-change`;
1420
+ };
1421
+ /**
1422
+ * Requests to change the authenticated user's email address
1423
+ * @summary Request email change
1424
+ */
1425
+ const requestEmailChange = async (requestEmailChangeRequest, options) => {
1426
+ const getHeaders = (h) => {
1427
+ if (!h) return {};
1428
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1429
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1430
+ const headers = {};
1431
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1432
+ return headers;
1433
+ };
1434
+ return customFetch(getRequestEmailChangeUrl(), {
1435
+ ...options,
1436
+ method: "POST",
1437
+ headers: {
1438
+ "Content-Type": "application/json",
1439
+ ...getHeaders(options?.headers)
1440
+ },
1441
+ body: JSON.stringify(requestEmailChangeRequest)
1442
+ });
1443
+ };
1444
+ const getRequestPasswordResetUrl = () => {
1445
+ return `/email-password/request-password-reset`;
1446
+ };
1447
+ /**
1448
+ * Requests a password reset link to be sent to the user's email
1449
+ * @summary Request password reset
1450
+ */
1451
+ const requestPasswordReset = async (requestPasswordResetRequest, options) => {
1452
+ const getHeaders = (h) => {
1453
+ if (!h) return {};
1454
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1455
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1456
+ const headers = {};
1457
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1458
+ return headers;
1459
+ };
1460
+ return customFetch(getRequestPasswordResetUrl(), {
1461
+ ...options,
1462
+ method: "POST",
1463
+ headers: {
1464
+ "Content-Type": "application/json",
1465
+ ...getHeaders(options?.headers)
1466
+ },
1467
+ body: JSON.stringify(requestPasswordResetRequest)
1468
+ });
1469
+ };
1470
+ const getSendEmailVerificationUrl = () => {
1471
+ return `/email-password/send-email-verification`;
1472
+ };
1473
+ /**
1474
+ * Sends a verification email to the authenticated user
1475
+ * @summary Send email verification
1476
+ */
1477
+ const sendEmailVerification = async (sendEmailVerificationRequest, options) => {
1478
+ const getHeaders = (h) => {
1479
+ if (!h) return {};
1480
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1481
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1482
+ const headers = {};
1483
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1484
+ return headers;
1485
+ };
1486
+ return customFetch(getSendEmailVerificationUrl(), {
1487
+ ...options,
1488
+ method: "POST",
1489
+ headers: {
1490
+ "Content-Type": "application/json",
1491
+ ...getHeaders(options?.headers)
1492
+ },
1493
+ body: JSON.stringify(sendEmailVerificationRequest)
1494
+ });
1495
+ };
1496
+ const getSignInUrl = () => {
1497
+ return `/email-password/sign-in`;
1498
+ };
1499
+ /**
1500
+ * Authenticates a user with email and password
1501
+ * @summary Sign in
1502
+ */
1503
+ const signIn = async (signInRequest, options) => {
1504
+ const getHeaders = (h) => {
1505
+ if (!h) return {};
1506
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1507
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1508
+ const headers = {};
1509
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1510
+ return headers;
1511
+ };
1512
+ return customFetch(getSignInUrl(), {
1513
+ ...options,
1514
+ method: "POST",
1515
+ headers: {
1516
+ "Content-Type": "application/json",
1517
+ ...getHeaders(options?.headers)
1518
+ },
1519
+ body: JSON.stringify(signInRequest)
1520
+ });
1521
+ };
1522
+ const getSignUpUrl = () => {
1523
+ return `/email-password/sign-up`;
1524
+ };
1525
+ /**
1526
+ * Registers a new user with email and password
1527
+ * @summary Register new user
1528
+ */
1529
+ const signUp = async (signUpRequest, options) => {
1530
+ const getHeaders = (h) => {
1531
+ if (!h) return {};
1532
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1533
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1534
+ const headers = {};
1535
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1536
+ return headers;
1537
+ };
1538
+ return customFetch(getSignUpUrl(), {
1539
+ ...options,
1540
+ method: "POST",
1541
+ headers: {
1542
+ "Content-Type": "application/json",
1543
+ ...getHeaders(options?.headers)
1544
+ },
1545
+ body: JSON.stringify(signUpRequest)
1546
+ });
1547
+ };
1548
+ const getVerifyEmailUrl = () => {
1549
+ return `/email-password/verify-email`;
1550
+ };
1551
+ /**
1552
+ * Verifies an email address or processes a password reset token using a verification token
1553
+ * @summary Verify email
1554
+ */
1555
+ const verifyEmail = async (options) => {
1556
+ return customFetch(getVerifyEmailUrl(), {
1557
+ ...options,
1558
+ method: "GET"
1559
+ });
1560
+ };
1561
+
1562
+ // src/plugins/email-password/plugin.ts
1563
+ var EmailPasswordPlugin = class {
1564
+ id = "emailPassword";
1565
+ init(client) {
1566
+ return wrapGenerated(email_password_plugin_exports, client);
1567
+ }
1568
+ };
1569
+
1570
+ // src/gen/endpoints/jwt-plugin/jwt-plugin.ts
1571
+ var jwt_plugin_exports = /* @__PURE__ */ __exportAll({
1572
+ getGetJWKSUrl: () => getGetJWKSUrl,
1573
+ getJWKS: () => getJWKS,
1574
+ getRefreshTokenUrl: () => getRefreshTokenUrl,
1575
+ refreshToken: () => refreshToken
1576
+ });
1577
+ const getGetJWKSUrl = () => {
1578
+ return `/.well-known/jwks.json`;
1579
+ };
1580
+ /**
1581
+ * Returns the JSON Web Key Set (JWKS) containing the public keys used to verify JWT signatures.
1582
+ * @summary Get JWKS
1583
+ */
1584
+ const getJWKS = async (options) => {
1585
+ return customFetch(getGetJWKSUrl(), {
1586
+ ...options,
1587
+ method: "GET"
1588
+ });
1589
+ };
1590
+ const getRefreshTokenUrl = () => {
1591
+ return `/token/refresh`;
1592
+ };
1593
+ /**
1594
+ * Exchanges a valid refresh token for a new access token and refresh token pair.
1595
+ * @summary Refresh JWT token
1596
+ */
1597
+ const refreshToken = async (refreshTokenRequest, options) => {
1598
+ const getHeaders = (h) => {
1599
+ if (!h) return {};
1600
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1601
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1602
+ const headers = {};
1603
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1604
+ return headers;
1605
+ };
1606
+ return customFetch(getRefreshTokenUrl(), {
1607
+ ...options,
1608
+ method: "POST",
1609
+ headers: {
1610
+ "Content-Type": "application/json",
1611
+ ...getHeaders(options?.headers)
1612
+ },
1613
+ body: JSON.stringify(refreshTokenRequest)
1614
+ });
1615
+ };
1616
+
1617
+ // src/plugins/jwt/plugin.ts
1618
+ var JWTPlugin = class {
1619
+ id = "jwt";
1620
+ constructor() {}
1621
+ init(client) {
1622
+ return wrapGenerated(jwt_plugin_exports, client);
1623
+ }
1624
+ };
1625
+
1626
+ // src/gen/endpoints/magic-link-plugin/magic-link-plugin.ts
1627
+ var magic_link_plugin_exports = /* @__PURE__ */ __exportAll({
1628
+ exchangeMagicLink: () => exchangeMagicLink,
1629
+ getExchangeMagicLinkUrl: () => getExchangeMagicLinkUrl,
1630
+ getSignInWithMagicLinkUrl: () => getSignInWithMagicLinkUrl,
1631
+ getVerifyMagicLinkUrl: () => getVerifyMagicLinkUrl,
1632
+ signInWithMagicLink: () => signInWithMagicLink,
1633
+ verifyMagicLink: () => verifyMagicLink
1634
+ });
1635
+ const getExchangeMagicLinkUrl = () => {
1636
+ return `/magic-link/exchange`;
1637
+ };
1638
+ /**
1639
+ * Exchanges a verified magic link token for an authenticated user session.
1640
+ * @summary Exchange magic link token for session
1641
+ */
1642
+ const exchangeMagicLink = async (magicLinkExchangeRequest, options) => {
1643
+ const getHeaders = (h) => {
1644
+ if (!h) return {};
1645
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1646
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1647
+ const headers = {};
1648
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1649
+ return headers;
1650
+ };
1651
+ return customFetch(getExchangeMagicLinkUrl(), {
1652
+ ...options,
1653
+ method: "POST",
1654
+ headers: {
1655
+ "Content-Type": "application/json",
1656
+ ...getHeaders(options?.headers)
1657
+ },
1658
+ body: JSON.stringify(magicLinkExchangeRequest)
1659
+ });
1660
+ };
1661
+ const getSignInWithMagicLinkUrl = () => {
1662
+ return `/magic-link/sign-in`;
1663
+ };
1664
+ /**
1665
+ * Sends a magic link to the given email address if an account exists. Optionally creates a new account if sign-up is enabled.
1666
+ * @summary Sign in with magic link
1667
+ */
1668
+ const signInWithMagicLink = async (magicLinkSignInRequest, options) => {
1669
+ const getHeaders = (h) => {
1670
+ if (!h) return {};
1671
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1672
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1673
+ const headers = {};
1674
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1675
+ return headers;
1676
+ };
1677
+ return customFetch(getSignInWithMagicLinkUrl(), {
1678
+ ...options,
1679
+ method: "POST",
1680
+ headers: {
1681
+ "Content-Type": "application/json",
1682
+ ...getHeaders(options?.headers)
1683
+ },
1684
+ body: JSON.stringify(magicLinkSignInRequest)
1685
+ });
1686
+ };
1687
+ const getVerifyMagicLinkUrl = (params) => {
1688
+ const normalizedParams = new URLSearchParams();
1689
+ Object.entries(params || {}).forEach(([key, value]) => {
1690
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1691
+ });
1692
+ const stringifiedParams = normalizedParams.toString();
1693
+ return stringifiedParams.length > 0 ? `/magic-link/verify?${stringifiedParams}` : `/magic-link/verify`;
1694
+ };
1695
+ /**
1696
+ * 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.
1697
+ * @summary Verify magic link token
1698
+ */
1699
+ const verifyMagicLink = async (params, options) => {
1700
+ return customFetch(getVerifyMagicLinkUrl(params), {
1701
+ ...options,
1702
+ method: "GET"
1703
+ });
1704
+ };
1705
+
1706
+ // src/plugins/magic-link/plugin.ts
1707
+ var MagicLinkPlugin = class {
1708
+ id = "magicLink";
1709
+ constructor() {}
1710
+ init(client) {
1711
+ return wrapGenerated(magic_link_plugin_exports, client);
1712
+ }
1713
+ };
1714
+
1715
+ // src/gen/endpoints/oauth2-plugin/oauth2-plugin.ts
1716
+ var oauth2_plugin_exports = /* @__PURE__ */ __exportAll({
1717
+ getOauthAuthorizeUrl: () => getOauthAuthorizeUrl,
1718
+ getOauthCallbackUrl: () => getOauthCallbackUrl,
1719
+ oauthAuthorize: () => oauthAuthorize,
1720
+ oauthCallback: () => oauthCallback
1721
+ });
1722
+ const getOauthAuthorizeUrl = (provider, params) => {
1723
+ const normalizedParams = new URLSearchParams();
1724
+ Object.entries(params || {}).forEach(([key, value]) => {
1725
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1726
+ });
1727
+ const stringifiedParams = normalizedParams.toString();
1728
+ return stringifiedParams.length > 0 ? `/oauth2/authorize/${provider}?${stringifiedParams}` : `/oauth2/authorize/${provider}`;
1729
+ };
1730
+ /**
1731
+ * Initiates the OAuth2 authorization flow with the specified provider. Returns the provider's authorization URL to redirect the user to.
1732
+ * @summary Authorize with OAuth2 provider
1733
+ */
1734
+ const oauthAuthorize = async (provider, params, options) => {
1735
+ return customFetch(getOauthAuthorizeUrl(provider, params), {
1736
+ ...options,
1737
+ method: "GET"
1738
+ });
1739
+ };
1740
+ const getOauthCallbackUrl = (provider, params) => {
1741
+ const normalizedParams = new URLSearchParams();
1742
+ Object.entries(params || {}).forEach(([key, value]) => {
1743
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1744
+ });
1745
+ const stringifiedParams = normalizedParams.toString();
1746
+ return stringifiedParams.length > 0 ? `/oauth2/callback/${provider}?${stringifiedParams}` : `/oauth2/callback/${provider}`;
1747
+ };
1748
+ /**
1749
+ * 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.
1750
+ * @summary OAuth2 callback
1751
+ */
1752
+ const oauthCallback = async (provider, params, options) => {
1753
+ return customFetch(getOauthCallbackUrl(provider, params), {
1754
+ ...options,
1755
+ method: "GET"
1756
+ });
1757
+ };
1758
+
1759
+ // src/plugins/oauth2/plugin.ts
1760
+ var OAuth2Plugin = class {
1761
+ id = "oauth2";
1762
+ init(client) {
1763
+ return wrapGenerated(oauth2_plugin_exports, client);
1764
+ }
1765
+ };
1766
+
1767
+ // src/gen/endpoints/organizations/organizations.ts
1768
+ var organizations_exports = /* @__PURE__ */ __exportAll({
1769
+ createOrganization: () => createOrganization,
1770
+ deleteOrganization: () => deleteOrganization,
1771
+ getCreateOrganizationUrl: () => getCreateOrganizationUrl,
1772
+ getDeleteOrganizationUrl: () => getDeleteOrganizationUrl,
1773
+ getGetOrganizationUrl: () => getGetOrganizationUrl,
1774
+ getListOrganizationsUrl: () => getListOrganizationsUrl,
1775
+ getOrganization: () => getOrganization,
1776
+ getUpdateOrganizationUrl: () => getUpdateOrganizationUrl,
1777
+ listOrganizations: () => listOrganizations,
1778
+ updateOrganization: () => updateOrganization
1779
+ });
1780
+ const getListOrganizationsUrl = (params) => {
1781
+ const normalizedParams = new URLSearchParams();
1782
+ Object.entries(params || {}).forEach(([key, value]) => {
1783
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1784
+ });
1785
+ const stringifiedParams = normalizedParams.toString();
1786
+ return stringifiedParams.length > 0 ? `/organizations?${stringifiedParams}` : `/organizations`;
1787
+ };
1788
+ /**
1789
+ * Lists every organization the authenticated user can access.
1790
+ * @summary List organizations
1791
+ */
1792
+ const listOrganizations = async (params, options) => {
1793
+ return customFetch(getListOrganizationsUrl(params), {
1794
+ ...options,
1795
+ method: "GET"
1796
+ });
1797
+ };
1798
+ const getCreateOrganizationUrl = () => {
1799
+ return `/organizations`;
1800
+ };
1801
+ /**
1802
+ * Creates a new organization with the authenticated user as the owner.
1803
+ * @summary Create organization
1804
+ */
1805
+ const createOrganization = async (createOrganizationRequest, options) => {
1806
+ const getHeaders = (h) => {
1807
+ if (!h) return {};
1808
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1809
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1810
+ const headers = {};
1811
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1812
+ return headers;
1813
+ };
1814
+ return customFetch(getCreateOrganizationUrl(), {
1815
+ ...options,
1816
+ method: "POST",
1817
+ headers: {
1818
+ "Content-Type": "application/json",
1819
+ ...getHeaders(options?.headers)
1820
+ },
1821
+ body: JSON.stringify(createOrganizationRequest)
1822
+ });
1823
+ };
1824
+ const getGetOrganizationUrl = (organizationId) => {
1825
+ return `/organizations/${organizationId}`;
1826
+ };
1827
+ /**
1828
+ * Retrieves an organization by its ID.
1829
+ * @summary Get organization
1830
+ */
1831
+ const getOrganization = async (organizationId, options) => {
1832
+ return customFetch(getGetOrganizationUrl(organizationId), {
1833
+ ...options,
1834
+ method: "GET"
1835
+ });
1836
+ };
1837
+ const getDeleteOrganizationUrl = (organizationId) => {
1838
+ return `/organizations/${organizationId}`;
1839
+ };
1840
+ /**
1841
+ * Soft-deletes an organization.
1842
+ * @summary Delete organization
1843
+ */
1844
+ const deleteOrganization = async (organizationId, options) => {
1845
+ return customFetch(getDeleteOrganizationUrl(organizationId), {
1846
+ ...options,
1847
+ method: "DELETE"
1848
+ });
1849
+ };
1850
+ const getUpdateOrganizationUrl = (organizationId) => {
1851
+ return `/organizations/${organizationId}`;
1852
+ };
1853
+ /**
1854
+ * Updates an existing organization.
1855
+ * @summary Update organization
1856
+ */
1857
+ const updateOrganization = async (organizationId, updateOrganizationRequest, options) => {
1858
+ const getHeaders = (h) => {
1859
+ if (!h) return {};
1860
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1861
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1862
+ const headers = {};
1863
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1864
+ return headers;
1865
+ };
1866
+ return customFetch(getUpdateOrganizationUrl(organizationId), {
1867
+ ...options,
1868
+ method: "PATCH",
1869
+ headers: {
1870
+ "Content-Type": "application/json",
1871
+ ...getHeaders(options?.headers)
1872
+ },
1873
+ body: JSON.stringify(updateOrganizationRequest)
1874
+ });
1875
+ };
1876
+
1877
+ // src/gen/endpoints/organization-invitations/organization-invitations.ts
1878
+ var organization_invitations_exports = /* @__PURE__ */ __exportAll({
1879
+ acceptOrganizationInvitation: () => acceptOrganizationInvitation,
1880
+ createOrganizationInvitation: () => createOrganizationInvitation,
1881
+ getAcceptOrganizationInvitationUrl: () => getAcceptOrganizationInvitationUrl,
1882
+ getCreateOrganizationInvitationUrl: () => getCreateOrganizationInvitationUrl,
1883
+ getGetOrganizationInvitationUrl: () => getGetOrganizationInvitationUrl,
1884
+ getListOrganizationInvitationsUrl: () => getListOrganizationInvitationsUrl,
1885
+ getOrganizationInvitation: () => getOrganizationInvitation,
1886
+ getRejectOrganizationInvitationUrl: () => getRejectOrganizationInvitationUrl,
1887
+ getRevokeOrganizationInvitationUrl: () => getRevokeOrganizationInvitationUrl,
1888
+ listOrganizationInvitations: () => listOrganizationInvitations,
1889
+ rejectOrganizationInvitation: () => rejectOrganizationInvitation,
1890
+ revokeOrganizationInvitation: () => revokeOrganizationInvitation
1891
+ });
1892
+ const getListOrganizationInvitationsUrl = (organizationId, params) => {
1893
+ const normalizedParams = new URLSearchParams();
1894
+ Object.entries(params || {}).forEach(([key, value]) => {
1895
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1896
+ });
1897
+ const stringifiedParams = normalizedParams.toString();
1898
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/invitations?${stringifiedParams}` : `/organizations/${organizationId}/invitations`;
1899
+ };
1900
+ /**
1901
+ * Lists the invitations for an organization, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10. `limit` is capped by the server's configured maximum page size, which defaults to 100; a larger value is silently reduced to the cap rather than rejected, and values below the minimum fall back to the defaults. The `pagination` object in the response always reports the values actually applied.
1902
+ * @summary List invitations
1903
+ */
1904
+ const listOrganizationInvitations = async (organizationId, params, options) => {
1905
+ return customFetch(getListOrganizationInvitationsUrl(organizationId, params), {
1906
+ ...options,
1907
+ method: "GET"
1908
+ });
1909
+ };
1910
+ const getCreateOrganizationInvitationUrl = (organizationId, params) => {
1911
+ const normalizedParams = new URLSearchParams();
1912
+ Object.entries(params || {}).forEach(([key, value]) => {
1913
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1914
+ });
1915
+ const stringifiedParams = normalizedParams.toString();
1916
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/invitations?${stringifiedParams}` : `/organizations/${organizationId}/invitations`;
1917
+ };
1918
+ /**
1919
+ * Creates an invitation for a user to join an organization.
1920
+ * @summary Create invitation
1921
+ */
1922
+ const createOrganizationInvitation = async (organizationId, createOrganizationInvitationRequest, params, options) => {
1923
+ const getHeaders = (h) => {
1924
+ if (!h) return {};
1925
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1926
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1927
+ const headers = {};
1928
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1929
+ return headers;
1930
+ };
1931
+ return customFetch(getCreateOrganizationInvitationUrl(organizationId, params), {
1932
+ ...options,
1933
+ method: "POST",
1934
+ headers: {
1935
+ "Content-Type": "application/json",
1936
+ ...getHeaders(options?.headers)
1937
+ },
1938
+ body: JSON.stringify(createOrganizationInvitationRequest)
1939
+ });
1940
+ };
1941
+ const getGetOrganizationInvitationUrl = (organizationId, invitationId) => {
1942
+ return `/organizations/${organizationId}/invitations/${invitationId}`;
1943
+ };
1944
+ /**
1945
+ * Retrieves a single invitation.
1946
+ * @summary Get invitation
1947
+ */
1948
+ const getOrganizationInvitation = async (organizationId, invitationId, options) => {
1949
+ return customFetch(getGetOrganizationInvitationUrl(organizationId, invitationId), {
1950
+ ...options,
1951
+ method: "GET"
1952
+ });
1953
+ };
1954
+ const getAcceptOrganizationInvitationUrl = (organizationId, invitationId, params) => {
1955
+ const normalizedParams = new URLSearchParams();
1956
+ Object.entries(params || {}).forEach(([key, value]) => {
1957
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
1958
+ });
1959
+ const stringifiedParams = normalizedParams.toString();
1960
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/invitations/${invitationId}/accept?${stringifiedParams}` : `/organizations/${organizationId}/invitations/${invitationId}/accept`;
1961
+ };
1962
+ /**
1963
+ * Accepts an invitation to join an organization.
1964
+ * @summary Accept invitation
1965
+ */
1966
+ const acceptOrganizationInvitation = async (organizationId, invitationId, acceptOrganizationInvitationQuery, params, options) => {
1967
+ const getHeaders = (h) => {
1968
+ if (!h) return {};
1969
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1970
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
1971
+ const headers = {};
1972
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
1973
+ return headers;
1974
+ };
1975
+ return customFetch(getAcceptOrganizationInvitationUrl(organizationId, invitationId, params), {
1976
+ ...options,
1977
+ method: "PATCH",
1978
+ headers: {
1979
+ "Content-Type": "application/json",
1980
+ ...getHeaders(options?.headers)
1981
+ },
1982
+ body: JSON.stringify(acceptOrganizationInvitationQuery)
1983
+ });
1984
+ };
1985
+ const getRejectOrganizationInvitationUrl = (organizationId, invitationId) => {
1986
+ return `/organizations/${organizationId}/invitations/${invitationId}/reject`;
1987
+ };
1988
+ /**
1989
+ * Rejects an invitation to join an organization.
1990
+ * @summary Reject invitation
1991
+ */
1992
+ const rejectOrganizationInvitation = async (organizationId, invitationId, options) => {
1993
+ return customFetch(getRejectOrganizationInvitationUrl(organizationId, invitationId), {
1994
+ ...options,
1995
+ method: "PATCH"
1996
+ });
1997
+ };
1998
+ const getRevokeOrganizationInvitationUrl = (organizationId, invitationId) => {
1999
+ return `/organizations/${organizationId}/invitations/${invitationId}/revoke`;
2000
+ };
2001
+ /**
2002
+ * Revokes a pending invitation.
2003
+ * @summary Revoke invitation
2004
+ */
2005
+ const revokeOrganizationInvitation = async (organizationId, invitationId, options) => {
2006
+ return customFetch(getRevokeOrganizationInvitationUrl(organizationId, invitationId), {
2007
+ ...options,
2008
+ method: "PATCH"
2009
+ });
2010
+ };
2011
+
2012
+ // src/gen/endpoints/organization-members/organization-members.ts
2013
+ var organization_members_exports = /* @__PURE__ */ __exportAll({
2014
+ addOrganizationMember: () => addOrganizationMember,
2015
+ deleteOrganizationMember: () => deleteOrganizationMember,
2016
+ getAddOrganizationMemberUrl: () => getAddOrganizationMemberUrl,
2017
+ getDeleteOrganizationMemberUrl: () => getDeleteOrganizationMemberUrl,
2018
+ getGetOrganizationMemberByUserIDUrl: () => getGetOrganizationMemberByUserIDUrl,
2019
+ getGetOrganizationMemberUrl: () => getGetOrganizationMemberUrl,
2020
+ getListOrganizationMembersUrl: () => getListOrganizationMembersUrl,
2021
+ getOrganizationMember: () => getOrganizationMember,
2022
+ getOrganizationMemberByUserID: () => getOrganizationMemberByUserID,
2023
+ getUpdateOrganizationMemberUrl: () => getUpdateOrganizationMemberUrl,
2024
+ listOrganizationMembers: () => listOrganizationMembers,
2025
+ updateOrganizationMember: () => updateOrganizationMember
2026
+ });
2027
+ const getListOrganizationMembersUrl = (organizationId, params) => {
2028
+ const normalizedParams = new URLSearchParams();
2029
+ Object.entries(params || {}).forEach(([key, value]) => {
2030
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
2031
+ });
2032
+ const stringifiedParams = normalizedParams.toString();
2033
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/members?${stringifiedParams}` : `/organizations/${organizationId}/members`;
2034
+ };
2035
+ /**
2036
+ * Lists the members of an organization, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10. `limit` is capped by the server's configured maximum page size, which defaults to 100; a larger value is silently reduced to the cap rather than rejected, and values below the minimum fall back to the defaults. The `pagination` object in the response always reports the values actually applied.
2037
+ * @summary List members
2038
+ */
2039
+ const listOrganizationMembers = async (organizationId, params, options) => {
2040
+ return customFetch(getListOrganizationMembersUrl(organizationId, params), {
2041
+ ...options,
2042
+ method: "GET"
2043
+ });
2044
+ };
2045
+ const getAddOrganizationMemberUrl = (organizationId) => {
2046
+ return `/organizations/${organizationId}/members`;
2047
+ };
2048
+ /**
2049
+ * Adds a user as a member of an organization with the specified role.
2050
+ * @summary Add member
2051
+ */
2052
+ const addOrganizationMember = async (organizationId, addOrganizationMemberRequest, options) => {
2053
+ const getHeaders = (h) => {
2054
+ if (!h) return {};
2055
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
2056
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2057
+ const headers = {};
2058
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
2059
+ return headers;
2060
+ };
2061
+ return customFetch(getAddOrganizationMemberUrl(organizationId), {
2062
+ ...options,
2063
+ method: "POST",
2064
+ headers: {
2065
+ "Content-Type": "application/json",
2066
+ ...getHeaders(options?.headers)
2067
+ },
2068
+ body: JSON.stringify(addOrganizationMemberRequest)
2069
+ });
2070
+ };
2071
+ const getGetOrganizationMemberByUserIDUrl = (organizationId, userId) => {
2072
+ return `/organizations/${organizationId}/members/by-user/${userId}`;
2073
+ };
2074
+ /**
2075
+ * Retrieves an organization member by the user's ID with nested user data.
2076
+ * @summary Get member by user ID
2077
+ */
2078
+ const getOrganizationMemberByUserID = async (organizationId, userId, options) => {
2079
+ return customFetch(getGetOrganizationMemberByUserIDUrl(organizationId, userId), {
2080
+ ...options,
2081
+ method: "GET"
2082
+ });
2083
+ };
2084
+ const getGetOrganizationMemberUrl = (organizationId, memberId) => {
2085
+ return `/organizations/${organizationId}/members/${memberId}`;
2086
+ };
2087
+ /**
2088
+ * Retrieves a single organization member by ID with nested user data.
2089
+ * @summary Get member
2090
+ */
2091
+ const getOrganizationMember = async (organizationId, memberId, options) => {
2092
+ return customFetch(getGetOrganizationMemberUrl(organizationId, memberId), {
2093
+ ...options,
2094
+ method: "GET"
2095
+ });
2096
+ };
2097
+ const getDeleteOrganizationMemberUrl = (organizationId, memberId) => {
2098
+ return `/organizations/${organizationId}/members/${memberId}`;
2099
+ };
2100
+ /**
2101
+ * Removes a member from an organization.
2102
+ * @summary Delete member
2103
+ */
2104
+ const deleteOrganizationMember = async (organizationId, memberId, options) => {
2105
+ return customFetch(getDeleteOrganizationMemberUrl(organizationId, memberId), {
2106
+ ...options,
2107
+ method: "DELETE"
2108
+ });
2109
+ };
2110
+ const getUpdateOrganizationMemberUrl = (organizationId, memberId) => {
2111
+ return `/organizations/${organizationId}/members/${memberId}`;
2112
+ };
2113
+ /**
2114
+ * Updates the role of an organization member.
2115
+ * @summary Update member
2116
+ */
2117
+ const updateOrganizationMember = async (organizationId, memberId, updateOrganizationMemberRequest, options) => {
2118
+ const getHeaders = (h) => {
2119
+ if (!h) return {};
2120
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
2121
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2122
+ const headers = {};
2123
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
2124
+ return headers;
2125
+ };
2126
+ return customFetch(getUpdateOrganizationMemberUrl(organizationId, memberId), {
2127
+ ...options,
2128
+ method: "PATCH",
2129
+ headers: {
2130
+ "Content-Type": "application/json",
2131
+ ...getHeaders(options?.headers)
2132
+ },
2133
+ body: JSON.stringify(updateOrganizationMemberRequest)
2134
+ });
2135
+ };
2136
+
2137
+ // src/gen/endpoints/organization-teams/organization-teams.ts
2138
+ var organization_teams_exports = /* @__PURE__ */ __exportAll({
2139
+ createOrganizationTeam: () => createOrganizationTeam,
2140
+ deleteOrganizationTeam: () => deleteOrganizationTeam,
2141
+ getCreateOrganizationTeamUrl: () => getCreateOrganizationTeamUrl,
2142
+ getDeleteOrganizationTeamUrl: () => getDeleteOrganizationTeamUrl,
2143
+ getGetOrganizationTeamUrl: () => getGetOrganizationTeamUrl,
2144
+ getListOrganizationTeamsUrl: () => getListOrganizationTeamsUrl,
2145
+ getOrganizationTeam: () => getOrganizationTeam,
2146
+ getUpdateOrganizationTeamUrl: () => getUpdateOrganizationTeamUrl,
2147
+ listOrganizationTeams: () => listOrganizationTeams,
2148
+ updateOrganizationTeam: () => updateOrganizationTeam
2149
+ });
2150
+ const getListOrganizationTeamsUrl = (organizationId, params) => {
2151
+ const normalizedParams = new URLSearchParams();
2152
+ Object.entries(params || {}).forEach(([key, value]) => {
2153
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
2154
+ });
2155
+ const stringifiedParams = normalizedParams.toString();
2156
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/teams?${stringifiedParams}` : `/organizations/${organizationId}/teams`;
2157
+ };
2158
+ /**
2159
+ * Lists the teams within an organization, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10. `limit` is capped by the server's configured maximum page size, which defaults to 100; a larger value is silently reduced to the cap rather than rejected, and values below the minimum fall back to the defaults. The `pagination` object in the response always reports the values actually applied.
2160
+ * @summary List teams
2161
+ */
2162
+ const listOrganizationTeams = async (organizationId, params, options) => {
2163
+ return customFetch(getListOrganizationTeamsUrl(organizationId, params), {
2164
+ ...options,
2165
+ method: "GET"
2166
+ });
2167
+ };
2168
+ const getCreateOrganizationTeamUrl = (organizationId) => {
2169
+ return `/organizations/${organizationId}/teams`;
2170
+ };
2171
+ /**
2172
+ * Creates a new team within an organization.
2173
+ * @summary Create team
2174
+ */
2175
+ const createOrganizationTeam = async (organizationId, createOrganizationTeamRequest, options) => {
2176
+ const getHeaders = (h) => {
2177
+ if (!h) return {};
2178
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
2179
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2180
+ const headers = {};
2181
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
2182
+ return headers;
2183
+ };
2184
+ return customFetch(getCreateOrganizationTeamUrl(organizationId), {
2185
+ ...options,
2186
+ method: "POST",
2187
+ headers: {
2188
+ "Content-Type": "application/json",
2189
+ ...getHeaders(options?.headers)
2190
+ },
2191
+ body: JSON.stringify(createOrganizationTeamRequest)
2192
+ });
2193
+ };
2194
+ const getGetOrganizationTeamUrl = (organizationId, teamId) => {
2195
+ return `/organizations/${organizationId}/teams/${teamId}`;
2196
+ };
2197
+ /**
2198
+ * Retrieves a single team by its ID.
2199
+ * @summary Get team
2200
+ */
2201
+ const getOrganizationTeam = async (organizationId, teamId, options) => {
2202
+ return customFetch(getGetOrganizationTeamUrl(organizationId, teamId), {
2203
+ ...options,
2204
+ method: "GET"
2205
+ });
2206
+ };
2207
+ const getDeleteOrganizationTeamUrl = (organizationId, teamId) => {
2208
+ return `/organizations/${organizationId}/teams/${teamId}`;
2209
+ };
2210
+ /**
2211
+ * Deletes a team.
2212
+ * @summary Delete team
2213
+ */
2214
+ const deleteOrganizationTeam = async (organizationId, teamId, options) => {
2215
+ return customFetch(getDeleteOrganizationTeamUrl(organizationId, teamId), {
2216
+ ...options,
2217
+ method: "DELETE"
2218
+ });
2219
+ };
2220
+ const getUpdateOrganizationTeamUrl = (organizationId, teamId) => {
2221
+ return `/organizations/${organizationId}/teams/${teamId}`;
2222
+ };
2223
+ /**
2224
+ * Updates an existing team.
2225
+ * @summary Update team
2226
+ */
2227
+ const updateOrganizationTeam = async (organizationId, teamId, updateOrganizationTeamRequest, options) => {
2228
+ const getHeaders = (h) => {
2229
+ if (!h) return {};
2230
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
2231
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2232
+ const headers = {};
2233
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
2234
+ return headers;
2235
+ };
2236
+ return customFetch(getUpdateOrganizationTeamUrl(organizationId, teamId), {
2237
+ ...options,
2238
+ method: "PATCH",
2239
+ headers: {
2240
+ "Content-Type": "application/json",
2241
+ ...getHeaders(options?.headers)
2242
+ },
2243
+ body: JSON.stringify(updateOrganizationTeamRequest)
2244
+ });
2245
+ };
2246
+
2247
+ // src/gen/endpoints/organization-team-members/organization-team-members.ts
2248
+ var organization_team_members_exports = /* @__PURE__ */ __exportAll({
2249
+ addOrganizationTeamMember: () => addOrganizationTeamMember,
2250
+ deleteOrganizationTeamMember: () => deleteOrganizationTeamMember,
2251
+ getAddOrganizationTeamMemberUrl: () => getAddOrganizationTeamMemberUrl,
2252
+ getDeleteOrganizationTeamMemberUrl: () => getDeleteOrganizationTeamMemberUrl,
2253
+ getGetOrganizationTeamMemberUrl: () => getGetOrganizationTeamMemberUrl,
2254
+ getListOrganizationTeamMembersUrl: () => getListOrganizationTeamMembersUrl,
2255
+ getOrganizationTeamMember: () => getOrganizationTeamMember,
2256
+ listOrganizationTeamMembers: () => listOrganizationTeamMembers
2257
+ });
2258
+ const getListOrganizationTeamMembersUrl = (organizationId, teamId, params) => {
2259
+ const normalizedParams = new URLSearchParams();
2260
+ Object.entries(params || {}).forEach(([key, value]) => {
2261
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
2262
+ });
2263
+ const stringifiedParams = normalizedParams.toString();
2264
+ return stringifiedParams.length > 0 ? `/organizations/${organizationId}/teams/${teamId}/members?${stringifiedParams}` : `/organizations/${organizationId}/teams/${teamId}/members`;
2265
+ };
2266
+ /**
2267
+ * Lists the members of a team, newest first. Results are paginated: `page` defaults to 1 and `limit` defaults to 10. `limit` is capped by the server's configured maximum page size, which defaults to 100; a larger value is silently reduced to the cap rather than rejected, and values below the minimum fall back to the defaults. The `pagination` object in the response always reports the values actually applied.
2268
+ * @summary List team members
2269
+ */
2270
+ const listOrganizationTeamMembers = async (organizationId, teamId, params, options) => {
2271
+ return customFetch(getListOrganizationTeamMembersUrl(organizationId, teamId, params), {
2272
+ ...options,
2273
+ method: "GET"
2274
+ });
2275
+ };
2276
+ const getAddOrganizationTeamMemberUrl = (organizationId, teamId) => {
2277
+ return `/organizations/${organizationId}/teams/${teamId}/members`;
2278
+ };
2279
+ /**
2280
+ * Adds a member to a team.
2281
+ * @summary Add team member
2282
+ */
2283
+ const addOrganizationTeamMember = async (organizationId, teamId, addOrganizationTeamMemberRequest, options) => {
2284
+ const getHeaders = (h) => {
2285
+ if (!h) return {};
2286
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
2287
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2288
+ const headers = {};
2289
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
2290
+ return headers;
2291
+ };
2292
+ return customFetch(getAddOrganizationTeamMemberUrl(organizationId, teamId), {
2293
+ ...options,
2294
+ method: "POST",
2295
+ headers: {
2296
+ "Content-Type": "application/json",
2297
+ ...getHeaders(options?.headers)
2298
+ },
2299
+ body: JSON.stringify(addOrganizationTeamMemberRequest)
2300
+ });
2301
+ };
2302
+ const getGetOrganizationTeamMemberUrl = (organizationId, teamId, memberId) => {
2303
+ return `/organizations/${organizationId}/teams/${teamId}/members/${memberId}`;
2304
+ };
2305
+ /**
2306
+ * Retrieves a single team member by ID with nested member and user data.
2307
+ * @summary Get team member
2308
+ */
2309
+ const getOrganizationTeamMember = async (organizationId, teamId, memberId, options) => {
2310
+ return customFetch(getGetOrganizationTeamMemberUrl(organizationId, teamId, memberId), {
2311
+ ...options,
2312
+ method: "GET"
2313
+ });
2314
+ };
2315
+ const getDeleteOrganizationTeamMemberUrl = (organizationId, teamId, memberId) => {
2316
+ return `/organizations/${organizationId}/teams/${teamId}/members/${memberId}`;
2317
+ };
2318
+ /**
2319
+ * Removes a member from a team.
2320
+ * @summary Delete team member
2321
+ */
2322
+ const deleteOrganizationTeamMember = async (organizationId, teamId, memberId, options) => {
2323
+ return customFetch(getDeleteOrganizationTeamMemberUrl(organizationId, teamId, memberId), {
2324
+ ...options,
2325
+ method: "DELETE"
2326
+ });
2327
+ };
2328
+
2329
+ // src/plugins/organizations/plugin.ts
2330
+ var OrganizationsPlugin = class {
2331
+ id = "organizations";
2332
+ init(client) {
2333
+ return wrapGenerated({
2334
+ ...organizations_exports,
2335
+ ...organization_invitations_exports,
2336
+ ...organization_members_exports,
2337
+ ...organization_teams_exports,
2338
+ ...organization_team_members_exports
2339
+ }, client);
2340
+ }
2341
+ };
2342
+
2343
+ // src/gen/endpoints/totp-plugin/totp-plugin.ts
2344
+ var totp_plugin_exports = /* @__PURE__ */ __exportAll({
2345
+ disableTotp: () => disableTotp,
2346
+ enableTotp: () => enableTotp,
2347
+ generateTotpBackupCodes: () => generateTotpBackupCodes,
2348
+ getDisableTotpUrl: () => getDisableTotpUrl,
2349
+ getEnableTotpUrl: () => getEnableTotpUrl,
2350
+ getGenerateTotpBackupCodesUrl: () => getGenerateTotpBackupCodesUrl,
2351
+ getGetTotpURIUrl: () => getGetTotpURIUrl,
2352
+ getTotpURI: () => getTotpURI,
2353
+ getVerifyTotpBackupCodeUrl: () => getVerifyTotpBackupCodeUrl,
2354
+ getVerifyTotpUrl: () => getVerifyTotpUrl,
2355
+ verifyTotp: () => verifyTotp,
2356
+ verifyTotpBackupCode: () => verifyTotpBackupCode
2357
+ });
2358
+ const getDisableTotpUrl = () => {
2359
+ return `/totp/disable`;
2360
+ };
2361
+ /**
2362
+ * Disables TOTP two-factor authentication for the authenticated user.
2363
+ * @summary Disable TOTP
2364
+ */
2365
+ const disableTotp = async (options) => {
2366
+ return customFetch(getDisableTotpUrl(), {
2367
+ ...options,
2368
+ method: "POST"
2369
+ });
2370
+ };
2371
+ const getEnableTotpUrl = () => {
2372
+ return `/totp/enable`;
2373
+ };
2374
+ /**
2375
+ * Enables TOTP two-factor authentication for the authenticated user. Returns the TOTP URI and backup codes.
2376
+ * @summary Enable TOTP
2377
+ */
2378
+ const enableTotp = async (options) => {
2379
+ return customFetch(getEnableTotpUrl(), {
2380
+ ...options,
2381
+ method: "POST"
2382
+ });
2383
+ };
2384
+ const getGenerateTotpBackupCodesUrl = () => {
2385
+ return `/totp/generate-backup-codes`;
2386
+ };
2387
+ /**
2388
+ * Generates a new set of backup codes for the authenticated user. Previous backup codes are invalidated.
2389
+ * @summary Generate backup codes
2390
+ */
2391
+ const generateTotpBackupCodes = async (options) => {
2392
+ return customFetch(getGenerateTotpBackupCodesUrl(), {
2393
+ ...options,
2394
+ method: "POST"
2395
+ });
2396
+ };
2397
+ const getGetTotpURIUrl = () => {
2398
+ return `/totp/get-uri`;
2399
+ };
2400
+ /**
2401
+ * Returns the current TOTP URI for the authenticated user's authenticator app configuration.
2402
+ * @summary Get TOTP URI
2403
+ */
2404
+ const getTotpURI = async (options) => {
2405
+ return customFetch(getGetTotpURIUrl(), {
2406
+ ...options,
2407
+ method: "GET"
2408
+ });
2409
+ };
2410
+ const getVerifyTotpUrl = () => {
2411
+ return `/totp/verify`;
2412
+ };
2413
+ /**
2414
+ * Verifies a TOTP code from the authenticator app and completes authentication. Requires a pending TOTP cookie set during sign-in.
2415
+ * @summary Verify TOTP code
2416
+ */
2417
+ const verifyTotp = async (verifyTOTPRequest, options) => {
2418
+ const getHeaders = (h) => {
2419
+ if (!h) return {};
2420
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
2421
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2422
+ const headers = {};
2423
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
2424
+ return headers;
2425
+ };
2426
+ return customFetch(getVerifyTotpUrl(), {
2427
+ ...options,
2428
+ method: "POST",
2429
+ headers: {
2430
+ "Content-Type": "application/json",
2431
+ ...getHeaders(options?.headers)
2432
+ },
2433
+ body: JSON.stringify(verifyTOTPRequest)
2434
+ });
2435
+ };
2436
+ const getVerifyTotpBackupCodeUrl = () => {
2437
+ return `/totp/verify-backup-code`;
2438
+ };
2439
+ /**
2440
+ * Verifies a backup code as an alternative to TOTP verification. Completes authentication if the code is valid.
2441
+ * @summary Verify backup code
2442
+ */
2443
+ const verifyTotpBackupCode = async (verifyBackupCodeRequest, options) => {
2444
+ const getHeaders = (h) => {
2445
+ if (!h) return {};
2446
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
2447
+ if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
2448
+ const headers = {};
2449
+ for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
2450
+ return headers;
2451
+ };
2452
+ return customFetch(getVerifyTotpBackupCodeUrl(), {
2453
+ ...options,
2454
+ method: "POST",
2455
+ headers: {
2456
+ "Content-Type": "application/json",
2457
+ ...getHeaders(options?.headers)
2458
+ },
2459
+ body: JSON.stringify(verifyBackupCodeRequest)
2460
+ });
2461
+ };
2462
+
2463
+ // src/plugins/totp/plugin.ts
2464
+ var TOTPPlugin = class {
2465
+ id = "totp";
2466
+ init(client) {
2467
+ return wrapGenerated(totp_plugin_exports, client);
2468
+ }
2469
+ };
2470
+
2471
+ export { AccessControlPlugin, AdminPlugin, ApiKeyPlugin, BearerPlugin, CSRFPlugin, CorePlugin, EmailPasswordPlugin, JWTPlugin, MagicLinkPlugin, OAuth2Plugin, OrganizationsPlugin, TOTPPlugin };
2472
+ //# sourceMappingURL=plugins.js.map