@geekmidas/cli 10.0.0-alpha.61 → 10.0.0-alpha.63

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 (202) hide show
  1. package/README.md +2 -0
  2. package/dist/{HostingerProvider-DI_Pr2VE.mjs → HostingerProvider-DBBwpDjn.mjs} +2 -2
  3. package/dist/{HostingerProvider-DI_Pr2VE.mjs.map → HostingerProvider-DBBwpDjn.mjs.map} +1 -1
  4. package/dist/{HostingerProvider-CgDaD8VR.cjs → HostingerProvider-mJ7YruxH.cjs} +2 -2
  5. package/dist/{HostingerProvider-CgDaD8VR.cjs.map → HostingerProvider-mJ7YruxH.cjs.map} +1 -1
  6. package/dist/{LegacyStateStore-JbBVFp_2.cjs → LegacyStateStore-CP7SZwTP.cjs} +2 -2
  7. package/dist/{LegacyStateStore-JbBVFp_2.cjs.map → LegacyStateStore-CP7SZwTP.cjs.map} +1 -1
  8. package/dist/{LegacyStateStore-C7vFAxbu.mjs → LegacyStateStore-Q3GmKOdw.mjs} +2 -2
  9. package/dist/{LegacyStateStore-C7vFAxbu.mjs.map → LegacyStateStore-Q3GmKOdw.mjs.map} +1 -1
  10. package/dist/{LocalStateStore-DfUwQsL8.mjs → LocalStateStore-BGIXcrvX.mjs} +2 -2
  11. package/dist/{LocalStateStore-DfUwQsL8.mjs.map → LocalStateStore-BGIXcrvX.mjs.map} +1 -1
  12. package/dist/{LocalStateStore-DHj_-CQB.cjs → LocalStateStore-sS8mvLeq.cjs} +2 -2
  13. package/dist/{LocalStateStore-DHj_-CQB.cjs.map → LocalStateStore-sS8mvLeq.cjs.map} +1 -1
  14. package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs → OpenApiTsGenerator-CjHWFRDd.cjs} +2 -2
  15. package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs.map → OpenApiTsGenerator-CjHWFRDd.cjs.map} +1 -1
  16. package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs → OpenApiTsGenerator-CnAwhGxi.mjs} +2 -2
  17. package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs.map → OpenApiTsGenerator-CnAwhGxi.mjs.map} +1 -1
  18. package/dist/{S3StateStore-xqnpUrzy.cjs → S3StateStore-6jqITH2F.cjs} +2 -2
  19. package/dist/{S3StateStore-xqnpUrzy.cjs.map → S3StateStore-6jqITH2F.cjs.map} +1 -1
  20. package/dist/{S3StateStore-Dq6hHtzY.mjs → S3StateStore-D7l_lWJ3.mjs} +2 -2
  21. package/dist/{S3StateStore-Dq6hHtzY.mjs.map → S3StateStore-D7l_lWJ3.mjs.map} +1 -1
  22. package/dist/{SSMStateStore-5dBRwVlJ.cjs → SSMStateStore-B__F7IJa.cjs} +2 -2
  23. package/dist/{SSMStateStore-5dBRwVlJ.cjs.map → SSMStateStore-B__F7IJa.cjs.map} +1 -1
  24. package/dist/{SSMStateStore-SUmvAbLi.mjs → SSMStateStore-CAQDVpoc.mjs} +2 -2
  25. package/dist/{SSMStateStore-SUmvAbLi.mjs.map → SSMStateStore-CAQDVpoc.mjs.map} +1 -1
  26. package/dist/{bundler-DXATpO1T.cjs → bundler-DLfOn0ls.cjs} +3 -3
  27. package/dist/{bundler-DXATpO1T.cjs.map → bundler-DLfOn0ls.cjs.map} +1 -1
  28. package/dist/{bundler-B5VsKW-_.mjs → bundler-DyWI41Iy.mjs} +2 -2
  29. package/dist/{bundler-B5VsKW-_.mjs.map → bundler-DyWI41Iy.mjs.map} +1 -1
  30. package/dist/{cli-DQdrVkj2.cjs → cli-D-ZM-X2s.cjs} +12 -16
  31. package/dist/cli-D-ZM-X2s.cjs.map +1 -0
  32. package/dist/{cli-DEA_J3Sa.mjs → cli-PkVF28LM.mjs} +10 -14
  33. package/dist/cli-PkVF28LM.mjs.map +1 -0
  34. package/dist/{config-DXnkCEq0.cjs → config-BEJYKd4s.cjs} +132 -18
  35. package/dist/config-BEJYKd4s.cjs.map +1 -0
  36. package/dist/config-C2BUosLm.d.mts +256 -0
  37. package/dist/config-C2BUosLm.d.mts.map +1 -0
  38. package/dist/config-CemHVcIr.d.cts +256 -0
  39. package/dist/config-CemHVcIr.d.cts.map +1 -0
  40. package/dist/{config-C5-EEdmr.mjs → config-LKKCVCnC.mjs} +109 -19
  41. package/dist/config-LKKCVCnC.mjs.map +1 -0
  42. package/dist/config.cjs +6 -2
  43. package/dist/config.d.cts +4 -211
  44. package/dist/config.d.mts +4 -211
  45. package/dist/config.mjs +3 -3
  46. package/dist/define-CHBIEc5j.mjs +94 -0
  47. package/dist/define-CHBIEc5j.mjs.map +1 -0
  48. package/dist/define-Cv_QvDrg.cjs +141 -0
  49. package/dist/define-Cv_QvDrg.cjs.map +1 -0
  50. package/dist/deploy/public.cjs +174 -13
  51. package/dist/deploy/public.cjs.map +1 -0
  52. package/dist/deploy/public.d.cts +200 -292
  53. package/dist/deploy/public.d.cts.map +1 -1
  54. package/dist/deploy/public.d.mts +200 -292
  55. package/dist/deploy/public.d.mts.map +1 -1
  56. package/dist/deploy/public.mjs +136 -3
  57. package/dist/deploy/public.mjs.map +1 -0
  58. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  59. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  60. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  61. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  62. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  63. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  64. package/dist/{deploy-BbJdgQ2b.cjs → deploy-ABBI0lf1.cjs} +169 -561
  65. package/dist/deploy-ABBI0lf1.cjs.map +1 -0
  66. package/dist/deploy-BiMrP9i7.cjs +140 -0
  67. package/dist/deploy-BiMrP9i7.cjs.map +1 -0
  68. package/dist/{deploy-BJcLmVTc.mjs → deploy-CG8bfFij.mjs} +152 -532
  69. package/dist/deploy-CG8bfFij.mjs.map +1 -0
  70. package/dist/deploy-CGW-QY9D.mjs +135 -0
  71. package/dist/deploy-CGW-QY9D.mjs.map +1 -0
  72. package/dist/discover-B6yPpvRV.d.mts +99 -0
  73. package/dist/discover-B6yPpvRV.d.mts.map +1 -0
  74. package/dist/discover-B_IkPukx.d.cts +99 -0
  75. package/dist/discover-B_IkPukx.d.cts.map +1 -0
  76. package/dist/discover-BaT6bpnA.mjs +614 -0
  77. package/dist/discover-BaT6bpnA.mjs.map +1 -0
  78. package/dist/discover-C_6COHEv.cjs +729 -0
  79. package/dist/discover-C_6COHEv.cjs.map +1 -0
  80. package/dist/dokploy-CwdmlyQL.mjs +32 -0
  81. package/dist/dokploy-CwdmlyQL.mjs.map +1 -0
  82. package/dist/dokploy-QJxMhxdf.cjs +32 -0
  83. package/dist/dokploy-QJxMhxdf.cjs.map +1 -0
  84. package/dist/{encryption-DaA9gRXr.mjs → encryption-CbQG_ayW.mjs} +4 -4
  85. package/dist/{encryption-DaA9gRXr.mjs.map → encryption-CbQG_ayW.mjs.map} +1 -1
  86. package/dist/{encryption-ojzUo7-z.cjs → encryption-DXw3jj0c.cjs} +4 -4
  87. package/dist/{encryption-ojzUo7-z.cjs.map → encryption-DXw3jj0c.cjs.map} +1 -1
  88. package/dist/fakes-C9RiT6XG.mjs.map +1 -1
  89. package/dist/fakes-zW-jNAbQ.cjs.map +1 -1
  90. package/dist/{github-Cq57poPj.cjs → github-BH_mETav.cjs} +3 -3
  91. package/dist/{github-Cq57poPj.cjs.map → github-BH_mETav.cjs.map} +1 -1
  92. package/dist/{github-DmCj2u95.mjs → github-ciwbIwVa.mjs} +3 -3
  93. package/dist/{github-DmCj2u95.mjs.map → github-ciwbIwVa.mjs.map} +1 -1
  94. package/dist/{index-UiWCaGzU.d.cts → index-BtXDZQuF.d.cts} +2 -2
  95. package/dist/{index-Da1-oa9W.d.mts.map → index-BtXDZQuF.d.cts.map} +1 -1
  96. package/dist/{index-Da1-oa9W.d.mts → index-DrKzpHl-.d.mts} +2 -2
  97. package/dist/{index-UiWCaGzU.d.cts.map → index-DrKzpHl-.d.mts.map} +1 -1
  98. package/dist/index.cjs +60 -52
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.mjs +57 -49
  101. package/dist/index.mjs.map +1 -1
  102. package/dist/{migrate-BScRpCEx.cjs → migrate-6oa9y_f2.cjs} +5 -5
  103. package/dist/{migrate-BScRpCEx.cjs.map → migrate-6oa9y_f2.cjs.map} +1 -1
  104. package/dist/{migrate-5_J5JySj.mjs → migrate-ImBKTBcW.mjs} +5 -5
  105. package/dist/{migrate-5_J5JySj.mjs.map → migrate-ImBKTBcW.mjs.map} +1 -1
  106. package/dist/openapi.cjs +3 -3
  107. package/dist/openapi.d.cts +1 -1
  108. package/dist/openapi.d.mts +1 -1
  109. package/dist/openapi.mjs +3 -3
  110. package/dist/{ready-XlNx-Gbo.cjs → ready-BiG0rt4h.cjs} +3 -3
  111. package/dist/{ready-XlNx-Gbo.cjs.map → ready-BiG0rt4h.cjs.map} +1 -1
  112. package/dist/{ready-DQIy21W5.mjs → ready-Bpdnn2ON.mjs} +3 -3
  113. package/dist/{ready-DQIy21W5.mjs.map → ready-Bpdnn2ON.mjs.map} +1 -1
  114. package/dist/reconcile/public.cjs +1 -1
  115. package/dist/reconcile/public.d.cts +4 -77
  116. package/dist/reconcile/public.d.cts.map +1 -1
  117. package/dist/reconcile/public.d.mts +4 -77
  118. package/dist/reconcile/public.d.mts.map +1 -1
  119. package/dist/reconcile/public.mjs +1 -1
  120. package/dist/resolve-B1T0hUaR.mjs +170 -0
  121. package/dist/resolve-B1T0hUaR.mjs.map +1 -0
  122. package/dist/resolve-xytBTtG4.cjs +217 -0
  123. package/dist/resolve-xytBTtG4.cjs.map +1 -0
  124. package/dist/runtime-CMwtq0AL.cjs +163 -0
  125. package/dist/runtime-CMwtq0AL.cjs.map +1 -0
  126. package/dist/runtime-CXPlkZzs.d.mts +90 -0
  127. package/dist/runtime-CXPlkZzs.d.mts.map +1 -0
  128. package/dist/runtime-DbakJS8u.mjs +134 -0
  129. package/dist/runtime-DbakJS8u.mjs.map +1 -0
  130. package/dist/runtime-Dn_n-29S.d.cts +90 -0
  131. package/dist/runtime-Dn_n-29S.d.cts.map +1 -0
  132. package/dist/sandbox/config-worker.cjs +43 -0
  133. package/dist/sandbox/config-worker.cjs.map +1 -0
  134. package/dist/sandbox/config-worker.d.cts +1 -0
  135. package/dist/sandbox/config-worker.d.mts +1 -0
  136. package/dist/sandbox/config-worker.mjs +44 -0
  137. package/dist/sandbox/config-worker.mjs.map +1 -0
  138. package/dist/sandbox/discover-worker.cjs +44 -0
  139. package/dist/sandbox/discover-worker.cjs.map +1 -0
  140. package/dist/sandbox/discover-worker.d.cts +1 -0
  141. package/dist/sandbox/discover-worker.d.mts +1 -0
  142. package/dist/sandbox/discover-worker.mjs +45 -0
  143. package/dist/sandbox/discover-worker.mjs.map +1 -0
  144. package/dist/sandbox-M8UnLhXE.d.cts +126 -0
  145. package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
  146. package/dist/sandbox-M8UnLhXE.d.mts +126 -0
  147. package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
  148. package/dist/{workspace-Bp1xVaOz.mjs → schemas-Ckm_aBnF.cjs} +264 -969
  149. package/dist/schemas-Ckm_aBnF.cjs.map +1 -0
  150. package/dist/{workspace-B64Xk1Mb.cjs → schemas-D2LCF689.mjs} +195 -1155
  151. package/dist/schemas-D2LCF689.mjs.map +1 -0
  152. package/dist/{sniffer-CQmJnNJM.cjs → sniffer-D_SYc_pO.cjs} +379 -214
  153. package/dist/sniffer-D_SYc_pO.cjs.map +1 -0
  154. package/dist/{sniffer-bdleks5l.mjs → sniffer-aO_-s5vq.mjs} +346 -211
  155. package/dist/sniffer-aO_-s5vq.mjs.map +1 -0
  156. package/dist/target/public.cjs +15 -0
  157. package/dist/target/public.d.cts +28 -0
  158. package/dist/target/public.d.cts.map +1 -0
  159. package/dist/target/public.d.mts +28 -0
  160. package/dist/target/public.d.mts.map +1 -0
  161. package/dist/target/public.mjs +4 -0
  162. package/dist/terminal-D0f1u0LG.cjs +576 -0
  163. package/dist/terminal-D0f1u0LG.cjs.map +1 -0
  164. package/dist/terminal-gMxAo9Dj.mjs +517 -0
  165. package/dist/terminal-gMxAo9Dj.mjs.map +1 -0
  166. package/dist/{types-efNLu9xu.d.cts → types-CfLKGfC_.d.mts} +624 -34
  167. package/dist/types-CfLKGfC_.d.mts.map +1 -0
  168. package/dist/{types-Bp1mVxG0.d.mts → types-DIA7Li-J.d.cts} +626 -34
  169. package/dist/types-DIA7Li-J.d.cts.map +1 -0
  170. package/dist/vitest.cjs +2 -2
  171. package/dist/vitest.mjs +2 -2
  172. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  173. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  174. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  175. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  176. package/dist/workspace/index.cjs +1 -1
  177. package/dist/workspace/index.d.cts +3 -3
  178. package/dist/workspace/index.d.mts +3 -3
  179. package/dist/workspace/index.mjs +1 -1
  180. package/dist/workspace-Dh7rr7l4.mjs +1024 -0
  181. package/dist/workspace-Dh7rr7l4.mjs.map +1 -0
  182. package/dist/workspace-Kl4NG9IH.cjs +1196 -0
  183. package/dist/workspace-Kl4NG9IH.cjs.map +1 -0
  184. package/package.json +23 -13
  185. package/dist/cli-DEA_J3Sa.mjs.map +0 -1
  186. package/dist/cli-DQdrVkj2.cjs.map +0 -1
  187. package/dist/config-C5-EEdmr.mjs.map +0 -1
  188. package/dist/config-DXnkCEq0.cjs.map +0 -1
  189. package/dist/config.d.cts.map +0 -1
  190. package/dist/config.d.mts.map +0 -1
  191. package/dist/deploy-BJcLmVTc.mjs.map +0 -1
  192. package/dist/deploy-BbJdgQ2b.cjs.map +0 -1
  193. package/dist/discover-Bc-4eA_p.cjs +0 -299
  194. package/dist/discover-Bc-4eA_p.cjs.map +0 -1
  195. package/dist/discover-FrYvzkeC.mjs +0 -262
  196. package/dist/discover-FrYvzkeC.mjs.map +0 -1
  197. package/dist/sniffer-CQmJnNJM.cjs.map +0 -1
  198. package/dist/sniffer-bdleks5l.mjs.map +0 -1
  199. package/dist/types-Bp1mVxG0.d.mts.map +0 -1
  200. package/dist/types-efNLu9xu.d.cts.map +0 -1
  201. package/dist/workspace-B64Xk1Mb.cjs.map +0 -1
  202. package/dist/workspace-Bp1xVaOz.mjs.map +0 -1
