Comparing version 2.3.0 to 2.4.0
# inngest | ||
## 2.4.0 | ||
### Minor Changes | ||
- 6cb6719: Allow filtering of events within triggers | ||
### Patch Changes | ||
- 55c889c: Expose raw error message if status is unknown | ||
## 2.3.0 | ||
@@ -4,0 +14,0 @@ |
@@ -197,34 +197,3 @@ import { type SendEventPayload } from "../helpers/types"; | ||
onFunctionRun(arg: Readonly<import("type-fest").Simplify<Omit<Readonly<{ | ||
ctx: Record<string, unknown> & Readonly<import("../types").BaseContext<ClientOptions, string, Record<string, (...args: unknown[]) => unknown>>>; /** | ||
* Pass in an object of functions that will be wrapped in Inngest | ||
* tooling and passes to your handler. This wrapping ensures that each | ||
* function is automatically separated and retried. | ||
* | ||
* @example | ||
* | ||
* Both examples behave the same; it's preference as to which you | ||
* prefer. | ||
* | ||
* ```ts | ||
* import { userDb } from "./db"; | ||
* | ||
* // Specify `fns` and be able to use them in your Inngest function | ||
* inngest.createFunction( | ||
* { name: "Create user from PR", fns: { ...userDb } }, | ||
* { event: "github/pull_request" }, | ||
* async ({ fns: { createUser } }) => { | ||
* await createUser("Alice"); | ||
* } | ||
* ); | ||
* | ||
* // Or always use `run()` to run inline steps and use them directly | ||
* inngest.createFunction( | ||
* { name: "Create user from PR" }, | ||
* { event: "github/pull_request" }, | ||
* async ({ step: { run } }) => { | ||
* await run("createUser", () => userDb.createUser("Alice")); | ||
* } | ||
* ); | ||
* ``` | ||
*/ | ||
ctx: Record<string, unknown> & Readonly<import("../types").BaseContext<ClientOptions, string, Record<string, (...args: unknown[]) => unknown>>>; | ||
steps: Readonly<Omit<{ | ||
@@ -231,0 +200,0 @@ data?: any; |
@@ -234,3 +234,16 @@ "use strict"; | ||
const sanitizedOpts = (typeof nameOrOpts === "string" ? { name: nameOrOpts } : nameOrOpts); | ||
return new InngestFunction_1.InngestFunction(this, sanitizedOpts, typeof trigger === "string" ? { event: trigger } : trigger, | ||
let sanitizedTrigger; | ||
if (typeof trigger === "string") { | ||
sanitizedTrigger = { event: trigger }; | ||
} | ||
else if (trigger.event) { | ||
sanitizedTrigger = { | ||
event: trigger.event, | ||
expression: trigger.if, | ||
}; | ||
} | ||
else { | ||
sanitizedTrigger = trigger; | ||
} | ||
return new InngestFunction_1.InngestFunction(this, sanitizedOpts, sanitizedTrigger, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any | ||
@@ -273,2 +286,5 @@ handler); | ||
break; | ||
default: | ||
errorMessage = await response.text(); | ||
break; | ||
} | ||
@@ -275,0 +291,0 @@ return new Error(`Inngest API Error: ${response.status} ${errorMessage}`); |
{ | ||
"name": "inngest", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "Official SDK for Inngest.com", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -515,2 +515,3 @@ import { z } from "zod"; | ||
event: T; | ||
if?: string; | ||
} | { | ||
@@ -517,0 +518,0 @@ cron: string; |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.3.0"; | ||
export declare const version = "2.4.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = "2.3.0"; | ||
exports.version = "2.4.0"; | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
826871
8833