@mastra/inngest 0.0.0-vnext-inngest-20250508122351 → 0.0.0-vnext-inngest-20250508131921

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,6 +1,6 @@
1
1
  # @mastra/inngest
2
2
 
3
- ## 0.0.0-vnext-inngest-20250508122351
3
+ ## 0.0.0-vnext-inngest-20250508131921
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -9,4 +9,4 @@
9
9
  - Updated dependencies [b5d2de0]
10
10
  - Updated dependencies [644f8ad]
11
11
  - Updated dependencies [70dbf51]
12
- - @mastra/core@0.0.0-vnext-inngest-20250508122351
12
+ - @mastra/core@0.0.0-vnext-inngest-20250508131921
@@ -22,6 +22,8 @@ import type { Span } from '@opentelemetry/api';
22
22
  import type { StepFlowEntry } from '@mastra/core/workflows/vNext';
23
23
  import type { StepResult } from '@mastra/core/workflows/vNext';
24
24
  import type { WorkflowResult } from '@mastra/core/workflows/vNext';
25
+ import type { WorkflowRun } from '@mastra/core';
26
+ import { WorkflowRuns } from '@mastra/core';
25
27
  import type { z } from 'zod';
26
28
 
27
29
  declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends NewStep<string, any, any, any, any>[] = NewStep<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
@@ -147,6 +149,14 @@ export declare class InngestWorkflow<TSteps extends NewStep<string, any, any>[]
147
149
  inngest: Inngest;
148
150
  private function;
