alp-body-parser 6.1.2 → 7.0.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/CHANGELOG.md +16 -0
- package/dist/{index.d.ts → definitions/index.d.ts} +0 -0
- package/dist/definitions/index.d.ts.map +1 -0
- package/dist/{index-node14.mjs → index-node16.mjs} +1 -1
- package/dist/{index-node14.mjs.map → index-node16.mjs.map} +1 -1
- package/package.json +12 -16
- package/src/.eslintrc.json +1 -1
- package/dist/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
# [7.0.0](https://github.com/christophehurpeau/alp/compare/alp-body-parser@6.1.2...alp-body-parser@7.0.0) (2022-11-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* drop node 14 ([5d5f90b](https://github.com/christophehurpeau/alp/commit/5d5f90b09d8532278aba75a97f10ea90bbb27919))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* drop node 14
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [6.1.2](https://github.com/christophehurpeau/alp/compare/alp-body-parser@6.1.1...alp-body-parser@6.1.2) (2022-10-29)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package alp-body-parser
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,WAAwB,MAAM,KAAK,CAAC;AAE3C,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,OAAO;QACf,IAAI,EAAE,GAAG,CAAC;KACX;IAED,UAAU,WAAW;QACnB,SAAS,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/B,aAAa,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,aAAa,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;KACpC;CACF;AAQD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAqB5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
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,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": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "body parser in alp framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alp",
|
|
@@ -19,27 +19,26 @@
|
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": "
|
|
22
|
+
"node": ">=16.0.0"
|
|
23
23
|
},
|
|
24
|
-
"main": "./dist/index-
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
24
|
+
"main": "./dist/index-node16.mjs",
|
|
25
|
+
"types": "./dist/definitions/index.d.ts",
|
|
26
26
|
"exports": {
|
|
27
27
|
"./package.json": "./package.json",
|
|
28
28
|
".": {
|
|
29
29
|
"node": {
|
|
30
|
-
"import": "./dist/index-
|
|
30
|
+
"import": "./dist/index-node16.mjs"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
"module:node": "./dist/index-node14.mjs",
|
|
35
34
|
"sideEffects": false,
|
|
36
35
|
"scripts": {
|
|
37
36
|
"build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
|
|
38
|
-
"build:definitions": "tsc -p tsconfig.
|
|
37
|
+
"build:definitions": "tsc -p tsconfig.json",
|
|
39
38
|
"clean": "yarn clean:build",
|
|
40
39
|
"clean:build": "pob-babel-clean-out dist",
|
|
41
40
|
"lint": "yarn run lint:eslint",
|
|
42
|
-
"lint:eslint": "
|
|
41
|
+
"lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/alp-body-parser",
|
|
43
42
|
"watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
|
|
44
43
|
},
|
|
45
44
|
"prettier": "@pob/root/prettier-config",
|
|
@@ -47,10 +46,7 @@
|
|
|
47
46
|
"babelEnvs": [
|
|
48
47
|
{
|
|
49
48
|
"target": "node",
|
|
50
|
-
"version": "
|
|
51
|
-
"formats": [
|
|
52
|
-
"es"
|
|
53
|
-
]
|
|
49
|
+
"version": "16"
|
|
54
50
|
}
|
|
55
51
|
],
|
|
56
52
|
"entries": [
|
|
@@ -67,9 +63,9 @@
|
|
|
67
63
|
"koa": "^2.13.1"
|
|
68
64
|
},
|
|
69
65
|
"devDependencies": {
|
|
70
|
-
"@babel/core": "7.
|
|
71
|
-
"pob-babel": "
|
|
72
|
-
"typescript": "4.
|
|
66
|
+
"@babel/core": "7.20.2",
|
|
67
|
+
"pob-babel": "35.3.0",
|
|
68
|
+
"typescript": "4.9.3"
|
|
73
69
|
},
|
|
74
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "f50c153bb4ab2123eb137b375b2109734cd8fd0c"
|
|
75
71
|
}
|
package/src/.eslintrc.json
CHANGED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,WAAwB,MAAM,KAAK,CAAC;AAE3C,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,OAAO;QACf,IAAI,EAAE,GAAG,CAAC;KACX;IAED,UAAU,WAAW;QACnB,SAAS,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/B,aAAa,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,aAAa,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;KACpC;CACF;AAQD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAqB5D"}
|