import type { Readable } from 'stream'; import type { HeaderInfo, ValidationContext } from '../entities/definition.js'; import { type ProductState } from '../entities/product/productValidator.js'; import type { ImageFetcher } from '../images/types.js'; import type { ProductPlan } from '../plan/productPlan.js'; import type { Clock } from '../ports/clock.js'; import type { EntityServices } from '../ports/services.js'; import type { CsvLimits } from '../reader/readCsv.js'; import type { WriteOutcome } from './categoryWriter.js'; export interface ProductWriterArgs { open: () => Readable; limits?: Partial; header: HeaderInfo; state: ProductState; plan: ProductPlan; context: ValidationContext; services: EntityServices; images: ImageFetcher; /** Images fetched ahead of their rows, at the same time (default 1: one at a time). */ imageConcurrency?: number; clock: Pick; /** The job is a resumed one (IMP-07): a product that exists is updated. */ resumed?: boolean; include?: (unit: { unit: number; rowNumber: number; key: string; }) => boolean; signal?: AbortSignal; /** Rows whose state is asked of the store together (units are never cut). */ batchSize?: number; } /** * Writes the products of a file that has been checked, in the order of the file. * A unit is one row, or the rows of one variant group (ยง 4.3), which are next to * each other. It yields what happened to each row; the runner counts, saves its * place at the end of a unit, and stops at the tenth failed row by not asking for * the next one. * * In a unit that makes a new group, the first member creates the group and joins * it: if that fails, the rest of the unit is skipped (IMP-04). After that the * members are independent: a member that fails fails alone, and the ones that * joined stay joined. Images are fetched before a row is written (IMP-03); the * redirects are a second step after the product is saved, so a row can end half * done (IMP-05) and a re-run completes it. */ export declare function writeProducts(args: ProductWriterArgs): AsyncGenerator;