Skip to content

armgit / TREK

Public Imported from GitHub
0

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.

refactor(mail-ingest): keep the types nothing else imports private to their file

Maurice81d27d8e8d45
diff --git a/server/src/db/json-columns.ts b/server/src/db/json-columns.ts
index 2040d88b6..b5a8355c5 100644
--- a/server/src/db/json-columns.ts
+++ b/server/src/db/json-columns.ts
@@ -574,7 +574,7 @@ const mailIngestMatchSchema = z.object({
/** The trip the AI proposed to create when none fits; never created on its own. */
suggested_new_trip: mailIngestSuggestedTripSchema.nullable(),
});
-export type MailIngestMatch = z.infer<typeof mailIngestMatchSchema>;
+type MailIngestMatch = z.infer<typeof mailIngestMatchSchema>;
/** How the booking was matched to a trip, past the suggested trip's own column. */
export const MAIL_INGEST_MATCH: JsonColumn<MailIngestMatch> = {
diff --git a/server/src/db/repositories/MailIngestCandidates.repository.ts b/server/src/db/repositories/MailIngestCandidates.repository.ts
index 9e7fdce50..2e3a5c502 100644
--- a/server/src/db/repositories/MailIngestCandidates.repository.ts
+++ b/server/src/db/repositories/MailIngestCandidates.repository.ts
@@ -57,7 +57,7 @@ export interface MailIngestCandidateInsert {
}
/** What deciding an entry writes. */
-export interface MailIngestResolutionPatch {
+interface MailIngestResolutionPatch {
resolution: string;
reason: string | null;
resolvedTripId: number | null;
@@ -79,7 +79,7 @@ export interface MailIngestTripRow {
}
/** A place of a trip with a position, for naming its destinations and checking a booking lies near them. */
-export interface MailIngestTripPlaceRow {
+interface MailIngestTripPlaceRow {
trip_id: number;
name: string;
address: string | null;
@@ -96,7 +96,7 @@ export interface MailIngestPersonRow {
}
/** What tells one booking from another already in a trip: its type, its start window and its reference. */
-export interface MailIngestSimilarProbe {
+interface MailIngestSimilarProbe {
type: string;
startFrom: string | null;
startTo: string | null;
diff --git a/server/src/db/repositories/MailIngestCursor.repository.ts b/server/src/db/repositories/MailIngestCursor.repository.ts
index 0c1d5d911..909eb72b5 100644
--- a/server/src/db/repositories/MailIngestCursor.repository.ts
+++ b/server/src/db/repositories/MailIngestCursor.repository.ts
@@ -5,7 +5,7 @@ import type { AssertRowKeys } from './_shared/rows';
import { TrekRepository } from './_shared/trek-repository';
/** What reads mail: an IMAP box, the TREK Cloud relay, or the processing pipeline itself. */
-export type MailIngestCursorTransport = 'imap' | 'cloud' | 'pipeline';
+type MailIngestCursorTransport = 'imap' | 'cloud' | 'pipeline';
/** One `mail_ingest_cursor` row as stored. */
interface MailIngestCursorRow {
diff --git a/server/src/db/repositories/MailIngestPrefs.repository.ts b/server/src/db/repositories/MailIngestPrefs.repository.ts
index f942a2a64..7494addf3 100644
--- a/server/src/db/repositories/MailIngestPrefs.repository.ts
+++ b/server/src/db/repositories/MailIngestPrefs.repository.ts
@@ -4,7 +4,7 @@ import type { AssertRowKeys } from './_shared/rows';
import { TrekRepository } from './_shared/trek-repository';
/** One `mail_ingest_prefs` row as stored: 0/1 flags. */
-export interface MailIngestPrefsRow {
+interface MailIngestPrefsRow {
id: number;
user_id: number;
enabled: number;
diff --git a/server/src/nest/mail-ingest/mail-classify.ts b/server/src/nest/mail-ingest/mail-classify.ts
index 8a55941de..de7001432 100644
--- a/server/src/nest/mail-ingest/mail-classify.ts
+++ b/server/src/nest/mail-ingest/mail-classify.ts
@@ -6,7 +6,7 @@ import type { WalkedMail } from '../llm-parse/mail-read.types';
* mail that is no booking (a newsletter, an automatic reply, an empty mail),
* or a mail to read.
*/
-export type MailClass =
+type MailClass =
| { kind: 'read' }
| { kind: 'forwarding_confirmation'; code: string | null }
| { kind: 'drop'; reason: 'newsletter' | 'auto_reply' | 'empty_mail' };
diff --git a/server/src/nest/mail-ingest/mail-ingest-address.service.ts b/server/src/nest/mail-ingest/mail-ingest-address.service.ts
index 5926cce5f..9396d6d62 100644
--- a/server/src/nest/mail-ingest/mail-ingest-address.service.ts
+++ b/server/src/nest/mail-ingest/mail-ingest-address.service.ts
@@ -21,7 +21,7 @@ import { createHash, randomBytes } from 'node:crypto';
const BASE32 = 'abcdefghijklmnopqrstuvwxyz234567';
/** A live address and the person it belongs to, as a mail that reached it is filed under. */
-export interface ResolvedAddress {
+interface ResolvedAddress {
address: MailIngestAddressRow;
person: MailIngestPersonRow;
}
diff --git a/server/src/nest/mail-ingest/mail-ingest-apply.service.ts b/server/src/nest/mail-ingest/mail-ingest-apply.service.ts
index 159376ebe..3a56ca158 100644
--- a/server/src/nest/mail-ingest/mail-ingest-apply.service.ts
+++ b/server/src/nest/mail-ingest/mail-ingest-apply.service.ts
@@ -329,7 +329,7 @@ export class MailIngestApplyService {
}
/** What an undo removed, for the announcement after it committed. */
-export interface RemovedBooking {
+interface RemovedBooking {
tripId: number;
reservationIds: number[];
accommodationIds: string[];
diff --git a/server/src/nest/mail-ingest/mail-ingest-checks.ts b/server/src/nest/mail-ingest/mail-ingest-checks.ts
index 67c929f79..83cfb215e 100644
--- a/server/src/nest/mail-ingest/mail-ingest-checks.ts
+++ b/server/src/nest/mail-ingest/mail-ingest-checks.ts
@@ -59,7 +59,7 @@ export interface CheckContext {
knownAirport: (code: string) => boolean;
}
-export interface TripChoice {
+interface TripChoice {
/** The trip the booking goes to; null when none is certain. */
tripId: number | null;
/** The trip to offer in the inbox. */
@@ -103,7 +103,7 @@ export function bookingStart(item: BookingImportPreviewItem): string | null {
}
/** When the booking ends: its end time, or a stay's check-out. */
-export function bookingEnd(item: BookingImportPreviewItem): string | null {
+function bookingEnd(item: BookingImportPreviewItem): string | null {
return item.reservation_end_time || item._accommodation?.check_out || null;
}
diff --git a/server/src/nest/mail-ingest/mail-ingest-intake.service.ts b/server/src/nest/mail-ingest/mail-ingest-intake.service.ts
index 2916cd223..10cc1e4e0 100644
--- a/server/src/nest/mail-ingest/mail-ingest-intake.service.ts
+++ b/server/src/nest/mail-ingest/mail-ingest-intake.service.ts
@@ -16,7 +16,7 @@ import type { MailIngestTransport } from '@trek/shared';
import { createHash } from 'node:crypto';
/** Why a mail was not taken in. A transport answers each the way its protocol does (a 550, a 404, a 413). */
-export type MailIntakeRefusal =
+type MailIntakeRefusal =
| 'unavailable'
| 'too_large'
| 'not_a_mail'
@@ -24,7 +24,7 @@ export type MailIntakeRefusal =
| 'address_daily_limit'
| 'inbox_full';
-export type MailIntakeResult =
+type MailIntakeResult =
| { status: 'accepted' | 'duplicate'; messageId: number }
| { status: 'refused'; reason: MailIntakeRefusal };
diff --git a/server/src/nest/mail-ingest/mail-ingest-notify.service.ts b/server/src/nest/mail-ingest/mail-ingest-notify.service.ts
index aa1b7d8c9..11ae0449f 100644
--- a/server/src/nest/mail-ingest/mail-ingest-notify.service.ts
+++ b/server/src/nest/mail-ingest/mail-ingest-notify.service.ts
@@ -5,7 +5,7 @@ import { KEEP_ACTION, UNDO_ACTION } from './mail-ingest.constants';
import { Injectable } from '@nestjs/common';
/** A booking a mail added, as its notifications name it. */
-export interface AddedBooking {
+interface AddedBooking {
candidateId: number;
tripId: number;
tripTitle: string;