@@ -1,5 +1,3 @@
1
- import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import { basename, isAbsolute, join } from "node:path";
3
1
  //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
4
2
  function getEnumValues(entries) {
5
3
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -2396,6 +2394,114 @@ function handleIntersectionResults(result, left, right) {
2396
2394
  result.value = merged.data;
2397
2395
  return result;
2398
2396
  }
2397
+ const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
2398
+ $ZodType.init(inst, def);
2399
+ const items = def.items;
2400
+ const memo = globalConfig.memoizer;
2401
+ memo?.attach(inst);
2402
+ inst._zod.parse = (payload, ctx) => {
2403
+ const input = payload.value;
2404
+ if (!Array.isArray(input)) {
2405
+ payload.issues.push({
2406
+ input,
2407
+ inst,
2408
+ expected: "tuple",
2409
+ code: "invalid_type"
2410
+ });
2411
+ return payload;
2412
+ }
2413
+ payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
2414
+ const proms = [];
2415
+ const optinStart = getTupleOptStart(items, "optin");
2416
+ const optoutStart = getTupleOptStart(items, "optout");
2417
+ if (!def.rest) {
2418
+ if (input.length < optinStart) {
2419
+ payload.issues.push({
2420
+ code: "too_small",
2421
+ minimum: optinStart,
2422
+ inclusive: true,
2423
+ input,
2424
+ inst,
2425
+ origin: "array"
2426
+ });
2427
+ return payload;
2428
+ }
2429
+ if (input.length > items.length) payload.issues.push({
2430
+ code: "too_big",
2431
+ maximum: items.length,
2432
+ inclusive: true,
2433
+ input,
2434
+ inst,
2435
+ origin: "array"
2436
+ });
2437
+ }
2438
+ const itemResults = new Array(items.length);
2439
+ const abortEarly = def.rest ? ctx?.abortEarly : void 0;
2440
+ let itemAborted = false;
2441
+ for (let i = 0; i < items.length; i++) {
2442
+ const r = items[i]._zod.run({
2443
+ value: input[i],
2444
+ issues: []
2445
+ }, ctx);
2446
+ if (r instanceof Promise) proms.push(r.then((rr) => {
2447
+ itemResults[i] = rr;
2448
+ }));
2449
+ else {
2450
+ itemResults[i] = r;
2451
+ if (abortEarly && !itemAborted && r.issues.length) itemAborted = aborted(r);
2452
+ }
2453
+ }
2454
+ if (def.rest && !itemAborted) {
2455
+ let i = items.length - 1;
2456
+ const rest = input.slice(items.length);
2457
+ let seen = payload.issues.length;
2458
+ for (const el of rest) {
2459
+ if (abortEarly && payload.issues.length !== seen) {
2460
+ if (aborted(payload, seen)) break;
2461
+ seen = payload.issues.length;
2462
+ }
2463
+ i++;
2464
+ const result = def.rest._zod.run({
2465
+ value: el,
2466
+ issues: []
2467
+ }, ctx);
2468
+ if (result instanceof Promise) proms.push(result.then((r) => handleTupleResult(r, payload, i)));
2469
+ else handleTupleResult(result, payload, i);
2470
+ }
2471
+ }
2472
+ if (proms.length) return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
2473
+ return handleTupleResults(itemResults, payload, items, input, optoutStart);
2474
+ };
2475
+ });
2476
+ function getTupleOptStart(items, key) {
2477
+ for (let i = items.length - 1; i >= 0; i--) if (!(key === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional")) return i + 1;
2478
+ return 0;
2479
+ }
2480
+ function handleTupleResult(result, final, index) {
2481
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
2482
+ final.value[index] = result.value;
2483
+ }
2484
+ function handleTupleResults(itemResults, final, items, input, optoutStart) {
2485
+ for (let i = 0; i < items.length; i++) {
2486
+ const r = itemResults[i];
2487
+ const isPresent = i < input.length;
2488
+ if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
2489
+ final.value.length = i;
2490
+ break;
2491
+ }
2492
+ if (r.issues.length) {
2493
+ if (!isPresent && i >= optoutStart) {
2494
+ final.value.length = i;
2495
+ break;
2496
+ }
2497
+ final.issues.push(...prefixIssues(i, r.issues));
2498
+ }
2499
+ final.value[i] = r.value;
2500
+ }
2501
+ for (let i = final.value.length - 1; i >= input.length; i--) if (items[i]._zod.optout === "optional" && final.value[i] === void 0) final.value.length = i;
2502
+ else break;
2503
+ return final;
2504
+ }
2399
2505
  const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
2400
2506
  $ZodType.init(inst, def);
2401
2507
  const memo = globalConfig.memoizer;
@@ -4427,6 +4533,58 @@ const intersectionProcessor = (schema, ctx, json, params) => {
4427
4533
  json.allOf = allOf;
4428
4534
  ctx.intersections.push(allOf);
4429
4535
  };
4536
+ const tupleProcessor = (schema, ctx, _json, params) => {
4537
+ const json = _json;
4538
+ const def = schema._zod.def;
4539
+ json.type = "array";
4540
+ const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
4541
+ const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
4542
+ const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
4543
+ ...params,
4544
+ path: [
4545
+ ...params.path,
4546
+ prefixPath,
4547
+ i
4548
+ ]
4549
+ }));
4550
+ const rest = def.rest ? processSchema(def.rest, ctx, {
4551
+ ...params,
4552
+ path: [
4553
+ ...params.path,
4554
+ restPath,
4555
+ ...ctx.target === "openapi-3.0" ? [def.items.length] : []
4556
+ ]
4557
+ }) : null;
4558
+ let minItems = def.items.length;
4559
+ while (minItems > 0) {
4560
+ const item = def.items[minItems - 1];
4561
+ if (!(ctx.io === "input" ? inputOptin(item) !== void 0 : item._zod.optout === "optional")) break;
4562
+ minItems--;
4563
+ }
4564
+ const maxItems = def.items.length;
4565
+ const isClosed = !def.rest;
4566
+ if (ctx.target === "draft-2020-12") {
4567
+ json.prefixItems = prefixItems;
4568
+ if (isClosed) json.items = false;
4569
+ else if (rest) json.items = rest;
4570
+ if (minItems > 0) json.minItems = minItems;
4571
+ if (isClosed) json.maxItems = maxItems;
4572
+ } else if (ctx.target === "openapi-3.0") {
4573
+ json.items = { anyOf: prefixItems };
4574
+ if (rest) json.items.anyOf.push(rest);
4575
+ if (minItems > 0) json.minItems = minItems;
4576
+ if (isClosed) json.maxItems = maxItems;
4577
+ } else {
4578
+ json.items = prefixItems;
4579
+ if (isClosed) json.additionalItems = false;
4580
+ else if (rest) json.additionalItems = rest;
4581
+ if (minItems > 0) json.minItems = minItems;
4582
+ if (isClosed) json.maxItems = maxItems;
4583
+ }
4584
+ const { minimum, maximum } = aggregateChecks(schema);
4585
+ if (typeof minimum === "number") json.minItems = minimum;
4586
+ if (typeof maximum === "number") json.maxItems = maximum;
4587
+ };
4430
4588
  /** JSON object keys are always strings, so a numeric record key schema is re-expressed over the
4431
4589
  * numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key
4432
4590
  * behind a wrapper only carries its own `type` before then, and a union key only has its branches.
@@ -4662,7 +4820,7 @@ const initializer = (inst, issues) => {
4662
4820
  const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
4663
4821
  //#endregion
4664
4822
  //#region ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
4665
- const parse$1 = /* @__PURE__ */ _parse(ZodRealError);
4823
+ const parse = /* @__PURE__ */ _parse(ZodRealError);
4666
4824
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
4667
4825
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
4668
4826
  const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
