import type { ProductRow } from '../entities/product/productValidator.js'; import type { Lookup, NamedRecord, StoredMetafield, StoredProduct } from '../ports/lookup.js'; import type { ImportIssue } from '../types.js'; /** What the names and codes of a row are in the store now. */ export interface ResolvedProduct { /** The attribute group named by the row, if it names one and it exists. */ groupId: number | null; packageId: number | null; taxClassId: number | null; categoryId: number | null; attributes: Array<{ attribute_code: string; value: string | string[]; }>; /** What no longer exists, or is no longer unique: the row cannot be written. */ problems: ImportIssue[]; } /** * Turns the names, codes and option texts of a row into ids, at the time the * row is written (the store may have changed since the check; D-6, S3 of * ยง 8.6). The store is asked for a batch of rows together (`prepare`), and * every answer is kept for the whole run, so a name that every row uses is asked * for once. */ export declare class ProductResolver { private readonly lookup; private readonly groups; private readonly packages; private readonly taxClasses; private readonly categories; private readonly attributes; private readonly options; private asked; defaultPackage: NamedRecord | null | undefined; /** The custom-field definitions of products, asked once for the run. */ metafields: ReadonlyMap; private metafieldsAsked; constructor(lookup: Lookup); prepare(rows: readonly ProductRow[]): Promise; /** The ids of one row. A problem means the row must not be written. */ /** * The code an attribute is stored under, for a code as the file has it (lower * case; the store matches codes with their letter case). A code that was not * asked for in `prepare` comes back as it is. */ storedAttributeCode(code: string): string; resolve(row: ProductRow, stored: StoredProduct | null): ResolvedProduct; }