@mastra/inngest 0.10.5-alpha.0 → 0.10.5

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/inngest@0.10.5-alpha.0 build /home/runner/work/mastra/mastra/workflows/inngest
2
+ > @mastra/inngest@0.10.5-alpha.1 build /home/runner/work/mastra/mastra/workflows/inngest
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 8463ms
9
+ TSC ⚡️ Build success in 8101ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/workflows/inngest/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/workflows/inngest/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 6163ms
16
+ DTS ⚡️ Build success in 6203ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 25.94 KB
21
- ESM ⚡️ Build success in 270ms
22
- CJS dist/index.cjs 26.13 KB
23
- CJS ⚡️ Build success in 271ms
20
+ CJS dist/index.cjs 26.84 KB
21
+ CJS ⚡️ Build success in 304ms
22
+ ESM dist/index.js 26.65 KB
23
+ ESM ⚡️ Build success in 305ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @mastra/inngest
2
2
 
3
+ ## 0.10.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 63f6b7d: dependencies updates:
8
+ - Updated dependency [`inngest@^3.39.1` ↗︎](https://www.npmjs.com/package/inngest/v/3.39.1) (from `^3.35.1`, in `dependencies`)
9
+ - Updated dependency [`zod@^3.25.57` ↗︎](https://www.npmjs.com/package/zod/v/3.25.57) (from `^3.25.56`, in `dependencies`)
10
+ - ee9af57: Add api for polling run execution result and get run by id
11
+ - Updated dependencies [63f6b7d]
12
+ - Updated dependencies [12a95fc]
13
+ - Updated dependencies [4b0f8a6]
14
+ - Updated dependencies [51264a5]
15
+ - Updated dependencies [8e6f677]
16
+ - Updated dependencies [d70c420]
17
+ - Updated dependencies [ee9af57]
18
+ - Updated dependencies [36f1c36]
19
+ - Updated dependencies [2a16996]
20
+ - Updated dependencies [10d352e]
21
+ - Updated dependencies [9589624]
22
+ - Updated dependencies [53d3c37]
23
+ - Updated dependencies [751c894]
24
+ - Updated dependencies [577ce3a]
25
+ - Updated dependencies [9260b3a]
26
+ - @mastra/core@0.10.6
27
+
28
+ ## 0.10.5-alpha.1
29
+
30
+ ### Patch Changes
31
+
32
+ - ee9af57: Add api for polling run execution result and get run by id
33
+ - Updated dependencies [ee9af57]
34
+ - Updated dependencies [751c894]
35
+ - Updated dependencies [577ce3a]
36
+ - Updated dependencies [9260b3a]
37
+ - @mastra/core@0.10.6-alpha.1
38
+
3
39
  ## 0.10.5-alpha.0
4
40
 
5
41
  ### Patch Changes
@@ -21,6 +21,7 @@ import type { StepFlowEntry } from '@mastra/core/workflows';
21
21
  import type { StepResult } from '@mastra/core/workflows';
22
22
  import { Tool } from '@mastra/core';
23
23
  import type { ToolExecutionContext } from '@mastra/core';
24
+ import type { WatchEvent } from '@mastra/core/workflows';
24
25
  import { Workflow } from '@mastra/core/workflows';
25
26
  import type { WorkflowConfig } from '@mastra/core/workflows';
26
27
  import type { WorkflowResult } from '@mastra/core/workflows';
@@ -196,6 +197,7 @@ export declare class InngestWorkflow<TEngineType = InngestEngineType, TSteps ext
196
197
  resourceId?: string;
197
198
  }): Promise<WorkflowRuns>;
198
199
  getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
200
+ getWorkflowRunExecutionResult(runId: string): Promise<WatchEvent['payload']['workflowState'] | null>;
199
201
  __registerMastra(mastra: Mastra): void;
200
202
  createRun(options?: {
201
203
  runId?: string;
@@ -21,6 +21,7 @@ import type { StepFlowEntry } from '@mastra/core/workflows';
21
21
  import type { StepResult } from '@mastra/core/workflows';
22
22
  import { Tool } from '@mastra/core';
23
23
  import type { ToolExecutionContext } from '@mastra/core';
24
+ import type { WatchEvent } from '@mastra/core/workflows';
24
25
  import { Workflow } from '@mastra/core/workflows';
25
26
  import type { WorkflowConfig } from '@mastra/core/workflows';
26
27
  import type { WorkflowResult } from '@mastra/core/workflows';
@@ -196,6 +197,7 @@ export declare class InngestWorkflow<TEngineType = InngestEngineType, TSteps ext
196
197
  resourceId?: string;
197
198
  }): Promise<WorkflowRuns>;
198
199
  getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
200
+ getWorkflowRunExecutionResult(runId: string): Promise<WatchEvent['payload']['workflowState'] | null>;
199
201
  __registerMastra(mastra: Mastra): void;
