@cleverbrush/schema 0.0.16 → 1.0.0-beta.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.
Files changed (75) hide show
  1. package/README.md +224 -149
  2. package/dist/builders/AliasSchemaBuilder.d.ts +14 -0
  3. package/dist/builders/AliasSchemaBuilder.js +91 -0
  4. package/dist/builders/ArraySchemaBuilder.d.ts +15 -0
  5. package/dist/builders/ArraySchemaBuilder.js +141 -0
  6. package/dist/builders/BooleanSchemaBuilder.d.ts +31 -0
  7. package/dist/builders/BooleanSchemaBuilder.js +90 -0
  8. package/dist/builders/FunctionSchemaBuilder.d.ts +25 -0
  9. package/dist/builders/FunctionSchemaBuilder.js +66 -0
  10. package/dist/builders/NumberSchemaBuilder.d.ts +61 -0
  11. package/dist/builders/NumberSchemaBuilder.js +206 -0
  12. package/dist/builders/ObjectSchemaBuilder.d.ts +83 -0
  13. package/dist/builders/ObjectSchemaBuilder.js +344 -0
  14. package/dist/builders/SchemaBuilder.d.ts +36 -0
  15. package/dist/builders/SchemaBuilder.js +88 -0
  16. package/dist/builders/StringSchemaBuilder.d.ts +14 -0
  17. package/dist/builders/StringSchemaBuilder.js +140 -0
  18. package/dist/builders/UnionSchemaBuilder.d.ts +10 -0
  19. package/dist/builders/UnionSchemaBuilder.js +100 -0
  20. package/dist/defaultSchemas.d.ts +4 -0
  21. package/dist/defaultSchemas.js +45 -0
  22. package/dist/index.d.ts +38 -90
  23. package/dist/index.js +30 -4
  24. package/dist/schema.d.ts +242 -0
  25. package/dist/schema.js +2 -0
  26. package/dist/schemaRegistry.d.ts +54 -0
  27. package/dist/schemaRegistry.js +301 -0
  28. package/dist/validators/validateArray.d.ts +3 -2
  29. package/dist/validators/validateBoolean.d.ts +2 -2
  30. package/dist/validators/validateBoolean.js +1 -4
  31. package/dist/validators/validateFunction.d.ts +2 -0
  32. package/dist/validators/validateFunction.js +21 -0
  33. package/dist/validators/validateNumber.d.ts +2 -2
  34. package/dist/validators/validateNumber.js +1 -1
  35. package/dist/validators/validateObject.d.ts +3 -2
  36. package/dist/validators/validateObject.js +33 -11
  37. package/dist/validators/validateString.d.ts +2 -2
  38. package/dist/validators/validateString.js +1 -1
  39. package/dist/validators/validateUnion.d.ts +3 -0
  40. package/dist/validators/validateUnion.js +30 -0
  41. package/package.json +3 -3
  42. package/src/builders/AliasSchemaBuilder.test.ts +124 -0
  43. package/src/builders/AliasSchemaBuilder.ts +250 -0
  44. package/src/builders/ArraySchemaBuilder.test.ts +270 -0
  45. package/src/builders/ArraySchemaBuilder.ts +381 -0
  46. package/src/builders/BooleanSchemaBuilder.test.ts +196 -0
  47. package/src/builders/BooleanSchemaBuilder.ts +155 -0
  48. package/src/builders/FunctionSchemaBuilder.test.ts +134 -0
  49. package/src/builders/FunctionSchemaBuilder.ts +109 -0
  50. package/src/builders/NumberSchemaBuilder.test.ts +493 -0
  51. package/src/builders/NumberSchemaBuilder.ts +789 -0
  52. package/src/builders/ObjectSchemaBuilder.test.ts +657 -0
  53. package/src/builders/ObjectSchemaBuilder.ts +794 -0
  54. package/src/builders/SchemaBuilder.test.ts +73 -0
  55. package/src/builders/SchemaBuilder.ts +135 -0
  56. package/src/builders/StringSchemaBuilder.test.ts +318 -0
  57. package/src/builders/StringSchemaBuilder.ts +392 -0
  58. package/src/builders/UnionSchemaBuilder.test.ts +162 -0
  59. package/src/builders/UnionSchemaBuilder.ts +159 -0
  60. package/src/defaultSchemas.ts +44 -0
  61. package/src/index.ts +70 -190
  62. package/src/schema.ts +922 -0
  63. package/src/schemaRegistry.builders.test.ts +1438 -0
  64. package/src/{schemaValidator.test.ts → schemaRegistry.test.ts} +561 -185
  65. package/src/schemaRegistry.ts +532 -0
  66. package/src/validators/validateArray.ts +4 -7
  67. package/src/validators/validateBoolean.ts +2 -11
  68. package/src/validators/validateFunction.ts +25 -0
  69. package/src/validators/validateNumber.ts +2 -7
  70. package/src/validators/validateObject.ts +32 -21
  71. package/src/validators/validateString.ts +2 -7
  72. package/src/validators/validateUnion.ts +36 -0
  73. package/dist/schemaValidator.d.ts +0 -16
  74. package/dist/schemaValidator.js +0 -234
  75. package/src/schemaValidator.ts +0 -367
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.string = void 0;
4
+ const SchemaBuilder_js_1 = require("./SchemaBuilder.js");
5
+ const defaultSchemas_js_1 = require("../defaultSchemas.js");
6
+ class StringSchemaBuilder extends SchemaBuilder_js_1.SchemaBuilder {
7
+ _minLength;
8
+ _maxLength;
9
+ _equals;
10
+ type = 'string';
11
+ clone() {
12
+ return StringSchemaBuilder.create(this._schema);
13
+ }
14
+ get _schema() {
15
+ return Object.assign({
16
+ type: this.type
17
+ }, this.getCommonSchema(), typeof this._minLength !== 'undefined'
18
+ ? { minLength: this._minLength }
19
+ : {}, typeof this._maxLength !== 'undefined'
20
+ ? { maxLength: this._maxLength }
21
+ : {}, typeof this._equals !== 'undefined' ? { equals: this._equals } : {});
22
+ }
23
+ optional() {
24
+ if (this.isRequired === false) {
25
+ return this;
26
+ }
27
+ return StringSchemaBuilder.create({
28
+ ...this._schema,
29
+ isRequired: false
30
+ });
31
+ }
32
+ required() {
33
+ if (this.isRequired === true) {
34
+ return this;
35
+ }
36
+ return StringSchemaBuilder.create({
37
+ ...this._schema,
38
+ isRequired: true
39
+ });
40
+ }
41
+ nullable() {
42
+ if (this.isNullable === true) {
43
+ return this;
44
+ }
45
+ return StringSchemaBuilder.create({
46
+ ...this._schema,
47
+ isNullable: true
48
+ });
49
+ }
50
+ notNullable() {
51
+ if (this.isNullable === false) {
52
+ return this;
53
+ }
54
+ return StringSchemaBuilder.create({
55
+ ...this._schema,
56
+ isNullable: false
57
+ });
58
+ }
59
+ minLength(val) {
60
+ if (this._minLength === val) {
61
+ return this;
62
+ }
63
+ return StringSchemaBuilder.create({
64
+ ...this._schema,
65
+ minLength: val
66
+ });
67
+ }
68
+ clearMinLength() {
69
+ if (typeof this._minLength === 'undefined') {
70
+ return this;
71
+ }
72
+ return StringSchemaBuilder.create({
73
+ ...this._schema,
74
+ minLength: undefined
75
+ });
76
+ }
77
+ maxLength(val) {
78
+ if (this._maxLength === val) {
79
+ return this;
80
+ }
81
+ return StringSchemaBuilder.create({
82
+ ...this._schema,
83
+ maxLength: val
84
+ });
85
+ }
86
+ clearMaxLength() {
87
+ if (typeof this._maxLength === 'undefined') {
88
+ return this;
89
+ }
90
+ return StringSchemaBuilder.create({
91
+ ...this._schema,
92
+ maxLength: undefined
93
+ });
94
+ }
95
+ equals(val) {
96
+ if (this._equals === val) {
97
+ return this;
98
+ }
99
+ return StringSchemaBuilder.create({
100
+ ...this._schema,
101
+ equals: val
102
+ });
103
+ }
104
+ clearEquals() {
105
+ if (typeof this._equals === 'undefined') {
106
+ return this;
107
+ }
108
+ return StringSchemaBuilder.create({
109
+ ...this._schema,
110
+ equals: undefined
111
+ });
112
+ }
113
+ static create(obj) {
114
+ return new StringSchemaBuilder(obj);
115
+ }
116
+ constructor(obj) {
117
+ super(obj);
118
+ if (typeof obj === 'object' && obj) {
119
+ if (typeof obj.minLength !== 'undefined') {
120
+ this._minLength = obj.minLength;
121
+ }
122
+ if (typeof obj.maxLength !== 'undefined') {
123
+ this._maxLength = obj.maxLength;
124
+ }
125
+ if (typeof obj.equals !== 'undefined') {
126
+ this._equals = obj.equals;
127
+ }
128
+ }
129
+ else {
130
+ const defaultSchema = defaultSchemas_js_1.defaultSchemas['string'];
131
+ this.isRequired = defaultSchema.isRequired;
132
+ this.isNullable = defaultSchema.isNullable;
133
+ }
134
+ }
135
+ }
136
+ const string = (equals) => {
137
+ const res = StringSchemaBuilder.create();
138
+ return typeof equals === 'string' ? res.equals(equals) : res;
139
+ };
140
+ exports.string = string;
@@ -0,0 +1,10 @@
1
+ import { ISchemaBuilder } from './SchemaBuilder.js';
2
+ export interface IUnionSchemaBuilder<TRequired extends boolean = true, TNullable extends boolean = false, TVariants extends any[] = []> extends ISchemaBuilder<TRequired, TNullable> {
3
+ optional(): IUnionSchemaBuilder<false, TNullable, TVariants>;
4
+ required(): IUnionSchemaBuilder<true, TNullable, TVariants>;
5
+ nullable(): IUnionSchemaBuilder<TRequired, true, TVariants>;
6
+ notNullable(): IUnionSchemaBuilder<TRequired, false, TVariants>;
7
+ or<T>(schema: T): IUnionSchemaBuilder<TRequired, TNullable, [...TVariants, T]>;
8
+ clearVariants(): IUnionSchemaBuilder<TRequired, TNullable, []>;
9
+ }
10
+ export declare const union: <T extends ISchemaBuilder<true, false>, K extends T[], TRequired extends boolean = true, TNullable extends boolean = false>(...schemas: K) => IUnionSchemaBuilder<TRequired, TNullable, K>;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.union = void 0;
4
+ const SchemaBuilder_js_1 = require("./SchemaBuilder.js");
5
+ class UnionSchemaBuilder extends SchemaBuilder_js_1.SchemaBuilder {
6
+ type = 'union';
7
+ get _schema() {
8
+ return Object.assign({
9
+ type: this.type
10
+ }, this.getCommonSchema(), {
11
+ variants: this._variants.map((variant) => {
12
+ if (variant instanceof SchemaBuilder_js_1.SchemaBuilder) {
13
+ return variant._schema;
14
+ }
15
+ return JSON.parse(JSON.stringify(variant));
16
+ })
17
+ });
18
+ }
19
+ clone() {
20
+ return UnionSchemaBuilder.create(this._schema);
21
+ }
22
+ _variants;
23
+ static create(obj) {
24
+ return new UnionSchemaBuilder(obj);
25
+ }
26
+ constructor(obj) {
27
+ super(obj);
28
+ this._variants = [];
29
+ if (Array.isArray(obj.variants)) {
30
+ for (let i = 0; i < obj.variants.length; i++) {
31
+ this._variants.push(obj.variants[i]);
32
+ }
33
+ }
34
+ }
35
+ optional() {
36
+ if (this.isRequired === false) {
37
+ return this;
38
+ }
39
+ return UnionSchemaBuilder.create({
40
+ ...this._schema,
41
+ isRequired: false
42
+ });
43
+ }
44
+ required() {
45
+ if (this.isRequired === true) {
46
+ return this;
47
+ }
48
+ return UnionSchemaBuilder.create({
49
+ ...this._schema,
50
+ isRequired: true
51
+ });
52
+ }
53
+ nullable() {
54
+ if (this.isNullable === true) {
55
+ return this;
56
+ }
57
+ return UnionSchemaBuilder.create({
58
+ ...this._schema,
59
+ isNullable: true
60
+ });
61
+ }
62
+ notNullable() {
63
+ if (this.isNullable === false) {
64
+ return this;
65
+ }
66
+ return UnionSchemaBuilder.create({
67
+ ...this._schema,
68
+ isNullable: false
69
+ });
70
+ }
71
+ or(schema) {
72
+ return UnionSchemaBuilder.create({
73
+ ...this._schema,
74
+ variants: [...this._variants, schema]
75
+ });
76
+ }
77
+ clearVariants() {
78
+ if (this._variants.length === 0)
79
+ return this;
80
+ return UnionSchemaBuilder.create({
81
+ ...this._schema,
82
+ variants: []
83
+ });
84
+ }
85
+ }
86
+ const union = (...schemas) => {
87
+ if (schemas.length < 1) {
88
+ throw new Error('should provide at least one variant');
89
+ }
90
+ let res = UnionSchemaBuilder.create({
91
+ isRequired: true,
92
+ isNullable: false,
93
+ variants: [schemas[0]]
94
+ });
95
+ for (let i = 1; i < schemas.length; i++) {
96
+ res = res.or(schemas[i]);
97
+ }
98
+ return res;
99
+ };
100
+ exports.union = union;
@@ -0,0 +1,4 @@
1
+ import { DefaultSchemaType, Schema } from './schema.js';
2
+ export declare const defaultSchemas: {
3
+ [key in DefaultSchemaType]?: Schema;
4
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultSchemas = void 0;
4
+ exports.defaultSchemas = {
5
+ alias: {
6
+ type: 'alias',
7
+ // TODO: remove
8
+ schemaName: '',
9
+ isRequired: true,
10
+ isNullable: false
11
+ },
12
+ number: {
13
+ type: 'number',
14
+ isRequired: true,
15
+ isNullable: false,
16
+ ensureNotNaN: true,
17
+ ensureIsFinite: true
18
+ },
19
+ boolean: {
20
+ type: 'boolean',
21
+ isRequired: true,
22
+ isNullable: false
23
+ },
24
+ string: {
25
+ type: 'string',
26
+ isRequired: true,
27
+ isNullable: false
28
+ },
29
+ array: {
30
+ type: 'array',
31
+ isRequired: true,
32
+ isNullable: false
33
+ },
34
+ object: {
35
+ type: 'object',
36
+ noUnknownProperties: true,
37
+ isNullable: false,
38
+ isRequired: true
39
+ },
40
+ function: {
41
+ type: 'function',
42
+ isRequired: true,
43
+ isNullable: false
44
+ }
45
+ };
package/dist/index.d.ts CHANGED
@@ -1,94 +1,42 @@
1
- import { Merge } from '@cleverbrush/deep';
2
- import SchemaValidator from './schemaValidator';
3
- export declare type DefaultSchemaType = 'object' | 'boolean' | 'function' | 'number' | 'string' | 'array' | 'alias';
4
- export declare type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
5
- export declare type DefaultPropertyDefinition = {
6
- isRequired: boolean;
7
- isNullable: boolean;
1
+ import { InferType, ExpandSchemaBuilder, ValidationResultWithObject } from './schema.js';
2
+ import SchemaRegistry from './schemaRegistry.js';
3
+ import { alias } from './builders/AliasSchemaBuilder.js';
4
+ import { array } from './builders/ArraySchemaBuilder.js';
5
+ import { boolean } from './builders/BooleanSchemaBuilder.js';
6
+ import { number } from './builders/NumberSchemaBuilder.js';
7
+ import { object } from './builders/ObjectSchemaBuilder.js';
8
+ import { string } from './builders/StringSchemaBuilder.js';
9
+ import { union } from './builders/UnionSchemaBuilder.js';
10
+ import { func } from './builders/FunctionSchemaBuilder.js';
11
+ export declare type GetNodes<T extends Record<string, any>, TPrefix extends string = ''> = {
12
+ [k in keyof T]: k extends `${TPrefix}${infer F}.${infer S}` ? F : never;
13
+ }[keyof T];
14
+ export declare type GetLeafs<T extends Record<string, any>, TPrefix extends string = ''> = {
15
+ [k in keyof T]: k extends `${TPrefix}${infer F}` ? F extends `${infer S}.${infer G}` ? never : F : never;
16
+ }[keyof T];
17
+ export declare type Unfold<TBag extends Record<string, any>, TPrefix extends string = ''> = {
18
+ [k in GetLeafs<TBag, TPrefix>]: ISchemaActions<TBag[`${TPrefix}${k}`]>;
19
+ } & {
20
+ [k in GetNodes<TBag, TPrefix>]: Unfold<TBag, `${TPrefix}${k}.`>;
8
21
  };
9
- export declare type ValidationResultRaw = {
10
- valid: boolean;
11
- errors?: Array<string>;
12
- };
13
- export declare type ValidationResult = ValidationResultRaw | Promise<ValidationResultRaw>;
14
- export declare type Validator<TObj> = (value: TObj) => ValidationResult;
15
- export declare type SchemaDefintion<TObj> = {
16
- type: DefaultSchemaType;
17
- isRequired?: boolean;
18
- isNullable?: boolean;
19
- validators?: Array<Validator<TObj>>;
20
- };
21
- export declare type ObjectSchemaDefinition<T> = Omit<SchemaDefintion<T>, 'type'> & {
22
- type: 'object';
23
- extends?: string;
24
- properties?: Partial<{
25
- [S in keyof T]: Schema<PropType<T, S>>;
26
- }>;
27
- preprocessors?: Partial<{
28
- [S in keyof T | '*']: S extends keyof T ? ((value: unknown) => undefined | PropType<T, S> | Promise<PropType<T, S>>) | string : (value: T) => void | Promise<void>;
29
- }>;
30
- };
31
- export declare type AliasSchemaDefinition<T> = Omit<SchemaDefintion<T>, 'type'> & {
32
- type: 'alias';
33
- schemaName: string;
34
- };
35
- export declare type ObjectSchemaDefinitionParam<T> = Omit<ObjectSchemaDefinition<T>, 'type'>;
36
- export declare type ParamsValidators<TFunc extends (...args: any) => any> = {
37
- [S in keyof Parameters<TFunc>]: SingleSchema<Parameters<TFunc>[S]>;
38
- };
39
- export declare type FunctionSchemaDefinition<T extends (...args: any) => any> = Omit<SchemaDefintion<T>, 'type'> & {
40
- type: 'function';
41
- params?: ParamsValidators<T>;
42
- };
43
- export declare type BooleanSchemaDefinition<TObj> = Omit<SchemaDefintion<TObj>, 'type'> & {
44
- type: 'boolean';
45
- equals?: boolean;
46
- };
47
- export declare type NumberSchemaDefinition<TObj> = Omit<SchemaDefintion<TObj>, 'type'> & {
48
- type: 'number';
49
- min?: number;
50
- max?: number;
51
- equals?: number;
52
- isInteger?: boolean;
53
- ensureNotNaN?: boolean;
54
- ensureIsFinite?: boolean;
55
- };
56
- export declare type StringSchemaDefinition<TObj> = Omit<SchemaDefintion<TObj>, 'type'> & {
57
- type: 'string';
58
- equals?: string;
59
- minLength?: number;
60
- maxLength?: number;
61
- };
62
- export declare type ArraySchemaDefinition<TObj> = Omit<SchemaDefintion<TObj>, 'type'> & {
63
- type: 'array';
64
- preprocessor?: ((value: unknown) => unknown | Promise<unknown>) | string;
65
- ofType?: Schema<any>;
66
- minLength?: number;
67
- maxLength?: number;
68
- };
69
- export declare type CompositeSchema<TObj> = TObj extends (...args: any) => any ? FunctionSchemaDefinition<TObj> : TObj extends number ? NumberSchemaDefinition<TObj> : TObj extends string ? StringSchemaDefinition<TObj> | 'string' : BooleanSchemaDefinition<TObj> | NumberSchemaDefinition<TObj> | StringSchemaDefinition<TObj> | ArraySchemaDefinition<TObj> | ObjectSchemaDefinition<TObj> | AliasSchemaDefinition<TObj>;
70
- export declare type SingleSchema<TObj = Record<string, never>> = number | string | DefaultSchemaType | CompositeSchema<TObj>;
71
- export declare type Schema<TObj> = SingleSchema<TObj> | Array<SingleSchema<TObj>>;
72
- export declare type Cons<H, T extends unknown[] = []> = T['length'] extends 0 ? [H] : ((h: H, ...t: T) => void) extends (...r: infer R) => void ? R : never;
73
22
  export interface ISchemaActions<S> {
74
- validate(value: any): Promise<ValidationResult>;
75
- schema: S;
76
- }
77
- export interface ISchemasProvider<T extends unknown[]> {
78
- schemas: Merge<T>;
23
+ validate(value: any): Promise<ValidationResultWithObject<InferType<ExpandSchemaBuilder<S>>>>;
24
+ schema: ExpandSchemaBuilder<S>;
79
25
  }
80
- export interface ISchemaValidator<T extends Record<string, never> = Record<string, never>, SchemaTypesStructures extends unknown[] = []> {
81
- get preprocessors(): Map<string, (value: unknown) => unknown | Promise<unknown>>;
82
- addPreprocessor(name: string, preprocessor: (value: unknown) => unknown | Promise<unknown>): SchemaValidator<T, SchemaTypesStructures>;
83
- addSchemaType<K, L extends ObjectSchemaDefinitionParam<M> | Array<Schema<any>>, M = any>(name: keyof K, schema: L): SchemaValidator<T & {
84
- [key in keyof K]: typeof schema;
85
- }, Cons<Unfold<keyof K, ISchemaActions<L>>, SchemaTypesStructures>>;
86
- validate(schema: keyof T | DefaultSchemaType | Schema<any>, obj: any): Promise<ValidationResult>;
26
+ export interface ISchemaRegistry<T extends Record<string, any>> {
27
+ schemas: Unfold<T>;
87
28
  }
88
- export declare type Unfold<T, K> = T extends string ? T extends `${infer F}.${infer L}` ? {
89
- [k in F]: Unfold<L, K>;
90
- } : {
91
- [k in T]: K;
92
- } : never;
93
- export { SchemaValidator };
94
- export default SchemaValidator;
29
+ export { SchemaRegistry };
30
+ declare const _default: {
31
+ SchemaRegistry: typeof SchemaRegistry;
32
+ alias: <TSchemaName extends keyof TAliases, TAliases extends Record<string, any>, TAliasesCompiledType = InferType<TAliases[TSchemaName]>>(schemaName: TSchemaName) => import("./builders/AliasSchemaBuilder.js").IAliasSchemaBuilder<TSchemaName, true, false, TAliases, TAliasesCompiledType, {}>;
33
+ array: () => import("./builders/ArraySchemaBuilder.js").IArraySchemaBuilder<true, false, undefined, undefined, undefined>;
34
+ boolean: () => import("./builders/BooleanSchemaBuilder.js").IBooleanSchemaBuilder<true, false, undefined>;
35
+ number: () => import("./builders/NumberSchemaBuilder.js").INumberSchemaBuilder<true, false, undefined, undefined, undefined, true, true, undefined>;
36
+ object: <T>(properties?: T) => import("./builders/ObjectSchemaBuilder.js").IObjectSchemaBuilder<true, false, true, T extends undefined ? {} : T, undefined>;
37
+ string: <T_1 extends string = undefined>(equals?: T_1) => import("./builders/StringSchemaBuilder.js").IStringSchemaBuilder<true, false, undefined, undefined, T_1 extends undefined ? undefined : T_1>;
38
+ union: <T_2 extends import("./builders/SchemaBuilder.js").ISchemaBuilder<true, false>, K extends T_2[], TRequired extends boolean = true, TNullable extends boolean = false>(...schemas: K) => import("./builders/UnionSchemaBuilder.js").IUnionSchemaBuilder<TRequired, TNullable, K>;
39
+ func: () => import("./builders/FunctionSchemaBuilder.js").IFunctionSchemaBuilder<true, false>;
40
+ };
41
+ export default _default;
42
+ export { alias, array, boolean, number, object, string, union, func, InferType };
package/dist/index.js CHANGED
@@ -3,7 +3,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SchemaValidator = void 0;
7
- const schemaValidator_1 = __importDefault(require("./schemaValidator"));
8
- exports.SchemaValidator = schemaValidator_1.default;
9
- exports.default = schemaValidator_1.default;
6
+ exports.func = exports.union = exports.string = exports.object = exports.number = exports.boolean = exports.array = exports.alias = exports.SchemaRegistry = void 0;
7
+ const schemaRegistry_js_1 = __importDefault(require("./schemaRegistry.js"));
8
+ exports.SchemaRegistry = schemaRegistry_js_1.default;
9
+ const AliasSchemaBuilder_js_1 = require("./builders/AliasSchemaBuilder.js");
10
+ Object.defineProperty(exports, "alias", { enumerable: true, get: function () { return AliasSchemaBuilder_js_1.alias; } });
11
+ const ArraySchemaBuilder_js_1 = require("./builders/ArraySchemaBuilder.js");
12
+ Object.defineProperty(exports, "array", { enumerable: true, get: function () { return ArraySchemaBuilder_js_1.array; } });
13
+ const BooleanSchemaBuilder_js_1 = require("./builders/BooleanSchemaBuilder.js");
14
+ Object.defineProperty(exports, "boolean", { enumerable: true, get: function () { return BooleanSchemaBuilder_js_1.boolean; } });
15
+ const NumberSchemaBuilder_js_1 = require("./builders/NumberSchemaBuilder.js");
16
+ Object.defineProperty(exports, "number", { enumerable: true, get: function () { return NumberSchemaBuilder_js_1.number; } });
17
+ const ObjectSchemaBuilder_js_1 = require("./builders/ObjectSchemaBuilder.js");
18
+ Object.defineProperty(exports, "object", { enumerable: true, get: function () { return ObjectSchemaBuilder_js_1.object; } });
19
+ const StringSchemaBuilder_js_1 = require("./builders/StringSchemaBuilder.js");
20
+ Object.defineProperty(exports, "string", { enumerable: true, get: function () { return StringSchemaBuilder_js_1.string; } });
21
+ const UnionSchemaBuilder_js_1 = require("./builders/UnionSchemaBuilder.js");
22
+ Object.defineProperty(exports, "union", { enumerable: true, get: function () { return UnionSchemaBuilder_js_1.union; } });
23
+ const FunctionSchemaBuilder_js_1 = require("./builders/FunctionSchemaBuilder.js");
24
+ Object.defineProperty(exports, "func", { enumerable: true, get: function () { return FunctionSchemaBuilder_js_1.func; } });
25
+ exports.default = {
26
+ SchemaRegistry: schemaRegistry_js_1.default,
27
+ alias: AliasSchemaBuilder_js_1.alias,
28
+ array: ArraySchemaBuilder_js_1.array,
29
+ boolean: BooleanSchemaBuilder_js_1.boolean,
30
+ number: NumberSchemaBuilder_js_1.number,
31
+ object: ObjectSchemaBuilder_js_1.object,
32
+ string: StringSchemaBuilder_js_1.string,
33
+ union: UnionSchemaBuilder_js_1.union,
34
+ func: FunctionSchemaBuilder_js_1.func
35
+ };