Adding a day before a trip's start with "Keep bookings on their dates" moved almost everything a day earlier and emptied the last day. The day grid was always rebuilt by position: the n-th day row took the n-th date of the new range. With bookings kept on their dates, only timed bookings and stays were re-anchored afterwards. Places, day notes, bookings with no time and a booking's place in a day's order stayed on their re-dated rows and slid to the day before. Days added at both ends had the same problem. planDayGrid now takes keepDates. When the new range still holds every dated day, each of them keeps its date and the new days go around them. The server passes it unless the traveller chose to shift everything, and the trip dialog's warning check uses the same rule. A moved or shorter range still follows the positional rule the dialog describes, and "Shift everything" still moves the whole plan with the new start. Two things keyed outside the day rows followed the old rule. Road trip day boundaries are keyed by day number, so a new first day left each one on the day before its own. They now follow their days to their new numbers and go out to every screen. The owner's leave days moved by the change of start even when days were only added. They now move by as far as the trip's first day moved, which is nothing when days are only added. The help text of the option and the MCP description say what happens when days are added. Closes #3119
@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.