@lastshotlabs/slingshot-events
npm install @lastshotlabs/slingshot-events
Functions
Section titled “Functions”createEventReplayValidator
Section titled “createEventReplayValidator”Create an instance-scoped replay validator from the app’s governed registries.
function createEventReplayValidator(options: EventReplayValidatorOptions,): EventReplayValidatorSource: packages/slingshot-events/src/replayValidation.ts
createOutboxDispatcher
Section titled “createOutboxDispatcher”Create a lease-based, at-least-once outbox dispatcher.
function createOutboxDispatcher(options: OutboxDispatcherOptions): OutboxDispatcherSource: packages/slingshot-events/src/outbox/dispatcher.ts
createPostgresEventReliabilityOperations
Section titled “createPostgresEventReliabilityOperations”Create PostgreSQL-backed reliability operations for health and CLI tooling.
function createPostgresEventReliabilityOperations(postgres: PostgresBundle, options: EventReliabilityOperationsOptions = {},): EventReliabilityOperationsSource: packages/slingshot-events/src/operations/postgres.ts
createPostgresInboxRepository
Section titled “createPostgresInboxRepository”Create a PostgreSQL inbox repository over the active transaction client.
function createPostgresInboxRepository(postgres: PostgresBundle): InboxRepositorySource: packages/slingshot-events/src/inbox/postgres.ts
createPostgresOutboxDispatchRepository
Section titled “createPostgresOutboxDispatchRepository”Create the PostgreSQL skip-locked lease/finalization repository.
function createPostgresOutboxDispatchRepository(postgres: PostgresBundle,): OutboxDispatchRepositorySource: packages/slingshot-events/src/outbox/postgres.ts
createPostgresOutboxRepository
Section titled “createPostgresOutboxRepository”Create a PostgreSQL outbox repository over the current scoped queryable.
function createPostgresOutboxRepository(postgres: PostgresBundle): OutboxRepositorySource: packages/slingshot-events/src/outbox/postgres.ts
createSqliteEventReliabilityOperations
Section titled “createSqliteEventReliabilityOperations”Create SQLite-backed reliability operations for health and CLI tooling.
function createSqliteEventReliabilityOperations(db: RuntimeSqliteDatabase, options: EventReliabilityOperationsOptions = {},): EventReliabilityOperationsSource: packages/slingshot-events/src/operations/sqlite.ts
createSqliteInboxRepository
Section titled “createSqliteInboxRepository”Create a SQLite inbox repository over the active transaction connection.
function createSqliteInboxRepository(db: RuntimeSqliteDatabase): InboxRepositorySource: packages/slingshot-events/src/inbox/sqlite.ts
createSqliteOutboxDispatchRepository
Section titled “createSqliteOutboxDispatchRepository”Create the SQLite lease/finalization repository used by one dispatcher loop.
function createSqliteOutboxDispatchRepository(db: RuntimeSqliteDatabase,): OutboxDispatchRepositorySource: packages/slingshot-events/src/outbox/sqlite.ts
createSqliteOutboxRepository
Section titled “createSqliteOutboxRepository”Create a SQLite outbox repository over the current scoped database handle.
function createSqliteOutboxRepository(db: RuntimeSqliteDatabase): OutboxRepositorySource: packages/slingshot-events/src/outbox/sqlite.ts
createTransactionalEventConsumer
Section titled “createTransactionalEventConsumer”Build the governed durable consumer wrapper used by events.consume().
function createTransactionalEventConsumer(configuredStore: EventReliabilityStore, bus: SlingshotEventBus, transactions: TransactionManager, resolveInfra: ResolveTransactionScopeInfra, onLifecycle?: (event: InboxLifecycleEvent) => void,): TransactionalEventConsumerSource: packages/slingshot-events/src/consume.ts
createTransactionalEventOutboxWriter
Section titled “createTransactionalEventOutboxWriter”Build the transaction-bound writer used by the governed event publisher.
function createTransactionalEventOutboxWriter(store: EventReliabilityStore, enqueue: EnqueueTransactionScopeWork, onInserted?: () => void,): TransactionalEventOutboxWriterSource: packages/slingshot-events/src/outbox/writer.ts
eventInboxConfigSchema
Section titled “eventInboxConfigSchema”Zod schema for transactional inbox configuration.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
enabled | Enable transactional consumer inbox deduplication. |
Source: packages/slingshot-events/src/config.schema.ts
eventOutboxConfigSchema
Section titled “eventOutboxConfigSchema”Zod schema for transactional outbox configuration.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
enabled | Enable transactional outbox persistence and dispatch. |
Source: packages/slingshot-events/src/config.schema.ts
eventReliabilityConfigSchema
Section titled “eventReliabilityConfigSchema”Zod schema for top-level events.reliability configuration.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
inbox | Transactional inbox settings, or false to disable inbox deduplication. |
outbox | Transactional outbox settings, or false to disable outbox delivery. |
readiness | Optional readiness thresholds for durable event processing. |
store | SQL store shared by domain transactions and event reliability tables. |
Source: packages/slingshot-events/src/config.schema.ts
eventReliabilityReadinessConfigSchema
Section titled “eventReliabilityReadinessConfigSchema”Zod schema for transactional-event readiness thresholds.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
deadRows | Readiness severity when dead outbox rows exist. |
Source: packages/slingshot-events/src/config.schema.ts
eventRetryConfigSchema
Section titled “eventRetryConfigSchema”Zod schema for outbox retry timing.
Config Fields
Section titled “Config Fields”| Field | Description |
|---|---|
jitter | Fractional random jitter applied to publication retry delays. |
Source: packages/slingshot-events/src/config.schema.ts
initializeEventReliabilityStore
Section titled “initializeEventReliabilityStore”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
projectStoredEventEnvelope
Section titled “projectStoredEventEnvelope”Parse one stored envelope and return only the fields safe for operator projection.
function projectStoredEventEnvelope(envelopeJson: string): voidSource: packages/slingshot-events/src/operatorProjection.ts
redactEventPayload
Section titled “redactEventPayload”Produce a bounded, recursively redacted payload preview for operator tooling.
function redactEventPayload(eventKey: string, payload: unknown): unknownSource: packages/slingshot-events/src/operatorProjection.ts
redactOperatorText
Section titled “redactOperatorText”Redact credentials and bound the size of one operator-visible text field.
function redactOperatorText(value: string): stringSource: packages/slingshot-events/src/operatorProjection.ts
serializeOutboxEnvelope
Section titled “serializeOutboxEnvelope”Serialize a governed envelope without changing its stable identity.
function serializeOutboxEnvelope(envelope: EventEnvelope): NewOutboxRowSource: packages/slingshot-events/src/outbox/repository.ts
validateEventReliabilityTopology
Section titled “validateEventReliabilityTopology”Validate cross-component event reliability requirements before migrations or workers start.
function validateEventReliabilityTopology(input: EventReliabilityTopologyInput): voidSource: packages/slingshot-events/src/config.schema.ts
Classes
Section titled “Classes”EventReliabilityTopologyError
Section titled “EventReliabilityTopologyError”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
TransactionalEventError
Section titled “TransactionalEventError”Base class for transactional event delivery failures.
Source: packages/slingshot-events/src/errors.ts
TransactionalEventScopeRequiredError
Section titled “TransactionalEventScopeRequiredError”Thrown when outbox delivery omits its transaction scope.
Source: packages/slingshot-events/src/errors.ts
TransactionalEventSerializationError
Section titled “TransactionalEventSerializationError”Thrown when a governed envelope cannot be safely serialized for persistence.
Source: packages/slingshot-events/src/errors.ts
TransactionalEventStoreMismatchError
Section titled “TransactionalEventStoreMismatchError”Thrown when reliability and transaction scopes select different SQL stores.
Source: packages/slingshot-events/src/errors.ts
Interfaces
Section titled “Interfaces”EventInboxConfig
Section titled “EventInboxConfig”Transactional consumer-inbox configuration.
Source: packages/slingshot-events/src/types.ts
EventOperatorAudit
Section titled “EventOperatorAudit”Durable package-owned record for any event operator mutation.
Source: packages/slingshot-events/src/outbox/repository.ts
EventOutboxConfig
Section titled “EventOutboxConfig”Transactional outbox worker configuration.
Source: packages/slingshot-events/src/types.ts
EventReliabilityConfig
Section titled “EventReliabilityConfig”Top-level configuration for transactional event reliability.
Source: packages/slingshot-events/src/types.ts
EventReliabilityOperations
Section titled “EventReliabilityOperations”Read-only and explicitly mutating outbox/inbox operator contract.
Source: packages/slingshot-events/src/outbox/repository.ts
EventReliabilityOperationsOptions
Section titled “EventReliabilityOperationsOptions”Optional governed registries used by operator replay validation.
Source: packages/slingshot-events/src/outbox/repository.ts
EventReliabilityReadinessConfig
Section titled “EventReliabilityReadinessConfig”Readiness thresholds for transactional event infrastructure.
Source: packages/slingshot-events/src/types.ts
EventReliabilityTopologyInput
Section titled “EventReliabilityTopologyInput”Input used to reject unsupported reliability topology before infrastructure access.
Source: packages/slingshot-events/src/config.schema.ts
EventReplayValidator
Section titled “EventReplayValidator”Validates and prepares immutable stored envelopes for the current event contract.
Source: packages/slingshot-events/src/replayValidation.ts
EventReplayValidatorOptions
Section titled “EventReplayValidatorOptions”Dependencies for governed replay compatibility.
Source: packages/slingshot-events/src/replayValidation.ts
EventRetryConfig
Section titled “EventRetryConfig”Retry timing for failed durable publication attempts.
Source: packages/slingshot-events/src/types.ts
InboxLifecycleEvent
Section titled “InboxLifecycleEvent”Bounded-cardinality inbox signal for framework metrics.
Source: packages/slingshot-events/src/consume.ts
InboxRepository
Section titled “InboxRepository”Transaction-bound inbox deduplication persistence contract.
Source: packages/slingshot-events/src/inbox/repository.ts
LeasedOutboxRow
Section titled “LeasedOutboxRow”Durable row leased by one dispatcher instance.
Source: packages/slingshot-events/src/outbox/repository.ts
NewInboxReceipt
Section titled “NewInboxReceipt”Receipt inserted before one transactional consumer handler executes.
Source: packages/slingshot-events/src/inbox/repository.ts
NewOutboxRow
Section titled “NewOutboxRow”Immutable outbox row inserted with a domain transaction.
Source: packages/slingshot-events/src/outbox/repository.ts
OutboxDispatcher
Section titled “OutboxDispatcher”Running transactional outbox worker.
Source: packages/slingshot-events/src/outbox/dispatcher.ts
OutboxDispatcherOptions
Section titled “OutboxDispatcherOptions”Injectable dispatcher dependencies used by production lifecycle and deterministic tests.
Source: packages/slingshot-events/src/outbox/dispatcher.ts
OutboxDispatchRepository
Section titled “OutboxDispatchRepository”Persistence operations used by the outbox dispatcher outside domain transactions.
Source: packages/slingshot-events/src/outbox/repository.ts
OutboxLifecycleEvent
Section titled “OutboxLifecycleEvent”Dispatcher signal that never exposes a raw event ID or tenant.
Source: packages/slingshot-events/src/outbox/dispatcher.ts
OutboxOperationalDetail
Section titled “OutboxOperationalDetail”Redacted bounded detail for one durable outbox event.
Source: packages/slingshot-events/src/outbox/repository.ts
OutboxOperationalRow
Section titled “OutboxOperationalRow”Bounded operational view of one outbox row.
Source: packages/slingshot-events/src/outbox/repository.ts
OutboxOperationalStatus
Section titled “OutboxOperationalStatus”Aggregate state used by readiness, metrics, and events outbox status.
Source: packages/slingshot-events/src/outbox/repository.ts
OutboxReplayAudit
Section titled “OutboxReplayAudit”Audit record written whenever an operator makes dead work retryable.
Source: packages/slingshot-events/src/outbox/repository.ts
OutboxRepository
Section titled “OutboxRepository”Transaction-bound persistence contract for new outbox rows.
Source: packages/slingshot-events/src/outbox/repository.ts
TransactionalEventConsumerContext
Section titled “TransactionalEventConsumerContext”Context supplied to one transactional inbox handler.
Source: packages/slingshot-events/src/types.ts
TransactionalEventConsumerOptions
Section titled “TransactionalEventConsumerOptions”Durable named-consumer options for SQL inbox deduplication.
Source: packages/slingshot-events/src/types.ts
EnqueueTransactionScopeWork
Section titled “EnqueueTransactionScopeWork”Internal scope-work scheduler supplied by the framework transaction manager.
Source: packages/slingshot-events/src/outbox/writer.ts
EventReliabilityStore
Section titled “EventReliabilityStore”SQL stores supported by transactional event reliability.
Source: packages/slingshot-events/src/types.ts
EventReplayIncompatibility
Section titled “EventReplayIncompatibility”Stable incompatibility reasons surfaced to operators without validation internals.
Source: packages/slingshot-events/src/replayValidation.ts
EventReplayValidation
Section titled “EventReplayValidation”Compatibility result produced before durable replay or publication.
Source: packages/slingshot-events/src/replayValidation.ts
OutboxStatus
Section titled “OutboxStatus”Persisted lifecycle state exposed to operators.
Source: packages/slingshot-events/src/outbox/repository.ts
ResolveTransactionScopeInfra
Section titled “ResolveTransactionScopeInfra”Resolve the transaction-bound infrastructure view for one authentic open scope.
Source: packages/slingshot-events/src/consume.ts