@mastra/inngest 0.15.1 → 0.16.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,31 @@
1
1
  # @mastra/inngest
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update peer dependencies to match core package version bump (0.20.2) ([#8617](https://github.com/mastra-ai/mastra/pull/8617))
8
+
9
+ ### Patch Changes
10
+
11
+ - Add shouldPersistSnapshot to control when to persist run snapshot ([#8617](https://github.com/mastra-ai/mastra/pull/8617))
12
+
13
+ - Updated dependencies [[`07eaf25`](https://github.com/mastra-ai/mastra/commit/07eaf25aada9e42235dbf905854de53da4d8121b), [`0d71771`](https://github.com/mastra-ai/mastra/commit/0d71771f5711164c79f8e80919bc84d6bffeb6bc), [`0d6e55e`](https://github.com/mastra-ai/mastra/commit/0d6e55ecc5a2e689cd4fc9c86525e0eb54d82372), [`68b1111`](https://github.com/mastra-ai/mastra/commit/68b11118a1303f93e9c0c157850c0751309304c5)]:
14
+ - @mastra/core@0.20.2
15
+
16
+ ## 0.16.0-alpha.0
17
+
18
+ ### Minor Changes
19
+
20
+ - Update peer dependencies to match core package version bump (0.20.2) ([#8617](https://github.com/mastra-ai/mastra/pull/8617))
21
+
22
+ ### Patch Changes
23
+
24
+ - Add shouldPersistSnapshot to control when to persist run snapshot ([#8617](https://github.com/mastra-ai/mastra/pull/8617))
25
+
26
+ - Updated dependencies [[`0d71771`](https://github.com/mastra-ai/mastra/commit/0d71771f5711164c79f8e80919bc84d6bffeb6bc), [`0d6e55e`](https://github.com/mastra-ai/mastra/commit/0d6e55ecc5a2e689cd4fc9c86525e0eb54d82372)]:
27
+ - @mastra/core@0.20.2-alpha.0
28
+
3
29
  ## 0.15.1
4
30
 
5
31
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -338,8 +338,12 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
338
338
  this.inngest
339
339
  );
340
340
  this.runs.set(runIdToUse, run);
341
+ const shouldPersistSnapshot = this.options.shouldPersistSnapshot({
342
+ workflowStatus: run.workflowRunStatus,
343
+ stepResults: {}
344
+ });
341
345
  const workflowSnapshotInStorage = await this.getWorkflowRunExecutionResult(runIdToUse, false);
342
- if (!workflowSnapshotInStorage) {
346
+ if (!workflowSnapshotInStorage && shouldPersistSnapshot) {
343
347
  await this.mastra?.getStorage()?.persistWorkflowSnapshot({
344
348
  workflowName: this.id,
345
349
  runId: runIdToUse,
@@ -405,7 +409,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
405
409
  once: (_event, _callback) => {
406
410
  }
407
411
  };
408
- const engine = new InngestExecutionEngine(this.#mastra, step, attempt);
412
+ const engine = new InngestExecutionEngine(this.#mastra, step, attempt, this.options);
409
413
  const result = await engine.execute({
410
414
  workflowId: this.id,
411
415
  runId,
@@ -1333,6 +1337,10 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1333
1337
  await this.inngestStep.run(
1334
1338
  `workflow.${workflowId}.run.${runId}.path.${JSON.stringify(executionContext.executionPath)}.stepUpdate`,
1335
1339
  async () => {
1340
+ const shouldPersistSnapshot = this.options.shouldPersistSnapshot({ stepResults, workflowStatus });
1341
+ if (!shouldPersistSnapshot) {
1342
+ return;
1343
+ }
1336
1344
  await this.mastra?.getStorage()?.persistWorkflowSnapshot({
1337
1345
  workflowName: workflowId,
1338
1346
  runId,