@geekmidas/cli 10.0.0-alpha.67 → 10.0.0-alpha.69

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 (175) hide show
  1. package/dist/{LegacyStateStore-C39UKwmf.mjs → LegacyStateStore-BE1Et8RS.mjs} +2 -2
  2. package/dist/{LegacyStateStore-C39UKwmf.mjs.map → LegacyStateStore-BE1Et8RS.mjs.map} +1 -1
  3. package/dist/{LegacyStateStore-BZiO9-Lw.cjs → LegacyStateStore-LS_uTO8D.cjs} +2 -2
  4. package/dist/{LegacyStateStore-BZiO9-Lw.cjs.map → LegacyStateStore-LS_uTO8D.cjs.map} +1 -1
  5. package/dist/{LocalStateStore-DHVsZLyF.cjs → LocalStateStore-CV6phNMZ.cjs} +2 -2
  6. package/dist/{LocalStateStore-DHVsZLyF.cjs.map → LocalStateStore-CV6phNMZ.cjs.map} +1 -1
  7. package/dist/{LocalStateStore-Dk3Wbvzk.mjs → LocalStateStore-DAnFc708.mjs} +2 -2
  8. package/dist/{LocalStateStore-Dk3Wbvzk.mjs.map → LocalStateStore-DAnFc708.mjs.map} +1 -1
  9. package/dist/{OpenApiTsGenerator-BmUAcR7d.mjs → OpenApiTsGenerator-CSaXs-dB.mjs} +2 -2
  10. package/dist/{OpenApiTsGenerator-BmUAcR7d.mjs.map → OpenApiTsGenerator-CSaXs-dB.mjs.map} +1 -1
  11. package/dist/{OpenApiTsGenerator-B2zrdyP4.cjs → OpenApiTsGenerator-CxB8mqXz.cjs} +2 -2
  12. package/dist/{OpenApiTsGenerator-B2zrdyP4.cjs.map → OpenApiTsGenerator-CxB8mqXz.cjs.map} +1 -1
  13. package/dist/{S3StateStore-B_ZF9eHt.mjs → S3StateStore-8kJEGnTh.mjs} +2 -2
  14. package/dist/{S3StateStore-B_ZF9eHt.mjs.map → S3StateStore-8kJEGnTh.mjs.map} +1 -1
  15. package/dist/{S3StateStore--4tYVMAL.cjs → S3StateStore-dA34LAYm.cjs} +2 -2
  16. package/dist/{S3StateStore--4tYVMAL.cjs.map → S3StateStore-dA34LAYm.cjs.map} +1 -1
  17. package/dist/{SSMStateStore-ACZ8hRvZ.cjs → SSMStateStore-DBzlfc-S.cjs} +2 -2
  18. package/dist/{SSMStateStore-ACZ8hRvZ.cjs.map → SSMStateStore-DBzlfc-S.cjs.map} +1 -1
  19. package/dist/{SSMStateStore-DjPuKqrm.mjs → SSMStateStore-Dkdw-fPL.mjs} +2 -2
  20. package/dist/{SSMStateStore-DjPuKqrm.mjs.map → SSMStateStore-Dkdw-fPL.mjs.map} +1 -1
  21. package/dist/add-CoIr2wgv.cjs +568 -0
  22. package/dist/add-CoIr2wgv.cjs.map +1 -0
  23. package/dist/add-Dzk23476.mjs +566 -0
  24. package/dist/add-Dzk23476.mjs.map +1 -0
  25. package/dist/{bundler-pyLj-gS0.cjs → bundler-CSR2nM4m.cjs} +5 -5
  26. package/dist/{bundler-pyLj-gS0.cjs.map → bundler-CSR2nM4m.cjs.map} +1 -1
  27. package/dist/{bundler-Bq3HaLOZ.mjs → bundler-Cn0JF5G0.mjs} +5 -5
  28. package/dist/{bundler-Bq3HaLOZ.mjs.map → bundler-Cn0JF5G0.mjs.map} +1 -1
  29. package/dist/{cli-DR7B2_fX.cjs → cli-IoM2-x48.cjs} +13 -4
  30. package/dist/cli-IoM2-x48.cjs.map +1 -0
  31. package/dist/{cli-C2Tjbn27.mjs → cli-ij8Lwlww.mjs} +13 -4
  32. package/dist/cli-ij8Lwlww.mjs.map +1 -0
  33. package/dist/{compose-BjToENzG.mjs → compose-CZtinmtw.mjs} +173 -58
  34. package/dist/compose-CZtinmtw.mjs.map +1 -0
  35. package/dist/{compose-5oNHAKNT.cjs → compose-DfIioFX0.cjs} +173 -58
  36. package/dist/compose-DfIioFX0.cjs.map +1 -0
  37. package/dist/{config-4XFxX1al.d.cts → config-BnA0kPTY.d.cts} +3 -3
  38. package/dist/{config-4XFxX1al.d.cts.map → config-BnA0kPTY.d.cts.map} +1 -1
  39. package/dist/{config-UtKzhpFb.d.mts → config-CxEp_g7j.d.mts} +3 -3
  40. package/dist/{config-UtKzhpFb.d.mts.map → config-CxEp_g7j.d.mts.map} +1 -1
  41. package/dist/config.cjs +3 -3
  42. package/dist/config.d.cts +3 -3
  43. package/dist/config.d.mts +3 -3
  44. package/dist/config.mjs +3 -3
  45. package/dist/credentialSchemas-BcNL1N5R.cjs +271 -0
  46. package/dist/credentialSchemas-BcNL1N5R.cjs.map +1 -0
  47. package/dist/credentialSchemas-BmYxnEz_.mjs +236 -0
  48. package/dist/credentialSchemas-BmYxnEz_.mjs.map +1 -0
  49. package/dist/deploy/public.cjs +11 -7
  50. package/dist/deploy/public.d.cts +15 -4
  51. package/dist/deploy/public.d.cts.map +1 -1
  52. package/dist/deploy/public.d.mts +15 -4
  53. package/dist/deploy/public.d.mts.map +1 -1
  54. package/dist/deploy/public.mjs +8 -8
  55. package/dist/{deploy-DRAwTG72.mjs → deploy-BzqbkJ3o.mjs} +11 -7
  56. package/dist/deploy-BzqbkJ3o.mjs.map +1 -0
  57. package/dist/{deploy-BucRfbvX.cjs → deploy-Dpz9raPM.cjs} +11 -7
  58. package/dist/deploy-Dpz9raPM.cjs.map +1 -0
  59. package/dist/{discover-OEfZ9OkA.cjs → discover-B4VjaFJk.cjs} +2 -2
  60. package/dist/{discover-OEfZ9OkA.cjs.map → discover-B4VjaFJk.cjs.map} +1 -1
  61. package/dist/{discover-BFoJWKGD.mjs → discover-Buwf1z4P.mjs} +2 -2
  62. package/dist/{discover-BFoJWKGD.mjs.map → discover-Buwf1z4P.mjs.map} +1 -1
  63. package/dist/{dokploy-m345Zx02.cjs → dokploy-B6O-J1fb.cjs} +2 -2
  64. package/dist/{dokploy-m345Zx02.cjs.map → dokploy-B6O-J1fb.cjs.map} +1 -1
  65. package/dist/{dokploy-DIt1IZl1.mjs → dokploy-DkwcORbv.mjs} +2 -2
  66. package/dist/{dokploy-DIt1IZl1.mjs.map → dokploy-DkwcORbv.mjs.map} +1 -1
  67. package/dist/{encryption-Ccbahik7.mjs → encryption-7m1mKcRy.mjs} +3 -3
  68. package/dist/{encryption-Ccbahik7.mjs.map → encryption-7m1mKcRy.mjs.map} +1 -1
  69. package/dist/{encryption-rZ3BghXy.cjs → encryption-C8Ic5t0C.cjs} +3 -3
  70. package/dist/{encryption-rZ3BghXy.cjs.map → encryption-C8Ic5t0C.cjs.map} +1 -1
  71. package/dist/{engine-Gs0abjuj.mjs → engine-62Kl70Pj.mjs} +146 -28
  72. package/dist/engine-62Kl70Pj.mjs.map +1 -0
  73. package/dist/{engine-Cx_dvx9q.cjs → engine-BR9qlS7A.cjs} +146 -28
  74. package/dist/engine-BR9qlS7A.cjs.map +1 -0
  75. package/dist/{github-CrcGFkfD.cjs → github-CmGIZjhu.cjs} +3 -3
  76. package/dist/{github-CrcGFkfD.cjs.map → github-CmGIZjhu.cjs.map} +1 -1
  77. package/dist/{github-CJANTYqi.mjs → github-DtymyOcH.mjs} +3 -3
  78. package/dist/{github-CJANTYqi.mjs.map → github-DtymyOcH.mjs.map} +1 -1
  79. package/dist/{index-DD1FfUHh.d.mts → index-CkX89m6S.d.mts} +2 -2
  80. package/dist/{index-CyApaHVe.d.cts.map → index-CkX89m6S.d.mts.map} +1 -1
  81. package/dist/{index-CyApaHVe.d.cts → index-EvZBkycu.d.cts} +2 -2
  82. package/dist/{index-DD1FfUHh.d.mts.map → index-EvZBkycu.d.cts.map} +1 -1
  83. package/dist/index.cjs +94 -52
  84. package/dist/index.cjs.map +1 -1
  85. package/dist/index.mjs +94 -52
  86. package/dist/index.mjs.map +1 -1
  87. package/dist/{migrate-DCVo5gLS.mjs → migrate-CEzq6DjL.mjs} +4 -4
  88. package/dist/{migrate-DCVo5gLS.mjs.map → migrate-CEzq6DjL.mjs.map} +1 -1
  89. package/dist/{migrate-CQdSpttI.cjs → migrate-CYC-hBOU.cjs} +4 -4
  90. package/dist/{migrate-CQdSpttI.cjs.map → migrate-CYC-hBOU.cjs.map} +1 -1
  91. package/dist/openapi.cjs +1 -1
  92. package/dist/openapi.d.cts +1 -1
  93. package/dist/openapi.d.mts +1 -1
  94. package/dist/openapi.mjs +1 -1
  95. package/dist/{ready-2s3-CndS.mjs → ready-DeYaSoNN.mjs} +3 -3
  96. package/dist/{ready-2s3-CndS.mjs.map → ready-DeYaSoNN.mjs.map} +1 -1
  97. package/dist/{ready-B6uHr4sm.cjs → ready-QGgjmcuN.cjs} +3 -3
  98. package/dist/{ready-B6uHr4sm.cjs.map → ready-QGgjmcuN.cjs.map} +1 -1
  99. package/dist/reconcile/public.cjs +1 -1
  100. package/dist/reconcile/public.d.cts +1 -1
  101. package/dist/reconcile/public.d.mts +1 -1
  102. package/dist/reconcile/public.mjs +1 -1
  103. package/dist/{resolve-BexmDcsN.cjs → resolve-BDsMffvz.cjs} +3 -3
  104. package/dist/{resolve-BexmDcsN.cjs.map → resolve-BDsMffvz.cjs.map} +1 -1
  105. package/dist/{resolve-DhZgtvZe.mjs → resolve-Dn5wGf1r.mjs} +3 -3
  106. package/dist/{resolve-DhZgtvZe.mjs.map → resolve-Dn5wGf1r.mjs.map} +1 -1
  107. package/dist/{rollback-BnY7KuG_.cjs → rollback-5XHaBDxW.cjs} +5 -5
  108. package/dist/{rollback-BnY7KuG_.cjs.map → rollback-5XHaBDxW.cjs.map} +1 -1
  109. package/dist/{rollback-m4Yeym5x.mjs → rollback-DDfaqv7P.mjs} +5 -5
  110. package/dist/{rollback-m4Yeym5x.mjs.map → rollback-DDfaqv7P.mjs.map} +1 -1
  111. package/dist/{runtime-CEk5n4VH.d.mts → runtime-B3jNgeP-.d.mts} +2 -2
  112. package/dist/{runtime-BRqFOvPM.d.cts.map → runtime-B3jNgeP-.d.mts.map} +1 -1
  113. package/dist/{runtime-BRqFOvPM.d.cts → runtime-DWThEP-r.d.cts} +2 -2
  114. package/dist/{runtime-CEk5n4VH.d.mts.map → runtime-DWThEP-r.d.cts.map} +1 -1
  115. package/dist/sandbox/credentials-worker.cjs +54 -0
  116. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  117. package/dist/sandbox/credentials-worker.d.cts +1 -0
  118. package/dist/sandbox/credentials-worker.d.mts +1 -0
  119. package/dist/sandbox/credentials-worker.mjs +55 -0
  120. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  121. package/dist/sandbox/discover-worker.cjs +1 -1
  122. package/dist/sandbox/discover-worker.mjs +1 -1
  123. package/dist/sandbox/migrate-worker.cjs +1 -1
  124. package/dist/sandbox/migrate-worker.mjs +1 -1
  125. package/dist/{schemas-RUlKHu27.cjs → schemas-BObwxB_t.cjs} +164 -3
  126. package/dist/schemas-BObwxB_t.cjs.map +1 -0
  127. package/dist/{schemas-Cfhtpdo0.mjs → schemas-D-xeKJDD.mjs} +153 -4
  128. package/dist/schemas-D-xeKJDD.mjs.map +1 -0
  129. package/dist/{sniffer-D66HIvi9.cjs → sniffer-Bc0nNBDF.cjs} +7 -7
  130. package/dist/sniffer-Bc0nNBDF.cjs.map +1 -0
  131. package/dist/{sniffer-BdFeLSmA.mjs → sniffer-DMqi2b1q.mjs} +7 -7
  132. package/dist/sniffer-DMqi2b1q.mjs.map +1 -0
  133. package/dist/{state-DgmM4EKq.cjs → state-8RgXeX5Y.cjs} +398 -8
  134. package/dist/state-8RgXeX5Y.cjs.map +1 -0
  135. package/dist/{state-DkUStoqJ.mjs → state-DClnPZt5.mjs} +291 -9
  136. package/dist/state-DClnPZt5.mjs.map +1 -0
  137. package/dist/target/public.cjs +1 -1
  138. package/dist/target/public.d.cts +2 -2
  139. package/dist/target/public.d.mts +2 -2
  140. package/dist/target/public.mjs +1 -1
  141. package/dist/{terminal-C3cv-OQu.mjs → terminal-C6TBo_SA.mjs} +2 -2
  142. package/dist/{terminal-C3cv-OQu.mjs.map → terminal-C6TBo_SA.mjs.map} +1 -1
  143. package/dist/{terminal-DjzgLu6m.cjs → terminal-CFO3xWoF.cjs} +2 -2
  144. package/dist/{terminal-DjzgLu6m.cjs.map → terminal-CFO3xWoF.cjs.map} +1 -1
  145. package/dist/{types-CSw2w69a.d.mts → types-CZdCxUCK.d.cts} +64 -2
  146. package/dist/types-CZdCxUCK.d.cts.map +1 -0
  147. package/dist/{types-D5WIxRDP.d.cts → types-Da0E3Qv7.d.mts} +63 -3
  148. package/dist/types-Da0E3Qv7.d.mts.map +1 -0
  149. package/dist/vitest.cjs +1 -1
  150. package/dist/vitest.mjs +1 -1
  151. package/dist/workspace/index.cjs +1 -1
  152. package/dist/workspace/index.d.cts +2 -2
  153. package/dist/workspace/index.d.mts +2 -2
  154. package/dist/workspace/index.mjs +1 -1
  155. package/dist/{workspace-ON-bqiJz.cjs → workspace-8NuAjaXJ.cjs} +2 -2
  156. package/dist/{workspace-ON-bqiJz.cjs.map → workspace-8NuAjaXJ.cjs.map} +1 -1
  157. package/dist/{workspace-Be6uBhlF.mjs → workspace-B2UK_rVP.mjs} +2 -2
  158. package/dist/{workspace-Be6uBhlF.mjs.map → workspace-B2UK_rVP.mjs.map} +1 -1
  159. package/package.json +16 -13
  160. package/dist/cli-C2Tjbn27.mjs.map +0 -1
  161. package/dist/cli-DR7B2_fX.cjs.map +0 -1
  162. package/dist/compose-5oNHAKNT.cjs.map +0 -1
  163. package/dist/compose-BjToENzG.mjs.map +0 -1
  164. package/dist/deploy-BucRfbvX.cjs.map +0 -1
  165. package/dist/deploy-DRAwTG72.mjs.map +0 -1
  166. package/dist/engine-Cx_dvx9q.cjs.map +0 -1
  167. package/dist/engine-Gs0abjuj.mjs.map +0 -1
  168. package/dist/schemas-Cfhtpdo0.mjs.map +0 -1
  169. package/dist/schemas-RUlKHu27.cjs.map +0 -1
  170. package/dist/sniffer-BdFeLSmA.mjs.map +0 -1
  171. package/dist/sniffer-D66HIvi9.cjs.map +0 -1
  172. package/dist/state-DgmM4EKq.cjs.map +0 -1
  173. package/dist/state-DkUStoqJ.mjs.map +0 -1
  174. package/dist/types-CSw2w69a.d.mts.map +0 -1
  175. package/dist/types-D5WIxRDP.d.cts.map +0 -1
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
2
  const require_run = require("./run-fVZ-rLnc.cjs");