200
202
  createRun(options?: {
201
203
  runId?: string;
package/dist/index.cjs CHANGED
@@ -165,11 +165,32 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
165
165
  const storage = this.#mastra?.getStorage();
166
166
  if (!storage) {
167
167
  this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
168
- return null;
168
+ return this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null;
169
169
  }
170
170
  const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
171
171
  return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
172
172
  }
173
+ async getWorkflowRunExecutionResult(runId) {
174
+ const storage = this.#mastra?.getStorage();
175
+ if (!storage) {
176
+ this.logger.debug("Cannot get workflow run execution result. Mastra storage is not initialized");
177
+ return null;
178
+ }
179
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
180
+ if (!run?.snapshot) {
181
+ return null;
182
+ }
183
+ if (typeof run.snapshot === "string") {
184
+ return null;
185
+ }
186
+ return {
187
+ status: run.snapshot.status,
188
+ result: run.snapshot.result,
189
+ error: run.snapshot.error,
190
+ payload: run.snapshot.context?.input,
191
+ steps: run.snapshot.context
192
+ };
193
+ }
173
194
  __registerMastra(mastra) {
174
195
  this.#mastra = mastra;
175
196
  this.executionEngine.__registerMastra(mastra);
package/dist/index.js CHANGED
@@ -163,11 +163,32 @@ var InngestWorkflow = class _InngestWorkflow extends Workflow {
163
163
  const storage = this.#mastra?.getStorage();
164
164
  if (!storage) {
165
165
  this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
166
- return null;
166
+ return this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null;
167
167
  }
168
168
  const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
169
169
  return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
170
170
  }
171
+ async getWorkflowRunExecutionResult(runId) {
172
+ const storage = this.#mastra?.getStorage();
173
+ if (!storage) {
174
+ this.logger.debug("Cannot get workflow run execution result. Mastra storage is not initialized");
175
+ return null;
176
+ }
177
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
178
+ if (!run?.snapshot) {
179
+ return null;
180
+ }
181
+ if (typeof run.snapshot === "string") {
182
+ return null;
183
+ }
184
+ return {
185
+ status: run.snapshot.status,
186
+ result: run.snapshot.result,
187
+ error: run.snapshot.error,
188
+ payload: run.snapshot.context?.input,
189
+ steps: run.snapshot.context
190
+ };
191
+ }
171
192
  __registerMastra(mastra) {
172
193
  this.#mastra = mastra;
173
194
  this.executionEngine.__registerMastra(mastra);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/inngest",
3
- "version": "0.10.5-alpha.0",
3
+ "version": "0.10.5",
4
4
  "description": "Mastra Inngest integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -37,10 +37,10 @@
37
37
  "tsup": "^8.5.0",
38
38
  "typescript": "^5.8.3",
39
39
  "vitest": "^2.1.9",
40
- "@internal/lint": "0.0.12",
41
- "@mastra/core": "0.10.6-alpha.0",
42
- "@mastra/libsql": "0.10.3-alpha.0",
43
- "@mastra/deployer": "0.10.6-alpha.0"
40
+ "@internal/lint": "0.0.13",
41
+ "@mastra/core": "0.10.6",
42
+ "@mastra/libsql": "0.10.3",
43
+ "@mastra/deployer": "0.10.6"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@mastra/core": "^0.10.2-alpha.0"
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ import type {
16
16
  WorkflowResult,
17
17
  SerializedStepFlowEntry,
18
18
  StepFailure,
19
+ WatchEvent,
19
20
  } from '@mastra/core/workflows';
20
21
  import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
21
22
  import type { Span } from '@opentelemetry/api';
@@ -247,7 +248,10 @@ export class InngestWorkflow<
247
248
  const storage = this.#mastra?.getStorage();
248
249
  if (!storage) {
249
250
  this.logger.debug('Cannot get workflow runs. Mastra engine is not initialized');
250
- return null;
251
+ //returning in memory run if no storage is initialized
252
+ return this.runs.get(runId)
253
+ ? ({ ...this.runs.get(runId), workflowName: this.id } as unknown as WorkflowRun)
254
+ : null;
251
255
  }
252
256
  const run = (await storage.getWorkflowRunById({ runId, workflowName: this.id })) as unknown as WorkflowRun;
253
257
 
@@ -257,6 +261,32 @@ export class InngestWorkflow<
257
261
  );
258
262
  }
259
263
 
264
+ async getWorkflowRunExecutionResult(runId: string): Promise<WatchEvent['payload']['workflowState'] | null> {
265
+ const storage = this.#mastra?.getStorage();
266
+ if (!storage) {
267
+ this.logger.debug('Cannot get workflow run execution result. Mastra storage is not initialized');
268
+ return null;
269
+ }
270
+
271
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
272
+
273
+ if (!run?.snapshot) {
274
+ return null;
275
+ }
276
+
277
+ if (typeof run.snapshot === 'string') {
278
+ return null;
279
+ }
280
+
281
+ return {
282
+ status: run.snapshot.status,
283
+ result: run.snapshot.result,
284
+ error: run.snapshot.error,
285
+ payload: run.snapshot.context?.input,
286
+ steps: run.snapshot.context as any,
287
+ };
288
+ }
289
+
260
290
  __registerMastra(mastra: Mastra) {
261
291
  this.#mastra = mastra;
262
292
  this.executionEngine.__registerMastra(mastra);