@baseplate-dev/plugin-auth 0.6.17 → 0.6.19
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/CHANGELOG.md +54 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +74 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +74 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +37 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +37 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.js +1 -2
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.tsx +1 -1
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +74 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +74 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +37 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +74 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.js +1 -2
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.tsx +1 -1
- package/dist/better-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +37 -0
- package/dist/better-auth/core/node.js +7 -8
- package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/index.d.ts +1 -0
- package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/ts-import-providers.d.ts +1 -0
- package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/ts-import-providers.js +1 -0
- package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.d.ts +20 -3
- package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.js +5 -24
- package/dist/better-auth/generators/fastify/better-auth-module/generated/index.d.ts +40 -2
- package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.d.ts +19 -1
- package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.js +6 -2
- package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.d.ts +1 -0
- package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.js +1 -0
- package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.d.ts +20 -1
- package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.js +4 -1
- package/dist/better-auth/generators/fastify/better-auth-module/templates/module/services/auth.ts +16 -8
- package/dist/better-auth/generators/react/better-auth-hooks/better-auth-hooks.generator.d.ts +1 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/index.d.ts +5 -4
- package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.d.ts +1 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.js +1 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.d.ts +2 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.js +2 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.d.ts +6 -6
- package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.js +13 -13
- package/dist/better-auth/generators/react/better-auth-hooks/templates/src/hooks/{use-required-user-id.ts → use-user-id-or-throw.ts} +1 -1
- package/dist/better-auth/generators/react/better-auth-pages/better-auth-pages.generator.d.ts +37 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/index.d.ts +222 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.d.ts +37 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.d.ts +370 -0
- package/dist/better-auth/generators/react/better-auth-pages/templates/routes/forgot-password.tsx +1 -4
- package/dist/better-auth/generators/react/react-better-auth/generated/index.d.ts +77 -2
- package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.d.ts +38 -1
- package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.d.ts +1 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.js +1 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.d.ts +38 -1
- package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.d.ts +38 -1
- package/dist/better-auth/generators/react/react-better-auth/templates/src/app/auth-loaded-gate.tsx +12 -3
- package/dist/local-auth/admin/common.js +6 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.d.ts +593 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.js +119 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.d.ts +602 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.js +11 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.js +24 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.d.ts +307 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.js +45 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.d.ts +294 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.js +21 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.d.ts +2 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.js +2 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.d.ts +21 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.js +68 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.tsx +122 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +74 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +74 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +37 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +37 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.js +1 -2
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.tsx +1 -1
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +74 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +74 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +37 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +74 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.js +1 -2
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.tsx +1 -1
- package/dist/local-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +37 -0
- package/dist/local-auth/admin/node.js +13 -0
- package/dist/local-auth/admin/schema/invite-user-action.d.ts +12 -0
- package/dist/local-auth/admin/schema/invite-user-action.js +6 -0
- package/dist/local-auth/admin/web.js +8 -0
- package/dist/local-auth/core/common.js +7 -2
- package/dist/local-auth/core/components/local-auth-definition-editor.js +2 -1
- package/dist/local-auth/core/components/local-auth-web-app-settings-form.d.ts +9 -0
- package/dist/local-auth/core/components/local-auth-web-app-settings-form.js +11 -0
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +16 -7
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js +73 -16
- package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +222 -7
- package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts +5 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js +5 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts +27 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js +71 -4
- package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.d.ts +1 -3
- package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.js +1 -2
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +226 -10
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +91 -7
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.d.ts +19 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.js +20 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.ts +22 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts +12 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js +12 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.ts +14 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.js +30 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.ts +38 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.js +42 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.ts +54 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.js +2 -19
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.ts +1 -22
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.d.ts +37 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.js +225 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.ts +333 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.js +2 -3
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.ts +5 -3
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.d.ts +39 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.js +142 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.ts +221 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +5 -6
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +8 -5
- package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts +3 -1
- package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js +18 -3
- package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts +40 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js +2 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js +20 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts +40 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js +24 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.js +18 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.tsx +57 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.js +14 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.tsx +47 -0
- package/dist/local-auth/core/generators/auth-hooks/auth-hooks.generator.d.ts +272 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/index.d.ts +547 -4
- package/dist/local-auth/core/generators/auth-hooks/generated/template-paths.d.ts +1 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/template-paths.js +1 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/template-renderers.d.ts +271 -0
- package/dist/local-auth/core/generators/auth-hooks/generated/template-renderers.js +4 -2
- package/dist/local-auth/core/generators/auth-hooks/generated/ts-import-providers.d.ts +2 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/ts-import-providers.js +2 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/typed-templates.d.ts +548 -6
- package/dist/local-auth/core/generators/auth-hooks/generated/typed-templates.js +15 -14
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-log-out.js +1 -1
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-log-out.ts +1 -1
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-session.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-session.ts +7 -0
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +23 -7
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +7 -26
- package/dist/local-auth/core/generators/auth-module/generated/index.d.ts +65 -4
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.d.ts +1 -1
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.js +1 -1
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts +22 -1
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.js +19 -2
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.d.ts +10 -0
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.js +7 -0
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts +42 -4
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.js +24 -13
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.d.ts +4 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.js +1 -1
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.ts +1 -1
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.d.ts +67 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.js +140 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.ts +191 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/user-session.service.js +8 -9
- package/dist/local-auth/core/generators/auth-module/templates/module/services/user-session.service.ts +10 -11
- package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.d.ts +39 -0
- package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js +38 -5
- package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts +1089 -268
- package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js +3 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts +49 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js +51 -0
- package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.d.ts +1 -0
- package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.js +1 -0
- package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts +918 -283
- package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js +69 -23
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.d.ts +9 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.js +10 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.ts +11 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.js +155 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.tsx +274 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.js +1 -2
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.tsx +1 -1
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.js +184 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.tsx +312 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +5 -5
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +6 -12
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js +4 -4
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.tsx +4 -3
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js +1 -2
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.tsx +1 -1
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.js +1 -2
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.tsx +1 -1
- package/dist/local-auth/core/generators/react-session/generated/index.d.ts +90 -7
- package/dist/local-auth/core/generators/react-session/generated/template-renderers.d.ts +38 -1
- package/dist/local-auth/core/generators/react-session/generated/ts-import-providers.d.ts +1 -0
- package/dist/local-auth/core/generators/react-session/generated/ts-import-providers.js +1 -0
- package/dist/local-auth/core/generators/react-session/generated/typed-templates.d.ts +102 -12
- package/dist/local-auth/core/generators/react-session/generated/typed-templates.js +5 -2
- package/dist/local-auth/core/generators/react-session/react-session.generator.d.ts +54 -1
- package/dist/local-auth/core/generators/react-session/react-session.generator.js +35 -1
- package/dist/local-auth/core/generators/react-session/templates/src/app/user-session-provider.js +17 -44
- package/dist/local-auth/core/generators/react-session/templates/src/app/user-session-provider.tsx +21 -49
- package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.d.ts +43 -34
- package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.js +96 -80
- package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.ts +148 -82
- package/dist/local-auth/core/generators/seed-initial-user/generated/index.d.ts +0 -2
- package/dist/local-auth/core/generators/seed-initial-user/generated/template-renderers.d.ts +0 -1
- package/dist/local-auth/core/generators/seed-initial-user/generated/typed-templates.d.ts +0 -1
- package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.d.ts +0 -1
- package/dist/local-auth/core/node.js +30 -12
- package/dist/local-auth/core/schema/migrations.d.ts +3 -0
- package/dist/local-auth/core/schema/migrations.js +36 -0
- package/dist/local-auth/core/schema/models.js +8 -0
- package/dist/local-auth/core/schema/plugin-definition.d.ts +1 -0
- package/dist/local-auth/core/schema/plugin-definition.js +1 -0
- package/dist/local-auth/core/schema/web-app-schema.d.ts +15 -0
- package/dist/local-auth/core/schema/web-app-schema.js +16 -0
- package/dist/local-auth/core/web.js +8 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/index.d.ts +4 -3
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/template-paths.d.ts +1 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/template-paths.js +1 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/ts-import-providers.d.ts +2 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/ts-import-providers.js +2 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/typed-templates.d.ts +4 -4
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/typed-templates.js +13 -13
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/placeholder-auth-hooks.generator.d.ts +1 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/templates/src/hooks/use-session.d.ts +1 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/templates/src/hooks/use-session.ts +2 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/index.d.ts +1 -2
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/template-renderers.d.ts +0 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/ts-import-providers.d.ts +1 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/ts-import-providers.js +1 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/typed-templates.d.ts +0 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/placeholder-auth-module.generator.d.ts +0 -1
- package/dist/web/assets/{_virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth-ChkXxpXe.js → _virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth__mf_owner__1-DUupKqD4.js} +42 -34
- package/dist/web/assets/{dist-DY7ZXvq4.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-DE4rTqEA.js} +16857 -381
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-37vlYRxk.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-mszeXpf-.js} +90 -38
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-DRSNXPPo.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-CtIleM_e.js} +4095 -2399
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-DfiQqvVC.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-BckLhSjF.js} +212 -57
- package/dist/web/assets/auth-DR6QxrAW.js +1 -0
- package/dist/web/assets/{common-iHaemino.js → common-BsyRiQi3.js} +6 -6
- package/dist/web/assets/{common-TDf_PrjX.js → common-CRwNlCMn.js} +10 -10
- package/dist/web/assets/{common-ByxS61u8.js → common-CvqlRZC9.js} +12 -12
- package/dist/web/assets/common-D3atSs7O.js +70 -0
- package/dist/web/assets/common-DuFyXa6l.js +36 -0
- package/dist/web/assets/common-islduJTj.js +43 -0
- package/dist/web/assets/{dist-CrLSslv6.js → dist-DQd1TAJX.js} +273 -132
- package/dist/web/assets/{get-auth-plugin-definition-kDCtXq_6.js → get-auth-plugin-definition-BgWWHl_Y.js} +3 -3
- package/dist/web/assets/{hostInit-Cruek6c6.js → hostInit-DNA4kLRY.js} +32 -5
- package/dist/web/assets/{mf-entry-bootstrap-0-dfed0275.js → mf-entry-bootstrap-0-ea77c09b.js} +2 -1
- package/dist/web/assets/{mf-entry-bootstrap-1-5275674a.js → mf-entry-bootstrap-1-9dee3d8d.js} +3 -2
- package/dist/web/assets/{mf-entry-bootstrap-2-39fb9255.js → mf-entry-bootstrap-2-3179040b.js} +3 -2
- package/dist/web/assets/{mf-entry-bootstrap-3-49e64336.js → mf-entry-bootstrap-3-370d200d.js} +3 -2
- package/dist/web/assets/{models-DSvs_3bA.js → models-BOeSYfRn.js} +4 -5
- package/dist/web/assets/{models-BZmCbizK.js → models-DF6DoXt6.js} +11 -6
- package/dist/web/assets/{plugin-definition-CYj29S3q.js → plugin-definition--k0VAeK3.js} +9 -10
- package/dist/web/assets/plugin-definition-CMwSlxsJ.js +10 -0
- package/dist/web/assets/{styles-yjbHBTlw.js → styles-BQEcQHoR.js} +9 -10
- package/dist/web/assets/{virtualExposes-CbPBmicF.js → virtualExposes-C7fDiAmS.js} +1 -1
- package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-BZBRyml2.js +747 -0
- package/dist/web/assets/{virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-B6BXIeF1.js → virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-6SjVUCs8.js} +13 -13
- package/dist/web/assets/web-8wz0ad-V.js +59 -0
- package/dist/web/assets/{web-CXAHKjIY.js → web-BGixH_gT.js} +27 -27
- package/dist/web/assets/{web-1eTcxMhf.js → web-BxIwkN3O.js} +6 -6
- package/dist/web/assets/{web-VqBA3jxZ.js → web-CQMfABjr.js} +24 -24
- package/dist/web/assets/{web-CDAKPPK9.js → web-CcNpItSu.js} +22 -22
- package/dist/web/assets/web-CypPeiVv.js +148 -0
- package/dist/web/assets/{web-D0MSKfyv.js → web-CzK_la2_.js} +53 -53
- package/dist/web/index.html +5 -5
- package/dist/web/remoteEntry.js +1 -1
- package/package.json +14 -14
- package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.d.ts +0 -38
- package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.js +0 -71
- package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.ts +0 -77
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-CO5Pvo0y.js +0 -384
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.js-BEZ7A-cz.js +0 -13566
- package/dist/web/assets/auth-BxAE0rgh.js +0 -1
- package/dist/web/assets/common-CKl_XlvH.js +0 -37
- package/dist/web/assets/common-UpVCKZeW.js +0 -41
- package/dist/web/assets/common-crSwCD36.js +0 -37
- package/dist/web/assets/model-utils-C0WDb_Ec.js +0 -1599
- package/dist/web/assets/plugin-definition-DOMmPL2Z.js +0 -11
- package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-XM6iYVxf.js +0 -259
- package/dist/web/assets/virtual_mf-exposes-ssr___mfe_internal__plugin-auth__remoteEntry_js-DGjg7Brm.js +0 -129
- package/dist/web/assets/web-DbeAaDTV.js +0 -118
- package/dist/web/assets/web-miDovYk_.js +0 -46
- package/dist/web/remoteEntry.ssr.js +0 -43
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { createTsTemplateFile } from '@baseplate-dev/core-generators';
|
|
2
|
-
import { configServiceImportsProvider, errorHandlerServiceImportsProvider, passwordHasherServiceImportsProvider, pothosImportsProvider, prismaGeneratedImportsProvider, prismaImportsProvider, requestServiceContextImportsProvider, userSessionTypesImportsProvider, } from '@baseplate-dev/fastify-generators';
|
|
2
|
+
import { appUrlsImportsProvider, configServiceImportsProvider, errorHandlerServiceImportsProvider, passwordHasherServiceImportsProvider, pothosImportsProvider, prismaGeneratedImportsProvider, prismaImportsProvider, requestServiceContextImportsProvider, userSessionTypesImportsProvider, } from '@baseplate-dev/fastify-generators';
|
|
3
3
|
import { rateLimitImportsProvider } from '@baseplate-dev/plugin-rate-limit';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { authModuleImportsProvider } from '#src/local-auth/core/generators/auth-module/generated/ts-import-providers.js';
|
|
6
|
+
const constantsOtp = createTsTemplateFile({
|
|
7
|
+
fileOptions: { kind: 'singleton' },
|
|
8
|
+
importMapProviders: {},
|
|
9
|
+
name: 'constants-otp',
|
|
10
|
+
source: {
|
|
11
|
+
path: path.join(import.meta.dirname, '../templates/module/constants/otp.constants.ts'),
|
|
12
|
+
},
|
|
13
|
+
variables: {},
|
|
14
|
+
});
|
|
6
15
|
const constantsPassword = createTsTemplateFile({
|
|
7
16
|
fileOptions: { kind: 'singleton' },
|
|
8
17
|
group: 'module',
|
|
@@ -41,14 +50,18 @@ const schemaUserPasswordMutations = createTsTemplateFile({
|
|
|
41
50
|
source: {
|
|
42
51
|
path: path.join(import.meta.dirname, '../templates/module/schema/user-password.mutations.ts'),
|
|
43
52
|
},
|
|
44
|
-
variables: {
|
|
53
|
+
variables: {
|
|
54
|
+
TPL_ADMIN_ROLES: {},
|
|
55
|
+
TPL_REGISTER_MUTATION: {},
|
|
56
|
+
TPL_USER_OBJECT_TYPE: {},
|
|
57
|
+
},
|
|
45
58
|
});
|
|
46
59
|
const servicesPasswordReset = createTsTemplateFile({
|
|
47
60
|
fileOptions: { kind: 'singleton' },
|
|
48
61
|
group: 'module',
|
|
49
62
|
importMapProviders: {
|
|
63
|
+
appUrlsImports: appUrlsImportsProvider,
|
|
50
64
|
authModuleImports: authModuleImportsProvider,
|
|
51
|
-
configServiceImports: configServiceImportsProvider,
|
|
52
65
|
errorHandlerServiceImports: errorHandlerServiceImportsProvider,
|
|
53
66
|
passwordHasherServiceImports: passwordHasherServiceImportsProvider,
|
|
54
67
|
prismaImports: prismaImportsProvider,
|
|
@@ -57,7 +70,6 @@ const servicesPasswordReset = createTsTemplateFile({
|
|
|
57
70
|
},
|
|
58
71
|
name: 'services-password-reset',
|
|
59
72
|
projectExports: {
|
|
60
|
-
cleanupExpiredPasswordResetTokens: { isTypeOnly: false },
|
|
61
73
|
completePasswordReset: { isTypeOnly: false },
|
|
62
74
|
requestPasswordReset: { isTypeOnly: false },
|
|
63
75
|
validatePasswordResetToken: { isTypeOnly: false },
|
|
@@ -69,7 +81,11 @@ const servicesPasswordReset = createTsTemplateFile({
|
|
|
69
81
|
source: {
|
|
70
82
|
path: path.join(import.meta.dirname, '../templates/module/services/password-reset.service.ts'),
|
|
71
83
|
},
|
|
72
|
-
variables: {
|
|
84
|
+
variables: {
|
|
85
|
+
TPL_AUTH_WEB_APP: {},
|
|
86
|
+
TPL_PASSWORD_CHANGED_EMAIL: {},
|
|
87
|
+
TPL_PASSWORD_RESET_EMAIL: {},
|
|
88
|
+
},
|
|
73
89
|
});
|
|
74
90
|
const servicesUserPassword = createTsTemplateFile({
|
|
75
91
|
fileOptions: { kind: 'singleton' },
|
|
@@ -105,6 +121,19 @@ export const moduleGroup = {
|
|
|
105
121
|
servicesPasswordReset,
|
|
106
122
|
servicesUserPassword,
|
|
107
123
|
};
|
|
124
|
+
const schemaEmailOtpMutations = createTsTemplateFile({
|
|
125
|
+
fileOptions: { kind: 'singleton' },
|
|
126
|
+
importMapProviders: {
|
|
127
|
+
authModuleImports: authModuleImportsProvider,
|
|
128
|
+
pothosImports: pothosImportsProvider,
|
|
129
|
+
},
|
|
130
|
+
name: 'schema-email-otp-mutations',
|
|
131
|
+
referencedGeneratorTemplates: { servicesEmailOtp: {} },
|
|
132
|
+
source: {
|
|
133
|
+
path: path.join(import.meta.dirname, '../templates/module/schema/email-otp.mutations.ts'),
|
|
134
|
+
},
|
|
135
|
+
variables: {},
|
|
136
|
+
});
|
|
108
137
|
const schemaEmailVerificationMutations = createTsTemplateFile({
|
|
109
138
|
fileOptions: { kind: 'singleton' },
|
|
110
139
|
importMapProviders: { pothosImports: pothosImportsProvider },
|
|
@@ -115,7 +144,20 @@ const schemaEmailVerificationMutations = createTsTemplateFile({
|
|
|
115
144
|
},
|
|
116
145
|
variables: {},
|
|
117
146
|
});
|
|
118
|
-
const
|
|
147
|
+
const schemaInviteMutations = createTsTemplateFile({
|
|
148
|
+
fileOptions: { kind: 'singleton' },
|
|
149
|
+
importMapProviders: {
|
|
150
|
+
authModuleImports: authModuleImportsProvider,
|
|
151
|
+
pothosImports: pothosImportsProvider,
|
|
152
|
+
},
|
|
153
|
+
name: 'schema-invite-mutations',
|
|
154
|
+
referencedGeneratorTemplates: { servicesInvite: {} },
|
|
155
|
+
source: {
|
|
156
|
+
path: path.join(import.meta.dirname, '../templates/module/schema/invite.mutations.ts'),
|
|
157
|
+
},
|
|
158
|
+
variables: { TPL_ADMIN_ROLES: {}, TPL_USER_OBJECT_TYPE: {} },
|
|
159
|
+
});
|
|
160
|
+
const servicesEmailOtp = createTsTemplateFile({
|
|
119
161
|
fileOptions: { kind: 'singleton' },
|
|
120
162
|
importMapProviders: {
|
|
121
163
|
authModuleImports: authModuleImportsProvider,
|
|
@@ -124,17 +166,59 @@ const servicesEmailVerification = createTsTemplateFile({
|
|
|
124
166
|
prismaImports: prismaImportsProvider,
|
|
125
167
|
rateLimitImports: rateLimitImportsProvider,
|
|
126
168
|
requestServiceContextImports: requestServiceContextImportsProvider,
|
|
169
|
+
userSessionTypesImports: userSessionTypesImportsProvider,
|
|
170
|
+
},
|
|
171
|
+
name: 'services-email-otp',
|
|
172
|
+
referencedGeneratorTemplates: { constantsOtp: {}, constantsPassword: {} },
|
|
173
|
+
source: {
|
|
174
|
+
path: path.join(import.meta.dirname, '../templates/module/services/email-otp.service.ts'),
|
|
175
|
+
},
|
|
176
|
+
variables: { TPL_EMAIL_OTP_EMAIL: {}, TPL_NAME_REQUIRED_CHECK: {} },
|
|
177
|
+
});
|
|
178
|
+
const servicesEmailVerification = createTsTemplateFile({
|
|
179
|
+
fileOptions: { kind: 'singleton' },
|
|
180
|
+
importMapProviders: {
|
|
181
|
+
appUrlsImports: appUrlsImportsProvider,
|
|
182
|
+
authModuleImports: authModuleImportsProvider,
|
|
183
|
+
errorHandlerServiceImports: errorHandlerServiceImportsProvider,
|
|
184
|
+
prismaImports: prismaImportsProvider,
|
|
185
|
+
rateLimitImports: rateLimitImportsProvider,
|
|
186
|
+
requestServiceContextImports: requestServiceContextImportsProvider,
|
|
127
187
|
},
|
|
128
188
|
name: 'services-email-verification',
|
|
129
189
|
referencedGeneratorTemplates: { constantsPassword: {} },
|
|
130
190
|
source: {
|
|
131
191
|
path: path.join(import.meta.dirname, '../templates/module/services/email-verification.service.ts'),
|
|
132
192
|
},
|
|
133
|
-
variables: { TPL_ACCOUNT_VERIFICATION_EMAIL: {} },
|
|
193
|
+
variables: { TPL_ACCOUNT_VERIFICATION_EMAIL: {}, TPL_AUTH_WEB_APP: {} },
|
|
194
|
+
});
|
|
195
|
+
const servicesInvite = createTsTemplateFile({
|
|
196
|
+
fileOptions: { kind: 'singleton' },
|
|
197
|
+
importMapProviders: {
|
|
198
|
+
appUrlsImports: appUrlsImportsProvider,
|
|
199
|
+
authModuleImports: authModuleImportsProvider,
|
|
200
|
+
errorHandlerServiceImports: errorHandlerServiceImportsProvider,
|
|
201
|
+
passwordHasherServiceImports: passwordHasherServiceImportsProvider,
|
|
202
|
+
prismaGeneratedImports: prismaGeneratedImportsProvider,
|
|
203
|
+
prismaImports: prismaImportsProvider,
|
|
204
|
+
requestServiceContextImports: requestServiceContextImportsProvider,
|
|
205
|
+
userSessionTypesImports: userSessionTypesImportsProvider,
|
|
206
|
+
},
|
|
207
|
+
name: 'services-invite',
|
|
208
|
+
referencedGeneratorTemplates: { constantsPassword: {} },
|
|
209
|
+
source: {
|
|
210
|
+
path: path.join(import.meta.dirname, '../templates/module/services/invite.service.ts'),
|
|
211
|
+
},
|
|
212
|
+
variables: { TPL_AUTH_WEB_APP: {}, TPL_INVITE_EMAIL: {} },
|
|
134
213
|
});
|
|
135
214
|
export const LOCAL_AUTH_CORE_AUTH_EMAIL_PASSWORD_TEMPLATES = {
|
|
215
|
+
constantsOtp,
|
|
136
216
|
moduleGroup,
|
|
217
|
+
schemaEmailOtpMutations,
|
|
137
218
|
schemaEmailVerificationMutations,
|
|
219
|
+
schemaInviteMutations,
|
|
220
|
+
servicesEmailOtp,
|
|
138
221
|
servicesEmailVerification,
|
|
222
|
+
servicesInvite,
|
|
139
223
|
};
|
|
140
224
|
//# sourceMappingURL=typed-templates.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Number of digits in an emailed sign-in code.
|
|
3
|
+
*
|
|
4
|
+
* Six is the length users expect from a one-time code. At this length the
|
|
5
|
+
* keyspace alone is not much of a barrier, so what keeps guessing impractical
|
|
6
|
+
* is the attempt budget below, the endpoint rate limits, and the short expiry.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EMAIL_OTP_LENGTH = 6;
|
|
9
|
+
/**
|
|
10
|
+
* Emailed sign-in code expiration time in seconds (10 minutes)
|
|
11
|
+
*/
|
|
12
|
+
export declare const EMAIL_OTP_EXPIRY_SEC: number;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of guesses allowed per emailed sign-in code before it is
|
|
15
|
+
* discarded. A short numeric code needs its own attempt budget on top of the
|
|
16
|
+
* endpoint rate limits.
|
|
17
|
+
*/
|
|
18
|
+
export declare const EMAIL_OTP_MAX_ATTEMPTS = 5;
|
|
19
|
+
//# sourceMappingURL=otp.constants.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Number of digits in an emailed sign-in code.
|
|
4
|
+
*
|
|
5
|
+
* Six is the length users expect from a one-time code. At this length the
|
|
6
|
+
* keyspace alone is not much of a barrier, so what keeps guessing impractical
|
|
7
|
+
* is the attempt budget below, the endpoint rate limits, and the short expiry.
|
|
8
|
+
*/
|
|
9
|
+
export const EMAIL_OTP_LENGTH = 6;
|
|
10
|
+
/**
|
|
11
|
+
* Emailed sign-in code expiration time in seconds (10 minutes)
|
|
12
|
+
*/
|
|
13
|
+
export const EMAIL_OTP_EXPIRY_SEC = 60 * 10;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum number of guesses allowed per emailed sign-in code before it is
|
|
16
|
+
* discarded. A short numeric code needs its own attempt budget on top of the
|
|
17
|
+
* endpoint rate limits.
|
|
18
|
+
*/
|
|
19
|
+
export const EMAIL_OTP_MAX_ATTEMPTS = 5;
|
|
20
|
+
//# sourceMappingURL=otp.constants.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Number of digits in an emailed sign-in code.
|
|
5
|
+
*
|
|
6
|
+
* Six is the length users expect from a one-time code. At this length the
|
|
7
|
+
* keyspace alone is not much of a barrier, so what keeps guessing impractical
|
|
8
|
+
* is the attempt budget below, the endpoint rate limits, and the short expiry.
|
|
9
|
+
*/
|
|
10
|
+
export const EMAIL_OTP_LENGTH = 6;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emailed sign-in code expiration time in seconds (10 minutes)
|
|
14
|
+
*/
|
|
15
|
+
export const EMAIL_OTP_EXPIRY_SEC = 60 * 10;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Maximum number of guesses allowed per emailed sign-in code before it is
|
|
19
|
+
* discarded. A short numeric code needs its own attempt budget on top of the
|
|
20
|
+
* endpoint rate limits.
|
|
21
|
+
*/
|
|
22
|
+
export const EMAIL_OTP_MAX_ATTEMPTS = 5;
|
|
@@ -14,4 +14,16 @@ export declare const PASSWORD_RESET_TOKEN_EXPIRY_SEC: number;
|
|
|
14
14
|
* Email verification token expiration time in seconds (24 hours)
|
|
15
15
|
*/
|
|
16
16
|
export declare const EMAIL_VERIFICATION_TOKEN_EXPIRY_SEC: number;
|
|
17
|
+
/**
|
|
18
|
+
* Invite token expiration time in seconds (7 days, since invites are
|
|
19
|
+
* admin-initiated and not tied to a login attempt in progress)
|
|
20
|
+
*/
|
|
21
|
+
export declare const INVITE_TOKEN_EXPIRY_SEC: number;
|
|
22
|
+
/**
|
|
23
|
+
* Safety upper bound on auth verification token length (password reset,
|
|
24
|
+
* invite, etc.), generous relative to the actual token format produced by
|
|
25
|
+
* `generateSplitToken` in `auth-verification.service.ts` so validation
|
|
26
|
+
* doesn't need to track that format exactly.
|
|
27
|
+
*/
|
|
28
|
+
export declare const AUTH_TOKEN_MAX_LENGTH = 100;
|
|
17
29
|
//# sourceMappingURL=password.constants.d.ts.map
|
|
@@ -15,4 +15,16 @@ export const PASSWORD_RESET_TOKEN_EXPIRY_SEC = 60 * 60;
|
|
|
15
15
|
* Email verification token expiration time in seconds (24 hours)
|
|
16
16
|
*/
|
|
17
17
|
export const EMAIL_VERIFICATION_TOKEN_EXPIRY_SEC = 60 * 60 * 24;
|
|
18
|
+
/**
|
|
19
|
+
* Invite token expiration time in seconds (7 days, since invites are
|
|
20
|
+
* admin-initiated and not tied to a login attempt in progress)
|
|
21
|
+
*/
|
|
22
|
+
export const INVITE_TOKEN_EXPIRY_SEC = 60 * 60 * 24 * 7;
|
|
23
|
+
/**
|
|
24
|
+
* Safety upper bound on auth verification token length (password reset,
|
|
25
|
+
* invite, etc.), generous relative to the actual token format produced by
|
|
26
|
+
* `generateSplitToken` in `auth-verification.service.ts` so validation
|
|
27
|
+
* doesn't need to track that format exactly.
|
|
28
|
+
*/
|
|
29
|
+
export const AUTH_TOKEN_MAX_LENGTH = 100;
|
|
18
30
|
//# sourceMappingURL=password.constants.js.map
|
|
@@ -19,3 +19,17 @@ export const PASSWORD_RESET_TOKEN_EXPIRY_SEC = 60 * 60;
|
|
|
19
19
|
* Email verification token expiration time in seconds (24 hours)
|
|
20
20
|
*/
|
|
21
21
|
export const EMAIL_VERIFICATION_TOKEN_EXPIRY_SEC = 60 * 60 * 24;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Invite token expiration time in seconds (7 days, since invites are
|
|
25
|
+
* admin-initiated and not tied to a login attempt in progress)
|
|
26
|
+
*/
|
|
27
|
+
export const INVITE_TOKEN_EXPIRY_SEC = 60 * 60 * 24 * 7;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Safety upper bound on auth verification token length (password reset,
|
|
31
|
+
* invite, etc.), generous relative to the actual token format produced by
|
|
32
|
+
* `generateSplitToken` in `auth-verification.service.ts` so validation
|
|
33
|
+
* doesn't need to track that format exactly.
|
|
34
|
+
*/
|
|
35
|
+
export const AUTH_TOKEN_MAX_LENGTH = 100;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { requestEmailOtp, signInWithEmailOtp } from '$servicesEmailOtp';
|
|
3
|
+
import { userSessionPayload } from '%authModuleImports';
|
|
4
|
+
import { builder } from '%pothosImports';
|
|
5
|
+
builder.mutationField('requestEmailOtp', (t) => t.fieldWithInputPayload({
|
|
6
|
+
authorize: ['public'],
|
|
7
|
+
payload: {
|
|
8
|
+
success: t.payload.field({ type: 'Boolean' }),
|
|
9
|
+
},
|
|
10
|
+
input: {
|
|
11
|
+
email: t.input.field({ required: true, type: 'String' }),
|
|
12
|
+
},
|
|
13
|
+
resolve: async (root, { input }, context) => requestEmailOtp({ email: input.email, context }),
|
|
14
|
+
}));
|
|
15
|
+
builder.mutationField('signInWithEmailOtp', (t) => t.fieldWithInputPayload({
|
|
16
|
+
authorize: ['public'],
|
|
17
|
+
payload: {
|
|
18
|
+
session: t.payload.field({ type: userSessionPayload }),
|
|
19
|
+
},
|
|
20
|
+
input: {
|
|
21
|
+
email: t.input.field({ required: true, type: 'String' }),
|
|
22
|
+
code: t.input.field({ required: true, type: 'String' }),
|
|
23
|
+
name: t.input.field({ required: false, type: 'String' }),
|
|
24
|
+
},
|
|
25
|
+
resolve: async (root, { input }, context) => signInWithEmailOtp({
|
|
26
|
+
input: { ...input, name: input.name ?? undefined },
|
|
27
|
+
context,
|
|
28
|
+
}),
|
|
29
|
+
}));
|
|
30
|
+
//# sourceMappingURL=email-otp.mutations.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import { requestEmailOtp, signInWithEmailOtp } from '$servicesEmailOtp';
|
|
4
|
+
import { userSessionPayload } from '%authModuleImports';
|
|
5
|
+
import { builder } from '%pothosImports';
|
|
6
|
+
|
|
7
|
+
builder.mutationField('requestEmailOtp', (t) =>
|
|
8
|
+
t.fieldWithInputPayload({
|
|
9
|
+
authorize: ['public'],
|
|
10
|
+
payload: {
|
|
11
|
+
success: t.payload.field({ type: 'Boolean' }),
|
|
12
|
+
},
|
|
13
|
+
input: {
|
|
14
|
+
email: t.input.field({ required: true, type: 'String' }),
|
|
15
|
+
},
|
|
16
|
+
resolve: async (root, { input }, context) =>
|
|
17
|
+
requestEmailOtp({ email: input.email, context }),
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
builder.mutationField('signInWithEmailOtp', (t) =>
|
|
22
|
+
t.fieldWithInputPayload({
|
|
23
|
+
authorize: ['public'],
|
|
24
|
+
payload: {
|
|
25
|
+
session: t.payload.field({ type: userSessionPayload }),
|
|
26
|
+
},
|
|
27
|
+
input: {
|
|
28
|
+
email: t.input.field({ required: true, type: 'String' }),
|
|
29
|
+
code: t.input.field({ required: true, type: 'String' }),
|
|
30
|
+
name: t.input.field({ required: false, type: 'String' }),
|
|
31
|
+
},
|
|
32
|
+
resolve: async (root, { input }, context) =>
|
|
33
|
+
signInWithEmailOtp({
|
|
34
|
+
input: { ...input, name: input.name ?? undefined },
|
|
35
|
+
context,
|
|
36
|
+
}),
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { acceptInvite, inviteUser, validateInviteToken } from '$servicesInvite';
|
|
3
|
+
import { userSessionPayload } from '%authModuleImports';
|
|
4
|
+
import { builder } from '%pothosImports';
|
|
5
|
+
builder.mutationField('inviteUser', (t) => t.fieldWithInputPayload({
|
|
6
|
+
authorize: TPL_ADMIN_ROLES,
|
|
7
|
+
payload: {
|
|
8
|
+
user: t.payload.field({
|
|
9
|
+
type: TPL_USER_OBJECT_TYPE,
|
|
10
|
+
}),
|
|
11
|
+
},
|
|
12
|
+
input: {
|
|
13
|
+
userId: t.input.field({ required: true, type: 'Uuid' }),
|
|
14
|
+
},
|
|
15
|
+
resolve: async (_root, { input }, context) => inviteUser({ userId: input.userId, context }),
|
|
16
|
+
}));
|
|
17
|
+
builder.mutationField('validateInviteToken', (t) => t.fieldWithInputPayload({
|
|
18
|
+
authorize: ['public'],
|
|
19
|
+
payload: {
|
|
20
|
+
email: t.payload.field({ type: 'String' }),
|
|
21
|
+
},
|
|
22
|
+
input: {
|
|
23
|
+
token: t.input.field({ required: true, type: 'String' }),
|
|
24
|
+
},
|
|
25
|
+
resolve: async (_root, { input }) => validateInviteToken({ token: input.token }),
|
|
26
|
+
}));
|
|
27
|
+
builder.mutationField('acceptInvite', (t) => t.fieldWithInputPayload({
|
|
28
|
+
authorize: ['public'],
|
|
29
|
+
payload: {
|
|
30
|
+
session: t.payload.field({ type: userSessionPayload }),
|
|
31
|
+
},
|
|
32
|
+
input: {
|
|
33
|
+
token: t.input.field({ required: true, type: 'String' }),
|
|
34
|
+
newPassword: t.input.field({ required: true, type: 'String' }),
|
|
35
|
+
},
|
|
36
|
+
resolve: async (_root, { input }, context) => acceptInvite({
|
|
37
|
+
token: input.token,
|
|
38
|
+
newPassword: input.newPassword,
|
|
39
|
+
context,
|
|
40
|
+
}),
|
|
41
|
+
}));
|
|
42
|
+
//# sourceMappingURL=invite.mutations.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import { acceptInvite, inviteUser, validateInviteToken } from '$servicesInvite';
|
|
4
|
+
import { userSessionPayload } from '%authModuleImports';
|
|
5
|
+
import { builder } from '%pothosImports';
|
|
6
|
+
|
|
7
|
+
builder.mutationField('inviteUser', (t) =>
|
|
8
|
+
t.fieldWithInputPayload({
|
|
9
|
+
authorize: TPL_ADMIN_ROLES,
|
|
10
|
+
payload: {
|
|
11
|
+
user: t.payload.field({
|
|
12
|
+
type: TPL_USER_OBJECT_TYPE,
|
|
13
|
+
}),
|
|
14
|
+
},
|
|
15
|
+
input: {
|
|
16
|
+
userId: t.input.field({ required: true, type: 'Uuid' }),
|
|
17
|
+
},
|
|
18
|
+
resolve: async (_root, { input }, context) =>
|
|
19
|
+
inviteUser({ userId: input.userId, context }),
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
builder.mutationField('validateInviteToken', (t) =>
|
|
24
|
+
t.fieldWithInputPayload({
|
|
25
|
+
authorize: ['public'],
|
|
26
|
+
payload: {
|
|
27
|
+
email: t.payload.field({ type: 'String' }),
|
|
28
|
+
},
|
|
29
|
+
input: {
|
|
30
|
+
token: t.input.field({ required: true, type: 'String' }),
|
|
31
|
+
},
|
|
32
|
+
resolve: async (_root, { input }) =>
|
|
33
|
+
validateInviteToken({ token: input.token }),
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
builder.mutationField('acceptInvite', (t) =>
|
|
38
|
+
t.fieldWithInputPayload({
|
|
39
|
+
authorize: ['public'],
|
|
40
|
+
payload: {
|
|
41
|
+
session: t.payload.field({ type: userSessionPayload }),
|
|
42
|
+
},
|
|
43
|
+
input: {
|
|
44
|
+
token: t.input.field({ required: true, type: 'String' }),
|
|
45
|
+
newPassword: t.input.field({ required: true, type: 'String' }),
|
|
46
|
+
},
|
|
47
|
+
resolve: async (_root, { input }, context) =>
|
|
48
|
+
acceptInvite({
|
|
49
|
+
token: input.token,
|
|
50
|
+
newPassword: input.newPassword,
|
|
51
|
+
context,
|
|
52
|
+
}),
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { authenticateUserWithEmailAndPassword, changeUserPassword,
|
|
2
|
+
import { authenticateUserWithEmailAndPassword, changeUserPassword, resetUserPassword, } from '$servicesUserPassword';
|
|
3
3
|
import { userSessionPayload } from '%authModuleImports';
|
|
4
4
|
import { builder } from '%pothosImports';
|
|
5
|
-
|
|
6
|
-
authorize: ['public'],
|
|
7
|
-
payload: {
|
|
8
|
-
session: t.payload.field({ type: userSessionPayload }),
|
|
9
|
-
},
|
|
10
|
-
input: {
|
|
11
|
-
email: t.input.field({ required: true, type: 'String' }),
|
|
12
|
-
name: t.input.field({ required: false, type: 'String' }),
|
|
13
|
-
password: t.input.field({ required: true, type: 'String' }),
|
|
14
|
-
},
|
|
15
|
-
resolve: async (root, { input }, context) => registerUserWithEmailAndPassword({
|
|
16
|
-
input: {
|
|
17
|
-
...input,
|
|
18
|
-
name: input.name ?? undefined,
|
|
19
|
-
},
|
|
20
|
-
context,
|
|
21
|
-
}),
|
|
22
|
-
}));
|
|
5
|
+
TPL_REGISTER_MUTATION;
|
|
23
6
|
builder.mutationField('loginWithEmailPassword', (t) => t.fieldWithInputPayload({
|
|
24
7
|
authorize: ['public'],
|
|
25
8
|
payload: {
|
|
@@ -3,33 +3,12 @@
|
|
|
3
3
|
import {
|
|
4
4
|
authenticateUserWithEmailAndPassword,
|
|
5
5
|
changeUserPassword,
|
|
6
|
-
registerUserWithEmailAndPassword,
|
|
7
6
|
resetUserPassword,
|
|
8
7
|
} from '$servicesUserPassword';
|
|
9
8
|
import { userSessionPayload } from '%authModuleImports';
|
|
10
9
|
import { builder } from '%pothosImports';
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
t.fieldWithInputPayload({
|
|
14
|
-
authorize: ['public'],
|
|
15
|
-
payload: {
|
|
16
|
-
session: t.payload.field({ type: userSessionPayload }),
|
|
17
|
-
},
|
|
18
|
-
input: {
|
|
19
|
-
email: t.input.field({ required: true, type: 'String' }),
|
|
20
|
-
name: t.input.field({ required: false, type: 'String' }),
|
|
21
|
-
password: t.input.field({ required: true, type: 'String' }),
|
|
22
|
-
},
|
|
23
|
-
resolve: async (root, { input }, context) =>
|
|
24
|
-
registerUserWithEmailAndPassword({
|
|
25
|
-
input: {
|
|
26
|
-
...input,
|
|
27
|
-
name: input.name ?? undefined,
|
|
28
|
-
},
|
|
29
|
-
context,
|
|
30
|
-
}),
|
|
31
|
-
}),
|
|
32
|
-
);
|
|
11
|
+
TPL_REGISTER_MUTATION;
|
|
33
12
|
|
|
34
13
|
builder.mutationField('loginWithEmailPassword', (t) =>
|
|
35
14
|
t.fieldWithInputPayload({
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { RequestServiceContext, RequestServiceContextWith } from '%requestServiceContextImports';
|
|
2
|
+
import type { UserSessionPayload } from '%userSessionTypesImports';
|
|
3
|
+
/**
|
|
4
|
+
* Emails a single-use sign-in code to the given address.
|
|
5
|
+
*
|
|
6
|
+
* A code is sent whether or not an account exists — verifying one signs the
|
|
7
|
+
* user in, creating the account on first use — so this endpoint reveals
|
|
8
|
+
* nothing about which addresses are registered.
|
|
9
|
+
*/
|
|
10
|
+
export declare function requestEmailOtp({ email: rawEmail, context, }: {
|
|
11
|
+
email: string;
|
|
12
|
+
context: RequestServiceContextWith<'email'>;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
success: true;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Signs a user in with an emailed code, creating the account on first use.
|
|
18
|
+
*
|
|
19
|
+
* A verified code proves control of the inbox, so the account it creates (or
|
|
20
|
+
* signs in to) is marked as having a verified email. Accounts created this way
|
|
21
|
+
* have no password until the user goes through the password reset flow.
|
|
22
|
+
*
|
|
23
|
+
* @throws BadRequestError `name-required` when the code is valid but the
|
|
24
|
+
* address has no account yet and no name was supplied. The code is left intact
|
|
25
|
+
* so the client can collect a name and retry with it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function signInWithEmailOtp({ input, context, }: {
|
|
28
|
+
input: {
|
|
29
|
+
email: string;
|
|
30
|
+
code: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
};
|
|
33
|
+
context: RequestServiceContext;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
session: UserSessionPayload;
|
|
36
|
+
}>;
|
|
37
|
+
//# sourceMappingURL=email-otp.service.d.ts.map
|