docs-i18n 0.9.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/admin/app/lib/auth-client.ts +21 -0
  2. package/admin/app/lib/auth.server.ts +62 -0
  3. package/admin/app/routeTree.gen.ts +21 -3
  4. package/admin/app/routes/index.tsx +68 -8
  5. package/admin/app/routes/login.tsx +207 -0
  6. package/admin/app/server.ts +23 -0
  7. package/admin/app/styles.css +146 -0
  8. package/admin/app/worker.ts +18 -0
  9. package/admin/dist/client/assets/auth-client-DqJZaFZR.js +3 -0
  10. package/admin/dist/client/assets/login-CQjkiBAF.js +1 -0
  11. package/admin/dist/client/assets/main-bc5tcdGg.js +18 -0
  12. package/admin/dist/client/assets/routes-CTPOG_v1.js +3 -0
  13. package/admin/dist/client/assets/{styles-DJ6QEJmN.css → styles-zS0BbO7e.css} +1 -1
  14. package/admin/dist/client/assets/useNavigate-CEOVvMjz.js +1 -0
  15. package/admin/dist/server/assets/{react-dom-CpO9xk_L.js → __tanstack-start-server-fn-resolver-qK0Yfvti.js} +83 -507
  16. package/admin/dist/server/assets/_tanstack-start-manifest_v-BgMVPPt2.js +21 -0
  17. package/admin/dist/server/assets/adapter-DjXlUL1J.js +2253 -0
  18. package/admin/dist/server/assets/auth-client-CoUpyQIM.js +807 -0
  19. package/admin/dist/server/assets/auth-dSAIPjBw.js +72 -0
  20. package/admin/dist/server/assets/auth.server-BLVDnTCZ.js +31352 -0
  21. package/admin/dist/server/assets/bun-sqlite-dialect-C8OaCWSL-BNNY-FoT.js +154 -0
  22. package/admin/dist/server/assets/compiled-query-CnFG_BVV.js +6967 -0
  23. package/admin/dist/server/assets/d1-sqlite-dialect-sYHNqBte-Bjz-cybU.js +115 -0
  24. package/admin/dist/server/assets/dist-C3-e8E2B.js +215 -0
  25. package/admin/dist/server/assets/dist-CUzFWZag.js +6039 -0
  26. package/admin/dist/server/assets/{init-DJr2glb3.js → dist-DBv71kqn.js} +21 -381
  27. package/admin/dist/server/assets/error-CASJ5tIm.js +457 -0
  28. package/admin/dist/server/assets/error-codes-BhMTGvV6.js +1153 -0
  29. package/admin/dist/server/assets/init-CJJUsPDL.js +49 -0
  30. package/admin/dist/server/assets/job-manager-D9Ab9hgu.js +179 -0
  31. package/admin/dist/server/assets/{jobs-bQfYqSk7.js → jobs-DrEe9YOj.js} +18 -5
  32. package/admin/dist/server/assets/kysely-adapter-YC8RFPyc.js +2 -0
  33. package/admin/dist/server/assets/login-SqzTMYOZ.js +228 -0
  34. package/admin/dist/server/assets/migrator-ZpVZslbq.js +2926 -0
  35. package/admin/dist/server/assets/{misc-DOk3t9vs.js → misc-BSoYldBT.js} +22 -9
  36. package/admin/dist/server/assets/{models-CBb8Owe5.js → models-CoviNHUP.js} +1 -1
  37. package/admin/dist/server/assets/node-sqlite-dialect-BJIaP6lL.js +154 -0
  38. package/admin/dist/server/assets/{router-DlU_fGDK.js → router-D-82slI-.js} +23 -11
  39. package/admin/dist/server/assets/{routes-BcfX6iub.js → routes-B1pNmxF3.js} +43 -29
  40. package/admin/dist/server/assets/{routes-pIM0fgUO.js → routes-C9huiZHw.js} +56 -22
  41. package/admin/dist/server/assets/sqlite-adapter-CL2EidjD.js +69 -0
  42. package/admin/dist/server/assets/{start-BS52hm79.js → start-BiybVoR2.js} +1 -1
  43. package/admin/dist/server/assets/status-B1AGLvHn.js +162 -0
  44. package/admin/dist/server/assets/status-D7PU72hm.js +262 -0
  45. package/admin/dist/server/assets/string-B4XlckmJ.js +6 -0
  46. package/admin/dist/server/assets/useNavigate-0H08s_Q2.js +29 -0
  47. package/admin/dist/server/assets/useRouter-BXJvr8to.js +508 -0
  48. package/admin/dist/server/server.js +70 -90
  49. package/admin/package.json +6 -1
  50. package/admin/server/functions/auth.ts +89 -0
  51. package/admin/server/functions/jobs.ts +30 -2
  52. package/admin/server/functions/misc.ts +25 -5
  53. package/admin/server/functions/status.ts +52 -3
  54. package/admin/server/index.ts +1 -1
  55. package/admin/server/init.ts +21 -9
  56. package/admin/server/services/d1-status.ts +282 -0
  57. package/admin/vite.config.ts +29 -15
  58. package/admin/wrangler.jsonc +16 -0
  59. package/package.json +1 -1
  60. package/template/app/components/markdown/Markdown.tsx +7 -1
  61. package/template/app/utils/docs.server.ts +37 -4
  62. package/template/app/worker.ts +16 -0
  63. package/template/content/docs-i18n/en/cli.md +9 -5
  64. package/template/content/docs-i18n/en/deployment.md +85 -68
  65. package/template/dist/client/assets/{Doc-CGhUfH9r.js → Doc-BKO69_nz.js} +1 -1
  66. package/template/dist/client/assets/{DocsLayout-CoPL9BM9.js → DocsLayout-BGugXxEQ.js} +1 -1
  67. package/template/dist/client/assets/{FileTabs-DsPkEUu7.js → FileTabs-4fZriOj4.js} +1 -1
  68. package/template/dist/client/assets/{Footer-4faHyha8.js → Footer-DYh1AfWA.js} +1 -1
  69. package/template/dist/client/assets/{FrameworkContent-Cxg_X_EP.js → FrameworkContent-rVvjxASn.js} +1 -1
  70. package/template/dist/client/assets/{MarkdownHeadingContext-CwDqQdSh.js → MarkdownHeadingContext-CdvUDZFU.js} +4 -4
  71. package/template/dist/client/assets/{PostNotFound-1ZaWdycM.js → PostNotFound-WoSYGsGu.js} +1 -1
  72. package/template/dist/client/assets/{_basePickBy-FbrKkfHa.js → _basePickBy-Dd7GuR7A.js} +1 -1
  73. package/template/dist/client/assets/{_baseUniq-g6ljCkn8.js → _baseUniq-DMxQLGFI.js} +1 -1
  74. package/template/dist/client/assets/_lang-3AqGszEy.js +1 -0
  75. package/template/dist/client/assets/_lang._project-COkrIqzH.js +1 -0
  76. package/template/dist/client/assets/_lang._project._version-B8vRZczu.js +1 -0
  77. package/template/dist/client/assets/{_lang._project._version.docs-DjZ_USgK.js → _lang._project._version.docs-DokNGgvU.js} +1 -1
  78. package/template/dist/client/assets/{_lang._project._version.docs._-CNb1EMFX.js → _lang._project._version.docs._-CXCNZzOb.js} +1 -1
  79. package/template/dist/client/assets/_lang._project._version.docs._-DR0WSQEb.js +1 -0
  80. package/template/dist/client/assets/_lang._project._version.docs.framework._framework._-C_Grro8r.js +1 -0
  81. package/template/dist/client/assets/{_lang._project._version.docs.framework._framework.index-CqyVy6eq.js → _lang._project._version.docs.framework._framework.index-DsYjXRdj.js} +1 -1
  82. package/template/dist/client/assets/{_lang._project._version.docs.framework.index-S3Frbfn4.js → _lang._project._version.docs.framework.index-DQX1lBi3.js} +1 -1
  83. package/template/dist/client/assets/{_lang._project.docs-CkmM5v1V.js → _lang._project.docs-DsYQj9jI.js} +1 -1
  84. package/template/dist/client/assets/_lang._project.docs._-DlM_D6DD.js +1 -0
  85. package/template/dist/client/assets/{_lang._project.docs._-BHYKQj_2.js → _lang._project.docs._-l2tTjx80.js} +1 -1
  86. package/template/dist/client/assets/_lang.blog-CEwEtalL.js +1 -0
  87. package/template/dist/client/assets/_lang.blog-D6YGC3tK.js +1 -0
  88. package/template/dist/client/assets/_lang.blog._-DgHu4oLy.js +1 -0
  89. package/template/dist/client/assets/{_lang.blog._-bXJwKw9E.js → _lang.blog._-Umz18sQE.js} +1 -1
  90. package/template/dist/client/assets/_lang.blog.index-C8LKUFtD.js +1 -0
  91. package/template/dist/client/assets/{_lang.blog.index-CdR5PZOo.js → _lang.blog.index-DzUqpOBE.js} +1 -1
  92. package/template/dist/client/assets/{_lang.docs-Cp3wmc9k.js → _lang.docs-CUh3R7DD.js} +1 -1
  93. package/template/dist/client/assets/{_lang.docs._-0bwIpeOn.js → _lang.docs._-DlgTPy3s.js} +1 -1
  94. package/template/dist/client/assets/_lang.docs._-DmaQE7lx.js +1 -0
  95. package/template/dist/client/assets/_lang.docs.framework._framework._-B4C4uDFp.js +1 -0
  96. package/template/dist/client/assets/{_lang.docs.framework._framework.index-BLgwIvQA.js → _lang.docs.framework._framework.index-DTg6Xd3p.js} +1 -1
  97. package/template/dist/client/assets/{_lang.docs.framework.index-CzW7Dul3.js → _lang.docs.framework.index-BQ2enasl.js} +1 -1
  98. package/template/dist/client/assets/{arc-B4lRpBfi.js → arc-DGPgC_QF.js} +1 -1
  99. package/template/dist/client/assets/{architectureDiagram-2XIMDMQ5-Coq1Gceq.js → architectureDiagram-2XIMDMQ5-yI53_GAi.js} +1 -1
  100. package/template/dist/client/assets/{blockDiagram-WCTKOSBZ-C7BGTzDN.js → blockDiagram-WCTKOSBZ-C3tr24zy.js} +1 -1
  101. package/template/dist/client/assets/{c4Diagram-IC4MRINW-xTBVTs0q.js → c4Diagram-IC4MRINW-DOA-mowm.js} +1 -1
  102. package/template/dist/client/assets/channel-DzZD7dUQ.js +1 -0
  103. package/template/dist/client/assets/{chunk-4BX2VUAB-DUUHBu75.js → chunk-4BX2VUAB-B6NSnNJJ.js} +1 -1
  104. package/template/dist/client/assets/{chunk-55IACEB6-MUxF_n9_.js → chunk-55IACEB6-CWYwArBH.js} +1 -1
  105. package/template/dist/client/assets/{chunk-FMBD7UC4-BWh6wvYo.js → chunk-FMBD7UC4-DSyn2wIW.js} +1 -1
  106. package/template/dist/client/assets/{chunk-JSJVCQXG-CLUdUV5u.js → chunk-JSJVCQXG-D83nm5W0.js} +1 -1
  107. package/template/dist/client/assets/{chunk-KX2RTZJC-CAlz_cXA.js → chunk-KX2RTZJC-DD7fN9e9.js} +1 -1
  108. package/template/dist/client/assets/{chunk-NQ4KR5QH-BaYKfUVy.js → chunk-NQ4KR5QH-C3YlYiU5.js} +1 -1
  109. package/template/dist/client/assets/{chunk-QZHKN3VN-NxDloxi5.js → chunk-QZHKN3VN-B7wBEuCG.js} +1 -1
  110. package/template/dist/client/assets/{chunk-WL4C6EOR-C2Ncbi5S.js → chunk-WL4C6EOR-ByA1FloT.js} +1 -1
  111. package/template/dist/client/assets/classDiagram-VBA2DB6C-CRozKaUD.js +1 -0
  112. package/template/dist/client/assets/classDiagram-v2-RAHNMMFH-CRozKaUD.js +1 -0
  113. package/template/dist/client/assets/clone-CGnOEl4E.js +1 -0
  114. package/template/dist/client/assets/{cose-bilkent-S5V4N54A-Ct9-ZJcv.js → cose-bilkent-S5V4N54A-nt_sXfWc.js} +1 -1
  115. package/template/dist/client/assets/{dagre-KLK3FWXG-u9dz8dcq.js → dagre-KLK3FWXG-DUsyMTPd.js} +1 -1
  116. package/template/dist/client/assets/{diagram-E7M64L7V-BXmcaktT.js → diagram-E7M64L7V-D5SAypX0.js} +1 -1
  117. package/template/dist/client/assets/{diagram-IFDJBPK2-CRlP5SeV.js → diagram-IFDJBPK2-WhP5c8Vz.js} +1 -1
  118. package/template/dist/client/assets/{diagram-P4PSJMXO-B9rJcj_H.js → diagram-P4PSJMXO-AMrwIlhf.js} +1 -1
  119. package/template/dist/client/assets/{erDiagram-INFDFZHY-DX-vee6w.js → erDiagram-INFDFZHY-BxifSpCV.js} +1 -1
  120. package/template/dist/client/assets/{flowDiagram-PKNHOUZH-CoBCSOFc.js → flowDiagram-PKNHOUZH-BMAowE9I.js} +1 -1
  121. package/template/dist/client/assets/{ganttDiagram-A5KZAMGK-BlqU_ghi.js → ganttDiagram-A5KZAMGK-Bay-0iRq.js} +1 -1
  122. package/template/dist/client/assets/{gitGraphDiagram-K3NZZRJ6-CntCsuti.js → gitGraphDiagram-K3NZZRJ6-Va91W3gw.js} +1 -1
  123. package/template/dist/client/assets/{graph-CZaxZzO8.js → graph-CbBYObK_.js} +1 -1
  124. package/template/dist/client/assets/{index-XelhTkgl.js → index-CF6qz2tX.js} +1 -1
  125. package/template/dist/client/assets/{infoDiagram-LFFYTUFH-_jCC8Jtt.js → infoDiagram-LFFYTUFH-Byd5C-4U.js} +1 -1
  126. package/template/dist/client/assets/{ishikawaDiagram-PHBUUO56-D3m_r2ig.js → ishikawaDiagram-PHBUUO56-DxOKnE1v.js} +1 -1
  127. package/template/dist/client/assets/{journeyDiagram-4ABVD52K-CvRNm03C.js → journeyDiagram-4ABVD52K-IRmt7RI4.js} +1 -1
  128. package/template/dist/client/assets/{kanban-definition-K7BYSVSG-nQcLuNSy.js → kanban-definition-K7BYSVSG-BjTVXn-R.js} +1 -1
  129. package/template/dist/client/assets/{layout-DZIdDq97.js → layout-Bbx6A0bC.js} +1 -1
  130. package/template/dist/client/assets/{linear-C2JcF5ss.js → linear-Df2eAW4A.js} +1 -1
  131. package/template/dist/client/assets/{main-C8MldI1o.js → main-DqZtiCro.js} +2 -2
  132. package/template/dist/client/assets/{mermaid.core-DlB0QBo2.js → mermaid.core-BIoiBcAA.js} +4 -4
  133. package/template/dist/client/assets/{mindmap-definition-YRQLILUH-D9OjtrBW.js → mindmap-definition-YRQLILUH-Btzz0iIP.js} +1 -1
  134. package/template/dist/client/assets/ordinal-Cboi1Yqb.js +1 -0
  135. package/template/dist/client/assets/{pieDiagram-SKSYHLDU-DoYJZfNJ.js → pieDiagram-SKSYHLDU-C2amrGtU.js} +1 -1
  136. package/template/dist/client/assets/{quadrantDiagram-337W2JSQ-Bs71YHJr.js → quadrantDiagram-337W2JSQ-EVgH9VuN.js} +1 -1
  137. package/template/dist/client/assets/{react-C0klD_r9.js → react-qvbbiZob.js} +1 -1
  138. package/template/dist/client/assets/{requirementDiagram-Z7DCOOCP-BWvQcALn.js → requirementDiagram-Z7DCOOCP-BkYPbRis.js} +1 -1
  139. package/template/dist/client/assets/{sankeyDiagram-WA2Y5GQK-CiGy1SQP.js → sankeyDiagram-WA2Y5GQK-B5EIaP-h.js} +1 -1
  140. package/template/dist/client/assets/{sequenceDiagram-2WXFIKYE-DRZim8vR.js → sequenceDiagram-2WXFIKYE-BC33VGOc.js} +1 -1
  141. package/template/dist/client/assets/{stateDiagram-RAJIS63D-BoqzJeL7.js → stateDiagram-RAJIS63D-DiKvWUYb.js} +1 -1
  142. package/template/dist/client/assets/stateDiagram-v2-FVOUBMTO-DjKMPYGe.js +1 -0
  143. package/template/dist/client/assets/{timeline-definition-YZTLITO2-CyvR95Wz.js → timeline-definition-YZTLITO2-QiFlgbRA.js} +1 -1
  144. package/template/dist/client/assets/{treemap-KZPCXAKY-DkXgGvs_.js → treemap-KZPCXAKY-BOYbyS9G.js} +1 -1
  145. package/template/dist/client/assets/{vennDiagram-LZ73GAT5-CVpGZu6p.js → vennDiagram-LZ73GAT5-CqmW7j4r.js} +1 -1
  146. package/template/dist/client/assets/{xychartDiagram-JWTSCODW-Cjqbi_DU.js → xychartDiagram-JWTSCODW-gj6oWX8l.js} +1 -1
  147. package/template/dist/server/assets/{Doc-DKBxQduk.js → Doc-9tJiX5y6.js} +3 -3
  148. package/template/dist/server/assets/{DocsLayout-CQfCTal3.js → DocsLayout-BTjhU_W5.js} +2 -2
  149. package/template/dist/server/assets/{Footer-Dcw5XVqX.js → Footer-CefTi2yh.js} +1 -1
  150. package/template/dist/server/assets/{FrameworkContent-OJfvCBHi.js → FrameworkContent-BkJvuP04.js} +2 -2
  151. package/template/dist/server/assets/{MarkdownHeadingContext-h4SfZq-C.js → MarkdownHeadingContext-37oQpb36.js} +8 -4
  152. package/template/dist/server/assets/{PostNotFound-DRJpnWrj.js → PostNotFound-BqBZf83v.js} +1 -1
  153. package/template/dist/server/assets/{_basePickBy-DJ9gzwF8.js → _basePickBy-DZ3TPUta.js} +2 -2
  154. package/template/dist/server/assets/{_baseUniq-CezmbvU2.js → _baseUniq-DKicWTQT.js} +1 -1
  155. package/template/dist/server/assets/{_lang._project._version.docs-CE_Z2zvG.js → _lang._project._version.docs-DOTNQiDb.js} +1 -1
  156. package/template/dist/server/assets/{_lang._project._version.docs-sJvASz_e.js → _lang._project._version.docs-U-t4mk5_.js} +3 -3
  157. package/template/dist/server/assets/{_lang._project._version.docs._-B2vf_QGY.js → _lang._project._version.docs._-DMgnElWM.js} +5 -5
  158. package/template/dist/server/assets/{_lang._project._version.docs._-CQcamDns.js → _lang._project._version.docs._-DSg82-Ug.js} +1 -1
  159. package/template/dist/server/assets/{_lang._project._version.docs.framework._framework._-54LEIllb.js → _lang._project._version.docs.framework._framework._-DbeN6toN.js} +1 -1
  160. package/template/dist/server/assets/{_lang._project._version.docs.framework._framework._-Dmn8xCf0.js → _lang._project._version.docs.framework._framework._-kBw_9L-F.js} +5 -5
  161. package/template/dist/server/assets/{_lang._project._version.docs.framework._framework.index-COKb9ffR.js → _lang._project._version.docs.framework._framework.index-Bsyj0DD5.js} +1 -1
  162. package/template/dist/server/assets/{_lang._project._version.docs.framework.index-DoEddI6Z.js → _lang._project._version.docs.framework.index-CmLAP_Io.js} +1 -1
  163. package/template/dist/server/assets/{_lang._project.docs-BjOhmwp6.js → _lang._project.docs-Bb4ZZ_jr.js} +3 -3
  164. package/template/dist/server/assets/{_lang._project.docs-dl8MxaGg.js → _lang._project.docs-BsnkRf-R.js} +1 -1
  165. package/template/dist/server/assets/{_lang._project.docs._-hSRVM-U7.js → _lang._project.docs._-ChrpJ61j.js} +5 -5
  166. package/template/dist/server/assets/{_lang._project.docs._-Bq0ajlaH.js → _lang._project.docs._-axRfm8vS.js} +1 -1
  167. package/template/dist/server/assets/{_lang.blog-Dk36D6Ol.js → _lang.blog-8j6IvzvQ.js} +2 -2
  168. package/template/dist/server/assets/{_lang.blog._-Cm8zXsPs.js → _lang.blog._-BPzP97Ac.js} +2 -2
  169. package/template/dist/server/assets/{_lang.blog._-D4CEjSkM.js → _lang.blog._-CjgFipz7.js} +1 -1
  170. package/template/dist/server/assets/{_lang.blog.index-orWcAgbi.js → _lang.blog._-DNX8UglA.js} +2 -2
  171. package/template/dist/server/assets/{_lang.blog.index-ZhMds6Jp.js → _lang.blog.index-CeZnMJBi.js} +1 -1
  172. package/template/dist/server/assets/{_lang.blog.index-Dfy48Gbt.js → _lang.blog.index-Dk5fYp4Q.js} +1 -1
  173. package/template/dist/server/assets/{_lang.blog._-A8h17fpC.js → _lang.blog.index-DzVKqoC4.js} +2 -2
  174. package/template/dist/server/assets/{_lang.docs-CAEkhcnT.js → _lang.docs-B4StnHMb.js} +3 -3
  175. package/template/dist/server/assets/{_lang.docs-CB1sGjRO.js → _lang.docs-DSB3iI6a.js} +1 -1
  176. package/template/dist/server/assets/{_lang.docs._-Zbv8OwJU.js → _lang.docs._--c0In1AT.js} +5 -5
  177. package/template/dist/server/assets/{_lang.docs._-DEX6FutM.js → _lang.docs._-S-y4-3Qn.js} +1 -1
  178. package/template/dist/server/assets/{_lang.docs.framework._framework._-BnpTV3KM.js → _lang.docs.framework._framework._-BFWLyU2h.js} +1 -1
  179. package/template/dist/server/assets/{_lang.docs.framework._framework._-4s4-ZCYh.js → _lang.docs.framework._framework._-Be0U7cDg.js} +5 -5
  180. package/template/dist/server/assets/{_lang.docs.framework._framework.index-BLryfsl2.js → _lang.docs.framework._framework.index-BZ512aSk.js} +1 -1
  181. package/template/dist/server/assets/{_lang.docs.framework.index-DGxWQH6q.js → _lang.docs.framework.index-U8z3j4kz.js} +1 -1
  182. package/template/dist/server/assets/{_tanstack-start-manifest_v-CURwM8Tc.js → _tanstack-start-manifest_v-DXpQ8503.js} +1 -1
  183. package/template/dist/server/assets/{arc-BwftnT5H.js → arc-B4h6h_n6.js} +1 -1
  184. package/template/dist/server/assets/{architecture-PBZL5I3N-KbDVC6gM.js → architecture-PBZL5I3N-CUwqLXkR.js} +6 -6
  185. package/template/dist/server/assets/{architectureDiagram-2XIMDMQ5-BoLvWxb3.js → architectureDiagram-2XIMDMQ5-CuCoxdBe.js} +6 -6
  186. package/template/dist/server/assets/{blockDiagram-WCTKOSBZ-GPFcXs-f.js → blockDiagram-WCTKOSBZ-D5PsUOim.js} +6 -6
  187. package/template/dist/server/assets/{blog.server-Bbk2Ifog.js → blog.server-WqzZ00iA.js} +1 -1
  188. package/template/dist/server/assets/{c4Diagram-IC4MRINW-EQwQCspo.js → c4Diagram-IC4MRINW-CXy5xO3o.js} +2 -2
  189. package/template/dist/server/assets/{channel-CxvwuPH7.js → channel-D0l-mWaF.js} +1 -1
  190. package/template/dist/server/assets/{chunk-4BX2VUAB-DUgcw5ei.js → chunk-4BX2VUAB-M7FVHMss.js} +1 -1
  191. package/template/dist/server/assets/{chunk-55IACEB6-Cn15uD91.js → chunk-55IACEB6-D_gDAje5.js} +1 -1
  192. package/template/dist/server/assets/{chunk-FMBD7UC4-Ck3iyLPu.js → chunk-FMBD7UC4-B5Bebx-Y.js} +1 -1
  193. package/template/dist/server/assets/{chunk-JSJVCQXG-VAT8yncE.js → chunk-JSJVCQXG-DxBkq-uB.js} +1 -1
  194. package/template/dist/server/assets/{chunk-KX2RTZJC-B1bd2VmA.js → chunk-KX2RTZJC-BMHm1EGi.js} +1 -1
  195. package/template/dist/server/assets/{chunk-NQ4KR5QH-CR67GG9C.js → chunk-NQ4KR5QH-Cp28pTwT.js} +3 -3
  196. package/template/dist/server/assets/{chunk-QZHKN3VN-B9SSazM4.js → chunk-QZHKN3VN-Bq5GZqaR.js} +1 -1
  197. package/template/dist/server/assets/{chunk-WL4C6EOR-DZ4Pjuao.js → chunk-WL4C6EOR-C9Nj5GdW.js} +5 -5
  198. package/template/dist/server/assets/{classDiagram-VBA2DB6C-CA6_4Wb2.js → classDiagram-VBA2DB6C-CUchv9T5.js} +6 -6
  199. package/template/dist/server/assets/{classDiagram-v2-RAHNMMFH-CA6_4Wb2.js → classDiagram-v2-RAHNMMFH-CUchv9T5.js} +6 -6
  200. package/template/dist/server/assets/{clone-DJHP_iVy.js → clone-CJcTi58S.js} +1 -1
  201. package/template/dist/server/assets/{cose-bilkent-S5V4N54A-DtU-cN6W.js → cose-bilkent-S5V4N54A-CxvCMhN_.js} +1 -1
  202. package/template/dist/server/assets/{dagre-KLK3FWXG-yZYrVU4p.js → dagre-KLK3FWXG-B5bQP7FL.js} +6 -6
  203. package/template/dist/server/assets/{diagram-E7M64L7V-8Yyz0aw0.js → diagram-E7M64L7V-NjHca90S.js} +8 -8
  204. package/template/dist/server/assets/{diagram-IFDJBPK2-DcxFYI3M.js → diagram-IFDJBPK2-CoTCfBKd.js} +6 -6
  205. package/template/dist/server/assets/{diagram-P4PSJMXO-CehxUcI0.js → diagram-P4PSJMXO-DHvGgYjH.js} +6 -6
  206. package/template/dist/server/assets/{docs.server-7EUAkSBN.js → docs.server-BSH7IvIU.js} +3884 -444
  207. package/template/dist/server/assets/{erDiagram-INFDFZHY-Bu2p1_Pj.js → erDiagram-INFDFZHY-01crajKr.js} +4 -4
  208. package/template/dist/server/assets/{flowDiagram-PKNHOUZH-B_eKR7I0.js → flowDiagram-PKNHOUZH-BkUQ_vxg.js} +6 -6
  209. package/template/dist/server/assets/{ganttDiagram-A5KZAMGK-DP6YEZof.js → ganttDiagram-A5KZAMGK-DvrO-w2P.js} +2 -2
  210. package/template/dist/server/assets/{gitGraph-HDMCJU4V-Bt0qhVL4.js → gitGraph-HDMCJU4V-h9JNaxB7.js} +6 -6
  211. package/template/dist/server/assets/{gitGraphDiagram-K3NZZRJ6-DwvkdYrg.js → gitGraphDiagram-K3NZZRJ6-BoKm6Fm-.js} +7 -7
  212. package/template/dist/server/assets/{graph-BVFNe_k5.js → graph-BoxbfI7Z.js} +2 -2
  213. package/template/dist/server/assets/{index-BvagF3L5.js → index-Jfzi6SZW.js} +2 -2
  214. package/template/dist/server/assets/{info-3K5VOQVL-CFejRnvB.js → info-3K5VOQVL-DgaSHqkS.js} +6 -6
  215. package/template/dist/server/assets/{infoDiagram-LFFYTUFH-D0v9uyXI.js → infoDiagram-LFFYTUFH-DgV5W8-I.js} +5 -5
  216. package/template/dist/server/assets/{ishikawaDiagram-PHBUUO56-DZumspL4.js → ishikawaDiagram-PHBUUO56-CqlMQ0Fq.js} +1 -1
  217. package/template/dist/server/assets/{journeyDiagram-4ABVD52K-nRp_-qZp.js → journeyDiagram-4ABVD52K-D6ySTub8.js} +4 -4
  218. package/template/dist/server/assets/{kanban-definition-K7BYSVSG-BMKyyzjt.js → kanban-definition-K7BYSVSG-BT8m7Cwk.js} +2 -2
  219. package/template/dist/server/assets/{layout-mpiN5R-5.js → layout-CkYcErfn.js} +4 -4
  220. package/template/dist/server/assets/{linear-CqNYgjEx.js → linear-F_0dWGZL.js} +1 -1
  221. package/template/dist/server/assets/{mermaid-parser.core-B8Uu3QZY.js → mermaid-parser.core-q5MdUJuo.js} +11 -11
  222. package/template/dist/server/assets/{mermaid.core-BI3nMhNO.js → mermaid.core-DOWTODR1.js} +31 -31
  223. package/template/dist/server/assets/{mindmap-definition-YRQLILUH-DCoFqLPh.js → mindmap-definition-YRQLILUH-BQxlQqn-.js} +3 -3
  224. package/template/dist/server/assets/{ordinal-Bcam90FY.js → ordinal-CxptdPJm.js} +1 -1
  225. package/template/dist/server/assets/{packet-RMMSAZCW-djgonfKN.js → packet-RMMSAZCW-D8FkLZuP.js} +6 -6
  226. package/template/dist/server/assets/{pie-UPGHQEXC-Dug2t-PE.js → pie-UPGHQEXC-Diw2fHLk.js} +6 -6
  227. package/template/dist/server/assets/{pieDiagram-SKSYHLDU-CS0_hW4w.js → pieDiagram-SKSYHLDU-B1J4UJZ7.js} +8 -8
  228. package/template/dist/server/assets/{quadrantDiagram-337W2JSQ-BpQNM0zu.js → quadrantDiagram-337W2JSQ-BvjKLapg.js} +2 -2
  229. package/template/dist/server/assets/{radar-KQ55EAFF-3ir2W9Wi.js → radar-KQ55EAFF-CcBdPU3n.js} +6 -6
  230. package/template/dist/server/assets/{requirementDiagram-Z7DCOOCP-D92RyjV4.js → requirementDiagram-Z7DCOOCP-Bgr_wnAs.js} +3 -3
  231. package/template/dist/server/assets/{router-DK1vpPhv.js → router-DxwPl-Dc.js} +18 -18
  232. package/template/dist/server/assets/{sankeyDiagram-WA2Y5GQK-DCPRB-xO.js → sankeyDiagram-WA2Y5GQK-B0UwtyW3.js} +2 -2
  233. package/template/dist/server/assets/{sequenceDiagram-2WXFIKYE-C1ab2VvU.js → sequenceDiagram-2WXFIKYE-BbxQJHjO.js} +3 -3
  234. package/template/dist/server/assets/{stateDiagram-RAJIS63D-GhG1G3ff.js → stateDiagram-RAJIS63D-Cg-uJ_UO.js} +8 -8
  235. package/template/dist/server/assets/{stateDiagram-v2-FVOUBMTO-C-KtMadV.js → stateDiagram-v2-FVOUBMTO-BWVPrqfa.js} +4 -4
  236. package/template/dist/server/assets/{timeline-definition-YZTLITO2-DyfAQCd4.js → timeline-definition-YZTLITO2-DCSJT2WT.js} +2 -2
  237. package/template/dist/server/assets/{treemap-KZPCXAKY-Cn0Cw4Cl.js → treemap-KZPCXAKY-a0nhlKgx.js} +6 -6
  238. package/template/dist/server/assets/{vennDiagram-LZ73GAT5-D2Ak5JUa.js → vennDiagram-LZ73GAT5-Bk2HQEQq.js} +1 -1
  239. package/template/dist/server/assets/{xychartDiagram-JWTSCODW-DqoBOs1L.js → xychartDiagram-JWTSCODW-C4svHkt_.js} +3 -3
  240. package/template/dist/server/server.js +16 -16
  241. package/template/package.json +2 -0
  242. package/template/vite.config.ts +33 -18
  243. package/template/wrangler.jsonc +2 -2
  244. package/admin/dist/client/assets/main-CSFhgz4p.js +0 -17
  245. package/admin/dist/client/assets/routes-C6bCOSX-.js +0 -3
  246. package/admin/dist/server/assets/_tanstack-start-manifest_v-BE5XHVZ2.js +0 -17
  247. package/admin/dist/server/assets/redirect-DtfSYi2g.js +0 -51
  248. package/admin/dist/server/assets/status-CZz8Rs_7.js +0 -81
  249. package/template/dist/client/assets/_lang-Cpuy5xmU.js +0 -1
  250. package/template/dist/client/assets/_lang._project-DBdR04In.js +0 -1
  251. package/template/dist/client/assets/_lang._project._version-CtCLMJs2.js +0 -1
  252. package/template/dist/client/assets/_lang._project._version.docs._-CxgRZ17Q.js +0 -1
  253. package/template/dist/client/assets/_lang._project._version.docs.framework._framework._-Qph6wahA.js +0 -1
  254. package/template/dist/client/assets/_lang._project.docs._-C_ZfXEJ7.js +0 -1
  255. package/template/dist/client/assets/_lang.blog-BcRmhv23.js +0 -1
  256. package/template/dist/client/assets/_lang.blog-C5Aa7k5r.js +0 -1
  257. package/template/dist/client/assets/_lang.blog._-BVw4vhtF.js +0 -1
  258. package/template/dist/client/assets/_lang.blog.index-Y35iFzkp.js +0 -1
  259. package/template/dist/client/assets/_lang.docs._-B9hwwoTY.js +0 -1
  260. package/template/dist/client/assets/_lang.docs.framework._framework._-BENbKZIu.js +0 -1
  261. package/template/dist/client/assets/channel-C_1F7tzH.js +0 -1
  262. package/template/dist/client/assets/classDiagram-VBA2DB6C-CqViWWFw.js +0 -1
  263. package/template/dist/client/assets/classDiagram-v2-RAHNMMFH-CqViWWFw.js +0 -1
  264. package/template/dist/client/assets/clone-EeiNAO_N.js +0 -1
  265. package/template/dist/client/assets/ordinal-BENe2yWM.js +0 -1
  266. package/template/dist/client/assets/stateDiagram-v2-FVOUBMTO-CJYWvllO.js +0 -1
  267. /package/admin/dist/server/assets/{createServerRpc-DJq9yo-B.js → createServerRpc-Cyyxq9HQ.js} +0 -0
