@adonisjs/http-server 6.5.0-0 → 6.6.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/factories/http_context.js +1 -1
- package/build/factories/request.js +1 -1
- package/build/factories/response.js +1 -1
- package/build/factories/router.js +3 -3
- package/build/factories/server_factory.js +3 -3
- package/build/src/request.d.ts +4 -0
- package/build/src/request.js +7 -2
- package/build/src/response.d.ts +6 -0
- package/build/src/response.js +16 -1
- package/package.json +16 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Container } from '@adonisjs/fold';
|
|
2
|
-
import { LoggerFactory } from '@adonisjs/logger/
|
|
2
|
+
import { LoggerFactory } from '@adonisjs/logger/factories';
|
|
3
3
|
import { RequestFactory } from './request.js';
|
|
4
4
|
import { ResponseFactory } from './response.js';
|
|
5
5
|
import { HttpContext } from '../src/http_context/main.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Socket } from 'node:net';
|
|
2
2
|
import proxyAddr from 'proxy-addr';
|
|
3
3
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
-
import { EncryptionFactory } from '@adonisjs/encryption/
|
|
4
|
+
import { EncryptionFactory } from '@adonisjs/encryption/factories';
|
|
5
5
|
import { Request } from '../src/request.js';
|
|
6
6
|
import { QsParserFactory } from './qs_parser_factory.js';
|
|
7
7
|
export class RequestFactory {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Socket } from 'node:net';
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
-
import { EncryptionFactory } from '@adonisjs/encryption/
|
|
3
|
+
import { EncryptionFactory } from '@adonisjs/encryption/factories';
|
|
4
4
|
import { RouterFactory } from './router.js';
|
|
5
5
|
import { Response } from '../src/response.js';
|
|
6
6
|
import { QsParserFactory } from './qs_parser_factory.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AppFactory } from '@adonisjs/application/
|
|
2
|
-
import { EncryptionFactory } from '@adonisjs/encryption/
|
|
1
|
+
import { AppFactory } from '@adonisjs/application/factories';
|
|
2
|
+
import { EncryptionFactory } from '@adonisjs/encryption/factories';
|
|
3
3
|
import { Router } from '../src/router/main.js';
|
|
4
4
|
import { QsParserFactory } from './qs_parser_factory.js';
|
|
5
5
|
export class RouterFactory {
|
|
6
6
|
#parameters = {};
|
|
7
7
|
#getApp() {
|
|
8
|
-
return this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url));
|
|
8
|
+
return (this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url), () => { }));
|
|
9
9
|
}
|
|
10
10
|
#createEncryption() {
|
|
11
11
|
return this.#parameters.encryption || new EncryptionFactory().create();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Logger } from '@adonisjs/logger';
|
|
2
2
|
import { Emitter } from '@adonisjs/events';
|
|
3
|
-
import { AppFactory } from '@adonisjs/application/
|
|
4
|
-
import { EncryptionFactory } from '@adonisjs/encryption/
|
|
3
|
+
import { AppFactory } from '@adonisjs/application/factories';
|
|
4
|
+
import { EncryptionFactory } from '@adonisjs/encryption/factories';
|
|
5
5
|
import { Server } from '../src/server/main.js';
|
|
6
6
|
import { defineConfig } from '../src/define_config.js';
|
|
7
7
|
export class ServerFactory {
|
|
@@ -16,7 +16,7 @@ export class ServerFactory {
|
|
|
16
16
|
return defineConfig(this.#parameters.config || {});
|
|
17
17
|
}
|
|
18
18
|
#getApp() {
|
|
19
|
-
return this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url));
|
|
19
|
+
return (this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url), () => { }));
|
|
20
20
|
}
|
|
21
21
|
#createEncryption() {
|
|
22
22
|
return this.#parameters.encryption || new EncryptionFactory().create();
|
package/build/src/request.d.ts
CHANGED
|
@@ -62,6 +62,10 @@ export declare class Request extends Macroable {
|
|
|
62
62
|
cookiesList(): Record<string, any>;
|
|
63
63
|
cookie(key: string, defaultValue?: string): any;
|
|
64
64
|
encryptedCookie(key: string, defaultValue?: string): any;
|
|
65
|
+
plainCookie(key: string, options?: {
|
|
66
|
+
defaultValue?: string;
|
|
67
|
+
encoded?: boolean;
|
|
68
|
+
}): any;
|
|
65
69
|
plainCookie(key: string, defaultValue?: string, encoded?: boolean): any;
|
|
66
70
|
hasValidSignature(purpose?: string): boolean;
|
|
67
71
|
toJSON(): {
|
package/build/src/request.js
CHANGED
|
@@ -3,6 +3,7 @@ import fresh from 'fresh';
|
|
|
3
3
|
import typeIs from 'type-is';
|
|
4
4
|
import accepts from 'accepts';
|
|
5
5
|
import { isIP } from 'node:net';
|
|
6
|
+
import is from '@sindresorhus/is';
|
|
6
7
|
import proxyaddr from 'proxy-addr';
|
|
7
8
|
import lodash from '@poppinss/utils/lodash';
|
|
8
9
|
import { safeEqual } from '@poppinss/utils';
|
|
@@ -278,9 +279,13 @@ export class Request extends Macroable {
|
|
|
278
279
|
this.#initiateCookieParser();
|
|
279
280
|
return this.#cookieParser.decrypt(key) || defaultValue;
|
|
280
281
|
}
|
|
281
|
-
plainCookie(key,
|
|
282
|
+
plainCookie(key, defaultValueOrOptions, encoded) {
|
|
282
283
|
this.#initiateCookieParser();
|
|
283
|
-
|
|
284
|
+
if (is.object(defaultValueOrOptions)) {
|
|
285
|
+
return (this.#cookieParser.decode(key, defaultValueOrOptions?.encoded) ||
|
|
286
|
+
defaultValueOrOptions.defaultValue);
|
|
287
|
+
}
|
|
288
|
+
return this.#cookieParser.decode(key, encoded) || defaultValueOrOptions;
|
|
284
289
|
}
|
|
285
290
|
hasValidSignature(purpose) {
|
|
286
291
|
const { signature, ...rest } = this.qs();
|
package/build/src/response.d.ts
CHANGED
|
@@ -15,7 +15,13 @@ export declare class Response extends Macroable {
|
|
|
15
15
|
get hasLazyBody(): boolean;
|
|
16
16
|
get hasContent(): boolean;
|
|
17
17
|
get hasStream(): boolean;
|
|
18
|
+
get hasFileToStream(): boolean;
|
|
18
19
|
get content(): [any, boolean, (string | undefined)?] | undefined;
|
|
20
|
+
get outgoingStream(): ResponseStream | undefined;
|
|
21
|
+
get fileToStream(): {
|
|
22
|
+
path: string;
|
|
23
|
+
generateEtag: boolean;
|
|
24
|
+
} | undefined;
|
|
19
25
|
lazyBody: Partial<{
|
|
20
26
|
content: [any, boolean, string?];
|
|
21
27
|
stream: [ResponseStream, ((error: NodeJS.ErrnoException) => [string, number?])?];
|
package/build/src/response.js
CHANGED
|
@@ -32,11 +32,25 @@ export class Response extends Macroable {
|
|
|
32
32
|
return !!this.lazyBody.content;
|
|
33
33
|
}
|
|
34
34
|
get hasStream() {
|
|
35
|
-
return !!
|
|
35
|
+
return !!this.lazyBody.stream;
|
|
36
|
+
}
|
|
37
|
+
get hasFileToStream() {
|
|
38
|
+
return !!this.lazyBody.fileToStream;
|
|
36
39
|
}
|
|
37
40
|
get content() {
|
|
38
41
|
return this.lazyBody.content;
|
|
39
42
|
}
|
|
43
|
+
get outgoingStream() {
|
|
44
|
+
return this.lazyBody.stream?.[0];
|
|
45
|
+
}
|
|
46
|
+
get fileToStream() {
|
|
47
|
+
return this.lazyBody.fileToStream
|
|
48
|
+
? {
|
|
49
|
+
path: this.lazyBody.fileToStream[0],
|
|
50
|
+
generateEtag: this.lazyBody.fileToStream[1],
|
|
51
|
+
}
|
|
52
|
+
: undefined;
|
|
53
|
+
}
|
|
40
54
|
lazyBody = {};
|
|
41
55
|
ctx;
|
|
42
56
|
constructor(request, response, encryption, config, router, qs) {
|
|
@@ -267,6 +281,7 @@ export class Response extends Macroable {
|
|
|
267
281
|
}
|
|
268
282
|
removeHeader(key) {
|
|
269
283
|
key = key.toLowerCase();
|
|
284
|
+
this.response.removeHeader(key);
|
|
270
285
|
if (this.#headers[key]) {
|
|
271
286
|
delete this.#headers[key.toLowerCase()];
|
|
272
287
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.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",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"author": "virk,adonisjs",
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@adonisjs/application": "^
|
|
43
|
-
"@adonisjs/config": "^4.
|
|
44
|
-
"@adonisjs/encryption": "^5.1.
|
|
45
|
-
"@adonisjs/events": "^8.4.
|
|
46
|
-
"@adonisjs/fold": "^9.9.
|
|
47
|
-
"@adonisjs/logger": "^5.
|
|
42
|
+
"@adonisjs/application": "^7.0.0-0",
|
|
43
|
+
"@adonisjs/config": "^4.2.0-0",
|
|
44
|
+
"@adonisjs/encryption": "^5.1.2-0",
|
|
45
|
+
"@adonisjs/events": "^8.4.5-0",
|
|
46
|
+
"@adonisjs/fold": "^9.9.2-0",
|
|
47
|
+
"@adonisjs/logger": "^5.4.1-0",
|
|
48
48
|
"@commitlint/cli": "^17.4.2",
|
|
49
49
|
"@commitlint/config-conventional": "^17.4.2",
|
|
50
50
|
"@fastify/middie": "^8.1.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@japa/run-failed-tests": "^1.1.0",
|
|
55
55
|
"@japa/runner": "^2.2.2",
|
|
56
56
|
"@japa/spec-reporter": "^1.3.2",
|
|
57
|
-
"@swc/core": "^1.3.
|
|
57
|
+
"@swc/core": "^1.3.29",
|
|
58
58
|
"@types/accepts": "^1.3.5",
|
|
59
59
|
"@types/content-disposition": "^0.5.5",
|
|
60
60
|
"@types/cookie": "^0.5.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"eslint-config-prettier": "^8.6.0",
|
|
81
81
|
"eslint-plugin-adonis": "^3.0.3",
|
|
82
82
|
"eslint-plugin-prettier": "^4.2.1",
|
|
83
|
-
"fastify": "^4.
|
|
83
|
+
"fastify": "^4.12.0",
|
|
84
84
|
"fs-extra": "^11.1.0",
|
|
85
85
|
"github-label-sync": "^2.2.0",
|
|
86
86
|
"http-status-codes": "^2.2.0",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"@poppinss/macroable": "^1.0.0-0",
|
|
98
98
|
"@poppinss/matchit": "^3.1.2",
|
|
99
99
|
"@poppinss/middleware": "^3.1.0",
|
|
100
|
-
"@poppinss/utils": "^6.
|
|
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": "^
|
|
105
|
+
"cuid": "^3.0.0",
|
|
106
106
|
"destroy": "^1.2.0",
|
|
107
107
|
"encodeurl": "^1.0.2",
|
|
108
108
|
"etag": "^1.8.1",
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"youch": "^3.2.2"
|
|
118
118
|
},
|
|
119
119
|
"peerDependencies": {
|
|
120
|
-
"@adonisjs/application": "^
|
|
121
|
-
"@adonisjs/encryption": "^5.1.
|
|
122
|
-
"@adonisjs/events": "^8.4.
|
|
123
|
-
"@adonisjs/fold": "^9.9.
|
|
124
|
-
"@adonisjs/logger": "^5.
|
|
120
|
+
"@adonisjs/application": "^7.0.0-0",
|
|
121
|
+
"@adonisjs/encryption": "^5.1.2-0",
|
|
122
|
+
"@adonisjs/events": "^8.4.5-0",
|
|
123
|
+
"@adonisjs/fold": "^9.9.2-0",
|
|
124
|
+
"@adonisjs/logger": "^5.4.1-0"
|
|
125
125
|
},
|
|
126
126
|
"repository": {
|
|
127
127
|
"type": "git",
|