@kyro-cms/core 0.10.4 → 0.10.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 (301) hide show
  1. package/dist/api-handler-graphql.cjs +1 -49
  2. package/dist/api-handler-graphql.js +1 -46
  3. package/dist/api-handler-trpc.cjs +1 -38
  4. package/dist/api-handler-trpc.js +1 -36
  5. package/dist/api-handler.cjs +1 -44
  6. package/dist/api-handler.js +1 -27
  7. package/dist/bootstrap-HIAV5ZFT.cjs +1 -0
  8. package/dist/bootstrap-P7QPQYQP.js +1 -0
  9. package/dist/chunk-2BTRHVT3.cjs +20 -0
  10. package/dist/chunk-2W4FK6CJ.js +122 -0
  11. package/dist/chunk-4ORJMSJU.cjs +1 -0
  12. package/dist/chunk-65G73T7Z.cjs +2 -0
  13. package/dist/chunk-7N6NKCRT.js +1 -0
  14. package/dist/chunk-7WOX27LK.js +259 -0
  15. package/dist/chunk-AE6GXUT7.js +1 -0
  16. package/dist/chunk-AJAZ7D3W.cjs +259 -0
  17. package/dist/chunk-ATLSIYRH.cjs +1 -0
  18. package/dist/chunk-AU6IWTBO.js +2 -0
  19. package/dist/chunk-CDL7ARXT.js +133 -0
  20. package/dist/chunk-CUTFS6N2.cjs +1 -0
  21. package/dist/chunk-CVVW4LXZ.cjs +1 -0
  22. package/dist/chunk-DGJUBN33.js +1 -0
  23. package/dist/chunk-DV4LFLPL.cjs +1 -0
  24. package/dist/chunk-EEWCANFX.js +1 -0
  25. package/dist/chunk-ELICKLFM.cjs +3 -0
  26. package/dist/chunk-EQUQJBPP.cjs +2 -0
  27. package/dist/chunk-ET6NN2V2.cjs +122 -0
  28. package/dist/chunk-F7P36SLX.cjs +74 -0
  29. package/dist/chunk-F7SR5IDT.cjs +1 -0
  30. package/dist/chunk-FO3HLBC7.js +1 -0
  31. package/dist/chunk-FS7GL2BR.js +73 -0
  32. package/dist/chunk-G6A7OSIG.js +2 -0
  33. package/dist/chunk-GFU7AOI3.cjs +1 -0
  34. package/dist/chunk-GYQMNXXW.cjs +114 -0
  35. package/dist/chunk-HLSB2MCK.js +1 -0
  36. package/dist/chunk-HVXO3OFB.cjs +1 -0
  37. package/dist/chunk-IFJJ44OQ.cjs +133 -0
  38. package/dist/chunk-ISWMETHJ.cjs +1 -0
  39. package/dist/chunk-K6WUOU6P.js +1 -0
  40. package/dist/chunk-KDNYHLD2.js +1 -0
  41. package/dist/chunk-KIW36TG7.cjs +86 -0
  42. package/dist/chunk-L6CZYN3L.cjs +20 -0
  43. package/dist/chunk-LRGAPGG3.js +74 -0
  44. package/dist/chunk-LZ6YFYQM.js +20 -0
  45. package/dist/chunk-MIOMMB23.cjs +1 -0
  46. package/dist/chunk-NGBJKZMT.js +90 -0
  47. package/dist/chunk-NRLIGDYF.js +1 -0
  48. package/dist/chunk-NY47CFVP.cjs +1 -0
  49. package/dist/chunk-NZ35PV5R.js +2 -0
  50. package/dist/chunk-OG7CNQGU.js +1 -0
  51. package/dist/chunk-OQD3WG6Z.cjs +1 -0
  52. package/dist/chunk-P7CESLDJ.js +1 -0
  53. package/dist/chunk-PP5S2UBV.js +0 -0
  54. package/dist/chunk-Q3Q7BJVQ.cjs +1 -0
  55. package/dist/chunk-Q4CSLXCO.cjs +90 -0
  56. package/dist/chunk-QRXDCV6K.js +0 -0
  57. package/dist/chunk-R7DVVXXI.cjs +73 -0
  58. package/dist/chunk-RHCWCG3O.js +114 -0
  59. package/dist/chunk-SL3LZQCF.js +1 -0
  60. package/dist/chunk-UBHFUFD4.cjs +1 -0
  61. package/dist/chunk-UBRYJP2G.js +1 -0
  62. package/dist/chunk-UDSJGML2.cjs +2 -0
  63. package/dist/chunk-UHFDH3PG.js +20 -0
  64. package/dist/chunk-UJNSOOYZ.cjs +1 -0
  65. package/dist/chunk-URCLFIME.js +86 -0
  66. package/dist/chunk-UVTS2IWM.js +1 -0
  67. package/dist/chunk-V65NPSR5.cjs +1 -0
  68. package/dist/chunk-WIZ6C5QZ.cjs +1 -0
  69. package/dist/chunk-ZAQOSRP6.js +1 -0
  70. package/dist/chunk-ZELCS7IC.js +3 -0
  71. package/dist/cli/index.cjs +35 -405
  72. package/dist/cli/index.js +35 -402
  73. package/dist/client.cjs +1 -55
  74. package/dist/client.js +1 -6
  75. package/dist/drizzle/index.cjs +1 -50
  76. package/dist/drizzle/index.d.cts +1 -2
  77. package/dist/drizzle/index.d.ts +1 -2
  78. package/dist/drizzle/index.js +1 -9
  79. package/dist/fields/index.cjs +1 -89
  80. package/dist/fields/index.js +1 -4
  81. package/dist/graphql/index.cjs +1 -31
  82. package/dist/graphql/index.d.cts +1 -1
  83. package/dist/graphql/index.d.ts +1 -1
  84. package/dist/graphql/index.js +1 -6
  85. package/dist/{index-jLs0zlft.d.ts → index-DXr33e0x.d.ts} +1 -1
  86. package/dist/{index-DHbywDs-.d.cts → index-DuuUzWBq.d.cts} +1 -1
  87. package/dist/index.cjs +29 -2464
  88. package/dist/index.d.cts +2 -2
  89. package/dist/index.d.ts +2 -2
  90. package/dist/index.js +29 -1929
  91. package/dist/integration.cjs +1 -10
  92. package/dist/integration.js +1 -4
  93. package/dist/media-NSSMOB7N.cjs +1 -0
  94. package/dist/media-RNMCZYPZ.js +1 -0
  95. package/dist/mongo-auth-adapter-JYJ4GBZE.cjs +1 -0
  96. package/dist/mongo-auth-adapter-XI7EPURZ.js +1 -0
  97. package/dist/mongodb/index.cjs +1 -29
  98. package/dist/mongodb/index.d.cts +1 -2
  99. package/dist/mongodb/index.d.ts +1 -2
  100. package/dist/mongodb/index.js +1 -8
  101. package/dist/postgres-auth-adapter-E7OGMDD4.cjs +1 -0
  102. package/dist/postgres-auth-adapter-F4KLOGAG.js +1 -0
  103. package/dist/redis-adapter-AQJVABYT.cjs +1 -0
  104. package/dist/redis-adapter-AUKOV74G.js +1 -0
  105. package/dist/rest/index.cjs +1 -31
  106. package/dist/rest/index.d.cts +1 -1
  107. package/dist/rest/index.d.ts +1 -1
  108. package/dist/rest/index.js +1 -18
  109. package/dist/schema-5XNROI7I.js +1 -0
  110. package/dist/schema-6O4JTJRU.cjs +1 -0
  111. package/dist/sqlite-adapter-5XFLNJDH.js +1 -0
  112. package/dist/sqlite-adapter-W53Q32N5.cjs +1 -0
  113. package/dist/templates/index.cjs +1 -207
  114. package/dist/templates/index.js +1 -6
  115. package/dist/trpc/index.cjs +1 -48
  116. package/dist/trpc/index.js +1 -7
  117. package/dist/ws/index.cjs +1 -25
  118. package/dist/ws/index.js +1 -4
  119. package/package.json +44 -13
  120. package/dist/api-handler-graphql.cjs.map +0 -1
  121. package/dist/api-handler-graphql.js.map +0 -1
  122. package/dist/api-handler-trpc.cjs.map +0 -1
  123. package/dist/api-handler-trpc.js.map +0 -1
  124. package/dist/api-handler.cjs.map +0 -1
  125. package/dist/api-handler.js.map +0 -1
  126. package/dist/bootstrap-FUAPY2OF.cjs +0 -32
  127. package/dist/bootstrap-FUAPY2OF.cjs.map +0 -1
  128. package/dist/bootstrap-OXNVM7FP.js +0 -7
  129. package/dist/bootstrap-OXNVM7FP.js.map +0 -1
  130. package/dist/chunk-2HFJUUFZ.js +0 -250
  131. package/dist/chunk-2HFJUUFZ.js.map +0 -1
  132. package/dist/chunk-3AKCVYDB.js +0 -162
  133. package/dist/chunk-3AKCVYDB.js.map +0 -1
  134. package/dist/chunk-3KTWGODI.cjs +0 -178
  135. package/dist/chunk-3KTWGODI.cjs.map +0 -1
  136. package/dist/chunk-3YELQL7Z.cjs +0 -4
  137. package/dist/chunk-3YELQL7Z.cjs.map +0 -1
  138. package/dist/chunk-4CV4JOE5.js +0 -24
  139. package/dist/chunk-4CV4JOE5.js.map +0 -1
  140. package/dist/chunk-4OCMVGEY.cjs +0 -173
  141. package/dist/chunk-4OCMVGEY.cjs.map +0 -1
  142. package/dist/chunk-4PWRCMTQ.cjs +0 -15
  143. package/dist/chunk-4PWRCMTQ.cjs.map +0 -1
  144. package/dist/chunk-53NYVYVX.js +0 -3243
  145. package/dist/chunk-53NYVYVX.js.map +0 -1
  146. package/dist/chunk-5GFQPHGT.cjs +0 -156
  147. package/dist/chunk-5GFQPHGT.cjs.map +0 -1
  148. package/dist/chunk-5RPRLTTN.js +0 -861
  149. package/dist/chunk-5RPRLTTN.js.map +0 -1
  150. package/dist/chunk-74YSDAWE.cjs +0 -2749
  151. package/dist/chunk-74YSDAWE.cjs.map +0 -1
  152. package/dist/chunk-7OGPN7MP.js +0 -352
  153. package/dist/chunk-7OGPN7MP.js.map +0 -1
  154. package/dist/chunk-7OS7TX2Q.cjs +0 -495
  155. package/dist/chunk-7OS7TX2Q.cjs.map +0 -1
  156. package/dist/chunk-ADLJSJSN.cjs +0 -13
  157. package/dist/chunk-ADLJSJSN.cjs.map +0 -1
  158. package/dist/chunk-B6X3LN25.cjs +0 -6486
  159. package/dist/chunk-B6X3LN25.cjs.map +0 -1
  160. package/dist/chunk-BYBMTIMT.js +0 -419
  161. package/dist/chunk-BYBMTIMT.js.map +0 -1
  162. package/dist/chunk-CF7OL6HR.js +0 -355
  163. package/dist/chunk-CF7OL6HR.js.map +0 -1
  164. package/dist/chunk-CJX74IYK.js +0 -489
  165. package/dist/chunk-CJX74IYK.js.map +0 -1
  166. package/dist/chunk-CKVOU6MX.cjs +0 -52
  167. package/dist/chunk-CKVOU6MX.cjs.map +0 -1
  168. package/dist/chunk-CZLDE2OZ.cjs +0 -28
  169. package/dist/chunk-CZLDE2OZ.cjs.map +0 -1
  170. package/dist/chunk-DPA3KWPY.cjs +0 -205
  171. package/dist/chunk-DPA3KWPY.cjs.map +0 -1
  172. package/dist/chunk-EEJUFDMF.cjs +0 -424
  173. package/dist/chunk-EEJUFDMF.cjs.map +0 -1
  174. package/dist/chunk-FIAMXNTH.js +0 -220
  175. package/dist/chunk-FIAMXNTH.js.map +0 -1
  176. package/dist/chunk-GAOXD3XT.js +0 -175
  177. package/dist/chunk-GAOXD3XT.js.map +0 -1
  178. package/dist/chunk-GTGRLD4Y.js +0 -3
  179. package/dist/chunk-GTGRLD4Y.js.map +0 -1
  180. package/dist/chunk-GUUB5EAG.cjs +0 -223
  181. package/dist/chunk-GUUB5EAG.cjs.map +0 -1
  182. package/dist/chunk-GXFOGU7N.cjs +0 -359
  183. package/dist/chunk-GXFOGU7N.cjs.map +0 -1
  184. package/dist/chunk-GZS4LMR7.js +0 -422
  185. package/dist/chunk-GZS4LMR7.js.map +0 -1
  186. package/dist/chunk-HY6B7B5A.js +0 -150
  187. package/dist/chunk-HY6B7B5A.js.map +0 -1
  188. package/dist/chunk-HZOMOK5Y.js +0 -2728
  189. package/dist/chunk-HZOMOK5Y.js.map +0 -1
  190. package/dist/chunk-IDVRRRAK.cjs +0 -824
  191. package/dist/chunk-IDVRRRAK.cjs.map +0 -1
  192. package/dist/chunk-KC2GDBLS.cjs +0 -84
  193. package/dist/chunk-KC2GDBLS.cjs.map +0 -1
  194. package/dist/chunk-L4EZKIEX.js +0 -185
  195. package/dist/chunk-L4EZKIEX.js.map +0 -1
  196. package/dist/chunk-LNTFRAHF.cjs +0 -473
  197. package/dist/chunk-LNTFRAHF.cjs.map +0 -1
  198. package/dist/chunk-MTIRYI7F.cjs +0 -4
  199. package/dist/chunk-MTIRYI7F.cjs.map +0 -1
  200. package/dist/chunk-N4GN6Q3V.cjs +0 -869
  201. package/dist/chunk-N4GN6Q3V.cjs.map +0 -1
  202. package/dist/chunk-N4H37VN4.cjs +0 -259
  203. package/dist/chunk-N4H37VN4.cjs.map +0 -1
  204. package/dist/chunk-N5QSHUA6.js +0 -1135
  205. package/dist/chunk-N5QSHUA6.js.map +0 -1
  206. package/dist/chunk-NKPKR5BW.cjs +0 -188
  207. package/dist/chunk-NKPKR5BW.cjs.map +0 -1
  208. package/dist/chunk-OIRG6ZRV.cjs +0 -1073
  209. package/dist/chunk-OIRG6ZRV.cjs.map +0 -1
  210. package/dist/chunk-OJ2AM75W.cjs +0 -253
  211. package/dist/chunk-OJ2AM75W.cjs.map +0 -1
  212. package/dist/chunk-OLV7K22H.js +0 -6457
  213. package/dist/chunk-OLV7K22H.js.map +0 -1
  214. package/dist/chunk-OX6GOIPH.js +0 -516
  215. package/dist/chunk-OX6GOIPH.js.map +0 -1
  216. package/dist/chunk-P2YW545G.js +0 -11
  217. package/dist/chunk-P2YW545G.js.map +0 -1
  218. package/dist/chunk-PHJRNPHY.cjs +0 -3291
  219. package/dist/chunk-PHJRNPHY.cjs.map +0 -1
  220. package/dist/chunk-Q72BOAPK.js +0 -817
  221. package/dist/chunk-Q72BOAPK.js.map +0 -1
  222. package/dist/chunk-QU2RFFH4.js +0 -3
  223. package/dist/chunk-QU2RFFH4.js.map +0 -1
  224. package/dist/chunk-RP7VZUEL.js +0 -49
  225. package/dist/chunk-RP7VZUEL.js.map +0 -1
  226. package/dist/chunk-SHTTJMLT.cjs +0 -361
  227. package/dist/chunk-SHTTJMLT.cjs.map +0 -1
  228. package/dist/chunk-SX76DNOO.js +0 -103
  229. package/dist/chunk-SX76DNOO.js.map +0 -1
  230. package/dist/chunk-THBQG64D.cjs +0 -425
  231. package/dist/chunk-THBQG64D.cjs.map +0 -1
  232. package/dist/chunk-TQG7G7YI.cjs +0 -526
  233. package/dist/chunk-TQG7G7YI.cjs.map +0 -1
  234. package/dist/chunk-U3VVLYXG.cjs +0 -189
  235. package/dist/chunk-U3VVLYXG.cjs.map +0 -1
  236. package/dist/chunk-UUDTPZX6.js +0 -193
  237. package/dist/chunk-UUDTPZX6.js.map +0 -1
  238. package/dist/chunk-V5AWATUP.js +0 -1059
  239. package/dist/chunk-V5AWATUP.js.map +0 -1
  240. package/dist/chunk-VAXLFZCV.cjs +0 -110
  241. package/dist/chunk-VAXLFZCV.cjs.map +0 -1
  242. package/dist/chunk-VKREAIBA.cjs +0 -1139
  243. package/dist/chunk-VKREAIBA.cjs.map +0 -1
  244. package/dist/chunk-WDTTHKDS.js +0 -458
  245. package/dist/chunk-WDTTHKDS.js.map +0 -1
  246. package/dist/chunk-WXVB364T.js +0 -218
  247. package/dist/chunk-WXVB364T.js.map +0 -1
  248. package/dist/chunk-X4BPPD6K.js +0 -181
  249. package/dist/chunk-X4BPPD6K.js.map +0 -1
  250. package/dist/chunk-XEB7PH2E.js +0 -81
  251. package/dist/chunk-XEB7PH2E.js.map +0 -1
  252. package/dist/chunk-YT7HXXVN.js +0 -13
  253. package/dist/chunk-YT7HXXVN.js.map +0 -1
  254. package/dist/cli/index.cjs.map +0 -1
  255. package/dist/cli/index.js.map +0 -1
  256. package/dist/client.cjs.map +0 -1
  257. package/dist/client.js.map +0 -1
  258. package/dist/drizzle/index.cjs.map +0 -1
  259. package/dist/drizzle/index.js.map +0 -1
  260. package/dist/fields/index.cjs.map +0 -1
  261. package/dist/fields/index.js.map +0 -1
  262. package/dist/graphql/index.cjs.map +0 -1
  263. package/dist/graphql/index.js.map +0 -1
  264. package/dist/index.cjs.map +0 -1
  265. package/dist/index.js.map +0 -1
  266. package/dist/integration.cjs.map +0 -1
  267. package/dist/integration.js.map +0 -1
  268. package/dist/media-7WDX4BDJ.js +0 -4
  269. package/dist/media-7WDX4BDJ.js.map +0 -1
  270. package/dist/media-TUSLVRQ6.cjs +0 -17
  271. package/dist/media-TUSLVRQ6.cjs.map +0 -1
  272. package/dist/mongo-auth-adapter-GT4S7SCU.cjs +0 -17
  273. package/dist/mongo-auth-adapter-GT4S7SCU.cjs.map +0 -1
  274. package/dist/mongo-auth-adapter-M7VV4LNB.js +0 -4
  275. package/dist/mongo-auth-adapter-M7VV4LNB.js.map +0 -1
  276. package/dist/mongodb/index.cjs.map +0 -1
  277. package/dist/mongodb/index.js.map +0 -1
  278. package/dist/postgres-auth-adapter-AFAPISH7.js +0 -5
  279. package/dist/postgres-auth-adapter-AFAPISH7.js.map +0 -1
  280. package/dist/postgres-auth-adapter-SFDTLONT.cjs +0 -14
  281. package/dist/postgres-auth-adapter-SFDTLONT.cjs.map +0 -1
  282. package/dist/redis-adapter-UQX4EE3B.cjs +0 -13
  283. package/dist/redis-adapter-UQX4EE3B.cjs.map +0 -1
  284. package/dist/redis-adapter-XALOGWY3.js +0 -4
  285. package/dist/redis-adapter-XALOGWY3.js.map +0 -1
  286. package/dist/rest/index.cjs.map +0 -1
  287. package/dist/rest/index.js.map +0 -1
  288. package/dist/schema-6QL3USNB.cjs +0 -67
  289. package/dist/schema-6QL3USNB.cjs.map +0 -1
  290. package/dist/schema-FNNWEAAW.js +0 -6
  291. package/dist/schema-FNNWEAAW.js.map +0 -1
  292. package/dist/sqlite-adapter-AQB5TCGV.cjs +0 -13
  293. package/dist/sqlite-adapter-AQB5TCGV.cjs.map +0 -1
  294. package/dist/sqlite-adapter-N5H6IM2X.js +0 -4
  295. package/dist/sqlite-adapter-N5H6IM2X.js.map +0 -1
  296. package/dist/templates/index.cjs.map +0 -1
  297. package/dist/templates/index.js.map +0 -1
  298. package/dist/trpc/index.cjs.map +0 -1
  299. package/dist/trpc/index.js.map +0 -1
  300. package/dist/ws/index.cjs.map +0 -1
  301. package/dist/ws/index.js.map +0 -1
