payload-auth 1.0.2 → 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.
Files changed (423) hide show
  1. package/dist/better-auth/adapter/index.d.ts +2 -2
  2. package/dist/better-auth/adapter/index.d.ts.map +1 -1
  3. package/dist/better-auth/adapter/index.js +115 -69
  4. package/dist/better-auth/adapter/transform/index.d.ts +22 -10
  5. package/dist/better-auth/adapter/transform/index.d.ts.map +1 -1
  6. package/dist/better-auth/adapter/transform/index.js +387 -96
  7. package/dist/better-auth/adapter/types.d.ts +2 -1
  8. package/dist/better-auth/adapter/types.d.ts.map +1 -1
  9. package/dist/better-auth/adapter/types.js +1 -1
  10. package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts +3 -0
  11. package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts.map +1 -0
  12. package/dist/better-auth/plugin/helpers/check-passkey-plugin.js +5 -0
  13. package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts +3 -0
  14. package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts.map +1 -0
  15. package/dist/better-auth/plugin/helpers/check-username-plugin.js +5 -0
  16. package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts.map +1 -1
  17. package/dist/better-auth/plugin/helpers/generate-verify-email-url.js +8 -8
  18. package/dist/better-auth/plugin/helpers/get-admin-access.d.ts +8 -0
  19. package/dist/better-auth/plugin/helpers/get-admin-access.d.ts.map +1 -0
  20. package/dist/better-auth/plugin/helpers/get-admin-access.js +22 -0
  21. package/dist/better-auth/plugin/helpers/get-admin-routes.d.ts +14 -0
  22. package/dist/better-auth/plugin/helpers/get-admin-routes.d.ts.map +1 -0
  23. package/dist/better-auth/plugin/helpers/get-admin-routes.js +6 -0
  24. package/dist/better-auth/plugin/helpers/get-all-roles.d.ts +6 -0
  25. package/dist/better-auth/plugin/helpers/get-all-roles.d.ts.map +1 -0
  26. package/dist/better-auth/plugin/helpers/get-all-roles.js +20 -0
  27. package/dist/better-auth/plugin/helpers/get-ip.d.ts +1 -1
  28. package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -1
  29. package/dist/better-auth/plugin/helpers/get-ip.js +14 -14
  30. package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts +3 -0
  31. package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts.map +1 -0
  32. package/dist/better-auth/plugin/helpers/get-requst-collection.js +14 -0
  33. package/dist/better-auth/plugin/helpers/index.d.ts +1 -1
  34. package/dist/better-auth/plugin/helpers/index.js +2 -2
  35. package/dist/better-auth/plugin/{lib → helpers}/prepare-session-data.d.ts +3 -3
  36. package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts.map +1 -0
  37. package/dist/better-auth/plugin/helpers/prepare-session-data.js +42 -0
  38. package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts +4 -4
  39. package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts.map +1 -1
  40. package/dist/better-auth/plugin/helpers/serialize-cookie.js +34 -34
  41. package/dist/better-auth/plugin/index.d.ts +7 -7
  42. package/dist/better-auth/plugin/index.d.ts.map +1 -1
  43. package/dist/better-auth/plugin/index.js +145 -37
  44. package/dist/better-auth/plugin/{collections → lib/build-collections}/accounts/hooks/sync-password-to-user.d.ts +1 -1
  45. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts.map +1 -0
  46. package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.js +47 -0
  47. package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts +7 -0
  48. package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts.map +1 -0
  49. package/dist/better-auth/plugin/lib/build-collections/accounts/index.js +159 -0
  50. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts +6 -0
  51. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts.map +1 -0
  52. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.js +11 -0
  53. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts +3 -0
  54. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts.map +1 -0
  55. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.js +8 -0
  56. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts +7 -0
  57. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts.map +1 -0
  58. package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.js +107 -0
  59. package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts +6 -0
  60. package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts.map +1 -0
  61. package/dist/better-auth/plugin/lib/build-collections/api-keys.js +196 -0
  62. package/dist/better-auth/plugin/lib/build-collections/index.d.ts +12 -0
  63. package/dist/better-auth/plugin/lib/build-collections/index.d.ts.map +1 -0
  64. package/dist/better-auth/plugin/lib/build-collections/index.js +96 -0
  65. package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts +6 -0
  66. package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts.map +1 -0
  67. package/dist/better-auth/plugin/lib/build-collections/invitations.js +91 -0
  68. package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts +6 -0
  69. package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts.map +1 -0
  70. package/dist/better-auth/plugin/lib/build-collections/jwks.js +43 -0
  71. package/dist/better-auth/plugin/lib/build-collections/members.d.ts +6 -0
  72. package/dist/better-auth/plugin/lib/build-collections/members.d.ts.map +1 -0
  73. package/dist/better-auth/plugin/lib/build-collections/members.js +71 -0
  74. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts +6 -0
  75. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts.map +1 -0
  76. package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.js +98 -0
  77. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts +6 -0
  78. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts.map +1 -0
  79. package/dist/better-auth/plugin/lib/build-collections/oauth-applications.js +113 -0
  80. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts +6 -0
  81. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts.map +1 -0
  82. package/dist/better-auth/plugin/lib/build-collections/oauth-consents.js +67 -0
  83. package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts +6 -0
  84. package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts.map +1 -0
  85. package/dist/better-auth/plugin/lib/build-collections/organizations.js +59 -0
  86. package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts +6 -0
  87. package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts.map +1 -0
  88. package/dist/better-auth/plugin/lib/build-collections/passkeys.js +108 -0
  89. package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts +8 -0
  90. package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts.map +1 -0
  91. package/dist/better-auth/plugin/lib/build-collections/sessions.js +123 -0
  92. package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts +6 -0
  93. package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts.map +1 -0
  94. package/dist/better-auth/plugin/lib/build-collections/sso-providers.js +83 -0
  95. package/dist/better-auth/plugin/lib/build-collections/teams.d.ts +6 -0
  96. package/dist/better-auth/plugin/lib/build-collections/teams.d.ts.map +1 -0
  97. package/dist/better-auth/plugin/lib/build-collections/teams.js +45 -0
  98. package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts +6 -0
  99. package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts.map +1 -0
  100. package/dist/better-auth/plugin/lib/build-collections/two-factors.js +56 -0
  101. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts +8 -0
  102. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts.map +1 -0
  103. package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.js +52 -0
  104. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.d.ts +3 -0
  105. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.d.ts.map +1 -0
  106. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.js +96 -0
  107. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts +13 -0
  108. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts.map +1 -0
  109. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.js +67 -0
  110. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts +4 -0
  111. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts.map +1 -0
  112. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.js +115 -0
  113. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts +3 -0
  114. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts.map +1 -0
  115. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.js +110 -0
  116. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts +3 -0
  117. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts.map +1 -0
  118. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.js +62 -0
  119. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts +3 -0
  120. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts.map +1 -0
  121. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.js +42 -0
  122. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts +4 -0
  123. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts.map +1 -0
  124. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.js +79 -0
  125. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts +4 -0
  126. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts.map +1 -0
  127. package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.js +153 -0
  128. package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/after-login.d.ts +1 -1
  129. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts.map +1 -0
  130. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.js +75 -0
  131. package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/after-logout.d.ts +1 -1
  132. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts.map +1 -0
  133. package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.js +74 -0
  134. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts +7 -0
  135. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts.map +1 -0
  136. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.js +45 -0
  137. package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/before-login.d.ts +1 -1
  138. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts.map +1 -0
  139. package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.js +18 -0
  140. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts +3 -0
  141. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts.map +1 -0
  142. package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.js +14 -0
  143. package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/sync-account.d.ts +1 -1
  144. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts.map +1 -0
  145. package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.js +82 -0
  146. package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts +8 -0
  147. package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts.map +1 -0
  148. package/dist/better-auth/plugin/lib/build-collections/users/index.js +345 -0
  149. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts +8 -0
  150. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts.map +1 -0
  151. package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.js +31 -0
  152. package/dist/better-auth/plugin/lib/{payload-access.d.ts → build-collections/utils/payload-access.d.ts} +1 -1
  153. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts.map +1 -0
  154. package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.js +64 -0
  155. package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts +7 -0
  156. package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts.map +1 -0
  157. package/dist/better-auth/plugin/lib/build-collections/verifications.js +63 -0
  158. package/dist/better-auth/plugin/lib/{config.d.ts → constants.d.ts} +13 -1
  159. package/dist/better-auth/plugin/lib/constants.d.ts.map +1 -0
  160. package/dist/better-auth/plugin/lib/constants.js +56 -0
  161. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +2 -2
  162. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -1
  163. package/dist/better-auth/plugin/lib/get-payload-auth.js +2 -2
  164. package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts +4 -4
  165. package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts.map +1 -1
  166. package/dist/better-auth/plugin/lib/get-required-collection-slugs.js +26 -43
  167. package/dist/better-auth/plugin/lib/init-better-auth.d.ts +4 -3
  168. package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -1
  169. package/dist/better-auth/plugin/lib/init-better-auth.js +7 -7
  170. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts +3 -0
  171. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts.map +1 -0
  172. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.js +8 -0
  173. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts +2 -0
  174. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts.map +1 -0
  175. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.js +17 -0
  176. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts +10 -0
  177. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts.map +1 -0
  178. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.js +118 -0
  179. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts +2 -0
  180. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts.map +1 -0
  181. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.js +58 -0
  182. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts +2 -0
  183. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts.map +1 -0
  184. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.js +86 -0
  185. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts +2 -0
  186. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts.map +1 -0
  187. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.js +17 -0
  188. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts +2 -0
  189. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts.map +1 -0
  190. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.js +17 -0
  191. 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} +1 -1
  192. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts.map +1 -0
  193. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.js +23 -0
  194. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts.map +1 -0
  195. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.js +62 -0
  196. 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 -6
  197. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts.map +1 -0
  198. package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.js +30 -0
  199. package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts +8 -0
  200. package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts.map +1 -0
  201. package/dist/better-auth/plugin/payload/components/admin-buttons/index.js +115 -0
  202. package/dist/better-auth/plugin/payload/components/admin-buttons/index.scss +31 -0
  203. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts +11 -0
  204. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts.map +1 -0
  205. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.js +196 -0
  206. package/dist/better-auth/plugin/payload/components/admin-invite-button/index.scss +131 -0
  207. package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts +14 -0
  208. package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts.map +1 -0
  209. package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.js +111 -0
  210. package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.scss +51 -0
  211. package/dist/better-auth/plugin/payload/components/form-header/index.d.ts +9 -0
  212. package/dist/better-auth/plugin/payload/components/form-header/index.d.ts.map +1 -0
  213. package/dist/better-auth/plugin/payload/components/form-header/index.js +23 -0
  214. package/dist/better-auth/plugin/payload/components/form-header/index.scss +8 -0
  215. package/dist/better-auth/plugin/payload/components/icons.d.ts +9 -0
  216. package/dist/better-auth/plugin/payload/components/icons.d.ts.map +1 -0
  217. package/dist/better-auth/plugin/payload/components/icons.js +437 -0
  218. package/dist/better-auth/plugin/payload/components/logo.d.ts +3 -2
  219. package/dist/better-auth/plugin/payload/components/logo.d.ts.map +1 -1
  220. package/dist/better-auth/plugin/payload/components/logo.js +22 -34
  221. package/dist/better-auth/plugin/payload/components/logout-button.d.ts +6 -0
  222. package/dist/better-auth/plugin/payload/components/logout-button.d.ts.map +1 -0
  223. package/dist/better-auth/plugin/payload/components/logout-button.js +27 -0
  224. package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts +7 -0
  225. package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts.map +1 -0
  226. package/dist/better-auth/plugin/payload/components/rsc-redirect.js +8 -0
  227. package/dist/better-auth/plugin/payload/components/styles.css +2 -2
  228. package/dist/better-auth/plugin/payload/components/token-field.d.ts +5 -0
  229. package/dist/better-auth/plugin/payload/components/token-field.d.ts.map +1 -0
  230. package/dist/better-auth/plugin/payload/components/token-field.js +30 -0
  231. package/dist/better-auth/plugin/payload/exports/client.d.ts +6 -3
  232. package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -1
  233. package/dist/better-auth/plugin/payload/exports/client.js +7 -4
  234. package/dist/better-auth/plugin/payload/exports/rsc.d.ts +9 -5
  235. package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -1
  236. package/dist/better-auth/plugin/payload/exports/rsc.js +10 -6
  237. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts +3 -0
  238. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts.map +1 -0
  239. package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.js +8 -0
  240. package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts +15 -0
  241. package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts.map +1 -0
  242. package/dist/better-auth/plugin/payload/utils/generate-metadata.js +74 -0
  243. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts +2 -0
  244. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts.map +1 -0
  245. package/dist/better-auth/plugin/payload/utils/get-safe-redirect.js +23 -0
  246. package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts +12 -0
  247. package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts.map +1 -0
  248. package/dist/better-auth/plugin/payload/views/admin-invite/client.js +92 -0
  249. package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts +11 -0
  250. package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts.map +1 -0
  251. package/dist/better-auth/plugin/payload/views/admin-invite/index.js +84 -0
  252. package/dist/better-auth/plugin/payload/views/admin-invite/index.scss +25 -0
  253. package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts +14 -0
  254. package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts.map +1 -0
  255. package/dist/better-auth/plugin/payload/views/create-first-admin/client.js +95 -0
  256. package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts +10 -4
  257. package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts.map +1 -1
  258. package/dist/better-auth/plugin/payload/views/create-first-admin/index.js +124 -92
  259. package/dist/better-auth/plugin/payload/views/create-first-admin/index.scss +29 -0
  260. package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts +8 -0
  261. package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts.map +1 -0
  262. package/dist/better-auth/plugin/payload/views/forgot-password/client.js +119 -0
  263. package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts +9 -0
  264. package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts.map +1 -0
  265. package/dist/better-auth/plugin/payload/views/forgot-password/index.js +69 -0
  266. package/dist/better-auth/plugin/payload/views/forgot-password/index.scss +0 -0
  267. package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts +5 -0
  268. package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts.map +1 -0
  269. package/dist/better-auth/plugin/payload/views/inactivity/index.js +12 -0
  270. package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts +9 -0
  271. package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts.map +1 -0
  272. package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.js +54 -0
  273. package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts +1 -0
  274. package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts.map +1 -0
  275. package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.js +121 -0
  276. package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.scss +31 -0
  277. package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts +56 -0
  278. package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts.map +1 -0
  279. package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.js +3 -0
  280. package/dist/better-auth/plugin/payload/views/login/form/index.d.ts +17 -0
  281. package/dist/better-auth/plugin/payload/views/login/form/index.d.ts.map +1 -0
  282. package/dist/better-auth/plugin/payload/views/login/form/index.js +137 -0
  283. package/dist/better-auth/plugin/payload/views/login/form/index.scss +23 -0
  284. package/dist/better-auth/plugin/payload/views/login/index.d.ts +10 -5
  285. package/dist/better-auth/plugin/payload/views/login/index.d.ts.map +1 -1
  286. package/dist/better-auth/plugin/payload/views/login/index.js +81 -61
  287. package/dist/better-auth/plugin/payload/views/login/index.scss +10 -0
  288. package/dist/better-auth/plugin/payload/views/logout/client.d.ts +8 -0
  289. package/dist/better-auth/plugin/payload/views/logout/client.d.ts.map +1 -0
  290. package/dist/better-auth/plugin/payload/views/logout/client.js +76 -0
  291. package/dist/better-auth/plugin/payload/views/logout/index.d.ts +8 -0
  292. package/dist/better-auth/plugin/payload/views/logout/index.d.ts.map +1 -0
  293. package/dist/better-auth/plugin/payload/views/logout/index.js +14 -0
  294. package/dist/better-auth/plugin/payload/views/logout/index.scss +0 -0
  295. package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts +7 -0
  296. package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts.map +1 -0
  297. package/dist/better-auth/plugin/payload/views/reset-password/client.js +72 -0
  298. package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts +5 -0
  299. package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts.map +1 -0
  300. package/dist/better-auth/plugin/payload/views/reset-password/index.js +81 -0
  301. package/dist/better-auth/plugin/payload/views/reset-password/index.scss +9 -0
  302. package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts +3 -0
  303. package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts.map +1 -0
  304. package/dist/better-auth/plugin/payload/views/reset-password/metadata.js +11 -0
  305. package/dist/better-auth/plugin/types.d.ts +170 -33
  306. package/dist/better-auth/plugin/types.d.ts.map +1 -1
  307. package/dist/better-auth/plugin/types.js +1 -1
  308. package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts +1 -1
  309. package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts.map +1 -1
  310. package/dist/clerk/utils/clerk-user.d.ts +0 -3
  311. package/dist/clerk/utils/clerk-user.d.ts.map +1 -1
  312. package/dist/clerk/utils/clerk-user.js +1 -3
  313. package/dist/clerk/utils/load-clerk-instance.d.ts +1 -1
  314. package/dist/clerk/utils/load-clerk-instance.d.ts.map +1 -1
  315. package/package.json +13 -13
  316. package/LICENSE.md +0 -17
  317. package/dist/better-auth/adapter/dev/bin/run.d.ts +0 -2
  318. package/dist/better-auth/adapter/dev/bin/run.d.ts.map +0 -1
  319. package/dist/better-auth/adapter/dev/bin/run.js +0 -64
  320. package/dist/better-auth/adapter/dev/bin/schema.d.ts +0 -23
  321. package/dist/better-auth/adapter/dev/bin/schema.d.ts.map +0 -1
  322. package/dist/better-auth/adapter/dev/bin/schema.js +0 -160
  323. package/dist/better-auth/adapter/dev/collections.d.ts +0 -4
  324. package/dist/better-auth/adapter/dev/collections.d.ts.map +0 -1
  325. package/dist/better-auth/adapter/dev/collections.js +0 -212
  326. package/dist/better-auth/adapter/dev/index.d.ts +0 -4
  327. package/dist/better-auth/adapter/dev/index.d.ts.map +0 -1
  328. package/dist/better-auth/adapter/dev/index.js +0 -168
  329. package/dist/better-auth/adapter/test/adapter.test.d.ts +0 -2
  330. package/dist/better-auth/adapter/test/adapter.test.d.ts.map +0 -1
  331. package/dist/better-auth/adapter/test/adapter.test.js +0 -181
  332. package/dist/better-auth/adapter/test/better-auth-adapter-test.d.ts +0 -8
  333. package/dist/better-auth/adapter/test/better-auth-adapter-test.d.ts.map +0 -1
  334. package/dist/better-auth/adapter/test/better-auth-adapter-test.js +0 -425
  335. package/dist/better-auth/adapter/test/schema.test.d.ts +0 -2
  336. package/dist/better-auth/adapter/test/schema.test.d.ts.map +0 -1
  337. package/dist/better-auth/adapter/test/schema.test.js +0 -796
  338. package/dist/better-auth/adapter/test/test_payload1/schema.d.ts +0 -24
  339. package/dist/better-auth/adapter/test/test_payload1/schema.d.ts.map +0 -1
  340. package/dist/better-auth/adapter/test/test_payload1/schema.js +0 -177
  341. package/dist/better-auth/adapter/test/test_payload2/schema.d.ts +0 -24
  342. package/dist/better-auth/adapter/test/test_payload2/schema.d.ts.map +0 -1
  343. package/dist/better-auth/adapter/test/test_payload2/schema.js +0 -167
  344. package/dist/better-auth/adapter/test/test_payload3/schema.d.ts +0 -24
  345. package/dist/better-auth/adapter/test/test_payload3/schema.d.ts.map +0 -1
  346. package/dist/better-auth/adapter/test/test_payload3/schema.js +0 -198
  347. package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.d.ts.map +0 -1
  348. package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.js +0 -47
  349. package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.d.ts +0 -7
  350. package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.d.ts.map +0 -1
  351. package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.js +0 -106
  352. package/dist/better-auth/plugin/collections/users/hooks/after-login.d.ts.map +0 -1
  353. package/dist/better-auth/plugin/collections/users/hooks/after-login.js +0 -71
  354. package/dist/better-auth/plugin/collections/users/hooks/after-logout.d.ts.map +0 -1
  355. package/dist/better-auth/plugin/collections/users/hooks/after-logout.js +0 -49
  356. package/dist/better-auth/plugin/collections/users/hooks/before-login.d.ts.map +0 -1
  357. package/dist/better-auth/plugin/collections/users/hooks/before-login.js +0 -18
  358. package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.d.ts +0 -6
  359. package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.d.ts.map +0 -1
  360. package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.js +0 -33
  361. package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.d.ts +0 -3
  362. package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.d.ts.map +0 -1
  363. package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.js +0 -14
  364. package/dist/better-auth/plugin/collections/users/hooks/sync-account.d.ts.map +0 -1
  365. package/dist/better-auth/plugin/collections/users/hooks/sync-account.js +0 -82
  366. package/dist/better-auth/plugin/lib/auth-strategy.d.ts +0 -9
  367. package/dist/better-auth/plugin/lib/auth-strategy.d.ts.map +0 -1
  368. package/dist/better-auth/plugin/lib/auth-strategy.js +0 -48
  369. package/dist/better-auth/plugin/lib/build-collection-configs.d.ts +0 -12
  370. package/dist/better-auth/plugin/lib/build-collection-configs.d.ts.map +0 -1
  371. package/dist/better-auth/plugin/lib/build-collection-configs.js +0 -1558
  372. package/dist/better-auth/plugin/lib/config.d.ts.map +0 -1
  373. package/dist/better-auth/plugin/lib/config.js +0 -44
  374. package/dist/better-auth/plugin/lib/ensure-password-set-before-create.d.ts.map +0 -1
  375. package/dist/better-auth/plugin/lib/ensure-password-set-before-create.js +0 -24
  376. package/dist/better-auth/plugin/lib/password.d.ts.map +0 -1
  377. package/dist/better-auth/plugin/lib/password.js +0 -63
  378. package/dist/better-auth/plugin/lib/payload-access.d.ts.map +0 -1
  379. package/dist/better-auth/plugin/lib/payload-access.js +0 -64
  380. package/dist/better-auth/plugin/lib/prepare-session-data.d.ts.map +0 -1
  381. package/dist/better-auth/plugin/lib/prepare-session-data.js +0 -42
  382. package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.d.ts.map +0 -1
  383. package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.js +0 -30
  384. package/dist/better-auth/plugin/lib/sanitize-auth-options.d.ts +0 -6
  385. package/dist/better-auth/plugin/lib/sanitize-auth-options.d.ts.map +0 -1
  386. package/dist/better-auth/plugin/lib/sanitize-auth-options.js +0 -298
  387. package/dist/better-auth/plugin/payload/components/admin-buttons.d.ts +0 -7
  388. package/dist/better-auth/plugin/payload/components/admin-buttons.d.ts.map +0 -1
  389. package/dist/better-auth/plugin/payload/components/admin-buttons.js +0 -219
  390. package/dist/better-auth/plugin/payload/components/login-redirect.d.ts +0 -2
  391. package/dist/better-auth/plugin/payload/components/login-redirect.d.ts.map +0 -1
  392. package/dist/better-auth/plugin/payload/components/login-redirect.js +0 -6
  393. package/dist/better-auth/plugin/payload/components/logout.d.ts +0 -3
  394. package/dist/better-auth/plugin/payload/components/logout.d.ts.map +0 -1
  395. package/dist/better-auth/plugin/payload/components/logout.js +0 -61
  396. package/dist/better-auth/plugin/payload/components/sign-in.d.ts +0 -4
  397. package/dist/better-auth/plugin/payload/components/sign-in.d.ts.map +0 -1
  398. package/dist/better-auth/plugin/payload/components/sign-in.js +0 -384
  399. package/dist/better-auth/plugin/payload/components/sign-up.d.ts +0 -7
  400. package/dist/better-auth/plugin/payload/components/sign-up.d.ts.map +0 -1
  401. package/dist/better-auth/plugin/payload/components/sign-up.js +0 -503
  402. package/dist/better-auth/plugin/payload/components/ui/button.d.ts +0 -11
  403. package/dist/better-auth/plugin/payload/components/ui/button.d.ts.map +0 -1
  404. package/dist/better-auth/plugin/payload/components/ui/button.js +0 -42
  405. package/dist/better-auth/plugin/payload/components/ui/card.d.ts +0 -10
  406. package/dist/better-auth/plugin/payload/components/ui/card.d.ts.map +0 -1
  407. package/dist/better-auth/plugin/payload/components/ui/card.js +0 -55
  408. package/dist/better-auth/plugin/payload/components/ui/checkbox.d.ts +0 -5
  409. package/dist/better-auth/plugin/payload/components/ui/checkbox.d.ts.map +0 -1
  410. package/dist/better-auth/plugin/payload/components/ui/checkbox.js +0 -23
  411. package/dist/better-auth/plugin/payload/components/ui/cn.d.ts +0 -3
  412. package/dist/better-auth/plugin/payload/components/ui/cn.d.ts.map +0 -1
  413. package/dist/better-auth/plugin/payload/components/ui/cn.js +0 -7
  414. package/dist/better-auth/plugin/payload/components/ui/input.d.ts +0 -4
  415. package/dist/better-auth/plugin/payload/components/ui/input.d.ts.map +0 -1
  416. package/dist/better-auth/plugin/payload/components/ui/input.js +0 -14
  417. package/dist/better-auth/plugin/payload/components/ui/label.d.ts +0 -5
  418. package/dist/better-auth/plugin/payload/components/ui/label.d.ts.map +0 -1
  419. package/dist/better-auth/plugin/payload/components/ui/label.js +0 -15
  420. package/dist/better-auth/plugin/payload/components/ui/password-input.d.ts +0 -3
  421. package/dist/better-auth/plugin/payload/components/ui/password-input.d.ts.map +0 -1
  422. package/dist/better-auth/plugin/payload/components/ui/password-input.js +0 -55
  423. /package/dist/better-auth/plugin/lib/{password.d.ts → sanitize-better-auth-options/utils/password.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/better-auth/plugin/lib/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;CAqB/B,CAAA;AAEV,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAA;AAEV,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;CAaxB,CAAA"}
@@ -1,44 +0,0 @@
1
- export const supportedBetterAuthPluginIds = {
2
- harmonyEmail: 'harmony-email',
3
- harmonyPhoneNumber: 'harmony-phone-number',
4
- twoFactor: 'two-factor',
5
- username: 'username',
6
- anonymous: 'anonymous',
7
- phoneNumber: 'phone-number',
8
- magicLink: 'magic-link',
9
- emailOtp: 'email-otp',
10
- passkey: 'passkey',
11
- oneTap: 'one-tap',
12
- admin: 'admin',
13
- apiKey: 'api-key',
14
- organization: 'organization',
15
- multiSession: 'multi-session',
16
- openApi: 'open-api',
17
- jwt: 'jwt',
18
- nextCookies: 'next-cookies',
19
- sso: 'sso',
20
- oidc: 'oidc',
21
- expo: 'expo'
22
- };
23
- export const baseCollectionSlugs = {
24
- users: 'users',
25
- sessions: 'sessions',
26
- accounts: 'accounts',
27
- verifications: 'verifications'
28
- };
29
- export const betterAuthPluginSlugs = {
30
- apiKeys: 'apiKeys',
31
- jwks: 'jwks',
32
- twoFactors: 'twoFactors',
33
- passkeys: 'passkeys',
34
- oauthApplications: 'oauthApplications',
35
- oauthAccessTokens: 'oauthAccessTokens',
36
- oauthConsents: 'oauthConsents',
37
- ssoProviders: 'ssoProviders',
38
- organizations: 'organizations',
39
- invitations: 'invitations',
40
- members: 'members',
41
- teams: 'teams'
42
- };
43
-
44
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2NvbmZpZy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3Qgc3VwcG9ydGVkQmV0dGVyQXV0aFBsdWdpbklkcyA9IHtcbiAgaGFybW9ueUVtYWlsOiAnaGFybW9ueS1lbWFpbCcsXG4gIGhhcm1vbnlQaG9uZU51bWJlcjogJ2hhcm1vbnktcGhvbmUtbnVtYmVyJyxcbiAgdHdvRmFjdG9yOiAndHdvLWZhY3RvcicsXG4gIHVzZXJuYW1lOiAndXNlcm5hbWUnLFxuICBhbm9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yxRQUFRO0lBQ1JDLE9BQU87SUFDUEMsUUFBUTtJQUNSQyxjQUFjO0lBQ2RDLGNBQWM7SUFDZEMsU0FBUztJQUNUQyxLQUFLO0lBQ0xDLGFBQWE7SUFDYkMsS0FBSztJQUNMQyxNQUFNO0lBQ05DLE1BQU07QUFDUixFQUFVO0FBRVYsT0FBTyxNQUFNQyxzQkFBc0I7SUFDakNDLE9BQU87SUFDUEMsVUFBVTtJQUNWQyxVQUFVO0lBQ1ZDLGVBQWU7QUFDakIsRUFBVTtBQUVWLE9BQU8sTUFBTUMsd0JBQXdCO0lBQ25DQyxTQUFTO0lBQ1RDLE1BQU07SUFDTkMsWUFBWTtJQUNaQyxVQUFVO0lBQ1ZDLG1CQUFtQjtJQUNuQkMsbUJBQW1CO0lBQ25CQyxlQUFlO0lBQ2ZDLGNBQWM7SUFDZEMsZUFBZTtJQUNmQyxhQUFhO0lBQ2JDLFNBQVM7SUFDVEMsT0FBTztBQUNULEVBQVUifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensure-password-set-before-create.d.ts","sourceRoot":"","sources":["../../../../src/better-auth/plugin/lib/ensure-password-set-before-create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,IAAI,CAAA;AAEpD;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,0BAA0B,QAoBpF"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Adds a before hook to the user create operation to ensure the password is set.
3
- * This is necessary because the password is not set in the user create operation
4
- * and is instead set in the sync password accounts hook.
5
- */ export function ensurePasswordSetBeforeUserCreate(options) {
6
- if (typeof options.databaseHooks !== 'object') options.databaseHooks = {};
7
- if (typeof options.databaseHooks.user !== 'object') options.databaseHooks.user = {};
8
- if (typeof options.databaseHooks.user.create !== 'object') options.databaseHooks.user.create = {};
9
- const initialBeforeUserCreateHook = options.databaseHooks.user.create.before ?? null;
10
- options.databaseHooks.user.create.before = async (user, ctx)=>{
11
- if (!user.password) {
12
- ;
13
- user.password = ctx?.body?.password ?? Array(3).fill(0).map(()=>Math.random().toString(36).slice(2)).join('');
14
- }
15
- if (typeof initialBeforeUserCreateHook === 'function') {
16
- return initialBeforeUserCreateHook(user, ctx);
17
- }
18
- return {
19
- data: user
20
- };
21
- };
22
- }
23
-
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL2Vuc3VyZS1wYXNzd29yZC1zZXQtYmVmb3JlLWNyZWF0ZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFNhbml0aXplZEJldHRlckF1dGhPcHRpb25zIH0gZnJvbSAnLi4nXG5cbi8qKlxuICogQWRkcyBhIGJlZm9yZSBob29rIHRvIHRoZSB1c2VyIGNyZWF0ZSBvcGVyYXRpb24gdG8gZW5zdXJlIHRoZSBwYXNzd29yZCBpcyBzZXQuXG4gKiBUaGlzIGlzIG5lY2Vzc2FyeSBiZWNhdXNlIHRoZSBwYXNzd29yZCBpcyBub3Qgc2V0IGluIHRoZSB1c2VyIGNyZWF0ZSBvcGVyYXRpb25cbiAqIGFuZCBpcyBpbnN0ZWFkIHNldCBpbiB0aGUgc3luYyBwYXNzd29yZCBhY2NvdW50cyBob29rLlxuICovXG5leHBvcnQgZnVuY3Rpb24gZW5zdXJlUGFzc3dvcmRTZXRCZWZvcmVVc2VyQ3JlYXRlKG9wdGlvbnM6IFNhbml0aXplZEJldHRlckF1dGhPcHRpb25zKSB7XG4gIGlmICh0eXBlb2Ygb3B0aW9ucy5kYXRhYmFzZUhvb2tzICE9PSAnb2JqZWN0Jykgb3B0aW9ucy5kYXRhYmFzZUhvb2tzID0ge31cbiAgaWYgKHR5cGVvZiBvcHRpb25zLmRhdGFiYXNlSG9va3MudXNlciAhPT0gJ29iamVjdCcpIG9wdGlvbnMuZGF0YWJhc2VI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UNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../src/better-auth/plugin/lib/password.ts"],"names":[],"mappings":"AAyBA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,CAQnE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAU,2BAIlC;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,KAAG,OAAO,CAAC,OAAO,CAyBlB,CAAA"}
@@ -1,63 +0,0 @@
1
- import crypto from 'crypto';
2
- /**
3
- * Mimics Payload's internal password hashing using pbkdf2
4
- *
5
- * This generates a hash compatible with Payload's internal auth system
6
- * so that passwords set via better-auth can be used with Payload admin panel
7
- */ function pbkdf2Promisified(password, salt) {
8
- return new Promise((resolve, reject)=>crypto.pbkdf2(password, salt, 25000, 512, 'sha256', (err, hashRaw)=>err ? reject(err) : resolve(hashRaw)));
9
- }
10
- /**
11
- * Generates random bytes for the salt
12
- */ function randomBytes() {
13
- return new Promise((resolve, reject)=>crypto.randomBytes(32, (err, saltBuffer)=>err ? reject(err) : resolve(saltBuffer)));
14
- }
15
- /**
16
- * Custom implementation of password hashing that matches Payload's format
17
- *
18
- * Instead of using better-auth's scrypt, this uses pbkdf2 with the same
19
- * parameters as Payload CMS
20
- *
21
- * @param password The password to hash
22
- * @returns A string in the format {salt}:{hash}
23
- */ export const hashPassword = async (password)=>{
24
- const saltBuffer = await randomBytes();
25
- const salt = saltBuffer.toString('hex');
26
- const hashRaw = await pbkdf2Promisified(password, salt);
27
- const hash = hashRaw.toString('hex');
28
- return `${salt}:${hash}`;
29
- };
30
- /**
31
- * Verifies a password against a stored hash
32
- *
33
- * This function is flexible and can handle:
34
- * 1. A combined string in format {salt}:{hash} (for account passwords)
35
- * 2. When salt and hash need to be combined from user records
36
- *
37
- * @param params Object containing the hash and password
38
- * @returns Boolean indicating if the password matches
39
- */ export const verifyPassword = async ({ hash, password, salt })=>{
40
- let saltValue;
41
- let storedHash;
42
- // If salt is provided separately (from user record), use it with the hash
43
- if (salt) {
44
- saltValue = salt;
45
- storedHash = hash;
46
- } else {
47
- // Otherwise, split the combined format (from account.password)
48
- const parts = hash.split(':');
49
- if (parts.length !== 2) {
50
- return false;
51
- }
52
- ;
53
- [saltValue, storedHash] = parts;
54
- }
55
- if (!saltValue || !storedHash) {
56
- return false;
57
- }
58
- const hashRaw = await pbkdf2Promisified(password, saltValue);
59
- const computedHash = hashRaw.toString('hex');
60
- return storedHash === computedHash;
61
- };
62
-
63
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Bhc3N3b3JkLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjcnlwdG8gZnJvbSAnY3J5cHRvJ1xuXG4vKipcbiAqIE1pbWljcyBQYXlsb2FkJ3MgaW50ZXJuYWwgcGFzc3dvcmQgaGFzaGluZyB1c2luZyBwYmtkZjJcbiAqXG4gKiBUaGlzIGdlbmVyYXRlcyBhIGhhc2ggY29tcGF0aWJsZSB3aXRoIFBheWxvYWQncyBpbnRlcm5hbCBhdXRoIHN5c3RlbVxuICogc28gdGhhdCBwYXNzd29yZHMgc2V0IHZpYSBiZXR0ZXItYXV0aCBjYW4gYmUgdXNlZCB3aXRoIFBheWxvYWQgYWRtaW4gcGFuZWxcbiAqL1xuZnVuY3Rpb24gcGJrZGYyUHJvbWlzaWZpZWQocGFzc3dvcmQ6IHN0cmluZywgc2FsdDogc3RyaW5nKTogUHJvbWlzZTxCdWZmZXI+IHtcbiAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+XG4gICAgY3J5cHRvLnBia2RmMihwYXNzd29yZCwgc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DSixXQUFXQyxXQUFXLEdBQUdDO0lBQzdCO0lBRUEsSUFBSSxDQUFDRixhQUFhLENBQUNDLFlBQVk7UUFDN0IsT0FBTztJQUNUO0lBRUEsTUFBTVIsVUFBVSxNQUFNUixrQkFBa0JDLFVBQVVjO0lBQ2xELE1BQU1LLGVBQWVaLFFBQVFJLFFBQVEsQ0FBQztJQUV0QyxPQUFPSSxlQUFlSTtBQUN4QixFQUFDIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"payload-access.d.ts","sourceRoot":"","sources":["../../../../src/better-auth/plugin/lib/payload-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAElD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IACxD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,wBAAwB,GAAG;IACtE,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC1B,SAAQ,gBAAqB,KAAG,WAKhC,CAAA;AAEH,eAAO,MAAM,6BAA6B,GACvC,SAAQ,wBAA6B,KAAG,MAUxC,CAAA;AAEH,eAAO,MAAM,2CAA2C,GACtD,QAAQ,8BAA8B,KACrC,MA2CF,CAAA"}
@@ -1,64 +0,0 @@
1
- export const isAdminWithRoles = (config = {})=>({ req })=>{
2
- const { adminRoles = [
3
- 'admin'
4
- ] } = config;
5
- if (!req?.user || !req.user.role || !adminRoles.includes(req.user.role)) return false;
6
- return true;
7
- };
8
- export const isAdminOrCurrentUserWithRoles = (config = {})=>({ req })=>{
9
- const { adminRoles = [
10
- 'admin'
11
- ], idField = 'id' } = config;
12
- if (isAdminWithRoles({
13
- adminRoles
14
- })({
15
- req
16
- })) return true;
17
- if (!req?.user) return false;
18
- return {
19
- [idField]: {
20
- equals: req?.user?.id
21
- }
22
- };
23
- };
24
- export const isAdminOrCurrentUserUpdateWithAllowedFields = (config)=>{
25
- return async ({ req, id, data })=>{
26
- const { adminRoles = [
27
- 'admin'
28
- ], allowedFields = [], userSlug, idField = 'id' } = config;
29
- const user = req.user;
30
- if (isAdminWithRoles({
31
- adminRoles
32
- })({
33
- req
34
- })) return true;
35
- if (!user) return false;
36
- if (user[idField] === id && data) {
37
- const dataKeys = Object.keys(data);
38
- const hasCurrentPassword = dataKeys.includes('currentPassword');
39
- const hasPassword = dataKeys.includes('password');
40
- if (hasPassword || hasCurrentPassword) {
41
- if (!(hasCurrentPassword && hasPassword)) return false;
42
- try {
43
- if (!user.email) return false;
44
- const result = await req.payload.login({
45
- collection: userSlug,
46
- data: {
47
- email: user.email,
48
- password: data.currentPassword
49
- }
50
- });
51
- if (!result) return false;
52
- allowedFields.push('password', 'currentPassword');
53
- } catch (error) {
54
- return false;
55
- }
56
- }
57
- const hasDisallowedField = dataKeys.some((key)=>!allowedFields.includes(key));
58
- return !hasDisallowedField;
59
- }
60
- return false;
61
- };
62
- };
63
-
64
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3BheWxvYWQtYWNjZXNzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgQWNjZXNzLCBGaWVsZEFjY2VzcyB9IGZyb20gJ3BheWxvYWQnXG5cbmV4cG9ydCB0eXBlIEFkbWluUm9sZXNDb25maWcgPSB7XG4gIGFkbWluUm9sZXM/OiBzdHJpbmdbXVxufVxuXG5leHBvcnQgdHlwZSBBZG1pbk9yQ3VycmVudFVzZXJDb25maWcgPSBBZG1pblJvbGVzQ29uZmlnICYge1xuICBpZEZpZWxkPzog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ugin/lib/prepare-session-data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAE9C,KAAK,eAAe,GAAG;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,qBAAqB,EAAE,MAAM,CAAA;CAC9B,CAAA;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,UAAU,EACV,aAAa,EACb,eAAe,GAChB,EAAE;IACD,UAAU,EAAE;QACV,IAAI,EAAE,GAAG,CAAA;QACT,OAAO,EAAE,GAAG,CAAA;KACb,CAAA;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAA;IACzC,eAAe,EAAE,eAAe,CAAA;CACjC;;;GA6CA"}
@@ -1,42 +0,0 @@
1
- import { getFieldsToSign } from 'payload';
2
- /**
3
- * Prepares session data for cookie cache by filtering user and session objects
4
- * based on the payload configuration's 'saveToJwt' property
5
- */ export async function prepareSessionData({ newSession, payloadConfig, collectionSlugs }) {
6
- if (!newSession || !newSession.user) {
7
- return null;
8
- }
9
- const { userCollectionSlug, sessionCollectionSlug } = collectionSlugs;
10
- const userCollection = payloadConfig?.collections?.find((c)=>c.slug === userCollectionSlug);
11
- const sessionCollection = payloadConfig?.collections?.find((c)=>c.slug === sessionCollectionSlug);
12
- if (!userCollection) {
13
- throw new Error(`User collection with slug '${userCollectionSlug}' not found`);
14
- }
15
- const filteredUser = getFieldsToSign({
16
- collectionConfig: userCollection,
17
- email: newSession.user.email,
18
- user: newSession.user
19
- });
20
- let filteredSession = newSession.session;
21
- const isImpersonated = newSession.session.impersonatedBy;
22
- if (sessionCollection && newSession.session) {
23
- filteredSession = getFieldsToSign({
24
- collectionConfig: sessionCollection,
25
- email: newSession.user.email,
26
- user: newSession.session
27
- });
28
- // getFieldsToSign is meant for auth collections so we remove the email and collection fields
29
- delete filteredSession.email;
30
- delete filteredSession.collection;
31
- }
32
- if (isImpersonated) {
33
- filteredSession.impersonatedBy = newSession.session.impersonatedBy;
34
- }
35
- return {
36
- ...newSession,
37
- user: filteredUser,
38
- session: filteredSession
39
- };
40
- }
41
-
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3ByZXBhcmUtc2Vzc2lvbi1kYXRhLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGdldEZpZWxkc1RvU2lnbiB9IGZyb20gJ3BheWxvYWQnXG5pbXBvcnQgdHlwZSB7IENvbmZpZywgUGF5bG9hZCB9IGZyb20gJ3BheWxvYWQnXG5cbnR5cGUgQ29sbGVjdGlvblNsdWdzID0ge1xuICB1c2VyQ29sbGVjdGlvblNsdWc6IHN0cmluZ1xuICBzZXNzaW9uQ29sbGVjdGlvblNsdWc6IHN0cmluZ1xufVxuXG4vKipcbiAqIFByZXBhcmVzIHNlc3Npb24gZGF0YSBmb3IgY29va2llIGNhY2hlIGJ5IGZpbHRlcmluZyB1c2VyIGFuZCBzZXNzaW9uIG9iamVjdHNcbiAqIGJhc2VkIG9uIHRoZSBwYXlsb2FkIGNvbmZpZ3VyYXRpb24ncyAnc2F2ZVRvSnd0JyBwcm9wZXJ0eVxuICovXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gcHJlcGFyZVNlc3Npb25EYXRhKHtcbiAgbmV3U2Vzc2lvbixcbiAgcGF5bG9hZENvbmZpZyxcbiAgY29sbGVjdGlvblNsdWdzLFxufToge1xuICBuZXdTZXNzaW9uOiB7XG4gICAgdXNlcjogYW55XG4gICAgc2Vzc2lvbjogYW55XG4gIH1cbiAgcGF5bG9hZENvbmZpZzogUGF5bG9hZFsnY29uZmlnJ10gfCBDb25maWdcbiAgY29sbGVjdGlvblNsdWdzOiBDb2xsZWN0aW9uU2x1Z3Ncbn0pIHtcbiAgaWYgKCFuZXdTZXNzaW9uIHx8ICFuZXdTZ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V0csSUFBSSxDQUFDWSxLQUFLO1lBQzVCWixNQUFNSCxXQUFXaUIsT0FBTztRQUMxQjtRQUVBLDZGQUE2RjtRQUM3RixPQUFPRCxnQkFBZ0JELEtBQUs7UUFDNUIsT0FBT0MsZ0JBQWdCSSxVQUFVO0lBQ25DO0lBRUEsSUFBSUYsZ0JBQWdCO1FBQ2xCRixnQkFBZ0JHLGNBQWMsR0FBR25CLFdBQVdpQixPQUFPLENBQUNFLGNBQWM7SUFDcEU7SUFFQSxPQUFPO1FBQ0wsR0FBR25CLFVBQVU7UUFDYkcsTUFBTVU7UUFDTkksU0FBU0Q7SUFDWDtBQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"respect-save-to-jwt-fields-middleware.d.ts","sourceRoot":"","sources":["../../../../src/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,IAAI,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAG9C;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,EAC/C,gBAAgB,EAChB,aAAa,EACb,aAAa,GACd,EAAE;IACD,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAA;IACzC,aAAa,EAAE,8BAA8B,CAAA;CAC9C,QAoBA"}
@@ -1,30 +0,0 @@
1
- import { setCookieCache } from 'better-auth/cookies';
2
- import { createAuthMiddleware } from 'better-auth/api';
3
- import { prepareSessionData } from './prepare-session-data';
4
- /**
5
- * Sets up a middleware that enforces the saveToJwt configuration when setting session data.
6
- * This ensures that only fields specified in saveToJwt are included in the cookie cache
7
- * for both user and session objects.
8
- *
9
- * The middleware runs after authentication and filters the session data based on
10
- * the collection configurations before storing it in the cookie cache.
11
- */ export function respectSaveToJwtFieldsMiddleware({ sanitizedOptions, payloadConfig, pluginOptions }) {
12
- if (typeof sanitizedOptions.hooks !== 'object') sanitizedOptions.hooks = {};
13
- sanitizedOptions.hooks.after = createAuthMiddleware(async (ctx)=>{
14
- const newSession = ctx.context?.newSession;
15
- if (!newSession) return;
16
- const filteredSessionData = await prepareSessionData({
17
- newSession,
18
- payloadConfig,
19
- collectionSlugs: {
20
- userCollectionSlug: pluginOptions.users?.slug ?? 'users',
21
- sessionCollectionSlug: pluginOptions.sessions?.slug ?? 'sessions'
22
- }
23
- });
24
- if (filteredSessionData) {
25
- await setCookieCache(ctx, filteredSessionData);
26
- }
27
- });
28
- }
29
-
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9iZXR0ZXItYXV0aC9wbHVnaW4vbGliL3Jlc3BlY3Qtc2F2ZS10by1qd3QtZmllbGRzLW1pZGRsZXdhcmUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc2V0Q29va2llQ2FjaGUgfSBmcm9tICdiZXR0ZXItYXV0aC9jb29raWVzJ1xuaW1wb3J0IHsgY3JlYXRlQXV0aE1pZGRsZXdhcmUgfSBmcm9tICdiZXR0ZXItYXV0aC9hcGknXG5pbXBvcnQgdHlwZSB7IFNhbml0aXplZEJldHRlckF1dGhPcHRpb25zLCBQYXlsb2FkQmV0dGVyQXV0aFBsdWdpbk9wdGlvbnMgfSBmcm9tICcuLidcbmltcG9ydCB0eXBlIHsgQ29uZmlnLCBQYXlsb2FkIH0gZnJvbSAncGF5bG9hZCdcbmltcG9ydCB7IHByZXBhcmVTZXNzaW9uRGF0YSB9IGZyb20gJy4vcHJlcGFyZS1zZXNzaW9uLWRhdGEnXG5cbi8qKlxuICogU2V0cyB1cCBhIG1pZGRsZXdhcmUgdGhhdCBlbmZvcmNlcyB0aGUgc2F2ZVRvSnd0IGNvbmZpZ3VyYXRpb24gd2hlbiBzZXR0aW5nIHNlc3Npb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3QjtBQUUzRDs7Ozs7OztDQU9DLEdBQ0QsT0FBTyxTQUFTQyxpQ0FBaUMsRUFDL0NDLGdCQUFnQixFQUNoQkMsYUFBYSxFQUNiQyxhQUFhLEVBS2Q7SUFDQyxJQUFJLE9BQU9GLGlCQUFpQkcsS0FBSyxLQUFLLFVBQVVILGlCQUFpQkcsS0FBSyxHQUFHLENBQUM7SUFFMUVILGlCQUFpQkcsS0FBSyxDQUFDQyxLQUFLLEdBQUdQLHFCQUFxQixPQUFPUTtRQUN6RCxNQUFNQyxhQUFhRCxJQUFJRSxPQUFPLEVBQUVEO1FBQ2hDLElBQUksQ0FBQ0EsWUFBWTtRQUVqQixNQUFNRSxzQkFBc0IsTUFBTVYsbUJBQW1CO1lBQ25EUTtZQUNBTDtZQUNBUSxpQkFBaUI7Z0JBQ2ZDLG9CQUFvQlIsY0FBY1MsS0FBSyxFQUFFQyxRQUFRO2dCQUNqREMsdUJBQXVCWCxjQUFjWSxRQUFRLEVBQUVGLFFBQVE7WUFDekQ7UUFDRjtRQUVBLElBQUlKLHFCQUFxQjtZQUN2QixNQUFNWixlQUFlUyxLQUFLRztRQUM1QjtJQUNGO0FBQ0YifQ==
@@ -1,6 +0,0 @@
1
- import type { PayloadBetterAuthPluginOptions, SanitizedBetterAuthOptions } from '..';
2
- /**
3
- * Sanitizes the BetterAuth options
4
- */
5
- export declare function sanitizeBetterAuthOptions(options: PayloadBetterAuthPluginOptions): SanitizedBetterAuthOptions;
6
- //# sourceMappingURL=sanitize-auth-options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sanitize-auth-options.d.ts","sourceRoot":"","sources":["../../../../src/better-auth/plugin/lib/sanitize-auth-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,MAAM,IAAI,CAAA;AAKpF;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,8BAA8B,GACtC,0BAA0B,CAwT5B"}