@nest-boot/auth 8.0.3-beta.0 → 8.0.3-beta.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 +538 -2
- package/dist/abilities/user.ability.d.ts +3 -0
- package/dist/abilities/user.ability.js +2 -0
- package/dist/abilities/user.ability.js.map +1 -1
- package/dist/abilities/workspace.ability.d.ts +3 -0
- package/dist/abilities/workspace.ability.js +2 -0
- package/dist/abilities/workspace.ability.js.map +1 -1
- package/dist/adapters/mikro-orm/adapter-config.js +1 -0
- package/dist/adapters/mikro-orm/adapter-config.js.map +1 -1
- package/dist/adapters/mikro-orm/create-custom-adapter.d.ts +3 -2
- package/dist/adapters/mikro-orm/create-custom-adapter.js +13 -22
- package/dist/adapters/mikro-orm/create-custom-adapter.js.map +1 -1
- package/dist/adapters/mikro-orm/entity-metadata-resolver.d.ts +2 -2
- package/dist/adapters/mikro-orm/entity-metadata-resolver.js +22 -0
- package/dist/adapters/mikro-orm/entity-metadata-resolver.js.map +1 -1
- package/dist/adapters/mikro-orm/where-compiler.d.ts +24 -24
- package/dist/adapters/mikro-orm-adapter.d.ts +6 -2
- package/dist/adapters/mikro-orm-adapter.js +5 -3
- package/dist/adapters/mikro-orm-adapter.js.map +1 -1
- package/dist/api-key-usage.interceptor.d.ts +5 -2
- package/dist/api-key-usage.interceptor.js +10 -8
- package/dist/api-key-usage.interceptor.js.map +1 -1
- package/dist/auth-handler.middleware.d.ts +3 -0
- package/dist/auth-handler.middleware.js +3 -0
- package/dist/auth-handler.middleware.js.map +1 -1
- package/dist/auth-module-options.interface.d.ts +31 -338
- package/dist/auth.constants.d.ts +4 -0
- package/dist/auth.constants.js +4 -0
- package/dist/auth.constants.js.map +1 -1
- package/dist/auth.guard.d.ts +31 -9
- package/dist/auth.guard.js +49 -106
- package/dist/auth.guard.js.map +1 -1
- package/dist/auth.middleware.d.ts +21 -6
- package/dist/auth.middleware.js +124 -36
- package/dist/auth.middleware.js.map +1 -1
- package/dist/auth.module-definition.d.ts +1 -1
- package/dist/auth.module.d.ts +28 -5
- package/dist/auth.module.js +87 -64
- package/dist/auth.module.js.map +1 -1
- package/dist/connections/account.connection-definition.d.ts +9 -0
- package/dist/connections/account.connection-definition.js +38 -0
- package/dist/connections/account.connection-definition.js.map +1 -0
- package/dist/connections/index.d.ts +8 -0
- package/dist/connections/index.js +9 -0
- package/dist/connections/index.js.map +1 -0
- package/dist/connections/invitation.connection-definition.d.ts +9 -0
- package/dist/connections/invitation.connection-definition.js +40 -0
- package/dist/connections/invitation.connection-definition.js.map +1 -0
- package/dist/connections/member.connection-definition.d.ts +9 -0
- package/dist/connections/member.connection-definition.js +52 -0
- package/dist/connections/member.connection-definition.js.map +1 -0
- package/dist/connections/session.connection-definition.d.ts +9 -0
- package/dist/connections/session.connection-definition.js +32 -0
- package/dist/connections/session.connection-definition.js.map +1 -0
- package/dist/connections/user-api-key.connection-definition.d.ts +13 -0
- package/dist/connections/user-api-key.connection-definition.js +60 -0
- package/dist/connections/user-api-key.connection-definition.js.map +1 -0
- package/dist/connections/user.connection-definition.d.ts +9 -0
- package/dist/connections/user.connection-definition.js +46 -0
- package/dist/connections/user.connection-definition.js.map +1 -0
- package/dist/connections/workspace-api-key.connection-definition.d.ts +13 -0
- package/dist/connections/workspace-api-key.connection-definition.js +60 -0
- package/dist/connections/workspace-api-key.connection-definition.js.map +1 -0
- package/dist/connections/workspace.connection-definition.d.ts +13 -0
- package/dist/connections/workspace.connection-definition.js +43 -0
- package/dist/connections/workspace.connection-definition.js.map +1 -0
- package/dist/decorators/can.decorator.d.ts +8 -0
- package/dist/decorators/can.decorator.js +8 -0
- package/dist/decorators/can.decorator.js.map +1 -1
- package/dist/decorators/current-api-key.decorator.d.ts +1 -0
- package/dist/decorators/current-api-key.decorator.js +3 -3
- package/dist/decorators/current-api-key.decorator.js.map +1 -1
- package/dist/decorators/current-member.decorator.d.ts +2 -0
- package/dist/decorators/current-member.decorator.js +6 -0
- package/dist/decorators/current-member.decorator.js.map +1 -0
- package/dist/decorators/current-session.decorator.d.ts +1 -0
- package/dist/decorators/current-session.decorator.js +3 -2
- package/dist/decorators/current-session.decorator.js.map +1 -1
- package/dist/decorators/current-user.decorator.d.ts +1 -0
- package/dist/decorators/current-user.decorator.js +3 -2
- package/dist/decorators/current-user.decorator.js.map +1 -1
- package/dist/decorators/current-workspace.decorator.d.ts +1 -0
- package/dist/decorators/current-workspace.decorator.js +3 -2
- package/dist/decorators/current-workspace.decorator.js.map +1 -1
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +1 -1
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/public.decorator.d.ts +1 -0
- package/dist/decorators/public.decorator.js +1 -0
- package/dist/decorators/public.decorator.js.map +1 -1
- package/dist/decorators/user-can.decorator.d.ts +8 -0
- package/dist/decorators/user-can.decorator.js +8 -0
- package/dist/decorators/user-can.decorator.js.map +1 -1
- package/dist/decorators/workspace-can.decorator.d.ts +8 -0
- package/dist/decorators/workspace-can.decorator.js +8 -0
- package/dist/decorators/workspace-can.decorator.js.map +1 -1
- package/dist/entities/account.entity.d.ts +21 -3
- package/dist/entities/account.entity.js +67 -29
- package/dist/entities/account.entity.js.map +1 -1
- package/dist/entities/auth-entity-map.d.ts +21 -0
- package/dist/entities/auth-entity-map.js +22 -0
- package/dist/entities/auth-entity-map.js.map +1 -0
- package/dist/entities/index.d.ts +14 -3
- package/dist/entities/index.js +25 -3
- package/dist/entities/index.js.map +1 -1
- package/dist/entities/invitation.entity.d.ts +24 -0
- package/dist/entities/invitation.entity.js +117 -0
- package/dist/entities/invitation.entity.js.map +1 -0
- package/dist/entities/member.entity.d.ts +28 -0
- package/dist/entities/member.entity.js +126 -0
- package/dist/entities/member.entity.js.map +1 -0
- package/dist/entities/session.entity.d.ts +16 -6
- package/dist/entities/session.entity.js +57 -27
- package/dist/entities/session.entity.js.map +1 -1
- package/dist/entities/user-api-key.entity.d.ts +29 -0
- package/dist/entities/user-api-key.entity.js +147 -0
- package/dist/entities/user-api-key.entity.js.map +1 -0
- package/dist/entities/user.entity.d.ts +18 -2
- package/dist/entities/user.entity.js +104 -29
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/entities/verification.entity.d.ts +8 -1
- package/dist/entities/verification.entity.js +27 -11
- package/dist/entities/verification.entity.js.map +1 -1
- package/dist/entities/workspace-api-key.entity.d.ts +29 -0
- package/dist/entities/workspace-api-key.entity.js +147 -0
- package/dist/entities/workspace-api-key.entity.js.map +1 -0
- package/dist/entities/workspace.entity.d.ts +10 -3
- package/dist/entities/workspace.entity.js +51 -20
- package/dist/entities/workspace.entity.js.map +1 -1
- package/dist/enums/index.d.ts +8 -0
- package/dist/enums/index.js +9 -0
- package/dist/enums/index.js.map +1 -0
- package/dist/enums/invitation-status.enum.d.ts +11 -0
- package/dist/enums/invitation-status.enum.js +17 -0
- package/dist/enums/invitation-status.enum.js.map +1 -0
- package/dist/enums/member-status.enum.d.ts +9 -0
- package/dist/enums/member-status.enum.js +15 -0
- package/dist/enums/member-status.enum.js.map +1 -0
- package/dist/enums/user-api-key-permission.enum.d.ts +4 -0
- package/dist/enums/user-api-key-permission.enum.js +11 -0
- package/dist/enums/user-api-key-permission.enum.js.map +1 -0
- package/dist/enums/user-permission.enum.d.ts +4 -0
- package/dist/enums/user-permission.enum.js +7 -0
- package/dist/enums/user-permission.enum.js.map +1 -0
- package/dist/enums/user-role.enum.d.ts +4 -0
- package/dist/enums/user-role.enum.js +6 -0
- package/dist/enums/user-role.enum.js.map +1 -0
- package/dist/enums/workspace-api-key-permission.enum.d.ts +4 -0
- package/dist/enums/workspace-api-key-permission.enum.js +11 -0
- package/dist/enums/workspace-api-key-permission.enum.js.map +1 -0
- package/dist/enums/workspace-permission.enum.d.ts +4 -0
- package/dist/enums/workspace-permission.enum.js +7 -0
- package/dist/enums/workspace-permission.enum.js.map +1 -0
- package/dist/enums/workspace-role.enum.d.ts +4 -0
- package/dist/enums/workspace-role.enum.js +9 -0
- package/dist/enums/workspace-role.enum.js.map +1 -0
- package/dist/index.d.ts +184 -12
- package/dist/index.js +183 -12
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/api-key-authentication.service.d.ts +14 -0
- package/dist/infrastructure/api-key-authentication.service.js +78 -0
- package/dist/infrastructure/api-key-authentication.service.js.map +1 -0
- package/dist/infrastructure/auth-ability.factory.d.ts +15 -0
- package/dist/infrastructure/auth-ability.factory.js +91 -0
- package/dist/infrastructure/auth-ability.factory.js.map +1 -0
- package/dist/infrastructure/auth-enum-registry.d.ts +8 -0
- package/dist/infrastructure/auth-enum-registry.js +48 -0
- package/dist/infrastructure/auth-enum-registry.js.map +1 -0
- package/dist/infrastructure/auth-service.providers.d.ts +3 -0
- package/dist/infrastructure/auth-service.providers.js +72 -0
- package/dist/infrastructure/auth-service.providers.js.map +1 -0
- package/dist/infrastructure/create-contextual-auth-service.d.ts +10 -0
- package/dist/infrastructure/create-contextual-auth-service.js +50 -0
- package/dist/infrastructure/create-contextual-auth-service.js.map +1 -0
- package/dist/infrastructure/request-identity.d.ts +34 -0
- package/dist/infrastructure/request-identity.js +174 -0
- package/dist/infrastructure/request-identity.js.map +1 -0
- package/dist/infrastructure/revoked-authentication.exception.d.ts +4 -0
- package/dist/infrastructure/revoked-authentication.exception.js +5 -0
- package/dist/infrastructure/revoked-authentication.exception.js.map +1 -0
- package/dist/inputs/add-member.input.d.ts +5 -0
- package/dist/inputs/add-member.input.js +26 -0
- package/dist/inputs/add-member.input.js.map +1 -0
- package/dist/inputs/auth-change-email.input.d.ts +7 -0
- package/dist/inputs/auth-change-email.input.js +33 -0
- package/dist/inputs/auth-change-email.input.js.map +1 -0
- package/dist/inputs/auth-change-password.input.d.ts +9 -0
- package/dist/inputs/auth-change-password.input.js +40 -0
- package/dist/inputs/auth-change-password.input.js.map +1 -0
- package/dist/inputs/auth-delete-user.input.d.ts +9 -0
- package/dist/inputs/auth-delete-user.input.js +40 -0
- package/dist/inputs/auth-delete-user.input.js.map +1 -0
- package/dist/inputs/auth-link-social-account.input.d.ts +13 -0
- package/dist/inputs/auth-link-social-account.input.js +54 -0
- package/dist/inputs/auth-link-social-account.input.js.map +1 -0
- package/dist/inputs/auth-request-password-reset.input.d.ts +7 -0
- package/dist/inputs/auth-request-password-reset.input.js +33 -0
- package/dist/inputs/auth-request-password-reset.input.js.map +1 -0
- package/dist/inputs/auth-reset-password.input.d.ts +7 -0
- package/dist/inputs/auth-reset-password.input.js +33 -0
- package/dist/inputs/auth-reset-password.input.js.map +1 -0
- package/dist/inputs/auth-send-verification-email.input.d.ts +7 -0
- package/dist/inputs/auth-send-verification-email.input.js +33 -0
- package/dist/inputs/auth-send-verification-email.input.js.map +1 -0
- package/dist/inputs/auth-sign-in-social.input.d.ts +17 -0
- package/dist/inputs/auth-sign-in-social.input.js +68 -0
- package/dist/inputs/auth-sign-in-social.input.js.map +1 -0
- package/dist/inputs/auth-sign-in.input.d.ts +11 -0
- package/dist/inputs/auth-sign-in.input.js +47 -0
- package/dist/inputs/auth-sign-in.input.js.map +1 -0
- package/dist/inputs/auth-sign-up.input.d.ts +15 -0
- package/dist/inputs/auth-sign-up.input.js +61 -0
- package/dist/inputs/auth-sign-up.input.js.map +1 -0
- package/dist/inputs/auth-update-user.input.d.ts +7 -0
- package/dist/inputs/auth-update-user.input.js +33 -0
- package/dist/inputs/auth-update-user.input.js.map +1 -0
- package/dist/inputs/ban-user.input.d.ts +7 -0
- package/dist/inputs/ban-user.input.js +33 -0
- package/dist/inputs/ban-user.input.js.map +1 -0
- package/dist/inputs/create-invitation.input.d.ts +10 -0
- package/dist/inputs/create-invitation.input.js +41 -0
- package/dist/inputs/create-invitation.input.js.map +1 -0
- package/dist/inputs/create-user-api-key.input.d.ts +14 -0
- package/dist/inputs/create-user-api-key.input.js +55 -0
- package/dist/inputs/create-user-api-key.input.js.map +1 -0
- package/dist/inputs/create-user.input.d.ts +15 -0
- package/dist/inputs/create-user.input.js +56 -0
- package/dist/inputs/create-user.input.js.map +1 -0
- package/dist/inputs/create-workspace-api-key.input.d.ts +14 -0
- package/dist/inputs/create-workspace-api-key.input.js +55 -0
- package/dist/inputs/create-workspace-api-key.input.js.map +1 -0
- package/dist/inputs/create-workspace.input.d.ts +7 -0
- package/dist/inputs/create-workspace.input.js +28 -0
- package/dist/inputs/create-workspace.input.js.map +1 -0
- package/dist/inputs/set-member-permissions.input.d.ts +6 -0
- package/dist/inputs/set-member-permissions.input.js +27 -0
- package/dist/inputs/set-member-permissions.input.js.map +1 -0
- package/dist/inputs/set-member-roles.input.d.ts +6 -0
- package/dist/inputs/set-member-roles.input.js +27 -0
- package/dist/inputs/set-member-roles.input.js.map +1 -0
- package/dist/inputs/set-user-password.input.d.ts +5 -0
- package/dist/inputs/set-user-password.input.js +26 -0
- package/dist/inputs/set-user-password.input.js.map +1 -0
- package/dist/inputs/set-user-permissions.input.d.ts +6 -0
- package/dist/inputs/set-user-permissions.input.js +27 -0
- package/dist/inputs/set-user-permissions.input.js.map +1 -0
- package/dist/inputs/set-user-roles.input.d.ts +6 -0
- package/dist/inputs/set-user-roles.input.js +27 -0
- package/dist/inputs/set-user-roles.input.js.map +1 -0
- package/dist/inputs/update-member.input.d.ts +10 -0
- package/dist/inputs/update-member.input.js +43 -0
- package/dist/inputs/update-member.input.js.map +1 -0
- package/dist/inputs/update-user-api-key.input.d.ts +14 -0
- package/dist/inputs/update-user-api-key.input.js +50 -0
- package/dist/inputs/update-user-api-key.input.js.map +1 -0
- package/dist/inputs/update-user.input.d.ts +11 -0
- package/dist/inputs/update-user.input.js +47 -0
- package/dist/inputs/update-user.input.js.map +1 -0
- package/dist/inputs/update-workspace-api-key.input.d.ts +14 -0
- package/dist/inputs/update-workspace-api-key.input.js +50 -0
- package/dist/inputs/update-workspace-api-key.input.js.map +1 -0
- package/dist/inputs/update-workspace.input.d.ts +7 -0
- package/dist/inputs/update-workspace.input.js +28 -0
- package/dist/inputs/update-workspace.input.js.map +1 -0
- package/dist/inputs/user-id.input.d.ts +5 -0
- package/dist/inputs/user-id.input.js +26 -0
- package/dist/inputs/user-id.input.js.map +1 -0
- package/dist/interfaces/ability-rules.interface.d.ts +8 -0
- package/dist/interfaces/ability-rules.interface.js +2 -0
- package/dist/interfaces/ability-rules.interface.js.map +1 -0
- package/dist/interfaces/accept-invitation-result.interface.d.ts +9 -0
- package/dist/interfaces/accept-invitation-result.interface.js +2 -0
- package/dist/interfaces/accept-invitation-result.interface.js.map +1 -0
- package/dist/interfaces/add-member-options.interface.d.ts +7 -0
- package/dist/interfaces/add-member-options.interface.js +2 -0
- package/dist/interfaces/add-member-options.interface.js.map +1 -0
- package/dist/interfaces/auth-access-token.interface.d.ts +11 -0
- package/dist/interfaces/auth-access-token.interface.js +2 -0
- package/dist/interfaces/auth-access-token.interface.js.map +1 -0
- package/dist/interfaces/auth-account-info.interface.d.ts +11 -0
- package/dist/interfaces/auth-account-info.interface.js +2 -0
- package/dist/interfaces/auth-account-info.interface.js.map +1 -0
- package/dist/interfaces/auth-account.interface.d.ts +19 -0
- package/dist/interfaces/auth-account.interface.js +2 -0
- package/dist/interfaces/auth-account.interface.js.map +1 -0
- package/dist/interfaces/auth-change-email-confirmation-data.interface.d.ts +12 -0
- package/dist/interfaces/auth-change-email-confirmation-data.interface.js +2 -0
- package/dist/interfaces/auth-change-email-confirmation-data.interface.js.map +1 -0
- package/dist/interfaces/auth-delete-account-verification-data.interface.d.ts +10 -0
- package/dist/interfaces/auth-delete-account-verification-data.interface.js +2 -0
- package/dist/interfaces/auth-delete-account-verification-data.interface.js.map +1 -0
- package/dist/interfaces/auth-email-verification-data.interface.d.ts +10 -0
- package/dist/interfaces/auth-email-verification-data.interface.js +2 -0
- package/dist/interfaces/auth-email-verification-data.interface.js.map +1 -0
- package/dist/interfaces/auth-invitation-email-data.interface.d.ts +18 -0
- package/dist/interfaces/auth-invitation-email-data.interface.js +2 -0
- package/dist/interfaces/auth-invitation-email-data.interface.js.map +1 -0
- package/dist/interfaces/auth-module-account-linking-options.interface.d.ts +18 -0
- package/dist/interfaces/auth-module-account-linking-options.interface.js +2 -0
- package/dist/interfaces/auth-module-account-linking-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-account-options.interface.d.ts +16 -0
- package/dist/interfaces/auth-module-account-options.interface.js +2 -0
- package/dist/interfaces/auth-module-account-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-api-key-options.interface.d.ts +15 -0
- package/dist/interfaces/auth-module-api-key-options.interface.js +2 -0
- package/dist/interfaces/auth-module-api-key-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-change-email-options.interface.d.ts +10 -0
- package/dist/interfaces/auth-module-change-email-options.interface.js +2 -0
- package/dist/interfaces/auth-module-change-email-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-delete-user-options.interface.d.ts +15 -0
- package/dist/interfaces/auth-module-delete-user-options.interface.js +2 -0
- package/dist/interfaces/auth-module-delete-user-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-email-and-password-options.interface.d.ts +34 -0
- package/dist/interfaces/auth-module-email-and-password-options.interface.js +2 -0
- package/dist/interfaces/auth-module-email-and-password-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-email-verification-options.interface.d.ts +19 -0
- package/dist/interfaces/auth-module-email-verification-options.interface.js +2 -0
- package/dist/interfaces/auth-module-email-verification-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-middleware-options.interface.d.ts +11 -0
- package/dist/interfaces/auth-module-middleware-options.interface.js +2 -0
- package/dist/interfaces/auth-module-middleware-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-oauth-provider.interface.d.ts +91 -0
- package/dist/interfaces/auth-module-oauth-provider.interface.js +2 -0
- package/dist/interfaces/auth-module-oauth-provider.interface.js.map +1 -0
- package/dist/interfaces/auth-module-password-options.interface.d.ts +10 -0
- package/dist/interfaces/auth-module-password-options.interface.js +2 -0
- package/dist/interfaces/auth-module-password-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-session-cookie-cache-options.interface.d.ts +14 -0
- package/dist/interfaces/auth-module-session-cookie-cache-options.interface.js +2 -0
- package/dist/interfaces/auth-module-session-cookie-cache-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-session-cookie-cache-refresh-options.interface.d.ts +5 -0
- package/dist/interfaces/auth-module-session-cookie-cache-refresh-options.interface.js +2 -0
- package/dist/interfaces/auth-module-session-cookie-cache-refresh-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-session-options.interface.d.ts +16 -0
- package/dist/interfaces/auth-module-session-options.interface.js +2 -0
- package/dist/interfaces/auth-module-session-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-social-provider.interface.d.ts +109 -0
- package/dist/interfaces/auth-module-social-provider.interface.js +2 -0
- package/dist/interfaces/auth-module-social-provider.interface.js.map +1 -0
- package/dist/interfaces/auth-module-user-options.interface.d.ts +22 -0
- package/dist/interfaces/auth-module-user-options.interface.js +2 -0
- package/dist/interfaces/auth-module-user-options.interface.js.map +1 -0
- package/dist/interfaces/auth-module-workspace-options.interface.d.ts +19 -0
- package/dist/interfaces/auth-module-workspace-options.interface.js +2 -0
- package/dist/interfaces/auth-module-workspace-options.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-basic-token-endpoint-auth.interface.d.ts +5 -0
- package/dist/interfaces/auth-oauth-basic-token-endpoint-auth.interface.js +2 -0
- package/dist/interfaces/auth-oauth-basic-token-endpoint-auth.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-client-assertion-context.interface.d.ts +9 -0
- package/dist/interfaces/auth-oauth-client-assertion-context.interface.js +2 -0
- package/dist/interfaces/auth-oauth-client-assertion-context.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-custom-token-endpoint-auth.interface.d.ts +8 -0
- package/dist/interfaces/auth-oauth-custom-token-endpoint-auth.interface.js +2 -0
- package/dist/interfaces/auth-oauth-custom-token-endpoint-auth.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-mapped-user.interface.d.ts +15 -0
- package/dist/interfaces/auth-oauth-mapped-user.interface.js +2 -0
- package/dist/interfaces/auth-oauth-mapped-user.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-no-token-endpoint-auth.interface.d.ts +5 -0
- package/dist/interfaces/auth-oauth-no-token-endpoint-auth.interface.js +2 -0
- package/dist/interfaces/auth-oauth-no-token-endpoint-auth.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-post-token-endpoint-auth.interface.d.ts +5 -0
- package/dist/interfaces/auth-oauth-post-token-endpoint-auth.interface.js +2 -0
- package/dist/interfaces/auth-oauth-post-token-endpoint-auth.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-private-key-jwt-token-endpoint-auth.interface.d.ts +9 -0
- package/dist/interfaces/auth-oauth-private-key-jwt-token-endpoint-auth.interface.js +2 -0
- package/dist/interfaces/auth-oauth-private-key-jwt-token-endpoint-auth.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-profile.interface.d.ts +9 -0
- package/dist/interfaces/auth-oauth-profile.interface.js +2 -0
- package/dist/interfaces/auth-oauth-profile.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-refresh-context.interface.d.ts +7 -0
- package/dist/interfaces/auth-oauth-refresh-context.interface.js +2 -0
- package/dist/interfaces/auth-oauth-refresh-context.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-token-request-client-options.interface.d.ts +7 -0
- package/dist/interfaces/auth-oauth-token-request-client-options.interface.js +2 -0
- package/dist/interfaces/auth-oauth-token-request-client-options.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-token-request-context.interface.d.ts +15 -0
- package/dist/interfaces/auth-oauth-token-request-context.interface.js +2 -0
- package/dist/interfaces/auth-oauth-token-request-context.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-tokens.interface.d.ts +19 -0
- package/dist/interfaces/auth-oauth-tokens.interface.js +2 -0
- package/dist/interfaces/auth-oauth-tokens.interface.js.map +1 -0
- package/dist/interfaces/auth-oauth-user-info.interface.d.ts +13 -0
- package/dist/interfaces/auth-oauth-user-info.interface.js +2 -0
- package/dist/interfaces/auth-oauth-user-info.interface.js.map +1 -0
- package/dist/interfaces/auth-provider-user-info.interface.d.ts +13 -0
- package/dist/interfaces/auth-provider-user-info.interface.js +2 -0
- package/dist/interfaces/auth-provider-user-info.interface.js.map +1 -0
- package/dist/interfaces/auth-refreshed-token.interface.d.ts +19 -0
- package/dist/interfaces/auth-refreshed-token.interface.js +2 -0
- package/dist/interfaces/auth-refreshed-token.interface.js.map +1 -0
- package/dist/interfaces/auth-reset-password-data.interface.d.ts +10 -0
- package/dist/interfaces/auth-reset-password-data.interface.js +2 -0
- package/dist/interfaces/auth-reset-password-data.interface.js.map +1 -0
- package/dist/interfaces/auth-social-provider-user-info.interface.d.ts +8 -0
- package/dist/interfaces/auth-social-provider-user-info.interface.js +2 -0
- package/dist/interfaces/auth-social-provider-user-info.interface.js.map +1 -0
- package/dist/interfaces/auth-social-provider.interface.d.ts +7 -0
- package/dist/interfaces/auth-social-provider.interface.js +2 -0
- package/dist/interfaces/auth-social-provider.interface.js.map +1 -0
- package/dist/interfaces/auth-user.interface.d.ts +19 -0
- package/dist/interfaces/auth-user.interface.js +2 -0
- package/dist/interfaces/auth-user.interface.js.map +1 -0
- package/dist/interfaces/authenticated-session.interface.d.ts +9 -0
- package/dist/interfaces/authenticated-session.interface.js +2 -0
- package/dist/interfaces/authenticated-session.interface.js.map +1 -0
- package/dist/interfaces/ban-user-options.interface.d.ts +7 -0
- package/dist/interfaces/ban-user-options.interface.js +2 -0
- package/dist/interfaces/ban-user-options.interface.js.map +1 -0
- package/dist/interfaces/can-options.interface.d.ts +2 -0
- package/dist/interfaces/change-auth-email-options.interface.d.ts +7 -0
- package/dist/interfaces/change-auth-email-options.interface.js +2 -0
- package/dist/interfaces/change-auth-email-options.interface.js.map +1 -0
- package/dist/interfaces/change-auth-password-options.interface.d.ts +9 -0
- package/dist/interfaces/change-auth-password-options.interface.js +2 -0
- package/dist/interfaces/change-auth-password-options.interface.js.map +1 -0
- package/dist/interfaces/change-auth-password-result.interface.d.ts +5 -0
- package/dist/interfaces/change-auth-password-result.interface.js +2 -0
- package/dist/interfaces/change-auth-password-result.interface.js.map +1 -0
- package/dist/interfaces/create-api-key-options.interface.d.ts +14 -0
- package/dist/interfaces/create-api-key-options.interface.js +2 -0
- package/dist/interfaces/create-api-key-options.interface.js.map +1 -0
- package/dist/interfaces/create-invitation-options.interface.d.ts +9 -0
- package/dist/interfaces/create-invitation-options.interface.js +2 -0
- package/dist/interfaces/create-invitation-options.interface.js.map +1 -0
- package/dist/interfaces/create-user-options.interface.d.ts +13 -0
- package/dist/interfaces/create-user-options.interface.js +2 -0
- package/dist/interfaces/create-user-options.interface.js.map +1 -0
- package/dist/interfaces/create-workspace-options.interface.d.ts +5 -0
- package/dist/interfaces/create-workspace-options.interface.js +2 -0
- package/dist/interfaces/create-workspace-options.interface.js.map +1 -0
- package/dist/interfaces/created-api-key.interface.d.ts +8 -0
- package/dist/interfaces/created-api-key.interface.js +2 -0
- package/dist/interfaces/created-api-key.interface.js.map +1 -0
- package/dist/interfaces/delete-auth-user-options.interface.d.ts +9 -0
- package/dist/interfaces/delete-auth-user-options.interface.js +2 -0
- package/dist/interfaces/delete-auth-user-options.interface.js.map +1 -0
- package/dist/interfaces/delete-auth-user-result.interface.d.ts +7 -0
- package/dist/interfaces/delete-auth-user-result.interface.js +2 -0
- package/dist/interfaces/delete-auth-user-result.interface.js.map +1 -0
- package/dist/interfaces/impersonation-options.interface.d.ts +7 -0
- package/dist/interfaces/impersonation-options.interface.js +2 -0
- package/dist/interfaces/impersonation-options.interface.js.map +1 -0
- package/dist/interfaces/link-auth-social-account-options.interface.d.ts +21 -0
- package/dist/interfaces/link-auth-social-account-options.interface.js +2 -0
- package/dist/interfaces/link-auth-social-account-options.interface.js.map +1 -0
- package/dist/interfaces/link-auth-social-account-result.interface.d.ts +7 -0
- package/dist/interfaces/link-auth-social-account-result.interface.js +2 -0
- package/dist/interfaces/link-auth-social-account-result.interface.js.map +1 -0
- package/dist/interfaces/request-identity-patch.interface.d.ts +13 -0
- package/dist/interfaces/request-identity-patch.interface.js +2 -0
- package/dist/interfaces/request-identity-patch.interface.js.map +1 -0
- package/dist/interfaces/request-password-reset-options.interface.d.ts +7 -0
- package/dist/interfaces/request-password-reset-options.interface.js +2 -0
- package/dist/interfaces/request-password-reset-options.interface.js.map +1 -0
- package/dist/interfaces/request-password-reset-result.interface.d.ts +7 -0
- package/dist/interfaces/request-password-reset-result.interface.js +2 -0
- package/dist/interfaces/request-password-reset-result.interface.js.map +1 -0
- package/dist/interfaces/request-permissions.interface.d.ts +7 -0
- package/dist/interfaces/request-permissions.interface.js +2 -0
- package/dist/interfaces/request-permissions.interface.js.map +1 -0
- package/dist/interfaces/reset-password-options.interface.d.ts +7 -0
- package/dist/interfaces/reset-password-options.interface.js +2 -0
- package/dist/interfaces/reset-password-options.interface.js.map +1 -0
- package/dist/interfaces/route-argument-metadata-value.interface.d.ts +4 -0
- package/dist/interfaces/scope-policy-options.interface.d.ts +14 -0
- package/dist/interfaces/scope-policy-options.interface.js +2 -0
- package/dist/interfaces/scope-policy-options.interface.js.map +1 -0
- package/dist/interfaces/send-verification-email-options.interface.d.ts +7 -0
- package/dist/interfaces/send-verification-email-options.interface.js +2 -0
- package/dist/interfaces/send-verification-email-options.interface.js.map +1 -0
- package/dist/interfaces/serialized-ability-rule.interface.d.ts +7 -0
- package/dist/interfaces/sign-in-entity-result.interface.d.ts +7 -0
- package/dist/interfaces/sign-in-entity-result.interface.js +2 -0
- package/dist/interfaces/sign-in-entity-result.interface.js.map +1 -0
- package/dist/interfaces/sign-in-options.interface.d.ts +11 -0
- package/dist/interfaces/sign-in-options.interface.js +2 -0
- package/dist/interfaces/sign-in-options.interface.js.map +1 -0
- package/dist/interfaces/sign-in-result.interface.d.ts +12 -0
- package/dist/interfaces/sign-in-result.interface.js +2 -0
- package/dist/interfaces/sign-in-result.interface.js.map +1 -0
- package/dist/interfaces/sign-in-social-entity-result.interface.d.ts +7 -0
- package/dist/interfaces/sign-in-social-entity-result.interface.js +2 -0
- package/dist/interfaces/sign-in-social-entity-result.interface.js.map +1 -0
- package/dist/interfaces/sign-in-social-options.interface.d.ts +23 -0
- package/dist/interfaces/sign-in-social-options.interface.js +2 -0
- package/dist/interfaces/sign-in-social-options.interface.js.map +1 -0
- package/dist/interfaces/sign-in-social-result.interface.d.ts +12 -0
- package/dist/interfaces/sign-in-social-result.interface.js +2 -0
- package/dist/interfaces/sign-in-social-result.interface.js.map +1 -0
- package/dist/interfaces/sign-up-options.interface.d.ts +15 -0
- package/dist/interfaces/sign-up-options.interface.js +2 -0
- package/dist/interfaces/sign-up-options.interface.js.map +1 -0
- package/dist/interfaces/sign-up-result.interface.d.ts +8 -0
- package/dist/interfaces/sign-up-result.interface.js +2 -0
- package/dist/interfaces/sign-up-result.interface.js.map +1 -0
- package/dist/interfaces/unlink-auth-account-options.interface.d.ts +5 -0
- package/dist/interfaces/unlink-auth-account-options.interface.js +2 -0
- package/dist/interfaces/unlink-auth-account-options.interface.js.map +1 -0
- package/dist/interfaces/update-api-key-options.interface.d.ts +14 -0
- package/dist/interfaces/update-api-key-options.interface.js +2 -0
- package/dist/interfaces/update-api-key-options.interface.js.map +1 -0
- package/dist/interfaces/update-auth-user-options.interface.d.ts +7 -0
- package/dist/interfaces/update-auth-user-options.interface.js +2 -0
- package/dist/interfaces/update-auth-user-options.interface.js.map +1 -0
- package/dist/interfaces/update-member-options.interface.d.ts +10 -0
- package/dist/interfaces/update-member-options.interface.js +2 -0
- package/dist/interfaces/update-member-options.interface.js.map +1 -0
- package/dist/interfaces/update-user-options.interface.d.ts +11 -0
- package/dist/interfaces/update-user-options.interface.js +2 -0
- package/dist/interfaces/update-user-options.interface.js.map +1 -0
- package/dist/interfaces/update-workspace-options.interface.d.ts +5 -0
- package/dist/interfaces/update-workspace-options.interface.js +2 -0
- package/dist/interfaces/update-workspace-options.interface.js.map +1 -0
- package/dist/interfaces/user-api-key-validation.interface.d.ts +11 -0
- package/dist/interfaces/user-api-key-validation.interface.js +2 -0
- package/dist/interfaces/user-api-key-validation.interface.js.map +1 -0
- package/dist/interfaces/user-can-metadata.interface.d.ts +3 -0
- package/dist/interfaces/user-has-permissions-options.interface.d.ts +5 -0
- package/dist/interfaces/user-has-permissions-options.interface.js +2 -0
- package/dist/interfaces/user-has-permissions-options.interface.js.map +1 -0
- package/dist/interfaces/workspace-api-key-validation.interface.d.ts +11 -0
- package/dist/interfaces/workspace-api-key-validation.interface.js +2 -0
- package/dist/interfaces/workspace-api-key-validation.interface.js.map +1 -0
- package/dist/interfaces/workspace-can-metadata.interface.d.ts +3 -0
- package/dist/interfaces/workspace-has-permissions-options.interface.d.ts +5 -0
- package/dist/interfaces/workspace-has-permissions-options.interface.js +2 -0
- package/dist/interfaces/workspace-has-permissions-options.interface.js.map +1 -0
- package/dist/objects/accept-invitation-payload.object.d.ts +9 -0
- package/dist/objects/accept-invitation-payload.object.js +36 -0
- package/dist/objects/accept-invitation-payload.object.js.map +1 -0
- package/dist/objects/add-member-payload.object.d.ts +5 -0
- package/dist/objects/add-member-payload.object.js +24 -0
- package/dist/objects/add-member-payload.object.js.map +1 -0
- package/dist/objects/auth-ability-rule.object.d.ts +15 -0
- package/dist/objects/auth-ability-rule.object.js +55 -0
- package/dist/objects/auth-ability-rule.object.js.map +1 -0
- package/dist/objects/auth-change-password-result.object.d.ts +5 -0
- package/dist/objects/auth-change-password-result.object.js +24 -0
- package/dist/objects/auth-change-password-result.object.js.map +1 -0
- package/dist/objects/auth-delete-user-result.object.d.ts +7 -0
- package/dist/objects/auth-delete-user-result.object.js +30 -0
- package/dist/objects/auth-delete-user-result.object.js.map +1 -0
- package/dist/objects/auth-link-social-account-result.object.d.ts +7 -0
- package/dist/objects/auth-link-social-account-result.object.js +30 -0
- package/dist/objects/auth-link-social-account-result.object.js.map +1 -0
- package/dist/objects/auth-request-password-reset-result.object.d.ts +7 -0
- package/dist/objects/auth-request-password-reset-result.object.js +30 -0
- package/dist/objects/auth-request-password-reset-result.object.js.map +1 -0
- package/dist/objects/auth-sign-in-result.object.d.ts +12 -0
- package/dist/objects/auth-sign-in-result.object.js +43 -0
- package/dist/objects/auth-sign-in-result.object.js.map +1 -0
- package/dist/objects/auth-sign-in-social-result.object.d.ts +12 -0
- package/dist/objects/auth-sign-in-social-result.object.js +43 -0
- package/dist/objects/auth-sign-in-social-result.object.js.map +1 -0
- package/dist/objects/auth-social-provider.object.d.ts +7 -0
- package/dist/objects/auth-social-provider.object.js +30 -0
- package/dist/objects/auth-social-provider.object.js.map +1 -0
- package/dist/objects/ban-user-payload.object.d.ts +5 -0
- package/dist/objects/ban-user-payload.object.js +24 -0
- package/dist/objects/ban-user-payload.object.js.map +1 -0
- package/dist/objects/cancel-invitation-payload.object.d.ts +5 -0
- package/dist/objects/cancel-invitation-payload.object.js +24 -0
- package/dist/objects/cancel-invitation-payload.object.js.map +1 -0
- package/dist/objects/create-invitation-payload.object.d.ts +5 -0
- package/dist/objects/create-invitation-payload.object.js +24 -0
- package/dist/objects/create-invitation-payload.object.js.map +1 -0
- package/dist/objects/create-user-api-key-result.object.d.ts +10 -0
- package/dist/objects/create-user-api-key-result.object.js +33 -0
- package/dist/objects/create-user-api-key-result.object.js.map +1 -0
- package/dist/objects/create-user-payload.object.d.ts +5 -0
- package/dist/objects/create-user-payload.object.js +24 -0
- package/dist/objects/create-user-payload.object.js.map +1 -0
- package/dist/objects/create-workspace-api-key-result.object.d.ts +10 -0
- package/dist/objects/create-workspace-api-key-result.object.js +33 -0
- package/dist/objects/create-workspace-api-key-result.object.js.map +1 -0
- package/dist/objects/create-workspace-payload.object.d.ts +5 -0
- package/dist/objects/create-workspace-payload.object.js +24 -0
- package/dist/objects/create-workspace-payload.object.js.map +1 -0
- package/dist/objects/delete-user-payload.object.d.ts +5 -0
- package/dist/objects/delete-user-payload.object.js +24 -0
- package/dist/objects/delete-user-payload.object.js.map +1 -0
- package/dist/objects/delete-workspace-payload.object.d.ts +5 -0
- package/dist/objects/delete-workspace-payload.object.js +24 -0
- package/dist/objects/delete-workspace-payload.object.js.map +1 -0
- package/dist/objects/leave-workspace-payload.object.d.ts +5 -0
- package/dist/objects/leave-workspace-payload.object.js +24 -0
- package/dist/objects/leave-workspace-payload.object.js.map +1 -0
- package/dist/objects/reject-invitation-payload.object.d.ts +5 -0
- package/dist/objects/reject-invitation-payload.object.js +24 -0
- package/dist/objects/reject-invitation-payload.object.js.map +1 -0
- package/dist/objects/remove-member-payload.object.d.ts +5 -0
- package/dist/objects/remove-member-payload.object.js +24 -0
- package/dist/objects/remove-member-payload.object.js.map +1 -0
- package/dist/objects/set-member-permissions-payload.object.d.ts +5 -0
- package/dist/objects/set-member-permissions-payload.object.js +24 -0
- package/dist/objects/set-member-permissions-payload.object.js.map +1 -0
- package/dist/objects/set-member-roles-payload.object.d.ts +5 -0
- package/dist/objects/set-member-roles-payload.object.js +24 -0
- package/dist/objects/set-member-roles-payload.object.js.map +1 -0
- package/dist/objects/set-user-permissions-payload.object.d.ts +5 -0
- package/dist/objects/set-user-permissions-payload.object.js +24 -0
- package/dist/objects/set-user-permissions-payload.object.js.map +1 -0
- package/dist/objects/set-user-roles-payload.object.d.ts +5 -0
- package/dist/objects/set-user-roles-payload.object.js +24 -0
- package/dist/objects/set-user-roles-payload.object.js.map +1 -0
- package/dist/objects/sign-up-payload.object.d.ts +7 -0
- package/dist/objects/sign-up-payload.object.js +30 -0
- package/dist/objects/sign-up-payload.object.js.map +1 -0
- package/dist/objects/unban-user-payload.object.d.ts +5 -0
- package/dist/objects/unban-user-payload.object.js +24 -0
- package/dist/objects/unban-user-payload.object.js.map +1 -0
- package/dist/objects/update-member-payload.object.d.ts +5 -0
- package/dist/objects/update-member-payload.object.js +24 -0
- package/dist/objects/update-member-payload.object.js.map +1 -0
- package/dist/objects/update-user-payload.object.d.ts +5 -0
- package/dist/objects/update-user-payload.object.js +24 -0
- package/dist/objects/update-user-payload.object.js.map +1 -0
- package/dist/objects/update-workspace-payload.object.d.ts +5 -0
- package/dist/objects/update-workspace-payload.object.js +24 -0
- package/dist/objects/update-workspace-payload.object.js.map +1 -0
- package/dist/objects/user-api-key-permission-option.object.d.ts +8 -0
- package/dist/objects/user-api-key-permission-option.object.js +31 -0
- package/dist/objects/user-api-key-permission-option.object.js.map +1 -0
- package/dist/objects/user-permission-option.object.d.ts +8 -0
- package/dist/objects/user-permission-option.object.js +31 -0
- package/dist/objects/user-permission-option.object.js.map +1 -0
- package/dist/objects/user-role-option.object.d.ts +8 -0
- package/dist/objects/user-role-option.object.js +31 -0
- package/dist/objects/user-role-option.object.js.map +1 -0
- package/dist/objects/workspace-api-key-permission-option.object.d.ts +8 -0
- package/dist/objects/workspace-api-key-permission-option.object.js +31 -0
- package/dist/objects/workspace-api-key-permission-option.object.js.map +1 -0
- package/dist/objects/workspace-permission-option.object.d.ts +8 -0
- package/dist/objects/workspace-permission-option.object.js +31 -0
- package/dist/objects/workspace-permission-option.object.js.map +1 -0
- package/dist/objects/workspace-role-option.object.d.ts +8 -0
- package/dist/objects/workspace-role-option.object.js +31 -0
- package/dist/objects/workspace-role-option.object.js.map +1 -0
- package/dist/permission.constants.d.ts +23 -0
- package/dist/permission.constants.js +23 -0
- package/dist/permission.constants.js.map +1 -1
- package/dist/policies/create-scope-policy.d.ts +4 -0
- package/dist/policies/create-scope-policy.js +38 -0
- package/dist/policies/create-scope-policy.js.map +1 -0
- package/dist/policies/index.d.ts +2 -0
- package/dist/policies/index.js +3 -0
- package/dist/policies/index.js.map +1 -0
- package/dist/policies/user-scope.policy.d.ts +11 -0
- package/dist/policies/user-scope.policy.js +13 -0
- package/dist/policies/user-scope.policy.js.map +1 -0
- package/dist/policies/workspace-scope.policy.d.ts +11 -0
- package/dist/policies/workspace-scope.policy.js +13 -0
- package/dist/policies/workspace-scope.policy.js.map +1 -0
- package/dist/resolvers/auth.resolver.d.ts +67 -0
- package/dist/resolvers/auth.resolver.js +279 -0
- package/dist/resolvers/auth.resolver.js.map +1 -0
- package/dist/resolvers/invitation.resolver.d.ts +32 -0
- package/dist/resolvers/invitation.resolver.js +134 -0
- package/dist/resolvers/invitation.resolver.js.map +1 -0
- package/dist/resolvers/member.resolver.d.ts +73 -0
- package/dist/resolvers/member.resolver.js +191 -0
- package/dist/resolvers/member.resolver.js.map +1 -0
- package/dist/resolvers/session.resolver.d.ts +33 -0
- package/dist/resolvers/session.resolver.js +156 -0
- package/dist/resolvers/session.resolver.js.map +1 -0
- package/dist/resolvers/user-api-key.resolver.d.ts +24 -0
- package/dist/resolvers/user-api-key.resolver.js +84 -0
- package/dist/resolvers/user-api-key.resolver.js.map +1 -0
- package/dist/resolvers/user.resolver.d.ts +75 -0
- package/dist/resolvers/user.resolver.js +289 -0
- package/dist/resolvers/user.resolver.js.map +1 -0
- package/dist/resolvers/workspace-api-key.resolver.d.ts +24 -0
- package/dist/resolvers/workspace-api-key.resolver.js +84 -0
- package/dist/resolvers/workspace-api-key.resolver.js.map +1 -0
- package/dist/resolvers/workspace.resolver.d.ts +80 -0
- package/dist/resolvers/workspace.resolver.js +211 -0
- package/dist/resolvers/workspace.resolver.js.map +1 -0
- package/dist/services/access-control.service.d.ts +52 -0
- package/dist/services/access-control.service.js +201 -0
- package/dist/services/access-control.service.js.map +1 -0
- package/dist/services/account.service.d.ts +14 -0
- package/dist/services/account.service.js +43 -0
- package/dist/services/account.service.js.map +1 -0
- package/dist/services/auth.service.d.ts +101 -0
- package/dist/services/auth.service.js +333 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/invitation.service.d.ts +58 -0
- package/dist/services/invitation.service.js +386 -0
- package/dist/services/invitation.service.js.map +1 -0
- package/dist/services/member.service.d.ts +75 -0
- package/dist/services/member.service.js +390 -0
- package/dist/services/member.service.js.map +1 -0
- package/dist/services/session.service.d.ts +58 -0
- package/dist/services/session.service.js +313 -0
- package/dist/services/session.service.js.map +1 -0
- package/dist/services/user-api-key.service.d.ts +48 -0
- package/dist/services/user-api-key.service.js +260 -0
- package/dist/services/user-api-key.service.js.map +1 -0
- package/dist/services/user-deletion.service.d.ts +15 -0
- package/dist/services/user-deletion.service.js +50 -0
- package/dist/services/user-deletion.service.js.map +1 -0
- package/dist/services/user.service.d.ts +81 -0
- package/dist/services/user.service.js +479 -0
- package/dist/services/user.service.js.map +1 -0
- package/dist/services/workspace-api-key.service.d.ts +49 -0
- package/dist/services/workspace-api-key.service.js +272 -0
- package/dist/services/workspace-api-key.service.js.map +1 -0
- package/dist/services/workspace.service.d.ts +40 -0
- package/dist/services/workspace.service.js +202 -0
- package/dist/services/workspace.service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api-key-validation.type.d.ts +4 -0
- package/dist/types/api-key-validation.type.js +2 -0
- package/dist/types/api-key-validation.type.js.map +1 -0
- package/dist/types/api-key.type.d.ts +4 -0
- package/dist/types/api-key.type.js +2 -0
- package/dist/types/api-key.type.js.map +1 -0
- package/dist/types/auth-account-selector.type.d.ts +12 -0
- package/dist/types/auth-account-selector.type.js +2 -0
- package/dist/types/auth-account-selector.type.js.map +1 -0
- package/dist/types/auth-invitation-email-inviter.type.d.ts +7 -0
- package/dist/types/auth-invitation-email-inviter.type.js +2 -0
- package/dist/types/auth-invitation-email-inviter.type.js.map +1 -0
- package/dist/types/auth-maybe-promise.type.d.ts +2 -0
- package/dist/types/auth-maybe-promise.type.js +2 -0
- package/dist/types/auth-maybe-promise.type.js.map +1 -0
- package/dist/types/auth-module-provider.type.d.ts +4 -0
- package/dist/types/auth-module-provider.type.js +2 -0
- package/dist/types/auth-module-provider.type.js.map +1 -0
- package/dist/types/auth-module-roles.type.d.ts +3 -1
- package/dist/types/auth-module-social-provider-id.type.d.ts +2 -0
- package/dist/types/auth-module-social-provider-id.type.js +2 -0
- package/dist/types/auth-module-social-provider-id.type.js.map +1 -0
- package/dist/types/auth-oauth-token-endpoint-auth.type.d.ts +7 -0
- package/dist/types/auth-oauth-token-endpoint-auth.type.js +2 -0
- package/dist/types/auth-oauth-token-endpoint-auth.type.js.map +1 -0
- package/dist/types/auth-send-invitation-email.type.d.ts +7 -0
- package/dist/types/auth-send-invitation-email.type.js +2 -0
- package/dist/types/auth-send-invitation-email.type.js.map +1 -0
- package/dist/types/auth-send-reset-password.type.d.ts +7 -0
- package/dist/types/auth-send-reset-password.type.js +2 -0
- package/dist/types/auth-send-reset-password.type.js.map +1 -0
- package/dist/types/auth-send-verification-email.type.d.ts +7 -0
- package/dist/types/auth-send-verification-email.type.js +2 -0
- package/dist/types/auth-send-verification-email.type.js.map +1 -0
- package/dist/types/build-user-ability-callback.type.d.ts +10 -4
- package/dist/types/build-workspace-ability-callback.type.d.ts +10 -4
- package/dist/types/can-subject-factory.type.d.ts +1 -0
- package/dist/types/can-subject.type.d.ts +1 -0
- package/dist/types/lowercase-identifier.type.d.ts +6 -0
- package/dist/types/lowercase-identifier.type.js +2 -0
- package/dist/types/lowercase-identifier.type.js.map +1 -0
- package/dist/types/permission-name.type.d.ts +3 -0
- package/dist/types/permission-name.type.js +2 -0
- package/dist/types/permission-name.type.js.map +1 -0
- package/dist/types/role-name.type.d.ts +3 -0
- package/dist/types/role-name.type.js +2 -0
- package/dist/types/role-name.type.js.map +1 -0
- package/dist/types/route-argument-metadata.type.d.ts +1 -0
- package/dist/user.constants.d.ts +8 -2
- package/dist/user.constants.js +24 -14
- package/dist/user.constants.js.map +1 -1
- package/dist/utils/api-key-credential.util.d.ts +4 -0
- package/dist/utils/api-key-credential.util.js +16 -0
- package/dist/utils/api-key-credential.util.js.map +1 -0
- package/dist/utils/api-key-permissions.util.d.ts +6 -0
- package/dist/utils/api-key-permissions.util.js +16 -0
- package/dist/utils/api-key-permissions.util.js.map +1 -0
- package/dist/utils/append-metadata.util.d.ts +1 -0
- package/dist/utils/append-metadata.util.js +1 -0
- package/dist/utils/append-metadata.util.js.map +1 -1
- package/dist/utils/apply-auth-response-cookies.util.d.ts +1 -0
- package/dist/utils/apply-auth-response-cookies.util.js +1 -0
- package/dist/utils/apply-auth-response-cookies.util.js.map +1 -1
- package/dist/utils/auth-role.util.d.ts +8 -2
- package/dist/utils/auth-role.util.js +22 -6
- package/dist/utils/auth-role.util.js.map +1 -1
- package/dist/utils/build-request-ability.util.d.ts +7 -0
- package/dist/utils/build-request-ability.util.js +25 -0
- package/dist/utils/build-request-ability.util.js.map +1 -0
- package/dist/utils/can.util.d.ts +1 -0
- package/dist/utils/can.util.js +1 -0
- package/dist/utils/can.util.js.map +1 -1
- package/dist/utils/create-email-verification-config.d.ts +1 -0
- package/dist/utils/create-email-verification-config.js +1 -0
- package/dist/utils/create-email-verification-config.js.map +1 -1
- package/dist/utils/create-generic-oauth-config.d.ts +1 -0
- package/dist/utils/create-generic-oauth-config.js +1 -0
- package/dist/utils/create-generic-oauth-config.js.map +1 -1
- package/dist/utils/create-permission-enum.util.d.ts +2 -0
- package/dist/utils/create-permission-enum.util.js +16 -0
- package/dist/utils/create-permission-enum.util.js.map +1 -0
- package/dist/utils/create-user-config.d.ts +2 -1
- package/dist/utils/create-user-config.js +1 -0
- package/dist/utils/create-user-config.js.map +1 -1
- package/dist/utils/estimate-entropy.d.ts +7 -0
- package/dist/utils/estimate-entropy.js +7 -0
- package/dist/utils/estimate-entropy.js.map +1 -1
- package/dist/utils/extend-ability.util.d.ts +4 -0
- package/dist/utils/extend-ability.util.js +62 -0
- package/dist/utils/extend-ability.util.js.map +1 -0
- package/dist/utils/extract-api-key.util.d.ts +1 -0
- package/dist/utils/extract-api-key.util.js +1 -0
- package/dist/utils/extract-api-key.util.js.map +1 -1
- package/dist/utils/get-current-api-key.util.d.ts +3 -0
- package/dist/utils/get-current-api-key.util.js +9 -0
- package/dist/utils/get-current-api-key.util.js.map +1 -0
- package/dist/utils/get-user-ability.util.d.ts +2 -1
- package/dist/utils/get-user-ability.util.js +5 -2
- package/dist/utils/get-user-ability.util.js.map +1 -1
- package/dist/utils/get-workspace-ability.util.d.ts +2 -1
- package/dist/utils/get-workspace-ability.util.js +5 -2
- package/dist/utils/get-workspace-ability.util.js.map +1 -1
- package/dist/utils/resolve-auth-catalog.util.d.ts +7 -0
- package/dist/utils/resolve-auth-catalog.util.js +34 -0
- package/dist/utils/resolve-auth-catalog.util.js.map +1 -0
- package/dist/utils/resolve-effective-permissions.util.d.ts +9 -0
- package/dist/utils/resolve-effective-permissions.util.js +18 -0
- package/dist/utils/resolve-effective-permissions.util.js.map +1 -0
- package/dist/utils/resolve-request-permissions.util.d.ts +6 -0
- package/dist/utils/resolve-request-permissions.util.js +44 -0
- package/dist/utils/resolve-request-permissions.util.js.map +1 -0
- package/dist/utils/run-auth-query.d.ts +6 -0
- package/dist/utils/run-auth-query.js +51 -0
- package/dist/utils/run-auth-query.js.map +1 -0
- package/dist/utils/serialize-ability-rules.util.d.ts +1 -0
- package/dist/utils/serialize-ability-rules.util.js +2 -1
- package/dist/utils/serialize-ability-rules.util.js.map +1 -1
- package/dist/utils/split-auth-providers.d.ts +2 -1
- package/dist/utils/split-auth-providers.js +1 -0
- package/dist/utils/split-auth-providers.js.map +1 -1
- package/dist/utils/user-can.util.d.ts +1 -0
- package/dist/utils/user-can.util.js +3 -12
- package/dist/utils/user-can.util.js.map +1 -1
- package/dist/utils/workspace-can.util.d.ts +1 -0
- package/dist/utils/workspace-can.util.js +4 -12
- package/dist/utils/workspace-can.util.js.map +1 -1
- package/dist/workspace.constants.d.ts +10 -3
- package/dist/workspace.constants.js +24 -13
- package/dist/workspace.constants.js.map +1 -1
- package/package.json +41 -19
- package/dist/access-control.service.d.ts +0 -18
- package/dist/access-control.service.js +0 -153
- package/dist/access-control.service.js.map +0 -1
- package/dist/api-key.service.d.ts +0 -75
- package/dist/api-key.service.js +0 -336
- package/dist/api-key.service.js.map +0 -1
- package/dist/auth.service.d.ts +0 -27
- package/dist/auth.service.js +0 -199
- package/dist/auth.service.js.map +0 -1
- package/dist/decorators/current-workspace-member.decorator.d.ts +0 -1
- package/dist/decorators/current-workspace-member.decorator.js +0 -5
- package/dist/decorators/current-workspace-member.decorator.js.map +0 -1
- package/dist/entities/api-key.entity.d.ts +0 -17
- package/dist/entities/api-key.entity.js +0 -92
- package/dist/entities/api-key.entity.js.map +0 -1
- package/dist/entities/resolve-auth-relation-target.d.ts +0 -3
- package/dist/entities/resolve-auth-relation-target.js +0 -30
- package/dist/entities/resolve-auth-relation-target.js.map +0 -1
- package/dist/entities/workspace-invitation.entity.d.ts +0 -14
- package/dist/entities/workspace-invitation.entity.js +0 -74
- package/dist/entities/workspace-invitation.entity.js.map +0 -1
- package/dist/entities/workspace-member.entity.d.ts +0 -16
- package/dist/entities/workspace-member.entity.js +0 -86
- package/dist/entities/workspace-member.entity.js.map +0 -1
- package/dist/interfaces/auth-role.interface.d.ts +0 -4
- package/dist/interfaces/auth-role.interface.js +0 -2
- package/dist/interfaces/auth-role.interface.js.map +0 -1
- package/dist/interfaces/auth-service.interface.d.ts +0 -160
- package/dist/interfaces/auth-service.interface.js +0 -2
- package/dist/interfaces/auth-service.interface.js.map +0 -1
- package/dist/interfaces/session-service.interface.d.ts +0 -5
- package/dist/interfaces/session-service.interface.js +0 -2
- package/dist/interfaces/session-service.interface.js.map +0 -1
- package/dist/interfaces/user-service.interface.d.ts +0 -44
- package/dist/interfaces/user-service.interface.js +0 -2
- package/dist/interfaces/user-service.interface.js.map +0 -1
- package/dist/interfaces/workspace-service.interface.d.ts +0 -37
- package/dist/interfaces/workspace-service.interface.js +0 -2
- package/dist/interfaces/workspace-service.interface.js.map +0 -1
- package/dist/session.service.d.ts +0 -18
- package/dist/session.service.js +0 -171
- package/dist/session.service.js.map +0 -1
- package/dist/user-deletion.service.d.ts +0 -19
- package/dist/user-deletion.service.js +0 -103
- package/dist/user-deletion.service.js.map +0 -1
- package/dist/user.service.d.ts +0 -54
- package/dist/user.service.js +0 -386
- package/dist/user.service.js.map +0 -1
- package/dist/workspace.service.d.ts +0 -59
- package/dist/workspace.service.js +0 -611
- package/dist/workspace.service.js.map +0 -1
|
@@ -1,350 +1,43 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export interface AuthResetPasswordData {
|
|
17
|
-
user: AuthUser;
|
|
18
|
-
url: string;
|
|
19
|
-
token: string;
|
|
20
|
-
}
|
|
21
|
-
export type AuthSendResetPassword = (data: AuthResetPasswordData, request?: Request) => Promise<void>;
|
|
22
|
-
export type AuthWorkspaceInvitationEmailInviter = Omit<BaseWorkspaceMember, "user"> & {
|
|
23
|
-
user: BaseUser;
|
|
24
|
-
};
|
|
25
|
-
export interface AuthWorkspaceInvitationEmailData {
|
|
26
|
-
id: string;
|
|
27
|
-
roles: string[];
|
|
28
|
-
email: string;
|
|
29
|
-
workspace: BaseWorkspace;
|
|
30
|
-
invitation: BaseWorkspaceInvitation;
|
|
31
|
-
inviter: AuthWorkspaceInvitationEmailInviter;
|
|
32
|
-
}
|
|
33
|
-
export type AuthSendWorkspaceInvitationEmail = (data: AuthWorkspaceInvitationEmailData, request?: Request) => Promise<void>;
|
|
34
|
-
export interface AuthModulePasswordOptions {
|
|
35
|
-
hash?: (password: string) => Promise<string>;
|
|
36
|
-
verify?: (data: {
|
|
37
|
-
hash: string;
|
|
38
|
-
password: string;
|
|
39
|
-
}) => Promise<boolean>;
|
|
40
|
-
}
|
|
41
|
-
export interface AuthModuleEmailAndPasswordOptions {
|
|
42
|
-
enabled?: boolean;
|
|
43
|
-
disableSignUp?: boolean;
|
|
44
|
-
requireEmailVerification?: boolean;
|
|
45
|
-
maxPasswordLength?: number;
|
|
46
|
-
minPasswordLength?: number;
|
|
47
|
-
sendResetPassword?: AuthSendResetPassword;
|
|
48
|
-
resetPasswordTokenExpiresIn?: number;
|
|
49
|
-
onPasswordReset?: (data: {
|
|
50
|
-
user: AuthUser;
|
|
51
|
-
}, request?: Request) => Promise<void>;
|
|
52
|
-
password?: AuthModulePasswordOptions;
|
|
53
|
-
autoSignIn?: boolean;
|
|
54
|
-
revokeSessionsOnPasswordReset?: boolean;
|
|
55
|
-
onExistingUserSignUp?: (data: {
|
|
56
|
-
user: AuthUser;
|
|
57
|
-
}, request?: Request) => Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
export interface AuthModuleEmailVerificationOptions {
|
|
60
|
-
sendVerificationEmail?: AuthSendVerificationEmail;
|
|
61
|
-
sendOnSignUp?: boolean;
|
|
62
|
-
sendOnSignIn?: boolean;
|
|
63
|
-
autoSignInAfterVerification?: boolean;
|
|
64
|
-
expiresIn?: number;
|
|
65
|
-
beforeEmailVerification?: (user: AuthUser, request?: Request) => Promise<void>;
|
|
66
|
-
afterEmailVerification?: (user: AuthUser, request?: Request) => Promise<void>;
|
|
67
|
-
}
|
|
68
|
-
export interface AuthChangeEmailConfirmationData {
|
|
69
|
-
user: AuthUser;
|
|
70
|
-
newEmail: string;
|
|
71
|
-
url: string;
|
|
72
|
-
token: string;
|
|
73
|
-
}
|
|
74
|
-
export interface AuthModuleChangeEmailOptions {
|
|
75
|
-
enabled: boolean;
|
|
76
|
-
sendChangeEmailConfirmation?: (data: AuthChangeEmailConfirmationData, request?: Request) => Promise<void>;
|
|
77
|
-
updateEmailWithoutVerification?: boolean;
|
|
78
|
-
}
|
|
79
|
-
export interface AuthDeleteAccountVerificationData {
|
|
80
|
-
user: AuthUser;
|
|
81
|
-
url: string;
|
|
82
|
-
token: string;
|
|
83
|
-
}
|
|
84
|
-
export interface AuthModuleDeleteUserOptions {
|
|
85
|
-
enabled?: boolean;
|
|
86
|
-
sendDeleteAccountVerification?: (data: AuthDeleteAccountVerificationData, request?: Request) => Promise<void>;
|
|
87
|
-
beforeDelete?: (user: AuthUser, request?: Request) => Promise<void>;
|
|
88
|
-
afterDelete?: (user: AuthUser, request?: Request) => Promise<void>;
|
|
89
|
-
deleteTokenExpiresIn?: number;
|
|
90
|
-
}
|
|
91
|
-
export interface AuthModuleWorkspaceOptions<Permission extends string = string, Workspace extends BaseWorkspace = BaseWorkspace> {
|
|
92
|
-
defaultRole?: string;
|
|
93
|
-
creatorRole?: string;
|
|
94
|
-
permissions?: readonly Permission[];
|
|
95
|
-
roles?: AuthModuleRoles<NoInfer<Permission>>;
|
|
96
|
-
buildAbility?: BuildWorkspaceAbilityCallback<Permission, Workspace>;
|
|
97
|
-
sendInvitationEmail?: AuthSendWorkspaceInvitationEmail;
|
|
98
|
-
}
|
|
99
|
-
export interface AuthModuleUserOptions<Permission extends string = string, User extends BaseUser = BaseUser> {
|
|
100
|
-
defaultRole?: string;
|
|
101
|
-
adminRoles?: readonly string[];
|
|
102
|
-
permissions?: readonly Permission[];
|
|
103
|
-
roles?: AuthModuleRoles<NoInfer<Permission>>;
|
|
104
|
-
buildAbility?: BuildUserAbilityCallback<Permission, User>;
|
|
105
|
-
changeEmail?: AuthModuleChangeEmailOptions;
|
|
106
|
-
deleteUser?: AuthModuleDeleteUserOptions;
|
|
107
|
-
}
|
|
108
|
-
export interface AuthModuleAccountLinkingOptions {
|
|
109
|
-
enabled?: boolean;
|
|
110
|
-
disableImplicitLinking?: boolean;
|
|
111
|
-
requireLocalEmailVerified?: boolean;
|
|
112
|
-
trustedProviders?: string[] | ((request?: Request) => AuthMaybePromise<string[]>);
|
|
113
|
-
allowDifferentEmails?: boolean;
|
|
114
|
-
allowUnlinkingAll?: boolean;
|
|
115
|
-
updateUserInfoOnLink?: boolean;
|
|
116
|
-
}
|
|
117
|
-
export interface AuthModuleAccountOptions {
|
|
118
|
-
updateAccountOnSignIn?: boolean;
|
|
119
|
-
accountLinking?: AuthModuleAccountLinkingOptions;
|
|
120
|
-
encryptOAuthTokens?: boolean;
|
|
121
|
-
skipStateCookieCheck?: boolean;
|
|
122
|
-
storeStateStrategy?: "cookie" | "database";
|
|
123
|
-
storeAccountCookie?: boolean;
|
|
124
|
-
}
|
|
125
|
-
export interface AuthModuleSessionCookieCacheRefreshOptions {
|
|
126
|
-
updateAge?: number;
|
|
127
|
-
}
|
|
128
|
-
export interface AuthModuleSessionCookieCacheOptions {
|
|
129
|
-
enabled?: boolean;
|
|
130
|
-
maxAge?: number;
|
|
131
|
-
strategy?: "compact" | "jwe" | "jwt";
|
|
132
|
-
refreshCache?: boolean | AuthModuleSessionCookieCacheRefreshOptions;
|
|
133
|
-
version?: string | ((session: Record<string, unknown>, user: Record<string, unknown>) => string) | ((session: Record<string, unknown>, user: Record<string, unknown>) => Promise<string>);
|
|
134
|
-
}
|
|
135
|
-
export interface AuthModuleSessionOptions {
|
|
136
|
-
expiresIn?: number;
|
|
137
|
-
updateAge?: number;
|
|
138
|
-
disableSessionRefresh?: boolean;
|
|
139
|
-
deferSessionRefresh?: boolean;
|
|
140
|
-
cookieCache?: AuthModuleSessionCookieCacheOptions;
|
|
141
|
-
freshAge?: number;
|
|
142
|
-
}
|
|
143
|
-
export interface AuthModuleMiddlewareOptions {
|
|
144
|
-
register?: boolean;
|
|
145
|
-
includeRoutes?: (string | RouteInfo | Type)[];
|
|
146
|
-
excludeRoutes?: (string | RouteInfo)[];
|
|
147
|
-
}
|
|
148
|
-
export interface AuthModuleApiKeyOptions<Permission extends string = string> {
|
|
149
|
-
defaultPermissions?: readonly Permission[];
|
|
150
|
-
allowedPermissions?: readonly Permission[];
|
|
151
|
-
}
|
|
152
|
-
export interface AuthOAuthTokens {
|
|
153
|
-
tokenType?: string;
|
|
154
|
-
accessToken?: string;
|
|
155
|
-
refreshToken?: string;
|
|
156
|
-
accessTokenExpiresAt?: Date;
|
|
157
|
-
refreshTokenExpiresAt?: Date;
|
|
158
|
-
scopes?: string[];
|
|
159
|
-
idToken?: string;
|
|
160
|
-
raw?: Record<string, unknown>;
|
|
161
|
-
}
|
|
162
|
-
export interface AuthOAuthMappedUser {
|
|
163
|
-
id?: never;
|
|
164
|
-
name?: string;
|
|
165
|
-
email?: string | null;
|
|
166
|
-
image?: string;
|
|
167
|
-
emailVerified?: boolean;
|
|
168
|
-
[key: string]: unknown;
|
|
169
|
-
}
|
|
170
|
-
export interface AuthOAuthUserInfo {
|
|
171
|
-
id?: never;
|
|
172
|
-
name?: string;
|
|
173
|
-
email?: string | null;
|
|
174
|
-
image?: string;
|
|
175
|
-
emailVerified: boolean;
|
|
176
|
-
}
|
|
177
|
-
export interface AuthOAuthProfile {
|
|
178
|
-
id?: string | number | null;
|
|
179
|
-
sub?: string | number | null;
|
|
180
|
-
[key: string]: unknown;
|
|
181
|
-
}
|
|
182
|
-
export interface AuthOAuthRefreshContext {
|
|
183
|
-
headers?: Headers;
|
|
184
|
-
request?: Request;
|
|
185
|
-
}
|
|
186
|
-
export interface AuthOAuthClientAssertionContext {
|
|
187
|
-
clientId: string;
|
|
188
|
-
tokenEndpoint: string;
|
|
189
|
-
grantType: "authorization_code" | "refresh_token" | "client_credentials";
|
|
190
|
-
}
|
|
191
|
-
export interface AuthOAuthTokenRequestContext {
|
|
192
|
-
body: URLSearchParams;
|
|
193
|
-
headers: Record<string, string>;
|
|
194
|
-
options: AuthOAuthTokenRequestClientOptions;
|
|
195
|
-
tokenEndpoint: string;
|
|
196
|
-
grantType: AuthOAuthClientAssertionContext["grantType"];
|
|
197
|
-
}
|
|
198
|
-
export interface AuthOAuthTokenRequestClientOptions {
|
|
199
|
-
clientId?: string | string[];
|
|
200
|
-
clientSecret?: string;
|
|
201
|
-
}
|
|
202
|
-
export interface AuthOAuthNoTokenEndpointAuth {
|
|
203
|
-
method: "none";
|
|
204
|
-
}
|
|
205
|
-
export interface AuthOAuthBasicTokenEndpointAuth {
|
|
206
|
-
method: "client_secret_basic";
|
|
207
|
-
}
|
|
208
|
-
export interface AuthOAuthPostTokenEndpointAuth {
|
|
209
|
-
method: "client_secret_post";
|
|
210
|
-
}
|
|
211
|
-
export interface AuthOAuthPrivateKeyJwtTokenEndpointAuth {
|
|
212
|
-
method: "private_key_jwt";
|
|
213
|
-
getClientAssertion: (context: AuthOAuthClientAssertionContext) => AuthMaybePromise<string>;
|
|
214
|
-
}
|
|
215
|
-
export interface AuthOAuthCustomTokenEndpointAuth {
|
|
216
|
-
method: "custom";
|
|
217
|
-
customizeRequest: (context: AuthOAuthTokenRequestContext) => void | Promise<void>;
|
|
218
|
-
}
|
|
219
|
-
export type AuthOAuthTokenEndpointAuth = AuthOAuthNoTokenEndpointAuth | AuthOAuthBasicTokenEndpointAuth | AuthOAuthPostTokenEndpointAuth | AuthOAuthPrivateKeyJwtTokenEndpointAuth | AuthOAuthCustomTokenEndpointAuth;
|
|
220
|
-
export interface AuthSocialProviderUserInfo {
|
|
221
|
-
user: AuthOAuthUserInfo;
|
|
222
|
-
data: Record<string, unknown>;
|
|
223
|
-
}
|
|
224
|
-
export type AuthModuleSocialProviderId = "apple" | "atlassian" | "cognito" | "discord" | "dropbox" | "facebook" | "figma" | "github" | "gitlab" | "google" | "huggingface" | "kakao" | "kick" | "line" | "linear" | "linkedin" | "microsoft" | "naver" | "notion" | "paybin" | "paypal" | "polar" | "railway" | "reddit" | "roblox" | "salesforce" | "slack" | "spotify" | "tiktok" | "twitch" | "twitter" | "vercel" | "vk" | "wechat" | "zoom";
|
|
225
|
-
export interface AuthModuleSocialProvider {
|
|
226
|
-
id: AuthModuleSocialProviderId;
|
|
227
|
-
clientId?: string | string[];
|
|
228
|
-
clientSecret?: string;
|
|
229
|
-
scope?: string[];
|
|
230
|
-
disableDefaultScope?: boolean;
|
|
231
|
-
redirectURI?: string;
|
|
232
|
-
authorizationEndpoint?: string;
|
|
233
|
-
clientKey?: string;
|
|
234
|
-
disableIdTokenSignIn?: boolean;
|
|
235
|
-
verifyIdToken?: (token: string, nonce?: string, context?: unknown) => Promise<boolean>;
|
|
236
|
-
getUserInfo?: (tokens: AuthOAuthTokens) => Promise<AuthSocialProviderUserInfo | null>;
|
|
237
|
-
refreshAccessToken?: (refreshToken: string) => Promise<AuthOAuthTokens>;
|
|
238
|
-
mapProfileToUser?: (profile: Record<string, unknown>) => AuthMaybePromise<AuthOAuthMappedUser>;
|
|
239
|
-
disableImplicitSignUp?: boolean;
|
|
240
|
-
disableSignUp?: boolean;
|
|
241
|
-
prompt?: "select_account" | "consent" | "login" | "none" | "select_account consent";
|
|
242
|
-
responseMode?: "query" | "form_post";
|
|
243
|
-
overrideUserInfoOnSignIn?: boolean;
|
|
244
|
-
requireEmailVerification?: boolean;
|
|
245
|
-
enabled?: boolean;
|
|
246
|
-
appBundleIdentifier?: string;
|
|
247
|
-
audience?: string | string[];
|
|
248
|
-
domain?: string;
|
|
249
|
-
region?: string;
|
|
250
|
-
userPoolId?: string;
|
|
251
|
-
requireClientSecret?: boolean;
|
|
252
|
-
identityProvider?: string;
|
|
253
|
-
permissions?: number;
|
|
254
|
-
accessType?: "offline" | "online" | "legacy";
|
|
255
|
-
fields?: string[];
|
|
256
|
-
configId?: string;
|
|
257
|
-
issuer?: string;
|
|
258
|
-
display?: "page" | "popup" | "touch" | "wap";
|
|
259
|
-
hd?: string;
|
|
260
|
-
includeGrantedScopes?: boolean;
|
|
261
|
-
tenantId?: string;
|
|
262
|
-
authority?: string;
|
|
263
|
-
clientAssertion?: (context: AuthOAuthClientAssertionContext) => AuthMaybePromise<string>;
|
|
264
|
-
profilePhotoSize?: 48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648;
|
|
265
|
-
disableProfilePhoto?: boolean;
|
|
266
|
-
environment?: "sandbox" | "live" | "production";
|
|
267
|
-
requestShippingAddress?: boolean;
|
|
268
|
-
duration?: string;
|
|
269
|
-
loginUrl?: string;
|
|
270
|
-
claims?: string[];
|
|
271
|
-
scheme?: "light" | "dark";
|
|
272
|
-
platformType?: "WebsiteApp";
|
|
273
|
-
lang?: "cn" | "en";
|
|
274
|
-
pkce?: boolean;
|
|
275
|
-
tokenEndpointAuthMethod?: "client_secret_basic" | "client_secret_post" | "none";
|
|
276
|
-
}
|
|
277
|
-
export interface AuthModuleOAuthProvider {
|
|
278
|
-
id: string;
|
|
279
|
-
name?: string;
|
|
280
|
-
accountSubject?: (context: {
|
|
281
|
-
tokens: AuthOAuthTokens;
|
|
282
|
-
profile: AuthOAuthProfile;
|
|
283
|
-
}) => AuthMaybePromise<string | number>;
|
|
284
|
-
discoveryUrl?: string;
|
|
285
|
-
requireIdTokenVerification?: boolean;
|
|
286
|
-
authorizationUrl?: string;
|
|
287
|
-
tokenUrl?: string;
|
|
288
|
-
userInfoUrl?: string;
|
|
289
|
-
endSessionEndpoint?: string;
|
|
290
|
-
postLogoutRedirectURI?: string;
|
|
291
|
-
disableProviderLogout?: boolean;
|
|
292
|
-
clientId: string;
|
|
293
|
-
clientSecret?: string;
|
|
294
|
-
tokenEndpointAuth?: AuthOAuthTokenEndpointAuth;
|
|
295
|
-
scopes?: string[];
|
|
296
|
-
redirectURI?: string;
|
|
297
|
-
responseType?: string;
|
|
298
|
-
responseMode?: "query" | "form_post";
|
|
299
|
-
prompt?: "none" | "login" | "create" | "consent" | "select_account" | "select_account consent" | "login consent";
|
|
300
|
-
pkce?: boolean;
|
|
301
|
-
accessType?: string;
|
|
302
|
-
accessTokenExpiresIn?: number;
|
|
303
|
-
getToken?: (data: {
|
|
304
|
-
code: string;
|
|
305
|
-
redirectURI: string;
|
|
306
|
-
codeVerifier?: string;
|
|
307
|
-
deviceId?: string;
|
|
308
|
-
}) => Promise<AuthOAuthTokens>;
|
|
309
|
-
getUserInfo?: (tokens: AuthOAuthTokens) => Promise<AuthOAuthProfile | null>;
|
|
310
|
-
mapProfileToUser?: (profile: AuthOAuthProfile) => AuthMaybePromise<AuthOAuthMappedUser>;
|
|
311
|
-
authorizationUrlParams?: Record<string, string>;
|
|
312
|
-
tokenUrlParams?: Record<string, string>;
|
|
313
|
-
refreshTokenParams?: Record<string, string> | ((context?: AuthOAuthRefreshContext) => AuthMaybePromise<Record<string, string> | undefined>);
|
|
314
|
-
disableImplicitSignUp?: boolean;
|
|
315
|
-
disableSignUp?: boolean;
|
|
316
|
-
authentication?: "basic" | "post";
|
|
317
|
-
discoveryHeaders?: Record<string, string>;
|
|
318
|
-
authorizationHeaders?: Record<string, string>;
|
|
319
|
-
overrideUserInfo?: boolean;
|
|
320
|
-
requireEmailVerification?: boolean;
|
|
321
|
-
allowIdpInitiated?: boolean;
|
|
322
|
-
disableIdTokenNonceBinding?: boolean;
|
|
323
|
-
}
|
|
324
|
-
export type AuthModuleProvider = AuthModuleSocialProvider | AuthModuleOAuthProvider;
|
|
325
|
-
export interface AuthModuleOptions<UserPermission extends string = string, WorkspacePermission extends string = string, User extends BaseUser = BaseUser, Workspace extends BaseWorkspace = BaseWorkspace> {
|
|
1
|
+
import type { AuthModuleAccountOptions } from "./interfaces/auth-module-account-options.interface.js";
|
|
2
|
+
import type { AuthModuleApiKeyOptions } from "./interfaces/auth-module-api-key-options.interface.js";
|
|
3
|
+
import type { AuthModuleEmailAndPasswordOptions } from "./interfaces/auth-module-email-and-password-options.interface.js";
|
|
4
|
+
import type { AuthModuleEmailVerificationOptions } from "./interfaces/auth-module-email-verification-options.interface.js";
|
|
5
|
+
import type { AuthModuleMiddlewareOptions } from "./interfaces/auth-module-middleware-options.interface.js";
|
|
6
|
+
import type { AuthModuleSessionOptions } from "./interfaces/auth-module-session-options.interface.js";
|
|
7
|
+
import type { AuthModuleUserOptions } from "./interfaces/auth-module-user-options.interface.js";
|
|
8
|
+
import type { AuthModuleWorkspaceOptions } from "./interfaces/auth-module-workspace-options.interface.js";
|
|
9
|
+
import type { AuthMaybePromise } from "./types/auth-maybe-promise.type.js";
|
|
10
|
+
import type { AuthModuleProvider } from "./types/auth-module-provider.type.js";
|
|
11
|
+
import type { DEFAULT_USER_PERMISSIONS, DEFAULT_USER_ROLES } from "./user.constants.js";
|
|
12
|
+
import type { DEFAULT_WORKSPACE_PERMISSIONS, DEFAULT_WORKSPACE_ROLES } from "./workspace.constants.js";
|
|
13
|
+
/** Configuration options for the AuthModule. */
|
|
14
|
+
export interface AuthModuleOptions<UserPermission extends string = string, WorkspacePermission extends string = string, UserRole extends string = string, WorkspaceRole extends string = string> {
|
|
15
|
+
/** Application name used by authentication flows. */
|
|
326
16
|
appName?: string;
|
|
17
|
+
/** Public application URL used to construct authentication callbacks. */
|
|
327
18
|
baseURL?: string;
|
|
19
|
+
/** Base path for the auth API endpoints. */
|
|
328
20
|
basePath?: string;
|
|
21
|
+
/** Secret used for authentication signing and encryption. */
|
|
329
22
|
secret?: string;
|
|
23
|
+
/** Origins permitted to initiate browser authentication requests. */
|
|
330
24
|
trustedOrigins?: string[] | ((request?: Request) => AuthMaybePromise<(string | null | undefined)[]>);
|
|
25
|
+
/** OAuth account persistence and state-validation options. */
|
|
331
26
|
account?: AuthModuleAccountOptions;
|
|
27
|
+
/** Session lifecycle and Cookie cache options. */
|
|
332
28
|
session?: AuthModuleSessionOptions;
|
|
29
|
+
/** Email and password authentication options. */
|
|
333
30
|
emailAndPassword?: AuthModuleEmailAndPasswordOptions;
|
|
334
|
-
|
|
31
|
+
/** User lifecycle, roles, permissions, and authorization ability. */
|
|
32
|
+
user?: AuthModuleUserOptions<UserPermission | (typeof DEFAULT_USER_PERMISSIONS)[number], UserRole | keyof typeof DEFAULT_USER_ROLES>;
|
|
33
|
+
/** Email verification delivery and lifecycle options. */
|
|
335
34
|
emailVerification?: AuthModuleEmailVerificationOptions;
|
|
336
|
-
|
|
337
|
-
|
|
35
|
+
/** Workspace lifecycle and invitation-delivery options. */
|
|
36
|
+
workspace?: AuthModuleWorkspaceOptions<WorkspacePermission | (typeof DEFAULT_WORKSPACE_PERMISSIONS)[number], WorkspaceRole | keyof typeof DEFAULT_WORKSPACE_ROLES>;
|
|
37
|
+
/** API-key permission defaults and grant limits. */
|
|
38
|
+
apiKey?: AuthModuleApiKeyOptions<NoInfer<UserPermission | WorkspacePermission | (typeof DEFAULT_USER_PERMISSIONS)[number] | (typeof DEFAULT_WORKSPACE_PERMISSIONS)[number]>>;
|
|
39
|
+
/** Built-in social and custom OAuth providers, identified by `id`. */
|
|
338
40
|
providers?: readonly AuthModuleProvider[];
|
|
339
|
-
|
|
340
|
-
user: EntityClass<User>;
|
|
341
|
-
account: EntityClass<BaseAccount>;
|
|
342
|
-
session: EntityClass<BaseSession>;
|
|
343
|
-
verification: EntityClass<BaseVerification>;
|
|
344
|
-
workspace: EntityClass<Workspace>;
|
|
345
|
-
workspaceInvitation: EntityClass<BaseWorkspaceInvitation>;
|
|
346
|
-
workspaceMember: EntityClass<BaseWorkspaceMember>;
|
|
347
|
-
apiKey: EntityClass<BaseApiKey>;
|
|
348
|
-
};
|
|
41
|
+
/** Middleware registration options. */
|
|
349
42
|
middleware?: AuthModuleMiddlewareOptions;
|
|
350
43
|
}
|
package/dist/auth.constants.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
/** @internal Injection token for the private better-auth instance. */
|
|
1
2
|
export declare const AUTH_TOKEN: unique symbol;
|
|
3
|
+
/** Metadata key used by the {@link Public} decorator to mark public routes. */
|
|
2
4
|
export declare const IS_PUBLIC_KEY: unique symbol;
|
|
5
|
+
/** Request-context token for the authenticated API credential. */
|
|
6
|
+
export declare const API_KEY: unique symbol;
|
package/dist/auth.constants.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/** @internal Injection token for the private better-auth instance. */
|
|
1
2
|
export const AUTH_TOKEN = Symbol("AUTH");
|
|
3
|
+
/** Metadata key used by the {@link Public} decorator to mark public routes. */
|
|
2
4
|
export const IS_PUBLIC_KEY = Symbol("IS_PUBLIC_KEY");
|
|
5
|
+
/** Request-context token for the authenticated API credential. */
|
|
6
|
+
export const API_KEY = Symbol("API_KEY");
|
|
3
7
|
//# sourceMappingURL=auth.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.constants.js","sourceRoot":"","sources":["../src/auth.constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.constants.js","sourceRoot":"","sources":["../src/auth.constants.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAEzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAErD,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/auth.guard.d.ts
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
1
|
import type { CanActivate, ExecutionContext } from "@nestjs/common";
|
|
2
2
|
import { ModuleRef, Reflector } from "@nestjs/core";
|
|
3
3
|
import type { AuthModuleOptions } from "./auth-module-options.interface.js";
|
|
4
|
+
import { AccessControlService } from "./services/access-control.service.js";
|
|
5
|
+
/** Guard that enforces authentication and evaluates route permissions. */
|
|
4
6
|
export declare class AuthGuard implements CanActivate {
|
|
5
7
|
protected readonly reflector: Reflector;
|
|
6
8
|
private readonly options;
|
|
7
9
|
private readonly moduleRef;
|
|
8
|
-
|
|
10
|
+
private readonly accessControlService;
|
|
11
|
+
/** Rebuilds abilities after an explicit sign-in changes the request identity. */
|
|
12
|
+
refreshAbilities(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Creates the authentication and permission guard.
|
|
15
|
+
*
|
|
16
|
+
* @param reflector - Nest metadata reflector.
|
|
17
|
+
* @param options - Auth module options.
|
|
18
|
+
* @param moduleRef - Nest module reference used to resolve handler instances.
|
|
19
|
+
* @param accessControlService - Shared fail-closed operation authorization.
|
|
20
|
+
*/
|
|
21
|
+
constructor(reflector: Reflector, options: AuthModuleOptions, moduleRef: ModuleRef, accessControlService: AccessControlService);
|
|
22
|
+
/**
|
|
23
|
+
* Determines whether the current route is marked as public.
|
|
24
|
+
*
|
|
25
|
+
* @param context - Current Nest execution context.
|
|
26
|
+
* @returns `true` when session authentication should be skipped.
|
|
27
|
+
*/
|
|
9
28
|
protected isPublic(context: ExecutionContext): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether the request has an authenticated session.
|
|
31
|
+
*
|
|
32
|
+
* @returns `true` when the request is authenticated.
|
|
33
|
+
*/
|
|
10
34
|
protected isAuthenticated(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Checks authentication and route permission metadata.
|
|
37
|
+
*
|
|
38
|
+
* @param context - Current Nest execution context.
|
|
39
|
+
* @returns `true` when access is allowed.
|
|
40
|
+
*/
|
|
11
41
|
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
12
42
|
private checkPermissions;
|
|
13
43
|
private checkUserPermission;
|
|
14
44
|
private checkWorkspacePermission;
|
|
15
|
-
private isWorkspaceApiKey;
|
|
16
|
-
private getOrBuildUserAbility;
|
|
17
|
-
private getOrBuildWorkspaceAbility;
|
|
18
|
-
private buildAndCacheUserAbility;
|
|
19
|
-
private buildAndCacheWorkspaceAbility;
|
|
20
|
-
private intersectApiKeyPermissions;
|
|
21
|
-
private resolveUserPermissions;
|
|
22
|
-
private resolveWorkspacePermissions;
|
|
23
45
|
private resolveSubject;
|
|
24
46
|
private isSubjectType;
|
|
25
47
|
private resolveProvider;
|
package/dist/auth.guard.js
CHANGED
|
@@ -10,53 +10,79 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
-
import { AbilityBuilder } from "@casl/ability";
|
|
14
|
-
import { Reference } from "@mikro-orm/core";
|
|
15
13
|
import { RequestContext } from "@nest-boot/request-context";
|
|
16
|
-
import {
|
|
14
|
+
import { Inject, Injectable, UnauthorizedException } from "@nestjs/common";
|
|
17
15
|
import { ContextIdFactory, ModuleRef, Reflector } from "@nestjs/core";
|
|
18
|
-
import { UserAbility } from "./abilities/user.ability.js";
|
|
19
|
-
import { WorkspaceAbility } from "./abilities/workspace.ability.js";
|
|
20
16
|
import { IS_PUBLIC_KEY } from "./auth.constants.js";
|
|
21
17
|
import { MODULE_OPTIONS_TOKEN } from "./auth.module-definition.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { BaseUser } from "./entities/user.entity.js";
|
|
18
|
+
import { Session } from "./entities/session.entity.js";
|
|
19
|
+
import { RequestIdentity } from "./infrastructure/request-identity.js";
|
|
25
20
|
import { CUSTOM_ROUTE_ARGS_METADATA, GQL_PARAM_TYPES, ROUTE_ARGS_METADATA, ROUTE_PARAM_TYPES, USER_CAN_METADATA, WORKSPACE_CAN_METADATA, } from "./permission.constants.js";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
21
|
+
import { AccessControlService } from "./services/access-control.service.js";
|
|
22
|
+
import { getCurrentApiKey } from "./utils/get-current-api-key.util.js";
|
|
23
|
+
/** Guard that enforces authentication and evaluates route permissions. */
|
|
29
24
|
let AuthGuard = class AuthGuard {
|
|
30
25
|
reflector;
|
|
31
26
|
options;
|
|
32
27
|
moduleRef;
|
|
33
|
-
|
|
28
|
+
accessControlService;
|
|
29
|
+
/** Rebuilds abilities after an explicit sign-in changes the request identity. */
|
|
30
|
+
refreshAbilities() {
|
|
31
|
+
RequestIdentity.refresh(this.options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates the authentication and permission guard.
|
|
35
|
+
*
|
|
36
|
+
* @param reflector - Nest metadata reflector.
|
|
37
|
+
* @param options - Auth module options.
|
|
38
|
+
* @param moduleRef - Nest module reference used to resolve handler instances.
|
|
39
|
+
* @param accessControlService - Shared fail-closed operation authorization.
|
|
40
|
+
*/
|
|
41
|
+
constructor(reflector, options, moduleRef, accessControlService) {
|
|
34
42
|
this.reflector = reflector;
|
|
35
43
|
this.options = options;
|
|
36
44
|
this.moduleRef = moduleRef;
|
|
37
|
-
|
|
45
|
+
this.accessControlService = accessControlService;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Determines whether the current route is marked as public.
|
|
49
|
+
*
|
|
50
|
+
* @param context - Current Nest execution context.
|
|
51
|
+
* @returns `true` when session authentication should be skipped.
|
|
52
|
+
*/
|
|
38
53
|
isPublic(context) {
|
|
39
54
|
return !!this.reflector.getAllAndOverride(IS_PUBLIC_KEY, [
|
|
40
55
|
context.getHandler(),
|
|
41
56
|
context.getClass(),
|
|
42
57
|
]);
|
|
43
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Determines whether the request has an authenticated session.
|
|
61
|
+
*
|
|
62
|
+
* @returns `true` when the request is authenticated.
|
|
63
|
+
*/
|
|
44
64
|
isAuthenticated() {
|
|
45
65
|
try {
|
|
46
|
-
return
|
|
66
|
+
return !!RequestContext.get(Session) || !!getCurrentApiKey();
|
|
47
67
|
}
|
|
48
68
|
catch {
|
|
49
69
|
return false;
|
|
50
70
|
}
|
|
51
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Checks authentication and route permission metadata.
|
|
74
|
+
*
|
|
75
|
+
* @param context - Current Nest execution context.
|
|
76
|
+
* @returns `true` when access is allowed.
|
|
77
|
+
*/
|
|
52
78
|
async canActivate(context) {
|
|
53
79
|
const authenticated = this.isAuthenticated();
|
|
54
80
|
if (!this.isPublic(context) && !authenticated) {
|
|
55
81
|
throw new UnauthorizedException("Authentication is required");
|
|
56
82
|
}
|
|
57
|
-
if (
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
83
|
+
if (RequestContext.isActive()) {
|
|
84
|
+
RequestContext.set(AccessControlService, this.accessControlService);
|
|
85
|
+
RequestIdentity.prepare(this.options);
|
|
60
86
|
}
|
|
61
87
|
const targets = [context.getHandler(), context.getClass()];
|
|
62
88
|
const userCanMetadata = this.reflector.getAllAndMerge(USER_CAN_METADATA, targets);
|
|
@@ -80,100 +106,16 @@ let AuthGuard = class AuthGuard {
|
|
|
80
106
|
return true;
|
|
81
107
|
}
|
|
82
108
|
async checkUserPermission(canOptions, context) {
|
|
83
|
-
|
|
84
|
-
if (apiKey && this.isWorkspaceApiKey(apiKey)) {
|
|
109
|
+
if (!this.accessControlService.getUserAbility())
|
|
85
110
|
return false;
|
|
86
|
-
}
|
|
87
|
-
const ability = this.getOrBuildUserAbility();
|
|
88
111
|
const subject = await this.resolveSubject(canOptions, context);
|
|
89
|
-
|
|
90
|
-
throw new ForbiddenException("User permission ability is not available");
|
|
91
|
-
}
|
|
92
|
-
return ability.can(canOptions.action, subject);
|
|
112
|
+
return this.accessControlService.userCan(canOptions.action, subject);
|
|
93
113
|
}
|
|
94
114
|
async checkWorkspacePermission(canOptions, context) {
|
|
95
|
-
|
|
96
|
-
const workspaceApiKey = apiKey && this.isWorkspaceApiKey(apiKey);
|
|
97
|
-
if (apiKey &&
|
|
98
|
-
!workspaceApiKey &&
|
|
99
|
-
!RequestContext.get(BaseWorkspaceMember)) {
|
|
115
|
+
if (!this.accessControlService.getWorkspaceAbility())
|
|
100
116
|
return false;
|
|
101
|
-
}
|
|
102
|
-
const ability = this.getOrBuildWorkspaceAbility();
|
|
103
117
|
const subject = await this.resolveSubject(canOptions, context);
|
|
104
|
-
|
|
105
|
-
throw new ForbiddenException("Workspace permission ability is not available");
|
|
106
|
-
}
|
|
107
|
-
return ability.can(canOptions.action, subject);
|
|
108
|
-
}
|
|
109
|
-
isWorkspaceApiKey(apiKey) {
|
|
110
|
-
const owner = Reference.unwrapReference(apiKey.owner);
|
|
111
|
-
return owner instanceof this.options.entities.workspace;
|
|
112
|
-
}
|
|
113
|
-
getOrBuildUserAbility() {
|
|
114
|
-
const cachedAbility = RequestContext.get(UserAbility) ?? null;
|
|
115
|
-
if (cachedAbility) {
|
|
116
|
-
return cachedAbility;
|
|
117
|
-
}
|
|
118
|
-
return this.buildAndCacheUserAbility();
|
|
119
|
-
}
|
|
120
|
-
getOrBuildWorkspaceAbility() {
|
|
121
|
-
const cachedAbility = RequestContext.get(WorkspaceAbility) ?? null;
|
|
122
|
-
if (cachedAbility) {
|
|
123
|
-
return cachedAbility;
|
|
124
|
-
}
|
|
125
|
-
return this.buildAndCacheWorkspaceAbility();
|
|
126
|
-
}
|
|
127
|
-
buildAndCacheUserAbility() {
|
|
128
|
-
const buildAbility = this.options.user?.buildAbility;
|
|
129
|
-
const user = RequestContext.get(BaseUser);
|
|
130
|
-
if (!buildAbility || !user)
|
|
131
|
-
return null;
|
|
132
|
-
const builder = new AbilityBuilder(UserAbility);
|
|
133
|
-
const roles = this.options.user?.roles ?? DEFAULT_USER_ROLES;
|
|
134
|
-
const permissions = this.intersectApiKeyPermissions(this.resolveUserPermissions(roles));
|
|
135
|
-
const ability = buildAbility(builder, permissions, user);
|
|
136
|
-
RequestContext.set(UserAbility, ability);
|
|
137
|
-
return ability;
|
|
138
|
-
}
|
|
139
|
-
buildAndCacheWorkspaceAbility() {
|
|
140
|
-
const buildAbility = this.options.workspace?.buildAbility;
|
|
141
|
-
const workspace = RequestContext.get(BaseWorkspace);
|
|
142
|
-
const member = RequestContext.get(BaseWorkspaceMember);
|
|
143
|
-
const apiKey = RequestContext.get(BaseApiKey);
|
|
144
|
-
const workspaceApiKey = apiKey && this.isWorkspaceApiKey(apiKey);
|
|
145
|
-
if (!buildAbility || !workspace || (!member && !workspaceApiKey)) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
const builder = new AbilityBuilder(WorkspaceAbility);
|
|
149
|
-
const roles = this.options.workspace?.roles ?? DEFAULT_WORKSPACE_ROLES;
|
|
150
|
-
const permissions = workspaceApiKey
|
|
151
|
-
? apiKey.permissions
|
|
152
|
-
: this.intersectApiKeyPermissions(this.resolveWorkspacePermissions(roles));
|
|
153
|
-
const ability = buildAbility(builder, permissions, workspace);
|
|
154
|
-
RequestContext.set(WorkspaceAbility, ability);
|
|
155
|
-
return ability;
|
|
156
|
-
}
|
|
157
|
-
intersectApiKeyPermissions(permissions) {
|
|
158
|
-
const apiKey = RequestContext.get(BaseApiKey);
|
|
159
|
-
if (!apiKey)
|
|
160
|
-
return permissions;
|
|
161
|
-
const apiKeyPermissions = new Set(Array.isArray(apiKey.permissions) ? apiKey.permissions : []);
|
|
162
|
-
return permissions.filter((permission) => apiKeyPermissions.has(permission));
|
|
163
|
-
}
|
|
164
|
-
resolveUserPermissions(roles) {
|
|
165
|
-
const user = RequestContext.get(BaseUser);
|
|
166
|
-
if (!user)
|
|
167
|
-
return [];
|
|
168
|
-
return resolveAuthPermissions(user.roles ?? [this.options.user?.defaultRole ?? DEFAULT_USER_ROLE], user.permissions ?? [], roles);
|
|
169
|
-
}
|
|
170
|
-
resolveWorkspacePermissions(roles) {
|
|
171
|
-
const member = RequestContext.get(BaseWorkspaceMember);
|
|
172
|
-
if (!member)
|
|
173
|
-
return [];
|
|
174
|
-
return resolveAuthPermissions(member.roles ?? [
|
|
175
|
-
this.options.workspace?.defaultRole ?? DEFAULT_WORKSPACE_ROLE,
|
|
176
|
-
], member.permissions ?? [], roles);
|
|
118
|
+
return this.accessControlService.workspaceCan(canOptions.action, subject);
|
|
177
119
|
}
|
|
178
120
|
async resolveSubject(canOptions, context) {
|
|
179
121
|
const { subject } = canOptions;
|
|
@@ -322,7 +264,8 @@ let AuthGuard = class AuthGuard {
|
|
|
322
264
|
AuthGuard = __decorate([
|
|
323
265
|
Injectable(),
|
|
324
266
|
__param(1, Inject(MODULE_OPTIONS_TOKEN)),
|
|
325
|
-
__metadata("design:paramtypes", [Reflector, Object, ModuleRef
|
|
267
|
+
__metadata("design:paramtypes", [Reflector, Object, ModuleRef,
|
|
268
|
+
AccessControlService])
|
|
326
269
|
], AuthGuard);
|
|
327
270
|
export { AuthGuard };
|
|
328
271
|
//# sourceMappingURL=auth.guard.js.map
|