@geekmidas/cli 0.54.0 → 1.0.0

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 (152) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +26 -5
  3. package/dist/CachedStateProvider-D73dCqfH.cjs +60 -0
  4. package/dist/CachedStateProvider-D73dCqfH.cjs.map +1 -0
  5. package/dist/CachedStateProvider-DVyKfaMm.mjs +54 -0
  6. package/dist/CachedStateProvider-DVyKfaMm.mjs.map +1 -0
  7. package/dist/CachedStateProvider-D_uISMmJ.cjs +3 -0
  8. package/dist/CachedStateProvider-OiFUGr7p.mjs +3 -0
  9. package/dist/HostingerProvider-DUV9-Tzg.cjs +210 -0
  10. package/dist/HostingerProvider-DUV9-Tzg.cjs.map +1 -0
  11. package/dist/HostingerProvider-DqUq6e9i.mjs +210 -0
  12. package/dist/HostingerProvider-DqUq6e9i.mjs.map +1 -0
  13. package/dist/LocalStateProvider-CdspeSVL.cjs +43 -0
  14. package/dist/LocalStateProvider-CdspeSVL.cjs.map +1 -0
  15. package/dist/LocalStateProvider-DxoSaWUV.mjs +42 -0
  16. package/dist/LocalStateProvider-DxoSaWUV.mjs.map +1 -0
  17. package/dist/Route53Provider-CpRIqu69.cjs +157 -0
  18. package/dist/Route53Provider-CpRIqu69.cjs.map +1 -0
  19. package/dist/Route53Provider-KUAX3vz9.mjs +156 -0
  20. package/dist/Route53Provider-KUAX3vz9.mjs.map +1 -0
  21. package/dist/SSMStateProvider-BxAPU99a.cjs +53 -0
  22. package/dist/SSMStateProvider-BxAPU99a.cjs.map +1 -0
  23. package/dist/SSMStateProvider-C4wp4AZe.mjs +52 -0
  24. package/dist/SSMStateProvider-C4wp4AZe.mjs.map +1 -0
  25. package/dist/{bundler-DGry2vaR.mjs → bundler-BqTN5Dj5.mjs} +3 -3
  26. package/dist/{bundler-DGry2vaR.mjs.map → bundler-BqTN5Dj5.mjs.map} +1 -1
  27. package/dist/{bundler-BB-kETMd.cjs → bundler-tHLLwYuU.cjs} +3 -3
  28. package/dist/{bundler-BB-kETMd.cjs.map → bundler-tHLLwYuU.cjs.map} +1 -1
  29. package/dist/{config-HYiM3iQJ.cjs → config-BGeJsW1r.cjs} +2 -2
  30. package/dist/{config-HYiM3iQJ.cjs.map → config-BGeJsW1r.cjs.map} +1 -1
  31. package/dist/{config-C3LSBNSl.mjs → config-C6awcFBx.mjs} +2 -2
  32. package/dist/{config-C3LSBNSl.mjs.map → config-C6awcFBx.mjs.map} +1 -1
  33. package/dist/config.cjs +2 -2
  34. package/dist/config.d.cts +1 -1
  35. package/dist/config.d.mts +2 -2
  36. package/dist/config.mjs +2 -2
  37. package/dist/credentials-C8DWtnMY.cjs +174 -0
  38. package/dist/credentials-C8DWtnMY.cjs.map +1 -0
  39. package/dist/credentials-DT1dSxIx.mjs +126 -0
  40. package/dist/credentials-DT1dSxIx.mjs.map +1 -0
  41. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  42. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  43. package/dist/deploy/sniffer-loader.cjs +1 -1
  44. package/dist/{dokploy-api-94KzmTVf.mjs → dokploy-api-7k3t7_zd.mjs} +1 -1
  45. package/dist/{dokploy-api-94KzmTVf.mjs.map → dokploy-api-7k3t7_zd.mjs.map} +1 -1
  46. package/dist/dokploy-api-CHa8G51l.mjs +3 -0
  47. package/dist/{dokploy-api-YD8WCQfW.cjs → dokploy-api-CQvhV6Hd.cjs} +1 -1
  48. package/dist/{dokploy-api-YD8WCQfW.cjs.map → dokploy-api-CQvhV6Hd.cjs.map} +1 -1
  49. package/dist/dokploy-api-CWc02yyg.cjs +3 -0
  50. package/dist/{encryption-DaCB_NmS.cjs → encryption-BE0UOb8j.cjs} +1 -1
  51. package/dist/{encryption-DaCB_NmS.cjs.map → encryption-BE0UOb8j.cjs.map} +1 -1
  52. package/dist/{encryption-Biq0EZ4m.cjs → encryption-Cv3zips0.cjs} +1 -1
  53. package/dist/{encryption-BC4MAODn.mjs → encryption-JtMsiGNp.mjs} +1 -1
  54. package/dist/{encryption-BC4MAODn.mjs.map → encryption-JtMsiGNp.mjs.map} +1 -1
  55. package/dist/encryption-UUmaWAmz.mjs +3 -0
  56. package/dist/{index-pOA56MWT.d.cts → index-B5rGIc4g.d.cts} +553 -196
  57. package/dist/index-B5rGIc4g.d.cts.map +1 -0
  58. package/dist/{index-A70abJ1m.d.mts → index-KFEbMIRa.d.mts} +554 -197
  59. package/dist/index-KFEbMIRa.d.mts.map +1 -0
  60. package/dist/index.cjs +2223 -606
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.mjs +2200 -583
  63. package/dist/index.mjs.map +1 -1
  64. package/dist/{openapi-C3C-BzIZ.mjs → openapi-BMFmLnX6.mjs} +51 -7
  65. package/dist/openapi-BMFmLnX6.mjs.map +1 -0
  66. package/dist/{openapi-D7WwlpPF.cjs → openapi-D1KXv2Ml.cjs} +51 -7
  67. package/dist/openapi-D1KXv2Ml.cjs.map +1 -0
  68. package/dist/{openapi-react-query-C_MxpBgF.cjs → openapi-react-query-BeXvk-wa.cjs} +1 -1
  69. package/dist/{openapi-react-query-C_MxpBgF.cjs.map → openapi-react-query-BeXvk-wa.cjs.map} +1 -1
  70. package/dist/{openapi-react-query-ZoP9DPbY.mjs → openapi-react-query-DGEkD39r.mjs} +1 -1
  71. package/dist/{openapi-react-query-ZoP9DPbY.mjs.map → openapi-react-query-DGEkD39r.mjs.map} +1 -1
  72. package/dist/openapi-react-query.cjs +1 -1
  73. package/dist/openapi-react-query.mjs +1 -1
  74. package/dist/openapi.cjs +3 -3
  75. package/dist/openapi.d.cts +1 -1
  76. package/dist/openapi.d.mts +2 -2
  77. package/dist/openapi.mjs +3 -3
  78. package/dist/{storage-Dhst7BhI.mjs → storage-BMW6yLu3.mjs} +1 -1
  79. package/dist/{storage-Dhst7BhI.mjs.map → storage-BMW6yLu3.mjs.map} +1 -1
  80. package/dist/{storage-fOR8dMu5.cjs → storage-C7pmBq1u.cjs} +1 -1
  81. package/dist/{storage-BPRgh3DU.cjs → storage-CoCNe0Pt.cjs} +1 -1
  82. package/dist/{storage-BPRgh3DU.cjs.map → storage-CoCNe0Pt.cjs.map} +1 -1
  83. package/dist/{storage-DNj_I11J.mjs → storage-D8XzjVaO.mjs} +1 -1
  84. package/dist/{types-BtGL-8QS.d.mts → types-BldpmqQX.d.mts} +1 -1
  85. package/dist/{types-BtGL-8QS.d.mts.map → types-BldpmqQX.d.mts.map} +1 -1
  86. package/dist/workspace/index.cjs +1 -1
  87. package/dist/workspace/index.d.cts +1 -1
  88. package/dist/workspace/index.d.mts +2 -2
  89. package/dist/workspace/index.mjs +1 -1
  90. package/dist/{workspace-CaVW6j2q.cjs → workspace-BFRUOOrh.cjs} +309 -25
  91. package/dist/workspace-BFRUOOrh.cjs.map +1 -0
  92. package/dist/{workspace-DLFRaDc-.mjs → workspace-DAxG3_H2.mjs} +309 -25
  93. package/dist/workspace-DAxG3_H2.mjs.map +1 -0
  94. package/package.json +12 -8
  95. package/src/build/__tests__/handler-templates.spec.ts +115 -47
  96. package/src/deploy/CachedStateProvider.ts +86 -0
  97. package/src/deploy/LocalStateProvider.ts +57 -0
  98. package/src/deploy/SSMStateProvider.ts +93 -0
  99. package/src/deploy/StateProvider.ts +171 -0
  100. package/src/deploy/__tests__/CachedStateProvider.spec.ts +228 -0
  101. package/src/deploy/__tests__/HostingerProvider.spec.ts +347 -0
  102. package/src/deploy/__tests__/LocalStateProvider.spec.ts +126 -0
  103. package/src/deploy/__tests__/Route53Provider.spec.ts +402 -0
  104. package/src/deploy/__tests__/SSMStateProvider.spec.ts +177 -0
  105. package/src/deploy/__tests__/__fixtures__/env-parsers/throwing-env-parser.ts +1 -3
  106. package/src/deploy/__tests__/__fixtures__/route-apps/services.ts +28 -19
  107. package/src/deploy/__tests__/createDnsProvider.spec.ts +172 -0
  108. package/src/deploy/__tests__/createStateProvider.spec.ts +116 -0
  109. package/src/deploy/__tests__/dns-orchestration.spec.ts +192 -0
  110. package/src/deploy/__tests__/dns-verification.spec.ts +2 -2
  111. package/src/deploy/__tests__/env-resolver.spec.ts +37 -15
  112. package/src/deploy/__tests__/sniffer.spec.ts +4 -20
  113. package/src/deploy/__tests__/state.spec.ts +13 -5
  114. package/src/deploy/dns/DnsProvider.ts +163 -0
  115. package/src/deploy/dns/HostingerProvider.ts +100 -0
  116. package/src/deploy/dns/Route53Provider.ts +256 -0
  117. package/src/deploy/dns/index.ts +257 -165
  118. package/src/deploy/env-resolver.ts +12 -5
  119. package/src/deploy/index.ts +16 -13
  120. package/src/deploy/sniffer-envkit-patch.ts +3 -1
  121. package/src/deploy/sniffer-routes-worker.ts +104 -0
  122. package/src/deploy/sniffer.ts +77 -55
  123. package/src/deploy/state-commands.ts +274 -0
  124. package/src/dev/__tests__/entry.spec.ts +8 -2
  125. package/src/dev/__tests__/index.spec.ts +1 -3
  126. package/src/dev/index.ts +9 -3
  127. package/src/docker/__tests__/templates.spec.ts +3 -1
  128. package/src/index.ts +88 -0
  129. package/src/init/__tests__/generators.spec.ts +273 -0
  130. package/src/init/__tests__/init.spec.ts +3 -3
  131. package/src/init/generators/auth.ts +1 -0
  132. package/src/init/generators/config.ts +2 -0
  133. package/src/init/generators/models.ts +6 -1
  134. package/src/init/generators/monorepo.ts +3 -0
  135. package/src/init/generators/ui.ts +1472 -0
  136. package/src/init/generators/web.ts +134 -87
  137. package/src/init/index.ts +22 -3
  138. package/src/init/templates/api.ts +109 -3
  139. package/src/openapi.ts +99 -13
  140. package/src/workspace/__tests__/schema.spec.ts +107 -0
  141. package/src/workspace/schema.ts +314 -4
  142. package/src/workspace/types.ts +22 -36
  143. package/dist/dokploy-api-CItuaWTq.mjs +0 -3
  144. package/dist/dokploy-api-DBNE8MDt.cjs +0 -3
  145. package/dist/encryption-CQXBZGkt.mjs +0 -3
  146. package/dist/index-A70abJ1m.d.mts.map +0 -1
  147. package/dist/index-pOA56MWT.d.cts.map +0 -1
  148. package/dist/openapi-C3C-BzIZ.mjs.map +0 -1
  149. package/dist/openapi-D7WwlpPF.cjs.map +0 -1
  150. package/dist/workspace-CaVW6j2q.cjs.map +0 -1
  151. package/dist/workspace-DLFRaDc-.mjs.map +0 -1
  152. package/tsconfig.tsbuildinfo +0 -1
