@naturalcycles/nodejs-lib 13.30.2 → 13.31.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.
package/dist/fs/fs2.js CHANGED
@@ -79,6 +79,7 @@ class FS2 {
79
79
  }
80
80
  async readJsonAsync(filePath) {
81
81
  const str = await promises_1.default.readFile(filePath, 'utf8');
82
+ // eslint-disable-next-line @typescript-eslint/return-await
82
83
  return (0, js_lib_1._jsonParse)(str);
83
84
  }
84
85
  readYaml(filePath) {
@@ -59,7 +59,7 @@ class ProcessUtil {
59
59
  const stats1 = this.getCPUInfo();
60
60
  const startIdle = stats1.idle;
61
61
  const startTotal = stats1.total;
62
- return new Promise(resolve => {
62
+ return await new Promise(resolve => {
63
63
  setTimeout(() => {
64
64
  const stats2 = this.getCPUInfo();
65
65
  const endIdle = stats2.idle;
@@ -41,9 +41,9 @@ class NDJsonStats {
41
41
  toPretty(name) {
42
42
  return [
43
43
  `Processed ${name ? (0, colors_1.boldWhite)(name) + ': ' : ''}${(0, colors_1.dimWhite)(this.rows)} rows, ${(0, colors_1.dimWhite)((0, js_lib_1._hb)(this.sizeBytes))} in ${(0, colors_1.dimWhite)((0, js_lib_1._ms)(this.tookMillis))}`,
44
- `${(0, colors_1.dimWhite)(this.rpsTotal + ' rows/sec')}`,
45
- `${(0, colors_1.dimWhite)((0, js_lib_1._hb)(this.avgBytesPerRow) + '/row')}`,
46
- `${(0, colors_1.dimWhite)((0, js_lib_1._hb)(this.bpsTotal) + '/sec')}`,
44
+ (0, colors_1.dimWhite)(this.rpsTotal + ' rows/sec'),
45
+ (0, colors_1.dimWhite)((0, js_lib_1._hb)(this.avgBytesPerRow) + '/row'),
46
+ (0, colors_1.dimWhite)((0, js_lib_1._hb)(this.bpsTotal) + '/sec'),
47
47
  ].join(', ');
48
48
  }
49
49
  }
@@ -93,3 +93,5 @@ export declare const utcOffsetSchema: NumberSchema<number>;
93
93
  export declare const ianaTimezoneSchema: StringSchema<string>;
94
94
  export declare const ipAddressSchema: StringSchema<string>;
95
95
  export declare const baseDBEntitySchema: ObjectSchema<BaseDBEntity>;
96
+ export declare const macAddressSchema: StringSchema<string>;
97
+ export declare const uuidSchema: StringSchema<string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseDBEntitySchema = exports.ipAddressSchema = exports.ianaTimezoneSchema = exports.utcOffsetSchema = exports.userAgentSchema = exports.semVerSchema = exports.SEM_VER_REGEX = exports.emailSchema = exports.verSchema = exports.unixTimestampMillis2000Schema = exports.unixTimestampMillisSchema = exports.unixTimestamp2000Schema = exports.unixTimestampSchema = exports.slugSchema = exports.SLUG_REGEX = exports.idBase64UrlSchema = exports.idBase64Schema = exports.idBase62Schema = exports.idSchema = exports.jwtSchema = exports.JWT_REGEX = exports.base64UrlSchema = exports.base64Schema = exports.base62Schema = exports.BASE64URL_REGEX = exports.BASE64_REGEX = exports.BASE62_REGEX = exports.anyObjectSchema = exports.anySchema = exports.urlSchema = exports.numberEnumKeySchema = exports.numberEnumValueSchema = exports.stringEnumKeySchema = exports.stringEnumValueSchema = exports.dateIntervalStringSchema = exports.dateObjectSchema = exports.binarySchema = exports.dateStringSchema = exports.percentageSchema = exports.integerSchema = exports.numberSchemaTyped = exports.numberSchema = exports.stringSchemaTyped = exports.stringSchema = exports.booleanDefaultToFalseSchema = exports.booleanSchema = void 0;
3
+ exports.uuidSchema = exports.macAddressSchema = exports.baseDBEntitySchema = exports.ipAddressSchema = exports.ianaTimezoneSchema = exports.utcOffsetSchema = exports.userAgentSchema = exports.semVerSchema = exports.SEM_VER_REGEX = exports.emailSchema = exports.verSchema = exports.unixTimestampMillis2000Schema = exports.unixTimestampMillisSchema = exports.unixTimestamp2000Schema = exports.unixTimestampSchema = exports.slugSchema = exports.SLUG_REGEX = exports.idBase64UrlSchema = exports.idBase64Schema = exports.idBase62Schema = exports.idSchema = exports.jwtSchema = exports.JWT_REGEX = exports.base64UrlSchema = exports.base64Schema = exports.base62Schema = exports.BASE64URL_REGEX = exports.BASE64_REGEX = exports.BASE62_REGEX = exports.anyObjectSchema = exports.anySchema = exports.urlSchema = exports.numberEnumKeySchema = exports.numberEnumValueSchema = exports.stringEnumKeySchema = exports.stringEnumValueSchema = exports.dateIntervalStringSchema = exports.dateObjectSchema = exports.binarySchema = exports.dateStringSchema = exports.percentageSchema = exports.integerSchema = exports.numberSchemaTyped = exports.numberSchema = exports.stringSchemaTyped = exports.stringSchema = exports.booleanDefaultToFalseSchema = exports.booleanSchema = void 0;
4
4
  exports.arraySchema = arraySchema;
5
5
  exports.objectSchema = objectSchema;
6
6
  exports.oneOfSchema = oneOfSchema;
@@ -136,3 +136,5 @@ exports.baseDBEntitySchema = objectSchema({
136
136
  created: exports.unixTimestamp2000Schema.optional(),
137
137
  updated: exports.unixTimestamp2000Schema.optional(),
138
138
  });
139
+ exports.macAddressSchema = exports.stringSchema.regex(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/);
140
+ exports.uuidSchema = exports.stringSchema.uuid();
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "13.30.2",
3
+ "version": "13.31.1",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
+ "build": "dev-lib build",
7
+ "test": "dev-lib test",
8
+ "lint": "dev-lib lint",
9
+ "bt": "dev-lib bt",
10
+ "lbt": "dev-lib lbt",
6
11
  "docs-serve": "vuepress dev docs",
7
12
  "docs-build": "vuepress build docs",
8
13
  "slack-this-debug": "tsn ./src/bin/slack-this.ts --channel test --msg 'Hello slack!'",
@@ -35,7 +40,7 @@
35
40
  },
36
41
  "devDependencies": {
37
42
  "@naturalcycles/bench-lib": "^3.0.0",
38
- "@naturalcycles/dev-lib": "^13.0.0",
43
+ "@naturalcycles/dev-lib": "^15.0.3",
39
44
  "@types/node": "^20.1.0",
40
45
  "@types/yargs": "^16.0.0",
41
46
  "jest": "^29.0.0"
package/src/fs/fs2.ts CHANGED
@@ -68,6 +68,7 @@ class FS2 {
68
68
 
69
69
  async readJsonAsync<T = unknown>(filePath: string): Promise<T> {
70
70
  const str = await fsp.readFile(filePath, 'utf8')
71
+ // eslint-disable-next-line @typescript-eslint/return-await
71
72
  return _jsonParse(str)
72
73
  }
73
74
 
@@ -77,7 +77,7 @@ class ProcessUtil {
77
77
  const startIdle = stats1.idle
78
78
  const startTotal = stats1.total
79
79
 
80
- return new Promise<number>(resolve => {
80
+ return await new Promise<number>(resolve => {
81
81
  setTimeout(() => {
82
82
  const stats2 = this.getCPUInfo()
83
83
  const endIdle = stats2.idle
@@ -46,9 +46,9 @@ export class NDJsonStats {
46
46
  `Processed ${name ? boldWhite(name) + ': ' : ''}${dimWhite(this.rows)} rows, ${dimWhite(
47
47
  _hb(this.sizeBytes),
48
48
  )} in ${dimWhite(_ms(this.tookMillis))}`,
49
- `${dimWhite(this.rpsTotal + ' rows/sec')}`,
50
- `${dimWhite(_hb(this.avgBytesPerRow) + '/row')}`,
51
- `${dimWhite(_hb(this.bpsTotal) + '/sec')}`,
49
+ dimWhite(this.rpsTotal + ' rows/sec'),
50
+ dimWhite(_hb(this.avgBytesPerRow) + '/row'),
51
+ dimWhite(_hb(this.bpsTotal) + '/sec'),
52
52
  ].join(', ')
53
53
  }
54
54
  }
@@ -170,3 +170,7 @@ export const baseDBEntitySchema: ObjectSchema<BaseDBEntity> = objectSchema<BaseD
170
170
  created: unixTimestamp2000Schema.optional(),
171
171
  updated: unixTimestamp2000Schema.optional(),
172
172
  })
173
+
174
+ export const macAddressSchema = stringSchema.regex(/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/)
175
+
176
+ export const uuidSchema = stringSchema.uuid()