Skip to content

@lastshotlabs/slingshot-events

npm install @lastshotlabs/slingshot-events

Create an instance-scoped replay validator from the app’s governed registries.

function createEventReplayValidator(options: EventReplayValidatorOptions,): EventReplayValidator

Source: packages/slingshot-events/src/replayValidation.ts

Create a lease-based, at-least-once outbox dispatcher.

function createOutboxDispatcher(options: OutboxDispatcherOptions): OutboxDispatcher

Source: packages/slingshot-events/src/outbox/dispatcher.ts

Create PostgreSQL-backed reliability operations for health and CLI tooling.

function createPostgresEventReliabilityOperations(postgres: PostgresBundle, options: EventReliabilityOperationsOptions = {},): EventReliabilityOperations

Source: packages/slingshot-events/src/operations/postgres.ts

Create a PostgreSQL inbox repository over the active transaction client.

function createPostgresInboxRepository(postgres: PostgresBundle): InboxRepository

Source: packages/slingshot-events/src/inbox/postgres.ts

Create the PostgreSQL skip-locked lease/finalization repository.

function createPostgresOutboxDispatchRepository(postgres: PostgresBundle,): OutboxDispatchRepository

Source: packages/slingshot-events/src/outbox/postgres.ts

Create a PostgreSQL outbox repository over the current scoped queryable.

function createPostgresOutboxRepository(postgres: PostgresBundle): OutboxRepository

Source: packages/slingshot-events/src/outbox/postgres.ts

Create SQLite-backed reliability operations for health and CLI tooling.

function createSqliteEventReliabilityOperations(db: RuntimeSqliteDatabase, options: EventReliabilityOperationsOptions = {},): EventReliabilityOperations

Source: packages/slingshot-events/src/operations/sqlite.ts

Create a SQLite inbox repository over the active transaction connection.

function createSqliteInboxRepository(db: RuntimeSqliteDatabase): InboxRepository

Source: packages/slingshot-events/src/inbox/sqlite.ts

Create the SQLite lease/finalization repository used by one dispatcher loop.

function createSqliteOutboxDispatchRepository(db: RuntimeSqliteDatabase,): OutboxDispatchRepository

Source: packages/slingshot-events/src/outbox/sqlite.ts

Create a SQLite outbox repository over the current scoped database handle.

function createSqliteOutboxRepository(db: RuntimeSqliteDatabase): OutboxRepository

Source: packages/slingshot-events/src/outbox/sqlite.ts

Build the governed durable consumer wrapper used by events.consume().

function createTransactionalEventConsumer(configuredStore: EventReliabilityStore, bus: SlingshotEventBus, transactions: TransactionManager, resolveInfra: ResolveTransactionScopeInfra, onLifecycle?: (event: InboxLifecycleEvent) => void,): TransactionalEventConsumer

Source: packages/slingshot-events/src/consume.ts

Build the transaction-bound writer used by the governed event publisher.

function createTransactionalEventOutboxWriter(store: EventReliabilityStore, enqueue: EnqueueTransactionScopeWork, onInserted?: () => void,): TransactionalEventOutboxWriter

Source: packages/slingshot-events/src/outbox/writer.ts

Zod schema for transactional inbox configuration.

FieldDescription
enabledEnable transactional consumer inbox deduplication.

Source: packages/slingshot-events/src/config.schema.ts

Zod schema for transactional outbox configuration.

FieldDescription
enabledEnable transactional outbox persistence and dispatch.

Source: packages/slingshot-events/src/config.schema.ts

Zod schema for top-level events.reliability configuration.

FieldDescription
inboxTransactional inbox settings, or false to disable inbox deduplication.
outboxTransactional outbox settings, or false to disable outbox delivery.
readinessOptional readiness thresholds for durable event processing.
storeSQL store shared by domain transactions and event reliability tables.

Source: packages/slingshot-events/src/config.schema.ts

Zod schema for transactional-event readiness thresholds.

FieldDescription
deadRowsReadiness severity when dead outbox rows exist.

Source: packages/slingshot-events/src/config.schema.ts

Zod schema for outbox retry timing.

FieldDescription
jitterFractional random jitter applied to publication retry delays.

Source: packages/slingshot-events/src/config.schema.ts

Apply package-owned reliability migrations before dispatchers or consumers start.

async function initializeEventReliabilityStore(infra: StoreInfra, config: EventReliabilityConfig,): Promise<void>

Source: packages/slingshot-events/src/migrations/initialize.ts

Parse one stored envelope and return only the fields safe for operator projection.

function projectStoredEventEnvelope(envelopeJson: string): void

Source: packages/slingshot-events/src/operatorProjection.ts

Produce a bounded, recursively redacted payload preview for operator tooling.

function redactEventPayload(eventKey: string, payload: unknown): unknown

Source: packages/slingshot-events/src/operatorProjection.ts

Redact credentials and bound the size of one operator-visible text field.

