basalt / events-sqlite/src / SqliteOutboxStore
Class: SqliteOutboxStore
Defined in: events-sqlite/src/index.ts:89
Implements
Constructors
Constructor
> new SqliteOutboxStore(db): SqliteOutboxStore
Defined in: events-sqlite/src/index.ts:90
Parameters
db
DatabaseSync
Returns
SqliteOutboxStore
Methods
all()
> all(): Promise<OutboxEntry[]>
Defined in: events-sqlite/src/index.ts:195
Returns
Promise<OutboxEntry[]>
Implementation of
claim()
> claim(ids, options): Promise<string[]>
Defined in: events-sqlite/src/index.ts:164
Claims rows for one relay: a single conditional UPDATE (atomic in SQLite, also across processes sharing the file) stamps the token on rows still unpublished and unclaimed (or expired); a SELECT reads back the winners.
Parameters
ids
string[]
options
Returns
Promise<string[]>
Implementation of
enqueue()
> enqueue(input, options?): Promise<OutboxEntry>
Defined in: events-sqlite/src/index.ts:99
Writes the entry. Pass { tx } — the DatabaseSync handle on which your BEGIN … COMMIT runs (the store's own handle, or another connection to the same file) — to write it in that transaction: a rollback removes it with the state change. Without tx it is written on the store's handle, which already joins any transaction open on that same handle.
Parameters
input
createdAt
number
event
string
id?
string
payload
unknown
tenantId?
string
options?
tx?
DatabaseSync
Returns
Promise<OutboxEntry>
Implementation of
markFailed()
> markFailed(id, error, options?): Promise<void>
Defined in: events-sqlite/src/index.ts:187
Records a failure and releases the claim — or holds it until retryAt (cross-relay backoff).
Parameters
id
string
error
string
options?
Returns
Promise<void>
Implementation of
markPublished()
> markPublished(id, at): Promise<void>
Defined in: events-sqlite/src/index.ts:180
Marks an entry delivered (and releases its claim).
Parameters
id
string
at
number
Returns
Promise<void>
Implementation of
pending()
> pending(limit, maxAttempts, filter?): Promise<OutboxEntry[]>
Defined in: events-sqlite/src/index.ts:129
Unpublished entries below the attempt ceiling (minus filter's tenants), oldest first.
Parameters
limit
number
maxAttempts
number
filter?
OutboxPendingFilter = {}
Returns
Promise<OutboxEntry[]>