@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
@@ -1698,6 +1698,60 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1698
1698
  });
1699
1699
  };
1700
1700
  });
1701
+ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
1702
+ $ZodUnion.init(inst, def);
1703
+ const _super = inst._zod.parse;
1704
+ defineLazy(inst._zod, "propValues", () => {
1705
+ const propValues = {};
1706
+ for (const option of def.options) {
1707
+ const pv = option._zod.propValues;
1708
+ if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
1709
+ for (const [k, v] of Object.entries(pv)) {
1710
+ if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
1711
+ for (const val of v) propValues[k].add(val);
1712
+ }
1713
+ }
1714
+ return propValues;
1715
+ });
1716
+ const disc = cached(() => {
1717
+ const opts = def.options;
1718
+ const map = /* @__PURE__ */ new Map();
1719
+ for (const o of opts) {
1720
+ const values = o._zod.propValues?.[def.discriminator];
1721
+ if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
1722
+ for (const v of values) {
1723
+ if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
1724
+ map.set(v, o);
1725
+ }
1726
+ }
1727
+ return map;
1728
+ });
1729
+ inst._zod.parse = (payload, ctx) => {
1730
+ const input = payload.value;
1731
+ if (!isObject(input)) {
1732
+ payload.issues.push({
1733
+ code: "invalid_type",
1734
+ expected: "object",
1735
+ input,
1736
+ inst
1737
+ });
1738
+ return payload;
1739
+ }
1740
+ const opt = disc.value.get(input?.[def.discriminator]);
1741
+ if (opt) return opt._zod.run(payload, ctx);
1742
+ if (def.unionFallback) return _super(payload, ctx);
1743
+ payload.issues.push({
1744
+ code: "invalid_union",
1745
+ errors: [],
1746
+ note: "No matching discriminator",
1747
+ discriminator: def.discriminator,
1748
+ input,
1749
+ path: [def.discriminator],
1750
+ inst
1751
+ });
1752
+ return payload;
1753
+ };
1754
+ });
1701
1755
  const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
1702
1756
  $ZodType.init(inst, def);
1703
1757
  inst._zod.parse = (payload, ctx) => {
@@ -1882,6 +1936,24 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1882
1936
  return payload;
1883
1937
  };
1884
1938
  });
1939
+ const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
1940
+ $ZodType.init(inst, def);
1941
+ if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
1942
+ const values = new Set(def.values);
1943
+ inst._zod.values = values;
1944
+ inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
1945
+ inst._zod.parse = (payload, _ctx) => {
1946
+ const input = payload.value;
1947
+ if (values.has(input)) return payload;
1948
+ payload.issues.push({
1949
+ code: "invalid_value",
1950
+ values: def.values,
1951
+ input,
1952
+ inst
1953
+ });
1954
+ return payload;
1955
+ };
1956
+ });
1885
1957
  const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1886
1958
  $ZodType.init(inst, def);
1887
1959
  inst._zod.parse = (payload, ctx) => {
@@ -2564,6 +2636,17 @@ function _array(Class, element, params) {
2564
2636
  ...normalizeParams(params)
2565
2637
  });
2566
2638
  }
2639
+ function _custom(Class, fn, _params) {
2640
+ const norm = normalizeParams(_params);
2641
+ norm.abort ?? (norm.abort = true);
2642
+ const schema = new Class({
2643
+ type: "custom",
2644
+ check: "custom",
2645
+ fn,
2646
+ ...norm
2647
+ });
2648
+ return schema;
2649
+ }
2567
2650
  function _refine(Class, fn, _params) {
2568
2651
  const schema = new Class({
2569
2652
  type: "custom",
@@ -3033,6 +3116,18 @@ function union(options, params) {
3033
3116
  ...normalizeParams(params)
3034
3117
  });
3035
3118
  }
3119
+ const ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
3120
+ ZodUnion.init(inst, def);
3121
+ $ZodDiscriminatedUnion.init(inst, def);
3122
+ });
3123
+ function discriminatedUnion(discriminator, options, params) {
3124
+ return new ZodDiscriminatedUnion({
3125
+ type: "union",
3126
+ options,
3127
+ discriminator,
3128
+ ...normalizeParams(params)
3129
+ });
3130
+ }
3036
3131
  const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
3037
3132
  $ZodIntersection.init(inst, def);
3038
3133
  ZodType.init(inst, def);
@@ -3095,6 +3190,22 @@ function _enum(values, params) {
3095
3190
  ...normalizeParams(params)
3096
3191
  });
