@mastra/inngest 0.10.2-alpha.0 → 0.10.2-alpha.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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/inngest@0.10.2-alpha.0 build /home/runner/work/mastra/mastra/workflows/inngest
2
+ > @mastra/inngest@0.10.2-alpha.2 build /home/runner/work/mastra/mastra/workflows/inngest
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.4.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 7452ms
9
+ TSC ⚡️ Build success in 7766ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/workflows/inngest/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/workflows/inngest/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 5987ms
16
+ DTS ⚡️ Build success in 5836ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 22.10 KB
21
- ESM ⚡️ Build success in 338ms
22
- CJS dist/index.cjs 22.24 KB
23
- CJS ⚡️ Build success in 339ms
20
+ CJS dist/index.cjs 22.66 KB
21
+ CJS ⚡️ Build success in 310ms
22
+ ESM dist/index.js 22.51 KB
23
+ ESM ⚡️ Build success in 311ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @mastra/inngest
2
2
 
3
+ ## 0.10.2-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 12b7002: Add serializedStepGraph to workflow run snapshot in storage
8
+ - Updated dependencies [c5bf1ce]
9
+ - Updated dependencies [12b7002]
10
+ - @mastra/core@0.10.2-alpha.4
11
+
12
+ ## 0.10.2-alpha.1
13
+
14
+ ### Patch Changes
15
+
16
+ - 195c428: Add runId to step execute fn
17
+ - Updated dependencies [ab5adbe]
18
+ - Updated dependencies [195c428]
19
+ - Updated dependencies [f73e11b]
20
+ - @mastra/core@0.10.2-alpha.3
21
+
3
22
  ## 0.10.2-alpha.0
4
23
 
5
24
  ### Patch Changes
@@ -14,6 +14,7 @@ import { InngestMiddleware } from 'inngest';
14
14
  import type { Mastra } from '@mastra/core';
15
15
  import { Run } from '@mastra/core/workflows';
16
16
  import { RuntimeContext } from '@mastra/core/di';
17
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
17
18
  import { serve as serve_2 } from 'inngest/hono';
18
19
  import type { Span } from '@opentelemetry/api';
19
20
  import type { Step } from '@mastra/core/workflows';
@@ -84,13 +85,14 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
84
85
  };
85
86
  runtimeContext: RuntimeContext;
86
87
  }): Promise<StepResult<any, any, any, any>>;
87
- persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
88
+ persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, }: {
88
89
  workflowId: string;
89
90
  runId: string;
90
91
  stepResults: Record<string, StepResult<any, any, any, any>>;
92
+ serializedStepGraph: SerializedStepFlowEntry[];
91
93
  executionContext: ExecutionContext;
92
94
  }): Promise<void>;
93
- executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
95
+ executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
94
96
  workflowId: string;
95
97
  runId: string;
96
98
  entry: {
@@ -99,6 +101,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
99
101
  conditions: ExecuteFunction<any, any, any, any>[];
100
102
  };
101
103
  prevStep: StepFlowEntry;
104
+ serializedStepGraph: SerializedStepFlowEntry[];
102
105
  prevOutput: any;
103
106
  stepResults: Record<string, StepResult<any, any, any, any>>;
104
107
  resume?: {
@@ -118,11 +121,13 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
118
121
  export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
119
122
  #private;
120
123
  private inngest;
124
+ serializedStepGraph: SerializedStepFlowEntry[];
121
125
  constructor(params: {
122
126
  workflowId: string;
123
127
  runId: string;
124
128
  executionEngine: ExecutionEngine;
125
129
  executionGraph: ExecutionGraph;
130
+ serializedStepGraph: SerializedStepFlowEntry[];
126
131
  mastra?: Mastra;
127
132
  retryConfig?: {
128
133
  attempts?: number;
@@ -14,6 +14,7 @@ import { InngestMiddleware } from 'inngest';
14
14
  import type { Mastra } from '@mastra/core';
15
15
  import { Run } from '@mastra/core/workflows';
16
16
  import { RuntimeContext } from '@mastra/core/di';
17
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
17
18
  import { serve as serve_2 } from 'inngest/hono';
18
19
  import type { Span } from '@opentelemetry/api';
19
20
  import type { Step } from '@mastra/core/workflows';
@@ -84,13 +85,14 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
84
85
  };
85
86
  runtimeContext: RuntimeContext;
86
87
  }): Promise<StepResult<any, any, any, any>>;
87
- persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
88
+ persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, }: {
88
89
  workflowId: string;
89
90
  runId: string;
90
91
  stepResults: Record<string, StepResult<any, any, any, any>>;
92
+ serializedStepGraph: SerializedStepFlowEntry[];
91
93
  executionContext: ExecutionContext;
92
94
  }): Promise<void>;
