@adonisjs/http-server 8.0.0-next.8 → 8.0.0
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 +2438 -0
- package/build/factories/http_context.d.ts +10 -4
- package/build/factories/main.d.ts +2 -2
- package/build/factories/main.js +170 -345
- package/build/factories/request.d.ts +4 -4
- package/build/factories/response.d.ts +4 -4
- package/build/factories/router.d.ts +1 -1
- package/build/factories/server_factory.d.ts +1 -1
- package/build/factories/url_builder_factory.d.ts +3 -3
- package/build/helpers-C_2HouOe.js +52 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +155 -370
- package/build/src/client/helpers.d.ts +37 -0
- package/build/src/client/types.d.ts +194 -0
- package/build/src/client/url_builder.d.ts +15 -0
- package/build/src/client/url_builder.js +115 -0
- package/build/src/cookies/client.d.ts +28 -5
- package/build/src/cookies/drivers/encrypted.d.ts +1 -1
- package/build/src/cookies/drivers/signed.d.ts +1 -1
- package/build/src/cookies/parser.d.ts +1 -1
- package/build/src/cookies/serializer.d.ts +2 -2
- package/build/src/debug.d.ts +14 -1
- package/build/src/define_config.d.ts +19 -1
- package/build/src/define_middleware.d.ts +19 -3
- package/build/src/errors.d.ts +60 -5
- package/build/src/exception_handler.d.ts +28 -8
- package/build/src/helpers.d.ts +23 -16
- package/build/src/helpers.js +76 -22
- package/build/src/http_context/main.d.ts +67 -17
- package/build/src/qs.d.ts +17 -3
- package/build/src/redirect.d.ts +22 -3
- package/build/src/request.d.ts +12 -5
- package/build/src/response.d.ts +5 -5
- package/build/src/response_status.d.ts +14 -0
- package/build/src/router/main.d.ts +6 -2
- package/build/src/router/route.d.ts +130 -32
- package/build/src/router/signed_url_builder.d.ts +1 -1
- package/build/src/server/main.d.ts +6 -6
- package/build/src/types/main.js +1 -0
- package/build/src/types/response.d.ts +6 -1
- package/build/src/types/route.d.ts +3 -27
- package/build/src/types/url_builder.d.ts +2 -140
- package/build/src/utils.d.ts +71 -6
- package/build/types-AUwURgIL.js +1 -0
- package/build/utils-BjSHKI3s.js +618 -0
- package/package.json +56 -47
- package/build/chunk-NQNHMINZ.js +0 -135
- package/build/chunk-W6WKITGF.js +0 -5486
- package/build/src/router/url_builder.d.ts +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
".": "./build/index.js",
|
|
14
14
|
"./helpers": "./build/src/helpers.js",
|
|
15
15
|
"./types": "./build/src/types/main.js",
|
|
16
|
+
"./client/url_builder": "./build/src/client/url_builder.js",
|
|
16
17
|
"./factories": "./build/factories/main.js"
|
|
17
18
|
},
|
|
18
19
|
"engines": {
|
|
@@ -20,10 +21,10 @@
|
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
23
|
"pretest": "npm run lint",
|
|
23
|
-
"test": "cross-env NODE_DEBUG=adonisjs:http
|
|
24
|
+
"test": "cross-env NODE_DEBUG=adonisjs:http npm run quick:test",
|
|
24
25
|
"typecheck": "tsc --noEmit",
|
|
25
26
|
"precompile": "npm run lint",
|
|
26
|
-
"compile": "
|
|
27
|
+
"compile": "tsdown && tsc --emitDeclarationOnly --declaration",
|
|
27
28
|
"build": "npm run compile",
|
|
28
29
|
"prebenchmark": "npm run build",
|
|
29
30
|
"benchmark": "node benchmarks/index.js",
|
|
@@ -42,22 +43,22 @@
|
|
|
42
43
|
"author": "virk,adonisjs",
|
|
43
44
|
"license": "MIT",
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@adonisjs/application": "^9.0.0
|
|
46
|
-
"@adonisjs/
|
|
47
|
-
"@adonisjs/
|
|
48
|
-
"@adonisjs/
|
|
49
|
-
"@adonisjs/
|
|
50
|
-
"@adonisjs/logger": "^7.1.0-next.0",
|
|
46
|
+
"@adonisjs/application": "^9.0.0",
|
|
47
|
+
"@adonisjs/eslint-config": "^3.0.0",
|
|
48
|
+
"@adonisjs/events": "^10.1.0",
|
|
49
|
+
"@adonisjs/fold": "^11.0.0",
|
|
50
|
+
"@adonisjs/logger": "^7.1.0",
|
|
51
51
|
"@adonisjs/prettier-config": "^1.4.5",
|
|
52
|
-
"@adonisjs/tsconfig": "^2.0.0
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@japa/
|
|
56
|
-
"@japa/
|
|
57
|
-
"@japa/
|
|
58
|
-
"@japa/
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
52
|
+
"@adonisjs/tsconfig": "^2.0.0",
|
|
53
|
+
"@boringnode/encryption": "^1.0.0",
|
|
54
|
+
"@fastify/middie": "^9.1.0",
|
|
55
|
+
"@japa/assert": "^4.2.0",
|
|
56
|
+
"@japa/expect-type": "^2.0.4",
|
|
57
|
+
"@japa/file-system": "^3.0.0",
|
|
58
|
+
"@japa/runner": "^5.3.0",
|
|
59
|
+
"@japa/snapshot": "^2.0.10",
|
|
60
|
+
"@poppinss/ts-exec": "^1.4.4",
|
|
61
|
+
"@release-it/conventional-changelog": "^10.0.5",
|
|
61
62
|
"@types/accepts": "^1.3.7",
|
|
62
63
|
"@types/content-disposition": "^0.5.9",
|
|
63
64
|
"@types/destroy": "^1.0.3",
|
|
@@ -66,61 +67,60 @@
|
|
|
66
67
|
"@types/fresh": "^0.5.3",
|
|
67
68
|
"@types/fs-extra": "^11.0.4",
|
|
68
69
|
"@types/mime-types": "^3.0.1",
|
|
69
|
-
"@types/node": "^
|
|
70
|
+
"@types/node": "^25.3.0",
|
|
70
71
|
"@types/on-finished": "^2.3.5",
|
|
71
72
|
"@types/pem": "^1.14.4",
|
|
72
73
|
"@types/proxy-addr": "^2.0.3",
|
|
73
|
-
"@types/qs": "^6.14.0",
|
|
74
74
|
"@types/supertest": "^6.0.3",
|
|
75
75
|
"@types/type-is": "^1.6.7",
|
|
76
76
|
"@types/vary": "^1.1.3",
|
|
77
|
-
"@vinejs/vine": "^3.0
|
|
77
|
+
"@vinejs/vine": "^4.3.0",
|
|
78
|
+
"accepts": "^1.3.8",
|
|
78
79
|
"autocannon": "^8.0.0",
|
|
79
|
-
"c8": "^
|
|
80
|
+
"c8": "^11.0.0",
|
|
80
81
|
"cross-env": "^10.1.0",
|
|
81
|
-
"eslint": "^
|
|
82
|
-
"fastify": "^5.
|
|
83
|
-
"fs-extra": "^11.3.
|
|
82
|
+
"eslint": "^10.0.2",
|
|
83
|
+
"fastify": "^5.7.4",
|
|
84
|
+
"fs-extra": "^11.3.3",
|
|
84
85
|
"get-port": "^7.1.0",
|
|
85
86
|
"http-status-codes": "^2.3.0",
|
|
86
87
|
"pem": "^1.14.8",
|
|
87
|
-
"prettier": "^3.
|
|
88
|
+
"prettier": "^3.8.1",
|
|
88
89
|
"reflect-metadata": "^0.2.2",
|
|
89
|
-
"release-it": "^19.
|
|
90
|
-
"supertest": "^7.
|
|
91
|
-
"
|
|
92
|
-
"typedoc": "^0.28.
|
|
93
|
-
"typescript": "^5.9.
|
|
94
|
-
"youch": "^4.1.0
|
|
90
|
+
"release-it": "^19.2.4",
|
|
91
|
+
"supertest": "^7.2.2",
|
|
92
|
+
"tsdown": "^0.20.3",
|
|
93
|
+
"typedoc": "^0.28.17",
|
|
94
|
+
"typescript": "^5.9.3",
|
|
95
|
+
"youch": "^4.1.0"
|
|
95
96
|
},
|
|
96
97
|
"dependencies": {
|
|
97
98
|
"@poppinss/macroable": "^1.1.0",
|
|
98
99
|
"@poppinss/matchit": "^3.2.0",
|
|
99
|
-
"@poppinss/middleware": "^3.2.
|
|
100
|
-
"@poppinss/
|
|
101
|
-
"@
|
|
102
|
-
"
|
|
103
|
-
"content-disposition": "^0.
|
|
104
|
-
"cookie": "^
|
|
100
|
+
"@poppinss/middleware": "^3.2.7",
|
|
101
|
+
"@poppinss/qs": "^6.15.0",
|
|
102
|
+
"@poppinss/utils": "^7.0.0",
|
|
103
|
+
"@sindresorhus/is": "^7.2.0",
|
|
104
|
+
"content-disposition": "^1.0.1",
|
|
105
|
+
"cookie-es": "^2.0.0",
|
|
105
106
|
"destroy": "^1.2.0",
|
|
106
107
|
"encodeurl": "^2.0.0",
|
|
107
108
|
"etag": "^1.8.1",
|
|
108
109
|
"fresh": "^0.5.2",
|
|
109
|
-
"mime-types": "^3.0.
|
|
110
|
+
"mime-types": "^3.0.2",
|
|
110
111
|
"on-finished": "^2.4.1",
|
|
111
112
|
"proxy-addr": "^2.0.7",
|
|
112
|
-
"qs": "^6.14.0",
|
|
113
113
|
"tmp-cache": "^1.1.0",
|
|
114
114
|
"type-is": "^2.0.1",
|
|
115
115
|
"vary": "^1.1.2"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
|
-
"@adonisjs/application": "^9.0.0-next.
|
|
119
|
-
"@adonisjs/
|
|
120
|
-
"@adonisjs/
|
|
121
|
-
"@adonisjs/
|
|
122
|
-
"@
|
|
123
|
-
"youch": "^4.1.0-beta.
|
|
118
|
+
"@adonisjs/application": "^9.0.0-next.14 || ^9.0.0",
|
|
119
|
+
"@adonisjs/events": "^10.1.0-next.4 || ^10.1.0",
|
|
120
|
+
"@adonisjs/fold": "^11.0.0-next.4 || ^11.0.0",
|
|
121
|
+
"@adonisjs/logger": "^7.1.0-next.3 || ^7.1.0",
|
|
122
|
+
"@boringnode/encryption": "^0.2.0 || ^1.0.0",
|
|
123
|
+
"youch": "^4.1.0-beta.13 || ^4.1.0"
|
|
124
124
|
},
|
|
125
125
|
"peerDependenciesMeta": {
|
|
126
126
|
"youch": {
|
|
@@ -176,17 +176,26 @@
|
|
|
176
176
|
]
|
|
177
177
|
},
|
|
178
178
|
"prettier": "@adonisjs/prettier-config",
|
|
179
|
-
"
|
|
179
|
+
"tsdown": {
|
|
180
180
|
"entry": [
|
|
181
181
|
"./index.ts",
|
|
182
182
|
"./src/helpers.ts",
|
|
183
183
|
"./src/types/main.ts",
|
|
184
|
+
"./src/client/url_builder.ts",
|
|
184
185
|
"./factories/main.ts"
|
|
185
186
|
],
|
|
187
|
+
"noExternal": [
|
|
188
|
+
"accepts",
|
|
189
|
+
"negotiator"
|
|
190
|
+
],
|
|
191
|
+
"inlineOnly": false,
|
|
186
192
|
"outDir": "./build",
|
|
187
193
|
"clean": true,
|
|
188
194
|
"format": "esm",
|
|
195
|
+
"minify": "dce-only",
|
|
196
|
+
"fixedExtension": false,
|
|
189
197
|
"dts": false,
|
|
198
|
+
"treeshake": false,
|
|
190
199
|
"sourcemap": false,
|
|
191
200
|
"target": "esnext"
|
|
192
201
|
}
|
package/build/chunk-NQNHMINZ.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
// src/helpers.ts
|
|
8
|
-
import cookie from "cookie";
|
|
9
|
-
import matchit from "@poppinss/matchit";
|
|
10
|
-
import string from "@poppinss/utils/string";
|
|
11
|
-
import { parseBindingReference } from "@adonisjs/fold";
|
|
12
|
-
import { default as default2 } from "encodeurl";
|
|
13
|
-
import { default as default3 } from "mime-types";
|
|
14
|
-
function parseRoute(pattern, matchers) {
|
|
15
|
-
const tokens = matchit.parse(pattern, matchers);
|
|
16
|
-
return tokens;
|
|
17
|
-
}
|
|
18
|
-
function createURL(pattern, tokens, searchParamsStringifier, params, options) {
|
|
19
|
-
const uriSegments = [];
|
|
20
|
-
const paramsArray = Array.isArray(params) ? params : null;
|
|
21
|
-
const paramsObject = !Array.isArray(params) ? params ?? {} : {};
|
|
22
|
-
let paramsIndex = 0;
|
|
23
|
-
for (const token of tokens) {
|
|
24
|
-
if (token.type === 0) {
|
|
25
|
-
uriSegments.push(token.val === "/" ? "" : `${token.val}${token.end}`);
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (token.type === 2) {
|
|
29
|
-
const values = paramsArray ? paramsArray.slice(paramsIndex) : paramsObject["*"];
|
|
30
|
-
if (!Array.isArray(values) || !values.length) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
`Cannot make URL for "${pattern}". Invalid value provided for the wildcard param`
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
uriSegments.push(`${values.join("/")}${token.end}`);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
const paramName = token.val;
|
|
39
|
-
const value = paramsArray ? paramsArray[paramsIndex] : paramsObject[paramName];
|
|
40
|
-
const isDefined = value !== void 0 && value !== null;
|
|
41
|
-
if (token.type === 1 && !isDefined) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
`Cannot make URL for "${pattern}". Missing value for the "${paramName}" param`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
if (isDefined) {
|
|
47
|
-
uriSegments.push(`${value}${token.end}`);
|
|
48
|
-
}
|
|
49
|
-
paramsIndex++;
|
|
50
|
-
}
|
|
51
|
-
let URI = `/${uriSegments.join("/")}`;
|
|
52
|
-
if (options?.prefixUrl) {
|
|
53
|
-
URI = `${options?.prefixUrl.replace(/\/$/, "")}${URI}`;
|
|
54
|
-
}
|
|
55
|
-
if (options?.qs) {
|
|
56
|
-
const queryString = searchParamsStringifier(options?.qs);
|
|
57
|
-
URI = queryString ? `${URI}?${queryString}` : URI;
|
|
58
|
-
}
|
|
59
|
-
return URI;
|
|
60
|
-
}
|
|
61
|
-
function createSignedURL(identifier, tokens, searchParamsStringifier, encryption, params, options) {
|
|
62
|
-
const signature = encryption.verifier.sign(
|
|
63
|
-
createURL(identifier, tokens, searchParamsStringifier, params, {
|
|
64
|
-
...options,
|
|
65
|
-
prefixUrl: void 0
|
|
66
|
-
}),
|
|
67
|
-
options?.expiresIn,
|
|
68
|
-
options?.purpose
|
|
69
|
-
);
|
|
70
|
-
return createURL(identifier, tokens, searchParamsStringifier, params, {
|
|
71
|
-
...options,
|
|
72
|
-
qs: { ...options?.qs, signature }
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function matchRoute(url, patterns) {
|
|
76
|
-
const tokensBucket = patterns.map((pattern) => parseRoute(pattern));
|
|
77
|
-
const match = matchit.match(url, tokensBucket);
|
|
78
|
-
if (!match.length) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
return matchit.exec(url, match);
|
|
82
|
-
}
|
|
83
|
-
function serializeCookie(key, value, options) {
|
|
84
|
-
let expires;
|
|
85
|
-
let maxAge;
|
|
86
|
-
if (options) {
|
|
87
|
-
expires = typeof options.expires === "function" ? options.expires() : options.expires;
|
|
88
|
-
maxAge = options.maxAge ? string.seconds.parse(options.maxAge) : void 0;
|
|
89
|
-
}
|
|
90
|
-
return cookie.serialize(key, value, { ...options, maxAge, expires });
|
|
91
|
-
}
|
|
92
|
-
async function middlewareInfo(middleware) {
|
|
93
|
-
if (typeof middleware === "function") {
|
|
94
|
-
return {
|
|
95
|
-
type: "closure",
|
|
96
|
-
name: middleware.name || "closure"
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if ("args" in middleware) {
|
|
100
|
-
return {
|
|
101
|
-
type: "named",
|
|
102
|
-
name: middleware.name,
|
|
103
|
-
args: middleware.args,
|
|
104
|
-
...await parseBindingReference([middleware.reference])
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
type: "global",
|
|
109
|
-
name: middleware.name,
|
|
110
|
-
...await parseBindingReference([middleware.reference])
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
async function routeInfo(route) {
|
|
114
|
-
return "reference" in route.handler ? {
|
|
115
|
-
type: "controller",
|
|
116
|
-
...await parseBindingReference(route.handler.reference)
|
|
117
|
-
} : {
|
|
118
|
-
type: "closure",
|
|
119
|
-
name: route.handler.name || "closure",
|
|
120
|
-
args: "listArgs" in route.handler ? String(route.handler.listArgs) : void 0
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export {
|
|
125
|
-
__export,
|
|
126
|
-
parseRoute,
|
|
127
|
-
createURL,
|
|
128
|
-
createSignedURL,
|
|
129
|
-
matchRoute,
|
|
130
|
-
serializeCookie,
|
|
131
|
-
middlewareInfo,
|
|
132
|
-
routeInfo,
|
|
133
|
-
default2 as default,
|
|
134
|
-
default3 as default2
|
|
135
|
-
};
|