@brandboostinggmbh/observable-workflows 0.17.0 → 0.17.2
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 +1 -0
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -460,6 +460,7 @@ declare const createLogAccessor: (context: {
|
|
|
460
460
|
listWorkflows: (limit: number, offset: number, filter?: WorkflowFilter, options?: {
|
|
461
461
|
/** If false the input will not be populated. This decreases memory load. */
|
|
462
462
|
populateInput?: boolean;
|
|
463
|
+
debugLogs?: boolean;
|
|
463
464
|
}) => Promise<WorkflowRun[]>;
|
|
464
465
|
getWorkflow: (instanceId: string, populateData?: boolean) => Promise<WorkflowRun | null>;
|
|
465
466
|
getWorkflowTypesByTenantId: (tenantId: string) => Promise<string[]>;
|
package/dist/index.js
CHANGED
|
@@ -766,7 +766,9 @@ const createLogAccessor = (context) => {
|
|
|
766
766
|
}
|
|
767
767
|
const listWorkflows = async (limit, offset, filter, options) => {
|
|
768
768
|
const { sql, bindings } = buildFilteredWorkflowQuery(filter);
|
|
769
|
+
if (options?.debugLogs) console.log("listWorkflows SQL:", sql, "Bindings:", JSON.stringify(bindings));
|
|
769
770
|
const result = await context.D1.prepare(sql).bind(...bindings, limit, offset).all();
|
|
771
|
+
if (options?.debugLogs) console.log("listWorkflows SQL Query executed");
|
|
770
772
|
if (result.results) {
|
|
771
773
|
const workflows = await Promise.all(result.results.map((row) => workflowTableRowToWorkflowRun({
|
|
772
774
|
row,
|
|
@@ -1506,17 +1508,21 @@ const createCleanupManager = (context) => {
|
|
|
1506
1508
|
deletedExternalStorageKeysCount: 0
|
|
1507
1509
|
};
|
|
1508
1510
|
const deletedWorkflows = await getAffectedWorkflows(config, limit);
|
|
1511
|
+
console.log(`Deleting ${deletedWorkflows.length} old workflows...`);
|
|
1509
1512
|
const deletedSteps = await getAffectedSteps(config, limit);
|
|
1513
|
+
console.log(`Deleting ${deletedSteps.length} associated steps...`);
|
|
1510
1514
|
let deletedExternalStorageKeysCount = 0;
|
|
1511
1515
|
if (config.deleteRefsFromExternalStorage && context.externalBlobStorage) {
|
|
1512
1516
|
const externalKeys = collectExternalStorageKeys(deletedWorkflows, deletedSteps);
|
|
1513
1517
|
if (externalKeys.length > 0) try {
|
|
1518
|
+
console.log(`Deleting ${externalKeys.length} external storage keys...`);
|
|
1514
1519
|
deletedExternalStorageKeysCount = await context.externalBlobStorage.delete(...externalKeys);
|
|
1515
1520
|
} catch (error) {
|
|
1516
1521
|
console.warn(`Failed to delete some external storage keys: ${error instanceof Error ? error.message : String(error)}`);
|
|
1517
1522
|
}
|
|
1518
1523
|
}
|
|
1519
1524
|
if (deletedWorkflows.length > 0) {
|
|
1525
|
+
console.log(`Proceeding to delete workflows from the database...`);
|
|
1520
1526
|
await context.D1.prepare(`PRAGMA foreign_keys = ON`).run();
|
|
1521
1527
|
let totalDeletedCount = 0;
|
|
1522
1528
|
for (let i = 0; i < deletedWorkflows.length; i += 100) {
|
|
@@ -1536,7 +1542,7 @@ const createCleanupManager = (context) => {
|
|
|
1536
1542
|
deletedSteps,
|
|
1537
1543
|
deletedExternalStorageKeysCount
|
|
1538
1544
|
};
|
|
1539
|
-
}
|
|
1545
|
+
} else console.log(`No workflows matched the deletion criteria.`);
|
|
1540
1546
|
return {
|
|
1541
1547
|
deletedCount: 0,
|
|
1542
1548
|
deletedSteps,
|