@mastra/inngest 0.0.0-netlify-no-bundle-20251127120354 → 0.0.0-new-button-export-20251219130424
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 +517 -12
- package/dist/execution-engine.d.ts +109 -0
- package/dist/execution-engine.d.ts.map +1 -0
- package/dist/index.cjs +684 -963
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -319
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +682 -963
- package/dist/index.js.map +1 -1
- package/dist/pubsub.d.ts +56 -0
- package/dist/pubsub.d.ts.map +1 -0
- package/dist/run.d.ts +167 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/serve.d.ts +13 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/workflow.d.ts +51 -0
- package/dist/workflow.d.ts.map +1 -0
- package/package.json +7 -8
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { SerializedError } from '@mastra/core/error';
|
|
2
|
+
import type { PubSub } from '@mastra/core/events';
|
|
3
|
+
import type { Mastra } from '@mastra/core/mastra';
|
|
4
|
+
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
5
|
+
import type { ExecutionContext, Step, StepResult, ExecutionEngineOptions, TimeTravelExecutionParams } from '@mastra/core/workflows';
|
|
6
|
+
import type { Inngest, BaseContext } from 'inngest';
|
|
7
|
+
export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
8
|
+
private inngestStep;
|
|
9
|
+
private inngestAttempts;
|
|
10
|
+
constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts: number | undefined, options: ExecutionEngineOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Format errors while preserving Error instances and their custom properties.
|
|
13
|
+
* Uses getErrorFromUnknown to ensure all error properties are preserved.
|
|
14
|
+
*/
|
|
15
|
+
protected formatResultError(error: Error | string | undefined, lastOutput: StepResult<any, any, any, any>): SerializedError;
|
|
16
|
+
/**
|
|
17
|
+
* Detect InngestWorkflow instances for special nested workflow handling
|
|
18
|
+
*/
|
|
19
|
+
isNestedWorkflowStep(step: Step<any, any, any>): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Inngest requires requestContext serialization for memoization.
|
|
22
|
+
* When steps are replayed, the original function doesn't re-execute,
|
|
23
|
+
* so requestContext modifications must be captured and restored.
|
|
24
|
+
*/
|
|
25
|
+
requiresDurableContextSerialization(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Execute a step with retry logic for Inngest.
|
|
28
|
+
* Retries are handled via step-level retry (RetryAfterError thrown INSIDE step.run()).
|
|
29
|
+
* After retries exhausted, error propagates here and we return a failed result.
|
|
30
|
+
*/
|
|
31
|
+
executeStepWithRetry<T>(stepId: string, runStep: () => Promise<T>, params: {
|
|
32
|
+
retries: number;
|
|
33
|
+
delay: number;
|
|
34
|
+
stepSpan?: any;
|
|
35
|
+
workflowId: string;
|
|
36
|
+
runId: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
ok: true;
|
|
39
|
+
result: T;
|
|
40
|
+
} | {
|
|
41
|
+
ok: false;
|
|
42
|
+
error: {
|
|
43
|
+
status: 'failed';
|
|
44
|
+
error: Error;
|
|
45
|
+
endedAt: number;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Use Inngest's sleep primitive for durability
|
|
50
|
+
*/
|
|
51
|
+
executeSleepDuration(duration: number, sleepId: string, workflowId: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Use Inngest's sleepUntil primitive for durability
|
|
54
|
+
*/
|
|
55
|
+
executeSleepUntilDate(date: Date, sleepUntilId: string, workflowId: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Wrap durable operations in Inngest step.run() for durability.
|
|
58
|
+
* If retryConfig is provided, throws RetryAfterError INSIDE step.run() to trigger
|
|
59
|
+
* Inngest's step-level retry mechanism (not function-level retry).
|
|
60
|
+
*/
|
|
61
|
+
wrapDurableOperation<T>(operationId: string, operationFn: () => Promise<T>, retryConfig?: {
|
|
62
|
+
delay: number;
|
|
63
|
+
}): Promise<T>;
|
|
64
|
+
/**
|
|
65
|
+
* Provide Inngest step primitive in engine context
|
|
66
|
+
*/
|
|
67
|
+
getEngineContext(): Record<string, any>;
|
|
68
|
+
/**
|
|
69
|
+
* For Inngest, lifecycle callbacks are invoked in the workflow's finalize step
|
|
70
|
+
* (wrapped in step.run for durability), not in execute(). Override to skip.
|
|
71
|
+
*/
|
|
72
|
+
invokeLifecycleCallbacks(_result: {
|
|
73
|
+
status: any;
|
|
74
|
+
result?: any;
|
|
75
|
+
error?: any;
|
|
76
|
+
steps: Record<string, any>;
|
|
77
|
+
tripwire?: any;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Actually invoke the lifecycle callbacks. Called from workflow.ts finalize step.
|
|
81
|
+
*/
|
|
82
|
+
invokeLifecycleCallbacksInternal(result: {
|
|
83
|
+
status: any;
|
|
84
|
+
result?: any;
|
|
85
|
+
error?: any;
|
|
86
|
+
steps: Record<string, any>;
|
|
87
|
+
tripwire?: any;
|
|
88
|
+
}): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Execute nested InngestWorkflow using inngestStep.invoke() for durability.
|
|
91
|
+
* This MUST be called directly (not inside step.run()) due to Inngest constraints.
|
|
92
|
+
*/
|
|
93
|
+
executeWorkflowStep(params: {
|
|
94
|
+
step: Step<string, any, any>;
|
|
95
|
+
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
96
|
+
executionContext: ExecutionContext;
|
|
97
|
+
resume?: {
|
|
98
|
+
steps: string[];
|
|
99
|
+
resumePayload: any;
|
|
100
|
+
runId?: string;
|
|
101
|
+
};
|
|
102
|
+
timeTravel?: TimeTravelExecutionParams;
|
|
103
|
+
prevOutput: any;
|
|
104
|
+
inputData: any;
|
|
105
|
+
pubsub: PubSub;
|
|
106
|
+
startedAt: number;
|
|
107
|
+
}): Promise<StepResult<any, any, any, any> | null>;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=execution-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-engine.d.ts","sourceRoot":"","sources":["../src/execution-engine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAmC,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAChB,IAAI,EACJ,UAAU,EAEV,sBAAsB,EACtB,yBAAyB,EAE1B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGpD,qBAAa,sBAAuB,SAAQ,sBAAsB;IAChE,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,eAAe,CAAS;gBAG9B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EACzC,eAAe,EAAE,MAAM,YAAI,EAC3B,OAAO,EAAE,sBAAsB;IAWjC;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CACzB,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,EACjC,UAAU,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACzC,eAAe;IAUlB;;OAEG;IACH,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,OAAO;IAIxD;;;;OAIG;IACH,mCAAmC,IAAI,OAAO;IAI9C;;;;OAIG;IACG,oBAA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