@mastra/upstash 1.0.0-beta.0 → 1.0.0-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 CHANGED
@@ -1378,7 +1378,8 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
1378
1378
  toDate,
1379
1379
  perPage,
1380
1380
  page,
1381
- resourceId
1381
+ resourceId,
1382
+ status
1382
1383
  }) {
1383
1384
  try {
1384
1385
  if (page !== void 0 && page < 0) {
@@ -1422,6 +1423,18 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
1422
1423
  ).filter((record) => !workflowName || record.workflow_name === workflowName).map((w) => parseWorkflowRun(w)).filter((w) => {
1423
1424
  if (fromDate && w.createdAt < fromDate) return false;
1424
1425
  if (toDate && w.createdAt > toDate) return false;
1426
+ if (status) {
1427
+ let snapshot = w.snapshot;
1428
+ if (typeof snapshot === "string") {
1429
+ try {
1430
+ snapshot = JSON.parse(snapshot);
1431
+ } catch (e) {
1432
+ console.warn(`Failed to parse snapshot for workflow ${w.workflowName}: ${e}`);
1433
+ return false;
1434
+ }
1435
+ }
1436
+ return snapshot.status === status;
1437
+ }
1425
1438
  return true;
1426
1439
  }).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
1427
1440
  const total = runs.length;
@@ -1554,15 +1567,8 @@ var UpstashStore = class extends MastraStorage {
1554
1567
  async loadWorkflowSnapshot(params) {
1555
1568
  return this.stores.workflows.loadWorkflowSnapshot(params);
1556
1569
  }
1557
- async listWorkflowRuns({
1558
- workflowName,
1559
- fromDate,
1560
- toDate,
1561
- perPage,
1562
- page,
1563
- resourceId
1564
- } = {}) {
1565
- return this.stores.workflows.listWorkflowRuns({ workflowName, fromDate, toDate, perPage, page, resourceId });
1570
+ async listWorkflowRuns(args = {}) {
1571
+ return this.stores.workflows.listWorkflowRuns(args);
1566
1572
  }
1567
1573
  async getWorkflowRunById({
1568
1574
  runId,