mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
feat(search): coordinates and bundled presets resolve keyless (#572)
Supersedes #388 by @KuraPiee, ported onto the current component layout with fixes from review. Verified before merge: format, package boundaries, unit suite, build, and the browser tracking suite; a browser harness for the change where one applies; adversarial review applied. Co-authored-by: KuraPiee <[email protected]>
This commit is contained in:
1 parent
d9fac6d88e
commit
cca6442997
13 files changed
+672
-14
No files matched your search
+14
-1
@@ -3,18 +3,31 @@ import { createHttpGeospatialProvider } from './http.js';
|
||||
import { createPlaceSearch } from './placeSearch.js';
|
||||
import { createGoogleGeocoder } from './google.js';
|
||||
import { createPhotonGeocoder } from '../keylessGeocoder.js';
|
||||
import { createCoordinateGeocoder } from './coordinateGeocoder.js';
|
||||
import { createPresetGeocoder } from './presetGeocoder.js';
|
||||
|
||||
/** Google first when configured, then keyless Photon; transport stays local to setup. */
|
||||
/**
|
||||
* Coordinates and bundled names first — both answer offline and with no key —
|
||||
* then Google when configured, then keyless Photon. Transport stays local to
|
||||
* setup.
|
||||
*
|
||||
* `presets` is the caller's bundled place data. It is passed in rather than
|
||||
* imported so this package keeps reading no application state; with none
|
||||
* supplied there is simply no bundled-name provider.
|
||||
*/
|
||||
export function createDefaultPlaceSearch({
|
||||
resolveApiKey,
|
||||
fetchImpl = (...args) => fetch(...args),
|
||||
signal,
|
||||
endpoints = {},
|
||||
providers = {},
|
||||
presets = null,
|
||||
} = {}) {
|
||||
const forward = createPlaceSearch({
|
||||
signal,
|
||||
providers: providers.geocode || [
|
||||
createCoordinateGeocoder(),
|
||||
...(presets ? [createPresetGeocoder({ presets })] : []),
|
||||
createGoogleGeocoder({
|
||||
request(query, { bias, signal }) {
|
||||
const key = resolveApiKey?.();
|
||||
|
||||
Reference in new issue
Block a user