A MapLibre user could only draw OpenFreeMap styles; a raster template was Leaflet's alone. With maplibre_style set to trek:template, MapLibre now draws the template the trip map already resolves for Leaflet (CARTO key, keyless fallback and dark default included), so both renderers show the same map. No stored row holds the keyword, so every existing user sees exactly the map they saw before, and Mapbox is untouched. - glBasemap turns the basemap spec into a raster style document (256px tiles as Leaflet requests them, the provider's deepest zoom, the credit, OpenFreeMap glyphs for the map's own labels) and resolves trek:ofm-auto to Liberty or OpenFreeMap Dark with the colour scheme. - glCanFetch decides whether a GL map may fetch a basemap here: https on a host the CSP names, the shipped ones or MAP_EXTRA_CONNECT_HOSTS from the app config. GCJ-02 tiles (Amap) and other hosts are drawn by Leaflet for that render, the setting untouched. - rasterHealth watches the first tiles of a template map: a CSP refusal or twelve failures without a success move every map drawing that template to Leaflet for the session, with a pill that says so. - useEffectiveMapEngine decides this on the engine that actually draws and runs the offline checks after it; a stored raster template keeps drawing offline where Leaflet would keep the same tiles. - The journey map uses the same hook: the same template, the same fallback and now the offline basemap with its pill as the trip map has it. - A MapLibre raster style stops at zoom 19 like Leaflet; the Mapbox options stay as they were. The offline pill moves to BasemapPill for both maps. Dropping the unused imports there lowers the eslint baseline.
@trek/shared
Single source of truth for TREK's API contracts, expressed as Zod schemas and consumed by both the server (request validation + inferred DTO types) and the client (typed requests/responses).
This package is part of the incremental NestJS + React 19 migration (see the "Brownfield Rewrite" board). It is intentionally dormant until modules start importing it — adding it changes nothing for users.
Rules
- One folder per domain:
src/<domain>/<domain>.schema.ts(+.spec.ts). - Domain-agnostic building blocks live in
src/common/. - A route is only considered migrated once its contract lives here.
- Schemas are the source of truth; server DTOs and client types are inferred from them
(
z.infer<typeof schema>), never hand-duplicated.
Consumption (dev)
Both apps resolve @trek/shared to this package's TypeScript source:
- Server (
tsx): viapathsinserver/tsconfig.json. - Client (
vite): viaresolve.aliasinclient/vite.config.ts(+pathsfor the type-checker).
Production packaging (Docker / workspace wiring) is introduced in card F2, when the server first depends on this package at runtime. Until then prod builds are untouched.
Not yet here
The canonical error envelope is finalised in card F5 (it must match TREK's current Express error responses byte-for-byte), so it is deliberately not invented in F1.