Spreading a multi-day tour wrote through the store directly and skipped the via re-anchoring every other write on the plan does. A tour with a start counts as a road-trip stop, so taking the whole tour, a stale stage or a moved stage off the middle of a day shifted every later stop, and the vias anchored by position shaped the wrong leg. The undo had the same gap when it put the whole tour back mid-day. Each stop a spread or its undo takes off a day now carries the day's vias along (reanchorAfterRemove), and the whole tour put back carries them the other way (reanchorAfterInsert). The stops are read from the store as each write goes out and the vias are kept as the last correction left them, since one run can touch a day twice before the plan renders. The phone's place sheet greyed out a day that holds a multi-day tour, so its stages could not be spread from there. It now checks the day the way the desktop menus do and leaves the choice to the plan, which opens the card with only the stages offered. The second step of the day menu names the day picked, and a greyed-out "Whole tour on this day" says why right under it. The toast for a tour that sat whole on several days now says "days" instead of "day", in all 27 languages.
@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.