@naturalcycles/nodejs-lib 12.76.0 → 12.77.1

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.
Files changed (95) hide show
  1. package/dist/bin/secrets-gen-key.js +1 -1
  2. package/dist/buffer/buffer.util.js +1 -1
  3. package/dist/colors/colors.js +1 -1
  4. package/dist/fs/kpy.js +1 -1
  5. package/dist/got/getGot.js +2 -2
  6. package/dist/infra/process.util.js +1 -1
  7. package/dist/secret/secrets-decrypt.util.js +1 -1
  8. package/dist/secret/secrets-encrypt.util.js +1 -1
  9. package/dist/security/crypto.util.js +3 -3
  10. package/dist/security/hash.util.d.ts +13 -2
  11. package/dist/security/hash.util.js +35 -9
  12. package/dist/security/secret.util.js +1 -1
  13. package/dist/stream/ndjson/ndjsonMap.js +6 -6
  14. package/dist/stream/ndjson/ndjsonStreamForEach.js +3 -3
  15. package/dist/stream/ndjson/pipelineFromNDJsonFile.d.ts +1 -1
  16. package/dist/stream/ndjson/pipelineFromNDJsonFile.js +2 -2
  17. package/dist/stream/ndjson/pipelineToNDJsonFile.d.ts +1 -1
  18. package/dist/stream/ndjson/pipelineToNDJsonFile.js +2 -2
  19. package/dist/stream/ndjson/transformJsonParse.js +2 -2
  20. package/dist/stream/ndjson/transformToNDJson.js +2 -2
  21. package/dist/stream/pipeline/pipeline.d.ts +1 -1
  22. package/dist/stream/pipeline/pipeline.js +3 -3
  23. package/dist/stream/readable/readableCreate.d.ts +1 -1
  24. package/dist/stream/readable/readableCreate.js +3 -3
  25. package/dist/stream/readable/readableFromArray.d.ts +1 -1
  26. package/dist/stream/readable/readableFromArray.js +2 -2
  27. package/dist/stream/readable/readableMap.js +2 -2
  28. package/dist/stream/stream.model.d.ts +1 -1
  29. package/dist/stream/stream.util.d.ts +1 -1
  30. package/dist/stream/transform/transformBuffer.js +2 -2
  31. package/dist/stream/transform/transformFilter.js +2 -2
  32. package/dist/stream/transform/transformLimit.d.ts +1 -1
  33. package/dist/stream/transform/transformLogProgress.js +4 -4
  34. package/dist/stream/transform/transformMapSimple.js +2 -2
  35. package/dist/stream/transform/transformNoOp.js +2 -2
  36. package/dist/stream/transform/transformTap.js +2 -2
  37. package/dist/stream/transform/transformToArray.js +2 -2
  38. package/dist/stream/transform/transformToString.js +2 -2
  39. package/dist/stream/transform/worker/transformMultiThreaded.js +2 -2
  40. package/dist/stream/writable/writableFork.js +2 -2
  41. package/dist/stream/writable/writableLimit.d.ts +1 -1
  42. package/dist/stream/writable/writableLimit.js +2 -2
  43. package/dist/stream/writable/writablePushToArray.js +2 -2
  44. package/dist/stream/writable/writableVoid.d.ts +1 -1
  45. package/dist/stream/writable/writableVoid.js +2 -2
  46. package/dist/string/inspectAny.d.ts +1 -1
  47. package/dist/string/inspectAny.js +3 -3
  48. package/dist/util/env.util.js +1 -1
  49. package/dist/util/zip.util.d.ts +1 -1
  50. package/dist/util/zip.util.js +6 -6
  51. package/dist/validation/ajv/ajv.util.js +1 -1
  52. package/dist/validation/ajv/ajvSchema.js +1 -1
  53. package/package.json +2 -5
  54. package/src/bin/secrets-gen-key.ts +1 -1
  55. package/src/buffer/buffer.util.ts +1 -1
  56. package/src/colors/colors.ts +1 -1
  57. package/src/fs/kpy.ts +1 -1
  58. package/src/got/getGot.ts +1 -1
  59. package/src/infra/process.util.ts +1 -1
  60. package/src/secret/secrets-decrypt.util.ts +1 -1
  61. package/src/secret/secrets-encrypt.util.ts +1 -1
  62. package/src/security/crypto.util.ts +3 -3
  63. package/src/security/hash.util.ts +33 -7
  64. package/src/security/secret.util.ts +1 -1
  65. package/src/stream/ndjson/ndjsonMap.ts +2 -2
  66. package/src/stream/ndjson/ndjsonStreamForEach.ts +2 -2
  67. package/src/stream/ndjson/pipelineFromNDJsonFile.ts +1 -1
  68. package/src/stream/ndjson/pipelineToNDJsonFile.ts +1 -1
  69. package/src/stream/ndjson/transformJsonParse.ts +1 -1
  70. package/src/stream/ndjson/transformToNDJson.ts +1 -1
  71. package/src/stream/pipeline/pipeline.ts +1 -1
  72. package/src/stream/readable/readableCreate.ts +1 -1
  73. package/src/stream/readable/readableFromArray.ts +1 -1
  74. package/src/stream/readable/readableMap.ts +1 -1
  75. package/src/stream/stream.model.ts +1 -1
  76. package/src/stream/stream.util.ts +1 -1
  77. package/src/stream/transform/transformBuffer.ts +1 -1
  78. package/src/stream/transform/transformFilter.ts +1 -1
  79. package/src/stream/transform/transformLimit.ts +1 -1
  80. package/src/stream/transform/transformLogProgress.ts +2 -2
  81. package/src/stream/transform/transformMapSimple.ts +1 -1
  82. package/src/stream/transform/transformNoOp.ts +1 -1
  83. package/src/stream/transform/transformTap.ts +1 -1
  84. package/src/stream/transform/transformToArray.ts +1 -1
  85. package/src/stream/transform/transformToString.ts +1 -1
  86. package/src/stream/transform/worker/transformMultiThreaded.ts +1 -1
  87. package/src/stream/writable/writableFork.ts +1 -1
  88. package/src/stream/writable/writableLimit.ts +1 -1
  89. package/src/stream/writable/writablePushToArray.ts +1 -1
  90. package/src/stream/writable/writableVoid.ts +1 -1
  91. package/src/string/inspectAny.ts +1 -1
  92. package/src/util/env.util.ts +1 -1
  93. package/src/util/zip.util.ts +3 -3
  94. package/src/validation/ajv/ajv.util.ts +1 -1
  95. package/src/validation/ajv/ajvSchema.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformToString = void 0;
