@pikku/kysely 0.12.6 → 0.12.7
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/CHANGELOG.md +6 -0
- package/dist/src/kysely-agent-run-service.js +59 -59
- package/dist/src/kysely-ai-storage-service.js +174 -174
- package/dist/src/kysely-channel-store.js +12 -12
- package/dist/src/kysely-credential-service.js +29 -29
- package/dist/src/kysely-deployment-service.js +22 -22
- package/dist/src/kysely-eventhub-store.js +8 -8
- package/dist/src/kysely-secret-service.js +19 -19
- package/dist/src/kysely-tables.d.ts +91 -91
- package/dist/src/kysely-workflow-run-service.js +73 -73
- package/dist/src/kysely-workflow-service.js +127 -127
- package/package.json +1 -1
- package/src/kysely-agent-run-service.ts +59 -59
- package/src/kysely-ai-storage-service.ts +174 -174
- package/src/kysely-channel-store.ts +12 -12
- package/src/kysely-credential-service.ts +29 -29
- package/src/kysely-deployment-service.ts +24 -24
- package/src/kysely-eventhub-store.ts +8 -8
- package/src/kysely-secret-service.ts +19 -19
- package/src/kysely-services.test.ts +19 -18
- package/src/kysely-tables.ts +91 -91
- package/src/kysely-workflow-run-service.ts +76 -76
- package/src/kysely-workflow-service.ts +129 -129
|
@@ -98,14 +98,14 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
98
98
|
async createRun(workflowName, input, inline, graphHash, wire) {
|
|
99
99
|
const id = crypto.randomUUID();
|
|
100
100
|
await this.db
|
|
101
|
-
.insertInto('
|
|
101
|
+
.insertInto('workflowRuns')
|
|
102
102
|
.values({
|
|
103
|
-
|
|
103
|
+
workflowRunId: id,
|
|
104
104
|
workflow: workflowName,
|
|
105
105
|
status: 'running',
|
|
106
106
|
input: JSON.stringify(input),
|
|
107
107
|
inline,
|
|
108
|
-
|
|
108
|
+
graphHash: graphHash,
|
|
109
109
|
wire: JSON.stringify(wire),
|
|
110
110
|
})
|
|
111
111
|
.execute();
|
|
@@ -116,32 +116,32 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
116
116
|
}
|
|
117
117
|
async updateRunStatus(id, status, output, error) {
|
|
118
118
|
await this.db
|
|
119
|
-
.updateTable('
|
|
119
|
+
.updateTable('workflowRuns')
|
|
120
120
|
.set({
|
|
121
121
|
status,
|
|
122
122
|
output: output ? JSON.stringify(output) : null,
|
|
123
123
|
error: error ? JSON.stringify(error) : null,
|
|
124
|
-
|
|
124
|
+
updatedAt: new Date(),
|
|
125
125
|
})
|
|
126
|
-
.where('
|
|
126
|
+
.where('workflowRunId', '=', id)
|
|
127
127
|
.execute();
|
|
128
128
|
}
|
|
129
129
|
async insertStepState(runId, stepName, rpcName, data, stepOptions) {
|
|
130
130
|
const stepId = crypto.randomUUID();
|
|
131
131
|
const now = new Date();
|
|
132
132
|
await this.db
|
|
133
|
-
.insertInto('
|
|
133
|
+
.insertInto('workflowStep')
|
|
134
134
|
.values({
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
workflowStepId: stepId,
|
|
136
|
+
workflowRunId: runId,
|
|
137
|
+
stepName: stepName,
|
|
138
|
+
rpcName: rpcName,
|
|
139
139
|
data: data != null ? JSON.stringify(data) : null,
|
|
140
140
|
status: 'pending',
|
|
141
141
|
retries: stepOptions?.retries ?? null,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
retryDelay: stepOptions?.retryDelay?.toString() ?? null,
|
|
143
|
+
createdAt: now,
|
|
144
|
+
updatedAt: now,
|
|
145
145
|
})
|
|
146
146
|
.execute();
|
|
147
147
|
await this.insertHistoryRecord(stepId, 'pending');
|
|
@@ -159,38 +159,38 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
159
159
|
}
|
|
160
160
|
async getStepState(runId, stepName) {
|
|
161
161
|
const row = await this.db
|
|
162
|
-
.selectFrom('
|
|
162
|
+
.selectFrom('workflowStep as s')
|
|
163
163
|
.select([
|
|
164
|
-
's.
|
|
164
|
+
's.workflowStepId',
|
|
165
165
|
's.status',
|
|
166
166
|
's.result',
|
|
167
167
|
's.error',
|
|
168
168
|
's.retries',
|
|
169
|
-
's.
|
|
170
|
-
's.
|
|
171
|
-
's.
|
|
169
|
+
's.retryDelay',
|
|
170
|
+
's.createdAt',
|
|
171
|
+
's.updatedAt',
|
|
172
172
|
])
|
|
173
173
|
.select((eb) => eb
|
|
174
|
-
.selectFrom('
|
|
174
|
+
.selectFrom('workflowStepHistory')
|
|
175
175
|
.select(eb.fn.countAll().as('cnt'))
|
|
176
|
-
.whereRef('
|
|
177
|
-
.as('
|
|
178
|
-
.where('s.
|
|
179
|
-
.where('s.
|
|
176
|
+
.whereRef('workflowStepHistory.workflowStepId', '=', 's.workflowStepId')
|
|
177
|
+
.as('attemptCount'))
|
|
178
|
+
.where('s.workflowRunId', '=', runId)
|
|
179
|
+
.where('s.stepName', '=', stepName)
|
|
180
180
|
.executeTakeFirst();
|
|
181
181
|
if (!row) {
|
|
182
182
|
throw new Error(`Step not found: runId=${runId}, stepName=${stepName}. Use insertStepState to create it.`);
|
|
183
183
|
}
|
|
184
184
|
return {
|
|
185
|
-
stepId: row.
|
|
185
|
+
stepId: row.workflowStepId,
|
|
186
186
|
status: row.status,
|
|
187
187
|
result: parseJson(row.result),
|
|
188
188
|
error: parseJson(row.error),
|
|
189
|
-
attemptCount: Number(row.
|
|
189
|
+
attemptCount: Number(row.attemptCount),
|
|
190
190
|
retries: row.retries != null ? Number(row.retries) : undefined,
|
|
191
|
-
retryDelay: row.
|
|
192
|
-
createdAt: new Date(row.
|
|
193
|
-
updatedAt: new Date(row.
|
|
191
|
+
retryDelay: row.retryDelay ?? undefined,
|
|
192
|
+
createdAt: new Date(row.createdAt),
|
|
193
|
+
updatedAt: new Date(row.updatedAt),
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
async getRunHistory(runId) {
|
|
@@ -198,99 +198,99 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
198
198
|
}
|
|
199
199
|
async setStepRunning(stepId) {
|
|
200
200
|
await this.db
|
|
201
|
-
.updateTable('
|
|
202
|
-
.set({ status: 'running',
|
|
203
|
-
.where('
|
|
201
|
+
.updateTable('workflowStep')
|
|
202
|
+
.set({ status: 'running', updatedAt: new Date() })
|
|
203
|
+
.where('workflowStepId', '=', stepId)
|
|
204
204
|
.execute();
|
|
205
205
|
const latestHistory = await this.db
|
|
206
|
-
.selectFrom('
|
|
207
|
-
.select('
|
|
208
|
-
.where('
|
|
209
|
-
.orderBy('
|
|
206
|
+
.selectFrom('workflowStepHistory')
|
|
207
|
+
.select('historyId')
|
|
208
|
+
.where('workflowStepId', '=', stepId)
|
|
209
|
+
.orderBy('createdAt', 'desc')
|
|
210
210
|
.limit(1)
|
|
211
211
|
.executeTakeFirst();
|
|
212
212
|
if (latestHistory) {
|
|
213
213
|
await this.db
|
|
214
|
-
.updateTable('
|
|
214
|
+
.updateTable('workflowStepHistory')
|
|
215
215
|
.set({ status: 'running' })
|
|
216
|
-
.where('
|
|
216
|
+
.where('historyId', '=', latestHistory.historyId)
|
|
217
217
|
.execute();
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
async setStepScheduled(stepId) {
|
|
221
221
|
await this.db
|
|
222
|
-
.updateTable('
|
|
223
|
-
.set({ status: 'scheduled',
|
|
224
|
-
.where('
|
|
222
|
+
.updateTable('workflowStep')
|
|
223
|
+
.set({ status: 'scheduled', updatedAt: new Date() })
|
|
224
|
+
.where('workflowStepId', '=', stepId)
|
|
225
225
|
.execute();
|
|
226
226
|
}
|
|
227
227
|
async insertHistoryRecord(stepId, status, result, error) {
|
|
228
228
|
const now = new Date();
|
|
229
229
|
const values = {
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
historyId: crypto.randomUUID(),
|
|
231
|
+
workflowStepId: stepId,
|
|
232
232
|
status,
|
|
233
233
|
result: result != null ? JSON.stringify(result) : null,
|
|
234
234
|
error: error != null ? JSON.stringify(error) : null,
|
|
235
|
-
|
|
235
|
+
createdAt: now,
|
|
236
236
|
};
|
|
237
237
|
const timestampField = this.getTimestampFieldForStatus(status);
|
|
238
|
-
if (timestampField !== '
|
|
238
|
+
if (timestampField !== 'createdAt') {
|
|
239
239
|
values[timestampField] = now;
|
|
240
240
|
}
|
|
241
241
|
await this.db
|
|
242
|
-
.insertInto('
|
|
242
|
+
.insertInto('workflowStepHistory')
|
|
243
243
|
.values(values)
|
|
244
244
|
.execute();
|
|
245
245
|
}
|
|
246
246
|
getTimestampFieldForStatus(status) {
|
|
247
247
|
switch (status) {
|
|
248
248
|
case 'running':
|
|
249
|
-
return '
|
|
249
|
+
return 'runningAt';
|
|
250
250
|
case 'scheduled':
|
|
251
|
-
return '
|
|
251
|
+
return 'scheduledAt';
|
|
252
252
|
case 'succeeded':
|
|
253
|
-
return '
|
|
253
|
+
return 'succeededAt';
|
|
254
254
|
case 'failed':
|
|
255
|
-
return '
|
|
255
|
+
return 'failedAt';
|
|
256
256
|
default:
|
|
257
|
-
return '
|
|
257
|
+
return 'createdAt';
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
async setStepChildRunId(stepId, childRunId) {
|
|
261
261
|
await this.db
|
|
262
|
-
.updateTable('
|
|
262
|
+
.updateTable('workflowStep')
|
|
263
263
|
.set({
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
childRunId: childRunId,
|
|
265
|
+
updatedAt: new Date(),
|
|
266
266
|
})
|
|
267
|
-
.where('
|
|
267
|
+
.where('workflowStepId', '=', stepId)
|
|
268
268
|
.execute();
|
|
269
269
|
}
|
|
270
270
|
async setStepResult(stepId, result) {
|
|
271
271
|
const resultJson = JSON.stringify(result);
|
|
272
272
|
await this.db
|
|
273
|
-
.updateTable('
|
|
273
|
+
.updateTable('workflowStep')
|
|
274
274
|
.set({
|
|
275
275
|
status: 'succeeded',
|
|
276
276
|
result: resultJson,
|
|
277
277
|
error: null,
|
|
278
|
-
|
|
278
|
+
updatedAt: new Date(),
|
|
279
279
|
})
|
|
280
|
-
.where('
|
|
280
|
+
.where('workflowStepId', '=', stepId)
|
|
281
281
|
.execute();
|
|
282
282
|
const latestHistory = await this.db
|
|
283
|
-
.selectFrom('
|
|
284
|
-
.select('
|
|
285
|
-
.where('
|
|
286
|
-
.orderBy('
|
|
283
|
+
.selectFrom('workflowStepHistory')
|
|
284
|
+
.select('historyId')
|
|
285
|
+
.where('workflowStepId', '=', stepId)
|
|
286
|
+
.orderBy('createdAt', 'desc')
|
|
287
287
|
.limit(1)
|
|
288
288
|
.executeTakeFirst();
|
|
289
289
|
if (latestHistory) {
|
|
290
290
|
await this.db
|
|
291
|
-
.updateTable('
|
|
291
|
+
.updateTable('workflowStepHistory')
|
|
292
292
|
.set({ status: 'succeeded', result: resultJson })
|
|
293
|
-
.where('
|
|
293
|
+
.where('historyId', '=', latestHistory.historyId)
|
|
294
294
|
.execute();
|
|
295
295
|
}
|
|
296
296
|
}
|
|
@@ -302,66 +302,66 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
302
302
|
};
|
|
303
303
|
const errorJson = JSON.stringify(serializedError);
|
|
304
304
|
await this.db
|
|
305
|
-
.updateTable('
|
|
305
|
+
.updateTable('workflowStep')
|
|
306
306
|
.set({
|
|
307
307
|
status: 'failed',
|
|
308
308
|
error: errorJson,
|
|
309
309
|
result: null,
|
|
310
|
-
|
|
310
|
+
updatedAt: new Date(),
|
|
311
311
|
})
|
|
312
|
-
.where('
|
|
312
|
+
.where('workflowStepId', '=', stepId)
|
|
313
313
|
.execute();
|
|
314
314
|
const latestHistory = await this.db
|
|
315
|
-
.selectFrom('
|
|
316
|
-
.select('
|
|
317
|
-
.where('
|
|
318
|
-
.orderBy('
|
|
315
|
+
.selectFrom('workflowStepHistory')
|
|
316
|
+
.select('historyId')
|
|
317
|
+
.where('workflowStepId', '=', stepId)
|
|
318
|
+
.orderBy('createdAt', 'desc')
|
|
319
319
|
.limit(1)
|
|
320
320
|
.executeTakeFirst();
|
|
321
321
|
if (latestHistory) {
|
|
322
322
|
await this.db
|
|
323
|
-
.updateTable('
|
|
323
|
+
.updateTable('workflowStepHistory')
|
|
324
324
|
.set({ status: 'failed', error: errorJson })
|
|
325
|
-
.where('
|
|
325
|
+
.where('historyId', '=', latestHistory.historyId)
|
|
326
326
|
.execute();
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
async createRetryAttempt(stepId, status) {
|
|
330
330
|
await this.db
|
|
331
|
-
.updateTable('
|
|
332
|
-
.set({ status, result: null, error: null,
|
|
333
|
-
.where('
|
|
331
|
+
.updateTable('workflowStep')
|
|
332
|
+
.set({ status, result: null, error: null, updatedAt: new Date() })
|
|
333
|
+
.where('workflowStepId', '=', stepId)
|
|
334
334
|
.execute();
|
|
335
335
|
await this.insertHistoryRecord(stepId, status);
|
|
336
336
|
const row = await this.db
|
|
337
|
-
.selectFrom('
|
|
337
|
+
.selectFrom('workflowStep as s')
|
|
338
338
|
.select([
|
|
339
|
-
's.
|
|
339
|
+
's.workflowStepId',
|
|
340
340
|
's.status',
|
|
341
341
|
's.result',
|
|
342
342
|
's.error',
|
|
343
343
|
's.retries',
|
|
344
|
-
's.
|
|
345
|
-
's.
|
|
346
|
-
's.
|
|
344
|
+
's.retryDelay',
|
|
345
|
+
's.createdAt',
|
|
346
|
+
's.updatedAt',
|
|
347
347
|
])
|
|
348
348
|
.select((eb) => eb
|
|
349
|
-
.selectFrom('
|
|
349
|
+
.selectFrom('workflowStepHistory')
|
|
350
350
|
.select(eb.fn.countAll().as('cnt'))
|
|
351
|
-
.whereRef('
|
|
352
|
-
.as('
|
|
353
|
-
.where('s.
|
|
351
|
+
.whereRef('workflowStepHistory.workflowStepId', '=', 's.workflowStepId')
|
|
352
|
+
.as('attemptCount'))
|
|
353
|
+
.where('s.workflowStepId', '=', stepId)
|
|
354
354
|
.executeTakeFirstOrThrow();
|
|
355
355
|
return {
|
|
356
|
-
stepId: row.
|
|
356
|
+
stepId: row.workflowStepId,
|
|
357
357
|
status: row.status,
|
|
358
358
|
result: parseJson(row.result),
|
|
359
359
|
error: parseJson(row.error),
|
|
360
|
-
attemptCount: Number(row.
|
|
360
|
+
attemptCount: Number(row.attemptCount),
|
|
361
361
|
retries: row.retries != null ? Number(row.retries) : undefined,
|
|
362
|
-
retryDelay: row.
|
|
363
|
-
createdAt: new Date(row.
|
|
364
|
-
updatedAt: new Date(row.
|
|
362
|
+
retryDelay: row.retryDelay ?? undefined,
|
|
363
|
+
createdAt: new Date(row.createdAt),
|
|
364
|
+
updatedAt: new Date(row.updatedAt),
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
367
|
async withRunLock(_id, fn) {
|
|
@@ -372,30 +372,30 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
372
372
|
}
|
|
373
373
|
async getCompletedGraphState(runId) {
|
|
374
374
|
const results = await this.db
|
|
375
|
-
.selectFrom('
|
|
376
|
-
.select(['ws.
|
|
375
|
+
.selectFrom('workflowStep as ws')
|
|
376
|
+
.select(['ws.stepName', 'ws.status', 'ws.branchTaken', 'ws.retries'])
|
|
377
377
|
.select((eb) => eb
|
|
378
|
-
.selectFrom('
|
|
378
|
+
.selectFrom('workflowStepHistory as h')
|
|
379
379
|
.select(eb.fn.countAll().as('cnt'))
|
|
380
|
-
.whereRef('h.
|
|
381
|
-
.as('
|
|
382
|
-
.where('ws.
|
|
380
|
+
.whereRef('h.workflowStepId', '=', 'ws.workflowStepId')
|
|
381
|
+
.as('attemptCount'))
|
|
382
|
+
.where('ws.workflowRunId', '=', runId)
|
|
383
383
|
.where('ws.status', 'in', ['succeeded', 'failed'])
|
|
384
384
|
.execute();
|
|
385
385
|
const completedNodeIds = [];
|
|
386
386
|
const failedNodeIds = [];
|
|
387
387
|
const branchKeys = {};
|
|
388
388
|
for (const row of results) {
|
|
389
|
-
const nodeId = row.
|
|
389
|
+
const nodeId = row.stepName;
|
|
390
390
|
if (row.status === 'succeeded') {
|
|
391
391
|
completedNodeIds.push(nodeId);
|
|
392
|
-
if (row.
|
|
393
|
-
branchKeys[nodeId] = row.
|
|
392
|
+
if (row.branchTaken) {
|
|
393
|
+
branchKeys[nodeId] = row.branchTaken;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
else if (row.status === 'failed') {
|
|
397
397
|
const maxAttempts = (row.retries ?? 0) + 1;
|
|
398
|
-
if (Number(row.
|
|
398
|
+
if (Number(row.attemptCount) >= maxAttempts) {
|
|
399
399
|
failedNodeIds.push(nodeId);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
@@ -406,56 +406,56 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
406
406
|
if (nodeIds.length === 0)
|
|
407
407
|
return [];
|
|
408
408
|
const result = await this.db
|
|
409
|
-
.selectFrom('
|
|
410
|
-
.select('
|
|
411
|
-
.where('
|
|
412
|
-
.where('
|
|
409
|
+
.selectFrom('workflowStep')
|
|
410
|
+
.select('stepName')
|
|
411
|
+
.where('workflowRunId', '=', runId)
|
|
412
|
+
.where('stepName', 'in', nodeIds)
|
|
413
413
|
.execute();
|
|
414
|
-
const existingStepNames = new Set(result.map((r) => r.
|
|
414
|
+
const existingStepNames = new Set(result.map((r) => r.stepName));
|
|
415
415
|
return nodeIds.filter((id) => !existingStepNames.has(id));
|
|
416
416
|
}
|
|
417
417
|
async getNodeResults(runId, nodeIds) {
|
|
418
418
|
if (nodeIds.length === 0)
|
|
419
419
|
return {};
|
|
420
420
|
const result = await this.db
|
|
421
|
-
.selectFrom('
|
|
422
|
-
.select(['
|
|
423
|
-
.where('
|
|
424
|
-
.where('
|
|
421
|
+
.selectFrom('workflowStep')
|
|
422
|
+
.select(['stepName', 'result'])
|
|
423
|
+
.where('workflowRunId', '=', runId)
|
|
424
|
+
.where('stepName', 'in', nodeIds)
|
|
425
425
|
.where('status', '=', 'succeeded')
|
|
426
426
|
.execute();
|
|
427
427
|
const results = {};
|
|
428
428
|
for (const row of result) {
|
|
429
|
-
results[row.
|
|
429
|
+
results[row.stepName] = parseJson(row.result);
|
|
430
430
|
}
|
|
431
431
|
return results;
|
|
432
432
|
}
|
|
433
433
|
async setBranchTaken(stepId, branchKey) {
|
|
434
434
|
await this.db
|
|
435
|
-
.updateTable('
|
|
436
|
-
.set({
|
|
437
|
-
.where('
|
|
435
|
+
.updateTable('workflowStep')
|
|
436
|
+
.set({ branchTaken: branchKey, updatedAt: new Date() })
|
|
437
|
+
.where('workflowStepId', '=', stepId)
|
|
438
438
|
.execute();
|
|
439
439
|
}
|
|
440
440
|
async updateRunState(runId, name, value) {
|
|
441
441
|
const row = await this.db
|
|
442
|
-
.selectFrom('
|
|
442
|
+
.selectFrom('workflowRuns')
|
|
443
443
|
.select('state')
|
|
444
|
-
.where('
|
|
444
|
+
.where('workflowRunId', '=', runId)
|
|
445
445
|
.executeTakeFirst();
|
|
446
446
|
const state = parseJson(row?.state) ?? {};
|
|
447
447
|
state[name] = value;
|
|
448
448
|
await this.db
|
|
449
|
-
.updateTable('
|
|
450
|
-
.set({ state: JSON.stringify(state),
|
|
451
|
-
.where('
|
|
449
|
+
.updateTable('workflowRuns')
|
|
450
|
+
.set({ state: JSON.stringify(state), updatedAt: new Date() })
|
|
451
|
+
.where('workflowRunId', '=', runId)
|
|
452
452
|
.execute();
|
|
453
453
|
}
|
|
454
454
|
async getRunState(runId) {
|
|
455
455
|
const row = await this.db
|
|
456
|
-
.selectFrom('
|
|
456
|
+
.selectFrom('workflowRuns')
|
|
457
457
|
.select('state')
|
|
458
|
-
.where('
|
|
458
|
+
.where('workflowRunId', '=', runId)
|
|
459
459
|
.executeTakeFirst();
|
|
460
460
|
if (!row)
|
|
461
461
|
return {};
|
|
@@ -463,23 +463,23 @@ export class KyselyWorkflowService extends PikkuWorkflowService {
|
|
|
463
463
|
}
|
|
464
464
|
async upsertWorkflowVersion(name, graphHash, graph, source, status) {
|
|
465
465
|
await this.db
|
|
466
|
-
.insertInto('
|
|
466
|
+
.insertInto('workflowVersions')
|
|
467
467
|
.values({
|
|
468
|
-
|
|
469
|
-
|
|
468
|
+
workflowName: name,
|
|
469
|
+
graphHash: graphHash,
|
|
470
470
|
graph: JSON.stringify(graph),
|
|
471
471
|
source,
|
|
472
472
|
status: status ?? 'active',
|
|
473
473
|
})
|
|
474
|
-
.onConflict((oc) => oc.columns(['
|
|
474
|
+
.onConflict((oc) => oc.columns(['workflowName', 'graphHash']).doNothing())
|
|
475
475
|
.execute();
|
|
476
476
|
}
|
|
477
477
|
async updateWorkflowVersionStatus(name, graphHash, status) {
|
|
478
478
|
await this.db
|
|
479
|
-
.updateTable('
|
|
479
|
+
.updateTable('workflowVersions')
|
|
480
480
|
.set({ status })
|
|
481
|
-
.where('
|
|
482
|
-
.where('
|
|
481
|
+
.where('workflowName', '=', name)
|
|
482
|
+
.where('graphHash', '=', graphHash)
|
|
483
483
|
.execute();
|
|
484
484
|
}
|
|
485
485
|
async getWorkflowVersion(name, graphHash) {
|