@naturalcycles/nodejs-lib 15.90.1 → 15.91.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.
Files changed (38) hide show
  1. package/dist/exec2/exec2.d.ts +1 -1
  2. package/dist/fs/fs2.d.ts +6 -5
  3. package/dist/fs/kpy.js +1 -1
  4. package/dist/security/crypto.util.d.ts +1 -1
  5. package/dist/slack/slack.service.d.ts +1 -1
  6. package/dist/slack/slack.service.js +1 -1
  7. package/dist/stream/pipeline.d.ts +11 -12
  8. package/dist/stream/pipeline.js +5 -7
  9. package/dist/stream/readable/createReadable.d.ts +1 -1
  10. package/dist/stream/transform/transformMap.d.ts +3 -2
  11. package/dist/stream/transform/transformMap.js +1 -1
  12. package/dist/validation/ajv/ajvSchema.d.ts +660 -3
  13. package/dist/validation/ajv/ajvSchema.js +1148 -4
  14. package/dist/validation/ajv/from-data/generateJsonSchemaFromData.d.ts +2 -2
  15. package/dist/validation/ajv/getAjv.d.ts +2 -1
  16. package/dist/validation/ajv/index.d.ts +0 -1
  17. package/dist/validation/ajv/index.js +0 -1
  18. package/dist/validation/ajv/jsonSchemaBuilder.util.d.ts +1 -1
  19. package/dist/zip/zip.util.d.ts +1 -2
  20. package/package.json +2 -1
  21. package/src/exec2/exec2.ts +2 -1
  22. package/src/security/crypto.util.ts +2 -1
  23. package/src/slack/slack.service.ts +6 -7
  24. package/src/stream/pipeline.ts +30 -34
  25. package/src/stream/readable/createReadable.ts +2 -1
  26. package/src/stream/readable/readableCombined.ts +4 -2
  27. package/src/stream/transform/transformFork.ts +2 -1
  28. package/src/stream/transform/transformMap.ts +12 -12
  29. package/src/stream/transform/worker/workerClassProxy.js +1 -1
  30. package/src/stream/writable/writableChunk.ts +2 -1
  31. package/src/validation/ajv/ajvSchema.ts +2005 -5
  32. package/src/validation/ajv/from-data/generateJsonSchemaFromData.ts +3 -2
  33. package/src/validation/ajv/getAjv.ts +3 -2
  34. package/src/validation/ajv/index.ts +0 -1
  35. package/src/validation/ajv/jsonSchemaBuilder.util.ts +1 -1
  36. package/dist/validation/ajv/jsonSchemaBuilder.d.ts +0 -655
  37. package/dist/validation/ajv/jsonSchemaBuilder.js +0 -1129
  38. package/src/validation/ajv/jsonSchemaBuilder.ts +0 -1985
@@ -1,4 +1,4 @@
1
- import { type StdioOptions } from 'node:child_process';
1
+ import type { StdioOptions } from 'node:child_process';
2
2
  import { AppError } from '@naturalcycles/js-lib/error/error.util.js';
3
3
  import type { AnyObject, NumberOfMilliseconds } from '@naturalcycles/js-lib/types';
4
4
  /**
package/dist/fs/fs2.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { RmOptions } from 'node:fs';
2
2
  import fs from 'node:fs';
3
+ import fsp from 'node:fs/promises';
3
4
  /**
4
5
  * fs2 conveniently groups filesystem functions together.
5
6
  * Supposed to be almost a drop-in replacement for these things together:
@@ -61,15 +62,15 @@ declare class FS2 {
61
62
  */
62
63
  isDirectory(filePath: string): boolean;
63
64
  fs: typeof fs;
64
- fsp: typeof fs.promises;
65
+ fsp: typeof fsp;
65
66
  lstat: fs.StatSyncFn;
66
- lstatAsync: typeof fs.promises.lstat;
67
+ lstatAsync: typeof fsp.lstat;
67
68
  stat: fs.StatSyncFn;
68
- statAsync: typeof fs.promises.stat;
69
+ statAsync: typeof fsp.stat;
69
70
  mkdir: typeof fs.mkdirSync;
70
- mkdirAsync: typeof fs.promises.mkdir;
71
+ mkdirAsync: typeof fsp.mkdir;
71
72
  readdir: typeof fs.readdirSync;
72
- readdirAsync: typeof fs.promises.readdir;
73
+ readdirAsync: typeof fsp.readdir;
73
74
  createWriteStream: typeof fs.createWriteStream;
74
75
  createReadStream: typeof fs.createReadStream;
75
76
  }
package/dist/fs/kpy.js CHANGED
@@ -12,7 +12,7 @@ export async function kpy(opt) {
12
12
  });
13
13
  kpyLogFilenames(opt, filenames);
