Comparing version 2.4.2-pr-294.5 to 2.4.2-pr-294.6
# inngest | ||
## 2.5.1 | ||
### Patch Changes | ||
- [#302](https://github.com/inngest/inngest-js/pull/302) [`5b2bfac`](https://github.com/inngest/inngest-js/commit/5b2bfac61f3b3f4ecbfdedca3e3c18be1393eb88) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Remove `preinstall` script from `inngest` package causing errors when consuming the package | ||
## 2.5.0 | ||
@@ -4,0 +10,0 @@ |
@@ -135,3 +135,3 @@ import { type ExclusiveKeys, type SendEventPayload } from "../helpers/types"; | ||
send<Payload extends SendEventPayload<EventsFromOpts<TOpts>>>(payload: Payload): Promise<void>; | ||
createFunction<TFns extends Record<string, unknown>, TMiddleware extends MiddlewareStack, TTrigger extends TriggerOptions<keyof EventsFromOpts<TOpts> & string>, TShimmedFns extends Record<string, (...args: any[]) => any> = ShimmedFns<TFns>, TTriggerName extends keyof EventsFromOpts<TOpts> & string = EventNameFromTrigger<EventsFromOpts<TOpts>, TTrigger>>(nameOrOpts: string | ExclusiveKeys<Omit<FunctionOptions<EventsFromOpts<TOpts>, TTriggerName>, "fns" | "onFailure" | "middleware"> & { | ||
createFunction<TFns extends Record<string, unknown>, TMiddleware extends MiddlewareStack, TTrigger extends TriggerOptions<keyof EventsFromOpts<TOpts> & string>, TShimmedFns extends Record<string, (...args: any[]) => any> = ShimmedFns<TFns>, TTriggerName extends keyof EventsFromOpts<TOpts> & string = EventNameFromTrigger<EventsFromOpts<TOpts>, TTrigger>>(options: ExclusiveKeys<Omit<FunctionOptions<EventsFromOpts<TOpts>, TTriggerName>, "fns" | "onFailure" | "middleware"> & { | ||
/** | ||
@@ -138,0 +138,0 @@ * Pass in an object of functions that will be wrapped in Inngest |
@@ -233,9 +233,6 @@ "use strict"; | ||
} | ||
createFunction(nameOrOpts, trigger, handler) { | ||
const sanitizedOpts = (typeof nameOrOpts === "string" ? { name: nameOrOpts } : nameOrOpts); | ||
createFunction(options, trigger, handler) { | ||
const sanitizedOpts = options; | ||
let sanitizedTrigger; | ||
if (typeof trigger === "string") { | ||
sanitizedTrigger = { event: trigger }; | ||
} | ||
else if (trigger.event) { | ||
if (trigger.event) { | ||
sanitizedTrigger = { | ||
@@ -242,0 +239,0 @@ event: trigger.event, |
@@ -102,3 +102,3 @@ import { type Simplify } from "type-fest"; | ||
}; | ||
interface MemoizedOp extends IncomingOp { | ||
export interface MemoizedOp extends IncomingOp { | ||
fulfilled?: boolean; | ||
@@ -105,0 +105,0 @@ } |
@@ -41,3 +41,3 @@ import { type ClientOptions, type EventNameFromTrigger, type FunctionOptions, type FunctionTrigger, type Handler } from "../types"; | ||
*/ | ||
get name(): string; | ||
get name(): string | undefined; | ||
/** | ||
@@ -44,0 +44,0 @@ * Retrieve the Inngest config for this function. |
@@ -24,3 +24,3 @@ "use strict"; | ||
}; | ||
var _InngestFunction_instances, _InngestFunction_client, _InngestFunction_generateId; | ||
var _InngestFunction_client; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -53,3 +53,2 @@ exports.InngestFunction = void 0; | ||
opts, trigger, fn) { | ||
_InngestFunction_instances.add(this); | ||
_InngestFunction_client.set(this, void 0); | ||
@@ -67,3 +66,3 @@ __classPrivateFieldSet(this, _InngestFunction_client, client, "f"); | ||
id(prefix) { | ||
return this.opts.id || __classPrivateFieldGet(this, _InngestFunction_instances, "m", _InngestFunction_generateId).call(this, prefix); | ||
return [prefix, this.opts.id].filter(Boolean).join("-"); | ||
} | ||
@@ -86,2 +85,3 @@ /** | ||
baseUrl, appPrefix) { | ||
var _a; | ||
const fnId = this.id(appPrefix); | ||
@@ -91,3 +91,3 @@ const stepUrl = new URL(baseUrl.href); | ||
stepUrl.searchParams.set(consts_1.queryKeys.StepId, InngestFunction.stepId); | ||
const _a = this.opts, { retries: attempts, cancelOn, fns: _ } = _a, opts = __rest(_a, ["retries", "cancelOn", "fns"]); | ||
const _b = this.opts, { retries: attempts, cancelOn, fns: _ } = _b, opts = __rest(_b, ["retries", "cancelOn", "fns"]); | ||
/** | ||
@@ -130,3 +130,3 @@ * Convert retries into the format required when defining function | ||
const id = `${fn.id}${InngestFunction.failureSuffix}`; | ||
const name = `${fn.name} (failure)`; | ||
const name = `${(_a = fn.name) !== null && _a !== void 0 ? _a : fn.id} (failure)`; | ||
const failureStepUrl = new URL(stepUrl.href); | ||
@@ -158,5 +158,3 @@ failureStepUrl.searchParams.set(consts_1.queryKeys.FnId, id); | ||
} | ||
_InngestFunction_client = new WeakMap(), _InngestFunction_instances = new WeakSet(), _InngestFunction_generateId = function _InngestFunction_generateId(prefix) { | ||
return (0, strings_1.slugify)([prefix || "", this.opts.name].join("-")); | ||
}; | ||
_InngestFunction_client = new WeakMap(); | ||
InngestFunction.stepId = "step"; | ||
@@ -163,0 +161,0 @@ InngestFunction.failureSuffix = "-failure"; |
{ | ||
"name": "inngest", | ||
"version": "2.4.2-pr-294.5", | ||
"version": "2.4.2-pr-294.6", | ||
"description": "Official SDK for Inngest.com", | ||
@@ -11,3 +11,2 @@ "main": "./index.js", | ||
"scripts": { | ||
"preinstall": "npx only-allow pnpm", | ||
"prebuild": "pnpm run pb:version", | ||
@@ -17,3 +16,3 @@ "pb:version": "genversion --semi --double --es6 ./src/version.ts", | ||
"test": "jest --silent --logHeapUsage --maxWorkers=8 --coverage --ci", | ||
"test:examples": "jest --logHeapUsage --maxWorkers=8 --testMatch \"**/examples/**/*.test.ts\" --ci --verbose", | ||
"test:examples": "jest --logHeapUsage --maxWorkers=8 --testMatch \"**/test/functions/**/*.test.ts\" --ci --verbose", | ||
"test:types": "tsc --noEmit --project tsconfig.types.json --listFiles", | ||
@@ -20,0 +19,0 @@ "clean": "rm -rf ./dist", |
@@ -536,3 +536,3 @@ import { z } from "zod"; | ||
*/ | ||
export type TriggerOptions<T extends string> = T | StrictUnion<{ | ||
export type TriggerOptions<T extends string> = StrictUnion<{ | ||
event: T; | ||
@@ -550,25 +550,14 @@ if?: string; | ||
/** | ||
* An optional unique ID used to identify the function. This is used | ||
* internally for versioning and referring to your function, so should not | ||
* change between deployments. | ||
* An unique ID used to identify the function. This is used internally for | ||
* versioning and referring to your function, so should not change between | ||
* deployments. | ||
* | ||
* By default, this is a slugified version of the given `name`, e.g. | ||
* `"My FN :)"` would be slugified to `"my-fn"`. | ||
* | ||
* If you are not specifying an ID and get a warning about duplicate | ||
* functions, make sure to explicitly set an ID for the duplicate or change | ||
* the name. | ||
* If you'd like to set a prettier name for your function, use the `name` | ||
* option. | ||
*/ | ||
id?: string; | ||
id: string; | ||
/** | ||
* A name for the function as it will appear in the Inngest Cloud UI. | ||
* | ||
* This is used to create a slugified ID for the function too, e.g. | ||
* `"My FN :)"` would create a slugified ID of `"my-fn"`. | ||
* | ||
* If you are not specifying an ID and get a warning about duplicate | ||
* functions, make sure to explicitly set an ID for the duplicate or change | ||
* the name. | ||
*/ | ||
name: string; | ||
name?: string; | ||
/** | ||
@@ -791,3 +780,3 @@ * Concurrency specifies a limit on the total number of concurrent steps that | ||
export interface FunctionConfig { | ||
name: string; | ||
name?: string; | ||
id: string; | ||
@@ -794,0 +783,0 @@ triggers: FunctionTrigger[]; |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.4.2-pr-294.5"; | ||
export declare const version = "2.4.2-pr-294.6"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = "2.4.2-pr-294.5"; | ||
exports.version = "2.4.2-pr-294.6"; | ||
//# 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 not supported yet
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
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
0
508953
7761