@@ -4794,7 +4952,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
4794
4952
  own(this, "~standard", value);
4795
4953
  },
4796
4954
  parse: function _parse(data, params) {
4797
- return parse$1(this, data, params, { callee: _parse });
4955
+ return parse(this, data, params, { callee: _parse });
4798
4956
  },
4799
4957
  parseAsync: async function _parseAsync(data, params) {
4800
4958
  return await parseAsync(this, data, params, { callee: _parseAsync });
@@ -5318,6 +5476,39 @@ function intersection(left, right) {
5318
5476
  right
5319
5477
  });
5320
5478
  }
5479
+ const ZodTuple = /*@__PURE__*/ $constructor("ZodTuple", (inst, def) => {
5480
+ _ensureDefaultMemoizer();
5481
+ $ZodTuple.init(inst, def);
5482
+ ZodType.init(inst, def);
5483
+ inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
5484
+ }, {
5485
+ rest(rest) {
5486
+ return this.clone({
5487
+ ...this._zod.def,
5488
+ rest
5489
+ });
5490
+ },
5491
+ partial() {
5492
+ const def = this._zod.def;
5493
+ if (def.checks?.length) throw new Error(".partial() cannot be used on tuple schemas containing refinements");
5494
+ return this.clone({
5495
+ ...def,
5496
+ items: def.items.map((item) => new ZodOptional({
5497
+ type: "optional",
5498
+ innerType: item
5499
+ }))
5500
+ });
5501
+ }
5502
+ });
5503
+ function tuple(items, _paramsOrRest, _params) {
5504
+ const hasRest = _paramsOrRest instanceof $ZodType;
5505
+ return new ZodTuple({
5506
+ type: "tuple",
5507
+ items,
5508
+ rest: hasRest ? _paramsOrRest : null,
5509
+ ...normalizeParams(hasRest ? _params : _paramsOrRest)
5510
+ });
5511
+ }
5321
5512
  const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5322
5513
  _ensureDefaultMemoizer();
5323
5514
  $ZodRecord.init(inst, def);
@@ -5563,985 +5754,89 @@ function superRefine(fn, params) {
5563
5754
  return /* @__PURE__ */ _superRefine(fn, params);
5564
5755
  }
5565
5756
  //#endregion
