@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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { AuthMiddleware } from "../auth.middleware.js";
|
|
2
|
+
import { User } from "../entities/user.entity.js";
|
|
3
|
+
import type { AuthAccessToken } from "../interfaces/auth-access-token.interface.js";
|
|
4
|
+
import type { AuthAccount } from "../interfaces/auth-account.interface.js";
|
|
5
|
+
import type { AuthAccountInfo } from "../interfaces/auth-account-info.interface.js";
|
|
6
|
+
import type { AuthProviderUserInfo } from "../interfaces/auth-provider-user-info.interface.js";
|
|
7
|
+
import type { AuthRefreshedToken } from "../interfaces/auth-refreshed-token.interface.js";
|
|
8
|
+
import type { AuthSocialProvider } from "../interfaces/auth-social-provider.interface.js";
|
|
9
|
+
import type { ChangeAuthEmailOptions } from "../interfaces/change-auth-email-options.interface.js";
|
|
10
|
+
import type { ChangeAuthPasswordOptions } from "../interfaces/change-auth-password-options.interface.js";
|
|
11
|
+
import type { ChangeAuthPasswordResult } from "../interfaces/change-auth-password-result.interface.js";
|
|
12
|
+
import type { DeleteAuthUserOptions } from "../interfaces/delete-auth-user-options.interface.js";
|
|
13
|
+
import type { DeleteAuthUserResult } from "../interfaces/delete-auth-user-result.interface.js";
|
|
14
|
+
import type { LinkAuthSocialAccountOptions } from "../interfaces/link-auth-social-account-options.interface.js";
|
|
15
|
+
import type { LinkAuthSocialAccountResult } from "../interfaces/link-auth-social-account-result.interface.js";
|
|
16
|
+
import type { RequestPasswordResetOptions } from "../interfaces/request-password-reset-options.interface.js";
|
|
17
|
+
import type { RequestPasswordResetResult } from "../interfaces/request-password-reset-result.interface.js";
|
|
18
|
+
import type { ResetPasswordOptions } from "../interfaces/reset-password-options.interface.js";
|
|
19
|
+
import type { SendVerificationEmailOptions } from "../interfaces/send-verification-email-options.interface.js";
|
|
20
|
+
import type { SignInEntityResult } from "../interfaces/sign-in-entity-result.interface.js";
|
|
21
|
+
import type { SignInOptions } from "../interfaces/sign-in-options.interface.js";
|
|
22
|
+
import type { SignInResult } from "../interfaces/sign-in-result.interface.js";
|
|
23
|
+
import type { SignInSocialEntityResult } from "../interfaces/sign-in-social-entity-result.interface.js";
|
|
24
|
+
import type { SignInSocialOptions } from "../interfaces/sign-in-social-options.interface.js";
|
|
25
|
+
import type { SignInSocialResult } from "../interfaces/sign-in-social-result.interface.js";
|
|
26
|
+
import type { SignUpOptions } from "../interfaces/sign-up-options.interface.js";
|
|
27
|
+
import type { SignUpResult } from "../interfaces/sign-up-result.interface.js";
|
|
28
|
+
import type { UnlinkAuthAccountOptions } from "../interfaces/unlink-auth-account-options.interface.js";
|
|
29
|
+
import type { UpdateAuthUserOptions } from "../interfaces/update-auth-user-options.interface.js";
|
|
30
|
+
import type { SignUpPayload } from "../objects/sign-up-payload.object.js";
|
|
31
|
+
import type { AuthAccountSelector } from "../types/auth-account-selector.type.js";
|
|
32
|
+
import { SessionService } from "./session.service.js";
|
|
33
|
+
import { UserService } from "./user.service.js";
|
|
34
|
+
/** Application-facing user and account authentication operations. */
|
|
35
|
+
export declare class AuthService {
|
|
36
|
+
private readonly authMiddleware;
|
|
37
|
+
private readonly userService;
|
|
38
|
+
private readonly sessionService;
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new AuthService instance.
|
|
41
|
+
* @param auth - Internal Better Auth instance.
|
|
42
|
+
*/
|
|
43
|
+
constructor(auth: unknown, authMiddleware: AuthMiddleware, userService: UserService, sessionService: SessionService);
|
|
44
|
+
private readonly auth;
|
|
45
|
+
/** Starts impersonation and adopts its identity before returning application fields. */
|
|
46
|
+
impersonateUser(id: string): Promise<User>;
|
|
47
|
+
/** Restores the administrator and its abilities/RLS scope in the same request. */
|
|
48
|
+
stopImpersonating(): Promise<User | null>;
|
|
49
|
+
private adoptSession;
|
|
50
|
+
/** Registers a user without exposing relations that require a session. */
|
|
51
|
+
signUpPayload(options: SignUpOptions): Promise<SignUpPayload>;
|
|
52
|
+
/** Signs in and establishes the new identity for nested GraphQL selections. */
|
|
53
|
+
signInEntity(options: SignInOptions): Promise<SignInEntityResult>;
|
|
54
|
+
/** Returns a redirect payload or the authenticated application user. */
|
|
55
|
+
signInSocialEntity(options: SignInSocialOptions): Promise<SignInSocialEntityResult>;
|
|
56
|
+
private resolveResultUser;
|
|
57
|
+
/** Returns the current user, rejecting principals without a user identity. */
|
|
58
|
+
getCurrentUser(): User;
|
|
59
|
+
/** Lists social and generic OAuth providers currently enabled. */
|
|
60
|
+
listSocialProviders(): Promise<AuthSocialProvider[]>;
|
|
61
|
+
/** Signs up a user with an email address and password. */
|
|
62
|
+
signUp(options: SignUpOptions): Promise<SignUpResult>;
|
|
63
|
+
/** Signs in a user with an email address and password. */
|
|
64
|
+
signIn(options: SignInOptions): Promise<SignInResult>;
|
|
65
|
+
/** Starts a social or generic OAuth sign-in flow. */
|
|
66
|
+
signInSocial(options: SignInSocialOptions): Promise<SignInSocialResult>;
|
|
67
|
+
/** Signs out the session represented by the current request context. */
|
|
68
|
+
signOut(): Promise<boolean>;
|
|
69
|
+
/** Sends an email-verification link to an unverified email address. */
|
|
70
|
+
sendVerificationEmail(options: SendVerificationEmailOptions): Promise<boolean>;
|
|
71
|
+
/** Requests an enumeration-safe password-reset email. */
|
|
72
|
+
requestPasswordReset(options: RequestPasswordResetOptions): Promise<RequestPasswordResetResult>;
|
|
73
|
+
/** Resets a credential password using a password-reset token. */
|
|
74
|
+
resetPassword(options: ResetPasswordOptions): Promise<boolean>;
|
|
75
|
+
/** Verifies the authenticated user's credential password. */
|
|
76
|
+
verifyCurrentUserPassword(password: string): Promise<boolean>;
|
|
77
|
+
/** Updates the authenticated user's profile and refreshes its request identity. */
|
|
78
|
+
updateCurrentUser(options: UpdateAuthUserOptions): Promise<boolean>;
|
|
79
|
+
/** Starts or completes the authenticated user's configured email-change flow. */
|
|
80
|
+
changeCurrentUserEmail(options: ChangeAuthEmailOptions): Promise<boolean>;
|
|
81
|
+
/** Changes the authenticated user's credential password. */
|
|
82
|
+
changeCurrentUserPassword(options: ChangeAuthPasswordOptions): Promise<ChangeAuthPasswordResult>;
|
|
83
|
+
/** Adds a credential password to an authenticated account that has none. */
|
|
84
|
+
setCurrentUserPassword(newPassword: string): Promise<boolean>;
|
|
85
|
+
/** Requests deletion of the authenticated user's account. */
|
|
86
|
+
deleteCurrentUser(options?: DeleteAuthUserOptions): Promise<DeleteAuthUserResult>;
|
|
87
|
+
/** Lists safe summaries of authentication accounts linked to the current user. */
|
|
88
|
+
listCurrentUserAccounts(): Promise<AuthAccount[]>;
|
|
89
|
+
/** Starts a social or OpenID Connect account-linking flow. */
|
|
90
|
+
linkCurrentUserAccount(options: LinkAuthSocialAccountOptions): Promise<LinkAuthSocialAccountResult>;
|
|
91
|
+
/** Unlinks an authentication account from the current user. */
|
|
92
|
+
unlinkCurrentUserAccount(options: UnlinkAuthAccountOptions): Promise<boolean>;
|
|
93
|
+
/** Returns a usable provider access token for a linked account. */
|
|
94
|
+
getAccessToken(selector: AuthAccountSelector): Promise<AuthAccessToken>;
|
|
95
|
+
/** Refreshes provider credentials for a linked account. */
|
|
96
|
+
refreshToken(selector: AuthAccountSelector): Promise<AuthRefreshedToken>;
|
|
97
|
+
/** Returns provider identity and metadata for a linked account. */
|
|
98
|
+
getAccountInfo<UserInfo extends AuthProviderUserInfo = AuthProviderUserInfo, Data extends object = Record<string, unknown>>(selector: AuthAccountSelector): Promise<AuthAccountInfo<UserInfo, Data>>;
|
|
99
|
+
private normalizeSignInResult;
|
|
100
|
+
private normalizeSignInSocialResult;
|
|
101
|
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { headers, RequestContext } from "@nest-boot/request-context";
|
|
14
|
+
import { ForbiddenException, Inject, Injectable } from "@nestjs/common";
|
|
15
|
+
import { AUTH_TOKEN } from "../auth.constants.js";
|
|
16
|
+
import { AuthMiddleware } from "../auth.middleware.js";
|
|
17
|
+
import { Session } from "../entities/session.entity.js";
|
|
18
|
+
import { User } from "../entities/user.entity.js";
|
|
19
|
+
import { applyAuthResponseCookies } from "../utils/apply-auth-response-cookies.util.js";
|
|
20
|
+
import { SessionService } from "./session.service.js";
|
|
21
|
+
import { UserService } from "./user.service.js";
|
|
22
|
+
/** Application-facing user and account authentication operations. */
|
|
23
|
+
let AuthService = class AuthService {
|
|
24
|
+
authMiddleware;
|
|
25
|
+
userService;
|
|
26
|
+
sessionService;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new AuthService instance.
|
|
29
|
+
* @param auth - Internal Better Auth instance.
|
|
30
|
+
*/
|
|
31
|
+
constructor(auth, authMiddleware, userService, sessionService) {
|
|
32
|
+
this.authMiddleware = authMiddleware;
|
|
33
|
+
this.userService = userService;
|
|
34
|
+
this.sessionService = sessionService;
|
|
35
|
+
this.auth = auth;
|
|
36
|
+
}
|
|
37
|
+
auth;
|
|
38
|
+
/** Starts impersonation and adopts its identity before returning application fields. */
|
|
39
|
+
async impersonateUser(id) {
|
|
40
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
41
|
+
const result = await this.userService.impersonateUser(this.getCurrentUser(), id);
|
|
42
|
+
return await this.adoptSession(result.session.token);
|
|
43
|
+
}
|
|
44
|
+
/** Restores the administrator and its abilities/RLS scope in the same request. */
|
|
45
|
+
async stopImpersonating() {
|
|
46
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
47
|
+
const session = RequestContext.isActive()
|
|
48
|
+
? RequestContext.get(Session)
|
|
49
|
+
: null;
|
|
50
|
+
if (!session)
|
|
51
|
+
throw new ForbiddenException("A user session is required");
|
|
52
|
+
const result = await this.userService.stopImpersonating(session);
|
|
53
|
+
return result ? await this.adoptSession(result.session.token) : null;
|
|
54
|
+
}
|
|
55
|
+
async adoptSession(token) {
|
|
56
|
+
const user = await this.authMiddleware.authenticateSession(token);
|
|
57
|
+
await this.sessionService.setSessionCookie(token);
|
|
58
|
+
return user;
|
|
59
|
+
}
|
|
60
|
+
/** Registers a user without exposing relations that require a session. */
|
|
61
|
+
async signUpPayload(options) {
|
|
62
|
+
const result = await this.signUp(options);
|
|
63
|
+
if (result.token) {
|
|
64
|
+
await this.authMiddleware.authenticateSession(result.token);
|
|
65
|
+
}
|
|
66
|
+
return { id: result.user.id, token: result.token };
|
|
67
|
+
}
|
|
68
|
+
/** Signs in and establishes the new identity for nested GraphQL selections. */
|
|
69
|
+
async signInEntity(options) {
|
|
70
|
+
const result = await this.signIn(options);
|
|
71
|
+
return {
|
|
72
|
+
...result,
|
|
73
|
+
user: await this.resolveResultUser(result.user, result.token),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Returns a redirect payload or the authenticated application user. */
|
|
77
|
+
async signInSocialEntity(options) {
|
|
78
|
+
const result = await this.signInSocial(options);
|
|
79
|
+
return {
|
|
80
|
+
...result,
|
|
81
|
+
user: result.user
|
|
82
|
+
? await this.resolveResultUser(result.user, result.token)
|
|
83
|
+
: null,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async resolveResultUser(user, token) {
|
|
87
|
+
if (token) {
|
|
88
|
+
const entity = await this.authMiddleware.authenticateSession(token);
|
|
89
|
+
return entity;
|
|
90
|
+
}
|
|
91
|
+
// Registration without a session must not authenticate the request. Only
|
|
92
|
+
// load the exact user returned by the successful registration operation.
|
|
93
|
+
return await this.authMiddleware.resolveRegisteredUser(user.id);
|
|
94
|
+
}
|
|
95
|
+
/** Returns the current user, rejecting principals without a user identity. */
|
|
96
|
+
getCurrentUser() {
|
|
97
|
+
const user = RequestContext.isActive() ? RequestContext.get(User) : null;
|
|
98
|
+
if (!user)
|
|
99
|
+
throw new ForbiddenException("A user identity is required");
|
|
100
|
+
return user;
|
|
101
|
+
}
|
|
102
|
+
/** Lists social and generic OAuth providers currently enabled. */
|
|
103
|
+
async listSocialProviders() {
|
|
104
|
+
const context = await this.auth.$context;
|
|
105
|
+
return context.socialProviders.map(({ id, name }) => ({
|
|
106
|
+
id,
|
|
107
|
+
name,
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
/** Signs up a user with an email address and password. */
|
|
111
|
+
async signUp(options) {
|
|
112
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
113
|
+
const result = await this.auth.api.signUpEmail({
|
|
114
|
+
body: options,
|
|
115
|
+
headers: headers(),
|
|
116
|
+
returnHeaders: true,
|
|
117
|
+
});
|
|
118
|
+
applyAuthResponseCookies(result.headers);
|
|
119
|
+
return result.response;
|
|
120
|
+
}
|
|
121
|
+
/** Signs in a user with an email address and password. */
|
|
122
|
+
async signIn(options) {
|
|
123
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
124
|
+
const result = await this.auth.api.signInEmail({
|
|
125
|
+
body: options,
|
|
126
|
+
headers: headers(),
|
|
127
|
+
returnHeaders: true,
|
|
128
|
+
});
|
|
129
|
+
applyAuthResponseCookies(result.headers);
|
|
130
|
+
return this.normalizeSignInResult(result.response);
|
|
131
|
+
}
|
|
132
|
+
/** Starts a social or generic OAuth sign-in flow. */
|
|
133
|
+
async signInSocial(options) {
|
|
134
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
135
|
+
const result = await this.auth.api.signInSocial({
|
|
136
|
+
body: options,
|
|
137
|
+
headers: headers(),
|
|
138
|
+
returnHeaders: true,
|
|
139
|
+
});
|
|
140
|
+
applyAuthResponseCookies(result.headers);
|
|
141
|
+
return this.normalizeSignInSocialResult(result.response);
|
|
142
|
+
}
|
|
143
|
+
/** Signs out the session represented by the current request context. */
|
|
144
|
+
async signOut() {
|
|
145
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
146
|
+
const result = await this.auth.api.signOut({
|
|
147
|
+
headers: headers(),
|
|
148
|
+
returnHeaders: true,
|
|
149
|
+
});
|
|
150
|
+
if (result.response.success)
|
|
151
|
+
this.authMiddleware.clearAuthentication();
|
|
152
|
+
applyAuthResponseCookies(result.headers);
|
|
153
|
+
return result.response.success;
|
|
154
|
+
}
|
|
155
|
+
/** Sends an email-verification link to an unverified email address. */
|
|
156
|
+
async sendVerificationEmail(options) {
|
|
157
|
+
const result = await this.auth.api.sendVerificationEmail({ body: options });
|
|
158
|
+
return result.status;
|
|
159
|
+
}
|
|
160
|
+
/** Requests an enumeration-safe password-reset email. */
|
|
161
|
+
async requestPasswordReset(options) {
|
|
162
|
+
return await this.auth.api.requestPasswordReset({ body: options });
|
|
163
|
+
}
|
|
164
|
+
/** Resets a credential password using a password-reset token. */
|
|
165
|
+
async resetPassword(options) {
|
|
166
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
167
|
+
const result = await this.auth.api.resetPassword({ body: options });
|
|
168
|
+
if (result.status)
|
|
169
|
+
await this.authMiddleware.revalidateCurrentSession();
|
|
170
|
+
return result.status;
|
|
171
|
+
}
|
|
172
|
+
/** Verifies the authenticated user's credential password. */
|
|
173
|
+
async verifyCurrentUserPassword(password) {
|
|
174
|
+
const result = await this.auth.api.verifyPassword({
|
|
175
|
+
body: { password },
|
|
176
|
+
headers: headers(),
|
|
177
|
+
});
|
|
178
|
+
return result.status;
|
|
179
|
+
}
|
|
180
|
+
/** Updates the authenticated user's profile and refreshes its request identity. */
|
|
181
|
+
async updateCurrentUser(options) {
|
|
182
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
183
|
+
const result = await this.auth.api.updateUser({
|
|
184
|
+
body: options,
|
|
185
|
+
headers: headers(),
|
|
186
|
+
returnHeaders: true,
|
|
187
|
+
});
|
|
188
|
+
if (result.response.status)
|
|
189
|
+
await this.authMiddleware.refreshCurrentUser();
|
|
190
|
+
applyAuthResponseCookies(result.headers);
|
|
191
|
+
return result.response.status;
|
|
192
|
+
}
|
|
193
|
+
/** Starts or completes the authenticated user's configured email-change flow. */
|
|
194
|
+
async changeCurrentUserEmail(options) {
|
|
195
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
196
|
+
const result = await this.auth.api.changeEmail({
|
|
197
|
+
body: options,
|
|
198
|
+
headers: headers(),
|
|
199
|
+
returnHeaders: true,
|
|
200
|
+
});
|
|
201
|
+
// A successful response may only queue verification; reload persisted state.
|
|
202
|
+
if (result.response.status)
|
|
203
|
+
await this.authMiddleware.refreshCurrentUser();
|
|
204
|
+
applyAuthResponseCookies(result.headers);
|
|
205
|
+
return result.response.status;
|
|
206
|
+
}
|
|
207
|
+
/** Changes the authenticated user's credential password. */
|
|
208
|
+
async changeCurrentUserPassword(options) {
|
|
209
|
+
if (options.revokeOtherSessions)
|
|
210
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
211
|
+
const result = await this.auth.api.changePassword({
|
|
212
|
+
body: options,
|
|
213
|
+
headers: headers(),
|
|
214
|
+
returnHeaders: true,
|
|
215
|
+
});
|
|
216
|
+
if (result.response.token) {
|
|
217
|
+
try {
|
|
218
|
+
await this.authMiddleware.authenticateSession(result.response.token);
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
// Rotation already revoked the old session; never retain its identity.
|
|
222
|
+
this.authMiddleware.clearAuthentication();
|
|
223
|
+
throw error;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
applyAuthResponseCookies(result.headers);
|
|
227
|
+
return { token: result.response.token };
|
|
228
|
+
}
|
|
229
|
+
/** Adds a credential password to an authenticated account that has none. */
|
|
230
|
+
async setCurrentUserPassword(newPassword) {
|
|
231
|
+
const result = await this.auth.api.setPassword({
|
|
232
|
+
body: { newPassword },
|
|
233
|
+
headers: headers(),
|
|
234
|
+
});
|
|
235
|
+
return result.status;
|
|
236
|
+
}
|
|
237
|
+
/** Requests deletion of the authenticated user's account. */
|
|
238
|
+
async deleteCurrentUser(options) {
|
|
239
|
+
this.authMiddleware.assertAuthenticationCanChange();
|
|
240
|
+
const result = await this.auth.api.deleteUser({
|
|
241
|
+
body: options ?? {},
|
|
242
|
+
headers: headers(),
|
|
243
|
+
returnHeaders: true,
|
|
244
|
+
});
|
|
245
|
+
if (result.response.success && result.response.message === "User deleted") {
|
|
246
|
+
this.authMiddleware.clearAuthentication();
|
|
247
|
+
}
|
|
248
|
+
applyAuthResponseCookies(result.headers);
|
|
249
|
+
return result.response;
|
|
250
|
+
}
|
|
251
|
+
/** Lists safe summaries of authentication accounts linked to the current user. */
|
|
252
|
+
async listCurrentUserAccounts() {
|
|
253
|
+
return await this.auth.api.listUserAccounts({ headers: headers() });
|
|
254
|
+
}
|
|
255
|
+
/** Starts a social or OpenID Connect account-linking flow. */
|
|
256
|
+
async linkCurrentUserAccount(options) {
|
|
257
|
+
const result = await this.auth.api.linkSocialAccount({
|
|
258
|
+
body: options,
|
|
259
|
+
headers: headers(),
|
|
260
|
+
returnHeaders: true,
|
|
261
|
+
});
|
|
262
|
+
applyAuthResponseCookies(result.headers);
|
|
263
|
+
return result.response;
|
|
264
|
+
}
|
|
265
|
+
/** Unlinks an authentication account from the current user. */
|
|
266
|
+
async unlinkCurrentUserAccount(options) {
|
|
267
|
+
const result = await this.auth.api.unlinkAccount({
|
|
268
|
+
body: options,
|
|
269
|
+
headers: headers(),
|
|
270
|
+
});
|
|
271
|
+
return result.status;
|
|
272
|
+
}
|
|
273
|
+
/** Returns a usable provider access token for a linked account. */
|
|
274
|
+
async getAccessToken(selector) {
|
|
275
|
+
const result = await this.auth.api.getAccessToken({
|
|
276
|
+
body: selector,
|
|
277
|
+
headers: headers(),
|
|
278
|
+
});
|
|
279
|
+
return {
|
|
280
|
+
accessToken: result.accessToken,
|
|
281
|
+
accessTokenExpiresAt: result.accessTokenExpiresAt ?? null,
|
|
282
|
+
scopes: result.scopes,
|
|
283
|
+
idToken: result.idToken ?? null,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/** Refreshes provider credentials for a linked account. */
|
|
287
|
+
async refreshToken(selector) {
|
|
288
|
+
const result = await this.auth.api.refreshToken({
|
|
289
|
+
body: selector,
|
|
290
|
+
headers: headers(),
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
accessToken: result.accessToken ?? null,
|
|
294
|
+
refreshToken: result.refreshToken,
|
|
295
|
+
accessTokenExpiresAt: result.accessTokenExpiresAt ?? null,
|
|
296
|
+
refreshTokenExpiresAt: result.refreshTokenExpiresAt ?? null,
|
|
297
|
+
scope: result.scope ?? null,
|
|
298
|
+
idToken: result.idToken ?? null,
|
|
299
|
+
providerId: result.providerId,
|
|
300
|
+
accountId: result.accountId,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
/** Returns provider identity and metadata for a linked account. */
|
|
304
|
+
async getAccountInfo(selector) {
|
|
305
|
+
return (await this.auth.api.accountInfo({
|
|
306
|
+
query: selector,
|
|
307
|
+
headers: headers(),
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
normalizeSignInResult(result) {
|
|
311
|
+
return {
|
|
312
|
+
...result,
|
|
313
|
+
url: result.url ?? null,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
normalizeSignInSocialResult(result) {
|
|
317
|
+
return {
|
|
318
|
+
redirect: result.redirect,
|
|
319
|
+
url: result.url ?? null,
|
|
320
|
+
token: result.token ?? null,
|
|
321
|
+
user: result.user ?? null,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
AuthService = __decorate([
|
|
326
|
+
Injectable(),
|
|
327
|
+
__param(0, Inject(AUTH_TOKEN)),
|
|
328
|
+
__metadata("design:paramtypes", [Object, AuthMiddleware,
|
|
329
|
+
UserService,
|
|
330
|
+
SessionService])
|
|
331
|
+
], AuthService);
|
|
332
|
+
export { AuthService };
|
|
333
|
+
//# sourceMappingURL=auth.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AA+BlD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAwHhD,qEAAqE;AAE9D,IAAM,WAAW,GAAjB,MAAM,WAAW;IAOH;IACA;IACA;IARnB;;;OAGG;IACH,YACsB,IAAa,EAChB,cAA8B,EAC9B,WAAwB,EACxB,cAA8B;QAF9B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAAgB;QAE/C,IAAI,CAAC,IAAI,GAAG,IAAoB,CAAC;IACnC,CAAC;IAEgB,IAAI,CAAe;IAEpC,wFAAwF;IACxF,KAAK,CAAC,eAAe,CAAC,EAAU;QAC9B,IAAI,CAAC,cAAc,CAAC,6BAA6B,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CACnD,IAAI,CAAC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M,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;YACtC,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,OAAO,EAAE;SACnB,CAAC,CAAoC,CAAC;IACzC,CAAC;IAEO,qBAAqB,CAC3B,MAAoD;QAEpD,OAAO;YACL,GAAG,MAAM;YACT,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI;SACR,CAAC;IACpB,CAAC;IAEO,2BAA2B,CAAC,MAKnC;QACC,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;YAC3B,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI;SAC1B,CAAC;IACJ,CAAC;CACF,CAAA;AA5WY,WAAW;IADvB,UAAU,EAAE;IAOR,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;6CACc,cAAc;QACjB,WAAW;QACR,cAAc;GATtC,WAAW,CA4WvB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EntityManager } from "@mikro-orm/core";
|
|
2
|
+
import { type ConnectionArgsInterface, type ConnectionInterface } from "@nest-boot/graphql-connection";
|
|
3
|
+
import type { AuthModuleOptions } from "../auth-module-options.interface.js";
|
|
4
|
+
import { Invitation } from "../entities/invitation.entity.js";
|
|
5
|
+
import { User } from "../entities/user.entity.js";
|
|
6
|
+
import { Workspace } from "../entities/workspace.entity.js";
|
|
7
|
+
import type { AcceptInvitationResult } from "../interfaces/accept-invitation-result.interface.js";
|
|
8
|
+
import type { CreateInvitationOptions } from "../interfaces/create-invitation-options.interface.js";
|
|
9
|
+
import { AccessControlService } from "./access-control.service.js";
|
|
10
|
+
/** Workspace invitation queries and lifecycle operations. */
|
|
11
|
+
export declare class InvitationService {
|
|
12
|
+
/** MikroORM entity manager used for workspace persistence. */
|
|
13
|
+
protected readonly em: EntityManager;
|
|
14
|
+
private readonly authOptions;
|
|
15
|
+
private readonly accessControlService;
|
|
16
|
+
/** Creates a workspace invitation domain service. */
|
|
17
|
+
constructor(
|
|
18
|
+
/** MikroORM entity manager used for workspace persistence. */
|
|
19
|
+
em: EntityManager, authOptions: AuthModuleOptions, accessControlService: AccessControlService);
|
|
20
|
+
/** Creates a pending workspace invitation. */
|
|
21
|
+
createInvitation(workspace: Workspace, inviter: User, input: CreateInvitationOptions, request?: Request): Promise<Invitation>;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves only the login identity needed for invitation membership checks.
|
|
24
|
+
* Infrastructure isolates this lookup; invitation writes retain request RLS.
|
|
25
|
+
* An unregistered email is a valid invitation recipient.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
getUserIdForInvitation(workspace: Workspace, inviter: User, email: string): Promise<string | null>;
|
|
29
|
+
/** Finds an invitation after recipient or workspace authorization, preserving RLS. */
|
|
30
|
+
getInvitation(id: string): Promise<Invitation | null>;
|
|
31
|
+
/** Resolves the inviter through an authorized invitation without bypassing RLS. */
|
|
32
|
+
getInvitationInviter(invitation: Invitation): Promise<User>;
|
|
33
|
+
/** Resolves the workspace through an authorized invitation without requiring membership. */
|
|
34
|
+
getInvitationWorkspace(invitation: Invitation): Promise<Workspace>;
|
|
35
|
+
private getInvitationForRelation;
|
|
36
|
+
private assertInvitationReadAccess;
|
|
37
|
+
/** Finds an invitation when it is addressed to the supplied user. */
|
|
38
|
+
getInvitationByUser(id: string, user: User): Promise<Invitation | null>;
|
|
39
|
+
/** Finds an invitation owned by the supplied workspace. */
|
|
40
|
+
getInvitationByWorkspace(id: string, workspace: Workspace): Promise<Invitation | null>;
|
|
41
|
+
/** Paginates invitations for the selected workspace after authorization. */
|
|
42
|
+
getInvitationConnectionByWorkspace(workspace: Workspace, args: ConnectionArgsInterface<Invitation>): Promise<ConnectionInterface<Invitation>>;
|
|
43
|
+
/** Paginates unexpired pending invitations addressed to the current user. */
|
|
44
|
+
getInvitationConnectionByUser(user: User, args: ConnectionArgsInterface<Invitation>): Promise<ConnectionInterface<Invitation>>;
|
|
45
|
+
/** Accepts a pending invitation and creates an active membership. */
|
|
46
|
+
acceptInvitation(user: User, invitationId: string): Promise<AcceptInvitationResult | null>;
|
|
47
|
+
/** Cancels a pending invitation. */
|
|
48
|
+
cancelInvitation(invitation: Invitation | string): Promise<Invitation>;
|
|
49
|
+
/** Rejects an invitation after verifying the invited user's email. */
|
|
50
|
+
rejectInvitation(user: User, invitation: Invitation | string): Promise<Invitation>;
|
|
51
|
+
private resolveInvitationForAction;
|
|
52
|
+
private lockWorkspace;
|
|
53
|
+
private normalizeRoles;
|
|
54
|
+
private normalizeGrantedRoles;
|
|
55
|
+
private get roles();
|
|
56
|
+
private get defaultRole();
|
|
57
|
+
private unwrapInvitationWorkspace;
|
|
58
|
+
}
|