@mastra/convex 1.9.0-alpha.1 → 1.9.1-alpha.0
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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +4 -4
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +4 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2337,6 +2337,25 @@ var ScoresConvex = class extends ScoresStorage {
|
|
|
2337
2337
|
}
|
|
2338
2338
|
};
|
|
2339
2339
|
// src/storage/domains/workflows/index.ts
|
|
2340
|
+
/**
|
|
2341
|
+
* A stored snapshot reduced to what `listWorkflowRuns({ summary: true })` returns: `status` and
|
|
2342
|
+
* `timestamp` when set, and `parentWorkflow` only when both of its IDs are non-empty strings.
|
|
2343
|
+
* A missing snapshot reduces to `{}`. Reads the stored value in place, without a full copy.
|
|
2344
|
+
*/
|
|
2345
|
+
function summarySnapshot(stored) {
|
|
2346
|
+
const parsed = typeof stored === "string" ? JSON.parse(stored) : stored;
|
|
2347
|
+
const { status, timestamp, parentWorkflow } = parsed !== null && typeof parsed === "object" ? parsed : {};
|
|
2348
|
+
const summary = {};
|
|
2349
|
+
if (status !== void 0 && status !== null) summary.status = status;
|
|
2350
|
+
if (timestamp !== void 0 && timestamp !== null) summary.timestamp = timestamp;
|
|
2351
|
+
const workflowId = parentWorkflow?.workflowId;
|
|
2352
|
+
const runId = parentWorkflow?.runId;
|
|
2353
|
+
if (typeof workflowId === "string" && workflowId !== "" && typeof runId === "string" && runId !== "") summary.parentWorkflow = {
|
|
2354
|
+
workflowId,
|
|
2355
|
+
runId
|
|
2356
|
+
};
|
|
2357
|
+
return summary;
|
|
2358
|
+
}
|
|
2340
2359
|
var WorkflowsConvex = class WorkflowsConvex extends WorkflowsStorage {
|
|
2341
2360
|
/**
|
|
2342
2361
|
* Tables `prune()` can clean up. Run ownership records anchor on `updatedAt` (epoch ms), which every
|
|
@@ -2441,8 +2460,12 @@ var WorkflowsConvex = class WorkflowsConvex extends WorkflowsStorage {
|
|
|
2441
2460
|
if (!row) return null;
|
|
2442
2461
|
return typeof row.snapshot === "string" ? JSON.parse(row.snapshot) : JSON.parse(JSON.stringify(row.snapshot));
|
|
2443
2462
|
}
|
|
2463
|
+
/**
|
|
2464
|
+
* Lists runs newest first. With `summary`, each snapshot keeps only its status, timestamp and
|
|
2465
|
+
* parent run; the full rows are still read from Convex.
|
|
2466
|
+
*/
|
|
2444
2467
|
async listWorkflowRuns(args = {}) {
|
|
2445
|
-
const { workflowName, fromDate, toDate, perPage, page, resourceId, status } = args;
|
|
2468
|
+
const { workflowName, fromDate, toDate, perPage, page, resourceId, status, summary } = args;
|
|
2446
2469
|
const filters = [];
|
|
2447
2470
|
if (workflowName) filters.push({
|
|
2448
2471
|
field: "workflow_name",
|
|
@@ -2469,7 +2492,7 @@ var WorkflowsConvex = class WorkflowsConvex extends WorkflowsStorage {
|
|
|
2469
2492
|
runs: rows.map((run) => ({
|
|
2470
2493
|
workflowName: run.workflow_name,
|
|
2471
2494
|
runId: run.run_id,
|
|
2472
|
-
snapshot: this.ensureSnapshot(run),
|
|
2495
|
+
snapshot: summary ? summarySnapshot(run.snapshot) : this.ensureSnapshot(run),
|
|
2473
2496
|
createdAt: new Date(run.createdAt),
|
|
2474
2497
|
updatedAt: new Date(run.updatedAt),
|
|
2475
2498
|
resourceId: run.resourceId
|