@kyro-cms/core 0.13.3 → 0.13.6

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 (563) hide show
  1. package/dist/{WebhookService-BOJMgjBm.d.cts → WebhookService-BJTCP3cU.d.cts} +1 -1
  2. package/dist/{WebhookService-BLi5Rz2m.d.ts → WebhookService-Bqr_66lK.d.ts} +1 -1
  3. package/dist/api-handler-graphql.cjs +1 -1
  4. package/dist/api-handler-graphql.js +2 -2
  5. package/dist/api-handler-trpc.cjs +1 -1
  6. package/dist/api-handler-trpc.js +2 -2
  7. package/dist/api-handler.cjs +1 -1
  8. package/dist/api-handler.js +1 -1
  9. package/dist/auth-session-4WJUKESW.js +1 -0
  10. package/dist/auth-session-VHUHDBCL.cjs +1 -0
  11. package/dist/{base-A9AJPCG5.d.ts → base-C2DOe8wD.d.ts} +2 -2
  12. package/dist/{base-C6wyX2nC.d.cts → base-DIpT2Vuz.d.cts} +2 -2
  13. package/dist/bootstrap-JYAUQ52D.cjs +1 -0
  14. package/dist/bootstrap-TTMLNQM3.js +1 -0
  15. package/dist/chunk-23RSKVJP.cjs +1 -0
  16. package/dist/chunk-24W5I6SJ.cjs +2 -0
  17. package/dist/{chunk-CH4TZZI5.js → chunk-2I2AXTKY.cjs} +38 -39
  18. package/dist/chunk-34LCWI5X.cjs +1 -0
  19. package/dist/chunk-3A5UO6OQ.cjs +114 -0
  20. package/dist/chunk-3N34WXBS.js +2 -0
  21. package/dist/chunk-5BUAWCU6.js +91 -0
  22. package/dist/{chunk-7NKNSRCB.cjs → chunk-5I3BM5TV.js} +33 -32
  23. package/dist/chunk-5RBGM5N5.js +3 -0
  24. package/dist/chunk-7EY3GXRA.js +2 -0
  25. package/dist/chunk-7KTPBTH5.cjs +1 -0
  26. package/dist/chunk-A4XM33WO.js +109 -0
  27. package/dist/chunk-A7763NCF.cjs +19 -0
  28. package/dist/chunk-AQWTJGML.cjs +1 -0
  29. package/dist/chunk-CIWLQXB2.js +2 -0
  30. package/dist/chunk-DCFOVCJX.cjs +1 -0
  31. package/dist/chunk-DCKJT247.cjs +1 -0
  32. package/dist/chunk-EG4SRTYS.cjs +2 -0
  33. package/dist/chunk-FAG2645P.js +2 -0
  34. package/dist/chunk-FIVTKI25.cjs +3 -0
  35. package/dist/chunk-FU76HURF.cjs +1 -0
  36. package/dist/chunk-GDLMPZKD.cjs +2 -0
  37. package/dist/chunk-GS4CMYKS.cjs +1 -0
  38. package/dist/chunk-GTAKGVUY.js +2 -0
  39. package/dist/chunk-GWUHIIPO.cjs +132 -0
  40. package/dist/chunk-H2IJDTA2.cjs +1 -0
  41. package/dist/chunk-HACW42ZZ.cjs +108 -0
  42. package/dist/chunk-HCM2G674.cjs +20 -0
  43. package/dist/chunk-I22MSXGL.js +2 -0
  44. package/dist/chunk-IIPSXKNV.js +115 -0
  45. package/dist/{chunk-WNU76M2C.js → chunk-IIVBEZC2.js} +6 -6
  46. package/dist/chunk-JHFD3IAU.cjs +1 -0
  47. package/dist/chunk-JJY2F6NL.cjs +3 -0
  48. package/dist/chunk-JQ4V2MGJ.cjs +2 -0
  49. package/dist/chunk-JXJTFBHG.js +3 -0
  50. package/dist/chunk-KOSR7235.cjs +1 -0
  51. package/dist/chunk-KUY4QDAL.js +2 -0
  52. package/dist/chunk-LGUHXOEW.js +3 -0
  53. package/dist/chunk-LXTVMP5F.cjs +6 -0
  54. package/dist/chunk-N25DOGLQ.js +5 -0
  55. package/dist/chunk-N2BMGZIX.cjs +90 -0
  56. package/dist/chunk-N7CDHWQH.cjs +2 -0
  57. package/dist/chunk-NBBAMC2X.cjs +1 -0
  58. package/dist/chunk-NGNXOXI5.js +2 -0
  59. package/dist/chunk-O4PPZOVI.cjs +1 -0
  60. package/dist/chunk-O4RKZQYQ.js +2 -0
  61. package/dist/chunk-OJBL4CXK.cjs +2 -0
  62. package/dist/chunk-OPKZYQV7.js +3 -0
  63. package/dist/chunk-OXEJCIOA.cjs +1 -0
  64. package/dist/chunk-OXH6CANN.js +2 -0
  65. package/dist/{chunk-EQN3HDES.cjs → chunk-PW6Y5MQL.cjs} +5 -5
  66. package/dist/chunk-RLW6AQF2.js +2 -0
  67. package/dist/chunk-SBFVITY2.js +7 -0
  68. package/dist/chunk-SEJ7LMYY.js +4 -0
  69. package/dist/chunk-SZY25KAE.js +21 -0
  70. package/dist/chunk-TG5YQ4PB.cjs +4 -0
  71. package/dist/chunk-TJ6N5ZPZ.js +133 -0
  72. package/dist/chunk-V2RMDMWN.js +2 -0
  73. package/dist/chunk-V4SR7DU5.js +3 -0
  74. package/dist/chunk-VLFM66BZ.js +4 -0
  75. package/dist/chunk-VPBGZW4P.cjs +1 -0
  76. package/dist/chunk-VQWOCGJ2.cjs +1 -0
  77. package/dist/chunk-VWXHW74B.js +3 -0
  78. package/dist/chunk-W5GDZG64.js +2 -0
  79. package/dist/chunk-WLSVS3NC.js +2 -0
  80. package/dist/chunk-YLP3EKTQ.js +2 -0
  81. package/dist/chunk-YNSKDTFG.js +2 -0
  82. package/dist/chunk-YOJOVQIH.cjs +1 -0
  83. package/dist/chunk-ZE2X3FBU.js +20 -0
  84. package/dist/chunk-ZMH35QYG.js +2 -0
  85. package/dist/cli/index.cjs +53 -182
  86. package/dist/cli/index.js +54 -183
  87. package/dist/drizzle/index.cjs +1 -1
  88. package/dist/drizzle/index.d.cts +3 -3
  89. package/dist/drizzle/index.d.ts +3 -3
  90. package/dist/drizzle/index.js +1 -1
  91. package/dist/fields/index.cjs +1 -1
  92. package/dist/fields/index.d.cts +2 -2
  93. package/dist/fields/index.d.ts +2 -2
  94. package/dist/fields/index.js +1 -1
  95. package/dist/graphql/index.cjs +1 -1
  96. package/dist/graphql/index.d.cts +3 -3
  97. package/dist/graphql/index.d.ts +3 -3
  98. package/dist/graphql/index.js +1 -1
  99. package/dist/{index-BttsFZDa.d.ts → index-C9uBoJtm.d.ts} +2 -2
  100. package/dist/{index-BMcYFpTv.d.cts → index-Ci7aUrmN.d.cts} +2 -2
  101. package/dist/index.cjs +30 -30
  102. package/dist/index.d.cts +10 -10
  103. package/dist/index.d.ts +10 -10
  104. package/dist/index.js +31 -31
  105. package/dist/integration.cjs +1 -1
  106. package/dist/integration.js +1 -1
  107. package/dist/local-DKP43BWQ.cjs +1 -0
  108. package/dist/local-TF5ZMHWW.js +1 -0
  109. package/dist/media-M3EIZ4QS.cjs +1 -0
  110. package/dist/media-WYEILC6K.js +1 -0
  111. package/dist/mongo-auth-adapter-33M5ENM7.cjs +1 -0
  112. package/dist/mongo-auth-adapter-4ITULS2P.js +1 -0
  113. package/dist/mongodb/index.cjs +1 -1
  114. package/dist/mongodb/index.d.cts +3 -3
  115. package/dist/mongodb/index.d.ts +3 -3
  116. package/dist/mongodb/index.js +1 -1
  117. package/dist/nodemailer-transport-7F3VLLBW.js +1 -0
  118. package/dist/nodemailer-transport-WAPZD3SJ.cjs +1 -0
  119. package/dist/postgres-auth-adapter-7BCPXNBO.js +1 -0
  120. package/dist/postgres-auth-adapter-HMXFUM5W.cjs +1 -0
  121. package/dist/redis-adapter-2E5AWMMA.cjs +1 -0
  122. package/dist/redis-adapter-GFH74CF4.js +1 -0
  123. package/dist/rest/index.cjs +1 -1
  124. package/dist/rest/index.d.cts +4 -4
  125. package/dist/rest/index.d.ts +4 -4
  126. package/dist/rest/index.js +1 -1
  127. package/dist/schema-FNIDQKIJ.cjs +1 -0
  128. package/dist/schema-KD736QFN.js +1 -0
  129. package/dist/sqlite-adapter-HL53RLSN.cjs +1 -0
  130. package/dist/sqlite-adapter-TT6ZASDG.js +1 -0
  131. package/dist/templates/index.cjs +1 -1
  132. package/dist/templates/index.d.cts +2 -2
  133. package/dist/templates/index.d.ts +2 -2
  134. package/dist/templates/index.js +1 -1
  135. package/dist/trpc/index.cjs +1 -1
  136. package/dist/trpc/index.d.cts +3 -3
  137. package/dist/trpc/index.d.ts +3 -3
  138. package/dist/trpc/index.js +1 -1
  139. package/dist/{types-DxaK39ix.d.cts → types-C3QFX0l6.d.cts} +4 -0
  140. package/dist/{types-DxaK39ix.d.ts → types-C3QFX0l6.d.ts} +4 -0
  141. package/dist/{types-6ShQp2EM.d.cts → types-CKWnrUAh.d.ts} +23 -2
  142. package/dist/{types-BCOhfwHC.d.ts → types-CdwfDpyW.d.cts} +23 -2
  143. package/dist/ws/index.cjs +1 -1
  144. package/dist/ws/index.js +1 -1
  145. package/package.json +3 -11
  146. package/dist/WebhookService-BcuD8tnn.d.cts +0 -143
  147. package/dist/WebhookService-CFe6Zd0_.d.cts +0 -143
  148. package/dist/WebhookService-CGxHtw7E.d.cts +0 -143
  149. package/dist/WebhookService-CNC1lYz7.d.ts +0 -143
  150. package/dist/WebhookService-CVXmjbtQ.d.cts +0 -143
  151. package/dist/WebhookService-D5PSI5t6.d.cts +0 -143
  152. package/dist/WebhookService-DPCCn_12.d.ts +0 -143
  153. package/dist/WebhookService-Dk1lzSrG.d.cts +0 -143
  154. package/dist/WebhookService-Dncnbgm9.d.cts +0 -143
  155. package/dist/WebhookService-I6hdue2Y.d.ts +0 -143
  156. package/dist/WebhookService-KnQ2UDlW.d.ts +0 -143
  157. package/dist/WebhookService-UY5p89Bj.d.ts +0 -143
  158. package/dist/WebhookService-YZXBCRXA.d.ts +0 -143
  159. package/dist/WebhookService-fk0FGRlk.d.ts +0 -143
  160. package/dist/WebhookService-vsFnWrOh.d.ts +0 -143
  161. package/dist/WebhookService-zrDmAx7L.d.cts +0 -143
  162. package/dist/auth-session-DHVGXHOH.cjs +0 -1
  163. package/dist/auth-session-O7IIH7EP.js +0 -1
  164. package/dist/base-B--L0lCn.d.cts +0 -218
  165. package/dist/base-B-i-tjm1.d.ts +0 -218
  166. package/dist/base-B-siit_y.d.cts +0 -218
  167. package/dist/base-B8SyZI4D.d.ts +0 -218
  168. package/dist/base-BCgFt3Yx.d.ts +0 -218
  169. package/dist/base-BHRGJ40F.d.cts +0 -218
  170. package/dist/base-BVoDPNjJ.d.cts +0 -218
  171. package/dist/base-BaOJ5uWd.d.cts +0 -218
  172. package/dist/base-BfPaVEAE.d.cts +0 -218
  173. package/dist/base-BxrX5EPU.d.cts +0 -218
  174. package/dist/base-CAb9EYQs.d.ts +0 -218
  175. package/dist/base-CcZIEll-.d.ts +0 -218
  176. package/dist/base-CyG7aF1e.d.cts +0 -218
  177. package/dist/base-DOImeJ-F.d.ts +0 -218
  178. package/dist/base-DbnwE42-.d.cts +0 -218
  179. package/dist/base-NyiSsD-n.d.ts +0 -218
  180. package/dist/base-OYfoYPYP.d.ts +0 -218
  181. package/dist/base-xflndGDO.d.ts +0 -218
  182. package/dist/bcryptjs-WIQSWJGK.cjs +0 -1
  183. package/dist/bcryptjs-ZEEHSMAG.js +0 -2
  184. package/dist/better-sqlite3-5IISPX34.cjs +0 -1
  185. package/dist/better-sqlite3-B34RIU4C.js +0 -2
  186. package/dist/bootstrap-E24SGUJP.cjs +0 -1
  187. package/dist/bootstrap-PG2LGDLB.js +0 -1
  188. package/dist/bootstrap-QQ6D3OYG.js +0 -1
  189. package/dist/bootstrap-QVKSKXJF.cjs +0 -1
  190. package/dist/bootstrap-RILR44UM.cjs +0 -1
  191. package/dist/bootstrap-YD3GLTWX.cjs +0 -1
  192. package/dist/bootstrap-YFVE7MRG.js +0 -1
  193. package/dist/bootstrap-ZRRUPRUR.js +0 -1
  194. package/dist/bowser-SB3ZUPO4.js +0 -11
  195. package/dist/bowser-VX6B6ZSE.cjs +0 -10
  196. package/dist/chokidar-5RVQZVHP.cjs +0 -5
  197. package/dist/chokidar-BOYGRT4Q.js +0 -6
  198. package/dist/chunk-22RXJ442.js +0 -57
  199. package/dist/chunk-262YP5XA.cjs +0 -1
  200. package/dist/chunk-2FSOHXOU.cjs +0 -56
  201. package/dist/chunk-2HA6EKXX.js +0 -24
  202. package/dist/chunk-2OS5Y4LE.cjs +0 -1
  203. package/dist/chunk-2PXXQKN3.cjs +0 -3
  204. package/dist/chunk-2SPWRQ5O.js +0 -122
  205. package/dist/chunk-32QY56XF.js +0 -122
  206. package/dist/chunk-355R4LS5.cjs +0 -56
  207. package/dist/chunk-35IVNLMA.js +0 -122
  208. package/dist/chunk-35PGCW3S.cjs +0 -1
  209. package/dist/chunk-3GXLOYM3.js +0 -2
  210. package/dist/chunk-3KZXF4US.js +0 -2
  211. package/dist/chunk-3LAWUINR.cjs +0 -1
  212. package/dist/chunk-3NSZZCOJ.js +0 -2
  213. package/dist/chunk-3O3AVMWM.cjs +0 -1
  214. package/dist/chunk-3TAUNYEM.js +0 -8
  215. package/dist/chunk-3U6MKWET.cjs +0 -120
  216. package/dist/chunk-3VXEK5ZW.cjs +0 -1
  217. package/dist/chunk-47CXBWMA.js +0 -2
  218. package/dist/chunk-4BMWWGJN.js +0 -384
  219. package/dist/chunk-4NTIK6DF.cjs +0 -2
  220. package/dist/chunk-4YCI3HBD.js +0 -3
  221. package/dist/chunk-4ZWLNGLS.js +0 -2
  222. package/dist/chunk-5A7E7N4B.cjs +0 -431
  223. package/dist/chunk-5ZEYOFAK.js +0 -2
  224. package/dist/chunk-6DD4J7LI.js +0 -2
  225. package/dist/chunk-6E44MQQ5.js +0 -115
  226. package/dist/chunk-6GGPY7U2.js +0 -4
  227. package/dist/chunk-6LWF5MPL.js +0 -20
  228. package/dist/chunk-6MNLRAKM.cjs +0 -121
  229. package/dist/chunk-6NBZDW53.js +0 -133
  230. package/dist/chunk-6TPICJ2L.js +0 -7
  231. package/dist/chunk-73D2PNHD.cjs +0 -7
  232. package/dist/chunk-73Y63IPP.js +0 -57
  233. package/dist/chunk-7ACHOBWY.cjs +0 -13
  234. package/dist/chunk-7DUKWHRN.cjs +0 -1
  235. package/dist/chunk-7GGZA5YU.cjs +0 -2
  236. package/dist/chunk-7JWQ2PZP.cjs +0 -1
  237. package/dist/chunk-7K6ZUNJM.js +0 -4
  238. package/dist/chunk-7KLEANTO.cjs +0 -1
  239. package/dist/chunk-7LLCXY5O.cjs +0 -19
  240. package/dist/chunk-7MNDQU6K.js +0 -8
  241. package/dist/chunk-7NH7H3WA.js +0 -10
  242. package/dist/chunk-7WMMKGEO.cjs +0 -1
  243. package/dist/chunk-A35ZP72D.cjs +0 -132
  244. package/dist/chunk-A3IOQOV6.js +0 -2
  245. package/dist/chunk-A3XVL6ED.cjs +0 -3
  246. package/dist/chunk-A7LZ6T42.cjs +0 -1
  247. package/dist/chunk-APDQ6ZTG.cjs +0 -120
  248. package/dist/chunk-ATI2UZ7U.js +0 -2
  249. package/dist/chunk-AWQGDMOE.js +0 -3
  250. package/dist/chunk-B3BSVEFC.cjs +0 -3
  251. package/dist/chunk-B4AC23SG.js +0 -122
  252. package/dist/chunk-BAVN7VDR.cjs +0 -1
  253. package/dist/chunk-BCEE4NBZ.cjs +0 -2
  254. package/dist/chunk-BD6XHMMM.cjs +0 -2
  255. package/dist/chunk-BUNLC3II.cjs +0 -1
  256. package/dist/chunk-C7QCZX7X.js +0 -2
  257. package/dist/chunk-CHYVUWZ3.js +0 -2
  258. package/dist/chunk-CIVA6SKW.js +0 -2
  259. package/dist/chunk-CNHUCCQJ.js +0 -121
  260. package/dist/chunk-CRP6PSCE.js +0 -2
  261. package/dist/chunk-D6SDGHY6.js +0 -2
  262. package/dist/chunk-DI6TCZSE.js +0 -122
  263. package/dist/chunk-DORUYZQV.cjs +0 -1
  264. package/dist/chunk-DSHKQL3R.cjs +0 -121
  265. package/dist/chunk-DVWYO3KK.cjs +0 -1
  266. package/dist/chunk-E4H3ZZ7U.js +0 -4
  267. package/dist/chunk-EFKEVWAD.js +0 -4
  268. package/dist/chunk-EHWUALGH.cjs +0 -1
  269. package/dist/chunk-EI7FRSNY.js +0 -57
  270. package/dist/chunk-ELFQKQLL.js +0 -2
  271. package/dist/chunk-EML5FDUU.js +0 -2
  272. package/dist/chunk-EN65ZEK2.cjs +0 -2
  273. package/dist/chunk-EON4XLKQ.cjs +0 -1
  274. package/dist/chunk-EUQAOYEO.cjs +0 -121
  275. package/dist/chunk-EVAUBT7H.js +0 -57
  276. package/dist/chunk-EW424IBO.cjs +0 -1
  277. package/dist/chunk-EYHD7HZE.cjs +0 -1
  278. package/dist/chunk-EYYIPA5N.js +0 -432
  279. package/dist/chunk-EZIDQBXI.cjs +0 -1
  280. package/dist/chunk-F2O4QO5N.cjs +0 -383
  281. package/dist/chunk-F4ITQ6XQ.cjs +0 -3
  282. package/dist/chunk-FBWLSWZ4.js +0 -122
  283. package/dist/chunk-FDKU7HJX.js +0 -2
  284. package/dist/chunk-FG3IFGJP.cjs +0 -1
  285. package/dist/chunk-FGN6IMPY.cjs +0 -3
  286. package/dist/chunk-FK2BG4HU.js +0 -3
  287. package/dist/chunk-FLMUMPDE.js +0 -2
  288. package/dist/chunk-FLS2FJM6.cjs +0 -431
  289. package/dist/chunk-FP5UK272.cjs +0 -1
  290. package/dist/chunk-FSL3NLRT.cjs +0 -2
  291. package/dist/chunk-FUFS65Q5.js +0 -133
  292. package/dist/chunk-GIS6X43A.cjs +0 -3
  293. package/dist/chunk-GNEVCEJU.cjs +0 -3
  294. package/dist/chunk-GNOSG3PK.cjs +0 -1
  295. package/dist/chunk-GQGFNTDZ.js +0 -2
  296. package/dist/chunk-GTR7JAKP.cjs +0 -3
  297. package/dist/chunk-GV2IB4WQ.cjs +0 -56
  298. package/dist/chunk-GWIZT2P5.js +0 -57
  299. package/dist/chunk-H3FJ54KB.cjs +0 -121
  300. package/dist/chunk-HPIJI7TM.js +0 -3
  301. package/dist/chunk-HPYH7GTS.cjs +0 -1
  302. package/dist/chunk-HRAY65XH.js +0 -3
  303. package/dist/chunk-HTYVI2HK.cjs +0 -9
  304. package/dist/chunk-HY3EAWB2.js +0 -4
  305. package/dist/chunk-I6UJVO2P.js +0 -57
  306. package/dist/chunk-IKGVPXMK.js +0 -3
  307. package/dist/chunk-IQSF6XRV.js +0 -57
  308. package/dist/chunk-IXGDTAES.js +0 -4
  309. package/dist/chunk-J6V573PE.cjs +0 -1
  310. package/dist/chunk-JA44K75G.js +0 -2
  311. package/dist/chunk-JB4WG2YJ.cjs +0 -121
  312. package/dist/chunk-JCEJ4VTN.js +0 -20
  313. package/dist/chunk-JRUQ5ABB.js +0 -4
  314. package/dist/chunk-JV4HJBXW.js +0 -14
  315. package/dist/chunk-JZ7Z6WC2.cjs +0 -3
  316. package/dist/chunk-K5XGP57D.cjs +0 -19
  317. package/dist/chunk-K73HOMQY.cjs +0 -56
  318. package/dist/chunk-KEITOXIP.js +0 -2
  319. package/dist/chunk-KMFLHGD5.cjs +0 -1
  320. package/dist/chunk-KZHXYXSH.cjs +0 -10
  321. package/dist/chunk-L3Q64RUX.js +0 -3
  322. package/dist/chunk-LBLFU6KI.js +0 -57
  323. package/dist/chunk-LEBM6ZSZ.cjs +0 -10
  324. package/dist/chunk-LP3HRZGK.js +0 -57
  325. package/dist/chunk-LPFRMQFQ.js +0 -121
  326. package/dist/chunk-LQ3YZTPU.cjs +0 -15
  327. package/dist/chunk-LVBHOZZF.js +0 -4
  328. package/dist/chunk-LWM4WABU.js +0 -3
  329. package/dist/chunk-LY7N3UHH.cjs +0 -23
  330. package/dist/chunk-LYU44UNN.cjs +0 -56
  331. package/dist/chunk-M75VGFCI.js +0 -3
  332. package/dist/chunk-MCIZG4A3.cjs +0 -1
  333. package/dist/chunk-MDLJTZLV.cjs +0 -1
  334. package/dist/chunk-MFNN5DYG.cjs +0 -1
  335. package/dist/chunk-MJAODEFC.cjs +0 -121
  336. package/dist/chunk-MLCBSEBU.js +0 -2
  337. package/dist/chunk-MSC4G2HF.cjs +0 -2
  338. package/dist/chunk-MYHNTJLR.cjs +0 -56
  339. package/dist/chunk-N2YHO2WI.cjs +0 -3
  340. package/dist/chunk-N4FXLQE3.cjs +0 -132
  341. package/dist/chunk-N5POANYV.js +0 -2
  342. package/dist/chunk-N6MNQIQU.js +0 -123
  343. package/dist/chunk-NGNJSUGL.cjs +0 -1
  344. package/dist/chunk-NPBXLPOP.js +0 -3
  345. package/dist/chunk-NRE6VKL6.cjs +0 -121
  346. package/dist/chunk-O4YE57OS.cjs +0 -6
  347. package/dist/chunk-O7CBGP4N.cjs +0 -1
  348. package/dist/chunk-OBYAIJVU.js +0 -11
  349. package/dist/chunk-OJ3H4AQ2.cjs +0 -56
  350. package/dist/chunk-OLRCZ6E3.js +0 -2
  351. package/dist/chunk-ON5XJEPO.cjs +0 -3
  352. package/dist/chunk-OOVNTOZC.cjs +0 -56
  353. package/dist/chunk-OPTVCCQQ.cjs +0 -122
  354. package/dist/chunk-OT2Z4XBD.cjs +0 -1
  355. package/dist/chunk-P6JITOFF.js +0 -4
  356. package/dist/chunk-PFKVHUOT.js +0 -432
  357. package/dist/chunk-PFTBTWSC.cjs +0 -1
  358. package/dist/chunk-PITMDQYN.cjs +0 -18
  359. package/dist/chunk-PTPVFLET.js +0 -20
  360. package/dist/chunk-PYUWSKKP.js +0 -57
  361. package/dist/chunk-PZDLPRJF.js +0 -4
  362. package/dist/chunk-Q5TFO66G.cjs +0 -1
  363. package/dist/chunk-QC4YXUBT.cjs +0 -383
  364. package/dist/chunk-QO5ZWQA3.cjs +0 -74
  365. package/dist/chunk-QUTYCUST.js +0 -4
  366. package/dist/chunk-QYN6C3FZ.cjs +0 -114
  367. package/dist/chunk-REKKBAQX.cjs +0 -56
  368. package/dist/chunk-REQ622YC.js +0 -3
  369. package/dist/chunk-RPRGGGIW.js +0 -11
  370. package/dist/chunk-RTNQP6BV.js +0 -2
  371. package/dist/chunk-RUJW47ZJ.js +0 -2
  372. package/dist/chunk-RVBSJ4UQ.cjs +0 -7
  373. package/dist/chunk-RXYCFZJC.cjs +0 -121
  374. package/dist/chunk-RYHOWZLK.js +0 -2
  375. package/dist/chunk-RYXLEFS5.js +0 -2
  376. package/dist/chunk-S2MZNEBQ.cjs +0 -1
  377. package/dist/chunk-S5HTTLN7.cjs +0 -2
  378. package/dist/chunk-S73YERS2.js +0 -57
  379. package/dist/chunk-SBNMXQNO.cjs +0 -2
  380. package/dist/chunk-SLMIYECU.js +0 -2
  381. package/dist/chunk-SMQ6736Y.js +0 -57
  382. package/dist/chunk-SRIXRJHL.js +0 -4
  383. package/dist/chunk-T3DJ3UTP.cjs +0 -121
  384. package/dist/chunk-TBHNE4VV.js +0 -2
  385. package/dist/chunk-TCFL3UWT.cjs +0 -2
  386. package/dist/chunk-TEY5LZ26.cjs +0 -56
  387. package/dist/chunk-TJZO7ZSX.cjs +0 -3
  388. package/dist/chunk-TKUNRCRH.js +0 -4
  389. package/dist/chunk-TQLCOMKC.js +0 -4
  390. package/dist/chunk-TRXYDWGE.cjs +0 -1
  391. package/dist/chunk-TS55CUNJ.js +0 -57
  392. package/dist/chunk-TYQYKKWJ.js +0 -16
  393. package/dist/chunk-U6KFONKM.js +0 -2
  394. package/dist/chunk-UFBJ3WOZ.js +0 -2
  395. package/dist/chunk-UNYXWPLZ.cjs +0 -2
  396. package/dist/chunk-UQRVQUVR.js +0 -2
  397. package/dist/chunk-UW5W35NP.js +0 -122
  398. package/dist/chunk-UWHWSWDE.js +0 -2
  399. package/dist/chunk-UWVBFRCW.js +0 -2
  400. package/dist/chunk-UZWYFEUN.js +0 -122
  401. package/dist/chunk-V4FAL7AG.js +0 -2
  402. package/dist/chunk-VI7WCO2J.cjs +0 -3
  403. package/dist/chunk-VOYPKTID.cjs +0 -1
  404. package/dist/chunk-VQ53TFYA.cjs +0 -1
  405. package/dist/chunk-VRZC4TTF.cjs +0 -1
  406. package/dist/chunk-VTOL3URF.js +0 -4
  407. package/dist/chunk-VVVCCB6R.js +0 -2
  408. package/dist/chunk-W2GPP6RB.js +0 -122
  409. package/dist/chunk-W45TLOOT.js +0 -2
  410. package/dist/chunk-WAVGRSE6.js +0 -2
  411. package/dist/chunk-WHOA7YJU.cjs +0 -1
  412. package/dist/chunk-WNRUPL26.js +0 -2
  413. package/dist/chunk-WPM6LFCY.js +0 -2
  414. package/dist/chunk-WXT2XW7T.js +0 -13
  415. package/dist/chunk-X473JI7Z.js +0 -75
  416. package/dist/chunk-X6HUA6EF.cjs +0 -20
  417. package/dist/chunk-XBQ6HV3T.cjs +0 -114
  418. package/dist/chunk-XDPLVJRO.js +0 -21
  419. package/dist/chunk-XDQVYCIR.cjs +0 -1
  420. package/dist/chunk-XFYSADHV.cjs +0 -2
  421. package/dist/chunk-XIAJQLGS.js +0 -2
  422. package/dist/chunk-XK6UB77Q.js +0 -4
  423. package/dist/chunk-XOR64WUQ.cjs +0 -19
  424. package/dist/chunk-XP7BXFXT.cjs +0 -121
  425. package/dist/chunk-Y2VHO66Q.cjs +0 -3
  426. package/dist/chunk-Y2YAKDEQ.js +0 -2
  427. package/dist/chunk-Y5O2OD7J.cjs +0 -3
  428. package/dist/chunk-YARB43JG.cjs +0 -56
  429. package/dist/chunk-YENNL5HG.js +0 -2
  430. package/dist/chunk-YGI5W4RS.js +0 -2
  431. package/dist/chunk-YLCEMVYY.cjs +0 -56
  432. package/dist/chunk-YSOM57GK.cjs +0 -3
  433. package/dist/chunk-YUUXFD73.js +0 -19
  434. package/dist/chunk-Z2SN2MYP.js +0 -122
  435. package/dist/chunk-Z3UVDGYS.cjs +0 -56
  436. package/dist/chunk-ZAKYTBEN.js +0 -3
  437. package/dist/chunk-ZHA446FA.cjs +0 -1
  438. package/dist/chunk-ZO3YB5DK.cjs +0 -1
  439. package/dist/chunk-ZOVH6QT5.cjs +0 -1
  440. package/dist/chunk-ZRIBWDYJ.js +0 -384
  441. package/dist/chunk-ZTLGK6R4.cjs +0 -12
  442. package/dist/chunk-ZUBJ6RLQ.cjs +0 -1
  443. package/dist/chunk-ZWDBPEXL.js +0 -115
  444. package/dist/client.d.cts +0 -1266
  445. package/dist/client.d.ts +0 -1266
  446. package/dist/d1-5ZQJOFDX.cjs +0 -1
  447. package/dist/d1-HPB6B253.js +0 -2
  448. package/dist/dist-es-3SSNUZST.cjs +0 -1
  449. package/dist/dist-es-64F22JL2.js +0 -2
  450. package/dist/dist-es-A5OF2STN.cjs +0 -2
  451. package/dist/dist-es-BOW5V247.cjs +0 -6
  452. package/dist/dist-es-CRIMATLL.cjs +0 -2
  453. package/dist/dist-es-DL3VLVP6.cjs +0 -1
  454. package/dist/dist-es-F2ZR55UK.js +0 -4
  455. package/dist/dist-es-IPSSZNFP.js +0 -1
  456. package/dist/dist-es-M2F7M27Y.js +0 -2
  457. package/dist/dist-es-M66JKZF5.js +0 -7
  458. package/dist/dist-es-OKLLRYI3.js +0 -2
  459. package/dist/dist-es-P25IKLBI.cjs +0 -1
  460. package/dist/dist-es-SRPWSAF4.cjs +0 -1
  461. package/dist/dist-es-SVHZDVUF.js +0 -3
  462. package/dist/dist-es-T2H2W5BX.cjs +0 -3
  463. package/dist/dist-es-WFI55HKT.js +0 -3
  464. package/dist/drizzle-orm-47ELDEM6.cjs +0 -1
  465. package/dist/drizzle-orm-XRTSOQJS.js +0 -1
  466. package/dist/event-streams-7NAWZW2I.js +0 -1
  467. package/dist/event-streams-JBMWCI2O.cjs +0 -1
  468. package/dist/fs-KWBRQ6T6.js +0 -1
  469. package/dist/fs-ZQYOJOIO.cjs +0 -1
  470. package/dist/index-8Ino7vKq.d.ts +0 -105
  471. package/dist/index-B9BFNOHd.d.cts +0 -105
  472. package/dist/index-ByOM1Y5x.d.ts +0 -105
  473. package/dist/index-C6xmtRio.d.cts +0 -105
  474. package/dist/index-CTI3K_uq.d.cts +0 -105
  475. package/dist/index-CTL4zv_u.d.ts +0 -105
  476. package/dist/index-CaDbioSg.d.ts +0 -105
  477. package/dist/index-CxA9uOv0.d.ts +0 -105
  478. package/dist/index-D6AXbuPI.d.ts +0 -105
  479. package/dist/index-DF0KDBaM.d.cts +0 -105
  480. package/dist/index-DG4Xu7gA.d.cts +0 -105
  481. package/dist/index-DS3DpJli.d.cts +0 -105
  482. package/dist/index-NGnJpSgf.d.ts +0 -105
  483. package/dist/index-Zrg3sZ6R.d.cts +0 -105
  484. package/dist/index-eHex8Iwj.d.ts +0 -105
  485. package/dist/index-rm7uyOK1.d.cts +0 -105
  486. package/dist/jsonwebtoken-DFB6ZBZA.cjs +0 -8
  487. package/dist/jsonwebtoken-OD67R5JS.js +0 -9
  488. package/dist/lib-5QYYN6ML.cjs +0 -12
  489. package/dist/lib-A2D63VXD.cjs +0 -1
  490. package/dist/lib-JQD2JAOO.js +0 -2
  491. package/dist/lib-XXYYUPMW.js +0 -13
  492. package/dist/loadSso-JY4WDQPS.cjs +0 -2
  493. package/dist/loadSso-UQR6545M.js +0 -3
  494. package/dist/local-6UUGBZ4M.js +0 -1
  495. package/dist/local-DPLKZQA3.js +0 -1
  496. package/dist/local-KR3AIGVA.cjs +0 -1
  497. package/dist/local-S5VA7IXE.cjs +0 -1
  498. package/dist/local-T7GISZBL.js +0 -1
  499. package/dist/local-ZYHV3J2K.cjs +0 -1
  500. package/dist/media-3Z6YW5J4.cjs +0 -1
  501. package/dist/media-E762GEHL.js +0 -1
  502. package/dist/mongo-auth-adapter-2H2AXDRH.cjs +0 -1
  503. package/dist/mongo-auth-adapter-EUHAYWJ6.cjs +0 -1
  504. package/dist/mongo-auth-adapter-FW7ATYQ6.js +0 -1
  505. package/dist/mongo-auth-adapter-GR2CFFEA.js +0 -1
  506. package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +0 -1
  507. package/dist/mongo-auth-adapter-YWMEOC42.js +0 -1
  508. package/dist/nodemailer-IDML4L6W.cjs +0 -53
  509. package/dist/nodemailer-NITB45SS.js +0 -54
  510. package/dist/nodemailer-transport-3VWVUBM5.cjs +0 -1
  511. package/dist/nodemailer-transport-7RHATUKL.js +0 -1
  512. package/dist/nodemailer-transport-CHO2WKIY.js +0 -1
  513. package/dist/nodemailer-transport-ED2IXNGW.cjs +0 -1
  514. package/dist/postgres-auth-adapter-QKBNXVPT.js +0 -1
  515. package/dist/postgres-auth-adapter-SK3N3OSS.js +0 -1
  516. package/dist/postgres-auth-adapter-WMLM4UUC.cjs +0 -1
  517. package/dist/postgres-auth-adapter-ZO6HK5AK.cjs +0 -1
  518. package/dist/postgres-js-7YBZKGXG.cjs +0 -1
  519. package/dist/postgres-js-JLFIWOBH.js +0 -1
  520. package/dist/redis-adapter-EGMUN65D.cjs +0 -1
  521. package/dist/redis-adapter-EVK2SMKH.cjs +0 -1
  522. package/dist/redis-adapter-LY2NBSAG.js +0 -1
  523. package/dist/redis-adapter-QPCTMF55.js +0 -1
  524. package/dist/schema-RT6WSUYC.cjs +0 -1
  525. package/dist/schema-YFMSJK2P.js +0 -2
  526. package/dist/signin-N3T2KF5Q.js +0 -3
  527. package/dist/signin-VFBLX7EL.cjs +0 -2
  528. package/dist/sqlite-adapter-52PL52VU.js +0 -1
  529. package/dist/sqlite-adapter-KPSISY6E.cjs +0 -1
  530. package/dist/sqlite-adapter-MNNZZXGX.cjs +0 -1
  531. package/dist/sqlite-adapter-PI6SIY7O.js +0 -1
  532. package/dist/src-6LAUXXDM.cjs +0 -1
  533. package/dist/src-QBADSZV4.js +0 -1
  534. package/dist/sso-oidc-54BIRYR6.cjs +0 -2
  535. package/dist/sso-oidc-UB7G4END.js +0 -3
  536. package/dist/sts-WAA6I22C.js +0 -3
  537. package/dist/sts-YLXXIB3X.cjs +0 -2
  538. package/dist/types-B5Qz1svz.d.cts +0 -822
  539. package/dist/types-B9oXBEKI.d.cts +0 -330
  540. package/dist/types-B9oXBEKI.d.ts +0 -330
  541. package/dist/types-BRDBNacn.d.ts +0 -839
  542. package/dist/types-Bii0bhUV.d.cts +0 -329
  543. package/dist/types-Bii0bhUV.d.ts +0 -329
  544. package/dist/types-Bt2_ycUO.d.ts +0 -811
  545. package/dist/types-C4wXHImf.d.ts +0 -822
  546. package/dist/types-C8yIAV6K.d.cts +0 -839
  547. package/dist/types-CORUQhY-.d.ts +0 -839
  548. package/dist/types-Cdssrcbz.d.cts +0 -839
  549. package/dist/types-CjGqxBd3.d.cts +0 -330
  550. package/dist/types-CjGqxBd3.d.ts +0 -330
  551. package/dist/types-DBGR-eQl.d.cts +0 -839
  552. package/dist/types-DCWgPFmi.d.cts +0 -822
  553. package/dist/types-DROqAsr0.d.cts +0 -330
  554. package/dist/types-DROqAsr0.d.ts +0 -330
  555. package/dist/types-DlGSbh7I.d.cts +0 -297
  556. package/dist/types-DlGSbh7I.d.ts +0 -297
  557. package/dist/types-DsF64Wrc.d.cts +0 -811
  558. package/dist/types-IeKFn7Ky.d.ts +0 -839
  559. package/dist/types-QglJ7PwT.d.cts +0 -839
  560. package/dist/types-ZrjEVWfi.d.ts +0 -811
  561. package/dist/types-dEy5JxvN.d.ts +0 -822
  562. package/dist/types-tVJc9YbX.d.cts +0 -811
  563. package/dist/types-zt5qIvje.d.ts +0 -839
