/** * @pwngh/economy-lab * * Copyright (c) Preston Neal * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import type { WorkerCtx } from '../contract.js'; import type { ReconcileInputs, ReconcileReport } from '../reconcile.js'; import type { CallOptions, Range } from '../ports.js'; /** * Host-implemented feed that supplies both sides of one window: the processor's settled records * and our ledger's records of the same events. It exists because neither the processor port nor * the ledger store offers a "list everything settled in this window" read. */ export type ReconcileFeed = { pull(window: Range, options?: CallOptions): Promise; }; /** * Outcome of one sweep; each window lands in exactly one bucket. * - `reconciled`: the two sides matched. * - `drifted`: discrepancies found — a normal result that carries data, not a failure. * - `failed`: the feed pull threw, so the comparison never ran. */ export type ReconcileSummary = { reconciled: ReadonlyArray; drifted: ReadonlyArray; failed: ReadonlyArray<{ window: Range; code: string; retryable: boolean; }>; }; /** * Reconciles a batch of windows independently: one unreachable feed fails only its own window * and the rest of the batch still runs. * * @see {@link https://economy-lab-docs.pages.dev/economy/reference/background-worker/ Background * worker} for how the worker schedules and sweeps reconciliation windows. */ export declare function reconcileDueWindows(feed: ReconcileFeed, ctx: WorkerCtx, input: { windows: ReadonlyArray; }, options?: CallOptions): Promise;