Skip to content

@xtandard/webhooks/core

Admin + publish core — the operations layer the API, CLI, and dispatcher sit on top of.

Owns the split between the control plane (CRUD on applications / event types / endpoints, browsing messages and deliveries, replay — rare, human-driven, hook-guarded, audited) and the delivery plane (publish()

  • the dispatcher’s claim/record internals — the hot path). publish() never performs an HTTP call and never throws because an endpoint is down: it persists one message and fans out one pending delivery per matching enabled endpoint; the dispatcher owns all network I/O.

Storage can be split: control data lives in storage, while deliveries + the due index live in queueStorage (defaults to storage) — e.g. control in Postgres, queue in Redis.

import { … } from "@xtandard/webhooks/core";
Name Summary
createWebhooksCore Construct the core over the configured storage.
Name Summary
ConflictError Thrown when creating an entity whose key already exists. Maps to HTTP 409.
IdempotencyConflictError Thrown by WebhooksCore.publish when an idempotency key is reused with a different payload (same key + same payload returns the original message instead). Maps to HTTP 409.
NotFoundError Thrown when a referenced application/event type/endpoint/delivery does not exist.
PayloadTooLargeError Thrown by WebhooksCore.publish when the payload exceeds the limit. Maps to 413.
ReadonlyError Thrown by mutating operations when the core is in readonly mode.
Name Summary
ActorOptions Per-call actor attribution for audited mutations.
ClaimInput Input to the dispatcher-facing WebhooksCore.claimDueDeliveries.
ListDeliveriesOptions Pagination + filters for WebhooksCore.listDeliveries.
ListMessagesOptions Pagination + filters for WebhooksCore.listMessages.
PublishInput Input to WebhooksCore.publish.
PublishResult Result of WebhooksCore.publish.
RecordAttemptInput Input to the dispatcher-facing WebhooksCore.recordAttempt.
RecoverResult Result of WebhooksCore.recoverEndpoint.
RetentionOptions Retention policy for WebhooksCoreOptions.retention.
RetentionRule One retention rule set. When both fields are set, an item is kept if either rule keeps it (union of keeps — the same semantics as backup tools): pruned only when it is outside the keepLast most recent AND older than maxAge.
SendExampleResult Result of WebhooksCore.sendExample.
WebhooksCore The admin + publish core surface.
WebhooksCoreOptions Options for createWebhooksCore.