@mastra/inngest 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-testing-cloud-studios-20260114234039

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.
@@ -0,0 +1,53 @@
1
+ import type { Mastra } from '@mastra/core/mastra';
2
+ import type { WorkflowRuns } from '@mastra/core/storage';
3
+ import { Workflow } from '@mastra/core/workflows';
4
+ import type { Step, StepFlowEntry, Run } from '@mastra/core/workflows';
5
+ import type { Inngest } from 'inngest';
6
+ import type { z } from 'zod';
7
+ import type { InngestEngineType, InngestWorkflowConfig } from './types.js';
8
+ export declare class InngestWorkflow<TEngineType = InngestEngineType, TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TState extends z.ZodObject<any> = z.ZodObject<any>, 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, TState, TInput, TOutput, TPrevSchema> {
9
+ #private;
10
+ inngest: Inngest;
11
+ private function;
12
+ private cronFunction;
13
+ private readonly flowControlConfig?;
14
+ private readonly cronConfig?;
15
+ constructor(params: InngestWorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps>, inngest: Inngest);
16
+ listWorkflowRuns(args?: {
17
+ fromDate?: Date;
18
+ toDate?: Date;
19
+ perPage?: number | false;
20
+ page?: number;
21
+ resourceId?: string;
22
+ }): Promise<WorkflowRuns>;
23
+ __registerMastra(mastra: Mastra): void;
24
+ createRun(options?: {
25
+ runId?: string;
26
+ resourceId?: string;
27
+ }): Promise<Run<TEngineType, TSteps, TState, TInput, TOutput>>;
28
+ private createCronFunction;
29
+ getFunction(): import("inngest").InngestFunction<Omit<import("inngest").InngestFunction.Options<Inngest<import("inngest").ClientOptions>, import("inngest").InngestMiddleware.Stack, import("inngest").InngestFunction.Trigger<string>[] | [{
30
+ cron: string;
31
+ } & Partial<Record<"event" | "if", never>>] | [{
32
+ event: string;
33
+ if?: string;
34
+ } & Partial<Record<"cron", never>>], import("inngest").Handler.Any>, "triggers">, import("inngest").Handler.Any, import("inngest").Handler.Any, Inngest<import("inngest").ClientOptions>, import("inngest").InngestMiddleware.Stack, import("inngest").InngestFunction.Trigger<string>[] | [{
35
+ cron: string;
36
+ } & Partial<Record<"event" | "if", never>>] | [{
37
+ event: string;
38
+ if?: string;
39
+ } & Partial<Record<"cron", never>>]>;
40
+ getNestedFunctions(steps: StepFlowEntry[]): ReturnType<Inngest['createFunction']>[];
41
+ getFunctions(): import("inngest").InngestFunction<Omit<import("inngest").InngestFunction.Options<Inngest<import("inngest").ClientOptions>, import("inngest").InngestMiddleware.Stack, import("inngest").InngestFunction.Trigger<string>[] | [{
42
+ cron: string;
43
+ } & Partial<Record<"event" | "if", never>>] | [{
44
+ event: string;
45
+ if?: string;
46
+ } & Partial<Record<"cron", never>>], import("inngest").Handler.Any>, "triggers">, import("inngest").Handler.Any, import("inngest").Handler.Any, Inngest<import("inngest").ClientOptions>, import("inngest").InngestMiddleware.Stack, import("inngest").InngestFunction.Trigger<string>[] | [{
47
+ cron: string;
48
+ } & Partial<Record<"event" | "if", never>>] | [{
49
+ event: string;
50
+ if?: string;
51
+ } & Partial<Record<"cron", never>>]>[];
52
+ }
53
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,EACV,IAAI,EAEJ,aAAa,EAGb,GAAG,EACJ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,EACV,iBAAiB,EAGjB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,qBAAa,eAAe,CAC1B,WAAW,GAAG,iBAAiB,EAC/B,MAAM,SAAS,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAClE,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,MAAM,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAClD,MAAM,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAC9C,OAAO,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAC/C,WAAW,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAC3C,SAAQ,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC;;IAEjF,OAAO,EAAE,OAAO,CAAC;IAExB,OAAO,CAAC,QAAQ,CAAoD;IACpE,OAAO,CAAC,YAAY,CAAoD;IACxE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAA2B;IAC9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAwC;gBAExD,MAAM,EAAE,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO;IAsBnG,gBAAgB,CAAC,IAAI,CAAC,EAAE;QAC5B,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAcD,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAwBzB,SAAS,CAAC,OAAO,CAAC,EAAE;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAkE9D,OAAO,CAAC,kBAAkB;IAwB1B,WAAW;;;;;;;;;;;IA2GX,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE;IAenF,YAAY;;;;;;;;;;;CAOb"}
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@mastra/inngest",
3
- "version": "0.0.0-taofeeqInngest-20250603090617",
3
+ "version": "0.0.0-testing-cloud-studios-20260114234039",
4
4
  "description": "Mastra Inngest integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "CHANGELOG.md"
