authula 0.5.4 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,825 +0,0 @@
1
- import { h as User, l as Plugin, m as Session, p as Account, t as ClientWithPlugins, u as AuthulaClient } from "../sdk-7eSlhCrf.cjs";
2
- import { z } from "zod";
3
-
4
- //#region src/plugins/access-control/types.d.ts
5
- declare const roleSchema: z.ZodObject<{
6
- id: z.ZodString;
7
- name: z.ZodString;
8
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
- weight: z.ZodNumber;
10
- isSystem: z.ZodBoolean;
11
- createdAt: z.ZodISODateTime;
12
- updatedAt: z.ZodISODateTime;
13
- }, z.core.$strip>;
14
- type Role = z.infer<typeof roleSchema>;
15
- declare const permissionSchema: z.ZodObject<{
16
- id: z.ZodString;
17
- key: z.ZodString;
18
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
- isSystem: z.ZodBoolean;
20
- createdAt: z.ZodISODateTime;
21
- updatedAt: z.ZodISODateTime;
22
- }, z.core.$strip>;
23
- type Permission = z.infer<typeof permissionSchema>;
24
- declare const permissionGrantSourceSchema: z.ZodObject<{
25
- roleId: z.ZodString;
26
- roleName: z.ZodString;
27
- grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
- grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
29
- }, z.core.$strip>;
30
- type PermissionGrantSource = z.infer<typeof permissionGrantSourceSchema>;
31
- declare const userPermissionInfoSchema: z.ZodObject<{
32
- permissionId: z.ZodString;
33
- permissionKey: z.ZodString;
34
- permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
- grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
- grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
37
- sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
38
- roleId: z.ZodString;
39
- roleName: z.ZodString;
40
- grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
- grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
42
- }, z.core.$strip>>>;
43
- }, z.core.$strip>;
44
- type UserPermissionInfo = z.infer<typeof userPermissionInfoSchema>;
45
- declare const userRoleInfoSchema: z.ZodObject<{
46
- roleId: z.ZodString;
47
- roleName: z.ZodString;
48
- roleDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
- assignedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
- assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
51
- expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
52
- }, z.core.$strip>;
53
- type UserRoleInfo = z.infer<typeof userRoleInfoSchema>;
54
- declare const roleDetailsSchema: z.ZodObject<{
55
- role: z.ZodObject<{
56
- id: z.ZodString;
57
- name: z.ZodString;
58
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
- weight: z.ZodNumber;
60
- isSystem: z.ZodBoolean;
61
- createdAt: z.ZodISODateTime;
62
- updatedAt: z.ZodISODateTime;
63
- }, z.core.$strip>;
64
- permissions: z.ZodArray<z.ZodObject<{
65
- permissionId: z.ZodString;
66
- permissionKey: z.ZodString;
67
- permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
- grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
- grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
70
- sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
- roleId: z.ZodString;
72
- roleName: z.ZodString;
73
- grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
- grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
75
- }, z.core.$strip>>>;
76
- }, z.core.$strip>>;
77
- }, z.core.$strip>;
78
- type RoleDetails = z.infer<typeof roleDetailsSchema>;
79
- declare const getUserPermissionsResponseSchema: z.ZodObject<{
80
- permissions: z.ZodArray<z.ZodObject<{
81
- permissionId: z.ZodString;
82
- permissionKey: z.ZodString;
83
- permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
- grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
- grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
86
- sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
- roleId: z.ZodString;
88
- roleName: z.ZodString;
89
- grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
90
- grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
91
- }, z.core.$strip>>>;
92
- }, z.core.$strip>>;
93
- }, z.core.$strip>;
94
- type GetUserPermissionsResponse = z.infer<typeof getUserPermissionsResponseSchema>;
95
- declare const checkUserPermissionsResponseSchema: z.ZodObject<{
96
- hasPermissions: z.ZodBoolean;
97
- }, z.core.$strip>;
98
- type CheckUserPermissionsResponse = z.infer<typeof checkUserPermissionsResponseSchema>;
99
- type CreateRoleRequest = {
100
- name: string;
101
- description?: string | null;
102
- weight?: number;
103
- isSystem?: boolean;
104
- };
105
- type CreateRoleResponse = {
106
- role: Role;
107
- };
108
- type UpdateRoleRequest = {
109
- name?: string | null;
110
- description?: string | null;
111
- weight?: number;
112
- };
113
- type UpdateRoleResponse = {
114
- role: Role;
115
- };
116
- type DeleteRoleResponse = {
117
- message: string;
118
- };
119
- type CreatePermissionRequest = {
120
- key: string;
121
- description?: string | null;
122
- isSystem?: boolean;
123
- };
124
- type CreatePermissionResponse = {
125
- permission: Permission;
126
- };
127
- type UpdatePermissionRequest = {
128
- description?: string | null;
129
- };
130
- type UpdatePermissionResponse = {
131
- permission: Permission;
132
- };
133
- type DeletePermissionResponse = {
134
- message: string;
135
- };
136
- type AddRolePermissionRequest = {
137
- permissionId: string;
138
- };
139
- type AddRolePermissionResponse = {
140
- message: string;
141
- };
142
- type ReplaceRolePermissionsRequest = {
143
- permissionIds: string[];
144
- };
145
- type ReplaceRolePermissionResponse = {
146
- message: string;
147
- };
148
- type RemoveRolePermissionResponse = {
149
- message: string;
150
- };
151
- type AssignUserRoleRequest = {
152
- roleId: string;
153
- expiresAt?: string | null;
154
- };
155
- type ReplaceUserRolesRequest = {
156
- roleIds: string[];
157
- };
158
- type ReplaceUserRolesResponse = {
159
- message: string;
160
- };
161
- type AssignUserRoleResponse = {
162
- message: string;
163
- };
164
- type RemoveUserRoleResponse = {
165
- message: string;
166
- };
167
- type CheckUserPermissionsRequest = {
168
- permissionKeys: string[];
169
- };
170
- type UserWithPermissions = {
171
- user: User;
172
- permissions: UserPermissionInfo[];
173
- };
174
- type UserAuthorizationProfile = {
175
- user: User;
176
- roles: UserRoleInfo[];
177
- permissions: UserPermissionInfo[];
178
- };
179
- type UserWithRoles = {
180
- user: User;
181
- roles: UserRoleInfo[];
182
- };
183
- //#endregion
184
- //#region src/plugins/access-control/plugin.d.ts
185
- declare class AccessControlPlugin implements Plugin {
186
- readonly id = "accessControl";
187
- constructor();
188
- init(client: AuthulaClient): {
189
- createRole: (data: CreateRoleRequest) => Promise<CreateRoleResponse>;
190
- getAllRoles: () => Promise<Role[]>;
191
- getRoleByName: (roleName: string) => Promise<Role>;
192
- getRoleById: (roleId: string) => Promise<RoleDetails>;
193
- updateRole: (roleId: string, data: UpdateRoleRequest) => Promise<UpdateRoleResponse>;
194
- deleteRole: (roleId: string) => Promise<DeleteRoleResponse>;
195
- createPermission: (data: CreatePermissionRequest) => Promise<CreatePermissionResponse>;
196
- getAllPermissions: () => Promise<Permission[]>;
197
- getPermissionById: (permissionId: string) => Promise<Permission>;
198
- updatePermission: (permissionId: string, data: UpdatePermissionRequest) => Promise<UpdatePermissionResponse>;
199
- deletePermission: (permissionId: string) => Promise<DeletePermissionResponse>;
200
- addRolePermission: (roleId: string, data: AddRolePermissionRequest) => Promise<AddRolePermissionResponse>;
201
- getRolePermissions: (roleId: string) => Promise<UserPermissionInfo[]>;
202
- replaceRolePermissions: (roleId: string, data: ReplaceRolePermissionsRequest) => Promise<ReplaceRolePermissionResponse>;
203
- removeRolePermission: (roleId: string, permissionId: string) => Promise<RemoveRolePermissionResponse>;
204
- getUserRoles: (userId: string) => Promise<UserRoleInfo[]>;
205
- assignUserRole: (userId: string, data: AssignUserRoleRequest) => Promise<AssignUserRoleResponse>;
206
- replaceUserRoles: (userId: string, data: ReplaceUserRolesRequest) => Promise<ReplaceUserRolesResponse>;
207
- removeUserRole: (userId: string, roleId: string) => Promise<RemoveUserRoleResponse>;
208
- getUserPermissions: (userId: string) => Promise<GetUserPermissionsResponse>;
209
- checkUserPermissions: (userId: string, data: CheckUserPermissionsRequest) => Promise<CheckUserPermissionsResponse>;
210
- };
211
- }
212
- //#endregion
213
- //#region src/plugins/admin/types.d.ts
214
- declare const adminUserStateSchema: z.ZodObject<{
215
- userId: z.ZodString;
216
- isBanned: z.ZodBoolean;
217
- bannedAt: z.ZodNullable<z.ZodISODateTime>;
218
- bannedUntil: z.ZodNullable<z.ZodISODateTime>;
219
- bannedReason: z.ZodNullable<z.ZodString>;
220
- bannedByUserId: z.ZodNullable<z.ZodString>;
221
- createdAt: z.ZodISODateTime;
222
- updatedAt: z.ZodISODateTime;
223
- }, z.core.$strip>;
224
- type AdminUserState = z.infer<typeof adminUserStateSchema>;
225
- declare const adminSessionStateSchema: z.ZodObject<{
226
- sessionId: z.ZodString;
227
- revokedAt: z.ZodNullable<z.ZodISODateTime>;
228
- revokedReason: z.ZodNullable<z.ZodString>;
229
- revokedByUserId: z.ZodNullable<z.ZodString>;
230
- impersonatorUserId: z.ZodNullable<z.ZodString>;
231
- impersonationReason: z.ZodNullable<z.ZodString>;
232
- impersonationExpiresAt: z.ZodNullable<z.ZodISODateTime>;
233
- createdAt: z.ZodISODateTime;
234
- updatedAt: z.ZodISODateTime;
235
- }, z.core.$strip>;
236
- type AdminSessionState = z.infer<typeof adminSessionStateSchema>;
237
- declare const adminUserSessionSchema: z.ZodObject<{
238
- session: z.ZodObject<{
239
- id: z.ZodUUID;
240
- userId: z.ZodString;
241
- token: z.ZodString;
242
- expiresAt: z.ZodISODateTime;
243
- ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
244
- userAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
- createdAt: z.ZodISODateTime;
246
- updatedAt: z.ZodISODateTime;
247
- }, z.core.$strip>;
248
- state: z.ZodNullable<z.ZodObject<{
249
- sessionId: z.ZodString;
250
- revokedAt: z.ZodNullable<z.ZodISODateTime>;
251
- revokedReason: z.ZodNullable<z.ZodString>;
252
- revokedByUserId: z.ZodNullable<z.ZodString>;
253
- impersonatorUserId: z.ZodNullable<z.ZodString>;
254
- impersonationReason: z.ZodNullable<z.ZodString>;
255
- impersonationExpiresAt: z.ZodNullable<z.ZodISODateTime>;
256
- createdAt: z.ZodISODateTime;
257
- updatedAt: z.ZodISODateTime;
258
- }, z.core.$strip>>;
259
- }, z.core.$strip>;
260
- type AdminUserSession = z.infer<typeof adminUserSessionSchema>;
261
- declare const impersonationSchema: z.ZodObject<{
262
- id: z.ZodString;
263
- actorUserId: z.ZodString;
264
- targetUserId: z.ZodString;
265
- actorSessionId: z.ZodNullable<z.ZodString>;
266
- impersonationSessionId: z.ZodNullable<z.ZodString>;
267
- reason: z.ZodString;
268
- startedAt: z.ZodISODateTime;
269
- expiresAt: z.ZodISODateTime;
270
- endedAt: z.ZodNullable<z.ZodISODateTime>;
271
- endedByUserId: z.ZodNullable<z.ZodString>;
272
- createdAt: z.ZodISODateTime;
273
- updatedAt: z.ZodISODateTime;
274
- }, z.core.$strip>;
275
- type Impersonation = z.infer<typeof impersonationSchema>;
276
- type CreateUserRequest = {
277
- name: string;
278
- email: string;
279
- emailVerified?: boolean;
280
- image?: string;
281
- metadata?: Record<string, unknown>;
282
- };
283
- type CreateUserResponse = {
284
- user: User;
285
- };
286
- type GetAllUsersResponse = {
287
- users: Array<User>;
288
- nextCursor?: string | null;
289
- };
290
- type GetUserByIdResponse = {
291
- user: User;
292
- };
293
- type UpdateUserRequest = {
294
- name?: string;
295
- email?: string;
296
- emailVerified?: boolean;
297
- image?: string;
298
- metadata?: Record<string, unknown>;
299
- };
300
- type UpdateUserResponse = {
301
- user: User;
302
- };
303
- type DeleteUserResponse = {
304
- message: string;
305
- };
306
- type CreateAccountRequest = {
307
- providerId: string;
308
- accountId: string;
309
- accessToken?: string;
310
- refreshToken?: string;
311
- idToken?: string;
312
- accessTokenExpiresAt?: string;
313
- refreshTokenExpiresAt?: string;
314
- scope?: string;
315
- password?: string;
316
- };
317
- type CreateAccountResponse = {
318
- account: Account;
319
- };
320
- type GetUserAccountsResponse = {
321
- accounts: Array<Account>;
322
- };
323
- type GetAccountByIdResponse = {
324
- account: Account;
325
- };
326
- type UpdateAccountRequest = {
327
- providerId?: string;
328
- accountId?: string;
329
- accessToken?: string;
330
- refreshToken?: string;
331
- idToken?: string;
332
- accessTokenExpiresAt?: string;
333
- refreshTokenExpiresAt?: string;
334
- scope?: string;
335
- password?: string;
336
- };
337
- type UpdateAccountResponse = {
338
- account: Account;
339
- };
340
- type DeleteAccountResponse = {
341
- message: string;
342
- };
343
- type GetUserStateResponse = {
344
- state: AdminUserState;
345
- };
346
- type CreateUserStateRequest = {
347
- banned: boolean;
348
- bannedUntil?: string;
349
- bannedReason?: string;
350
- };
351
- type UpdateUserStateRequest = {
352
- banned: boolean;
353
- bannedUntil?: string;
354
- bannedReason?: string;
355
- };
356
- type CreateUserStateResponse = {
357
- userState: AdminUserState;
358
- };
359
- type UpdateUserStateResponse = {
360
- userState: AdminUserState;
361
- };
362
- type DeleteUserStateResponse = {
363
- message: string;
364
- };
365
- type GetBannedUserStatesResponse = Array<AdminUserState>;
366
- type BanUserRequest = {
367
- bannedUntil?: string;
368
- reason?: string;
369
- };
370
- type BanUserResponse = {
371
- state: AdminUserState;
372
- };
373
- type UnbanUserResponse = {
374
- state: AdminUserState;
375
- };
376
- type GetUserAdminSessionsResponse = Array<AdminUserSession>;
377
- type GetSessionStateResponse = {
378
- state: AdminSessionState;
379
- };
380
- type CreateSessionStateRequest = {
381
- revoke: boolean;
382
- revokedReason?: string;
383
- impersonatorUserId?: string;
384
- impersonationReason?: string;
385
- impersonationExpiresAt?: string;
386
- };
387
- type UpdateSessionStateRequest = {
388
- revoke: boolean;
389
- revokedReason?: string;
390
- impersonatorUserId?: string;
391
- impersonationReason?: string;
392
- impersonationExpiresAt?: string;
393
- };
394
- type CreateSessionStateResponse = {
395
- state: AdminSessionState;
396
- };
397
- type UpdateSessionStateResponse = {
398
- state: AdminSessionState;
399
- };
400
- type DeleteSessionStateResponse = {
401
- message: string;
402
- };
403
- type GetRevokedSessionStatesResponse = Array<AdminSessionState>;
404
- type RevokeSessionRequest = {
405
- reason?: string;
406
- };
407
- type RevokeSessionResponse = {
408
- sessionState: AdminSessionState;
409
- };
410
- type GetAllImpersonationsResponse = Array<Impersonation>;
411
- type GetImpersonationByIdResponse = {
412
- impersonation: Impersonation;
413
- };
414
- type StartImpersonationRequest = {
415
- targetUserId: string;
416
- reason: string;
417
- expiresInSeconds?: number;
418
- };
419
- type StartImpersonationResponse = {
420
- impersonation: Impersonation;
421
- };
422
- type StopImpersonationResponse = {
423
- message: string;
424
- };
425
- //#endregion
426
- //#region src/plugins/admin/plugin.d.ts
427
- declare class AdminPlugin implements Plugin {
428
- readonly id = "admin";
429
- constructor();
430
- init(client: AuthulaClient): {
431
- createUser: (data: CreateUserRequest) => Promise<CreateUserResponse>;
432
- getAllUsers: (limit?: number) => Promise<GetAllUsersResponse>;
433
- getUserById: (userId: string) => Promise<GetUserByIdResponse>;
434
- updateUser: (userId: string, data: UpdateUserRequest) => Promise<UpdateUserResponse>;
435
- deleteUser: (userId: string) => Promise<DeleteUserResponse>;
436
- createAccount: (userId: string, data: CreateAccountRequest) => Promise<CreateAccountResponse>;
437
- getUserAccounts: (userId: string) => Promise<GetUserAccountsResponse>;
438
- getAccountById: (id: string) => Promise<GetAccountByIdResponse>;
439
- updateAccount: (id: string, data: UpdateAccountRequest) => Promise<UpdateAccountResponse>;
440
- deleteAccount: (id: string) => Promise<DeleteAccountResponse>;
441
- getUserState: (userId: string) => Promise<GetUserStateResponse>;
442
- createUserState: (userId: string, data: CreateUserStateRequest) => Promise<CreateUserStateResponse>;
443
- updateUserState: (userId: string, data: UpdateUserStateRequest) => Promise<UpdateUserStateResponse>;
444
- deleteUserState: (userId: string) => Promise<DeleteUserStateResponse>;
445
- getBannedUserStates: () => Promise<GetBannedUserStatesResponse>;
446
- banUser: (userId: string, data: BanUserRequest) => Promise<BanUserResponse>;
447
- unbanUser: (userId: string) => Promise<UnbanUserResponse>;
448
- getUserAdminSessions: (userId: string) => Promise<GetUserAdminSessionsResponse>;
449
- getSessionState: (sessionId: string) => Promise<GetSessionStateResponse>;
450
- createSessionState: (sessionId: string, data: CreateSessionStateRequest) => Promise<CreateSessionStateResponse>;
451
- updateSessionState: (sessionId: string, data: UpdateSessionStateRequest) => Promise<UpdateSessionStateResponse>;
452
- deleteSessionState: (sessionId: string) => Promise<DeleteSessionStateResponse>;
453
- getRevokedSessionStates: () => Promise<GetRevokedSessionStatesResponse>;
454
- revokeSession: (sessionId: string, data: RevokeSessionRequest) => Promise<RevokeSessionResponse>;
455
- getAllImpersonations: () => Promise<GetAllImpersonationsResponse>;
456
- getImpersonationById: (impersonationId: string) => Promise<GetImpersonationByIdResponse>;
457
- startImpersonation: (data: StartImpersonationRequest) => Promise<StartImpersonationResponse>;
458
- stopImpersonation: (impersonationId: string) => Promise<StopImpersonationResponse>;
459
- };
460
- }
461
- //#endregion
462
- //#region src/plugins/bearer/types.d.ts
463
- type BearerPluginOptions = {
464
- headerName?: string;
465
- };
466
- type JWTTokensResponse = {
467
- accessToken: string;
468
- refreshToken: string;
469
- };
470
- //#endregion
471
- //#region src/plugins/jwt/types.d.ts
472
- type TokenRefreshRequest = {
473
- refreshToken: string;
474
- };
475
- type TokenRefreshResponse = {
476
- accessToken: string;
477
- refreshToken: string;
478
- };
479
- type JWTAlgorithm = "eddsa" | "rs256" | "ps256" | "es256" | "es512" | "ecdh-es";
480
- type JWKSKey = {
481
- alg: JWTAlgorithm;
482
- crv: string;
483
- kid: string;
484
- kty: string;
485
- x: string;
486
- };
487
- //#endregion
488
- //#region src/plugins/jwt/plugin.d.ts
489
- declare class JWTPlugin implements Plugin {
490
- readonly id = "jwt";
491
- constructor();
492
- init(client: AuthulaClient): {
493
- refreshToken: (data: TokenRefreshRequest) => Promise<TokenRefreshResponse>;
494
- getJWKSKeys: () => Promise<Array<JWKSKey>>;
495
- };
496
- }
497
- //#endregion
498
- //#region src/plugins/bearer/plugin.d.ts
499
- declare class BearerPlugin implements Plugin {
500
- private readonly options?;
501
- readonly id = "bearer";
502
- private refreshPromise;
503
- constructor(options?: BearerPluginOptions | undefined);
504
- init(client: ClientWithPlugins<[JWTPlugin]>): {};
505
- }
506
- //#endregion
507
- //#region src/plugins/csrf/types.d.ts
508
- type CSRFPluginOptions = {
509
- cookieName: string;
510
- headerName: string;
511
- };
512
- //#endregion
513
- //#region src/plugins/csrf/plugin.d.ts
514
- declare class CSRFPlugin implements Plugin {
515
- private readonly options;
516
- readonly id = "csrf";
517
- constructor(options: CSRFPluginOptions);
518
- init(client: AuthulaClient): {};
519
- private cookies?;
520
- attachCookies(fn: () => Promise<any>): void;
521
- }
522
- //#endregion
523
- //#region src/plugins/email-password/types.d.ts
524
- type SignUpRequest = {
525
- name: string;
526
- email: string;
527
- password: string;
528
- callbackUrl?: string;
529
- };
530
- type SignInRequest = {
531
- email: string;
532
- password: string;
533
- callbackUrl?: string;
534
- };
535
- type VerifyEmailRequest = {
536
- token: string;
537
- callbackUrl?: string;
538
- };
539
- type SendEmailVerificationRequest = {
540
- callbackUrl?: string;
541
- };
542
- type RequestPasswordResetRequest = {
543
- email: string;
544
- callbackUrl?: string;
545
- };
546
- type ChangePasswordRequest = {
547
- token: string;
548
- password: string;
549
- };
550
- type RequestEmailChangeRequest = {
551
- newEmail: string;
552
- callbackUrl?: string;
553
- };
554
- //#endregion
555
- //#region src/plugins/email-password/plugin.d.ts
556
- declare class EmailPasswordPlugin implements Plugin {
557
- readonly id = "emailPassword";
558
- init(client: AuthulaClient): {
559
- signUp: <T>(data: SignUpRequest) => Promise<T>;
560
- signIn: <T>(data: SignInRequest) => Promise<T>;
561
- sendEmailVerification: (data: SendEmailVerificationRequest) => Promise<void>;
562
- requestPasswordReset: (data: RequestPasswordResetRequest) => Promise<void>;
563
- changePassword: (data: ChangePasswordRequest) => Promise<void>;
564
- requestEmailChange: (data: RequestEmailChangeRequest) => Promise<void>;
565
- };
566
- }
567
- //#endregion
568
- //#region src/plugins/magic-link/types.d.ts
569
- type MagicLinkSignInRequest = {
570
- email: string;
571
- name?: string;
572
- callbackUrl?: string;
573
- };
574
- type MagicLinkSignInResponse = {
575
- message: string;
576
- };
577
- type MagicLinkVerifyRequest = {
578
- token: string;
579
- callbackUrl?: string;
580
- };
581
- type MagicLinkVerifyResponse = {
582
- message: string;
583
- token: string;
584
- };
585
- type MagicLinkExchangeRequest = {
586
- token: string;
587
- };
588
- //#endregion
589
- //#region src/plugins/magic-link/plugin.d.ts
590
- declare class MagicLinkPlugin implements Plugin {
591
- readonly id = "magicLink";
592
- constructor();
593
- init(client: AuthulaClient): {
594
- signIn: (data: MagicLinkSignInRequest) => Promise<MagicLinkSignInResponse>;
595
- verify: (data: MagicLinkVerifyRequest) => Promise<MagicLinkVerifyResponse>;
596
- exchange: <T>(data: MagicLinkExchangeRequest) => Promise<T>;
597
- };
598
- }
599
- //#endregion
600
- //#region src/plugins/oauth2/types.d.ts
601
- /**
602
- * OAuth2 provider types supported by Authula
603
- */
604
- type OAuth2ProviderType = "discord" | "github" | "google";
605
- /**
606
- * OAuth2 authorization options
607
- */
608
- type SignInWithOAuth2Request = {
609
- /** OAuth2 provider to use */provider: OAuth2ProviderType;
610
- redirectTo?: string;
611
- };
612
- type SignInWithOAuth2Response = {
613
- authUrl: string;
614
- };
615
- //#endregion
616
- //#region src/plugins/oauth2/plugin.d.ts
617
- declare class OAuth2Plugin implements Plugin {
618
- readonly id = "oauth2";
619
- init(client: AuthulaClient): {
620
- signIn: (data: SignInWithOAuth2Request) => Promise<SignInWithOAuth2Response>;
621
- };
622
- }
623
- //#endregion
624
- //#region src/plugins/organizations/types.d.ts
625
- type Organization = {
626
- id: string;
627
- ownerId: string;
628
- name: string;
629
- slug: string;
630
- logo: string | null;
631
- metadata: Record<string, unknown> | null;
632
- createdAt: string;
633
- updatedAt: string;
634
- };
635
- type OrganizationInvitationStatus = "pending" | "accepted" | "rejected" | "revoked" | "expired";
636
- type OrganizationInvitation = {
637
- id: string;
638
- email: string;
639
- inviterId: string;
640
- organizationId: string;
641
- role: string;
642
- status: OrganizationInvitationStatus;
643
- expiresAt: string;
644
- createdAt: string;
645
- updatedAt: string;
646
- };
647
- type OrganizationMember = {
648
- id: string;
649
- organizationId: string;
650
- userId: string;
651
- role: string;
652
- createdAt: string;
653
- updatedAt: string;
654
- };
655
- type OrganizationTeam = {
656
- id: string;
657
- organizationId: string;
658
- name: string;
659
- slug: string;
660
- description: string | null;
661
- metadata: Record<string, unknown> | null;
662
- createdAt: string;
663
- updatedAt: string;
664
- };
665
- type OrganizationTeamMember = {
666
- id: string;
667
- teamId: string;
668
- memberId: string;
669
- createdAt: string;
670
- };
671
- type CreateOrganizationRequest = {
672
- name: string;
673
- role: string;
674
- slug?: string | null;
675
- logo?: string | null;
676
- metadata?: Record<string, unknown> | null;
677
- };
678
- type CreateOrganizationResponse = Organization;
679
- type GetAllOrganizationsResponse = Array<Organization>;
680
- type GetOrganizationByIdResponse = Organization;
681
- type UpdateOrganizationRequest = {
682
- name: string;
683
- slug?: string | null;
684
- logo?: string | null;
685
- metadata?: Record<string, unknown> | null;
686
- };
687
- type UpdateOrganizationResponse = Organization;
688
- type DeleteOrganizationResponse = {
689
- message: string;
690
- };
691
- type AddOrganizationMemberRequest = {
692
- userId: string;
693
- role: string;
694
- };
695
- type AddOrganizationMemberResponse = OrganizationMember;
696
- type GetOrganizationMembersResponse = Array<OrganizationMember>;
697
- type GetOrganizationMemberResponse = OrganizationMember;
698
- type UpdateOrganizationMemberRequest = {
699
- role: string;
700
- };
701
- type UpdateOrganizationMemberResponse = OrganizationMember;
702
- type DeleteOrganizationMemberResponse = {
703
- message: string;
704
- };
705
- type CreateOrganizationTeamRequest = {
706
- name: string;
707
- slug?: string | null;
708
- description?: string | null;
709
- metadata?: Record<string, unknown> | null;
710
- };
711
- type CreateOrganizationTeamResponse = OrganizationTeam;
712
- type GetAllOrganizationTeamsResponse = Array<OrganizationTeam>;
713
- type GetOrganizationTeamResponse = OrganizationTeam;
714
- type UpdateOrganizationTeamRequest = {
715
- name: string;
716
- slug?: string | null;
717
- description?: string | null;
718
- metadata?: Record<string, unknown> | null;
719
- };
720
- type UpdateOrganizationTeamResponse = OrganizationTeam;
721
- type DeleteOrganizationTeamResponse = {
722
- message: string;
723
- };
724
- type AddOrganizationTeamMemberRequest = {
725
- memberId: string;
726
- };
727
- type AddOrganizationTeamMemberResponse = OrganizationTeamMember;
728
- type GetAllOrganizationTeamMembersResponse = Array<OrganizationTeamMember>;
729
- type GetOrganizationTeamMemberResponse = OrganizationTeamMember;
730
- type DeleteOrganizationTeamMemberResponse = {
731
- message: string;
732
- };
733
- type CreateOrganizationInvitationRequest = {
734
- email: string;
735
- role: string;
736
- redirectUrl?: string;
737
- };
738
- type CreateOrganizationInvitationResponse = OrganizationInvitation;
739
- type GetAllOrganizationInvitationsResponse = Array<OrganizationInvitation>;
740
- type GetOrganizationInvitationResponse = OrganizationInvitation;
741
- type RevokeOrganizationInvitationResponse = OrganizationInvitation;
742
- type AcceptOrganizationInvitationRequest = {
743
- redirectUrl?: string;
744
- };
745
- type AcceptOrganizationInvitationResponse = OrganizationInvitation;
746
- type RejectOrganizationInvitationResponse = OrganizationInvitation;
747
- //#endregion
748
- //#region src/plugins/organizations/plugin.d.ts
749
- declare class OrganizationsPlugin implements Plugin {
750
- readonly id = "organizations";
751
- init(client: AuthulaClient): {
752
- createOrganization: (data: CreateOrganizationRequest) => Promise<CreateOrganizationResponse>;
753
- getAllOrganizations: () => Promise<GetAllOrganizationsResponse>;
754
- getOrganizationById: (organizationId: string) => Promise<GetOrganizationByIdResponse>;
755
- updateOrganization: (organizationId: string, data: UpdateOrganizationRequest) => Promise<UpdateOrganizationResponse>;
756
- deleteOrganization: (organizationId: string) => Promise<DeleteOrganizationResponse>;
757
- createOrganizationInvitation: (organizationId: string, data: CreateOrganizationInvitationRequest) => Promise<CreateOrganizationInvitationResponse>;
758
- getAllOrganizationInvitations: (organizationId: string) => Promise<GetAllOrganizationInvitationsResponse>;
759
- getOrganizationInvitation: (organizationId: string, invitationId: string) => Promise<GetOrganizationInvitationResponse>;
760
- revokeOrganizationInvitation: (organizationId: string, invitationId: string) => Promise<RevokeOrganizationInvitationResponse>;
761
- acceptOrganizationInvitation: (organizationId: string, invitationId: string, data?: AcceptOrganizationInvitationRequest) => Promise<AcceptOrganizationInvitationResponse>;
762
- rejectOrganizationInvitation: (organizationId: string, invitationId: string) => Promise<RejectOrganizationInvitationResponse>;
763
- addOrganizationMember: (organizationId: string, data: AddOrganizationMemberRequest) => Promise<AddOrganizationMemberResponse>;
764
- getAllOrganizationMembers: (organizationId: string) => Promise<GetOrganizationMembersResponse>;
765
- getOrganizationMember: (organizationId: string, memberId: string) => Promise<GetOrganizationMemberResponse>;
766
- updateOrganizationMember: (organizationId: string, memberId: string, data: UpdateOrganizationMemberRequest) => Promise<UpdateOrganizationMemberResponse>;
767
- deleteOrganizationMember: (organizationId: string, memberId: string) => Promise<DeleteOrganizationMemberResponse>;
768
- createOrganizationTeam: (organizationId: string, data: CreateOrganizationTeamRequest) => Promise<CreateOrganizationTeamResponse>;
769
- getAllOrganizationTeams: (organizationId: string) => Promise<GetAllOrganizationTeamsResponse>;
770
- getOrganizationTeam: (organizationId: string, teamId: string) => Promise<GetOrganizationTeamResponse>;
771
- updateOrganizationTeam: (organizationId: string, teamId: string, data: UpdateOrganizationTeamRequest) => Promise<UpdateOrganizationTeamResponse>;
772
- deleteOrganizationTeam: (organizationId: string, teamId: string) => Promise<DeleteOrganizationTeamResponse>;
773
- addOrganizationTeamMember: (organizationId: string, teamId: string, data: AddOrganizationTeamMemberRequest) => Promise<AddOrganizationTeamMemberResponse>;
774
- getAllOrganizationTeamMembers: (organizationId: string, teamId: string) => Promise<GetAllOrganizationTeamMembersResponse>;
775
- getOrganizationTeamMember: (organizationId: string, teamId: string, memberId: string) => Promise<GetOrganizationTeamMemberResponse>;
776
- deleteOrganizationTeamMember: (organizationId: string, teamId: string, memberId: string) => Promise<DeleteOrganizationTeamMemberResponse>;
777
- };
778
- }
779
- //#endregion
780
- //#region src/plugins/totp/types.d.ts
781
- type EnableResponse = {
782
- totpUri: string;
783
- backupCodes: string[];
784
- };
785
- type DisableResponse = {
786
- message: string;
787
- };
788
- type GetTOTPURIResponse = {
789
- totpUri: string;
790
- };
791
- type VerifyTOTPRequest = {
792
- code: string;
793
- trustDevice?: boolean;
794
- };
795
- type VerifyTOTPResponse = {
796
- user: User;
797
- session: Session;
798
- };
799
- type VerifyBackupCodeRequest = {
800
- code: string;
801
- trustDevice?: boolean;
802
- };
803
- type VerifyBackupCodeResponse = {
804
- user: User;
805
- session: Session;
806
- };
807
- type GenerateBackupCodesResponse = {
808
- backupCodes: string[];
809
- };
810
- //#endregion
811
- //#region src/plugins/totp/plugin.d.ts
812
- declare class TOTPPlugin implements Plugin {
813
- readonly id = "totp";
814
- init(client: AuthulaClient): {
815
- enable: () => Promise<EnableResponse>;
816
- disable: () => Promise<DisableResponse>;
817
- getUri: () => Promise<GetTOTPURIResponse>;
818
- verify: (data: VerifyTOTPRequest) => Promise<VerifyTOTPResponse>;
819
- verifyBackupCode: (data: VerifyBackupCodeRequest) => Promise<VerifyBackupCodeResponse>;
820
- generateBackupCodes: () => Promise<GenerateBackupCodesResponse>;
821
- };
822
- }
823
- //#endregion
824
- export { AcceptOrganizationInvitationRequest, AcceptOrganizationInvitationResponse, AccessControlPlugin, AddOrganizationMemberRequest, AddOrganizationMemberResponse, AddOrganizationTeamMemberRequest, AddOrganizationTeamMemberResponse, AddRolePermissionRequest, AddRolePermissionResponse, AdminPlugin, AdminSessionState, AdminUserSession, AdminUserState, AssignUserRoleRequest, AssignUserRoleResponse, BanUserRequest, BanUserResponse, BearerPlugin, BearerPluginOptions, CSRFPlugin, CSRFPluginOptions, ChangePasswordRequest, CheckUserPermissionsRequest, CheckUserPermissionsResponse, CreateAccountRequest, CreateAccountResponse, CreateOrganizationInvitationRequest, CreateOrganizationInvitationResponse, CreateOrganizationRequest, CreateOrganizationResponse, CreateOrganizationTeamRequest, CreateOrganizationTeamResponse, CreatePermissionRequest, CreatePermissionResponse, CreateRoleRequest, CreateRoleResponse, CreateSessionStateRequest, CreateSessionStateResponse, CreateUserRequest, CreateUserResponse, CreateUserStateRequest, CreateUserStateResponse, DeleteAccountResponse, DeleteOrganizationMemberResponse, DeleteOrganizationResponse, DeleteOrganizationTeamMemberResponse, DeleteOrganizationTeamResponse, DeletePermissionResponse, DeleteRoleResponse, DeleteSessionStateResponse, DeleteUserResponse, DeleteUserStateResponse, DisableResponse, EmailPasswordPlugin, EnableResponse, GenerateBackupCodesResponse, GetAccountByIdResponse, GetAllImpersonationsResponse, GetAllOrganizationInvitationsResponse, GetAllOrganizationTeamMembersResponse, GetAllOrganizationTeamsResponse, GetAllOrganizationsResponse, GetAllUsersResponse, GetBannedUserStatesResponse, GetImpersonationByIdResponse, GetOrganizationByIdResponse, GetOrganizationInvitationResponse, GetOrganizationMemberResponse, GetOrganizationMembersResponse, GetOrganizationTeamMemberResponse, GetOrganizationTeamResponse, GetRevokedSessionStatesResponse, GetSessionStateResponse, GetTOTPURIResponse, GetUserAccountsResponse, GetUserAdminSessionsResponse, GetUserByIdResponse, GetUserPermissionsResponse, GetUserStateResponse, Impersonation, JWKSKey, JWTAlgorithm, JWTPlugin, JWTTokensResponse, MagicLinkExchangeRequest, MagicLinkPlugin, MagicLinkSignInRequest, MagicLinkSignInResponse, MagicLinkVerifyRequest, MagicLinkVerifyResponse, OAuth2Plugin, OAuth2ProviderType, Organization, OrganizationInvitation, OrganizationInvitationStatus, OrganizationMember, OrganizationTeam, OrganizationTeamMember, OrganizationsPlugin, Permission, PermissionGrantSource, RejectOrganizationInvitationResponse, RemoveRolePermissionResponse, RemoveUserRoleResponse, ReplaceRolePermissionResponse, ReplaceRolePermissionsRequest, ReplaceUserRolesRequest, ReplaceUserRolesResponse, RequestEmailChangeRequest, RequestPasswordResetRequest, RevokeOrganizationInvitationResponse, RevokeSessionRequest, RevokeSessionResponse, Role, RoleDetails, SendEmailVerificationRequest, SignInRequest, SignInWithOAuth2Request, SignInWithOAuth2Response, SignUpRequest, StartImpersonationRequest, StartImpersonationResponse, StopImpersonationResponse, TOTPPlugin, TokenRefreshRequest, TokenRefreshResponse, UnbanUserResponse, UpdateAccountRequest, UpdateAccountResponse, UpdateOrganizationMemberRequest, UpdateOrganizationMemberResponse, UpdateOrganizationRequest, UpdateOrganizationResponse, UpdateOrganizationTeamRequest, UpdateOrganizationTeamResponse, UpdatePermissionRequest, UpdatePermissionResponse, UpdateRoleRequest, UpdateRoleResponse, UpdateSessionStateRequest, UpdateSessionStateResponse, UpdateUserRequest, UpdateUserResponse, UpdateUserStateRequest, UpdateUserStateResponse, UserAuthorizationProfile, UserPermissionInfo, UserRoleInfo, UserWithPermissions, UserWithRoles, VerifyBackupCodeRequest, VerifyBackupCodeResponse, VerifyEmailRequest, VerifyTOTPRequest, VerifyTOTPResponse, adminSessionStateSchema, adminUserSessionSchema, adminUserStateSchema, checkUserPermissionsResponseSchema, getUserPermissionsResponseSchema, impersonationSchema, permissionGrantSourceSchema, permissionSchema, roleDetailsSchema, roleSchema, userPermissionInfoSchema, userRoleInfoSchema };
825
- //# sourceMappingURL=index.d.cts.map