A hike can ask the router for more than its difficulty limit: avoid steps, avoid ferries, prefer footpaths, shorter over faster. They sit under the limit in the planner's details as switches, each with what it really does, and the info dot says they weigh the way and give way where there is no other, and that none grades a path. Switching one plans the route again as one step of the history, and the choice is kept in the draft. Only preferences the public Valhalla was seen to honour are offered, with the measured cases beside hikingCostingOptions: step_penalty took Würzburg to the Festung from four flights to one, use_ferry 0 sent Kiel round the Förde and Hamburg through the Elbe tunnel, walkway_factor moved Garmisch to the Partnachklamm onto the paths, shortest cut the way to the Eckbauer. use_hills and use_tracks showed no effect on foot and are left out, as are marked, paved and rough ways, for which the router has no option. tours.hiking_preferences (migration 045000) holds them as JSON, NULL for none, so no tour saved before routes differently. Only a hike keeps them; a paddle tour naming one is refused. A copy carries them, and list_tours and get_tour_plan read them. The trip copy's waypoint links now follow the copied places inside TourWaypointsRepository.insertForPlace.
@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.