@adonisjs/http-server 8.0.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{define_config-D-kQXU0e.js → define_config-CfKSwwjk.js} +6 -6
- package/build/factories/main.js +3 -3
- package/build/index.js +1 -1
- package/build/src/client/url_builder.d.ts +2 -2
- package/build/src/client/url_builder.js +6 -2
- package/build/src/types/request.d.ts +2 -1
- package/package.json +12 -12
|
@@ -16,7 +16,7 @@ import onFinished from "on-finished";
|
|
|
16
16
|
import fresh from "fresh";
|
|
17
17
|
import typeIs from "type-is";
|
|
18
18
|
import { isIP } from "node:net";
|
|
19
|
-
import
|
|
19
|
+
import proxyaddr from "proxy-addr";
|
|
20
20
|
import { MessageBuilder, safeEqual } from "@poppinss/utils";
|
|
21
21
|
import lodash from "@poppinss/utils/lodash";
|
|
22
22
|
import base64 from "@poppinss/utils/base64";
|
|
@@ -870,11 +870,11 @@ var HttpRequest = class extends Macroable {
|
|
|
870
870
|
}
|
|
871
871
|
ip() {
|
|
872
872
|
const ipFn = this.#config.getIp;
|
|
873
|
-
if (typeof ipFn === "function") return ipFn(this);
|
|
874
|
-
return
|
|
873
|
+
if (typeof ipFn === "function") return ipFn(this, () => proxyaddr(this.request, this.#config.trustProxy));
|
|
874
|
+
return proxyaddr(this.request, this.#config.trustProxy);
|
|
875
875
|
}
|
|
876
876
|
ips() {
|
|
877
|
-
return
|
|
877
|
+
return proxyaddr.all(this.request, this.#config.trustProxy);
|
|
878
878
|
}
|
|
879
879
|
protocol() {
|
|
880
880
|
if ("encrypted" in this.request.socket) return "https";
|
|
@@ -2391,7 +2391,7 @@ function defineConfig(config) {
|
|
|
2391
2391
|
const { trustProxy, ...rest } = config;
|
|
2392
2392
|
const defaults = {
|
|
2393
2393
|
allowMethodSpoofing: false,
|
|
2394
|
-
trustProxy:
|
|
2394
|
+
trustProxy: proxyaddr.compile("loopback"),
|
|
2395
2395
|
subdomainOffset: 2,
|
|
2396
2396
|
generateRequestId: !!config.createRequestId,
|
|
2397
2397
|
createRequestId() {
|
|
@@ -2431,7 +2431,7 @@ function defineConfig(config) {
|
|
|
2431
2431
|
normalizedConfig.trustProxy = (_, __) => tpValue;
|
|
2432
2432
|
} else if (typeof trustProxy === "string") {
|
|
2433
2433
|
const tpValue = trustProxy;
|
|
2434
|
-
normalizedConfig.trustProxy =
|
|
2434
|
+
normalizedConfig.trustProxy = proxyaddr.compile(tpValue);
|
|
2435
2435
|
} else if (trustProxy) normalizedConfig.trustProxy = trustProxy;
|
|
2436
2436
|
return normalizedConfig;
|
|
2437
2437
|
}
|
package/build/factories/main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../utils-BjSHKI3s.js";
|
|
2
|
-
import { _ as Qs, c as HttpRequest, i as HttpResponse, n as Server, r as HttpContext, s as Router, t as defineConfig } from "../define_config-
|
|
2
|
+
import { _ as Qs, c as HttpRequest, i as HttpResponse, n as Server, r as HttpContext, s as Router, t as defineConfig } from "../define_config-CfKSwwjk.js";
|
|
3
3
|
import { t as createURL } from "../helpers-C_2HouOe.js";
|
|
4
4
|
import { parseRoute } from "../src/helpers.js";
|
|
5
5
|
import "../types-AUwURgIL.js";
|
|
6
6
|
import { Container } from "@adonisjs/fold";
|
|
7
7
|
import { Socket } from "node:net";
|
|
8
|
-
import
|
|
8
|
+
import proxyaddr from "proxy-addr";
|
|
9
9
|
import { safeStringify } from "@poppinss/utils/json";
|
|
10
10
|
import { AppFactory } from "@adonisjs/application/factories";
|
|
11
11
|
import { EncryptionFactory } from "@boringnode/encryption/factories";
|
|
@@ -60,7 +60,7 @@ var HttpRequestFactory = class {
|
|
|
60
60
|
#getConfig() {
|
|
61
61
|
return {
|
|
62
62
|
allowMethodSpoofing: false,
|
|
63
|
-
trustProxy:
|
|
63
|
+
trustProxy: proxyaddr.compile("loopback"),
|
|
64
64
|
subdomainOffset: 2,
|
|
65
65
|
generateRequestId: false,
|
|
66
66
|
createRequestId() {
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as RouteGroup, c as Route, m as canWriteResponseBody, o as RouteResource, p as tracing_channels_exports, s as BriskRoute, t as parseRange } from "./utils-BjSHKI3s.js";
|
|
2
|
-
import { _ as Qs, a as CookieSerializer, c as HttpRequest, d as Redirect, f as E_CANNOT_LOOKUP_ROUTE, g as errors_exports, h as E_ROUTE_NOT_FOUND, i as HttpResponse, l as CookieParser, m as E_HTTP_REQUEST_ABORTED, n as Server, o as ResponseStatus, p as E_HTTP_EXCEPTION, r as HttpContext, s as Router, t as defineConfig, u as CookieClient } from "./define_config-
|
|
2
|
+
import { _ as Qs, a as CookieSerializer, c as HttpRequest, d as Redirect, f as E_CANNOT_LOOKUP_ROUTE, g as errors_exports, h as E_ROUTE_NOT_FOUND, i as HttpResponse, l as CookieParser, m as E_HTTP_REQUEST_ABORTED, n as Server, o as ResponseStatus, p as E_HTTP_EXCEPTION, r as HttpContext, s as Router, t as defineConfig, u as CookieClient } from "./define_config-CfKSwwjk.js";
|
|
3
3
|
import "./helpers-C_2HouOe.js";
|
|
4
4
|
import "./types-AUwURgIL.js";
|
|
5
5
|
import Macroable from "@poppinss/macroable";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createURL, findRoute } from './helpers.ts';
|
|
2
|
-
import { type UrlFor, type LookupList, type ClientRouteJSON } from './types.ts';
|
|
2
|
+
import { type UrlFor, type LookupList, type URLOptions, type ClientRouteJSON } from './types.ts';
|
|
3
3
|
export * from './types.ts';
|
|
4
4
|
export { createURL, findRoute };
|
|
5
5
|
/**
|
|
@@ -12,4 +12,4 @@ export declare function createUrlBuilder<Routes extends LookupList>(routesLoader
|
|
|
12
12
|
[domain: string]: ClientRouteJSON[];
|
|
13
13
|
} | (() => {
|
|
14
14
|
[domain: string]: ClientRouteJSON[];
|
|
15
|
-
}), searchParamsStringifier: (qs: Record<string, any>) => string): UrlFor<Routes>;
|
|
15
|
+
}), searchParamsStringifier: (qs: Record<string, any>) => string, defaultOptions?: URLOptions): UrlFor<Routes>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as findRoute, t as createURL } from "../../helpers-C_2HouOe.js";
|
|
2
2
|
import "../../types-AUwURgIL.js";
|
|
3
|
-
function createUrlBuilder(routesLoader, searchParamsStringifier) {
|
|
3
|
+
function createUrlBuilder(routesLoader, searchParamsStringifier, defaultOptions) {
|
|
4
4
|
let domainsList;
|
|
5
5
|
let domainsRoutes;
|
|
6
6
|
function createUrlForRoute(identifier, params, options, method) {
|
|
@@ -16,7 +16,11 @@ function createUrlBuilder(routesLoader, searchParamsStringifier) {
|
|
|
16
16
|
if (method) throw new Error(`Cannot lookup route "${routeIdentifier}" for method "${method}"`);
|
|
17
17
|
throw new Error(`Cannot lookup route "${routeIdentifier}"`);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const mergedOptions = defaultOptions || options ? {
|
|
20
|
+
...defaultOptions,
|
|
21
|
+
...options
|
|
22
|
+
} : void 0;
|
|
23
|
+
return createURL(route.name ?? route.pattern, route.tokens, searchParamsStringifier, params, mergedOptions);
|
|
20
24
|
}
|
|
21
25
|
const urlFor = function route(...[identifier, params, options]) {
|
|
22
26
|
return createUrlForRoute(identifier, params, options);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HttpRequest } from '../request.ts';
|
|
1
2
|
/**
|
|
2
3
|
* Configuration options for HTTP request handling and processing
|
|
3
4
|
*/
|
|
@@ -32,7 +33,7 @@ export type RequestConfig = {
|
|
|
32
33
|
/**
|
|
33
34
|
* A custom implementation to get the request ip address
|
|
34
35
|
*/
|
|
35
|
-
getIp?: (request:
|
|
36
|
+
getIp?: (request: HttpRequest, originalFn: () => string) => string;
|
|
36
37
|
/**
|
|
37
38
|
* A callback function to trust proxy ip addresses. You must use
|
|
38
39
|
* the `proxy-addr` package to compute this value.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"@adonisjs/eslint-config": "^3.0.0",
|
|
48
48
|
"@adonisjs/events": "^10.1.0",
|
|
49
49
|
"@adonisjs/fold": "^11.0.0",
|
|
50
|
-
"@adonisjs/logger": "^7.1.
|
|
50
|
+
"@adonisjs/logger": "^7.1.1",
|
|
51
51
|
"@adonisjs/prettier-config": "^1.4.5",
|
|
52
52
|
"@adonisjs/tsconfig": "^2.0.0",
|
|
53
53
|
"@boringnode/encryption": "^1.0.0",
|
|
54
|
-
"@fastify/middie": "^9.1
|
|
54
|
+
"@fastify/middie": "^9.3.1",
|
|
55
55
|
"@japa/assert": "^4.2.0",
|
|
56
56
|
"@japa/expect-type": "^2.0.4",
|
|
57
57
|
"@japa/file-system": "^3.0.0",
|
|
58
58
|
"@japa/runner": "^5.3.0",
|
|
59
59
|
"@japa/snapshot": "^2.0.10",
|
|
60
60
|
"@poppinss/ts-exec": "^1.4.4",
|
|
61
|
-
"@release-it/conventional-changelog": "^10.0.
|
|
61
|
+
"@release-it/conventional-changelog": "^10.0.6",
|
|
62
62
|
"@types/accepts": "^1.3.7",
|
|
63
63
|
"@types/content-disposition": "^0.5.9",
|
|
64
64
|
"@types/destroy": "^1.0.3",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"@types/fresh": "^0.5.3",
|
|
68
68
|
"@types/fs-extra": "^11.0.4",
|
|
69
69
|
"@types/mime-types": "^3.0.1",
|
|
70
|
-
"@types/node": "^25.
|
|
70
|
+
"@types/node": "^25.5.0",
|
|
71
71
|
"@types/on-finished": "^2.3.5",
|
|
72
72
|
"@types/pem": "^1.14.4",
|
|
73
73
|
"@types/proxy-addr": "^2.0.3",
|
|
74
|
-
"@types/supertest": "^
|
|
74
|
+
"@types/supertest": "^7.2.0",
|
|
75
75
|
"@types/type-is": "^1.6.7",
|
|
76
76
|
"@types/vary": "^1.1.3",
|
|
77
77
|
"@vinejs/vine": "^4.3.0",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"autocannon": "^8.0.0",
|
|
80
80
|
"c8": "^11.0.0",
|
|
81
81
|
"cross-env": "^10.1.0",
|
|
82
|
-
"eslint": "^10.0.
|
|
83
|
-
"fastify": "^5.
|
|
84
|
-
"fs-extra": "^11.3.
|
|
82
|
+
"eslint": "^10.0.3",
|
|
83
|
+
"fastify": "^5.8.2",
|
|
84
|
+
"fs-extra": "^11.3.4",
|
|
85
85
|
"get-port": "^7.1.0",
|
|
86
86
|
"http-status-codes": "^2.3.0",
|
|
87
87
|
"pem": "^1.14.8",
|
|
@@ -89,17 +89,17 @@
|
|
|
89
89
|
"reflect-metadata": "^0.2.2",
|
|
90
90
|
"release-it": "^19.2.4",
|
|
91
91
|
"supertest": "^7.2.2",
|
|
92
|
-
"tsdown": "
|
|
92
|
+
"tsdown": "0.20.3",
|
|
93
93
|
"typedoc": "^0.28.17",
|
|
94
94
|
"typescript": "^5.9.3",
|
|
95
95
|
"youch": "^4.1.0"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@poppinss/macroable": "^1.1.
|
|
98
|
+
"@poppinss/macroable": "^1.1.2",
|
|
99
99
|
"@poppinss/matchit": "^3.2.0",
|
|
100
100
|
"@poppinss/middleware": "^3.2.7",
|
|
101
101
|
"@poppinss/qs": "^6.15.0",
|
|
102
|
-
"@poppinss/utils": "^7.0.
|
|
102
|
+
"@poppinss/utils": "^7.0.1",
|
|
103
103
|
"@sindresorhus/is": "^7.2.0",
|
|
104
104
|
"content-disposition": "^1.0.1",
|
|
105
105
|
"cookie-es": "^2.0.0",
|