@mastra/inngest 0.0.0-feat-mcp-embedded-docs-tools-clean-20260105080340 → 0.0.0-feat-mcp-embedded-docs-tools-clean-20260108124346

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/index.js CHANGED
@@ -1152,19 +1152,6 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1152
1152
  }
1153
1153
  return workflowsStore.listWorkflowRuns({ workflowName: this.id, ...args ?? {} });
1154
1154
  }
1155
- async getWorkflowRunById(runId) {
1156
- const storage = this.#mastra?.getStorage();
1157
- if (!storage) {
1158
- this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
1159
- return this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null;
1160
- }
1161
- const workflowsStore = await storage.getStore("workflows");
1162
- if (!workflowsStore) {
1163
- return this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null;
1164
- }
1165
- const run = await workflowsStore.getWorkflowRunById({ runId, workflowName: this.id });
1166
- return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
1167
- }
1168
1155
  __registerMastra(mastra) {
1169
1156
  super.__registerMastra(mastra);
1170
1157
  this.#mastra = mastra;
@@ -1208,10 +1195,11 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1208
1195
  workflowStatus: run.workflowRunStatus,
1209
1196
  stepResults: {}
1210
1197
  });
1211
- const workflowSnapshotInStorage = await this.getWorkflowRunExecutionResult(runIdToUse, {
1198
+ const existingRun = await this.getWorkflowRunById(runIdToUse, {
1212
1199
  withNestedWorkflows: false
1213
1200
  });
1214
- if (!workflowSnapshotInStorage && shouldPersistSnapshot) {
1201
+ const existsInStorage = existingRun && !existingRun.isFromInMemory;
1202
+ if (!existsInStorage && shouldPersistSnapshot) {
1215
1203
  const workflowsStore = await this.mastra?.getStorage()?.getStore("workflows");
1216
1204
  await workflowsStore?.persistWorkflowSnapshot({
1217
1205
  workflowName: this.id,
@@ -1281,6 +1269,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1281
1269
  });
1282
1270
  }
1283
1271
  const pubsub = new InngestPubSub(this.inngest, this.id, publish);
1272
+ const requestContext = new RequestContext(Object.entries(event.data.requestContext ?? {}));
1284
1273
  const engine = new InngestExecutionEngine(this.#mastra, step, attempt, this.options);
1285
1274
  const result = await engine.execute({
1286
1275
  workflowId: this.id,
@@ -1292,7 +1281,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1292
1281
  initialState,
1293
1282
  pubsub,
1294
1283
  retryConfig: this.retryConfig,
1295
- requestContext: new RequestContext(Object.entries(event.data.requestContext ?? {})),
1284
+ requestContext,
1296
1285
  resume,
1297
1286
  timeTravel,
1298
1287
  perStep,
@@ -1314,7 +1303,19 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1314
1303
  });
1315
1304
  await step.run(`workflow.${this.id}.finalize`, async () => {
1316
1305
  if (result.status !== "paused") {
1317
- await engine.invokeLifecycleCallbacksInternal(result);
1306
+ await engine.invokeLifecycleCallbacksInternal({
1307
+ status: result.status,
1308
+ result: "result" in result ? result.result : void 0,
1309
+ error: "error" in result ? result.error : void 0,
1310
+ steps: result.steps,
1311
+ tripwire: "tripwire" in result ? result.tripwire : void 0,
1312
+ runId,
1313
+ workflowId: this.id,
1314
+ resourceId,
1315
+ input: inputData,
1316
+ requestContext,
1317
+ state: result.state ?? initialState ?? {}
1318
+ });
1318
1319
  }
1319
1320
  if (result.status === "failed") {
1320
1321
  throw new NonRetriableError(`Workflow failed`, {