@contember/engine-tenant-api 2.0.0-alpha.14 → 2.0.0-alpha.15
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/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/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/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/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/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/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/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/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/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/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/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/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/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/PasswordChangeManager.cjs +1 -1
- package/dist/development/src/model/service/PasswordChangeManager.js +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/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.js +2 -2
- package/dist/development/src/model/service/RolesManager.cjs +1 -1
- package/dist/development/src/model/service/RolesManager.js +1 -1
- package/dist/development/src/model/service/SignUpManager.cjs +1 -1
- package/dist/development/src/model/service/SignUpManager.js +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/providers/OIDCProvider.cjs +2 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.js +2 -1
- package/dist/development/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.cjs +2 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.cjs.map +1 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.js +2 -1
- package/dist/development/src/model/service/idp/providers/OIDCTypes.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/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/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/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/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/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/schema/tenant.graphql.cjs +161 -10
- package/dist/development/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/development/src/schema/tenant.graphql.js +161 -10
- package/dist/development/src/schema/tenant.graphql.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/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/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/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/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/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/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/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/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/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/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/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/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/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/PasswordChangeManager.cjs +1 -1
- package/dist/production/src/model/service/PasswordChangeManager.js +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/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.js +2 -2
- package/dist/production/src/model/service/RolesManager.cjs +1 -1
- package/dist/production/src/model/service/RolesManager.js +1 -1
- package/dist/production/src/model/service/SignUpManager.cjs +1 -1
- package/dist/production/src/model/service/SignUpManager.js +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/providers/OIDCProvider.cjs +2 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.js +2 -1
- package/dist/production/src/model/service/idp/providers/OIDCProvider.js.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.cjs +2 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.cjs.map +1 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.js +2 -1
- package/dist/production/src/model/service/idp/providers/OIDCTypes.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/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/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/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/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/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/schema/tenant.graphql.cjs +161 -10
- package/dist/production/src/schema/tenant.graphql.cjs.map +1 -1
- package/dist/production/src/schema/tenant.graphql.js +161 -10
- package/dist/production/src/schema/tenant.graphql.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/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/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/providers/AppleProvider.d.ts +2 -0
- package/dist/types/model/service/idp/providers/AppleProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/FacebookProvider.d.ts +2 -0
- package/dist/types/model/service/idp/providers/FacebookProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCProvider.d.ts +1 -0
- package/dist/types/model/service/idp/providers/OIDCProvider.d.ts.map +1 -1
- package/dist/types/model/service/idp/providers/OIDCTypes.d.ts +5 -1
- 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/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/schema/index.d.ts +258 -5
- 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/package.json +12 -12
- 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/InviteManager.ts +5 -6
- 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/providers/OIDCProvider.ts +1 -0
- package/src/model/service/idp/providers/OIDCTypes.ts +1 -0
- 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/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/schema/index.ts +326 -2
- package/src/schema/tenant.graphql.ts +161 -10
- package/tests/cases/integration/mocked/inviteMutations.test.ts +2 -2
- 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/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/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
|
@@ -20,6 +20,8 @@ const schema: DocumentNode = gql`
|
|
|
20
20
|
|
|
21
21
|
identityProviders: [IdentityProvider!]!
|
|
22
22
|
mailTemplates: [MailTemplateData!]!
|
|
23
|
+
|
|
24
|
+
configuration: Config!
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
type Mutation {
|
|
@@ -45,6 +47,14 @@ const schema: DocumentNode = gql`
|
|
|
45
47
|
redirectUrl: String @deprecated(reason: "use data.redirectUrl"),
|
|
46
48
|
sessionData: Json @deprecated(reason: "use data.sessionData"),
|
|
47
49
|
): SignInIDPResponse
|
|
50
|
+
|
|
51
|
+
# passwordless sign in
|
|
52
|
+
initSignInPasswordless(email: String!, options: InitSignInPasswordlessOptions): InitSignInPasswordlessResponse
|
|
53
|
+
signInPasswordless(requestId: String!, validationType: PasswordlessValidationType!, token: String!, expiration: Int, mfaOtp: String): SignInPasswordlessResponse
|
|
54
|
+
activatePasswordlessOtp(requestId: String!, token: String!, otpHash: String!): ActivatePasswordlessOtpResponse
|
|
55
|
+
|
|
56
|
+
enableMyPasswordless: ToggleMyPasswordlessResponse
|
|
57
|
+
disableMyPasswordless: ToggleMyPasswordlessResponse
|
|
48
58
|
|
|
49
59
|
# IDP management
|
|
50
60
|
addIDP(identityProvider: String!, type: String!, configuration: Json!, options: IDPOptions): AddIDPResponse
|
|
@@ -95,6 +105,8 @@ const schema: DocumentNode = gql`
|
|
|
95
105
|
): CreateProjectResponse
|
|
96
106
|
setProjectSecret(projectSlug: String!, key: String!, value: String!): SetProjectSecretResponse
|
|
97
107
|
updateProject(projectSlug: String!, name: String, config: Json, mergeConfig: Boolean): UpdateProjectResponse
|
|
108
|
+
|
|
109
|
+
configure(config: ConfigInput!): ConfigureResponse
|
|
98
110
|
|
|
99
111
|
addProjectMailTemplate(template: MailTemplate!): AddMailTemplateResponse
|
|
100
112
|
@deprecated(reason: "use addMailTemplate")
|
|
@@ -103,6 +115,49 @@ const schema: DocumentNode = gql`
|
|
|
103
115
|
@deprecated(reason: "use removeMailTemplate")
|
|
104
116
|
|
|
105
117
|
}
|
|
118
|
+
|
|
119
|
+
# === configure ===
|
|
120
|
+
|
|
121
|
+
type Config {
|
|
122
|
+
passwordless: ConfigPasswordless!
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
type ConfigPasswordless {
|
|
126
|
+
enabled: ConfigPolicy!
|
|
127
|
+
url: String
|
|
128
|
+
expirationMinutes: Int!
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
input ConfigInput {
|
|
132
|
+
passwordless: ConfigPasswordlessInput
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
enum ConfigPolicy {
|
|
136
|
+
always
|
|
137
|
+
never
|
|
138
|
+
optIn
|
|
139
|
+
optOut
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
input ConfigPasswordlessInput {
|
|
143
|
+
enabled: ConfigPolicy
|
|
144
|
+
url: String
|
|
145
|
+
expirationMinutes: Int
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
type ConfigureResponse {
|
|
149
|
+
ok: Boolean!
|
|
150
|
+
error: ConfigureError
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type ConfigureError {
|
|
154
|
+
code: ConfigureErrorCode!
|
|
155
|
+
developerMessage: String!
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
enum ConfigureErrorCode {
|
|
159
|
+
INVALID_CONFIG
|
|
160
|
+
}
|
|
106
161
|
|
|
107
162
|
# === signUp ===
|
|
108
163
|
type SignUpResponse {
|
|
@@ -418,6 +473,98 @@ const schema: DocumentNode = gql`
|
|
|
418
473
|
initReturnsConfig: Boolean
|
|
419
474
|
}
|
|
420
475
|
|
|
476
|
+
# === passwordless sign in ===
|
|
477
|
+
|
|
478
|
+
type InitSignInPasswordlessResponse {
|
|
479
|
+
ok: Boolean!
|
|
480
|
+
error: InitSignInPasswordlessError
|
|
481
|
+
result: InitSignInPasswordlessResult
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
type InitSignInPasswordlessError {
|
|
485
|
+
code: InitSignInPasswordlessErrorCode!
|
|
486
|
+
developerMessage: String!
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
enum InitSignInPasswordlessErrorCode {
|
|
490
|
+
PERSON_NOT_FOUND
|
|
491
|
+
|
|
492
|
+
PASSWORDLESS_DISABLED
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
type InitSignInPasswordlessResult {
|
|
496
|
+
requestId: String!
|
|
497
|
+
expiresAt: DateTime!
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
input InitSignInPasswordlessOptions {
|
|
501
|
+
mailVariant: String
|
|
502
|
+
mailProject: String
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
type SignInPasswordlessResponse {
|
|
506
|
+
ok: Boolean!
|
|
507
|
+
error: SignInPasswordlessError
|
|
508
|
+
result: SignInPasswordlessResult
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
enum PasswordlessValidationType {
|
|
512
|
+
otp
|
|
513
|
+
token
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
type SignInPasswordlessError {
|
|
517
|
+
code: SignInPasswordlessErrorCode!
|
|
518
|
+
developerMessage: String!
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
enum SignInPasswordlessErrorCode {
|
|
522
|
+
TOKEN_NOT_FOUND
|
|
523
|
+
TOKEN_INVALID
|
|
524
|
+
TOKEN_EXPIRED
|
|
525
|
+
TOKEN_USED
|
|
526
|
+
PERSON_DISABLED
|
|
527
|
+
OTP_REQUIRED
|
|
528
|
+
INVALID_OTP_TOKEN
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
type SignInPasswordlessResult implements CommonSignInResult {
|
|
532
|
+
token: String!
|
|
533
|
+
person: Person!
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
type ActivatePasswordlessOtpResponse {
|
|
537
|
+
ok: Boolean!
|
|
538
|
+
error: ActivatePasswordlessOtpError
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
type ActivatePasswordlessOtpError {
|
|
542
|
+
code: ActivatePasswordlessOtpErrorCode!
|
|
543
|
+
developerMessage: String!
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
enum ActivatePasswordlessOtpErrorCode {
|
|
547
|
+
TOKEN_NOT_FOUND
|
|
548
|
+
TOKEN_INVALID
|
|
549
|
+
TOKEN_EXPIRED
|
|
550
|
+
TOKEN_USED
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
type ToggleMyPasswordlessResponse {
|
|
554
|
+
ok: Boolean!
|
|
555
|
+
error: ToggleMyPasswordlessError
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
type ToggleMyPasswordlessError {
|
|
559
|
+
code: ToggleMyPasswordlessErrorCode!
|
|
560
|
+
developerMessage: String!
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
enum ToggleMyPasswordlessErrorCode {
|
|
564
|
+
CANNOT_TOGGLE
|
|
565
|
+
NOT_A_PERSON
|
|
566
|
+
}
|
|
567
|
+
|
|
421
568
|
|
|
422
569
|
# === invite ===
|
|
423
570
|
|
|
@@ -671,6 +818,7 @@ const schema: DocumentNode = gql`
|
|
|
671
818
|
email: String
|
|
672
819
|
name: String
|
|
673
820
|
otpEnabled: Boolean!
|
|
821
|
+
passwordlessEnabled: Boolean
|
|
674
822
|
identity: Identity!
|
|
675
823
|
}
|
|
676
824
|
|
|
@@ -831,15 +979,15 @@ const schema: DocumentNode = gql`
|
|
|
831
979
|
|
|
832
980
|
# === mails ===
|
|
833
981
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
982
|
+
type MailTemplateData {
|
|
983
|
+
projectSlug: String
|
|
984
|
+
type: MailType!
|
|
985
|
+
variant: String
|
|
986
|
+
subject: String!
|
|
987
|
+
content: String!
|
|
988
|
+
useLayout: Boolean!
|
|
989
|
+
replyTo: String
|
|
990
|
+
}
|
|
843
991
|
|
|
844
992
|
input MailTemplate {
|
|
845
993
|
projectSlug: String
|
|
@@ -856,6 +1004,7 @@ const schema: DocumentNode = gql`
|
|
|
856
1004
|
EXISTING_USER_INVITED
|
|
857
1005
|
NEW_USER_INVITED
|
|
858
1006
|
RESET_PASSWORD_REQUEST
|
|
1007
|
+
PASSWORDLESS_SIGN_IN
|
|
859
1008
|
}
|
|
860
1009
|
|
|
861
1010
|
input MailTemplateIdentifier {
|
|
@@ -879,7 +1028,7 @@ const schema: DocumentNode = gql`
|
|
|
879
1028
|
enum AddMailTemplateErrorCode {
|
|
880
1029
|
MISSING_VARIABLE
|
|
881
1030
|
PROJECT_NOT_FOUND
|
|
882
|
-
|
|
1031
|
+
INVALID_REPLY_EMAIL_FORMAT
|
|
883
1032
|
}
|
|
884
1033
|
|
|
885
1034
|
type RemoveMailTemplateResponse {
|
|
@@ -908,6 +1057,7 @@ const schema: DocumentNode = gql`
|
|
|
908
1057
|
enum CheckResetPasswordTokenCode {
|
|
909
1058
|
REQUEST_NOT_FOUND
|
|
910
1059
|
TOKEN_NOT_FOUND
|
|
1060
|
+
TOKEN_INVALID
|
|
911
1061
|
TOKEN_USED
|
|
912
1062
|
TOKEN_EXPIRED
|
|
913
1063
|
}
|
|
@@ -941,6 +1091,7 @@ const schema: DocumentNode = gql`
|
|
|
941
1091
|
|
|
942
1092
|
enum ResetPasswordErrorCode {
|
|
943
1093
|
TOKEN_NOT_FOUND
|
|
1094
|
+
TOKEN_INVALID
|
|
944
1095
|
TOKEN_USED
|
|
945
1096
|
TOKEN_EXPIRED
|
|
946
1097
|
|
|
@@ -11,7 +11,7 @@ import { createMembershipSql } from './sql/createMembershipSql'
|
|
|
11
11
|
import { createPersonSql } from './sql/createPersonSql'
|
|
12
12
|
import { disableOneOffKeySql } from './sql/disableOneOffKeySql'
|
|
13
13
|
import { test } from 'vitest'
|
|
14
|
-
import {
|
|
14
|
+
import { createPersonTokenSql } from './sql/createPersonTokenSql'
|
|
15
15
|
import { getMailTemplateSql } from './sql/getMailTemplateSql'
|
|
16
16
|
|
|
17
17
|
test('invite a new person', async () => {
|
|
@@ -125,7 +125,7 @@ test('invite a new person with password reset', async () => {
|
|
|
125
125
|
getPersonByEmailSql({ email, response: null }),
|
|
126
126
|
createIdentitySql({ roles: ['person'], identityId }),
|
|
127
127
|
createPersonSql({ identityId, personId, email }),
|
|
128
|
-
|
|
128
|
+
createPersonTokenSql({ personId, tokenHash: '9692e67b8378a6f6753f97782d458aa757e947eab2fbdf6b5c187b74561eb78f', resetId: passwordTokenId, type: 'password_reset' }),
|
|
129
129
|
createMembershipSql({ membershipId, projectId, identityId, role: 'editor' }),
|
|
130
130
|
patchVariablesSql({
|
|
131
131
|
id: variableId,
|
package/tests/cases/integration/mocked/sql/{createPasswordResetSql.ts → createPersonTokenSql.ts}
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { SQL } from '../../../../src/tags'
|
|
2
2
|
import { ExpectedQuery } from '@contember/database-tester'
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const createPersonTokenSql = (args: {
|
|
5
5
|
resetId: string
|
|
6
6
|
tokenHash: string
|
|
7
7
|
personId: string
|
|
8
|
+
type: string
|
|
8
9
|
}): ExpectedQuery => ({
|
|
9
|
-
sql: SQL`INSERT INTO "tenant"."
|
|
10
|
-
VALUES (?, ?, ?, ?, ?, ?)`,
|
|
10
|
+
sql: SQL`INSERT INTO "tenant"."person_token" ("id", "token_hash", "person_id", "expires_at", "created_at", "used_at", "type")
|
|
11
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
11
12
|
parameters: [
|
|
12
13
|
args.resetId,
|
|
13
14
|
args.tokenHash,
|
|
@@ -15,6 +16,7 @@ export const createPasswordResetSql = (args: {
|
|
|
15
16
|
(val: any) => val instanceof Date,
|
|
16
17
|
(val: any) => val instanceof Date,
|
|
17
18
|
null,
|
|
19
|
+
args.type,
|
|
18
20
|
],
|
|
19
21
|
response: { rowCount: 1 },
|
|
20
22
|
})
|
|
@@ -5,7 +5,7 @@ export const getPersonByEmailSql = (args: {
|
|
|
5
5
|
email: string
|
|
6
6
|
response: null | { personId: string; password: string; identityId: string; roles: string[]; otpUri?: string }
|
|
7
7
|
}): ExpectedQuery => ({
|
|
8
|
-
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "identity"."roles"
|
|
8
|
+
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "person"."passwordless_enabled", "identity"."roles"
|
|
9
9
|
FROM "tenant"."person"
|
|
10
10
|
INNER JOIN "tenant"."identity" AS "identity" ON "identity"."id" = "person"."identity_id"
|
|
11
11
|
WHERE "person"."email" = ?`,
|
|
@@ -22,6 +22,7 @@ export const getPersonByEmailSql = (args: {
|
|
|
22
22
|
otp_uri: args.response.otpUri,
|
|
23
23
|
otp_activated_at: args.response.otpUri ? new Date() : null,
|
|
24
24
|
disabled_at: null,
|
|
25
|
+
passwordless_enabled: null,
|
|
25
26
|
},
|
|
26
27
|
]
|
|
27
28
|
: [],
|
|
@@ -5,7 +5,7 @@ export const getPersonByIdSql = (args: {
|
|
|
5
5
|
personId: string
|
|
6
6
|
response: { personId: string; password: string; identityId: string; roles: string[]; email: string; name?: string }
|
|
7
7
|
}): ExpectedQuery => ({
|
|
8
|
-
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "identity"."roles"
|
|
8
|
+
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "person"."passwordless_enabled", "identity"."roles"
|
|
9
9
|
FROM "tenant"."person"
|
|
10
10
|
INNER JOIN "tenant"."identity" AS "identity" ON "identity"."id" = "person"."identity_id"
|
|
11
11
|
WHERE "person"."id" = ?`,
|
|
@@ -5,7 +5,7 @@ export const getPersonByIdentity = (args: {
|
|
|
5
5
|
identityId: string
|
|
6
6
|
response: null | { personId: string; password: string; roles: string[]; email: string; name?: string; otpUri?: string }
|
|
7
7
|
}): ExpectedQuery => ({
|
|
8
|
-
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "identity"."roles"
|
|
8
|
+
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "person"."passwordless_enabled", "identity"."roles"
|
|
9
9
|
FROM "tenant"."person"
|
|
10
10
|
INNER JOIN "tenant"."identity" AS "identity" ON "identity"."id" = "person"."identity_id"
|
|
11
11
|
WHERE "person"."identity_id" = ?`,
|
|
@@ -6,7 +6,7 @@ export const getPersonByIdpSql = (args: {
|
|
|
6
6
|
externalIdentifier: string
|
|
7
7
|
response: null | { personId: string; password?: string; identityId: string; email: string; roles: string[]; otpUri?: string }
|
|
8
8
|
}): ExpectedQuery => ({
|
|
9
|
-
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "identity"."roles"
|
|
9
|
+
sql: SQL`SELECT "person"."id", "person"."password_hash", "person"."otp_uri", "person"."otp_activated_at", "person"."identity_id", "person"."email", "person"."name", "person"."disabled_at", "person"."passwordless_enabled", "identity"."roles"
|
|
10
10
|
FROM "tenant"."person"
|
|
11
11
|
INNER JOIN "tenant"."identity" AS "identity" ON "identity"."id" = "person"."identity_id"
|
|
12
12
|
INNER JOIN "tenant"."person_identity_provider" as "idp" on "idp"."person_id" = "person"."id"
|
package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("@contember/database");
|
|
4
|
-
require("../../type/ApiKey.cjs");
|
|
5
|
-
const SavePasswordResetRequestCommand = require("./SavePasswordResetRequestCommand.cjs");
|
|
6
|
-
const tokenUtils = require("../../utils/tokenUtils.cjs");
|
|
7
|
-
class CreatePasswordResetRequestCommand {
|
|
8
|
-
constructor(personId, expirationMinutes) {
|
|
9
|
-
this.personId = personId;
|
|
10
|
-
this.expirationMinutes = expirationMinutes;
|
|
11
|
-
}
|
|
12
|
-
async execute({ db, providers, bus }) {
|
|
13
|
-
const token = await tokenUtils.generateToken(providers);
|
|
14
|
-
const tokenHash = tokenUtils.computeTokenHash(token);
|
|
15
|
-
await bus.execute(new SavePasswordResetRequestCommand.SavePasswordResetRequestCommand(
|
|
16
|
-
this.personId,
|
|
17
|
-
tokenHash,
|
|
18
|
-
this.expirationMinutes
|
|
19
|
-
));
|
|
20
|
-
return new CreatePasswordResetRequestResult(token);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
class CreatePasswordResetRequestResult {
|
|
24
|
-
constructor(token) {
|
|
25
|
-
this.token = token;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.CreatePasswordResetRequestCommand = CreatePasswordResetRequestCommand;
|
|
29
|
-
exports.CreatePasswordResetRequestResult = CreatePasswordResetRequestResult;
|
|
30
|
-
//# sourceMappingURL=CreatePasswordResetRequestCommand.cjs.map
|
package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreatePasswordResetRequestCommand.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { computeTokenHash, generateToken } from '../../utils'\nimport { SavePasswordResetRequestCommand } from './SavePasswordResetRequestCommand'\n\nexport class CreatePasswordResetRequestCommand implements Command<CreatePasswordResetRequestResult> {\n\tconstructor(\n\t\tprivate readonly personId: string,\n\t\tprivate readonly expirationMinutes?: number,\n\t) {}\n\n\tasync execute({ db, providers, bus }: Command.Args): Promise<CreatePasswordResetRequestResult> {\n\t\tconst token = await generateToken(providers)\n\t\tconst tokenHash = computeTokenHash(token)\n\t\tawait bus.execute(new SavePasswordResetRequestCommand(\n\t\t\tthis.personId,\n\t\t\ttokenHash,\n\t\t\tthis.expirationMinutes,\n\t\t))\n\n\t\treturn new CreatePasswordResetRequestResult(token)\n\t}\n}\nexport class CreatePasswordResetRequestResult {\n\tconstructor(public readonly token: string) {}\n}\n"],"names":["generateToken","computeTokenHash","SavePasswordResetRequestCommand"],"mappings":";;;;;;AAIO,MAAM,kCAAuF;AAAA,EACnG,YACkB,UACA,mBAChB;AAFgB,SAAA,WAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEH,MAAM,QAAQ,EAAE,IAAI,WAAW,OAAgE;AACxF,UAAA,QAAQ,MAAMA,yBAAc,SAAS;AACrC,UAAA,YAAYC,4BAAiB,KAAK;AAClC,UAAA,IAAI,QAAQ,IAAIC,gCAAA;AAAA,MACrB,KAAK;AAAA,MACL;AAAA,MACA,KAAK;AAAA,IAAA,CACL;AAEM,WAAA,IAAI,iCAAiC,KAAK;AAAA,EAClD;AACD;AACO,MAAM,iCAAiC;AAAA,EAC7C,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAC7C;;;"}
|
package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "@contember/database";
|
|
2
|
-
import "../../type/ApiKey.js";
|
|
3
|
-
import { SavePasswordResetRequestCommand } from "./SavePasswordResetRequestCommand.js";
|
|
4
|
-
import { generateToken, computeTokenHash } from "../../utils/tokenUtils.js";
|
|
5
|
-
class CreatePasswordResetRequestCommand {
|
|
6
|
-
constructor(personId, expirationMinutes) {
|
|
7
|
-
this.personId = personId;
|
|
8
|
-
this.expirationMinutes = expirationMinutes;
|
|
9
|
-
}
|
|
10
|
-
async execute({ db, providers, bus }) {
|
|
11
|
-
const token = await generateToken(providers);
|
|
12
|
-
const tokenHash = computeTokenHash(token);
|
|
13
|
-
await bus.execute(new SavePasswordResetRequestCommand(
|
|
14
|
-
this.personId,
|
|
15
|
-
tokenHash,
|
|
16
|
-
this.expirationMinutes
|
|
17
|
-
));
|
|
18
|
-
return new CreatePasswordResetRequestResult(token);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
class CreatePasswordResetRequestResult {
|
|
22
|
-
constructor(token) {
|
|
23
|
-
this.token = token;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
CreatePasswordResetRequestCommand,
|
|
28
|
-
CreatePasswordResetRequestResult
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=CreatePasswordResetRequestCommand.js.map
|
package/dist/development/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreatePasswordResetRequestCommand.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { computeTokenHash, generateToken } from '../../utils'\nimport { SavePasswordResetRequestCommand } from './SavePasswordResetRequestCommand'\n\nexport class CreatePasswordResetRequestCommand implements Command<CreatePasswordResetRequestResult> {\n\tconstructor(\n\t\tprivate readonly personId: string,\n\t\tprivate readonly expirationMinutes?: number,\n\t) {}\n\n\tasync execute({ db, providers, bus }: Command.Args): Promise<CreatePasswordResetRequestResult> {\n\t\tconst token = await generateToken(providers)\n\t\tconst tokenHash = computeTokenHash(token)\n\t\tawait bus.execute(new SavePasswordResetRequestCommand(\n\t\t\tthis.personId,\n\t\t\ttokenHash,\n\t\t\tthis.expirationMinutes,\n\t\t))\n\n\t\treturn new CreatePasswordResetRequestResult(token)\n\t}\n}\nexport class CreatePasswordResetRequestResult {\n\tconstructor(public readonly token: string) {}\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,kCAAuF;AAAA,EACnG,YACkB,UACA,mBAChB;AAFgB,SAAA,WAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEH,MAAM,QAAQ,EAAE,IAAI,WAAW,OAAgE;AACxF,UAAA,QAAQ,MAAM,cAAc,SAAS;AACrC,UAAA,YAAY,iBAAiB,KAAK;AAClC,UAAA,IAAI,QAAQ,IAAI;AAAA,MACrB,KAAK;AAAA,MACL;AAAA,MACA,KAAK;AAAA,IAAA,CACL;AAEM,WAAA,IAAI,iCAAiC,KAAK;AAAA,EAClD;AACD;AACO,MAAM,iCAAiC;AAAA,EAC7C,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAC7C;"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Database = require("@contember/database");
|
|
4
|
-
require("../../type/ApiKey.cjs");
|
|
5
|
-
const ChangePasswordCommand = require("../person/ChangePasswordCommand.cjs");
|
|
6
|
-
const exceptions = require("../../../exceptions.cjs");
|
|
7
|
-
const Response = require("../../utils/Response.cjs");
|
|
8
|
-
const tokenUtils = require("../../utils/tokenUtils.cjs");
|
|
9
|
-
class ResetPasswordCommand {
|
|
10
|
-
constructor(token, password) {
|
|
11
|
-
this.token = token;
|
|
12
|
-
this.password = password;
|
|
13
|
-
}
|
|
14
|
-
async execute({ db, providers, bus }) {
|
|
15
|
-
const tokenHash = tokenUtils.computeTokenHash(this.token);
|
|
16
|
-
const result = (await Database.SelectBuilder.create().from("person_password_reset").select("id").select("person_id").select("used_at").select("expires_at").where({ token_hash: tokenHash }).getResult(db))[0] || null;
|
|
17
|
-
if (!result) {
|
|
18
|
-
return new Response.ResponseError("TOKEN_NOT_FOUND", "Token was not found");
|
|
19
|
-
}
|
|
20
|
-
if (result.used_at) {
|
|
21
|
-
return new Response.ResponseError("TOKEN_USED", `Token was used at ${result.used_at.toISOString()}`);
|
|
22
|
-
}
|
|
23
|
-
const now = providers.now();
|
|
24
|
-
if (result.expires_at < now) {
|
|
25
|
-
return new Response.ResponseError("TOKEN_EXPIRED", `Token expired at ${result.expires_at.toISOString()}`);
|
|
26
|
-
}
|
|
27
|
-
const count = await Database.UpdateBuilder.create().table("person_password_reset").where({ id: result.id }).where((expr) => expr.isNull("used_at")).values({
|
|
28
|
-
used_at: now
|
|
29
|
-
}).execute(db);
|
|
30
|
-
if (count === 0) {
|
|
31
|
-
throw new exceptions.ImplementationException();
|
|
32
|
-
}
|
|
33
|
-
await bus.execute(new ChangePasswordCommand.ChangePasswordCommand(result.person_id, this.password));
|
|
34
|
-
return new Response.ResponseOk(null);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.ResetPasswordCommand = ResetPasswordCommand;
|
|
38
|
-
//# sourceMappingURL=ResetPasswordCommand.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordCommand.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/ResetPasswordCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { SelectBuilder, UpdateBuilder } from '@contember/database'\nimport { computeTokenHash } from '../../utils'\nimport { ImplementationException } from '../../../exceptions'\nimport { ChangePasswordCommand } from '../person/ChangePasswordCommand'\nimport { Response, ResponseError, ResponseOk } from '../../utils/Response'\n\nexport class ResetPasswordCommand implements Command<ResetPasswordCommandResponse> {\n\tconstructor(private readonly token: string, private readonly password: string) {}\n\n\tasync execute({ db, providers, bus }: Command.Args): Promise<ResetPasswordCommandResponse> {\n\t\tconst tokenHash = computeTokenHash(this.token)\n\n\t\tconst result =\n\t\t\t(\n\t\t\t\tawait SelectBuilder.create<{ used_at: null | Date; expires_at: Date; id: string; person_id: string }>()\n\t\t\t\t\t.from('person_password_reset')\n\t\t\t\t\t.select('id')\n\t\t\t\t\t.select('person_id')\n\t\t\t\t\t.select('used_at')\n\t\t\t\t\t.select('expires_at')\n\t\t\t\t\t.where({ token_hash: tokenHash })\n\t\t\t\t\t.getResult(db)\n\t\t\t)[0] || null\n\t\tif (!result) {\n\t\t\treturn new ResponseError('TOKEN_NOT_FOUND', 'Token was not found')\n\t\t}\n\t\tif (result.used_at) {\n\t\t\treturn new ResponseError('TOKEN_USED', `Token was used at ${result.used_at.toISOString()}`)\n\t\t}\n\t\tconst now = providers.now()\n\t\tif (result.expires_at < now) {\n\t\t\treturn new ResponseError('TOKEN_EXPIRED', `Token expired at ${result.expires_at.toISOString()}`)\n\t\t}\n\t\tconst count = await UpdateBuilder.create()\n\t\t\t.table('person_password_reset')\n\t\t\t.where({ id: result.id })\n\t\t\t.where(expr => expr.isNull('used_at'))\n\t\t\t.values({\n\t\t\t\tused_at: now,\n\t\t\t})\n\t\t\t.execute(db)\n\t\tif (count === 0) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\n\t\tawait bus.execute(new ChangePasswordCommand(result.person_id, this.password))\n\n\t\treturn new ResponseOk(null)\n\t}\n}\nexport type ResetPasswordCommandErrorCode =\n\t| 'TOKEN_NOT_FOUND'\n\t| 'TOKEN_USED'\n\t| 'TOKEN_EXPIRED'\n\nexport type ResetPasswordCommandResponse = Response<null, ResetPasswordCommandErrorCode>\n"],"names":["computeTokenHash","SelectBuilder","ResponseError","UpdateBuilder","ImplementationException","ChangePasswordCommand","ResponseOk"],"mappings":";;;;;;;;AAOO,MAAM,qBAAsE;AAAA,EAClF,YAA6B,OAAgC,UAAkB;AAAlD,SAAA,QAAA;AAAgC,SAAA,WAAA;AAAA,EAAmB;AAAA,EAEhF,MAAM,QAAQ,EAAE,IAAI,WAAW,OAA4D;AACpF,UAAA,YAAYA,WAAAA,iBAAiB,KAAK,KAAK;AAE7C,UAAM,UAEJ,MAAMC,uBAAc,OAClB,EAAA,KAAK,uBAAuB,EAC5B,OAAO,IAAI,EACX,OAAO,WAAW,EAClB,OAAO,SAAS,EAChB,OAAO,YAAY,EACnB,MAAM,EAAE,YAAY,UAAW,CAAA,EAC/B,UAAU,EAAE,GACb,CAAC,KAAK;AACT,QAAI,CAAC,QAAQ;AACL,aAAA,IAAIC,SAAc,cAAA,mBAAmB,qBAAqB;AAAA,IAClE;AACA,QAAI,OAAO,SAAS;AACZ,aAAA,IAAIA,SAAAA,cAAc,cAAc,qBAAqB,OAAO,QAAQ,aAAa,EAAE;AAAA,IAC3F;AACM,UAAA,MAAM,UAAU;AAClB,QAAA,OAAO,aAAa,KAAK;AACrB,aAAA,IAAIA,SAAAA,cAAc,iBAAiB,oBAAoB,OAAO,WAAW,aAAa,EAAE;AAAA,IAChG;AACM,UAAA,QAAQ,MAAMC,SAAAA,cAAc,OAAA,EAChC,MAAM,uBAAuB,EAC7B,MAAM,EAAE,IAAI,OAAO,GAAI,CAAA,EACvB,MAAM,CAAA,SAAQ,KAAK,OAAO,SAAS,CAAC,EACpC,OAAO;AAAA,MACP,SAAS;AAAA,IAAA,CACT,EACA,QAAQ,EAAE;AACZ,QAAI,UAAU,GAAG;AAChB,YAAM,IAAIC,WAAwB,wBAAA;AAAA,IACnC;AAEM,UAAA,IAAI,QAAQ,IAAIC,sBAAA,sBAAsB,OAAO,WAAW,KAAK,QAAQ,CAAC;AAErE,WAAA,IAAIC,SAAAA,WAAW,IAAI;AAAA,EAC3B;AACD;;"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SelectBuilder, UpdateBuilder as UpdateBuilder$1 } from "@contember/database";
|
|
2
|
-
import "../../type/ApiKey.js";
|
|
3
|
-
import { ChangePasswordCommand } from "../person/ChangePasswordCommand.js";
|
|
4
|
-
import { ImplementationException } from "../../../exceptions.js";
|
|
5
|
-
import { ResponseError, ResponseOk } from "../../utils/Response.js";
|
|
6
|
-
import { computeTokenHash } from "../../utils/tokenUtils.js";
|
|
7
|
-
class ResetPasswordCommand {
|
|
8
|
-
constructor(token, password) {
|
|
9
|
-
this.token = token;
|
|
10
|
-
this.password = password;
|
|
11
|
-
}
|
|
12
|
-
async execute({ db, providers, bus }) {
|
|
13
|
-
const tokenHash = computeTokenHash(this.token);
|
|
14
|
-
const result = (await SelectBuilder.create().from("person_password_reset").select("id").select("person_id").select("used_at").select("expires_at").where({ token_hash: tokenHash }).getResult(db))[0] || null;
|
|
15
|
-
if (!result) {
|
|
16
|
-
return new ResponseError("TOKEN_NOT_FOUND", "Token was not found");
|
|
17
|
-
}
|
|
18
|
-
if (result.used_at) {
|
|
19
|
-
return new ResponseError("TOKEN_USED", `Token was used at ${result.used_at.toISOString()}`);
|
|
20
|
-
}
|
|
21
|
-
const now = providers.now();
|
|
22
|
-
if (result.expires_at < now) {
|
|
23
|
-
return new ResponseError("TOKEN_EXPIRED", `Token expired at ${result.expires_at.toISOString()}`);
|
|
24
|
-
}
|
|
25
|
-
const count = await UpdateBuilder$1.create().table("person_password_reset").where({ id: result.id }).where((expr) => expr.isNull("used_at")).values({
|
|
26
|
-
used_at: now
|
|
27
|
-
}).execute(db);
|
|
28
|
-
if (count === 0) {
|
|
29
|
-
throw new ImplementationException();
|
|
30
|
-
}
|
|
31
|
-
await bus.execute(new ChangePasswordCommand(result.person_id, this.password));
|
|
32
|
-
return new ResponseOk(null);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
ResetPasswordCommand
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=ResetPasswordCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordCommand.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/ResetPasswordCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { SelectBuilder, UpdateBuilder } from '@contember/database'\nimport { computeTokenHash } from '../../utils'\nimport { ImplementationException } from '../../../exceptions'\nimport { ChangePasswordCommand } from '../person/ChangePasswordCommand'\nimport { Response, ResponseError, ResponseOk } from '../../utils/Response'\n\nexport class ResetPasswordCommand implements Command<ResetPasswordCommandResponse> {\n\tconstructor(private readonly token: string, private readonly password: string) {}\n\n\tasync execute({ db, providers, bus }: Command.Args): Promise<ResetPasswordCommandResponse> {\n\t\tconst tokenHash = computeTokenHash(this.token)\n\n\t\tconst result =\n\t\t\t(\n\t\t\t\tawait SelectBuilder.create<{ used_at: null | Date; expires_at: Date; id: string; person_id: string }>()\n\t\t\t\t\t.from('person_password_reset')\n\t\t\t\t\t.select('id')\n\t\t\t\t\t.select('person_id')\n\t\t\t\t\t.select('used_at')\n\t\t\t\t\t.select('expires_at')\n\t\t\t\t\t.where({ token_hash: tokenHash })\n\t\t\t\t\t.getResult(db)\n\t\t\t)[0] || null\n\t\tif (!result) {\n\t\t\treturn new ResponseError('TOKEN_NOT_FOUND', 'Token was not found')\n\t\t}\n\t\tif (result.used_at) {\n\t\t\treturn new ResponseError('TOKEN_USED', `Token was used at ${result.used_at.toISOString()}`)\n\t\t}\n\t\tconst now = providers.now()\n\t\tif (result.expires_at < now) {\n\t\t\treturn new ResponseError('TOKEN_EXPIRED', `Token expired at ${result.expires_at.toISOString()}`)\n\t\t}\n\t\tconst count = await UpdateBuilder.create()\n\t\t\t.table('person_password_reset')\n\t\t\t.where({ id: result.id })\n\t\t\t.where(expr => expr.isNull('used_at'))\n\t\t\t.values({\n\t\t\t\tused_at: now,\n\t\t\t})\n\t\t\t.execute(db)\n\t\tif (count === 0) {\n\t\t\tthrow new ImplementationException()\n\t\t}\n\n\t\tawait bus.execute(new ChangePasswordCommand(result.person_id, this.password))\n\n\t\treturn new ResponseOk(null)\n\t}\n}\nexport type ResetPasswordCommandErrorCode =\n\t| 'TOKEN_NOT_FOUND'\n\t| 'TOKEN_USED'\n\t| 'TOKEN_EXPIRED'\n\nexport type ResetPasswordCommandResponse = Response<null, ResetPasswordCommandErrorCode>\n"],"names":["UpdateBuilder"],"mappings":";;;;;;AAOO,MAAM,qBAAsE;AAAA,EAClF,YAA6B,OAAgC,UAAkB;AAAlD,SAAA,QAAA;AAAgC,SAAA,WAAA;AAAA,EAAmB;AAAA,EAEhF,MAAM,QAAQ,EAAE,IAAI,WAAW,OAA4D;AACpF,UAAA,YAAY,iBAAiB,KAAK,KAAK;AAE7C,UAAM,UAEJ,MAAM,cAAc,OAClB,EAAA,KAAK,uBAAuB,EAC5B,OAAO,IAAI,EACX,OAAO,WAAW,EAClB,OAAO,SAAS,EAChB,OAAO,YAAY,EACnB,MAAM,EAAE,YAAY,UAAW,CAAA,EAC/B,UAAU,EAAE,GACb,CAAC,KAAK;AACT,QAAI,CAAC,QAAQ;AACL,aAAA,IAAI,cAAc,mBAAmB,qBAAqB;AAAA,IAClE;AACA,QAAI,OAAO,SAAS;AACZ,aAAA,IAAI,cAAc,cAAc,qBAAqB,OAAO,QAAQ,aAAa,EAAE;AAAA,IAC3F;AACM,UAAA,MAAM,UAAU;AAClB,QAAA,OAAO,aAAa,KAAK;AACrB,aAAA,IAAI,cAAc,iBAAiB,oBAAoB,OAAO,WAAW,aAAa,EAAE;AAAA,IAChG;AACM,UAAA,QAAQ,MAAMA,gBAAc,OAAA,EAChC,MAAM,uBAAuB,EAC7B,MAAM,EAAE,IAAI,OAAO,GAAI,CAAA,EACvB,MAAM,CAAA,SAAQ,KAAK,OAAO,SAAS,CAAC,EACpC,OAAO;AAAA,MACP,SAAS;AAAA,IAAA,CACT,EACA,QAAQ,EAAE;AACZ,QAAI,UAAU,GAAG;AAChB,YAAM,IAAI,wBAAwB;AAAA,IACnC;AAEM,UAAA,IAAI,QAAQ,IAAI,sBAAsB,OAAO,WAAW,KAAK,QAAQ,CAAC;AAErE,WAAA,IAAI,WAAW,IAAI;AAAA,EAC3B;AACD;"}
|
package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Database = require("@contember/database");
|
|
4
|
-
const time = require("../../utils/time.cjs");
|
|
5
|
-
const PASSWORD_RESET_EXPIRATION = 60;
|
|
6
|
-
class SavePasswordResetRequestCommand {
|
|
7
|
-
constructor(personId, tokenHash, expirationMinutes = PASSWORD_RESET_EXPIRATION) {
|
|
8
|
-
this.personId = personId;
|
|
9
|
-
this.tokenHash = tokenHash;
|
|
10
|
-
this.expirationMinutes = expirationMinutes;
|
|
11
|
-
}
|
|
12
|
-
async execute({ db, providers }) {
|
|
13
|
-
await Database.InsertBuilder.create().into("person_password_reset").values({
|
|
14
|
-
id: providers.uuid(),
|
|
15
|
-
token_hash: this.tokenHash,
|
|
16
|
-
person_id: this.personId,
|
|
17
|
-
expires_at: time.plusMinutes(providers.now(), this.expirationMinutes),
|
|
18
|
-
created_at: providers.now(),
|
|
19
|
-
used_at: null
|
|
20
|
-
}).execute(db);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.SavePasswordResetRequestCommand = SavePasswordResetRequestCommand;
|
|
24
|
-
//# sourceMappingURL=SavePasswordResetRequestCommand.cjs.map
|
package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SavePasswordResetRequestCommand.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/SavePasswordResetRequestCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { InsertBuilder } from '@contember/database'\nimport { plusMinutes } from '../../utils/time'\nimport { TokenHash } from '../../utils'\n\nconst PASSWORD_RESET_EXPIRATION = 60\n\nexport class SavePasswordResetRequestCommand implements Command<void> {\n\tconstructor(\n\t\tprivate readonly personId: string,\n\t\tprivate readonly tokenHash: TokenHash,\n\t\tprivate readonly expirationMinutes: number = PASSWORD_RESET_EXPIRATION,\n\t) {}\n\n\tasync execute({ db, providers }: Command.Args): Promise<void> {\n\t\tawait InsertBuilder.create()\n\t\t\t.into('person_password_reset')\n\t\t\t.values({\n\t\t\t\tid: providers.uuid(),\n\t\t\t\ttoken_hash: this.tokenHash,\n\t\t\t\tperson_id: this.personId,\n\t\t\t\texpires_at: plusMinutes(providers.now(), this.expirationMinutes),\n\t\t\t\tcreated_at: providers.now(),\n\t\t\t\tused_at: null,\n\t\t\t})\n\t\t\t.execute(db)\n\t}\n}\n"],"names":["InsertBuilder","plusMinutes"],"mappings":";;;;AAKA,MAAM,4BAA4B;AAE3B,MAAM,gCAAyD;AAAA,EACrE,YACkB,UACA,WACA,oBAA4B,2BAC5C;AAHgB,SAAA,WAAA;AACA,SAAA,YAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEH,MAAM,QAAQ,EAAE,IAAI,aAA0C;AAC7D,UAAMA,SAAAA,cAAc,OAAO,EACzB,KAAK,uBAAuB,EAC5B,OAAO;AAAA,MACP,IAAI,UAAU,KAAK;AAAA,MACnB,YAAY,KAAK;AAAA,MACjB,WAAW,KAAK;AAAA,MAChB,YAAYC,KAAY,YAAA,UAAU,IAAI,GAAG,KAAK,iBAAiB;AAAA,MAC/D,YAAY,UAAU,IAAI;AAAA,MAC1B,SAAS;AAAA,IAAA,CACT,EACA,QAAQ,EAAE;AAAA,EACb;AACD;;"}
|
package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { InsertBuilder as InsertBuilder$1 } from "@contember/database";
|
|
2
|
-
import { plusMinutes } from "../../utils/time.js";
|
|
3
|
-
const PASSWORD_RESET_EXPIRATION = 60;
|
|
4
|
-
class SavePasswordResetRequestCommand {
|
|
5
|
-
constructor(personId, tokenHash, expirationMinutes = PASSWORD_RESET_EXPIRATION) {
|
|
6
|
-
this.personId = personId;
|
|
7
|
-
this.tokenHash = tokenHash;
|
|
8
|
-
this.expirationMinutes = expirationMinutes;
|
|
9
|
-
}
|
|
10
|
-
async execute({ db, providers }) {
|
|
11
|
-
await InsertBuilder$1.create().into("person_password_reset").values({
|
|
12
|
-
id: providers.uuid(),
|
|
13
|
-
token_hash: this.tokenHash,
|
|
14
|
-
person_id: this.personId,
|
|
15
|
-
expires_at: plusMinutes(providers.now(), this.expirationMinutes),
|
|
16
|
-
created_at: providers.now(),
|
|
17
|
-
used_at: null
|
|
18
|
-
}).execute(db);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
SavePasswordResetRequestCommand
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=SavePasswordResetRequestCommand.js.map
|
package/dist/development/src/model/commands/passwordReset/SavePasswordResetRequestCommand.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SavePasswordResetRequestCommand.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/SavePasswordResetRequestCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { InsertBuilder } from '@contember/database'\nimport { plusMinutes } from '../../utils/time'\nimport { TokenHash } from '../../utils'\n\nconst PASSWORD_RESET_EXPIRATION = 60\n\nexport class SavePasswordResetRequestCommand implements Command<void> {\n\tconstructor(\n\t\tprivate readonly personId: string,\n\t\tprivate readonly tokenHash: TokenHash,\n\t\tprivate readonly expirationMinutes: number = PASSWORD_RESET_EXPIRATION,\n\t) {}\n\n\tasync execute({ db, providers }: Command.Args): Promise<void> {\n\t\tawait InsertBuilder.create()\n\t\t\t.into('person_password_reset')\n\t\t\t.values({\n\t\t\t\tid: providers.uuid(),\n\t\t\t\ttoken_hash: this.tokenHash,\n\t\t\t\tperson_id: this.personId,\n\t\t\t\texpires_at: plusMinutes(providers.now(), this.expirationMinutes),\n\t\t\t\tcreated_at: providers.now(),\n\t\t\t\tused_at: null,\n\t\t\t})\n\t\t\t.execute(db)\n\t}\n}\n"],"names":["InsertBuilder"],"mappings":";;AAKA,MAAM,4BAA4B;AAE3B,MAAM,gCAAyD;AAAA,EACrE,YACkB,UACA,WACA,oBAA4B,2BAC5C;AAHgB,SAAA,WAAA;AACA,SAAA,YAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEH,MAAM,QAAQ,EAAE,IAAI,aAA0C;AAC7D,UAAMA,gBAAc,OAAO,EACzB,KAAK,uBAAuB,EAC5B,OAAO;AAAA,MACP,IAAI,UAAU,KAAK;AAAA,MACnB,YAAY,KAAK;AAAA,MACjB,WAAW,KAAK;AAAA,MAChB,YAAY,YAAY,UAAU,IAAI,GAAG,KAAK,iBAAiB;AAAA,MAC/D,YAAY,UAAU,IAAI;AAAA,MAC1B,SAAS;AAAA,IAAA,CACT,EACA,QAAQ,EAAE;AAAA,EACb;AACD;"}
|
package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
require("@contember/database");
|
|
4
|
-
require("../../type/ApiKey.cjs");
|
|
5
|
-
const SavePasswordResetRequestCommand = require("./SavePasswordResetRequestCommand.cjs");
|
|
6
|
-
const tokenUtils = require("../../utils/tokenUtils.cjs");
|
|
7
|
-
class CreatePasswordResetRequestCommand {
|
|
8
|
-
constructor(personId, expirationMinutes) {
|
|
9
|
-
this.personId = personId;
|
|
10
|
-
this.expirationMinutes = expirationMinutes;
|
|
11
|
-
}
|
|
12
|
-
async execute({ db, providers, bus }) {
|
|
13
|
-
const token = await tokenUtils.generateToken(providers);
|
|
14
|
-
const tokenHash = tokenUtils.computeTokenHash(token);
|
|
15
|
-
await bus.execute(new SavePasswordResetRequestCommand.SavePasswordResetRequestCommand(
|
|
16
|
-
this.personId,
|
|
17
|
-
tokenHash,
|
|
18
|
-
this.expirationMinutes
|
|
19
|
-
));
|
|
20
|
-
return new CreatePasswordResetRequestResult(token);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
class CreatePasswordResetRequestResult {
|
|
24
|
-
constructor(token) {
|
|
25
|
-
this.token = token;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.CreatePasswordResetRequestCommand = CreatePasswordResetRequestCommand;
|
|
29
|
-
exports.CreatePasswordResetRequestResult = CreatePasswordResetRequestResult;
|
|
30
|
-
//# sourceMappingURL=CreatePasswordResetRequestCommand.cjs.map
|
package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreatePasswordResetRequestCommand.cjs","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { computeTokenHash, generateToken } from '../../utils'\nimport { SavePasswordResetRequestCommand } from './SavePasswordResetRequestCommand'\n\nexport class CreatePasswordResetRequestCommand implements Command<CreatePasswordResetRequestResult> {\n\tconstructor(\n\t\tprivate readonly personId: string,\n\t\tprivate readonly expirationMinutes?: number,\n\t) {}\n\n\tasync execute({ db, providers, bus }: Command.Args): Promise<CreatePasswordResetRequestResult> {\n\t\tconst token = await generateToken(providers)\n\t\tconst tokenHash = computeTokenHash(token)\n\t\tawait bus.execute(new SavePasswordResetRequestCommand(\n\t\t\tthis.personId,\n\t\t\ttokenHash,\n\t\t\tthis.expirationMinutes,\n\t\t))\n\n\t\treturn new CreatePasswordResetRequestResult(token)\n\t}\n}\nexport class CreatePasswordResetRequestResult {\n\tconstructor(public readonly token: string) {}\n}\n"],"names":["generateToken","computeTokenHash","SavePasswordResetRequestCommand"],"mappings":";;;;;;AAIO,MAAM,kCAAuF;AAAA,EACnG,YACkB,UACA,mBAChB;AAFgB,SAAA,WAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEH,MAAM,QAAQ,EAAE,IAAI,WAAW,OAAgE;AACxF,UAAA,QAAQ,MAAMA,yBAAc,SAAS;AACrC,UAAA,YAAYC,4BAAiB,KAAK;AAClC,UAAA,IAAI,QAAQ,IAAIC,gCAAA;AAAA,MACrB,KAAK;AAAA,MACL;AAAA,MACA,KAAK;AAAA,IAAA,CACL;AAEM,WAAA,IAAI,iCAAiC,KAAK;AAAA,EAClD;AACD;AACO,MAAM,iCAAiC;AAAA,EAC7C,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAC7C;;;"}
|
package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "@contember/database";
|
|
2
|
-
import "../../type/ApiKey.js";
|
|
3
|
-
import { SavePasswordResetRequestCommand } from "./SavePasswordResetRequestCommand.js";
|
|
4
|
-
import { generateToken, computeTokenHash } from "../../utils/tokenUtils.js";
|
|
5
|
-
class CreatePasswordResetRequestCommand {
|
|
6
|
-
constructor(personId, expirationMinutes) {
|
|
7
|
-
this.personId = personId;
|
|
8
|
-
this.expirationMinutes = expirationMinutes;
|
|
9
|
-
}
|
|
10
|
-
async execute({ db, providers, bus }) {
|
|
11
|
-
const token = await generateToken(providers);
|
|
12
|
-
const tokenHash = computeTokenHash(token);
|
|
13
|
-
await bus.execute(new SavePasswordResetRequestCommand(
|
|
14
|
-
this.personId,
|
|
15
|
-
tokenHash,
|
|
16
|
-
this.expirationMinutes
|
|
17
|
-
));
|
|
18
|
-
return new CreatePasswordResetRequestResult(token);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
class CreatePasswordResetRequestResult {
|
|
22
|
-
constructor(token) {
|
|
23
|
-
this.token = token;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
CreatePasswordResetRequestCommand,
|
|
28
|
-
CreatePasswordResetRequestResult
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=CreatePasswordResetRequestCommand.js.map
|
package/dist/production/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreatePasswordResetRequestCommand.js","sources":["../../../../../../../packages/engine-tenant-api/src/model/commands/passwordReset/CreatePasswordResetRequestCommand.ts"],"sourcesContent":["import { Command } from '../Command'\nimport { computeTokenHash, generateToken } from '../../utils'\nimport { SavePasswordResetRequestCommand } from './SavePasswordResetRequestCommand'\n\nexport class CreatePasswordResetRequestCommand implements Command<CreatePasswordResetRequestResult> {\n\tconstructor(\n\t\tprivate readonly personId: string,\n\t\tprivate readonly expirationMinutes?: number,\n\t) {}\n\n\tasync execute({ db, providers, bus }: Command.Args): Promise<CreatePasswordResetRequestResult> {\n\t\tconst token = await generateToken(providers)\n\t\tconst tokenHash = computeTokenHash(token)\n\t\tawait bus.execute(new SavePasswordResetRequestCommand(\n\t\t\tthis.personId,\n\t\t\ttokenHash,\n\t\t\tthis.expirationMinutes,\n\t\t))\n\n\t\treturn new CreatePasswordResetRequestResult(token)\n\t}\n}\nexport class CreatePasswordResetRequestResult {\n\tconstructor(public readonly token: string) {}\n}\n"],"names":[],"mappings":";;;;AAIO,MAAM,kCAAuF;AAAA,EACnG,YACkB,UACA,mBAChB;AAFgB,SAAA,WAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEH,MAAM,QAAQ,EAAE,IAAI,WAAW,OAAgE;AACxF,UAAA,QAAQ,MAAM,cAAc,SAAS;AACrC,UAAA,YAAY,iBAAiB,KAAK;AAClC,UAAA,IAAI,QAAQ,IAAI;AAAA,MACrB,KAAK;AAAA,MACL;AAAA,MACA,KAAK;AAAA,IAAA,CACL;AAEM,WAAA,IAAI,iCAAiC,KAAK;AAAA,EAClD;AACD;AACO,MAAM,iCAAiC;AAAA,EAC7C,YAA4B,OAAe;AAAf,SAAA,QAAA;AAAA,EAAgB;AAC7C;"}
|