@geekmidas/cli 10.0.0-alpha.76 → 10.0.0-alpha.78

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/{LegacyStateStore-dyq07_Ir.mjs → LegacyStateStore-Ceq7A_75.mjs} +2 -2
  2. package/dist/{LegacyStateStore-dyq07_Ir.mjs.map → LegacyStateStore-Ceq7A_75.mjs.map} +1 -1
  3. package/dist/{LegacyStateStore-DwngfJxr.cjs → LegacyStateStore-Z-EKUGSX.cjs} +2 -2
  4. package/dist/{LegacyStateStore-DwngfJxr.cjs.map → LegacyStateStore-Z-EKUGSX.cjs.map} +1 -1
  5. package/dist/{LocalStateStore-B0NCde8Z.cjs → LocalStateStore-Bocb8dmZ.cjs} +2 -2
  6. package/dist/{LocalStateStore-B0NCde8Z.cjs.map → LocalStateStore-Bocb8dmZ.cjs.map} +1 -1
  7. package/dist/{LocalStateStore-DLxCCatI.mjs → LocalStateStore-C72bwpG2.mjs} +2 -2
  8. package/dist/{LocalStateStore-DLxCCatI.mjs.map → LocalStateStore-C72bwpG2.mjs.map} +1 -1
  9. package/dist/{S3StateStore-BOenb-3o.cjs → S3StateStore-35YfcdL_.cjs} +2 -2
  10. package/dist/{S3StateStore-BOenb-3o.cjs.map → S3StateStore-35YfcdL_.cjs.map} +1 -1
  11. package/dist/{S3StateStore-CGK_4hlo.mjs → S3StateStore-C9upSW5o.mjs} +2 -2
  12. package/dist/{S3StateStore-CGK_4hlo.mjs.map → S3StateStore-C9upSW5o.mjs.map} +1 -1
  13. package/dist/{SSMStateStore-DYeD__7p.cjs → SSMStateStore-W-Ps22AQ.cjs} +2 -2
  14. package/dist/{SSMStateStore-DYeD__7p.cjs.map → SSMStateStore-W-Ps22AQ.cjs.map} +1 -1
  15. package/dist/{SSMStateStore-B_5_RqY-.mjs → SSMStateStore-dOmFO6g1.mjs} +2 -2
  16. package/dist/{SSMStateStore-B_5_RqY-.mjs.map → SSMStateStore-dOmFO6g1.mjs.map} +1 -1
  17. package/dist/{add-j2yI3cbS.cjs → add-BvOICikp.cjs} +8 -8
  18. package/dist/{add-j2yI3cbS.cjs.map → add-BvOICikp.cjs.map} +1 -1
  19. package/dist/{add-B7IMXzou.mjs → add-D2XKszYP.mjs} +3 -3
  20. package/dist/{add-B7IMXzou.mjs.map → add-D2XKszYP.mjs.map} +1 -1
  21. package/dist/{bundler-Cf6OgaOe.cjs → bundler-C6T-1OLT.cjs} +5 -5
  22. package/dist/{bundler-Cf6OgaOe.cjs.map → bundler-C6T-1OLT.cjs.map} +1 -1
  23. package/dist/{bundler-DO6bHhnb.mjs → bundler-CtHzKqnZ.mjs} +5 -5
  24. package/dist/{bundler-DO6bHhnb.mjs.map → bundler-CtHzKqnZ.mjs.map} +1 -1
  25. package/dist/{cli-BCPOHmg9.mjs → cli-BgPyhx1i.mjs} +3 -3
  26. package/dist/{cli-BCPOHmg9.mjs.map → cli-BgPyhx1i.mjs.map} +1 -1
  27. package/dist/{cli-CNanUB7a.cjs → cli-K6Vj_pPW.cjs} +4 -4
  28. package/dist/{cli-CNanUB7a.cjs.map → cli-K6Vj_pPW.cjs.map} +1 -1
  29. package/dist/{compose-h_6oNnHC.cjs → compose-B7MC19eC.cjs} +668 -110
  30. package/dist/compose-B7MC19eC.cjs.map +1 -0
  31. package/dist/{compose-Dq4VCtu5.mjs → compose-DByK353T.mjs} +606 -66
  32. package/dist/compose-DByK353T.mjs.map +1 -0
  33. package/dist/{config-CqAvPP-f.d.mts → config-Bql0AmJt.d.mts} +3 -3
  34. package/dist/{config-CWyhLSY1.d.cts.map → config-Bql0AmJt.d.mts.map} +1 -1
  35. package/dist/{config-CWyhLSY1.d.cts → config-DlNpHK8p.d.cts} +3 -3
  36. package/dist/{config-CqAvPP-f.d.mts.map → config-DlNpHK8p.d.cts.map} +1 -1
  37. package/dist/config.cjs +1 -1
  38. package/dist/config.d.cts +3 -3
  39. package/dist/config.d.mts +3 -3
  40. package/dist/config.mjs +1 -1
  41. package/dist/deploy/public.cjs +12 -12
  42. package/dist/deploy/public.d.cts +3 -3
  43. package/dist/deploy/public.d.cts.map +1 -1
  44. package/dist/deploy/public.d.mts +3 -3
  45. package/dist/deploy/public.d.mts.map +1 -1
  46. package/dist/deploy/public.mjs +6 -6
  47. package/dist/{deploy-CVXEx7Nm.mjs → deploy-BerP7ppB.mjs} +5 -5
  48. package/dist/{deploy-CVXEx7Nm.mjs.map → deploy-BerP7ppB.mjs.map} +1 -1
  49. package/dist/{deploy-CT3R9de9.cjs → deploy-Dt42xiQA.cjs} +11 -11
  50. package/dist/{deploy-CT3R9de9.cjs.map → deploy-Dt42xiQA.cjs.map} +1 -1
  51. package/dist/{dokploy-eSGmlhhj.cjs → dokploy-NG9UrVrP.cjs} +2 -2
  52. package/dist/{dokploy-eSGmlhhj.cjs.map → dokploy-NG9UrVrP.cjs.map} +1 -1
  53. package/dist/{dokploy-CYm2ozFs.mjs → dokploy-ssZQRK2C.mjs} +2 -2
  54. package/dist/{dokploy-CYm2ozFs.mjs.map → dokploy-ssZQRK2C.mjs.map} +1 -1
  55. package/dist/{encryption-vS3Qzw73.cjs → encryption-CbMI24fI.cjs} +6 -6
  56. package/dist/{encryption-vS3Qzw73.cjs.map → encryption-CbMI24fI.cjs.map} +1 -1
  57. package/dist/{encryption-DC0rsR1W.mjs → encryption-De6MN0O5.mjs} +3 -3
  58. package/dist/{encryption-DC0rsR1W.mjs.map → encryption-De6MN0O5.mjs.map} +1 -1
  59. package/dist/{engine-C0N2d1i5.cjs → engine-CoCsNoW_.cjs} +73 -68
  60. package/dist/{engine-C0N2d1i5.cjs.map → engine-CoCsNoW_.cjs.map} +1 -1
  61. package/dist/{engine-BOO5TWZd.mjs → engine-DOjGIgl4.mjs} +9 -4
  62. package/dist/{engine-BOO5TWZd.mjs.map → engine-DOjGIgl4.mjs.map} +1 -1
  63. package/dist/{github-CEaFDL6t.mjs → github-CwX9z89E.mjs} +3 -3
  64. package/dist/{github-CEaFDL6t.mjs.map → github-CwX9z89E.mjs.map} +1 -1
  65. package/dist/{github-ClkdCOL9.cjs → github-D9vGqdLk.cjs} +7 -7
  66. package/dist/{github-ClkdCOL9.cjs.map → github-D9vGqdLk.cjs.map} +1 -1
  67. package/dist/{index-DOxmDKqv.d.mts → index-BXO0vlme.d.mts} +2 -2
  68. package/dist/{index-Ccu0f_2m.d.cts.map → index-BXO0vlme.d.mts.map} +1 -1
  69. package/dist/{index-Ccu0f_2m.d.cts → index-Rs0Fua-q.d.cts} +2 -2
  70. package/dist/{index-DOxmDKqv.d.mts.map → index-Rs0Fua-q.d.cts.map} +1 -1
  71. package/dist/index.cjs +180 -219
  72. package/dist/index.cjs.map +1 -1
  73. package/dist/index.mjs +108 -147
  74. package/dist/index.mjs.map +1 -1
  75. package/dist/{migrate-BRbYtFXG.cjs → migrate-B4GBvCNY.cjs} +5 -5
  76. package/dist/{migrate-BRbYtFXG.cjs.map → migrate-B4GBvCNY.cjs.map} +1 -1
  77. package/dist/{migrate-D3NAT7Ns.mjs → migrate-BQ4wVKq_.mjs} +3 -3
  78. package/dist/{migrate-D3NAT7Ns.mjs.map → migrate-BQ4wVKq_.mjs.map} +1 -1
  79. package/dist/{migrate-DrO2p9Rl.mjs → migrate-CNKaQl3K.mjs} +3 -3
  80. package/dist/{migrate-DrO2p9Rl.mjs.map → migrate-CNKaQl3K.mjs.map} +1 -1
  81. package/dist/{migrate-D5_-ylI1.cjs → migrate-Cgoy58Sh.cjs} +8 -8
  82. package/dist/{migrate-D5_-ylI1.cjs.map → migrate-Cgoy58Sh.cjs.map} +1 -1
  83. package/dist/openapi.cjs +1 -1
  84. package/dist/openapi.d.cts +1 -1
  85. package/dist/openapi.d.mts +1 -1
  86. package/dist/openapi.mjs +1 -1
  87. package/dist/reconcile/public.d.cts +1 -1
  88. package/dist/reconcile/public.d.mts +1 -1
  89. package/dist/{resolve-Fa1Ii0BK.cjs → resolve-CEaqRBzY.cjs} +3 -3
  90. package/dist/{resolve-Fa1Ii0BK.cjs.map → resolve-CEaqRBzY.cjs.map} +1 -1
  91. package/dist/{resolve-C1muFos5.mjs → resolve-mvaystiE.mjs} +3 -3
  92. package/dist/{resolve-C1muFos5.mjs.map → resolve-mvaystiE.mjs.map} +1 -1
  93. package/dist/{rollback-C9N5lKVf.cjs → rollback-F3P-rA-r.cjs} +7 -7
  94. package/dist/{rollback-C9N5lKVf.cjs.map → rollback-F3P-rA-r.cjs.map} +1 -1
  95. package/dist/{rollback-DeQzbRqM.mjs → rollback-S2C-Y9pB.mjs} +5 -5
  96. package/dist/{rollback-DeQzbRqM.mjs.map → rollback-S2C-Y9pB.mjs.map} +1 -1
  97. package/dist/{runtime-Cm7QA53H.d.cts → runtime-D9AxGzrw.d.cts} +2 -2
  98. package/dist/{runtime-BSvzPqXW.d.mts.map → runtime-D9AxGzrw.d.cts.map} +1 -1
  99. package/dist/{runtime-BSvzPqXW.d.mts → runtime-Dflki3Vs.d.mts} +2 -2
  100. package/dist/{runtime-Cm7QA53H.d.cts.map → runtime-Dflki3Vs.d.mts.map} +1 -1
  101. package/dist/{sniffer-Y6GQOCXB.cjs → sniffer-BjG-1mlD.cjs} +6 -6
  102. package/dist/{sniffer-Y6GQOCXB.cjs.map → sniffer-BjG-1mlD.cjs.map} +1 -1
  103. package/dist/{sniffer-DR8AlRCk.mjs → sniffer-ByWtH28i.mjs} +6 -6
  104. package/dist/{sniffer-DR8AlRCk.mjs.map → sniffer-ByWtH28i.mjs.map} +1 -1
  105. package/dist/{state-C2qi0iQw.cjs → stale-BsiPJI7Y.cjs} +111 -25
  106. package/dist/stale-BsiPJI7Y.cjs.map +1 -0
  107. package/dist/{state-CUecOCNJ.mjs → stale-C5FqIVc8.mjs} +106 -26
  108. package/dist/stale-C5FqIVc8.mjs.map +1 -0
  109. package/dist/target/public.cjs +1 -1
  110. package/dist/target/public.d.cts +2 -2
  111. package/dist/target/public.d.mts +2 -2
  112. package/dist/target/public.mjs +1 -1
  113. package/dist/{types-BdptGBFS.d.cts → types-ByY0zi3n.d.cts} +42 -3
  114. package/dist/types-ByY0zi3n.d.cts.map +1 -0
  115. package/dist/{types-OxE0OAn2.d.mts → types-DKxkXsKC.d.mts} +42 -3
  116. package/dist/types-DKxkXsKC.d.mts.map +1 -0
  117. package/dist/workspace/index.cjs +1 -1
  118. package/dist/workspace/index.d.cts +2 -2
  119. package/dist/workspace/index.d.mts +2 -2
  120. package/dist/workspace/index.mjs +1 -1
  121. package/dist/{workspace-QUTqYmVy.mjs → workspace-BBdqmkch.mjs} +114 -17
  122. package/dist/workspace-BBdqmkch.mjs.map +1 -0
  123. package/dist/{workspace-DOm81oUo.cjs → workspace-Bp8FEkF-.cjs} +130 -15
  124. package/dist/workspace-Bp8FEkF-.cjs.map +1 -0
  125. package/package.json +15 -15
  126. package/dist/compose-Dq4VCtu5.mjs.map +0 -1
  127. package/dist/compose-h_6oNnHC.cjs.map +0 -1
  128. package/dist/state-C2qi0iQw.cjs.map +0 -1
  129. package/dist/state-CUecOCNJ.mjs.map +0 -1
  130. package/dist/types-BdptGBFS.d.cts.map +0 -1
  131. package/dist/types-OxE0OAn2.d.mts.map +0 -1
  132. package/dist/workspace-DOm81oUo.cjs.map +0 -1
  133. package/dist/workspace-QUTqYmVy.mjs.map +0 -1
