@mastra/inngest 0.0.0-vnext-inngest-20250506123700 → 0.0.0-vnext-inngest-20250507093737

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/src/index.ts CHANGED
@@ -27,16 +27,17 @@ import { randomUUID } from 'crypto';
27
27
 
28
28
  import { createStep } from '@mastra/core/workflows/vNext';
29
29
 
30
- export function serve({ mastra, ingest }: { mastra: Mastra; ingest: Inngest }): ReturnType<typeof inngestServe> {
30
+ export function serve({ mastra, inngest }: { mastra: Mastra; inngest: Inngest }): ReturnType<typeof inngestServe> {
31
31
  const wfs = mastra.vnext_getWorkflows();
32
32
  const functions = Object.values(wfs).flatMap(wf => {
33
33
  if (wf instanceof InngestWorkflow) {
34
+ wf.__registerMastra(mastra);
34
35
  return wf.getFunctions();
35
36
  }
36
37
  return [];
37
38
  });
38
39
  return inngestServe({
39
- client: ingest,
40
+ client: inngest,
40
41
  functions,
41
42
  });
42
43
  }
@@ -203,12 +204,22 @@ export class InngestWorkflow<
203
204
  __registerMastra(mastra: Mastra) {
204
205
  this.#mastra = mastra;
205
206
  this.executionEngine.__registerMastra(mastra);
207
+ const updateNested = (step: StepFlowEntry) => {
208
+ if (
209
+ (step.type === 'step' || step.type === 'loop' || step.type === 'foreach') &&
210
+ step.step instanceof InngestWorkflow
211
+ ) {
212
+ step.step.__registerMastra(mastra);
213
+ } else if (step.type === 'parallel' || step.type === 'conditional') {
214
+ for (const subStep of step.steps) {
215
+ updateNested(subStep);
216
+ }
217
+ }
218
+ };
206
219
 
207
220
  if (this.executionGraph.steps.length) {
208
221
  for (const step of this.executionGraph.steps) {
209
- if (step.type === 'step' && step.step instanceof InngestWorkflow) {
210
- step.step.__registerMastra(mastra);
211
- }
222
+ updateNested(step);
212
223
  }
213
224
  }
214
225
  }