/** * @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 { Economy } from '../contract.js'; import type { CallOptions, Ports, Store } from '../ports.js'; /** * Result of one inbox-apply run, the inbound mirror of {@link RelaySummary}. * - `applied`: committed or deduped; row marked 'applied' so it is not re-claimed. * - `failed`: apply threw under the cap; row stays 'pending' with `attempts` bumped, retried * next run. * - `deadLettered`: hit the attempt cap or was declined (a `rejected` Outcome, terminal). Row set * to 'dead' and never re-claimed, so a poison event cannot block the events behind it. */ export type InboxSummary = { applied: ReadonlyArray; failed: ReadonlyArray<{ id: string; code: string; retryable: boolean; }>; deadLettered: ReadonlyArray<{ id: string; reason: string; }>; }; type Applier = Pick; /** * Applies a batch of pending inbox events — verified inbound provider events already mapped to * the `Operation` they apply. * * Never gated on the economy pause: settlements must keep flowing through a maintenance window. * An apply can run more than once (submit committed but `markApplied` did not); exactly-once * rests on the stored Operation's idempotencyKey (the provider event id the row deduped on), so * a re-apply resolves to a `duplicate` Outcome. * * @see {@link https://economy-lab-docs.pages.dev/economy/reference/background-worker/ Background * worker} for how inbox draining fits the sweep loop. * @see {@link https://economy-lab-docs.pages.dev/economy/concepts/idempotency/ Idempotency} for the * idempotencyKey dedupe. */ export declare function drainInbox(store: Store, ports: Ports, input: { economy: Applier; now: number; limit: number; }, options?: CallOptions): Promise; export {};