UNPKG

@tmlmobilidade/interfaces

Version:

This package provides SDK-style connectors for interacting with databases (e.g., stops, plans, rides, alerts) and external providers (e.g., authentication, storage). It simplifies data access and integration across projects.

206 lines (205 loc) • 7.25 kB
import { MongoCollectionClass } from '../../common/mongo-collection.js'; import { type CreatePatternDto, type Pattern, type UpdatePatternDto } from '@tmlmobilidade/types'; import { IndexDescription } from 'mongodb'; import { z } from 'zod'; declare class PatternsClass extends MongoCollectionClass<Pattern, CreatePatternDto, UpdatePatternDto> { private static _instance; protected createSchema: z.ZodSchema; protected updateSchema: z.ZodSchema; private constructor(); static getInstance(): Promise<PatternsClass>; /** * Finds Pattern documents by line ID. * * @param lineId - The line ID to search for * @returns A promise that resolves to an array of matching documents */ findByLineId(lineId: string): Promise<import("mongodb").WithId<{ _id: string; created_at: number & { __brand: "UnixTimestamp"; }; created_by: string | null; is_locked: boolean; updated_at: number & { __brand: "UnixTimestamp"; }; code: string; rules: ({ _id: string; kind: "manual"; operating_mode: "exclude" | "include"; timepoints: (string & z.BRAND<"HHMM">)[]; year_period_ids: string[]; name?: string | undefined; event_id?: string | undefined; months?: (1 | 2 | 12 | 10 | 11 | 4 | 3 | 8 | 5 | 6 | 7 | 9)[] | undefined; weekdays?: (1 | 2 | 4 | 3 | 5 | 6 | 7)[] | undefined; } | { event: { title: string; id: string; }; dates: import("@tmlmobilidade/types").OperationalDate[]; kind: "event_restriction"; lines_mode: "exclude" | "include" | "all"; all_day: boolean; end_time: string & z.BRAND<"HHMM">; start_time: string & z.BRAND<"HHMM">; _id?: string | undefined; name?: string | undefined; timepoints?: (string & z.BRAND<"HHMM">)[] | undefined; lines_to_exclude?: string[] | undefined; lines_to_include?: string[] | undefined; } | { event: { title: string; id: string; }; dates: import("@tmlmobilidade/types").OperationalDate[]; kind: "event_replacement"; weekdays: (1 | 2 | 4 | 3 | 5 | 6 | 7)[]; year_period_ids: string[]; lines_mode: "exclude" | "include" | "all"; _id?: string | undefined; name?: string | undefined; timepoints?: (string & z.BRAND<"HHMM">)[] | undefined; lines_to_exclude?: string[] | undefined; lines_to_include?: string[] | undefined; same_weekday?: boolean | undefined; })[]; headsign: string; line_id: string; route_id: string; comments: ({ message: string; type: "note"; created_at: number & { __brand: "UnixTimestamp"; }; created_by: string | null; updated_at: number & { __brand: "UnixTimestamp"; }; _id?: string | undefined; updated_by?: string | undefined; } | { type: "field_changed"; created_at: number & { __brand: "UnixTimestamp"; }; created_by: string | null; updated_at: number & { __brand: "UnixTimestamp"; }; field: string; _id?: string | undefined; updated_by?: string | undefined; curr_value?: any; prev_value?: any; metadata?: { changes?: { field: string; curr_value?: any; prev_value?: any; }[] | undefined; } | null | undefined; } | { type: "crud"; created_at: number & { __brand: "UnixTimestamp"; }; created_by: string | null; updated_at: number & { __brand: "UnixTimestamp"; }; action: "create" | "update" | "delete" | "archive" | "restore"; _id?: string | undefined; updated_by?: string | undefined; })[]; destination: string; direction: "outbound" | "inbound"; origin: string; updated_by?: string | undefined; path?: { _id: string; stop_id: number; timepoint: boolean; allow_drop_off: boolean; allow_pickup: boolean; distance_delta: number | null; zones?: string[] | undefined; }[] | undefined; shape?: { geojson: { type: string; geometry: { type: string; coordinates: number[][]; }; properties?: {} | undefined; }; extension: number; encoded_polyline?: string | undefined; anchors?: { _id: string; type: "via" | "through"; after_stop_id: number; before_stop_id: number; lat: number; lon: number; sequence: number; }[] | undefined; legs?: { geojson: { type: string; properties: { distance: number; duration: number; from_index: number; to_index: number; }; geometry: { type: string; coordinates: number[][]; }; }; distance: number; duration: number; from_index: number; geometry: [number, number][]; to_index: number; encoded_polyline?: string | undefined; }[] | undefined; } | undefined; parameters?: ({ path: { stop_id: number; avg_speed: number; dwell_time: number; }[]; kind: "default"; _id?: string | undefined; name?: string | undefined; vehicle_type?: string | undefined; } | { path: { stop_id: number; avg_speed: number; dwell_time: number; }[]; kind: "override"; weekdays: (1 | 2 | 4 | 3 | 5 | 6 | 7)[]; year_period_ids: string[]; _id?: string | undefined; name?: string | undefined; vehicle_type?: string | undefined; day_periods?: ("PPM" | "CD" | "PPT" | "N" | "M")[] | undefined; })[] | undefined; }>[]>; protected getCollectionIndexes(): IndexDescription[]; protected getCollectionName(): string; protected getEnvName(): string; } export declare const patterns: PatternsClass; export {};