payload-auth 1.0.1 → 1.1.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/authjs/index.d.ts +1 -0
- package/dist/authjs/index.d.ts.map +1 -0
- package/dist/authjs/index.js +1 -1
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts +1 -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 +1 -1
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts +1 -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 +1 -1
- package/dist/better-auth/adapter/generate-schema/index.d.ts +1 -0
- package/dist/better-auth/adapter/generate-schema/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/index.js +3 -3
- package/dist/better-auth/adapter/generate-schema/utils.d.ts +1 -0
- package/dist/better-auth/adapter/generate-schema/utils.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/utils.js +1 -1
- package/dist/better-auth/adapter/index.d.ts +3 -2
- package/dist/better-auth/adapter/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/index.js +115 -69
- package/dist/better-auth/adapter/transform/index.d.ts +19 -6
- package/dist/better-auth/adapter/transform/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/transform/index.js +387 -96
- package/dist/better-auth/adapter/types.d.ts +3 -1
- package/dist/better-auth/adapter/types.d.ts.map +1 -0
- package/dist/better-auth/adapter/types.js +1 -1
- package/dist/better-auth/index.d.ts +1 -0
- package/dist/better-auth/index.d.ts.map +1 -0
- package/dist/better-auth/index.js +1 -1
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.js +5 -0
- package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/check-username-plugin.js +5 -0
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts +1 -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 +8 -8
- 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-admin-routes.d.ts +14 -0
- package/dist/better-auth/plugin/helpers/get-admin-routes.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-admin-routes.js +6 -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-ip.d.ts +2 -1
- package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-ip.js +14 -14
- package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-requst-collection.js +14 -0
- package/dist/better-auth/plugin/helpers/index.d.ts +2 -1
- package/dist/better-auth/plugin/helpers/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/index.js +2 -2
- package/dist/better-auth/plugin/{lib → helpers}/prepare-session-data.d.ts +3 -2
- package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/prepare-session-data.js +42 -0
- package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts +3 -2
- package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/serialize-cookie.js +34 -34
- package/dist/better-auth/plugin/index.d.ts +8 -7
- package/dist/better-auth/plugin/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/index.js +145 -37
- package/dist/better-auth/plugin/{collections → lib/build-collections}/accounts/hooks/sync-password-to-user.d.ts +2 -1
- 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 +47 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts +7 -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 +159 -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 +107 -0
- package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts +6 -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 +196 -0
- package/dist/better-auth/plugin/lib/build-collections/index.d.ts +12 -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 +96 -0
- package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts +6 -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 +91 -0
- package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts +6 -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 +43 -0
- package/dist/better-auth/plugin/lib/build-collections/members.d.ts +6 -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 +71 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts +6 -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 +98 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts +6 -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 +113 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts +6 -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 +67 -0
- package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts +6 -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 +59 -0
- package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts +6 -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 +108 -0
- package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts +8 -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 +123 -0
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts +6 -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 +83 -0
- package/dist/better-auth/plugin/lib/build-collections/teams.d.ts +6 -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 +45 -0
- package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts +6 -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 +56 -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/forgot-password.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.js +96 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts +13 -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 +67 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.js +115 -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 +110 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.js +62 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts +3 -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 +42 -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 +79 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.js +153 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/after-login.d.ts +2 -1
- 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 +75 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/after-logout.d.ts +2 -1
- 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 +74 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts +7 -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 +45 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/before-login.d.ts +2 -1
- 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 +18 -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 +14 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/sync-account.d.ts +2 -1
- 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 +82 -0
- package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts +8 -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 +345 -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/{payload-access.d.ts → build-collections/utils/payload-access.d.ts} +2 -1
- 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 +64 -0
- package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts +7 -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 +63 -0
- package/dist/better-auth/plugin/lib/{config.d.ts → constants.d.ts} +14 -0
- package/dist/better-auth/plugin/lib/constants.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/constants.js +56 -0
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +3 -2
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/get-payload-auth.js +2 -2
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts +5 -4
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.js +26 -43
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts +5 -3
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/init-better-auth.js +6 -6
- 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 +8 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts +2 -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 +17 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts +10 -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 +118 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts +2 -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 +58 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts +2 -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 +86 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts +2 -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 +17 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts +2 -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 +17 -0
- package/dist/better-auth/plugin/lib/{ensure-password-set-before-create.d.ts → sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts} +2 -1
- 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/{password.d.ts → sanitize-better-auth-options/utils/password.d.ts} +1 -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/{respect-save-to-jwt-fields-middleware.d.ts → sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts} +6 -5
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.js +30 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts +8 -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 +115 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.scss +31 -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 +196 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.scss +131 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts +14 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.js +111 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.scss +51 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.d.ts +9 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.js +23 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.scss +8 -0
- package/dist/better-auth/plugin/payload/components/icons.d.ts +9 -0
- package/dist/better-auth/plugin/payload/components/icons.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/icons.js +437 -0
- package/dist/better-auth/plugin/payload/components/logo.d.ts +4 -1
- package/dist/better-auth/plugin/payload/components/logo.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/logo.js +22 -34
- package/dist/better-auth/plugin/payload/components/logout-button.d.ts +6 -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 +27 -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 +8 -0
- package/dist/better-auth/plugin/payload/components/styles.css +2 -2
- package/dist/better-auth/plugin/payload/components/token-field.d.ts +5 -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 +30 -0
- package/dist/better-auth/plugin/payload/exports/client.d.ts +7 -3
- package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/exports/client.js +7 -4
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts +10 -5
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/exports/rsc.js +10 -6
- 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 +8 -0
- package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts +15 -0
- package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/utils/generate-metadata.js +74 -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 +23 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts +12 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/client.js +92 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts +11 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.js +84 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.scss +25 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts +14 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.js +95 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts +11 -3
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.js +124 -92
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.scss +29 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts +8 -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 +119 -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 +69 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.scss +0 -0
- package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts +5 -0
- package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/inactivity/index.js +12 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts +9 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.js +54 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.js +121 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.scss +31 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts +56 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.js +3 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.d.ts +17 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.js +137 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.scss +23 -0
- package/dist/better-auth/plugin/payload/views/login/index.d.ts +11 -4
- package/dist/better-auth/plugin/payload/views/login/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/index.js +81 -61
- package/dist/better-auth/plugin/payload/views/login/index.scss +10 -0
- package/dist/better-auth/plugin/payload/views/logout/client.d.ts +8 -0
- package/dist/better-auth/plugin/payload/views/logout/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/logout/client.js +76 -0
- package/dist/better-auth/plugin/payload/views/logout/index.d.ts +8 -0
- package/dist/better-auth/plugin/payload/views/logout/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/logout/index.js +14 -0
- package/dist/better-auth/plugin/payload/views/logout/index.scss +0 -0
- package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts +7 -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 +72 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts +5 -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 +81 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.scss +9 -0
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts +3 -0
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.js +11 -0
- package/dist/better-auth/plugin/types.d.ts +171 -33
- package/dist/better-auth/plugin/types.d.ts.map +1 -0
- package/dist/better-auth/plugin/types.js +1 -1
- package/dist/better-auth/types.d.ts +1 -0
- package/dist/better-auth/types.d.ts.map +1 -0
- package/dist/better-auth/types.js +1 -1
- package/dist/clerk/admin-ui.d.ts +4 -0
- package/dist/clerk/admin-ui.d.ts.map +1 -0
- package/dist/clerk/admin-ui.js +5 -0
- package/dist/clerk/index.d.ts +7 -1
- package/dist/clerk/index.d.ts.map +1 -0
- package/dist/clerk/index.js +7 -2
- package/dist/clerk/plugin/auth-strategy.d.ts +11 -0
- package/dist/clerk/plugin/auth-strategy.d.ts.map +1 -0
- package/dist/clerk/plugin/auth-strategy.js +45 -0
- package/dist/clerk/plugin/collections/users/access.d.ts +14 -0
- package/dist/clerk/plugin/collections/users/access.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/access.js +36 -0
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts +14 -0
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.js +108 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.d.ts +4 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.js +5 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.d.ts +13 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.js +33 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.d.ts +11 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.js +27 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.d.ts +13 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.js +35 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.d.ts +12 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.js +86 -0
- package/dist/clerk/plugin/collections/users/fields.d.ts +6 -0
- package/dist/clerk/plugin/collections/users/fields.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/fields.js +81 -0
- package/dist/clerk/plugin/collections/users/index.d.ts +10 -0
- package/dist/clerk/plugin/collections/users/index.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/index.js +95 -0
- package/dist/clerk/plugin/components/after-login-form.d.ts +4 -0
- package/dist/clerk/plugin/components/after-login-form.d.ts.map +1 -0
- package/dist/clerk/plugin/components/after-login-form.js +65 -0
- package/dist/clerk/plugin/components/logout-button.d.ts +2 -0
- package/dist/clerk/plugin/components/logout-button.d.ts.map +1 -0
- package/dist/clerk/plugin/components/logout-button.js +49 -0
- package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts +6 -0
- package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts.map +1 -0
- package/dist/clerk/plugin/components/sync-clerk-users-button.js +75 -0
- package/dist/clerk/plugin.d.ts +6 -0
- package/dist/clerk/plugin.d.ts.map +1 -0
- package/dist/clerk/plugin.js +63 -0
- package/dist/clerk/types.d.ts +63 -0
- package/dist/clerk/types.d.ts.map +1 -0
- package/dist/clerk/types.js +3 -0
- package/dist/clerk/utils/clerk-user.d.ts +21 -0
- package/dist/clerk/utils/clerk-user.d.ts.map +1 -0
- package/dist/clerk/utils/clerk-user.js +45 -0
- package/dist/clerk/utils/index.d.ts +4 -0
- package/dist/clerk/utils/index.d.ts.map +1 -0
- package/dist/clerk/utils/index.js +5 -0
- package/dist/clerk/utils/load-clerk-instance.d.ts +8 -0
- package/dist/clerk/utils/load-clerk-instance.d.ts.map +1 -0
- package/dist/clerk/utils/load-clerk-instance.js +11 -0
- package/dist/clerk/utils/svix.d.ts +9 -0
- package/dist/clerk/utils/svix.d.ts.map +1 -0
- package/dist/clerk/utils/svix.js +40 -0
- package/dist/clerk/utils/user.d.ts +17 -0
- package/dist/clerk/utils/user.d.ts.map +1 -0
- package/dist/clerk/utils/user.js +46 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -5
- package/dist/kinde/index.d.ts +1 -0
- package/dist/kinde/index.d.ts.map +1 -0
- package/dist/kinde/index.js +1 -1
- package/package.json +44 -18
- package/LICENSE.md +0 -17
- package/dist/authjs/index.js.map +0 -1
- package/dist/better-auth/adapter/dev/bin/run.d.ts +0 -1
- package/dist/better-auth/adapter/dev/bin/run.js +0 -64
- package/dist/better-auth/adapter/dev/bin/run.js.map +0 -1
- package/dist/better-auth/adapter/dev/bin/schema.d.ts +0 -22
- package/dist/better-auth/adapter/dev/bin/schema.js +0 -160
- package/dist/better-auth/adapter/dev/bin/schema.js.map +0 -1
- package/dist/better-auth/adapter/dev/collections.d.ts +0 -3
- package/dist/better-auth/adapter/dev/collections.js +0 -212
- package/dist/better-auth/adapter/dev/collections.js.map +0 -1
- package/dist/better-auth/adapter/dev/index.d.ts +0 -3
- package/dist/better-auth/adapter/dev/index.js +0 -168
- package/dist/better-auth/adapter/dev/index.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/index.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/utils.js.map +0 -1
- package/dist/better-auth/adapter/index.js.map +0 -1
- package/dist/better-auth/adapter/test/adapter.test.d.ts +0 -1
- package/dist/better-auth/adapter/test/adapter.test.js +0 -181
- package/dist/better-auth/adapter/test/adapter.test.js.map +0 -1
- package/dist/better-auth/adapter/test/better-auth-adapter-test.d.ts +0 -7
- package/dist/better-auth/adapter/test/better-auth-adapter-test.js +0 -425
- package/dist/better-auth/adapter/test/better-auth-adapter-test.js.map +0 -1
- package/dist/better-auth/adapter/test/schema.test.d.ts +0 -1
- package/dist/better-auth/adapter/test/schema.test.js +0 -796
- package/dist/better-auth/adapter/test/schema.test.js.map +0 -1
- package/dist/better-auth/adapter/test/test_payload1/schema.d.ts +0 -23
- package/dist/better-auth/adapter/test/test_payload1/schema.js +0 -177
- package/dist/better-auth/adapter/test/test_payload1/schema.js.map +0 -1
- package/dist/better-auth/adapter/test/test_payload2/schema.d.ts +0 -23
- package/dist/better-auth/adapter/test/test_payload2/schema.js +0 -167
- package/dist/better-auth/adapter/test/test_payload2/schema.js.map +0 -1
- package/dist/better-auth/adapter/test/test_payload3/schema.d.ts +0 -23
- package/dist/better-auth/adapter/test/test_payload3/schema.js +0 -198
- package/dist/better-auth/adapter/test/test_payload3/schema.js.map +0 -1
- package/dist/better-auth/adapter/transform/index.js.map +0 -1
- package/dist/better-auth/adapter/types.js.map +0 -1
- package/dist/better-auth/index.js.map +0 -1
- package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.js +0 -47
- package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.d.ts +0 -6
- package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.js +0 -106
- package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/after-login.js +0 -71
- package/dist/better-auth/plugin/collections/users/hooks/after-login.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/after-logout.js +0 -49
- package/dist/better-auth/plugin/collections/users/hooks/after-logout.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/before-login.js +0 -18
- package/dist/better-auth/plugin/collections/users/hooks/before-login.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.d.ts +0 -5
- package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.js +0 -33
- package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.d.ts +0 -2
- package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.js +0 -14
- package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/sync-account.js +0 -82
- package/dist/better-auth/plugin/collections/users/hooks/sync-account.js.map +0 -1
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.js.map +0 -1
- package/dist/better-auth/plugin/helpers/get-ip.js.map +0 -1
- package/dist/better-auth/plugin/helpers/index.js.map +0 -1
- package/dist/better-auth/plugin/helpers/serialize-cookie.js.map +0 -1
- package/dist/better-auth/plugin/index.js.map +0 -1
- package/dist/better-auth/plugin/lib/auth-strategy.d.ts +0 -8
- package/dist/better-auth/plugin/lib/auth-strategy.js +0 -48
- package/dist/better-auth/plugin/lib/auth-strategy.js.map +0 -1
- package/dist/better-auth/plugin/lib/build-collection-configs.d.ts +0 -11
- package/dist/better-auth/plugin/lib/build-collection-configs.js +0 -1558
- package/dist/better-auth/plugin/lib/build-collection-configs.js.map +0 -1
- package/dist/better-auth/plugin/lib/config.js +0 -43
- package/dist/better-auth/plugin/lib/config.js.map +0 -1
- package/dist/better-auth/plugin/lib/ensure-password-set-before-create.js +0 -24
- package/dist/better-auth/plugin/lib/ensure-password-set-before-create.js.map +0 -1
- package/dist/better-auth/plugin/lib/get-payload-auth.js.map +0 -1
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.js.map +0 -1
- package/dist/better-auth/plugin/lib/init-better-auth.js.map +0 -1
- package/dist/better-auth/plugin/lib/password.js +0 -63
- package/dist/better-auth/plugin/lib/password.js.map +0 -1
- package/dist/better-auth/plugin/lib/payload-access.js +0 -64
- package/dist/better-auth/plugin/lib/payload-access.js.map +0 -1
- package/dist/better-auth/plugin/lib/prepare-session-data.js +0 -42
- package/dist/better-auth/plugin/lib/prepare-session-data.js.map +0 -1
- package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.js +0 -30
- package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.js.map +0 -1
- package/dist/better-auth/plugin/lib/sanitize-auth-options.d.ts +0 -5
- package/dist/better-auth/plugin/lib/sanitize-auth-options.js +0 -298
- package/dist/better-auth/plugin/lib/sanitize-auth-options.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/admin-buttons.d.ts +0 -5
- package/dist/better-auth/plugin/payload/components/admin-buttons.js +0 -222
- package/dist/better-auth/plugin/payload/components/admin-buttons.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/login-redirect.d.ts +0 -1
- package/dist/better-auth/plugin/payload/components/login-redirect.js +0 -6
- package/dist/better-auth/plugin/payload/components/login-redirect.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/logo.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/logout.d.ts +0 -1
- package/dist/better-auth/plugin/payload/components/logout.js +0 -61
- package/dist/better-auth/plugin/payload/components/logout.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/sign-in.d.ts +0 -3
- package/dist/better-auth/plugin/payload/components/sign-in.js +0 -384
- package/dist/better-auth/plugin/payload/components/sign-in.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/sign-up.d.ts +0 -6
- package/dist/better-auth/plugin/payload/components/sign-up.js +0 -502
- package/dist/better-auth/plugin/payload/components/sign-up.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/button.d.ts +0 -10
- package/dist/better-auth/plugin/payload/components/ui/button.js +0 -42
- package/dist/better-auth/plugin/payload/components/ui/button.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/card.d.ts +0 -9
- package/dist/better-auth/plugin/payload/components/ui/card.js +0 -55
- package/dist/better-auth/plugin/payload/components/ui/card.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/checkbox.d.ts +0 -4
- package/dist/better-auth/plugin/payload/components/ui/checkbox.js +0 -23
- package/dist/better-auth/plugin/payload/components/ui/checkbox.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/cn.d.ts +0 -2
- package/dist/better-auth/plugin/payload/components/ui/cn.js +0 -7
- package/dist/better-auth/plugin/payload/components/ui/cn.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/input.d.ts +0 -3
- package/dist/better-auth/plugin/payload/components/ui/input.js +0 -14
- package/dist/better-auth/plugin/payload/components/ui/input.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/label.d.ts +0 -4
- package/dist/better-auth/plugin/payload/components/ui/label.js +0 -15
- package/dist/better-auth/plugin/payload/components/ui/label.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/password-input.d.ts +0 -2
- package/dist/better-auth/plugin/payload/components/ui/password-input.js +0 -55
- package/dist/better-auth/plugin/payload/components/ui/password-input.js.map +0 -1
- package/dist/better-auth/plugin/payload/exports/client.js.map +0 -1
- package/dist/better-auth/plugin/payload/exports/rsc.js.map +0 -1
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.js.map +0 -1
- package/dist/better-auth/plugin/payload/views/login/index.js.map +0 -1
- package/dist/better-auth/plugin/types.js.map +0 -1
- package/dist/better-auth/types.js.map +0 -1
- package/dist/clerk/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kinde/index.js.map +0 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { APIError } from "payload";
|
|
2
|
+
import { createClerkClient } from "@clerk/backend";
|
|
3
|
+
import { getPrimaryEmail } from "../../../../utils";
|
|
4
|
+
export const syncClerkUsersEndpoint = ({ userCollectionSlug })=>{
|
|
5
|
+
return {
|
|
6
|
+
path: "/sync-from-clerk",
|
|
7
|
+
method: "post",
|
|
8
|
+
handler: async (req)=>{
|
|
9
|
+
try {
|
|
10
|
+
const { payload } = req;
|
|
11
|
+
const mappingFunction = payload.config.custom.clerkPlugin.clerkToPayloadMapping;
|
|
12
|
+
if (!process.env.CLERK_SECRET_KEY) {
|
|
13
|
+
throw new APIError("CLERK_SECRET_KEY is not defined", 400);
|
|
14
|
+
}
|
|
15
|
+
const clerkClient = createClerkClient({
|
|
16
|
+
secretKey: process.env.CLERK_SECRET_KEY
|
|
17
|
+
});
|
|
18
|
+
const totalUsers = await clerkClient.users.getCount();
|
|
19
|
+
const limit = 100;
|
|
20
|
+
const totalPages = Math.ceil(totalUsers / limit);
|
|
21
|
+
let allUsers = [];
|
|
22
|
+
for(let page = 0; page < totalPages; page++){
|
|
23
|
+
const offset = page * limit;
|
|
24
|
+
const pageUsers = await fetch(`https://api.clerk.com/v1/users?limit=${limit}&offset=${offset}`, {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${process.env.CLERK_SECRET_KEY}`
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const pageUsersData = await pageUsers.json();
|
|
30
|
+
allUsers = [
|
|
31
|
+
...allUsers,
|
|
32
|
+
...pageUsersData
|
|
33
|
+
];
|
|
34
|
+
console.log(`Fetched page ${page + 1}/${totalPages}, users: ${pageUsersData.length}`);
|
|
35
|
+
}
|
|
36
|
+
let created = 0;
|
|
37
|
+
let updated = 0;
|
|
38
|
+
for (const clerkUser of allUsers){
|
|
39
|
+
const payloadUserData = mappingFunction(clerkUser);
|
|
40
|
+
const randomPassword = Array(3).fill(0).map(()=>Math.random().toString(36).slice(2)).join("");
|
|
41
|
+
let existingUser = await payload.find({
|
|
42
|
+
collection: userCollectionSlug,
|
|
43
|
+
where: {
|
|
44
|
+
clerkId: {
|
|
45
|
+
equals: clerkUser.id
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (!existingUser.docs.length && clerkUser.emailAddresses && clerkUser.emailAddresses.length > 0) {
|
|
50
|
+
const primaryEmail = getPrimaryEmail(clerkUser);
|
|
51
|
+
if (primaryEmail) {
|
|
52
|
+
existingUser = await payload.find({
|
|
53
|
+
collection: userCollectionSlug,
|
|
54
|
+
where: {
|
|
55
|
+
email: {
|
|
56
|
+
equals: primaryEmail
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (existingUser.docs.length > 0) {
|
|
63
|
+
await payload.update({
|
|
64
|
+
collection: userCollectionSlug,
|
|
65
|
+
id: existingUser.docs[0].id,
|
|
66
|
+
data: payloadUserData
|
|
67
|
+
});
|
|
68
|
+
updated++;
|
|
69
|
+
} else {
|
|
70
|
+
await payload.create({
|
|
71
|
+
collection: userCollectionSlug,
|
|
72
|
+
data: {
|
|
73
|
+
...payloadUserData,
|
|
74
|
+
password: randomPassword
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
created++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
console.log(`Synced ${allUsers.length} users from Clerk. Created: ${created}, Updated: ${updated}`);
|
|
81
|
+
const response = {
|
|
82
|
+
syncedUsers: allUsers.length,
|
|
83
|
+
success: true,
|
|
84
|
+
message: `Successfully synced ${allUsers.length} users from Clerk. Created: ${created}, Updated: ${updated}`,
|
|
85
|
+
count: allUsers.length,
|
|
86
|
+
created,
|
|
87
|
+
updated
|
|
88
|
+
};
|
|
89
|
+
return new Response(JSON.stringify(response), {
|
|
90
|
+
status: 200,
|
|
91
|
+
headers: {
|
|
92
|
+
"Content-Type": "application/json"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error("Error syncing users from Clerk:", error);
|
|
97
|
+
const errorResponse = {
|
|
98
|
+
syncedUsers: 0,
|
|
99
|
+
success: false,
|
|
100
|
+
error: error instanceof Error ? error.message : "Failed to sync users from Clerk"
|
|
101
|
+
};
|
|
102
|
+
throw new APIError(errorResponse.error || "Unknown error", 500);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jbGVyay9wbHVnaW4vY29sbGVjdGlvbnMvdXNlcnMvZW5kcG9pbnRzL3N5bmMtZnJvbS1jbGVyay50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBUElFcnJvciwgRW5kcG9pbnQgfSBmcm9tIFwicGF5bG9hZFwiO1xuaW1wb3J0IHsgY3JlYXRlQ2xlcmtDbGllbnQgfSBmcm9tIFwiQGNsZXJrL2JhY2tlbmRcIjtcbmltcG9ydCB0eXBlIHsgVXNlciB9IGZyb20gXCJAY2xlcmsvYmFja2VuZFwiO1xuaW1wb3J0IHsgZ2V0UHJpbWFyeUVtYWlsIH0gZnJvbSBcIi4uLy4uLy4uLy4u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PSAwO1xuXG4gICAgICAgIGZvciAoY29uc3QgY2xlcmtVc2VyIG9mIGFsbFVzZXJzKSB7XG4gICAgICAgICAgY29uc3QgcGF5bG9hZFVzZXJEYXRhID0gbWFwcGluZ0Z1bmN0aW9uKGNsZXJrVXNlcik7XG5cbiAgICAgICAgICBjb25zdCByYW5kb21QYXNzd29yZCA9IEFycmF5KDMpXG4gICAgICAgICAgICAuZmlsbCgwKVxuICAgICAgICAgICAgLm1hcCgoKSA9PiBNYXRoLnJhbmRvbSgpLnRvU3RyaW5nKDM2KS5zbGljZSgyKSlcbiAgICAgICAgICAgIC5qb2luKFwiXCIpO1xuXG4gICAgICAgICAgbGV0IGV4aXN0aW5nVXNlciA9IGF3YWl0IHBheWxvYWQuZmluZCh7XG4gICAgICAgICAgICBjb2xsZWN0aW9uOiB1c2VyQ29sbGVjdGlvblNsdWcsXG4gICAgICAgICAgICB3aGVyZTogeyBjbGVya0lkOiB7IGVxdWFsczogY2xlcmtVc2VyLmlkIH0gfSxcbiAgICAgICAgICB9KTtcblxuICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICFleGlzdGluZ1VzZXIuZG9jcy5sZW5ndGggJiZcbiAgICAgICAgICAgIGNsZXJrVXNlci5lbWFpbEFkZHJlc3NlcyAmJlxuICAgICAgICAgICAgY2xlcmtVc2VyLmVtYWlsQWRkcmVzc2VzLmxlbmd0aCA+IDBcbiAgICAgICAgICApIHtcbiAgICAgICAgICAgIGNvbnN0IHByaW1hcnlFbWFpbCA9IGdldFByaW1hcnlFbWFpbChjbGVya1VzZXIpO1xuXG4gICAgICAgICAgICBpZiAocHJpbWFyeUVtYWlsKSB7XG4gICAgICAgICAgICAgIGV4aXN0aW5nVXNlciA9IGF3YWl0IHBheWxvYWQuZmluZCh7XG4gICAgICAgICAgICAgICAgY29sbGVjdGlvbjogdXNlckNvbGxlY3Rpb25TbHVnLFxuICAgICAgICAgICAgICAgIHdoZXJlOiB7IGVtYWlsOiB7IGVxdWFsczogcHJpbWFyeUVtYWlsIH0gfSxcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKGV4aXN0aW5nVXNlci5kb2NzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgIGF3YWl0IHBheWxvYWQudXBkYXRlKHtcbiAgICAgICAgICAgICAgY29sbGVjdGlvbjogdXNlckNvbGxlY3Rpb25TbHVnLFxuICAgICAgICAgICAgICBpZDogZXhpc3RpbmdVc2VyLmRvY3NbMF0uaWQsXG4gICAgICAgICAgICAgIGRhdGE6IHBheWxvYWRVc2VyRGF0YSxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgdXBkYXRlZCsrO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBhd2FpdCBwYXlsb2FkLmNyZWF0ZSh7XG4gICAgICAgICAgICAgIGNvbGxlY3Rpb246IHVzZXJDb2xsZWN0aW9uU2x1ZyxcbiAgICAgICAgICAgICAgZGF0YToge1xuICAgICAgICAgICAgICAgIC4uLnBheWxvYWRVc2VyRGF0YSxcbiAgICAgICAgICAgICAgICBwYXNzd29yZDogcmFuZG9tUGFzc3dvcmQsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGNyZWF0ZWQrKztcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBjb25zb2xlLmxvZyhcbiAgICAgICAgICBgU3luY2VkICR7YWxsVXNlcnMubGVuZ3RofSB1c2VycyBmcm9tIENsZXJrLiBDcmVhdGVkOiAke2NyZWF0ZWR9LCBVcGRhdGVkOiAke3VwZGF0ZWR9YFxuICAgICAgICApO1xuXG4gICAgICAgIGNvbnN0IHJlc3BvbnNlOiBTeW5jQ2xlcmtVc2Vyc1Jlc3BvbnNlID0ge1xuICAgICAgICAgIHN5bmNlZFVzZXJzOiBhbGxVc2Vycy5sZW5ndGgsXG4gICAgICAgICAgc3VjY2VzczogdHJ1ZSxcbiAgICAgICAgICBtZXNzYWdlOiBgU3VjY2Vzc2Z1bGx5IHN5bmNlZCAke2FsbFVzZXJzLmxlbmd0aH0gdXNlcnMgZnJvbSBDbGVyay4gQ3JlYXRlZDogJHtjcmVhdGVkfSwgVXBkYXRlZDogJHt1cGRhdGVkfWAsXG4gICAgICAgICAgY291bnQ6IGFsbFVzZXJzLmxlbmd0aCxcbiAgICAgICAgICBjcmVhdGVkLFxuICAgICAgICAgIHVwZGF0ZWQsXG4gICAgICAgIH07XG5cbiAgICAgICAgcmV0dXJuIG5ldyBSZXNwb25zZShcbiAgICAgICAgICBKU09OLnN0cmluZ2lmeShyZXNwb25zZSksXG4gICAgICAgICAge1xuICAgICAgICAgICAgc3RhdHVzOiAyMDAsXG4gICAgICAgICAgICBoZWFkZXJzOiB7IFwiQ29udGVudC1UeXBlXCI6IFwiYXBwbGljYXRpb24vanNvblwiIH0sXG4gICAgICAgICAgfVxuICAgICAgICApO1xuICAgICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgICAgY29uc29sZS5lcnJvcihcIkVycm9yIHN5bmNpbmcgdXNlcnMgZnJvbSBDbGVyazpcIiwgZXJyb3IpO1xuXG4gICAgICAgIGNvbnN0IGVycm9yUmVzcG9uc2U6IFN5bmNDbGVya1VzZXJzUmVzcG9uc2UgPSB7XG4gICAgICAgICAgc3luY2VkVXNlcnM6IDAsXG4gICAgICAgICAgc3VjY2VzczogZmFsc2UsXG4gICAgICAgICAgZXJyb3I6IGVycm9yIGluc3RhbmNlb2YgRXJyb3JcbiAgICAgICAgICAgID8gZXJyb3IubWVzc2FnZVxuICAgICAgICAgICAgOiBcIkZhaWxlZCB0byBzeW5jIHVzZXJzIGZyb20gQ2xlcmtcIixcbiAgICAgICAgfTtcblxuICAgICAgICB0aHJvdyBuZXcgQVBJRXJyb3IoXG4gICAgICAgICAgZXJyb3JSZXNwb25zZS5lcnJvciB8fCBcIlVua25vd24gZXJyb3JcIixcbiAgICAgICAgICA1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29CQUNFUSxRQUFRO29CQUNSMUMsU0FBUzt3QkFBRSxnQkFBZ0I7b0JBQW1CO2dCQUNoRDtZQUVKLEVBQUUsT0FBTzJDLE9BQU87Z0JBQ2R2QyxRQUFRdUMsS0FBSyxDQUFDLG1DQUFtQ0E7Z0JBRWpELE1BQU1DLGdCQUF3QztvQkFDNUNULGFBQWE7b0JBQ2JDLFNBQVM7b0JBQ1RPLE9BQU9BLGlCQUFpQkUsUUFDcEJGLE1BQU1OLE9BQU8sR0FDYjtnQkFDTjtnQkFFQSxNQUFNLElBQUlyRSxTQUNSNEUsY0FBY0QsS0FBSyxJQUFJLGlCQUN2QjtZQUVKO1FBQ0Y7SUFDRjtBQUNGLEVBQUUifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/clerk/plugin/collections/users/endpoints/webhook/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { handleUserCreated } from './userCreated';
|
|
2
|
+
export { handleUserUpdated } from './userUpdated';
|
|
3
|
+
export { handleUserDeleted } from './userDeleted';
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jbGVyay9wbHVnaW4vY29sbGVjdGlvbnMvdXNlcnMvZW5kcG9pbnRzL3dlYmhvb2svaGFuZGxlcnMvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgaGFuZGxlVXNlckNyZWF0ZWQgfSBmcm9tICcuL3VzZXJDcmVhdGVkJ1xuZXhwb3J0IHsgaGFuZGxlVXNlclVwZGF0ZWQgfSBmcm9tICcuL3VzZXJVcGRhdGVkJ1xuZXhwb3J0IHsgaGFuZGxlVXNlckRlbGV0ZWQgfSBmcm9tICcuL3VzZXJEZWxldGVkJyAiXSwibmFtZXMiOlsiaGFuZGxlVXNlckNyZWF0ZWQiLCJoYW5kbGVVc2VyVXBkYXRlZCIsImhhbmRsZVVzZXJEZWxldGVkIl0sIm1hcHBpbmdzIjoiQUFBQSxTQUFTQSxpQkFBaUIsUUFBUSxnQkFBZTtBQUNqRCxTQUFTQyxpQkFBaUIsUUFBUSxnQkFBZTtBQUNqRCxTQUFTQyxpQkFBaUIsUUFBUSxnQkFBZSJ9
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UserJSON } from '@clerk/backend';
|
|
2
|
+
import type { BasePayload, User } from 'payload';
|
|
3
|
+
import { ClerkPluginOptions } from '../../../../../../types';
|
|
4
|
+
interface UserCreatedHandlerParams {
|
|
5
|
+
data: any;
|
|
6
|
+
payload: BasePayload;
|
|
7
|
+
userSlug: string;
|
|
8
|
+
mappingFunction: (clerkUser: UserJSON) => Omit<User, 'id'>;
|
|
9
|
+
options: ClerkPluginOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare function handleUserCreated({ data, payload, userSlug, mappingFunction, options }: UserCreatedHandlerParams): Promise<void>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=userCreated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userCreated.d.ts","sourceRoot":"","sources":["../../../../../../../../src/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAI5D,UAAU,wBAAwB;IAChC,IAAI,EAAE,GAAG,CAAA;IACT,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,CAAC,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC1D,OAAO,EAAE,kBAAkB,CAAA;CAC5B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsC1C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { findUserFromClerkUser } from '../../../../../../utils/user';
|
|
2
|
+
export async function handleUserCreated({ data, payload, userSlug, mappingFunction, options }) {
|
|
3
|
+
const clerkUser = data;
|
|
4
|
+
try {
|
|
5
|
+
const existingUsers = await findUserFromClerkUser({
|
|
6
|
+
payload,
|
|
7
|
+
userSlug,
|
|
8
|
+
clerkUser
|
|
9
|
+
});
|
|
10
|
+
if (existingUsers.docs.length === 0) {
|
|
11
|
+
let userData = {
|
|
12
|
+
...mappingFunction(clerkUser)
|
|
13
|
+
};
|
|
14
|
+
if (!userData.role) {
|
|
15
|
+
userData.role = 'user';
|
|
16
|
+
}
|
|
17
|
+
if (!userData.password) {
|
|
18
|
+
userData.password = Array(3).fill(0).map(()=>Math.random().toString(36).slice(2)).join('');
|
|
19
|
+
}
|
|
20
|
+
await payload.create({
|
|
21
|
+
collection: userSlug,
|
|
22
|
+
data: userData
|
|
23
|
+
});
|
|
24
|
+
if (options.enableDebugLogs) {
|
|
25
|
+
console.log(`Created new user from Clerk: ${clerkUser.id}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('Error creating user from Clerk webhook:', error);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uI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QUFJQyxLQUFLLENBQUMsSUFDM0NDLElBQUksQ0FBQztZQUNWO1lBRUEsTUFBTWxCLFFBQVFtQixNQUFNLENBQUM7Z0JBQ25CQyxZQUFZbkI7Z0JBQ1pGLE1BQU1TO1lBQ1I7WUFFQSxJQUFJTCxRQUFRa0IsZUFBZSxFQUFFO2dCQUMzQkMsUUFBUUMsR0FBRyxDQUFDLENBQUMsNkJBQTZCLEVBQUVuQixVQUFVb0IsRUFBRSxFQUFFO1lBQzVEO1FBQ0Y7SUFDRixFQUFFLE9BQU9DLE9BQU87UUFDZEgsUUFBUUcsS0FBSyxDQUFDLDJDQUEyQ0E7SUFDM0Q7QUFDRiJ9
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Payload } from 'payload';
|
|
2
|
+
import { ClerkPluginOptions } from '../../../../../../types';
|
|
3
|
+
interface UserDeletedHandlerParams {
|
|
4
|
+
data: any;
|
|
5
|
+
payload: Payload;
|
|
6
|
+
userSlug: string;
|
|
7
|
+
options: ClerkPluginOptions;
|
|
8
|
+
}
|
|
9
|
+
export declare function handleUserDeleted({ data, payload, userSlug, options }: UserDeletedHandlerParams): Promise<void>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=userDeleted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userDeleted.d.ts","sourceRoot":"","sources":["../../../../../../../../src/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAG5D,UAAU,wBAAwB;IAChC,IAAI,EAAE,GAAG,CAAA;IACT,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,kBAAkB,CAAA;CAC5B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,OAAO,EACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB1C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { findUserFromClerkUser } from '../../../../../../utils/user';
|
|
2
|
+
export async function handleUserDeleted({ data, payload, userSlug, options }) {
|
|
3
|
+
const clerkId = data.id;
|
|
4
|
+
try {
|
|
5
|
+
const existingUsers = await findUserFromClerkUser({
|
|
6
|
+
payload,
|
|
7
|
+
userSlug,
|
|
8
|
+
clerkUser: {
|
|
9
|
+
id: clerkId
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
if (existingUsers.docs.length > 0) {
|
|
13
|
+
const existingUser = existingUsers.docs[0];
|
|
14
|
+
await payload.delete({
|
|
15
|
+
collection: userSlug,
|
|
16
|
+
id: existingUser.id
|
|
17
|
+
});
|
|
18
|
+
if (options.enableDebugLogs) {
|
|
19
|
+
console.log(`Deleted user from Clerk: ${clerkId}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error('Error deleting user from Clerk webhook:', error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jbGVyay9wbHVnaW4vY29sbGVjdGlvbnMvdXNlcnMvZW5kcG9pbnRzL3dlYmhvb2svaGFuZGxlcnMvdXNlckRlbGV0ZWQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUGF5bG9hZCB9IGZyb20gJ3BheWxvYWQnXG5pbXBvcnQgeyBDbGVya1BsdWdpbk9wdGlvbnMgfSBmcm9tICcuLi8uLi8uLi8uLi8uLi8uLi90eXBlcydcbmltcG9ydCB7IGZpbmRVc2VyRnJvbUNsZXJrVXNlciB9IGZyb20gJy4uLy4uLy4uLy4uLy4uLy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UFDZEYsUUFBUUUsS0FBSyxDQUFDLDJDQUEyQ0E7SUFDM0Q7QUFDRiJ9
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Payload, User } from 'payload';
|
|
2
|
+
import { ClerkPluginOptions } from '../../../../../../types';
|
|
3
|
+
import type { UserJSON } from '@clerk/types';
|
|
4
|
+
interface UserUpdatedHandlerParams {
|
|
5
|
+
data: any;
|
|
6
|
+
payload: Payload;
|
|
7
|
+
userSlug: string;
|
|
8
|
+
mappingFunction: (clerkUser: Partial<UserJSON>) => Omit<User, 'id'>;
|
|
9
|
+
options: ClerkPluginOptions;
|
|
10
|
+
}
|
|
11
|
+
export declare function handleUserUpdated({ data, payload, userSlug, mappingFunction, options }: UserUpdatedHandlerParams): Promise<void>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=userUpdated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userUpdated.d.ts","sourceRoot":"","sources":["../../../../../../../../src/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,UAAU,wBAAwB;IAChC,IAAI,EAAE,GAAG,CAAA;IACT,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACnE,OAAO,EAAE,kBAAkB,CAAA;CAC5B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,eAAe,EACf,OAAO,EACR,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC1C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { findUserFromClerkUser } from '../../../../../../utils/user';
|
|
2
|
+
export async function handleUserUpdated({ data, payload, userSlug, mappingFunction, options }) {
|
|
3
|
+
const clerkUser = data;
|
|
4
|
+
try {
|
|
5
|
+
const existingUsers = await findUserFromClerkUser({
|
|
6
|
+
payload,
|
|
7
|
+
userSlug,
|
|
8
|
+
clerkUser
|
|
9
|
+
});
|
|
10
|
+
if (existingUsers.docs.length > 0) {
|
|
11
|
+
const existingUser = existingUsers.docs[0];
|
|
12
|
+
let userData = {
|
|
13
|
+
...mappingFunction(clerkUser)
|
|
14
|
+
};
|
|
15
|
+
if ('role' in userData) {
|
|
16
|
+
const { role, ...dataWithoutRole } = userData;
|
|
17
|
+
userData = dataWithoutRole;
|
|
18
|
+
}
|
|
19
|
+
await payload.update({
|
|
20
|
+
collection: userSlug,
|
|
21
|
+
id: existingUser.id,
|
|
22
|
+
data: userData
|
|
23
|
+
});
|
|
24
|
+
if (options.enableDebugLogs) {
|
|
25
|
+
console.log(`Updated user from Clerk: ${clerkUser.id}`);
|
|
26
|
+
}
|
|
27
|
+
} else if (options.enableDebugLogs) {
|
|
28
|
+
console.log(`Attempted to update non-existent user: ${clerkUser.id}`);
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Error updating user from Clerk webhook:', error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jbGVyay9wbHVnaW4vY29sbGVjdGlvbnMvdXNlcnMvZW5kcG9pbnRzL3dlYmhvb2svaGFuZGxlcnMvdXNlclVwZGF0ZWQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgUGF5bG9hZCwgVXNlciB9IGZyb20gJ3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RQUFRWSxlQUFlLEVBQUU7WUFDbENDLFFBQVFDLEdBQUcsQ0FBQyxDQUFDLHVDQUF1QyxFQUFFYixVQUFVVSxFQUFFLEVBQUU7UUFDdEU7SUFDRixFQUFFLE9BQU9JLE9BQU87UUFDZEYsUUFBUUUsS0FBSyxDQUFDLDJDQUEyQ0E7SUFDM0Q7QUFDRiJ9
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Endpoint } from 'payload';
|
|
2
|
+
import { ClerkPluginOptions } from '../../../../../types';
|
|
3
|
+
interface ClerkWebhookEndpointOptions {
|
|
4
|
+
userSlug: string;
|
|
5
|
+
options: ClerkPluginOptions;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates a webhook endpoint for handling Clerk events
|
|
9
|
+
*/
|
|
10
|
+
export declare const clerkWebhookEndpoint: ({ userSlug, options }: ClerkWebhookEndpointOptions) => Endpoint;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/clerk/plugin/collections/users/endpoints/webhook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAIzD,UAAU,2BAA2B;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,kBAAkB,CAAA;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,uBAGlC,2BAA2B,KAAG,QAkFhC,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { APIError } from 'payload';
|
|
2
|
+
import { validateWebhook } from '../../../../../utils/svix';
|
|
3
|
+
import { handleUserCreated, handleUserDeleted, handleUserUpdated } from './handlers';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a webhook endpoint for handling Clerk events
|
|
6
|
+
*/ export const clerkWebhookEndpoint = ({ userSlug, options })=>{
|
|
7
|
+
const mappingFunction = options.users?.clerkToPayloadMapping // This is forced to be set by the plugin.ts
|
|
8
|
+
;
|
|
9
|
+
if (!mappingFunction) {
|
|
10
|
+
throw new Error('Clerk to Payload mapping function is not set');
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
path: '/clerk-webhook',
|
|
14
|
+
method: 'post',
|
|
15
|
+
handler: async (req)=>{
|
|
16
|
+
try {
|
|
17
|
+
const { payload } = req;
|
|
18
|
+
if (!req.text) {
|
|
19
|
+
throw new APIError('Invalid request body', 400);
|
|
20
|
+
}
|
|
21
|
+
// Validate the webhook before reading the body
|
|
22
|
+
if (!await validateWebhook({
|
|
23
|
+
request: req,
|
|
24
|
+
secret: options.webhook?.svixSecret
|
|
25
|
+
})) {
|
|
26
|
+
throw new APIError('Invalid webhook signature', 401);
|
|
27
|
+
}
|
|
28
|
+
// Now we can read the body safely
|
|
29
|
+
const rawBody = await req.text();
|
|
30
|
+
const webhookData = parseWebhookData(rawBody);
|
|
31
|
+
const { type, data } = webhookData;
|
|
32
|
+
if (options.enableDebugLogs) {
|
|
33
|
+
console.log(`Processing Clerk webhook: ${type}`);
|
|
34
|
+
}
|
|
35
|
+
switch(type){
|
|
36
|
+
case 'user.created':
|
|
37
|
+
await handleUserCreated({
|
|
38
|
+
data,
|
|
39
|
+
payload,
|
|
40
|
+
userSlug,
|
|
41
|
+
mappingFunction,
|
|
42
|
+
options
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
case 'user.updated':
|
|
46
|
+
await handleUserUpdated({
|
|
47
|
+
data,
|
|
48
|
+
payload,
|
|
49
|
+
userSlug,
|
|
50
|
+
mappingFunction: mappingFunction,
|
|
51
|
+
options
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
case 'user.deleted':
|
|
55
|
+
await handleUserDeleted({
|
|
56
|
+
data,
|
|
57
|
+
payload,
|
|
58
|
+
userSlug,
|
|
59
|
+
options
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
if (options.enableDebugLogs) {
|
|
64
|
+
console.log(`Unhandled Clerk webhook type: ${type}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return new Response(JSON.stringify({
|
|
68
|
+
success: true
|
|
69
|
+
}), {
|
|
70
|
+
status: 200,
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-Type': 'application/json'
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.error('Error processing Clerk webhook:', error);
|
|
77
|
+
throw new APIError('Internal server error', 500);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
function parseWebhookData(rawBody) {
|
|
83
|
+
return typeof rawBody === 'string' ? JSON.parse(rawBody) : rawBody;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jbGVyay9wbHVnaW4vY29sbGVjdGlvbnMvdXNlcnMvZW5kcG9pbnRzL3dlYmhvb2svaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQVBJRXJyb3IsIEVuZHBvaW50IH0gZnJvbSAncGF5bG9hZCdcbmltcG9ydCB7IENsZXJrUGx1Z2luT3B0aW9ucyB9IGZyb20gJy4uLy4uLy4uLy4uLy4uL3R5cGVzJ1xuaW1wb3J0IHsgdmFsaWRhdGVXZWJob29rIH0gZnJvbSAnLi4vLi4vLi4vLi4vLi4vdXRpbHMvc3ZpeCdcbmltcG9ydCB7IGhhbmRsZVVzZXJDcmVhdGVkLCBoYW5kbGVVc2VyRGVsZXRlZCwgaGFuZGxlVXNlclVwZGF0ZWQgfSBmcm9tICcuL2hhbmRsZXJzJ1xuXG5pbnRlcmZhY2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0aGUgd2ViaG9vayBiZWZvcmUgcmVhZGluZyB0aGUgYm9keVxuICAgICAgICBpZiAoIWF3YWl0IHZhbGlkYXRlV2ViaG9vayh7XG4gICAgICAgICAgcmVxdWVzdDogcmVxLFxuICAgICAgICAgIHNlY3JldDogb3B0aW9ucy53ZWJob29rPy5zdml4U2VjcmV0XG4gICAgICAgIH0pKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEFQSUVycm9yKCdJbnZhbGlkIHdlYmhvb2sgc2lnbmF0dXJlJywgNDAxKVxuICAgICAgICB9XG4gICAgICAgIFxuICAgICAgICAvLyBOb3cgd2UgY2FuIHJlYWQgdGhlIGJvZHkgc2FmZWx5XG4gICAgICAgIGNvbnN0IHJhd0JvZHkgPSBhd2FpdCByZXEudGV4dCgpXG4gICAgICAgIFxuICAgICAgICBjb25zdCB3ZWJob29rRGF0YSA9IHBhcnNlV2ViaG9va0RhdGEocmF3Qm9keSlcbiAgICAgICAgY29uc3QgeyB0eXBlLCBkYXRhIH0gPSB3ZWJob29rRGF0YVxuICAgICAgICBcbiAgICAgICAgaWYgKG9wdGlvbnMuZW5hYmxlRGVidWdMb2dzKSB7XG4gICAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgQ2xlcmsgd2ViaG9vazogJHt0eXBlfWApXG4gICAgICAgIH1cbiAgICAgICAgXG4gICAgICAgIHN3aXRjaCAodHlwZSkge1xuICAgICAgICAgIGNhc2UgJ3VzZXIuY3JlYXRlZCc6XG4gICAgICAgICAgICBhd2FpdCBoYW5kbGVVc2VyQ3JlYXRlZCh7XG4gICAgICAgICAgICAgIGRhdGEsXG4gICAgICAgICAgICAgIHBheWxvYWQsXG4gICAgICAgICAgICAgIHVzZXJTbHVnLFxuICAgICAgICAgICAgICBtYXBwaW5nRnVuY3Rpb24sXG4gICAgICAgICAgICAgIG9wdGlvbnNcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICBicmVha1xuICAgICAgICAgICAgXG4gICAgICAgICAgY2FzZSAndXNlci51cGRhdGVkJzpcbiAgICAgICAgICAgIGF3YWl0IGhhbmRsZVVzZXJVcGRhdGVkKHtcbiAgICAgICAgICAgICAgZGF0YSxcbiAgICAgICAgICAgICAgcGF5bG9hZCxcbiAgICAgICAgICAgICAgdXNlclNsdWcsXG4gICAgICAgICAgICAgIG1hcHBpbmdGdW5jdGlvbjogbWFwcGluZ0Z1bmN0aW9uIGFzIGFueSwgLy8gQFRPRE86IFR5cGUgdGhpcyBwcm9wZXJseVxuICAgICAgICAgICAgICBvcHRpb25zXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgIFxuICAgICAgICAgIGNhc2UgJ3VzZXIuZGVsZXRlZCc6XG4gICAgICAgICAgICBhd2FpdCBoYW5kbGVVc2VyRGVsZXRlZCh7XG4gICAgICAgICAgICAgIGRhdGEsXG4gICAgICAgICAgICAgIHBheWxvYWQsXG4gICAgICAgICAgICAgIHVzZXJTbHVnLFxuICAgICAgICAgICAgICBvcHRpb25zXG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgYnJlYWtcbiAgICAgICAgICAgIFxuICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICBpZiAob3B0aW9ucy5lbmFibGVEZWJ1Z0xvZ3MpIHtcbiAgICAgICAgICAgICAgY29uc29sZS5sb2coYFVuaGFuZGxlZCBDbGVyayB3ZWJob29rIHR5cGU6ICR7dHlwZX1gKVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIFxuICAgICAgICByZXR1cm4gbmV3IFJlc3BvbnNlKFxuICAgICAgICAgIEpTT04uc3RyaW5naWZ5KHsgc3VjY2VzczogdHJ1ZSB9KSwgXG4gICAgICAgICAgeyBzdGF0dXM6IDIwMCwgaGVhZGVyczogeyAnQ29udGVudC1UeXBlJzogJ2FwcGxpY2F0aW9uL2pzb24nIH0gfVxuICAgICAgICApXG4gICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICBjb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
|
|
|
1
|
+
/**
|
|
2
|
+
* Clerk user fields to be added to the user collection
|
|
3
|
+
*/ export const clerkUserFields = [
|
|
4
|
+
{
|
|
5
|
+
name: 'clerkId',
|
|
6
|
+
type: 'text',
|
|
7
|
+
unique: true,
|
|
8
|
+
index: true,
|
|
9
|
+
admin: {
|
|
10
|
+
description: 'Clerk user ID',
|
|
11
|
+
readOnly: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'emailVerified',
|
|
16
|
+
type: 'checkbox',
|
|
17
|
+
defaultValue: false,
|
|
18
|
+
admin: {
|
|
19
|
+
description: 'Whether the email is verified',
|
|
20
|
+
readOnly: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'firstName',
|
|
25
|
+
type: 'text',
|
|
26
|
+
admin: {
|
|
27
|
+
description: 'User first name'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'lastName',
|
|
32
|
+
type: 'text',
|
|
33
|
+
admin: {
|
|
34
|
+
description: 'User last name'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'imageUrl',
|
|
39
|
+
type: 'text',
|
|
40
|
+
admin: {
|
|
41
|
+
description: 'User profile image URL'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'role',
|
|
46
|
+
type: 'select',
|
|
47
|
+
required: true,
|
|
48
|
+
defaultValue: 'user',
|
|
49
|
+
options: [
|
|
50
|
+
{
|
|
51
|
+
label: 'Admin',
|
|
52
|
+
value: 'admin'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: 'User',
|
|
56
|
+
value: 'user'
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
admin: {
|
|
60
|
+
description: 'User role for access control'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'lastSyncedAt',
|
|
65
|
+
type: 'date',
|
|
66
|
+
admin: {
|
|
67
|
+
description: 'When the user was last synced with Clerk',
|
|
68
|
+
readOnly: true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'clerkPublicMetadata',
|
|
73
|
+
type: 'json',
|
|
74
|
+
admin: {
|
|
75
|
+
description: 'Additional metadata from Clerk',
|
|
76
|
+
readOnly: true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9jbGVyay9wbHVnaW4vY29sbGVjdGlvbnMvdXNlcnMvZmllbGRzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRmllbGQgfSBmcm9tICdwYXlsb2FkJ1xuXG4vKipcbiAqIENsZXJrIHVzZXIgZmllbGRzIHRvIGJlIGFkZGVkIHRvIHRoZSB1c2VyIGNvbGxlY3Rpb25cbiAqL1xuZXhwb3J0IGNvbnN0IGNsZXJrVXNlckZpZWxkczogRmllbGRbXSA9IFtcbiAge1xuICAgIG5hbWU6ICdjbGVya0lkJyxcbiAgICB0eXBlOiAndGV4dCcsXG4gICAgdW5pcXVlOiB0cnVlLFxuICAgIGluZGV4OiB0cnVlLFxuICAgIGFkbWluOiB7XG4gICAgICBkZXNjcmlwdGlvbjogJ0NsZXJrIHVzZXIgSUQnLFxuICAgICAgcmVhZE9ubHk6IHRydWUsXG4gICAgfVxuICB9LFxuICB7XG4gICAgbmFtZTogJ2VtYWlsVmVyaWZpZWQnLFxuICAgIHR5cGU6ICdjaGVja2JveCcsXG4gICAgZGVmYXVsdFZhbHVlOiBmYWxzZSxcbiAgICBhZG1pbjoge1xuICAgICAgZGVzY3JpcHRpb246ICdXaGV0aGVyIHRoZSBlbWFpbCBpcyB2ZXJpZmllZCcsXG4gICAgICByZWF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VTtRQUNWRCxjQUFjO1FBQ2RFLFNBQVM7WUFDUDtnQkFDRUMsT0FBTztnQkFDUEMsT0FBTztZQUNUO1lBQ0E7Z0JBQ0VELE9BQU87Z0JBQ1BDLE9BQU87WUFDVDtTQUNEO1FBQ0RQLE9BQU87WUFDTEMsYUFBYTtRQUNmO0lBQ0Y7SUFDQTtRQUNFTCxNQUFNO1FBQ05DLE1BQU07UUFDTkcsT0FBTztZQUNMQyxhQUFhO1lBQ2JDLFVBQVU7UUFDWjtJQUNGO0lBQ0E7UUFDRU4sTUFBTTtRQUNOQyxNQUFNO1FBQ05HLE9BQU87WUFDTEMsYUFBYTtZQUNiQyxVQUFVO1FBQ1o7SUFDRjtDQUNELENBQUEifQ==
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CollectionConfig } from 'payload';
|
|
2
|
+
import type { ClerkPluginOptions } from '../../../types';
|
|
3
|
+
export interface WithClerkUsersCollectionOptions {
|
|
4
|
+
collection?: Partial<CollectionConfig>;
|
|
5
|
+
options: ClerkPluginOptions;
|
|
6
|
+
apiBasePath?: string;
|
|
7
|
+
adminBasePath?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function withClerkUsersCollection({ collection, options, apiBasePath, adminBasePath, }: WithClerkUsersCollectionOptions): CollectionConfig;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/clerk/plugin/collections/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAQxD,MAAM,WAAW,+BAA+B;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACtC,OAAO,EAAE,kBAAkB,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,UAA8B,EAC9B,OAAO,EACP,WAAoB,EACpB,aAAwB,GACzB,EAAE,+BAA+B,GAAG,gBAAgB,CAoEpD"}
|