@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
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkF4ITQ6XQ_cjs=require('./chunk-F4ITQ6XQ.cjs'),chunkHTYVI2HK_cjs=require('./chunk-HTYVI2HK.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto=require('crypto');chunkBUNLC3II_cjs.h();var g=chunkBUNLC3II_cjs.e(chunkHTYVI2HK_cjs.a(),1);var f="kyro:auth:",A=86400,x=604800,w=class{_redis=null;prefix;tokenExpiration;refreshExpiration;options;constructor(e={}){this.options=e,this.prefix=e.keyPrefix||f,this.tokenExpiration=e.tokenExpiration||A,this.refreshExpiration=e.refreshTokenExpiration||x;}async getRedis(){if(!this._redis){let e,t="ioredis";try{e=(await import(t)).Redis;}catch{chunkF4ITQ6XQ_cjs.a([t]),e=(await import(t)).Redis;}let s=this.options.url||`redis://${this.options.host||"localhost"}:${this.options.port||6379}`;this._redis=new e(s,{password:this.options.password,db:this.options.db,lazyConnect:true,tls:this.options.tls?{}:void 0});}return this._redis}async connect(){await this.getRedis();}async disconnect(){await(await this.getRedis()).quit();}userKey(e){return `${this.prefix}users:${e}`}sessionKey(e){return `${this.prefix}sessions:${e}`}refreshKey(e){return `${this.prefix}refresh:${e}`}userByEmailKey(e){return `${this.prefix}users:email:${e.toLowerCase()}`}passwordHistoryKey(e){return `${this.prefix}users:${e}:password_history`}async createUser(e){let t=crypto.randomBytes(16).toString("hex"),s=new Date().toISOString(),i=await this.hashPassword(e.password),r={id:t,email:e.email.toLowerCase(),passwordHash:i,role:e.role||"customer",tenantId:e.tenantId,createdAt:s,updatedAt:s},n=(await this.getRedis()).pipeline();return n.hset(this.userKey(t),this.userToHash(r)),n.set(this.userByEmailKey(e.email),t),await n.exec(),r}async findUserByEmail(e){let t=await(await this.getRedis()).get(this.userByEmailKey(e.toLowerCase()));return t?this.findUserById(t):null}async findUserById(e){let t=await(await this.getRedis()).hgetall(this.userKey(e));return !t||Object.keys(t).length===0?null:this.hashToUser(t)}async updateUser(e,t){let s=await this.findUserById(e);if(!s)return null;let i={...s,...t,id:e,updatedAt:new Date().toISOString()};if(t.email&&t.email!==s.email){let r=(await this.getRedis()).pipeline();r.del(this.userByEmailKey(s.email)),r.set(this.userByEmailKey(t.email),e),await r.exec();}return await(await this.getRedis()).hset(this.userKey(e),this.userToHash(i)),i}async deleteUser(e){let t=await this.findUserById(e);if(!t)return false;let s=(await this.getRedis()).pipeline();return s.del(this.userKey(e)),s.del(this.userByEmailKey(t.email)),s.del(this.passwordHistoryKey(e)),await s.exec(),true}async hashPassword(e){return g.default.hash(e,12)}async verifyPassword(e,t){let s=await(await this.getRedis()).get(this.userByEmailKey(e));if(!s)return null;let i=await this.findUserById(s);return !i||!i.passwordHash?null:await g.default.compare(t,i.passwordHash)?i:null}async createSession(e,t={}){let s=crypto.randomBytes(32).toString("hex"),i=crypto.randomBytes(32).toString("base64url"),r=crypto.randomBytes(32).toString("base64url"),n=new Date,a={id:s,userId:e,token:i,refreshToken:r,expiresAt:new Date(n.getTime()+this.tokenExpiration*1e3).toISOString(),createdAt:n.toISOString(),ipAddress:t.ipAddress,userAgent:t.userAgent},o=(await this.getRedis()).pipeline();return o.hset(this.sessionKey(s),this.sessionToHash(a)),o.setex(this.refreshKey(r),this.refreshExpiration,s),await o.exec(),a}async findSessionByToken(e){let t=await(await this.getRedis()).hgetall(this.sessionKey(e));return !t||Object.keys(t).length===0?null:this.hashToSession(t)}async findSessionByRefreshToken(e){let t=await(await this.getRedis()).get(this.refreshKey(e));if(!t)return null;let s=await(await this.getRedis()).hgetall(this.sessionKey(t));return !s||Object.keys(s).length===0?null:this.hashToSession(s)}async deleteSession(e){let t=await(await this.getRedis()).hgetall(this.sessionKey(e));if(!t||Object.keys(t).length===0)return false;let s=(await this.getRedis()).pipeline();return s.del(this.sessionKey(e)),t.refreshToken&&s.del(this.refreshKey(t.refreshToken)),await s.exec(),true}async deleteUserSessions(e){let t=`${this.prefix}sessions:*`,s="0",i=0;do{let[r,n]=await(await this.getRedis()).scan(s,"MATCH",t,"COUNT",100);s=r;for(let a of n)if((await(await this.getRedis()).hgetall(a)).userId===e){let l=a.replace(`${this.prefix}sessions:`,"");await this.deleteSession(l),i++;}}while(s!=="0");return i}async addPasswordToHistory(e,t){await(await this.getRedis()).lpush(this.passwordHistoryKey(e),t),await(await this.getRedis()).ltrim(this.passwordHistoryKey(e),0,4);}async getPasswordHistory(e,t=5){return (await this.getRedis()).lrange(this.passwordHistoryKey(e),0,t-1)}async isPasswordInHistory(e,t,s=5){let i=await this.getPasswordHistory(t,s);for(let r of i)if(await g.default.compare(e,r))return true;return false}userToHash(e){let t={id:e.id,email:e.email,passwordHash:e.passwordHash||"",role:e.role,createdAt:e.createdAt,updatedAt:e.updatedAt};return e.avatar&&(t.avatar=e.avatar),e.tenantId&&(t.tenantId=e.tenantId),e.metadata&&(t.metadata=JSON.stringify(e.metadata)),e.emailVerified!==void 0&&(t.emailVerified=String(e.emailVerified)),e.locked!==void 0&&(t.locked=String(e.locked)),e.lastLogin&&(t.lastLogin=e.lastLogin),e.failedLoginAttempts!==void 0&&(t.failedLoginAttempts=String(e.failedLoginAttempts)),t}hashToUser(e){return {id:e.id,email:e.email,passwordHash:e.passwordHash,role:e.role,tenantId:e.tenantId,avatar:e.avatar,metadata:e.metadata?JSON.parse(e.metadata):void 0,createdAt:e.createdAt,updatedAt:e.updatedAt,emailVerified:e.emailVerified==="true",locked:e.locked==="true",lastLogin:e.lastLogin,failedLoginAttempts:e.failedLoginAttempts?parseInt(e.failedLoginAttempts,10):0}}sessionToHash(e){let t={id:e.id,userId:e.userId,token:e.token,expiresAt:e.expiresAt,createdAt:e.createdAt};return e.refreshToken&&(t.refreshToken=e.refreshToken),e.ipAddress&&(t.ipAddress=e.ipAddress),e.userAgent&&(t.userAgent=e.userAgent),t}hashToSession(e){return {id:e.id,userId:e.userId,token:e.token,refreshToken:e.refreshToken,expiresAt:e.expiresAt,createdAt:e.createdAt,ipAddress:e.ipAddress,userAgent:e.userAgent}}tokenKey(e,t){return `${this.prefix}tokens:${e}:${t}`}async createEmailVerificationToken(e){let t=crypto.randomBytes(32).toString("hex"),s=new Date(Date.now()+1440*60*1e3);return await(await this.getRedis()).setex(this.tokenKey("email-verify",t),86400,e),{token:t,expiresAt:s}}async verifyEmailToken(e){let t=await this.getRedis(),s=await t.get(this.tokenKey("email-verify",e));return s?(await t.del(this.tokenKey("email-verify",e)),{success:true,userId:s}):{success:false,error:"Invalid or expired token"}}async createPasswordResetToken(e){let t=await this.findUserByEmail(e);if(!t)return {token:"",expiresAt:new Date,error:"User not found"};let s=crypto.randomBytes(32).toString("hex"),i=new Date(Date.now()+3600*1e3);return await(await this.getRedis()).setex(this.tokenKey("password-reset",s),3600,t.id),{token:s,expiresAt:i}}async resetPasswordWithToken(e,t){let s=await this.getRedis(),i=await s.get(this.tokenKey("password-reset",e));if(!i)return {success:false,error:"Invalid or expired token"};let r=await this.hashPassword(t);return await this.updateUser(i,{passwordHash:r}),await s.del(this.tokenKey("password-reset",e)),{success:true}}auditLogKey(e){return `${this.prefix}audit:logs:${e}`}auditLogIndexKey(){return `${this.prefix}audit:index`}async findAuditLogs(e){let{limit:t=50,offset:s=0}=e,i=this.auditLogIndexKey(),r=await(await this.getRedis()).zrevrange(i,0,-1),n=r.length,a=r.slice(s,s+t),o=[];for(let l of a){let u=await(await this.getRedis()).get(this.auditLogKey(l));if(u){let d=JSON.parse(u);(!e.userId||d.userId===e.userId)&&(!e.action||(Array.isArray(e.action)?e.action.includes(d.action):d.action===e.action))&&(!e.resource||d.resource===e.resource)&&(e.success===void 0||d.success===e.success)&&o.push({...d,timestamp:new Date(d.timestamp)});}}return {logs:o,total:n}}async createAuditLog(e){let t=crypto.randomBytes(16).toString("hex"),i={...e,id:t,timestamp:new Date};await(await this.getRedis()).set(this.auditLogKey(t),JSON.stringify(i)),await(await this.getRedis()).zadd(this.auditLogIndexKey(),Date.now(),t);let r=await(await this.getRedis()).zcard(this.auditLogIndexKey());if(r>1e4){let n=await(await this.getRedis()).zrange(this.auditLogIndexKey(),0,r-10001);for(let a of n)await(await this.getRedis()).del(this.auditLogKey(a)),await(await this.getRedis()).zrem(this.auditLogIndexKey(),a);}return i}};
2
- exports.a=w;
@@ -1,3 +0,0 @@
1
- import {a,c,b,d}from'./chunk-SLMIYECU.js';import {a as a$1}from'./chunk-P6JITOFF.js';import {a as a$2}from'./chunk-VVVCCB6R.js';import {g}from'./chunk-Y2YAKDEQ.js';import {randomBytes}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g();g();var A=class extends a{dialect="mongodb";client;db;database;connectionString;constructor(o){if(super(),o.connectionString){this.connectionString=o.connectionString;try{let e=new URL(o.connectionString);this.database=e.pathname.replace(/^\//,"")||"kyro_cms";}catch{this.database="kyro_cms";}}else this.client=o.client,this.database=o.database;}async connect(){if(this.connectionString&&!this.client){let o;try{let e=await import('./lib-XXYYUPMW.js');o=e.MongoClient??e.default?.MongoClient;}catch{a$1(["mongodb"]);let n=await import('./lib-XXYYUPMW.js');o=n.MongoClient??n.default?.MongoClient;}this.client=new o(this.connectionString),await this.client.connect();}else if(this.client&&typeof this.client.connect=="function")try{await this.client.connect();}catch{}this.client&&(this.db=this.client.db(this.database),this.connected=true);}async disconnect(){this.client&&(await this.client.close(),this.connected=false);}getMongoCollection(o){if(!this.db&&this.client&&(this.db=this.client.db(this.database),this.connected=true),!this.db)throw new Error("MongoDB not connected");return this.db.collection(o)}async find(o){let{collection:e,where:n={},sort:s,limit:t=10,page:i=1,tenantId:r,select:a,draft:l}=o,d$1=this.getCollectionConfig(e),f=this.getMongoCollection(e),g={...n};this.tenantContext&&d$1.tenantScoped&&(g=c({where:g},e,this.tenantContext,b).where||{});let u=this.buildFilter(g,d$1.tenantScoped?r:void 0),c$1=d$1.fields.find(p=>p.name==="status"),h=c$1?.type==="select"&&Array.isArray(c$1.options)&&c$1.options.some(p=>p.value==="published");!l&&h&&(u.status="published");let y=this.parseSort(s),O={[y.field]:y.direction==="asc"?1:-1},$=(i-1)*t,[x,M]=await Promise.all([f.find(u).sort(O).skip($).limit(t).project(this.buildProjection(a)).toArray(),f.countDocuments(u)]),C=x.map(p=>this.processResult(p,d$1));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(C=C.filter(p=>d(p,e,this.tenantContext,b))),l&&(C=await Promise.all(C.map(async p=>{let m=await this.getMongoCollection(`${e}_versions`).findOne({document_id:p.id},{sort:{createdAt:-1}});if(m){let P=typeof m.data=="string"?JSON.parse(m.data):m.data&&typeof m.data=="object"?m.data:{};return {...p,...P,status:p.status,_hasUnpublishedChanges:m.status==="draft"}}return p}))),{docs:C,...this.calculatePagination(i,t,M)}}async findByID(o){let{collection:e,id:n,tenantId:s,draft:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(e);if(this.tenantContext&&i.tenantScoped){let u={_id:n,tenantId:this.tenantContext.tenantId};if(!d(u,e,this.tenantContext,b))return null}let a={_id:n};s&&i.tenantScoped&&(a.tenantId=s);let l=i.fields.find(u=>u.name==="status"),d$1=l?.type==="select"&&Array.isArray(l.options)&&l.options.some(u=>u.value==="published");!t&&d$1&&(a.status="published");let f=await r.findOne(a);if(!f)return null;let g=this.processResult(f,i);if(t){let c=await this.getMongoCollection(`${e}_versions`).findOne({document_id:g.id},{sort:{createdAt:-1}});if(c){let h=typeof c.data=="string"?JSON.parse(c.data):c.data&&typeof c.data=="object"?c.data:{};g={...g,...h,status:g.status,_hasUnpublishedChanges:c.status==="draft"};}}return g}async create(o){let{collection:e,data:n,tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(e),r=this.prepareData(n,t),a=r.id||this.generateId();delete r.id;let l={...r,_id:a};return s&&t.tenantScoped&&(l.tenantId=s),await i.insertOne(l),this.processResult(l,t)}async update(o){let{collection:e,id:n,data:s,tenantId:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(e),a={_id:n};t&&i.tenantScoped&&(a.tenantId=t);let l=this.prepareData(s,i),d=await r.findOneAndUpdate(a,{$set:l},{returnDocument:"after"});if(!d)throw new Error(`Document not found: ${e}/${n}`);return this.processResult(d,i)}async delete(o){let{collection:e,id:n,tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(e),r={_id:n};s&&t.tenantScoped&&(r.tenantId=s);let a=await i.findOneAndDelete(r);if(!a)throw new Error(`Document not found: ${e}/${n}`);return this.processResult(a,t)}async count(o){let{collection:e,where:n={},tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(e),r=this.buildFilter(n,t.tenantScoped?s:void 0);return i.countDocuments(r)}async findOne(o){let{collection:e,where:n={},tenantId:s,draft:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(e),a=this.buildFilter(n,i.tenantScoped?s:void 0),l=i.fields.find(u=>u.name==="status"),d=l?.type==="select"&&Array.isArray(l.options)&&l.options.some(u=>u.value==="published");!t&&d&&(a.status="published");let f=await r.findOne(a);if(!f)return null;let g=this.processResult(f,i);if(t){let c=await this.getMongoCollection(`${e}_versions`).findOne({document_id:g.id},{sort:{createdAt:-1}});if(c){let h=typeof c.data=="string"?JSON.parse(c.data):c.data&&typeof c.data=="object"?c.data:{};g={...g,...h,status:g.status};}}return g}async findVersions(o){let{collection:e,documentId:n,sort:s,limit:t=10,page:i=1,tenantId:r}=o,a=this.getCollectionConfig(e),l=this.getMongoCollection(`${e}_versions`),d={document_id:n,autosave:{$ne:true}};r&&a.tenantScoped&&(d.tenant_id=r);let f=(i-1)*t,g=this.parseSort(s),u={[g.field]:g.direction==="asc"?1:-1},[c,h]=await Promise.all([l.find(d).sort(u).skip(f).limit(t).toArray(),l.countDocuments(d)]);return {docs:c.map(y=>this.processResult(y,{})),...this.calculatePagination(i,t,h)}}async findVersionByID(o){let{collection:e,versionId:n,tenantId:s}=o,t=this.getCollectionConfig(e),i=this.getMongoCollection(`${e}_versions`),r={_id:n};s&&t.tenantScoped&&(r.tenant_id=s);let a=await i.findOne(r);return a?this.processResult(a,{}):null}async createVersion(o){let{collection:e,documentId:n,data:s,status:t,createdBy:i,changeDescription:r,tenantId:a,autosave:l}=o,d=this.getCollectionConfig(e),f=this.getMongoCollection(`${e}_versions`);if(l){let c={document_id:n,collection_slug:e,autosave:true};a&&d.tenantScoped&&(c.tenant_id=a);let h=await f.findOne(c);if(h){let y=new Date().toISOString();return await f.updateOne({_id:h._id},{$set:{data:s,status:t,updatedAt:y}}),this.processResult({...h,data:s,status:t,updatedAt:y},{})}}let g=new Date().toISOString(),u={_id:this.generateId(),document_id:n,collection_slug:e,data:s,status:t,autosave:l===true,created_by:i,change_description:r,createdAt:g,updatedAt:g};if(a&&d.tenantScoped&&(u.tenant_id=a),await f.insertOne(u),!l){let c=this.getCollectionConfig(e);c.versions?.maxPerDoc&&await this.deleteVersions({collection:e,documentId:n,keepLatest:c.versions.maxPerDoc,tenantId:a});}return this.processResult(u,{})}async updateLatestVersion(o){return this.createVersion({...o,autosave:true})}async deleteVersions(o){let{collection:e,documentId:n,keepLatest:s,tenantId:t}=o,i=this.getCollectionConfig(e),r=this.getMongoCollection(`${e}_versions`);if(s){let a={document_id:n,autosave:{$ne:true}};t&&i.tenantScoped&&(a.tenant_id=t);let d=(await r.find(a).sort({createdAt:-1}).limit(s).project({_id:1}).toArray()).map(f=>f._id);d.length>0&&await r.deleteMany({document_id:n,autosave:{$ne:true},_id:{$nin:d},...t&&i.tenantScoped?{tenant_id:t}:{}});}else {let a={document_id:n};t&&i.tenantScoped&&(a.tenant_id=t),await r.deleteMany(a);}}async migrate(){for(let o of this.collections.values()){let e=this.getMongoCollection(o.slug);await e.createIndex({_id:1}),o.tenantScoped&&await e.createIndex({tenantId:1}),o.timestamps&&await e.createIndex({createdAt:-1});for(let n of o.fields)n.unique&&n.name&&await e.createIndex({[n.name]:1},{unique:true}),n.indexed&&n.name&&await e.createIndex({[n.name]:1});}}getCollectionConfig(o){if(o.startsWith("_globals_")){let n=o.replace("_globals_",""),s=this.globals.get(n);if(!s)throw new Error(`Global "${n}" not found`);return s}let e=this.collections.get(o);if(!e)throw new Error(`Collection "${o}" not found`);return e}buildFilter(o={},e){let n={};e&&(n.tenantId=e);for(let[s,t]of Object.entries(o))if(s==="AND"&&Array.isArray(t)){let i=t.map(r=>this.buildFilter(r));Object.assign(n,...i);}else if(s==="OR"&&Array.isArray(t))n.$or=t.map(i=>this.buildFilter(i));else if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let i={};if(t.equals!==void 0){n[s==="id"?"_id":s]=t.equals;continue}t.not_equals!==void 0&&(i.$ne=t.not_equals),t.in!==void 0&&(i.$in=t.in),t.not_in!==void 0&&(i.$nin=t.not_in),t.greater_than!==void 0&&(i.$gt=t.greater_than),t.greater_than_equal!==void 0&&(i.$gte=t.greater_than_equal),t.less_than!==void 0&&(i.$lt=t.less_than),t.less_than_equal!==void 0&&(i.$lte=t.less_than_equal),t.like!==void 0&&(i.$regex=new RegExp(t.like.replace(/%/g,".*"),"i")),t.not_like!==void 0&&(i.$not=new RegExp(t.not_like.replace(/%/g,".*"),"i")),t.contains!==void 0&&(i.$regex=new RegExp(`.*${t.contains}.*`,"i")),t.exists!==void 0&&(i.$exists=t.exists),Object.keys(i).length>0&&(n[s==="id"?"_id":s]=i);}else n[s==="id"?"_id":s]=t;return n}buildProjection(o){if(!o||o.length===0)return;let e={_id:1};for(let n of o)e[n]=1;return e}processResult(o,e){if(!o)return null;let n={...o};for(let s of Object.keys(n))/^\d+$/.test(s)&&delete n[s];return o._id&&(n.id=o._id,delete n._id),delete n.__v,n.createdAt&&(n.createdAt=new Date(n.createdAt).toISOString()),n.updatedAt&&(n.updatedAt=new Date(n.updatedAt).toISOString()),a$2(n)}generateId(){let o=Date.now().toString(16).padStart(12,"0"),e=randomBytes(6).toString("hex");return o+e}};function k(v){return new A(v)}
3
- export{A as a,k as b};
@@ -1,2 +0,0 @@
1
- import {c,n,o,a as a$1,b as b$2}from'./chunk-AWQGDMOE.js';import {c as c$1,b as b$1,d}from'./chunk-GQGFNTDZ.js';import {a}from'./chunk-VVVCCB6R.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g();g();async function G(e){let a=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$1=c$1(e.req);if(n$1){let r=await b$1(n$1,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=d(r));}return t}g();var L={_media:{create:c.MEDIA_UPLOAD,update:c.MEDIA_UPLOAD,delete:c.MEDIA_DELETE}};function q(e,a){let t=L[e];return t?t[a]:`collection.${a}`}async function P(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 I(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)&&I(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")I(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"&&I(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;I(u,s.fields);}}}async function b(e,a,t){let n=await a$1(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 v(e){return async a$1=>{let{collection:t,where:n,sort:r,limit:o$1,page:s,depth:u,select:i,draft:d}=a$1,l=e.registry.getCollection(t);if(await b(l,"read",e),l.hooks?.beforeRead)for(let p of l.hooks.beforeRead)await p({collection:t,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read",where:n});let c=d??!!e.user,h=await e.db.find({collection:t,where:n||{},sort:r,limit:o$1||10,page:s||1,depth:u||0,tenantId:e.tenantId,select:i,draft:c});if(l.hooks?.afterRead)for(let p of h.docs)for(let k of l.hooks.afterRead)await k({collection:t,doc:p,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read"});return await o(h.docs,l.fields,e.db,e.registry,1,u||0),a(h)}}function K(e){return async a$1=>{let{collection:t,id:n,depth:r,select:o$1,draft:s}=a$1,u=e.registry.getCollection(t);await b(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$1,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 o([d],u.fields,e.db,e.registry,1,r||0),a(d)}}function E(e){return async a=>{let{collection:t,data:n,depth:r,select:o}=a,s=e.registry.getCollection(t);await b(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 P(e,q(t,"create"),{collection:t,data:d,operation:"create"}),{doc:d}}}function j(e){return async a=>{let{collection:t,id:n,data:r,depth:o,select:s,baseUpdatedAt:u}=a,i=e.registry.getCollection(t);await b(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}`);I(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 m of i.hooks.beforeValidate){let f=await m({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 m of i.hooks.beforeChange){let f=await m({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 h=e.req&&typeof e.req.headers?.get=="function"&&e.req.headers.get("x-draft")==="true"||a.draft===true,p=i.versions?.drafts===true,k=e.req?.query?.autosave==="true"||e.req?.url?.includes("autosave=true")||a.autosave===true,g;if(p&&h?(await e.db.createVersion({collection:t,documentId:n,data:c,status:"draft",autosave:k,createdBy:e.user?.id,tenantId:e.tenantId}),g=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true})):p?(g=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})):g=await e.db.update({collection:t,id:n,data:c,depth:o||0,tenantId:e.tenantId,select:s}),i.hooks?.afterChange)for(let m of i.hooks.afterChange)await m({collection:t,doc:g,data:c,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});return await P(e,q(t,"update"),{collection:t,data:g,previousData:d,operation:"update"}),{doc:g}}}function S(e){return async a=>{let{collection:t,id:n}=a,r=e.registry.getCollection(t);await b(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 P(e,q(t,"delete"),{collection:t,data:s,previousData:o,operation:"delete"}),{doc:s,message:"Deleted successfully"}}}function _(e){return async a=>{let{collection:t,where:n}=a,r=e.registry.getCollection(t);return await b(r,"read",e),{totalDocs:await e.db.count({collection:t,where:n||{},tenantId:e.tenantId})}}}g();async function O(e,a,t){let n=await b$2(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 V(e){let a={},t=e.registry.getCollections();for(let r of t){let o=r.slug;a[o]={find:v(e),findByID:K(e),create:E(e),update:j(e),delete:S(e),count:_(e)};}let n=e.registry.getGlobals();for(let r of n){let o=r.slug;a[`_globals_${o}`]={get:async s=>(await O(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 O(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 M(e){if(e.settings?.access?.apiAccess?.trpcEnabled===false)throw new Error("tRPC API is disabled");return V(e)}export{G as a,v as b,K as c,E as d,j as e,S as f,_ as g,V as h,M as i};
@@ -1,431 +0,0 @@
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,previewText:r=t,bodyHtml:s,ctaText:i,ctaUrl:a,secondaryCtaText:n,secondaryCtaUrl:l}=o,p=e?.siteName||"Kyro CMS",f=e?.logoUrl||"https://kyro-cms.com/logo.svg",m=e?.logoDarkUrl||e?.logoUrl||"https://kyro-cms.com/logo-white.svg",u=e?.appUrl||"https://kyro-cms.com";return `<!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta name="color-scheme" content="light dark">
7
- <meta name="supported-color-schemes" content="light dark">
8
- <title>${t}</title>
9
- <style>
10
- :root {
11
- color-scheme: light dark;
12
- supported-color-schemes: light dark;
13
- }
14
- @media (prefers-color-scheme: dark) {
15
- .email-body { background-color: #09090b !important; color: #f4f4f5 !important; }
16
- .email-card { background-color: #121215 !important; border-color: #27272a !important; box-shadow: none !important; }
17
- .email-header { background-color: #18181b !important; border-color: #27272a !important; }
18
- .email-brand-text { color: #ffffff !important; }
19
- .email-title { color: #ffffff !important; }
20
- .email-text { color: #a1a1aa !important; }
21
- .email-strong { color: #ffffff !important; }
22
- .email-table { background-color: #18181b !important; border-color: #27272a !important; }
23
- .email-td-border { border-color: #27272a !important; }
24
- .email-label { color: #a1a1aa !important; }
25
- .email-value { color: #f4f4f5 !important; }
26
- .email-code-box { background-color: #18181b !important; border-color: #27272a !important; color: #ffffff !important; }
27
- .email-btn-primary { background-color: #ffffff !important; color: #09090b !important; }
28
- .email-btn-secondary { background-color: #18181b !important; border-color: #27272a !important; color: #f4f4f5 !important; }
29
- .email-footer { background-color: #09090b !important; border-color: #27272a !important; }
30
- .email-footer-text { color: #71717a !important; }
31
- .email-footer-link { color: #a1a1aa !important; }
32
- .logo-light { display: none !important; }
33
- .logo-dark { display: inline-block !important; }
34
- }
35
- </style>
36
- </head>
37
- <body class="email-body" style="margin: 0; padding: 24px 12px; background-color: #fafafa; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; color: #09090b; -webkit-font-smoothing: antialiased;">
38
- <!-- Preview Text -->
39
- <div style="display: none; max-height: 0; overflow: hidden;">${r}</div>
40
-
41
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-card" style="max-width: 480px; margin: 0 auto; background-color: #ffffff; border: 1px solid #f4f4f5; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);">
42
- <!-- Header Bar -->
43
- <tr>
44
- <td class="email-header" style="padding: 16px 24px; border-bottom: 1px solid #fafafa; background-color: #ffffff;">
45
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0">
46
- <tr>
47
- <td align="center" valign="middle">
48
- <a href="${u}" target="_blank" style="text-decoration: none; display: inline-flex; align-items: center; gap: 8px;">
49
- <!-- Light Mode Logo -->
50
- <img src="${f}" alt="${p} Logo" class="logo-light" height="22" style="display: inline-block; border: 0; max-height: 22px; vertical-align: middle;" />
51
- <!-- Dark Mode Logo -->
52
- <img src="${m}" alt="${p} Logo" class="logo-dark" height="22" style="display: none; border: 0; max-height: 22px; vertical-align: middle;" />
53
- <span class="email-brand-text" style="font-size: 15px; font-weight: 600; color: #09090b; letter-spacing: -0.2px; vertical-align: middle;">${p}</span>
54
- </a>
55
- </td>
56
- </tr>
57
- </table>
58
- </td>
59
- </tr>
60
-
61
- <!-- Body Section -->
62
- <tr>
63
- <td style="padding: 24px;">
64
- <h1 class="email-title" style="margin: 0 0 8px; font-size: 18px; font-weight: 600; color: #09090b; letter-spacing: -0.2px; text-align: center;">
65
- ${t}
66
- </h1>
67
-
68
- ${s}
69
-
70
- ${i&&a?`
71
- <!-- Action Buttons -->
72
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top: 20px;">
73
- <tr>
74
- <td align="center">
75
- <a href="${a}" target="_blank" class="email-btn-primary" style="display: inline-block; padding: 10px 18px; background-color: #09090b; color: #ffffff; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 8px;">
76
- ${i} \u2192
77
- </a>
78
- ${n&&l?`<a href="${l}" target="_blank" class="email-btn-secondary" style="display: inline-block; padding: 10px 16px; margin-left: 8px; background-color: #ffffff; border: 1px solid #e4e4e7; color: #09090b; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 8px;">
79
- ${n}
80
- </a>`:""}
81
- </td>
82
- </tr>
83
- </table>`:""}
84
- </td>
85
- </tr>
86
-
87
- <!-- Footer -->
88
- <tr>
89
- <td class="email-footer" style="padding: 16px 24px; border-top: 1px solid #fafafa; background-color: #fdfdfd; text-align: center;">
90
- <p style="margin: 0; font-size: 12px; color: #a1a1aa;">
91
- <a href="${u}" target="_blank" class="email-footer-link" style="color: #71717a; text-decoration: none; font-weight: 500;">${u.replace(/^https?:\/\//,"")}</a> &nbsp;\u2022&nbsp;
92
- <a href="${u}/docs" target="_blank" class="email-footer-link" style="color: #71717a; text-decoration: none; font-weight: 500;">Docs</a>
93
- </p>
94
- </td>
95
- </tr>
96
- </table>
97
- </body>
98
- </html>`}chunkBUNLC3II_cjs.h();function b(o,e="User",t){let r="Confirm your email address \u2014 Kyro CMS",s=`
99
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
100
- Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
101
- </p>
102
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
103
- Thank you for registering. Please confirm your email address by clicking the verification button below to activate your account.
104
- </p>
105
-
106
- <!-- Verification Token Link Card -->
107
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
108
- <tr>
109
- <td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
110
- <strong>Direct link:</strong><br />
111
- <a href="${o}" style="color: #09090b; text-decoration: underline;" class="email-value">${o}</a>
112
- </td>
113
- </tr>
114
- </table>
115
-
116
- <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
117
- This verification link will expire in 24 hours. If you did not create an account, you can safely ignore this email.
118
- </p>
119
- `,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"}),a=`Welcome, ${e}!
120
-
121
- Please verify your email address by visiting:
122
- ${o}
123
-
124
- This link expires in 24 hours.
125
-
126
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function x(o,e="User",t){let r="Reset your password \u2014 Kyro CMS",s=`
127
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
128
- Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
129
- </p>
130
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
131
- We received a request to reset the password for your account. Click the button below to choose a new password.
132
- </p>
133
-
134
- <!-- Reset Link Box -->
135
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
136
- <tr>
137
- <td style="font-size: 12px; color: #71717a; line-height: 1.5; word-break: break-all;">
138
- <strong>Reset URL:</strong><br />
139
- <a href="${o}" style="color: #09090b; text-decoration: underline;" class="email-value">${o}</a>
140
- </td>
141
- </tr>
142
- </table>
143
-
144
- <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
145
- For security reasons, this link will expire in 1 hour. If you did not request a password reset, no further action is required.
146
- </p>
147
- `,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}),a=`Hello ${e},
148
-
149
- Reset your password using the following link:
150
- ${o}
151
-
152
- This link will expire in 1 hour.
153
-
154
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function _(o="User",e="https://kyro-cms.com",t){let r="Welcome to Kyro CMS!",s=`
155
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
156
- Welcome <strong class="email-strong" style="color: #09090b;">${o}</strong>,
157
- </p>
158
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
159
- Your Kyro CMS account is now set up and ready to go. You can access your admin dashboard, build content collections, and manage schema endpoints.
160
- </p>
161
-
162
- <!-- Key Capabilities List -->
163
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
164
- <tr>
165
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
166
- \u{1F680} <strong>What you can do next:</strong>
167
- <ul style="margin: 8px 0 0; padding-left: 20px; color: #52525b;">
168
- <li>Define collections & custom field schemas in <code style="font-family: monospace;">kyro.config.ts</code></li>
169
- <li>Explore auto-generated REST, GraphQL, tRPC & WebSocket endpoints</li>
170
- <li>Customize your visual Admin dashboard & branding settings</li>
171
- </ul>
172
- </td>
173
- </tr>
174
- </table>
175
- `,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"}),a=`Welcome to Kyro CMS, ${o}!
176
-
177
- Your account is active. Log in at ${e} to start building.
178
-
179
- Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:a}}chunkBUNLC3II_cjs.h();function w(o="User",e,t,r){let s="Security Alert: Password Changed \u2014 Kyro CMS",i=new Date().toUTCString(),a=`
180
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
181
- Hello <strong class="email-strong" style="color: #09090b;">${o}</strong>,
182
- </p>
183
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
184
- This email confirms that the password for your Kyro CMS account was successfully updated on <strong>${i}</strong>.
185
- </p>
186
-
187
- <!-- Security Warning Card -->
188
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
189
- <tr>
190
- <td style="font-size: 13px; color: #991b1b; line-height: 1.5; text-align: center;">
191
- \u26A0\uFE0F <strong>Did not request this change?</strong><br />
192
- If you did not initiate this change, your account may be compromised. Reset your password immediately and contact an administrator.
193
- </td>
194
- </tr>
195
- </table>
196
-
197
- ${t||r?`
198
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #f4f4f5; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
199
- <tr>
200
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
201
- <strong>Action IP:</strong> ${t||"Unknown"}<br />
202
- <strong>Device:</strong> ${r||"Unknown"}
203
- </td>
204
- </tr>
205
- </table>`:""}
206
- `,n=g({brand:e,title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",bodyHtml:a,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: Your Kyro CMS password was updated at ${i}.
207
-
208
- If you did not make this change, please reset your password immediately.
209
-
210
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:l}}chunkBUNLC3II_cjs.h();function S(o,e,t="User",r){let s="Your one-time login link \u2014 Kyro CMS",i=`
211
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
212
- Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
213
- </p>
214
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
215
- Click the button below to sign in to your Kyro CMS account without entering a password.
216
- </p>
217
-
218
- ${e?`
219
- <!-- One-Time Passcode Box -->
220
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 16px; text-align: center;">
221
- <tr>
222
- <td style="font-size: 12px; color: #71717a; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;">
223
- One-Time Passcode
224
- </td>
225
- </tr>
226
- <tr>
227
- <td style="font-size: 28px; font-weight: 800; font-family: monospace; color: #09090b; letter-spacing: 4px;" class="email-code-box">
228
- ${e}
229
- </td>
230
- </tr>
231
- </table>`:""}
232
-
233
- <p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
234
- This single-use link will expire in 10 minutes. Never share authentication links with anyone.
235
- </p>
236
- `,a=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}),n=`Hello ${t},
237
-
238
- Sign in to Kyro CMS using the link below:
239
- ${o}${e?`
240
-
241
- Or enter code: ${e}`:""}
242
-
243
- This link expires in 10 minutes.
244
-
245
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:n}}chunkBUNLC3II_cjs.h();function C(o,e,t="User",r,s,i){let a="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",n=`
246
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
247
- Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
248
- </p>
249
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
250
- Your Kyro CMS account was temporarily locked after <strong>${o} failed login attempts</strong>.
251
- </p>
252
-
253
- <!-- Lockout Notice Card -->
254
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
255
- <tr>
256
- <td style="font-size: 13px; color: #b45309; line-height: 1.5; text-align: center;">
257
- \u{1F512} <strong>Lockout duration:</strong> ${e} minutes.<br />
258
- You may try logging in again after the cooling-off period expires.
259
- </td>
260
- </tr>
261
- </table>
262
-
263
- ${s||i?`
264
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #f4f4f5; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
265
- <tr>
266
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
267
- <strong>Failed Attempts IP:</strong> ${s||"Unknown"}<br />
268
- <strong>Device:</strong> ${i||"Unknown"}
269
- </td>
270
- </tr>
271
- </table>`:""}
272
- `,l=g({brand:r,title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",bodyHtml:n,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.
273
-
274
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:a,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=`
275
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
276
- Hello,
277
- </p>
278
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
279
- <strong class="email-strong" style="color: #09090b;">${t}</strong> has invited you to join their team workspace as an <strong>${e}</strong> in Kyro CMS.
280
- </p>
281
-
282
- <!-- Invite Details Card -->
283
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 20px; padding: 14px; border-collapse: separate;">
284
- <tr>
285
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
286
- <strong>Assigned Role:</strong> ${e}<br />
287
- <strong>Invited By:</strong> ${t}
288
- </td>
289
- </tr>
290
- </table>
291
- `,a=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"}),n=`You're invited to join Kyro CMS as an ${e} by ${t}.
292
-
293
- Accept your invitation here:
294
- ${o}
295
-
296
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:n}}chunkBUNLC3II_cjs.h();function k(o,e,t="User",r,s="Unknown Device"){let i="Security Alert: New Sign-in to Kyro CMS",a=`
297
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
298
- Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
299
- </p>
300
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
301
- A new sign-in to your Kyro CMS account was detected.
302
- </p>
303
-
304
- <!-- Sign-in Details -->
305
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #f4f4f5; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
306
- <tr>
307
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
308
- <strong>Time:</strong> ${e}<br />
309
- <strong>Location/IP:</strong> ${o}<br />
310
- <strong>Device:</strong> ${s}
311
- </td>
312
- </tr>
313
- </table>
314
-
315
- <!-- Security Warning Card -->
316
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; margin-bottom: 20px; padding: 16px; border-collapse: separate;">
317
- <tr>
318
- <td style="font-size: 13px; color: #991b1b; line-height: 1.5; text-align: center;">
319
- \u26A0\uFE0F <strong>Don't recognize this activity?</strong><br />
320
- If you did not sign in recently, your account may be compromised. Please reset your password immediately and contact an administrator.
321
- </td>
322
- </tr>
323
- </table>
324
- `,n=g({brand:r,title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",bodyHtml:a,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: New Sign-in to Kyro CMS
325
-
326
- Hello ${t},
327
-
328
- A new sign-in to your account was detected at ${e} from ${o} using ${s}.
329
-
330
- If you did not sign in recently, please reset your password immediately.
331
-
332
- Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:n,text:l}}chunkBUNLC3II_cjs.h();function E(o,e="Customer",t,r,s){let i=`Order Confirmation #${o}`,a=`
333
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
334
- Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
335
- </p>
336
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
337
- Thank you for your order! We've received your order <strong>#${o}</strong> and are getting it ready for shipment.
338
- </p>
339
-
340
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
341
- <tr>
342
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
343
- \u{1F6D2} <strong>Order Summary:</strong><br/>
344
- Order Total: <strong>${t}</strong>
345
- </td>
346
- </tr>
347
- </table>
348
- `,n=g({brand:s,title:"Order Confirmed",previewText:`Your order #${o} has been confirmed.`,bodyHtml:a,ctaText:"View Order",ctaUrl:r||"https://kyro-cms.com"}),l=`Hi ${e},
349
-
350
- Thank you for your order #${o}!
351
-
352
- Order Total: ${t}
353
-
354
- View your order here: ${r||"https://kyro-cms.com"}`;return {subject:i,html:n,text:l}}chunkBUNLC3II_cjs.h();function v(o,e="Customer",t,r,s){let i=`Your Order #${o} is on the way!`,a=`
355
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
356
- Great news, <strong class="email-strong" style="color: #09090b;">${e}</strong>!
357
- </p>
358
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
359
- Your order <strong>#${o}</strong> has been shipped and is on its way to you.
360
- </p>
361
-
362
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
363
- <tr>
364
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
365
- \u{1F4E6} <strong>Tracking Number:</strong> ${t}
366
- </td>
367
- </tr>
368
- </table>
369
- `,n=g({brand:s,title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,bodyHtml:a,ctaText:"Track Package",ctaUrl:r}),l=`Hi ${e},
370
-
371
- Your order #${o} has been shipped!
372
-
373
- Tracking Number: ${t}
374
- Track it here: ${r}`;return {subject:i,html:n,text:l}}chunkBUNLC3II_cjs.h();function A(o,e="Customer",t,r){let s=`Your Order #${o} has been delivered`,i=`
375
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
376
- Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
377
- </p>
378
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
379
- Good news! Your order <strong>#${o}</strong> has been successfully delivered. We hope you love it!
380
- </p>
381
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
382
- We'd love to hear your thoughts. If you have a minute, please leave a review for your items.
383
- </p>
384
- `,a=g({brand:r,title:"Order Delivered",previewText:`Your order #${o} has arrived!`,bodyHtml:i,ctaText:"Leave a Review",ctaUrl:t}),n=`Hi ${e},
385
-
386
- Your order #${o} has been delivered!
387
-
388
- Leave a review here: ${t}`;return {subject:s,html:a,text:n}}chunkBUNLC3II_cjs.h();function R(o,e="Customer",t,r){let s=`Refund Processed for Order #${o}`,i=`
389
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
390
- Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
391
- </p>
392
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
393
- We have processed a refund for your order <strong>#${o}</strong>. It may take 3-5 business days for the funds to appear on your original payment method.
394
- </p>
395
-
396
- <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" class="email-table" style="background-color: #fafafa; border: 1px solid #e4e4e7; border-radius: 8px; margin-bottom: 24px; padding: 16px; border-collapse: separate;">
397
- <tr>
398
- <td style="font-size: 13px; color: #09090b; line-height: 1.6;" class="email-value">
399
- \u{1F4B8} <strong>Refund Amount:</strong> ${t}
400
- </td>
401
- </tr>
402
- </table>
403
- `,a=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"}),n=`Hi ${e},
404
-
405
- We have processed a refund of ${t} for order #${o}.
406
-
407
- View store: https://kyro-cms.com`;return {subject:s,html:a,text:n}}chunkBUNLC3II_cjs.h();function I(o="Customer",e,t){let r="You left something behind...",s=`
408
- <p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
409
- Hi <strong class="email-strong" style="color: #09090b;">${o}</strong>,
410
- </p>
411
- <p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
412
- We noticed you left some great items in your shopping cart. They are still waiting for you, but they might sell out soon!
413
- </p>
414
- `,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}),a=`Hi ${o},
415
-
416
- You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:a}}function O(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 K=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(!K)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('./drizzle-orm-47ELDEM6.cjs');await this.db.execute(e`
417
- CREATE TABLE IF NOT EXISTS "settings" (
418
- "key" VARCHAR(255) PRIMARY KEY,
419
- "value" TEXT NOT NULL,
420
- "description" TEXT,
421
- "updated_at" TIMESTAMP DEFAULT NOW()
422
- )
423
- `),K=!0;}else typeof this.db?.exec=="function"&&(this.db.exec(`
424
- CREATE TABLE IF NOT EXISTS settings (
425
- key TEXT PRIMARY KEY,
426
- value TEXT NOT NULL,
427
- description TEXT,
428
- updated_at TEXT
429
- )
430
- `),K=!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 a of i)try{let n=await this.db.execute(s`SELECT * FROM ${s.raw(a)} LIMIT 1`);if(e=Array.isArray(n)?n[0]:n?.rows?n.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 $=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...O(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,a=`"${s||"Kyro CMS"}" <${r}>`,n=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:a,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:n});}break;case "resend":l=await this.sendViaResend(a,e,n);break;case "sendgrid":l=await this.sendViaSendGrid(a,e,n);break;case "mailgun":l=await this.sendViaMailgun(a,e,n);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},a=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){let n=await a.json();throw new Error(`Resend Error: ${JSON.stringify(n)}`)}return a.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(n=>({email:n})):[{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},a=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){let n=await a.json();throw new Error(`SendGrid Error: ${JSON.stringify(n)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:a}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let n=a==="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://${n}/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,a=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),a=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:n}=await import('./drizzle-orm-47ELDEM6.cjs');try{let l=await e.execute(n`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(n`SELECT * FROM "_globals_brand-settings" LIMIT 1`);a=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{a=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),a?.identity){let n=typeof a.identity=="string"?JSON.parse(a.identity):a.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(n.primaryLogo){let p=await l(n.primaryLogo);p&&(r=p);}if(n.darkLogo){let p=await l(n.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,a=process.env.SMTP_USER,n=process.env.SMTP_PASS;return !i||!a||!n?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:a,pass:n}}})}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,a=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!a?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:a,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,a=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,n=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!a?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:a,region:n}})}return null}};
431
- 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=O;exports.p=y;exports.q=$;
@@ -1,2 +0,0 @@
1
- import {a}from'./chunk-7NH7H3WA.js';import {g as g$1,e}from'./chunk-Y2YAKDEQ.js';import {randomUUID,randomBytes}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g$1();var c=e(a(),1);var g=class{db;adapter;prefix;sessionTTL;refreshTokenTTL;indexesEnsured=false;constructor(e){this.db=e.db,this.adapter=e.adapter,this.prefix=e.collectionPrefix||"",this.sessionTTL=e.sessionTTL||86400,this.refreshTokenTTL=e.refreshTokenTTL||604800;}getDatabase(){let e=typeof this.db=="function"?this.db():this.db;if(!e&&this.adapter&&(this.adapter.db?e=this.adapter.db:this.adapter.client&&(this.adapter.db=this.adapter.client.db(this.adapter.database||"kyro_cms"),e=this.adapter.db)),!e&&globalThis.__KYRO_INSTANCE__?.db){let s=globalThis.__KYRO_INSTANCE__.db;s.db?e=s.db:s.client&&(s.db=s.client.db(s.database||"kyro_cms"),e=s.db);}if(!e)throw new Error("MongoDB database not initialized");return e}col(e){return this.getDatabase().collection(`${this.prefix}${e}`)}async connect(){this.adapter&&!this.adapter.connected&&await this.adapter.connect(),this.indexesEnsured||await this.ensureIndexes();}async disconnect(){}async ensureIndexes(){await this.col("users").createIndex({email:1},{unique:true}),await this.col("users").createIndex({tenantId:1}),await this.col("users").createIndex({role:1}),await this.col("sessions").createIndex({token:1},{unique:true}),await this.col("sessions").createIndex({refreshToken:1}),await this.col("sessions").createIndex({userId:1}),await this.col("sessions").createIndex({expiresAt:1},{expireAfterSeconds:0}),await this.col("audit_logs").createIndex({timestamp:-1}),await this.col("audit_logs").createIndex({userId:1}),await this.col("audit_logs").createIndex({action:1}),await this.col("audit_logs").createIndex({resource:1}),await this.col("password_history").createIndex({userId:1,createdAt:-1}),await this.col("lockouts").createIndex({userId:1},{unique:true}),await this.col("lockouts").createIndex({lockedUntil:1}),this.indexesEnsured=true;}async createUser(e){let s=randomUUID(),t=new Date,i=await this.hashPassword(e.password),r={_id:s,name:e.name||null,email:e.email.toLowerCase(),passwordHash:i,role:e.role||"customer",avatar:e.avatar||null,tenantId:e.tenantId||null,emailVerified:false,locked:false,lastLogin:null,failedLoginAttempts:0,createdAt:t,updatedAt:t};return await this.col("users").insertOne(r),this.docToAuthUser(r)}async findUserByEmail(e){let s=await this.col("users").findOne({email:e.toLowerCase()});return s?this.docToAuthUser(s):null}async findUserById(e){let s=await this.col("users").findOne({_id:e});return s?this.docToAuthUser(s):null}async updateUser(e,s){let t={updatedAt:new Date};s.name!==void 0&&(t.name=s.name),s.email!==void 0&&(t.email=s.email),s.passwordHash!==void 0&&(t.passwordHash=s.passwordHash),s.role!==void 0&&(t.role=s.role),s.avatar!==void 0&&(t.avatar=s.avatar),s.tenantId!==void 0&&(t.tenantId=s.tenantId),s.emailVerified!==void 0&&(t.emailVerified=s.emailVerified),s.locked!==void 0&&(t.locked=s.locked),s.lastLogin!==void 0&&(t.lastLogin=s.lastLogin?new Date(s.lastLogin):null),s.failedLoginAttempts!==void 0&&(t.failedLoginAttempts=s.failedLoginAttempts);let i=await this.col("users").findOneAndUpdate({_id:e},{$set:t},{returnDocument:"after"});return i?this.docToAuthUser(i):null}async deleteUser(e){return (await this.col("users").deleteOne({_id:e})).deletedCount>0}async verifyPassword(e,s){let t=await this.findUserByEmail(e);if(!t)return null;let i=await this.col("users").findOne({email:e.toLowerCase()},{projection:{passwordHash:1}});return i?.passwordHash&&await c.default.compare(s,i.passwordHash)?t:null}async hashPassword(e){return c.default.hash(e,12)}async createSession(e,s){let t=randomUUID(),i=randomBytes(32).toString("base64url"),r=randomBytes(32).toString("base64url"),o=new Date,u=new Date(o.getTime()+this.sessionTTL*1e3),d={_id:t,userId:e,token:i,refreshToken:r,ipAddress:s?.ipAddress||null,userAgent:s?.userAgent||null,expiresAt:u,createdAt:o};return await this.col("sessions").insertOne(d),this.docToSession(d)}async findSessionByToken(e){let s=await this.col("sessions").findOne({token:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async findSessionByRefreshToken(e){let s=await this.col("sessions").findOne({refreshToken:e,expiresAt:{$gt:new Date}});return s?this.docToSession(s):null}async deleteSession(e){return (await this.col("sessions").deleteOne({_id:e})).deletedCount>0}async deleteUserSessions(e){return (await this.col("sessions").deleteMany({userId:e})).deletedCount}async hasAnyUsers(){return await this.col("users").countDocuments()>0}async addPasswordToHistory(e,s){await this.col("password_history").insertOne({userId:e,passwordHash:s,createdAt:new Date});}async getPasswordHistory(e,s=5){return (await this.col("password_history").find({userId:e}).sort({createdAt:-1}).limit(s).toArray()).map(i=>i.passwordHash)}async isPasswordInHistory(e,s,t=5){let i=await this.getPasswordHistory(s,t);for(let r of i)if(await c.default.compare(e,r))return true;return false}async findAuditLogs(e){let{limit:s=50,offset:t=0,userId:i,action:r,resource:o,resourceId:u,success:d,startDate:f,endDate:h}=e,a={};i&&(a.userId=i),r&&(Array.isArray(r)?a.action={$in:r}:a.action=r),o&&(a.resource=o),u&&(a.resourceId=u),d!==void 0&&(a.success=d),(f||h)&&(a.timestamp={},f&&(a.timestamp.$gte=f),h&&(a.timestamp.$lte=h));let w=await this.col("audit_logs").countDocuments(a);return {logs:(await this.col("audit_logs").find(a).sort({timestamp:-1}).skip(t).limit(s).toArray()).map(n=>({id:n._id,timestamp:n.timestamp,action:n.action,userId:n.userId||void 0,userEmail:n.userEmail||void 0,role:n.role||void 0,resource:n.resource,resourceId:n.resourceId||void 0,changes:n.changes||void 0,ipAddress:n.ipAddress||void 0,userAgent:n.userAgent||void 0,success:n.success,error:n.error||void 0,metadata:n.metadata||void 0})),total:w}}async createAuditLog(e){let s=randomUUID(),t=new Date;return await this.col("audit_logs").insertOne({_id:s,action:e.action,userId:e.userId||null,userEmail:e.userEmail||null,role:e.role||null,resource:e.resource,resourceId:e.resourceId||null,changes:e.changes||null,ipAddress:e.ipAddress||null,userAgent:e.userAgent||null,success:e.success,error:e.error||null,metadata:e.metadata||null,timestamp:t}),{...e,id:s,timestamp:t}}docToAuthUser(e){return {id:e._id,name:e.name||void 0,email:e.email,passwordHash:e.passwordHash||void 0,role:e.role,tenantId:e.tenantId||void 0,avatar:e.avatar||void 0,emailVerified:e.emailVerified||false,locked:e.locked||false,lastLogin:e.lastLogin?.toISOString?.()||e.lastLogin||void 0,failedLoginAttempts:e.failedLoginAttempts||0,createdAt:e.createdAt?.toISOString?.()||e.createdAt,updatedAt:e.updatedAt?.toISOString?.()||e.updatedAt}}docToSession(e){return {id:e._id,userId:e.userId,token:e.token,refreshToken:e.refreshToken||void 0,expiresAt:e.expiresAt?.toISOString?.()||e.expiresAt,createdAt:e.createdAt?.toISOString?.()||e.createdAt,ipAddress:e.ipAddress||void 0,userAgent:e.userAgent||void 0}}async createEmailVerificationToken(e){let s=randomBytes(32).toString("hex"),t=new Date(Date.now()+1440*60*1e3),i=await import('./lib-XXYYUPMW.js'),r=i.ObjectId??i.default?.ObjectId;return await this.db.collection("email_verifications").insertOne({userId:new r(e),token:s,expiresAt:t,createdAt:new Date}),{token:s,expiresAt:t}}async verifyEmailToken(e){let s=await this.db.collection("email_verifications").findOne({token:e});return s?s.expiresAt<new Date?{success:false,error:"Verification token has expired"}:(await this.db.collection("users").updateOne({_id:s.userId},{$set:{emailVerified:true}}),await this.db.collection("email_verifications").deleteOne({_id:s._id}),{success:true,userId:s.userId.toString()}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=randomBytes(32).toString("hex"),i=new Date(Date.now()+3600*1e3),r=await import('./lib-XXYYUPMW.js'),o=r.ObjectId??r.default?.ObjectId;return await this.db.collection("password_resets").insertOne({userId:new o(s.id),token:t,expiresAt:i,createdAt:new Date}),{token:t,expiresAt:i}}async resetPasswordWithToken(e,s){let t=await this.db.collection("password_resets").findOne({token:e});if(!t)return {success:false,error:"Invalid reset token"};if(t.expiresAt<new Date)return {success:false,error:"Reset token has expired"};if(t.usedAt)return {success:false,error:"Reset token has already been used"};let i=await this.hashPassword(s);return await this.db.collection("users").updateOne({_id:t.userId},{$set:{passwordHash:i,updatedAt:new Date}}),await this.db.collection("password_resets").updateOne({_id:t._id},{$set:{usedAt:new Date}}),await this.db.collection("sessions").deleteMany({userId:t.userId}),{success:true}}};export{g as a};
@@ -1,2 +0,0 @@
1
- import {K,H}from'./chunk-EI7FRSNY.js';import {e}from'./chunk-CHYVUWZ3.js';import {hb}from'./chunk-CNHUCCQJ.js';import {a as a$1}from'./chunk-N6MNQIQU.js';import {c}from'./chunk-FUFS65Q5.js';import {a}from'./chunk-ZWDBPEXL.js';import {a as a$2}from'./chunk-5ZEYOFAK.js';import {g}from'./chunk-Y2YAKDEQ.js';import w from'kyro:config';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
2
- g();var r=null,l=null;async function b(){if(!r){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let e$1=w.default||w,t=e$1.adapter,o=t&&!t.dialect&&typeof t.connect=="function";if(globalThis.DB&&(!t||o)){let s=globalThis.DB;e$1.adapter=new c({type:"sqlite",client:s}),K.info("Hot-swapped to D1 DrizzleAdapter");}r=H(e$1),await r.init();let a$3=e$1.adapter,p=a$3&&a$3.dialect&&(a$3.dialect==="postgres"||a$3.dialect==="sqlite"),c$1=a$3&&a$3.dialect==="mongodb",n;if(p)a$3.dialect==="postgres"?n=new a({db:a$3.client}):a$3.dialect==="sqlite"&&(n=new hb({db:a$3.rawClient||a$3.client}));else if(o&&!globalThis.DB){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";n=new a$1({path:s});}else c$1&&(n=new a$2({adapter:a$3}));if(n?.connect)try{await n.connect();}catch(s){K.warn("Auth connect warning:",s);}try{await r.loadSettings();}catch(s){K.warn("loadSettings warning:",s);}try{await e(n);}catch(s){K.warn("autoBootstrap warning:",s);}globalThis.__KYRO_INSTANCE__=r;}catch(e){throw r=null,l=null,K.error("Init failed, will retry:",e),e}}}async function E(e){let t=globalThis.DB?globalThis:null;try{let{env:o}=await import('cloudflare:workers');o&&(t=o);}catch{}if(e)try{t=e.locals?.cfContext?.env||e?.env||t;}catch{}if(!t)try{t=process.env;}catch{}t?.DB&&(globalThis.DB=t.DB),t?.STORAGE_BUCKET&&(globalThis.STORAGE_BUCKET=t.STORAGE_BUCKET),l||(l=b()),await l;}var _={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function T(e){return r?r.settings?.access?.apiAccess?.[e]??_[e]??true:_[e]??true}var R=async e=>{if(!r)try{await Promise.race([E(e),new Promise((t,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch(t){return console.error("[Kyro API] Warm error:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}try{let o=new URL(e.request.url).pathname,a=__KYRO_API_PATH__;if(o===`${a}/graphql`&&typeof r.getGraphQL=="function"){if(!T("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getGraphQL().fetch(e.request,e.locals);return new Response(n.body,n)}if(o.startsWith(`${a}/trpc/`)&&typeof r.getTRPC=="function"){if(!T("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getTRPC().fetch(e.request,e.locals);return new Response(n.body,n)}return await(await r.getREST()).fetch(e.request,e.locals)}catch(t){return console.error("[Kyro API Execution Error]:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Internal Server Error",message:t?.message||String(t),stack:t?.stack}),{status:500,headers:{"Content-Type":"application/json"}})}},N=R;export{r as a,E as b,R as c,N as d};