Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

refactor: expose reference sources independently of standalone setup

Sameh Khamise46d50ce5282
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10f9de54a..ef58e2e65 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
# Changelog
+- Expose reference feed factories independently of standalone catalog construction; preserve source choices and asset attribution.
+
- Add source-only layer exports and enforce source, browser, standalone and voice import directions. Move plain record/feed helpers and settings filesystem hardening to their owners while preserving compatibility and behavior.
- Separate voice session lifetime and common controls from the default Realtime protocol adapter.
diff --git a/docs/CODE-BOUNDARIES.md b/docs/CODE-BOUNDARIES.md
index f0158d015..6d6d4d55f 100644
--- a/docs/CODE-BOUNDARIES.md
+++ b/docs/CODE-BOUNDARIES.md
@@ -540,3 +540,8 @@ retention. `layers/vessels/ingestion` owns source requests and feed state throug
explicit operations. Both exports exclude Cesium, DOM and application assembly.
The snapshot renderer applies record changes; rendering owns a weak map of
geometry and billboard resources used by cards, picking and trails.
+
+`gods-eye-view/sources/reference` constructs fresh earthquake and bundled cable
+source instances independently of standalone setup. Individual sources remain
+available through `layers/earthquakes/source` and `layers/submarine-cables/source`.
+The latter retains the bundled dataset’s attribution and licensing requirements.
diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md
index 4ea0b2b74..e0d94a6ae 100644
--- a/docs/CURRENT-STATE.md
+++ b/docs/CURRENT-STATE.md
@@ -1,5 +1,7 @@
# God's Eye View Current State
+Reference feed construction is exported through `sources/reference`; the cable source also has a dedicated `layers/submarine-cables/source` entry. Standalone catalog compatibility remains available. Source choices, data and attribution are unchanged.
+
Source factories have dedicated `layers/<family>/source` exports. ALPR and earthquake record normalization and CCTV source policy no longer pull rendering into source consumers. Catalog construction and voice feed reads use their focused owners; compatibility entries remain available. Settings filesystem hardening lives under `server/standalone/`. Import-direction checks complement export ownership checks; source behavior, settings policy and rendering are unchanged.
Voice controls bind to a protocol-independent session factory. The default WebRTC adapter preserves the existing Realtime connection, push-to-talk, cost controls and radio handoff. Session subscriptions expose state, transcript, action call/result, interruption and completion events; stopping or replacing a session cancels pending actions. Alternate adapters can use the same controls and action runner.
diff --git a/package.json b/package.json
index 779a60126..c9ad7e86c 100644
--- a/package.json
+++ b/package.json
@@ -224,6 +224,8 @@
"./layers/launches/source": "./src/layers/launches/source.js",
"./layers/radio/source": "./src/layers/radio/source.js",
"./layers/satellites/source": "./src/layers/satellites/source.js",
- "./layers/traffic/source": "./src/layers/traffic/source.js"
+ "./layers/traffic/source": "./src/layers/traffic/source.js",
+ "./sources/reference": "./src/sources/reference.js",
+ "./layers/submarine-cables/source": "./src/layers/submarineCables/bundledSource.js"
}
}
diff --git a/scripts/format-scope.json b/scripts/format-scope.json
index 5cc813cc5..bf3be68ff 100644
--- a/scripts/format-scope.json
+++ b/scripts/format-scope.json
@@ -668,5 +668,7 @@
"src/layers/cctv/sourcePolicy.js",
"scripts/module-analysis.mjs",
"scripts/check-import-directions.mjs",
- "src/tooling/importDirections.test.mjs"
+ "src/tooling/importDirections.test.mjs",
+ "src/sources/reference.js",
+ "src/sources/reference.test.mjs"
]
diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json
index d5e9d5d2f..8ee1cfaa8 100644
--- a/scripts/package-boundaries.json
+++ b/scripts/package-boundaries.json
@@ -1618,7 +1618,8 @@
"src/data/feedState.js",
"src/layers/alpr/records.js",
"src/layers/earthquakes/records.js",
- "src/layers/cctv/sourcePolicy.js"
+ "src/layers/cctv/sourcePolicy.js",
+ "src/sources/reference.js"
],
"external": [
"@mapbox/vector-tile",
@@ -2242,5 +2243,15 @@
"src/layers/traffic/source.js"
],
"external": ["@mapbox/vector-tile", "pbf"]
+ },
+ "reference-sources": {
+ "exports": ["./sources/reference", "./layers/submarine-cables/source"],
+ "modules": [
+ "src/sources/reference.js",
+ "src/layers/earthquakes/source.js",
+ "src/layers/earthquakes/records.js",
+ "src/layers/submarineCables/bundledSource.js"
+ ],
+ "external": []
}
}
diff --git a/src/sources/reference.js b/src/sources/reference.js
new file mode 100644
index 000000000..e3accf58e
--- /dev/null
+++ b/src/sources/reference.js
@@ -0,0 +1,10 @@
+import { createUsgsEarthquakeSource } from '../layers/earthquakes/source.js';
+import { createBundledCableSource } from '../layers/submarineCables/bundledSource.js';
+
+/** Construct the existing reference feeds independently of application setup. */
+export function createReferenceSources() {
+ return {
+ earthquakes: createUsgsEarthquakeSource(),
+ cables: createBundledCableSource(),
+ };
+}
diff --git a/src/sources/reference.test.mjs b/src/sources/reference.test.mjs
new file mode 100644
index 000000000..9b39277bc
--- /dev/null
+++ b/src/sources/reference.test.mjs
@@ -0,0 +1,21 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { createReferenceSources } from './reference.js';
+import { createStandaloneReferenceSources } from '../standalone/layerSources.js';
+
+test('reference factories retain compatibility without starting acquisition or sharing instances', (t) => {
+ let requests = 0;
+ t.mock.method(globalThis, 'fetch', () => {
+ requests++;
+ throw new Error('unexpected acquisition');
+ });
+ assert.equal(createReferenceSources, createStandaloneReferenceSources);
+ const first = createReferenceSources();
+ const second = createReferenceSources();
+ assert.deepEqual(Object.keys(first), ['earthquakes', 'cables']);
+ assert.notEqual(first.earthquakes, second.earthquakes);
+ assert.notEqual(first.cables, second.cables);
+ assert.equal(typeof first.earthquakes.getSnapshot, 'function');
+ assert.equal(typeof first.cables.fetch, 'function');
+ assert.equal(requests, 0);
+});
diff --git a/src/standalone/layerSources.js b/src/standalone/layerSources.js
index 0b89938e0..9d59aafba 100644
--- a/src/standalone/layerSources.js
+++ b/src/standalone/layerSources.js
@@ -7,26 +7,18 @@ import { createCctvSource } from '../layers/cctv/source.js';
import { createRadioSource } from '../layers/radio/source.js';
import { createTrafficSource } from '../layers/traffic/source.js';
import { createBikeshareSource } from '../layers/bikeshare/source.js';
-import { createInstallationSource } from '../layers/installations/index.js';
-import { createSatelliteSource } from '../layers/satellites/index.js';
-import { createLaunchSource } from '../layers/launches/index.js';
-import { createOverpassAlprSource } from '../layers/alpr/index.js';
-import { createFirmsSource } from '../layers/firms/index.js';
-import { createUsgsEarthquakeSource } from '../layers/earthquakes/source.js';
-import { createBundledCableSource } from '../layers/submarineCables/bundledSource.js';
-
-/** Existing reference feeds, usable independently of live source selection. */
-export function createStandaloneReferenceSources() {
- return {
- earthquakes: createUsgsEarthquakeSource(),
- cables: createBundledCableSource(),
- };
-}
+import { createInstallationSource } from '../layers/installations/source.js';
+import { createSatelliteSource } from '../layers/satellites/source.js';
+import { createLaunchSource } from '../layers/launches/source.js';
+import { createOverpassAlprSource } from '../layers/alpr/source.js';
+import { createFirmsSource } from '../layers/firms/source.js';
+import { createReferenceSources } from '../sources/reference.js';
+export { createReferenceSources as createStandaloneReferenceSources } from '../sources/reference.js';
/** Select standalone providers without starting their acquisition. */
export function createStandaloneLayerSources() {
return {
- ...createStandaloneReferenceSources(),
+ ...createReferenceSources(),
flights: createOpenSkySource(),
military: createAdsbLolSource(),
vessels: createAisStreamSource({