@kyro-cms/core 0.12.44 → 0.12.45

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 (311) hide show
  1. package/dist/{WebhookService-C19xR8qE.d.ts → WebhookService-CZf_na-J.d.ts} +1 -1
  2. package/dist/{WebhookService-BBcCHBo8.d.cts → WebhookService-DgIx21X-.d.cts} +1 -1
  3. package/dist/api-handler-graphql.cjs +1 -1
  4. package/dist/api-handler-graphql.js +2 -1
  5. package/dist/api-handler-trpc.cjs +1 -1
  6. package/dist/api-handler-trpc.js +2 -1
  7. package/dist/api-handler.cjs +1 -1
  8. package/dist/api-handler.js +1 -1
  9. package/dist/{base-yXdYZxFK.d.ts → base-7vJMzr4V.d.ts} +1 -1
  10. package/dist/{base-C2iwjdJQ.d.cts → base-DDEmdRqV.d.cts} +1 -1
  11. package/dist/bcryptjs-AZA6WEN2.js +2 -0
  12. package/dist/bcryptjs-WIQSWJGK.cjs +1 -0
  13. package/dist/better-sqlite3-42Q3FG3E.js +2 -0
  14. package/dist/better-sqlite3-5IISPX34.cjs +1 -0
  15. package/dist/bootstrap-7CI3NVSY.js +1 -0
  16. package/dist/bootstrap-DOOM2CNQ.cjs +1 -0
  17. package/dist/bowser-FI5JQGKZ.js +11 -0
  18. package/dist/bowser-VX6B6ZSE.cjs +10 -0
  19. package/dist/chokidar-24HVS6XD.cjs +5 -0
  20. package/dist/chokidar-43DT7CVN.js +6 -0
  21. package/dist/chunk-26Q7JXM4.cjs +3 -0
  22. package/dist/chunk-2BUODBE2.js +2 -0
  23. package/dist/chunk-2WFTETFB.js +2 -0
  24. package/dist/chunk-35PGCW3S.cjs +1 -0
  25. package/dist/chunk-3VXEK5ZW.cjs +1 -0
  26. package/dist/chunk-45TJAB5X.js +301 -0
  27. package/dist/chunk-5DWYVUQR.cjs +1 -0
  28. package/dist/chunk-5LPNEYK5.cjs +1 -0
  29. package/dist/chunk-66BJXVFJ.js +2 -0
  30. package/dist/chunk-6KRR7YHA.js +2 -0
  31. package/dist/chunk-6KUL2BSA.cjs +133 -0
  32. package/dist/chunk-6MSS5X77.js +2 -0
  33. package/dist/chunk-6QWLXJ7L.js +2 -0
  34. package/dist/chunk-6V3AP7HR.cjs +269 -0
  35. package/dist/chunk-73D2PNHD.cjs +7 -0
  36. package/dist/chunk-7ACHOBWY.cjs +13 -0
  37. package/dist/chunk-7AQSH3KR.js +2 -0
  38. package/dist/chunk-7GGZA5YU.cjs +2 -0
  39. package/dist/chunk-7I6URA6F.js +4 -0
  40. package/dist/chunk-7JWQ2PZP.cjs +1 -0
  41. package/dist/chunk-7SSFHJTR.js +57 -0
  42. package/dist/chunk-7T35572E.js +75 -0
  43. package/dist/chunk-7V67ONUD.js +4 -0
  44. package/dist/chunk-7WMMKGEO.cjs +1 -0
  45. package/dist/chunk-A73AVVFR.js +11 -0
  46. package/dist/chunk-AK754S3T.cjs +2 -0
  47. package/dist/chunk-AMGJ5AFH.cjs +1 -0
  48. package/dist/chunk-ATBH763U.js +2 -0
  49. package/dist/chunk-B3GDQ7UI.cjs +114 -0
  50. package/dist/chunk-BAVN7VDR.cjs +1 -0
  51. package/dist/chunk-BCEE4NBZ.cjs +2 -0
  52. package/dist/{chunk-J4252I5B.cjs → chunk-BHR7OAU4.cjs} +4 -4
  53. package/dist/chunk-BLH2MRK4.js +2 -0
  54. package/dist/chunk-BPMA2ECA.js +10 -0
  55. package/dist/chunk-BUNLC3II.cjs +1 -0
  56. package/dist/chunk-C2PXMVR5.js +2 -0
  57. package/dist/chunk-CGPAS4U5.js +4 -0
  58. package/dist/chunk-DS5DE5BU.js +2 -0
  59. package/dist/chunk-DUO523BH.cjs +1 -0
  60. package/dist/chunk-DVWYO3KK.cjs +1 -0
  61. package/dist/chunk-E27KEZPT.js +2 -0
  62. package/dist/chunk-EHWUALGH.cjs +1 -0
  63. package/dist/chunk-EN65ZEK2.cjs +2 -0
  64. package/dist/chunk-EOOZDOL7.js +3 -0
  65. package/dist/chunk-EZIDQBXI.cjs +1 -0
  66. package/dist/chunk-F4ITQ6XQ.cjs +3 -0
  67. package/dist/chunk-FLM37UVD.js +2 -0
  68. package/dist/chunk-GIS6X43A.cjs +3 -0
  69. package/dist/chunk-GNEVCEJU.cjs +3 -0
  70. package/dist/chunk-GNOSG3PK.cjs +1 -0
  71. package/dist/chunk-HLAEJB5R.js +384 -0
  72. package/dist/chunk-HPYH7GTS.cjs +1 -0
  73. package/dist/chunk-HT44I66C.js +24 -0
  74. package/dist/chunk-HTYVI2HK.cjs +9 -0
  75. package/dist/chunk-ICVQWR2A.js +2 -0
  76. package/dist/chunk-IP6JUEH3.js +3 -0
  77. package/dist/chunk-IPXOY4RI.js +2 -0
  78. package/dist/chunk-J6U5LWZ7.js +11 -0
  79. package/dist/{chunk-UHFDH3PG.js → chunk-JT36FTHY.cjs} +4 -4
  80. package/dist/chunk-JUJZOG6P.js +2 -0
  81. package/dist/{chunk-2BTRHVT3.cjs → chunk-K7YNEKVE.js} +5 -4
  82. package/dist/chunk-KCHPADCH.cjs +7 -0
  83. package/dist/chunk-KH7LM52S.js +3 -0
  84. package/dist/chunk-LEBM6ZSZ.cjs +10 -0
  85. package/dist/chunk-LQ3YZTPU.cjs +15 -0
  86. package/dist/chunk-LY7N3UHH.cjs +23 -0
  87. package/dist/chunk-M6ESQ5TE.cjs +56 -0
  88. package/dist/chunk-MCZ3YZ2L.js +2 -0
  89. package/dist/chunk-MP5VC5ER.cjs +1 -0
  90. package/dist/chunk-MVX2PYJJ.cjs +1 -0
  91. package/dist/chunk-MY42EWZP.js +2 -0
  92. package/dist/chunk-MZOWPV4D.js +20 -0
  93. package/dist/chunk-NGNJSUGL.cjs +1 -0
  94. package/dist/chunk-NWCREF47.js +3 -0
  95. package/dist/chunk-OMWQVPV7.js +14 -0
  96. package/dist/chunk-ORG67NXX.js +3 -0
  97. package/dist/chunk-OSAVAYJZ.js +16 -0
  98. package/dist/chunk-P7XYIKL6.cjs +300 -0
  99. package/dist/chunk-PBOZJOKN.js +2 -0
  100. package/dist/chunk-PITMDQYN.cjs +18 -0
  101. package/dist/chunk-PL5AIE6F.js +2 -0
  102. package/dist/chunk-QC4YXUBT.cjs +383 -0
  103. package/dist/chunk-QDHP5E4P.cjs +2 -0
  104. package/dist/chunk-QYI3GOHF.cjs +1 -0
  105. package/dist/chunk-R3NEPC4I.js +3 -0
  106. package/dist/chunk-R4LXRAMX.js +2 -0
  107. package/dist/chunk-S5HTTLN7.cjs +2 -0
  108. package/dist/chunk-STX5V7HG.cjs +20 -0
  109. package/dist/chunk-SVYUTQVE.js +115 -0
  110. package/dist/chunk-SYEP5QLG.js +19 -0
  111. package/dist/chunk-TR3ZS3T3.js +3 -0
  112. package/dist/chunk-UB5TJHQR.js +2 -0
  113. package/dist/chunk-UD6ZPO7T.js +2 -0
  114. package/dist/chunk-UK43ADRO.js +270 -0
  115. package/dist/chunk-UNYXWPLZ.cjs +2 -0
  116. package/dist/chunk-VBPAAQEF.js +2 -0
  117. package/dist/chunk-VIUU4D5I.js +2 -0
  118. package/dist/chunk-VJ2WMKPK.js +21 -0
  119. package/dist/chunk-VOQUO2EZ.cjs +74 -0
  120. package/dist/chunk-VQ53TFYA.cjs +1 -0
  121. package/dist/chunk-VRZC4TTF.cjs +1 -0
  122. package/dist/chunk-W46LZ4MY.js +2 -0
  123. package/dist/chunk-WCFHS7EZ.cjs +1 -0
  124. package/dist/chunk-WGESLAWV.js +8 -0
  125. package/dist/chunk-WSP7PSXC.js +8 -0
  126. package/dist/chunk-X54XZACS.cjs +10 -0
  127. package/dist/{chunk-Q2UYCYKV.js → chunk-XBH4YMC7.js} +5 -4
  128. package/dist/chunk-XDE7CFV6.cjs +19 -0
  129. package/dist/chunk-XOACKBG7.js +4 -0
  130. package/dist/chunk-XPPVX4GQ.cjs +1 -0
  131. package/dist/chunk-ZJE3VAAW.js +134 -0
  132. package/dist/chunk-ZO3YB5DK.cjs +1 -0
  133. package/dist/chunk-ZOVH6QT5.cjs +1 -0
  134. package/dist/chunk-ZYDOF65Q.cjs +1 -0
  135. package/dist/cli/index.cjs +197 -78
  136. package/dist/cli/index.js +198 -78
  137. package/dist/client.cjs +1 -1
  138. package/dist/client.d.cts +1 -1
  139. package/dist/client.d.ts +1 -1
  140. package/dist/client.js +2 -1
  141. package/dist/d1-5ZQJOFDX.cjs +1 -0
  142. package/dist/d1-VPH75GI2.js +2 -0
  143. package/dist/dist-es-3SSNUZST.cjs +1 -0
  144. package/dist/dist-es-6SVFVYN3.js +1 -0
  145. package/dist/dist-es-6TQTDPE7.js +2 -0
  146. package/dist/dist-es-A5OF2STN.cjs +2 -0
  147. package/dist/dist-es-BOW5V247.cjs +6 -0
  148. package/dist/dist-es-CRIMATLL.cjs +2 -0
  149. package/dist/dist-es-DL3VLVP6.cjs +1 -0
  150. package/dist/dist-es-EMUQ6ZNZ.js +3 -0
  151. package/dist/dist-es-MNIQZC4U.js +2 -0
  152. package/dist/dist-es-P25IKLBI.cjs +1 -0
  153. package/dist/dist-es-SJ76GYCI.js +2 -0
  154. package/dist/dist-es-SRPWSAF4.cjs +1 -0
  155. package/dist/dist-es-T2H2W5BX.cjs +3 -0
  156. package/dist/dist-es-TX4DBXEW.js +3 -0
  157. package/dist/dist-es-U4ZB3ZDA.js +7 -0
  158. package/dist/dist-es-XZBHIIKY.js +4 -0
  159. package/dist/drizzle/index.cjs +1 -1
  160. package/dist/drizzle/index.d.cts +2 -2
  161. package/dist/drizzle/index.d.ts +2 -2
  162. package/dist/drizzle/index.js +1 -1
  163. package/dist/drizzle-orm-47ELDEM6.cjs +1 -0
  164. package/dist/drizzle-orm-7YTX5NTT.js +1 -0
  165. package/dist/event-streams-25YJ2Z6R.js +1 -0
  166. package/dist/event-streams-JBMWCI2O.cjs +1 -0
  167. package/dist/fields/index.cjs +1 -1
  168. package/dist/fields/index.js +1 -1
  169. package/dist/fs-DGKZLRM6.cjs +1 -0
  170. package/dist/fs-YZJ5FM6J.js +2 -0
  171. package/dist/graphql/index.cjs +1 -1
  172. package/dist/graphql/index.d.cts +2 -2
  173. package/dist/graphql/index.d.ts +2 -2
  174. package/dist/graphql/index.js +1 -1
  175. package/dist/{index-DTz6u7w9.d.cts → index-BJ1rwHxk.d.cts} +1 -1
  176. package/dist/{index-BeQtbl3z.d.ts → index-BTjlptCL.d.ts} +1 -1
  177. package/dist/index.cjs +28 -46
  178. package/dist/index.d.cts +23 -9
  179. package/dist/index.d.ts +23 -9
  180. package/dist/index.js +29 -46
  181. package/dist/integration.cjs +1 -1
  182. package/dist/integration.js +1 -1
  183. package/dist/jsonwebtoken-DFB6ZBZA.cjs +8 -0
  184. package/dist/jsonwebtoken-S7BG2YWK.js +9 -0
  185. package/dist/lib-5QYYN6ML.cjs +12 -0
  186. package/dist/lib-IYW32OER.js +13 -0
  187. package/dist/loadSso-JY4WDQPS.cjs +2 -0
  188. package/dist/loadSso-YTG2GQGW.js +3 -0
  189. package/dist/local-VDCSEMC2.js +1 -0
  190. package/dist/local-YCWBUF3R.cjs +1 -0
  191. package/dist/media-3Z6YW5J4.cjs +1 -0
  192. package/dist/media-HK2IZMUZ.js +1 -0
  193. package/dist/mongo-auth-adapter-7K64Y2QM.cjs +1 -0
  194. package/dist/mongo-auth-adapter-BUKINEZL.js +1 -0
  195. package/dist/mongodb/index.cjs +1 -1
  196. package/dist/mongodb/index.d.cts +2 -2
  197. package/dist/mongodb/index.d.ts +2 -2
  198. package/dist/mongodb/index.js +1 -1
  199. package/dist/nodemailer-AXROO37D.js +54 -0
  200. package/dist/nodemailer-IDML4L6W.cjs +53 -0
  201. package/dist/postgres-auth-adapter-2M4RNEY3.cjs +1 -0
  202. package/dist/postgres-auth-adapter-MKSHIJDL.js +1 -0
  203. package/dist/postgres-js-3Y54EXVQ.cjs +1 -0
  204. package/dist/postgres-js-INQPBHJP.js +1 -0
  205. package/dist/redis-adapter-EGMUN65D.cjs +1 -0
  206. package/dist/redis-adapter-SXOXLHNH.js +1 -0
  207. package/dist/rest/index.cjs +1 -1
  208. package/dist/rest/index.d.cts +5 -5
  209. package/dist/rest/index.d.ts +5 -5
  210. package/dist/rest/index.js +1 -1
  211. package/dist/schema-RT6WSUYC.cjs +1 -0
  212. package/dist/schema-XC5ISGNR.js +2 -0
  213. package/dist/signin-KZBIAHGS.js +3 -0
  214. package/dist/signin-VFBLX7EL.cjs +2 -0
  215. package/dist/sqlite-adapter-DV7ZX2EJ.js +1 -0
  216. package/dist/sqlite-adapter-ZTABLT2X.cjs +1 -0
  217. package/dist/src-6LAUXXDM.cjs +1 -0
  218. package/dist/src-GZRZ4VAO.js +1 -0
  219. package/dist/sso-oidc-54BIRYR6.cjs +2 -0
  220. package/dist/sso-oidc-SX5OIQGG.js +3 -0
  221. package/dist/sts-HVGDJYIF.js +3 -0
  222. package/dist/sts-YLXXIB3X.cjs +2 -0
  223. package/dist/templates/index.cjs +1 -1
  224. package/dist/templates/index.d.cts +1 -1
  225. package/dist/templates/index.d.ts +1 -1
  226. package/dist/templates/index.js +1 -1
  227. package/dist/trpc/index.cjs +1 -1
  228. package/dist/trpc/index.d.cts +7 -7
  229. package/dist/trpc/index.d.ts +7 -7
  230. package/dist/trpc/index.js +1 -1
  231. package/dist/{types-CaXXmV9h.d.ts → types-CYGXsNcJ.d.ts} +5 -5
  232. package/dist/{types-BjivdGbU.d.cts → types-DOKMyC3y.d.cts} +5 -5
  233. package/dist/ws/index.cjs +1 -1
  234. package/dist/ws/index.js +1 -1
  235. package/package.json +2 -2
  236. package/dist/bootstrap-ROSTPMVL.js +0 -1
  237. package/dist/bootstrap-WW5NJ6EB.cjs +0 -1
  238. package/dist/chunk-3CVLI5C5.cjs +0 -3
  239. package/dist/chunk-3Q2WUG63.cjs +0 -2
  240. package/dist/chunk-3RSMK4DA.cjs +0 -2
  241. package/dist/chunk-4IGWJMBY.cjs +0 -2
  242. package/dist/chunk-4ORJMSJU.cjs +0 -1
  243. package/dist/chunk-4RMFCTWH.js +0 -1
  244. package/dist/chunk-5B6X2GBJ.js +0 -2
  245. package/dist/chunk-5J6HXUF6.js +0 -1
  246. package/dist/chunk-5KOQYQEE.js +0 -1
  247. package/dist/chunk-5SEHX7ON.js +0 -1
  248. package/dist/chunk-6ROHVUXF.js +0 -1
  249. package/dist/chunk-6SPPR5JZ.js +0 -3
  250. package/dist/chunk-7IVN6TTY.js +0 -133
  251. package/dist/chunk-AHSFSERC.cjs +0 -1
  252. package/dist/chunk-B5XWYVWK.js +0 -1
  253. package/dist/chunk-BGX27ZRG.cjs +0 -300
  254. package/dist/chunk-C2W5PSHC.js +0 -300
  255. package/dist/chunk-CCUQZ66T.cjs +0 -133
  256. package/dist/chunk-D5P2IPGX.cjs +0 -3
  257. package/dist/chunk-EPMGPNBE.js +0 -1
  258. package/dist/chunk-FHJJKFAU.cjs +0 -1
  259. package/dist/chunk-FVZ5RFLO.js +0 -2
  260. package/dist/chunk-FZ6Q2EBJ.cjs +0 -20
  261. package/dist/chunk-G3J2EU5D.cjs +0 -1
  262. package/dist/chunk-G7SSHELM.cjs +0 -1
  263. package/dist/chunk-GKYEJ2UF.js +0 -1
  264. package/dist/chunk-GO34AOBZ.cjs +0 -1
  265. package/dist/chunk-GYQMNXXW.cjs +0 -114
  266. package/dist/chunk-HLSB2MCK.js +0 -1
  267. package/dist/chunk-HQP2Y7QQ.js +0 -251
  268. package/dist/chunk-HS2KNFAB.cjs +0 -2
  269. package/dist/chunk-HVXO3OFB.cjs +0 -1
  270. package/dist/chunk-IETGL7WJ.js +0 -1
  271. package/dist/chunk-IFJ73O3A.cjs +0 -1
  272. package/dist/chunk-ILEZ3NYX.cjs +0 -2
  273. package/dist/chunk-INB4LNA6.js +0 -90
  274. package/dist/chunk-K6WUOU6P.js +0 -1
  275. package/dist/chunk-KD7LUCFY.cjs +0 -1
  276. package/dist/chunk-KDNYHLD2.js +0 -1
  277. package/dist/chunk-LHW4R367.js +0 -1
  278. package/dist/chunk-MIOMMB23.cjs +0 -1
  279. package/dist/chunk-N5VNHUJS.cjs +0 -4
  280. package/dist/chunk-NRLIGDYF.js +0 -1
  281. package/dist/chunk-NY47CFVP.cjs +0 -1
  282. package/dist/chunk-NZJAGASC.cjs +0 -251
  283. package/dist/chunk-OG7CNQGU.js +0 -1
  284. package/dist/chunk-PP5S2UBV.js +0 -0
  285. package/dist/chunk-PP7W5UKL.js +0 -2
  286. package/dist/chunk-Q3Q7BJVQ.cjs +0 -1
  287. package/dist/chunk-QCA3AP3M.cjs +0 -1
  288. package/dist/chunk-QOCHBPMK.js +0 -2
  289. package/dist/chunk-QYFU5Y7S.js +0 -3
  290. package/dist/chunk-RHCWCG3O.js +0 -114
  291. package/dist/chunk-SK2Q4PRV.cjs +0 -90
  292. package/dist/chunk-TFBHE5FF.cjs +0 -1
  293. package/dist/chunk-UBRYJP2G.js +0 -1
  294. package/dist/chunk-V65NPSR5.cjs +0 -1
  295. package/dist/chunk-VGQ4VUG6.js +0 -2
  296. package/dist/chunk-W7C6SJXZ.js +0 -20
  297. package/dist/chunk-WIZ6C5QZ.cjs +0 -1
  298. package/dist/chunk-ZIWJJRWQ.js +0 -4
  299. package/dist/chunk-ZUVP4UK7.cjs +0 -1
  300. package/dist/media-L5XDD47D.js +0 -1
  301. package/dist/media-OUBQTIQP.cjs +0 -1
  302. package/dist/mongo-auth-adapter-5TJO5J5U.js +0 -1
  303. package/dist/mongo-auth-adapter-JVE5M3S4.cjs +0 -1
  304. package/dist/postgres-auth-adapter-33QOIRXT.js +0 -1
  305. package/dist/postgres-auth-adapter-JKDYYULH.cjs +0 -1
  306. package/dist/redis-adapter-NN3H4GRX.js +0 -1
  307. package/dist/redis-adapter-OUKQGYCH.cjs +0 -1
  308. package/dist/schema-HIUSHSUI.cjs +0 -1
  309. package/dist/schema-KFYUM674.js +0 -1
  310. package/dist/sqlite-adapter-GTTVSXRV.cjs +0 -1
  311. package/dist/sqlite-adapter-UPANATIW.js +0 -1
