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.

45 lines (44 loc) 1.91 kB
import { type AggregationPipeline } from '../../../common/aggregation-pipeline.js'; import { type Sam, type SamTimelineSummary } from '@tmlmobilidade/types'; /** * `timeline_summary` on SAM list responses: months with `key`, `month`, `count`, * `successful_count`, `failed_count`, plus optional `undated` (computed from `analysis`). */ export type SamsBatchListTimelineSummary = SamTimelineSummary; /** * Builds a pipeline to return all matching SAMs for list view (no skip/limit). * Excludes `analysis` from list fields; `timeline_summary` is computed from `analysis`. * * @param matchAnd - An array of $match conditions (ANDed). * @returns Aggregation pipeline for MongoDB. */ export declare function samsBatchAggregationPipeline({ matchAnd, }: { matchAnd: Record<string, unknown>[]; }): AggregationPipeline<Sam>; /** * Same list row shape as {@link samsBatchAggregationPipeline} for explicit `_id`s (e.g. favorites). */ export declare function samsByIdsListViewAggregationPipeline({ agencyIds, ids, restrictByAgency, }: { agencyIds?: string[]; ids: number[]; restrictByAgency: boolean; }): AggregationPipeline<Sam>; /** * Full SAM by id: all fields preserved; `timeline_summary` is recomputed from `analysis`. */ export declare function samsByIdAggregationPipeline(id: number): AggregationPipeline<Sam>; /** * Returns stored timeline summary rows for explicit SAM `_id`s. * Used for fast SAM list timeline hydration. */ export declare function samsByIdsTimelineSummaryAggregationPipeline({ agencyIds, ids, restrictByAgency, }: { agencyIds?: string[]; ids: number[]; restrictByAgency: boolean; }): AggregationPipeline<Sam>; /** * Lightweight SAM list rows without timeline data (used for fast initial list loading). */ export declare function samsBatchBaseAggregationPipeline({ matchAnd, }: { matchAnd: Record<string, unknown>[]; }): AggregationPipeline<Sam>;