@nest-boot/auth 8.0.3-beta.1 → 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/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 +2 -1
- 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 +20 -6
- package/dist/auth.middleware.js +119 -48
- 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 +182 -12
- package/dist/index.js +181 -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 +6 -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 +1 -0
- package/dist/policies/create-scope-policy.js +2 -1
- package/dist/policies/create-scope-policy.js.map +1 -1
- package/dist/policies/user-scope.policy.d.ts +8 -0
- package/dist/policies/user-scope.policy.js +8 -0
- package/dist/policies/user-scope.policy.js.map +1 -1
- package/dist/policies/workspace-scope.policy.d.ts +8 -0
- package/dist/policies/workspace-scope.policy.js +8 -0
- package/dist/policies/workspace-scope.policy.js.map +1 -1
- 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 +4 -0
- package/dist/utils/run-auth-query.js +32 -2
- package/dist/utils/run-auth-query.js.map +1 -1
- 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 +36 -13
- 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 -332
- 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 -165
- package/dist/session.service.js.map +0 -1
- package/dist/user-deletion.service.d.ts +0 -19
- package/dist/user-deletion.service.js +0 -96
- package/dist/user-deletion.service.js.map +0 -1
- package/dist/user.service.d.ts +0 -54
- package/dist/user.service.js +0 -384
- package/dist/user.service.js.map +0 -1
- package/dist/workspace.service.d.ts +0 -59
- package/dist/workspace.service.js +0 -618
- package/dist/workspace.service.js.map +0 -1
|
@@ -0,0 +1,313 @@
|
|
|
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 { EntityManager, LockMode } from "@mikro-orm/core";
|
|
14
|
+
import { ConnectionManager, } from "@nest-boot/graphql-connection";
|
|
15
|
+
import { cookies, headers, RequestContext, } from "@nest-boot/request-context";
|
|
16
|
+
import { BadRequestException, Inject, Injectable, NotFoundException, } from "@nestjs/common";
|
|
17
|
+
import { makeSignature } from "better-auth/crypto";
|
|
18
|
+
import { AUTH_TOKEN } from "../auth.constants.js";
|
|
19
|
+
import { SessionConnection } from "../connections/session.connection-definition.js";
|
|
20
|
+
import { Session } from "../entities/session.entity.js";
|
|
21
|
+
import { User } from "../entities/user.entity.js";
|
|
22
|
+
import { RequestIdentity } from "../infrastructure/request-identity.js";
|
|
23
|
+
import { getCurrentApiKey } from "../utils/get-current-api-key.util.js";
|
|
24
|
+
import { AccessControlService } from "./access-control.service.js";
|
|
25
|
+
/** Application-facing session management operations. */
|
|
26
|
+
let SessionService = class SessionService {
|
|
27
|
+
em;
|
|
28
|
+
accessControlService;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new SessionService instance.
|
|
31
|
+
* @param auth - Internal Better Auth instance.
|
|
32
|
+
* @param em - Entity manager used to resolve application entities.
|
|
33
|
+
* @param accessControlService - Authorization for parent-scoped reads and administrative revocation.
|
|
34
|
+
*/
|
|
35
|
+
constructor(auth, em, accessControlService) {
|
|
36
|
+
this.em = em;
|
|
37
|
+
this.accessControlService = accessControlService;
|
|
38
|
+
this.auth = auth;
|
|
39
|
+
}
|
|
40
|
+
auth;
|
|
41
|
+
/** Paginates active sessions visible to the caller for the parent user. */
|
|
42
|
+
async getSessionConnectionByUser(user, args) {
|
|
43
|
+
this.assertCanListSessions(user);
|
|
44
|
+
const connection = await new ConnectionManager(this.em).find(SessionConnection, args, {
|
|
45
|
+
exclude: ["token"],
|
|
46
|
+
where: {
|
|
47
|
+
user: String(user.id),
|
|
48
|
+
expiresAt: { $gt: new Date() },
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
for (const { node } of connection.edges)
|
|
52
|
+
this.assertCanListSessions(user, node);
|
|
53
|
+
return connection;
|
|
54
|
+
}
|
|
55
|
+
/** Authorizes both the parent session and the impersonator's private profile. */
|
|
56
|
+
async getSessionImpersonator(session) {
|
|
57
|
+
this.assertCanListSessions({ id: session.user.id }, session);
|
|
58
|
+
if (!session.impersonatedBy)
|
|
59
|
+
return null;
|
|
60
|
+
const current = RequestContext.isActive() ? RequestContext.get(User) : null;
|
|
61
|
+
const self = current?.id === session.impersonatedBy.id;
|
|
62
|
+
if (!self)
|
|
63
|
+
this.accessControlService.assertUserCan("read", User);
|
|
64
|
+
const user = await this.em.findOne(User, {
|
|
65
|
+
id: String(session.impersonatedBy.id),
|
|
66
|
+
});
|
|
67
|
+
if (user && !self)
|
|
68
|
+
this.accessControlService.assertUserCan("read", user);
|
|
69
|
+
return user;
|
|
70
|
+
}
|
|
71
|
+
assertCanListSessions(user, session) {
|
|
72
|
+
const current = RequestContext.isActive()
|
|
73
|
+
? RequestContext.get(User)
|
|
74
|
+
: undefined;
|
|
75
|
+
const apiKey = RequestContext.isActive() ? getCurrentApiKey() : undefined;
|
|
76
|
+
if (!current || String(current.id) !== String(user.id) || apiKey) {
|
|
77
|
+
this.accessControlService.assertUserCan("list", session ?? Session);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Revokes one session by ID when it belongs to the supplied user. */
|
|
81
|
+
async revokeSession(user, id) {
|
|
82
|
+
user = await this.resolveUserForRevocation(user);
|
|
83
|
+
this.accessControlService.assertUserCan("revoke", Session);
|
|
84
|
+
const current = RequestContext.isActive()
|
|
85
|
+
? RequestContext.get(Session)
|
|
86
|
+
: null;
|
|
87
|
+
const revokesCurrent = current?.id === id;
|
|
88
|
+
if (revokesCurrent)
|
|
89
|
+
this.assertRevocationCanCommit();
|
|
90
|
+
const revoked = await this.em.transactional(async (em) => {
|
|
91
|
+
const session = await em.findOne(Session, {
|
|
92
|
+
id,
|
|
93
|
+
user: String(user.id),
|
|
94
|
+
}, { filters: false, lockMode: LockMode.PESSIMISTIC_WRITE });
|
|
95
|
+
if (!session)
|
|
96
|
+
return false;
|
|
97
|
+
this.accessControlService.assertUserCan("revoke", session);
|
|
98
|
+
await em.remove(session).flush();
|
|
99
|
+
return true;
|
|
100
|
+
}, { clear: true });
|
|
101
|
+
if (revoked && revokesCurrent)
|
|
102
|
+
RequestIdentity.clear(this.em);
|
|
103
|
+
return revoked;
|
|
104
|
+
}
|
|
105
|
+
/** Revokes the user's sessions, including impersonation sessions they started. */
|
|
106
|
+
async revokeUserSessions(user) {
|
|
107
|
+
user = await this.resolveUserForRevocation(user);
|
|
108
|
+
this.accessControlService.assertUserCan("revoke", Session);
|
|
109
|
+
const current = RequestContext.isActive()
|
|
110
|
+
? RequestContext.get(Session)
|
|
111
|
+
: null;
|
|
112
|
+
const revokesCurrent = current?.user.id === user.id || current?.impersonatedBy?.id === user.id;
|
|
113
|
+
if (revokesCurrent)
|
|
114
|
+
this.assertRevocationCanCommit();
|
|
115
|
+
const count = await this.em.transactional(async (em) => {
|
|
116
|
+
const sessions = await em.find(Session, {
|
|
117
|
+
$or: [{ user: String(user.id) }, { impersonatedBy: user }],
|
|
118
|
+
}, { filters: false, lockMode: LockMode.PESSIMISTIC_WRITE });
|
|
119
|
+
for (const session of sessions)
|
|
120
|
+
this.accessControlService.assertUserCan("revoke", session);
|
|
121
|
+
if (sessions.length === 0)
|
|
122
|
+
return 0;
|
|
123
|
+
// Delete only the locked, authorized snapshot; never include unchecked new sessions.
|
|
124
|
+
return await em.nativeDelete(Session, {
|
|
125
|
+
id: { $in: sessions.map(({ id }) => id) },
|
|
126
|
+
});
|
|
127
|
+
}, { clear: true });
|
|
128
|
+
if (revokesCurrent)
|
|
129
|
+
RequestIdentity.clear(this.em);
|
|
130
|
+
return count;
|
|
131
|
+
}
|
|
132
|
+
async resolveUserForRevocation(user) {
|
|
133
|
+
if (typeof user !== "string")
|
|
134
|
+
return user;
|
|
135
|
+
this.accessControlService.assertUserCan("revoke", Session);
|
|
136
|
+
const entity = await this.em.findOne(User, { id: user }, { refresh: true });
|
|
137
|
+
if (!entity)
|
|
138
|
+
throw new NotFoundException("User not found");
|
|
139
|
+
return entity;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Resolves the persisted user and session represented by the current request.
|
|
143
|
+
*
|
|
144
|
+
* @returns Application entities for a valid session, otherwise `null`.
|
|
145
|
+
*/
|
|
146
|
+
async getCurrentAuthenticatedSession() {
|
|
147
|
+
const requestHeaders = headers();
|
|
148
|
+
const candidates = [requestHeaders];
|
|
149
|
+
if (requestHeaders.has("cookie") && requestHeaders.has("authorization")) {
|
|
150
|
+
const cookieHeaders = new Headers(requestHeaders);
|
|
151
|
+
cookieHeaders.delete("authorization");
|
|
152
|
+
candidates.unshift(cookieHeaders);
|
|
153
|
+
}
|
|
154
|
+
for (const candidate of candidates) {
|
|
155
|
+
const session = await this.resolveSession(candidate);
|
|
156
|
+
if (session)
|
|
157
|
+
return session;
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
async resolveSession(requestHeaders) {
|
|
162
|
+
const data = await this.auth.api.getSession({ headers: requestHeaders });
|
|
163
|
+
if (!data)
|
|
164
|
+
return null;
|
|
165
|
+
const [user, session] = await Promise.all([
|
|
166
|
+
this.em.findOne(User, { id: data.user.id }),
|
|
167
|
+
this.em.findOne(Session, {
|
|
168
|
+
token: data.session.token,
|
|
169
|
+
}),
|
|
170
|
+
]);
|
|
171
|
+
if (!user || !session)
|
|
172
|
+
return null;
|
|
173
|
+
if (user.banned &&
|
|
174
|
+
(!user.banExpiresAt || user.banExpiresAt.getTime() > Date.now())) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
session: session,
|
|
179
|
+
user: user,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Lists the persisted active sessions belonging to the authenticated user.
|
|
184
|
+
*
|
|
185
|
+
* @returns Active session entities in the order returned by the auth backend.
|
|
186
|
+
*/
|
|
187
|
+
async listCurrentUserSessions() {
|
|
188
|
+
const data = await this.auth.api.listSessions({ headers: headers() });
|
|
189
|
+
if (data.length === 0)
|
|
190
|
+
return [];
|
|
191
|
+
// Better Auth already authorized this list; the credential-bearing entities
|
|
192
|
+
// are needed internally by revocation. GraphQL uses getSessionConnectionByUser without credential columns.
|
|
193
|
+
const sessions = await this.em.find(Session, {
|
|
194
|
+
token: { $in: data.map(({ token }) => token) },
|
|
195
|
+
});
|
|
196
|
+
const sessionsByToken = new Map(sessions.map((session) => [session.token, session]));
|
|
197
|
+
return data.flatMap(({ token }) => {
|
|
198
|
+
const session = sessionsByToken.get(token);
|
|
199
|
+
return session ? [session] : [];
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/** Revokes one session owned by the authenticated user by its public ID. */
|
|
203
|
+
async revokeCurrentUserSession(id) {
|
|
204
|
+
const session = (await this.listCurrentUserSessions()).find((candidate) => String(candidate.id) === id);
|
|
205
|
+
if (!session)
|
|
206
|
+
return false;
|
|
207
|
+
const current = RequestContext.isActive()
|
|
208
|
+
? RequestContext.get(Session)
|
|
209
|
+
: null;
|
|
210
|
+
const revokesCurrent = current?.id === session.id;
|
|
211
|
+
if (revokesCurrent)
|
|
212
|
+
this.assertRevocationCanCommit();
|
|
213
|
+
const result = await this.auth.api.revokeSession({
|
|
214
|
+
body: { token: session.token },
|
|
215
|
+
headers: headers(),
|
|
216
|
+
});
|
|
217
|
+
if (result.status && revokesCurrent)
|
|
218
|
+
RequestIdentity.clear(this.em);
|
|
219
|
+
return result.status;
|
|
220
|
+
}
|
|
221
|
+
/** Revokes every session except the authenticated user's current session. */
|
|
222
|
+
async revokeCurrentUserOtherSessions() {
|
|
223
|
+
const result = await this.auth.api.revokeOtherSessions({
|
|
224
|
+
headers: headers(),
|
|
225
|
+
});
|
|
226
|
+
return result.status;
|
|
227
|
+
}
|
|
228
|
+
/** Revokes every session belonging to the authenticated user. */
|
|
229
|
+
async revokeCurrentUserSessions() {
|
|
230
|
+
this.assertRevocationCanCommit();
|
|
231
|
+
const result = await this.auth.api.revokeSessions({ headers: headers() });
|
|
232
|
+
if (result.status)
|
|
233
|
+
RequestIdentity.clear(this.em);
|
|
234
|
+
return result.status;
|
|
235
|
+
}
|
|
236
|
+
assertRevocationCanCommit() {
|
|
237
|
+
if (this.em.isInTransaction()) {
|
|
238
|
+
throw new BadRequestException("Revoke the current session outside an active transaction");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Writes a persisted session's signed cookie to the current browser response.
|
|
243
|
+
*
|
|
244
|
+
* @remarks
|
|
245
|
+
* The session cookie is intentionally browser-session scoped. Cached session
|
|
246
|
+
* and account cookies are expired so the next request resolves fresh data.
|
|
247
|
+
* This does not change the current request's identity, abilities, or RLS scope.
|
|
248
|
+
*/
|
|
249
|
+
async setSessionCookie(sessionToken) {
|
|
250
|
+
const { authCookies, secret } = await this.auth.$context;
|
|
251
|
+
const cookieStore = cookies();
|
|
252
|
+
cookieStore.set(authCookies.sessionToken.name, await createSignedCookieValue(sessionToken, secret), createSessionCookieOptions(authCookies.sessionToken));
|
|
253
|
+
cookieStore.set(authCookies.dontRememberToken.name, await createSignedCookieValue("true", secret), createSessionCookieOptions(authCookies.dontRememberToken));
|
|
254
|
+
expireCookieAndChunks(cookieStore, authCookies.sessionData);
|
|
255
|
+
expireCookieAndChunks(cookieStore, authCookies.accountData);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
SessionService = __decorate([
|
|
259
|
+
Injectable(),
|
|
260
|
+
__param(0, Inject(AUTH_TOKEN)),
|
|
261
|
+
__metadata("design:paramtypes", [Object, EntityManager,
|
|
262
|
+
AccessControlService])
|
|
263
|
+
], SessionService);
|
|
264
|
+
export { SessionService };
|
|
265
|
+
async function createSignedCookieValue(value, secret) {
|
|
266
|
+
const signature = await makeSignature(value, secret);
|
|
267
|
+
return `${value}.${signature}`;
|
|
268
|
+
}
|
|
269
|
+
function createSessionCookieOptions(cookie) {
|
|
270
|
+
const options = createCookieOptions(cookie);
|
|
271
|
+
delete options.maxAge;
|
|
272
|
+
return options;
|
|
273
|
+
}
|
|
274
|
+
function createExpiredCookieOptions(cookie) {
|
|
275
|
+
return {
|
|
276
|
+
...createCookieOptions(cookie),
|
|
277
|
+
expires: new Date(0),
|
|
278
|
+
maxAge: 0,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function expireCookieAndChunks(cookieStore, cookie) {
|
|
282
|
+
const options = createExpiredCookieOptions(cookie);
|
|
283
|
+
cookieStore.set(cookie.name, "", options);
|
|
284
|
+
for (const { name } of cookieStore.getAll()) {
|
|
285
|
+
if (isCookieChunk(name, cookie.name)) {
|
|
286
|
+
cookieStore.set(name, "", options);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function isCookieChunk(name, cookieName) {
|
|
291
|
+
const prefix = `${cookieName}.`;
|
|
292
|
+
if (!name.startsWith(prefix))
|
|
293
|
+
return false;
|
|
294
|
+
const suffix = name.slice(prefix.length);
|
|
295
|
+
const index = Number(suffix);
|
|
296
|
+
return Number.isSafeInteger(index) && index >= 0 && String(index) === suffix;
|
|
297
|
+
}
|
|
298
|
+
function createCookieOptions(cookie) {
|
|
299
|
+
const { attributes } = cookie;
|
|
300
|
+
return {
|
|
301
|
+
domain: attributes.domain,
|
|
302
|
+
expires: attributes.expires,
|
|
303
|
+
httpOnly: attributes.httpOnly,
|
|
304
|
+
maxAge: attributes.maxAge,
|
|
305
|
+
partitioned: attributes.partitioned,
|
|
306
|
+
path: attributes.path,
|
|
307
|
+
sameSite: typeof attributes.sameSite === "string"
|
|
308
|
+
? attributes.sameSite.toLowerCase()
|
|
309
|
+
: attributes.sameSite,
|
|
310
|
+
secure: attributes.secure,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
//# sourceMappingURL=session.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.service.js","sourceRoot":"","sources":["../../src/services/session.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAoB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAGL,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,OAAO,EACP,OAAO,EACP,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,MAAM,EACN,UAAU,EACV,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA8BnE,wDAAwD;AAEjD,IAAM,cAAc,GAApB,MAAM,cAAc;IAUN;IACA;IAVnB;;;;;OAKG;IACH,YAEE,IAAa,EACI,EAAiB,EACjB,oBAA0C;QAD1C,OAAE,GAAF,E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I,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAE3C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC;AAC/E,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAkB;IAC7C,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAC9B,OAAO;QACL,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,QAAQ,EACN,OAAO,UAAU,CAAC,QAAQ,KAAK,QAAQ;YACrC,CAAC,CAAE,UAAU,CAAC,QAAQ,CAAC,WAAW,EAAgC;YAClE,CAAC,CAAC,UAAU,CAAC,QAAQ;QACzB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { User } from "../entities/user.entity.js";
|
|
5
|
+
import { UserApiKey } from "../entities/user-api-key.entity.js";
|
|
6
|
+
import type { CreateApiKeyOptions } from "../interfaces/create-api-key-options.interface.js";
|
|
7
|
+
import type { CreatedApiKey } from "../interfaces/created-api-key.interface.js";
|
|
8
|
+
import type { UpdateApiKeyOptions } from "../interfaces/update-api-key-options.interface.js";
|
|
9
|
+
import type { UserApiKeyPermissionOption } from "../objects/user-api-key-permission-option.object.js";
|
|
10
|
+
import { AccessControlService } from "./access-control.service.js";
|
|
11
|
+
/** Manages user-owned API keys within the current request's authorization scope. */
|
|
12
|
+
export declare class UserApiKeyService {
|
|
13
|
+
/** MikroORM entity manager used for API-key persistence. */
|
|
14
|
+
protected readonly em: EntityManager;
|
|
15
|
+
private readonly authOptions;
|
|
16
|
+
private readonly accessControlService;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
/** Creates an API-key domain service. */
|
|
19
|
+
constructor(
|
|
20
|
+
/** MikroORM entity manager used for API-key persistence. */
|
|
21
|
+
em: EntityManager, authOptions: AuthModuleOptions, accessControlService: AccessControlService);
|
|
22
|
+
/** Lists user-key grants subject to configuration and the current credential's ceiling. */
|
|
23
|
+
getUserApiKeyPermissions(user: User): UserApiKeyPermissionOption[];
|
|
24
|
+
/** Returns a user-owned API key when it belongs to the current user. */
|
|
25
|
+
getUserApiKey(id: string, user: User): Promise<UserApiKey | null>;
|
|
26
|
+
/** Paginates current-user keys after applying ownership and permission ceilings. */
|
|
27
|
+
getUserApiKeyConnection(user: User, args: ConnectionArgsInterface<UserApiKey>): Promise<ConnectionInterface<UserApiKey>>;
|
|
28
|
+
/** Creates an API key owned by a user. */
|
|
29
|
+
createUserApiKey(user: User, options: CreateApiKeyOptions): Promise<CreatedApiKey<UserApiKey>>;
|
|
30
|
+
/** Updates an API key owned by the current user. */
|
|
31
|
+
updateUserApiKey(id: string, input: UpdateApiKeyOptions): Promise<UserApiKey>;
|
|
32
|
+
/** Deletes an API key owned by the current user. */
|
|
33
|
+
deleteUserApiKey(id: string): Promise<UserApiKey>;
|
|
34
|
+
private createKey;
|
|
35
|
+
private updateKey;
|
|
36
|
+
private deleteKey;
|
|
37
|
+
private getVisibleApiKey;
|
|
38
|
+
private findWritableApiKey;
|
|
39
|
+
private getOwnedListFilter;
|
|
40
|
+
private assertOwner;
|
|
41
|
+
private unwrapOwner;
|
|
42
|
+
private normalizePermissions;
|
|
43
|
+
private normalizeCreatePermissions;
|
|
44
|
+
private normalizeUpdatedPermissions;
|
|
45
|
+
private assertUserPermissionCeiling;
|
|
46
|
+
private assertDelegatedApiKeyPermissionCeiling;
|
|
47
|
+
private assertPermissionCeiling;
|
|
48
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
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
|
+
var UserApiKeyService_1;
|
|
14
|
+
import { EntityManager, Reference, } from "@mikro-orm/core";
|
|
15
|
+
import { ConnectionManager, } from "@nest-boot/graphql-connection";
|
|
16
|
+
import { BadRequestException, ForbiddenException, Inject, Injectable, Logger, NotFoundException, } from "@nestjs/common";
|
|
17
|
+
import { MODULE_OPTIONS_TOKEN } from "../auth.module-definition.js";
|
|
18
|
+
import { UserApiKeyConnection } from "../connections/user-api-key.connection-definition.js";
|
|
19
|
+
import { UserApiKey } from "../entities/user-api-key.entity.js";
|
|
20
|
+
import { RequestIdentity } from "../infrastructure/request-identity.js";
|
|
21
|
+
import { generateApiKey, hashApiKey, } from "../utils/api-key-credential.util.js";
|
|
22
|
+
import { resolveApiKeyPermissionCatalog } from "../utils/api-key-permissions.util.js";
|
|
23
|
+
import { normalizeAuthPermissions } from "../utils/auth-role.util.js";
|
|
24
|
+
import { resolveAuthCatalog } from "../utils/resolve-auth-catalog.util.js";
|
|
25
|
+
import { resolveUserPermissions } from "../utils/resolve-effective-permissions.util.js";
|
|
26
|
+
import { AccessControlService } from "./access-control.service.js";
|
|
27
|
+
/** Manages user-owned API keys within the current request's authorization scope. */
|
|
28
|
+
let UserApiKeyService = UserApiKeyService_1 = class UserApiKeyService {
|
|
29
|
+
em;
|
|
30
|
+
authOptions;
|
|
31
|
+
accessControlService;
|
|
32
|
+
logger = new Logger(UserApiKeyService_1.name);
|
|
33
|
+
/** Creates an API-key domain service. */
|
|
34
|
+
constructor(
|
|
35
|
+
/** MikroORM entity manager used for API-key persistence. */
|
|
36
|
+
em, authOptions, accessControlService) {
|
|
37
|
+
this.em = em;
|
|
38
|
+
this.authOptions = authOptions;
|
|
39
|
+
this.accessControlService = accessControlService;
|
|
40
|
+
}
|
|
41
|
+
/** Lists user-key grants subject to configuration and the current credential's ceiling. */
|
|
42
|
+
getUserApiKeyPermissions(user) {
|
|
43
|
+
this.accessControlService.assertCurrentUser(user);
|
|
44
|
+
const { permissions, allowed } = resolveApiKeyPermissionCatalog(this.authOptions, "user");
|
|
45
|
+
const allowedSet = new Set(allowed);
|
|
46
|
+
const userPermissions = new Set(resolveAuthCatalog(this.authOptions, "user").permissions);
|
|
47
|
+
const ceiling = this.accessControlService.getApiKeyPermissionCeiling();
|
|
48
|
+
return permissions.map((permission) => ({
|
|
49
|
+
permission,
|
|
50
|
+
grantable: allowedSet.has(permission) &&
|
|
51
|
+
(!userPermissions.has(permission) ||
|
|
52
|
+
this.accessControlService.canGrantUserPermissions([permission])) &&
|
|
53
|
+
(ceiling === null || ceiling.includes(permission)),
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
/** Returns a user-owned API key when it belongs to the current user. */
|
|
57
|
+
async getUserApiKey(id, user) {
|
|
58
|
+
this.accessControlService.assertCurrentUser(user);
|
|
59
|
+
this.accessControlService.assertUserCan("read", UserApiKey);
|
|
60
|
+
const apiKey = await this.getVisibleApiKey(id, user);
|
|
61
|
+
if (apiKey) {
|
|
62
|
+
this.accessControlService.assertUserCan("read", apiKey);
|
|
63
|
+
}
|
|
64
|
+
return apiKey;
|
|
65
|
+
}
|
|
66
|
+
/** Paginates current-user keys after applying ownership and permission ceilings. */
|
|
67
|
+
async getUserApiKeyConnection(user, args) {
|
|
68
|
+
this.accessControlService.assertCurrentUser(user);
|
|
69
|
+
this.accessControlService.assertUserCan("read", UserApiKey);
|
|
70
|
+
const where = this.getOwnedListFilter(user);
|
|
71
|
+
const connection = await new ConnectionManager(this.em).find(UserApiKeyConnection, args, {
|
|
72
|
+
where,
|
|
73
|
+
exclude: ["key"],
|
|
74
|
+
});
|
|
75
|
+
// Reject the whole page rather than silently changing cursor pagination.
|
|
76
|
+
for (const { node } of connection.edges) {
|
|
77
|
+
this.accessControlService.assertUserCan("read", node);
|
|
78
|
+
}
|
|
79
|
+
return connection;
|
|
80
|
+
}
|
|
81
|
+
/** Creates an API key owned by a user. */
|
|
82
|
+
async createUserApiKey(user, options) {
|
|
83
|
+
this.accessControlService.assertCurrentUser(user);
|
|
84
|
+
this.accessControlService.assertUserCan("create", UserApiKey);
|
|
85
|
+
const permissions = this.normalizeCreatePermissions(user, options);
|
|
86
|
+
this.assertUserPermissionCeiling(user, permissions);
|
|
87
|
+
return await this.createKey(user, options, permissions);
|
|
88
|
+
}
|
|
89
|
+
/** Updates an API key owned by the current user. */
|
|
90
|
+
async updateUserApiKey(id, input) {
|
|
91
|
+
this.accessControlService.assertUserCan("update", UserApiKey);
|
|
92
|
+
const apiKey = await this.findWritableApiKey(id);
|
|
93
|
+
this.accessControlService.assertUserCan("update", apiKey);
|
|
94
|
+
const user = this.unwrapOwner(apiKey);
|
|
95
|
+
const permissions = this.normalizeUpdatedPermissions(apiKey, input);
|
|
96
|
+
// Allow disabling stale grants without replacing them.
|
|
97
|
+
if (input.enabled !== false || permissions !== undefined) {
|
|
98
|
+
const finalPermissions = permissions ??
|
|
99
|
+
this.normalizePermissions(user, apiKey.permissions ?? []);
|
|
100
|
+
this.assertUserPermissionCeiling(user, finalPermissions);
|
|
101
|
+
}
|
|
102
|
+
return await this.updateKey(apiKey, input, permissions);
|
|
103
|
+
}
|
|
104
|
+
/** Deletes an API key owned by the current user. */
|
|
105
|
+
async deleteUserApiKey(id) {
|
|
106
|
+
this.accessControlService.assertUserCan("delete", UserApiKey);
|
|
107
|
+
const apiKey = await this.findWritableApiKey(id);
|
|
108
|
+
this.accessControlService.assertUserCan("delete", apiKey);
|
|
109
|
+
return await this.deleteKey(apiKey);
|
|
110
|
+
}
|
|
111
|
+
async createKey(owner, options, permissions) {
|
|
112
|
+
if (options.expiresAt && options.expiresAt <= new Date()) {
|
|
113
|
+
throw new BadRequestException("API key expiration must be in the future");
|
|
114
|
+
}
|
|
115
|
+
const prefix = options.prefix ?? process.env.API_KEY_PREFIX ?? "sk";
|
|
116
|
+
const plaintextApiKey = generateApiKey(prefix);
|
|
117
|
+
const entity = await this.em.transactional(async (em) => {
|
|
118
|
+
const entity = em.create(UserApiKey, {
|
|
119
|
+
enabled: true,
|
|
120
|
+
expiresAt: options.expiresAt ?? null,
|
|
121
|
+
key: hashApiKey(plaintextApiKey),
|
|
122
|
+
name: options.name,
|
|
123
|
+
user: owner,
|
|
124
|
+
permissions,
|
|
125
|
+
prefix,
|
|
126
|
+
start: plaintextApiKey.slice(0, 8),
|
|
127
|
+
});
|
|
128
|
+
this.accessControlService.assertUserCan("create", entity);
|
|
129
|
+
await em.persist(entity).flush();
|
|
130
|
+
return entity;
|
|
131
|
+
}, { clear: true });
|
|
132
|
+
this.logger.log("API key created", {
|
|
133
|
+
apiKeyId: entity.id,
|
|
134
|
+
ownerId: owner.id,
|
|
135
|
+
ownerType: "user",
|
|
136
|
+
});
|
|
137
|
+
return { apiKey: plaintextApiKey, entity };
|
|
138
|
+
}
|
|
139
|
+
async updateKey(apiKey, input, permissions) {
|
|
140
|
+
if (input.expiresAt && input.expiresAt <= new Date()) {
|
|
141
|
+
throw new BadRequestException("API key expiration must be in the future");
|
|
142
|
+
}
|
|
143
|
+
RequestIdentity.assertApiKeyCanCommit(this.em, apiKey);
|
|
144
|
+
const previous = {
|
|
145
|
+
name: apiKey.name,
|
|
146
|
+
enabled: apiKey.enabled,
|
|
147
|
+
expiresAt: apiKey.expiresAt,
|
|
148
|
+
permissions: apiKey.permissions,
|
|
149
|
+
lastUsedAt: apiKey.lastUsedAt,
|
|
150
|
+
};
|
|
151
|
+
if (input.name !== undefined)
|
|
152
|
+
apiKey.name = input.name;
|
|
153
|
+
if (input.enabled !== undefined)
|
|
154
|
+
apiKey.enabled = input.enabled;
|
|
155
|
+
if (input.expiresAt !== undefined)
|
|
156
|
+
apiKey.expiresAt = input.expiresAt;
|
|
157
|
+
if (permissions !== undefined) {
|
|
158
|
+
apiKey.permissions = permissions;
|
|
159
|
+
}
|
|
160
|
+
// Commit the final use before revocation removes the interceptor's identity.
|
|
161
|
+
if (input.enabled === false && RequestIdentity.isCurrentApiKey(apiKey))
|
|
162
|
+
apiKey.lastUsedAt = new Date();
|
|
163
|
+
try {
|
|
164
|
+
await this.em.persist(apiKey).flush();
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
Object.assign(apiKey, previous);
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
RequestIdentity.updateApiKey(this.em, this.authOptions, apiKey);
|
|
171
|
+
return apiKey;
|
|
172
|
+
}
|
|
173
|
+
async deleteKey(apiKey) {
|
|
174
|
+
RequestIdentity.assertApiKeyCanCommit(this.em, apiKey);
|
|
175
|
+
await this.em.remove(apiKey).flush();
|
|
176
|
+
RequestIdentity.updateApiKey(this.em, this.authOptions, apiKey, true);
|
|
177
|
+
return apiKey;
|
|
178
|
+
}
|
|
179
|
+
async getVisibleApiKey(id, owner) {
|
|
180
|
+
const apiKey = await this.em.findOne(UserApiKey, {
|
|
181
|
+
$and: [{ id }, this.getOwnedListFilter(owner)],
|
|
182
|
+
}, { populate: ["user"], exclude: ["key"] });
|
|
183
|
+
if (apiKey) {
|
|
184
|
+
this.assertOwner(apiKey, owner);
|
|
185
|
+
this.assertDelegatedApiKeyPermissionCeiling(apiKey.permissions ?? []);
|
|
186
|
+
}
|
|
187
|
+
return apiKey;
|
|
188
|
+
}
|
|
189
|
+
async findWritableApiKey(id) {
|
|
190
|
+
const apiKey = await this.em.findOne(UserApiKey, { id }, {
|
|
191
|
+
populate: ["user"],
|
|
192
|
+
exclude: ["key"],
|
|
193
|
+
refresh: true,
|
|
194
|
+
});
|
|
195
|
+
if (!apiKey) {
|
|
196
|
+
throw new NotFoundException("API key not found");
|
|
197
|
+
}
|
|
198
|
+
this.accessControlService.assertApiKeyOwner(apiKey);
|
|
199
|
+
this.accessControlService.assertApiKeyPermissionCeiling(apiKey.permissions ?? []);
|
|
200
|
+
return apiKey;
|
|
201
|
+
}
|
|
202
|
+
getOwnedListFilter(owner) {
|
|
203
|
+
const ceiling = this.accessControlService.getApiKeyPermissionCeiling();
|
|
204
|
+
return {
|
|
205
|
+
["user"]: owner,
|
|
206
|
+
...(ceiling !== null ? { permissions: { $contained: ceiling } } : {}),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
assertOwner(apiKey, expectedOwner) {
|
|
210
|
+
const owner = this.unwrapOwner(apiKey);
|
|
211
|
+
if (owner.id !== expectedOwner.id) {
|
|
212
|
+
throw new ForbiddenException("You are not allowed to access this API key");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
unwrapOwner(apiKey) {
|
|
216
|
+
return Reference.unwrapReference(apiKey.user);
|
|
217
|
+
}
|
|
218
|
+
normalizePermissions(owner, permissions) {
|
|
219
|
+
const userPermissions = resolveAuthCatalog(this.authOptions, "user").permissions;
|
|
220
|
+
const workspacePermissions = resolveAuthCatalog(this.authOptions, "workspace").permissions;
|
|
221
|
+
const availablePermissions = [...userPermissions, ...workspacePermissions];
|
|
222
|
+
const normalizedPermissions = normalizeAuthPermissions(permissions, availablePermissions, "User API key");
|
|
223
|
+
this.assertPermissionCeiling(normalizedPermissions, resolveApiKeyPermissionCatalog(this.authOptions, "user").allowed, "API key permissions exceed configured allowedPermissions");
|
|
224
|
+
return normalizedPermissions;
|
|
225
|
+
}
|
|
226
|
+
normalizeCreatePermissions(owner, options) {
|
|
227
|
+
return this.normalizePermissions(owner, options.permissions === undefined
|
|
228
|
+
? (this.authOptions.apiKey?.defaultPermissions ?? [])
|
|
229
|
+
: (options.permissions ?? []));
|
|
230
|
+
}
|
|
231
|
+
normalizeUpdatedPermissions(apiKey, input) {
|
|
232
|
+
return input.permissions === undefined
|
|
233
|
+
? undefined
|
|
234
|
+
: this.normalizePermissions(this.unwrapOwner(apiKey), input.permissions ?? []);
|
|
235
|
+
}
|
|
236
|
+
assertUserPermissionCeiling(user, permissions) {
|
|
237
|
+
const userPermissionCatalog = new Set(resolveAuthCatalog(this.authOptions, "user").permissions);
|
|
238
|
+
const requestedUserPermissions = permissions.filter((permission) => userPermissionCatalog.has(permission));
|
|
239
|
+
const effectivePermissions = resolveUserPermissions(this.authOptions, user);
|
|
240
|
+
this.assertPermissionCeiling(requestedUserPermissions, effectivePermissions, "User API key permissions exceed owner permissions");
|
|
241
|
+
this.assertDelegatedApiKeyPermissionCeiling(permissions);
|
|
242
|
+
}
|
|
243
|
+
assertDelegatedApiKeyPermissionCeiling(permissions) {
|
|
244
|
+
this.accessControlService.assertApiKeyPermissionCeiling(permissions);
|
|
245
|
+
}
|
|
246
|
+
assertPermissionCeiling(requestedPermissions, effectivePermissions, message) {
|
|
247
|
+
const effectivePermissionSet = new Set(effectivePermissions);
|
|
248
|
+
const excessivePermissions = requestedPermissions.filter((permission) => !effectivePermissionSet.has(permission));
|
|
249
|
+
if (excessivePermissions.length > 0) {
|
|
250
|
+
throw new ForbiddenException(`${message}: ${excessivePermissions.join(", ")}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
UserApiKeyService = UserApiKeyService_1 = __decorate([
|
|
255
|
+
Injectable(),
|
|
256
|
+
__param(1, Inject(MODULE_OPTIONS_TOKEN)),
|
|
257
|
+
__metadata("design:paramtypes", [EntityManager, Object, AccessControlService])
|
|
258
|
+
], UserApiKeyService);
|
|
259
|
+
export { UserApiKeyService };
|
|
260
|
+
//# sourceMappingURL=user-api-key.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-api-key.service.js","sourceRoot":"","sources":["../../src/services/user-api-key.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EACL,aAAa,EAEb,SAAS,GAEV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAGL,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,MAAM,EACN,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAKxE,OAAO,EACL,cAAc,EACd,UAAU,GACX,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,oBAAo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