@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.
29 lines (28 loc) • 1.56 kB
TypeScript
import { type AggregationPipeline } from '../../../common/aggregation-pipeline.js';
import { type Sam } from '@tmlmobilidade/types';
/**
* Optional per-analysis filters after `$unwind` (e.g. export file `start_time` / `end_time`).
*/
export interface SamsAnalysisExportAnalysisFilter {
/** If set, keep rows where `analysis.end_time` is less than or equal to this timestamp. */
end_time?: number;
/** If set, keep rows where `analysis.start_time` is greater than or equal to this timestamp. */
start_time?: number;
}
/**
* Builds a pipeline that returns one document per analysis record (no SAM pagination),
* for CSV / file export. SAM documents are restricted by optional {@link samIds} and/or
* {@link matchAnd} (ANDed together). Callers must pass at least one non-empty constraint;
* otherwise the pipeline would not filter SAMs before unwind.
* Then `analysis` is unwound and optionally narrowed by {@link SamsAnalysisExportAnalysisFilter}.
*
* @param samIds - Optional SAM `_id` values to include. When omitted or empty, no `_id` filter is applied.
* @param matchAnd - Optional list conditions ANDed with each other (and with `samIds` when set).
* @param analysisFilter - Optional filters on the unwound `analysis` subdocument.
* @returns Aggregation pipeline for MongoDB.
*/
export declare function samsAnalysisExportAggregationPipeline({ analysisFilter, matchAnd, samIds }: {
analysisFilter?: SamsAnalysisExportAnalysisFilter;
matchAnd?: Record<string, unknown>[];
samIds?: number[];
}): AggregationPipeline<Sam>;