@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.
Files changed (424) hide show
  1. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts +24 -0
  2. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts.map +1 -0
  3. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js +317 -0
  4. package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts +2 -0
  5. package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts.map +1 -0
  6. package/dist/better-auth/adapter/generate-schema/get-payload-schema.js +23 -0
  7. package/dist/better-auth/adapter/generate-schema/index.d.ts +5 -0
  8. package/dist/better-auth/adapter/generate-schema/index.d.ts.map +1 -0
  9. package/dist/better-auth/adapter/generate-schema/index.js +19 -0
  10. package/dist/better-auth/adapter/generate-schema/utils.d.ts +3 -0
  11. package/dist/better-auth/adapter/generate-schema/utils.d.ts.map +1 -0
  12. package/dist/better-auth/adapter/generate-schema/utils.js +20 -0
  13. package/dist/better-auth/adapter/index.d.ts +16 -0
  14. package/dist/better-auth/adapter/index.d.ts.map +1 -0
  15. package/dist/better-auth/adapter/index.js +717 -0
  16. package/dist/better-auth/adapter/transform/index.d.ts +31 -0
  17. package/dist/better-auth/adapter/transform/index.d.ts.map +1 -0
  18. package/dist/better-auth/adapter/transform/index.js +729 -0
  19. package/dist/better-auth/adapter/types.d.ts +11 -0
  20. package/dist/better-auth/adapter/types.d.ts.map +1 -0
  21. package/dist/better-auth/adapter/types.js +3 -0
  22. package/dist/better-auth/generated-types.d.ts +329 -0
  23. package/dist/better-auth/generated-types.d.ts.map +1 -0
  24. package/dist/better-auth/generated-types.js +4 -0
  25. package/dist/better-auth/index.d.ts +4 -0
  26. package/dist/better-auth/index.d.ts.map +1 -0
  27. package/dist/better-auth/index.js +5 -0
  28. package/dist/better-auth/plugin/constants.d.ts +231 -0
  29. package/dist/better-auth/plugin/constants.d.ts.map +1 -0
  30. package/dist/better-auth/plugin/constants.js +259 -0
  31. package/dist/better-auth/plugin/helpers/check-plugin-exists.d.ts +13 -0
  32. package/dist/better-auth/plugin/helpers/check-plugin-exists.d.ts.map +1 -0
  33. package/dist/better-auth/plugin/helpers/check-plugin-exists.js +14 -0
  34. package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts +30 -0
  35. package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts.map +1 -0
  36. package/dist/better-auth/plugin/helpers/generate-verify-email-url.js +46 -0
  37. package/dist/better-auth/plugin/helpers/get-admin-access.d.ts +8 -0
  38. package/dist/better-auth/plugin/helpers/get-admin-access.d.ts.map +1 -0
  39. package/dist/better-auth/plugin/helpers/get-admin-access.js +22 -0
  40. package/dist/better-auth/plugin/helpers/get-all-roles.d.ts +6 -0
  41. package/dist/better-auth/plugin/helpers/get-all-roles.d.ts.map +1 -0
  42. package/dist/better-auth/plugin/helpers/get-all-roles.js +20 -0
  43. package/dist/better-auth/plugin/helpers/get-better-auth-schema.d.ts +19 -0
  44. package/dist/better-auth/plugin/helpers/get-better-auth-schema.d.ts.map +1 -0
  45. package/dist/better-auth/plugin/helpers/get-better-auth-schema.js +75 -0
  46. package/dist/better-auth/plugin/helpers/get-collection-slug.d.ts +6 -0
  47. package/dist/better-auth/plugin/helpers/get-collection-slug.d.ts.map +1 -0
  48. package/dist/better-auth/plugin/helpers/get-collection-slug.js +20 -0
  49. package/dist/better-auth/plugin/helpers/get-collection.d.ts +28 -0
  50. package/dist/better-auth/plugin/helpers/get-collection.d.ts.map +1 -0
  51. package/dist/better-auth/plugin/helpers/get-collection.js +49 -0
  52. package/dist/better-auth/plugin/helpers/get-ip.d.ts +3 -0
  53. package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -0
  54. package/dist/better-auth/plugin/helpers/get-ip.js +31 -0
  55. package/dist/better-auth/plugin/helpers/get-signed-cookie.d.ts +3 -0
  56. package/dist/better-auth/plugin/helpers/get-signed-cookie.d.ts.map +1 -0
  57. package/dist/better-auth/plugin/helpers/get-signed-cookie.js +63 -0
  58. package/dist/better-auth/plugin/helpers/index.d.ts +2 -0
  59. package/dist/better-auth/plugin/helpers/index.d.ts.map +1 -0
  60. package/dist/better-auth/plugin/helpers/index.js +3 -0
  61. package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts +60 -0
  62. package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts.map +1 -0
  63. package/dist/better-auth/plugin/helpers/prepare-session-data.js +49 -0
  64. package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.d.ts +21 -0
  65. package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.d.ts.map +1 -0
  66. package/dist/better-auth/plugin/helpers/sync-resolved-schema-with-collection-map.js +63 -0
  67. package/dist/better-auth/plugin/index.d.ts +8 -0
  68. package/dist/better-auth/plugin/index.d.ts.map +1 -0
  69. package/dist/better-auth/plugin/index.js +103 -0
  70. package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.d.ts +13 -0
  71. package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.d.ts.map +1 -0
  72. package/dist/better-auth/plugin/lib/apply-disabled-default-auth-config.js +87 -0
  73. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts +4 -0
  74. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts.map +1 -0
  75. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.js +51 -0
  76. package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts +4 -0
  77. package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts.map +1 -0
  78. package/dist/better-auth/plugin/lib/build-collections/accounts/index.js +150 -0
  79. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts +6 -0
  80. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts.map +1 -0
  81. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.js +11 -0
  82. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts +3 -0
  83. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts.map +1 -0
  84. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.js +8 -0
  85. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts +7 -0
  86. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts.map +1 -0
  87. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.js +117 -0
  88. package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts +4 -0
  89. package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts.map +1 -0
  90. package/dist/better-auth/plugin/lib/build-collections/api-keys.js +174 -0
  91. package/dist/better-auth/plugin/lib/build-collections/device-code.d.ts +4 -0
  92. package/dist/better-auth/plugin/lib/build-collections/device-code.d.ts.map +1 -0
  93. package/dist/better-auth/plugin/lib/build-collections/device-code.js +49 -0
  94. package/dist/better-auth/plugin/lib/build-collections/index.d.ts +11 -0
  95. package/dist/better-auth/plugin/lib/build-collections/index.d.ts.map +1 -0
  96. package/dist/better-auth/plugin/lib/build-collections/index.js +79 -0
  97. package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts +4 -0
  98. package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts.map +1 -0
  99. package/dist/better-auth/plugin/lib/build-collections/invitations.js +93 -0
  100. package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts +4 -0
  101. package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts.map +1 -0
  102. package/dist/better-auth/plugin/lib/build-collections/jwks.js +58 -0
  103. package/dist/better-auth/plugin/lib/build-collections/members.d.ts +4 -0
  104. package/dist/better-auth/plugin/lib/build-collections/members.d.ts.map +1 -0
  105. package/dist/better-auth/plugin/lib/build-collections/members.js +72 -0
  106. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts +4 -0
  107. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts.map +1 -0
  108. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.js +105 -0
  109. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts +4 -0
  110. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts.map +1 -0
  111. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.js +117 -0
  112. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts +4 -0
  113. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts.map +1 -0
  114. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.js +87 -0
  115. package/dist/better-auth/plugin/lib/build-collections/organization-roles.d.ts +4 -0
  116. package/dist/better-auth/plugin/lib/build-collections/organization-roles.d.ts.map +1 -0
  117. package/dist/better-auth/plugin/lib/build-collections/organization-roles.js +65 -0
  118. package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts +4 -0
  119. package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts.map +1 -0
  120. package/dist/better-auth/plugin/lib/build-collections/organizations.js +106 -0
  121. package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts +4 -0
  122. package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts.map +1 -0
  123. package/dist/better-auth/plugin/lib/build-collections/passkeys.js +115 -0
  124. package/dist/better-auth/plugin/lib/build-collections/rate-limit.d.ts +4 -0
  125. package/dist/better-auth/plugin/lib/build-collections/rate-limit.d.ts.map +1 -0
  126. package/dist/better-auth/plugin/lib/build-collections/rate-limit.js +54 -0
  127. package/dist/better-auth/plugin/lib/build-collections/scim-provider.d.ts +4 -0
  128. package/dist/better-auth/plugin/lib/build-collections/scim-provider.d.ts.map +1 -0
  129. package/dist/better-auth/plugin/lib/build-collections/scim-provider.js +65 -0
  130. package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts +4 -0
  131. package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts.map +1 -0
  132. package/dist/better-auth/plugin/lib/build-collections/sessions.js +140 -0
  133. package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts +4 -0
  134. package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts.map +1 -0
  135. package/dist/better-auth/plugin/lib/build-collections/sso-providers.js +80 -0
  136. package/dist/better-auth/plugin/lib/build-collections/subscriptions.d.ts +4 -0
  137. package/dist/better-auth/plugin/lib/build-collections/subscriptions.d.ts.map +1 -0
  138. package/dist/better-auth/plugin/lib/build-collections/subscriptions.js +110 -0
  139. package/dist/better-auth/plugin/lib/build-collections/team-members.d.ts +4 -0
  140. package/dist/better-auth/plugin/lib/build-collections/team-members.d.ts.map +1 -0
  141. package/dist/better-auth/plugin/lib/build-collections/team-members.js +63 -0
  142. package/dist/better-auth/plugin/lib/build-collections/teams.d.ts +4 -0
  143. package/dist/better-auth/plugin/lib/build-collections/teams.d.ts.map +1 -0
  144. package/dist/better-auth/plugin/lib/build-collections/teams.js +74 -0
  145. package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts +4 -0
  146. package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts.map +1 -0
  147. package/dist/better-auth/plugin/lib/build-collections/two-factors.js +66 -0
  148. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts +8 -0
  149. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts.map +1 -0
  150. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.js +52 -0
  151. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts +12 -0
  152. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts.map +1 -0
  153. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.js +68 -0
  154. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.d.ts +5 -0
  155. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.d.ts.map +1 -0
  156. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/index.js +6 -0
  157. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts +3 -0
  158. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts.map +1 -0
  159. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.js +114 -0
  160. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts +4 -0
  161. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts.map +1 -0
  162. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.js +64 -0
  163. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts +4 -0
  164. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts.map +1 -0
  165. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.js +90 -0
  166. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts +7 -0
  167. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts.map +1 -0
  168. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.js +80 -0
  169. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts +3 -0
  170. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts.map +1 -0
  171. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.js +79 -0
  172. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts +3 -0
  173. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts.map +1 -0
  174. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.js +54 -0
  175. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts +7 -0
  176. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts.map +1 -0
  177. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.js +15 -0
  178. package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.d.ts +7 -0
  179. package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.d.ts.map +1 -0
  180. package/dist/better-auth/plugin/lib/build-collections/users/hooks/index.js +8 -0
  181. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts +3 -0
  182. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts.map +1 -0
  183. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.js +17 -0
  184. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts +3 -0
  185. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts.map +1 -0
  186. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.js +90 -0
  187. package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts +4 -0
  188. package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts.map +1 -0
  189. package/dist/better-auth/plugin/lib/build-collections/users/index.js +333 -0
  190. package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.d.ts +16 -0
  191. package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.d.ts.map +1 -0
  192. package/dist/better-auth/plugin/lib/build-collections/utils/collection-schema.js +24 -0
  193. package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.d.ts +11 -0
  194. package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.d.ts.map +1 -0
  195. package/dist/better-auth/plugin/lib/build-collections/utils/filter-properties.js +112 -0
  196. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts +8 -0
  197. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts.map +1 -0
  198. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.js +31 -0
  199. package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.d.ts +12 -0
  200. package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.d.ts.map +1 -0
  201. package/dist/better-auth/plugin/lib/build-collections/utils/model-field-transformations.js +26 -0
  202. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts +18 -0
  203. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts.map +1 -0
  204. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.js +84 -0
  205. package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.d.ts +21 -0
  206. package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.d.ts.map +1 -0
  207. package/dist/better-auth/plugin/lib/build-collections/utils/transform-schema-fields-to-payload.js +95 -0
  208. package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts +4 -0
  209. package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts.map +1 -0
  210. package/dist/better-auth/plugin/lib/build-collections/verifications.js +82 -0
  211. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +6 -0
  212. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -0
  213. package/dist/better-auth/plugin/lib/get-payload-auth.js +9 -0
  214. package/dist/better-auth/plugin/lib/init-better-auth.d.ts +8 -0
  215. package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -0
  216. package/dist/better-auth/plugin/lib/init-better-auth.js +16 -0
  217. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts +3 -0
  218. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts.map +1 -0
  219. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.js +12 -0
  220. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts +3 -0
  221. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts.map +1 -0
  222. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.js +10 -0
  223. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.d.ts +3 -0
  224. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.d.ts.map +1 -0
  225. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/device-authorization-plugin.js +8 -0
  226. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts +12 -0
  227. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts.map +1 -0
  228. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.js +146 -0
  229. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts +3 -0
  230. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts.map +1 -0
  231. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.js +18 -0
  232. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts +3 -0
  233. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts.map +1 -0
  234. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.js +34 -0
  235. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts +3 -0
  236. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts.map +1 -0
  237. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.js +11 -0
  238. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts +3 -0
  239. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts.map +1 -0
  240. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.js +10 -0
  241. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.d.ts +3 -0
  242. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.d.ts.map +1 -0
  243. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/two-factor-plugin.js +11 -0
  244. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.d.ts +8 -0
  245. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.d.ts.map +1 -0
  246. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-after-role-middleware.js +20 -0
  247. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.d.ts +8 -0
  248. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.d.ts.map +1 -0
  249. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/admin-before-role-middleware.js +20 -0
  250. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.d.ts +14 -0
  251. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.d.ts.map +1 -0
  252. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/apply-save-to-jwt-returned.js +38 -0
  253. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts +8 -0
  254. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts.map +1 -0
  255. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.js +23 -0
  256. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts +26 -0
  257. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts.map +1 -0
  258. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.js +62 -0
  259. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts +10 -0
  260. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.d.ts.map +1 -0
  261. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/require-admin-invite-for-sign-up-middleware.js +42 -0
  262. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.d.ts +10 -0
  263. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.d.ts.map +1 -0
  264. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/use-admin-invite-after-email-sign-up-middleware.js +62 -0
  265. package/dist/better-auth/plugin/lib/set-login-methods.d.ts +5 -0
  266. package/dist/better-auth/plugin/lib/set-login-methods.d.ts.map +1 -0
  267. package/dist/better-auth/plugin/lib/set-login-methods.js +14 -0
  268. package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts +10 -0
  269. package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts.map +1 -0
  270. package/dist/better-auth/plugin/payload/components/admin-buttons/index.js +116 -0
  271. package/dist/better-auth/plugin/payload/components/admin-buttons/index.scss +36 -0
  272. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts +11 -0
  273. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts.map +1 -0
  274. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.js +213 -0
  275. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.scss +136 -0
  276. package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.d.ts +4 -0
  277. package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.d.ts.map +1 -0
  278. package/dist/better-auth/plugin/payload/components/login-form/alternative-methods.js +197 -0
  279. package/dist/better-auth/plugin/payload/components/login-form/context.d.ts +49 -0
  280. package/dist/better-auth/plugin/payload/components/login-form/context.d.ts.map +1 -0
  281. package/dist/better-auth/plugin/payload/components/login-form/context.js +94 -0
  282. package/dist/better-auth/plugin/payload/components/login-form/credentials-form.d.ts +4 -0
  283. package/dist/better-auth/plugin/payload/components/login-form/credentials-form.d.ts.map +1 -0
  284. package/dist/better-auth/plugin/payload/components/login-form/credentials-form.js +167 -0
  285. package/dist/better-auth/plugin/payload/components/login-form/index.d.ts +5 -0
  286. package/dist/better-auth/plugin/payload/components/login-form/index.d.ts.map +1 -0
  287. package/dist/better-auth/plugin/payload/components/login-form/index.js +6 -0
  288. package/dist/better-auth/plugin/payload/components/login-form/index.scss +58 -0
  289. package/dist/better-auth/plugin/payload/components/logout-button.d.ts +5 -0
  290. package/dist/better-auth/plugin/payload/components/logout-button.d.ts.map +1 -0
  291. package/dist/better-auth/plugin/payload/components/logout-button.js +24 -0
  292. package/dist/better-auth/plugin/payload/components/passkeys/add-button.d.ts +9 -0
  293. package/dist/better-auth/plugin/payload/components/passkeys/add-button.d.ts.map +1 -0
  294. package/dist/better-auth/plugin/payload/components/passkeys/add-button.js +122 -0
  295. package/dist/better-auth/plugin/payload/components/passkeys/client.d.ts +3 -0
  296. package/dist/better-auth/plugin/payload/components/passkeys/client.d.ts.map +1 -0
  297. package/dist/better-auth/plugin/payload/components/passkeys/client.js +61 -0
  298. package/dist/better-auth/plugin/payload/components/passkeys/index.d.ts +5 -0
  299. package/dist/better-auth/plugin/payload/components/passkeys/index.d.ts.map +1 -0
  300. package/dist/better-auth/plugin/payload/components/passkeys/index.js +42 -0
  301. package/dist/better-auth/plugin/payload/components/passkeys/index.scss +98 -0
  302. package/dist/better-auth/plugin/payload/components/passkeys/list.d.ts +9 -0
  303. package/dist/better-auth/plugin/payload/components/passkeys/list.d.ts.map +1 -0
  304. package/dist/better-auth/plugin/payload/components/passkeys/list.js +57 -0
  305. package/dist/better-auth/plugin/payload/components/passkeys/types.d.ts +23 -0
  306. package/dist/better-auth/plugin/payload/components/passkeys/types.d.ts.map +1 -0
  307. package/dist/better-auth/plugin/payload/components/passkeys/types.js +3 -0
  308. package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts +7 -0
  309. package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts.map +1 -0
  310. package/dist/better-auth/plugin/payload/components/rsc-redirect.js +13 -0
  311. package/dist/better-auth/plugin/payload/components/token-field.d.ts +4 -0
  312. package/dist/better-auth/plugin/payload/components/token-field.d.ts.map +1 -0
  313. package/dist/better-auth/plugin/payload/components/token-field.js +29 -0
  314. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.d.ts +9 -0
  315. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.d.ts.map +1 -0
  316. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.js +347 -0
  317. package/dist/better-auth/plugin/payload/components/two-factor-auth/index.scss +116 -0
  318. package/dist/better-auth/plugin/payload/exports/client.d.ts +7 -0
  319. package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -0
  320. package/dist/better-auth/plugin/payload/exports/client.js +8 -0
  321. package/dist/better-auth/plugin/payload/exports/rsc.d.ts +9 -0
  322. package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -0
  323. package/dist/better-auth/plugin/payload/exports/rsc.js +10 -0
  324. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts +3 -0
  325. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts.map +1 -0
  326. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.js +9 -0
  327. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts +2 -0
  328. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts.map +1 -0
  329. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.js +22 -0
  330. package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts +23 -0
  331. package/dist/better-auth/plugin/payload/views/admin-login/client.d.ts.map +1 -0
  332. package/dist/better-auth/plugin/payload/views/admin-login/client.js +24 -0
  333. package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts +11 -0
  334. package/dist/better-auth/plugin/payload/views/admin-login/index.d.ts.map +1 -0
  335. package/dist/better-auth/plugin/payload/views/admin-login/index.js +143 -0
  336. package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts +23 -0
  337. package/dist/better-auth/plugin/payload/views/admin-signup/client.d.ts.map +1 -0
  338. package/dist/better-auth/plugin/payload/views/admin-signup/client.js +185 -0
  339. package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts +10 -0
  340. package/dist/better-auth/plugin/payload/views/admin-signup/index.d.ts.map +1 -0
  341. package/dist/better-auth/plugin/payload/views/admin-signup/index.js +92 -0
  342. package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts +7 -0
  343. package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts.map +1 -0
  344. package/dist/better-auth/plugin/payload/views/forgot-password/client.js +104 -0
  345. package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts +9 -0
  346. package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts.map +1 -0
  347. package/dist/better-auth/plugin/payload/views/forgot-password/index.js +61 -0
  348. package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts +11 -0
  349. package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts.map +1 -0
  350. package/dist/better-auth/plugin/payload/views/reset-password/client.js +111 -0
  351. package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts +9 -0
  352. package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts.map +1 -0
  353. package/dist/better-auth/plugin/payload/views/reset-password/index.js +78 -0
  354. package/dist/better-auth/plugin/payload/views/two-factor-verify/client.d.ts +9 -0
  355. package/dist/better-auth/plugin/payload/views/two-factor-verify/client.d.ts.map +1 -0
  356. package/dist/better-auth/plugin/payload/views/two-factor-verify/client.js +79 -0
  357. package/dist/better-auth/plugin/payload/views/two-factor-verify/index.d.ts +10 -0
  358. package/dist/better-auth/plugin/payload/views/two-factor-verify/index.d.ts.map +1 -0
  359. package/dist/better-auth/plugin/payload/views/two-factor-verify/index.js +49 -0
  360. package/dist/better-auth/plugin/types.d.ts +448 -0
  361. package/dist/better-auth/plugin/types.d.ts.map +1 -0
  362. package/dist/better-auth/plugin/types.js +3 -0
  363. package/dist/better-auth/plugin/utils/set.d.ts +40 -0
  364. package/dist/better-auth/plugin/utils/set.d.ts.map +1 -0
  365. package/dist/better-auth/plugin/utils/set.js +84 -0
  366. package/dist/better-auth/scripts/generate-types.d.ts +2 -0
  367. package/dist/better-auth/scripts/generate-types.d.ts.map +1 -0
  368. package/dist/better-auth/scripts/generate-types.js +225 -0
  369. package/dist/better-auth/types.d.ts +3 -0
  370. package/dist/better-auth/types.d.ts.map +1 -0
  371. package/dist/better-auth/types.js +4 -0
  372. package/dist/index.d.ts +2 -0
  373. package/dist/index.d.ts.map +1 -0
  374. package/dist/index.js +4 -0
  375. package/dist/shared/components/icons.d.ts +8 -0
  376. package/dist/shared/components/icons.d.ts.map +1 -0
  377. package/dist/shared/components/icons.js +436 -0
  378. package/dist/shared/components/logo.d.ts +3 -0
  379. package/dist/shared/components/logo.d.ts.map +1 -0
  380. package/dist/shared/components/logo.js +24 -0
  381. package/dist/shared/form/components/submit.d.ts +8 -0
  382. package/dist/shared/form/components/submit.d.ts.map +1 -0
  383. package/dist/shared/form/components/submit.js +23 -0
  384. package/dist/shared/form/fields/text-field.d.ts +9 -0
  385. package/dist/shared/form/fields/text-field.d.ts.map +1 -0
  386. package/dist/shared/form/fields/text-field.js +44 -0
  387. package/dist/shared/form/index.d.ts +28 -0
  388. package/dist/shared/form/index.d.ts.map +1 -0
  389. package/dist/shared/form/index.js +17 -0
  390. package/dist/shared/form/ui/header/index.d.ts +9 -0
  391. package/dist/shared/form/ui/header/index.d.ts.map +1 -0
  392. package/dist/shared/form/ui/header/index.js +23 -0
  393. package/dist/shared/form/ui/header/index.scss +8 -0
  394. package/dist/shared/form/ui/index.d.ts +34 -0
  395. package/dist/shared/form/ui/index.d.ts.map +1 -0
  396. package/dist/shared/form/ui/index.js +70 -0
  397. package/dist/shared/form/ui/index.scss +27 -0
  398. package/dist/shared/form/validation.d.ts +65 -0
  399. package/dist/shared/form/validation.d.ts.map +1 -0
  400. package/dist/shared/form/validation.js +108 -0
  401. package/dist/shared/index.d.ts +3 -0
  402. package/dist/shared/index.d.ts.map +1 -0
  403. package/dist/shared/index.js +4 -0
  404. package/dist/shared/payload/fields/field-copy-button/index.css +47 -0
  405. package/dist/shared/payload/fields/field-copy-button/index.d.ts +4 -0
  406. package/dist/shared/payload/fields/field-copy-button/index.d.ts.map +1 -0
  407. package/dist/shared/payload/fields/field-copy-button/index.js +38 -0
  408. package/dist/shared/payload/fields/generate-uuid-button/index.css +14 -0
  409. package/dist/shared/payload/fields/generate-uuid-button/index.d.ts +4 -0
  410. package/dist/shared/payload/fields/generate-uuid-button/index.d.ts.map +1 -0
  411. package/dist/shared/payload/fields/generate-uuid-button/index.js +26 -0
  412. package/dist/shared/payload/fields/index.d.ts +3 -0
  413. package/dist/shared/payload/fields/index.d.ts.map +1 -0
  414. package/dist/shared/payload/fields/index.js +4 -0
  415. package/dist/shared/utils/regex.d.ts +3 -0
  416. package/dist/shared/utils/regex.d.ts.map +1 -0
  417. package/dist/shared/utils/regex.js +4 -0
  418. package/dist/shared/utils/try-catch.d.ts +12 -0
  419. package/dist/shared/utils/try-catch.d.ts.map +1 -0
  420. package/dist/shared/utils/try-catch.js +17 -0
  421. package/dist/shared/utils/value-or-default.d.ts +10 -0
  422. package/dist/shared/utils/value-or-default.d.ts.map +1 -0
  423. package/dist/shared/utils/value-or-default.js +12 -0
  424. 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25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1BQU0sSUFBSStCO0FBQ3RCIn0=
