Skip to content

Commit 564e273

Browse files
authored
fix: remove http dep to fix app dir support (#768)
1 parent a7f94b1 commit 564e273

File tree

8 files changed

+40
-55
lines changed

8 files changed

+40
-55
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [16.6.8] - 2023-12-18
11+
12+
- Fix App dir support by removing the import of the "http" module
13+
1014
## [16.6.7] - 2023-12-18
1115

1216
- Adds facebook user data by checking the scopes provided in the config

lib/build/framework/custom/nodeHeaders.js

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
"use strict";
22
// @ts-nocheck This is basically plain JS from another lib
3-
var __importDefault =
4-
(this && this.__importDefault) ||
5-
function (mod) {
6-
return mod && mod.__esModule ? mod : { default: mod };
7-
};
83
Object.defineProperty(exports, "__esModule", { value: true });
94
exports.fromRawHeaders = void 0;
105
/* From https://github.com/lquixada/node-fetch/blob/master/src/headers.js */
@@ -21,27 +16,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
2116
2217
*/
2318
const util_1 = require("util");
24-
const http_1 = __importDefault(require("http"));
25-
const validateHeaderName =
26-
typeof http_1.default.validateHeaderName === "function"
27-
? http_1.default.validateHeaderName
28-
: (name) => {
29-
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
30-
const err = new TypeError(`Header name must be a valid HTTP token [${name}]`);
31-
Object.defineProperty(err, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
32-
throw err;
33-
}
34-
};
35-
const validateHeaderValue =
36-
typeof http_1.default.validateHeaderValue === "function"
37-
? http_1.default.validateHeaderValue
38-
: (name, value) => {
39-
if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
40-
const err = new TypeError(`Invalid character in header content ["${name}"]`);
41-
Object.defineProperty(err, "code", { value: "ERR_INVALID_CHAR" });
42-
throw err;
43-
}
44-
};
19+
const validateHeaderName = (name) => {
20+
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
21+
const err = new TypeError(`Header name must be a valid HTTP token [${name}]`);
22+
Object.defineProperty(err, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
23+
throw err;
24+
}
25+
};
26+
const validateHeaderValue = (name, value) => {
27+
if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
28+
const err = new TypeError(`Invalid character in header content ["${name}"]`);
29+
Object.defineProperty(err, "code", { value: "ERR_INVALID_CHAR" });
30+
throw err;
31+
}
32+
};
4533
/**
4634
* @typedef {Headers | Record<string, string> | Iterable<readonly [string, string]> | Iterable<Iterable<string>>} HeadersInit
4735
*/

lib/build/version.d.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/version.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ts/framework/custom/nodeHeaders.ts

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,22 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1616
*/
1717

1818
import { types } from "util";
19-
import http from "http";
20-
21-
const validateHeaderName =
22-
typeof http.validateHeaderName === "function"
23-
? http.validateHeaderName
24-
: (name) => {
25-
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
26-
const err = new TypeError(`Header name must be a valid HTTP token [${name}]`);
27-
Object.defineProperty(err, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
28-
throw err;
29-
}
30-
};
31-
32-
const validateHeaderValue =
33-
typeof http.validateHeaderValue === "function"
34-
? http.validateHeaderValue
35-
: (name, value) => {
36-
if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
37-
const err = new TypeError(`Invalid character in header content ["${name}"]`);
38-
Object.defineProperty(err, "code", { value: "ERR_INVALID_CHAR" });
39-
throw err;
40-
}
41-
};
19+
20+
const validateHeaderName = (name) => {
21+
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
22+
const err = new TypeError(`Header name must be a valid HTTP token [${name}]`);
23+
Object.defineProperty(err, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
24+
throw err;
25+
}
26+
};
27+
28+
const validateHeaderValue = (name, value) => {
29+
if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
30+
const err = new TypeError(`Invalid character in header content ["${name}"]`);
31+
Object.defineProperty(err, "code", { value: "ERR_INVALID_CHAR" });
32+
throw err;
33+
}
34+
};
4235

4336
/**
4437
* @typedef {Headers | Record<string, string> | Iterable<readonly [string, string]> | Iterable<Iterable<string>>} HeadersInit

lib/ts/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* License for the specific language governing permissions and limitations
1313
* under the License.
1414
*/
15-
export const version = "16.6.7";
15+
export const version = "16.6.8";
1616

1717
export const cdiSupported = ["4.0"];
1818

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "supertokens-node",
3-
"version": "16.6.7",
3+
"version": "16.6.8",
44
"description": "NodeJS driver for SuperTokens core",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)