@adonisjs/http-server 7.0.0-2 → 7.0.0-4
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-Z63E3STR.js → chunk-5PZNIOSV.js} +7 -6
- package/build/chunk-5PZNIOSV.js.map +1 -0
- package/build/factories/http_server.d.ts +1 -0
- package/build/factories/main.js +1 -1
- package/build/index.js +1 -1
- package/build/src/define_middleware.d.ts +2 -1
- package/build/src/router/main.d.ts +3 -2
- package/build/src/server/main.d.ts +3 -3
- package/build/src/types/middleware.d.ts +3 -1
- package/build/src/types/server.d.ts +7 -1
- package/package.json +32 -32
- package/build/chunk-Z63E3STR.js.map +0 -1
package/build/factories/main.js
CHANGED
package/build/index.js
CHANGED
|
@@ -8,4 +8,5 @@ import type { GetMiddlewareArgs, MiddlewareAsClass, ParsedGlobalMiddleware } fro
|
|
|
8
8
|
export declare function defineNamedMiddleware<NamedMiddleware extends Record<string | number | symbol, LazyImport<MiddlewareAsClass>>>(collection: NamedMiddleware): { [K in keyof NamedMiddleware]: <Args extends GetMiddlewareArgs<UnWrapLazyImport<NamedMiddleware[K]>>>(...args: Args) => {
|
|
9
9
|
name: K;
|
|
10
10
|
args: Args[0];
|
|
11
|
-
|
|
11
|
+
handle: ParsedGlobalMiddleware['handle'];
|
|
12
|
+
}; };
|
|
@@ -8,7 +8,7 @@ import { RouteResource } from './resource.js';
|
|
|
8
8
|
import { LookupStore } from './lookup_store/main.js';
|
|
9
9
|
import { RouteMatchers as Matchers } from './matchers.js';
|
|
10
10
|
import type { Constructor, LazyImport } from '../types/base.js';
|
|
11
|
-
import type { MiddlewareAsClass
|
|
11
|
+
import type { MiddlewareAsClass } from '../types/middleware.js';
|
|
12
12
|
import type { RouteFn, MatchedRoute, RouteMatcher, RouteMatchers, MakeUrlOptions, MakeSignedUrlOptions, GetControllerHandlers } from '../types/route.js';
|
|
13
13
|
/**
|
|
14
14
|
* Router class exposes a unified API to register new routes, group them or
|
|
@@ -57,7 +57,8 @@ export declare class Router extends LookupStore {
|
|
|
57
57
|
named<NamedMiddleware extends Record<string, LazyImport<MiddlewareAsClass>>>(collection: NamedMiddleware): { [K in keyof NamedMiddleware]: <Args extends import("../types/middleware.js").GetMiddlewareArgs<import("../types/base.js").UnWrapLazyImport<NamedMiddleware[K]>>>(...args: Args) => {
|
|
58
58
|
name: K;
|
|
59
59
|
args: Args[0];
|
|
60
|
-
|
|
60
|
+
handle: (resolver: import("@adonisjs/fold").ContainerResolver<any>, ctx: import("../http_context/main.js").HttpContext, next: import("@poppinss/middleware/types").NextFn, params?: any) => any;
|
|
61
|
+
}; };
|
|
61
62
|
/**
|
|
62
63
|
* Add route for a given pattern and methods
|
|
63
64
|
*/
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import type { Logger } from '@adonisjs/logger';
|
|
4
|
-
import type { Emitter } from '@adonisjs/events';
|
|
5
4
|
import type { Encryption } from '@adonisjs/encryption';
|
|
6
5
|
import type { Server as HttpsServer } from 'node:https';
|
|
7
6
|
import type { Application } from '@adonisjs/application';
|
|
7
|
+
import type { EmitterLike } from '@adonisjs/events/types';
|
|
8
8
|
import { ContainerResolver } from '@adonisjs/fold';
|
|
9
9
|
import type { ServerResponse, IncomingMessage, Server as HttpServer } from 'node:http';
|
|
10
10
|
import type { LazyImport } from '../types/base.js';
|
|
11
11
|
import type { MiddlewareAsClass } from '../types/middleware.js';
|
|
12
|
-
import type { ServerConfig, ErrorHandlerAsAClass, TestingMiddlewarePipeline } from '../types/server.js';
|
|
12
|
+
import type { ServerConfig, HttpServerEvents, ErrorHandlerAsAClass, TestingMiddlewarePipeline } from '../types/server.js';
|
|
13
13
|
import { Request } from '../request.js';
|
|
14
14
|
import { Response } from '../response.js';
|
|
15
15
|
import { Router } from '../router/main.js';
|
|
@@ -24,7 +24,7 @@ export declare class Server {
|
|
|
24
24
|
* Know if async local storage is enabled or not.
|
|
25
25
|
*/
|
|
26
26
|
get usingAsyncLocalStorage(): boolean;
|
|
27
|
-
constructor(app: Application<any>, encryption: Encryption, emitter:
|
|
27
|
+
constructor(app: Application<any>, encryption: Encryption, emitter: EmitterLike<HttpServerEvents>, logger: Logger, config: ServerConfig);
|
|
28
28
|
/**
|
|
29
29
|
* Creates a pipeline of middleware.
|
|
30
30
|
*/
|
|
@@ -23,13 +23,15 @@ export type MiddlewareFn = (ctx: HttpContext, next: NextFn) => any;
|
|
|
23
23
|
* Parsed global middleware
|
|
24
24
|
*/
|
|
25
25
|
export type ParsedGlobalMiddleware = {
|
|
26
|
+
name?: string;
|
|
26
27
|
handle: (resolver: ContainerResolver<any>, ...args: [ctx: HttpContext, next: NextFn, params?: any]) => any;
|
|
27
28
|
};
|
|
28
29
|
/**
|
|
29
30
|
* Parsed named middleware
|
|
30
31
|
*/
|
|
31
|
-
export type ParsedNamedMiddleware =
|
|
32
|
+
export type ParsedNamedMiddleware = {
|
|
32
33
|
name: string;
|
|
34
|
+
handle: ParsedGlobalMiddleware['handle'];
|
|
33
35
|
args: any;
|
|
34
36
|
};
|
|
35
37
|
export {};
|
|
@@ -37,12 +37,18 @@ export type StatusPageRange = `${number}..${number}` | `${number}` | number;
|
|
|
37
37
|
*/
|
|
38
38
|
export type StatusPageRenderer = (error: HttpError, ctx: HttpContext) => any | Promise<any>;
|
|
39
39
|
/**
|
|
40
|
-
* Data type for the "http:
|
|
40
|
+
* Data type for the "http:request_completed" event
|
|
41
41
|
*/
|
|
42
42
|
export type HttpRequestFinishedPayload = {
|
|
43
43
|
ctx: HttpContext;
|
|
44
44
|
duration: [number, number];
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Events emitted by the HttpServer
|
|
48
|
+
*/
|
|
49
|
+
export type HttpServerEvents = {
|
|
50
|
+
'http:request_completed': HttpRequestFinishedPayload;
|
|
51
|
+
};
|
|
46
52
|
/**
|
|
47
53
|
* Error handler to handle HTTP errors
|
|
48
54
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-4",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -43,24 +43,24 @@
|
|
|
43
43
|
"author": "virk,adonisjs",
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@adonisjs/application": "^8.0.0-
|
|
47
|
-
"@adonisjs/encryption": "^5.1.2-
|
|
48
|
-
"@adonisjs/eslint-config": "^1.
|
|
49
|
-
"@adonisjs/events": "^9.0.0-
|
|
50
|
-
"@adonisjs/fold": "^9.9.3-
|
|
51
|
-
"@adonisjs/logger": "^5.4.2-
|
|
52
|
-
"@adonisjs/prettier-config": "^1.
|
|
53
|
-
"@adonisjs/tsconfig": "^1.
|
|
46
|
+
"@adonisjs/application": "^8.0.0-3",
|
|
47
|
+
"@adonisjs/encryption": "^5.1.2-5",
|
|
48
|
+
"@adonisjs/eslint-config": "^1.2.0",
|
|
49
|
+
"@adonisjs/events": "^9.0.0-2",
|
|
50
|
+
"@adonisjs/fold": "^9.9.3-12",
|
|
51
|
+
"@adonisjs/logger": "^5.4.2-8",
|
|
52
|
+
"@adonisjs/prettier-config": "^1.2.0",
|
|
53
|
+
"@adonisjs/tsconfig": "^1.2.0",
|
|
54
54
|
"@commitlint/cli": "^18.4.3",
|
|
55
55
|
"@commitlint/config-conventional": "^18.4.3",
|
|
56
56
|
"@fastify/middie": "^8.3.0",
|
|
57
|
-
"@japa/assert": "^2.0
|
|
58
|
-
"@japa/expect-type": "^2.0.
|
|
59
|
-
"@japa/runner": "^3.1.
|
|
60
|
-
"@swc/core": "^1.3.
|
|
57
|
+
"@japa/assert": "^2.1.0",
|
|
58
|
+
"@japa/expect-type": "^2.0.1",
|
|
59
|
+
"@japa/runner": "^3.1.1",
|
|
60
|
+
"@swc/core": "^1.3.101",
|
|
61
61
|
"@types/accepts": "^1.3.7",
|
|
62
62
|
"@types/content-disposition": "^0.5.8",
|
|
63
|
-
"@types/cookie": "^0.
|
|
63
|
+
"@types/cookie": "^0.6.0",
|
|
64
64
|
"@types/destroy": "^1.0.3",
|
|
65
65
|
"@types/encodeurl": "^1.0.2",
|
|
66
66
|
"@types/etag": "^1.8.3",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/fs-extra": "^11.0.4",
|
|
69
69
|
"@types/http-status-codes": "^1.2.0",
|
|
70
70
|
"@types/mime-types": "^2.1.4",
|
|
71
|
-
"@types/node": "^20.
|
|
71
|
+
"@types/node": "^20.10.5",
|
|
72
72
|
"@types/on-finished": "^2.3.4",
|
|
73
73
|
"@types/pem": "^1.14.4",
|
|
74
74
|
"@types/proxy-addr": "^2.0.3",
|
|
@@ -77,32 +77,32 @@
|
|
|
77
77
|
"@types/type-is": "^1.6.6",
|
|
78
78
|
"@types/vary": "^1.1.3",
|
|
79
79
|
"@vinejs/vine": "^1.6.0",
|
|
80
|
-
"autocannon": "^7.
|
|
80
|
+
"autocannon": "^7.14.0",
|
|
81
81
|
"c8": "^8.0.1",
|
|
82
82
|
"cross-env": "^7.0.3",
|
|
83
83
|
"del-cli": "^5.1.0",
|
|
84
|
-
"eslint": "^8.
|
|
85
|
-
"fastify": "^4.
|
|
86
|
-
"fs-extra": "^11.
|
|
84
|
+
"eslint": "^8.56.0",
|
|
85
|
+
"fastify": "^4.25.1",
|
|
86
|
+
"fs-extra": "^11.2.0",
|
|
87
87
|
"get-port": "^7.0.0",
|
|
88
88
|
"github-label-sync": "^2.3.1",
|
|
89
89
|
"http-status-codes": "^2.3.0",
|
|
90
90
|
"husky": "^8.0.3",
|
|
91
|
-
"np": "^
|
|
91
|
+
"np": "^9.2.0",
|
|
92
92
|
"pem": "^1.14.8",
|
|
93
|
-
"prettier": "^3.1.
|
|
94
|
-
"reflect-metadata": "^0.1
|
|
93
|
+
"prettier": "^3.1.1",
|
|
94
|
+
"reflect-metadata": "^0.2.1",
|
|
95
95
|
"supertest": "^6.3.3",
|
|
96
|
-
"ts-node": "^10.9.
|
|
96
|
+
"ts-node": "^10.9.2",
|
|
97
97
|
"tsup": "^8.0.1",
|
|
98
|
-
"typescript": "5.
|
|
98
|
+
"typescript": "^5.3.3"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
102
|
-
"@poppinss/macroable": "^1.0.
|
|
102
|
+
"@poppinss/macroable": "^1.0.1",
|
|
103
103
|
"@poppinss/matchit": "^3.1.2",
|
|
104
|
-
"@poppinss/middleware": "^3.2.
|
|
105
|
-
"@poppinss/utils": "^6.
|
|
104
|
+
"@poppinss/middleware": "^3.2.2",
|
|
105
|
+
"@poppinss/utils": "^6.7.0",
|
|
106
106
|
"@sindresorhus/is": "^6.1.0",
|
|
107
107
|
"accepts": "^1.3.8",
|
|
108
108
|
"content-disposition": "^0.5.4",
|
|
@@ -121,11 +121,11 @@
|
|
|
121
121
|
"youch": "^3.3.3"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
|
-
"@adonisjs/application": "^8.0.0-
|
|
125
|
-
"@adonisjs/encryption": "^5.1.2-
|
|
126
|
-
"@adonisjs/events": "^9.0.0-
|
|
127
|
-
"@adonisjs/fold": "^9.9.3-
|
|
128
|
-
"@adonisjs/logger": "^5.4.2-
|
|
124
|
+
"@adonisjs/application": "^8.0.0-3",
|
|
125
|
+
"@adonisjs/encryption": "^5.1.2-5",
|
|
126
|
+
"@adonisjs/events": "^9.0.0-2",
|
|
127
|
+
"@adonisjs/fold": "^9.9.3-12",
|
|
128
|
+
"@adonisjs/logger": "^5.4.2-8"
|
|
129
129
|
},
|
|
130
130
|
"repository": {
|
|
131
131
|
"type": "git",
|