@brandboostinggmbh/observable-workflows 0.15.0 → 0.15.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/dist/index.d.ts +0 -2
- package/dist/index.js +19 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -562,7 +562,6 @@ declare const createCleanupManager: (context: {
|
|
|
562
562
|
stepStatus: string;
|
|
563
563
|
errorRef: string | null;
|
|
564
564
|
resultRef: string | null;
|
|
565
|
-
workflowName: string;
|
|
566
565
|
}[];
|
|
567
566
|
externalStorageKeysCount: number;
|
|
568
567
|
}>;
|
|
@@ -574,7 +573,6 @@ declare const createCleanupManager: (context: {
|
|
|
574
573
|
stepStatus: string;
|
|
575
574
|
errorRef: string | null;
|
|
576
575
|
resultRef: string | null;
|
|
577
|
-
workflowName: string;
|
|
578
576
|
}[];
|
|
579
577
|
deletedExternalStorageKeysCount: number;
|
|
580
578
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -1348,30 +1348,37 @@ const createCleanupManager = (context) => {
|
|
|
1348
1348
|
const result = await context.D1.prepare(
|
|
1349
1349
|
/* sql */
|
|
1350
1350
|
`
|
|
1351
|
-
SELECT instanceId,
|
|
1351
|
+
SELECT instanceId, inputRef
|
|
1352
1352
|
FROM WorkflowTable
|
|
1353
1353
|
WHERE tenantId = ?
|
|
1354
1354
|
AND startTime < (strftime('%s', 'now', '-' || ? || ' days') * 1000)
|
|
1355
1355
|
AND workflowStatus IN (${statusPlaceholders})
|
|
1356
|
-
ORDER BY
|
|
1356
|
+
ORDER BY instanceId
|
|
1357
1357
|
LIMIT ?
|
|
1358
1358
|
`
|
|
1359
1359
|
).bind(context.tenantId, config.deleteWorkflowsOlderThanDays, ...statuses, limit).all();
|
|
1360
1360
|
return result.results;
|
|
1361
1361
|
};
|
|
1362
|
-
const getAffectedSteps = async (
|
|
1363
|
-
|
|
1364
|
-
|
|
1362
|
+
const getAffectedSteps = async (config, limit) => {
|
|
1363
|
+
const { statuses, statusPlaceholders } = buildStatusesAndPlaceholders(config);
|
|
1364
|
+
if (statuses.length === 0) return [];
|
|
1365
1365
|
const result = await context.D1.prepare(
|
|
1366
1366
|
/* sql */
|
|
1367
1367
|
`
|
|
1368
|
-
SELECT s.instanceId, s.stepName, s.stepStatus, s.errorRef, s.resultRef
|
|
1368
|
+
SELECT s.instanceId, s.stepName, s.stepStatus, s.errorRef, s.resultRef
|
|
1369
1369
|
FROM StepTable s
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1370
|
+
WHERE s.instanceId IN (
|
|
1371
|
+
SELECT instanceId
|
|
1372
|
+
FROM WorkflowTable
|
|
1373
|
+
WHERE tenantId = ?
|
|
1374
|
+
AND startTime < (strftime('%s', 'now', '-' || ? || ' days') * 1000)
|
|
1375
|
+
AND workflowStatus IN (${statusPlaceholders})
|
|
1376
|
+
ORDER BY instanceId
|
|
1377
|
+
LIMIT ?
|
|
1378
|
+
)
|
|
1379
|
+
ORDER BY s.instanceId, s.stepName
|
|
1373
1380
|
`
|
|
1374
|
-
).bind(
|
|
1381
|
+
).bind(context.tenantId, config.deleteWorkflowsOlderThanDays, ...statuses, limit).all();
|
|
1375
1382
|
return result.results;
|
|
1376
1383
|
};
|
|
1377
1384
|
const collectExternalStorageKeys = (workflows, steps) => {
|
|
@@ -1390,7 +1397,7 @@ const createCleanupManager = (context) => {
|
|
|
1390
1397
|
externalStorageKeysCount: 0
|
|
1391
1398
|
};
|
|
1392
1399
|
const affectedWorkflows = await getAffectedWorkflows(config, limit);
|
|
1393
|
-
const affectedSteps = await getAffectedSteps(
|
|
1400
|
+
const affectedSteps = await getAffectedSteps(config, limit);
|
|
1394
1401
|
let externalStorageKeysCount = 0;
|
|
1395
1402
|
if (config.deleteRefsFromExternalStorage && context.externalBlobStorage) {
|
|
1396
1403
|
const externalKeys = collectExternalStorageKeys(affectedWorkflows, affectedSteps);
|
|
@@ -1409,7 +1416,7 @@ const createCleanupManager = (context) => {
|
|
|
1409
1416
|
deletedExternalStorageKeysCount: 0
|
|
1410
1417
|
};
|
|
1411
1418
|
const deletedWorkflows = await getAffectedWorkflows(config, limit);
|
|
1412
|
-
const deletedSteps = await getAffectedSteps(
|
|
1419
|
+
const deletedSteps = await getAffectedSteps(config, limit);
|
|
1413
1420
|
let deletedExternalStorageKeysCount = 0;
|
|
1414
1421
|
if (config.deleteRefsFromExternalStorage && context.externalBlobStorage) {
|
|
1415
1422
|
const externalKeys = collectExternalStorageKeys(deletedWorkflows, deletedSteps);
|