3
- const require_discover = require("./discover-OEfZ9OkA.cjs");
3
+ const require_discover = require("./discover-B4VjaFJk.cjs");
4
4
  const require_derive = require("./derive-DAbo49sm.cjs");
5
- const require_workspace = require("./workspace-ON-bqiJz.cjs");
5
+ const require_workspace = require("./workspace-8NuAjaXJ.cjs");
6
6
  const require_config = require("./config.cjs");
7
- const require_resolve = require("./resolve-BexmDcsN.cjs");
7
+ const require_resolve = require("./resolve-BDsMffvz.cjs");
8
8
  const require_fakes = require("./fakes-zW-jNAbQ.cjs");
9
9
  let node_path = require("node:path");
10
10
  let node_fs = require("node:fs");
@@ -3109,15 +3109,18 @@ function pgClient(port, password = LOCAL_USER$1) {
3109
3109
  }
3110
3110
  } };
3111
3111
  }
3112
- /** A bucket client pointed at the local MinIO. */
3113
- function bucketClient(port) {
3112
+ /** A bucket client pointed at a MinIO on this machine. */
3113
+ function bucketClient(port, credentials = {
3114
+ user: LOCAL_USER$1,
3115
+ password: LOCAL_USER$1
3116
+ }) {
3114
3117
  const s3 = new _aws_sdk_client_s3.S3Client({
3115
3118
  region: "us-east-1",
3116
3119
  endpoint: `http://localhost:${port}`,
3117
3120
  forcePathStyle: true,
3118
3121
  credentials: {
3119
- accessKeyId: LOCAL_USER$1,
3120
- secretAccessKey: LOCAL_USER$1
3122
+ accessKeyId: credentials.user,
3123
+ secretAccessKey: credentials.password
3121
3124
  }
3122
3125
  });
3123
3126
  return {
@@ -4578,6 +4581,285 @@ function keyFingerprint(masterKey) {
4578
4581
  return (0, node_crypto.createHash)("sha256").update(masterKey).digest("hex").slice(0, 8);
4579
4582
  }
4580
4583
  //#endregion
4584
+ //#region src/deploy/devServices.ts
4585
+ /**
4586
+ * Mail and object storage on a deployed stage: real ones, or — only when
4587
+ * someone asked — the dev services the local stage runs.
4588
+ *
4589
+ * Locally a declared `Email` is Mailpit and a declared bucket is MinIO, and
4590
+ * nobody has to configure either. Deployed, the same two containers would be
4591
+ * a stage that silently delivers no mail and keeps its files on one
4592
+ * container's disk. So a deployed stage on a server target takes both from
4593
+ * its secrets — the mail server's URL and sending address, and each bucket's
4594
+ * URL — and a stage missing any of them fails before anything is built,
4595
+ * provisioned or written, naming every key at once.
4596
+ *
4597
+ * A bucket's credentials are not checked: they are optional, and come from
4598
+ * either of two places. The bucket's URL may carry a key of its own
4599
+ * (`s3://KEY:SECRET@uploads`), which wins; otherwise the S3 client's default
4600
+ * chain applies — the stage's shared `AWS_ACCESS_KEY_ID`/
4601
+ * `AWS_SECRET_ACCESS_KEY` when it set them, or a role.
4602
+ *
4603
+ * `--allow-dev-services minio,mailpit` is the way out for a stage that is
4604
+ * not production — a preview, a demo: the target runs the dev service and
4605
+ * derives the keys from it. Keys the stage did set still win. Every run that
4606
+ * uses one says so, loudly.
4607
+ *
4608
+ * Pure: what each target runs is decided here from declarations and the
4609
+ * stage's values, and the targets do the running.
4610
+ */
4611
+ /** The dev services a deployed stage may be allowed to run. */
4612
+ const DEV_SERVICES = ["minio", "mailpit"];
4613
+ /**
4614
+ * The S3 client's shared key pair. Optional: a bucket whose URL carries its own
4615
+ * key (`s3://KEY:SECRET@bucket`) signs with that, and one without signs with
4616
+ * this pair when the stage set it, or with whatever else the SDK's default
4617
+ * chain finds — a role.
4618
+ */
4619
+ const STORAGE_KEY_PAIR = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"];
4620
+ /** A `--allow-dev-services` value that is not a dev service. */
4621
+ var UnknownDevService = class extends Error {
4622
+ value;
4623
+ constructor(value) {
4624
+ super(`'${value}' is not a dev service. --allow-dev-services takes a comma-separated list of ${DEV_SERVICES.join(", ")}: --allow-dev-services ${DEV_SERVICES.join(",")}`);
4625
+ this.value = value;
4626
+ this.name = "UnknownDevService";
4627
+ }
4628
+ };
4629
+ /** Dev services asked of a target that runs no containers. */
4630
+ var DevServicesNeedServerTarget = class extends Error {
4631
+ target;
4632
+ services;
4633
+ constructor(target, services) {
4634
+ super(`--allow-dev-services applies to server targets only, and '${target}' deploys to AWS, where a bucket is S3 and mail is the stage's own. Drop --allow-dev-services ${services.join(",")}.`);
4635
+ this.target = target;
4636
+ this.services = services;
4637
+ this.name = "DevServicesNeedServerTarget";
4638
+ }
4639
+ };
4640
+ /**
4641
+ * A deployed stage with mail or object storage that its secrets do not
4642
+ * configure — every missing key, across every app, at once.
4643
+ */
4644
+ var ExternalServicesNotConfigured = class extends Error {
4645
+ stage;
4646
+ missing;
4647
+ constructor(stage, missing) {
4648
+ const services = [...new Set(missing.map((m) => m.service))].sort();
4649
+ const lines = missing.map((m) => {
4650
+ const by = m.apps?.length ? `, read by ${m.apps.join(", ")}` : "";
4651
+ return ` gkm secrets:set ${m.key} '${m.example}' --stage ${stage}\n ${m.what}${by}` + (m.note ? `\n ${m.note}` : "");
4652
+ });
4653
+ super(`The stage '${stage}' is deployed, and a deployed stage's mail and object storage are real services: gkm runs no Mailpit or MinIO for it. Set ${missing.length === 1 ? "this key" : `these ${missing.length} keys`} in the stage's secrets:\n\n${lines.join("\n")}\n\nFor a stage that is not production — a preview, a demo — the dev services can run instead, with --allow-dev-services ${services.join(",")}. Mailpit delivers no mail, and MinIO keeps every object on one container's disk.\n\nOr run: gkm secrets:add --stage ${stage}`);
4654
+ this.stage = stage;
4655
+ this.missing = missing;
4656
+ this.name = "ExternalServicesNotConfigured";
4657
+ }
4658
+ };
4659
+ /**
4660
+ * The dev services a value names: `'minio,mailpit'`, or a list of them.
4661
+ *
4662
+ * @throws {UnknownDevService} for anything that is not one
4663
+ */
4664
+ function parseDevServices(value) {
4665
+ if (value === void 0) return [];
4666
+ const items = (typeof value === "string" ? [value] : value).flatMap((item) => item.split(",")).map((item) => item.trim()).filter(Boolean);
4667
+ const services = /* @__PURE__ */ new Set();
4668
+ for (const item of items) {
4669
+ if (!DEV_SERVICES.includes(item)) throw new UnknownDevService(item);
4670
+ services.add(item);
4671
+ }
4672
+ return [...services].sort();
4673
+ }
4674
+ /**
4675
+ * Every mail and storage construct a manifest declares, with the apps that
4676
+ * depend on each — what a target that provisions the whole manifest checks.
4677
+ */
4678
+ function manifestServiceDeclarations(manifest) {
4679
+ return Object.entries(manifest).flatMap(([id, declaration]) => {
4680
+ const { kind } = declaration;
4681
+ if (kind !== "email" && kind !== "objects" && kind !== "file-server") return [];
4682
+ const apps = (0, _geekmidas_manifest.dependentsOf)(manifest, id).filter((caller) => {
4683
+ const callerKind = manifest[caller]?.kind;
4684
+ return callerKind === "rest-api" || callerKind === "site";
4685
+ }).map(require_derive.appKey);
4686
+ return [{
4687
+ id,
4688
+ kind,
4689
+ ...declaration.kind === "file-server" ? { of: declaration.of } : {},
4690
+ ...apps.length ? { apps } : {}
4691
+ }];
4692
+ });
4693
+ }
4694
+ /**
4695
+ * Every key a stage must be given rather than derive — the one list both a
4696
+ * deploy's checks and `gkm secrets:add` read, so what a deploy refuses and
4697
+ * what the builder offers cannot drift.
4698
+ *
4699
+ * - Deployed, mail is its URL and its sending address, a bucket its URL, and
4700
+ * a file server its public URL. Locally all of it is Mailpit and MinIO.
4701
+ * - On every stage, a third party's credentials: nobody but the third party
4702
+ * can issue them.
4703
+ *
4704
+ * Never a derived value: a database URL, a generated secret, the seed.
4705
+ */
4706
+ function requiredStageKeys(input) {
4707
+ const domain = input.domain ?? "example.com";
4708
+ const keys = [];
4709
+ const add = (entry) => {
4710
+ if (!keys.some((k) => k.key === entry.key)) keys.push(entry);
4711
+ };
4712
+ const byId = (list) => [...list ?? []].sort((a, b) => a.id.localeCompare(b.id));
4713
+ const apps = (d) => d.apps?.length ? { apps: [...d.apps].sort() } : {};
4714
+ if (!input.local) {
4715
+ const services = byId(input.services);
4716
+ for (const d of services.filter((d) => d.kind === "email")) {
4717
+ add({
4718
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "url"),
4719
+ id: d.id,
4720
+ kind: "email",
4721
+ what: `where '${d.id}' sends mail — any SMTP server`,
4722
+ example: `smtp://user:password@smtp.${domain}:587`,
4723
+ service: "mailpit",
4724
+ ...apps(d)
4725
+ });
4726
+ add({
4727
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "from"),
4728
+ id: d.id,
4729
+ kind: "email",
4730
+ what: `the address '${d.id}' sends from, on a domain the mail server has verified`,
4731
+ example: `noreply@${domain}`,
4732
+ service: "mailpit",
4733
+ ...apps(d)
4734
+ });
4735
+ }
4736
+ for (const d of services.filter((d) => d.kind === "objects")) add({
4737
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "url"),
4738
+ id: d.id,
4739
+ kind: "bucket",
4740
+ what: `the bucket '${d.id}' — S3, R2, or any S3-compatible store (add &endpoint=… for one that is not S3)`,
4741
+ note: `credentials are optional: a key for this bucket alone in the URL (s3://KEY:SECRET@${require_derive.appKey(d.id)}?…) wins; without one, the shared AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY or a role signs`,
4742
+ example: `s3://${require_derive.appKey(d.id)}?region=eu-west-1`,
4743
+ service: "minio",
4744
+ ...apps(d)
4745
+ });
4746
+ for (const d of services.filter((d) => d.kind === "file-server")) add({
4747
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "url"),
4748
+ id: d.id,
4749
+ kind: "file-server",
4750
+ what: `the public address '${d.id}' serves its bucket on — a CDN or the bucket's own domain`,
4751
+ example: `https://${require_derive.appKey(d.id)}.${domain}`,
4752
+ service: "minio",
4753
+ ...d.of ? { of: d.of } : {},
4754
+ ...apps(d)
4755
+ });
4756
+ }
4757
+ for (const d of byId(input.credentials)) add({
4758
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "credentials"),
4759
+ id: d.id,
4760
+ kind: d.kind,
4761
+ what: d.kind === "external-api" ? `the credentials '${d.id}' was issued for this stage, as its schema describes them` : `the credential '${d.id}', as its schema describes it`,
4762
+ example: "{\"apiKey\":\"…\"}",
4763
+ ...apps(d)
4764
+ });
4765
+ return keys;
4766
+ }
4767
+ /**
4768
+ * Whether only the stage's secrets can supply `key` to a construct of `kind`
4769
+ * — what nothing on the stage derives.
4770
+ *
4771
+ * A third party's credentials, always. Deployed, also each generated secret
4772
+ * and keyring: the stage generated each one once, and every run reads the
4773
+ * same value back.
4774
+ */
4775
+ function suppliedOnly(kind, id, key, local) {
4776
+ if (kind === "credential") return true;
4777
+ if (kind === "external-api") return key === (0, _geekmidas_manifest.provideKey)(id, "credentials");
4778
+ if (local) return false;
4779
+ return kind === "secret" || kind === "encryption";
4780
+ }
4781
+ /**
4782
+ * Where a deployed stage's mail and storage come from, and what it lacks.
4783
+ *
4784
+ * - Mail is external once its URL is set, and then needs its sending
4785
+ * address too. Unset, it is Mailpit where allowed — the address derived
4786
+ * unless set — and missing otherwise.
4787
+ * - A bucket is external once its URL is set; its credentials, in the URL or
4788
+ * the shared pair, are optional. Unset, it is MinIO where allowed, and
4789
+ * missing otherwise.
4790
+ * - A file server's URL is derived where its bucket is MinIO, unless set;
4791
+ * over an external bucket the stage must set it.
4792
+ *
4793
+ * The keys themselves are {@link requiredStageKeys}'s.
4794
+ */
4795
+ function externalServices(input) {
4796
+ const { supplied, allow } = input;
4797
+ const has = (key) => supplied[key] !== void 0;
4798
+ const required = requiredStageKeys({
4799
+ local: false,
4800
+ services: input.declarations,
4801
+ ...input.domain ? { domain: input.domain } : {}
4802
+ });
4803
+ const mailpit = required.filter((k) => k.kind === "email" && k.key === (0, _geekmidas_manifest.provideKey)(k.id, "url")).filter((k) => !has(k.key) && allow.includes("mailpit")).map((k) => k.id);
4804
+ const minio = required.filter((k) => k.kind === "bucket").filter((k) => !has(k.key) && allow.includes("minio")).map((k) => k.id);
4805
+ const covered = (k) => k.kind === "email" && mailpit.includes(k.id) || k.kind === "bucket" && minio.includes(k.id) || k.kind === "file-server" && k.of !== void 0 && minio.includes(k.of);
4806
+ return {
4807
+ missing: required.filter((k) => !has(k.key) && !covered(k)).map(({ key, id, what, note, example, service, apps }) => ({
4808
+ key,
4809
+ id,
4810
+ what,
4811
+ ...note ? { note } : {},
4812
+ example,
4813
+ service,
4814
+ ...apps ? { apps } : {}
4815
+ })),
4816
+ minio,
4817
+ mailpit
4818
+ };
4819
+ }
4820
+ /**
4821
+ * `externalServices`, refusing a stage that lacks anything.
4822
+ *
4823
+ * @throws {ExternalServicesNotConfigured} naming every missing key
4824
+ */
4825
+ function assertExternalServices(input) {
4826
+ const services = externalServices(input);
4827
+ if (services.missing.length > 0) throw new ExternalServicesNotConfigured(input.stage, services.missing);
4828
+ return services;
4829
+ }
4830
+ /** The dev services a run uses, one entry per service it runs. */
4831
+ function devServicesUsed(services) {
4832
+ const used = [];
4833
+ if (services.mailpit.length > 0) used.push({
4834
+ service: "mailpit",
4835
+ ids: services.mailpit
4836
+ });
4837
+ if (services.minio.length > 0) used.push({
4838
+ service: "minio",
4839
+ ids: services.minio
4840
+ });
4841
+ return used;
4842
+ }
4843
+ /** The line a run prints for each dev service a deployed stage uses. */
4844
+ function devServiceWarning(stage, use) {
4845
+ return `⚠️ DEV SERVICE ON A DEPLOYED STAGE (${stage}): ${use.service === "mailpit" ? `Mailpit is catching mail for ${use.ids.join(", ")}. It delivers NO mail: nobody receives a sign-in link, a receipt or a reset` : `MinIO is storing ${use.ids.join(", ")}. Every object is on one container's disk, with no replication and no backup`}. It is not production-grade — set the stage's own keys in its secrets for that.`;
4846
+ }
4847
+ /**
4848
+ * Report each dev service a run uses: a loud line, and a `dev-service.used`
4849
+ * event a host can act on.
4850
+ */
4851
+ function reportDevServices(ctx, uses) {
4852
+ for (const use of uses) {
4853
+ ctx.logger.warn(`\n${devServiceWarning(ctx.stage, use)}`);
4854
+ ctx.emit({
4855
+ type: "dev-service.used",
4856
+ service: use.service,
4857
+ stage: ctx.stage,
4858
+ constructs: use.ids
4859
+ });
4860
+ }
4861
+ }
4862
+ //#endregion
4581
4863
  //#region src/target/dokploy/domain.ts
4582
4864
  /** A stage was deployed that `deploy.domains` gives no domain. */
4583
4865
  var NoDomainForStage = class extends Error {
@@ -5402,12 +5684,30 @@ Object.defineProperty(exports, "DEFAULT_IMAGES", {
5402
5684
  return DEFAULT_IMAGES;
5403
5685
  }
5404
5686
  });
5687
+ Object.defineProperty(exports, "DEV_SERVICES", {
5688
+ enumerable: true,
5689
+ get: function() {
5690
+ return DEV_SERVICES;
5691
+ }
5692
+ });
5405
5693
  Object.defineProperty(exports, "DeployJournal", {
5406
5694
  enumerable: true,
5407
5695
  get: function() {
5408
5696
  return DeployJournal;
5409
5697
  }
5410
5698
  });
5699
+ Object.defineProperty(exports, "DevServicesNeedServerTarget", {
5700
+ enumerable: true,
5701
+ get: function() {
5702
+ return DevServicesNeedServerTarget;
5703
+ }
5704
+ });
5705
+ Object.defineProperty(exports, "ExternalServicesNotConfigured", {
5706
+ enumerable: true,
5707
+ get: function() {
5708
+ return ExternalServicesNotConfigured;
5709
+ }
5710
+ });
5411
5711
  Object.defineProperty(exports, "FAKE_ENV", {
5412
5712
  enumerable: true,
5413
5713
  get: function() {
@@ -5426,12 +5726,30 @@ Object.defineProperty(exports, "LOCAL_CA_PATH", {
5426
5726
  return LOCAL_CA_PATH;
5427
5727
  }
5428
5728
  });
5729
+ Object.defineProperty(exports, "NoDomainForStage", {
5730
+ enumerable: true,
5731
+ get: function() {
5732
+ return NoDomainForStage;
5733
+ }
5734
+ });
5735
+ Object.defineProperty(exports, "STORAGE_KEY_PAIR", {
5736
+ enumerable: true,
5737
+ get: function() {
5738
+ return STORAGE_KEY_PAIR;
5739
+ }
5740
+ });
5429
5741
  Object.defineProperty(exports, "TURBO_VERSION", {
5430
5742
  enumerable: true,
5431
5743
  get: function() {
5432
5744
  return TURBO_VERSION;
5433
5745
  }
5434
5746
  });
5747
+ Object.defineProperty(exports, "UnknownDevService", {
5748
+ enumerable: true,
5749
+ get: function() {
5750
+ return UnknownDevService;
5751
+ }
5752
+ });
5435
5753
  Object.defineProperty(exports, "appDockerfile", {
5436
5754
  enumerable: true,
5437
5755
  get: function() {
@@ -5450,18 +5768,48 @@ Object.defineProperty(exports, "applicationName", {
5450
5768
  return applicationName;
5451
5769
  }
5452
5770
  });
5771
+ Object.defineProperty(exports, "applyBuckets", {
5772
+ enumerable: true,
5773
+ get: function() {
5774
+ return applyBuckets;
5775
+ }
5776
+ });
5777
+ Object.defineProperty(exports, "applyPolicies", {
5778
+ enumerable: true,
5779
+ get: function() {
5780
+ return applyPolicies;
5781
+ }
5782
+ });
5453
5783
  Object.defineProperty(exports, "applyPostgres", {
5454
5784
  enumerable: true,
5455
5785
  get: function() {
5456
5786
  return applyPostgres;
5457
5787
  }
5458
5788
  });
5789
+ Object.defineProperty(exports, "assertExternalServices", {
5790
+ enumerable: true,
5791
+ get: function() {
5792
+ return assertExternalServices;
5793
+ }
5794
+ });
5459
5795
  Object.defineProperty(exports, "backendsOf", {
5460
5796
  enumerable: true,
5461
5797
  get: function() {
5462
5798
  return backendsOf;
5463
5799
  }
5464
5800
  });
5801
+ Object.defineProperty(exports, "bucketClient", {
5802
+ enumerable: true,
5803
+ get: function() {
5804
+ return bucketClient;
5805
+ }
5806
+ });
5807
+ Object.defineProperty(exports, "bucketPolicies", {
5808
+ enumerable: true,
5809
+ get: function() {
5810
+ return bucketPolicies;
5811
+ }
5812
+ });
5465
5813
  Object.defineProperty(exports, "cacheBackendFor", {
5466
5814
  enumerable: true,
5467
5815
  get: function() {
@@ -5546,6 +5894,12 @@ Object.defineProperty(exports, "detectPackageManager", {
5546
5894
  return detectPackageManager;
5547
5895
  }
5548
5896
  });
5897
+ Object.defineProperty(exports, "devServicesUsed", {
5898
+ enumerable: true,
5899
+ get: function() {
5900
+ return devServicesUsed;
5901
+ }
5902
+ });
5549
5903
  Object.defineProperty(exports, "dockerCommand", {
5550
5904
  enumerable: true,
5551
5905
  get: function() {
@@ -5582,6 +5936,12 @@ Object.defineProperty(exports, "eventsBackendFor", {
5582
5936
  return eventsBackendFor;
5583
5937
  }
5584
5938
  });
5939
+ Object.defineProperty(exports, "externalServices", {
5940
+ enumerable: true,
5941
+ get: function() {
5942
+ return externalServices;
5943
+ }
5944
+ });
5585
5945
  Object.defineProperty(exports, "fakeKey", {
5586
5946
  enumerable: true,
5587
5947
  get: function() {
@@ -5714,6 +6074,12 @@ Object.defineProperty(exports, "localRolePassword", {
5714
6074
  return localRolePassword;
5715
6075
  }
5716
6076
  });
6077
+ Object.defineProperty(exports, "manifestServiceDeclarations", {
6078
+ enumerable: true,
6079
+ get: function() {
6080
+ return manifestServiceDeclarations;
6081
+ }
6082
+ });
5717
6083
  Object.defineProperty(exports, "markerOf", {
5718
6084
  enumerable: true,
5719
6085
  get: function() {
@@ -5738,6 +6104,12 @@ Object.defineProperty(exports, "ownershipMarker", {
5738
6104
  return ownershipMarker;
5739
6105
  }
5740
6106
  });
6107
+ Object.defineProperty(exports, "parseDevServices", {
6108
+ enumerable: true,
6109
+ get: function() {
6110
+ return parseDevServices;
6111
+ }
6112
+ });
5741
6113
  Object.defineProperty(exports, "pgClient", {
5742
6114
  enumerable: true,
5743
6115
  get: function() {
@@ -5828,6 +6200,18 @@ Object.defineProperty(exports, "recordRollback", {
5828
6200
  return recordRollback;
5829
6201
  }
5830
6202
  });
6203
+ Object.defineProperty(exports, "reportDevServices", {
6204
+ enumerable: true,
6205
+ get: function() {
6206
+ return reportDevServices;
6207
+ }
6208
+ });
6209
+ Object.defineProperty(exports, "requiredStageKeys", {
6210
+ enumerable: true,
6211
+ get: function() {
6212
+ return requiredStageKeys;
6213
+ }
6214
+ });
5831
6215
  Object.defineProperty(exports, "resolveHost", {
5832
6216
  enumerable: true,
5833
6217
  get: function() {
@@ -5900,6 +6284,12 @@ Object.defineProperty(exports, "store_exports", {
5900
6284
  return store_exports;
5901
6285
  }
5902
6286
  });
6287
+ Object.defineProperty(exports, "suppliedOnly", {
6288
+ enumerable: true,
6289
+ get: function() {
6290
+ return suppliedOnly;
6291
+ }
6292
+ });
5903
6293
  Object.defineProperty(exports, "toEmbeddableSecrets", {
5904
6294
  enumerable: true,
5905
6295
  get: function() {
@@ -5931,4 +6321,4 @@ Object.defineProperty(exports, "workspace_exports", {
5931
6321
  }
5932
6322
  });
5933
6323
 
5934
- //# sourceMappingURL=state-DgmM4EKq.cjs.map
6324
+ //# sourceMappingURL=state-8RgXeX5Y.cjs.map