@authup/server-core 1.0.0-beta.45 → 1.0.0-beta.47
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/LICENSE +661 -201
- package/README.md +3 -1
- package/dist/adapters/database/data-source/index.d.ts +0 -1
- package/dist/adapters/database/data-source/index.d.ts.map +1 -1
- package/dist/adapters/database/data-source/index.mjs +1 -2
- package/dist/adapters/database/domains/client/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/client/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/client-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/client-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/client-role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client-role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client-role/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/client-role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/client-scope/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/client-scope/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/client-scope/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/client-scope/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/identity-provider/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider-account/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider-account/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider-account/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/identity-provider-account/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/identity-provider-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.mjs +21 -45
- package/dist/adapters/database/domains/identity-provider-role-mapping/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/permission/subscriber.mjs +28 -47
- package/dist/adapters/database/domains/permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/policy/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/policy/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/policy/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/policy/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/policy-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/policy-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/policy-attribute/subscriber.mjs +24 -45
- package/dist/adapters/database/domains/policy-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/realm/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/realm/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/realm/subscriber.mjs +21 -36
- package/dist/adapters/database/domains/realm/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/robot/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/robot/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/robot/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/robot/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/robot-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/robot-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/robot-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/robot-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/robot-role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/robot-role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/robot-role/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/robot-role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/role/subscriber.mjs +21 -41
- package/dist/adapters/database/domains/role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/role-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/role-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/role-attribute/subscriber.mjs +24 -45
- package/dist/adapters/database/domains/role-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/role-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/role-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/role-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/role-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/scope/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/scope/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/scope/subscriber.mjs +17 -43
- package/dist/adapters/database/domains/scope/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user/subscriber.mjs +21 -39
- package/dist/adapters/database/domains/user/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user-attribute/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user-attribute/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user-attribute/subscriber.mjs +24 -43
- package/dist/adapters/database/domains/user-attribute/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user-permission/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user-permission/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user-permission/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/user-permission/subscriber.mjs.map +1 -1
- package/dist/adapters/database/domains/user-role/subscriber.d.ts +3 -6
- package/dist/adapters/database/domains/user-role/subscriber.d.ts.map +1 -1
- package/dist/adapters/database/domains/user-role/subscriber.mjs +24 -49
- package/dist/adapters/database/domains/user-role/subscriber.mjs.map +1 -1
- package/dist/adapters/database/index.d.ts +1 -0
- package/dist/adapters/database/index.d.ts.map +1 -1
- package/dist/adapters/database/index.mjs +3 -2
- package/dist/adapters/database/subscriber/index.d.ts +3 -0
- package/dist/adapters/database/subscriber/index.d.ts.map +1 -0
- package/dist/adapters/database/subscriber/index.mjs +5 -0
- package/dist/adapters/database/subscriber/module.d.ts +19 -0
- package/dist/adapters/database/subscriber/module.d.ts.map +1 -0
- package/dist/adapters/database/subscriber/module.mjs +70 -0
- package/dist/adapters/database/subscriber/module.mjs.map +1 -0
- package/dist/adapters/database/subscriber/types.d.ts +15 -0
- package/dist/adapters/database/subscriber/types.d.ts.map +1 -0
- package/dist/adapters/http/controllers/entities/identity-provider/module.mjs +1 -1
- package/dist/adapters/http/controllers/workflows/activate/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/activate/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/activate/module.mjs +20 -1
- package/dist/adapters/http/controllers/workflows/activate/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs +16 -37
- package/dist/adapters/http/controllers/workflows/authorize/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts +2 -0
- package/dist/adapters/http/controllers/workflows/authorize/types.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-forgot/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/password-forgot/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-forgot/module.mjs +23 -2
- package/dist/adapters/http/controllers/workflows/password-forgot/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.mjs +21 -1
- package/dist/adapters/http/controllers/workflows/password-reset/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/register/module.d.ts +8 -1
- package/dist/adapters/http/controllers/workflows/register/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/register/module.mjs +23 -2
- package/dist/adapters/http/controllers/workflows/register/module.mjs.map +1 -1
- package/dist/adapters/http/controllers/workflows/status/module.d.ts +11 -4
- package/dist/adapters/http/controllers/workflows/status/module.d.ts.map +1 -1
- package/dist/adapters/http/controllers/workflows/status/module.mjs +17 -5
- package/dist/adapters/http/controllers/workflows/status/module.mjs.map +1 -1
- package/dist/adapters/http/index.mjs +4 -1
- package/dist/adapters/http/middleware/built-in/cors.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/cors.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/error.d.ts +6 -1
- package/dist/adapters/http/middleware/built-in/error.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/error.mjs +2 -3
- package/dist/adapters/http/middleware/built-in/error.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.d.ts +1 -0
- package/dist/adapters/http/middleware/built-in/index.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/index.mjs +2 -1
- package/dist/adapters/http/middleware/built-in/logger.d.ts +2 -0
- package/dist/adapters/http/middleware/built-in/logger.d.ts.map +1 -1
- package/dist/adapters/http/middleware/built-in/logger.mjs +1 -2
- package/dist/adapters/http/middleware/built-in/logger.mjs.map +1 -1
- package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts +15 -0
- package/dist/adapters/http/middleware/built-in/ui-http-client.d.ts.map +1 -0
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs +25 -0
- package/dist/adapters/http/middleware/built-in/ui-http-client.mjs.map +1 -0
- package/dist/adapters/http/middleware/index.mjs +2 -1
- package/dist/adapters/http/request/helpers/index.d.ts +2 -0
- package/dist/adapters/http/request/helpers/index.d.ts.map +1 -1
- package/dist/adapters/http/request/helpers/index.mjs +3 -1
- package/dist/adapters/http/request/helpers/locale.d.ts +14 -0
- package/dist/adapters/http/request/helpers/locale.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/locale.mjs +32 -0
- package/dist/adapters/http/request/helpers/locale.mjs.map +1 -0
- package/dist/adapters/http/request/helpers/locations.mjs +1 -1
- package/dist/adapters/http/request/helpers/redirect.d.ts +14 -0
- package/dist/adapters/http/request/helpers/redirect.d.ts.map +1 -0
- package/dist/adapters/http/request/helpers/redirect.mjs +36 -0
- package/dist/adapters/http/request/helpers/redirect.mjs.map +1 -0
- package/dist/adapters/http/request/index.mjs +3 -1
- package/dist/adapters/http/ui/base-path.d.ts +9 -0
- package/dist/adapters/http/ui/base-path.d.ts.map +1 -0
- package/dist/adapters/http/ui/base-path.mjs +18 -0
- package/dist/adapters/http/ui/base-path.mjs.map +1 -0
- package/dist/adapters/http/ui/index.d.ts +5 -0
- package/dist/adapters/http/ui/index.d.ts.map +1 -0
- package/dist/adapters/http/ui/index.mjs +7 -0
- package/dist/adapters/http/ui/render.d.ts +4 -0
- package/dist/adapters/http/ui/render.d.ts.map +1 -0
- package/dist/adapters/http/ui/render.mjs +60 -0
- package/dist/adapters/http/ui/render.mjs.map +1 -0
- package/dist/adapters/http/ui/serve.d.ts +16 -0
- package/dist/adapters/http/ui/serve.d.ts.map +1 -0
- package/dist/adapters/http/ui/serve.mjs +32 -0
- package/dist/adapters/http/ui/serve.mjs.map +1 -0
- package/dist/adapters/http/ui/types.d.ts +8 -0
- package/dist/adapters/http/ui/types.d.ts.map +1 -0
- package/dist/adapters/http/ui/types.mjs +4 -0
- package/dist/app/index.d.ts +0 -2
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.mjs +3 -3
- package/dist/app/modules/config/constants.d.ts +1 -0
- package/dist/app/modules/config/constants.d.ts.map +1 -1
- package/dist/app/modules/config/constants.mjs +1 -0
- package/dist/app/modules/config/constants.mjs.map +1 -1
- package/dist/app/modules/config/index.d.ts +1 -0
- package/dist/app/modules/config/index.d.ts.map +1 -1
- package/dist/app/modules/config/index.mjs +2 -1
- package/dist/app/modules/config/normalize.d.ts.map +1 -1
- package/dist/app/modules/config/normalize.mjs +9 -2
- package/dist/app/modules/config/normalize.mjs.map +1 -1
- package/dist/app/modules/config/origins.d.ts +10 -0
- package/dist/app/modules/config/origins.d.ts.map +1 -0
- package/dist/app/modules/config/origins.mjs +21 -0
- package/dist/app/modules/config/origins.mjs.map +1 -0
- package/dist/app/modules/config/parse.d.ts.map +1 -1
- package/dist/app/modules/config/parse.mjs +1 -0
- package/dist/app/modules/config/parse.mjs.map +1 -1
- package/dist/app/modules/config/read/env.d.ts.map +1 -1
- package/dist/app/modules/config/read/env.mjs +2 -0
- package/dist/app/modules/config/read/env.mjs.map +1 -1
- package/dist/app/modules/config/types.d.ts +14 -0
- package/dist/app/modules/config/types.d.ts.map +1 -1
- package/dist/app/modules/database/constants.d.ts +2 -0
- package/dist/app/modules/database/constants.d.ts.map +1 -1
- package/dist/app/modules/database/constants.mjs +4 -1
- package/dist/app/modules/database/constants.mjs.map +1 -1
- package/dist/app/modules/database/module.d.ts +5 -1
- package/dist/app/modules/database/module.d.ts.map +1 -1
- package/dist/app/modules/database/module.mjs +26 -15
- package/dist/app/modules/database/module.mjs.map +1 -1
- package/dist/app/modules/http/constants.d.ts +11 -0
- package/dist/app/modules/http/constants.d.ts.map +1 -1
- package/dist/app/modules/http/constants.mjs +12 -1
- package/dist/app/modules/http/constants.mjs.map +1 -1
- package/dist/app/modules/http/modules/controller.d.ts +5 -1
- package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
- package/dist/app/modules/http/modules/controller.mjs +75 -10
- package/dist/app/modules/http/modules/controller.mjs.map +1 -1
- package/dist/app/modules/http/modules/middleware.d.ts +2 -1
- package/dist/app/modules/http/modules/middleware.d.ts.map +1 -1
- package/dist/app/modules/http/modules/middleware.mjs +19 -4
- package/dist/app/modules/http/modules/middleware.mjs.map +1 -1
- package/dist/app/modules/identity/module.mjs +4 -4
- package/dist/app/modules/identity/module.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/account/module.d.ts +3 -1
- package/dist/app/modules/identity/repositories/provider/account/module.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/account/module.mjs +6 -3
- package/dist/app/modules/identity/repositories/provider/account/module.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.d.ts +3 -0
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.mjs +5 -2
- package/dist/app/modules/identity/repositories/provider/mapper/attribute.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/permission.d.ts +3 -0
- package/dist/app/modules/identity/repositories/provider/mapper/permission.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/permission.mjs +5 -2
- package/dist/app/modules/identity/repositories/provider/mapper/permission.mjs.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/role.d.ts +3 -0
- package/dist/app/modules/identity/repositories/provider/mapper/role.d.ts.map +1 -1
- package/dist/app/modules/identity/repositories/provider/mapper/role.mjs +5 -2
- package/dist/app/modules/identity/repositories/provider/mapper/role.mjs.map +1 -1
- package/dist/app/modules/index.mjs +3 -2
- package/dist/app/modules/logger/module.d.ts.map +1 -1
- package/dist/app/modules/logger/module.mjs +1 -5
- package/dist/app/modules/logger/module.mjs.map +1 -1
- package/dist/app/modules/mail/constants.d.ts +2 -1
- package/dist/app/modules/mail/constants.d.ts.map +1 -1
- package/dist/app/modules/mail/constants.mjs +2 -1
- package/dist/app/modules/mail/constants.mjs.map +1 -1
- package/dist/app/modules/mail/index.mjs +2 -2
- package/dist/app/modules/mail/module.d.ts.map +1 -1
- package/dist/app/modules/mail/module.mjs +4 -1
- package/dist/app/modules/mail/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/module.d.ts.map +1 -1
- package/dist/app/modules/oauth2/module.mjs +3 -1
- package/dist/app/modules/oauth2/module.mjs.map +1 -1
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts +3 -0
- package/dist/app/modules/oauth2/repositories/key/repository.d.ts.map +1 -1
- package/dist/app/modules/oauth2/repositories/key/repository.mjs +5 -2
- package/dist/app/modules/oauth2/repositories/key/repository.mjs.map +1 -1
- package/dist/app/modules/provisioning/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/module.mjs +12 -0
- package/dist/app/modules/provisioning/module.mjs.map +1 -1
- package/dist/app/modules/provisioning/sources/default/module.d.ts.map +1 -1
- package/dist/app/modules/provisioning/sources/default/module.mjs +2 -1
- package/dist/app/modules/provisioning/sources/default/module.mjs.map +1 -1
- package/dist/core/entities/client/index.d.ts +1 -0
- package/dist/core/entities/client/index.d.ts.map +1 -1
- package/dist/core/entities/client/index.mjs +2 -1
- package/dist/core/entities/client/service.d.ts.map +1 -1
- package/dist/core/entities/client/service.mjs +3 -2
- package/dist/core/entities/client/service.mjs.map +1 -1
- package/dist/core/entities/client/types.d.ts +11 -1
- package/dist/core/entities/client/types.d.ts.map +1 -1
- package/dist/core/entities/client/web-client.d.ts +34 -0
- package/dist/core/entities/client/web-client.d.ts.map +1 -0
- package/dist/core/entities/client/web-client.mjs +62 -0
- package/dist/core/entities/client/web-client.mjs.map +1 -0
- package/dist/core/entities/index.mjs +2 -1
- package/dist/core/entities/realm/service.d.ts +6 -1
- package/dist/core/entities/realm/service.d.ts.map +1 -1
- package/dist/core/entities/realm/service.mjs +9 -0
- package/dist/core/entities/realm/service.mjs.map +1 -1
- package/dist/core/identity/index.d.ts +1 -0
- package/dist/core/identity/index.d.ts.map +1 -1
- package/dist/core/identity/index.mjs +2 -1
- package/dist/core/identity/password-recovery/constants.d.ts +6 -0
- package/dist/core/identity/password-recovery/constants.d.ts.map +1 -0
- package/dist/core/identity/password-recovery/constants.mjs +12 -0
- package/dist/core/identity/password-recovery/constants.mjs.map +1 -0
- package/dist/core/identity/password-recovery/index.d.ts +1 -0
- package/dist/core/identity/password-recovery/index.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/index.mjs +2 -1
- package/dist/core/identity/password-recovery/service.d.ts +4 -2
- package/dist/core/identity/password-recovery/service.d.ts.map +1 -1
- package/dist/core/identity/password-recovery/service.mjs +17 -6
- package/dist/core/identity/password-recovery/service.mjs.map +1 -1
- package/dist/core/identity/password-recovery/types.d.ts +5 -2
- package/dist/core/identity/password-recovery/types.d.ts.map +1 -1
- package/dist/core/identity/registration/service.d.ts +4 -2
- package/dist/core/identity/registration/service.d.ts.map +1 -1
- package/dist/core/identity/registration/service.mjs +15 -6
- package/dist/core/identity/registration/service.mjs.map +1 -1
- package/dist/core/identity/registration/types.d.ts +5 -2
- package/dist/core/identity/registration/types.d.ts.map +1 -1
- package/dist/core/identity/role/module.d.ts.map +1 -1
- package/dist/core/identity/role/module.mjs +1 -1
- package/dist/core/identity/role/module.mjs.map +1 -1
- package/dist/core/identity/types.d.ts +10 -0
- package/dist/core/identity/types.d.ts.map +1 -0
- package/dist/core/identity/types.mjs +4 -0
- package/dist/core/index.mjs +8 -1
- package/dist/core/mail/format/blocks.d.ts +12 -0
- package/dist/core/mail/format/blocks.d.ts.map +1 -0
- package/dist/core/mail/format/blocks.mjs +47 -0
- package/dist/core/mail/format/blocks.mjs.map +1 -0
- package/dist/core/mail/format/html.d.ts +9 -0
- package/dist/core/mail/format/html.d.ts.map +1 -0
- package/dist/core/mail/format/html.mjs +41 -0
- package/dist/core/mail/format/html.mjs.map +1 -0
- package/dist/core/mail/format/index.d.ts +5 -0
- package/dist/core/mail/format/index.d.ts.map +1 -0
- package/dist/core/mail/format/index.mjs +7 -0
- package/dist/core/mail/format/text.d.ts +3 -0
- package/dist/core/mail/format/text.d.ts.map +1 -0
- package/dist/core/mail/format/text.mjs +20 -0
- package/dist/core/mail/format/text.mjs.map +1 -0
- package/dist/core/mail/format/types.d.ts +30 -0
- package/dist/core/mail/format/types.d.ts.map +1 -0
- package/dist/core/mail/format/types.mjs +4 -0
- package/dist/core/mail/index.d.ts +3 -0
- package/dist/core/mail/index.d.ts.map +1 -1
- package/dist/core/mail/index.mjs +6 -1
- package/dist/core/mail/renderer.d.ts +10 -0
- package/dist/core/mail/renderer.d.ts.map +1 -0
- package/dist/core/mail/renderer.mjs +49 -0
- package/dist/core/mail/renderer.mjs.map +1 -0
- package/dist/core/mail/template/define.d.ts +7 -0
- package/dist/core/mail/template/define.d.ts.map +1 -0
- package/dist/core/mail/template/define.mjs +14 -0
- package/dist/core/mail/template/define.mjs.map +1 -0
- package/dist/core/mail/template/index.d.ts +4 -0
- package/dist/core/mail/template/index.d.ts.map +1 -0
- package/dist/core/mail/template/index.mjs +7 -0
- package/dist/core/mail/template/registry.d.ts +6 -0
- package/dist/core/mail/template/registry.d.ts.map +1 -0
- package/dist/core/mail/template/registry.mjs +15 -0
- package/dist/core/mail/template/registry.mjs.map +1 -0
- package/dist/core/mail/template/templates/password-reset.d.ts +3 -0
- package/dist/core/mail/template/templates/password-reset.d.ts.map +1 -0
- package/dist/core/mail/template/templates/password-reset.mjs +36 -0
- package/dist/core/mail/template/templates/password-reset.mjs.map +1 -0
- package/dist/core/mail/template/templates/registration-activation.d.ts +3 -0
- package/dist/core/mail/template/templates/registration-activation.d.ts.map +1 -0
- package/dist/core/mail/template/templates/registration-activation.mjs +34 -0
- package/dist/core/mail/template/templates/registration-activation.mjs.map +1 -0
- package/dist/core/mail/template/types.d.ts +39 -0
- package/dist/core/mail/template/types.d.ts.map +1 -0
- package/dist/core/mail/template/types.mjs +13 -0
- package/dist/core/mail/template/types.mjs.map +1 -0
- package/dist/core/mail/types.d.ts +21 -0
- package/dist/core/mail/types.d.ts.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/swagger.json +98 -3
- package/dist/ui/client/.vite/ssr-manifest.json +49086 -875
- package/dist/ui/client/assets/asap-latin-400-normal-Dc37g3Il.woff +0 -0
- package/dist/ui/client/assets/asap-latin-400-normal-DnZ1MOsG.woff2 +0 -0
- package/dist/ui/client/assets/asap-latin-700-normal-Dqcopq14.woff +0 -0
- package/dist/ui/client/assets/asap-latin-700-normal-l2Y8pi-F.woff2 +0 -0
- package/dist/ui/client/assets/asap-latin-ext-400-normal-C-fcRdtE.woff +0 -0
- package/dist/ui/client/assets/asap-latin-ext-400-normal-DwYtpHbV.woff2 +0 -0
- package/dist/ui/client/assets/asap-latin-ext-700-normal-D00OESsZ.woff +0 -0
- package/dist/ui/client/assets/asap-latin-ext-700-normal-y8bo5aW5.woff2 +0 -0
- package/dist/ui/client/assets/asap-vietnamese-400-normal-DGyJlJLT.woff2 +0 -0
- package/dist/ui/client/assets/asap-vietnamese-400-normal-lfLaoF2x.woff +0 -0
- package/dist/ui/client/assets/asap-vietnamese-700-normal-B-e19ug5.woff +0 -0
- package/dist/ui/client/assets/asap-vietnamese-700-normal-D-SxY94i.woff2 +0 -0
- package/dist/ui/client/assets/index-BeXJgvKE.css +2 -0
- package/dist/ui/client/assets/index-CgLTRwpP.js +95 -0
- package/dist/ui/client/assets/nunito-cyrillic-300-normal-BPQV259B.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-300-normal-g5qSsvc0.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-400-normal-D1j0u8EH.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-400-normal-xAOo5cBP.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-600-normal-BUjmtIuu.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-600-normal-DJGQ2h05.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-700-normal-DP36NgGt.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-700-normal-DfHRUDv-.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-300-normal-BDHtqmCR.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-300-normal-ChMQLIrm.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-400-normal-CuPM9foi.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-400-normal-xaE7D4Sw.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-600-normal-CWPPjBOD.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-600-normal-vnfu4DTE.woff +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-700-normal-BuR0mlCG.woff2 +0 -0
- package/dist/ui/client/assets/nunito-cyrillic-ext-700-normal-DfoqN4Gs.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-300-normal-C3ZIKvzv.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-300-normal-COoPE5VN.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-400-normal-DKg4f3fz.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-400-normal-r8SDr6Up.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-600-normal-Br8yIETf.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-600-normal-Cd0eNu1l.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-700-normal-Dort48En.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-700-normal-OcDqTBcA.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-300-normal-D1SyVuPt.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-300-normal-DfqbmdMl.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-400-normal-CjMJVfGn.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-400-normal-i-8OOpdj.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-600-normal-BKUpuB78.woff +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-600-normal-Dd9Zuxh1.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-700-normal-BWeMsAzO.woff2 +0 -0
- package/dist/ui/client/assets/nunito-latin-ext-700-normal-D4woHhbd.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-300-normal-DATld5Vw.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-300-normal-mLneKULB.woff2 +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-400-normal-BHkVbP3T.woff2 +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-400-normal-DtOtW02z.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-600-normal-BY8O6Cug.woff2 +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-600-normal-DO1RqFw5.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-700-normal-C9SQsXvj.woff +0 -0
- package/dist/ui/client/assets/nunito-vietnamese-700-normal-Ch8EUCfz.woff2 +0 -0
- package/dist/ui/client/index.html +2 -2
- package/dist/ui/server/server.js +20388 -18163
- package/package.json +20 -17
- package/dist/adapters/database/data-source/singleton.d.ts +0 -5
- package/dist/adapters/database/data-source/singleton.d.ts.map +0 -1
- package/dist/adapters/database/data-source/singleton.mjs +0 -19
- package/dist/adapters/database/data-source/singleton.mjs.map +0 -1
- package/dist/adapters/database/event-publisher/index.d.ts +0 -2
- package/dist/adapters/database/event-publisher/index.d.ts.map +0 -1
- package/dist/adapters/database/event-publisher/index.mjs +0 -5
- package/dist/adapters/database/event-publisher/module.d.ts +0 -6
- package/dist/adapters/database/event-publisher/module.d.ts.map +0 -1
- package/dist/adapters/database/event-publisher/module.mjs +0 -25
- package/dist/adapters/database/event-publisher/module.mjs.map +0 -1
- package/dist/app/module.d.ts +0 -2
- package/dist/app/module.d.ts.map +0 -1
- package/dist/app/module.mjs +0 -5
- package/dist/app/types.d.ts +0 -2
- package/dist/app/types.d.ts.map +0 -1
- package/dist/ui/client/assets/index-CjKS9a0I.css +0 -1
- package/dist/ui/client/assets/index-bGxpD1zZ.js +0 -95
- /package/dist/{app → adapters/database/subscriber}/types.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.mjs","names":["BuiltInPolicyType","PolicyData","ValidatorGroup","isPropertySet","isUUID","BadRequestError","EntityNotFoundError","PermissionName","REALM_MASTER_NAME","RealmValidator","AbstractEntityService","RealmService","repository","validator","ctx","getMany","query","findMany","getOne","idOrName","entity","findOneByIdOrName","create","data","actor","save","undefined","update","updateOnly","options","group","where","id","name","findOneBy","permissionEvaluator","preEvaluate","REALM_UPDATE","UPDATE","REALM_CREATE","CREATE","validated","run","validateJoinColumns","evaluate","input","ATTRIBUTES","merge","created","delete","REALM_DELETE","built_in","entityId","remove"],"sources":["../../../../src/core/entities/realm/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BuiltInPolicyType, PolicyData } from '@authup/access';\nimport { ValidatorGroup, isPropertySet, isUUID } from '@authup/kit';\nimport { BadRequestError, EntityNotFoundError } from '@authup/errors';\nimport {\n PermissionName,\n REALM_MASTER_NAME,\n RealmValidator,\n} from '@authup/core-kit';\nimport type { Realm } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult } from '@authup/server-kit';\nimport { AbstractEntityService } from '@authup/server-kit';\nimport type { IRealmRepository, IRealmService } from './types.ts';\n\nexport type RealmServiceContext = {\n repository: IRealmRepository;\n};\n\nexport class RealmService extends AbstractEntityService implements IRealmService {\n protected repository: IRealmRepository;\n\n protected validator: RealmValidator;\n\n constructor(ctx: RealmServiceContext) {\n super();\n this.repository = ctx.repository;\n this.validator = new RealmValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n ): Promise<EntityRepositoryFindManyResult<Realm>> {\n return this.repository.findMany(query);\n }\n\n async getOne(\n idOrName: string,\n ): Promise<Realm> {\n const entity = await this.repository.findOneByIdOrName(idOrName);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Realm> {\n const { entity } = await this.save(undefined, data, actor);\n return entity;\n }\n\n async update(\n idOrName: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Realm> {\n const { entity } = await this.save(idOrName, data, actor, { updateOnly: true });\n return entity;\n }\n\n async save(\n idOrName: string | undefined,\n data: Record<string, any>,\n actor: ActorContext,\n options: { updateOnly?: boolean } = {},\n ): Promise<{\n entity: Realm,\n created: boolean \n }> {\n let group: string;\n\n let entity: Realm | null | undefined;\n if (idOrName) {\n const where: Record<string, any> = {};\n if (isUUID(idOrName)) {\n where.id = idOrName;\n } else {\n where.name = idOrName;\n }\n\n entity = await this.repository.findOneBy(where);\n if (!entity && options.updateOnly) {\n throw new EntityNotFoundError();\n }\n } else if (options.updateOnly) {\n throw new EntityNotFoundError();\n }\n\n if (entity) {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.REALM_UPDATE });\n group = ValidatorGroup.UPDATE;\n } else {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.REALM_CREATE });\n group = ValidatorGroup.CREATE;\n }\n\n const validated = await this.validator.run(data, { group });\n\n await this.repository.validateJoinColumns(validated);\n\n if (entity) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.REALM_UPDATE,\n input: new PolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: {\n ...entity,\n ...validated,\n },\n }),\n });\n\n if (entity.name === REALM_MASTER_NAME && isPropertySet(validated, 'name') && entity.name !== validated.name) {\n throw new BadRequestError(`The name of the ${REALM_MASTER_NAME} can not be changed.`);\n }\n\n entity = this.repository.merge(entity, validated);\n await this.repository.save(entity);\n\n return {\n entity,\n created: false, \n };\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.REALM_CREATE,\n input: new PolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated }),\n });\n\n entity = this.repository.create(validated);\n await this.repository.save(entity);\n\n return {\n entity,\n created: true, \n };\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<Realm> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.REALM_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (entity.built_in) {\n throw new BadRequestError('A built-in realm can not be deleted.');\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.REALM_DELETE,\n input: new PolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n\n return entity;\n }\n}\n"],"mappings":";;;;;;;;;AAwBA,IAAaW,eAAb,cAAkCD,sBAAAA;CACpBE;CAEAC;CAEV,YAAYC,KAA0B;EAClC,MAAK;EACL,KAAKF,aAAaE,IAAIF;EACtB,KAAKC,YAAY,IAAIJ,eAAAA;CACzB;CAEA,MAAMM,QACFC,OAC8C;EAC9C,OAAO,KAAKJ,WAAWK,SAASD,KAAAA;CACpC;CAEA,MAAME,OACFC,UACc;EACd,MAAMC,SAAS,MAAM,KAAKR,WAAWS,kBAAkBF,QAAAA;EACvD,IAAI,CAACC,QACD,MAAM,IAAId,oBAAAA;EAGd,OAAOc;CACX;CAEA,MAAME,OACFC,MACAC,OACc;EACd,MAAM,EAAEJ,WAAW,MAAM,KAAKK,KAAKC,KAAAA,GAAWH,MAAMC,KAAAA;EACpD,OAAOJ;CACX;CAEA,MAAMO,OACFR,UACAI,MACAC,OACc;EACd,MAAM,EAAEJ,WAAW,MAAM,KAAKK,KAAKN,UAAUI,MAAMC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ACb;EACJ;EAEA,MAAMxB,MAAMW,oBAAoBS,SAAS;GACrCX,MAAM1B,eAAegC;GACrBM,OAAO,IAAI5C,WAAW,GAAGD,kBAAkB8C,aAAaL,UAAU,CAAA;EACtE,CAAA;EAEArB,SAAS,KAAKR,WAAWU,OAAOmB,SAAAA;EAChC,MAAM,KAAK7B,WAAWa,KAAKL,MAAAA;EAE3B,OAAO;GACHA;GACA4B,SAAS;EACb;CACJ;CAEA,MAAMC,OACFjB,IACAR,OACc;EACd,MAAMA,MAAMW,oBAAoBC,YAAY,EAAEH,MAAM1B,eAAe2C,aAAa,CAAA;EAEhF,MAAM9B,SAAS,MAAM,KAAKR,WAAWsB,UAAU,EAAEF,GAAG,CAAA;EACpD,IAAI,CAACZ,QACD,MAAM,IAAId,oBAAAA;EAGd,IAAIc,OAAO+B,UACP,MAAM,IAAI9C,gBAAgB,sCAAA;EAG9B,MAAMmB,MAAMW,oBAAoBS,SAAS;GACrCX,MAAM1B,eAAe2C;GACrBL,OAAO,IAAI5C,WAAW,GAAGD,kBAAkB8C,aAAa1B,OAAO,CAAA;EACnE,CAAA;EAEA,MAAM,EAAEY,IAAIoB,aAAahC;EACzB,MAAM,KAAKR,WAAWyC,OAAOjC,MAAAA;EAC7BA,OAAOY,KAAKoB;EAEZ,OAAOhC;CACX;AACJ"}
|
|
1
|
+
{"version":3,"file":"service.mjs","names":["BuiltInPolicyType","PolicyData","ValidatorGroup","isPropertySet","isUUID","BadRequestError","EntityNotFoundError","PermissionName","REALM_MASTER_NAME","RealmValidator","AbstractEntityService","RealmService","repository","validator","webClientProvisioner","logger","ctx","getMany","query","findMany","getOne","idOrName","entity","findOneByIdOrName","create","data","actor","save","undefined","update","updateOnly","options","group","where","id","name","findOneBy","permissionEvaluator","preEvaluate","REALM_UPDATE","UPDATE","REALM_CREATE","CREATE","validated","run","validateJoinColumns","evaluate","input","ATTRIBUTES","merge","created","ensureForRealm","e","warn","Error","message","String","delete","REALM_DELETE","built_in","entityId","remove"],"sources":["../../../../src/core/entities/realm/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BuiltInPolicyType, PolicyData } from '@authup/access';\nimport { ValidatorGroup, isPropertySet, isUUID } from '@authup/kit';\nimport { BadRequestError, EntityNotFoundError } from '@authup/errors';\nimport {\n PermissionName,\n REALM_MASTER_NAME,\n RealmValidator,\n} from '@authup/core-kit';\nimport type { Realm } from '@authup/core-kit';\nimport type { ActorContext, EntityRepositoryFindManyResult, Logger } from '@authup/server-kit';\nimport { AbstractEntityService } from '@authup/server-kit';\nimport type { IWebClientProvisioner } from '../client/types.ts';\nimport type { IRealmRepository, IRealmService } from './types.ts';\n\nexport type RealmServiceContext = {\n repository: IRealmRepository;\n webClientProvisioner?: IWebClientProvisioner;\n logger?: Logger;\n};\n\nexport class RealmService extends AbstractEntityService implements IRealmService {\n protected repository: IRealmRepository;\n\n protected validator: RealmValidator;\n\n protected webClientProvisioner?: IWebClientProvisioner;\n\n protected logger?: Logger;\n\n constructor(ctx: RealmServiceContext) {\n super();\n this.repository = ctx.repository;\n this.webClientProvisioner = ctx.webClientProvisioner;\n this.logger = ctx.logger;\n this.validator = new RealmValidator();\n }\n\n async getMany(\n query: Record<string, any>,\n ): Promise<EntityRepositoryFindManyResult<Realm>> {\n return this.repository.findMany(query);\n }\n\n async getOne(\n idOrName: string,\n ): Promise<Realm> {\n const entity = await this.repository.findOneByIdOrName(idOrName);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n return entity;\n }\n\n async create(\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Realm> {\n const { entity } = await this.save(undefined, data, actor);\n return entity;\n }\n\n async update(\n idOrName: string,\n data: Record<string, any>,\n actor: ActorContext,\n ): Promise<Realm> {\n const { entity } = await this.save(idOrName, data, actor, { updateOnly: true });\n return entity;\n }\n\n async save(\n idOrName: string | undefined,\n data: Record<string, any>,\n actor: ActorContext,\n options: { updateOnly?: boolean } = {},\n ): Promise<{\n entity: Realm,\n created: boolean \n }> {\n let group: string;\n\n let entity: Realm | null | undefined;\n if (idOrName) {\n const where: Record<string, any> = {};\n if (isUUID(idOrName)) {\n where.id = idOrName;\n } else {\n where.name = idOrName;\n }\n\n entity = await this.repository.findOneBy(where);\n if (!entity && options.updateOnly) {\n throw new EntityNotFoundError();\n }\n } else if (options.updateOnly) {\n throw new EntityNotFoundError();\n }\n\n if (entity) {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.REALM_UPDATE });\n group = ValidatorGroup.UPDATE;\n } else {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.REALM_CREATE });\n group = ValidatorGroup.CREATE;\n }\n\n const validated = await this.validator.run(data, { group });\n\n await this.repository.validateJoinColumns(validated);\n\n if (entity) {\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.REALM_UPDATE,\n input: new PolicyData({\n [BuiltInPolicyType.ATTRIBUTES]: {\n ...entity,\n ...validated,\n },\n }),\n });\n\n if (entity.name === REALM_MASTER_NAME && isPropertySet(validated, 'name') && entity.name !== validated.name) {\n throw new BadRequestError(`The name of the ${REALM_MASTER_NAME} can not be changed.`);\n }\n\n entity = this.repository.merge(entity, validated);\n await this.repository.save(entity);\n\n return {\n entity,\n created: false, \n };\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.REALM_CREATE,\n input: new PolicyData({ [BuiltInPolicyType.ATTRIBUTES]: validated }),\n });\n\n entity = this.repository.create(validated);\n await this.repository.save(entity);\n\n // Provision the realm's public `web` client via the system-level\n // provisioner (NOT clientService.create) — it must not be gated on\n // the actor's CLIENT_CREATE, since a realm creator may lack it.\n // Realm creation must stay atomic from the caller's perspective: the\n // realm is already persisted, so a provisioning failure is logged and\n // swallowed (startup provisioning reconciles every realm's web client).\n if (this.webClientProvisioner) {\n try {\n await this.webClientProvisioner.ensureForRealm(entity);\n } catch (e) {\n if (this.logger) {\n this.logger.warn(\n `Failed to provision web client for realm ${entity.id}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n }\n }\n\n return {\n entity,\n created: true,\n };\n }\n\n async delete(\n id: string,\n actor: ActorContext,\n ): Promise<Realm> {\n await actor.permissionEvaluator.preEvaluate({ name: PermissionName.REALM_DELETE });\n\n const entity = await this.repository.findOneBy({ id });\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (entity.built_in) {\n throw new BadRequestError('A built-in realm can not be deleted.');\n }\n\n await actor.permissionEvaluator.evaluate({\n name: PermissionName.REALM_DELETE,\n input: new PolicyData({ [BuiltInPolicyType.ATTRIBUTES]: entity }),\n });\n\n const { id: entityId } = entity;\n await this.repository.remove(entity);\n entity.id = entityId;\n\n return entity;\n }\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAaW,eAAb,cAAkCD,sBAAAA;CACpBE;CAEAC;CAEAC;CAEAC;CAEV,YAAYC,KAA0B;EAClC,MAAK;EACL,KAAKJ,aAAaI,IAAIJ;EACtB,KAAKE,uBAAuBE,IAAIF;EAChC,KAAKC,SAASC,IAAID;EAClB,KAAKF,YAAY,IAAIJ,eAAAA;CACzB;CAEA,MAAMQ,QACFC,OAC8C;EAC9C,OAAO,KAAKN,WAAWO,SAASD,KAAAA;CACpC;CAEA,MAAME,OACFC,UACc;EACd,MAAMC,SAAS,MAAM,KAAKV,WAAWW,kBAAkBF,QAAAA;EACvD,IAAI,CAACC,QACD,MAAM,IAAIhB,oBAAAA;EAGd,OAAOgB;CACX;CAEA,MAAME,OACFC,MACAC,OACc;EACd,MAAM,EAAEJ,WAAW,MAAM,KAAKK,KAAKC,KAAAA,GAAWH,MAAMC,KAAAA;EACpD,OAAOJ;CACX;CAEA,MAAMO,OACFR,UACAI,MACAC,OACc;EACd,MAAM,EAAEJ,WAAW,MAAM,KAAKK,KAAKN,UAAUI,MAAMC,OAAO,EAAEI,YAAY,KAAK,CAAA;EAC7E,OAAOR;CACX;CAEA,MAAMK,KACFN,UACAI,MACAC,OACAK,U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C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/identity/index.ts"],"names":[],"mappings":"AAOA,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { PASSWORD_RESET_EXPIRES_IN_MINUTES } from "./password-recovery/constants.mjs";
|
|
4
5
|
import { PasswordRecoveryService } from "./password-recovery/service.mjs";
|
|
5
6
|
import "./password-recovery/index.mjs";
|
|
6
7
|
import { PermissionCheckerService } from "./permission/checker/service.mjs";
|
|
@@ -31,4 +32,4 @@ import "./registration/index.mjs";
|
|
|
31
32
|
import { IdentityResolver } from "./resolver/module.mjs";
|
|
32
33
|
import "./resolver/index.mjs";
|
|
33
34
|
import { IdentityRoleProvider } from "./role/module.mjs";
|
|
34
|
-
export { IDENTITY_PROVIDER_LDAP_COLLECTION_AUTHENTICATOR_TOKEN, IdentityPermissionProvider, IdentityProviderAccountBaseMapper, IdentityProviderAccountManager, IdentityProviderAttributeMapper, IdentityProviderFacebookAuthenticator, IdentityProviderGithubAuthenticator, IdentityProviderGoogleAuthenticator, IdentityProviderInstagramAuthenticator, IdentityProviderLdapAuthenticator, IdentityProviderLdapCollectionAuthenticator, IdentityProviderMapperOperation, IdentityProviderOAuth2Authenticator, IdentityProviderOpenIDAuthenticator, IdentityProviderPaypalAuthenticator, IdentityProviderPermissionMapper, IdentityProviderRoleMapper, IdentityResolver, IdentityRoleProvider, PasswordRecoveryService, PermissionCheckerService, PolicyCheckerService, RegistrationService, createIdentityProviderOAuth2Authenticator };
|
|
35
|
+
export { IDENTITY_PROVIDER_LDAP_COLLECTION_AUTHENTICATOR_TOKEN, IdentityPermissionProvider, IdentityProviderAccountBaseMapper, IdentityProviderAccountManager, IdentityProviderAttributeMapper, IdentityProviderFacebookAuthenticator, IdentityProviderGithubAuthenticator, IdentityProviderGoogleAuthenticator, IdentityProviderInstagramAuthenticator, IdentityProviderLdapAuthenticator, IdentityProviderLdapCollectionAuthenticator, IdentityProviderMapperOperation, IdentityProviderOAuth2Authenticator, IdentityProviderOpenIDAuthenticator, IdentityProviderPaypalAuthenticator, IdentityProviderPermissionMapper, IdentityProviderRoleMapper, IdentityResolver, IdentityRoleProvider, PASSWORD_RESET_EXPIRES_IN_MINUTES, PasswordRecoveryService, PermissionCheckerService, PolicyCheckerService, RegistrationService, createIdentityProviderOAuth2Authenticator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/password-recovery/constants.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,iCAAiC,KAAK,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
//#region src/core/identity/password-recovery/constants.ts
|
|
5
|
+
/**
|
|
6
|
+
* Validity window of a password-reset code. Drives both the persisted
|
|
7
|
+
* `reset_expires` timestamp and the expiry note in the reset mail.
|
|
8
|
+
*/ const PASSWORD_RESET_EXPIRES_IN_MINUTES = 30;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { PASSWORD_RESET_EXPIRES_IN_MINUTES };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":["PASSWORD_RESET_EXPIRES_IN_MINUTES"],"sources":["../../../../src/core/identity/password-recovery/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\n/**\n * Validity window of a password-reset code. Drives both the persisted\n * `reset_expires` timestamp and the expiry note in the reset mail.\n */\nexport const PASSWORD_RESET_EXPIRES_IN_MINUTES = 30;\n"],"mappings":";;;;;;;GAWA,MAAaA,oCAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/password-recovery/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/password-recovery/index.ts"],"names":[],"mappings":"AAOA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "node:path";
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
|
+
import { PASSWORD_RESET_EXPIRES_IN_MINUTES } from "./constants.mjs";
|
|
4
5
|
import { PasswordRecoveryService } from "./service.mjs";
|
|
5
|
-
export { PasswordRecoveryService };
|
|
6
|
+
export { PASSWORD_RESET_EXPIRES_IN_MINUTES, PasswordRecoveryService };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { IPasswordRecoveryService, PasswordForgotResult, PasswordRecoveryServiceContext, PasswordRecoveryServiceOptions, PasswordResetResult } from './types.ts';
|
|
2
|
-
import type { IMailClient } from '../../mail/types.ts';
|
|
2
|
+
import type { IMailClient, IMailTemplateRenderer } from '../../mail/types.ts';
|
|
3
3
|
import type { IRealmRepository, IUserRepository } from '../../entities/index.ts';
|
|
4
|
+
import type { IdentityWorkflowContext } from '../types.ts';
|
|
4
5
|
export declare class PasswordRecoveryService implements IPasswordRecoveryService {
|
|
5
6
|
protected options: PasswordRecoveryServiceOptions;
|
|
6
7
|
protected repository: IUserRepository;
|
|
7
8
|
protected realmRepository: IRealmRepository;
|
|
8
9
|
protected mailClient: IMailClient;
|
|
10
|
+
protected mailTemplateRenderer: IMailTemplateRenderer;
|
|
9
11
|
constructor(ctx: PasswordRecoveryServiceContext);
|
|
10
|
-
forgotPassword(data: Record<string, any
|
|
12
|
+
forgotPassword(data: Record<string, any>, context?: IdentityWorkflowContext): Promise<PasswordForgotResult>;
|
|
11
13
|
resetPassword(data: Record<string, any>): Promise<PasswordResetResult>;
|
|
12
14
|
private runForgotPasswordValidator;
|
|
13
15
|
private runResetPasswordValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/password-recovery/service.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACR,wBAAwB,EACxB,oBAAoB,EACpB,8BAA8B,EAC9B,8BAA8B,EAC9B,mBAAmB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/password-recovery/service.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACR,wBAAwB,EACxB,oBAAoB,EACpB,8BAA8B,EAC9B,8BAA8B,EAC9B,mBAAmB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG3D,qBAAa,uBAAwB,YAAW,wBAAwB;IACpE,SAAS,CAAC,OAAO,EAAE,8BAA8B,CAAC;IAElD,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC;IAEtC,SAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAE5C,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;IAElC,SAAS,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;gBAE1C,GAAG,EAAE,8BAA8B;IAQzC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAwE3G,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;YA0C9D,0BAA0B;YAgC1B,yBAAyB;CAuC1C"}
|
|
@@ -2,6 +2,9 @@ import "node:path";
|
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { UserCredentialsService } from "../../authentication/credential/entities/user/module.mjs";
|
|
5
|
+
import { MailTemplateName } from "../../mail/template/types.mjs";
|
|
6
|
+
import "../../mail/index.mjs";
|
|
7
|
+
import "./constants.mjs";
|
|
5
8
|
import { PasswordRecoveryDisabledError } from "./disabled.mjs";
|
|
6
9
|
import { EmailVerificationRequiredError } from "./email-verification-required.mjs";
|
|
7
10
|
import { ResetTokenExpiredError } from "./token-expired.mjs";
|
|
@@ -16,13 +19,15 @@ var PasswordRecoveryService = class {
|
|
|
16
19
|
repository;
|
|
17
20
|
realmRepository;
|
|
18
21
|
mailClient;
|
|
22
|
+
mailTemplateRenderer;
|
|
19
23
|
constructor(ctx) {
|
|
20
24
|
this.options = ctx.options;
|
|
21
25
|
this.repository = ctx.repository;
|
|
22
26
|
this.realmRepository = ctx.realmRepository;
|
|
23
27
|
this.mailClient = ctx.mailClient;
|
|
28
|
+
this.mailTemplateRenderer = ctx.mailTemplateRenderer;
|
|
24
29
|
}
|
|
25
|
-
async forgotPassword(data) {
|
|
30
|
+
async forgotPassword(data, context) {
|
|
26
31
|
if (!this.options.passwordRecoveryEnabled) throw new PasswordRecoveryDisabledError();
|
|
27
32
|
if (!this.options.emailVerificationEnabled) throw new EmailVerificationRequiredError("Email verification is not enabled, but required to reset a password.");
|
|
28
33
|
const validated = await this.runForgotPasswordValidator(data);
|
|
@@ -40,13 +45,19 @@ var PasswordRecoveryService = class {
|
|
|
40
45
|
});
|
|
41
46
|
await this.repository.save(merged);
|
|
42
47
|
try {
|
|
48
|
+
const resetUrl = this.options.publicUrl ? `${this.options.publicUrl.replace(/\/+$/, "")}/password-reset?token=${encodeURIComponent(merged.reset_hash)}&realm_id=${encodeURIComponent(entity.realm_id)}` : void 0;
|
|
49
|
+
const mail = await this.mailTemplateRenderer.render({
|
|
50
|
+
template: MailTemplateName.PASSWORD_RESET,
|
|
51
|
+
params: {
|
|
52
|
+
code: merged.reset_hash,
|
|
53
|
+
url: resetUrl,
|
|
54
|
+
expiresInMinutes: 30
|
|
55
|
+
},
|
|
56
|
+
locale: context?.locale
|
|
57
|
+
});
|
|
43
58
|
await this.mailClient.send({
|
|
44
59
|
to: entity.email,
|
|
45
|
-
|
|
46
|
-
html: `
|
|
47
|
-
<p>Please use the code below to reset your account password.</p>
|
|
48
|
-
<p>${merged.reset_hash}</p>
|
|
49
|
-
`
|
|
60
|
+
...mail
|
|
50
61
|
});
|
|
51
62
|
} catch {
|
|
52
63
|
this.repository.merge(merged, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.mjs","names":["BadRequestError","EntityNotFoundError","PasswordRecoveryDisabledError","EmailVerificationRequiredError","ResetTokenExpiredError","createValidator","randomBytes","Container","z","UserCredentialsService","PasswordRecoveryService","options","repository","realmRepository","mailClient","ctx","forgotPassword","data","passwordRecoveryEnabled","emailVerificationEnabled","validated","runForgotPasswordValidator","realm","resolve","realm_id","where","name","email","id","entity","findOneByWithEmail","merged","merge","reset_expires","Date","now","toISOString","reset_hash","toString","save","send","to","subject","html","resetPassword","runResetPasswordValidator","validateJoinColumns","token","findOneBy","credentialsService","hashedPassword","protect","password","reset_at","validator","oneOfContainer","oneOf","mount","string","trim","toLowerCase","regex","message","min","optional","uuid","nullable","run","max"],"sources":["../../../../src/core/identity/password-recovery/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BadRequestError, EntityNotFoundError } from '@authup/errors';\nimport { PasswordRecoveryDisabledError } from './disabled.ts';\nimport { EmailVerificationRequiredError } from './email-verification-required.ts';\nimport { ResetTokenExpiredError } from './token-expired.ts';\nimport { createValidator } from '@validup/zod';\nimport { randomBytes } from 'node:crypto';\nimport { Container } from 'validup';\nimport { z } from 'zod';\nimport { UserCredentialsService } from '../../authentication/credential/entities/user/module.ts';\nimport type {\n IPasswordRecoveryService,\n PasswordForgotResult,\n PasswordRecoveryServiceContext,\n PasswordRecoveryServiceOptions,\n PasswordResetResult,\n} from './types.ts';\nimport type { IMailClient } from '../../mail/types.ts';\nimport type { IRealmRepository, IUserRepository } from '../../entities/index.ts';\n\nexport class PasswordRecoveryService implements IPasswordRecoveryService {\n protected options: PasswordRecoveryServiceOptions;\n\n protected repository: IUserRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected mailClient: IMailClient;\n\n constructor(ctx: PasswordRecoveryServiceContext) {\n this.options = ctx.options;\n this.repository = ctx.repository;\n this.realmRepository = ctx.realmRepository;\n this.mailClient = ctx.mailClient;\n }\n\n async forgotPassword(data: Record<string, any>): Promise<PasswordForgotResult> {\n if (!this.options.passwordRecoveryEnabled) {\n throw new PasswordRecoveryDisabledError();\n }\n\n if (!this.options.emailVerificationEnabled) {\n throw new EmailVerificationRequiredError('Email verification is not enabled, but required to reset a password.');\n }\n\n const validated = await this.runForgotPasswordValidator(data);\n\n const realm = await this.realmRepository.resolve(validated.realm_id, true);\n\n const where: Record<string, any> = {\n ...(validated.name ? { name: validated.name } : {}),\n ...(validated.email ? { email: validated.email } : {}),\n realm_id: realm.id,\n };\n\n const entity = await this.repository.findOneByWithEmail(where);\n\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n const merged = this.repository.merge(entity, {\n reset_expires: new Date(Date.now() + (1000 * 60 * 30)).toISOString(),\n reset_hash: randomBytes(32).toString('hex'),\n });\n\n await this.repository.save(merged);\n\n try {\n await this.mailClient.send({\n to: entity.email,\n subject: 'Forgot Password - Reset code',\n html: `\n <p>Please use the code below to reset your account password.</p>\n <p>${merged.reset_hash}</p>\n `,\n });\n } catch {\n this.repository.merge(merged, {\n reset_hash: null,\n reset_expires: null,\n });\n await this.repository.save(merged);\n\n throw new BadRequestError('Password recovery failed. Could not send reset email.');\n }\n\n return { reset_expires: merged.reset_expires! };\n }\n\n async resetPassword(data: Record<string, any>): Promise<PasswordResetResult> {\n if (!this.options.passwordRecoveryEnabled) {\n throw new PasswordRecoveryDisabledError();\n }\n\n const validated = await this.runResetPasswordValidator(data);\n\n await this.repository.validateJoinColumns(validated);\n\n const realm = await this.realmRepository.resolve(validated.realm_id, true);\n\n const where: Record<string, any> = {\n ...(validated.name ? { name: validated.name } : {}),\n ...(validated.email ? { email: validated.email } : {}),\n reset_hash: validated.token,\n realm_id: realm.id,\n };\n\n const entity = await this.repository.findOneBy(where);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (!entity.reset_expires || new Date(entity.reset_expires) < new Date()) {\n throw new ResetTokenExpiredError();\n }\n\n const credentialsService = new UserCredentialsService();\n const hashedPassword = await credentialsService.protect(validated.password);\n\n const merged = this.repository.merge(entity, {\n reset_at: new Date().toISOString(),\n reset_hash: null,\n reset_expires: null,\n password: hashedPassword,\n });\n\n await this.repository.save(merged);\n\n return { reset_at: merged.reset_at! };\n }\n\n private async runForgotPasswordValidator(data: Record<string, any>) {\n const validator = new Container<any>({});\n\n const oneOfContainer = new Container({ oneOf: true });\n\n oneOfContainer.mount(\n 'email',\n createValidator(\n z.string()\n .trim()\n .toLowerCase()\n .email()\n .regex(/^[^A-Z]+$/, { message: 'Email must be lowercase.' }),\n ),\n );\n\n oneOfContainer.mount(\n 'name',\n createValidator(z.string().trim().toLowerCase().min(1)),\n );\n\n validator.mount(oneOfContainer);\n\n validator.mount(\n 'realm_id',\n { optional: true },\n createValidator(z.uuid().nullable()),\n );\n\n return validator.run(data);\n }\n\n private async runResetPasswordValidator(data: Record<string, any>) {\n const validator = new Container<any>({});\n\n const oneOfContainer = new Container({ oneOf: true });\n oneOfContainer.mount(\n 'email',\n createValidator(\n z.string()\n .trim()\n .toLowerCase()\n .email()\n .regex(/^[^A-Z]+$/, { message: 'Email must be lowercase.' }),\n ),\n );\n oneOfContainer.mount(\n 'name',\n createValidator(z.string().trim().toLowerCase().min(1)),\n );\n\n validator.mount(oneOfContainer);\n\n validator.mount(\n 'realm_id',\n { optional: true },\n createValidator(z.uuid().nullable()),\n );\n\n validator.mount(\n 'token',\n createValidator(z.string().min(3).max(256)),\n );\n\n validator.mount(\n 'password',\n createValidator(z.string().min(5).max(512)),\n );\n\n return validator.run(data);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,IAAaU,0BAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEAC;CAEV,YAAYC,KAAqC;EAC7C,KAAKJ,UAAUI,IAAIJ;EACnB,KAAKC,aAAaG,IAAIH;EACtB,KAAKC,kBAAkBE,IAAIF;EAC3B,KAAKC,aAAaC,IAAID;CAC1B;CAEA,MAAME,eAAeC,MAA0D;EAC3E,IAAI,CAAC,KAAKN,QAAQO,yBACd,MAAM,IAAIhB,8BAAAA;EAGd,IAAI,CAAC,KAAKS,QAAQQ,0BACd,MAAM,IAAIhB,+BAA+B,sEAAA;EAG7C,MAAMiB,YAAY,MAAM,KAAKC,2BAA2BJ,IAAAA;EAExD,MAAMK,QAAQ,MAAM,KAAKT,gBAAgBU,QAAQH,UAAUI,UAAU,IAAA;EAErE,MAAMC,QAA6B;GAC/B,GAAIL,UAAUM,OAAO,EAAEA,MAAMN,UAAUM,KAAK,IAAI,CAAC;GACjD,GAAIN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EAC/D,MAAMqC,YAAY,IAAI/C,UAAe,CAAC,CAAA;EAEtC,MAAMgD,iBAAiB,IAAIhD,UAAU,EAAEiD,OAAO,KAAK,CAAA;EACnDD,eAAeE,MACX,SACApD,gBACIG,EAAEkD,OAAM,CAAA,CACHC,KAAI,CAAA,CACJC,YAAW,CAAA,CACXjC,MAAK,CAAA,CACLkC,MAAM,aAAa,EAAEC,SAAS,2BAA2B,CAAA,CAAA,CAAA;EAGtEP,eAAeE,MACX,QACApD,gBAAgBG,EAAEkD,OAAM,CAAA,CAAGC,KAAI,CAAA,CAAGC,YAAW,CAAA,CAAGG,IAAI,CAAA,CAAA,CAAA;EAGxDT,UAAUG,MAAMF,cAAAA;EAEhBD,UAAUG,MACN,YACA,EAAEO,UAAU,KAAK,GACjB3D,gBAAgBG,EAAEyD,KAAI,CAAA,CAAGC,SAAQ,CAAA,CAAA;EAGrCZ,UAAUG,MACN,SACApD,gBAAgBG,EAAEkD,OAAM,CAAA,CAAGK,IAAI,CAAA,CAAA,CAAGK,IAAI,GAAA,CAAA,CAAA;EAG1Cd,UAAUG,MACN,YACApD,gBAAgBG,EAAEkD,OAAM,CAAA,CAAGK,IAAI,CAAA,CAAA,CAAGK,IAAI,GAAA,CAAA,CAAA;EAG1C,OAAOd,UAAUa,IAAIlD,IAAAA;CACzB;AACJ"}
|
|
1
|
+
{"version":3,"file":"service.mjs","names":["BadRequestError","EntityNotFoundError","PasswordRecoveryDisabledError","EmailVerificationRequiredError","ResetTokenExpiredError","createValidator","randomBytes","Container","z","UserCredentialsService","MailTemplateName","PASSWORD_RESET_EXPIRES_IN_MINUTES","PasswordRecoveryService","options","repository","realmRepository","mailClient","mailTemplateRenderer","ctx","forgotPassword","data","context","passwordRecoveryEnabled","emailVerificationEnabled","validated","runForgotPasswordValidator","realm","resolve","realm_id","where","name","email","id","entity","findOneByWithEmail","merged","merge","reset_expires","Date","now","toISOString","reset_hash","toString","save","resetUrl","publicUrl","replace","encodeURIComponent","undefined","mail","render","template","PASSWORD_RESET","params","code","url","expiresInMinutes","locale","send","to","resetPassword","runResetPasswordValidator","validateJoinColumns","token","findOneBy","credentialsService","hashedPassword","protect","password","reset_at","validator","oneOfContainer","oneOf","mount","string","trim","toLowerCase","regex","message","min","optional","uuid","nullable","run","max"],"sources":["../../../../src/core/identity/password-recovery/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BadRequestError, EntityNotFoundError } from '@authup/errors';\nimport { PasswordRecoveryDisabledError } from './disabled.ts';\nimport { EmailVerificationRequiredError } from './email-verification-required.ts';\nimport { ResetTokenExpiredError } from './token-expired.ts';\nimport { createValidator } from '@validup/zod';\nimport { randomBytes } from 'node:crypto';\nimport { Container } from 'validup';\nimport { z } from 'zod';\nimport { UserCredentialsService } from '../../authentication/credential/entities/user/module.ts';\nimport type {\n IPasswordRecoveryService,\n PasswordForgotResult,\n PasswordRecoveryServiceContext,\n PasswordRecoveryServiceOptions,\n PasswordResetResult,\n} from './types.ts';\nimport type { IMailClient, IMailTemplateRenderer } from '../../mail/types.ts';\nimport { MailTemplateName } from '../../mail/index.ts';\nimport type { IRealmRepository, IUserRepository } from '../../entities/index.ts';\nimport type { IdentityWorkflowContext } from '../types.ts';\nimport { PASSWORD_RESET_EXPIRES_IN_MINUTES } from './constants.ts';\n\nexport class PasswordRecoveryService implements IPasswordRecoveryService {\n protected options: PasswordRecoveryServiceOptions;\n\n protected repository: IUserRepository;\n\n protected realmRepository: IRealmRepository;\n\n protected mailClient: IMailClient;\n\n protected mailTemplateRenderer: IMailTemplateRenderer;\n\n constructor(ctx: PasswordRecoveryServiceContext) {\n this.options = ctx.options;\n this.repository = ctx.repository;\n this.realmRepository = ctx.realmRepository;\n this.mailClient = ctx.mailClient;\n this.mailTemplateRenderer = ctx.mailTemplateRenderer;\n }\n\n async forgotPassword(data: Record<string, any>, context?: IdentityWorkflowContext): Promise<PasswordForgotResult> {\n if (!this.options.passwordRecoveryEnabled) {\n throw new PasswordRecoveryDisabledError();\n }\n\n if (!this.options.emailVerificationEnabled) {\n throw new EmailVerificationRequiredError('Email verification is not enabled, but required to reset a password.');\n }\n\n const validated = await this.runForgotPasswordValidator(data);\n\n const realm = await this.realmRepository.resolve(validated.realm_id, true);\n\n const where: Record<string, any> = {\n ...(validated.name ? { name: validated.name } : {}),\n ...(validated.email ? { email: validated.email } : {}),\n realm_id: realm.id,\n };\n\n const entity = await this.repository.findOneByWithEmail(where);\n\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n const merged = this.repository.merge(entity, {\n reset_expires: new Date(\n Date.now() + (1000 * 60 * PASSWORD_RESET_EXPIRES_IN_MINUTES),\n ).toISOString(),\n reset_hash: randomBytes(32).toString('hex'),\n });\n\n await this.repository.save(merged);\n\n try {\n // realm_id MUST ride the link: resetPassword resolves the realm\n // from the request and filters the lookup by it, so a realm-less\n // link resolves to the master realm and never matches a\n // non-master user.\n const resetUrl = this.options.publicUrl ?\n `${this.options.publicUrl.replace(/\\/+$/, '')}/password-reset` +\n `?token=${encodeURIComponent(merged.reset_hash!)}` +\n `&realm_id=${encodeURIComponent(entity.realm_id)}` :\n undefined;\n\n const mail = await this.mailTemplateRenderer.render({\n template: MailTemplateName.PASSWORD_RESET,\n params: {\n code: merged.reset_hash!,\n url: resetUrl,\n expiresInMinutes: PASSWORD_RESET_EXPIRES_IN_MINUTES,\n },\n locale: context?.locale,\n });\n\n await this.mailClient.send({\n to: entity.email,\n ...mail,\n });\n } catch {\n this.repository.merge(merged, {\n reset_hash: null,\n reset_expires: null,\n });\n await this.repository.save(merged);\n\n throw new BadRequestError('Password recovery failed. Could not send reset email.');\n }\n\n return { reset_expires: merged.reset_expires! };\n }\n\n async resetPassword(data: Record<string, any>): Promise<PasswordResetResult> {\n if (!this.options.passwordRecoveryEnabled) {\n throw new PasswordRecoveryDisabledError();\n }\n\n const validated = await this.runResetPasswordValidator(data);\n\n await this.repository.validateJoinColumns(validated);\n\n const realm = await this.realmRepository.resolve(validated.realm_id, true);\n\n const where: Record<string, any> = {\n ...(validated.name ? { name: validated.name } : {}),\n ...(validated.email ? { email: validated.email } : {}),\n reset_hash: validated.token,\n realm_id: realm.id,\n };\n\n const entity = await this.repository.findOneBy(where);\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n if (!entity.reset_expires || new Date(entity.reset_expires) < new Date()) {\n throw new ResetTokenExpiredError();\n }\n\n const credentialsService = new UserCredentialsService();\n const hashedPassword = await credentialsService.protect(validated.password);\n\n const merged = this.repository.merge(entity, {\n reset_at: new Date().toISOString(),\n reset_hash: null,\n reset_expires: null,\n password: hashedPassword,\n });\n\n await this.repository.save(merged);\n\n return { reset_at: merged.reset_at! };\n }\n\n private async runForgotPasswordValidator(data: Record<string, any>) {\n const validator = new Container<any>({});\n\n const oneOfContainer = new Container({ oneOf: true });\n\n oneOfContainer.mount(\n 'email',\n createValidator(\n z.string()\n .trim()\n .toLowerCase()\n .email()\n .regex(/^[^A-Z]+$/, { message: 'Email must be lowercase.' }),\n ),\n );\n\n oneOfContainer.mount(\n 'name',\n createValidator(z.string().trim().toLowerCase().min(1)),\n );\n\n validator.mount(oneOfContainer);\n\n validator.mount(\n 'realm_id',\n { optional: true },\n createValidator(z.uuid().nullable()),\n );\n\n return validator.run(data);\n }\n\n private async runResetPasswordValidator(data: Record<string, any>) {\n const validator = new Container<any>({});\n\n const oneOfContainer = new Container({ oneOf: true });\n oneOfContainer.mount(\n 'email',\n createValidator(\n z.string()\n .trim()\n .toLowerCase()\n .email()\n .regex(/^[^A-Z]+$/, { message: 'Email must be lowercase.' }),\n ),\n );\n oneOfContainer.mount(\n 'name',\n createValidator(z.string().trim().toLowerCase().min(1)),\n );\n\n validator.mount(oneOfContainer);\n\n validator.mount(\n 'realm_id',\n { optional: true },\n createValidator(z.uuid().nullable()),\n );\n\n validator.mount(\n 'token',\n createValidator(z.string().min(3).max(256)),\n );\n\n validator.mount(\n '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AAW,CAAA,CACX7C,MAAK,CAAA,CACL8C,MAAM,aAAa,EAAEC,SAAS,2BAA2B,CAAA,CAAA,CAAA;EAGtEP,eAAeE,MACX,QACApE,gBAAgBG,EAAEkE,OAAM,CAAA,CAAGC,KAAI,CAAA,CAAGC,YAAW,CAAA,CAAGG,IAAI,CAAA,CAAA,CAAA;EAGxDT,UAAUG,MAAMF,cAAAA;EAEhBD,UAAUG,MACN,YACA,EAAEO,UAAU,KAAK,GACjB3E,gBAAgBG,EAAEyE,KAAI,CAAA,CAAGC,SAAQ,CAAA,CAAA;EAGrCZ,UAAUG,MACN,SACApE,gBAAgBG,EAAEkE,OAAM,CAAA,CAAGK,IAAI,CAAA,CAAA,CAAGK,IAAI,GAAA,CAAA,CAAA;EAG1Cd,UAAUG,MACN,YACApE,gBAAgBG,EAAEkE,OAAM,CAAA,CAAGK,IAAI,CAAA,CAAA,CAAGK,IAAI,GAAA,CAAA,CAAA;EAG1C,OAAOd,UAAUa,IAAI/D,IAAAA;CACzB;AACJ"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import type { IMailClient } from '../../mail/types.ts';
|
|
1
|
+
import type { IMailClient, IMailTemplateRenderer } from '../../mail/types.ts';
|
|
2
2
|
import type { IRealmRepository, IUserRepository } from '../../entities/index.ts';
|
|
3
|
+
import type { IdentityWorkflowContext } from '../types.ts';
|
|
3
4
|
export type PasswordRecoveryServiceOptions = {
|
|
4
5
|
passwordRecoveryEnabled?: boolean;
|
|
5
6
|
emailVerificationEnabled?: boolean;
|
|
7
|
+
publicUrl?: string;
|
|
6
8
|
};
|
|
7
9
|
export type PasswordRecoveryServiceContext = {
|
|
8
10
|
options: PasswordRecoveryServiceOptions;
|
|
9
11
|
mailClient: IMailClient;
|
|
12
|
+
mailTemplateRenderer: IMailTemplateRenderer;
|
|
10
13
|
repository: IUserRepository;
|
|
11
14
|
realmRepository: IRealmRepository;
|
|
12
15
|
};
|
|
@@ -17,7 +20,7 @@ export type PasswordResetResult = {
|
|
|
17
20
|
reset_at: string;
|
|
18
21
|
};
|
|
19
22
|
export interface IPasswordRecoveryService {
|
|
20
|
-
forgotPassword(data: Record<string, any
|
|
23
|
+
forgotPassword(data: Record<string, any>, context?: IdentityWorkflowContext): Promise<PasswordForgotResult>;
|
|
21
24
|
resetPassword(data: Record<string, any>): Promise<PasswordResetResult>;
|
|
22
25
|
}
|
|
23
26
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/password-recovery/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/password-recovery/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,MAAM,8BAA8B,GAAG;IACzC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IACzC,OAAO,EAAE,8BAA8B,CAAC;IACxC,UAAU,EAAE,WAAW,CAAC;IACxB,oBAAoB,EAAE,qBAAqB,CAAC;IAC5C,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACrC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC5G,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1E"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { IRegistrationService, RegistrationResult, RegistrationServiceContext, RegistrationServiceOptions } from './types.ts';
|
|
2
|
-
import type { IMailClient } from '../../mail/types.ts';
|
|
2
|
+
import type { IMailClient, IMailTemplateRenderer } from '../../mail/types.ts';
|
|
3
3
|
import type { IRealmRepository, IUserRepository } from '../../entities/index.ts';
|
|
4
|
+
import type { IdentityWorkflowContext } from '../types.ts';
|
|
4
5
|
export declare class RegistrationService implements IRegistrationService {
|
|
5
6
|
protected options: RegistrationServiceOptions;
|
|
6
7
|
protected mailClient: IMailClient;
|
|
8
|
+
protected mailTemplateRenderer: IMailTemplateRenderer;
|
|
7
9
|
protected repository: IUserRepository;
|
|
8
10
|
protected realmRepository: IRealmRepository;
|
|
9
11
|
constructor(ctx: RegistrationServiceContext);
|
|
10
|
-
register(data: Record<string, any
|
|
12
|
+
register(data: Record<string, any>, context?: IdentityWorkflowContext): Promise<RegistrationResult>;
|
|
11
13
|
activate(data: {
|
|
12
14
|
token: string;
|
|
13
15
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/registration/service.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACR,oBAAoB,EACpB,kBAAkB,EAClB,0BAA0B,EAC1B,0BAA0B,EAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/registration/service.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACR,oBAAoB,EACpB,kBAAkB,EAClB,0BAA0B,EAC1B,0BAA0B,EAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,qBAAa,mBAAoB,YAAW,oBAAoB;IAC5D,SAAS,CAAC,OAAO,EAAE,0BAA0B,CAAC;IAE9C,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;IAElC,SAAS,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;IAEtD,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC;IAEtC,SAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC;gBAEhC,GAAG,EAAE,0BAA0B;IAQrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsDnG,QAAQ,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAczD"}
|
|
@@ -2,6 +2,8 @@ import "node:path";
|
|
|
2
2
|
import "node:url";
|
|
3
3
|
import.meta.url;
|
|
4
4
|
import { UserCredentialsService } from "../../authentication/credential/entities/user/module.mjs";
|
|
5
|
+
import { MailTemplateName } from "../../mail/template/types.mjs";
|
|
6
|
+
import "../../mail/index.mjs";
|
|
5
7
|
import { RegistrationDisabledError } from "./error.mjs";
|
|
6
8
|
import { UserValidator } from "@authup/core-kit";
|
|
7
9
|
import { createNanoID } from "@authup/kit";
|
|
@@ -12,15 +14,17 @@ import { randomBytes } from "node:crypto";
|
|
|
12
14
|
var RegistrationService = class {
|
|
13
15
|
options;
|
|
14
16
|
mailClient;
|
|
17
|
+
mailTemplateRenderer;
|
|
15
18
|
repository;
|
|
16
19
|
realmRepository;
|
|
17
20
|
constructor(ctx) {
|
|
18
21
|
this.options = ctx.options;
|
|
19
22
|
this.mailClient = ctx.mailClient;
|
|
23
|
+
this.mailTemplateRenderer = ctx.mailTemplateRenderer;
|
|
20
24
|
this.repository = ctx.repository;
|
|
21
25
|
this.realmRepository = ctx.realmRepository;
|
|
22
26
|
}
|
|
23
|
-
async register(data) {
|
|
27
|
+
async register(data, context) {
|
|
24
28
|
if (!this.options.registrationEnabled) throw new RegistrationDisabledError();
|
|
25
29
|
const validator = new Container({});
|
|
26
30
|
validator.mount(new UserValidator({ pathsToInclude: [
|
|
@@ -42,13 +46,18 @@ var RegistrationService = class {
|
|
|
42
46
|
entity.realm_id = (await this.realmRepository.resolve(entity.realm_id, true)).id;
|
|
43
47
|
await this.repository.save(entity);
|
|
44
48
|
if (this.options.emailVerificationEnabled) try {
|
|
49
|
+
const activateUrl = this.options.publicUrl ? `${this.options.publicUrl.replace(/\/+$/, "")}/activate?token=${entity.activate_hash}` : void 0;
|
|
50
|
+
const mail = await this.mailTemplateRenderer.render({
|
|
51
|
+
template: MailTemplateName.REGISTRATION_ACTIVATION,
|
|
52
|
+
params: {
|
|
53
|
+
code: entity.activate_hash,
|
|
54
|
+
url: activateUrl
|
|
55
|
+
},
|
|
56
|
+
locale: context?.locale
|
|
57
|
+
});
|
|
45
58
|
await this.mailClient.send({
|
|
46
59
|
to: entity.email,
|
|
47
|
-
|
|
48
|
-
html: `
|
|
49
|
-
<p>Please use the code below to activate your account and start using the site.</p>
|
|
50
|
-
<p>${entity.activate_hash}</p>
|
|
51
|
-
`
|
|
60
|
+
...mail
|
|
52
61
|
});
|
|
53
62
|
} catch {
|
|
54
63
|
await this.repository.remove(entity);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.mjs","names":["UserValidator","createNanoID","BadRequestError","EntityNotFoundError","RegistrationDisabledError","randomBytes","Container","UserCredentialsService","RegistrationService","options","mailClient","repository","realmRepository","ctx","register","data","registrationEnabled","validator","mount","pathsToInclude","validated","run","group","validateJoinColumns","emailVerificationEnabled","active","activate_hash","toString","entity","create","credentialsService","password","protect","realm","resolve","realm_id","id","save","
|
|
1
|
+
{"version":3,"file":"service.mjs","names":["UserValidator","createNanoID","BadRequestError","EntityNotFoundError","RegistrationDisabledError","randomBytes","Container","UserCredentialsService","MailTemplateName","RegistrationService","options","mailClient","mailTemplateRenderer","repository","realmRepository","ctx","register","data","context","registrationEnabled","validator","mount","pathsToInclude","validated","run","group","validateJoinColumns","emailVerificationEnabled","active","activate_hash","toString","entity","create","credentialsService","password","protect","realm","resolve","realm_id","id","save","activateUrl","publicUrl","replace","undefined","mail","render","template","REGISTRATION_ACTIVATION","params","code","url","locale","send","to","email","remove","activate","findOneBy","token","merged","merge"],"sources":["../../../../src/core/identity/registration/service.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { UserValidator } from '@authup/core-kit';\nimport { createNanoID } from '@authup/kit';\nimport { BadRequestError, EntityNotFoundError } from '@authup/errors';\nimport { RegistrationDisabledError } from './error.ts';\nimport { randomBytes } from 'node:crypto';\nimport { Container } from 'validup';\nimport { UserCredentialsService } from '../../authentication/credential/entities/user/module.ts';\nimport type {\n IRegistrationService,\n RegistrationResult,\n RegistrationServiceContext,\n RegistrationServiceOptions,\n} from './types.ts';\nimport type { IMailClient, IMailTemplateRenderer } from '../../mail/types.ts';\nimport { MailTemplateName } from '../../mail/index.ts';\nimport type { IRealmRepository, IUserRepository } from '../../entities/index.ts';\nimport type { IdentityWorkflowContext } from '../types.ts';\n\nexport class RegistrationService implements IRegistrationService {\n protected options: RegistrationServiceOptions;\n\n protected mailClient: IMailClient;\n\n protected mailTemplateRenderer: IMailTemplateRenderer;\n\n protected repository: IUserRepository;\n\n protected realmRepository: IRealmRepository;\n\n constructor(ctx: RegistrationServiceContext) {\n this.options = ctx.options;\n this.mailClient = ctx.mailClient;\n this.mailTemplateRenderer = ctx.mailTemplateRenderer;\n this.repository = ctx.repository;\n this.realmRepository = ctx.realmRepository;\n }\n\n async register(data: Record<string, any>, context?: IdentityWorkflowContext): Promise<RegistrationResult> {\n if (!this.options.registrationEnabled) {\n throw new RegistrationDisabledError();\n }\n\n const validator = new Container({});\n validator.mount(new UserValidator({ pathsToInclude: ['email', 'name', 'password', 'realm_id'] }));\n const validated = await validator.run(data, { group: 'create' });\n\n await this.repository.validateJoinColumns(validated);\n\n if (this.options.emailVerificationEnabled) {\n validated.active = false;\n validated.activate_hash = randomBytes(32).toString('hex');\n } else {\n validated.active = true;\n }\n\n const entity = this.repository.create(validated);\n\n const credentialsService = new UserCredentialsService();\n entity.password = entity.password || createNanoID(64);\n entity.password = await credentialsService.protect(entity.password);\n\n const realm = await this.realmRepository.resolve(entity.realm_id, true);\n entity.realm_id = realm.id;\n\n await this.repository.save(entity);\n\n if (this.options.emailVerificationEnabled) {\n try {\n const activateUrl = this.options.publicUrl ?\n `${this.options.publicUrl.replace(/\\/+$/, '')}/activate?token=${entity.activate_hash}` :\n undefined;\n\n const mail = await this.mailTemplateRenderer.render({\n template: MailTemplateName.REGISTRATION_ACTIVATION,\n params: { code: entity.activate_hash!, url: activateUrl },\n locale: context?.locale,\n });\n\n await this.mailClient.send({\n to: entity.email,\n ...mail,\n });\n } catch {\n await this.repository.remove(entity);\n throw new BadRequestError('Registration failed. Could not send activation email.');\n }\n }\n\n return { active: entity.active };\n }\n\n async activate(data: { token: string }): Promise<void> {\n const entity = await this.repository.findOneBy({ activate_hash: data.token });\n\n if (!entity) {\n throw new EntityNotFoundError();\n }\n\n const merged = this.repository.merge(entity, {\n active: true,\n activate_hash: null,\n });\n\n await this.repository.save(mer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AQ,EAAA,EAAI,kBAAkBZ,OAAOF,kBACvEe,KAAAA;GAEJ,MAAMC,OAAO,MAAM,KAAKjC,qBAAqBkC,OAAO;IAChDC,UAAUvC,iBAAiBwC;IAC3BC,QAAQ;KAAEC,MAAMnB,OAAOF;KAAgBsB,KAAKV;IAAY;IACxDW,QAAQlC,SAASkC;GACrB,CAAA;GAEA,MAAM,KAAKzC,WAAW0C,KAAK;IACvBC,IAAIvB,OAAOwB;IACX,GAAGV;GACP,CAAA;EACJ,QAAQ;GACJ,MAAM,KAAKhC,WAAW2C,OAAOzB,MAAAA;GAC7B,MAAM,IAAI7B,gBAAgB,uDAAA;EAC9B;EAGJ,OAAO,EAAE0B,QAAQG,OAAOH,OAAO;CACnC;CAEA,MAAM6B,SAASxC,MAAwC;EACnD,MAAMc,SAAS,MAAM,KAAKlB,WAAW6C,UAAU,EAAE7B,eAAeZ,KAAK0C,MAAM,CAAA;EAE3E,IAAI,CAAC5B,QACD,MAAM,IAAI5B,oBAAAA;EAGd,MAAMyD,SAAS,KAAK/C,WAAWgD,MAAM9B,QAAQ;GACzCH,QAAQ;GACRC,eAAe;EACnB,CAAA;EAEA,MAAM,KAAKhB,WAAW2B,KAAKoB,MAAAA;CAC/B;AACJ"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import type { IMailClient } from '../../mail/types.ts';
|
|
1
|
+
import type { IMailClient, IMailTemplateRenderer } from '../../mail/types.ts';
|
|
2
2
|
import type { IRealmRepository, IUserRepository } from '../../entities/index.ts';
|
|
3
|
+
import type { IdentityWorkflowContext } from '../types.ts';
|
|
3
4
|
export type RegistrationServiceOptions = {
|
|
4
5
|
registrationEnabled?: boolean;
|
|
5
6
|
emailVerificationEnabled?: boolean;
|
|
7
|
+
publicUrl?: string;
|
|
6
8
|
};
|
|
7
9
|
export type RegistrationServiceContext = {
|
|
8
10
|
options: RegistrationServiceOptions;
|
|
9
11
|
mailClient: IMailClient;
|
|
12
|
+
mailTemplateRenderer: IMailTemplateRenderer;
|
|
10
13
|
repository: IUserRepository;
|
|
11
14
|
realmRepository: IRealmRepository;
|
|
12
15
|
};
|
|
@@ -14,7 +17,7 @@ export type RegistrationResult = {
|
|
|
14
17
|
active: boolean;
|
|
15
18
|
};
|
|
16
19
|
export interface IRegistrationService {
|
|
17
|
-
register(data: Record<string, any
|
|
20
|
+
register(data: Record<string, any>, context?: IdentityWorkflowContext): Promise<RegistrationResult>;
|
|
18
21
|
activate(data: {
|
|
19
22
|
token: string;
|
|
20
23
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/registration/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/registration/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,MAAM,0BAA0B,GAAG;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,0BAA0B,CAAC;IACpC,UAAU,EAAE,WAAW,CAAC;IACxB,oBAAoB,EAAE,qBAAqB,CAAC;IAC5C,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpG,QAAQ,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/role/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAErF,qBAAa,oBAAqB,YAAW,qBAAqB;IAC9D,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAE9C,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC;IAE1C,SAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC;gBAEhC,GAAG,EAAE,2BAA2B;IAMtC,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAkBjE,OAAO,CAAC,sBAAsB;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/core/identity/role/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAErF,qBAAa,oBAAqB,YAAW,qBAAqB;IAC9D,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAE9C,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC;IAE1C,SAAS,CAAC,eAAe,EAAE,gBAAgB,CAAC;gBAEhC,GAAG,EAAE,2BAA2B;IAMtC,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAkBjE,OAAO,CAAC,sBAAsB;CAiBjC"}
|
|
@@ -21,7 +21,7 @@ var IdentityRoleProvider = class {
|
|
|
21
21
|
}
|
|
22
22
|
reduceByIdentityClient(entities, identity) {
|
|
23
23
|
if (!identity.clientId) return entities;
|
|
24
|
-
return entities.filter((entity) => entity.client_id === identity.clientId);
|
|
24
|
+
return entities.filter((entity) => !entity.client_id || entity.client_id === identity.clientId);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","names":["IdentityRoleProvider","clientRepository","userRepository","robotRepository","ctx","getRolesFor","identity","type","getBoundRoles","id","then","data","reduceByIdentityClient","entities","clientId","filter","entity","client_id"],"sources":["../../../../src/core/identity/role/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Role } from '@authup/core-kit';\nimport type { IdentityPolicyData } from '@authup/access';\nimport type { IClientRepository } from '../../entities/client/types.ts';\nimport type { IRobotRepository } from '../../entities/robot/types.ts';\nimport type { IUserRepository } from '../../entities/user/types.ts';\nimport type { IIdentityRoleProvider, IdentityRoleProviderContext } from './types.ts';\n\nexport class IdentityRoleProvider implements IIdentityRoleProvider {\n protected clientRepository: IClientRepository;\n\n protected userRepository: IUserRepository;\n\n protected robotRepository: IRobotRepository;\n\n constructor(ctx: IdentityRoleProviderContext) {\n this.clientRepository = ctx.clientRepository;\n this.userRepository = ctx.userRepository;\n this.robotRepository = ctx.robotRepository;\n }\n\n async getRolesFor(identity: IdentityPolicyData) : Promise<Role[]> {\n switch (identity.type) {\n case 'client': {\n return this.clientRepository.getBoundRoles(identity.id);\n }\n case 'user': {\n return this.userRepository.getBoundRoles(identity.id)\n .then((data) => this.reduceByIdentityClient(data, identity));\n }\n case 'robot': {\n return this.robotRepository.getBoundRoles(identity.id)\n .then((data) => this.reduceByIdentityClient(data, identity));\n }\n }\n\n return [];\n }\n\n private reduceByIdentityClient<T extends { client_id?: string | null }>(\n entities: T[],\n identity: IdentityPolicyData,\n ): T[] {\n if (!identity.clientId) {\n return entities;\n }\n\n return entities.filter((entity) => entity.client_id === identity.clientId);\n }\n}\n"],"mappings":";;;;AAcA,IAAaA,uBAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEV,YAAYC,KAAkC;EAC1C,KAAKH,mBAAmBG,IAAIH;EAC5B,KAAKC,iBAAiBE,IAAIF;EAC1B,KAAKC,kBAAkBC,IAAID;CAC/B;CAEA,MAAME,YAAYC,UAAgD;EAC9D,QAAQA,SAASC,MAAjB;GACI,KAAK,UACD,OAAO,KAAKN,iBAAiBO,cAAcF,SAASG,EAAE;GAE1D,KAAK,QACD,OAAO,KAAKP,eAAeM,cAAcF,SAASG,EAAE,CAAA,CAC/CC,MAAMC,SAAS,KAAKC,uBAAuBD,MAAML,QAAAA,CAAAA;GAE1D,KAAK,SACD,OAAO,KAAKH,gBAAgBK,cAAcF,SAASG,EAAE,CAAA,CAChDC,MAAMC,SAAS,KAAKC,uBAAuBD,MAAML,QAAAA,CAAAA;EAE9D;EAEA,OAAO,CAAA;CACX;CAEQM,uBACJC,UACAP,UACG;EACH,IAAI,CAACA,SAASQ,UACV,OAAOD;
|
|
1
|
+
{"version":3,"file":"module.mjs","names":["IdentityRoleProvider","clientRepository","userRepository","robotRepository","ctx","getRolesFor","identity","type","getBoundRoles","id","then","data","reduceByIdentityClient","entities","clientId","filter","entity","client_id"],"sources":["../../../../src/core/identity/role/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Role } from '@authup/core-kit';\nimport type { IdentityPolicyData } from '@authup/access';\nimport type { IClientRepository } from '../../entities/client/types.ts';\nimport type { IRobotRepository } from '../../entities/robot/types.ts';\nimport type { IUserRepository } from '../../entities/user/types.ts';\nimport type { IIdentityRoleProvider, IdentityRoleProviderContext } from './types.ts';\n\nexport class IdentityRoleProvider implements IIdentityRoleProvider {\n protected clientRepository: IClientRepository;\n\n protected userRepository: IUserRepository;\n\n protected robotRepository: IRobotRepository;\n\n constructor(ctx: IdentityRoleProviderContext) {\n this.clientRepository = ctx.clientRepository;\n this.userRepository = ctx.userRepository;\n this.robotRepository = ctx.robotRepository;\n }\n\n async getRolesFor(identity: IdentityPolicyData) : Promise<Role[]> {\n switch (identity.type) {\n case 'client': {\n return this.clientRepository.getBoundRoles(identity.id);\n }\n case 'user': {\n return this.userRepository.getBoundRoles(identity.id)\n .then((data) => this.reduceByIdentityClient(data, identity));\n }\n case 'robot': {\n return this.robotRepository.getBoundRoles(identity.id)\n .then((data) => this.reduceByIdentityClient(data, identity));\n }\n }\n\n return [];\n }\n\n private reduceByIdentityClient<T extends { client_id?: string | null }>(\n entities: T[],\n identity: IdentityPolicyData,\n ): T[] {\n if (!identity.clientId) {\n return entities;\n }\n\n // Keep client-agnostic (global / realm) roles — client_id null — in\n // addition to roles scoped to the authenticating client. Dropping the\n // null case stripped every global/realm role from a token issued via\n // a real client (e.g. the per-realm `web` client used by the\n // realm-selection login), leaving permissions/roles empty.\n return entities.filter(\n (entity) => !entity.client_id || entity.client_id === identity.clientId,\n );\n }\n}\n"],"mappings":";;;;AAcA,IAAaA,uBAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEV,YAAYC,KAAkC;EAC1C,KAAKH,mBAAmBG,IAAIH;EAC5B,KAAKC,iBAAiBE,IAAIF;EAC1B,KAAKC,kBAAkBC,IAAID;CAC/B;CAEA,MAAME,YAAYC,UAAgD;EAC9D,QAAQA,SAASC,MAAjB;GACI,KAAK,UACD,OAAO,KAAKN,iBAAiBO,cAAcF,SAASG,EAAE;GAE1D,KAAK,QACD,OAAO,KAAKP,eAAeM,cAAcF,SAASG,EAAE,CAAA,CAC/CC,MAAMC,SAAS,KAAKC,uBAAuBD,MAAML,QAAAA,CAAAA;GAE1D,KAAK,SACD,OAAO,KAAKH,gBAAgBK,cAAcF,SAASG,EAAE,CAAA,CAChDC,MAAMC,SAAS,KAAKC,uBAAuBD,MAAML,QAAAA,CAAAA;EAE9D;EAEA,OAAO,CAAA;CACX;CAEQM,uBACJC,UACAP,UACG;EACH,IAAI,CAACA,SAASQ,UACV,OAAOD;EAQX,OAAOA,SAASE,QACXC,WAAW,CAACA,OAAOC,aAAaD,OAAOC,cAAcX,SAASQ,QAAQ;CAE/E;AACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-request ambience the HTTP adapter passes alongside the raw payload of
|
|
3
|
+
* an identity workflow (registration, password recovery, ...). Carries no
|
|
4
|
+
* business data — only context such as the requester's preferred locale,
|
|
5
|
+
* which drives outbound mail localization.
|
|
6
|
+
*/
|
|
7
|
+
export type IdentityWorkflowContext = {
|
|
8
|
+
locale?: string;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/identity/types.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
package/dist/core/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { CredentialsAuthenticator } from "./authentication/module.mjs";
|
|
|
12
12
|
import { SessionManager } from "./authentication/session/module.mjs";
|
|
13
13
|
import "./authentication/index.mjs";
|
|
14
14
|
import { ClientService } from "./entities/client/service.mjs";
|
|
15
|
+
import { WebClientProvisioner, buildWebClientAttributes } from "./entities/client/web-client.mjs";
|
|
15
16
|
import { ClientPermissionService } from "./entities/client-permission/service.mjs";
|
|
16
17
|
import { ClientRoleService } from "./entities/client-role/service.mjs";
|
|
17
18
|
import { ClientScopeService } from "./entities/client-scope/service.mjs";
|
|
@@ -32,6 +33,11 @@ import { UserPermissionService } from "./entities/user-permission/service.mjs";
|
|
|
32
33
|
import { UserRoleService } from "./entities/user-role/service.mjs";
|
|
33
34
|
import { IdentityProviderRoleMappingService } from "./entities/identity-provider-role-mapping/service.mjs";
|
|
34
35
|
import "./entities/index.mjs";
|
|
36
|
+
import { defineMailTemplate } from "./mail/template/define.mjs";
|
|
37
|
+
import { MailTemplateName } from "./mail/template/types.mjs";
|
|
38
|
+
import { MAIL_TEMPLATE_REGISTRY } from "./mail/template/registry.mjs";
|
|
39
|
+
import { MailTemplateRenderer } from "./mail/renderer.mjs";
|
|
40
|
+
import "./mail/index.mjs";
|
|
35
41
|
import { OAuth2AuthorizationCodeIssuer } from "./oauth2/authorization/code/issuer/module.mjs";
|
|
36
42
|
import { base64URLEncode, buildOAuth2CodeChallenge, buildOAuth2TokenHash, generateOAuth2CodeVerifier } from "./oauth2/authorization/helpers.mjs";
|
|
37
43
|
import { OAuth2AuthorizationCodeVerifier } from "./oauth2/authorization/code/verifier/module.mjs";
|
|
@@ -56,6 +62,7 @@ import { OAuth2TokenRevoker } from "./oauth2/token/revoker/module.mjs";
|
|
|
56
62
|
import { OAuth2TokenSigner } from "./oauth2/token/signer/module.mjs";
|
|
57
63
|
import { OAuth2TokenVerifier } from "./oauth2/token/verifier/module.mjs";
|
|
58
64
|
import "./oauth2/index.mjs";
|
|
65
|
+
import { PASSWORD_RESET_EXPIRES_IN_MINUTES } from "./identity/password-recovery/constants.mjs";
|
|
59
66
|
import { PasswordRecoveryService } from "./identity/password-recovery/service.mjs";
|
|
60
67
|
import { PermissionBindingPolicyEvaluator } from "./security/policy/evaluator.mjs";
|
|
61
68
|
import { PolicyEngine } from "./security/policy/engine.mjs";
|
|
@@ -107,4 +114,4 @@ import { ScopeProvisioningSynchronizer } from "./provisioning/synchronizer/scope
|
|
|
107
114
|
import { UserProvisioningSynchronizer } from "./provisioning/synchronizer/user/module.mjs";
|
|
108
115
|
import "./provisioning/index.mjs";
|
|
109
116
|
import "./security/index.mjs";
|
|
110
|
-
export { BaseCredentialsAuthenticator, ClientAuthenticator, ClientCredentialsGrant, ClientCredentialsService, ClientPermissionService, ClientProvisioningSynchronizer, ClientProvisioningValidator, ClientRoleService, ClientScopeService, ClientService, CredentialsAuthenticator, GraphProvisioningSynchronizer, IDENTITY_PROVIDER_LDAP_COLLECTION_AUTHENTICATOR_TOKEN, IdentityGrantType, IdentityPermissionProvider, IdentityProviderAccountBaseMapper, IdentityProviderAccountManager, IdentityProviderAttributeMapper, IdentityProviderFacebookAuthenticator, IdentityProviderGithubAuthenticator, IdentityProviderGoogleAuthenticator, IdentityProviderInstagramAuthenticator, IdentityProviderLdapAuthenticator, IdentityProviderLdapCollectionAuthenticator, IdentityProviderMapperOperation, IdentityProviderOAuth2Authenticator, IdentityProviderOpenIDAuthenticator, IdentityProviderPaypalAuthenticator, IdentityProviderPermissionMapper, IdentityProviderRoleMapper, IdentityProviderRoleMappingService, IdentityResolver, IdentityRoleProvider, OAuth2AccessTokenIssuer, OAuth2Authorization, OAuth2AuthorizationCodeIssuer, OAuth2AuthorizationCodeRequestValidator, OAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationCodeVerifier, OAuth2AuthorizationStateManager, OAuth2AuthorizeGrant, OAuth2ClientAuthenticator, OAuth2OpenIDClaimsBuilder, OAuth2OpenIDTokenIssuer, OAuth2RefreshTokenGrant, OAuth2RefreshTokenIssuer, OAuth2ScopeAttributesResolver, OAuth2TokenRevoker, OAuth2TokenSigner, OAuth2TokenVerifier, PasswordGrantType, PasswordRecoveryService, PermissionBindingPolicyEvaluator, PermissionCheckerService, PermissionPolicyService, PermissionProvisioningSynchronizer, PermissionProvisioningValidator, PermissionService, PolicyCheckerService, PolicyEngine, PolicyProvisioningSynchronizer, PolicyService, ProvisioningEntityResolver, ProvisioningEntityStrategyType, ProvisioningJunctionSynchronizer, ProvisioningStrategyValidator, RealmProvisioningSynchronizer, RealmProvisioningValidator, RealmService, RegistrationService, RobotAuthenticator, RobotCredentialsGrant, RobotCredentialsService, RobotPermissionService, RobotProvisioningSynchronizer, RobotProvisioningValidator, RobotRoleService, RobotService, RoleAttributeService, RolePermissionService, RoleProvisioningSynchronizer, RoleProvisioningValidator, RoleService, RootProvisioningValidator, ScopeProvisioningSynchronizer, ScopeProvisioningValidator, ScopeService, SessionManager, UserAttributeService, UserAuthenticator, UserCredentialsService, UserPermissionService, UserProvisioningSynchronizer, UserProvisioningValidator, UserRoleService, UserService, base64URLEncode, buildOAuth2BearerTokenResponse, buildOAuth2CodeChallenge, buildOAuth2TokenHash, createIdentityProviderOAuth2Authenticator, generateOAuth2CodeVerifier, normalizeEntityProvisioningStrategy };
|
|
117
|
+
export { BaseCredentialsAuthenticator, ClientAuthenticator, ClientCredentialsGrant, ClientCredentialsService, ClientPermissionService, ClientProvisioningSynchronizer, ClientProvisioningValidator, ClientRoleService, ClientScopeService, ClientService, CredentialsAuthenticator, GraphProvisioningSynchronizer, IDENTITY_PROVIDER_LDAP_COLLECTION_AUTHENTICATOR_TOKEN, IdentityGrantType, IdentityPermissionProvider, IdentityProviderAccountBaseMapper, IdentityProviderAccountManager, IdentityProviderAttributeMapper, IdentityProviderFacebookAuthenticator, IdentityProviderGithubAuthenticator, IdentityProviderGoogleAuthenticator, IdentityProviderInstagramAuthenticator, IdentityProviderLdapAuthenticator, IdentityProviderLdapCollectionAuthenticator, IdentityProviderMapperOperation, IdentityProviderOAuth2Authenticator, IdentityProviderOpenIDAuthenticator, IdentityProviderPaypalAuthenticator, IdentityProviderPermissionMapper, IdentityProviderRoleMapper, IdentityProviderRoleMappingService, IdentityResolver, IdentityRoleProvider, MAIL_TEMPLATE_REGISTRY, MailTemplateName, MailTemplateRenderer, OAuth2AccessTokenIssuer, OAuth2Authorization, OAuth2AuthorizationCodeIssuer, OAuth2AuthorizationCodeRequestValidator, OAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationCodeVerifier, OAuth2AuthorizationStateManager, OAuth2AuthorizeGrant, OAuth2ClientAuthenticator, OAuth2OpenIDClaimsBuilder, OAuth2OpenIDTokenIssuer, OAuth2RefreshTokenGrant, OAuth2RefreshTokenIssuer, OAuth2ScopeAttributesResolver, OAuth2TokenRevoker, OAuth2TokenSigner, OAuth2TokenVerifier, PASSWORD_RESET_EXPIRES_IN_MINUTES, PasswordGrantType, PasswordRecoveryService, PermissionBindingPolicyEvaluator, PermissionCheckerService, PermissionPolicyService, PermissionProvisioningSynchronizer, PermissionProvisioningValidator, PermissionService, PolicyCheckerService, PolicyEngine, PolicyProvisioningSynchronizer, PolicyService, ProvisioningEntityResolver, ProvisioningEntityStrategyType, ProvisioningJunctionSynchronizer, ProvisioningStrategyValidator, RealmProvisioningSynchronizer, RealmProvisioningValidator, RealmService, RegistrationService, RobotAuthenticator, RobotCredentialsGrant, RobotCredentialsService, RobotPermissionService, RobotProvisioningSynchronizer, RobotProvisioningValidator, RobotRoleService, RobotService, RoleAttributeService, RolePermissionService, RoleProvisioningSynchronizer, RoleProvisioningValidator, RoleService, RootProvisioningValidator, ScopeProvisioningSynchronizer, ScopeProvisioningValidator, ScopeService, SessionManager, UserAttributeService, UserAuthenticator, UserCredentialsService, UserPermissionService, UserProvisioningSynchronizer, UserProvisioningValidator, UserRoleService, UserService, WebClientProvisioner, base64URLEncode, buildOAuth2BearerTokenResponse, buildOAuth2CodeChallenge, buildOAuth2TokenHash, buildWebClientAttributes, createIdentityProviderOAuth2Authenticator, defineMailTemplate, generateOAuth2CodeVerifier, normalizeEntityProvisioningStrategy };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MailActionBlock, MailCodeBlock, MailNoteBlock, MailParagraphBlock } from './types.ts';
|
|
2
|
+
export declare function paragraph(text: string): MailParagraphBlock;
|
|
3
|
+
export declare function code(label: string, value: string): MailCodeBlock;
|
|
4
|
+
export declare function action(label: string, url: string): MailActionBlock;
|
|
5
|
+
export declare function note(text: string): MailNoteBlock;
|
|
6
|
+
/**
|
|
7
|
+
* Only http(s) URLs may become call-to-action links. Action URLs are built
|
|
8
|
+
* from `publicUrl` config today, so this is defense in depth against a
|
|
9
|
+
* future caller passing an attacker-influenced value (e.g. `javascript:`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function isSafeActionURL(input: string): boolean;
|
|
12
|
+
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../../src/core/mail/format/blocks.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,EACrB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAE1D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAMhE;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,eAAe,CAMlE;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAUtD"}
|