93
- executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
95
+ executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
94
96
  workflowId: string;
95
97
  runId: string;
96
98
  entry: {
@@ -99,6 +101,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
99
101
  conditions: ExecuteFunction<any, any, any, any>[];
100
102
  };
101
103
  prevStep: StepFlowEntry;
104
+ serializedStepGraph: SerializedStepFlowEntry[];
102
105
  prevOutput: any;
103
106
  stepResults: Record<string, StepResult<any, any, any, any>>;
104
107
  resume?: {
@@ -118,11 +121,13 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
118
121
  export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
119
122
  #private;
120
123
  private inngest;
124
+ serializedStepGraph: SerializedStepFlowEntry[];
121
125
  constructor(params: {
122
126
  workflowId: string;
123
127
  runId: string;
124
128
  executionEngine: ExecutionEngine;
125
129
  executionGraph: ExecutionGraph;
130
+ serializedStepGraph: SerializedStepFlowEntry[];
126
131
  mastra?: Mastra;
127
132
  retryConfig?: {
128
133
  attempts?: number;
package/dist/index.cjs CHANGED
@@ -24,10 +24,12 @@ function serve({ mastra, inngest }) {
24
24
  }
25
25
  var InngestRun = class extends workflows.Run {
26
26
  inngest;
27
+ serializedStepGraph;
27
28
  #mastra;
28
29
  constructor(params, inngest) {
29
30
  super(params);
30
31
  this.inngest = inngest;
32
+ this.serializedStepGraph = params.serializedStepGraph;
31
33
  this.#mastra = params.mastra;
32
34
  }
33
35
  async getRuns(eventId) {
@@ -58,6 +60,7 @@ var InngestRun = class extends workflows.Run {
58
60
  runId: this.runId,
59
61
  snapshot: {
60
62
  runId: this.runId,
63
+ serializedStepGraph: this.serializedStepGraph,
61
64
  value: {},
62
65
  context: {},
63
66
  activePaths: [],
@@ -190,6 +193,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
190
193
  runId: runIdToUse,
191
194
  executionEngine: this.executionEngine,
192
195
  executionGraph: this.executionGraph,
196
+ serializedStepGraph: this.serializedStepGraph,
193
197
  mastra: this.#mastra,
194
198
  retryConfig: this.retryConfig,
195
199
  cleanup: () => this.runs.delete(runIdToUse)
@@ -235,6 +239,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
235
239
  workflowId: this.id,
236
240
  runId,
237
241
  graph: this.executionGraph,
242
+ serializedStepGraph: this.serializedStepGraph,
238
243
  input: inputData,
239
244
  emitter,
240
245
  retryConfig: this.retryConfig,
@@ -557,6 +562,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
557
562
  let suspended;
558
563
  try {
559
564
  const result = await step.execute({
565
+ runId: executionContext.runId,
560
566
  mastra: this.mastra,
561
567
  runtimeContext,
562
568
  inputData: prevOutput,
@@ -620,7 +626,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
620
626
  workflowId,
621
627
  runId,
622
628
  stepResults,
623
- executionContext
629
+ executionContext,
630
+ serializedStepGraph
624
631
  }) {
625
632
  await this.inngestStep.run(
626
633
  `workflow.${workflowId}.run.${runId}.path.${JSON.stringify(executionContext.executionPath)}.stepUpdate`,
@@ -634,6 +641,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
634
641
  context: stepResults,
635
642
  activePaths: [],
636
643
  suspendedPaths: executionContext.suspendedPaths,
644
+ serializedStepGraph,
637
645
  // @ts-ignore
638
646
  timestamp: Date.now()
639
647
  }
@@ -648,6 +656,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
648
656
  prevOutput,
649
657
  prevStep,
650
658
  stepResults,
659
+ serializedStepGraph,
651
660
  resume,
652
661
  executionContext,
653
662
  emitter,
@@ -659,6 +668,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
659
668
  (cond, index) => this.inngestStep.run(`workflow.${workflowId}.conditional.${index}`, async () => {
660
669
  try {
661
670
  const result = await cond({
671
+ runId,
662
672
  mastra: this.mastra,
663
673
  runtimeContext,
664
674
  inputData: prevOutput,
@@ -695,6 +705,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
695
705
  prevStep,
696
706
  stepResults,
697
707
  resume,
708
+ serializedStepGraph,
698
709
  executionContext: {
699
710
  workflowId,
700
711
  runId,
package/dist/index.js CHANGED
@@ -22,10 +22,12 @@ function serve({ mastra, inngest }) {
22
22
  }
23
23
  var InngestRun = class extends Run {
24
24
  inngest;
25
+ serializedStepGraph;
25
26
  #mastra;
26
27
  constructor(params, inngest) {
27
28
  super(params);
28
29
  this.inngest = inngest;
30
+ this.serializedStepGraph = params.serializedStepGraph;
29
31
  this.#mastra = params.mastra;
30
32
  }
31
33
  async getRuns(eventId) {
@@ -56,6 +58,7 @@ var InngestRun = class extends Run {
56
58
  runId: this.runId,
57
59
  snapshot: {
58
60
  runId: this.runId,
61
+ serializedStepGraph: this.serializedStepGraph,
59
62
  value: {},
60
63
  context: {},
61
64
  activePaths: [],
@@ -188,6 +191,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
188
191
  runId: runIdToUse,
189
192
  executionEngine: this.executionEngine,
190
193
  executionGraph: this.executionGraph,
194
+ serializedStepGraph: this.serializedStepGraph,
191
195
  mastra: this.#mastra,
192
196
  retryConfig: this.retryConfig,
193
197
  cleanup: () => this.runs.delete(runIdToUse)
@@ -233,6 +237,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
233
237
  workflowId: this.id,
234
238
  runId,
235
239
  graph: this.executionGraph,
240
+ serializedStepGraph: this.serializedStepGraph,
236
241
  input: inputData,
237
242
  emitter,
238
243
  retryConfig: this.retryConfig,
@@ -555,6 +560,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
555
560
  let suspended;
556
561
  try {
557
562
  const result = await step.execute({
563
+ runId: executionContext.runId,
558
564
  mastra: this.mastra,
559
565
  runtimeContext,
560
566
  inputData: prevOutput,
@@ -618,7 +624,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
618
624
  workflowId,
619
625
  runId,
620
626
  stepResults,
621
- executionContext
627
+ executionContext,
628
+ serializedStepGraph
622
629
  }) {
623
630
  await this.inngestStep.run(
624
631
  `workflow.${workflowId}.run.${runId}.path.${JSON.stringify(executionContext.executionPath)}.stepUpdate`,
@@ -632,6 +639,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
632
639
  context: stepResults,
633
640
  activePaths: [],
634
641
  suspendedPaths: executionContext.suspendedPaths,
642
+ serializedStepGraph,
635
643
  // @ts-ignore
636
644
  timestamp: Date.now()
637
645
  }
@@ -646,6 +654,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
646
654
  prevOutput,
647
655
  prevStep,
648
656
  stepResults,
657
+ serializedStepGraph,
649
658
  resume,
650
659
  executionContext,
651
660
  emitter,
@@ -657,6 +666,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
657
666
  (cond, index) => this.inngestStep.run(`workflow.${workflowId}.conditional.${index}`, async () => {
658
667
  try {
659
668
  const result = await cond({
669
+ runId,
660
670
  mastra: this.mastra,
661
671
  runtimeContext,
662
672
  inputData: prevOutput,
@@ -693,6 +703,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
693
703
  prevStep,
694
704
  stepResults,
695
705
  resume,
706
+ serializedStepGraph,
696
707
  executionContext: {
697
708
  workflowId,
698
709
  runId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/inngest",
3
- "version": "0.10.2-alpha.0",
3
+ "version": "0.10.2-alpha.2",
4
4
  "description": "Mastra Inngest integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -37,9 +37,9 @@
37
37
  "tsup": "^8.4.0",
38
38
  "typescript": "^5.8.2",
39
39
  "vitest": "^2.1.9",
40
- "@internal/lint": "0.0.7",
41
- "@mastra/core": "0.10.2-alpha.2",
42
- "@mastra/deployer": "0.10.2-alpha.2"
40
+ "@mastra/deployer": "0.10.2-alpha.4",
41
+ "@mastra/core": "0.10.2-alpha.4",
42
+ "@internal/lint": "0.0.7"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@mastra/core": "^0.10.0-alpha.0"
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ import type {
13
13
  StepFlowEntry,
14
14
  StepResult,
15
15
  WorkflowResult,
16
+ SerializedStepFlowEntry,
16
17
  } from '@mastra/core/workflows';
17
18
  import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
18
19
  import type { Span } from '@opentelemetry/api';
@@ -41,6 +42,7 @@ export class InngestRun<
41
42
  TOutput extends z.ZodType<any> = z.ZodType<any>,
42
43
  > extends Run<TSteps, TInput, TOutput> {
43
44
  private inngest: Inngest;
45
+ serializedStepGraph: SerializedStepFlowEntry[];
44
46
  #mastra: Mastra;
45
47
 
46
48
  constructor(
@@ -49,6 +51,7 @@ export class InngestRun<
49
51
  runId: string;
50
52
  executionEngine: ExecutionEngine;
51
53
  executionGraph: ExecutionGraph;
54
+ serializedStepGraph: SerializedStepFlowEntry[];
52
55
  mastra?: Mastra;
53
56
  retryConfig?: {
54
57
  attempts?: number;
@@ -60,6 +63,7 @@ export class InngestRun<
60
63
  ) {
61
64
  super(params);
62
65
  this.inngest = inngest;
66
+ this.serializedStepGraph = params.serializedStepGraph;
63
67
  this.#mastra = params.mastra!;
64
68
  }
65
69
 
@@ -96,6 +100,7 @@ export class InngestRun<
96
100
  runId: this.runId,
97
101
  snapshot: {
98
102
  runId: this.runId,
103
+ serializedStepGraph: this.serializedStepGraph,
99
104
  value: {},
100
105
  context: {} as any,
101
106
  activePaths: [],
@@ -278,6 +283,7 @@ export class InngestWorkflow<
278
283
  runId: runIdToUse,
279
284
  executionEngine: this.executionEngine,
280
285
  executionGraph: this.executionGraph,
286
+ serializedStepGraph: this.serializedStepGraph,
281
287
  mastra: this.#mastra,
282
288
  retryConfig: this.retryConfig,
283
289
  cleanup: () => this.runs.delete(runIdToUse),
@@ -329,6 +335,7 @@ export class InngestWorkflow<
329
335
  workflowId: this.id,
330
336
  runId,
331
337
  graph: this.executionGraph,
338
+ serializedStepGraph: this.serializedStepGraph,
332
339
  input: inputData,
333
340
  emitter,
334
341
  retryConfig: this.retryConfig,
@@ -740,6 +747,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
740
747
  let suspended: { payload: any } | undefined;
741
748
  try {
742
749
  const result = await step.execute({
750
+ runId: executionContext.runId,
743
751
  mastra: this.mastra!,
744
752
  runtimeContext,
745
753
  inputData: prevOutput,
@@ -816,10 +824,12 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
816
824
  runId,
817
825
  stepResults,
818
826
  executionContext,
827
+ serializedStepGraph,
819
828
  }: {
820
829
  workflowId: string;
821
830
  runId: string;
822
831
  stepResults: Record<string, StepResult<any, any, any, any>>;
832
+ serializedStepGraph: SerializedStepFlowEntry[];
823
833
  executionContext: ExecutionContext;
824
834
  }) {
825
835
  await this.inngestStep.run(
@@ -834,6 +844,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
834
844
  context: stepResults as any,
835
845
  activePaths: [],
836
846
  suspendedPaths: executionContext.suspendedPaths,
847
+ serializedStepGraph,
837
848
  // @ts-ignore
838
849
  timestamp: Date.now(),
839
850
  },
@@ -849,6 +860,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
849
860
  prevOutput,
850
861
  prevStep,
851
862
  stepResults,
863
+ serializedStepGraph,
852
864
  resume,
853
865
  executionContext,
854
866
  emitter,
@@ -858,6 +870,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
858
870
  runId: string;
859
871
  entry: { type: 'conditional'; steps: StepFlowEntry[]; conditions: ExecuteFunction<any, any, any, any>[] };
860
872
  prevStep: StepFlowEntry;
873
+ serializedStepGraph: SerializedStepFlowEntry[];
861
874
  prevOutput: any;
862
875
  stepResults: Record<string, StepResult<any, any, any, any>>;
863
876
  resume?: {
@@ -877,6 +890,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
877
890
  this.inngestStep.run(`workflow.${workflowId}.conditional.${index}`, async () => {
878
891
  try {
879
892
  const result = await cond({
893
+ runId,
880
894
  mastra: this.mastra!,
881
895
  runtimeContext,
882
896
  inputData: prevOutput,
@@ -918,6 +932,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
918
932
  prevStep,
919
933
  stepResults,
920
934
  resume,
935
+ serializedStepGraph,
921
936
  executionContext: {
922
937
  workflowId,
923
938
  runId,