@dudousxd/nestjs-durable-store-drizzle 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.cjs +403 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{schema.d.ts → index.d.cts} +294 -84
- package/dist/index.d.ts +1591 -3
- package/dist/index.js +370 -17
- package/dist/index.js.map +1 -1
- package/package.json +21 -6
- package/dist/drizzle-state-store.d.ts +0 -38
- package/dist/drizzle-state-store.d.ts.map +0 -1
- package/dist/drizzle-state-store.js +0 -272
- package/dist/drizzle-state-store.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -53
- package/dist/schema.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,19 +1,372 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/drizzle-state-store.ts
|
|
5
|
+
import { attributeColumnFor, attributeOperand, normalizeAttributeRows, sqlComparator } from "@dudousxd/nestjs-durable-core";
|
|
6
|
+
import { and, asc, desc, eq, exists, inArray, isNotNull, isNull, like, lte, or, sql } from "drizzle-orm";
|
|
7
|
+
|
|
8
|
+
// src/schema.ts
|
|
9
|
+
import { integer, primaryKey, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
10
|
+
var workflowRuns = sqliteTable("durable_workflow_runs", {
|
|
11
|
+
id: text("id").primaryKey(),
|
|
12
|
+
workflow: text("workflow").notNull(),
|
|
13
|
+
workflowVersion: text("workflow_version").notNull(),
|
|
14
|
+
status: text("status").notNull(),
|
|
15
|
+
input: text("input", {
|
|
16
|
+
mode: "json"
|
|
17
|
+
}),
|
|
18
|
+
output: text("output", {
|
|
19
|
+
mode: "json"
|
|
20
|
+
}),
|
|
21
|
+
error: text("error", {
|
|
22
|
+
mode: "json"
|
|
23
|
+
}),
|
|
24
|
+
wakeAt: integer("wake_at"),
|
|
25
|
+
lockedBy: text("locked_by"),
|
|
26
|
+
lockedUntil: integer("locked_until"),
|
|
27
|
+
recoveryAttempts: integer("recovery_attempts"),
|
|
28
|
+
tags: text("tags", {
|
|
29
|
+
mode: "json"
|
|
30
|
+
}).$type(),
|
|
31
|
+
searchAttributes: text("search_attributes", {
|
|
32
|
+
mode: "json"
|
|
33
|
+
}).$type(),
|
|
34
|
+
createdAt: integer("created_at").notNull(),
|
|
35
|
+
updatedAt: integer("updated_at").notNull()
|
|
36
|
+
});
|
|
37
|
+
var stepCheckpoints = sqliteTable("durable_step_checkpoints", {
|
|
38
|
+
runId: text("run_id").notNull(),
|
|
39
|
+
seq: integer("seq").notNull(),
|
|
40
|
+
name: text("name").notNull(),
|
|
41
|
+
kind: text("kind").notNull(),
|
|
42
|
+
stepId: text("step_id").notNull(),
|
|
43
|
+
status: text("status").notNull(),
|
|
44
|
+
input: text("input", {
|
|
45
|
+
mode: "json"
|
|
46
|
+
}),
|
|
47
|
+
output: text("output", {
|
|
48
|
+
mode: "json"
|
|
49
|
+
}),
|
|
50
|
+
error: text("error", {
|
|
51
|
+
mode: "json"
|
|
52
|
+
}),
|
|
53
|
+
events: text("events", {
|
|
54
|
+
mode: "json"
|
|
55
|
+
}),
|
|
56
|
+
attempts: integer("attempts").notNull(),
|
|
57
|
+
workerGroup: text("worker_group"),
|
|
58
|
+
wakeAt: integer("wake_at"),
|
|
59
|
+
enqueuedAt: integer("enqueued_at"),
|
|
60
|
+
startedAt: integer("started_at").notNull(),
|
|
61
|
+
finishedAt: integer("finished_at").notNull()
|
|
62
|
+
}, (t) => [
|
|
63
|
+
primaryKey({
|
|
64
|
+
columns: [
|
|
65
|
+
t.runId,
|
|
66
|
+
t.seq
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
]);
|
|
70
|
+
var runAttributes = sqliteTable("durable_run_attributes", {
|
|
71
|
+
runId: text("run_id").notNull(),
|
|
72
|
+
key: text("key").notNull(),
|
|
73
|
+
strValue: text("str_value"),
|
|
74
|
+
numValue: real("num_value")
|
|
75
|
+
}, (t) => [
|
|
76
|
+
primaryKey({
|
|
77
|
+
columns: [
|
|
78
|
+
t.runId,
|
|
79
|
+
t.key
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
]);
|
|
83
|
+
var signalWaiters = sqliteTable("durable_signal_waiters", {
|
|
84
|
+
token: text("token").primaryKey(),
|
|
85
|
+
runId: text("run_id").notNull(),
|
|
86
|
+
seq: integer("seq").notNull()
|
|
87
|
+
});
|
|
88
|
+
var bufferedSignals = sqliteTable("durable_buffered_signals", {
|
|
89
|
+
id: integer("id").primaryKey({
|
|
90
|
+
autoIncrement: true
|
|
91
|
+
}),
|
|
92
|
+
token: text("token").notNull(),
|
|
93
|
+
payload: text("payload", {
|
|
94
|
+
mode: "json"
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
var durableSchema = {
|
|
98
|
+
workflowRuns,
|
|
99
|
+
stepCheckpoints,
|
|
100
|
+
runAttributes,
|
|
101
|
+
signalWaiters,
|
|
102
|
+
bufferedSignals
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/drizzle-state-store.ts
|
|
106
|
+
var DrizzleStateStore = class {
|
|
107
|
+
static {
|
|
108
|
+
__name(this, "DrizzleStateStore");
|
|
109
|
+
}
|
|
110
|
+
db;
|
|
111
|
+
constructor(db) {
|
|
112
|
+
this.db = db;
|
|
113
|
+
}
|
|
114
|
+
async createRun(run) {
|
|
115
|
+
await this.db.insert(workflowRuns).values(toRunRow(run));
|
|
116
|
+
await this.reindexAttributes(run.id, run.searchAttributes);
|
|
117
|
+
}
|
|
118
|
+
async updateRun(runId, patch) {
|
|
119
|
+
const row = toRunPatch(patch);
|
|
120
|
+
if (Object.keys(row).length) await this.db.update(workflowRuns).set(row).where(eq(workflowRuns.id, runId));
|
|
121
|
+
if ("searchAttributes" in patch) await this.reindexAttributes(runId, patch.searchAttributes);
|
|
122
|
+
}
|
|
123
|
+
/** Rewrite a run's normalized attribute rows: delete the old set, insert the current one. Mirrors
|
|
124
|
+
* the in-memory store's reindex so the side-table always reflects the run's live searchAttributes. */
|
|
125
|
+
async reindexAttributes(runId, attributes) {
|
|
126
|
+
await this.db.delete(runAttributes).where(eq(runAttributes.runId, runId));
|
|
127
|
+
const rows = normalizeAttributeRows(runId, attributes);
|
|
128
|
+
if (rows.length) await this.db.insert(runAttributes).values(rows);
|
|
129
|
+
}
|
|
130
|
+
async getRun(runId) {
|
|
131
|
+
const rows = await this.db.select().from(workflowRuns).where(eq(workflowRuns.id, runId)).limit(1);
|
|
132
|
+
return rows[0] ? fromRunRow(rows[0]) : null;
|
|
133
|
+
}
|
|
134
|
+
async getCheckpoint(runId, seq) {
|
|
135
|
+
const rows = await this.db.select().from(stepCheckpoints).where(and(eq(stepCheckpoints.runId, runId), eq(stepCheckpoints.seq, seq))).limit(1);
|
|
136
|
+
return rows[0] ? fromCheckpointRow(rows[0]) : null;
|
|
137
|
+
}
|
|
138
|
+
async saveCheckpoint(checkpoint) {
|
|
139
|
+
const row = toCheckpointRow(checkpoint);
|
|
140
|
+
await this.db.insert(stepCheckpoints).values(row).onConflictDoUpdate({
|
|
141
|
+
target: [
|
|
142
|
+
stepCheckpoints.runId,
|
|
143
|
+
stepCheckpoints.seq
|
|
144
|
+
],
|
|
145
|
+
set: row
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async transaction(work) {
|
|
149
|
+
return this.db.transaction(async (tx) => work({
|
|
150
|
+
raw: tx,
|
|
151
|
+
saveCheckpoint: /* @__PURE__ */ __name(async (cp) => {
|
|
152
|
+
const row = toCheckpointRow(cp);
|
|
153
|
+
await tx.insert(stepCheckpoints).values(row).onConflictDoUpdate({
|
|
154
|
+
target: [
|
|
155
|
+
stepCheckpoints.runId,
|
|
156
|
+
stepCheckpoints.seq
|
|
157
|
+
],
|
|
158
|
+
set: row
|
|
159
|
+
});
|
|
160
|
+
}, "saveCheckpoint")
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
async listIncompleteRuns() {
|
|
164
|
+
const rows = await this.db.select().from(workflowRuns).where(eq(workflowRuns.status, "running"));
|
|
165
|
+
return rows.map(fromRunRow);
|
|
166
|
+
}
|
|
167
|
+
async listPendingRuns(limit) {
|
|
168
|
+
const rows = await this.db.select().from(workflowRuns).where(eq(workflowRuns.status, "pending")).orderBy(asc(workflowRuns.createdAt)).limit(limit);
|
|
169
|
+
return rows.map(fromRunRow);
|
|
170
|
+
}
|
|
171
|
+
async listDueTimers(nowMs) {
|
|
172
|
+
const rows = await this.db.select().from(workflowRuns).where(and(eq(workflowRuns.status, "suspended"), isNotNull(workflowRuns.wakeAt), lte(workflowRuns.wakeAt, nowMs)));
|
|
173
|
+
return rows.map(fromRunRow);
|
|
174
|
+
}
|
|
175
|
+
async tryLockRun(runId, owner, leaseUntilMs, nowMs) {
|
|
176
|
+
const result = await this.db.update(workflowRuns).set({
|
|
177
|
+
lockedBy: owner,
|
|
178
|
+
lockedUntil: leaseUntilMs
|
|
179
|
+
}).where(and(eq(workflowRuns.id, runId), or(isNull(workflowRuns.lockedUntil), lte(workflowRuns.lockedUntil, nowMs))));
|
|
180
|
+
return result.changes === 1;
|
|
181
|
+
}
|
|
182
|
+
async releaseRunLock(runId) {
|
|
183
|
+
await this.db.update(workflowRuns).set({
|
|
184
|
+
lockedBy: null,
|
|
185
|
+
lockedUntil: null
|
|
186
|
+
}).where(eq(workflowRuns.id, runId));
|
|
187
|
+
}
|
|
188
|
+
async renewRunLock(runId, owner, leaseUntilMs) {
|
|
189
|
+
const result = await this.db.update(workflowRuns).set({
|
|
190
|
+
lockedUntil: leaseUntilMs
|
|
191
|
+
}).where(and(eq(workflowRuns.id, runId), eq(workflowRuns.lockedBy, owner)));
|
|
192
|
+
return result.changes === 1;
|
|
193
|
+
}
|
|
194
|
+
async listRuns(query) {
|
|
195
|
+
const filters = [
|
|
196
|
+
query.workflow ? eq(workflowRuns.workflow, query.workflow) : void 0,
|
|
197
|
+
query.status ? eq(workflowRuns.status, query.status) : void 0,
|
|
198
|
+
// `status IN (...)`; an empty set matches nothing (mirrors the in-memory store).
|
|
199
|
+
query.statuses ? query.statuses.length ? inArray(workflowRuns.status, query.statuses) : sql`1 = 0` : void 0,
|
|
200
|
+
// `tags` is JSON text; match the quoted token so `etl` doesn't match `etl-foo`.
|
|
201
|
+
query.tag ? like(workflowRuns.tags, `%"${query.tag}"%`) : void 0,
|
|
202
|
+
// Typed/range attribute predicates push DOWN into SQL: each filter becomes an EXISTS against
|
|
203
|
+
// the normalized `durable_run_attributes` side-table, so the DB filters AND paginates — no
|
|
204
|
+
// full scan + in-process filter. ANDed: a run must satisfy every filter (one EXISTS per filter).
|
|
205
|
+
...query.attributes?.map((f) => this.attributeExists(f)) ?? []
|
|
206
|
+
].filter((f) => f !== void 0);
|
|
207
|
+
const rows = await this.db.select().from(workflowRuns).where(filters.length ? and(...filters) : void 0).orderBy(desc(workflowRuns.createdAt)).limit(query.limit ?? -1).offset(query.offset ?? 0);
|
|
208
|
+
return rows.map(fromRunRow);
|
|
209
|
+
}
|
|
210
|
+
/** One attribute predicate as an EXISTS subquery on the side-table, correlated to the outer run.
|
|
211
|
+
* `<>` (ne) also excludes runs where the attribute is absent (the missing-key-never-matches
|
|
212
|
+
* contract): EXISTS already requires the key row to be present, so EXISTS(... <> ...) is exactly
|
|
213
|
+
* ne-with-present. Numeric operands compare `num_value`, everything else `str_value`. */
|
|
214
|
+
attributeExists(f) {
|
|
215
|
+
const col = attributeColumnFor(f) === "numValue" ? runAttributes.numValue : runAttributes.strValue;
|
|
216
|
+
const cmp = sqlComparator(f.op);
|
|
217
|
+
return exists(this.db.select({
|
|
218
|
+
one: sql`1`
|
|
219
|
+
}).from(runAttributes).where(and(eq(runAttributes.runId, workflowRuns.id), eq(runAttributes.key, f.key), sql`${col} ${sql.raw(cmp)} ${attributeOperand(f)}`)));
|
|
220
|
+
}
|
|
221
|
+
async listCheckpoints(runId) {
|
|
222
|
+
const rows = await this.db.select().from(stepCheckpoints).where(eq(stepCheckpoints.runId, runId)).orderBy(asc(stepCheckpoints.seq));
|
|
223
|
+
return rows.map(fromCheckpointRow);
|
|
224
|
+
}
|
|
225
|
+
async putSignalWaiter(waiter) {
|
|
226
|
+
await this.db.insert(signalWaiters).values(waiter).onConflictDoUpdate({
|
|
227
|
+
target: signalWaiters.token,
|
|
228
|
+
set: {
|
|
229
|
+
runId: waiter.runId,
|
|
230
|
+
seq: waiter.seq
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
async takeSignalWaiter(token) {
|
|
235
|
+
const rows = await this.db.select().from(signalWaiters).where(eq(signalWaiters.token, token)).limit(1);
|
|
236
|
+
const row = rows[0];
|
|
237
|
+
if (!row) return null;
|
|
238
|
+
await this.db.delete(signalWaiters).where(eq(signalWaiters.token, token));
|
|
239
|
+
return {
|
|
240
|
+
token: row.token,
|
|
241
|
+
runId: row.runId,
|
|
242
|
+
seq: row.seq
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
async listSignalWaiters(prefix) {
|
|
246
|
+
const rows = await this.db.select().from(signalWaiters).where(like(signalWaiters.token, `${prefix}%`));
|
|
247
|
+
return rows.map((r) => ({
|
|
248
|
+
token: r.token,
|
|
249
|
+
runId: r.runId,
|
|
250
|
+
seq: r.seq
|
|
251
|
+
}));
|
|
252
|
+
}
|
|
253
|
+
async bufferSignal(token, payload) {
|
|
254
|
+
await this.db.insert(bufferedSignals).values({
|
|
255
|
+
token,
|
|
256
|
+
payload: payload ?? null
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
async takeBufferedSignal(token) {
|
|
260
|
+
const rows = await this.db.select().from(bufferedSignals).where(eq(bufferedSignals.token, token)).orderBy(asc(bufferedSignals.id)).limit(1);
|
|
261
|
+
const row = rows[0];
|
|
262
|
+
if (!row) return null;
|
|
263
|
+
await this.db.delete(bufferedSignals).where(eq(bufferedSignals.id, row.id));
|
|
264
|
+
return {
|
|
265
|
+
payload: row.payload ?? void 0
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
function toRunRow(run) {
|
|
270
|
+
return {
|
|
271
|
+
id: run.id,
|
|
272
|
+
workflow: run.workflow,
|
|
273
|
+
workflowVersion: run.workflowVersion,
|
|
274
|
+
status: run.status,
|
|
275
|
+
input: run.input ?? null,
|
|
276
|
+
output: run.output ?? null,
|
|
277
|
+
error: run.error ?? null,
|
|
278
|
+
wakeAt: run.wakeAt ?? null,
|
|
279
|
+
lockedBy: run.lockedBy ?? null,
|
|
280
|
+
lockedUntil: run.lockedUntil ?? null,
|
|
281
|
+
recoveryAttempts: run.recoveryAttempts ?? null,
|
|
282
|
+
tags: run.tags ?? null,
|
|
283
|
+
searchAttributes: run.searchAttributes ?? null,
|
|
284
|
+
createdAt: run.createdAt.getTime(),
|
|
285
|
+
updatedAt: run.updatedAt.getTime()
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
__name(toRunRow, "toRunRow");
|
|
289
|
+
function toRunPatch(patch) {
|
|
290
|
+
const row = {};
|
|
291
|
+
if (patch.status !== void 0) row.status = patch.status;
|
|
292
|
+
if (patch.output !== void 0) row.output = patch.output ?? null;
|
|
293
|
+
if (patch.error !== void 0) row.error = patch.error ?? null;
|
|
294
|
+
if (patch.wakeAt !== void 0) row.wakeAt = patch.wakeAt ?? null;
|
|
295
|
+
if (patch.recoveryAttempts !== void 0) row.recoveryAttempts = patch.recoveryAttempts ?? null;
|
|
296
|
+
if ("searchAttributes" in patch) row.searchAttributes = patch.searchAttributes ?? null;
|
|
297
|
+
if (patch.updatedAt !== void 0) row.updatedAt = patch.updatedAt.getTime();
|
|
298
|
+
return row;
|
|
299
|
+
}
|
|
300
|
+
__name(toRunPatch, "toRunPatch");
|
|
301
|
+
function fromRunRow(row) {
|
|
302
|
+
return {
|
|
303
|
+
id: row.id,
|
|
304
|
+
workflow: row.workflow,
|
|
305
|
+
workflowVersion: row.workflowVersion,
|
|
306
|
+
status: row.status,
|
|
307
|
+
input: row.input ?? void 0,
|
|
308
|
+
output: row.output ?? void 0,
|
|
309
|
+
error: row.error ?? void 0,
|
|
310
|
+
wakeAt: row.wakeAt ?? void 0,
|
|
311
|
+
lockedBy: row.lockedBy ?? void 0,
|
|
312
|
+
lockedUntil: row.lockedUntil ?? void 0,
|
|
313
|
+
recoveryAttempts: row.recoveryAttempts ?? void 0,
|
|
314
|
+
tags: row.tags ?? void 0,
|
|
315
|
+
searchAttributes: row.searchAttributes ?? void 0,
|
|
316
|
+
createdAt: new Date(row.createdAt),
|
|
317
|
+
updatedAt: new Date(row.updatedAt)
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
__name(fromRunRow, "fromRunRow");
|
|
321
|
+
function toCheckpointRow(cp) {
|
|
322
|
+
return {
|
|
323
|
+
runId: cp.runId,
|
|
324
|
+
seq: cp.seq,
|
|
325
|
+
name: cp.name,
|
|
326
|
+
kind: cp.kind,
|
|
327
|
+
stepId: cp.stepId,
|
|
328
|
+
status: cp.status,
|
|
329
|
+
input: cp.input ?? null,
|
|
330
|
+
output: cp.output ?? null,
|
|
331
|
+
error: cp.error ?? null,
|
|
332
|
+
events: cp.events ?? null,
|
|
333
|
+
attempts: cp.attempts,
|
|
334
|
+
workerGroup: cp.workerGroup ?? null,
|
|
335
|
+
wakeAt: cp.wakeAt ?? null,
|
|
336
|
+
enqueuedAt: (cp.enqueuedAt ?? cp.startedAt).getTime(),
|
|
337
|
+
startedAt: cp.startedAt.getTime(),
|
|
338
|
+
finishedAt: cp.finishedAt.getTime()
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
__name(toCheckpointRow, "toCheckpointRow");
|
|
342
|
+
function fromCheckpointRow(row) {
|
|
343
|
+
return {
|
|
344
|
+
runId: row.runId,
|
|
345
|
+
seq: row.seq,
|
|
346
|
+
name: row.name,
|
|
347
|
+
kind: row.kind,
|
|
348
|
+
stepId: row.stepId,
|
|
349
|
+
status: row.status,
|
|
350
|
+
input: row.input ?? void 0,
|
|
351
|
+
output: row.output ?? void 0,
|
|
352
|
+
error: row.error ?? void 0,
|
|
353
|
+
events: row.events ?? void 0,
|
|
354
|
+
attempts: row.attempts,
|
|
355
|
+
workerGroup: row.workerGroup ?? void 0,
|
|
356
|
+
wakeAt: row.wakeAt ?? void 0,
|
|
357
|
+
enqueuedAt: row.enqueuedAt == null ? new Date(row.startedAt) : new Date(row.enqueuedAt),
|
|
358
|
+
startedAt: new Date(row.startedAt),
|
|
359
|
+
finishedAt: new Date(row.finishedAt)
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
__name(fromCheckpointRow, "fromCheckpointRow");
|
|
363
|
+
export {
|
|
364
|
+
DrizzleStateStore,
|
|
365
|
+
bufferedSignals,
|
|
366
|
+
durableSchema,
|
|
367
|
+
runAttributes,
|
|
368
|
+
signalWaiters,
|
|
369
|
+
stepCheckpoints,
|
|
370
|
+
workflowRuns
|
|
15
371
|
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./drizzle-state-store"), exports);
|
|
18
|
-
__exportStar(require("./schema"), exports);
|
|
19
372
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,2CAAyB"}
|
|
1
|
+
{"version":3,"sources":["../src/drizzle-state-store.ts","../src/schema.ts"],"sourcesContent":["import {\n type AttributeFilter,\n type RunQuery,\n type SignalWaiter,\n type StateStore,\n type StepCheckpoint,\n type StepError,\n type StepEvent,\n type WorkflowRun,\n attributeColumnFor,\n attributeOperand,\n normalizeAttributeRows,\n sqlComparator,\n} from '@dudousxd/nestjs-durable-core';\nimport {\n and,\n asc,\n desc,\n eq,\n exists,\n inArray,\n isNotNull,\n isNull,\n like,\n lte,\n or,\n sql,\n} from 'drizzle-orm';\nimport type { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';\nimport {\n bufferedSignals,\n runAttributes,\n signalWaiters,\n stepCheckpoints,\n workflowRuns,\n} from './schema';\n\ntype RunRow = typeof workflowRuns.$inferSelect;\ntype CheckpointRow = typeof stepCheckpoints.$inferSelect;\ntype DrizzleSqlite = BaseSQLiteDatabase<'sync' | 'async', unknown>;\n\n/**\n * Drizzle (SQLite / libSQL) `StateStore`. Pass a drizzle db built with `./schema`. Timestamps are\n * epoch-ms integers (SQLite's 64-bit integers hold them fine). For Postgres or MySQL, use the\n * MikroORM, TypeORM or Prisma adapter.\n */\nexport class DrizzleStateStore implements StateStore {\n constructor(private readonly db: DrizzleSqlite) {}\n\n async createRun(run: WorkflowRun): Promise<void> {\n await this.db.insert(workflowRuns).values(toRunRow(run));\n await this.reindexAttributes(run.id, run.searchAttributes);\n }\n\n async updateRun(runId: string, patch: Partial<WorkflowRun>): Promise<void> {\n const row = toRunPatch(patch);\n // Drizzle throws on `.set({})`; skip the UPDATE when no mapped column actually changed.\n if (Object.keys(row).length)\n await this.db.update(workflowRuns).set(row).where(eq(workflowRuns.id, runId));\n // Keep the side-table in step with the run's attributes whenever they're patched.\n if ('searchAttributes' in patch) await this.reindexAttributes(runId, patch.searchAttributes);\n }\n\n /** Rewrite a run's normalized attribute rows: delete the old set, insert the current one. Mirrors\n * the in-memory store's reindex so the side-table always reflects the run's live searchAttributes. */\n private async reindexAttributes(\n runId: string,\n attributes: WorkflowRun['searchAttributes'],\n ): Promise<void> {\n await this.db.delete(runAttributes).where(eq(runAttributes.runId, runId));\n const rows = normalizeAttributeRows(runId, attributes);\n if (rows.length) await this.db.insert(runAttributes).values(rows);\n }\n\n async getRun(runId: string): Promise<WorkflowRun | null> {\n const rows = await this.db\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.id, runId))\n .limit(1);\n return rows[0] ? fromRunRow(rows[0]) : null;\n }\n\n async getCheckpoint(runId: string, seq: number): Promise<StepCheckpoint | null> {\n const rows = await this.db\n .select()\n .from(stepCheckpoints)\n .where(and(eq(stepCheckpoints.runId, runId), eq(stepCheckpoints.seq, seq)))\n .limit(1);\n return rows[0] ? fromCheckpointRow(rows[0]) : null;\n }\n\n async saveCheckpoint(checkpoint: StepCheckpoint): Promise<void> {\n const row = toCheckpointRow(checkpoint);\n await this.db\n .insert(stepCheckpoints)\n .values(row)\n .onConflictDoUpdate({ target: [stepCheckpoints.runId, stepCheckpoints.seq], set: row });\n }\n\n async transaction<T>(\n work: (tx: {\n raw: unknown;\n saveCheckpoint: (cp: StepCheckpoint) => Promise<void>;\n }) => Promise<T>,\n ): Promise<T> {\n return this.db.transaction(async (tx) =>\n work({\n raw: tx,\n saveCheckpoint: async (cp) => {\n const row = toCheckpointRow(cp);\n await tx\n .insert(stepCheckpoints)\n .values(row)\n .onConflictDoUpdate({\n target: [stepCheckpoints.runId, stepCheckpoints.seq],\n set: row,\n });\n },\n }),\n );\n }\n\n async listIncompleteRuns(): Promise<WorkflowRun[]> {\n const rows = await this.db\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.status, 'running'));\n return rows.map(fromRunRow);\n }\n\n async listPendingRuns(limit: number): Promise<WorkflowRun[]> {\n const rows = await this.db\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.status, 'pending'))\n .orderBy(asc(workflowRuns.createdAt)) // FIFO dispatch\n .limit(limit);\n return rows.map(fromRunRow);\n }\n\n async listDueTimers(nowMs: number): Promise<WorkflowRun[]> {\n const rows = await this.db\n .select()\n .from(workflowRuns)\n .where(\n and(\n eq(workflowRuns.status, 'suspended'),\n isNotNull(workflowRuns.wakeAt),\n lte(workflowRuns.wakeAt, nowMs),\n ),\n );\n return rows.map(fromRunRow);\n }\n\n async tryLockRun(\n runId: string,\n owner: string,\n leaseUntilMs: number,\n nowMs: number,\n ): Promise<boolean> {\n const result = await this.db\n .update(workflowRuns)\n .set({ lockedBy: owner, lockedUntil: leaseUntilMs })\n .where(\n and(\n eq(workflowRuns.id, runId),\n or(isNull(workflowRuns.lockedUntil), lte(workflowRuns.lockedUntil, nowMs)),\n ),\n );\n return (result as { changes?: number }).changes === 1;\n }\n\n async releaseRunLock(runId: string): Promise<void> {\n await this.db\n .update(workflowRuns)\n .set({ lockedBy: null, lockedUntil: null })\n .where(eq(workflowRuns.id, runId));\n }\n\n async renewRunLock(runId: string, owner: string, leaseUntilMs: number): Promise<boolean> {\n const result = await this.db\n .update(workflowRuns)\n .set({ lockedUntil: leaseUntilMs })\n .where(and(eq(workflowRuns.id, runId), eq(workflowRuns.lockedBy, owner)));\n return (result as { changes?: number }).changes === 1;\n }\n\n async listRuns(query: RunQuery): Promise<WorkflowRun[]> {\n const filters = [\n query.workflow ? eq(workflowRuns.workflow, query.workflow) : undefined,\n query.status ? eq(workflowRuns.status, query.status) : undefined,\n // `status IN (...)`; an empty set matches nothing (mirrors the in-memory store).\n query.statuses\n ? query.statuses.length\n ? inArray(workflowRuns.status, query.statuses)\n : sql`1 = 0`\n : undefined,\n // `tags` is JSON text; match the quoted token so `etl` doesn't match `etl-foo`.\n query.tag ? like(workflowRuns.tags, `%\"${query.tag}\"%`) : undefined,\n // Typed/range attribute predicates push DOWN into SQL: each filter becomes an EXISTS against\n // the normalized `durable_run_attributes` side-table, so the DB filters AND paginates — no\n // full scan + in-process filter. ANDed: a run must satisfy every filter (one EXISTS per filter).\n ...(query.attributes?.map((f) => this.attributeExists(f)) ?? []),\n ].filter((f): f is NonNullable<typeof f> => f !== undefined);\n const rows = await this.db\n .select()\n .from(workflowRuns)\n .where(filters.length ? and(...filters) : undefined)\n .orderBy(desc(workflowRuns.createdAt)) // newest first — recent runs on top in the dashboard\n .limit(query.limit ?? -1)\n .offset(query.offset ?? 0);\n return rows.map(fromRunRow);\n }\n\n /** One attribute predicate as an EXISTS subquery on the side-table, correlated to the outer run.\n * `<>` (ne) also excludes runs where the attribute is absent (the missing-key-never-matches\n * contract): EXISTS already requires the key row to be present, so EXISTS(... <> ...) is exactly\n * ne-with-present. Numeric operands compare `num_value`, everything else `str_value`. */\n private attributeExists(f: AttributeFilter) {\n const col =\n attributeColumnFor(f) === 'numValue' ? runAttributes.numValue : runAttributes.strValue;\n const cmp = sqlComparator(f.op);\n return exists(\n this.db\n .select({ one: sql`1` })\n .from(runAttributes)\n .where(\n and(\n eq(runAttributes.runId, workflowRuns.id),\n eq(runAttributes.key, f.key),\n sql`${col} ${sql.raw(cmp)} ${attributeOperand(f)}`,\n ),\n ),\n );\n }\n\n async listCheckpoints(runId: string): Promise<StepCheckpoint[]> {\n const rows = await this.db\n .select()\n .from(stepCheckpoints)\n .where(eq(stepCheckpoints.runId, runId))\n .orderBy(asc(stepCheckpoints.seq));\n return rows.map(fromCheckpointRow);\n }\n\n async putSignalWaiter(waiter: SignalWaiter): Promise<void> {\n await this.db\n .insert(signalWaiters)\n .values(waiter)\n .onConflictDoUpdate({\n target: signalWaiters.token,\n set: { runId: waiter.runId, seq: waiter.seq },\n });\n }\n\n async takeSignalWaiter(token: string): Promise<SignalWaiter | null> {\n const rows = await this.db\n .select()\n .from(signalWaiters)\n .where(eq(signalWaiters.token, token))\n .limit(1);\n const row = rows[0];\n if (!row) return null;\n await this.db.delete(signalWaiters).where(eq(signalWaiters.token, token));\n return { token: row.token, runId: row.runId, seq: row.seq };\n }\n\n async listSignalWaiters(prefix: string): Promise<SignalWaiter[]> {\n const rows = await this.db\n .select()\n .from(signalWaiters)\n .where(like(signalWaiters.token, `${prefix}%`));\n return rows.map((r) => ({ token: r.token, runId: r.runId, seq: r.seq }));\n }\n\n async bufferSignal(token: string, payload: unknown): Promise<void> {\n await this.db.insert(bufferedSignals).values({ token, payload: payload ?? null });\n }\n\n async takeBufferedSignal(token: string): Promise<{ payload: unknown } | null> {\n const rows = await this.db\n .select()\n .from(bufferedSignals)\n .where(eq(bufferedSignals.token, token))\n .orderBy(asc(bufferedSignals.id))\n .limit(1);\n const row = rows[0];\n if (!row) return null;\n await this.db.delete(bufferedSignals).where(eq(bufferedSignals.id, row.id));\n return { payload: row.payload ?? undefined };\n }\n}\n\nfunction toRunRow(run: WorkflowRun): RunRow {\n return {\n id: run.id,\n workflow: run.workflow,\n workflowVersion: run.workflowVersion,\n status: run.status,\n input: run.input ?? null,\n output: run.output ?? null,\n error: run.error ?? null,\n wakeAt: run.wakeAt ?? null,\n lockedBy: run.lockedBy ?? null,\n lockedUntil: run.lockedUntil ?? null,\n recoveryAttempts: run.recoveryAttempts ?? null,\n tags: run.tags ?? null,\n searchAttributes: run.searchAttributes ?? null,\n createdAt: run.createdAt.getTime(),\n updatedAt: run.updatedAt.getTime(),\n };\n}\n\nfunction toRunPatch(patch: Partial<WorkflowRun>): Partial<RunRow> {\n const row: Partial<RunRow> = {};\n if (patch.status !== undefined) row.status = patch.status;\n if (patch.output !== undefined) row.output = patch.output ?? null;\n if (patch.error !== undefined) row.error = patch.error ?? null;\n if (patch.wakeAt !== undefined) row.wakeAt = patch.wakeAt ?? null;\n if (patch.recoveryAttempts !== undefined) row.recoveryAttempts = patch.recoveryAttempts ?? null;\n if ('searchAttributes' in patch) row.searchAttributes = patch.searchAttributes ?? null;\n if (patch.updatedAt !== undefined) row.updatedAt = patch.updatedAt.getTime();\n return row;\n}\n\nfunction fromRunRow(row: RunRow): WorkflowRun {\n return {\n id: row.id,\n workflow: row.workflow,\n workflowVersion: row.workflowVersion,\n status: row.status as WorkflowRun['status'],\n input: row.input ?? undefined,\n output: row.output ?? undefined,\n error: (row.error ?? undefined) as StepError | undefined,\n wakeAt: row.wakeAt ?? undefined,\n lockedBy: row.lockedBy ?? undefined,\n lockedUntil: row.lockedUntil ?? undefined,\n recoveryAttempts: row.recoveryAttempts ?? undefined,\n tags: row.tags ?? undefined,\n searchAttributes: row.searchAttributes ?? undefined,\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n };\n}\n\nfunction toCheckpointRow(cp: StepCheckpoint): CheckpointRow {\n return {\n runId: cp.runId,\n seq: cp.seq,\n name: cp.name,\n kind: cp.kind,\n stepId: cp.stepId,\n status: cp.status,\n input: cp.input ?? null,\n output: cp.output ?? null,\n error: cp.error ?? null,\n events: cp.events ?? null,\n attempts: cp.attempts,\n workerGroup: cp.workerGroup ?? null,\n wakeAt: cp.wakeAt ?? null,\n enqueuedAt: (cp.enqueuedAt ?? cp.startedAt).getTime(),\n startedAt: cp.startedAt.getTime(),\n finishedAt: cp.finishedAt.getTime(),\n };\n}\n\nfunction fromCheckpointRow(row: CheckpointRow): StepCheckpoint {\n return {\n runId: row.runId,\n seq: row.seq,\n name: row.name,\n kind: row.kind as StepCheckpoint['kind'],\n stepId: row.stepId,\n status: row.status as StepCheckpoint['status'],\n input: row.input ?? undefined,\n output: row.output ?? undefined,\n error: (row.error ?? undefined) as StepError | undefined,\n events: (row.events ?? undefined) as StepEvent[] | undefined,\n attempts: row.attempts,\n workerGroup: row.workerGroup ?? undefined,\n wakeAt: row.wakeAt ?? undefined,\n enqueuedAt: row.enqueuedAt == null ? new Date(row.startedAt) : new Date(row.enqueuedAt),\n startedAt: new Date(row.startedAt),\n finishedAt: new Date(row.finishedAt),\n };\n}\n","import { integer, primaryKey, real, sqliteTable, text } from 'drizzle-orm/sqlite-core';\n\n// SQLite / libSQL schema for the durable tables. Timestamps and `wakeAt` are epoch-ms integers\n// (SQLite has no native date type). Import these tables and pass them with your drizzle db.\n\nexport const workflowRuns = sqliteTable('durable_workflow_runs', {\n id: text('id').primaryKey(),\n workflow: text('workflow').notNull(),\n workflowVersion: text('workflow_version').notNull(),\n status: text('status').notNull(),\n input: text('input', { mode: 'json' }),\n output: text('output', { mode: 'json' }),\n error: text('error', { mode: 'json' }),\n wakeAt: integer('wake_at'),\n lockedBy: text('locked_by'),\n lockedUntil: integer('locked_until'),\n recoveryAttempts: integer('recovery_attempts'),\n tags: text('tags', { mode: 'json' }).$type<string[]>(),\n searchAttributes: text('search_attributes', { mode: 'json' }).$type<\n Record<string, string | number | boolean>\n >(),\n createdAt: integer('created_at').notNull(),\n updatedAt: integer('updated_at').notNull(),\n});\n\nexport const stepCheckpoints = sqliteTable(\n 'durable_step_checkpoints',\n {\n runId: text('run_id').notNull(),\n seq: integer('seq').notNull(),\n name: text('name').notNull(),\n kind: text('kind').notNull(),\n stepId: text('step_id').notNull(),\n status: text('status').notNull(),\n input: text('input', { mode: 'json' }),\n output: text('output', { mode: 'json' }),\n error: text('error', { mode: 'json' }),\n events: text('events', { mode: 'json' }),\n attempts: integer('attempts').notNull(),\n workerGroup: text('worker_group'),\n wakeAt: integer('wake_at'),\n enqueuedAt: integer('enqueued_at'),\n startedAt: integer('started_at').notNull(),\n finishedAt: integer('finished_at').notNull(),\n },\n (t) => [primaryKey({ columns: [t.runId, t.seq] })],\n);\n\n// Normalized search-attribute side-table: one row per (run, key), so range/equality attribute\n// predicates push DOWN into SQL via an EXISTS join instead of a coarse scan + in-process filter.\n// Maintained on every createRun/updateRun. Numbers land in `numValue`, strings/booleans in\n// `strValue` (booleans as \"true\"/\"false\"); see core `normalizeAttributeRows`.\nexport const runAttributes = sqliteTable(\n 'durable_run_attributes',\n {\n runId: text('run_id').notNull(),\n key: text('key').notNull(),\n strValue: text('str_value'),\n numValue: real('num_value'),\n },\n (t) => [primaryKey({ columns: [t.runId, t.key] })],\n);\n\nexport const signalWaiters = sqliteTable('durable_signal_waiters', {\n token: text('token').primaryKey(),\n runId: text('run_id').notNull(),\n seq: integer('seq').notNull(),\n});\n\nexport const bufferedSignals = sqliteTable('durable_buffered_signals', {\n id: integer('id').primaryKey({ autoIncrement: true }),\n token: text('token').notNull(),\n payload: text('payload', { mode: 'json' }),\n});\n\nexport const durableSchema = {\n workflowRuns,\n st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AAG6E,eAAe;IAC/BlE,QAAQX,GAAGW,UAAU;IACrBmE,aAAa9E,GAAG8E,cAAc9E,GAAG+E,WAAWV,QAAO;IACnDU,WAAW/E,GAAG+E,UAAUV,QAAO;IAC/BW,YAAYhF,GAAGgF,WAAWX,QAAO;EACnC;AACF;AAnBS5E;AAqBT,SAASH,kBAAkBvB,KAAkB;AAC3C,SAAO;IACLF,OAAOE,IAAIF;IACXsB,KAAKpB,IAAIoB;IACTqF,MAAMzG,IAAIyG;IACVC,MAAM1G,IAAI0G;IACVC,QAAQ3G,IAAI2G;IACZxE,QAAQnC,IAAImC;IACZ+D,OAAOlG,IAAIkG,SAASrC;IACpBsC,QAAQnG,IAAImG,UAAUtC;IACtBuC,OAAQpG,IAAIoG,SAASvC;IACrB+C,QAAS5G,IAAI4G,UAAU/C;IACvBgD,UAAU7G,IAAI6G;IACdC,aAAa9G,IAAI8G,eAAejD;IAChCjB,QAAQ5C,IAAI4C,UAAUiB;IACtBkD,YAAY/G,IAAI+G,cAAc,OAAO,IAAIP,KAAKxG,IAAIgH,SAAS,IAAI,IAAIR,KAAKxG,IAAI+G,UAAU;IACtFC,WAAW,IAAIR,KAAKxG,IAAIgH,SAAS;IACjCC,YAAY,IAAIT,KAAKxG,IAAIiH,UAAU;EACrC;AACF;AAnBS1F;","names":["attributeColumnFor","attributeOperand","normalizeAttributeRows","sqlComparator","and","asc","desc","eq","exists","inArray","isNotNull","isNull","like","lte","or","sql","integer","primaryKey","real","sqliteTable","text","workflowRuns","id","workflow","notNull","workflowVersion","status","input","mode","output","error","wakeAt","lockedBy","lockedUntil","recoveryAttempts","tags","$type","searchAttributes","createdAt","updatedAt","stepCheckpoints","runId","seq","name","kind","stepId","events","attempts","workerGroup","enqueuedAt","startedAt","finishedAt","t","columns","runAttributes","key","strValue","numValue","signalWaiters","token","bufferedSignals","autoIncrement","payload","durableSchema","DrizzleStateStore","db","createRun","run","insert","workflowRuns","values","toRunRow","reindexAttributes","id","searchAttributes","updateRun","runId","patch","row","toRunPatch","Object","keys","length","update","set","where","eq","attributes","delete","runAttributes","rows","normalizeAttributeRows","getRun","select","from","limit","fromRunRow","getCheckpoint","seq","stepCheckpoints","and","fromCheckpointRow","saveCheckpoint","checkpoint","toCheckpointRow","onConflictDoUpdate","target","transaction","work","tx","raw","cp","listIncompleteRuns","status","map","listPendingRuns","orderBy","asc","createdAt","listDueTimers","nowMs","isNotNull","wakeAt","lte","tryLockRun","owner","leaseUntilMs","result","lockedBy","lockedUntil","or","isNull","changes","releaseRunLock","renewRunLock","listRuns","query","filters","workflow","undefined","statuses","inArray","sql","tag","like","tags","f","attributeExists","filter","desc","offset","col","attributeColumnFor","numValue","strValue","cmp","sqlComparator","op","exists","one","key","attributeOperand","listCheckpoints","putSignalWaiter","waiter","signalWaiters","token","takeSignalWaiter","listSignalWaiters","prefix","r","bufferSignal","payload","bufferedSignals","takeBufferedSignal","workflowVersion","input","output","error","recoveryAttempts","getTime","updatedAt","Date","name","kind","stepId","events","attempts","workerGroup","enqueuedAt","startedAt","finishedAt"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-durable-store-drizzle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Drizzle ORM (SQLite/libSQL) adapter for the nestjs-durable StateStore",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Davide Carvalho",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"url": "https://github.com/DavideCarvalho/nestjs-durable.git",
|
|
10
10
|
"directory": "packages/store-drizzle"
|
|
11
11
|
},
|
|
12
|
-
"type": "
|
|
13
|
-
"main": "dist/index.
|
|
14
|
-
"types": "dist/index.d.ts",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
@@ -24,10 +24,25 @@
|
|
|
24
24
|
"better-sqlite3": "11.10.0",
|
|
25
25
|
"drizzle-orm": "0.44.7",
|
|
26
26
|
"typescript": "5.9.3",
|
|
27
|
-
"
|
|
27
|
+
"tsup": "8.3.5",
|
|
28
|
+
"@dudousxd/nestjs-durable-core": "^0.28.0",
|
|
29
|
+
"@dudousxd/nestjs-durable-testing": "^0.4.0"
|
|
30
|
+
},
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/index.d.cts",
|
|
40
|
+
"default": "./dist/index.cjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
28
43
|
},
|
|
29
44
|
"scripts": {
|
|
30
|
-
"build": "
|
|
45
|
+
"build": "tsup",
|
|
31
46
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
32
47
|
}
|
|
33
48
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type RunQuery, type SignalWaiter, type StateStore, type StepCheckpoint, type WorkflowRun } from '@dudousxd/nestjs-durable-core';
|
|
2
|
-
import type { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
3
|
-
type DrizzleSqlite = BaseSQLiteDatabase<'sync' | 'async', unknown>;
|
|
4
|
-
/**
|
|
5
|
-
* Drizzle (SQLite / libSQL) `StateStore`. Pass a drizzle db built with `./schema`. Timestamps are
|
|
6
|
-
* epoch-ms integers (SQLite's 64-bit integers hold them fine). For Postgres or MySQL, use the
|
|
7
|
-
* MikroORM, TypeORM or Prisma adapter.
|
|
8
|
-
*/
|
|
9
|
-
export declare class DrizzleStateStore implements StateStore {
|
|
10
|
-
private readonly db;
|
|
11
|
-
constructor(db: DrizzleSqlite);
|
|
12
|
-
createRun(run: WorkflowRun): Promise<void>;
|
|
13
|
-
updateRun(runId: string, patch: Partial<WorkflowRun>): Promise<void>;
|
|
14
|
-
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
15
|
-
getCheckpoint(runId: string, seq: number): Promise<StepCheckpoint | null>;
|
|
16
|
-
saveCheckpoint(checkpoint: StepCheckpoint): Promise<void>;
|
|
17
|
-
transaction<T>(work: (tx: {
|
|
18
|
-
raw: unknown;
|
|
19
|
-
saveCheckpoint: (cp: StepCheckpoint) => Promise<void>;
|
|
20
|
-
}) => Promise<T>): Promise<T>;
|
|
21
|
-
listIncompleteRuns(): Promise<WorkflowRun[]>;
|
|
22
|
-
listPendingRuns(limit: number): Promise<WorkflowRun[]>;
|
|
23
|
-
listDueTimers(nowMs: number): Promise<WorkflowRun[]>;
|
|
24
|
-
tryLockRun(runId: string, owner: string, leaseUntilMs: number, nowMs: number): Promise<boolean>;
|
|
25
|
-
releaseRunLock(runId: string): Promise<void>;
|
|
26
|
-
renewRunLock(runId: string, owner: string, leaseUntilMs: number): Promise<boolean>;
|
|
27
|
-
listRuns(query: RunQuery): Promise<WorkflowRun[]>;
|
|
28
|
-
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
29
|
-
putSignalWaiter(waiter: SignalWaiter): Promise<void>;
|
|
30
|
-
takeSignalWaiter(token: string): Promise<SignalWaiter | null>;
|
|
31
|
-
listSignalWaiters(prefix: string): Promise<SignalWaiter[]>;
|
|
32
|
-
bufferSignal(token: string, payload: unknown): Promise<void>;
|
|
33
|
-
takeBufferedSignal(token: string): Promise<{
|
|
34
|
-
payload: unknown;
|
|
35
|
-
} | null>;
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=drizzle-state-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle-state-store.d.ts","sourceRoot":"","sources":["../src/drizzle-state-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,Y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