@adonisjs/http-server 5.6.1 → 5.7.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.
@@ -15,31 +15,19 @@ declare module '@ioc:Adonis/Core/CookieClient' {
15
15
  /**
16
16
  * Parse the set-cookie header
17
17
  */
18
- parse(setCookieHeader: string): {
19
- name: string;
20
- value: any;
21
- encrypted: boolean;
22
- signed: boolean;
23
- path?: string;
24
- expires?: Date;
25
- maxAge?: number;
26
- domain?: string;
27
- secure?: boolean;
28
- httpOnly?: boolean;
29
- sameSite?: 'lax' | 'none' | 'strict';
30
- }[];
18
+ parse(key: string, value: string): any | null;
31
19
  /**
32
20
  * Unsign a signed cookie value
33
21
  */
34
- unsign(key: string, value: string): any;
22
+ unsign(key: string, value: string): any | null;
35
23
  /**
36
24
  * Decrypt an encrypted cookie value
37
25
  */
38
- decrypt(key: string, value: string): any;
26
+ decrypt(key: string, value: string): any | null;
39
27
  /**
40
28
  * Decode an encoded cookie value
41
29
  */
42
- decode(key: string, value: string): any;
30
+ decode(key: string, value: string): any | null;
43
31
  }
44
32
  const CookieClient: CookieClientContract;
45
33
  export default CookieClient;
@@ -33,8 +33,7 @@ export declare class CookieClient implements CookieClientContract {
33
33
  */
34
34
  decode(_: string, value: string): any;
35
35
  /**
36
- * Parses the set-cookie header and returns an
37
- * array of parsed cookies
36
+ * Parse response cookie
38
37
  */
39
- parse(setCookieHeader: string): any;
38
+ parse(key: string, value: any): any;
40
39
  }
@@ -9,7 +9,11 @@
9
9
  */
10
10
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
11
  if (k2 === undefined) k2 = k;
