@naturalcycles/nodejs-lib 15.90.0 → 15.90.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,6 +1,5 @@
|
|
|
1
1
|
import { type ValidationFunction, type ValidationFunctionResult } from '@naturalcycles/js-lib';
|
|
2
2
|
import { type AnyObject } from '@naturalcycles/js-lib/types';
|
|
3
|
-
import type { ZodType } from '@naturalcycles/js-lib/zod';
|
|
4
3
|
import type { Ajv } from 'ajv';
|
|
5
4
|
import { AjvValidationError } from './ajvValidationError.js';
|
|
6
5
|
import { type JsonSchema, JsonSchemaTerminal } from './jsonSchemaBuilder.js';
|
|
@@ -25,10 +24,6 @@ export declare class AjvSchema<IN = unknown, OUT = IN> {
|
|
|
25
24
|
* correctly for some reason.
|
|
26
25
|
*/
|
|
27
26
|
static create<IN, OUT = IN>(schema: SchemaHandledByAjv<IN, OUT>, cfg?: Partial<AjvSchemaCfg>): AjvSchema<IN, OUT>;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Use `j` to build schemas, not `z` or `zod`.
|
|
30
|
-
*/
|
|
31
|
-
static createFromZod<T extends ZodType<any, any, any>>(schema: T): AjvSchema<T['_input'], T['_output']>;
|
|
32
27
|
static isJsonSchemaBuilder<IN, OUT>(schema: unknown): schema is JsonSchemaTerminal<IN, OUT, any>;
|
|
33
28
|
readonly cfg: AjvSchemaCfg;
|
|
34
29
|
/**
|
|
@@ -3,7 +3,6 @@ import { _assert } from '@naturalcycles/js-lib/error';
|
|
|
3
3
|
import { _deepCopy, _filterNullishValues } from '@naturalcycles/js-lib/object';
|
|
4
4
|
import { _substringBefore } from '@naturalcycles/js-lib/string';
|
|
5
5
|
import { _typeCast } from '@naturalcycles/js-lib/types';
|
|
6
|
-
import { z } from '@naturalcycles/js-lib/zod';
|
|
7
6
|
import { _inspect } from '../../string/inspect.js';
|
|
8
7
|
import { AjvValidationError } from './ajvValidationError.js';
|
|
9
8
|
import { getAjv } from './getAjv.js';
|
|
@@ -70,15 +69,6 @@ export class AjvSchema {
|
|
|
70
69
|
AjvSchema.cacheAjvSchema(schema, ajvSchema);
|
|
71
70
|
return ajvSchema;
|
|
72
71
|
}
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated Use `j` to build schemas, not `z` or `zod`.
|
|
75
|
-
*/
|
|
76
|
-
static createFromZod(schema) {
|
|
77
|
-
const jsonSchema = z.toJSONSchema(schema, {
|
|
78
|
-
target: 'draft-2020-12',
|
|
79
|
-
});
|
|
80
|
-
return AjvSchema.create(jsonSchema);
|
|
81
|
-
}
|
|
82
72
|
static isJsonSchemaBuilder(schema) {
|
|
83
73
|
return schema instanceof JsonSchemaTerminal;
|
|
84
74
|
}
|
package/package.json
CHANGED
|
@@ -8,8 +8,6 @@ import { _assert } from '@naturalcycles/js-lib/error'
|
|
|
8
8
|
import { _deepCopy, _filterNullishValues } from '@naturalcycles/js-lib/object'
|
|
9
9
|
import { _substringBefore } from '@naturalcycles/js-lib/string'
|
|
10
10
|
import { _typeCast, type AnyObject } from '@naturalcycles/js-lib/types'
|
|
11
|
-
import type { ZodType } from '@naturalcycles/js-lib/zod'
|
|
12
|
-
import { z } from '@naturalcycles/js-lib/zod'
|
|
13
11
|
import type { Ajv, ErrorObject } from 'ajv'
|
|
14
12
|
import { _inspect } from '../../string/inspect.js'
|
|
15
13
|
import { AjvValidationError } from './ajvValidationError.js'
|
|
@@ -93,19 +91,6 @@ export class AjvSchema<IN = unknown, OUT = IN> {
|
|
|
93
91
|
return ajvSchema
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated Use `j` to build schemas, not `z` or `zod`.
|
|
98
|
-
*/
|
|
99
|
-
static createFromZod<T extends ZodType<any, any, any>>(
|
|
100
|
-
schema: T,
|
|
101
|
-
): AjvSchema<T['_input'], T['_output']> {
|
|
102
|
-
const jsonSchema = z.toJSONSchema(schema, {
|
|
103
|
-
target: 'draft-2020-12',
|
|
104
|
-
}) as unknown as JsonSchema<T['_input'], T['_output']>
|
|
105
|
-
|
|
106
|
-
return AjvSchema.create(jsonSchema)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
94
|
static isJsonSchemaBuilder<IN, OUT>(schema: unknown): schema is JsonSchemaTerminal<IN, OUT, any> {
|
|
110
95
|
return schema instanceof JsonSchemaTerminal
|
|
111
96
|
}
|