4
- const stream_1 = require("stream");
4
+ const node_stream_1 = require("node:stream");
5
5
  /**
6
6
  * Transforms objectMode=false Buffers/strings into objectMode=true strings.
7
7
  *
@@ -12,7 +12,7 @@ const stream_1 = require("stream");
12
12
  * transformToString(), // string chunks, but objectMode==true
13
13
  */
14
14
  function transformToString() {
15
- return new stream_1.Transform({
15
+ return new node_stream_1.Transform({
16
16
  objectMode: false,
17
17
  readableObjectMode: true,
18
18
  transform(chunk, _, cb) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformMultiThreaded = void 0;
4
- const worker_threads_1 = require("worker_threads");
4
+ const node_worker_threads_1 = require("node:worker_threads");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
6
  const through2Concurrent = require("through2-concurrent");
7
7
  const workerProxyFilePath = `${__dirname}/workerClassProxy.js`;
@@ -25,7 +25,7 @@ function transformMultiThreaded(opt) {
25
25
  let index = -1; // input chunk index, will start from 0
26
26
  const workers = (0, js_lib_1._range)(0, poolSize).map(workerIndex => {
27
27
  workerDonePromises.push((0, js_lib_1.pDefer)());
28
- const worker = new worker_threads_1.Worker(workerProxyFilePath, {
28
+ const worker = new node_worker_threads_1.Worker(workerProxyFilePath, {
29
29
  workerData: {
30
30
  workerIndex,
31
31
  workerFile,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writableFork = void 0;
4
- const stream_1 = require("stream");
4
+ const node_stream_1 = require("node:stream");
5
5
  const __1 = require("../..");
6
6
  /**
7
7
  * Allows "forking" a stream inside pipeline into a number of pipeline chains (2 or more).
@@ -21,7 +21,7 @@ function writableFork(chains, opt) {
21
21
  console.error(err); // ensure the error is logged
22
22
  throw err;
23
23
  });
24
- return new stream_1.Writable({
24
+ return new node_stream_1.Writable({
25
25
  objectMode: true,
26
26
  ...opt,
27
27
  write(chunk, _, cb) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Readable } from 'stream';
2
+ import { Readable } from 'node:stream';
3
3
  import { WritableTyped } from '../stream.model';
4
4
  /**
5
5
  * Allows to stop the Readable stream after the pipeline has processed X number of rows.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writableLimit = void 0;
4
- const stream_1 = require("stream");
4
+ const node_stream_1 = require("node:stream");
5
5
  /**
6
6
  * Allows to stop the Readable stream after the pipeline has processed X number of rows.
7
7
  * It counts OUTPUT rows (not input), because this Writable is always at the end of the Pipeline.
@@ -9,7 +9,7 @@ const stream_1 = require("stream");
9
9
  */
10
10
  function writableLimit(readable, limit) {
11
11
  let i = 0;
12
- return new stream_1.Writable({
12
+ return new node_stream_1.Writable({
13
13
  objectMode: true,
14
14
  write(chunk, _, cb) {
15
15
  if (limit === 0)
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writablePushToArray = void 0;
4
- const stream_1 = require("stream");
4
+ const node_stream_1 = require("node:stream");
5
5
  /**
6
6
  * Will push all results to `arr`, will emit nothing in the end.
7
7
  */
8
8
  function writablePushToArray(arr, opt = {}) {
9
- return new stream_1.Writable({
9
+ return new node_stream_1.Writable({
10
10
  objectMode: true,
11
11
  ...opt,
12
12
  write(chunk, _, cb) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Writable } from 'stream';
2
+ import { Writable } from 'node:stream';
3
3
  import { DeferredPromise } from '@naturalcycles/js-lib';
4
4
  import { TransformOptions } from '../stream.model';
5
5
  export interface WritableVoidOptions extends TransformOptions {
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writableVoid = void 0;
4
- const stream_1 = require("stream");
4
+ const node_stream_1 = require("node:stream");
5
5
  /**
6
6
  * Use as a "null-terminator" of stream.pipeline.
7
7
  * It consumes the stream as quickly as possible without doing anything.
8
8
  * Put it in the end of your pipeline in case it ends with Transform that needs a consumer.
9
9
  */
10
10
  function writableVoid(opt = {}) {
11
- return new stream_1.Writable({
11
+ return new node_stream_1.Writable({
12
12
  objectMode: true,
13
13
  ...opt,
14
14
  write(chunk, _, cb) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { InspectOptions } from 'util';
2
+ import { InspectOptions } from 'node:util';
3
3
  import { StringifyAnyOptions, JsonStringifyFunction } from '@naturalcycles/js-lib';
4
4
  export interface InspectAnyOptions extends StringifyAnyOptions, InspectOptions {
5
5
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inspectAny = exports.inspectAnyStringifyFn = void 0;
4
- const util_1 = require("util");
4
+ const node_util_1 = require("node:util");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
6
  const INSPECT_OPT = {
7
7
  breakLength: 80,
@@ -32,14 +32,14 @@ exports.inspectAnyStringifyFn = inspectAnyStringifyFn;
32
32
  function inspectAny(obj, opt = {}) {
33
33
  // Inspect handles functions better
34
34
  if (typeof obj === 'function') {
35
- return (0, util_1.inspect)(obj, {
35
+ return (0, node_util_1.inspect)(obj, {
36
36
  ...INSPECT_OPT,
37
37
  ...opt,
38
38
  });
39
39
  }
40
40
  return (0, js_lib_1._stringifyAny)(obj, {
41
41
  ...opt,
42
- stringifyFn: obj => (0, util_1.inspect)(obj, {
42
+ stringifyFn: obj => (0, node_util_1.inspect)(obj, {
43
43
  ...INSPECT_OPT,
44
44
  ...opt,
45
45
  }),
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requireFileToExist = exports.requireEnvKeys = void 0;
4
- const fs = require("fs");
4
+ const fs = require("node:fs");
5
5
  require("dotenv/config"); // ensure .env is read before requiring keys
6
6
  /**
7
7
  * @example
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { ZlibOptions } from 'zlib';
3
+ import { ZlibOptions } from 'node:zlib';
4
4
  /**
5
5
  * deflateBuffer uses `deflate`.
6
6
  * It's 9 bytes shorter than `gzip`.
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.gunzipToString = exports.gzipString = exports.gunzipBuffer = exports.gzipBuffer = exports.inflateToString = exports.deflateString = exports.inflateBuffer = exports.deflateBuffer = void 0;
4
- const util_1 = require("util");
5
- const zlib = require("zlib");
6
- const deflate = (0, util_1.promisify)(zlib.deflate.bind(zlib));
7
- const inflate = (0, util_1.promisify)(zlib.inflate.bind(zlib));
8
- const gzip = (0, util_1.promisify)(zlib.gzip.bind(zlib));
9
- const gunzip = (0, util_1.promisify)(zlib.gunzip.bind(zlib));
4
+ const node_util_1 = require("node:util");
5
+ const zlib = require("node:zlib");
6
+ const deflate = (0, node_util_1.promisify)(zlib.deflate.bind(zlib));
7
+ const inflate = (0, node_util_1.promisify)(zlib.inflate.bind(zlib));
8
+ const gzip = (0, node_util_1.promisify)(zlib.gzip.bind(zlib));
9
+ const gunzip = (0, node_util_1.promisify)(zlib.gunzip.bind(zlib));
10
10
  // string > compressed buffer
11
11
  /**
12
12
  * deflateBuffer uses `deflate`.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readAjvSchemas = exports.readJsonSchemas = void 0;
4
- const fs = require("fs");
4
+ const fs = require("node:fs");
5
5
  const __1 = require("../..");
6
6
  const ajvSchema_1 = require("./ajvSchema");
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AjvSchema = void 0;
4
- const fs = require("fs");
4
+ const fs = require("node:fs");
5
5
  const js_lib_1 = require("@naturalcycles/js-lib");
6
6
  const index_1 = require("../../index");
7
7
  const ajvValidationError_1 = require("./ajvValidationError");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "12.76.0",
3
+ "version": "12.77.1",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "docs-serve": "vuepress dev docs",
@@ -49,10 +49,7 @@
49
49
  "vue-class-component": "^7.2.6",
50
50
  "vuepress": "^1.7.1",
51
51
  "vuepress-plugin-typescript": "^0.3.1",
52
- "weak-napi": "^2.0.0"
53
- },
54
- "resolutions": {
55
- "prettier": "^2.0.0"
52
+ "zod": "^3.19.1"
56
53
  },
57
54
  "bin": {
58
55
  "del": "dist/bin/del.js",
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import * as crypto from 'crypto'
3
+ import * as crypto from 'node:crypto'
4
4
  import * as yargs from 'yargs'
5
5
  import { dimGrey } from '../colors'
6
6
  import { runScript } from '../script'
@@ -5,7 +5,7 @@ export function _chunkBuffer(buf: Buffer, size: number): Buffer[] {
5
5
  const out: Buffer[] = []
6
6
 
7
7
  for (let i = 0; i < buf.length; i += size) {
8
- out.push(buf.slice(i, i + size))
8
+ out.push(buf.subarray(i, i + size))
9
9
  }
10
10
 
11
11
  return out
@@ -1,4 +1,4 @@
1
- import * as tty from 'tty'
1
+ import * as tty from 'node:tty'
2
2
 
3
3
  /**
4
4
  * Based on: https://github.com/sindresorhus/yoctocolors/pull/5
package/src/fs/kpy.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as path from 'path'
1
+ import * as path from 'node:path'
2
2
  import { _since } from '@naturalcycles/js-lib'
3
3
  import * as cpFile from 'cp-file'
4
4
  import * as fs from 'fs-extra'
package/src/got/getGot.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { URL } from 'url'
1
+ import { URL } from 'node:url'
2
2
  import { _since } from '@naturalcycles/js-lib'
3
3
  import got, {
4
4
  AfterResponseHook,
@@ -1,4 +1,4 @@
1
- import * as os from 'os'
1
+ import * as os from 'node:os'
2
2
  import { _mb } from '@naturalcycles/js-lib'
3
3
 
4
4
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
@@ -1,4 +1,4 @@
1
- import * as path from 'path'
1
+ import * as path from 'node:path'
2
2
  import { _assert } from '@naturalcycles/js-lib'
3
3
  import * as fs from 'fs-extra'
4
4
  import { dimGrey, yellow } from '../colors'
@@ -1,4 +1,4 @@
1
- import * as path from 'path'
1
+ import * as path from 'node:path'
2
2
  import { _assert } from '@naturalcycles/js-lib'
3
3
  import * as fs from 'fs-extra'
4
4
  import { dimGrey, yellow } from '../colors'
@@ -1,4 +1,4 @@
1
- import * as crypto from 'crypto'
1
+ import * as crypto from 'node:crypto'
2
2
  import { _stringMapEntries, StringMap } from '@naturalcycles/js-lib'
3
3
  import { md5 } from './hash.util'
4
4
 
@@ -26,8 +26,8 @@ export function decryptRandomIVBuffer(input: Buffer, secretKeyBase64: string): B
26
26
  const key = md5(Buffer.from(secretKeyBase64, 'base64'))
27
27
 
28
28
  // iv is first 16 bytes of encrypted buffer, the rest is payload
29
- const iv = input.slice(0, 16)
30
- const payload = input.slice(16)
29
+ const iv = input.subarray(0, 16)
30
+ const payload = input.subarray(16)
31
31
 
32
32
  const decipher = crypto.createDecipheriv(algorithm, key, iv)
33
33
 
@@ -1,13 +1,29 @@
1
- import * as crypto from 'crypto'
1
+ import * as crypto from 'node:crypto'
2
2
 
3
3
  export function md5(s: string | Buffer): string {
4
4
  return hash(s, 'md5')
5
5
  }
6
6
 
7
+ export function md5AsBase64(s: string | Buffer): string {
8
+ return hashAsBuffer(s, 'md5').toString('base64')
9
+ }
10
+
7
11
  export function md5AsBuffer(s: string | Buffer): Buffer {
8
12
  return hashAsBuffer(s, 'md5')
9
13
  }
10
14
 
15
+ export function sha256(s: string | Buffer): string {
16
+ return hash(s, 'sha256')
17
+ }
18
+
19
+ export function sha256AsBase64(s: string | Buffer): string {
20
+ return hashAsBuffer(s, 'sha256').toString('base64')
21
+ }
22
+
23
+ export function sha256AsBuffer(s: string | Buffer): Buffer {
24
+ return hashAsBuffer(s, 'sha256')
25
+ }
26
+
11
27
  export function hash(s: string | Buffer, algorithm: string): string {
12
28
  return crypto.createHash(algorithm).update(s).digest('hex')
13
29
  }
@@ -16,18 +32,28 @@ export function hashAsBuffer(s: string | Buffer, algorithm: string): Buffer {
16
32
  return crypto.createHash(algorithm).update(s).digest()
17
33
  }
18
34
 
19
- export function stringToBase64(s: string): string {
20
- return Buffer.from(s, 'utf8').toString('base64')
35
+ export function base64(s: string | Buffer): string {
36
+ return (Buffer.isBuffer(s) ? s : Buffer.from(s, 'utf8')).toString('base64')
21
37
  }
22
38
 
23
39
  export function base64ToString(strBase64: string): string {
24
40
  return Buffer.from(strBase64, 'base64').toString('utf8')
25
41
  }
26
42
 
27
- export function bufferToBase64(b: Buffer): string {
28
- return b.toString('base64')
29
- }
30
-
31
43
  export function base64ToBuffer(strBase64: string): Buffer {
32
44
  return Buffer.from(strBase64, 'base64')
33
45
  }
46
+
47
+ /**
48
+ * @deprecated use `base64`
49
+ */
50
+ export function stringToBase64(s: string): string {
51
+ return Buffer.from(s, 'utf8').toString('base64')
52
+ }
53
+
54
+ /**
55
+ * @deprecated use `base64`
56
+ */
57
+ export function bufferToBase64(b: Buffer): string {
58
+ return b.toString('base64')
59
+ }
@@ -1,4 +1,4 @@
1
- import * as fs from 'fs'
1
+ import * as fs from 'node:fs'
2
2
  import { _assert, StringMap } from '@naturalcycles/js-lib'
3
3
  import { base64ToString } from '..'
4
4
  import { decryptObject, decryptRandomIVBuffer } from './crypto.util'
@@ -1,5 +1,5 @@
1
- import { createReadStream, createWriteStream } from 'fs'
2
- import { createGzip, createUnzip } from 'zlib'
1
+ import { createReadStream, createWriteStream } from 'node:fs'
2
+ import { createGzip, createUnzip } from 'node:zlib'
3
3
  import { AbortableAsyncMapper, ErrorMode } from '@naturalcycles/js-lib'
4
4
  import {
5
5
  requireFileToExist,
@@ -1,5 +1,5 @@
1
- import * as fs from 'fs'
2
- import { createUnzip } from 'zlib'
1
+ import * as fs from 'node:fs'
2
+ import { createUnzip } from 'node:zlib'
3
3
  import { AbortableAsyncMapper, ErrorMode } from '@naturalcycles/js-lib'
4
4
  import {
5
5
  requireFileToExist,
@@ -1,4 +1,4 @@
1
- import { createUnzip, ZlibOptions } from 'zlib'
1
+ import { createUnzip, ZlibOptions } from 'node:zlib'
2
2
  import { _hb } from '@naturalcycles/js-lib'
3
3
  import * as fs from 'fs-extra'
4
4
  import { transformTap, _pipeline, transformSplit } from '../..'
@@ -1,4 +1,4 @@
1
- import { createGzip, ZlibOptions } from 'zlib'
1
+ import { createGzip, ZlibOptions } from 'node:zlib'
2
2
  import { AppError } from '@naturalcycles/js-lib'
3
3
  import * as fs from 'fs-extra'
4
4
  import { transformTap, _pipeline } from '../..'
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { Reviver } from '@naturalcycles/js-lib'
3
3
  import { TransformTyped } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { _sortObjectDeep } from '@naturalcycles/js-lib'
3
3
  import { TransformTyped } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { pipeline, Readable, Transform, Writable } from 'stream'
1
+ import { pipeline, Readable, Transform, Writable } from 'node:stream'
2
2
  import { _last, AnyFunction, DeferredPromise, pDefer } from '@naturalcycles/js-lib'
3
3
  import { writablePushToArray } from '../../index'
4
4
 
@@ -1,4 +1,4 @@
1
- import { Readable, ReadableOptions } from 'stream'
1
+ import { Readable, ReadableOptions } from 'node:stream'
2
2
  import { ReadableTyped } from '../stream.model'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Readable, ReadableOptions } from 'stream'
1
+ import { Readable, ReadableOptions } from 'node:stream'
2
2
  import { _passthroughMapper, AbortableAsyncMapper } from '@naturalcycles/js-lib'
3
3
  import { ReadableTyped } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { AbortableAsyncMapper, SKIP } from '@naturalcycles/js-lib'
3
3
  import { ReadableTyped } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { Readable, Transform, Writable } from 'stream'
1
+ import { Readable, Transform, Writable } from 'node:stream'
2
2
 
3
3
  // eslint-disable-next-line unused-imports/no-unused-vars
4
4
  export interface ReadableTyped<T> extends Readable {}
@@ -1,4 +1,4 @@
1
- import { Readable } from 'stream'
1
+ import { Readable } from 'node:stream'
2
2
  import { CommonLogger } from '@naturalcycles/js-lib'
3
3
 
4
4
  export function pipelineClose(
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { TransformOptions, TransformTyped } from '../stream.model'
3
3
 
4
4
  export interface TransformBufferOptions extends TransformOptions {
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { AsyncPredicate, Predicate } from '@naturalcycles/js-lib'
3
3
  import { TransformOptions, TransformTyped } from '../stream.model'
4
4
  import { transformMap, TransformMapOptions } from './transformMap'
@@ -1,4 +1,4 @@
1
- import { Readable } from 'stream'
1
+ import { Readable } from 'node:stream'
2
2
  import { CommonLogger } from '@naturalcycles/js-lib'
3
3
  import { AbortableTransform, transformNoOp } from '../../index'
4
4
  import { TransformOptions, TransformTyped } from '../stream.model'
@@ -1,5 +1,5 @@
1
- import { Transform } from 'stream'
2
- import { inspect, InspectOptions } from 'util'
1
+ import { Transform } from 'node:stream'
2
+ import { inspect, InspectOptions } from 'node:util'
3
3
  import {
4
4
  SimpleMovingAverage,
5
5
  _mb,
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { CommonLogger, ErrorMode, Mapper } from '@naturalcycles/js-lib'
3
3
  import { TransformTyped } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { TransformTyped } from '../stream.model'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { AsyncMapper, CommonLogger } from '@naturalcycles/js-lib'
3
3
  import { TransformOptions, TransformTyped } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { TransformOptions, TransformTyped } from '../stream.model'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Transform } from 'stream'
1
+ import { Transform } from 'node:stream'
2
2
  import { TransformTyped } from '../stream.model'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Worker } from 'worker_threads'
1
+ import { Worker } from 'node:worker_threads'
2
2
  import { DeferredPromise, pDefer, _range, AnyObject } from '@naturalcycles/js-lib'
3
3
  import through2Concurrent = require('through2-concurrent')
4
4
  import { TransformTyped } from '../../stream.model'
@@ -1,4 +1,4 @@
1
- import { Writable } from 'stream'
1
+ import { Writable } from 'node:stream'
2
2
  import { readableCreate, ReadableTyped, _pipeline } from '../..'
3
3
  import { TransformOptions, WritableTyped } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { Readable, Writable } from 'stream'
1
+ import { Readable, Writable } from 'node:stream'
2
2
  import { WritableTyped } from '../stream.model'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Writable } from 'stream'
1
+ import { Writable } from 'node:stream'
2
2
  import { TransformOptions, WritableTyped } from '../stream.model'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Writable } from 'stream'
1
+ import { Writable } from 'node:stream'
2
2
  import { DeferredPromise } from '@naturalcycles/js-lib'
3
3
  import { TransformOptions } from '../stream.model'
4
4
 
@@ -1,4 +1,4 @@
1
- import { inspect, InspectOptions } from 'util'
1
+ import { inspect, InspectOptions } from 'node:util'
2
2
  import { StringifyAnyOptions, _stringifyAny, JsonStringifyFunction } from '@naturalcycles/js-lib'
3
3
 
4
4
  export interface InspectAnyOptions extends StringifyAnyOptions, InspectOptions {}
@@ -1,4 +1,4 @@
1
- import * as fs from 'fs'
1
+ import * as fs from 'node:fs'
2
2
  import type { ValuesOf } from '@naturalcycles/js-lib'
3
3
  import 'dotenv/config' // ensure .env is read before requiring keys
4
4
 
@@ -1,6 +1,6 @@
1
- import { promisify } from 'util'
2
- import { ZlibOptions } from 'zlib'
3
- import * as zlib from 'zlib'
1
+ import { promisify } from 'node:util'
2
+ import { ZlibOptions } from 'node:zlib'
3
+ import * as zlib from 'node:zlib'
4
4
 
5
5
  const deflate = promisify(zlib.deflate.bind(zlib))
6
6
  const inflate = promisify(zlib.inflate.bind(zlib))
@@ -1,4 +1,4 @@
1
- import * as fs from 'fs'
1
+ import * as fs from 'node:fs'
2
2
  import { JsonSchema } from '@naturalcycles/js-lib'
3
3
  import { fastGlob } from '../..'
4
4
  import type { FastGlobOptions } from '../..'
@@ -1,4 +1,4 @@
1
- import * as fs from 'fs'
1
+ import * as fs from 'node:fs'
2
2
  import {
3
3
  JsonSchema,
4
4
  JsonSchemaAnyBuilder,