@contember/engine-tenant-api 2.0.0-alpha.8 → 2.0.0-beta.1
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/dist/development/index.cjs +18 -6
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +20 -8
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/TenantContainer.cjs +7 -1
- package/dist/development/src/TenantContainer.cjs.map +1 -1
- package/dist/development/src/TenantContainer.js +7 -1
- package/dist/development/src/TenantContainer.js.map +1 -1
- package/dist/development/src/bridges/system/IdentityFetcher.cjs.map +1 -1
- package/dist/development/src/bridges/system/IdentityFetcher.js.map +1 -1
- package/dist/development/src/exceptions.cjs.map +1 -1
- package/dist/development/src/exceptions.js.map +1 -1
- package/dist/development/src/migrations/2024-08-26-120000-passwordless.cjs +31 -0
- package/dist/development/src/migrations/2024-08-26-120000-passwordless.cjs.map +1 -0
- package/dist/development/src/migrations/2024-08-26-120000-passwordless.js +32 -0
- package/dist/development/src/migrations/2024-08-26-120000-passwordless.js.map +1 -0
- package/dist/development/src/migrations/runner.cjs +3 -1
- package/dist/development/src/migrations/runner.cjs.map +1 -1
- package/dist/development/src/migrations/runner.js +3 -1
- package/dist/development/src/migrations/runner.js.map +1 -1
- package/dist/development/src/migrations/snapshot.cjs +33 -5
- package/dist/development/src/migrations/snapshot.cjs.map +1 -1
- package/dist/development/src/migrations/snapshot.js +33 -5
- package/dist/development/src/migrations/snapshot.js.map +1 -1
- package/dist/development/src/migrations/tenantCredentials.cjs.map +1 -1
- package/dist/development/src/migrations/tenantCredentials.js.map +1 -1
- package/dist/development/src/model/authorization/AclSchemaAccessNodeFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/AclSchemaAccessNodeFactory.js.map +1 -1
- package/dist/development/src/model/authorization/DirectPermissionsAccessNode.cjs.map +1 -1
- package/dist/development/src/model/authorization/DirectPermissionsAccessNode.js.map +1 -1
- package/dist/development/src/model/authorization/Identity.cjs.map +1 -1
- package/dist/development/src/model/authorization/Identity.js.map +1 -1
- package/dist/development/src/model/authorization/IdentityFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/IdentityFactory.js.map +1 -1
- package/dist/development/src/model/authorization/IdentityScope.cjs.map +1 -1
- package/dist/development/src/model/authorization/IdentityScope.js.map +1 -1
- package/dist/development/src/model/authorization/MembershipMatcher.cjs.map +1 -1
- package/dist/development/src/model/authorization/MembershipMatcher.js.map +1 -1
- package/dist/development/src/model/authorization/PermissionActions.cjs +5 -0
- package/dist/development/src/model/authorization/PermissionActions.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionActions.js +5 -0
- package/dist/development/src/model/authorization/PermissionActions.js.map +1 -1
- package/dist/development/src/model/authorization/PermissionContext.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionContext.js.map +1 -1
- package/dist/development/src/model/authorization/PermissionContextFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionContextFactory.js.map +1 -1
- package/dist/development/src/model/authorization/PermissionsFactory.cjs +5 -0
- package/dist/development/src/model/authorization/PermissionsFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/PermissionsFactory.js +5 -0
- package/dist/development/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/development/src/model/authorization/ProjectScope.cjs.map +1 -1
- package/dist/development/src/model/authorization/ProjectScope.js.map +1 -1
- package/dist/development/src/model/authorization/ProjectScopeFactory.cjs.map +1 -1
- package/dist/development/src/model/authorization/ProjectScopeFactory.js.map +1 -1
- package/dist/development/src/model/commands/CommandBus.cjs.map +1 -1
- package/dist/development/src/model/commands/CommandBus.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/ApiKeyHelper.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/ApiKeyHelper.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/CreateApiKeyCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/CreateApiKeyCommand.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/DisableApiKeyCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/DisableApiKeyCommand.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/DisableIdentityApiKeysCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/DisableIdentityApiKeysCommand.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/DisableOneOffApiKeyCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/DisableOneOffApiKeyCommand.js.map +1 -1
- package/dist/development/src/model/commands/apiKey/ProlongApiKeyCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/apiKey/ProlongApiKeyCommand.js.map +1 -1
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.cjs +20 -0
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.js +20 -0
- package/dist/development/src/model/commands/configuration/UpdateConfigurationCommand.js.map +1 -0
- package/dist/development/src/model/commands/identity/CreateIdentityCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/identity/CreateIdentityCommand.js.map +1 -1
- package/dist/development/src/model/commands/identity/PatchIdentityGlobalRoles.cjs.map +1 -1
- package/dist/development/src/model/commands/identity/PatchIdentityGlobalRoles.js.map +1 -1
- package/dist/development/src/model/commands/idp/CreateIdpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/CreateIdpCommand.js.map +1 -1
- package/dist/development/src/model/commands/idp/DisableIdpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/DisableIdpCommand.js.map +1 -1
- package/dist/development/src/model/commands/idp/EnableIdpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/EnableIdpCommand.js.map +1 -1
- package/dist/development/src/model/commands/idp/UpdateIdpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/idp/UpdateIdpCommand.js.map +1 -1
- package/dist/development/src/model/commands/mailTemplate/AddMailTemplateCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/mailTemplate/AddMailTemplateCommand.js.map +1 -1
- package/dist/development/src/model/commands/mailTemplate/RemoveMailTemplateCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/mailTemplate/RemoveMailTemplateCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/AddProjectMemberCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/AddProjectMemberCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/CreateOrUpdateProjectMembershipCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/CreateOrUpdateProjectMembershipCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/RemoveProjectMemberCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/RemoveProjectMemberCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/RemoveProjectMembershipsCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/RemoveProjectMembershipsCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/UpdateProjectMemberCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/variables/PatchProjectMembershipVariableValuesCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/variables/PatchProjectMembershipVariableValuesCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/variables/PatchProjectMembershipVariablesCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/variables/PatchProjectMembershipVariablesCommand.js.map +1 -1
- package/dist/development/src/model/commands/membership/variables/SetProjectMembershipVariableValuesCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/membership/variables/SetProjectMembershipVariableValuesCommand.js.map +1 -1
- package/dist/development/src/model/commands/otp/ConfirmOtpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/otp/ConfirmOtpCommand.js.map +1 -1
- package/dist/development/src/model/commands/otp/DisableOtpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/otp/DisableOtpCommand.js.map +1 -1
- package/dist/development/src/model/commands/otp/PrepareOtpCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/otp/PrepareOtpCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/ChangePasswordCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/person/ChangePasswordCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/ChangeProfileCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/person/ChangeProfileCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/CreatePersonCommand.cjs +2 -1
- package/dist/development/src/model/commands/person/CreatePersonCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/person/CreatePersonCommand.js +2 -1
- package/dist/development/src/model/commands/person/CreatePersonCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/CreatePersonIdentityProviderIdentifierCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/person/CreatePersonIdentityProviderIdentifierCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/DisablePersonCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/person/DisablePersonCommand.js.map +1 -1
- package/dist/development/src/model/commands/person/TogglePersonPasswordlessCommand.cjs +18 -0
- package/dist/development/src/model/commands/person/TogglePersonPasswordlessCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/person/TogglePersonPasswordlessCommand.js +18 -0
- package/dist/development/src/model/commands/person/TogglePersonPasswordlessCommand.js.map +1 -0
- package/dist/development/src/model/commands/personToken/ActivateOtpCommand.cjs +20 -0
- package/dist/development/src/model/commands/personToken/ActivateOtpCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/personToken/ActivateOtpCommand.js +20 -0
- package/dist/development/src/model/commands/personToken/ActivateOtpCommand.js.map +1 -0
- package/dist/development/src/model/commands/personToken/CreatePersonTokenCommand.cjs +33 -0
- package/dist/development/src/model/commands/personToken/CreatePersonTokenCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/personToken/CreatePersonTokenCommand.js +33 -0
- package/dist/development/src/model/commands/personToken/CreatePersonTokenCommand.js.map +1 -0
- package/dist/development/src/model/commands/personToken/IncreaseOtpAttemptCommand.cjs +19 -0
- package/dist/development/src/model/commands/personToken/IncreaseOtpAttemptCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/personToken/IncreaseOtpAttemptCommand.js +19 -0
- package/dist/development/src/model/commands/personToken/IncreaseOtpAttemptCommand.js.map +1 -0
- package/dist/development/src/model/commands/personToken/InvalidateTokenCommand.cjs +19 -0
- package/dist/development/src/model/commands/personToken/InvalidateTokenCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/personToken/InvalidateTokenCommand.js +19 -0
- package/dist/development/src/model/commands/personToken/InvalidateTokenCommand.js.map +1 -0
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.cjs +28 -0
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.js +28 -0
- package/dist/development/src/model/commands/personToken/ResetPasswordCommand.js.map +1 -0
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.cjs +28 -0
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.cjs.map +1 -0
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.js +28 -0
- package/dist/development/src/model/commands/personToken/SavePersonTokenCommand.js.map +1 -0
- package/dist/development/src/model/commands/project/CreateProjectCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/project/CreateProjectCommand.js.map +1 -1
- package/dist/development/src/model/commands/project/SetProjectSecretCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/project/SetProjectSecretCommand.js.map +1 -1
- package/dist/development/src/model/commands/project/UpdateProjectCommand.cjs.map +1 -1
- package/dist/development/src/model/commands/project/UpdateProjectCommand.js.map +1 -1
- package/dist/development/src/model/consts/expirations.cjs +7 -0
- package/dist/development/src/model/consts/expirations.cjs.map +1 -0
- package/dist/development/src/model/consts/expirations.js +7 -0
- package/dist/development/src/model/consts/expirations.js.map +1 -0
- package/dist/development/src/model/dtos/Password.cjs.map +1 -1
- package/dist/development/src/model/dtos/Password.js.map +1 -1
- package/dist/development/src/model/mailing/UserMailer.cjs +10 -1
- package/dist/development/src/model/mailing/UserMailer.cjs.map +1 -1
- package/dist/development/src/model/mailing/UserMailer.js +10 -1
- package/dist/development/src/model/mailing/UserMailer.js.map +1 -1
- package/dist/development/src/model/mailing/templates/ExistingUserInvited.mustache.cjs.map +1 -1
- package/dist/development/src/model/mailing/templates/ExistingUserInvited.mustache.js.map +1 -1
- package/dist/development/src/model/mailing/templates/NewUserInvited.mustache.cjs.map +1 -1
- package/dist/development/src/model/mailing/templates/NewUserInvited.mustache.js.map +1 -1
- package/dist/development/src/model/mailing/templates/PasswordReset.mustache.cjs.map +1 -1
- package/dist/development/src/model/mailing/templates/PasswordReset.mustache.js.map +1 -1
- package/dist/development/src/model/mailing/templates/PasswordlessSignIn.mustache.cjs +17 -0
- package/dist/development/src/model/mailing/templates/PasswordlessSignIn.mustache.cjs.map +1 -0
- package/dist/development/src/model/mailing/templates/PasswordlessSignIn.mustache.js +18 -0
- package/dist/development/src/model/mailing/templates/PasswordlessSignIn.mustache.js.map +1 -0
- package/dist/development/src/model/mailing/type.cjs +9 -3
- package/dist/development/src/model/mailing/type.cjs.map +1 -1
- package/dist/development/src/model/mailing/type.js +9 -3
- package/dist/development/src/model/mailing/type.js.map +1 -1
- package/dist/development/src/model/queries/apiKey/ApiKeyQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/apiKey/ApiKeyQuery.js.map +1 -1
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.cjs +21 -0
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.cjs.map +1 -0
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.js +21 -0
- package/dist/development/src/model/queries/configuration/ConfigurationQuery.js.map +1 -0
- package/dist/development/src/model/queries/identity/IdentityQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/identity/IdentityQuery.js.map +1 -1
- package/dist/development/src/model/queries/idp/IdentityProviderBySlugQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/idp/IdentityProviderBySlugQuery.js.map +1 -1
- package/dist/development/src/model/queries/idp/IdentityProvidersQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/idp/IdentityProvidersQuery.js.map +1 -1
- package/dist/development/src/model/queries/idp/helpers.cjs.map +1 -1
- package/dist/development/src/model/queries/idp/helpers.js.map +1 -1
- package/dist/development/src/model/queries/mailTemplate/MailTemplateListQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/mailTemplate/MailTemplateListQuery.js.map +1 -1
- package/dist/development/src/model/queries/mailTemplate/MailTemplateQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/mailTemplate/MailTemplateQuery.js.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectMembersQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectMembersQuery.js.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectMembershipByIdentityQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectMembershipByIdentityQuery.js.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectRolesByIdentityQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectRolesByIdentityQuery.js.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectSlugSpecification.cjs.map +1 -1
- package/dist/development/src/model/queries/membership/ProjectSlugSpecification.js.map +1 -1
- package/dist/development/src/model/queries/person/PersonByIdPQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/person/PersonByIdPQuery.js.map +1 -1
- package/dist/development/src/model/queries/person/PersonByIdentityBatchQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/person/PersonByIdentityBatchQuery.js.map +1 -1
- package/dist/development/src/model/queries/person/PersonQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/person/PersonQuery.js.map +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.cjs +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.js +1 -1
- package/dist/development/src/model/queries/person/PersonQueryBuilderFactory.js.map +1 -1
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.cjs +29 -0
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.cjs.map +1 -0
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.js +29 -0
- package/dist/development/src/model/queries/personToken/PersonTokenQuery.js.map +1 -0
- package/dist/development/src/model/queries/project/ProjectBySlugQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/project/ProjectBySlugQuery.js.map +1 -1
- package/dist/development/src/model/queries/project/ProjectSecretsQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/project/ProjectSecretsQuery.js.map +1 -1
- package/dist/development/src/model/queries/project/ProjectUpdateTimestampQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/project/ProjectUpdateTimestampQuery.js.map +1 -1
- package/dist/development/src/model/queries/project/ProjectsByIdentityQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/project/ProjectsByIdentityQuery.js.map +1 -1
- package/dist/development/src/model/queries/project/ProjectsQuery.cjs.map +1 -1
- package/dist/development/src/model/queries/project/ProjectsQuery.js.map +1 -1
- package/dist/development/src/model/service/ConfigurationManager.cjs +27 -0
- package/dist/development/src/model/service/ConfigurationManager.cjs.map +1 -0
- package/dist/development/src/model/service/ConfigurationManager.js +27 -0
- package/dist/development/src/model/service/ConfigurationManager.js.map +1 -0
- package/dist/development/src/model/service/EmailValidator.cjs.map +1 -1
- package/dist/development/src/model/service/EmailValidator.js.map +1 -1
- package/dist/development/src/model/service/IDPSignInManager.cjs +1 -1
- package/dist/development/src/model/service/IDPSignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/IDPSignInManager.js +1 -1
- package/dist/development/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/development/src/model/service/InviteManager.cjs +7 -7
- package/dist/development/src/model/service/InviteManager.cjs.map +1 -1
- package/dist/development/src/model/service/InviteManager.js +6 -6
- package/dist/development/src/model/service/InviteManager.js.map +1 -1
- package/dist/development/src/model/service/MailTemplateManager.cjs.map +1 -1
- package/dist/development/src/model/service/MailTemplateManager.js.map +1 -1
- package/dist/development/src/model/service/MembershipValidator.cjs.map +1 -1
- package/dist/development/src/model/service/MembershipValidator.js.map +1 -1
- package/dist/development/src/model/service/OtpAuthenticator.cjs.map +1 -1
- package/dist/development/src/model/service/OtpAuthenticator.js.map +1 -1
- package/dist/development/src/model/service/OtpManager.cjs.map +1 -1
- package/dist/development/src/model/service/OtpManager.js.map +1 -1
- package/dist/development/src/model/service/PasswordChangeManager.cjs +1 -1
- package/dist/development/src/model/service/PasswordChangeManager.cjs.map +1 -1
- package/dist/development/src/model/service/PasswordChangeManager.js +1 -1
- package/dist/development/src/model/service/PasswordChangeManager.js.map +1 -1
- package/dist/development/src/model/service/PasswordResetManager.cjs +7 -15
- package/dist/development/src/model/service/PasswordResetManager.cjs.map +1 -1
- package/dist/development/src/model/service/PasswordResetManager.js +7 -15
- package/dist/development/src/model/service/PasswordResetManager.js.map +1 -1
- package/dist/development/src/model/service/PasswordlessSignInManager.cjs +135 -0
- package/dist/development/src/model/service/PasswordlessSignInManager.cjs.map +1 -0
- package/dist/development/src/model/service/PasswordlessSignInManager.js +135 -0
- package/dist/development/src/model/service/PasswordlessSignInManager.js.map +1 -0
- package/dist/development/src/model/service/PersonAccessManager.cjs.map +1 -1
- package/dist/development/src/model/service/PersonAccessManager.js.map +1 -1
- package/dist/development/src/model/service/PersonManager.cjs +7 -0
- package/dist/development/src/model/service/PersonManager.cjs.map +1 -1
- package/dist/development/src/model/service/PersonManager.js +7 -0
- package/dist/development/src/model/service/PersonManager.js.map +1 -1
- package/dist/development/src/model/service/ProjectManager.cjs +2 -2
- package/dist/development/src/model/service/ProjectManager.cjs.map +1 -1
- package/dist/development/src/model/service/ProjectManager.js +2 -2
- package/dist/development/src/model/service/ProjectManager.js.map +1 -1
- package/dist/development/src/model/service/ProjectMemberManager.cjs.map +1 -1
- package/dist/development/src/model/service/ProjectMemberManager.js.map +1 -1
- package/dist/development/src/model/service/RolesManager.cjs +1 -1
- package/dist/development/src/model/service/RolesManager.cjs.map +1 -1
- package/dist/development/src/model/service/RolesManager.js +1 -1
- package/dist/development/src/model/service/RolesManager.js.map +1 -1
- package/dist/development/src/model/service/SecretsManager.cjs.map +1 -1
- package/dist/development/src/model/service/SecretsManager.js.map +1 -1
- package/dist/development/src/model/service/SignInManager.cjs.map +1 -1
- package/dist/development/src/model/service/SignInManager.js.map +1 -1
- package/dist/development/src/model/service/SignUpManager.cjs +1 -1
- package/dist/development/src/model/service/SignUpManager.cjs.map +1 -1
- package/dist/development/src/model/service/SignUpManager.js +1 -1
- package/dist/development/src/model/service/SignUpManager.js.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyService.cjs.map +1 -1
- package/dist/development/src/model/service/apiKey/ApiKeyService.js.map +1 -1
- package/dist/development/src/model/service/helpers/getPreferredProject.cjs +13 -0
- package/dist/development/src/model/service/helpers/getPreferredProject.cjs.map +1 -0
- package/dist/development/src/model/service/helpers/getPreferredProject.js +13 -0
- package/dist/development/src/model/service/helpers/getPreferredProject.js.map +1 -0
- package/dist/development/src/model/service/idp/IDPHandlerRegistry.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IDPHandlerRegistry.js.map +1 -1
- package/dist/development/src/model/service/idp/IDPManager.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/development/src/model/service/idp/IDPResponseError.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IDPResponseError.js.map +1 -1
- package/dist/development/src/model/service/idp/IDPValidationError.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IDPValidationError.js.map +1 -1
- package/dist/development/src/model/service/idp/IdentityProviderNotFoundError.cjs.map +1 -1
- package/dist/development/src/model/service/idp/IdentityProviderNotFoundError.js.map +1 -1
- package/dist/development/src/model/service/idp/InvalidIDPConfigurationError.cjs.map +1 -1
- package/dist/development/src/model/service/idp/InvalidIDPConfigurationError.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/AppleProvider.cjs +1 -1
- package/dist/development/src/model/service/idp/providers/AppleProvider.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/AppleProvider.js +1 -1
- package/dist/development/src/model/service/idp/providers/AppleProvider.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/FacebookProvider.cjs +1 -1
- package/dist/development/src/model/service/idp/providers/FacebookProvider.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/FacebookProvider.js +1 -1
- package/dist/development/src/model/service/idp/providers/FacebookProvider.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs +9 -5
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.js +9 -5
- package/dist/development/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs +9 -3
- package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.js +9 -3
- package/dist/development/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.cjs +6 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.js +6 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/helpers.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/helpers.js.map +1 -1
- package/dist/development/src/model/service/membershipUtils.cjs.map +1 -1
- package/dist/development/src/model/service/membershipUtils.js.map +1 -1
- package/dist/development/src/model/type/ApiKey.cjs.map +1 -1
- package/dist/development/src/model/type/ApiKey.js.map +1 -1
- package/dist/development/src/model/utils/DatabaseContext.cjs.map +1 -1
- package/dist/development/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/development/src/model/utils/Response.cjs.map +1 -1
- package/dist/development/src/model/utils/Response.js.map +1 -1
- package/dist/development/src/model/utils/password.cjs.map +1 -1
- package/dist/development/src/model/utils/password.js.map +1 -1
- package/dist/development/src/model/utils/tokenUtils.cjs +39 -0
- package/dist/development/src/model/utils/tokenUtils.cjs.map +1 -1
- package/dist/development/src/model/utils/tokenUtils.js +40 -1
- package/dist/development/src/model/utils/tokenUtils.js.map +1 -1
- package/dist/development/src/resolvers/ResolverFactory.cjs +8 -1
- package/dist/development/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/ResolverFactory.js +8 -1
- package/dist/development/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/development/src/resolvers/TenantResolverContextFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/TenantResolverContextFactory.js.map +1 -1
- package/dist/development/src/resolvers/errorUtils.cjs.map +1 -1
- package/dist/development/src/resolvers/errorUtils.js.map +1 -1
- package/dist/development/src/resolvers/membershipUtils.cjs.map +1 -1
- package/dist/development/src/resolvers/membershipUtils.js.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +41 -0
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +41 -0
- package/dist/development/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -0
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs +4 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js +4 -1
- package/dist/development/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +83 -0
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js +83 -0
- package/dist/development/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -0
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +52 -0
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +52 -0
- package/dist/development/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -0
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs +34 -0
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -0
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js +34 -0
- package/dist/development/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -0
- package/dist/development/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/IDPQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/MeQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/MeQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/PersonQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.cjs +1 -0
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.js +1 -0
- package/dist/development/src/resolvers/responseHelpers/PersonResponseFactory.js.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
- package/dist/development/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
- package/dist/development/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
- package/dist/development/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
- package/dist/development/src/schema/tenant.graphql.cjs +162 -10
- package/dist/development/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/development/src/schema/tenant.graphql.js +162 -10
- package/dist/development/src/schema/tenant.graphql.js.map +1 -1
- package/dist/development/src/utils/Mailer.cjs.map +1 -1
- package/dist/development/src/utils/Mailer.js.map +1 -1
- package/dist/development/src/utils/TemplateRenderer.cjs.map +1 -1
- package/dist/development/src/utils/TemplateRenderer.js.map +1 -1
- package/dist/development/src/utils/array.cjs.map +1 -1
- package/dist/development/src/utils/array.js.map +1 -1
- package/dist/development/src/utils/batchQuery.cjs.map +1 -1
- package/dist/development/src/utils/batchQuery.js.map +1 -1
- package/dist/production/index.cjs +18 -6
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +20 -8
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/TenantContainer.cjs +7 -1
- package/dist/production/src/TenantContainer.cjs.map +1 -1
- package/dist/production/src/TenantContainer.js +7 -1
- package/dist/production/src/TenantContainer.js.map +1 -1
- package/dist/production/src/bridges/system/IdentityFetcher.cjs.map +1 -1
- package/dist/production/src/bridges/system/IdentityFetcher.js.map +1 -1
- package/dist/production/src/exceptions.cjs.map +1 -1
- package/dist/production/src/exceptions.js.map +1 -1
- package/dist/production/src/migrations/2024-08-26-120000-passwordless.cjs +31 -0
- package/dist/production/src/migrations/2024-08-26-120000-passwordless.cjs.map +1 -0
- package/dist/production/src/migrations/2024-08-26-120000-passwordless.js +32 -0
- package/dist/production/src/migrations/2024-08-26-120000-passwordless.js.map +1 -0
- package/dist/production/src/migrations/runner.cjs +3 -1
- package/dist/production/src/migrations/runner.cjs.map +1 -1
- package/dist/production/src/migrations/runner.js +3 -1
- package/dist/production/src/migrations/runner.js.map +1 -1
- package/dist/production/src/migrations/snapshot.cjs +33 -5
- package/dist/production/src/migrations/snapshot.cjs.map +1 -1
- package/dist/production/src/migrations/snapshot.js +33 -5
- package/dist/production/src/migrations/snapshot.js.map +1 -1
- package/dist/production/src/migrations/tenantCredentials.cjs.map +1 -1
- package/dist/production/src/migrations/tenantCredentials.js.map +1 -1
- package/dist/production/src/model/authorization/AclSchemaAccessNodeFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/AclSchemaAccessNodeFactory.js.map +1 -1
- package/dist/production/src/model/authorization/DirectPermissionsAccessNode.cjs.map +1 -1
- package/dist/production/src/model/authorization/DirectPermissionsAccessNode.js.map +1 -1
- package/dist/production/src/model/authorization/Identity.cjs.map +1 -1
- package/dist/production/src/model/authorization/Identity.js.map +1 -1
- package/dist/production/src/model/authorization/IdentityFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/IdentityFactory.js.map +1 -1
- package/dist/production/src/model/authorization/IdentityScope.cjs.map +1 -1
- package/dist/production/src/model/authorization/IdentityScope.js.map +1 -1
- package/dist/production/src/model/authorization/MembershipMatcher.cjs.map +1 -1
- package/dist/production/src/model/authorization/MembershipMatcher.js.map +1 -1
- package/dist/production/src/model/authorization/PermissionActions.cjs +5 -0
- package/dist/production/src/model/authorization/PermissionActions.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionActions.js +5 -0
- package/dist/production/src/model/authorization/PermissionActions.js.map +1 -1
- package/dist/production/src/model/authorization/PermissionContext.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionContext.js.map +1 -1
- package/dist/production/src/model/authorization/PermissionContextFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionContextFactory.js.map +1 -1
- package/dist/production/src/model/authorization/PermissionsFactory.cjs +5 -0
- package/dist/production/src/model/authorization/PermissionsFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/PermissionsFactory.js +5 -0
- package/dist/production/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/production/src/model/authorization/ProjectScope.cjs.map +1 -1
- package/dist/production/src/model/authorization/ProjectScope.js.map +1 -1
- package/dist/production/src/model/authorization/ProjectScopeFactory.cjs.map +1 -1
- package/dist/production/src/model/authorization/ProjectScopeFactory.js.map +1 -1
- package/dist/production/src/model/commands/CommandBus.cjs.map +1 -1
- package/dist/production/src/model/commands/CommandBus.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/ApiKeyHelper.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/ApiKeyHelper.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/CreateApiKeyCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/CreateApiKeyCommand.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/DisableApiKeyCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/DisableApiKeyCommand.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/DisableIdentityApiKeysCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/DisableIdentityApiKeysCommand.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/DisableOneOffApiKeyCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/DisableOneOffApiKeyCommand.js.map +1 -1
- package/dist/production/src/model/commands/apiKey/ProlongApiKeyCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/apiKey/ProlongApiKeyCommand.js.map +1 -1
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.cjs +20 -0
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.js +20 -0
- package/dist/production/src/model/commands/configuration/UpdateConfigurationCommand.js.map +1 -0
- package/dist/production/src/model/commands/identity/CreateIdentityCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/identity/CreateIdentityCommand.js.map +1 -1
- package/dist/production/src/model/commands/identity/PatchIdentityGlobalRoles.cjs.map +1 -1
- package/dist/production/src/model/commands/identity/PatchIdentityGlobalRoles.js.map +1 -1
- package/dist/production/src/model/commands/idp/CreateIdpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/CreateIdpCommand.js.map +1 -1
- package/dist/production/src/model/commands/idp/DisableIdpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/DisableIdpCommand.js.map +1 -1
- package/dist/production/src/model/commands/idp/EnableIdpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/EnableIdpCommand.js.map +1 -1
- package/dist/production/src/model/commands/idp/UpdateIdpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/idp/UpdateIdpCommand.js.map +1 -1
- package/dist/production/src/model/commands/mailTemplate/AddMailTemplateCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/mailTemplate/AddMailTemplateCommand.js.map +1 -1
- package/dist/production/src/model/commands/mailTemplate/RemoveMailTemplateCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/mailTemplate/RemoveMailTemplateCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/AddProjectMemberCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/AddProjectMemberCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/CreateOrUpdateProjectMembershipCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/CreateOrUpdateProjectMembershipCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMemberCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMemberCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMembershipsCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/RemoveProjectMembershipsCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/UpdateProjectMemberCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/variables/PatchProjectMembershipVariableValuesCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/variables/PatchProjectMembershipVariableValuesCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/variables/PatchProjectMembershipVariablesCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/variables/PatchProjectMembershipVariablesCommand.js.map +1 -1
- package/dist/production/src/model/commands/membership/variables/SetProjectMembershipVariableValuesCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/membership/variables/SetProjectMembershipVariableValuesCommand.js.map +1 -1
- package/dist/production/src/model/commands/otp/ConfirmOtpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/otp/ConfirmOtpCommand.js.map +1 -1
- package/dist/production/src/model/commands/otp/DisableOtpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/otp/DisableOtpCommand.js.map +1 -1
- package/dist/production/src/model/commands/otp/PrepareOtpCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/otp/PrepareOtpCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/ChangePasswordCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/person/ChangePasswordCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/ChangeProfileCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/person/ChangeProfileCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/CreatePersonCommand.cjs +2 -1
- package/dist/production/src/model/commands/person/CreatePersonCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/person/CreatePersonCommand.js +2 -1
- package/dist/production/src/model/commands/person/CreatePersonCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/CreatePersonIdentityProviderIdentifierCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/person/CreatePersonIdentityProviderIdentifierCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/DisablePersonCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/person/DisablePersonCommand.js.map +1 -1
- package/dist/production/src/model/commands/person/TogglePersonPasswordlessCommand.cjs +18 -0
- package/dist/production/src/model/commands/person/TogglePersonPasswordlessCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/person/TogglePersonPasswordlessCommand.js +18 -0
- package/dist/production/src/model/commands/person/TogglePersonPasswordlessCommand.js.map +1 -0
- package/dist/production/src/model/commands/personToken/ActivateOtpCommand.cjs +20 -0
- package/dist/production/src/model/commands/personToken/ActivateOtpCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/personToken/ActivateOtpCommand.js +20 -0
- package/dist/production/src/model/commands/personToken/ActivateOtpCommand.js.map +1 -0
- package/dist/production/src/model/commands/personToken/CreatePersonTokenCommand.cjs +33 -0
- package/dist/production/src/model/commands/personToken/CreatePersonTokenCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/personToken/CreatePersonTokenCommand.js +33 -0
- package/dist/production/src/model/commands/personToken/CreatePersonTokenCommand.js.map +1 -0
- package/dist/production/src/model/commands/personToken/IncreaseOtpAttemptCommand.cjs +19 -0
- package/dist/production/src/model/commands/personToken/IncreaseOtpAttemptCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/personToken/IncreaseOtpAttemptCommand.js +19 -0
- package/dist/production/src/model/commands/personToken/IncreaseOtpAttemptCommand.js.map +1 -0
- package/dist/production/src/model/commands/personToken/InvalidateTokenCommand.cjs +19 -0
- package/dist/production/src/model/commands/personToken/InvalidateTokenCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/personToken/InvalidateTokenCommand.js +19 -0
- package/dist/production/src/model/commands/personToken/InvalidateTokenCommand.js.map +1 -0
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.cjs +28 -0
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.js +28 -0
- package/dist/production/src/model/commands/personToken/ResetPasswordCommand.js.map +1 -0
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.cjs +28 -0
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.cjs.map +1 -0
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.js +28 -0
- package/dist/production/src/model/commands/personToken/SavePersonTokenCommand.js.map +1 -0
- package/dist/production/src/model/commands/project/CreateProjectCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/project/CreateProjectCommand.js.map +1 -1
- package/dist/production/src/model/commands/project/SetProjectSecretCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/project/SetProjectSecretCommand.js.map +1 -1
- package/dist/production/src/model/commands/project/UpdateProjectCommand.cjs.map +1 -1
- package/dist/production/src/model/commands/project/UpdateProjectCommand.js.map +1 -1
- package/dist/production/src/model/consts/expirations.cjs +7 -0
- package/dist/production/src/model/consts/expirations.cjs.map +1 -0
- package/dist/production/src/model/consts/expirations.js +7 -0
- package/dist/production/src/model/consts/expirations.js.map +1 -0
- package/dist/production/src/model/dtos/Password.cjs.map +1 -1
- package/dist/production/src/model/dtos/Password.js.map +1 -1
- package/dist/production/src/model/mailing/UserMailer.cjs +10 -1
- package/dist/production/src/model/mailing/UserMailer.cjs.map +1 -1
- package/dist/production/src/model/mailing/UserMailer.js +10 -1
- package/dist/production/src/model/mailing/UserMailer.js.map +1 -1
- package/dist/production/src/model/mailing/templates/ExistingUserInvited.mustache.cjs.map +1 -1
- package/dist/production/src/model/mailing/templates/ExistingUserInvited.mustache.js.map +1 -1
- package/dist/production/src/model/mailing/templates/NewUserInvited.mustache.cjs.map +1 -1
- package/dist/production/src/model/mailing/templates/NewUserInvited.mustache.js.map +1 -1
- package/dist/production/src/model/mailing/templates/PasswordReset.mustache.cjs.map +1 -1
- package/dist/production/src/model/mailing/templates/PasswordReset.mustache.js.map +1 -1
- package/dist/production/src/model/mailing/templates/PasswordlessSignIn.mustache.cjs +17 -0
- package/dist/production/src/model/mailing/templates/PasswordlessSignIn.mustache.cjs.map +1 -0
- package/dist/production/src/model/mailing/templates/PasswordlessSignIn.mustache.js +18 -0
- package/dist/production/src/model/mailing/templates/PasswordlessSignIn.mustache.js.map +1 -0
- package/dist/production/src/model/mailing/type.cjs +9 -3
- package/dist/production/src/model/mailing/type.cjs.map +1 -1
- package/dist/production/src/model/mailing/type.js +9 -3
- package/dist/production/src/model/mailing/type.js.map +1 -1
- package/dist/production/src/model/queries/apiKey/ApiKeyQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/apiKey/ApiKeyQuery.js.map +1 -1
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.cjs +21 -0
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.cjs.map +1 -0
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.js +21 -0
- package/dist/production/src/model/queries/configuration/ConfigurationQuery.js.map +1 -0
- package/dist/production/src/model/queries/identity/IdentityQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/identity/IdentityQuery.js.map +1 -1
- package/dist/production/src/model/queries/idp/IdentityProviderBySlugQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/idp/IdentityProviderBySlugQuery.js.map +1 -1
- package/dist/production/src/model/queries/idp/IdentityProvidersQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/idp/IdentityProvidersQuery.js.map +1 -1
- package/dist/production/src/model/queries/idp/helpers.cjs.map +1 -1
- package/dist/production/src/model/queries/idp/helpers.js.map +1 -1
- package/dist/production/src/model/queries/mailTemplate/MailTemplateListQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/mailTemplate/MailTemplateListQuery.js.map +1 -1
- package/dist/production/src/model/queries/mailTemplate/MailTemplateQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/mailTemplate/MailTemplateQuery.js.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectMembersQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectMembersQuery.js.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectMembershipByIdentityQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectMembershipByIdentityQuery.js.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectRolesByIdentityQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectRolesByIdentityQuery.js.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectSlugSpecification.cjs.map +1 -1
- package/dist/production/src/model/queries/membership/ProjectSlugSpecification.js.map +1 -1
- package/dist/production/src/model/queries/person/PersonByIdPQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/person/PersonByIdPQuery.js.map +1 -1
- package/dist/production/src/model/queries/person/PersonByIdentityBatchQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/person/PersonByIdentityBatchQuery.js.map +1 -1
- package/dist/production/src/model/queries/person/PersonQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/person/PersonQuery.js.map +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.cjs +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.cjs.map +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.js +1 -1
- package/dist/production/src/model/queries/person/PersonQueryBuilderFactory.js.map +1 -1
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.cjs +29 -0
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.cjs.map +1 -0
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.js +29 -0
- package/dist/production/src/model/queries/personToken/PersonTokenQuery.js.map +1 -0
- package/dist/production/src/model/queries/project/ProjectBySlugQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/project/ProjectBySlugQuery.js.map +1 -1
- package/dist/production/src/model/queries/project/ProjectSecretsQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/project/ProjectSecretsQuery.js.map +1 -1
- package/dist/production/src/model/queries/project/ProjectUpdateTimestampQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/project/ProjectUpdateTimestampQuery.js.map +1 -1
- package/dist/production/src/model/queries/project/ProjectsByIdentityQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/project/ProjectsByIdentityQuery.js.map +1 -1
- package/dist/production/src/model/queries/project/ProjectsQuery.cjs.map +1 -1
- package/dist/production/src/model/queries/project/ProjectsQuery.js.map +1 -1
- package/dist/production/src/model/service/ConfigurationManager.cjs +27 -0
- package/dist/production/src/model/service/ConfigurationManager.cjs.map +1 -0
- package/dist/production/src/model/service/ConfigurationManager.js +27 -0
- package/dist/production/src/model/service/ConfigurationManager.js.map +1 -0
- package/dist/production/src/model/service/EmailValidator.cjs.map +1 -1
- package/dist/production/src/model/service/EmailValidator.js.map +1 -1
- package/dist/production/src/model/service/IDPSignInManager.cjs +1 -1
- package/dist/production/src/model/service/IDPSignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/IDPSignInManager.js +1 -1
- package/dist/production/src/model/service/IDPSignInManager.js.map +1 -1
- package/dist/production/src/model/service/InviteManager.cjs +7 -7
- package/dist/production/src/model/service/InviteManager.cjs.map +1 -1
- package/dist/production/src/model/service/InviteManager.js +6 -6
- package/dist/production/src/model/service/InviteManager.js.map +1 -1
- package/dist/production/src/model/service/MailTemplateManager.cjs.map +1 -1
- package/dist/production/src/model/service/MailTemplateManager.js.map +1 -1
- package/dist/production/src/model/service/MembershipValidator.cjs.map +1 -1
- package/dist/production/src/model/service/MembershipValidator.js.map +1 -1
- package/dist/production/src/model/service/OtpAuthenticator.cjs.map +1 -1
- package/dist/production/src/model/service/OtpAuthenticator.js.map +1 -1
- package/dist/production/src/model/service/OtpManager.cjs.map +1 -1
- package/dist/production/src/model/service/OtpManager.js.map +1 -1
- package/dist/production/src/model/service/PasswordChangeManager.cjs +1 -1
- package/dist/production/src/model/service/PasswordChangeManager.cjs.map +1 -1
- package/dist/production/src/model/service/PasswordChangeManager.js +1 -1
- package/dist/production/src/model/service/PasswordChangeManager.js.map +1 -1
- package/dist/production/src/model/service/PasswordResetManager.cjs +7 -15
- package/dist/production/src/model/service/PasswordResetManager.cjs.map +1 -1
- package/dist/production/src/model/service/PasswordResetManager.js +7 -15
- package/dist/production/src/model/service/PasswordResetManager.js.map +1 -1
- package/dist/production/src/model/service/PasswordlessSignInManager.cjs +135 -0
- package/dist/production/src/model/service/PasswordlessSignInManager.cjs.map +1 -0
- package/dist/production/src/model/service/PasswordlessSignInManager.js +135 -0
- package/dist/production/src/model/service/PasswordlessSignInManager.js.map +1 -0
- package/dist/production/src/model/service/PersonAccessManager.cjs.map +1 -1
- package/dist/production/src/model/service/PersonAccessManager.js.map +1 -1
- package/dist/production/src/model/service/PersonManager.cjs +7 -0
- package/dist/production/src/model/service/PersonManager.cjs.map +1 -1
- package/dist/production/src/model/service/PersonManager.js +7 -0
- package/dist/production/src/model/service/PersonManager.js.map +1 -1
- package/dist/production/src/model/service/ProjectManager.cjs +2 -2
- package/dist/production/src/model/service/ProjectManager.cjs.map +1 -1
- package/dist/production/src/model/service/ProjectManager.js +2 -2
- package/dist/production/src/model/service/ProjectManager.js.map +1 -1
- package/dist/production/src/model/service/ProjectMemberManager.cjs.map +1 -1
- package/dist/production/src/model/service/ProjectMemberManager.js.map +1 -1
- package/dist/production/src/model/service/RolesManager.cjs +1 -1
- package/dist/production/src/model/service/RolesManager.cjs.map +1 -1
- package/dist/production/src/model/service/RolesManager.js +1 -1
- package/dist/production/src/model/service/RolesManager.js.map +1 -1
- package/dist/production/src/model/service/SecretsManager.cjs.map +1 -1
- package/dist/production/src/model/service/SecretsManager.js.map +1 -1
- package/dist/production/src/model/service/SignInManager.cjs.map +1 -1
- package/dist/production/src/model/service/SignInManager.js.map +1 -1
- package/dist/production/src/model/service/SignUpManager.cjs +1 -1
- package/dist/production/src/model/service/SignUpManager.cjs.map +1 -1
- package/dist/production/src/model/service/SignUpManager.js +1 -1
- package/dist/production/src/model/service/SignUpManager.js.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyManager.cjs.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyManager.js.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyService.cjs.map +1 -1
- package/dist/production/src/model/service/apiKey/ApiKeyService.js.map +1 -1
- package/dist/production/src/model/service/helpers/getPreferredProject.cjs +13 -0
- package/dist/production/src/model/service/helpers/getPreferredProject.cjs.map +1 -0
- package/dist/production/src/model/service/helpers/getPreferredProject.js +13 -0
- package/dist/production/src/model/service/helpers/getPreferredProject.js.map +1 -0
- package/dist/production/src/model/service/idp/IDPHandlerRegistry.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IDPHandlerRegistry.js.map +1 -1
- package/dist/production/src/model/service/idp/IDPManager.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IDPManager.js.map +1 -1
- package/dist/production/src/model/service/idp/IDPResponseError.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IDPResponseError.js.map +1 -1
- package/dist/production/src/model/service/idp/IDPValidationError.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IDPValidationError.js.map +1 -1
- package/dist/production/src/model/service/idp/IdentityProviderNotFoundError.cjs.map +1 -1
- package/dist/production/src/model/service/idp/IdentityProviderNotFoundError.js.map +1 -1
- package/dist/production/src/model/service/idp/InvalidIDPConfigurationError.cjs.map +1 -1
- package/dist/production/src/model/service/idp/InvalidIDPConfigurationError.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/AppleProvider.cjs +1 -1
- package/dist/production/src/model/service/idp/providers/AppleProvider.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/AppleProvider.js +1 -1
- package/dist/production/src/model/service/idp/providers/AppleProvider.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/FacebookProvider.cjs +1 -1
- package/dist/production/src/model/service/idp/providers/FacebookProvider.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/FacebookProvider.js +1 -1
- package/dist/production/src/model/service/idp/providers/FacebookProvider.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs +9 -5
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.js +9 -5
- package/dist/production/src/model/service/idp/providers/OIDCHelpers.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs +9 -3
- package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.js +9 -3
- package/dist/production/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.cjs +6 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.js +6 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/helpers.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/helpers.js.map +1 -1
- package/dist/production/src/model/service/membershipUtils.cjs.map +1 -1
- package/dist/production/src/model/service/membershipUtils.js.map +1 -1
- package/dist/production/src/model/type/ApiKey.cjs.map +1 -1
- package/dist/production/src/model/type/ApiKey.js.map +1 -1
- package/dist/production/src/model/utils/DatabaseContext.cjs.map +1 -1
- package/dist/production/src/model/utils/DatabaseContext.js.map +1 -1
- package/dist/production/src/model/utils/Response.cjs.map +1 -1
- package/dist/production/src/model/utils/Response.js.map +1 -1
- package/dist/production/src/model/utils/password.cjs.map +1 -1
- package/dist/production/src/model/utils/password.js.map +1 -1
- package/dist/production/src/model/utils/tokenUtils.cjs +39 -0
- package/dist/production/src/model/utils/tokenUtils.cjs.map +1 -1
- package/dist/production/src/model/utils/tokenUtils.js +40 -1
- package/dist/production/src/model/utils/tokenUtils.js.map +1 -1
- package/dist/production/src/resolvers/ResolverFactory.cjs +8 -1
- package/dist/production/src/resolvers/ResolverFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/ResolverFactory.js +8 -1
- package/dist/production/src/resolvers/ResolverFactory.js.map +1 -1
- package/dist/production/src/resolvers/TenantResolverContextFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/TenantResolverContextFactory.js.map +1 -1
- package/dist/production/src/resolvers/errorUtils.cjs.map +1 -1
- package/dist/production/src/resolvers/errorUtils.js.map +1 -1
- package/dist/production/src/resolvers/membershipUtils.cjs.map +1 -1
- package/dist/production/src/resolvers/membershipUtils.js.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/CreateApiKeyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/apiKey/DisableApiKeyMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs +41 -0
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js +41 -0
- package/dist/production/src/resolvers/mutation/configuration/ConfigurationMutationResolver.js.map +1 -0
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/identity/GlobalRolesMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/AddIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/DisableIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/EnableIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/idp/UpdateIDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/mailTemplates/MailTemplateMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangePasswordMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ChangeProfileMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/DisablePersonMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs +4 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js +4 -1
- package/dist/production/src/resolvers/mutation/person/IDPMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/InviteMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/OtpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs +83 -0
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js +83 -0
- package/dist/production/src/resolvers/mutation/person/PasswordlessMutationResolver.js.map +1 -0
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/ResetPasswordMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignInMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignOutMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/person/SignUpMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs +52 -0
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js +52 -0
- package/dist/production/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.js.map +1 -0
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/CreateProjectMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/SetProjectSecretMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/project/UpdateProjectMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/AddProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/RemoveProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/mutation/projectMember/UpdateProjectMemberMutationResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs +34 -0
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.cjs.map +1 -0
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js +34 -0
- package/dist/production/src/resolvers/query/ConfigurationQueryResolver.js.map +1 -0
- package/dist/production/src/resolvers/query/IDPQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/IDPQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/MailTemplateQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/MeQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/MeQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/PersonQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ProjectMembersQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/query/ProjectQueryResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/query/ProjectQueryResolver.js.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.cjs +1 -0
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.js +1 -0
- package/dist/production/src/resolvers/responseHelpers/PersonResponseFactory.js.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.cjs.map +1 -1
- package/dist/production/src/resolvers/responseHelpers/SignInResponseFactory.js.map +1 -1
- package/dist/production/src/resolvers/types/IdentityTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/IdentityTypeResolver.js.map +1 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.cjs.map +1 -1
- package/dist/production/src/resolvers/types/ProjectTypeResolver.js.map +1 -1
- package/dist/production/src/schema/tenant.graphql.cjs +162 -10
- package/dist/production/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/production/src/schema/tenant.graphql.js +162 -10
- package/dist/production/src/schema/tenant.graphql.js.map +1 -1
- package/dist/production/src/utils/Mailer.cjs.map +1 -1
- package/dist/production/src/utils/Mailer.js.map +1 -1
- package/dist/production/src/utils/TemplateRenderer.cjs.map +1 -1
- package/dist/production/src/utils/TemplateRenderer.js.map +1 -1
- package/dist/production/src/utils/array.cjs.map +1 -1
- package/dist/production/src/utils/array.js.map +1 -1
- package/dist/production/src/utils/batchQuery.cjs.map +1 -1
- package/dist/production/src/utils/batchQuery.js.map +1 -1
- package/dist/tests/cases/integration/mocked/sql/{createPasswordResetSql.d.ts → createPersonTokenSql.d.ts} +3 -2
- package/dist/tests/cases/integration/mocked/sql/createPersonTokenSql.d.ts.map +1 -0
- package/dist/tests/cases/integration/mocked/sql/getPersonByEmailSql.d.ts.map +1 -1
- package/dist/tests/src/IdPMock.d.ts +2 -2
- package/dist/tests/src/IdPMock.d.ts.map +1 -1
- package/dist/tests/src/mailer.d.ts.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/TenantContainer.d.ts +18 -0
- package/dist/types/TenantContainer.d.ts.map +1 -1
- package/dist/types/migrations/2024-08-26-120000-passwordless.d.ts +3 -0
- package/dist/types/migrations/2024-08-26-120000-passwordless.d.ts.map +1 -0
- package/dist/types/migrations/runner.d.ts.map +1 -1
- package/dist/types/migrations/snapshot.d.ts.map +1 -1
- package/dist/types/model/authorization/PermissionActions.d.ts +25 -0
- package/dist/types/model/authorization/PermissionActions.d.ts.map +1 -1
- package/dist/types/model/authorization/PermissionsFactory.d.ts.map +1 -1
- package/dist/types/model/commands/configuration/UpdateConfigurationCommand.d.ts +8 -0
- package/dist/types/model/commands/configuration/UpdateConfigurationCommand.d.ts.map +1 -0
- package/dist/types/model/commands/configuration/index.d.ts +2 -0
- package/dist/types/model/commands/configuration/index.d.ts.map +1 -0
- package/dist/types/model/commands/index.d.ts +2 -2
- package/dist/types/model/commands/index.d.ts.map +1 -1
- package/dist/types/model/commands/person/CreatePersonCommand.d.ts.map +1 -1
- package/dist/types/model/commands/person/TogglePersonPasswordlessCommand.d.ts +8 -0
- package/dist/types/model/commands/person/TogglePersonPasswordlessCommand.d.ts.map +1 -0
- package/dist/types/model/commands/person/index.d.ts +1 -0
- package/dist/types/model/commands/person/index.d.ts.map +1 -1
- package/dist/types/model/commands/personToken/ActivateOtpCommand.d.ts +8 -0
- package/dist/types/model/commands/personToken/ActivateOtpCommand.d.ts.map +1 -0
- package/dist/types/model/commands/personToken/CreatePersonTokenCommand.d.ts +19 -0
- package/dist/types/model/commands/personToken/CreatePersonTokenCommand.d.ts.map +1 -0
- package/dist/types/model/commands/personToken/IncreaseOtpAttemptCommand.d.ts +7 -0
- package/dist/types/model/commands/personToken/IncreaseOtpAttemptCommand.d.ts.map +1 -0
- package/dist/types/model/commands/personToken/InvalidateTokenCommand.d.ts +7 -0
- package/dist/types/model/commands/personToken/InvalidateTokenCommand.d.ts.map +1 -0
- package/dist/types/model/commands/{passwordReset → personToken}/ResetPasswordCommand.d.ts +3 -2
- package/dist/types/model/commands/personToken/ResetPasswordCommand.d.ts.map +1 -0
- package/dist/types/model/commands/personToken/SavePersonTokenCommand.d.ts +19 -0
- package/dist/types/model/commands/personToken/SavePersonTokenCommand.d.ts.map +1 -0
- package/dist/types/model/commands/personToken/index.d.ts +7 -0
- package/dist/types/model/commands/personToken/index.d.ts.map +1 -0
- package/dist/types/model/consts/expirations.d.ts +3 -0
- package/dist/types/model/consts/expirations.d.ts.map +1 -0
- package/dist/types/model/mailing/UserMailer.d.ts +10 -0
- package/dist/types/model/mailing/UserMailer.d.ts.map +1 -1
- package/dist/types/model/mailing/templates/PasswordlessSignIn.mustache.d.ts +3 -0
- package/dist/types/model/mailing/templates/PasswordlessSignIn.mustache.d.ts.map +1 -0
- package/dist/types/model/mailing/type.d.ts +2 -1
- package/dist/types/model/mailing/type.d.ts.map +1 -1
- package/dist/types/model/queries/configuration/ConfigurationQuery.d.ts +6 -0
- package/dist/types/model/queries/configuration/ConfigurationQuery.d.ts.map +1 -0
- package/dist/types/model/queries/configuration/index.d.ts +2 -0
- package/dist/types/model/queries/configuration/index.d.ts.map +1 -0
- package/dist/types/model/queries/index.d.ts +1 -0
- package/dist/types/model/queries/index.d.ts.map +1 -1
- package/dist/types/model/queries/person/PersonQueryBuilderFactory.d.ts.map +1 -1
- package/dist/types/model/queries/person/types.d.ts +1 -0
- package/dist/types/model/queries/person/types.d.ts.map +1 -1
- package/dist/types/model/queries/personToken/PersonTokenQuery.d.ts +12 -0
- package/dist/types/model/queries/personToken/PersonTokenQuery.d.ts.map +1 -0
- package/dist/types/model/service/ConfigurationManager.d.ts +9 -0
- package/dist/types/model/service/ConfigurationManager.d.ts.map +1 -0
- package/dist/types/model/service/IDPSignInManager.d.ts +1 -0
- package/dist/types/model/service/IDPSignInManager.d.ts.map +1 -1
- package/dist/types/model/service/InviteManager.d.ts.map +1 -1
- package/dist/types/model/service/PasswordResetManager.d.ts +1 -1
- package/dist/types/model/service/PasswordResetManager.d.ts.map +1 -1
- package/dist/types/model/service/PasswordlessSignInManager.d.ts +54 -0
- package/dist/types/model/service/PasswordlessSignInManager.d.ts.map +1 -0
- package/dist/types/model/service/PersonManager.d.ts +1 -0
- package/dist/types/model/service/PersonManager.d.ts.map +1 -1
- package/dist/types/model/service/PersonTokenManager.d.ts +3 -0
- package/dist/types/model/service/PersonTokenManager.d.ts.map +1 -0
- package/dist/types/model/service/helpers/getPreferredProject.d.ts +3 -0
- package/dist/types/model/service/helpers/getPreferredProject.d.ts.map +1 -0
- package/dist/types/model/service/idp/IdentityProviderHandler.d.ts +3 -3
- package/dist/types/model/service/idp/IdentityProviderHandler.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/AppleProvider.d.ts +10 -2
- package/dist/types/model/service/idp/providers/AppleProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/FacebookProvider.d.ts +10 -2
- package/dist/types/model/service/idp/providers/FacebookProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts +4 -4
- package/dist/types/model/service/idp/providers/OIDCHelpers.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCProvider.d.ts +6 -2
- package/dist/types/model/service/idp/providers/OIDCProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCTypes.d.ts +21 -5
- package/dist/types/model/service/idp/providers/OIDCTypes.d.ts.map +1 -1
- package/dist/types/model/type/PersonToken.d.ts +16 -0
- package/dist/types/model/type/PersonToken.d.ts.map +1 -0
- package/dist/types/model/type/index.d.ts +1 -0
- package/dist/types/model/type/index.d.ts.map +1 -1
- package/dist/types/model/utils/tokenUtils.d.ts +8 -0
- package/dist/types/model/utils/tokenUtils.d.ts.map +1 -1
- package/dist/types/resolvers/ResolverFactory.d.ts +8 -0
- package/dist/types/resolvers/ResolverFactory.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/configuration/ConfigurationMutationResolver.d.ts +9 -0
- package/dist/types/resolvers/mutation/configuration/ConfigurationMutationResolver.d.ts.map +1 -0
- package/dist/types/resolvers/mutation/person/IDPMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/PasswordlessMutationResolver.d.ts +13 -0
- package/dist/types/resolvers/mutation/person/PasswordlessMutationResolver.d.ts.map +1 -0
- package/dist/types/resolvers/mutation/person/ResetPasswordMutationResolver.d.ts.map +1 -1
- package/dist/types/resolvers/mutation/person/TogglePasswordlessMutationResolver.d.ts +13 -0
- package/dist/types/resolvers/mutation/person/TogglePasswordlessMutationResolver.d.ts.map +1 -0
- package/dist/types/resolvers/query/ConfigurationQueryResolver.d.ts +9 -0
- package/dist/types/resolvers/query/ConfigurationQueryResolver.d.ts.map +1 -0
- package/dist/types/resolvers/responseHelpers/PersonResponseFactory.d.ts.map +1 -1
- package/dist/types/resolvers/types/ProjectTypeResolver.d.ts +3 -3
- package/dist/types/schema/index.d.ts +362 -38
- package/dist/types/schema/index.d.ts.map +1 -1
- package/dist/types/schema/tenant.graphql.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/utils/batchQuery.d.ts.map +1 -1
- package/{graphql-tenant.codegen.yml → graphql.codegen.yml} +1 -1
- package/package.json +23 -27
- package/src/TenantContainer.ts +18 -0
- package/src/migrations/2024-08-26-120000-passwordless.ts +31 -0
- package/src/migrations/runner.ts +2 -0
- package/src/migrations/snapshot-template-end.txt +3 -0
- package/src/migrations/snapshot.ts +33 -5
- package/src/model/authorization/PermissionActions.ts +7 -0
- package/src/model/authorization/PermissionsFactory.ts +5 -0
- package/src/model/commands/configuration/UpdateConfigurationCommand.ts +26 -0
- package/src/model/commands/configuration/index.ts +1 -0
- package/src/model/commands/index.ts +2 -2
- package/src/model/commands/person/CreatePersonCommand.ts +1 -0
- package/src/model/commands/person/TogglePersonPasswordlessCommand.ts +18 -0
- package/src/model/commands/person/index.ts +1 -0
- package/src/model/commands/personToken/ActivateOtpCommand.ts +24 -0
- package/src/model/commands/personToken/CreatePersonTokenCommand.ts +42 -0
- package/src/model/commands/personToken/IncreaseOtpAttemptCommand.ts +23 -0
- package/src/model/commands/personToken/InvalidateTokenCommand.ts +22 -0
- package/src/model/commands/personToken/ResetPasswordCommand.ts +28 -0
- package/src/model/commands/personToken/SavePersonTokenCommand.ts +42 -0
- package/src/model/commands/personToken/index.ts +6 -0
- package/src/model/consts/expirations.ts +2 -0
- package/src/model/mailing/UserMailer.ts +14 -0
- package/src/model/mailing/templates/PasswordlessSignIn.mustache.ts +15 -0
- package/src/model/mailing/type.ts +3 -0
- package/src/model/queries/configuration/ConfigurationQuery.ts +30 -0
- package/src/model/queries/configuration/index.ts +1 -0
- package/src/model/queries/index.ts +1 -0
- package/src/model/queries/person/PersonQueryBuilderFactory.ts +1 -0
- package/src/model/queries/person/types.ts +1 -0
- package/src/model/queries/personToken/PersonTokenQuery.ts +35 -0
- package/src/model/service/ConfigurationManager.ts +22 -0
- package/src/model/service/IDPSignInManager.ts +7 -6
- package/src/model/service/InviteManager.ts +5 -6
- package/src/model/service/OtpAuthenticator.ts +1 -1
- package/src/model/service/PasswordResetManager.ts +4 -10
- package/src/model/service/PasswordlessSignInManager.ts +190 -0
- package/src/model/service/PersonManager.ts +6 -0
- package/src/model/service/PersonTokenManager.ts +2 -0
- package/src/model/service/helpers/getPreferredProject.ts +11 -0
- package/src/model/service/idp/IdentityProviderHandler.ts +3 -3
- package/src/model/service/idp/providers/AppleProvider.ts +3 -3
- package/src/model/service/idp/providers/FacebookProvider.ts +3 -3
- package/src/model/service/idp/providers/OIDCHelpers.ts +11 -6
- package/src/model/service/idp/providers/OIDCProvider.ts +10 -4
- package/src/model/service/idp/providers/OIDCTypes.ts +5 -1
- package/src/model/type/PersonToken.ts +21 -0
- package/src/model/type/index.ts +1 -0
- package/src/model/utils/tokenUtils.ts +47 -0
- package/src/resolvers/ResolverFactory.ts +19 -0
- package/src/resolvers/mutation/configuration/ConfigurationMutationResolver.ts +29 -0
- package/src/resolvers/mutation/person/IDPMutationResolver.ts +4 -1
- package/src/resolvers/mutation/person/PasswordlessMutationResolver.ts +81 -0
- package/src/resolvers/mutation/person/ResetPasswordMutationResolver.ts +1 -10
- package/src/resolvers/mutation/person/TogglePasswordlessMutationResolver.ts +44 -0
- package/src/resolvers/query/ConfigurationQueryResolver.ts +21 -0
- package/src/resolvers/responseHelpers/PersonResponseFactory.ts +1 -0
- package/src/resolvers/types/ProjectTypeResolver.ts +3 -3
- package/src/schema/index.ts +362 -35
- package/src/schema/tenant.graphql.ts +162 -10
- package/tests/cases/integration/mocked/addProjectMemberMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/changeMyPasswordMutation.test.ts +2 -2
- package/tests/cases/integration/mocked/changeMyProfileMutation.test.ts +2 -2
- package/tests/cases/integration/mocked/changePasswordMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/changeProfileMutation.test.ts +2 -2
- package/tests/cases/integration/mocked/confirmOtpMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/createApiKeyMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/createSessionKeyMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/disableApiKeyMutation.ts +1 -1
- package/tests/cases/integration/mocked/inviteMutations.test.ts +3 -3
- package/tests/cases/integration/mocked/listProjectMembersQuery.test.ts +1 -1
- package/tests/cases/integration/mocked/personByIdQuery.test.ts +1 -1
- package/tests/cases/integration/mocked/prepareOtpMutation.test.ts +3 -3
- package/tests/cases/integration/mocked/removeProjectMemberMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/signInIdpMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/signInMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/signOutMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/signUpMutation.test.ts +1 -1
- package/tests/cases/integration/mocked/sql/{createPasswordResetSql.ts → createPersonTokenSql.ts} +5 -3
- package/tests/cases/integration/mocked/sql/getPersonByEmailSql.ts +2 -1
- package/tests/cases/integration/mocked/sql/getPersonByIdSql.ts +1 -1
- package/tests/cases/integration/mocked/sql/getPersonByIdentity.ts +1 -1
- package/tests/cases/integration/mocked/sql/getPersonByIdpSql.ts +1 -1
- package/tests/cases/integration/mocked/updateProjectMemberMutation.test.ts +1 -1
- package/tests/cases/migrations/2020-06-08-134000-tenant-credentials.test.ts +5 -3
- package/tests/cases/unit/authorization/membershipAwareAccessNode.test.ts +9 -9
- package/tests/cases/unit/authorization/membershipMatcher.test.ts +10 -10
- package/tests/src/IdPMock.ts +2 -2
- package/tests/src/mailer.ts +3 -4
- package/tests/src/testGraphql.ts +2 -2
- package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs +0 -30
- package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs.map +0 -1
- package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js +0 -30
- package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js.map +0 -1
- package/dist/development/src/model/commands/passwordReset/ResetPasswordCommand.cjs +0 -38
- package/dist/development/src/model/commands/passwordReset/ResetPasswordCommand.cjs.map +0 -1
- package/dist/development/src/model/commands/passwordReset/ResetPasswordCommand.js +0 -38
- package/dist/development/src/model/commands/passwordReset/ResetPasswordCommand.js.map +0 -1
- package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.cjs +0 -24
- package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.cjs.map +0 -1
- package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.js +0 -24
- package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.js.map +0 -1
- package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs +0 -30
- package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs.map +0 -1
- package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js +0 -30
- package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js.map +0 -1
- package/dist/production/src/model/commands/passwordReset/ResetPasswordCommand.cjs +0 -38
- package/dist/production/src/model/commands/passwordReset/ResetPasswordCommand.cjs.map +0 -1
- package/dist/production/src/model/commands/passwordReset/ResetPasswordCommand.js +0 -38
- package/dist/production/src/model/commands/passwordReset/ResetPasswordCommand.js.map +0 -1
- package/dist/production/src/model/commands/passwordReset/SavePasswordResetRequestCommand.cjs +0 -24
- package/dist/production/src/model/commands/passwordReset/SavePasswordResetRequestCommand.cjs.map +0 -1
- package/dist/production/src/model/commands/passwordReset/SavePasswordResetRequestCommand.js +0 -24
- package/dist/production/src/model/commands/passwordReset/SavePasswordResetRequestCommand.js.map +0 -1
- package/dist/tests/cases/integration/mocked/sql/createPasswordResetSql.d.ts.map +0 -1
- package/dist/tests/src/testTenantDb.d.ts +0 -31
- package/dist/tests/src/testTenantDb.d.ts.map +0 -1
- package/dist/types/model/commands/passwordReset/CreatePasswordResetRequestCommand.d.ts +0 -12
- package/dist/types/model/commands/passwordReset/CreatePasswordResetRequestCommand.d.ts.map +0 -1
- package/dist/types/model/commands/passwordReset/ResetPasswordCommand.d.ts.map +0 -1
- package/dist/types/model/commands/passwordReset/SavePasswordResetRequestCommand.d.ts +0 -10
- package/dist/types/model/commands/passwordReset/SavePasswordResetRequestCommand.d.ts.map +0 -1
- package/dist/types/model/commands/passwordReset/index.d.ts +0 -4
- package/dist/types/model/commands/passwordReset/index.d.ts.map +0 -1
- package/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.ts +0 -25
- package/src/model/commands/passwordReset/ResetPasswordCommand.ts +0 -57
- package/src/model/commands/passwordReset/SavePasswordResetRequestCommand.ts +0 -28
- package/src/model/commands/passwordReset/index.ts +0 -3
- package/tests/src/testTenantDb.ts +0 -202
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OtpAuthenticator.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/OtpAuthenticator.ts"],"sourcesContent":["import { Providers } from '../providers'\nimport { Secret, TOTP, URI } from 'otpauth'\n\nexport interface OtpData {\n\tsecret: string\n\turi: string\n}\n\nconst digits = 6\n\nexport class OtpAuthenticator {\n\tconstructor(\n\t\tprivate readonly providers: Pick<Providers, 'now' | 'randomBytes'>,\n\t) {\n\t}\n\n\tpublic validate(secret: SecretLike, token: string): boolean {\n\t\tconst result = TOTP.validate({\n\t\t\ttoken,\n\t\t\tdigits,\n\t\t\tsecret: getSecret(secret),\n\t\t\ttimestamp: this.providers.now().getTime(),\n\t\t})\n\t\treturn result !== null\n\t}\n\n\tpublic generate(secret: SecretLike): string {\n\t\treturn TOTP.generate({\n\t\t\tsecret: getSecret(secret),\n\t\t\tdigits,\n\t\t\ttimestamp: this.providers.now().getTime(),\n\t\t})\n\t}\n\n\tpublic async create(user: string, label: string): Promise<OtpData> {\n\t\tconst secret = new Secret({ buffer: await this.providers.randomBytes(20) })\n\t\tconst totp = new TOTP({\n\t\t\tlabel: user,\n\t\t\tissuer: label,\n\t\t\tsecret,\n\t\t})\n\t\treturn {\n\t\t\tsecret: secret.base32,\n\t\t\turi: totp.toString(),\n\t\t}\n\t}\n}\n\ntype SecretLike = { uri: string } | { secret: string }\nconst getSecret = function (otp: SecretLike): Secret {\n\treturn 'uri' in otp ? (URI.parse(otp.uri).secret) : Secret.fromBase32(otp.secret)\n}\n"],"names":[],"mappings":";AAQA,MAAM,SAAS;AAER,MAAM,iBAAiB;AAAA,EAC7B,YACkB,WAChB;AADgB,SAAA,YAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"OtpAuthenticator.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/OtpAuthenticator.ts"],"sourcesContent":["import { Providers } from '../providers'\nimport { Secret, TOTP, URI } from 'otpauth'\n\nexport interface OtpData {\n\tsecret: string\n\turi: string\n}\n\nconst digits = 6\n\nexport class OtpAuthenticator {\n\tconstructor(\n\t\tprivate readonly providers: Pick<Providers, 'now' | 'randomBytes'>,\n\t) {\n\t}\n\n\tpublic validate(secret: SecretLike, token: string): boolean {\n\t\tconst result = TOTP.validate({\n\t\t\ttoken,\n\t\t\tdigits,\n\t\t\tsecret: getSecret(secret),\n\t\t\ttimestamp: this.providers.now().getTime(),\n\t\t})\n\t\treturn result !== null\n\t}\n\n\tpublic generate(secret: SecretLike): string {\n\t\treturn TOTP.generate({\n\t\t\tsecret: getSecret(secret),\n\t\t\tdigits,\n\t\t\ttimestamp: this.providers.now().getTime(),\n\t\t})\n\t}\n\n\tpublic async create(user: string, label: string): Promise<OtpData> {\n\t\tconst secret = new Secret({ buffer: (await this.providers.randomBytes(20)) as any })\n\t\tconst totp = new TOTP({\n\t\t\tlabel: user,\n\t\t\tissuer: label,\n\t\t\tsecret,\n\t\t})\n\t\treturn {\n\t\t\tsecret: secret.base32,\n\t\t\turi: totp.toString(),\n\t\t}\n\t}\n}\n\ntype SecretLike = { uri: string } | { secret: string }\nconst getSecret = function (otp: SecretLike): Secret {\n\treturn 'uri' in otp ? (URI.parse(otp.uri).secret) : Secret.fromBase32(otp.secret)\n}\n"],"names":[],"mappings":";AAQA,MAAM,SAAS;AAER,MAAM,iBAAiB;AAAA,EAC7B,YACkB,WAChB;AADgB,SAAA,YAAA;AAAA,EAAA;AAAA,EAIX,SAAS,QAAoB,OAAwB;AACrD,UAAA,SAAS,KAAK,SAAS;AAAA,MAC5B;AAAA,MACA;AAAA,MACA,QAAQ,UAAU,MAAM;AAAA,MACxB,WAAW,KAAK,UAAU,MAAM,QAAQ;AAAA,IAAA,CACxC;AACD,WAAO,WAAW;AAAA,EAAA;AAAA,EAGZ,SAAS,QAA4B;AAC3C,WAAO,KAAK,SAAS;AAAA,MACpB,QAAQ,UAAU,MAAM;AAAA,MACxB;AAAA,MACA,WAAW,KAAK,UAAU,MAAM,QAAQ;AAAA,IAAA,CACxC;AAAA,EAAA;AAAA,EAGF,MAAa,OAAO,MAAc,OAAiC;AAC5D,UAAA,SAAS,IAAI,OAAO,EAAE,QAAS,MAAM,KAAK,UAAU,YAAY,EAAE,GAAW;AAC7E,UAAA,OAAO,IAAI,KAAK;AAAA,MACrB,OAAO;AAAA,MACP,QAAQ;AAAA,MACR;AAAA,IAAA,CACA;AACM,WAAA;AAAA,MACN,QAAQ,OAAO;AAAA,MACf,KAAK,KAAK,SAAS;AAAA,IACpB;AAAA,EAAA;AAEF;AAGA,MAAM,YAAY,SAAU,KAAyB;AAC7C,SAAA,SAAS,MAAO,IAAI,MAAM,IAAI,GAAG,EAAE,SAAU,OAAO,WAAW,IAAI,MAAM;AACjF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OtpManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/OtpManager.ts"],"sourcesContent":["import { PersonRow } from '../queries'\nimport { ConfirmOtpCommand, DisableOtpCommand, PrepareOtpCommand } from '../commands'\nimport { DatabaseContext } from '../utils'\nimport { OtpAuthenticator, OtpData } from './OtpAuthenticator'\n\nexport class OtpManager {\n\tconstructor(\n\t\tprivate readonly otpAuthenticator: OtpAuthenticator,\n\t) {}\n\n\tasync prepareOtp(dbContext: DatabaseContext, person: PersonRow, label: string): Promise<OtpData> {\n\t\tconst otp = await this.otpAuthenticator.create(person.email ?? person.name ?? 'unnamed', label)\n\t\tawait dbContext.commandBus.execute(new PrepareOtpCommand(person.id, otp.uri))\n\t\treturn otp\n\t}\n\n\tasync confirmOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new ConfirmOtpCommand(person.id))\n\t}\n\n\tasync disableOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOtpCommand(person.id))\n\t}\n\n\tverifyOtp(person: PersonRow, token: string): boolean {\n\t\tif (!person.otp_uri) {\n\t\t\tthrow new OtpError('not configured')\n\t\t}\n\t\treturn this.otpAuthenticator.validate({ uri: person.otp_uri }, token)\n\t}\n}\n\nexport class OtpError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message)\n\t}\n}\n"],"names":["PrepareOtpCommand","ConfirmOtpCommand","DisableOtpCommand"],"mappings":";;;;;;;;AAKO,MAAM,WAAW;AAAA,EACvB,YACkB,kBAChB;AADgB,SAAA,mBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"OtpManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/OtpManager.ts"],"sourcesContent":["import { PersonRow } from '../queries'\nimport { ConfirmOtpCommand, DisableOtpCommand, PrepareOtpCommand } from '../commands'\nimport { DatabaseContext } from '../utils'\nimport { OtpAuthenticator, OtpData } from './OtpAuthenticator'\n\nexport class OtpManager {\n\tconstructor(\n\t\tprivate readonly otpAuthenticator: OtpAuthenticator,\n\t) {}\n\n\tasync prepareOtp(dbContext: DatabaseContext, person: PersonRow, label: string): Promise<OtpData> {\n\t\tconst otp = await this.otpAuthenticator.create(person.email ?? person.name ?? 'unnamed', label)\n\t\tawait dbContext.commandBus.execute(new PrepareOtpCommand(person.id, otp.uri))\n\t\treturn otp\n\t}\n\n\tasync confirmOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new ConfirmOtpCommand(person.id))\n\t}\n\n\tasync disableOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOtpCommand(person.id))\n\t}\n\n\tverifyOtp(person: PersonRow, token: string): boolean {\n\t\tif (!person.otp_uri) {\n\t\t\tthrow new OtpError('not configured')\n\t\t}\n\t\treturn this.otpAuthenticator.validate({ uri: person.otp_uri }, token)\n\t}\n}\n\nexport class OtpError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message)\n\t}\n}\n"],"names":["PrepareOtpCommand","ConfirmOtpCommand","DisableOtpCommand"],"mappings":";;;;;;;;AAKO,MAAM,WAAW;AAAA,EACvB,YACkB,kBAChB;AADgB,SAAA,mBAAA;AAAA,EAAA;AAAA,EAGlB,MAAM,WAAW,WAA4B,QAAmB,OAAiC;AAC1F,UAAA,MAAM,MAAM,KAAK,iBAAiB,OAAO,OAAO,SAAS,OAAO,QAAQ,WAAW,KAAK;AACxF,UAAA,UAAU,WAAW,QAAQ,IAAIA,kBAAAA,kBAAkB,OAAO,IAAI,IAAI,GAAG,CAAC;AACrE,WAAA;AAAA,EAAA;AAAA,EAGR,MAAM,WAAW,WAA4B,QAAkC;AAC9E,UAAM,UAAU,WAAW,QAAQ,IAAIC,kBAAAA,kBAAkB,OAAO,EAAE,CAAC;AAAA,EAAA;AAAA,EAGpE,MAAM,WAAW,WAA4B,QAAkC;AAC9E,UAAM,UAAU,WAAW,QAAQ,IAAIC,kBAAAA,kBAAkB,OAAO,EAAE,CAAC;AAAA,EAAA;AAAA,EAGpE,UAAU,QAAmB,OAAwB;AAChD,QAAA,CAAC,OAAO,SAAS;AACd,YAAA,IAAI,SAAS,gBAAgB;AAAA,IAAA;AAE7B,WAAA,KAAK,iBAAiB,SAAS,EAAE,KAAK,OAAO,WAAW,KAAK;AAAA,EAAA;AAEtE;AAEO,MAAM,iBAAiB,MAAM;AAAA,EACnC,YAAY,SAAkB;AAC7B,UAAM,OAAO;AAAA,EAAA;AAEf;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OtpManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/OtpManager.ts"],"sourcesContent":["import { PersonRow } from '../queries'\nimport { ConfirmOtpCommand, DisableOtpCommand, PrepareOtpCommand } from '../commands'\nimport { DatabaseContext } from '../utils'\nimport { OtpAuthenticator, OtpData } from './OtpAuthenticator'\n\nexport class OtpManager {\n\tconstructor(\n\t\tprivate readonly otpAuthenticator: OtpAuthenticator,\n\t) {}\n\n\tasync prepareOtp(dbContext: DatabaseContext, person: PersonRow, label: string): Promise<OtpData> {\n\t\tconst otp = await this.otpAuthenticator.create(person.email ?? person.name ?? 'unnamed', label)\n\t\tawait dbContext.commandBus.execute(new PrepareOtpCommand(person.id, otp.uri))\n\t\treturn otp\n\t}\n\n\tasync confirmOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new ConfirmOtpCommand(person.id))\n\t}\n\n\tasync disableOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOtpCommand(person.id))\n\t}\n\n\tverifyOtp(person: PersonRow, token: string): boolean {\n\t\tif (!person.otp_uri) {\n\t\t\tthrow new OtpError('not configured')\n\t\t}\n\t\treturn this.otpAuthenticator.validate({ uri: person.otp_uri }, token)\n\t}\n}\n\nexport class OtpError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message)\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAKO,MAAM,WAAW;AAAA,EACvB,YACkB,kBAChB;AADgB,SAAA,mBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"OtpManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/OtpManager.ts"],"sourcesContent":["import { PersonRow } from '../queries'\nimport { ConfirmOtpCommand, DisableOtpCommand, PrepareOtpCommand } from '../commands'\nimport { DatabaseContext } from '../utils'\nimport { OtpAuthenticator, OtpData } from './OtpAuthenticator'\n\nexport class OtpManager {\n\tconstructor(\n\t\tprivate readonly otpAuthenticator: OtpAuthenticator,\n\t) {}\n\n\tasync prepareOtp(dbContext: DatabaseContext, person: PersonRow, label: string): Promise<OtpData> {\n\t\tconst otp = await this.otpAuthenticator.create(person.email ?? person.name ?? 'unnamed', label)\n\t\tawait dbContext.commandBus.execute(new PrepareOtpCommand(person.id, otp.uri))\n\t\treturn otp\n\t}\n\n\tasync confirmOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new ConfirmOtpCommand(person.id))\n\t}\n\n\tasync disableOtp(dbContext: DatabaseContext, person: PersonRow): Promise<void> {\n\t\tawait dbContext.commandBus.execute(new DisableOtpCommand(person.id))\n\t}\n\n\tverifyOtp(person: PersonRow, token: string): boolean {\n\t\tif (!person.otp_uri) {\n\t\t\tthrow new OtpError('not configured')\n\t\t}\n\t\treturn this.otpAuthenticator.validate({ uri: person.otp_uri }, token)\n\t}\n}\n\nexport class OtpError extends Error {\n\tconstructor(message?: string) {\n\t\tsuper(message)\n\t}\n}\n"],"names":[],"mappings":";;;;;;AAKO,MAAM,WAAW;AAAA,EACvB,YACkB,kBAChB;AADgB,SAAA,mBAAA;AAAA,EAAA;AAAA,EAGlB,MAAM,WAAW,WAA4B,QAAmB,OAAiC;AAC1F,UAAA,MAAM,MAAM,KAAK,iBAAiB,OAAO,OAAO,SAAS,OAAO,QAAQ,WAAW,KAAK;AACxF,UAAA,UAAU,WAAW,QAAQ,IAAI,kBAAkB,OAAO,IAAI,IAAI,GAAG,CAAC;AACrE,WAAA;AAAA,EAAA;AAAA,EAGR,MAAM,WAAW,WAA4B,QAAkC;AAC9E,UAAM,UAAU,WAAW,QAAQ,IAAI,kBAAkB,OAAO,EAAE,CAAC;AAAA,EAAA;AAAA,EAGpE,MAAM,WAAW,WAA4B,QAAkC;AAC9E,UAAM,UAAU,WAAW,QAAQ,IAAI,kBAAkB,OAAO,EAAE,CAAC;AAAA,EAAA;AAAA,EAGpE,UAAU,QAAmB,OAAwB;AAChD,QAAA,CAAC,OAAO,SAAS;AACd,YAAA,IAAI,SAAS,gBAAgB;AAAA,IAAA;AAE7B,WAAA,KAAK,iBAAiB,SAAS,EAAE,KAAK,OAAO,WAAW,KAAK;AAAA,EAAA;AAEtE;AAEO,MAAM,iBAAiB,MAAM;AAAA,EACnC,YAAY,SAAkB;AAC7B,UAAM,OAAO;AAAA,EAAA;AAEf;"}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("../type/ApiKey.cjs");
|
|
4
4
|
require("@contember/database");
|
|
5
5
|
require("node:crypto");
|
|
6
|
-
const ChangePasswordCommand = require("../commands/person/ChangePasswordCommand.cjs");
|
|
7
6
|
const Response = require("../utils/Response.cjs");
|
|
7
|
+
const ChangePasswordCommand = require("../commands/person/ChangePasswordCommand.cjs");
|
|
8
8
|
const password = require("../utils/password.cjs");
|
|
9
9
|
class PasswordChangeManager {
|
|
10
10
|
constructor(providers) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordChangeManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordChangeManager.ts"],"sourcesContent":["import { ChangeMyPasswordErrorCode, ChangePasswordErrorCode } from '../../schema'\nimport { ChangePasswordCommand } from '../commands'\nimport { getPasswordWeaknessMessage } from '../utils/password'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { PersonRow } from '../queries'\nimport { Providers } from '../providers'\nimport { DatabaseContext } from '../utils'\n\nclass PasswordChangeManager {\n\tconstructor(\n\t\tprivate readonly providers: Providers,\n\t) {}\n\n\tasync changePassword(dbContext: DatabaseContext, personId: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangePasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(personId, password))\n\t\treturn new ResponseOk(null)\n\t}\n\n\tasync changeMyPassword(dbContext: DatabaseContext, person: PersonRow, currentPassword: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangeMyPasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tif (!person.password_hash) {\n\t\t\treturn new ResponseError('NO_PASSWORD_SET', 'No password set')\n\t\t}\n\t\tif (!(await this.providers.bcryptCompare(currentPassword, person.password_hash))) {\n\t\t\treturn new ResponseError('INVALID_PASSWORD', 'Password does not match')\n\t\t}\n\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(person.id, password))\n\t\treturn new ResponseOk(null)\n\t}\n}\n\nnamespace PasswordChangeManager {\n\texport type PasswordChangeResponse<T extends ChangePasswordErrorCode | ChangeMyPasswordErrorCode> = Response<null, T>\n}\n\nexport { PasswordChangeManager }\n"],"names":["password","getPasswordWeaknessMessage","ResponseError","ChangePasswordCommand","ResponseOk"],"mappings":";;;;;;;;AAQA,MAAM,sBAAsB;AAAA,EAC3B,YACkB,WAChB;AADgB,SAAA,YAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"PasswordChangeManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordChangeManager.ts"],"sourcesContent":["import { ChangeMyPasswordErrorCode, ChangePasswordErrorCode } from '../../schema'\nimport { ChangePasswordCommand } from '../commands'\nimport { getPasswordWeaknessMessage } from '../utils/password'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { PersonRow } from '../queries'\nimport { Providers } from '../providers'\nimport { DatabaseContext } from '../utils'\n\nclass PasswordChangeManager {\n\tconstructor(\n\t\tprivate readonly providers: Providers,\n\t) {}\n\n\tasync changePassword(dbContext: DatabaseContext, personId: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangePasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(personId, password))\n\t\treturn new ResponseOk(null)\n\t}\n\n\tasync changeMyPassword(dbContext: DatabaseContext, person: PersonRow, currentPassword: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangeMyPasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tif (!person.password_hash) {\n\t\t\treturn new ResponseError('NO_PASSWORD_SET', 'No password set')\n\t\t}\n\t\tif (!(await this.providers.bcryptCompare(currentPassword, person.password_hash))) {\n\t\t\treturn new ResponseError('INVALID_PASSWORD', 'Password does not match')\n\t\t}\n\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(person.id, password))\n\t\treturn new ResponseOk(null)\n\t}\n}\n\nnamespace PasswordChangeManager {\n\texport type PasswordChangeResponse<T extends ChangePasswordErrorCode | ChangeMyPasswordErrorCode> = Response<null, T>\n}\n\nexport { PasswordChangeManager }\n"],"names":["password","getPasswordWeaknessMessage","ResponseError","ChangePasswordCommand","ResponseOk"],"mappings":";;;;;;;;AAQA,MAAM,sBAAsB;AAAA,EAC3B,YACkB,WAChB;AADgB,SAAA,YAAA;AAAA,EAAA;AAAA,EAGlB,MAAM,eAAe,WAA4B,UAAkBA,YAAkG;AAC9J,UAAA,eAAeC,oCAA2BD,UAAQ;AACxD,QAAI,cAAc;AACV,aAAA,IAAIE,SAAAA,cAAc,YAAY,YAAY;AAAA,IAAA;AAElD,UAAM,UAAU,WAAW,QAAQ,IAAIC,sBAAAA,sBAAsB,UAAUH,UAAQ,CAAC;AACzE,WAAA,IAAII,oBAAW,IAAI;AAAA,EAAA;AAAA,EAG3B,MAAM,iBAAiB,WAA4B,QAAmB,iBAAyBJ,YAAoG;AAC5L,UAAA,eAAeC,oCAA2BD,UAAQ;AACxD,QAAI,cAAc;AACV,aAAA,IAAIE,SAAAA,cAAc,YAAY,YAAY;AAAA,IAAA;AAE9C,QAAA,CAAC,OAAO,eAAe;AACnB,aAAA,IAAIA,SAAAA,cAAc,mBAAmB,iBAAiB;AAAA,IAAA;AAE1D,QAAA,CAAE,MAAM,KAAK,UAAU,cAAc,iBAAiB,OAAO,aAAa,GAAI;AAC1E,aAAA,IAAIA,SAAAA,cAAc,oBAAoB,yBAAyB;AAAA,IAAA;AAGjE,UAAA,UAAU,WAAW,QAAQ,IAAIC,4CAAsB,OAAO,IAAIH,UAAQ,CAAC;AAC1E,WAAA,IAAII,oBAAW,IAAI;AAAA,EAAA;AAE5B;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../type/ApiKey.js";
|
|
2
2
|
import "@contember/database";
|
|
3
3
|
import "node:crypto";
|
|
4
|
-
import { ChangePasswordCommand } from "../commands/person/ChangePasswordCommand.js";
|
|
5
4
|
import { ResponseError, ResponseOk } from "../utils/Response.js";
|
|
5
|
+
import { ChangePasswordCommand } from "../commands/person/ChangePasswordCommand.js";
|
|
6
6
|
import { getPasswordWeaknessMessage } from "../utils/password.js";
|
|
7
7
|
class PasswordChangeManager {
|
|
8
8
|
constructor(providers) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordChangeManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordChangeManager.ts"],"sourcesContent":["import { ChangeMyPasswordErrorCode, ChangePasswordErrorCode } from '../../schema'\nimport { ChangePasswordCommand } from '../commands'\nimport { getPasswordWeaknessMessage } from '../utils/password'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { PersonRow } from '../queries'\nimport { Providers } from '../providers'\nimport { DatabaseContext } from '../utils'\n\nclass PasswordChangeManager {\n\tconstructor(\n\t\tprivate readonly providers: Providers,\n\t) {}\n\n\tasync changePassword(dbContext: DatabaseContext, personId: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangePasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(personId, password))\n\t\treturn new ResponseOk(null)\n\t}\n\n\tasync changeMyPassword(dbContext: DatabaseContext, person: PersonRow, currentPassword: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangeMyPasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tif (!person.password_hash) {\n\t\t\treturn new ResponseError('NO_PASSWORD_SET', 'No password set')\n\t\t}\n\t\tif (!(await this.providers.bcryptCompare(currentPassword, person.password_hash))) {\n\t\t\treturn new ResponseError('INVALID_PASSWORD', 'Password does not match')\n\t\t}\n\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(person.id, password))\n\t\treturn new ResponseOk(null)\n\t}\n}\n\nnamespace PasswordChangeManager {\n\texport type PasswordChangeResponse<T extends ChangePasswordErrorCode | ChangeMyPasswordErrorCode> = Response<null, T>\n}\n\nexport { PasswordChangeManager }\n"],"names":[],"mappings":";;;;;;AAQA,MAAM,sBAAsB;AAAA,EAC3B,YACkB,WAChB;AADgB,SAAA,YAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"PasswordChangeManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordChangeManager.ts"],"sourcesContent":["import { ChangeMyPasswordErrorCode, ChangePasswordErrorCode } from '../../schema'\nimport { ChangePasswordCommand } from '../commands'\nimport { getPasswordWeaknessMessage } from '../utils/password'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { PersonRow } from '../queries'\nimport { Providers } from '../providers'\nimport { DatabaseContext } from '../utils'\n\nclass PasswordChangeManager {\n\tconstructor(\n\t\tprivate readonly providers: Providers,\n\t) {}\n\n\tasync changePassword(dbContext: DatabaseContext, personId: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangePasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(personId, password))\n\t\treturn new ResponseOk(null)\n\t}\n\n\tasync changeMyPassword(dbContext: DatabaseContext, person: PersonRow, currentPassword: string, password: string): Promise<PasswordChangeManager.PasswordChangeResponse<ChangeMyPasswordErrorCode>> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('TOO_WEAK', weakPassword)\n\t\t}\n\t\tif (!person.password_hash) {\n\t\t\treturn new ResponseError('NO_PASSWORD_SET', 'No password set')\n\t\t}\n\t\tif (!(await this.providers.bcryptCompare(currentPassword, person.password_hash))) {\n\t\t\treturn new ResponseError('INVALID_PASSWORD', 'Password does not match')\n\t\t}\n\n\t\tawait dbContext.commandBus.execute(new ChangePasswordCommand(person.id, password))\n\t\treturn new ResponseOk(null)\n\t}\n}\n\nnamespace PasswordChangeManager {\n\texport type PasswordChangeResponse<T extends ChangePasswordErrorCode | ChangeMyPasswordErrorCode> = Response<null, T>\n}\n\nexport { PasswordChangeManager }\n"],"names":[],"mappings":";;;;;;AAQA,MAAM,sBAAsB;AAAA,EAC3B,YACkB,WAChB;AADgB,SAAA,YAAA;AAAA,EAAA;AAAA,EAGlB,MAAM,eAAe,WAA4B,UAAkB,UAAkG;AAC9J,UAAA,eAAe,2BAA2B,QAAQ;AACxD,QAAI,cAAc;AACV,aAAA,IAAI,cAAc,YAAY,YAAY;AAAA,IAAA;AAElD,UAAM,UAAU,WAAW,QAAQ,IAAI,sBAAsB,UAAU,QAAQ,CAAC;AACzE,WAAA,IAAI,WAAW,IAAI;AAAA,EAAA;AAAA,EAG3B,MAAM,iBAAiB,WAA4B,QAAmB,iBAAyB,UAAoG;AAC5L,UAAA,eAAe,2BAA2B,QAAQ;AACxD,QAAI,cAAc;AACV,aAAA,IAAI,cAAc,YAAY,YAAY;AAAA,IAAA;AAE9C,QAAA,CAAC,OAAO,eAAe;AACnB,aAAA,IAAI,cAAc,mBAAmB,iBAAiB;AAAA,IAAA;AAE1D,QAAA,CAAE,MAAM,KAAK,UAAU,cAAc,iBAAiB,OAAO,aAAa,GAAI;AAC1E,aAAA,IAAI,cAAc,oBAAoB,yBAAyB;AAAA,IAAA;AAGjE,UAAA,UAAU,WAAW,QAAQ,IAAI,sBAAsB,OAAO,IAAI,QAAQ,CAAC;AAC1E,WAAA,IAAI,WAAW,IAAI;AAAA,EAAA;AAE5B;"}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("../type/ApiKey.cjs");
|
|
4
|
-
require("@contember/database");
|
|
5
|
-
require("node:crypto");
|
|
6
|
-
const exceptions = require("../../exceptions.cjs");
|
|
7
3
|
const Response = require("../utils/Response.cjs");
|
|
8
|
-
const CreatePasswordResetRequestCommand = require("../commands/passwordReset/CreatePasswordResetRequestCommand.cjs");
|
|
9
|
-
const ResetPasswordCommand = require("../commands/passwordReset/ResetPasswordCommand.cjs");
|
|
10
4
|
const password = require("../utils/password.cjs");
|
|
5
|
+
const exceptions = require("../../exceptions.cjs");
|
|
6
|
+
const getPreferredProject = require("./helpers/getPreferredProject.cjs");
|
|
7
|
+
require("@contember/database");
|
|
8
|
+
const CreatePersonTokenCommand = require("../commands/personToken/CreatePersonTokenCommand.cjs");
|
|
9
|
+
const ResetPasswordCommand = require("../commands/personToken/ResetPasswordCommand.cjs");
|
|
11
10
|
class PasswordResetManager {
|
|
12
11
|
constructor(mailer, projectManager) {
|
|
13
12
|
this.mailer = mailer;
|
|
14
13
|
this.projectManager = projectManager;
|
|
15
14
|
}
|
|
16
15
|
async createPasswordResetRequest(dbContext, permissionContext, person, mailOptions = {}) {
|
|
17
|
-
const result = await dbContext.commandBus.execute(
|
|
16
|
+
const result = await dbContext.commandBus.execute(CreatePersonTokenCommand.CreatePersonTokenCommand.createPasswordResetRequest(person.id));
|
|
18
17
|
const projects = await this.projectManager.getProjectsByIdentity(dbContext, person.identity_id, permissionContext);
|
|
19
|
-
const project = (
|
|
20
|
-
if (projects.length === 1) {
|
|
21
|
-
return projects[0];
|
|
22
|
-
} else if (mailOptions.project) {
|
|
23
|
-
return projects.find((it) => it.slug === mailOptions.project) || null;
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
})();
|
|
18
|
+
const project = getPreferredProject.getPreferredProject(projects, mailOptions.project ?? null);
|
|
27
19
|
if (!person.email) {
|
|
28
20
|
throw new exceptions.ImplementationException();
|
|
29
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordResetManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordResetManager.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"PasswordResetManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordResetManager.ts"],"sourcesContent":["import { Response, ResponseError } from '../utils/Response'\nimport { getPasswordWeaknessMessage } from '../utils/password'\nimport { UserMailer } from '../mailing'\nimport { PersonRow } from '../queries'\nimport { PermissionContext } from '../authorization'\nimport { ProjectManager } from './ProjectManager'\nimport { DatabaseContext } from '../utils'\nimport { ImplementationException } from '../../exceptions'\nimport { getPreferredProject } from './helpers/getPreferredProject'\nimport { CreatePersonTokenCommand, ResetPasswordCommand, ResetPasswordCommandErrorCode } from '../commands/personToken'\n\ninterface MailOptions {\n\tproject?: string\n\tmailVariant?: string\n}\n\nexport class PasswordResetManager {\n\tconstructor(\n\t\tprivate readonly mailer: UserMailer,\n\t\tprivate readonly projectManager: ProjectManager,\n\t) { }\n\n\tpublic async createPasswordResetRequest(\n\t\tdbContext: DatabaseContext,\n\t\tpermissionContext: PermissionContext,\n\t\tperson: PersonRow,\n\t\tmailOptions: MailOptions = {},\n\t): Promise<void> {\n\t\tconst result = await dbContext.commandBus.execute(CreatePersonTokenCommand.createPasswordResetRequest(person.id))\n\t\tconst projects = await this.projectManager.getProjectsByIdentity(dbContext, person.identity_id, permissionContext)\n\t\tconst project = getPreferredProject(projects, mailOptions.project ?? null)\n\t\tif (!person.email) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\n\t\tawait this.mailer.sendPasswordResetEmail(\n\t\t\tdbContext,\n\t\t\t{\n\t\t\t\temail: person.email,\n\t\t\t\ttoken: result.token,\n\t\t\t\tproject: project?.name,\n\t\t\t\tprojectSlug: project?.slug,\n\t\t\t},\n\t\t\t{\n\t\t\t\tvariant: mailOptions.mailVariant || '',\n\t\t\t\tprojectId: project?.id ?? null,\n\t\t\t},\n\t\t)\n\t}\n\n\tpublic async resetPassword(dbContext: DatabaseContext, token: string, password: string): Promise<ResetPasswordResponse> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('PASSWORD_TOO_WEAK', weakPassword)\n\t\t}\n\t\treturn await dbContext.commandBus.execute(new ResetPasswordCommand(token, password))\n\t}\n}\n\nexport type ResetPasswordErrorCode = 'PASSWORD_TOO_WEAK'\n\nexport type ResetPasswordResponse = Response<null, ResetPasswordErrorCode | ResetPasswordCommandErrorCode>\n"],"names":["CreatePersonTokenCommand","getPreferredProject","ImplementationException","password","getPasswordWeaknessMessage","ResponseError","ResetPasswordCommand"],"mappings":";;;;;;;;;AAgBO,MAAM,qBAAqB;AAAA,EACjC,YACkB,QACA,gBAChB;AAFgB,SAAA,SAAA;AACA,SAAA,iBAAA;AAAA,EAAA;AAAA,EAGlB,MAAa,2BACZ,WACA,mBACA,QACA,cAA2B,CAAA,GACX;AACV,UAAA,SAAS,MAAM,UAAU,WAAW,QAAQA,yBAAAA,yBAAyB,2BAA2B,OAAO,EAAE,CAAC;AAC1G,UAAA,WAAW,MAAM,KAAK,eAAe,sBAAsB,WAAW,OAAO,aAAa,iBAAiB;AACjH,UAAM,UAAUC,oBAAAA,oBAAoB,UAAU,YAAY,WAAW,IAAI;AACrE,QAAA,CAAC,OAAO,OAAO;AAClB,YAAM,IAAIC,WAAAA,wBAAwB;AAAA,IAAA;AAGnC,UAAM,KAAK,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,QACC,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,QACd,SAAS,SAAS;AAAA,QAClB,aAAa,SAAS;AAAA,MACvB;AAAA,MACA;AAAA,QACC,SAAS,YAAY,eAAe;AAAA,QACpC,WAAW,SAAS,MAAM;AAAA,MAAA;AAAA,IAE5B;AAAA,EAAA;AAAA,EAGD,MAAa,cAAc,WAA4B,OAAeC,YAAkD;AACjH,UAAA,eAAeC,oCAA2BD,UAAQ;AACxD,QAAI,cAAc;AACV,aAAA,IAAIE,SAAAA,cAAc,qBAAqB,YAAY;AAAA,IAAA;AAEpD,WAAA,MAAM,UAAU,WAAW,QAAQ,IAAIC,0CAAqB,OAAOH,UAAQ,CAAC;AAAA,EAAA;AAErF;;"}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import "../type/ApiKey.js";
|
|
2
|
-
import "@contember/database";
|
|
3
|
-
import "node:crypto";
|
|
4
|
-
import { ImplementationException } from "../../exceptions.js";
|
|
5
1
|
import { ResponseError } from "../utils/Response.js";
|
|
6
|
-
import { CreatePasswordResetRequestCommand } from "../commands/passwordReset/CreatePasswordResetRequestCommand.js";
|
|
7
|
-
import { ResetPasswordCommand } from "../commands/passwordReset/ResetPasswordCommand.js";
|
|
8
2
|
import { getPasswordWeaknessMessage } from "../utils/password.js";
|
|
3
|
+
import { ImplementationException } from "../../exceptions.js";
|
|
4
|
+
import { getPreferredProject } from "./helpers/getPreferredProject.js";
|
|
5
|
+
import "@contember/database";
|
|
6
|
+
import { CreatePersonTokenCommand } from "../commands/personToken/CreatePersonTokenCommand.js";
|
|
7
|
+
import { ResetPasswordCommand } from "../commands/personToken/ResetPasswordCommand.js";
|
|
9
8
|
class PasswordResetManager {
|
|
10
9
|
constructor(mailer, projectManager) {
|
|
11
10
|
this.mailer = mailer;
|
|
12
11
|
this.projectManager = projectManager;
|
|
13
12
|
}
|
|
14
13
|
async createPasswordResetRequest(dbContext, permissionContext, person, mailOptions = {}) {
|
|
15
|
-
const result = await dbContext.commandBus.execute(
|
|
14
|
+
const result = await dbContext.commandBus.execute(CreatePersonTokenCommand.createPasswordResetRequest(person.id));
|
|
16
15
|
const projects = await this.projectManager.getProjectsByIdentity(dbContext, person.identity_id, permissionContext);
|
|
17
|
-
const project = (
|
|
18
|
-
if (projects.length === 1) {
|
|
19
|
-
return projects[0];
|
|
20
|
-
} else if (mailOptions.project) {
|
|
21
|
-
return projects.find((it) => it.slug === mailOptions.project) || null;
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
})();
|
|
16
|
+
const project = getPreferredProject(projects, mailOptions.project ?? null);
|
|
25
17
|
if (!person.email) {
|
|
26
18
|
throw new ImplementationException();
|
|
27
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordResetManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordResetManager.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"PasswordResetManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordResetManager.ts"],"sourcesContent":["import { Response, ResponseError } from '../utils/Response'\nimport { getPasswordWeaknessMessage } from '../utils/password'\nimport { UserMailer } from '../mailing'\nimport { PersonRow } from '../queries'\nimport { PermissionContext } from '../authorization'\nimport { ProjectManager } from './ProjectManager'\nimport { DatabaseContext } from '../utils'\nimport { ImplementationException } from '../../exceptions'\nimport { getPreferredProject } from './helpers/getPreferredProject'\nimport { CreatePersonTokenCommand, ResetPasswordCommand, ResetPasswordCommandErrorCode } from '../commands/personToken'\n\ninterface MailOptions {\n\tproject?: string\n\tmailVariant?: string\n}\n\nexport class PasswordResetManager {\n\tconstructor(\n\t\tprivate readonly mailer: UserMailer,\n\t\tprivate readonly projectManager: ProjectManager,\n\t) { }\n\n\tpublic async createPasswordResetRequest(\n\t\tdbContext: DatabaseContext,\n\t\tpermissionContext: PermissionContext,\n\t\tperson: PersonRow,\n\t\tmailOptions: MailOptions = {},\n\t): Promise<void> {\n\t\tconst result = await dbContext.commandBus.execute(CreatePersonTokenCommand.createPasswordResetRequest(person.id))\n\t\tconst projects = await this.projectManager.getProjectsByIdentity(dbContext, person.identity_id, permissionContext)\n\t\tconst project = getPreferredProject(projects, mailOptions.project ?? null)\n\t\tif (!person.email) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\n\t\tawait this.mailer.sendPasswordResetEmail(\n\t\t\tdbContext,\n\t\t\t{\n\t\t\t\temail: person.email,\n\t\t\t\ttoken: result.token,\n\t\t\t\tproject: project?.name,\n\t\t\t\tprojectSlug: project?.slug,\n\t\t\t},\n\t\t\t{\n\t\t\t\tvariant: mailOptions.mailVariant || '',\n\t\t\t\tprojectId: project?.id ?? null,\n\t\t\t},\n\t\t)\n\t}\n\n\tpublic async resetPassword(dbContext: DatabaseContext, token: string, password: string): Promise<ResetPasswordResponse> {\n\t\tconst weakPassword = getPasswordWeaknessMessage(password)\n\t\tif (weakPassword) {\n\t\t\treturn new ResponseError('PASSWORD_TOO_WEAK', weakPassword)\n\t\t}\n\t\treturn await dbContext.commandBus.execute(new ResetPasswordCommand(token, password))\n\t}\n}\n\nexport type ResetPasswordErrorCode = 'PASSWORD_TOO_WEAK'\n\nexport type ResetPasswordResponse = Response<null, ResetPasswordErrorCode | ResetPasswordCommandErrorCode>\n"],"names":[],"mappings":";;;;;;;AAgBO,MAAM,qBAAqB;AAAA,EACjC,YACkB,QACA,gBAChB;AAFgB,SAAA,SAAA;AACA,SAAA,iBAAA;AAAA,EAAA;AAAA,EAGlB,MAAa,2BACZ,WACA,mBACA,QACA,cAA2B,CAAA,GACX;AACV,UAAA,SAAS,MAAM,UAAU,WAAW,QAAQ,yBAAyB,2BAA2B,OAAO,EAAE,CAAC;AAC1G,UAAA,WAAW,MAAM,KAAK,eAAe,sBAAsB,WAAW,OAAO,aAAa,iBAAiB;AACjH,UAAM,UAAU,oBAAoB,UAAU,YAAY,WAAW,IAAI;AACrE,QAAA,CAAC,OAAO,OAAO;AAClB,YAAM,IAAI,wBAAwB;AAAA,IAAA;AAGnC,UAAM,KAAK,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,QACC,OAAO,OAAO;AAAA,QACd,OAAO,OAAO;AAAA,QACd,SAAS,SAAS;AAAA,QAClB,aAAa,SAAS;AAAA,MACvB;AAAA,MACA;AAAA,QACC,SAAS,YAAY,eAAe;AAAA,QACpC,WAAW,SAAS,MAAM;AAAA,MAAA;AAAA,IAE5B;AAAA,EAAA;AAAA,EAGD,MAAa,cAAc,WAA4B,OAAe,UAAkD;AACjH,UAAA,eAAe,2BAA2B,QAAQ;AACxD,QAAI,cAAc;AACV,aAAA,IAAI,cAAc,qBAAqB,YAAY;AAAA,IAAA;AAEpD,WAAA,MAAM,UAAU,WAAW,QAAQ,IAAI,qBAAqB,OAAO,QAAQ,CAAC;AAAA,EAAA;AAErF;"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../queries/apiKey/ApiKeyQuery.cjs");
|
|
4
|
+
require("@contember/database");
|
|
5
|
+
const exceptions = require("../../exceptions.cjs");
|
|
6
|
+
const PersonQuery = require("../queries/person/PersonQuery.cjs");
|
|
7
|
+
require("../authorization/PermissionActions.cjs");
|
|
8
|
+
require("@contember/authorization");
|
|
9
|
+
require("../authorization/PermissionContext.cjs");
|
|
10
|
+
require("../authorization/PermissionsFactory.cjs");
|
|
11
|
+
require("@contember/schema");
|
|
12
|
+
const Response = require("../utils/Response.cjs");
|
|
13
|
+
require("../type/ApiKey.cjs");
|
|
14
|
+
const ActivateOtpCommand = require("../commands/personToken/ActivateOtpCommand.cjs");
|
|
15
|
+
const CreatePersonTokenCommand = require("../commands/personToken/CreatePersonTokenCommand.cjs");
|
|
16
|
+
const InvalidateTokenCommand = require("../commands/personToken/InvalidateTokenCommand.cjs");
|
|
17
|
+
const IncreaseOtpAttemptCommand = require("../commands/personToken/IncreaseOtpAttemptCommand.cjs");
|
|
18
|
+
const PersonTokenQuery = require("../queries/personToken/PersonTokenQuery.cjs");
|
|
19
|
+
const tokenUtils = require("../utils/tokenUtils.cjs");
|
|
20
|
+
const getPreferredProject = require("./helpers/getPreferredProject.cjs");
|
|
21
|
+
class PasswordlessSignInManager {
|
|
22
|
+
constructor(apiKeyManager, configurationManager, mailer, projectManager, otpAuthenticator) {
|
|
23
|
+
this.apiKeyManager = apiKeyManager;
|
|
24
|
+
this.configurationManager = configurationManager;
|
|
25
|
+
this.mailer = mailer;
|
|
26
|
+
this.projectManager = projectManager;
|
|
27
|
+
this.otpAuthenticator = otpAuthenticator;
|
|
28
|
+
}
|
|
29
|
+
async initSignInPasswordless({ db, permissionContext, mailVariant, mailProject, email }) {
|
|
30
|
+
return db.transaction(async (db2) => {
|
|
31
|
+
const configuration = await this.configurationManager.fetchConfiguration(db2);
|
|
32
|
+
if (configuration.passwordless.enabled === "never") {
|
|
33
|
+
return new Response.ResponseError("PASSWORDLESS_DISABLED", "Passwordless sign-in is disabled");
|
|
34
|
+
}
|
|
35
|
+
const person = await db2.queryHandler.fetch(PersonQuery.PersonQuery.byEmail(email));
|
|
36
|
+
if (!person) {
|
|
37
|
+
return new Response.ResponseError("PERSON_NOT_FOUND", `Person ${email} not found`);
|
|
38
|
+
}
|
|
39
|
+
if (!this.isEnabled(configuration.passwordless.enabled, person.passwordless_enabled)) {
|
|
40
|
+
return new Response.ResponseError("PASSWORDLESS_DISABLED", "Passwordless sign-in is disabled for this person");
|
|
41
|
+
}
|
|
42
|
+
const createTokenCommand = CreatePersonTokenCommand.CreatePersonTokenCommand.createPasswordlessRequest(person.id, configuration.passwordless.expirationMinutes);
|
|
43
|
+
const result = await db2.commandBus.execute(createTokenCommand);
|
|
44
|
+
const url = this.formatUrl(configuration.passwordless.url ?? null, result.token, result.id, email) ?? void 0;
|
|
45
|
+
const projects = await this.projectManager.getProjectsByIdentity(db2, person.identity_id, permissionContext);
|
|
46
|
+
const project = getPreferredProject.getPreferredProject(projects, mailProject ?? null);
|
|
47
|
+
await this.mailer.sendPasswordlessEmail(db2, {
|
|
48
|
+
email,
|
|
49
|
+
token: result.token,
|
|
50
|
+
url,
|
|
51
|
+
project: project?.name,
|
|
52
|
+
projectSlug: project?.slug
|
|
53
|
+
}, {
|
|
54
|
+
variant: mailVariant || "",
|
|
55
|
+
projectId: project?.id ?? null
|
|
56
|
+
});
|
|
57
|
+
return new Response.ResponseOk({ requestId: result.id, expiresAt: result.expiresAt });
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
formatUrl(url, token, requestId, email) {
|
|
61
|
+
if (!url) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const urlObj = new URL(url);
|
|
65
|
+
urlObj.searchParams.set("token", token);
|
|
66
|
+
urlObj.searchParams.set("request_id", requestId);
|
|
67
|
+
urlObj.searchParams.set("email", email);
|
|
68
|
+
return urlObj.toString();
|
|
69
|
+
}
|
|
70
|
+
async signInPasswordless({ db, expiration, token, requestId, mfaOtp, validationType }) {
|
|
71
|
+
return db.transaction(async (db2) => {
|
|
72
|
+
const tokenResult = await db2.queryHandler.fetch(PersonTokenQuery.PersonTokenQuery.byId(requestId, "passwordless"));
|
|
73
|
+
const tokenValidationResult = tokenUtils.validateToken({
|
|
74
|
+
entry: tokenResult,
|
|
75
|
+
token,
|
|
76
|
+
now: db2.providers.now(),
|
|
77
|
+
validationType
|
|
78
|
+
});
|
|
79
|
+
if (!tokenValidationResult.ok) {
|
|
80
|
+
if (tokenValidationResult.error === "TOKEN_INVALID" && validationType === "otp") {
|
|
81
|
+
await db2.commandBus.execute(new IncreaseOtpAttemptCommand.IncreaseOtpAttemptCommand(tokenResult.id));
|
|
82
|
+
}
|
|
83
|
+
return tokenValidationResult;
|
|
84
|
+
}
|
|
85
|
+
const personRow = await db2.queryHandler.fetch(PersonQuery.PersonQuery.byId(tokenValidationResult.result.person_id));
|
|
86
|
+
if (!personRow) {
|
|
87
|
+
throw new exceptions.ImplementationException();
|
|
88
|
+
}
|
|
89
|
+
if (personRow.disabled_at !== null) {
|
|
90
|
+
return new Response.ResponseError("PERSON_DISABLED", `Person is disabled`);
|
|
91
|
+
}
|
|
92
|
+
if (personRow.otp_uri && personRow.otp_activated_at) {
|
|
93
|
+
if (!mfaOtp) {
|
|
94
|
+
return new Response.ResponseError("OTP_REQUIRED", `2FA is enabled. OTP token is required`);
|
|
95
|
+
}
|
|
96
|
+
if (!this.otpAuthenticator.validate({ uri: personRow.otp_uri }, mfaOtp)) {
|
|
97
|
+
return new Response.ResponseError("INVALID_OTP_TOKEN", "OTP token validation has failed");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
await db2.commandBus.execute(new InvalidateTokenCommand.InvalidateTokenCommand(tokenValidationResult.result.id));
|
|
101
|
+
const sessionToken = await this.apiKeyManager.createSessionApiKey(db2, personRow.identity_id, expiration);
|
|
102
|
+
return new Response.ResponseOk({ person: personRow, token: sessionToken });
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async activatePasswordlessOtp({ db, token, requestId, otpHash }) {
|
|
106
|
+
return db.transaction(async (db2) => {
|
|
107
|
+
const tokenResult = await db2.queryHandler.fetch(PersonTokenQuery.PersonTokenQuery.byId(requestId, "passwordless"));
|
|
108
|
+
const tokenValidationResult = tokenUtils.validateToken({
|
|
109
|
+
entry: tokenResult,
|
|
110
|
+
token,
|
|
111
|
+
now: db2.providers.now(),
|
|
112
|
+
validationType: "token"
|
|
113
|
+
});
|
|
114
|
+
if (!tokenValidationResult.ok) {
|
|
115
|
+
return tokenValidationResult;
|
|
116
|
+
}
|
|
117
|
+
await db2.commandBus.execute(new ActivateOtpCommand.ActivateOtpCommand(tokenValidationResult.result.id, otpHash));
|
|
118
|
+
return new Response.ResponseOk(null);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
isEnabled(globalValue, personValue) {
|
|
122
|
+
switch (globalValue) {
|
|
123
|
+
case "always":
|
|
124
|
+
return true;
|
|
125
|
+
case "never":
|
|
126
|
+
return false;
|
|
127
|
+
case "optIn":
|
|
128
|
+
return personValue === true;
|
|
129
|
+
case "optOut":
|
|
130
|
+
return personValue !== false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.PasswordlessSignInManager = PasswordlessSignInManager;
|
|
135
|
+
//# sourceMappingURL=PasswordlessSignInManager.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordlessSignInManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordlessSignInManager.ts"],"sourcesContent":["import { ApiKeyManager } from './apiKey'\nimport { PersonQuery, PersonRow } from '../queries'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport {\n\tActivatePasswordlessOtpErrorCode,\n\tConfigPolicy,\n\tInitSignInPasswordlessErrorCode,\n\tInitSignInPasswordlessResult,\n\tSignInPasswordlessErrorCode,\n} from '../../schema'\nimport { DatabaseContext, validateToken } from '../utils'\nimport { ConfigurationManager } from './ConfigurationManager'\nimport { UserMailer } from '../mailing'\nimport { ActivateOtpCommand, CreatePersonTokenCommand, IncreaseOtpAttemptCommand } from '../commands'\nimport { getPreferredProject } from './helpers/getPreferredProject'\nimport { ProjectManager } from './ProjectManager'\nimport { PermissionContext } from '../authorization'\nimport { PersonTokenQuery } from '../queries/personToken/PersonTokenQuery'\nimport { ImplementationException } from '../../exceptions'\nimport { OtpAuthenticator } from './OtpAuthenticator'\nimport { InvalidateTokenCommand } from '../commands/personToken/InvalidateTokenCommand'\nimport { PersonToken } from '../type'\n\nclass PasswordlessSignInManager {\n\tconstructor(\n\t\tprivate readonly apiKeyManager: ApiKeyManager,\n\t\tprivate readonly configurationManager: ConfigurationManager,\n\t\tprivate readonly mailer: UserMailer,\n\t\tprivate readonly projectManager: ProjectManager,\n\t\tprivate readonly otpAuthenticator: OtpAuthenticator,\n\n\t) {}\n\n\tasync initSignInPasswordless({ db, permissionContext, mailVariant, mailProject, email }: {\n\t\tdb: DatabaseContext\n\t\tpermissionContext: PermissionContext\n\t\temail: string\n\t\tmailVariant?: string\n\t\tmailProject?: string\n\t}): Promise<PasswordlessSignInManager.InitSignInPasswordlessResponse> {\n\t\treturn db.transaction(async (db): Promise<PasswordlessSignInManager.InitSignInPasswordlessResponse> => {\n\t\t\tconst configuration = await this.configurationManager.fetchConfiguration(db)\n\t\t\tif (configuration.passwordless.enabled === 'never') {\n\t\t\t\treturn new ResponseError('PASSWORDLESS_DISABLED', 'Passwordless sign-in is disabled')\n\t\t\t}\n\n\t\t\tconst person = await db.queryHandler.fetch(PersonQuery.byEmail(email))\n\t\t\tif (!person) {\n\t\t\t\treturn new ResponseError('PERSON_NOT_FOUND', `Person ${email} not found`)\n\t\t\t}\n\t\t\tif (!this.isEnabled(configuration.passwordless.enabled, person.passwordless_enabled)) {\n\t\t\t\treturn new ResponseError('PASSWORDLESS_DISABLED', 'Passwordless sign-in is disabled for this person')\n\t\t\t}\n\n\t\t\tconst createTokenCommand = CreatePersonTokenCommand.createPasswordlessRequest(person.id, configuration.passwordless.expirationMinutes)\n\t\t\tconst result = await db.commandBus.execute(createTokenCommand)\n\n\n\t\t\tconst url = this.formatUrl(configuration.passwordless.url ?? null, result.token, result.id, email) ?? undefined\n\n\t\t\tconst projects = await this.projectManager.getProjectsByIdentity(db, person.identity_id, permissionContext)\n\t\t\tconst project = getPreferredProject(projects, mailProject ?? null)\n\n\t\t\tawait this.mailer.sendPasswordlessEmail(db, {\n\t\t\t\temail,\n\t\t\t\ttoken: result.token,\n\t\t\t\turl,\n\t\t\t\tproject: project?.name,\n\t\t\t\tprojectSlug: project?.slug,\n\t\t\t}, {\n\t\t\t\tvariant: mailVariant || '',\n\t\t\t\tprojectId: project?.id ?? null,\n\t\t\t})\n\n\t\t\treturn new ResponseOk({ requestId: result.id, expiresAt: result.expiresAt })\n\t\t})\n\t}\n\n\tprivate formatUrl(url: string | null, token: string, requestId: string, email: string): string | null {\n\t\tif (!url) {\n\t\t\treturn null\n\t\t}\n\t\tconst urlObj = new URL(url)\n\t\turlObj.searchParams.set('token', token)\n\t\turlObj.searchParams.set('request_id', requestId)\n\t\turlObj.searchParams.set('email', email)\n\t\treturn urlObj.toString()\n\t}\n\n\tasync signInPasswordless({ db, expiration, token, requestId, mfaOtp, validationType }: {\n\t\tdb: DatabaseContext\n\t\tvalidationType: PersonToken.ValidationType\n\t\trequestId: string\n\t\ttoken: string\n\t\tmfaOtp?: string\n\t\texpiration?: number\n\t}): Promise<PasswordlessSignInManager.SignInPasswordlessResponse> {\n\t\treturn db.transaction(async (db): Promise<PasswordlessSignInManager.SignInPasswordlessResponse> => {\n\n\t\t\tconst tokenResult = await db.queryHandler.fetch(PersonTokenQuery.byId(requestId, 'passwordless'))\n\t\t\tconst tokenValidationResult = validateToken({\n\t\t\t\tentry: tokenResult,\n\t\t\t\ttoken,\n\t\t\t\tnow: db.providers.now(),\n\t\t\t\tvalidationType,\n\t\t\t})\n\t\t\tif (!tokenValidationResult.ok) {\n\t\t\t\tif (tokenValidationResult.error === 'TOKEN_INVALID' && validationType === 'otp') {\n\t\t\t\t\tawait db.commandBus.execute(new IncreaseOtpAttemptCommand(tokenResult!.id))\n\t\t\t\t}\n\t\t\t\treturn tokenValidationResult\n\t\t\t}\n\t\t\tconst personRow = await db.queryHandler.fetch(PersonQuery.byId(tokenValidationResult.result.person_id))\n\t\t\tif (!personRow) {\n\t\t\t\tthrow new ImplementationException()\n\t\t\t}\n\t\t\tif (personRow.disabled_at !== null) {\n\t\t\t\treturn new ResponseError('PERSON_DISABLED', `Person is disabled`)\n\t\t\t}\n\n\t\t\tif (personRow.otp_uri && personRow.otp_activated_at) {\n\t\t\t\tif (!mfaOtp) {\n\t\t\t\t\treturn new ResponseError('OTP_REQUIRED', `2FA is enabled. OTP token is required`)\n\t\t\t\t}\n\n\t\t\t\tif (!this.otpAuthenticator.validate({ uri: personRow.otp_uri }, mfaOtp)) {\n\t\t\t\t\treturn new ResponseError('INVALID_OTP_TOKEN', 'OTP token validation has failed')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(new InvalidateTokenCommand(tokenValidationResult.result.id))\n\t\t\tconst sessionToken = await this.apiKeyManager.createSessionApiKey(db, personRow.identity_id, expiration)\n\n\t\t\treturn new ResponseOk({ person: personRow, token: sessionToken })\n\t\t})\n\t}\n\n\tasync activatePasswordlessOtp({ db, token, requestId, otpHash }: {\n\t\tdb: DatabaseContext\n\t\trequestId: string\n\t\ttoken: string\n\t\totpHash: string\n\t}): Promise<PasswordlessSignInManager.ActivatePasswordlessOtpResponse> {\n\t\treturn db.transaction(async (db): Promise<PasswordlessSignInManager.ActivatePasswordlessOtpResponse> => {\n\n\t\t\tconst tokenResult = await db.queryHandler.fetch(PersonTokenQuery.byId(requestId, 'passwordless'))\n\t\t\tconst tokenValidationResult = validateToken({\n\t\t\t\tentry: tokenResult,\n\t\t\t\ttoken,\n\t\t\t\tnow: db.providers.now(),\n\t\t\t\tvalidationType: 'token',\n\t\t\t})\n\t\t\tif (!tokenValidationResult.ok) {\n\t\t\t\treturn tokenValidationResult\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(new ActivateOtpCommand(tokenValidationResult.result.id, otpHash))\n\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tprivate isEnabled(globalValue: ConfigPolicy, personValue: boolean | null): boolean {\n\t\tswitch (globalValue) {\n\t\t\tcase 'always':\n\t\t\t\treturn true\n\t\t\tcase 'never':\n\t\t\t\treturn false\n\t\t\tcase 'optIn':\n\t\t\t\treturn personValue === true\n\t\t\tcase 'optOut':\n\t\t\t\treturn personValue !== false\n\t\t}\n\t}\n}\n\nnamespace PasswordlessSignInManager {\n\texport type InitSignInPasswordlessResponse = Response<InitSignInPasswordlessResult, InitSignInPasswordlessErrorCode>\n\n\n\tinterface SignInPasswordlessResult {\n\t\treadonly person: PersonRow\n\t\treadonly token: string\n\t}\n\texport type SignInPasswordlessResponse = Response<SignInPasswordlessResult, SignInPasswordlessErrorCode>\n\n\texport type ActivatePasswordlessOtpResponse = Response<null, ActivatePasswordlessOtpErrorCode>\n}\n\nexport { PasswordlessSignInManager }\n"],"names":["db","ResponseError","PersonQuery","CreatePersonTokenCommand","getPreferredProject","ResponseOk","PersonTokenQuery","validateToken","IncreaseOtpAttemptCommand","ImplementationException","InvalidateTokenCommand","ActivateOtpCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,0BAA0B;AAAA,EAC/B,YACkB,eACA,sBACA,QACA,gBACA,kBAEhB;AANgB,SAAA,gBAAA;AACA,SAAA,uBAAA;AACA,SAAA,SAAA;AACA,SAAA,iBAAA;AACA,SAAA,mBAAA;AAAA,EAAA;AAAA,EAIlB,MAAM,uBAAuB,EAAE,IAAI,mBAAmB,aAAa,aAAa,SAMV;AAC9D,WAAA,GAAG,YAAY,OAAOA,QAA0E;AACtG,YAAM,gBAAgB,MAAM,KAAK,qBAAqB,mBAAmBA,GAAE;AACvE,UAAA,cAAc,aAAa,YAAY,SAAS;AAC5C,eAAA,IAAIC,SAAAA,cAAc,yBAAyB,kCAAkC;AAAA,MAAA;AAG/E,YAAA,SAAS,MAAMD,IAAG,aAAa,MAAME,wBAAY,QAAQ,KAAK,CAAC;AACrE,UAAI,CAAC,QAAQ;AACZ,eAAO,IAAID,SAAA,cAAc,oBAAoB,UAAU,KAAK,YAAY;AAAA,MAAA;AAErE,UAAA,CAAC,KAAK,UAAU,cAAc,aAAa,SAAS,OAAO,oBAAoB,GAAG;AAC9E,eAAA,IAAIA,SAAAA,cAAc,yBAAyB,kDAAkD;AAAA,MAAA;AAGrG,YAAM,qBAAqBE,yBAAyB,yBAAA,0BAA0B,OAAO,IAAI,cAAc,aAAa,iBAAiB;AACrI,YAAM,SAAS,MAAMH,IAAG,WAAW,QAAQ,kBAAkB;AAG7D,YAAM,MAAM,KAAK,UAAU,cAAc,aAAa,OAAO,MAAM,OAAO,OAAO,OAAO,IAAI,KAAK,KAAK;AAEhG,YAAA,WAAW,MAAM,KAAK,eAAe,sBAAsBA,KAAI,OAAO,aAAa,iBAAiB;AAC1G,YAAM,UAAUI,oBAAA,oBAAoB,UAAU,eAAe,IAAI;AAE3D,YAAA,KAAK,OAAO,sBAAsBJ,KAAI;AAAA,QAC3C;AAAA,QACA,OAAO,OAAO;AAAA,QACd;AAAA,QACA,SAAS,SAAS;AAAA,QAClB,aAAa,SAAS;AAAA,MAAA,GACpB;AAAA,QACF,SAAS,eAAe;AAAA,QACxB,WAAW,SAAS,MAAM;AAAA,MAAA,CAC1B;AAEM,aAAA,IAAIK,SAAAA,WAAW,EAAE,WAAW,OAAO,IAAI,WAAW,OAAO,WAAW;AAAA,IAAA,CAC3E;AAAA,EAAA;AAAA,EAGM,UAAU,KAAoB,OAAe,WAAmB,OAA8B;AACrG,QAAI,CAAC,KAAK;AACF,aAAA;AAAA,IAAA;AAEF,UAAA,SAAS,IAAI,IAAI,GAAG;AACnB,WAAA,aAAa,IAAI,SAAS,KAAK;AAC/B,WAAA,aAAa,IAAI,cAAc,SAAS;AACxC,WAAA,aAAa,IAAI,SAAS,KAAK;AACtC,WAAO,OAAO,SAAS;AAAA,EAAA;AAAA,EAGxB,MAAM,mBAAmB,EAAE,IAAI,YAAY,OAAO,WAAW,QAAQ,kBAOH;AAC1D,WAAA,GAAG,YAAY,OAAOL,QAAsE;AAE5F,YAAA,cAAc,MAAMA,IAAG,aAAa,MAAMM,iBAAAA,iBAAiB,KAAK,WAAW,cAAc,CAAC;AAChG,YAAM,wBAAwBC,WAAAA,cAAc;AAAA,QAC3C,OAAO;AAAA,QACP;AAAA,QACA,KAAKP,IAAG,UAAU,IAAI;AAAA,QACtB;AAAA,MAAA,CACA;AACG,UAAA,CAAC,sBAAsB,IAAI;AAC9B,YAAI,sBAAsB,UAAU,mBAAmB,mBAAmB,OAAO;AAChF,gBAAMA,IAAG,WAAW,QAAQ,IAAIQ,0BAAAA,0BAA0B,YAAa,EAAE,CAAC;AAAA,QAAA;AAEpE,eAAA;AAAA,MAAA;AAEF,YAAA,YAAY,MAAMR,IAAG,aAAa,MAAME,wBAAY,KAAK,sBAAsB,OAAO,SAAS,CAAC;AACtG,UAAI,CAAC,WAAW;AACf,cAAM,IAAIO,WAAAA,wBAAwB;AAAA,MAAA;AAE/B,UAAA,UAAU,gBAAgB,MAAM;AAC5B,eAAA,IAAIR,SAAc,cAAA,mBAAmB,oBAAoB;AAAA,MAAA;AAG7D,UAAA,UAAU,WAAW,UAAU,kBAAkB;AACpD,YAAI,CAAC,QAAQ;AACL,iBAAA,IAAIA,SAAc,cAAA,gBAAgB,uCAAuC;AAAA,QAAA;AAG7E,YAAA,CAAC,KAAK,iBAAiB,SAAS,EAAE,KAAK,UAAU,WAAW,MAAM,GAAG;AACjE,iBAAA,IAAIA,SAAAA,cAAc,qBAAqB,iCAAiC;AAAA,QAAA;AAAA,MAChF;AAGKD,YAAAA,IAAG,WAAW,QAAQ,IAAIU,8CAAuB,sBAAsB,OAAO,EAAE,CAAC;AACjF,YAAA,eAAe,MAAM,KAAK,cAAc,oBAAoBV,KAAI,UAAU,aAAa,UAAU;AAEvG,aAAO,IAAIK,SAAW,WAAA,EAAE,QAAQ,WAAW,OAAO,cAAc;AAAA,IAAA,CAChE;AAAA,EAAA;AAAA,EAGF,MAAM,wBAAwB,EAAE,IAAI,OAAO,WAAW,WAKiB;AAC/D,WAAA,GAAG,YAAY,OAAOL,QAA2E;AAEjG,YAAA,cAAc,MAAMA,IAAG,aAAa,MAAMM,iBAAAA,iBAAiB,KAAK,WAAW,cAAc,CAAC;AAChG,YAAM,wBAAwBC,WAAAA,cAAc;AAAA,QAC3C,OAAO;AAAA,QACP;AAAA,QACA,KAAKP,IAAG,UAAU,IAAI;AAAA,QACtB,gBAAgB;AAAA,MAAA,CAChB;AACG,UAAA,CAAC,sBAAsB,IAAI;AACvB,eAAA;AAAA,MAAA;AAGFA,YAAAA,IAAG,WAAW,QAAQ,IAAIW,mBAAAA,mBAAmB,sBAAsB,OAAO,IAAI,OAAO,CAAC;AAErF,aAAA,IAAIN,oBAAW,IAAI;AAAA,IAAA,CAC1B;AAAA,EAAA;AAAA,EAGM,UAAU,aAA2B,aAAsC;AAClF,YAAQ,aAAa;AAAA,MACpB,KAAK;AACG,eAAA;AAAA,MACR,KAAK;AACG,eAAA;AAAA,MACR,KAAK;AACJ,eAAO,gBAAgB;AAAA,MACxB,KAAK;AACJ,eAAO,gBAAgB;AAAA,IAAA;AAAA,EACzB;AAEF;;"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import "../queries/apiKey/ApiKeyQuery.js";
|
|
2
|
+
import "@contember/database";
|
|
3
|
+
import { ImplementationException } from "../../exceptions.js";
|
|
4
|
+
import { PersonQuery } from "../queries/person/PersonQuery.js";
|
|
5
|
+
import "../authorization/PermissionActions.js";
|
|
6
|
+
import "@contember/authorization";
|
|
7
|
+
import "../authorization/PermissionContext.js";
|
|
8
|
+
import "../authorization/PermissionsFactory.js";
|
|
9
|
+
import "@contember/schema";
|
|
10
|
+
import { ResponseError, ResponseOk } from "../utils/Response.js";
|
|
11
|
+
import "../type/ApiKey.js";
|
|
12
|
+
import { ActivateOtpCommand } from "../commands/personToken/ActivateOtpCommand.js";
|
|
13
|
+
import { CreatePersonTokenCommand } from "../commands/personToken/CreatePersonTokenCommand.js";
|
|
14
|
+
import { InvalidateTokenCommand } from "../commands/personToken/InvalidateTokenCommand.js";
|
|
15
|
+
import { IncreaseOtpAttemptCommand } from "../commands/personToken/IncreaseOtpAttemptCommand.js";
|
|
16
|
+
import { PersonTokenQuery } from "../queries/personToken/PersonTokenQuery.js";
|
|
17
|
+
import { validateToken } from "../utils/tokenUtils.js";
|
|
18
|
+
import { getPreferredProject } from "./helpers/getPreferredProject.js";
|
|
19
|
+
class PasswordlessSignInManager {
|
|
20
|
+
constructor(apiKeyManager, configurationManager, mailer, projectManager, otpAuthenticator) {
|
|
21
|
+
this.apiKeyManager = apiKeyManager;
|
|
22
|
+
this.configurationManager = configurationManager;
|
|
23
|
+
this.mailer = mailer;
|
|
24
|
+
this.projectManager = projectManager;
|
|
25
|
+
this.otpAuthenticator = otpAuthenticator;
|
|
26
|
+
}
|
|
27
|
+
async initSignInPasswordless({ db, permissionContext, mailVariant, mailProject, email }) {
|
|
28
|
+
return db.transaction(async (db2) => {
|
|
29
|
+
const configuration = await this.configurationManager.fetchConfiguration(db2);
|
|
30
|
+
if (configuration.passwordless.enabled === "never") {
|
|
31
|
+
return new ResponseError("PASSWORDLESS_DISABLED", "Passwordless sign-in is disabled");
|
|
32
|
+
}
|
|
33
|
+
const person = await db2.queryHandler.fetch(PersonQuery.byEmail(email));
|
|
34
|
+
if (!person) {
|
|
35
|
+
return new ResponseError("PERSON_NOT_FOUND", `Person ${email} not found`);
|
|
36
|
+
}
|
|
37
|
+
if (!this.isEnabled(configuration.passwordless.enabled, person.passwordless_enabled)) {
|
|
38
|
+
return new ResponseError("PASSWORDLESS_DISABLED", "Passwordless sign-in is disabled for this person");
|
|
39
|
+
}
|
|
40
|
+
const createTokenCommand = CreatePersonTokenCommand.createPasswordlessRequest(person.id, configuration.passwordless.expirationMinutes);
|
|
41
|
+
const result = await db2.commandBus.execute(createTokenCommand);
|
|
42
|
+
const url = this.formatUrl(configuration.passwordless.url ?? null, result.token, result.id, email) ?? void 0;
|
|
43
|
+
const projects = await this.projectManager.getProjectsByIdentity(db2, person.identity_id, permissionContext);
|
|
44
|
+
const project = getPreferredProject(projects, mailProject ?? null);
|
|
45
|
+
await this.mailer.sendPasswordlessEmail(db2, {
|
|
46
|
+
email,
|
|
47
|
+
token: result.token,
|
|
48
|
+
url,
|
|
49
|
+
project: project?.name,
|
|
50
|
+
projectSlug: project?.slug
|
|
51
|
+
}, {
|
|
52
|
+
variant: mailVariant || "",
|
|
53
|
+
projectId: project?.id ?? null
|
|
54
|
+
});
|
|
55
|
+
return new ResponseOk({ requestId: result.id, expiresAt: result.expiresAt });
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
formatUrl(url, token, requestId, email) {
|
|
59
|
+
if (!url) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const urlObj = new URL(url);
|
|
63
|
+
urlObj.searchParams.set("token", token);
|
|
64
|
+
urlObj.searchParams.set("request_id", requestId);
|
|
65
|
+
urlObj.searchParams.set("email", email);
|
|
66
|
+
return urlObj.toString();
|
|
67
|
+
}
|
|
68
|
+
async signInPasswordless({ db, expiration, token, requestId, mfaOtp, validationType }) {
|
|
69
|
+
return db.transaction(async (db2) => {
|
|
70
|
+
const tokenResult = await db2.queryHandler.fetch(PersonTokenQuery.byId(requestId, "passwordless"));
|
|
71
|
+
const tokenValidationResult = validateToken({
|
|
72
|
+
entry: tokenResult,
|
|
73
|
+
token,
|
|
74
|
+
now: db2.providers.now(),
|
|
75
|
+
validationType
|
|
76
|
+
});
|
|
77
|
+
if (!tokenValidationResult.ok) {
|
|
78
|
+
if (tokenValidationResult.error === "TOKEN_INVALID" && validationType === "otp") {
|
|
79
|
+
await db2.commandBus.execute(new IncreaseOtpAttemptCommand(tokenResult.id));
|
|
80
|
+
}
|
|
81
|
+
return tokenValidationResult;
|
|
82
|
+
}
|
|
83
|
+
const personRow = await db2.queryHandler.fetch(PersonQuery.byId(tokenValidationResult.result.person_id));
|
|
84
|
+
if (!personRow) {
|
|
85
|
+
throw new ImplementationException();
|
|
86
|
+
}
|
|
87
|
+
if (personRow.disabled_at !== null) {
|
|
88
|
+
return new ResponseError("PERSON_DISABLED", `Person is disabled`);
|
|
89
|
+
}
|
|
90
|
+
if (personRow.otp_uri && personRow.otp_activated_at) {
|
|
91
|
+
if (!mfaOtp) {
|
|
92
|
+
return new ResponseError("OTP_REQUIRED", `2FA is enabled. OTP token is required`);
|
|
93
|
+
}
|
|
94
|
+
if (!this.otpAuthenticator.validate({ uri: personRow.otp_uri }, mfaOtp)) {
|
|
95
|
+
return new ResponseError("INVALID_OTP_TOKEN", "OTP token validation has failed");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
await db2.commandBus.execute(new InvalidateTokenCommand(tokenValidationResult.result.id));
|
|
99
|
+
const sessionToken = await this.apiKeyManager.createSessionApiKey(db2, personRow.identity_id, expiration);
|
|
100
|
+
return new ResponseOk({ person: personRow, token: sessionToken });
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async activatePasswordlessOtp({ db, token, requestId, otpHash }) {
|
|
104
|
+
return db.transaction(async (db2) => {
|
|
105
|
+
const tokenResult = await db2.queryHandler.fetch(PersonTokenQuery.byId(requestId, "passwordless"));
|
|
106
|
+
const tokenValidationResult = validateToken({
|
|
107
|
+
entry: tokenResult,
|
|
108
|
+
token,
|
|
109
|
+
now: db2.providers.now(),
|
|
110
|
+
validationType: "token"
|
|
111
|
+
});
|
|
112
|
+
if (!tokenValidationResult.ok) {
|
|
113
|
+
return tokenValidationResult;
|
|
114
|
+
}
|
|
115
|
+
await db2.commandBus.execute(new ActivateOtpCommand(tokenValidationResult.result.id, otpHash));
|
|
116
|
+
return new ResponseOk(null);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
isEnabled(globalValue, personValue) {
|
|
120
|
+
switch (globalValue) {
|
|
121
|
+
case "always":
|
|
122
|
+
return true;
|
|
123
|
+
case "never":
|
|
124
|
+
return false;
|
|
125
|
+
case "optIn":
|
|
126
|
+
return personValue === true;
|
|
127
|
+
case "optOut":
|
|
128
|
+
return personValue !== false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
PasswordlessSignInManager
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=PasswordlessSignInManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordlessSignInManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PasswordlessSignInManager.ts"],"sourcesContent":["import { ApiKeyManager } from './apiKey'\nimport { PersonQuery, PersonRow } from '../queries'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport {\n\tActivatePasswordlessOtpErrorCode,\n\tConfigPolicy,\n\tInitSignInPasswordlessErrorCode,\n\tInitSignInPasswordlessResult,\n\tSignInPasswordlessErrorCode,\n} from '../../schema'\nimport { DatabaseContext, validateToken } from '../utils'\nimport { ConfigurationManager } from './ConfigurationManager'\nimport { UserMailer } from '../mailing'\nimport { ActivateOtpCommand, CreatePersonTokenCommand, IncreaseOtpAttemptCommand } from '../commands'\nimport { getPreferredProject } from './helpers/getPreferredProject'\nimport { ProjectManager } from './ProjectManager'\nimport { PermissionContext } from '../authorization'\nimport { PersonTokenQuery } from '../queries/personToken/PersonTokenQuery'\nimport { ImplementationException } from '../../exceptions'\nimport { OtpAuthenticator } from './OtpAuthenticator'\nimport { InvalidateTokenCommand } from '../commands/personToken/InvalidateTokenCommand'\nimport { PersonToken } from '../type'\n\nclass PasswordlessSignInManager {\n\tconstructor(\n\t\tprivate readonly apiKeyManager: ApiKeyManager,\n\t\tprivate readonly configurationManager: ConfigurationManager,\n\t\tprivate readonly mailer: UserMailer,\n\t\tprivate readonly projectManager: ProjectManager,\n\t\tprivate readonly otpAuthenticator: OtpAuthenticator,\n\n\t) {}\n\n\tasync initSignInPasswordless({ db, permissionContext, mailVariant, mailProject, email }: {\n\t\tdb: DatabaseContext\n\t\tpermissionContext: PermissionContext\n\t\temail: string\n\t\tmailVariant?: string\n\t\tmailProject?: string\n\t}): Promise<PasswordlessSignInManager.InitSignInPasswordlessResponse> {\n\t\treturn db.transaction(async (db): Promise<PasswordlessSignInManager.InitSignInPasswordlessResponse> => {\n\t\t\tconst configuration = await this.configurationManager.fetchConfiguration(db)\n\t\t\tif (configuration.passwordless.enabled === 'never') {\n\t\t\t\treturn new ResponseError('PASSWORDLESS_DISABLED', 'Passwordless sign-in is disabled')\n\t\t\t}\n\n\t\t\tconst person = await db.queryHandler.fetch(PersonQuery.byEmail(email))\n\t\t\tif (!person) {\n\t\t\t\treturn new ResponseError('PERSON_NOT_FOUND', `Person ${email} not found`)\n\t\t\t}\n\t\t\tif (!this.isEnabled(configuration.passwordless.enabled, person.passwordless_enabled)) {\n\t\t\t\treturn new ResponseError('PASSWORDLESS_DISABLED', 'Passwordless sign-in is disabled for this person')\n\t\t\t}\n\n\t\t\tconst createTokenCommand = CreatePersonTokenCommand.createPasswordlessRequest(person.id, configuration.passwordless.expirationMinutes)\n\t\t\tconst result = await db.commandBus.execute(createTokenCommand)\n\n\n\t\t\tconst url = this.formatUrl(configuration.passwordless.url ?? null, result.token, result.id, email) ?? undefined\n\n\t\t\tconst projects = await this.projectManager.getProjectsByIdentity(db, person.identity_id, permissionContext)\n\t\t\tconst project = getPreferredProject(projects, mailProject ?? null)\n\n\t\t\tawait this.mailer.sendPasswordlessEmail(db, {\n\t\t\t\temail,\n\t\t\t\ttoken: result.token,\n\t\t\t\turl,\n\t\t\t\tproject: project?.name,\n\t\t\t\tprojectSlug: project?.slug,\n\t\t\t}, {\n\t\t\t\tvariant: mailVariant || '',\n\t\t\t\tprojectId: project?.id ?? null,\n\t\t\t})\n\n\t\t\treturn new ResponseOk({ requestId: result.id, expiresAt: result.expiresAt })\n\t\t})\n\t}\n\n\tprivate formatUrl(url: string | null, token: string, requestId: string, email: string): string | null {\n\t\tif (!url) {\n\t\t\treturn null\n\t\t}\n\t\tconst urlObj = new URL(url)\n\t\turlObj.searchParams.set('token', token)\n\t\turlObj.searchParams.set('request_id', requestId)\n\t\turlObj.searchParams.set('email', email)\n\t\treturn urlObj.toString()\n\t}\n\n\tasync signInPasswordless({ db, expiration, token, requestId, mfaOtp, validationType }: {\n\t\tdb: DatabaseContext\n\t\tvalidationType: PersonToken.ValidationType\n\t\trequestId: string\n\t\ttoken: string\n\t\tmfaOtp?: string\n\t\texpiration?: number\n\t}): Promise<PasswordlessSignInManager.SignInPasswordlessResponse> {\n\t\treturn db.transaction(async (db): Promise<PasswordlessSignInManager.SignInPasswordlessResponse> => {\n\n\t\t\tconst tokenResult = await db.queryHandler.fetch(PersonTokenQuery.byId(requestId, 'passwordless'))\n\t\t\tconst tokenValidationResult = validateToken({\n\t\t\t\tentry: tokenResult,\n\t\t\t\ttoken,\n\t\t\t\tnow: db.providers.now(),\n\t\t\t\tvalidationType,\n\t\t\t})\n\t\t\tif (!tokenValidationResult.ok) {\n\t\t\t\tif (tokenValidationResult.error === 'TOKEN_INVALID' && validationType === 'otp') {\n\t\t\t\t\tawait db.commandBus.execute(new IncreaseOtpAttemptCommand(tokenResult!.id))\n\t\t\t\t}\n\t\t\t\treturn tokenValidationResult\n\t\t\t}\n\t\t\tconst personRow = await db.queryHandler.fetch(PersonQuery.byId(tokenValidationResult.result.person_id))\n\t\t\tif (!personRow) {\n\t\t\t\tthrow new ImplementationException()\n\t\t\t}\n\t\t\tif (personRow.disabled_at !== null) {\n\t\t\t\treturn new ResponseError('PERSON_DISABLED', `Person is disabled`)\n\t\t\t}\n\n\t\t\tif (personRow.otp_uri && personRow.otp_activated_at) {\n\t\t\t\tif (!mfaOtp) {\n\t\t\t\t\treturn new ResponseError('OTP_REQUIRED', `2FA is enabled. OTP token is required`)\n\t\t\t\t}\n\n\t\t\t\tif (!this.otpAuthenticator.validate({ uri: personRow.otp_uri }, mfaOtp)) {\n\t\t\t\t\treturn new ResponseError('INVALID_OTP_TOKEN', 'OTP token validation has failed')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(new InvalidateTokenCommand(tokenValidationResult.result.id))\n\t\t\tconst sessionToken = await this.apiKeyManager.createSessionApiKey(db, personRow.identity_id, expiration)\n\n\t\t\treturn new ResponseOk({ person: personRow, token: sessionToken })\n\t\t})\n\t}\n\n\tasync activatePasswordlessOtp({ db, token, requestId, otpHash }: {\n\t\tdb: DatabaseContext\n\t\trequestId: string\n\t\ttoken: string\n\t\totpHash: string\n\t}): Promise<PasswordlessSignInManager.ActivatePasswordlessOtpResponse> {\n\t\treturn db.transaction(async (db): Promise<PasswordlessSignInManager.ActivatePasswordlessOtpResponse> => {\n\n\t\t\tconst tokenResult = await db.queryHandler.fetch(PersonTokenQuery.byId(requestId, 'passwordless'))\n\t\t\tconst tokenValidationResult = validateToken({\n\t\t\t\tentry: tokenResult,\n\t\t\t\ttoken,\n\t\t\t\tnow: db.providers.now(),\n\t\t\t\tvalidationType: 'token',\n\t\t\t})\n\t\t\tif (!tokenValidationResult.ok) {\n\t\t\t\treturn tokenValidationResult\n\t\t\t}\n\n\t\t\tawait db.commandBus.execute(new ActivateOtpCommand(tokenValidationResult.result.id, otpHash))\n\n\t\t\treturn new ResponseOk(null)\n\t\t})\n\t}\n\n\tprivate isEnabled(globalValue: ConfigPolicy, personValue: boolean | null): boolean {\n\t\tswitch (globalValue) {\n\t\t\tcase 'always':\n\t\t\t\treturn true\n\t\t\tcase 'never':\n\t\t\t\treturn false\n\t\t\tcase 'optIn':\n\t\t\t\treturn personValue === true\n\t\t\tcase 'optOut':\n\t\t\t\treturn personValue !== false\n\t\t}\n\t}\n}\n\nnamespace PasswordlessSignInManager {\n\texport type InitSignInPasswordlessResponse = Response<InitSignInPasswordlessResult, InitSignInPasswordlessErrorCode>\n\n\n\tinterface SignInPasswordlessResult {\n\t\treadonly person: PersonRow\n\t\treadonly token: string\n\t}\n\texport type SignInPasswordlessResponse = Response<SignInPasswordlessResult, SignInPasswordlessErrorCode>\n\n\texport type ActivatePasswordlessOtpResponse = Response<null, ActivatePasswordlessOtpErrorCode>\n}\n\nexport { PasswordlessSignInManager }\n"],"names":["db"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,MAAM,0BAA0B;AAAA,EAC/B,YACkB,eACA,sBACA,QACA,gBACA,kBAEhB;AANgB,SAAA,gBAAA;AACA,SAAA,uBAAA;AACA,SAAA,SAAA;AACA,SAAA,iBAAA;AACA,SAAA,mBAAA;AAAA,EAAA;AAAA,EAIlB,MAAM,uBAAuB,EAAE,IAAI,mBAAmB,aAAa,aAAa,SAMV;AAC9D,WAAA,GAAG,YAAY,OAAOA,QAA0E;AACtG,YAAM,gBAAgB,MAAM,KAAK,qBAAqB,mBAAmBA,GAAE;AACvE,UAAA,cAAc,aAAa,YAAY,SAAS;AAC5C,eAAA,IAAI,cAAc,yBAAyB,kCAAkC;AAAA,MAAA;AAG/E,YAAA,SAAS,MAAMA,IAAG,aAAa,MAAM,YAAY,QAAQ,KAAK,CAAC;AACrE,UAAI,CAAC,QAAQ;AACZ,eAAO,IAAI,cAAc,oBAAoB,UAAU,KAAK,YAAY;AAAA,MAAA;AAErE,UAAA,CAAC,KAAK,UAAU,cAAc,aAAa,SAAS,OAAO,oBAAoB,GAAG;AAC9E,eAAA,IAAI,cAAc,yBAAyB,kDAAkD;AAAA,MAAA;AAGrG,YAAM,qBAAqB,yBAAyB,0BAA0B,OAAO,IAAI,cAAc,aAAa,iBAAiB;AACrI,YAAM,SAAS,MAAMA,IAAG,WAAW,QAAQ,kBAAkB;AAG7D,YAAM,MAAM,KAAK,UAAU,cAAc,aAAa,OAAO,MAAM,OAAO,OAAO,OAAO,IAAI,KAAK,KAAK;AAEhG,YAAA,WAAW,MAAM,KAAK,eAAe,sBAAsBA,KAAI,OAAO,aAAa,iBAAiB;AAC1G,YAAM,UAAU,oBAAoB,UAAU,eAAe,IAAI;AAE3D,YAAA,KAAK,OAAO,sBAAsBA,KAAI;AAAA,QAC3C;AAAA,QACA,OAAO,OAAO;AAAA,QACd;AAAA,QACA,SAAS,SAAS;AAAA,QAClB,aAAa,SAAS;AAAA,MAAA,GACpB;AAAA,QACF,SAAS,eAAe;AAAA,QACxB,WAAW,SAAS,MAAM;AAAA,MAAA,CAC1B;AAEM,aAAA,IAAI,WAAW,EAAE,WAAW,OAAO,IAAI,WAAW,OAAO,WAAW;AAAA,IAAA,CAC3E;AAAA,EAAA;AAAA,EAGM,UAAU,KAAoB,OAAe,WAAmB,OAA8B;AACrG,QAAI,CAAC,KAAK;AACF,aAAA;AAAA,IAAA;AAEF,UAAA,SAAS,IAAI,IAAI,GAAG;AACnB,WAAA,aAAa,IAAI,SAAS,KAAK;AAC/B,WAAA,aAAa,IAAI,cAAc,SAAS;AACxC,WAAA,aAAa,IAAI,SAAS,KAAK;AACtC,WAAO,OAAO,SAAS;AAAA,EAAA;AAAA,EAGxB,MAAM,mBAAmB,EAAE,IAAI,YAAY,OAAO,WAAW,QAAQ,kBAOH;AAC1D,WAAA,GAAG,YAAY,OAAOA,QAAsE;AAE5F,YAAA,cAAc,MAAMA,IAAG,aAAa,MAAM,iBAAiB,KAAK,WAAW,cAAc,CAAC;AAChG,YAAM,wBAAwB,cAAc;AAAA,QAC3C,OAAO;AAAA,QACP;AAAA,QACA,KAAKA,IAAG,UAAU,IAAI;AAAA,QACtB;AAAA,MAAA,CACA;AACG,UAAA,CAAC,sBAAsB,IAAI;AAC9B,YAAI,sBAAsB,UAAU,mBAAmB,mBAAmB,OAAO;AAChF,gBAAMA,IAAG,WAAW,QAAQ,IAAI,0BAA0B,YAAa,EAAE,CAAC;AAAA,QAAA;AAEpE,eAAA;AAAA,MAAA;AAEF,YAAA,YAAY,MAAMA,IAAG,aAAa,MAAM,YAAY,KAAK,sBAAsB,OAAO,SAAS,CAAC;AACtG,UAAI,CAAC,WAAW;AACf,cAAM,IAAI,wBAAwB;AAAA,MAAA;AAE/B,UAAA,UAAU,gBAAgB,MAAM;AAC5B,eAAA,IAAI,cAAc,mBAAmB,oBAAoB;AAAA,MAAA;AAG7D,UAAA,UAAU,WAAW,UAAU,kBAAkB;AACpD,YAAI,CAAC,QAAQ;AACL,iBAAA,IAAI,cAAc,gBAAgB,uCAAuC;AAAA,QAAA;AAG7E,YAAA,CAAC,KAAK,iBAAiB,SAAS,EAAE,KAAK,UAAU,WAAW,MAAM,GAAG;AACjE,iBAAA,IAAI,cAAc,qBAAqB,iCAAiC;AAAA,QAAA;AAAA,MAChF;AAGKA,YAAAA,IAAG,WAAW,QAAQ,IAAI,uBAAuB,sBAAsB,OAAO,EAAE,CAAC;AACjF,YAAA,eAAe,MAAM,KAAK,cAAc,oBAAoBA,KAAI,UAAU,aAAa,UAAU;AAEvG,aAAO,IAAI,WAAW,EAAE,QAAQ,WAAW,OAAO,cAAc;AAAA,IAAA,CAChE;AAAA,EAAA;AAAA,EAGF,MAAM,wBAAwB,EAAE,IAAI,OAAO,WAAW,WAKiB;AAC/D,WAAA,GAAG,YAAY,OAAOA,QAA2E;AAEjG,YAAA,cAAc,MAAMA,IAAG,aAAa,MAAM,iBAAiB,KAAK,WAAW,cAAc,CAAC;AAChG,YAAM,wBAAwB,cAAc;AAAA,QAC3C,OAAO;AAAA,QACP;AAAA,QACA,KAAKA,IAAG,UAAU,IAAI;AAAA,QACtB,gBAAgB;AAAA,MAAA,CAChB;AACG,UAAA,CAAC,sBAAsB,IAAI;AACvB,eAAA;AAAA,MAAA;AAGFA,YAAAA,IAAG,WAAW,QAAQ,IAAI,mBAAmB,sBAAsB,OAAO,IAAI,OAAO,CAAC;AAErF,aAAA,IAAI,WAAW,IAAI;AAAA,IAAA,CAC1B;AAAA,EAAA;AAAA,EAGM,UAAU,aAA2B,aAAsC;AAClF,YAAQ,aAAa;AAAA,MACpB,KAAK;AACG,eAAA;AAAA,MACR,KAAK;AACG,eAAA;AAAA,MACR,KAAK;AACJ,eAAO,gBAAgB;AAAA,MACxB,KAAK;AACJ,eAAO,gBAAgB;AAAA,IAAA;AAAA,EACzB;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonAccessManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PersonAccessManager.ts"],"sourcesContent":["import { PersonQuery } from '../queries'\nimport { DatabaseContext } from '../utils'\nimport { DisablePersonCommand } from '../commands/person/DisablePersonCommand'\nimport { ApiKeyManager } from './apiKey'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { DisablePersonErrorCode } from '../../schema'\n\nclass PersonAccessManager {\n\n\tconstructor(private readonly apiKeyManager: ApiKeyManager) {}\n\n\tasync disablePerson(dbContext: DatabaseContext, personId: string): Promise<PersonDisableAccessResponse> {\n\t\tconst result = await dbContext.transaction(async trx => {\n\t\t\tconst personRow = await trx.queryHandler.fetch(\n\t\t\t\tPersonQuery.byId(personId),\n\t\t\t)\n\n\t\t\tif (personRow === null) {\n\t\t\t\treturn 'PERSON_NOT_FOUND'\n\t\t\t}\n\n\t\t\tif (personRow.disabled_at !== null) {\n\t\t\t\treturn 'PERSON_ALREADY_DISABLED'\n\t\t\t}\n\n\t\t\t// Deactivate person & invalidate all api keys associated with person identity\n\t\t\tawait this.disablePersonAccount(trx, personRow.id)\n\t\t\tawait this.disableIdentityApiKeys(trx, personRow.identity_id)\n\n\t\t\treturn null\n\t\t})\n\n\t\tswitch (result) {\n\t\t\tcase null:\n\t\t\t\treturn new ResponseOk(null)\n\n\t\t\tcase 'PERSON_ALREADY_DISABLED':\n\t\t\t\treturn new ResponseError(result, 'Person is already disable')\n\n\t\t\tcase 'PERSON_NOT_FOUND':\n\t\t\t\treturn new ResponseError(result, 'Person not found')\n\t\t}\n\t}\n\n\tprivate async disablePersonAccount(dbContext: DatabaseContext, personId: string) {\n\t\tawait dbContext.commandBus.execute(new DisablePersonCommand(personId))\n\t}\n\n\tprivate async disableIdentityApiKeys(dbContext: DatabaseContext, personIdentityId: string) {\n\t\tawait this.apiKeyManager.disableIdentityApiKeys(dbContext, personIdentityId)\n\t}\n}\n\nexport type PersonDisableAccessResponse = Response<null, DisablePersonErrorCode>\n\nexport { PersonAccessManager }\n"],"names":["PersonQuery","ResponseOk","ResponseError","DisablePersonCommand"],"mappings":";;;;;;;;;;;;AAOA,MAAM,oBAAoB;AAAA,EAEzB,YAA6B,eAA8B;AAA9B,SAAA,gBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"PersonAccessManager.cjs","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PersonAccessManager.ts"],"sourcesContent":["import { PersonQuery } from '../queries'\nimport { DatabaseContext } from '../utils'\nimport { DisablePersonCommand } from '../commands/person/DisablePersonCommand'\nimport { ApiKeyManager } from './apiKey'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { DisablePersonErrorCode } from '../../schema'\n\nclass PersonAccessManager {\n\n\tconstructor(private readonly apiKeyManager: ApiKeyManager) {}\n\n\tasync disablePerson(dbContext: DatabaseContext, personId: string): Promise<PersonDisableAccessResponse> {\n\t\tconst result = await dbContext.transaction(async trx => {\n\t\t\tconst personRow = await trx.queryHandler.fetch(\n\t\t\t\tPersonQuery.byId(personId),\n\t\t\t)\n\n\t\t\tif (personRow === null) {\n\t\t\t\treturn 'PERSON_NOT_FOUND'\n\t\t\t}\n\n\t\t\tif (personRow.disabled_at !== null) {\n\t\t\t\treturn 'PERSON_ALREADY_DISABLED'\n\t\t\t}\n\n\t\t\t// Deactivate person & invalidate all api keys associated with person identity\n\t\t\tawait this.disablePersonAccount(trx, personRow.id)\n\t\t\tawait this.disableIdentityApiKeys(trx, personRow.identity_id)\n\n\t\t\treturn null\n\t\t})\n\n\t\tswitch (result) {\n\t\t\tcase null:\n\t\t\t\treturn new ResponseOk(null)\n\n\t\t\tcase 'PERSON_ALREADY_DISABLED':\n\t\t\t\treturn new ResponseError(result, 'Person is already disable')\n\n\t\t\tcase 'PERSON_NOT_FOUND':\n\t\t\t\treturn new ResponseError(result, 'Person not found')\n\t\t}\n\t}\n\n\tprivate async disablePersonAccount(dbContext: DatabaseContext, personId: string) {\n\t\tawait dbContext.commandBus.execute(new DisablePersonCommand(personId))\n\t}\n\n\tprivate async disableIdentityApiKeys(dbContext: DatabaseContext, personIdentityId: string) {\n\t\tawait this.apiKeyManager.disableIdentityApiKeys(dbContext, personIdentityId)\n\t}\n}\n\nexport type PersonDisableAccessResponse = Response<null, DisablePersonErrorCode>\n\nexport { PersonAccessManager }\n"],"names":["PersonQuery","ResponseOk","ResponseError","DisablePersonCommand"],"mappings":";;;;;;;;;;;;AAOA,MAAM,oBAAoB;AAAA,EAEzB,YAA6B,eAA8B;AAA9B,SAAA,gBAAA;AAAA,EAAA;AAAA,EAE7B,MAAM,cAAc,WAA4B,UAAwD;AACvG,UAAM,SAAS,MAAM,UAAU,YAAY,OAAM,QAAO;AACjD,YAAA,YAAY,MAAM,IAAI,aAAa;AAAA,QACxCA,YAAA,YAAY,KAAK,QAAQ;AAAA,MAC1B;AAEA,UAAI,cAAc,MAAM;AAChB,eAAA;AAAA,MAAA;AAGJ,UAAA,UAAU,gBAAgB,MAAM;AAC5B,eAAA;AAAA,MAAA;AAIR,YAAM,KAAK,qBAAqB,KAAK,UAAU,EAAE;AACjD,YAAM,KAAK,uBAAuB,KAAK,UAAU,WAAW;AAErD,aAAA;AAAA,IAAA,CACP;AAED,YAAQ,QAAQ;AAAA,MACf,KAAK;AACG,eAAA,IAAIC,oBAAW,IAAI;AAAA,MAE3B,KAAK;AACG,eAAA,IAAIC,SAAAA,cAAc,QAAQ,2BAA2B;AAAA,MAE7D,KAAK;AACG,eAAA,IAAIA,SAAAA,cAAc,QAAQ,kBAAkB;AAAA,IAAA;AAAA,EACrD;AAAA,EAGD,MAAc,qBAAqB,WAA4B,UAAkB;AAChF,UAAM,UAAU,WAAW,QAAQ,IAAIC,qBAAA,qBAAqB,QAAQ,CAAC;AAAA,EAAA;AAAA,EAGtE,MAAc,uBAAuB,WAA4B,kBAA0B;AAC1F,UAAM,KAAK,cAAc,uBAAuB,WAAW,gBAAgB;AAAA,EAAA;AAE7E;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonAccessManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PersonAccessManager.ts"],"sourcesContent":["import { PersonQuery } from '../queries'\nimport { DatabaseContext } from '../utils'\nimport { DisablePersonCommand } from '../commands/person/DisablePersonCommand'\nimport { ApiKeyManager } from './apiKey'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { DisablePersonErrorCode } from '../../schema'\n\nclass PersonAccessManager {\n\n\tconstructor(private readonly apiKeyManager: ApiKeyManager) {}\n\n\tasync disablePerson(dbContext: DatabaseContext, personId: string): Promise<PersonDisableAccessResponse> {\n\t\tconst result = await dbContext.transaction(async trx => {\n\t\t\tconst personRow = await trx.queryHandler.fetch(\n\t\t\t\tPersonQuery.byId(personId),\n\t\t\t)\n\n\t\t\tif (personRow === null) {\n\t\t\t\treturn 'PERSON_NOT_FOUND'\n\t\t\t}\n\n\t\t\tif (personRow.disabled_at !== null) {\n\t\t\t\treturn 'PERSON_ALREADY_DISABLED'\n\t\t\t}\n\n\t\t\t// Deactivate person & invalidate all api keys associated with person identity\n\t\t\tawait this.disablePersonAccount(trx, personRow.id)\n\t\t\tawait this.disableIdentityApiKeys(trx, personRow.identity_id)\n\n\t\t\treturn null\n\t\t})\n\n\t\tswitch (result) {\n\t\t\tcase null:\n\t\t\t\treturn new ResponseOk(null)\n\n\t\t\tcase 'PERSON_ALREADY_DISABLED':\n\t\t\t\treturn new ResponseError(result, 'Person is already disable')\n\n\t\t\tcase 'PERSON_NOT_FOUND':\n\t\t\t\treturn new ResponseError(result, 'Person not found')\n\t\t}\n\t}\n\n\tprivate async disablePersonAccount(dbContext: DatabaseContext, personId: string) {\n\t\tawait dbContext.commandBus.execute(new DisablePersonCommand(personId))\n\t}\n\n\tprivate async disableIdentityApiKeys(dbContext: DatabaseContext, personIdentityId: string) {\n\t\tawait this.apiKeyManager.disableIdentityApiKeys(dbContext, personIdentityId)\n\t}\n}\n\nexport type PersonDisableAccessResponse = Response<null, DisablePersonErrorCode>\n\nexport { PersonAccessManager }\n"],"names":[],"mappings":";;;;;;;;;;AAOA,MAAM,oBAAoB;AAAA,EAEzB,YAA6B,eAA8B;AAA9B,SAAA,gBAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"PersonAccessManager.js","sources":["../../../../../../packages/engine-tenant-api/src/model/service/PersonAccessManager.ts"],"sourcesContent":["import { PersonQuery } from '../queries'\nimport { DatabaseContext } from '../utils'\nimport { DisablePersonCommand } from '../commands/person/DisablePersonCommand'\nimport { ApiKeyManager } from './apiKey'\nimport { Response, ResponseError, ResponseOk } from '../utils/Response'\nimport { DisablePersonErrorCode } from '../../schema'\n\nclass PersonAccessManager {\n\n\tconstructor(private readonly apiKeyManager: ApiKeyManager) {}\n\n\tasync disablePerson(dbContext: DatabaseContext, personId: string): Promise<PersonDisableAccessResponse> {\n\t\tconst result = await dbContext.transaction(async trx => {\n\t\t\tconst personRow = await trx.queryHandler.fetch(\n\t\t\t\tPersonQuery.byId(personId),\n\t\t\t)\n\n\t\t\tif (personRow === null) {\n\t\t\t\treturn 'PERSON_NOT_FOUND'\n\t\t\t}\n\n\t\t\tif (personRow.disabled_at !== null) {\n\t\t\t\treturn 'PERSON_ALREADY_DISABLED'\n\t\t\t}\n\n\t\t\t// Deactivate person & invalidate all api keys associated with person identity\n\t\t\tawait this.disablePersonAccount(trx, personRow.id)\n\t\t\tawait this.disableIdentityApiKeys(trx, personRow.identity_id)\n\n\t\t\treturn null\n\t\t})\n\n\t\tswitch (result) {\n\t\t\tcase null:\n\t\t\t\treturn new ResponseOk(null)\n\n\t\t\tcase 'PERSON_ALREADY_DISABLED':\n\t\t\t\treturn new ResponseError(result, 'Person is already disable')\n\n\t\t\tcase 'PERSON_NOT_FOUND':\n\t\t\t\treturn new ResponseError(result, 'Person not found')\n\t\t}\n\t}\n\n\tprivate async disablePersonAccount(dbContext: DatabaseContext, personId: string) {\n\t\tawait dbContext.commandBus.execute(new DisablePersonCommand(personId))\n\t}\n\n\tprivate async disableIdentityApiKeys(dbContext: DatabaseContext, personIdentityId: string) {\n\t\tawait this.apiKeyManager.disableIdentityApiKeys(dbContext, personIdentityId)\n\t}\n}\n\nexport type PersonDisableAccessResponse = Response<null, DisablePersonErrorCode>\n\nexport { PersonAccessManager }\n"],"names":[],"mappings":";;;;;;;;;;AAOA,MAAM,oBAAoB;AAAA,EAEzB,YAA6B,eAA8B;AAA9B,SAAA,gBAAA;AAAA,EAAA;AAAA,EAE7B,MAAM,cAAc,WAA4B,UAAwD;AACvG,UAAM,SAAS,MAAM,UAAU,YAAY,OAAM,QAAO;AACjD,YAAA,YAAY,MAAM,IAAI,aAAa;AAAA,QACxC,YAAY,KAAK,QAAQ;AAAA,MAC1B;AAEA,UAAI,cAAc,MAAM;AAChB,eAAA;AAAA,MAAA;AAGJ,UAAA,UAAU,gBAAgB,MAAM;AAC5B,eAAA;AAAA,MAAA;AAIR,YAAM,KAAK,qBAAqB,KAAK,UAAU,EAAE;AACjD,YAAM,KAAK,uBAAuB,KAAK,UAAU,WAAW;AAErD,aAAA;AAAA,IAAA,CACP;AAED,YAAQ,QAAQ;AAAA,MACf,KAAK;AACG,eAAA,IAAI,WAAW,IAAI;AAAA,MAE3B,KAAK;AACG,eAAA,IAAI,cAAc,QAAQ,2BAA2B;AAAA,MAE7D,KAAK;AACG,eAAA,IAAI,cAAc,QAAQ,kBAAkB;AAAA,IAAA;AAAA,EACrD;AAAA,EAGD,MAAc,qBAAqB,WAA4B,UAAkB;AAChF,UAAM,UAAU,WAAW,QAAQ,IAAI,qBAAqB,QAAQ,CAAC;AAAA,EAAA;AAAA,EAGtE,MAAc,uBAAuB,WAA4B,kBAA0B;AAC1F,UAAM,KAAK,cAAc,uBAAuB,WAAW,gBAAgB;AAAA,EAAA;AAE7E;"}
|
|
@@ -10,6 +10,9 @@ require("@contember/authorization");
|
|
|
10
10
|
require("../authorization/PermissionContext.cjs");
|
|
11
11
|
require("../authorization/PermissionsFactory.cjs");
|
|
12
12
|
require("@contember/schema");
|
|
13
|
+
require("../type/ApiKey.cjs");
|
|
14
|
+
require("node:crypto");
|
|
15
|
+
const TogglePersonPasswordlessCommand = require("../commands/person/TogglePersonPasswordlessCommand.cjs");
|
|
13
16
|
class PersonManager {
|
|
14
17
|
constructor(emailValidator) {
|
|
15
18
|
this.emailValidator = emailValidator;
|
|
@@ -29,6 +32,10 @@ class PersonManager {
|
|
|
29
32
|
await dbContext.commandBus.execute(new ChangeProfileCommand.ChangeProfileCommand(person.id, data));
|
|
30
33
|
return new Response.ResponseOk(null);
|
|
31
34
|
}
|
|
35
|
+
async togglePasswordless(dbContext, person, value) {
|
|
36
|
+
await dbContext.commandBus.execute(new TogglePersonPasswordlessCommand.TogglePersonPasswordlessCommand(person.id, value));
|
|
37
|
+
return new Response.ResponseOk(null);
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
exports.PersonManager = PersonManager;
|
|
34
41
|
//# sourceMappingURL=PersonManager.cjs.map
|