@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
package/dist/api-key.service.js
DELETED
|
@@ -1,336 +0,0 @@
|
|
|
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 ApiKeyService_1;
|
|
14
|
-
import { createHash, randomBytes } from "node:crypto";
|
|
15
|
-
import { EntityManager, Reference, } from "@mikro-orm/core";
|
|
16
|
-
import { RequestContext } from "@nest-boot/request-context";
|
|
17
|
-
import { RowLevelSecurity, RowLevelSecurityMode, } from "@nest-boot/row-level-security";
|
|
18
|
-
import { BadRequestException, ForbiddenException, Inject, Injectable, Logger, NotFoundException, UnauthorizedException, } from "@nestjs/common";
|
|
19
|
-
import { AccessControlService } from "./access-control.service.js";
|
|
20
|
-
import { MODULE_OPTIONS_TOKEN } from "./auth.module-definition.js";
|
|
21
|
-
import { BaseApiKey, BaseWorkspaceMember, } from "./entities/index.js";
|
|
22
|
-
import { DEFAULT_USER_PERMISSIONS, DEFAULT_USER_ROLE, DEFAULT_USER_ROLES, } from "./user.constants.js";
|
|
23
|
-
import { normalizeAuthPermissions, resolveAuthPermissions, } from "./utils/auth-role.util.js";
|
|
24
|
-
import { DEFAULT_WORKSPACE_PERMISSIONS } from "./workspace.constants.js";
|
|
25
|
-
let ApiKeyService = ApiKeyService_1 = class ApiKeyService {
|
|
26
|
-
em;
|
|
27
|
-
authOptions;
|
|
28
|
-
accessControlService;
|
|
29
|
-
logger = new Logger(ApiKeyService_1.name);
|
|
30
|
-
constructor(em, authOptions, accessControlService) {
|
|
31
|
-
this.em = em;
|
|
32
|
-
this.authOptions = authOptions;
|
|
33
|
-
this.accessControlService = accessControlService;
|
|
34
|
-
}
|
|
35
|
-
async getUserApiKey(id, user) {
|
|
36
|
-
this.accessControlService.assertCurrentUser(user);
|
|
37
|
-
this.accessControlService.assertUserCan("read", this.apiKeyEntity);
|
|
38
|
-
return await this.getOwnedApiKey(id, user);
|
|
39
|
-
}
|
|
40
|
-
async getWorkspaceApiKey(id, workspace) {
|
|
41
|
-
this.assertWorkspacePrincipal(workspace);
|
|
42
|
-
this.accessControlService.assertWorkspaceCan("read", this.apiKeyEntity);
|
|
43
|
-
return await this.getOwnedApiKey(id, workspace);
|
|
44
|
-
}
|
|
45
|
-
getUserListFilter(user) {
|
|
46
|
-
this.accessControlService.assertCurrentUser(user);
|
|
47
|
-
this.accessControlService.assertUserCan("read", this.apiKeyEntity);
|
|
48
|
-
return this.getOwnedListFilter(user);
|
|
49
|
-
}
|
|
50
|
-
getWorkspaceListFilter(workspace) {
|
|
51
|
-
this.assertWorkspacePrincipal(workspace);
|
|
52
|
-
this.accessControlService.assertWorkspaceCan("read", this.apiKeyEntity);
|
|
53
|
-
return this.getOwnedListFilter(workspace);
|
|
54
|
-
}
|
|
55
|
-
async createUserKey(user, options) {
|
|
56
|
-
this.accessControlService.assertCurrentUser(user);
|
|
57
|
-
this.accessControlService.assertUserCan("create", this.apiKeyEntity);
|
|
58
|
-
const permissions = this.normalizeCreatePermissions(user, options);
|
|
59
|
-
this.assertUserPermissionCeiling(user, permissions);
|
|
60
|
-
return await this.createKey(user, options, permissions);
|
|
61
|
-
}
|
|
62
|
-
async createWorkspaceKey(workspace, options) {
|
|
63
|
-
this.assertWorkspacePrincipal(workspace);
|
|
64
|
-
this.accessControlService.assertWorkspaceCan("create", this.apiKeyEntity);
|
|
65
|
-
const permissions = this.normalizeCreatePermissions(workspace, options);
|
|
66
|
-
this.accessControlService.assertCanGrantWorkspacePermissions(permissions);
|
|
67
|
-
return await this.createKey(workspace, options, permissions);
|
|
68
|
-
}
|
|
69
|
-
async updateUserKey(id, user, input) {
|
|
70
|
-
this.accessControlService.assertCurrentUser(user);
|
|
71
|
-
this.accessControlService.assertUserCan("update", this.apiKeyEntity);
|
|
72
|
-
const apiKey = await this.findOwnedApiKey(id, user);
|
|
73
|
-
const permissions = this.normalizeUpdatedPermissions(apiKey, input);
|
|
74
|
-
const finalPermissions = permissions ?? this.normalizePermissions(user, apiKey.permissions ?? []);
|
|
75
|
-
this.assertUserPermissionCeiling(user, finalPermissions);
|
|
76
|
-
return await this.updateKey(apiKey, input, permissions);
|
|
77
|
-
}
|
|
78
|
-
async updateWorkspaceKey(id, workspace, input) {
|
|
79
|
-
this.assertWorkspacePrincipal(workspace);
|
|
80
|
-
this.accessControlService.assertWorkspaceCan("update", this.apiKeyEntity);
|
|
81
|
-
const apiKey = await this.findOwnedApiKey(id, workspace);
|
|
82
|
-
const permissions = this.normalizeUpdatedPermissions(apiKey, input);
|
|
83
|
-
const finalPermissions = permissions ??
|
|
84
|
-
this.normalizePermissions(this.unwrapOwner(apiKey), apiKey.permissions ?? []);
|
|
85
|
-
this.accessControlService.assertCanGrantWorkspacePermissions(finalPermissions);
|
|
86
|
-
return await this.updateKey(apiKey, input, permissions);
|
|
87
|
-
}
|
|
88
|
-
async deleteUserKey(id, user) {
|
|
89
|
-
this.accessControlService.assertCurrentUser(user);
|
|
90
|
-
this.accessControlService.assertUserCan("delete", this.apiKeyEntity);
|
|
91
|
-
return await this.deleteKey(await this.findOwnedApiKey(id, user));
|
|
92
|
-
}
|
|
93
|
-
async deleteWorkspaceKey(id, workspace) {
|
|
94
|
-
this.assertWorkspacePrincipal(workspace);
|
|
95
|
-
this.accessControlService.assertWorkspaceCan("delete", this.apiKeyEntity);
|
|
96
|
-
return await this.deleteKey(await this.findOwnedApiKey(id, workspace));
|
|
97
|
-
}
|
|
98
|
-
async validate(apiKey) {
|
|
99
|
-
if (!apiKey) {
|
|
100
|
-
throw new UnauthorizedException("Missing API key");
|
|
101
|
-
}
|
|
102
|
-
const row = await this.findValidationRow(apiKey);
|
|
103
|
-
if (!row) {
|
|
104
|
-
throw new UnauthorizedException("Invalid API key");
|
|
105
|
-
}
|
|
106
|
-
if (!row.apiKey.enabled) {
|
|
107
|
-
throw new UnauthorizedException("API key is disabled");
|
|
108
|
-
}
|
|
109
|
-
if (row.apiKey.expiresAt && new Date(row.apiKey.expiresAt) <= new Date()) {
|
|
110
|
-
throw new UnauthorizedException("API key has expired");
|
|
111
|
-
}
|
|
112
|
-
return row;
|
|
113
|
-
}
|
|
114
|
-
async recordUsage(apiKey) {
|
|
115
|
-
const now = new Date();
|
|
116
|
-
apiKey.lastUsedAt = now;
|
|
117
|
-
apiKey.updatedAt = now;
|
|
118
|
-
await this.runUnrestricted(() => this.em.flush());
|
|
119
|
-
return apiKey;
|
|
120
|
-
}
|
|
121
|
-
async runUnrestricted(callback) {
|
|
122
|
-
const run = () => {
|
|
123
|
-
RowLevelSecurity.setMode(RowLevelSecurityMode.DISABLED);
|
|
124
|
-
return callback();
|
|
125
|
-
};
|
|
126
|
-
if (RequestContext.isActive())
|
|
127
|
-
return await RequestContext.child(run);
|
|
128
|
-
return await RequestContext.run(new RequestContext({ type: "api-key-persistence" }), run);
|
|
129
|
-
}
|
|
130
|
-
async findOne(where) {
|
|
131
|
-
return await this.runUnrestricted(async () => await this.em.findOne(this.apiKeyEntity, where, {
|
|
132
|
-
populate: ["owner"],
|
|
133
|
-
}));
|
|
134
|
-
}
|
|
135
|
-
async createKey(owner, options, permissions) {
|
|
136
|
-
if (options.expiresAt && options.expiresAt <= new Date()) {
|
|
137
|
-
throw new BadRequestException("API key expiration must be in the future");
|
|
138
|
-
}
|
|
139
|
-
const prefix = options.prefix ?? process.env.API_KEY_PREFIX ?? "sk";
|
|
140
|
-
this.assertValidPrefix(prefix);
|
|
141
|
-
const plaintextApiKey = `${prefix}${randomBytes(48).toString("base64url")}`;
|
|
142
|
-
const entity = this.em.create(this.apiKeyEntity, {
|
|
143
|
-
enabled: true,
|
|
144
|
-
expiresAt: options.expiresAt ?? null,
|
|
145
|
-
key: this.hashApiKey(plaintextApiKey),
|
|
146
|
-
name: options.name,
|
|
147
|
-
owner,
|
|
148
|
-
permissions,
|
|
149
|
-
prefix,
|
|
150
|
-
start: plaintextApiKey.slice(0, 8),
|
|
151
|
-
});
|
|
152
|
-
await this.runUnrestricted(() => this.em.persist(entity).flush());
|
|
153
|
-
this.logger.log("API key created", {
|
|
154
|
-
apiKeyId: entity.id,
|
|
155
|
-
ownerId: owner.id,
|
|
156
|
-
ownerType: this.getOwnerType(owner),
|
|
157
|
-
});
|
|
158
|
-
return { apiKey: plaintextApiKey, entity };
|
|
159
|
-
}
|
|
160
|
-
async updateKey(apiKey, input, permissions) {
|
|
161
|
-
if (input.expiresAt && input.expiresAt <= new Date()) {
|
|
162
|
-
throw new BadRequestException("API key expiration must be in the future");
|
|
163
|
-
}
|
|
164
|
-
if (input.name !== undefined)
|
|
165
|
-
apiKey.name = input.name;
|
|
166
|
-
if (input.enabled !== undefined)
|
|
167
|
-
apiKey.enabled = input.enabled;
|
|
168
|
-
if (input.expiresAt !== undefined)
|
|
169
|
-
apiKey.expiresAt = input.expiresAt;
|
|
170
|
-
if (permissions !== undefined) {
|
|
171
|
-
apiKey.permissions = permissions;
|
|
172
|
-
}
|
|
173
|
-
await this.runUnrestricted(() => this.em.flush());
|
|
174
|
-
return apiKey;
|
|
175
|
-
}
|
|
176
|
-
async deleteKey(apiKey) {
|
|
177
|
-
this.em.remove(apiKey);
|
|
178
|
-
await this.runUnrestricted(() => this.em.flush());
|
|
179
|
-
return apiKey;
|
|
180
|
-
}
|
|
181
|
-
async getOwnedApiKey(id, owner) {
|
|
182
|
-
const apiKey = await this.findOne({ id });
|
|
183
|
-
if (apiKey) {
|
|
184
|
-
this.assertOwner(apiKey, owner);
|
|
185
|
-
this.assertDelegatedApiKeyPermissionCeiling(apiKey.permissions ?? []);
|
|
186
|
-
}
|
|
187
|
-
return apiKey;
|
|
188
|
-
}
|
|
189
|
-
async findOwnedApiKey(id, owner) {
|
|
190
|
-
const apiKey = await this.getOwnedApiKey(id, owner);
|
|
191
|
-
if (!apiKey)
|
|
192
|
-
throw new NotFoundException("API key not found");
|
|
193
|
-
return apiKey;
|
|
194
|
-
}
|
|
195
|
-
getOwnedListFilter(owner) {
|
|
196
|
-
const apiKey = this.getAuthenticatingApiKey();
|
|
197
|
-
return {
|
|
198
|
-
owner,
|
|
199
|
-
...(apiKey
|
|
200
|
-
? { permissions: { $contained: apiKey.permissions ?? [] } }
|
|
201
|
-
: {}),
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
assertWorkspacePrincipal(workspace) {
|
|
205
|
-
this.accessControlService.assertCurrentWorkspace(workspace);
|
|
206
|
-
const apiKey = this.getAuthenticatingApiKey();
|
|
207
|
-
if (apiKey &&
|
|
208
|
-
this.getOwnerType(this.unwrapOwner(apiKey)) === "workspace") {
|
|
209
|
-
this.assertOwner(apiKey, workspace);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
const member = RequestContext.get(BaseWorkspaceMember);
|
|
213
|
-
if (member?.status !== "ACTIVE") {
|
|
214
|
-
throw new ForbiddenException("An active workspace member is required");
|
|
215
|
-
}
|
|
216
|
-
this.accessControlService.assertCurrentWorkspaceMember(member);
|
|
217
|
-
if (Reference.unwrapReference(member.workspace).id !== workspace.id) {
|
|
218
|
-
throw new ForbiddenException("Workspace member does not belong to this workspace");
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
assertOwner(apiKey, expectedOwner) {
|
|
222
|
-
const owner = this.unwrapOwner(apiKey);
|
|
223
|
-
if (this.getOwnerType(owner) !== this.getOwnerType(expectedOwner) ||
|
|
224
|
-
owner.id !== expectedOwner.id) {
|
|
225
|
-
throw new ForbiddenException("You are not allowed to access this API key");
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
async findValidationRow(plaintextApiKey) {
|
|
229
|
-
return await this.runUnrestricted(async () => {
|
|
230
|
-
const entity = await this.findOne({
|
|
231
|
-
key: this.hashApiKey(plaintextApiKey),
|
|
232
|
-
});
|
|
233
|
-
if (!entity)
|
|
234
|
-
return null;
|
|
235
|
-
const owner = this.unwrapOwner(entity);
|
|
236
|
-
const ownerType = this.getOwnerType(owner);
|
|
237
|
-
if (ownerType === "user") {
|
|
238
|
-
const user = owner;
|
|
239
|
-
if (user.banned &&
|
|
240
|
-
(!user.banExpiresAt || user.banExpiresAt.getTime() > Date.now())) {
|
|
241
|
-
return null;
|
|
242
|
-
}
|
|
243
|
-
return { apiKey: entity, ownerType, user };
|
|
244
|
-
}
|
|
245
|
-
if (owner.deletedAt)
|
|
246
|
-
return null;
|
|
247
|
-
return { apiKey: entity, ownerType, workspace: owner };
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
getOwnerType(owner) {
|
|
251
|
-
if (owner instanceof this.userEntity)
|
|
252
|
-
return "user";
|
|
253
|
-
if (owner instanceof this.workspaceEntity)
|
|
254
|
-
return "workspace";
|
|
255
|
-
throw new TypeError("Unsupported API key owner type");
|
|
256
|
-
}
|
|
257
|
-
unwrapOwner(apiKey) {
|
|
258
|
-
return Reference.unwrapReference(apiKey.owner);
|
|
259
|
-
}
|
|
260
|
-
hashApiKey(apiKey) {
|
|
261
|
-
return createHash("sha256").update(apiKey).digest("base64url");
|
|
262
|
-
}
|
|
263
|
-
assertValidPrefix(prefix) {
|
|
264
|
-
if (prefix.length < 1 ||
|
|
265
|
-
prefix.length > 32 ||
|
|
266
|
-
!/^[a-z]/u.test(prefix) ||
|
|
267
|
-
/[^a-z0-9]/u.test(prefix)) {
|
|
268
|
-
throw new BadRequestException("API key prefix must contain 1–32 lowercase letters or digits and start with a lowercase letter");
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
normalizePermissions(owner, permissions) {
|
|
272
|
-
const ownerType = this.getOwnerType(owner);
|
|
273
|
-
const userPermissions = this.authOptions.user?.permissions ?? DEFAULT_USER_PERMISSIONS;
|
|
274
|
-
const workspacePermissions = this.authOptions.workspace?.permissions ?? DEFAULT_WORKSPACE_PERMISSIONS;
|
|
275
|
-
const availablePermissions = ownerType === "user"
|
|
276
|
-
? [...userPermissions, ...workspacePermissions]
|
|
277
|
-
: workspacePermissions;
|
|
278
|
-
const normalizedPermissions = normalizeAuthPermissions(permissions, availablePermissions, ownerType === "user" ? "User API key" : "Workspace API key");
|
|
279
|
-
this.assertPermissionCeiling(normalizedPermissions, this.authOptions.apiKey?.allowedPermissions ?? [
|
|
280
|
-
...userPermissions,
|
|
281
|
-
...workspacePermissions,
|
|
282
|
-
], "API key permissions exceed configured allowedPermissions");
|
|
283
|
-
return normalizedPermissions;
|
|
284
|
-
}
|
|
285
|
-
normalizeCreatePermissions(owner, options) {
|
|
286
|
-
return this.normalizePermissions(owner, options.permissions === undefined
|
|
287
|
-
? (this.authOptions.apiKey?.defaultPermissions ?? [])
|
|
288
|
-
: (options.permissions ?? []));
|
|
289
|
-
}
|
|
290
|
-
normalizeUpdatedPermissions(apiKey, input) {
|
|
291
|
-
return input.permissions === undefined
|
|
292
|
-
? undefined
|
|
293
|
-
: this.normalizePermissions(this.unwrapOwner(apiKey), input.permissions ?? []);
|
|
294
|
-
}
|
|
295
|
-
assertUserPermissionCeiling(user, permissions) {
|
|
296
|
-
const userPermissionCatalog = new Set(this.authOptions.user?.permissions ?? DEFAULT_USER_PERMISSIONS);
|
|
297
|
-
const requestedUserPermissions = permissions.filter((permission) => userPermissionCatalog.has(permission));
|
|
298
|
-
const effectivePermissions = resolveAuthPermissions(user.roles ?? [this.authOptions.user?.defaultRole ?? DEFAULT_USER_ROLE], user.permissions ?? [], this.authOptions.user?.roles ?? DEFAULT_USER_ROLES);
|
|
299
|
-
this.assertPermissionCeiling(requestedUserPermissions, effectivePermissions, "User API key permissions exceed owner permissions");
|
|
300
|
-
this.assertDelegatedApiKeyPermissionCeiling(permissions);
|
|
301
|
-
}
|
|
302
|
-
getAuthenticatingApiKey() {
|
|
303
|
-
return RequestContext.isActive()
|
|
304
|
-
? (RequestContext.get(BaseApiKey) ?? null)
|
|
305
|
-
: null;
|
|
306
|
-
}
|
|
307
|
-
assertDelegatedApiKeyPermissionCeiling(permissions) {
|
|
308
|
-
const apiKey = this.getAuthenticatingApiKey();
|
|
309
|
-
if (!apiKey)
|
|
310
|
-
return;
|
|
311
|
-
this.assertPermissionCeiling(permissions, apiKey.permissions ?? [], "API key permissions exceed authenticating API key permissions");
|
|
312
|
-
}
|
|
313
|
-
assertPermissionCeiling(requestedPermissions, effectivePermissions, message) {
|
|
314
|
-
const effectivePermissionSet = new Set(effectivePermissions);
|
|
315
|
-
const excessivePermissions = requestedPermissions.filter((permission) => !effectivePermissionSet.has(permission));
|
|
316
|
-
if (excessivePermissions.length > 0) {
|
|
317
|
-
throw new ForbiddenException(`${message}: ${excessivePermissions.join(", ")}`);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
get apiKeyEntity() {
|
|
321
|
-
return this.authOptions.entities.apiKey;
|
|
322
|
-
}
|
|
323
|
-
get userEntity() {
|
|
324
|
-
return this.authOptions.entities.user;
|
|
325
|
-
}
|
|
326
|
-
get workspaceEntity() {
|
|
327
|
-
return this.authOptions.entities.workspace;
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
ApiKeyService = ApiKeyService_1 = __decorate([
|
|
331
|
-
Injectable(),
|
|
332
|
-
__param(1, Inject(MODULE_OPTIONS_TOKEN)),
|
|
333
|
-
__metadata("design:paramtypes", [EntityManager, Object, AccessControlService])
|
|
334
|
-
], ApiKeyService);
|
|
335
|
-
export { ApiKeyService };
|
|
336
|
-
//# sourceMappingURL=api-key.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"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5C,WAA8B;QAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC9C,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,IAAI,CAAC,uBAAuB,CAC1B,WAAW,EACX,MAAM,CAAC,WAAW,IAAI,EAAE,EACxB,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAEO,uBAAuB,CAC7B,oBAAuC,EACvC,oBAAuC,EACvC,OAAe;QAEf,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAC7D,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,MAAM,CACtD,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,sBAAsB,CAAC,GAAG,CAAC,UAAU,CAAC,CACxD,CAAC;QACF,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,kBAAkB,CAC1B,GAAG,OAAO,KAAK,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACjD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAY,YAAY;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAA6B,CAAC;IACjE,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAyB,CAAC;IAC7D,CAAC;IAED,IAAY,eAAe;QACzB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAmC,CAAC;IACvE,CAAC;CACF,CAAA;AA1dY,aAAa;IADzB,UAAU,EAAE;IAYR,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;qCADN,aAAa,UAGG,oBAAoB;GAblD,aAAa,CA0dzB"}
|
package/dist/auth.service.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { AuthAccessToken, AuthAccount, AuthAccountInfo, AuthAccountSelector, AuthProviderUserInfo, AuthRefreshedToken, AuthSocialProvider, AuthUser, ChangeAuthEmailOptions, ChangeAuthPasswordOptions, ChangeAuthPasswordResult, DeleteAuthUserOptions, DeleteAuthUserResult, LinkAuthSocialAccountOptions, LinkAuthSocialAccountResult, RequestPasswordResetOptions, RequestPasswordResetResult, ResetPasswordOptions, SendVerificationEmailOptions, SignInOptions, SignInResult, SignInSocialOptions, SignInSocialResult, SignUpOptions, SignUpResult, UnlinkAuthAccountOptions, UpdateAuthUserOptions } from "./interfaces/auth-service.interface.js";
|
|
2
|
-
export declare class AuthService {
|
|
3
|
-
constructor(auth: unknown);
|
|
4
|
-
private readonly auth;
|
|
5
|
-
listSocialProviders(): Promise<AuthSocialProvider[]>;
|
|
6
|
-
signUp<User extends AuthUser = AuthUser>(options: SignUpOptions): Promise<SignUpResult<User>>;
|
|
7
|
-
signIn<User extends AuthUser = AuthUser>(options: SignInOptions): Promise<SignInResult<User>>;
|
|
8
|
-
signInSocial<User extends AuthUser = AuthUser>(options: SignInSocialOptions): Promise<SignInSocialResult<User>>;
|
|
9
|
-
signOut(): Promise<boolean>;
|
|
10
|
-
sendVerificationEmail(options: SendVerificationEmailOptions): Promise<boolean>;
|
|
11
|
-
requestPasswordReset(options: RequestPasswordResetOptions): Promise<RequestPasswordResetResult>;
|
|
12
|
-
resetPassword(options: ResetPasswordOptions): Promise<boolean>;
|
|
13
|
-
verifyPassword(password: string): Promise<boolean>;
|
|
14
|
-
updateUser(options: UpdateAuthUserOptions): Promise<boolean>;
|
|
15
|
-
changeEmail(options: ChangeAuthEmailOptions): Promise<boolean>;
|
|
16
|
-
changePassword(options: ChangeAuthPasswordOptions): Promise<ChangeAuthPasswordResult>;
|
|
17
|
-
setPassword(newPassword: string): Promise<boolean>;
|
|
18
|
-
deleteUser(options?: DeleteAuthUserOptions): Promise<DeleteAuthUserResult>;
|
|
19
|
-
listAccounts(): Promise<AuthAccount[]>;
|
|
20
|
-
linkSocialAccount(options: LinkAuthSocialAccountOptions): Promise<LinkAuthSocialAccountResult>;
|
|
21
|
-
unlinkAccount(options: UnlinkAuthAccountOptions): Promise<boolean>;
|
|
22
|
-
getAccessToken(selector: AuthAccountSelector): Promise<AuthAccessToken>;
|
|
23
|
-
refreshToken(selector: AuthAccountSelector): Promise<AuthRefreshedToken>;
|
|
24
|
-
accountInfo<UserInfo extends AuthProviderUserInfo = AuthProviderUserInfo, Data extends object = Record<string, unknown>>(selector: AuthAccountSelector): Promise<AuthAccountInfo<UserInfo, Data>>;
|
|
25
|
-
private normalizeSignInResult;
|
|
26
|
-
private normalizeSignInSocialResult;
|
|
27
|
-
}
|
package/dist/auth.service.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
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 } from "@nest-boot/request-context";
|
|
14
|
-
import { Inject, Injectable } from "@nestjs/common";
|
|
15
|
-
import { AUTH_TOKEN } from "./auth.constants.js";
|
|
16
|
-
import { applyAuthResponseCookies } from "./utils/apply-auth-response-cookies.util.js";
|
|
17
|
-
let AuthService = class AuthService {
|
|
18
|
-
constructor(auth) {
|
|
19
|
-
this.auth = auth;
|
|
20
|
-
}
|
|
21
|
-
auth;
|
|
22
|
-
async listSocialProviders() {
|
|
23
|
-
const context = await this.auth.$context;
|
|
24
|
-
return context.socialProviders.map(({ id, name }) => ({
|
|
25
|
-
id,
|
|
26
|
-
name,
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
async signUp(options) {
|
|
30
|
-
const result = await this.auth.api.signUpEmail({
|
|
31
|
-
body: options,
|
|
32
|
-
headers: headers(),
|
|
33
|
-
returnHeaders: true,
|
|
34
|
-
});
|
|
35
|
-
applyAuthResponseCookies(result.headers);
|
|
36
|
-
return result.response;
|
|
37
|
-
}
|
|
38
|
-
async signIn(options) {
|
|
39
|
-
const result = await this.auth.api.signInEmail({
|
|
40
|
-
body: options,
|
|
41
|
-
headers: headers(),
|
|
42
|
-
returnHeaders: true,
|
|
43
|
-
});
|
|
44
|
-
applyAuthResponseCookies(result.headers);
|
|
45
|
-
return this.normalizeSignInResult(result.response);
|
|
46
|
-
}
|
|
47
|
-
async signInSocial(options) {
|
|
48
|
-
const result = await this.auth.api.signInSocial({
|
|
49
|
-
body: options,
|
|
50
|
-
headers: headers(),
|
|
51
|
-
returnHeaders: true,
|
|
52
|
-
});
|
|
53
|
-
applyAuthResponseCookies(result.headers);
|
|
54
|
-
return this.normalizeSignInSocialResult(result.response);
|
|
55
|
-
}
|
|
56
|
-
async signOut() {
|
|
57
|
-
const result = await this.auth.api.signOut({
|
|
58
|
-
headers: headers(),
|
|
59
|
-
returnHeaders: true,
|
|
60
|
-
});
|
|
61
|
-
applyAuthResponseCookies(result.headers);
|
|
62
|
-
return result.response.success;
|
|
63
|
-
}
|
|
64
|
-
async sendVerificationEmail(options) {
|
|
65
|
-
const result = await this.auth.api.sendVerificationEmail({ body: options });
|
|
66
|
-
return result.status;
|
|
67
|
-
}
|
|
68
|
-
async requestPasswordReset(options) {
|
|
69
|
-
return await this.auth.api.requestPasswordReset({ body: options });
|
|
70
|
-
}
|
|
71
|
-
async resetPassword(options) {
|
|
72
|
-
const result = await this.auth.api.resetPassword({ body: options });
|
|
73
|
-
return result.status;
|
|
74
|
-
}
|
|
75
|
-
async verifyPassword(password) {
|
|
76
|
-
const result = await this.auth.api.verifyPassword({
|
|
77
|
-
body: { password },
|
|
78
|
-
headers: headers(),
|
|
79
|
-
});
|
|
80
|
-
return result.status;
|
|
81
|
-
}
|
|
82
|
-
async updateUser(options) {
|
|
83
|
-
const result = await this.auth.api.updateUser({
|
|
84
|
-
body: options,
|
|
85
|
-
headers: headers(),
|
|
86
|
-
returnHeaders: true,
|
|
87
|
-
});
|
|
88
|
-
applyAuthResponseCookies(result.headers);
|
|
89
|
-
return result.response.status;
|
|
90
|
-
}
|
|
91
|
-
async changeEmail(options) {
|
|
92
|
-
const result = await this.auth.api.changeEmail({
|
|
93
|
-
body: options,
|
|
94
|
-
headers: headers(),
|
|
95
|
-
returnHeaders: true,
|
|
96
|
-
});
|
|
97
|
-
applyAuthResponseCookies(result.headers);
|
|
98
|
-
return result.response.status;
|
|
99
|
-
}
|
|
100
|
-
async changePassword(options) {
|
|
101
|
-
const result = await this.auth.api.changePassword({
|
|
102
|
-
body: options,
|
|
103
|
-
headers: headers(),
|
|
104
|
-
returnHeaders: true,
|
|
105
|
-
});
|
|
106
|
-
applyAuthResponseCookies(result.headers);
|
|
107
|
-
return { token: result.response.token };
|
|
108
|
-
}
|
|
109
|
-
async setPassword(newPassword) {
|
|
110
|
-
const result = await this.auth.api.setPassword({
|
|
111
|
-
body: { newPassword },
|
|
112
|
-
headers: headers(),
|
|
113
|
-
});
|
|
114
|
-
return result.status;
|
|
115
|
-
}
|
|
116
|
-
async deleteUser(options) {
|
|
117
|
-
const result = await this.auth.api.deleteUser({
|
|
118
|
-
body: options ?? {},
|
|
119
|
-
headers: headers(),
|
|
120
|
-
returnHeaders: true,
|
|
121
|
-
});
|
|
122
|
-
applyAuthResponseCookies(result.headers);
|
|
123
|
-
return result.response;
|
|
124
|
-
}
|
|
125
|
-
async listAccounts() {
|
|
126
|
-
return await this.auth.api.listUserAccounts({ headers: headers() });
|
|
127
|
-
}
|
|
128
|
-
async linkSocialAccount(options) {
|
|
129
|
-
const result = await this.auth.api.linkSocialAccount({
|
|
130
|
-
body: options,
|
|
131
|
-
headers: headers(),
|
|
132
|
-
returnHeaders: true,
|
|
133
|
-
});
|
|
134
|
-
applyAuthResponseCookies(result.headers);
|
|
135
|
-
return result.response;
|
|
136
|
-
}
|
|
137
|
-
async unlinkAccount(options) {
|
|
138
|
-
const result = await this.auth.api.unlinkAccount({
|
|
139
|
-
body: options,
|
|
140
|
-
headers: headers(),
|
|
141
|
-
});
|
|
142
|
-
return result.status;
|
|
143
|
-
}
|
|
144
|
-
async getAccessToken(selector) {
|
|
145
|
-
const result = await this.auth.api.getAccessToken({
|
|
146
|
-
body: selector,
|
|
147
|
-
headers: headers(),
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
accessToken: result.accessToken,
|
|
151
|
-
accessTokenExpiresAt: result.accessTokenExpiresAt ?? null,
|
|
152
|
-
scopes: result.scopes,
|
|
153
|
-
idToken: result.idToken ?? null,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
async refreshToken(selector) {
|
|
157
|
-
const result = await this.auth.api.refreshToken({
|
|
158
|
-
body: selector,
|
|
159
|
-
headers: headers(),
|
|
160
|
-
});
|
|
161
|
-
return {
|
|
162
|
-
accessToken: result.accessToken ?? null,
|
|
163
|
-
refreshToken: result.refreshToken,
|
|
164
|
-
accessTokenExpiresAt: result.accessTokenExpiresAt ?? null,
|
|
165
|
-
refreshTokenExpiresAt: result.refreshTokenExpiresAt ?? null,
|
|
166
|
-
scope: result.scope ?? null,
|
|
167
|
-
idToken: result.idToken ?? null,
|
|
168
|
-
providerId: result.providerId,
|
|
169
|
-
accountId: result.accountId,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
async accountInfo(selector) {
|
|
173
|
-
return (await this.auth.api.accountInfo({
|
|
174
|
-
query: selector,
|
|
175
|
-
headers: headers(),
|
|
176
|
-
}));
|
|
177
|
-
}
|
|
178
|
-
normalizeSignInResult(result) {
|
|
179
|
-
return {
|
|
180
|
-
...result,
|
|
181
|
-
url: result.url ?? null,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
normalizeSignInSocialResult(result) {
|
|
185
|
-
return {
|
|
186
|
-
redirect: result.redirect,
|
|
187
|
-
url: result.url ?? null,
|
|
188
|
-
token: result.token ?? null,
|
|
189
|
-
user: result.user ?? null,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
AuthService = __decorate([
|
|
194
|
-
Injectable(),
|
|
195
|
-
__param(0, Inject(AUTH_TOKEN)),
|
|
196
|
-
__metadata("design:paramtypes", [Object])
|
|
197
|
-
], AuthService);
|
|
198
|
-
export { AuthService };
|
|
199
|
-
//# sourceMappingURL=auth.service.js.map
|
package/dist/auth.service.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../src/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA8BjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AA0HhF,IAAM,WAAW,GAAjB,MAAM,WAAW;IAKtB,YAAgC,IAAa;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAoB,CAAC;IACnC,CAAC;IAEgB,IAAI,CAAe;IAGpC,KAAK,CAAC,mBAAmB;QACvB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QACzC,OAAO,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;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kspaceMember: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { RequestContext } from "@nest-boot/request-context";
|
|
2
|
-
import { createParamDecorator } from "@nestjs/common";
|
|
3
|
-
import { BaseWorkspaceMember } from "../entities/index.js";
|
|
4
|
-
export const CurrentWorkspaceMember = createParamDecorator(() => RequestContext.get(BaseWorkspaceMember));
|
|
5
|
-
//# sourceMappingURL=current-workspace-member.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"current-workspace-member.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-workspace-member.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,GAAG,EAAE,CAC9D,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,CACxC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BaseEntity, type Opt, type Ref } from "@mikro-orm/core";
|
|
2
|
-
import { BaseUser } from "./user.entity.js";
|
|
3
|
-
import { BaseWorkspace } from "./workspace.entity.js";
|
|
4
|
-
export declare class BaseApiKey extends BaseEntity {
|
|
5
|
-
id: Opt<string>;
|
|
6
|
-
name: string;
|
|
7
|
-
start?: Opt<string> | null;
|
|
8
|
-
prefix?: Opt<string> | null;
|
|
9
|
-
key: string;
|
|
10
|
-
enabled: Opt<boolean>;
|
|
11
|
-
permissions: Opt<string[]>;
|
|
12
|
-
createdAt: Opt<Date>;
|
|
13
|
-
updatedAt: Opt<Date>;
|
|
14
|
-
lastUsedAt?: Opt<Date> | null;
|
|
15
|
-
expiresAt?: Opt<Date> | null;
|
|
16
|
-
owner: Ref<BaseUser | BaseWorkspace>;
|
|
17
|
-
}
|