@mastra/inngest 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-tsconfig-compile-20250703214351
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/CHANGELOG.md +274 -2
- package/dist/_tsup-dts-rollup.d.cts +150 -40
- package/dist/_tsup-dts-rollup.d.ts +150 -40
- package/dist/index.cjs +564 -53
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +564 -54
- package/docker-compose.yaml +3 -3
- package/package.json +21 -19
- package/src/index.test.ts +5538 -3441
- package/src/index.ts +843 -78
- package/vitest.config.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,295 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-tsconfig-compile-20250703214351
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b790fd1: Ability to pass a function to .sleep()/.sleepUntil()
|
|
8
|
+
- Updated dependencies [b790fd1]
|
|
9
|
+
- Updated dependencies [f36e4f1]
|
|
10
|
+
- @mastra/core@0.0.0-tsconfig-compile-20250703214351
|
|
11
|
+
|
|
12
|
+
## 0.11.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 48d9738: Fix inngest sleep stream events
|
|
17
|
+
- Updated dependencies [4d3fbdf]
|
|
18
|
+
- @mastra/core@0.10.10
|
|
19
|
+
|
|
20
|
+
## 0.11.2-alpha.0
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 48d9738: Fix inngest sleep stream events
|
|
25
|
+
- Updated dependencies [4d3fbdf]
|
|
26
|
+
- @mastra/core@0.10.10-alpha.0
|
|
27
|
+
|
|
28
|
+
## 0.11.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
|
|
33
|
+
- 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
|
|
34
|
+
- 1760a1c: Use workflow stream in playground instead of watch
|
|
35
|
+
- 038e5ae: Add cancel workflow run
|
|
36
|
+
- 81a1b3b: Update peerdeps
|
|
37
|
+
- Updated dependencies [9dda1ac]
|
|
38
|
+
- Updated dependencies [c984582]
|
|
39
|
+
- Updated dependencies [7e801dd]
|
|
40
|
+
- Updated dependencies [a606c75]
|
|
41
|
+
- Updated dependencies [7aa70a4]
|
|
42
|
+
- Updated dependencies [764f86a]
|
|
43
|
+
- Updated dependencies [1760a1c]
|
|
44
|
+
- Updated dependencies [038e5ae]
|
|
45
|
+
- Updated dependencies [7dda16a]
|
|
46
|
+
- Updated dependencies [5ebfcdd]
|
|
47
|
+
- Updated dependencies [b2d0c91]
|
|
48
|
+
- Updated dependencies [4e809ad]
|
|
49
|
+
- Updated dependencies [57929df]
|
|
50
|
+
- Updated dependencies [b7852ed]
|
|
51
|
+
- Updated dependencies [6320a61]
|
|
52
|
+
- @mastra/core@0.10.9
|
|
53
|
+
|
|
54
|
+
## 0.11.1-alpha.0
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
|
|
59
|
+
- 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
|
|
60
|
+
- 1760a1c: Use workflow stream in playground instead of watch
|
|
61
|
+
- 038e5ae: Add cancel workflow run
|
|
62
|
+
- 81a1b3b: Update peerdeps
|
|
63
|
+
- Updated dependencies [9dda1ac]
|
|
64
|
+
- Updated dependencies [c984582]
|
|
65
|
+
- Updated dependencies [7e801dd]
|
|
66
|
+
- Updated dependencies [a606c75]
|
|
67
|
+
- Updated dependencies [7aa70a4]
|
|
68
|
+
- Updated dependencies [764f86a]
|
|
69
|
+
- Updated dependencies [1760a1c]
|
|
70
|
+
- Updated dependencies [038e5ae]
|
|
71
|
+
- Updated dependencies [7dda16a]
|
|
72
|
+
- Updated dependencies [5ebfcdd]
|
|
73
|
+
- Updated dependencies [b2d0c91]
|
|
74
|
+
- Updated dependencies [4e809ad]
|
|
75
|
+
- Updated dependencies [57929df]
|
|
76
|
+
- Updated dependencies [b7852ed]
|
|
77
|
+
- Updated dependencies [6320a61]
|
|
78
|
+
- @mastra/core@0.10.9-alpha.0
|
|
79
|
+
|
|
80
|
+
## 0.11.0
|
|
81
|
+
|
|
82
|
+
### Minor Changes
|
|
83
|
+
|
|
84
|
+
- 8a3bfd2: Update peerdeps to latest core
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- 8e1b6e9: dependencies updates:
|
|
89
|
+
- Updated dependency [`zod@^3.25.67` ↗︎](https://www.npmjs.com/package/zod/v/3.25.67) (from `^3.25.57`, in `dependencies`)
|
|
90
|
+
- 9d52b17: Fix inngest workflows streaming and add step metadata
|
|
91
|
+
- 4fb0cc2: Type safe variable mapping
|
|
92
|
+
- 502fe05: createRun() -> createRunAsync()
|
|
93
|
+
- 4efcfa0: Added bail() method and more ergonomic suspend function return value
|
|
94
|
+
- Updated dependencies [15e9d26]
|
|
95
|
+
- Updated dependencies [d1baedb]
|
|
96
|
+
- Updated dependencies [d8f2d19]
|
|
97
|
+
- Updated dependencies [4d21bf2]
|
|
98
|
+
- Updated dependencies [07d6d88]
|
|
99
|
+
- Updated dependencies [9d52b17]
|
|
100
|
+
- Updated dependencies [2097952]
|
|
101
|
+
- Updated dependencies [792c4c0]
|
|
102
|
+
- Updated dependencies [5d74aab]
|
|
103
|
+
- Updated dependencies [a8b194f]
|
|
104
|
+
- Updated dependencies [4fb0cc2]
|
|
105
|
+
- Updated dependencies [d2a7a31]
|
|
106
|
+
- Updated dependencies [502fe05]
|
|
107
|
+
- Updated dependencies [144eb0b]
|
|
108
|
+
- Updated dependencies [8ba1b51]
|
|
109
|
+
- Updated dependencies [4efcfa0]
|
|
110
|
+
- Updated dependencies [0e17048]
|
|
111
|
+
- @mastra/core@0.10.7
|
|
112
|
+
|
|
113
|
+
## 0.11.0-alpha.3
|
|
114
|
+
|
|
115
|
+
### Minor Changes
|
|
116
|
+
|
|
117
|
+
- 8a3bfd2: Update peerdeps to latest core
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- 502fe05: createRun() -> createRunAsync()
|
|
122
|
+
- 4efcfa0: Added bail() method and more ergonomic suspend function return value
|
|
123
|
+
- Updated dependencies [792c4c0]
|
|
124
|
+
- Updated dependencies [502fe05]
|
|
125
|
+
- Updated dependencies [4efcfa0]
|
|
126
|
+
- @mastra/core@0.10.7-alpha.3
|
|
127
|
+
|
|
128
|
+
## 0.10.6-alpha.2
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- 8e1b6e9: dependencies updates:
|
|
133
|
+
- Updated dependency [`zod@^3.25.67` ↗︎](https://www.npmjs.com/package/zod/v/3.25.67) (from `^3.25.57`, in `dependencies`)
|
|
134
|
+
- Updated dependencies [15e9d26]
|
|
135
|
+
- Updated dependencies [07d6d88]
|
|
136
|
+
- Updated dependencies [5d74aab]
|
|
137
|
+
- Updated dependencies [144eb0b]
|
|
138
|
+
- @mastra/core@0.10.7-alpha.2
|
|
139
|
+
|
|
140
|
+
## 0.10.6-alpha.1
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- 4fb0cc2: Type safe variable mapping
|
|
145
|
+
- Updated dependencies [d1baedb]
|
|
146
|
+
- Updated dependencies [4d21bf2]
|
|
147
|
+
- Updated dependencies [2097952]
|
|
148
|
+
- Updated dependencies [4fb0cc2]
|
|
149
|
+
- Updated dependencies [d2a7a31]
|
|
150
|
+
- Updated dependencies [0e17048]
|
|
151
|
+
- @mastra/core@0.10.7-alpha.1
|
|
152
|
+
|
|
153
|
+
## 0.10.6-alpha.0
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- 9d52b17: Fix inngest workflows streaming and add step metadata
|
|
158
|
+
- Updated dependencies [d8f2d19]
|
|
159
|
+
- Updated dependencies [9d52b17]
|
|
160
|
+
- Updated dependencies [8ba1b51]
|
|
161
|
+
- @mastra/core@0.10.7-alpha.0
|
|
162
|
+
|
|
163
|
+
## 0.10.5
|
|
164
|
+
|
|
165
|
+
### Patch Changes
|
|
166
|
+
|
|
167
|
+
- 63f6b7d: dependencies updates:
|
|
168
|
+
- Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
|
|
169
|
+
- Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
|
|
170
|
+
- ee9af57: Add api for polling run execution result and get run by id
|
|
171
|
+
- Updated dependencies [63f6b7d]
|
|
172
|
+
- Updated dependencies [12a95fc]
|
|
173
|
+
- Updated dependencies [4b0f8a6]
|
|
174
|
+
- Updated dependencies [51264a5]
|
|
175
|
+
- Updated dependencies [8e6f677]
|
|
176
|
+
- Updated dependencies [d70c420]
|
|
177
|
+
- Updated dependencies [ee9af57]
|
|
178
|
+
- Updated dependencies [36f1c36]
|
|
179
|
+
- Updated dependencies [2a16996]
|
|
180
|
+
- Updated dependencies [10d352e]
|
|
181
|
+
- Updated dependencies [9589624]
|
|
182
|
+
- Updated dependencies [53d3c37]
|
|
183
|
+
- Updated dependencies [751c894]
|
|
184
|
+
- Updated dependencies [577ce3a]
|
|
185
|
+
- Updated dependencies [9260b3a]
|
|
186
|
+
- @mastra/core@0.10.6
|
|
187
|
+
|
|
188
|
+
## 0.10.5-alpha.1
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- ee9af57: Add api for polling run execution result and get run by id
|
|
193
|
+
- Updated dependencies [ee9af57]
|
|
194
|
+
- Updated dependencies [751c894]
|
|
195
|
+
- Updated dependencies [577ce3a]
|
|
196
|
+
- Updated dependencies [9260b3a]
|
|
197
|
+
- @mastra/core@0.10.6-alpha.1
|
|
198
|
+
|
|
199
|
+
## 0.10.5-alpha.0
|
|
200
|
+
|
|
201
|
+
### Patch Changes
|
|
202
|
+
|
|
203
|
+
- 63f6b7d: dependencies updates:
|
|
204
|
+
- Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
|
|
205
|
+
- Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
|
|
206
|
+
- Updated dependencies [63f6b7d]
|
|
207
|
+
- Updated dependencies [36f1c36]
|
|
208
|
+
- Updated dependencies [10d352e]
|
|
209
|
+
- Updated dependencies [53d3c37]
|
|
210
|
+
- @mastra/core@0.10.6-alpha.0
|
|
211
|
+
|
|
212
|
+
## 0.10.4
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- 13c97f9: Save run status, result and error in storage snapshot
|
|
217
|
+
- Updated dependencies [13c97f9]
|
|
218
|
+
- @mastra/core@0.10.5
|
|
219
|
+
|
|
220
|
+
## 0.10.3
|
|
221
|
+
|
|
222
|
+
### Patch Changes
|
|
223
|
+
|
|
224
|
+
- 1ccccff: dependencies updates:
|
|
225
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
226
|
+
- 1ccccff: dependencies updates:
|
|
227
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
228
|
+
- Updated dependencies [d1ed912]
|
|
229
|
+
- Updated dependencies [f6fd25f]
|
|
230
|
+
- Updated dependencies [dffb67b]
|
|
231
|
+
- Updated dependencies [f1f1f1b]
|
|
232
|
+
- Updated dependencies [925ab94]
|
|
233
|
+
- Updated dependencies [f9816ae]
|
|
234
|
+
- Updated dependencies [82090c1]
|
|
235
|
+
- Updated dependencies [1b443fd]
|
|
236
|
+
- Updated dependencies [ce97900]
|
|
237
|
+
- Updated dependencies [f1309d3]
|
|
238
|
+
- Updated dependencies [14a2566]
|
|
239
|
+
- Updated dependencies [f7f8293]
|
|
240
|
+
- Updated dependencies [48eddb9]
|
|
241
|
+
- @mastra/core@0.10.4
|
|
242
|
+
|
|
243
|
+
## 0.10.3-alpha.0
|
|
244
|
+
|
|
245
|
+
### Patch Changes
|
|
246
|
+
|
|
247
|
+
- 1ccccff: dependencies updates:
|
|
248
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
249
|
+
- 1ccccff: dependencies updates:
|
|
250
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
251
|
+
- Updated dependencies [f6fd25f]
|
|
252
|
+
- Updated dependencies [dffb67b]
|
|
253
|
+
- Updated dependencies [f1309d3]
|
|
254
|
+
- Updated dependencies [f7f8293]
|
|
255
|
+
- @mastra/core@0.10.4-alpha.1
|
|
256
|
+
|
|
257
|
+
## 0.10.2
|
|
4
258
|
|
|
5
259
|
### Patch Changes
|
|
6
260
|
|
|
7
261
|
- 195c428: Add runId to step execute fn
|
|
8
262
|
- 12b7002: Add serializedStepGraph to workflow run snapshot in storage
|
|
9
263
|
- f0d559f: Fix peerdeps for alpha channel
|
|
264
|
+
- 1ee6894: inngest production url fix
|
|
10
265
|
- Updated dependencies [ee77e78]
|
|
11
266
|
- Updated dependencies [592a2db]
|
|
12
267
|
- Updated dependencies [e5dc18d]
|
|
13
268
|
- Updated dependencies [ab5adbe]
|
|
14
269
|
- Updated dependencies [1e8bb40]
|
|
270
|
+
- Updated dependencies [1b5fc55]
|
|
15
271
|
- Updated dependencies [195c428]
|
|
16
272
|
- Updated dependencies [f73e11b]
|
|
273
|
+
- Updated dependencies [37643b8]
|
|
274
|
+
- Updated dependencies [99fd6cf]
|
|
17
275
|
- Updated dependencies [c5bf1ce]
|
|
276
|
+
- Updated dependencies [add596e]
|
|
277
|
+
- Updated dependencies [8dc94d8]
|
|
278
|
+
- Updated dependencies [ecebbeb]
|
|
279
|
+
- Updated dependencies [79d5145]
|
|
18
280
|
- Updated dependencies [12b7002]
|
|
19
281
|
- Updated dependencies [2901125]
|
|
20
|
-
- @mastra/core@0.
|
|
282
|
+
- @mastra/core@0.10.2
|
|
283
|
+
|
|
284
|
+
## 0.10.2-alpha.3
|
|
285
|
+
|
|
286
|
+
### Patch Changes
|
|
287
|
+
|
|
288
|
+
- 1ee6894: inngest production url fix
|
|
289
|
+
- Updated dependencies [1b5fc55]
|
|
290
|
+
- Updated dependencies [add596e]
|
|
291
|
+
- Updated dependencies [ecebbeb]
|
|
292
|
+
- @mastra/core@0.10.2-alpha.5
|
|
21
293
|
|
|
22
294
|
## 0.10.2-alpha.2
|
|
23
295
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { Agent } from '@mastra/core';
|
|
1
2
|
import type { BaseContext } from 'inngest';
|
|
2
3
|
import { ClientOptions } from 'inngest';
|
|
3
|
-
import { cloneStep } from '@mastra/core/workflows';
|
|
4
|
-
import { createStep } from '@mastra/core/workflows';
|
|
5
4
|
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
5
|
+
import type { Emitter } from '@mastra/core/workflows';
|
|
6
6
|
import type { ExecuteFunction } from '@mastra/core/workflows';
|
|
7
7
|
import type { ExecutionContext } from '@mastra/core/workflows';
|
|
8
8
|
import type { ExecutionEngine } from '@mastra/core/workflows';
|
|
@@ -12,6 +12,7 @@ import type { Inngest } from 'inngest';
|
|
|
12
12
|
import { InngestFunction } from 'inngest';
|
|
13
13
|
import { InngestMiddleware } from 'inngest';
|
|
14
14
|
import type { Mastra } from '@mastra/core';
|
|
15
|
+
import type { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
15
16
|
import { Run } from '@mastra/core/workflows';
|
|
16
17
|
import { RuntimeContext } from '@mastra/core/di';
|
|
17
18
|
import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
|
|
@@ -20,32 +21,80 @@ import type { Span } from '@opentelemetry/api';
|
|
|
20
21
|
import type { Step } from '@mastra/core/workflows';
|
|
21
22
|
import type { StepFlowEntry } from '@mastra/core/workflows';
|
|
22
23
|
import type { StepResult } from '@mastra/core/workflows';
|
|
24
|
+
import type { StreamEvent } from '@mastra/core/workflows';
|
|
25
|
+
import { Tool } from '@mastra/core/tools';
|
|
26
|
+
import type { ToolExecutionContext } from '@mastra/core';
|
|
27
|
+
import type { WatchEvent } from '@mastra/core/workflows';
|
|
23
28
|
import { Workflow } from '@mastra/core/workflows';
|
|
24
29
|
import type { WorkflowConfig } from '@mastra/core/workflows';
|
|
25
30
|
import type { WorkflowResult } from '@mastra/core/workflows';
|
|
26
31
|
import type { WorkflowRun } from '@mastra/core';
|
|
27
32
|
import type { WorkflowRuns } from '@mastra/core';
|
|
28
|
-
import
|
|
33
|
+
import { z } from 'zod';
|
|
29
34
|
|
|
30
|
-
declare function
|
|
31
|
-
id:
|
|
32
|
-
|
|
35
|
+
export declare function createStep<TStepId extends string, TStepInput extends z.ZodType<any>, TStepOutput extends z.ZodType<any>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(params: {
|
|
36
|
+
id: TStepId;
|
|
37
|
+
description?: string;
|
|
38
|
+
inputSchema: TStepInput;
|
|
39
|
+
outputSchema: TStepOutput;
|
|
40
|
+
resumeSchema?: TResumeSchema;
|
|
41
|
+
suspendSchema?: TSuspendSchema;
|
|
42
|
+
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, InngestEngineType>;
|
|
43
|
+
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
|
|
44
|
+
|
|
45
|
+
export declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
|
|
46
|
+
prompt: z.ZodString;
|
|
47
|
+
}>, TStepOutput extends z.ZodObject<{
|
|
48
|
+
text: z.ZodString;
|
|
49
|
+
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
|
|
50
|
+
|
|
51
|
+
export declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
52
|
+
inputSchema: TSchemaIn;
|
|
53
|
+
outputSchema: TSchemaOut;
|
|
54
|
+
execute: (context: TContext) => Promise<any>;
|
|
55
|
+
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>, InngestEngineType>;
|
|
33
56
|
|
|
34
57
|
export declare function init(inngest: Inngest): {
|
|
35
|
-
createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any>[] = Step<string, any, any,
|
|
58
|
+
createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
36
59
|
createStep: typeof createStep;
|
|
37
|
-
cloneStep:
|
|
38
|
-
|
|
60
|
+
cloneStep<TStepId extends string>(step: Step<string, any, any, any, any, InngestEngineType>, opts: {
|
|
61
|
+
id: TStepId;
|
|
62
|
+
}): Step<TStepId, any, any, any, any, InngestEngineType>;
|
|
63
|
+
cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[], TPrevSchema extends z.ZodType<any> = TInput>(workflow: Workflow<InngestEngineType, TSteps, string, TInput, TOutput, TPrevSchema>, opts: {
|
|
64
|
+
id: TWorkflowId;
|
|
65
|
+
}): Workflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TPrevSchema>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export declare type InngestEngineType = {
|
|
69
|
+
step: any;
|
|
39
70
|
};
|
|
40
71
|
|
|
41
72
|
export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
42
73
|
private inngestStep;
|
|
43
74
|
private inngestAttempts;
|
|
44
75
|
constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
76
|
+
execute<TInput, TOutput>(params: {
|
|
77
|
+
workflowId: string;
|
|
78
|
+
runId: string;
|
|
79
|
+
graph: ExecutionGraph;
|
|
80
|
+
serializedStepGraph: SerializedStepFlowEntry[];
|
|
81
|
+
input?: TInput;
|
|
82
|
+
resume?: {
|
|
83
|
+
steps: string[];
|
|
84
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
85
|
+
resumePayload: any;
|
|
86
|
+
resumePath: number[];
|
|
87
|
+
};
|
|
88
|
+
emitter: Emitter;
|
|
89
|
+
retryConfig?: {
|
|
90
|
+
attempts?: number;
|
|
91
|
+
delay?: number;
|
|
92
|
+
};
|
|
93
|
+
runtimeContext: RuntimeContext;
|
|
94
|
+
abortController: AbortController;
|
|
95
|
+
}): Promise<TOutput>;
|
|
96
|
+
protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: Emitter, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
|
|
97
|
+
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
|
|
49
98
|
workflowId: string;
|
|
50
99
|
runId: string;
|
|
51
100
|
step: Step<string, any, any>;
|
|
@@ -56,49 +105,93 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
56
105
|
resumePayload: any;
|
|
57
106
|
};
|
|
58
107
|
prevOutput: any;
|
|
59
|
-
emitter:
|
|
60
|
-
|
|
61
|
-
};
|
|
108
|
+
emitter: Emitter;
|
|
109
|
+
abortController: AbortController;
|
|
62
110
|
runtimeContext: RuntimeContext;
|
|
63
111
|
}): Promise<StepResult<any, any, any, any>>;
|
|
64
|
-
|
|
65
|
-
|
|
112
|
+
executeSleep({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
|
|
113
|
+
workflowId: string;
|
|
114
|
+
runId: string;
|
|
115
|
+
serializedStepGraph: SerializedStepFlowEntry[];
|
|
116
|
+
entry: {
|
|
117
|
+
type: 'sleep';
|
|
118
|
+
id: string;
|
|
119
|
+
duration?: number;
|
|
120
|
+
fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
|
|
121
|
+
};
|
|
122
|
+
prevStep: StepFlowEntry;
|
|
123
|
+
prevOutput: any;
|
|
124
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
125
|
+
resume?: {
|
|
126
|
+
steps: string[];
|
|
127
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
128
|
+
resumePayload: any;
|
|
129
|
+
resumePath: number[];
|
|
130
|
+
};
|
|
131
|
+
executionContext: ExecutionContext;
|
|
132
|
+
emitter: Emitter;
|
|
133
|
+
abortController: AbortController;
|
|
134
|
+
runtimeContext: RuntimeContext;
|
|
135
|
+
}): Promise<void>;
|
|
136
|
+
executeSleepUntil({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
|
|
137
|
+
workflowId: string;
|
|
138
|
+
runId: string;
|
|
139
|
+
serializedStepGraph: SerializedStepFlowEntry[];
|
|
140
|
+
entry: {
|
|
141
|
+
type: 'sleepUntil';
|
|
142
|
+
id: string;
|
|
143
|
+
date?: Date;
|
|
144
|
+
fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
|
|
145
|
+
};
|
|
146
|
+
prevStep: StepFlowEntry;
|
|
147
|
+
prevOutput: any;
|
|
66
148
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
retryConfig: {
|
|
73
|
-
attempts: number;
|
|
74
|
-
delay: number;
|
|
75
|
-
};
|
|
149
|
+
resume?: {
|
|
150
|
+
steps: string[];
|
|
151
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
152
|
+
resumePayload: any;
|
|
153
|
+
resumePath: number[];
|
|
76
154
|
};
|
|
155
|
+
executionContext: ExecutionContext;
|
|
156
|
+
emitter: Emitter;
|
|
157
|
+
abortController: AbortController;
|
|
158
|
+
runtimeContext: RuntimeContext;
|
|
159
|
+
}): Promise<void>;
|
|
160
|
+
executeWaitForEvent({ event, timeout }: {
|
|
161
|
+
event: string;
|
|
162
|
+
timeout?: number;
|
|
163
|
+
}): Promise<any>;
|
|
164
|
+
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
|
|
165
|
+
step: Step<string, any, any>;
|
|
166
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
167
|
+
executionContext: ExecutionContext;
|
|
77
168
|
resume?: {
|
|
78
169
|
steps: string[];
|
|
79
170
|
resumePayload: any;
|
|
80
171
|
runId?: string;
|
|
81
172
|
};
|
|
82
173
|
prevOutput: any;
|
|
83
|
-
emitter:
|
|
84
|
-
|
|
85
|
-
};
|
|
174
|
+
emitter: Emitter;
|
|
175
|
+
abortController: AbortController;
|
|
86
176
|
runtimeContext: RuntimeContext;
|
|
87
177
|
}): Promise<StepResult<any, any, any, any>>;
|
|
88
|
-
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, }: {
|
|
178
|
+
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
|
|
89
179
|
workflowId: string;
|
|
90
180
|
runId: string;
|
|
91
181
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
92
182
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
93
183
|
executionContext: ExecutionContext;
|
|
184
|
+
workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
|
|
185
|
+
result?: Record<string, any>;
|
|
186
|
+
error?: string | Error;
|
|
94
187
|
}): Promise<void>;
|
|
95
|
-
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
|
|
188
|
+
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
|
|
96
189
|
workflowId: string;
|
|
97
190
|
runId: string;
|
|
98
191
|
entry: {
|
|
99
192
|
type: 'conditional';
|
|
100
193
|
steps: StepFlowEntry[];
|
|
101
|
-
conditions: ExecuteFunction<any, any, any, any>[];
|
|
194
|
+
conditions: ExecuteFunction<any, any, any, any, InngestEngineType>[];
|
|
102
195
|
};
|
|
103
196
|
prevStep: StepFlowEntry;
|
|
104
197
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -111,14 +204,13 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
111
204
|
resumePath: number[];
|
|
112
205
|
};
|
|
113
206
|
executionContext: ExecutionContext;
|
|
114
|
-
emitter:
|
|
115
|
-
|
|
116
|
-
};
|
|
207
|
+
emitter: Emitter;
|
|
208
|
+
abortController: AbortController;
|
|
117
209
|
runtimeContext: RuntimeContext;
|
|
118
210
|
}): Promise<StepResult<any, any, any, any>>;
|
|
119
211
|
}
|
|
120
212
|
|
|
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> {
|
|
213
|
+
export declare class InngestRun<TEngineType = InngestEngineType, 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<TEngineType, TSteps, TInput, TOutput> {
|
|
122
214
|
#private;
|
|
123
215
|
private inngest;
|
|
124
216
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -137,6 +229,8 @@ export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<s
|
|
|
137
229
|
}, inngest: Inngest);
|
|
138
230
|
getRuns(eventId: string): Promise<any>;
|
|
139
231
|
getRunOutput(eventId: string): Promise<any>;
|
|
232
|
+
sendEvent(event: string, data: any): Promise<void>;
|
|
233
|
+
cancel(): Promise<void>;
|
|
140
234
|
start({ inputData, }: {
|
|
141
235
|
inputData?: z.infer<TInput>;
|
|
142
236
|
runtimeContext?: RuntimeContext;
|
|
@@ -146,10 +240,22 @@ export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<s
|
|
|
146
240
|
step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
|
|
147
241
|
runtimeContext?: RuntimeContext;
|
|
148
242
|
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
149
|
-
|
|
243
|
+
_resume<TResumeSchema extends z.ZodType<any>>(params: {
|
|
244
|
+
resumeData?: z.infer<TResumeSchema>;
|
|
245
|
+
step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
|
|
246
|
+
runtimeContext?: RuntimeContext;
|
|
247
|
+
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
248
|
+
watch(cb: (event: WatchEvent) => void, type?: 'watch' | 'watch-v2'): () => void;
|
|
249
|
+
stream({ inputData, runtimeContext }?: {
|
|
250
|
+
inputData?: z.infer<TInput>;
|
|
251
|
+
runtimeContext?: RuntimeContext;
|
|
252
|
+
}): {
|
|
253
|
+
stream: ReadableStream_2<StreamEvent>;
|
|
254
|
+
getWorkflowState: () => Promise<WorkflowResult<TOutput, TSteps>>;
|
|
255
|
+
};
|
|
150
256
|
}
|
|
151
257
|
|
|
152
|
-
export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends Workflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
|
|
258
|
+
export declare class InngestWorkflow<TEngineType = InngestEngineType, TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends Workflow<TEngineType, TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
|
|
153
259
|
#private;
|
|
154
260
|
inngest: Inngest;
|
|
155
261
|
private function;
|
|
@@ -162,10 +268,14 @@ export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = S
|
|
|
162
268
|
resourceId?: string;
|
|
163
269
|
}): Promise<WorkflowRuns>;
|
|
164
270
|
getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
|
|
271
|
+
getWorkflowRunExecutionResult(runId: string): Promise<WatchEvent['payload']['workflowState'] | null>;
|
|
165
272
|
__registerMastra(mastra: Mastra): void;
|
|
166
273
|
createRun(options?: {
|
|
167
274
|
runId?: string;
|
|
168
|
-
}): Run<TSteps, TInput, TOutput>;
|
|
275
|
+
}): Run<TEngineType, TSteps, TInput, TOutput>;
|
|
276
|
+
createRunAsync(options?: {
|
|
277
|
+
runId?: string;
|
|
278
|
+
}): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
|
|
169
279
|
getFunction(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
|
|
170
280
|
cron: string;
|
|
171
281
|
} & Partial<Record<"event" | "if", never>>] | [{
|