@@ -1,2 +0,0 @@
1
- import {a,c,b,d}from'./chunk-5KOQYQEE.js';import {a as a$1}from'./chunk-6SPPR5JZ.js';import {a as a$2}from'./chunk-4RMFCTWH.js';import {randomBytes}from'crypto';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{o=(await import('mongodb')).MongoClient;}catch{a$1(["mongodb"]),o=(await import('mongodb')).MongoClient;}this.client=new o(this.connectionString),await this.client.connect();}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)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:d$1}=o,l=this.getCollectionConfig(e),f=this.getMongoCollection(e),g={...n};this.tenantContext&&l.tenantScoped&&(g=c({where:g},e,this.tenantContext,b).where||{});let u=this.buildFilter(g,l.tenantScoped?r:void 0),c$1=l.fields.find(p=>p.name==="status"),h=c$1?.type==="select"&&Array.isArray(c$1.options)&&c$1.options.some(p=>p.value==="published");!d$1&&h&&(u.status="published");let y=this.parseSort(s),R={[y.field]:y.direction==="asc"?1:-1},O=(i-1)*t,[$,x]=await Promise.all([f.find(u).sort(R).skip(O).limit(t).project(this.buildProjection(a)).toArray(),f.countDocuments(u)]),C=$.map(p=>this.processResult(p,l));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(C=C.filter(p=>d(p,e,this.tenantContext,b))),d$1&&(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 M=typeof m.data=="string"?JSON.parse(m.data):m.data&&typeof m.data=="object"?m.data:{};return {...p,...M,status:p.status}}return p}))),{docs:C,...this.calculatePagination(i,t,x)}}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 d$1=i.fields.find(u=>u.name==="status"),l=d$1?.type==="select"&&Array.isArray(d$1.options)&&d$1.options.some(u=>u.value==="published");!t&&l&&(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 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 d={...r,_id:a};return s&&t.tenantScoped&&(d.tenantId=s),await i.insertOne(d),this.processResult(d,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 d=this.prepareData(s,i),l=await r.findOneAndUpdate(a,{$set:d},{returnDocument:"after"});if(!l)throw new Error(`Document not found: ${e}/${n}`);return this.processResult(l,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),d=i.fields.find(u=>u.name==="status"),l=d?.type==="select"&&Array.isArray(d.options)&&d.options.some(u=>u.value==="published");!t&&l&&(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),d=this.getMongoCollection(`${e}_versions`),l={document_id:n,autosave:{$ne:true}};r&&a.tenantScoped&&(l.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([d.find(l).sort(u).skip(f).limit(t).toArray(),d.countDocuments(l)]);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:d}=o,l=this.getCollectionConfig(e),f=this.getMongoCollection(`${e}_versions`);if(d){let c={document_id:n,collection_slug:e,autosave:true};a&&l.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:d===true,created_by:i,change_description:r,createdAt:g,updatedAt:g};if(a&&l.tenantScoped&&(u.tenant_id=a),await f.insertOne(u),!d){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 l=(await r.find(a).sort({createdAt:-1}).limit(s).project({_id:1}).toArray()).map(f=>f._id);l.length>0&&await r.deleteMany({document_id:n,autosave:{$ne:true},_id:{$nin:l},...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 T(b){return new A(b)}
2
- export{A as a,T as b};
@@ -1,20 +0,0 @@
1
- import a from'path';import h from'fs';var c=r=>{let s=typeof process<"u"&&process.cwd?a.join(process.cwd(),"node_modules","@kyro-cms","core","dist"):"",e=a.resolve(s,`${r}.ts`),o=a.resolve(s,`${r}.js`);return h.existsSync(e)?e:o},b=c("api-handler"),S=c("api-handler-graphql"),g=c("api-handler-trpc");function _(r={}){let{configPath:s="./kyro.config.ts",apiPath:e="/api",adminPath:o="/admin",admin:k=true,enableGraphQL:l=false,enableTRPC:p=false,enableWebSocket:m=false}=r;return {name:"@kyro-cms/core",hooks:{"astro:config:setup":async({config:f,updateConfig:u,injectRoute:i,logger:n})=>{if(n.info(`Setting up Kyro CMS (API: ${e}, Admin: ${o})`),e===o)throw new Error(`Kyro CMS: apiPath and adminPath cannot be the same ("${e}")`);let d=a.resolve(f.root.pathname,s),y=d;h.existsSync(d)||n.warn(`Kyro config file not found at ${s}. The API will fail to boot if collections are needed.`),u({security:{checkOrigin:false},vite:{ssr:{external:["@kyro-cms/core","@kyro-cms/admin","@kyro-cms/astro","@kyro-cms/ai","@kyro-cms/connect","crypto","node:crypto","module","node:module","fs","node:fs","fs/promises","node:fs/promises","path","node:path","util","node:util","stream","node:stream","events","node:events","url","node:url","http","node:http","https","node:https","os","node:os","child_process","node:child_process","assert","node:assert","zlib","node:zlib","buffer","node:buffer","better-sqlite3","pg","mongodb","ioredis","sharp","ssh2","cpu-features","ssh2-sftp-client","nodemailer","jsonwebtoken","@mapbox/node-pre-gyp","mock-aws-s3","aws-sdk","nock"]},build:{rollupOptions:{external:["@kyro-cms/core","@kyro-cms/admin","@kyro-cms/astro","@kyro-cms/ai","@kyro-cms/connect","better-sqlite3","pg","mongodb","ioredis","sharp","ssh2","cpu-features","ssh2-sftp-client","nodemailer","jsonwebtoken","@mapbox/node-pre-gyp","mock-aws-s3","aws-sdk","nock"]}},optimizeDeps:{exclude:["@kyro-cms/core","@kyro-cms/admin","@kyro-cms/astro","@kyro-cms/ai","@kyro-cms/connect","better-sqlite3","pg","mongodb","ioredis","sharp","ssh2","cpu-features","ssh2-sftp-client","nodemailer","jsonwebtoken","@mapbox/node-pre-gyp","mock-aws-s3","aws-sdk","nock"]},server:{watch:{ignored:["**/*.db","**/*.db-*","**/data/**","**/public/uploads/**","**/.kyro/**"]}},plugins:[{name:"use-sync-external-store-shim-fix",enforce:"pre",resolveId(t){if(t==="use-sync-external-store/shim"||t==="use-sync-external-store/shim/index.js")return "\0virtual:use-sync-external-store-shim";if(t==="use-sync-external-store/shim/with-selector"||t==="use-sync-external-store/shim/with-selector.js")return "\0virtual:use-sync-external-store-shim-with-selector"},load(t){if(t==="\0virtual:use-sync-external-store-shim")return 'export { useSyncExternalStore } from "react";';if(t==="\0virtual:use-sync-external-store-shim-with-selector")return `
2
- import { useSyncExternalStore, useMemo } from "react";
3
- export function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
4
- const memoizedSelector = useMemo(() => {
5
- let last, lastSnap, hasMemo = false;
6
- return (snap) => {
7
- if (!hasMemo || !Object.is(lastSnap, snap)) {
8
- const next = selector(snap);
9
- if (!hasMemo || !(isEqual ? isEqual(last, next) : Object.is(last, next))) {
10
- last = next; lastSnap = snap; hasMemo = true;
11
- }
12
- }
13
- return last;
14
- };
15
- }, [selector, isEqual]);
16
- const getSelection = () => memoizedSelector(getSnapshot());
17
- const getServerSelection = getServerSnapshot != null ? () => memoizedSelector(getServerSnapshot()) : undefined;
18
- return useSyncExternalStore(subscribe, getSelection, getServerSelection);
19
- }
20
- `}}],resolve:{alias:{"kyro:config":y}},define:{__KYRO_API_PATH__:JSON.stringify(e),__KYRO_ADMIN_PATH__:JSON.stringify(o),__KYRO_ENABLE_GRAPHQL__:JSON.stringify(l),__KYRO_ENABLE_TRPC__:JSON.stringify(p),__KYRO_ENABLE_WS__:JSON.stringify(m)}}}),i({pattern:`${e}/[...path]`,entrypoint:b}),l&&(i({pattern:`${e}/graphql`,entrypoint:S}),n.info(`GraphQL endpoint enabled at ${e}/graphql`)),p&&(i({pattern:`${e}/trpc/[...path]`,entrypoint:g}),n.info(`tRPC endpoint enabled at ${e}/trpc`)),m&&n.info("WebSocket support enabled (auto-starts at first request)");}}}}export{_ as a};
@@ -1 +0,0 @@
1
- 'use strict';var pgCore=require('drizzle-orm/pg-core');var r=pgCore.pgTable("settings",{key:pgCore.varchar("key",{length:255}).primaryKey(),value:pgCore.text("value").notNull(),description:pgCore.text("description"),updatedAt:pgCore.timestamp("updated_at").defaultNow()});exports.a=r;
@@ -1,4 +0,0 @@
1
- import {a as a$2}from'./chunk-5B6X2GBJ.js';import {a as a$1}from'./chunk-5SEHX7ON.js';import {a as a$4,i}from'./chunk-LHW4R367.js';import {c as c$2,a as a$3}from'./chunk-PP7W5UKL.js';import {a,b as b$1,c,f,u as u$1}from'./chunk-HQP2Y7QQ.js';import {o,f as f$1,g as g$1}from'./chunk-FVZ5RFLO.js';import {d as d$1,f as f$2,e,g as g$2}from'./chunk-HLSB2MCK.js';import {b as b$2,d as d$2}from'./chunk-GKYEJ2UF.js';import {c as c$1}from'./chunk-7IVN6TTY.js';import {g}from'./chunk-OG7CNQGU.js';import {z as z$1}from'zod';import {createYoga}from'graphql-yoga';function T(s,e){for(let t of s){if(t.name===e)return true;if("tabs"in t&&t.tabs){for(let i of t.tabs)if(T(i.fields,e))return true}if("fields"in t&&t.fields&&T(t.fields,e))return true}return false}var K=class extends Error{errors;constructor(e){super(`Configuration validation failed:
2
- ${e.join(`
3
- `)}`),this.name="ConfigValidationError",this.errors=e;}};function I(s){let e=[];if(s.slug?/^[a-z][a-z0-9_-]*$/.test(s.slug)||e.push(`Collection slug "${s.slug}" must be lowercase alphanumeric with dashes`):e.push('Collection is missing a "slug" property'),!s.fields||s.fields.length===0)e.push(`Collection "${s.slug}" has no fields defined`);else {let t=m(s.fields,s.slug);e.push(...t);}if(s.access)for(let[t,i]of Object.entries(s.access))typeof i!="boolean"&&typeof i!="function"&&e.push(`Collection "${s.slug}" has invalid access.${t} (must be boolean or function)`);if(s.admin?.useAsTitle&&(T(s.fields,s.admin.useAsTitle)||e.push(`Collection "${s.slug}" admin.useAsTitle references unknown field "${s.admin.useAsTitle}"`)),s.admin?.defaultColumns)for(let t of s.admin.defaultColumns)T(s.fields,t)||e.push(`Collection "${s.slug}" admin.defaultColumns references unknown field "${t}"`);if(s.upload&&s.upload.fileSize&&s.upload.fileSize<=0&&e.push(`Collection "${s.slug}" upload.fileSize must be positive`),s.versions&&s.versions.maxPerDoc&&s.versions.maxPerDoc<=0&&e.push(`Collection "${s.slug}" versions.maxPerDoc must be positive`),s.auth){let t=s.fields.some(o=>o.name==="email"),i=s.fields.some(o=>o.name==="password");t||e.push(`Collection "${s.slug}" with auth enabled requires an "email" field`),i||e.push(`Collection "${s.slug}" with auth enabled requires a "password" field`);}return e}function D(s){let e=[];if(s.slug?/^[a-z][a-z0-9_-]*$/.test(s.slug)||e.push(`Global slug "${s.slug}" must be lowercase alphanumeric with dashes`):e.push('Global is missing a "slug" property'),!s.fields||s.fields.length===0)e.push(`Global "${s.slug}" has no fields defined`);else {let t=m(s.fields,`global:${s.slug}`);e.push(...t);}return e}function m(s,e){let t=[],i=new Set;for(let o=0;o<s.length;o++){let n=s[o];if(n.type==="row"||n.type==="collapsible"||n.type==="tabs"){if("fields"in n&&n.fields){let l=m(n.fields,e);t.push(...l);}else if("tabs"in n)for(let l of n.tabs){let c=m(l.fields,e);t.push(...c);}continue}let a=n.name;if(!a){t.push(`${e}: Field at index ${o} is missing a "name" property`);continue}if(i.has(a)&&t.push(`${e}: Duplicate field name "${a}"`),i.add(a),/^[a-zA-Z][a-zA-Z0-9_]*$/.test(a)||t.push(`${e}: Field name "${a}" must be alphanumeric with underscores`),!n.type){t.push(`${e}: Field "${a}" is missing a "type" property`);continue}switch(n.type){case "relationship":n.relationTo||t.push(`${e}: Relationship field "${a}" is missing "relationTo"`);break;case "array":if(!n.fields||n.fields.length===0)t.push(`${e}: Array field "${a}" has no fields defined`);else {let l=m(n.fields,`${e}.${a}`);t.push(...l);}break;case "group":if(!n.fields||n.fields.length===0)t.push(`${e}: Group field "${a}" has no fields defined`);else {let l=m(n.fields,`${e}.${a}`);t.push(...l);}break;case "blocks":if(!n.blocks||n.blocks.length===0)t.push(`${e}: Blocks field "${a}" has no blocks defined`);else {let l=Ae(n.blocks,`${e}.${a}`);t.push(...l);}break;case "select":case "radio":if(typeof n.options=="function")break;if((!n.options||n.options.length===0)&&!n.dynamicOptions)t.push(`${e}: ${n.type} field "${a}" has no options defined`);else if(Array.isArray(n.options)){let l=n.options.map(f=>f.value),c=new Set(l);l.length!==c.size&&t.push(`${e}: ${n.type} field "${a}" has duplicate option values`);}break;case "upload":n.relationTo||t.push(`${e}: Upload field "${a}" is missing "relationTo"`);break}"min"in n&&"max"in n&&n.min>n.max&&t.push(`${e}: Field "${a}" has min greater than max`),"minLength"in n&&"maxLength"in n&&n.minLength>n.maxLength&&t.push(`${e}: Field "${a}" has minLength greater than maxLength`),"minRows"in n&&"maxRows"in n&&n.minRows>n.maxRows&&t.push(`${e}: Field "${a}" has minRows greater than maxRows`);}return t}function Ae(s,e){let t=[],i=new Set;for(let o of s){if(!o.slug){t.push(`${e}: Block is missing a "slug" property`);continue}if(i.has(o.slug)&&t.push(`${e}: Duplicate block slug "${o.slug}"`),i.add(o.slug),o.label||t.push(`${e}: Block "${o.slug}" is missing a "label" property`),!o.fields||o.fields.length===0)t.push(`${e}: Block "${o.slug}" has no fields defined`);else {let n=m(o.fields,`${e}.${o.slug}`);t.push(...n);}}return t}function de(s,e=[]){let t=[],i=new Set;for(let o of s)i.has(o.slug)&&t.push(`Duplicate collection slug "${o.slug}"`),i.add(o.slug);for(let o of e)i.has(o.slug)&&t.push(`Duplicate global slug "${o.slug}"`),i.add(o.slug);for(let o of s){let n=I(o);t.push(...n);}for(let o of e){let n=D(o);t.push(...n);}for(let o of s){let n=S(o.fields,s);t.push(...n);}if(t.length>0)throw new K(t)}function S(s,e){let t=[],i=new Set(e.map(o=>o.slug));for(let o of s){if(o.type==="relationship"){let n=Array.isArray(o.relationTo)?o.relationTo:[o.relationTo];for(let a of n)a!=="*"&&!i.has(a)&&console.warn(`[Kyro Config Warning]: Relationship field "${o.name}" references unknown collection "${a}". Select options will not be available until this collection is registered.`);}if(o.type==="upload"){let n=Array.isArray(o.relationTo)?o.relationTo:[o.relationTo];for(let a of n)i.has(a)||t.push(`Upload field "${o.name}" references unknown collection "${a}"`);}if("fields"in o&&o.fields){let n=S(o.fields,e);t.push(...n);}if("tabs"in o)for(let n of o.tabs){let a=S(n.fields,e);t.push(...a);}if("blocks"in o)for(let n of o.blocks){let a=S(n.fields,e);t.push(...a);}}return t}function u(s){switch(s.type){case "text":return Se(s);case "number":return Te(s);case "checkbox":return ke(s);case "date":return Re(s);case "email":return Pe(s);case "password":return Fe(s);case "textarea":return Ze(s);case "select":return je(s);case "radio":return $e(s);case "color":return qe(s);case "richtext":return Ee(s);case "json":return Ke(s);case "code":return Ie(s);case "upload":return ue(s);case "image":return ue(s);case "markdown":return De(s);case "relationship":return pe(s);case "relationship-block":return pe(s);case "array":return Oe(s);case "list":return Ge(s);case "group":return Ne(s);case "blocks":return Ue(s);case "row":return Le(s);case "collapsible":return ze(s);case "tabs":return _e(s);default:return z$1.any()}}function Se(s){let e=z$1.string();return s.minLength&&(e=e.min(s.minLength)),s.maxLength&&(e=e.max(s.maxLength)),s.pattern&&(e=e.regex(new RegExp(s.pattern))),s.variant==="email"&&(e=e.email()),s.variant==="url"&&(e=e.url()),s.hasMany&&(e=z$1.array(e)),s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Te(s){let e=s.integer?z$1.coerce.number().int():z$1.coerce.number();return s.min!==void 0&&(e=e.min(s.min)),s.max!==void 0&&(e=e.max(s.max)),s.step&&(e=e.refine(t=>Number.isInteger(t/s.step),`Value must be divisible by ${s.step}`)),s.hasMany&&(e=z$1.array(e)),s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function ke(s){let e=z$1.boolean();return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Re(s){let e=z$1.string().refine(t=>!isNaN(Date.parse(t)),"Invalid date format");return s.minDate&&(e=e.refine(t=>new Date(t)>=new Date(s.minDate),`Date must be after ${s.minDate}`)),s.maxDate&&(e=e.refine(t=>new Date(t)<=new Date(s.maxDate),`Date must be before ${s.maxDate}`)),s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Pe(s){let e=z$1.string().email("Invalid email");return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Fe(s){let e=z$1.string().min(6,"Password must be at least 6 characters");return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Ze(s){let e=z$1.string();return s.minLength&&(e=e.min(s.minLength)),s.maxLength&&(e=e.max(s.maxLength)),s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function je(s){let e;if(Array.isArray(s.options)&&s.options.length>0){let t=s.options.map(i=>i.value);s.hasMany?e=z$1.array(z$1.enum(t)):e=z$1.enum(t);}else e=s.hasMany?z$1.array(z$1.string()):z$1.string();return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function $e(s){let e;if(Array.isArray(s.options)&&s.options.length>0){let t=s.options.map(i=>i.value);e=z$1.enum(t);}else e=z$1.string();return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function qe(s){let e=z$1.string();return s.format==="hex"&&(e=e.regex(/^#[0-9A-Fa-f]{6}$/)),s.format==="rgb"&&(e=e.regex(/^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/)),s.format==="hsl"&&(e=e.regex(/^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/)),s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Ee(s){let e=z$1.array(z$1.record(z$1.any()));return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Ke(s){let e=z$1.union([z$1.record(z$1.any()),z$1.array(z$1.any())]);return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Ie(s){let e=z$1.string();return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function ue(s){let e;if(s.relationTo){let t=z$1.object({id:z$1.string(),url:z$1.string().optional(),filename:z$1.string().optional(),mimeType:z$1.string().optional()});e=z$1.union([z$1.string(),t]);}else e=z$1.string();return s.hasMany&&(e=z$1.array(e)),s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function De(s){let e=z$1.string();return s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function pe(s){let e;return Array.isArray(s.relationTo)?e=z$1.object({relationTo:z$1.enum(s.relationTo),value:z$1.string()}):e=z$1.union([z$1.string(),z$1.object({relationTo:z$1.string(),value:z$1.string()})]),s.hasMany&&(e=z$1.array(e)),s.required||(e=e.optional().nullable()),s.validate&&(e=d(e,s.validate)),e}function Oe(s){let e=z$1.object(Object.fromEntries(s.fields.filter(i=>i.name).map(i=>[i.name,u(i)]))).passthrough(),t=z$1.array(e);return s.minRows&&(t=t.min(s.minRows)),s.maxRows&&(t=t.max(s.maxRows)),s.required||(t=t.optional().nullable()),s.validate&&(t=d(t,s.validate)),t}function Ge(s){let e=z$1.array(z$1.string());return s.required||(e=e.optional().nullable()),e}function Ne(s){let e=z$1.object(Object.fromEntries(s.fields.filter(t=>t.name).map(t=>[t.name,u(t)])));return s.required?e:e.optional().nullable()}function Ue(s){let e=s.blocks||[];e.map(n=>z$1.object({blockType:z$1.literal(n.slug),...Object.fromEntries(n.fields.filter(a=>a.name).map(a=>[a.name,u(a)]))}));let i=e.map(n=>n.slug),o;if(i.length>0){let n=z$1.object({blockType:z$1.enum(i)}).catchall(z$1.any()),a=z$1.object({blockType:z$1.string()}).catchall(z$1.any());o=z$1.array(z$1.union([n,a,z$1.record(z$1.any())]));}else o=z$1.array(z$1.union([z$1.object({blockType:z$1.string()}).catchall(z$1.any()),z$1.record(z$1.any())]));return s.minRows&&(o=o.min(s.minRows)),s.maxRows&&(o=o.max(s.maxRows)),s.required||(o=o.optional().nullable()),s.validate&&(o=d(o,s.validate)),o}function Le(s){return z$1.object(Object.fromEntries(s.fields.filter(t=>t.name).map(t=>[t.name,u(t)])))}function ze(s){return z$1.object(Object.fromEntries(s.fields.filter(t=>t.name).map(t=>[t.name,u(t)])))}function _e(s){let e={};for(let t of s.tabs)for(let i of t.fields)i.name&&(e[i.name]=u(i));return z$1.object(e).passthrough().optional()}function d(s,e){return s.refine(async t=>await e(t,{required:false})===true,{message:"Custom validation failed"})}function C(s){let e={};for(let t of s)if(t.type==="tabs"&&"tabs"in t){let i={};for(let o of t.tabs){let n=C(o.fields);Object.assign(i,n);}t.name?e[t.name]=z$1.object(i).passthrough().optional():Object.assign(e,i);}else if(t.type==="row"&&"fields"in t){let i=C(t.fields);t.name?e[t.name]=z$1.object(i).passthrough().optional():Object.assign(e,i);}else if(t.type==="collapsible"&&"fields"in t){let i=C(t.fields);t.name?e[t.name]=z$1.object(i).passthrough().optional():Object.assign(e,i);}else {if(!t.name)continue;e[t.name]=u(t);}return e}function y(s){let e={};for(let t of s)if(t.type==="tabs"&&"tabs"in t){let i={};for(let o of t.tabs){let n=y(o.fields);Object.assign(i,n);}t.name?e[t.name]=z$1.object(i).passthrough().optional().nullable():Object.assign(e,i);}else if(t.type==="row"&&"fields"in t){let i=y(t.fields);t.name?e[t.name]=z$1.object(i).passthrough().optional().nullable():Object.assign(e,i);}else if(t.type==="collapsible"&&"fields"in t){let i=y(t.fields);t.name?e[t.name]=z$1.object(i).passthrough().optional().nullable():Object.assign(e,i);}else if(t.type==="group"&&"fields"in t)t.name?e[t.name]=z$1.object(y(t.fields)).passthrough().optional().nullable():Object.assign(e,y(t.fields));else {if(!t.name)continue;e[t.name]=u(t).optional().nullable();}return e}function fe(s){let e=C(s.fields);return s.timestamps&&(e.createdAt=z$1.string().optional(),e.updatedAt=z$1.string().optional()),s.tenantScoped&&(e.tenantId=z$1.string().optional()),e.id=z$1.string().optional(),z$1.object(e).passthrough()}function ye(s){let e=C(s.fields);return z$1.object(e).passthrough()}function ge(s){let e={};for(let t of s.fields)if(t.name)if(t.type==="tabs"&&"tabs"in t){let i={};for(let o of t.tabs)for(let n of o.fields)n.name&&(i[n.name]=u(n).optional().nullable());e[t.name]=z$1.object(i).optional().nullable();}else if(t.type==="row"&&"fields"in t){let i={};for(let o of t.fields)o.name&&(i[o.name]=u(o).optional().nullable());Object.assign(e,i);}else t.type==="collapsible"&&"fields"in t?e[t.name]=z$1.object(y(t.fields)).optional().nullable():t.type==="group"&&"fields"in t?e[t.name]=z$1.object(y(t.fields)).optional().nullable():e[t.name]=u(t).optional().nullable();return z$1.object(e).passthrough()}function he(s){let e={};for(let t of s.fields)t.name&&(e[t.name]=z$1.object({equals:z$1.any().optional(),not_equals:z$1.any().optional(),in:z$1.array(z$1.any()).optional(),not_in:z$1.array(z$1.any()).optional(),greater_than:z$1.number().optional(),greater_than_equal:z$1.number().optional(),less_than:z$1.number().optional(),less_than_equal:z$1.number().optional(),like:z$1.string().optional(),not_like:z$1.string().optional(),contains:z$1.string().optional(),exists:z$1.boolean().optional()}).optional());return e.AND=z$1.array(z$1.lazy(()=>z$1.object(e))).optional(),e.OR=z$1.array(z$1.lazy(()=>z$1.object(e))).optional(),z$1.object(e).optional()}function me(s){let e=C(s.fields);return e.id=z$1.string().optional(),z$1.object(e).passthrough()}function be(s){let e={};for(let t of s.fields)if(t.name)if(t.type==="tabs"&&"tabs"in t){let i={};for(let o of t.tabs)for(let n of o.fields)n.name&&(i[n.name]=u(n).optional().nullable());e[t.name]=z$1.object(i).optional().nullable();}else t.type==="collapsible"&&"fields"in t?e[t.name]=z$1.object(y(t.fields)).optional().nullable():t.type==="group"&&"fields"in t?e[t.name]=z$1.object(y(t.fields)).optional().nullable():e[t.name]=u(t).optional().nullable();return z$1.object(e).passthrough()}var w=class{storageProviders=f();collections=new Map;globals=new Map;plugins=[];schemaCache=new Map;initialized=false;addCollection(e){if(this.initialized)throw new Error("Cannot add collections after Registry has been initialized");if(this.collections.has(e.slug)){console.warn(`[Registry] Duplicate collection slug "${e.slug}" \u2014 skipping`);return}let t={...e,fields:[...e.fields]};for(let o of this.plugins){let n=o.extensions?.collections?.find(a=>a.slug===t.slug);n&&(t={...t,...n.config,fields:[...t.fields,...n.config.fields||[]]});}if(t.seo){let o=a$1(),n=t.fields.findIndex(a=>a.type==="tabs");if(n!==-1){let a=t.fields[n];t.fields[n]={...a,tabs:[...a.tabs,{label:"SEO Settings",fields:o.fields}]};}else t.fields.push(o);}t.fields=this.applyFieldDefaults(t);let i=I(t);if(i.length>0)throw new Error(`Invalid collection config: ${i.join(", ")}`);this.collections.set(t.slug,t),this.clearSchemaCache(t.slug);}addCollections(e){for(let t of e)this.addCollection(t);}getCollection(e){return this.collections.get(e)}getCollections(){return Array.from(this.collections.values())}getCollectionSlugs(){return Array.from(this.collections.keys())}hasCollection(e){return this.collections.has(e)}removeCollection(e){if(this.initialized)throw new Error("Cannot remove collections after Registry has been initialized");return this.clearSchemaCache(e),this.collections.delete(e)}addGlobal(e){if(this.initialized)throw new Error("Cannot add globals after Registry has been initialized");this._addGlobalUnsafe(e);}addGlobalPostInit(e){this.globals.has(e.slug)&&this.globals.delete(e.slug),this._addGlobalUnsafe(e);}_addGlobalUnsafe(e){if(this.globals.has(e.slug)){console.warn(`[Registry] Duplicate global slug "${e.slug}" \u2014 skipping`);return}let t=D(e);if(t.length>0)throw new Error(`Invalid global config: ${t.join(", ")}`);let i={...e};for(let o of this.plugins){let n=o.extensions?.globals?.find(a=>a.slug===i.slug);n&&(i={...i,...n.config,fields:[...i.fields||[],...n.config.fields||[]]});}this.globals.set(i.slug,i),this.clearSchemaCache(`global:${i.slug}`);}addGlobals(e){for(let t of e)this.addGlobal(t);}getGlobal(e){return this.globals.get(e)}getGlobals(){return Array.from(this.globals.values())}getGlobalSlugs(){return Array.from(this.globals.keys())}hasGlobal(e){return this.globals.has(e)}removeGlobal(e){if(this.initialized)throw new Error("Cannot remove globals after Registry has been initialized");return this.clearSchemaCache(`global:${e}`),this.globals.delete(e)}addPlugin(e){if(this.initialized)throw new Error("Cannot add plugins after Registry has been initialized");this.plugins.push(e);}getPlugins(){return [...this.plugins]}getZodSchema(e){let t=this.schemaCache.get(e);if(t)return t;let i=this.collections.get(e);if(i){let n=fe(i);return this.schemaCache.set(e,n),n}let o=this.globals.get(e);if(o){let n=me(o);return this.schemaCache.set(`global:${e}`,n),n}throw new Error(`No collection or global found with slug "${e}"`)}getCreateZodSchema(e){let t=`${e}:create`,i=this.schemaCache.get(t);if(i)return i;let o=this.collections.get(e);if(o){let n=ye(o);return this.schemaCache.set(t,n),n}throw new Error(`No collection found with slug "${e}"`)}getUpdateZodSchema(e){let t=`${e}:update`,i=this.schemaCache.get(t);if(i)return i;let o=this.collections.get(e);if(o){let a=ge(o);return this.schemaCache.set(t,a),a}let n=this.globals.get(e);if(n){let a=be(n);return this.schemaCache.set(`global:${e}:update`,a),a}throw new Error(`No collection or global found with slug "${e}"`)}getWhereZodSchema(e){let t=`${e}:where`,i=this.schemaCache.get(t);if(i)return i;let o=this.collections.get(e);if(o){let n=he(o);return this.schemaCache.set(t,n),n}throw new Error(`No collection found with slug "${e}"`)}getFieldZodSchema(e){return u(e)}clearSchemaCache(e){this.schemaCache.delete(e),this.schemaCache.delete(`${e}:create`),this.schemaCache.delete(`${e}:update`),this.schemaCache.delete(`${e}:where`);}applyFieldDefaults(e){let t=[...e.fields];return t.some(i=>i.name==="id")||t.unshift({name:"id",type:"text",admin:{readOnly:true,hidden:true}}),e.tenantScoped&&!t.some(i=>i.name==="tenantId")&&t.push({name:"tenantId",type:"text",required:true,admin:{readOnly:true,hidden:true}}),e.timestamps&&!t.some(i=>i.name==="createdAt")&&(t.push({name:"createdAt",type:"date",admin:{readOnly:true,hidden:true}}),t.push({name:"updatedAt",type:"date",admin:{readOnly:true,hidden:true}})),e.versions?.drafts&&!t.some(i=>i.name==="status")&&t.push({name:"status",type:"select",options:[{value:"draft",label:"Draft"},{value:"published",label:"Published"}],admin:{readOnly:true,hidden:true}}),e.auth&&!t.some(i=>i.name==="password")&&t.push({name:"password",type:"password",required:true,admin:{hidden:true}}),t}getFields(e){let t=this.collections.get(e);if(t)return t.fields;let i=this.globals.get(e);if(i)return i.fields;throw new Error(`No collection or global found with slug "${e}"`)}getFieldMap(e){let t=this.getFields(e),i=new Map,o=n=>{for(let a of n){if(a.name&&i.set(a.name,a),"fields"in a&&a.fields&&o(a.fields),"tabs"in a)for(let l of a.tabs)o(l.fields);if("blocks"in a)for(let l of a.blocks)o(l.fields);}};return o(t),i}getVisibleFields(e){return this.getFields(e).filter(i=>!i.admin?.hidden)}validate(){let e=this.getCollections(),t=this.getGlobals();de(e,t);}async init(e){this.validate();for(let t of this.plugins){t.init&&await t.init(e||this);let i=t.collections||[];for(let n of i)n.slug&&!this.hasCollection(n.slug)&&this.addCollection(n);let o=t.globals||[];for(let n of o)n.slug&&!this.hasGlobal(n.slug)&&this.addGlobal(n);}this.initialized=true;}isInitialized(){return this.initialized}getPaginationDefaults(e){let t=this.collections.get(e);return {defaultLimit:t?.admin?.pagination?.defaultLimit||10,limits:t?.admin?.pagination?.limits||[10,25,50,100]}}getDefaultSort(e){let i=this.collections.get(e)?.admin?.useAsTitle;return i||"createdAt"}getDefaultColumns(e){let t=this.collections.get(e);return t?.admin?.defaultColumns?t.admin.defaultColumns:this.getVisibleFields(e).slice(0,4).map(o=>o.name)}getAdminTitle(e){let t=this.collections.get(e);return t?.label||t?.admin?.description||e}getAdminLabel(e){let t=this.collections.get(e);return t?.singularLabel||t?.label||e}getAdminGroup(e){return this.collections.get(e)?.admin?.group}getStats(){let e=0;for(let t of this.collections.values())e+=t.fields.length;for(let t of this.globals.values())e+=t.fields.length;return {collections:this.collections.size,globals:this.globals.size,plugins:this.plugins.length,fields:e}}toJSON(){return {collections:this.getCollections(),globals:this.getGlobals()}}},v=null;function He(){return v||(v=new w),v}function Me(){v=null;}function O(){return v=new w,v}var p=class{name;displayName;adminEntry;version;description;hooks={};collections=[];globals=[];fields=[];extensions={collections:[],globals:[]};adminComponents={};adminStyles=[];serverMiddleware;clientMiddleware;constructor(e){this.name=e;}async init(e){}async beforeInit(e){}async afterInit(e){}getCollections(){return this.collections}getGlobals(){return this.globals}getHooks(){return this.hooks}},k=class{plugins=new Map;hooks=new Map;register(e){if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);this.plugins.set(e.name,e);let t=e.getHooks?.()||{};for(let[i,o]of Object.entries(t))if(Array.isArray(o))for(let n of o)this.registerHook(i,n);}unregister(e){let t=this.plugins.get(e);if(!t)return;let i=t.getHooks?.()||{};for(let[o,n]of Object.entries(i))if(Array.isArray(n))for(let a of n)this.unregisterHook(o,a);this.plugins.delete(e);}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}registerHook(e,t){this.hooks.has(e)||this.hooks.set(e,[]),this.hooks.get(e).push(t);}unregisterHook(e,t){let i=this.hooks.get(e);if(i){let o=i.indexOf(t);o>-1&&i.splice(o,1);}}async executeHook(e,t){let i=this.hooks.get(e)||[],o=t;for(let n of i)try{let a=await n({...t,data:o});a!==void 0&&(o=a);}catch(a){console.error(`[PluginManager] Error in hook "${e}":`,a);}return o}getAllCollections(){let e=[];for(let t of this.plugins.values()){let i=t.getCollections?.()||[];e.push(...i);}return e}getAllGlobals(){let e=[];for(let t of this.plugins.values()){let i=t.getGlobals?.()||[];e.push(...i);}return e}getAllFields(){let e=[];for(let t of this.plugins.values())e.push(...t.fields);return e}getAdminComponents(){let e={};for(let t of this.plugins.values())Object.assign(e,t.adminComponents);return e}getAdminStyles(){let e=[];for(let t of this.plugins.values())e.push(...t.adminStyles);return e}},G=class extends p{constructor(){super("seo"),this.displayName="Core SEO",this.description="Advanced SEO features including sitemaps, robots.txt, and structured data",this.adminEntry="@kyro-cms/admin/plugins/seo-admin",this.collections.push({slug:"seo-settings",label:"SEO Settings",fields:[{name:"sitemap",type:"checkbox",label:"Enable Sitemap",defaultValue:true},{name:"robotsTxt",type:"richtext",label:"robots.txt Content"},{name:"canonicalUrl",type:"text",variant:"url",label:"Canonical URL"},{name:"ogImage",type:"text",label:"Default OG Image URL"}]});}},N=class extends p{constructor(){super("analytics"),this.displayName="Core Analytics",this.description="Built-in privacy-friendly analytics and dashboards",this.collections.push({slug:"analytics-events",label:"Analytics Events",fields:[{name:"name",type:"text",required:true},{name:"properties",type:"json",label:"Event Properties"},{name:"timestamp",type:"date",required:true},{name:"userId",type:"text",label:"User ID"},{name:"sessionId",type:"text",label:"Session ID"}]}),this.adminComponents.AnalyticsDashboard={};}},U=class extends p{constructor(){super("comments"),this.description="Commenting system for products and posts",this.collections.push({slug:"comments",label:"Comments",fields:[{name:"content",type:"richtext",required:true},{name:"author",type:"text",required:true},{name:"email",type:"email"},{name:"approved",type:"checkbox",defaultValue:false},{name:"parent",type:"text",label:"Parent Comment ID"},{name:"resourceType",type:"text",required:true},{name:"resourceId",type:"text",required:true}]}),this.adminComponents.CommentModeration={};}},L=class extends p{constructor(){super("reviews"),this.description="Product reviews and ratings",this.collections.push({slug:"reviews",label:"Reviews",fields:[{name:"rating",type:"number",required:true,min:1,max:5},{name:"title",type:"text"},{name:"content",type:"richtext",required:true},{name:"author",type:"relationship",relationTo:"customers"},{name:"product",type:"relationship",relationTo:"products",required:true},{name:"approved",type:"checkbox",defaultValue:false},{name:"verified",type:"checkbox",label:"Verified Purchase"},{name:"helpful",type:"number",label:"Helpful Count",defaultValue:0}]}),this.adminComponents.ReviewModeration={};}},z=class extends p{constructor(){super("wishlist"),this.description="Customer wishlists",this.collections.push({slug:"wishlists",label:"Wishlists",fields:[{name:"customer",type:"relationship",relationTo:"customers",required:true},{name:"name",type:"text",label:"Wishlist Name",defaultValue:"My Wishlist"},{name:"items",type:"blocks",label:"Items",blocks:[{slug:"wishlist-item",label:"Item",fields:[{name:"product",type:"relationship",relationTo:"products"},{name:"quantity",type:"number",defaultValue:1},{name:"addedAt",type:"date"},{name:"priority",type:"select",options:[{label:"Low",value:"low"},{label:"Medium",value:"medium"},{label:"High",value:"high"}]}]}]}]});}},ct={SEO:G,Analytics:N,Comments:U,Reviews:L,Wishlist:z};var Ve={aws:{type:"aws",configKey:"s3",displayName:"S3 Compatible (AWS, Backblaze, Wasabi, etc.)",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1",admin:{placeholder:"us-east-1"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"endpoint",type:"text",label:"Endpoint URL",admin:{placeholder:"https://s3.custom.com"}},{name:"cdnUrl",type:"text",label:"CDN URL",admin:{placeholder:"https://cdn.example.com"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads"}}]},r2:{type:"r2",configKey:"r2",displayName:"Cloudflare R2",configFields:[{name:"accountId",type:"text",label:"Account ID",required:true,admin:{placeholder:"Your Cloudflare Account ID"}},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"publicDevUrl",type:"text",label:"Public Dev URL ID",admin:{placeholder:"pub-xxxxxxxxxxxxxxxx",description:"Enter ONLY the ID (e.g., pub-b8d8c4cc8bcf4d868ddd95efc1b305aa). Do NOT include https:// or the full URL. Found in R2 Dashboard \u2192 Public Dev URL."}},{name:"cdnUrl",type:"text",label:"Custom CDN URL",admin:{placeholder:"https://assets.example.com (optional)"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads (optional)",description:"Optional prefix for all object keys. Do not use '/' as prefix."}}]},gcs:{type:"gcs",configKey:"gcs",displayName:"Google Cloud Storage",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"projectId",type:"text",label:"Project ID"},{name:"clientEmail",type:"text",label:"Client Email"},{name:"privateKey",type:"password",label:"Private Key"},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},digitalocean:{type:"digitalocean",configKey:"digitalocean",displayName:"DigitalOcean Spaces",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"nyc3"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},backblaze:{type:"backblaze",configKey:"backblaze",displayName:"Backblaze B2",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"accountId",type:"text",label:"Account ID"},{name:"applicationKeyId",type:"text",label:"Application Key ID",required:true},{name:"applicationKey",type:"password",label:"Application Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]},wasabi:{type:"wasabi",configKey:"wasabi",displayName:"Wasabi",configFields:[{name:"bucket",type:"text",label:"Bucket Name",required:true},{name:"region",type:"text",label:"Region",defaultValue:"us-east-1"},{name:"accessKeyId",type:"text",label:"Access Key ID",required:true},{name:"secretAccessKey",type:"password",label:"Secret Access Key",required:true},{name:"cdnUrl",type:"text",label:"CDN URL"},{name:"prefix",type:"text",label:"Path Prefix"}]}};function Be(s,e){switch(s){case "r2":return e?.endpoint||`https://${e?.accountId||""}.r2.cloudflarestorage.com`;case "digitalocean":return e?.endpoint||`https://${e?.region||"nyc3"}.digitaloceanspaces.com`;case "backblaze":return e?.endpoint||"https://s3.backblazeb2.com";case "wasabi":return e?.endpoint||`https://s3.${e?.region||"us-east-1"}.wasabisys.com`;default:return e?.endpoint}}function xe(s,e){return {provider:s,bucket:e?.bucket||"",region:e?.region||"us-east-1",accessKeyId:e?.accessKeyId||e?.clientEmail||e?.applicationKeyId||"",secretAccessKey:e?.secretAccessKey||e?.privateKey||e?.applicationKey||"",endpoint:Be(s,e),cdnUrl:e?.cdnUrl,prefix:e?.prefix,accountId:e?.accountId,publicDevUrl:e?.publicDevUrl}}function We(s,e,t){let i=t[e.configKey]||{};return xe(s,i)}function Je(s,e,t){let i=t?.[e.configKey]||t;return xe(s,i)}var _=class extends p{constructor(){super("@kyro-cms/storage-s3"),this.version="1.0.0",this.description="S3-compatible storage (AWS R2 GCS DigitalOcean Backblaze Wasabi)";}async init(e){let t=e.registry?.storageProviders;if(!t)return;let i=this.name;for(let o of Object.values(Ve))t.register({type:o.type,displayName:o.displayName,pluginName:i,configKey:o.configKey,configFields:o.configFields,extractConfig:n=>We(o.type,o,n),extractRawConfig:n=>Je(o.type,o,n),factory:n=>a(n)});}},Ce=new _;var H=class extends p{constructor(){super("@kyro-cms/storage-cloudinary"),this.version="1.0.0",this.description="Cloudinary image and video storage";}async init(e){let t=e.registry?.storageProviders;t&&t.register({type:"cloudinary",displayName:"Cloudinary",pluginName:this.name,configKey:"cloudinary",configFields:[{name:"cloudName",type:"text",label:"Cloud Name",required:true},{name:"apiKey",type:"text",label:"API Key",required:true},{name:"apiSecret",type:"password",label:"API Secret",required:true},{name:"folder",type:"text",label:"Folder",admin:{placeholder:"Optional folder path"}},{name:"uploadPreset",type:"text",label:"Upload Preset (optional)",admin:{placeholder:"Leave empty for signed uploads",description:"If not set, uploads will be signed with API Secret"}}],extractConfig:i=>({cloudName:i.cloudinary?.cloudName||"",apiKey:i.cloudinary?.apiKey||"",apiSecret:i.cloudinary?.apiSecret||"",folder:i.cloudinary?.folder,uploadPreset:i.cloudinary?.uploadPreset}),extractRawConfig:i=>{let o=i?.cloudinary||i;return {cloudName:o?.cloudName||"",apiKey:o?.apiKey||"",apiSecret:o?.apiSecret||"",folder:o?.folder,uploadPreset:o?.uploadPreset}},factory:i=>b$1(i)});}},ve=new H;var M=class extends p{constructor(){super("@kyro-cms/storage-ftp"),this.version="1.0.0",this.description="FTP/SFTP storage provider";}async init(e){let t=e.registry?.storageProviders;t&&t.register({type:"ftp",displayName:"FTP",pluginName:this.name,configKey:"ftp",configFields:[{name:"host",type:"text",label:"Host",required:true,admin:{placeholder:"ftp.example.com"}},{name:"port",type:"number",label:"Port",defaultValue:21,admin:{placeholder:"21 for FTP"}},{name:"user",type:"text",label:"Username",required:true},{name:"password",type:"password",label:"Password",required:true},{name:"secure",type:"checkbox",label:"Use TLS/SSL",defaultValue:false,admin:{description:"Enable TLS/SSL for secure connections (FTP only)"}},{name:"baseUrl",type:"text",label:"Base URL",required:true,admin:{placeholder:"https://files.example.com"}},{name:"prefix",type:"text",label:"Path Prefix",admin:{placeholder:"uploads"}}],extractConfig:i=>({host:i.ftp?.host||"",port:i.ftp?.port||21,user:i.ftp?.user||"",password:i.ftp?.password||"",secure:i.ftp?.secure||false,baseUrl:i.ftp?.baseUrl||"",prefix:i.ftp?.prefix,type:"ftp"}),extractRawConfig:i=>{let o=i?.ftp||i;return {host:o?.host||"",port:o?.port||21,user:o?.user||"",password:o?.password||"",secure:o?.secure||false,baseUrl:o?.baseUrl||"",prefix:o?.prefix,type:"ftp"}},factory:i=>c(i)});}},we=new M;var Qe=[Ce,ve,we];function b(s,e,t){let i=e.split(".");if(i.length===0)return false;let o=i[0],n=i.slice(1).join(".");for(let a of s)if(a.name===o)if(n){if(a.fields&&Array.isArray(a.fields))return b(a.fields,n,t);if(a.type==="tabs"&&a.tabs&&Array.isArray(a.tabs)){for(let l of a.tabs)if(l.fields&&Array.isArray(l.fields)&&b(l.fields,n,t))return true;return false}if(a.type==="blocks"&&a.blocks&&Array.isArray(a.blocks)){let l=n.split(".")[0],c=n.split(".").slice(1).join(".");if(!c)return false;for(let f of a.blocks)if(f.slug===l&&f.fields&&Array.isArray(f.fields))return b(f.fields,c,t);return false}return a.type==="array"&&a.fields&&Array.isArray(a.fields)?b(a.fields,n,t):false}else return Object.assign(a,t),true;for(let a of s)if(!a.name||a.type==="tabs"||a.type==="row"||a.type==="collapsible"){if(a.fields&&Array.isArray(a.fields)&&b(a.fields,e,t))return true;if(a.type==="tabs"&&a.tabs&&Array.isArray(a.tabs)){for(let c of a.tabs)if(c.fields&&Array.isArray(c.fields)&&b(c.fields,e,t))return true}}return n?false:(s.push({name:o,...t}),true)}function Xe(s,e){if(e)for(let t of s){let i=e[t.slug];if(i){let{fields:o,...n}=i;if(t.admin={...t.admin,...n},o&&t.fields&&Array.isArray(t.fields))for(let[a,l]of Object.entries(o))b(t.fields,a,l);}}}var V=class{registry;db;pubsub;webhookService;settings;pluginManager;wsServer;config;constructor(e){this.config=e,this.registry=O(),this.db=e.adapter||e.db,this.pubsub=new b$2(this.registry),this.webhookService=o(this.db),this.pluginManager=new k;for(let t of Qe)this.pluginManager.register(t),this.registry.addPlugin(t);if(e.plugins)for(let t of e.plugins)this.pluginManager.register(t),this.registry.addPlugin(t);e.collections&&e.admin?.collectionOverrides&&Xe(e.collections,e.admin.collectionOverrides),e.collections&&this.registry.addCollections(e.collections),e.globals&&this.registry.addGlobals(e.globals);}async init(){await this.pluginManager.executeHook("beforeInit",{kyro:this}),await this.registry.init(this),await this.pluginManager.executeHook("afterInit",{kyro:this}),this.registry.addGlobalPostInit(a$2);let e={slug:"plugin-settings",admin:{hidden:true},fields:[{name:"states",type:"json"}]};if(this.registry.addGlobalPostInit(e),!this.db)throw new Error("Database adapter is null \u2014 failed to load at startup. Check the server console for the exact error.");let t={slug:d$1,fields:[{name:"userId",type:"text",required:true},{name:"name",type:"text",required:true},{name:"key",type:"text",required:true},{name:"keyPrefix",type:"text",required:true},{name:"permissions",type:"json"},{name:"lastUsedAt",type:"date"},{name:"expiresAt",type:"date"}]},i={slug:f$1,fields:[{name:"name",type:"text",required:true},{name:"url",type:"text",required:true},{name:"events",type:"json",required:true},{name:"collections",type:"json"},{name:"status",type:"text",required:true},{name:"secret",type:"text"},{name:"headers",type:"json"},{name:"action",type:"text"},{name:"config",type:"json"},{name:"lastTriggered",type:"date"},{name:"lastError",type:"text"}]},o={slug:g$1,fields:[{name:"webhookId",type:"text",required:true},{name:"event",type:"text",required:true},{name:"payload",type:"json",required:true},{name:"attempt",type:"number",required:true},{name:"status",type:"text",required:true},{name:"responseStatus",type:"number"},{name:"responseBody",type:"text"},{name:"error",type:"text"},{name:"duration",type:"number"},{name:"deliveredAt",type:"date"},{name:"nextRetryAt",type:"date"}]},n=this.registry.getGlobals();if(this.db instanceof c$1&&this.db.dialect==="postgres"){let a=this.db,l=d$1.replace(/-/g,"_");a.schema[l]||(a.schema[l]=g);}await this.db.init([...this.registry.getCollections(),t,i,o],n),await this.loadPluginState(),this.pubsub.autoRegisterHooks();}async loadSettings(){if(this.settings)return this.settings;try{let e=await this.db.findOne({collection:"_globals_access-settings",where:{},draft:!0});e&&(this.settings={access:e});}catch{}return this.settings||{}}async loadPluginState(){let e=this.registry.storageProviders,t=e.getAllPluginNames(),i={};try{let o=await this.db.findOne({collection:"_globals_plugin-settings",where:{},draft:!0});o&&o.states&&(i=o.states);}catch{}for(let o of t)i[o]!==void 0&&e.setPluginEnabled(o,i[o]);}getREST(e){let t=typeof this.config.auth=="object"?this.config.auth:null,i=t?.secret,o=t?.checkSession!==false;return u$1({registry:this.registry,db:this.db,authSecret:i,authAdapter:this.config.authAdapter,checkSession:o,...e,cors:this.config.cors,webhookService:this.webhookService,settings:this.settings})}getGraphQL(e$1){let t=c$2({registry:this.registry,db:this.db,settings:this.settings});return {fetch:createYoga({schema:t,context:async({request:o})=>{let n=f$2(o),a,l;if(n&&this.db){let f=await e(n,this.db);f.user&&(a=f.user,l=g$2(f));}let c=e$1?.tenantId;return {db:this.db,registry:this.registry,user:a,req:o,tenantId:c,apiKey:l,relationLoader:new a$3({db:this.db,tenantId:c,user:a})}},graphiql:this.config.graphQL?.disablePlayground!==true,plugins:[]}).fetch,schema:t}}getTRPC(e){return {fetch:async(t,i$1)=>{let n=new URL(t.url).pathname.replace(/^\/api\/trpc\//,""),[a,...l]=n.split("."),c=l.join(".");if(c=c.replace(/\.(query|mutate|subscribe)$/,""),!a||!c)return new Response(JSON.stringify({error:{message:"Invalid tRPC path",code:-32600,data:{code:"BAD_REQUEST",httpStatus:400}}}),{status:400,headers:{"Content-Type":"application/json"}});let f=await a$4({db:this.db,registry:this.registry,req:t,user:e?.user,tenantId:e?.tenantId,settings:this.settings}),B=i(f)[a];if(!B)return new Response(JSON.stringify({error:{message:`Collection '${a}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});let W=B[c];if(typeof W!="function")return new Response(JSON.stringify({error:{message:`Procedure '${c}' not found`,code:-32601,data:{code:"NOT_FOUND",httpStatus:404}}}),{status:404,headers:{"Content-Type":"application/json"}});try{let x={};if(t.method==="POST"||t.method==="PATCH")x=await t.json().catch(()=>({}));else {let A=new URL(t.url).searchParams.get("input");if(A)try{x=JSON.parse(decodeURIComponent(A));}catch{}}let g=x?.["0"]??x,h=await W({...g,collection:a});return new Response(JSON.stringify({result:{data:h}}),{status:200,headers:{"Content-Type":"application/json"}})}catch(x){let g=x.message||"Internal error",h=g.includes("not found")?404:g.includes("denied")||g.includes("authentication required")?403:g.includes("conflict")?409:500,A=h===404?-32601:h===403?-32001:h===409?-32002:-32603;return new Response(JSON.stringify({error:{message:g,code:A,data:{code:"INTERNAL_SERVER_ERROR",httpStatus:h}}}),{status:h,headers:{"Content-Type":"application/json"}})}},router:null}}getWS(){return this.wsServer}async startWebSocket(e$1){let t=this.settings?.access?.apiAccess;if(t?.wsEnabled===false)return null;let i=async n=>{let a=await e(n,this.db);if(!a.valid)throw new Error(a.error||"Invalid API key");if(!a.user)throw new Error("API key has no associated user");return a.user},o=e$1?.port||8080;if(globalThis.__KYRO_WS_SERVER__)try{await globalThis.__KYRO_WS_SERVER__.close();}catch{}return this.wsServer=d$2({pubsub:this.pubsub,port:o,requireAuth:e$1?.requireAuth??t?.requireAuth,verifyToken:e$1?.verifyToken||i}),globalThis.__KYRO_WS_SERVER__=this.wsServer,this.wsServer}async shutdown(){await this.pluginManager.executeHook("beforeServerStop",{kyro:this}),this.wsServer&&await this.wsServer.close(),await this.db.disconnect(),await this.pluginManager.executeHook("afterServerStop",{kyro:this});}};function Lt(s){return new V(s)}
4
- export{K as a,I as b,D as c,m as d,de as e,u as f,fe as g,ye as h,ge as i,he as j,me as k,w as l,He as m,Me as n,O as o,p,k as q,G as r,N as s,U as t,L as u,z as v,ct as w,Xe as x,V as y,Lt as z};
@@ -1 +0,0 @@
1
- 'use strict';var chunkILEZ3NYX_cjs=require('./chunk-ILEZ3NYX.cjs'),chunkNY47CFVP_cjs=require('./chunk-NY47CFVP.cjs'),chunkG7SSHELM_cjs=require('./chunk-G7SSHELM.cjs');async function W(e){let a=chunkILEZ3NYX_cjs.o(e.db),t={db:e.db,registry:e.registry,req:e.req,user:e.user,tenantId:e.tenantId,webhookService:a,settings:e.settings},n=chunkNY47CFVP_cjs.f(e.req);if(n){let r=await chunkNY47CFVP_cjs.e(n,e.db,async o=>{try{return await e.db.findByID({collection:"users",id:o})||null}catch{return null}});r.valid&&(t.user=r.user||e.user,t.tenantId=r.tenantId||e.tenantId,t.apiKey=chunkNY47CFVP_cjs.g(r));}return t}var O={_media:{create:chunkILEZ3NYX_cjs.d.MEDIA_UPLOAD,update:chunkILEZ3NYX_cjs.d.MEDIA_UPLOAD,delete:chunkILEZ3NYX_cjs.d.MEDIA_DELETE}};function C(e,a){let t=O[e];return t?t[a]:`collection.${a}`}async function D(e,a,t){if(e.webhookService)try{await e.webhookService.trigger(a,{collection:t.collection,operation:t.operation,data:t.data,previousData:t.previousData,user:e.user?{id:e.user.id,email:e.user.email,role:e.user.role}:void 0,tenantId:e.tenantId});}catch(n){console.error(`[Webhook] Failed to trigger ${a}:`,n);}}function m(e,a){if(!(!e||typeof e!="object"))for(let t of a){if(t.type==="tabs"&&Array.isArray(t.tabs)){let r=t.name?e[t.name]:e;if(r&&typeof r=="object")for(let o of t.tabs)Array.isArray(o.fields)&&m(r,o.fields);continue}if(!t.name||!(t.name in e))continue;if(e[t.name]===""&&(t.type==="text"||t.type==="textarea"||t.type==="code"||t.type==="markdown"||t.type==="email"||t.type==="password"||t.type==="color"||(e[t.name]=null)),(t.type==="group"||t.type==="collapsible")&&t.name&&Array.isArray(t.fields)&&e[t.name]&&typeof e[t.name]=="object")m(e[t.name],t.fields);else if(t.type==="array"&&t.name&&Array.isArray(t.fields)&&Array.isArray(e[t.name]))for(let r of e[t.name])r&&typeof r=="object"&&m(r,t.fields);else if(t.type==="blocks"&&t.name&&Array.isArray(t.blocks)&&Array.isArray(e[t.name]))for(let r of e[t.name]){if(!r||typeof r!="object")continue;let o=r.type||r.blockType;if(!o)continue;let s=t.blocks.find(i=>i.slug===o);if(!s||!Array.isArray(s.fields))continue;let u=r.data&&typeof r.data=="object"?r.data:r;m(u,s.fields);}}}async function g(e,a,t){let n=await chunkILEZ3NYX_cjs.b(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 R(e){return async a=>{let{collection:t,where:n,sort:r,limit:o,page:s,depth:u,select:i,draft:d}=a,l=e.registry.getCollection(t);if(await g(l,"read",e),l.hooks?.beforeRead)for(let y of l.hooks.beforeRead)await y({collection:t,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read",where:n});let c=d??!!e.user,b=await e.db.find({collection:t,where:n||{},sort:r,limit:o||10,page:s||1,depth:u||0,tenantId:e.tenantId,select:i,draft:c});if(l.hooks?.afterRead)for(let y of b.docs)for(let w of l.hooks.afterRead)await w({collection:t,doc:y,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read"});return await chunkILEZ3NYX_cjs.a(b.docs,l.fields,e.db,e.registry,1,u||0),chunkG7SSHELM_cjs.a(b)}}function q(e){return async a=>{let{collection:t,id:n,depth:r,select:o,draft:s}=a,u=e.registry.getCollection(t);await g(u,"read",e);let i=s??!!e.user,d=await e.db.findByID({collection:t,id:n,depth:r||0,tenantId:e.tenantId,select:o,draft:i});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(u.hooks?.afterRead)for(let l of u.hooks.afterRead)await l({collection:t,doc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"read",id:n});return await chunkILEZ3NYX_cjs.a([d],u.fields,e.db,e.registry,1,r||0),chunkG7SSHELM_cjs.a(d)}}function P(e){return async a=>{let{collection:t,data:n,depth:r,select:o}=a,s=e.registry.getCollection(t);await g(s,"create",e);let i=e.registry.getCreateZodSchema(t).parse(n);if(s.tenantScoped&&e.tenantId&&(i.tenantId=e.tenantId),s.hooks?.beforeValidate)for(let l of s.hooks.beforeValidate){let c=await l({collection:t,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});c&&typeof c=="object"&&!Array.isArray(c)&&Object.assign(i,c);}if(s.hooks?.beforeChange)for(let l of s.hooks.beforeChange){let c=await l({collection:t,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});c&&typeof c=="object"&&!Array.isArray(c)&&Object.assign(i,c);}let d=await e.db.create({collection:t,data:i,depth:r||0,tenantId:e.tenantId,select:o});if(s.hooks?.afterChange)for(let l of s.hooks.afterChange)await l({collection:t,doc:d,data:i,req:e.req,user:e.user,tenantId:e.tenantId,operation:"create"});return await D(e,C(t,"create"),{collection:t,data:d,operation:"create"}),{doc:d}}}function v(e){return async a=>{let{collection:t,id:n,data:r,depth:o,select:s,baseUpdatedAt:u}=a,i=e.registry.getCollection(t);await g(i,"update",e);let d=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true});if(!d)throw new Error(`Document not found: ${t}/${n}`);if(u&&d.updatedAt&&u!==d.updatedAt)throw new Error(`Revision conflict: document has changed since ${u}. Current updatedAt: ${d.updatedAt}`);m(r,i.fields);let c=e.registry.getUpdateZodSchema(t).parse(r);if(i.tenantScoped&&e.tenantId&&(c.tenantId=e.tenantId),i.hooks?.beforeValidate)for(let h of i.hooks.beforeValidate){let f=await h({collection:t,data:c,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});f&&typeof f=="object"&&!Array.isArray(f)&&Object.assign(c,f);}if(i.hooks?.beforeChange)for(let h of i.hooks.beforeChange){let f=await h({collection:t,data:c,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});f&&typeof f=="object"&&!Array.isArray(f)&&Object.assign(c,f);}let b=e.req&&typeof e.req.headers?.get=="function"&&e.req.headers.get("x-draft")==="true"||a.draft===true,y=i.versions?.drafts===true,w=e.req?.query?.autosave==="true"||e.req?.url?.includes("autosave=true")||a.autosave===true,p;if(y&&b?(await e.db.createVersion({collection:t,documentId:n,data:c,status:"draft",autosave:w,createdBy:e.user?.id,tenantId:e.tenantId}),p=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true})):y?(p=await e.db.update({collection:t,id:n,data:{...c,status:"published"},depth:o||0,tenantId:e.tenantId,select:s}),await e.db.createVersion({collection:t,documentId:n,data:c,status:"published",createdBy:e.user?.id,tenantId:e.tenantId})):p=await e.db.update({collection:t,id:n,data:c,depth:o||0,tenantId:e.tenantId,select:s}),i.hooks?.afterChange)for(let h of i.hooks.afterChange)await h({collection:t,doc:p,data:c,originalDoc:d,req:e.req,user:e.user,tenantId:e.tenantId,operation:"update",id:n});return await D(e,C(t,"update"),{collection:t,data:p,previousData:d,operation:"update"}),{doc:p}}}function K(e){return async a=>{let{collection:t,id:n}=a,r=e.registry.getCollection(t);await g(r,"delete",e);let o=await e.db.findByID({collection:t,id:n,tenantId:e.tenantId,draft:true});if(!o)throw new Error(`Document not found: ${t}/${n}`);if(r.hooks?.beforeDelete)for(let u of r.hooks.beforeDelete)await u({collection:t,doc:o,req:e.req,user:e.user,tenantId:e.tenantId,operation:"delete",id:n});let s=await e.db.delete({collection:t,id:n,tenantId:e.tenantId});if(r.hooks?.afterDelete)for(let u of r.hooks.afterDelete)await u({collection:t,doc:s,req:e.req,user:e.user,tenantId:e.tenantId,operation:"delete",id:n});return await D(e,C(t,"delete"),{collection:t,data:s,previousData:o,operation:"delete"}),{doc:s,message:"Deleted successfully"}}}function E(e){return async a=>{let{collection:t,where:n}=a,r=e.registry.getCollection(t);return await g(r,"read",e),{totalDocs:await e.db.count({collection:t,where:n||{},tenantId:e.tenantId})}}}async function $(e,a,t){let n=await chunkILEZ3NYX_cjs.c(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 T(e){let a={},t=e.registry.getCollections();for(let r of t){let o=r.slug;a[o]={find:R(e),findByID:q(e),create:P(e),update:v(e),delete:K(e),count:E(e)};}let n=e.registry.getGlobals();for(let r of n){let o=r.slug;a[`_globals_${o}`]={get:async s=>(await $(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 $(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 V(e){if(e.settings?.access?.apiAccess?.trpcEnabled===false)throw new Error("tRPC API is disabled");return T(e)}exports.a=W;exports.b=R;exports.c=q;exports.d=P;exports.e=v;exports.f=K;exports.g=E;exports.h=T;exports.i=V;
@@ -1 +0,0 @@
1
- export{a as media,b as mediaFolders}from'./chunk-UBRYJP2G.js';import'./chunk-5J6HXUF6.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunkV65NPSR5_cjs=require('./chunk-V65NPSR5.cjs');require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"media",{enumerable:true,get:function(){return chunkV65NPSR5_cjs.a}});Object.defineProperty(exports,"mediaFolders",{enumerable:true,get:function(){return chunkV65NPSR5_cjs.b}});
@@ -1 +0,0 @@
1
- export{a as MongoDBAuthAdapter}from'./chunk-6ROHVUXF.js';import'./chunk-5J6HXUF6.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunkQCA3AP3M_cjs=require('./chunk-QCA3AP3M.cjs');require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"MongoDBAuthAdapter",{enumerable:true,get:function(){return chunkQCA3AP3M_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as PostgresAuthAdapter}from'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-5J6HXUF6.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunkGYQMNXXW_cjs=require('./chunk-GYQMNXXW.cjs');require('./chunk-MIOMMB23.cjs'),require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"PostgresAuthAdapter",{enumerable:true,get:function(){return chunkGYQMNXXW_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as RedisAuthAdapter}from'./chunk-QOCHBPMK.js';import'./chunk-6SPPR5JZ.js';import'./chunk-5J6HXUF6.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunk3RSMK4DA_cjs=require('./chunk-3RSMK4DA.cjs');require('./chunk-D5P2IPGX.cjs'),require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"RedisAuthAdapter",{enumerable:true,get:function(){return chunk3RSMK4DA_cjs.a}});
@@ -1 +0,0 @@
1
- 'use strict';var chunkV65NPSR5_cjs=require('./chunk-V65NPSR5.cjs'),chunkWIZ6C5QZ_cjs=require('./chunk-WIZ6C5QZ.cjs'),chunkMIOMMB23_cjs=require('./chunk-MIOMMB23.cjs');require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"media",{enumerable:true,get:function(){return chunkV65NPSR5_cjs.a}});Object.defineProperty(exports,"mediaFolders",{enumerable:true,get:function(){return chunkV65NPSR5_cjs.b}});Object.defineProperty(exports,"settings",{enumerable:true,get:function(){return chunkWIZ6C5QZ_cjs.a}});Object.defineProperty(exports,"apiKeys",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.g}});Object.defineProperty(exports,"auditLogs",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.e}});Object.defineProperty(exports,"emailVerifications",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.h}});Object.defineProperty(exports,"lockouts",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.k}});Object.defineProperty(exports,"passwordHistory",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.j}});Object.defineProperty(exports,"passwordResets",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.i}});Object.defineProperty(exports,"permissions",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.c}});Object.defineProperty(exports,"roles",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.b}});Object.defineProperty(exports,"sessions",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.d}});Object.defineProperty(exports,"tenants",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.f}});Object.defineProperty(exports,"users",{enumerable:true,get:function(){return chunkMIOMMB23_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as media,b as mediaFolders}from'./chunk-UBRYJP2G.js';export{a as settings}from'./chunk-K6WUOU6P.js';export{g as apiKeys,e as auditLogs,h as emailVerifications,k as lockouts,j as passwordHistory,i as passwordResets,c as permissions,b as roles,d as sessions,f as tenants,a as users}from'./chunk-OG7CNQGU.js';import'./chunk-5J6HXUF6.js';
@@ -1 +0,0 @@
1
- 'use strict';var chunkJ4252I5B_cjs=require('./chunk-J4252I5B.cjs');require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"SQLiteAuthAdapter",{enumerable:true,get:function(){return chunkJ4252I5B_cjs.a}});
@@ -1 +0,0 @@
1
- export{a as SQLiteAuthAdapter}from'./chunk-Q2UYCYKV.js';import'./chunk-5J6HXUF6.js';