@@ -0,0 +1,91 @@
1
+ import {generateHTML}from'@tiptap/html';import c from'@tiptap/starter-kit';import p from'@tiptap/extension-link';import g from'@tiptap/extension-image';import x from'@tiptap/extension-text-align';import u from'@tiptap/extension-underline';import m from'@tiptap/extension-highlight';import F from'@tiptap/extension-task-list';import y from'@tiptap/extension-task-item';import {TextStyle}from'@tiptap/extension-text-style';import f from'@tiptap/extension-color';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ function k(e){return e.type==="text"}function R(e){return e.type==="number"}function B(e){return e.type==="relationship"}function T(e){return e.type==="array"}function w(e){return e.type==="group"}function I(e){return e.type==="blocks"}function D(e){return e.type==="upload"}function A(e){return e.type==="image"}function L(e){return e.type==="richtext"}function C(e){return e.type==="select"}function V(e){return e.type==="row"||e.type==="collapsible"||e.type==="tabs"}function E(e){return e.type==="icon"}function S(e){return e.type==="embedding"}var o=["text","number","checkbox","date","email","password","textarea","select","radio","color","icon"],a=["richtext","json","code","upload","image","markdown","embedding"],l=["relationship","array","group","blocks"],d=["row","collapsible","tabs"],q=[...o,...a,...l,...d];function O(e,t,i){return {name:e,type:"relationship",relationTo:t,...i,required:i?.required??false}}var X=`
3
+ .kyro-richtext {
4
+ color: inherit;
5
+ line-height: 1.7;
6
+ }
7
+
8
+ .kyro-richtext > *:first-child {
9
+ margin-top: 0;
10
+ }
11
+
12
+ .kyro-richtext > *:last-child {
13
+ margin-bottom: 0;
14
+ }
15
+
16
+ .kyro-richtext p,
17
+ .kyro-richtext ul,
18
+ .kyro-richtext ol,
19
+ .kyro-richtext blockquote,
20
+ .kyro-richtext pre {
21
+ margin: 0 0 1rem;
22
+ }
23
+
24
+ .kyro-richtext h1,
25
+ .kyro-richtext h2,
26
+ .kyro-richtext h3,
27
+ .kyro-richtext h4,
28
+ .kyro-richtext h5,
29
+ .kyro-richtext h6 {
30
+ margin: 0 0 0.75rem;
31
+ line-height: 1.2;
32
+ }
33
+
34
+ .kyro-richtext ul,
35
+ .kyro-richtext ol {
36
+ padding-left: 1.5rem;
37
+ }
38
+
39
+ .kyro-richtext blockquote {
40
+ border-left: 4px solid rgba(148, 163, 184, 0.5);
41
+ margin-left: 0;
42
+ padding-left: 1rem;
43
+ font-style: italic;
44
+ }
45
+
46
+ .kyro-richtext pre {
47
+ overflow-x: auto;
48
+ border-radius: 0.75rem;
49
+ background: rgba(15, 23, 42, 0.92);
50
+ color: #f8fafc;
51
+ padding: 1rem;
52
+ }
53
+
54
+ .kyro-richtext code {
55
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
56
+ }
57
+
58
+ .kyro-richtext img {
59
+ display: block;
60
+ max-width: 100%;
61
+ height: auto;
62
+ border-radius: 0.75rem;
63
+ }
64
+
65
+ .kyro-richtext ul[data-type="taskList"] {
66
+ list-style: none;
67
+ padding: 0;
68
+ }
69
+
70
+ .kyro-richtext li[data-type="taskItem"] {
71
+ display: flex;
72
+ align-items: flex-start;
73
+ gap: 0.5rem;
74
+ }
75
+
76
+ .kyro-richtext li[data-type="taskItem"] > label {
77
+ user-select: none;
78
+ pointer-events: none;
79
+ margin-top: 0.2rem;
80
+ }
81
+
82
+ .kyro-richtext li[data-type="taskItem"] > div {
83
+ flex: 1;
84
+ }
85
+
86
+ .kyro-richtext mark {
87
+ background-color: #fef08a;
88
+ border-radius: 0.25rem;
89
+ padding: 0.125rem 0.25rem;
90
+ }
91
+ `.trim(),h=[c,p.configure({openOnClick:false}),g,x.configure({types:["heading","paragraph"]}),u,m.configure({multicolor:true}),F,y.configure({nested:true}),TextStyle,f];function $(e){return typeof e=="object"&&e!==null?e:{}}function Q(e){if(typeof e!="object"||e===null)return "";try{return `<div class="kyro-richtext">${generateHTML(e,h)}</div>`}catch(t){return console.error("Failed to render rich text:",t),""}}export{k as a,R as b,B as c,T as d,w as e,I as f,D as g,A as h,L as i,C as j,V as k,E as l,S as m,o as n,a as o,l as p,d as q,q as r,O as s,X as t,$ as u,Q as v};
@@ -1,4 +1,5 @@
1
- 'use strict';var chunkHPYH7GTS_cjs=require('./chunk-HPYH7GTS.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,bodyHtml:i,ctaText:n,ctaUrl:a,secondaryCtaText:l,secondaryCtaUrl:p}=o,f=e?.siteName||"Lagos Buka",m=e?.logoUrl||"https://resources.lagosbukasantonio.com/lagosbuka.svg",u=e?.logoDarkUrl||e?.logoUrl||m,K=e?.appUrl||"https://lagosbukasantonio.com";return `<!DOCTYPE html>
1
+ import {a}from'./chunk-W5GDZG64.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ function c(o){let{brand:e,title:t,badge:r,previewText:s=t,bodyHtml:i,ctaText:n,ctaUrl:a,secondaryCtaText:l,secondaryCtaUrl:g}=o,f=e?.siteName||"Lagos Buka",m=e?.logoUrl||"https://resources.lagosbukasantonio.com/lagosbuka.svg",u=e?.logoDarkUrl||e?.logoUrl||m,K=e?.appUrl||"https://lagosbukasantonio.com";return `<!DOCTYPE html>
2
3
  <html lang="en">
3
4
  <head>
4
5
  <meta charset="UTF-8">
@@ -80,8 +81,8 @@
80
81
  <a href="${a}" target="_blank" class="email-btn-primary" style="display: inline-block; padding: 12px 24px; background-color: #0b3b24; color: #ffffff; font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 12px; box-shadow: 0 2px 6px rgba(11, 59, 36, 0.15);">
81
82
  ${n} &rarr;
82
83
  </a>
83
- ${l&&p?`
84
- <a href="${p}" target="_blank" style="display: inline-block; padding: 12px 20px; margin-left: 8px; background-color: #f8fafc; border: 1px solid #e2e8f0; color: #334155; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 12px;">
84
+ ${l&&g?`
85
+ <a href="${g}" target="_blank" style="display: inline-block; padding: 12px 20px; margin-left: 8px; background-color: #f8fafc; border: 1px solid #e2e8f0; color: #334155; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 12px;">
85
86
  ${l}
86
87
  </a>
87
88
  `:""}
@@ -103,7 +104,7 @@
103
104
  </tr>
104
105
  </table>
105
106
  </body>
106
- </html>`}chunkBUNLC3II_cjs.h();function b(o,e="User",t){let r="Confirm your email address \u2014 Kyro CMS",s=`
107
+ </html>`}function b(o,e="User",t){let r="Confirm your email address \u2014 Kyro CMS",s=`
107
108
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
108
109
  Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
109
110
  </p>
@@ -124,14 +125,14 @@
124
125
  <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
125
126
  This verification link will expire in 24 hours. If you did not create an account, you can safely ignore this email.
126
127
  </p>
127
- `,i=g({brand:t,title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",bodyHtml:s,ctaText:"Confirm Email Address",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome, ${e}!
128
+ `,i=c({brand:t,title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",bodyHtml:s,ctaText:"Confirm Email Address",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome, ${e}!
128
129
 
129
130
  Please verify your email address by visiting:
130
131
  ${o}
131
132
 
132
133
  This link expires in 24 hours.
133
134
 
134
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function x(o,e="User",t){let r="Reset your password \u2014 Kyro CMS",s=`
135
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}function x(o,e="User",t){let r="Reset your password \u2014 Kyro CMS",s=`
135
136
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
136
137
  Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
137
138
  </p>
@@ -152,14 +153,14 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNL
152
153
  <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
153
154
  For security reasons, this link will expire in 1 hour. If you did not request a password reset, no further action is required.
154
155
  </p>
155
- `,i=g({brand:t,title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",bodyHtml:s,ctaText:"Reset Password",ctaUrl:o}),n=`Hello ${e},
156
+ `,i=c({brand:t,title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",bodyHtml:s,ctaText:"Reset Password",ctaUrl:o}),n=`Hello ${e},
156
157
 
157
158
  Reset your password using the following link:
158
159
  ${o}
159
160
 
160
161
  This link will expire in 1 hour.
161
162
 
162
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function _(o="User",e="https://kyro-cms.com",t){let r="Welcome to Kyro CMS!",s=`
163
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}function _(o="User",e="https://kyro-cms.com",t){let r="Welcome to Kyro CMS!",s=`
163
164
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
164
165
  Welcome <strong class="email-strong" style="color: #09090b;">${o}</strong>,
165
166
  </p>
@@ -180,11 +181,11 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}chunkBUNL
180
181
  </td>
181
182
  </tr>
182
183
  </table>
183
- `,i=g({brand:t,title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",bodyHtml:s,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome to Kyro CMS, ${o}!
184
+ `,i=c({brand:t,title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",bodyHtml:s,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome to Kyro CMS, ${o}!
184
185
 
185
186
  Your account is active. Log in at ${e} to start building.
186
187
 
187
- Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}chunkBUNLC3II_cjs.h();function w(o="User",e,t,r){let s="Security Alert: Password Changed \u2014 Kyro CMS",i=new Date().toUTCString(),n=`
188
+ Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}function w(o="User",e,t,r){let s="Security Alert: Password Changed \u2014 Kyro CMS",i=new Date().toUTCString(),n=`
188
189
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
189
190
  Hello <strong class="email-strong" style="color: #09090b;">${o}</strong>,
190
191
  </p>
@@ -211,11 +212,11 @@ Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}chunk
211
212
  </td>
212
213
  </tr>
213
214
  </table>`:""}
214
- `,a=g({brand:e,title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",bodyHtml:n,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: Your Kyro CMS password was updated at ${i}.
215
+ `,a=c({brand:e,title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",bodyHtml:n,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: Your Kyro CMS password was updated at ${i}.
215
216
 
216
217
  If you did not make this change, please reset your password immediately.
217
218
 
218
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}chunkBUNLC3II_cjs.h();function S(o,e,t="User",r){let s="Your one-time login link \u2014 Kyro CMS",i=`
219
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}function S(o,e,t="User",r){let s="Your one-time login link \u2014 Kyro CMS",i=`
219
220
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
220
221
  Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
221
222
  </p>
@@ -241,7 +242,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}chunkBUNL
241
242
  <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
242
243
  This single-use link will expire in 10 minutes. Never share authentication links with anyone.
243
244
  </p>
244
- `,n=g({brand:r,title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",bodyHtml:i,ctaText:"Sign In Now",ctaUrl:o}),a=`Hello ${t},
245
+ `,n=c({brand:r,title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",bodyHtml:i,ctaText:"Sign In Now",ctaUrl:o}),a=`Hello ${t},
245
246
 
246
247
  Sign in to Kyro CMS using the link below:
247
248
  ${o}${e?`
@@ -250,7 +251,7 @@ Or enter code: ${e}`:""}
250
251
 
251
252
  This link expires in 10 minutes.
252
253
 
253
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function C(o,e,t="User",r,s,i){let n="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",a=`
254
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}function C(o,e,t="User",r,s,i){let n="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",a=`
254
255
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
255
256
  Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
256
257
  </p>
@@ -277,9 +278,9 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNL
277
278
  </td>
278
279
  </tr>
279
280
  </table>`:""}
280
- `,l=g({brand:r,title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",bodyHtml:a,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),p=`Security Alert: Account temporarily locked for ${t} after ${o} failed login attempts. Unlocks in ${e} minutes.
281
+ `,l=c({brand:r,title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",bodyHtml:a,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),g=`Security Alert: Account temporarily locked for ${t} after ${o} failed login attempts. Unlocks in ${e} minutes.
281
282
 
282
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:p}}chunkBUNLC3II_cjs.h();function T(o,e="Editor",t="An Administrator",r){let s="You're invited to join Kyro CMS",i=`
283
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:g}}function T(o,e="Editor",t="An Administrator",r){let s="You're invited to join Kyro CMS",i=`
283
284
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
284
285
  Hello,
285
286
  </p>
@@ -296,12 +297,12 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:p}}chunkBUNL
296
297
  </td>
297
298
  </tr>
298
299
  </table>
299
- `,n=g({brand:r,title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,bodyHtml:i,ctaText:"Accept Invitation",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
300
+ `,n=c({brand:r,title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,bodyHtml:i,ctaText:"Accept Invitation",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
300
301
 
301
302
  Accept your invitation here:
302
303
  ${o}
303
304
 
304
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function k(o,e,t="User",r,s="Unknown Device"){let i="Security Alert: New Sign-in to Kyro CMS",n=`
305
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}function k(o,e,t="User",r,s="Unknown Device"){let i="Security Alert: New Sign-in to Kyro CMS",n=`
305
306
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
306
307
  Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
307
308
  </p>
@@ -329,7 +330,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNL
329
330
  </td>
330
331
  </tr>
331
332
  </table>
332
- `,a=g({brand:r,title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",bodyHtml:n,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: New Sign-in to Kyro CMS
333
+ `,a=c({brand:r,title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",bodyHtml:n,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: New Sign-in to Kyro CMS
333
334
 
334
335
  Hello ${t},
335
336
 
@@ -337,7 +338,7 @@ A new sign-in to your account was detected at ${e} from ${o} using ${s}.
337
338
 
338
339
  If you did not sign in recently, please reset your password immediately.
339
340
 
340
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function E(o,e="Customer",t,r,s){let i=`Order confirmed #${o}`,n=`
341
+ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}function E(o,e="Customer",t,r,s){let i=`Order confirmed #${o}`,n=`
341
342
  <p class="email-text" style="margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: #475569; text-align: center;">
342
343
  Hi ${e}, thanks for your order. We're getting your food freshly prepared.
343
344
  </p>
@@ -362,13 +363,13 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}chunkBUNL
362
363
  <p style="margin: 0; font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.5;">
363
364
  You can track the live preparation and delivery status anytime.
364
365
  </p>
365
- `,a=g({brand:s,title:"Order Confirmed",badge:"Order received",previewText:`Your order #${o} has been confirmed.`,bodyHtml:n,ctaText:"Track order live",ctaUrl:r||"https://lagosbukasantonio.com/track-order"}),l=`Hi ${e},
366
+ `,a=c({brand:s,title:"Order Confirmed",badge:"Order received",previewText:`Your order #${o} has been confirmed.`,bodyHtml:n,ctaText:"Track order live",ctaUrl:r||"https://lagosbukasantonio.com/track-order"}),l=`Hi ${e},
366
367
 
367
368
  Thank you for your order #${o}!
368
369
 
369
370
  Total: ${t}
370
371
 
371
- Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function v(o,e="Customer",t,r,s){let i=`Your Order #${o} is on the way!`,n=`
372
+ Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:a,text:l}}function v(o,e="Customer",t,r,s){let i=`Your Order #${o} is on the way!`,n=`
372
373
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
373
374
  Great news, <strong class="email-strong" style="color: #09090b;">${e}</strong>!
374
375
  </p>
@@ -383,12 +384,12 @@ Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:
383
384
  </td>
384
385
  </tr>
385
386
  </table>
386
- `,a=g({brand:s,title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,bodyHtml:n,ctaText:"Track Package",ctaUrl:r}),l=`Hi ${e},
387
+ `,a=c({brand:s,title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,bodyHtml:n,ctaText:"Track Package",ctaUrl:r}),l=`Hi ${e},
387
388
 
388
389
  Your order #${o} has been shipped!
389
390
 
390
391
  Tracking Number: ${t}
391
- Track it here: ${r}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();function A(o,e="Customer",t,r){let s=`Your Order #${o} has been delivered`,i=`
392
+ Track it here: ${r}`;return {subject:i,html:a,text:l}}function A(o,e="Customer",t,r){let s=`Your Order #${o} has been delivered`,i=`
392
393
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
393
394
  Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
394
395
  </p>
@@ -398,11 +399,11 @@ Track it here: ${r}`;return {subject:i,html:a,text:l}}chunkBUNLC3II_cjs.h();func
398
399
  <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
399
400
  We'd love to hear your thoughts. If you have a minute, please leave a review for your items.
400
401
  </p>
401
- `,n=g({brand:r,title:"Order Delivered",previewText:`Your order #${o} has arrived!`,bodyHtml:i,ctaText:"Leave a Review",ctaUrl:t}),a=`Hi ${e},
402
+ `,n=c({brand:r,title:"Order Delivered",previewText:`Your order #${o} has arrived!`,bodyHtml:i,ctaText:"Leave a Review",ctaUrl:t}),a=`Hi ${e},
402
403
 
403
404
  Your order #${o} has been delivered!
404
405
 
405
- Leave a review here: ${t}`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function R(o,e="Customer",t,r){let s=`Refund Processed for Order #${o}`,i=`
406
+ Leave a review here: ${t}`;return {subject:s,html:n,text:a}}function R(o,e="Customer",t,r){let s=`Refund Processed for Order #${o}`,i=`
406
407
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
407
408
  Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
408
409
  </p>
@@ -417,20 +418,20 @@ Leave a review here: ${t}`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h(
417
418
  </td>
418
419
  </tr>
419
420
  </table>
420
- `,n=g({brand:r,title:"Refund Processed",previewText:`We have processed a refund of ${t} for order #${o}.`,bodyHtml:i,ctaText:"View Store",ctaUrl:"https://kyro-cms.com"}),a=`Hi ${e},
421
+ `,n=c({brand:r,title:"Refund Processed",previewText:`We have processed a refund of ${t} for order #${o}.`,bodyHtml:i,ctaText:"View Store",ctaUrl:"https://kyro-cms.com"}),a=`Hi ${e},
421
422
 
422
423
  We have processed a refund of ${t} for order #${o}.
423
424
 
424
- View store: https://kyro-cms.com`;return {subject:s,html:n,text:a}}chunkBUNLC3II_cjs.h();function I(o="Customer",e,t){let r="You left something behind...",s=`
425
+ View store: https://kyro-cms.com`;return {subject:s,html:n,text:a}}function I(o="Customer",e,t){let r="You left something behind...",s=`
425
426
  <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
426
427
  Hi <strong class="email-strong" style="color: #09090b;">${o}</strong>,
427
428
  </p>
428
429
  <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
429
430
  We noticed you left some great items in your shopping cart. They are still waiting for you, but they might sell out soon!
430
431
  </p>
431
- `,i=g({brand:t,title:"Complete Your Purchase",previewText:"Your shopping cart is waiting for you. Complete your purchase now.",bodyHtml:s,ctaText:"Return to Checkout",ctaUrl:e}),n=`Hi ${o},
432
+ `,i=c({brand:t,title:"Complete Your Purchase",previewText:"Your shopping cart is waiting for you. Complete your purchase now.",bodyHtml:s,ctaText:"Return to Checkout",ctaUrl:e}),n=`Hi ${o},
432
433
 
433
- You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:n}}function $(o){return {verifyEmail:(e,t)=>b(e,t,o),resetPassword:(e,t)=>x(e,t,o),welcome:(e,t)=>_(e,t,o),passwordChanged:e=>w(e,o),magicLink:(e,t,r)=>S(e,t,r,o),accountLocked:(e,t,r)=>C(e,t,r,o),newLogin:(e,t,r)=>k(e,t,r,o),userInvite:(e,t,r)=>T(e,t,r,o),orderConfirmation:(e,t,r,s)=>E(e,t,r||"0.00",s,o),orderShipped:(e,t,r,s)=>v(e,t,r||"",s||"",o),orderDelivered:(e,t,r)=>A(e,t,r||"",o),orderRefunded:(e,t,r)=>R(e,t,r||"0.00",o),abandonedCart:(e,t)=>I(e,t||"",o)}}chunkBUNLC3II_cjs.h();var O=false,y=class o{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(chunkHPYH7GTS_cjs.a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!O)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-47ELDEM6.cjs');await this.db.execute(e`
434
+ You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:n}}function $(o){return {verifyEmail:(e,t)=>b(e,t,o),resetPassword:(e,t)=>x(e,t,o),welcome:(e,t)=>_(e,t,o),passwordChanged:e=>w(e,o),magicLink:(e,t,r)=>S(e,t,r,o),accountLocked:(e,t,r)=>C(e,t,r,o),newLogin:(e,t,r)=>k(e,t,r,o),userInvite:(e,t,r)=>T(e,t,r,o),orderConfirmation:(e,t,r,s)=>E(e,t,r||"0.00",s,o),orderShipped:(e,t,r,s)=>v(e,t,r||"",s||"",o),orderDelivered:(e,t,r)=>A(e,t,r||"",o),orderRefunded:(e,t,r)=>R(e,t,r||"0.00",o),abandonedCart:(e,t)=>I(e,t||"",o)}}var O=false,y=class o{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!O)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('drizzle-orm');await this.db.execute(e`
434
435
  CREATE TABLE IF NOT EXISTS "settings" (
435
436
  "key" VARCHAR(255) PRIMARY KEY,
436
437
  "value" TEXT NOT NULL,
@@ -444,5 +445,5 @@ You left some items in your cart! Complete your purchase here: ${e}`;return {sub
444
445
  description TEXT,
445
446
  updated_at TEXT
446
447
  )
447
- `),O=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-47ELDEM6.cjs'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let n of i)try{let a=await this.db.execute(s`SELECT * FROM ${s.raw(n)} LIMIT 1`);if(e=Array.isArray(a)?a[0]:a?.rows?a.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-47ELDEM6.cjs'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(chunkHPYH7GTS_cjs.a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[chunkHPYH7GTS_cjs.a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};var U=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...$(e.brand),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-IDML4L6W.cjs');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,n=`"${s||"Kyro CMS"}" <${r}>`,a=e.replyTo||i;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:n,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:a});}break;case "resend":l=await this.sendViaResend(n,e,a);break;case "sendgrid":l=await this.sendViaSendGrid(n,e,a);break;case "mailgun":l=await this.sendViaMailgun(n,e,a);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},n=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`Resend Error: ${JSON.stringify(a)}`)}return n.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(a=>({email:a})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},n=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`SendGrid Error: ${JSON.stringify(a)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:n}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let a=n==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let f=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",f),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let m=await fetch(`https://${a}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!m.ok){let u=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(u)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fetchBrandConfig(e){let t="Kyro CMS",r="https://kyro-cms.com/logo.svg",s="https://kyro-cms.com/logo-white.svg";try{let i=null,n=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),n=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:a}=await import('./drizzle-orm-47ELDEM6.cjs');try{let l=await e.execute(a`SELECT * FROM "_globals_store-settings" LIMIT 1`);i=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}try{let l=await e.execute(a`SELECT * FROM "_globals_brand-settings" LIMIT 1`);n=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}}else if(typeof e?.prepare=="function"){try{i=e.prepare('SELECT * FROM "_globals_store-settings" LIMIT 1').get();}catch{}try{n=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),n?.identity){let a=typeof n.identity=="string"?JSON.parse(n.identity):n.identity,l=async p=>{if(typeof e?.findOne=="function")return (await e.findOne({collection:"media",where:{id:{equals:p}}}))?.url;if(typeof e?.execute=="function"){let{sql:f}=await import('./drizzle-orm-47ELDEM6.cjs');try{let m=await e.execute(f`SELECT url FROM "media" WHERE id = ${p}`);return (Array.isArray(m)?m[0]:m?.rows?m.rows[0]:null)?.url}catch{}}else if(typeof e?.prepare=="function")try{return e.prepare('SELECT url FROM "media" WHERE id = ?').get(p)?.url}catch{}};if(a.primaryLogo){let p=await l(a.primaryLogo);p&&(r=p);}if(a.darkLogo){let p=await l(a.darkLogo);p&&(s=p);}}}catch{}return {siteName:t,logoUrl:r,logoDarkUrl:s,appUrl:process.env.PUBLIC_URL||"https://kyro-cms.com"}}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let i={brand:await this.fetchBrandConfig(e),provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(i)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,n=process.env.SMTP_USER,a=process.env.SMTP_PASS;return !i||!n||!a?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:n,pass:a}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,n=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!n?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:n,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,n=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,a=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!n?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:n,region:a}})}return null}};
448
- exports.a=g;exports.b=b;exports.c=x;exports.d=_;exports.e=w;exports.f=S;exports.g=C;exports.h=T;exports.i=k;exports.j=E;exports.k=v;exports.l=A;exports.m=R;exports.n=I;exports.o=$;exports.p=y;exports.q=U;
448
+ `),O=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('drizzle-orm'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let n of i)try{let a=await this.db.execute(s`SELECT * FROM ${s.raw(n)} LIMIT 1`);if(e=Array.isArray(a)?a[0]:a?.rows?a.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('drizzle-orm'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};var U=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...$(e.brand),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('nodemailer');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,n=`"${s||"Kyro CMS"}" <${r}>`,a=e.replyTo||i;try{let l;switch(t){case "smtp":case "ses":{let g=await this.ensureTransporter();if(!g)throw new Error(`${t} transporter not initialized`);l=await g.sendMail({from:n,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:a});}break;case "resend":l=await this.sendViaResend(n,e,a);break;case "sendgrid":l=await this.sendViaSendGrid(n,e,a);break;case "mailgun":l=await this.sendViaMailgun(n,e,a);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},n=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`Resend Error: ${JSON.stringify(a)}`)}return n.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(a=>({email:a})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},n=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`SendGrid Error: ${JSON.stringify(a)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:n}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let a=n==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),g=new URLSearchParams;g.append("from",e);let f=Array.isArray(t.to)?t.to.join(", "):t.to;g.append("to",f),g.append("subject",t.subject),g.append("html",t.html),t.text&&g.append("text",t.text),r&&g.append("h:Reply-To",r);let m=await fetch(`https://${a}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:g});if(!m.ok){let u=await m.json();throw new Error(`Mailgun Error: ${JSON.stringify(u)}`)}return m.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fetchBrandConfig(e){let t="Kyro CMS",r="https://kyro-cms.com/logo.svg",s="https://kyro-cms.com/logo-white.svg";try{let i=null,n=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),n=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:a}=await import('drizzle-orm');try{let l=await e.execute(a`SELECT * FROM "_globals_store-settings" LIMIT 1`);i=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}try{let l=await e.execute(a`SELECT * FROM "_globals_brand-settings" LIMIT 1`);n=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}}else if(typeof e?.prepare=="function"){try{i=e.prepare('SELECT * FROM "_globals_store-settings" LIMIT 1').get();}catch{}try{n=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),n?.identity){let a=typeof n.identity=="string"?JSON.parse(n.identity):n.identity,l=async g=>{if(typeof e?.findOne=="function")return (await e.findOne({collection:"media",where:{id:{equals:g}}}))?.url;if(typeof e?.execute=="function"){let{sql:f}=await import('drizzle-orm');try{let m=await e.execute(f`SELECT url FROM "media" WHERE id = ${g}`);return (Array.isArray(m)?m[0]:m?.rows?m.rows[0]:null)?.url}catch{}}else if(typeof e?.prepare=="function")try{return e.prepare('SELECT url FROM "media" WHERE id = ?').get(g)?.url}catch{}};if(a.primaryLogo){let g=await l(a.primaryLogo);g&&(r=g);}if(a.darkLogo){let g=await l(a.darkLogo);g&&(s=g);}}}catch{}return {siteName:t,logoUrl:r,logoDarkUrl:s,appUrl:process.env.PUBLIC_URL||"https://kyro-cms.com"}}static async fromConfig(e){let t=new y(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let i={brand:await this.fetchBrandConfig(e),provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(i)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,n=process.env.SMTP_USER,a=process.env.SMTP_PASS;return !i||!n||!a?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:n,pass:a}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,n=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!n?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:n,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,n=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,a=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!n?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:n,region:a}})}return null}};
449
+ export{c as a,b,x as c,_ as d,w as e,S as f,C as g,T as h,k as i,E as j,v as k,A as l,R as m,I as n,$ as o,y as p,U as q};
@@ -0,0 +1,3 @@
1
+ import {e,h}from'./chunk-3N34WXBS.js';import {a}from'./chunk-O4RKZQYQ.js';import {GraphQLScalarType,Kind,GraphQLObjectType,GraphQLString,GraphQLInputObjectType,GraphQLBoolean,GraphQLInt,GraphQLList,GraphQLNonNull,GraphQLSchema,GraphQLUnionType,GraphQLFloat}from'graphql';export{printSchema as e}from'graphql';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ var N=class{db;tenantId;user;caches=new Map;pending=new Map;waiting=new Map;flushScheduled=false;constructor(t){this.db=t.db,this.tenantId=t.tenantId,this.user=t.user;}getCacheKey(t){return t}async load(t,e){let d=this.getCacheKey(t),y=this.caches.get(d);if(y||(y=new Map,this.caches.set(d,y)),y.has(e)&&!this.pending.get(d)?.has(e))return y.get(e);let s=this.pending.get(d);return s||(s=new Set,this.pending.set(d,s)),s.add(e),this.flushScheduled||(this.flushScheduled=true,queueMicrotask(()=>{this.flushScheduled=false,this.flushAll();})),new Promise(i=>{let o=this.waiting.get(`${d}:${e}`);o||(o=[],this.waiting.set(`${d}:${e}`,o)),o.push(i);})}async flushAll(){for(let[t,e]of this.pending){if(e.size===0)continue;let d=t,y=Array.from(e);this.pending.delete(t);try{let s=await this.db.find({collection:d,where:{id:{in:y}},limit:y.length,tenantId:this.tenantId}),i=this.caches.get(t)||new Map,o=new Map;for(let l of s.docs)o.set(l.id,l),i.set(l.id,l);for(let l of y){let w=this.waiting.get(`${t}:${l}`);if(w){let I=o.get(l);for(let m of w)m(I);this.waiting.delete(`${t}:${l}`);}}}catch(s){console.error(`[RelationLoader] Failed to batch load ${d}:`,s);for(let i of y){let o=this.waiting.get(`${t}:${i}`);if(o){for(let l of o)l(void 0);this.waiting.delete(`${t}:${i}`);}}}}}async loadMany(t,e){return Promise.all(e.map(d=>this.load(t,d)))}resolveOne(t,e){return this.caches.get(this.getCacheKey(t))?.get(e)}};var q=new GraphQLScalarType({name:"JSON",description:"Arbitrary JSON value",serialize(n){return n},parseValue(n){return n},parseLiteral(n){switch(n.kind){case Kind.STRING:return n.value;case Kind.INT:case Kind.FLOAT:return parseFloat(n.value);case Kind.BOOLEAN:return n.value;case Kind.OBJECT:{let t={};for(let e of n.fields)t[e.name.value]=q.parseLiteral(e.value);return t}case Kind.LIST:return n.values.map(t=>q.parseLiteral(t));case Kind.NULL:return null;default:return null}}});function oe(n){return t=>{let e=0;return {Field(){e++,e>n&&t.reportError(new Error(`Query exceeds max depth of ${n}`));},leaveField(){e--;}}}}function L(n){return n.split(/[-_]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Z(n){let t=L(n);return t.charAt(0).toLowerCase()+t.slice(1)}function O(n){return n.endsWith("s")&&n.length>1?n.slice(0,-1):n}async function P(n,t,e$1){let d=n.access?.[t];if(e$1.apiKey){if(e$1.apiKey.permissions?.length>0){let s=n.slug,o=`${s}:${t==="read"?"read":t==="create"?"create":"update"}`;return !e(e$1.apiKey.permissions,o)&&!e(e$1.apiKey.permissions,`${s}:admin`)?{allowed:false}:{allowed:true}}if(d){let s=await h(d,{req:e$1.req,user:e$1.user,tenantId:e$1.tenantId});return typeof s=="boolean"?{allowed:s}:{allowed:true,extraWhere:s}}return {allowed:true}}if(e$1.user){let s=n.slug,o=`${s}:${t==="read"?"read":t==="create"?"create":t==="update"?"update":"delete"}`;if(!a({id:e$1.user.id,email:e$1.user.email,role:e$1.user.role},o)&&!a({id:e$1.user.id,email:e$1.user.email,role:e$1.user.role},`${s}:admin`)&&!d)return {allowed:false}}if(!d)return e$1.user?{allowed:true}:{allowed:false};let y=await h(d,{req:e$1.req,user:e$1.user,tenantId:e$1.tenantId});return typeof y=="boolean"?{allowed:y}:{allowed:true,extraWhere:y}}async function ee(n,t,e$1){let d=n.access?.[t];if(e$1.apiKey){if(e$1.apiKey.permissions?.length>0){let s=n.slug,i=`${s}:${t}`;return !e(e$1.apiKey.permissions,i)&&!e(e$1.apiKey.permissions,`${s}:admin`)&&!e(e$1.apiKey.permissions,`${s}:*`)?{allowed:false}:{allowed:true}}if(d){let s=await h(d,{req:e$1.req,user:e$1.user,tenantId:e$1.tenantId});return {allowed:typeof s=="boolean"?s:true}}return {allowed:true}}if(!d){if(!e$1.user)return {allowed:false};let s=e$1.user.role;return s==="super_admin"||s==="admin"?{allowed:true}:{allowed:false}}let y=await h(d,{req:e$1.req,user:e$1.user,tenantId:e$1.tenantId});return typeof y=="boolean"?{allowed:y}:{allowed:true}}function ne(n,t){return n?n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob:")||n.startsWith("data:")?n:`${(process.env.KYRO_BASE_URL||t||"http://localhost:4321").replace(/\/+$/,"")}${n.startsWith("/")?"":"/"}${n}`:null}function K(n,t){return n&&(n.url&&(n.url=ne(n.url,t)),n.thumbnailUrl&&(n.thumbnailUrl=ne(n.thumbnailUrl,t)),n)}function U(n,t,e,d=false,y="Root",s=new Map){switch(n.type){case "text":case "email":case "password":case "textarea":case "color":case "code":case "markdown":case "date":case "select":case "radio":return n.hasMany?new GraphQLList(GraphQLString):GraphQLString;case "list":return new GraphQLList(GraphQLString);case "upload":{let i=n;if(d)return i.hasMany?new GraphQLList(GraphQLString):GraphQLString;if(i.relationTo&&e?.[i.relationTo]){let o=e[i.relationTo];return i.hasMany?new GraphQLList(o):o}return q}case "image":{if(d)return GraphQLString;let i=n;return i.relationTo&&e?.[i.relationTo]?e[i.relationTo]:q}case "number":{let i=n.integer?GraphQLInt:GraphQLFloat;return n.hasMany?new GraphQLList(i):i}case "checkbox":return GraphQLBoolean;case "json":case "richtext":return q;case "blocks":{if(d)return q;let i=n,o=(i.blocks||[]).map(I=>{let m=`Block_${L(I.slug)}`,u=s.get(m);return u||(u=new GraphQLObjectType({name:m,fields:()=>{let f=k(I.fields||[],t,e,m,s);return f.blockType={type:GraphQLString},f.name={type:GraphQLString},f}}),s.set(m,u)),u});if(o.length===0)return q;let l=`${y}_${L(i.name)}_Blocks`,w=s.get(l);return w||(w=new GraphQLUnionType({name:l,types:o,resolveType:I=>`Block_${L(I.blockType||I.type)}`}),s.set(l,w)),new GraphQLList(w)}case "tabs":{if(d)return q;let i=n,o=`${y}_${L(i.name)}_Tabs`,l=s.get(o);return l||(l=new GraphQLObjectType({name:o,fields:()=>k(i.tabs?.flatMap(w=>w.fields||[])||[],t,e,o,s)}),s.set(o,l)),l}case "relationship":{let i=n.relationTo;if((i==="*"||Array.isArray(i)&&i.includes("*"))&&(i=t.getCollections().map(o=>o.slug)),typeof i=="string"){if(d)return n.hasMany?new GraphQLList(GraphQLString):GraphQLString;if(e?.[i])return n.hasMany?new GraphQLList(e[i]):e[i];let o=t.getCollection(i);if(o)return new GraphQLObjectType({name:`${L(i)}Ref`,fields:()=>({id:{type:GraphQLString},...J(o,t,e,s)})})}else if(Array.isArray(i)){if(d)return n.hasMany?new GraphQLList(q):q;let o=i.map(u=>{if(e?.[u])return e[u];let f=t.getCollection(u);if(f){let c=s.get(`${L(u)}Ref`);return c||(c=new GraphQLObjectType({name:`${L(u)}Ref`,fields:()=>({id:{type:GraphQLString},...J(f,t,e,s)})}),s.set(`${L(u)}Ref`,c)),c}return null}).filter(Boolean);if(o.length===0)return q;let l=`${y}_${L(n.name||"Ref")}_PolyUnion`,w=s.get(l);w||(w=new GraphQLUnionType({name:l,types:o,resolveType:u=>{if(u.__collection&&u.__collection!=="*")return e?.[u.__collection]?e[u.__collection].name:`${L(u.__collection)}Ref`}}),s.set(l,w));let I=`${y}_${L(n.name||"Ref")}_PolyWrapper`,m=s.get(I);return m||(m=new GraphQLObjectType({name:I,fields:{relationTo:{type:GraphQLString},value:{type:w}}}),s.set(I,m)),n.hasMany?new GraphQLList(m):m}return q}case "array":{if(d)return new GraphQLList(q);let i=n,o=`${y}_${L(i.name)}_ArrayItem`,l=s.get(o);return l||(l=new GraphQLObjectType({name:o,fields:()=>{let w=k(i.fields||[],t,e,o,s);return w.id={type:GraphQLString},w}}),s.set(o,l)),new GraphQLList(l)}case "group":{if(d)return q;let i=n,o=`${y}_${L(i.name)}_Group`,l=s.get(o);return l||(l=new GraphQLObjectType({name:o,fields:()=>k(i.fields||[],t,e,o,s)}),s.set(o,l)),l}default:return GraphQLString}}function k(n,t,e,d,y=new Map){let s={};for(let i of n){if(i.type==="tabs"&&!i.name){for(let o of i.tabs||[]){let l=k(o.fields||[],t,e,d,y);Object.assign(s,l);}continue}if(i.type==="row"||i.type==="collapsible"){let o=k(i.fields||[],t,e,d,y);Object.assign(s,o);continue}if(i.name&&i.admin?.hidden!==true){let o=le(i,t,e,d,y);o&&(s[i.name]=o);}}return s}function J(n,t,e,d=new Map){return k(n.fields,t,e,L(O(n.slug)),d)}function le(n,t,e,d,y=new Map){if(!n.name)return null;let s=n.deprecated||void 0;if(n.type==="upload"){let o=U(n,t,e,false,d,y),l=n;return {type:o,description:n.admin?.description||n.label,deprecationReason:s,resolve:async(w,I,m)=>{let u=m?.relationLoader,f=w?.[l.name],c=m?.req?.url?new URL(m.req.url).origin:void 0;if(!f)return null;if(l.hasMany){let T=Array.isArray(f)?f:[];return Promise.all(T.map(async g=>{let G=typeof g=="string"?g:g?.id;if(!G||typeof g=="object"&&g?.url)return K(g,c);if(u){let S=u.resolveOne(l.relationTo,G);if(S)return K(S,c);let r=await u.load(l.relationTo,G);return r?K(r,c):null}return {id:G}}))}let b=typeof f=="string"?f:f?.id;if(!b||typeof f=="object"&&f?.url)return K(f,c);if(u){let T=u.resolveOne(l.relationTo,b);if(T)return K(T,c);let g=await u.load(l.relationTo,b);return g?K(g,c):null}return {id:b}}}}return n.type==="relationship"&&!n.hasMany?{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:async(l,w,I)=>{let m=I?.relationLoader,u=n,f=l?.[u.name];if(!f)return null;let c=Array.isArray(u.relationTo)||u.relationTo==="*",b=c?f?.relationTo:u.relationTo,T=c?f?.value:f;if(c&&typeof f=="string"&&(b=u.relationTo[0],T=f),c&&b==="*")return null;if(m&&typeof T=="string"&&typeof b=="string"&&b!=="*"){let G=m.resolveOne(b,T);if(G)return c?{relationTo:b,value:{...G,__collection:b}}:G;let S=await m.load(b,T);return S?c?{relationTo:b,value:{...S,__collection:b}}:S:null}let g=typeof T=="object"&&T!==null?T:{id:T};return c?{relationTo:b,value:{...g,__collection:b}}:g}}:n.type==="relationship"&&n.hasMany?{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:async(l,w,I)=>{let m=I?.relationLoader,u=n,f=l?.[u.name]||[];if(typeof f=="string")try{f=JSON.parse(f);}catch{}if(Array.isArray(f)||(f=[]),!f.length)return [];let c=Array.isArray(u.relationTo)||u.relationTo==="*";if(m){let b=[];for(let T of f){let g=c?T?.relationTo:u.relationTo,G=c?T?.value:T;if(c&&typeof T=="string"&&(g=u.relationTo[0],G=T),c&&g==="*")continue;if(typeof G=="string"&&typeof g=="string"&&g!=="*"){let r=m.resolveOne(g,G);if(r){b.push(c?{relationTo:g,value:{...r,__collection:g}}:r);continue}let $=await m.load(g,G);if($){b.push(c?{relationTo:g,value:{...$,__collection:g}}:$);continue}continue}let S=typeof G=="object"&&G!==null?G:{id:G};b.push(c?{relationTo:g,value:{...S,__collection:g}}:S);}return b}return f.map(b=>{let T=c?b?.relationTo:u.relationTo,g=c?b?.value:b;c&&typeof b=="string"&&(T=u.relationTo[0],g=b);let G=typeof g=="object"&&g!==null?g:{id:g};return c?{relationTo:T,value:{...G,__collection:T}}:G})}}:n.type==="blocks"?{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:l=>{let w=l?.[n.name];if(typeof w=="string")try{w=JSON.parse(w);}catch{}return Array.isArray(w)?w.map(I=>I&&I.data&&I.type?{...I.data,id:I.id,type:I.type,blockType:I.type,name:I.name}:I):w}}:{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:o=>{let l=o?.[n.name];if(typeof l=="string"&&["array","group","tabs","blocks","json","richtext","list"].includes(n.type))try{l=JSON.parse(l);}catch{}return l}}}function te(n){let{registry:t,db:e,user:d,req:y,tenantId:s,apiKey:i,settings:o}=n;if(o?.access?.apiAccess?.graphqlEnabled===false)throw new Error("GraphQL API is disabled");let w=t.getCollections(),I=t.getGlobals(),m={},u={},f=new Map;for(let r of w){m[r.slug]=new GraphQLObjectType({name:L(O(r.slug)),fields:()=>({id:{type:GraphQLString},...J(r,t,m,f),...r.timestamps?{createdAt:{type:GraphQLString},updatedAt:{type:GraphQLString}}:{},...r.tenantScoped?{tenantId:{type:GraphQLString}}:{}})});let $={};for(let A of r.fields)A.name&&A.name!=="id"&&($[A.name]={type:U(A,t,m,true)});u[r.slug]=new GraphQLInputObjectType({name:`${L(O(r.slug))}Input`,fields:()=>$});}let c={},b={};for(let r of I)c[r.slug]=new GraphQLObjectType({name:`${L(r.slug)}Global`,fields:()=>({id:{type:GraphQLString},...J({slug:r.slug,fields:r.fields},t,m)})}),b[r.slug]=new GraphQLInputObjectType({name:`${L(r.slug)}GlobalInput`,fields:()=>{let $={};for(let A of r.fields)A.name&&A.name!=="id"&&($[A.name]={type:U(A,t,m,true)});return $}});let T={};for(let r of w){let $=m[r.slug];$&&(T[Z(r.slug)]={type:new GraphQLObjectType({name:`${L(O(r.slug))}FindResult`,fields:{docs:{type:new GraphQLList($)},totalDocs:{type:GraphQLInt},page:{type:GraphQLInt},totalPages:{type:GraphQLInt},hasNextPage:{type:GraphQLBoolean},hasPrevPage:{type:GraphQLBoolean}}}),args:{where:{type:GraphQLString},sort:{type:GraphQLString},limit:{type:GraphQLInt},page:{type:GraphQLInt},draft:{type:GraphQLBoolean}},resolve:async(A,_,a)=>{let p=await P(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey});if(!p.allowed)throw new Error("Access denied");a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"});let R={};if(_.where)try{R=JSON.parse(_.where);}catch{}p.extraWhere&&(R={...R,...p.extraWhere});let F=_.draft??!!a.user;return e.find({collection:r.slug,where:R,sort:_.sort,limit:_.limit||10,page:_.page||1,tenantId:a.tenantId,draft:F})}},T[Z(O(r.slug))]={type:$,args:{id:{type:GraphQLString},slug:{type:GraphQLString},draft:{type:GraphQLBoolean}},resolve:async(A,_,a)=>{if(!_.id&&!_.slug)throw new Error("Either id or slug is required");if(!(await P(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)throw new Error("Access denied");a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"});let R=_.draft??!!a.user;return _.id?e.findByID({collection:r.slug,id:_.id,tenantId:a.tenantId,draft:R}):(await e.find({collection:r.slug,where:{slug:{equals:_.slug}},limit:1,page:1,tenantId:a.tenantId,draft:R})).docs?.[0]||null}},T[`count${L(r.slug)}`]={type:new GraphQLObjectType({name:`${L(O(r.slug))}Count`,fields:{totalDocs:{type:GraphQLInt}}}),args:{where:{type:GraphQLString}},resolve:async(A,_,a)=>{if(!(await P(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)return {totalDocs:0};let R={};if(_.where)try{R=JSON.parse(_.where);}catch{}return {totalDocs:await e.count({collection:r.slug,where:R,tenantId:a.tenantId})}}});}for(let r of I){let $=c[r.slug];$&&(T[Z(O(r.slug))]={type:$,resolve:async(A,_,a)=>{if(!(await ee(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)throw new Error("Access denied: cannot read global");return a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"}),e.findOne({collection:`_globals_${r.slug}`,where:{},tenantId:a.tenantId})}});}let g=new GraphQLObjectType({name:"Query",fields:T}),G={};for(let r of w){let $=m[r.slug],A=u[r.slug];!$||!A||(G[`create${L(O(r.slug))}`]={type:new GraphQLObjectType({name:`${L(O(r.slug))}CreateResult`,fields:{doc:{type:$},message:{type:GraphQLString}}}),args:{data:{type:new GraphQLNonNull(A)}},resolve:async(_,a,p)=>{if(!(await P(r,"create",{user:p.user,req:p.req,tenantId:p.tenantId,apiKey:p.apiKey})).allowed)throw new Error("Access denied: cannot create");p.tenantId&&e.setTenantContext({tenantId:p.tenantId,userId:p.user?.id??"",role:p.user?.role,isSuperAdmin:p.user?.role==="super_admin"});let z=t.getCreateZodSchema(r.slug).parse(a.data);return {doc:await e.create({collection:r.slug,data:z,tenantId:p.tenantId}),message:"Created successfully"}}},G[`update${L(O(r.slug))}`]={type:new GraphQLObjectType({name:`${L(O(r.slug))}UpdateResult`,fields:{doc:{type:$},message:{type:GraphQLString}}}),args:{id:{type:new GraphQLNonNull(GraphQLString)},data:{type:new GraphQLNonNull(A)},baseUpdatedAt:{type:GraphQLString}},resolve:async(_,a,p)=>{if(!(await P(r,"update",{user:p.user,req:p.req,tenantId:p.tenantId,apiKey:p.apiKey})).allowed)throw new Error("Access denied: cannot update");if(p.tenantId&&e.setTenantContext({tenantId:p.tenantId,userId:p.user?.id??"",role:p.user?.role,isSuperAdmin:p.user?.role==="super_admin"}),a.baseUpdatedAt){let D=await e.findByID({collection:r.slug,id:a.id,tenantId:p.tenantId,draft:true});if(D&&D.updatedAt&&a.baseUpdatedAt!==D.updatedAt)throw new Error(`Revision conflict: document has changed since ${a.baseUpdatedAt}. Current updatedAt: ${D.updatedAt}`)}let z=t.getUpdateZodSchema(r.slug).parse(a.data);return {doc:await e.update({collection:r.slug,id:a.id,data:z,tenantId:p.tenantId}),message:"Updated successfully"}}},G[`delete${L(O(r.slug))}`]={type:new GraphQLObjectType({name:`${L(O(r.slug))}DeleteResult`,fields:{doc:{type:$},message:{type:GraphQLString}}}),args:{id:{type:new GraphQLNonNull(GraphQLString)}},resolve:async(_,a,p)=>{if(!(await P(r,"delete",{user:p.user,req:p.req,tenantId:p.tenantId,apiKey:p.apiKey})).allowed)throw new Error("Access denied: cannot delete");return p.tenantId&&e.setTenantContext({tenantId:p.tenantId,userId:p.user?.id??"",role:p.user?.role,isSuperAdmin:p.user?.role==="super_admin"}),{doc:await e.delete({collection:r.slug,id:a.id,tenantId:p.tenantId}),message:"Deleted successfully"}}});}for(let r of I){let $=b[r.slug];$&&(G[`update${L(r.slug)}`]={type:new GraphQLObjectType({name:`${L(r.slug)}UpdateResult`,fields:{doc:{type:c[r.slug]||GraphQLString},message:{type:GraphQLString}}}),args:{data:{type:new GraphQLNonNull($)}},resolve:async(A,_,a)=>{if(!(await ee(r,"update",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)throw new Error("Access denied: cannot update global");a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"});let R=await e.findOne({collection:`_globals_${r.slug}`,where:{},tenantId:a.tenantId}),F;return R?F=await e.update({collection:`_globals_${r.slug}`,id:R.id,data:_.data,tenantId:a.tenantId}):F=await e.create({collection:`_globals_${r.slug}`,data:_.data,tenantId:a.tenantId}),{doc:F,message:"Updated successfully"}}});}let S=new GraphQLObjectType({name:"Mutation",fields:G});return new GraphQLSchema({query:g,mutation:S})}function de(n,t,e){return te({registry:n,db:t,user:e?.user,req:e?.req,tenantId:e?.tenantId,apiKey:e?.apiKey})}
3
+ export{N as a,oe as b,te as c,de as d};
@@ -0,0 +1,2 @@
1
+ import {pgTable,timestamp,jsonb,integer,boolean,varchar,uuid,uniqueIndex,index,text}from'drizzle-orm/pg-core';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
+ var d=pgTable("users",{id:uuid("id").primaryKey().defaultRandom(),name:varchar("name",{length:255}),email:varchar("email",{length:255}).notNull(),passwordHash:varchar("password_hash",{length:255}),role:varchar("role",{length:50}).notNull().default("customer"),tenantId:uuid("tenant_id"),emailVerified:boolean("email_verified").default(false),avatar:varchar("avatar",{length:255}),locked:boolean("locked").default(false),lastLogin:timestamp("last_login"),failedLoginAttempts:integer("failed_login_attempts").default(0),metadata:jsonb("metadata").$type(),createdAt:timestamp("created_at").defaultNow().notNull(),updatedAt:timestamp("updated_at").defaultNow().notNull()},e=>[uniqueIndex("users_email_idx").on(e.email),index("users_tenant_idx").on(e.tenantId),index("users_role_idx").on(e.role)]),c=pgTable("roles",{id:uuid("id").primaryKey().defaultRandom(),name:varchar("name",{length:100}).notNull().unique(),level:integer("level").notNull().default(0),inherits:text("inherits").array(),description:text("description"),permissions:jsonb("permissions").$type().default([]),isSystem:boolean("is_system").default(false),createdAt:timestamp("created_at").defaultNow().notNull(),updatedAt:timestamp("updated_at").defaultNow().notNull()},e=>[index("roles_level_idx").on(e.level)]),m=pgTable("permissions",{id:uuid("id").primaryKey().defaultRandom(),roleId:uuid("role_id").references(()=>c.id,{onDelete:"cascade"}),resource:varchar("resource",{length:100}).notNull(),action:varchar("action",{length:50}).notNull(),conditions:jsonb("conditions").$type(),createdAt:timestamp("created_at").defaultNow().notNull()},e=>[index("permissions_role_idx").on(e.roleId),index("permissions_resource_idx").on(e.resource)]),x=pgTable("sessions",{id:uuid("id").primaryKey().defaultRandom(),userId:uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:varchar("token",{length:512}).notNull().unique(),refreshToken:varchar("refresh_token",{length:512}),ipAddress:varchar("ip_address",{length:45}),userAgent:text("user_agent"),expiresAt:timestamp("expires_at").notNull(),createdAt:timestamp("created_at").defaultNow().notNull()},e=>[index("sessions_user_idx").on(e.userId),index("sessions_token_idx").on(e.token),index("sessions_expires_idx").on(e.expiresAt)]),g=pgTable("audit_logs",{id:uuid("id").primaryKey().defaultRandom(),action:varchar("action",{length:100}).notNull(),userId:uuid("user_id").references(()=>d.id,{onDelete:"set null"}),userEmail:varchar("user_email",{length:255}),role:varchar("role",{length:50}),resource:varchar("resource",{length:100}).notNull(),resourceId:varchar("resource_id",{length:255}),changes:jsonb("changes").$type(),ipAddress:varchar("ip_address",{length:45}),userAgent:text("user_agent"),success:boolean("success").notNull().default(true),error:text("error"),metadata:jsonb("metadata").$type(),timestamp:timestamp("timestamp").defaultNow().notNull()},e=>[index("audit_logs_user_idx").on(e.userId),index("audit_logs_action_idx").on(e.action),index("audit_logs_resource_idx").on(e.resource),index("audit_logs_timestamp_idx").on(e.timestamp)]),N=pgTable("tenants",{id:uuid("id").primaryKey().defaultRandom(),name:varchar("name",{length:255}).notNull(),slug:varchar("slug",{length:100}).notNull().unique(),settings:jsonb("settings").$type().default({}),isActive:boolean("is_active").default(true),createdAt:timestamp("created_at").defaultNow().notNull(),updatedAt:timestamp("updated_at").defaultNow().notNull()},e=>[uniqueIndex("tenants_slug_idx").on(e.slug)]),h=pgTable("api_keys",{id:uuid("id").primaryKey().defaultRandom(),userId:uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),name:varchar("name",{length:255}).notNull(),key:varchar("key",{length:64}).notNull().unique(),keyPrefix:varchar("key_prefix",{length:8}).notNull(),permissions:jsonb("permissions").$type().default([]),lastUsedAt:timestamp("last_used_at"),expiresAt:timestamp("expires_at"),createdAt:timestamp("created_at").defaultNow().notNull()},e=>[index("api_keys_user_idx").on(e.userId),index("api_keys_key_idx").on(e.key)]),A=pgTable("email_verifications",{id:uuid("id").primaryKey().defaultRandom(),userId:uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:varchar("token",{length:64}).notNull().unique(),expiresAt:timestamp("expires_at").notNull(),createdAt:timestamp("created_at").defaultNow().notNull()},e=>[index("email_verifications_token_idx").on(e.token),index("email_verifications_user_idx").on(e.userId)]),k=pgTable("password_resets",{id:uuid("id").primaryKey().defaultRandom(),userId:uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:varchar("token",{length:64}).notNull().unique(),expiresAt:timestamp("expires_at").notNull(),usedAt:timestamp("used_at"),createdAt:timestamp("created_at").defaultNow().notNull()},e=>[index("password_resets_token_idx").on(e.token),index("password_resets_user_idx").on(e.userId)]),w=pgTable("password_history",{id:uuid("id").primaryKey().defaultRandom(),userId:uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),passwordHash:varchar("password_hash",{length:255}).notNull(),createdAt:timestamp("created_at").defaultNow().notNull()},e=>[index("password_history_user_idx").on(e.userId)]),I=pgTable("lockouts",{id:uuid("id").primaryKey().defaultRandom(),userId:uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),ipAddress:varchar("ip_address",{length:45}),reason:varchar("reason",{length:255}),lockedUntil:timestamp("locked_until").notNull(),releasedAt:timestamp("released_at"),createdAt:timestamp("created_at").defaultNow().notNull()},e=>[index("lockouts_user_idx").on(e.userId),index("lockouts_ip_idx").on(e.ipAddress),index("lockouts_locked_until_idx").on(e.lockedUntil)]);export{d as a,c as b,m as c,x as d,g as e,N as f,h as g,A as h,k as i,w as j,I as k};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkOJBL4CXK_cjs=require('./chunk-OJBL4CXK.cjs'),chunkDCFOVCJX_cjs=require('./chunk-DCFOVCJX.cjs'),chunkOXEJCIOA_cjs=require('./chunk-OXEJCIOA.cjs');async function O(e){let a=chunkOJBL4CXK_cjs.n(e.db),t={db:e.db,registry:e.registry,req:e.req,user:e.user,tenantId:e.tenantId,webhookService:a,settings:e.settings},n=chunkDCFOVCJX_cjs.c(e.req);if(n){let r=await chunkDCFOVCJX_cjs.b(n,e.db,async o=>{try{return await e.db.findByID({collection:"users",id:o})||null}catch{return null}});r.valid&&(t.user=r.user||e.user,t.tenantId=r.tenantId||e.tenantId,t.apiKey=chunkDCFOVCJX_cjs.d(r));}return t}var V={_media:{create:chunkOJBL4CXK_cjs.c.MEDIA_UPLOAD,update:chunkOJBL4CXK_cjs.c.MEDIA_UPLOAD,delete:chunkOJBL4CXK_cjs.c.MEDIA_DELETE}};function D(e,a){let t=V[e];return t?t[a]:`collection.${a}`}async function R(e,a,t){if(e.webhookService)try{await e.webhookService.trigger(a,{collection:t.collection,operation:t.operation,data:t.data,previousData:t.previousData,user:e.user?{id:e.user.id,email:e.user.email,role:e.user.role}:void 0,tenantId:e.tenantId});}catch(n){console.error(`[Webhook] Failed to trigger ${a}:`,n);}}function m(e,a){if(!(!e||typeof e!="object"))for(let t of a){if(t.type==="tabs"&&Array.isArray(t.tabs)){let r=t.name?e[t.name]:e;if(r&&typeof r=="object")for(let o of t.tabs)Array.isArray(o.fields)&&m(r,o.fields);continue}if(!t.name||!(t.name in e))continue;if(e[t.name]===""&&(t.type==="text"||t.type==="textarea"||t.type==="code"||t.type==="markdown"||t.type==="email"||t.type==="password"||t.type==="color"||(e[t.name]=null)),(t.type==="group"||t.type==="collapsible")&&t.name&&Array.isArray(t.fields)&&e[t.name]&&typeof e[t.name]=="object")m(e[t.name],t.fields);else if(t.type==="array"&&t.name&&Array.isArray(t.fields)&&Array.isArray(e[t.name]))for(let r of e[t.name])r&&typeof r=="object"&&m(r,t.fields);else if(t.type==="blocks"&&t.name&&Array.isArray(t.blocks)&&Array.isArray(e[t.name]))for(let r of e[t.name]){if(!r||typeof r!="object")continue;let o=r.type||r.blockType;if(!o)continue;let s=t.blocks.find(i=>i.slug===o);if(!s||!Array.isArray(s.fields))continue;let u=r.data&&typeof r.data=="object"?r.data:r;m(u,s.fields);}}}async function g(e,a,t){let n=await chunkOJBL4CXK_cjs.a(e,a,{user:t.user,req:t.req,tenantId:t.tenantId,apiKey:t.apiKey});if(!n.allowed)throw new Error(n.error||"Access denied");t.tenantId&&t.db.setTenantContext({tenantId:t.tenantId,userId:t.user?.id??"",role:t.user?.role,isSuperAdmin:t.user?.role==="super_admin"});}function q(e){return async a=>{let{collection:t,where:n,sort:r,limit:o,page:s,depth:u,select:i,draft:d}=a,l=e.registry.getCollection(t);if(await g(l,"read",e),l.hooks?.beforeRead)for(let y of l.hooks.beforeRead)await y({collection:t,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read",where:n});let c=d??!!e.user,b=await e.db.find({collection:t,where:n||{},sort:r,limit:o||10,page:s||1,depth:u||0,tenantId:e.tenantId,select:i,draft:c});if(l.hooks?.afterRead)for(let y of b.docs)for(let w of l.hooks.afterRead)await w({collection:t,doc:y,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read"});return await chunkOJBL4CXK_cjs.o(b.docs,l.fields,e.db,e.registry,1,u||0),chunkOXEJCIOA_cjs.a(b)}}function P(e){return async a=>{let{collection:t,id:n,depth:r,select:o,draft:s}=a,u=e.registry.getCollection(t);await g(u,"read",e);let i=s??!!e.user,d=await e.db.findByID({collection:t,id:n,depth:r||0,tenantId:e.tenantId,select:o,draft:i});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(u.hooks?.afterRead)for(let l of u.hooks.afterRead)await l({collection:t,doc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read",id:n});return await chunkOJBL4CXK_cjs.o([d],u.fields,e.db,e.registry,1,r||0),chunkOXEJCIOA_cjs.a(d)}}function v(e){return async a=>{let{collection:t,data:n,depth:r,select:o}=a,s=e.registry.getCollection(t);await g(s,"create",e);let i=e.registry.getCreateZodSchema(t).parse(n);if(s.tenantScoped&&e.tenantId&&(i.tenantId=e.tenantId),s.hooks?.beforeValidate)for(let l of s.hooks.beforeValidate){let c=await l({collection:t,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});c&&typeof c=="object"&&!Array.isArray(c)&&Object.assign(i,c);}if(s.hooks?.beforeChange)for(let l of s.hooks.beforeChange){let c=await l({collection:t,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});c&&typeof c=="object"&&!Array.isArray(c)&&Object.assign(i,c);}let d=await e.db.create({collection:t,data:i,depth:r||0,tenantId:e.tenantId,select:o});if(s.hooks?.afterChange)for(let l of s.hooks.afterChange)await l({collection:t,doc:d,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});return await R(e,D(t,"create"),{collection:t,data:d,operation:"create"}),{doc:d}}}function K(e){return async a=>{let{collection:t,id:n,data:r,depth:o,select:s,baseUpdatedAt:u}=a,i=e.registry.getCollection(t);await g(i,"update",e);let d=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(u&&d.updatedAt&&u!==d.updatedAt)throw new Error(`Revision conflict: document has changed since ${u}. Current updatedAt: ${d.updatedAt}`);m(r,i.fields);let c=e.registry.getUpdateZodSchema(t).parse(r);if(i.tenantScoped&&e.tenantId&&(c.tenantId=e.tenantId),i.hooks?.beforeValidate)for(let h of i.hooks.beforeValidate){let f=await h({collection:t,data:c,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});f&&typeof f=="object"&&!Array.isArray(f)&&Object.assign(c,f);}if(i.hooks?.beforeChange)for(let h of i.hooks.beforeChange){let f=await h({collection:t,data:c,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});f&&typeof f=="object"&&!Array.isArray(f)&&Object.assign(c,f);}let b=e.req&&typeof e.req.headers?.get=="function"&&e.req.headers.get("x-draft")==="true"||a.draft===true,y=i.versions?.drafts===true,w=e.req?.query?.autosave==="true"||e.req?.url?.includes("autosave=true")||a.autosave===true,p;if(y&&b?(await e.db.createVersion({collection:t,documentId:n,data:c,status:"draft",autosave:w,createdBy:e.user?.id,tenantId:e.tenantId}),p=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true})):y?(p=await e.db.update({collection:t,id:n,data:{...c,status:"published"},depth:o||0,tenantId:e.tenantId,select:s}),await e.db.createVersion({collection:t,documentId:n,data:c,status:"published",createdBy:e.user?.id,tenantId:e.tenantId})):p=await e.db.update({collection:t,id:n,data:c,depth:o||0,tenantId:e.tenantId,select:s}),i.hooks?.afterChange)for(let h of i.hooks.afterChange)await h({collection:t,doc:p,data:c,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});return await R(e,D(t,"update"),{collection:t,data:p,previousData:d,operation:"update"}),{doc:p}}}function E(e){return async a=>{let{collection:t,id:n}=a,r=e.registry.getCollection(t);await g(r,"delete",e);let o=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true});if(!o)throw new Error(`Document not found: ${t}/${n}`);if(r.hooks?.beforeDelete)for(let u of r.hooks.beforeDelete)await u({collection:t,doc:o,req:e.req,user:e.user,tenantId:e.tenantId,operation:"delete",id:n});let s=await e.db.delete({collection:t,id:n,tenantId:e.tenantId});if(r.hooks?.afterDelete)for(let u of r.hooks.afterDelete)await u({collection:t,doc:s,req:e.req,user:e.user,tenantId:e.tenantId,operation:"delete",id:n});return await R(e,D(t,"delete"),{collection:t,data:s,previousData:o,operation:"delete"}),{doc:s,message:"Deleted successfully"}}}function j(e){return async a=>{let{collection:t,where:n}=a,r=e.registry.getCollection(t);return await g(r,"read",e),{totalDocs:await e.db.count({collection:t,where:n||{},tenantId:e.tenantId})}}}async function T(e,a,t){let n=await chunkOJBL4CXK_cjs.b(e,a,{user:t.user,req:t.req,tenantId:t.tenantId});if(!n.allowed)throw new Error(n.error||"Access denied");t.tenantId&&t.db.setTenantContext({tenantId:t.tenantId,userId:t.user?.id??"",role:t.user?.role,isSuperAdmin:t.user?.role==="super_admin"});}function W(e){let a={},t=e.registry.getCollections();for(let r of t){let o=r.slug;a[o]={find:q(e),findByID:P(e),create:v(e),update:K(e),delete:E(e),count:j(e)};}let n=e.registry.getGlobals();for(let r of n){let o=r.slug;a[`_globals_${o}`]={get:async s=>(await T(r,"read",e),await e.db.findOne({collection:`_globals_${o}`,where:{},tenantId:e.tenantId,depth:s?.depth,draft:s?.draft,select:s?.select})),update:async s=>{await T(r,"update",e);let i=e.registry.getZodSchema(o).parse(s.data),d=await e.db.findOne({collection:`_globals_${o}`,where:{},tenantId:e.tenantId,draft:true}),l;return d?l=await e.db.update({collection:`_globals_${o}`,id:d.id,data:i,tenantId:e.tenantId}):l=await e.db.create({collection:`_globals_${o}`,data:{...i,id:o},tenantId:e.tenantId}),l}};}return a}function G(e){if(e.settings?.access?.apiAccess?.trpcEnabled===false)throw new Error("tRPC API is disabled");return W(e)}exports.a=O;exports.b=q;exports.c=P;exports.d=v;exports.e=K;exports.f=E;exports.g=j;exports.h=W;exports.i=G;