Merge pull request #1804 from bilawalsidhu/fix/route-steps-export

Export route steps from sources/places
This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-11-17 21:20:42 -08:00
commit dc739eb75e
5 files changed
+23 -3

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
- `gods-eye-view/sources/places` also exports `normalizeOsrmSteps`, so a route
proxy outside Core's dev server can serve the same turn-by-turn steps the
Directions layer asks for with `steps=1`.
+2 -1
View File
@@ -150,7 +150,8 @@ Google credentials are resolved on each request; the default uses the existing
server-key precedence, and callers may supply `resolveApiKey`.
`gods-eye-view/sources/places` exports portable response projections for Google
place results and OSRM route results/profile aliases. These functions own no
place results and OSRM route results/profile aliases, and the turn-by-turn
steps (`normalizeOsrmSteps`) Core's `/api/route` serves with `steps=1`. These functions own no
credentials, requests, caches, environment loading, or rendering. Callers retain
input validation and upstream-response acceptance. The boundary check builds
this entry independently and rejects Node imports.
+5 -1
View File
@@ -423,7 +423,11 @@
},
"place-payloads": {
"exports": ["./sources/places"],
"modules": ["src/data/placeProviderPayloads.js"],
"modules": [
"src/data/placeProviderPayloads.js",
"src/data/routeSteps.js",
"src/data/distanceFormat.js"
],
"external": []
},
"space-providers": {
+4
View File
@@ -1,3 +1,7 @@
// Turn-by-turn steps for a route, as Core's own /api/route serves them with
// steps=1; a hosted route proxy projects the same OSRM answer.
export { normalizeOsrmSteps } from './routeSteps.js';
function placeContextPriority(types) {
const typeSet = new Set(types);
if (typeSet.has('historical_landmark') || typeSet.has('monument')) return 100;
+9 -1
View File
@@ -11,7 +11,11 @@ import {
_routeInflightCountForTest,
_setRouteUpstreamIntervalForTest,
} from '../../server/providers/places/routes.js';
import { ROUTE_STEPS_MAX } from '../../src/data/routeSteps.js';
import {
ROUTE_STEPS_MAX,
normalizeOsrmSteps,
} from '../../src/data/routeSteps.js';
import * as placePayloads from '../../src/data/placeProviderPayloads.js';
import {
projectNearbyPlaces,
projectTextSearchPlaces,
@@ -465,6 +469,10 @@ test('identical concurrent route requests make one upstream call', async (t) =>
);
});
test('the place payloads entry serves the same route steps the dev proxy does', () => {
assert.equal(placePayloads.normalizeOsrmSteps, normalizeOsrmSteps);
});
test('a pathological maneuver count is bounded before it reaches the browser', async (t) => {
_resetRouteUpstreamForTest();
const request = install(installRouteMiddleware);