payload-auth 1.0.0 → 1.0.2

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 (328) hide show
  1. package/dist/authjs/index.d.ts +1 -0
  2. package/dist/authjs/index.d.ts.map +1 -0
  3. package/dist/authjs/index.js +1 -1
  4. package/dist/better-auth/adapter/dev/bin/run.d.ts +1 -0
  5. package/dist/better-auth/adapter/dev/bin/run.d.ts.map +1 -0
  6. package/dist/better-auth/adapter/dev/bin/run.js +1 -1
  7. package/dist/better-auth/adapter/dev/bin/schema.d.ts +1 -0
  8. package/dist/better-auth/adapter/dev/bin/schema.d.ts.map +1 -0
  9. package/dist/better-auth/adapter/dev/bin/schema.js +1 -1
  10. package/dist/better-auth/adapter/dev/collections.d.ts +1 -0
  11. package/dist/better-auth/adapter/dev/collections.d.ts.map +1 -0
  12. package/dist/better-auth/adapter/dev/collections.js +1 -1
  13. package/dist/better-auth/adapter/dev/index.d.ts +1 -0
  14. package/dist/better-auth/adapter/dev/index.d.ts.map +1 -0
  15. package/dist/better-auth/adapter/dev/index.js +1 -1
  16. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts +1 -0
  17. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts.map +1 -0
  18. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js +1 -1
  19. package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts +1 -0
  20. package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts.map +1 -0
  21. package/dist/better-auth/adapter/generate-schema/get-payload-schema.js +1 -1
  22. package/dist/better-auth/adapter/generate-schema/index.d.ts +1 -0
  23. package/dist/better-auth/adapter/generate-schema/index.d.ts.map +1 -0
  24. package/dist/better-auth/adapter/generate-schema/index.js +3 -3
  25. package/dist/better-auth/adapter/generate-schema/utils.d.ts +1 -0
  26. package/dist/better-auth/adapter/generate-schema/utils.d.ts.map +1 -0
  27. package/dist/better-auth/adapter/generate-schema/utils.js +1 -1
  28. package/dist/better-auth/adapter/index.d.ts +3 -2
  29. package/dist/better-auth/adapter/index.d.ts.map +1 -0
  30. package/dist/better-auth/adapter/index.js +3 -3
  31. package/dist/better-auth/adapter/test/adapter.test.d.ts +1 -0
  32. package/dist/better-auth/adapter/test/adapter.test.d.ts.map +1 -0
  33. package/dist/better-auth/adapter/test/adapter.test.js +1 -1
  34. package/dist/better-auth/adapter/test/better-auth-adapter-test.d.ts +1 -0
  35. package/dist/better-auth/adapter/test/better-auth-adapter-test.d.ts.map +1 -0
  36. package/dist/better-auth/adapter/test/better-auth-adapter-test.js +1 -1
  37. package/dist/better-auth/adapter/test/schema.test.d.ts +1 -0
  38. package/dist/better-auth/adapter/test/schema.test.d.ts.map +1 -0
  39. package/dist/better-auth/adapter/test/schema.test.js +1 -1
  40. package/dist/better-auth/adapter/test/test_payload1/schema.d.ts +1 -0
  41. package/dist/better-auth/adapter/test/test_payload1/schema.d.ts.map +1 -0
  42. package/dist/better-auth/adapter/test/test_payload1/schema.js +1 -1
  43. package/dist/better-auth/adapter/test/test_payload2/schema.d.ts +1 -0
  44. package/dist/better-auth/adapter/test/test_payload2/schema.d.ts.map +1 -0
  45. package/dist/better-auth/adapter/test/test_payload2/schema.js +1 -1
  46. package/dist/better-auth/adapter/test/test_payload3/schema.d.ts +1 -0
  47. package/dist/better-auth/adapter/test/test_payload3/schema.d.ts.map +1 -0
  48. package/dist/better-auth/adapter/test/test_payload3/schema.js +1 -1
  49. package/dist/better-auth/adapter/transform/index.d.ts +5 -4
  50. package/dist/better-auth/adapter/transform/index.d.ts.map +1 -0
  51. package/dist/better-auth/adapter/transform/index.js +1 -1
  52. package/dist/better-auth/adapter/types.d.ts +1 -0
  53. package/dist/better-auth/adapter/types.d.ts.map +1 -0
  54. package/dist/better-auth/adapter/types.js +1 -1
  55. package/dist/better-auth/index.d.ts +1 -3
  56. package/dist/better-auth/index.d.ts.map +1 -0
  57. package/dist/better-auth/index.js +1 -4
  58. package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.d.ts +1 -0
  59. package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.d.ts.map +1 -0
  60. package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.js +1 -1
  61. package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.d.ts +1 -0
  62. package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.d.ts.map +1 -0
  63. package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.js +1 -1
  64. package/dist/better-auth/plugin/collections/users/hooks/after-login.d.ts +1 -0
  65. package/dist/better-auth/plugin/collections/users/hooks/after-login.d.ts.map +1 -0
  66. package/dist/better-auth/plugin/collections/users/hooks/after-login.js +1 -1
  67. package/dist/better-auth/plugin/collections/users/hooks/after-logout.d.ts +1 -0
  68. package/dist/better-auth/plugin/collections/users/hooks/after-logout.d.ts.map +1 -0
  69. package/dist/better-auth/plugin/collections/users/hooks/after-logout.js +1 -1
  70. package/dist/better-auth/plugin/collections/users/hooks/before-login.d.ts +1 -0
  71. package/dist/better-auth/plugin/collections/users/hooks/before-login.d.ts.map +1 -0
  72. package/dist/better-auth/plugin/collections/users/hooks/before-login.js +1 -1
  73. package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.d.ts +1 -0
  74. package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.d.ts.map +1 -0
  75. package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.js +1 -1
  76. package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.d.ts +1 -0
  77. package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.d.ts.map +1 -0
  78. package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.js +1 -1
  79. package/dist/better-auth/plugin/collections/users/hooks/sync-account.d.ts +1 -0
  80. package/dist/better-auth/plugin/collections/users/hooks/sync-account.d.ts.map +1 -0
  81. package/dist/better-auth/plugin/collections/users/hooks/sync-account.js +2 -2
  82. package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts +1 -0
  83. package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts.map +1 -0
  84. package/dist/better-auth/plugin/helpers/generate-verify-email-url.js +1 -1
  85. package/dist/better-auth/plugin/helpers/get-ip.d.ts +1 -0
  86. package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -0
  87. package/dist/better-auth/plugin/helpers/get-ip.js +1 -1
  88. package/dist/better-auth/plugin/helpers/index.d.ts +1 -0
  89. package/dist/better-auth/plugin/helpers/index.d.ts.map +1 -0
  90. package/dist/better-auth/plugin/helpers/index.js +1 -1
  91. package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts +3 -2
  92. package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts.map +1 -0
  93. package/dist/better-auth/plugin/helpers/serialize-cookie.js +1 -1
  94. package/dist/better-auth/plugin/index.d.ts +2 -1
  95. package/dist/better-auth/plugin/index.d.ts.map +1 -0
  96. package/dist/better-auth/plugin/index.js +2 -2
  97. package/dist/better-auth/plugin/lib/auth-strategy.d.ts +1 -0
  98. package/dist/better-auth/plugin/lib/auth-strategy.d.ts.map +1 -0
  99. package/dist/better-auth/plugin/lib/auth-strategy.js +1 -1
  100. package/dist/better-auth/plugin/lib/build-collection-configs.d.ts +1 -0
  101. package/dist/better-auth/plugin/lib/build-collection-configs.d.ts.map +1 -0
  102. package/dist/better-auth/plugin/lib/build-collection-configs.js +2 -2
  103. package/dist/better-auth/plugin/lib/config.d.ts +2 -0
  104. package/dist/better-auth/plugin/lib/config.d.ts.map +1 -0
  105. package/dist/better-auth/plugin/lib/config.js +3 -2
  106. package/dist/better-auth/plugin/lib/ensure-password-set-before-create.d.ts +1 -0
  107. package/dist/better-auth/plugin/lib/ensure-password-set-before-create.d.ts.map +1 -0
  108. package/dist/better-auth/plugin/lib/ensure-password-set-before-create.js +1 -1
  109. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +1 -0
  110. package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -0
  111. package/dist/better-auth/plugin/lib/get-payload-auth.js +1 -1
  112. package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts +1 -0
  113. package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts.map +1 -0
  114. package/dist/better-auth/plugin/lib/get-required-collection-slugs.js +1 -1
  115. package/dist/better-auth/plugin/lib/init-better-auth.d.ts +1 -0
  116. package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -0
  117. package/dist/better-auth/plugin/lib/init-better-auth.js +2 -2
  118. package/dist/better-auth/plugin/lib/password.d.ts +1 -0
  119. package/dist/better-auth/plugin/lib/password.d.ts.map +1 -0
  120. package/dist/better-auth/plugin/lib/password.js +1 -1
  121. package/dist/better-auth/plugin/lib/payload-access.d.ts +1 -0
  122. package/dist/better-auth/plugin/lib/payload-access.d.ts.map +1 -0
  123. package/dist/better-auth/plugin/lib/payload-access.js +1 -1
  124. package/dist/better-auth/plugin/lib/prepare-session-data.d.ts +2 -1
  125. package/dist/better-auth/plugin/lib/prepare-session-data.d.ts.map +1 -0
  126. package/dist/better-auth/plugin/lib/prepare-session-data.js +1 -1
  127. package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.d.ts +1 -0
  128. package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.d.ts.map +1 -0
  129. package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.js +1 -1
  130. package/dist/better-auth/plugin/lib/sanitize-auth-options.d.ts +1 -0
  131. package/dist/better-auth/plugin/lib/sanitize-auth-options.d.ts.map +1 -0
  132. package/dist/better-auth/plugin/lib/sanitize-auth-options.js +1 -1
  133. package/dist/better-auth/plugin/payload/components/admin-buttons.d.ts +3 -1
  134. package/dist/better-auth/plugin/payload/components/admin-buttons.d.ts.map +1 -0
  135. package/dist/better-auth/plugin/payload/components/admin-buttons.js +3 -6
  136. package/dist/better-auth/plugin/payload/components/login-redirect.d.ts +1 -0
  137. package/dist/better-auth/plugin/payload/components/login-redirect.d.ts.map +1 -0
  138. package/dist/better-auth/plugin/payload/components/login-redirect.js +1 -1
  139. package/dist/better-auth/plugin/payload/components/logo.d.ts +3 -1
  140. package/dist/better-auth/plugin/payload/components/logo.d.ts.map +1 -0
  141. package/dist/better-auth/plugin/payload/components/logo.js +1 -1
  142. package/dist/better-auth/plugin/payload/components/logout.d.ts +3 -1
  143. package/dist/better-auth/plugin/payload/components/logout.d.ts.map +1 -0
  144. package/dist/better-auth/plugin/payload/components/logout.js +1 -1
  145. package/dist/better-auth/plugin/payload/components/sign-in.d.ts +2 -1
  146. package/dist/better-auth/plugin/payload/components/sign-in.d.ts.map +1 -0
  147. package/dist/better-auth/plugin/payload/components/sign-in.js +1 -1
  148. package/dist/better-auth/plugin/payload/components/sign-up.d.ts +2 -1
  149. package/dist/better-auth/plugin/payload/components/sign-up.d.ts.map +1 -0
  150. package/dist/better-auth/plugin/payload/components/sign-up.js +2 -1
  151. package/dist/better-auth/plugin/payload/components/ui/button.d.ts +6 -5
  152. package/dist/better-auth/plugin/payload/components/ui/button.d.ts.map +1 -0
  153. package/dist/better-auth/plugin/payload/components/ui/button.js +1 -1
  154. package/dist/better-auth/plugin/payload/components/ui/card.d.ts +8 -7
  155. package/dist/better-auth/plugin/payload/components/ui/card.d.ts.map +1 -0
  156. package/dist/better-auth/plugin/payload/components/ui/card.js +1 -1
  157. package/dist/better-auth/plugin/payload/components/ui/checkbox.d.ts +2 -1
  158. package/dist/better-auth/plugin/payload/components/ui/checkbox.d.ts.map +1 -0
  159. package/dist/better-auth/plugin/payload/components/ui/checkbox.js +1 -1
  160. package/dist/better-auth/plugin/payload/components/ui/cn.d.ts +1 -0
  161. package/dist/better-auth/plugin/payload/components/ui/cn.d.ts.map +1 -0
  162. package/dist/better-auth/plugin/payload/components/ui/cn.js +1 -1
  163. package/dist/better-auth/plugin/payload/components/ui/input.d.ts +2 -1
  164. package/dist/better-auth/plugin/payload/components/ui/input.d.ts.map +1 -0
  165. package/dist/better-auth/plugin/payload/components/ui/input.js +1 -1
  166. package/dist/better-auth/plugin/payload/components/ui/label.d.ts +2 -1
  167. package/dist/better-auth/plugin/payload/components/ui/label.d.ts.map +1 -0
  168. package/dist/better-auth/plugin/payload/components/ui/label.js +1 -1
  169. package/dist/better-auth/plugin/payload/components/ui/password-input.d.ts +2 -1
  170. package/dist/better-auth/plugin/payload/components/ui/password-input.d.ts.map +1 -0
  171. package/dist/better-auth/plugin/payload/components/ui/password-input.js +1 -1
  172. package/dist/better-auth/plugin/payload/exports/client.d.ts +1 -0
  173. package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -0
  174. package/dist/better-auth/plugin/payload/exports/client.js +1 -1
  175. package/dist/better-auth/plugin/payload/exports/rsc.d.ts +1 -0
  176. package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -0
  177. package/dist/better-auth/plugin/payload/exports/rsc.js +1 -1
  178. package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts +3 -1
  179. package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts.map +1 -0
  180. package/dist/better-auth/plugin/payload/views/create-first-admin/index.js +1 -1
  181. package/dist/better-auth/plugin/payload/views/login/index.d.ts +3 -1
  182. package/dist/better-auth/plugin/payload/views/login/index.d.ts.map +1 -0
  183. package/dist/better-auth/plugin/payload/views/login/index.js +1 -1
  184. package/dist/better-auth/plugin/types.d.ts +1 -0
  185. package/dist/better-auth/plugin/types.d.ts.map +1 -0
  186. package/dist/better-auth/plugin/types.js +1 -1
  187. package/dist/better-auth/types.d.ts +1 -0
  188. package/dist/better-auth/types.d.ts.map +1 -0
  189. package/dist/better-auth/types.js +1 -1
  190. package/dist/clerk/admin-ui.d.ts +4 -0
  191. package/dist/clerk/admin-ui.d.ts.map +1 -0
  192. package/dist/clerk/admin-ui.js +5 -0
  193. package/dist/clerk/index.d.ts +7 -1
  194. package/dist/clerk/index.d.ts.map +1 -0
  195. package/dist/clerk/index.js +7 -2
  196. package/dist/clerk/plugin/auth-strategy.d.ts +11 -0
  197. package/dist/clerk/plugin/auth-strategy.d.ts.map +1 -0
  198. package/dist/clerk/plugin/auth-strategy.js +45 -0
  199. package/dist/clerk/plugin/collections/users/access.d.ts +14 -0
  200. package/dist/clerk/plugin/collections/users/access.d.ts.map +1 -0
  201. package/dist/clerk/plugin/collections/users/access.js +36 -0
  202. package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts +14 -0
  203. package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts.map +1 -0
  204. package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.js +108 -0
  205. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.d.ts +4 -0
  206. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.d.ts.map +1 -0
  207. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.js +5 -0
  208. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.d.ts +13 -0
  209. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.d.ts.map +1 -0
  210. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.js +33 -0
  211. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.d.ts +11 -0
  212. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.d.ts.map +1 -0
  213. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.js +27 -0
  214. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.d.ts +13 -0
  215. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.d.ts.map +1 -0
  216. package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.js +35 -0
  217. package/dist/clerk/plugin/collections/users/endpoints/webhook/index.d.ts +12 -0
  218. package/dist/clerk/plugin/collections/users/endpoints/webhook/index.d.ts.map +1 -0
  219. package/dist/clerk/plugin/collections/users/endpoints/webhook/index.js +86 -0
  220. package/dist/clerk/plugin/collections/users/fields.d.ts +6 -0
  221. package/dist/clerk/plugin/collections/users/fields.d.ts.map +1 -0
  222. package/dist/clerk/plugin/collections/users/fields.js +81 -0
  223. package/dist/clerk/plugin/collections/users/index.d.ts +10 -0
  224. package/dist/clerk/plugin/collections/users/index.d.ts.map +1 -0
  225. package/dist/clerk/plugin/collections/users/index.js +95 -0
  226. package/dist/clerk/plugin/components/after-login-form.d.ts +4 -0
  227. package/dist/clerk/plugin/components/after-login-form.d.ts.map +1 -0
  228. package/dist/clerk/plugin/components/after-login-form.js +65 -0
  229. package/dist/clerk/plugin/components/logout-button.d.ts +2 -0
  230. package/dist/clerk/plugin/components/logout-button.d.ts.map +1 -0
  231. package/dist/clerk/plugin/components/logout-button.js +49 -0
  232. package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts +6 -0
  233. package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts.map +1 -0
  234. package/dist/clerk/plugin/components/sync-clerk-users-button.js +75 -0
  235. package/dist/clerk/plugin.d.ts +6 -0
  236. package/dist/clerk/plugin.d.ts.map +1 -0
  237. package/dist/clerk/plugin.js +63 -0
  238. package/dist/clerk/types.d.ts +63 -0
  239. package/dist/clerk/types.d.ts.map +1 -0
  240. package/dist/clerk/types.js +3 -0
  241. package/dist/clerk/utils/clerk-user.d.ts +24 -0
  242. package/dist/clerk/utils/clerk-user.d.ts.map +1 -0
  243. package/dist/clerk/utils/clerk-user.js +47 -0
  244. package/dist/clerk/utils/index.d.ts +4 -0
  245. package/dist/clerk/utils/index.d.ts.map +1 -0
  246. package/dist/clerk/utils/index.js +5 -0
  247. package/dist/clerk/utils/load-clerk-instance.d.ts +8 -0
  248. package/dist/clerk/utils/load-clerk-instance.d.ts.map +1 -0
  249. package/dist/clerk/utils/load-clerk-instance.js +11 -0
  250. package/dist/clerk/utils/svix.d.ts +9 -0
  251. package/dist/clerk/utils/svix.d.ts.map +1 -0
  252. package/dist/clerk/utils/svix.js +40 -0
  253. package/dist/clerk/utils/user.d.ts +17 -0
  254. package/dist/clerk/utils/user.d.ts.map +1 -0
  255. package/dist/clerk/utils/user.js +46 -0
  256. package/dist/index.d.ts +5 -0
  257. package/dist/index.d.ts.map +1 -0
  258. package/dist/index.js +5 -5
  259. package/dist/kinde/index.d.ts +1 -0
  260. package/dist/kinde/index.d.ts.map +1 -0
  261. package/dist/kinde/index.js +1 -1
  262. package/package.json +39 -12
  263. package/dist/authjs/index.js.map +0 -1
  264. package/dist/better-auth/adapter/dev/bin/run.js.map +0 -1
  265. package/dist/better-auth/adapter/dev/bin/schema.js.map +0 -1
  266. package/dist/better-auth/adapter/dev/collections.js.map +0 -1
  267. package/dist/better-auth/adapter/dev/index.js.map +0 -1
  268. package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js.map +0 -1
  269. package/dist/better-auth/adapter/generate-schema/get-payload-schema.js.map +0 -1
  270. package/dist/better-auth/adapter/generate-schema/index.js.map +0 -1
  271. package/dist/better-auth/adapter/generate-schema/utils.js.map +0 -1
  272. package/dist/better-auth/adapter/index.js.map +0 -1
  273. package/dist/better-auth/adapter/test/adapter.test.js.map +0 -1
  274. package/dist/better-auth/adapter/test/better-auth-adapter-test.js.map +0 -1
  275. package/dist/better-auth/adapter/test/schema.test.js.map +0 -1
  276. package/dist/better-auth/adapter/test/test_payload1/schema.js.map +0 -1
  277. package/dist/better-auth/adapter/test/test_payload2/schema.js.map +0 -1
  278. package/dist/better-auth/adapter/test/test_payload3/schema.js.map +0 -1
  279. package/dist/better-auth/adapter/transform/index.js.map +0 -1
  280. package/dist/better-auth/adapter/types.js.map +0 -1
  281. package/dist/better-auth/index.js.map +0 -1
  282. package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.js.map +0 -1
  283. package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.js.map +0 -1
  284. package/dist/better-auth/plugin/collections/users/hooks/after-login.js.map +0 -1
  285. package/dist/better-auth/plugin/collections/users/hooks/after-logout.js.map +0 -1
  286. package/dist/better-auth/plugin/collections/users/hooks/before-login.js.map +0 -1
  287. package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.js.map +0 -1
  288. package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.js.map +0 -1
  289. package/dist/better-auth/plugin/collections/users/hooks/sync-account.js.map +0 -1
  290. package/dist/better-auth/plugin/helpers/generate-verify-email-url.js.map +0 -1
  291. package/dist/better-auth/plugin/helpers/get-ip.js.map +0 -1
  292. package/dist/better-auth/plugin/helpers/index.js.map +0 -1
  293. package/dist/better-auth/plugin/helpers/serialize-cookie.js.map +0 -1
  294. package/dist/better-auth/plugin/index.js.map +0 -1
  295. package/dist/better-auth/plugin/lib/auth-strategy.js.map +0 -1
  296. package/dist/better-auth/plugin/lib/build-collection-configs.js.map +0 -1
  297. package/dist/better-auth/plugin/lib/config.js.map +0 -1
  298. package/dist/better-auth/plugin/lib/ensure-password-set-before-create.js.map +0 -1
  299. package/dist/better-auth/plugin/lib/get-payload-auth.js.map +0 -1
  300. package/dist/better-auth/plugin/lib/get-required-collection-slugs.js.map +0 -1
  301. package/dist/better-auth/plugin/lib/init-better-auth.js.map +0 -1
  302. package/dist/better-auth/plugin/lib/password.js.map +0 -1
  303. package/dist/better-auth/plugin/lib/payload-access.js.map +0 -1
  304. package/dist/better-auth/plugin/lib/prepare-session-data.js.map +0 -1
  305. package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.js.map +0 -1
  306. package/dist/better-auth/plugin/lib/sanitize-auth-options.js.map +0 -1
  307. package/dist/better-auth/plugin/payload/components/admin-buttons.js.map +0 -1
  308. package/dist/better-auth/plugin/payload/components/login-redirect.js.map +0 -1
  309. package/dist/better-auth/plugin/payload/components/logo.js.map +0 -1
  310. package/dist/better-auth/plugin/payload/components/logout.js.map +0 -1
  311. package/dist/better-auth/plugin/payload/components/sign-in.js.map +0 -1
  312. package/dist/better-auth/plugin/payload/components/sign-up.js.map +0 -1
  313. package/dist/better-auth/plugin/payload/components/ui/button.js.map +0 -1
  314. package/dist/better-auth/plugin/payload/components/ui/card.js.map +0 -1
  315. package/dist/better-auth/plugin/payload/components/ui/checkbox.js.map +0 -1
  316. package/dist/better-auth/plugin/payload/components/ui/cn.js.map +0 -1
  317. package/dist/better-auth/plugin/payload/components/ui/input.js.map +0 -1
  318. package/dist/better-auth/plugin/payload/components/ui/label.js.map +0 -1
  319. package/dist/better-auth/plugin/payload/components/ui/password-input.js.map +0 -1
  320. package/dist/better-auth/plugin/payload/exports/client.js.map +0 -1
  321. package/dist/better-auth/plugin/payload/exports/rsc.js.map +0 -1
  322. package/dist/better-auth/plugin/payload/views/create-first-admin/index.js.map +0 -1
  323. package/dist/better-auth/plugin/payload/views/login/index.js.map +0 -1
  324. package/dist/better-auth/plugin/types.js.map +0 -1
  325. package/dist/better-auth/types.js.map +0 -1
  326. package/dist/clerk/index.js.map +0 -1
  327. package/dist/index.js.map +0 -1
  328. package/dist/kinde/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/adapter/test/schema.test.ts"],"sourcesContent":["import { describe, expect, it, test } from 'vitest'\nimport { format } from 'prettier'\nimport { getPayloadPath } from '../generate-schema/utils'\nimport { generateSchema } from '../generate-schema'\n\nconst PAYLOAD_TEST_DIR_PATH = getPayloadPath('./test/test_payload1')\nconst PAYLOAD_TEST_DIR_PATH2 = getPayloadPath('./test/test_payload2')\nconst PAYLOAD_TEST_DIR_PATH3 = getPayloadPath('./test/test_payload3')\n\ndescribe(`Handle schema generation`, async () => {\n it('should generate the correct schema with existing schema', async () => {\n const generate_schema = await generateSchema(\n {\n plugins: [\n {\n schema: {\n testTable: {\n fields: {\n hello: {\n type: 'boolean',\n required: false,\n },\n hello2: {\n type: 'string',\n required: true,\n },\n },\n },\n },\n id: 'test',\n },\n ],\n },\n {\n outputDir: PAYLOAD_TEST_DIR_PATH,\n },\n )\n\n // console.log(generate_schema);\n\n const hard_coded_schema = await format(\n `/**\n * EXAMPLE COLLECTIONS FOR BETTER AUTH\n *\n * Below is what your Payload collections should look like.\n * Please copy these to your actual collection configs.\n * Make sure to add an authStrategy for the users collection if there is one.\n *\n * Example auth strategy:\n * auth: {\n * disableLocalStrategy: true,\n * strategies: [\n * betterAuthStrategy(),\n * // Add other strategies as needed\n * ],\n * },\n */\nimport type { CollectionConfig } from \"payload\";\n\nconst User: CollectionConfig = {\n slug: \"user\",\n admin: {\n useAsTitle: \"name\",\n },\n fields: [\n {\n name: \"name\",\n type: \"text\",\n required: true,\n },\n {\n name: \"email\",\n type: \"email\",\n required: true,\n unique: true,\n },\n {\n name: \"emailVerified\",\n type: \"checkbox\",\n required: true,\n },\n {\n name: \"image\",\n type: \"upload\",\n relationTo: \"media\",\n },\n ],\n timestamps: true,\n} as const;\n\nconst Session: CollectionConfig = {\n slug: \"session\",\n admin: {\n useAsTitle: \"expiresAt\",\n },\n fields: [\n {\n name: \"expiresAt\",\n type: \"date\",\n required: true,\n },\n {\n name: \"token\",\n type: \"text\",\n required: true,\n unique: true,\n },\n {\n name: \"ipAddress\",\n type: \"text\",\n },\n {\n name: \"userAgent\",\n type: \"text\",\n },\n {\n name: \"userId\",\n type: \"relationship\",\n required: true,\n relationTo: \"user\",\n },\n ],\n timestamps: true,\n} as const;\n\nconst Account: CollectionConfig = {\n slug: \"account\",\n admin: {\n useAsTitle: \"accountId\",\n },\n fields: [\n {\n name: \"accountId\",\n type: \"text\",\n required: true,\n },\n {\n name: \"providerId\",\n type: \"text\",\n required: true,\n },\n {\n name: \"userId\",\n type: \"relationship\",\n required: true,\n relationTo: \"user\",\n },\n {\n name: \"accessToken\",\n type: \"text\",\n },\n {\n name: \"refreshToken\",\n type: \"text\",\n },\n {\n name: \"idToken\",\n type: \"text\",\n },\n {\n name: \"accessTokenExpiresAt\",\n type: \"date\",\n },\n {\n name: \"refreshTokenExpiresAt\",\n type: \"date\",\n },\n {\n name: \"scope\",\n type: \"text\",\n },\n {\n name: \"password\",\n type: \"text\",\n },\n ],\n timestamps: true,\n} as const;\n\nconst Verification: CollectionConfig = {\n slug: \"verification\",\n admin: {\n useAsTitle: \"identifier\",\n },\n fields: [\n {\n name: \"identifier\",\n type: \"text\",\n required: true,\n },\n {\n name: \"value\",\n type: \"text\",\n required: true,\n },\n {\n name: \"expiresAt\",\n type: \"date\",\n required: true,\n },\n ],\n timestamps: true,\n} as const;\n\nconst TestTable: CollectionConfig = {\n slug: \"testTable\",\n admin: {\n useAsTitle: \"hello\",\n },\n fields: [\n {\n name: \"hello\",\n type: \"checkbox\",\n },\n {\n name: \"hello2\",\n type: \"text\",\n required: true,\n },\n ],\n timestamps: true,\n} as const;\n\nexport { User, Session, Account, Verification, TestTable };\n\n`,\n { filepath: 'schema.ts' },\n )\n\n // if (generate_schema !== hard_coded_schema) {\n // console.log(`\\n\\n\\n--------------------------------- Generated:`);\n // console.log(generate_schema);\n // console.log(`--------------------------------- Hard-coded:`);\n // console.log(hard_coded_schema);\n // console.log(`---------------------------------\\n\\n\\n`);\n // }\n expect(generate_schema).toEqual(hard_coded_schema)\n })\n\n // it(\"should generate the correct schema based on multiple plugins\", async () => {\n // const generate_schema = await generateSchema(\n // {\n // plugins: [\n // {\n // schema: {\n // user: {\n // fields: {},\n // },\n // admins: {\n // fields: {},\n // },\n // },\n // id: \"test\",\n // },\n // ],\n // },\n // {\n // payload_dir_path: PAYLOAD_TEST_DIR_PATH2,\n // }\n // );\n\n // const hard_coded_schema = await format(\n // `/**\n // * EXAMPLE COLLECTIONS FOR BETTER AUTH\n // *\n // * Below is what your Payload collections should look like.\n // * Please copy these to your actual collection configs.\n // * Make sure to add an authStrategy for the users collection if there is one.\n // *\n // * Example auth strategy:\n // * auth: {\n // * disableLocalStrategy: true,\n // * strategies: [\n // * betterAuthStrategy(),\n // * // Add other strategies as needed\n // * ],\n // * },\n // */\n // import type { CollectionConfig } from \"payload\";\n\n // const User: CollectionConfig = {\n // slug: \"user\",\n // admin: {\n // useAsTitle: \"name\",\n // },\n // fields: [\n // {\n // name: \"name\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"email\",\n // type: \"email\",\n // required: true,\n // unique: true,\n // },\n // {\n // name: \"emailVerified\",\n // type: \"checkbox\",\n // required: true,\n // defaultValue: false,\n // },\n // {\n // name: \"image\",\n // type: \"upload\",\n // relationTo: \"media\",\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Session: CollectionConfig = {\n // slug: \"session\",\n // admin: {\n // useAsTitle: \"expiresAt\",\n // },\n // fields: [\n // {\n // name: \"expiresAt\",\n // type: \"date\",\n // required: true,\n // },\n // {\n // name: \"token\",\n // type: \"text\",\n // required: true,\n // unique: true,\n // },\n // {\n // name: \"ipAddress\",\n // type: \"text\",\n // },\n // {\n // name: \"userAgent\",\n // type: \"text\",\n // },\n // {\n // name: \"userId\",\n // type: \"relationship\",\n // relationTo: \"user\",\n // required: true,\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Account: CollectionConfig = {\n // slug: \"account\",\n // admin: {\n // useAsTitle: \"accountId\",\n // },\n // fields: [\n // {\n // name: \"accountId\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"providerId\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"userId\",\n // type: \"relationship\",\n // relationTo: \"user\",\n // required: true,\n // },\n // {\n // name: \"accessToken\",\n // type: \"text\",\n // },\n // {\n // name: \"refreshToken\",\n // type: \"text\",\n // },\n // {\n // name: \"idToken\",\n // type: \"text\",\n // },\n // {\n // name: \"accessTokenExpiresAt\",\n // type: \"date\",\n // },\n // {\n // name: \"refreshTokenExpiresAt\",\n // type: \"date\",\n // },\n // {\n // name: \"scope\",\n // type: \"text\",\n // },\n // {\n // name: \"password\",\n // type: \"text\",\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Verification: CollectionConfig = {\n // slug: \"verification\",\n // admin: {\n // useAsTitle: \"identifier\",\n // },\n // fields: [\n // {\n // name: \"identifier\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"value\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"expiresAt\",\n // type: \"date\",\n // required: true,\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Admins: CollectionConfig = {\n // slug: \"admins\",\n // admin: {\n // useAsTitle: \"id\",\n // },\n // fields: [],\n // timestamps: true,\n // } as const;\n\n // export { User, Session, Account, Verification, Admins };\n // `,\n // { filepath: \"schema.ts\" }\n // );\n\n // if (generate_schema !== hard_coded_schema) {\n // console.log(`\\n\\n\\n--------------------------------- Generated:`);\n // console.log(generate_schema);\n // console.log(`--------------------------------- Hard-coded:`);\n // console.log(hard_coded_schema);\n // console.log(`---------------------------------\\n\\n\\n`);\n // }\n\n // expect(generate_schema).toBe(hard_coded_schema);\n // });\n\n // it(`should generate the correct schema based on multiple different field types`, async () => {\n // const generate_schema = await generateSchema(\n // {\n // plugins: [\n // {\n // id: \"admin\",\n // schema: {\n // admin: {\n // fields: {\n // name: {\n // type: \"string\",\n // required: true,\n // },\n // id: {\n // type: \"string\",\n // required: true,\n // },\n // isAdmin: {\n // type: \"boolean\",\n // required: true,\n // },\n // status: {\n // type: \"string\",\n // required: false,\n // },\n // date: {\n // type: \"date\",\n // },\n // number: {\n // type: \"number\",\n // },\n // str_array: {\n // type: \"string[]\",\n // },\n // num_array: {\n // type: \"number[]\",\n // },\n // },\n // },\n // },\n // },\n // ],\n // },\n // {\n // payload_dir_path: PAYLOAD_TEST_DIR_PATH3,\n // }\n // );\n\n // const hard_coded_schema = await format(\n // `/**\n // * EXAMPLE COLLECTIONS FOR BETTER AUTH\n // *\n // * Below is what your Payload collections should look like.\n // * Please copy these to your actual collection configs.\n // * Make sure to add an authStrategy for the users collection if there is one.\n // *\n // * Example auth strategy:\n // * auth: {\n // * disableLocalStrategy: true,\n // * strategies: [\n // * betterAuthStrategy(),\n // * // Add other strategies as needed\n // * ],\n // * },\n // */\n // import type { CollectionConfig } from \"payload\";\n\n // const User: CollectionConfig = {\n // slug: \"user\",\n // admin: {\n // useAsTitle: \"name\",\n // },\n // fields: [\n // {\n // name: \"name\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"email\",\n // type: \"email\",\n // required: true,\n // unique: true,\n // },\n // {\n // name: \"emailVerified\",\n // type: \"checkbox\",\n // required: true,\n // defaultValue: false,\n // },\n // {\n // name: \"image\",\n // type: \"upload\",\n // relationTo: \"media\",\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Session: CollectionConfig = {\n // slug: \"session\",\n // admin: {\n // useAsTitle: \"expiresAt\",\n // },\n // fields: [\n // {\n // name: \"expiresAt\",\n // type: \"date\",\n // required: true,\n // },\n // {\n // name: \"token\",\n // type: \"text\",\n // required: true,\n // unique: true,\n // },\n // {\n // name: \"ipAddress\",\n // type: \"text\",\n // },\n // {\n // name: \"userAgent\",\n // type: \"text\",\n // },\n // {\n // name: \"userId\",\n // type: \"relationship\",\n // relationTo: \"user\",\n // required: true,\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Account: CollectionConfig = {\n // slug: \"account\",\n // admin: {\n // useAsTitle: \"accountId\",\n // },\n // fields: [\n // {\n // name: \"accountId\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"providerId\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"userId\",\n // type: \"relationship\",\n // relationTo: \"user\",\n // required: true,\n // },\n // {\n // name: \"accessToken\",\n // type: \"text\",\n // },\n // {\n // name: \"refreshToken\",\n // type: \"text\",\n // },\n // {\n // name: \"idToken\",\n // type: \"text\",\n // },\n // {\n // name: \"accessTokenExpiresAt\",\n // type: \"date\",\n // },\n // {\n // name: \"refreshTokenExpiresAt\",\n // type: \"date\",\n // },\n // {\n // name: \"scope\",\n // type: \"text\",\n // },\n // {\n // name: \"password\",\n // type: \"text\",\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Verification: CollectionConfig = {\n // slug: \"verification\",\n // admin: {\n // useAsTitle: \"identifier\",\n // },\n // fields: [\n // {\n // name: \"identifier\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"value\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"expiresAt\",\n // type: \"date\",\n // required: true,\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // const Admin: CollectionConfig = {\n // slug: \"admin\",\n // admin: {\n // useAsTitle: \"name\",\n // },\n // fields: [\n // {\n // name: \"name\",\n // type: \"text\",\n // required: true,\n // },\n // {\n // name: \"isAdmin\",\n // type: \"checkbox\",\n // required: true,\n // },\n // {\n // name: \"status\",\n // type: \"text\",\n // },\n // {\n // name: \"date\",\n // type: \"date\",\n // },\n // {\n // name: \"number\",\n // type: \"number\",\n // },\n // {\n // name: \"str_array\",\n // type: \"text\",\n // },\n // {\n // name: \"num_array\",\n // type: \"text\",\n // },\n // ],\n // timestamps: true,\n // } as const;\n\n // export { User, Session, Account, Verification, Admin };\n // `,\n // { filepath: \"schema.ts\" }\n // );\n\n // if (generate_schema !== hard_coded_schema) {\n // console.log(`\\n\\n\\n--------------------------------- Generated:`);\n // console.log(generate_schema);\n // console.log(`--------------------------------- Hard-coded:`);\n // console.log(hard_coded_schema);\n // console.log(`---------------------------------\\n\\n\\n`);\n // }\n\n // expect(generate_schema).toBe(hard_coded_schema);\n // });\n\n // test.skip(\"should support .index method after `defineTable`\", async () => {\n // const generate_schema = await generateSchema(\n // {\n // plugins: [\n // {\n // schema: {\n // testTable: {\n // fields: {},\n // },\n // },\n // id: \"test\",\n // },\n // ],\n // },\n // {\n // payload_dir_path: PAYLOAD_TEST_DIR_PATH3,\n // }\n // );\n\n // const hard_coded_schema = await format(\n // [\n // `import {defineSchema,defineTable} from \"convex/server\";`,\n // `import {v} from \"convex/values\";`,\n // ``,\n // `export default defineSchema({`,\n // default_tables,\n // `testTable: defineTable({`,\n // `}).index(\"by_something\", [\"email\"]),`,\n // `});`,\n // ].join(\"\\n\"),\n // { filepath: \"schema.ts\" }\n // );\n\n // if (generate_schema !== hard_coded_schema) {\n // console.log(`\\n\\n\\n--------------------------------- Generated:`);\n // console.log(generate_schema);\n // console.log(`--------------------------------- Hard-coded:`);\n // console.log(hard_coded_schema);\n // console.log(`---------------------------------\\n\\n\\n`);\n // }\n\n // expect(generate_schema).toBe(hard_coded_schema);\n // });\n\n // it(`should generate references correctly`, async () => {\n // const generate_schema = await generateSchema(\n // {\n // plugins: [\n // {\n // id: \"admin\",\n // schema: {\n // admin: {\n // fields: {\n // id: {\n // type: \"string\",\n // required: true,\n // },\n\n // reference_optional: {\n // type: \"string\",\n // references: {\n // field: \"something\",\n // model: \"something_else\",\n // },\n // },\n // reference_required: {\n // type: \"string\",\n // required: true,\n // references: {\n // field: \"something2\",\n // model: \"something2_else\",\n // },\n // },\n // },\n // },\n // },\n // },\n // ],\n // },\n // {\n // payload_dir_path: PAYLOAD_TEST_DIR_PATH3,\n // }\n // );\n\n // const hard_coded_schema = await format(\n // [\n // `import {defineSchema,defineTable} from \"convex/server\";`,\n // `import {v} from \"convex/values\";`,\n // ``,\n // `export default defineSchema({`,\n // default_tables,\n // `admin: defineTable({`,\n // `id: v.id(\"admin\"),`,\n // `reference_optional: v.id(\"something_else\"),`,\n // `reference_required: v.id(\"something2_else\"),`,\n // `}),`,\n // `});`,\n // ].join(\"\\n\"),\n // { filepath: \"schema.ts\" }\n // );\n\n // if (generate_schema !== hard_coded_schema) {\n // console.log(`\\n\\n\\n--------------------------------- Generated:`);\n // console.log(generate_schema);\n // console.log(`--------------------------------- Hard-coded:`);\n // console.log(hard_coded_schema);\n // console.log(`---------------------------------\\n\\n\\n`);\n // }\n // expect(generate_schema).toBe(hard_coded_schema);\n // });\n})\n"],"names":["describe","expect","it","format","getPayloadPath","generateSchema","PAYLOAD_TEST_DIR_PATH","PAYLOAD_TEST_DIR_PATH2","PAYLOAD_TEST_DIR_PATH3","generate_schema","plugins","schema","testTable","fields","hello","type","required","hello2","id","outputDir","hard_coded_schema","filepath","toEqual"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAc,SAAQ;AACnD,SAASC,MAAM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;AACrE,8CAA8C;AAC9C,cAAc;AACd,2CAA2C;AAC3C,0BAA0B;AAC1B,sCAAsC;AACtC,kDAAkD;AAClD,iBAAiB;AACjB,sBAAsB;AACtB,kCAAkC;AAClC,SAAS;AAET,mDAAmD;AACnD,2EAA2E;AAC3E,sCAAsC;AACtC,sEAAsE;AACtE,wCAAwC;AACxC,gEAAgE;AAChE,QAAQ;AAER,uDAAuD;AACvD,QAAQ;AAER,6DAA6D;AAC7D,oDAAoD;AACpD,UAAU;AACV,qBAAqB;AACrB,cAAc;AACd,2BAA2B;AAC3B,wBAAwB;AACxB,yBAAyB;AACzB,4BAA4B;AAC5B,0BAA0B;AAC1B,sCAAsC;AACtC,sCAAsC;AACtC,uBAAuB;AAEvB,0CAA0C;AAC1C,sCAAsC;AACtC,oCAAoC;AACpC,4CAA4C;AAC5C,iDAAiD;AACjD,yBAAyB;AACzB,uBAAuB;AACvB,0CAA0C;AAC1C,sCAAsC;AACtC,sCAAsC;AACtC,oCAAoC;AACpC,6CAA6C;AAC7C,kDAAkD;AAClD,yBAAyB;AACzB,uBAAuB;AACvB,qBAAqB;AACrB,mBAAmB;AACnB,iBAAiB;AACjB,eAAe;AACf,aAAa;AACb,WAAW;AACX,UAAU;AACV,oDAAoD;AACpD,UAAU;AACV,SAAS;AAET,8CAA8C;AAC9C,UAAU;AACV,qEAAqE;AACrE,8CAA8C;AAC9C,cAAc;AACd,2CAA2C;AAC3C,0BAA0B;AAC1B,kCAAkC;AAClC,gCAAgC;AAChC,yDAAyD;AACzD,0DAA0D;AAC1D,iBAAiB;AACjB,iBAAiB;AACjB,sBAAsB;AACtB,kCAAkC;AAClC,SAAS;AAET,mDAAmD;AACnD,2EAA2E;AAC3E,sCAAsC;AACtC,sEAAsE;AACtE,wCAAwC;AACxC,gEAAgE;AAChE,QAAQ;AACR,uDAAuD;AACvD,QAAQ;AACV"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/adapter/test/test_payload1/schema.ts"],"sourcesContent":["/**\n * EXAMPLE COLLECTIONS FOR BETTER AUTH\n *\n * Below is what your Payload collections should look like.\n * Please copy these to your actual collection configs.\n * Make sure to add an authStrategy for the users collection if there is one.\n *\n * Example auth strategy:\n * auth: {\n * disableLocalStrategy: true,\n * strategies: [\n * betterAuthStrategy(),\n * // Add other strategies as needed\n * ],\n * },\n */\nimport type { CollectionConfig } from 'payload'\n\nconst User: CollectionConfig = {\n slug: 'user',\n admin: {\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n },\n {\n name: 'email',\n type: 'email',\n required: true,\n unique: true,\n },\n {\n name: 'emailVerified',\n type: 'checkbox',\n required: true,\n },\n {\n name: 'image',\n type: 'upload',\n relationTo: 'media',\n },\n ],\n timestamps: true,\n} as const\n\nconst Session: CollectionConfig = {\n slug: 'session',\n admin: {\n useAsTitle: 'expiresAt',\n },\n fields: [\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n },\n {\n name: 'token',\n type: 'text',\n required: true,\n unique: true,\n },\n {\n name: 'ipAddress',\n type: 'text',\n },\n {\n name: 'userAgent',\n type: 'text',\n },\n {\n name: 'userId',\n type: 'relationship',\n required: true,\n relationTo: 'user',\n },\n ],\n timestamps: true,\n} as const\n\nconst Account: CollectionConfig = {\n slug: 'account',\n admin: {\n useAsTitle: 'accountId',\n },\n fields: [\n {\n name: 'accountId',\n type: 'text',\n required: true,\n },\n {\n name: 'providerId',\n type: 'text',\n required: true,\n },\n {\n name: 'userId',\n type: 'relationship',\n required: true,\n relationTo: 'user',\n },\n {\n name: 'accessToken',\n type: 'text',\n },\n {\n name: 'refreshToken',\n type: 'text',\n },\n {\n name: 'idToken',\n type: 'text',\n },\n {\n name: 'accessTokenExpiresAt',\n type: 'date',\n },\n {\n name: 'refreshTokenExpiresAt',\n type: 'date',\n },\n {\n name: 'scope',\n type: 'text',\n },\n {\n name: 'password',\n type: 'text',\n },\n ],\n timestamps: true,\n} as const\n\nconst Verification: CollectionConfig = {\n slug: 'verification',\n admin: {\n useAsTitle: 'identifier',\n },\n fields: [\n {\n name: 'identifier',\n type: 'text',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n },\n ],\n timestamps: true,\n} as const\n\nconst TestTable: CollectionConfig = {\n slug: 'testTable',\n admin: {\n useAsTitle: 'hello',\n },\n fields: [\n {\n name: 'hello',\n type: 'checkbox',\n },\n {\n name: 'hello2',\n type: 'text',\n required: true,\n },\n ],\n timestamps: true,\n} as const\n\nexport { User, Session, Account, Verification, TestTable }\n"],"names":["User","slug","admin","useAsTitle","fields","name","type","required","unique","relationTo","timestamps","Session","Account","Verification","TestTable"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,MAAMA,OAAyB;IAC7BC,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVC,QAAQ;QACV;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNG,YAAY;QACd;KACD;IACDC,YAAY;AACd;AAEA,MAAMC,UAA4B;IAChCV,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVC,QAAQ;QACV;QACA;YACEH,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;YACNC,UAAU;YACVE,YAAY;QACd;KACD;IACDC,YAAY;AACd;AAEA,MAAME,UAA4B;IAChCX,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVE,YAAY;QACd;QACA;YACEJ,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;KACD;IACDI,YAAY;AACd;AAEA,MAAMG,eAAiC;IACrCZ,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;KACD;IACDG,YAAY;AACd;AAEA,MAAMI,YAA8B;IAClCb,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;KACD;IACDG,YAAY;AACd;AAEA,SAASV,IAAI,EAAEW,OAAO,EAAEC,OAAO,EAAEC,YAAY,EAAEC,SAAS,GAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/adapter/test/test_payload2/schema.ts"],"sourcesContent":["/**\n * EXAMPLE COLLECTIONS FOR BETTER AUTH\n *\n * Below is what your Payload collections should look like.\n * Please copy these to your actual collection configs.\n * Make sure to add an authStrategy for the users collection if there is one.\n *\n * Example auth strategy:\n * auth: {\n * disableLocalStrategy: true,\n * strategies: [\n * betterAuthStrategy(),\n * // Add other strategies as needed\n * ],\n * },\n */\nimport type { CollectionConfig } from 'payload'\n\nconst User: CollectionConfig = {\n slug: 'user',\n admin: {\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n },\n {\n name: 'email',\n type: 'email',\n required: true,\n unique: true,\n },\n {\n name: 'emailVerified',\n type: 'checkbox',\n required: true,\n },\n {\n name: 'image',\n type: 'upload',\n relationTo: 'media',\n },\n ],\n timestamps: true,\n} as const\n\nconst Session: CollectionConfig = {\n slug: 'session',\n admin: {\n useAsTitle: 'expiresAt',\n },\n fields: [\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n },\n {\n name: 'token',\n type: 'text',\n required: true,\n unique: true,\n },\n {\n name: 'ipAddress',\n type: 'text',\n },\n {\n name: 'userAgent',\n type: 'text',\n },\n {\n name: 'userId',\n type: 'relationship',\n required: true,\n relationTo: 'user',\n },\n ],\n timestamps: true,\n} as const\n\nconst Account: CollectionConfig = {\n slug: 'account',\n admin: {\n useAsTitle: 'accountId',\n },\n fields: [\n {\n name: 'accountId',\n type: 'text',\n required: true,\n },\n {\n name: 'providerId',\n type: 'text',\n required: true,\n },\n {\n name: 'userId',\n type: 'relationship',\n required: true,\n relationTo: 'user',\n },\n {\n name: 'accessToken',\n type: 'text',\n },\n {\n name: 'refreshToken',\n type: 'text',\n },\n {\n name: 'idToken',\n type: 'text',\n },\n {\n name: 'accessTokenExpiresAt',\n type: 'date',\n },\n {\n name: 'refreshTokenExpiresAt',\n type: 'date',\n },\n {\n name: 'scope',\n type: 'text',\n },\n {\n name: 'password',\n type: 'text',\n },\n ],\n timestamps: true,\n} as const\n\nconst Verification: CollectionConfig = {\n slug: 'verification',\n admin: {\n useAsTitle: 'identifier',\n },\n fields: [\n {\n name: 'identifier',\n type: 'text',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n },\n ],\n timestamps: true,\n} as const\n\nconst Admins: CollectionConfig = {\n slug: 'admins',\n admin: {\n useAsTitle: 'id',\n },\n fields: [],\n timestamps: true,\n} as const\n\nexport { User, Session, Account, Verification, Admins }\n"],"names":["User","slug","admin","useAsTitle","fields","name","type","required","unique","relationTo","timestamps","Session","Account","Verification","Admins"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,MAAMA,OAAyB;IAC7BC,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVC,QAAQ;QACV;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNG,YAAY;QACd;KACD;IACDC,YAAY;AACd;AAEA,MAAMC,UAA4B;IAChCV,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVC,QAAQ;QACV;QACA;YACEH,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;YACNC,UAAU;YACVE,YAAY;QACd;KACD;IACDC,YAAY;AACd;AAEA,MAAME,UAA4B;IAChCX,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVE,YAAY;QACd;QACA;YACEJ,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;KACD;IACDI,YAAY;AACd;AAEA,MAAMG,eAAiC;IACrCZ,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;KACD;IACDG,YAAY;AACd;AAEA,MAAMI,SAA2B;IAC/Bb,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ,EAAE;IACVM,YAAY;AACd;AAEA,SAASV,IAAI,EAAEW,OAAO,EAAEC,OAAO,EAAEC,YAAY,EAAEC,MAAM,GAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/adapter/test/test_payload3/schema.ts"],"sourcesContent":["/**\n * EXAMPLE COLLECTIONS FOR BETTER AUTH\n *\n * Below is what your Payload collections should look like.\n * Please copy these to your actual collection configs.\n * Make sure to add an authStrategy for the users collection if there is one.\n *\n * Example auth strategy:\n * auth: {\n * disableLocalStrategy: true,\n * strategies: [\n * betterAuthStrategy(),\n * // Add other strategies as needed\n * ],\n * },\n */\nimport type { CollectionConfig } from 'payload'\n\nconst User: CollectionConfig = {\n slug: 'user',\n admin: {\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n },\n {\n name: 'email',\n type: 'email',\n required: true,\n unique: true,\n },\n {\n name: 'emailVerified',\n type: 'checkbox',\n required: true,\n },\n {\n name: 'image',\n type: 'upload',\n relationTo: 'media',\n },\n ],\n timestamps: true,\n} as const\n\nconst Session: CollectionConfig = {\n slug: 'session',\n admin: {\n useAsTitle: 'expiresAt',\n },\n fields: [\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n },\n {\n name: 'token',\n type: 'text',\n required: true,\n unique: true,\n },\n {\n name: 'ipAddress',\n type: 'text',\n },\n {\n name: 'userAgent',\n type: 'text',\n },\n {\n name: 'userId',\n type: 'relationship',\n required: true,\n relationTo: 'user',\n },\n ],\n timestamps: true,\n} as const\n\nconst Account: CollectionConfig = {\n slug: 'account',\n admin: {\n useAsTitle: 'accountId',\n },\n fields: [\n {\n name: 'accountId',\n type: 'text',\n required: true,\n },\n {\n name: 'providerId',\n type: 'text',\n required: true,\n },\n {\n name: 'userId',\n type: 'relationship',\n required: true,\n relationTo: 'user',\n },\n {\n name: 'accessToken',\n type: 'text',\n },\n {\n name: 'refreshToken',\n type: 'text',\n },\n {\n name: 'idToken',\n type: 'text',\n },\n {\n name: 'accessTokenExpiresAt',\n type: 'date',\n },\n {\n name: 'refreshTokenExpiresAt',\n type: 'date',\n },\n {\n name: 'scope',\n type: 'text',\n },\n {\n name: 'password',\n type: 'text',\n },\n ],\n timestamps: true,\n} as const\n\nconst Verification: CollectionConfig = {\n slug: 'verification',\n admin: {\n useAsTitle: 'identifier',\n },\n fields: [\n {\n name: 'identifier',\n type: 'text',\n required: true,\n },\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n },\n ],\n timestamps: true,\n} as const\n\nconst Admin: CollectionConfig = {\n slug: 'admin',\n admin: {\n useAsTitle: 'name',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n },\n {\n name: 'isAdmin',\n type: 'checkbox',\n required: true,\n },\n {\n name: 'status',\n type: 'text',\n },\n {\n name: 'date',\n type: 'date',\n },\n {\n name: 'number',\n type: 'number',\n },\n {\n name: 'str_array',\n type: 'text',\n },\n {\n name: 'num_array',\n type: 'text',\n },\n ],\n timestamps: true,\n} as const\n\nexport { User, Session, Account, Verification, Admin }\n"],"names":["User","slug","admin","useAsTitle","fields","name","type","required","unique","relationTo","timestamps","Session","Account","Verification","Admin"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,MAAMA,OAAyB;IAC7BC,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVC,QAAQ;QACV;QACA;YACEH,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNG,YAAY;QACd;KACD;IACDC,YAAY;AACd;AAEA,MAAMC,UAA4B;IAChCV,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVC,QAAQ;QACV;QACA;YACEH,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;YACNC,UAAU;YACVE,YAAY;QACd;KACD;IACDC,YAAY;AACd;AAEA,MAAME,UAA4B;IAChCX,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;YACVE,YAAY;QACd;QACA;YACEJ,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;KACD;IACDI,YAAY;AACd;AAEA,MAAMG,eAAiC;IACrCZ,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;KACD;IACDG,YAAY;AACd;AAEA,MAAMI,QAA0B;IAC9Bb,MAAM;IACNC,OAAO;QACLC,YAAY;IACd;IACAC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;YACNC,UAAU;QACZ;QACA;YACEF,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;QACA;YACED,MAAM;YACNC,MAAM;QACR;KACD;IACDI,YAAY;AACd;AAEA,SAASV,IAAI,EAAEW,OAAO,EAAEC,OAAO,EAAEC,YAAY,EAAEC,KAAK,GAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/adapter/transform/index.ts"],"sourcesContent":["import { BetterAuthError } from 'better-auth'\nimport { getAuthTables } from 'better-auth/db'\nimport type { BetterAuthOptions, Where } from 'better-auth'\nimport type { CollectionSlug, Where as PayloadWhere } from 'payload'\n\nexport const createTransform = (options: BetterAuthOptions, enableDebugLogs: boolean) => {\n const schema = getAuthTables(options)\n\n function debugLog(message: any[]) {\n if (enableDebugLogs) {\n console.log(`[payload-db-adapter]`, ...message)\n }\n }\n\n function getField(model: string, field: string) {\n if (field === 'id') {\n return field\n }\n const f = (schema as Record<string, any>)[model]?.fields[field]\n const fieldName = f?.fieldName || field\n debugLog(['getField: ', model, fieldName])\n return fieldName\n }\n\n function getModelName(model: string): CollectionSlug {\n const collection = (schema as Record<string, any>)[model]?.modelName || model\n if (!collection) {\n throw new BetterAuthError(`Model ${model} does not exist in the database.`)\n }\n return collection as CollectionSlug\n }\n\n function singleIdQuery(where: PayloadWhere) {\n if (!where || 'and' in where || 'or' in where) return null\n\n // For a single id query like { id: { equals: 15 } }\n // First, check if there's an id field in the where clause\n if ('id' in where || '_id' in where) {\n const idField = 'id' in where ? 'id' : '_id'\n const condition = where[idField]\n\n // Check if condition is an object with equals operator\n if (\n condition &&\n typeof condition === 'object' &&\n !Array.isArray(condition) &&\n 'equals' in condition\n ) {\n const value = condition.equals\n if (typeof value === 'string' || typeof value === 'number') {\n return value\n }\n }\n\n // Check for contains operator with single value\n if (\n condition &&\n typeof condition === 'object' &&\n !Array.isArray(condition) &&\n 'contains' in condition &&\n Array.isArray(condition.contains) &&\n condition.contains.length === 1\n ) {\n const value = condition.contains[0]\n if (typeof value === 'string' || typeof value === 'number') {\n return value\n }\n }\n }\n\n return null\n }\n\n function multipleIdsQuery(where: PayloadWhere) {\n if (!where || 'and' in where || 'or' in where) return null\n if ('id' in where || '_id' in where) {\n const idField = 'id' in where ? 'id' : '_id'\n const condition = where[idField]\n\n // Check if this is an 'in' operator with id field and array of values\n if (\n condition &&\n typeof condition === 'object' &&\n !Array.isArray(condition) &&\n 'in' in condition &&\n Array.isArray(condition.in) &&\n condition.in.length > 1 &&\n condition.in.every((id: unknown) => typeof id === 'string' || typeof id === 'number')\n ) {\n return condition.in as (number | string)[]\n }\n\n // Also check for contains operator with array of IDs\n if (\n condition &&\n typeof condition === 'object' &&\n !Array.isArray(condition) &&\n 'contains' in condition &&\n Array.isArray(condition.contains) &&\n condition.contains.length > 1 &&\n condition.contains.every((id: unknown) => typeof id === 'string' || typeof id === 'number')\n ) {\n return condition.contains as (number | string)[]\n }\n }\n\n return null\n }\n\n function transformInput(data: Record<string, any>, model: string, action: 'create' | 'update') {\n const transformedData: Record<string, any> = {}\n const schemaFields = (schema as Record<string, any>)[model].fields\n for (const dataField in data) {\n if (data[dataField] === undefined && action === 'update') {\n continue\n }\n const updatedFieldName = schemaFields[dataField]?.fieldName\n\n if (updatedFieldName) {\n if (\n schemaFields[dataField].type === 'string' &&\n typeof data[dataField] === 'number' &&\n updatedFieldName.endsWith('Id')\n ) {\n debugLog([\n 'Incoming data is typeof number but stored as typeof string',\n dataField,\n data[dataField].toString(),\n ])\n transformedData[updatedFieldName] = data[dataField].toString()\n } else {\n transformedData[updatedFieldName] = data[dataField]\n }\n } else {\n transformedData[dataField] = data[dataField]\n }\n }\n\n return transformedData\n }\n\n function transformOutput<T extends Record<string, any> | undefined>(doc: T): T {\n if (!doc || typeof doc !== 'object') return doc\n\n const result = { ...doc } as any\n\n // Scan for relationship fields that contain objects with IDs\n Object.entries(doc).forEach(([key, value]) => {\n // If the value is an object with an id property, it's likely a relationship\n if (value && typeof value === 'object' && 'id' in value) {\n // Create a new field with Id suffix containing just the ID\n const newKey = `${key}Id`\n result[newKey] = value.id\n\n //also remove the object and just keep the id\n result[key] = value.id\n\n // Keep the original value as well for backward compatibility\n } else if (Array.isArray(value)) {\n // Handle arrays of relationships\n if (value.length > 0 && typeof value[0] === 'object' && 'id' in value[0]) {\n const newKey = `${key}Ids`\n result[newKey] = value.map((item) => item.id)\n\n //also remove the object and just keep the id\n result[key] = value.map((item) => item.id)\n }\n }\n })\n\n // Scan for date fields and convert them to Date objects\n Object.entries(result).forEach(([key, value]) => {\n // Check if the field is a date string (ISO format)\n if (\n typeof value === 'string' &&\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z$/.test(value)\n ) {\n result[key] = new Date(value)\n } else if (\n // Also check for date-like field names\n (key.endsWith('At') || key.endsWith('Date') || key === 'date') &&\n typeof value === 'string' &&\n !isNaN(Date.parse(value))\n ) {\n result[key] = new Date(value)\n }\n })\n\n return result as T\n }\n\n function operatorToPayload(operator: string, value: any) {\n switch (operator) {\n case 'eq':\n return { equals: value }\n case 'ne':\n return { not_equals: value }\n case 'gt':\n return { greater_than: value }\n case 'gte':\n return { greater_than_equal: value }\n case 'lt':\n return { less_than: value }\n case 'lte':\n return { less_than_equal: value }\n case 'contains':\n return { contains: value }\n case 'in':\n return { in: value }\n case 'starts_with':\n return { like: `${value}%` }\n case 'ends_with':\n return { like: `%${value}` }\n default:\n return { equals: value }\n }\n }\n\n function convertWhereValue(value: any, field: string) {\n if (field === 'id' || field === '_id') {\n if (typeof value === 'object') {\n return value.id\n }\n return value\n }\n return value\n }\n\n function convertWhereClause(model: string, where?: Where[]): PayloadWhere {\n if (!where) return {}\n if (where.length === 1) {\n const w = where[0]\n if (!w) {\n return {}\n }\n\n const field = getField(model, w.field)\n const value = convertWhereValue(w.value, field)\n\n const res = {\n [field]: operatorToPayload(w.operator ?? '', value),\n }\n\n return res\n }\n const and = where.filter((w) => w.connector === 'AND' || !w.connector)\n const or = where.filter((w) => w.connector === 'OR')\n const andClause = and.map((w) => {\n const field = getField(model, w.field)\n const value = convertWhereValue(w.value, field)\n return {\n [field]: operatorToPayload(w.operator ?? '', value),\n }\n })\n const orClause = or.map((w) => {\n const field = getField(model, w.field)\n const value = convertWhereValue(w.value, field)\n return {\n [field]: operatorToPayload(w.operator ?? '', value),\n }\n })\n\n return {\n ...(andClause.length ? { AND: andClause } : {}),\n ...(orClause.length ? { OR: orClause } : {}),\n }\n }\n\n function convertSelect(model: string, select?: string[]) {\n if (!select || select.length === 0) return undefined\n return select.reduce((acc, field) => ({ ...acc, [getField(model, field)]: true }), {})\n }\n\n function convertSort(model: string, sortBy?: { field: string; direction: 'asc' | 'desc' }) {\n if (!sortBy) return undefined\n return `${sortBy.direction === 'desc' ? '-' : ''}${getField(model, sortBy.field)}`\n }\n\n return {\n getField,\n getModelName,\n singleIdQuery,\n multipleIdsQuery,\n transformInput,\n transformOutput,\n convertWhereClause,\n convertSelect,\n convertSort,\n }\n}\n"],"names":["BetterAuthError","getAuthTables","createTransform","options","enableDebugLogs","schema","debugLog","message","console","log","getField","model","field","f","fields","fieldName","getModelName","collection","modelName","singleIdQuery","where","idField","condition","Array","isArray","value","equals","contains","length","multipleIdsQuery","in","every","id","transformInput","data","action","transformedData","schemaFields","dataField","undefined","updatedFieldName","type","endsWith","toString","transformOutput","doc","result","Object","entries","forEach","key","newKey","map","item","test","Date","isNaN","parse","operatorToPayload","operator","not_equals","greater_than","greater_than_equal","less_than","less_than_equal","like","convertWhereValue","convertWhereClause","w","res","and","filter","connector","or","andClause","orClause","AND","OR","convertSelect","select","reduce","acc","convertSort","sortBy","direction"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAa;AAC7C,SAASC,aA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C,KAAK,EAAEb;YACzC,OAAO;gBACL,CAACA,MAAM,EAAE8C,kBAAkBU,EAAET,QAAQ,IAAI,IAAIlC;YAC/C;QACF;QAEA,OAAO;YACL,GAAIiD,UAAU9C,MAAM,GAAG;gBAAEgD,KAAKF;YAAU,IAAI,CAAC,CAAC;YAC9C,GAAIC,SAAS/C,MAAM,GAAG;gBAAEiD,IAAIF;YAAS,IAAI,CAAC,CAAC;QAC7C;IACF;IAEA,SAASG,cAAcnE,KAAa,EAAEoE,MAAiB;QACrD,IAAI,CAACA,UAAUA,OAAOnD,MAAM,KAAK,GAAG,OAAOW;QAC3C,OAAOwC,OAAOC,MAAM,CAAC,CAACC,KAAKrE,QAAW,CAAA;gBAAE,GAAGqE,GAAG;gBAAE,CAACvE,SAASC,OAAOC,OAAO,EAAE;YAAK,CAAA,GAAI,CAAC;IACtF;IAEA,SAASsE,YAAYvE,KAAa,EAAEwE,MAAqD;QACvF,IAAI,CAACA,QAAQ,OAAO5C;QACpB,OAAO,GAAG4C,OAAOC,SAAS,KAAK,SAAS,MAAM,KAAK1E,SAASC,OAAOwE,OAAOvE,KAAK,GAAG;IACpF;IAEA,OAAO;QACLF;QACAM;QACAG;QACAU;QACAI;QACAW;QACAuB;QACAW;QACAI;IACF;AACF,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/adapter/types.ts"],"sourcesContent":["import type { BasePayload } from \"payload\";\nimport type { AdapterInstance } from \"better-auth\";\n\nexport type PayloadAdapterOptions = {\n enableDebugLogs?: boolean;\n};\n\nexport type PayloadAdapter = (\n payloadClient: BasePayload | Promise<BasePayload> | (() => Promise<BasePayload>),\n config?: PayloadAdapterOptions\n) => AdapterInstance;\n"],"names":[],"mappings":"AAOA,WAGqB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './adapter'\nexport * from './plugin'\nexport * from './types'\nimport { payloadAdapter } from './adapter'\nimport { payloadBetterAuth } from './plugin'\n\nexport { payloadAdapter, payloadBetterAuth as betterAuthPlugin }\n"],"names":["payloadAdapter","payloadBetterAuth","betterAuthPlugin"],"mappings":"AAAA,cAAc,YAAW;AACzB,cAAc,WAAU;AACxB,cAAc,UAAS;AACvB,SAASA,cAAc,QAAQ,YAAW;AAC1C,SAASC,iBAAiB,QAAQ,WAAU;AAE5C,SAASD,cAAc,EAAEC,qBAAqBC,gBAAgB,GAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/accounts/hooks/sync-password-to-user.ts"],"sourcesContent":["import type { CollectionAfterChangeHook } from 'payload'\nimport type { CollectionHookWithBetterAuth } from '../../../types'\n\ntype CollectionAfterChangeHookWithBetterAuth =\n CollectionHookWithBetterAuth<CollectionAfterChangeHook>\n\ntype SyncPasswordToUserOptions = {\n userSlug: string\n accountSlug: string\n}\n\nexport const getSyncPasswordToUserHook = (\n options: SyncPasswordToUserOptions,\n): CollectionAfterChangeHook => {\n const hook: CollectionAfterChangeHookWithBetterAuth = async ({\n doc,\n req,\n operation,\n context,\n }) => {\n if (context?.syncAccountHook) return doc\n\n if (operation !== 'create' && operation !== 'update') {\n return doc\n }\n\n const userField = req.payload.betterAuth.options.account?.fields?.userId || 'userId'\n\n if (!doc[userField]) {\n return doc\n }\n\n const account = await req.payload.findByID({\n collection: options.accountSlug,\n id: doc.id,\n depth: 0,\n req,\n showHiddenFields: true,\n })\n\n if (!account || !account.password) {\n return doc\n }\n\n const [salt, hash] = account.password.split(':')\n\n if (!salt || !hash) {\n return doc\n }\n\n const userId = typeof doc[userField] === 'string' ? doc[userField] : doc[userField]?.id\n\n try {\n await req.payload.update({\n collection: options.userSlug,\n id: userId,\n data: {\n salt,\n hash,\n },\n req,\n context: { syncPasswordToUser: true },\n })\n } catch (error) {\n console.error('Failed to sync password to user:', error)\n }\n\n return doc\n }\n\n return hook as CollectionAfterChangeHook\n}\n"],"names":["getSyncPasswordToUserHook","options","hook","doc","req","operation","context","syncAccountHook","userField","payload","betterAuth","account","fields","userId","findByID","collection","accountSlug","id","depth","showHiddenFields","password","salt","hash","split","update","userSlug","data","syncPasswordToUser","error","console"],"mappings":"AAWA,OAAO,MAAMA,4BAA4B,CACvCC;IAEA,MAAMC,OAAgD,OAAO,EAC3DC,GAAG,EACHC,GAAG,EACHC,SAAS,EACTC,OAAO,EACR;QACC,IAAIA,SAASC,iBAAiB,OAAOJ;QAErC,IAAIE,cAAc,YAAYA,cAAc,UAAU;YACpD,OAAOF;QACT;QAEA,MAAMK,YAAYJ,IAAIK,OAAO,CAACC,UAAU,CAACT,OAAO,CAACU,OAAO,EAAEC,QAAQC,UAAU;QAE5E,IAAI,CAACV,GAAG,CAACK,UAAU,EAAE;YACnB,OAAOL;QACT;QAEA,MAAMQ,UAAU,MAAMP,IAAIK,OAAO,CAACK,QAAQ,CAAC;YACzCC,YAAYd,QAAQe,WAAW;YAC/BC,IAAId,IAAIc,EAAE;YACVC,OAAO;YACPd;YACAe,kBAAkB;QACpB;QAEA,IAAI,CAACR,WAAW,CAACA,QAAQS,QAAQ,EAAE;YACjC,OAAOjB;QACT;QAEA,MAAM,CAACkB,MAAMC,KAAK,GAAGX,QAAQS,QAAQ,CAACG,KAAK,CAAC;QAE5C,IAAI,CAACF,QAAQ,CAACC,MAAM;YAClB,OAAOnB;QACT;QAEA,MAAMU,SAAS,OAAOV,GAAG,CAACK,UAAU,KAAK,WAAWL,GAAG,CAACK,UAAU,GAAGL,GAAG,CAACK,UAAU,EAAES;QAErF,IAAI;YACF,MAAMb,IAAIK,OAAO,CAACe,MAAM,CAAC;gBACvBT,YAAYd,QAAQwB,QAAQ;gBAC5BR,IAAIJ;gBACJa,MAAM;oBACJL;oBACAC;gBACF;gBACAlB;gBACAE,SAAS;oBAAEqB,oBAAoB;gBAAK;YACtC;QACF,EAAE,OAAOC,OAAO;YACdC,QAAQD,KAAK,CAAC,oCAAoCA;QACpD;QAEA,OAAOzB;IACT;IAEA,OAAOD;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/users/endpoints/refresh-token.ts"],"sourcesContent":["import { setCookieCache } from 'better-auth/cookies'\nimport { CollectionSlug, type Endpoint, getFieldsToSign, refreshOperation, User } from 'payload'\nimport { GenericEndpointContext } from 'better-auth/types'\nimport { EndpointWithBetterAuth } from '../../../types'\nimport { getPayloadAuth } from '../../../lib/get-payload-auth'\n\ntype RefreshTokenEndpointOptions = {\n userSlug: CollectionSlug\n}\n\nexport const getRefreshTokenEndpoint = (options?: RefreshTokenEndpointOptions): Endpoint => {\n const userSlug = options?.userSlug\n\n const endpoint: EndpointWithBetterAuth = {\n path: '/refresh-token',\n method: 'post',\n handler: async (req) => {\n const payload = await getPayloadAuth(req.payload.config)\n const betterAuth = payload.betterAuth\n const authContext = await betterAuth?.$context\n const userCollection = payload.collections[userSlug as CollectionSlug]\n\n if (!betterAuth || !authContext) {\n return new Response(JSON.stringify({ message: 'BetterAuth not initialized' }), {\n status: 500,\n })\n }\n\n const sessionTokenName = authContext.authCookies.sessionToken.name\n const cookieHeader = req.headers.get('cookie') || ''\n const hasSessionToken = cookieHeader.includes(`${sessionTokenName}=`)\n\n if (!hasSessionToken) {\n try {\n const result = await refreshOperation({ collection: userCollection, req })\n return new Response(JSON.stringify(result), { status: 200 })\n } catch (error) {\n console.error('Token refresh failed:', error)\n return new Response(JSON.stringify({ message: 'Token refresh failed' }), { status: 401 })\n }\n }\n\n // @ts-ignore - @TODO, fix type of .api\n const session = await betterAuth.api.getSession({\n headers: req.headers,\n query: { disableCookieCache: true },\n })\n\n if (!session?.session?.userId) {\n return new Response(JSON.stringify({ message: 'No user in session' }), { status: 401 })\n }\n\n const user = await payload.findByID({\n collection: userSlug as string,\n id: session.session.userId,\n })\n\n if (!user) {\n return new Response(JSON.stringify({ message: 'No user found' }), { status: 401 })\n }\n\n const cookieCacheFields = getFieldsToSign({\n collectionConfig: userCollection.config,\n email: user.email,\n user: user as User,\n })\n\n const responseData = {\n refreshedToken: null,\n setCookie: !!authContext.options.session?.cookieCache?.enabled,\n strategy: 'better-auth',\n user: { ...user, collection: userSlug },\n }\n\n const response = new Response(JSON.stringify(responseData), {\n status: 200,\n })\n\n const ctx = {\n context: authContext,\n setCookie(name, value, options) {\n const path = options?.path || '/'\n const maxAge = options?.maxAge ? `; Max-Age=${options.maxAge}` : ''\n const httpOnly = options?.httpOnly ? '; HttpOnly' : ''\n const secure = options?.secure ? '; Secure' : ''\n const sameSite = options?.sameSite ? `; SameSite=${options.sameSite}` : '; SameSite=Lax'\n\n response.headers.set(\n 'Set-Cookie',\n `${name}=${value}; Path=${path}${maxAge}${httpOnly}${secure}${sameSite}`,\n )\n return name\n },\n } as GenericEndpointContext\n\n await setCookieCache(ctx, {\n session: session.session,\n user: cookieCacheFields as any,\n })\n\n return response\n },\n }\n\n return endpoint as unknown as Endpoint\n}\n"],"names":["setCookieCache","getFieldsToSign","refreshOperation","getPayloadAuth","getRefreshTokenEndpoint","options","userSlug","endpoint","path","method","handler","req","payload","config","betterAuth","authContext","$context","userCollection","collections","Response","JSON","stringify","message","status","sessionTokenName","authCookies","sessionToken","name","cookieHeader","headers","get","hasSessionToken","includes","result","collection","error","console","session","api","getSession","query","disableCookieCache","userId","user","findByID","id","cookieCacheFields","collectionConfig","email","responseData","refreshedToken","setCookie","cookieCache","enabled","strategy","response","ctx","context","value","maxAge","httpOnly","secure","sameSite","set"],"mappings":"AAAA,SAASA,cAAc,QAAQ,sBAAqB;AACpD,SAAwCC,eAAe,EAAEC,gBAAgB,QAAc,UAAS;AAGhG,SAASC,cAAc,QAAQ,gCAA+B;AAM9D,OAAO,MAAMC,0BAA0B,CAACC;IACtC,MAAMC,WAAWD,SAASC;IAE1B,MAAMC,WAAmC;QACvCC,MAAM;QACNC,QAAQ;QACRC,SAAS,OAAOC;YACd,MAAMC,UAAU,MAAMT,eAAeQ,IAAIC,OAAO,CAACC,MAAM;YACvD,MAAMC,aAAaF,QAAQE,UAAU;YACrC,MAAMC,cAAc,MAAMD,YA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EC,SAAS;gBAAgB,IAAI;oBAAEC,QAAQ;gBAAI;YAClF;YAEA,MAAMuB,oBAAoB7C,gBAAgB;gBACxC8C,kBAAkB9B,eAAeJ,MAAM;gBACvCmC,OAAOL,KAAKK,KAAK;gBACjBL,MAAMA;YACR;YAEA,MAAMM,eAAe;gBACnBC,gBAAgB;gBAChBC,WAAW,CAAC,CAACpC,YAAYV,OAAO,CAACgC,OAAO,EAAEe,aAAaC;gBACvDC,UAAU;gBACVX,MAAM;oBAAE,GAAGA,IAAI;oBAAET,YAAY5B;gBAAS;YACxC;YAEA,MAAMiD,WAAW,IAAIpC,SAASC,KAAKC,SAAS,CAAC4B,eAAe;gBAC1D1B,QAAQ;YACV;YAEA,MAAMiC,MAAM;gBACVC,SAAS1C;gBACToC,WAAUxB,IAAI,EAAE+B,KAAK,EAAErD,OAAO;oBAC5B,MAAMG,OAAOH,SAASG,QAAQ;oBAC9B,MAAMmD,SAAStD,SAASsD,SAAS,CAAC,UAAU,EAAEtD,QAAQsD,MAAM,EAAE,GAAG;oBACjE,MAAMC,WAAWvD,SAASuD,WAAW,eAAe;oBACpD,MAAMC,SAASxD,SAASwD,SAAS,aAAa;oBAC9C,MAAMC,WAAWzD,SAASyD,WAAW,CAAC,WAAW,EAAEzD,QAAQyD,QAAQ,EAAE,GAAG;oBAExEP,SAAS1B,OAAO,CAACkC,GAAG,CAClB,cACA,GAAGpC,KAAK,CAAC,EAAE+B,MAAM,OAAO,EAAElD,OAAOmD,SAASC,WAAWC,SAASC,UAAU;oBAE1E,OAAOnC;gBACT;YACF;YAEA,MAAM3B,eAAewD,KAAK;gBACxBnB,SAASA,QAAQA,OAAO;gBACxBM,MAAMG;YACR;YAEA,OAAOS;QACT;IACF;IAEA,OAAOhD;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/users/hooks/after-login.ts"],"sourcesContent":["import { generateId, Session } from 'better-auth'\nimport { createAuthMiddleware } from 'better-auth/api'\nimport { setCookieCache } from 'better-auth/cookies'\nimport { parseSetCookie, type ResponseCookie } from 'next/dist/compiled/@edge-runtime/cookies'\nimport { cookies } from 'next/headers'\nimport { CollectionAfterLoginHook } from 'payload'\nimport { getPayloadAuth } from '../../../lib/get-payload-auth'\nimport { getIp } from '../../../helpers/get-ip'\nimport { prepareSessionData } from '../../../lib/prepare-session-data'\n\ntype AfterLoginOptions = {\n usersCollectionSlug: string\n sessionsCollectionSlug: string\n}\n\n/**\n * This hook is used to sync the admin login token with better-auth session token\n * It also creates a new session in better-auth\n */\nexport const getAfterLoginHook = (options: AfterLoginOptions): CollectionAfterLoginHook => {\n const hook: CollectionAfterLoginHook = async ({ collection, context, req, token, user }) => {\n const config = req.payload.config\n const payload = await getPayloadAuth(config)\n const cookieStore = await cookies()\n const authContext = await payload.betterAuth.$context\n\n const sessionExpiration = payload.betterAuth.options.session?.expiresIn || 60 * 60 * 24 * 7 // 7 days\n // we can't use internal adapter as we can cause a race condition unless we pass req to the payload.create\n const session = (await payload.create({\n collection: options.sessionsCollectionSlug,\n data: {\n ipAddress: getIp(req.headers, payload.betterAuth.options) || '',\n userAgent: req.headers?.get('user-agent') || '',\n user: user.id,\n token: generateId(32),\n expiresAt: new Date(Date.now() + sessionExpiration * 1000),\n },\n req,\n })) as Session\n\n const betterAuthHandleRequest = createAuthMiddleware(async (ctx): Promise<Headers | null> => {\n ctx.context = { ...authContext, user: user }\n await ctx.setSignedCookie(\n ctx.context.authCookies.sessionToken.name,\n session.token,\n ctx.context.secret,\n ctx.context.authCookies.sessionToken.options,\n )\n const filteredSessionData = await prepareSessionData({\n newSession: { session, user },\n payloadConfig: config,\n collectionSlugs: {\n userCollectionSlug: options.usersCollectionSlug,\n sessionCollectionSlug: options.sessionsCollectionSlug,\n },\n })\n await setCookieCache(ctx, filteredSessionData as any)\n if ('responseHeaders' in ctx) {\n return ctx.responseHeaders as Headers\n }\n return null\n })\n\n const responseHeaders = await betterAuthHandleRequest(req)\n const responseCookies = responseHeaders\n ?.getSetCookie()\n .map((cookie) => parseSetCookie(cookie))\n .filter(Boolean) as ResponseCookie[]\n\n if (responseCookies) {\n for (const cookieData of responseCookies) {\n const { name, value, ...options } = cookieData\n cookieStore.set({\n ...options,\n name,\n value: decodeURIComponent(value),\n })\n }\n }\n }\n\n return hook as CollectionAfterLoginHook\n}\n"],"names":["generateId","createAuthMiddleware","setCookieCache","parseSetCookie","cookies","getPayloadAuth","getIp","prepareSessionData","getAfterLoginHook","options","hook","collection","context","req","token","user","config","payload","cookieStore","authContext","betterAuth","$context","sessionExpiration","session","expiresIn","create","sessionsCollectionSlug","data","ipAddress","headers","userAgent","get","id","expiresAt","Date","now","betterAuthHandleRequest","ctx","setSignedCookie","authCookies","sessionToken","name","secret","filteredSessionData","newSession","payloadConfig","collectionSlugs","userCollectionSlug","usersCollectionSlug","sessionCollectionSlug","responseHeaders","responseCookies","getSetCookie","map","cookie","filter","Boolean","cookieData","value","set","decodeURIComponent"],"mappings":"AAAA,SAASA,UAAU,QAAiB,cAAa;AACjD,SAASC,oBAAoB,QAAQ,kBAAiB;AACtD,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,cAAc,QAA6B,2CAA0C;AAC9F,SAASC,OAAO,QAAQ,eAAc;AAEtC,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASC,KAAK,QAAQ,0BAAyB;AAC/C,SAASC,kBAAkB,QAAQ,oCAAmC;AAOtE;;;CAGC,GACD,OAAO,MAAMC,oBAAoB,CAACC;IAChC,MAAMC,OAAiC,OAAO,EAAEC,UAAU,EAAEC,OAAO,EAAEC,GAAG,EAAEC,KAAK,EAAEC,IAAI,EAAE;QACrF,MAAMC,SAASH,IAAII,OAAO,CAACD,MAAM;QACjC,MAAMC,UAAU,MAAMZ,eAAeW;QACrC,MAAME,cAAc,MAAMd;QAC1B,MAAMe,cAAc,MAAMF,QAAQG,UAAU,CAACC,QAAQ;QAErD,MAAMC,oBAAoBL,QAAQG,UAAU,CAACX,OAAO,CAAC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BACxC,MAAM,EAAEV,IAAI,EAAEiB,KAAK,EAAE,GAAGjD,SAAS,GAAGgD;gBACpCvC,YAAYyC,GAAG,CAAC;oBACd,GAAGlD,OAAO;oBACVgC;oBACAiB,OAAOE,mBAAmBF;gBAC5B;YACF;QACF;IACF;IAEA,OAAOhD;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/users/hooks/after-logout.ts"],"sourcesContent":["import { cookies } from 'next/headers'\nimport type { CollectionAfterLogoutHook } from 'payload'\nimport type { CollectionHookWithBetterAuth } from '../../../types'\nimport { getPayloadAuth } from '../../../lib/get-payload-auth'\n\ntype CollectionAfterLogoutHookWithBetterAuth =\n CollectionHookWithBetterAuth<CollectionAfterLogoutHook>\n\ntype AfterLogoutOptions = {\n sessionsCollectionSlug: string\n}\n\nexport const getAfterLogoutHook = (options: AfterLogoutOptions): CollectionAfterLogoutHook => {\n const hook: CollectionAfterLogoutHookWithBetterAuth = async ({ req }) => {\n const cookieStore = await cookies()\n const payload = await getPayloadAuth(req.payload.config)\n const authContext = await payload.betterAuth.$context\n const sessionTokenName = authContext.authCookies.sessionToken.name\n\n const sessionDataName = authContext.authCookies.sessionData.name\n const dontRememberTokenName = authContext.authCookies.dontRememberToken.name\n\n const sessionCookieValue = cookieStore.get(sessionTokenName)?.value\n if (sessionCookieValue) {\n const payload = req.payload\n const [token] = sessionCookieValue.split('.')\n const { docs: sessions } = await payload.find({\n collection: options.sessionsCollectionSlug,\n where: {\n token: { equals: token },\n },\n limit: 1,\n })\n const session = sessions.at(0)\n if (session) {\n await payload.delete({\n collection: options.sessionsCollectionSlug,\n id: session.id,\n })\n }\n }\n\n const baseMultiSessionName = sessionTokenName + '_multi'\n const multiSessionCookies = cookieStore.getAll()\n multiSessionCookies.forEach((cookie) => {\n if (cookie.name.startsWith(baseMultiSessionName)) {\n cookieStore.delete(cookie.name)\n }\n })\n\n //TODO: this is a hack to delete the admin session cookie\n // we need to find a better way to do this (BETTER AUTH HARDCODED THIS)\n cookieStore.delete('admin_session')\n\n cookieStore.delete(sessionTokenName)\n cookieStore.delete(sessionDataName)\n cookieStore.delete(dontRememberTokenName)\n }\n\n return hook as CollectionAfterLogoutHook\n}\n"],"names":["cookies","getPayloadAuth","getAfterLogoutHook","options","hook","req","cookieStore","payload","config","authContext","betterAuth","$context","sessionTokenName","authCookies","sessionToken","name","sessionDataName","sessionData","dontRememberTokenName","dontRememberToken","sessionCookieValue","get","value","token","split","docs","sessions","find","collection","sessionsCollectionSlug","where","equals","limit","session","at","delete","id","baseMultiSessionName","multiSessionCookies","getAll","forEach","cookie","startsWith"],"mappings":"AAAA,SAASA,OAAO,QAAQ,eAAc;AAGtC,SAASC,cAAc,QAAQ,gCAA+B;AAS9D,OAAO,MAAMC,qBAAqB,CAACC;IACjC,MAAMC,OAAgD,OAAO,EAAEC,GAAG,EAAE;QAClE,MAAMC,cAAc,MAAMN;QAC1B,MAAMO,UAAU,MAAMN,eAAeI,IAAIE,OAAO,CAACC,MAAM;QACvD,MAAMC,cAAc,MAAMF,QAAQG,UAAU,CAACC,QAAQ;QACrD,MAAMC,mBAAmBH,YAAYI,WAAW,CAACC,YAAY,CAACC,IAAI;QAElE,MAAMC,kBAAkBP,YAAYI,WAAW,CAACI,WAAW,CAACF,IAAI;QAChE,MAAMG,wBAAwBT,YAAYI,WAAW,CAACM,iBAAiB,CAACJ,IAAI;QAE5E,MAAMK,qBAAqBd,YAAYe,GAAG,CAACT,mBAAmBU;QAC9D,IAAIF,oBAAoB;YACtB,MAAMb,UAAUF,IAAIE,OAAO;YAC3B,MAAM,CAACgB,MAAM,GAAGH,mBAAmBI,KAAK,CAAC;YACzC,MAAM,EAAEC,MAAMC,QAAQ,EAAE,GAAG,MAAMnB,QAAQoB,IAAI,CAAC;gBAC5CC,YAAYzB,QAAQ0B,sBAAsB;gBAC1CC,OAAO;oBACLP,OAAO;wBAAEQ,QAAQR;oBAAM;gBACzB;gBACAS,OAAO;YACT;YACA,MAAMC,UAAUP,SAASQ,EAAE,CAAC;YAC5B,IAAID,SAAS;gBACX,MAAM1B,QAAQ4B,MAAM,CAAC;oBACnBP,YAAYzB,QAAQ0B,sBAAsB;oBAC1CO,IAAIH,QAAQG,EAAE;gBAChB;YACF;QACF;QAEA,MAAMC,uBAAuBzB,mBAAmB;QAChD,MAAM0B,sBAAsBhC,YAAYiC,MAAM;QAC9CD,oBAAoBE,OAAO,CAAC,CAACC;YAC3B,IAAIA,OAAO1B,IAAI,CAAC2B,UAAU,CAACL,uBAAuB;gBAChD/B,YAAY6B,MAAM,CAACM,OAAO1B,IAAI;YAChC;QACF;QAEA,yDAAyD;QACzD,uEAAuE;QACvET,YAAY6B,MAAM,CAAC;QAEnB7B,YAAY6B,MAAM,CAACvB;QACnBN,YAAY6B,MAAM,CAACnB;QACnBV,YAAY6B,MAAM,CAACjB;IACrB;IAEA,OAAOd;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/users/hooks/before-login.ts"],"sourcesContent":["import { APIError, CollectionBeforeLoginHook } from 'payload'\nimport { getPayloadAuth } from '../../../lib/get-payload-auth'\n\n/**\n * This hook blocks login attempts if email verification is required and the user's email is not verified\n */\nexport const getBeforeLoginHook = (): CollectionBeforeLoginHook => {\n const hook: CollectionBeforeLoginHook = async ({ req, user }) => {\n const config = req.payload.config\n const payload = await getPayloadAuth(config)\n\n const requireEmailVerification =\n payload.betterAuth.options.emailAndPassword?.requireEmailVerification ?? false\n\n if (requireEmailVerification && !user.emailVerified) {\n throw new APIError(\n 'Email verification required. Please verify your email before logging in.',\n 403,\n )\n }\n\n return user\n }\n\n return hook\n}\n"],"names":["APIError","getPayloadAuth","getBeforeLoginHook","hook","req","user","config","payload","requireEmailVerification","betterAuth","options","emailAndPassword","emailVerified"],"mappings":"AAAA,SAASA,QAAQ,QAAmC,UAAS;AAC7D,SAASC,cAAc,QAAQ,gCAA+B;AAE9D;;CAEC,GACD,OAAO,MAAMC,qBAAqB;IAChC,MAAMC,OAAkC,OAAO,EAAEC,GAAG,EAAEC,IAAI,EAAE;QAC1D,MAAMC,SAASF,IAAIG,OAAO,CAACD,MAAM;QACjC,MAAMC,UAAU,MAAMN,eAAeK;QAErC,MAAME,2BACJD,QAAQE,UAAU,CAACC,OAAO,CAACC,gBAAgB,EAAEH,4BAA4B;QAE3E,IAAIA,4BAA4B,CAACH,KAAKO,aAAa,EAAE;YACnD,MAAM,IAAIZ,SACR,4EACA;QAEJ;QAEA,OAAOK;IACT;IAEA,OAAOF;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/users/hooks/clean-up-user-after-delete.ts"],"sourcesContent":["import type { CollectionAfterDeleteHook } from 'payload'\nimport type { CollectionHookWithBetterAuth } from '../../../types'\n\ntype CollectionAfterDeleteHookWithBetterAuth =\n CollectionHookWithBetterAuth<CollectionAfterDeleteHook>\n\nexport const cleanUpUserAfterDelete: CollectionAfterDeleteHookWithBetterAuth = async ({\n doc,\n req,\n}) => {\n try {\n const { payload } = req\n const betterAuthContext = await payload.betterAuth.$context\n const userId = doc.id\n const beforeDelete = betterAuthContext.options.user?.deleteUser?.beforeDelete\n if (typeof beforeDelete === 'function') {\n await beforeDelete(doc, req as Request)\n }\n await betterAuthContext.internalAdapter.deleteSessions(userId)\n await betterAuthContext.internalAdapter.deleteAccounts(userId)\n if (payload.collections.verifications) {\n await payload.delete({\n collection: payload.collections.verifications.config.slug,\n where: {\n value: {\n like: `\"${userId}\"`,\n },\n },\n })\n }\n const afterDelete = betterAuthContext.options.user?.deleteUser?.afterDelete\n if (typeof afterDelete === 'function') {\n await afterDelete(doc, req as Request)\n }\n return doc\n } catch (error) {\n console.error('Error in user afterDelete hook:', error)\n return doc\n }\n}\n"],"names":["cleanUpUserAfterDelete","doc","req","payload","betterAuthContext","betterAuth","$context","userId","id","beforeDelete","options","user","deleteUser","internalAdapter","deleteSessions","deleteAccounts","collections","verifications","delete","collection","config","slug","where","value","like","afterDelete","error","console"],"mappings":"AAMA,OAAO,MAAMA,yBAAkE,OAAO,EACpFC,GAAG,EACHC,GAAG,EACJ;IACC,IAAI;QACF,MAAM,EAAEC,OAAO,EAAE,GAAGD;QACpB,MAAME,oBAAoB,MAAMD,QAAQE,UAAU,CAACC,QAAQ;QAC3D,MAAMC,SAASN,IAAIO,EAAE;QACrB,MAAMC,eAAeL,kBAAkBM,OAAO,CAACC,IAAI,EAAEC,YAAYH;QACjE,IAAI,OAAOA,iBAAiB,YAAY;YACtC,MAAMA,aAAaR,KAAKC;QAC1B;QACA,MAAME,kBAAkBS,eAAe,CAACC,cAAc,CAACP;QACvD,MAAMH,kBAAkBS,eAAe,CAACE,cAAc,CAACR;QACvD,IAAIJ,QAAQa,WAAW,CAACC,aAAa,EAAE;YACrC,MAAMd,QAAQe,MAAM,CAAC;gBACnBC,YAAYhB,QAAQa,WAAW,CAACC,aAAa,CAACG,MAAM,CAACC,IAAI;gBACzDC,OAAO;oBACLC,OAAO;wBACLC,MAAM,CAAC,CAAC,EAAEjB,OAAO,CAAC,CAAC;oBACrB;gBACF;YACF;QACF;QACA,MAAMkB,cAAcrB,kBAAkBM,OAAO,CAACC,IAAI,EAAEC,YAAYa;QAChE,IAAI,OAAOA,gBAAgB,YAAY;YACrC,MAAMA,YAAYxB,KAAKC;QACzB;QACA,OAAOD;IACT,EAAE,OAAOyB,OAAO;QACdC,QAAQD,KAAK,CAAC,mCAAmCA;QACjD,OAAOzB;IACT;AACF,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/users/hooks/on-verified-change.ts"],"sourcesContent":["import { CollectionBeforeChangeHook } from 'payload'\n\nexport const onVerifiedChange: CollectionBeforeChangeHook = async ({ data, originalDoc }) => {\n const isVerifiedChangingToTrue = Boolean(data._verified) && !Boolean(originalDoc?._verified)\n const isEmailVerifiedChangingToTrue =\n Boolean(data.emailVerified) && !Boolean(originalDoc?.emailVerified)\n\n if (!isVerifiedChangingToTrue && !isEmailVerifiedChangingToTrue) {\n return data\n }\n\n return {\n ...data,\n _verified: true,\n emailVerified: true,\n }\n}\n"],"names":["onVerifiedChange","data","originalDoc","isVerifiedChangingToTrue","Boolean","_verified","isEmailVerifiedChangingToTrue","emailVerified"],"mappings":"AAEA,OAAO,MAAMA,mBAA+C,OAAO,EAAEC,IAAI,EAAEC,WAAW,EAAE;IACtF,MAAMC,2BAA2BC,QAAQH,KAAKI,SAAS,KAAK,CAACD,QAAQF,aAAaG;IAClF,MAAMC,gCACJF,QAAQH,KAAKM,aAAa,KAAK,CAACH,QAAQF,aAAaK;IAEvD,IAAI,CAACJ,4BAA4B,CAACG,+BAA+B;QAC/D,OAAOL;IACT;IAEA,OAAO;QACL,GAAGA,IAAI;QACPI,WAAW;QACXE,eAAe;IACjB;AACF,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/plugin/collections/users/hooks/sync-account.ts"],"sourcesContent":["import type { CollectionAfterChangeHook } from 'payload'\nimport type { CollectionHookWithBetterAuth } from '../../../types'\nimport { BETTER_AUTH_CONTEXT_KEY } from 'payload-auth/better-auth/adapter'\n\ntype CollectionAfterChangeHookWithBetterAuth =\n CollectionHookWithBetterAuth<CollectionAfterChangeHook>\n\ntype SyncAccountOptions = {\n userSlug: string\n accountSlug: string\n}\n\nexport const getSyncAccountHook = (options: SyncAccountOptions): CollectionAfterChangeHook => {\n const hook: CollectionAfterChangeHookWithBetterAuth = async ({\n doc,\n req,\n operation,\n context,\n }) => {\n if (context?.syncPasswordToUser) return doc\n\n if (operation !== 'create' && operation !== 'update') return doc\n\n const user = await req.payload.findByID({\n collection: options.userSlug,\n id: doc.id,\n depth: 0,\n req,\n showHiddenFields: true,\n })\n\n if (!user || !user.hash || !user.salt) return doc\n\n const passwordValue = `${user.salt}:${user.hash}`\n const userField = req.payload.betterAuth.options.account?.fields?.userId || 'userId'\n\n if (operation === 'create' && !(BETTER_AUTH_CONTEXT_KEY in context)) {\n try {\n await req.payload.create({\n collection: options.accountSlug,\n data: {\n [userField]: doc.id,\n accountId: doc.id.toString(),\n providerId: 'credential',\n password: passwordValue,\n context: { syncAccountHook: true },\n },\n req,\n })\n } catch (error) {\n console.error('Failed to create account for user:', error)\n }\n }\n\n if (operation === 'update') {\n try {\n const accounts = await req.payload.find({\n collection: options.accountSlug,\n where: {\n and: [{ [userField]: { equals: doc.id } }, { providerId: { equals: 'credential' } }],\n },\n req,\n depth: 0,\n context: { syncAccountHook: true },\n })\n\n const account = accounts.docs.at(0)\n if (account) {\n await req.payload.update({\n collection: options.accountSlug,\n id: account.id,\n data: {\n password: passwordValue,\n },\n req,\n context: { syncAccountHook: true },\n })\n }\n } catch (error) {\n console.error('Failed to sync hash/salt to account:', error)\n }\n }\n\n return doc\n }\n\n return hook as CollectionAfterChangeHook\n}\n"],"names":["BETTER_AUTH_CONTEXT_KEY","getSyncAccountHook","options","hook","doc","req","operation","context","syncPasswordToUser","user","payload","findByID","collection","userSlug","id","depth","showHiddenFields","hash","salt","passwordValue","userField","betterAuth","account","fields","userId","create","accountSlug","data","accountId","toString","providerId","password","syncAccountHook","error","console","accounts","find","where","and","equals","docs","at","update"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ,mCAAkC;AAU1E,OAAO,MAAMC,qBAAqB,CAACC;IACjC,MAAMC,OAAgD,OAAO,EAC3DC,GAAG,EACHC,GAAG,EACHC,SAAS,EACTC,OAAO,EACR;QACC,IAAIA,SAASC,oBAAoB,OAAOJ;QAExC,IAAIE,cAAc,YAAYA,cAAc,UAAU,OAAOF;QAE7D,MAAMK,OAAO,MAAMJ,IAAIK,OAAO,CAACC,QAAQ,CAAC;YACtCC,YAAYV,QAAQW,QAAQ;YAC5BC,IAAIV,IAAIU,EAAE;YACVC,OAAO;YACPV;YACAW,kBAAkB;QACpB;QAEA,IAAI,CAACP,QAAQ,CAACA,KAAKQ,IAAI,IAAI,CAACR,KAAKS,IAAI,EAAE,OAAOd;QAE9C,MAAMe,gBAAgB,GAA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,OAAO;gBACdC,QAAQD,KAAK,CAAC,wCAAwCA;YACxD;QACF;QAEA,OAAO7B;IACT;IAEA,OAAOD;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/plugin/helpers/generate-verify-email-url.ts"],"sourcesContent":["import { SignJWT } from 'jose'\n\n/**\n * Generates a verification URL for email verification\n *\n * This utility function creates a JWT token containing the user's email and\n * expiration information, signs it with the provided secret, and constructs\n * a verification URL with the token as a query parameter.\n *\n * @param userEmail - The email address of the user to verify\n * @param secret - The secret used to sign the JWT\n * @param expiresIn - Duration in seconds for token expiration (default: 3600)\n * @param verifyRouteUrl - The base URL for the verification endpoint\n * @param callbackURL - Optional callback URL after verification (default: \"/\")\n * @returns The complete verification URL with token\n *\n * @example\n * const url = await generateVerifyEmailUrl({\n * userEmail: 'user@example.com',\n * secret: 'your-secret-key',\n * verifyRouteUrl: 'https://your-app.com/api/auth/verify-email',\n * callbackURL: '/profile'\n * });\n */\nexport const generateVerifyEmailUrl = async ({\n userEmail,\n secret,\n expiresIn = 3600,\n verifyRouteUrl,\n callbackURL = '/',\n}: {\n userEmail: string\n secret: string\n expiresIn?: number\n verifyRouteUrl: string\n callbackURL?: string\n}): Promise<string> => {\n if (!userEmail) {\n throw new Error('userEmail is required to generate a verification URL')\n }\n\n if (!secret) {\n throw new Error('secret is required to sign the JWT token')\n }\n\n if (!verifyRouteUrl) {\n throw new Error('verifyRouteUrl is required to generate a verification URL')\n }\n\n // Create and sign the JWT token\n const jwt = await new SignJWT({\n email: userEmail,\n iat: Math.floor(Date.now() / 1000),\n exp: Math.floor(Date.now() / 1000) + expiresIn,\n })\n .setProtectedHeader({ alg: 'HS256' })\n .sign(new TextEncoder().encode(secret))\n\n // Build the verification URL\n const verifyUrl = `${verifyRouteUrl}?token=${jwt}${callbackURL ? `&callbackURL=${encodeURIComponent(callbackURL)}` : ''}`\n\n return verifyUrl\n}\n"],"names":["SignJWT","generateVerifyEmailUrl","userEmail","secret","expiresIn","verifyRouteUrl","callbackURL","Error","jwt","email","iat","Math","floor","Date","now","exp","setProtectedHeader","alg","sign","TextEncoder","encode","verifyUrl","encodeURIComponent"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAM;AAE9B;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,MAAMC,yBAAyB,OAAO,EAC3CC,SAAS,EACTC,MAAM,EACNC,YAAY,IAAI,EAChBC,cAAc,EACdC,cAAc,GAAG,EAOlB;IACC,IAAI,CAACJ,WAAW;QACd,MAAM,IAAIK,MAAM;IAClB;IAEA,IAAI,CAACJ,QAAQ;QACX,MAAM,IAAII,MAAM;IAClB;IAEA,IAAI,CAACF,gBAAgB;QACnB,MAAM,IAAIE,MAAM;IAClB;IAEA,gCAAgC;IAChC,MAAMC,MAAM,MAAM,IAAIR,QAAQ;QAC5BS,OAAOP;QACPQ,KAAKC,KAAKC,KAAK,CAACC,KAAKC,GAAG,KAAK;QAC7BC,KAAKJ,KAAKC,KAAK,CAACC,KAAKC,GAAG,KAAK,QAAQV;IACvC,GACGY,kBAAkB,CAAC;QAAEC,KAAK;IAAQ,GAClCC,IAAI,CAAC,IAAIC,cAAcC,MAAM,CAACjB;IAEjC,6BAA6B;IAC7B,MAAMkB,YAAY,GAAGhB,eAAe,OAAO,EAAEG,MAAMF,cAAc,CAAC,aAAa,EAAEgB,mBAAmBhB,cAAc,GAAG,IAAI;IAEzH,OAAOe;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/plugin/helpers/get-ip.ts"],"sourcesContent":["import type { BetterAuthOptions } from 'better-auth'\n\nexport function getIp(headers: Headers, options: BetterAuthOptions): string | null {\n if (options.advanced?.ipAddress?.disableIpTracking) {\n return null\n }\n const testIP = '127.0.0.1'\n if ((process.env.NODE_ENV === 'test' || process.env.NODE_ENV === 'development') ?? false) {\n return testIP\n }\n const ipHeaders = options.advanced?.ipAddress?.ipAddressHeaders\n const keys = ipHeaders || [\n 'x-client-ip',\n 'x-forwarded-for',\n 'cf-connecting-ip',\n 'fastly-client-ip',\n 'x-real-ip',\n 'x-cluster-client-ip',\n 'x-forwarded',\n 'forwarded-for',\n 'forwarded',\n ]\n for (const key of keys) {\n const value = headers.get(key)\n if (typeof value === 'string') {\n const ip = value.split(',')[0].trim()\n if (ip) return ip\n }\n }\n return null\n}\n"],"names":["getIp","headers","options","advanced","ipAddress","disableIpTracking","testIP","process","env","NODE_ENV","ipHeaders","ipAddressHeaders","keys","key","value","get","ip","split","trim"],"mappings":"AAEA,OAAO,SAASA,MAAMC,OAAgB,EAAEC,OAA0B;IAChE,IAAIA,QAAQC,QAAQ,EAAEC,WAAWC,mBAAmB;QAClD,OAAO;IACT;IACA,MAAMC,SAAS;IACf,IAAI,AAACC,CAAAA,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAUF,QAAQC,GAAG,CAACC,QAAQ,KAAK,aAAY,KAAM,OAAO;QACxF,OAAOH;IACT;IACA,MAAMI,YAAYR,QAAQC,QAAQ,EAAEC,WAAWO;IAC/C,MAAMC,OAAOF,aAAa;QACxB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IACD,KAAK,MAAMG,OAAOD,KAAM;QACtB,MAAME,QAAQb,QAAQc,GAAG,CAACF;QAC1B,IAAI,OAAOC,UAAU,UAAU;YAC7B,MAAME,KAAKF,MAAMG,KAAK,CAAC,IAAI,CAAC,EAAE,CAACC,IAAI;YACnC,IAAIF,IAAI,OAAOA;QACjB;IACF;IACA,OAAO;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/plugin/helpers/index.ts"],"sourcesContent":["export { generateVerifyEmailUrl } from './generate-verify-email-url'; "],"names":["generateVerifyEmailUrl"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,8BAA8B"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/plugin/helpers/serialize-cookie.ts"],"sourcesContent":["import { subtle } from 'uncrypto'\n\ntype CookiePrefixOptions = 'host' | 'secure'\n\ntype CookieOptions = {\n /**\n * Domain of the cookie\n *\n * The Domain attribute specifies which server can receive a cookie. If specified, cookies are\n * available on the specified server and its subdomains. If the it is not\n * specified, the cookies are available on the server that sets it but not on\n * its subdomains.\n *\n * @example\n * `domain: \"example.com\"`\n */\n domain?: string\n /**\n * A lifetime of a cookie. Permanent cookies are deleted after the date specified in the\n * Expires attribute:\n *\n * Expires has been available for longer than Max-Age, however Max-Age is less error-prone, and\n * takes precedence when both are set. The rationale behind this is that when you set an\n * Expires date and time, they're relative to the client the cookie is being set on. If the\n * server is set to a different time, this could cause errors\n */\n expires?: Date\n /**\n * Forbids JavaScript from accessing the cookie, for example, through the Document.cookie\n * property. Note that a cookie that has been created with HttpOnly will still be sent with\n * JavaScript-initiated requests, for example, when calling XMLHttpRequest.send() or fetch().\n * This mitigates attacks against cross-site scripting\n */\n httpOnly?: boolean\n /**\n * Indicates the number of seconds until the cookie expires. A zero or negative number will\n * expire the cookie immediately. If both Expires and Max-Age are set, Max-Age has precedence.\n *\n * @example 604800 - 7 days\n */\n maxAge?: number\n /**\n * Indicates the path that must exist in the requested URL for the browser to send the Cookie\n * header.\n *\n * @example\n * \"/docs\"\n * // -> the request paths /docs, /docs/, /docs/Web/, and /docs/Web/HTTP will all match. the request paths /, /fr/docs will not match.\n */\n path?: string\n /**\n * Indicates that the cookie is sent to the server only when a request is made with the https:\n * scheme (except on localhost), and therefore, is more resistant to man-in-the-middle attacks.\n */\n secure?: boolean\n /**\n * Controls whether or not a cookie is sent with cross-site requests, providing some protection\n * against cross-site request forgery attacks (CSRF).\n *\n * Strict - Means that the browser sends the cookie only for same-site requests, that is,\n * requests originating from the same site that set the cookie. If a request originates from a\n * different domain or scheme (even with the same domain), no cookies with the SameSite=Strict\n * attribute are sent.\n *\n * Lax - Means that the cookie is not sent on cross-site requests, such as on requests to load\n * images or frames, but is sent when a user is navigating to the origin site from an external\n * site (for example, when following a link). This is the default behavior if the SameSite\n * attribute is not specified.\n *\n * None - Means that the browser sends the cookie with both cross-site and same-site requests.\n * The Secure attribute must also be set when setting this value.\n */\n sameSite?: 'Strict' | 'Lax' | 'None' | 'strict' | 'lax' | 'none'\n /**\n * Indicates that the cookie should be stored using partitioned storage. Note that if this is\n * set, the Secure directive must also be set.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Privacy/Privacy_sandbox/Partitioned_cookies\n */\n partitioned?: boolean\n /**\n * Cooke Prefix\n *\n * - secure: `__Secure-` -> `__Secure-cookie-name`\n * - host: `__Host-` -> `__Host-cookie-name`\n *\n * `secure` must be set to true to use prefixes\n */\n prefix?: CookiePrefixOptions\n}\n\nexport const verifySignature = async (\n base64Signature: string,\n value: string,\n secret: CryptoKey,\n): Promise<boolean> => {\n try {\n const signatureBinStr = atob(base64Signature)\n const signature = new Uint8Array(signatureBinStr.length)\n for (let i = 0, len = signatureBinStr.length; i < len; i++) {\n signature[i] = signatureBinStr.charCodeAt(i)\n }\n return await subtle.verify(algorithm, secret, signature, new TextEncoder().encode(value))\n } catch (e) {\n return false\n }\n}\n\nconst _serialize = (key: string, value: string, opt: CookieOptions = {}) => {\n let cookie: string\n\n if (opt?.prefix === 'secure') {\n cookie = `${`__Secure-${key}`}=${value}`\n } else if (opt?.prefix === 'host') {\n cookie = `${`__Host-${key}`}=${value}`\n } else {\n cookie = `${key}=${value}`\n }\n\n if (key.startsWith('__Secure-') && !opt.secure) {\n opt.secure = true\n }\n\n if (key.startsWith('__Host-')) {\n if (!opt.secure) {\n opt.secure = true\n }\n\n if (opt.path !== '/') {\n opt.path = '/'\n }\n\n if (opt.domain) {\n opt.domain = undefined\n }\n }\n\n if (opt && typeof opt.maxAge === 'number' && opt.maxAge >= 0) {\n if (opt.maxAge > 34560000) {\n throw new Error(\n 'Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.',\n )\n }\n cookie += `; Max-Age=${Math.floor(opt.maxAge)}`\n }\n\n if (opt.domain && opt.prefix !== 'host') {\n cookie += `; Domain=${opt.domain}`\n }\n\n if (opt.path) {\n cookie += `; Path=${opt.path}`\n }\n\n if (opt.expires) {\n if (opt.expires.getTime() - Date.now() > 34560000_000) {\n throw new Error(\n 'Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.',\n )\n }\n cookie += `; Expires=${opt.expires.toUTCString()}`\n }\n\n if (opt.httpOnly) {\n cookie += '; HttpOnly'\n }\n\n if (opt.secure) {\n cookie += '; Secure'\n }\n\n if (opt.sameSite) {\n cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`\n }\n\n if (opt.partitioned) {\n if (!opt.secure) {\n opt.secure = true\n }\n cookie += '; Partitioned'\n }\n\n return cookie\n}\n\nconst algorithm = { name: 'HMAC', hash: 'SHA-256' }\n\nconst getCryptoKey = async (secret: string | BufferSource) => {\n const secretBuf = typeof secret === 'string' ? new TextEncoder().encode(secret) : secret\n return await subtle.importKey('raw', secretBuf, algorithm, false, ['sign', 'verify'])\n}\n\nconst makeSignature = async (value: string, secret: string | BufferSource): Promise<string> => {\n const key = await getCryptoKey(secret)\n const signature = await subtle.sign(algorithm.name, key, new TextEncoder().encode(value))\n // the returned base64 encoded signature will always be 44 characters long and end with one or two equal signs\n return btoa(String.fromCharCode(...new Uint8Array(signature)))\n}\n\nexport const signCookieValue = async (value: string, secret: string | BufferSource) => {\n const signature = await makeSignature(value, secret)\n value = `${value}.${signature}`\n value = encodeURIComponent(value)\n value = decodeURIComponent(value)\n return value\n}\n\nexport const serializeCookie = (key: string, value: string, opt?: CookieOptions) => {\n value = encodeURIComponent(value)\n return _serialize(key, value, opt)\n}\n\nexport const serializeSignedCookie = async (\n key: string,\n value: string,\n secret: string,\n opt?: CookieOptions,\n) => {\n value = await signCookieValue(value, secret)\n return _serialize(key, value, opt)\n}\n\nexport const getCookieKey = (key: string, prefix?: CookiePrefixOptions) => {\n let finalKey = key\n if (prefix) {\n if (prefix === 'secure') {\n finalKey = '__Secure-' + key\n } else if (prefix === 'host') {\n finalKey = '__Host-' + key\n } else {\n return undefined\n }\n }\n return finalKey\n}\n\nexport function tryDecode(str: string) {\n try {\n return str.includes('%') ? decodeURIComponent(str) : str\n } catch {\n return str\n }\n}\n\n/**\n * Parse an HTTP Cookie header string and returning an object of all cookie\n * name-value pairs.\n *\n * Inspired by https://github.com/unjs/cookie-es/blob/main/src/cookie/parse.ts\n *\n * @param str the string representing a `Cookie` header value\n */\nexport function parseCookies(str: string) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string')\n }\n\n const cookies: Map<string, string> = new Map()\n\n let index = 0\n while (index < str.length) {\n const eqIdx = str.indexOf('=', index)\n\n if (eqIdx === -1) {\n break\n }\n\n let endIdx = str.indexOf(';', index)\n\n if (endIdx === -1) {\n endIdx = str.length\n } else if (endIdx < eqIdx) {\n index = str.lastIndexOf(';', eqIdx - 1) + 1\n continue\n }\n\n const key = str.slice(index, eqIdx).trim()\n if (!cookies.has(key)) {\n let val = str.slice(eqIdx + 1, endIdx).trim()\n if (val.codePointAt(0) === 0x22) {\n val = val.slice(1, -1)\n }\n cookies.set(key, tryDecode(val))\n }\n\n index = endIdx + 1\n }\n\n return cookies\n}\n\nexport const getSignedCookie = async (\n key: string,\n secret: string,\n headers: Headers,\n prefix?: CookiePrefixOptions,\n) => {\n const finalKey = getCookieKey(key, prefix)\n if (!finalKey) {\n return null\n }\n const cookieHeader = headers.get('cookie')\n const parsedCookies = cookieHeader ? parseCookies(cookieHeader) : undefined\n const value = parsedCookies?.get(finalKey)\n if (!value) {\n return null\n }\n const signatureStartPos = value.lastIndexOf('.')\n if (signatureStartPos < 1) {\n return null\n }\n const signedValue = value.substring(0, signatureStartPos)\n const signature = value.substring(signatureStartPos + 1)\n if (signature.length !== 44 || !signature.endsWith('=')) {\n return null\n }\n const secretKey = await getCryptoKey(secret)\n const isVerified = await verifySignature(signature, signedValue, secretKey)\n return isVerified ? signedValue : false\n}\n"],"names":["subtle","verifySignature","base64Signature","value","secret","signatureBinStr","atob","signature","Uint8Array","length","i","len","charCodeAt","verify","algorithm","TextEncoder","encode","e","_serialize","key","opt","cookie","prefix","startsWith","secure","path","domain","undefined","maxAge","Error","Math","floor","expires","getTime","Date","now","toUTCString","httpOnly","sameSite","charAt","toUpperCase","slice","partitioned","name","hash","getCryptoKey","secretBuf","importKey","makeSignature","sign","btoa","String","fromCharCode","signCookieValue","encodeURIComponent","decodeURIComponent","serializeCookie","serializeSignedCookie","getCookieKey","finalKey","tryDecode","str","includes","parseCookies","TypeError","cookies","Map","index","eqIdx","indexOf","endIdx","lastIndexOf","trim","has","val","codePointAt","set","getSignedCookie","headers","cookieHeader","get","parsedCookies","signatureStartPos","signedValue","substring","endsWith","secretKey","isVerified"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAU;AA2FjC,OAAO,MAAMC,kBAAkB,OAC7BC,iBACAC,OACAC;IAEA,IAAI;QACF,MAAMC,kBAAkBC,KAAKJ;QAC7B,MAAMK,YAAY,IAAIC,WAAWH,gBAAgBI,MAAM;QACvD,IAAK,IAAIC,IAAI,GAAGC,MAAMN,gBAAgBI,MAAM,EAAEC,IAAIC,KAAKD,IAAK;YAC1DH,SAAS,CAACG,EAAE,GAAGL,gBAAgBO,UAAU,CAACF;QAC5C;QACA,OAAO,MAAMV,OAAOa,MAAM,CAACC,WAAWV,QAAQG,WAAW,IAAIQ,cAAcC,MAAM,CAACb;IACpF,EAAE,OAAOc,GAAG;QACV,OAAO;IACT;AACF,EAAC;AAED,MAAMC,aAAa,CAACC,KAAahB,OAAeiB,MAAqB,CAAC,CAAC;IACrE,IAAIC;IAEJ,IAAID,KAAKE,WAAW,UAAU;QAC5BD,SAAS,GAAG,CAAC,SAAS,EAAEF,KAAK,CAAC,CAAC,EAAEhB,OAAO;IAC1C,OAAO,IAAIiB,KAAKE,WAAW,QAAQ;QACjCD,SAAS,GAAG,CAAC,OAAO,EAAEF,KAAK,CAAC,CAAC,EAAEhB,OAAO;IACxC,OAAO;QACLkB,SAAS,GAAGF,IAAI,CAAC,E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MY,kBAAkB,OAC7B1D,KACAf,QACA0E,SACAxD;IAEA,MAAMqC,WAAWD,aAAavC,KAAKG;IACnC,IAAI,CAACqC,UAAU;QACb,OAAO;IACT;IACA,MAAMoB,eAAeD,QAAQE,GAAG,CAAC;IACjC,MAAMC,gBAAgBF,eAAehB,aAAagB,gBAAgBpD;IAClE,MAAMxB,QAAQ8E,eAAeD,IAAIrB;IACjC,IAAI,CAACxD,OAAO;QACV,OAAO;IACT;IACA,MAAM+E,oBAAoB/E,MAAMoE,WAAW,CAAC;IAC5C,IAAIW,oBAAoB,GAAG;QACzB,OAAO;IACT;IACA,MAAMC,cAAchF,MAAMiF,SAAS,CAAC,GAAGF;IACvC,MAAM3E,YAAYJ,MAAMiF,SAAS,CAACF,oBAAoB;IACtD,IAAI3E,UAAUE,MAAM,KAAK,MAAM,CAACF,UAAU8E,QAAQ,CAAC,MAAM;QACvD,OAAO;IACT;IACA,MAAMC,YAAY,MAAMzC,aAAazC;IACrC,MAAMmF,aAAa,MAAMtF,gBAAgBM,WAAW4E,aAAaG;IACjE,OAAOC,aAAaJ,cAAc;AACpC,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/plugin/index.ts"],"sourcesContent":["import type { BasePayload, Config } from 'payload'\nimport type { PayloadBetterAuthPluginOptions } from './types'\nimport { sanitizeBetterAuthOptions } from './lib/sanitize-auth-options'\nimport { getRequiredCollectionSlugs } from './lib/get-required-collection-slugs'\nimport { buildCollectionConfigs } from './lib/build-collection-configs'\nimport { respectSaveToJwtFieldsMiddleware } from './lib/respect-save-to-jwt-fields-middleware'\nimport { initBetterAuth } from './lib/init-better-auth'\n\nexport * from './types'\nexport * from './helpers'\nexport { sanitizeBetterAuthOptions } from './lib/sanitize-auth-options'\nexport { getPayloadAuth } from './lib/get-payload-auth'\n\nexport function payloadBetterAuth(pluginOptions: PayloadBetterAuthPluginOptions) {\n return (config: Config): Config => {\n if (pluginOptions.disabled) {\n return config\n }\n config.custom = {\n ...config.custom,\n hasBetterAuthPlugin: true,\n }\n\n if (!config.collections) {\n config.collections = []\n }\n\n let sanitzedBetterAuthOptions = sanitizeBetterAuthOptions(pluginOptions)\n\n // Determine which collections to add based on the options and plugins\n const requiredCollectionSlugs = getRequiredCollectionSlugs({\n logTables: pluginOptions.logTables ?? false,\n pluginOptions,\n sanitizedBAOptions: sanitzedBetterAuthOptions,\n })\n\n // Update with the required collections + existing collections\n config.collections = buildCollectionConfigs({\n incomingCollections: config.collections ?? [],\n requiredCollectionSlugs,\n pluginOptions,\n sanitizedBAOptions: sanitzedBetterAuthOptions,\n })\n\n respectSaveToJwtFieldsMiddleware({\n sanitizedOptions: sanitzedBetterAuthOptions,\n payloadConfig: config,\n pluginOptions,\n })\n\n const incomingOnInit = config.onInit\n\n config.onInit = async (payload) => {\n // Ensure we are executing any existing onInit functions before running our own.\n if (incomingOnInit) {\n await incomingOnInit(payload)\n }\n\n // Initialize and set the betterAuth instance\n const auth = initBetterAuth<NonNullable<typeof sanitzedBetterAuthOptions.plugins>>({\n payload,\n options: {\n ...sanitzedBetterAuthOptions,\n enableDebugLogs: pluginOptions.enableDebugLogs,\n plugins: [...(sanitzedBetterAuthOptions.plugins ?? [])],\n },\n })\n ;(payload as BasePayload & { betterAuth: typeof auth }).betterAuth = auth\n }\n return config\n }\n}\n"],"names":["sanitizeBetterAuthOptions","getRequiredCollectionSlugs","buildCollectionConfigs","respectSaveToJwtFieldsMiddleware","initBetterAuth","getPayloadAuth","payloadBetterAuth","pluginOptions","config","disabled","custom","hasBetterAuthPlugin","collections","sanitzedBetterAuthOptions","requiredCollectionSlugs","logTables","sanitizedBAOptions","incomingCollections","sanitizedOptions","payloadConfig","incomingOnInit","onInit","payload","auth","options","enableDebugLogs","plugins","betterAuth"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ,8BAA6B;AACvE,SAASC,0BAA0B,QAAQ,sCAAqC;AAChF,SAASC,sBAAsB,QAAQ,iCAAgC;AACvE,SAASC,gCAAgC,QAAQ,8CAA6C;AAC9F,SAASC,cAAc,QAAQ,yBAAwB;AAEvD,cAAc,UAAS;AACvB,cAAc,YAAW;AACzB,SAASJ,yBAAyB,QAAQ,8BAA6B;AACvE,SAASK,cAAc,QAAQ,yBAAwB;AAEvD,OAAO,SAASC,kBAAkBC,aAA6C;IAC7E,OAAO,CAACC;QACN,IAAID,cAAcE,QAAQ,EAAE;YAC1B,OAAOD;QACT;QACAA,OAAOE,MAAM,GAAG;YACd,GAAGF,OAAOE,MAAM;YAChBC,qBAAqB;QACvB;QAEA,IAAI,CAACH,OAAOI,WAAW,EAAE;YACvBJ,OAAOI,WAAW,GAAG,EAAE;QACzB;QAEA,IAAIC,4BAA4Bb,0BAA0BO;QAE1D,sEAAsE;QACtE,MAAMO,0BAA0Bb,2BAA2B;YACzDc,WAAWR,cAAcQ,SAAS,IAAI;YACtCR;YACAS,oBAAoBH;QACtB;QAEA,8DAA8D;QAC9DL,OAAOI,WAAW,GAAGV,uBAAuB;YAC1Ce,qBAAqBT,OAAOI,WAAW,IAAI,EAAE;YAC7CE;YACAP;YACAS,oBAAoBH;QACtB;QAEAV,iCAAiC;YAC/Be,kBAAkBL;YAClBM,eAAeX;YACfD;QACF;QAEA,MAAMa,iBAAiBZ,OAAOa,MAAM;QAEpCb,OAAOa,MAAM,GAAG,OAAOC;YACrB,gFAAgF;YAChF,IAAIF,gBAAgB;gBAClB,MAAMA,eAAeE;YACvB;YAEA,6CAA6C;YAC7C,MAAMC,OAAOnB,eAAsE;gBACjFkB;gBACAE,SAAS;oBACP,GAAGX,yBAAyB;oBAC5BY,iBAAiBlB,cAAckB,eAAe;oBAC9CC,SAAS;2BAAKb,0BAA0Ba,OAAO,IAAI,EAAE;qBAAE;gBACzD;YACF;YACEJ,QAAsDK,UAAU,GAAGJ;QACvE;QACA,OAAOf;IACT;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/plugin/lib/auth-strategy.ts"],"sourcesContent":["import type { AuthStrategy } from 'payload'\nimport { getPayloadAuth } from './get-payload-auth'\nimport type { TPlugins } from '..'\n\n/**\n * Auth strategy for BetterAuth\n * @param adminRoles - Admin roles\n * @param userSlug - User collection slug\n * @returns Auth strategy\n */\nexport function betterAuthStrategy(adminRoles?: string[], userSlug?: string): AuthStrategy {\n return {\n name: 'better-auth',\n authenticate: async ({ payload, headers }) => {\n const payloadAuth = await getPayloadAuth<NonNullable<TPlugins>>(payload.config)\n const session = await payloadAuth.betterAuth.api.getSession({ headers })\n const sessionUserIdField = payloadAuth.betterAuth.options.session?.fields?.userId ?? 'userId'\n const userId = (session?.session as any)?.[sessionUserIdField] ?? session?.user?.id\n\n if (!session || !userId) {\n return { user: null }\n }\n try {\n const user = await payloadAuth.findByID({\n collection: userSlug ?? 'users',\n id: userId,\n })\n\n if (!user) {\n return { user: null }\n }\n\n return {\n user: {\n ...user,\n collection: userSlug ?? 'users',\n _strategy: 'better-auth',\n },\n }\n } catch {\n return { user: null }\n }\n },\n }\n}\n"],"names":["getPayloadAuth","betterAuthStrategy","adminRoles","userSlug","name","authenticate","payload","headers","payloadAuth","config","session","betterAuth","api","getSession","sessionUserIdField","options","fields","userId","user","id","findByID","collection","_strategy"],"mappings":"AACA,SAASA,cAAc,QAAQ,qBAAoB;AAGnD;;;;;CAKC,GACD,OAAO,SAASC,mBAAmBC,UAAqB,EAAEC,QAAiB;IACzE,OAAO;QACLC,MAAM;QACNC,cAAc,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAE;YACvC,MAAMC,cAAc,MAAMR,eAAsCM,QAAQG,MAAM;YAC9E,MAAMC,UAAU,MAAMF,YAAYG,UAAU,CAACC,GAAG,CAACC,UAAU,CAAC;gBAAEN;YAAQ;YACtE,MAAMO,qBAAqBN,YAAYG,UAAU,CAACI,OAAO,CAACL,OAAO,EAAEM,QAAQC,UAAU;YACrF,MAAMA,SAAS,AAACP,SAASA,SAAiB,CAACI,mBAAmB,IAAIJ,SAASQ,MAAMC;YAEjF,IAAI,CAACT,WAAW,CAACO,QAAQ;gBACvB,OAAO;oBAAEC,MAAM;gBAAK;YACtB;YACA,IAAI;gBACF,MAAMA,OAAO,MAAMV,YAAYY,QAAQ,CAAC;oBACtCC,YAAYlB,YAAY;oBACxBgB,IAAIF;gBACN;gBAEA,IAAI,CAACC,MAAM;oBACT,OAAO;wBAAEA,MAAM;oBAAK;gBACtB;gBAEA,OAAO;oBACLA,MAAM;wBACJ,GAAGA,IAAI;wBACPG,YAAYlB,YAAY;wBACxBmB,WAAW;oBACb;gBACF;YACF,EAAE,OAAM;gBACN,OAAO;oBAAEJ,MAAM;gBAAK;YACtB;QACF;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/plugin/lib/build-collection-configs.ts"],"sourcesContent":["import type { PayloadBetterAuthPluginOptions, SanitizedBetterAuthOptions } from '..'\nimport { baseCollectionSlugs, betterAuthPluginSlugs } from './config'\nimport { betterAuthStrategy } from './auth-strategy'\nimport { getAfterLogoutHook } from '../collections/users/hooks/after-logout'\nimport { getRefreshTokenEndpoint } from '../collections/users/endpoints/refresh-token'\nimport {\n isAdminOrCurrentUserUpdateWithAllowedFields,\n isAdminOrCurrentUserWithRoles,\n isAdminWithRoles,\n} from './payload-access'\nimport { cleanUpUserAfterDelete } from '../collections/users/hooks/clean-up-user-after-delete'\nimport { getSyncPasswordToUserHook } from '../collections/accounts/hooks/sync-password-to-user'\nimport { getSyncAccountHook } from '../collections/users/hooks/sync-account'\nimport { onVerifiedChange } from '../collections/users/hooks/on-verified-change'\nimport { getAfterLoginHook } from '../collections/users/hooks/after-login'\nimport { getBeforeLoginHook } from '../collections/users/hooks/before-login'\nimport { CollectionConfig, Field } from 'payload'\n/**\n * Builds the required collections based on the BetterAuth options and plugins\n */\nexport function buildCollectionConfigs({\n incomingCollections,\n requiredCollectionSlugs,\n pluginOptions,\n sanitizedBAOptions,\n}: {\n incomingCollections: CollectionConfig[]\n requiredCollectionSlugs: Set<string>\n pluginOptions: PayloadBetterAuthPluginOptions\n sanitizedBAOptions: SanitizedBetterAuthOptions\n}): CollectionConfig[] {\n const userSlug = pluginOptions.users?.slug ?? baseCollectionSlugs.users\n const accountSlug = pluginOptions.accounts?.slug ?? baseCollectionSlugs.accounts\n const sessionSlug = pluginOptions.sessions?.slug ?? baseCollectionSlugs.sessions\n const verificationSlug = pluginOptions.verifications?.slug ?? baseCollectionSlugs.verifications\n const baPlugins = sanitizedBAOptions.plugins ?? null\n const adminRoles = pluginOptions.users?.adminRoles ?? ['admin']\n\n const getTimestampFields = ({\n saveUpdatedAtToJWT = true,\n saveCreatedAtToJWT = true,\n }: {\n saveUpdatedAtToJWT?: boolean\n saveCreatedAtToJWT?: boolean\n } = {}): Field[] => {\n return [\n {\n name: 'updatedAt',\n type: 'date',\n saveToJWT: saveUpdatedAtToJWT,\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n index: true,\n label: ({ t }) => t('general:updatedAt'),\n },\n {\n name: 'createdAt',\n saveToJWT: saveCreatedAtToJWT,\n admin: {\n disableBulkEdit: true,\n hidden: true,\n },\n type: 'date',\n index: true,\n label: ({ t }) => t('general:createdAt'),\n },\n ]\n }\n\n const enhancedCollections: CollectionConfig[] = []\n\n requiredCollectionSlugs.forEach((slug) => {\n switch (slug as keyof typeof baseCollectionSlugs | keyof typeof betterAuthPluginSlugs) {\n case baseCollectionSlugs.users:\n const existingUserCollection = incomingCollections.find(\n (collection) => collection.slug === userSlug,\n ) as CollectionConfig | undefined\n const allowedFields = pluginOptions.users?.allowedFields ?? ['name']\n let usersCollection: CollectionConfig = {\n ...existingUserCollection,\n slug: userSlug,\n admin: {\n defaultColumns: ['email'],\n useAsTitle: 'email',\n ...existingUserCollection?.admin,\n hidden: pluginOptions.users?.hidden ?? false,\n },\n access: {\n admin: ({ req }) => adminRoles.includes((req.user?.role as string) ?? 'user'),\n read: isAdminOrCurrentUserWithRoles({ adminRoles, idField: 'id' }),\n create: isAdminWithRoles({ adminRoles }),\n delete: isAdminOrCurrentUserWithRoles({ adminRoles, idField: 'id' }),\n update: isAdminOrCurrentUserUpdateWithAllowedFields({\n allowedFields,\n adminRoles,\n userSlug,\n }),\n ...(existingUserCollection?.access ?? {}),\n },\n endpoints: [\n ...(existingUserCollection?.endpoints ? existingUserCollection.endpoints : []),\n getRefreshTokenEndpoint({ userSlug }),\n ],\n hooks: {\n beforeChange: [\n ...(existingUserCollection?.hooks?.beforeChange ?? []),\n onVerifiedChange,\n ],\n afterChange: [\n ...(existingUserCollection?.hooks?.afterChange ?? []),\n getSyncAccountHook({\n userSlug,\n accountSlug,\n }),\n ],\n beforeLogin: [\n ...(existingUserCollection?.hooks?.beforeLogin ?? []),\n getBeforeLoginHook(),\n ],\n afterLogin: [\n ...(existingUserCollection?.hooks?.afterLogin ?? []),\n getAfterLoginHook({\n sessionsCollectionSlug: sessionSlug,\n usersCollectionSlug: userSlug,\n }),\n ],\n afterLogout: [\n ...(existingUserCollection?.hooks?.afterLogout ?? []),\n getAfterLogoutHook({ sessionsCollectionSlug: sessionSlug }),\n ],\n afterDelete: [\n ...(existingUserCollection?.hooks?.afterDelete ?? []),\n (args) => cleanUpUserAfterDelete(args as any),\n ],\n },\n auth: {\n ...(existingUserCollection && typeof existingUserCollection.auth === 'object'\n ? existingUserCollection.auth\n : {}),\n //disableLocalStrategy: false,\n strategies: [betterAuthStrategy(adminRoles, userSlug)],\n },\n fields: [\n ...(existingUserCollection?.fields ?? []),\n {\n name: 'betterAuthAdminButtons',\n type: 'ui',\n admin: {\n position: 'sidebar',\n components: {\n Field: {\n path: '@payload-auth/better-auth-plugin/client#AdminButtons',\n clientProps: () => {\n return {\n userSlug,\n }\n },\n },\n },\n condition: () => {\n // Only show the impersonate button if the admin plugin is enabled\n return (baPlugins && baPlugins.some((plugin) => plugin.id === 'admin')) ?? false\n },\n },\n },\n {\n name: 'name',\n type: 'text',\n label: 'Name',\n saveToJWT: true,\n admin: {\n description: 'Users chosen display name',\n },\n },\n {\n name: 'email',\n type: 'text',\n required: true,\n unique: true,\n index: true,\n label: 'Email',\n admin: {\n description: 'The email of the user',\n },\n },\n {\n name: 'emailVerified',\n type: 'checkbox',\n required: true,\n defaultValue: false,\n saveToJWT: true,\n label: 'Email Verified',\n admin: {\n description: 'Whether the email of the user has been verified',\n },\n },\n {\n name: 'image',\n type: 'text',\n label: 'Image',\n saveToJWT: true,\n admin: {\n description: 'The image of the user',\n },\n },\n {\n name: 'role',\n type: 'select',\n required: true,\n defaultValue: 'user',\n saveToJWT: true,\n options: [\n ...(\n pluginOptions.users?.roles ?? [\n { label: 'Admin', value: 'admin' },\n { label: 'User', value: 'user' },\n ]\n ).map((role) => {\n if (typeof role === 'string') {\n return {\n label: role.charAt(0).toUpperCase() + role.slice(1),\n value: role,\n }\n }\n return role\n }),\n ],\n label: 'Role',\n admin: {\n description: 'The role of the user',\n },\n },\n ...getTimestampFields({ saveUpdatedAtToJWT: false, saveCreatedAtToJWT: false }),\n ],\n }\n if (baPlugins) {\n baPlugins.forEach((plugin) => {\n switch (plugin.id) {\n case 'two-factor':\n usersCollection.fields.push({\n name: 'twoFactorEnabled',\n type: 'checkbox',\n defaultValue: false,\n label: 'Two Factor Enabled',\n admin: {\n description: 'Whether the user has two factor authentication enabled',\n },\n })\n break\n case 'username':\n usersCollection.fields.push(\n {\n name: 'username',\n type: 'text',\n unique: true,\n required: false, // TODO: decide if this should be required, will have to tell users they need to add ui for it.\n label: 'Username',\n admin: {\n description: 'The username of the user',\n },\n },\n {\n name: 'displayUsername',\n type: 'text',\n required: true,\n label: 'Display Username',\n admin: {\n description: 'The display username of the user',\n },\n },\n )\n break\n case 'anonymous':\n usersCollection.fields.push({\n name: 'isAnonymous',\n type: 'checkbox',\n defaultValue: false,\n label: 'Is Anonymous',\n admin: {\n description: 'Whether the user is anonymous.',\n },\n })\n break\n case 'phone-number':\n usersCollection.fields.push(\n {\n name: 'phoneNumber',\n type: 'text',\n label: 'Phone Number',\n admin: {\n description: 'The phone number of the user',\n },\n },\n {\n name: 'phoneNumberVerified',\n type: 'checkbox',\n defaultValue: false,\n label: 'Phone Number Verified',\n admin: {\n description: 'Whether the phone number of the user has been verified',\n },\n },\n )\n break\n case 'admin':\n usersCollection.fields.push(\n {\n name: 'banned',\n type: 'checkbox',\n defaultValue: false,\n label: 'Banned',\n admin: {\n description: 'Whether the user is banned from the platform',\n },\n },\n {\n name: 'banReason',\n type: 'text',\n label: 'Ban Reason',\n admin: {\n description: 'The reason for the ban',\n },\n },\n {\n name: 'banExpires',\n type: 'date',\n label: 'Ban Expires',\n admin: {\n description: 'The date and time when the ban will expire',\n },\n },\n )\n break\n case 'harmony-email':\n usersCollection.fields.push({\n name: 'normalizedEmail',\n type: 'text',\n required: false,\n unique: true,\n admin: {\n readOnly: true,\n description: 'The normalized email of the user',\n },\n })\n break\n default:\n break\n }\n })\n }\n\n if (pluginOptions.users?.collectionOverrides) {\n usersCollection = pluginOptions.users.collectionOverrides({ collection: usersCollection })\n }\n\n enhancedCollections.push(usersCollection)\n break\n case baseCollectionSlugs.accounts:\n const existingAccountCollection = incomingCollections.find(\n (collection) => collection.slug === accountSlug,\n ) as CollectionConfig | undefined\n let accountCollection: CollectionConfig = {\n slug: accountSlug,\n admin: {\n useAsTitle: 'accountId',\n description: 'Accounts are used to store user accounts for authentication providers',\n ...existingAccountCollection?.admin,\n hidden: pluginOptions.accounts?.hidden,\n },\n hooks: {\n afterChange: [\n ...(existingAccountCollection?.hooks?.afterChange ?? []),\n getSyncPasswordToUserHook({\n userSlug,\n accountSlug,\n }),\n ],\n },\n access: {\n create: isAdminWithRoles({ adminRoles }),\n delete: isAdminWithRoles({ adminRoles }),\n read: isAdminOrCurrentUserWithRoles({ adminRoles, idField: 'user' }),\n update: isAdminWithRoles({ adminRoles }),\n ...(existingAccountCollection?.access ?? {}),\n },\n fields: [\n ...(existingAccountCollection?.fields ?? []),\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n index: true,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'The user that the account belongs to',\n },\n },\n {\n name: 'accountId',\n type: 'text',\n label: 'Account ID',\n required: true,\n index: true,\n admin: {\n readOnly: true,\n description:\n 'The id of the account as provided by the SSO or equal to userId for credential accounts',\n },\n },\n {\n name: 'providerId',\n type: 'text',\n required: true,\n label: 'Provider ID',\n admin: {\n readOnly: true,\n description: 'The id of the provider as provided by the SSO',\n },\n },\n {\n name: 'accessToken',\n type: 'text',\n label: 'Access Token',\n admin: {\n readOnly: true,\n description: 'The access token of the account. Returned by the provider',\n },\n },\n {\n name: 'refreshToken',\n type: 'text',\n label: 'Refresh Token',\n admin: {\n readOnly: true,\n description: 'The refresh token of the account. Returned by the provider',\n },\n },\n {\n name: 'accessTokenExpiresAt',\n type: 'date',\n label: 'Access Token Expires At',\n admin: {\n readOnly: true,\n description: 'The date and time when the access token will expire',\n },\n },\n {\n name: 'refreshTokenExpiresAt',\n type: 'date',\n label: 'Refresh Token Expires At',\n admin: {\n readOnly: true,\n description: 'The date and time when the refresh token will expire',\n },\n },\n {\n name: 'scope',\n type: 'text',\n label: 'Scope',\n admin: {\n readOnly: true,\n description: 'The scope of the account. Returned by the provider',\n },\n },\n {\n name: 'idToken',\n type: 'text',\n label: 'ID Token',\n admin: {\n readOnly: true,\n description: 'The id token for the account. Returned by the provider',\n },\n },\n {\n name: 'password',\n type: 'text',\n label: 'Password',\n admin: {\n readOnly: true,\n hidden: true,\n description:\n 'The hashed password of the account. Mainly used for email and password authentication',\n },\n },\n ...getTimestampFields(),\n ],\n ...existingAccountCollection,\n }\n if (pluginOptions.accounts?.collectionOverrides) {\n accountCollection = pluginOptions.accounts.collectionOverrides({\n collection: accountCollection,\n })\n }\n\n enhancedCollections.push(accountCollection)\n break\n case baseCollectionSlugs.sessions:\n const existingSessionCollection = incomingCollections.find(\n (collection) => collection.slug === sessionSlug,\n ) as CollectionConfig | undefined\n let sessionCollection: CollectionConfig = {\n slug: sessionSlug,\n admin: {\n ...existingSessionCollection?.admin,\n hidden: pluginOptions.sessions?.hidden,\n description:\n 'Sessions are active sessions for users. They are used to authenticate users with a session token',\n },\n fields: [\n ...(existingSessionCollection?.fields ?? []),\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n saveToJWT: true,\n index: true,\n admin: {\n readOnly: true,\n description: 'The user that the session belongs to',\n },\n },\n {\n name: 'token',\n type: 'text',\n required: true,\n unique: true,\n index: true,\n saveToJWT: true,\n label: 'Token',\n admin: {\n description: 'The unique session token',\n readOnly: true,\n },\n },\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n label: 'Expires At',\n saveToJWT: true,\n admin: {\n description: 'The date and time when the session will expire',\n readOnly: true,\n },\n },\n {\n name: 'ipAddress',\n type: 'text',\n label: 'IP Address',\n saveToJWT: true,\n admin: {\n description: 'The IP address of the device',\n readOnly: true,\n },\n },\n {\n name: 'userAgent',\n type: 'text',\n label: 'User Agent',\n saveToJWT: true,\n admin: {\n description: 'The user agent information of the device',\n readOnly: true,\n },\n },\n ...getTimestampFields(),\n ],\n ...existingSessionCollection,\n }\n if (baPlugins) {\n baPlugins.forEach((plugin) => {\n switch (plugin.id) {\n case 'admin':\n sessionCollection.fields.push({\n name: 'impersonatedBy',\n type: 'relationship',\n relationTo: userSlug,\n required: false,\n label: 'Impersonated By',\n admin: {\n readOnly: true,\n description: 'The admin who is impersonating this session',\n },\n })\n break\n case 'organization':\n sessionCollection.fields.push({\n name: 'activeOrganization',\n type: 'relationship',\n relationTo: betterAuthPluginSlugs.organizations,\n label: 'Active Organization',\n admin: {\n readOnly: true,\n description: 'The currently active organization for the session',\n },\n })\n break\n default:\n break\n }\n })\n }\n\n if (pluginOptions.sessions?.collectionOverrides) {\n sessionCollection = pluginOptions.sessions.collectionOverrides({\n collection: sessionCollection,\n })\n }\n\n enhancedCollections.push(sessionCollection)\n break\n case baseCollectionSlugs.verifications:\n const existingVerificationCollection = incomingCollections.find(\n (collection) => collection.slug === verificationSlug,\n )\n const verificationCollection: CollectionConfig = {\n slug: verificationSlug,\n admin: {\n ...existingVerificationCollection?.admin,\n hidden: pluginOptions.verifications?.hidden,\n useAsTitle: 'identifier',\n description: 'Verifications are used to verify authentication requests',\n },\n fields: [\n ...(existingVerificationCollection?.fields ?? []),\n {\n name: 'identifier',\n type: 'text',\n required: true,\n index: true,\n label: 'Identifier',\n admin: {\n description: 'The identifier of the verification request',\n readOnly: true,\n },\n },\n {\n name: 'value',\n type: 'text',\n required: true,\n label: 'Value',\n admin: {\n description: 'The value to be verified',\n readOnly: true,\n },\n },\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n label: 'Expires At',\n admin: {\n description: 'The date and time when the verification request will expire',\n readOnly: true,\n },\n },\n ],\n timestamps: true,\n ...existingVerificationCollection,\n }\n enhancedCollections.push(verificationCollection)\n break\n case betterAuthPluginSlugs.organizations:\n const organizationCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.organizations,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'name',\n description:\n 'Organizations are groups of users that share access to certain resources.',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n label: 'Name',\n admin: {\n description: 'The name of the organization.',\n },\n },\n {\n name: 'slug',\n type: 'text',\n unique: true,\n index: true,\n label: 'Slug',\n admin: {\n description: 'The slug of the organization.',\n },\n },\n {\n name: 'logo',\n type: 'text',\n label: 'Logo',\n admin: {\n description: 'The logo of the organization.',\n },\n },\n {\n name: 'metadata',\n type: 'json',\n label: 'Metadata',\n admin: {\n description: 'Additional metadata for the organization.',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(organizationCollection)\n break\n case betterAuthPluginSlugs.members:\n const memberCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.members,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'organization',\n description: 'Members of an organization.',\n },\n fields: [\n {\n name: 'organization',\n type: 'relationship',\n relationTo: betterAuthPluginSlugs.organizations,\n required: true,\n index: true,\n label: 'Organization',\n admin: {\n readOnly: true,\n description: 'The organization that the member belongs to.',\n },\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n index: true,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'The user that is a member of the organization.',\n },\n },\n {\n name: 'team',\n type: 'relationship',\n relationTo: betterAuthPluginSlugs.teams,\n required: false,\n label: 'Team',\n admin: {\n description: 'The team that the member belongs to.',\n },\n },\n {\n name: 'role',\n type: 'text',\n required: true,\n defaultValue: 'member',\n label: 'Role',\n admin: {\n description: 'The role of the member in the organization.',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(memberCollection)\n break\n case betterAuthPluginSlugs.invitations:\n const invitationCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.invitations,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'email',\n description: 'Invitations to join an organization',\n },\n fields: [\n {\n name: 'email',\n type: 'text',\n required: true,\n index: true,\n label: 'Email',\n admin: {\n description: 'The email of the user being invited.',\n readOnly: true,\n },\n },\n {\n name: 'inviter',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n label: 'Inviter',\n admin: {\n description: 'The user who invited the user.',\n readOnly: true,\n },\n },\n {\n name: 'organization',\n type: 'relationship',\n relationTo: betterAuthPluginSlugs.organizations,\n required: true,\n index: true,\n label: 'Organization',\n admin: {\n description: 'The organization that the user is being invited to.',\n readOnly: true,\n },\n },\n {\n name: 'role',\n type: 'text',\n required: true,\n label: 'Role',\n admin: {\n description: 'The role of the user being invited.',\n readOnly: true,\n },\n },\n {\n name: 'status',\n type: 'text',\n required: true,\n defaultValue: 'pending',\n label: 'Status',\n admin: {\n description: 'The status of the invitation.',\n readOnly: true,\n },\n },\n {\n name: 'expiresAt',\n type: 'date',\n required: true,\n label: 'Expires At',\n admin: {\n description: 'The date and time when the invitation will expire.',\n readOnly: true,\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(invitationCollection)\n break\n case betterAuthPluginSlugs.teams:\n const teamCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.teams,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'name',\n description: 'Teams are groups of users that share access to certain resources.',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n required: true,\n label: 'Name',\n admin: {\n description: 'The name of the team.',\n },\n },\n {\n name: 'organization',\n type: 'relationship',\n relationTo: betterAuthPluginSlugs.organizations,\n required: true,\n label: 'Organization',\n admin: {\n readOnly: true,\n description: 'The organization that the team belongs to.',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(teamCollection)\n break\n case betterAuthPluginSlugs.jwks:\n const jwksCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.jwks,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'publicKey',\n description: 'JWKS are used to verify the signature of the JWT token',\n },\n fields: [\n {\n name: 'publicKey',\n type: 'text',\n required: true,\n index: true,\n label: 'Public Key',\n admin: {\n description: 'The public part of the web key',\n },\n },\n {\n name: 'privateKey',\n type: 'text',\n required: true,\n label: 'Private Key',\n admin: {\n description: 'The private part of the web key',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(jwksCollection)\n break\n case betterAuthPluginSlugs.apiKeys:\n const apiKeyCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.apiKeys,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'name',\n description: 'API keys are used to authenticate requests to the API.',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n label: 'Name',\n admin: {\n readOnly: true,\n description: 'The name of the API key.',\n },\n },\n {\n name: 'start',\n type: 'text',\n label: 'Starting Characters',\n admin: {\n readOnly: true,\n description:\n 'The starting characters of the API key. Useful for showing the first few characters of the API key in the UI for the users to easily identify.',\n },\n },\n {\n name: 'prefix',\n type: 'text',\n label: 'Prefix',\n admin: {\n readOnly: true,\n description: 'The API Key prefix. Stored as plain text.',\n },\n },\n {\n name: 'key',\n type: 'text',\n required: true,\n label: 'API Key',\n admin: {\n readOnly: true,\n description: 'The hashed API key itself.',\n },\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'The user associated with the API key.',\n },\n },\n {\n name: 'refillInterval',\n type: 'number',\n label: 'Refill Interval',\n admin: {\n readOnly: true,\n description: 'The interval to refill the key in milliseconds.',\n },\n },\n {\n name: 'refillAmount',\n type: 'number',\n label: 'Refill Amount',\n admin: {\n readOnly: true,\n description: 'The amount to refill the remaining count of the key.',\n },\n },\n {\n name: 'lastRefillAt',\n type: 'date',\n label: 'Last Refill At',\n admin: {\n readOnly: true,\n description: 'The date and time when the key was last refilled.',\n },\n },\n {\n name: 'enabled',\n type: 'checkbox',\n defaultValue: true,\n label: 'Enabled',\n admin: {\n readOnly: true,\n description: 'Whether the API key is enabled.',\n },\n },\n {\n name: 'rateLimitEnabled',\n type: 'checkbox',\n defaultValue: true,\n label: 'Rate Limit Enabled',\n admin: {\n readOnly: true,\n description: 'Whether the API key has rate limiting enabled.',\n },\n },\n {\n name: 'rateLimitTimeWindow',\n type: 'number',\n label: 'Rate Limit Time Window',\n admin: {\n readOnly: true,\n description: 'The time window in milliseconds for the rate limit.',\n },\n },\n {\n name: 'rateLimitMax',\n type: 'number',\n label: 'The maximum number of requests allowed within the `rateLimitTimeWindow`.',\n admin: {\n readOnly: true,\n description:\n 'The maximum number of requests allowed within the rate limit time window.',\n },\n },\n {\n name: 'requstCount',\n type: 'number',\n label: 'Request Count',\n required: true,\n admin: {\n readOnly: true,\n description: 'The number of requests made within the rate limit time window.',\n },\n },\n {\n name: 'remaining',\n type: 'number',\n label: 'Remaining Requests',\n admin: {\n readOnly: true,\n description: 'The number of requests remaining.',\n },\n },\n {\n name: 'lastRequest',\n type: 'date',\n label: 'Last Request At',\n admin: {\n readOnly: true,\n description: 'The date and time of the last request made to the key.',\n },\n },\n {\n name: 'expiresAt',\n type: 'date',\n label: 'Expires At',\n admin: {\n readOnly: true,\n description: 'The date and time of when the API key will expire.',\n },\n },\n {\n name: 'permissions',\n type: 'text',\n label: 'Permissions',\n admin: {\n readOnly: true,\n description: 'The permissions for the API key.',\n },\n },\n {\n name: 'metadata',\n type: 'json',\n label: 'Metadata',\n admin: {\n readOnly: true,\n description: 'Any additional metadata you want to store with the key.',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(apiKeyCollection)\n break\n case betterAuthPluginSlugs.twoFactors:\n const twoFactorCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.twoFactors,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'secret',\n description: 'Two factor authentication secrets',\n },\n fields: [\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'The user that the two factor authentication secret belongs to',\n },\n },\n {\n name: 'secret',\n type: 'text',\n label: 'Secret',\n index: true,\n admin: {\n readOnly: true,\n description: 'The secret used to generate the TOTP code.',\n },\n },\n {\n name: 'backupCodes',\n type: 'text',\n required: true,\n label: 'Backup Codes',\n admin: {\n readOnly: true,\n description:\n 'The backup codes used to recover access to the account if the user loses access to their phone or email',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(twoFactorCollection)\n break\n case betterAuthPluginSlugs.oauthAccessTokens:\n const oauthAccessTokenCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.oauthAccessTokens,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'accessToken',\n description: 'OAuth access tokens for custom OAuth clients',\n },\n fields: [\n {\n name: 'accessToken',\n type: 'text',\n required: true,\n index: true,\n label: 'Access Token',\n admin: {\n readOnly: true,\n description: 'Access token issued to the client',\n },\n },\n {\n name: 'refreshToken',\n type: 'text',\n required: true,\n label: 'Refresh Token',\n admin: {\n readOnly: true,\n description: 'Refresh token issued to the client',\n },\n },\n {\n name: 'accessTokenExpiresAt',\n type: 'date',\n required: true,\n label: 'Access Token Expires At',\n admin: {\n readOnly: true,\n description: 'Expiration date of the access token',\n },\n },\n {\n name: 'refreshTokenExpiresAt',\n type: 'date',\n required: true,\n label: 'Refresh Token Expires At',\n admin: {\n readOnly: true,\n description: 'Expiration date of the refresh token',\n },\n },\n {\n name: 'client',\n type: 'relationship',\n relationTo: betterAuthPluginSlugs.oauthApplications,\n required: true,\n label: 'Client',\n admin: {\n readOnly: true,\n description: 'OAuth application associated with the access token',\n },\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'User associated with the access token',\n },\n },\n {\n name: 'scopes',\n type: 'text',\n required: true,\n label: 'Scopes',\n admin: {\n description: 'Comma-separated list of scopes granted',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(oauthAccessTokenCollection)\n break\n case betterAuthPluginSlugs.oauthApplications:\n const oauthApplicationCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.oauthApplications,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'name',\n description: 'OAuth applications are custom OAuth clients',\n },\n fields: [\n {\n name: 'clientId',\n type: 'text',\n unique: true,\n index: true,\n required: true,\n label: 'Client ID',\n admin: {\n readOnly: true,\n description: 'Unique identifier for each OAuth client',\n },\n },\n {\n name: 'clientSecret',\n type: 'text',\n required: true,\n label: 'Client Secret',\n admin: {\n readOnly: true,\n description: 'Secret key for the OAuth client',\n },\n },\n {\n name: 'name',\n type: 'text',\n required: true,\n index: true,\n label: 'Name',\n admin: {\n description: 'Name of the OAuth application',\n },\n },\n {\n name: 'redirectURLs',\n type: 'text',\n required: true,\n label: 'Redirect URLs',\n admin: {\n description: 'Comma-separated list of redirect URLs',\n },\n },\n {\n name: 'metadata',\n type: 'json',\n admin: {\n readOnly: true,\n description: 'Additional metadata for the OAuth application',\n },\n },\n {\n name: 'type',\n type: 'text',\n required: true,\n label: 'Type',\n admin: {\n readOnly: true,\n description: 'Type of OAuth client (e.g., web, mobile)',\n },\n },\n {\n name: 'disabled',\n type: 'checkbox',\n defaultValue: false,\n required: true,\n label: 'Disabled',\n admin: {\n description: 'Indicates if the client is disabled',\n },\n },\n {\n name: 'icon',\n type: 'text',\n label: 'Icon',\n admin: {\n description: 'Icon of the OAuth application',\n },\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: false,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'ID of the user who owns the client. (optional)',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(oauthApplicationCollection)\n break\n case betterAuthPluginSlugs.oauthConsents:\n const oauthConsentCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.oauthConsents,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n description: 'OAuth consents are used to store user consents for OAuth clients',\n },\n fields: [\n {\n name: 'client',\n type: 'relationship',\n relationTo: betterAuthPluginSlugs.oauthApplications,\n required: true,\n label: 'Client',\n admin: {\n readOnly: true,\n description: 'OAuth client associated with the consent',\n },\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'User associated with the consent',\n },\n },\n {\n name: 'scopes',\n type: 'text',\n required: true,\n label: 'Scopes',\n admin: {\n readOnly: true,\n description: 'Comma-separated list of scopes consented to',\n },\n },\n {\n name: 'consentGiven',\n type: 'checkbox',\n defaultValue: false,\n required: true,\n label: 'Consent Given',\n admin: {\n readOnly: true,\n description: '\tIndicates if consent was given',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(oauthConsentCollection)\n break\n case betterAuthPluginSlugs.passkeys:\n const passkeyCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.passkeys,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'name',\n description: 'Passkeys are used to authenticate users',\n },\n fields: [\n {\n name: 'name',\n type: 'text',\n label: 'Name',\n admin: {\n readOnly: true,\n description: 'The name of the passkey',\n },\n },\n {\n name: 'publicKey',\n type: 'text',\n required: true,\n index: true,\n label: 'Public Key',\n admin: {\n readOnly: true,\n description: 'The public key of the passkey',\n },\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n index: true,\n label: 'User',\n admin: {\n readOnly: true,\n description: 'The user that the passkey belongs to',\n },\n },\n {\n name: 'credentialID',\n type: 'text',\n required: true,\n unique: true,\n label: 'Credential ID',\n admin: {\n readOnly: true,\n description: 'The unique identifier of the registered credential',\n },\n },\n {\n name: 'counter',\n type: 'number',\n required: true,\n label: 'Counter',\n admin: {\n readOnly: true,\n description: 'The counter of the passkey',\n },\n },\n {\n name: 'deviceType',\n type: 'text',\n required: true,\n label: 'Device Type',\n admin: {\n readOnly: true,\n description: 'The type of device used to register the passkey',\n },\n },\n {\n name: 'backedUp',\n type: 'checkbox',\n required: true,\n label: 'Backed Up',\n admin: {\n readOnly: true,\n description: 'Whether the passkey is backed up',\n },\n },\n {\n name: 'transports',\n type: 'text',\n required: true,\n label: 'Transports',\n admin: {\n readOnly: true,\n description: 'The transports used to register the passkey',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(passkeyCollection)\n break\n case betterAuthPluginSlugs.ssoProviders:\n const ssoProviderCollection: CollectionConfig = {\n slug: betterAuthPluginSlugs.ssoProviders,\n admin: {\n hidden: pluginOptions.hidePluginCollections ?? false,\n useAsTitle: 'issuer',\n description: 'SSO providers are used to authenticate users with an external provider',\n },\n fields: [\n {\n name: 'issuer',\n type: 'text',\n required: true,\n index: true,\n label: 'Issuer',\n admin: {\n description: 'The issuer of the SSO provider',\n },\n },\n {\n name: 'domain',\n type: 'text',\n required: true,\n label: 'Domain',\n admin: {\n description: 'The domain of the SSO provider',\n },\n },\n {\n name: 'oidcConfig',\n type: 'text',\n required: true,\n label: 'OIDC Config',\n admin: {\n description: 'The OIDC config of the SSO provider',\n },\n },\n {\n name: 'user',\n type: 'relationship',\n relationTo: userSlug,\n required: true,\n label: 'User',\n admin: {\n description: 'The user associated with the SSO provider',\n },\n },\n {\n name: 'providerId',\n type: 'text',\n required: true,\n label: 'Provider ID',\n admin: {\n readOnly: true,\n description:\n 'The provider id. Used to identify a provider and to generate a redirect url',\n },\n },\n {\n name: 'organizationId',\n type: 'text',\n required: true,\n label: 'Organization ID',\n admin: {\n readOnly: true,\n description: 'The organization Id. If provider is linked to an organization',\n },\n },\n ],\n timestamps: true,\n }\n enhancedCollections.push(ssoProviderCollection)\n break\n default:\n break\n }\n })\n\n const restOfCollections = incomingCollections.filter((collection) => {\n return !enhancedCollections.some(\n (enhancedCollection) => enhancedCollection.slug === collection.slug,\n )\n })\n\n return [...enhancedCollections, ...restOfCollections]\n}\n"],"names":["baseCollectionSlugs","betterAuthPluginSlugs","betterAuthStrategy","getAfterLogoutHook","getRefreshTokenEndpoint","isAdminOrCurrentUserUpdateWithAllowedFields","isAdminOrCurrentUserWithRoles","isAdminWithRoles","cleanUpUserAfterDelete","getSyncPasswordToUserHook","getSyncAccountHook","onVerifiedChange","getAfterLoginHook","getBeforeLoginHook","buildCollectionConfigs","incomingCollections","requiredCollectionSlugs","pluginOptions","sanitizedBAOptions","userSlug","users","slug","accountSlug","accounts","sessionSlug","sessions","verificationSlug","verifications","baPlugins","plugins","adminRoles","getTimestampFields","saveUpdatedAtToJWT","saveCreatedAtToJWT","name","type","saveToJWT","admin","disableBulkEdit","hidden","index","label","t","enhancedCollections","forEach","existingUserCollection","find","collection","allowedFields","usersCollection","defaultColumns","useAsTitle","access","req","includes","user","role","read","idField","create","delete","update","endpoints","hooks","beforeChange","afterChange","beforeLogin","afterLogin","sessionsCollectionSlug","usersCollectionSlug","afterLogout","afterDelete","args","auth","strategies","fields","position","components","Field","path","clientProps","condition","some","plugin","id","description","required","unique","defaultValue","options","roles","value","map","charAt","toUpperCase","slice","push","readOnly","collectionOverrides","existingAccountCollection","accountCollection","relationTo","existingSessionCollection","sessionCollection","organizations","existingVerificationCollection","verificationCollection","timestamps","organizationCollection","hidePluginCollections","members","memberCollection","teams","invitations","invitationCollection","teamCollection","jwks","jwksCollection","apiKeys","apiKeyCollection","twoFactors","twoFactorCollection","oauthAccessTokens","oauthAccessTokenCollection","oauthApplications","oauthApplicationCollection","oauthConsents","oauthConsentCollection","passkeys","passkeyCollection","ssoProviders","ssoProviderCollection","restOfCollections","filter","enhancedCollection"],"mappings":"AACA,SAASA,mBAAmB,EAAEC,qBAAqB,QAAQ,WAAU;AACrE,SAASC,kBAAkB,QAAQ,kBAAiB;AACpD,SAASC,kBAAkB,QAAQ,0CAAyC;AAC5E,SAASC,uBAAuB,QAAQ,+CAA8C;AACtF,SACEC,2CAA2C,EAC3CC,6BAA6B,EAC7BC,gBAAgB,QACX,mBAAkB;AACzB,SAASC,sBAAsB,QAAQ,wDAAuD;AAC9F,SAASC,yBAAyB,QAAQ,sDAAqD;AAC/F,SAASC,kBAAkB,QAAQ,0CAAyC;AAC5E,SAASC,gBAAgB,QAAQ,gDAA+C;AAChF,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,SAASC,kBAAkB,QAAQ,0CAAyC;AAE5E;;CAEC,GACD,OAAO,SAASC,uBAAuB,EACrCC,mBAAmB,EACnBC,uBAAuB,EACvBC,aAAa,EACbC,kBAAkB,EAMnB;IACC,MAAMC,WAAWF,cAAcG,KAAK,EAAEC,QAAQrB,oBAAoBoB,KAAK;IACvE,MAAME,cAAcL,cAAcM,QAAQ,EAAEF,QAAQrB,oBAAoBuB,QAAQ;IAChF,MAAMC,cAAcP,cAAcQ,QAAQ,EAAEJ,QAAQrB,oBAAoByB,QAAQ;IAChF,MAAMC,mBAAmBT,cAAcU,aAAa,EAAEN,QAAQrB,oBAAoB2B,aAAa;IAC/F,MAAMC,YAAYV,mBAAmBW,OAAO,IAAI;IAChD,MAAMC,aAAab,cAAcG,KAAK,EAAEU,cAAc;QAAC;KAAQ;IAE/D,MAAMC,qBAAqB,CAAC,EAC1BC,qBAAqB,IAAI,EACzBC,qBAAqB,IAAI,EAI1B,GAAG,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