@geekmidas/cli 10.0.0-alpha.132 → 10.0.0-alpha.134

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 (133) hide show
  1. package/dist/{GoDaddyProvider-CtnM5qxL.cjs → GoDaddyProvider-BWU__DEY.cjs} +2 -2
  2. package/dist/{GoDaddyProvider-CtnM5qxL.cjs.map → GoDaddyProvider-BWU__DEY.cjs.map} +1 -1
  3. package/dist/{GoDaddyProvider-CLrIIpCr.mjs → GoDaddyProvider-bMRAYW79.mjs} +2 -2
  4. package/dist/{GoDaddyProvider-CLrIIpCr.mjs.map → GoDaddyProvider-bMRAYW79.mjs.map} +1 -1
  5. package/dist/{LegacyStateStore-C0LmkRnT.mjs → LegacyStateStore-BGEf6nPn.mjs} +3 -3
  6. package/dist/{LegacyStateStore-C0LmkRnT.mjs.map → LegacyStateStore-BGEf6nPn.mjs.map} +1 -1
  7. package/dist/{LegacyStateStore-C4rb-2W_.cjs → LegacyStateStore-BvTCypOA.cjs} +3 -3
  8. package/dist/{LegacyStateStore-C4rb-2W_.cjs.map → LegacyStateStore-BvTCypOA.cjs.map} +1 -1
  9. package/dist/{LocalStateStore-vHx3OPmE.mjs → LocalStateStore-B5oun7s4.mjs} +2 -2
  10. package/dist/{LocalStateStore-vHx3OPmE.mjs.map → LocalStateStore-B5oun7s4.mjs.map} +1 -1
  11. package/dist/{LocalStateStore-DL15tGfM.cjs → LocalStateStore-Dg_VH2hs.cjs} +2 -2
  12. package/dist/{LocalStateStore-DL15tGfM.cjs.map → LocalStateStore-Dg_VH2hs.cjs.map} +1 -1
  13. package/dist/{S3StateStore-CLJJ4G8F.mjs → S3StateStore-C0V3gdW_.mjs} +2 -2
  14. package/dist/{S3StateStore-CLJJ4G8F.mjs.map → S3StateStore-C0V3gdW_.mjs.map} +1 -1
  15. package/dist/{S3StateStore-jJUI-UW7.cjs → S3StateStore-vUawQwzF.cjs} +2 -2
  16. package/dist/{S3StateStore-jJUI-UW7.cjs.map → S3StateStore-vUawQwzF.cjs.map} +1 -1
  17. package/dist/{SSMStateStore-D1QPy_gq.mjs → SSMStateStore-6OqX1ljx.mjs} +2 -2
  18. package/dist/{SSMStateStore-D1QPy_gq.mjs.map → SSMStateStore-6OqX1ljx.mjs.map} +1 -1
  19. package/dist/{SSMStateStore-B0Z9hEeo.cjs → SSMStateStore-BqQmI50p.cjs} +2 -2
  20. package/dist/{SSMStateStore-B0Z9hEeo.cjs.map → SSMStateStore-BqQmI50p.cjs.map} +1 -1
  21. package/dist/{add-xwmKaLFC.mjs → add-Cf7j443Y.mjs} +4 -4
  22. package/dist/{add-xwmKaLFC.mjs.map → add-Cf7j443Y.mjs.map} +1 -1
  23. package/dist/{add-BV5ZDKgx.cjs → add-DH6kOCWt.cjs} +4 -4
  24. package/dist/{add-BV5ZDKgx.cjs.map → add-DH6kOCWt.cjs.map} +1 -1
  25. package/dist/{bundler-DrpnJNwr.mjs → bundler-DJOWPm2o.mjs} +5 -5
  26. package/dist/{bundler-DrpnJNwr.mjs.map → bundler-DJOWPm2o.mjs.map} +1 -1
  27. package/dist/{bundler-CHXBqzsc.cjs → bundler-NllxHcc3.cjs} +5 -5
  28. package/dist/{bundler-CHXBqzsc.cjs.map → bundler-NllxHcc3.cjs.map} +1 -1
  29. package/dist/{cli-o3cXaGtO.mjs → cli-CR1jbJwq.mjs} +2 -2
  30. package/dist/{cli-o3cXaGtO.mjs.map → cli-CR1jbJwq.mjs.map} +1 -1
  31. package/dist/{cli-CdwEMpeT.cjs → cli-D_lrSwHD.cjs} +2 -2
  32. package/dist/{cli-CdwEMpeT.cjs.map → cli-D_lrSwHD.cjs.map} +1 -1
  33. package/dist/{compose-DNRPMVES.cjs → compose-CTMonYlz.cjs} +4 -4
  34. package/dist/{compose-DNRPMVES.cjs.map → compose-CTMonYlz.cjs.map} +1 -1
  35. package/dist/{compose-D0SN1LaV.mjs → compose-EhGFelLH.mjs} +4 -4
  36. package/dist/{compose-D0SN1LaV.mjs.map → compose-EhGFelLH.mjs.map} +1 -1
  37. package/dist/config.cjs +1 -1
  38. package/dist/config.mjs +1 -1
  39. package/dist/deploy/public.cjs +7 -7
  40. package/dist/deploy/public.mjs +7 -7
  41. package/dist/{deploy-DC8YEQPF.cjs → deploy-Clny7rUL.cjs} +6 -6
  42. package/dist/{deploy-DC8YEQPF.cjs.map → deploy-Clny7rUL.cjs.map} +1 -1
  43. package/dist/{deploy-B98pqds6.mjs → deploy-Djdvl9Vw.mjs} +6 -6
  44. package/dist/{deploy-B98pqds6.mjs.map → deploy-Djdvl9Vw.mjs.map} +1 -1
  45. package/dist/{derive-BpT9jpPo.mjs → derive-Bsnm81mg.mjs} +6 -2
  46. package/dist/{derive-BpT9jpPo.mjs.map → derive-Bsnm81mg.mjs.map} +1 -1
  47. package/dist/{derive-BkWnOSPH.cjs → derive-ClMgyPzp.cjs} +11 -1
  48. package/dist/{derive-BkWnOSPH.cjs.map → derive-ClMgyPzp.cjs.map} +1 -1
  49. package/dist/{dokploy-BexEz2nW.mjs → dokploy-3XEN3qM8.mjs} +2 -2
  50. package/dist/{dokploy-BexEz2nW.mjs.map → dokploy-3XEN3qM8.mjs.map} +1 -1
  51. package/dist/{dokploy-DGVo3gIu.cjs → dokploy-BcmHDE-j.cjs} +2 -2
  52. package/dist/{dokploy-DGVo3gIu.cjs.map → dokploy-BcmHDE-j.cjs.map} +1 -1
  53. package/dist/{eas-DZ4DRSpN.cjs → eas-47ihrpP_.cjs} +3 -3
  54. package/dist/{eas-DZ4DRSpN.cjs.map → eas-47ihrpP_.cjs.map} +1 -1
  55. package/dist/{eas-vfFOLF35.mjs → eas-DFr4OtsE.mjs} +3 -3
  56. package/dist/{eas-vfFOLF35.mjs.map → eas-DFr4OtsE.mjs.map} +1 -1
  57. package/dist/emit-CYloptRS.cjs.map +1 -1
  58. package/dist/emit-CiJGdy_f.mjs.map +1 -1
  59. package/dist/{encryption-qxFK97mG.cjs → encryption-Be24KDa-.cjs} +2 -2
  60. package/dist/{encryption-qxFK97mG.cjs.map → encryption-Be24KDa-.cjs.map} +1 -1
  61. package/dist/{encryption-DcXhLeea.mjs → encryption-CTdgXPGk.mjs} +2 -2
  62. package/dist/{encryption-DcXhLeea.mjs.map → encryption-CTdgXPGk.mjs.map} +1 -1
  63. package/dist/{engine-BJ1JjsqP.mjs → engine-Cit4QpMf.mjs} +4 -4
  64. package/dist/{engine-BJ1JjsqP.mjs.map → engine-Cit4QpMf.mjs.map} +1 -1
  65. package/dist/{engine-BsfN6Z2y.cjs → engine-DJU3udhe.cjs} +4 -4
  66. package/dist/{engine-BsfN6Z2y.cjs.map → engine-DJU3udhe.cjs.map} +1 -1
  67. package/dist/{github-CHnzHGbI.cjs → github-Cn5zn5SP.cjs} +4 -4
  68. package/dist/{github-CHnzHGbI.cjs.map → github-Cn5zn5SP.cjs.map} +1 -1
  69. package/dist/{github-DM8dcTS3.mjs → github-DkkhCshn.mjs} +4 -4
  70. package/dist/{github-DM8dcTS3.mjs.map → github-DkkhCshn.mjs.map} +1 -1
  71. package/dist/{googlePlay-DDrnzQWm.mjs → googlePlay-BKZvrPUP.mjs} +3 -3
  72. package/dist/{googlePlay-DDrnzQWm.mjs.map → googlePlay-BKZvrPUP.mjs.map} +1 -1
  73. package/dist/{googlePlay-D4CBqrrd.cjs → googlePlay-CU3oeZmS.cjs} +3 -3
  74. package/dist/{googlePlay-D4CBqrrd.cjs.map → googlePlay-CU3oeZmS.cjs.map} +1 -1
  75. package/dist/index.cjs +92 -58
  76. package/dist/index.cjs.map +1 -1
  77. package/dist/index.mjs +93 -59
  78. package/dist/index.mjs.map +1 -1
  79. package/dist/{migrate-Dw94du_D.cjs → migrate-B8Zmp44v.cjs} +2 -2
  80. package/dist/{migrate-Dw94du_D.cjs.map → migrate-B8Zmp44v.cjs.map} +1 -1
  81. package/dist/{migrate-CtXmf5sw.mjs → migrate-BcVzkhs2.mjs} +2 -2
  82. package/dist/{migrate-CtXmf5sw.mjs.map → migrate-BcVzkhs2.mjs.map} +1 -1
  83. package/dist/{migrate-DXj1Kc79.mjs → migrate-CtjgTkyn.mjs} +2 -2
  84. package/dist/{migrate-DXj1Kc79.mjs.map → migrate-CtjgTkyn.mjs.map} +1 -1
  85. package/dist/{migrate-Bonkj7OS.cjs → migrate-DWbw8nOy.cjs} +2 -2
  86. package/dist/{migrate-Bonkj7OS.cjs.map → migrate-DWbw8nOy.cjs.map} +1 -1
  87. package/dist/openapi.cjs +1 -1
  88. package/dist/openapi.mjs +1 -1
  89. package/dist/{publish-0CESXM6R.mjs → publish-ClprDLQl.mjs} +2 -2
  90. package/dist/{publish-0CESXM6R.mjs.map → publish-ClprDLQl.mjs.map} +1 -1
  91. package/dist/{publish-CLD1NjFa.cjs → publish-CumoWjin.cjs} +2 -2
  92. package/dist/{publish-CLD1NjFa.cjs.map → publish-CumoWjin.cjs.map} +1 -1
  93. package/dist/reconcile/public.d.cts +6 -0
  94. package/dist/reconcile/public.d.cts.map +1 -1
  95. package/dist/reconcile/public.d.mts +6 -0
  96. package/dist/reconcile/public.d.mts.map +1 -1
  97. package/dist/{resolve-DuZ4RSeN.mjs → resolve-DDFQRZh_.mjs} +4 -4
  98. package/dist/{resolve-DuZ4RSeN.mjs.map → resolve-DDFQRZh_.mjs.map} +1 -1
  99. package/dist/{resolve-Af3UHIxS.cjs → resolve-nMzMombL.cjs} +4 -4
  100. package/dist/{resolve-Af3UHIxS.cjs.map → resolve-nMzMombL.cjs.map} +1 -1
  101. package/dist/{rollback-CWcIVBLT.cjs → rollback-CTWZB5Ai.cjs} +4 -4
  102. package/dist/{rollback-CWcIVBLT.cjs.map → rollback-CTWZB5Ai.cjs.map} +1 -1
  103. package/dist/{rollback-DCIeBIX3.mjs → rollback-M6Tzl8X-.mjs} +4 -4
  104. package/dist/{rollback-DCIeBIX3.mjs.map → rollback-M6Tzl8X-.mjs.map} +1 -1
  105. package/dist/{seeds-CVbX__84.mjs → seeds-B5Lw7Jwy.mjs} +85 -20
  106. package/dist/seeds-B5Lw7Jwy.mjs.map +1 -0
  107. package/dist/{seeds-BGhU_55R.cjs → seeds-Dq62Vi1i.cjs} +85 -20
  108. package/dist/seeds-Dq62Vi1i.cjs.map +1 -0
  109. package/dist/{serverSetup-Blb5uyq8.mjs → serverSetup-lCtWjAbe.mjs} +5 -5
  110. package/dist/{serverSetup-Blb5uyq8.mjs.map → serverSetup-lCtWjAbe.mjs.map} +1 -1
  111. package/dist/{serverSetup-C8W-mpu2.cjs → serverSetup-tkxyu4C4.cjs} +5 -5
  112. package/dist/{serverSetup-C8W-mpu2.cjs.map → serverSetup-tkxyu4C4.cjs.map} +1 -1
  113. package/dist/{sniffer-C94960vd.cjs → sniffer-BHWLGxbU.cjs} +6 -6
  114. package/dist/{sniffer-C94960vd.cjs.map → sniffer-BHWLGxbU.cjs.map} +1 -1
  115. package/dist/{sniffer-xx8N8mpY.mjs → sniffer-DBT-n3aP.mjs} +6 -6
  116. package/dist/{sniffer-xx8N8mpY.mjs.map → sniffer-DBT-n3aP.mjs.map} +1 -1
  117. package/dist/{snsSubscriptions-CLkFDjZc.mjs → snsSubscriptions-CZcuwbO-.mjs} +3 -3
  118. package/dist/{snsSubscriptions-CLkFDjZc.mjs.map → snsSubscriptions-CZcuwbO-.mjs.map} +1 -1
  119. package/dist/{snsSubscriptions-DcmmVj2k.cjs → snsSubscriptions-DeA_EfK2.cjs} +3 -3
  120. package/dist/{snsSubscriptions-DcmmVj2k.cjs.map → snsSubscriptions-DeA_EfK2.cjs.map} +1 -1
  121. package/dist/{sst-C7mwg02Z.cjs → sst-CHOp2-qt.cjs} +2 -2
  122. package/dist/{sst-C7mwg02Z.cjs.map → sst-CHOp2-qt.cjs.map} +1 -1
  123. package/dist/{sst-ChTeT2qY.mjs → sst-WPkIfa64.mjs} +2 -2
  124. package/dist/{sst-ChTeT2qY.mjs.map → sst-WPkIfa64.mjs.map} +1 -1
  125. package/dist/{stage-COixgz4P.mjs → stage-Bqgc0gpc.mjs} +4 -4
  126. package/dist/{stage-COixgz4P.mjs.map → stage-Bqgc0gpc.mjs.map} +1 -1
  127. package/dist/{stage-BdJzkWOO.cjs → stage-CvaUCPxu.cjs} +4 -4
  128. package/dist/{stage-BdJzkWOO.cjs.map → stage-CvaUCPxu.cjs.map} +1 -1
  129. package/dist/target/public.cjs +1 -1
  130. package/dist/target/public.mjs +1 -1
  131. package/package.json +15 -15
  132. package/dist/seeds-BGhU_55R.cjs.map +0 -1
  133. package/dist/seeds-CVbX__84.mjs.map +0 -1