11
+ ],
8
12
  "exports": {
9
13
  ".": {
10
14
  "import": {
@@ -12,42 +16,58 @@
12
16
  "default": "./dist/index.js"
13
17
  },
14
18
  "require": {
15
- "types": "./dist/index.d.cts",
19
+ "types": "./dist/index.d.ts",
16
20
  "default": "./dist/index.cjs"
17
21
  }
18
22
  },
19
23
  "./package.json": "./package.json"
20
24
  },
21
25
  "dependencies": {
22
- "@inngest/realtime": "^0.3.1",
23
- "inngest": "^3.35.1",
24
- "zod": "^3.24.2",
25
- "@opentelemetry/api": "^1.9.0"
26
+ "@inngest/realtime": "^0.4.5",
27
+ "@opentelemetry/api": "^1.9.0",
28
+ "inngest": "^3.44.3"
26
29
  },
27
30
  "devDependencies": {
28
- "@ai-sdk/openai": "^1.3.22",
29
- "@hono/node-server": "^1.14.1",
30
- "@microsoft/api-extractor": "^7.52.2",
31
- "@types/node": "^20.17.27",
32
- "ai": "^4.3.15",
33
- "eslint": "^9.23.0",
34
- "execa": "^9.5.2",
31
+ "@ai-sdk/openai": "^1.3.24",
32
+ "@hono/node-server": "^1.19.6",
33
+ "@types/node": "22.13.17",
34
+ "@vitest/coverage-v8": "4.0.12",
35
+ "@vitest/ui": "4.0.12",
36
+ "ai": "^4.3.19",
37
+ "eslint": "^9.37.0",
38
+ "execa": "^9.6.0",
35
39
  "get-port": "7.1.0",
36
- "hono": "^4.7.7",
37
- "tsup": "^8.4.0",
38
- "typescript": "^5.8.2",
39
- "vitest": "^2.1.9",
40
- "@mastra/deployer": "0.0.0-taofeeqInngest-20250603090617",
41
- "@internal/lint": "0.0.0-taofeeqInngest-20250603090617",
42
- "@mastra/core": "0.0.0-taofeeqInngest-20250603090617"
40
+ "hono": "^4.11.3",
41
+ "inngest-cli": "^1.12.1",
42
+ "tsup": "^8.5.0",
43
+ "typescript": "^5.9.3",
44
+ "vitest": "4.0.16",
45
+ "@internal/lint": "0.0.0-testing-cloud-studios-20260114234039",
46
+ "@internal/types-builder": "0.0.0-testing-cloud-studios-20260114234039",
47
+ "@mastra/core": "0.0.0-testing-cloud-studios-20260114234039",
48
+ "@mastra/deployer": "0.0.0-testing-cloud-studios-20260114234039",
49
+ "@mastra/libsql": "0.0.0-testing-cloud-studios-20260114234039"
43
50
  },
44
51
  "peerDependencies": {
45
- "@mastra/core": "^0.10.0-alpha.0"
52
+ "zod": "^3.25.0 || ^4.0.0",
53
+ "@mastra/core": "0.0.0-testing-cloud-studios-20260114234039"
54
+ },
55
+ "homepage": "https://mastra.ai",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/mastra-ai/mastra.git",
59
+ "directory": "workflows/inngest"
60
+ },
61
+ "bugs": {
62
+ "url": "https://github.com/mastra-ai/mastra/issues"
63
+ },
64
+ "engines": {
65
+ "node": ">=22.13.0"
46
66
  },
