@naturalcycles/nodejs-lib 13.45.3 → 13.45.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.
@@ -13,6 +13,7 @@ class CSVWriter {
13
13
  ...cfg,
14
14
  };
15
15
  }
16
+ cfg;
16
17
  writeRows(rows) {
17
18
  let s = '';
18
19
  // Detect columns based on content, if not defined upfront
package/dist/fs/fs2.js CHANGED
@@ -35,26 +35,9 @@ const env_util_1 = require("../util/env.util");
35
35
  * 3. fs-extra
36
36
  */
37
37
  class FS2 {
38
- constructor() {
39
- // Naming convention is:
40
- // - async function has Async in the name, e.g readTextAsync
41
- // - sync function has postfix in the name, e.g readText
42
- // Re-export the whole fs/fsp, for the edge cases where they are needed
43
- this.fs = node_fs_1.default;
44
- this.fsp = promises_1.default;
45
- // Re-export existing fs/fsp functions
46
- // rm/rmAsync are replaced with removePath/removePathAsync
47
- this.lstat = node_fs_1.default.lstatSync;
48
- this.lstatAsync = promises_1.default.lstat;
49
- this.stat = node_fs_1.default.statSync;
50
- this.statAsync = promises_1.default.stat;
51
- this.mkdir = node_fs_1.default.mkdirSync;
52
- this.mkdirAsync = promises_1.default.mkdir;
53
- this.readdir = node_fs_1.default.readdirSync;
54
- this.readdirAsync = promises_1.default.readdir;
55
- this.createWriteStream = node_fs_1.default.createWriteStream;
56
- this.createReadStream = node_fs_1.default.createReadStream;
57
- }
38
+ // Naming convention is:
39
+ // - async function has Async in the name, e.g readTextAsync
40
+ // - sync function has postfix in the name, e.g readText
58
41
  /**
59
42
  * Convenience wrapper that defaults to utf-8 string output.
60
43
  */
@@ -291,6 +274,21 @@ class FS2 {
291
274
  })
292
275
  ?.isDirectory() || false);
293
276
  }
277
+ // Re-export the whole fs/fsp, for the edge cases where they are needed
278
+ fs = node_fs_1.default;
279
+ fsp = promises_1.default;
280
+ // Re-export existing fs/fsp functions
281
+ // rm/rmAsync are replaced with removePath/removePathAsync
282
+ lstat = node_fs_1.default.lstatSync;
283
+ lstatAsync = promises_1.default.lstat;
284
+ stat = node_fs_1.default.statSync;
285
+ statAsync = promises_1.default.stat;
286
+ mkdir = node_fs_1.default.mkdirSync;
287
+ mkdirAsync = promises_1.default.mkdir;
288
+ readdir = node_fs_1.default.readdirSync;
289
+ readdirAsync = promises_1.default.readdir;
290
+ createWriteStream = node_fs_1.default.createWriteStream;
291
+ createReadStream = node_fs_1.default.createReadStream;
294
292
  /*
295
293
  Returns a Readable of [already parsed] NDJSON objects.
296
294
 
@@ -30,6 +30,7 @@ function memoryUsageFull() {
30
30
  };
31
31
  }
32
32
  class ProcessUtil {
33
+ timer;
33
34
  startMemoryTimer(intervalMillis = 1000) {
34
35
  console.log(memoryUsage());
35
36
  this.timer = setInterval(() => {
@@ -23,6 +23,7 @@ const joi_validation_util_1 = require("../validation/joi/joi.validation.util");
23
23
  * openssl ec -in key.pem -pubout > key.pub.pem
24
24
  */
25
25
  class JWTService {
26
+ cfg;
26
27
  constructor(cfg) {
27
28
  this.cfg = cfg;
28
29
  }
@@ -42,6 +42,8 @@ class SlackService {
42
42
  timeoutSeconds: 90,
43
43
  });
44
44
  }
