@naturalcycles/nodejs-lib 15.90.2 → 15.92.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/fs/fs2.d.ts +6 -5
- package/dist/fs/kpy.js +1 -1
- package/dist/stream/pipeline.d.ts +1 -2
- package/dist/stream/pipeline.js +1 -3
- package/dist/validation/ajv/ajvSchema.d.ts +644 -20
- package/dist/validation/ajv/ajvSchema.js +1179 -8
- package/dist/validation/ajv/from-data/generateJsonSchemaFromData.d.ts +1 -1
- package/dist/validation/ajv/getAjv.js +6 -0
- package/dist/validation/ajv/index.d.ts +0 -1
- package/dist/validation/ajv/index.js +0 -1
- package/dist/validation/ajv/jsonSchemaBuilder.util.d.ts +1 -1
- package/dist/zip/zip.util.d.ts +1 -2
- package/package.json +2 -2
- package/src/validation/ajv/ajvSchema.ts +1930 -50
- package/src/validation/ajv/from-data/generateJsonSchemaFromData.ts +1 -1
- package/src/validation/ajv/getAjv.ts +10 -3
- package/src/validation/ajv/index.ts +0 -1
- package/src/validation/ajv/jsonSchemaBuilder.util.ts +1 -1
- package/dist/validation/ajv/jsonSchemaBuilder.d.ts +0 -653
- package/dist/validation/ajv/jsonSchemaBuilder.js +0 -1128
- package/src/validation/ajv/jsonSchemaBuilder.ts +0 -1975
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _uniq } from '@naturalcycles/js-lib/array'
|
|
2
2
|
import { _stringMapEntries } from '@naturalcycles/js-lib/types'
|
|
3
3
|
import type { AnyObject, StringMap } from '@naturalcycles/js-lib/types'
|
|
4
|
-
import type { JsonSchema } from '../
|
|
4
|
+
import type { JsonSchema } from '../ajvSchema.js'
|
|
5
5
|
|
|
6
6
|
type PrimitiveType = 'undefined' | 'null' | 'boolean' | 'string' | 'number'
|
|
7
7
|
type Type = PrimitiveType | 'array' | 'object'
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
JsonSchemaIsoMonthOptions,
|
|
14
14
|
JsonSchemaStringEmailOptions,
|
|
15
15
|
JsonSchemaTerminal,
|
|
16
|
-
} from './
|
|
16
|
+
} from './ajvSchema.js'
|
|
17
17
|
|
|
18
18
|
/* eslint-disable @typescript-eslint/prefer-string-starts-ends-with */
|
|
19
19
|
// oxlint-disable unicorn/prefer-code-point
|
|
@@ -570,7 +570,7 @@ export function createAjv(opt?: Options): Ajv2020 {
|
|
|
570
570
|
const { propertyName, schemaDictionary } = config
|
|
571
571
|
|
|
572
572
|
const isValidFnByKey: Record<any, ValidateFunction> = _mapObject(
|
|
573
|
-
schemaDictionary as Record<any, JsonSchemaTerminal<any, any
|
|
573
|
+
schemaDictionary as Record<any, JsonSchemaTerminal<any, any>>,
|
|
574
574
|
(key, value) => {
|
|
575
575
|
return [key, ajv.compile(value)]
|
|
576
576
|
},
|
|
@@ -607,7 +607,7 @@ export function createAjv(opt?: Options): Ajv2020 {
|
|
|
607
607
|
modifying: true,
|
|
608
608
|
errors: true,
|
|
609
609
|
schemaType: 'array',
|
|
610
|
-
compile(schemas: JsonSchemaTerminal<any, any
|
|
610
|
+
compile(schemas: JsonSchemaTerminal<any, any>[], _parentSchema, _it) {
|
|
611
611
|
const validators = schemas.map(schema => ajv.compile(schema))
|
|
612
612
|
|
|
613
613
|
function validate(data: AnyObject, ctx: any): boolean {
|
|
@@ -725,6 +725,13 @@ export function createAjv(opt?: Options): Ajv2020 {
|
|
|
725
725
|
},
|
|
726
726
|
})
|
|
727
727
|
|
|
728
|
+
// postValidation is handled in AjvSchema.getValidationResult, not by Ajv itself.
|
|
729
|
+
// We register it here so Ajv's strict mode doesn't reject the keyword.
|
|
730
|
+
ajv.addKeyword({
|
|
731
|
+
keyword: 'postValidation',
|
|
732
|
+
valid: true,
|
|
733
|
+
})
|
|
734
|
+
|
|
728
735
|
return ajv
|
|
729
736
|
}
|
|
730
737
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _uniq } from '@naturalcycles/js-lib/array'
|
|
2
2
|
import { _filterNullishValues } from '@naturalcycles/js-lib/object'
|
|
3
3
|
import type { AnyObject } from '@naturalcycles/js-lib/types'
|
|
4
|
-
import type { JsonSchema } from './
|
|
4
|
+
import type { JsonSchema } from './ajvSchema.js'
|
|
5
5
|
|
|
6
6
|
export const JSON_SCHEMA_ORDER = [
|
|
7
7
|
'$schema',
|