@naturalcycles/nodejs-lib 13.1.0 → 13.1.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.
- package/dist/bin/del.js +3 -2
- package/dist/bin/generate-build-info.js +8 -7
- package/dist/bin/json2env.js +3 -2
- package/dist/bin/kpy.js +3 -2
- package/dist/bin/secrets-decrypt.js +3 -2
- package/dist/bin/secrets-encrypt.js +3 -2
- package/dist/bin/secrets-gen-key.js +5 -4
- package/dist/bin/slack-this.js +3 -2
- package/dist/colors/colors.d.ts +1 -1
- package/dist/colors/colors.js +31 -30
- package/dist/fs/del.js +11 -10
- package/dist/fs/fs.util.d.ts +1 -1
- package/dist/fs/fs.util.js +42 -41
- package/dist/fs/json2env.js +6 -5
- package/dist/fs/kpy.js +8 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/infra/process.util.js +8 -7
- package/dist/jwt/jwt.service.d.ts +1 -1
- package/dist/jwt/jwt.service.js +6 -5
- package/dist/secret/secrets-decrypt.util.js +9 -8
- package/dist/secret/secrets-encrypt.util.js +8 -7
- package/dist/security/crypto.util.js +9 -8
- package/dist/security/hash.util.js +4 -3
- package/dist/security/id.util.js +4 -3
- package/dist/security/secret.util.js +7 -6
- package/dist/stream/ndjson/ndjsonStreamForEach.js +3 -2
- package/dist/stream/ndjson/pipelineFromNDJsonFile.js +4 -3
- package/dist/stream/ndjson/pipelineToNDJsonFile.js +4 -3
- package/dist/stream/transform/transformLogProgress.js +1 -1
- package/dist/util/env.util.js +3 -2
- package/dist/util/exec.util.js +4 -3
- package/dist/util/git.util.js +9 -8
- package/dist/util/zip.util.js +6 -5
- package/dist/validation/ajv/getAjv.js +2 -1
- package/dist/validation/joi/joi.extensions.d.ts +1 -1
- package/dist/validation/joi/joi.extensions.js +3 -2
- package/dist/validation/joi/number.extensions.d.ts +1 -1
- package/dist/validation/joi/string.extensions.d.ts +1 -1
- package/package.json +2 -7
- package/src/bin/del.ts +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 +2 -2
- package/src/bin/slack-this.ts +1 -1
- package/src/colors/colors.ts +2 -2
- package/src/fs/del.ts +2 -2
- package/src/fs/fs.util.ts +3 -3
- package/src/fs/json2env.ts +1 -1
- package/src/fs/kpy.ts +1 -1
- package/src/index.ts +2 -2
- package/src/infra/process.util.ts +1 -1
- package/src/jwt/jwt.service.ts +1 -1
- package/src/secret/secrets-decrypt.util.ts +2 -2
- package/src/secret/secrets-encrypt.util.ts +2 -2
- package/src/security/crypto.util.ts +1 -1
- package/src/security/hash.util.ts +1 -1
- package/src/security/id.util.ts +1 -1
- package/src/security/secret.util.ts +1 -1
- package/src/stream/ndjson/ndjsonStreamForEach.ts +1 -1
- package/src/stream/ndjson/pipelineFromNDJsonFile.ts +1 -1
- package/src/stream/ndjson/pipelineToNDJsonFile.ts +1 -1
- package/src/stream/transform/transformLogProgress.ts +1 -1
- package/src/util/env.util.ts +1 -1
- package/src/util/exec.util.ts +1 -1
- package/src/util/git.util.ts +2 -2
- package/src/util/zip.util.ts +1 -1
- package/src/validation/joi/joi.extensions.ts +1 -1
- package/src/validation/joi/number.extensions.ts +1 -1
- package/src/validation/joi/string.extensions.ts +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Joi = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const joi_1 = tslib_1.__importDefault(require("joi"));
|
|
5
6
|
const number_extensions_1 = require("./number.extensions");
|
|
6
7
|
const string_extensions_1 = require("./string.extensions");
|
|
7
8
|
/**
|
|
8
9
|
* This is the only right place to import Joi from
|
|
9
10
|
*/
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
-
exports.Joi =
|
|
12
|
+
exports.Joi = joi_1.default.defaults(schema => {
|
|
12
13
|
// hack to prevent infinite recursion due to .empty('') where '' is a stringSchema itself
|
|
13
14
|
if (schema.type === 'string') {
|
|
14
15
|
return (schema
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/nodejs-lib",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"docs-serve": "vuepress dev docs",
|
|
@@ -38,12 +38,7 @@
|
|
|
38
38
|
"@naturalcycles/dev-lib": "^13.0.0",
|
|
39
39
|
"@types/node": "^20.1.0",
|
|
40
40
|
"@types/yargs": "^16.0.0",
|
|
41
|
-
"jest": "^29.0.0"
|
|
42
|
-
"nock": "^13.0.2",
|
|
43
|
-
"prettier": "^3.0.0",
|
|
44
|
-
"vue-class-component": "^7.2.6",
|
|
45
|
-
"vuepress": "^1.7.1",
|
|
46
|
-
"vuepress-plugin-typescript": "^0.3.1"
|
|
41
|
+
"jest": "^29.0.0"
|
|
47
42
|
},
|
|
48
43
|
"bin": {
|
|
49
44
|
"del": "dist/bin/del.js",
|
package/src/bin/del.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import yargs from 'yargs'
|
|
6
6
|
import { appendToBashEnv, appendToGithubEnv, appendToGithubOutput } from '../fs/json2env'
|
|
7
7
|
import { runScript } from '../script/runScript'
|
|
8
8
|
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/del.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import fsp from 'node:fs/promises'
|
|
3
3
|
import { pFilter, pMap, _since } from '@naturalcycles/js-lib'
|
|
4
4
|
import { dimGrey, yellow } from '../colors/colors'
|
|
5
5
|
import { _pathExists, _pathExistsSync, globby } from '../index'
|
package/src/fs/fs.util.ts
CHANGED
|
@@ -14,9 +14,9 @@ Credit to: fs-extra (https://github.com/jprichardson/node-fs-extra)
|
|
|
14
14
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
17
|
+
import fs from 'node:fs'
|
|
18
|
+
import fsp from 'node:fs/promises'
|
|
19
|
+
import path from 'node:path'
|
|
20
20
|
import { _jsonParse } from '@naturalcycles/js-lib'
|
|
21
21
|
|
|
22
22
|
/**
|
package/src/fs/json2env.ts
CHANGED
package/src/fs/kpy.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Ajv from 'ajv'
|
|
2
|
-
import
|
|
2
|
+
import fastGlob from 'fast-glob'
|
|
3
3
|
import type { Options as FastGlobOptions } from 'fast-glob'
|
|
4
|
-
import
|
|
4
|
+
import globby from 'globby'
|
|
5
5
|
import type { GlobbyOptions } from 'globby'
|
|
6
6
|
import type {
|
|
7
7
|
AnySchema,
|
package/src/jwt/jwt.service.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _assert, _errorDataAppend, AnyObject, ErrorData, JWTString } from '@naturalcycles/js-lib'
|
|
2
2
|
import { AnySchema } from 'joi'
|
|
3
3
|
import type { Algorithm, VerifyOptions, JwtHeader, SignOptions } from 'jsonwebtoken'
|
|
4
|
-
import
|
|
4
|
+
import jsonwebtoken from 'jsonwebtoken'
|
|
5
5
|
import { anyObjectSchema } from '../validation/joi/joi.shared.schemas'
|
|
6
6
|
import { validate } from '../validation/joi/joi.validation.util'
|
|
7
7
|
export { jsonwebtoken }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
3
|
import { _assert } from '@naturalcycles/js-lib'
|
|
4
4
|
import { dimGrey, yellow } from '../colors/colors'
|
|
5
5
|
import { _readJsonSync, _writeJsonSync, fastGlob } from '../index'
|
|
@@ -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 { _readJsonSync, _writeJsonSync, fastGlob } from '../index'
|
package/src/security/id.util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createUnzip, ZlibOptions } from 'node:zlib'
|
|
2
|
-
import
|
|
2
|
+
import fs from 'node:fs'
|
|
3
3
|
import { _hb } from '@naturalcycles/js-lib'
|
|
4
4
|
import { transformTap, _pipeline, transformSplit } from '../..'
|
|
5
5
|
import { dimWhite, grey } from '../../colors/colors'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createGzip, ZlibOptions } from 'node:zlib'
|
|
2
|
-
import
|
|
2
|
+
import fs from 'node:fs'
|
|
3
3
|
import { AppError } from '@naturalcycles/js-lib'
|
|
4
4
|
import { transformTap, _pipeline, _pathExistsSync, _ensureFileSync } from '../..'
|
|
5
5
|
import { grey } from '../../colors/colors'
|
|
@@ -224,7 +224,7 @@ export function transformLogProgress<IN = any>(
|
|
|
224
224
|
lastSecondStarted = now
|
|
225
225
|
processedLastSecond = 0
|
|
226
226
|
|
|
227
|
-
const rps10 = Math.round(sma.
|
|
227
|
+
const rps10 = Math.round(sma.pushGetAvg(lastRPS))
|
|
228
228
|
if (mem.rss > peakRSS) peakRSS = mem.rss
|
|
229
229
|
|
|
230
230
|
const o: LogItem = {
|
package/src/util/env.util.ts
CHANGED
package/src/util/exec.util.ts
CHANGED
package/src/util/git.util.ts
CHANGED
package/src/util/zip.util.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LocalDate, localTime } from '@naturalcycles/js-lib'
|
|
2
2
|
import { Extension, StringSchema as JoiStringSchema } from 'joi'
|
|
3
|
-
import
|
|
3
|
+
import Joi from 'joi'
|
|
4
4
|
|
|
5
5
|
export interface StringSchema<TSchema = string> extends JoiStringSchema<TSchema> {
|
|
6
6
|
dateString: (min?: string, max?: string) => this
|