@brandboostinggmbh/observable-workflows 0.20.1-beta.1 → 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.js +12 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1223,10 +1223,11 @@ const createLogAccessor = (context) => {
|
|
|
1223
1223
|
const bindings = [];
|
|
1224
1224
|
const whereConditions = [];
|
|
1225
1225
|
let joinClause = "";
|
|
1226
|
-
|
|
1226
|
+
let hasPropertyJoins = false;
|
|
1227
1227
|
const fromClause = "FROM WorkflowTable w";
|
|
1228
1228
|
const propertyWhereConditions = [];
|
|
1229
1229
|
if (filter && filter.properties && Object.keys(filter.properties).length > 0) {
|
|
1230
|
+
hasPropertyJoins = true;
|
|
1230
1231
|
let propIndex = 0;
|
|
1231
1232
|
for (const [key, propertyFilter] of Object.entries(filter.properties)) {
|
|
1232
1233
|
const propAlias = `p${propIndex}`;
|
|
@@ -1348,6 +1349,7 @@ const createLogAccessor = (context) => {
|
|
|
1348
1349
|
}
|
|
1349
1350
|
}
|
|
1350
1351
|
const whereClause = whereConditions.length > 0 ? `WHERE ${whereConditions.join(" AND ")}` : "";
|
|
1352
|
+
const selectClause = hasPropertyJoins ? "SELECT DISTINCT w.*" : "SELECT w.*";
|
|
1351
1353
|
const sql = `${selectClause} ${fromClause}${joinClause} ${whereClause} ORDER BY w.startTime DESC LIMIT ? OFFSET ?`;
|
|
1352
1354
|
return {
|
|
1353
1355
|
sql,
|
|
@@ -1410,10 +1412,16 @@ const createLogAccessor = (context) => {
|
|
|
1410
1412
|
}
|
|
1411
1413
|
const listWorkflows = async (limit, offset, filter, options) => {
|
|
1412
1414
|
const { sql, bindings } = buildFilteredWorkflowQuery(filter, { ignoreTenant: options?.ignoreTenant });
|
|
1413
|
-
|
|
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
|
+
]));
|
|
1414
1421
|
const result = await retryD1Operation(() => context.D1.prepare(sql).bind(...bindings, limit, offset).all(), context.retryConfig);
|
|
1415
|
-
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}`);
|
|
1416
1423
|
if (result.results) {
|
|
1424
|
+
const deserializeStart = options?.debugLogs ? Date.now() : 0;
|
|
1417
1425
|
const workflows = await Promise.all(result.results.map((row) => workflowTableRowToWorkflowRun({
|
|
1418
1426
|
row,
|
|
1419
1427
|
serializer: internalSerializer,
|
|
@@ -1421,6 +1429,7 @@ const createLogAccessor = (context) => {
|
|
|
1421
1429
|
populateInput: options?.populateInput,
|
|
1422
1430
|
populateResult: options?.populateResult
|
|
1423
1431
|
})));
|
|
1432
|
+
if (options?.debugLogs) console.log(`listWorkflows deserialization completed in ${Date.now() - deserializeStart}ms`);
|
|
1424
1433
|
if (options?.populateProperties && workflows.length > 0) {
|
|
1425
1434
|
const instanceIds = workflows.map((w) => w.instanceId);
|
|
1426
1435
|
const BATCH_SIZE = 80;
|