@adonisjs/http-server 8.0.0-next.9 → 8.1.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/chunk-B2GA45YG.js +35 -0
- package/build/define_config-t7GL92UR.js +5470 -0
- package/build/factories/http_context.d.ts +10 -4
- package/build/factories/main.d.ts +2 -2
- package/build/factories/main.js +328 -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-XD4_pfkD.js +108 -0
- package/build/helpers-aa47NQc6.js +1426 -0
- package/build/index.d.ts +2 -2
- package/build/index.js +330 -373
- 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 +131 -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 +5 -17
- package/build/src/helpers.js +4 -24
- 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 +2 -0
- package/build/src/types/request.d.ts +2 -1
- 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/package.json +57 -48
- package/build/chunk-CVZAIRWJ.js +0 -1222
- package/build/chunk-JD6QW4NQ.js +0 -4428
- package/build/src/router/url_builder.d.ts +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger } from '@adonisjs/logger';
|
|
2
2
|
import type { LazyImport } from '@poppinss/utils/types';
|
|
3
|
-
import type { Encryption } from '@
|
|
3
|
+
import type { Encryption } from '@boringnode/encryption';
|
|
4
4
|
import type { Server as HttpsServer } from 'node:https';
|
|
5
5
|
import type { Application } from '@adonisjs/application';
|
|
6
6
|
import type { EmitterLike } from '@adonisjs/events/types';
|
|
@@ -8,9 +8,9 @@ import { type ContainerResolver } from '@adonisjs/fold';
|
|
|
8
8
|
import type { ServerResponse, IncomingMessage, Server as HttpServer } from 'node:http';
|
|
9
9
|
import type { MiddlewareAsClass, ParsedGlobalMiddleware } from '../types/middleware.ts';
|
|
10
10
|
import type { ServerConfig, HttpServerEvents, ErrorHandlerAsAClass, TestingMiddlewarePipeline } from '../types/server.ts';
|
|
11
|
-
import {
|
|
12
|
-
import { Response } from '../response.ts';
|
|
11
|
+
import { HttpRequest } from '../request.ts';
|
|
13
12
|
import { Router } from '../router/main.ts';
|
|
13
|
+
import { HttpResponse } from '../response.ts';
|
|
14
14
|
import { HttpContext } from '../http_context/main.ts';
|
|
15
15
|
/**
|
|
16
16
|
* The Server class provides the core HTTP server implementation for AdonisJS.
|
|
@@ -105,7 +105,7 @@ export declare class Server {
|
|
|
105
105
|
* @param res - Node.js ServerResponse
|
|
106
106
|
* @returns New Request instance
|
|
107
107
|
*/
|
|
108
|
-
createRequest(req: IncomingMessage, res: ServerResponse):
|
|
108
|
+
createRequest(req: IncomingMessage, res: ServerResponse): HttpRequest;
|
|
109
109
|
/**
|
|
110
110
|
* Creates a Response instance from Node.js request/response objects
|
|
111
111
|
*
|
|
@@ -113,7 +113,7 @@ export declare class Server {
|
|
|
113
113
|
* @param res - Node.js ServerResponse
|
|
114
114
|
* @returns New Response instance
|
|
115
115
|
*/
|
|
116
|
-
createResponse(req: IncomingMessage, res: ServerResponse):
|
|
116
|
+
createResponse(req: IncomingMessage, res: ServerResponse): HttpResponse;
|
|
117
117
|
/**
|
|
118
118
|
* Creates an HttpContext instance with request-specific logger
|
|
119
119
|
*
|
|
@@ -122,7 +122,7 @@ export declare class Server {
|
|
|
122
122
|
* @param resolver - Container resolver for dependency injection
|
|
123
123
|
* @returns New HttpContext instance
|
|
124
124
|
*/
|
|
125
|
-
createHttpContext(request:
|
|
125
|
+
createHttpContext(request: HttpRequest, response: HttpResponse, resolver: ContainerResolver<any>): HttpContext;
|
|
126
126
|
/**
|
|
127
127
|
* Gets the list of registered global middleware
|
|
128
128
|
*
|
package/build/src/types/main.js
CHANGED
|
@@ -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.
|
|
@@ -30,6 +30,11 @@ export type CastableHeader = string | number | boolean | string[] | number[] | b
|
|
|
30
30
|
* Configuration options for HTTP response handling and processing
|
|
31
31
|
*/
|
|
32
32
|
export type ResponseConfig = {
|
|
33
|
+
/**
|
|
34
|
+
* Define a custom serializer to serialize the response body
|
|
35
|
+
* to a JSON string
|
|
36
|
+
*/
|
|
37
|
+
serializeJSON(payload: unknown): string | undefined;
|
|
33
38
|
/**
|
|
34
39
|
* Whether or not to generate etags for responses. Etags can be
|
|
35
40
|
* enabled/disabled when sending response as well.
|
|
@@ -51,4 +56,4 @@ export type ResponseConfig = {
|
|
|
51
56
|
/**
|
|
52
57
|
* A readable stream that can be piped to the response stream method
|
|
53
58
|
*/
|
|
54
|
-
export type ResponseStream = Readable
|
|
59
|
+
export type ResponseStream = Readable | ReadableStream<any>;
|
|
@@ -4,6 +4,7 @@ import type { Constructor, LazyImport } from '@poppinss/utils/types';
|
|
|
4
4
|
import type { ServerErrorHandler } from './server.ts';
|
|
5
5
|
import type { HttpContext } from '../http_context/main.ts';
|
|
6
6
|
import type { MiddlewareFn, ParsedGlobalMiddleware } from './middleware.ts';
|
|
7
|
+
import { type ClientRouteJSON, type ClientRouteMatchItTokens } from '../client/types.ts';
|
|
7
8
|
/**
|
|
8
9
|
* Configuration for matching and casting route parameters
|
|
9
10
|
*/
|
|
@@ -16,16 +17,7 @@ export type RouteMatcher = {
|
|
|
16
17
|
/**
|
|
17
18
|
* Route token structure used internally by the matchit routing library
|
|
18
19
|
*/
|
|
19
|
-
export type MatchItRouteToken = RouteMatcher &
|
|
20
|
-
/** Original token string */
|
|
21
|
-
old: string;
|
|
22
|
-
/** Token type identifier (0=static, 1=param, 2=wildcard, 3=optional) */
|
|
23
|
-
type: 0 | 1 | 2 | 3;
|
|
24
|
-
/** Token value */
|
|
25
|
-
val: string;
|
|
26
|
-
/** Token end delimiter */
|
|
27
|
-
end: string;
|
|
28
|
-
};
|
|
20
|
+
export type MatchItRouteToken = RouteMatcher & ClientRouteMatchItTokens;
|
|
29
21
|
/**
|
|
30
22
|
* Extracts method names from a controller class that accept HttpContext as first parameter
|
|
31
23
|
*/
|
|
@@ -120,20 +112,12 @@ export type RouteMatchers = {
|
|
|
120
112
|
/**
|
|
121
113
|
* Complete route definition with all metadata, handlers, and execution context
|
|
122
114
|
*/
|
|
123
|
-
export type RouteJSON = {
|
|
115
|
+
export type RouteJSON = Pick<ClientRouteJSON, 'name' | 'methods' | 'domain' | 'pattern'> & {
|
|
124
116
|
/**
|
|
125
117
|
* The execute function to execute the route middleware
|
|
126
118
|
* and the handler
|
|
127
119
|
*/
|
|
128
120
|
execute: (route: RouteJSON, resolver: ContainerResolver<any>, ctx: HttpContext, errorResponder: ServerErrorHandler['handle']) => any;
|
|
129
|
-
/**
|
|
130
|
-
* A unique name for the route
|
|
131
|
-
*/
|
|
132
|
-
name?: string;
|
|
133
|
-
/**
|
|
134
|
-
* Route URI pattern
|
|
135
|
-
*/
|
|
136
|
-
pattern: string;
|
|
137
121
|
/**
|
|
138
122
|
* Route handler
|
|
139
123
|
*/
|
|
@@ -150,14 +134,6 @@ export type RouteJSON = {
|
|
|
150
134
|
* Tokens to be used to construct the route URL
|
|
151
135
|
*/
|
|
152
136
|
tokens: MatchItRouteToken[];
|
|
153
|
-
/**
|
|
154
|
-
* HTTP methods, the route responds to.
|
|
155
|
-
*/
|
|
156
|
-
methods: string[];
|
|
157
|
-
/**
|
|
158
|
-
* The domain for which the route is registered.
|
|
159
|
-
*/
|
|
160
|
-
domain: string;
|
|
161
137
|
/**
|
|
162
138
|
* Matchers for route params.
|
|
163
139
|
*/
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { type Prettify } from '@poppinss/utils/types';
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for URL generation helpers
|
|
7
|
-
*/
|
|
8
|
-
export type URLOptions = {
|
|
9
|
-
/** Query string parameters to append to the URL */
|
|
10
|
-
qs?: Record<string, any>;
|
|
11
|
-
/** URL prefix to prepend to the generated URL */
|
|
12
|
-
prefixUrl?: string;
|
|
13
|
-
};
|
|
1
|
+
import { type UrlFor, type LookupList, type URLOptions, type LookupListRoute, type RouteBuilderArguments } from '../client/types.ts';
|
|
2
|
+
export { URLOptions, LookupListRoute, RouteBuilderArguments, LookupList, UrlFor };
|
|
14
3
|
/**
|
|
15
4
|
* Configuration options for signed URL generation helpers
|
|
16
5
|
*/
|
|
@@ -20,133 +9,6 @@ export type SignedURLOptions = URLOptions & {
|
|
|
20
9
|
/** Purpose identifier for the signed URL */
|
|
21
10
|
purpose?: string;
|
|
22
11
|
};
|
|
23
|
-
/**
|
|
24
|
-
* Utility type that constructs function arguments for route URL builders based on route parameters
|
|
25
|
-
*/
|
|
26
|
-
export type RouteBuilderArguments<Identifier, Route, Options extends any = URLOptions> = Route extends LookupListRoute ? Prettify<Route['params'] extends undefined ? [identifier: Identifier, params?: undefined, options?: Options] : [undefined] extends [Route['params']] ? [
|
|
27
|
-
identifier: Identifier,
|
|
28
|
-
params?: Route['params'] | Route['paramsTuple'],
|
|
29
|
-
options?: Options
|
|
30
|
-
] : [
|
|
31
|
-
identifier: Identifier,
|
|
32
|
-
params: Route['params'] | Route['paramsTuple'],
|
|
33
|
-
options?: Options
|
|
34
|
-
]> : never;
|
|
35
|
-
/**
|
|
36
|
-
* LookupList type is used by the URLBuilder to provide
|
|
37
|
-
* type-safety when creating URLs.
|
|
38
|
-
*
|
|
39
|
-
* There is no runtime property that matches this type. Its
|
|
40
|
-
* purely for type-inference.
|
|
41
|
-
*/
|
|
42
|
-
/**
|
|
43
|
-
* Route definition structure for type-safe URL building
|
|
44
|
-
*/
|
|
45
|
-
export type LookupListRoute = {
|
|
46
|
-
/** Parameters as a tuple for positional arguments */
|
|
47
|
-
paramsTuple?: [...any[]];
|
|
48
|
-
/** Parameters as a named object */
|
|
49
|
-
params?: {
|
|
50
|
-
[name: string]: any;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Complete route lookup structure organized by HTTP methods and route identifiers
|
|
55
|
-
*/
|
|
56
|
-
export type LookupList = {
|
|
57
|
-
/** HTTP method to route mapping */
|
|
58
|
-
[method: string]: {
|
|
59
|
-
/** Route identifier to route definition mapping */
|
|
60
|
-
[identifier: string]: LookupListRoute;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* The urlFor helper is used to make URLs for pre-existing known routes. You can
|
|
65
|
-
* make a URL using the route name, route pattern, or the route controller
|
|
66
|
-
* reference (depends upon enabled lookupStrategies)
|
|
67
|
-
*
|
|
68
|
-
* ```ts
|
|
69
|
-
* urlFor('users.show', [1]) // /users/1
|
|
70
|
-
*
|
|
71
|
-
* // Lookup inside a specific domain
|
|
72
|
-
* urlFor('blog.adonisjs.com@posts.show', [1]) // /posts/1
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export type UrlFor<Routes extends LookupList, Options extends any = URLOptions> = (<Identifier extends keyof Routes['ALL'] & string>(...[identifier, params, options]: RouteBuilderArguments<Identifier, Routes['ALL'][Identifier], Options>) => string) & {
|
|
76
|
-
/**
|
|
77
|
-
* Make URL for a GET route. An error will be raised if the route doesn't
|
|
78
|
-
* exist.
|
|
79
|
-
*
|
|
80
|
-
* ```ts
|
|
81
|
-
* urlFor.get('users.show', [1]) // { method: 'get', url: '/users/1' }
|
|
82
|
-
* urlFor.get('users.store', [1]) // Error: Route not found GET@users/store
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
get<RouteIdentifier extends keyof Routes['GET'] & string>(...[identifier, params, options]: RouteBuilderArguments<RouteIdentifier, Routes['GET'][RouteIdentifier], Options>): {
|
|
86
|
-
method: 'get';
|
|
87
|
-
url: string;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Make URL for a POST route. An error will be raised if the route doesn't
|
|
91
|
-
* exist.
|
|
92
|
-
*
|
|
93
|
-
* ```ts
|
|
94
|
-
* urlFor.post('users.store') // { method: 'post', url: '/users' }
|
|
95
|
-
* urlFor.post('users.show', [1]) // Error: Route not found POST@users.show
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
post<RouteIdentifier extends keyof Routes['POST'] & string>(...[identifier, params, options]: RouteBuilderArguments<RouteIdentifier, Routes['POST'][RouteIdentifier], Options>): {
|
|
99
|
-
method: 'post';
|
|
100
|
-
url: string;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Make URL for a PUT route. An error will be raised if the route doesn't
|
|
104
|
-
* exist.
|
|
105
|
-
*
|
|
106
|
-
* ```ts
|
|
107
|
-
* urlFor.put('users.update', [1]) // { method: 'put', url: '/users/1' }
|
|
108
|
-
* urlFor.put('users.show', [1]) // Error: Route not found PUT@users.show
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
put<RouteIdentifier extends keyof Routes['PUT'] & string>(...[identifier, params, options]: RouteBuilderArguments<RouteIdentifier, Routes['PUT'][RouteIdentifier], Options>): {
|
|
112
|
-
method: 'put';
|
|
113
|
-
url: string;
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Make URL for a PATCH route. An error will be raised if the route doesn't
|
|
117
|
-
* exist.
|
|
118
|
-
*
|
|
119
|
-
* ```ts
|
|
120
|
-
* urlFor.put('users.update', [1]) // { method: 'patch', url: '/users/1' }
|
|
121
|
-
* urlFor.put('users.show', [1]) // Error: Route not found PATCH@users.show
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
patch<RouteIdentifier extends keyof Routes['PATCH'] & string>(...[identifier, params, options]: RouteBuilderArguments<RouteIdentifier, Routes['PATCH'][RouteIdentifier], Options>): {
|
|
125
|
-
method: 'patch';
|
|
126
|
-
url: string;
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Make URL for a DELETE route. An error will be raised if the route doesn't
|
|
130
|
-
* exist.
|
|
131
|
-
*
|
|
132
|
-
* ```ts
|
|
133
|
-
* urlFor.delete('users.destroy', [1]) // { method: 'delete', url: '/users/1' }
|
|
134
|
-
* urlFor.delete('users.show', [1]) // Error: Route not found DELETE@users.show
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
delete<RouteIdentifier extends keyof Routes['DELETE'] & string>(...[identifier, params, options]: RouteBuilderArguments<RouteIdentifier, Routes['DELETE'][RouteIdentifier], Options>): {
|
|
138
|
-
method: 'delete';
|
|
139
|
-
url: string;
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Make URL for a custom route method. An error will be raised if the route doesn't
|
|
143
|
-
* exist for the same method.
|
|
144
|
-
*/
|
|
145
|
-
method<Method extends keyof Routes & string, RouteIdentifier extends keyof Routes[Method] & string>(method: Method, ...[identifier, params, options]: RouteBuilderArguments<RouteIdentifier, Routes[Method][RouteIdentifier], Options>): {
|
|
146
|
-
method: Method;
|
|
147
|
-
url: string;
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
12
|
/**
|
|
151
13
|
* Utility type to extract routes for a specific HTTP method from the routes collection
|
|
152
14
|
*/
|
package/build/src/utils.d.ts
CHANGED
|
@@ -4,23 +4,88 @@ import { BriskRoute } from './router/brisk.ts';
|
|
|
4
4
|
import type { RouteJSON } from './types/route.ts';
|
|
5
5
|
import { RouteResource } from './router/resource.ts';
|
|
6
6
|
/**
|
|
7
|
-
* Makes input string consistent by having only the starting
|
|
8
|
-
*
|
|
7
|
+
* Makes input string consistent by having only the starting slash.
|
|
8
|
+
*
|
|
9
|
+
* Removes trailing slashes and ensures the path starts with a forward slash,
|
|
10
|
+
* except for the root path '/' which remains unchanged.
|
|
11
|
+
*
|
|
12
|
+
* @param input - The input path string to normalize
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* dropSlash('/users/') // '/users'
|
|
17
|
+
* dropSlash('users') // '/users'
|
|
18
|
+
* dropSlash('/') // '/'
|
|
19
|
+
* ```
|
|
9
20
|
*/
|
|
10
21
|
export declare function dropSlash(input: string): string;
|
|
11
22
|
/**
|
|
12
|
-
* Returns a flat list of routes from
|
|
23
|
+
* Returns a flat list of routes from route groups, resources, and brisk routes.
|
|
24
|
+
*
|
|
25
|
+
* This function recursively processes route collections, extracting individual routes
|
|
26
|
+
* from groups and resources while filtering out any deleted routes.
|
|
27
|
+
*
|
|
28
|
+
* @param routes - Array containing route groups, individual routes, resources, and brisk routes
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const flatRoutes = toRoutesJSON([
|
|
33
|
+
* routeGroup,
|
|
34
|
+
* singleRoute,
|
|
35
|
+
* resourceRoutes
|
|
36
|
+
* ])
|
|
37
|
+
* ```
|
|
13
38
|
*/
|
|
14
39
|
export declare function toRoutesJSON(routes: (RouteGroup | Route | RouteResource | BriskRoute)[]): RouteJSON[];
|
|
15
40
|
/**
|
|
16
|
-
* Helper to
|
|
17
|
-
*
|
|
41
|
+
* Helper to determine if a remote address should be trusted.
|
|
42
|
+
*
|
|
43
|
+
* Uses caching to avoid repeated expensive proxy function calls for the same
|
|
44
|
+
* remote address. The cache improves performance when the same addresses are
|
|
45
|
+
* checked multiple times.
|
|
46
|
+
*
|
|
47
|
+
* @param remoteAddress - The remote IP address to check
|
|
48
|
+
* @param proxyFn - Function that determines if an address should be trusted
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const isTrusted = trustProxy('192.168.1.1', proxyAddr.compile('loopback'))
|
|
53
|
+
* ```
|
|
18
54
|
*/
|
|
19
55
|
export declare function trustProxy(remoteAddress: string, proxyFn: (addr: string, distance: number) => boolean): boolean;
|
|
20
56
|
/**
|
|
21
|
-
* Parses a range expression
|
|
57
|
+
* Parses a range expression (e.g., '200..299') into an object with numeric keys.
|
|
58
|
+
*
|
|
59
|
+
* Supports both single values and ranges. For ranges, all numbers between
|
|
60
|
+
* the start and end (inclusive) are mapped to the provided value.
|
|
61
|
+
*
|
|
62
|
+
* @param range - Range expression as a string (e.g., '200', '200..299')
|
|
63
|
+
* @param value - Value to assign to each number in the range
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* parseRange('200', 'success') // { 200: 'success' }
|
|
68
|
+
* parseRange('200..202', 'success') // { 200: 'success', 201: 'success', 202: 'success' }
|
|
69
|
+
* ```
|
|
22
70
|
*/
|
|
23
71
|
export declare function parseRange<T>(range: string, value: T): Record<number, T>;
|
|
72
|
+
/**
|
|
73
|
+
* Safely decodes a URI path while handling special characters and query strings.
|
|
74
|
+
*
|
|
75
|
+
* This function carefully parses and decodes URI components, handling edge cases
|
|
76
|
+
* like double-encoded characters and non-standard query string delimiters.
|
|
77
|
+
* It separates the pathname from query parameters and determines whether
|
|
78
|
+
* route parameters should be decoded.
|
|
79
|
+
*
|
|
80
|
+
* @param path - The URI path to decode
|
|
81
|
+
* @param useSemicolonDelimiter - Whether to treat semicolons as query string delimiters
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const result = safeDecodeURI('/users/123?name=john', false)
|
|
86
|
+
* // Returns: { pathname: '/users/123', query: 'name=john', shouldDecodeParam: false }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
24
89
|
export declare function safeDecodeURI(path: string, useSemicolonDelimiter: boolean): {
|
|
25
90
|
pathname: string;
|
|
26
91
|
query: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.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.1",
|
|
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.3.1",
|
|
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.6",
|
|
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.5.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/
|
|
74
|
-
"@types/supertest": "^6.0.3",
|
|
74
|
+
"@types/supertest": "^7.2.0",
|
|
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.3",
|
|
83
|
+
"fastify": "^5.8.2",
|
|
84
|
+
"fs-extra": "^11.3.4",
|
|
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.
|
|
90
|
+
"release-it": "^19.2.4",
|
|
91
|
+
"supertest": "^7.2.2",
|
|
92
|
+
"tsdown": "^0.21.4",
|
|
93
|
+
"typedoc": "^0.28.17",
|
|
93
94
|
"typescript": "^5.9.3",
|
|
94
|
-
"youch": "^4.1.0
|
|
95
|
+
"youch": "^4.1.0"
|
|
95
96
|
},
|
|
96
97
|
"dependencies": {
|
|
97
|
-
"@poppinss/macroable": "^1.1.
|
|
98
|
+
"@poppinss/macroable": "^1.1.2",
|
|
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.1",
|
|
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
|
}
|