/** * @packageDocumentation * @module act-http/webhook * * Reaction-handler sugar for POSTing committed events to external URLs. * * Wraps `fetch` with timeouts, automatic `Idempotency-Key` derivation, and * status-classified errors. Designed to be composed with the reaction * options shipped in ACT-601 (`maxRetries`, `blockOnError`, `backoff`): * * ```ts * import { webhook } from "@rotorsoft/act-http/webhook"; * * .on("OrderConfirmed") * .do( * webhook({ * url: "https://api.example.com/webhooks/orders", * headers: (e) => ({ Authorization: "Bearer ..." }), * body: (e) => ({ orderId: e.stream, total: e.data.total }), * timeoutMs: 5_000, * }), * { maxRetries: 5, backoff: { strategy: "exponential", baseMs: 200, maxMs: 30_000 } } * ) * .to(resolver); * ``` */ import type { ReactionHandler, Schemas } from "@rotorsoft/act"; import { type WebhookConfig } from "./types.js"; export type { HttpDisposition } from "./classify.js"; export type { HttpDeliveryErrorInit, WebhookBody, WebhookConfig, WebhookResolver, } from "./types.js"; export { NonRetryableHttpError, NonRetryableWebhookError, RetryableHttpError, WebhookError, } from "./types.js"; /** * Build a reaction handler that POSTs each event to an external URL. * * Behavior: * * - 2xx and 3xx return successfully. * - 5xx responses, network errors, and timeouts throw * {@link WebhookError} (`status: 0` for network/timeout). Drain * retries per the reaction's `maxRetries` / `backoff`. * - 4xx responses throw {@link NonRetryableWebhookError}, which * extends `NonRetryableError`. The drain finalizer blocks the * stream immediately (when `blockOnError` is true) without * consuming the retry budget. */ export declare function webhook(config: WebhookConfig): ReactionHandler; //# sourceMappingURL=index.d.ts.map