@mastra/inngest 0.13.3-alpha.0 → 0.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @mastra/inngest
2
2
 
3
+ ## 0.13.3-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#7865](https://github.com/mastra-ai/mastra/pull/7865))
8
+ - Updated dependency [`inngest@^3.40.3` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.3) (from `^3.40.2`, in `dependencies`)
9
+
10
+ - Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
11
+
12
+ - fix(workflows/inngest): handle Date serialization in sleepUntil execution ([#7863](https://github.com/mastra-ai/mastra/pull/7863))
13
+
14
+ - add resourceId support to inngest workflow execution engine for workflow snapshot persistance ([#7792](https://github.com/mastra-ai/mastra/pull/7792))
15
+
16
+ - Updated dependencies [[`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
17
+ - @mastra/core@0.17.0-alpha.3
18
+
3
19
  ## 0.13.3-alpha.0
4
20
 
5
21
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -54,7 +54,6 @@ var InngestRun = class extends workflows.Run {
54
54
  await new Promise((resolve) => setTimeout(resolve, 1e3));
55
55
  runs = await this.getRuns(eventId);
56
56
  if (runs?.[0]?.status === "Failed") {
57
- console.log("run", runs?.[0]);
58
57
  throw new Error(`Function run ${runs?.[0]?.status}`);
59
58
  } else if (runs?.[0]?.status === "Cancelled") {
60
59
  const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
@@ -87,6 +86,7 @@ var InngestRun = class extends workflows.Run {
87
86
  await this.#mastra?.storage?.persistWorkflowSnapshot({
88
87
  workflowName: this.workflowId,
89
88
  runId: this.runId,
89
+ resourceId: this.resourceId,
90
90
  snapshot: {
91
91
  ...snapshot,
92
92
  status: "canceled"
@@ -100,6 +100,7 @@ var InngestRun = class extends workflows.Run {
100
100
  await this.#mastra.getStorage()?.persistWorkflowSnapshot({
101
101
  workflowName: this.workflowId,
102
102
  runId: this.runId,
103
+ resourceId: this.resourceId,
103
104
  snapshot: {
104
105
  runId: this.runId,
105
106
  serializedStepGraph: this.serializedStepGraph,
@@ -116,7 +117,8 @@ var InngestRun = class extends workflows.Run {
116
117
  name: `workflow.${this.workflowId}`,
117
118
  data: {
118
119
  inputData,
119
- runId: this.runId
120
+ runId: this.runId,
121
+ resourceId: this.resourceId
120
122
  }
121
123
  });
122
124
  const eventId = eventOutput.ids[0];
@@ -312,6 +314,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
312
314
  {
313
315
  workflowId: this.id,
314
316
  runId: runIdToUse,
317
+ resourceId: options?.resourceId,
315
318
  executionEngine: this.executionEngine,
316
319
  executionGraph: this.executionGraph,
317
320
  serializedStepGraph: this.serializedStepGraph,
@@ -327,6 +330,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
327
330
  await this.mastra?.getStorage()?.persistWorkflowSnapshot({
328
331
  workflowName: this.id,
329
332
  runId: runIdToUse,
333
+ resourceId: options?.resourceId,
330
334
  snapshot: {
331
335
  runId: runIdToUse,
332
336
  status: "pending",
@@ -360,7 +364,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
360
364
  },
361
365
  { event: `workflow.${this.id}` },
362
366
  async ({ event, step, attempt, publish }) => {
363
- let { inputData, runId, resume } = event.data;
367
+ let { inputData, runId, resourceId, resume } = event.data;
364
368
  if (!runId) {
365
369
  runId = await step.run(`workflow.${this.id}.runIdGen`, async () => {
366
370
  return crypto.randomUUID();
@@ -392,6 +396,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
392
396
  const result = await engine.execute({
393
397
  workflowId: this.id,
394
398
  runId,
399
+ resourceId,
395
400
  graph: this.executionGraph,
396
401
  serializedStepGraph: this.serializedStepGraph,
397
402
  input: inputData,
@@ -439,8 +444,6 @@ function createStep(params) {
439
444
  // @ts-ignore
440
445
  inputSchema: zod.z.object({
441
446
  prompt: zod.z.string()
442
- // resourceId: z.string().optional(),
443
- // threadId: z.string().optional(),
444
447
  }),
445
448
  // @ts-ignore
446
449
  outputSchema: zod.z.object({
@@ -457,8 +460,6 @@ function createStep(params) {
457
460
  args: inputData
458
461
  };
459
462
  const { fullStream } = await params.stream(inputData.prompt, {
460
- // resourceId: inputData.resourceId,
461
- // threadId: inputData.threadId,
462
463
  runtimeContext,
463
464
  tracingContext,
464
465
  onFinish: (result) => {
@@ -790,6 +791,9 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
790
791
  )
791
792
  });
792
793
  });
794
+ if (date && !(date instanceof Date)) {
795
+ date = new Date(date);
796
+ }
793
797
  const time = !date ? 0 : date.getTime() - Date.now();
794
798
  sleepUntilSpan?.update({
795
799
  attributes: {
@@ -1201,6 +1205,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1201
1205
  workflowId,
1202
1206
  runId,
1203
1207
  stepResults,
1208
+ resourceId,
1204
1209
  executionContext,
1205
1210
  serializedStepGraph,
1206
1211
  workflowStatus,
@@ -1213,6 +1218,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1213
1218
  await this.mastra?.getStorage()?.persistWorkflowSnapshot({
1214
1219
  workflowName: workflowId,
1215
1220
  runId,
1221
+ resourceId,
1216
1222
  snapshot: {
1217
1223
  runId,
1218
1224
  value: {},