alp-body-parser 7.2.0 → 8.0.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.0.1](https://github.com/christophehurpeau/alp/compare/alp-body-parser@8.0.0...alp-body-parser@8.0.1) (2023-07-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * dedupe and fix update alp ([aed32bc](https://github.com/christophehurpeau/alp/commit/aed32bc12e596acfd60f0d032a8d78a1ef68f9ee))
12
+
13
+
14
+
15
+ ## [8.0.0](https://github.com/christophehurpeau/alp/compare/alp-body-parser@7.2.0...alp-body-parser@8.0.0) (2023-07-29)
16
+
17
+
18
+ ### ⚠ BREAKING CHANGES
19
+
20
+ * drop node 16
21
+
22
+ ### Code Refactoring
23
+
24
+ * update to node 18 ([26280d6](https://github.com/christophehurpeau/alp/commit/26280d638aba1bd46fa42ad5a571b9626f1fff6d))
25
+
26
+
27
+
6
28
  ## [7.2.0](https://github.com/christophehurpeau/alp/compare/alp-body-parser@7.1.2...alp-body-parser@7.2.0) (2023-03-19)
7
29
 
8
30
 
@@ -29,4 +29,4 @@ function alpBodyParser(app) {
29
29
  }
30
30
 
31
31
  export { alpBodyParser as default };
32
- //# sourceMappingURL=index-node16.mjs.map
32
+ //# sourceMappingURL=index-node18.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-node16.mjs","sources":["../src/index.ts"],"sourcesContent":["import parse from 'co-body';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport Application, { Context } from 'koa';\n\ndeclare module 'koa' {\n interface Request {\n body: any;\n }\n\n interface BaseContext {\n parseBody: <T>() => Promise<T>;\n parseBodyJson: <T>() => Promise<T>;\n parseBodyText: <T>() => Promise<T>;\n }\n}\n\nconst assertBodyNotParsed = (ctx: Context): void => {\n if (ctx.request.body) {\n throw new Error('Request is already parsed');\n }\n};\n\nexport default function alpBodyParser(app: Application): void {\n app.context.parseBody = async function <T>(this: Context): Promise<T> {\n assertBodyNotParsed(this);\n const body: T = (await parse.form(this)) as T;\n this.request.body = body;\n return body;\n };\n\n app.context.parseBodyJson = async function <T>(this: Context): Promise<T> {\n assertBodyNotParsed(this);\n const body: T = (await parse.json(this)) as T;\n this.request.body = body;\n return body;\n };\n\n app.context.parseBodyText = async function <T>(this: Context): Promise<T> {\n assertBodyNotParsed(this);\n const body: T = (await parse.text(this)) as T;\n this.request.body = body;\n return body;\n };\n}\n"],"names":["assertBodyNotParsed","ctx","request","body","Error","alpBodyParser","app","context","parseBody","parse","form","parseBodyJson","json","parseBodyText","text"],"mappings":";;AACA;;AAeA,MAAMA,mBAAmB,GAAIC,GAAY,IAAW;AAClD,EAAA,IAAIA,GAAG,CAACC,OAAO,CAACC,IAAI,EAAE;AACpB,IAAA,MAAM,IAAIC,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC9C,GAAA;AACF,CAAC,CAAA;AAEc,SAASC,aAAaA,CAACC,GAAgB,EAAQ;AAC5DA,EAAAA,GAAG,CAACC,OAAO,CAACC,SAAS,GAAG,kBAA8C;IACpER,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACzB,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACC,IAAI,CAAC,IAAI,CAAO,CAAA;AAC7C,IAAA,IAAI,CAACR,OAAO,CAACC,IAAI,GAAGA,IAAI,CAAA;AACxB,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;AAEDG,EAAAA,GAAG,CAACC,OAAO,CAACI,aAAa,GAAG,kBAA8C;IACxEX,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACzB,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACG,IAAI,CAAC,IAAI,CAAO,CAAA;AAC7C,IAAA,IAAI,CAACV,OAAO,CAACC,IAAI,GAAGA,IAAI,CAAA;AACxB,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;AAEDG,EAAAA,GAAG,CAACC,OAAO,CAACM,aAAa,GAAG,kBAA8C;IACxEb,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACzB,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACK,IAAI,CAAC,IAAI,CAAO,CAAA;AAC7C,IAAA,IAAI,CAACZ,OAAO,CAACC,IAAI,GAAGA,IAAI,CAAA;AACxB,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"index-node18.mjs","sources":["../src/index.ts"],"sourcesContent":["import parse from 'co-body';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport Application, { Context } from 'koa';\n\ndeclare module 'koa' {\n interface Request {\n body: any;\n }\n\n interface BaseContext {\n parseBody: <T>() => Promise<T>;\n parseBodyJson: <T>() => Promise<T>;\n parseBodyText: <T>() => Promise<T>;\n }\n}\n\nconst assertBodyNotParsed = (ctx: Context): void => {\n if (ctx.request.body) {\n throw new Error('Request is already parsed');\n }\n};\n\nexport default function alpBodyParser(app: Application): void {\n app.context.parseBody = async function <T>(this: Context): Promise<T> {\n assertBodyNotParsed(this);\n const body: T = (await parse.form(this)) as T;\n this.request.body = body;\n return body;\n };\n\n app.context.parseBodyJson = async function <T>(this: Context): Promise<T> {\n assertBodyNotParsed(this);\n const body: T = (await parse.json(this)) as T;\n this.request.body = body;\n return body;\n };\n\n app.context.parseBodyText = async function <T>(this: Context): Promise<T> {\n assertBodyNotParsed(this);\n const body: T = (await parse.text(this)) as T;\n this.request.body = body;\n return body;\n };\n}\n"],"names":["assertBodyNotParsed","ctx","request","body","Error","alpBodyParser","app","context","parseBody","parse","form","parseBodyJson","json","parseBodyText","text"],"mappings":";;AACA;;AAeA,MAAMA,mBAAmB,GAAIC,GAAY,IAAW;AAClD,EAAA,IAAIA,GAAG,CAACC,OAAO,CAACC,IAAI,EAAE;AACpB,IAAA,MAAM,IAAIC,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC9C,GAAA;AACF,CAAC,CAAA;AAEc,SAASC,aAAaA,CAACC,GAAgB,EAAQ;AAC5DA,EAAAA,GAAG,CAACC,OAAO,CAACC,SAAS,GAAG,kBAA8C;IACpER,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACzB,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACC,IAAI,CAAC,IAAI,CAAO,CAAA;AAC7C,IAAA,IAAI,CAACR,OAAO,CAACC,IAAI,GAAGA,IAAI,CAAA;AACxB,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;AAEDG,EAAAA,GAAG,CAACC,OAAO,CAACI,aAAa,GAAG,kBAA8C;IACxEX,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACzB,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACG,IAAI,CAAC,IAAI,CAAO,CAAA;AAC7C,IAAA,IAAI,CAACV,OAAO,CAACC,IAAI,GAAGA,IAAI,CAAA;AACxB,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;AAEDG,EAAAA,GAAG,CAACC,OAAO,CAACM,aAAa,GAAG,kBAA8C;IACxEb,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACzB,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACK,IAAI,CAAC,IAAI,CAAO,CAAA;AAC7C,IAAA,IAAI,CAACZ,OAAO,CAACC,IAAI,GAAGA,IAAI,CAAA;AACxB,IAAA,OAAOA,IAAI,CAAA;GACZ,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alp-body-parser",
3
- "version": "7.2.0",
3
+ "version": "8.0.1",
4
4
  "description": "body parser in alp framework",
5
5
  "keywords": [
6
6
  "alp",
@@ -19,15 +19,16 @@
19
19
  },
20
20
  "type": "module",
21
21
  "engines": {
22
- "node": ">=16.0.0"
22
+ "node": ">=18.12.0"
23
23
  },
24
- "main": "./dist/index-node16.mjs",
24
+ "main": "./dist/index-node18.mjs",
25
25
  "types": "./dist/definitions/index.d.ts",
26
26
  "exports": {
27
27
  "./package.json": "./package.json",
28
28
  ".": {
29
+ "types": "./dist/definitions/index.d.ts",
29
30
  "node": {
30
- "import": "./dist/index-node16.mjs"
31
+ "import": "./dist/index-node18.mjs"
31
32
  }
32
33
  }
33
34
  },
@@ -46,7 +47,7 @@
46
47
  "babelEnvs": [
47
48
  {
48
49
  "target": "node",
49
- "version": "16"
50
+ "version": "18"
50
51
  }
51
52
  ],
52
53
  "entries": [
@@ -54,7 +55,7 @@
54
55
  ]
55
56
  },
56
57
  "peerDependencies": {
57
- "alp-node": "^5.0.0"
58
+ "alp-node": "^6.0.0"
58
59
  },
59
60
  "dependencies": {
60
61
  "@types/co-body": "^6.0.0",
@@ -63,9 +64,9 @@
63
64
  "koa": "^2.13.1"
64
65
  },
65
66
  "devDependencies": {
66
- "@babel/core": "7.21.3",
67
- "pob-babel": "35.6.2",
68
- "typescript": "4.9.5"
67
+ "@babel/core": "7.22.9",
68
+ "pob-babel": "36.2.0",
69
+ "typescript": "5.1.6"
69
70
  },
70
- "gitHead": "f7dfa98e33968879e3b16541652a316e92782259"
71
+ "gitHead": "939b2f12d7e4680a37c4575332818957ca085bd4"
71
72
  }