@naturalcycles/nodejs-lib 12.77.0 → 12.78.0
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/dist/bin/secrets-gen-key.js +1 -1
- package/dist/colors/colors.js +1 -1
- package/dist/fs/kpy.js +1 -1
- package/dist/got/getGot.js +2 -2
- package/dist/infra/process.util.js +1 -1
- package/dist/secret/secrets-decrypt.util.js +1 -1
- package/dist/secret/secrets-encrypt.util.js +1 -1
- package/dist/security/crypto.util.d.ts +7 -7
- package/dist/security/crypto.util.js +1 -1
- package/dist/security/hash.util.d.ts +7 -12
- package/dist/security/hash.util.js +2 -8
- package/dist/security/secret.util.d.ts +3 -3
- package/dist/security/secret.util.js +1 -1
- package/dist/stream/ndjson/ndjsonMap.js +6 -6
- package/dist/stream/ndjson/ndjsonStreamForEach.js +3 -3
- package/dist/stream/ndjson/pipelineFromNDJsonFile.d.ts +1 -1
- package/dist/stream/ndjson/pipelineFromNDJsonFile.js +2 -2
- package/dist/stream/ndjson/pipelineToNDJsonFile.d.ts +1 -1
- package/dist/stream/ndjson/pipelineToNDJsonFile.js +2 -2
- package/dist/stream/ndjson/transformJsonParse.js +2 -2
- package/dist/stream/ndjson/transformToNDJson.js +2 -2
- package/dist/stream/pipeline/pipeline.d.ts +1 -1
- package/dist/stream/pipeline/pipeline.js +3 -3
- package/dist/stream/readable/readableCreate.d.ts +1 -1
- package/dist/stream/readable/readableCreate.js +3 -3
- package/dist/stream/readable/readableFromArray.d.ts +1 -1
- package/dist/stream/readable/readableFromArray.js +2 -2
- package/dist/stream/readable/readableMap.js +2 -2
- package/dist/stream/stream.model.d.ts +1 -1
- package/dist/stream/stream.util.d.ts +1 -1
- package/dist/stream/transform/transformBuffer.js +2 -2
- package/dist/stream/transform/transformFilter.js +2 -2
- package/dist/stream/transform/transformLimit.d.ts +1 -1
- package/dist/stream/transform/transformLogProgress.js +4 -4
- package/dist/stream/transform/transformMapSimple.js +2 -2
- package/dist/stream/transform/transformNoOp.js +2 -2
- package/dist/stream/transform/transformTap.js +2 -2
- package/dist/stream/transform/transformToArray.js +2 -2
- package/dist/stream/transform/transformToString.js +2 -2
- package/dist/stream/transform/worker/transformMultiThreaded.js +2 -2
- package/dist/stream/writable/writableFork.js +2 -2
- package/dist/stream/writable/writableLimit.d.ts +1 -1
- package/dist/stream/writable/writableLimit.js +2 -2
- package/dist/stream/writable/writablePushToArray.js +2 -2
- package/dist/stream/writable/writableVoid.d.ts +1 -1
- package/dist/stream/writable/writableVoid.js +2 -2
- package/dist/string/inspectAny.d.ts +1 -1
- package/dist/string/inspectAny.js +3 -3
- package/dist/util/env.util.js +1 -1
- package/dist/util/zip.util.d.ts +1 -1
- package/dist/util/zip.util.js +6 -6
- package/dist/validation/ajv/ajv.util.js +1 -1
- package/dist/validation/ajv/ajvSchema.js +1 -1
- package/package.json +1 -1
- package/src/bin/secrets-gen-key.ts +1 -1
- package/src/colors/colors.ts +1 -1
- package/src/fs/kpy.ts +1 -1
- package/src/got/getGot.ts +1 -1
- package/src/infra/process.util.ts +1 -1
- package/src/secret/secrets-decrypt.util.ts +1 -1
- package/src/secret/secrets-encrypt.util.ts +1 -1
- package/src/security/crypto.util.ts +8 -8
- package/src/security/hash.util.ts +9 -14
- package/src/security/secret.util.ts +4 -4
- package/src/stream/ndjson/ndjsonMap.ts +2 -2
- package/src/stream/ndjson/ndjsonStreamForEach.ts +2 -2
- package/src/stream/ndjson/pipelineFromNDJsonFile.ts +1 -1
- package/src/stream/ndjson/pipelineToNDJsonFile.ts +1 -1
- package/src/stream/ndjson/transformJsonParse.ts +1 -1
- package/src/stream/ndjson/transformToNDJson.ts +1 -1
- package/src/stream/pipeline/pipeline.ts +1 -1
- package/src/stream/readable/readableCreate.ts +1 -1
- package/src/stream/readable/readableFromArray.ts +1 -1
- package/src/stream/readable/readableMap.ts +1 -1
- package/src/stream/stream.model.ts +1 -1
- package/src/stream/stream.util.ts +1 -1
- package/src/stream/transform/transformBuffer.ts +1 -1
- package/src/stream/transform/transformFilter.ts +1 -1
- package/src/stream/transform/transformLimit.ts +1 -1
- package/src/stream/transform/transformLogProgress.ts +2 -2
- package/src/stream/transform/transformMapSimple.ts +1 -1
- package/src/stream/transform/transformNoOp.ts +1 -1
- package/src/stream/transform/transformTap.ts +1 -1
- package/src/stream/transform/transformToArray.ts +1 -1
- package/src/stream/transform/transformToString.ts +1 -1
- package/src/stream/transform/worker/transformMultiThreaded.ts +1 -1
- package/src/stream/writable/writableFork.ts +1 -1
- package/src/stream/writable/writableLimit.ts +1 -1
- package/src/stream/writable/writablePushToArray.ts +1 -1
- package/src/stream/writable/writableVoid.ts +1 -1
- package/src/string/inspectAny.ts +1 -1
- package/src/util/env.util.ts +1 -1
- package/src/util/zip.util.ts +3 -3
- package/src/validation/ajv/ajv.util.ts +1 -1
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
24
|
+
return new node_stream_1.Writable({
|
|
25
25
|
objectMode: true,
|
|
26
26
|
...opt,
|
|
27
27
|
write(chunk, _, cb) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writableLimit = void 0;
|
|
4
|
-
const
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
42
|
+
stringifyFn: obj => (0, node_util_1.inspect)(obj, {
|
|
43
43
|
...INSPECT_OPT,
|
|
44
44
|
...opt,
|
|
45
45
|
}),
|
package/dist/util/env.util.js
CHANGED
|
@@ -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
|
package/dist/util/zip.util.d.ts
CHANGED
package/dist/util/zip.util.js
CHANGED
|
@@ -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
|
|
5
|
-
const zlib = require("zlib");
|
|
6
|
-
const deflate = (0,
|
|
7
|
-
const inflate = (0,
|
|
8
|
-
const gzip = (0,
|
|
9
|
-
const gunzip = (0,
|
|
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
package/src/colors/colors.ts
CHANGED
package/src/fs/kpy.ts
CHANGED
package/src/got/getGot.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as crypto from 'crypto'
|
|
2
|
-
import { _stringMapEntries, StringMap } from '@naturalcycles/js-lib'
|
|
1
|
+
import * as crypto from 'node:crypto'
|
|
2
|
+
import { _stringMapEntries, Base64String, StringMap } from '@naturalcycles/js-lib'
|
|
3
3
|
import { md5 } from './hash.util'
|
|
4
4
|
|
|
5
5
|
const algorithm = 'aes-256-cbc'
|
|
@@ -7,7 +7,7 @@ const algorithm = 'aes-256-cbc'
|
|
|
7
7
|
/**
|
|
8
8
|
* Using aes-256-cbc
|
|
9
9
|
*/
|
|
10
|
-
export function encryptRandomIVBuffer(input: Buffer, secretKeyBase64:
|
|
10
|
+
export function encryptRandomIVBuffer(input: Buffer, secretKeyBase64: Base64String): Buffer {
|
|
11
11
|
// md5 to match aes-256 key length of 32 bytes
|
|
12
12
|
const key = md5(Buffer.from(secretKeyBase64, 'base64'))
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ export function encryptRandomIVBuffer(input: Buffer, secretKeyBase64: string): B
|
|
|
21
21
|
/**
|
|
22
22
|
* Using aes-256-cbc
|
|
23
23
|
*/
|
|
24
|
-
export function decryptRandomIVBuffer(input: Buffer, secretKeyBase64:
|
|
24
|
+
export function decryptRandomIVBuffer(input: Buffer, secretKeyBase64: Base64String): Buffer {
|
|
25
25
|
// md5 to match aes-256 key length of 32 bytes
|
|
26
26
|
const key = md5(Buffer.from(secretKeyBase64, 'base64'))
|
|
27
27
|
|
|
@@ -38,7 +38,7 @@ export function decryptRandomIVBuffer(input: Buffer, secretKeyBase64: string): B
|
|
|
38
38
|
* Decrypts all object values.
|
|
39
39
|
* Returns object with decrypted values.
|
|
40
40
|
*/
|
|
41
|
-
export function decryptObject(obj: StringMap
|
|
41
|
+
export function decryptObject(obj: StringMap<Base64String>, secretKey: string): StringMap {
|
|
42
42
|
const { key, iv } = getCryptoParams(secretKey)
|
|
43
43
|
|
|
44
44
|
const r: StringMap = {}
|
|
@@ -49,7 +49,7 @@ export function decryptObject(obj: StringMap, secretKey: string): StringMap {
|
|
|
49
49
|
return r
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export function encryptObject(obj: StringMap, secretKey: string): StringMap {
|
|
52
|
+
export function encryptObject(obj: StringMap, secretKey: string): StringMap<Base64String> {
|
|
53
53
|
const { key, iv } = getCryptoParams(secretKey)
|
|
54
54
|
|
|
55
55
|
const r: StringMap = {}
|
|
@@ -63,7 +63,7 @@ export function encryptObject(obj: StringMap, secretKey: string): StringMap {
|
|
|
63
63
|
/**
|
|
64
64
|
* Using aes-256-cbc
|
|
65
65
|
*/
|
|
66
|
-
export function decryptString(str:
|
|
66
|
+
export function decryptString(str: Base64String, secretKey: string): string {
|
|
67
67
|
const { key, iv } = getCryptoParams(secretKey)
|
|
68
68
|
const decipher = crypto.createDecipheriv(algorithm, key, iv)
|
|
69
69
|
return decipher.update(str, 'base64', 'utf8') + decipher.final('utf8')
|
|
@@ -72,7 +72,7 @@ export function decryptString(str: string, secretKey: string): string {
|
|
|
72
72
|
/**
|
|
73
73
|
* Using aes-256-cbc
|
|
74
74
|
*/
|
|
75
|
-
export function encryptString(str: string, secretKey: string):
|
|
75
|
+
export function encryptString(str: string, secretKey: string): Base64String {
|
|
76
76
|
const { key, iv } = getCryptoParams(secretKey)
|
|
77
77
|
const cipher = crypto.createCipheriv(algorithm, key, iv)
|
|
78
78
|
return cipher.update(str, 'utf8', 'base64') + cipher.final('base64')
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import * as crypto from 'crypto'
|
|
1
|
+
import * as crypto from 'node:crypto'
|
|
2
|
+
import { Base64String } from '@naturalcycles/js-lib'
|
|
2
3
|
|
|
3
4
|
export function md5(s: string | Buffer): string {
|
|
4
5
|
return hash(s, 'md5')
|
|
5
6
|
}
|
|
6
7
|
|
|
7
|
-
export function md5AsBase64(s: string | Buffer):
|
|
8
|
+
export function md5AsBase64(s: string | Buffer): Base64String {
|
|
8
9
|
return hashAsBuffer(s, 'md5').toString('base64')
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -16,7 +17,7 @@ export function sha256(s: string | Buffer): string {
|
|
|
16
17
|
return hash(s, 'sha256')
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export function sha256AsBase64(s: string | Buffer):
|
|
20
|
+
export function sha256AsBase64(s: string | Buffer): Base64String {
|
|
20
21
|
return hashAsBuffer(s, 'sha256').toString('base64')
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -32,11 +33,11 @@ export function hashAsBuffer(s: string | Buffer, algorithm: string): Buffer {
|
|
|
32
33
|
return crypto.createHash(algorithm).update(s).digest()
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export function base64(s: string | Buffer):
|
|
36
|
-
return (
|
|
36
|
+
export function base64(s: string | Buffer): Base64String {
|
|
37
|
+
return (typeof s === 'string' ? Buffer.from(s) : s).toString('base64')
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export function base64ToString(strBase64:
|
|
40
|
+
export function base64ToString(strBase64: Base64String): string {
|
|
40
41
|
return Buffer.from(strBase64, 'base64').toString('utf8')
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -44,16 +45,10 @@ export function base64ToBuffer(strBase64: string): Buffer {
|
|
|
44
45
|
return Buffer.from(strBase64, 'base64')
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
* @deprecated use `base64`
|
|
49
|
-
*/
|
|
50
|
-
export function stringToBase64(s: string): string {
|
|
48
|
+
export function stringToBase64(s: string): Base64String {
|
|
51
49
|
return Buffer.from(s, 'utf8').toString('base64')
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
* @deprecated use `base64`
|
|
56
|
-
*/
|
|
57
|
-
export function bufferToBase64(b: Buffer): string {
|
|
52
|
+
export function bufferToBase64(b: Buffer): Base64String {
|
|
58
53
|
return b.toString('base64')
|
|
59
54
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as fs from 'fs'
|
|
2
|
-
import { _assert, StringMap } from '@naturalcycles/js-lib'
|
|
1
|
+
import * as fs from 'node:fs'
|
|
2
|
+
import { _assert, Base64String, StringMap } from '@naturalcycles/js-lib'
|
|
3
3
|
import { base64ToString } from '..'
|
|
4
4
|
import { decryptObject, decryptRandomIVBuffer } from './crypto.util'
|
|
5
5
|
|
|
@@ -53,7 +53,7 @@ export function removeSecretsFromEnv(): void {
|
|
|
53
53
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
54
54
|
export function loadSecretsFromEncryptedJsonFile(
|
|
55
55
|
filePath: string,
|
|
56
|
-
secretEncryptionKey?:
|
|
56
|
+
secretEncryptionKey?: Base64String,
|
|
57
57
|
): void {
|
|
58
58
|
_assert(
|
|
59
59
|
fs.existsSync(filePath),
|
|
@@ -86,7 +86,7 @@ export function loadSecretsFromEncryptedJsonFile(
|
|
|
86
86
|
*/
|
|
87
87
|
export function loadSecretsFromEncryptedJsonFileValues(
|
|
88
88
|
filePath: string,
|
|
89
|
-
secretEncryptionKey?:
|
|
89
|
+
secretEncryptionKey?: Base64String,
|
|
90
90
|
): void {
|
|
91
91
|
_assert(
|
|
92
92
|
fs.existsSync(filePath),
|
|
@@ -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,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 { 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 { 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'
|
package/src/string/inspectAny.ts
CHANGED
|
@@ -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 {}
|
package/src/util/env.util.ts
CHANGED