@forklaunch/validator 0.3.12 → 0.4.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/lib/index-V6qNDTlr.d.mts +476 -0
- package/lib/index-V6qNDTlr.d.ts +476 -0
- package/lib/index.d.mts +6 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.js +18 -1
- package/lib/index.mjs +0 -0
- package/lib/src/typebox/index.d.mts +220 -0
- package/lib/src/typebox/index.d.ts +220 -3
- package/lib/src/typebox/index.js +448 -1
- package/lib/src/typebox/index.mjs +406 -0
- package/lib/src/zod/index.d.mts +106 -0
- package/lib/src/zod/index.d.ts +106 -3
- package/lib/src/zod/index.js +291 -1
- package/lib/src/zod/index.mjs +244 -0
- package/lib/tests/utils/mockSchemaValidator.d.mts +69 -0
- package/lib/tests/utils/mockSchemaValidator.d.ts +29 -25
- package/lib/tests/utils/mockSchemaValidator.js +143 -79
- package/lib/tests/utils/mockSchemaValidator.mjs +99 -0
- package/package.json +21 -8
- package/lib/index.d.ts.map +0 -1
- package/lib/src/shared/types/schema.types.d.ts +0 -255
- package/lib/src/shared/types/schema.types.d.ts.map +0 -1
- package/lib/src/shared/types/schema.types.js +0 -1
- package/lib/src/typebox/index.d.ts.map +0 -1
- package/lib/src/typebox/staticSchemaValidator.d.ts +0 -99
- package/lib/src/typebox/staticSchemaValidator.d.ts.map +0 -1
- package/lib/src/typebox/staticSchemaValidator.js +0 -99
- package/lib/src/typebox/typeboxSchemaValidator.d.ts +0 -122
- package/lib/src/typebox/typeboxSchemaValidator.d.ts.map +0 -1
- package/lib/src/typebox/typeboxSchemaValidator.js +0 -362
- package/lib/src/typebox/types/schema.types.d.ts +0 -59
- package/lib/src/typebox/types/schema.types.d.ts.map +0 -1
- package/lib/src/typebox/types/schema.types.js +0 -1
- package/lib/src/zod/index.d.ts.map +0 -1
- package/lib/src/zod/staticSchemaValidator.d.ts +0 -99
- package/lib/src/zod/staticSchemaValidator.d.ts.map +0 -1
- package/lib/src/zod/staticSchemaValidator.js +0 -99
- package/lib/src/zod/types/schema.types.d.ts +0 -71
- package/lib/src/zod/types/schema.types.d.ts.map +0 -1
- package/lib/src/zod/types/schema.types.js +0 -1
- package/lib/src/zod/zodSchemaValidator.d.ts +0 -110
- package/lib/src/zod/zodSchemaValidator.d.ts.map +0 -1
- package/lib/src/zod/zodSchemaValidator.js +0 -192
- package/lib/tests/typebox/advancedParse.test.d.ts +0 -2
- package/lib/tests/typebox/advancedParse.test.d.ts.map +0 -1
- package/lib/tests/typebox/advancedParse.test.js +0 -514
- package/lib/tests/typebox/largeSchema.test.d.ts +0 -2
- package/lib/tests/typebox/largeSchema.test.d.ts.map +0 -1
- package/lib/tests/typebox/largeSchema.test.js +0 -150
- package/lib/tests/typebox/schemaValidator.test.d.ts +0 -2
- package/lib/tests/typebox/schemaValidator.test.d.ts.map +0 -1
- package/lib/tests/typebox/schemaValidator.test.js +0 -253
- package/lib/tests/typebox/typeEquality.test.d.ts +0 -2
- package/lib/tests/typebox/typeEquality.test.d.ts.map +0 -1
- package/lib/tests/typebox/typeEquality.test.js +0 -100
- package/lib/tests/utils/compare.d.ts +0 -2
- package/lib/tests/utils/compare.d.ts.map +0 -1
- package/lib/tests/utils/compare.js +0 -8
- package/lib/tests/utils/mockSchemaValidator.d.ts.map +0 -1
- package/lib/tests/zod/advancedParse.test.d.ts +0 -2
- package/lib/tests/zod/advancedParse.test.d.ts.map +0 -1
- package/lib/tests/zod/advancedParse.test.js +0 -514
- package/lib/tests/zod/largeSchema.test.d.ts +0 -2
- package/lib/tests/zod/largeSchema.test.d.ts.map +0 -1
- package/lib/tests/zod/largeSchema.test.js +0 -150
- package/lib/tests/zod/schemaValidator.test.d.ts +0 -2
- package/lib/tests/zod/schemaValidator.test.d.ts.map +0 -1
- package/lib/tests/zod/schemaValidator.test.js +0 -205
- package/lib/tests/zod/typeEquality.test.d.ts +0 -2
- package/lib/tests/zod/typeEquality.test.d.ts.map +0 -1
- package/lib/tests/zod/typeEquality.test.js +0 -100
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/vitest.config.d.ts +0 -3
- package/lib/vitest.config.d.ts.map +0 -1
- package/lib/vitest.config.js +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/typebox/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { TypeboxSchemaValidator } from './typeboxSchemaValidator';
|
|
2
|
-
/**
|
|
3
|
-
* Factory function for creating a TypeboxSchemaValidator instance.
|
|
4
|
-
* @returns {TypeboxSchemaValidator} The TypeboxSchemaValidator instance.
|
|
5
|
-
*/
|
|
6
|
-
export declare const SchemaValidator: () => TypeboxSchemaValidator;
|
|
7
|
-
/**
|
|
8
|
-
* TypeBox schema definition for string type.
|
|
9
|
-
*/
|
|
10
|
-
export declare const string: import("@sinclair/typebox").TString;
|
|
11
|
-
/**
|
|
12
|
-
* TypeBox schema definition for UUID type.
|
|
13
|
-
*/
|
|
14
|
-
export declare const uuid: import("@sinclair/typebox").TString;
|
|
15
|
-
/**
|
|
16
|
-
* TypeBox schema definition for URI type.
|
|
17
|
-
*/
|
|
18
|
-
export declare const uri: import("@sinclair/typebox").TString;
|
|
19
|
-
/**
|
|
20
|
-
* TypeBox schema definition for email type.
|
|
21
|
-
*/
|
|
22
|
-
export declare const email: import("@sinclair/typebox").TString;
|
|
23
|
-
/**
|
|
24
|
-
* TypeBox schema definition for number type.
|
|
25
|
-
*/
|
|
26
|
-
export declare const number: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TDate, import("@sinclair/typebox").TBigInt]>, number>;
|
|
27
|
-
/**
|
|
28
|
-
* TypeBox schema definition for bigint type.
|
|
29
|
-
*/
|
|
30
|
-
export declare const bigint: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TDate]>, bigint>;
|
|
31
|
-
/**
|
|
32
|
-
* TypeBox schema definition for boolean type.
|
|
33
|
-
*/
|
|
34
|
-
export declare const boolean: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TString]>, boolean | undefined>;
|
|
35
|
-
/**
|
|
36
|
-
* TypeBox schema definition for date type.
|
|
37
|
-
*/
|
|
38
|
-
export declare const date: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>, Date>;
|
|
39
|
-
/**
|
|
40
|
-
* TypeBox schema definition for symbol type.
|
|
41
|
-
*/
|
|
42
|
-
export declare const symbol: import("@sinclair/typebox").TSymbol;
|
|
43
|
-
/**
|
|
44
|
-
* TypeBox schema definition for undefined, null, void types.
|
|
45
|
-
*/
|
|
46
|
-
export declare const nullish: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TVoid, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TUndefined]>;
|
|
47
|
-
/**
|
|
48
|
-
* TypeBox schema definition for any type.
|
|
49
|
-
*/
|
|
50
|
-
export declare const any: import("@sinclair/typebox").TAny;
|
|
51
|
-
/**
|
|
52
|
-
* TypeBox schema definition for unknown type.
|
|
53
|
-
*/
|
|
54
|
-
export declare const unknown: import("@sinclair/typebox").TUnknown;
|
|
55
|
-
/**
|
|
56
|
-
* TypeBox schema definition for never type.
|
|
57
|
-
*/
|
|
58
|
-
export declare const never: import("@sinclair/typebox").TNever;
|
|
59
|
-
/**
|
|
60
|
-
* Transforms valid schema into TypeBox schema.
|
|
61
|
-
*/
|
|
62
|
-
export declare const schemify: <T extends import("./types/schema.types").TIdiomaticSchema>(schema: T) => import("./types/schema.types").TResolve<T>;
|
|
63
|
-
/**
|
|
64
|
-
* Makes a valid schema optional.
|
|
65
|
-
*/
|
|
66
|
-
export declare const optional: <T extends import("./types/schema.types").TIdiomaticSchema>(schema: T) => import("@sinclair/typebox").TOptional<import("./types/schema.types").TResolve<T>>;
|
|
67
|
-
/**
|
|
68
|
-
* Defines an array for a valid schema.
|
|
69
|
-
*/
|
|
70
|
-
export declare const array: <T extends import("./types/schema.types").TIdiomaticSchema>(schema: T) => import("@sinclair/typebox").TArray<import("./types/schema.types").TResolve<T>>;
|
|
71
|
-
/**
|
|
72
|
-
* Defines a union for a valid schema.
|
|
73
|
-
*/
|
|
74
|
-
export declare const union: <T extends import("./types/schema.types").TUnionContainer>(schemas: [...T]) => import("@sinclair/typebox").TUnion<import("./types/schema.types").UnionTResolve<T>>;
|
|
75
|
-
/**
|
|
76
|
-
* Defines a literal for a valid schema.
|
|
77
|
-
*/
|
|
78
|
-
export declare const literal: <T extends import("../..").LiteralSchema>(value: T) => import("@sinclair/typebox").TLiteral<T>;
|
|
79
|
-
/**
|
|
80
|
-
* Defines an enum for a valid schema.
|
|
81
|
-
*/
|
|
82
|
-
export declare const enum_: <T extends import("../..").LiteralSchema>(schemaEnum: Record<string, T>) => import("@sinclair/typebox").TUnion<import("./types/schema.types").UnionTResolve<T[]>>;
|
|
83
|
-
/**
|
|
84
|
-
* Checks if a value is a TypeBox schema.
|
|
85
|
-
*/
|
|
86
|
-
export declare const isSchema: (value: unknown) => value is import("@sinclair/typebox").TSchema;
|
|
87
|
-
/**
|
|
88
|
-
* Validates a value against a valid schema.
|
|
89
|
-
*/
|
|
90
|
-
export declare const validate: <T extends import("./types/schema.types").TIdiomaticSchema | import("@sinclair/typebox").TSchema>(schema: T | import("@sinclair/typebox/compiler").TypeCheck<import("./types/schema.types").TResolve<T>>, value: unknown) => boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Parses a value against a valid schema.
|
|
93
|
-
*/
|
|
94
|
-
export declare const parse: <T extends import("./types/schema.types").TIdiomaticSchema | import("@sinclair/typebox").TSchema>(schema: T | import("@sinclair/typebox/compiler").TypeCheck<import("./types/schema.types").TResolve<T>>, value: unknown) => import("../..").ParseResult<import("./types/schema.types").TResolve<T>>;
|
|
95
|
-
/**
|
|
96
|
-
* Generates an OpenAPI schema object from a valid schema.
|
|
97
|
-
*/
|
|
98
|
-
export declare const openapi: <T extends import("./types/schema.types").TIdiomaticSchema | import("@sinclair/typebox").TSchema>(schema: T) => import("openapi3-ts/oas31").SchemaObject;
|
|
99
|
-
//# sourceMappingURL=staticSchemaValidator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"staticSchemaValidator.d.ts","sourceRoot":"","sources":["../../../src/typebox/staticSchemaValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,eAAe,8BAAqC,CAAC;AAIlE;;GAEG;AACH,eAAO,MAAM,MAAM,qCAA+B,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,IAAI,qCAA6B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,GAAG,qCAA4B,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,KAAK,qCAA8B,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,MAAM,iTAA+B,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,MAAM,8QAA+B,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,OAAO,8KAAgC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,IAAI,0QAA6B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,MAAM,qCAA+B,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,OAAO,oJAAgC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,GAAG,kCAA4B,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,OAAO,sCAAgC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,KAAK,oCAA8B,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,QAAQ,sHAEpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,6JAEpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,0JAA0D,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,KAAK,oKAA0D,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,OAAO,gGAEnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,mKAA0D,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,QAAQ,kEAEpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,sOAEpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,sSAA0D,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,OAAO,0JAEnB,CAAC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { TypeboxSchemaValidator } from './typeboxSchemaValidator';
|
|
2
|
-
/**
|
|
3
|
-
* Factory function for creating a TypeboxSchemaValidator instance.
|
|
4
|
-
* @returns {TypeboxSchemaValidator} The TypeboxSchemaValidator instance.
|
|
5
|
-
*/
|
|
6
|
-
export const SchemaValidator = () => new TypeboxSchemaValidator();
|
|
7
|
-
const StaticSchemaValidator = SchemaValidator();
|
|
8
|
-
/**
|
|
9
|
-
* TypeBox schema definition for string type.
|
|
10
|
-
*/
|
|
11
|
-
export const string = StaticSchemaValidator.string;
|
|
12
|
-
/**
|
|
13
|
-
* TypeBox schema definition for UUID type.
|
|
14
|
-
*/
|
|
15
|
-
export const uuid = StaticSchemaValidator.uuid;
|
|
16
|
-
/**
|
|
17
|
-
* TypeBox schema definition for URI type.
|
|
18
|
-
*/
|
|
19
|
-
export const uri = StaticSchemaValidator.uri;
|
|
20
|
-
/**
|
|
21
|
-
* TypeBox schema definition for email type.
|
|
22
|
-
*/
|
|
23
|
-
export const email = StaticSchemaValidator.email;
|
|
24
|
-
/**
|
|
25
|
-
* TypeBox schema definition for number type.
|
|
26
|
-
*/
|
|
27
|
-
export const number = StaticSchemaValidator.number;
|
|
28
|
-
/**
|
|
29
|
-
* TypeBox schema definition for bigint type.
|
|
30
|
-
*/
|
|
31
|
-
export const bigint = StaticSchemaValidator.bigint;
|
|
32
|
-
/**
|
|
33
|
-
* TypeBox schema definition for boolean type.
|
|
34
|
-
*/
|
|
35
|
-
export const boolean = StaticSchemaValidator.boolean;
|
|
36
|
-
/**
|
|
37
|
-
* TypeBox schema definition for date type.
|
|
38
|
-
*/
|
|
39
|
-
export const date = StaticSchemaValidator.date;
|
|
40
|
-
/**
|
|
41
|
-
* TypeBox schema definition for symbol type.
|
|
42
|
-
*/
|
|
43
|
-
export const symbol = StaticSchemaValidator.symbol;
|
|
44
|
-
/**
|
|
45
|
-
* TypeBox schema definition for undefined, null, void types.
|
|
46
|
-
*/
|
|
47
|
-
export const nullish = StaticSchemaValidator.nullish;
|
|
48
|
-
/**
|
|
49
|
-
* TypeBox schema definition for any type.
|
|
50
|
-
*/
|
|
51
|
-
export const any = StaticSchemaValidator.any;
|
|
52
|
-
/**
|
|
53
|
-
* TypeBox schema definition for unknown type.
|
|
54
|
-
*/
|
|
55
|
-
export const unknown = StaticSchemaValidator.unknown;
|
|
56
|
-
/**
|
|
57
|
-
* TypeBox schema definition for never type.
|
|
58
|
-
*/
|
|
59
|
-
export const never = StaticSchemaValidator.never;
|
|
60
|
-
/**
|
|
61
|
-
* Transforms valid schema into TypeBox schema.
|
|
62
|
-
*/
|
|
63
|
-
export const schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
64
|
-
/**
|
|
65
|
-
* Makes a valid schema optional.
|
|
66
|
-
*/
|
|
67
|
-
export const optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
68
|
-
/**
|
|
69
|
-
* Defines an array for a valid schema.
|
|
70
|
-
*/
|
|
71
|
-
export const array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
72
|
-
/**
|
|
73
|
-
* Defines a union for a valid schema.
|
|
74
|
-
*/
|
|
75
|
-
export const union = StaticSchemaValidator.union.bind(StaticSchemaValidator);
|
|
76
|
-
/**
|
|
77
|
-
* Defines a literal for a valid schema.
|
|
78
|
-
*/
|
|
79
|
-
export const literal = StaticSchemaValidator.literal.bind(StaticSchemaValidator);
|
|
80
|
-
/**
|
|
81
|
-
* Defines an enum for a valid schema.
|
|
82
|
-
*/
|
|
83
|
-
export const enum_ = StaticSchemaValidator.enum_.bind(StaticSchemaValidator);
|
|
84
|
-
/**
|
|
85
|
-
* Checks if a value is a TypeBox schema.
|
|
86
|
-
*/
|
|
87
|
-
export const isSchema = StaticSchemaValidator.isSchema.bind(StaticSchemaValidator);
|
|
88
|
-
/**
|
|
89
|
-
* Validates a value against a valid schema.
|
|
90
|
-
*/
|
|
91
|
-
export const validate = StaticSchemaValidator.validate.bind(StaticSchemaValidator);
|
|
92
|
-
/**
|
|
93
|
-
* Parses a value against a valid schema.
|
|
94
|
-
*/
|
|
95
|
-
export const parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
|
|
96
|
-
/**
|
|
97
|
-
* Generates an OpenAPI schema object from a valid schema.
|
|
98
|
-
*/
|
|
99
|
-
export const openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides a TypeScript-based schema definition using the TypeBox library.
|
|
3
|
-
* It includes various types, schema creation, validation, and OpenAPI integration.
|
|
4
|
-
*
|
|
5
|
-
* @module TypeboxSchemaValidator
|
|
6
|
-
*/
|
|
7
|
-
import { TArray, TKind, TLiteral, TOptional, TProperties, TSchema, TUnion } from '@sinclair/typebox';
|
|
8
|
-
import { TypeCheck } from '@sinclair/typebox/compiler';
|
|
9
|
-
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
10
|
-
import { LiteralSchema, ParseResult, SchemaValidator as SV } from '../shared/types/schema.types';
|
|
11
|
-
import { TIdiomaticSchema, TObject, TResolve, TUnionContainer, UnionTResolve } from './types/schema.types';
|
|
12
|
-
/**
|
|
13
|
-
* Class representing a TypeBox schema definition.
|
|
14
|
-
* @implements {SchemaValidator}
|
|
15
|
-
*/
|
|
16
|
-
export declare class TypeboxSchemaValidator implements SV<(<T extends TObject<TProperties>>(schema: T) => TypeCheck<T>), <T extends TIdiomaticSchema>(schema: T) => TResolve<T>, <T extends TIdiomaticSchema>(schema: T) => TOptional<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => TArray<TResolve<T>>, <T extends TUnionContainer>(schemas: [...T]) => TUnion<UnionTResolve<T>>, <T extends LiteralSchema>(value: T) => TLiteral<T>, <T extends LiteralSchema>(schemaEnum: Record<string, T>) => TUnion<UnionTResolve<T[]>>, (value: unknown) => value is TSchema, <T extends TIdiomaticSchema>(schema: T, value: unknown) => boolean, <T extends TIdiomaticSchema>(schema: T, value: unknown) => ParseResult<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => SchemaObject> {
|
|
17
|
-
_Type: 'TypeBox';
|
|
18
|
-
_SchemaCatchall: TKind;
|
|
19
|
-
_ValidSchemaObject: TObject<TProperties> | TArray<TObject<TProperties>>;
|
|
20
|
-
string: import("@sinclair/typebox").TString;
|
|
21
|
-
uuid: import("@sinclair/typebox").TString;
|
|
22
|
-
uri: import("@sinclair/typebox").TString;
|
|
23
|
-
email: import("@sinclair/typebox").TString;
|
|
24
|
-
number: import("@sinclair/typebox").TTransform<TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TDate, import("@sinclair/typebox").TBigInt]>, number>;
|
|
25
|
-
bigint: import("@sinclair/typebox").TTransform<TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TDate]>, bigint>;
|
|
26
|
-
boolean: import("@sinclair/typebox").TTransform<TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TString]>, boolean | undefined>;
|
|
27
|
-
date: import("@sinclair/typebox").TTransform<TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>, Date>;
|
|
28
|
-
symbol: import("@sinclair/typebox").TSymbol;
|
|
29
|
-
nullish: TUnion<[import("@sinclair/typebox").TVoid, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TUndefined]>;
|
|
30
|
-
any: import("@sinclair/typebox").TAny;
|
|
31
|
-
unknown: import("@sinclair/typebox").TUnknown;
|
|
32
|
-
never: import("@sinclair/typebox").TNever;
|
|
33
|
-
/**
|
|
34
|
-
* Extracts the error type of a schema for error messages.
|
|
35
|
-
*
|
|
36
|
-
* @param {TCatchall} schema - A schema that contains some type information.
|
|
37
|
-
* @returns The type of the schema for error messages.
|
|
38
|
-
*/
|
|
39
|
-
private errorType;
|
|
40
|
-
/**
|
|
41
|
-
* Pretty print TypeBox errors.
|
|
42
|
-
*
|
|
43
|
-
* @param {ValueError[]} errors
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
private prettyPrintTypeBoxErrors;
|
|
47
|
-
/**
|
|
48
|
-
* Compiles schema if this exists, for optimal performance.
|
|
49
|
-
*
|
|
50
|
-
* @param {TObject<TProperties>} schema - The schema to compile.
|
|
51
|
-
* @returns {TypeCheck<T>} - The compiled schema.
|
|
52
|
-
*/
|
|
53
|
-
compile<T extends TObject<TProperties>>(schema: T): TypeCheck<T>;
|
|
54
|
-
/**
|
|
55
|
-
* Convert a schema to a TypeBox schema.
|
|
56
|
-
* @param {TIdiomaticSchema} schema - The schema to convert.
|
|
57
|
-
* @returns {TResolve<T>} The resolved schema.
|
|
58
|
-
*/
|
|
59
|
-
schemify<T extends TIdiomaticSchema>(schema: T): TResolve<T>;
|
|
60
|
-
/**
|
|
61
|
-
* Make a schema optional.
|
|
62
|
-
* @param {TIdiomaticSchema} schema - The schema to make optional.
|
|
63
|
-
* @returns {TOptional<TResolve<T>>} The optional schema.
|
|
64
|
-
*/
|
|
65
|
-
optional<T extends TIdiomaticSchema>(schema: T): TOptional<TResolve<T>>;
|
|
66
|
-
/**
|
|
67
|
-
* Create an array schema.
|
|
68
|
-
* @param {TIdiomaticSchema} schema - The schema to use for array items.
|
|
69
|
-
* @returns {TArray<TResolve<T>>} The array schema.
|
|
70
|
-
*/
|
|
71
|
-
array<T extends TIdiomaticSchema>(schema: T): TArray<TResolve<T>>;
|
|
72
|
-
/**
|
|
73
|
-
* Create a union schema.
|
|
74
|
-
* @param {TUnionContainer} schemas - The schemas to union.
|
|
75
|
-
* @returns {TUnion<UnionTResolve<T>>} The union schema.
|
|
76
|
-
*
|
|
77
|
-
* WARNING: If "nullish" or TUndefined is included in the union, the key will still be expected.
|
|
78
|
-
* This is a limitation of TypeBox. Consider using "optional" instead.
|
|
79
|
-
*/
|
|
80
|
-
union<T extends TUnionContainer>(schemas: [...T]): TUnion<UnionTResolve<T>>;
|
|
81
|
-
/**
|
|
82
|
-
* Create a literal schema.
|
|
83
|
-
* @param {LiteralSchema} value - The literal value.
|
|
84
|
-
* @returns {TLiteral<T>} The literal schema.
|
|
85
|
-
*/
|
|
86
|
-
literal<T extends LiteralSchema>(value: T): TLiteral<T>;
|
|
87
|
-
/**
|
|
88
|
-
* Create an enum schema.
|
|
89
|
-
* @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
|
|
90
|
-
* @returns {TUnion<UnionTResolve<T[]>>} The enum schema.
|
|
91
|
-
*/
|
|
92
|
-
enum_<T extends LiteralSchema>(schemaEnum: Record<string, T>): TUnion<UnionTResolve<T[]>>;
|
|
93
|
-
/**
|
|
94
|
-
* Check if a value is a TypeBox object schema.
|
|
95
|
-
* @param {unknown} value - The value to check.
|
|
96
|
-
* @returns {boolean} True if the value is a TypeBox object schema.
|
|
97
|
-
*/
|
|
98
|
-
isSchema(value: unknown): value is TSchema;
|
|
99
|
-
/**
|
|
100
|
-
* Validate a value against a schema.
|
|
101
|
-
*
|
|
102
|
-
* @param {TSchema} schema - The schema to validate against.
|
|
103
|
-
* @param {unknown} value - The value to validate.
|
|
104
|
-
* @returns {boolean} True if valid, otherwise false.
|
|
105
|
-
*/
|
|
106
|
-
validate<T extends TIdiomaticSchema | TSchema>(schema: T | TypeCheck<TResolve<T>>, value: unknown): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Parse a value against a schema.
|
|
109
|
-
*
|
|
110
|
-
* @param {TSchema} schema - The schema to validate against.
|
|
111
|
-
* @param {unknown} value - The value to validate.
|
|
112
|
-
* @returns {ParseResult<TResolve<T>>} The parsing result.
|
|
113
|
-
*/
|
|
114
|
-
parse<T extends TIdiomaticSchema | TSchema>(schema: T | TypeCheck<TResolve<T>>, value: unknown): ParseResult<TResolve<T>>;
|
|
115
|
-
/**
|
|
116
|
-
* Convert a schema to an OpenAPI schema object.
|
|
117
|
-
* @param {TIdiomaticSchema | TSchema} schema - The schema to convert.
|
|
118
|
-
* @returns {SchemaObject} The OpenAPI schema object.
|
|
119
|
-
*/
|
|
120
|
-
openapi<T extends TIdiomaticSchema | TSchema>(schema: T): SchemaObject;
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=typeboxSchemaValidator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeboxSchemaValidator.d.ts","sourceRoot":"","sources":["../../../src/typebox/typeboxSchemaValidator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,MAAM,EAEP,MAAM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