alp-body-parser 6.0.6 → 6.1.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,25 @@
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
+ ## [6.1.1](https://github.com/christophehurpeau/alp/compare/alp-body-parser@6.1.0...alp-body-parser@6.1.1) (2022-10-19)
7
+
8
+ **Note:** Version bump only for package alp-body-parser
9
+
10
+
11
+
12
+
13
+
14
+ # [6.1.0](https://github.com/christophehurpeau/alp/compare/alp-body-parser@6.0.6...alp-body-parser@6.1.0) (2022-10-16)
15
+
16
+
17
+ ### Features
18
+
19
+ * update to react 18 ([6ac42b8](https://github.com/christophehurpeau/alp/commit/6ac42b84b80bf76853773f3b93819666684327d1))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [6.0.6](https://github.com/christophehurpeau/alp/compare/alp-body-parser@6.0.5...alp-body-parser@6.0.6) (2022-10-13)
7
26
 
8
27
  **Note:** Version bump only for package alp-body-parser
package/README.md CHANGED
@@ -8,6 +8,9 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://npmjs.org/package/alp-body-parser"><img src="https://img.shields.io/npm/v/alp-body-parser.svg?style=flat-square"></a>
11
+ <a href="https://npmjs.org/package/alp-body-parser"><img src="https://img.shields.io/npm/dw/alp-body-parser.svg?style=flat-square"></a>
12
+ <a href="https://npmjs.org/package/alp-body-parser"><img src="https://img.shields.io/node/v/alp-body-parser.svg?style=flat-square"></a>
13
+ <a href="https://npmjs.org/package/alp-body-parser"><img src="https://img.shields.io/npm/types/alp-body-parser.svg?style=flat-square"></a>
11
14
  </p>
12
15
 
13
16
  ## Install
@@ -1,11 +1,12 @@
1
1
  import parse from 'co-body';
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/consistent-type-imports
4
+
3
5
  const assertBodyNotParsed = ctx => {
4
6
  if (ctx.request.body) {
5
7
  throw new Error('Request is already parsed');
6
8
  }
7
9
  };
8
-
9
10
  function alpBodyParser(app) {
10
11
  app.context.parseBody = async function () {
11
12
  assertBodyNotParsed(this);
@@ -13,14 +14,12 @@ function alpBodyParser(app) {
13
14
  this.request.body = body;
14
15
  return body;
15
16
  };
16
-
17
17
  app.context.parseBodyJson = async function () {
18
18
  assertBodyNotParsed(this);
19
19
  const body = await parse.json(this);
20
20
  this.request.body = body;
21
21
  return body;
22
22
  };
23
-
24
23
  app.context.parseBodyText = async function () {
25
24
  assertBodyNotParsed(this);
26
25
  const body = await parse.text(this);
@@ -1 +1 @@
1
- {"version":3,"file":"index-node14.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":";;AAgBA,MAAMA,mBAAmB,GAAIC,GAAD,IAAwB;EAClD,IAAIA,GAAG,CAACC,OAAJ,CAAYC,IAAhB,EAAsB;IACpB,MAAM,IAAIC,KAAJ,CAAU,2BAAV,CAAN;;AAEH,CAJD;;AAMe,SAASC,aAAT,CAAuBC,GAAvB,EAA+C;EAC5DA,GAAG,CAACC,OAAJ,CAAYC,SAAZ,GAAwB,kBAA8C;IACpER,mBAAmB,CAAC,IAAD,CAAnB;IACA,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACC,IAAN,CAAW,IAAX,CAAvB;IACA,KAAKR,OAAL,CAAaC,IAAb,GAAoBA,IAApB;IACA,OAAOA,IAAP;GAJF;;EAOAG,GAAG,CAACC,OAAJ,CAAYI,aAAZ,GAA4B,kBAA8C;IACxEX,mBAAmB,CAAC,IAAD,CAAnB;IACA,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACG,IAAN,CAAW,IAAX,CAAvB;IACA,KAAKV,OAAL,CAAaC,IAAb,GAAoBA,IAApB;IACA,OAAOA,IAAP;GAJF;;EAOAG,GAAG,CAACC,OAAJ,CAAYM,aAAZ,GAA4B,kBAA8C;IACxEb,mBAAmB,CAAC,IAAD,CAAnB;IACA,MAAMG,IAAO,GAAI,MAAMM,KAAK,CAACK,IAAN,CAAW,IAAX,CAAvB;IACA,KAAKZ,OAAL,CAAaC,IAAb,GAAoBA,IAApB;IACA,OAAOA,IAAP;GAJF;AAMD;;;;"}
1
+ {"version":3,"file":"index-node14.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,aAAa,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": "6.0.6",
3
+ "version": "6.1.1",
4
4
  "description": "body parser in alp framework",
5
5
  "keywords": [
6
6
  "alp",
@@ -37,16 +37,12 @@
37
37
  "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
38
38
  "build:definitions": "tsc -p tsconfig.build.json",
39
39
  "clean": "yarn clean:build",
40
- "clean:build": "rm -Rf dist",
40
+ "clean:build": "pob-babel-clean-out dist",
41
41
  "lint": "yarn run lint:eslint",
42
42
  "lint:eslint": "cd ../.. && yarn run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/alp-body-parser",
43
43
  "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
44
44
  },
45
- "prettier": {
46
- "trailingComma": "all",
47
- "singleQuote": true,
48
- "arrowParens": "always"
49
- },
45
+ "prettier": "@pob/root/prettier-config",
50
46
  "pob": {
51
47
  "babelEnvs": [
52
48
  {
@@ -71,9 +67,9 @@
71
67
  "koa": "^2.13.1"
72
68
  },
73
69
  "devDependencies": {
74
- "@babel/core": "7.17.5",
75
- "pob-babel": "32.2.0",
76
- "typescript": "4.6.2"
70
+ "@babel/core": "7.19.3",
71
+ "pob-babel": "34.2.0",
72
+ "typescript": "4.8.4"
77
73
  },
78
- "gitHead": "81644a1b75145fc792fadce0c04096aea046994b"
74
+ "gitHead": "37573847487da0689917f2667f5c810f0136eab7"
79
75
  }
package/rollup.config.mjs DELETED
@@ -1,5 +0,0 @@
1
- import createRollupConfig from 'pob-babel/createRollupConfig.js';
2
-
3
- export default createRollupConfig({
4
- cwd: new URL('.', import.meta.url).pathname,
5
- });
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
-
4
- "compilerOptions": {
5
- "noEmit": true
6
- }
7
- }