12
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }) : (function(o, m, k, k2) {
14
18
  if (k2 === undefined) k2 = k;
15
19
  o[k2] = m[k];
@@ -26,13 +30,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
30
  __setModuleDefault(result, mod);
27
31
  return result;
28
32
  };
29
- var __importDefault = (this && this.__importDefault) || function (mod) {
30
- return (mod && mod.__esModule) ? mod : { "default": mod };
31
- };
32
33
  Object.defineProperty(exports, "__esModule", { value: true });
33
34
  exports.CookieClient = void 0;
34
- /// <reference path="../../../adonis-typings/index.ts" />
35
- const set_cookie_parser_1 = __importDefault(require("set-cookie-parser"));
36
35
  const PlainCookie = __importStar(require("../Drivers/Plain"));
37
36
  const SignedCookie = __importStar(require("../Drivers/Signed"));
38
37
  const EncryptedCookie = __importStar(require("../Drivers/Encrypted"));
@@ -83,39 +82,27 @@ class CookieClient {
83
82
  return PlainCookie.canUnpack(value) ? PlainCookie.unpack(value) : null;
84
83
  }
85
84
  /**
86
- * Parses the set-cookie header and returns an
87
- * array of parsed cookies
85
+ * Parse response cookie
88
86
  */
89
- parse(setCookieHeader) {
90
- const cookies = (0, set_cookie_parser_1.default)(setCookieHeader);
91
- return cookies.map((cookie) => {
92
- cookie.encrypted = false;
93
- cookie.signed = false;
94
- const value = cookie.value;
95
- /**
96
- * Unsign signed cookie
97
- */
98
- if (SignedCookie.canUnpack(value)) {
99
- cookie.value = SignedCookie.unpack(cookie.name, value, this.encryption);
100
- cookie.signed = true;
101
- return cookie;
102
- }
103
- /**
104
- * Decrypted encrypted cookie
105
- */
106
- if (EncryptedCookie.canUnpack(value)) {
107
- cookie.value = EncryptedCookie.unpack(cookie.name, value, this.encryption);
108
- cookie.encrypted = true;
109
- return cookie;
110
- }
111
- /**
112
- * Decode encoded cookie
113
- */
114
- if (PlainCookie.canUnpack(value)) {
115
- cookie.value = PlainCookie.unpack(value);
116
- }
117
- return cookie;
118
- });
87
+ parse(key, value) {
88
+ /**
89
+ * Unsign signed cookie
90
+ */
91
+ if (SignedCookie.canUnpack(value)) {
92
+ return SignedCookie.unpack(key, value, this.encryption);
93
+ }
94
+ /**
95
+ * Decrypted encrypted cookie
96
+ */
97
+ if (EncryptedCookie.canUnpack(value)) {
98
+ return EncryptedCookie.unpack(key, value, this.encryption);
99
+ }
100
+ /**
101
+ * Decode encoded cookie
102
+ */
103
+ if (PlainCookie.canUnpack(value)) {
104
+ return PlainCookie.unpack(value);
105
+ }
119
106
  }
120
107
  }
121
108
  exports.CookieClient = CookieClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/http-server",
3
- "version": "5.6.1",
3
+ "version": "5.7.2",
4
4
  "description": "AdonisJS HTTP server with support packed with Routing and Cookies",
5
5
  "main": "build/providers/HttpServerProvider.js",
6
6
  "files": [
@@ -14,8 +14,8 @@
14
14
  "scripts": {
15
15
  "mrm": "mrm --preset=@adonisjs/mrm-preset",
16
16
  "pretest": "npm run lint",
17
- "test": "node .bin/test.js",
18
- "clean": "del build",
17
+ "test": "node -r ts-node/register/transpile-only bin/test.ts",
18
+ "clean": "del-cli build",
19
19
  "compile": "npm run lint && npm run clean && tsc",
20
20
  "build": "npm run compile",
21
21
  "benchmark": "ENV_SILENT=true node build/benchmarks/index.js",
@@ -36,40 +36,44 @@
36
36
  "author": "virk,adonisjs",
37
37
  "license": "MIT",
38
38
  "devDependencies": {
39
- "@adonisjs/application": "^5.1.10",
39
+ "@adonisjs/application": "^5.2.0",
40
40
  "@adonisjs/encryption": "^4.0.7",
41
- "@adonisjs/mrm-preset": "^5.0.2",
41
+ "@adonisjs/mrm-preset": "^5.0.3",
42
42
  "@adonisjs/require-ts": "^2.0.10",
43
+ "@japa/assert": "^1.3.2",
44
+ "@japa/run-failed-tests": "^1.0.6",
45
+ "@japa/runner": "^2.0.5",
46
+ "@japa/spec-reporter": "^1.1.11",
43
47
  "@poppinss/dev-utils": "^2.0.2",
44
48
  "@types/cookie": "^0.4.1",
45
49
  "@types/ms": "^0.7.31",
46
- "@types/node": "^17.0.21",
50
+ "@types/node": "^17.0.23",
47
51
  "@types/pluralize": "0.0.29",
48
52
  "@types/proxy-addr": "^2.0.0",
49
53
  "@types/qs": "^6.9.7",
50
- "@types/supertest": "^2.0.11",
51
- "autocannon": "^7.7.0",
54
+ "@types/supertest": "^2.0.12",
55
+ "autocannon": "^7.8.0",
52
56
  "commitizen": "^4.2.4",
53
57
  "cross-env": "^7.0.3",
54
58
  "cz-conventional-changelog": "^3.3.0",
55
59
  "del-cli": "^4.0.1",
56
- "eslint": "^8.9.0",
57
- "eslint-config-prettier": "^8.4.0",
60
+ "eslint": "^8.11.0",
61
+ "eslint-config-prettier": "^8.5.0",
58
62
  "eslint-plugin-adonis": "^2.1.0",
59
63
  "eslint-plugin-prettier": "^4.0.0",
60
- "fastify": "^3.27.2",
64
+ "fastify": "^3.27.4",
61
65
  "github-label-sync": "^2.0.2",
62
66
  "http-status-codes": "^2.2.0",
63
67
  "husky": "^7.0.4",
64
- "japa": "^4.0.0",
65
68
  "middie": "^6.0.0",
66
- "mrm": "^3.0.10",
67
- "np": "^7.6.0",
69
+ "mrm": "^4.0.0",
70
+ "np": "^7.6.1",
68
71
  "pem": "^1.14.6",
69
- "prettier": "^2.5.1",
72
+ "prettier": "^2.6.0",
70
73
  "reflect-metadata": "^0.1.13",
71
74
  "supertest": "^6.2.2",
72
- "typescript": "^4.5.5"
75
+ "ts-node": "^10.7.0",
76
+ "typescript": "^4.6.2"
73
77
  },
74
78
  "peerDependencies": {
75
79
  "@adonisjs/application": "^5.0.0",
@@ -99,19 +103,18 @@
99
103
  "co-compose": "^7.0.1",
100
104
  "content-disposition": "^0.5.4",
101
105
  "cookie": "^0.4.2",
102
- "destroy": "^1.1.0",
106
+ "destroy": "^1.2.0",
103
107
  "encodeurl": "^1.0.2",
104
108
  "etag": "^1.8.1",
105
109
  "fresh": "^0.5.2",
106
110
  "haye": "^3.0.0",
107
- "macroable": "^6.0.1",
108
- "mime-types": "^2.1.34",
111
+ "macroable": "^7.0.0",
112
+ "mime-types": "^2.1.35",
109
113
  "ms": "^2.1.3",
110
114
  "on-finished": "^2.4.1",
111
115
  "pluralize": "^8.0.0",
112
116
  "proxy-addr": "^2.0.7",
113
117
  "qs": "^6.10.3",
114
- "set-cookie-parser": "^2.4.8",
115
118
  "tmp-cache": "^1.1.0",
116
119
  "type-is": "^1.6.18",
117
120
  "vary": "^1.1.2"