@ezs/basics 2.8.0 → 2.8.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.
- package/lib/csv-object.js +1 -1
- package/lib/file-save.js +2 -2
- package/lib/tar-extract.js +2 -1
- package/lib/url-connect.js +3 -3
- package/lib/url-fetch.js +2 -2
- package/lib/url-request.js +2 -2
- package/lib/url-stream.js +5 -2
- package/package.json +2 -2
package/lib/csv-object.js
CHANGED
|
@@ -9,7 +9,7 @@ function CSVObject(data, feed) {
|
|
|
9
9
|
return feed.close();
|
|
10
10
|
}
|
|
11
11
|
if (!this.columns) {
|
|
12
|
-
this.columns = data.map(name => name.replace(/\./g, ''));
|
|
12
|
+
this.columns = Array().concat(data).map(name => String(name).replace(/\./g, ''));
|
|
13
13
|
const countCols = {};
|
|
14
14
|
const renamedCols = {};
|
|
15
15
|
this.columns.forEach(colname => {
|
package/lib/file-save.js
CHANGED
|
@@ -71,11 +71,11 @@ function FILESave(data, feed) {
|
|
|
71
71
|
this.whenFinish = new Promise((resolve, reject) => {
|
|
72
72
|
const output = compress ? this.input.pipe((0, _fs.createWriteStream)(filename)) : this.input;
|
|
73
73
|
output.once('error', err => {
|
|
74
|
-
(0, _debug.default)('ezs')(`
|
|
74
|
+
(0, _debug.default)('ezs:warn')(`File ${filename} not saved.`, this.ezs.serializeError(err));
|
|
75
75
|
reject(err);
|
|
76
76
|
});
|
|
77
77
|
output.once('close', () => {
|
|
78
|
-
(0, _debug.default)('ezs')(`${filename} saved.`);
|
|
78
|
+
(0, _debug.default)('ezs:info')(`${filename} saved.`);
|
|
79
79
|
(0, _fs.lstat)(filename, (err, stat) => {
|
|
80
80
|
if (err) {
|
|
81
81
|
return reject(err);
|
package/lib/tar-extract.js
CHANGED
|
@@ -9,6 +9,7 @@ var _micromatch = _interopRequireDefault(require("micromatch"));
|
|
|
9
9
|
var _zlib = require("zlib");
|
|
10
10
|
var _getStream = _interopRequireDefault(require("get-stream"));
|
|
11
11
|
var _streamWrite = _interopRequireDefault(require("stream-write"));
|
|
12
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
/**
|
|
14
15
|
* Take the content of a tar file, extract some files.
|
|
@@ -65,7 +66,7 @@ function TARExtract(data, feed) {
|
|
|
65
66
|
value: contentRaw
|
|
66
67
|
}, () => next());
|
|
67
68
|
} catch (e) {
|
|
68
|
-
|
|
69
|
+
(0, _debug.default)('ezs:warn')(`File was ignored (${header.name})`, ezs.serializeError(e));
|
|
69
70
|
stream.resume();
|
|
70
71
|
return next();
|
|
71
72
|
}
|
package/lib/url-connect.js
CHANGED
|
@@ -65,7 +65,7 @@ async function URLConnect(data, feed) {
|
|
|
65
65
|
try {
|
|
66
66
|
await (0, _asyncRetry.default)(async (bail, numberOfTimes) => {
|
|
67
67
|
if (numberOfTimes > 1) {
|
|
68
|
-
(0, _debug.default)('ezs')(`Attempts to reconnect (${numberOfTimes})`);
|
|
68
|
+
(0, _debug.default)('ezs:debug')(`Attempts to reconnect (${numberOfTimes})`);
|
|
69
69
|
}
|
|
70
70
|
const controller = new _nodeAbortController.default();
|
|
71
71
|
const response = await (0, _fetchWithProxy.default)(url, {
|
|
@@ -105,10 +105,10 @@ async function URLConnect(data, feed) {
|
|
|
105
105
|
});
|
|
106
106
|
} catch (e) {
|
|
107
107
|
if (!noerror) {
|
|
108
|
-
(0, _debug.default)('ezs')(`Break item #${this.getIndex()} [URLConnect]
|
|
108
|
+
(0, _debug.default)('ezs:warn')(`Break item #${this.getIndex()} [URLConnect]`, ezs.serializeError(e));
|
|
109
109
|
feed.stop(e);
|
|
110
110
|
} else {
|
|
111
|
-
(0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLConnect]
|
|
111
|
+
(0, _debug.default)('ezs:info')(`Ignore item #${this.getIndex()} [URLConnect]`, ezs.serializeError(e));
|
|
112
112
|
}
|
|
113
113
|
output.end();
|
|
114
114
|
}
|
package/lib/url-fetch.js
CHANGED
|
@@ -73,10 +73,10 @@ async function URLFetch(data, feed) {
|
|
|
73
73
|
} catch (e) {
|
|
74
74
|
controller.abort();
|
|
75
75
|
if (noerror) {
|
|
76
|
-
(0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLFetch]
|
|
76
|
+
(0, _debug.default)('ezs:info')(`Ignore item #${this.getIndex()} [URLFetch]`, this.ezs.serializeError(e));
|
|
77
77
|
return feed.send(data);
|
|
78
78
|
}
|
|
79
|
-
(0, _debug.default)('ezs')(`Break item #${this.getIndex()} [URLFetch]
|
|
79
|
+
(0, _debug.default)('ezs:warn')(`Break item #${this.getIndex()} [URLFetch]`, this.ezs.serializeError(e));
|
|
80
80
|
return feed.send(e);
|
|
81
81
|
}
|
|
82
82
|
}
|
package/lib/url-request.js
CHANGED
|
@@ -77,10 +77,10 @@ async function URLRequest(data, feed) {
|
|
|
77
77
|
const onError = e => {
|
|
78
78
|
controller.abort();
|
|
79
79
|
if (noerror) {
|
|
80
|
-
(0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLRequest]
|
|
80
|
+
(0, _debug.default)('ezs:info')(`Ignore item #${this.getIndex()} [URLRequest]`, this.ezs.serializeError(e));
|
|
81
81
|
return feed.send(data);
|
|
82
82
|
}
|
|
83
|
-
(0, _debug.default)('ezs')(`Break item #${this.getIndex()} [URLRequest]
|
|
83
|
+
(0, _debug.default)('ezs:warn')(`Break item #${this.getIndex()} [URLRequest]`, this.ezs.serializeError(e));
|
|
84
84
|
return feed.send(e);
|
|
85
85
|
};
|
|
86
86
|
try {
|
package/lib/url-stream.js
CHANGED
|
@@ -82,6 +82,9 @@ async function URLStream(data, feed) {
|
|
|
82
82
|
if (this.isLast()) {
|
|
83
83
|
return feed.close();
|
|
84
84
|
}
|
|
85
|
+
const {
|
|
86
|
+
ezs
|
|
87
|
+
} = this;
|
|
85
88
|
const url = this.getParam('url');
|
|
86
89
|
const path = this.getParam('path', '*');
|
|
87
90
|
const retries = Number(this.getParam('retries', 5));
|
|
@@ -104,10 +107,10 @@ async function URLStream(data, feed) {
|
|
|
104
107
|
const onError = e => {
|
|
105
108
|
controller.abort();
|
|
106
109
|
if (noerror) {
|
|
107
|
-
(0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLStream]
|
|
110
|
+
(0, _debug.default)('ezs:info')(`Ignore item #${this.getIndex()} [URLStream]`, ezs.serializeError(e));
|
|
108
111
|
return feed.send(data);
|
|
109
112
|
}
|
|
110
|
-
(0, _debug.default)('ezs')(`Break item #${this.getIndex()} [URLStream]
|
|
113
|
+
(0, _debug.default)('ezs:warn')(`Break item #${this.getIndex()} [URLStream]`, ezs.serializeError(e));
|
|
111
114
|
return feed.send(e);
|
|
112
115
|
};
|
|
113
116
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezs/basics",
|
|
3
3
|
"description": "Basics statements for EZS",
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.2",
|
|
5
5
|
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Inist-CNRS/ezs/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"directories": {
|
|
36
36
|
"test": "test"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "037710b96f0d99070ce1ab92522b41262deefe69",
|
|
39
39
|
"homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
|
|
40
40
|
"keywords": [
|
|
41
41
|
"ezs"
|