openworkflow 0.4.0 → 0.4.1
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/README.md +17 -11
- package/dist/backend-sqlite/backend.d.ts +38 -0
- package/dist/backend-sqlite/backend.d.ts.map +1 -0
- package/dist/backend-sqlite/backend.js +628 -0
- package/dist/backend-sqlite/backend.js.map +1 -0
- package/dist/backend-sqlite/index.d.ts +2 -0
- package/dist/backend-sqlite/index.d.ts.map +1 -0
- package/dist/backend-sqlite/index.js +2 -0
- package/dist/backend-sqlite/index.js.map +1 -0
- package/dist/backend-sqlite/sqlite.d.ts +45 -0
- package/dist/backend-sqlite/sqlite.d.ts.map +1 -0
- package/dist/backend-sqlite/sqlite.js +229 -0
- package/dist/backend-sqlite/sqlite.js.map +1 -0
- package/dist/config/config.d.ts +102 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +29 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +41 -0
- package/dist/config.js.map +1 -0
- package/dist/core/backend-test-suite.d.ts +22 -0
- package/dist/core/backend-test-suite.d.ts.map +1 -0
- package/dist/core/backend-test-suite.js +960 -0
- package/dist/core/backend-test-suite.js.map +1 -0
- package/dist/core/backend.d.ts +103 -0
- package/dist/core/backend.d.ts.map +1 -0
- package/dist/core/backend.js +2 -0
- package/dist/core/backend.js.map +1 -0
- package/dist/core/backend.testsuite.d.ts +21 -0
- package/dist/core/backend.testsuite.d.ts.map +1 -0
- package/dist/core/backend.testsuite.js +958 -0
- package/dist/core/backend.testsuite.js.map +1 -0
- package/dist/{duration.d.ts → core/duration.d.ts} +2 -1
- package/dist/core/duration.d.ts.map +1 -0
- package/dist/{duration.js → core/duration.js} +6 -5
- package/dist/core/duration.js.map +1 -0
- package/dist/core/duration.test.d.ts +2 -0
- package/dist/core/duration.test.d.ts.map +1 -0
- package/dist/core/duration.test.js +264 -0
- package/dist/core/duration.test.js.map +1 -0
- package/dist/core/json.d.ts +5 -0
- package/dist/core/json.d.ts.map +1 -0
- package/dist/core/json.js +2 -0
- package/dist/core/json.js.map +1 -0
- package/dist/core/result.d.ts +12 -0
- package/dist/core/result.d.ts.map +1 -0
- package/dist/core/result.js +7 -0
- package/dist/core/result.js.map +1 -0
- package/dist/core/result.test.d.ts +2 -0
- package/dist/core/result.test.d.ts.map +1 -0
- package/dist/core/result.test.js +11 -0
- package/dist/core/result.test.js.map +1 -0
- package/dist/core/retry.d.ts +16 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/{backend.js → core/retry.js} +1 -3
- package/dist/core/retry.js.map +1 -0
- package/dist/core/retry.test.d.ts +2 -0
- package/dist/core/retry.test.d.ts.map +1 -0
- package/dist/core/retry.test.js +36 -0
- package/dist/core/retry.test.js.map +1 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/core/step.d.ts +120 -0
- package/dist/core/step.d.ts.map +1 -0
- package/dist/core/step.js +101 -0
- package/dist/core/step.js.map +1 -0
- package/dist/core/step.test.d.ts +2 -0
- package/dist/core/step.test.d.ts.map +1 -0
- package/dist/core/step.test.js +340 -0
- package/dist/core/step.test.js.map +1 -0
- package/dist/core/workflow.d.ts +108 -0
- package/dist/core/workflow.d.ts.map +1 -0
- package/dist/core/workflow.js +79 -0
- package/dist/core/workflow.js.map +1 -0
- package/dist/core/workflow.test.d.ts +2 -0
- package/dist/core/workflow.test.d.ts.map +1 -0
- package/dist/core/workflow.test.js +216 -0
- package/dist/core/workflow.test.js.map +1 -0
- package/dist/execution/execution.d.ts +91 -0
- package/dist/execution/execution.d.ts.map +1 -0
- package/dist/execution/execution.js +188 -0
- package/dist/execution/execution.js.map +1 -0
- package/dist/execution/execution.test.d.ts +2 -0
- package/dist/execution/execution.test.d.ts.map +1 -0
- package/dist/execution/execution.test.js +382 -0
- package/dist/execution/execution.test.js.map +1 -0
- package/dist/global.d.ts +62 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/global.js +78 -0
- package/dist/global.js.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/sdk/sdk.d.ts +182 -0
- package/dist/sdk/sdk.d.ts.map +1 -0
- package/dist/sdk/sdk.js +208 -0
- package/dist/sdk/sdk.js.map +1 -0
- package/dist/sdk/sdk.test.d.ts +2 -0
- package/dist/sdk/sdk.test.d.ts.map +1 -0
- package/dist/sdk/sdk.test.js +195 -0
- package/dist/sdk/sdk.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{worker.d.ts → worker/worker.d.ts} +3 -3
- package/dist/worker/worker.d.ts.map +1 -0
- package/dist/worker/worker.js +208 -0
- package/dist/worker/worker.js.map +1 -0
- package/dist/worker/worker.test.d.ts +2 -0
- package/dist/worker/worker.test.d.ts.map +1 -0
- package/dist/worker/worker.test.js +786 -0
- package/dist/worker/worker.test.js.map +1 -0
- package/package.json +6 -6
- package/dist/backend.d.ts +0 -173
- package/dist/backend.d.ts.map +0 -1
- package/dist/backend.js.map +0 -1
- package/dist/client.d.ts +0 -153
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -151
- package/dist/client.js.map +0 -1
- package/dist/duration.d.ts.map +0 -1
- package/dist/duration.js.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/worker.d.ts.map +0 -1
- package/dist/worker.js +0 -384
- package/dist/worker.js.map +0 -1
- /package/dist/{schema.d.ts → core/schema.d.ts} +0 -0
- /package/dist/{schema.js → core/schema.js} +0 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { newDatabase, migrate, generateUUID, now, addMilliseconds, toJSON, fromJSON, toISO, fromISO, DEFAULT_DATABASE_PATH, } from "./sqlite.js";
|
|
2
|
+
import { DEFAULT_NAMESPACE_ID, DEFAULT_RETRY_POLICY, } from "../index.js";
|
|
3
|
+
export const DEFAULT_PAGINATION_PAGE_SIZE = 100;
|
|
4
|
+
/**
|
|
5
|
+
* Manages a connection to a SQLite database for workflow operations.
|
|
6
|
+
*/
|
|
7
|
+
export class BackendSqlite {
|
|
8
|
+
db;
|
|
9
|
+
namespaceId;
|
|
10
|
+
constructor(db, namespaceId) {
|
|
11
|
+
this.db = db;
|
|
12
|
+
this.namespaceId = namespaceId;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create and initialize a new BackendSqlite instance. This will
|
|
16
|
+
* automatically run migrations on startup unless `runMigrations` is set to
|
|
17
|
+
* false.
|
|
18
|
+
*/
|
|
19
|
+
static connect(path = DEFAULT_DATABASE_PATH, options) {
|
|
20
|
+
const { namespaceId, runMigrations } = {
|
|
21
|
+
namespaceId: DEFAULT_NAMESPACE_ID,
|
|
22
|
+
runMigrations: true,
|
|
23
|
+
...options,
|
|
24
|
+
};
|
|
25
|
+
const db = newDatabase(path);
|
|
26
|
+
if (runMigrations) {
|
|
27
|
+
migrate(db);
|
|
28
|
+
}
|
|
29
|
+
return new BackendSqlite(db, namespaceId);
|
|
30
|
+
}
|
|
31
|
+
stop() {
|
|
32
|
+
this.db.close();
|
|
33
|
+
}
|
|
34
|
+
async createWorkflowRun(params) {
|
|
35
|
+
const id = generateUUID();
|
|
36
|
+
const currentTime = now();
|
|
37
|
+
const availableAt = params.availableAt
|
|
38
|
+
? toISO(params.availableAt)
|
|
39
|
+
: currentTime;
|
|
40
|
+
const stmt = this.db.prepare(`
|
|
41
|
+
INSERT INTO "workflow_runs" (
|
|
42
|
+
"namespace_id",
|
|
43
|
+
"id",
|
|
44
|
+
"workflow_name",
|
|
45
|
+
"version",
|
|
46
|
+
"status",
|
|
47
|
+
"idempotency_key",
|
|
48
|
+
"config",
|
|
49
|
+
"context",
|
|
50
|
+
"input",
|
|
51
|
+
"attempts",
|
|
52
|
+
"available_at",
|
|
53
|
+
"deadline_at",
|
|
54
|
+
"created_at",
|
|
55
|
+
"updated_at"
|
|
56
|
+
)
|
|
57
|
+
VALUES (?, ?, ?, ?, 'pending', ?, ?, ?, ?, 0, ?, ?, ?, ?)
|
|
58
|
+
`);
|
|
59
|
+
stmt.run(this.namespaceId, id, params.workflowName, params.version, params.idempotencyKey, toJSON(params.config), toJSON(params.context), toJSON(params.input), availableAt, toISO(params.deadlineAt), currentTime, currentTime);
|
|
60
|
+
const workflowRun = await this.getWorkflowRun({ workflowRunId: id });
|
|
61
|
+
if (!workflowRun)
|
|
62
|
+
throw new Error("Failed to create workflow run");
|
|
63
|
+
return workflowRun;
|
|
64
|
+
}
|
|
65
|
+
getWorkflowRun(params) {
|
|
66
|
+
const stmt = this.db.prepare(`
|
|
67
|
+
SELECT *
|
|
68
|
+
FROM "workflow_runs"
|
|
69
|
+
WHERE "namespace_id" = ? AND "id" = ?
|
|
70
|
+
LIMIT 1
|
|
71
|
+
`);
|
|
72
|
+
const row = stmt.get(this.namespaceId, params.workflowRunId);
|
|
73
|
+
return Promise.resolve(row ? rowToWorkflowRun(row) : null);
|
|
74
|
+
}
|
|
75
|
+
async claimWorkflowRun(params) {
|
|
76
|
+
const currentTime = now();
|
|
77
|
+
const newAvailableAt = addMilliseconds(currentTime, params.leaseDurationMs);
|
|
78
|
+
// SQLite doesn't have SKIP LOCKED, so we need to handle claims differently
|
|
79
|
+
this.db.exec("BEGIN IMMEDIATE");
|
|
80
|
+
try {
|
|
81
|
+
// 1. mark any deadline-expired workflow runs as failed
|
|
82
|
+
const expireStmt = this.db.prepare(`
|
|
83
|
+
UPDATE "workflow_runs"
|
|
84
|
+
SET
|
|
85
|
+
"status" = 'failed',
|
|
86
|
+
"error" = ?,
|
|
87
|
+
"worker_id" = NULL,
|
|
88
|
+
"available_at" = NULL,
|
|
89
|
+
"finished_at" = ?,
|
|
90
|
+
"updated_at" = ?
|
|
91
|
+
WHERE "namespace_id" = ?
|
|
92
|
+
AND "status" IN ('pending', 'running', 'sleeping')
|
|
93
|
+
AND "deadline_at" IS NOT NULL
|
|
94
|
+
AND "deadline_at" <= ?
|
|
95
|
+
`);
|
|
96
|
+
expireStmt.run(toJSON({ message: "Workflow run deadline exceeded" }), currentTime, currentTime, this.namespaceId, currentTime);
|
|
97
|
+
// 2. find an available workflow run to claim
|
|
98
|
+
const findStmt = this.db.prepare(`
|
|
99
|
+
SELECT "id"
|
|
100
|
+
FROM "workflow_runs"
|
|
101
|
+
WHERE "namespace_id" = ?
|
|
102
|
+
AND "status" IN ('pending', 'running', 'sleeping')
|
|
103
|
+
AND "available_at" <= ?
|
|
104
|
+
AND ("deadline_at" IS NULL OR "deadline_at" > ?)
|
|
105
|
+
ORDER BY
|
|
106
|
+
CASE WHEN "status" = 'pending' THEN 0 ELSE 1 END,
|
|
107
|
+
"available_at",
|
|
108
|
+
"created_at"
|
|
109
|
+
LIMIT 1
|
|
110
|
+
`);
|
|
111
|
+
const candidate = findStmt.get(this.namespaceId, currentTime, currentTime);
|
|
112
|
+
if (!candidate) {
|
|
113
|
+
this.db.exec("COMMIT");
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
// 3. claim the workflow run
|
|
117
|
+
const claimStmt = this.db.prepare(`
|
|
118
|
+
UPDATE "workflow_runs"
|
|
119
|
+
SET
|
|
120
|
+
"status" = 'running',
|
|
121
|
+
"attempts" = "attempts" + 1,
|
|
122
|
+
"worker_id" = ?,
|
|
123
|
+
"available_at" = ?,
|
|
124
|
+
"started_at" = COALESCE("started_at", ?),
|
|
125
|
+
"updated_at" = ?
|
|
126
|
+
WHERE "id" = ?
|
|
127
|
+
AND "namespace_id" = ?
|
|
128
|
+
`);
|
|
129
|
+
claimStmt.run(params.workerId, newAvailableAt, currentTime, currentTime, candidate.id, this.namespaceId);
|
|
130
|
+
this.db.exec("COMMIT");
|
|
131
|
+
return await this.getWorkflowRun({ workflowRunId: candidate.id });
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
this.db.exec("ROLLBACK");
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async extendWorkflowRunLease(params) {
|
|
139
|
+
const currentTime = now();
|
|
140
|
+
const newAvailableAt = addMilliseconds(currentTime, params.leaseDurationMs);
|
|
141
|
+
const stmt = this.db.prepare(`
|
|
142
|
+
UPDATE "workflow_runs"
|
|
143
|
+
SET
|
|
144
|
+
"available_at" = ?,
|
|
145
|
+
"updated_at" = ?
|
|
146
|
+
WHERE "namespace_id" = ?
|
|
147
|
+
AND "id" = ?
|
|
148
|
+
AND "status" = 'running'
|
|
149
|
+
AND "worker_id" = ?
|
|
150
|
+
`);
|
|
151
|
+
const result = stmt.run(newAvailableAt, currentTime, this.namespaceId, params.workflowRunId, params.workerId);
|
|
152
|
+
if (result.changes === 0) {
|
|
153
|
+
throw new Error("Failed to extend lease for workflow run");
|
|
154
|
+
}
|
|
155
|
+
const updated = await this.getWorkflowRun({
|
|
156
|
+
workflowRunId: params.workflowRunId,
|
|
157
|
+
});
|
|
158
|
+
if (!updated)
|
|
159
|
+
throw new Error("Failed to extend lease for workflow run");
|
|
160
|
+
return updated;
|
|
161
|
+
}
|
|
162
|
+
async sleepWorkflowRun(params) {
|
|
163
|
+
const currentTime = now();
|
|
164
|
+
const stmt = this.db.prepare(`
|
|
165
|
+
UPDATE "workflow_runs"
|
|
166
|
+
SET
|
|
167
|
+
"status" = 'sleeping',
|
|
168
|
+
"available_at" = ?,
|
|
169
|
+
"worker_id" = NULL,
|
|
170
|
+
"updated_at" = ?
|
|
171
|
+
WHERE "namespace_id" = ?
|
|
172
|
+
AND "id" = ?
|
|
173
|
+
AND "status" NOT IN ('completed', 'failed', 'canceled')
|
|
174
|
+
AND "worker_id" = ?
|
|
175
|
+
`);
|
|
176
|
+
const result = stmt.run(toISO(params.availableAt), currentTime, this.namespaceId, params.workflowRunId, params.workerId);
|
|
177
|
+
if (result.changes === 0) {
|
|
178
|
+
throw new Error("Failed to sleep workflow run");
|
|
179
|
+
}
|
|
180
|
+
const updated = await this.getWorkflowRun({
|
|
181
|
+
workflowRunId: params.workflowRunId,
|
|
182
|
+
});
|
|
183
|
+
if (!updated)
|
|
184
|
+
throw new Error("Failed to sleep workflow run");
|
|
185
|
+
return updated;
|
|
186
|
+
}
|
|
187
|
+
async completeWorkflowRun(params) {
|
|
188
|
+
const currentTime = now();
|
|
189
|
+
const stmt = this.db.prepare(`
|
|
190
|
+
UPDATE "workflow_runs"
|
|
191
|
+
SET
|
|
192
|
+
"status" = 'completed',
|
|
193
|
+
"output" = ?,
|
|
194
|
+
"error" = NULL,
|
|
195
|
+
"worker_id" = ?,
|
|
196
|
+
"available_at" = NULL,
|
|
197
|
+
"finished_at" = ?,
|
|
198
|
+
"updated_at" = ?
|
|
199
|
+
WHERE "namespace_id" = ?
|
|
200
|
+
AND "id" = ?
|
|
201
|
+
AND "status" = 'running'
|
|
202
|
+
AND "worker_id" = ?
|
|
203
|
+
`);
|
|
204
|
+
const result = stmt.run(toJSON(params.output), params.workerId, currentTime, currentTime, this.namespaceId, params.workflowRunId, params.workerId);
|
|
205
|
+
if (result.changes === 0) {
|
|
206
|
+
throw new Error("Failed to mark workflow run completed");
|
|
207
|
+
}
|
|
208
|
+
const updated = await this.getWorkflowRun({
|
|
209
|
+
workflowRunId: params.workflowRunId,
|
|
210
|
+
});
|
|
211
|
+
if (!updated)
|
|
212
|
+
throw new Error("Failed to mark workflow run completed");
|
|
213
|
+
return updated;
|
|
214
|
+
}
|
|
215
|
+
async failWorkflowRun(params) {
|
|
216
|
+
const { workflowRunId, error } = params;
|
|
217
|
+
const { initialIntervalMs, backoffCoefficient, maximumIntervalMs } = DEFAULT_RETRY_POLICY;
|
|
218
|
+
const currentTime = now();
|
|
219
|
+
// Get the current workflow run to access attempts
|
|
220
|
+
const workflowRun = await this.getWorkflowRun({ workflowRunId });
|
|
221
|
+
if (!workflowRun)
|
|
222
|
+
throw new Error("Workflow run not found");
|
|
223
|
+
// Calculate retry delay
|
|
224
|
+
const backoffMs = initialIntervalMs *
|
|
225
|
+
Math.pow(backoffCoefficient, workflowRun.attempts - 1);
|
|
226
|
+
const retryDelayMs = Math.min(backoffMs, maximumIntervalMs);
|
|
227
|
+
// Determine if we should reschedule or permanently fail
|
|
228
|
+
const nextRetryTime = new Date(Date.now() + retryDelayMs);
|
|
229
|
+
const shouldRetry = !workflowRun.deadlineAt || nextRetryTime < workflowRun.deadlineAt;
|
|
230
|
+
const status = shouldRetry ? "pending" : "failed";
|
|
231
|
+
const availableAt = shouldRetry ? nextRetryTime.toISOString() : null;
|
|
232
|
+
const finishedAt = shouldRetry ? null : currentTime;
|
|
233
|
+
const stmt = this.db.prepare(`
|
|
234
|
+
UPDATE "workflow_runs"
|
|
235
|
+
SET
|
|
236
|
+
"status" = ?,
|
|
237
|
+
"available_at" = ?,
|
|
238
|
+
"finished_at" = ?,
|
|
239
|
+
"error" = ?,
|
|
240
|
+
"worker_id" = NULL,
|
|
241
|
+
"started_at" = NULL,
|
|
242
|
+
"updated_at" = ?
|
|
243
|
+
WHERE "namespace_id" = ?
|
|
244
|
+
AND "id" = ?
|
|
245
|
+
AND "status" = 'running'
|
|
246
|
+
AND "worker_id" = ?
|
|
247
|
+
`);
|
|
248
|
+
const result = stmt.run(status, availableAt, finishedAt, toJSON(error), currentTime, this.namespaceId, workflowRunId, params.workerId);
|
|
249
|
+
if (result.changes === 0) {
|
|
250
|
+
throw new Error("Failed to mark workflow run failed");
|
|
251
|
+
}
|
|
252
|
+
const updated = await this.getWorkflowRun({ workflowRunId });
|
|
253
|
+
if (!updated)
|
|
254
|
+
throw new Error("Failed to mark workflow run failed");
|
|
255
|
+
return updated;
|
|
256
|
+
}
|
|
257
|
+
async cancelWorkflowRun(params) {
|
|
258
|
+
const currentTime = now();
|
|
259
|
+
const stmt = this.db.prepare(`
|
|
260
|
+
UPDATE "workflow_runs"
|
|
261
|
+
SET
|
|
262
|
+
"status" = 'canceled',
|
|
263
|
+
"worker_id" = NULL,
|
|
264
|
+
"available_at" = NULL,
|
|
265
|
+
"finished_at" = ?,
|
|
266
|
+
"updated_at" = ?
|
|
267
|
+
WHERE "namespace_id" = ?
|
|
268
|
+
AND "id" = ?
|
|
269
|
+
AND "status" IN ('pending', 'running', 'sleeping')
|
|
270
|
+
`);
|
|
271
|
+
const result = stmt.run(currentTime, currentTime, this.namespaceId, params.workflowRunId);
|
|
272
|
+
if (result.changes === 0) {
|
|
273
|
+
// workflow may already be in a terminal state
|
|
274
|
+
const existing = await this.getWorkflowRun({
|
|
275
|
+
workflowRunId: params.workflowRunId,
|
|
276
|
+
});
|
|
277
|
+
if (!existing) {
|
|
278
|
+
throw new Error(`Workflow run ${params.workflowRunId} does not exist`);
|
|
279
|
+
}
|
|
280
|
+
// if already canceled, just return it
|
|
281
|
+
if (existing.status === "canceled") {
|
|
282
|
+
return existing;
|
|
283
|
+
}
|
|
284
|
+
// throw error for completed/failed workflows
|
|
285
|
+
if (["completed", "failed"].includes(existing.status)) {
|
|
286
|
+
throw new Error(`Cannot cancel workflow run ${params.workflowRunId} with status ${existing.status}`);
|
|
287
|
+
}
|
|
288
|
+
throw new Error("Failed to cancel workflow run");
|
|
289
|
+
}
|
|
290
|
+
const updated = await this.getWorkflowRun({
|
|
291
|
+
workflowRunId: params.workflowRunId,
|
|
292
|
+
});
|
|
293
|
+
if (!updated)
|
|
294
|
+
throw new Error("Failed to cancel workflow run");
|
|
295
|
+
return updated;
|
|
296
|
+
}
|
|
297
|
+
listWorkflowRuns(params) {
|
|
298
|
+
const limit = params.limit ?? DEFAULT_PAGINATION_PAGE_SIZE;
|
|
299
|
+
const { after, before } = params;
|
|
300
|
+
let cursor = null;
|
|
301
|
+
if (after) {
|
|
302
|
+
cursor = decodeCursor(after);
|
|
303
|
+
}
|
|
304
|
+
else if (before) {
|
|
305
|
+
cursor = decodeCursor(before);
|
|
306
|
+
}
|
|
307
|
+
const order = before
|
|
308
|
+
? `ORDER BY "created_at" DESC, "id" DESC`
|
|
309
|
+
: `ORDER BY "created_at" ASC, "id" ASC`;
|
|
310
|
+
let query;
|
|
311
|
+
let queryParams;
|
|
312
|
+
if (cursor) {
|
|
313
|
+
const op = after ? ">" : "<";
|
|
314
|
+
query = `
|
|
315
|
+
SELECT *
|
|
316
|
+
FROM "workflow_runs"
|
|
317
|
+
WHERE "namespace_id" = ?
|
|
318
|
+
AND ("created_at", "id") ${op} (?, ?)
|
|
319
|
+
${order}
|
|
320
|
+
LIMIT ?
|
|
321
|
+
`;
|
|
322
|
+
queryParams = [
|
|
323
|
+
this.namespaceId,
|
|
324
|
+
cursor.createdAt.toISOString(),
|
|
325
|
+
cursor.id,
|
|
326
|
+
limit + 1,
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
query = `
|
|
331
|
+
SELECT *
|
|
332
|
+
FROM "workflow_runs"
|
|
333
|
+
WHERE "namespace_id" = ?
|
|
334
|
+
${order}
|
|
335
|
+
LIMIT ?
|
|
336
|
+
`;
|
|
337
|
+
queryParams = [this.namespaceId, limit + 1];
|
|
338
|
+
}
|
|
339
|
+
const stmt = this.db.prepare(query);
|
|
340
|
+
const rawRows = stmt.all(...queryParams);
|
|
341
|
+
if (!Array.isArray(rawRows)) {
|
|
342
|
+
return Promise.resolve({
|
|
343
|
+
data: [],
|
|
344
|
+
pagination: { next: null, prev: null },
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
const rows = rawRows.map((row) => rowToWorkflowRun(row));
|
|
348
|
+
return Promise.resolve(this.processPaginationResults(rows, limit, !!after, !!before));
|
|
349
|
+
}
|
|
350
|
+
listStepAttempts(params) {
|
|
351
|
+
const limit = params.limit ?? DEFAULT_PAGINATION_PAGE_SIZE;
|
|
352
|
+
const { after, before } = params;
|
|
353
|
+
let cursor = null;
|
|
354
|
+
if (after) {
|
|
355
|
+
cursor = decodeCursor(after);
|
|
356
|
+
}
|
|
357
|
+
else if (before) {
|
|
358
|
+
cursor = decodeCursor(before);
|
|
359
|
+
}
|
|
360
|
+
const order = before
|
|
361
|
+
? `ORDER BY "created_at" DESC, "id" DESC`
|
|
362
|
+
: `ORDER BY "created_at" ASC, "id" ASC`;
|
|
363
|
+
let query;
|
|
364
|
+
let queryParams;
|
|
365
|
+
if (cursor) {
|
|
366
|
+
const op = after ? ">" : "<";
|
|
367
|
+
query = `
|
|
368
|
+
SELECT *
|
|
369
|
+
FROM "step_attempts"
|
|
370
|
+
WHERE "namespace_id" = ?
|
|
371
|
+
AND "workflow_run_id" = ?
|
|
372
|
+
AND ("created_at", "id") ${op} (?, ?)
|
|
373
|
+
${order}
|
|
374
|
+
LIMIT ?
|
|
375
|
+
`;
|
|
376
|
+
queryParams = [
|
|
377
|
+
this.namespaceId,
|
|
378
|
+
params.workflowRunId,
|
|
379
|
+
cursor.createdAt.toISOString(),
|
|
380
|
+
cursor.id,
|
|
381
|
+
limit + 1,
|
|
382
|
+
];
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
query = `
|
|
386
|
+
SELECT *
|
|
387
|
+
FROM "step_attempts"
|
|
388
|
+
WHERE "namespace_id" = ?
|
|
389
|
+
AND "workflow_run_id" = ?
|
|
390
|
+
${order}
|
|
391
|
+
LIMIT ?
|
|
392
|
+
`;
|
|
393
|
+
queryParams = [this.namespaceId, params.workflowRunId, limit + 1];
|
|
394
|
+
}
|
|
395
|
+
const stmt = this.db.prepare(query);
|
|
396
|
+
const rawRows = stmt.all(...queryParams);
|
|
397
|
+
if (!Array.isArray(rawRows)) {
|
|
398
|
+
return Promise.resolve({
|
|
399
|
+
data: [],
|
|
400
|
+
pagination: { next: null, prev: null },
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
const rows = rawRows.map((row) => rowToStepAttempt(row));
|
|
404
|
+
return Promise.resolve(this.processPaginationResults(rows, limit, !!after, !!before));
|
|
405
|
+
}
|
|
406
|
+
processPaginationResults(rows, limit, hasAfter, hasBefore) {
|
|
407
|
+
const data = rows;
|
|
408
|
+
let hasNext = false;
|
|
409
|
+
let hasPrev = false;
|
|
410
|
+
if (hasBefore) {
|
|
411
|
+
data.reverse();
|
|
412
|
+
if (data.length > limit) {
|
|
413
|
+
hasPrev = true;
|
|
414
|
+
data.shift();
|
|
415
|
+
}
|
|
416
|
+
hasNext = true;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
if (data.length > limit) {
|
|
420
|
+
hasNext = true;
|
|
421
|
+
data.pop();
|
|
422
|
+
}
|
|
423
|
+
if (hasAfter) {
|
|
424
|
+
hasPrev = true;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const lastItem = data.at(-1);
|
|
428
|
+
const nextCursor = hasNext && lastItem ? encodeCursor(lastItem) : null;
|
|
429
|
+
const firstItem = data[0];
|
|
430
|
+
const prevCursor = hasPrev && firstItem ? encodeCursor(firstItem) : null;
|
|
431
|
+
return {
|
|
432
|
+
data,
|
|
433
|
+
pagination: {
|
|
434
|
+
next: nextCursor,
|
|
435
|
+
prev: prevCursor,
|
|
436
|
+
},
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
async createStepAttempt(params) {
|
|
440
|
+
const id = generateUUID();
|
|
441
|
+
const currentTime = now();
|
|
442
|
+
const stmt = this.db.prepare(`
|
|
443
|
+
INSERT INTO "step_attempts" (
|
|
444
|
+
"namespace_id",
|
|
445
|
+
"id",
|
|
446
|
+
"workflow_run_id",
|
|
447
|
+
"step_name",
|
|
448
|
+
"kind",
|
|
449
|
+
"status",
|
|
450
|
+
"config",
|
|
451
|
+
"context",
|
|
452
|
+
"started_at",
|
|
453
|
+
"created_at",
|
|
454
|
+
"updated_at"
|
|
455
|
+
)
|
|
456
|
+
VALUES (?, ?, ?, ?, ?, 'running', ?, ?, ?, ?, ?)
|
|
457
|
+
`);
|
|
458
|
+
stmt.run(this.namespaceId, id, params.workflowRunId, params.stepName, params.kind, toJSON(params.config), toJSON(params.context), currentTime, currentTime, currentTime);
|
|
459
|
+
const stepAttempt = await this.getStepAttempt({ stepAttemptId: id });
|
|
460
|
+
if (!stepAttempt)
|
|
461
|
+
throw new Error("Failed to create step attempt");
|
|
462
|
+
return stepAttempt;
|
|
463
|
+
}
|
|
464
|
+
getStepAttempt(params) {
|
|
465
|
+
const stmt = this.db.prepare(`
|
|
466
|
+
SELECT *
|
|
467
|
+
FROM "step_attempts"
|
|
468
|
+
WHERE "namespace_id" = ? AND "id" = ?
|
|
469
|
+
LIMIT 1
|
|
470
|
+
`);
|
|
471
|
+
const row = stmt.get(this.namespaceId, params.stepAttemptId);
|
|
472
|
+
return Promise.resolve(row ? rowToStepAttempt(row) : null);
|
|
473
|
+
}
|
|
474
|
+
async completeStepAttempt(params) {
|
|
475
|
+
const currentTime = now();
|
|
476
|
+
// Check that the workflow is running and owned by the worker
|
|
477
|
+
const workflowStmt = this.db.prepare(`
|
|
478
|
+
SELECT "id"
|
|
479
|
+
FROM "workflow_runs"
|
|
480
|
+
WHERE "namespace_id" = ?
|
|
481
|
+
AND "id" = ?
|
|
482
|
+
AND "status" = 'running'
|
|
483
|
+
AND "worker_id" = ?
|
|
484
|
+
`);
|
|
485
|
+
const workflowRow = workflowStmt.get(this.namespaceId, params.workflowRunId, params.workerId);
|
|
486
|
+
if (!workflowRow) {
|
|
487
|
+
throw new Error("Failed to mark step attempt completed");
|
|
488
|
+
}
|
|
489
|
+
const stmt = this.db.prepare(`
|
|
490
|
+
UPDATE "step_attempts"
|
|
491
|
+
SET
|
|
492
|
+
"status" = 'completed',
|
|
493
|
+
"output" = ?,
|
|
494
|
+
"error" = NULL,
|
|
495
|
+
"finished_at" = ?,
|
|
496
|
+
"updated_at" = ?
|
|
497
|
+
WHERE "namespace_id" = ?
|
|
498
|
+
AND "workflow_run_id" = ?
|
|
499
|
+
AND "id" = ?
|
|
500
|
+
AND "status" = 'running'
|
|
501
|
+
`);
|
|
502
|
+
const result = stmt.run(toJSON(params.output), currentTime, currentTime, this.namespaceId, params.workflowRunId, params.stepAttemptId);
|
|
503
|
+
if (result.changes === 0) {
|
|
504
|
+
throw new Error("Failed to mark step attempt completed");
|
|
505
|
+
}
|
|
506
|
+
const updated = await this.getStepAttempt({
|
|
507
|
+
stepAttemptId: params.stepAttemptId,
|
|
508
|
+
});
|
|
509
|
+
if (!updated)
|
|
510
|
+
throw new Error("Failed to mark step attempt completed");
|
|
511
|
+
return updated;
|
|
512
|
+
}
|
|
513
|
+
async failStepAttempt(params) {
|
|
514
|
+
const currentTime = now();
|
|
515
|
+
// Check that the workflow is running and owned by the worker
|
|
516
|
+
const workflowStmt = this.db.prepare(`
|
|
517
|
+
SELECT "id"
|
|
518
|
+
FROM "workflow_runs"
|
|
519
|
+
WHERE "namespace_id" = ?
|
|
520
|
+
AND "id" = ?
|
|
521
|
+
AND "status" = 'running'
|
|
522
|
+
AND "worker_id" = ?
|
|
523
|
+
`);
|
|
524
|
+
const workflowRow = workflowStmt.get(this.namespaceId, params.workflowRunId, params.workerId);
|
|
525
|
+
if (!workflowRow) {
|
|
526
|
+
throw new Error("Failed to mark step attempt failed");
|
|
527
|
+
}
|
|
528
|
+
const stmt = this.db.prepare(`
|
|
529
|
+
UPDATE "step_attempts"
|
|
530
|
+
SET
|
|
531
|
+
"status" = 'failed',
|
|
532
|
+
"output" = NULL,
|
|
533
|
+
"error" = ?,
|
|
534
|
+
"finished_at" = ?,
|
|
535
|
+
"updated_at" = ?
|
|
536
|
+
WHERE "namespace_id" = ?
|
|
537
|
+
AND "workflow_run_id" = ?
|
|
538
|
+
AND "id" = ?
|
|
539
|
+
AND "status" = 'running'
|
|
540
|
+
`);
|
|
541
|
+
const result = stmt.run(toJSON(params.error), currentTime, currentTime, this.namespaceId, params.workflowRunId, params.stepAttemptId);
|
|
542
|
+
if (result.changes === 0) {
|
|
543
|
+
throw new Error("Failed to mark step attempt failed");
|
|
544
|
+
}
|
|
545
|
+
const updated = await this.getStepAttempt({
|
|
546
|
+
stepAttemptId: params.stepAttemptId,
|
|
547
|
+
});
|
|
548
|
+
if (!updated)
|
|
549
|
+
throw new Error("Failed to mark step attempt failed");
|
|
550
|
+
return updated;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
// Conversion functions
|
|
554
|
+
function rowToWorkflowRun(row) {
|
|
555
|
+
const createdAt = fromISO(row.created_at);
|
|
556
|
+
const updatedAt = fromISO(row.updated_at);
|
|
557
|
+
const config = fromJSON(row.config);
|
|
558
|
+
if (!createdAt)
|
|
559
|
+
throw new Error("createdAt is required");
|
|
560
|
+
if (!updatedAt)
|
|
561
|
+
throw new Error("updatedAt is required");
|
|
562
|
+
if (config === null)
|
|
563
|
+
throw new Error("config is required");
|
|
564
|
+
return {
|
|
565
|
+
namespaceId: row.namespace_id,
|
|
566
|
+
id: row.id,
|
|
567
|
+
workflowName: row.workflow_name,
|
|
568
|
+
version: row.version,
|
|
569
|
+
status: row.status,
|
|
570
|
+
idempotencyKey: row.idempotency_key,
|
|
571
|
+
config: config,
|
|
572
|
+
context: fromJSON(row.context),
|
|
573
|
+
input: fromJSON(row.input),
|
|
574
|
+
output: fromJSON(row.output),
|
|
575
|
+
error: fromJSON(row.error),
|
|
576
|
+
attempts: row.attempts,
|
|
577
|
+
parentStepAttemptNamespaceId: row.parent_step_attempt_namespace_id,
|
|
578
|
+
parentStepAttemptId: row.parent_step_attempt_id,
|
|
579
|
+
workerId: row.worker_id,
|
|
580
|
+
availableAt: fromISO(row.available_at),
|
|
581
|
+
deadlineAt: fromISO(row.deadline_at),
|
|
582
|
+
startedAt: fromISO(row.started_at),
|
|
583
|
+
finishedAt: fromISO(row.finished_at),
|
|
584
|
+
createdAt,
|
|
585
|
+
updatedAt,
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
function rowToStepAttempt(row) {
|
|
589
|
+
const createdAt = fromISO(row.created_at);
|
|
590
|
+
const updatedAt = fromISO(row.updated_at);
|
|
591
|
+
const config = fromJSON(row.config);
|
|
592
|
+
if (!createdAt)
|
|
593
|
+
throw new Error("createdAt is required");
|
|
594
|
+
if (!updatedAt)
|
|
595
|
+
throw new Error("updatedAt is required");
|
|
596
|
+
if (config === null)
|
|
597
|
+
throw new Error("config is required");
|
|
598
|
+
return {
|
|
599
|
+
namespaceId: row.namespace_id,
|
|
600
|
+
id: row.id,
|
|
601
|
+
workflowRunId: row.workflow_run_id,
|
|
602
|
+
stepName: row.step_name,
|
|
603
|
+
kind: row.kind,
|
|
604
|
+
status: row.status,
|
|
605
|
+
config: config,
|
|
606
|
+
context: fromJSON(row.context),
|
|
607
|
+
output: fromJSON(row.output),
|
|
608
|
+
error: fromJSON(row.error),
|
|
609
|
+
childWorkflowRunNamespaceId: row.child_workflow_run_namespace_id,
|
|
610
|
+
childWorkflowRunId: row.child_workflow_run_id,
|
|
611
|
+
startedAt: fromISO(row.started_at),
|
|
612
|
+
finishedAt: fromISO(row.finished_at),
|
|
613
|
+
createdAt,
|
|
614
|
+
updatedAt,
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
function encodeCursor(item) {
|
|
618
|
+
return Buffer.from(JSON.stringify({ createdAt: item.createdAt, id: item.id })).toString("base64");
|
|
619
|
+
}
|
|
620
|
+
function decodeCursor(cursor) {
|
|
621
|
+
const decoded = Buffer.from(cursor, "base64").toString("utf8");
|
|
622
|
+
const parsed = JSON.parse(decoded);
|
|
623
|
+
return {
|
|
624
|
+
createdAt: new Date(parsed.createdAt),
|
|
625
|
+
id: parsed.id,
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
//# sourceMappingURL=backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../backend-sqlite/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,OAAO,EACP,YAAY,EACZ,GAAG,EACH,eAAe,EACf,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAO,EACP,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,O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AAC;QAClC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;QACpC,SAAS;QACT,SAAS;KACV,CAAC;AACJ,CAAC;AAaD,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAC3D,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAsC,CAAC;IACxE,OAAO;QACL,SAAS,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;QACrC,EAAE,EAAE,MAAM,CAAC,EAAE;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../backend-sqlite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../backend-sqlite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|