@@ -2,14 +2,14 @@ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
2
  const require_errors = require("./errors-DMC4Umsb.cjs");
3
3
  const require_credentials = require("./credentials-D7XJypNd.cjs");
4
4
  const require_workspace = require("./workspace-secxwA6K.cjs");
5
- const require_derive = require("./derive-BkWnOSPH.cjs");
5
+ const require_derive = require("./derive-ClMgyPzp.cjs");
6
6
  const require_drivers = require("./drivers-C47nm-wB.cjs");
7
7
  const require_identity = require("./identity-CbLfgQNT.cjs");
8
8
  const require_EndpointGenerator = require("./EndpointGenerator-D3p5WQOv.cjs");
9
9
  const require_discover = require("./discover-DEOspD9M.cjs");
10
10
  const require_config = require("./config.cjs");
11
11
  const require_SubscriberGenerator = require("./SubscriberGenerator-uDZW1ddC.cjs");
12
- const require_resolve = require("./resolve-Af3UHIxS.cjs");
12
+ const require_resolve = require("./resolve-nMzMombL.cjs");
13
13
  let node_path = require("node:path");
14
14
  let node_fs = require("node:fs");
15
15
  let node_fs_promises = require("node:fs/promises");
@@ -600,13 +600,49 @@ function sitesFor(plan, project, addresses = {}, processorAddresses = {}) {
600
600
  if (!address) continue;
601
601
  const port = portOf(address);
602
602
  if (!port) continue;
603
+ const upstream = `http://${HOST_GATEWAY$1}:${port}`;
604
+ if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) {
605
+ sites.push({
606
+ host,
607
+ upstream,
608
+ tenants: tenantsOf(resource, host, addresses)
609
+ });
610
+ continue;
611
+ }
603
612
  sites.push({
604
613
  host,
605
- upstream: `http://${HOST_GATEWAY$1}:${port}`
614
+ upstream
606
615
  });
