@adonisjs/http-server 6.8.2-0 → 6.8.2-2
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/src/request.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import cuid from 'cuid';
|
|
2
1
|
import fresh from 'fresh';
|
|
3
2
|
import typeIs from 'type-is';
|
|
4
3
|
import accepts from 'accepts';
|
|
@@ -8,6 +7,7 @@ import proxyaddr from 'proxy-addr';
|
|
|
8
7
|
import { safeEqual } from '@poppinss/utils';
|
|
9
8
|
import Macroable from '@poppinss/macroable';
|
|
10
9
|
import lodash from '@poppinss/utils/lodash';
|
|
10
|
+
import { createId } from '@paralleldrive/cuid2';
|
|
11
11
|
import { parse } from 'node:url';
|
|
12
12
|
import { trustProxy } from './helpers.js';
|
|
13
13
|
import { CookieParser } from './cookies/parser.js';
|
|
@@ -53,7 +53,7 @@ export class Request extends Macroable {
|
|
|
53
53
|
id() {
|
|
54
54
|
let requestId = this.header('x-request-id');
|
|
55
55
|
if (!requestId && this.#config.generateRequestId) {
|
|
56
|
-
requestId =
|
|
56
|
+
requestId = createId();
|
|
57
57
|
this.request.headers['x-request-id'] = requestId;
|
|
58
58
|
}
|
|
59
59
|
return requestId;
|
|
@@ -23,7 +23,7 @@ export class BriskRoute extends Macroable {
|
|
|
23
23
|
return this.route;
|
|
24
24
|
}
|
|
25
25
|
redirect(identifier, params, options) {
|
|
26
|
-
return this.setHandler(async (ctx)
|
|
26
|
+
return this.setHandler(async function redirectsToRoute(ctx) {
|
|
27
27
|
const redirector = ctx.response.redirect();
|
|
28
28
|
if (options?.status) {
|
|
29
29
|
redirector.status(options.status);
|
|
@@ -32,7 +32,7 @@ export class BriskRoute extends Macroable {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
redirectToPath(url, options) {
|
|
35
|
-
return this.setHandler(async (ctx)
|
|
35
|
+
return this.setHandler(async function redirectsToPath(ctx) {
|
|
36
36
|
const redirector = ctx.response.redirect();
|
|
37
37
|
if (options?.status) {
|
|
38
38
|
redirector.status(options.status);
|
|
@@ -29,8 +29,8 @@ export declare class Router extends LookupStore {
|
|
|
29
29
|
patch<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
|
|
30
30
|
delete<T extends Constructor<any>>(pattern: string, handler: string | RouteFn | [LazyImport<T> | T, GetControllerHandlers<T>?]): Route<T>;
|
|
31
31
|
group(callback: () => void): RouteGroup;
|
|
32
|
-
resource(resource: string, controller: string): RouteResource;
|
|
33
|
-
shallowResource(resource: string, controller: string): RouteResource;
|
|
32
|
+
resource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource;
|
|
33
|
+
shallowResource(resource: string, controller: string | LazyImport<Constructor<any>> | Constructor<any>): RouteResource;
|
|
34
34
|
on(pattern: string): BriskRoute;
|
|
35
35
|
where(param: string, matcher: RouteMatcher | string | RegExp): this;
|
|
36
36
|
commit(): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Macroable from '@poppinss/macroable';
|
|
2
2
|
import type { Application } from '@adonisjs/application';
|
|
3
3
|
import { Route } from './route.js';
|
|
4
|
+
import type { Constructor, LazyImport } from '../types/base.js';
|
|
4
5
|
import type { ParsedGlobalMiddleware } from '../types/middleware.js';
|
|
5
6
|
import type { ResourceActionNames, RouteMatcher, RouteMatchers } from '../types/route.js';
|
|
6
7
|
export declare class RouteResource extends Macroable {
|
|
@@ -8,7 +9,7 @@ export declare class RouteResource extends Macroable {
|
|
|
8
9
|
routes: Route[];
|
|
9
10
|
constructor(app: Application<any>, routerMiddleware: ParsedGlobalMiddleware[], options: {
|
|
10
11
|
resource: string;
|
|
11
|
-
controller: string
|
|
12
|
+
controller: string | LazyImport<Constructor<any>> | Constructor<any>;
|
|
12
13
|
globalMatchers: RouteMatchers;
|
|
13
14
|
shallow: boolean;
|
|
14
15
|
});
|
|
@@ -42,7 +42,9 @@ export class RouteResource extends Macroable {
|
|
|
42
42
|
const route = new Route(this.#app, this.#routerMiddleware, {
|
|
43
43
|
pattern,
|
|
44
44
|
methods,
|
|
45
|
-
handler:
|
|
45
|
+
handler: typeof this.#controller === 'string'
|
|
46
|
+
? `${this.#controller}.${action}`
|
|
47
|
+
: [this.#controller, action],
|
|
46
48
|
globalMatchers: this.#globalMatchers,
|
|
47
49
|
});
|
|
48
50
|
route.as(`${this.#routesBaseName}.${action}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "6.8.2-
|
|
3
|
+
"version": "6.8.2-2",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@adonisjs/application": "^7.1.2-0",
|
|
43
|
-
"@adonisjs/config": "^4.2.1-0",
|
|
44
43
|
"@adonisjs/encryption": "^5.1.2-0",
|
|
45
44
|
"@adonisjs/events": "^8.4.9-0",
|
|
46
45
|
"@adonisjs/fold": "^9.9.3-0",
|
|
@@ -48,13 +47,12 @@
|
|
|
48
47
|
"@commitlint/cli": "^17.4.4",
|
|
49
48
|
"@commitlint/config-conventional": "^17.4.4",
|
|
50
49
|
"@fastify/middie": "^8.1.0",
|
|
51
|
-
"@japa/api-client": "^1.4.4",
|
|
52
50
|
"@japa/assert": "^1.4.1",
|
|
53
51
|
"@japa/expect-type": "^1.0.3",
|
|
54
52
|
"@japa/run-failed-tests": "^1.1.1",
|
|
55
53
|
"@japa/runner": "^2.5.1",
|
|
56
54
|
"@japa/spec-reporter": "^1.3.3",
|
|
57
|
-
"@swc/core": "^1.3.
|
|
55
|
+
"@swc/core": "^1.3.39",
|
|
58
56
|
"@types/accepts": "^1.3.5",
|
|
59
57
|
"@types/content-disposition": "^0.5.5",
|
|
60
58
|
"@types/cookie": "^0.5.1",
|
|
@@ -65,6 +63,7 @@
|
|
|
65
63
|
"@types/fs-extra": "^11.0.1",
|
|
66
64
|
"@types/http-status-codes": "^1.2.0",
|
|
67
65
|
"@types/mime-types": "^2.1.1",
|
|
66
|
+
"@types/node": "^18.15.0",
|
|
68
67
|
"@types/on-finished": "^2.3.1",
|
|
69
68
|
"@types/pem": "^1.9.6",
|
|
70
69
|
"@types/proxy-addr": "^2.0.0",
|
|
@@ -76,13 +75,13 @@
|
|
|
76
75
|
"c8": "^7.13.0",
|
|
77
76
|
"cross-env": "^7.0.3",
|
|
78
77
|
"del-cli": "^5.0.0",
|
|
79
|
-
"eslint": "^8.
|
|
80
|
-
"eslint-config-prettier": "^8.
|
|
78
|
+
"eslint": "^8.36.0",
|
|
79
|
+
"eslint-config-prettier": "^8.7.0",
|
|
81
80
|
"eslint-plugin-adonis": "^3.0.3",
|
|
82
81
|
"eslint-plugin-prettier": "^4.2.1",
|
|
83
|
-
"fastify": "^4.14.
|
|
82
|
+
"fastify": "^4.14.1",
|
|
84
83
|
"fs-extra": "^11.1.0",
|
|
85
|
-
"github-label-sync": "^2.
|
|
84
|
+
"github-label-sync": "^2.3.1",
|
|
86
85
|
"http-status-codes": "^2.2.0",
|
|
87
86
|
"husky": "^8.0.3",
|
|
88
87
|
"np": "^7.6.3",
|
|
@@ -94,15 +93,15 @@
|
|
|
94
93
|
"typescript": "^4.9.5"
|
|
95
94
|
},
|
|
96
95
|
"dependencies": {
|
|
96
|
+
"@paralleldrive/cuid2": "^2.2.0",
|
|
97
97
|
"@poppinss/macroable": "^1.0.0-2",
|
|
98
98
|
"@poppinss/matchit": "^3.1.2",
|
|
99
|
-
"@poppinss/middleware": "^3.1.
|
|
99
|
+
"@poppinss/middleware": "^3.1.1",
|
|
100
100
|
"@poppinss/utils": "^6.5.0-0",
|
|
101
101
|
"@sindresorhus/is": "^5.3.0",
|
|
102
102
|
"accepts": "^1.3.8",
|
|
103
103
|
"content-disposition": "^0.5.4",
|
|
104
104
|
"cookie": "^0.5.0",
|
|
105
|
-
"cuid": "^3.0.0",
|
|
106
105
|
"destroy": "^1.2.0",
|
|
107
106
|
"encodeurl": "^1.0.2",
|
|
108
107
|
"etag": "^1.8.1",
|
|
@@ -110,7 +109,7 @@
|
|
|
110
109
|
"mime-types": "^2.1.35",
|
|
111
110
|
"on-finished": "^2.4.1",
|
|
112
111
|
"proxy-addr": "^2.0.7",
|
|
113
|
-
"qs": "^6.11.
|
|
112
|
+
"qs": "^6.11.1",
|
|
114
113
|
"tmp-cache": "^1.1.0",
|
|
115
114
|
"type-is": "^1.6.18",
|
|
116
115
|
"vary": "^1.1.2",
|