@forklaunch/validator 0.3.0 → 0.3.2

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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/lib/eslint.config.d.mts +3 -0
  3. package/lib/eslint.config.d.mts.map +1 -0
  4. package/lib/eslint.config.mjs +10 -0
  5. package/lib/index.d.ts +2 -0
  6. package/lib/index.d.ts.map +1 -0
  7. package/lib/index.js +1 -0
  8. package/lib/jest.config.d.ts +4 -0
  9. package/lib/jest.config.d.ts.map +1 -0
  10. package/lib/jest.config.js +21 -0
  11. package/{dist → lib/src/shared}/types/schema.types.d.ts +47 -7
  12. package/lib/src/shared/types/schema.types.d.ts.map +1 -0
  13. package/lib/src/typebox/index.d.ts +3 -0
  14. package/lib/src/typebox/index.d.ts.map +1 -0
  15. package/lib/src/typebox/index.js +1 -0
  16. package/lib/src/typebox/staticSchemaValidator.d.ts +93 -0
  17. package/lib/src/typebox/staticSchemaValidator.d.ts.map +1 -0
  18. package/lib/src/typebox/staticSchemaValidator.js +91 -0
  19. package/lib/src/typebox/typeboxSchemaValidator.d.ts +110 -0
  20. package/lib/src/typebox/typeboxSchemaValidator.d.ts.map +1 -0
  21. package/lib/src/typebox/typeboxSchemaValidator.js +343 -0
  22. package/{dist/typebox/types/typebox.schema.types.d.ts → lib/src/typebox/types/schema.types.d.ts} +9 -13
  23. package/lib/src/typebox/types/schema.types.d.ts.map +1 -0
  24. package/lib/src/zod/index.d.ts +3 -0
  25. package/lib/src/zod/index.d.ts.map +1 -0
  26. package/lib/src/zod/index.js +1 -0
  27. package/lib/src/zod/staticSchemaValidator.d.ts +93 -0
  28. package/lib/src/zod/staticSchemaValidator.d.ts.map +1 -0
  29. package/lib/src/zod/staticSchemaValidator.js +91 -0
  30. package/{dist/zod/types/zod.schema.types.d.ts → lib/src/zod/types/schema.types.d.ts} +3 -2
  31. package/lib/src/zod/types/schema.types.d.ts.map +1 -0
  32. package/lib/src/zod/types/schema.types.js +1 -0
  33. package/lib/src/zod/zodSchemaValidator.d.ts +98 -0
  34. package/lib/src/zod/zodSchemaValidator.d.ts.map +1 -0
  35. package/lib/src/zod/zodSchemaValidator.js +179 -0
  36. package/lib/tests/typebox/advancedParse.test.d.ts +2 -0
  37. package/lib/tests/typebox/advancedParse.test.d.ts.map +1 -0
  38. package/lib/tests/typebox/advancedParse.test.js +514 -0
  39. package/lib/tests/typebox/largeSchema.test.d.ts +2 -0
  40. package/lib/tests/typebox/largeSchema.test.d.ts.map +1 -0
  41. package/{dist → lib}/tests/typebox/largeSchema.test.js +46 -49
  42. package/lib/tests/typebox/schemaValidator.test.d.ts +2 -0
  43. package/lib/tests/typebox/schemaValidator.test.d.ts.map +1 -0
  44. package/lib/tests/typebox/schemaValidator.test.js +219 -0
  45. package/{dist/tests/typebox/equality.test.d.ts → lib/tests/typebox/typeEquality.test.d.ts} +1 -0
  46. package/lib/tests/typebox/typeEquality.test.d.ts.map +1 -0
  47. package/lib/tests/typebox/typeEquality.test.js +100 -0
  48. package/lib/tests/utils/compare.d.ts +2 -0
  49. package/lib/tests/utils/compare.d.ts.map +1 -0
  50. package/lib/tests/utils/compare.js +8 -0
  51. package/{dist/tests → lib/tests/utils}/mockSchemaValidator.d.ts +14 -8
  52. package/lib/tests/utils/mockSchemaValidator.d.ts.map +1 -0
  53. package/lib/tests/utils/mockSchemaValidator.js +72 -0
  54. package/lib/tests/zod/advancedParse.test.d.ts +2 -0
  55. package/lib/tests/zod/advancedParse.test.d.ts.map +1 -0
  56. package/lib/tests/zod/advancedParse.test.js +514 -0
  57. package/lib/tests/zod/largeSchema.test.d.ts +2 -0
  58. package/lib/tests/zod/largeSchema.test.d.ts.map +1 -0
  59. package/{dist → lib}/tests/zod/largeSchema.test.js +43 -46
  60. package/lib/tests/zod/schemaValidator.test.d.ts +2 -0
  61. package/lib/tests/zod/schemaValidator.test.d.ts.map +1 -0
  62. package/lib/tests/zod/schemaValidator.test.js +179 -0
  63. package/{dist/tests/zod/equality.test.d.ts → lib/tests/zod/typeEquality.test.d.ts} +1 -0
  64. package/lib/tests/zod/typeEquality.test.d.ts.map +1 -0
  65. package/lib/tests/zod/typeEquality.test.js +100 -0
  66. package/lib/tsconfig.tsbuildinfo +1 -0
  67. package/lib/vitest.config.d.ts +3 -0
  68. package/lib/vitest.config.d.ts.map +1 -0
  69. package/lib/vitest.config.js +7 -0
  70. package/package.json +35 -39
  71. package/dist/index.d.ts +0 -1
  72. package/dist/index.js +0 -18
  73. package/dist/index.js.map +0 -1
  74. package/dist/jest.config.d.ts +0 -3
  75. package/dist/jest.config.js +0 -10
  76. package/dist/jest.config.js.map +0 -1
  77. package/dist/tests/mockSchemaValidator.js +0 -60
  78. package/dist/tests/mockSchemaValidator.js.map +0 -1
  79. package/dist/tests/typebox/equality.test.js +0 -234
  80. package/dist/tests/typebox/equality.test.js.map +0 -1
  81. package/dist/tests/typebox/largeSchema.test.js.map +0 -1
  82. package/dist/tests/zod/equality.test.js +0 -238
  83. package/dist/tests/zod/equality.test.js.map +0 -1
  84. package/dist/tests/zod/largeSchema.test.js.map +0 -1
  85. package/dist/typebox/index.d.ts +0 -1
  86. package/dist/typebox/index.js +0 -18
  87. package/dist/typebox/index.js.map +0 -1
  88. package/dist/typebox/typebox.schemaValidator.d.ts +0 -150
  89. package/dist/typebox/typebox.schemaValidator.js +0 -203
  90. package/dist/typebox/typebox.schemaValidator.js.map +0 -1
  91. package/dist/typebox/types/typebox.schema.types.js +0 -3
  92. package/dist/typebox/types/typebox.schema.types.js.map +0 -1
  93. package/dist/types/index.d.ts +0 -1
  94. package/dist/types/index.js +0 -18
  95. package/dist/types/index.js.map +0 -1
  96. package/dist/types/schema.types.js +0 -3
  97. package/dist/types/schema.types.js.map +0 -1
  98. package/dist/zod/index.d.ts +0 -1
  99. package/dist/zod/index.js +0 -18
  100. package/dist/zod/index.js.map +0 -1
  101. package/dist/zod/types/zod.schema.types.js +0 -3
  102. package/dist/zod/types/zod.schema.types.js.map +0 -1
  103. package/dist/zod/zod.schemaValidator.d.ts +0 -147
  104. package/dist/zod/zod.schemaValidator.js +0 -196
  105. package/dist/zod/zod.schemaValidator.js.map +0 -1
  106. /package/{dist/tests/typebox/largeSchema.test.d.ts → lib/src/shared/types/schema.types.js} +0 -0
  107. /package/{dist/tests/zod/largeSchema.test.d.ts → lib/src/typebox/types/schema.types.js} +0 -0
