@ezs/basics 1.14.0 → 1.15.4
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 +49 -0
- package/README.md +1 -0
- package/lib/json-parse.js +21 -10
- package/package.json +32 -37
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,55 @@
|
|
|
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
|
+
## [1.15.4](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.15.3...@ezs/basics@1.15.4) (2022-01-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* npm dependencies ([36c7ebe](https://github.com/Inist-CNRS/ezs/commit/36c7ebea03e82e9d177f7480f587511360e3dace))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.15.3](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.15.2...@ezs/basics@1.15.3) (2022-01-31)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @ezs/basics
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [1.15.2](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.15.1...@ezs/basics@1.15.2) (2022-01-27)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @ezs/basics
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [1.15.1](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.15.0...@ezs/basics@1.15.1) (2021-10-05)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* 🐛 fix wrong options + miss dep.x ([5b38d05](https://github.com/Inist-CNRS/ezs/commit/5b38d05199a9a49c73d264f4ddb9a45dd0e64c7e))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# [1.15.0](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.14.0...@ezs/basics@1.15.0) (2021-10-05)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* 🎸 introduce new parser ([66a408b](https://github.com/Inist-CNRS/ezs/commit/66a408b0be2f6f2374d7193df2576e2fa383d369))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
6
55
|
# [1.14.0](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.13.6...@ezs/basics@1.14.0) (2021-08-27)
|
|
7
56
|
|
|
8
57
|
|
package/README.md
CHANGED
|
@@ -284,6 +284,7 @@ Output:
|
|
|
284
284
|
#### Parameters
|
|
285
285
|
|
|
286
286
|
- `separator` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to split at every JSONPath found (optional, default `"*"`)
|
|
287
|
+
- `legacy` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** use legacy or newer parser (separator should be different) (optional, default `true`)
|
|
287
288
|
|
|
288
289
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
|
289
290
|
|
package/lib/json-parse.js
CHANGED
|
@@ -7,25 +7,35 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _JSONStream = _interopRequireDefault(require("JSONStream"));
|
|
9
9
|
|
|
10
|
+
var _stream = require("stream");
|
|
11
|
+
|
|
12
|
+
var _yajsonStream = _interopRequireDefault(require("yajson-stream"));
|
|
13
|
+
|
|
10
14
|
var _streamWrite = _interopRequireDefault(require("stream-write"));
|
|
11
15
|
|
|
12
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
17
|
|
|
14
18
|
function JSONParse(data, feed) {
|
|
15
|
-
if (
|
|
19
|
+
if (this.isFirst()) {
|
|
20
|
+
const legacy = this.getParam('legacy', true);
|
|
16
21
|
const separator = this.getParam('separator', '*');
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
|
|
23
|
+
if (legacy) {
|
|
24
|
+
this.input = _JSONStream.default.parse(separator);
|
|
25
|
+
this.whenFinish = feed.flow(this.input);
|
|
26
|
+
} else {
|
|
27
|
+
this.input = new _stream.PassThrough();
|
|
28
|
+
const stream = this.input.pipe(this.ezs.toBuffer()).pipe((0, _yajsonStream.default)(separator)).pipe(this.ezs((d, f) => f.send(d ? d.value : d)));
|
|
29
|
+
this.whenFinish = feed.flow(stream);
|
|
30
|
+
}
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.handle.end();
|
|
25
|
-
process.nextTick(() => {
|
|
26
|
-
feed.close();
|
|
27
|
-
});
|
|
33
|
+
if (this.isLast()) {
|
|
34
|
+
this.whenFinish.finally(() => feed.close());
|
|
35
|
+
return this.input.end();
|
|
28
36
|
}
|
|
37
|
+
|
|
38
|
+
(0, _streamWrite.default)(this.input, data, () => feed.end());
|
|
29
39
|
}
|
|
30
40
|
/**
|
|
31
41
|
* Parse a `String` to JSON and generate objects.
|
|
@@ -69,6 +79,7 @@ function JSONParse(data, feed) {
|
|
|
69
79
|
*
|
|
70
80
|
* @name JSONParse
|
|
71
81
|
* @param {String} [separator="*"] to split at every JSONPath found
|
|
82
|
+
* @param {String} [legacy=true] use legacy or newer parser (separator should be different)
|
|
72
83
|
* @returns {Object}
|
|
73
84
|
*/
|
|
74
85
|
|
package/package.json
CHANGED
|
@@ -1,63 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezs/basics",
|
|
3
|
-
"version": "1.14.0",
|
|
4
3
|
"description": "Basics statements for EZS",
|
|
5
|
-
"
|
|
6
|
-
"test": "test"
|
|
7
|
-
},
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/Inist-CNRS/ezs.git"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"ezs"
|
|
14
|
-
],
|
|
4
|
+
"version": "1.15.4",
|
|
15
5
|
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
|
|
16
|
-
"
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/Inist-CNRS/ezs/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
|
|
6
|
+
"bugs": "https://github.com/Inist-CNRS/ezs/issues",
|
|
21
7
|
"dependencies": {
|
|
22
|
-
"JSONStream": "
|
|
23
|
-
"better-https-proxy-agent": "1.0.
|
|
24
|
-
"csv-string": "
|
|
25
|
-
"debug": "4.
|
|
8
|
+
"JSONStream": "1.3.5",
|
|
9
|
+
"better-https-proxy-agent": "1.0.9",
|
|
10
|
+
"csv-string": "3.2.0",
|
|
11
|
+
"debug": "4.3.3",
|
|
26
12
|
"fetch-with-proxy": "3.0.1",
|
|
27
|
-
"flat": "
|
|
13
|
+
"flat": "5.0.2",
|
|
28
14
|
"lodash.escaperegexp": "4.1.2",
|
|
29
15
|
"lodash.get": "4.4.2",
|
|
30
16
|
"lodash.mapkeys": "4.6.0",
|
|
31
17
|
"lodash.mapvalues": "4.6.0",
|
|
32
18
|
"lodash.set": "4.3.2",
|
|
33
19
|
"lodash.zipobject": "4.1.3",
|
|
34
|
-
"micromatch": "4.0.
|
|
20
|
+
"micromatch": "4.0.4",
|
|
35
21
|
"node-abort-controller": "1.1.0",
|
|
36
22
|
"parse-headers": "2.0.4",
|
|
37
23
|
"stream-write": "1.0.1",
|
|
38
24
|
"tmp-filepath": "2.0.0",
|
|
39
25
|
"unzipper": "0.10.11",
|
|
40
|
-
"xml-mapping": "
|
|
41
|
-
"xml-splitter": "
|
|
26
|
+
"xml-mapping": "1.7.2",
|
|
27
|
+
"xml-splitter": "1.2.1",
|
|
28
|
+
"yajson-stream": "1.3.3"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"pako": "2.0.4"
|
|
42
32
|
},
|
|
33
|
+
"directories": {
|
|
34
|
+
"test": "test"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "653a28a1e40b088ea62b1b00c055de51e264dee1",
|
|
37
|
+
"homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
|
|
38
|
+
"keywords": [
|
|
39
|
+
"ezs"
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT",
|
|
43
42
|
"main": "./lib/index.js",
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@ezs/core": "1.27.2"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"repository": "Inist-CNRS/ezs.git",
|
|
44
50
|
"scripts": {
|
|
51
|
+
"build": "babel --root-mode upward src --out-dir lib",
|
|
45
52
|
"doc": "documentation readme src/* --sort-order=alpha --shallow --markdown-toc-max-depth=2 --readme-file=../../docs/plugin-basics.md --section=usage && cp ../../docs/plugin-basics.md ./README.md",
|
|
46
53
|
"lint": "eslint --ext=.js ./test/*.js ./src/*.js",
|
|
47
|
-
"build": "babel --root-mode upward src --out-dir lib",
|
|
48
54
|
"prepublish": "npm run build",
|
|
49
55
|
"pretest": "npm run build",
|
|
50
56
|
"preversion": "npm run doc"
|
|
51
|
-
}
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@ezs/core": "1.3.1",
|
|
57
|
-
"pako": "~1.0.11"
|
|
58
|
-
},
|
|
59
|
-
"peerDependencies": {
|
|
60
|
-
"@ezs/core": "*"
|
|
61
|
-
},
|
|
62
|
-
"gitHead": "c125659a94266cdeeeec21ee8d422231f51f6bbd"
|
|
57
|
+
}
|
|
63
58
|
}
|