Merge pull request #580 from bilawalsidhu/refactor/reference-source-exports

refactor: expose reference sources independently of standalone setup
This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-09-14 22:01:14 -07:00
commit 2b1092bf89
9 files changed
+66 -19

No files matched your search

+2
View File
@@ -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.
+5
View File
@@ -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.
+2
View File
@@ -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.
+3 -1
View File
@@ -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"
}
}
+3 -1
View File
@@ -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"
]
+12 -1
View File
@@ -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": []
}
}
+10
View File
@@ -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(),
};
}
+21
View File
@@ -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);
});
+8 -16
View File
@@ -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({