@adonisjs/http-server 6.8.2-9 → 7.0.0-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-XX72ATFY.js +4388 -0
- package/build/factories/main.d.ts +149 -6
- package/build/factories/main.js +331 -14
- package/build/index.d.ts +272 -14
- package/build/index.js +308 -22
- package/build/{src/server/main.d.ts → main-29eaaee4.d.ts} +12 -17
- package/build/main-e5b46c83.d.ts +2210 -0
- package/build/src/types/main.d.ts +14 -7
- package/build/src/types/main.js +0 -15
- package/package.json +62 -53
- package/build/factories/http_context.d.ts +0 -25
- package/build/factories/http_context.js +0 -51
- package/build/factories/http_server.d.ts +0 -8
- package/build/factories/http_server.js +0 -26
- package/build/factories/qs_parser_factory.d.ts +0 -20
- package/build/factories/qs_parser_factory.js +0 -44
- package/build/factories/request.d.ts +0 -29
- package/build/factories/request.js +0 -73
- package/build/factories/response.d.ts +0 -29
- package/build/factories/response.js +0 -77
- package/build/factories/router.d.ts +0 -23
- package/build/factories/router.js +0 -45
- package/build/factories/server_factory.d.ts +0 -29
- package/build/factories/server_factory.js +0 -65
- package/build/src/cookies/client.d.ts +0 -37
- package/build/src/cookies/client.js +0 -84
- package/build/src/cookies/drivers/encrypted.d.ts +0 -16
- package/build/src/cookies/drivers/encrypted.js +0 -36
- package/build/src/cookies/drivers/plain.d.ts +0 -15
- package/build/src/cookies/drivers/plain.js +0 -33
- package/build/src/cookies/drivers/signed.d.ts +0 -16
- package/build/src/cookies/drivers/signed.js +0 -36
- package/build/src/cookies/parser.d.ts +0 -37
- package/build/src/cookies/parser.js +0 -167
- package/build/src/cookies/serializer.d.ts +0 -33
- package/build/src/cookies/serializer.js +0 -79
- package/build/src/debug.d.ts +0 -3
- package/build/src/debug.js +0 -10
- package/build/src/define_config.d.ts +0 -5
- package/build/src/define_config.js +0 -51
- package/build/src/define_middleware.d.ts +0 -11
- package/build/src/define_middleware.js +0 -35
- package/build/src/exception_handler.d.ts +0 -112
- package/build/src/exception_handler.js +0 -303
- package/build/src/exceptions.d.ts +0 -84
- package/build/src/exceptions.js +0 -38
- package/build/src/helpers.d.ts +0 -23
- package/build/src/helpers.js +0 -84
- package/build/src/http_context/local_storage.d.ts +0 -12
- package/build/src/http_context/local_storage.js +0 -39
- package/build/src/http_context/main.d.ts +0 -58
- package/build/src/http_context/main.js +0 -105
- package/build/src/qs.d.ts +0 -11
- package/build/src/qs.js +0 -25
- package/build/src/redirect.d.ts +0 -42
- package/build/src/redirect.js +0 -140
- package/build/src/request.d.ts +0 -565
- package/build/src/request.js +0 -865
- package/build/src/response.d.ts +0 -540
- package/build/src/response.js +0 -1208
- package/build/src/router/brisk.d.ts +0 -42
- package/build/src/router/brisk.js +0 -85
- package/build/src/router/executor.d.ts +0 -8
- package/build/src/router/executor.js +0 -29
- package/build/src/router/factories/use_return_value.d.ts +0 -6
- package/build/src/router/factories/use_return_value.js +0 -22
- package/build/src/router/group.d.ts +0 -65
- package/build/src/router/group.js +0 -207
- package/build/src/router/lookup_store/main.d.ts +0 -49
- package/build/src/router/lookup_store/main.js +0 -86
- package/build/src/router/lookup_store/route_finder.d.ts +0 -21
- package/build/src/router/lookup_store/route_finder.js +0 -49
- package/build/src/router/lookup_store/url_builder.d.ts +0 -52
- package/build/src/router/lookup_store/url_builder.js +0 -209
- package/build/src/router/main.d.ts +0 -128
- package/build/src/router/main.js +0 -316
- package/build/src/router/matchers.d.ts +0 -27
- package/build/src/router/matchers.js +0 -36
- package/build/src/router/parser.d.ts +0 -5
- package/build/src/router/parser.js +0 -17
- package/build/src/router/resource.d.ts +0 -54
- package/build/src/router/resource.js +0 -216
- package/build/src/router/route.d.ts +0 -92
- package/build/src/router/route.js +0 -293
- package/build/src/router/store.d.ts +0 -66
- package/build/src/router/store.js +0 -195
- package/build/src/server/factories/final_handler.d.ts +0 -9
- package/build/src/server/factories/final_handler.js +0 -30
- package/build/src/server/factories/middleware_handler.d.ts +0 -8
- package/build/src/server/factories/middleware_handler.js +0 -16
- package/build/src/server/factories/write_response.d.ts +0 -6
- package/build/src/server/factories/write_response.js +0 -24
- package/build/src/server/main.js +0 -283
- package/build/src/types/base.d.ts +0 -19
- package/build/src/types/base.js +0 -9
- package/build/src/types/middleware.d.ts +0 -35
- package/build/src/types/middleware.js +0 -9
- package/build/src/types/qs.d.ts +0 -68
- package/build/src/types/qs.js +0 -9
- package/build/src/types/request.d.ts +0 -39
- package/build/src/types/request.js +0 -9
- package/build/src/types/response.d.ts +0 -45
- package/build/src/types/response.js +0 -9
- package/build/src/types/route.d.ts +0 -165
- package/build/src/types/route.js +0 -9
- package/build/src/types/server.d.ts +0 -72
- package/build/src/types/server.js +0 -9
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export { p as CastableHeader, C as Constructor, o as CookieOptions, E as ErrorHandlerAsAClass, r as GetControllerHandlers, G as GetMiddlewareArgs, e as HttpError, V as HttpRequestFinishedPayload, L as LazyImport, N as MakeSignedUrlOptions, K as MakeUrlOptions, s as MatchItRouteToken, A as MatchedRoute, M as MiddlewareAsClass, m as MiddlewareFn, O as OneOrMore, P as ParsedGlobalMiddleware, n as ParsedNamedMiddleware, Q as QSParserConfig, k as RequestConfig, J as ResourceActionNames, l as ResponseConfig, q as ResponseStream, t as RouteFn, I as RouteJSON, D as RouteMatcher, F as RouteMatchers, S as ServerConfig, W as ServerErrorHandler, c as StatusPageRange, d as StatusPageRenderer, y as StoreDomainNode, x as StoreMethodNode, u as StoreRouteHandler, v as StoreRouteMiddleware, w as StoreRouteNode, z as StoreRoutesTree, T as TestingMiddlewarePipeline, U as UnWrapLazyImport } from '../../main-e5b46c83.js';
|
|
2
|
+
export { NextFn } from '@poppinss/middleware/types';
|
|
3
|
+
import '@adonisjs/fold';
|
|
4
|
+
import '@poppinss/macroable';
|
|
5
|
+
import '@adonisjs/logger';
|
|
6
|
+
import 'node:url';
|
|
7
|
+
import '@adonisjs/encryption';
|
|
8
|
+
import 'node:http';
|
|
9
|
+
import 'qs';
|
|
10
|
+
import 'http';
|
|
11
|
+
import 'stream';
|
|
12
|
+
import '@poppinss/middleware';
|
|
13
|
+
import 'node:stream';
|
|
14
|
+
import '@adonisjs/application';
|
package/build/src/types/main.js
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
export * from './base.js';
|
|
10
|
-
export * from './middleware.js';
|
|
11
|
-
export * from './qs.js';
|
|
12
|
-
export * from './request.js';
|
|
13
|
-
export * from './response.js';
|
|
14
|
-
export * from './route.js';
|
|
15
|
-
export * from './server.js';
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-0",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
|
-
"build
|
|
9
|
-
"build/factories",
|
|
10
|
-
"build/index.d.ts",
|
|
11
|
-
"build/index.js"
|
|
8
|
+
"build"
|
|
12
9
|
],
|
|
13
10
|
"exports": {
|
|
14
11
|
".": "./build/index.js",
|
|
@@ -23,10 +20,10 @@
|
|
|
23
20
|
"test": "cross-env NODE_DEBUG=adonisjs:http c8 npm run quick:test",
|
|
24
21
|
"clean": "del-cli build",
|
|
25
22
|
"typecheck": "tsc --noEmit",
|
|
26
|
-
"compile": "npm run lint && npm run clean &&
|
|
23
|
+
"compile": "npm run lint && npm run clean && tsup-node",
|
|
27
24
|
"build": "npm run compile",
|
|
28
25
|
"prebenchmark": "npm run build",
|
|
29
|
-
"benchmark": "node
|
|
26
|
+
"benchmark": "node benchmarks/index.js",
|
|
30
27
|
"release": "np",
|
|
31
28
|
"version": "npm run build",
|
|
32
29
|
"format": "prettier --write .",
|
|
@@ -43,67 +40,67 @@
|
|
|
43
40
|
"author": "virk,adonisjs",
|
|
44
41
|
"license": "MIT",
|
|
45
42
|
"devDependencies": {
|
|
46
|
-
"@adonisjs/application": "^
|
|
47
|
-
"@adonisjs/encryption": "^5.1.2-
|
|
43
|
+
"@adonisjs/application": "^8.0.0-0",
|
|
44
|
+
"@adonisjs/encryption": "^5.1.2-3",
|
|
48
45
|
"@adonisjs/eslint-config": "^1.1.8",
|
|
49
|
-
"@adonisjs/events": "^
|
|
50
|
-
"@adonisjs/fold": "^9.9.3-
|
|
51
|
-
"@adonisjs/logger": "^5.4.2-
|
|
46
|
+
"@adonisjs/events": "^9.0.0-0",
|
|
47
|
+
"@adonisjs/fold": "^9.9.3-10",
|
|
48
|
+
"@adonisjs/logger": "^5.4.2-6",
|
|
52
49
|
"@adonisjs/prettier-config": "^1.1.8",
|
|
53
50
|
"@adonisjs/tsconfig": "^1.1.8",
|
|
54
|
-
"@commitlint/cli": "^17.
|
|
55
|
-
"@commitlint/config-conventional": "^17.
|
|
51
|
+
"@commitlint/cli": "^17.8.0",
|
|
52
|
+
"@commitlint/config-conventional": "^17.8.0",
|
|
56
53
|
"@fastify/middie": "^8.3.0",
|
|
57
|
-
"@japa/
|
|
58
|
-
"@japa/
|
|
59
|
-
"@japa/
|
|
60
|
-
"@
|
|
61
|
-
"@swc/core": "^1.3.70",
|
|
54
|
+
"@japa/assert": "^2.0.0",
|
|
55
|
+
"@japa/expect-type": "^2.0.0",
|
|
56
|
+
"@japa/runner": "^3.0.2",
|
|
57
|
+
"@swc/core": "1.3.82",
|
|
62
58
|
"@types/accepts": "^1.3.5",
|
|
63
|
-
"@types/content-disposition": "^0.5.
|
|
64
|
-
"@types/cookie": "^0.5.
|
|
65
|
-
"@types/destroy": "^1.0.
|
|
59
|
+
"@types/content-disposition": "^0.5.6",
|
|
60
|
+
"@types/cookie": "^0.5.2",
|
|
61
|
+
"@types/destroy": "^1.0.1",
|
|
66
62
|
"@types/encodeurl": "^1.0.0",
|
|
67
63
|
"@types/etag": "^1.8.1",
|
|
68
64
|
"@types/fresh": "^0.5.0",
|
|
69
|
-
"@types/fs-extra": "^11.0.
|
|
65
|
+
"@types/fs-extra": "^11.0.2",
|
|
70
66
|
"@types/http-status-codes": "^1.2.0",
|
|
71
|
-
"@types/mime-types": "^2.1.
|
|
72
|
-
"@types/node": "^20.
|
|
73
|
-
"@types/on-finished": "^2.3.
|
|
74
|
-
"@types/pem": "^1.14.
|
|
75
|
-
"@types/proxy-addr": "^2.0.
|
|
76
|
-
"@types/qs": "^6.9.
|
|
77
|
-
"@types/supertest": "^2.0.
|
|
78
|
-
"@types/type-is": "^1.6.
|
|
79
|
-
"@types/vary": "^1.1.
|
|
80
|
-
"@vinejs/vine": "^1.
|
|
81
|
-
"autocannon": "^7.
|
|
82
|
-
"c8": "^8.0.
|
|
67
|
+
"@types/mime-types": "^2.1.2",
|
|
68
|
+
"@types/node": "^20.8.6",
|
|
69
|
+
"@types/on-finished": "^2.3.2",
|
|
70
|
+
"@types/pem": "^1.14.2",
|
|
71
|
+
"@types/proxy-addr": "^2.0.1",
|
|
72
|
+
"@types/qs": "^6.9.8",
|
|
73
|
+
"@types/supertest": "^2.0.14",
|
|
74
|
+
"@types/type-is": "^1.6.4",
|
|
75
|
+
"@types/vary": "^1.1.1",
|
|
76
|
+
"@vinejs/vine": "^1.6.0",
|
|
77
|
+
"autocannon": "^7.12.0",
|
|
78
|
+
"c8": "^8.0.1",
|
|
83
79
|
"cross-env": "^7.0.3",
|
|
84
|
-
"del-cli": "^5.
|
|
85
|
-
"eslint": "^8.
|
|
86
|
-
"fastify": "^4.
|
|
80
|
+
"del-cli": "^5.1.0",
|
|
81
|
+
"eslint": "^8.51.0",
|
|
82
|
+
"fastify": "^4.24.2",
|
|
87
83
|
"fs-extra": "^11.1.1",
|
|
88
84
|
"get-port": "^7.0.0",
|
|
89
85
|
"github-label-sync": "^2.3.1",
|
|
90
|
-
"http-status-codes": "^2.
|
|
86
|
+
"http-status-codes": "^2.3.0",
|
|
91
87
|
"husky": "^8.0.3",
|
|
92
88
|
"np": "^8.0.4",
|
|
93
89
|
"pem": "^1.14.8",
|
|
94
|
-
"prettier": "^3.0.
|
|
90
|
+
"prettier": "^3.0.3",
|
|
95
91
|
"reflect-metadata": "^0.1.13",
|
|
96
92
|
"supertest": "^6.3.3",
|
|
97
93
|
"ts-node": "^10.9.1",
|
|
98
|
-
"
|
|
94
|
+
"tsup": "^7.2.0",
|
|
95
|
+
"typescript": "^5.2.2"
|
|
99
96
|
},
|
|
100
97
|
"dependencies": {
|
|
101
|
-
"@paralleldrive/cuid2": "^2.2.
|
|
102
|
-
"@poppinss/macroable": "^1.0.0
|
|
98
|
+
"@paralleldrive/cuid2": "^2.2.2",
|
|
99
|
+
"@poppinss/macroable": "^1.0.0",
|
|
103
100
|
"@poppinss/matchit": "^3.1.2",
|
|
104
|
-
"@poppinss/middleware": "^3.
|
|
105
|
-
"@poppinss/utils": "^6.5.0
|
|
106
|
-
"@sindresorhus/is": "^
|
|
101
|
+
"@poppinss/middleware": "^3.2.0",
|
|
102
|
+
"@poppinss/utils": "^6.5.0",
|
|
103
|
+
"@sindresorhus/is": "^6.0.1",
|
|
107
104
|
"accepts": "^1.3.8",
|
|
108
105
|
"content-disposition": "^0.5.4",
|
|
109
106
|
"cookie": "^0.5.0",
|
|
@@ -118,14 +115,14 @@
|
|
|
118
115
|
"tmp-cache": "^1.1.0",
|
|
119
116
|
"type-is": "^1.6.18",
|
|
120
117
|
"vary": "^1.1.2",
|
|
121
|
-
"youch": "^3.2
|
|
118
|
+
"youch": "^3.3.2"
|
|
122
119
|
},
|
|
123
120
|
"peerDependencies": {
|
|
124
|
-
"@adonisjs/application": "^
|
|
125
|
-
"@adonisjs/encryption": "^5.1.2-
|
|
126
|
-
"@adonisjs/events": "^
|
|
127
|
-
"@adonisjs/fold": "^9.9.3-
|
|
128
|
-
"@adonisjs/logger": "^5.4.2-
|
|
121
|
+
"@adonisjs/application": "^8.0.0-0",
|
|
122
|
+
"@adonisjs/encryption": "^5.1.2-3",
|
|
123
|
+
"@adonisjs/events": "^9.0.0-0",
|
|
124
|
+
"@adonisjs/fold": "^9.9.3-10",
|
|
125
|
+
"@adonisjs/logger": "^5.4.2-6"
|
|
129
126
|
},
|
|
130
127
|
"repository": {
|
|
131
128
|
"type": "git",
|
|
@@ -164,5 +161,17 @@
|
|
|
164
161
|
"eslintConfig": {
|
|
165
162
|
"extends": "@adonisjs/eslint-config/package"
|
|
166
163
|
},
|
|
167
|
-
"prettier": "@adonisjs/prettier-config"
|
|
164
|
+
"prettier": "@adonisjs/prettier-config",
|
|
165
|
+
"tsup": {
|
|
166
|
+
"entry": [
|
|
167
|
+
"./index.ts",
|
|
168
|
+
"./src/types/main.ts",
|
|
169
|
+
"./factories/main.ts"
|
|
170
|
+
],
|
|
171
|
+
"outDir": "./build",
|
|
172
|
+
"clean": true,
|
|
173
|
+
"format": "esm",
|
|
174
|
+
"dts": true,
|
|
175
|
+
"target": "esnext"
|
|
176
|
+
}
|
|
168
177
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@adonisjs/logger';
|
|
2
|
-
import type { Request } from '../src/request.js';
|
|
3
|
-
import type { Response } from '../src/response.js';
|
|
4
|
-
import { HttpContext } from '../src/http_context/main.js';
|
|
5
|
-
type FactoryParameters = {
|
|
6
|
-
request: Request;
|
|
7
|
-
response: Response;
|
|
8
|
-
logger: Logger;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* HttpContext factory is used to generate Http context class instances for
|
|
12
|
-
* testing
|
|
13
|
-
*/
|
|
14
|
-
export declare class HttpContextFactory {
|
|
15
|
-
#private;
|
|
16
|
-
/**
|
|
17
|
-
* Merge factory params
|
|
18
|
-
*/
|
|
19
|
-
merge(params: Partial<FactoryParameters>): this;
|
|
20
|
-
/**
|
|
21
|
-
* Create request
|
|
22
|
-
*/
|
|
23
|
-
create(): HttpContext;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { Container } from '@adonisjs/fold';
|
|
10
|
-
import { LoggerFactory } from '@adonisjs/logger/factories';
|
|
11
|
-
import { RequestFactory } from './request.js';
|
|
12
|
-
import { ResponseFactory } from './response.js';
|
|
13
|
-
import { HttpContext } from '../src/http_context/main.js';
|
|
14
|
-
/**
|
|
15
|
-
* HttpContext factory is used to generate Http context class instances for
|
|
16
|
-
* testing
|
|
17
|
-
*/
|
|
18
|
-
export class HttpContextFactory {
|
|
19
|
-
#parameters = {};
|
|
20
|
-
/**
|
|
21
|
-
* Returns the request class instance
|
|
22
|
-
*/
|
|
23
|
-
#createRequest() {
|
|
24
|
-
return this.#parameters.request || new RequestFactory().create();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Returns the response class instance
|
|
28
|
-
*/
|
|
29
|
-
#createResponse() {
|
|
30
|
-
return this.#parameters.response || new ResponseFactory().create();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Returns an instance of the logger class
|
|
34
|
-
*/
|
|
35
|
-
#createLogger() {
|
|
36
|
-
return this.#parameters.logger || new LoggerFactory().create();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Merge factory params
|
|
40
|
-
*/
|
|
41
|
-
merge(params) {
|
|
42
|
-
Object.assign(this.#parameters, params);
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Create request
|
|
47
|
-
*/
|
|
48
|
-
create() {
|
|
49
|
-
return new HttpContext(this.#createRequest(), this.#createResponse(), this.#createLogger(), new Container().createResolver());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import getPort from 'get-port';
|
|
10
|
-
import { getActiveTest } from '@japa/runner';
|
|
11
|
-
import { createServer } from 'node:http';
|
|
12
|
-
export const httpServer = {
|
|
13
|
-
async create(handler) {
|
|
14
|
-
const server = createServer(handler);
|
|
15
|
-
const test = getActiveTest();
|
|
16
|
-
test?.cleanup(() => {
|
|
17
|
-
server.close();
|
|
18
|
-
});
|
|
19
|
-
const port = await getPort({ port: 3000 });
|
|
20
|
-
return new Promise((resolve) => {
|
|
21
|
-
server.listen(port, 'localhost', () => {
|
|
22
|
-
return resolve({ server, port, url: `http://localhost:${port}` });
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Qs } from '../src/qs.js';
|
|
2
|
-
import type { QSParserConfig } from '../src/types/qs.js';
|
|
3
|
-
/**
|
|
4
|
-
* QS Parser factory is used to generate the query string
|
|
5
|
-
* parser for testing
|
|
6
|
-
*/
|
|
7
|
-
export declare class QsParserFactory {
|
|
8
|
-
#private;
|
|
9
|
-
/**
|
|
10
|
-
* Merge encryption factory options
|
|
11
|
-
*/
|
|
12
|
-
merge(options: Partial<{
|
|
13
|
-
parse: Partial<QSParserConfig['parse']>;
|
|
14
|
-
stringify: Partial<QSParserConfig['stringify']>;
|
|
15
|
-
}>): this;
|
|
16
|
-
/**
|
|
17
|
-
* Create instance of the logger class
|
|
18
|
-
*/
|
|
19
|
-
create(): Qs;
|
|
20
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { Qs } from '../src/qs.js';
|
|
10
|
-
/**
|
|
11
|
-
* QS Parser factory is used to generate the query string
|
|
12
|
-
* parser for testing
|
|
13
|
-
*/
|
|
14
|
-
export class QsParserFactory {
|
|
15
|
-
#options = {
|
|
16
|
-
parse: {
|
|
17
|
-
depth: 5,
|
|
18
|
-
parameterLimit: 1000,
|
|
19
|
-
allowSparse: false,
|
|
20
|
-
arrayLimit: 20,
|
|
21
|
-
comma: true,
|
|
22
|
-
},
|
|
23
|
-
stringify: {
|
|
24
|
-
encode: true,
|
|
25
|
-
encodeValuesOnly: false,
|
|
26
|
-
arrayFormat: 'indices',
|
|
27
|
-
skipNulls: false,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Merge encryption factory options
|
|
32
|
-
*/
|
|
33
|
-
merge(options) {
|
|
34
|
-
Object.assign(this.#options.parse, options.parse);
|
|
35
|
-
Object.assign(this.#options.stringify, options.stringify);
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Create instance of the logger class
|
|
40
|
-
*/
|
|
41
|
-
create() {
|
|
42
|
-
return new Qs(this.#options);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { Encryption } from '@adonisjs/encryption';
|
|
3
|
-
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
-
import { Request } from '../src/request.js';
|
|
5
|
-
import { RequestConfig } from '../src/types/request.js';
|
|
6
|
-
type FactoryParameters = {
|
|
7
|
-
url: string;
|
|
8
|
-
method: string;
|
|
9
|
-
req: IncomingMessage;
|
|
10
|
-
res: ServerResponse;
|
|
11
|
-
encryption: Encryption;
|
|
12
|
-
config: Partial<RequestConfig>;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Request factory is used to generate request class instances for
|
|
16
|
-
* testing
|
|
17
|
-
*/
|
|
18
|
-
export declare class RequestFactory {
|
|
19
|
-
#private;
|
|
20
|
-
/**
|
|
21
|
-
* Merge factory params
|
|
22
|
-
*/
|
|
23
|
-
merge(params: Partial<FactoryParameters>): this;
|
|
24
|
-
/**
|
|
25
|
-
* Create request
|
|
26
|
-
*/
|
|
27
|
-
create(): Request;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { Socket } from 'node:net';
|
|
10
|
-
import proxyAddr from 'proxy-addr';
|
|
11
|
-
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
12
|
-
import { EncryptionFactory } from '@adonisjs/encryption/factories';
|
|
13
|
-
import { Request } from '../src/request.js';
|
|
14
|
-
import { QsParserFactory } from './qs_parser_factory.js';
|
|
15
|
-
/**
|
|
16
|
-
* Request factory is used to generate request class instances for
|
|
17
|
-
* testing
|
|
18
|
-
*/
|
|
19
|
-
export class RequestFactory {
|
|
20
|
-
#parameters = {};
|
|
21
|
-
/**
|
|
22
|
-
* Returns the config for the request class
|
|
23
|
-
*/
|
|
24
|
-
#getConfig() {
|
|
25
|
-
return {
|
|
26
|
-
allowMethodSpoofing: false,
|
|
27
|
-
trustProxy: proxyAddr.compile('loopback'),
|
|
28
|
-
subdomainOffset: 2,
|
|
29
|
-
generateRequestId: false,
|
|
30
|
-
...this.#parameters.config,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Returns the HTTP req object
|
|
35
|
-
*/
|
|
36
|
-
#createRequest() {
|
|
37
|
-
const req = this.#parameters.req || new IncomingMessage(new Socket());
|
|
38
|
-
if (this.#parameters.url) {
|
|
39
|
-
req.url = this.#parameters.url;
|
|
40
|
-
}
|
|
41
|
-
if (this.#parameters.method) {
|
|
42
|
-
req.method = this.#parameters.method;
|
|
43
|
-
}
|
|
44
|
-
return req;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Returns the HTTP res object
|
|
48
|
-
*/
|
|
49
|
-
#createResponse(req) {
|
|
50
|
-
return this.#parameters.res || new ServerResponse(req);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Returns an instance of the encryptor to encrypt
|
|
54
|
-
* signed URLs
|
|
55
|
-
*/
|
|
56
|
-
#createEncryption() {
|
|
57
|
-
return this.#parameters.encryption || new EncryptionFactory().create();
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Merge factory params
|
|
61
|
-
*/
|
|
62
|
-
merge(params) {
|
|
63
|
-
Object.assign(this.#parameters, params);
|
|
64
|
-
return this;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Create request
|
|
68
|
-
*/
|
|
69
|
-
create() {
|
|
70
|
-
const req = this.#createRequest();
|
|
71
|
-
return new Request(req, this.#createResponse(req), this.#createEncryption(), this.#getConfig(), new QsParserFactory().create());
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { Encryption } from '@adonisjs/encryption';
|
|
3
|
-
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
-
import { Response } from '../src/response.js';
|
|
5
|
-
import { Router } from '../src/router/main.js';
|
|
6
|
-
import { ResponseConfig } from '../src/types/response.js';
|
|
7
|
-
type FactoryParameters = {
|
|
8
|
-
req: IncomingMessage;
|
|
9
|
-
res: ServerResponse;
|
|
10
|
-
encryption: Encryption;
|
|
11
|
-
config: Partial<ResponseConfig>;
|
|
12
|
-
router: Router;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Response factory is used to generate response class instances for
|
|
16
|
-
* testing
|
|
17
|
-
*/
|
|
18
|
-
export declare class ResponseFactory {
|
|
19
|
-
#private;
|
|
20
|
-
/**
|
|
21
|
-
* Merge factory params
|
|
22
|
-
*/
|
|
23
|
-
merge(params: Partial<FactoryParameters>): this;
|
|
24
|
-
/**
|
|
25
|
-
* Create response class instance
|
|
26
|
-
*/
|
|
27
|
-
create(): Response;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/http-server
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { Socket } from 'node:net';
|
|
10
|
-
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
11
|
-
import { EncryptionFactory } from '@adonisjs/encryption/factories';
|
|
12
|
-
import { RouterFactory } from './router.js';
|
|
13
|
-
import { Response } from '../src/response.js';
|
|
14
|
-
import { QsParserFactory } from './qs_parser_factory.js';
|
|
15
|
-
/**
|
|
16
|
-
* Response factory is used to generate response class instances for
|
|
17
|
-
* testing
|
|
18
|
-
*/
|
|
19
|
-
export class ResponseFactory {
|
|
20
|
-
#parameters = {};
|
|
21
|
-
/**
|
|
22
|
-
* Returns the config for the request class
|
|
23
|
-
*/
|
|
24
|
-
#getConfig() {
|
|
25
|
-
return {
|
|
26
|
-
etag: false,
|
|
27
|
-
jsonpCallbackName: 'callback',
|
|
28
|
-
cookie: {
|
|
29
|
-
maxAge: 90,
|
|
30
|
-
path: '/',
|
|
31
|
-
httpOnly: true,
|
|
32
|
-
sameSite: false,
|
|
33
|
-
secure: false,
|
|
34
|
-
},
|
|
35
|
-
...this.#parameters.config,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Returns the HTTP req object
|
|
40
|
-
*/
|
|
41
|
-
#createRequest() {
|
|
42
|
-
return this.#parameters.req || new IncomingMessage(new Socket());
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Returns an instance of the router
|
|
46
|
-
*/
|
|
47
|
-
#createRouter() {
|
|
48
|
-
return this.#parameters.router || new RouterFactory().create();
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Returns the HTTP res object
|
|
52
|
-
*/
|
|
53
|
-
#createResponse(req) {
|
|
54
|
-
return this.#parameters.res || new ServerResponse(req);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Returns an instance of the encryptor to encrypt
|
|
58
|
-
* signed URLs
|
|
59
|
-
*/
|
|
60
|
-
#createEncryption() {
|
|
61
|
-
return this.#parameters.encryption || new EncryptionFactory().create();
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Merge factory params
|
|
65
|
-
*/
|
|
66
|
-
merge(params) {
|
|
67
|
-
Object.assign(this.#parameters, params);
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Create response class instance
|
|
72
|
-
*/
|
|
73
|
-
create() {
|
|
74
|
-
const req = this.#createRequest();
|
|
75
|
-
return new Response(req, this.#createResponse(req), this.#createEncryption(), this.#getConfig(), this.#createRouter(), new QsParserFactory().create());
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Encryption } from '@adonisjs/encryption';
|
|
2
|
-
import type { Application } from '@adonisjs/application';
|
|
3
|
-
import { Router } from '../src/router/main.js';
|
|
4
|
-
type FactoryParameters = {
|
|
5
|
-
app: Application<any>;
|
|
6
|
-
encryption: Encryption;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Router factory is used to generate router class instances for
|
|
10
|
-
* testing
|
|
11
|
-
*/
|
|
12
|
-
export declare class RouterFactory {
|
|
13
|
-
#private;
|
|
14
|
-
/**
|
|
15
|
-
* Merge factory params
|
|
16
|
-
*/
|
|
17
|
-
merge(params: Partial<FactoryParameters>): this;
|
|
18
|
-
/**
|
|
19
|
-
* Create router instance
|
|
20
|
-
*/
|
|
21
|
-
create(): Router;
|
|
22
|
-
}
|
|
23
|
-
export {};
|