@brandboostinggmbh/observable-workflows 0.20.0-beta.6 → 0.20.2-beta.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 +4 -0
- package/dist/index.js +14 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -748,6 +748,10 @@ type DeleteConfig = {
|
|
|
748
748
|
failedWorkflows: boolean;
|
|
749
749
|
/** Workflows that are still in progress after a long time, might have failed non-gracefully and are therefore not correctly marked as failed.*/
|
|
750
750
|
inProgressWorkflows: boolean;
|
|
751
|
+
/** Workflows that are queued for execution but have never started. Defaults to false. */
|
|
752
|
+
scheduledWorkflows?: boolean;
|
|
753
|
+
/** Workflows that are blocked waiting for dependencies to complete. Defaults to false. */
|
|
754
|
+
waitingWorkflows?: boolean;
|
|
751
755
|
};
|
|
752
756
|
deleteRefsFromExternalStorage: boolean;
|
|
753
757
|
};
|
package/dist/index.js
CHANGED
|
@@ -1018,6 +1018,8 @@ const createCleanupManager = (context) => {
|
|
|
1018
1018
|
if (config.delete.successfulWorkflows) statuses.push("completed");
|
|
1019
1019
|
if (config.delete.failedWorkflows) statuses.push("failed");
|
|
1020
1020
|
if (config.delete.inProgressWorkflows) statuses.push("pending");
|
|
1021
|
+
if (config.delete.scheduledWorkflows) statuses.push("scheduled");
|
|
1022
|
+
if (config.delete.waitingWorkflows) statuses.push("waiting");
|
|
1021
1023
|
const statusPlaceholders = statuses.map(() => "?").join(", ");
|
|
1022
1024
|
return {
|
|
1023
1025
|
statuses,
|
|
@@ -1221,10 +1223,11 @@ const createLogAccessor = (context) => {
|
|
|
1221
1223
|
const bindings = [];
|
|
1222
1224
|
const whereConditions = [];
|
|
1223
1225
|
let joinClause = "";
|
|
1224
|
-
|
|
1226
|
+
let hasPropertyJoins = false;
|
|
1225
1227
|
const fromClause = "FROM WorkflowTable w";
|
|
1226
1228
|
const propertyWhereConditions = [];
|
|
1227
1229
|
if (filter && filter.properties && Object.keys(filter.properties).length > 0) {
|
|
1230
|
+
hasPropertyJoins = true;
|
|
1228
1231
|
let propIndex = 0;
|
|
1229
1232
|
for (const [key, propertyFilter] of Object.entries(filter.properties)) {
|
|
1230
1233
|
const propAlias = `p${propIndex}`;
|
|
@@ -1346,6 +1349,7 @@ const createLogAccessor = (context) => {
|
|
|
1346
1349
|
}
|
|
1347
1350
|
}
|
|
1348
1351
|
const whereClause = whereConditions.length > 0 ? `WHERE ${whereConditions.join(" AND ")}` : "";
|
|
1352
|
+
const selectClause = hasPropertyJoins ? "SELECT DISTINCT w.*" : "SELECT w.*";
|
|
1349
1353
|
const sql = `${selectClause} ${fromClause}${joinClause} ${whereClause} ORDER BY w.startTime DESC LIMIT ? OFFSET ?`;
|
|
1350
1354
|
return {
|
|
1351
1355
|
sql,
|
|
@@ -1408,10 +1412,16 @@ const createLogAccessor = (context) => {
|
|
|
1408
1412
|
}
|
|
1409
1413
|
const listWorkflows = async (limit, offset, filter, options) => {
|
|
1410
1414
|
const { sql, bindings } = buildFilteredWorkflowQuery(filter, { ignoreTenant: options?.ignoreTenant });
|
|
1411
|
-
|
|
1415
|
+
const debugStartTime = options?.debugLogs ? Date.now() : 0;
|
|
1416
|
+
if (options?.debugLogs) console.log("listWorkflows SQL:", sql, "Bindings:", JSON.stringify([
|
|
1417
|
+
...bindings,
|
|
1418
|
+
limit,
|
|
1419
|
+
offset
|
|
1420
|
+
]));
|
|
1412
1421
|
const result = await retryD1Operation(() => context.D1.prepare(sql).bind(...bindings, limit, offset).all(), context.retryConfig);
|
|
1413
|
-
if (options?.debugLogs) console.log(
|
|
1422
|
+
if (options?.debugLogs) console.log(`listWorkflows SQL Query executed in ${Date.now() - debugStartTime}ms, rows: ${result.results?.length ?? 0}`);
|
|
1414
1423
|
if (result.results) {
|
|
1424
|
+
const deserializeStart = options?.debugLogs ? Date.now() : 0;
|
|
1415
1425
|
const workflows = await Promise.all(result.results.map((row) => workflowTableRowToWorkflowRun({
|
|
1416
1426
|
row,
|
|
1417
1427
|
serializer: internalSerializer,
|
|
@@ -1419,6 +1429,7 @@ const createLogAccessor = (context) => {
|
|
|
1419
1429
|
populateInput: options?.populateInput,
|
|
1420
1430
|
populateResult: options?.populateResult
|
|
1421
1431
|
})));
|
|
1432
|
+
if (options?.debugLogs) console.log(`listWorkflows deserialization completed in ${Date.now() - deserializeStart}ms`);
|
|
1422
1433
|
if (options?.populateProperties && workflows.length > 0) {
|
|
1423
1434
|
const instanceIds = workflows.map((w) => w.instanceId);
|
|
1424
1435
|
const BATCH_SIZE = 80;
|