import type { MergedOutputItem, RequestQueueData } from "./types.js"; /** * Deduplicate a list of merged-output items by their `meta.uniqueKey`. * * In distributed mode every worker writes its own dataset shard and each item * already carries a deterministic `meta.uniqueKey` (see {@link generateUniqueKey}). * When those shards are concatenated for the consolidated webhook / run output, * identical items (same uniqueKey, scraped by more than one worker, or re-scraped * on retry) must collapse to a single record. * * Strategy is **last-wins** by default: when keys collide, the item appearing * later in `items` replaces the earlier one. Callers that concatenate worker * shards in a deterministic order therefore get a deterministic result. * * Items without a `meta.uniqueKey` are passed through unchanged (never dropped). */ export declare function dedupeByUniqueKey(items: MergedOutputItem[], strategy?: "last" | "first"): MergedOutputItem[]; /** * Build the merged, deduplicated output for a run from raw dataset items and the * request-queue data that produced them. * * Each dataset item is wrapped into a {@link MergedOutputItem} with a * `meta.uniqueKey` computed via {@link generateUniqueKey}, then the whole set is * deduplicated (last-wins by default). * * @param datasets - Raw scraped dataset items. * @param requestQueueData - Request-queue records keyed by url (provides the * request uniqueKey + source metadata for each item, when available). * @param uniqueKeySelector - Optional field names that define identity; passed * through to {@link generateUniqueKey}. */ export declare function buildMergedOutput(datasets: any[], requestQueueData?: RequestQueueData[], uniqueKeySelector?: string[]): MergedOutputItem[]; /** * Build merged, deduplicated output without request-queue metadata. * * Same as {@link buildMergedOutput} but for callers that only have the dataset * items themselves. The unique key is derived from item content (and the * optional selector) alone. */ export declare function buildSimpleMergedOutput(datasets: any[], uniqueKeySelector?: string[]): MergedOutputItem[]; //# sourceMappingURL=merged-output.d.ts.map