@@ -1702,6 +1702,60 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1702
1702
  });
1703
1703
  };
1704
1704
  });
1705
+ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
1706
+ $ZodUnion.init(inst, def);
1707
+ const _super = inst._zod.parse;
1708
+ defineLazy(inst._zod, "propValues", () => {
1709
+ const propValues = {};
1710
+ for (const option of def.options) {
1711
+ const pv = option._zod.propValues;
1712
+ if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
1713
+ for (const [k, v] of Object.entries(pv)) {
1714
+ if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
1715
+ for (const val of v) propValues[k].add(val);
1716
+ }
1717
+ }
1718
+ return propValues;
1719
+ });
1720
+ const disc = cached(() => {
1721
+ const opts = def.options;
1722
+ const map = /* @__PURE__ */ new Map();
1723
+ for (const o of opts) {
1724
+ const values = o._zod.propValues?.[def.discriminator];
1725
+ if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
1726
+ for (const v of values) {
1727
+ if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
1728
+ map.set(v, o);
1729
+ }
1730
+ }
1731
+ return map;
1732
+ });
1733
+ inst._zod.parse = (payload, ctx) => {
1734
+ const input = payload.value;
1735
+ if (!isObject(input)) {
1736
+ payload.issues.push({
1737
+ code: "invalid_type",
1738
+ expected: "object",
1739
+ input,
1740
+ inst
1741
+ });
1742
+ return payload;
1743
+ }
1744
+ const opt = disc.value.get(input?.[def.discriminator]);
1745
+ if (opt) return opt._zod.run(payload, ctx);
1746
+ if (def.unionFallback) return _super(payload, ctx);
1747
+ payload.issues.push({
1748
+ code: "invalid_union",
1749
+ errors: [],
1750
+ note: "No matching discriminator",
1751
+ discriminator: def.discriminator,
1752
+ input,
1753
+ path: [def.discriminator],
1754
+ inst
1755
+ });
1756
+ return payload;
1757
+ };
1758
+ });
1705
1759
  const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