5566
- //#region src/workspace/stages.ts
5567
- /**
5568
- * What `gkm test` runs as. The CLI's own, so no project stage may take it:
5569
- * its containers are torn down and rebuilt between runs.
5570
- */
5571
- const TEST_STAGE = "test";
5572
- /** A stage becomes part of every physical name, so it has to fit in one. */
5573
- const STAGE_NAME = /^[a-z][a-z0-9-]*$/;
5574
- /** Everything wrong with one stage name, or nothing. */
5575
- function nameProblems(name) {
5576
- const problems = [];
5577
- if (!STAGE_NAME.test(name)) problems.push(`stage "${name}" must be lowercase letters, digits and hyphens, starting with a letter`);
5578
- if (name === "test") problems.push(`stage "${TEST_STAGE}" is reserved for gkm test`);
5579
- return problems;
5580
- }
5581
- /** Everything wrong with a list of deployed stages on its own. */
5582
- function deployedProblems(deployed) {
5583
- const problems = deployed.flatMap(nameProblems);
5584
- const seen = /* @__PURE__ */ new Set();
5585
- for (const name of deployed) {
5586
- if (seen.has(name)) problems.push(`stage "${name}" is listed twice`);
5587
- seen.add(name);
5588
- }
5589
- return problems;
5590
- }
5591
- /** Everything wrong with a stages block, or nothing. */
5592
- function stageProblems(stages) {
5593
- if (!stages) return ["`stages` is required, e.g. stages: { local: 'dev', deployed: ['prod'] }"];
5594
- const { local, deployed, protected: kept = [] } = stages;
5595
- const problems = [...nameProblems(local), ...deployedProblems(deployed)];
5596
- if (deployed.includes(local)) problems.push(`"${local}" is both the local stage and a deployed one; they would share secrets`);
5597
- for (const name of kept) if (!deployed.includes(name)) problems.push(`protected stage "${name}" is not a deployed stage`);
5598
- return problems;
5599
- }
5600
- /** The stages block, or an error naming everything wrong with it. */
5601
- function validateStages(stages) {
5602
- const problems = stageProblems(stages);
5603
- if (problems.length) throw new InvalidStages(problems);
5604
- return stages;
5605
- }
5606
- /** Refuses a stage the project does not deploy to. */
5607
- function assertDeployedStage(stages, stage) {
5608
- if (!stages.deployed.includes(stage)) throw new UndeclaredStage(stage, stages.deployed);
5609
- }
5610
- /** A stages block — in gkm.config.ts or from `gkm init`'s flags — that breaks a rule. */
5611
- var InvalidStages = class extends Error {
5612
- problems;
5613
- constructor(problems) {
5614
- super(`Invalid stages:\n ${problems.join("\n ")}`);
5615
- this.problems = problems;
5616
- this.name = "InvalidStages";
5617
- }
5618
- };
5619
- /**
5620
- * A stage the project does not deploy to. Refused before anything is
5621
- * provisioned, so a typo does not become a second environment.
5622
- */
5623
- var UndeclaredStage = class extends Error {
5624
- stage;
5625
- deployed;
5626
- constructor(stage, deployed) {
5627
- super(`"${stage}" is not a deployed stage. gkm.config.ts deploys to: ${deployed.join(", ") || "nothing yet"}.`);
5628
- this.stage = stage;
5629
- this.deployed = deployed;
5630
- this.name = "UndeclaredStage";
5757
+ Object.defineProperty(exports, "_enum", {
5758
+ enumerable: true,
5759
+ get: function() {
5760
+ return _enum;
5631
5761
  }
5632
- };
5633
- //#endregion
5634
- //#region src/workspace/schema.ts
5635
- /** Routes are a glob, or a list of them. */
5636
- const RoutesSchema = union([string(), array(string())]);
5637
- /**
5638
- * Telescope configuration schema.
5639
- */
5640
- const TelescopeConfigSchema = object({
5641
- enabled: boolean().optional(),
5642
- port: number().optional(),
5643
- path: string().optional(),
5644
- ignore: array(string()).optional(),
5645
- recordBody: boolean().optional(),
5646
- maxEntries: number().optional(),
5647
- websocket: boolean().optional()
5648
- });
5649
- /**
5650
- * OpenAPI configuration schema.
5651
- */
5652
- const OpenApiConfigSchema = object({
5653
- enabled: boolean().optional(),
5654
- title: string().optional(),
5655
- version: string().optional(),
5656
- description: string().optional()
5657
- });
5658
- /**
5659
- * Hooks configuration schema.
5660
- */
5661
- const HooksConfigSchema = object({ server: string().optional() });
5662
- /**
5663
- * Combined framework schema (backend, frontend, or mobile).
5664
- */
5665
- const FrameworkSchema = union([
5666
- _enum([
5667
- "hono",
5668
- "better-auth",
5669
- "express",
5670
- "fastify"
5671
- ]),
5672
- _enum([
5673
- "nextjs",
5674
- "remix",
5675
- "vite",
5676
- "tanstack-start"
5677
- ]),
5678
- _enum(["expo"])
5679
- ]);
5680
- /** Frontend framework values, kept in sync with FrontendFrameworkSchema. */
5681
- const FRONTEND_FRAMEWORKS = [
5682
- "nextjs",
5683
- "remix",
5684
- "vite",
5685
- "tanstack-start"
5686
- ];
5687
- /** Mobile framework values, kept in sync with MobileFrameworkSchema. */
5688
- const MOBILE_FRAMEWORKS = ["expo"];
5689
- /**
5690
- * Deploy target schema.
5691
- * 'dokploy' is deployed by `gkm deploy`; 'sst' by `sst deploy`, from the
5692
- * manifest `gkm build` writes.
5693
- * 'vercel' and 'cloudflare' are planned for Phase 2.
5694
- */
5695
- const DeployTargetSchema = _enum([
5696
- "dokploy",
5697
- "sst",
5698
- "vercel",
5699
- "cloudflare"
5700
- ]);
5701
- /**
5702
- * Supported deploy targets (Phase 1).
5703
- */
5704
- const SUPPORTED_DEPLOY_TARGETS = ["dokploy", "sst"];
5705
- /**
5706
- * Phase 2 deploy targets (not yet implemented).
5707
- */
5708
- const PHASE_2_DEPLOY_TARGETS = ["vercel", "cloudflare"];
5709
- /**
5710
- * Check if a deploy target is supported.
5711
- */
5712
- function isDeployTargetSupported(target) {
5713
- return SUPPORTED_DEPLOY_TARGETS.includes(target);
5714
- }
5715
- /**
5716
- * Check if a deploy target is planned for Phase 2.
5717
- */
5718
- function isPhase2DeployTarget(target) {
5719
- return PHASE_2_DEPLOY_TARGETS.includes(target);
5720
- }
5721
- /**
5722
- * Get error message for unsupported deploy targets.
5723
- */
5724
- function getDeployTargetError(target, appName) {
5725
- if (isPhase2DeployTarget(target)) return `Deploy target "${target}"${appName ? ` for app "${appName}"` : ""} is coming in Phase 2. Currently "dokploy" and "sst" are supported.`;
5726
- return `Unknown deploy target: ${target}. Supported: dokploy, sst. Coming in Phase 2: vercel, cloudflare.`;
5727
- }
5728
- /**
5729
- * Dokploy workspace configuration schema.
5730
- * Supports either a single endpoint or per-stage endpoints.
5731
- */
5732
- const DokployWorkspaceConfigSchema = object({
5733
- /** Single endpoint for all stages */
5734
- endpoint: url("Dokploy endpoint must be a valid URL").optional(),
5735
- /** Per-stage endpoints (stage name -> endpoint URL) */
5736
- endpoints: record(string(), url("Endpoint must be a valid URL")).optional(),
5737
- registry: string().optional(),
5738
- registryId: string().optional()
5739
- }).refine((data) => data.endpoint || data.endpoints, { message: "Either endpoint or endpoints must be provided" });
5740
- /**
5741
- * Valid AWS regions.
5742
- */
5743
- const AwsRegionSchema = _enum([
5744
- "us-east-1",
5745
- "us-east-2",
5746
- "us-west-1",
5747
- "us-west-2",
5748
- "af-south-1",
5749
- "ap-east-1",
5750
- "ap-south-1",
5751
- "ap-south-2",
5752
- "ap-southeast-1",
5753
- "ap-southeast-2",
5754
- "ap-southeast-3",
5755
- "ap-southeast-4",
5756
- "ap-northeast-1",
5757
- "ap-northeast-2",
5758
- "ap-northeast-3",
5759
- "ca-central-1",
5760
- "eu-central-1",
5761
- "eu-central-2",
5762
- "eu-west-1",
5763
- "eu-west-2",
5764
- "eu-west-3",
5765
- "eu-south-1",
5766
- "eu-south-2",
5767
- "eu-north-1",
5768
- "me-south-1",
5769
- "me-central-1",
5770
- "sa-east-1"
5771
- ]);
5772
- /**
5773
- * DNS record types supported across providers.
5774
- */
5775
- const DnsRecordTypeSchema = _enum([
5776
- "A",
5777
- "AAAA",
5778
- "CNAME",
5779
- "MX",
5780
- "TXT",
5781
- "NS",
5782
- "SRV",
5783
- "CAA"
5784
- ]);
5785
- object({
5786
- /** Subdomain name (e.g., 'api' for api.example.com, '@' for root) */
5787
- name: string(),
5788
- /** Record type */
5789
- type: DnsRecordTypeSchema,
5790
- /** TTL in seconds */
5791
- ttl: number().int().positive(),
5792
- /** Record values */
5793
- values: array(string())
5794
- });
5795
- object({
5796
- /** The record that was upserted */
5797
- record: object({
5798
- /** Subdomain name (e.g., 'api' for api.example.com, '@' for root) */
5799
- name: string(),
5800
- /** Record type */
5801
- type: DnsRecordTypeSchema,
5802
- /** TTL in seconds */
5803
- ttl: number().int().positive(),
5804
- /** Record value (IP address, hostname, etc.) */
5805
- value: string()
5806
- }),
5807
- /** Whether the record was created (true) or updated (false) */
5808
- created: boolean(),
5809
- /** Whether the record already existed with the same value */
5810
- unchanged: boolean()
5811
- });
5812
- /**
5813
- * Hostinger DNS provider config (without domain - domain is the record key).
5814
- */
5815
- const HostingerDnsProviderSchema = object({
5816
- provider: literal("hostinger"),
5817
- /** TTL in seconds (default: 300) */
5818
- ttl: number().int().positive().optional()
5819
5762
  });
5820
- /**
5821
- * Route53 DNS provider config (without domain - domain is the record key).
5822
- */
5823
- const Route53DnsProviderSchema = object({
5824
- provider: literal("route53"),
5825
- /** AWS region (optional - uses AWS_REGION env var if not provided) */
5826
- region: AwsRegionSchema.optional(),
5827
- /** AWS profile name (optional - uses default credential chain if not provided) */
5828
- profile: string().optional(),
5829
- /** Hosted zone ID (optional - auto-detected from domain if not provided) */
5830
- hostedZoneId: string().optional(),
5831
- /** TTL in seconds (default: 300) */
5832
- ttl: number().int().positive().optional()
5833
- });
5834
- /**
5835
- * Cloudflare DNS provider config (placeholder for future).
5836
- */
5837
- const CloudflareDnsProviderSchema = object({
5838
- provider: literal("cloudflare"),
5839
- /** TTL in seconds (default: 300) */
5840
- ttl: number().int().positive().optional()
5841
- });
5842
- /**
5843
- * Manual DNS configuration (user handles DNS themselves).
5844
- */
5845
- const ManualDnsProviderSchema = object({ provider: literal("manual") });
5846
- /**
5847
- * Custom DNS provider config (user-provided implementation).
5848
- */
5849
- const CustomDnsProviderSchema = object({
5850
- /** Custom DnsProvider implementation */
5851
- provider: custom((val) => typeof val === "object" && val !== null && typeof val.name === "string" && typeof val.getRecords === "function" && typeof val.upsertRecords === "function", { message: "Custom DNS provider must implement name, getRecords(), and upsertRecords() methods" }),
5852
- /** TTL in seconds (default: 300) */
5853
- ttl: number().int().positive().optional()
5854
- });
5855
- /**
5856
- * Single DNS provider config (for one domain).
5857
- */
5858
- const DnsProviderSchema = union([discriminatedUnion("provider", [
5859
- HostingerDnsProviderSchema,
5860
- Route53DnsProviderSchema,
5861
- CloudflareDnsProviderSchema,
5862
- ManualDnsProviderSchema
5863
- ]), CustomDnsProviderSchema]);
5864
- /**
5865
- * DNS configuration schema.
5866
- *
5867
- * Maps root domains to their DNS provider configuration.
5868
- * Example:
5869
- * ```
5870
- * dns: {
5871
- * 'geekmidas.dev': { provider: 'hostinger' },
5872
- * 'geekmidas.com': { provider: 'route53' },
5873
- * }
5874
- * ```
5875
- *
5876
- * Supported providers:
5877
- * - 'hostinger': Use Hostinger DNS API
5878
- * - 'route53': Use AWS Route53
5879
- * - 'cloudflare': Use Cloudflare DNS API (future)
5880
- * - 'manual': Don't create records, just print required records
5881
- * - Custom: Provide a DnsProvider implementation
5882
- */
5883
- const DnsConfigSchema = record(string(), DnsProviderSchema);
5884
- const HostingerDnsConfigSchema = HostingerDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
5885
- const Route53DnsConfigSchema = Route53DnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
5886
- const CloudflareDnsConfigSchema = CloudflareDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
5887
- const ManualDnsConfigSchema = ManualDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
5888
- const CustomDnsConfigSchema = CustomDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
5889
- /**
5890
- * Combined DNS config that supports both new multi-domain and legacy single-domain formats.
5891
- */
5892
- const DnsConfigWithLegacySchema = union([DnsConfigSchema, union([discriminatedUnion("provider", [
5893
- HostingerDnsConfigSchema,
5894
- Route53DnsConfigSchema,
5895
- CloudflareDnsConfigSchema,
5896
- ManualDnsConfigSchema
5897
- ]), CustomDnsConfigSchema])]);
5898
- /**
5899
- * Backups configuration schema.
5900
- *
5901
- * Configures automatic backup destinations for database services.
5902
- * On first deploy, creates S3 bucket with unique name and IAM credentials.
5903
- */
5904
- const BackupsConfigSchema = object({
5905
- /** Backup storage type (currently only 's3' supported) */
5906
- type: literal("s3"),
5907
- /** AWS profile name for creating bucket/IAM resources */
5908
- profile: string().optional(),
5909
- /** AWS region for the backup bucket */
5910
- region: AwsRegionSchema,
5911
- /** Cron schedule for backups (default: '0 2 * * *' = 2 AM daily) */
5912
- schedule: string().optional(),
5913
- /** Number of backups to retain (default: 30) */
5914
- retention: number().optional()
5915
- });
5916
- /**
5917
- * Deploy configuration schema.
5918
- */
5919
- const DeployConfigSchema = object({
5920
- default: DeployTargetSchema.optional(),
5921
- /** Whose deploy this is, on a target shared with other workspaces. */
5922
- namespace: string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "deploy.namespace must be lowercase letters and digits with single '-' between them").optional(),
5923
- /** Each deployed stage's base domain (stage name -> domain). */
5924
- domains: record(string(), string()).optional(),
5925
- dokploy: DokployWorkspaceConfigSchema.optional(),
5926
- dns: DnsConfigWithLegacySchema.optional(),
5927
- backups: BackupsConfigSchema.optional()
5928
- });
5929
- /**
5930
- * Models configuration schema.
5931
- */
5932
- const ModelsConfigSchema = object({
5933
- path: string().optional(),
5934
- schema: _enum(["zod"]).optional()
5935
- });
5936
- /**
5937
- * Shared configuration schema.
5938
- */
5939
- const SharedConfigSchema = object({
5940
- packages: array(string()).optional(),
5941
- models: ModelsConfigSchema.optional()
5942
- });
5943
- /**
5944
- * Secrets configuration schema.
5945
- */
5946
- const StagesConfigSchema = object({
5947
- local: string(),
5948
- deployed: array(string()),
5949
- protected: array(string()).optional()
5950
- }).superRefine((stages, ctx) => {
5951
- for (const message of stageProblems(stages)) ctx.addIssue({
5952
- code: "custom",
5953
- message
5954
- });
5955
- });
5956
- const SecretsStoreSchema = union([
5957
- literal("file"),
5958
- object({
5959
- provider: literal("ssm"),
5960
- region: AwsRegionSchema
5961
- }).strict(),
5962
- object({
5963
- /** Any backend: an object implementing SecretsStore */
5964
- provider: custom((val) => typeof val === "object" && val !== null && typeof val.name === "string" && typeof val.read === "function" && typeof val.write === "function", { message: "a secrets store has a name, read() and write()" }) })
5965
- ]);
5966
- const SecretsConfigSchema = object({
5967
- enabled: boolean().optional(),
5968
- store: SecretsStoreSchema.optional(),
5969
- algorithm: string().optional(),
5970
- kdf: _enum(["scrypt", "pbkdf2"]).optional()
5971
- });
5972
- /**
5973
- * Local state provider config.
5974
- */
5975
- const LocalStateConfigSchema = object({ provider: literal("local") });
5976
- /**
5977
- * SSM state provider config (requires region).
5978
- */
5979
- const SSMStateConfigSchema = object({
5980
- provider: literal("ssm"),
5981
- /** AWS region (required for SSM provider) */
5982
- region: AwsRegionSchema,
5983
- /** AWS profile name (optional - uses default credential chain if not provided) */
5984
- profile: string().optional()
5985
- });
5986
- /**
5987
- * S3 state provider config: conditional writes and a lock object in a bucket.
5988
- */
5989
- const S3StateConfigSchema = object({
5990
- provider: literal("s3"),
5991
- /** Bucket the state lives in (must already exist) */
5992
- bucket: string().min(1),
5993
- /** AWS region of the bucket */
5994
- region: AwsRegionSchema,
5995
- /** Key prefix inside the bucket (default: 'gkm') */
5996
- prefix: string().optional(),
5997
- /** AWS profile name (optional - uses default credential chain if not provided) */
5998
- profile: string().optional()
5999
- });
6000
- /**
6001
- * Custom state provider config (user-provided implementation).
6002
- */
6003
- const CustomStateConfigSchema = object({
6004
- /** Custom StateProvider implementation */
6005
- provider: custom((val) => typeof val === "object" && val !== null && typeof val.read === "function" && typeof val.write === "function", { message: "Custom provider must implement read() and write() methods" }) });
6006
- /**
6007
- * State configuration schema.
6008
- *
6009
- * Configures how deployment state is stored.
6010
- * - 'local': Store in .gkm/deploy-{stage}.json (default)
6011
- * - 'ssm': Store in AWS SSM Parameter Store (requires region)
6012
- * - 's3': Store in an S3 bucket with conditional writes (requires bucket, region)
6013
- * - Custom: Provide a StateStore, or a StateProvider with read/write methods
6014
- */
6015
- const StateConfigSchema = union([discriminatedUnion("provider", [
6016
- LocalStateConfigSchema,
6017
- SSMStateConfigSchema,
6018
- S3StateConfigSchema
6019
- ]), CustomStateConfigSchema]);
6020
- /**
6021
- * App configuration schema.
6022
- */
6023
- const AppConfigSchema = object({
6024
- type: _enum([
6025
- "backend",
6026
- "web",
6027
- "mobile"
6028
- ]).optional().default("backend"),
6029
- path: string().min(1, "App path is required"),
6030
- port: number().int().positive("Port must be a positive integer"),
6031
- dependencies: array(string()).optional(),
6032
- deploy: DeployTargetSchema.optional(),
6033
- constructs: RoutesSchema.optional(),
6034
- routes: RoutesSchema.optional(),
6035
- functions: RoutesSchema.optional(),
6036
- crons: RoutesSchema.optional(),
6037
- queues: RoutesSchema.optional(),
6038
- topics: RoutesSchema.optional(),
6039
- subscribers: RoutesSchema.optional(),
6040
- envParser: string().optional(),
6041
- logger: string().optional(),
6042
- hooks: HooksConfigSchema.optional(),
6043
- telescope: union([
6044
- string(),
6045
- boolean(),
6046
- TelescopeConfigSchema
6047
- ]).optional(),
6048
- openapi: union([boolean(), OpenApiConfigSchema]).optional(),
6049
- runtime: _enum(["node", "bun"]).optional(),
6050
- env: union([string(), array(string())]).optional(),
6051
- entry: string().optional(),
6052
- framework: FrameworkSchema.optional(),
6053
- config: object({
6054
- client: string().optional(),
6055
- server: string().optional()
6056
- }).optional()
6057
- }).refine((data) => {
6058
- if (data.type === "web") {
6059
- if (!data.framework || !FRONTEND_FRAMEWORKS.includes(data.framework)) return false;
5763
+ Object.defineProperty(exports, "array", {
5764
+ enumerable: true,
5765
+ get: function() {
5766
+ return array;
6060
5767
  }
6061
- return true;
6062
- }, {
6063
- message: `Web apps must have a valid web framework (${FRONTEND_FRAMEWORKS.join(", ")})`,
6064
- path: ["framework"]
6065
- }).refine((data) => {
6066
- if (data.type === "mobile") {
6067
- if (!data.framework || !MOBILE_FRAMEWORKS.includes(data.framework)) return false;
5768
+ });
5769
+ Object.defineProperty(exports, "boolean", {
5770
+ enumerable: true,
5771
+ get: function() {
5772
+ return boolean;
6068
5773
  }
6069
- return true;
6070
- }, {
6071
- message: `Mobile apps must have a valid mobile framework (${MOBILE_FRAMEWORKS.join(", ")})`,
6072
- path: ["framework"]
6073
- });
6074
- /** What `gkm test` hands a feature test. */
6075
- const TestConfigSchema = object({
6076
- /** The folder of per-database factories; `test/factories` by default. */
6077
- factories: string().optional() }).strict();
6078
- /** How `gkm dev` is reached from outside the apps it runs. */
6079
- const DevConfigSchema = object({
6080
- /** Browser origins that may read the discovery endpoint. */
6081
- allowedOrigins: array(url().refine((value) => URL.canParse(value) && new URL(value).origin === value, { message: "An origin is a scheme, host and port only, e.g. https://console.example.com — no path or trailing slash" })).optional(),
6082
- /** The discovery endpoint's loopback port; 4983 by default. */
6083
- discoveryPort: number().int().min(0).max(65535).optional()
6084
- }).strict();
6085
- /**
6086
- * Workspace configuration schema.
6087
- */
6088
- const WorkspaceConfigSchema = object({
6089
- name: string().optional(),
6090
- /**
6091
- * Where the workspace's own constructs live, relative to its root.
6092
- *
6093
- * Infrastructure is a fact about the product, not about the process that
6094
- * happens to import it — so a database two apps share is declared once,
6095
- * at the top, and both find it. An app-level glob still works and is
6096
- * additive, for something only one app uses.
6097
- */
6098
- constructs: RoutesSchema.optional(),
6099
- /**
6100
- * Apps that nothing declares.
6101
- *
6102
- * Optional, and normally absent: a `site` is an app and so is a
6103
- * `rest-api` that named one, so the list is read off the graph. This is
6104
- * the escape hatch for what no construct describes — a mobile app, a
6105
- * process someone runs by hand — and for overriding one field of a
6106
- * derived app without restating it.
6107
- */
6108
- apps: record(string(), AppConfigSchema).optional(),
6109
- shared: SharedConfigSchema.optional(),
6110
- deploy: DeployConfigSchema.optional(),
6111
- stages: StagesConfigSchema,
6112
- secrets: SecretsConfigSchema.optional(),
6113
- state: StateConfigSchema.optional(),
6114
- test: TestConfigSchema.optional(),
6115
- dev: DevConfigSchema.optional()
6116
- }).strict().refine((data) => {
6117
- const appNames = Object.keys(data.apps ?? {});
6118
- for (const [appName, app] of Object.entries(data.apps ?? {})) for (const dep of app.dependencies ?? []) {
6119
- if (!appNames.includes(dep)) return false;
6120
- if (dep === appName) return false;
5774
+ });
5775
+ Object.defineProperty(exports, "custom", {
5776
+ enumerable: true,
5777
+ get: function() {
5778
+ return custom;
6121
5779
  }
6122
- return true;
6123
- }, { message: "App dependencies must reference existing apps and cannot be self-referential" }).refine((data) => {
6124
- const appNames = Object.keys(data.apps ?? {});
6125
- const visited = /* @__PURE__ */ new Set();
6126
- const recStack = /* @__PURE__ */ new Set();
6127
- function hasCycle(app) {
6128
- if (recStack.has(app)) return true;
6129
- if (visited.has(app)) return false;
6130
- visited.add(app);
6131
- recStack.add(app);
6132
- const deps = data.apps?.[app]?.dependencies ?? [];
6133
- for (const dep of deps) if (hasCycle(dep)) return true;
6134
- recStack.delete(app);
6135
- return false;
5780
+ });
5781
+ Object.defineProperty(exports, "discriminatedUnion", {
5782
+ enumerable: true,
5783
+ get: function() {
5784
+ return discriminatedUnion;
6136
5785
  }
6137
- for (const app of appNames) {
6138
- visited.clear();
6139
- recStack.clear();
6140
- if (hasCycle(app)) return false;
5786
+ });
5787
+ Object.defineProperty(exports, "literal", {
5788
+ enumerable: true,
5789
+ get: function() {
5790
+ return literal;
6141
5791
  }
6142
- return true;
6143
- }, { message: "Circular dependencies detected between apps" }).superRefine((data, ctx) => {
6144
- const defaultTarget = data.deploy?.default;
6145
- if (defaultTarget && !isDeployTargetSupported(defaultTarget)) {
6146
- ctx.addIssue({
6147
- code: "custom",
6148
- message: getDeployTargetError(defaultTarget),
6149
- path: ["deploy", "default"]
6150
- });
6151
- return;
5792
+ });
5793
+ Object.defineProperty(exports, "number", {
5794
+ enumerable: true,
5795
+ get: function() {
5796
+ return number;
6152
5797
  }
6153
- for (const [appName, app] of Object.entries(data.apps ?? {})) if (app.deploy && !isDeployTargetSupported(app.deploy)) {
6154
- ctx.addIssue({
6155
- code: "custom",
6156
- message: getDeployTargetError(app.deploy, appName),
6157
- path: [
6158
- "apps",
6159
- appName,
6160
- "deploy"
6161
- ]
6162
- });
6163
- return;
5798
+ });
5799
+ Object.defineProperty(exports, "object", {
5800
+ enumerable: true,
5801
+ get: function() {
5802
+ return object;
6164
5803
  }
6165
- if (data.state?.provider === "ssm" && !data.name) ctx.addIssue({
6166
- code: "custom",
6167
- message: "Workspace name is required when using SSM state provider. Add \"name\" to your gkm.config.ts.",
6168
- path: ["name"]
6169
- });
6170
5804
  });
6171
- /**
6172
- * Validate workspace configuration.
6173
- * Throws ZodError with detailed messages on validation failure.
6174
- */
6175
- function validateWorkspaceConfig(config) {
6176
- return WorkspaceConfigSchema.parse(config);
6177
- }
6178
- /**
6179
- * Safe validation that returns result instead of throwing.
6180
- */
6181
- function safeValidateWorkspaceConfig(config) {
6182
- const result = WorkspaceConfigSchema.safeParse(config);
6183
- if (result.success) return {
6184
- success: true,
6185
- data: result.data
6186
- };
6187
- return {
6188
- success: false,
6189
- error: result.error
6190
- };
6191
- }
6192
- /**
6193
- * Format Zod errors into user-friendly messages.
6194
- */
6195
- function formatValidationErrors(error) {
6196
- return `Workspace configuration validation failed:\n${error.issues.map((issue) => {
6197
- const path = issue.path.join(".");
6198
- return path ? ` - ${path}: ${issue.message}` : ` - ${issue.message}`;
6199
- }).join("\n")}`;
6200
- }
6201
- //#endregion
6202
- //#region src/workspace/types.ts
6203
- /**
6204
- * Type guard to check if a config is a WorkspaceConfig.
6205
- *
6206
- * @example
6207
- * ```ts
6208
- * const config = await loadConfig();
6209
- * if (isWorkspaceConfig(config)) {
6210
- * // config.apps is available
6211
- * console.log(Object.keys(config.apps));
6212
- * }
6213
- * ```
6214
- */
6215
- function isWorkspaceConfig(config) {
6216
- if (typeof config !== "object" || config === null) return false;
6217
- if ("apps" in config && typeof config.apps === "object") return true;
6218
- return "constructs" in config && Object.keys(config).every((key) => WORKSPACE_KEYS.has(key));
6219
- }
6220
- /** Every top-level key a workspace config has — see `WorkspaceConfigSchema`. */
6221
- const WORKSPACE_KEYS = /* @__PURE__ */ new Set([
6222
- "name",
6223
- "constructs",
6224
- "apps",
6225
- "shared",
6226
- "deploy",
6227
- "stages",
6228
- "secrets",
6229
- "state"
6230
- ]);
6231
- //#endregion
6232
- //#region src/workspace/publicEnv.ts
6233
- /**
6234
- * All public env-var prefixes the toolbox understands.
6235
- *
6236
- * Used when resolving incoming var names back to a dependency
6237
- * (e.g. `VITE_AUTH_URL` → `auth`). A var matching any of these
6238
- * is considered safe to inline into a client bundle.
6239
- */
6240
- const PUBLIC_ENV_PREFIXES = [
6241
- "NEXT_PUBLIC_",
6242
- "VITE_",
6243
- "EXPO_PUBLIC_"
6244
- ];
6245
- /**
6246
- * Resolve the public env-var prefix that a frontend framework's bundler
6247
- * inlines into client code at build time:
6248
- *
6249
- * - `nextjs` → `NEXT_PUBLIC_`
6250
- * - `vite` → `VITE_`
6251
- * - `tanstack-start` → `VITE_` (uses Vite under the hood)
6252
- * - `expo` → `EXPO_PUBLIC_`
6253
- * - `remix` → `''` (Remix exposes via loaders, no prefix convention)
6254
- *
6255
- * For backend frameworks or unspecified, falls back to `NEXT_PUBLIC_` to
6256
- * preserve the historical default. Backend apps never read these vars
6257
- * from a bundle, so the prefix only affects scaffolding/symmetry.
6258
- */
6259
- function getPublicEnvPrefix(framework) {
6260
- switch (framework) {
6261
- case "vite":
6262
- case "tanstack-start": return "VITE_";
6263
- case "expo": return "EXPO_PUBLIC_";
6264
- case "remix": return "";
6265
- case "nextjs": return "NEXT_PUBLIC_";
6266
- default: return "NEXT_PUBLIC_";
5805
+ Object.defineProperty(exports, "record", {
5806
+ enumerable: true,
5807
+ get: function() {
5808
+ return record;
6267
5809
  }
6268
- }
6269
- /**
6270
- * Strip a known public prefix from a var name.
6271
- * Returns the un-prefixed name, or `null` if no prefix matched.
6272
- */
6273
- function stripPublicPrefix(name) {
6274
- for (const prefix of PUBLIC_ENV_PREFIXES) if (prefix && name.startsWith(prefix)) return name.slice(prefix.length);
6275
- return null;
6276
- }
6277
- //#endregion
6278
- //#region src/workspace/index.ts
6279
- /**
6280
- * Validate that all dependencies reference existing apps.
6281
- * Returns the config if valid, throws otherwise.
6282
- */
6283
- function validateDependencies(apps) {
6284
- const appNames = new Set(Object.keys(apps));
6285
- for (const [appName, app] of Object.entries(apps)) for (const dep of app.dependencies ?? []) {
6286
- if (!appNames.has(dep)) throw new Error(`Invalid dependency: App "${appName}" depends on "${dep}" which does not exist. Valid apps are: ${[...appNames].join(", ")}`);
6287
- if (dep === appName) throw new Error(`Invalid dependency: App "${appName}" cannot depend on itself.`);
5810
+ });
5811
+ Object.defineProperty(exports, "string", {
5812
+ enumerable: true,
5813
+ get: function() {
5814
+ return string;
6288
5815
  }
6289
- }
6290
- /**
6291
- * Define workspace configuration with full TypeScript support and type inference.
6292
- *
6293
- * Uses `const` type parameter to infer literal app names, providing:
6294
- * - Autocomplete for app names in dependencies
6295
- * - Type errors for invalid dependency references
6296
- * - Full type inference for the returned config
6297
- *
6298
- * @example
6299
- * ```ts
6300
- * // gkm.config.ts
6301
- * import { defineWorkspace } from '@geekmidas/cli';
6302
- *
6303
- * export default defineWorkspace({
6304
- * name: 'my-saas',
6305
- * apps: {
6306
- * api: {
6307
- * type: 'backend',
6308
- * path: 'apps/api',
6309
- * port: 3000,
6310
- * routes: './src/endpoints/**\/*.ts',
6311
- * envParser: './src/config/env',
6312
- * logger: './src/logger',
6313
- * },
6314
- * web: {
6315
- * type: 'web',
6316
- * framework: 'nextjs',
6317
- * path: 'apps/web',
6318
- * port: 3001,
6319
- * dependencies: ['api'], // <- autocomplete shows 'api' | 'web'
6320
- * },
6321
- * },
6322
- * });
6323
- *
6324
- * // config.apps.api <- full type inference
6325
- * // config.apps.foo <- TypeScript error
6326
- * ```
6327
- */
6328
- function defineWorkspace(config) {
6329
- if (config.apps) validateDependencies(config.apps);
6330
- const result = safeValidateWorkspaceConfig(config);
6331
- if (!result.success && result.error) throw new Error(formatValidationErrors(result.error));
6332
- return config;
6333
- }
6334
- /**
6335
- * Get the package name from package.json in the given directory.
6336
- */
6337
- function getPackageName(cwd) {
6338
- try {
6339
- return __require(`${cwd}/package.json`).name?.replace(/^@[^/]+\//, "");
6340
- } catch {
6341
- return;
5816
+ });
5817
+ Object.defineProperty(exports, "tuple", {
5818
+ enumerable: true,
5819
+ get: function() {
5820
+ return tuple;
6342
5821
  }
6343
- }
6344
- /**
6345
- * Normalize a workspace configuration with resolved defaults.
6346
- */
6347
- function normalizeWorkspace(config, cwd) {
6348
- const name = config.name ?? getPackageName(cwd) ?? basename(cwd);
6349
- const defaultTarget = config.deploy?.default ?? "dokploy";
6350
- const normalizedApps = {};
6351
- for (const [appName, app] of Object.entries(config.apps ?? {})) normalizedApps[appName] = normalizeAppConfig(app, defaultTarget);
6352
- return {
6353
- name,
6354
- root: cwd,
6355
- ...config.constructs ? { constructs: config.constructs } : {},
6356
- apps: normalizedApps,
6357
- deploy: config.deploy ?? { default: "dokploy" },
6358
- shared: config.shared ?? { packages: ["packages/*"] },
6359
- stages: validateStages(config.stages),
6360
- secrets: config.secrets ?? {},
6361
- state: config.state,
6362
- test: config.test ?? {},
6363
- ...config.dev ? { dev: config.dev } : {}
6364
- };
6365
- }
6366
- /**
6367
- * Normalize an app configuration with resolved defaults.
6368
- * @param app - App configuration
6369
- * @param defaultTarget - Default deploy target from workspace config
6370
- */
6371
- function normalizeAppConfig(app, defaultTarget) {
6372
- return {
6373
- ...app,
6374
- type: app.type ?? "backend",
6375
- port: app.port,
6376
- path: app.path,
6377
- dependencies: app.dependencies ?? [],
6378
- resolvedDeployTarget: app.deploy ?? defaultTarget
6379
- };
6380
- }
6381
- /**
6382
- * Wrap a single-app GkmConfig as a workspace.
6383
- * This allows existing single-app configs to work seamlessly.
6384
- */
6385
- function wrapSingleAppAsWorkspace(config, cwd) {
6386
- return {
6387
- name: config.name ?? getPackageName(cwd) ?? basename(cwd),
6388
- root: cwd,
6389
- apps: { api: {
6390
- type: "backend",
6391
- path: ".",
6392
- port: 3e3,
6393
- dependencies: [],
6394
- resolvedDeployTarget: config.deploy?.default ?? "dokploy",
6395
- constructs: config.constructs,
6396
- hooks: config.hooks,
6397
- telescope: config.telescope,
6398
- openapi: config.openapi,
6399
- runtime: config.runtime,
6400
- env: config.env
6401
- } },
6402
- deploy: {
6403
- default: "dokploy",
6404
- ...config.deploy
6405
- },
6406
- shared: { packages: [] },
6407
- stages: validateStages(config.stages),
6408
- secrets: config.secrets ?? {},
6409
- test: config.test ?? {},
6410
- ...config.dev ? { dev: config.dev } : {}
6411
- };
6412
- }
6413
- /**
6414
- * Process a loaded configuration (either single-app or workspace).
6415
- * Returns a normalized workspace in both cases.
6416
- */
6417
- function processConfig(config, cwd) {
6418
- if (isWorkspaceConfig(config)) {
6419
- const result = safeValidateWorkspaceConfig(config);
6420
- if (!result.success && result.error) throw new Error(formatValidationErrors(result.error));
6421
- return {
6422
- type: "workspace",
6423
- raw: config,
6424
- workspace: normalizeWorkspace(config, cwd)
6425
- };
5822
+ });
5823
+ Object.defineProperty(exports, "union", {
5824
+ enumerable: true,
5825
+ get: function() {
5826
+ return union;
6426
5827
  }
6427
- return {
6428
- type: "single",
6429
- raw: config,
6430
- workspace: wrapSingleAppAsWorkspace(config, cwd)
6431
- };
6432
- }
6433
- /**
6434
- * The workspace's own constructs globs, absolute.
6435
- *
6436
- * Infrastructure two apps share is a fact about the product, and declaring it
6437
- * inside one of them makes moving that app a change to the other's database.
6438
- */
6439
- function workspaceConstructGlobs(workspace) {
6440
- return constructPatterns(workspace.constructs).map((pattern) => isAbsolute(pattern) ? pattern : join(workspace.root, pattern));
6441
- }
6442
- /**
6443
- * Every constructs glob an app can see, absolute.
6444
- *
6445
- * The workspace's own first, then the app's. Absolute because the app builds
6446
- * from its own directory while the workspace's constructs live above it —
6447
- * a relative glob resolved from the app would look for the product's
6448
- * infrastructure inside one of its consumers and find nothing.
6449
- *
6450
- * Additive, not overriding: an app that declares its own constructs still sees
6451
- * the ones the workspace declared for everybody.
6452
- */
6453
- function appConstructGlobs(workspace, appName) {
6454
- const globs = workspaceConstructGlobs(workspace);
6455
- const app = workspace.apps[appName];
6456
- if (app) {
6457
- const root = isAbsolute(app.path) ? app.path : join(workspace.root, app.path);
6458
- for (const pattern of constructPatterns(app.constructs)) globs.push(isAbsolute(pattern) ? pattern : join(root, pattern));
5828
+ });
5829
+ Object.defineProperty(exports, "unknown", {
5830
+ enumerable: true,
5831
+ get: function() {
5832
+ return unknown;
6459
5833
  }
6460
- return globs;
6461
- }
6462
- /**
6463
- * Every constructs glob in the workspace: its own, plus each app's.
6464
- *
6465
- * One list, so what a deploy provisions and what an app's entry point
6466
- * registers drivers for are read off the same globs.
6467
- */
6468
- function allConstructGlobs(workspace) {
6469
- const globs = [...workspaceConstructGlobs(workspace), ...Object.keys(workspace.apps).flatMap((appName) => appConstructGlobs(workspace, appName))];
6470
- return [...new Set(globs)];
6471
- }
6472
- /** A `Routes` in any of its accepted shapes, as a flat list of patterns. */
6473
- function constructPatterns(routes) {
6474
- if (!routes) return [];
6475
- return typeof routes === "string" ? [routes] : routes;
6476
- }
6477
- /**
6478
- * Get the GkmConfig for a specific app in a workspace.
6479
- * Useful for running existing single-app commands on a specific app.
6480
- */
6481
- function getAppGkmConfig(workspace, appName) {
6482
- const app = workspace.apps[appName];
6483
- if (!app || app.type !== "backend") return;
6484
- return {
6485
- ...workspace.deploy ? { deploy: workspace.deploy } : {},
6486
- stages: workspace.stages,
6487
- constructs: appConstructGlobs(workspace, appName),
6488
- hooks: app.hooks,
6489
- telescope: app.telescope,
6490
- openapi: app.openapi,
6491
- runtime: app.runtime,
6492
- env: app.env
6493
- };
6494
- }
6495
- /**
6496
- * Get topologically sorted app names based on dependencies.
6497
- * Apps with no dependencies come first, then apps that depend on them.
6498
- */
6499
- function getAppBuildOrder(workspace) {
6500
- const appNames = Object.keys(workspace.apps);
6501
- const visited = /* @__PURE__ */ new Set();
6502
- const result = [];
6503
- function visit(name) {
6504
- if (visited.has(name)) return;
6505
- visited.add(name);
6506
- const app = workspace.apps[name];
6507
- if (app) for (const dep of app.dependencies) visit(dep);
6508
- result.push(name);
5834
+ });
5835
+ Object.defineProperty(exports, "url", {
5836
+ enumerable: true,
5837
+ get: function() {
5838
+ return url;
6509
5839
  }
6510
- for (const name of appNames) visit(name);
6511
- return result;
6512
- }
6513
- /**
6514
- * Resolve the Dokploy endpoint for a specific stage.
6515
- *
6516
- * Uses per-stage endpoint from `endpoints` if available,
6517
- * otherwise falls back to the global `endpoint`.
6518
- *
6519
- * @param dokployConfig - Dokploy workspace configuration
6520
- * @param stage - Deployment stage (e.g., 'development', 'production')
6521
- * @returns The endpoint URL for the stage, or undefined if not configured
6522
- *
6523
- * @example
6524
- * ```ts
6525
- * // With per-stage endpoints
6526
- * const config = {
6527
- * endpoints: {
6528
- * development: 'https://dev.dokploy.example.com:3000',
6529
- * production: 'https://prod.dokploy.example.com:3000',
6530
- * },
6531
- * };
6532
- * getEndpointForStage(config, 'production'); // => 'https://prod.dokploy.example.com:3000'
6533
- *
6534
- * // With single endpoint
6535
- * const config = { endpoint: 'https://dokploy.example.com:3000' };
6536
- * getEndpointForStage(config, 'production'); // => 'https://dokploy.example.com:3000'
6537
- * ```
6538
- */
6539
- function getEndpointForStage(dokployConfig, stage) {
6540
- if (!dokployConfig) return void 0;
6541
- if (dokployConfig.endpoints?.[stage]) return dokployConfig.endpoints[stage];
6542
- return dokployConfig.endpoint;
6543
- }
6544
- //#endregion
6545
- export { safeValidateWorkspaceConfig as C, assertDeployedStage as D, TEST_STAGE as E, deployedProblems as O, isPhase2DeployTarget as S, InvalidStages as T, SUPPORTED_DEPLOY_TARGETS as _, getAppBuildOrder as a, getDeployTargetError as b, normalizeWorkspace as c, wrapSingleAppAsWorkspace as d, PUBLIC_ENV_PREFIXES as f, PHASE_2_DEPLOY_TARGETS as g, isWorkspaceConfig as h, defineWorkspace as i, stageProblems as k, processConfig as l, stripPublicPrefix as m, appConstructGlobs as n, getAppGkmConfig as o, getPublicEnvPrefix as p, constructPatterns as r, getEndpointForStage as s, allConstructGlobs as t, workspaceConstructGlobs as u, WorkspaceConfigSchema as v, validateWorkspaceConfig as w, isDeployTargetSupported as x, formatValidationErrors as y };
5840
+ });
6546
5841
 
6547
- //# sourceMappingURL=workspace-Bp1xVaOz.mjs.map
5842
+ //# sourceMappingURL=schemas-Ckm_aBnF.cjs.map