@naturalcycles/nodejs-lib 15.74.1 → 15.76.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/stream/pipeline.js +1 -0
- package/dist/stream/transform/transformFork.js +1 -0
- package/dist/validation/ajv/getAjv.js +3 -0
- package/dist/validation/ajv/jsonSchemaBuilder.d.ts +5 -0
- package/dist/validation/ajv/jsonSchemaBuilder.js +7 -0
- package/package.json +1 -1
- package/src/stream/pipeline.ts +1 -0
- package/src/stream/transform/transformFork.ts +1 -0
- package/src/validation/ajv/getAjv.ts +3 -0
- package/src/validation/ajv/jsonSchemaBuilder.ts +8 -0
package/dist/stream/pipeline.js
CHANGED
|
@@ -13,6 +13,7 @@ import { PIPELINE_GRACEFUL_ABORT } from './stream.util.js';
|
|
|
13
13
|
import { transformChunk } from './transform/transformChunk.js';
|
|
14
14
|
import { transformFilterSync } from './transform/transformFilter.js';
|
|
15
15
|
import { transformFlatten, transformFlattenIfNeeded } from './transform/transformFlatten.js';
|
|
16
|
+
// oxlint-disable-next-line import/no-cycle -- intentional cycle
|
|
16
17
|
import { transformFork } from './transform/transformFork.js';
|
|
17
18
|
import { transformLimit } from './transform/transformLimit.js';
|
|
18
19
|
import { transformLogProgress, } from './transform/transformLogProgress.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Transform } from 'node:stream';
|
|
2
2
|
import { createCommonLoggerAtLevel } from '@naturalcycles/js-lib/log';
|
|
3
3
|
import { pDefer } from '@naturalcycles/js-lib/promise/pDefer.js';
|
|
4
|
+
// oxlint-disable-next-line import/no-cycle -- intentional cycle
|
|
4
5
|
import { Pipeline } from '../pipeline.js';
|
|
5
6
|
import { createReadable } from '../readable/createReadable.js';
|
|
6
7
|
/**
|
|
@@ -13,6 +13,9 @@ const AJV_OPTIONS = {
|
|
|
13
13
|
// these are important and kept same as default:
|
|
14
14
|
// https://ajv.js.org/options.html#coercetypes
|
|
15
15
|
coerceTypes: false, // while `false` - it won't mutate your input
|
|
16
|
+
strictTypes: true,
|
|
17
|
+
strictTuples: true,
|
|
18
|
+
allowUnionTypes: true, // supports oneOf/anyOf schemas
|
|
16
19
|
};
|
|
17
20
|
const AJV_NON_MUTATING_OPTIONS = {
|
|
18
21
|
...AJV_OPTIONS,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Set2 } from '@naturalcycles/js-lib/object';
|
|
2
2
|
import { type AnyObject, type BaseDBEntity, type IANATimezone, type Inclusiveness, type IsoDate, type IsoDateTime, type IsoMonth, type NumberEnum, type StringEnum, type StringMap, type UnixTimestamp, type UnixTimestampMillis } from '@naturalcycles/js-lib/types';
|
|
3
3
|
export declare const j: {
|
|
4
|
+
/**
|
|
5
|
+
* Matches literally any value - equivalent to TypeScript's `any` type.
|
|
6
|
+
* Use sparingly, as it bypasses type validation entirely.
|
|
7
|
+
*/
|
|
8
|
+
any(): JsonSchemaAnyBuilder<any, any, false>;
|
|
4
9
|
string(): JsonSchemaStringBuilder<string, string, false>;
|
|
5
10
|
number(): JsonSchemaNumberBuilder<number, number, false>;
|
|
6
11
|
boolean(): JsonSchemaBooleanBuilder<boolean, boolean, false>;
|
|
@@ -9,6 +9,13 @@ import { BASE64URL_REGEX, COUNTRY_CODE_REGEX, CURRENCY_REGEX, IPV4_REGEX, IPV6_R
|
|
|
9
9
|
import { TIMEZONES } from '../timezones.js';
|
|
10
10
|
import { isEveryItemNumber, isEveryItemPrimitive, isEveryItemString, JSON_SCHEMA_ORDER, mergeJsonSchemaObjects, } from './jsonSchemaBuilder.util.js';
|
|
11
11
|
export const j = {
|
|
12
|
+
/**
|
|
13
|
+
* Matches literally any value - equivalent to TypeScript's `any` type.
|
|
14
|
+
* Use sparingly, as it bypasses type validation entirely.
|
|
15
|
+
*/
|
|
16
|
+
any() {
|
|
17
|
+
return new JsonSchemaAnyBuilder({});
|
|
18
|
+
},
|
|
12
19
|
string() {
|
|
13
20
|
return new JsonSchemaStringBuilder();
|
|
14
21
|
},
|
package/package.json
CHANGED
package/src/stream/pipeline.ts
CHANGED
|
@@ -39,6 +39,7 @@ import { PIPELINE_GRACEFUL_ABORT } from './stream.util.js'
|
|
|
39
39
|
import { transformChunk } from './transform/transformChunk.js'
|
|
40
40
|
import { transformFilterSync } from './transform/transformFilter.js'
|
|
41
41
|
import { transformFlatten, transformFlattenIfNeeded } from './transform/transformFlatten.js'
|
|
42
|
+
// oxlint-disable-next-line import/no-cycle -- intentional cycle
|
|
42
43
|
import { transformFork } from './transform/transformFork.js'
|
|
43
44
|
import { transformLimit } from './transform/transformLimit.js'
|
|
44
45
|
import {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Transform } from 'node:stream'
|
|
2
2
|
import { createCommonLoggerAtLevel } from '@naturalcycles/js-lib/log'
|
|
3
3
|
import { type DeferredPromise, pDefer } from '@naturalcycles/js-lib/promise/pDefer.js'
|
|
4
|
+
// oxlint-disable-next-line import/no-cycle -- intentional cycle
|
|
4
5
|
import { Pipeline } from '../pipeline.js'
|
|
5
6
|
import { createReadable } from '../readable/createReadable.js'
|
|
6
7
|
import type { TransformOptions, TransformTyped } from '../stream.model.js'
|
|
@@ -21,6 +21,9 @@ const AJV_OPTIONS: Options = {
|
|
|
21
21
|
// these are important and kept same as default:
|
|
22
22
|
// https://ajv.js.org/options.html#coercetypes
|
|
23
23
|
coerceTypes: false, // while `false` - it won't mutate your input
|
|
24
|
+
strictTypes: true,
|
|
25
|
+
strictTuples: true,
|
|
26
|
+
allowUnionTypes: true, // supports oneOf/anyOf schemas
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const AJV_NON_MUTATING_OPTIONS: Options = {
|
|
@@ -49,6 +49,14 @@ import {
|
|
|
49
49
|
} from './jsonSchemaBuilder.util.js'
|
|
50
50
|
|
|
51
51
|
export const j = {
|
|
52
|
+
/**
|
|
53
|
+
* Matches literally any value - equivalent to TypeScript's `any` type.
|
|
54
|
+
* Use sparingly, as it bypasses type validation entirely.
|
|
55
|
+
*/
|
|
56
|
+
any(): JsonSchemaAnyBuilder<any, any, false> {
|
|
57
|
+
return new JsonSchemaAnyBuilder({})
|
|
58
|
+
},
|
|
59
|
+
|
|
52
60
|
string(): JsonSchemaStringBuilder<string, string, false> {
|
|
53
61
|
return new JsonSchemaStringBuilder()
|
|
54
62
|
},
|