mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Make catalog feed configuration optional and explicit
This commit is contained in:
1 parent
1ee07468c4
commit
5756ae92a8
13 files changed
+283
-43
No files matched your search
@@ -22,9 +22,11 @@ import { createReferenceSources } from '../sources/reference.js';
|
||||
export { createReferenceSources as createStandaloneReferenceSources } from '../sources/reference.js';
|
||||
|
||||
/** Select standalone providers without starting their acquisition. */
|
||||
export function createStandaloneLayerSources() {
|
||||
export function createStandaloneLayerSources(overrides = {}) {
|
||||
if (!overrides || typeof overrides !== 'object' || Array.isArray(overrides))
|
||||
throw new TypeError('Source overrides must be an object');
|
||||
const mapTiles = createOpenFreeMapSource();
|
||||
return {
|
||||
const defaults = {
|
||||
...createReferenceSources(),
|
||||
flights: createFlightSource(),
|
||||
military: createMilitarySource(),
|
||||
@@ -51,4 +53,9 @@ export function createStandaloneLayerSources() {
|
||||
token: import.meta.env?.MAPILLARY_CLIENT_TOKEN || '',
|
||||
}),
|
||||
};
|
||||
for (const name of Object.keys(overrides)) {
|
||||
if (!Object.hasOwn(defaults, name))
|
||||
throw new TypeError(`Unknown source: ${name}`);
|
||||
}
|
||||
return { ...defaults, ...overrides };
|
||||
}
|
||||
Reference in new issue
Block a user