@@ -2,10 +2,10 @@ import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
2
  import { i as run$1, s as gkmHome } from "./run-BJLIerMM.mjs";
3
3
  import { d as output, r as discover, u as ConstructGenerator } from "./discover-BPelzeGW.mjs";
4
4
  import { t as appKey } from "./derive-B4vDpzgP.mjs";
5
- import { F as UnknownSecretsStoreProvider, O as TEST_STAGE, h as getPublicEnvPrefix, m as PUBLIC_ENV_PREFIXES, n as allConstructGlobs } from "./workspace-QUTqYmVy.mjs";
5
+ import { O as TEST_STAGE, R as UnknownSecretsStoreProvider, h as getPublicEnvPrefix, m as PUBLIC_ENV_PREFIXES, n as allConstructGlobs } from "./workspace-BBdqmkch.mjs";
6
6
  import { ConfigNotFound, NotInAnApp, loadWorkspaceAppInfo, loadWorkspaceConfig } from "./config.mjs";
7
7
  import { n as runtimeFor, r as generateTelemetryModule } from "./EndpointGenerator-DftalLYg.mjs";
8
- import { c as runtimeOf } from "./resolve-C1muFos5.mjs";
8
+ import { c as runtimeOf } from "./resolve-mvaystiE.mjs";
9
9
  import { a as DEFAULT_STORAGE, i as DEFAULT_EVENTS$1, n as readFakes, o as holdsEveryCache, r as DEFAULT_CACHE, t as SubscriberGenerator } from "./SubscriberGenerator-5looQ3gB.mjs";
