@adonisjs/http-server 8.0.0-next.6 → 8.0.0-next.8
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-7ROFCP6L.js → chunk-W6WKITGF.js} +11 -19
- package/build/factories/main.js +1 -1
- package/build/index.js +1 -1
- package/build/src/cookies/serializer.d.ts +1 -2
- package/build/src/redirect.d.ts +44 -7
- package/build/src/response.d.ts +23 -6
- package/build/src/router/group.d.ts +1 -1
- package/build/src/router/legacy/url_builder.d.ts +7 -14
- package/build/src/router/main.d.ts +1 -3
- package/build/src/router/resource.d.ts +1 -1
- package/build/src/router/route.d.ts +1 -1
- package/build/src/types/middleware.d.ts +1 -1
- package/build/src/types/route.d.ts +2 -4
- package/package.json +10 -10
|
@@ -739,7 +739,7 @@ var RouteResource = class extends Macroable2 {
|
|
|
739
739
|
return this;
|
|
740
740
|
}
|
|
741
741
|
/**
|
|
742
|
-
* @
|
|
742
|
+
* Alias for {@link RouteResource.use}
|
|
743
743
|
* @param actions - Action name(s) or '*' for all actions
|
|
744
744
|
* @param middleware - Middleware function(s) to apply
|
|
745
745
|
* @returns Current RouteResource instance for method chaining
|
|
@@ -958,7 +958,7 @@ var RouteGroup = class _RouteGroup extends Macroable3 {
|
|
|
958
958
|
return this;
|
|
959
959
|
}
|
|
960
960
|
/**
|
|
961
|
-
* @
|
|
961
|
+
* Alias for {@link RouteGroup.use}
|
|
962
962
|
* @param middleware - Middleware function(s) to apply to all routes in the group
|
|
963
963
|
* @returns Current RouteGroup instance for method chaining
|
|
964
964
|
*/
|
|
@@ -1290,7 +1290,7 @@ var Route = class extends Macroable4 {
|
|
|
1290
1290
|
return this;
|
|
1291
1291
|
}
|
|
1292
1292
|
/**
|
|
1293
|
-
* @
|
|
1293
|
+
* Alias for {@link Route.use}
|
|
1294
1294
|
*/
|
|
1295
1295
|
middleware(middleware) {
|
|
1296
1296
|
return this.use(middleware);
|
|
@@ -4097,8 +4097,7 @@ var UrlBuilder = class {
|
|
|
4097
4097
|
}
|
|
4098
4098
|
/**
|
|
4099
4099
|
* Prefix a custom base URL to the final URI
|
|
4100
|
-
* @deprecated
|
|
4101
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4100
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
4102
4101
|
*/
|
|
4103
4102
|
prefixUrl(url) {
|
|
4104
4103
|
this.#baseUrl = url;
|
|
@@ -4107,8 +4106,7 @@ var UrlBuilder = class {
|
|
|
4107
4106
|
/**
|
|
4108
4107
|
* Disable route lookup. Calling this method considers
|
|
4109
4108
|
* the "identifier" as the route pattern
|
|
4110
|
-
* @deprecated
|
|
4111
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4109
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
4112
4110
|
*/
|
|
4113
4111
|
disableRouteLookup() {
|
|
4114
4112
|
this.#shouldPerformLookup = false;
|
|
@@ -4116,8 +4114,7 @@ var UrlBuilder = class {
|
|
|
4116
4114
|
}
|
|
4117
4115
|
/**
|
|
4118
4116
|
* Append query string to the final URI
|
|
4119
|
-
* @deprecated
|
|
4120
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4117
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
4121
4118
|
*/
|
|
4122
4119
|
qs(queryString) {
|
|
4123
4120
|
if (!queryString) {
|
|
@@ -4128,8 +4125,7 @@ var UrlBuilder = class {
|
|
|
4128
4125
|
}
|
|
4129
4126
|
/**
|
|
4130
4127
|
* Specify params to apply to the route pattern
|
|
4131
|
-
* @deprecated
|
|
4132
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4128
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
4133
4129
|
*/
|
|
4134
4130
|
params(params) {
|
|
4135
4131
|
if (!params) {
|
|
@@ -4143,8 +4139,7 @@ var UrlBuilder = class {
|
|
|
4143
4139
|
* route name, controller.method name or the route pattern
|
|
4144
4140
|
* itself.
|
|
4145
4141
|
*
|
|
4146
|
-
* @deprecated
|
|
4147
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4142
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
4148
4143
|
* @param identifier - Route identifier to generate URL for
|
|
4149
4144
|
* @returns Generated URL string
|
|
4150
4145
|
*/
|
|
@@ -4161,8 +4156,7 @@ var UrlBuilder = class {
|
|
|
4161
4156
|
* route name, controller.method name or the route pattern
|
|
4162
4157
|
* itself.
|
|
4163
4158
|
*
|
|
4164
|
-
* @deprecated
|
|
4165
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4159
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
4166
4160
|
*
|
|
4167
4161
|
*/
|
|
4168
4162
|
makeSigned(identifier, options) {
|
|
@@ -4778,7 +4772,7 @@ var Router = class {
|
|
|
4778
4772
|
(domain) => this.routes[domain].forEach((route) => trackRoute.bind(this)(route, domain))
|
|
4779
4773
|
);
|
|
4780
4774
|
return Object.keys(routesList).reduce((result, method) => {
|
|
4781
|
-
result.push(`${" ".repeat(indentation)}
|
|
4775
|
+
result.push(`${" ".repeat(indentation)}${method}: {`);
|
|
4782
4776
|
Object.keys(routesList[method]).forEach((identifier) => {
|
|
4783
4777
|
const key = `'${identifier}'`;
|
|
4784
4778
|
const { paramsTuple, hasRequiredParams, params } = routesList[method][identifier];
|
|
@@ -4810,9 +4804,7 @@ var Router = class {
|
|
|
4810
4804
|
}
|
|
4811
4805
|
/**
|
|
4812
4806
|
* Create URL builder instance.
|
|
4813
|
-
* @deprecated
|
|
4814
|
-
*
|
|
4815
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
4807
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
4816
4808
|
*/
|
|
4817
4809
|
builder() {
|
|
4818
4810
|
return new UrlBuilder(this);
|
package/build/factories/main.js
CHANGED
package/build/index.js
CHANGED
|
@@ -31,8 +31,7 @@ export declare class CookieSerializer {
|
|
|
31
31
|
*/
|
|
32
32
|
encode(key: string, value: any, options?: Partial<CookieOptions & {
|
|
33
33
|
/**
|
|
34
|
-
* @depreacted
|
|
35
|
-
* Instead use stringify option
|
|
34
|
+
* @depreacted Instead use stringify option
|
|
36
35
|
*/
|
|
37
36
|
encode: boolean;
|
|
38
37
|
stringify: boolean;
|
package/build/src/redirect.d.ts
CHANGED
|
@@ -28,16 +28,53 @@ export declare class Redirect {
|
|
|
28
28
|
*/
|
|
29
29
|
clearQs(): this;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @
|
|
37
|
-
*
|
|
31
|
+
* Forwards the current request's query string to the redirect URL
|
|
32
|
+
*
|
|
33
|
+
* Use this overload when you want to preserve all existing query parameters
|
|
34
|
+
* from the current request in the redirect URL.
|
|
35
|
+
*
|
|
36
|
+
* @returns The Redirect instance for method chaining
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* // If current URL is '/search?q=hello&page=2'
|
|
41
|
+
* response.redirect().withQs().toPath('/results')
|
|
42
|
+
* // Redirects to: '/results?q=hello&page=2'
|
|
43
|
+
* ```
|
|
38
44
|
*/
|
|
39
45
|
withQs(): this;
|
|
46
|
+
/**
|
|
47
|
+
* Adds multiple query string parameters to the redirect URL
|
|
48
|
+
*
|
|
49
|
+
* Use this overload when you want to add several query parameters at once
|
|
50
|
+
* using an object with key-value pairs.
|
|
51
|
+
*
|
|
52
|
+
* @param values - Object containing query parameter names and values
|
|
53
|
+
* @returns The Redirect instance for method chaining
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* response.redirect().withQs({ page: 1, sort: 'name' }).toPath('/users')
|
|
58
|
+
* // Redirects to: '/users?page=1&sort=name'
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
40
61
|
withQs(values: Record<string, any>): this;
|
|
62
|
+
/**
|
|
63
|
+
* Adds a single query string parameter to the redirect URL
|
|
64
|
+
*
|
|
65
|
+
* Use this overload when you want to add just one query parameter
|
|
66
|
+
* with a specific name and value.
|
|
67
|
+
*
|
|
68
|
+
* @param name - The query parameter name
|
|
69
|
+
* @param value - The query parameter value
|
|
70
|
+
* @returns The Redirect instance for method chaining
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* response.redirect().withQs('success', 'true').toPath('/dashboard')
|
|
75
|
+
* // Redirects to: '/dashboard?success=true'
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
41
78
|
withQs(name: string, value: any): this;
|
|
42
79
|
/**
|
|
43
80
|
* Redirects to the previous path using the Referer header
|
package/build/src/response.d.ts
CHANGED
|
@@ -458,21 +458,38 @@ export declare class Response extends Macroable {
|
|
|
458
458
|
*/
|
|
459
459
|
location(url: string): this;
|
|
460
460
|
/**
|
|
461
|
-
*
|
|
461
|
+
* Returns a Redirect instance for fluent API usage
|
|
462
462
|
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
* @returns Redirect instance
|
|
463
|
+
* Use this overload when you want to use methods like `.toRoute()`, `.back()`,
|
|
464
|
+
* `.withQs()`, or other redirect builder methods.
|
|
465
|
+
*
|
|
466
|
+
* @returns Redirect instance for chaining redirect methods
|
|
467
467
|
*
|
|
468
468
|
* @example
|
|
469
469
|
* ```ts
|
|
470
|
-
* response.redirect('/dashboard')
|
|
471
470
|
* response.redirect().toRoute('users.show', { id: 1 })
|
|
472
471
|
* response.redirect().back()
|
|
472
|
+
* response.redirect().withQs().toPath('/dashboard')
|
|
473
473
|
* ```
|
|
474
474
|
*/
|
|
475
475
|
redirect(): Redirect;
|
|
476
|
+
/**
|
|
477
|
+
* Performs an immediate redirect to the specified path
|
|
478
|
+
*
|
|
479
|
+
* This overload directly redirects the request with the provided parameters.
|
|
480
|
+
* Use this when you have a simple redirect without needing the fluent API.
|
|
481
|
+
*
|
|
482
|
+
* @param path - The path or URL to redirect to (use 'back' for referrer redirect)
|
|
483
|
+
* @param forwardQueryString - Whether to forward current query string parameters
|
|
484
|
+
* @param statusCode - HTTP status code for redirect (defaults to 302 Found)
|
|
485
|
+
*
|
|
486
|
+
* @example
|
|
487
|
+
* ```ts
|
|
488
|
+
* response.redirect('/dashboard')
|
|
489
|
+
* response.redirect('/users', true, 301) // with query forwarding and 301 status
|
|
490
|
+
* response.redirect('back') // redirect to referrer
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
476
493
|
redirect(path: string, forwardQueryString?: boolean, statusCode?: number): void;
|
|
477
494
|
/**
|
|
478
495
|
* Aborts the request with a custom response body and status code
|
|
@@ -74,7 +74,7 @@ export declare class RouteGroup extends Macroable {
|
|
|
74
74
|
*/
|
|
75
75
|
use(middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
|
|
76
76
|
/**
|
|
77
|
-
* @
|
|
77
|
+
* Alias for {@link RouteGroup.use}
|
|
78
78
|
* @param middleware - Middleware function(s) to apply to all routes in the group
|
|
79
79
|
* @returns Current RouteGroup instance for method chaining
|
|
80
80
|
*/
|
|
@@ -12,8 +12,7 @@ import { type Router } from '../main.ts';
|
|
|
12
12
|
* .make('categories.posts.index')
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
-
* @deprecated
|
|
16
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
15
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
17
16
|
*/
|
|
18
17
|
export declare class UrlBuilder {
|
|
19
18
|
#private;
|
|
@@ -25,27 +24,23 @@ export declare class UrlBuilder {
|
|
|
25
24
|
constructor(router: Router, domain?: string);
|
|
26
25
|
/**
|
|
27
26
|
* Prefix a custom base URL to the final URI
|
|
28
|
-
* @deprecated
|
|
29
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
27
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
30
28
|
*/
|
|
31
29
|
prefixUrl(url: string): this;
|
|
32
30
|
/**
|
|
33
31
|
* Disable route lookup. Calling this method considers
|
|
34
32
|
* the "identifier" as the route pattern
|
|
35
|
-
* @deprecated
|
|
36
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
33
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
37
34
|
*/
|
|
38
35
|
disableRouteLookup(): this;
|
|
39
36
|
/**
|
|
40
37
|
* Append query string to the final URI
|
|
41
|
-
* @deprecated
|
|
42
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
38
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
43
39
|
*/
|
|
44
40
|
qs(queryString?: Record<string, any>): this;
|
|
45
41
|
/**
|
|
46
42
|
* Specify params to apply to the route pattern
|
|
47
|
-
* @deprecated
|
|
48
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
43
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
49
44
|
*/
|
|
50
45
|
params(params?: any[] | Record<string, any>): this;
|
|
51
46
|
/**
|
|
@@ -53,8 +48,7 @@ export declare class UrlBuilder {
|
|
|
53
48
|
* route name, controller.method name or the route pattern
|
|
54
49
|
* itself.
|
|
55
50
|
*
|
|
56
|
-
* @deprecated
|
|
57
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
51
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
58
52
|
* @param identifier - Route identifier to generate URL for
|
|
59
53
|
* @returns Generated URL string
|
|
60
54
|
*/
|
|
@@ -64,8 +58,7 @@ export declare class UrlBuilder {
|
|
|
64
58
|
* route name, controller.method name or the route pattern
|
|
65
59
|
* itself.
|
|
66
60
|
*
|
|
67
|
-
* @deprecated
|
|
68
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
61
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
69
62
|
*
|
|
70
63
|
*/
|
|
71
64
|
makeSigned(identifier: string, options?: {
|
|
@@ -261,9 +261,7 @@ export declare class Router {
|
|
|
261
261
|
match(uri: string, method: string, shouldDecodeParam: boolean, hostname?: string | null): null | MatchedRoute;
|
|
262
262
|
/**
|
|
263
263
|
* Create URL builder instance.
|
|
264
|
-
* @deprecated
|
|
265
|
-
*
|
|
266
|
-
* Instead use "@adonisjs/core/services/url_builder" instead
|
|
264
|
+
* @deprecated Instead use "@adonisjs/core/services/url_builder" instead
|
|
267
265
|
*/
|
|
268
266
|
builder(): UrlBuilder;
|
|
269
267
|
/**
|
|
@@ -83,7 +83,7 @@ export declare class RouteResource<ActionNames extends ResourceActionNames = Res
|
|
|
83
83
|
*/
|
|
84
84
|
use(actions: ActionNames | ActionNames[] | '*', middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
|
|
85
85
|
/**
|
|
86
|
-
* @
|
|
86
|
+
* Alias for {@link RouteResource.use}
|
|
87
87
|
* @param actions - Action name(s) or '*' for all actions
|
|
88
88
|
* @param middleware - Middleware function(s) to apply
|
|
89
89
|
* @returns Current RouteResource instance for method chaining
|
|
@@ -57,7 +57,7 @@ export declare class Route<Controller extends Constructor<any> = any> extends Ma
|
|
|
57
57
|
*/
|
|
58
58
|
use(middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
|
|
59
59
|
/**
|
|
60
|
-
* @
|
|
60
|
+
* Alias for {@link Route.use}
|
|
61
61
|
*/
|
|
62
62
|
middleware(middleware: OneOrMore<MiddlewareFn | ParsedNamedMiddleware>): this;
|
|
63
63
|
/**
|
|
@@ -2,6 +2,7 @@ import type { ContainerResolver } from '@adonisjs/fold';
|
|
|
2
2
|
import type { NextFn } from '@poppinss/middleware/types';
|
|
3
3
|
import type { Constructor, LazyImport } from '@poppinss/utils/types';
|
|
4
4
|
import type { HttpContext } from '../http_context/main.ts';
|
|
5
|
+
export { NextFn };
|
|
5
6
|
/**
|
|
6
7
|
* Middleware represented as a class constructor that implements a handle method
|
|
7
8
|
*/
|
|
@@ -92,4 +93,3 @@ export type RouteHandlerInfo = {
|
|
|
92
93
|
/** Module name or file path for the controller */
|
|
93
94
|
moduleNameOrPath: string;
|
|
94
95
|
};
|
|
95
|
-
export {};
|
|
@@ -168,8 +168,7 @@ export type RouteJSON = {
|
|
|
168
168
|
*/
|
|
169
169
|
export type ResourceActionNames = 'create' | 'index' | 'store' | 'show' | 'edit' | 'update' | 'destroy';
|
|
170
170
|
/**
|
|
171
|
-
* Options for URL generation (
|
|
172
|
-
* @deprecated
|
|
171
|
+
* @deprecated Options for URL generation (use URLBuilder instead)
|
|
173
172
|
*/
|
|
174
173
|
export type MakeUrlOptions = {
|
|
175
174
|
/** Query string parameters to append */
|
|
@@ -182,8 +181,7 @@ export type MakeUrlOptions = {
|
|
|
182
181
|
disableRouteLookup?: boolean;
|
|
183
182
|
};
|
|
184
183
|
/**
|
|
185
|
-
* Options for signed URL generation (
|
|
186
|
-
* @deprecated
|
|
184
|
+
* @deprecated Options for signed URL generation (use URLBuilder instead)
|
|
187
185
|
*/
|
|
188
186
|
export type MakeSignedUrlOptions = MakeUrlOptions & {
|
|
189
187
|
/** Expiration time for the signed URL */
|
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.8",
|
|
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.6.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.
|
|
83
|
-
"fs-extra": "^11.3.
|
|
80
|
+
"cross-env": "^10.1.0",
|
|
81
|
+
"eslint": "^9.36.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.
|
|
92
|
+
"typedoc": "^0.28.13",
|
|
93
93
|
"typescript": "^5.9.2",
|
|
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",
|