@mastra/inngest 0.11.3 → 0.11.4
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 +6 -6
- package/CHANGELOG.md +33 -0
- package/dist/_tsup-dts-rollup.d.cts +1 -0
- package/dist/_tsup-dts-rollup.d.ts +1 -0
- package/package.json +5 -5
- package/src/index.test.ts +170 -0
- package/src/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/inngest@0.11.
|
|
2
|
+
> @mastra/inngest@0.11.4-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 8888ms
|
|
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 6708ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mESM[39m [1mdist/index.js [22m[32m37.03 KB[39m
|
|
21
|
-
[32mESM[39m ⚡️ Build success in 287ms
|
|
22
20
|
[32mCJS[39m [1mdist/index.cjs [22m[32m37.25 KB[39m
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 364ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m37.03 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 364ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 0.11.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0b56518: Ensure removed runtimeContext values are not saved in snapshot
|
|
8
|
+
- Updated dependencies [0b56518]
|
|
9
|
+
- Updated dependencies [db5cc15]
|
|
10
|
+
- Updated dependencies [2ba5b76]
|
|
11
|
+
- Updated dependencies [5237998]
|
|
12
|
+
- Updated dependencies [c3a30de]
|
|
13
|
+
- Updated dependencies [37c1acd]
|
|
14
|
+
- Updated dependencies [1aa60b1]
|
|
15
|
+
- Updated dependencies [89ec9d4]
|
|
16
|
+
- Updated dependencies [cf3a184]
|
|
17
|
+
- Updated dependencies [d6bfd60]
|
|
18
|
+
- Updated dependencies [626b0f4]
|
|
19
|
+
- Updated dependencies [c22a91f]
|
|
20
|
+
- Updated dependencies [f7403ab]
|
|
21
|
+
- Updated dependencies [6c89d7f]
|
|
22
|
+
- @mastra/core@0.10.15
|
|
23
|
+
|
|
24
|
+
## 0.11.4-alpha.0
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 0b56518: Ensure removed runtimeContext values are not saved in snapshot
|
|
29
|
+
- Updated dependencies [0b56518]
|
|
30
|
+
- Updated dependencies [2ba5b76]
|
|
31
|
+
- Updated dependencies [c3a30de]
|
|
32
|
+
- Updated dependencies [cf3a184]
|
|
33
|
+
- Updated dependencies [d6bfd60]
|
|
34
|
+
- @mastra/core@0.10.15-alpha.1
|
|
35
|
+
|
|
3
36
|
## 0.11.3
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -184,6 +184,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
184
184
|
workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
|
|
185
185
|
result?: Record<string, any>;
|
|
186
186
|
error?: string | Error;
|
|
187
|
+
runtimeContext: RuntimeContext;
|
|
187
188
|
}): Promise<void>;
|
|
188
189
|
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
|
|
189
190
|
workflowId: string;
|
|
@@ -184,6 +184,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
184
184
|
workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
|
|
185
185
|
result?: Record<string, any>;
|
|
186
186
|
error?: string | Error;
|
|
187
|
+
runtimeContext: RuntimeContext;
|
|
187
188
|
}): Promise<void>;
|
|
188
189
|
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
|
|
189
190
|
workflowId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/inngest",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "Mastra Inngest integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"@microsoft/api-extractor": "^7.52.8",
|
|
32
32
|
"@types/node": "^20.19.0",
|
|
33
33
|
"ai": "^4.3.16",
|
|
34
|
-
"eslint": "^9.
|
|
34
|
+
"eslint": "^9.30.1",
|
|
35
35
|
"execa": "^9.6.0",
|
|
36
36
|
"get-port": "7.1.0",
|
|
37
37
|
"hono": "^4.8.4",
|
|
38
38
|
"tsup": "^8.5.0",
|
|
39
39
|
"typescript": "^5.8.3",
|
|
40
40
|
"vitest": "^3.2.4",
|
|
41
|
-
"@internal/lint": "0.0.
|
|
41
|
+
"@internal/lint": "0.0.20",
|
|
42
42
|
"@mastra/libsql": "0.11.0",
|
|
43
|
-
"@mastra/
|
|
44
|
-
"@mastra/
|
|
43
|
+
"@mastra/deployer": "0.10.15",
|
|
44
|
+
"@mastra/core": "0.10.15"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@mastra/core": ">=0.10.11-0 <0.11.0-0"
|
package/src/index.test.ts
CHANGED
|
@@ -6219,6 +6219,176 @@ describe('MastraInngestWorkflow', () => {
|
|
|
6219
6219
|
// @ts-ignore
|
|
6220
6220
|
expect(result?.steps.step1.output.injectedValue).toBe(testValue + '2');
|
|
6221
6221
|
});
|
|
6222
|
+
|
|
6223
|
+
it('should have access to runtimeContext from before suspension during workflow resume', async ctx => {
|
|
6224
|
+
const inngest = new Inngest({
|
|
6225
|
+
id: 'mastra',
|
|
6226
|
+
baseUrl: `http://localhost:${(ctx as any).inngestPort}`,
|
|
6227
|
+
});
|
|
6228
|
+
|
|
6229
|
+
const { createWorkflow, createStep } = init(inngest);
|
|
6230
|
+
|
|
6231
|
+
const testValue = 'test-dependency';
|
|
6232
|
+
const resumeStep = createStep({
|
|
6233
|
+
id: 'resume',
|
|
6234
|
+
inputSchema: z.object({ value: z.number() }),
|
|
6235
|
+
outputSchema: z.object({ value: z.number() }),
|
|
6236
|
+
resumeSchema: z.object({ value: z.number() }),
|
|
6237
|
+
suspendSchema: z.object({ message: z.string() }),
|
|
6238
|
+
execute: async ({ inputData, resumeData, suspend }) => {
|
|
6239
|
+
const finalValue = (resumeData?.value ?? 0) + inputData.value;
|
|
6240
|
+
|
|
6241
|
+
if (!resumeData?.value || finalValue < 10) {
|
|
6242
|
+
return await suspend({
|
|
6243
|
+
message: `Please provide additional information. now value is ${inputData.value}`,
|
|
6244
|
+
});
|
|
6245
|
+
}
|
|
6246
|
+
|
|
6247
|
+
return { value: finalValue };
|
|
6248
|
+
},
|
|
6249
|
+
});
|
|
6250
|
+
|
|
6251
|
+
const incrementStep = createStep({
|
|
6252
|
+
id: 'increment',
|
|
6253
|
+
inputSchema: z.object({
|
|
6254
|
+
value: z.number(),
|
|
6255
|
+
}),
|
|
6256
|
+
outputSchema: z.object({
|
|
6257
|
+
value: z.number(),
|
|
6258
|
+
}),
|
|
6259
|
+
execute: async ({ inputData, runtimeContext }) => {
|
|
6260
|
+
runtimeContext.set('testKey', testValue);
|
|
6261
|
+
return {
|
|
6262
|
+
value: inputData.value + 1,
|
|
6263
|
+
};
|
|
6264
|
+
},
|
|
6265
|
+
});
|
|
6266
|
+
|
|
6267
|
+
const incrementWorkflow = createWorkflow({
|
|
6268
|
+
id: 'increment-workflow',
|
|
6269
|
+
inputSchema: z.object({ value: z.number() }),
|
|
6270
|
+
outputSchema: z.object({ value: z.number() }),
|
|
6271
|
+
})
|
|
6272
|
+
.then(incrementStep)
|
|
6273
|
+
.then(resumeStep)
|
|
6274
|
+
.then(
|
|
6275
|
+
createStep({
|
|
6276
|
+
id: 'final',
|
|
6277
|
+
inputSchema: z.object({ value: z.number() }),
|
|
6278
|
+
outputSchema: z.object({ value: z.number() }),
|
|
6279
|
+
execute: async ({ inputData, runtimeContext }) => {
|
|
6280
|
+
const testKey = runtimeContext.get('testKey');
|
|
6281
|
+
expect(testKey).toBe(testValue);
|
|
6282
|
+
return { value: inputData.value };
|
|
6283
|
+
},
|
|
6284
|
+
}),
|
|
6285
|
+
)
|
|
6286
|
+
.commit();
|
|
6287
|
+
|
|
6288
|
+
new Mastra({
|
|
6289
|
+
logger: false,
|
|
6290
|
+
storage: testStorage,
|
|
6291
|
+
workflows: { incrementWorkflow },
|
|
6292
|
+
});
|
|
6293
|
+
|
|
6294
|
+
const run = await incrementWorkflow.createRunAsync();
|
|
6295
|
+
const result = await run.start({ inputData: { value: 0 } });
|
|
6296
|
+
expect(result.status).toBe('suspended');
|
|
6297
|
+
|
|
6298
|
+
const resumeResult = await run.resume({
|
|
6299
|
+
resumeData: { value: 21 },
|
|
6300
|
+
step: ['resume'],
|
|
6301
|
+
});
|
|
6302
|
+
|
|
6303
|
+
expect(resumeResult.status).toBe('success');
|
|
6304
|
+
});
|
|
6305
|
+
|
|
6306
|
+
it('should not show removed runtimeContext values in subsequent steps', async ctx => {
|
|
6307
|
+
const inngest = new Inngest({
|
|
6308
|
+
id: 'mastra',
|
|
6309
|
+
baseUrl: `http://localhost:${(ctx as any).inngestPort}`,
|
|
6310
|
+
});
|
|
6311
|
+
|
|
6312
|
+
const { createWorkflow, createStep } = init(inngest);
|
|
6313
|
+
const testValue = 'test-dependency';
|
|
6314
|
+
const resumeStep = createStep({
|
|
6315
|
+
id: 'resume',
|
|
6316
|
+
inputSchema: z.object({ value: z.number() }),
|
|
6317
|
+
outputSchema: z.object({ value: z.number() }),
|
|
6318
|
+
resumeSchema: z.object({ value: z.number() }),
|
|
6319
|
+
suspendSchema: z.object({ message: z.string() }),
|
|
6320
|
+
execute: async ({ inputData, resumeData, suspend, runtimeContext }) => {
|
|
6321
|
+
const finalValue = (resumeData?.value ?? 0) + inputData.value;
|
|
6322
|
+
|
|
6323
|
+
if (!resumeData?.value || finalValue < 10) {
|
|
6324
|
+
return await suspend({
|
|
6325
|
+
message: `Please provide additional information. now value is ${inputData.value}`,
|
|
6326
|
+
});
|
|
6327
|
+
}
|
|
6328
|
+
|
|
6329
|
+
const testKey = runtimeContext.get('testKey');
|
|
6330
|
+
expect(testKey).toBe(testValue);
|
|
6331
|
+
|
|
6332
|
+
runtimeContext.delete('testKey');
|
|
6333
|
+
|
|
6334
|
+
return { value: finalValue };
|
|
6335
|
+
},
|
|
6336
|
+
});
|
|
6337
|
+
|
|
6338
|
+
const incrementStep = createStep({
|
|
6339
|
+
id: 'increment',
|
|
6340
|
+
inputSchema: z.object({
|
|
6341
|
+
value: z.number(),
|
|
6342
|
+
}),
|
|
6343
|
+
outputSchema: z.object({
|
|
6344
|
+
value: z.number(),
|
|
6345
|
+
}),
|
|
6346
|
+
execute: async ({ inputData, runtimeContext }) => {
|
|
6347
|
+
runtimeContext.set('testKey', testValue);
|
|
6348
|
+
return {
|
|
6349
|
+
value: inputData.value + 1,
|
|
6350
|
+
};
|
|
6351
|
+
},
|
|
6352
|
+
});
|
|
6353
|
+
|
|
6354
|
+
const incrementWorkflow = createWorkflow({
|
|
6355
|
+
id: 'increment-workflow',
|
|
6356
|
+
inputSchema: z.object({ value: z.number() }),
|
|
6357
|
+
outputSchema: z.object({ value: z.number() }),
|
|
6358
|
+
})
|
|
6359
|
+
.then(incrementStep)
|
|
6360
|
+
.then(resumeStep)
|
|
6361
|
+
.then(
|
|
6362
|
+
createStep({
|
|
6363
|
+
id: 'final',
|
|
6364
|
+
inputSchema: z.object({ value: z.number() }),
|
|
6365
|
+
outputSchema: z.object({ value: z.number() }),
|
|
6366
|
+
execute: async ({ inputData, runtimeContext }) => {
|
|
6367
|
+
const testKey = runtimeContext.get('testKey');
|
|
6368
|
+
expect(testKey).toBeUndefined();
|
|
6369
|
+
return { value: inputData.value };
|
|
6370
|
+
},
|
|
6371
|
+
}),
|
|
6372
|
+
)
|
|
6373
|
+
.commit();
|
|
6374
|
+
|
|
6375
|
+
new Mastra({
|
|
6376
|
+
logger: false,
|
|
6377
|
+
storage: testStorage,
|
|
6378
|
+
workflows: { incrementWorkflow },
|
|
6379
|
+
});
|
|
6380
|
+
|
|
6381
|
+
const run = await incrementWorkflow.createRunAsync();
|
|
6382
|
+
const result = await run.start({ inputData: { value: 0 } });
|
|
6383
|
+
expect(result.status).toBe('suspended');
|
|
6384
|
+
|
|
6385
|
+
const resumeResult = await run.resume({
|
|
6386
|
+
resumeData: { value: 21 },
|
|
6387
|
+
step: ['resume'],
|
|
6388
|
+
});
|
|
6389
|
+
|
|
6390
|
+
expect(resumeResult.status).toBe('success');
|
|
6391
|
+
});
|
|
6222
6392
|
});
|
|
6223
6393
|
|
|
6224
6394
|
describe('Access to inngest step primitives', () => {
|
package/src/index.ts
CHANGED
|
@@ -1575,6 +1575,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1575
1575
|
workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
|
|
1576
1576
|
result?: Record<string, any>;
|
|
1577
1577
|
error?: string | Error;
|
|
1578
|
+
runtimeContext: RuntimeContext;
|
|
1578
1579
|
}) {
|
|
1579
1580
|
await this.inngestStep.run(
|
|
1580
1581
|
`workflow.${workflowId}.run.${runId}.path.${JSON.stringify(executionContext.executionPath)}.stepUpdate`,
|