@@ -0,0 +1,2253 @@
1
+ import { d as logger, l as TTY_COLORS, n as BetterAuthError, p as getColorDepth, u as createLogger } from "./error-CASJ5tIm.js";
2
+ //#region ../../node_modules/.bun/@better-auth+utils@0.3.1/node_modules/@better-auth/utils/dist/random.mjs
3
+ function expandAlphabet(alphabet) {
4
+ switch (alphabet) {
5
+ case "a-z": return "abcdefghijklmnopqrstuvwxyz";
6
+ case "A-Z": return "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
7
+ case "0-9": return "0123456789";
8
+ case "-_": return "-_";
9
+ default: throw new Error(`Unsupported alphabet: ${alphabet}`);
10
+ }
11
+ }
12
+ function createRandomStringGenerator(...baseAlphabets) {
13
+ const baseCharSet = baseAlphabets.map(expandAlphabet).join("");
14
+ if (baseCharSet.length === 0) throw new Error("No valid characters provided for random string generation.");
15
+ const baseCharSetLength = baseCharSet.length;
16
+ return (length, ...alphabets) => {
17
+ if (length <= 0) throw new Error("Length must be a positive integer.");
18
+ let charSet = baseCharSet;
19
+ let charSetLength = baseCharSetLength;
20
+ if (alphabets.length > 0) {
21
+ charSet = alphabets.map(expandAlphabet).join("");
22
+ charSetLength = charSet.length;
23
+ }
24
+ const maxValid = Math.floor(256 / charSetLength) * charSetLength;
25
+ const buf = new Uint8Array(length * 2);
26
+ const bufLength = buf.length;
27
+ let result = "";
28
+ let bufIndex = bufLength;
29
+ let rand;
30
+ while (result.length < length) {
31
+ if (bufIndex >= bufLength) {
32
+ crypto.getRandomValues(buf);
33
+ bufIndex = 0;
34
+ }
35
+ rand = buf[bufIndex++];
36
+ if (rand < maxValid) result += charSet[rand % charSetLength];
37
+ }
38
+ return result;
39
+ };
40
+ }
41
+ //#endregion
42
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/get-tables.mjs
43
+ var getAuthTables = (options) => {
44
+ const pluginSchema = (options.plugins ?? []).reduce((acc, plugin) => {
45
+ const schema = plugin.schema;
46
+ if (!schema) return acc;
47
+ for (const [key, value] of Object.entries(schema)) acc[key] = {
48
+ fields: {
49
+ ...acc[key]?.fields,
50
+ ...value.fields
51
+ },
52
+ modelName: value.modelName || key
53
+ };
54
+ return acc;
55
+ }, {});
56
+ const shouldAddRateLimitTable = options.rateLimit?.storage === "database";
57
+ const rateLimitTable = { rateLimit: {
58
+ modelName: options.rateLimit?.modelName || "rateLimit",
59
+ fields: {
60
+ key: {
61
+ type: "string",
62
+ unique: true,
63
+ required: true,
64
+ fieldName: options.rateLimit?.fields?.key || "key"
65
+ },
66
+ count: {
67
+ type: "number",
68
+ required: true,
69
+ fieldName: options.rateLimit?.fields?.count || "count"
70
+ },
71
+ lastRequest: {
72
+ type: "number",
73
+ bigint: true,
74
+ required: true,
75
+ fieldName: options.rateLimit?.fields?.lastRequest || "lastRequest",
76
+ defaultValue: () => Date.now()
77
+ }
78
+ }
79
+ } };
80
+ const { user, session, account, verification, ...pluginTables } = pluginSchema;
81
+ const verificationTable = { verification: {
82
+ modelName: options.verification?.modelName || "verification",
83
+ fields: {
84
+ identifier: {
85
+ type: "string",
86
+ required: true,
87
+ fieldName: options.verification?.fields?.identifier || "identifier",
88
+ index: true
89
+ },
90
+ value: {
91
+ type: "string",
92
+ required: true,
93
+ fieldName: options.verification?.fields?.value || "value"
94
+ },
95
+ expiresAt: {
96
+ type: "date",
97
+ required: true,
98
+ fieldName: options.verification?.fields?.expiresAt || "expiresAt"
99
+ },
100
+ createdAt: {
101
+ type: "date",
102
+ required: true,
103
+ defaultValue: () => /* @__PURE__ */ new Date(),
104
+ fieldName: options.verification?.fields?.createdAt || "createdAt"
105
+ },
106
+ updatedAt: {
107
+ type: "date",
108
+ required: true,
109
+ defaultValue: () => /* @__PURE__ */ new Date(),
110
+ onUpdate: () => /* @__PURE__ */ new Date(),
111
+ fieldName: options.verification?.fields?.updatedAt || "updatedAt"
112
+ },
113
+ ...verification?.fields,
114
+ ...options.verification?.additionalFields
115
+ },
116
+ order: 4
117
+ } };
118
+ const sessionTable = { session: {
119
+ modelName: options.session?.modelName || "session",
120
+ fields: {
121
+ expiresAt: {
122
+ type: "date",
123
+ required: true,
124
+ fieldName: options.session?.fields?.expiresAt || "expiresAt"
125
+ },
126
+ token: {
127
+ type: "string",
128
+ required: true,
129
+ fieldName: options.session?.fields?.token || "token",
130
+ unique: true
131
+ },
132
+ createdAt: {
133
+ type: "date",
134
+ required: true,
135
+ fieldName: options.session?.fields?.createdAt || "createdAt",
136
+ defaultValue: () => /* @__PURE__ */ new Date()
137
+ },
138
+ updatedAt: {
139
+ type: "date",
140
+ required: true,
141
+ fieldName: options.session?.fields?.updatedAt || "updatedAt",
142
+ onUpdate: () => /* @__PURE__ */ new Date()
143
+ },
144
+ ipAddress: {
145
+ type: "string",
146
+ required: false,
147
+ fieldName: options.session?.fields?.ipAddress || "ipAddress"
148
+ },
149
+ userAgent: {
150
+ type: "string",
151
+ required: false,
152
+ fieldName: options.session?.fields?.userAgent || "userAgent"
153
+ },
154
+ userId: {
155
+ type: "string",
156
+ fieldName: options.session?.fields?.userId || "userId",
157
+ references: {
158
+ model: options.user?.modelName || "user",
159
+ field: "id",
160
+ onDelete: "cascade"
161
+ },
162
+ required: true,
163
+ index: true
164
+ },
165
+ ...session?.fields,
166
+ ...options.session?.additionalFields
167
+ },
168
+ order: 2
169
+ } };
170
+ return {
171
+ user: {
172
+ modelName: options.user?.modelName || "user",
173
+ fields: {
174
+ name: {
175
+ type: "string",
176
+ required: true,
177
+ fieldName: options.user?.fields?.name || "name",
178
+ sortable: true
179
+ },
180
+ email: {
181
+ type: "string",
182
+ unique: true,
183
+ required: true,
184
+ fieldName: options.user?.fields?.email || "email",
185
+ sortable: true
186
+ },
187
+ emailVerified: {
188
+ type: "boolean",
189
+ defaultValue: false,
190
+ required: true,
191
+ fieldName: options.user?.fields?.emailVerified || "emailVerified",
192
+ input: false
193
+ },
194
+ image: {
195
+ type: "string",
196
+ required: false,
197
+ fieldName: options.user?.fields?.image || "image"
198
+ },
199
+ createdAt: {
200
+ type: "date",
201
+ defaultValue: () => /* @__PURE__ */ new Date(),
202
+ required: true,
203
+ fieldName: options.user?.fields?.createdAt || "createdAt"
204
+ },
205
+ updatedAt: {
206
+ type: "date",
207
+ defaultValue: () => /* @__PURE__ */ new Date(),
208
+ onUpdate: () => /* @__PURE__ */ new Date(),
209
+ required: true,
210
+ fieldName: options.user?.fields?.updatedAt || "updatedAt"
211
+ },
212
+ ...user?.fields,
213
+ ...options.user?.additionalFields
214
+ },
215
+ order: 1
216
+ },
217
+ ...!options.secondaryStorage || options.session?.storeSessionInDatabase ? sessionTable : {},
218
+ account: {
219
+ modelName: options.account?.modelName || "account",
220
+ fields: {
221
+ accountId: {
222
+ type: "string",
223
+ required: true,
224
+ fieldName: options.account?.fields?.accountId || "accountId"
225
+ },
226
+ providerId: {
227
+ type: "string",
228
+ required: true,
229
+ fieldName: options.account?.fields?.providerId || "providerId"
230
+ },
231
+ userId: {
232
+ type: "string",
233
+ references: {
234
+ model: options.user?.modelName || "user",
235
+ field: "id",
236
+ onDelete: "cascade"
237
+ },
238
+ required: true,
239
+ fieldName: options.account?.fields?.userId || "userId",
240
+ index: true
241
+ },
242
+ accessToken: {
243
+ type: "string",
244
+ required: false,
245
+ returned: false,
246
+ fieldName: options.account?.fields?.accessToken || "accessToken"
247
+ },
248
+ refreshToken: {
249
+ type: "string",
250
+ required: false,
251
+ returned: false,
252
+ fieldName: options.account?.fields?.refreshToken || "refreshToken"
253
+ },
254
+ idToken: {
255
+ type: "string",
256
+ required: false,
257
+ returned: false,
258
+ fieldName: options.account?.fields?.idToken || "idToken"
259
+ },
260
+ accessTokenExpiresAt: {
261
+ type: "date",
262
+ required: false,
263
+ returned: false,
264
+ fieldName: options.account?.fields?.accessTokenExpiresAt || "accessTokenExpiresAt"
265
+ },
266
+ refreshTokenExpiresAt: {
267
+ type: "date",
268
+ required: false,
269
+ returned: false,
270
+ fieldName: options.account?.fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt"
271
+ },
272
+ scope: {
273
+ type: "string",
274
+ required: false,
275
+ fieldName: options.account?.fields?.scope || "scope"
276
+ },
277
+ password: {
278
+ type: "string",
279
+ required: false,
280
+ returned: false,
281
+ fieldName: options.account?.fields?.password || "password"
282
+ },
283
+ createdAt: {
284
+ type: "date",
285
+ required: true,
286
+ fieldName: options.account?.fields?.createdAt || "createdAt",
287
+ defaultValue: () => /* @__PURE__ */ new Date()
288
+ },
289
+ updatedAt: {
290
+ type: "date",
291
+ required: true,
292
+ fieldName: options.account?.fields?.updatedAt || "updatedAt",
293
+ onUpdate: () => /* @__PURE__ */ new Date()
294
+ },
295
+ ...account?.fields,
296
+ ...options.account?.additionalFields
297
+ },
298
+ order: 3
299
+ },
300
+ ...!options.secondaryStorage || options.verification?.storeInDatabase ? verificationTable : {},
301
+ ...pluginTables,
302
+ ...shouldAddRateLimitTable ? rateLimitTable : {}
303
+ };
304
+ };
305
+ //#endregion
306
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/utils/json.mjs
307
+ var iso8601Regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
308
+ function reviveDate(value) {
309
+ if (typeof value === "string" && iso8601Regex.test(value)) {
310
+ const date = new Date(value);
311
+ if (!isNaN(date.getTime())) return date;
312
+ }
313
+ return value;
314
+ }
315
+ /**
316
+ * Recursively walk a pre-parsed object and convert ISO 8601 date strings
317
+ * to Date instances. This handles the case where a Redis client (or similar)
318
+ * returns already-parsed JSON objects whose date fields are still strings.
319
+ */
320
+ function reviveDates(value) {
321
+ if (value === null || value === void 0) return value;
322
+ if (typeof value === "string") return reviveDate(value);
323
+ if (value instanceof Date) return value;
324
+ if (Array.isArray(value)) return value.map(reviveDates);
325
+ if (typeof value === "object") {
326
+ const result = {};
327
+ for (const key of Object.keys(value)) result[key] = reviveDates(value[key]);
328
+ return result;
329
+ }
330
+ return value;
331
+ }
332
+ function safeJSONParse(data) {
333
+ try {
334
+ if (typeof data !== "string") {
335
+ if (data === null || data === void 0) return null;
336
+ return reviveDates(data);
337
+ }
338
+ return JSON.parse(data, (_, value) => reviveDate(value));
339
+ } catch (e) {
340
+ logger.error("Error parsing JSON", { error: e });
341
+ return null;
342
+ }
343
+ }
344
+ //#endregion
345
+ //#region ../../node_modules/.bun/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js
346
+ /**
347
+ * The name of a collection (table, container) within the database.
348
+ *
349
+ * @example public.users
350
+ * @example customers
351
+ *
352
+ * @note It is **RECOMMENDED** to capture the value as provided by the application
353
+ * without attempting to do any case normalization.
354
+ *
355
+ * The collection name **SHOULD NOT** be extracted from `db.query.text`,
356
+ * when the database system supports query text with multiple collections
357
+ * in non-batch operations.
358
+ *
359
+ * For batch operations, if the individual operations are known to have the same
360
+ * collection name then that collection name **SHOULD** be used.
361
+ */
362
+ var ATTR_DB_COLLECTION_NAME = "db.collection.name";
363
+ /**
364
+ * The name of the operation or command being executed.
365
+ *
366
+ * @example findAndModify
367
+ * @example HMSET
368
+ * @example SELECT
369
+ *
370
+ * @note It is **RECOMMENDED** to capture the value as provided by the application
371
+ * without attempting to do any case normalization.
372
+ *
373
+ * The operation name **SHOULD NOT** be extracted from `db.query.text`,
374
+ * when the database system supports query text with multiple operations
375
+ * in non-batch operations.
376
+ *
377
+ * If spaces can occur in the operation name, multiple consecutive spaces
378
+ * **SHOULD** be normalized to a single space.
379
+ *
380
+ * For batch operations, if the individual operations are known to have the same operation name
381
+ * then that operation name **SHOULD** be used prepended by `BATCH `,
382
+ * otherwise `db.operation.name` **SHOULD** be `BATCH` or some other database
383
+ * system specific term if more applicable.
384
+ */
385
+ var ATTR_DB_OPERATION_NAME = "db.operation.name";
386
+ /**
387
+ * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
388
+ *
389
+ * @example 200
390
+ */
391
+ var ATTR_HTTP_RESPONSE_STATUS_CODE = "http.response.status_code";
392
+ /**
393
+ * The matched route template for the request. This **MUST** be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders.
394
+ *
395
+ * @example /users/:userID?
396
+ * @example my-controller/my-action/{id?}
397
+ *
398
+ * @note **MUST NOT** be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it.
399
+ * **SHOULD** include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one.
400
+ *
401
+ * A static path segment is a part of the route template with a fixed, low-cardinality value. This includes literal strings like `/users/` and placeholders that
402
+ * are constrained to a finite, predefined set of values, e.g. `{controller}` or `{action}`.
403
+ *
404
+ * A dynamic path segment is a placeholder for a value that can have high cardinality and is not constrained to a predefined list like static path segments.
405
+ *
406
+ * Instrumentations **SHOULD** use routing information provided by the corresponding web framework. They **SHOULD** pick the most precise source of routing information and **MAY**
407
+ * support custom route formatting. Instrumentations **SHOULD** document the format and the API used to obtain the route string.
408
+ */
409
+ var ATTR_HTTP_ROUTE = "http.route";
410
+ //#endregion
411
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/instrumentation/attributes.mjs
412
+ /** Operation identifier (e.g. getSession, signUpWithEmailAndPassword). Uses endpoint operationId when set, otherwise the endpoint key. */
413
+ var ATTR_OPERATION_ID = "better_auth.operation_id";
414
+ /** Hook type (e.g. before, after, create.before). */
415
+ var ATTR_HOOK_TYPE = "better_auth.hook.type";
416
+ /** Execution context (e.g. user, plugin:id). */
417
+ var ATTR_CONTEXT = "better_auth.context";
418
+ //#endregion
419
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
420
+ /** only globals that common to node and browsers are allowed */
421
+ var _globalThis = typeof globalThis === "object" ? globalThis : global;
422
+ //#endregion
423
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/version.js
424
+ var VERSION = "1.9.0";
425
+ //#endregion
426
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/internal/semver.js
427
+ var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
428
+ /**
429
+ * Create a function to test an API version to see if it is compatible with the provided ownVersion.
430
+ *
431
+ * The returned function has the following semantics:
432
+ * - Exact match is always compatible
433
+ * - Major versions must match exactly
434
+ * - 1.x package cannot use global 2.x package
435
+ * - 2.x package cannot use global 1.x package
436
+ * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API
437
+ * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects
438
+ * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3
439
+ * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor
440
+ * - Patch and build tag differences are not considered at this time
441
+ *
442
+ * @param ownVersion version which should be checked against
443
+ */
444
+ function _makeCompatibilityCheck(ownVersion) {
445
+ var acceptedVersions = new Set([ownVersion]);
446
+ var rejectedVersions = /* @__PURE__ */ new Set();
447
+ var myVersionMatch = ownVersion.match(re);
448
+ if (!myVersionMatch) return function() {
449
+ return false;
450
+ };
451
+ var ownVersionParsed = {
452
+ major: +myVersionMatch[1],
453
+ minor: +myVersionMatch[2],
454
+ patch: +myVersionMatch[3],
455
+ prerelease: myVersionMatch[4]
456
+ };
457
+ if (ownVersionParsed.prerelease != null) return function isExactmatch(globalVersion) {
458
+ return globalVersion === ownVersion;
459
+ };
460
+ function _reject(v) {
461
+ rejectedVersions.add(v);
462
+ return false;
463
+ }
464
+ function _accept(v) {
465
+ acceptedVersions.add(v);
466
+ return true;
467
+ }
468
+ return function isCompatible(globalVersion) {
469
+ if (acceptedVersions.has(globalVersion)) return true;
470
+ if (rejectedVersions.has(globalVersion)) return false;
471
+ var globalVersionMatch = globalVersion.match(re);
472
+ if (!globalVersionMatch) return _reject(globalVersion);
473
+ var globalVersionParsed = {
474
+ major: +globalVersionMatch[1],
475
+ minor: +globalVersionMatch[2],
476
+ patch: +globalVersionMatch[3],
477
+ prerelease: globalVersionMatch[4]
478
+ };
479
+ if (globalVersionParsed.prerelease != null) return _reject(globalVersion);
480
+ if (ownVersionParsed.major !== globalVersionParsed.major) return _reject(globalVersion);
481
+ if (ownVersionParsed.major === 0) {
482
+ if (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) return _accept(globalVersion);
483
+ return _reject(globalVersion);
484
+ }
485
+ if (ownVersionParsed.minor <= globalVersionParsed.minor) return _accept(globalVersion);
486
+ return _reject(globalVersion);
487
+ };
488
+ }
489
+ /**
490
+ * Test an API version to see if it is compatible with this API.
491
+ *
492
+ * - Exact match is always compatible
493
+ * - Major versions must match exactly
494
+ * - 1.x package cannot use global 2.x package
495
+ * - 2.x package cannot use global 1.x package
496
+ * - The minor version of the API module requesting access to the global API must be less than or equal to the minor version of this API
497
+ * - 1.3 package may use 1.4 global because the later global contains all functions 1.3 expects
498
+ * - 1.4 package may NOT use 1.3 global because it may try to call functions which don't exist on 1.3
499
+ * - If the major version is 0, the minor version is treated as the major and the patch is treated as the minor
500
+ * - Patch and build tag differences are not considered at this time
501
+ *
502
+ * @param version version of the API requesting an instance of the global API
503
+ */
504
+ var isCompatible = _makeCompatibilityCheck(VERSION);
505
+ //#endregion
506
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
507
+ var major = VERSION.split(".")[0];
508
+ var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
509
+ var _global = _globalThis;
510
+ function registerGlobal(type, instance, diag, allowOverride) {
511
+ var _a;
512
+ if (allowOverride === void 0) allowOverride = false;
513
+ var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : { version: VERSION };
514
+ if (!allowOverride && api[type]) {
515
+ var err = /* @__PURE__ */ new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type);
516
+ diag.error(err.stack || err.message);
517
+ return false;
518
+ }
519
+ if (api.version !== "1.9.0") {
520
+ var err = /* @__PURE__ */ new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type + " does not match previously registered API v" + VERSION);
521
+ diag.error(err.stack || err.message);
522
+ return false;
523
+ }
524
+ api[type] = instance;
525
+ diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + VERSION + ".");
526
+ return true;
527
+ }
528
+ function getGlobal(type) {
529
+ var _a, _b;
530
+ var globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
531
+ if (!globalVersion || !isCompatible(globalVersion)) return;
532
+ return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
533
+ }
534
+ function unregisterGlobal(type, diag) {
535
+ diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION + ".");
536
+ var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
537
+ if (api) delete api[type];
538
+ }
539
+ //#endregion
540
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
541
+ var __read$3 = function(o, n) {
542
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
543
+ if (!m) return o;
544
+ var i = m.call(o), r, ar = [], e;
545
+ try {
546
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
547
+ } catch (error) {
548
+ e = { error };
549
+ } finally {
550
+ try {
551
+ if (r && !r.done && (m = i["return"])) m.call(i);
552
+ } finally {
553
+ if (e) throw e.error;
554
+ }
555
+ }
556
+ return ar;
557
+ };
558
+ var __spreadArray$3 = function(to, from, pack) {
559
+ if (pack || arguments.length === 2) {
560
+ for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
561
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
562
+ ar[i] = from[i];
563
+ }
564
+ }
565
+ return to.concat(ar || Array.prototype.slice.call(from));
566
+ };
567
+ /**
568
+ * Component Logger which is meant to be used as part of any component which
569
+ * will add automatically additional namespace in front of the log message.
570
+ * It will then forward all message to global diag logger
571
+ * @example
572
+ * const cLogger = diag.createComponentLogger({ namespace: '@opentelemetry/instrumentation-http' });
573
+ * cLogger.debug('test');
574
+ * // @opentelemetry/instrumentation-http test
575
+ */
576
+ var DiagComponentLogger = function() {
577
+ function DiagComponentLogger(props) {
578
+ this._namespace = props.namespace || "DiagComponentLogger";
579
+ }
580
+ DiagComponentLogger.prototype.debug = function() {
581
+ var args = [];
582
+ for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
583
+ return logProxy("debug", this._namespace, args);
584
+ };
585
+ DiagComponentLogger.prototype.error = function() {
586
+ var args = [];
587
+ for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
588
+ return logProxy("error", this._namespace, args);
589
+ };
590
+ DiagComponentLogger.prototype.info = function() {
591
+ var args = [];
592
+ for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
593
+ return logProxy("info", this._namespace, args);
594
+ };
595
+ DiagComponentLogger.prototype.warn = function() {
596
+ var args = [];
597
+ for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
598
+ return logProxy("warn", this._namespace, args);
599
+ };
600
+ DiagComponentLogger.prototype.verbose = function() {
601
+ var args = [];
602
+ for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
603
+ return logProxy("verbose", this._namespace, args);
604
+ };
605
+ return DiagComponentLogger;
606
+ }();
607
+ function logProxy(funcName, namespace, args) {
608
+ var logger = getGlobal("diag");
609
+ if (!logger) return;
610
+ args.unshift(namespace);
611
+ return logger[funcName].apply(logger, __spreadArray$3([], __read$3(args), false));
612
+ }
613
+ //#endregion
614
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/types.js
615
+ /**
616
+ * Defines the available internal logging levels for the diagnostic logger, the numeric values
617
+ * of the levels are defined to match the original values from the initial LogLevel to avoid
618
+ * compatibility/migration issues for any implementation that assume the numeric ordering.
619
+ */
620
+ var DiagLogLevel;
621
+ (function(DiagLogLevel) {
622
+ /** Diagnostic Logging level setting to disable all logging (except and forced logs) */
623
+ DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
624
+ /** Identifies an error scenario */
625
+ DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR";
626
+ /** Identifies a warning scenario */
627
+ DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN";
628
+ /** General informational log message */
629
+ DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO";
630
+ /** General debug log message */
631
+ DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG";
632
+ /**
633
+ * Detailed trace level logging should only be used for development, should only be set
634
+ * in a development environment.
635
+ */
636
+ DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
637
+ /** Used to set the logging level to include all logging */
638
+ DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
639
+ })(DiagLogLevel || (DiagLogLevel = {}));
640
+ //#endregion
641
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
642
+ function createLogLevelDiagLogger(maxLevel, logger) {
643
+ if (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;
644
+ else if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;
645
+ logger = logger || {};
646
+ function _filterFunc(funcName, theLevel) {
647
+ var theFunc = logger[funcName];
648
+ if (typeof theFunc === "function" && maxLevel >= theLevel) return theFunc.bind(logger);
649
+ return function() {};
650
+ }
651
+ return {
652
+ error: _filterFunc("error", DiagLogLevel.ERROR),
653
+ warn: _filterFunc("warn", DiagLogLevel.WARN),
654
+ info: _filterFunc("info", DiagLogLevel.INFO),
655
+ debug: _filterFunc("debug", DiagLogLevel.DEBUG),
656
+ verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
657
+ };
658
+ }
659
+ //#endregion
660
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/diag.js
661
+ var __read$2 = function(o, n) {
662
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
663
+ if (!m) return o;
664
+ var i = m.call(o), r, ar = [], e;
665
+ try {
666
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
667
+ } catch (error) {
668
+ e = { error };
669
+ } finally {
670
+ try {
671
+ if (r && !r.done && (m = i["return"])) m.call(i);
672
+ } finally {
673
+ if (e) throw e.error;
674
+ }
675
+ }
676
+ return ar;
677
+ };
678
+ var __spreadArray$2 = function(to, from, pack) {
679
+ if (pack || arguments.length === 2) {
680
+ for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
681
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
682
+ ar[i] = from[i];
683
+ }
684
+ }
685
+ return to.concat(ar || Array.prototype.slice.call(from));
686
+ };
687
+ var API_NAME$2 = "diag";
688
+ /**
689
+ * Singleton object which represents the entry point to the OpenTelemetry internal
690
+ * diagnostic API
691
+ */
692
+ var DiagAPI = function() {
693
+ /**
694
+ * Private internal constructor
695
+ * @private
696
+ */
697
+ function DiagAPI() {
698
+ function _logProxy(funcName) {
699
+ return function() {
700
+ var args = [];
701
+ for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
702
+ var logger = getGlobal("diag");
703
+ if (!logger) return;
704
+ return logger[funcName].apply(logger, __spreadArray$2([], __read$2(args), false));
705
+ };
706
+ }
707
+ var self = this;
708
+ var setLogger = function(logger, optionsOrLogLevel) {
709
+ var _a, _b, _c;
710
+ if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
711
+ if (logger === self) {
712
+ var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
713
+ self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
714
+ return false;
715
+ }
716
+ if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
717
+ var oldLogger = getGlobal("diag");
718
+ var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
719
+ if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
720
+ var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
721
+ oldLogger.warn("Current logger will be overwritten from " + stack);
722
+ newLogger.warn("Current logger will overwrite one already registered from " + stack);
723
+ }
724
+ return registerGlobal("diag", newLogger, self, true);
725
+ };
726
+ self.setLogger = setLogger;
727
+ self.disable = function() {
728
+ unregisterGlobal(API_NAME$2, self);
729
+ };
730
+ self.createComponentLogger = function(options) {
731
+ return new DiagComponentLogger(options);
732
+ };
733
+ self.verbose = _logProxy("verbose");
734
+ self.debug = _logProxy("debug");
735
+ self.info = _logProxy("info");
736
+ self.warn = _logProxy("warn");
737
+ self.error = _logProxy("error");
738
+ }
739
+ /** Get the singleton instance of the DiagAPI API */
740
+ DiagAPI.instance = function() {
741
+ if (!this._instance) this._instance = new DiagAPI();
742
+ return this._instance;
743
+ };
744
+ return DiagAPI;
745
+ }();
746
+ //#endregion
747
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context/context.js
748
+ /** Get a key to uniquely identify a context value */
749
+ function createContextKey(description) {
750
+ return Symbol.for(description);
751
+ }
752
+ /** The root context is used as the default parent context when there is no active context */
753
+ var ROOT_CONTEXT = new (function() {
754
+ /**
755
+ * Construct a new context which inherits values from an optional parent context.
756
+ *
757
+ * @param parentContext a context from which to inherit values
758
+ */
759
+ function BaseContext(parentContext) {
760
+ var self = this;
761
+ self._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
762
+ self.getValue = function(key) {
763
+ return self._currentContext.get(key);
764
+ };
765
+ self.setValue = function(key, value) {
766
+ var context = new BaseContext(self._currentContext);
767
+ context._currentContext.set(key, value);
768
+ return context;
769
+ };
770
+ self.deleteValue = function(key) {
771
+ var context = new BaseContext(self._currentContext);
772
+ context._currentContext.delete(key);
773
+ return context;
774
+ };
775
+ }
776
+ return BaseContext;
777
+ }())();
778
+ //#endregion
779
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
780
+ var __read$1 = function(o, n) {
781
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
782
+ if (!m) return o;
783
+ var i = m.call(o), r, ar = [], e;
784
+ try {
785
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
786
+ } catch (error) {
787
+ e = { error };
788
+ } finally {
789
+ try {
790
+ if (r && !r.done && (m = i["return"])) m.call(i);
791
+ } finally {
792
+ if (e) throw e.error;
793
+ }
794
+ }
795
+ return ar;
796
+ };
797
+ var __spreadArray$1 = function(to, from, pack) {
798
+ if (pack || arguments.length === 2) {
799
+ for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
800
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
801
+ ar[i] = from[i];
802
+ }
803
+ }
804
+ return to.concat(ar || Array.prototype.slice.call(from));
805
+ };
806
+ var NoopContextManager = function() {
807
+ function NoopContextManager() {}
808
+ NoopContextManager.prototype.active = function() {
809
+ return ROOT_CONTEXT;
810
+ };
811
+ NoopContextManager.prototype.with = function(_context, fn, thisArg) {
812
+ var args = [];
813
+ for (var _i = 3; _i < arguments.length; _i++) args[_i - 3] = arguments[_i];
814
+ return fn.call.apply(fn, __spreadArray$1([thisArg], __read$1(args), false));
815
+ };
816
+ NoopContextManager.prototype.bind = function(_context, target) {
817
+ return target;
818
+ };
819
+ NoopContextManager.prototype.enable = function() {
820
+ return this;
821
+ };
822
+ NoopContextManager.prototype.disable = function() {
823
+ return this;
824
+ };
825
+ return NoopContextManager;
826
+ }();
827
+ //#endregion
828
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/context.js
829
+ var __read = function(o, n) {
830
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
831
+ if (!m) return o;
832
+ var i = m.call(o), r, ar = [], e;
833
+ try {
834
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
835
+ } catch (error) {
836
+ e = { error };
837
+ } finally {
838
+ try {
839
+ if (r && !r.done && (m = i["return"])) m.call(i);
840
+ } finally {
841
+ if (e) throw e.error;
842
+ }
843
+ }
844
+ return ar;
845
+ };
846
+ var __spreadArray = function(to, from, pack) {
847
+ if (pack || arguments.length === 2) {
848
+ for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
849
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
850
+ ar[i] = from[i];
851
+ }
852
+ }
853
+ return to.concat(ar || Array.prototype.slice.call(from));
854
+ };
855
+ var API_NAME$1 = "context";
856
+ var NOOP_CONTEXT_MANAGER = new NoopContextManager();
857
+ /**
858
+ * Singleton object which represents the entry point to the OpenTelemetry Context API
859
+ */
860
+ var ContextAPI = function() {
861
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
862
+ function ContextAPI() {}
863
+ /** Get the singleton instance of the Context API */
864
+ ContextAPI.getInstance = function() {
865
+ if (!this._instance) this._instance = new ContextAPI();
866
+ return this._instance;
867
+ };
868
+ /**
869
+ * Set the current context manager.
870
+ *
871
+ * @returns true if the context manager was successfully registered, else false
872
+ */
873
+ ContextAPI.prototype.setGlobalContextManager = function(contextManager) {
874
+ return registerGlobal(API_NAME$1, contextManager, DiagAPI.instance());
875
+ };
876
+ /**
877
+ * Get the currently active context
878
+ */
879
+ ContextAPI.prototype.active = function() {
880
+ return this._getContextManager().active();
881
+ };
882
+ /**
883
+ * Execute a function with an active context
884
+ *
885
+ * @param context context to be active during function execution
886
+ * @param fn function to execute in a context
887
+ * @param thisArg optional receiver to be used for calling fn
888
+ * @param args optional arguments forwarded to fn
889
+ */
890
+ ContextAPI.prototype.with = function(context, fn, thisArg) {
891
+ var _a;
892
+ var args = [];
893
+ for (var _i = 3; _i < arguments.length; _i++) args[_i - 3] = arguments[_i];
894
+ return (_a = this._getContextManager()).with.apply(_a, __spreadArray([
895
+ context,
896
+ fn,
897
+ thisArg
898
+ ], __read(args), false));
899
+ };
900
+ /**
901
+ * Bind a context to a target function or event emitter
902
+ *
903
+ * @param context context to bind to the event emitter or function. Defaults to the currently active context
904
+ * @param target function or event emitter to bind
905
+ */
906
+ ContextAPI.prototype.bind = function(context, target) {
907
+ return this._getContextManager().bind(context, target);
908
+ };
909
+ ContextAPI.prototype._getContextManager = function() {
910
+ return getGlobal(API_NAME$1) || NOOP_CONTEXT_MANAGER;
911
+ };
912
+ /** Disable and remove the global context manager */
913
+ ContextAPI.prototype.disable = function() {
914
+ this._getContextManager().disable();
915
+ unregisterGlobal(API_NAME$1, DiagAPI.instance());
916
+ };
917
+ return ContextAPI;
918
+ }();
919
+ //#endregion
920
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
921
+ var TraceFlags;
922
+ (function(TraceFlags) {
923
+ /** Represents no flag set. */
924
+ TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
925
+ /** Bit to represent whether trace is sampled in trace flags. */
926
+ TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
927
+ })(TraceFlags || (TraceFlags = {}));
928
+ var INVALID_SPAN_CONTEXT = {
929
+ traceId: "00000000000000000000000000000000",
930
+ spanId: "0000000000000000",
931
+ traceFlags: TraceFlags.NONE
932
+ };
933
+ //#endregion
934
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
935
+ /**
936
+ * The NonRecordingSpan is the default {@link Span} that is used when no Span
937
+ * implementation is available. All operations are no-op including context
938
+ * propagation.
939
+ */
940
+ var NonRecordingSpan = function() {
941
+ function NonRecordingSpan(_spanContext) {
942
+ if (_spanContext === void 0) _spanContext = INVALID_SPAN_CONTEXT;
943
+ this._spanContext = _spanContext;
944
+ }
945
+ NonRecordingSpan.prototype.spanContext = function() {
946
+ return this._spanContext;
947
+ };
948
+ NonRecordingSpan.prototype.setAttribute = function(_key, _value) {
949
+ return this;
950
+ };
951
+ NonRecordingSpan.prototype.setAttributes = function(_attributes) {
952
+ return this;
953
+ };
954
+ NonRecordingSpan.prototype.addEvent = function(_name, _attributes) {
955
+ return this;
956
+ };
957
+ NonRecordingSpan.prototype.addLink = function(_link) {
958
+ return this;
959
+ };
960
+ NonRecordingSpan.prototype.addLinks = function(_links) {
961
+ return this;
962
+ };
963
+ NonRecordingSpan.prototype.setStatus = function(_status) {
964
+ return this;
965
+ };
966
+ NonRecordingSpan.prototype.updateName = function(_name) {
967
+ return this;
968
+ };
969
+ NonRecordingSpan.prototype.end = function(_endTime) {};
970
+ NonRecordingSpan.prototype.isRecording = function() {
971
+ return false;
972
+ };
973
+ NonRecordingSpan.prototype.recordException = function(_exception, _time) {};
974
+ return NonRecordingSpan;
975
+ }();
976
+ //#endregion
977
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
978
+ /**
979
+ * span key
980
+ */
981
+ var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
982
+ /**
983
+ * Return the span if one exists
984
+ *
985
+ * @param context context to get span from
986
+ */
987
+ function getSpan(context) {
988
+ return context.getValue(SPAN_KEY) || void 0;
989
+ }
990
+ /**
991
+ * Gets the span from the current context, if one exists.
992
+ */
993
+ function getActiveSpan() {
994
+ return getSpan(ContextAPI.getInstance().active());
995
+ }
996
+ /**
997
+ * Set the span on a context
998
+ *
999
+ * @param context context to use as parent
1000
+ * @param span span to set active
1001
+ */
1002
+ function setSpan(context, span) {
1003
+ return context.setValue(SPAN_KEY, span);
1004
+ }
1005
+ /**
1006
+ * Remove current span stored in the context
1007
+ *
1008
+ * @param context context to delete span from
1009
+ */
1010
+ function deleteSpan(context) {
1011
+ return context.deleteValue(SPAN_KEY);
1012
+ }
1013
+ /**
1014
+ * Wrap span context in a NoopSpan and set as span in a new
1015
+ * context
1016
+ *
1017
+ * @param context context to set active span on
1018
+ * @param spanContext span context to be wrapped
1019
+ */
1020
+ function setSpanContext(context, spanContext) {
1021
+ return setSpan(context, new NonRecordingSpan(spanContext));
1022
+ }
1023
+ /**
1024
+ * Get the span context of the span if it exists.
1025
+ *
1026
+ * @param context context to get values from
1027
+ */
1028
+ function getSpanContext(context) {
1029
+ var _a;
1030
+ return (_a = getSpan(context)) === null || _a === void 0 ? void 0 : _a.spanContext();
1031
+ }
1032
+ //#endregion
1033
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
1034
+ var VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;
1035
+ var VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
1036
+ function isValidTraceId(traceId) {
1037
+ return VALID_TRACEID_REGEX.test(traceId) && traceId !== "00000000000000000000000000000000";
1038
+ }
1039
+ function isValidSpanId(spanId) {
1040
+ return VALID_SPANID_REGEX.test(spanId) && spanId !== "0000000000000000";
1041
+ }
1042
+ /**
1043
+ * Returns true if this {@link SpanContext} is valid.
1044
+ * @return true if this {@link SpanContext} is valid.
1045
+ */
1046
+ function isSpanContextValid(spanContext) {
1047
+ return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
1048
+ }
1049
+ /**
1050
+ * Wrap the given {@link SpanContext} in a new non-recording {@link Span}
1051
+ *
1052
+ * @param spanContext span context to be wrapped
1053
+ * @returns a new non-recording {@link Span} with the provided context
1054
+ */
1055
+ function wrapSpanContext(spanContext) {
1056
+ return new NonRecordingSpan(spanContext);
1057
+ }
1058
+ //#endregion
1059
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
1060
+ var contextApi = ContextAPI.getInstance();
1061
+ /**
1062
+ * No-op implementations of {@link Tracer}.
1063
+ */
1064
+ var NoopTracer = function() {
1065
+ function NoopTracer() {}
1066
+ NoopTracer.prototype.startSpan = function(name, options, context) {
1067
+ if (context === void 0) context = contextApi.active();
1068
+ if (Boolean(options === null || options === void 0 ? void 0 : options.root)) return new NonRecordingSpan();
1069
+ var parentFromContext = context && getSpanContext(context);
1070
+ if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) return new NonRecordingSpan(parentFromContext);
1071
+ else return new NonRecordingSpan();
1072
+ };
1073
+ NoopTracer.prototype.startActiveSpan = function(name, arg2, arg3, arg4) {
1074
+ var opts;
1075
+ var ctx;
1076
+ var fn;
1077
+ if (arguments.length < 2) return;
1078
+ else if (arguments.length === 2) fn = arg2;
1079
+ else if (arguments.length === 3) {
1080
+ opts = arg2;
1081
+ fn = arg3;
1082
+ } else {
1083
+ opts = arg2;
1084
+ ctx = arg3;
1085
+ fn = arg4;
1086
+ }
1087
+ var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
1088
+ var span = this.startSpan(name, opts, parentContext);
1089
+ var contextWithSpanSet = setSpan(parentContext, span);
1090
+ return contextApi.with(contextWithSpanSet, fn, void 0, span);
1091
+ };
1092
+ return NoopTracer;
1093
+ }();
1094
+ function isSpanContext(spanContext) {
1095
+ return typeof spanContext === "object" && typeof spanContext["spanId"] === "string" && typeof spanContext["traceId"] === "string" && typeof spanContext["traceFlags"] === "number";
1096
+ }
1097
+ //#endregion
1098
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
1099
+ var NOOP_TRACER = new NoopTracer();
1100
+ /**
1101
+ * Proxy tracer provided by the proxy tracer provider
1102
+ */
1103
+ var ProxyTracer = function() {
1104
+ function ProxyTracer(_provider, name, version, options) {
1105
+ this._provider = _provider;
1106
+ this.name = name;
1107
+ this.version = version;
1108
+ this.options = options;
1109
+ }
1110
+ ProxyTracer.prototype.startSpan = function(name, options, context) {
1111
+ return this._getTracer().startSpan(name, options, context);
1112
+ };
1113
+ ProxyTracer.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
1114
+ var tracer = this._getTracer();
1115
+ return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
1116
+ };
1117
+ /**
1118
+ * Try to get a tracer from the proxy tracer provider.
1119
+ * If the proxy tracer provider has no delegate, return a noop tracer.
1120
+ */
1121
+ ProxyTracer.prototype._getTracer = function() {
1122
+ if (this._delegate) return this._delegate;
1123
+ var tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
1124
+ if (!tracer) return NOOP_TRACER;
1125
+ this._delegate = tracer;
1126
+ return this._delegate;
1127
+ };
1128
+ return ProxyTracer;
1129
+ }();
1130
+ //#endregion
1131
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
1132
+ var NOOP_TRACER_PROVIDER = new (function() {
1133
+ function NoopTracerProvider() {}
1134
+ NoopTracerProvider.prototype.getTracer = function(_name, _version, _options) {
1135
+ return new NoopTracer();
1136
+ };
1137
+ return NoopTracerProvider;
1138
+ }())();
1139
+ /**
1140
+ * Tracer provider which provides {@link ProxyTracer}s.
1141
+ *
1142
+ * Before a delegate is set, tracers provided are NoOp.
1143
+ * When a delegate is set, traces are provided from the delegate.
1144
+ * When a delegate is set after tracers have already been provided,
1145
+ * all tracers already provided will use the provided delegate implementation.
1146
+ */
1147
+ var ProxyTracerProvider = function() {
1148
+ function ProxyTracerProvider() {}
1149
+ /**
1150
+ * Get a {@link ProxyTracer}
1151
+ */
1152
+ ProxyTracerProvider.prototype.getTracer = function(name, version, options) {
1153
+ var _a;
1154
+ return (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);
1155
+ };
1156
+ ProxyTracerProvider.prototype.getDelegate = function() {
1157
+ var _a;
1158
+ return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
1159
+ };
1160
+ /**
1161
+ * Set the delegate tracer provider
1162
+ */
1163
+ ProxyTracerProvider.prototype.setDelegate = function(delegate) {
1164
+ this._delegate = delegate;
1165
+ };
1166
+ ProxyTracerProvider.prototype.getDelegateTracer = function(name, version, options) {
1167
+ var _a;
1168
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
1169
+ };
1170
+ return ProxyTracerProvider;
1171
+ }();
1172
+ //#endregion
1173
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/status.js
1174
+ /**
1175
+ * An enumeration of status codes.
1176
+ */
1177
+ var SpanStatusCode;
1178
+ (function(SpanStatusCode) {
1179
+ /**
1180
+ * The default status.
1181
+ */
1182
+ SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
1183
+ /**
1184
+ * The operation has been validated by an Application developer or
1185
+ * Operator to have completed successfully.
1186
+ */
1187
+ SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
1188
+ /**
1189
+ * The operation contains an error.
1190
+ */
1191
+ SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
1192
+ })(SpanStatusCode || (SpanStatusCode = {}));
1193
+ //#endregion
1194
+ //#region ../../node_modules/.bun/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/trace.js
1195
+ var API_NAME = "trace";
1196
+ //#endregion
1197
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/instrumentation/tracer.mjs
1198
+ var tracer = function() {
1199
+ /** Empty private constructor prevents end users from constructing a new instance of the API */
1200
+ function TraceAPI() {
1201
+ this._proxyTracerProvider = new ProxyTracerProvider();
1202
+ this.wrapSpanContext = wrapSpanContext;
1203
+ this.isSpanContextValid = isSpanContextValid;
1204
+ this.deleteSpan = deleteSpan;
1205
+ this.getSpan = getSpan;
1206
+ this.getActiveSpan = getActiveSpan;
1207
+ this.getSpanContext = getSpanContext;
1208
+ this.setSpan = setSpan;
1209
+ this.setSpanContext = setSpanContext;
1210
+ }
1211
+ /** Get the singleton instance of the Trace API */
1212
+ TraceAPI.getInstance = function() {
1213
+ if (!this._instance) this._instance = new TraceAPI();
1214
+ return this._instance;
1215
+ };
1216
+ /**
1217
+ * Set the current global tracer.
1218
+ *
1219
+ * @returns true if the tracer provider was successfully registered, else false
1220
+ */
1221
+ TraceAPI.prototype.setGlobalTracerProvider = function(provider) {
1222
+ var success = registerGlobal(API_NAME, this._proxyTracerProvider, DiagAPI.instance());
1223
+ if (success) this._proxyTracerProvider.setDelegate(provider);
1224
+ return success;
1225
+ };
1226
+ /**
1227
+ * Returns the global tracer provider.
1228
+ */
1229
+ TraceAPI.prototype.getTracerProvider = function() {
1230
+ return getGlobal(API_NAME) || this._proxyTracerProvider;
1231
+ };
1232
+ /**
1233
+ * Returns a tracer from the global tracer provider.
1234
+ */
1235
+ TraceAPI.prototype.getTracer = function(name, version) {
1236
+ return this.getTracerProvider().getTracer(name, version);
1237
+ };
1238
+ /** Remove the global tracer provider */
1239
+ TraceAPI.prototype.disable = function() {
1240
+ unregisterGlobal(API_NAME, DiagAPI.instance());
1241
+ this._proxyTracerProvider = new ProxyTracerProvider();
1242
+ };
1243
+ return TraceAPI;
1244
+ }().getInstance().getTracer("better-auth", "1.5.6");
1245
+ function withSpan(name, attributes, fn) {
1246
+ return tracer.startActiveSpan(name, { attributes }, (span) => {
1247
+ try {
1248
+ const result = fn();
1249
+ if (result instanceof Promise) return result.then((value) => {
1250
+ span.end();
1251
+ return value;
1252
+ }).catch((err) => {
1253
+ span.recordException(err);
1254
+ span.setStatus({
1255
+ code: SpanStatusCode.ERROR,
1256
+ message: String(err.message ?? err)
1257
+ });
1258
+ span.end();
1259
+ throw err;
1260
+ });
1261
+ span.end();
1262
+ return result;
1263
+ } catch (err) {
1264
+ span.recordException(err);
1265
+ span.setStatus({
1266
+ code: SpanStatusCode.ERROR,
1267
+ message: String(err?.message ?? err)
1268
+ });
1269
+ span.end();
1270
+ throw err;
1271
+ }
1272
+ });
1273
+ }
1274
+ //#endregion
1275
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/utils/id.mjs
1276
+ var generateId = (size) => {
1277
+ return createRandomStringGenerator("a-z", "A-Z", "0-9")(size || 32);
1278
+ };
1279
+ //#endregion
1280
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.mjs
1281
+ var initGetDefaultModelName = ({ usePlural, schema }) => {
1282
+ /**
1283
+ * This function helps us get the default model name from the schema defined by devs.
1284
+ * Often times, the user will be using the `modelName` which could had been customized by the users.
1285
+ * This function helps us get the actual model name useful to match against the schema. (eg: schema[model])
1286
+ *
1287
+ * If it's still unclear what this does:
1288
+ *
1289
+ * 1. User can define a custom modelName.
1290
+ * 2. When using a custom modelName, doing something like `schema[model]` will not work.
1291
+ * 3. Using this function helps us get the actual model name based on the user's defined custom modelName.
1292
+ */
1293
+ const getDefaultModelName = (model) => {
1294
+ if (usePlural && model.charAt(model.length - 1) === "s") {
1295
+ const pluralessModel = model.slice(0, -1);
1296
+ let m = schema[pluralessModel] ? pluralessModel : void 0;
1297
+ if (!m) m = Object.entries(schema).find(([_, f]) => f.modelName === pluralessModel)?.[0];
1298
+ if (m) return m;
1299
+ }
1300
+ let m = schema[model] ? model : void 0;
1301
+ if (!m) m = Object.entries(schema).find(([_, f]) => f.modelName === model)?.[0];
1302
+ if (!m) throw new BetterAuthError(`Model "${model}" not found in schema`);
1303
+ return m;
1304
+ };
1305
+ return getDefaultModelName;
1306
+ };
1307
+ //#endregion
1308
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.mjs
1309
+ var initGetDefaultFieldName = ({ schema, usePlural }) => {
1310
+ const getDefaultModelName = initGetDefaultModelName({
1311
+ schema,
1312
+ usePlural
1313
+ });
1314
+ /**
1315
+ * This function helps us get the default field name from the schema defined by devs.
1316
+ * Often times, the user will be using the `fieldName` which could had been customized by the users.
1317
+ * This function helps us get the actual field name useful to match against the schema. (eg: schema[model].fields[field])
1318
+ *
1319
+ * If it's still unclear what this does:
1320
+ *
1321
+ * 1. User can define a custom fieldName.
1322
+ * 2. When using a custom fieldName, doing something like `schema[model].fields[field]` will not work.
1323
+ */
1324
+ const getDefaultFieldName = ({ field, model: unsafeModel }) => {
1325
+ if (field === "id" || field === "_id") return "id";
1326
+ const model = getDefaultModelName(unsafeModel);
1327
+ let f = schema[model]?.fields[field];
1328
+ if (!f) {
1329
+ const result = Object.entries(schema[model].fields).find(([_, f]) => f.fieldName === field);
1330
+ if (result) {
1331
+ f = result[1];
1332
+ field = result[0];
1333
+ }
1334
+ }
1335
+ if (!f) throw new BetterAuthError(`Field ${field} not found in model ${model}`);
1336
+ return field;
1337
+ };
1338
+ return getDefaultFieldName;
1339
+ };
1340
+ //#endregion
1341
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/get-id-field.mjs
1342
+ var initGetIdField = ({ usePlural, schema, disableIdGeneration, options, customIdGenerator, supportsUUIDs }) => {
1343
+ const getDefaultModelName = initGetDefaultModelName({
1344
+ usePlural,
1345
+ schema
1346
+ });
1347
+ const idField = ({ customModelName, forceAllowId }) => {
1348
+ const useNumberId = options.advanced?.database?.generateId === "serial";
1349
+ const useUUIDs = options.advanced?.database?.generateId === "uuid";
1350
+ const shouldGenerateId = (() => {
1351
+ if (disableIdGeneration) return false;
1352
+ else if (useNumberId && !forceAllowId) return false;
1353
+ else if (useUUIDs) return !supportsUUIDs;
1354
+ else return true;
1355
+ })();
1356
+ const model = getDefaultModelName(customModelName ?? "id");
1357
+ return {
1358
+ type: useNumberId ? "number" : "string",
1359
+ required: shouldGenerateId ? true : false,
1360
+ ...shouldGenerateId ? { defaultValue() {
1361
+ if (disableIdGeneration) return void 0;
1362
+ const generateId$1 = options.advanced?.database?.generateId;
1363
+ if (generateId$1 === false || generateId$1 === "serial") return void 0;
1364
+ if (typeof generateId$1 === "function") return generateId$1({ model });
1365
+ if (generateId$1 === "uuid") return crypto.randomUUID();
1366
+ if (customIdGenerator) return customIdGenerator({ model });
1367
+ return generateId();
1368
+ } } : {},
1369
+ transform: {
1370
+ input: (value) => {
1371
+ if (!value) return void 0;
1372
+ if (useNumberId) {
1373
+ const numberValue = Number(value);
1374
+ if (isNaN(numberValue)) return;
1375
+ return numberValue;
1376
+ }
1377
+ if (useUUIDs) {
1378
+ if (shouldGenerateId && !forceAllowId) return value;
1379
+ if (disableIdGeneration) return void 0;
1380
+ if (supportsUUIDs) return void 0;
1381
+ if (forceAllowId && typeof value === "string") if (/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value)) return value;
1382
+ else {
1383
+ const stack = (/* @__PURE__ */ new Error()).stack?.split("\n").filter((_, i) => i !== 1).join("\n").replace("Error:", "");
1384
+ logger.warn("[Adapter Factory] - Invalid UUID value for field `id` provided when `forceAllowId` is true. Generating a new UUID.", stack);
1385
+ }
1386
+ if (typeof value !== "string" && !supportsUUIDs) return crypto.randomUUID();
1387
+ return;
1388
+ }
1389
+ return value;
1390
+ },
1391
+ output: (value) => {
1392
+ if (!value) return void 0;
1393
+ return String(value);
1394
+ }
1395
+ }
1396
+ };
1397
+ };
1398
+ return idField;
1399
+ };
1400
+ //#endregion
1401
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.mjs
1402
+ var initGetFieldAttributes = ({ usePlural, schema, options, customIdGenerator, disableIdGeneration }) => {
1403
+ const getDefaultModelName = initGetDefaultModelName({
1404
+ usePlural,
1405
+ schema
1406
+ });
1407
+ const getDefaultFieldName = initGetDefaultFieldName({
1408
+ usePlural,
1409
+ schema
1410
+ });
1411
+ const idField = initGetIdField({
1412
+ usePlural,
1413
+ schema,
1414
+ options,
1415
+ customIdGenerator,
1416
+ disableIdGeneration
1417
+ });
1418
+ const getFieldAttributes = ({ model, field }) => {
1419
+ const defaultModelName = getDefaultModelName(model);
1420
+ const defaultFieldName = getDefaultFieldName({
1421
+ field,
1422
+ model: defaultModelName
1423
+ });
1424
+ const fields = schema[defaultModelName].fields;
1425
+ fields.id = idField({ customModelName: defaultModelName });
1426
+ const fieldAttributes = fields[defaultFieldName];
1427
+ if (!fieldAttributes) throw new BetterAuthError(`Field ${field} not found in model ${model}`);
1428
+ return fieldAttributes;
1429
+ };
1430
+ return getFieldAttributes;
1431
+ };
1432
+ //#endregion
1433
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/get-field-name.mjs
1434
+ var initGetFieldName = ({ schema, usePlural }) => {
1435
+ const getDefaultModelName = initGetDefaultModelName({
1436
+ schema,
1437
+ usePlural
1438
+ });
1439
+ const getDefaultFieldName = initGetDefaultFieldName({
1440
+ schema,
1441
+ usePlural
1442
+ });
1443
+ /**
1444
+ * Get the field name which is expected to be saved in the database based on the user's schema.
1445
+ *
1446
+ * This function is useful if you need to save the field name to the database.
1447
+ *
1448
+ * For example, if the user has defined a custom field name for the `user` model, then you can use this function to get the actual field name from the schema.
1449
+ */
1450
+ function getFieldName({ model: modelName, field: fieldName }) {
1451
+ const model = getDefaultModelName(modelName);
1452
+ const field = getDefaultFieldName({
1453
+ model,
1454
+ field: fieldName
1455
+ });
1456
+ return schema[model]?.fields[field]?.fieldName || field;
1457
+ }
1458
+ return getFieldName;
1459
+ };
1460
+ //#endregion
1461
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/get-model-name.mjs
1462
+ var initGetModelName = ({ usePlural, schema }) => {
1463
+ const getDefaultModelName = initGetDefaultModelName({
1464
+ schema,
1465
+ usePlural
1466
+ });
1467
+ /**
1468
+ * Users can overwrite the default model of some tables. This function helps find the correct model name.
1469
+ * Furthermore, if the user passes `usePlural` as true in their adapter config,
1470
+ * then we should return the model name ending with an `s`.
1471
+ */
1472
+ const getModelName = (model) => {
1473
+ const defaultModelKey = getDefaultModelName(model);
1474
+ if (schema && schema[defaultModelKey] && schema[defaultModelKey].modelName !== model) return usePlural ? `${schema[defaultModelKey].modelName}s` : schema[defaultModelKey].modelName;
1475
+ return usePlural ? `${model}s` : model;
1476
+ };
1477
+ return getModelName;
1478
+ };
1479
+ //#endregion
1480
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/utils.mjs
1481
+ function withApplyDefault(value, field, action) {
1482
+ if (action === "update") {
1483
+ if (value === void 0 && field.onUpdate !== void 0) {
1484
+ if (typeof field.onUpdate === "function") return field.onUpdate();
1485
+ return field.onUpdate;
1486
+ }
1487
+ return value;
1488
+ }
1489
+ if (action === "create") {
1490
+ if (value === void 0 || field.required === true && value === null) {
1491
+ if (field.defaultValue !== void 0) {
1492
+ if (typeof field.defaultValue === "function") return field.defaultValue();
1493
+ return field.defaultValue;
1494
+ }
1495
+ }
1496
+ }
1497
+ return value;
1498
+ }
1499
+ //#endregion
1500
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/factory.mjs
1501
+ var debugLogs = [];
1502
+ var transactionId = -1;
1503
+ var createAsIsTransaction = (adapter) => (fn) => fn(adapter);
1504
+ var createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (options) => {
1505
+ const uniqueAdapterFactoryInstanceId = Math.random().toString(36).substring(2, 15);
1506
+ const config = {
1507
+ ...cfg,
1508
+ supportsBooleans: cfg.supportsBooleans ?? true,
1509
+ supportsDates: cfg.supportsDates ?? true,
1510
+ supportsJSON: cfg.supportsJSON ?? false,
1511
+ adapterName: cfg.adapterName ?? cfg.adapterId,
1512
+ supportsNumericIds: cfg.supportsNumericIds ?? true,
1513
+ supportsUUIDs: cfg.supportsUUIDs ?? false,
1514
+ supportsArrays: cfg.supportsArrays ?? false,
1515
+ transaction: cfg.transaction ?? false,
1516
+ disableTransformInput: cfg.disableTransformInput ?? false,
1517
+ disableTransformOutput: cfg.disableTransformOutput ?? false,
1518
+ disableTransformJoin: cfg.disableTransformJoin ?? false
1519
+ };
1520
+ if (options.advanced?.database?.generateId === "serial" && config.supportsNumericIds === false) throw new BetterAuthError(`[${config.adapterName}] Your database or database adapter does not support numeric ids. Please disable "useNumberId" in your config.`);
1521
+ const schema = getAuthTables(options);
1522
+ const debugLog = (...args) => {
1523
+ if (config.debugLogs === true || typeof config.debugLogs === "object") {
1524
+ const logger = createLogger({ level: "info" });
1525
+ if (typeof config.debugLogs === "object" && "isRunningAdapterTests" in config.debugLogs) {
1526
+ if (config.debugLogs.isRunningAdapterTests) {
1527
+ args.shift();
1528
+ debugLogs.push({
1529
+ instance: uniqueAdapterFactoryInstanceId,
1530
+ args
1531
+ });
1532
+ }
1533
+ return;
1534
+ }
1535
+ if (typeof config.debugLogs === "object" && config.debugLogs.logCondition && !config.debugLogs.logCondition?.()) return;
1536
+ if (typeof args[0] === "object" && "method" in args[0]) {
1537
+ const method = args.shift().method;
1538
+ if (typeof config.debugLogs === "object") {
1539
+ if (method === "create" && !config.debugLogs.create) return;
1540
+ else if (method === "update" && !config.debugLogs.update) return;
1541
+ else if (method === "updateMany" && !config.debugLogs.updateMany) return;
1542
+ else if (method === "findOne" && !config.debugLogs.findOne) return;
1543
+ else if (method === "findMany" && !config.debugLogs.findMany) return;
1544
+ else if (method === "delete" && !config.debugLogs.delete) return;
1545
+ else if (method === "deleteMany" && !config.debugLogs.deleteMany) return;
1546
+ else if (method === "count" && !config.debugLogs.count) return;
1547
+ }
1548
+ logger.info(`[${config.adapterName}]`, ...args);
1549
+ } else logger.info(`[${config.adapterName}]`, ...args);
1550
+ }
1551
+ };
1552
+ const logger = createLogger(options.logger);
1553
+ const getDefaultModelName = initGetDefaultModelName({
1554
+ usePlural: config.usePlural,
1555
+ schema
1556
+ });
1557
+ const getDefaultFieldName = initGetDefaultFieldName({
1558
+ usePlural: config.usePlural,
1559
+ schema
1560
+ });
1561
+ const getModelName = initGetModelName({
1562
+ usePlural: config.usePlural,
1563
+ schema
1564
+ });
1565
+ const getFieldName = initGetFieldName({
1566
+ schema,
1567
+ usePlural: config.usePlural
1568
+ });
1569
+ const idField = initGetIdField({
1570
+ schema,
1571
+ options,
1572
+ usePlural: config.usePlural,
1573
+ disableIdGeneration: config.disableIdGeneration,
1574
+ customIdGenerator: config.customIdGenerator,
1575
+ supportsUUIDs: config.supportsUUIDs
1576
+ });
1577
+ const getFieldAttributes = initGetFieldAttributes({
1578
+ schema,
1579
+ options,
1580
+ usePlural: config.usePlural,
1581
+ disableIdGeneration: config.disableIdGeneration,
1582
+ customIdGenerator: config.customIdGenerator
1583
+ });
1584
+ const transformInput = async (data, defaultModelName, action, forceAllowId) => {
1585
+ const transformedData = {};
1586
+ const fields = schema[defaultModelName].fields;
1587
+ const newMappedKeys = config.mapKeysTransformInput ?? {};
1588
+ const useNumberId = options.advanced?.database?.generateId === "serial";
1589
+ fields.id = idField({
1590
+ customModelName: defaultModelName,
1591
+ forceAllowId: forceAllowId && "id" in data
1592
+ });
1593
+ for (const field in fields) {
1594
+ let value = data[field];
1595
+ const fieldAttributes = fields[field];
1596
+ const newFieldName = newMappedKeys[field] || fields[field].fieldName || field;
1597
+ if (value === void 0 && (fieldAttributes.defaultValue === void 0 && !fieldAttributes.transform?.input && !(action === "update" && fieldAttributes.onUpdate) || action === "update" && !fieldAttributes.onUpdate)) continue;
1598
+ if (fieldAttributes && fieldAttributes.type === "date" && !(value instanceof Date) && typeof value === "string") try {
1599
+ value = new Date(value);
1600
+ } catch {
1601
+ logger.error("[Adapter Factory] Failed to convert string to date", {
1602
+ value,
1603
+ field
1604
+ });
1605
+ }
1606
+ let newValue = withApplyDefault(value, fieldAttributes, action);
1607
+ if (fieldAttributes.transform?.input) newValue = await fieldAttributes.transform.input(newValue);
1608
+ if (fieldAttributes.references?.field === "id" && useNumberId) if (Array.isArray(newValue)) newValue = newValue.map((x) => x !== null ? Number(x) : null);
1609
+ else newValue = newValue !== null ? Number(newValue) : null;
1610
+ else if (config.supportsJSON === false && typeof newValue === "object" && fieldAttributes.type === "json") newValue = JSON.stringify(newValue);
1611
+ else if (config.supportsArrays === false && Array.isArray(newValue) && (fieldAttributes.type === "string[]" || fieldAttributes.type === "number[]")) newValue = JSON.stringify(newValue);
1612
+ else if (config.supportsDates === false && newValue instanceof Date && fieldAttributes.type === "date") newValue = newValue.toISOString();
1613
+ else if (config.supportsBooleans === false && typeof newValue === "boolean") newValue = newValue ? 1 : 0;
1614
+ if (config.customTransformInput) newValue = config.customTransformInput({
1615
+ data: newValue,
1616
+ action,
1617
+ field: newFieldName,
1618
+ fieldAttributes,
1619
+ model: getModelName(defaultModelName),
1620
+ schema,
1621
+ options
1622
+ });
1623
+ if (newValue !== void 0) transformedData[newFieldName] = newValue;
1624
+ }
1625
+ return transformedData;
1626
+ };
1627
+ const transformOutput = async (data, unsafe_model, select = [], join) => {
1628
+ const transformSingleOutput = async (data, unsafe_model, select = []) => {
1629
+ if (!data) return null;
1630
+ const newMappedKeys = config.mapKeysTransformOutput ?? {};
1631
+ const transformedData = {};
1632
+ const tableSchema = schema[getDefaultModelName(unsafe_model)].fields;
1633
+ const idKey = Object.entries(newMappedKeys).find(([_, v]) => v === "id")?.[0];
1634
+ tableSchema[idKey ?? "id"] = { type: options.advanced?.database?.generateId === "serial" ? "number" : "string" };
1635
+ for (const key in tableSchema) {
1636
+ if (select.length && !select.includes(key)) continue;
1637
+ const field = tableSchema[key];
1638
+ if (field) {
1639
+ const originalKey = field.fieldName || key;
1640
+ let newValue = data[Object.entries(newMappedKeys).find(([_, v]) => v === originalKey)?.[0] || originalKey];
1641
+ if (field.transform?.output) newValue = await field.transform.output(newValue);
1642
+ const newFieldName = newMappedKeys[key] || key;
1643
+ if (originalKey === "id" || field.references?.field === "id") {
1644
+ if (typeof newValue !== "undefined" && newValue !== null) newValue = String(newValue);
1645
+ } else if (config.supportsJSON === false && typeof newValue === "string" && field.type === "json") newValue = safeJSONParse(newValue);
1646
+ else if (config.supportsArrays === false && typeof newValue === "string" && (field.type === "string[]" || field.type === "number[]")) newValue = safeJSONParse(newValue);
1647
+ else if (config.supportsDates === false && typeof newValue === "string" && field.type === "date") newValue = new Date(newValue);
1648
+ else if (config.supportsBooleans === false && typeof newValue === "number" && field.type === "boolean") newValue = newValue === 1;
1649
+ if (config.customTransformOutput) newValue = config.customTransformOutput({
1650
+ data: newValue,
1651
+ field: newFieldName,
1652
+ fieldAttributes: field,
1653
+ select,
1654
+ model: getModelName(unsafe_model),
1655
+ schema,
1656
+ options
1657
+ });
1658
+ transformedData[newFieldName] = newValue;
1659
+ }
1660
+ }
1661
+ return transformedData;
1662
+ };
1663
+ if (!join || Object.keys(join).length === 0) return await transformSingleOutput(data, unsafe_model, select);
1664
+ unsafe_model = getDefaultModelName(unsafe_model);
1665
+ const transformedData = await transformSingleOutput(data, unsafe_model, select);
1666
+ const requiredModels = Object.entries(join).map(([model, joinConfig]) => ({
1667
+ modelName: getModelName(model),
1668
+ defaultModelName: getDefaultModelName(model),
1669
+ joinConfig
1670
+ }));
1671
+ if (!data) return null;
1672
+ for (const { modelName, defaultModelName, joinConfig } of requiredModels) {
1673
+ let joinedData = await (async () => {
1674
+ if (options.experimental?.joins) return data[modelName];
1675
+ else return await handleFallbackJoin({
1676
+ baseModel: unsafe_model,
1677
+ baseData: transformedData,
1678
+ joinModel: modelName,
1679
+ specificJoinConfig: joinConfig
1680
+ });
1681
+ })();
1682
+ if (joinedData === void 0 || joinedData === null) joinedData = joinConfig.relation === "one-to-one" ? null : [];
1683
+ if (joinConfig.relation === "one-to-many" && !Array.isArray(joinedData)) joinedData = [joinedData];
1684
+ const transformed = [];
1685
+ if (Array.isArray(joinedData)) for (const item of joinedData) {
1686
+ const transformedItem = await transformSingleOutput(item, modelName, []);
1687
+ transformed.push(transformedItem);
1688
+ }
1689
+ else {
1690
+ const transformedItem = await transformSingleOutput(joinedData, modelName, []);
1691
+ transformed.push(transformedItem);
1692
+ }
1693
+ transformedData[defaultModelName] = (joinConfig.relation === "one-to-one" ? transformed[0] : transformed) ?? null;
1694
+ }
1695
+ return transformedData;
1696
+ };
1697
+ const transformWhereClause = ({ model, where, action }) => {
1698
+ if (!where) return void 0;
1699
+ const newMappedKeys = config.mapKeysTransformInput ?? {};
1700
+ return where.map((w) => {
1701
+ const { field: unsafe_field, value, operator = "eq", connector = "AND" } = w;
1702
+ if (operator === "in") {
1703
+ if (!Array.isArray(value)) throw new BetterAuthError("Value must be an array");
1704
+ }
1705
+ let newValue = value;
1706
+ const defaultModelName = getDefaultModelName(model);
1707
+ const defaultFieldName = getDefaultFieldName({
1708
+ field: unsafe_field,
1709
+ model
1710
+ });
1711
+ const fieldName = newMappedKeys[defaultFieldName] || getFieldName({
1712
+ field: defaultFieldName,
1713
+ model: defaultModelName
1714
+ });
1715
+ const fieldAttr = getFieldAttributes({
1716
+ field: defaultFieldName,
1717
+ model: defaultModelName
1718
+ });
1719
+ const useNumberId = options.advanced?.database?.generateId === "serial";
1720
+ if (defaultFieldName === "id" || fieldAttr.references?.field === "id") {
1721
+ if (useNumberId) if (Array.isArray(value)) newValue = value.map(Number);
1722
+ else newValue = Number(value);
1723
+ }
1724
+ if (fieldAttr.type === "date" && value instanceof Date && !config.supportsDates) newValue = value.toISOString();
1725
+ if (fieldAttr.type === "boolean" && typeof newValue === "string") newValue = newValue === "true";
1726
+ if (fieldAttr.type === "number") {
1727
+ if (typeof newValue === "string" && newValue.trim() !== "") {
1728
+ const parsed = Number(newValue);
1729
+ if (!Number.isNaN(parsed)) newValue = parsed;
1730
+ } else if (Array.isArray(newValue)) {
1731
+ const parsed = newValue.map((v) => typeof v === "string" && v.trim() !== "" ? Number(v) : NaN);
1732
+ if (parsed.every((n) => !Number.isNaN(n))) newValue = parsed;
1733
+ }
1734
+ }
1735
+ if (fieldAttr.type === "boolean" && typeof newValue === "boolean" && !config.supportsBooleans) newValue = newValue ? 1 : 0;
1736
+ if (fieldAttr.type === "json" && typeof value === "object" && !config.supportsJSON) try {
1737
+ newValue = JSON.stringify(value);
1738
+ } catch (error) {
1739
+ throw new Error(`Failed to stringify JSON value for field ${fieldName}`, { cause: error });
1740
+ }
1741
+ if (config.customTransformInput) newValue = config.customTransformInput({
1742
+ data: newValue,
1743
+ fieldAttributes: fieldAttr,
1744
+ field: fieldName,
1745
+ model: getModelName(model),
1746
+ schema,
1747
+ options,
1748
+ action
1749
+ });
1750
+ return {
1751
+ operator,
1752
+ connector,
1753
+ field: fieldName,
1754
+ value: newValue
1755
+ };
1756
+ });
1757
+ };
1758
+ const transformJoinClause = (baseModel, unsanitizedJoin, select) => {
1759
+ if (!unsanitizedJoin) return void 0;
1760
+ if (Object.keys(unsanitizedJoin).length === 0) return void 0;
1761
+ const transformedJoin = {};
1762
+ for (const [model, join] of Object.entries(unsanitizedJoin)) {
1763
+ if (!join) continue;
1764
+ const defaultModelName = getDefaultModelName(model);
1765
+ const defaultBaseModelName = getDefaultModelName(baseModel);
1766
+ let foreignKeys = Object.entries(schema[defaultModelName].fields).filter(([field, fieldAttributes]) => fieldAttributes.references && getDefaultModelName(fieldAttributes.references.model) === defaultBaseModelName);
1767
+ let isForwardJoin = true;
1768
+ if (!foreignKeys.length) {
1769
+ foreignKeys = Object.entries(schema[defaultBaseModelName].fields).filter(([field, fieldAttributes]) => fieldAttributes.references && getDefaultModelName(fieldAttributes.references.model) === defaultModelName);
1770
+ isForwardJoin = false;
1771
+ }
1772
+ if (!foreignKeys.length) throw new BetterAuthError(`No foreign key found for model ${model} and base model ${baseModel} while performing join operation.`);
1773
+ else if (foreignKeys.length > 1) throw new BetterAuthError(`Multiple foreign keys found for model ${model} and base model ${baseModel} while performing join operation. Only one foreign key is supported.`);
1774
+ const [foreignKey, foreignKeyAttributes] = foreignKeys[0];
1775
+ if (!foreignKeyAttributes.references) throw new BetterAuthError(`No references found for foreign key ${foreignKey} on model ${model} while performing join operation.`);
1776
+ let from;
1777
+ let to;
1778
+ let requiredSelectField;
1779
+ if (isForwardJoin) {
1780
+ requiredSelectField = foreignKeyAttributes.references.field;
1781
+ from = getFieldName({
1782
+ model: baseModel,
1783
+ field: requiredSelectField
1784
+ });
1785
+ to = getFieldName({
1786
+ model,
1787
+ field: foreignKey
1788
+ });
1789
+ } else {
1790
+ requiredSelectField = foreignKey;
1791
+ from = getFieldName({
1792
+ model: baseModel,
1793
+ field: requiredSelectField
1794
+ });
1795
+ to = getFieldName({
1796
+ model,
1797
+ field: foreignKeyAttributes.references.field
1798
+ });
1799
+ }
1800
+ if (select && !select.includes(requiredSelectField)) select.push(requiredSelectField);
1801
+ const isUnique = to === "id" ? true : foreignKeyAttributes.unique ?? false;
1802
+ let limit = options.advanced?.database?.defaultFindManyLimit ?? 100;
1803
+ if (isUnique) limit = 1;
1804
+ else if (typeof join === "object" && typeof join.limit === "number") limit = join.limit;
1805
+ transformedJoin[getModelName(model)] = {
1806
+ on: {
1807
+ from,
1808
+ to
1809
+ },
1810
+ limit,
1811
+ relation: isUnique ? "one-to-one" : "one-to-many"
1812
+ };
1813
+ }
1814
+ return {
1815
+ join: transformedJoin,
1816
+ select
1817
+ };
1818
+ };
1819
+ /**
1820
+ * Handle joins by making separate queries and combining results (fallback for adapters that don't support native joins).
1821
+ */
1822
+ const handleFallbackJoin = async ({ baseModel, baseData, joinModel, specificJoinConfig: joinConfig }) => {
1823
+ if (!baseData) return baseData;
1824
+ const modelName = getModelName(joinModel);
1825
+ const field = joinConfig.on.to;
1826
+ const value = baseData[getDefaultFieldName({
1827
+ field: joinConfig.on.from,
1828
+ model: baseModel
1829
+ })];
1830
+ if (value === null || value === void 0) return joinConfig.relation === "one-to-one" ? null : [];
1831
+ let result;
1832
+ const where = transformWhereClause({
1833
+ model: modelName,
1834
+ where: [{
1835
+ field,
1836
+ value,
1837
+ operator: "eq",
1838
+ connector: "AND"
1839
+ }],
1840
+ action: "findOne"
1841
+ });
1842
+ try {
1843
+ if (joinConfig.relation === "one-to-one") result = await withSpan(`db findOne ${modelName}`, {
1844
+ [ATTR_DB_OPERATION_NAME]: "findOne",
1845
+ [ATTR_DB_COLLECTION_NAME]: modelName
1846
+ }, () => adapterInstance.findOne({
1847
+ model: modelName,
1848
+ where
1849
+ }));
1850
+ else {
1851
+ const limit = joinConfig.limit ?? options.advanced?.database?.defaultFindManyLimit ?? 100;
1852
+ result = await withSpan(`db findMany ${modelName}`, {
1853
+ [ATTR_DB_OPERATION_NAME]: "findMany",
1854
+ [ATTR_DB_COLLECTION_NAME]: modelName
1855
+ }, () => adapterInstance.findMany({
1856
+ model: modelName,
1857
+ where,
1858
+ limit
1859
+ }));
1860
+ }
1861
+ } catch (error) {
1862
+ logger.error(`Failed to query fallback join for model ${modelName}:`, {
1863
+ where,
1864
+ limit: joinConfig.limit
1865
+ });
1866
+ console.error(error);
1867
+ throw error;
1868
+ }
1869
+ return result;
1870
+ };
1871
+ const adapterInstance = customAdapter({
1872
+ options,
1873
+ schema,
1874
+ debugLog,
1875
+ getFieldName,
1876
+ getModelName,
1877
+ getDefaultModelName,
1878
+ getDefaultFieldName,
1879
+ getFieldAttributes,
1880
+ transformInput,
1881
+ transformOutput,
1882
+ transformWhereClause
1883
+ });
1884
+ let lazyLoadTransaction = null;
1885
+ const adapter = {
1886
+ transaction: async (cb) => {
1887
+ if (!lazyLoadTransaction) if (!config.transaction) lazyLoadTransaction = createAsIsTransaction(adapter);
1888
+ else {
1889
+ logger.debug(`[${config.adapterName}] - Using provided transaction implementation.`);
1890
+ lazyLoadTransaction = config.transaction;
1891
+ }
1892
+ return lazyLoadTransaction(cb);
1893
+ },
1894
+ create: async ({ data: unsafeData, model: unsafeModel, select, forceAllowId = false }) => {
1895
+ transactionId++;
1896
+ const thisTransactionId = transactionId;
1897
+ const model = getModelName(unsafeModel);
1898
+ unsafeModel = getDefaultModelName(unsafeModel);
1899
+ if ("id" in unsafeData && typeof unsafeData.id !== "undefined" && !forceAllowId) {
1900
+ logger.warn(`[${config.adapterName}] - You are trying to create a record with an id. This is not allowed as we handle id generation for you, unless you pass in the \`forceAllowId\` parameter. The id will be ignored.`);
1901
+ const stack = (/* @__PURE__ */ new Error()).stack?.split("\n").filter((_, i) => i !== 1).join("\n").replace("Error:", "Create method with `id` being called at:");
1902
+ console.log(stack);
1903
+ unsafeData.id = void 0;
1904
+ }
1905
+ debugLog({ method: "create" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 4)}`, `${formatMethod("create")} ${formatAction("Unsafe Input")}:`, {
1906
+ model,
1907
+ data: unsafeData
1908
+ });
1909
+ let data = unsafeData;
1910
+ if (!config.disableTransformInput) data = await transformInput(unsafeData, unsafeModel, "create", forceAllowId);
1911
+ debugLog({ method: "create" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 4)}`, `${formatMethod("create")} ${formatAction("Parsed Input")}:`, {
1912
+ model,
1913
+ data
1914
+ });
1915
+ const res = await withSpan(`db create ${model}`, {
1916
+ [ATTR_DB_OPERATION_NAME]: "create",
1917
+ [ATTR_DB_COLLECTION_NAME]: model
1918
+ }, () => adapterInstance.create({
1919
+ data,
1920
+ model
1921
+ }));
1922
+ debugLog({ method: "create" }, `${formatTransactionId(thisTransactionId)} ${formatStep(3, 4)}`, `${formatMethod("create")} ${formatAction("DB Result")}:`, {
1923
+ model,
1924
+ res
1925
+ });
1926
+ let transformed = res;
1927
+ if (!config.disableTransformOutput) transformed = await transformOutput(res, unsafeModel, select, void 0);
1928
+ debugLog({ method: "create" }, `${formatTransactionId(thisTransactionId)} ${formatStep(4, 4)}`, `${formatMethod("create")} ${formatAction("Parsed Result")}:`, {
1929
+ model,
1930
+ data: transformed
1931
+ });
1932
+ return transformed;
1933
+ },
1934
+ update: async ({ model: unsafeModel, where: unsafeWhere, update: unsafeData }) => {
1935
+ transactionId++;
1936
+ const thisTransactionId = transactionId;
1937
+ unsafeModel = getDefaultModelName(unsafeModel);
1938
+ const model = getModelName(unsafeModel);
1939
+ const where = transformWhereClause({
1940
+ model: unsafeModel,
1941
+ where: unsafeWhere,
1942
+ action: "update"
1943
+ });
1944
+ debugLog({ method: "update" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 4)}`, `${formatMethod("update")} ${formatAction("Unsafe Input")}:`, {
1945
+ model,
1946
+ data: unsafeData
1947
+ });
1948
+ let data = unsafeData;
1949
+ if (!config.disableTransformInput) data = await transformInput(unsafeData, unsafeModel, "update");
1950
+ debugLog({ method: "update" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 4)}`, `${formatMethod("update")} ${formatAction("Parsed Input")}:`, {
1951
+ model,
1952
+ data
1953
+ });
1954
+ const res = await withSpan(`db update ${model}`, {
1955
+ [ATTR_DB_OPERATION_NAME]: "update",
1956
+ [ATTR_DB_COLLECTION_NAME]: model
1957
+ }, () => adapterInstance.update({
1958
+ model,
1959
+ where,
1960
+ update: data
1961
+ }));
1962
+ debugLog({ method: "update" }, `${formatTransactionId(thisTransactionId)} ${formatStep(3, 4)}`, `${formatMethod("update")} ${formatAction("DB Result")}:`, {
1963
+ model,
1964
+ data: res
1965
+ });
1966
+ let transformed = res;
1967
+ if (!config.disableTransformOutput) transformed = await transformOutput(res, unsafeModel, void 0, void 0);
1968
+ debugLog({ method: "update" }, `${formatTransactionId(thisTransactionId)} ${formatStep(4, 4)}`, `${formatMethod("update")} ${formatAction("Parsed Result")}:`, {
1969
+ model,
1970
+ data: transformed
1971
+ });
1972
+ return transformed;
1973
+ },
1974
+ updateMany: async ({ model: unsafeModel, where: unsafeWhere, update: unsafeData }) => {
1975
+ transactionId++;
1976
+ const thisTransactionId = transactionId;
1977
+ const model = getModelName(unsafeModel);
1978
+ const where = transformWhereClause({
1979
+ model: unsafeModel,
1980
+ where: unsafeWhere,
1981
+ action: "updateMany"
1982
+ });
1983
+ unsafeModel = getDefaultModelName(unsafeModel);
1984
+ debugLog({ method: "updateMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 4)}`, `${formatMethod("updateMany")} ${formatAction("Unsafe Input")}:`, {
1985
+ model,
1986
+ data: unsafeData
1987
+ });
1988
+ let data = unsafeData;
1989
+ if (!config.disableTransformInput) data = await transformInput(unsafeData, unsafeModel, "update");
1990
+ debugLog({ method: "updateMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 4)}`, `${formatMethod("updateMany")} ${formatAction("Parsed Input")}:`, {
1991
+ model,
1992
+ data
1993
+ });
1994
+ const updatedCount = await withSpan(`db updateMany ${model}`, {
1995
+ [ATTR_DB_OPERATION_NAME]: "updateMany",
1996
+ [ATTR_DB_COLLECTION_NAME]: model
1997
+ }, () => adapterInstance.updateMany({
1998
+ model,
1999
+ where,
2000
+ update: data
2001
+ }));
2002
+ debugLog({ method: "updateMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(3, 4)}`, `${formatMethod("updateMany")} ${formatAction("DB Result")}:`, {
2003
+ model,
2004
+ data: updatedCount
2005
+ });
2006
+ debugLog({ method: "updateMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(4, 4)}`, `${formatMethod("updateMany")} ${formatAction("Parsed Result")}:`, {
2007
+ model,
2008
+ data: updatedCount
2009
+ });
2010
+ return updatedCount;
2011
+ },
2012
+ findOne: async ({ model: unsafeModel, where: unsafeWhere, select, join: unsafeJoin }) => {
2013
+ transactionId++;
2014
+ const thisTransactionId = transactionId;
2015
+ const model = getModelName(unsafeModel);
2016
+ const where = transformWhereClause({
2017
+ model: unsafeModel,
2018
+ where: unsafeWhere,
2019
+ action: "findOne"
2020
+ });
2021
+ unsafeModel = getDefaultModelName(unsafeModel);
2022
+ let join;
2023
+ let passJoinToAdapter = true;
2024
+ if (!config.disableTransformJoin) {
2025
+ const result = transformJoinClause(unsafeModel, unsafeJoin, select);
2026
+ if (result) {
2027
+ join = result.join;
2028
+ select = result.select;
2029
+ }
2030
+ if (!options.experimental?.joins && join && Object.keys(join).length > 0) passJoinToAdapter = false;
2031
+ } else join = unsafeJoin;
2032
+ debugLog({ method: "findOne" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 3)}`, `${formatMethod("findOne")}:`, {
2033
+ model,
2034
+ where,
2035
+ select,
2036
+ join
2037
+ });
2038
+ const res = await withSpan(`db findOne ${model}`, {
2039
+ [ATTR_DB_OPERATION_NAME]: "findOne",
2040
+ [ATTR_DB_COLLECTION_NAME]: model
2041
+ }, () => adapterInstance.findOne({
2042
+ model,
2043
+ where,
2044
+ select,
2045
+ join: passJoinToAdapter ? join : void 0
2046
+ }));
2047
+ debugLog({ method: "findOne" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 3)}`, `${formatMethod("findOne")} ${formatAction("DB Result")}:`, {
2048
+ model,
2049
+ data: res
2050
+ });
2051
+ let transformed = res;
2052
+ if (!config.disableTransformOutput) transformed = await transformOutput(res, unsafeModel, select, join);
2053
+ debugLog({ method: "findOne" }, `${formatTransactionId(thisTransactionId)} ${formatStep(3, 3)}`, `${formatMethod("findOne")} ${formatAction("Parsed Result")}:`, {
2054
+ model,
2055
+ data: transformed
2056
+ });
2057
+ return transformed;
2058
+ },
2059
+ findMany: async ({ model: unsafeModel, where: unsafeWhere, limit: unsafeLimit, select, sortBy, offset, join: unsafeJoin }) => {
2060
+ transactionId++;
2061
+ const thisTransactionId = transactionId;
2062
+ const limit = unsafeLimit ?? options.advanced?.database?.defaultFindManyLimit ?? 100;
2063
+ const model = getModelName(unsafeModel);
2064
+ const where = transformWhereClause({
2065
+ model: unsafeModel,
2066
+ where: unsafeWhere,
2067
+ action: "findMany"
2068
+ });
2069
+ unsafeModel = getDefaultModelName(unsafeModel);
2070
+ let join;
2071
+ let passJoinToAdapter = true;
2072
+ if (!config.disableTransformJoin) {
2073
+ const result = transformJoinClause(unsafeModel, unsafeJoin, select);
2074
+ if (result) {
2075
+ join = result.join;
2076
+ select = result.select;
2077
+ }
2078
+ if (!options.experimental?.joins && join && Object.keys(join).length > 0) passJoinToAdapter = false;
2079
+ } else join = unsafeJoin;
2080
+ debugLog({ method: "findMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 3)}`, `${formatMethod("findMany")}:`, {
2081
+ model,
2082
+ where,
2083
+ limit,
2084
+ sortBy,
2085
+ offset,
2086
+ join
2087
+ });
2088
+ const res = await withSpan(`db findMany ${model}`, {
2089
+ [ATTR_DB_OPERATION_NAME]: "findMany",
2090
+ [ATTR_DB_COLLECTION_NAME]: model
2091
+ }, () => adapterInstance.findMany({
2092
+ model,
2093
+ where,
2094
+ limit,
2095
+ select,
2096
+ sortBy,
2097
+ offset,
2098
+ join: passJoinToAdapter ? join : void 0
2099
+ }));
2100
+ debugLog({ method: "findMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 3)}`, `${formatMethod("findMany")} ${formatAction("DB Result")}:`, {
2101
+ model,
2102
+ data: res
2103
+ });
2104
+ let transformed = res;
2105
+ if (!config.disableTransformOutput) transformed = await Promise.all(res.map(async (r) => {
2106
+ return await transformOutput(r, unsafeModel, void 0, join);
2107
+ }));
2108
+ debugLog({ method: "findMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(3, 3)}`, `${formatMethod("findMany")} ${formatAction("Parsed Result")}:`, {
2109
+ model,
2110
+ data: transformed
2111
+ });
2112
+ return transformed;
2113
+ },
2114
+ delete: async ({ model: unsafeModel, where: unsafeWhere }) => {
2115
+ transactionId++;
2116
+ const thisTransactionId = transactionId;
2117
+ const model = getModelName(unsafeModel);
2118
+ const where = transformWhereClause({
2119
+ model: unsafeModel,
2120
+ where: unsafeWhere,
2121
+ action: "delete"
2122
+ });
2123
+ unsafeModel = getDefaultModelName(unsafeModel);
2124
+ debugLog({ method: "delete" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 2)}`, `${formatMethod("delete")}:`, {
2125
+ model,
2126
+ where
2127
+ });
2128
+ await withSpan(`db delete ${model}`, {
2129
+ [ATTR_DB_OPERATION_NAME]: "delete",
2130
+ [ATTR_DB_COLLECTION_NAME]: model
2131
+ }, () => adapterInstance.delete({
2132
+ model,
2133
+ where
2134
+ }));
2135
+ debugLog({ method: "delete" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 2)}`, `${formatMethod("delete")} ${formatAction("DB Result")}:`, { model });
2136
+ },
2137
+ deleteMany: async ({ model: unsafeModel, where: unsafeWhere }) => {
2138
+ transactionId++;
2139
+ const thisTransactionId = transactionId;
2140
+ const model = getModelName(unsafeModel);
2141
+ const where = transformWhereClause({
2142
+ model: unsafeModel,
2143
+ where: unsafeWhere,
2144
+ action: "deleteMany"
2145
+ });
2146
+ unsafeModel = getDefaultModelName(unsafeModel);
2147
+ debugLog({ method: "deleteMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 2)}`, `${formatMethod("deleteMany")} ${formatAction("DeleteMany")}:`, {
2148
+ model,
2149
+ where
2150
+ });
2151
+ const res = await withSpan(`db deleteMany ${model}`, {
2152
+ [ATTR_DB_OPERATION_NAME]: "deleteMany",
2153
+ [ATTR_DB_COLLECTION_NAME]: model
2154
+ }, () => adapterInstance.deleteMany({
2155
+ model,
2156
+ where
2157
+ }));
2158
+ debugLog({ method: "deleteMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 2)}`, `${formatMethod("deleteMany")} ${formatAction("DB Result")}:`, {
2159
+ model,
2160
+ data: res
2161
+ });
2162
+ return res;
2163
+ },
2164
+ count: async ({ model: unsafeModel, where: unsafeWhere }) => {
2165
+ transactionId++;
2166
+ const thisTransactionId = transactionId;
2167
+ const model = getModelName(unsafeModel);
2168
+ const where = transformWhereClause({
2169
+ model: unsafeModel,
2170
+ where: unsafeWhere,
2171
+ action: "count"
2172
+ });
2173
+ unsafeModel = getDefaultModelName(unsafeModel);
2174
+ debugLog({ method: "count" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 2)}`, `${formatMethod("count")}:`, {
2175
+ model,
2176
+ where
2177
+ });
2178
+ const res = await withSpan(`db count ${model}`, {
2179
+ [ATTR_DB_OPERATION_NAME]: "count",
2180
+ [ATTR_DB_COLLECTION_NAME]: model
2181
+ }, () => adapterInstance.count({
2182
+ model,
2183
+ where
2184
+ }));
2185
+ debugLog({ method: "count" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 2)}`, `${formatMethod("count")}:`, {
2186
+ model,
2187
+ data: res
2188
+ });
2189
+ return res;
2190
+ },
2191
+ createSchema: adapterInstance.createSchema ? async (_, file) => {
2192
+ const tables = getAuthTables(options);
2193
+ if (options.secondaryStorage && !options.session?.storeSessionInDatabase) delete tables.session;
2194
+ return adapterInstance.createSchema({
2195
+ file,
2196
+ tables
2197
+ });
2198
+ } : void 0,
2199
+ options: {
2200
+ adapterConfig: config,
2201
+ ...adapterInstance.options ?? {}
2202
+ },
2203
+ id: config.adapterId,
2204
+ ...config.debugLogs?.isRunningAdapterTests ? { adapterTestDebugLogs: {
2205
+ resetDebugLogs() {
2206
+ debugLogs = debugLogs.filter((log) => log.instance !== uniqueAdapterFactoryInstanceId);
2207
+ },
2208
+ printDebugLogs() {
2209
+ const separator = `─`.repeat(80);
2210
+ const logs = debugLogs.filter((log) => log.instance === uniqueAdapterFactoryInstanceId);
2211
+ if (logs.length === 0) return;
2212
+ const log = logs.reverse().map((log) => {
2213
+ log.args[0] = `\n${log.args[0]}`;
2214
+ return [...log.args, "\n"];
2215
+ }).reduce((prev, curr) => {
2216
+ return [...curr, ...prev];
2217
+ }, [`\n${separator}`]);
2218
+ console.log(...log);
2219
+ }
2220
+ } } : {}
2221
+ };
2222
+ return adapter;
2223
+ };
2224
+ function formatTransactionId(transactionId) {
2225
+ if (getColorDepth() < 8) return `#${transactionId}`;
2226
+ return `${TTY_COLORS.fg.magenta}#${transactionId}${TTY_COLORS.reset}`;
2227
+ }
2228
+ function formatStep(step, total) {
2229
+ return `${TTY_COLORS.bg.black}${TTY_COLORS.fg.yellow}[${step}/${total}]${TTY_COLORS.reset}`;
2230
+ }
2231
+ function formatMethod(method) {
2232
+ return `${TTY_COLORS.bright}${method}${TTY_COLORS.reset}`;
2233
+ }
2234
+ function formatAction(action) {
2235
+ return `${TTY_COLORS.dim}(${action})${TTY_COLORS.reset}`;
2236
+ }
2237
+ //#endregion
2238
+ //#region ../../node_modules/.bun/@better-auth+core@1.5.6+b884d6c866886bb4/node_modules/@better-auth/core/dist/db/adapter/index.mjs
2239
+ var whereOperators = [
2240
+ "eq",
2241
+ "ne",
2242
+ "lt",
2243
+ "lte",
2244
+ "gt",
2245
+ "gte",
2246
+ "in",
2247
+ "not_in",
2248
+ "contains",
2249
+ "starts_with",
2250
+ "ends_with"
2251
+ ];
2252
+ //#endregion
2253
+ export { generateId as a, ATTR_HOOK_TYPE as c, ATTR_HTTP_RESPONSE_STATUS_CODE as d, ATTR_HTTP_ROUTE as f, createRandomStringGenerator as h, initGetFieldName as i, ATTR_OPERATION_ID as l, getAuthTables as m, createAdapterFactory as n, withSpan as o, safeJSONParse as p, initGetModelName as r, ATTR_CONTEXT as s, whereOperators as t, ATTR_DB_COLLECTION_NAME as u };