149
151
  constructor(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
152
+ getWorkflowRuns(args?: {
153
+ fromDate?: Date;
154
+ toDate?: Date;
155
+ limit?: number;
156
+ offset?: number;
157
+ resourceId?: string;
158
+ }): Promise<WorkflowRuns>;
159
+ getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
150
160
  __registerMastra(mastra: Mastra): void;
151
161
  createRun(options?: {
152
162
  runId?: string;
@@ -22,6 +22,8 @@ import type { Span } from '@opentelemetry/api';
22
22
  import type { StepFlowEntry } from '@mastra/core/workflows/vNext';
23
23
  import type { StepResult } from '@mastra/core/workflows/vNext';
24
24
  import type { WorkflowResult } from '@mastra/core/workflows/vNext';
25
+ import type { WorkflowRun } from '@mastra/core';
26
+ import { WorkflowRuns } from '@mastra/core';
25
27
  import type { z } from 'zod';
26
28
 
27
29
  declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends NewStep<string, any, any, any, any>[] = NewStep<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
@@ -147,6 +149,14 @@ export declare class InngestWorkflow<TSteps extends NewStep<string, any, any>[]
147
149
  inngest: Inngest;
148
150
  private function;
149
151
  constructor(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
152
+ getWorkflowRuns(args?: {
153
+ fromDate?: Date;
154
+ toDate?: Date;
155
+ limit?: number;
156
+ offset?: number;
157
+ resourceId?: string;
158
+ }): Promise<WorkflowRuns>;
159
+ getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
150
160
  __registerMastra(mastra: Mastra): void;
151
161
  createRun(options?: {
152
162
  runId?: string;
package/dist/index.cjs CHANGED
@@ -146,6 +146,23 @@ var InngestWorkflow = class _InngestWorkflow extends vNext.NewWorkflow {
146
146
  this.#mastra = params.mastra;
147
147
  this.inngest = inngest;
148
148
  }
149
+ async getWorkflowRuns(args) {
150
+ const storage = this.#mastra?.getStorage();
151
+ if (!storage) {
152
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
153
+ return { runs: [], total: 0 };
154
+ }
155
+ return storage.getWorkflowRuns({ workflowName: this.id, ...args ?? {} });
156
+ }
157
+ async getWorkflowRunById(runId) {
158
+ const storage = this.#mastra?.getStorage();
159
+ if (!storage) {
160
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
161
+ return null;
162
+ }
163
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
164
+ return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
165
+ }
149
166
  __registerMastra(mastra) {
150
167
  this.#mastra = mastra;
151
168
  this.executionEngine.__registerMastra(mastra);
package/dist/index.js CHANGED
@@ -144,6 +144,23 @@ var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
144
144
  this.#mastra = params.mastra;
145
145
  this.inngest = inngest;
146
146
  }
147
+ async getWorkflowRuns(args) {
148
+ const storage = this.#mastra?.getStorage();
149
+ if (!storage) {
150
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
151
+ return { runs: [], total: 0 };
152
+ }
153
+ return storage.getWorkflowRuns({ workflowName: this.id, ...args ?? {} });
154
+ }
155
+ async getWorkflowRunById(runId) {
156
+ const storage = this.#mastra?.getStorage();
157
+ if (!storage) {
158
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
159
+ return null;
160
+ }
161
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
162
+ return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
163
+ }
147
164
  __registerMastra(mastra) {
148
165
  this.#mastra = mastra;
149
166
  this.executionEngine.__registerMastra(mastra);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/inngest",
3
- "version": "0.0.0-vnext-inngest-20250508122351",
3
+ "version": "0.0.0-vnext-inngest-20250508131921",
4
4
  "description": "Mastra Inngest integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "inngest": "^3.35.1",
24
24
  "zod": "^3.24.2",
25
25
  "@opentelemetry/api": "^1.9.0",
26
- "@mastra/core": "0.0.0-vnext-inngest-20250508122351"
26
+ "@mastra/core": "0.0.0-vnext-inngest-20250508131921"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@ai-sdk/openai": "^1.2.1",
@@ -38,8 +38,8 @@
38
38
  "tsup": "^8.4.0",
39
39
  "typescript": "^5.8.2",
40
40
  "vitest": "^2.1.9",
41
- "@internal/lint": "0.0.0-vnext-inngest-20250508122351",
42
- "@mastra/deployer": "0.0.0-vnext-inngest-20250508122351"
41
+ "@internal/lint": "0.0.0-vnext-inngest-20250508131921",
42
+ "@mastra/deployer": "0.0.0-vnext-inngest-20250508131921"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { subscribe } from '@inngest/realtime';
3
- import type { Mastra } from '@mastra/core';
3
+ import type { Mastra, WorkflowRun } from '@mastra/core';
4
4
  import { RuntimeContext } from '@mastra/core/di';
5
5
  import { NewWorkflow, createStep, Run, DefaultExecutionEngine, cloneStep } from '@mastra/core/workflows/vNext';
6
6
  import type {
@@ -213,6 +213,36 @@ export class InngestWorkflow<
213
213
  this.inngest = inngest;
214
214
  }
215
215
 
216
+ async getWorkflowRuns(args?: {
217
+ fromDate?: Date;
218
+ toDate?: Date;
219
+ limit?: number;
220
+ offset?: number;
221
+ resourceId?: string;
222
+ }) {
223
+ const storage = this.#mastra?.getStorage();
224
+ if (!storage) {
225
+ this.logger.debug('Cannot get workflow runs. Mastra engine is not initialized');
226
+ return { runs: [], total: 0 };
227
+ }
228
+
229
+ return storage.getWorkflowRuns({ workflowName: this.id, ...(args ?? {}) });
230
+ }
231
+
232
+ async getWorkflowRunById(runId: string): Promise<WorkflowRun | null> {
233
+ const storage = this.#mastra?.getStorage();
234
+ if (!storage) {
235
+ this.logger.debug('Cannot get workflow runs. Mastra engine is not initialized');
236
+ return null;
237
+ }
238
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
239
+
240
+ return (
241
+ run ??
242
+ (this.runs.get(runId) ? ({ ...this.runs.get(runId), workflowName: this.id } as unknown as WorkflowRun) : null)
243
+ );
244
+ }
245
+
216
246
  __registerMastra(mastra: Mastra) {
217
247
  this.#mastra = mastra;
218
248
  this.executionEngine.__registerMastra(mastra);