@mastra/inngest 0.10.0 → 0.10.1
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +34 -0
- package/dist/_tsup-dts-rollup.d.cts +9 -9
- package/dist/_tsup-dts-rollup.d.ts +9 -9
- package/dist/index.cjs +2 -1
- package/dist/index.js +2 -1
- package/package.json +4 -4
- package/src/index.test.ts +46 -53
- package/src/index.ts +15 -14
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/inngest@0.10.
|
|
2
|
+
> @mastra/inngest@0.10.1-alpha.0 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
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 7201ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/workflows/inngest/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/workflows/inngest/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 6590ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m22.24 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 238ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m22.10 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 338ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 0.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 200d0da: Return payload data, start time, end time, resume time and suspend time for each step in workflow state
|
|
8
|
+
Return error stack for failed workflow runs
|
|
9
|
+
- 5343f93: Move emitter to symbol to make private
|
|
10
|
+
- Updated dependencies [d70b807]
|
|
11
|
+
- Updated dependencies [6d16390]
|
|
12
|
+
- Updated dependencies [1e4a421]
|
|
13
|
+
- Updated dependencies [200d0da]
|
|
14
|
+
- Updated dependencies [bf5f17b]
|
|
15
|
+
- Updated dependencies [5343f93]
|
|
16
|
+
- Updated dependencies [38aee50]
|
|
17
|
+
- Updated dependencies [5c41100]
|
|
18
|
+
- Updated dependencies [d6a759b]
|
|
19
|
+
- Updated dependencies [6015bdf]
|
|
20
|
+
- @mastra/core@0.10.1
|
|
21
|
+
|
|
22
|
+
## 0.10.1-alpha.0
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 200d0da: Return payload data, start time, end time, resume time and suspend time for each step in workflow state
|
|
27
|
+
Return error stack for failed workflow runs
|
|
28
|
+
- 5343f93: Move emitter to symbol to make private
|
|
29
|
+
- Updated dependencies [200d0da]
|
|
30
|
+
- Updated dependencies [bf5f17b]
|
|
31
|
+
- Updated dependencies [5343f93]
|
|
32
|
+
- Updated dependencies [38aee50]
|
|
33
|
+
- Updated dependencies [5c41100]
|
|
34
|
+
- Updated dependencies [d6a759b]
|
|
35
|
+
- @mastra/core@0.10.1-alpha.1
|
|
36
|
+
|
|
3
37
|
## 0.10.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
|
@@ -43,12 +43,12 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
43
43
|
constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
|
|
44
44
|
protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
|
|
45
45
|
emit: (event: string, data: any) => Promise<void>;
|
|
46
|
-
}, stepResults: Record<string, StepResult<any>>, lastOutput: StepResult<any>, error?: Error | string): Promise<TOutput>;
|
|
46
|
+
}, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
|
|
47
47
|
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
48
48
|
workflowId: string;
|
|
49
49
|
runId: string;
|
|
50
50
|
step: Step<string, any, any>;
|
|
51
|
-
stepResults: Record<string, StepResult<any>>;
|
|
51
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
52
52
|
executionContext: ExecutionContext;
|
|
53
53
|
resume?: {
|
|
54
54
|
steps: string[];
|
|
@@ -59,10 +59,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
59
59
|
emit: (event: string, data: any) => Promise<void>;
|
|
60
60
|
};
|
|
61
61
|
runtimeContext: RuntimeContext;
|
|
62
|
-
}): Promise<StepResult<any>>;
|
|
62
|
+
}): Promise<StepResult<any, any, any, any>>;
|
|
63
63
|
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
64
64
|
step: Step<string, any, any>;
|
|
65
|
-
stepResults: Record<string, StepResult<any>>;
|
|
65
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
66
66
|
executionContext: {
|
|
67
67
|
workflowId: string;
|
|
68
68
|
runId: string;
|
|
@@ -83,11 +83,11 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
83
83
|
emit: (event: string, data: any) => Promise<void>;
|
|
84
84
|
};
|
|
85
85
|
runtimeContext: RuntimeContext;
|
|
86
|
-
}): Promise<StepResult<any>>;
|
|
86
|
+
}): Promise<StepResult<any, any, any, any>>;
|
|
87
87
|
persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
|
|
88
88
|
workflowId: string;
|
|
89
89
|
runId: string;
|
|
90
|
-
stepResults: Record<string, StepResult<any>>;
|
|
90
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
91
91
|
executionContext: ExecutionContext;
|
|
92
92
|
}): Promise<void>;
|
|
93
93
|
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
@@ -100,10 +100,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
100
100
|
};
|
|
101
101
|
prevStep: StepFlowEntry;
|
|
102
102
|
prevOutput: any;
|
|
103
|
-
stepResults: Record<string, StepResult<any>>;
|
|
103
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
104
104
|
resume?: {
|
|
105
105
|
steps: string[];
|
|
106
|
-
stepResults: Record<string, StepResult<any>>;
|
|
106
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
107
107
|
resumePayload: any;
|
|
108
108
|
resumePath: number[];
|
|
109
109
|
};
|
|
@@ -112,7 +112,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
112
112
|
emit: (event: string, data: any) => Promise<void>;
|
|
113
113
|
};
|
|
114
114
|
runtimeContext: RuntimeContext;
|
|
115
|
-
}): Promise<StepResult<any>>;
|
|
115
|
+
}): Promise<StepResult<any, any, any, any>>;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
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> {
|
|
@@ -43,12 +43,12 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
43
43
|
constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
|
|
44
44
|
protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
|
|
45
45
|
emit: (event: string, data: any) => Promise<void>;
|
|
46
|
-
}, stepResults: Record<string, StepResult<any>>, lastOutput: StepResult<any>, error?: Error | string): Promise<TOutput>;
|
|
46
|
+
}, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
|
|
47
47
|
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
48
48
|
workflowId: string;
|
|
49
49
|
runId: string;
|
|
50
50
|
step: Step<string, any, any>;
|
|
51
|
-
stepResults: Record<string, StepResult<any>>;
|
|
51
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
52
52
|
executionContext: ExecutionContext;
|
|
53
53
|
resume?: {
|
|
54
54
|
steps: string[];
|
|
@@ -59,10 +59,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
59
59
|
emit: (event: string, data: any) => Promise<void>;
|
|
60
60
|
};
|
|
61
61
|
runtimeContext: RuntimeContext;
|
|
62
|
-
}): Promise<StepResult<any>>;
|
|
62
|
+
}): Promise<StepResult<any, any, any, any>>;
|
|
63
63
|
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
64
64
|
step: Step<string, any, any>;
|
|
65
|
-
stepResults: Record<string, StepResult<any>>;
|
|
65
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
66
66
|
executionContext: {
|
|
67
67
|
workflowId: string;
|
|
68
68
|
runId: string;
|
|
@@ -83,11 +83,11 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
83
83
|
emit: (event: string, data: any) => Promise<void>;
|
|
84
84
|
};
|
|
85
85
|
runtimeContext: RuntimeContext;
|
|
86
|
-
}): Promise<StepResult<any>>;
|
|
86
|
+
}): Promise<StepResult<any, any, any, any>>;
|
|
87
87
|
persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
|
|
88
88
|
workflowId: string;
|
|
89
89
|
runId: string;
|
|
90
|
-
stepResults: Record<string, StepResult<any>>;
|
|
90
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
91
91
|
executionContext: ExecutionContext;
|
|
92
92
|
}): Promise<void>;
|
|
93
93
|
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
|
|
@@ -100,10 +100,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
100
100
|
};
|
|
101
101
|
prevStep: StepFlowEntry;
|
|
102
102
|
prevOutput: any;
|
|
103
|
-
stepResults: Record<string, StepResult<any>>;
|
|
103
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
104
104
|
resume?: {
|
|
105
105
|
steps: string[];
|
|
106
|
-
stepResults: Record<string, StepResult<any>>;
|
|
106
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
107
107
|
resumePayload: any;
|
|
108
108
|
resumePath: number[];
|
|
109
109
|
};
|
|
@@ -112,7 +112,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
112
112
|
emit: (event: string, data: any) => Promise<void>;
|
|
113
113
|
};
|
|
114
114
|
runtimeContext: RuntimeContext;
|
|
115
|
-
}): Promise<StepResult<any>>;
|
|
115
|
+
}): Promise<StepResult<any, any, any, any>>;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
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> {
|
package/dist/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var crypto = require('crypto');
|
|
|
4
4
|
var realtime = require('@inngest/realtime');
|
|
5
5
|
var di = require('@mastra/core/di');
|
|
6
6
|
var workflows = require('@mastra/core/workflows');
|
|
7
|
+
var _constants = require('@mastra/core/workflows/_constants');
|
|
7
8
|
var hono = require('inngest/hono');
|
|
8
9
|
|
|
9
10
|
// src/index.ts
|
|
@@ -675,7 +676,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
675
676
|
// TODO: this function shouldn't have suspend probably?
|
|
676
677
|
suspend: async (_suspendPayload) => {
|
|
677
678
|
},
|
|
678
|
-
emitter
|
|
679
|
+
[_constants.EMITTER_SYMBOL]: emitter
|
|
679
680
|
});
|
|
680
681
|
return result ? index : null;
|
|
681
682
|
} catch (e) {
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { randomUUID } from 'crypto';
|
|
|
2
2
|
import { subscribe } from '@inngest/realtime';
|
|
3
3
|
import { RuntimeContext } from '@mastra/core/di';
|
|
4
4
|
import { Run, Workflow, cloneStep, createStep, DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
5
|
+
import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
|
|
5
6
|
import { serve as serve$1 } from 'inngest/hono';
|
|
6
7
|
|
|
7
8
|
// src/index.ts
|
|
@@ -673,7 +674,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
673
674
|
// TODO: this function shouldn't have suspend probably?
|
|
674
675
|
suspend: async (_suspendPayload) => {
|
|
675
676
|
},
|
|
676
|
-
emitter
|
|
677
|
+
[EMITTER_SYMBOL]: emitter
|
|
677
678
|
});
|
|
678
679
|
return result ? index : null;
|
|
679
680
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/inngest",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
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
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@mastra/core": "0.10.
|
|
40
|
+
"@mastra/deployer": "0.10.1",
|
|
41
|
+
"@internal/lint": "0.0.7",
|
|
42
|
+
"@mastra/core": "0.10.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@mastra/core": "^0.10.0"
|
package/src/index.test.ts
CHANGED
|
@@ -71,7 +71,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
71
71
|
url: ':memory:',
|
|
72
72
|
},
|
|
73
73
|
}),
|
|
74
|
-
|
|
74
|
+
workflows: {
|
|
75
75
|
'test-workflow': workflow,
|
|
76
76
|
},
|
|
77
77
|
server: {
|
|
@@ -148,7 +148,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
148
148
|
url: ':memory:',
|
|
149
149
|
},
|
|
150
150
|
}),
|
|
151
|
-
|
|
151
|
+
workflows: {
|
|
152
152
|
'test-workflow': workflow,
|
|
153
153
|
},
|
|
154
154
|
server: {
|
|
@@ -231,7 +231,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
231
231
|
url: ':memory:',
|
|
232
232
|
},
|
|
233
233
|
}),
|
|
234
|
-
|
|
234
|
+
workflows: {
|
|
235
235
|
'test-workflow': workflow,
|
|
236
236
|
},
|
|
237
237
|
server: {
|
|
@@ -305,7 +305,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
305
305
|
url: ':memory:',
|
|
306
306
|
},
|
|
307
307
|
}),
|
|
308
|
-
|
|
308
|
+
workflows: {
|
|
309
309
|
'test-workflow': workflow,
|
|
310
310
|
},
|
|
311
311
|
server: {
|
|
@@ -394,7 +394,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
394
394
|
url: ':memory:',
|
|
395
395
|
},
|
|
396
396
|
}),
|
|
397
|
-
|
|
397
|
+
workflows: {
|
|
398
398
|
'test-workflow': workflow,
|
|
399
399
|
},
|
|
400
400
|
server: {
|
|
@@ -463,7 +463,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
463
463
|
url: ':memory:',
|
|
464
464
|
},
|
|
465
465
|
}),
|
|
466
|
-
|
|
466
|
+
workflows: {
|
|
467
467
|
'test-workflow': workflow,
|
|
468
468
|
},
|
|
469
469
|
server: {
|
|
@@ -540,7 +540,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
540
540
|
url: ':memory:',
|
|
541
541
|
},
|
|
542
542
|
}),
|
|
543
|
-
|
|
543
|
+
workflows: {
|
|
544
544
|
'test-workflow': workflow,
|
|
545
545
|
},
|
|
546
546
|
server: {
|
|
@@ -624,7 +624,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
624
624
|
url: ':memory:',
|
|
625
625
|
},
|
|
626
626
|
}),
|
|
627
|
-
|
|
627
|
+
workflows: {
|
|
628
628
|
'test-workflow': workflow,
|
|
629
629
|
},
|
|
630
630
|
server: {
|
|
@@ -729,7 +729,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
729
729
|
url: ':memory:',
|
|
730
730
|
},
|
|
731
731
|
}),
|
|
732
|
-
|
|
732
|
+
workflows: {
|
|
733
733
|
'test-workflow': workflow,
|
|
734
734
|
},
|
|
735
735
|
server: {
|
|
@@ -807,7 +807,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
807
807
|
url: ':memory:',
|
|
808
808
|
},
|
|
809
809
|
}),
|
|
810
|
-
|
|
810
|
+
workflows: {
|
|
811
811
|
'test-workflow': workflow,
|
|
812
812
|
},
|
|
813
813
|
server: {
|
|
@@ -914,7 +914,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
914
914
|
url: ':memory:',
|
|
915
915
|
},
|
|
916
916
|
}),
|
|
917
|
-
|
|
917
|
+
workflows: {
|
|
918
918
|
'test-workflow': workflow,
|
|
919
919
|
},
|
|
920
920
|
server: {
|
|
@@ -999,7 +999,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
999
999
|
url: ':memory:',
|
|
1000
1000
|
},
|
|
1001
1001
|
}),
|
|
1002
|
-
|
|
1002
|
+
workflows: {
|
|
1003
1003
|
'test-workflow': workflow,
|
|
1004
1004
|
},
|
|
1005
1005
|
server: {
|
|
@@ -1069,7 +1069,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1069
1069
|
url: ':memory:',
|
|
1070
1070
|
},
|
|
1071
1071
|
}),
|
|
1072
|
-
|
|
1072
|
+
workflows: {
|
|
1073
1073
|
'test-workflow': workflow,
|
|
1074
1074
|
},
|
|
1075
1075
|
server: {
|
|
@@ -1155,7 +1155,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1155
1155
|
url: ':memory:',
|
|
1156
1156
|
},
|
|
1157
1157
|
}),
|
|
1158
|
-
|
|
1158
|
+
workflows: {
|
|
1159
1159
|
'test-workflow': workflow,
|
|
1160
1160
|
},
|
|
1161
1161
|
server: {
|
|
@@ -1251,7 +1251,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1251
1251
|
url: ':memory:',
|
|
1252
1252
|
},
|
|
1253
1253
|
}),
|
|
1254
|
-
|
|
1254
|
+
workflows: {
|
|
1255
1255
|
'main-workflow': mainWorkflow,
|
|
1256
1256
|
},
|
|
1257
1257
|
server: {
|
|
@@ -1381,7 +1381,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1381
1381
|
url: ':memory:',
|
|
1382
1382
|
},
|
|
1383
1383
|
}),
|
|
1384
|
-
|
|
1384
|
+
workflows: {
|
|
1385
1385
|
'test-workflow': workflow,
|
|
1386
1386
|
},
|
|
1387
1387
|
server: {
|
|
@@ -1485,7 +1485,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1485
1485
|
url: ':memory:',
|
|
1486
1486
|
},
|
|
1487
1487
|
}),
|
|
1488
|
-
|
|
1488
|
+
workflows: {
|
|
1489
1489
|
'test-workflow': counterWorkflow,
|
|
1490
1490
|
},
|
|
1491
1491
|
server: {
|
|
@@ -1590,7 +1590,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1590
1590
|
url: ':memory:',
|
|
1591
1591
|
},
|
|
1592
1592
|
}),
|
|
1593
|
-
|
|
1593
|
+
workflows: {
|
|
1594
1594
|
'test-workflow': counterWorkflow,
|
|
1595
1595
|
},
|
|
1596
1596
|
server: {
|
|
@@ -1681,7 +1681,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1681
1681
|
url: ':memory:',
|
|
1682
1682
|
},
|
|
1683
1683
|
}),
|
|
1684
|
-
|
|
1684
|
+
workflows: {
|
|
1685
1685
|
'test-workflow': counterWorkflow,
|
|
1686
1686
|
},
|
|
1687
1687
|
server: {
|
|
@@ -1836,7 +1836,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1836
1836
|
url: ':memory:',
|
|
1837
1837
|
},
|
|
1838
1838
|
}),
|
|
1839
|
-
|
|
1839
|
+
workflows: {
|
|
1840
1840
|
'test-workflow': counterWorkflow,
|
|
1841
1841
|
},
|
|
1842
1842
|
server: {
|
|
@@ -1987,7 +1987,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1987
1987
|
url: ':memory:',
|
|
1988
1988
|
},
|
|
1989
1989
|
}),
|
|
1990
|
-
|
|
1990
|
+
workflows: {
|
|
1991
1991
|
'test-workflow': counterWorkflow,
|
|
1992
1992
|
},
|
|
1993
1993
|
server: {
|
|
@@ -2161,7 +2161,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2161
2161
|
url: ':memory:',
|
|
2162
2162
|
},
|
|
2163
2163
|
}),
|
|
2164
|
-
|
|
2164
|
+
workflows: {
|
|
2165
2165
|
'test-workflow': workflow,
|
|
2166
2166
|
},
|
|
2167
2167
|
server: {
|
|
@@ -2229,7 +2229,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2229
2229
|
url: ':memory:',
|
|
2230
2230
|
},
|
|
2231
2231
|
}),
|
|
2232
|
-
|
|
2232
|
+
workflows: {
|
|
2233
2233
|
'test-workflow': workflow,
|
|
2234
2234
|
},
|
|
2235
2235
|
server: {
|
|
@@ -2292,7 +2292,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2292
2292
|
});
|
|
2293
2293
|
|
|
2294
2294
|
new Mastra({
|
|
2295
|
-
|
|
2295
|
+
workflows: {
|
|
2296
2296
|
'test-workflow': workflow,
|
|
2297
2297
|
},
|
|
2298
2298
|
server: {
|
|
@@ -2363,7 +2363,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2363
2363
|
url: ':memory:',
|
|
2364
2364
|
},
|
|
2365
2365
|
}),
|
|
2366
|
-
|
|
2366
|
+
workflows: {
|
|
2367
2367
|
'test-workflow': workflow,
|
|
2368
2368
|
},
|
|
2369
2369
|
server: {
|
|
@@ -2436,7 +2436,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2436
2436
|
url: ':memory:',
|
|
2437
2437
|
},
|
|
2438
2438
|
}),
|
|
2439
|
-
|
|
2439
|
+
workflows: {
|
|
2440
2440
|
'test-workflow': workflow,
|
|
2441
2441
|
},
|
|
2442
2442
|
server: {
|
|
@@ -2624,7 +2624,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2624
2624
|
url: ':memory:',
|
|
2625
2625
|
},
|
|
2626
2626
|
}),
|
|
2627
|
-
|
|
2627
|
+
workflows: {
|
|
2628
2628
|
'test-workflow': workflow,
|
|
2629
2629
|
},
|
|
2630
2630
|
server: {
|
|
@@ -2796,15 +2796,9 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2796
2796
|
url: 'file::memory:',
|
|
2797
2797
|
},
|
|
2798
2798
|
});
|
|
2799
|
-
await initialStorage.init();
|
|
2800
|
-
|
|
2801
2799
|
const mastra = new Mastra({
|
|
2802
|
-
storage:
|
|
2803
|
-
|
|
2804
|
-
url: ':memory:',
|
|
2805
|
-
},
|
|
2806
|
-
}),
|
|
2807
|
-
vnext_workflows: {
|
|
2800
|
+
storage: initialStorage,
|
|
2801
|
+
workflows: {
|
|
2808
2802
|
'test-workflow': promptEvalWorkflow,
|
|
2809
2803
|
},
|
|
2810
2804
|
server: {
|
|
@@ -2956,7 +2950,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2956
2950
|
url: ':memory:',
|
|
2957
2951
|
},
|
|
2958
2952
|
}),
|
|
2959
|
-
|
|
2953
|
+
workflows: {
|
|
2960
2954
|
'test-workflow': workflow,
|
|
2961
2955
|
},
|
|
2962
2956
|
server: {
|
|
@@ -3160,7 +3154,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3160
3154
|
url: ':memory:',
|
|
3161
3155
|
},
|
|
3162
3156
|
}),
|
|
3163
|
-
|
|
3157
|
+
workflows: {
|
|
3164
3158
|
'test-workflow': workflow,
|
|
3165
3159
|
},
|
|
3166
3160
|
server: {
|
|
@@ -3356,7 +3350,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3356
3350
|
url: ':memory:',
|
|
3357
3351
|
},
|
|
3358
3352
|
}),
|
|
3359
|
-
|
|
3353
|
+
workflows: {
|
|
3360
3354
|
'test-workflow': promptEvalWorkflow,
|
|
3361
3355
|
},
|
|
3362
3356
|
server: {
|
|
@@ -3482,7 +3476,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3482
3476
|
url: ':memory:',
|
|
3483
3477
|
},
|
|
3484
3478
|
}),
|
|
3485
|
-
|
|
3479
|
+
workflows: {
|
|
3486
3480
|
'test-workflow': workflow,
|
|
3487
3481
|
},
|
|
3488
3482
|
server: {
|
|
@@ -3587,7 +3581,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3587
3581
|
url: ':memory:',
|
|
3588
3582
|
},
|
|
3589
3583
|
}),
|
|
3590
|
-
|
|
3584
|
+
workflows: {
|
|
3591
3585
|
'test-workflow': workflow,
|
|
3592
3586
|
},
|
|
3593
3587
|
server: {
|
|
@@ -3725,7 +3719,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3725
3719
|
url: ':memory:',
|
|
3726
3720
|
},
|
|
3727
3721
|
}),
|
|
3728
|
-
|
|
3722
|
+
workflows: {
|
|
3729
3723
|
'test-workflow': workflow,
|
|
3730
3724
|
},
|
|
3731
3725
|
server: {
|
|
@@ -3870,7 +3864,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3870
3864
|
url: ':memory:',
|
|
3871
3865
|
},
|
|
3872
3866
|
}),
|
|
3873
|
-
|
|
3867
|
+
workflows: {
|
|
3874
3868
|
'test-workflow': counterWorkflow,
|
|
3875
3869
|
},
|
|
3876
3870
|
server: {
|
|
@@ -4024,7 +4018,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4024
4018
|
url: ':memory:',
|
|
4025
4019
|
},
|
|
4026
4020
|
}),
|
|
4027
|
-
|
|
4021
|
+
workflows: {
|
|
4028
4022
|
'test-workflow': counterWorkflow,
|
|
4029
4023
|
},
|
|
4030
4024
|
server: {
|
|
@@ -4183,7 +4177,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4183
4177
|
url: ':memory:',
|
|
4184
4178
|
},
|
|
4185
4179
|
}),
|
|
4186
|
-
|
|
4180
|
+
workflows: {
|
|
4187
4181
|
'test-workflow': counterWorkflow,
|
|
4188
4182
|
},
|
|
4189
4183
|
server: {
|
|
@@ -4344,7 +4338,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4344
4338
|
url: ':memory:',
|
|
4345
4339
|
},
|
|
4346
4340
|
}),
|
|
4347
|
-
|
|
4341
|
+
workflows: {
|
|
4348
4342
|
'test-workflow': counterWorkflow,
|
|
4349
4343
|
},
|
|
4350
4344
|
server: {
|
|
@@ -4543,7 +4537,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4543
4537
|
url: ':memory:',
|
|
4544
4538
|
},
|
|
4545
4539
|
}),
|
|
4546
|
-
|
|
4540
|
+
workflows: {
|
|
4547
4541
|
'test-workflow': counterWorkflow,
|
|
4548
4542
|
},
|
|
4549
4543
|
server: {
|
|
@@ -4701,7 +4695,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4701
4695
|
url: ':memory:',
|
|
4702
4696
|
},
|
|
4703
4697
|
}),
|
|
4704
|
-
|
|
4698
|
+
workflows: {
|
|
4705
4699
|
'test-workflow': counterWorkflow,
|
|
4706
4700
|
},
|
|
4707
4701
|
server: {
|
|
@@ -4851,7 +4845,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4851
4845
|
url: ':memory:',
|
|
4852
4846
|
},
|
|
4853
4847
|
}),
|
|
4854
|
-
|
|
4848
|
+
workflows: {
|
|
4855
4849
|
'test-workflow': counterWorkflow,
|
|
4856
4850
|
},
|
|
4857
4851
|
server: {
|
|
@@ -5038,7 +5032,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5038
5032
|
url: ':memory:',
|
|
5039
5033
|
},
|
|
5040
5034
|
}),
|
|
5041
|
-
|
|
5035
|
+
workflows: {
|
|
5042
5036
|
'test-workflow': counterWorkflow,
|
|
5043
5037
|
},
|
|
5044
5038
|
server: {
|
|
@@ -5197,7 +5191,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5197
5191
|
url: ':memory:',
|
|
5198
5192
|
},
|
|
5199
5193
|
}),
|
|
5200
|
-
|
|
5194
|
+
workflows: {
|
|
5201
5195
|
'test-workflow': counterWorkflow,
|
|
5202
5196
|
},
|
|
5203
5197
|
server: {
|
|
@@ -5274,7 +5268,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5274
5268
|
url: ':memory:',
|
|
5275
5269
|
},
|
|
5276
5270
|
}),
|
|
5277
|
-
|
|
5271
|
+
workflows: {
|
|
5278
5272
|
'test-workflow': workflow,
|
|
5279
5273
|
},
|
|
5280
5274
|
server: {
|
|
@@ -5339,7 +5333,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5339
5333
|
url: ':memory:',
|
|
5340
5334
|
},
|
|
5341
5335
|
}),
|
|
5342
|
-
|
|
5336
|
+
workflows: {
|
|
5343
5337
|
'test-workflow': workflow,
|
|
5344
5338
|
},
|
|
5345
5339
|
server: {
|
|
@@ -5382,7 +5376,6 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5382
5376
|
url: 'file::memory:',
|
|
5383
5377
|
},
|
|
5384
5378
|
});
|
|
5385
|
-
await initialStorage.init();
|
|
5386
5379
|
|
|
5387
5380
|
const runtimeContext = new RuntimeContext();
|
|
5388
5381
|
const testValue = 'test-dependency';
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
StepResult,
|
|
15
15
|
WorkflowResult,
|
|
16
16
|
} from '@mastra/core/workflows';
|
|
17
|
+
import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
|
|
17
18
|
import type { Span } from '@opentelemetry/api';
|
|
18
19
|
import type { Inngest, BaseContext } from 'inngest';
|
|
19
20
|
import { serve as inngestServe } from 'inngest/hono';
|
|
@@ -415,8 +416,8 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
415
416
|
protected async fmtReturnValue<TOutput>(
|
|
416
417
|
executionSpan: Span | undefined,
|
|
417
418
|
emitter: { emit: (event: string, data: any) => Promise<void> },
|
|
418
|
-
stepResults: Record<string, StepResult<any>>,
|
|
419
|
-
lastOutput: StepResult<any>,
|
|
419
|
+
stepResults: Record<string, StepResult<any, any, any, any>>,
|
|
420
|
+
lastOutput: StepResult<any, any, any, any>,
|
|
420
421
|
error?: Error | string,
|
|
421
422
|
): Promise<TOutput> {
|
|
422
423
|
const base: any = {
|
|
@@ -500,7 +501,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
500
501
|
workflowId: string;
|
|
501
502
|
runId: string;
|
|
502
503
|
step: Step<string, any, any>;
|
|
503
|
-
stepResults: Record<string, StepResult<any>>;
|
|
504
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
504
505
|
executionContext: ExecutionContext;
|
|
505
506
|
resume?: {
|
|
506
507
|
steps: string[];
|
|
@@ -509,7 +510,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
509
510
|
prevOutput: any;
|
|
510
511
|
emitter: { emit: (event: string, data: any) => Promise<void> };
|
|
511
512
|
runtimeContext: RuntimeContext;
|
|
512
|
-
}): Promise<StepResult<any>> {
|
|
513
|
+
}): Promise<StepResult<any, any, any, any>> {
|
|
513
514
|
return super.executeStep({
|
|
514
515
|
workflowId,
|
|
515
516
|
runId,
|
|
@@ -533,7 +534,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
533
534
|
runtimeContext,
|
|
534
535
|
}: {
|
|
535
536
|
step: Step<string, any, any>;
|
|
536
|
-
stepResults: Record<string, StepResult<any>>;
|
|
537
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
537
538
|
executionContext: {
|
|
538
539
|
workflowId: string;
|
|
539
540
|
runId: string;
|
|
@@ -549,7 +550,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
549
550
|
prevOutput: any;
|
|
550
551
|
emitter: { emit: (event: string, data: any) => Promise<void> };
|
|
551
552
|
runtimeContext: RuntimeContext;
|
|
552
|
-
}): Promise<StepResult<any>> {
|
|
553
|
+
}): Promise<StepResult<any, any, any, any>> {
|
|
553
554
|
await this.inngestStep.run(
|
|
554
555
|
`workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
|
|
555
556
|
async () => {
|
|
@@ -643,7 +644,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
643
644
|
return { executionContext, result: { status: 'failed', error: result?.error } };
|
|
644
645
|
} else if (result.status === 'suspended') {
|
|
645
646
|
const suspendedSteps = Object.entries(result.steps).filter(([_stepName, stepResult]) => {
|
|
646
|
-
const stepRes: StepResult<any> = stepResult as StepResult<any>;
|
|
647
|
+
const stepRes: StepResult<any, any, any, any> = stepResult as StepResult<any, any, any, any>;
|
|
647
648
|
return stepRes?.status === 'suspended';
|
|
648
649
|
});
|
|
649
650
|
|
|
@@ -731,7 +732,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
731
732
|
);
|
|
732
733
|
|
|
733
734
|
Object.assign(executionContext, res.executionContext);
|
|
734
|
-
return res.result as StepResult<any>;
|
|
735
|
+
return res.result as StepResult<any, any, any, any>;
|
|
735
736
|
}
|
|
736
737
|
|
|
737
738
|
const stepRes = await this.inngestStep.run(`workflow.${executionContext.workflowId}.step.${step.id}`, async () => {
|
|
@@ -818,7 +819,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
818
819
|
}: {
|
|
819
820
|
workflowId: string;
|
|
820
821
|
runId: string;
|
|
821
|
-
stepResults: Record<string, StepResult<any>>;
|
|
822
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
822
823
|
executionContext: ExecutionContext;
|
|
823
824
|
}) {
|
|
824
825
|
await this.inngestStep.run(
|
|
@@ -858,17 +859,17 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
858
859
|
entry: { type: 'conditional'; steps: StepFlowEntry[]; conditions: ExecuteFunction<any, any, any, any>[] };
|
|
859
860
|
prevStep: StepFlowEntry;
|
|
860
861
|
prevOutput: any;
|
|
861
|
-
stepResults: Record<string, StepResult<any>>;
|
|
862
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
862
863
|
resume?: {
|
|
863
864
|
steps: string[];
|
|
864
|
-
stepResults: Record<string, StepResult<any>>;
|
|
865
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
865
866
|
resumePayload: any;
|
|
866
867
|
resumePath: number[];
|
|
867
868
|
};
|
|
868
869
|
executionContext: ExecutionContext;
|
|
869
870
|
emitter: { emit: (event: string, data: any) => Promise<void> };
|
|
870
871
|
runtimeContext: RuntimeContext;
|
|
871
|
-
}): Promise<StepResult<any>> {
|
|
872
|
+
}): Promise<StepResult<any, any, any, any>> {
|
|
872
873
|
let execResults: any;
|
|
873
874
|
const truthyIndexes = (
|
|
874
875
|
await Promise.all(
|
|
@@ -895,7 +896,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
895
896
|
|
|
896
897
|
// TODO: this function shouldn't have suspend probably?
|
|
897
898
|
suspend: async (_suspendPayload: any) => {},
|
|
898
|
-
emitter,
|
|
899
|
+
[EMITTER_SYMBOL]: emitter,
|
|
899
900
|
});
|
|
900
901
|
return result ? index : null;
|
|
901
902
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -908,7 +909,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
908
909
|
).filter((index: any): index is number => index !== null);
|
|
909
910
|
|
|
910
911
|
const stepsToRun = entry.steps.filter((_, index) => truthyIndexes.includes(index));
|
|
911
|
-
const results: StepResult<any>[] = await Promise.all(
|
|
912
|
+
const results: StepResult<any, any, any, any>[] = await Promise.all(
|
|
912
913
|
stepsToRun.map((step, index) =>
|
|
913
914
|
this.executeEntry({
|
|
914
915
|
workflowId,
|