607
616
  }
608
617
  return sites;
609
618
  }
619
+ /**
620
+ * What stands between a wildcard site and a host that is not a tenant.
621
+ *
622
+ * Caddy already prefers a named host to the `*`, so `api.shop.localhost`
623
+ * reaches the API whatever the wildcard says. What it cannot know is the
624
+ * labels nothing is running on: `www`, or an app this stage has not started.
625
+ * Those are refused here, so no slug that a deploy would protect is ever
626
+ * served locally either.
627
+ *
628
+ * The `hosts` route is asked through `forward_auth`, which is a deployed
629
+ * edge's check in miniature: a `2xx` lets the request through, and any other
630
+ * answer — the app's own `404` — is what the browser gets, so a mistyped
631
+ * slug fails here and not first in production. Without an address for the
632
+ * surface serving it there is nothing to ask, and every host is served.
633
+ */
634
+ function tenantsOf(resource, host, addresses) {
635
+ const domain = host.slice(`${_geekmidas_manifest.WILDCARD_SUBDOMAIN}.`.length);
636
+ const surface = resource.hosts ? addresses[resource.hosts.surface] : void 0;
637
+ const port = surface ? portOf(surface) : void 0;
638
+ return {
639
+ protected: (resource.protectedSubdomains ?? []).map((label) => `${label}.${domain}`),
640
+ ...resource.hosts && port ? { hosts: {
641
+ upstream: `http://${HOST_GATEWAY$1}:${port}`,
642
+ uri: `${resource.hosts.path}?domain={host}`
643
+ } } : {}
644
+ };
645
+ }
610
646
  /** The port a local address answers on, defaulting by scheme. */
