@mastra/inngest 0.0.0-ai-v5-20250710191716 → 0.0.0-ai-v5-20250718021026
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 +38 -3
- package/dist/_tsup-dts-rollup.d.cts +1 -0
- package/dist/_tsup-dts-rollup.d.ts +1 -0
- package/package.json +7 -7
- package/src/index.test.ts +170 -0
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
-
## 0.0.0-ai-v5-
|
|
3
|
+
## 0.0.0-ai-v5-20250718021026
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -8,9 +8,44 @@
|
|
|
8
8
|
|
|
9
9
|
### Patch Changes
|
|
10
10
|
|
|
11
|
-
- Updated dependencies [5237998]
|
|
12
11
|
- Updated dependencies [66858d4]
|
|
13
|
-
|
|
12
|
+
- Updated dependencies [7827943]
|
|
13
|
+
- Updated dependencies [bf1e7e7]
|
|
14
|
+
- Updated dependencies [cbddd18]
|
|
15
|
+
- @mastra/core@0.0.0-ai-v5-20250718021026
|
|
16
|
+
|
|
17
|
+
## 0.11.4
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 0b56518: Ensure removed runtimeContext values are not saved in snapshot
|
|
22
|
+
- Updated dependencies [0b56518]
|
|
23
|
+
- Updated dependencies [db5cc15]
|
|
24
|
+
- Updated dependencies [2ba5b76]
|
|
25
|
+
- Updated dependencies [5237998]
|
|
26
|
+
- Updated dependencies [c3a30de]
|
|
27
|
+
- Updated dependencies [37c1acd]
|
|
28
|
+
- Updated dependencies [1aa60b1]
|
|
29
|
+
- Updated dependencies [89ec9d4]
|
|
30
|
+
- Updated dependencies [cf3a184]
|
|
31
|
+
- Updated dependencies [d6bfd60]
|
|
32
|
+
- Updated dependencies [626b0f4]
|
|
33
|
+
- Updated dependencies [c22a91f]
|
|
34
|
+
- Updated dependencies [f7403ab]
|
|
35
|
+
- Updated dependencies [6c89d7f]
|
|
36
|
+
- @mastra/core@0.10.15
|
|
37
|
+
|
|
38
|
+
## 0.11.4-alpha.0
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 0b56518: Ensure removed runtimeContext values are not saved in snapshot
|
|
43
|
+
- Updated dependencies [0b56518]
|
|
44
|
+
- Updated dependencies [2ba5b76]
|
|
45
|
+
- Updated dependencies [c3a30de]
|
|
46
|
+
- Updated dependencies [cf3a184]
|
|
47
|
+
- Updated dependencies [d6bfd60]
|
|
48
|
+
- @mastra/core@0.10.15-alpha.1
|
|
14
49
|
|
|
15
50
|
## 0.11.3
|
|
16
51
|
|
|
@@ -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.0.0-ai-v5-
|
|
3
|
+
"version": "0.0.0-ai-v5-20250718021026",
|
|
4
4
|
"description": "Mastra Inngest integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"@microsoft/api-extractor": "^7.52.8",
|
|
32
32
|
"@types/node": "^20.19.0",
|
|
33
33
|
"ai": "5.0.0-beta.14",
|
|
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.0-ai-v5-
|
|
42
|
-
"@mastra/
|
|
43
|
-
"@mastra/
|
|
44
|
-
"@mastra/deployer": "0.0.0-ai-v5-
|
|
41
|
+
"@internal/lint": "0.0.0-ai-v5-20250718021026",
|
|
42
|
+
"@mastra/core": "0.0.0-ai-v5-20250718021026",
|
|
43
|
+
"@mastra/libsql": "0.0.0-ai-v5-20250718021026",
|
|
44
|
+
"@mastra/deployer": "0.0.0-ai-v5-20250718021026"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@mastra/core": "0.0.0-ai-v5-
|
|
47
|
+
"@mastra/core": "0.0.0-ai-v5-20250718021026"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
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`,
|