@luochuanyuewu/payload-auth 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts +24 -0
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js +317 -0
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts +2 -0
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.js +23 -0
- package/dist/better-auth/adapter/generate-schema/index.d.ts +5 -0
- package/dist/better-auth/adapter/generate-schema/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/index.js +19 -0
- package/dist/better-auth/adapter/generate-schema/utils.d.ts +3 -0
- package/dist/better-auth/adapter/generate-schema/utils.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/utils.js +20 -0
- package/dist/better-auth/adapter/index.d.ts +16 -0
- package/dist/better-auth/adapter/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/index.js +717 -0
- package/dist/better-auth/adapter/transform/index.d.ts +31 -0
- package/dist/better-auth/adapter/transform/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/transform/index.js +729 -0
- package/dist/better-auth/adapter/types.d.ts +11 -0
- package/dist/better-auth/adapter/types.d.ts.map +1 -0
- package/dist/better-auth/adapter/types.js +3 -0
- package/dist/better-auth/generated-types.d.ts +329 -0
- package/dist/better-auth/generated-types.d.ts.map +1 -0
- package/dist/better-auth/generated-types.js +4 -0
- package/dist/better-auth/index.d.ts +4 -0
- package/dist/better-auth/index.d.ts.map +1 -0
- package/dist/better-auth/index.js +5 -0
- package/dist/better-auth/plugin/constants.d.ts +231 -0
- package/dist/better-auth/plugin/constants.d.ts.map +1 -0
- package/dist/better-auth/plugin/constants.js +259 -0
- package/dist/better-auth/plugin/helpers/check-plugin-exists.d.ts +13 -0
- package/dist/better-auth/plugin/helpers/check-plugin-exists.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/check-plugin-exists.js +14 -0
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts +30 -0
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.js +46 -0
- package/dist/better-auth/plugin/helpers/get-admin-access.d.ts +8 -0
- package/dist/better-auth/plugin/helpers/get-admin-access.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-admin-access.js +22 -0
- package/dist/better-auth/plugin/helpers/get-all-roles.d.ts +6 -0
- package/dist/better-auth/plugin/helpers/get-all-roles.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-all-roles.js +20 -0
- package/dist/better-auth/plugin/helpers/get-better-auth-schema.d.ts +19 -0
- package/dist/better-auth/plugin/helpers/get-better-auth-schema.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-better-auth-schema.js +75 -0
- package/dist/better-auth/plugin/helpers/get-collection-slug.d.ts +6 -0
- package/dist/better-auth/plugin/helpers/get-collection-slug.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-collection-slug.js +20 -0
- package/dist/better-auth/plugin/helpers/get-collection.d.ts +28 -0
- package/dist/better-auth/plugin/helpers/get-collection.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-collection.js +49 -0
- package/dist/better-auth/plugin/helpers/get-ip.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-ip.js +31 -0
- package/dist/better-auth/plugin/helpers/get-signed-cookie.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/get-signed-cookie.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-signed-cookie.js +63 -0
- package/dist/better-auth/plugin/helpers/index.d.ts +2 -0
- package/dist/better-auth/plugin/helpers/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/index.js +3 -0
- package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts +60 -0
- package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/prepare-session-data.js +49 -0
- package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.d.ts +21 -0
- package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.js +63 -0
- package/dist/better-auth/plugin/index.d.ts +8 -0
- package/dist/better-auth/plugin/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/index.js +103 -0
- package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.d.ts +13 -0
- package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.js +87 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.js +51 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.js +150 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.js +11 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.js +8 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.js +117 -0
- package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/api-keys.js +174 -0
- package/dist/better-auth/plugin/lib/build-collections/device-code.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/device-code.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/device-code.js +49 -0
- package/dist/better-auth/plugin/lib/build-collections/index.d.ts +11 -0
- package/dist/better-auth/plugin/lib/build-collections/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/index.js +79 -0
- package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/invitations.js +93 -0
- package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/jwks.js +58 -0
- package/dist/better-auth/plugin/lib/build-collections/members.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/members.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/members.js +72 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.js +105 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.js +117 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.js +87 -0
- package/dist/better-auth/plugin/lib/build-collections/organization-roles.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/organization-roles.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/organization-roles.js +65 -0
- package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/organizations.js +106 -0
- package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/passkeys.js +115 -0
- package/dist/better-auth/plugin/lib/build-collections/rate-limit.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/rate-limit.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/rate-limit.js +54 -0
- package/dist/better-auth/plugin/lib/build-collections/scim-provider.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/scim-provider.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/scim-provider.js +65 -0
- package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/sessions.js +140 -0
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.js +80 -0
- package/dist/better-auth/plugin/lib/build-collections/subscriptions.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/subscriptions.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/subscriptions.js +110 -0
- package/dist/better-auth/plugin/lib/build-collections/team-members.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/team-members.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/team-members.js +63 -0
- package/dist/better-auth/plugin/lib/build-collections/teams.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/teams.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/teams.js +74 -0
- package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/two-factors.js +66 -0
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts +8 -0
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.js +52 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts +12 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.js +68 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.d.ts +5 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.js +6 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.js +114 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.js +64 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.js +90 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.js +80 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.js +79 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.js +54 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.js +15 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.js +8 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.js +17 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.js +90 -0
- package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/index.js +333 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.d.ts +16 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.js +24 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.d.ts +11 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.js +112 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts +8 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.js +31 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.d.ts +12 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.js +26 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts +18 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.js +84 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.d.ts +21 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.js +95 -0
- package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/verifications.js +82 -0
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +6 -0
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/get-payload-auth.js +9 -0
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts +8 -0
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/init-better-auth.js +16 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.js +12 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.js +10 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.js +8 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts +12 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.js +146 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.js +18 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.js +34 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.js +11 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.js +10 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.js +11 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.d.ts +8 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.js +20 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.d.ts +8 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.js +20 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.d.ts +14 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.js +38 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts +8 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.js +23 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts +26 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.js +62 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts +10 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.js +42 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.d.ts +10 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.js +62 -0
- package/dist/better-auth/plugin/lib/set-login-methods.d.ts +5 -0
- package/dist/better-auth/plugin/lib/set-login-methods.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/set-login-methods.js +14 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts +10 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.js +116 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.scss +36 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts +11 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.js +213 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.scss +136 -0
- package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.d.ts +4 -0
- package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.js +197 -0
- package/dist/better-auth/plugin/payload/components/login-form/context.d.ts +49 -0
- package/dist/better-auth/plugin/payload/components/login-form/context.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/login-form/context.js +94 -0
- package/dist/better-auth/plugin/payload/components/login-form/credentials-form.d.ts +4 -0
- package/dist/better-auth/plugin/payload/components/login-form/credentials-form.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/login-form/credentials-form.js +167 -0
- package/dist/better-auth/plugin/payload/components/login-form/index.d.ts +5 -0
- package/dist/better-auth/plugin/payload/components/login-form/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/login-form/index.js +6 -0
- package/dist/better-auth/plugin/payload/components/login-form/index.scss +58 -0
- package/dist/better-auth/plugin/payload/components/logout-button.d.ts +5 -0
- package/dist/better-auth/plugin/payload/components/logout-button.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/logout-button.js +24 -0
- package/dist/better-auth/plugin/payload/components/passkeys/add-button.d.ts +9 -0
- package/dist/better-auth/plugin/payload/components/passkeys/add-button.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/passkeys/add-button.js +122 -0
- package/dist/better-auth/plugin/payload/components/passkeys/client.d.ts +3 -0
- package/dist/better-auth/plugin/payload/components/passkeys/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/passkeys/client.js +61 -0
- package/dist/better-auth/plugin/payload/components/passkeys/index.d.ts +5 -0
- package/dist/better-auth/plugin/payload/components/passkeys/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/passkeys/index.js +42 -0
- package/dist/better-auth/plugin/payload/components/passkeys/index.scss +98 -0
- package/dist/better-auth/plugin/payload/components/passkeys/list.d.ts +9 -0
- package/dist/better-auth/plugin/payload/components/passkeys/list.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/passkeys/list.js +57 -0
- package/dist/better-auth/plugin/payload/components/passkeys/types.d.ts +23 -0
- package/dist/better-auth/plugin/payload/components/passkeys/types.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/passkeys/types.js +3 -0
- package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts +7 -0
- package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/rsc-redirect.js +13 -0
- package/dist/better-auth/plugin/payload/components/token-field.d.ts +4 -0
- package/dist/better-auth/plugin/payload/components/token-field.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/token-field.js +29 -0
- package/dist/better-auth/plugin/payload/components/two-factor-auth/index.d.ts +9 -0
- package/dist/better-auth/plugin/payload/components/two-factor-auth/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/two-factor-auth/index.js +347 -0
- package/dist/better-auth/plugin/payload/components/two-factor-auth/index.scss +116 -0
- package/dist/better-auth/plugin/payload/exports/client.d.ts +7 -0
- package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/exports/client.js +8 -0
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts +9 -0
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/exports/rsc.js +10 -0
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts +3 -0
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.js +9 -0
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts +2 -0
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.js +22 -0
- package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts +23 -0
- package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-login/client.js +24 -0
- package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts +11 -0
- package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-login/index.js +143 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts +23 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/client.js +185 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts +10 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-signup/index.js +92 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts +7 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.js +104 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts +9 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.js +61 -0
- package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts +11 -0
- package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/reset-password/client.js +111 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts +9 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.js +78 -0
- package/dist/better-auth/plugin/payload/views/two-factor-verify/client.d.ts +9 -0
- package/dist/better-auth/plugin/payload/views/two-factor-verify/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/two-factor-verify/client.js +79 -0
- package/dist/better-auth/plugin/payload/views/two-factor-verify/index.d.ts +10 -0
- package/dist/better-auth/plugin/payload/views/two-factor-verify/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/two-factor-verify/index.js +49 -0
- package/dist/better-auth/plugin/types.d.ts +448 -0
- package/dist/better-auth/plugin/types.d.ts.map +1 -0
- package/dist/better-auth/plugin/types.js +3 -0
- package/dist/better-auth/plugin/utils/set.d.ts +40 -0
- package/dist/better-auth/plugin/utils/set.d.ts.map +1 -0
- package/dist/better-auth/plugin/utils/set.js +84 -0
- package/dist/better-auth/scripts/generate-types.d.ts +2 -0
- package/dist/better-auth/scripts/generate-types.d.ts.map +1 -0
- package/dist/better-auth/scripts/generate-types.js +225 -0
- package/dist/better-auth/types.d.ts +3 -0
- package/dist/better-auth/types.d.ts.map +1 -0
- package/dist/better-auth/types.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/shared/components/icons.d.ts +8 -0
- package/dist/shared/components/icons.d.ts.map +1 -0
- package/dist/shared/components/icons.js +436 -0
- package/dist/shared/components/logo.d.ts +3 -0
- package/dist/shared/components/logo.d.ts.map +1 -0
- package/dist/shared/components/logo.js +24 -0
- package/dist/shared/form/components/submit.d.ts +8 -0
- package/dist/shared/form/components/submit.d.ts.map +1 -0
- package/dist/shared/form/components/submit.js +23 -0
- package/dist/shared/form/fields/text-field.d.ts +9 -0
- package/dist/shared/form/fields/text-field.d.ts.map +1 -0
- package/dist/shared/form/fields/text-field.js +44 -0
- package/dist/shared/form/index.d.ts +28 -0
- package/dist/shared/form/index.d.ts.map +1 -0
- package/dist/shared/form/index.js +17 -0
- package/dist/shared/form/ui/header/index.d.ts +9 -0
- package/dist/shared/form/ui/header/index.d.ts.map +1 -0
- package/dist/shared/form/ui/header/index.js +23 -0
- package/dist/shared/form/ui/header/index.scss +8 -0
- package/dist/shared/form/ui/index.d.ts +34 -0
- package/dist/shared/form/ui/index.d.ts.map +1 -0
- package/dist/shared/form/ui/index.js +70 -0
- package/dist/shared/form/ui/index.scss +27 -0
- package/dist/shared/form/validation.d.ts +65 -0
- package/dist/shared/form/validation.d.ts.map +1 -0
- package/dist/shared/form/validation.js +108 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/payload/fields/field-copy-button/index.css +47 -0
- package/dist/shared/payload/fields/field-copy-button/index.d.ts +4 -0
- package/dist/shared/payload/fields/field-copy-button/index.d.ts.map +1 -0
- package/dist/shared/payload/fields/field-copy-button/index.js +38 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.css +14 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.d.ts +4 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.d.ts.map +1 -0
- package/dist/shared/payload/fields/generate-uuid-button/index.js +26 -0
- package/dist/shared/payload/fields/index.d.ts +3 -0
- package/dist/shared/payload/fields/index.d.ts.map +1 -0
- package/dist/shared/payload/fields/index.js +4 -0
- package/dist/shared/utils/regex.d.ts +3 -0
- package/dist/shared/utils/regex.d.ts.map +1 -0
- package/dist/shared/utils/regex.js +4 -0
- package/dist/shared/utils/try-catch.d.ts +12 -0
- package/dist/shared/utils/try-catch.d.ts.map +1 -0
- package/dist/shared/utils/try-catch.js +17 -0
- package/dist/shared/utils/value-or-default.d.ts +10 -0
- package/dist/shared/utils/value-or-default.d.ts.map +1 -0
- package/dist/shared/utils/value-or-default.js +12 -0
- package/package.json +124 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { cookies } from "next/headers";
|
|
2
|
+
import { baModelKey } from "../../../../constants";
|
|
3
|
+
import { getCollectionByModelKey } from "../../../../helpers/get-collection";
|
|
4
|
+
import { getPayloadAuth } from "../../../get-payload-auth";
|
|
5
|
+
export function getAfterLogoutHook() {
|
|
6
|
+
const hook = async ({ req })=>{
|
|
7
|
+
const store = await cookies();
|
|
8
|
+
const payload = await getPayloadAuth(req.payload.config);
|
|
9
|
+
const { sessionToken, sessionData, dontRememberToken } = (await payload.betterAuth.$context).authCookies;
|
|
10
|
+
const sessionsSlug = getCollectionByModelKey(req.payload.collections, baModelKey.session).slug;
|
|
11
|
+
await deleteSessionFromDb(payload, sessionsSlug, store.get(sessionToken.name)?.value, req);
|
|
12
|
+
const baseNames = [
|
|
13
|
+
sessionToken.name,
|
|
14
|
+
sessionData.name,
|
|
15
|
+
dontRememberToken.name,
|
|
16
|
+
//This is a hacky wat to delete the admin session cookie (BETTER AUTH HARDCODED THIS)
|
|
17
|
+
// see https://github.com/better-auth/better-auth/blob/25e82669eed83ba6da063c167e8ae5b7da84ef9f/packages/better-auth/src/plugins/admin/admin.ts#L917C7-L917C23
|
|
18
|
+
"admin_session"
|
|
19
|
+
];
|
|
20
|
+
const multiBase = `${sessionToken.name}_multi`;
|
|
21
|
+
const multiCandidates = store.getAll().filter((c)=>c.name.startsWith(multiBase) || c.name.startsWith(`__Secure-${multiBase}`)).map((c)=>c.name);
|
|
22
|
+
const allNames = [
|
|
23
|
+
...baseNames.flatMap((n)=>{
|
|
24
|
+
const clean = n.replace(/^__Secure-/, "");
|
|
25
|
+
return [
|
|
26
|
+
clean,
|
|
27
|
+
`__Secure-${clean}`
|
|
28
|
+
];
|
|
29
|
+
}),
|
|
30
|
+
...multiCandidates
|
|
31
|
+
];
|
|
32
|
+
allNames.forEach((n)=>deleteCookie(store, n));
|
|
33
|
+
};
|
|
34
|
+
return hook;
|
|
35
|
+
}
|
|
36
|
+
async function deleteSessionFromDb(payload, slug, rawCookieValue, req) {
|
|
37
|
+
if (!rawCookieValue) return;
|
|
38
|
+
const [token] = rawCookieValue.split(".");
|
|
39
|
+
const { docs } = await payload.find({
|
|
40
|
+
collection: slug,
|
|
41
|
+
where: {
|
|
42
|
+
token: {
|
|
43
|
+
equals: token
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
limit: 1,
|
|
47
|
+
req
|
|
48
|
+
});
|
|
49
|
+
const session = docs.at(0);
|
|
50
|
+
if (!session) return;
|
|
51
|
+
try {
|
|
52
|
+
await payload.delete({
|
|
53
|
+
collection: slug,
|
|
54
|
+
where: {
|
|
55
|
+
id: {
|
|
56
|
+
equals: session.id
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
req
|
|
60
|
+
});
|
|
61
|
+
} catch {}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Deleting __Secure-* cookies need to set options.secure = true
|
|
65
|
+
*/ function deleteCookie(store, name) {
|
|
66
|
+
const cookie = store.get(name);
|
|
67
|
+
if (!cookie) return;
|
|
68
|
+
const isSecure = name.startsWith("__Secure-") || name.startsWith("__Host-");
|
|
69
|
+
const options = {
|
|
70
|
+
path: "/",
|
|
71
|
+
maxAge: 0,
|
|
72
|
+
httpOnly: true,
|
|
73
|
+
sameSite: "lax"
|
|
74
|
+
};
|
|
75
|
+
if (isSecure) options.secure = true;
|
|
76
|
+
store.set(name, "", options);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJzL2hvb2tzL2FmdGVyLWxvZ291dC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjb29raWVzIH0gZnJvbSBcIm5leHQvaGVhZGVyc1wiO1xuaW1wb3J0IHR5cGUgeyBDb2xsZWN0aW9uQWZ0ZXJMb2dvdXRIb29rLCBQYXlsb2FkUmVxdWVzdCB9IGZyb20gXCJwYXlsb2FkXCI7XG5pbXBvcnQgeyBiYU1vZGVsS2V5IH0gZnJvbSBcIkAvYmV0dGVyLWF1dGgvcGx1Z2luL2NvbnN0YW50c1wiO1xuaW1wb3J0IHsgZ2V0Q29sbGVjdGlvbkJ5TW9kZWxLZXkgfSBmcm9tIFwiQC9iZXR0ZXItYXV0aC9wbH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S00sRUFBRSxDQUFDO0lBQ3hCLElBQUksQ0FBQzlCLFNBQVM7SUFDZCxJQUFJO1FBQ0YsTUFBTVYsUUFBUXlDLE1BQU0sQ0FBQztZQUNuQkwsWUFBWXpCO1lBQ1owQixPQUFPO2dCQUFFSyxJQUFJO29CQUFFSixRQUFRNUIsUUFBUWdDLEVBQUU7Z0JBQUM7WUFBRTtZQUNwQzVDO1FBQ0Y7SUFDRixFQUFFLE9BQU0sQ0FBQztBQUNYO0FBRUE7O0NBRUMsR0FDRCxTQUFTZ0MsYUFDUC9CLEtBQTBDLEVBQzFDZSxJQUFZO0lBRVosTUFBTTZCLFNBQVM1QyxNQUFNYyxHQUFHLENBQUNDO0lBQ3pCLElBQUksQ0FBQzZCLFFBQVE7SUFFYixNQUFNQyxXQUFXOUIsS0FBS1EsVUFBVSxDQUFDLGdCQUFnQlIsS0FBS1EsVUFBVSxDQUFDO0lBRWpFLE1BQU11QixVQUFtQztRQUN2Q0MsTUFBTTtRQUNOQyxRQUFRO1FBQ1JDLFVBQVU7UUFDVkMsVUFBVTtJQUNaO0lBRUEsSUFBSUwsVUFBVUMsUUFBUUssTUFBTSxHQUFHO0lBRS9CbkQsTUFBTW9ELEdBQUcsQ0FBQ3JDLE1BQU0sSUFBSStCO0FBQ3RCIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"before-delete.d.ts","sourceRoot":"","sources":["../../../../../../../src/better-auth/plugin/lib/build-collections/users/hooks/before-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,SAAS,CAAC;AAIjB,wBAAgB,mBAAmB,IAAI,0BAA0B,CAgEhE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { commitTransaction, initTransaction, killTransaction } from "payload";
|
|
2
|
+
import { baModelKey } from "../../../../constants";
|
|
3
|
+
import { getCollectionByModelKey } from "../../../../helpers/get-collection";
|
|
4
|
+
export function getBeforeDeleteHook() {
|
|
5
|
+
const hook = async ({ req, id })=>{
|
|
6
|
+
const collections = req.payload.collections;
|
|
7
|
+
const accountsSlug = getCollectionByModelKey(collections, baModelKey.account).slug;
|
|
8
|
+
const sessionsSlug = getCollectionByModelKey(collections, baModelKey.session).slug;
|
|
9
|
+
const verificationsSlug = getCollectionByModelKey(collections, baModelKey.verification).slug;
|
|
10
|
+
try {
|
|
11
|
+
const { payload } = req;
|
|
12
|
+
const userId = id;
|
|
13
|
+
const shouldCommit = await initTransaction(req);
|
|
14
|
+
await payload.delete({
|
|
15
|
+
collection: accountsSlug,
|
|
16
|
+
where: {
|
|
17
|
+
user: {
|
|
18
|
+
equals: userId
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
req
|
|
22
|
+
});
|
|
23
|
+
await payload.delete({
|
|
24
|
+
collection: sessionsSlug,
|
|
25
|
+
where: {
|
|
26
|
+
user: {
|
|
27
|
+
equals: userId
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
req
|
|
31
|
+
});
|
|
32
|
+
await payload.delete({
|
|
33
|
+
collection: verificationsSlug,
|
|
34
|
+
where: {
|
|
35
|
+
value: {
|
|
36
|
+
like: `"${userId}"`
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
req
|
|
40
|
+
});
|
|
41
|
+
if (shouldCommit) {
|
|
42
|
+
await commitTransaction(req);
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
await killTransaction(req);
|
|
47
|
+
console.error("Error in user afterDelete hook:", error);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return hook;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJ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b25zLFxuICAgICAgYmFNb2RlbEtleS52ZXJpZmljYXRpb25cbiAgICApLnNsdWc7XG4gICAgdHJ5IHtcbiAgICAgIGNvbnN0IHsgcGF5bG9hZCB9ID0gcmVxO1xuICAgICAgY29uc3QgdXNlcklkID0gaWQ7XG5cbiAgICAgIGNvbnN0IHNob3VsZENvbW1pdCA9IGF3YWl0IGluaXRUcmFuc2FjdGlvbihyZXEpO1xuXG4gICAgICBhd2FpdCBwYXlsb2FkLmRlbGV0ZSh7XG4gICAgICAgIGNvbGxlY3Rpb246IGFjY291bnRzU2x1ZyxcbiAgICAgICAgd2hlcmU6IHtcbiAgICAgICAgICB1c2VyOiB7XG4gICAgICAgICAgICBlcXVhbHM6IHVzZXJJZFxuICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVxXG4gICAgICB9KTtcblxuICAgICAgYXdhaXQgcGF5bG9hZC5kZWxldGUoe1xuICAgICAgICBjb2xsZWN0aW9uOiBzZXNzaW9uc1NsdWcsXG4gICAgICAgIHdoZXJlOiB7XG4gICAgICAgICAgdXNlcjoge1xuICAgICAgICAgICAgZXF1YWxzOiB1c2VySWRcbiAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIHJlcVxuICAgICAgfSk7XG5cbiAgICAgIGF3YWl0IHBheWxvYWQuZGVsZXRlKHtcbiAgICAgICAgY29sbGVjdGlvbjogdmVyaWZpY2F0aW9uc1NsdWcsXG4gICAgICAgIHdoZXJlOiB7XG4gICAgICAgICAgdmFsdWU6IHtcbiAgICAgICAgICAgIGxpa2U6IGBcIiR7dXNlcklkfVwiYFxuICAgICAgICAgIH1cbiAgICAgICAgfSxcbiAgICAgICAgcmVxXG4gICAgICB9KTtcblxuICAgICAgaWYgKHNob3VsZENvbW1pdCkge1xuICAgICAgICBhd2FpdCBjb21taXRUcmFuc2FjdGlvbihyZXEpO1xuICAgICAgfVxuXG4gICAgICByZXR1cm47XG4gICAgfSBjYXRjaCAoZXJyb3IpIHtcbiA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/**
|
|
4
|
+
* This hook blocks login attempts if email verification is required and the user's email is not verified
|
|
5
|
+
*/
|
|
6
|
+
export declare function getBeforeLoginHook(betterAuthOptions: BetterAuthOptions): CollectionBeforeLoginHook;
|
|
7
|
+
//# sourceMappingURL=before-login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"before-login.d.ts","sourceRoot":"","sources":["../../../../../../../src/better-auth/plugin/lib/build-collections/users/hooks/before-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,iBAAiB,6BAgBtE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { APIError } from "payload";
|
|
2
|
+
/**
|
|
3
|
+
* This hook blocks login attempts if email verification is required and the user's email is not verified
|
|
4
|
+
*/ export function getBeforeLoginHook(betterAuthOptions) {
|
|
5
|
+
const hook = async ({ user })=>{
|
|
6
|
+
const requireEmailVerification = betterAuthOptions.emailAndPassword?.requireEmailVerification ?? false;
|
|
7
|
+
if (requireEmailVerification && !user.emailVerified) {
|
|
8
|
+
throw new APIError("Email verification required. Please verify your email before logging in.", 403);
|
|
9
|
+
}
|
|
10
|
+
return user;
|
|
11
|
+
};
|
|
12
|
+
return hook;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJzL2hvb2tzL2JlZm9yZS1sb2dpbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBUElFcnJvciwgQ29sbGVjdGlvbkJlZm9yZU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WlyZUVtYWlsVmVyaWZpY2F0aW9uIiwiZW1haWxBbmRQYXNzd29yZCIsImVtYWlsVmVyaWZpZWQiXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLFFBQVEsUUFBbUMsVUFBVTtBQUU5RDs7Q0FFQyxHQUNELE9BQU8sU0FBU0MsbUJBQW1CQyxpQkFBb0M7SUFDckUsTUFBTUMsT0FBa0MsT0FBTyxFQUFFQyxJQUFJLEVBQUU7UUFDckQsTUFBTUMsMkJBQ0pILGtCQUFrQkksZ0JBQWdCLEVBQUVELDRCQUE0QjtRQUVsRSxJQUFJQSw0QkFBNEIsQ0FBQ0QsS0FBS0csYUFBYSxFQUFFO1lBQ25ELE1BQU0sSUFBSVAsU0FDUiw0RUFDQTtRQUVKO1FBRUEsT0FBT0k7SUFDVDtJQUVBLE9BQU9EO0FBQ1QifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/better-auth/plugin/lib/build-collections/users/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./after-login";
|
|
2
|
+
export * from "./after-logout";
|
|
3
|
+
export * from "./before-delete";
|
|
4
|
+
export * from "./before-login";
|
|
5
|
+
export * from "./on-verified-change";
|
|
6
|
+
export * from "./sync-account";
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJzL2hvb2tzL2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gXCIuL2FmdGVyLWxvZ2luXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9hZnRlci1sb2dvdXRcIjtcbmV4cG9ydCAqIGZyb20gXCIuL2JlZm9yZS1kZWxldGVcIjtcbmV4cG9ydCAqIGZyb20gXCIuL2JlZm9yZS1sb2dpblwiO1xuZXhwb3J0ICogZnJvbSBcIi4vb24tdmVyaWZpZWQtY2hhbmdlXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9zeW5jLWFjY291bnRcIjtcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGdCQUFnQjtBQUM5QixjQUFjLGlCQUFpQjtBQUMvQixjQUFjLGtCQUFrQjtBQUNoQyxjQUFjLGlCQUFpQjtBQUMvQixjQUFjLHVCQUF1QjtBQUNyQyxjQUFjLGlCQUFpQiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-verified-change.d.ts","sourceRoot":"","sources":["../../../../../../../src/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAgB,uBAAuB,+BAmBtC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function getOnVerifiedChangeHook() {
|
|
2
|
+
const hook = async ({ data, originalDoc })=>{
|
|
3
|
+
const isVerifiedChangingToTrue = Boolean(data._verified) && !Boolean(originalDoc?._verified);
|
|
4
|
+
const isEmailVerifiedChangingToTrue = Boolean(data.emailVerified) && !Boolean(originalDoc?.emailVerified);
|
|
5
|
+
if (!isVerifiedChangingToTrue && !isEmailVerifiedChangingToTrue) {
|
|
6
|
+
return data;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
...data,
|
|
10
|
+
_verified: true,
|
|
11
|
+
emailVerified: true
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14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mV0dXJuIGhvb2s7XG59XG4iXSwibmFtZXMiOlsiZ2V0T25WZXJpZmllZENoYW5nZUhvb2siLCJob29rIiwiZGF0YSIsIm9yaWdpbmFsRG9jIiwiaXNWZXJpZmllZENoYW5naW5nVG9UcnVlIiwiQm9vbGVhbiIsIl92ZXJpZmllZCIsImlzRW1haWxWZXJpZmllZENoYW5naW5nVG9UcnVlIiwiZW1haWxWZXJpZmllZCJdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxTQUFTQTtJQUNkLE1BQU1DLE9BQW1DLE9BQU8sRUFBRUMsSUFBSSxFQUFFQyxXQUFXLEVBQUU7UUFDbkUsTUFBTUMsMkJBQ0pDLFFBQVFILEtBQUtJLFNBQVMsS0FBSyxDQUFDRCxRQUFRRixhQUFhRztRQUNuRCxNQUFNQyxnQ0FDSkYsUUFBUUgsS0FBS00sYUFBYSxLQUFLLENBQUNILFFBQVFGLGFBQWFLO1FBRXZELElBQUksQ0FBQ0osNEJBQTRCLENBQUNHLCtCQUErQjtZQUMvRCxPQUFPTDtRQUNUO1FBRUEsT0FBTztZQUNMLEdBQUdBLElBQUk7WUFDUEksV0FBVztZQUNYRSxlQUFlO1FBQ2pCO0lBQ0Y7SUFFQSxPQUFPUDtBQUNUIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-account.d.ts","sourceRoot":"","sources":["../../../../../../../src/better-auth/plugin/lib/build-collections/users/hooks/sync-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAQzD,wBAAgB,kBAAkB,IAAI,yBAAyB,CA4G9D"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BETTER_AUTH_CONTEXT_KEY } from "../../../../../adapter";
|
|
2
|
+
import { baModelKey } from "../../../../constants";
|
|
3
|
+
import { getCollectionByModelKey, getCollectionFieldNameByFieldKey } from "../../../../helpers/get-collection";
|
|
4
|
+
export function getSyncAccountHook() {
|
|
5
|
+
const hook = async ({ doc, req, operation, context })=>{
|
|
6
|
+
if (context?.syncPasswordToUser) return doc;
|
|
7
|
+
if (operation !== "create" && operation !== "update") return doc;
|
|
8
|
+
const collections = req.payload.collections;
|
|
9
|
+
const userCollection = getCollectionByModelKey(collections, baModelKey.user);
|
|
10
|
+
const accountCollection = getCollectionByModelKey(collections, baModelKey.account);
|
|
11
|
+
const userIdFieldName = getCollectionFieldNameByFieldKey(accountCollection, baModelKey.account, "userId");
|
|
12
|
+
const accountIdFieldName = getCollectionFieldNameByFieldKey(accountCollection, baModelKey.account, "accountId");
|
|
13
|
+
const providerIdFieldName = getCollectionFieldNameByFieldKey(accountCollection, baModelKey.account, "providerId");
|
|
14
|
+
const passwordFieldName = getCollectionFieldNameByFieldKey(accountCollection, baModelKey.account, "password");
|
|
15
|
+
const user = await req.payload.findByID({
|
|
16
|
+
collection: userCollection.slug,
|
|
17
|
+
id: doc.id,
|
|
18
|
+
depth: 0,
|
|
19
|
+
req,
|
|
20
|
+
showHiddenFields: true
|
|
21
|
+
});
|
|
22
|
+
if (!user || !user.hash || !user.salt) return doc;
|
|
23
|
+
const passwordValue = `${user.salt}:${user.hash}`;
|
|
24
|
+
if (operation === "create" && !(BETTER_AUTH_CONTEXT_KEY in context)) {
|
|
25
|
+
try {
|
|
26
|
+
await req.payload.create({
|
|
27
|
+
collection: accountCollection.slug,
|
|
28
|
+
data: {
|
|
29
|
+
[userIdFieldName]: doc.id,
|
|
30
|
+
[accountIdFieldName]: doc.id.toString(),
|
|
31
|
+
[providerIdFieldName]: "credential",
|
|
32
|
+
[passwordFieldName]: passwordValue
|
|
33
|
+
},
|
|
34
|
+
context: {
|
|
35
|
+
syncAccountHook: true
|
|
36
|
+
},
|
|
37
|
+
req
|
|
38
|
+
});
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error("Failed to create account for user:", error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (operation === "update") {
|
|
44
|
+
try {
|
|
45
|
+
const accounts = await req.payload.find({
|
|
46
|
+
collection: accountCollection.slug,
|
|
47
|
+
where: {
|
|
48
|
+
and: [
|
|
49
|
+
{
|
|
50
|
+
[userIdFieldName]: {
|
|
51
|
+
equals: doc.id
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
[providerIdFieldName]: {
|
|
56
|
+
equals: "credential"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
req,
|
|
62
|
+
depth: 0,
|
|
63
|
+
context: {
|
|
64
|
+
syncAccountHook: true
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const account = accounts.docs.at(0);
|
|
68
|
+
if (account) {
|
|
69
|
+
await req.payload.update({
|
|
70
|
+
collection: accountCollection.slug,
|
|
71
|
+
id: account.id,
|
|
72
|
+
data: {
|
|
73
|
+
[passwordFieldName]: passwordValue
|
|
74
|
+
},
|
|
75
|
+
req,
|
|
76
|
+
context: {
|
|
77
|
+
syncAccountHook: true
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error("Failed to sync hash/salt to account:", error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return doc;
|
|
86
|
+
};
|
|
87
|
+
return hook;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJzL2hvb2tzL3N5bmMtYWNjb3VudC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IENvbGxlY3Rpb25BZnRlckNoYW5nZUhvb2sgfSBmcm9tIFwicGF5bG9hZFwiO1xuaW1wb3J0IHsgQkVUVEVSX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AgY29uc3QgcGFzc3dvcmRWYWx1ZSA9IGAke3VzZXIuc2FsdH06JHt1c2VyLmhhc2h9YDtcblxuICAgIGlmIChvcGVyYXRpb24gPT09IFwiY3JlYXRlXCIgJiYgIShCRVRURVJfQVVUSF9DT05URVhUX0tFWSBpbiBjb250ZXh0KSkge1xuICAgICAgdHJ5IHtcbiAgICAgICAgYXdhaXQgcmVxLnBheWxvYWQuY3JlYXRlKHtcbiAgICAgICAgICBjb2xsZWN0aW9uOiBhY2NvdW50Q29sbGVjdGlvbi5zbHVnLFxuICAgICAgICAgIGRhdGE6IHtcbiAgICAgICAgICAgIFt1c2VySWRGaWVsZE5hbWVdOiBkb2MuaWQsXG4gICAgICAgICAgICBbYWNjb3VudElkRmllbGROYW1lXTogZG9jLmlkLnRvU3RyaW5nKCksXG4gICAgICAgICAgICBbcHJvdmlkZXJJZEZpZWxkTmFtZV06IFwiY3JlZGVudGlhbFwiLFxuICAgICAgICAgICAgW3Bhc3N3b3JkRmllbGROYW1lXTogcGFzc3dvcmRWYWx1ZVxuICAgICAgICAgIH0sXG4gICAgICAgICAgY29udGV4dDogeyBzeW5jQWNjb3VudEhvb2s6IHRydWUgfSxcbiAgICAgICAgICByZXFcbiAgICAgICAgfSk7XG4gICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICBjb25zb2xlLmVycm9yKFwiRmFpbGVkIHRvIGNyZWF0ZSBhY2NvdW50IGZvciB1c2VyOlwiLCBlcnJvcik7XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKG9wZXJhdGlvbiA9PT0gXCJ1cGRhdGVcIikge1xuICAgICAgdHJ5IHtcbiAgICAgICAgY29uc3QgYWNjb3VudHMgPSBhd2FpdCByZXEucGF5bG9hZC5maW5kKHtcbiAgICAgICAgICBjb2xsZWN0aW9uOiBhY2NvdW50Q29sbGVjdGlvbi5zbHVnLFxuICAgICAgICAgIHdoZXJlOiB7XG4gICAgICAgICAgICBhbmQ6IFtcbiAgICAgICAgICAgICAgeyBbdXNlcklkRmllbGROYW1lXTogeyBlcXVhbHM6IGRvYy5pZCB9IH0sXG4gICAgICAgICAgICAgIHsgW3Byb3ZpZGVySWRGaWVsZE5hbWVdOiB7IGVxdWFsczogXCJjcmVkZW50aWFsXCIgfSB9XG4gICAgICAgICAgICBdXG4gICAgICAgICAgfSxcbiAgICAgICAgICByZXEsXG4gICAgICAgICAgZGVwdGg6IDAsXG4gICAgICAgICAgY29udGV4dDogeyBzeW5jQWNjb3VudEhvb2s6IHRydWUgfVxuICAgICAgICB9KTtcblxuICAgICAgICBjb25zdCBhY2NvdW50ID0gYWNjb3VudHMuZG9jcy5hdCgwKTtcbiAgICAgICAgaWYgKGFjY291bnQpIHtcbiAgICAgICAgICBhd2FpdCByZXEucGF5bG9hZC51cGRhdGUoe1xuICAgICAgICAgICAgY29sbGVjdGlvbjogYWNjb3VudENvbGxlY3Rpb24uc2x1ZyxcbiAgICAgICAgICAgIGlkOiBhY2NvdW50LmlkLFxuICAgICAgICAgICAgZGF0YToge1xuICAgICAgICAgICAgICBbcGFzc3dvcmRGaWVsZE5hbWVdOiBwYXNzd29yZFZhbHVlXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcmVxLFxuICAgICAgICAgICAgY29udGV4dDogeyBzeW5jQWNjb3VudEhvb2s6IHRydWUgfVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICBjb25zb2xlLmVycm9yKFwiRmFpbGVkIHRvIHN5bmMgaGFzaC9zYWx0IHRvIGFjY291bnQ6XCIsIGVycm9yKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gZG9jO1xuICB9O1xuXG4gIHJldHVybiBob29rIGFzIENvbGxlY3Rpb25BZnRlckNoYW5nZUhvb2s7XG59XG4iXSwibmFtZXMiOlsiQkVUVEVSX0FVVEhfQ09OVEVYVF9LRVkiLCJiYU1vZGVsS2V5IiwiZ2V0Q29sbGVjdGlvbk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RCQUFFd0IsaUJBQWlCO3dCQUFLO29CQUNuQztnQkFDRjtZQUNGLEVBQUUsT0FBT0MsT0FBTztnQkFDZEMsUUFBUUQsS0FBSyxDQUFDLHdDQUF3Q0E7WUFDeEQ7UUFDRjtRQUVBLE9BQU81QjtJQUNUO0lBRUEsT0FBT0Q7QUFDVCJ9
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CollectionConfig } from "payload";
|
|
2
|
+
import type { BuildCollectionProps } from "../../../types";
|
|
3
|
+
export declare function buildUsersCollection({ incomingCollections, pluginOptions, resolvedSchemas }: BuildCollectionProps): CollectionConfig;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/better-auth/plugin/lib/build-collections/users/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,SAAS,CAAC;AAQpE,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,gBAAgB,CAAC;AA6BxB,wBAAgB,oBAAoB,CAAC,EACnC,mBAAmB,EACnB,aAAa,EACb,eAAe,EAChB,EAAE,oBAAoB,GAAG,gBAAgB,CA+UzC"}
|