611
647
  function portOf(address) {
612
648
  try {
@@ -689,7 +725,19 @@ function toCaddyfile(sites) {
689
725
  if (sites.length === 0) return `${GENERATED}
690
726
  # No file server is declared in this stage, so it routes nothing.
691
727
  `;
692
- const blocks = sites.map(({ host, upstream, rewrite, processors }) => `
728
+ const blocks = sites.map(({ host, upstream, rewrite, processors, tenants }) => {
729
+ const proxy = `reverse_proxy ${upstream} {${rewrite ? `
730
+ rewrite ${rewrite}
731
+ # MinIO routes and signs on the Host header, so forwarding the requested
732
+ # hostname would make it look for a bucket named after the domain.
733
+ header_up Host {upstream_hostport}` : `
734
+ # The application reads whatever address was injected, so it has to see
735
+ # the one a caller used — that is what makes a redirect, a cookie domain
736
+ # and a generated link point back here rather than at the upstream.
737
+ header_up Host {host}
738
+ header_up X-Forwarded-Proto {scheme}`}
739
+ }`;
740
+ return `
693
741
  https://${host} {
694
742
  tls internal
695
743
 
@@ -706,21 +754,35 @@ ${processors ? `
706
754
  header_up Host {host}
707
755
  }
708
756
  }
709
- ` : ""}
710
- reverse_proxy ${upstream} {${rewrite ? `
711
- rewrite ${rewrite}
712
- # MinIO routes and signs on the Host header, so forwarding the requested
713
- # hostname would make it look for a bucket named after the domain.
714
- header_up Host {upstream_hostport}` : `
715
- # The application reads whatever address was injected, so it has to see
716
- # the one a caller used — that is what makes a redirect, a cookie domain
717
- # and a generated link point back here rather than at the upstream.
718
- header_up Host {host}
719
- header_up X-Forwarded-Proto {scheme}`}
720
- }
721
- }`);
757
+ ` : ""}${tenants ? tenantBlock(tenants, proxy) : ` ${proxy}`}
758
+ }`;
759
+ });
722
760
  return `${GENERATED}${blocks.join("\n")}\n`;
723
761
  }
762
+ /**
763
+ * A wildcard site's routes: a protected host refused, every other host asked
764
+ * about before it is proxied. `handle` blocks rather than bare directives,
765
+ * because Caddy orders directives itself and would proxy before it refused.
766
+ */
767
+ function tenantBlock(tenants, proxy) {
768
+ return `${tenants.protected.length ? `
769
+ # Labels an app answers on, or that the workspace protects: never a
770
+ # tenant's, whether or not anything is running on them.
771
+ @protected host ${tenants.protected.join(" ")}
772
+ handle @protected {
773
+ respond 404
774
+ }
775
+ ` : ""}
776
+ handle {${tenants.hosts ? `
777
+ # Which hosts are tenants is the app's to say: its \`hosts\` route
778
+ # answers 200 to serve this one, and anything else goes back as is.
779
+ forward_auth ${tenants.hosts.upstream} {
780
+ uri ${tenants.hosts.uri}
781
+ }
782
+ ` : ""}
783
+ ${proxy.replaceAll("\n", "\n ")}
784
+ }`;
785
+ }
724
786
  const GENERATED = `# Generated by gkm from the construct manifest — do not edit.
725
787
  #
726
788
  # One host per declared file server, in front of the object store that holds its
@@ -1177,7 +1239,10 @@ function planFor(manifest, stage, order, options = {}) {
1177
1239
  ...declaration.kind === "file-server" && declaration.processors?.length ? { processors: [...new Set(declaration.processors.map((p) => p.prefix))].sort() } : {},
1178
1240
  ...declaration.kind === "objects" && (0, _geekmidas_manifest.bucketExpiry)(manifest, id) ? { expire: (0, _geekmidas_manifest.bucketExpiry)(manifest, id) } : {},
1179
1241
  ...(declaration.kind === "rest-api" || declaration.kind === "websocket-api" || declaration.kind === "site") && declaration.subdomain ? { subdomain: declaration.subdomain } : {},
1180
- ...(0, _geekmidas_manifest.isWildcardSite)(declaration) ? { protectedSubdomains: require_derive.protectedSubdomains(manifest, options.protectedSubdomains) } : {},
1242
+ ...(0, _geekmidas_manifest.isWildcardSite)(declaration) ? {
1243
+ protectedSubdomains: require_derive.protectedSubdomains(manifest, options.protectedSubdomains),
1244
+ ...declaration.hosts ? { hosts: declaration.hosts } : {}
1245
+ } : {},
1181
1246
  ...fake ? { fake: {
1182
1247
  key: fake.key,
1183
1248
  credentials: fake.credentials
@@ -8365,7 +8430,7 @@ async function createDnsProvider(options) {
8365
8430
  });
8366
8431
  }
8367
8432
  if (provider === "godaddy") {
8368
- const { GoDaddyProvider } = await Promise.resolve().then(() => require("./GoDaddyProvider-CtnM5qxL.cjs"));
8433
+ const { GoDaddyProvider } = await Promise.resolve().then(() => require("./GoDaddyProvider-BWU__DEY.cjs"));
8369
8434
  return new GoDaddyProvider(options.godaddy ?? {});
8370
8435
  }
8371
8436
  if (provider === "cloudflare") throw new DnsProviderNotImplemented("cloudflare");
@@ -10319,4 +10384,4 @@ Object.defineProperty(exports, "workspace_exports", {
10319
10384
  }
10320
10385
  });
10321
10386
 
10322
- //# sourceMappingURL=seeds-BGhU_55R.cjs.map
10387
+ //# sourceMappingURL=seeds-Dq62Vi1i.cjs.map