@mastra/dsql 1.3.1 → 1.3.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 { AuroraDSQLClient } from "@aws/aurora-dsql-node-postgres-connector";
2
2
  import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
3
- import { AgentsStorage, MastraStorage, MemoryStorage, ObservabilityStorage, ScoresStorage, TABLE_AGENTS, TABLE_AGENT_VERSIONS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCHEMAS, TABLE_SCORERS, TABLE_SPANS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, TraceStatus, WorkflowsStorage, calculatePagination, createStorageErrorId, getDefaultValue, getSqlType, listTracesArgsSchema, normalizePerPage, storageMessageMatchesMetadataFilter, toTraceSpans, transformScoreRow, validateStorageMetadataFilter } from "@mastra/core/storage";
3
+ import { AgentsStorage, MastraStorage, MemoryStorage, ObservabilityStorage, ScoresStorage, TABLE_AGENTS, TABLE_AGENT_VERSIONS, TABLE_MESSAGES, TABLE_RESOURCES, TABLE_SCHEMAS, TABLE_SCORERS, TABLE_SPANS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, TraceStatus, WorkflowsStorage, calculatePagination, createStorageErrorId, getDefaultValue, getSqlType, listTracesArgsSchema, matchesExpectedWorkflowStatus, normalizePerPage, storageMessageMatchesMetadataFilter, toTraceSpans, transformScoreRow, validateStorageMetadataFilter } from "@mastra/core/storage";
4
4
  import { Pool } from "pg";
5
5
  import { MastraBase } from "@mastra/core/base";
6
6
  import { parseSqlIdentifier } from "@mastra/core/utils";
@@ -3769,9 +3769,11 @@ var WorkflowsDSQL = class WorkflowsDSQL extends WorkflowsStorage {
3769
3769
  const existingSnapshot = existingSnapshotResult.snapshot;
3770
3770
  const snapshot = typeof existingSnapshot === "string" ? JSON.parse(existingSnapshot) : existingSnapshot;
3771
3771
  if (!snapshot || !snapshot?.context) throw new Error(`Snapshot not found for runId ${runId}`);
3772
+ const { expectedStatus, ...state } = opts;
3773
+ if (!matchesExpectedWorkflowStatus(snapshot.status, expectedStatus)) return;
3772
3774
  const updatedSnapshot = {
3773
3775
  ...snapshot,
3774
- ...opts
3776
+ ...state
3775
3777
  };
3776
3778
  await t.none(`UPDATE ${tableName} SET snapshot = $1, "updatedAt" = $2 WHERE workflow_name = $3 AND run_id = $4`, [
3777
3779
  JSON.stringify(updatedSnapshot),