1706
1760
  $ZodType.init(inst, def);
1707
1761
  inst._zod.parse = (payload, ctx) => {
@@ -1886,6 +1940,24 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1886
1940
  return payload;
1887
1941
  };
1888
1942
  });
1943
+ const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
1944
+ $ZodType.init(inst, def);
1945
+ if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
1946
+ const values = new Set(def.values);
1947
+ inst._zod.values = values;
1948
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
1949
+ inst._zod.parse = (payload, _ctx) => {
1950
+ const input = payload.value;
1951
+ if (values.has(input)) return payload;
1952
+ payload.issues.push({
1953
+ code: "invalid_value",
1954
+ values: def.values,
1955
+ input,
1956
+ inst
1957
+ });
1958
+ return payload;
1959
+ };
1960
+ });
1889
1961
  const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1890
1962
  $ZodType.init(inst, def);
1891
1963
  inst._zod.parse = (payload, ctx) => {
@@ -2568,6 +2640,17 @@ function _array(Class, element, params) {
2568
2640
  ...normalizeParams(params)
2569
2641
  });
2570
2642
  }
2643
+ function _custom(Class, fn, _params) {
2644
+ const norm = normalizeParams(_params);
2645
+ norm.abort ?? (norm.abort = true);
2646
+ const schema = new Class({
2647
+ type: "custom",
2648
+ check: "custom",
2649
+ fn,
2650
+ ...norm
2651
+ });
2652
+ return schema;
2653
+ }
2571
2654
  function _refine(Class, fn, _params) {
2572
2655
  const schema = new Class({
2573
2656
  type: "custom",
@@ -3037,6 +3120,18 @@ function union(options, params) {
3037
3120
  ...normalizeParams(params)
3038
3121
  });
3039
3122
  }
3123
+ const ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
3124
+ ZodUnion.init(inst, def);
3125
+ $ZodDiscriminatedUnion.init(inst, def);
3126
+ });
3127
+ function discriminatedUnion(discriminator, options, params) {
3128
+ return new ZodDiscriminatedUnion({
3129
+ type: "union",
3130
+ options,
3131
+ discriminator,
3132
+ ...normalizeParams(params)
3133
+ });
3134
+ }
3040
3135
  const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