@@ -1,97 +1,14 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';
3
-
4
- require('../chunk-CZLDE2OZ.cjs');
5
- var commander = require('commander');
6
- var fs = require('fs');
7
- var path = require('path');
8
- var url = require('url');
9
- var glob = require('glob');
10
-
11
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
12
- function fieldToType(field) {
13
- switch (field.type) {
14
- case "text":
15
- case "email":
16
- case "password":
17
- case "textarea":
18
- case "color":
19
- case "code":
20
- case "markdown":
21
- case "date":
22
- case "richtext":
23
- case "json":
24
- return field.hasMany ? "string[]" : "string";
25
- case "number":
26
- return field.hasMany ? "number[]" : "number";
27
- case "checkbox":
28
- return "boolean";
29
- case "select":
30
- case "radio":
31
- if (field.options) {
32
- const values = field.options.map((o) => `'${o.value}'`).join(" | ");
33
- return field.hasMany ? `(${values})[]` : values;
34
- }
35
- return field.hasMany ? "string[]" : "string";
36
- case "relationship":
37
- if (Array.isArray(field.relationTo)) {
38
- const types = field.relationTo.map((r) => `${capitalize(r)} | string`).join(" | ");
39
- return field.hasMany ? `(${types})[]` : `(${types})`;
40
- }
41
- const relTo = field.relationTo || "unknown";
42
- return field.hasMany ? `(${capitalize(relTo)} | string)[]` : `${capitalize(relTo)} | string`;
43
- case "upload":
44
- return field.hasMany ? "(Media | string)[]" : "Media | string";
45
- case "array":
46
- if (field.fields && field.fields.length > 0) {
47
- const itemFields = field.fields.filter((f) => f.name).map((f) => {
48
- const type = fieldToType(f);
49
- return ` ${f.name}${f.required ? "" : "?"}: ${type};`;
50
- }).join("\n");
51
- return `Array<{
52
- ${itemFields}
53
- }>`;
54
- }
55
- return "Record<string, any>[]";
56
- case "group":
57
- if (field.fields && field.fields.length > 0) {
58
- const itemFields = field.fields.filter((f) => f.name).map((f) => {
59
- const type = fieldToType(f);
60
- return ` ${f.name}${f.required ? "" : "?"}: ${type};`;
61
- }).join("\n");
62
- return `{
63
- ${itemFields}
64
- }`;
65
- }
66
- return "Record<string, any>";
67
- case "blocks":
68
- return "Block[]";
69
- default:
70
- return "any";
71
- }
72
- }
73
- function capitalize(str) {
74
- return str.charAt(0).toUpperCase() + str.slice(1).replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
75
- }
76
- function toCamel(str) {
77
- return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
78
- }
79
- function collectionToInterface(collection) {
80
- const name = capitalize(collection.slug);
81
- const fields = collection.fields.filter((f) => f.name).map((f) => {
82
- const type = fieldToType(f);
83
- return ` ${f.name}${f.required ? "" : "?"}: ${type};`;
84
- });
85
- fields.unshift(" id: string;");
86
- fields.push(" createdAt: string;");
87
- fields.push(" updatedAt: string;");
88
- return `export interface ${name} {
89
- ${fields.join("\n")}
90
- }`;
91
- }
92
- function generateTypes(collections) {
93
- const interfaces = collections.map((c) => collectionToInterface(c));
94
- const header = `// ============================================================================
2
+ 'use strict';require('../chunk-OQD3WG6Z.cjs');var commander=require('commander'),fs=require('fs'),path=require('path'),url=require('url'),glob=require('glob');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function y(e){switch(e.type){case "text":case "email":case "password":case "textarea":case "color":case "code":case "markdown":case "date":case "richtext":case "json":return e.hasMany?"string[]":"string";case "number":return e.hasMany?"number[]":"number";case "checkbox":return "boolean";case "select":case "radio":if(e.options){let t=e.options.map(r=>`'${r.value}'`).join(" | ");return e.hasMany?`(${t})[]`:t}return e.hasMany?"string[]":"string";case "relationship":if(Array.isArray(e.relationTo)){let t=e.relationTo.map(r=>`${m(r)} | string`).join(" | ");return e.hasMany?`(${t})[]`:`(${t})`}let n=e.relationTo||"unknown";return e.hasMany?`(${m(n)} | string)[]`:`${m(n)} | string`;case "upload":return e.hasMany?"(Media | string)[]":"Media | string";case "array":return e.fields&&e.fields.length>0?`Array<{
3
+ ${e.fields.filter(r=>r.name).map(r=>{let o=y(r);return ` ${r.name}${r.required?"":"?"}: ${o};`}).join(`
4
+ `)}
5
+ }>`:"Record<string, any>[]";case "group":return e.fields&&e.fields.length>0?`{
6
+ ${e.fields.filter(r=>r.name).map(r=>{let o=y(r);return ` ${r.name}${r.required?"":"?"}: ${o};`}).join(`
7
+ `)}
8
+ }`:"Record<string, any>";case "blocks":return "Block[]";default:return "any"}}function m(e){return e.charAt(0).toUpperCase()+e.slice(1).replace(/-([a-z])/g,(n,t)=>t.toUpperCase())}function C(e){return e.replace(/-([a-z])/g,(n,t)=>t.toUpperCase())}function M(e){let n=m(e.slug),t=e.fields.filter(r=>r.name).map(r=>{let o=y(r);return ` ${r.name}${r.required?"":"?"}: ${o};`});return t.unshift(" id: string;"),t.push(" createdAt: string;"),t.push(" updatedAt: string;"),`export interface ${n} {
9
+ ${t.join(`
10
+ `)}
11
+ }`}function T(e){let n=e.map(s=>M(s)),t=`// ============================================================================
95
12
  // Auto-generated by kyro generate
96
13
  // ============================================================================
97
14
 
@@ -114,9 +31,9 @@ export interface Block {
114
31
  [key: string]: any;
115
32
  }
116
33
 
117
- `;
118
- const body = interfaces.join("\n\n");
119
- const footer = `
34
+ `,r=n.join(`
35
+
36
+ `),o=`
120
37
 
121
38
  // ============================================================================
122
39
  // Query Types
@@ -179,7 +96,8 @@ export interface KyroDeleteResult<T> {
179
96
  // ============================================================================
180
97
 
181
98
  export interface KyroCollections {
182
- ${collections.map((c) => ` ${toCamel(c.slug)}: ${capitalize(c.slug)};`).join("\n")}
99
+ ${e.map(s=>` ${C(s.slug)}: ${m(s.slug)};`).join(`
100
+ `)}
183
101
  }
184
102
 
185
103
  // ============================================================================
@@ -196,29 +114,15 @@ export interface KyroTypedClient<C extends keyof KyroCollections> {
196
114
  }
197
115
 
198
116
  export interface KyroClient {
199
- ${collections.map((c) => ` ${toCamel(c.slug)}: KyroTypedClient<'${c.slug}'>;`).join("\n")}
117
+ ${e.map(s=>` ${C(s.slug)}: KyroTypedClient<'${s.slug}'>;`).join(`
118
+ `)}
200
119
  }
201
120
 
202
121
  export function createClient(config: { url: string; token?: string }): KyroClient {
203
122
  // Client implementation would be here
204
123
  throw new Error('Not implemented');
205
124
  }
206
- `;
207
- return header + body + footer;
208
- }
209
- async function fetchRemoteSchema(url, apiKey) {
210
- const schemaUrl = `${url.replace(/\/+$/, "")}/api/__schema`;
211
- const res = await fetch(schemaUrl, {
212
- headers: { Authorization: `ApiKey ${apiKey}` }
213
- });
214
- if (!res.ok) {
215
- const body = await res.text();
216
- throw new Error(`Schema fetch failed (${res.status}): ${body}`);
217
- }
218
- return res.json();
219
- }
220
- function generateRemoteTypes(collections) {
221
- let output = `// ============================================================================
125
+ `;return t+r+o}async function q(e,n){let t=`${e.replace(/\/+$/,"")}/api/__schema`,r=await fetch(t,{headers:{Authorization:`ApiKey ${n}`}});if(!r.ok){let o=await r.text();throw new Error(`Schema fetch failed (${r.status}): ${o}`)}return r.json()}function D(e){let n=`// ============================================================================
222
126
  // Auto-generated by kyro generate --api
223
127
  // ============================================================================
224
128
 
@@ -241,23 +145,12 @@ export interface Block {
241
145
  [key: string]: any;
242
146
  }
243
147
 
244
- `;
245
- for (const col of collections) {
246
- const name = capitalize(col.slug);
247
- const fields = col.fields.filter((f) => f.name).map((f) => {
248
- const type = fieldToType(f);
249
- return ` ${f.name}${f.required ? "" : "?"}: ${type};`;
250
- });
251
- fields.unshift(" id: string;");
252
- fields.push(" createdAt: string;");
253
- fields.push(" updatedAt: string;");
254
- output += `export interface ${name} {
255
- ${fields.join("\n")}
148
+ `;for(let t of e){let r=m(t.slug),o=t.fields.filter(s=>s.name).map(s=>{let i=y(s);return ` ${s.name}${s.required?"":"?"}: ${i};`});o.unshift(" id: string;"),o.push(" createdAt: string;"),o.push(" updatedAt: string;"),n+=`export interface ${r} {
149
+ ${o.join(`
150
+ `)}
256
151
  }
257
152
 
258
- `;
259
- }
260
- output += `// ============================================================================
153
+ `;}return n+=`// ============================================================================
261
154
  // Typed REST Client
262
155
  // ============================================================================
263
156
 
@@ -296,286 +189,23 @@ export function createKyroClient(opts: KyroClientOptions) {
296
189
  }
297
190
 
298
191
  return {
299
- ${collections.map((col) => {
300
- const name = capitalize(col.slug);
301
- return ` ${toCamel(col.slug)}: {
192
+ ${e.map(t=>{let r=m(t.slug);return ` ${C(t.slug)}: {
302
193
  find: (args?: { where?: Record<string, any>; sort?: string; limit?: number; page?: number; draft?: boolean }) =>
303
- request<{ docs: ${name}[]; totalDocs: number; page: number; totalPages: number; hasNextPage: boolean; hasPrevPage: boolean }>(\`/${col.slug}\${args ? "?" + qs(args) : ""}\`),
194
+ request<{ docs: ${r}[]; totalDocs: number; page: number; totalPages: number; hasNextPage: boolean; hasPrevPage: boolean }>(\`/${t.slug}\${args ? "?" + qs(args) : ""}\`),
304
195
  findByID: (id: string, args?: { draft?: boolean }) =>
305
- request<${name}>(\`/${col.slug}/\${id}\${args ? "?" + qs(args) : ""}\`),
196
+ request<${r}>(\`/${t.slug}/\${id}\${args ? "?" + qs(args) : ""}\`),
306
197
  findBySlug: (slug: string, args?: { draft?: boolean }) =>
307
- request<{ docs: ${name}[] }>(\`/${col.slug}?where=\${encodeURIComponent(JSON.stringify({ slug: { equals: slug } }))}\`),
308
- create: (data: Partial<${name}>) =>
309
- request<{ doc: ${name}; message?: string }>(\`/${col.slug}\`, { method: "POST", body: JSON.stringify(data) }),
310
- update: (id: string, data: Partial<${name}>, args?: { baseUpdatedAt?: string }) =>
311
- request<{ doc: ${name}; message?: string }>(\`/${col.slug}/\${id}\`, { method: "PATCH", body: JSON.stringify({ ...data, ...args }) }),
198
+ request<{ docs: ${r}[] }>(\`/${t.slug}?where=\${encodeURIComponent(JSON.stringify({ slug: { equals: slug } }))}\`),
199
+ create: (data: Partial<${r}>) =>
200
+ request<{ doc: ${r}; message?: string }>(\`/${t.slug}\`, { method: "POST", body: JSON.stringify(data) }),
201
+ update: (id: string, data: Partial<${r}>, args?: { baseUpdatedAt?: string }) =>
202
+ request<{ doc: ${r}; message?: string }>(\`/${t.slug}/\${id}\`, { method: "PATCH", body: JSON.stringify({ ...data, ...args }) }),
312
203
  delete: (id: string) =>
313
- request<{ doc: ${name}; message: string }>(\`/${col.slug}/\${id}\`, { method: "DELETE" }),
204
+ request<{ doc: ${r}; message: string }>(\`/${t.slug}/\${id}\`, { method: "DELETE" }),
314
205
  count: (args?: { where?: Record<string, any> }) =>
315
- request<{ totalDocs: number }>(\`/${col.slug}/count\${args ? "?" + qs(args) : ""}\`),
316
- },`;
317
- }).join("\n")}
206
+ request<{ totalDocs: number }>(\`/${t.slug}/count\${args ? "?" + qs(args) : ""}\`),
207
+ },`}).join(`
208
+ `)}
318
209
  };
319
210
  }
320
- `;
321
- return output;
322
- }
323
- function createGenerateCommand() {
324
- const generate = new commander.Command("generate").description("Generate TypeScript types from collection configs").option("-c, --config <path>", "Path to config file or directory", "./src/kyro").option("-o, --output <path>", "Output file path", "./src/types/kyro.d.ts").option("-w, --watch", "Watch for changes and regenerate").option("--url <url>", "URL of a running Kyro CMS instance (enables remote mode)").option("--api-key <key>", "API key for authentication (required with --url)").action(async (options) => {
325
- if (options.url) {
326
- if (!options.url) {
327
- console.error("\u274C --url is required when using --api");
328
- process.exit(1);
329
- }
330
- if (!options.apiKey) {
331
- console.error("\u274C --api-key is required when using --api");
332
- process.exit(1);
333
- }
334
- const outputPath2 = path.resolve(options.output);
335
- try {
336
- const collections = await fetchRemoteSchema(options.url, options.apiKey);
337
- const types = generateRemoteTypes(collections);
338
- const outputDir = path.join(outputPath2, "..");
339
- if (!fs.existsSync(outputDir)) {
340
- fs.mkdirSync(outputDir, { recursive: true });
341
- }
342
- fs.writeFileSync(outputPath2, types);
343
- } catch (error) {
344
- console.error("\u274C Error:", error.message);
345
- process.exit(1);
346
- }
347
- return;
348
- }
349
- const configPath = path.resolve(options.config);
350
- const outputPath = path.resolve(options.output);
351
- try {
352
- const configFiles = await glob.glob(`${configPath}/**/*.{ts,js}`);
353
- if (configFiles.length === 0) {
354
- console.error("\u274C No config files found at:", configPath);
355
- process.exit(1);
356
- }
357
- const collections = [];
358
- for (const file of configFiles) {
359
- try {
360
- const mod = await import(file);
361
- const configs = Object.values(mod).filter((v) => v && v.slug && v.fields);
362
- collections.push(...configs);
363
- } catch (error) {
364
- console.warn(`\u26A0\uFE0F Could not parse: ${file}`);
365
- }
366
- }
367
- if (collections.length === 0) {
368
- console.error("\u274C No valid collection configs found");
369
- process.exit(1);
370
- }
371
- const types = generateTypes(collections);
372
- const outputDir = path.join(outputPath, "..");
373
- if (!fs.existsSync(outputDir)) {
374
- fs.mkdirSync(outputDir, { recursive: true });
375
- }
376
- fs.writeFileSync(outputPath, types);
377
- if (options.watch) {
378
- const { watch } = await import('fs');
379
- watch(configPath, { recursive: true }, async (eventType, filename) => {
380
- const newCollections = [];
381
- for (const file of configFiles) {
382
- try {
383
- const mod = await import(file + `?t=${Date.now()}`);
384
- const configs = Object.values(mod).filter((v) => v && v.slug && v.fields);
385
- newCollections.push(...configs);
386
- } catch {
387
- }
388
- }
389
- const newTypes = generateTypes(newCollections);
390
- fs.writeFileSync(outputPath, newTypes);
391
- });
392
- }
393
- } catch (error) {
394
- console.error("\u274C Error:", error.message);
395
- process.exit(1);
396
- }
397
- });
398
- return generate;
399
- }
400
-
401
- // src/cli/index.ts
402
- var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
403
- var __dirname$1 = path.dirname(__filename$1);
404
- var version = "0.1.0";
405
- try {
406
- const pkg = JSON.parse(
407
- fs.readFileSync(path.join(__dirname$1, "../../package.json"), "utf-8")
408
- );
409
- version = pkg.version;
410
- } catch {
411
- }
412
- var program = new commander.Command();
413
- program.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(version);
414
- program.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>", "Port to run on", "4321").option("-h, --host <host>", "Host to bind to", "localhost").action(async (options) => {
415
- const { exec } = await import('child_process');
416
- const child = exec(`astro dev --port ${options.port} --host ${options.host}`, {
417
- env: { ...process.env, NODE_NO_WARNINGS: "1" }
418
- });
419
- child.stdout?.on("data", (data) => process.stdout.write(data));
420
- child.stderr?.on("data", (data) => process.stderr.write(data));
421
- process.on("SIGINT", () => {
422
- child.kill("SIGINT");
423
- process.exit(0);
424
- });
425
- process.on("SIGTERM", () => {
426
- child.kill("SIGTERM");
427
- process.exit(0);
428
- });
429
- });
430
- program.addCommand(createGenerateCommand());
431
- var dbCommand = program.command("db").description("Database management commands");
432
- dbCommand.command("generate").description("Generate migrations from schema").action(async () => {
433
- const { exec } = await import('child_process');
434
- exec("npx drizzle-kit generate", (error, stdout, stderr) => {
435
- if (error) {
436
- console.error("\u274C Generation failed:", error.message);
437
- process.exit(1);
438
- }
439
- });
440
- });
441
- dbCommand.command("migrate").description("Run database migrations").action(async () => {
442
- const { exec } = await import('child_process');
443
- exec("npx drizzle-kit migrate", (error, stdout, stderr) => {
444
- if (error) {
445
- console.error("\u274C Migration failed:", error.message);
446
- process.exit(1);
447
- }
448
- });
449
- });
450
- dbCommand.command("push").description("Push schema to database (development)").action(async () => {
451
- const { exec } = await import('child_process');
452
- exec("npx drizzle-kit push", (error, stdout, stderr) => {
453
- if (error) {
454
- console.error("\u274C Push failed:", error.message);
455
- process.exit(1);
456
- }
457
- });
458
- });
459
- dbCommand.command("seed").description("Seed database with initial data").action(async () => {
460
- const { exec } = await import('child_process');
461
- exec("npx tsx src/database/drizzle/seed.ts", (error, stdout, stderr) => {
462
- if (error) {
463
- console.error("\u274C Seeding failed:", error.message);
464
- process.exit(1);
465
- }
466
- });
467
- });
468
- dbCommand.command("studio").description("Open Drizzle Studio").action(async () => {
469
- const { exec } = await import('child_process');
470
- exec("npx drizzle-kit studio", (error, stdout, stderr) => {
471
- if (error) {
472
- console.error("\u274C Studio failed:", error.message);
473
- process.exit(1);
474
- }
475
- });
476
- });
477
- var authCommand = program.command("auth").description("Authentication management commands");
478
- authCommand.command("bootstrap").description("Create initial admin user").option("-e, --email <email>", "Admin email", process.env.KYRO_ADMIN_EMAIL).option(
479
- "-p, --password <password>",
480
- "Admin password",
481
- process.env.KYRO_ADMIN_PASSWORD
482
- ).option(
483
- "-r, --role <role>",
484
- "Admin role",
485
- process.env.KYRO_ADMIN_ROLE || "admin"
486
- ).action(async (options) => {
487
- if (!options.email || !options.password) {
488
- console.error(
489
- "\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."
490
- );
491
- process.exit(1);
492
- }
493
- try {
494
- const { bootstrapAdmin } = await import('../bootstrap-FUAPY2OF.cjs');
495
- const databaseUrl = process.env.DATABASE_URL || "";
496
- const isPostgres = databaseUrl.toLowerCase().startsWith("postgres://") || databaseUrl.toLowerCase().startsWith("postgresql://");
497
- const isMongo = databaseUrl.toLowerCase().startsWith("mongodb://") || databaseUrl.toLowerCase().startsWith("mongodb+srv://");
498
- const isSQLite = !databaseUrl || databaseUrl.includes(".db") || databaseUrl.includes("sqlite") || databaseUrl.includes("file:");
499
- let adapter;
500
- if (isPostgres) {
501
- const { PostgresAuthAdapter } = await import('../postgres-auth-adapter-SFDTLONT.cjs');
502
- const { drizzle } = await import('drizzle-orm/postgres-js');
503
- const { default: postgres } = await import('postgres');
504
- const client = postgres(databaseUrl, { max: 1, onnotice: () => {
505
- } });
506
- const db = drizzle(client);
507
- adapter = new PostgresAuthAdapter({ db });
508
- } else if (isMongo) {
509
- const { MongoDBAuthAdapter } = await import('../mongo-auth-adapter-GT4S7SCU.cjs');
510
- const { MongoClient } = await import('mongodb');
511
- const client = new MongoClient(databaseUrl);
512
- await client.connect();
513
- const db = client.db();
514
- adapter = new MongoDBAuthAdapter({ db });
515
- } else {
516
- const { SQLiteAuthAdapter } = await import('../sqlite-adapter-AQB5TCGV.cjs');
517
- const authDbPath = process.env.KYRO_AUTH_DB_PATH || "./data/auth.db";
518
- adapter = new SQLiteAuthAdapter({ path: authDbPath });
519
- }
520
- if (adapter.connect) {
521
- await adapter.connect();
522
- }
523
- const result = await bootstrapAdmin({
524
- authAdapter: adapter,
525
- adminEmail: options.email,
526
- adminPassword: options.password,
527
- adminRole: options.role
528
- });
529
- if (adapter.disconnect) {
530
- await adapter.disconnect();
531
- }
532
- if (result.success) {
533
- } else {
534
- console.error("\u274C Failed to create admin:", result.error);
535
- process.exit(1);
536
- }
537
- } catch (error) {
538
- console.error("\u274C Bootstrap failed:", error);
539
- process.exit(1);
540
- }
541
- });
542
- program.command("health").description("Check system health").action(async () => {
543
- const databaseUrl = process.env.DATABASE_URL || "";
544
- const isPostgres = databaseUrl.toLowerCase().startsWith("postgres://") || databaseUrl.toLowerCase().startsWith("postgresql://");
545
- const isMongo = databaseUrl.toLowerCase().startsWith("mongodb://") || databaseUrl.toLowerCase().startsWith("mongodb+srv://");
546
- const isSQLite = !databaseUrl || databaseUrl.includes(".db") || databaseUrl.includes("sqlite") || databaseUrl.includes("file:");
547
- if (isPostgres) {
548
- try {
549
- const { default: postgres } = await import('postgres');
550
- const client = postgres(databaseUrl, { max: 1, onnotice: () => {
551
- } });
552
- await client.unsafe("SELECT 1");
553
- await client.end();
554
- } catch {
555
- }
556
- } else if (isMongo) {
557
- try {
558
- const { MongoClient } = await import('mongodb');
559
- const client = new MongoClient(databaseUrl);
560
- await client.connect();
561
- await client.db().admin().ping();
562
- await client.close();
563
- } catch {
564
- }
565
- } else if (isSQLite) {
566
- try {
567
- const authDbPath = process.env.KYRO_AUTH_DB_PATH || "./data/auth.db";
568
- const { existsSync: existsSync2 } = await import('fs');
569
- if (existsSync2(authDbPath)) {
570
- } else {
571
- }
572
- } catch {
573
- }
574
- }
575
- });
576
- program.parse();
577
- if (!process.argv.slice(2).length) {
578
- program.outputHelp();
579
- }
580
- //# sourceMappingURL=index.cjs.map
581
- //# sourceMappingURL=index.cjs.map
211
+ `,n}function K(){return new commander.Command("generate").description("Generate TypeScript types from collection configs").option("-c, --config <path>","Path to config file or directory","./src/kyro").option("-o, --output <path>","Output file path","./src/types/kyro.d.ts").option("-w, --watch","Watch for changes and regenerate").option("--url <url>","URL of a running Kyro CMS instance (enables remote mode)").option("--api-key <key>","API key for authentication (required with --url)").action(async n=>{if(n.url){n.url||(console.error("\u274C --url is required when using --api"),process.exit(1)),n.apiKey||(console.error("\u274C --api-key is required when using --api"),process.exit(1));let o=path.resolve(n.output);try{let s=await q(n.url,n.apiKey),i=D(s),d=path.join(o,"..");fs.existsSync(d)||fs.mkdirSync(d,{recursive:!0}),fs.writeFileSync(o,i);}catch(s){console.error("\u274C Error:",s.message),process.exit(1);}return}let t=path.resolve(n.config),r=path.resolve(n.output);try{let o=await glob.glob(`${t}/**/*.{ts,js}`);o.length===0&&(console.error("\u274C No config files found at:",t),process.exit(1));let s=[];for(let a of o)try{let l=await import(a),u=Object.values(l).filter(c=>c&&c.slug&&c.fields);s.push(...u);}catch{console.warn(`\u26A0\uFE0F Could not parse: ${a}`);}s.length===0&&(console.error("\u274C No valid collection configs found"),process.exit(1));let i=T(s),d=path.join(r,"..");if(fs.existsSync(d)||fs.mkdirSync(d,{recursive:!0}),fs.writeFileSync(r,i),n.watch){let{watch:a}=await import('fs');a(t,{recursive:!0},async(l,u)=>{let c=[];for(let S of o)try{let k=await import(S+`?t=${Date.now()}`),v=Object.values(k).filter(h=>h&&h.slug&&h.fields);c.push(...v);}catch{}let f=T(c);fs.writeFileSync(r,f);});}}catch(o){console.error("\u274C Error:",o.message),process.exit(1);}})}var L=url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))),N=path.dirname(L),P="0.1.0";try{P=JSON.parse(fs.readFileSync(path.join(N,"../../package.json"),"utf-8")).version;}catch{}var p=new commander.Command;p.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(P);p.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async e=>{let{exec:n}=await import('child_process'),t=n(`astro dev --port ${e.port} --host ${e.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});t.stdout?.on("data",r=>process.stdout.write(r)),t.stderr?.on("data",r=>process.stderr.write(r)),process.on("SIGINT",()=>{t.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{t.kill("SIGTERM"),process.exit(0);});});p.addCommand(K());var g=p.command("db").description("Database management commands");g.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:e}=await import('child_process');e("npx drizzle-kit generate",(n,t,r)=>{n&&(console.error("\u274C Generation failed:",n.message),process.exit(1));});});g.command("migrate").description("Run database migrations").action(async()=>{let{exec:e}=await import('child_process');e("npx drizzle-kit migrate",(n,t,r)=>{n&&(console.error("\u274C Migration failed:",n.message),process.exit(1));});});g.command("push").description("Push schema to database (development)").action(async()=>{let{exec:e}=await import('child_process');e("npx drizzle-kit push",(n,t,r)=>{n&&(console.error("\u274C Push failed:",n.message),process.exit(1));});});g.command("seed").description("Seed database with initial data").action(async()=>{let{exec:e}=await import('child_process');e("npx tsx src/database/drizzle/seed.ts",(n,t,r)=>{n&&(console.error("\u274C Seeding failed:",n.message),process.exit(1));});});g.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:e}=await import('child_process');e("npx drizzle-kit studio",(n,t,r)=>{n&&(console.error("\u274C Studio failed:",n.message),process.exit(1));});});var F=p.command("auth").description("Authentication management commands");F.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async e=>{(!e.email||!e.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:n}=await import('../bootstrap-HIAV5ZFT.cjs'),t=process.env.DATABASE_URL||"",r=t.toLowerCase().startsWith("postgres://")||t.toLowerCase().startsWith("postgresql://"),o=t.toLowerCase().startsWith("mongodb://")||t.toLowerCase().startsWith("mongodb+srv://"),s=!t||t.includes(".db")||t.includes("sqlite")||t.includes("file:"),i;if(r){let{PostgresAuthAdapter:a}=await import('../postgres-auth-adapter-E7OGMDD4.cjs'),{drizzle:l}=await import('drizzle-orm/postgres-js'),{default:u}=await import('postgres'),c=u(t,{max:1,onnotice:()=>{}}),f=l(c);i=new a({db:f});}else if(o){let{MongoDBAuthAdapter:a}=await import('../mongo-auth-adapter-JYJ4GBZE.cjs'),{MongoClient:l}=await import('mongodb'),u=new l(t);await u.connect();let c=u.db();i=new a({db:c});}else {let{SQLiteAuthAdapter:a}=await import('../sqlite-adapter-W53Q32N5.cjs'),l=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";i=new a({path:l});}i.connect&&await i.connect();let d=await n({authAdapter:i,adminEmail:e.email,adminPassword:e.password,adminRole:e.role});i.disconnect&&await i.disconnect(),d.success||(console.error("\u274C Failed to create admin:",d.error),process.exit(1));}catch(n){console.error("\u274C Bootstrap failed:",n),process.exit(1);}});p.command("health").description("Check system health").action(async()=>{let e=process.env.DATABASE_URL||"",n=e.toLowerCase().startsWith("postgres://")||e.toLowerCase().startsWith("postgresql://"),t=e.toLowerCase().startsWith("mongodb://")||e.toLowerCase().startsWith("mongodb+srv://"),r=!e||e.includes(".db")||e.includes("sqlite")||e.includes("file:");if(n)try{let{default:o}=await import('postgres'),s=o(e,{max:1,onnotice:()=>{}});await s.unsafe("SELECT 1"),await s.end();}catch{}else if(t)try{let{MongoClient:o}=await import('mongodb'),s=new o(e);await s.connect(),await s.db().admin().ping(),await s.close();}catch{}else if(r)try{let o=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db",{existsSync:s}=await import('fs');s(o);}catch{}});p.parse();process.argv.slice(2).length||p.outputHelp();