/** * The machinery under the quick API: turn one generator into an endless * stream of values. * * A quick call has to look like `faker.person.firstName()` and cost about what * that costs. Two measured facts shape everything here. * * FIRST, values depend on the row count, not only on the seed. The same * config run with `count="3"` yields `John | Robert | James`, and run three * times with `count="1"` yields `James | James | James`. So a call cannot mean * "render one row" — it has to mean "take the next value from a stream", or a * loop of calls returns the same value forever. * * SECOND, `toIterator()` is lazy: the first three values of a config declaring * a million rows arrive in 0 ms. So a stream is cheap to open and cheap to * abandon. * * A stream is therefore a run of `BATCH_ROWS` rows; when it is exhausted the * next run starts under a seed derived from the batch number, so the sequence * continues without bound and stays reproducible from the same starting seed. */ /** * Rows per underlying run. Small enough that opening a stream is free, large * enough that a test drawing a few hundred values never reopens one. * * This number is part of the contract: change it and every seeded value * changes, because the draw depends on the declared count. */ export declare const BATCH_ROWS = 512; /** One ``: its type and the attributes written on it. */ export interface QuickGenSpec { readonly type: string; readonly attrs: Readonly>; } /** Raised for anything the quick API can explain better than the engine can. */ export declare class TdcQuickError extends Error { constructor(message: string); } /** * The nearest reachable address to what was typed. * * Compared against the address as written AND against its locale-qualified * form, because `person.firstNam` and `en.person.firstNam` are the same typo * seen from two sides. */ export declare function nearestAddress(typed: string, locale: string, known: readonly string[]): string | undefined; /** * Streams held open per generator, for one seed and one locale. * * Keyed by the generator and its attributes: two different addresses draw * independently, and the same address asked twice continues where it left off. */ export declare class QuickDraw { private readonly seed; private readonly locale; private readonly cursors; constructor(seed: string, locale: string | undefined); draw(spec: QuickGenSpec, count: number): string[]; private open; /** * Turn an engine diagnostic about a config the caller never wrote into a * sentence about the call they did write — but ONLY when the address really * is what went wrong. * * Rewriting every failure hides the one line that says what is actually * wrong: an attribute the validator refused came back as `unknown address * "common.internet.email". Did you mean "common.internet.email"?`, which is * nonsense. An address the packs do resolve cannot be the explanation, so * whatever the engine said is raised as it came. */ private explain; } //# sourceMappingURL=draw.d.ts.map