@mastra/inngest 0.0.0-vnextAgentNetwork-20250602134426 → 0.0.0-workflow-deno-20250616130925
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 +100 -2
- package/dist/_tsup-dts-rollup.d.cts +50 -14
- package/dist/_tsup-dts-rollup.d.ts +50 -14
- package/dist/index.cjs +168 -29
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +168 -30
- package/package.json +18 -17
- package/src/index.test.ts +279 -187
- package/src/index.ts +307 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,121 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-workflow-deno-20250616130925
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3ca9a67: Make createRun async to support storage
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 63f6b7d: dependencies updates:
|
|
12
|
+
- Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
|
|
13
|
+
- Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
|
|
14
|
+
- ee9af57: Add api for polling run execution result and get run by id
|
|
15
|
+
- Updated dependencies [63f6b7d]
|
|
16
|
+
- Updated dependencies [ee9af57]
|
|
17
|
+
- Updated dependencies [36f1c36]
|
|
18
|
+
- Updated dependencies [10d352e]
|
|
19
|
+
- Updated dependencies [3ca9a67]
|
|
20
|
+
- Updated dependencies [53d3c37]
|
|
21
|
+
- Updated dependencies [577ce3a]
|
|
22
|
+
- Updated dependencies [9260b3a]
|
|
23
|
+
- @mastra/core@0.0.0-workflow-deno-20250616130925
|
|
24
|
+
|
|
25
|
+
## 0.10.5-alpha.0
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- 63f6b7d: dependencies updates:
|
|
30
|
+
- Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
|
|
31
|
+
- Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
|
|
32
|
+
- Updated dependencies [63f6b7d]
|
|
33
|
+
- Updated dependencies [36f1c36]
|
|
34
|
+
- Updated dependencies [10d352e]
|
|
35
|
+
- Updated dependencies [53d3c37]
|
|
36
|
+
- @mastra/core@0.10.6-alpha.0
|
|
37
|
+
|
|
38
|
+
## 0.10.4
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 13c97f9: Save run status, result and error in storage snapshot
|
|
43
|
+
- Updated dependencies [13c97f9]
|
|
44
|
+
- @mastra/core@0.10.5
|
|
45
|
+
|
|
46
|
+
## 0.10.3
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- 1ccccff: dependencies updates:
|
|
51
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
52
|
+
- 1ccccff: dependencies updates:
|
|
53
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
54
|
+
- Updated dependencies [d1ed912]
|
|
55
|
+
- Updated dependencies [f6fd25f]
|
|
56
|
+
- Updated dependencies [dffb67b]
|
|
57
|
+
- Updated dependencies [f1f1f1b]
|
|
58
|
+
- Updated dependencies [925ab94]
|
|
59
|
+
- Updated dependencies [f9816ae]
|
|
60
|
+
- Updated dependencies [82090c1]
|
|
61
|
+
- Updated dependencies [1b443fd]
|
|
62
|
+
- Updated dependencies [ce97900]
|
|
63
|
+
- Updated dependencies [f1309d3]
|
|
64
|
+
- Updated dependencies [14a2566]
|
|
65
|
+
- Updated dependencies [f7f8293]
|
|
66
|
+
- Updated dependencies [48eddb9]
|
|
67
|
+
- @mastra/core@0.10.4
|
|
68
|
+
|
|
69
|
+
## 0.10.3-alpha.0
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- 1ccccff: dependencies updates:
|
|
74
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
75
|
+
- 1ccccff: dependencies updates:
|
|
76
|
+
- Updated dependency [`zod@^3.25.56` ↗︎](https://www.npmjs.com/package/zod/v/3.25.56) (from `^3.24.2`, in `dependencies`)
|
|
77
|
+
- Updated dependencies [f6fd25f]
|
|
78
|
+
- Updated dependencies [dffb67b]
|
|
79
|
+
- Updated dependencies [f1309d3]
|
|
80
|
+
- Updated dependencies [f7f8293]
|
|
81
|
+
- @mastra/core@0.10.4-alpha.1
|
|
82
|
+
|
|
83
|
+
## 0.10.2
|
|
4
84
|
|
|
5
85
|
### Patch Changes
|
|
6
86
|
|
|
7
87
|
- 195c428: Add runId to step execute fn
|
|
8
88
|
- 12b7002: Add serializedStepGraph to workflow run snapshot in storage
|
|
9
89
|
- f0d559f: Fix peerdeps for alpha channel
|
|
90
|
+
- 1ee6894: inngest production url fix
|
|
10
91
|
- Updated dependencies [ee77e78]
|
|
11
92
|
- Updated dependencies [592a2db]
|
|
12
93
|
- Updated dependencies [e5dc18d]
|
|
13
94
|
- Updated dependencies [ab5adbe]
|
|
14
95
|
- Updated dependencies [1e8bb40]
|
|
96
|
+
- Updated dependencies [1b5fc55]
|
|
15
97
|
- Updated dependencies [195c428]
|
|
16
98
|
- Updated dependencies [f73e11b]
|
|
99
|
+
- Updated dependencies [37643b8]
|
|
100
|
+
- Updated dependencies [99fd6cf]
|
|
17
101
|
- Updated dependencies [c5bf1ce]
|
|
102
|
+
- Updated dependencies [add596e]
|
|
103
|
+
- Updated dependencies [8dc94d8]
|
|
104
|
+
- Updated dependencies [ecebbeb]
|
|
105
|
+
- Updated dependencies [79d5145]
|
|
18
106
|
- Updated dependencies [12b7002]
|
|
19
107
|
- Updated dependencies [2901125]
|
|
20
|
-
- @mastra/core@0.
|
|
108
|
+
- @mastra/core@0.10.2
|
|
109
|
+
|
|
110
|
+
## 0.10.2-alpha.3
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- 1ee6894: inngest production url fix
|
|
115
|
+
- Updated dependencies [1b5fc55]
|
|
116
|
+
- Updated dependencies [add596e]
|
|
117
|
+
- Updated dependencies [ecebbeb]
|
|
118
|
+
- @mastra/core@0.10.2-alpha.5
|
|
21
119
|
|
|
22
120
|
## 0.10.2-alpha.2
|
|
23
121
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
1
2
|
import type { BaseContext } from 'inngest';
|
|
2
3
|
import { ClientOptions } from 'inngest';
|
|
3
|
-
import { cloneStep } from '@mastra/core/workflows';
|
|
4
|
-
import { createStep } from '@mastra/core/workflows';
|
|
5
4
|
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
6
5
|
import type { ExecuteFunction } from '@mastra/core/workflows';
|
|
7
6
|
import type { ExecutionContext } from '@mastra/core/workflows';
|
|
@@ -20,22 +19,51 @@ import type { Span } from '@opentelemetry/api';
|
|
|
20
19
|
import type { Step } from '@mastra/core/workflows';
|
|
21
20
|
import type { StepFlowEntry } from '@mastra/core/workflows';
|
|
22
21
|
import type { StepResult } from '@mastra/core/workflows';
|
|
22
|
+
import { Tool } from '@mastra/core';
|
|
23
|
+
import type { ToolExecutionContext } from '@mastra/core';
|
|
24
|
+
import type { WatchEvent } from '@mastra/core/workflows';
|
|
23
25
|
import { Workflow } from '@mastra/core/workflows';
|
|
24
26
|
import type { WorkflowConfig } from '@mastra/core/workflows';
|
|
25
27
|
import type { WorkflowResult } from '@mastra/core/workflows';
|
|
26
28
|
import type { WorkflowRun } from '@mastra/core';
|
|
27
29
|
import type { WorkflowRuns } from '@mastra/core';
|
|
28
|
-
import
|
|
30
|
+
import { z } from 'zod';
|
|
29
31
|
|
|
30
|
-
declare function
|
|
31
|
-
id:
|
|
32
|
-
|
|
32
|
+
export declare function createStep<TStepId extends string, TStepInput extends z.ZodType<any>, TStepOutput extends z.ZodType<any>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(params: {
|
|
33
|
+
id: TStepId;
|
|
34
|
+
description?: string;
|
|
35
|
+
inputSchema: TStepInput;
|
|
36
|
+
outputSchema: TStepOutput;
|
|
37
|
+
resumeSchema?: TResumeSchema;
|
|
38
|
+
suspendSchema?: TSuspendSchema;
|
|
39
|
+
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, InngestEngineType>;
|
|
40
|
+
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
|
|
41
|
+
|
|
42
|
+
export declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
|
|
43
|
+
prompt: z.ZodString;
|
|
44
|
+
}>, TStepOutput extends z.ZodObject<{
|
|
45
|
+
text: z.ZodString;
|
|
46
|
+
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
|
|
47
|
+
|
|
48
|
+
export declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
49
|
+
inputSchema: TSchemaIn;
|
|
50
|
+
outputSchema: TSchemaOut;
|
|
51
|
+
execute: (context: TContext) => Promise<any>;
|
|
52
|
+
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>, InngestEngineType>;
|
|
33
53
|
|
|
34
54
|
export declare function init(inngest: Inngest): {
|
|
35
|
-
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,
|
|
55
|
+
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, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
36
56
|
createStep: typeof createStep;
|
|
37
|
-
cloneStep:
|
|
38
|
-
|
|
57
|
+
cloneStep<TStepId extends string>(step: Step<string, any, any, any, any, InngestEngineType>, opts: {
|
|
58
|
+
id: TStepId;
|
|
59
|
+
}): Step<TStepId, any, any, any, any, InngestEngineType>;
|
|
60
|
+
cloneWorkflow<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, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[]>(workflow: Workflow<InngestEngineType, TSteps, string, TInput, TOutput, TInput>, opts: {
|
|
61
|
+
id: TWorkflowId;
|
|
62
|
+
}): Workflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export declare type InngestEngineType = {
|
|
66
|
+
step: any;
|
|
39
67
|
};
|
|
40
68
|
|
|
41
69
|
export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
@@ -61,6 +89,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
61
89
|
};
|
|
62
90
|
runtimeContext: RuntimeContext;
|
|
63
91
|
}): Promise<StepResult<any, any, any, any>>;
|
|
92
|
+
executeSleep({ id, duration }: {
|
|
93
|
+
id: string;
|
|
94
|
+
duration: number;
|
|
95
|
+
}): Promise<void>;
|
|
64
96
|
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
65
97
|
step: Step<string, any, any>;
|
|
66
98
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
@@ -85,12 +117,15 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
85
117
|
};
|
|
86
118
|
runtimeContext: RuntimeContext;
|
|
87
119
|
}): Promise<StepResult<any, any, any, any>>;
|
|
88
|
-
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, }: {
|
|
120
|
+
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
|
|
89
121
|
workflowId: string;
|
|
90
122
|
runId: string;
|
|
91
123
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
92
124
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
93
125
|
executionContext: ExecutionContext;
|
|
126
|
+
workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
|
|
127
|
+
result?: Record<string, any>;
|
|
128
|
+
error?: string | Error;
|
|
94
129
|
}): Promise<void>;
|
|
95
130
|
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
|
|
96
131
|
workflowId: string;
|
|
@@ -98,7 +133,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
98
133
|
entry: {
|
|
99
134
|
type: 'conditional';
|
|
100
135
|
steps: StepFlowEntry[];
|
|
101
|
-
conditions: ExecuteFunction<any, any, any, any>[];
|
|
136
|
+
conditions: ExecuteFunction<any, any, any, any, InngestEngineType>[];
|
|
102
137
|
};
|
|
103
138
|
prevStep: StepFlowEntry;
|
|
104
139
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -118,7 +153,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
118
153
|
}): Promise<StepResult<any, any, any, any>>;
|
|
119
154
|
}
|
|
120
155
|
|
|
121
|
-
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> {
|
|
156
|
+
export declare class InngestRun<TEngineType = InngestEngineType, 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<TEngineType, TSteps, TInput, TOutput> {
|
|
122
157
|
#private;
|
|
123
158
|
private inngest;
|
|
124
159
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -149,7 +184,7 @@ export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<s
|
|
|
149
184
|
watch(cb: (event: any) => void): () => void;
|
|
150
185
|
}
|
|
151
186
|
|
|
152
|
-
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> {
|
|
187
|
+
export declare class InngestWorkflow<TEngineType = InngestEngineType, 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<TEngineType, TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
|
|
153
188
|
#private;
|
|
154
189
|
inngest: Inngest;
|
|
155
190
|
private function;
|
|
@@ -162,10 +197,11 @@ export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = S
|
|
|
162
197
|
resourceId?: string;
|
|
163
198
|
}): Promise<WorkflowRuns>;
|
|
164
199
|
getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
|
|
200
|
+
getWorkflowRunExecutionResult(runId: string): Promise<WatchEvent['payload']['workflowState'] | null>;
|
|
165
201
|
__registerMastra(mastra: Mastra): void;
|
|
166
202
|
createRun(options?: {
|
|
167
203
|
runId?: string;
|
|
168
|
-
}): Run<TSteps, TInput, TOutput
|
|
204
|
+
}): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
|
|
169
205
|
getFunction(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
|
|
170
206
|
cron: string;
|
|
171
207
|
} & Partial<Record<"event" | "if", never>>] | [{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
1
2
|
import type { BaseContext } from 'inngest';
|
|
2
3
|
import { ClientOptions } from 'inngest';
|
|
3
|
-
import { cloneStep } from '@mastra/core/workflows';
|
|
4
|
-
import { createStep } from '@mastra/core/workflows';
|
|
5
4
|
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
6
5
|
import type { ExecuteFunction } from '@mastra/core/workflows';
|
|
7
6
|
import type { ExecutionContext } from '@mastra/core/workflows';
|
|
@@ -20,22 +19,51 @@ import type { Span } from '@opentelemetry/api';
|
|
|
20
19
|
import type { Step } from '@mastra/core/workflows';
|
|
21
20
|
import type { StepFlowEntry } from '@mastra/core/workflows';
|
|
22
21
|
import type { StepResult } from '@mastra/core/workflows';
|
|
22
|
+
import { Tool } from '@mastra/core';
|
|
23
|
+
import type { ToolExecutionContext } from '@mastra/core';
|
|
24
|
+
import type { WatchEvent } from '@mastra/core/workflows';
|
|
23
25
|
import { Workflow } from '@mastra/core/workflows';
|
|
24
26
|
import type { WorkflowConfig } from '@mastra/core/workflows';
|
|
25
27
|
import type { WorkflowResult } from '@mastra/core/workflows';
|
|
26
28
|
import type { WorkflowRun } from '@mastra/core';
|
|
27
29
|
import type { WorkflowRuns } from '@mastra/core';
|
|
28
|
-
import
|
|
30
|
+
import { z } from 'zod';
|
|
29
31
|
|
|
30
|
-
declare function
|
|
31
|
-
id:
|
|
32
|
-
|
|
32
|
+
export declare function createStep<TStepId extends string, TStepInput extends z.ZodType<any>, TStepOutput extends z.ZodType<any>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(params: {
|
|
33
|
+
id: TStepId;
|
|
34
|
+
description?: string;
|
|
35
|
+
inputSchema: TStepInput;
|
|
36
|
+
outputSchema: TStepOutput;
|
|
37
|
+
resumeSchema?: TResumeSchema;
|
|
38
|
+
suspendSchema?: TSuspendSchema;
|
|
39
|
+
execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, InngestEngineType>;
|
|
40
|
+
}): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
|
|
41
|
+
|
|
42
|
+
export declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
|
|
43
|
+
prompt: z.ZodString;
|
|
44
|
+
}>, TStepOutput extends z.ZodObject<{
|
|
45
|
+
text: z.ZodString;
|
|
46
|
+
}>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
|
|
47
|
+
|
|
48
|
+
export declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
|
|
49
|
+
inputSchema: TSchemaIn;
|
|
50
|
+
outputSchema: TSchemaOut;
|
|
51
|
+
execute: (context: TContext) => Promise<any>;
|
|
52
|
+
}): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>, InngestEngineType>;
|
|
33
53
|
|
|
34
54
|
export declare function init(inngest: Inngest): {
|
|
35
|
-
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,
|
|
55
|
+
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, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
36
56
|
createStep: typeof createStep;
|
|
37
|
-
cloneStep:
|
|
38
|
-
|
|
57
|
+
cloneStep<TStepId extends string>(step: Step<string, any, any, any, any, InngestEngineType>, opts: {
|
|
58
|
+
id: TStepId;
|
|
59
|
+
}): Step<TStepId, any, any, any, any, InngestEngineType>;
|
|
60
|
+
cloneWorkflow<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, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[]>(workflow: Workflow<InngestEngineType, TSteps, string, TInput, TOutput, TInput>, opts: {
|
|
61
|
+
id: TWorkflowId;
|
|
62
|
+
}): Workflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TInput>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export declare type InngestEngineType = {
|
|
66
|
+
step: any;
|
|
39
67
|
};
|
|
40
68
|
|
|
41
69
|
export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
@@ -61,6 +89,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
61
89
|
};
|
|
62
90
|
runtimeContext: RuntimeContext;
|
|
63
91
|
}): Promise<StepResult<any, any, any, any>>;
|
|
92
|
+
executeSleep({ id, duration }: {
|
|
93
|
+
id: string;
|
|
94
|
+
duration: number;
|
|
95
|
+
}): Promise<void>;
|
|
64
96
|
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
|
|
65
97
|
step: Step<string, any, any>;
|
|
66
98
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
@@ -85,12 +117,15 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
85
117
|
};
|
|
86
118
|
runtimeContext: RuntimeContext;
|
|
87
119
|
}): Promise<StepResult<any, any, any, any>>;
|
|
88
|
-
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, }: {
|
|
120
|
+
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
|
|
89
121
|
workflowId: string;
|
|
90
122
|
runId: string;
|
|
91
123
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
92
124
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
93
125
|
executionContext: ExecutionContext;
|
|
126
|
+
workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
|
|
127
|
+
result?: Record<string, any>;
|
|
128
|
+
error?: string | Error;
|
|
94
129
|
}): Promise<void>;
|
|
95
130
|
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
|
|
96
131
|
workflowId: string;
|
|
@@ -98,7 +133,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
98
133
|
entry: {
|
|
99
134
|
type: 'conditional';
|
|
100
135
|
steps: StepFlowEntry[];
|
|
101
|
-
conditions: ExecuteFunction<any, any, any, any>[];
|
|
136
|
+
conditions: ExecuteFunction<any, any, any, any, InngestEngineType>[];
|
|
102
137
|
};
|
|
103
138
|
prevStep: StepFlowEntry;
|
|
104
139
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -118,7 +153,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
118
153
|
}): Promise<StepResult<any, any, any, any>>;
|
|
119
154
|
}
|
|
120
155
|
|
|
121
|
-
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> {
|
|
156
|
+
export declare class InngestRun<TEngineType = InngestEngineType, 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<TEngineType, TSteps, TInput, TOutput> {
|
|
122
157
|
#private;
|
|
123
158
|
private inngest;
|
|
124
159
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -149,7 +184,7 @@ export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<s
|
|
|
149
184
|
watch(cb: (event: any) => void): () => void;
|
|
150
185
|
}
|
|
151
186
|
|
|
152
|
-
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> {
|
|
187
|
+
export declare class InngestWorkflow<TEngineType = InngestEngineType, 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<TEngineType, TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
|
|
153
188
|
#private;
|
|
154
189
|
inngest: Inngest;
|
|
155
190
|
private function;
|
|
@@ -162,10 +197,11 @@ export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = S
|
|
|
162
197
|
resourceId?: string;
|
|
163
198
|
}): Promise<WorkflowRuns>;
|
|
164
199
|
getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
|
|
200
|
+
getWorkflowRunExecutionResult(runId: string): Promise<WatchEvent['payload']['workflowState'] | null>;
|
|
165
201
|
__registerMastra(mastra: Mastra): void;
|
|
166
202
|
createRun(options?: {
|
|
167
203
|
runId?: string;
|
|
168
|
-
}): Run<TSteps, TInput, TOutput
|
|
204
|
+
}): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
|
|
169
205
|
getFunction(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
|
|
170
206
|
cron: string;
|
|
171
207
|
} & Partial<Record<"event" | "if", never>>] | [{
|