@mastra/inngest 1.11.2 → 1.11.3-alpha.1
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/dist/connect.cjs +1 -1
- package/dist/connect.js +1 -1
- package/dist/durable-agent/create-inngest-agent.d.ts +2 -0
- package/dist/durable-agent/create-inngest-agent.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-CSFwfJvk.cjs → src-5A0aFcD7.cjs} +46 -1
- package/dist/src-5A0aFcD7.cjs.map +1 -0
- package/dist/{src-BMFptyh4.js → src-CFtk0_CD.js} +46 -1
- package/dist/src-CFtk0_CD.js.map +1 -0
- package/dist/workflow.d.ts.map +1 -1
- package/package.json +7 -6
- package/dist/src-BMFptyh4.js.map +0 -1
- package/dist/src-CSFwfJvk.cjs.map +0 -1
|
@@ -2039,6 +2039,43 @@ var InngestWorkflow = class extends Workflow {
|
|
|
2039
2039
|
});
|
|
2040
2040
|
return run;
|
|
2041
2041
|
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Records a run Inngest gave up on as failed. Only a row still marked live is
|
|
2044
|
+
* rewritten: a run that failed in its own code already wrote a richer terminal
|
|
2045
|
+
* snapshot in finalize, and a suspended row stays resumable.
|
|
2046
|
+
*/
|
|
2047
|
+
async #markRunFailed(runId, error) {
|
|
2048
|
+
const workflowsStore = await this.#mastra?.getStorage()?.getStore("workflows");
|
|
2049
|
+
if (!workflowsStore) return;
|
|
2050
|
+
const run = await workflowsStore.getWorkflowRunById({
|
|
2051
|
+
runId,
|
|
2052
|
+
workflowName: this.id
|
|
2053
|
+
});
|
|
2054
|
+
const snapshot = typeof run?.snapshot === "string" ? void 0 : run?.snapshot;
|
|
2055
|
+
if (!snapshot || ![
|
|
2056
|
+
"running",
|
|
2057
|
+
"pending",
|
|
2058
|
+
"waiting"
|
|
2059
|
+
].includes(snapshot.status)) return;
|
|
2060
|
+
await workflowsStore.persistWorkflowSnapshot({
|
|
2061
|
+
workflowName: this.id,
|
|
2062
|
+
runId,
|
|
2063
|
+
resourceId: run?.resourceId,
|
|
2064
|
+
expectedStatus: [
|
|
2065
|
+
"running",
|
|
2066
|
+
"pending",
|
|
2067
|
+
"waiting"
|
|
2068
|
+
],
|
|
2069
|
+
snapshot: {
|
|
2070
|
+
...snapshot,
|
|
2071
|
+
status: "failed",
|
|
2072
|
+
activePaths: [],
|
|
2073
|
+
activeStepsPath: {},
|
|
2074
|
+
error: getErrorFromUnknown(error, { fallbackMessage: "Inngest run failed" }),
|
|
2075
|
+
timestamp: Date.now()
|
|
2076
|
+
}
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2042
2079
|
createCronFunction() {
|
|
2043
2080
|
if (this.cronFunction) return this.cronFunction;
|
|
2044
2081
|
this.cronFunction = this.inngest.createFunction({
|
|
@@ -2074,6 +2111,11 @@ var InngestWorkflow = class extends Workflow {
|
|
|
2074
2111
|
event: `cancel.workflow.${this.id}`,
|
|
2075
2112
|
match: "data.runId"
|
|
2076
2113
|
}],
|
|
2114
|
+
onFailure: async ({ event, error }) => {
|
|
2115
|
+
const original = event.data?.event?.data;
|
|
2116
|
+
if (typeof original?.runId !== "string" || original.resume?.claim) return;
|
|
2117
|
+
await this.#markRunFailed(original.runId, error);
|
|
2118
|
+
},
|
|
2077
2119
|
triggers: { event: `workflow.${this.id}` },
|
|
2078
2120
|
...this.flowControlConfig
|
|
2079
2121
|
},
|
|
@@ -3580,6 +3622,9 @@ function createInngestAgent(options) {
|
|
|
3580
3622
|
get pubsub() {
|
|
3581
3623
|
return getPubsub();
|
|
3582
3624
|
},
|
|
3625
|
+
hasResumableStreams() {
|
|
3626
|
+
return true;
|
|
3627
|
+
},
|
|
3583
3628
|
async stream(messages, streamOptions) {
|
|
3584
3629
|
streamOptions = applyReservedMemoryContextKeys(streamOptions);
|
|
3585
3630
|
if (streamOptions?.untilIdle) {
|
|
@@ -5140,4 +5185,4 @@ function init(inngest) {
|
|
|
5140
5185
|
}
|
|
5141
5186
|
export { createServe as a, isInngestAgent as c, InngestRun as d, InngestPubSub as f, connect as i, createInngestDurableAgenticWorkflow as l, InngestExecutionEngine as m, init as n, serve$1 as o, OVERSIZED_EVENT_CHUNK_TYPE as p, _compatibilityCheck as r, createInngestAgent as s, createStep as t, InngestWorkflow as u };
|
|
5142
5187
|
|
|
5143
|
-
//# sourceMappingURL=src-
|
|
5188
|
+
//# sourceMappingURL=src-CFtk0_CD.js.map
|