10
10
  import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
11
11
  import { constants, existsSync, readFileSync } from "node:fs";
@@ -91,10 +91,6 @@ function toEmbeddableSecrets(secrets) {
91
91
  AWS_SECRET_ACCESS_KEY: secrets.services.localstack.password,
92
92
  AWS_REGION: secrets.services.localstack.region ?? "us-east-1",
93
93
  AWS_ENDPOINT_URL: `http://${secrets.services.localstack.host}:${secrets.services.localstack.port}`
94
- },
95
- ...secrets.services.pgboss && {
96
- PGBOSS_DB_USER: secrets.services.pgboss.username,
97
- PGBOSS_DB_PASSWORD: secrets.services.pgboss.password
98
94
  }
99
95
  };
100
96
  }
@@ -661,24 +657,18 @@ async function savePortState(workspaceRoot, ports) {
661
657
  await writeFile(join(workspaceRoot, PORT_STATE_PATH), `${JSON.stringify(ports, null, 2)}\n`);
662
658
  }
663
659
  /**
664
- * Load and flatten secrets for an app from encrypted storage.
665
- * For workspace app: maps {APP}_DATABASE_URL → DATABASE_URL.
660
+ * Load and flatten a stage's secrets from its store.
661
+ *
662
+ * Every key as stored — nothing renamed. An app's database URL is its
663
+ * construct's key, derived by reconcile, and never a stored per-app value
664
+ * mapped onto `DATABASE_URL`.
666
665
  * @internal Exported for testing
667
666
  */
