@mastra/inngest 0.0.0-fix-11329-windows-path-20251222155941 → 0.0.0-fix-local-pkg-cwd-20251226155239

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
@@ -175,7 +175,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
175
175
  try {
176
176
  if (isResume) {
177
177
  runId = stepResults[resume?.steps?.[0] ?? ""]?.suspendPayload?.__workflow_meta?.runId ?? randomUUID();
178
- const snapshot = await this.mastra?.getStorage()?.loadWorkflowSnapshot({
178
+ const workflowsStore = await this.mastra?.getStorage()?.getStore("workflows");
179
+ const snapshot = await workflowsStore?.loadWorkflowSnapshot({
179
180
  workflowName: step.id,
180
181
  runId
181
182
  });
@@ -200,7 +201,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
200
201
  runId = invokeResp.runId;
201
202
  executionContext.state = invokeResp.result.state;
202
203
  } else if (isTimeTravel) {
203
- const snapshot = await this.mastra?.getStorage()?.loadWorkflowSnapshot({
204
+ const workflowsStoreForTimeTravel = await this.mastra?.getStorage()?.getStore("workflows");
205
+ const snapshot = await workflowsStoreForTimeTravel?.loadWorkflowSnapshot({
204
206
  workflowName: step.id,
205
207
  runId: executionContext.runId
206
208
  }) ?? { context: {} };
@@ -558,6 +560,7 @@ var InngestRun = class extends Run {
558
560
  async getRunOutput(eventId, maxWaitMs = 3e5) {
559
561
  const startTime = Date.now();
560
562
  const storage = this.#mastra?.getStorage();
563
+ const workflowsStore = await storage?.getStore("workflows");
561
564
  while (Date.now() - startTime < maxWaitMs) {
562
565
  let runs;
563
566
  try {
@@ -574,7 +577,7 @@ var InngestRun = class extends Run {
574
577
  return runs[0];
575
578
  }
576
579
  if (runs?.[0]?.status === "Failed") {
577
- const snapshot = await storage?.loadWorkflowSnapshot({
580
+ const snapshot = await workflowsStore?.loadWorkflowSnapshot({
578
581
  workflowName: this.workflowId,
579
582
  runId: this.runId
580
583
  });
@@ -593,7 +596,7 @@ var InngestRun = class extends Run {
593
596
  };
594
597
  }
595
598
  if (runs?.[0]?.status === "Cancelled") {
596
- const snapshot = await storage?.loadWorkflowSnapshot({
599
+ const snapshot = await workflowsStore?.loadWorkflowSnapshot({
597
600
  workflowName: this.workflowId,
598
601
  runId: this.runId
599
602
  });
@@ -611,12 +614,13 @@ var InngestRun = class extends Run {
611
614
  runId: this.runId
612
615
  }
613
616
  });
614
- const snapshot = await storage?.loadWorkflowSnapshot({
617
+ const workflowsStore = await storage?.getStore("workflows");
618
+ const snapshot = await workflowsStore?.loadWorkflowSnapshot({
615
619
  workflowName: this.workflowId,
616
620
  runId: this.runId
617
621
  });
618
622
  if (snapshot) {
619
- await storage?.persistWorkflowSnapshot({
623
+ await workflowsStore?.persistWorkflowSnapshot({
620
624
  workflowName: this.workflowId,
621
625
  runId: this.runId,
622
626
  resourceId: this.resourceId,
@@ -638,7 +642,8 @@ var InngestRun = class extends Run {
638
642
  * Use this when you don't need to wait for the result or want to avoid polling failures.
639
643
  */
640
644
  async startAsync(params) {
641
- await this.#mastra.getStorage()?.persistWorkflowSnapshot({
645
+ const workflowsStore = await this.#mastra.getStorage()?.getStore("workflows");
646
+ await workflowsStore?.persistWorkflowSnapshot({
642
647
  workflowName: this.workflowId,
643
648
  runId: this.runId,
644
649
  resourceId: this.resourceId,
@@ -686,7 +691,8 @@ var InngestRun = class extends Run {
686
691
  requestContext,
687
692
  perStep
688
693
  }) {
689
- await this.#mastra.getStorage()?.persistWorkflowSnapshot({
694
+ const workflowsStore = await this.#mastra.getStorage()?.getStore("workflows");
695
+ await workflowsStore?.persistWorkflowSnapshot({
690
696
  workflowName: this.workflowId,
691
697
  runId: this.runId,
692
698
  resourceId: this.resourceId,
@@ -753,7 +759,8 @@ var InngestRun = class extends Run {
753
759
  (step) => typeof step === "string" ? step : step?.id
754
760
  );
755
761
  }
756
- const snapshot = await storage?.loadWorkflowSnapshot({
762
+ const workflowsStore = await storage?.getStore("workflows");
763
+ const snapshot = await workflowsStore?.loadWorkflowSnapshot({
757
764
  workflowName: this.workflowId,
758
765
  runId: this.runId
759
766
  });
@@ -816,12 +823,13 @@ var InngestRun = class extends Run {
816
823
  throw new Error("No steps provided to timeTravel");
817
824
  }
818
825
  const storage = this.#mastra?.getStorage();
819
- const snapshot = await storage?.loadWorkflowSnapshot({
826
+ const workflowsStore = await storage?.getStore("workflows");
827
+ const snapshot = await workflowsStore?.loadWorkflowSnapshot({
820
828
  workflowName: this.workflowId,
821
829
  runId: this.runId
822
830
  });
823
831
  if (!snapshot) {
824
- await storage?.persistWorkflowSnapshot({
832
+ await workflowsStore?.persistWorkflowSnapshot({
825
833
  workflowName: this.workflowId,
826
834
  runId: this.runId,
827
835
  resourceId: this.resourceId,
@@ -855,7 +863,8 @@ var InngestRun = class extends Run {
855
863
  nestedStepsContext: params.nestedStepsContext,
856
864
  snapshot: snapshot ?? { context: {} },
857
865
  graph: this.executionGraph,
858
- initialState: params.initialState
866
+ initialState: params.initialState,
867
+ perStep: params.perStep
859
868
  });
860
869
  const eventOutput = await this.inngest.send({
861
870
  name: `workflow.${this.workflowId}`,
@@ -1139,7 +1148,11 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1139
1148
  this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
1140
1149
  return { runs: [], total: 0 };
1141
1150
  }
1142
- return storage.listWorkflowRuns({ workflowName: this.id, ...args ?? {} });
1151
+ const workflowsStore = await storage.getStore("workflows");
1152
+ if (!workflowsStore) {
1153
+ return { runs: [], total: 0 };
1154
+ }
1155
+ return workflowsStore.listWorkflowRuns({ workflowName: this.id, ...args ?? {} });
1143
1156
  }
1144
1157
  async getWorkflowRunById(runId) {
1145
1158
  const storage = this.#mastra?.getStorage();
@@ -1147,7 +1160,11 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1147
1160
  this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
1148
1161
  return this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null;
1149
1162
  }
1150
- const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
1163
+ const workflowsStore = await storage.getStore("workflows");
1164
+ if (!workflowsStore) {
1165
+ return this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null;
1166
+ }
1167
+ const run = await workflowsStore.getWorkflowRunById({ runId, workflowName: this.id });
1151
1168
  return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
1152
1169
  }
1153
1170
  __registerMastra(mastra) {
@@ -1197,7 +1214,8 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1197
1214
  withNestedWorkflows: false
1198
1215
  });
1199
1216
  if (!workflowSnapshotInStorage && shouldPersistSnapshot) {
1200
- await this.mastra?.getStorage()?.persistWorkflowSnapshot({
1217
+ const workflowsStore = await this.mastra?.getStorage()?.getStore("workflows");
1218
+ await workflowsStore?.persistWorkflowSnapshot({
1201
1219
  workflowName: this.id,
1202
1220
  runId: runIdToUse,
1203
1221
  resourceId: options?.resourceId,