@mastra/convex 1.6.0 → 1.6.1-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
@@ -393,13 +393,19 @@ var ConvexDB = class extends MastraBase {
393
393
  return JSON.parse(context);
394
394
  }
395
395
  async mergeWorkflowState({ workflowName, runId, opts }) {
396
- const snapshot = await this.client.callStorage({
397
- op: "mergeWorkflowState",
398
- tableName: TABLE_WORKFLOW_SNAPSHOT$1,
399
- workflowName,
400
- runId,
401
- opts: JSON.stringify(opts)
402
- });
396
+ let snapshot;
397
+ try {
398
+ snapshot = await this.client.callStorage({
399
+ op: "mergeWorkflowState",
400
+ tableName: TABLE_WORKFLOW_SNAPSHOT$1,
401
+ workflowName,
402
+ runId,
403
+ opts: JSON.stringify(opts)
404
+ });
405
+ } catch (error) {
406
+ if (error instanceof Error && error.message.startsWith("Workflow snapshot not found for runId")) return;
407
+ throw error;
408
+ }
403
409
  if (snapshot === "") return;
404
410
  if (!snapshot) throw new Error(`Convex workflow state merge returned no snapshot for runId ${runId}`);
405
411
  return JSON.parse(snapshot);