14
14
  const overwrite = !opt.noOverwrite;
15
- await Promise.all(filenames.map(async (filename) => {
15
+ await Promise.all(filenames.map(async filename => {
16
16
  const basename = path.basename(filename);
17
17
  const srcFilename = path.resolve(opt.baseDir, filename);
18
18
  const destFilename = path.resolve(opt.outputDir, opt.flat ? basename : filename);
@@ -1,4 +1,4 @@
1
- import { type Base64String, type StringMap } from '@naturalcycles/js-lib/types';
1
+ import type { Base64String, StringMap } from '@naturalcycles/js-lib/types';
2
2
  /**
3
3
  * Using aes-256-cbc.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { type CommonLogger, type CommonLogLevel } from '@naturalcycles/js-lib/log';
1
+ import type { CommonLogger, CommonLogLevel } from '@naturalcycles/js-lib/log';
2
2
  import type { AnyObject } from '@naturalcycles/js-lib/types';
3
3
  import type { SlackAttachmentField, SlackMessage, SlackServiceCfg } from './slack.service.model.js';
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { localTime } from '@naturalcycles/js-lib/datetime/localTime.js';
2
2
  import { getFetcher } from '@naturalcycles/js-lib/http';
3
- import { createCommonLoggerAtLevel, } from '@naturalcycles/js-lib/log';
3
+ import { createCommonLoggerAtLevel } from '@naturalcycles/js-lib/log';
4
4
  import { _omit } from '@naturalcycles/js-lib/object/object.util.js';
5
5
  import { PQueue } from '@naturalcycles/js-lib/promise/pQueue.js';
6
6
  import { _inspect } from '../index.js';
@@ -1,15 +1,15 @@
1
- import { type Transform } from 'node:stream';
1
+ import type { Transform } from 'node:stream';
2
2
  import type { ReadableStream as WebReadableStream } from 'node:stream/web';
3
- import { type ZlibOptions, type ZstdOptions } from 'node:zlib';
4
- import { type AbortableAsyncMapper, type AsyncIndexedMapper, type AsyncPredicate, type END, type IndexedMapper, type Integer, type NonNegativeInteger, type PositiveInteger, type Predicate, type SKIP } from '@naturalcycles/js-lib/types';
3
+ import type { ZlibOptions, ZstdOptions } from 'node:zlib';
4
+ import type { AbortableAsyncMapper, AsyncIndexedMapper, AsyncPredicate, END, IndexedMapper, Integer, NonNegativeInteger, PositiveInteger, Predicate, SKIP } from '@naturalcycles/js-lib/types';
5
5
  import type { ReadableTyped, TransformOptions, TransformTyped, WritableTyped } from './stream.model.js';
6
- import { type TransformLogProgressOptions } from './transform/transformLogProgress.js';
7
- import { type TransformMapOptions } from './transform/transformMap.js';
8
- import { type TransformMapSimpleOptions } from './transform/transformMapSimple.js';
9
- import { type TransformMapSyncOptions } from './transform/transformMapSync.js';
10
- import { type TransformOffsetOptions } from './transform/transformOffset.js';
11
- import { type TransformThrottleOptions } from './transform/transformThrottle.js';
12
- import { type TransformWarmupOptions } from './transform/transformWarmup.js';
6
+ import type { TransformLogProgressOptions } from './transform/transformLogProgress.js';
7
+ import type { TransformMapOptions } from './transform/transformMap.js';
8
+ import type { TransformMapSimpleOptions } from './transform/transformMapSimple.js';
9
+ import type { TransformMapSyncOptions } from './transform/transformMapSync.js';
10
+ import type { TransformOffsetOptions } from './transform/transformOffset.js';
11
+ import type { TransformThrottleOptions } from './transform/transformThrottle.js';
12
+ import type { TransformWarmupOptions } from './transform/transformWarmup.js';
13
13
  export declare class Pipeline<T = unknown> {
14
14
  private readonly source;
15
15
  private transforms;
@@ -97,8 +97,7 @@ export declare class Pipeline<T = unknown> {
97
97
  parseJson<TO = unknown>(this: Pipeline<Buffer> | Pipeline<Uint8Array> | Pipeline<string>): Pipeline<TO>;
98
98
  gzip(this: Pipeline<Uint8Array>, opt?: ZlibOptions): Pipeline<Uint8Array>;
99
99
  gunzip(this: Pipeline<Uint8Array>, opt?: ZlibOptions): Pipeline<Uint8Array>;
100
- zstdCompress(this: Pipeline<Uint8Array>, level?: Integer, // defaults to 3
101
- opt?: ZstdOptions): Pipeline<Uint8Array>;
100
+ zstdCompress(this: Pipeline<Uint8Array>, level?: Integer, opt?: ZstdOptions): Pipeline<Uint8Array>;
102
101
  zstdDecompress(this: Pipeline<Uint8Array>, opt?: ZstdOptions): Pipeline<Uint8Array>;
103
102
  toArray(opt?: TransformOptions): Promise<T[]>;
104
103
  toFile(outputFilePath: string): Promise<void>;
@@ -1,8 +1,8 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { pipeline } from 'node:stream/promises';
3
- import { createGzip, createUnzip, createZstdCompress, createZstdDecompress, } from 'node:zlib';
3
+ import { createGzip, createUnzip, createZstdCompress, createZstdDecompress } from 'node:zlib';
4
4
  import { createAbortableSignal } from '@naturalcycles/js-lib';
5
- import { _passthroughPredicate, } from '@naturalcycles/js-lib/types';
5
+ import { _passthroughPredicate } from '@naturalcycles/js-lib/types';
6
6
  import { fs2 } from '../fs/fs2.js';
7
7
  import { zstdLevelToOptions } from '../zip/zip.util.js';
8
8
  import { createReadStreamAsNDJson } from './ndjson/createReadStreamAsNDJson.js';
@@ -16,9 +16,9 @@ import { transformFlatten, transformFlattenIfNeeded } from './transform/transfor
16
16
  // oxlint-disable-next-line import/no-cycle -- intentional cycle
17
17
  import { transformFork } from './transform/transformFork.js';
18
18
  import { transformLimit } from './transform/transformLimit.js';
19
- import { transformLogProgress, } from './transform/transformLogProgress.js';
19
+ import { transformLogProgress } from './transform/transformLogProgress.js';
20
20
  import { transformMap } from './transform/transformMap.js';
21
- import { transformMapSimple, } from './transform/transformMapSimple.js';
21
+ import { transformMapSimple } from './transform/transformMapSimple.js';
22
22
  import { transformMapSync } from './transform/transformMapSync.js';
23
23
  import { transformOffset } from './transform/transformOffset.js';
24
24
  import { transformSplitOnNewline } from './transform/transformSplit.js';
@@ -299,9 +299,7 @@ export class Pipeline {
299
299
  else if (outputFilePath.endsWith('.zst')) {
300
300
  this.transforms.push(createZstdCompress(zstdLevelToOptions(level)));
301
301
  }
302
- this.destination = fs2.createWriteStream(outputFilePath, {
303
- // highWaterMark: 64 * 1024, // no observed speedup
304
- });
302
+ this.destination = fs2.createWriteStream(outputFilePath, {});
305
303
  await this.run();
306
304
  }
307
305
  async to(destination) {
@@ -1,4 +1,4 @@
1
- import { type ReadableOptions } from 'node:stream';
1
+ import type { ReadableOptions } from 'node:stream';
2
2
  import type { ReadableTyped } from '../stream.model.js';
3
3
  /**
4
4
  * Convenience function to create a Readable that can be pushed into (similar to RxJS Subject).
@@ -1,6 +1,7 @@
1
- import { type AbortableSignal } from '@naturalcycles/js-lib';
1
+ import type { AbortableSignal } from '@naturalcycles/js-lib';
2
2
  import { ErrorMode } from '@naturalcycles/js-lib/error';
3
- import { type AbortableAsyncMapper, type AsyncPredicate, END, type NumberOfSeconds, type PositiveInteger, type Predicate, type Promisable, SKIP, type StringMap, type UnixTimestampMillis } from '@naturalcycles/js-lib/types';
3
+ import { END, SKIP } from '@naturalcycles/js-lib/types';
4
+ import type { AbortableAsyncMapper, AsyncPredicate, NumberOfSeconds, PositiveInteger, Predicate, Promisable, StringMap, UnixTimestampMillis } from '@naturalcycles/js-lib/types';
4
5
  import type { TransformOptions, TransformTyped } from '../stream.model.js';
5
6
  export interface TransformMapOptions<IN = any, OUT = IN> extends TransformOptions {
6
7
  /**
@@ -5,7 +5,7 @@ import { _anyToError, _assert, ErrorMode } from '@naturalcycles/js-lib/error';
5
5
  import { createCommonLoggerAtLevel } from '@naturalcycles/js-lib/log';
6
6
  import { pDefer } from '@naturalcycles/js-lib/promise/pDefer.js';
7
7
  import { _stringify } from '@naturalcycles/js-lib/string';
8
- import { END, SKIP, } from '@naturalcycles/js-lib/types';
8
+ import { END, SKIP } from '@naturalcycles/js-lib/types';
9
9
  import { yellow } from '../../colors/colors.js';
10
10
  import { PIPELINE_GRACEFUL_ABORT } from '../stream.util.js';
11
11
  const WARMUP_CHECK_INTERVAL_MS = 1000;