@@ -0,0 +1,3 @@
1
+ import { type CollectionBeforeDeleteHook } from "payload";
2
+ export declare function getBeforeDeleteHook(): CollectionBeforeDeleteHook;
3
+ //# sourceMappingURL=before-delete.d.ts.map
@@ -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
+
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UFDakQ7UUFDRjtJQUNGO0lBRUEsT0FBT3JCO0FBQ1QifQ==
@@ -0,0 +1,7 @@
1
+ import { CollectionBeforeLoginHook } from "payload";
2
+ import type { BetterAuthOptions } from "@/better-auth/plugin/types";
3
+ /**
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJzL2hvb2tzL2JlZm9yZS1sb2dpbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBUElFcnJvciwgQ29sbGVjdGlvbkJlZm9yZUxvZ2luS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YWlsVmVyaWZpY2F0aW9uIiwiZW1haWxBbmRQYXNzd29yZCIsImVtYWlsVmVyaWZpZWQiXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLFFBQVEsUUFBbUMsVUFBVTtBQUU5RDs7Q0FFQyxHQUNELE9BQU8sU0FBU0MsbUJBQW1CQyxpQkFBb0M7SUFDckUsTUFBTUMsT0FBa0MsT0FBTyxFQUFFQyxJQUFJLEVBQUU7UUFDckQsTUFBTUMsMkJBQ0pILGtCQUFrQkksZ0JBQWdCLEVBQUVELDRCQUE0QjtRQUVsRSxJQUFJQSw0QkFBNEIsQ0FBQ0QsS0FBS0csYUFBYSxFQUFFO1lBQ25ELE1BQU0sSUFBSVAsU0FDUiw0RUFDQTtRQUVKO1FBRUEsT0FBT0k7SUFDVDtJQUVBLE9BQU9EO0FBQ1QifQ==
@@ -0,0 +1,7 @@
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
+ //# 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/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,3 @@
1
+ import { CollectionBeforeChangeHook } from "payload";
2
+ export declare function getOnVerifiedChangeHook(): CollectionBeforeChangeHook;
3
+ //# sourceMappingURL=on-verified-change.d.ts.map
@@ -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
+ return hook;
15
+ }
16
+
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJzL2hvb2tzL29uLXZlcmlmaWVkLWNoYW5nZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb2xsZWN0aW9uQmVmb3JlQ2hhbmdlSG9vayB9IGZyb20gXCJwYXlsb2FkXCI7XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRPblZlcmlmaWVkQ2hhbmdlSG9vaygpIHtcbiAgY29uc3QgaG9vazogQ29sbGVjdGlvbkJlZm9yZUNoYW5nZUhvb2sgPSBhc3luYyAoeyBkYXRhLCBvcmlnaW5hbERvYyB9KSA9PiB7XG4gICAgY29uc3QgaXNWZXJpZmllZENoYW5naW5nVG9UcnVlID1cbiAgICAgIEJvb2xlYW4oZGF0YS5fdmVyaWZpZWQpICYmICFCb29sZWFuKG9yaWdpbmFsRG9jPy5fdmVyaWZpZWQpO1xuICAgIGNvbnN0IGlzRW1haWxWZXJpZmllZENoYW5naW5nVG9UcnVlID1cbiAgICAgIEJvb2xlYW4oZGF0YS5lbWFpbFZlcmlmaWVkKSAmJiAhQm9vbGVhbihvcmlnaW5hbERvYz8uZW1haWxWZXJpZmllZCk7XG5cbiAgICBpZiAoIWlzVmVyaWZpZWRDaGFuZ2luZ1RvVHJ1ZSAmJiAhaXNFbWFpbFZlcmlmaWVkQ2hhbmdpbmdUb1RydWUpIHtcbiAgICAgIHJldHVybiBkYXRhO1xuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICAuLi5kYXRhLFxuICAgICAgX3ZlcmlmaWVkOiB0cnVlLFxuICAgICAgZW1haWxWZXJpZmllZDogdHJ1ZVxuICAgIH07XG4gIH07XG5cbiAgcmV0dXJuIGhvb2s7XG59XG4iXSwibmFtZXMiOlsiZ2V0T25WZXJpZmllZENoYW5nZUhvb2siLCJob29rIiwiZGF0YSIsIm9yaWdpbmFsRG9jIiwiaXNWZXJpZmllZENoYW5naW5nVG9UcnVlIiwiQm9vbGVhbiIsIl92ZXJpZmllZCIsImlzRW1haWxWZXJpZmllZENoYW5naW5nVG9UcnVlIiwiZW1haWxWZXJpZmllZCJdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxTQUFTQTtJQUNkLE1BQU1DLE9BQW1DLE9BQU8sRUFBRUMsSUFBSSxFQUFFQyxXQUFXLEVBQUU7UUFDbkUsTUFBTUMsMkJBQ0pDLFFBQVFILEtBQUtJLFNBQVMsS0FBSyxDQUFDRCxRQUFRRixhQUFhRztRQUNuRCxNQUFNQyxnQ0FDSkYsUUFBUUgsS0FBS00sYUFBYSxLQUFLLENBQUNILFFBQVFGLGFBQWFLO1FBRXZELElBQUksQ0FBQ0osNEJBQTRCLENBQUNHLCtCQUErQjtZQUMvRCxPQUFPTDtRQUNUO1FBRUEsT0FBTztZQUNMLEdBQUdBLElBQUk7WUFDUEksV0FBVztZQUNYRSxlQUFlO1FBQ2pCO0lBQ0Y7SUFFQSxPQUFPUDtBQUNUIn0=
@@ -0,0 +1,3 @@
1
+ import type { CollectionAfterChangeHook } from "payload";
2
+ export declare function getSyncAccountHook(): CollectionAfterChangeHook;
3
+ //# sourceMappingURL=sync-account.d.ts.map
@@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2J1aWxkLWNvbGxlY3Rpb25zL3VzZXJzL2hvb2tzL3N5bmMtYWNjb3VudC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IENvbGxlY3Rpb25BZnRlckNoYW5nZUhvb2sgfSBmcm9tIFwicGF5bG9hZFwiO1xuaW1wb3J0IHsgQkVUVEVSX0FVVEhfQ09OVEVYVF9LRVkgfSBmcm9tIFwiQC9iZXR0ZXItYXV0aC9hZGFwdGVyXCI7XG5pbXBvcnQgeyBiYU1vZGVsS2V5IH0gZnJvbSBcIkAvYmV0dGVyLWF1dGgvcGx1Z2luL2NvbnN0YW50c1wiO1xuaW1wb3J0IHtcbiAgZ2V0Q29sbGVjdGlvbkJ5TW9kZWxLZXksXG4gIGdldENvbGxlY3Rpb25GaWVsZE5hbWVCeUZpZWxkS2V5XG59IGZyb20gXCJAL2JldHRlci1hdXRoL3BsdWdpbi9oZWxwZXJzL2dldC1jb2xsZWN0aW9uXCI7XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRTeW5jQWNjb3VudEhvb2soKTogQ29sbGVjdGlvbkFmdGVyQ2hhbmdlSG9vayB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yaW5nKCksXG4gICAgICAgICAgICBbcHJvdmlkZXJJZEZpZWxkTmFtZV06IFwiY3JlZGVudGlhbFwiLFxuICAgICAgICAgICAgW3Bhc3N3b3JkRmllbGROYW1lXTogcGFzc3dvcmRWYWx1ZVxuICAgICAgICAgIH0sXG4gICAgICAgICAgY29udGV4dDogeyBzeW5jQWNjb3VudEhvb2s6IHRydWUgfSxcbiAgICAgICAgICByZXFcbiAgICAgICAgfSk7XG4gICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICBjb25zb2xlLmVycm9yKFwiRmFpbGVkIHRvIGNyZWF0ZSBhY2NvdW50IGZvciB1c2VyOlwiLCBlcnJvcik7XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKG9wZXJhdGlvbiA9PT0gXCJ1cGRhdGVcIikge1xuICAgICAgdHJ5IHtcbiAgICAgICAgY29uc3QgYWNjb3VudHMgPSBhd2FpdCByZXEucGF5bG9hZC5maW5kKHtcbiAgICAgICAgICBjb2xsZWN0aW9uOiBhY2NvdW50Q29sbGVjdGlvbi5zbHVnLFxuICAgICAgICAgIHdoZXJlOiB7XG4gICAgICAgICAgICBhbmQ6IFtcbiAgICAgICAgICAgICAgeyBbdXNlcklkRmllbGROYW1lXTogeyBlcXVhbHM6IGRvYy5pZCB9IH0sXG4gICAgICAgICAgICAgIHsgW3Byb3ZpZGVySWRGaWVsZE5hbWVdOiB7IGVxdWFsczogXCJjcmVkZW50aWFsXCIgfSB9XG4gICAgICAgICAgICBdXG4gICAgICAgICAgfSxcbiAgICAgICAgICByZXEsXG4gICAgICAgICAgZGVwdGg6IDAsXG4gICAgICAgICAgY29udGV4dDogeyBzeW5jQWNjb3VudEhvb2s6IHRydWUgfVxuICAgICAgICB9KTtcblxuICAgICAgICBjb25zdCBhY2NvdW50ID0gYWNjb3VudHMuZG9jcy5hdCgwKTtcbiAgICAgICAgaWYgKGFjY291bnQpIHtcbiAgICAgICAgICBhd2FpdCByZXEucGF5bG9hZC51cGRhdGUo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VlQLGtCQUFrQlEsSUFBSTtvQkFDbENlLE9BQU87d0JBQ0xDLEtBQUs7NEJBQ0g7Z0NBQUUsQ0FBQ3RCLGdCQUFnQixFQUFFO29DQUFFdUIsUUFBUWxDLElBQUlrQixFQUFFO2dDQUFDOzRCQUFFOzRCQUN4QztnQ0FBRSxDQUFDTCxvQkFBb0IsRUFBRTtvQ0FBRXFCLFFBQVE7Z0NBQWE7NEJBQUU7eUJBQ25EO29CQUNIO29CQUNBakM7b0JBQ0FrQixPQUFPO29CQUNQaEIsU0FBUzt3QkFBRXdCLGlCQUFpQjtvQkFBSztnQkFDbkM7Z0JBRUEsTUFBTWpCLFVBQVVvQixTQUFTSyxJQUFJLENBQUNDLEVBQUUsQ0FBQztnQkFDakMsSUFBSTFCLFNBQVM7b0JBQ1gsTUFBTVQsSUFBSUssT0FBTyxDQUFDK0IsTUFBTSxDQUFDO3dCQUN2QnJCLFlBQVlQLGtCQUFrQlEsSUFBSTt3QkFDbENDLElBQUlSLFFBQVFRLEVBQUU7d0JBQ2RPLE1BQU07NEJBQ0osQ0FBQ1gsa0JBQWtCLEVBQUVTO3dCQUN2Qjt3QkFDQXRCO3dCQUNBRSxTQUFTOzRCQUFFd0IsaUJBQWlCO3dCQUFLO29CQUNuQztnQkFDRjtZQUNGLEVBQUUsT0FBT0MsT0FBTztnQkFDZEMsUUFBUUQsS0FBSyxDQUFDLHdDQUF3Q0E7WUFDeEQ7UUFDRjtRQUVBLE9BQU81QjtJQUNUO0lBRUEsT0FBT0Q7QUFDVCJ9
@@ -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"}