@mastra/dynamodb 1.3.0 → 1.3.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
@@ -1,7 +1,7 @@
1
1
  import { DescribeTableCommand, DynamoDBClient } from "@aws-sdk/client-dynamodb";
2
2
  import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
3
3
  import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
4
- import { BackgroundTasksStorage, MastraCompositeStore, MemoryStorage, SCORERS_SCHEMA, ScoresStorage, TABLE_BACKGROUND_TASKS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, WorkflowsStorage, calculatePagination, createStorageErrorId, normalizePerPage, storageMessageMatchesMetadataFilter, validateStorageMetadataFilter } from "@mastra/core/storage";
4
+ import { BackgroundTasksStorage, MastraCompositeStore, MemoryStorage, SCORERS_SCHEMA, ScoresStorage, TABLE_BACKGROUND_TASKS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, WorkflowsStorage, calculatePagination, createStorageErrorId, matchesExpectedWorkflowStatus, normalizePerPage, storageMessageMatchesMetadataFilter, validateStorageMetadataFilter } from "@mastra/core/storage";
5
5
  import { Entity, Service } from "electrodb";
6
6
  import { MessageList } from "@mastra/core/agent";
7
7
  import { saveScorePayloadSchema } from "@mastra/core/evals";
@@ -2681,9 +2681,11 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2681
2681
  const existingSnapshot = existingRecord.data.snapshot;
2682
2682
  if (!existingSnapshot || !existingSnapshot.context) return;
2683
2683
  const previousUpdatedAt = existingRecord.data.updatedAt;
2684
+ const { expectedStatus, ...state } = opts;
2685
+ if (!matchesExpectedWorkflowStatus(existingSnapshot.status, expectedStatus)) return;
2684
2686
  const updatedSnapshot = {
2685
2687
  ...existingSnapshot,
2686
- ...opts
2688
+ ...state
2687
2689
  };
2688
2690
  const now = /* @__PURE__ */ new Date();
2689
2691
  const data = {