@mastra/inngest 1.0.0-beta.11 → 1.0.0-beta.12

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
@@ -1269,6 +1269,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1269
1269
  });
1270
1270
  }
1271
1271
  const pubsub = new InngestPubSub(this.inngest, this.id, publish);
1272
+ const requestContext = new RequestContext(Object.entries(event.data.requestContext ?? {}));
1272
1273
  const engine = new InngestExecutionEngine(this.#mastra, step, attempt, this.options);
1273
1274
  const result = await engine.execute({
1274
1275
  workflowId: this.id,
@@ -1280,7 +1281,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1280
1281
  initialState,
1281
1282
  pubsub,
1282
1283
  retryConfig: this.retryConfig,
1283
- requestContext: new RequestContext(Object.entries(event.data.requestContext ?? {})),
1284
+ requestContext,
1284
1285
  resume,
1285
1286
  timeTravel,
1286
1287
  perStep,
@@ -1302,7 +1303,19 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1302
1303
  });
1303
1304
  await step.run(`workflow.${this.id}.finalize`, async () => {
1304
1305
  if (result.status !== "paused") {
1305
- 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
+ });
1306
1319
  }
1307
1320
  if (result.status === "failed") {
1308
1321
  throw new NonRetriableError(`Workflow failed`, {
@@ -1337,12 +1350,7 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
1337
1350
  ];
1338
1351
  }
1339
1352
  };
1340
- function serve({
1341
- mastra,
1342
- inngest,
1343
- functions: userFunctions = [],
1344
- registerOptions
1345
- }) {
1353
+ function prepareServeOptions({ mastra, inngest, functions: userFunctions = [], registerOptions }) {
1346
1354
  const wfs = mastra.listWorkflows();
1347
1355
  const workflowFunctions = Array.from(
1348
1356
  new Set(
@@ -1355,12 +1363,19 @@ function serve({
1355
1363
  })
1356
1364
  )
1357
1365
  );
1358
- return serve$1({
1366
+ return {
1359
1367
  ...registerOptions,
1360
1368
  client: inngest,
1361
1369
  functions: [...workflowFunctions, ...userFunctions]
1362
- });
1370
+ };
1371
+ }
1372
+ function createServe(adapter) {
1373
+ return (options) => {
1374
+ const serveOptions = prepareServeOptions(options);
1375
+ return adapter(serveOptions);
1376
+ };
1363
1377
  }
1378
+ var serve = createServe(serve$1);
1364
1379
 
1365
1380
  // src/types.ts
1366
1381
  var _compatibilityCheck = true;
@@ -1577,6 +1592,6 @@ function init(inngest) {
1577
1592
  };
1578
1593
  }
1579
1594
 
1580
- export { InngestExecutionEngine, InngestPubSub, InngestRun, InngestWorkflow, _compatibilityCheck, createStep, init, serve };
1595
+ export { InngestExecutionEngine, InngestPubSub, InngestRun, InngestWorkflow, _compatibilityCheck, createServe, createStep, init, serve };
1581
1596
  //# sourceMappingURL=index.js.map
1582
1597
  //# sourceMappingURL=index.js.map