@mastra/upstash 0.15.9-alpha.0 → 0.15.10-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/index.js CHANGED
@@ -1715,7 +1715,8 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
1715
1715
  toDate,
1716
1716
  limit,
1717
1717
  offset,
1718
- resourceId
1718
+ resourceId,
1719
+ status
1719
1720
  }) {
1720
1721
  try {
1721
1722
  let pattern = getKey(TABLE_WORKFLOW_SNAPSHOT, { namespace: "workflows" }) + ":*";
@@ -1748,6 +1749,18 @@ var WorkflowsUpstash = class extends WorkflowsStorage {
1748
1749
  ).filter((record) => !workflowName || record.workflow_name === workflowName).map((w) => parseWorkflowRun(w)).filter((w) => {
1749
1750
  if (fromDate && w.createdAt < fromDate) return false;
1750
1751
  if (toDate && w.createdAt > toDate) return false;
1752
+ if (status) {
1753
+ let snapshot = w.snapshot;
1754
+ if (typeof snapshot === "string") {
1755
+ try {
1756
+ snapshot = JSON.parse(snapshot);
1757
+ } catch (e) {
1758
+ console.warn(`Failed to parse snapshot for workflow ${w.workflowName}: ${e}`);
1759
+ return false;
1760
+ }
1761
+ }
1762
+ return snapshot.status === status;
1763
+ }
1751
1764
  return true;
1752
1765
  }).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
1753
1766
  const total = runs.length;
@@ -1930,15 +1943,8 @@ var UpstashStore = class extends MastraStorage {
1930
1943
  async loadWorkflowSnapshot(params) {
1931
1944
  return this.stores.workflows.loadWorkflowSnapshot(params);
1932
1945
  }
1933
- async getWorkflowRuns({
1934
- workflowName,
1935
- fromDate,
1936
- toDate,
1937
- limit,
1938
- offset,
1939
- resourceId
1940
- } = {}) {
1941
- return this.stores.workflows.getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId });
1946
+ async getWorkflowRuns(args = {}) {
1947
+ return this.stores.workflows.getWorkflowRuns(args);
1942
1948
  }
1943
1949
  async getWorkflowRunById({
1944
1950
  runId,