@mastra/inngest 0.0.4-alpha.0 → 0.10.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 +50 -0
- package/dist/_tsup-dts-rollup.d.cts +26 -26
- package/dist/_tsup-dts-rollup.d.ts +26 -26
- package/dist/index.cjs +7 -7
- package/dist/index.js +3 -3
- package/package.json +8 -5
- package/src/index.ts +15 -18
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/inngest@0.0
|
|
2
|
+
> @mastra/inngest@0.10.0-alpha.1 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.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 6794ms
|
|
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 6615ms
|
|
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[32m22.
|
|
21
|
-
[32mESM[39m ⚡️ Build success in
|
|
22
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m22.
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m22.01 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 500ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m22.15 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 497ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 83da932: Move @mastra/core to peerdeps
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
|
|
12
|
+
- e4172d9: Update getWorkflowRuns type for inngest workflow
|
|
13
|
+
- Updated dependencies [b3a3d63]
|
|
14
|
+
- Updated dependencies [344f453]
|
|
15
|
+
- Updated dependencies [0a3ae6d]
|
|
16
|
+
- Updated dependencies [95911be]
|
|
17
|
+
- Updated dependencies [f53a6ac]
|
|
18
|
+
- Updated dependencies [5eb5a99]
|
|
19
|
+
- Updated dependencies [7e632c5]
|
|
20
|
+
- Updated dependencies [1e9fbfa]
|
|
21
|
+
- Updated dependencies [eabdcd9]
|
|
22
|
+
- Updated dependencies [90be034]
|
|
23
|
+
- Updated dependencies [99f050a]
|
|
24
|
+
- Updated dependencies [d0ee3c6]
|
|
25
|
+
- Updated dependencies [b2ae5aa]
|
|
26
|
+
- Updated dependencies [23f258c]
|
|
27
|
+
- Updated dependencies [a7292b0]
|
|
28
|
+
- Updated dependencies [0dcb9f0]
|
|
29
|
+
- Updated dependencies [2672a05]
|
|
30
|
+
- @mastra/core@0.10.0
|
|
31
|
+
|
|
32
|
+
## 0.1.0-alpha.1
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- 83da932: Move @mastra/core to peerdeps
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
|
|
41
|
+
- Updated dependencies [b3a3d63]
|
|
42
|
+
- Updated dependencies [344f453]
|
|
43
|
+
- Updated dependencies [0a3ae6d]
|
|
44
|
+
- Updated dependencies [95911be]
|
|
45
|
+
- Updated dependencies [5eb5a99]
|
|
46
|
+
- Updated dependencies [7e632c5]
|
|
47
|
+
- Updated dependencies [1e9fbfa]
|
|
48
|
+
- Updated dependencies [b2ae5aa]
|
|
49
|
+
- Updated dependencies [a7292b0]
|
|
50
|
+
- Updated dependencies [0dcb9f0]
|
|
51
|
+
- @mastra/core@0.10.0-alpha.1
|
|
52
|
+
|
|
3
53
|
## 0.0.4-alpha.0
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import type { BaseContext } from 'inngest';
|
|
2
2
|
import { ClientOptions } from 'inngest';
|
|
3
|
-
import { cloneStep } from '@mastra/core/workflows
|
|
4
|
-
import { createStep } from '@mastra/core/workflows
|
|
5
|
-
import { DefaultExecutionEngine } from '@mastra/core/workflows
|
|
6
|
-
import type { ExecuteFunction } from '@mastra/core/workflows
|
|
7
|
-
import type { ExecutionContext } from '@mastra/core/workflows
|
|
8
|
-
import type { ExecutionEngine } from '@mastra/core/workflows
|
|
9
|
-
import type { ExecutionGraph } from '@mastra/core/workflows
|
|
3
|
+
import { cloneStep } from '@mastra/core/workflows';
|
|
4
|
+
import { createStep } from '@mastra/core/workflows';
|
|
5
|
+
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
6
|
+
import type { ExecuteFunction } from '@mastra/core/workflows';
|
|
7
|
+
import type { ExecutionContext } from '@mastra/core/workflows';
|
|
8
|
+
import type { ExecutionEngine } from '@mastra/core/workflows';
|
|
9
|
+
import type { ExecutionGraph } from '@mastra/core/workflows';
|
|
10
10
|
import { Handler } from 'inngest';
|
|
11
11
|
import type { Inngest } from 'inngest';
|
|
12
12
|
import { InngestFunction } from 'inngest';
|
|
13
13
|
import { InngestMiddleware } from 'inngest';
|
|
14
14
|
import type { Mastra } from '@mastra/core';
|
|
15
|
-
import
|
|
16
|
-
import { NewWorkflow } from '@mastra/core/workflows/vNext';
|
|
17
|
-
import type { NewWorkflowConfig } from '@mastra/core/workflows/vNext';
|
|
18
|
-
import { Run } from '@mastra/core/workflows/vNext';
|
|
15
|
+
import { Run } from '@mastra/core/workflows';
|
|
19
16
|
import { RuntimeContext } from '@mastra/core/di';
|
|
20
17
|
import { serve as serve_2 } from 'inngest/hono';
|
|
21
18
|
import type { Span } from '@opentelemetry/api';
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import
|
|
26
|
-
import type {
|
|
19
|
+
import type { Step } from '@mastra/core/workflows';
|
|
20
|
+
import type { StepFlowEntry } from '@mastra/core/workflows';
|
|
21
|
+
import type { StepResult } from '@mastra/core/workflows';
|
|
22
|
+
import { Workflow } from '@mastra/core/workflows';
|
|
23
|
+
import type { WorkflowConfig } from '@mastra/core/workflows';
|
|
24
|
+
import type { WorkflowResult } from '@mastra/core/workflows';
|
|
25
|
+
import type { WorkflowRun } from '@mastra/core';
|
|
26
|
+
import type { WorkflowRuns } from '@mastra/core';
|
|
27
27
|
import type { z } from 'zod';
|
|
28
28
|
|
|
29
|
-
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends
|
|
29
|
+
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
|
|
30
30
|
id: TWorkflowId;
|
|
31
31
|
}): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
|
|
32
32
|
|
|
33
33
|
export declare function init(inngest: Inngest): {
|
|
34
|
-
createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends
|
|
34
|
+
createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any>[] = Step<string, any, any, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
35
35
|
createStep: typeof createStep;
|
|
36
36
|
cloneStep: typeof cloneStep;
|
|
37
37
|
cloneWorkflow: typeof cloneWorkflow;
|
|
@@ -47,7 +47,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
47
47
|
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
48
48
|
workflowId: string;
|
|
49
49
|
runId: string;
|
|
50
|
-
step:
|
|
50
|
+
step: Step<string, any, any>;
|
|
51
51
|
stepResults: Record<string, StepResult<any>>;
|
|
52
52
|
executionContext: ExecutionContext;
|
|
53
53
|
resume?: {
|
|
@@ -61,7 +61,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
61
61
|
runtimeContext: RuntimeContext;
|
|
62
62
|
}): Promise<StepResult<any>>;
|
|
63
63
|
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
64
|
-
step:
|
|
64
|
+
step: Step<string, any, any>;
|
|
65
65
|
stepResults: Record<string, StepResult<any>>;
|
|
66
66
|
executionContext: {
|
|
67
67
|
workflowId: string;
|
|
@@ -115,7 +115,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
115
115
|
}): Promise<StepResult<any>>;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
export declare class InngestRun<TSteps extends
|
|
118
|
+
export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
|
|
119
119
|
#private;
|
|
120
120
|
private inngest;
|
|
121
121
|
constructor(params: {
|
|
@@ -138,25 +138,25 @@ export declare class InngestRun<TSteps extends NewStep<string, any, any>[] = New
|
|
|
138
138
|
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
139
139
|
resume<TResumeSchema extends z.ZodType<any>>(params: {
|
|
140
140
|
resumeData?: z.infer<TResumeSchema>;
|
|
141
|
-
step:
|
|
141
|
+
step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
|
|
142
142
|
runtimeContext?: RuntimeContext;
|
|
143
143
|
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
144
144
|
watch(cb: (event: any) => void): () => void;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export declare class InngestWorkflow<TSteps extends
|
|
147
|
+
export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends Workflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
|
|
148
148
|
#private;
|
|
149
149
|
inngest: Inngest;
|
|
150
150
|
private function;
|
|
151
|
-
constructor(params:
|
|
151
|
+
constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
|
|
152
152
|
getWorkflowRuns(args?: {
|
|
153
153
|
fromDate?: Date;
|
|
154
154
|
toDate?: Date;
|
|
155
155
|
limit?: number;
|
|
156
156
|
offset?: number;
|
|
157
157
|
resourceId?: string;
|
|
158
|
-
}): Promise<
|
|
159
|
-
getWorkflowRunById(runId: string): Promise<
|
|
158
|
+
}): Promise<WorkflowRuns>;
|
|
159
|
+
getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
|
|
160
160
|
__registerMastra(mastra: Mastra): void;
|
|
161
161
|
createRun(options?: {
|
|
162
162
|
runId?: string;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import type { BaseContext } from 'inngest';
|
|
2
2
|
import { ClientOptions } from 'inngest';
|
|
3
|
-
import { cloneStep } from '@mastra/core/workflows
|
|
4
|
-
import { createStep } from '@mastra/core/workflows
|
|
5
|
-
import { DefaultExecutionEngine } from '@mastra/core/workflows
|
|
6
|
-
import type { ExecuteFunction } from '@mastra/core/workflows
|
|
7
|
-
import type { ExecutionContext } from '@mastra/core/workflows
|
|
8
|
-
import type { ExecutionEngine } from '@mastra/core/workflows
|
|
9
|
-
import type { ExecutionGraph } from '@mastra/core/workflows
|
|
3
|
+
import { cloneStep } from '@mastra/core/workflows';
|
|
4
|
+
import { createStep } from '@mastra/core/workflows';
|
|
5
|
+
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
6
|
+
import type { ExecuteFunction } from '@mastra/core/workflows';
|
|
7
|
+
import type { ExecutionContext } from '@mastra/core/workflows';
|
|
8
|
+
import type { ExecutionEngine } from '@mastra/core/workflows';
|
|
9
|
+
import type { ExecutionGraph } from '@mastra/core/workflows';
|
|
10
10
|
import { Handler } from 'inngest';
|
|
11
11
|
import type { Inngest } from 'inngest';
|
|
12
12
|
import { InngestFunction } from 'inngest';
|
|
13
13
|
import { InngestMiddleware } from 'inngest';
|
|
14
14
|
import type { Mastra } from '@mastra/core';
|
|
15
|
-
import
|
|
16
|
-
import { NewWorkflow } from '@mastra/core/workflows/vNext';
|
|
17
|
-
import type { NewWorkflowConfig } from '@mastra/core/workflows/vNext';
|
|
18
|
-
import { Run } from '@mastra/core/workflows/vNext';
|
|
15
|
+
import { Run } from '@mastra/core/workflows';
|
|
19
16
|
import { RuntimeContext } from '@mastra/core/di';
|
|
20
17
|
import { serve as serve_2 } from 'inngest/hono';
|
|
21
18
|
import type { Span } from '@opentelemetry/api';
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
25
|
-
import
|
|
26
|
-
import type {
|
|
19
|
+
import type { Step } from '@mastra/core/workflows';
|
|
20
|
+
import type { StepFlowEntry } from '@mastra/core/workflows';
|
|
21
|
+
import type { StepResult } from '@mastra/core/workflows';
|
|
22
|
+
import { Workflow } from '@mastra/core/workflows';
|
|
23
|
+
import type { WorkflowConfig } from '@mastra/core/workflows';
|
|
24
|
+
import type { WorkflowResult } from '@mastra/core/workflows';
|
|
25
|
+
import type { WorkflowRun } from '@mastra/core';
|
|
26
|
+
import type { WorkflowRuns } from '@mastra/core';
|
|
27
27
|
import type { z } from 'zod';
|
|
28
28
|
|
|
29
|
-
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends
|
|
29
|
+
declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
|
|
30
30
|
id: TWorkflowId;
|
|
31
31
|
}): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
|
|
32
32
|
|
|
33
33
|
export declare function init(inngest: Inngest): {
|
|
34
|
-
createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends
|
|
34
|
+
createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any>[] = Step<string, any, any, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
35
35
|
createStep: typeof createStep;
|
|
36
36
|
cloneStep: typeof cloneStep;
|
|
37
37
|
cloneWorkflow: typeof cloneWorkflow;
|
|
@@ -47,7 +47,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
47
47
|
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
48
48
|
workflowId: string;
|
|
49
49
|
runId: string;
|
|
50
|
-
step:
|
|
50
|
+
step: Step<string, any, any>;
|
|
51
51
|
stepResults: Record<string, StepResult<any>>;
|
|
52
52
|
executionContext: ExecutionContext;
|
|
53
53
|
resume?: {
|
|
@@ -61,7 +61,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
61
61
|
runtimeContext: RuntimeContext;
|
|
62
62
|
}): Promise<StepResult<any>>;
|
|
63
63
|
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
64
|
-
step:
|
|
64
|
+
step: Step<string, any, any>;
|
|
65
65
|
stepResults: Record<string, StepResult<any>>;
|
|
66
66
|
executionContext: {
|
|
67
67
|
workflowId: string;
|
|
@@ -115,7 +115,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
115
115
|
}): Promise<StepResult<any>>;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
export declare class InngestRun<TSteps extends
|
|
118
|
+
export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
|
|
119
119
|
#private;
|
|
120
120
|
private inngest;
|
|
121
121
|
constructor(params: {
|
|
@@ -138,25 +138,25 @@ export declare class InngestRun<TSteps extends NewStep<string, any, any>[] = New
|
|
|
138
138
|
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
139
139
|
resume<TResumeSchema extends z.ZodType<any>>(params: {
|
|
140
140
|
resumeData?: z.infer<TResumeSchema>;
|
|
141
|
-
step:
|
|
141
|
+
step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
|
|
142
142
|
runtimeContext?: RuntimeContext;
|
|
143
143
|
}): Promise<WorkflowResult<TOutput, TSteps>>;
|
|
144
144
|
watch(cb: (event: any) => void): () => void;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export declare class InngestWorkflow<TSteps extends
|
|
147
|
+
export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends Workflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
|
|
148
148
|
#private;
|
|
149
149
|
inngest: Inngest;
|
|
150
150
|
private function;
|
|
151
|
-
constructor(params:
|
|
151
|
+
constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
|
|
152
152
|
getWorkflowRuns(args?: {
|
|
153
153
|
fromDate?: Date;
|
|
154
154
|
toDate?: Date;
|
|
155
155
|
limit?: number;
|
|
156
156
|
offset?: number;
|
|
157
157
|
resourceId?: string;
|
|
158
|
-
}): Promise<
|
|
159
|
-
getWorkflowRunById(runId: string): Promise<
|
|
158
|
+
}): Promise<WorkflowRuns>;
|
|
159
|
+
getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
|
|
160
160
|
__registerMastra(mastra: Mastra): void;
|
|
161
161
|
createRun(options?: {
|
|
162
162
|
runId?: string;
|
package/dist/index.cjs
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
var crypto = require('crypto');
|
|
4
4
|
var realtime = require('@inngest/realtime');
|
|
5
5
|
var di = require('@mastra/core/di');
|
|
6
|
-
var
|
|
6
|
+
var workflows = require('@mastra/core/workflows');
|
|
7
7
|
var hono = require('inngest/hono');
|
|
8
8
|
|
|
9
9
|
// src/index.ts
|
|
10
10
|
function serve({ mastra, inngest }) {
|
|
11
|
-
const wfs = mastra.
|
|
11
|
+
const wfs = mastra.getWorkflows();
|
|
12
12
|
const functions = Object.values(wfs).flatMap((wf) => {
|
|
13
13
|
if (wf instanceof InngestWorkflow) {
|
|
14
14
|
wf.__registerMastra(mastra);
|
|
@@ -21,7 +21,7 @@ function serve({ mastra, inngest }) {
|
|
|
21
21
|
functions
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
var InngestRun = class extends
|
|
24
|
+
var InngestRun = class extends workflows.Run {
|
|
25
25
|
inngest;
|
|
26
26
|
#mastra;
|
|
27
27
|
constructor(params, inngest) {
|
|
@@ -137,7 +137,7 @@ var InngestRun = class extends vNext.Run {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
-
var InngestWorkflow = class _InngestWorkflow extends
|
|
140
|
+
var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
141
141
|
#mastra;
|
|
142
142
|
inngest;
|
|
143
143
|
function;
|
|
@@ -283,12 +283,12 @@ function init(inngest) {
|
|
|
283
283
|
createWorkflow(params) {
|
|
284
284
|
return new InngestWorkflow(params, inngest);
|
|
285
285
|
},
|
|
286
|
-
createStep:
|
|
287
|
-
cloneStep:
|
|
286
|
+
createStep: workflows.createStep,
|
|
287
|
+
cloneStep: workflows.cloneStep,
|
|
288
288
|
cloneWorkflow
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
var InngestExecutionEngine = class extends
|
|
291
|
+
var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
292
292
|
inngestStep;
|
|
293
293
|
inngestAttempts;
|
|
294
294
|
constructor(mastra, inngestStep, inngestAttempts = 0) {
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto';
|
|
2
2
|
import { subscribe } from '@inngest/realtime';
|
|
3
3
|
import { RuntimeContext } from '@mastra/core/di';
|
|
4
|
-
import { Run,
|
|
4
|
+
import { Run, Workflow, cloneStep, createStep, DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
5
5
|
import { serve as serve$1 } from 'inngest/hono';
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
function serve({ mastra, inngest }) {
|
|
9
|
-
const wfs = mastra.
|
|
9
|
+
const wfs = mastra.getWorkflows();
|
|
10
10
|
const functions = Object.values(wfs).flatMap((wf) => {
|
|
11
11
|
if (wf instanceof InngestWorkflow) {
|
|
12
12
|
wf.__registerMastra(mastra);
|
|
@@ -135,7 +135,7 @@ var InngestRun = class extends Run {
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
|
-
var InngestWorkflow = class _InngestWorkflow extends
|
|
138
|
+
var InngestWorkflow = class _InngestWorkflow extends Workflow {
|
|
139
139
|
#mastra;
|
|
140
140
|
inngest;
|
|
141
141
|
function;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/inngest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Mastra Inngest integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"@inngest/realtime": "^0.3.1",
|
|
23
23
|
"inngest": "^3.35.1",
|
|
24
24
|
"zod": "^3.24.2",
|
|
25
|
-
"@opentelemetry/api": "^1.9.0"
|
|
26
|
-
"@mastra/core": "^0.9.5-alpha.0"
|
|
25
|
+
"@opentelemetry/api": "^1.9.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@ai-sdk/openai": "^1.3.22",
|
|
@@ -38,8 +37,12 @@
|
|
|
38
37
|
"tsup": "^8.4.0",
|
|
39
38
|
"typescript": "^5.8.2",
|
|
40
39
|
"vitest": "^2.1.9",
|
|
41
|
-
"@internal/lint": "0.0.
|
|
42
|
-
"@mastra/deployer": "0.
|
|
40
|
+
"@internal/lint": "0.0.6",
|
|
41
|
+
"@mastra/deployer": "0.10.0",
|
|
42
|
+
"@mastra/core": "0.10.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@mastra/core": "^0.10.0"
|
|
43
46
|
},
|
|
44
47
|
"scripts": {
|
|
45
48
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
package/src/index.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto';
|
|
2
2
|
import { subscribe } from '@inngest/realtime';
|
|
3
|
-
import type { Mastra,
|
|
3
|
+
import type { Mastra, WorkflowRun, WorkflowRuns } from '@mastra/core';
|
|
4
4
|
import { RuntimeContext } from '@mastra/core/di';
|
|
5
|
-
import {
|
|
5
|
+
import { Workflow, createStep, Run, DefaultExecutionEngine, cloneStep } from '@mastra/core/workflows';
|
|
6
6
|
import type {
|
|
7
7
|
ExecuteFunction,
|
|
8
8
|
ExecutionContext,
|
|
9
9
|
ExecutionEngine,
|
|
10
10
|
ExecutionGraph,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
NewWorkflowConfig,
|
|
11
|
+
Step,
|
|
12
|
+
WorkflowConfig,
|
|
14
13
|
StepFlowEntry,
|
|
15
14
|
StepResult,
|
|
16
15
|
WorkflowResult,
|
|
17
|
-
} from '@mastra/core/workflows
|
|
16
|
+
} from '@mastra/core/workflows';
|
|
18
17
|
import type { Span } from '@opentelemetry/api';
|
|
19
18
|
import type { Inngest, BaseContext } from 'inngest';
|
|
20
19
|
import { serve as inngestServe } from 'inngest/hono';
|
|
21
20
|
import type { z } from 'zod';
|
|
22
21
|
|
|
23
22
|
export function serve({ mastra, inngest }: { mastra: Mastra; inngest: Inngest }): ReturnType<typeof inngestServe> {
|
|
24
|
-
const wfs = mastra.
|
|
23
|
+
const wfs = mastra.getWorkflows();
|
|
25
24
|
const functions = Object.values(wfs).flatMap(wf => {
|
|
26
25
|
if (wf instanceof InngestWorkflow) {
|
|
27
26
|
wf.__registerMastra(mastra);
|
|
@@ -36,7 +35,7 @@ export function serve({ mastra, inngest }: { mastra: Mastra; inngest: Inngest })
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
export class InngestRun<
|
|
39
|
-
TSteps extends
|
|
38
|
+
TSteps extends Step<string, any, any>[] = Step<string, any, any>[],
|
|
40
39
|
TInput extends z.ZodType<any> = z.ZodType<any>,
|
|
41
40
|
TOutput extends z.ZodType<any> = z.ZodType<any>,
|
|
42
41
|
> extends Run<TSteps, TInput, TOutput> {
|
|
@@ -196,18 +195,18 @@ export class InngestRun<
|
|
|
196
195
|
}
|
|
197
196
|
|
|
198
197
|
export class InngestWorkflow<
|
|
199
|
-
TSteps extends
|
|
198
|
+
TSteps extends Step<string, any, any>[] = Step<string, any, any>[],
|
|
200
199
|
TWorkflowId extends string = string,
|
|
201
200
|
TInput extends z.ZodType<any> = z.ZodType<any>,
|
|
202
201
|
TOutput extends z.ZodType<any> = z.ZodType<any>,
|
|
203
202
|
TPrevSchema extends z.ZodType<any> = TInput,
|
|
204
|
-
> extends
|
|
203
|
+
> extends Workflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
|
|
205
204
|
#mastra: Mastra;
|
|
206
205
|
public inngest: Inngest;
|
|
207
206
|
|
|
208
207
|
private function: ReturnType<Inngest['createFunction']> | undefined;
|
|
209
208
|
|
|
210
|
-
constructor(params:
|
|
209
|
+
constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest) {
|
|
211
210
|
super(params);
|
|
212
211
|
this.#mastra = params.mastra!;
|
|
213
212
|
this.inngest = inngest;
|
|
@@ -226,22 +225,20 @@ export class InngestWorkflow<
|
|
|
226
225
|
return { runs: [], total: 0 };
|
|
227
226
|
}
|
|
228
227
|
|
|
229
|
-
return storage.getWorkflowRuns({ workflowName: this.id, ...(args ?? {}) }) as unknown as
|
|
228
|
+
return storage.getWorkflowRuns({ workflowName: this.id, ...(args ?? {}) }) as unknown as WorkflowRuns;
|
|
230
229
|
}
|
|
231
230
|
|
|
232
|
-
async getWorkflowRunById(runId: string): Promise<
|
|
231
|
+
async getWorkflowRunById(runId: string): Promise<WorkflowRun | null> {
|
|
233
232
|
const storage = this.#mastra?.getStorage();
|
|
234
233
|
if (!storage) {
|
|
235
234
|
this.logger.debug('Cannot get workflow runs. Mastra engine is not initialized');
|
|
236
235
|
return null;
|
|
237
236
|
}
|
|
238
|
-
const run = (await storage.getWorkflowRunById({ runId, workflowName: this.id })) as unknown as
|
|
237
|
+
const run = (await storage.getWorkflowRunById({ runId, workflowName: this.id })) as unknown as WorkflowRun;
|
|
239
238
|
|
|
240
239
|
return (
|
|
241
240
|
run ??
|
|
242
|
-
(this.runs.get(runId)
|
|
243
|
-
? ({ ...this.runs.get(runId), workflowName: this.id } as unknown as VNextWorkflowRun)
|
|
244
|
-
: null)
|
|
241
|
+
(this.runs.get(runId) ? ({ ...this.runs.get(runId), workflowName: this.id } as unknown as WorkflowRun) : null)
|
|
245
242
|
);
|
|
246
243
|
}
|
|
247
244
|
|
|
@@ -396,7 +393,7 @@ export function init(inngest: Inngest) {
|
|
|
396
393
|
TInput extends z.ZodType<any> = z.ZodType<any>,
|
|
397
394
|
TOutput extends z.ZodType<any> = z.ZodType<any>,
|
|
398
395
|
TSteps extends Step<string, any, any>[] = Step<string, any, any>[],
|
|
399
|
-
>(params:
|
|
396
|
+
>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>) {
|
|
400
397
|
return new InngestWorkflow(params, inngest);
|
|
401
398
|
},
|
|
402
399
|
createStep,
|