@volter/world-runtime 3.0.94 → 3.0.95

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.
package/dist/src/init.js CHANGED
@@ -45,6 +45,7 @@ import { overlayEndpointEnv, packFacts } from "./pack-facts.js";
45
45
  import { VENDOR_SERVER_BACKINGS } from "./backings.js";
46
46
  import { APP_URL_ENV, DEFAULT_WORLD_SELECTION, ISSUE_ENV_PREFIX, MINT_ENV, worldConfigDocument, worldSelectionIncludes } from "./schema.js";
47
47
  import { loadWorldConfig } from "./configs.js";
48
+ import { parseInfraDefinition } from "./pglite-backing.js";
48
49
  import { ownedPath } from "./owned-path.js";
49
50
  /** Credential artifacts (files or directories) hold paths, never invented credential values. */
50
51
  function fileCredentialNames() {
@@ -872,6 +873,23 @@ export function planWorldInit(name, repoPath, options = {}) {
872
873
  row.reason = `the local stand-in's region, not one ${stem}'s vendor has — left unset`;
873
874
  row.unset = true;
874
875
  }
876
+ // A selected twin's declared database is part of the World's infrastructure, even when the application
877
+ // only reads that twin's issued connection URL. Do not substitute a guessed DATABASE_URL for its door.
878
+ const infrastructurePath = resolve(out, 'world.infrastructure.yml');
879
+ const savedInfrastructure = existing?.services.some((service) => service.type === 'external'
880
+ && service.external?.up?.[0] === 'volter-world-infra') && existsSync(infrastructurePath)
881
+ ? new Set(parseInfraDefinition(readFileSync(infrastructurePath, 'utf8')).map((service) => service.kind))
882
+ : new Set();
883
+ for (const vendor of vendors) {
884
+ if (vendor.service === null)
885
+ continue;
886
+ const database = packFacts()[vendor.vendor]?.managedDatabase;
887
+ if (!database || savedInfrastructure.has(database.kind) || infraSignals.has(database.kind))
888
+ continue;
889
+ const connection = `VOLTER_WORLD_MANAGED_${database.kind.toUpperCase()}_URL`;
890
+ infraSignals.set(database.kind, [connection]);
891
+ infraEntries.push({ name: connection, source: `${vendor.vendor} pack descriptor managedDatabase`, kind: database.kind });
892
+ }
875
893
  // --- infra ----------------------------------------------------------------------------------
876
894
  // Kinds with a managed recipe get a private definition next to the config, a declared external
877
895
  // service whose lifecycle belongs to World, and env URLs pointing at it. Recipe-less kinds keep
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/world-runtime",
3
- "version": "3.0.94",
3
+ "version": "3.0.95",
4
4
  "description": "World configs for twins: boot named local runtimes, allocate ports, generate world.env/instance.json, and run apps against fake-key twin worlds.",
5
5
  "keywords": [
6
6
  "twin",
@@ -69,14 +69,14 @@
69
69
  "node": ">=22.3"
70
70
  },
71
71
  "peerDependencies": {
72
- "@volter/world-core": "3.0.94",
73
- "@volter/world-console": "3.0.89"
72
+ "@volter/world-core": "3.0.95",
73
+ "@volter/world-console": "3.0.90"
74
74
  },
75
75
  "dependencies": {
76
76
  "@electric-sql/pglite": "0.5.8",
77
77
  "@electric-sql/pglite-pgvector": "0.0.9",
78
78
  "@volter/world-access": "3.0.1",
79
- "@volter/world-core": "3.0.94",
79
+ "@volter/world-core": "3.0.95",
80
80
  "mongodb": "~6.20.0",
81
81
  "pg-gateway": "0.3.0-beta.4",
82
82
  "smol-toml": "^1.8.0",
package/src/init.ts CHANGED
@@ -55,6 +55,7 @@ import { overlayEndpointEnv, packFacts } from './pack-facts.ts';
55
55
  import { VENDOR_SERVER_BACKINGS } from './backings.ts';
56
56
  import { APP_URL_ENV, DEFAULT_WORLD_SELECTION, ISSUE_ENV_PREFIX, MINT_ENV, worldConfigDocument, worldSelectionIncludes, type WorldConfig, type WorldSelection, type WorldServiceConfig } from './schema.ts';
57
57
  import { loadWorldConfig } from './configs.ts';
58
+ import { parseInfraDefinition } from './pglite-backing.ts';
58
59
  import { ownedPath } from './owned-path.ts';
59
60
 
60
61
  /** Credential artifacts (files or directories) hold paths, never invented credential values. */
@@ -1056,6 +1057,22 @@ export function planWorldInit(name: string, repoPath: string, options: InitOptio
1056
1057
  row.unset = true;
1057
1058
  }
1058
1059
 
1060
+ // A selected twin's declared database is part of the World's infrastructure, even when the application
1061
+ // only reads that twin's issued connection URL. Do not substitute a guessed DATABASE_URL for its door.
1062
+ const infrastructurePath = resolve(out, 'world.infrastructure.yml');
1063
+ const savedInfrastructure = existing?.services.some((service) => service.type === 'external'
1064
+ && service.external?.up?.[0] === 'volter-world-infra') && existsSync(infrastructurePath)
1065
+ ? new Set(parseInfraDefinition(readFileSync(infrastructurePath, 'utf8')).map((service) => service.kind))
1066
+ : new Set<string>();
1067
+ for (const vendor of vendors) {
1068
+ if (vendor.service === null) continue;
1069
+ const database = packFacts()[vendor.vendor]?.managedDatabase;
1070
+ if (!database || savedInfrastructure.has(database.kind) || infraSignals.has(database.kind)) continue;
1071
+ const connection = `VOLTER_WORLD_MANAGED_${database.kind.toUpperCase()}_URL`;
1072
+ infraSignals.set(database.kind, [connection]);
1073
+ infraEntries.push({ name: connection, source: `${vendor.vendor} pack descriptor managedDatabase`, kind: database.kind });
1074
+ }
1075
+
1059
1076
  // --- infra ----------------------------------------------------------------------------------
1060
1077
  // Kinds with a managed recipe get a private definition next to the config, a declared external
1061
1078
  // service whose lifecycle belongs to World, and env URLs pointing at it. Recipe-less kinds keep