/** * @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 { Edge } from '@pwngh/economy-edge'; import type { LedgerRecord, ReconcileKind } from '../reconcile.js'; import type { CallOptions, Range, Store } from '../ports.js'; import type { ReconcileFeed } from '../worker/reconcile.js'; export type LedgerSide = (window: Range, options?: CallOptions) => Promise>; export declare function settledPayoutLedgerRecords(store: Store, matchKeyOf: (providerRef: string) => string): LedgerSide; /** * A settlement the feed filtered out rather than matched. Drops are legitimate — * sku-day aggregates have no per-transaction match key, and a foreign-currency * settlement cannot match a CREDIT/USD ledger — but a reconciliation feed must * never discard silently, so every drop is reported through `onDrop` with the * reason and enough identity to chase it in the provider's console. */ export type ReconcileDrop = { kind: ReconcileKind; reason: 'sku-day' | 'foreign-currency'; providerTxnId: string; currency: string; }; export declare function edgeReconcileFeed(edge: Edge, ledger: LedgerSide, onDrop?: (drop: ReconcileDrop) => void): ReconcileFeed;