authula 0.2.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -14
- package/dist/plugins/index.cjs +192 -0
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.cts +251 -2
- package/dist/plugins/index.d.ts +251 -2
- package/dist/plugins/index.js +183 -1
- package/dist/plugins/index.js.map +1 -1
- package/package.json +12 -13
package/dist/plugins/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as User, l as Plugin, p as Account, t as ClientWithPlugins, u as AuthulaClient } from "../sdk-DV73pbRH.cjs";
|
|
1
|
+
import { h as User, l as Plugin, m as Session, p as Account, t as ClientWithPlugins, u as AuthulaClient } from "../sdk-DV73pbRH.cjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/admin/types.d.ts
|
|
@@ -250,6 +250,211 @@ declare class AdminPlugin implements Plugin {
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
|
+
//#region src/plugins/access-control/types.d.ts
|
|
254
|
+
declare const roleSchema: z.ZodObject<{
|
|
255
|
+
id: z.ZodString;
|
|
256
|
+
name: z.ZodString;
|
|
257
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
258
|
+
isSystem: z.ZodBoolean;
|
|
259
|
+
createdAt: z.ZodISODateTime;
|
|
260
|
+
updatedAt: z.ZodISODateTime;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
type Role = z.infer<typeof roleSchema>;
|
|
263
|
+
declare const permissionSchema: z.ZodObject<{
|
|
264
|
+
id: z.ZodString;
|
|
265
|
+
key: z.ZodString;
|
|
266
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
267
|
+
isSystem: z.ZodBoolean;
|
|
268
|
+
createdAt: z.ZodISODateTime;
|
|
269
|
+
updatedAt: z.ZodISODateTime;
|
|
270
|
+
}, z.core.$strip>;
|
|
271
|
+
type Permission = z.infer<typeof permissionSchema>;
|
|
272
|
+
declare const permissionGrantSourceSchema: z.ZodObject<{
|
|
273
|
+
roleId: z.ZodString;
|
|
274
|
+
roleName: z.ZodString;
|
|
275
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
276
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
277
|
+
}, z.core.$strip>;
|
|
278
|
+
type PermissionGrantSource = z.infer<typeof permissionGrantSourceSchema>;
|
|
279
|
+
declare const userPermissionInfoSchema: z.ZodObject<{
|
|
280
|
+
permissionId: z.ZodString;
|
|
281
|
+
permissionKey: z.ZodString;
|
|
282
|
+
permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
283
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
284
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
285
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
286
|
+
roleId: z.ZodString;
|
|
287
|
+
roleName: z.ZodString;
|
|
288
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
289
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
290
|
+
}, z.core.$strip>>>;
|
|
291
|
+
}, z.core.$strip>;
|
|
292
|
+
type UserPermissionInfo = z.infer<typeof userPermissionInfoSchema>;
|
|
293
|
+
declare const userRoleInfoSchema: z.ZodObject<{
|
|
294
|
+
roleId: z.ZodString;
|
|
295
|
+
roleName: z.ZodString;
|
|
296
|
+
roleDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
297
|
+
assignedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
298
|
+
assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
299
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
300
|
+
}, z.core.$strip>;
|
|
301
|
+
type UserRoleInfo = z.infer<typeof userRoleInfoSchema>;
|
|
302
|
+
declare const roleDetailsSchema: z.ZodObject<{
|
|
303
|
+
role: z.ZodObject<{
|
|
304
|
+
id: z.ZodString;
|
|
305
|
+
name: z.ZodString;
|
|
306
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
307
|
+
isSystem: z.ZodBoolean;
|
|
308
|
+
createdAt: z.ZodISODateTime;
|
|
309
|
+
updatedAt: z.ZodISODateTime;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
312
|
+
permissionId: z.ZodString;
|
|
313
|
+
permissionKey: z.ZodString;
|
|
314
|
+
permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
315
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
316
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
317
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
318
|
+
roleId: z.ZodString;
|
|
319
|
+
roleName: z.ZodString;
|
|
320
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
321
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
322
|
+
}, z.core.$strip>>>;
|
|
323
|
+
}, z.core.$strip>>;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
type RoleDetails = z.infer<typeof roleDetailsSchema>;
|
|
326
|
+
declare const getUserPermissionsResponseSchema: z.ZodObject<{
|
|
327
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
328
|
+
permissionId: z.ZodString;
|
|
329
|
+
permissionKey: z.ZodString;
|
|
330
|
+
permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
331
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
332
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
333
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
334
|
+
roleId: z.ZodString;
|
|
335
|
+
roleName: z.ZodString;
|
|
336
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
337
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
338
|
+
}, z.core.$strip>>>;
|
|
339
|
+
}, z.core.$strip>>;
|
|
340
|
+
}, z.core.$strip>;
|
|
341
|
+
type GetUserPermissionsResponse = z.infer<typeof getUserPermissionsResponseSchema>;
|
|
342
|
+
declare const checkUserPermissionsResponseSchema: z.ZodObject<{
|
|
343
|
+
hasPermissions: z.ZodBoolean;
|
|
344
|
+
}, z.core.$strip>;
|
|
345
|
+
type CheckUserPermissionsResponse = z.infer<typeof checkUserPermissionsResponseSchema>;
|
|
346
|
+
type CreateRoleRequest = {
|
|
347
|
+
name: string;
|
|
348
|
+
description?: string | null;
|
|
349
|
+
isSystem: boolean;
|
|
350
|
+
};
|
|
351
|
+
type CreateRoleResponse = {
|
|
352
|
+
role: Role;
|
|
353
|
+
};
|
|
354
|
+
type UpdateRoleRequest = {
|
|
355
|
+
name?: string | null;
|
|
356
|
+
description?: string | null;
|
|
357
|
+
};
|
|
358
|
+
type UpdateRoleResponse = {
|
|
359
|
+
role: Role;
|
|
360
|
+
};
|
|
361
|
+
type DeleteRoleResponse = {
|
|
362
|
+
message: string;
|
|
363
|
+
};
|
|
364
|
+
type CreatePermissionRequest = {
|
|
365
|
+
key: string;
|
|
366
|
+
description?: string | null;
|
|
367
|
+
isSystem: boolean;
|
|
368
|
+
};
|
|
369
|
+
type CreatePermissionResponse = {
|
|
370
|
+
permission: Permission;
|
|
371
|
+
};
|
|
372
|
+
type UpdatePermissionRequest = {
|
|
373
|
+
description?: string | null;
|
|
374
|
+
};
|
|
375
|
+
type UpdatePermissionResponse = {
|
|
376
|
+
permission: Permission;
|
|
377
|
+
};
|
|
378
|
+
type DeletePermissionResponse = {
|
|
379
|
+
message: string;
|
|
380
|
+
};
|
|
381
|
+
type AddRolePermissionRequest = {
|
|
382
|
+
permissionId: string;
|
|
383
|
+
};
|
|
384
|
+
type AddRolePermissionResponse = {
|
|
385
|
+
message: string;
|
|
386
|
+
};
|
|
387
|
+
type ReplaceRolePermissionsRequest = {
|
|
388
|
+
permissionIds: string[];
|
|
389
|
+
};
|
|
390
|
+
type ReplaceRolePermissionResponse = {
|
|
391
|
+
message: string;
|
|
392
|
+
};
|
|
393
|
+
type RemoveRolePermissionResponse = {
|
|
394
|
+
message: string;
|
|
395
|
+
};
|
|
396
|
+
type AssignUserRoleRequest = {
|
|
397
|
+
roleId: string;
|
|
398
|
+
expiresAt?: string | null;
|
|
399
|
+
};
|
|
400
|
+
type ReplaceUserRolesRequest = {
|
|
401
|
+
roleIds: string[];
|
|
402
|
+
};
|
|
403
|
+
type ReplaceUserRolesResponse = {
|
|
404
|
+
message: string;
|
|
405
|
+
};
|
|
406
|
+
type AssignUserRoleResponse = {
|
|
407
|
+
message: string;
|
|
408
|
+
};
|
|
409
|
+
type RemoveUserRoleResponse = {
|
|
410
|
+
message: string;
|
|
411
|
+
};
|
|
412
|
+
type CheckUserPermissionsRequest = {
|
|
413
|
+
permissionKeys: string[];
|
|
414
|
+
};
|
|
415
|
+
type UserWithPermissions = {
|
|
416
|
+
user: User;
|
|
417
|
+
permissions: UserPermissionInfo[];
|
|
418
|
+
};
|
|
419
|
+
type UserAuthorizationProfile = {
|
|
420
|
+
user: User;
|
|
421
|
+
roles: UserRoleInfo[];
|
|
422
|
+
permissions: UserPermissionInfo[];
|
|
423
|
+
};
|
|
424
|
+
type UserWithRoles = {
|
|
425
|
+
user: User;
|
|
426
|
+
roles: UserRoleInfo[];
|
|
427
|
+
};
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/plugins/access-control/plugin.d.ts
|
|
430
|
+
declare class AccessControlPlugin implements Plugin {
|
|
431
|
+
readonly id = "accessControl";
|
|
432
|
+
constructor();
|
|
433
|
+
init(client: AuthulaClient): {
|
|
434
|
+
createRole: (data: CreateRoleRequest) => Promise<CreateRoleResponse>;
|
|
435
|
+
getAllRoles: () => Promise<Role[]>;
|
|
436
|
+
getRoleByName: (roleName: string) => Promise<Role>;
|
|
437
|
+
getRoleById: (roleId: string) => Promise<RoleDetails>;
|
|
438
|
+
updateRole: (roleId: string, data: UpdateRoleRequest) => Promise<UpdateRoleResponse>;
|
|
439
|
+
deleteRole: (roleId: string) => Promise<DeleteRoleResponse>;
|
|
440
|
+
createPermission: (data: CreatePermissionRequest) => Promise<CreatePermissionResponse>;
|
|
441
|
+
getAllPermissions: () => Promise<Permission[]>;
|
|
442
|
+
getPermissionById: (permissionId: string) => Promise<Permission>;
|
|
443
|
+
updatePermission: (permissionId: string, data: UpdatePermissionRequest) => Promise<UpdatePermissionResponse>;
|
|
444
|
+
deletePermission: (permissionId: string) => Promise<DeletePermissionResponse>;
|
|
445
|
+
addRolePermission: (roleId: string, data: AddRolePermissionRequest) => Promise<AddRolePermissionResponse>;
|
|
446
|
+
getRolePermissions: (roleId: string) => Promise<UserPermissionInfo[]>;
|
|
447
|
+
replaceRolePermissions: (roleId: string, data: ReplaceRolePermissionsRequest) => Promise<ReplaceRolePermissionResponse>;
|
|
448
|
+
removeRolePermission: (roleId: string, permissionId: string) => Promise<RemoveRolePermissionResponse>;
|
|
449
|
+
getUserRoles: (userId: string) => Promise<UserRoleInfo[]>;
|
|
450
|
+
assignUserRole: (userId: string, data: AssignUserRoleRequest) => Promise<AssignUserRoleResponse>;
|
|
451
|
+
replaceUserRoles: (userId: string, data: ReplaceUserRolesRequest) => Promise<ReplaceUserRolesResponse>;
|
|
452
|
+
removeUserRole: (userId: string, roleId: string) => Promise<RemoveUserRoleResponse>;
|
|
453
|
+
getUserPermissions: (userId: string) => Promise<GetUserPermissionsResponse>;
|
|
454
|
+
checkUserPermissions: (userId: string, data: CheckUserPermissionsRequest) => Promise<CheckUserPermissionsResponse>;
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
253
458
|
//#region src/plugins/bearer/types.d.ts
|
|
254
459
|
type BearerPluginOptions = {
|
|
255
460
|
headerName?: string;
|
|
@@ -413,5 +618,49 @@ declare class OAuth2Plugin implements Plugin {
|
|
|
413
618
|
};
|
|
414
619
|
}
|
|
415
620
|
//#endregion
|
|
416
|
-
|
|
621
|
+
//#region src/plugins/totp/types.d.ts
|
|
622
|
+
type EnableResponse = {
|
|
623
|
+
totpUri: string;
|
|
624
|
+
backupCodes: string[];
|
|
625
|
+
};
|
|
626
|
+
type DisableResponse = {
|
|
627
|
+
message: string;
|
|
628
|
+
};
|
|
629
|
+
type GetTOTPURIResponse = {
|
|
630
|
+
totpUri: string;
|
|
631
|
+
};
|
|
632
|
+
type VerifyTOTPRequest = {
|
|
633
|
+
code: string;
|
|
634
|
+
trustDevice?: boolean;
|
|
635
|
+
};
|
|
636
|
+
type VerifyTOTPResponse = {
|
|
637
|
+
user: User;
|
|
638
|
+
session: Session;
|
|
639
|
+
};
|
|
640
|
+
type VerifyBackupCodeRequest = {
|
|
641
|
+
code: string;
|
|
642
|
+
trustDevice?: boolean;
|
|
643
|
+
};
|
|
644
|
+
type VerifyBackupCodeResponse = {
|
|
645
|
+
user: User;
|
|
646
|
+
session: Session;
|
|
647
|
+
};
|
|
648
|
+
type GenerateBackupCodesResponse = {
|
|
649
|
+
backupCodes: string[];
|
|
650
|
+
};
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region src/plugins/totp/plugin.d.ts
|
|
653
|
+
declare class TOTPPlugin implements Plugin {
|
|
654
|
+
readonly id = "totp";
|
|
655
|
+
init(client: AuthulaClient): {
|
|
656
|
+
enable: () => Promise<EnableResponse>;
|
|
657
|
+
disable: () => Promise<DisableResponse>;
|
|
658
|
+
getUri: () => Promise<GetTOTPURIResponse>;
|
|
659
|
+
verify: (data: VerifyTOTPRequest) => Promise<VerifyTOTPResponse>;
|
|
660
|
+
verifyBackupCode: (data: VerifyBackupCodeRequest) => Promise<VerifyBackupCodeResponse>;
|
|
661
|
+
generateBackupCodes: () => Promise<GenerateBackupCodesResponse>;
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
//#endregion
|
|
665
|
+
export { AccessControlPlugin, AddRolePermissionRequest, AddRolePermissionResponse, AdminPlugin, AdminSessionState, AdminUserSession, AdminUserState, AssignUserRoleRequest, AssignUserRoleResponse, BanUserRequest, BanUserResponse, BearerPlugin, BearerPluginOptions, CSRFPlugin, CSRFPluginOptions, ChangePasswordRequest, CheckUserPermissionsRequest, CheckUserPermissionsResponse, CreateAccountRequest, CreateAccountResponse, CreatePermissionRequest, CreatePermissionResponse, CreateRoleRequest, CreateRoleResponse, CreateSessionStateRequest, CreateSessionStateResponse, CreateUserRequest, CreateUserResponse, CreateUserStateRequest, CreateUserStateResponse, DeleteAccountResponse, DeletePermissionResponse, DeleteRoleResponse, DeleteSessionStateResponse, DeleteUserResponse, DeleteUserStateResponse, DisableResponse, EmailPasswordPlugin, EnableResponse, GenerateBackupCodesResponse, GetAccountByIdResponse, GetAllImpersonationsResponse, GetAllUsersResponse, GetBannedUserStatesResponse, GetImpersonationByIdResponse, GetRevokedSessionStatesResponse, GetSessionStateResponse, GetTOTPURIResponse, GetUserAccountsResponse, GetUserAdminSessionsResponse, GetUserByIdResponse, GetUserPermissionsResponse, GetUserStateResponse, Impersonation, JWKSKey, JWTAlgorithm, JWTPlugin, JWTTokensResponse, MagicLinkExchangeRequest, MagicLinkPlugin, MagicLinkSignInRequest, MagicLinkSignInResponse, MagicLinkVerifyRequest, MagicLinkVerifyResponse, OAuth2Plugin, OAuth2ProviderType, Permission, PermissionGrantSource, RemoveRolePermissionResponse, RemoveUserRoleResponse, ReplaceRolePermissionResponse, ReplaceRolePermissionsRequest, ReplaceUserRolesRequest, ReplaceUserRolesResponse, RequestEmailChangeRequest, RequestPasswordResetRequest, RevokeSessionRequest, RevokeSessionResponse, Role, RoleDetails, SendEmailVerificationRequest, SignInRequest, SignInWithOAuth2Request, SignInWithOAuth2Response, SignUpRequest, StartImpersonationRequest, StartImpersonationResponse, StopImpersonationResponse, TOTPPlugin, TokenRefreshRequest, TokenRefreshResponse, UnbanUserResponse, UpdateAccountRequest, UpdateAccountResponse, 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 };
|
|
417
666
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as User, l as Plugin, p as Account, t as ClientWithPlugins, u as AuthulaClient } from "../sdk-BWoai6MP.js";
|
|
1
|
+
import { h as User, l as Plugin, m as Session, p as Account, t as ClientWithPlugins, u as AuthulaClient } from "../sdk-BWoai6MP.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/admin/types.d.ts
|
|
@@ -250,6 +250,211 @@ declare class AdminPlugin implements Plugin {
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
|
+
//#region src/plugins/access-control/types.d.ts
|
|
254
|
+
declare const roleSchema: z.ZodObject<{
|
|
255
|
+
id: z.ZodString;
|
|
256
|
+
name: z.ZodString;
|
|
257
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
258
|
+
isSystem: z.ZodBoolean;
|
|
259
|
+
createdAt: z.ZodISODateTime;
|
|
260
|
+
updatedAt: z.ZodISODateTime;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
type Role = z.infer<typeof roleSchema>;
|
|
263
|
+
declare const permissionSchema: z.ZodObject<{
|
|
264
|
+
id: z.ZodString;
|
|
265
|
+
key: z.ZodString;
|
|
266
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
267
|
+
isSystem: z.ZodBoolean;
|
|
268
|
+
createdAt: z.ZodISODateTime;
|
|
269
|
+
updatedAt: z.ZodISODateTime;
|
|
270
|
+
}, z.core.$strip>;
|
|
271
|
+
type Permission = z.infer<typeof permissionSchema>;
|
|
272
|
+
declare const permissionGrantSourceSchema: z.ZodObject<{
|
|
273
|
+
roleId: z.ZodString;
|
|
274
|
+
roleName: z.ZodString;
|
|
275
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
276
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
277
|
+
}, z.core.$strip>;
|
|
278
|
+
type PermissionGrantSource = z.infer<typeof permissionGrantSourceSchema>;
|
|
279
|
+
declare const userPermissionInfoSchema: z.ZodObject<{
|
|
280
|
+
permissionId: z.ZodString;
|
|
281
|
+
permissionKey: z.ZodString;
|
|
282
|
+
permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
283
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
284
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
285
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
286
|
+
roleId: z.ZodString;
|
|
287
|
+
roleName: z.ZodString;
|
|
288
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
289
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
290
|
+
}, z.core.$strip>>>;
|
|
291
|
+
}, z.core.$strip>;
|
|
292
|
+
type UserPermissionInfo = z.infer<typeof userPermissionInfoSchema>;
|
|
293
|
+
declare const userRoleInfoSchema: z.ZodObject<{
|
|
294
|
+
roleId: z.ZodString;
|
|
295
|
+
roleName: z.ZodString;
|
|
296
|
+
roleDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
297
|
+
assignedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
298
|
+
assignedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
299
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
300
|
+
}, z.core.$strip>;
|
|
301
|
+
type UserRoleInfo = z.infer<typeof userRoleInfoSchema>;
|
|
302
|
+
declare const roleDetailsSchema: z.ZodObject<{
|
|
303
|
+
role: z.ZodObject<{
|
|
304
|
+
id: z.ZodString;
|
|
305
|
+
name: z.ZodString;
|
|
306
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
307
|
+
isSystem: z.ZodBoolean;
|
|
308
|
+
createdAt: z.ZodISODateTime;
|
|
309
|
+
updatedAt: z.ZodISODateTime;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
312
|
+
permissionId: z.ZodString;
|
|
313
|
+
permissionKey: z.ZodString;
|
|
314
|
+
permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
315
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
316
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
317
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
318
|
+
roleId: z.ZodString;
|
|
319
|
+
roleName: z.ZodString;
|
|
320
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
321
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
322
|
+
}, z.core.$strip>>>;
|
|
323
|
+
}, z.core.$strip>>;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
type RoleDetails = z.infer<typeof roleDetailsSchema>;
|
|
326
|
+
declare const getUserPermissionsResponseSchema: z.ZodObject<{
|
|
327
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
328
|
+
permissionId: z.ZodString;
|
|
329
|
+
permissionKey: z.ZodString;
|
|
330
|
+
permissionDescription: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
331
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
332
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
333
|
+
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
334
|
+
roleId: z.ZodString;
|
|
335
|
+
roleName: z.ZodString;
|
|
336
|
+
grantedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
337
|
+
grantedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
338
|
+
}, z.core.$strip>>>;
|
|
339
|
+
}, z.core.$strip>>;
|
|
340
|
+
}, z.core.$strip>;
|
|
341
|
+
type GetUserPermissionsResponse = z.infer<typeof getUserPermissionsResponseSchema>;
|
|
342
|
+
declare const checkUserPermissionsResponseSchema: z.ZodObject<{
|
|
343
|
+
hasPermissions: z.ZodBoolean;
|
|
344
|
+
}, z.core.$strip>;
|
|
345
|
+
type CheckUserPermissionsResponse = z.infer<typeof checkUserPermissionsResponseSchema>;
|
|
346
|
+
type CreateRoleRequest = {
|
|
347
|
+
name: string;
|
|
348
|
+
description?: string | null;
|
|
349
|
+
isSystem: boolean;
|
|
350
|
+
};
|
|
351
|
+
type CreateRoleResponse = {
|
|
352
|
+
role: Role;
|
|
353
|
+
};
|
|
354
|
+
type UpdateRoleRequest = {
|
|
355
|
+
name?: string | null;
|
|
356
|
+
description?: string | null;
|
|
357
|
+
};
|
|
358
|
+
type UpdateRoleResponse = {
|
|
359
|
+
role: Role;
|
|
360
|
+
};
|
|
361
|
+
type DeleteRoleResponse = {
|
|
362
|
+
message: string;
|
|
363
|
+
};
|
|
364
|
+
type CreatePermissionRequest = {
|
|
365
|
+
key: string;
|
|
366
|
+
description?: string | null;
|
|
367
|
+
isSystem: boolean;
|
|
368
|
+
};
|
|
369
|
+
type CreatePermissionResponse = {
|
|
370
|
+
permission: Permission;
|
|
371
|
+
};
|
|
372
|
+
type UpdatePermissionRequest = {
|
|
373
|
+
description?: string | null;
|
|
374
|
+
};
|
|
375
|
+
type UpdatePermissionResponse = {
|
|
376
|
+
permission: Permission;
|
|
377
|
+
};
|
|
378
|
+
type DeletePermissionResponse = {
|
|
379
|
+
message: string;
|
|
380
|
+
};
|
|
381
|
+
type AddRolePermissionRequest = {
|
|
382
|
+
permissionId: string;
|
|
383
|
+
};
|
|
384
|
+
type AddRolePermissionResponse = {
|
|
385
|
+
message: string;
|
|
386
|
+
};
|
|
387
|
+
type ReplaceRolePermissionsRequest = {
|
|
388
|
+
permissionIds: string[];
|
|
389
|
+
};
|
|
390
|
+
type ReplaceRolePermissionResponse = {
|
|
391
|
+
message: string;
|
|
392
|
+
};
|
|
393
|
+
type RemoveRolePermissionResponse = {
|
|
394
|
+
message: string;
|
|
395
|
+
};
|
|
396
|
+
type AssignUserRoleRequest = {
|
|
397
|
+
roleId: string;
|
|
398
|
+
expiresAt?: string | null;
|
|
399
|
+
};
|
|
400
|
+
type ReplaceUserRolesRequest = {
|
|
401
|
+
roleIds: string[];
|
|
402
|
+
};
|
|
403
|
+
type ReplaceUserRolesResponse = {
|
|
404
|
+
message: string;
|
|
405
|
+
};
|
|
406
|
+
type AssignUserRoleResponse = {
|
|
407
|
+
message: string;
|
|
408
|
+
};
|
|
409
|
+
type RemoveUserRoleResponse = {
|
|
410
|
+
message: string;
|
|
411
|
+
};
|
|
412
|
+
type CheckUserPermissionsRequest = {
|
|
413
|
+
permissionKeys: string[];
|
|
414
|
+
};
|
|
415
|
+
type UserWithPermissions = {
|
|
416
|
+
user: User;
|
|
417
|
+
permissions: UserPermissionInfo[];
|
|
418
|
+
};
|
|
419
|
+
type UserAuthorizationProfile = {
|
|
420
|
+
user: User;
|
|
421
|
+
roles: UserRoleInfo[];
|
|
422
|
+
permissions: UserPermissionInfo[];
|
|
423
|
+
};
|
|
424
|
+
type UserWithRoles = {
|
|
425
|
+
user: User;
|
|
426
|
+
roles: UserRoleInfo[];
|
|
427
|
+
};
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/plugins/access-control/plugin.d.ts
|
|
430
|
+
declare class AccessControlPlugin implements Plugin {
|
|
431
|
+
readonly id = "accessControl";
|
|
432
|
+
constructor();
|
|
433
|
+
init(client: AuthulaClient): {
|
|
434
|
+
createRole: (data: CreateRoleRequest) => Promise<CreateRoleResponse>;
|
|
435
|
+
getAllRoles: () => Promise<Role[]>;
|
|
436
|
+
getRoleByName: (roleName: string) => Promise<Role>;
|
|
437
|
+
getRoleById: (roleId: string) => Promise<RoleDetails>;
|
|
438
|
+
updateRole: (roleId: string, data: UpdateRoleRequest) => Promise<UpdateRoleResponse>;
|
|
439
|
+
deleteRole: (roleId: string) => Promise<DeleteRoleResponse>;
|
|
440
|
+
createPermission: (data: CreatePermissionRequest) => Promise<CreatePermissionResponse>;
|
|
441
|
+
getAllPermissions: () => Promise<Permission[]>;
|
|
442
|
+
getPermissionById: (permissionId: string) => Promise<Permission>;
|
|
443
|
+
updatePermission: (permissionId: string, data: UpdatePermissionRequest) => Promise<UpdatePermissionResponse>;
|
|
444
|
+
deletePermission: (permissionId: string) => Promise<DeletePermissionResponse>;
|
|
445
|
+
addRolePermission: (roleId: string, data: AddRolePermissionRequest) => Promise<AddRolePermissionResponse>;
|
|
446
|
+
getRolePermissions: (roleId: string) => Promise<UserPermissionInfo[]>;
|
|
447
|
+
replaceRolePermissions: (roleId: string, data: ReplaceRolePermissionsRequest) => Promise<ReplaceRolePermissionResponse>;
|
|
448
|
+
removeRolePermission: (roleId: string, permissionId: string) => Promise<RemoveRolePermissionResponse>;
|
|
449
|
+
getUserRoles: (userId: string) => Promise<UserRoleInfo[]>;
|
|
450
|
+
assignUserRole: (userId: string, data: AssignUserRoleRequest) => Promise<AssignUserRoleResponse>;
|
|
451
|
+
replaceUserRoles: (userId: string, data: ReplaceUserRolesRequest) => Promise<ReplaceUserRolesResponse>;
|
|
452
|
+
removeUserRole: (userId: string, roleId: string) => Promise<RemoveUserRoleResponse>;
|
|
453
|
+
getUserPermissions: (userId: string) => Promise<GetUserPermissionsResponse>;
|
|
454
|
+
checkUserPermissions: (userId: string, data: CheckUserPermissionsRequest) => Promise<CheckUserPermissionsResponse>;
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
//#endregion
|
|
253
458
|
//#region src/plugins/bearer/types.d.ts
|
|
254
459
|
type BearerPluginOptions = {
|
|
255
460
|
headerName?: string;
|
|
@@ -413,5 +618,49 @@ declare class OAuth2Plugin implements Plugin {
|
|
|
413
618
|
};
|
|
414
619
|
}
|
|
415
620
|
//#endregion
|
|
416
|
-
|
|
621
|
+
//#region src/plugins/totp/types.d.ts
|
|
622
|
+
type EnableResponse = {
|
|
623
|
+
totpUri: string;
|
|
624
|
+
backupCodes: string[];
|
|
625
|
+
};
|
|
626
|
+
type DisableResponse = {
|
|
627
|
+
message: string;
|
|
628
|
+
};
|
|
629
|
+
type GetTOTPURIResponse = {
|
|
630
|
+
totpUri: string;
|
|
631
|
+
};
|
|
632
|
+
type VerifyTOTPRequest = {
|
|
633
|
+
code: string;
|
|
634
|
+
trustDevice?: boolean;
|
|
635
|
+
};
|
|
636
|
+
type VerifyTOTPResponse = {
|
|
637
|
+
user: User;
|
|
638
|
+
session: Session;
|
|
639
|
+
};
|
|
640
|
+
type VerifyBackupCodeRequest = {
|
|
641
|
+
code: string;
|
|
642
|
+
trustDevice?: boolean;
|
|
643
|
+
};
|
|
644
|
+
type VerifyBackupCodeResponse = {
|
|
645
|
+
user: User;
|
|
646
|
+
session: Session;
|
|
647
|
+
};
|
|
648
|
+
type GenerateBackupCodesResponse = {
|
|
649
|
+
backupCodes: string[];
|
|
650
|
+
};
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region src/plugins/totp/plugin.d.ts
|
|
653
|
+
declare class TOTPPlugin implements Plugin {
|
|
654
|
+
readonly id = "totp";
|
|
655
|
+
init(client: AuthulaClient): {
|
|
656
|
+
enable: () => Promise<EnableResponse>;
|
|
657
|
+
disable: () => Promise<DisableResponse>;
|
|
658
|
+
getUri: () => Promise<GetTOTPURIResponse>;
|
|
659
|
+
verify: (data: VerifyTOTPRequest) => Promise<VerifyTOTPResponse>;
|
|
660
|
+
verifyBackupCode: (data: VerifyBackupCodeRequest) => Promise<VerifyBackupCodeResponse>;
|
|
661
|
+
generateBackupCodes: () => Promise<GenerateBackupCodesResponse>;
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
//#endregion
|
|
665
|
+
export { AccessControlPlugin, AddRolePermissionRequest, AddRolePermissionResponse, AdminPlugin, AdminSessionState, AdminUserSession, AdminUserState, AssignUserRoleRequest, AssignUserRoleResponse, BanUserRequest, BanUserResponse, BearerPlugin, BearerPluginOptions, CSRFPlugin, CSRFPluginOptions, ChangePasswordRequest, CheckUserPermissionsRequest, CheckUserPermissionsResponse, CreateAccountRequest, CreateAccountResponse, CreatePermissionRequest, CreatePermissionResponse, CreateRoleRequest, CreateRoleResponse, CreateSessionStateRequest, CreateSessionStateResponse, CreateUserRequest, CreateUserResponse, CreateUserStateRequest, CreateUserStateResponse, DeleteAccountResponse, DeletePermissionResponse, DeleteRoleResponse, DeleteSessionStateResponse, DeleteUserResponse, DeleteUserStateResponse, DisableResponse, EmailPasswordPlugin, EnableResponse, GenerateBackupCodesResponse, GetAccountByIdResponse, GetAllImpersonationsResponse, GetAllUsersResponse, GetBannedUserStatesResponse, GetImpersonationByIdResponse, GetRevokedSessionStatesResponse, GetSessionStateResponse, GetTOTPURIResponse, GetUserAccountsResponse, GetUserAdminSessionsResponse, GetUserByIdResponse, GetUserPermissionsResponse, GetUserStateResponse, Impersonation, JWKSKey, JWTAlgorithm, JWTPlugin, JWTTokensResponse, MagicLinkExchangeRequest, MagicLinkPlugin, MagicLinkSignInRequest, MagicLinkSignInResponse, MagicLinkVerifyRequest, MagicLinkVerifyResponse, OAuth2Plugin, OAuth2ProviderType, Permission, PermissionGrantSource, RemoveRolePermissionResponse, RemoveUserRoleResponse, ReplaceRolePermissionResponse, ReplaceRolePermissionsRequest, ReplaceUserRolesRequest, ReplaceUserRolesResponse, RequestEmailChangeRequest, RequestPasswordResetRequest, RevokeSessionRequest, RevokeSessionResponse, Role, RoleDetails, SendEmailVerificationRequest, SignInRequest, SignInWithOAuth2Request, SignInWithOAuth2Response, SignUpRequest, StartImpersonationRequest, StartImpersonationResponse, StopImpersonationResponse, TOTPPlugin, TokenRefreshRequest, TokenRefreshResponse, UnbanUserResponse, UpdateAccountRequest, UpdateAccountResponse, 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 };
|
|
417
666
|
//# sourceMappingURL=index.d.ts.map
|