@mastra/inngest 0.0.0-cloud-transporter-20250513033346

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/dist/index.cjs ADDED
@@ -0,0 +1,735 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('crypto');
4
+ var realtime = require('@inngest/realtime');
5
+ var di = require('@mastra/core/di');
6
+ var vNext = require('@mastra/core/workflows/vNext');
7
+ var hono = require('inngest/hono');
8
+
9
+ // src/index.ts
10
+ function serve({ mastra, inngest }) {
11
+ const wfs = mastra.vnext_getWorkflows();
12
+ const functions = Object.values(wfs).flatMap((wf) => {
13
+ if (wf instanceof InngestWorkflow) {
14
+ wf.__registerMastra(mastra);
15
+ return wf.getFunctions();
16
+ }
17
+ return [];
18
+ });
19
+ return hono.serve({
20
+ client: inngest,
21
+ functions
22
+ });
23
+ }
24
+ var InngestRun = class extends vNext.Run {
25
+ inngest;
26
+ #mastra;
27
+ constructor(params, inngest) {
28
+ super(params);
29
+ this.inngest = inngest;
30
+ this.#mastra = params.mastra;
31
+ }
32
+ async getRuns(eventId) {
33
+ const response = await fetch(`${this.inngest.apiBaseUrl}/v1/events/${eventId}/runs`, {
34
+ headers: {
35
+ Authorization: `Bearer ${process.env.INNGEST_SIGNING_KEY}`
36
+ }
37
+ });
38
+ const json = await response.json();
39
+ return json.data;
40
+ }
41
+ async getRunOutput(eventId) {
42
+ let runs = await this.getRuns(eventId);
43
+ while (runs?.[0]?.status !== "Completed") {
44
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
45
+ runs = await this.getRuns(eventId);
46
+ if (runs?.[0]?.status === "Failed" || runs?.[0]?.status === "Cancelled") {
47
+ throw new Error(`Function run ${runs?.[0]?.status}`);
48
+ }
49
+ }
50
+ return runs?.[0];
51
+ }
52
+ async start({
53
+ inputData
54
+ }) {
55
+ await this.#mastra.getStorage()?.persistWorkflowSnapshot({
56
+ workflowName: this.workflowId,
57
+ runId: this.runId,
58
+ snapshot: {
59
+ runId: this.runId,
60
+ value: {},
61
+ context: {},
62
+ activePaths: [],
63
+ suspendedPaths: {},
64
+ timestamp: Date.now()
65
+ }
66
+ });
67
+ const eventOutput = await this.inngest.send({
68
+ name: `workflow.${this.workflowId}`,
69
+ data: {
70
+ inputData,
71
+ runId: this.runId
72
+ }
73
+ });
74
+ const eventId = eventOutput.ids[0];
75
+ if (!eventId) {
76
+ throw new Error("Event ID is not set");
77
+ }
78
+ const runOutput = await this.getRunOutput(eventId);
79
+ const result = runOutput?.output?.result;
80
+ if (result.status === "failed") {
81
+ result.error = new Error(result.error);
82
+ }
83
+ this.cleanup?.();
84
+ return result;
85
+ }
86
+ async resume(params) {
87
+ const steps = (Array.isArray(params.step) ? params.step : [params.step]).map(
88
+ (step) => typeof step === "string" ? step : step?.id
89
+ );
90
+ const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
91
+ workflowName: this.workflowId,
92
+ runId: this.runId
93
+ });
94
+ const eventOutput = await this.inngest.send({
95
+ name: `workflow.${this.workflowId}`,
96
+ data: {
97
+ inputData: params.resumeData,
98
+ runId: this.runId,
99
+ stepResults: snapshot?.context,
100
+ resume: {
101
+ steps,
102
+ stepResults: snapshot?.context,
103
+ resumePayload: params.resumeData,
104
+ // @ts-ignore
105
+ resumePath: snapshot?.suspendedPaths?.[steps?.[0]]
106
+ }
107
+ }
108
+ });
109
+ const eventId = eventOutput.ids[0];
110
+ if (!eventId) {
111
+ throw new Error("Event ID is not set");
112
+ }
113
+ const runOutput = await this.getRunOutput(eventId);
114
+ const result = runOutput?.output?.result;
115
+ if (result.status === "failed") {
116
+ result.error = new Error(result.error);
117
+ }
118
+ return result;
119
+ }
120
+ watch(cb) {
121
+ const streamPromise = realtime.subscribe(
122
+ {
123
+ channel: `workflow:${this.workflowId}:${this.runId}`,
124
+ topics: ["watch"],
125
+ app: this.inngest
126
+ },
127
+ (message) => {
128
+ cb(message.data);
129
+ }
130
+ );
131
+ return () => {
132
+ streamPromise.then((stream) => {
133
+ stream.cancel();
134
+ }).catch((err) => {
135
+ console.error(err);
136
+ });
137
+ };
138
+ }
139
+ };
140
+ var InngestWorkflow = class _InngestWorkflow extends vNext.NewWorkflow {
141
+ #mastra;
142
+ inngest;
143
+ function;
144
+ constructor(params, inngest) {
145
+ super(params);
146
+ this.#mastra = params.mastra;
147
+ this.inngest = inngest;
148
+ }
149
+ async getWorkflowRuns(args) {
150
+ const storage = this.#mastra?.getStorage();
151
+ if (!storage) {
152
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
153
+ return { runs: [], total: 0 };
154
+ }
155
+ return storage.getWorkflowRuns({ workflowName: this.id, ...args ?? {} });
156
+ }
157
+ async getWorkflowRunById(runId) {
158
+ const storage = this.#mastra?.getStorage();
159
+ if (!storage) {
160
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
161
+ return null;
162
+ }
163
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
164
+ return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
165
+ }
166
+ __registerMastra(mastra) {
167
+ this.#mastra = mastra;
168
+ this.executionEngine.__registerMastra(mastra);
169
+ const updateNested = (step) => {
170
+ if ((step.type === "step" || step.type === "loop" || step.type === "foreach") && step.step instanceof _InngestWorkflow) {
171
+ step.step.__registerMastra(mastra);
172
+ } else if (step.type === "parallel" || step.type === "conditional") {
173
+ for (const subStep of step.steps) {
174
+ updateNested(subStep);
175
+ }
176
+ }
177
+ };
178
+ if (this.executionGraph.steps.length) {
179
+ for (const step of this.executionGraph.steps) {
180
+ updateNested(step);
181
+ }
182
+ }
183
+ }
184
+ createRun(options) {
185
+ const runIdToUse = options?.runId || crypto.randomUUID();
186
+ const run = this.runs.get(runIdToUse) ?? new InngestRun(
187
+ {
188
+ workflowId: this.id,
189
+ runId: runIdToUse,
190
+ executionEngine: this.executionEngine,
191
+ executionGraph: this.executionGraph,
192
+ mastra: this.#mastra,
193
+ retryConfig: this.retryConfig,
194
+ cleanup: () => this.runs.delete(runIdToUse)
195
+ },
196
+ this.inngest
197
+ );
198
+ this.runs.set(runIdToUse, run);
199
+ return run;
200
+ }
201
+ getFunction() {
202
+ if (this.function) {
203
+ return this.function;
204
+ }
205
+ this.function = this.inngest.createFunction(
206
+ // @ts-ignore
207
+ { id: `workflow.${this.id}`, retries: this.retryConfig?.attempts ?? 0 },
208
+ { event: `workflow.${this.id}` },
209
+ async ({ event, step, attempt, publish }) => {
210
+ let { inputData, runId, resume } = event.data;
211
+ if (!runId) {
212
+ runId = await step.run(`workflow.${this.id}.runIdGen`, async () => {
213
+ return crypto.randomUUID();
214
+ });
215
+ }
216
+ const emitter = {
217
+ emit: async (event2, data) => {
218
+ if (!publish) {
219
+ return;
220
+ }
221
+ try {
222
+ await publish({
223
+ channel: `workflow:${this.id}:${runId}`,
224
+ topic: "watch",
225
+ data
226
+ });
227
+ } catch (err) {
228
+ this.logger.error("Error emitting event: " + (err?.stack ?? err?.message ?? err));
229
+ }
230
+ }
231
+ };
232
+ const engine = new InngestExecutionEngine(this.#mastra, step, attempt);
233
+ const result = await engine.execute({
234
+ workflowId: this.id,
235
+ runId,
236
+ graph: this.executionGraph,
237
+ input: inputData,
238
+ emitter,
239
+ retryConfig: this.retryConfig,
240
+ runtimeContext: new di.RuntimeContext(),
241
+ // TODO
242
+ resume
243
+ });
244
+ return { result, runId };
245
+ }
246
+ );
247
+ return this.function;
248
+ }
249
+ getNestedFunctions(steps) {
250
+ return steps.flatMap((step) => {
251
+ if (step.type === "step" || step.type === "loop" || step.type === "foreach") {
252
+ if (step.step instanceof _InngestWorkflow) {
253
+ return [step.step.getFunction(), ...step.step.getNestedFunctions(step.step.executionGraph.steps)];
254
+ }
255
+ return [];
256
+ } else if (step.type === "parallel" || step.type === "conditional") {
257
+ return this.getNestedFunctions(step.steps);
258
+ }
259
+ return [];
260
+ });
261
+ }
262
+ getFunctions() {
263
+ return [this.getFunction(), ...this.getNestedFunctions(this.executionGraph.steps)];
264
+ }
265
+ };
266
+ function cloneWorkflow(workflow, opts) {
267
+ const wf = new InngestWorkflow(
268
+ {
269
+ id: opts.id,
270
+ inputSchema: workflow.inputSchema,
271
+ outputSchema: workflow.outputSchema,
272
+ steps: workflow.stepDefs,
273
+ mastra: workflow.mastra
274
+ },
275
+ workflow.inngest
276
+ );
277
+ wf.setStepFlow(workflow.stepGraph);
278
+ wf.commit();
279
+ return wf;
280
+ }
281
+ function init(inngest) {
282
+ return {
283
+ createWorkflow(params) {
284
+ return new InngestWorkflow(params, inngest);
285
+ },
286
+ createStep: vNext.createStep,
287
+ cloneStep: vNext.cloneStep,
288
+ cloneWorkflow
289
+ };
290
+ }
291
+ var InngestExecutionEngine = class extends vNext.DefaultExecutionEngine {
292
+ inngestStep;
293
+ inngestAttempts;
294
+ constructor(mastra, inngestStep, inngestAttempts = 0) {
295
+ super({ mastra });
296
+ this.inngestStep = inngestStep;
297
+ this.inngestAttempts = inngestAttempts;
298
+ }
299
+ async fmtReturnValue(executionSpan, emitter, stepResults, lastOutput, error) {
300
+ const base = {
301
+ status: lastOutput.status,
302
+ steps: stepResults
303
+ };
304
+ if (lastOutput.status === "success") {
305
+ await emitter.emit("watch", {
306
+ type: "watch",
307
+ payload: {
308
+ workflowState: {
309
+ status: lastOutput.status,
310
+ steps: stepResults,
311
+ result: lastOutput.output
312
+ }
313
+ },
314
+ eventTimestamp: Date.now()
315
+ });
316
+ base.result = lastOutput.output;
317
+ } else if (lastOutput.status === "failed") {
318
+ base.error = error instanceof Error ? error?.stack ?? error.message : lastOutput?.error instanceof Error ? lastOutput.error.message : lastOutput.error ?? error ?? "Unknown error";
319
+ await emitter.emit("watch", {
320
+ type: "watch",
321
+ payload: {
322
+ workflowState: {
323
+ status: lastOutput.status,
324
+ steps: stepResults,
325
+ result: null,
326
+ error: base.error
327
+ }
328
+ },
329
+ eventTimestamp: Date.now()
330
+ });
331
+ } else if (lastOutput.status === "suspended") {
332
+ await emitter.emit("watch", {
333
+ type: "watch",
334
+ payload: {
335
+ workflowState: {
336
+ status: lastOutput.status,
337
+ steps: stepResults,
338
+ result: null,
339
+ error: null
340
+ }
341
+ },
342
+ eventTimestamp: Date.now()
343
+ });
344
+ const suspendedStepIds = Object.entries(stepResults).flatMap(([stepId, stepResult]) => {
345
+ if (stepResult?.status === "suspended") {
346
+ const nestedPath = stepResult?.payload?.__workflow_meta?.path;
347
+ return nestedPath ? [[stepId, ...nestedPath]] : [[stepId]];
348
+ }
349
+ return [];
350
+ });
351
+ base.suspended = suspendedStepIds;
352
+ }
353
+ executionSpan?.end();
354
+ return base;
355
+ }
356
+ async superExecuteStep({
357
+ workflowId,
358
+ runId,
359
+ step,
360
+ stepResults,
361
+ executionContext,
362
+ resume,
363
+ prevOutput,
364
+ emitter,
365
+ runtimeContext
366
+ }) {
367
+ return super.executeStep({
368
+ workflowId,
369
+ runId,
370
+ step,
371
+ stepResults,
372
+ executionContext,
373
+ resume,
374
+ prevOutput,
375
+ emitter,
376
+ runtimeContext
377
+ });
378
+ }
379
+ async executeStep({
380
+ step,
381
+ stepResults,
382
+ executionContext,
383
+ resume,
384
+ prevOutput,
385
+ emitter,
386
+ runtimeContext
387
+ }) {
388
+ await this.inngestStep.run(
389
+ `workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
390
+ async () => {
391
+ await emitter.emit("watch", {
392
+ type: "watch",
393
+ payload: {
394
+ currentStep: {
395
+ id: step.id,
396
+ status: "running"
397
+ },
398
+ workflowState: {
399
+ status: "running",
400
+ steps: {
401
+ ...stepResults,
402
+ [step.id]: {
403
+ status: "running"
404
+ }
405
+ },
406
+ result: null,
407
+ error: null
408
+ }
409
+ },
410
+ eventTimestamp: Date.now()
411
+ });
412
+ }
413
+ );
414
+ if (step instanceof InngestWorkflow) {
415
+ const isResume = !!resume?.steps?.length;
416
+ let result;
417
+ let runId;
418
+ if (isResume) {
419
+ runId = stepResults[resume?.steps?.[0]]?.payload?.__workflow_meta?.runId ?? crypto.randomUUID();
420
+ const snapshot = await this.mastra?.getStorage()?.loadWorkflowSnapshot({
421
+ workflowName: step.id,
422
+ runId
423
+ });
424
+ const invokeResp = await this.inngestStep.invoke(`workflow.${executionContext.workflowId}.step.${step.id}`, {
425
+ function: step.getFunction(),
426
+ data: {
427
+ inputData: prevOutput,
428
+ runId,
429
+ resume: {
430
+ runId,
431
+ steps: resume.steps.slice(1),
432
+ stepResults: snapshot?.context,
433
+ resumePayload: resume.resumePayload,
434
+ // @ts-ignore
435
+ resumePath: snapshot?.suspendedPaths?.[resume.steps?.[1]]
436
+ }
437
+ }
438
+ });
439
+ result = invokeResp.result;
440
+ runId = invokeResp.runId;
441
+ } else {
442
+ const invokeResp = await this.inngestStep.invoke(`workflow.${executionContext.workflowId}.step.${step.id}`, {
443
+ function: step.getFunction(),
444
+ data: {
445
+ inputData: prevOutput
446
+ }
447
+ });
448
+ result = invokeResp.result;
449
+ runId = invokeResp.runId;
450
+ }
451
+ const res = await this.inngestStep.run(
452
+ `workflow.${executionContext.workflowId}.step.${step.id}.nestedwf-results`,
453
+ async () => {
454
+ if (result.status === "failed") {
455
+ await emitter.emit("watch", {
456
+ type: "watch",
457
+ payload: {
458
+ currentStep: {
459
+ id: step.id,
460
+ status: "failed",
461
+ error: result?.error
462
+ },
463
+ workflowState: {
464
+ status: "running",
465
+ steps: stepResults,
466
+ result: null,
467
+ error: null
468
+ }
469
+ },
470
+ eventTimestamp: Date.now()
471
+ });
472
+ return { executionContext, result: { status: "failed", error: result?.error } };
473
+ } else if (result.status === "suspended") {
474
+ const suspendedSteps = Object.entries(result.steps).filter(([_stepName, stepResult]) => {
475
+ const stepRes2 = stepResult;
476
+ return stepRes2?.status === "suspended";
477
+ });
478
+ for (const [stepName, stepResult] of suspendedSteps) {
479
+ const suspendPath = [stepName, ...stepResult?.payload?.__workflow_meta?.path ?? []];
480
+ executionContext.suspendedPaths[step.id] = executionContext.executionPath;
481
+ await emitter.emit("watch", {
482
+ type: "watch",
483
+ payload: {
484
+ currentStep: {
485
+ id: step.id,
486
+ status: "suspended",
487
+ payload: { ...stepResult?.payload, __workflow_meta: { runId, path: suspendPath } }
488
+ },
489
+ workflowState: {
490
+ status: "running",
491
+ steps: stepResults,
492
+ result: null,
493
+ error: null
494
+ }
495
+ },
496
+ eventTimestamp: Date.now()
497
+ });
498
+ return {
499
+ executionContext,
500
+ result: {
501
+ status: "suspended",
502
+ payload: { ...stepResult?.payload, __workflow_meta: { runId, path: suspendPath } }
503
+ }
504
+ };
505
+ }
506
+ await emitter.emit("watch", {
507
+ type: "watch",
508
+ payload: {
509
+ currentStep: {
510
+ id: step.id,
511
+ status: "suspended",
512
+ payload: {}
513
+ },
514
+ workflowState: {
515
+ status: "running",
516
+ steps: stepResults,
517
+ result: null,
518
+ error: null
519
+ }
520
+ },
521
+ eventTimestamp: Date.now()
522
+ });
523
+ return {
524
+ executionContext,
525
+ result: {
526
+ status: "suspended",
527
+ payload: {}
528
+ }
529
+ };
530
+ }
531
+ await emitter.emit("watch", {
532
+ type: "watch",
533
+ payload: {
534
+ currentStep: {
535
+ id: step.id,
536
+ status: "success",
537
+ output: result?.result
538
+ },
539
+ workflowState: {
540
+ status: "running",
541
+ steps: stepResults,
542
+ result: null,
543
+ error: null
544
+ }
545
+ },
546
+ eventTimestamp: Date.now()
547
+ });
548
+ return { executionContext, result: { status: "success", output: result?.result } };
549
+ }
550
+ );
551
+ Object.assign(executionContext, res.executionContext);
552
+ return res.result;
553
+ }
554
+ const stepRes = await this.inngestStep.run(`workflow.${executionContext.workflowId}.step.${step.id}`, async () => {
555
+ let execResults;
556
+ let suspended;
557
+ try {
558
+ const result = await step.execute({
559
+ mastra: this.mastra,
560
+ runtimeContext,
561
+ inputData: prevOutput,
562
+ resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : void 0,
563
+ getInitData: () => stepResults?.input,
564
+ getStepResult: (step2) => {
565
+ const result2 = stepResults[step2.id];
566
+ if (result2?.status === "success") {
567
+ return result2.output;
568
+ }
569
+ return null;
570
+ },
571
+ suspend: async (suspendPayload) => {
572
+ executionContext.suspendedPaths[step.id] = executionContext.executionPath;
573
+ suspended = { payload: suspendPayload };
574
+ },
575
+ resume: {
576
+ steps: resume?.steps?.slice(1) || [],
577
+ resumePayload: resume?.resumePayload,
578
+ // @ts-ignore
579
+ runId: stepResults[step.id]?.payload?.__workflow_meta?.runId
580
+ },
581
+ emitter
582
+ });
583
+ execResults = { status: "success", output: result };
584
+ } catch (e) {
585
+ execResults = { status: "failed", error: e instanceof Error ? e.message : String(e) };
586
+ }
587
+ if (suspended) {
588
+ execResults = { status: "suspended", payload: suspended.payload };
589
+ }
590
+ if (execResults.status === "failed") {
591
+ if (executionContext.retryConfig.attempts > 0 && this.inngestAttempts < executionContext.retryConfig.attempts) {
592
+ throw execResults.error;
593
+ }
594
+ }
595
+ await emitter.emit("watch", {
596
+ type: "watch",
597
+ payload: {
598
+ currentStep: {
599
+ id: step.id,
600
+ status: execResults.status,
601
+ output: execResults.output
602
+ },
603
+ workflowState: {
604
+ status: "running",
605
+ steps: stepResults,
606
+ result: null,
607
+ error: null
608
+ }
609
+ },
610
+ eventTimestamp: Date.now()
611
+ });
612
+ return { result: execResults, executionContext, stepResults };
613
+ });
614
+ Object.assign(executionContext.suspendedPaths, stepRes.executionContext.suspendedPaths);
615
+ Object.assign(stepResults, stepRes.stepResults);
616
+ return stepRes.result;
617
+ }
618
+ async persistStepUpdate({
619
+ workflowId,
620
+ runId,
621
+ stepResults,
622
+ executionContext
623
+ }) {
624
+ await this.inngestStep.run(
625
+ `workflow.${workflowId}.run.${runId}.path.${JSON.stringify(executionContext.executionPath)}.stepUpdate`,
626
+ async () => {
627
+ await this.mastra?.getStorage()?.persistWorkflowSnapshot({
628
+ workflowName: workflowId,
629
+ runId,
630
+ snapshot: {
631
+ runId,
632
+ value: {},
633
+ context: stepResults,
634
+ activePaths: [],
635
+ suspendedPaths: executionContext.suspendedPaths,
636
+ // @ts-ignore
637
+ timestamp: Date.now()
638
+ }
639
+ });
640
+ }
641
+ );
642
+ }
643
+ async executeConditional({
644
+ workflowId,
645
+ runId,
646
+ entry,
647
+ prevOutput,
648
+ prevStep,
649
+ stepResults,
650
+ resume,
651
+ executionContext,
652
+ emitter,
653
+ runtimeContext
654
+ }) {
655
+ let execResults;
656
+ const truthyIndexes = (await Promise.all(
657
+ entry.conditions.map(
658
+ (cond, index) => this.inngestStep.run(`workflow.${workflowId}.conditional.${index}`, async () => {
659
+ try {
660
+ const result = await cond({
661
+ mastra: this.mastra,
662
+ runtimeContext,
663
+ inputData: prevOutput,
664
+ getInitData: () => stepResults?.input,
665
+ getStepResult: (step) => {
666
+ if (!step?.id) {
667
+ return null;
668
+ }
669
+ const result2 = stepResults[step.id];
670
+ if (result2?.status === "success") {
671
+ return result2.output;
672
+ }
673
+ return null;
674
+ },
675
+ // TODO: this function shouldn't have suspend probably?
676
+ suspend: async (_suspendPayload) => {
677
+ },
678
+ emitter
679
+ });
680
+ return result ? index : null;
681
+ } catch (e) {
682
+ return null;
683
+ }
684
+ })
685
+ )
686
+ )).filter((index) => index !== null);
687
+ const stepsToRun = entry.steps.filter((_, index) => truthyIndexes.includes(index));
688
+ const results = await Promise.all(
689
+ stepsToRun.map(
690
+ (step, index) => this.executeEntry({
691
+ workflowId,
692
+ runId,
693
+ entry: step,
694
+ prevStep,
695
+ stepResults,
696
+ resume,
697
+ executionContext: {
698
+ workflowId,
699
+ runId,
700
+ executionPath: [...executionContext.executionPath, index],
701
+ suspendedPaths: executionContext.suspendedPaths,
702
+ retryConfig: executionContext.retryConfig,
703
+ executionSpan: executionContext.executionSpan
704
+ },
705
+ emitter,
706
+ runtimeContext
707
+ })
708
+ )
709
+ );
710
+ const hasFailed = results.find((result) => result.status === "failed");
711
+ const hasSuspended = results.find((result) => result.status === "suspended");
712
+ if (hasFailed) {
713
+ execResults = { status: "failed", error: hasFailed.error };
714
+ } else if (hasSuspended) {
715
+ execResults = { status: "suspended", payload: hasSuspended.payload };
716
+ } else {
717
+ execResults = {
718
+ status: "success",
719
+ output: results.reduce((acc, result, index) => {
720
+ if (result.status === "success") {
721
+ acc[stepsToRun[index].step.id] = result.output;
722
+ }
723
+ return acc;
724
+ }, {})
725
+ };
726
+ }
727
+ return execResults;
728
+ }
729
+ };
730
+
731
+ exports.InngestExecutionEngine = InngestExecutionEngine;
732
+ exports.InngestRun = InngestRun;
733
+ exports.InngestWorkflow = InngestWorkflow;
734
+ exports.init = init;
735
+ exports.serve = serve;