@naturalcycles/nodejs-lib 13.2.1 → 13.2.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.
@@ -22,7 +22,7 @@ async function ndjsonMap(mapper, opt) {
22
22
  await (0, __1._pipeline)([
23
23
  readable,
24
24
  ...transformUnzip,
25
- (0, __1.transformSplit)(),
25
+ (0, __1.transformSplit)(), // splits by \n
26
26
  (0, __1.transformJsonParse)(),
27
27
  (0, __1.transformLimit)({ limit: limitInput, sourceReadable: readable }),
28
28
  (0, __1.transformLogProgress)({ metric: 'read', ...opt }),
@@ -21,7 +21,7 @@ async function pipelineFromNDJsonFile(streams, opt) {
21
21
  await (0, __1._pipeline)([
22
22
  node_fs_1.default.createReadStream(filePath),
23
23
  ...(gzip ? [(0, node_zlib_1.createUnzip)(opt.zlibOptions)] : []),
24
- (0, __1.transformSplit)(separator),
24
+ (0, __1.transformSplit)(separator), // splits by separator
25
25
  (0, transformJsonParse_1.transformJsonParse)(opt),
26
26
  (0, __1.transformTap)(() => rows++),
27
27
  ...streams,
@@ -27,7 +27,7 @@ async function pipelineToNDJsonFile(streams, opt) {
27
27
  ...streams,
28
28
  (0, __1.transformTap)(() => rows++),
29
29
  (0, transformToNDJson_1.transformToNDJson)(opt),
30
- ...(gzip ? [(0, node_zlib_1.createGzip)(opt.zlibOptions)] : []),
30
+ ...(gzip ? [(0, node_zlib_1.createGzip)(opt.zlibOptions)] : []), // optional gzip
31
31
  node_fs_1.default.createWriteStream(filePath),
32
32
  ]);
33
33
  const { size: sizeBytes } = node_fs_1.default.statSync(filePath);
@@ -28,7 +28,7 @@ function transformMultiThreaded(opt) {
28
28
  const worker = new node_worker_threads_1.Worker(workerProxyFilePath, {
29
29
  workerData: {
30
30
  workerIndex,
31
- workerFile,
31
+ workerFile, // pass it, so workerProxy can require() it
32
32
  ...workerData,
33
33
  },
34
34
  });
@@ -4,7 +4,7 @@ exports.inspectAny = exports._inspect = exports.inspectStringifyFn = void 0;
4
4
  const node_util_1 = require("node:util");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
6
  const INSPECT_OPT = {
7
- breakLength: 80,
7
+ breakLength: 80, // default: ??
8
8
  depth: 10, // default: 2
9
9
  };
10
10
  /**
@@ -7,7 +7,7 @@ const AJV_OPTIONS = {
7
7
  removeAdditional: true,
8
8
  allErrors: true,
9
9
  // https://ajv.js.org/options.html#usedefaults
10
- useDefaults: 'empty',
10
+ useDefaults: 'empty', // this will mutate your input!
11
11
  // these are important and kept same as default:
12
12
  // https://ajv.js.org/options.html#coercetypes
13
13
  coerceTypes: false, // while `false` - it won't mutate your input
@@ -29,13 +29,14 @@ function getAjv(opt) {
29
29
  require('ajv-formats')(ajv);
30
30
  // https://ajv.js.org/packages/ajv-keywords.html
31
31
  require('ajv-keywords')(ajv, [
32
- 'transform',
32
+ 'transform', // trim, toLowerCase, etc.
33
33
  'uniqueItemProperties',
34
34
  'instanceof',
35
35
  ]);
36
36
  // Adds $merge, $patch keywords
37
37
  // https://github.com/ajv-validator/ajv-merge-patch
38
- require('ajv-merge-patch')(ajv);
38
+ // Kirill: temporarily disabled, as it creates a noise of CVE warnings
39
+ // require('ajv-merge-patch')(ajv)
39
40
  return ajv;
40
41
  }
41
42
  exports.getAjv = getAjv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "13.2.1",
3
+ "version": "13.2.2",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "docs-serve": "vuepress dev docs",
@@ -20,7 +20,6 @@
20
20
  "ajv": "^8.6.2",
21
21
  "ajv-formats": "^2.1.0",
22
22
  "ajv-keywords": "^5.0.0",
23
- "ajv-merge-patch": "^5.0.1",
24
23
  "binary-split": "^1.0.5",
25
24
  "chalk": "^4.0.0",
26
25
  "debug": "^4.1.1",
@@ -38,7 +38,8 @@ export function getAjv(opt?: Options): Ajv {
38
38
 
39
39
  // Adds $merge, $patch keywords
40
40
  // https://github.com/ajv-validator/ajv-merge-patch
41
- require('ajv-merge-patch')(ajv)
41
+ // Kirill: temporarily disabled, as it creates a noise of CVE warnings
42
+ // require('ajv-merge-patch')(ajv)
42
43
 
43
44
  return ajv
44
45
  }