@adonisjs/http-server 8.0.0-next.7 → 8.0.0-next.9
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/chunk-CVZAIRWJ.js +1222 -0
- package/build/{chunk-3XEJZ4S4.js → chunk-JD6QW4NQ.js} +252 -1310
- package/build/factories/main.js +2 -2
- package/build/index.d.ts +1 -0
- package/build/index.js +10 -7
- package/build/src/helpers.d.ts +19 -0
- package/build/src/helpers.js +3 -1
- package/package.json +11 -11
- package/build/chunk-NQNHMINZ.js +0 -135
package/build/factories/main.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
Router,
|
|
7
7
|
Server,
|
|
8
8
|
defineConfig
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-JD6QW4NQ.js";
|
|
10
|
+
import "../chunk-CVZAIRWJ.js";
|
|
11
11
|
|
|
12
12
|
// factories/router.ts
|
|
13
13
|
import { AppFactory } from "@adonisjs/application/factories";
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BriskRoute,
|
|
3
2
|
CookieClient,
|
|
4
3
|
CookieParser,
|
|
5
4
|
CookieSerializer,
|
|
@@ -8,22 +7,25 @@ import {
|
|
|
8
7
|
E_HTTP_REQUEST_ABORTED,
|
|
9
8
|
E_ROUTE_NOT_FOUND,
|
|
10
9
|
HttpContext,
|
|
10
|
+
Qs,
|
|
11
11
|
Redirect,
|
|
12
12
|
Request,
|
|
13
13
|
Response,
|
|
14
14
|
ResponseStatus,
|
|
15
|
+
Router,
|
|
16
|
+
Server,
|
|
17
|
+
defineConfig,
|
|
18
|
+
errors_exports
|
|
19
|
+
} from "./chunk-JD6QW4NQ.js";
|
|
20
|
+
import {
|
|
21
|
+
BriskRoute,
|
|
15
22
|
Route,
|
|
16
23
|
RouteGroup,
|
|
17
24
|
RouteResource,
|
|
18
|
-
Router,
|
|
19
|
-
Server,
|
|
20
25
|
canWriteResponseBody,
|
|
21
|
-
defineConfig,
|
|
22
|
-
errors_exports,
|
|
23
26
|
parseRange,
|
|
24
27
|
tracing_channels_exports
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-NQNHMINZ.js";
|
|
28
|
+
} from "./chunk-CVZAIRWJ.js";
|
|
27
29
|
|
|
28
30
|
// src/exception_handler.ts
|
|
29
31
|
import is from "@sindresorhus/is";
|
|
@@ -358,6 +360,7 @@ export {
|
|
|
358
360
|
CookieSerializer,
|
|
359
361
|
ExceptionHandler,
|
|
360
362
|
HttpContext,
|
|
363
|
+
Qs,
|
|
361
364
|
Redirect,
|
|
362
365
|
Request,
|
|
363
366
|
Response,
|
package/build/src/helpers.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type CookieOptions } from './types/response.ts';
|
|
|
3
3
|
import { type SignedURLOptions, type URLOptions } from './types/url_builder.ts';
|
|
4
4
|
import type { RouteMatchers, RouteJSON, MatchItRouteToken } from './types/route.ts';
|
|
5
5
|
import { type MiddlewareFn, type RouteHandlerInfo, type MiddlewareHandlerInfo, type ParsedGlobalMiddleware, type ParsedNamedMiddleware } from './types/middleware.ts';
|
|
6
|
+
import { type Qs } from './qs.ts';
|
|
6
7
|
/**
|
|
7
8
|
* This function is similar to the intrinsic function encodeURI. However, it will not encode:
|
|
8
9
|
* - The \, ^, or | characters
|
|
@@ -106,3 +107,21 @@ export declare function middlewareInfo(middleware: MiddlewareFn | ParsedGlobalMi
|
|
|
106
107
|
* @returns {Promise<RouteHandlerInfo>} Promise resolving to route handler information
|
|
107
108
|
*/
|
|
108
109
|
export declare function routeInfo(route: RouteJSON): Promise<RouteHandlerInfo>;
|
|
110
|
+
/**
|
|
111
|
+
* Appends query string parameters to a URI. Existing query parameters
|
|
112
|
+
* in the URI are merged with the new ones.
|
|
113
|
+
*
|
|
114
|
+
* @param uri - The base URI to append query string to
|
|
115
|
+
* @param queryString - Object containing query parameters to append
|
|
116
|
+
* @param qsParser - Query string parser instance for stringify/parse operations
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const result = appendQueryString('/users', { page: 1, limit: 10 }, qsParser)
|
|
121
|
+
* // Returns: '/users?page=1&limit=10'
|
|
122
|
+
*
|
|
123
|
+
* const result2 = appendQueryString('/users?sort=name', { page: 1 }, qsParser)
|
|
124
|
+
* // Returns: '/users?sort=name&page=1'
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function appendQueryString(uri: string, queryString: Record<string, any>, qsParser: Qs): string;
|
package/build/src/helpers.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
appendQueryString,
|
|
2
3
|
createSignedURL,
|
|
3
4
|
createURL,
|
|
4
5
|
default as default2,
|
|
@@ -8,8 +9,9 @@ import {
|
|
|
8
9
|
parseRoute,
|
|
9
10
|
routeInfo,
|
|
10
11
|
serializeCookie
|
|
11
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-CVZAIRWJ.js";
|
|
12
13
|
export {
|
|
14
|
+
appendQueryString,
|
|
13
15
|
createSignedURL,
|
|
14
16
|
createURL,
|
|
15
17
|
default2 as encodeUrl,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "8.0.0-next.
|
|
3
|
+
"version": "8.0.0-next.9",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@types/fresh": "^0.5.3",
|
|
67
67
|
"@types/fs-extra": "^11.0.4",
|
|
68
68
|
"@types/mime-types": "^3.0.1",
|
|
69
|
-
"@types/node": "^24.
|
|
69
|
+
"@types/node": "^24.7.0",
|
|
70
70
|
"@types/on-finished": "^2.3.5",
|
|
71
71
|
"@types/pem": "^1.14.4",
|
|
72
72
|
"@types/proxy-addr": "^2.0.3",
|
|
@@ -77,28 +77,28 @@
|
|
|
77
77
|
"@vinejs/vine": "^3.0.1",
|
|
78
78
|
"autocannon": "^8.0.0",
|
|
79
79
|
"c8": "^10.1.3",
|
|
80
|
-
"cross-env": "^10.
|
|
81
|
-
"eslint": "^9.
|
|
82
|
-
"fastify": "^5.6.
|
|
83
|
-
"fs-extra": "^11.3.
|
|
80
|
+
"cross-env": "^10.1.0",
|
|
81
|
+
"eslint": "^9.37.0",
|
|
82
|
+
"fastify": "^5.6.1",
|
|
83
|
+
"fs-extra": "^11.3.2",
|
|
84
84
|
"get-port": "^7.1.0",
|
|
85
85
|
"http-status-codes": "^2.3.0",
|
|
86
86
|
"pem": "^1.14.8",
|
|
87
87
|
"prettier": "^3.6.2",
|
|
88
88
|
"reflect-metadata": "^0.2.2",
|
|
89
|
-
"release-it": "^19.0.
|
|
89
|
+
"release-it": "^19.0.5",
|
|
90
90
|
"supertest": "^7.1.4",
|
|
91
91
|
"tsup": "^8.5.0",
|
|
92
|
-
"typedoc": "^0.28.
|
|
93
|
-
"typescript": "^5.9.
|
|
92
|
+
"typedoc": "^0.28.13",
|
|
93
|
+
"typescript": "^5.9.3",
|
|
94
94
|
"youch": "^4.1.0-beta.11"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@poppinss/macroable": "^1.0
|
|
97
|
+
"@poppinss/macroable": "^1.1.0",
|
|
98
98
|
"@poppinss/matchit": "^3.2.0",
|
|
99
99
|
"@poppinss/middleware": "^3.2.6",
|
|
100
100
|
"@poppinss/utils": "^7.0.0-next.3",
|
|
101
|
-
"@sindresorhus/is": "^7.0
|
|
101
|
+
"@sindresorhus/is": "^7.1.0",
|
|
102
102
|
"accepts": "^1.3.8",
|
|
103
103
|
"content-disposition": "^0.5.4",
|
|
104
104
|
"cookie": "^1.0.2",
|
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
|
-
};
|