@udhuong/admin-core 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/admin-core-options.interface.d.ts +53 -0
- package/dist/server/admin-core-options.interface.d.ts.map +1 -0
- package/dist/server/admin-core-options.interface.js +5 -0
- package/dist/server/admin-core-options.interface.js.map +1 -0
- package/dist/server/admin-core.module.d.ts +8 -0
- package/dist/server/admin-core.module.d.ts.map +1 -0
- package/dist/server/admin-core.module.js +292 -0
- package/dist/server/admin-core.module.js.map +1 -0
- package/dist/server/auth/application/actions/auth/change-password.action.d.ts +12 -0
- package/dist/server/auth/application/actions/auth/change-password.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/change-password.action.js +56 -0
- package/dist/server/auth/application/actions/auth/change-password.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/client-credentials.action.d.ts +16 -0
- package/dist/server/auth/application/actions/auth/client-credentials.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/client-credentials.action.js +101 -0
- package/dist/server/auth/application/actions/auth/client-credentials.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/forgot-password.action.d.ts +12 -0
- package/dist/server/auth/application/actions/auth/forgot-password.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/forgot-password.action.js +50 -0
- package/dist/server/auth/application/actions/auth/forgot-password.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/get-roles-permissions.action.d.ts +13 -0
- package/dist/server/auth/application/actions/auth/get-roles-permissions.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/get-roles-permissions.action.js +53 -0
- package/dist/server/auth/application/actions/auth/get-roles-permissions.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/get-user-profile.action.d.ts +10 -0
- package/dist/server/auth/application/actions/auth/get-user-profile.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/get-user-profile.action.js +43 -0
- package/dist/server/auth/application/actions/auth/get-user-profile.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/index.d.ts +14 -0
- package/dist/server/auth/application/actions/auth/index.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/index.js +30 -0
- package/dist/server/auth/application/actions/auth/index.js.map +1 -0
- package/dist/server/auth/application/actions/auth/login.action.d.ts +23 -0
- package/dist/server/auth/application/actions/auth/login.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/login.action.js +175 -0
- package/dist/server/auth/application/actions/auth/login.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/logout.action.d.ts +8 -0
- package/dist/server/auth/application/actions/auth/logout.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/logout.action.js +48 -0
- package/dist/server/auth/application/actions/auth/logout.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/refresh-token.action.d.ts +24 -0
- package/dist/server/auth/application/actions/auth/refresh-token.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/refresh-token.action.js +165 -0
- package/dist/server/auth/application/actions/auth/refresh-token.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/register.action.d.ts +16 -0
- package/dist/server/auth/application/actions/auth/register.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/register.action.js +83 -0
- package/dist/server/auth/application/actions/auth/register.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/resend-verification-email.action.d.ts +12 -0
- package/dist/server/auth/application/actions/auth/resend-verification-email.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/resend-verification-email.action.js +61 -0
- package/dist/server/auth/application/actions/auth/resend-verification-email.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/reset-password.action.d.ts +10 -0
- package/dist/server/auth/application/actions/auth/reset-password.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/reset-password.action.js +52 -0
- package/dist/server/auth/application/actions/auth/reset-password.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/update-profile.action.d.ts +8 -0
- package/dist/server/auth/application/actions/auth/update-profile.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/update-profile.action.js +63 -0
- package/dist/server/auth/application/actions/auth/update-profile.action.js.map +1 -0
- package/dist/server/auth/application/actions/auth/verify-email.action.d.ts +9 -0
- package/dist/server/auth/application/actions/auth/verify-email.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/auth/verify-email.action.js +54 -0
- package/dist/server/auth/application/actions/auth/verify-email.action.js.map +1 -0
- package/dist/server/auth/application/actions/index.d.ts +5 -0
- package/dist/server/auth/application/actions/index.d.ts.map +1 -0
- package/dist/server/auth/application/actions/index.js +21 -0
- package/dist/server/auth/application/actions/index.js.map +1 -0
- package/dist/server/auth/application/actions/session/get-active-sessions.action.d.ts +8 -0
- package/dist/server/auth/application/actions/session/get-active-sessions.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/session/get-active-sessions.action.js +40 -0
- package/dist/server/auth/application/actions/session/get-active-sessions.action.js.map +1 -0
- package/dist/server/auth/application/actions/session/index.d.ts +4 -0
- package/dist/server/auth/application/actions/session/index.d.ts.map +1 -0
- package/dist/server/auth/application/actions/session/index.js +20 -0
- package/dist/server/auth/application/actions/session/index.js.map +1 -0
- package/dist/server/auth/application/actions/session/revoke-all-sessions.action.d.ts +9 -0
- package/dist/server/auth/application/actions/session/revoke-all-sessions.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/session/revoke-all-sessions.action.js +54 -0
- package/dist/server/auth/application/actions/session/revoke-all-sessions.action.js.map +1 -0
- package/dist/server/auth/application/actions/session/revoke-session.action.d.ts +9 -0
- package/dist/server/auth/application/actions/session/revoke-session.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/session/revoke-session.action.js +52 -0
- package/dist/server/auth/application/actions/session/revoke-session.action.js.map +1 -0
- package/dist/server/auth/application/actions/social/index.d.ts +2 -0
- package/dist/server/auth/application/actions/social/index.d.ts.map +1 -0
- package/dist/server/auth/application/actions/social/index.js +18 -0
- package/dist/server/auth/application/actions/social/index.js.map +1 -0
- package/dist/server/auth/application/actions/social/social-login.action.d.ts +22 -0
- package/dist/server/auth/application/actions/social/social-login.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/social/social-login.action.js +159 -0
- package/dist/server/auth/application/actions/social/social-login.action.js.map +1 -0
- package/dist/server/auth/application/actions/two-factor/disable-2fa.action.d.ts +9 -0
- package/dist/server/auth/application/actions/two-factor/disable-2fa.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/two-factor/disable-2fa.action.js +49 -0
- package/dist/server/auth/application/actions/two-factor/disable-2fa.action.js.map +1 -0
- package/dist/server/auth/application/actions/two-factor/enable-2fa.action.d.ts +13 -0
- package/dist/server/auth/application/actions/two-factor/enable-2fa.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/two-factor/enable-2fa.action.js +135 -0
- package/dist/server/auth/application/actions/two-factor/enable-2fa.action.js.map +1 -0
- package/dist/server/auth/application/actions/two-factor/index.d.ts +4 -0
- package/dist/server/auth/application/actions/two-factor/index.d.ts.map +1 -0
- package/dist/server/auth/application/actions/two-factor/index.js +20 -0
- package/dist/server/auth/application/actions/two-factor/index.js.map +1 -0
- package/dist/server/auth/application/actions/two-factor/verify-2fa-setup.action.d.ts +10 -0
- package/dist/server/auth/application/actions/two-factor/verify-2fa-setup.action.d.ts.map +1 -0
- package/dist/server/auth/application/actions/two-factor/verify-2fa-setup.action.js +97 -0
- package/dist/server/auth/application/actions/two-factor/verify-2fa-setup.action.js.map +1 -0
- package/dist/server/auth/application/dto/change-password.dto.d.ts +5 -0
- package/dist/server/auth/application/dto/change-password.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/change-password.dto.js +33 -0
- package/dist/server/auth/application/dto/change-password.dto.js.map +1 -0
- package/dist/server/auth/application/dto/client-credentials.dto.d.ts +7 -0
- package/dist/server/auth/application/dto/client-credentials.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/client-credentials.dto.js +42 -0
- package/dist/server/auth/application/dto/client-credentials.dto.js.map +1 -0
- package/dist/server/auth/application/dto/enable-2fa-response.d.ts +7 -0
- package/dist/server/auth/application/dto/enable-2fa-response.d.ts.map +1 -0
- package/dist/server/auth/application/dto/enable-2fa-response.js +13 -0
- package/dist/server/auth/application/dto/enable-2fa-response.js.map +1 -0
- package/dist/server/auth/application/dto/enable-2fa.dto.d.ts +4 -0
- package/dist/server/auth/application/dto/enable-2fa.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/enable-2fa.dto.js +23 -0
- package/dist/server/auth/application/dto/enable-2fa.dto.js.map +1 -0
- package/dist/server/auth/application/dto/forgot-password.dto.d.ts +4 -0
- package/dist/server/auth/application/dto/forgot-password.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/forgot-password.dto.js +23 -0
- package/dist/server/auth/application/dto/forgot-password.dto.js.map +1 -0
- package/dist/server/auth/application/dto/index.d.ts +17 -0
- package/dist/server/auth/application/dto/index.d.ts.map +1 -0
- package/dist/server/auth/application/dto/index.js +33 -0
- package/dist/server/auth/application/dto/index.js.map +1 -0
- package/dist/server/auth/application/dto/login-response.d.ts +25 -0
- package/dist/server/auth/application/dto/login-response.d.ts.map +1 -0
- package/dist/server/auth/application/dto/login-response.js +15 -0
- package/dist/server/auth/application/dto/login-response.js.map +1 -0
- package/dist/server/auth/application/dto/login.dto.d.ts +10 -0
- package/dist/server/auth/application/dto/login.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/login.dto.js +59 -0
- package/dist/server/auth/application/dto/login.dto.js.map +1 -0
- package/dist/server/auth/application/dto/refresh-token.dto.d.ts +5 -0
- package/dist/server/auth/application/dto/refresh-token.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/refresh-token.dto.js +30 -0
- package/dist/server/auth/application/dto/refresh-token.dto.js.map +1 -0
- package/dist/server/auth/application/dto/register.dto.d.ts +7 -0
- package/dist/server/auth/application/dto/register.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/register.dto.js +47 -0
- package/dist/server/auth/application/dto/register.dto.js.map +1 -0
- package/dist/server/auth/application/dto/reset-password.dto.d.ts +5 -0
- package/dist/server/auth/application/dto/reset-password.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/reset-password.dto.js +33 -0
- package/dist/server/auth/application/dto/reset-password.dto.js.map +1 -0
- package/dist/server/auth/application/dto/social-login.dto.d.ts +10 -0
- package/dist/server/auth/application/dto/social-login.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/social-login.dto.js +54 -0
- package/dist/server/auth/application/dto/social-login.dto.js.map +1 -0
- package/dist/server/auth/application/dto/token-response.d.ts +9 -0
- package/dist/server/auth/application/dto/token-response.d.ts.map +1 -0
- package/dist/server/auth/application/dto/token-response.js +15 -0
- package/dist/server/auth/application/dto/token-response.js.map +1 -0
- package/dist/server/auth/application/dto/update-profile.dto.d.ts +7 -0
- package/dist/server/auth/application/dto/update-profile.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/update-profile.dto.js +41 -0
- package/dist/server/auth/application/dto/update-profile.dto.js.map +1 -0
- package/dist/server/auth/application/dto/user-response.d.ts +14 -0
- package/dist/server/auth/application/dto/user-response.d.ts.map +1 -0
- package/dist/server/auth/application/dto/user-response.js +20 -0
- package/dist/server/auth/application/dto/user-response.js.map +1 -0
- package/dist/server/auth/application/dto/verify-2fa.dto.d.ts +4 -0
- package/dist/server/auth/application/dto/verify-2fa.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/verify-2fa.dto.js +24 -0
- package/dist/server/auth/application/dto/verify-2fa.dto.js.map +1 -0
- package/dist/server/auth/application/dto/verify-email.dto.d.ts +4 -0
- package/dist/server/auth/application/dto/verify-email.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dto/verify-email.dto.js +23 -0
- package/dist/server/auth/application/dto/verify-email.dto.js.map +1 -0
- package/dist/server/auth/application/dtos/create-role.dto.d.ts +6 -0
- package/dist/server/auth/application/dtos/create-role.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dtos/create-role.dto.js +35 -0
- package/dist/server/auth/application/dtos/create-role.dto.js.map +1 -0
- package/dist/server/auth/application/dtos/index.d.ts +4 -0
- package/dist/server/auth/application/dtos/index.d.ts.map +1 -0
- package/dist/server/auth/application/dtos/index.js +20 -0
- package/dist/server/auth/application/dtos/index.js.map +1 -0
- package/dist/server/auth/application/dtos/query-role.dto.d.ts +6 -0
- package/dist/server/auth/application/dtos/query-role.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dtos/query-role.dto.js +35 -0
- package/dist/server/auth/application/dtos/query-role.dto.js.map +1 -0
- package/dist/server/auth/application/dtos/update-role.dto.d.ts +6 -0
- package/dist/server/auth/application/dtos/update-role.dto.d.ts.map +1 -0
- package/dist/server/auth/application/dtos/update-role.dto.js +36 -0
- package/dist/server/auth/application/dtos/update-role.dto.js.map +1 -0
- package/dist/server/auth/application/index.d.ts +4 -0
- package/dist/server/auth/application/index.d.ts.map +1 -0
- package/dist/server/auth/application/index.js +20 -0
- package/dist/server/auth/application/index.js.map +1 -0
- package/dist/server/auth/application/ports/email.service.d.ts +12 -0
- package/dist/server/auth/application/ports/email.service.d.ts.map +1 -0
- package/dist/server/auth/application/ports/email.service.js +5 -0
- package/dist/server/auth/application/ports/email.service.js.map +1 -0
- package/dist/server/auth/application/ports/hash.service.d.ts +7 -0
- package/dist/server/auth/application/ports/hash.service.d.ts.map +1 -0
- package/dist/server/auth/application/ports/hash.service.js +5 -0
- package/dist/server/auth/application/ports/hash.service.js.map +1 -0
- package/dist/server/auth/application/ports/index.d.ts +5 -0
- package/dist/server/auth/application/ports/index.d.ts.map +1 -0
- package/dist/server/auth/application/ports/index.js +21 -0
- package/dist/server/auth/application/ports/index.js.map +1 -0
- package/dist/server/auth/application/ports/social-auth.service.d.ts +13 -0
- package/dist/server/auth/application/ports/social-auth.service.d.ts.map +1 -0
- package/dist/server/auth/application/ports/social-auth.service.js +7 -0
- package/dist/server/auth/application/ports/social-auth.service.js.map +1 -0
- package/dist/server/auth/application/ports/token.service.d.ts +36 -0
- package/dist/server/auth/application/ports/token.service.d.ts.map +1 -0
- package/dist/server/auth/application/ports/token.service.js +5 -0
- package/dist/server/auth/application/ports/token.service.js.map +1 -0
- package/dist/server/auth/application/services/auth-user.service.d.ts +29 -0
- package/dist/server/auth/application/services/auth-user.service.d.ts.map +1 -0
- package/dist/server/auth/application/services/auth-user.service.js +165 -0
- package/dist/server/auth/application/services/auth-user.service.js.map +1 -0
- package/dist/server/auth/application/services/permission.service.d.ts +13 -0
- package/dist/server/auth/application/services/permission.service.d.ts.map +1 -0
- package/dist/server/auth/application/services/permission.service.js +56 -0
- package/dist/server/auth/application/services/permission.service.js.map +1 -0
- package/dist/server/auth/application/services/role.service.d.ts +61 -0
- package/dist/server/auth/application/services/role.service.d.ts.map +1 -0
- package/dist/server/auth/application/services/role.service.js +178 -0
- package/dist/server/auth/application/services/role.service.js.map +1 -0
- package/dist/server/auth/domain/constants/auth-events.const.d.ts +17 -0
- package/dist/server/auth/domain/constants/auth-events.const.d.ts.map +1 -0
- package/dist/server/auth/domain/constants/auth-events.const.js +19 -0
- package/dist/server/auth/domain/constants/auth-events.const.js.map +1 -0
- package/dist/server/auth/domain/constants/index.d.ts +3 -0
- package/dist/server/auth/domain/constants/index.d.ts.map +1 -0
- package/dist/server/auth/domain/constants/index.js +19 -0
- package/dist/server/auth/domain/constants/index.js.map +1 -0
- package/dist/server/auth/domain/constants/oauth.config.d.ts +50 -0
- package/dist/server/auth/domain/constants/oauth.config.d.ts.map +1 -0
- package/dist/server/auth/domain/constants/oauth.config.js +53 -0
- package/dist/server/auth/domain/constants/oauth.config.js.map +1 -0
- package/dist/server/auth/domain/constants/scopes.d.ts +26 -0
- package/dist/server/auth/domain/constants/scopes.d.ts.map +1 -0
- package/dist/server/auth/domain/constants/scopes.js +52 -0
- package/dist/server/auth/domain/constants/scopes.js.map +1 -0
- package/dist/server/auth/domain/entities/auth-user.d.ts +52 -0
- package/dist/server/auth/domain/entities/auth-user.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/auth-user.js +134 -0
- package/dist/server/auth/domain/entities/auth-user.js.map +1 -0
- package/dist/server/auth/domain/entities/email-verification-token.d.ts +13 -0
- package/dist/server/auth/domain/entities/email-verification-token.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/email-verification-token.js +27 -0
- package/dist/server/auth/domain/entities/email-verification-token.js.map +1 -0
- package/dist/server/auth/domain/entities/index.d.ts +17 -0
- package/dist/server/auth/domain/entities/index.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/index.js +33 -0
- package/dist/server/auth/domain/entities/index.js.map +1 -0
- package/dist/server/auth/domain/entities/login-history.d.ts +18 -0
- package/dist/server/auth/domain/entities/login-history.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/login-history.js +30 -0
- package/dist/server/auth/domain/entities/login-history.js.map +1 -0
- package/dist/server/auth/domain/entities/oauth-audit-log.d.ts +15 -0
- package/dist/server/auth/domain/entities/oauth-audit-log.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/oauth-audit-log.js +34 -0
- package/dist/server/auth/domain/entities/oauth-audit-log.js.map +1 -0
- package/dist/server/auth/domain/entities/oauth-authorization-code.d.ts +19 -0
- package/dist/server/auth/domain/entities/oauth-authorization-code.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/oauth-authorization-code.js +37 -0
- package/dist/server/auth/domain/entities/oauth-authorization-code.js.map +1 -0
- package/dist/server/auth/domain/entities/oauth-client-consent.d.ts +14 -0
- package/dist/server/auth/domain/entities/oauth-client-consent.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/oauth-client-consent.js +30 -0
- package/dist/server/auth/domain/entities/oauth-client-consent.js.map +1 -0
- package/dist/server/auth/domain/entities/oauth-client.d.ts +31 -0
- package/dist/server/auth/domain/entities/oauth-client.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/oauth-client.js +51 -0
- package/dist/server/auth/domain/entities/oauth-client.js.map +1 -0
- package/dist/server/auth/domain/entities/oauth-scope.d.ts +10 -0
- package/dist/server/auth/domain/entities/oauth-scope.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/oauth-scope.js +18 -0
- package/dist/server/auth/domain/entities/oauth-scope.js.map +1 -0
- package/dist/server/auth/domain/entities/oauth-token.d.ts +20 -0
- package/dist/server/auth/domain/entities/oauth-token.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/oauth-token.js +38 -0
- package/dist/server/auth/domain/entities/oauth-token.js.map +1 -0
- package/dist/server/auth/domain/entities/permission.d.ts +14 -0
- package/dist/server/auth/domain/entities/permission.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/permission.js +26 -0
- package/dist/server/auth/domain/entities/permission.js.map +1 -0
- package/dist/server/auth/domain/entities/role-permission.d.ts +8 -0
- package/dist/server/auth/domain/entities/role-permission.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/role-permission.js +14 -0
- package/dist/server/auth/domain/entities/role-permission.js.map +1 -0
- package/dist/server/auth/domain/entities/role.d.ts +13 -0
- package/dist/server/auth/domain/entities/role.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/role.js +26 -0
- package/dist/server/auth/domain/entities/role.js.map +1 -0
- package/dist/server/auth/domain/entities/social-account.d.ts +20 -0
- package/dist/server/auth/domain/entities/social-account.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/social-account.js +37 -0
- package/dist/server/auth/domain/entities/social-account.js.map +1 -0
- package/dist/server/auth/domain/entities/user-role.d.ts +8 -0
- package/dist/server/auth/domain/entities/user-role.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/user-role.js +14 -0
- package/dist/server/auth/domain/entities/user-role.js.map +1 -0
- package/dist/server/auth/domain/entities/user-session.d.ts +25 -0
- package/dist/server/auth/domain/entities/user-session.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/user-session.js +50 -0
- package/dist/server/auth/domain/entities/user-session.js.map +1 -0
- package/dist/server/auth/domain/entities/user-two-factor.d.ts +25 -0
- package/dist/server/auth/domain/entities/user-two-factor.d.ts.map +1 -0
- package/dist/server/auth/domain/entities/user-two-factor.js +66 -0
- package/dist/server/auth/domain/entities/user-two-factor.js.map +1 -0
- package/dist/server/auth/domain/enums/index.d.ts +2 -0
- package/dist/server/auth/domain/enums/index.d.ts.map +1 -0
- package/dist/server/auth/domain/enums/index.js +18 -0
- package/dist/server/auth/domain/enums/index.js.map +1 -0
- package/dist/server/auth/domain/enums/oauth.enums.d.ts +69 -0
- package/dist/server/auth/domain/enums/oauth.enums.d.ts.map +1 -0
- package/dist/server/auth/domain/enums/oauth.enums.js +130 -0
- package/dist/server/auth/domain/enums/oauth.enums.js.map +1 -0
- package/dist/server/auth/domain/events/auth-user.events.d.ts +37 -0
- package/dist/server/auth/domain/events/auth-user.events.d.ts.map +1 -0
- package/dist/server/auth/domain/events/auth-user.events.js +70 -0
- package/dist/server/auth/domain/events/auth-user.events.js.map +1 -0
- package/dist/server/auth/domain/index.d.ts +3 -0
- package/dist/server/auth/domain/index.d.ts.map +1 -0
- package/dist/server/auth/domain/index.js +19 -0
- package/dist/server/auth/domain/index.js.map +1 -0
- package/dist/server/auth/domain/interfaces/auth.interface.d.ts +41 -0
- package/dist/server/auth/domain/interfaces/auth.interface.d.ts.map +1 -0
- package/dist/server/auth/domain/interfaces/auth.interface.js +3 -0
- package/dist/server/auth/domain/interfaces/auth.interface.js.map +1 -0
- package/dist/server/auth/domain/interfaces/index.d.ts +2 -0
- package/dist/server/auth/domain/interfaces/index.d.ts.map +1 -0
- package/dist/server/auth/domain/interfaces/index.js +18 -0
- package/dist/server/auth/domain/interfaces/index.js.map +1 -0
- package/dist/server/auth/domain/repositories/auth-user.repository.d.ts +14 -0
- package/dist/server/auth/domain/repositories/auth-user.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/auth-user.repository.js +5 -0
- package/dist/server/auth/domain/repositories/auth-user.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/email-verification-token.repository.d.ts +13 -0
- package/dist/server/auth/domain/repositories/email-verification-token.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/email-verification-token.repository.js +5 -0
- package/dist/server/auth/domain/repositories/email-verification-token.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/index.d.ts +17 -0
- package/dist/server/auth/domain/repositories/index.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/index.js +33 -0
- package/dist/server/auth/domain/repositories/index.js.map +1 -0
- package/dist/server/auth/domain/repositories/login-history.repository.d.ts +11 -0
- package/dist/server/auth/domain/repositories/login-history.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/login-history.repository.js +5 -0
- package/dist/server/auth/domain/repositories/login-history.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-audit-log.repository.d.ts +12 -0
- package/dist/server/auth/domain/repositories/oauth-audit-log.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-audit-log.repository.js +5 -0
- package/dist/server/auth/domain/repositories/oauth-audit-log.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-authorization-code.repository.d.ts +12 -0
- package/dist/server/auth/domain/repositories/oauth-authorization-code.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-authorization-code.repository.js +5 -0
- package/dist/server/auth/domain/repositories/oauth-authorization-code.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-client-consent.repository.d.ts +12 -0
- package/dist/server/auth/domain/repositories/oauth-client-consent.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-client-consent.repository.js +5 -0
- package/dist/server/auth/domain/repositories/oauth-client-consent.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-client.repository.d.ts +12 -0
- package/dist/server/auth/domain/repositories/oauth-client.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-client.repository.js +5 -0
- package/dist/server/auth/domain/repositories/oauth-client.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-scope.repository.d.ts +13 -0
- package/dist/server/auth/domain/repositories/oauth-scope.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-scope.repository.js +5 -0
- package/dist/server/auth/domain/repositories/oauth-scope.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-token.repository.d.ts +15 -0
- package/dist/server/auth/domain/repositories/oauth-token.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/oauth-token.repository.js +5 -0
- package/dist/server/auth/domain/repositories/oauth-token.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/permission.repository.d.ts +14 -0
- package/dist/server/auth/domain/repositories/permission.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/permission.repository.js +5 -0
- package/dist/server/auth/domain/repositories/permission.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/role-permission.repository.d.ts +14 -0
- package/dist/server/auth/domain/repositories/role-permission.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/role-permission.repository.js +5 -0
- package/dist/server/auth/domain/repositories/role-permission.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/role.repository.d.ts +13 -0
- package/dist/server/auth/domain/repositories/role.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/role.repository.js +5 -0
- package/dist/server/auth/domain/repositories/role.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/social-account.repository.d.ts +14 -0
- package/dist/server/auth/domain/repositories/social-account.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/social-account.repository.js +5 -0
- package/dist/server/auth/domain/repositories/social-account.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/user-role.repository.d.ts +13 -0
- package/dist/server/auth/domain/repositories/user-role.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/user-role.repository.js +5 -0
- package/dist/server/auth/domain/repositories/user-role.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/user-session.repository.d.ts +14 -0
- package/dist/server/auth/domain/repositories/user-session.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/user-session.repository.js +5 -0
- package/dist/server/auth/domain/repositories/user-session.repository.js.map +1 -0
- package/dist/server/auth/domain/repositories/user-two-factor.repository.d.ts +11 -0
- package/dist/server/auth/domain/repositories/user-two-factor.repository.d.ts.map +1 -0
- package/dist/server/auth/domain/repositories/user-two-factor.repository.js +5 -0
- package/dist/server/auth/domain/repositories/user-two-factor.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/migrations/1733400000000-CreateOAuthSystem.d.ts +6 -0
- package/dist/server/auth/infrastructure/database/postgresql/migrations/1733400000000-CreateOAuthSystem.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/migrations/1733400000000-CreateOAuthSystem.js +1386 -0
- package/dist/server/auth/infrastructure/database/postgresql/migrations/1733400000000-CreateOAuthSystem.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/1-permission.seeder.d.ts +13 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/1-permission.seeder.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/1-permission.seeder.js +75 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/1-permission.seeder.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/2-role.seeder.d.ts +15 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/2-role.seeder.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/2-role.seeder.js +83 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/2-role.seeder.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/3-oauth-scope.seeder.d.ts +9 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/3-oauth-scope.seeder.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/3-oauth-scope.seeder.js +137 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/3-oauth-scope.seeder.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/4-oauth-client.seeder.d.ts +13 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/4-oauth-client.seeder.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/4-oauth-client.seeder.js +226 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/4-oauth-client.seeder.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/5-test-user.seeder.d.ts +13 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/5-test-user.seeder.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/5-test-user.seeder.js +161 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/5-test-user.seeder.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/index.d.ts +17 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/index.js +63 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/index.js.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/oauth-seeder.module.d.ts +3 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/oauth-seeder.module.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/oauth-seeder.module.js +58 -0
- package/dist/server/auth/infrastructure/database/postgresql/seeders/oauth-seeder.module.js.map +1 -0
- package/dist/server/auth/infrastructure/index.d.ts +5 -0
- package/dist/server/auth/infrastructure/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/index.js +21 -0
- package/dist/server/auth/infrastructure/index.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/auth-user.entity.d.ts +23 -0
- package/dist/server/auth/infrastructure/persistence/entities/auth-user.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/auth-user.entity.js +120 -0
- package/dist/server/auth/infrastructure/persistence/entities/auth-user.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/email-verification-token.entity.d.ts +9 -0
- package/dist/server/auth/infrastructure/persistence/entities/email-verification-token.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/email-verification-token.entity.js +50 -0
- package/dist/server/auth/infrastructure/persistence/entities/email-verification-token.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/index.d.ts +17 -0
- package/dist/server/auth/infrastructure/persistence/entities/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/index.js +33 -0
- package/dist/server/auth/infrastructure/persistence/entities/index.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/login-history.entity.d.ts +14 -0
- package/dist/server/auth/infrastructure/persistence/entities/login-history.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/login-history.entity.js +71 -0
- package/dist/server/auth/infrastructure/persistence/entities/login-history.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-audit-log.entity.d.ts +12 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-audit-log.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-audit-log.entity.js +65 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-audit-log.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-authorization-code.entity.d.ts +14 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-authorization-code.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-authorization-code.entity.js +75 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-authorization-code.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client-consent.entity.d.ts +11 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client-consent.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client-consent.entity.js +60 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client-consent.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client.entity.d.ts +23 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client.entity.js +120 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-client.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-scope.entity.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-scope.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-scope.entity.js +45 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-scope.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-token.entity.d.ts +14 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-token.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-token.entity.js +75 -0
- package/dist/server/auth/infrastructure/persistence/entities/oauth-token.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/permission.entity.d.ts +9 -0
- package/dist/server/auth/infrastructure/persistence/entities/permission.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/permission.entity.js +50 -0
- package/dist/server/auth/infrastructure/persistence/entities/permission.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/role-permission.entity.d.ts +7 -0
- package/dist/server/auth/infrastructure/persistence/entities/role-permission.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/role-permission.entity.js +40 -0
- package/dist/server/auth/infrastructure/persistence/entities/role-permission.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/role.entity.d.ts +9 -0
- package/dist/server/auth/infrastructure/persistence/entities/role.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/role.entity.js +50 -0
- package/dist/server/auth/infrastructure/persistence/entities/role.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/social-account.entity.d.ts +17 -0
- package/dist/server/auth/infrastructure/persistence/entities/social-account.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/social-account.entity.js +86 -0
- package/dist/server/auth/infrastructure/persistence/entities/social-account.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-role.entity.d.ts +7 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-role.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-role.entity.js +40 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-role.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-session.entity.d.ts +18 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-session.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-session.entity.js +95 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-session.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-two-factor.entity.d.ts +15 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-two-factor.entity.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-two-factor.entity.js +76 -0
- package/dist/server/auth/infrastructure/persistence/entities/user-two-factor.entity.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/auth-user.mapper.d.ts +9 -0
- package/dist/server/auth/infrastructure/persistence/mappers/auth-user.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/auth-user.mapper.js +75 -0
- package/dist/server/auth/infrastructure/persistence/mappers/auth-user.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/email-verification-token.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/email-verification-token.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/email-verification-token.mapper.js +46 -0
- package/dist/server/auth/infrastructure/persistence/mappers/email-verification-token.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/index.d.ts +17 -0
- package/dist/server/auth/infrastructure/persistence/mappers/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/index.js +33 -0
- package/dist/server/auth/infrastructure/persistence/mappers/index.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/login-history.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/login-history.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/login-history.mapper.js +54 -0
- package/dist/server/auth/infrastructure/persistence/mappers/login-history.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-audit-log.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-audit-log.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-audit-log.mapper.js +52 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-audit-log.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-authorization-code.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-authorization-code.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-authorization-code.mapper.js +56 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-authorization-code.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client-consent.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client-consent.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client-consent.mapper.js +46 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client-consent.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client.mapper.js +74 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-client.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-scope.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-scope.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-scope.mapper.js +44 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-scope.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-token.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-token.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-token.mapper.js +56 -0
- package/dist/server/auth/infrastructure/persistence/mappers/oauth-token.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/permission.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/permission.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/permission.mapper.js +46 -0
- package/dist/server/auth/infrastructure/persistence/mappers/permission.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role-permission.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role-permission.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role-permission.mapper.js +42 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role-permission.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role.mapper.js +46 -0
- package/dist/server/auth/infrastructure/persistence/mappers/role.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/social-account.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/social-account.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/social-account.mapper.js +58 -0
- package/dist/server/auth/infrastructure/persistence/mappers/social-account.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-role.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-role.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-role.mapper.js +42 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-role.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-session.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-session.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-session.mapper.js +62 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-session.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-two-factor.mapper.d.ts +8 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-two-factor.mapper.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-two-factor.mapper.js +56 -0
- package/dist/server/auth/infrastructure/persistence/mappers/user-two-factor.mapper.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/auth-user.repository.d.ts +20 -0
- package/dist/server/auth/infrastructure/persistence/repositories/auth-user.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/auth-user.repository.js +74 -0
- package/dist/server/auth/infrastructure/persistence/repositories/auth-user.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/email-verification-token.repository.d.ts +19 -0
- package/dist/server/auth/infrastructure/persistence/repositories/email-verification-token.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/email-verification-token.repository.js +67 -0
- package/dist/server/auth/infrastructure/persistence/repositories/email-verification-token.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/index.d.ts +17 -0
- package/dist/server/auth/infrastructure/persistence/repositories/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/index.js +33 -0
- package/dist/server/auth/infrastructure/persistence/repositories/index.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/login-history.repository.d.ts +17 -0
- package/dist/server/auth/infrastructure/persistence/repositories/login-history.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/login-history.repository.js +70 -0
- package/dist/server/auth/infrastructure/persistence/repositories/login-history.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-audit-log.repository.d.ts +18 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-audit-log.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-audit-log.repository.js +77 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-audit-log.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-authorization-code.repository.d.ts +18 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-authorization-code.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-authorization-code.repository.js +64 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-authorization-code.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client-consent.repository.d.ts +18 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client-consent.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client-consent.repository.js +66 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client-consent.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client.repository.d.ts +18 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client.repository.js +65 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-client.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-scope.repository.d.ts +19 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-scope.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-scope.repository.js +69 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-scope.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-token.repository.d.ts +22 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-token.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-token.repository.js +93 -0
- package/dist/server/auth/infrastructure/persistence/repositories/oauth-token.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/permission.repository.d.ts +20 -0
- package/dist/server/auth/infrastructure/persistence/repositories/permission.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/permission.repository.js +75 -0
- package/dist/server/auth/infrastructure/persistence/repositories/permission.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role-permission.repository.d.ts +20 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role-permission.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role-permission.repository.js +79 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role-permission.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role.repository.d.ts +19 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role.repository.js +69 -0
- package/dist/server/auth/infrastructure/persistence/repositories/role.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/social-account.repository.d.ts +20 -0
- package/dist/server/auth/infrastructure/persistence/repositories/social-account.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/social-account.repository.js +72 -0
- package/dist/server/auth/infrastructure/persistence/repositories/social-account.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-role.repository.d.ts +19 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-role.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-role.repository.js +66 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-role.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-session.repository.d.ts +20 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-session.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-session.repository.js +85 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-session.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-two-factor.repository.d.ts +17 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-two-factor.repository.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-two-factor.repository.js +60 -0
- package/dist/server/auth/infrastructure/persistence/repositories/user-two-factor.repository.js.map +1 -0
- package/dist/server/auth/infrastructure/schedulers/cleanup.scheduler.d.ts +17 -0
- package/dist/server/auth/infrastructure/schedulers/cleanup.scheduler.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/schedulers/cleanup.scheduler.js +105 -0
- package/dist/server/auth/infrastructure/schedulers/cleanup.scheduler.js.map +1 -0
- package/dist/server/auth/infrastructure/schedulers/index.d.ts +2 -0
- package/dist/server/auth/infrastructure/schedulers/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/schedulers/index.js +18 -0
- package/dist/server/auth/infrastructure/schedulers/index.js.map +1 -0
- package/dist/server/auth/infrastructure/services/authorization-code.service.d.ts +22 -0
- package/dist/server/auth/infrastructure/services/authorization-code.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/authorization-code.service.js +176 -0
- package/dist/server/auth/infrastructure/services/authorization-code.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/bcrypt-hash.service.d.ts +8 -0
- package/dist/server/auth/infrastructure/services/bcrypt-hash.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/bcrypt-hash.service.js +61 -0
- package/dist/server/auth/infrastructure/services/bcrypt-hash.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/consent.service.d.ts +19 -0
- package/dist/server/auth/infrastructure/services/consent.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/consent.service.js +121 -0
- package/dist/server/auth/infrastructure/services/consent.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/email-verification.service.d.ts +11 -0
- package/dist/server/auth/infrastructure/services/email-verification.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/email-verification.service.js +52 -0
- package/dist/server/auth/infrastructure/services/email-verification.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/google-auth.service.d.ts +11 -0
- package/dist/server/auth/infrastructure/services/google-auth.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/google-auth.service.js +68 -0
- package/dist/server/auth/infrastructure/services/google-auth.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/index.d.ts +11 -0
- package/dist/server/auth/infrastructure/services/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/index.js +27 -0
- package/dist/server/auth/infrastructure/services/index.js.map +1 -0
- package/dist/server/auth/infrastructure/services/jwt-token.service.d.ts +41 -0
- package/dist/server/auth/infrastructure/services/jwt-token.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/jwt-token.service.js +112 -0
- package/dist/server/auth/infrastructure/services/jwt-token.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/nodemailer-email.service.d.ts +17 -0
- package/dist/server/auth/infrastructure/services/nodemailer-email.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/nodemailer-email.service.js +125 -0
- package/dist/server/auth/infrastructure/services/nodemailer-email.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/oauth-token.service.d.ts +27 -0
- package/dist/server/auth/infrastructure/services/oauth-token.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/oauth-token.service.js +215 -0
- package/dist/server/auth/infrastructure/services/oauth-token.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/root-account.service.d.ts +19 -0
- package/dist/server/auth/infrastructure/services/root-account.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/root-account.service.js +91 -0
- package/dist/server/auth/infrastructure/services/root-account.service.js.map +1 -0
- package/dist/server/auth/infrastructure/services/session.service.d.ts +11 -0
- package/dist/server/auth/infrastructure/services/session.service.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/services/session.service.js +49 -0
- package/dist/server/auth/infrastructure/services/session.service.js.map +1 -0
- package/dist/server/auth/infrastructure/strategies/facebook.strategy.d.ts +16 -0
- package/dist/server/auth/infrastructure/strategies/facebook.strategy.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/strategies/facebook.strategy.js +100 -0
- package/dist/server/auth/infrastructure/strategies/facebook.strategy.js.map +1 -0
- package/dist/server/auth/infrastructure/strategies/github.strategy.d.ts +16 -0
- package/dist/server/auth/infrastructure/strategies/github.strategy.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/strategies/github.strategy.js +99 -0
- package/dist/server/auth/infrastructure/strategies/github.strategy.js.map +1 -0
- package/dist/server/auth/infrastructure/strategies/google.strategy.d.ts +16 -0
- package/dist/server/auth/infrastructure/strategies/google.strategy.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/strategies/google.strategy.js +99 -0
- package/dist/server/auth/infrastructure/strategies/google.strategy.js.map +1 -0
- package/dist/server/auth/infrastructure/strategies/index.d.ts +2 -0
- package/dist/server/auth/infrastructure/strategies/index.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/strategies/index.js +18 -0
- package/dist/server/auth/infrastructure/strategies/index.js.map +1 -0
- package/dist/server/auth/infrastructure/strategies/jwt.strategy.d.ts +20 -0
- package/dist/server/auth/infrastructure/strategies/jwt.strategy.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/strategies/jwt.strategy.js +68 -0
- package/dist/server/auth/infrastructure/strategies/jwt.strategy.js.map +1 -0
- package/dist/server/auth/infrastructure/strategies/local.strategy.d.ts +13 -0
- package/dist/server/auth/infrastructure/strategies/local.strategy.d.ts.map +1 -0
- package/dist/server/auth/infrastructure/strategies/local.strategy.js +83 -0
- package/dist/server/auth/infrastructure/strategies/local.strategy.js.map +1 -0
- package/dist/server/auth/oauth.module.d.ts +3 -0
- package/dist/server/auth/oauth.module.d.ts.map +1 -0
- package/dist/server/auth/oauth.module.js +235 -0
- package/dist/server/auth/oauth.module.js.map +1 -0
- package/dist/server/auth/presentation/controllers/auth.controller.d.ts +72 -0
- package/dist/server/auth/presentation/controllers/auth.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/auth.controller.js +280 -0
- package/dist/server/auth/presentation/controllers/auth.controller.js.map +1 -0
- package/dist/server/auth/presentation/controllers/email.controller.d.ts +17 -0
- package/dist/server/auth/presentation/controllers/email.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/email.controller.js +75 -0
- package/dist/server/auth/presentation/controllers/email.controller.js.map +1 -0
- package/dist/server/auth/presentation/controllers/index.d.ts +9 -0
- package/dist/server/auth/presentation/controllers/index.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/index.js +25 -0
- package/dist/server/auth/presentation/controllers/index.js.map +1 -0
- package/dist/server/auth/presentation/controllers/password.controller.d.ts +19 -0
- package/dist/server/auth/presentation/controllers/password.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/password.controller.js +75 -0
- package/dist/server/auth/presentation/controllers/password.controller.js.map +1 -0
- package/dist/server/auth/presentation/controllers/permission.controller.d.ts +11 -0
- package/dist/server/auth/presentation/controllers/permission.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/permission.controller.js +43 -0
- package/dist/server/auth/presentation/controllers/permission.controller.js.map +1 -0
- package/dist/server/auth/presentation/controllers/role.controller.d.ts +32 -0
- package/dist/server/auth/presentation/controllers/role.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/role.controller.js +97 -0
- package/dist/server/auth/presentation/controllers/role.controller.js.map +1 -0
- package/dist/server/auth/presentation/controllers/session.controller.d.ts +23 -0
- package/dist/server/auth/presentation/controllers/session.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/session.controller.js +92 -0
- package/dist/server/auth/presentation/controllers/session.controller.js.map +1 -0
- package/dist/server/auth/presentation/controllers/social-auth.controller.d.ts +12 -0
- package/dist/server/auth/presentation/controllers/social-auth.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/social-auth.controller.js +58 -0
- package/dist/server/auth/presentation/controllers/social-auth.controller.js.map +1 -0
- package/dist/server/auth/presentation/controllers/two-factor.controller.d.ts +23 -0
- package/dist/server/auth/presentation/controllers/two-factor.controller.d.ts.map +1 -0
- package/dist/server/auth/presentation/controllers/two-factor.controller.js +94 -0
- package/dist/server/auth/presentation/controllers/two-factor.controller.js.map +1 -0
- package/dist/server/auth/presentation/decorators/auth.decorator.d.ts +7 -0
- package/dist/server/auth/presentation/decorators/auth.decorator.d.ts.map +1 -0
- package/dist/server/auth/presentation/decorators/auth.decorator.js +14 -0
- package/dist/server/auth/presentation/decorators/auth.decorator.js.map +1 -0
- package/dist/server/auth/presentation/decorators/current-session-id.decorator.d.ts +2 -0
- package/dist/server/auth/presentation/decorators/current-session-id.decorator.d.ts.map +1 -0
- package/dist/server/auth/presentation/decorators/current-session-id.decorator.js +9 -0
- package/dist/server/auth/presentation/decorators/current-session-id.decorator.js.map +1 -0
- package/dist/server/auth/presentation/decorators/index.d.ts +4 -0
- package/dist/server/auth/presentation/decorators/index.d.ts.map +1 -0
- package/dist/server/auth/presentation/decorators/index.js +20 -0
- package/dist/server/auth/presentation/decorators/index.js.map +1 -0
- package/dist/server/auth/presentation/decorators/require-permissions.decorator.d.ts +3 -0
- package/dist/server/auth/presentation/decorators/require-permissions.decorator.d.ts.map +1 -0
- package/dist/server/auth/presentation/decorators/require-permissions.decorator.js +8 -0
- package/dist/server/auth/presentation/decorators/require-permissions.decorator.js.map +1 -0
- package/dist/server/auth/presentation/decorators/user.decorator.d.ts +7 -0
- package/dist/server/auth/presentation/decorators/user.decorator.d.ts.map +1 -0
- package/dist/server/auth/presentation/decorators/user.decorator.js +29 -0
- package/dist/server/auth/presentation/decorators/user.decorator.js.map +1 -0
- package/dist/server/auth/presentation/filters/global-exception.filter.d.ts +5 -0
- package/dist/server/auth/presentation/filters/global-exception.filter.d.ts.map +1 -0
- package/dist/server/auth/presentation/filters/global-exception.filter.js +44 -0
- package/dist/server/auth/presentation/filters/global-exception.filter.js.map +1 -0
- package/dist/server/auth/presentation/filters/index.d.ts +2 -0
- package/dist/server/auth/presentation/filters/index.d.ts.map +1 -0
- package/dist/server/auth/presentation/filters/index.js +18 -0
- package/dist/server/auth/presentation/filters/index.js.map +1 -0
- package/dist/server/auth/presentation/guards/index.d.ts +3 -0
- package/dist/server/auth/presentation/guards/index.d.ts.map +1 -0
- package/dist/server/auth/presentation/guards/index.js +19 -0
- package/dist/server/auth/presentation/guards/index.js.map +1 -0
- package/dist/server/auth/presentation/guards/jwt-auth.guard.d.ts +11 -0
- package/dist/server/auth/presentation/guards/jwt-auth.guard.d.ts.map +1 -0
- package/dist/server/auth/presentation/guards/jwt-auth.guard.js +45 -0
- package/dist/server/auth/presentation/guards/jwt-auth.guard.js.map +1 -0
- package/dist/server/auth/presentation/guards/permission.guard.d.ts +17 -0
- package/dist/server/auth/presentation/guards/permission.guard.d.ts.map +1 -0
- package/dist/server/auth/presentation/guards/permission.guard.js +87 -0
- package/dist/server/auth/presentation/guards/permission.guard.js.map +1 -0
- package/dist/server/auth/presentation/index.d.ts +4 -0
- package/dist/server/auth/presentation/index.d.ts.map +1 -0
- package/dist/server/auth/presentation/index.js +20 -0
- package/dist/server/auth/presentation/index.js.map +1 -0
- package/dist/server/auth/presentation/responses/oauth.response.d.ts +26 -0
- package/dist/server/auth/presentation/responses/oauth.response.d.ts.map +1 -0
- package/dist/server/auth/presentation/responses/oauth.response.js +33 -0
- package/dist/server/auth/presentation/responses/oauth.response.js.map +1 -0
- package/dist/server/auth/presentation/validators/index.d.ts +2 -0
- package/dist/server/auth/presentation/validators/index.d.ts.map +1 -0
- package/dist/server/auth/presentation/validators/index.js +18 -0
- package/dist/server/auth/presentation/validators/index.js.map +1 -0
- package/dist/server/auth/presentation/validators/is-username-unique.validator.d.ts +10 -0
- package/dist/server/auth/presentation/validators/is-username-unique.validator.d.ts.map +1 -0
- package/dist/server/auth/presentation/validators/is-username-unique.validator.js +54 -0
- package/dist/server/auth/presentation/validators/is-username-unique.validator.js.map +1 -0
- package/dist/server/auth/presentation/validators/password.validator.d.ts +4 -0
- package/dist/server/auth/presentation/validators/password.validator.d.ts.map +1 -0
- package/dist/server/auth/presentation/validators/password.validator.js +56 -0
- package/dist/server/auth/presentation/validators/password.validator.js.map +1 -0
- package/dist/server/common/events/mail/index.d.ts +7 -0
- package/dist/server/common/events/mail/index.d.ts.map +1 -0
- package/dist/server/common/events/mail/index.js +16 -0
- package/dist/server/common/events/mail/index.js.map +1 -0
- package/dist/server/common/events/mail/mail-events.constants.d.ts +9 -0
- package/dist/server/common/events/mail/mail-events.constants.d.ts.map +1 -0
- package/dist/server/common/events/mail/mail-events.constants.js +11 -0
- package/dist/server/common/events/mail/mail-events.constants.js.map +1 -0
- package/dist/server/common/events/mail/send-password-changed.event.d.ts +7 -0
- package/dist/server/common/events/mail/send-password-changed.event.d.ts.map +1 -0
- package/dist/server/common/events/mail/send-password-changed.event.js +15 -0
- package/dist/server/common/events/mail/send-password-changed.event.js.map +1 -0
- package/dist/server/common/events/mail/send-password-reset.event.d.ts +7 -0
- package/dist/server/common/events/mail/send-password-reset.event.d.ts.map +1 -0
- package/dist/server/common/events/mail/send-password-reset.event.js +15 -0
- package/dist/server/common/events/mail/send-password-reset.event.js.map +1 -0
- package/dist/server/common/events/mail/send-user-welcome.event.d.ts +7 -0
- package/dist/server/common/events/mail/send-user-welcome.event.d.ts.map +1 -0
- package/dist/server/common/events/mail/send-user-welcome.event.js +15 -0
- package/dist/server/common/events/mail/send-user-welcome.event.js.map +1 -0
- package/dist/server/common/events/mail/send-verification-email.event.d.ts +7 -0
- package/dist/server/common/events/mail/send-verification-email.event.d.ts.map +1 -0
- package/dist/server/common/events/mail/send-verification-email.event.js +15 -0
- package/dist/server/common/events/mail/send-verification-email.event.js.map +1 -0
- package/dist/server/common/events/mail/send-welcome-email.event.d.ts +6 -0
- package/dist/server/common/events/mail/send-welcome-email.event.d.ts.map +1 -0
- package/dist/server/common/events/mail/send-welcome-email.event.js +13 -0
- package/dist/server/common/events/mail/send-welcome-email.event.js.map +1 -0
- package/dist/server/index.d.ts +40 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +139 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/lib/responder.d.ts +33 -0
- package/dist/server/lib/responder.d.ts.map +1 -0
- package/dist/server/lib/responder.js +75 -0
- package/dist/server/lib/responder.js.map +1 -0
- package/dist/server/shared/index.d.ts +3 -0
- package/dist/server/shared/index.d.ts.map +1 -0
- package/dist/server/shared/index.js +12 -0
- package/dist/server/shared/index.js.map +1 -0
- package/dist/server/shared/permissions.d.ts +78 -0
- package/dist/server/shared/permissions.d.ts.map +1 -0
- package/dist/server/shared/permissions.js +74 -0
- package/dist/server/shared/permissions.js.map +1 -0
- package/dist/server/shared/roles.d.ts +30 -0
- package/dist/server/shared/roles.d.ts.map +1 -0
- package/dist/server/shared/roles.js +31 -0
- package/dist/server/shared/roles.js.map +1 -0
- package/dist/server/user/application/dto/admin-user.dto.d.ts +51 -0
- package/dist/server/user/application/dto/admin-user.dto.d.ts.map +1 -0
- package/dist/server/user/application/dto/admin-user.dto.js +225 -0
- package/dist/server/user/application/dto/admin-user.dto.js.map +1 -0
- package/dist/server/user/application/dto/user-preferences.dto.d.ts +36 -0
- package/dist/server/user/application/dto/user-preferences.dto.d.ts.map +1 -0
- package/dist/server/user/application/dto/user-preferences.dto.js +76 -0
- package/dist/server/user/application/dto/user-preferences.dto.js.map +1 -0
- package/dist/server/user/application/listeners/auth-user-event.listener.d.ts +11 -0
- package/dist/server/user/application/listeners/auth-user-event.listener.d.ts.map +1 -0
- package/dist/server/user/application/listeners/auth-user-event.listener.js +114 -0
- package/dist/server/user/application/listeners/auth-user-event.listener.js.map +1 -0
- package/dist/server/user/application/repositories/user-setting.repository.d.ts +13 -0
- package/dist/server/user/application/repositories/user-setting.repository.d.ts.map +1 -0
- package/dist/server/user/application/repositories/user-setting.repository.js +84 -0
- package/dist/server/user/application/repositories/user-setting.repository.js.map +1 -0
- package/dist/server/user/application/services/user-preferences.service.d.ts +12 -0
- package/dist/server/user/application/services/user-preferences.service.d.ts.map +1 -0
- package/dist/server/user/application/services/user-preferences.service.js +65 -0
- package/dist/server/user/application/services/user-preferences.service.js.map +1 -0
- package/dist/server/user/application/services/user.service.d.ts +56 -0
- package/dist/server/user/application/services/user.service.d.ts.map +1 -0
- package/dist/server/user/application/services/user.service.js +213 -0
- package/dist/server/user/application/services/user.service.js.map +1 -0
- package/dist/server/user/domain/constants/user-events.const.d.ts +9 -0
- package/dist/server/user/domain/constants/user-events.const.d.ts.map +1 -0
- package/dist/server/user/domain/constants/user-events.const.js +11 -0
- package/dist/server/user/domain/constants/user-events.const.js.map +1 -0
- package/dist/server/user/domain/entities/user.entity.d.ts +37 -0
- package/dist/server/user/domain/entities/user.entity.d.ts.map +1 -0
- package/dist/server/user/domain/entities/user.entity.js +71 -0
- package/dist/server/user/domain/entities/user.entity.js.map +1 -0
- package/dist/server/user/domain/repositories/user.repository.d.ts +26 -0
- package/dist/server/user/domain/repositories/user.repository.d.ts.map +1 -0
- package/dist/server/user/domain/repositories/user.repository.js +3 -0
- package/dist/server/user/domain/repositories/user.repository.js.map +1 -0
- package/dist/server/user/infrastructure/persistence/entities/user-setting.entity.d.ts +29 -0
- package/dist/server/user/infrastructure/persistence/entities/user-setting.entity.d.ts.map +1 -0
- package/dist/server/user/infrastructure/persistence/entities/user-setting.entity.js +82 -0
- package/dist/server/user/infrastructure/persistence/entities/user-setting.entity.js.map +1 -0
- package/dist/server/user/infrastructure/persistence/entities/user.entity.d.ts +19 -0
- package/dist/server/user/infrastructure/persistence/entities/user.entity.d.ts.map +1 -0
- package/dist/server/user/infrastructure/persistence/entities/user.entity.js +100 -0
- package/dist/server/user/infrastructure/persistence/entities/user.entity.js.map +1 -0
- package/dist/server/user/infrastructure/persistence/mappers/user.mapper.d.ts +8 -0
- package/dist/server/user/infrastructure/persistence/mappers/user.mapper.d.ts.map +1 -0
- package/dist/server/user/infrastructure/persistence/mappers/user.mapper.js +59 -0
- package/dist/server/user/infrastructure/persistence/mappers/user.mapper.js.map +1 -0
- package/dist/server/user/infrastructure/persistence/repositories/user.repository.impl.d.ts +31 -0
- package/dist/server/user/infrastructure/persistence/repositories/user.repository.impl.d.ts.map +1 -0
- package/dist/server/user/infrastructure/persistence/repositories/user.repository.impl.js +123 -0
- package/dist/server/user/infrastructure/persistence/repositories/user.repository.impl.js.map +1 -0
- package/dist/server/user/presentation/controllers/admin-user.controller.d.ts +77 -0
- package/dist/server/user/presentation/controllers/admin-user.controller.d.ts.map +1 -0
- package/dist/server/user/presentation/controllers/admin-user.controller.js +358 -0
- package/dist/server/user/presentation/controllers/admin-user.controller.js.map +1 -0
- package/dist/server/user/user.module.d.ts +3 -0
- package/dist/server/user/user.module.d.ts.map +1 -0
- package/dist/server/user/user.module.js +46 -0
- package/dist/server/user/user.module.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RefreshTokenAction = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const domain_1 = require("../../../domain");
|
|
18
|
+
const token_response_1 = require("../../dto/token-response");
|
|
19
|
+
const token_service_1 = require("../../ports/token.service");
|
|
20
|
+
const enums_1 = require("../../../domain/enums");
|
|
21
|
+
const oauth_token_1 = require("../../../domain/entities/oauth-token");
|
|
22
|
+
let RefreshTokenAction = class RefreshTokenAction {
|
|
23
|
+
authUserRepository;
|
|
24
|
+
sessionRepository;
|
|
25
|
+
oauthTokenRepository;
|
|
26
|
+
oauthClientRepository;
|
|
27
|
+
tokenService;
|
|
28
|
+
constructor(authUserRepository, sessionRepository, oauthTokenRepository, oauthClientRepository, tokenService) {
|
|
29
|
+
this.authUserRepository = authUserRepository;
|
|
30
|
+
this.sessionRepository = sessionRepository;
|
|
31
|
+
this.oauthTokenRepository = oauthTokenRepository;
|
|
32
|
+
this.oauthClientRepository = oauthClientRepository;
|
|
33
|
+
this.tokenService = tokenService;
|
|
34
|
+
}
|
|
35
|
+
async handle(dto) {
|
|
36
|
+
const payload = this.verifyAndValidateToken(dto.refreshToken);
|
|
37
|
+
const tokenRecord = await this.getTokenRecord(dto.refreshToken);
|
|
38
|
+
await this.checkTokenReuseAttack(tokenRecord, payload);
|
|
39
|
+
const session = await this.validateAndUpdateSession(payload.sessionId);
|
|
40
|
+
const { user, client } = await this.validateUserAndClient(payload.userId, tokenRecord.clientId);
|
|
41
|
+
await this.revokeOldToken(tokenRecord);
|
|
42
|
+
const { accessToken, refreshToken } = await this.createNewTokens(user, session, client, tokenRecord.id);
|
|
43
|
+
return new token_response_1.TokenResponse({
|
|
44
|
+
accessToken,
|
|
45
|
+
refreshToken,
|
|
46
|
+
expiresIn: client.accessTokenLifetime,
|
|
47
|
+
tokenType: 'Bearer',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
verifyAndValidateToken(refreshToken) {
|
|
51
|
+
const payload = this.tokenService.verifyRefreshToken(refreshToken);
|
|
52
|
+
if (!payload || !payload.userId || !payload.sessionId) {
|
|
53
|
+
throw new common_1.UnauthorizedException('Refresh token không hợp lệ');
|
|
54
|
+
}
|
|
55
|
+
return payload;
|
|
56
|
+
}
|
|
57
|
+
async getTokenRecord(refreshToken) {
|
|
58
|
+
const tokenRecord = await this.oauthTokenRepository.findByRefreshToken(refreshToken);
|
|
59
|
+
if (!tokenRecord) {
|
|
60
|
+
throw new common_1.UnauthorizedException('Refresh token không tồn tại');
|
|
61
|
+
}
|
|
62
|
+
if (tokenRecord.isExpired()) {
|
|
63
|
+
throw new common_1.UnauthorizedException('Refresh token đã hết hạn');
|
|
64
|
+
}
|
|
65
|
+
return tokenRecord;
|
|
66
|
+
}
|
|
67
|
+
async checkTokenReuseAttack(tokenRecord, payload) {
|
|
68
|
+
if (tokenRecord.revokedAt) {
|
|
69
|
+
await this.revokeAllSessionTokens(payload.userId, payload.sessionId);
|
|
70
|
+
throw new common_1.UnauthorizedException('Token reuse detected! All tokens have been revoked for security.');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async revokeAllSessionTokens(userId, sessionId) {
|
|
74
|
+
const session = await this.sessionRepository.findById(sessionId);
|
|
75
|
+
if (session) {
|
|
76
|
+
session.revoke();
|
|
77
|
+
await this.sessionRepository.save(session);
|
|
78
|
+
}
|
|
79
|
+
const allTokens = await this.oauthTokenRepository.findActiveByUserId(userId);
|
|
80
|
+
for (const token of allTokens) {
|
|
81
|
+
if (token.sessionId === sessionId) {
|
|
82
|
+
token.revoke();
|
|
83
|
+
await this.oauthTokenRepository.save(token);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async validateAndUpdateSession(sessionId) {
|
|
88
|
+
const session = await this.sessionRepository.findById(sessionId);
|
|
89
|
+
if (!session) {
|
|
90
|
+
throw new common_1.UnauthorizedException('Session không tồn tại');
|
|
91
|
+
}
|
|
92
|
+
if (!session.isActive()) {
|
|
93
|
+
throw new common_1.UnauthorizedException('Session đã hết hạn hoặc bị thu hồi');
|
|
94
|
+
}
|
|
95
|
+
session.updateLastActiveAt();
|
|
96
|
+
await this.sessionRepository.save(session);
|
|
97
|
+
return session;
|
|
98
|
+
}
|
|
99
|
+
async validateUserAndClient(userId, clientId) {
|
|
100
|
+
const user = await this.authUserRepository.findById(userId);
|
|
101
|
+
if (!user) {
|
|
102
|
+
throw new common_1.UnauthorizedException('User không tồn tại');
|
|
103
|
+
}
|
|
104
|
+
const client = await this.oauthClientRepository.findById(clientId);
|
|
105
|
+
if (!client || !client.canBeUsed()) {
|
|
106
|
+
throw new common_1.UnauthorizedException('Invalid client');
|
|
107
|
+
}
|
|
108
|
+
return { user, client };
|
|
109
|
+
}
|
|
110
|
+
async revokeOldToken(tokenRecord) {
|
|
111
|
+
tokenRecord.revoke();
|
|
112
|
+
await this.oauthTokenRepository.save(tokenRecord);
|
|
113
|
+
}
|
|
114
|
+
async createNewTokens(user, session, client, parentRefreshTokenId) {
|
|
115
|
+
const accessToken = this.tokenService.generateAccessToken({
|
|
116
|
+
userId: user.id,
|
|
117
|
+
email: user.email,
|
|
118
|
+
});
|
|
119
|
+
const refreshToken = this.tokenService.generateRefreshToken({
|
|
120
|
+
userId: user.id,
|
|
121
|
+
sessionId: session.id,
|
|
122
|
+
});
|
|
123
|
+
await this.saveAccessToken(accessToken, user, session, client);
|
|
124
|
+
await this.saveRefreshToken(refreshToken, user, session, client, parentRefreshTokenId);
|
|
125
|
+
return { accessToken, refreshToken };
|
|
126
|
+
}
|
|
127
|
+
async saveAccessToken(accessToken, user, session, client) {
|
|
128
|
+
const accessTokenExpiresAt = new Date();
|
|
129
|
+
accessTokenExpiresAt.setSeconds(accessTokenExpiresAt.getSeconds() + client.accessTokenLifetime);
|
|
130
|
+
await this.oauthTokenRepository.create(new oauth_token_1.OAuthToken({
|
|
131
|
+
tokenType: enums_1.OAuthTokenType.ACCESS_TOKEN,
|
|
132
|
+
token: accessToken,
|
|
133
|
+
clientId: client.id,
|
|
134
|
+
userId: user.id,
|
|
135
|
+
sessionId: session.id,
|
|
136
|
+
scopes: [],
|
|
137
|
+
expiresAt: accessTokenExpiresAt,
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
async saveRefreshToken(refreshToken, user, session, client, parentRefreshTokenId) {
|
|
141
|
+
const refreshTokenExpiresAt = new Date();
|
|
142
|
+
refreshTokenExpiresAt.setSeconds(refreshTokenExpiresAt.getSeconds() + client.refreshTokenLifetime);
|
|
143
|
+
await this.oauthTokenRepository.create(new oauth_token_1.OAuthToken({
|
|
144
|
+
tokenType: enums_1.OAuthTokenType.REFRESH_TOKEN,
|
|
145
|
+
token: refreshToken,
|
|
146
|
+
clientId: client.id,
|
|
147
|
+
userId: user.id,
|
|
148
|
+
sessionId: session.id,
|
|
149
|
+
scopes: [],
|
|
150
|
+
expiresAt: refreshTokenExpiresAt,
|
|
151
|
+
parentRefreshTokenId,
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
exports.RefreshTokenAction = RefreshTokenAction;
|
|
156
|
+
exports.RefreshTokenAction = RefreshTokenAction = __decorate([
|
|
157
|
+
(0, common_1.Injectable)(),
|
|
158
|
+
__param(0, (0, common_1.Inject)(domain_1.AUTH_USER_REPOSITORY_TOKEN)),
|
|
159
|
+
__param(1, (0, common_1.Inject)(domain_1.USER_SESSION_REPOSITORY_TOKEN)),
|
|
160
|
+
__param(2, (0, common_1.Inject)(domain_1.OAUTH_TOKEN_REPOSITORY_TOKEN)),
|
|
161
|
+
__param(3, (0, common_1.Inject)(domain_1.OAUTH_CLIENT_REPOSITORY_TOKEN)),
|
|
162
|
+
__param(4, (0, common_1.Inject)(token_service_1.TOKEN_SERVICE_TOKEN)),
|
|
163
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object, Object])
|
|
164
|
+
], RefreshTokenAction);
|
|
165
|
+
//# sourceMappingURL=refresh-token.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-token.action.js","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/refresh-token.action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2E;AAE3E,4CASyB;AAEzB,6DAAyD;AACzD,6DAGmC;AACnC,iDAAuD;AACvD,sEAAkE;AAG3D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAGV;IAEA;IAEA;IAEA;IAEA;IAVnB,YAEmB,kBAAsC,EAEtC,iBAAwC,EAExC,oBAA0C,EAE1C,qBAA4C,EAE5C,YAA0B;QAR1B,uBAAkB,GAAlB,kBAAkB,CAAoB;QAEtC,sBAAiB,GAAjB,iBAAiB,CAAuB;QAExC,yBAAoB,GAApB,oBAAoB,CAAsB;QAE1C,0BAAqB,GAArB,qBAAqB,CAAuB;QAE5C,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,GAAoB;QAE/B,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAG9D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAGhE,MAAM,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAGvD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAGvE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,qBAAqB,CACvD,OAAO,CAAC,MAAM,EACd,WAAW,CAAC,QAAQ,CACrB,CAAC;QAGF,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAGvC,MAAM,EAAE,WAAW,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AAC,CAAA;IAErC,WAAA,IAAA,eAAM,EAAC,qCAA4B,CAAC,CAAA;IAEpC,WAAA,IAAA,eAAM,EAAC,sCAA6B,CAAC,CAAA;IAErC,WAAA,IAAA,eAAM,EAAC,mCAAmB,CAAC,CAAA;;GAVnB,kBAAkB,CAsO9B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
2
|
+
import { AuthUser } from '../../../domain/entities/auth-user';
|
|
3
|
+
import { AuthUserRepository, EmailVerificationTokenRepository } from '../../../domain/repositories';
|
|
4
|
+
import { RegisterDto } from '../../dto/register.dto';
|
|
5
|
+
import { HashService, TokenService } from '../../ports';
|
|
6
|
+
export declare class RegisterAction {
|
|
7
|
+
private readonly authUserRepository;
|
|
8
|
+
private readonly emailTokenRepository;
|
|
9
|
+
private readonly hashService;
|
|
10
|
+
private readonly tokenService;
|
|
11
|
+
private readonly eventEmitter;
|
|
12
|
+
constructor(authUserRepository: AuthUserRepository, emailTokenRepository: EmailVerificationTokenRepository, hashService: HashService, tokenService: TokenService, eventEmitter: EventEmitter2);
|
|
13
|
+
handle(dto: RegisterDto): Promise<AuthUser>;
|
|
14
|
+
private sendVerificationEmail;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=register.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.action.d.ts","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/register.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAGL,kBAAkB,EAClB,gCAAgC,EACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAEL,WAAW,EAEX,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,qBACa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAErC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAE5B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAPZ,kBAAkB,EAAE,kBAAkB,EAEtC,oBAAoB,EAAE,gCAAgC,EAEtD,WAAW,EAAE,WAAW,EAExB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,aAAa;IAMxC,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;YAiCnC,qBAAqB;CAuBpC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RegisterAction = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
18
|
+
const auth_user_1 = require("../../../domain/entities/auth-user");
|
|
19
|
+
const repositories_1 = require("../../../domain/repositories");
|
|
20
|
+
const ports_1 = require("../../ports");
|
|
21
|
+
const enums_1 = require("../../../domain/enums");
|
|
22
|
+
const mail_1 = require("../../../../common/events/mail");
|
|
23
|
+
let RegisterAction = class RegisterAction {
|
|
24
|
+
authUserRepository;
|
|
25
|
+
emailTokenRepository;
|
|
26
|
+
hashService;
|
|
27
|
+
tokenService;
|
|
28
|
+
eventEmitter;
|
|
29
|
+
constructor(authUserRepository, emailTokenRepository, hashService, tokenService, eventEmitter) {
|
|
30
|
+
this.authUserRepository = authUserRepository;
|
|
31
|
+
this.emailTokenRepository = emailTokenRepository;
|
|
32
|
+
this.hashService = hashService;
|
|
33
|
+
this.tokenService = tokenService;
|
|
34
|
+
this.eventEmitter = eventEmitter;
|
|
35
|
+
}
|
|
36
|
+
async handle(dto) {
|
|
37
|
+
const existingUser = await this.authUserRepository.findByEmail(dto.email);
|
|
38
|
+
if (existingUser) {
|
|
39
|
+
throw new common_1.ConflictException('Email đã được sử dụng');
|
|
40
|
+
}
|
|
41
|
+
if (dto.username) {
|
|
42
|
+
const existingUsername = await this.authUserRepository.findByUsername(dto.username);
|
|
43
|
+
if (existingUsername) {
|
|
44
|
+
throw new common_1.ConflictException('Username đã được sử dụng');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const passwordHash = await this.hashService.hash(dto.password);
|
|
48
|
+
const user = new auth_user_1.AuthUser({
|
|
49
|
+
email: dto.email,
|
|
50
|
+
username: dto.username,
|
|
51
|
+
displayName: dto.displayName || dto.username || dto.email.split('@')[0],
|
|
52
|
+
passwordHash,
|
|
53
|
+
status: enums_1.AuthUserStatus.PENDING_VERIFICATION,
|
|
54
|
+
failedLoginAttempts: 0,
|
|
55
|
+
twoFactorEnabled: false,
|
|
56
|
+
passwordChangedAt: new Date(),
|
|
57
|
+
});
|
|
58
|
+
const savedUser = await this.authUserRepository.create(user);
|
|
59
|
+
await this.sendVerificationEmail(savedUser);
|
|
60
|
+
return savedUser;
|
|
61
|
+
}
|
|
62
|
+
async sendVerificationEmail(user) {
|
|
63
|
+
const verificationToken = this.tokenService.generateEmailVerificationToken(user.id);
|
|
64
|
+
const tokenExpiry = new Date();
|
|
65
|
+
tokenExpiry.setHours(tokenExpiry.getHours() + 24);
|
|
66
|
+
await this.emailTokenRepository.create({
|
|
67
|
+
userId: user.id,
|
|
68
|
+
token: verificationToken,
|
|
69
|
+
expiresAt: tokenExpiry,
|
|
70
|
+
});
|
|
71
|
+
this.eventEmitter.emit(mail_1.MailEvents.SEND_VERIFICATION, new mail_1.SendVerificationEmailEvent(user.email, verificationToken, user.displayName));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.RegisterAction = RegisterAction;
|
|
75
|
+
exports.RegisterAction = RegisterAction = __decorate([
|
|
76
|
+
(0, common_1.Injectable)(),
|
|
77
|
+
__param(0, (0, common_1.Inject)(repositories_1.AUTH_USER_REPOSITORY_TOKEN)),
|
|
78
|
+
__param(1, (0, common_1.Inject)(repositories_1.EMAIL_VERIFICATION_TOKEN_REPOSITORY_TOKEN)),
|
|
79
|
+
__param(2, (0, common_1.Inject)(ports_1.HASH_SERVICE_TOKEN)),
|
|
80
|
+
__param(3, (0, common_1.Inject)(ports_1.TOKEN_SERVICE_TOKEN)),
|
|
81
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object, event_emitter_1.EventEmitter2])
|
|
82
|
+
], RegisterAction);
|
|
83
|
+
//# sourceMappingURL=register.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.action.js","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/register.action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,yDAAsD;AAEtD,kEAA8D;AAC9D,+DAKsC;AAEtC,uCAKqB;AACrB,iDAAuD;AACvD,yDAAwF;AAGjF,IAAM,cAAc,GAApB,MAAM,cAAc;I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{ EmailVerificationTokenRepository, AuthUserRepository } from '../../../domain/repositories';
|
|
3
|
+
import { TokenService } from '../../ports/token.service';
|
|
4
|
+
export declare class ResendVerificationEmailAction {
|
|
5
|
+
private readonly authUserRepository;
|
|
6
|
+
private readonly emailTokenRepository;
|
|
7
|
+
private readonly tokenService;
|
|
8
|
+
private readonly eventEmitter;
|
|
9
|
+
constructor(authUserRepository: AuthUserRepository, emailTokenRepository: EmailVerificationTokenRepository, tokenService: TokenService, eventEmitter: EventEmitter2);
|
|
10
|
+
handle(userId: number): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=resend-verification-email.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resend-verification-email.action.d.ts","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/resend-verification-email.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAEL,gCAAgC,EAEhC,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,YAAY,EACb,MAAM,2BAA2B,CAAC;AAGnC,qBACa,6BAA6B;IAGtC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAErC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBALZ,kBAAkB,EAAE,kBAAkB,EAEtC,oBAAoB,EAAE,gCAAgC,EAEtD,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,aAAa;IAGxC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAoC5C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ResendVerificationEmailAction = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
18
|
+
const repositories_1 = require("../../../domain/repositories");
|
|
19
|
+
const token_service_1 = require("../../ports/token.service");
|
|
20
|
+
const mail_1 = require("../../../../common/events/mail");
|
|
21
|
+
let ResendVerificationEmailAction = class ResendVerificationEmailAction {
|
|
22
|
+
authUserRepository;
|
|
23
|
+
emailTokenRepository;
|
|
24
|
+
tokenService;
|
|
25
|
+
eventEmitter;
|
|
26
|
+
constructor(authUserRepository, emailTokenRepository, tokenService, eventEmitter) {
|
|
27
|
+
this.authUserRepository = authUserRepository;
|
|
28
|
+
this.emailTokenRepository = emailTokenRepository;
|
|
29
|
+
this.tokenService = tokenService;
|
|
30
|
+
this.eventEmitter = eventEmitter;
|
|
31
|
+
}
|
|
32
|
+
async handle(userId) {
|
|
33
|
+
const user = await this.authUserRepository.findById(userId);
|
|
34
|
+
console.log(user);
|
|
35
|
+
if (!user) {
|
|
36
|
+
throw new common_1.NotFoundException('User không tồn tại');
|
|
37
|
+
}
|
|
38
|
+
if (user.isEmailVerified) {
|
|
39
|
+
throw new Error('Email đã được xác thực');
|
|
40
|
+
}
|
|
41
|
+
await this.emailTokenRepository.deleteByUserId(userId);
|
|
42
|
+
const verificationToken = this.tokenService.generateEmailVerificationToken(user.id);
|
|
43
|
+
const tokenExpiry = new Date();
|
|
44
|
+
tokenExpiry.setHours(tokenExpiry.getHours() + 24);
|
|
45
|
+
await this.emailTokenRepository.create({
|
|
46
|
+
userId: user.id,
|
|
47
|
+
token: verificationToken,
|
|
48
|
+
expiresAt: tokenExpiry,
|
|
49
|
+
});
|
|
50
|
+
this.eventEmitter.emit(mail_1.MailEvents.SEND_VERIFICATION, new mail_1.SendVerificationEmailEvent(user.email, verificationToken, user.displayName));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.ResendVerificationEmailAction = ResendVerificationEmailAction;
|
|
54
|
+
exports.ResendVerificationEmailAction = ResendVerificationEmailAction = __decorate([
|
|
55
|
+
(0, common_1.Injectable)(),
|
|
56
|
+
__param(0, (0, common_1.Inject)(repositories_1.AUTH_USER_REPOSITORY_TOKEN)),
|
|
57
|
+
__param(1, (0, common_1.Inject)(repositories_1.EMAIL_VERIFICATION_TOKEN_REPOSITORY_TOKEN)),
|
|
58
|
+
__param(2, (0, common_1.Inject)(token_service_1.TOKEN_SERVICE_TOKEN)),
|
|
59
|
+
__metadata("design:paramtypes", [Object, Object, Object, event_emitter_1.EventEmitter2])
|
|
60
|
+
], ResendVerificationEmailAction);
|
|
61
|
+
//# sourceMappingURL=resend-verification-email.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resend-verification-email.action.js","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/resend-verification-email.action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,yDAAsD;AAEtD,+DAKsC;AACtC,6DAGmC;AACnC,yDAAwF;AAGjF,IAAM,6BAA6B,GAAnC,MAAM,6BAA6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ACF,CAAC;IACJ,CAAC;CACF,CAAA;AA/CY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,yCAA0B,CAAC,CAAA;IAElC,WAAA,IAAA,eAAM,EAAC,wDAAyC,CAAC,CAAA;IAEjD,WAAA,IAAA,eAAM,EAAC,mCAAmB,CAAC,CAAA;6DAEG,6BAAa;GARnC,6BAA6B,CA+CzC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthUserRepository } from '../../../domain/repositories/auth-user.repository';
|
|
2
|
+
import { ResetPasswordDto } from '../../dto/reset-password.dto';
|
|
3
|
+
import { HashService } from '../../ports/hash.service';
|
|
4
|
+
export declare class ResetPasswordAction {
|
|
5
|
+
private readonly authUserRepository;
|
|
6
|
+
private readonly hashService;
|
|
7
|
+
constructor(authUserRepository: AuthUserRepository, hashService: HashService);
|
|
8
|
+
handle(dto: ResetPasswordDto): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=reset-password.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-password.action.d.ts","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/reset-password.action.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,kBAAkB,EACnB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAEL,WAAW,EACZ,MAAM,0BAA0B,CAAC;AAElC,qBACa,mBAAmB;IAG5B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAFX,kBAAkB,EAAE,kBAAkB,EAEtC,WAAW,EAAE,WAAW;IAGrC,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAyBnD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ResetPasswordAction = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const auth_user_repository_1 = require("../../../domain/repositories/auth-user.repository");
|
|
18
|
+
const hash_service_1 = require("../../ports/hash.service");
|
|
19
|
+
let ResetPasswordAction = class ResetPasswordAction {
|
|
20
|
+
authUserRepository;
|
|
21
|
+
hashService;
|
|
22
|
+
constructor(authUserRepository, hashService) {
|
|
23
|
+
this.authUserRepository = authUserRepository;
|
|
24
|
+
this.hashService = hashService;
|
|
25
|
+
}
|
|
26
|
+
async handle(dto) {
|
|
27
|
+
const user = await this.authUserRepository.findByPasswordResetToken(dto.token);
|
|
28
|
+
if (!user) {
|
|
29
|
+
throw new common_1.NotFoundException('Token không hợp lệ hoặc đã hết hạn');
|
|
30
|
+
}
|
|
31
|
+
console.log('User found for password reset:', user.id, user.email, user.passwordResetTokenExpiry);
|
|
32
|
+
if (!user.passwordResetTokenExpiry ||
|
|
33
|
+
user.passwordResetTokenExpiry < new Date()) {
|
|
34
|
+
throw new common_1.BadRequestException('Token đã hết hạn');
|
|
35
|
+
}
|
|
36
|
+
const passwordHash = await this.hashService.hash(dto.password);
|
|
37
|
+
user.passwordHash = passwordHash;
|
|
38
|
+
user.passwordChangedAt = new Date();
|
|
39
|
+
user.passwordResetToken = null;
|
|
40
|
+
user.passwordResetTokenExpiry = null;
|
|
41
|
+
user.resetFailedAttempts();
|
|
42
|
+
await this.authUserRepository.save(user);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.ResetPasswordAction = ResetPasswordAction;
|
|
46
|
+
exports.ResetPasswordAction = ResetPasswordAction = __decorate([
|
|
47
|
+
(0, common_1.Injectable)(),
|
|
48
|
+
__param(0, (0, common_1.Inject)(auth_user_repository_1.AUTH_USER_REPOSITORY_TOKEN)),
|
|
49
|
+
__param(1, (0, common_1.Inject)(hash_service_1.HASH_SERVICE_TOKEN)),
|
|
50
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
51
|
+
], ResetPasswordAction);
|
|
52
|
+
//# sourceMappingURL=reset-password.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-password.action.js","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/reset-password.action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKwB;AAExB,4FAG2D;AAE3D,2DAGkC;AAG3B,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGX;IAEA;IAJnB,YAEmB,kBAAsC,EAEtC,WAAwB;QAFxB,uBAAkB,GAAlB,kBAAkB,CAAoB;QAEtC,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,GAAqB;QAChC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CACjE,GAAG,CAAC,KAAK,CACV,CAAC;QACF,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,0BAAiB,CAAC,oCAAoC,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAClG,IACE,CAAC,IAAI,CAAC,wBAAwB;YAC9B,IAAI,CAAC,wBAAwB,GAAG,IAAI,IAAI,EAAE,EAC1C,CAAC;YACD,MAAM,IAAI,4BAAmB,CAAC,kBAAkB,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,IAAI,IAAI,EAAE,CAAC;QACpC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAE3B,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF,CAAA;AAjCY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,iDAA0B,CAAC,CAAA;IAElC,WAAA,IAAA,eAAM,EAAC,iCAAkB,CAAC,CAAA;;GAJlB,mBAAmB,CAiC/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UpdateProfileDto } from '../../dto/update-profile.dto';
|
|
2
|
+
import { AuthUserRepository } from '../../../domain';
|
|
3
|
+
export declare class UpdateProfileAction {
|
|
4
|
+
private readonly authUserRepository;
|
|
5
|
+
constructor(authUserRepository: AuthUserRepository);
|
|
6
|
+
handle(userId: number, updateDto: UpdateProfileDto): Promise<import("../../../domain").AuthUser>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=update-profile.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-profile.action.d.ts","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/update-profile.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAA8B,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,qBACa,mBAAmB;IAG5B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAAlB,kBAAkB,EAAE,kBAAkB;IAGnD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB;CA4CzD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UpdateProfileAction = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const domain_1 = require("../../../domain");
|
|
18
|
+
let UpdateProfileAction = class UpdateProfileAction {
|
|
19
|
+
authUserRepository;
|
|
20
|
+
constructor(authUserRepository) {
|
|
21
|
+
this.authUserRepository = authUserRepository;
|
|
22
|
+
}
|
|
23
|
+
async handle(userId, updateDto) {
|
|
24
|
+
const user = await this.authUserRepository.findById(userId);
|
|
25
|
+
if (!user) {
|
|
26
|
+
throw new common_1.NotFoundException('User not found');
|
|
27
|
+
}
|
|
28
|
+
if (updateDto.email && updateDto.email !== user.email) {
|
|
29
|
+
const existingUser = await this.authUserRepository.findByEmail(updateDto.email);
|
|
30
|
+
if (existingUser) {
|
|
31
|
+
throw new common_1.ConflictException('Email already in use');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (updateDto.username && updateDto.username !== user.username) {
|
|
35
|
+
const existingUser = await this.authUserRepository.findByUsername(updateDto.username);
|
|
36
|
+
if (existingUser) {
|
|
37
|
+
throw new common_1.ConflictException('Username already in use');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (updateDto.displayName !== undefined) {
|
|
41
|
+
user.displayName = updateDto.displayName;
|
|
42
|
+
}
|
|
43
|
+
if (updateDto.username !== undefined) {
|
|
44
|
+
user.username = updateDto.username;
|
|
45
|
+
}
|
|
46
|
+
if (updateDto.email !== undefined) {
|
|
47
|
+
user.email = updateDto.email;
|
|
48
|
+
user.emailVerifiedAt = null;
|
|
49
|
+
}
|
|
50
|
+
if (updateDto.avatar !== undefined) {
|
|
51
|
+
user.avatar = updateDto.avatar;
|
|
52
|
+
}
|
|
53
|
+
const updatedUser = await this.authUserRepository.save(user);
|
|
54
|
+
return updatedUser;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.UpdateProfileAction = UpdateProfileAction;
|
|
58
|
+
exports.UpdateProfileAction = UpdateProfileAction = __decorate([
|
|
59
|
+
(0, common_1.Injectable)(),
|
|
60
|
+
__param(0, (0, common_1.Inject)(domain_1.AUTH_USER_REPOSITORY_TOKEN)),
|
|
61
|
+
__metadata("design:paramtypes", [Object])
|
|
62
|
+
], UpdateProfileAction);
|
|
63
|
+
//# sourceMappingURL=update-profile.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-profile.action.js","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/update-profile.action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0F;AAE1F,4CAAiF;AAG1E,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGX;IAFnB,YAEmB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IACtD,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,SAA2B;QACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE5D,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,0BAAiB,CAAC,gBAAgB,CAAC,CAAC;QAChD,CAAC;QAGD,IAAI,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;YACtD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAChF,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,IAAI,0BAAiB,CAAC,sBAAsB,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QAGD,IAAI,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC/D,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACtF,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,IAAI,0BAAiB,CAAC,yBAAyB,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAGD,IAAI,SAAS,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACxC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QAC3C,CAAC;QACD,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACrC,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QACrC,CAAC;QACD,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;YAE7B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,CAAC;QACD,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QACjC,CAAC;QAGD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7D,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAA;AAlDY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,mCAA0B,CAAC,CAAA;;GAF1B,mBAAmB,CAkD/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EmailVerificationTokenRepository, AuthUserRepository } from '../../../domain/repositories';
|
|
2
|
+
import { VerifyEmailDto } from '../../dto/verify-email.dto';
|
|
3
|
+
export declare class VerifyEmailAction {
|
|
4
|
+
private readonly tokenRepository;
|
|
5
|
+
private readonly authUserRepository;
|
|
6
|
+
constructor(tokenRepository: EmailVerificationTokenRepository, authUserRepository: AuthUserRepository);
|
|
7
|
+
handle(dto: VerifyEmailDto): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=verify-email.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-email.action.d.ts","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/verify-email.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,gCAAgC,EAEhC,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,qBACa,iBAAiB;IAG1B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAEhC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAFlB,eAAe,EAAE,gCAAgC,EAEjD,kBAAkB,EAAE,kBAAkB;IAGnD,MAAM,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAyBjD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.VerifyEmailAction = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const repositories_1 = require("../../../domain/repositories");
|
|
18
|
+
const enums_1 = require("../../../domain/enums");
|
|
19
|
+
let VerifyEmailAction = class VerifyEmailAction {
|
|
20
|
+
tokenRepository;
|
|
21
|
+
authUserRepository;
|
|
22
|
+
constructor(tokenRepository, authUserRepository) {
|
|
23
|
+
this.tokenRepository = tokenRepository;
|
|
24
|
+
this.authUserRepository = authUserRepository;
|
|
25
|
+
}
|
|
26
|
+
async handle(dto) {
|
|
27
|
+
const tokenRecord = await this.tokenRepository.findByToken(dto.token);
|
|
28
|
+
if (!tokenRecord) {
|
|
29
|
+
throw new common_1.NotFoundException('Token không hợp lệ hoặc đã hết hạn');
|
|
30
|
+
}
|
|
31
|
+
if (tokenRecord.isExpired()) {
|
|
32
|
+
await this.tokenRepository.delete(tokenRecord.id);
|
|
33
|
+
throw new common_1.NotFoundException('Token đã hết hạn');
|
|
34
|
+
}
|
|
35
|
+
const user = await this.authUserRepository.findById(tokenRecord.userId);
|
|
36
|
+
if (!user) {
|
|
37
|
+
throw new common_1.NotFoundException('User không tồn tại');
|
|
38
|
+
}
|
|
39
|
+
user.verifyEmail();
|
|
40
|
+
if (user.status === enums_1.AuthUserStatus.PENDING_VERIFICATION) {
|
|
41
|
+
user.status = enums_1.AuthUserStatus.ACTIVE;
|
|
42
|
+
}
|
|
43
|
+
await this.authUserRepository.save(user);
|
|
44
|
+
await this.tokenRepository.delete(tokenRecord.id);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.VerifyEmailAction = VerifyEmailAction;
|
|
48
|
+
exports.VerifyEmailAction = VerifyEmailAction = __decorate([
|
|
49
|
+
(0, common_1.Injectable)(),
|
|
50
|
+
__param(0, (0, common_1.Inject)(repositories_1.EMAIL_VERIFICATION_TOKEN_REPOSITORY_TOKEN)),
|
|
51
|
+
__param(1, (0, common_1.Inject)(repositories_1.AUTH_USER_REPOSITORY_TOKEN)),
|
|
52
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
53
|
+
], VerifyEmailAction);
|
|
54
|
+
//# sourceMappingURL=verify-email.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-email.action.js","sourceRoot":"","sources":["../../../../../../src/server/auth/application/actions/auth/verify-email.action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AAEvE,+DAKsC;AAEtC,iDAAuD;AAGhD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAGT;IAEA;IAJnB,YAEmB,eAAiD,EAEjD,kBAAsC;QAFtC,oBAAe,GAAf,eAAe,CAAkC;QAEjD,uBAAkB,GAAlB,kBAAkB,CAAoB;IACtD,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,GAAmB;QAC9B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,0BAAiB,CAAC,oCAAoC,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,CAAC;YAC5B,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAClD,MAAM,IAAI,0BAAiB,CAAC,kBAAkB,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACxE,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,0BAAiB,CAAC,oBAAoB,CAAC,CAAC;QACpD,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,IAAI,CAAC,MAAM,KAAK,sBAAc,CAAC,oBAAoB,EAAE,CAAC;YACxD,IAAI,CAAC,MAAM,GAAG,sBAAc,CAAC,MAAM,CAAC;QACtC,CAAC;QAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,M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