3041
3136
  $ZodIntersection.init(inst, def);
3042
3137
  ZodType.init(inst, def);
@@ -3099,6 +3194,22 @@ function _enum(values, params) {
3099
3194
  ...normalizeParams(params)
3100
3195
  });
3101
3196
  }
3197
+ const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
3198
+ $ZodLiteral.init(inst, def);
3199
+ ZodType.init(inst, def);
3200
+ inst.values = new Set(def.values);
3201
+ Object.defineProperty(inst, "value", { get() {
3202
+ if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
3203
+ return def.values[0];
3204
+ } });
3205
+ });
3206
+ function literal(value, params) {
3207
+ return new ZodLiteral({
3208
+ type: "literal",
3209
+ values: Array.isArray(value) ? value : [value],
3210
+ ...normalizeParams(params)
3211
+ });
3212
+ }
3102
3213
  const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
3103
3214
  $ZodTransform.init(inst, def);
3104
3215
  ZodType.init(inst, def);
@@ -3234,6 +3345,9 @@ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3234
3345
  $ZodCustom.init(inst, def);
3235
3346
  ZodType.init(inst, def);
3236
3347
  });
3348
+ function custom(fn, _params) {
3349
+ return _custom(ZodCustom, fn ?? (() => true), _params);
3350
+ }
3237
3351
  function refine(fn, _params = {}) {
3238
3352
  return _refine(ZodCustom, fn, _params);
3239
3353
  }
