import type { Readable } from 'stream'; import type { EntityValidator, HeaderInfo, ValidationContext } from '../entities/definition.js'; import type { ImageFetcher } from '../images/types.js'; import type { Clock } from '../ports/clock.js'; import type { PageAddresses } from '../ports/pageAddresses.js'; import type { EntityServices } from '../ports/services.js'; import type { CsvLimits } from '../reader/readCsv.js'; import type { ImportEntity } from '../types.js'; import type { WriteOutcome } from '../write/categoryWriter.js'; export interface PipelineWriteArgs { open: () => Readable; limits?: Partial; header: HeaderInfo; state: unknown; plan: unknown; context: ValidationContext; services: EntityServices; images: ImageFetcher; /** Images fetched ahead of their rows, at the same time. */ imageConcurrency?: number; clock: Pick; resumed: boolean; /** For the writers that wait for the page address of a record they just made. */ pages?: Pick; include?: (unit: { unit: number; rowNumber: number; key: string; }) => boolean; signal?: AbortSignal; } /** * What an entity brings to the runner: how its file is checked, how its units * are ordered, and how they are written. The runner is the same for every entity; * the categories are the first. */ export interface EntityPipeline { entity: ImportEntity; validator: EntityValidator; /** Orders the units from what the first pass remembered. */ plan(state: unknown): unknown; write(args: PipelineWriteArgs): AsyncGenerator; } /** The pipeline of an entity, or null when it cannot be imported yet. */ export declare function pipelineFor(entity: ImportEntity): EntityPipeline | null;