@@ -1,150 +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, TLiteral, TOptional, TProperties, TSchema, TUnion } from '@sinclair/typebox';
8
- import { SchemaObject } from 'openapi3-ts/oas31';
9
- import { LiteralSchema, SchemaValidator } from '../types/schema.types';
10
- import { TIdiomaticSchema, TObject, TResolve, TUnionContainer, UnionTResolve } from './types/typebox.schema.types';
11
- /**
12
- * Class representing a TypeBox schema definition.
13
- * @implements {SchemaValidator}
14
- */
15
- export declare class TypeboxSchemaValidator implements SchemaValidator<(<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 TIdiomaticSchema>(schema: T, value: unknown) => boolean, <T extends TIdiomaticSchema>(schema: T) => SchemaObject> {
16
- _Type: 'TypeBox';
17
- _SchemaCatchall: TSchema;
18
- _ValidSchemaObject: TObject<TProperties> | TArray<TObject<TProperties>>;
19
- string: import("@sinclair/typebox").TString;
20
- number: import("@sinclair/typebox").TNumber;
21
- bigint: import("@sinclair/typebox").TBigInt;
22
- boolean: import("@sinclair/typebox").TBoolean;
23
- date: import("@sinclair/typebox").TDate;
24
- symbol: import("@sinclair/typebox").TSymbol;
25
- empty: TUnion<[import("@sinclair/typebox").TVoid, import("@sinclair/typebox").TNull, import("@sinclair/typebox").TUndefined]>;
26
- any: import("@sinclair/typebox").TAny;
27
- unknown: import("@sinclair/typebox").TUnknown;
28
- never: import("@sinclair/typebox").TNever;
29
- /**
30
- * Convert a schema to a TypeBox schema.
31
- * @param {TIdiomaticSchema} schema - The schema to convert.
32
- * @returns {TResolve<T>} The resolved schema.
33
- */
34
- schemify<T extends TIdiomaticSchema>(schema: T): TResolve<T>;
35
- /**
36
- * Make a schema optional.
37
- * @param {TIdiomaticSchema} schema - The schema to make optional.
38
- * @returns {TOptional<TResolve<T>>} The optional schema.
39
- */
40
- optional<T extends TIdiomaticSchema>(schema: T): TOptional<TResolve<T>>;
41
- /**
42
- * Create an array schema.
43
- * @param {TIdiomaticSchema} schema - The schema to use for array items.
44
- * @returns {TArray<TResolve<T>>} The array schema.
45
- */
46
- array<T extends TIdiomaticSchema>(schema: T): TArray<TResolve<T>>;
47
- /**
48
- * Create a union schema.
49
- * @param {TUnionContainer} schemas - The schemas to union.
50
- * @returns {TUnion<UnionTResolve<T>>} The union schema.
51
- *
52
- * WARNING: If "empty" or TUndefined is included in the union, the key will still be expected.
53
- * This is a limitation of TypeBox. Consider using "optional" instead.
54
- */
55
- union<T extends TUnionContainer>(schemas: T): TUnion<UnionTResolve<T>>;
56
- /**
57
- * Create a literal schema.
58
- * @param {LiteralSchema} value - The literal value.
59
- * @returns {TLiteral<T>} The literal schema.
60
- */
61
- literal<T extends LiteralSchema>(value: T): TLiteral<T>;
62
- /**
63
- * Validate a value against a schema.
64
- * @param {TSchema} schema - The schema to validate against.
65
- * @param {unknown} value - The value to validate.
66
- * @returns {boolean} True if valid, otherwise false.
67
- */
68
- validate<T extends TIdiomaticSchema | TSchema>(schema: T, value: unknown): boolean;
69
- /**
70
- * Convert a schema to an OpenAPI schema object.
71
- * @param {TIdiomaticSchema | TSchema} schema - The schema to convert.
72
- * @returns {SchemaObject} The OpenAPI schema object.
73
- */
74
- openapi<T extends TIdiomaticSchema | TSchema>(schema: T): SchemaObject;
75
- }
76
- /**
77
- * Factory function for creating a TypeboxSchemaValidator instance.
78
- * @returns {TypeboxSchemaValidator} The TypeboxSchemaValidator instance.
79
- */
80
- export declare const TypeboxSchema: () => TypeboxSchemaValidator;
81
- declare const SchemaValidator: TypeboxSchemaValidator;
82
- /**
83
- * TypeBox schema definition for string type.
84
- */
85
- export declare const string: typeof SchemaValidator.string;
86
- /**
87
- * TypeBox schema definition for number type.
88
- */
89
- export declare const number: typeof SchemaValidator.number;
90
- /**
91
- * TypeBox schema definition for bigint type.
92
- */
93
- export declare const bigint: typeof SchemaValidator.bigint;
94
- /**
95
- * TypeBox schema definition for boolean type.
96
- */
97
- export declare const boolean: typeof SchemaValidator.boolean;
98
- /**
99
- * TypeBox schema definition for date type.
100
- */
101
- export declare const date: typeof SchemaValidator.date;
102
- /**
103
- * TypeBox schema definition for symbol type.
104
- */
105
- export declare const symbol: typeof SchemaValidator.symbol;
106
- /**
107
- * TypeBox schema definition for undefined, null, void types.
108
- */
109
- export declare const empty: typeof SchemaValidator.empty;
110
- /**
111
- * TypeBox schema definition for any type.
112
- */
113
- export declare const any: typeof SchemaValidator.any;
114
- /**
115
- * TypeBox schema definition for unknown type.
116
- */
117
- export declare const unknown: typeof SchemaValidator.unknown;
118
- /**
119
- * TypeBox schema definition for never type.
120
- */
121
- export declare const never: typeof SchemaValidator.never;
122
- /**
123
- * Transforms valid schema into TypeBox schema.
124
- */
125
- export declare const schemify: typeof SchemaValidator.schemify;
126
- /**
127
- * Makes a valid schema optional.
128
- */
129
- export declare const optional: typeof SchemaValidator.optional;
130
- /**
131
- * Defines an array for a valid schema.
132
- */
133
- export declare const array: typeof SchemaValidator.array;
134
- /**
135
- * Defines a union for a valid schema.
136
- */
137
- export declare const union: typeof SchemaValidator.union;
138
- /**
139
- * Defines a literal for a valid schema.
140
- */
141
- export declare const literal: typeof SchemaValidator.literal;
142
- /**
143
- * Validates a value against a valid schema.
144
- */
145
- export declare const validate: typeof SchemaValidator.validate;
146
- /**
147
- * Generates an OpenAPI schema object from a valid schema.
148
- */
149
- export declare const openapi: typeof SchemaValidator.openapi;
150
- export {};
@@ -1,203 +0,0 @@
1
- "use strict";
2
- /**
3
- * This module provides a TypeScript-based schema definition using the TypeBox library.
4
- * It includes various types, schema creation, validation, and OpenAPI integration.
5
- *
6
- * @module TypeboxSchemaValidator
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.openapi = exports.validate = exports.literal = exports.union = exports.array = exports.optional = exports.schemify = exports.never = exports.unknown = exports.any = exports.empty = exports.symbol = exports.date = exports.boolean = exports.bigint = exports.number = exports.string = exports.TypeboxSchema = exports.TypeboxSchemaValidator = void 0;
10
- const typebox_1 = require("@sinclair/typebox");
11
- const value_1 = require("@sinclair/typebox/value");
12
- /**
13
- * Class representing a TypeBox schema definition.
14
- * @implements {SchemaValidator}
15
- */
16
- class TypeboxSchemaValidator {
17
- _Type;
18
- _SchemaCatchall;
19
- _ValidSchemaObject;
20
- string = typebox_1.Type.String();
21
- number = typebox_1.Type.Number();
22
- bigint = typebox_1.Type.BigInt();
23
- boolean = typebox_1.Type.Boolean();
24
- date = typebox_1.Type.Date();
25
- symbol = typebox_1.Type.Symbol();
26
- empty = typebox_1.Type.Union([typebox_1.Type.Void(), typebox_1.Type.Null(), typebox_1.Type.Undefined()]);
27
- any = typebox_1.Type.Any();
28
- unknown = typebox_1.Type.Unknown();
29
- never = typebox_1.Type.Never();
30
- /**
31
- * Convert a schema to a TypeBox schema.
32
- * @param {TIdiomaticSchema} schema - The schema to convert.
33
- * @returns {TResolve<T>} The resolved schema.
34
- */
35
- schemify(schema) {
36
- if (typeof schema === 'string' ||
37
- typeof schema === 'number' ||
38
- typeof schema === 'boolean') {
39
- return typebox_1.Type.Literal(schema);
40
- }
41
- if (typebox_1.Kind in schema) {
42
- return schema;
43
- }
44
- const newSchema = {};
45
- Object.getOwnPropertyNames(schema).forEach((key) => {
46
- if (typeof schema[key] === 'object' && typebox_1.Kind in schema[key]) {
47
- newSchema[key] = schema[key];
48
- }
49
- else {
50
- const schemified = this.schemify(schema[key]);
51
- newSchema[key] = schemified;
52
- }
53
- });
54
- return typebox_1.Type.Object(newSchema);
55
- }
56
- /**
57
- * Make a schema optional.
58
- * @param {TIdiomaticSchema} schema - The schema to make optional.
59
- * @returns {TOptional<TResolve<T>>} The optional schema.
60
- */
61
- optional(schema) {
62
- if (typebox_1.Kind in schema) {
63
- return typebox_1.Type.Optional(schema);
64
- }
65
- const schemified = this.schemify(schema);
66
- return typebox_1.Type.Optional(schemified);
67
- }
68
- /**
69
- * Create an array schema.
70
- * @param {TIdiomaticSchema} schema - The schema to use for array items.
71
- * @returns {TArray<TResolve<T>>} The array schema.
72
- */
73
- array(schema) {
74
- if (typebox_1.Kind in schema) {
75
- return typebox_1.Type.Array(schema);
76
- }
77
- const schemified = this.schemify(schema);
78
- return typebox_1.Type.Array(schemified);
79
- }
80
- /**
81
- * Create a union schema.
82
- * @param {TUnionContainer} schemas - The schemas to union.
83
- * @returns {TUnion<UnionTResolve<T>>} The union schema.
84
- *
85
- * WARNING: If "empty" or TUndefined is included in the union, the key will still be expected.
86
- * This is a limitation of TypeBox. Consider using "optional" instead.
87
- */
88
- union(schemas) {
89
- const unionTypes = schemas.map((schema) => {
90
- if (typebox_1.Kind in schema) {
91
- return schema;
92
- }
93
- return this.schemify(schema);
94
- });
95
- return typebox_1.Type.Union(unionTypes);
96
- }
97
- /**
98
- * Create a literal schema.
99
- * @param {LiteralSchema} value - The literal value.
100
- * @returns {TLiteral<T>} The literal schema.
101
- */
102
- literal(value) {
103
- return typebox_1.Type.Literal(value);
104
- }
105
- /**
106
- * Validate a value against a schema.
107
- * @param {TSchema} schema - The schema to validate against.
108
- * @param {unknown} value - The value to validate.
109
- * @returns {boolean} True if valid, otherwise false.
110
- */
111
- validate(schema, value) {
112
- if (typebox_1.Kind in schema) {
113
- return value_1.Value.Check(schema, value);
114
- }
115
- const schemified = this.schemify(schema);
116
- return value_1.Value.Check(schemified, value);
117
- }
118
- /**
119
- * Convert a schema to an OpenAPI schema object.
120
- * @param {TIdiomaticSchema | TSchema} schema - The schema to convert.
121
- * @returns {SchemaObject} The OpenAPI schema object.
122
- */
123
- openapi(schema) {
124
- return this.schemify(schema);
125
- }
126
- }
127
- exports.TypeboxSchemaValidator = TypeboxSchemaValidator;
128
- /**
129
- * Factory function for creating a TypeboxSchemaValidator instance.
130
- * @returns {TypeboxSchemaValidator} The TypeboxSchemaValidator instance.
131
- */
132
- const TypeboxSchema = () => new TypeboxSchemaValidator();
133
- exports.TypeboxSchema = TypeboxSchema;
134
- const SchemaValidator = (0, exports.TypeboxSchema)();
135
- /**
136
- * TypeBox schema definition for string type.
137
- */
138
- exports.string = SchemaValidator.string;
139
- /**
140
- * TypeBox schema definition for number type.
141
- */
142
- exports.number = SchemaValidator.number;
143
- /**
144
- * TypeBox schema definition for bigint type.
145
- */
146
- exports.bigint = SchemaValidator.bigint;
147
- /**
148
- * TypeBox schema definition for boolean type.
149
- */
150
- exports.boolean = SchemaValidator.boolean;
151
- /**
152
- * TypeBox schema definition for date type.
153
- */
154
- exports.date = SchemaValidator.date;
155
- /**
156
- * TypeBox schema definition for symbol type.
157
- */
158
- exports.symbol = SchemaValidator.symbol;
159
- /**
160
- * TypeBox schema definition for undefined, null, void types.
161
- */
162
- exports.empty = SchemaValidator.empty;
163
- /**
164
- * TypeBox schema definition for any type.
165
- */
166
- exports.any = SchemaValidator.any;
167
- /**
168
- * TypeBox schema definition for unknown type.
169
- */
170
- exports.unknown = SchemaValidator.unknown;
171
- /**
172
- * TypeBox schema definition for never type.
173
- */
174
- exports.never = SchemaValidator.never;
175
- /**
176
- * Transforms valid schema into TypeBox schema.
177
- */
178
- exports.schemify = SchemaValidator.schemify.bind(SchemaValidator);
179
- /**
180
- * Makes a valid schema optional.
181
- */
182
- exports.optional = SchemaValidator.optional.bind(SchemaValidator);
183
- /**
184
- * Defines an array for a valid schema.
185
- */
186
- exports.array = SchemaValidator.array.bind(SchemaValidator);
187
- /**
188
- * Defines a union for a valid schema.
189
- */
190
- exports.union = SchemaValidator.union.bind(SchemaValidator);
191
- /**
192
- * Defines a literal for a valid schema.
193
- */
194
- exports.literal = SchemaValidator.literal.bind(SchemaValidator);
195
- /**
196
- * Validates a value against a valid schema.
197
- */
198
- exports.validate = SchemaValidator.validate.bind(SchemaValidator);
199
- /**
200
- * Generates an OpenAPI schema object from a valid schema.
201
- */
202
- exports.openapi = SchemaValidator.openapi.bind(SchemaValidator);
203
- //# sourceMappingURL=typebox.schemaValidator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typebox.schemaValidator.js","sourceRoot":"","sources":["../../typebox/typebox.schemaValidator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,+CAS2B;AAC3B,mDAAgD;AAYhD;;;GAGG;AACH,MAAa,sBAAsB;IAYjC,KAAK,CAAa;IAClB,eAAe,CAAW;IAC1B,kBAAkB,CAAuD;IAEzE,MAAM,GAAG,cAAI,CAAC,MAAM,EAAE,CAAC;IACvB,MAAM,GAAG,cAAI,CAAC,MAAM,EAAE,CAAC;IACvB,MAAM,GAAG,cAAI,CAAC,MAAM,EAAE,CAAC;IACvB,OAAO,GAAG,cAAI,CAAC,OAAO,EAAE,CAAC;IACzB,IAAI,GAAG,cAAI,CAAC,IAAI,EAAE,CAAC;IACnB,MAAM,GAAG,cAAI,CAAC,MAAM,EAAE,CAAC;IACvB,KAAK,GAAG,cAAI,CAAC,KAAK,CAAC,CAAC,cAAI,CAAC,IAAI,EAAE,EAAE,cAAI,CAAC,IAAI,EAAE,EAAE,cAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACjE,GAAG,GAAG,cAAI,CAAC,GAAG,EAAE,CAAC;IACjB,OAAO,GAAG,cAAI,CAAC,OAAO,EAAE,CAAC;IACzB,KAAK,GAAG,cAAI,CAAC,KAAK,EAAE,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAA6B,MAAS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CAAC,IAAI,CAAC,eAAe,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=typebox.schema.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typebox.schema.types.js","sourceRoot":"","sources":["../../../typebox/types/typebox.schema.types.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export * from './schema.types';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./schema.types"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=schema.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.types.js","sourceRoot":"","sources":["../../types/schema.types.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export * from './zod.schemaValidator';
package/dist/zod/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./zod.schemaValidator"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../zod/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=zod.schema.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zod.schema.types.js","sourceRoot":"","sources":["../../../zod/types/zod.schema.types.ts"],"names":[],"mappings":""}
@@ -1,147 +0,0 @@
1
- /**
2
- * This module provides a Zod-based schema definition.
3
- * It includes various types, schema creation, validation, and OpenAPI integration.
4
- *
5
- * @module ZodSchemaValidator
6
- */
7
- import { SchemaObject } from 'openapi3-ts/oas31';
8
- import { ZodArray, ZodLiteral, ZodObject, ZodOptional, ZodRawShape, ZodType, ZodUnion, z } from 'zod';
9
- import { LiteralSchema, SchemaValidator } from '../types/schema.types';
10
- import { UnionZodResolve, ZodCatchall, ZodIdiomaticSchema, ZodResolve, ZodUnionContainer } from './types/zod.schema.types';
11
- /**
12
- * Class representing a Zod schema definition.
13
- * @implements {SchemaValidator}
14
- */
15
- export declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodIdiomaticSchema>(schema: T) => ZodResolve<T>), <T extends ZodIdiomaticSchema>(schema: T) => ZodOptional<ZodResolve<T>>, <T extends ZodIdiomaticSchema>(schema: T) => ZodArray<ZodResolve<T>>, <T extends ZodUnionContainer>(schemas: T) => ZodUnion<UnionZodResolve<T>>, <T extends LiteralSchema>(value: T) => ZodLiteral<ZodResolve<T>>, <T extends ZodCatchall>(schema: T, value: unknown) => boolean, <T extends ZodIdiomaticSchema>(schema: T) => SchemaObject> {
16
- _Type: 'Zod';
17
- _SchemaCatchall: ZodType;
18
- _ValidSchemaObject: ZodObject<ZodRawShape> | ZodArray<ZodObject<ZodRawShape>>;
19
- string: z.ZodString;
20
- number: z.ZodNumber;
21
- bigint: z.ZodBigInt;
22
- boolean: z.ZodBoolean;
23
- date: z.ZodDate;
24
- symbol: z.ZodSymbol;
25
- empty: ZodUnion<[z.ZodVoid, z.ZodNull, z.ZodUndefined]>;
26
- any: z.ZodAny;
27
- unknown: z.ZodUnknown;
28
- never: z.ZodNever;
29
- /**
30
- * Convert a schema to a Zod schema.
31
- * @param {ZodIdiomaticSchema} schema - The schema to convert.
32
- * @returns {ZodResolve<T>} The resolved schema.
33
- */
34
- schemify<T extends ZodIdiomaticSchema>(schema: T): ZodResolve<T>;
35
- /**
36
- * Make a schema optional.
37
- * @param {ZodIdiomaticSchema} schema - The schema to make optional.
38
- * @returns {ZodOptional<ZodResolve<T>>} The optional schema.
39
- */
40
- optional<T extends ZodIdiomaticSchema>(schema: T): ZodOptional<ZodResolve<T>>;
41
- /**
42
- * Create an array schema.
43
- * @param {ZodIdiomaticSchema} schema - The schema to use for array items.
44
- * @returns {ZodArray<ZodResolve<T>>} The array schema.
45
- */
46
- array<T extends ZodIdiomaticSchema>(schema: T): ZodArray<ZodResolve<T>>;
47
- /**
48
- * Create a union schema.
49
- * @param {ZodUnionContainer} schemas - The schemas to union.
50
- * @returns {ZodUnion<UnionZodResolve<T>>} The union schema.
51
- */
52
- union<T extends ZodUnionContainer>(schemas: T): ZodUnion<UnionZodResolve<T>>;
53
- /**
54
- * Create a literal schema.
55
- * @param {LiteralSchema} value - The literal value.
56
- * @returns {ZodLiteral<ZodResolve<T>>} The literal schema.
57
- */
58
- literal<T extends LiteralSchema>(value: T): ZodLiteral<ZodResolve<T>>;
59
- /**
60
- * Validate a value against a schema.
61
- * @param {ZodCatchall} schema - The schema to validate against.
62
- * @param {unknown} value - The value to validate.
63
- * @returns {boolean} True if valid, otherwise false.
64
- */
65
- validate<T extends ZodCatchall>(schema: T, value: unknown): boolean;
66
- /**
67
- * Convert a schema to an OpenAPI schema object.
68
- * @param {ZodIdiomaticSchema} schema - The schema to convert.
69
- * @returns {SchemaObject} The OpenAPI schema object.
70
- */
71
- openapi<T extends ZodIdiomaticSchema>(schema: T): SchemaObject;
72
- }
73
- /**
74
- * Factory function for creating a ZodSchemaValidator instance.
75
- * @returns {ZodSchemaValidator} The ZodSchemaValidator instance.
76
- */
77
- export declare const ZodSchema: () => ZodSchemaValidator;
78
- declare const SchemaValidator: ZodSchemaValidator;
79
- /**
80
- * Zod schema definition for string type.
81
- */
82
- export declare const string: typeof SchemaValidator.string;
83
- /**
84
- * Zod schema definition for number type.
85
- */
86
- export declare const number: typeof SchemaValidator.number;
87
- /**
88
- * Zod schema definition for bigint type.
89
- */
90
- export declare const bigint: typeof SchemaValidator.bigint;
91
- /**
92
- * Zod schema definition for boolean type.
93
- */
94
- export declare const boolean: typeof SchemaValidator.boolean;
95
- /**
96
- * Zod schema definition for date type.
97
- */
98
- export declare const date: typeof SchemaValidator.date;
99
- /**
100
- * Zod schema definition for symbol type.
101
- */
102
- export declare const symbol: typeof SchemaValidator.symbol;
103
- /**
104
- * Zod schema definition for undefined, null, void types.
105
- */
106
- export declare const empty: typeof SchemaValidator.empty;
107
- /**
108
- * Zod schema definition for any type.
109
- */
110
- export declare const any: typeof SchemaValidator.any;
111
- /**
112
- * Zod schema definition for unknown type.
113
- */
114
- export declare const unknown: typeof SchemaValidator.unknown;
115
- /**
116
- * Zod schema definition for never type.
117
- */
118
- export declare const never: typeof SchemaValidator.never;
119
- /**
120
- * Transforms valid schema into Zod schema.
121
- */
122
- export declare const schemify: typeof SchemaValidator.schemify;
123
- /**
124
- * Makes a valid schema optional.
125
- */
126
- export declare const optional: typeof SchemaValidator.optional;
127
- /**
128
- * Defines an array for a valid schema.
129
- */
130
- export declare const array: typeof SchemaValidator.array;
131
- /**
132
- * Defines a union for a valid schema.
133
- */
134
- export declare const union: typeof SchemaValidator.union;
135
- /**
136
- * Defines a literal for a valid schema.
137
- */
138
- export declare const literal: typeof SchemaValidator.literal;
139
- /**
140
- * Validates a value against a valid schema.
141
- */
142
- export declare const validate: typeof SchemaValidator.validate;
143
- /**
144
- * Generates an OpenAPI schema object from a valid schema.
145
- */
146
- export declare const openapi: typeof SchemaValidator.openapi;
147
- export {};