3097
3192
  }
3193
+ const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
3194
+ $ZodLiteral.init(inst, def);
3195
+ ZodType.init(inst, def);
3196
+ inst.values = new Set(def.values);
3197
+ Object.defineProperty(inst, "value", { get() {
3198
+ if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
3199
+ return def.values[0];
3200
+ } });
3201
+ });
3202
+ function literal(value, params) {
3203
+ return new ZodLiteral({
3204
+ type: "literal",
3205
+ values: Array.isArray(value) ? value : [value],
3206
+ ...normalizeParams(params)
3207
+ });
3208
+ }
3098
3209
  const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
3099
3210
  $ZodTransform.init(inst, def);
3100
3211
  ZodType.init(inst, def);
@@ -3230,6 +3341,9 @@ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3230
3341
  $ZodCustom.init(inst, def);
3231
3342
  ZodType.init(inst, def);
3232
3343
  });
3344
+ function custom(fn, _params) {
3345
+ return _custom(ZodCustom, fn ?? (() => true), _params);
3346
+ }
3233
3347
  function refine(fn, _params = {}) {
3234
3348
  return _refine(ZodCustom, fn, _params);
3235
3349
  }
@@ -3239,26 +3353,6 @@ function superRefine(fn) {
3239
3353
  const describe = describe$1;
3240
3354
  const meta = meta$1;
3241
3355
 
3242
- //#endregion
3243
- //#region ../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/compat.js
3244
- /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
3245
- const ZodIssueCode = {
3246
- invalid_type: "invalid_type",
3247
- too_big: "too_big",
3248
- too_small: "too_small",
3249
- invalid_format: "invalid_format",
3250
- not_multiple_of: "not_multiple_of",
3251
- unrecognized_keys: "unrecognized_keys",
3252
- invalid_union: "invalid_union",
3253
- invalid_key: "invalid_key",
3254
- invalid_element: "invalid_element",
3255
- invalid_value: "invalid_value",
3256
- custom: "custom"
3257
- };
3258
- /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
3259
- var ZodFirstPartyTypeKind;
3260
- (function(ZodFirstPartyTypeKind$1) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3261
-
3262
3356
  //#endregion
3263
3357
  //#region src/workspace/schema.ts
3264
3358
  /**
@@ -3402,11 +3496,167 @@ const DokployWorkspaceConfigSchema = object({
3402
3496
  registryId: string().optional()
3403
3497
  });
3404
3498
  /**
3499
+ * Valid AWS regions.
3500
+ */
3501
+ const AwsRegionSchema = _enum([
3502
+ "us-east-1",
3503
+ "us-east-2",
3504
+ "us-west-1",
3505
+ "us-west-2",
3506
+ "af-south-1",
3507
+ "ap-east-1",
3508
+ "ap-south-1",
3509
+ "ap-south-2",
3510
+ "ap-southeast-1",
3511
+ "ap-southeast-2",
3512
+ "ap-southeast-3",
3513
+ "ap-southeast-4",
3514
+ "ap-northeast-1",
3515
+ "ap-northeast-2",
3516
+ "ap-northeast-3",
3517
+ "ca-central-1",
3518
+ "eu-central-1",
3519
+ "eu-central-2",
3520
+ "eu-west-1",
3521
+ "eu-west-2",
3522
+ "eu-west-3",
3523
+ "eu-south-1",
3524
+ "eu-south-2",
3525
+ "eu-north-1",
3526
+ "me-south-1",
3527
+ "me-central-1",
3528
+ "sa-east-1"
3529
+ ]);
3530
+ /**
3531
+ * DNS record types supported across providers.
3532
+ */
3533
+ const DnsRecordTypeSchema = _enum([
3534
+ "A",
3535
+ "AAAA",
3536
+ "CNAME",
3537
+ "MX",
3538
+ "TXT",
3539
+ "NS",
3540
+ "SRV",
3541
+ "CAA"
3542
+ ]);
3543
+ /**
3544
+ * A DNS record as returned by the provider.
3545
+ */
3546
+ const DnsRecordSchema = object({
3547
+ name: string(),
3548
+ type: DnsRecordTypeSchema,
3549
+ ttl: number().int().positive(),
3550
+ values: array(string())
3551
+ });
3552
+ /**
3553
+ * A DNS record to create or update.
3554
+ */
3555
+ const UpsertDnsRecordSchema = object({
3556
+ name: string(),
3557
+ type: DnsRecordTypeSchema,
3558
+ ttl: number().int().positive(),
3559
+ value: string()
3560
+ });
3561
+ /**
3562
+ * Result of an upsert operation.
3563
+ */
3564
+ const UpsertResultSchema = object({
3565
+ record: UpsertDnsRecordSchema,
3566
+ created: boolean(),
3567
+ unchanged: boolean()
3568
+ });
3569
+ /**
3570
+ * Hostinger DNS provider config (without domain - domain is the record key).
3571
+ */
3572
+ const HostingerDnsProviderSchema = object({
3573
+ provider: literal("hostinger"),
3574
+ ttl: number().int().positive().optional()
3575
+ });
3576
+ /**
3577
+ * Route53 DNS provider config (without domain - domain is the record key).
3578
+ */
3579
+ const Route53DnsProviderSchema = object({
3580
+ provider: literal("route53"),
3581
+ region: AwsRegionSchema.optional(),
3582
+ profile: string().optional(),
3583
+ hostedZoneId: string().optional(),
3584
+ ttl: number().int().positive().optional()
3585
+ });
3586
+ /**
3587
+ * Cloudflare DNS provider config (placeholder for future).
3588
+ */
3589
+ const CloudflareDnsProviderSchema = object({
3590
+ provider: literal("cloudflare"),
3591
+ ttl: number().int().positive().optional()
3592
+ });
3593
+ /**
3594
+ * Manual DNS configuration (user handles DNS themselves).
3595
+ */
3596
+ const ManualDnsProviderSchema = object({ provider: literal("manual") });
3597
+ /**
3598
+ * Custom DNS provider config (user-provided implementation).
3599
+ */
3600
+ const CustomDnsProviderSchema = object({
3601
+ 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" }),
3602
+ ttl: number().int().positive().optional()
3603
+ });
3604
+ /**
3605
+ * Built-in DNS provider config (discriminated union).
3606
+ */
3607
+ const BuiltInDnsProviderSchema = discriminatedUnion("provider", [
3608
+ HostingerDnsProviderSchema,
3609
+ Route53DnsProviderSchema,
3610
+ CloudflareDnsProviderSchema,
3611
+ ManualDnsProviderSchema
3612
+ ]);
3613
+ /**
3614
+ * Single DNS provider config (for one domain).
3615
+ */
3616
+ const DnsProviderSchema = union([BuiltInDnsProviderSchema, CustomDnsProviderSchema]);
3617
+ /**
3618
+ * DNS configuration schema.
3619
+ *
3620
+ * Maps root domains to their DNS provider configuration.
3621
+ * Example:
3622
+ * ```
3623
+ * dns: {
3624
+ * 'geekmidas.dev': { provider: 'hostinger' },
3625
+ * 'geekmidas.com': { provider: 'route53' },
3626
+ * }
3627
+ * ```
3628
+ *
3629
+ * Supported providers:
3630
+ * - 'hostinger': Use Hostinger DNS API
3631
+ * - 'route53': Use AWS Route53
3632
+ * - 'cloudflare': Use Cloudflare DNS API (future)
3633
+ * - 'manual': Don't create records, just print required records
3634
+ * - Custom: Provide a DnsProvider implementation
3635
+ */
3636
+ const DnsConfigSchema = record(string(), DnsProviderSchema);
3637
+ const HostingerDnsConfigSchema = HostingerDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3638
+ const Route53DnsConfigSchema = Route53DnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3639
+ const CloudflareDnsConfigSchema = CloudflareDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3640
+ const ManualDnsConfigSchema = ManualDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3641
+ const CustomDnsConfigSchema = CustomDnsProviderSchema.extend({ domain: string().min(1, "Domain is required") });
3642
+ const BuiltInDnsConfigSchema = discriminatedUnion("provider", [
3643
+ HostingerDnsConfigSchema,
3644
+ Route53DnsConfigSchema,
3645
+ CloudflareDnsConfigSchema,
3646
+ ManualDnsConfigSchema
3647
+ ]);
3648
+ const LegacyDnsConfigSchema = union([BuiltInDnsConfigSchema, CustomDnsConfigSchema]);
3649
+ /**
3650
+ * Combined DNS config that supports both new multi-domain and legacy single-domain formats.
3651
+ */
3652
+ const DnsConfigWithLegacySchema = union([DnsConfigSchema, LegacyDnsConfigSchema]);
3653
+ /**
3405
3654
  * Deploy configuration schema.
3406
3655
  */
3407
3656
  const DeployConfigSchema = object({
3408
3657
  default: DeployTargetSchema.optional(),
3409
- dokploy: DokployWorkspaceConfigSchema.optional()
3658
+ dokploy: DokployWorkspaceConfigSchema.optional(),
3659
+ dns: DnsConfigWithLegacySchema.optional()
3410
3660
  });
3411
3661
  /**
3412
3662
  * Models configuration schema.
@@ -3431,6 +3681,34 @@ const SecretsConfigSchema = object({
3431
3681
  kdf: _enum(["scrypt", "pbkdf2"]).optional()
3432
3682
  });
3433
3683
  /**
3684
+ * Local state provider config.
3685
+ */
3686
+ const LocalStateConfigSchema = object({ provider: literal("local") });
3687
+ /**
3688
+ * SSM state provider config (requires region).
3689
+ */
3690
+ const SSMStateConfigSchema = object({
3691
+ provider: literal("ssm"),
3692
+ region: AwsRegionSchema
3693
+ });
3694
+ /**
3695
+ * Custom state provider config (user-provided implementation).
3696
+ */
3697
+ 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" }) });
3698
+ /**
3699
+ * Built-in state provider config (discriminated union).
3700
+ */
3701
+ const BuiltInStateConfigSchema = discriminatedUnion("provider", [LocalStateConfigSchema, SSMStateConfigSchema]);
3702
+ /**
3703
+ * State configuration schema.
3704
+ *
3705
+ * Configures how deployment state is stored.
3706
+ * - 'local': Store in .gkm/deploy-{stage}.json (default)
3707
+ * - 'ssm': Store in AWS SSM Parameter Store (requires region)
3708
+ * - Custom: Provide a StateProvider implementation with read/write methods
3709
+ */
3710
+ const StateConfigSchema = union([BuiltInStateConfigSchema, CustomStateConfigSchema]);
3711
+ /**
3434
3712
  * App configuration schema.
3435
3713
  */
3436
3714
  const AppConfigSchema = object({
@@ -3496,7 +3774,8 @@ const WorkspaceConfigSchema = object({
3496
3774
  shared: SharedConfigSchema.optional(),
3497
3775
  deploy: DeployConfigSchema.optional(),
3498
3776
  services: ServicesConfigSchema.optional(),
3499
- secrets: SecretsConfigSchema.optional()
3777
+ secrets: SecretsConfigSchema.optional(),
3778
+ state: StateConfigSchema.optional()
3500
3779
  }).refine((data) => {
3501
3780
  const appNames = Object.keys(data.apps);
3502
3781
  for (const [appName, app] of Object.entries(data.apps)) for (const dep of app.dependencies ?? []) {
@@ -3528,7 +3807,7 @@ const WorkspaceConfigSchema = object({
3528
3807
  const defaultTarget = data.deploy?.default;
3529
3808
  if (defaultTarget && !isDeployTargetSupported(defaultTarget)) {
3530
3809
  ctx.addIssue({
3531
- code: ZodIssueCode.custom,
3810
+ code: "custom",
3532
3811
  message: getDeployTargetError(defaultTarget),
3533
3812
  path: ["deploy", "default"]
3534
3813
  });
@@ -3536,7 +3815,7 @@ const WorkspaceConfigSchema = object({
3536
3815
  }
3537
3816
  for (const [appName, app] of Object.entries(data.apps)) if (app.deploy && !isDeployTargetSupported(app.deploy)) {
3538
3817
  ctx.addIssue({
3539
- code: ZodIssueCode.custom,
3818
+ code: "custom",
3540
3819
  message: getDeployTargetError(app.deploy, appName),
3541
3820
  path: [
3542
3821
  "apps",
@@ -3546,6 +3825,11 @@ const WorkspaceConfigSchema = object({
3546
3825
  });
3547
3826
  return;
3548
3827
  }
3828
+ if (data.state?.provider === "ssm" && !data.name) ctx.addIssue({
3829
+ code: "custom",
3830
+ message: "Workspace name is required when using SSM state provider. Add \"name\" to your gkm.config.ts.",
3831
+ path: ["name"]
3832
+ });
3549
3833
  });
3550
3834
  /**
3551
3835
  * Validate workspace configuration.
@@ -3930,4 +4214,4 @@ Object.defineProperty(exports, 'wrapSingleAppAsWorkspace', {
3930
4214
  return wrapSingleAppAsWorkspace;
3931
4215
  }
3932
4216
  });
3933
- //# sourceMappingURL=workspace-CaVW6j2q.cjs.map
4217
+ //# sourceMappingURL=workspace-BFRUOOrh.cjs.map