@naturalcycles/nodejs-lib 14.7.0 → 14.7.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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { JsonSchema, JsonSchemaBuilder } from '@naturalcycles/js-lib';
|
|
2
|
-
import type { ZodJSONSchema } from '@naturalcycles/js-lib/zod';
|
|
3
2
|
import type { Ajv } from 'ajv';
|
|
4
3
|
import { AjvValidationError } from './ajvValidationError.js';
|
|
5
4
|
export interface AjvValidationOptions {
|
|
@@ -45,7 +44,7 @@ export declare class AjvSchema<T = unknown> {
|
|
|
45
44
|
* Implementation note: JsonSchemaBuilder goes first in the union type, otherwise TypeScript fails to infer <T> type
|
|
46
45
|
* correctly for some reason.
|
|
47
46
|
*/
|
|
48
|
-
static create<T>(schema: JsonSchemaBuilder<T> | JsonSchema<T> | AjvSchema<T
|
|
47
|
+
static create<T>(schema: JsonSchemaBuilder<T> | JsonSchema<T> | AjvSchema<T>, cfg?: Partial<AjvSchemaCfg>): AjvSchema<T>;
|
|
49
48
|
/**
|
|
50
49
|
* Create AjvSchema directly from a filePath of json schema.
|
|
51
50
|
* Convenient method that just does fs.readFileSync for you.
|
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
_substringBefore,
|
|
6
6
|
JsonSchemaAnyBuilder,
|
|
7
7
|
} from '@naturalcycles/js-lib'
|
|
8
|
-
import type { ZodJSONSchema } from '@naturalcycles/js-lib/zod'
|
|
9
8
|
import type { Ajv, ValidateFunction } from 'ajv'
|
|
10
9
|
import { fs2 } from '../../fs/fs2.js'
|
|
11
10
|
import { _inspect } from '../../string/inspect.js'
|
|
@@ -83,7 +82,7 @@ export class AjvSchema<T = unknown> {
|
|
|
83
82
|
* correctly for some reason.
|
|
84
83
|
*/
|
|
85
84
|
static create<T>(
|
|
86
|
-
schema: JsonSchemaBuilder<T> | JsonSchema<T> | AjvSchema<T
|
|
85
|
+
schema: JsonSchemaBuilder<T> | JsonSchema<T> | AjvSchema<T>,
|
|
87
86
|
cfg: Partial<AjvSchemaCfg> = {},
|
|
88
87
|
): AjvSchema<T> {
|
|
89
88
|
if (schema instanceof AjvSchema) return schema
|