668
- async function loadSecretsForApp(store, stage, appName) {
669
- let secrets = {};
667
+ async function loadSecretsForApp(store, stage) {
670
668
  const stageSecrets = await store.read(stage);
671
- if (stageSecrets) {
672
- logger$1.log(`🔐 Loading secrets from stage: ${stage}`);
673
- secrets = toEmbeddableSecrets(stageSecrets);
674
- }
675
- if (Object.keys(secrets).length === 0) return {};
676
- if (!appName) return secrets;
677
- const prefix = appName.toUpperCase();
678
- const mapped = { ...secrets };
679
- const appDbUrl = secrets[`${prefix}_DATABASE_URL`];
680
- if (appDbUrl) mapped.DATABASE_URL = appDbUrl;
681
- return mapped;
669
+ if (!stageSecrets) return {};
670
+ logger$1.log(`🔐 Loading secrets from stage: ${stage}`);
671
+ return toEmbeddableSecrets(stageSecrets);
682
672
  }
683
673
  /**
684
674
  * Walk up the directory tree to find the root containing .gkm/secrets/.
@@ -786,7 +776,7 @@ async function prepareEntryCredentials(options) {
786
776
  const resolvedPort = options.explicitPort ?? workspaceAppPort ?? 3e3;
787
777
  const stage = options.stage ?? workspace?.stages.local;
788
778
  const store = stage ? workspace ? await secretsStoreFor(workspace, stage) : new FileSecretsStore(secretsRoot) : void 0;
789
- const credentials = store && stage ? await loadSecretsForApp(store, stage, appName) : {};
779
+ const credentials = store && stage ? await loadSecretsForApp(store, stage) : {};
790
780
  credentials.PORT = String(resolvedPort);
791
781
  if (appInfo?.app.type === "mobile") credentials.RCT_METRO_PORT = String(resolvedPort);
792
782
  const declaredKeys = [];
@@ -3098,13 +3088,13 @@ function sitePublicArgs(manifest, appName, env) {
3098
3088
  * network for a service another service calls, public for what a browser is
3099
3089
  * handed. `gkm compose` asks twice, once for each.
3100
3090
  */
3101
- function networkEnv(plan, options) {
3091
+ function networkEnv(plan, options, hostOf = (container) => container) {
3102
3092
  const placeholders = {};
3103
3093
  const targets = /* @__PURE__ */ new Map();
3104
3094
  let next = 49152;
3105
3095
  for (const container of [...plan.containers].sort()) for (const port of portsOf(container, plan.fakes)) {
3106
3096
  placeholders[port.key] = next;
3107
- targets.set(next, `${container}:${port.inside}`);
3097
+ targets.set(next, `${hostOf(container)}:${port.inside}`);
3108
3098
  next += 1;
3109
3099
  }
3110
3100
  for (const key of portKeys(plan.containers, plan.fakes)) placeholders[key] ??= next++;
@@ -6497,6 +6487,96 @@ function setPostgresBackupId(state, backupId) {
6497
6487
  if (state.backups) state.backups.postgresBackupId = backupId;
6498
6488
  }
6499
6489
  //#endregion
6500
- export { LOCAL_CA_PATH as $, applicationName as $t, ExternalServicesNotConfigured as A, providerOf as At, suppliedOnly as B, isPortAvailable as Bt, NoDomainForStage as C, WORKER_PORT as Ct, otelEnv as D, isImageBuild as Dt, isOtlpDestination as E, imageBuildCredentials as Et, externalServices as F, portKeys as Ft, QueueGenerator as G, secretsStoreFor as Gt, WorkerGenerator as H, loadSecretsForApp as Ht, manifestServiceDeclarations as I, primaryPortKey as It, backendsOf as J, FileSecretsStore as Jt, CronGenerator as K, storeFromConfig as Kt, parseDevServices as L, createCredentialsPreload as Lt, UnknownDevService as M, DEFAULT_IMAGES as Mt, assertExternalServices as N, describeServices as Nt, DEV_SERVICES as O, cacheBackendFor as Ot, devServicesUsed as P, fakeKey as Pt, workspace_exports as Q, readKey as Qt, reportDevServices as R, createEntryWrapper as Rt, validateImageRef as S, TURBO_VERSION as St, resolveHost as T, findBuildRoot as Tt, workerBundleName as U, prepareEntryCredentials as Ut, workerUnits as V, loadEnvFiles as Vt, workerEntryDir as W, isRemoteStore as Wt, derivedContainers as X, keystoreProject as Xt, constructGlobs as Y, getKeyPath as Yt, reconcileWorkspace as Z, projectKey as Zt, appDockerfile as _, planFor as _t, recordRelease as a, ownershipMarker as an, postgresDatabaseNames as at, workerDockerfile as b, composeBuildPaths as bt, setBackupState as c, maskPassword as cn, composeFor as ct, setGeneratedSecret as d, withCustomSecret as dn, appEnvKeys as dt, deployIdentity as en, forgetState as et, setPostgresBackupId as f, dockerfileOf as ft, DockerPushFailed as g, localRolePassword as gt, DockerBuildFailed as h, envFor as ht, isDnsVerified as i, markerOf as in, bucketPolicies as it, STORAGE_KEY_PAIR as j, storageBackendFor as jt, DevServicesNeedServerTarget as k, eventsBackendFor as kt, setDnsRecord as l, storage_exports as ln, bucketClient as lt, withGeneratedSecrets as m, workerEnvKeys as mt, getBackupState as n, imageRef as nn, applyPolicies as nt, recordRollback as o, projectName as on, postgresStatements as ot, DeployJournal as p, networkEnv as pt, FAKE_ENV as q, store_exports as qt, getGeneratedSecret as r, isOwnedBy as rn, applyPostgres as rt, setApplicationId as s, initStageSecrets as sn, quoteIdentifier as st, createEmptyState as t, imageName as tn, applyBuckets as tt, setDnsVerification as u, toEmbeddableSecrets as un, pgClient as ut, dockerCommand as v, resourceName as vt, isMainFrontendApp as w, detectPackageManager as wt, workerDockerfileOf as x, imageLayout as xt, ensureDockerignore as y, hostFor as yt, requiredStageKeys as z, findAvailablePort as zt };
6490
+ //#region src/secrets/stale.ts
6491
+ /**
6492
+ * Stored secrets an older gkm generated that now shadow a derived value.
6493
+ *
6494
+ * Before constructs, initialising a stage wrote an address for each app into
6495
+ * its custom secrets: `<APP>_DATABASE_URL` as a `postgresql://…@localhost`
6496
+ * URL with a password of its own, and `http://localhost:<port>` for a site or
6497
+ * an auth server. Those keys are now a construct's — `database.schema('AuthDatabase')`
6498
+ * provides `AUTH_DATABASE_URL`, `new BetterAuth('Auth')` provides `AUTH_URL`
6499
+ * — and a deploy derives them. A value the stage holds is a value set by hand,
6500
+ * and set by hand wins: the container is handed `localhost`, where nothing
6501
+ * answers, with a password no role has.
6502
+ *
6503
+ * So a deploy refuses such a stage rather than run it, naming each key and
6504
+ * the command that removes it. Nothing is deleted for the user: the value is
6505
+ * theirs, and only they can say it is stale. A URL that names a real host — a
6506
+ * managed database — is a deliberate choice and still wins.
6507
+ */
6508
+ /** The kinds whose URL an older gkm wrote into a stage's secrets. */
6509
+ const ADDRESSED = /* @__PURE__ */ new Set([
6510
+ "database",
6511
+ "database-reader",
6512
+ "database-schema",
6513
+ "rest-api",
6514
+ "site"
6515
+ ]);
6516
+ /** Hosts that are this machine — never anything, inside a container. */
6517
+ const LOOPBACK = /* @__PURE__ */ new Set([
6518
+ "localhost",
6519
+ "127.0.0.1",
6520
+ "[::1]",
6521
+ "::1"
6522
+ ]);
6523
+ /**
6524
+ * A stage holds a construct's address as a custom secret, pointing at
6525
+ * `localhost` — what an older `gkm secrets:init`, `gkm setup` or `gkm init`
6526
+ * generated. Set by hand wins over derived, so the app would be handed it.
6527
+ */
6528
+ var StaleStageSecrets = class extends Error {
6529
+ stage;
6530
+ stale;
6531
+ constructor(stage, stale) {
6532
+ const one = stale.length === 1;
6533
+ super(`The stage '${stage}' holds ${one ? "a value" : "values"} an older gkm generated for ${one ? "an address a construct" : "addresses constructs"} now ${one ? "provides" : "provide"}:\n` + stale.map((s) => ` ${s.key}: ${s.construct}'s, stored pointing at ${s.host}`).join("\n") + `
6534
+ A stored value wins over the derived one, so the app would be handed an address where nothing answers inside its container. Remove ${one ? "it" : "each"}, and the construct's own value is used:\n` + stale.map((s) => ` gkm secrets:unset ${s.key} --stage ${stage}`).join("\n") + "\nA managed service set with its real host is not affected.");
6535
+ this.stage = stage;
6536
+ this.stale = stale;
6537
+ this.name = "StaleStageSecrets";
6538
+ }
6539
+ };
6540
+ /** The host a stored value names, if it is a URL. */
6541
+ function hostOf(value) {
6542
+ try {
6543
+ return new URL(value).hostname;
6544
+ } catch {
6545
+ return;
6546
+ }
6547
+ }
6548
+ /**
6549
+ * Each stored key that a construct provides an address for, holding an
6550
+ * address on this machine.
6551
+ */
6552
+ function staleStageSecrets(manifest, supplied) {
6553
+ const stale = [];
6554
+ for (const [id, declaration] of Object.entries(manifest)) {
6555
+ if (!ADDRESSED.has(declaration.kind)) continue;
6556
+ const key = providedKeyFor(id, declaration.kind, "url");
6557
+ const value = supplied[key];
6558
+ if (value === void 0) continue;
6559
+ const host = hostOf(value);
6560
+ if (host === void 0 || !LOOPBACK.has(host)) continue;
6561
+ stale.push({
6562
+ key,
6563
+ construct: id,
6564
+ host
6565
+ });
6566
+ }
6567
+ return stale.sort((a, b) => a.key.localeCompare(b.key));
6568
+ }
6569
+ /**
6570
+ * Refuse a stage whose stored secrets would shadow a construct's address with
6571
+ * `localhost`.
6572
+ *
6573
+ * @throws {StaleStageSecrets} naming each key and the command removing it
6574
+ */
6575
+ function assertNoStaleSecrets(options) {
6576
+ const stale = staleStageSecrets(options.manifest, options.supplied);
6577
+ if (stale.length > 0) throw new StaleStageSecrets(options.stage, stale);
6578
+ }
6579
+ //#endregion
6580
+ export { workspace_exports as $, readKey as $t, DevServicesNeedServerTarget as A, eventsBackendFor as At, requiredStageKeys as B, findAvailablePort as Bt, validateImageRef as C, TURBO_VERSION as Ct, isOtlpDestination as D, imageBuildCredentials as Dt, resolveHost as E, findBuildRoot as Et, devServicesUsed as F, fakeKey as Ft, workerEntryDir as G, isRemoteStore as Gt, workerUnits as H, loadEnvFiles as Ht, externalServices as I, portKeys as It, FAKE_ENV as J, store_exports as Jt, QueueGenerator as K, secretsStoreFor as Kt, manifestServiceDeclarations as L, primaryPortKey as Lt, STORAGE_KEY_PAIR as M, storageBackendFor as Mt, UnknownDevService as N, DEFAULT_IMAGES as Nt, otelEnv as O, isImageBuild as Ot, assertExternalServices as P, describeServices as Pt, reconcileWorkspace as Q, projectKey as Qt, parseDevServices as R, createCredentialsPreload as Rt, workerDockerfileOf as S, imageLayout as St, isMainFrontendApp as T, detectPackageManager as Tt, WorkerGenerator as U, loadSecretsForApp as Ut, suppliedOnly as V, isPortAvailable as Vt, workerBundleName as W, prepareEntryCredentials as Wt, constructGlobs as X, getKeyPath as Xt, backendsOf as Y, FileSecretsStore as Yt, derivedContainers as Z, keystoreProject as Zt, DockerPushFailed as _, localRolePassword as _t, isDnsVerified as a, markerOf as an, bucketPolicies as at, ensureDockerignore as b, hostFor as bt, setApplicationId as c, initStageSecrets as cn, quoteIdentifier as ct, setDnsVerification as d, toEmbeddableSecrets as dn, pgClient as dt, applicationName as en, LOCAL_CA_PATH as et, setGeneratedSecret as f, withCustomSecret as fn, appEnvKeys as ft, DockerBuildFailed as g, envFor as gt, withGeneratedSecrets as h, workerEnvKeys as ht, getGeneratedSecret as i, isOwnedBy as in, applyPostgres as it, ExternalServicesNotConfigured as j, providerOf as jt, DEV_SERVICES as k, cacheBackendFor as kt, setBackupState as l, maskPassword as ln, composeFor as lt, DeployJournal as m, networkEnv as mt, createEmptyState as n, imageName as nn, applyBuckets as nt, recordRelease as o, ownershipMarker as on, postgresDatabaseNames as ot, setPostgresBackupId as p, dockerfileOf as pt, CronGenerator as q, storeFromConfig as qt, getBackupState as r, imageRef as rn, applyPolicies as rt, recordRollback as s, projectName as sn, postgresStatements as st, assertNoStaleSecrets as t, deployIdentity as tn, forgetState as tt, setDnsRecord as u, storage_exports as un, bucketClient as ut, appDockerfile as v, planFor as vt, NoDomainForStage as w, WORKER_PORT as wt, workerDockerfile as x, composeBuildPaths as xt, dockerCommand as y, resourceName as yt, reportDevServices as z, createEntryWrapper as zt };
6501
6581
 
6502
- //# sourceMappingURL=state-CUecOCNJ.mjs.map
6582
+ //# sourceMappingURL=stale-C5FqIVc8.mjs.map