Skip to content

basalt / events/src / OutboxStore

Interface: OutboxStore ​

Defined in: events/src/outbox.ts:81

Methods ​

all() ​

> all(): Promise<OutboxEntry[]>

Defined in: events/src/outbox.ts:106

Returns ​

Promise<OutboxEntry[]>


claim()? ​

> optional claim(ids, options): Promise<string[]>

Defined in: events/src/outbox.ts:101

OPTIONAL — atomically claims the given entries for one relay, so several relays (replicas) sharing the store never dispatch the same entry at once. Claims only entries still unpublished whose previous claim expired (lockedUntil <= now, or none), stamps token and until on them, and returns the ids it won. Must be atomic across processes (a conditional UPDATE … WHERE lockedUntil IS NULL OR lockedUntil <= now). Stores without it are single-relay only.

Parameters ​

ids ​

string[]

options ​

OutboxClaimOptions

Returns ​

Promise&lt;string[]&gt;


enqueue() ​

> enqueue(entry, options?): Promise&lt;OutboxEntry&gt;

Defined in: events/src/outbox.ts:86

Writes an entry. With options.tx the write joins that transaction (stores that support it) — commit both the state change and the event, or neither.

Parameters ​

entry ​
createdAt ​

number

event ​

string

id? ​

string

payload ​

unknown

tenantId? ​

string

options? ​

OutboxStoreEnqueueOptions

Returns ​

Promise&lt;OutboxEntry&gt;


markFailed() ​

> markFailed(id, error, options?): Promise&lt;void&gt;

Defined in: events/src/outbox.ts:105

Records a failed attempt (and releases its claim, or holds it until options.retryAt).

Parameters ​

id ​

string

error ​

string

options? ​

OutboxMarkFailedOptions

Returns ​

Promise&lt;void&gt;


markPublished() ​

> markPublished(id, at): Promise&lt;void&gt;

Defined in: events/src/outbox.ts:103

Marks an entry delivered (and releases its claim).

Parameters ​

id ​

string

at ​

number

Returns ​

Promise&lt;void&gt;


pending() ​

> pending(limit, maxAttempts, filter?): Promise&lt;OutboxEntry[]&gt;

Defined in: events/src/outbox.ts:91

Unpublished entries below the attempt ceiling (minus filter's tenants), oldest first.

Parameters ​

limit ​

number

maxAttempts ​

number

filter? ​

OutboxPendingFilter

Returns ​

Promise&lt;OutboxEntry[]&gt;

Released under the MIT License.