@mastra/redis 1.4.1 → 1.4.2

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
@@ -1,6 +1,6 @@
1
1
  import { MessageList } from "@mastra/core/agent";
2
2
  import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
3
- import { MastraStorage, MemoryStorage, ScoresStorage, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, WorkflowsStorage, calculatePagination, createStorageErrorId, ensureDate, filterByDateRange, jsonValueEquals, normalizePerPage, serializeDate, storageMessageMatchesMetadataFilter, transformScoreRow, validateStorageMetadataFilter } from "@mastra/core/storage";
3
+ import { MastraStorage, MemoryStorage, ScoresStorage, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, WorkflowsStorage, calculatePagination, createStorageErrorId, ensureDate, filterByDateRange, jsonValueEquals, matchesExpectedWorkflowStatus, normalizePerPage, serializeDate, storageMessageMatchesMetadataFilter, transformScoreRow, validateStorageMetadataFilter } from "@mastra/core/storage";
4
4
  import crypto$1 from "crypto";
5
5
  import { saveScorePayloadSchema } from "@mastra/core/evals";
6
6
  import { createClient } from "redis";
@@ -1247,9 +1247,11 @@ var WorkflowsRedis = class extends WorkflowsStorage {
1247
1247
  });
1248
1248
  const existingSnapshot = existingRecord?.snapshot;
1249
1249
  if (!existingSnapshot || !existingSnapshot.context) return;
1250
+ const { expectedStatus, ...state } = opts;
1251
+ if (!matchesExpectedWorkflowStatus(existingSnapshot.status, expectedStatus)) return;
1250
1252
  const updatedSnapshot = {
1251
1253
  ...existingSnapshot,
1252
- ...opts
1254
+ ...state
1253
1255
  };
1254
1256
  await this.persistWorkflowSnapshot({
1255
1257
  namespace: "workflows",