@mastra/inngest 0.11.1 → 0.11.2-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 +8 -0
- package/dist/index.cjs +4 -1
- package/dist/index.js +4 -1
- package/docker-compose.yaml +3 -3
- package/package.json +6 -5
- package/src/index.test.ts +250 -192
- package/src/index.ts +3 -0
- package/vitest.config.ts +6 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/inngest@0.11.
|
|
2
|
+
> @mastra/inngest@0.11.2-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.5.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 8549ms
|
|
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 6447ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m34.43 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 373ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m34.63 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 374ms
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -53,6 +53,7 @@ var InngestRun = class extends workflows.Run {
|
|
|
53
53
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
54
54
|
runs = await this.getRuns(eventId);
|
|
55
55
|
if (runs?.[0]?.status === "Failed") {
|
|
56
|
+
console.log("run", runs?.[0]);
|
|
56
57
|
throw new Error(`Function run ${runs?.[0]?.status}`);
|
|
57
58
|
} else if (runs?.[0]?.status === "Cancelled") {
|
|
58
59
|
const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
|
|
@@ -716,7 +717,9 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
716
717
|
type: "step-start",
|
|
717
718
|
payload: {
|
|
718
719
|
id: step.id,
|
|
719
|
-
status: "running"
|
|
720
|
+
status: "running",
|
|
721
|
+
payload: prevOutput,
|
|
722
|
+
startedAt: startedAt2
|
|
720
723
|
}
|
|
721
724
|
});
|
|
722
725
|
return startedAt2;
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ var InngestRun = class extends Run {
|
|
|
51
51
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
52
52
|
runs = await this.getRuns(eventId);
|
|
53
53
|
if (runs?.[0]?.status === "Failed") {
|
|
54
|
+
console.log("run", runs?.[0]);
|
|
54
55
|
throw new Error(`Function run ${runs?.[0]?.status}`);
|
|
55
56
|
} else if (runs?.[0]?.status === "Cancelled") {
|
|
56
57
|
const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
|
|
@@ -714,7 +715,9 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
714
715
|
type: "step-start",
|
|
715
716
|
payload: {
|
|
716
717
|
id: step.id,
|
|
717
|
-
status: "running"
|
|
718
|
+
status: "running",
|
|
719
|
+
payload: prevOutput,
|
|
720
|
+
startedAt: startedAt2
|
|
718
721
|
}
|
|
719
722
|
});
|
|
720
723
|
return startedAt2;
|
package/docker-compose.yaml
CHANGED
|
@@ -2,9 +2,9 @@ version: '3'
|
|
|
2
2
|
|
|
3
3
|
services:
|
|
4
4
|
inngest:
|
|
5
|
-
image: inngest/inngest
|
|
6
|
-
command: inngest dev -u http://host.docker.internal:
|
|
5
|
+
image: inngest/inngest:v1.5.10
|
|
6
|
+
command: inngest dev -p 4000 -u http://host.docker.internal:4001/inngest/api --poll-interval=1
|
|
7
7
|
ports:
|
|
8
|
-
- '
|
|
8
|
+
- '4000:4000'
|
|
9
9
|
extra_hosts:
|
|
10
10
|
- 'host.docker.internal:host-gateway'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/inngest",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2-alpha.0",
|
|
4
4
|
"description": "Mastra Inngest integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"zod": "^3.25.67"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"inngest-cli": "1.8.2",
|
|
28
29
|
"@ai-sdk/openai": "^1.3.22",
|
|
29
30
|
"@hono/node-server": "^1.14.4",
|
|
30
31
|
"@microsoft/api-extractor": "^7.52.8",
|
|
@@ -37,10 +38,10 @@
|
|
|
37
38
|
"tsup": "^8.5.0",
|
|
38
39
|
"typescript": "^5.8.3",
|
|
39
40
|
"vitest": "^3.2.4",
|
|
40
|
-
"@
|
|
41
|
+
"@mastra/core": "0.10.10-alpha.0",
|
|
41
42
|
"@mastra/libsql": "0.11.0",
|
|
42
|
-
"@mastra/deployer": "0.10.
|
|
43
|
-
"@
|
|
43
|
+
"@mastra/deployer": "0.10.10-alpha.0",
|
|
44
|
+
"@internal/lint": "0.0.16"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"@mastra/core": ">=0.10.9-0 <0.11.0-0"
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
|
50
51
|
"build:watch": "pnpm build --watch",
|
|
51
|
-
"test": "vitest run",
|
|
52
|
+
"test": "docker-compose up -d && vitest run --no-isolate --bail=1 --retry=1 && docker-compose down",
|
|
52
53
|
"lint": "eslint ."
|
|
53
54
|
}
|
|
54
55
|
}
|
package/src/index.test.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { randomUUID } from 'crypto';
|
|
2
1
|
import fs from 'fs';
|
|
3
2
|
import path from 'path';
|
|
4
3
|
import { openai } from '@ai-sdk/openai';
|
|
@@ -12,9 +11,8 @@ import { createHonoServer } from '@mastra/deployer/server';
|
|
|
12
11
|
import { DefaultStorage } from '@mastra/libsql';
|
|
13
12
|
import { MockLanguageModelV1, simulateReadableStream } from 'ai/test';
|
|
14
13
|
import { $ } from 'execa';
|
|
15
|
-
import getPort from 'get-port';
|
|
16
14
|
import { Inngest } from 'inngest';
|
|
17
|
-
import { afterAll,
|
|
15
|
+
import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
18
16
|
|
|
19
17
|
import { z } from 'zod';
|
|
20
18
|
import { init, serve as inngestServe } from './index';
|
|
@@ -22,27 +20,27 @@ import { init, serve as inngestServe } from './index';
|
|
|
22
20
|
interface LocalTestContext {
|
|
23
21
|
inngestPort: number;
|
|
24
22
|
handlerPort: number;
|
|
25
|
-
|
|
23
|
+
srv?: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function resetInngest() {
|
|
27
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
28
|
+
await $`docker-compose restart`;
|
|
29
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
describe('MastraInngestWorkflow', () => {
|
|
33
|
+
let globServer: any;
|
|
34
|
+
|
|
29
35
|
beforeEach<LocalTestContext>(async ctx => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const containerName = randomUUID();
|
|
33
|
-
await $`docker run --rm -d --name ${containerName} -p ${inngestPort}:${inngestPort} inngest/inngest:v1.5.10 inngest dev -p ${inngestPort} -u http://host.docker.internal:${handlerPort}/inngest/api`;
|
|
36
|
+
ctx.inngestPort = 4000;
|
|
37
|
+
ctx.handlerPort = 4001;
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
ctx.handlerPort = handlerPort;
|
|
37
|
-
ctx.containerName = containerName;
|
|
39
|
+
globServer?.close();
|
|
38
40
|
|
|
39
41
|
vi.restoreAllMocks();
|
|
40
42
|
});
|
|
41
43
|
|
|
42
|
-
afterEach<LocalTestContext>(async ctx => {
|
|
43
|
-
await $`docker stop ${ctx.containerName}`;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
44
|
describe.sequential('Basic Workflow Execution', () => {
|
|
47
45
|
it('should be able to bail workflow execution', async ctx => {
|
|
48
46
|
const inngest = new Inngest({
|
|
@@ -105,15 +103,17 @@ describe('MastraInngestWorkflow', () => {
|
|
|
105
103
|
|
|
106
104
|
const app = await createHonoServer(mastra);
|
|
107
105
|
|
|
108
|
-
const srv = serve({
|
|
106
|
+
const srv = (globServer = serve({
|
|
109
107
|
fetch: app.fetch,
|
|
110
108
|
port: (ctx as any).handlerPort,
|
|
111
|
-
});
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
await resetInngest();
|
|
112
112
|
|
|
113
113
|
const run = await workflow.createRunAsync();
|
|
114
|
+
console.log('running');
|
|
114
115
|
const result = await run.start({ inputData: { value: 'bail' } });
|
|
115
|
-
|
|
116
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
116
|
+
console.log('result', result);
|
|
117
117
|
|
|
118
118
|
expect(result.steps['step1']).toEqual({
|
|
119
119
|
status: 'success',
|
|
@@ -192,11 +192,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
192
192
|
|
|
193
193
|
const app = await createHonoServer(mastra);
|
|
194
194
|
|
|
195
|
-
const srv = serve({
|
|
195
|
+
const srv = (globServer = serve({
|
|
196
196
|
fetch: app.fetch,
|
|
197
197
|
port: (ctx as any).handlerPort,
|
|
198
|
-
});
|
|
199
|
-
await
|
|
198
|
+
}));
|
|
199
|
+
await resetInngest();
|
|
200
200
|
|
|
201
201
|
const run = await workflow.createRunAsync();
|
|
202
202
|
const result = await run.start({ inputData: {} });
|
|
@@ -267,11 +267,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
267
267
|
|
|
268
268
|
const app = await createHonoServer(mastra);
|
|
269
269
|
|
|
270
|
-
const srv = serve({
|
|
270
|
+
const srv = (globServer = serve({
|
|
271
271
|
fetch: app.fetch,
|
|
272
272
|
port: (ctx as any).handlerPort,
|
|
273
|
-
});
|
|
274
|
-
await
|
|
273
|
+
}));
|
|
274
|
+
await resetInngest();
|
|
275
275
|
|
|
276
276
|
const run = await workflow.createRunAsync();
|
|
277
277
|
const result = await run.start({ inputData: {} });
|
|
@@ -348,11 +348,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
348
348
|
|
|
349
349
|
const app = await createHonoServer(mastra);
|
|
350
350
|
|
|
351
|
-
const srv = serve({
|
|
351
|
+
const srv = (globServer = serve({
|
|
352
352
|
fetch: app.fetch,
|
|
353
353
|
port: (ctx as any).handlerPort,
|
|
354
|
-
});
|
|
355
|
-
await
|
|
354
|
+
}));
|
|
355
|
+
await resetInngest();
|
|
356
356
|
|
|
357
357
|
const run = await workflow.createRunAsync();
|
|
358
358
|
const result = await run.start({ inputData: {} });
|
|
@@ -422,11 +422,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
422
422
|
|
|
423
423
|
const app = await createHonoServer(mastra);
|
|
424
424
|
|
|
425
|
-
const srv = serve({
|
|
425
|
+
const srv = (globServer = serve({
|
|
426
426
|
fetch: app.fetch,
|
|
427
427
|
port: (ctx as any).handlerPort,
|
|
428
|
-
});
|
|
429
|
-
await
|
|
428
|
+
}));
|
|
429
|
+
await resetInngest();
|
|
430
430
|
|
|
431
431
|
const run = await workflow.createRunAsync();
|
|
432
432
|
const startTime = Date.now();
|
|
@@ -514,11 +514,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
514
514
|
|
|
515
515
|
const app = await createHonoServer(mastra);
|
|
516
516
|
|
|
517
|
-
const srv = serve({
|
|
517
|
+
const srv = (globServer = serve({
|
|
518
518
|
fetch: app.fetch,
|
|
519
519
|
port: (ctx as any).handlerPort,
|
|
520
|
-
});
|
|
521
|
-
await
|
|
520
|
+
}));
|
|
521
|
+
await resetInngest();
|
|
522
522
|
|
|
523
523
|
const run = await workflow.createRunAsync();
|
|
524
524
|
const startTime = Date.now();
|
|
@@ -604,11 +604,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
604
604
|
|
|
605
605
|
const app = await createHonoServer(mastra);
|
|
606
606
|
|
|
607
|
-
const srv = serve({
|
|
607
|
+
const srv = (globServer = serve({
|
|
608
608
|
fetch: app.fetch,
|
|
609
609
|
port: (ctx as any).handlerPort,
|
|
610
|
-
});
|
|
611
|
-
await
|
|
610
|
+
}));
|
|
611
|
+
await resetInngest();
|
|
612
612
|
|
|
613
613
|
const run = await workflow.createRunAsync();
|
|
614
614
|
const startTime = Date.now();
|
|
@@ -698,11 +698,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
698
698
|
|
|
699
699
|
const app = await createHonoServer(mastra);
|
|
700
700
|
|
|
701
|
-
const srv = serve({
|
|
701
|
+
const srv = (globServer = serve({
|
|
702
702
|
fetch: app.fetch,
|
|
703
703
|
port: (ctx as any).handlerPort,
|
|
704
|
-
});
|
|
705
|
-
await
|
|
704
|
+
}));
|
|
705
|
+
await resetInngest();
|
|
706
706
|
|
|
707
707
|
const run = await workflow.createRunAsync();
|
|
708
708
|
const startTime = Date.now();
|
|
@@ -790,11 +790,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
790
790
|
|
|
791
791
|
const app = await createHonoServer(mastra);
|
|
792
792
|
|
|
793
|
-
const srv = serve({
|
|
793
|
+
const srv = (globServer = serve({
|
|
794
794
|
fetch: app.fetch,
|
|
795
795
|
port: (ctx as any).handlerPort,
|
|
796
|
-
});
|
|
797
|
-
await
|
|
796
|
+
}));
|
|
797
|
+
await resetInngest();
|
|
798
798
|
|
|
799
799
|
const run = await workflow.createRunAsync();
|
|
800
800
|
const p = run.start({ inputData: { value: 'test' } });
|
|
@@ -892,11 +892,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
892
892
|
|
|
893
893
|
const app = await createHonoServer(mastra);
|
|
894
894
|
|
|
895
|
-
const srv = serve({
|
|
895
|
+
const srv = (globServer = serve({
|
|
896
896
|
fetch: app.fetch,
|
|
897
897
|
port: (ctx as any).handlerPort,
|
|
898
|
-
});
|
|
899
|
-
await
|
|
898
|
+
}));
|
|
899
|
+
await resetInngest();
|
|
900
900
|
|
|
901
901
|
const run = await workflow.createRunAsync();
|
|
902
902
|
const p = run.start({ inputData: { value: 'test' } });
|
|
@@ -981,10 +981,12 @@ describe('MastraInngestWorkflow', () => {
|
|
|
981
981
|
|
|
982
982
|
const app = await createHonoServer(mastra);
|
|
983
983
|
|
|
984
|
-
const srv = serve({
|
|
984
|
+
const srv = (globServer = serve({
|
|
985
985
|
fetch: app.fetch,
|
|
986
986
|
port: (ctx as any).handlerPort,
|
|
987
|
-
});
|
|
987
|
+
}));
|
|
988
|
+
|
|
989
|
+
await resetInngest();
|
|
988
990
|
|
|
989
991
|
const run = await workflow.createRunAsync();
|
|
990
992
|
const result = await run.start({ inputData: { inputData: 'test-input' } });
|
|
@@ -1068,10 +1070,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1068
1070
|
|
|
1069
1071
|
const app = await createHonoServer(mastra);
|
|
1070
1072
|
|
|
1071
|
-
const srv = serve({
|
|
1073
|
+
const srv = (globServer = serve({
|
|
1072
1074
|
fetch: app.fetch,
|
|
1073
1075
|
port: (ctx as any).handlerPort,
|
|
1074
|
-
});
|
|
1076
|
+
}));
|
|
1077
|
+
await resetInngest();
|
|
1075
1078
|
|
|
1076
1079
|
const run = await workflow.createRunAsync();
|
|
1077
1080
|
const result = await run.start({ inputData: { inputValue: 'test-input' } });
|
|
@@ -1135,10 +1138,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1135
1138
|
|
|
1136
1139
|
const app = await createHonoServer(mastra);
|
|
1137
1140
|
|
|
1138
|
-
const srv = serve({
|
|
1141
|
+
const srv = (globServer = serve({
|
|
1139
1142
|
fetch: app.fetch,
|
|
1140
1143
|
port: (ctx as any).handlerPort,
|
|
1141
|
-
});
|
|
1144
|
+
}));
|
|
1145
|
+
await resetInngest();
|
|
1142
1146
|
|
|
1143
1147
|
const run = await workflow.createRunAsync();
|
|
1144
1148
|
await run.start({ inputData: { inputData: 'test-input' } });
|
|
@@ -1210,10 +1214,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1210
1214
|
|
|
1211
1215
|
const app = await createHonoServer(mastra);
|
|
1212
1216
|
|
|
1213
|
-
const srv = serve({
|
|
1217
|
+
const srv = (globServer = serve({
|
|
1214
1218
|
fetch: app.fetch,
|
|
1215
1219
|
port: (ctx as any).handlerPort,
|
|
1216
|
-
});
|
|
1220
|
+
}));
|
|
1221
|
+
await resetInngest();
|
|
1217
1222
|
|
|
1218
1223
|
const run = await workflow.createRunAsync();
|
|
1219
1224
|
const result = await run.start({ inputData: { cool: 'test-input' } });
|
|
@@ -1292,10 +1297,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1292
1297
|
|
|
1293
1298
|
const app = await createHonoServer(mastra);
|
|
1294
1299
|
|
|
1295
|
-
const srv = serve({
|
|
1300
|
+
const srv = (globServer = serve({
|
|
1296
1301
|
fetch: app.fetch,
|
|
1297
1302
|
port: (ctx as any).handlerPort,
|
|
1298
|
-
});
|
|
1303
|
+
}));
|
|
1304
|
+
await resetInngest();
|
|
1299
1305
|
|
|
1300
1306
|
const run = await workflow.createRunAsync();
|
|
1301
1307
|
await run.start({ inputData: {} });
|
|
@@ -1395,10 +1401,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1395
1401
|
|
|
1396
1402
|
const app = await createHonoServer(mastra);
|
|
1397
1403
|
|
|
1398
|
-
const srv = serve({
|
|
1404
|
+
const srv = (globServer = serve({
|
|
1399
1405
|
fetch: app.fetch,
|
|
1400
1406
|
port: (ctx as any).handlerPort,
|
|
1401
|
-
});
|
|
1407
|
+
}));
|
|
1408
|
+
await resetInngest();
|
|
1402
1409
|
|
|
1403
1410
|
const run = await workflow.createRunAsync();
|
|
1404
1411
|
const result = await run.start({ inputData: { status: 'success' } });
|
|
@@ -1471,10 +1478,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1471
1478
|
|
|
1472
1479
|
const app = await createHonoServer(mastra);
|
|
1473
1480
|
|
|
1474
|
-
const srv = serve({
|
|
1481
|
+
const srv = (globServer = serve({
|
|
1475
1482
|
fetch: app.fetch,
|
|
1476
1483
|
port: (ctx as any).handlerPort,
|
|
1477
|
-
});
|
|
1484
|
+
}));
|
|
1485
|
+
await resetInngest();
|
|
1478
1486
|
|
|
1479
1487
|
const run = await workflow.createRunAsync();
|
|
1480
1488
|
let result: Awaited<ReturnType<typeof run.start>> | undefined = undefined;
|
|
@@ -1576,10 +1584,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1576
1584
|
|
|
1577
1585
|
const app = await createHonoServer(mastra);
|
|
1578
1586
|
|
|
1579
|
-
const srv = serve({
|
|
1587
|
+
const srv = (globServer = serve({
|
|
1580
1588
|
fetch: app.fetch,
|
|
1581
1589
|
port: (ctx as any).handlerPort,
|
|
1582
|
-
});
|
|
1590
|
+
}));
|
|
1591
|
+
await resetInngest();
|
|
1583
1592
|
|
|
1584
1593
|
const run = await workflow.createRunAsync();
|
|
1585
1594
|
const result = await run.start({ inputData: { status: 'success' } });
|
|
@@ -1659,10 +1668,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1659
1668
|
|
|
1660
1669
|
const app = await createHonoServer(mastra);
|
|
1661
1670
|
|
|
1662
|
-
const srv = serve({
|
|
1671
|
+
const srv = (globServer = serve({
|
|
1663
1672
|
fetch: app.fetch,
|
|
1664
1673
|
port: (ctx as any).handlerPort,
|
|
1665
|
-
});
|
|
1674
|
+
}));
|
|
1675
|
+
await resetInngest();
|
|
1666
1676
|
|
|
1667
1677
|
const run = await workflow.createRunAsync();
|
|
1668
1678
|
const result = await run.start({ inputData: { count: 5 } });
|
|
@@ -1726,11 +1736,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1726
1736
|
|
|
1727
1737
|
const app = await createHonoServer(mastra);
|
|
1728
1738
|
|
|
1729
|
-
const srv = serve({
|
|
1739
|
+
const srv = (globServer = serve({
|
|
1730
1740
|
fetch: app.fetch,
|
|
1731
1741
|
port: (ctx as any).handlerPort,
|
|
1732
|
-
});
|
|
1733
|
-
await
|
|
1742
|
+
}));
|
|
1743
|
+
await resetInngest();
|
|
1734
1744
|
|
|
1735
1745
|
const run = await workflow.createRunAsync();
|
|
1736
1746
|
|
|
@@ -1810,11 +1820,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1810
1820
|
|
|
1811
1821
|
const app = await createHonoServer(mastra);
|
|
1812
1822
|
|
|
1813
|
-
const srv = serve({
|
|
1823
|
+
const srv = (globServer = serve({
|
|
1814
1824
|
fetch: app.fetch,
|
|
1815
1825
|
port: (ctx as any).handlerPort,
|
|
1816
|
-
});
|
|
1817
|
-
await
|
|
1826
|
+
}));
|
|
1827
|
+
await resetInngest();
|
|
1818
1828
|
|
|
1819
1829
|
const run = await workflow.createRunAsync();
|
|
1820
1830
|
const result = await run.start({ inputData: {} });
|
|
@@ -1904,11 +1914,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
1904
1914
|
|
|
1905
1915
|
const app = await createHonoServer(mastra);
|
|
1906
1916
|
|
|
1907
|
-
const srv = serve({
|
|
1917
|
+
const srv = (globServer = serve({
|
|
1908
1918
|
fetch: app.fetch,
|
|
1909
1919
|
port: (ctx as any).handlerPort,
|
|
1910
|
-
});
|
|
1911
|
-
await
|
|
1920
|
+
}));
|
|
1921
|
+
await resetInngest();
|
|
1912
1922
|
|
|
1913
1923
|
const run = await mainWorkflow.createRunAsync();
|
|
1914
1924
|
const result = await run.start({ inputData: {} });
|
|
@@ -2032,11 +2042,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2032
2042
|
|
|
2033
2043
|
const app = await createHonoServer(mastra);
|
|
2034
2044
|
|
|
2035
|
-
const srv = serve({
|
|
2045
|
+
const srv = (globServer = serve({
|
|
2036
2046
|
fetch: app.fetch,
|
|
2037
2047
|
port: (ctx as any).handlerPort,
|
|
2038
|
-
});
|
|
2039
|
-
await
|
|
2048
|
+
}));
|
|
2049
|
+
await resetInngest();
|
|
2040
2050
|
|
|
2041
2051
|
const run = await workflow.createRunAsync();
|
|
2042
2052
|
const result = await run.start({ inputData: {} });
|
|
@@ -2134,11 +2144,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2134
2144
|
|
|
2135
2145
|
const app = await createHonoServer(mastra);
|
|
2136
2146
|
|
|
2137
|
-
const srv = serve({
|
|
2147
|
+
const srv = (globServer = serve({
|
|
2138
2148
|
fetch: app.fetch,
|
|
2139
2149
|
port: (ctx as any).handlerPort,
|
|
2140
|
-
});
|
|
2141
|
-
await
|
|
2150
|
+
}));
|
|
2151
|
+
await resetInngest();
|
|
2142
2152
|
|
|
2143
2153
|
const run = await counterWorkflow.createRunAsync();
|
|
2144
2154
|
const result = await run.start({ inputData: { target: 10, value: 0 } });
|
|
@@ -2237,11 +2247,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2237
2247
|
|
|
2238
2248
|
const app = await createHonoServer(mastra);
|
|
2239
2249
|
|
|
2240
|
-
const srv = serve({
|
|
2250
|
+
const srv = (globServer = serve({
|
|
2241
2251
|
fetch: app.fetch,
|
|
2242
2252
|
port: (ctx as any).handlerPort,
|
|
2243
|
-
});
|
|
2244
|
-
await
|
|
2253
|
+
}));
|
|
2254
|
+
await resetInngest();
|
|
2245
2255
|
|
|
2246
2256
|
const run = await counterWorkflow.createRunAsync();
|
|
2247
2257
|
const result = await run.start({ inputData: { target: 10, value: 0 } });
|
|
@@ -2326,11 +2336,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2326
2336
|
|
|
2327
2337
|
const app = await createHonoServer(mastra);
|
|
2328
2338
|
|
|
2329
|
-
const srv = serve({
|
|
2339
|
+
const srv = (globServer = serve({
|
|
2330
2340
|
fetch: app.fetch,
|
|
2331
2341
|
port: (ctx as any).handlerPort,
|
|
2332
|
-
});
|
|
2333
|
-
await
|
|
2342
|
+
}));
|
|
2343
|
+
await resetInngest();
|
|
2334
2344
|
|
|
2335
2345
|
const run = await counterWorkflow.createRunAsync();
|
|
2336
2346
|
const result = await run.start({ inputData: [{ value: 1 }, { value: 22 }, { value: 333 }] });
|
|
@@ -2479,11 +2489,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2479
2489
|
|
|
2480
2490
|
const app = await createHonoServer(mastra);
|
|
2481
2491
|
|
|
2482
|
-
const srv = serve({
|
|
2492
|
+
const srv = (globServer = serve({
|
|
2483
2493
|
fetch: app.fetch,
|
|
2484
2494
|
port: (ctx as any).handlerPort,
|
|
2485
|
-
});
|
|
2486
|
-
await
|
|
2495
|
+
}));
|
|
2496
|
+
await resetInngest();
|
|
2487
2497
|
|
|
2488
2498
|
const run = await counterWorkflow.createRunAsync();
|
|
2489
2499
|
const result = await run.start({ inputData: { startValue: 1 } });
|
|
@@ -2628,15 +2638,17 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2628
2638
|
|
|
2629
2639
|
const app = await createHonoServer(mastra);
|
|
2630
2640
|
|
|
2631
|
-
const srv = serve({
|
|
2641
|
+
const srv = (globServer = serve({
|
|
2632
2642
|
fetch: app.fetch,
|
|
2633
2643
|
port: (ctx as any).handlerPort,
|
|
2634
|
-
});
|
|
2635
|
-
await
|
|
2644
|
+
}));
|
|
2645
|
+
await resetInngest();
|
|
2636
2646
|
|
|
2637
2647
|
const run = await counterWorkflow.createRunAsync();
|
|
2638
2648
|
const result = await run.start({ inputData: { startValue: 6 } });
|
|
2639
2649
|
|
|
2650
|
+
srv.close();
|
|
2651
|
+
|
|
2640
2652
|
expect(start).toHaveBeenCalledTimes(1);
|
|
2641
2653
|
expect(other).toHaveBeenCalledTimes(1);
|
|
2642
2654
|
expect(final).toHaveBeenCalledTimes(1);
|
|
@@ -2644,8 +2656,6 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2644
2656
|
expect(result.steps['else-branch'].output).toMatchObject({ finalValue: 26 + 6 + 1 });
|
|
2645
2657
|
// @ts-ignore
|
|
2646
2658
|
expect(result.steps.start.output).toMatchObject({ newValue: 7 });
|
|
2647
|
-
|
|
2648
|
-
srv.close();
|
|
2649
2659
|
});
|
|
2650
2660
|
});
|
|
2651
2661
|
|
|
@@ -2800,19 +2810,19 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2800
2810
|
|
|
2801
2811
|
const app = await createHonoServer(mastra);
|
|
2802
2812
|
|
|
2803
|
-
const srv = serve({
|
|
2813
|
+
const srv = (globServer = serve({
|
|
2804
2814
|
fetch: app.fetch,
|
|
2805
2815
|
port: (ctx as any).handlerPort,
|
|
2806
|
-
});
|
|
2807
|
-
await
|
|
2816
|
+
}));
|
|
2817
|
+
await resetInngest();
|
|
2808
2818
|
|
|
2809
2819
|
const run = await workflow.createRunAsync();
|
|
2810
2820
|
const result = await run.start({ inputData: {} });
|
|
2811
2821
|
|
|
2822
|
+
srv.close();
|
|
2823
|
+
|
|
2812
2824
|
expect(result.steps['nested-a']).toMatchObject({ status: 'success', output: { result: 'success3' } });
|
|
2813
2825
|
expect(result.steps['nested-b']).toMatchObject({ status: 'success', output: { result: 'success5' } });
|
|
2814
|
-
|
|
2815
|
-
srv.close();
|
|
2816
2826
|
});
|
|
2817
2827
|
});
|
|
2818
2828
|
|
|
@@ -2866,21 +2876,21 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2866
2876
|
|
|
2867
2877
|
const app = await createHonoServer(mastra);
|
|
2868
2878
|
|
|
2869
|
-
const srv = serve({
|
|
2879
|
+
const srv = (globServer = serve({
|
|
2870
2880
|
fetch: app.fetch,
|
|
2871
2881
|
port: (ctx as any).handlerPort,
|
|
2872
|
-
});
|
|
2873
|
-
await
|
|
2882
|
+
}));
|
|
2883
|
+
await resetInngest();
|
|
2874
2884
|
|
|
2875
2885
|
const run = await workflow.createRunAsync();
|
|
2876
2886
|
const result = await run.start({ inputData: {} });
|
|
2877
2887
|
|
|
2888
|
+
srv.close();
|
|
2889
|
+
|
|
2878
2890
|
expect(result.steps.step1).toMatchObject({ status: 'success', output: { result: 'success' } });
|
|
2879
2891
|
expect(result.steps.step2).toMatchObject({ status: 'failed', error: 'Step failed' });
|
|
2880
2892
|
expect(step1.execute).toHaveBeenCalledTimes(1);
|
|
2881
2893
|
expect(step2.execute).toHaveBeenCalledTimes(1); // 0 retries + 1 initial call
|
|
2882
|
-
|
|
2883
|
-
srv.close();
|
|
2884
2894
|
});
|
|
2885
2895
|
|
|
2886
2896
|
// Need to fix so we can throw for inngest to recognize retries
|
|
@@ -2998,11 +3008,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
2998
3008
|
|
|
2999
3009
|
const app = await createHonoServer(mastra);
|
|
3000
3010
|
|
|
3001
|
-
const srv = serve({
|
|
3011
|
+
const srv = (globServer = serve({
|
|
3002
3012
|
fetch: app.fetch,
|
|
3003
3013
|
port: (ctx as any).handlerPort,
|
|
3004
|
-
});
|
|
3005
|
-
await
|
|
3014
|
+
}));
|
|
3015
|
+
await resetInngest();
|
|
3006
3016
|
|
|
3007
3017
|
const run = await workflow.createRunAsync();
|
|
3008
3018
|
const result = await run.start({ inputData: {} });
|
|
@@ -3070,11 +3080,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3070
3080
|
|
|
3071
3081
|
const app = await createHonoServer(mastra);
|
|
3072
3082
|
|
|
3073
|
-
const srv = serve({
|
|
3083
|
+
const srv = (globServer = serve({
|
|
3074
3084
|
fetch: app.fetch,
|
|
3075
3085
|
port: (ctx as any).handlerPort,
|
|
3076
|
-
});
|
|
3077
|
-
await
|
|
3086
|
+
}));
|
|
3087
|
+
await resetInngest();
|
|
3078
3088
|
|
|
3079
3089
|
const run = await workflow.createRunAsync();
|
|
3080
3090
|
|
|
@@ -3087,7 +3097,9 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3087
3097
|
});
|
|
3088
3098
|
|
|
3089
3099
|
const executionResult = await run.start({ inputData: {} });
|
|
3090
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
3100
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
3101
|
+
|
|
3102
|
+
srv.close();
|
|
3091
3103
|
|
|
3092
3104
|
expect(cnt).toBe(5);
|
|
3093
3105
|
expect(resps.length).toBe(5);
|
|
@@ -3199,8 +3211,6 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3199
3211
|
status: 'success',
|
|
3200
3212
|
output: { result: 'success2' },
|
|
3201
3213
|
});
|
|
3202
|
-
|
|
3203
|
-
srv.close();
|
|
3204
3214
|
});
|
|
3205
3215
|
|
|
3206
3216
|
it('should unsubscribe from transitions when unwatch is called', async ctx => {
|
|
@@ -3256,11 +3266,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3256
3266
|
|
|
3257
3267
|
const app = await createHonoServer(mastra);
|
|
3258
3268
|
|
|
3259
|
-
const srv = serve({
|
|
3269
|
+
const srv = (globServer = serve({
|
|
3260
3270
|
fetch: app.fetch,
|
|
3261
3271
|
port: (ctx as any).handlerPort,
|
|
3262
|
-
});
|
|
3263
|
-
await
|
|
3272
|
+
}));
|
|
3273
|
+
await resetInngest();
|
|
3264
3274
|
|
|
3265
3275
|
const onTransition = vi.fn();
|
|
3266
3276
|
const onTransition2 = vi.fn();
|
|
@@ -3428,11 +3438,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3428
3438
|
|
|
3429
3439
|
const app = await createHonoServer(mastra);
|
|
3430
3440
|
|
|
3431
|
-
const srv = serve({
|
|
3441
|
+
const srv = (globServer = serve({
|
|
3432
3442
|
fetch: app.fetch,
|
|
3433
3443
|
port: (ctx as any).handlerPort,
|
|
3434
|
-
});
|
|
3435
|
-
await
|
|
3444
|
+
}));
|
|
3445
|
+
await resetInngest();
|
|
3436
3446
|
|
|
3437
3447
|
const run = await promptEvalWorkflow.createRunAsync();
|
|
3438
3448
|
|
|
@@ -3578,11 +3588,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3578
3588
|
|
|
3579
3589
|
const app = await createHonoServer(mastra);
|
|
3580
3590
|
|
|
3581
|
-
const srv = serve({
|
|
3591
|
+
const srv = (globServer = serve({
|
|
3582
3592
|
fetch: app.fetch,
|
|
3583
3593
|
port: (ctx as any).handlerPort,
|
|
3584
|
-
});
|
|
3585
|
-
await
|
|
3594
|
+
}));
|
|
3595
|
+
await resetInngest();
|
|
3586
3596
|
|
|
3587
3597
|
const run = await workflow.createRunAsync();
|
|
3588
3598
|
|
|
@@ -3616,13 +3626,13 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3616
3626
|
|
|
3617
3627
|
const initialResult = await started;
|
|
3618
3628
|
|
|
3629
|
+
srv.close();
|
|
3630
|
+
|
|
3619
3631
|
expect(initialResult.steps.humanIntervention.status).toBe('suspended');
|
|
3620
3632
|
expect(initialResult.steps.explainResponse).toBeUndefined();
|
|
3621
3633
|
expect(humanInterventionAction).toHaveBeenCalledTimes(2);
|
|
3622
3634
|
expect(explainResponseAction).not.toHaveBeenCalled();
|
|
3623
3635
|
|
|
3624
|
-
srv.close();
|
|
3625
|
-
|
|
3626
3636
|
if (!result) {
|
|
3627
3637
|
throw new Error('Resume failed to return a result');
|
|
3628
3638
|
}
|
|
@@ -3780,11 +3790,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3780
3790
|
|
|
3781
3791
|
const app = await createHonoServer(mastra);
|
|
3782
3792
|
|
|
3783
|
-
const srv = serve({
|
|
3793
|
+
const srv = (globServer = serve({
|
|
3784
3794
|
fetch: app.fetch,
|
|
3785
3795
|
port: (ctx as any).handlerPort,
|
|
3786
|
-
});
|
|
3787
|
-
await
|
|
3796
|
+
}));
|
|
3797
|
+
await resetInngest();
|
|
3788
3798
|
|
|
3789
3799
|
const run = await workflow.createRunAsync();
|
|
3790
3800
|
const started = run.start({ inputData: { input: 'test' } });
|
|
@@ -3837,11 +3847,12 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3837
3847
|
// @ts-ignore
|
|
3838
3848
|
const improvedResponseResult = await improvedResponseResultPromise;
|
|
3839
3849
|
|
|
3850
|
+
srv.close();
|
|
3851
|
+
|
|
3840
3852
|
expect(improvedResponseResult?.steps.humanIntervention.status).toBe('suspended');
|
|
3841
3853
|
expect(improvedResponseResult?.steps.improveResponse.status).toBe('success');
|
|
3842
3854
|
expect(improvedResponseResult?.steps.evaluateImprovedResponse.status).toBe('success');
|
|
3843
3855
|
|
|
3844
|
-
srv.close();
|
|
3845
3856
|
if (!result) {
|
|
3846
3857
|
throw new Error('Resume failed to return a result');
|
|
3847
3858
|
}
|
|
@@ -3974,11 +3985,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
3974
3985
|
|
|
3975
3986
|
const app = await createHonoServer(mastra);
|
|
3976
3987
|
|
|
3977
|
-
const srv = serve({
|
|
3988
|
+
const srv = (globServer = serve({
|
|
3978
3989
|
fetch: app.fetch,
|
|
3979
3990
|
port: (ctx as any).handlerPort,
|
|
3980
|
-
});
|
|
3981
|
-
await
|
|
3991
|
+
}));
|
|
3992
|
+
await resetInngest();
|
|
3982
3993
|
|
|
3983
3994
|
const run = await promptEvalWorkflow.createRunAsync();
|
|
3984
3995
|
|
|
@@ -4033,6 +4044,9 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4033
4044
|
completenessScore: { score: 0.7 },
|
|
4034
4045
|
},
|
|
4035
4046
|
});
|
|
4047
|
+
|
|
4048
|
+
srv.close();
|
|
4049
|
+
|
|
4036
4050
|
if (!secondResumeResult) {
|
|
4037
4051
|
throw new Error('Resume failed to return a result');
|
|
4038
4052
|
}
|
|
@@ -4055,8 +4069,6 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4055
4069
|
});
|
|
4056
4070
|
|
|
4057
4071
|
expect(promptAgentAction).toHaveBeenCalledTimes(2);
|
|
4058
|
-
|
|
4059
|
-
srv.close();
|
|
4060
4072
|
});
|
|
4061
4073
|
});
|
|
4062
4074
|
|
|
@@ -4102,11 +4114,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4102
4114
|
|
|
4103
4115
|
const app = await createHonoServer(mastra);
|
|
4104
4116
|
|
|
4105
|
-
const srv = serve({
|
|
4117
|
+
const srv = (globServer = serve({
|
|
4106
4118
|
fetch: app.fetch,
|
|
4107
4119
|
port: (ctx as any).handlerPort,
|
|
4108
|
-
});
|
|
4109
|
-
await
|
|
4120
|
+
}));
|
|
4121
|
+
await resetInngest();
|
|
4110
4122
|
|
|
4111
4123
|
// Access new instance properties directly - should work without warning
|
|
4112
4124
|
const run = await workflow.createRunAsync();
|
|
@@ -4206,11 +4218,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4206
4218
|
|
|
4207
4219
|
const app = await createHonoServer(mastra);
|
|
4208
4220
|
|
|
4209
|
-
const srv = serve({
|
|
4221
|
+
const srv = (globServer = serve({
|
|
4210
4222
|
fetch: app.fetch,
|
|
4211
4223
|
port: (ctx as any).handlerPort,
|
|
4212
|
-
});
|
|
4213
|
-
await
|
|
4224
|
+
}));
|
|
4225
|
+
await resetInngest();
|
|
4214
4226
|
|
|
4215
4227
|
const run = await workflow.createRunAsync();
|
|
4216
4228
|
const result = await run.start({
|
|
@@ -4343,11 +4355,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4343
4355
|
|
|
4344
4356
|
const app = await createHonoServer(mastra);
|
|
4345
4357
|
|
|
4346
|
-
const srv = serve({
|
|
4358
|
+
const srv = (globServer = serve({
|
|
4347
4359
|
fetch: app.fetch,
|
|
4348
4360
|
port: (ctx as any).handlerPort,
|
|
4349
|
-
});
|
|
4350
|
-
await
|
|
4361
|
+
}));
|
|
4362
|
+
await resetInngest();
|
|
4351
4363
|
|
|
4352
4364
|
const run = await workflow.createRunAsync();
|
|
4353
4365
|
const result = await run.start({
|
|
@@ -4486,11 +4498,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4486
4498
|
|
|
4487
4499
|
const app = await createHonoServer(mastra);
|
|
4488
4500
|
|
|
4489
|
-
const srv = serve({
|
|
4501
|
+
const srv = (globServer = serve({
|
|
4490
4502
|
fetch: app.fetch,
|
|
4491
4503
|
port: (ctx as any).handlerPort,
|
|
4492
|
-
});
|
|
4493
|
-
await
|
|
4504
|
+
}));
|
|
4505
|
+
await resetInngest();
|
|
4494
4506
|
|
|
4495
4507
|
const run = await counterWorkflow.createRunAsync();
|
|
4496
4508
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -4638,11 +4650,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4638
4650
|
|
|
4639
4651
|
const app = await createHonoServer(mastra);
|
|
4640
4652
|
|
|
4641
|
-
const srv = serve({
|
|
4653
|
+
const srv = (globServer = serve({
|
|
4642
4654
|
fetch: app.fetch,
|
|
4643
4655
|
port: (ctx as any).handlerPort,
|
|
4644
|
-
});
|
|
4645
|
-
await
|
|
4656
|
+
}));
|
|
4657
|
+
await resetInngest();
|
|
4646
4658
|
|
|
4647
4659
|
const run = await counterWorkflow.createRunAsync();
|
|
4648
4660
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -4798,10 +4810,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4798
4810
|
await next();
|
|
4799
4811
|
});
|
|
4800
4812
|
|
|
4801
|
-
const srv = serve({
|
|
4813
|
+
const srv = (globServer = serve({
|
|
4802
4814
|
fetch: app.fetch,
|
|
4803
4815
|
port: (ctx as any).handlerPort,
|
|
4804
|
-
});
|
|
4816
|
+
}));
|
|
4817
|
+
await resetInngest();
|
|
4805
4818
|
|
|
4806
4819
|
const run = await counterWorkflow.createRunAsync();
|
|
4807
4820
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -4957,10 +4970,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4957
4970
|
await next();
|
|
4958
4971
|
});
|
|
4959
4972
|
|
|
4960
|
-
const srv = serve({
|
|
4973
|
+
const srv = (globServer = serve({
|
|
4961
4974
|
fetch: app.fetch,
|
|
4962
4975
|
port: (ctx as any).handlerPort,
|
|
4963
|
-
});
|
|
4976
|
+
}));
|
|
4977
|
+
await resetInngest();
|
|
4964
4978
|
|
|
4965
4979
|
const run = await counterWorkflow.createRunAsync();
|
|
4966
4980
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -5154,10 +5168,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5154
5168
|
await next();
|
|
5155
5169
|
});
|
|
5156
5170
|
|
|
5157
|
-
const srv = serve({
|
|
5171
|
+
const srv = (globServer = serve({
|
|
5158
5172
|
fetch: app.fetch,
|
|
5159
5173
|
port: (ctx as any).handlerPort,
|
|
5160
|
-
});
|
|
5174
|
+
}));
|
|
5175
|
+
await resetInngest();
|
|
5161
5176
|
|
|
5162
5177
|
const run = await counterWorkflow.createRunAsync();
|
|
5163
5178
|
const result = await run.start({ inputData: { startValue: 1 } });
|
|
@@ -5307,11 +5322,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5307
5322
|
|
|
5308
5323
|
const app = await createHonoServer(mastra);
|
|
5309
5324
|
|
|
5310
|
-
const srv = serve({
|
|
5325
|
+
const srv = (globServer = serve({
|
|
5311
5326
|
fetch: app.fetch,
|
|
5312
5327
|
port: (ctx as any).handlerPort,
|
|
5313
|
-
});
|
|
5314
|
-
await
|
|
5328
|
+
}));
|
|
5329
|
+
await resetInngest();
|
|
5315
5330
|
|
|
5316
5331
|
const run = await counterWorkflow.createRunAsync();
|
|
5317
5332
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -5458,10 +5473,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5458
5473
|
await next();
|
|
5459
5474
|
});
|
|
5460
5475
|
|
|
5461
|
-
const srv = serve({
|
|
5476
|
+
const srv = (globServer = serve({
|
|
5462
5477
|
fetch: app.fetch,
|
|
5463
5478
|
port: (ctx as any).handlerPort,
|
|
5464
|
-
});
|
|
5479
|
+
}));
|
|
5480
|
+
await resetInngest();
|
|
5465
5481
|
|
|
5466
5482
|
const run = await counterWorkflow.createRunAsync();
|
|
5467
5483
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -5639,11 +5655,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5639
5655
|
|
|
5640
5656
|
const app = await createHonoServer(mastra);
|
|
5641
5657
|
|
|
5642
|
-
const srv = serve({
|
|
5658
|
+
const srv = (globServer = serve({
|
|
5643
5659
|
fetch: app.fetch,
|
|
5644
5660
|
port: (ctx as any).handlerPort,
|
|
5645
|
-
});
|
|
5646
|
-
await
|
|
5661
|
+
}));
|
|
5662
|
+
await resetInngest();
|
|
5647
5663
|
|
|
5648
5664
|
const run = await counterWorkflow.createRunAsync();
|
|
5649
5665
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -5801,11 +5817,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5801
5817
|
|
|
5802
5818
|
const app = await createHonoServer(mastra);
|
|
5803
5819
|
|
|
5804
|
-
const srv = serve({
|
|
5820
|
+
const srv = (globServer = serve({
|
|
5805
5821
|
fetch: app.fetch,
|
|
5806
5822
|
port: (ctx as any).handlerPort,
|
|
5807
|
-
});
|
|
5808
|
-
await
|
|
5823
|
+
}));
|
|
5824
|
+
await resetInngest();
|
|
5809
5825
|
|
|
5810
5826
|
const run = await counterWorkflow.createRunAsync();
|
|
5811
5827
|
const result = await run.start({ inputData: { startValue: 0 } });
|
|
@@ -5876,11 +5892,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5876
5892
|
|
|
5877
5893
|
const app = await createHonoServer(mastra);
|
|
5878
5894
|
|
|
5879
|
-
const srv = serve({
|
|
5895
|
+
const srv = (globServer = serve({
|
|
5880
5896
|
fetch: app.fetch,
|
|
5881
5897
|
port: (ctx as any).handlerPort,
|
|
5882
|
-
});
|
|
5883
|
-
await
|
|
5898
|
+
}));
|
|
5899
|
+
await resetInngest();
|
|
5884
5900
|
|
|
5885
5901
|
// Access new instance properties directly - should work without warning
|
|
5886
5902
|
const run = await workflow.createRunAsync();
|
|
@@ -5939,10 +5955,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5939
5955
|
|
|
5940
5956
|
const app = await createHonoServer(mastra);
|
|
5941
5957
|
|
|
5942
|
-
const srv = serve({
|
|
5958
|
+
const srv = (globServer = serve({
|
|
5943
5959
|
fetch: app.fetch,
|
|
5944
5960
|
port: (ctx as any).handlerPort,
|
|
5945
|
-
});
|
|
5961
|
+
}));
|
|
5962
|
+
await resetInngest();
|
|
5946
5963
|
|
|
5947
5964
|
const run = await workflow.createRunAsync();
|
|
5948
5965
|
const result = await run.start({ runtimeContext });
|
|
@@ -5953,7 +5970,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
5953
5970
|
expect(result.steps.step1.output.injectedValue).toBe(testValue);
|
|
5954
5971
|
});
|
|
5955
5972
|
|
|
5956
|
-
it('should inject runtimeContext dependencies into steps during resume', async ctx => {
|
|
5973
|
+
it.skip('should inject runtimeContext dependencies into steps during resume', async ctx => {
|
|
5957
5974
|
const inngest = new Inngest({
|
|
5958
5975
|
id: 'mastra',
|
|
5959
5976
|
baseUrl: `http://localhost:${(ctx as any).inngestPort}`,
|
|
@@ -6064,10 +6081,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6064
6081
|
|
|
6065
6082
|
const app = await createHonoServer(mastra);
|
|
6066
6083
|
|
|
6067
|
-
const srv = serve({
|
|
6084
|
+
const srv = (globServer = serve({
|
|
6068
6085
|
fetch: app.fetch,
|
|
6069
6086
|
port: (ctx as any).handlerPort,
|
|
6070
|
-
});
|
|
6087
|
+
}));
|
|
6088
|
+
await resetInngest();
|
|
6071
6089
|
|
|
6072
6090
|
const run = await workflow.createRunAsync();
|
|
6073
6091
|
const result = await run.start({});
|
|
@@ -6133,10 +6151,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6133
6151
|
|
|
6134
6152
|
const app = await createHonoServer(mastra);
|
|
6135
6153
|
|
|
6136
|
-
const srv = serve({
|
|
6154
|
+
const srv = (globServer = serve({
|
|
6137
6155
|
fetch: app.fetch,
|
|
6138
6156
|
port: (ctx as any).handlerPort,
|
|
6139
|
-
});
|
|
6157
|
+
}));
|
|
6158
|
+
await resetInngest();
|
|
6140
6159
|
|
|
6141
6160
|
const runId = 'test-run-id';
|
|
6142
6161
|
let watchData: StreamEvent[] = [];
|
|
@@ -6144,7 +6163,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6144
6163
|
runId,
|
|
6145
6164
|
});
|
|
6146
6165
|
|
|
6147
|
-
await
|
|
6166
|
+
await resetInngest();
|
|
6148
6167
|
|
|
6149
6168
|
const { stream, getWorkflowState } = run.stream({ inputData: {} });
|
|
6150
6169
|
|
|
@@ -6157,7 +6176,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6157
6176
|
|
|
6158
6177
|
const executionResult = await getWorkflowState();
|
|
6159
6178
|
|
|
6160
|
-
await
|
|
6179
|
+
await resetInngest();
|
|
6161
6180
|
|
|
6162
6181
|
srv.close();
|
|
6163
6182
|
|
|
@@ -6304,10 +6323,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6304
6323
|
|
|
6305
6324
|
const app = await createHonoServer(mastra);
|
|
6306
6325
|
|
|
6307
|
-
const srv = serve({
|
|
6326
|
+
const srv = (globServer = serve({
|
|
6308
6327
|
fetch: app.fetch,
|
|
6309
6328
|
port: (ctx as any).handlerPort,
|
|
6310
|
-
});
|
|
6329
|
+
}));
|
|
6330
|
+
await resetInngest();
|
|
6311
6331
|
|
|
6312
6332
|
const runId = 'test-run-id';
|
|
6313
6333
|
let watchData: StreamEvent[] = [];
|
|
@@ -6315,7 +6335,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6315
6335
|
runId,
|
|
6316
6336
|
});
|
|
6317
6337
|
|
|
6318
|
-
await
|
|
6338
|
+
await resetInngest();
|
|
6319
6339
|
|
|
6320
6340
|
const { stream, getWorkflowState } = run.stream({ inputData: {} });
|
|
6321
6341
|
|
|
@@ -6328,11 +6348,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6328
6348
|
|
|
6329
6349
|
const executionResult = await getWorkflowState();
|
|
6330
6350
|
|
|
6331
|
-
await
|
|
6351
|
+
await resetInngest();
|
|
6332
6352
|
|
|
6333
6353
|
srv.close();
|
|
6334
6354
|
|
|
6335
|
-
expect(watchData.length).toBe(
|
|
6355
|
+
expect(watchData.length).toBe(11);
|
|
6336
6356
|
expect(watchData).toMatchObject([
|
|
6337
6357
|
{
|
|
6338
6358
|
payload: {
|
|
@@ -6343,6 +6363,9 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6343
6363
|
{
|
|
6344
6364
|
payload: {
|
|
6345
6365
|
id: 'step1',
|
|
6366
|
+
startedAt: expect.any(Number),
|
|
6367
|
+
status: 'running',
|
|
6368
|
+
payload: {},
|
|
6346
6369
|
},
|
|
6347
6370
|
type: 'step-start',
|
|
6348
6371
|
},
|
|
@@ -6352,6 +6375,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6352
6375
|
output: {
|
|
6353
6376
|
result: 'success1',
|
|
6354
6377
|
},
|
|
6378
|
+
endedAt: expect.any(Number),
|
|
6355
6379
|
status: 'success',
|
|
6356
6380
|
},
|
|
6357
6381
|
type: 'step-result',
|
|
@@ -6364,12 +6388,43 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6364
6388
|
type: 'step-finish',
|
|
6365
6389
|
},
|
|
6366
6390
|
{
|
|
6367
|
-
payload: {
|
|
6391
|
+
payload: {
|
|
6392
|
+
id: expect.any(String),
|
|
6393
|
+
startedAt: expect.any(Number),
|
|
6394
|
+
status: 'waiting',
|
|
6395
|
+
payload: {
|
|
6396
|
+
result: 'success1',
|
|
6397
|
+
},
|
|
6398
|
+
},
|
|
6368
6399
|
type: 'step-waiting',
|
|
6369
6400
|
},
|
|
6401
|
+
{
|
|
6402
|
+
payload: {
|
|
6403
|
+
id: expect.any(String),
|
|
6404
|
+
endedAt: expect.any(Number),
|
|
6405
|
+
startedAt: expect.any(Number),
|
|
6406
|
+
status: 'success',
|
|
6407
|
+
output: {
|
|
6408
|
+
result: 'success1',
|
|
6409
|
+
},
|
|
6410
|
+
},
|
|
6411
|
+
type: 'step-result',
|
|
6412
|
+
},
|
|
6413
|
+
{
|
|
6414
|
+
type: 'step-finish',
|
|
6415
|
+
payload: {
|
|
6416
|
+
id: expect.any(String),
|
|
6417
|
+
metadata: {},
|
|
6418
|
+
},
|
|
6419
|
+
},
|
|
6370
6420
|
{
|
|
6371
6421
|
payload: {
|
|
6372
6422
|
id: 'step2',
|
|
6423
|
+
payload: {
|
|
6424
|
+
result: 'success1',
|
|
6425
|
+
},
|
|
6426
|
+
startedAt: expect.any(Number),
|
|
6427
|
+
status: 'running',
|
|
6373
6428
|
},
|
|
6374
6429
|
type: 'step-start',
|
|
6375
6430
|
},
|
|
@@ -6379,6 +6434,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6379
6434
|
output: {
|
|
6380
6435
|
result: 'success2',
|
|
6381
6436
|
},
|
|
6437
|
+
endedAt: expect.any(Number),
|
|
6382
6438
|
status: 'success',
|
|
6383
6439
|
},
|
|
6384
6440
|
type: 'step-result',
|
|
@@ -6397,6 +6453,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6397
6453
|
type: 'finish',
|
|
6398
6454
|
},
|
|
6399
6455
|
]);
|
|
6456
|
+
|
|
6400
6457
|
// Verify execution completed successfully
|
|
6401
6458
|
expect(executionResult.steps.step1).toMatchObject({
|
|
6402
6459
|
status: 'success',
|
|
@@ -6469,10 +6526,11 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6469
6526
|
|
|
6470
6527
|
const app = await createHonoServer(mastra);
|
|
6471
6528
|
|
|
6472
|
-
const srv = serve({
|
|
6529
|
+
const srv = (globServer = serve({
|
|
6473
6530
|
fetch: app.fetch,
|
|
6474
6531
|
port: (ctx as any).handlerPort,
|
|
6475
|
-
});
|
|
6532
|
+
}));
|
|
6533
|
+
await resetInngest();
|
|
6476
6534
|
|
|
6477
6535
|
const runId = 'test-run-id';
|
|
6478
6536
|
let watchData: StreamEvent[] = [];
|
|
@@ -6480,7 +6538,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6480
6538
|
runId,
|
|
6481
6539
|
});
|
|
6482
6540
|
|
|
6483
|
-
await
|
|
6541
|
+
await resetInngest();
|
|
6484
6542
|
|
|
6485
6543
|
const { stream, getWorkflowState } = run.stream({ inputData: {} });
|
|
6486
6544
|
|
|
@@ -6500,7 +6558,7 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6500
6558
|
|
|
6501
6559
|
const executionResult = await getWorkflowState();
|
|
6502
6560
|
|
|
6503
|
-
await
|
|
6561
|
+
await resetInngest();
|
|
6504
6562
|
|
|
6505
6563
|
srv.close();
|
|
6506
6564
|
|
|
@@ -6694,12 +6752,12 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6694
6752
|
|
|
6695
6753
|
const app = await createHonoServer(mastra);
|
|
6696
6754
|
|
|
6697
|
-
const srv = serve({
|
|
6755
|
+
const srv = (globServer = serve({
|
|
6698
6756
|
fetch: app.fetch,
|
|
6699
6757
|
port: (ctx as any).handlerPort,
|
|
6700
|
-
});
|
|
6758
|
+
}));
|
|
6701
6759
|
|
|
6702
|
-
await
|
|
6760
|
+
await resetInngest();
|
|
6703
6761
|
|
|
6704
6762
|
const run = await promptEvalWorkflow.createRunAsync();
|
|
6705
6763
|
|
|
@@ -6883,12 +6941,12 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6883
6941
|
|
|
6884
6942
|
const app = await createHonoServer(mastra);
|
|
6885
6943
|
|
|
6886
|
-
const srv = serve({
|
|
6944
|
+
const srv = (globServer = serve({
|
|
6887
6945
|
fetch: app.fetch,
|
|
6888
6946
|
port: (ctx as any).handlerPort,
|
|
6889
|
-
});
|
|
6947
|
+
}));
|
|
6890
6948
|
|
|
6891
|
-
await
|
|
6949
|
+
await resetInngest();
|
|
6892
6950
|
|
|
6893
6951
|
const run = await workflow.createRunAsync({
|
|
6894
6952
|
runId: 'test-run-id',
|
package/src/index.ts
CHANGED
|
@@ -99,6 +99,7 @@ export class InngestRun<
|
|
|
99
99
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
100
100
|
runs = await this.getRuns(eventId);
|
|
101
101
|
if (runs?.[0]?.status === 'Failed') {
|
|
102
|
+
console.log('run', runs?.[0]);
|
|
102
103
|
throw new Error(`Function run ${runs?.[0]?.status}`);
|
|
103
104
|
} else if (runs?.[0]?.status === 'Cancelled') {
|
|
104
105
|
const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
|
|
@@ -1067,6 +1068,8 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1067
1068
|
payload: {
|
|
1068
1069
|
id: step.id,
|
|
1069
1070
|
status: 'running',
|
|
1071
|
+
payload: prevOutput,
|
|
1072
|
+
startedAt,
|
|
1070
1073
|
},
|
|
1071
1074
|
});
|
|
1072
1075
|
|