@mastra/inngest 0.13.3-alpha.1 → 0.14.0

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 CHANGED
@@ -1,5 +1,46 @@
1
1
  # @mastra/inngest
2
2
 
3
+ ## 0.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Fully deprecated createRun (now throws an error) in favour of createRunAsync ([#7897](https://github.com/mastra-ai/mastra/pull/7897))
8
+
9
+ ### Patch Changes
10
+
11
+ - dependencies updates: ([#7865](https://github.com/mastra-ai/mastra/pull/7865))
12
+ - Updated dependency [`inngest@^3.40.3` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.3) (from `^3.40.2`, in `dependencies`)
13
+
14
+ - Added the ability to hide internal ai tracing spans (enabled by default) ([#7764](https://github.com/mastra-ai/mastra/pull/7764))
15
+
16
+ - Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
17
+
18
+ - refactored handling of internal ai spans to be more intelligent ([#7876](https://github.com/mastra-ai/mastra/pull/7876))
19
+
20
+ - fix(workflows/inngest): handle Date serialization in sleepUntil execution ([#7863](https://github.com/mastra-ai/mastra/pull/7863))
21
+
22
+ - add resourceId support to inngest workflow execution engine for workflow snapshot persistance ([#7792](https://github.com/mastra-ai/mastra/pull/7792))
23
+
24
+ - feat(inngest): add support for user-supplied functions in `serve` / `inngestServe` ([#7900](https://github.com/mastra-ai/mastra/pull/7900))
25
+
26
+ - Updated dependencies [[`197cbb2`](https://github.com/mastra-ai/mastra/commit/197cbb248fc8cb4bbf61bf70b770f1388b445df2), [`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`6590763`](https://github.com/mastra-ai/mastra/commit/65907630ef4bf4127067cecd1cb21b56f55d5f1b), [`fb84c21`](https://github.com/mastra-ai/mastra/commit/fb84c21859d09bdc8f158bd5412bdc4b5835a61c), [`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`c2eade3`](https://github.com/mastra-ai/mastra/commit/c2eade3508ef309662f065e5f340d7840295dd53), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`222965a`](https://github.com/mastra-ai/mastra/commit/222965a98ce8197b86673ec594244650b5960257), [`6047778`](https://github.com/mastra-ai/mastra/commit/6047778e501df460648f31decddf8e443f36e373), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`9d4fc09`](https://github.com/mastra-ai/mastra/commit/9d4fc09b2ad55caa7738c7ceb3a905e454f74cdd), [`05c7abf`](https://github.com/mastra-ai/mastra/commit/05c7abfe105a015b7760c9bf33ff4419727502a0), [`0324ceb`](https://github.com/mastra-ai/mastra/commit/0324ceb8af9d16c12a531f90e575f6aab797ac81), [`d75ccf0`](https://github.com/mastra-ai/mastra/commit/d75ccf06dfd2582b916aa12624e3cd61b279edf1), [`0f9d227`](https://github.com/mastra-ai/mastra/commit/0f9d227890a98db33865abbea39daf407cd55ef7), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`de056a0`](https://github.com/mastra-ai/mastra/commit/de056a02cbb43f6aa0380ab2150ea404af9ec0dd), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`60c9cec`](https://github.com/mastra-ai/mastra/commit/60c9cec7048a79a87440f7840c383875bd710d93), [`c93532a`](https://github.com/mastra-ai/mastra/commit/c93532a340b80e4dd946d4c138d9381de5f70399), [`6cb1fcb`](https://github.com/mastra-ai/mastra/commit/6cb1fcbc8d0378ffed0d17784c96e68f30cb0272), [`aee4f00`](https://github.com/mastra-ai/mastra/commit/aee4f00e61e1a42e81a6d74ff149dbe69e32695a), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4), [`897995e`](https://github.com/mastra-ai/mastra/commit/897995e630d572fe2891e7ede817938cabb43251), [`0fed8f2`](https://github.com/mastra-ai/mastra/commit/0fed8f2aa84b167b3415ea6f8f70755775132c8d), [`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`87fd07f`](https://github.com/mastra-ai/mastra/commit/87fd07ff35387a38728967163460231b5d33ae3b), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`2685a78`](https://github.com/mastra-ai/mastra/commit/2685a78f224b8b04e20d4fab5ac1adb638190071), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11), [`239b5a4`](https://github.com/mastra-ai/mastra/commit/239b5a497aeae2e8b4d764f46217cfff2284788e), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
27
+ - @mastra/core@0.17.0
28
+
29
+ ## 0.14.0-alpha.2
30
+
31
+ ### Minor Changes
32
+
33
+ - Fully deprecated createRun (now throws an error) in favour of createRunAsync ([#7897](https://github.com/mastra-ai/mastra/pull/7897))
34
+
35
+ ### Patch Changes
36
+
37
+ - refactored handling of internal ai spans to be more intelligent ([#7876](https://github.com/mastra-ai/mastra/pull/7876))
38
+
39
+ - feat(inngest): add support for user-supplied functions in `serve` / `inngestServe` ([#7900](https://github.com/mastra-ai/mastra/pull/7900))
40
+
41
+ - Updated dependencies [[`fb84c21`](https://github.com/mastra-ai/mastra/commit/fb84c21859d09bdc8f158bd5412bdc4b5835a61c), [`9d4fc09`](https://github.com/mastra-ai/mastra/commit/9d4fc09b2ad55caa7738c7ceb3a905e454f74cdd), [`d75ccf0`](https://github.com/mastra-ai/mastra/commit/d75ccf06dfd2582b916aa12624e3cd61b279edf1), [`0fed8f2`](https://github.com/mastra-ai/mastra/commit/0fed8f2aa84b167b3415ea6f8f70755775132c8d), [`87fd07f`](https://github.com/mastra-ai/mastra/commit/87fd07ff35387a38728967163460231b5d33ae3b)]:
42
+ - @mastra/core@0.17.0-alpha.4
43
+
3
44
  ## 0.13.3-alpha.1
4
45
 
5
46
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -11,9 +11,13 @@ var hono = require('inngest/hono');
11
11
  var zod = require('zod');
12
12
 
13
13
  // src/index.ts
14
- function serve({ mastra, inngest }) {
14
+ function serve({
15
+ mastra,
16
+ inngest,
17
+ functions: userFunctions = []
18
+ }) {
15
19
  const wfs = mastra.getWorkflows();
16
- const functions = Array.from(
20
+ const workflowFunctions = Array.from(
17
21
  new Set(
18
22
  Object.values(wfs).flatMap((wf) => {
19
23
  if (wf instanceof InngestWorkflow) {
@@ -26,7 +30,7 @@ function serve({ mastra, inngest }) {
26
30
  );
27
31
  return hono.serve({
28
32
  client: inngest,
29
- functions
33
+ functions: [...workflowFunctions, ...userFunctions]
30
34
  });
31
35
  }
32
36
  var InngestRun = class extends workflows.Run {
@@ -290,23 +294,14 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
290
294
  }
291
295
  }
292
296
  }
293
- createRun(options) {
294
- const runIdToUse = options?.runId || crypto.randomUUID();
295
- const run = this.runs.get(runIdToUse) ?? new InngestRun(
296
- {
297
- workflowId: this.id,
298
- runId: runIdToUse,
299
- executionEngine: this.executionEngine,
300
- executionGraph: this.executionGraph,
301
- serializedStepGraph: this.serializedStepGraph,
302
- mastra: this.#mastra,
303
- retryConfig: this.retryConfig,
304
- cleanup: () => this.runs.delete(runIdToUse)
305
- },
306
- this.inngest
297
+ /**
298
+ * @deprecated Use createRunAsync() instead.
299
+ * @throws {Error} Always throws an error directing users to use createRunAsync()
300
+ */
301
+ createRun(_options) {
302
+ throw new Error(
303
+ "createRun() has been deprecated. Please use createRunAsync() instead.\n\nMigration guide:\n Before: const run = workflow.createRun();\n After: const run = await workflow.createRunAsync();\n\nNote: createRunAsync() is an async method, so make sure your calling function is async."
307
304
  );
308
- this.runs.set(runIdToUse, run);
309
- return run;
310
305
  }
311
306
  async createRunAsync(options) {
312
307
  const runIdToUse = options?.runId || crypto.randomUUID();
@@ -555,8 +550,8 @@ function init(inngest) {
555
550
  var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
556
551
  inngestStep;
557
552
  inngestAttempts;
558
- constructor(mastra, inngestStep, inngestAttempts = 0) {
559
- super({ mastra });
553
+ constructor(mastra, inngestStep, inngestAttempts = 0, options) {
554
+ super({ mastra, options });
560
555
  this.inngestStep = inngestStep;
561
556
  this.inngestAttempts = inngestAttempts;
562
557
  }
@@ -653,7 +648,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
653
648
  durationMs: duration,
654
649
  sleepType: fn ? "dynamic" : "fixed"
655
650
  },
656
- isInternal: tracingContext?.isInternal
651
+ tracingPolicy: this.options?.tracingPolicy
657
652
  });
658
653
  if (fn) {
659
654
  const stepCallId = crypto.randomUUID();
@@ -666,8 +661,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
666
661
  inputData: prevOutput,
667
662
  runCount: -1,
668
663
  tracingContext: {
669
- currentSpan: sleepSpan,
670
- isInternal: sleepSpan?.isInternal
664
+ currentSpan: sleepSpan
671
665
  },
672
666
  getInitData: () => stepResults?.input,
673
667
  getStepResult: (step) => {
@@ -740,7 +734,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
740
734
  durationMs: date ? Math.max(0, date.getTime() - Date.now()) : void 0,
741
735
  sleepType: fn ? "dynamic" : "fixed"
742
736
  },
743
- isInternal: tracingContext?.isInternal
737
+ tracingPolicy: this.options?.tracingPolicy
744
738
  });
745
739
  if (fn) {
746
740
  date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
@@ -753,8 +747,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
753
747
  inputData: prevOutput,
754
748
  runCount: -1,
755
749
  tracingContext: {
756
- currentSpan: sleepUntilSpan,
757
- isInternal: sleepUntilSpan?.isInternal
750
+ currentSpan: sleepUntilSpan
758
751
  },
759
752
  getInitData: () => stepResults?.input,
760
753
  getStepResult: (step) => {
@@ -843,7 +836,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
843
836
  attributes: {
844
837
  stepId: step.id
845
838
  },
846
- isInternal: tracingContext?.isInternal
839
+ tracingPolicy: this.options?.tracingPolicy
847
840
  });
848
841
  const startedAt = await this.inngestStep.run(
849
842
  `workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
@@ -1066,8 +1059,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1066
1059
  inputData: prevOutput,
1067
1060
  resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : void 0,
1068
1061
  tracingContext: {
1069
- currentSpan: stepAISpan,
1070
- isInternal: stepAISpan?.isInternal
1062
+ currentSpan: stepAISpan
1071
1063
  },
1072
1064
  getInitData: () => stepResults?.input,
1073
1065
  getStepResult: (step2) => {
@@ -1192,7 +1184,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1192
1184
  stepId: step.id,
1193
1185
  runtimeContext,
1194
1186
  disableScorers,
1195
- tracingContext: { currentSpan: stepAISpan, isInternal: true }
1187
+ tracingContext: { currentSpan: stepAISpan }
1196
1188
  });
1197
1189
  }
1198
1190
  });
@@ -1261,7 +1253,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1261
1253
  attributes: {
1262
1254
  conditionCount: entry.conditions.length
1263
1255
  },
1264
- isInternal: tracingContext?.isInternal
1256
+ tracingPolicy: this.options?.tracingPolicy
1265
1257
  });
1266
1258
  let execResults;
1267
1259
  const truthyIndexes = (await Promise.all(
@@ -1274,7 +1266,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1274
1266
  attributes: {
1275
1267
  conditionIndex: index
1276
1268
  },
1277
- isInternal: tracingContext?.isInternal
1269
+ tracingPolicy: this.options?.tracingPolicy
1278
1270
  });
1279
1271
  try {
1280
1272
  const result = await cond({
@@ -1285,8 +1277,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1285
1277
  runCount: -1,
1286
1278
  inputData: prevOutput,
1287
1279
  tracingContext: {
1288
- currentSpan: evalSpan,
1289
- isInternal: evalSpan?.isInternal
1280
+ currentSpan: evalSpan
1290
1281
  },
1291
1282
  getInitData: () => stepResults?.input,
1292
1283
  getStepResult: (step) => {
@@ -1374,8 +1365,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1374
1365
  writableStream,
1375
1366
  disableScorers,
1376
1367
  tracingContext: {
1377
- currentSpan: conditionalSpan,
1378
- isInternal: conditionalSpan?.isInternal
1368
+ currentSpan: conditionalSpan
1379
1369
  }
1380
1370
  })
1381
1371
  )