The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(ci): book frames typed for every compile mode, promise checks and the store's length
Maurice6c4330420551
diff --git a/client/src/store/inAppNotificationStore.ts b/client/src/store/inAppNotificationStore.tsindex 6048ee0c4..de88abc58 100644--- a/client/src/store/inAppNotificationStore.ts+++ b/client/src/store/inAppNotificationStore.ts@@ -79,6 +79,18 @@ function allRead(state: NotificationState): Partial<NotificationState> {return { notifications: state.notifications.map(n => n.is_read ? n : { ...n, is_read: true }), unreadCount: 0 }}+/** One notification marked read or unread: its row flips, and the count moves only if it was the other way. */+function markedOne(state: NotificationState, id: number, isRead: boolean): Partial<NotificationState> {+ const wasRead = Boolean(state.notifications.find(n => n.id === id)?.is_read)+ let delta = 0+ if (isRead && !wasRead) delta = -1+ if (!isRead && wasRead) delta = 1+ return {+ notifications: state.notifications.map(n => n.id === id ? { ...n, is_read: isRead } : n),+ unreadCount: Math.max(0, state.unreadCount + delta),+ }+}+export const useInAppNotificationStore = create<NotificationState>((set, get) => ({notifications: [],unreadCount: 0,@@ -129,10 +141,7 @@ export const useInAppNotificationStore = create<NotificationState>((set, get) =>markRead: async (id: number) => {try {await inAppNotificationsApi.markRead(id)- set(state => ({- notifications: state.notifications.map(n => n.id === id ? { ...n, is_read: true } : n),- unreadCount: Math.max(0, state.unreadCount - (state.notifications.find(n => n.id === id)?.is_read ? 0 : 1)),- }))+ set(state => markedOne(state, id, true))} catch {// best-effort}@@ -141,10 +150,7 @@ export const useInAppNotificationStore = create<NotificationState>((set, get) =>markUnread: async (id: number) => {try {await inAppNotificationsApi.markUnread(id)- set(state => ({- notifications: state.notifications.map(n => n.id === id ? { ...n, is_read: false } : n),- unreadCount: state.unreadCount + (state.notifications.find(n => n.id === id)?.is_read ? 1 : 0),- }))+ set(state => markedOne(state, id, false))} catch {// best-effort}diff --git a/server/src/nest/assistant/assistant-book-gate.ts b/server/src/nest/assistant/assistant-book-gate.tsindex f662fbe3d..a6a7cb27d 100644--- a/server/src/nest/assistant/assistant-book-gate.ts+++ b/server/src/nest/assistant/assistant-book-gate.ts@@ -98,7 +98,7 @@ export class AssistantBookGate {const trial = (tool: string, args: ToolArgs): Promise<BookTrial | null> => {const key = readKey(tool, args);const kept = trials.get(key);- if (kept) return kept;+ if (kept !== undefined) return kept;base ??= this.baseOf(userId, journeyId);const tried = base.then((input) => (input ? this.tried(tool, args, input) : null));trials.set(key, tried);diff --git a/server/src/nest/assistant/assistant-render.registry.ts b/server/src/nest/assistant/assistant-render.registry.tsindex dbe79218b..7e9a2b06e 100644--- a/server/src/nest/assistant/assistant-render.registry.ts+++ b/server/src/nest/assistant/assistant-render.registry.ts@@ -56,7 +56,6 @@ export class InMemoryAssistantRenderRegistry extends AssistantRenderRegistry {wait(request: RenderWait, signal: AbortSignal, timeoutMs: number): Promise<PageImage | null> {if (signal.aborted) return Promise.resolve(null);return new Promise((resolve) => {- let timer: ReturnType<typeof setTimeout> | undefined;const settle = (image: PageImage | null) => {clearTimeout(timer);signal.removeEventListener('abort', onAbort);@@ -64,7 +63,7 @@ export class InMemoryAssistantRenderRegistry extends AssistantRenderRegistry {resolve(image);};const onAbort = () => settle(null);- timer = setTimeout(() => settle(null), timeoutMs);+ const timer = setTimeout(() => settle(null), timeoutMs);signal.addEventListener('abort', onAbort, { once: true });this.waiting.set(request.requestId, { request, settle });});diff --git a/server/src/nest/journey/journey-book-edit.service.ts b/server/src/nest/journey/journey-book-edit.service.tsindex b23284bb7..3bb01a4e2 100644--- a/server/src/nest/journey/journey-book-edit.service.ts+++ b/server/src/nest/journey/journey-book-edit.service.ts@@ -203,7 +203,7 @@ export class JourneyBookEditService {async wordsFor(userId: number): Promise<BookWords> {const language = bookLanguage((await this.settings.getUserSettings(userId)).language);let known = this.words.get(language);- if (!known) {+ if (known === undefined) {known = loadBookWords(language);this.words.set(language, known);}diff --git a/server/tests/unit/nest/assistant/cards/registry.test.ts b/server/tests/unit/nest/assistant/cards/registry.test.tsindex 99c1d8294..92ec7ba0f 100644--- a/server/tests/unit/nest/assistant/cards/registry.test.ts+++ b/server/tests/unit/nest/assistant/cards/registry.test.ts@@ -56,7 +56,8 @@ const described = () => ({ subject: 'x', rows: new Rows(), dayId: null, placeIdsdescribe('mergeDomains', () => {it('ASTREG-001: the live registry holds every package once, the core tables and the tours they brought', () => {- expect(new Set(DOMAINS.map((d) => d.id)).size).toBe(10);+ expect(new Set(DOMAINS.map((d) => d.id)).size).toBe(DOMAINS.length);+ expect(DOMAINS).toHaveLength(12);for (const name of Object.keys(CORE_WRITE_TOOLS)) expect(ASSISTANT_WRITE_TOOLS[name]).toBe(CORE_WRITE_TOOLS[name]);expect(ASSISTANT_WRITE_TOOLS.create_hike).toEqual({ verbKey: 'addTour', entity: 'tour' });expect(ASSISTANT_UNDO_MAP.create_city_walk?.tool).toBe('delete_place');diff --git a/shared/src/book/auto/auto-elements.ts b/shared/src/book/auto/auto-elements.tsindex 5cc0fa344..45c1438e5 100644--- a/shared/src/book/auto/auto-elements.ts+++ b/shared/src/book/auto/auto-elements.ts@@ -330,7 +330,9 @@ export function placeMap(showRoute: false,showPins: true,showLabels: false,- } as BookElement;+ // weight and tripId are left to the schema's defaults when the book is saved, as the client's layout always did;+ // the parity fixture pins this output byte for byte.+ } as unknown as BookElement;}/** The day of the month as a numeral with its month beneath: a mark rather than a line of information. */diff --git a/shared/src/book/book-findings-design.ts b/shared/src/book/book-findings-design.tsindex 658874331..927040b32 100644--- a/shared/src/book/book-findings-design.ts+++ b/shared/src/book/book-findings-design.ts@@ -1,7 +1,7 @@import { contrastOfLuminance, deltaE, greyLuminance, luminance, parseHex, requiredContrast } from './book-colour';import type { BookPhotoInfo } from './book-ops-core';import { BOOK_OP_LIMITS, type BookFinding } from './book-ops.schema';-import type { BookDocument, BookElement, BookPageSetup, BookPhotoElement, BookSpread } from './book.schema';+import type { BookDocument, BookElement, BookFrame, BookPageSetup, BookPhotoElement, BookSpread } from './book.schema';/*** The checks a designer makes on a proof, beyond the print faults of@@ -17,12 +17,8 @@ import type { BookDocument, BookElement, BookPageSetup, BookPhotoElement, BookSp* them the checks that need them say nothing rather than guess.*/-interface Box {- x: number;- y: number;- w: number;- h: number;-}+/** A frame in millimetres, as the book types it, so a zod-inferred `el.frame` passes in every compile mode. */+type Box = BookFrame;const mm = (v: number) => `${Math.round(v * 10) / 10}`;diff --git a/shared/src/book/book-ops-elements.ts b/shared/src/book/book-ops-elements.tsindex 28a541b3c..6b21de0e4 100644--- a/shared/src/book/book-ops-elements.ts+++ b/shared/src/book/book-ops-elements.ts@@ -407,12 +407,8 @@ function opArrange(spread: BookSpread, op: Op<'arrange'>, env: ElementOpEnv): Bo// ── align, distribute ──────────────────────────────────────────────────────-interface Box {- x: number;- y: number;- w: number;- h: number;-}+/** A frame in millimetres, as the book types it, so a zod-inferred `el.frame` passes in every compile mode. */+type Box = BookFrame;function boundsOf(frames: readonly Box[]): Box {const x = Math.min(...frames.map((f) => f.x));diff --git a/shared/src/book/design/design-compose.ts b/shared/src/book/design/design-compose.tsindex 9bab360c8..84ee1f3e0 100644--- a/shared/src/book/design/design-compose.ts+++ b/shared/src/book/design/design-compose.ts@@ -152,14 +152,11 @@ interface TextOpts {size?: number;}+/** Where a text starts and how wide it runs; a zod-inferred frame passes in every compile mode. */+type TextAt = Pick<BookFrame, 'x' | 'y' | 'w'>;+/** A text in the book's look, its frame as tall as its words need. */-export function textEl(- c: ComposeCtx,- at: { x: number; y: number; w: number },- words: string,- role: TextRole,- opts: TextOpts = {},-): BookTextElement {+export function textEl(c: ComposeCtx, at: TextAt, words: string, role: TextRole, opts: TextOpts = {}): BookTextElement {const defaultColour = role === 'caption' || role === 'meta' ? c.look.muted : c.look.ink;const el: BookTextElement = {id: c.newId('t'),@@ -186,7 +183,7 @@ export function textEl(/** A heading that fits `maxH`: set smaller, down to the sub size, until it does. */export function headingEl(c: ComposeCtx,- at: { x: number; y: number; w: number },+ at: TextAt,words: string,maxH: number,opts: TextOpts = {},@@ -218,7 +215,7 @@ export function cutWords(words: string, n: number): string {}/** The longest start of `words` that fits a box at body size, cut at a sentence end where one is near. */-function cutToFit(c: ComposeCtx, words: string, box: { w: number; h: number }): string {+function cutToFit(c: ComposeCtx, words: string, box: Pick<BookFrame, 'w' | 'h'>): string {const fits = (s: string) => textEl(c, { x: 0, y: 0, w: box.w }, s, 'body').frame.h <= box.h;if (fits(words)) return words;let lo = 0;