@mastra/inngest 0.16.1 → 0.17.0-alpha.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/CHANGELOG.md +30 -0
- package/dist/index.cjs +63 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 0.17.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Consolidate streamVNext logic into stream, move old stream function into streamLegacy ([#9092](https://github.com/mastra-ai/mastra/pull/9092))
|
|
8
|
+
|
|
9
|
+
- Update peer dependencies to match core package version bump (0.22.0) ([#9092](https://github.com/mastra-ai/mastra/pull/9092))
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated `watch` and `watchAsync` methods to use proper function overloads instead of generic conditional types, ensuring compatibility with the base Run class signatures. ([#9048](https://github.com/mastra-ai/mastra/pull/9048))
|
|
14
|
+
|
|
15
|
+
- Update peerdeps to 0.23.0-0 ([#9043](https://github.com/mastra-ai/mastra/pull/9043))
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`efb5ed9`](https://github.com/mastra-ai/mastra/commit/efb5ed946ae7f410bc68c9430beb4b010afd25ec), [`8ea07b4`](https://github.com/mastra-ai/mastra/commit/8ea07b4bdc73e4218437dbb6dcb0f4b23e745a44), [`ba201b8`](https://github.com/mastra-ai/mastra/commit/ba201b8f8feac4c72350f2dbd52c13c7297ba7b0), [`4fc4136`](https://github.com/mastra-ai/mastra/commit/4fc413652866a8d2240694fddb2562e9edbb70df), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`d10baf5`](https://github.com/mastra-ai/mastra/commit/d10baf5a3c924f2a6654e23a3e318ed03f189b76), [`038c55a`](https://github.com/mastra-ai/mastra/commit/038c55a7090fc1b1513a966386d3072617f836ac), [`182f045`](https://github.com/mastra-ai/mastra/commit/182f0458f25bd70aa774e64fd923c8a483eddbf1), [`7620d2b`](https://github.com/mastra-ai/mastra/commit/7620d2bddeb4fae4c3c0a0b4e672969795fca11a), [`b2365f0`](https://github.com/mastra-ai/mastra/commit/b2365f038dd4c5f06400428b224af963f399ad50), [`9029ba3`](https://github.com/mastra-ai/mastra/commit/9029ba34459c8859fed4c6b73efd8e2d0021e7ba), [`426cc56`](https://github.com/mastra-ai/mastra/commit/426cc561c85ae76a112ded2385532a91f9f9f074), [`00931fb`](https://github.com/mastra-ai/mastra/commit/00931fb1a21aa42c4fbc20c2c40dd62466b8fc8f), [`e473bfe`](https://github.com/mastra-ai/mastra/commit/e473bfe416c0b8e876973c2b6a6f13c394b7a93f), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`648e2ca`](https://github.com/mastra-ai/mastra/commit/648e2ca42da54838c6ccbdaadc6fadd808fa6b86), [`b65c5e0`](https://github.com/mastra-ai/mastra/commit/b65c5e0fe6f3c390a9a8bbcf69304d972c3a4afb)]:
|
|
18
|
+
- @mastra/core@0.22.0-alpha.1
|
|
19
|
+
|
|
20
|
+
## 0.17.0-alpha.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- Update peer dependencies to match core package version bump (0.21.2) ([#8941](https://github.com/mastra-ai/mastra/pull/8941))
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Support for custom resume labels mapping to step to be resumed ([#8941](https://github.com/mastra-ai/mastra/pull/8941))
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [[`c67ca32`](https://github.com/mastra-ai/mastra/commit/c67ca32e3c2cf69bfc146580770c720220ca44ac), [`dbc9e12`](https://github.com/mastra-ai/mastra/commit/dbc9e1216ba575ba59ead4afb727a01215f7de4f), [`99e41b9`](https://github.com/mastra-ai/mastra/commit/99e41b94957cdd25137d3ac12e94e8b21aa01b68), [`c28833c`](https://github.com/mastra-ai/mastra/commit/c28833c5b6d8e10eeffd7f7d39129d53b8bca240), [`f053e89`](https://github.com/mastra-ai/mastra/commit/f053e89160dbd0bd3333fc3492f68231b5c7c349), [`9a1a485`](https://github.com/mastra-ai/mastra/commit/9a1a4859b855e37239f652bf14b1ecd1029b8c4e), [`9257233`](https://github.com/mastra-ai/mastra/commit/9257233c4ffce09b2bedc2a9adbd70d7a83fa8e2), [`0f1a4c9`](https://github.com/mastra-ai/mastra/commit/0f1a4c984fb4b104b2f0b63ba18c9fa77f567700), [`2db6160`](https://github.com/mastra-ai/mastra/commit/2db6160e2022ff8827c15d30157e684683b934b5), [`8aeea37`](https://github.com/mastra-ai/mastra/commit/8aeea37efdde347c635a67fed56794943b7f74ec), [`02fe153`](https://github.com/mastra-ai/mastra/commit/02fe15351d6021d214da48ec982a0e9e4150bcee), [`74567b3`](https://github.com/mastra-ai/mastra/commit/74567b3d237ae3915cd0bca3cf55fa0a64e4e4a4), [`15a1733`](https://github.com/mastra-ai/mastra/commit/15a1733074cee8bd37370e1af34cd818e89fa7ac), [`fc2a774`](https://github.com/mastra-ai/mastra/commit/fc2a77468981aaddc3e77f83f0c4ad4a4af140da), [`4e08933`](https://github.com/mastra-ai/mastra/commit/4e08933625464dfde178347af5b6278fcf34188e)]:
|
|
31
|
+
- @mastra/core@0.21.2-alpha.0
|
|
32
|
+
|
|
3
33
|
## 0.16.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var crypto = require('crypto');
|
|
4
|
+
var web = require('stream/web');
|
|
4
5
|
var realtime = require('@inngest/realtime');
|
|
5
6
|
var aiTracing = require('@mastra/core/ai-tracing');
|
|
6
7
|
var di = require('@mastra/core/di');
|
|
8
|
+
var stream = require('@mastra/core/stream');
|
|
7
9
|
var tools = require('@mastra/core/tools');
|
|
8
10
|
var workflows = require('@mastra/core/workflows');
|
|
9
11
|
var _constants = require('@mastra/core/workflows/_constants');
|
|
@@ -123,6 +125,7 @@ var InngestRun = class extends workflows.Run {
|
|
|
123
125
|
context: {},
|
|
124
126
|
activePaths: [],
|
|
125
127
|
suspendedPaths: {},
|
|
128
|
+
resumeLabels: {},
|
|
126
129
|
waitingPaths: {},
|
|
127
130
|
timestamp: Date.now(),
|
|
128
131
|
status: "running"
|
|
@@ -225,7 +228,7 @@ var InngestRun = class extends workflows.Run {
|
|
|
225
228
|
});
|
|
226
229
|
};
|
|
227
230
|
}
|
|
228
|
-
|
|
231
|
+
streamLegacy({ inputData, runtimeContext } = {}) {
|
|
229
232
|
const { readable, writable } = new TransformStream();
|
|
230
233
|
const writer = writable.getWriter();
|
|
231
234
|
const unwatch = this.watch(async (event) => {
|
|
@@ -260,6 +263,58 @@ var InngestRun = class extends workflows.Run {
|
|
|
260
263
|
getWorkflowState: () => this.executionResults
|
|
261
264
|
};
|
|
262
265
|
}
|
|
266
|
+
stream({
|
|
267
|
+
inputData,
|
|
268
|
+
runtimeContext,
|
|
269
|
+
closeOnSuspend = true
|
|
270
|
+
} = {}) {
|
|
271
|
+
const self = this;
|
|
272
|
+
let streamOutput;
|
|
273
|
+
const stream$1 = new web.ReadableStream({
|
|
274
|
+
async start(controller) {
|
|
275
|
+
const unwatch = self.watch(async ({ type, from = ChunkFrom.WORKFLOW, payload }) => {
|
|
276
|
+
controller.enqueue({
|
|
277
|
+
type,
|
|
278
|
+
runId: self.runId,
|
|
279
|
+
from,
|
|
280
|
+
payload: {
|
|
281
|
+
stepName: payload.id,
|
|
282
|
+
...payload
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}, "watch-v2");
|
|
286
|
+
self.closeStreamAction = async () => {
|
|
287
|
+
unwatch();
|
|
288
|
+
try {
|
|
289
|
+
await controller.close();
|
|
290
|
+
} catch (err) {
|
|
291
|
+
console.error("Error closing stream:", err);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const executionResultsPromise = self.start({
|
|
295
|
+
inputData,
|
|
296
|
+
runtimeContext
|
|
297
|
+
});
|
|
298
|
+
const executionResults = await executionResultsPromise;
|
|
299
|
+
if (closeOnSuspend) {
|
|
300
|
+
self.closeStreamAction?.().catch(() => {
|
|
301
|
+
});
|
|
302
|
+
} else if (executionResults.status !== "suspended") {
|
|
303
|
+
self.closeStreamAction?.().catch(() => {
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (streamOutput) {
|
|
307
|
+
streamOutput.updateResults(executionResults);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
streamOutput = new stream.WorkflowRunOutput({
|
|
312
|
+
runId: this.runId,
|
|
313
|
+
workflowId: this.workflowId,
|
|
314
|
+
stream: stream$1
|
|
315
|
+
});
|
|
316
|
+
return streamOutput;
|
|
317
|
+
}
|
|
263
318
|
};
|
|
264
319
|
var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
265
320
|
#mastra;
|
|
@@ -357,6 +412,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
357
412
|
waitingPaths: {},
|
|
358
413
|
serializedStepGraph: this.serializedStepGraph,
|
|
359
414
|
suspendedPaths: {},
|
|
415
|
+
resumeLabels: {},
|
|
360
416
|
result: void 0,
|
|
361
417
|
error: void 0,
|
|
362
418
|
// @ts-ignore
|
|
@@ -1176,8 +1232,11 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1176
1232
|
},
|
|
1177
1233
|
getInitData: () => stepResults?.input,
|
|
1178
1234
|
getStepResult: workflows.getStepResult.bind(this, stepResults),
|
|
1179
|
-
suspend: async (suspendPayload) => {
|
|
1235
|
+
suspend: async (suspendPayload, suspendOptions) => {
|
|
1180
1236
|
executionContext.suspendedPaths[step.id] = executionContext.executionPath;
|
|
1237
|
+
if (suspendOptions?.resumeLabel) {
|
|
1238
|
+
executionContext.resumeLabels[suspendOptions.resumeLabel] = step.id;
|
|
1239
|
+
}
|
|
1181
1240
|
suspended = { payload: suspendPayload };
|
|
1182
1241
|
},
|
|
1183
1242
|
bail: (result2) => {
|
|
@@ -1351,6 +1410,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1351
1410
|
context: stepResults,
|
|
1352
1411
|
activePaths: [],
|
|
1353
1412
|
suspendedPaths: executionContext.suspendedPaths,
|
|
1413
|
+
resumeLabels: executionContext.resumeLabels,
|
|
1354
1414
|
waitingPaths: {},
|
|
1355
1415
|
serializedStepGraph,
|
|
1356
1416
|
status: workflowStatus,
|
|
@@ -1485,6 +1545,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1485
1545
|
runId,
|
|
1486
1546
|
executionPath: [...executionContext.executionPath, index],
|
|
1487
1547
|
suspendedPaths: executionContext.suspendedPaths,
|
|
1548
|
+
resumeLabels: executionContext.resumeLabels,
|
|
1488
1549
|
retryConfig: executionContext.retryConfig,
|
|
1489
1550
|
executionSpan: executionContext.executionSpan,
|
|
1490
1551
|
state: executionContext.state
|