@mastra/inngest 0.10.0 → 0.10.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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +15 -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 +45 -45
- 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 7512ms
|
|
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 5984ms
|
|
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 268ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m22.10 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 270ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 0.10.1-alpha.0
|
|
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 [200d0da]
|
|
11
|
+
- Updated dependencies [bf5f17b]
|
|
12
|
+
- Updated dependencies [5343f93]
|
|
13
|
+
- Updated dependencies [38aee50]
|
|
14
|
+
- Updated dependencies [5c41100]
|
|
15
|
+
- Updated dependencies [d6a759b]
|
|
16
|
+
- @mastra/core@0.10.1-alpha.1
|
|
17
|
+
|
|
3
18
|
## 0.10.0
|
|
4
19
|
|
|
5
20
|
### 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.0",
|
|
3
|
+
"version": "0.10.1-alpha.0",
|
|
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
|
-
"@mastra/
|
|
42
|
-
"@
|
|
40
|
+
"@mastra/deployer": "0.10.1-alpha.1",
|
|
41
|
+
"@mastra/core": "0.10.1-alpha.1",
|
|
42
|
+
"@internal/lint": "0.0.6"
|
|
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: {
|
|
@@ -2804,7 +2804,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2804
2804
|
url: ':memory:',
|
|
2805
2805
|
},
|
|
2806
2806
|
}),
|
|
2807
|
-
|
|
2807
|
+
workflows: {
|
|
2808
2808
|
'test-workflow': promptEvalWorkflow,
|
|
2809
2809
|
},
|
|
2810
2810
|
server: {
|
|
@@ -2956,7 +2956,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2956
2956
|
url: ':memory:',
|
|
2957
2957
|
},
|
|
2958
2958
|
}),
|
|
2959
|
-
|
|
2959
|
+
workflows: {
|
|
2960
2960
|
'test-workflow': workflow,
|
|
2961
2961
|
},
|
|
2962
2962
|
server: {
|
|
@@ -3160,7 +3160,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3160
3160
|
url: ':memory:',
|
|
3161
3161
|
},
|
|
3162
3162
|
}),
|
|
3163
|
-
|
|
3163
|
+
workflows: {
|
|
3164
3164
|
'test-workflow': workflow,
|
|
3165
3165
|
},
|
|
3166
3166
|
server: {
|
|
@@ -3356,7 +3356,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3356
3356
|
url: ':memory:',
|
|
3357
3357
|
},
|
|
3358
3358
|
}),
|
|
3359
|
-
|
|
3359
|
+
workflows: {
|
|
3360
3360
|
'test-workflow': promptEvalWorkflow,
|
|
3361
3361
|
},
|
|
3362
3362
|
server: {
|
|
@@ -3482,7 +3482,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3482
3482
|
url: ':memory:',
|
|
3483
3483
|
},
|
|
3484
3484
|
}),
|
|
3485
|
-
|
|
3485
|
+
workflows: {
|
|
3486
3486
|
'test-workflow': workflow,
|
|
3487
3487
|
},
|
|
3488
3488
|
server: {
|
|
@@ -3587,7 +3587,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3587
3587
|
url: ':memory:',
|
|
3588
3588
|
},
|
|
3589
3589
|
}),
|
|
3590
|
-
|
|
3590
|
+
workflows: {
|
|
3591
3591
|
'test-workflow': workflow,
|
|
3592
3592
|
},
|
|
3593
3593
|
server: {
|
|
@@ -3725,7 +3725,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3725
3725
|
url: ':memory:',
|
|
3726
3726
|
},
|
|
3727
3727
|
}),
|
|
3728
|
-
|
|
3728
|
+
workflows: {
|
|
3729
3729
|
'test-workflow': workflow,
|
|
3730
3730
|
},
|
|
3731
3731
|
server: {
|
|
@@ -3870,7 +3870,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3870
3870
|
url: ':memory:',
|
|
3871
3871
|
},
|
|
3872
3872
|
}),
|
|
3873
|
-
|
|
3873
|
+
workflows: {
|
|
3874
3874
|
'test-workflow': counterWorkflow,
|
|
3875
3875
|
},
|
|
3876
3876
|
server: {
|
|
@@ -4024,7 +4024,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4024
4024
|
url: ':memory:',
|
|
4025
4025
|
},
|
|
4026
4026
|
}),
|
|
4027
|
-
|
|
4027
|
+
workflows: {
|
|
4028
4028
|
'test-workflow': counterWorkflow,
|
|
4029
4029
|
},
|
|
4030
4030
|
server: {
|
|
@@ -4183,7 +4183,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4183
4183
|
url: ':memory:',
|
|
4184
4184
|
},
|
|
4185
4185
|
}),
|
|
4186
|
-
|
|
4186
|
+
workflows: {
|
|
4187
4187
|
'test-workflow': counterWorkflow,
|
|
4188
4188
|
},
|
|
4189
4189
|
server: {
|
|
@@ -4344,7 +4344,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4344
4344
|
url: ':memory:',
|
|
4345
4345
|
},
|
|
4346
4346
|
}),
|
|
4347
|
-
|
|
4347
|
+
workflows: {
|
|
4348
4348
|
'test-workflow': counterWorkflow,
|
|
4349
4349
|
},
|
|
4350
4350
|
server: {
|
|
@@ -4543,7 +4543,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4543
4543
|
url: ':memory:',
|
|
4544
4544
|
},
|
|
4545
4545
|
}),
|
|
4546
|
-
|
|
4546
|
+
workflows: {
|
|
4547
4547
|
'test-workflow': counterWorkflow,
|
|
4548
4548
|
},
|
|
4549
4549
|
server: {
|
|
@@ -4701,7 +4701,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4701
4701
|
url: ':memory:',
|
|
4702
4702
|
},
|
|
4703
4703
|
}),
|
|
4704
|
-
|
|
4704
|
+
workflows: {
|
|
4705
4705
|
'test-workflow': counterWorkflow,
|
|
4706
4706
|
},
|
|
4707
4707
|
server: {
|
|
@@ -4851,7 +4851,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4851
4851
|
url: ':memory:',
|
|
4852
4852
|
},
|
|
4853
4853
|
}),
|
|
4854
|
-
|
|
4854
|
+
workflows: {
|
|
4855
4855
|
'test-workflow': counterWorkflow,
|
|
4856
4856
|
},
|
|
4857
4857
|
server: {
|
|
@@ -5038,7 +5038,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5038
5038
|
url: ':memory:',
|
|
5039
5039
|
},
|
|
5040
5040
|
}),
|
|
5041
|
-
|
|
5041
|
+
workflows: {
|
|
5042
5042
|
'test-workflow': counterWorkflow,
|
|
5043
5043
|
},
|
|
5044
5044
|
server: {
|
|
@@ -5197,7 +5197,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5197
5197
|
url: ':memory:',
|
|
5198
5198
|
},
|
|
5199
5199
|
}),
|
|
5200
|
-
|
|
5200
|
+
workflows: {
|
|
5201
5201
|
'test-workflow': counterWorkflow,
|
|
5202
5202
|
},
|
|
5203
5203
|
server: {
|
|
@@ -5274,7 +5274,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5274
5274
|
url: ':memory:',
|
|
5275
5275
|
},
|
|
5276
5276
|
}),
|
|
5277
|
-
|
|
5277
|
+
workflows: {
|
|
5278
5278
|
'test-workflow': workflow,
|
|
5279
5279
|
},
|
|
5280
5280
|
server: {
|
|
@@ -5339,7 +5339,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5339
5339
|
url: ':memory:',
|
|
5340
5340
|
},
|
|
5341
5341
|
}),
|
|
5342
|
-
|
|
5342
|
+
workflows: {
|
|
5343
5343
|
'test-workflow': workflow,
|
|
5344
5344
|
},
|
|
5345
5345
|
server: {
|
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,
|