45
+ fetcher;
46
+ cfg;
45
47
  /**
46
48
  * Allows to "log" many things at once, similar to `console.log(one, two, three).
47
49
  */
@@ -4,11 +4,6 @@ exports.NDJsonStats = void 0;
4
4
  const js_lib_1 = require("@naturalcycles/js-lib");
5
5
  const colors_1 = require("../../colors/colors");
6
6
  class NDJsonStats {
7
- constructor() {
8
- this.tookMillis = 0;
9
- this.rows = 0;
10
- this.sizeBytes = 0;
11
- }
12
7
  static create(o = {}) {
13
8
  return Object.assign(new NDJsonStats(), o);
14
9
  }
@@ -19,6 +14,9 @@ class NDJsonStats {
19
14
  // eslint-disable-next-line unicorn/no-array-reduce
20
15
  return stats.reduce((statsTotal, stats) => statsTotal.add(stats), new NDJsonStats());
21
16
  }
17
+ tookMillis = 0;
18
+ rows = 0;
19
+ sizeBytes = 0;
22
20
  get rpsTotal() {
23
21
  return Math.round(this.rows / ((this.tookMillis || 1) / 1000));
24
22
  }
@@ -81,5 +81,7 @@ async function _pipelineToArray(streams, opt = {}) {
81
81
  return a;
82
82
  }
83
83
  class AbortableTransform extends node_stream_1.Transform {
84
+ sourceReadable;
85
+ streamDone;
84
86
  }
85
87
  exports.AbortableTransform = AbortableTransform;
@@ -29,6 +29,16 @@ class ProgressLogger {
29
29
  this.start();
30
30
  this.logStats(); // initial
31
31
  }
32
+ cfg;
33
+ started;
34
+ lastSecondStarted;
35
+ sma;
36
+ logEvery10;
37
+ processedLastSecond;
38
+ progress;
39
+ peakRSS;
40
+ sizes;
41
+ sizesZipped;
32
42
  start() {
33
43
  this.started = Date.now();
34
44
  this.lastSecondStarted = Date.now();
@@ -5,11 +5,12 @@ const js_lib_1 = require("@naturalcycles/js-lib");
5
5
  const colors_1 = require("../colors/colors");
6
6
  const zip_util_1 = require("../util/zip.util");
7
7
  class SizeStack extends js_lib_1.NumberStack {
8
+ name;
8
9
  constructor(name, size) {
9
10
  super(size);
10
11
  this.name = name;
11
- this.total = 0;
12
12
  }
13
+ total = 0;
13
14
  push(item) {
14
15
  this.total += item;
15
16
  return super.push(item);
@@ -5,6 +5,7 @@ exports.BaseWorkerClass = void 0;
5
5
  * Class to be extended, to be used with `transformMultiThreaded`
6
6
  */
7
7
  class BaseWorkerClass {
8
+ workerData;
8
9
  constructor(workerData) {
9
10
  this.workerData = workerData;
10
11
  }
@@ -16,6 +16,7 @@ class LRUMemoCache {
16
16
  ...opt,
17
17
  });
18
18
  }
19
+ lru;
19
20
  has(k) {
20
21
  return this.lru.has(k);
21
22
  }
@@ -12,6 +12,7 @@ const getAjv_1 = require("./getAjv");
12
12
  * @experimental
13
13
  */
14
14
  class AjvSchema {
15
+ schema;
15
16
  constructor(schema, cfg = {}) {
16
17
  this.schema = schema;
17
18
  this.cfg = {
@@ -62,6 +63,8 @@ class AjvSchema {
62
63
  const schema = index_1.fs2.readJson(filePath);
63
64
  return new AjvSchema(schema, cfg);
64
65
  }
66
+ cfg;
67
+ validateFunction;
65
68
  /**
66
69
  * It returns the original object just for convenience.
67
70
  * Reminder: Ajv will MUTATE your object under 2 circumstances:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "13.45.3",
3
+ "version": "13.45.4",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build",