@naturalcycles/nodejs-lib 13.45.1 → 13.45.3
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/generate-build-info.js +7 -7
- package/dist/bin/json2env.js +2 -2
- package/dist/bin/kpy.js +2 -2
- package/dist/bin/secrets-decrypt.js +2 -2
- package/dist/bin/secrets-encrypt.js +2 -2
- package/dist/bin/secrets-gen-key.js +2 -2
- package/dist/bin/slack-this.js +2 -2
- package/dist/colors/colors.d.ts +1 -2
- package/dist/colors/colors.js +30 -31
- package/dist/fs/fs2.js +14 -14
- package/dist/fs/json2env.js +5 -5
- package/dist/fs/kpy.js +8 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/infra/process.util.js +7 -7
- package/dist/jwt/jwt.service.d.ts +1 -1
- package/dist/jwt/jwt.service.js +5 -5
- package/dist/script/runScript.js +3 -3
- package/dist/secret/secrets-decrypt.util.js +4 -4
- package/dist/secret/secrets-encrypt.util.js +7 -7
- package/dist/security/crypto.util.js +9 -9
- package/dist/util/zip.util.js +5 -5
- package/dist/validation/joi/number.extensions.d.ts +1 -1
- package/dist/validation/joi/string.extensions.d.ts +1 -1
- package/package.json +1 -1
- package/src/bin/generate-build-info.ts +3 -3
- package/src/bin/json2env.ts +1 -1
- package/src/bin/kpy.ts +1 -1
- package/src/bin/secrets-decrypt.ts +1 -1
- package/src/bin/secrets-encrypt.ts +1 -1
- package/src/bin/secrets-gen-key.ts +1 -1
- package/src/bin/slack-this.ts +1 -1
- package/src/colors/colors.ts +2 -4
- package/src/fs/fs2.ts +2 -2
- package/src/fs/json2env.ts +1 -1
- package/src/fs/kpy.ts +1 -1
- package/src/index.ts +1 -1
- package/src/infra/process.util.ts +1 -1
- package/src/jwt/jwt.service.ts +1 -1
- package/src/script/runScript.ts +1 -1
- package/src/secret/secrets-decrypt.util.ts +1 -1
- package/src/secret/secrets-encrypt.util.ts +2 -2
- package/src/security/crypto.util.ts +1 -1
- package/src/util/zip.util.ts +1 -1
- package/src/validation/joi/number.extensions.ts +1 -1
- package/src/validation/joi/string.extensions.ts +1 -1
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
8
8
|
const json2env_1 = require("../fs/json2env");
|
|
9
9
|
const runScript_1 = require("../script/runScript");
|
|
10
10
|
const buildInfo_util_1 = require("../util/buildInfo.util");
|
|
11
11
|
(0, runScript_1.runScript)(async () => {
|
|
12
|
-
const { dir, overrideTimestamp } =
|
|
12
|
+
const { dir, overrideTimestamp } = yargs_1.default.options({
|
|
13
13
|
dir: {
|
|
14
14
|
type: 'string',
|
|
15
15
|
desc: 'Output directory',
|
|
@@ -24,9 +24,9 @@ const buildInfo_util_1 = require("../util/buildInfo.util");
|
|
|
24
24
|
});
|
|
25
25
|
console.log(buildInfo);
|
|
26
26
|
if (dir)
|
|
27
|
-
|
|
28
|
-
const buildInfoPath = dir ?
|
|
29
|
-
|
|
27
|
+
node_fs_1.default.mkdirSync(dir, { recursive: true });
|
|
28
|
+
const buildInfoPath = dir ? node_path_1.default.resolve(dir, 'buildInfo.json') : 'buildInfo.json';
|
|
29
|
+
node_fs_1.default.writeFileSync(buildInfoPath, JSON.stringify(buildInfo, null, 2));
|
|
30
30
|
const prefix = 'buildInfo_';
|
|
31
31
|
(0, json2env_1.appendToBashEnv)(buildInfo, prefix);
|
|
32
32
|
(0, json2env_1.appendToGithubEnv)(buildInfo, prefix);
|
package/dist/bin/json2env.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
6
6
|
const json2env_1 = require("../fs/json2env");
|
|
7
7
|
const runScript_1 = require("../script/runScript");
|
|
8
8
|
(0, runScript_1.runScript)(() => {
|
|
9
|
-
const { argv } =
|
|
9
|
+
const { argv } = yargs_1.default.demandCommand(1).options({
|
|
10
10
|
prefix: {
|
|
11
11
|
type: 'string',
|
|
12
12
|
},
|
package/dist/bin/kpy.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
6
6
|
const kpy_1 = require("../fs/kpy");
|
|
7
7
|
const runScript_1 = require("../script/runScript");
|
|
8
8
|
(0, runScript_1.runScript)(() => {
|
|
9
|
-
const { _: [baseDir, ...inputPatterns], ...opt } =
|
|
9
|
+
const { _: [baseDir, ...inputPatterns], ...opt } = yargs_1.default.demandCommand(2).options({
|
|
10
10
|
silent: {
|
|
11
11
|
type: 'boolean',
|
|
12
12
|
desc: 'Suppress all text output',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
6
6
|
const colors_1 = require("../colors/colors");
|
|
7
7
|
const runScript_1 = require("../script/runScript");
|
|
8
8
|
const secrets_decrypt_util_1 = require("../secret/secrets-decrypt.util");
|
|
@@ -12,7 +12,7 @@ const secrets_decrypt_util_1 = require("../secret/secrets-decrypt.util");
|
|
|
12
12
|
});
|
|
13
13
|
function getDecryptCLIOptions() {
|
|
14
14
|
require('dotenv').config();
|
|
15
|
-
let { dir, file, encKey, encKeyVar, del, jsonMode } =
|
|
15
|
+
let { dir, file, encKey, encKeyVar, del, jsonMode } = yargs_1.default.options({
|
|
16
16
|
dir: {
|
|
17
17
|
type: 'array',
|
|
18
18
|
desc: 'Directory with secrets. Can be many',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
6
6
|
const colors_1 = require("../colors/colors");
|
|
7
7
|
const runScript_1 = require("../script/runScript");
|
|
8
8
|
const secrets_encrypt_util_1 = require("../secret/secrets-encrypt.util");
|
|
@@ -12,7 +12,7 @@ const secrets_encrypt_util_1 = require("../secret/secrets-encrypt.util");
|
|
|
12
12
|
});
|
|
13
13
|
function getEncryptCLIOptions() {
|
|
14
14
|
require('dotenv').config();
|
|
15
|
-
let { pattern, file, encKey, encKeyVar, del, jsonMode } =
|
|
15
|
+
let { pattern, file, encKey, encKeyVar, del, jsonMode } = yargs_1.default.options({
|
|
16
16
|
pattern: {
|
|
17
17
|
type: 'string',
|
|
18
18
|
array: true,
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const node_crypto_1 = require("node:crypto");
|
|
6
|
-
const
|
|
6
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
7
7
|
const colors_1 = require("../colors/colors");
|
|
8
8
|
const runScript_1 = require("../script/runScript");
|
|
9
9
|
(0, runScript_1.runScript)(() => {
|
|
10
|
-
const { sizeBytes } =
|
|
10
|
+
const { sizeBytes } = yargs_1.default.option('sizeBytes', {
|
|
11
11
|
type: 'number',
|
|
12
12
|
default: 256,
|
|
13
13
|
}).argv;
|
package/dist/bin/slack-this.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
6
6
|
const __1 = require("..");
|
|
7
7
|
const runScript_1 = require("../script/runScript");
|
|
8
8
|
(0, runScript_1.runScript)(async () => {
|
|
9
|
-
const { channel, msg, username, emoji, webhook: webhookUrl, } =
|
|
9
|
+
const { channel, msg, username, emoji, webhook: webhookUrl, } = yargs_1.default.options({
|
|
10
10
|
channel: {
|
|
11
11
|
type: 'string',
|
|
12
12
|
demandOption: true,
|
package/dist/colors/colors.d.ts
CHANGED
package/dist/colors/colors.js
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.boldCyan = exports.dimCyan = exports.cyan = exports.boldMagenta = exports.dimMagenta = exports.magenta = exports.boldBlue = exports.dimBlue = exports.blue = exports.boldRed = exports.dimRed = exports.red = exports.boldGreen = exports.dimGreen = exports.green = exports.inverseYellow = exports.boldYellow = exports.dimYellow = exports.yellow = exports.boldGrey = exports.dimGrey = exports.grey = exports.inverseWhite = exports.boldWhite = exports.dimWhite = exports.white = exports.hasColors =
|
|
3
|
+
exports.boldCyan = exports.dimCyan = exports.cyan = exports.boldMagenta = exports.dimMagenta = exports.magenta = exports.boldBlue = exports.dimBlue = exports.blue = exports.boldRed = exports.dimRed = exports.red = exports.boldGreen = exports.dimGreen = exports.green = exports.inverseYellow = exports.boldYellow = exports.dimYellow = exports.yellow = exports.boldGrey = exports.dimGrey = exports.grey = exports.inverseWhite = exports.boldWhite = exports.dimWhite = exports.white = exports.hasColors = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
exports.chalk = chalk;
|
|
5
|
+
const node_tty_1 = tslib_1.__importDefault(require("node:tty"));
|
|
6
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
7
|
/**
|
|
9
8
|
* Based on: https://github.com/sindresorhus/yoctocolors/pull/5
|
|
10
9
|
*
|
|
11
10
|
* @experimental
|
|
12
11
|
*/
|
|
13
|
-
exports.hasColors = !process.env['NO_COLOR'] &&
|
|
12
|
+
exports.hasColors = !process.env['NO_COLOR'] && node_tty_1.default.WriteStream.prototype.hasColors();
|
|
14
13
|
// The point of re-exporting is:
|
|
15
14
|
// 1. Fix typings to allow to pass `number` (very common case)
|
|
16
15
|
// 2. Easier/shorter to import, rather than from 'chalk'
|
|
17
16
|
// export type ColorFn = (...args: (string | number)[]) => string
|
|
18
|
-
exports.white =
|
|
19
|
-
exports.dimWhite =
|
|
20
|
-
exports.boldWhite =
|
|
21
|
-
exports.inverseWhite =
|
|
22
|
-
exports.grey =
|
|
23
|
-
exports.dimGrey =
|
|
24
|
-
exports.boldGrey =
|
|
25
|
-
exports.yellow =
|
|
26
|
-
exports.dimYellow =
|
|
27
|
-
exports.boldYellow =
|
|
28
|
-
exports.inverseYellow =
|
|
29
|
-
exports.green =
|
|
30
|
-
exports.dimGreen =
|
|
31
|
-
exports.boldGreen =
|
|
32
|
-
exports.red =
|
|
33
|
-
exports.dimRed =
|
|
34
|
-
exports.boldRed =
|
|
35
|
-
exports.blue =
|
|
36
|
-
exports.dimBlue =
|
|
37
|
-
exports.boldBlue =
|
|
38
|
-
exports.magenta =
|
|
39
|
-
exports.dimMagenta =
|
|
40
|
-
exports.boldMagenta =
|
|
41
|
-
exports.cyan =
|
|
42
|
-
exports.dimCyan =
|
|
43
|
-
exports.boldCyan =
|
|
17
|
+
exports.white = chalk_1.default.white;
|
|
18
|
+
exports.dimWhite = chalk_1.default.dim.white;
|
|
19
|
+
exports.boldWhite = chalk_1.default.bold.white;
|
|
20
|
+
exports.inverseWhite = chalk_1.default.inverse.white;
|
|
21
|
+
exports.grey = chalk_1.default.grey;
|
|
22
|
+
exports.dimGrey = chalk_1.default.dim.grey;
|
|
23
|
+
exports.boldGrey = chalk_1.default.bold.grey;
|
|
24
|
+
exports.yellow = chalk_1.default.yellow;
|
|
25
|
+
exports.dimYellow = chalk_1.default.dim.yellow;
|
|
26
|
+
exports.boldYellow = chalk_1.default.bold.yellow;
|
|
27
|
+
exports.inverseYellow = chalk_1.default.inverse.yellow;
|
|
28
|
+
exports.green = chalk_1.default.green;
|
|
29
|
+
exports.dimGreen = chalk_1.default.dim.green;
|
|
30
|
+
exports.boldGreen = chalk_1.default.bold.green;
|
|
31
|
+
exports.red = chalk_1.default.red;
|
|
32
|
+
exports.dimRed = chalk_1.default.dim.red;
|
|
33
|
+
exports.boldRed = chalk_1.default.bold.red;
|
|
34
|
+
exports.blue = chalk_1.default.blue;
|
|
35
|
+
exports.dimBlue = chalk_1.default.dim.blue;
|
|
36
|
+
exports.boldBlue = chalk_1.default.bold.blue;
|
|
37
|
+
exports.magenta = chalk_1.default.magenta;
|
|
38
|
+
exports.dimMagenta = chalk_1.default.dim.magenta;
|
|
39
|
+
exports.boldMagenta = chalk_1.default.bold.magenta;
|
|
40
|
+
exports.cyan = chalk_1.default.cyan;
|
|
41
|
+
exports.dimCyan = chalk_1.default.dim.cyan;
|
|
42
|
+
exports.boldCyan = chalk_1.default.bold.cyan;
|
package/dist/fs/fs2.js
CHANGED
|
@@ -19,10 +19,10 @@ exports.fs2 = void 0;
|
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
20
|
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
21
21
|
const promises_1 = tslib_1.__importDefault(require("node:fs/promises"));
|
|
22
|
-
const
|
|
22
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
23
23
|
const node_zlib_1 = require("node:zlib");
|
|
24
24
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
25
|
-
const
|
|
25
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
26
26
|
const transformToNDJson_1 = require("../stream/ndjson/transformToNDJson");
|
|
27
27
|
const transformSplit_1 = require("../stream/transform/transformSplit");
|
|
28
28
|
const env_util_1 = require("../util/env.util");
|
|
@@ -83,10 +83,10 @@ class FS2 {
|
|
|
83
83
|
return (0, js_lib_1._jsonParse)(str);
|
|
84
84
|
}
|
|
85
85
|
readYaml(filePath) {
|
|
86
|
-
return
|
|
86
|
+
return js_yaml_1.default.load(node_fs_1.default.readFileSync(filePath, 'utf8'));
|
|
87
87
|
}
|
|
88
88
|
async readYamlAsync(filePath) {
|
|
89
|
-
return
|
|
89
|
+
return js_yaml_1.default.load(await promises_1.default.readFile(filePath, 'utf8'));
|
|
90
90
|
}
|
|
91
91
|
writeFile(filePath, data) {
|
|
92
92
|
node_fs_1.default.writeFileSync(filePath, data);
|
|
@@ -103,11 +103,11 @@ class FS2 {
|
|
|
103
103
|
await promises_1.default.writeFile(filePath, str);
|
|
104
104
|
}
|
|
105
105
|
writeYaml(filePath, data, opt) {
|
|
106
|
-
const str =
|
|
106
|
+
const str = js_yaml_1.default.dump(data, opt);
|
|
107
107
|
node_fs_1.default.writeFileSync(filePath, str);
|
|
108
108
|
}
|
|
109
109
|
async writeYamlAsync(filePath, data, opt) {
|
|
110
|
-
const str =
|
|
110
|
+
const str = js_yaml_1.default.dump(data, opt);
|
|
111
111
|
await promises_1.default.writeFile(filePath, str);
|
|
112
112
|
}
|
|
113
113
|
appendFile(filePath, data) {
|
|
@@ -125,22 +125,22 @@ class FS2 {
|
|
|
125
125
|
await this.outputFileAsync(filePath, str);
|
|
126
126
|
}
|
|
127
127
|
outputYaml(filePath, data, opt) {
|
|
128
|
-
const str =
|
|
128
|
+
const str = js_yaml_1.default.dump(data, opt);
|
|
129
129
|
this.outputFile(filePath, str);
|
|
130
130
|
}
|
|
131
131
|
async outputYamlAsync(filePath, data, opt) {
|
|
132
|
-
const str =
|
|
132
|
+
const str = js_yaml_1.default.dump(data, opt);
|
|
133
133
|
await this.outputFileAsync(filePath, str);
|
|
134
134
|
}
|
|
135
135
|
outputFile(filePath, data) {
|
|
136
|
-
const dirPath =
|
|
136
|
+
const dirPath = node_path_1.default.dirname(filePath);
|
|
137
137
|
if (!node_fs_1.default.existsSync(dirPath)) {
|
|
138
138
|
this.ensureDir(dirPath);
|
|
139
139
|
}
|
|
140
140
|
node_fs_1.default.writeFileSync(filePath, data);
|
|
141
141
|
}
|
|
142
142
|
async outputFileAsync(filePath, data) {
|
|
143
|
-
const dirPath =
|
|
143
|
+
const dirPath = node_path_1.default.dirname(filePath);
|
|
144
144
|
if (!(await this.pathExistsAsync(dirPath))) {
|
|
145
145
|
await this.ensureDirAsync(dirPath);
|
|
146
146
|
}
|
|
@@ -178,7 +178,7 @@ class FS2 {
|
|
|
178
178
|
catch { }
|
|
179
179
|
if (stats?.isFile())
|
|
180
180
|
return;
|
|
181
|
-
const dir =
|
|
181
|
+
const dir = node_path_1.default.dirname(filePath);
|
|
182
182
|
try {
|
|
183
183
|
if (!node_fs_1.default.statSync(dir).isDirectory()) {
|
|
184
184
|
// parent is not a directory
|
|
@@ -204,7 +204,7 @@ class FS2 {
|
|
|
204
204
|
catch { }
|
|
205
205
|
if (stats?.isFile())
|
|
206
206
|
return;
|
|
207
|
-
const dir =
|
|
207
|
+
const dir = node_path_1.default.dirname(filePath);
|
|
208
208
|
try {
|
|
209
209
|
if (!(await promises_1.default.stat(dir)).isDirectory()) {
|
|
210
210
|
// parent is not a directory
|
|
@@ -235,7 +235,7 @@ class FS2 {
|
|
|
235
235
|
this.ensureDir(dirPath);
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
items.forEach(item => this.removePath(
|
|
238
|
+
items.forEach(item => this.removePath(node_path_1.default.join(dirPath, item)));
|
|
239
239
|
}
|
|
240
240
|
async emptyDirAsync(dirPath) {
|
|
241
241
|
let items;
|
|
@@ -245,7 +245,7 @@ class FS2 {
|
|
|
245
245
|
catch {
|
|
246
246
|
return await this.ensureDirAsync(dirPath);
|
|
247
247
|
}
|
|
248
|
-
await Promise.all(items.map(item => this.removePathAsync(
|
|
248
|
+
await Promise.all(items.map(item => this.removePathAsync(node_path_1.default.join(dirPath, item))));
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
251
|
* Cautious, underlying Node function is currently Experimental.
|
package/dist/fs/json2env.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.appendToGithubSummary = appendToGithubSummary;
|
|
|
8
8
|
exports.objectToShellExport = objectToShellExport;
|
|
9
9
|
exports.objectToGithubActionsEnv = objectToGithubActionsEnv;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const
|
|
11
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
12
12
|
const colors_1 = require("../colors/colors");
|
|
13
13
|
const fs2_1 = require("./fs2");
|
|
14
14
|
const JSON2ENV_OPT_DEF = {
|
|
@@ -60,7 +60,7 @@ function appendToBashEnv(obj, prefix = '') {
|
|
|
60
60
|
const { BASH_ENV } = process.env;
|
|
61
61
|
if (BASH_ENV) {
|
|
62
62
|
const data = objectToShellExport(obj, prefix);
|
|
63
|
-
|
|
63
|
+
node_fs_1.default.appendFileSync(BASH_ENV, data);
|
|
64
64
|
console.log(`BASH_ENV appended:\n${data}`);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -68,7 +68,7 @@ function appendToGithubEnv(obj, prefix = '') {
|
|
|
68
68
|
const { GITHUB_ENV } = process.env;
|
|
69
69
|
if (GITHUB_ENV) {
|
|
70
70
|
const data = objectToGithubActionsEnv(obj, prefix);
|
|
71
|
-
|
|
71
|
+
node_fs_1.default.appendFileSync(GITHUB_ENV, data);
|
|
72
72
|
console.log(`GITHUB_ENV appended:\n${data}`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ function appendToGithubOutput(obj, prefix = '') {
|
|
|
76
76
|
const { GITHUB_OUTPUT } = process.env;
|
|
77
77
|
if (GITHUB_OUTPUT) {
|
|
78
78
|
const data = objectToGithubActionsEnv(obj, prefix);
|
|
79
|
-
|
|
79
|
+
node_fs_1.default.appendFileSync(GITHUB_OUTPUT, data);
|
|
80
80
|
console.log(`GITHUB_OUTPUT appended:\n${data}`);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -87,7 +87,7 @@ function appendToGithubSummary(...lines) {
|
|
|
87
87
|
const { GITHUB_STEP_SUMMARY } = process.env;
|
|
88
88
|
if (GITHUB_STEP_SUMMARY) {
|
|
89
89
|
const str = lines.join('\n') + '\n';
|
|
90
|
-
|
|
90
|
+
node_fs_1.default.appendFileSync(GITHUB_STEP_SUMMARY, str);
|
|
91
91
|
console.log(`GITHUB_STEP_SUMMARY appended:\n${str}`);
|
|
92
92
|
}
|
|
93
93
|
}
|
package/dist/fs/kpy.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.kpy = kpy;
|
|
4
4
|
exports.kpySync = kpySync;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const
|
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
7
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
8
8
|
const colors_1 = require("../colors/colors");
|
|
9
9
|
const index_1 = require("../index");
|
|
@@ -17,9 +17,9 @@ async function kpy(opt) {
|
|
|
17
17
|
kpyLogFilenames(opt, filenames);
|
|
18
18
|
const overwrite = !opt.noOverwrite;
|
|
19
19
|
await Promise.all(filenames.map(async (filename) => {
|
|
20
|
-
const basename =
|
|
21
|
-
const srcFilename =
|
|
22
|
-
const destFilename =
|
|
20
|
+
const basename = node_path_1.default.basename(filename);
|
|
21
|
+
const srcFilename = node_path_1.default.resolve(opt.baseDir, filename);
|
|
22
|
+
const destFilename = node_path_1.default.resolve(opt.outputDir, opt.flat ? basename : filename);
|
|
23
23
|
if (!opt.dry) {
|
|
24
24
|
if (opt.move) {
|
|
25
25
|
await index_1.fs2.movePathAsync(srcFilename, destFilename, {
|
|
@@ -46,9 +46,9 @@ function kpySync(opt) {
|
|
|
46
46
|
kpyLogFilenames(opt, filenames);
|
|
47
47
|
const overwrite = !opt.noOverwrite;
|
|
48
48
|
filenames.forEach(filename => {
|
|
49
|
-
const basename =
|
|
50
|
-
const srcFilename =
|
|
51
|
-
const destFilename =
|
|
49
|
+
const basename = node_path_1.default.basename(filename);
|
|
50
|
+
const srcFilename = node_path_1.default.resolve(opt.baseDir, filename);
|
|
51
|
+
const destFilename = node_path_1.default.resolve(opt.outputDir, opt.flat ? basename : filename);
|
|
52
52
|
if (!opt.dry) {
|
|
53
53
|
if (opt.move) {
|
|
54
54
|
index_1.fs2.movePath(srcFilename, destFilename, { force: overwrite });
|
|
@@ -80,7 +80,7 @@ function kpyPrepare(opt) {
|
|
|
80
80
|
for (const pattern of opt.inputPatterns) {
|
|
81
81
|
if (pattern.includes('*'))
|
|
82
82
|
continue;
|
|
83
|
-
if (index_1.fs2.isDirectory(
|
|
83
|
+
if (index_1.fs2.isDirectory(node_path_1.default.resolve(opt.baseDir, pattern))) {
|
|
84
84
|
extraPatterns.push(`${pattern}/**`);
|
|
85
85
|
}
|
|
86
86
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
2
|
import type { Options as FastGlobOptions } from 'fast-glob';
|
|
3
3
|
import fastGlob from 'fast-glob';
|
|
4
4
|
import type { AlternativesSchema, AnySchema, ArraySchema, BinarySchema, BooleanSchema, DateSchema, FunctionSchema, ObjectSchema, ValidationErrorItem } from 'joi';
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fastGlob = exports.Ajv = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
exports.Ajv =
|
|
5
|
+
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
6
|
+
exports.Ajv = ajv_1.default;
|
|
7
7
|
const fast_glob_1 = tslib_1.__importDefault(require("fast-glob"));
|
|
8
8
|
exports.fastGlob = fast_glob_1.default;
|
|
9
9
|
tslib_1.__exportStar(require("./buffer/buffer.util"), exports);
|
|
@@ -4,7 +4,7 @@ exports.processSharedUtil = void 0;
|
|
|
4
4
|
exports.memoryUsage = memoryUsage;
|
|
5
5
|
exports.memoryUsageFull = memoryUsageFull;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
-
const
|
|
7
|
+
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
8
8
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
9
9
|
function memoryUsage() {
|
|
10
10
|
const { rss, external, heapUsed, heapTotal } = process.memoryUsage();
|
|
@@ -17,8 +17,8 @@ function memoryUsage() {
|
|
|
17
17
|
}
|
|
18
18
|
function memoryUsageFull() {
|
|
19
19
|
const { rss, external, heapUsed, heapTotal } = process.memoryUsage();
|
|
20
|
-
const totalMem =
|
|
21
|
-
const freeMem =
|
|
20
|
+
const totalMem = node_os_1.default.totalmem();
|
|
21
|
+
const freeMem = node_os_1.default.freemem();
|
|
22
22
|
return {
|
|
23
23
|
rss: (0, js_lib_1._mb)(rss),
|
|
24
24
|
heapTotal: (0, js_lib_1._mb)(heapTotal),
|
|
@@ -40,7 +40,7 @@ class ProcessUtil {
|
|
|
40
40
|
setTimeout(() => clearInterval(this.timer), afterMillis);
|
|
41
41
|
}
|
|
42
42
|
cpuAvg() {
|
|
43
|
-
const avg =
|
|
43
|
+
const avg = node_os_1.default.loadavg();
|
|
44
44
|
return {
|
|
45
45
|
avg1: avg[0].toFixed(2),
|
|
46
46
|
avg5: avg[1].toFixed(2),
|
|
@@ -48,9 +48,9 @@ class ProcessUtil {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
cpuInfo() {
|
|
51
|
-
const c =
|
|
51
|
+
const c = node_os_1.default.cpus()[0];
|
|
52
52
|
return {
|
|
53
|
-
count:
|
|
53
|
+
count: node_os_1.default.cpus().length,
|
|
54
54
|
model: c.model,
|
|
55
55
|
speed: c.speed,
|
|
56
56
|
};
|
|
@@ -73,7 +73,7 @@ class ProcessUtil {
|
|
|
73
73
|
}
|
|
74
74
|
getCPUInfo() {
|
|
75
75
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
76
|
-
return
|
|
76
|
+
return node_os_1.default.cpus().reduce((r, cpu) => {
|
|
77
77
|
r['idle'] += cpu.times.idle;
|
|
78
78
|
Object.values(cpu.times).forEach(m => (r['total'] += m));
|
|
79
79
|
return r;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnyObject, ErrorData, JWTString } from '@naturalcycles/js-lib';
|
|
2
2
|
import type { AnySchema } from 'joi';
|
|
3
3
|
import type { Algorithm, JwtHeader, SignOptions, VerifyOptions } from 'jsonwebtoken';
|
|
4
|
-
import
|
|
4
|
+
import jsonwebtoken from 'jsonwebtoken';
|
|
5
5
|
export { jsonwebtoken };
|
|
6
6
|
export type { Algorithm, JwtHeader, SignOptions, VerifyOptions };
|
|
7
7
|
export interface JWTServiceCfg {
|
package/dist/jwt/jwt.service.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.JWTService = exports.jsonwebtoken = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
6
|
-
const
|
|
7
|
-
exports.jsonwebtoken =
|
|
6
|
+
const jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
|
|
7
|
+
exports.jsonwebtoken = jsonwebtoken_1.default;
|
|
8
8
|
const joi_shared_schemas_1 = require("../validation/joi/joi.shared.schemas");
|
|
9
9
|
const joi_validation_util_1 = require("../validation/joi/joi.validation.util");
|
|
10
10
|
// todo: define JWTError and list possible options
|
|
@@ -31,7 +31,7 @@ class JWTService {
|
|
|
31
31
|
if (schema) {
|
|
32
32
|
(0, joi_validation_util_1.validate)(payload, schema);
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return jsonwebtoken_1.default.sign(payload, this.cfg.privateKey, {
|
|
35
35
|
algorithm: this.cfg.algorithm,
|
|
36
36
|
noTimestamp: true,
|
|
37
37
|
...this.cfg.signOptions,
|
|
@@ -41,7 +41,7 @@ class JWTService {
|
|
|
41
41
|
verify(token, schema, opt = {}, publicKey) {
|
|
42
42
|
(0, js_lib_1._assert)(this.cfg.publicKey, 'JWTService: publicKey is required to be able to verify, but not provided');
|
|
43
43
|
try {
|
|
44
|
-
const data =
|
|
44
|
+
const data = jsonwebtoken_1.default.verify(token, publicKey || this.cfg.publicKey, {
|
|
45
45
|
algorithms: [this.cfg.algorithm],
|
|
46
46
|
...this.cfg.verifyOptions,
|
|
47
47
|
...opt,
|
|
@@ -61,7 +61,7 @@ class JWTService {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
decode(token, schema) {
|
|
64
|
-
const data =
|
|
64
|
+
const data = jsonwebtoken_1.default.decode(token, {
|
|
65
65
|
complete: true,
|
|
66
66
|
});
|
|
67
67
|
(0, js_lib_1._assert)(data?.payload, 'invalid token, decoded value is empty', {
|
package/dist/script/runScript.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runScript = runScript;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
6
6
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
7
7
|
const colors_1 = require("../colors/colors");
|
|
8
8
|
const inspect_1 = require("../string/inspect");
|
|
@@ -69,8 +69,8 @@ function runScript(fn, opt = {}) {
|
|
|
69
69
|
function logEnvironment() {
|
|
70
70
|
const { platform, arch, versions: { node }, env: { CPU_LIMIT, NODE_OPTIONS }, } = process;
|
|
71
71
|
const cpuLimit = Number(CPU_LIMIT) || undefined;
|
|
72
|
-
const availableParallelism =
|
|
73
|
-
const cpus =
|
|
72
|
+
const availableParallelism = node_os_1.default.availableParallelism?.();
|
|
73
|
+
const cpus = node_os_1.default.cpus().length;
|
|
74
74
|
console.log((0, colors_1.dimGrey)(Object.entries({
|
|
75
75
|
node: `${node} ${platform} ${arch}`,
|
|
76
76
|
NODE_OPTIONS: NODE_OPTIONS || 'not defined',
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.secretsDecrypt = secretsDecrypt;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
-
const
|
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
7
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
8
8
|
const colors_1 = require("../colors/colors");
|
|
9
9
|
const index_1 = require("../index");
|
|
@@ -24,8 +24,8 @@ function secretsDecrypt(dir, file, encKeyBuffer, del = false, jsonMode = false)
|
|
|
24
24
|
filenames.forEach(filename => {
|
|
25
25
|
let plainFilename;
|
|
26
26
|
if (jsonMode) {
|
|
27
|
-
(0, js_lib_1._assert)(filename.endsWith('.json'), `${
|
|
28
|
-
(0, js_lib_1._assert)(!filename.endsWith('.plain.json'), `${
|
|
27
|
+
(0, js_lib_1._assert)(filename.endsWith('.json'), `${node_path_1.default.basename(filename)} MUST end with '.json'`);
|
|
28
|
+
(0, js_lib_1._assert)(!filename.endsWith('.plain.json'), `${node_path_1.default.basename(filename)} MUST NOT end with '.plain.json'`);
|
|
29
29
|
plainFilename = filename.replace('.json', '.plain.json');
|
|
30
30
|
const json = (0, crypto_util_1.decryptObject)(index_1.fs2.readJson(filename), encKeyBuffer);
|
|
31
31
|
index_1.fs2.writeJson(plainFilename, json, { spaces: 2 });
|
|
@@ -39,7 +39,7 @@ function secretsDecrypt(dir, file, encKeyBuffer, del = false, jsonMode = false)
|
|
|
39
39
|
if (del) {
|
|
40
40
|
node_fs_1.default.unlinkSync(filename);
|
|
41
41
|
}
|
|
42
|
-
console.log(` ${
|
|
42
|
+
console.log(` ${node_path_1.default.basename(filename)} > ${node_path_1.default.basename(plainFilename)}`);
|
|
43
43
|
});
|
|
44
44
|
console.log(`decrypted ${(0, colors_1.yellow)(filenames.length)} files in ${(0, colors_1.dimGrey)(dir.join(' '))}`);
|
|
45
45
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.secretsEncrypt = secretsEncrypt;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
7
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
8
8
|
const colors_1 = require("../colors/colors");
|
|
9
9
|
const index_1 = require("../index");
|
|
@@ -23,21 +23,21 @@ function secretsEncrypt(pattern, file, encKeyBuffer, del = false, jsonMode = fal
|
|
|
23
23
|
let encFilename;
|
|
24
24
|
filenames.forEach(filename => {
|
|
25
25
|
if (jsonMode) {
|
|
26
|
-
(0, js_lib_1._assert)(filename.endsWith('.plain.json'), `${
|
|
26
|
+
(0, js_lib_1._assert)(filename.endsWith('.plain.json'), `${node_path_1.default.basename(filename)} MUST end with '.plain.json'`);
|
|
27
27
|
encFilename = filename.replace('.plain', '');
|
|
28
28
|
const json = (0, crypto_util_1.encryptObject)(index_1.fs2.readJson(filename), encKeyBuffer);
|
|
29
29
|
index_1.fs2.writeJson(encFilename, json, { spaces: 2 });
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
const plain =
|
|
32
|
+
const plain = node_fs_1.default.readFileSync(filename);
|
|
33
33
|
const enc = (0, crypto_util_1.encryptRandomIVBuffer)(plain, encKeyBuffer);
|
|
34
34
|
encFilename = `${filename}.enc`;
|
|
35
|
-
|
|
35
|
+
node_fs_1.default.writeFileSync(encFilename, enc);
|
|
36
36
|
}
|
|
37
37
|
if (del) {
|
|
38
|
-
|
|
38
|
+
node_fs_1.default.unlinkSync(filename);
|
|
39
39
|
}
|
|
40
|
-
console.log(` ${
|
|
40
|
+
console.log(` ${node_path_1.default.basename(filename)} > ${node_path_1.default.basename(encFilename)}`);
|
|
41
41
|
});
|
|
42
42
|
console.log(`encrypted ${(0, colors_1.yellow)(filenames.length)} files in (${(0, colors_1.dimGrey)(pattern.join(' '))})`);
|
|
43
43
|
}
|
|
@@ -8,7 +8,7 @@ exports.decryptString = decryptString;
|
|
|
8
8
|
exports.encryptString = encryptString;
|
|
9
9
|
exports.timingSafeStringEqual = timingSafeStringEqual;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const
|
|
11
|
+
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
|
|
12
12
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
13
13
|
const hash_util_1 = require("./hash.util");
|
|
14
14
|
const algorithm = 'aes-256-cbc';
|
|
@@ -19,8 +19,8 @@ function encryptRandomIVBuffer(input, secretKeyBuffer) {
|
|
|
19
19
|
// sha256 to match aes-256 key length
|
|
20
20
|
const key = (0, hash_util_1.sha256AsBuffer)(secretKeyBuffer);
|
|
21
21
|
// Random iv to achieve non-deterministic encryption (but deterministic decryption)
|
|
22
|
-
const iv =
|
|
23
|
-
const cipher =
|
|
22
|
+
const iv = node_crypto_1.default.randomBytes(16);
|
|
23
|
+
const cipher = node_crypto_1.default.createCipheriv(algorithm, key, iv);
|
|
24
24
|
return Buffer.concat([iv, cipher.update(input), cipher.final()]);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -32,7 +32,7 @@ function decryptRandomIVBuffer(input, secretKeyBuffer) {
|
|
|
32
32
|
// iv is first 16 bytes of encrypted buffer, the rest is payload
|
|
33
33
|
const iv = input.subarray(0, 16);
|
|
34
34
|
const payload = input.subarray(16);
|
|
35
|
-
const decipher =
|
|
35
|
+
const decipher = node_crypto_1.default.createDecipheriv(algorithm, key, iv);
|
|
36
36
|
return Buffer.concat([decipher.update(payload), decipher.final()]);
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -43,7 +43,7 @@ function decryptObject(obj, secretKeyBuffer) {
|
|
|
43
43
|
const { key, iv } = getCryptoParams(secretKeyBuffer);
|
|
44
44
|
const r = {};
|
|
45
45
|
(0, js_lib_1._stringMapEntries)(obj).forEach(([k, v]) => {
|
|
46
|
-
const decipher =
|
|
46
|
+
const decipher = node_crypto_1.default.createDecipheriv(algorithm, key, iv);
|
|
47
47
|
r[k] = decipher.update(v, 'base64', 'utf8') + decipher.final('utf8');
|
|
48
48
|
});
|
|
49
49
|
return r;
|
|
@@ -56,7 +56,7 @@ function encryptObject(obj, secretKeyBuffer) {
|
|
|
56
56
|
const { key, iv } = getCryptoParams(secretKeyBuffer);
|
|
57
57
|
const r = {};
|
|
58
58
|
(0, js_lib_1._stringMapEntries)(obj).forEach(([k, v]) => {
|
|
59
|
-
const cipher =
|
|
59
|
+
const cipher = node_crypto_1.default.createCipheriv(algorithm, key, iv);
|
|
60
60
|
r[k] = cipher.update(v, 'utf8', 'base64') + cipher.final('base64');
|
|
61
61
|
});
|
|
62
62
|
return r;
|
|
@@ -69,7 +69,7 @@ function encryptObject(obj, secretKeyBuffer) {
|
|
|
69
69
|
*/
|
|
70
70
|
function decryptString(str, secretKeyBuffer) {
|
|
71
71
|
const { key, iv } = getCryptoParams(secretKeyBuffer);
|
|
72
|
-
const decipher =
|
|
72
|
+
const decipher = node_crypto_1.default.createDecipheriv(algorithm, key, iv);
|
|
73
73
|
return decipher.update(str, 'base64', 'utf8') + decipher.final('utf8');
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -80,7 +80,7 @@ function decryptString(str, secretKeyBuffer) {
|
|
|
80
80
|
*/
|
|
81
81
|
function encryptString(str, secretKeyBuffer) {
|
|
82
82
|
const { key, iv } = getCryptoParams(secretKeyBuffer);
|
|
83
|
-
const cipher =
|
|
83
|
+
const cipher = node_crypto_1.default.createCipheriv(algorithm, key, iv);
|
|
84
84
|
return cipher.update(str, 'utf8', 'base64') + cipher.final('base64');
|
|
85
85
|
}
|
|
86
86
|
function getCryptoParams(secretKeyBuffer) {
|
|
@@ -103,5 +103,5 @@ function getCryptoParams(secretKeyBuffer) {
|
|
|
103
103
|
function timingSafeStringEqual(s1, s2) {
|
|
104
104
|
if (s1 === undefined || s2 === undefined || s1.length !== s2.length)
|
|
105
105
|
return false;
|
|
106
|
-
return
|
|
106
|
+
return node_crypto_1.default.timingSafeEqual(Buffer.from(s1), Buffer.from(s2));
|
|
107
107
|
}
|
package/dist/util/zip.util.js
CHANGED
|
@@ -10,11 +10,11 @@ exports.gzipString = gzipString;
|
|
|
10
10
|
exports.gunzipToString = gunzipToString;
|
|
11
11
|
const tslib_1 = require("tslib");
|
|
12
12
|
const node_util_1 = require("node:util");
|
|
13
|
-
const
|
|
14
|
-
const deflate = (0, node_util_1.promisify)(
|
|
15
|
-
const inflate = (0, node_util_1.promisify)(
|
|
16
|
-
const gzip = (0, node_util_1.promisify)(
|
|
17
|
-
const gunzip = (0, node_util_1.promisify)(
|
|
13
|
+
const node_zlib_1 = tslib_1.__importDefault(require("node:zlib"));
|
|
14
|
+
const deflate = (0, node_util_1.promisify)(node_zlib_1.default.deflate.bind(node_zlib_1.default));
|
|
15
|
+
const inflate = (0, node_util_1.promisify)(node_zlib_1.default.inflate.bind(node_zlib_1.default));
|
|
16
|
+
const gzip = (0, node_util_1.promisify)(node_zlib_1.default.gzip.bind(node_zlib_1.default));
|
|
17
|
+
const gunzip = (0, node_util_1.promisify)(node_zlib_1.default.gunzip.bind(node_zlib_1.default));
|
|
18
18
|
// string > compressed buffer
|
|
19
19
|
/**
|
|
20
20
|
* deflateBuffer uses `deflate`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IsoDate } from '@naturalcycles/js-lib';
|
|
2
|
-
import type
|
|
2
|
+
import type Joi from 'joi';
|
|
3
3
|
import type { Extension, StringSchema as JoiStringSchema } from 'joi';
|
|
4
4
|
export interface StringSchema<TSchema = string> extends JoiStringSchema<TSchema> {
|
|
5
5
|
dateString: (min?: IsoDate | 'today', max?: IsoDate | 'today') => StringSchema<IsoDate>;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
5
|
import type { UnixTimestamp } from '@naturalcycles/js-lib'
|
|
6
|
-
import
|
|
6
|
+
import yargs from 'yargs'
|
|
7
7
|
import { appendToBashEnv, appendToGithubEnv, appendToGithubOutput } from '../fs/json2env'
|
|
8
8
|
import { runScript } from '../script/runScript'
|
|
9
9
|
import { generateBuildInfo } from '../util/buildInfo.util'
|
package/src/bin/json2env.ts
CHANGED
package/src/bin/kpy.ts
CHANGED
package/src/bin/slack-this.ts
CHANGED
package/src/colors/colors.ts
CHANGED
package/src/fs/fs2.ts
CHANGED
|
@@ -17,11 +17,11 @@ Credit to: fs-extra (https://github.com/jprichardson/node-fs-extra)
|
|
|
17
17
|
import type { RmOptions, Stats } from 'node:fs'
|
|
18
18
|
import fs from 'node:fs'
|
|
19
19
|
import fsp from 'node:fs/promises'
|
|
20
|
-
import
|
|
20
|
+
import path from 'node:path'
|
|
21
21
|
import { createGzip, createUnzip } from 'node:zlib'
|
|
22
22
|
import { _isTruthy, _jsonParse } from '@naturalcycles/js-lib'
|
|
23
23
|
import type { DumpOptions } from 'js-yaml'
|
|
24
|
-
import
|
|
24
|
+
import yaml from 'js-yaml'
|
|
25
25
|
import { transformToNDJson } from '../stream/ndjson/transformToNDJson'
|
|
26
26
|
import type { ReadableTyped, TransformTyped } from '../stream/stream.model'
|
|
27
27
|
import { transformSplitOnNewline } from '../stream/transform/transformSplit'
|
package/src/fs/json2env.ts
CHANGED
package/src/fs/kpy.ts
CHANGED
package/src/index.ts
CHANGED
package/src/jwt/jwt.service.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AnyObject, ErrorData, JWTString } from '@naturalcycles/js-lib'
|
|
|
2
2
|
import { _assert, _errorDataAppend } from '@naturalcycles/js-lib'
|
|
3
3
|
import type { AnySchema } from 'joi'
|
|
4
4
|
import type { Algorithm, JwtHeader, SignOptions, VerifyOptions } from 'jsonwebtoken'
|
|
5
|
-
import
|
|
5
|
+
import jsonwebtoken from 'jsonwebtoken'
|
|
6
6
|
import { anyObjectSchema } from '../validation/joi/joi.shared.schemas'
|
|
7
7
|
import { validate } from '../validation/joi/joi.validation.util'
|
|
8
8
|
export { jsonwebtoken }
|
package/src/script/runScript.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
3
|
import { _assert } from '@naturalcycles/js-lib'
|
|
4
4
|
import { dimGrey, yellow } from '../colors/colors'
|
|
5
5
|
import { fastGlob, fs2 } from '../index'
|
package/src/util/zip.util.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IsoDate } from '@naturalcycles/js-lib'
|
|
2
2
|
import { localTime } from '@naturalcycles/js-lib'
|
|
3
|
-
import type
|
|
3
|
+
import type Joi from 'joi'
|
|
4
4
|
import type { Extension, StringSchema as JoiStringSchema } from 'joi'
|
|
5
5
|
|
|
6
6
|
export interface StringSchema<TSchema = string> extends JoiStringSchema<TSchema> {
|