@adonisjs/http-server 5.11.0 → 5.12.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/adonis-typings/request.d.ts +1 -1
- package/build/adonis-typings/response.d.ts +3 -1
- package/build/src/Cookie/Parser/index.d.ts +1 -1
- package/build/src/Cookie/Parser/index.js +2 -2
- package/build/src/Cookie/Serializer/index.d.ts +3 -1
- package/build/src/Cookie/Serializer/index.js +1 -1
- package/build/src/Request/index.d.ts +1 -1
- package/build/src/Request/index.js +2 -2
- package/build/src/Response/index.d.ts +3 -1
- package/build/src/Server/PreCompiler/index.js +4 -2
- package/package.json +23 -23
|
@@ -520,7 +520,7 @@ declare module '@ioc:Adonis/Core/Request' {
|
|
|
520
520
|
* Returns value for a given key from unsigned cookies. Optional
|
|
521
521
|
* defaultValue is returned when actual value is undefined.
|
|
522
522
|
*/
|
|
523
|
-
plainCookie(key: string, defaultValue?: any): any;
|
|
523
|
+
plainCookie(key: string, defaultValue?: any, encoded?: boolean): any;
|
|
524
524
|
/**
|
|
525
525
|
* Returns a boolean telling if a signed url as a valid signature
|
|
526
526
|
* or not.
|
|
@@ -310,7 +310,9 @@ declare module '@ioc:Adonis/Core/Response' {
|
|
|
310
310
|
* Set unsigned cookie as the response header. The inline options overrides
|
|
311
311
|
* all options from the config (means they are not merged)
|
|
312
312
|
*/
|
|
313
|
-
plainCookie(key: string, value: any, options?: Partial<CookieOptions
|
|
313
|
+
plainCookie(key: string, value: any, options?: Partial<CookieOptions & {
|
|
314
|
+
encoded: boolean;
|
|
315
|
+
}>): this;
|
|
314
316
|
/**
|
|
315
317
|
* Set unsigned cookie as the response header. The inline options overrides
|
|
316
318
|
* all options from the config (means they are not merged)
|
|
@@ -41,7 +41,7 @@ export declare class CookieParser {
|
|
|
41
41
|
* you are assuming that the cookie was just encoded at the first
|
|
42
42
|
* place and not signed or encrypted.
|
|
43
43
|
*/
|
|
44
|
-
decode(key: string): any | null;
|
|
44
|
+
decode(key: string, encoded?: boolean): any | null;
|
|
45
45
|
/**
|
|
46
46
|
* Attempts to unsign a cookie by the name. When calling this method,
|
|
47
47
|
* you are assuming that the cookie was signed at the first place.
|
|
@@ -64,7 +64,7 @@ class CookieParser {
|
|
|
64
64
|
* you are assuming that the cookie was just encoded at the first
|
|
65
65
|
* place and not signed or encrypted.
|
|
66
66
|
*/
|
|
67
|
-
decode(key) {
|
|
67
|
+
decode(key, encoded = true) {
|
|
68
68
|
/*
|
|
69
69
|
* Ignore when initial value is not defined or null
|
|
70
70
|
*/
|
|
@@ -88,7 +88,7 @@ class CookieParser {
|
|
|
88
88
|
* Attempt to unpack and cache it for future. The value is only
|
|
89
89
|
* when value it is not null.
|
|
90
90
|
*/
|
|
91
|
-
const parsed = this.client.decode(key, value);
|
|
91
|
+
const parsed = encoded ? this.client.decode(key, value) : value;
|
|
92
92
|
if (parsed !== null) {
|
|
93
93
|
cacheObject[key] = parsed;
|
|
94
94
|
}
|
|
@@ -31,7 +31,9 @@ export declare class CookieSerializer {
|
|
|
31
31
|
* serializer.encode('name', 'virk')
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
encode(key: string, value: any, options?: Partial<CookieOptions
|
|
34
|
+
encode(key: string, value: any, options?: Partial<CookieOptions & {
|
|
35
|
+
encode: boolean;
|
|
36
|
+
}>): string | null;
|
|
35
37
|
/**
|
|
36
38
|
* Signs the value and returns it back as a url safe string. The signed value
|
|
37
39
|
* has a verification hash attached to it to detect data tampering.
|
|
@@ -57,7 +57,7 @@ class CookieSerializer {
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
encode(key, value, options) {
|
|
60
|
-
const packedValue = this.client.encode(key, value);
|
|
60
|
+
const packedValue = !(options?.encode ?? true) ? value : this.client.encode(key, value);
|
|
61
61
|
if (packedValue === null) {
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
@@ -593,7 +593,7 @@ export declare class Request extends Macroable implements RequestContract {
|
|
|
593
593
|
* Returns value for a given key from unsigned cookies. Optional
|
|
594
594
|
* defaultValue is returned when actual value is undefined.
|
|
595
595
|
*/
|
|
596
|
-
plainCookie(key: string, defaultValue?: string): any;
|
|
596
|
+
plainCookie(key: string, defaultValue?: string, encoded?: boolean): any;
|
|
597
597
|
/**
|
|
598
598
|
* Returns a boolean telling if a signed url as a valid signature
|
|
599
599
|
* or not.
|
|
@@ -811,9 +811,9 @@ class Request extends macroable_1.Macroable {
|
|
|
811
811
|
* Returns value for a given key from unsigned cookies. Optional
|
|
812
812
|
* defaultValue is returned when actual value is undefined.
|
|
813
813
|
*/
|
|
814
|
-
plainCookie(key, defaultValue) {
|
|
814
|
+
plainCookie(key, defaultValue, encoded) {
|
|
815
815
|
this.initiateCookieParser();
|
|
816
|
-
return this.cookieParser.decode(key) || defaultValue;
|
|
816
|
+
return this.cookieParser.decode(key, encoded) || defaultValue;
|
|
817
817
|
}
|
|
818
818
|
/**
|
|
819
819
|
* Returns a boolean telling if a signed url as a valid signature
|
|
@@ -350,7 +350,9 @@ export declare class Response extends Macroable implements ResponseContract {
|
|
|
350
350
|
* Set unsigned cookie as the response header. The inline options overrides
|
|
351
351
|
* all options from the config (means they are not merged)
|
|
352
352
|
*/
|
|
353
|
-
plainCookie(key: string, value: any, options?: Partial<CookieOptions
|
|
353
|
+
plainCookie(key: string, value: any, options?: Partial<CookieOptions & {
|
|
354
|
+
encode: boolean;
|
|
355
|
+
}>): this;
|
|
354
356
|
/**
|
|
355
357
|
* Set unsigned cookie as the response header. The inline options overrides
|
|
356
358
|
* all options from the config (means they are not merged)
|
|
@@ -110,8 +110,10 @@ class PreCompiler {
|
|
|
110
110
|
error.help = exceptions_json_1.E_MISSING_NAMED_MIDDLEWARE.help.join('\n');
|
|
111
111
|
throw error;
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
return {
|
|
114
|
+
...resolvedMiddleware,
|
|
115
|
+
args,
|
|
116
|
+
};
|
|
115
117
|
});
|
|
116
118
|
}
|
|
117
119
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/providers/HttpServerProvider.js",
|
|
6
6
|
"files": [
|
|
@@ -39,41 +39,41 @@
|
|
|
39
39
|
"@adonisjs/application": "^5.2.5",
|
|
40
40
|
"@adonisjs/encryption": "^4.0.8",
|
|
41
41
|
"@adonisjs/mrm-preset": "^5.0.3",
|
|
42
|
-
"@adonisjs/require-ts": "^2.0.
|
|
43
|
-
"@japa/assert": "^1.3.
|
|
44
|
-
"@japa/run-failed-tests": "^1.0
|
|
45
|
-
"@japa/runner": "^2.
|
|
46
|
-
"@japa/spec-reporter": "^1.
|
|
42
|
+
"@adonisjs/require-ts": "^2.0.13",
|
|
43
|
+
"@japa/assert": "^1.3.6",
|
|
44
|
+
"@japa/run-failed-tests": "^1.1.0",
|
|
45
|
+
"@japa/runner": "^2.2.2",
|
|
46
|
+
"@japa/spec-reporter": "^1.3.2",
|
|
47
47
|
"@poppinss/dev-utils": "^2.0.3",
|
|
48
48
|
"@types/cookie": "^0.5.1",
|
|
49
49
|
"@types/ms": "^0.7.31",
|
|
50
|
-
"@types/node": "^
|
|
50
|
+
"@types/node": "^18.11.0",
|
|
51
51
|
"@types/pluralize": "0.0.29",
|
|
52
52
|
"@types/proxy-addr": "^2.0.0",
|
|
53
53
|
"@types/qs": "^6.9.7",
|
|
54
54
|
"@types/supertest": "^2.0.12",
|
|
55
|
-
"autocannon": "^7.
|
|
56
|
-
"commitizen": "^4.2.
|
|
55
|
+
"autocannon": "^7.10.0",
|
|
56
|
+
"commitizen": "^4.2.5",
|
|
57
57
|
"cross-env": "^7.0.3",
|
|
58
58
|
"cz-conventional-changelog": "^3.3.0",
|
|
59
|
-
"del-cli": "^
|
|
60
|
-
"eslint": "^8.
|
|
59
|
+
"del-cli": "^5.0.0",
|
|
60
|
+
"eslint": "^8.25.0",
|
|
61
61
|
"eslint-config-prettier": "^8.5.0",
|
|
62
|
-
"eslint-plugin-adonis": "^2.1.
|
|
63
|
-
"eslint-plugin-prettier": "^4.
|
|
64
|
-
"fastify": "^4.0
|
|
62
|
+
"eslint-plugin-adonis": "^2.1.1",
|
|
63
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
64
|
+
"fastify": "^4.9.0",
|
|
65
65
|
"github-label-sync": "^2.2.0",
|
|
66
66
|
"http-status-codes": "^2.2.0",
|
|
67
67
|
"husky": "^8.0.1",
|
|
68
68
|
"middie": "^7.1.0",
|
|
69
|
-
"mrm": "^4.
|
|
70
|
-
"np": "^7.6.
|
|
69
|
+
"mrm": "^4.1.7",
|
|
70
|
+
"np": "^7.6.2",
|
|
71
71
|
"pem": "^1.14.6",
|
|
72
|
-
"prettier": "^2.
|
|
72
|
+
"prettier": "^2.7.1",
|
|
73
73
|
"reflect-metadata": "^0.1.13",
|
|
74
|
-
"supertest": "^6.
|
|
75
|
-
"ts-node": "^10.
|
|
76
|
-
"typescript": "^4.
|
|
74
|
+
"supertest": "^6.3.0",
|
|
75
|
+
"ts-node": "^10.9.1",
|
|
76
|
+
"typescript": "^4.8.4"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@adonisjs/application": "^5.0.0",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@poppinss/matchit": "^3.1.2",
|
|
101
|
-
"@poppinss/utils": "^
|
|
101
|
+
"@poppinss/utils": "^5.0.0",
|
|
102
102
|
"accepts": "^1.3.8",
|
|
103
103
|
"co-compose": "^7.0.2",
|
|
104
104
|
"content-disposition": "^0.5.4",
|
|
@@ -108,13 +108,13 @@
|
|
|
108
108
|
"etag": "^1.8.1",
|
|
109
109
|
"fresh": "^0.5.2",
|
|
110
110
|
"haye": "^3.0.0",
|
|
111
|
-
"macroable": "^7.0.
|
|
111
|
+
"macroable": "^7.0.2",
|
|
112
112
|
"mime-types": "^2.1.35",
|
|
113
113
|
"ms": "^2.1.3",
|
|
114
114
|
"on-finished": "^2.4.1",
|
|
115
115
|
"pluralize": "^8.0.0",
|
|
116
116
|
"proxy-addr": "^2.0.7",
|
|
117
|
-
"qs": "^6.
|
|
117
|
+
"qs": "^6.11.0",
|
|
118
118
|
"tmp-cache": "^1.1.0",
|
|
119
119
|
"type-is": "^1.6.18",
|
|
120
120
|
"vary": "^1.1.2"
|