mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-27 15:17:30 +00:00
refactor(mail-ingest): keep the types nothing else imports private to their file
Exported types without a reader outside their file only add to the unused-export count.
This commit is contained in:
@@ -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> = {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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' };
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 };
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user