Comparing version 1.8.1 to 1.8.2
# inngest | ||
## 1.8.2 | ||
### Patch Changes | ||
- 5462bdd: Ensure Inngest client's env object is used within serve() | ||
- 0b0c0ad: Add consistent type imports for slightly better tree-shaking | ||
## 1.8.1 | ||
@@ -4,0 +11,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import type { PartialK, SendEventPayload, SingleOrArray } from "../helpers/types"; | ||
import type { ClientOptions, EventNameFromTrigger, EventPayload, FailureEventArgs, FunctionOptions, Handler, ShimmedFns, TriggerOptions } from "../types"; | ||
import { type PartialK, type SendEventPayload, type SingleOrArray } from "../helpers/types"; | ||
import { type ClientOptions, type EventNameFromTrigger, type EventPayload, type FailureEventArgs, type FunctionOptions, type Handler, type ShimmedFns, type TriggerOptions } from "../types"; | ||
import { InngestFunction } from "./InngestFunction"; | ||
@@ -4,0 +4,0 @@ /** |
import { ServerTiming } from "../helpers/ServerTiming"; | ||
import type { MaybePromise } from "../helpers/types"; | ||
import { FunctionConfig, LogLevel, RegisterOptions, RegisterRequest, StepRunResponse } from "../types"; | ||
import { Inngest } from "./Inngest"; | ||
import type { InngestFunction } from "./InngestFunction"; | ||
import { type MaybePromise } from "../helpers/types"; | ||
import { type FunctionConfig, type LogLevel, type RegisterOptions, type RegisterRequest, type StepRunResponse } from "../types"; | ||
import { type Inngest } from "./Inngest"; | ||
import { type InngestFunction } from "./InngestFunction"; | ||
/** | ||
@@ -186,2 +186,3 @@ * A handler for serving Inngest functions. This type should be used | ||
private readonly rawFns; | ||
private readonly client; | ||
/** | ||
@@ -188,0 +189,0 @@ * A private collection of functions that are being served. This map is used |
@@ -185,2 +185,5 @@ "use strict"; | ||
: appNameOrInngest.name; | ||
if (typeof appNameOrInngest !== "string") { | ||
this.client = appNameOrInngest; | ||
} | ||
this.handler = handler; | ||
@@ -284,6 +287,10 @@ this.transformRes = transformRes; | ||
])); | ||
const getHeaders = () => (Object.assign(Object.assign({}, (0, env_1.inngestHeaders)({ | ||
const getHeaders = () => (0, env_1.inngestHeaders)({ | ||
env: actions.env, | ||
framework: this.frameworkName, | ||
})), { "Server-Timing": timer.getHeader() })); | ||
client: this.client, | ||
extras: { | ||
"Server-Timing": timer.getHeader(), | ||
}, | ||
}); | ||
const actionRes = timer.wrap("action", () => this.handleAction(actions, timer)); | ||
@@ -343,6 +350,10 @@ /** | ||
const env = (_a = actions.env) !== null && _a !== void 0 ? _a : (0, env_1.allProcessEnv)(); | ||
const getHeaders = () => (Object.assign(Object.assign({}, (0, env_1.inngestHeaders)({ | ||
const getHeaders = () => (0, env_1.inngestHeaders)({ | ||
env: env, | ||
framework: this.frameworkName, | ||
})), { "Server-Timing": timer.getHeader() })); | ||
client: this.client, | ||
extras: { | ||
"Server-Timing": timer.getHeader(), | ||
}, | ||
}); | ||
this._isProd = (_b = actions.isProduction) !== null && _b !== void 0 ? _b : (0, env_1.isProd)(env); | ||
@@ -349,0 +360,0 @@ try { |
@@ -1,3 +0,3 @@ | ||
import { EventNameFromTrigger, EventPayload, FunctionOptions, FunctionTrigger, Handler } from "../types"; | ||
import { Inngest } from "./Inngest"; | ||
import { type EventNameFromTrigger, type EventPayload, type FunctionOptions, type FunctionTrigger, type Handler } from "../types"; | ||
import { type Inngest } from "./Inngest"; | ||
/** | ||
@@ -4,0 +4,0 @@ * A stateless Inngest function, wrapping up function configuration and any |
@@ -1,5 +0,5 @@ | ||
import { Jsonify } from "type-fest"; | ||
import type { ObjectPaths, PartialK, SendEventPayload, SingleOrArray } from "../helpers/types"; | ||
import { EventPayload, HashedOp, StepOpCode } from "../types"; | ||
import { Inngest } from "./Inngest"; | ||
import { type Jsonify } from "type-fest"; | ||
import { type ObjectPaths, type PartialK, type SendEventPayload, type SingleOrArray } from "../helpers/types"; | ||
import { StepOpCode, type EventPayload, type HashedOp } from "../types"; | ||
import { type Inngest } from "./Inngest"; | ||
export interface TickOp extends HashedOp { | ||
@@ -6,0 +6,0 @@ fn?: (...args: unknown[]) => unknown; |
@@ -1,3 +0,3 @@ | ||
import type { SupportedFrameworkName } from "inngest/types"; | ||
import { ServeHandler } from "../components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "inngest/types"; | ||
import { type ServeHandler } from "../components/InngestCommHandler"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import type { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
type HTTP = { | ||
@@ -4,0 +4,0 @@ headers: Record<string, string>; |
@@ -1,3 +0,3 @@ | ||
import { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import type { FunctionConfig } from "../types"; | ||
import { type FunctionConfig } from "../types"; | ||
/** | ||
@@ -3,0 +3,0 @@ * A simple type map that we can transparently use `fetch` later without having |
@@ -1,2 +0,3 @@ | ||
import { SupportedFrameworkName } from "../types"; | ||
import { type Inngest } from "../components/Inngest"; | ||
import { type SupportedFrameworkName } from "../types"; | ||
/** | ||
@@ -57,2 +58,12 @@ * devServerHost returns the dev server host by searching for the INNGEST_DEVSERVER_URL | ||
inngestEnv?: string; | ||
/** | ||
* The Inngest client that's making the request. The client itself will | ||
* generate a set of headers; specifying it here will ensure that the client's | ||
* headers are included in the returned headers. | ||
*/ | ||
client?: Inngest; | ||
/** | ||
* Any additional headers to include in the returned headers. | ||
*/ | ||
extras?: Record<string, string>; | ||
}) => Record<string, string>; | ||
@@ -59,0 +70,0 @@ /** |
@@ -99,3 +99,6 @@ "use strict"; | ||
// eslint-disable-next-line @inngest/process-warn | ||
return process.env; | ||
if (process.env) { | ||
// eslint-disable-next-line @inngest/process-warn | ||
return process.env; | ||
} | ||
} | ||
@@ -106,3 +109,6 @@ catch (_err) { | ||
try { | ||
return Deno.env.toObject(); | ||
const env = Deno.env.toObject(); | ||
if (env) { | ||
return env; | ||
} | ||
} | ||
@@ -122,2 +128,3 @@ catch (_err) { | ||
const inngestHeaders = (opts) => { | ||
var _a; | ||
const sdkVersion = `inngest-js:v${version_1.version}`; | ||
@@ -132,3 +139,3 @@ const headers = { | ||
} | ||
const env = (opts === null || opts === void 0 ? void 0 : opts.env) || (0, exports.allProcessEnv)(); | ||
const env = Object.assign(Object.assign({}, (0, exports.allProcessEnv)()), opts === null || opts === void 0 ? void 0 : opts.env); | ||
const inngestEnv = (opts === null || opts === void 0 ? void 0 : opts.inngestEnv) || (0, exports.getEnvironmentName)(env); | ||
@@ -142,3 +149,3 @@ if (inngestEnv) { | ||
} | ||
return headers; | ||
return Object.assign(Object.assign(Object.assign({}, headers), (_a = opts === null || opts === void 0 ? void 0 : opts.client) === null || _a === void 0 ? void 0 : _a["headers"]), opts === null || opts === void 0 ? void 0 : opts.extras); | ||
}; | ||
@@ -145,0 +152,0 @@ exports.inngestHeaders = inngestHeaders; |
@@ -1,2 +0,2 @@ | ||
import { TimeStr } from "../types"; | ||
import { type TimeStr } from "../types"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Returns a slugified string used ot generate consistent IDs. |
@@ -1,2 +0,2 @@ | ||
import { EventPayload } from "../types"; | ||
import { type EventPayload } from "../types"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Returns a union of all of the values in a given object, regardless of key. |
@@ -1,3 +0,3 @@ | ||
import { ServeHandler } from "./components/InngestCommHandler"; | ||
import { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import type { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
{ | ||
"name": "inngest", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"description": "Official SDK for Inngest.com", | ||
@@ -84,2 +84,3 @@ "main": "./index.js", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
@@ -86,0 +87,0 @@ "express": "^4.18.2", |
@@ -137,4 +137,3 @@ <div align="center"> | ||
```sh | ||
yarn # install dependencies | ||
yarn dev # build/lint/test | ||
yarn dev # install dependencies, build/lint/test | ||
``` | ||
@@ -158,7 +157,48 @@ | ||
yarn link | ||
# in another repo | ||
yarn link inngest | ||
``` | ||
Alternatively, you can also package the library and ship it with an application. This is a nice way to generate and ship snapshot/test versions of the library to test in production environments without requiring releasing to npm. | ||
```sh | ||
# in this repo | ||
yarn local:pack | ||
cp inngest.tgz ../some-other-repo-root | ||
# in another repo | ||
yarn link inngest | ||
yarn add ./inngest.tgz | ||
``` | ||
Some platforms require manually installing the package again at build time to properly link dependencies, so you may have to change your `yarn build` script to be prefixed with this install, e.g.: | ||
```sh | ||
yarn add ./inngest.tgz && framework dev | ||
``` | ||
### Releasing | ||
To release to production, we use [Changesets](https://github.com/changesets/changesets). This means that releasing and changelog generation is all managed through PRs, where a bot will guide you through the process of announcing changes in PRs and releasing them once merged to `main`. | ||
#### Snapshot versions | ||
If a local `inngest.tgz` isn't ideal, we can release a tagged version to npm. For now, this is relatively manual. For this, please ensure you are in an open PR branch for observability. | ||
Decide on the "tag" you will be publishing to, which will dictate how the user installs the snapshot, e.g. if your tag is `beta`, the user will install using `inngest@beta`. | ||
You can see the currently available tags on the [`inngest` npm page](https://www.npmjs.com/package/inngest?activeTab=versions). | ||
> **NEVER** use the `latest` tag, and **NEVER** run `npm publish` without specifying `--tag`. | ||
If the current active version is `v1.1.1`, this is a minor release, and our tag is `foo`, we'd do: | ||
```sh | ||
yarn version v1.2.0-foo.1 | ||
yarn build | ||
yarn prelink | ||
cd dist/ | ||
npm publish --access public --tag foo | ||
``` | ||
You can iterate the final number for each extra snapshot you need to do on a branch. |
@@ -1,3 +0,3 @@ | ||
import { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export interface RedwoodResponse { | ||
@@ -4,0 +4,0 @@ statusCode: number; |
@@ -1,3 +0,3 @@ | ||
import { ServeHandler } from "./components/InngestCommHandler"; | ||
import type { SupportedFrameworkName } from "./types"; | ||
import { type ServeHandler } from "./components/InngestCommHandler"; | ||
import { type SupportedFrameworkName } from "./types"; | ||
export declare const name: SupportedFrameworkName; | ||
@@ -4,0 +4,0 @@ /** |
import { z } from "zod"; | ||
import type { createStepTools } from "./components/InngestStepTools"; | ||
import { internalEvents } from "./helpers/consts"; | ||
import type { IsStringLiteral, KeysNotOfType, ObjectPaths, StrictUnion } from "./helpers/types"; | ||
import { type createStepTools } from "./components/InngestStepTools"; | ||
import { type internalEvents } from "./helpers/consts"; | ||
import { type IsStringLiteral, type KeysNotOfType, type ObjectPaths, type StrictUnion } from "./helpers/types"; | ||
/** | ||
@@ -6,0 +6,0 @@ * The payload for an internal Inngest event that is sent when a function fails. |
@@ -1,2 +0,2 @@ | ||
export declare const version = "1.8.1"; | ||
export declare const version = "1.8.2"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = "1.8.1"; | ||
exports.version = "1.8.2"; | ||
//# 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
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
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 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
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
674262
6876
203
30
5