function redactOperatorText(value: string): string

Source: packages/slingshot-events/src/operatorProjection.ts

Serialize a governed envelope without changing its stable identity.

function serializeOutboxEnvelope(envelope: EventEnvelope): NewOutboxRow

Source: packages/slingshot-events/src/outbox/repository.ts

Validate cross-component event reliability requirements before migrations or workers start.

function validateEventReliabilityTopology(input: EventReliabilityTopologyInput): void

Source: packages/slingshot-events/src/config.schema.ts

Thrown when event reliability configuration selects an unsupported topology.

Source: packages/slingshot-events/src/errors.ts

TransactionalEventDeliveryUnavailableError

Section titled “TransactionalEventDeliveryUnavailableError”

Thrown when outbox delivery is requested but reliability is not available.

Source: packages/slingshot-events/src/errors.ts

Base class for transactional event delivery failures.

Source: packages/slingshot-events/src/errors.ts

Thrown when outbox delivery omits its transaction scope.

Source: packages/slingshot-events/src/errors.ts

Thrown when a governed envelope cannot be safely serialized for persistence.

Source: packages/slingshot-events/src/errors.ts

Thrown when reliability and transaction scopes select different SQL stores.

Source: packages/slingshot-events/src/errors.ts

Transactional consumer-inbox configuration.

Source: packages/slingshot-events/src/types.ts

Durable package-owned record for any event operator mutation.

Source: packages/slingshot-events/src/outbox/repository.ts

Transactional outbox worker configuration.

Source: packages/slingshot-events/src/types.ts

Top-level configuration for transactional event reliability.

Source: packages/slingshot-events/src/types.ts

Read-only and explicitly mutating outbox/inbox operator contract.

Source: packages/slingshot-events/src/outbox/repository.ts

Optional governed registries used by operator replay validation.

Source: packages/slingshot-events/src/outbox/repository.ts

Readiness thresholds for transactional event infrastructure.

Source: packages/slingshot-events/src/types.ts

Input used to reject unsupported reliability topology before infrastructure access.

Source: packages/slingshot-events/src/config.schema.ts

Validates and prepares immutable stored envelopes for the current event contract.

Source: packages/slingshot-events/src/replayValidation.ts

Dependencies for governed replay compatibility.

Source: packages/slingshot-events/src/replayValidation.ts

Retry timing for failed durable publication attempts.

Source: packages/slingshot-events/src/types.ts

Bounded-cardinality inbox signal for framework metrics.

Source: packages/slingshot-events/src/consume.ts

Transaction-bound inbox deduplication persistence contract.

Source: packages/slingshot-events/src/inbox/repository.ts

Durable row leased by one dispatcher instance.

Source: packages/slingshot-events/src/outbox/repository.ts

Receipt inserted before one transactional consumer handler executes.

Source: packages/slingshot-events/src/inbox/repository.ts

Immutable outbox row inserted with a domain transaction.

Source: packages/slingshot-events/src/outbox/repository.ts

Running transactional outbox worker.

Source: packages/slingshot-events/src/outbox/dispatcher.ts

Injectable dispatcher dependencies used by production lifecycle and deterministic tests.

Source: packages/slingshot-events/src/outbox/dispatcher.ts

Persistence operations used by the outbox dispatcher outside domain transactions.

Source: packages/slingshot-events/src/outbox/repository.ts

Dispatcher signal that never exposes a raw event ID or tenant.

Source: packages/slingshot-events/src/outbox/dispatcher.ts

Redacted bounded detail for one durable outbox event.

Source: packages/slingshot-events/src/outbox/repository.ts

Bounded operational view of one outbox row.

Source: packages/slingshot-events/src/outbox/repository.ts

Aggregate state used by readiness, metrics, and events outbox status.

Source: packages/slingshot-events/src/outbox/repository.ts

Audit record written whenever an operator makes dead work retryable.

Source: packages/slingshot-events/src/outbox/repository.ts

Transaction-bound persistence contract for new outbox rows.

Source: packages/slingshot-events/src/outbox/repository.ts

Context supplied to one transactional inbox handler.

Source: packages/slingshot-events/src/types.ts

Durable named-consumer options for SQL inbox deduplication.

Source: packages/slingshot-events/src/types.ts

Internal scope-work scheduler supplied by the framework transaction manager.

Source: packages/slingshot-events/src/outbox/writer.ts

SQL stores supported by transactional event reliability.

Source: packages/slingshot-events/src/types.ts

Stable incompatibility reasons surfaced to operators without validation internals.

Source: packages/slingshot-events/src/replayValidation.ts

Compatibility result produced before durable replay or publication.

Source: packages/slingshot-events/src/replayValidation.ts

Persisted lifecycle state exposed to operators.

Source: packages/slingshot-events/src/outbox/repository.ts

Resolve the transaction-bound infrastructure view for one authentic open scope.

Source: packages/slingshot-events/src/consume.ts