Comparing version 1.5.2 to 1.5.3
# inngest | ||
## 1.5.3 | ||
### Patch Changes | ||
- 906aca5: INN-1009 Show warnings when using the package with TS versions `<4.7.2` and Node versions `<14` | ||
This includes tests to assert we appropriately support these versions now and in the future. | ||
- ca7d79e: Detect env vars from Node and Deno in serve handlers (INN-1012) | ||
## 1.5.2 | ||
@@ -4,0 +14,0 @@ |
@@ -16,2 +16,3 @@ "use strict"; | ||
const scalar_1 = require("../helpers/scalar"); | ||
const strings_1 = require("../helpers/strings"); | ||
const landing_1 = require("../landing"); | ||
@@ -257,3 +258,3 @@ const version_1 = require("../version"); | ||
async handleAction(actions, timer) { | ||
var _a, _b, _c, _d, _e; | ||
var _a, _b; | ||
const getHeaders = () => ({ | ||
@@ -287,3 +288,3 @@ [consts_1.headerKeys.SdkVersion]: this.sdkHeader.join(""), | ||
this.upsertSigningKeyFromEnv(env); | ||
const showLandingPage = this.shouldShowLandingPage((_c = env[consts_1.envKeys.LandingPage]) === null || _c === void 0 ? void 0 : _c.toString()); | ||
const showLandingPage = this.shouldShowLandingPage((0, strings_1.stringifyUnknown)(env[consts_1.envKeys.LandingPage])); | ||
if (this._isProd || !showLandingPage) { | ||
@@ -297,4 +298,3 @@ return { | ||
if (viewRes.isIntrospection) { | ||
const introspection = Object.assign(Object.assign({}, this.registerBody(this.reqUrl(actions.url))), { devServerURL: (0, devserver_1.devServerUrl)((_d = env[consts_1.envKeys.DevServerUrl]) === null || _d === void 0 ? void 0 : _d.toString()) | ||
.href, hasSigningKey: Boolean(this.signingKey) }); | ||
const introspection = Object.assign(Object.assign({}, this.registerBody(this.reqUrl(actions.url))), { devServerURL: (0, devserver_1.devServerUrl)((0, strings_1.stringifyUnknown)(env[consts_1.envKeys.DevServerUrl])).href, hasSigningKey: Boolean(this.signingKey) }); | ||
return { | ||
@@ -315,3 +315,3 @@ status: 200, | ||
this.upsertSigningKeyFromEnv(env); | ||
const { status, message } = await this.register(this.reqUrl(actions.url), (_e = env[consts_1.envKeys.DevServerUrl]) === null || _e === void 0 ? void 0 : _e.toString(), registerRes.deployId); | ||
const { status, message } = await this.register(this.reqUrl(actions.url), (0, strings_1.stringifyUnknown)(env[consts_1.envKeys.DevServerUrl]), registerRes.deployId); | ||
return { | ||
@@ -548,3 +548,3 @@ status, | ||
if (!this.signingKey && env[consts_1.envKeys.SigningKey]) { | ||
this.signingKey = env[consts_1.envKeys.SigningKey].toString(); | ||
this.signingKey = String(env[consts_1.envKeys.SigningKey]); | ||
} | ||
@@ -551,0 +551,0 @@ } |
@@ -9,2 +9,3 @@ "use strict"; | ||
const consts_1 = require("./consts"); | ||
const strings_1 = require("./strings"); | ||
/** | ||
@@ -35,7 +36,7 @@ * devServerHost returns the dev server host by searching for the INNGEST_DEVSERVER_URL | ||
exports.devServerHost = devServerHost; | ||
const prodCheckFns = { | ||
const prodCheckFns = ((checks) => checks)({ | ||
equals: (actual, expected) => actual === expected, | ||
"starts with": (actual, expected) => { var _a; return expected ? (_a = actual === null || actual === void 0 ? void 0 : actual.startsWith(expected)) !== null && _a !== void 0 ? _a : false : false; }, | ||
"is truthy": (actual) => Boolean(actual), | ||
}; | ||
}); | ||
const prodChecks = [ | ||
@@ -59,10 +60,6 @@ ["CF_PAGES", "equals", "1"], | ||
return prodChecks.some(([key, checkKey, expected]) => { | ||
var _a; | ||
return prodCheckFns[checkKey]((_a = env[key]) === null || _a === void 0 ? void 0 : _a.toString(), expected); | ||
return prodCheckFns[checkKey]((0, strings_1.stringifyUnknown)(env[key]), expected); | ||
}); | ||
}; | ||
exports.isProd = isProd; | ||
const hasProcessEnv = () => { | ||
return typeof process !== "undefined" && "env" in process; | ||
}; | ||
const processEnv = (key) => { | ||
@@ -73,6 +70,15 @@ return (0, exports.allProcessEnv)()[key]; | ||
const allProcessEnv = () => { | ||
if (hasProcessEnv()) { | ||
try { | ||
// eslint-disable-next-line @inngest/process-warn | ||
return process.env; | ||
} | ||
catch (_err) { | ||
// noop | ||
} | ||
try { | ||
return Deno.env.toObject(); | ||
} | ||
catch (_err) { | ||
// noop | ||
} | ||
return {}; | ||
@@ -79,0 +85,0 @@ }; |
@@ -14,2 +14,7 @@ import { TimeStr } from "../types"; | ||
export declare const timeStr: (input: string | number | Date, now?: Date) => TimeStr; | ||
/** | ||
* Given an unknown input, stringify it if it's a boolean, a number, or a | ||
* string, else return `undefined`. | ||
*/ | ||
export declare const stringifyUnknown: (input: unknown) => string | undefined; | ||
//# sourceMappingURL=strings.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.timeStr = exports.slugify = void 0; | ||
exports.stringifyUnknown = exports.timeStr = exports.slugify = void 0; | ||
const ms_1 = __importDefault(require("ms")); | ||
@@ -78,2 +78,14 @@ /** | ||
exports.timeStr = timeStr; | ||
/** | ||
* Given an unknown input, stringify it if it's a boolean, a number, or a | ||
* string, else return `undefined`. | ||
*/ | ||
const stringifyUnknown = (input) => { | ||
if (typeof input === "boolean" || | ||
typeof input === "number" || | ||
typeof input === "string") { | ||
return input.toString(); | ||
} | ||
}; | ||
exports.stringifyUnknown = stringifyUnknown; | ||
//# sourceMappingURL=strings.js.map |
{ | ||
"name": "inngest", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "Official SDK for Inngest.com", | ||
@@ -24,2 +24,3 @@ "main": "./index.js", | ||
"test:examples": "node --expose-gc --max-old-space-size=4096 ./node_modules/.bin/jest --logHeapUsage --maxWorkers=8 --testMatch \"**/examples/**/*.test.ts\" --ci --verbose", | ||
"test:types": "tsc --noEmit --project tsconfig.types.json", | ||
"clean": "rm -rf ./dist", | ||
@@ -99,3 +100,9 @@ "lint": "eslint .", | ||
"yarn": "1.22.19" | ||
}, | ||
"peerDependencies": { | ||
"typescript": ">=4.7.2" | ||
}, | ||
"engines": { | ||
"node": ">=14" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
export declare const version = "1.5.2"; | ||
export declare const version = "1.5.3"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = "1.5.2"; | ||
exports.version = "1.5.3"; | ||
//# 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 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
564135
5740
10