Skip to content

StoreTx

Defined in: packages/core/src/model/store.ts:153

appendAudit(events): Promise<void>

Defined in: packages/core/src/model/store.ts:165

readonly AuditEvent[]

Promise<void>


enqueueEvents(events, now): Promise<void>

Defined in: packages/core/src/model/store.ts:170

Adds events with zero attempts, due at now.

readonly DomainEvent[]

string

Promise<void>


findBlocked(query): Promise<BlockedStepView[]>

Defined in: packages/core/src/model/store.ts:206

Blocked steps of pending requests, blocked longest first by (blockedAt, requestId). The tenant must match exactly. Build each item with blockedStepView(state).

BlockedQuery

Promise<BlockedStepView[]>


findDelegations(fromUserIds, tenantId?): Promise<DelegationRule[]>

Defined in: packages/core/src/model/store.ts:212

Every rule of these users, active or not; the engine filters by time, scope and tenant. With a tenantId: rules of that tenant and rules without one. Without: rules without one.

readonly string[]

string

Promise<DelegationRule[]>


findDue(now, limit, options?): Promise<string[]>

Defined in: packages/core/src/model/store.ts:167

Ids of requests with nextDueAt <= now, earliest first.

string

number

ClaimOptions

Promise<string[]>


findInbox(query): Promise<TaskView[]>

Defined in: packages/core/src/model/store.ts:196

Pending tasks on active steps of pending requests that the user holds (assigneeId) or that a delegate holds on the user’s behalf (onBehalfOf, EC-60), ordered by (assignedAt, taskId). The tenant must match exactly. Adapters return the task as stored; the service adds heldBy.

InboxQuery

Promise<TaskView[]>


findRequests(query): Promise<RequestSummary[]>

Defined in: packages/core/src/model/store.ts:201

Requests matching every given filter, newest first by (submittedAt desc, id desc). The tenant must match exactly. Build each item with requestSummary(state).

RequestQuery

Promise<RequestSummary[]>


getAudit(requestId): Promise<AuditEvent[]>

Defined in: packages/core/src/model/store.ts:190

Audit events of one request, ordered by seq.

string

Promise<AuditEvent[]>


getDelegation(id): Promise<DelegationRule | null>

Defined in: packages/core/src/model/store.ts:215

string

Promise<DelegationRule | null>


getFlow(ref): Promise<RegisteredFlow | null>

Defined in: packages/core/src/model/store.ts:155

Matches the scope exactly; versions are numbered per (tenantId, key).

FlowRef

Promise<RegisteredFlow | null>


getIdempotent(ref): Promise<IdempotentRecord | null>

Defined in: packages/core/src/model/store.ts:186

IdempotencyRef

Promise<IdempotentRecord | null>


getRequest(id, opts?): Promise<RequestState | null>

Defined in: packages/core/src/model/store.ts:159

string

boolean

Promise<RequestState | null>


listDelegations(query): Promise<DelegationRule[]>

Defined in: packages/core/src/model/store.ts:217

Rules from or to the user, with the same tenant matching as findDelegations.

string

string

Promise<DelegationRule[]>


markDispatched(keys, now?): Promise<void>

Defined in: packages/core/src/model/store.ts:180

now: when they were delivered; adapters that keep delivered events may record it.

readonly EventKey[]

string

Promise<void>


markFailed(key, failure): Promise<void>

Defined in: packages/core/src/model/store.ts:181

EventKey

number

string

string

Promise<void>


pendingEvents(query): Promise<OutboxEntry[]>

Defined in: packages/core/src/model/store.ts:176

Due entries (nextAttemptAt <= now), never one while an earlier entry of the same request is still undelivered: each request contributes its due events in seq order from its oldest undelivered one. Requests are ordered by that oldest event’s nextAttemptAt, then by id.

object & ClaimOptions

Promise<OutboxEntry[]>


putIdempotent(ref, record): Promise<void>

Defined in: packages/core/src/model/store.ts:187

IdempotencyRef

IdempotentRecord

Promise<void>


saveDelegation(rule): Promise<void>

Defined in: packages/core/src/model/store.ts:214

Inserts or replaces the rule with this id.

DelegationRule

Promise<void>


saveFlow(flow): Promise<void>

Defined in: packages/core/src/model/store.ts:157

flow.tenantId sets the scope.

RegisteredFlow

Promise<void>


saveRequest(state, expectedVersion): Promise<void>

Defined in: packages/core/src/model/store.ts:164

Compare-and-set on version: expectedVersion null means the request must not exist yet. A mismatch throws ConflictError (EC-15).

RequestState

number | null

Promise<void>