Skip to content

@xtandard/webhooks/schema

Core type definitions for @xtandard/webhooks.

This module is types only — no runtime code beyond tiny guards and the schema-version constant, no dependencies. It is safe to import from the publish hot path and the receiver. Runtime validation (which pulls in valibot) lives in validation.

import { … } from "@xtandard/webhooks/schema";
Name Summary
isTerminalDeliveryStatus Guard: has this delivery reached a terminal state?
Name Summary
Actor Identity captured on audit records and passed by callers of audited mutations.
Application An application is the unit of tenancy — typically one of your customers. Endpoints, messages, and deliveries are all scoped to an application, and a portal token grants access to exactly one application.
AuditEntry A single control-plane audit record. Publishes are deliberately not audited — they are data-plane traffic, and the message log is their record.
Delivery One message × one endpoint. Created at publish time (fan-out) and driven to a terminal state by the dispatcher.
DeliveryAttempt The recorded outcome of a single HTTP delivery attempt.
Endpoint A customer-registered URL that receives deliveries for one application.
EndpointSecret A signing secret attached to an endpoint. Secrets are whsec_ + base64 per the Standard Webhooks spec. Rotation keeps the previous secret verifiable until expiresAt (the grace window); expired secrets are pruned lazily.
EventType A named kind of event in the global catalog (shared by all applications), e.g. "invoice.paid". Endpoints subscribe to event types by name.
Message A published event for one application. The message is the receiver-facing unit: its id is the webhook-id header (stable across retries — receivers dedupe on it), and its payload is the data of the wire envelope.
WebhookEnvelope The wire envelope receivers get — the Standard Webhooks recommended shape. type is the event type name, timestamp the event-occurred time, and data the published payload.
Name Summary
AttemptTrigger What initiated a delivery attempt.
AuditAction Actions recorded in the control-plane audit log.
DeliveryStatus Delivery lifecycle. "failed" means the retry schedule is exhausted — the dead-letter state. A manual retry moves a failed delivery back to "pending".
EndpointDisabledReason Why an endpoint is disabled: by an operator, or by the auto-disable policy.
JsonValue JSON-serializable value, used for payloads, metadata, and event-type schemas.
WebhookDuration A duration for configuration options: either milliseconds as a number, or a human-friendly string such as "5s", "30m", "2h", "5d". Parsed by ./duration.durationToMs.
Name Summary
SCHEMA_VERSION Current schema version for stored records.