Skip to main content
Defined in: durability/types.ts:137 Persistence contract of the inbound journal.

Methods

append()

Defined in: durability/types.ts:144 Insert-if-absent by id. 'duplicate' means the id is already known (any state); the existing record is returned unchanged. With lease, a new record is created already claimed (processing, token 1, 1 attempt), so no other claimer can take it between the append and the claim.

Parameters

Returns

Promise<{ status: "appended" | "duplicate"; record: InboxRecord; }>

claim()

Defined in: durability/types.ts:150 Lease due records: pending/failed whose nextAttemptAt <= now, plus processing records whose lease expired. Oldest receivedAt first. Each claimed record comes back processing with a fresh fencingToken and attempts + 1.

Parameters

Returns

Promise<InboxRecord[]>

claimOne()

Defined in: durability/types.ts:152 Lease one specific record when it is claimable (as claim); null when it is not.

Parameters

Returns

Promise<InboxRecord | null>

ack()

Defined in: durability/types.ts:154 processing → done.

Parameters

Returns

Promise<void>

Throws

when token is not the current claim.

fail()

Defined in: durability/types.ts:159 processing → failed (due at retryAt, default now) or dead (dead: true).

Parameters

Returns

Promise<void>

Throws


release()

Defined in: durability/types.ts:161 processing → pending, due now; the claim’s attempt is not charged.

Parameters

Returns

Promise<void>

Throws


extend()

Defined in: durability/types.ts:163 Extend the current lease (heartbeat).

Parameters

Returns

Promise<void>

Throws


replay()

Defined in: durability/types.ts:165 Operator replay: any record → pending, due now, attempts reset. No-op for an unknown id.

Parameters

Returns

Promise<void>

get()

Defined in: durability/types.ts:166

Parameters

Returns

Promise<InboxRecord | undefined>

list()

Defined in: durability/types.ts:168 Records, optionally by state, oldest receivedAt first.

Parameters

Returns

Promise<InboxRecord[]>

purge()

Defined in: durability/types.ts:170 Delete done records completed before doneBefore (and dead ones when includeDead). Returns the count.

Parameters

Returns

Promise<number>