Beignet API reference
    Preparing search index...

    Function createIdempotencyHooks

    • Create metadata-driven idempotency hooks.

      The hook reads contract.metadata.idempotency and enforces it with ctx.ports.idempotency. In beforeHandle it reserves the client key after request parsing and route hook identity resolution, replays completed matching responses with an idempotency-replayed: true header, and rejects in-progress or conflicting keys with the framework IdempotencyInProgress/IdempotencyConflict catalog errors. After the response-validation phase, it stores final route-owned 2xx framework-neutral responses for replay and releases the reservation for framework-owned responses, errors, non-2xx responses, and native Response results, which are not replayable.

      Use runIdempotently(...) from @beignet/core/idempotency for non-HTTP workflows such as jobs, listeners, webhooks, and schedules.

      Type Parameters

      Parameters

      Returns ServerHook<Ctx, IdempotencyPorts>

      A server hook backed by ctx.ports.idempotency.