@@ -3243,26 +3357,6 @@ function superRefine(fn) {
3243
3357
  const describe = describe$1;
3244
3358
  const meta = meta$1;
3245
3359
 
3246
- //#endregion
3247
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/compat.js
3248
- /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
3249
- const ZodIssueCode = {
3250
- invalid_type: "invalid_type",
3251
- too_big: "too_big",
3252
- too_small: "too_small",
3253
- invalid_format: "invalid_format",
3254
- not_multiple_of: "not_multiple_of",
3255
- unrecognized_keys: "unrecognized_keys",
3256
- invalid_union: "invalid_union",
3257
- invalid_key: "invalid_key",
3258
- invalid_element: "invalid_element",
3259
- invalid_value: "invalid_value",
3260
- custom: "custom"
3261
- };
3262
- /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
3263
- var ZodFirstPartyTypeKind;
3264
- (function(ZodFirstPartyTypeKind$1) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3265
-
3266
3360
  //#endregion
3267
3361
  //#region src/workspace/schema.ts
3268
3362
  /**
@@ -3406,11 +3500,167 @@ const DokployWorkspaceConfigSchema = object({
3406
3500
  registryId: string().optional()
3407
3501
  });
3408
3502
  /**
3503
+ * Valid AWS regions.
3504
+ */
3505
+ const AwsRegionSchema = _enum([
3506
+ "us-east-1",
3507
+ "us-east-2",
3508
+ "us-west-1",
3509
+ "us-west-2",
3510
+ "af-south-1",
3511
+ "ap-east-1",
3512
+ "ap-south-1",
3513
+ "ap-south-2",
3514
+ "ap-southeast-1",
3515
+ "ap-southeast-2",
3516
+ "ap-southeast-3",
3517
+ "ap-southeast-4",
3518
+ "ap-northeast-1",
3519
+ "ap-northeast-2",
3520
+ "ap-northeast-3",
3521
+ "ca-central-1",
3522
+ "eu-central-1",
3523
+ "eu-central-2",
3524
+ "eu-west-1",
3525
+ "eu-west-2",
3526
+ "eu-west-3",
3527
+ "eu-south-1",
3528
+ "eu-south-2",
3529
+ "eu-north-1",
3530
+ "me-south-1",
3531
+ "me-central-1",
3532
+ "sa-east-1"
3533
+ ]);
3534
+ /**
3535
+ * DNS record types supported across providers.
3536
+ */
3537
+ const DnsRecordTypeSchema = _enum([
3538
+ "A",
3539
+ "AAAA",
3540
+ "CNAME",
3541
+ "MX",
3542
+ "TXT",
3543
+ "NS",
3544
+ "SRV",
3545
+ "CAA"
3546
+ ]);
3547
+ /**
3548
+ * A DNS record as returned by the provider.
3549
+ */
3550
+ const DnsRecordSchema = object({
3551
+ name: string(),
3552
+ type: DnsRecordTypeSchema,
3553
+ ttl: number().int().positive(),
3554
+ values: array(string())
3555
+ });
3556
+ /**
3557
+ * A DNS record to create or update.
3558
+ */
3559
+ const UpsertDnsRecordSchema = object({
3560
+ name: string(),
3561
+ type: DnsRecordTypeSchema,
3562
+ ttl: number().int().positive(),
3563
+ value: string()
3564
+ });
3565
+ /**
3566
+ * Result of an upsert operation.
3567
+ */
3568
+ const UpsertResultSchema = object({
3569
+ record: UpsertDnsRecordSchema,
3570
+ created: boolean(),
3571
+ unchanged: boolean()
3572
+ });
3573
+ /**
3574
+ * Hostinger DNS provider config (without domain - domain is the record key).
3575
+ */
3576
+ const HostingerDnsProviderSchema = object({
3577
+ provider: literal("hostinger"),
3578
+ ttl: number().int().positive().optional()
3579
+ });
3580
+ /**
3581
+ * Route53 DNS provider config (without domain - domain is the record key).
3582
+ */
3583
+ const Route53DnsProviderSchema = object({
3584
+ provider: literal("route53"),
3585
+ region: AwsRegionSchema.optional(),
3586
+ profile: string().optional(),
3587
+ hostedZoneId: string().optional(),
3588
+ ttl: number().int().positive().optional()
3589
+ });
3590
+ /**
3591
+ * Cloudflare DNS provider config (placeholder for future).
3592
+ */
3593
+ const CloudflareDnsProviderSchema = object({
3594
+ provider: literal("cloudflare"),
3595
+ ttl: number().int().positive().optional()
3596
+ });
3597
+ /**
3598
+ * Manual DNS configuration (user handles DNS themselves).
3599
+ */
3600
+ const ManualDnsProviderSchema = object({ provider: literal("manual") });
3601
+ /**
3602
+ * Custom DNS provider config (user-provided implementation).
3603
+ */
3604
+ const CustomDnsProviderSchema = object({
3605
+ 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" }),
3606
+ ttl: number().int().positive().optional()
3607
+ });
3608
+ /**
3609
+ * Built-in DNS provider config (discriminated union).
3610
+ */
3611
+ const BuiltInDnsProviderSchema = discriminatedUnion("provider", [
3612
+ HostingerDnsProviderSchema,
3613
+ Route53DnsProviderSchema,
3614
+ CloudflareDnsProviderSchema,
3615
+ ManualDnsProviderSchema
3616
+ ]);
3617
+ /**
3618
+ * Single DNS provider config (for one domain).
3619
+ */
3620
+ const DnsProviderSchema = union([BuiltInDnsProviderSchema, CustomDnsProviderSchema]);
3621
+ /**
3622
+ * DNS configuration schema.
3623
+ *
3624
+ * Maps root domains to their DNS provider configuration.
3625
+ * Example:
3626
+ * ```
3627
+ * dns: {
3628
+ * 'geekmidas.dev': { provider: 'hostinger' },
3629
+ * 'geekmidas.com': { provider: 'route53' },
3630
+ * }
3631
+ * ```
3632
+ *
3633
+ * Supported providers:
3634
+ * - 'hostinger': Use Hostinger DNS API
3635
+ * - 'route53': Use AWS Route53
3636
+ * - 'cloudflare': Use Cloudflare DNS API (future)
3637
+ * - 'manual': Don't create records, just print required records
3638
+ * - Custom: Provide a DnsProvider implementation
3639
+ */
3640
+ const DnsConfigSchema = record(string(), DnsProviderSchema);
3641
+ const HostingerDnsConfigSchema = HostingerDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3642
+ const Route53DnsConfigSchema = Route53DnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3643
+ const CloudflareDnsConfigSchema = CloudflareDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3644
+ const ManualDnsConfigSchema = ManualDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3645
+ const CustomDnsConfigSchema = CustomDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3646
+ const BuiltInDnsConfigSchema = discriminatedUnion("provider", [
3647
+ HostingerDnsConfigSchema,
3648
+ Route53DnsConfigSchema,
3649
+ CloudflareDnsConfigSchema,
3650
+ ManualDnsConfigSchema
3651
+ ]);
3652
+ const LegacyDnsConfigSchema = union([BuiltInDnsConfigSchema, CustomDnsConfigSchema]);
3653
+ /**
3654
+ * Combined DNS config that supports both new multi-domain and legacy single-domain formats.
3655
+ */
3656
+ const DnsConfigWithLegacySchema = union([DnsConfigSchema, LegacyDnsConfigSchema]);
3657
+ /**
3409
3658
  * Deploy configuration schema.
3410
3659
  */
3411
3660
  const DeployConfigSchema = object({
3412
3661
  default: DeployTargetSchema.optional(),
3413
- dokploy: DokployWorkspaceConfigSchema.optional()
3662
+ dokploy: DokployWorkspaceConfigSchema.optional(),
3663
+ dns: DnsConfigWithLegacySchema.optional()
3414
3664
  });
3415
3665
  /**
3416
3666
  * Models configuration schema.
@@ -3435,6 +3685,34 @@ const SecretsConfigSchema = object({
3435
3685
  kdf: _enum(["scrypt", "pbkdf2"]).optional()
3436
3686
  });
3437
3687
  /**
3688
+ * Local state provider config.
3689
+ */
3690
+ const LocalStateConfigSchema = object({ provider: literal("local") });
3691
+ /**
3692
+ * SSM state provider config (requires region).
3693
+ */
3694
+ const SSMStateConfigSchema = object({
3695
+ provider: literal("ssm"),
3696
+ region: AwsRegionSchema
3697
+ });
3698
+ /**
3699
+ * Custom state provider config (user-provided implementation).
3700
+ */
3701
+ const CustomStateConfigSchema = object({ 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" }) });
3702
+ /**
3703
+ * Built-in state provider config (discriminated union).
3704
+ */
3705
+ const BuiltInStateConfigSchema = discriminatedUnion("provider", [LocalStateConfigSchema, SSMStateConfigSchema]);
3706
+ /**
3707
+ * State configuration schema.
3708
+ *
3709
+ * Configures how deployment state is stored.
3710
+ * - 'local': Store in .gkm/deploy-{stage}.json (default)
3711
+ * - 'ssm': Store in AWS SSM Parameter Store (requires region)
3712
+ * - Custom: Provide a StateProvider implementation with read/write methods
3713
+ */
3714
+ const StateConfigSchema = union([BuiltInStateConfigSchema, CustomStateConfigSchema]);
3715
+ /**
3438
3716
  * App configuration schema.
3439
3717
  */
3440
3718
  const AppConfigSchema = object({
@@ -3500,7 +3778,8 @@ const WorkspaceConfigSchema = object({
3500
3778
  shared: SharedConfigSchema.optional(),
3501
3779
  deploy: DeployConfigSchema.optional(),
3502
3780
  services: ServicesConfigSchema.optional(),
3503
- secrets: SecretsConfigSchema.optional()
3781
+ secrets: SecretsConfigSchema.optional(),
3782
+ state: StateConfigSchema.optional()
3504
3783
  }).refine((data) => {
3505
3784
  const appNames = Object.keys(data.apps);
3506
3785
  for (const [appName, app] of Object.entries(data.apps)) for (const dep of app.dependencies ?? []) {
@@ -3532,7 +3811,7 @@ const WorkspaceConfigSchema = object({
3532
3811
  const defaultTarget = data.deploy?.default;
3533
3812
  if (defaultTarget && !isDeployTargetSupported(defaultTarget)) {
3534
3813
  ctx.addIssue({
3535
- code: ZodIssueCode.custom,
3814
+ code: "custom",
3536
3815
  message: getDeployTargetError(defaultTarget),
3537
3816
  path: ["deploy", "default"]
3538
3817
  });
@@ -3540,7 +3819,7 @@ const WorkspaceConfigSchema = object({
3540
3819
  }
3541
3820
  for (const [appName, app] of Object.entries(data.apps)) if (app.deploy && !isDeployTargetSupported(app.deploy)) {
3542
3821
  ctx.addIssue({
3543
- code: ZodIssueCode.custom,
3822
+ code: "custom",
3544
3823
  message: getDeployTargetError(app.deploy, appName),
3545
3824
  path: [
3546
3825
  "apps",
@@ -3550,6 +3829,11 @@ const WorkspaceConfigSchema = object({
3550
3829
  });
3551
3830
  return;
3552
3831
  }
3832
+ if (data.state?.provider === "ssm" && !data.name) ctx.addIssue({
3833
+ code: "custom",
3834
+ message: "Workspace name is required when using SSM state provider. Add \"name\" to your gkm.config.ts.",
3835
+ path: ["name"]
3836
+ });
3553
3837
  });
3554
3838
  /**
3555
3839
  * Validate workspace configuration.
@@ -3833,4 +4117,4 @@ function getDependencyEnvVars(workspace, appName, urlPrefix = "http://localhost"
3833
4117
 
3834
4118
  //#endregion
3835
4119
  export { PHASE_2_DEPLOY_TARGETS, SUPPORTED_DEPLOY_TARGETS, WorkspaceConfigSchema, __require, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, validateWorkspaceConfig, wrapSingleAppAsWorkspace };
3836
- //# sourceMappingURL=workspace-DLFRaDc-.mjs.map
4120
+ //# sourceMappingURL=workspace-DAxG3_H2.mjs.map