47
67
  "scripts": {
48
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
68
+ "build": "tsup --silent --config tsup.config.ts",
49
69
  "build:watch": "pnpm build --watch",
50
- "test": "vitest run",
70
+ "test": "docker-compose up -d && vitest run --no-isolate --retry=1 && docker-compose down",
51
71
  "lint": "eslint ."
52
72
  }
53
73
  }
@@ -1,199 +0,0 @@
1
- import type { BaseContext } from 'inngest';
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';
10
- import { Handler } from 'inngest';
11
- import type { Inngest } from 'inngest';
12
- import { InngestFunction } from 'inngest';
13
- import { InngestMiddleware } from 'inngest';
14
- import type { Mastra } from '@mastra/core';
15
- import { Run } from '@mastra/core/workflows';
16
- import { RuntimeContext } from '@mastra/core/di';
17
- import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
18
- import { serve as serve_2 } from 'inngest/hono';
19
- import type { Span } from '@opentelemetry/api';
20
- import type { Step } from '@mastra/core/workflows';
21
- import type { StepFlowEntry } from '@mastra/core/workflows';
22
- import type { StepResult } from '@mastra/core/workflows';
23
- import { Workflow } from '@mastra/core/workflows';
24
- import type { WorkflowConfig } from '@mastra/core/workflows';
25
- import type { WorkflowResult } from '@mastra/core/workflows';
26
- import type { WorkflowRun } from '@mastra/core';
27
- import type { WorkflowRuns } from '@mastra/core';
28
- import type { z } from 'zod';
29
-
30
- 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: {
31
- id: TWorkflowId;
32
- }): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
33
-
34
- 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, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
36
- createStep: typeof createStep;
37
- cloneStep: typeof cloneStep;
38
- cloneWorkflow: typeof cloneWorkflow;
39
- };
40
-
41
- export declare class InngestExecutionEngine extends DefaultExecutionEngine {
42
- private inngestStep;
43
- private inngestAttempts;
44
- constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
45
- protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
46
- emit: (event: string, data: any) => Promise<void>;
47
- }, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
48
- superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
49
- workflowId: string;
50
- runId: string;
51
- step: Step<string, any, any>;
52
- stepResults: Record<string, StepResult<any, any, any, any>>;
53
- executionContext: ExecutionContext;
54
- resume?: {
55
- steps: string[];
56
- resumePayload: any;
57
- };
58
- prevOutput: any;
59
- emitter: {
60
- emit: (event: string, data: any) => Promise<void>;
61
- };
62
- runtimeContext: RuntimeContext;
63
- }): Promise<StepResult<any, any, any, any>>;
64
- executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
65
- step: Step<string, any, any>;
66
- stepResults: Record<string, StepResult<any, any, any, any>>;
67
- executionContext: {
68
- workflowId: string;
69
- runId: string;
70
- executionPath: number[];
71
- suspendedPaths: Record<string, number[]>;
72
- retryConfig: {
73
- attempts: number;
74
- delay: number;
75
- };
76
- };
77
- resume?: {
78
- steps: string[];
79
- resumePayload: any;
80
- runId?: string;
81
- };
82
- prevOutput: any;
83
- emitter: {
84
- emit: (event: string, data: any) => Promise<void>;
85
- };
86
- runtimeContext: RuntimeContext;
87
- }): Promise<StepResult<any, any, any, any>>;
88
- persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, }: {
89
- workflowId: string;
90
- runId: string;
91
- stepResults: Record<string, StepResult<any, any, any, any>>;
92
- serializedStepGraph: SerializedStepFlowEntry[];
93
- executionContext: ExecutionContext;
94
- }): Promise<void>;
95
- executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
96
- workflowId: string;
97
- runId: string;
98
- entry: {
99
- type: 'conditional';
100
- steps: StepFlowEntry[];
101
- conditions: ExecuteFunction<any, any, any, any>[];
102
- };
103
- prevStep: StepFlowEntry;
104
- serializedStepGraph: SerializedStepFlowEntry[];
105
- prevOutput: any;
106
- stepResults: Record<string, StepResult<any, any, any, any>>;
107
- resume?: {
108
- steps: string[];
109
- stepResults: Record<string, StepResult<any, any, any, any>>;
110
- resumePayload: any;
111
- resumePath: number[];
112
- };
113
- executionContext: ExecutionContext;
114
- emitter: {
115
- emit: (event: string, data: any) => Promise<void>;
116
- };
117
- runtimeContext: RuntimeContext;
118
- }): Promise<StepResult<any, any, any, any>>;
119
- }
120
-
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> {
122
- #private;
123
- private inngest;
124
- serializedStepGraph: SerializedStepFlowEntry[];
125
- constructor(params: {
126
- workflowId: string;
127
- runId: string;
128
- executionEngine: ExecutionEngine;
129
- executionGraph: ExecutionGraph;
130
- serializedStepGraph: SerializedStepFlowEntry[];
131
- mastra?: Mastra;
132
- retryConfig?: {
133
- attempts?: number;
134
- delay?: number;
135
- };
136
- cleanup?: () => void;
137
- }, inngest: Inngest);
138
- getRuns(eventId: string): Promise<any>;
139
- getRunOutput(eventId: string): Promise<any>;
140
- start({ inputData, }: {
141
- inputData?: z.infer<TInput>;
142
- runtimeContext?: RuntimeContext;
143
- }): Promise<WorkflowResult<TOutput, TSteps>>;
144
- resume<TResumeSchema extends z.ZodType<any>>(params: {
145
- resumeData?: z.infer<TResumeSchema>;
146
- step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
147
- runtimeContext?: RuntimeContext;
148
- }): Promise<WorkflowResult<TOutput, TSteps>>;
149
- watch(cb: (event: any) => void): () => void;
150
- }
151
-
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> {
153
- #private;
154
- inngest: Inngest;
155
- private function;
156
- constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
157
- getWorkflowRuns(args?: {
158
- fromDate?: Date;
159
- toDate?: Date;
160
- limit?: number;
161
- offset?: number;
162
- resourceId?: string;
163
- }): Promise<WorkflowRuns>;
164
- getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
165
- __registerMastra(mastra: Mastra): void;
166
- createRun(options?: {
167
- runId?: string;
168
- }): Run<TSteps, TInput, TOutput>;
169
- getFunction(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
170
- cron: string;
171
- } & Partial<Record<"event" | "if", never>>] | [{
172
- event: string;
173
- if?: string;
174
- } & Partial<Record<"cron", never>>], Handler.Any>, "triggers">, Handler.Any, Handler.Any, Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
175
- cron: string;
176
- } & Partial<Record<"event" | "if", never>>] | [{
177
- event: string;
178
- if?: string;
179
- } & Partial<Record<"cron", never>>]>;
180
- getNestedFunctions(steps: StepFlowEntry[]): ReturnType<Inngest['createFunction']>[];
181
- getFunctions(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
182
- cron: string;
183
- } & Partial<Record<"event" | "if", never>>] | [{
184
- event: string;
185
- if?: string;
186
- } & Partial<Record<"cron", never>>], Handler.Any>, "triggers">, Handler.Any, Handler.Any, Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
187
- cron: string;
188
- } & Partial<Record<"event" | "if", never>>] | [{
189
- event: string;
190
- if?: string;
191
- } & Partial<Record<"cron", never>>]>[];
192
- }
193
-
194
- export declare function serve({ mastra, inngest }: {
195
- mastra: Mastra;
196
- inngest: Inngest;
197
- }): ReturnType<typeof serve_2>;
198
-
199
- export { }
@@ -1,199 +0,0 @@
1
- import type { BaseContext } from 'inngest';
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';
10
- import { Handler } from 'inngest';
11
- import type { Inngest } from 'inngest';
12
- import { InngestFunction } from 'inngest';
13
- import { InngestMiddleware } from 'inngest';
14
- import type { Mastra } from '@mastra/core';
15
- import { Run } from '@mastra/core/workflows';
16
- import { RuntimeContext } from '@mastra/core/di';
17
- import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
18
- import { serve as serve_2 } from 'inngest/hono';
19
- import type { Span } from '@opentelemetry/api';
20
- import type { Step } from '@mastra/core/workflows';
21
- import type { StepFlowEntry } from '@mastra/core/workflows';
22
- import type { StepResult } from '@mastra/core/workflows';
23
- import { Workflow } from '@mastra/core/workflows';
24
- import type { WorkflowConfig } from '@mastra/core/workflows';
25
- import type { WorkflowResult } from '@mastra/core/workflows';
26
- import type { WorkflowRun } from '@mastra/core';
27
- import type { WorkflowRuns } from '@mastra/core';
28
- import type { z } from 'zod';
29
-
30
- 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: {
31
- id: TWorkflowId;
32
- }): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
33
-
34
- 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, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
36
- createStep: typeof createStep;
37
- cloneStep: typeof cloneStep;
38
- cloneWorkflow: typeof cloneWorkflow;
39
- };
40
-
41
- export declare class InngestExecutionEngine extends DefaultExecutionEngine {
42
- private inngestStep;
43
- private inngestAttempts;
44
- constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
45
- protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
46
- emit: (event: string, data: any) => Promise<void>;
47
- }, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
48
- superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
49
- workflowId: string;
50
- runId: string;
51
- step: Step<string, any, any>;
52
- stepResults: Record<string, StepResult<any, any, any, any>>;
53
- executionContext: ExecutionContext;
54
- resume?: {
55
- steps: string[];
56
- resumePayload: any;
57
- };
58
- prevOutput: any;
59
- emitter: {
60
- emit: (event: string, data: any) => Promise<void>;
61
- };
62
- runtimeContext: RuntimeContext;
63
- }): Promise<StepResult<any, any, any, any>>;
64
- executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
65
- step: Step<string, any, any>;
66
- stepResults: Record<string, StepResult<any, any, any, any>>;
67
- executionContext: {
68
- workflowId: string;
69
- runId: string;
70
- executionPath: number[];
71
- suspendedPaths: Record<string, number[]>;
72
- retryConfig: {
73
- attempts: number;
74
- delay: number;
75
- };
76
- };
77
- resume?: {
78
- steps: string[];
79
- resumePayload: any;
80
- runId?: string;
81
- };
82
- prevOutput: any;
83
- emitter: {
84
- emit: (event: string, data: any) => Promise<void>;
85
- };
86
- runtimeContext: RuntimeContext;
87
- }): Promise<StepResult<any, any, any, any>>;
88
- persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, }: {
89
- workflowId: string;
90
- runId: string;
91
- stepResults: Record<string, StepResult<any, any, any, any>>;
92
- serializedStepGraph: SerializedStepFlowEntry[];
93
- executionContext: ExecutionContext;
94
- }): Promise<void>;
95
- executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
96
- workflowId: string;
97
- runId: string;
98
- entry: {
99
- type: 'conditional';
100
- steps: StepFlowEntry[];
101
- conditions: ExecuteFunction<any, any, any, any>[];
102
- };
103
- prevStep: StepFlowEntry;
104
- serializedStepGraph: SerializedStepFlowEntry[];
105
- prevOutput: any;
106
- stepResults: Record<string, StepResult<any, any, any, any>>;
107
- resume?: {
108
- steps: string[];
109
- stepResults: Record<string, StepResult<any, any, any, any>>;
110
- resumePayload: any;
111
- resumePath: number[];
112
- };
113
- executionContext: ExecutionContext;
114
- emitter: {
115
- emit: (event: string, data: any) => Promise<void>;
116
- };
117
- runtimeContext: RuntimeContext;
118
- }): Promise<StepResult<any, any, any, any>>;
119
- }
120
-
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> {
122
- #private;
123
- private inngest;
124
- serializedStepGraph: SerializedStepFlowEntry[];
125
- constructor(params: {
126
- workflowId: string;
127
- runId: string;
128
- executionEngine: ExecutionEngine;
129
- executionGraph: ExecutionGraph;
130
- serializedStepGraph: SerializedStepFlowEntry[];
131
- mastra?: Mastra;
132
- retryConfig?: {
133
- attempts?: number;
134
- delay?: number;
135
- };
136
- cleanup?: () => void;
137
- }, inngest: Inngest);
138
- getRuns(eventId: string): Promise<any>;
139
- getRunOutput(eventId: string): Promise<any>;
140
- start({ inputData, }: {
141
- inputData?: z.infer<TInput>;
142
- runtimeContext?: RuntimeContext;
143
- }): Promise<WorkflowResult<TOutput, TSteps>>;
144
- resume<TResumeSchema extends z.ZodType<any>>(params: {
145
- resumeData?: z.infer<TResumeSchema>;
146
- step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
147
- runtimeContext?: RuntimeContext;
148
- }): Promise<WorkflowResult<TOutput, TSteps>>;
149
- watch(cb: (event: any) => void): () => void;
150
- }
151
-
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> {
153
- #private;
154
- inngest: Inngest;
155
- private function;
156
- constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
157
- getWorkflowRuns(args?: {
158
- fromDate?: Date;
159
- toDate?: Date;
160
- limit?: number;
161
- offset?: number;
162
- resourceId?: string;
163
- }): Promise<WorkflowRuns>;
164
- getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
165
- __registerMastra(mastra: Mastra): void;
166
- createRun(options?: {
167
- runId?: string;
168
- }): Run<TSteps, TInput, TOutput>;
169
- getFunction(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
170
- cron: string;
171
- } & Partial<Record<"event" | "if", never>>] | [{
172
- event: string;
173
- if?: string;
174
- } & Partial<Record<"cron", never>>], Handler.Any>, "triggers">, Handler.Any, Handler.Any, Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
175
- cron: string;
176
- } & Partial<Record<"event" | "if", never>>] | [{
177
- event: string;
178
- if?: string;
179
- } & Partial<Record<"cron", never>>]>;
180
- getNestedFunctions(steps: StepFlowEntry[]): ReturnType<Inngest['createFunction']>[];
181
- getFunctions(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
182
- cron: string;
183
- } & Partial<Record<"event" | "if", never>>] | [{
184
- event: string;
185
- if?: string;
186
- } & Partial<Record<"cron", never>>], Handler.Any>, "triggers">, Handler.Any, Handler.Any, Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
187
- cron: string;
188
- } & Partial<Record<"event" | "if", never>>] | [{
189
- event: string;
190
- if?: string;
191
- } & Partial<Record<"cron", never>>]>[];
192
- }
193
-
194
- export declare function serve({ mastra, inngest }: {
195
- mastra: Mastra;
196
- inngest: Inngest;
197
- }): ReturnType<typeof serve_2>;
198
-
199
- export { }
package/dist/index.d.cts DELETED
@@ -1,5 +0,0 @@
1
- export { serve } from './_tsup-dts-rollup.cjs';
2
- export { init } from './_tsup-dts-rollup.cjs';
3
- export { InngestRun } from './_tsup-dts-rollup.cjs';
4
- export { InngestWorkflow } from './_tsup-dts-rollup.cjs';
5
- export { InngestExecutionEngine } from './_tsup-dts-rollup.cjs';
@@ -1,10 +0,0 @@
1
- version: '3'
2
-
3
- services:
4
- inngest:
5
- image: inngest/inngest
6
- command: inngest dev -u http://host.docker.internal:3000/api/inngest --poll-interval=1
7
- ports:
8
- - '8288:8288'
9
- extra_hosts:
10
- - 'host.docker.internal:host-gateway'
package/eslint.config.js DELETED
@@ -1,6 +0,0 @@
1
- import { createConfig } from '@internal/lint/eslint';
2
-
3
- const config = await createConfig();
4
-
5
- /** @type {import("eslint").Linter.Config[]} */
6
- export default [...config.map(conf => ({ ...conf, ignores: [...(conf.ignores || []), '**/vitest.perf.config.ts'] }))];