/** * @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 { Dispatcher } from '../ports.js'; export interface HttpDispatcherConfig { /** * The consumer endpoint each event is POSTed to — your event bus or webhook receiver. The lab * is the producer; the receiver is out of scope. */ url: string; /** * Supplies the `fetch` implementation. Defaults to the global `fetch`, which avoids any * node-specific dependency. Tests pass a stand-in. */ fetch?: typeof fetch; } /** * Builds the {@link Dispatcher} that POSTs one economy event to a remote endpoint over HTTP, the * body encoded by the shared `encodeEvent` (event-wire.ts). * * A network error or a non-2xx response throws a retryable `PROVIDER.FAILURE`, so the relay * redelivers later with backoff. Because a retry can duplicate an event, the event id goes in an * `Idempotency-Key` header for the receiver to dedupe. * * @see {@link https://economy-lab-docs.pages.dev/economy/ports/messaging/ Messaging} for the outbox-to-relay flow, the dispatcher port, and at-least-once delivery. */ export declare function httpDispatcher(config: HttpDispatcherConfig): Dispatcher;