Skip to content

Graphorin API reference v0.12.1


Graphorin API reference / @graphorin/store-sqlite / / SqliteTriggerStore

Class: SqliteTriggerStore

Defined in: packages/store-sqlite/src/trigger-store.ts:18

Default TriggerStore implementation. Backs the @graphorin/triggers scheduler with persistent rows so cron / interval / idle / event triggers survive process restarts (DEC-150).

Concurrency contract (W-133): two scheduler PROCESSES over one database file are not a supported deployment (see the storage guide's concurrency matrix). recordFire still carries a monotonic wall-clock fence as best-effort defense in depth for that unsupported case - a duplicate fixation with the same-or-earlier firedAt is a no-op instead of rewinding trigger state.

Stable

Implements

Constructors

Constructor

ts
new SqliteTriggerStore(conn): SqliteTriggerStore;

Defined in: packages/store-sqlite/src/trigger-store.ts:20

Parameters

ParameterType
connSqliteConnection

Returns

SqliteTriggerStore

Methods

get()

ts
get(id): Promise<
  | TriggerState
| null>;

Defined in: packages/store-sqlite/src/trigger-store.ts:50

Parameters

ParameterType
idstring

Returns

Promise< | TriggerState | null>

Implementation of

TriggerStore.get


list()

ts
list(): Promise<readonly TriggerState[]>;

Defined in: packages/store-sqlite/src/trigger-store.ts:55

Returns

Promise&lt;readonly TriggerState[]&gt;

Implementation of

TriggerStore.list


recordFire()

ts
recordFire(
   id, 
   firedAt, 
nextFireAt?): Promise<void>;

Defined in: packages/store-sqlite/src/trigger-store.ts:75

Persist a fire. W-133: the update carries a monotonic fence - a call whose firedAt is not strictly later than the stored last_fired_at changes nothing, so a second (unsupported) scheduler process re-fixing an old fire cannot rewind next_fire_at/missed_fires. The fence is wall-clock ms: two processes with the IDENTICAL firedAt both pass - accepted as best-effort for a deployment the docs already exclude. The in-process scheduler always calls this once per fire with a fresh timestamp, so supported behaviour is unchanged.

Parameters

ParameterType
idstring
firedAtstring
nextFireAt?string

Returns

Promise&lt;void&gt;

Implementation of

TriggerStore.recordFire


remove()

ts
remove(id): Promise<void>;

Defined in: packages/store-sqlite/src/trigger-store.ts:60

Parameters

ParameterType
idstring

Returns

Promise&lt;void&gt;

Implementation of

TriggerStore.remove


upsert()

ts
upsert(state): Promise<void>;

Defined in: packages/store-sqlite/src/trigger-store.ts:24

Parameters

ParameterType
stateTriggerState

Returns

Promise&lt;void&gt;

Implementation of

TriggerStore.upsert