@forklaunch/validator 0.4.12 → 0.5.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/__test__/utils/mockSchemaValidator.d.mts +111 -3
- package/lib/__test__/utils/mockSchemaValidator.d.ts +111 -3
- package/lib/__test__/utils/mockSchemaValidator.js +105 -0
- package/lib/__test__/utils/mockSchemaValidator.mjs +102 -0
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/{schema.types-LkSEBFTv.d.mts → schema.types-BL6n8u4w.d.mts} +113 -20
- package/lib/{schema.types-LkSEBFTv.d.ts → schema.types-BL6n8u4w.d.ts} +113 -20
- package/lib/src/typebox/index.d.mts +28 -4
- package/lib/src/typebox/index.d.ts +28 -4
- package/lib/src/typebox/index.js +68 -11
- package/lib/src/typebox/index.mjs +61 -10
- package/lib/src/zod/index.d.mts +28 -4
- package/lib/src/zod/index.d.ts +28 -4
- package/lib/src/zod/index.js +65 -23
- package/lib/src/zod/index.mjs +60 -24
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
2
|
import * as _sinclair_typebox_compiler from '@sinclair/typebox/compiler';
|
|
3
|
-
import { T as TypeboxSchemaValidator, f as TIdiomaticSchema, g as TResolve, h as
|
|
4
|
-
export { m as TObject, l as TObjectShape, k as TOuterArray, n as TSchemaTranslate, o as UnboxedTObjectSchema } from '../../schema.types-
|
|
3
|
+
import { T as TypeboxSchemaValidator, f as TIdiomaticSchema, g as TResolve, h as TUnionTupleContainer, i as UnionTupleTResolve, L as LiteralSchema, j as TCatchall, a as ParseResult } from '../../schema.types-BL6n8u4w.js';
|
|
4
|
+
export { m as TObject, l as TObjectShape, k as TOuterArray, n as TSchemaTranslate, o as UnboxedTObjectSchema } from '../../schema.types-BL6n8u4w.js';
|
|
5
5
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
6
6
|
import '@forklaunch/common';
|
|
7
7
|
import 'zod';
|
|
@@ -51,6 +51,18 @@ declare const symbol: _sinclair_typebox.TSymbol;
|
|
|
51
51
|
* TypeBox schema definition for undefined, null, void types.
|
|
52
52
|
*/
|
|
53
53
|
declare const nullish: _sinclair_typebox.TUnion<[_sinclair_typebox.TVoid, _sinclair_typebox.TNull, _sinclair_typebox.TUndefined]>;
|
|
54
|
+
/**
|
|
55
|
+
* TypeBox schema definition for void type.
|
|
56
|
+
*/
|
|
57
|
+
declare const void_: _sinclair_typebox.TVoid;
|
|
58
|
+
/**
|
|
59
|
+
* TypeBox schema definition for null type.
|
|
60
|
+
*/
|
|
61
|
+
declare const null_: _sinclair_typebox.TNull;
|
|
62
|
+
/**
|
|
63
|
+
* TypeBox schema definition for undefined type.
|
|
64
|
+
*/
|
|
65
|
+
declare const undefined_: _sinclair_typebox.TUndefined;
|
|
54
66
|
/**
|
|
55
67
|
* TypeBox schema definition for any type.
|
|
56
68
|
*/
|
|
@@ -78,7 +90,7 @@ declare const array: <T extends TIdiomaticSchema>(schema: T) => _sinclair_typebo
|
|
|
78
90
|
/**
|
|
79
91
|
* Defines a union for a valid schema.
|
|
80
92
|
*/
|
|
81
|
-
declare const union: <T extends
|
|
93
|
+
declare const union: <T extends TUnionTupleContainer>(schemas: [...T]) => _sinclair_typebox.TUnion<UnionTupleTResolve<T>>;
|
|
82
94
|
/**
|
|
83
95
|
* Defines a literal for a valid schema.
|
|
84
96
|
*/
|
|
@@ -87,6 +99,18 @@ declare const literal: <T extends LiteralSchema>(value: T) => _sinclair_typebox.
|
|
|
87
99
|
* Defines an enum for a valid schema.
|
|
88
100
|
*/
|
|
89
101
|
declare const enum_: <T extends Record<string, LiteralSchema>>(schemaEnum: T) => _sinclair_typebox.TUnion<[{ [K in keyof T]: _sinclair_typebox.TLiteral<T[K]>; }[keyof T]]>;
|
|
102
|
+
/**
|
|
103
|
+
* Defines a function for a valid schema.
|
|
104
|
+
*/
|
|
105
|
+
declare const function_: <Args extends TUnionTupleContainer, ReturnType extends TIdiomaticSchema>(args: [...Args], returnType: ReturnType) => _sinclair_typebox.TFunction<UnionTupleTResolve<Args>, TResolve<ReturnType>>;
|
|
106
|
+
/**
|
|
107
|
+
* Defines a record for a valid schema.
|
|
108
|
+
*/
|
|
109
|
+
declare const record: <Key extends TIdiomaticSchema, Value extends TIdiomaticSchema>(key: Key, value: Value) => _sinclair_typebox.TRecord<TResolve<Key>, TResolve<Value>>;
|
|
110
|
+
/**
|
|
111
|
+
* Defines a promise for a valid schema.
|
|
112
|
+
*/
|
|
113
|
+
declare const promise: <T extends TIdiomaticSchema>(schema: T) => _sinclair_typebox.TPromise<TResolve<T>>;
|
|
90
114
|
/**
|
|
91
115
|
* Checks if a value is a TypeBox schema.
|
|
92
116
|
*/
|
|
@@ -104,4 +128,4 @@ declare const parse: <T extends TIdiomaticSchema | TCatchall>(schema: T | _sincl
|
|
|
104
128
|
*/
|
|
105
129
|
declare const openapi: <T extends TIdiomaticSchema | TCatchall>(schema: T) => openapi3_ts_oas31.SchemaObject;
|
|
106
130
|
|
|
107
|
-
export { SchemaValidator, TCatchall, TIdiomaticSchema, TResolve,
|
|
131
|
+
export { SchemaValidator, TCatchall, TIdiomaticSchema, TResolve, TUnionTupleContainer, TypeboxSchemaValidator, UnionTupleTResolve, any, array, bigint, boolean, date, email, enum_, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
package/lib/src/typebox/index.js
CHANGED
|
@@ -28,22 +28,28 @@ __export(typebox_exports, {
|
|
|
28
28
|
date: () => date,
|
|
29
29
|
email: () => email,
|
|
30
30
|
enum_: () => enum_,
|
|
31
|
+
function_: () => function_,
|
|
31
32
|
isSchema: () => isSchema,
|
|
32
33
|
literal: () => literal,
|
|
33
34
|
never: () => never,
|
|
35
|
+
null_: () => null_,
|
|
34
36
|
nullish: () => nullish,
|
|
35
37
|
number: () => number,
|
|
36
38
|
openapi: () => openapi,
|
|
37
39
|
optional: () => optional,
|
|
38
40
|
parse: () => parse,
|
|
41
|
+
promise: () => promise,
|
|
42
|
+
record: () => record,
|
|
39
43
|
schemify: () => schemify,
|
|
40
44
|
string: () => string,
|
|
41
45
|
symbol: () => symbol,
|
|
46
|
+
undefined_: () => undefined_,
|
|
42
47
|
union: () => union,
|
|
43
48
|
unknown: () => unknown,
|
|
44
49
|
uri: () => uri,
|
|
45
50
|
uuid: () => uuid,
|
|
46
|
-
validate: () => validate
|
|
51
|
+
validate: () => validate,
|
|
52
|
+
void_: () => void_
|
|
47
53
|
});
|
|
48
54
|
module.exports = __toCommonJS(typebox_exports);
|
|
49
55
|
|
|
@@ -180,6 +186,9 @@ var TypeboxSchemaValidator = class {
|
|
|
180
186
|
nullish = import_typebox.Type.Union([import_typebox.Type.Void(), import_typebox.Type.Null(), import_typebox.Type.Undefined()], {
|
|
181
187
|
errorType: "nullish"
|
|
182
188
|
});
|
|
189
|
+
void = import_typebox.Type.Void();
|
|
190
|
+
null = import_typebox.Type.Null();
|
|
191
|
+
undefined = import_typebox.Type.Undefined();
|
|
183
192
|
any = import_typebox.Type.Any();
|
|
184
193
|
unknown = import_typebox.Type.Unknown();
|
|
185
194
|
never = import_typebox.Type.Never();
|
|
@@ -235,7 +244,7 @@ var TypeboxSchemaValidator = class {
|
|
|
235
244
|
* @returns {TOptional<TResolve<T>>} The optional schema.
|
|
236
245
|
*/
|
|
237
246
|
optional(schema) {
|
|
238
|
-
const schemified =
|
|
247
|
+
const schemified = this.schemify(schema);
|
|
239
248
|
return import_typebox.Type.Optional(schemified);
|
|
240
249
|
}
|
|
241
250
|
/**
|
|
@@ -244,22 +253,22 @@ var TypeboxSchemaValidator = class {
|
|
|
244
253
|
* @returns {TArray<TResolve<T>>} The array schema.
|
|
245
254
|
*/
|
|
246
255
|
array(schema) {
|
|
247
|
-
const schemified =
|
|
256
|
+
const schemified = this.schemify(schema);
|
|
248
257
|
return import_typebox.Type.Array(schemified, {
|
|
249
258
|
errorType: `array of ${this.errorType(schemified)}`
|
|
250
259
|
});
|
|
251
260
|
}
|
|
252
261
|
/**
|
|
253
262
|
* Create a union schema.
|
|
254
|
-
* @param {
|
|
255
|
-
* @returns {TUnion<
|
|
263
|
+
* @param {TUnionTupleContainer} schemas - The schemas to union.
|
|
264
|
+
* @returns {TUnion<UnionTupleTResolve<T>>} The union schema.
|
|
256
265
|
*
|
|
257
266
|
* WARNING: If "nullish" or TUndefined is included in the union, the key will still be expected.
|
|
258
267
|
* This is a limitation of TypeBox. Consider using "optional" instead.
|
|
259
268
|
*/
|
|
260
269
|
union(schemas) {
|
|
261
270
|
const unionTypes = schemas.map((schema) => {
|
|
262
|
-
return
|
|
271
|
+
return this.schemify(schema);
|
|
263
272
|
});
|
|
264
273
|
return import_typebox.Type.Union(unionTypes, {
|
|
265
274
|
errorType: `any of ${unionTypes.map((s) => this.errorType(s)).join(", ")}`,
|
|
@@ -279,13 +288,45 @@ var TypeboxSchemaValidator = class {
|
|
|
279
288
|
/**
|
|
280
289
|
* Create an enum schema.
|
|
281
290
|
* @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
|
|
282
|
-
* @returns {TUnion<
|
|
291
|
+
* @returns {TUnion<UnionTupleTResolve<T[]>>} The enum schema.
|
|
283
292
|
*/
|
|
284
293
|
enum_(schemaEnum) {
|
|
285
294
|
return this.union(
|
|
286
295
|
Object.values(schemaEnum).map((value) => this.literal(value))
|
|
287
296
|
);
|
|
288
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Create a function schema.
|
|
300
|
+
* @param {TSchema[]} args - The arguments of the function.
|
|
301
|
+
* @param {TAny} returnType - The return type of the function.
|
|
302
|
+
* @returns {TFunction<Args, ReturnType>} The function schema.
|
|
303
|
+
*/
|
|
304
|
+
function_(args, returnType) {
|
|
305
|
+
const schemaArgs = args.map((schema) => {
|
|
306
|
+
return this.schemify(schema);
|
|
307
|
+
});
|
|
308
|
+
const schemaReturnType = this.schemify(returnType);
|
|
309
|
+
return import_typebox.Type.Function(schemaArgs, schemaReturnType);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Create a record schema.
|
|
313
|
+
* @param {TIdiomaticSchema} key - The key schema.
|
|
314
|
+
* @param {TIdiomaticSchema} value - The value schema.
|
|
315
|
+
* @returns {TRecord<TResolve<Key>, TResolve<Value>>} The record schema.
|
|
316
|
+
*/
|
|
317
|
+
record(key, value) {
|
|
318
|
+
const keySchema = this.schemify(key);
|
|
319
|
+
const valueSchema = this.schemify(value);
|
|
320
|
+
return import_typebox.Type.Record(keySchema, valueSchema);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Create a promise schema.
|
|
324
|
+
* @param {TIdiomaticSchema} schema - The schema to use for the promise.
|
|
325
|
+
* @returns {TPromise<TResolve<T>>} The promise schema.
|
|
326
|
+
*/
|
|
327
|
+
promise(schema) {
|
|
328
|
+
return import_typebox.Type.Promise(this.schemify(schema));
|
|
329
|
+
}
|
|
289
330
|
/**
|
|
290
331
|
* Check if a value is a TypeBox object schema.
|
|
291
332
|
* @param {unknown} value - The value to check.
|
|
@@ -305,7 +346,7 @@ var TypeboxSchemaValidator = class {
|
|
|
305
346
|
if (schema instanceof import_compiler.TypeCheck) {
|
|
306
347
|
return schema.Check(value);
|
|
307
348
|
} else {
|
|
308
|
-
const schemified =
|
|
349
|
+
const schemified = this.schemify(schema);
|
|
309
350
|
return import_value.Value.Check(schemified, value);
|
|
310
351
|
}
|
|
311
352
|
}
|
|
@@ -326,7 +367,7 @@ var TypeboxSchemaValidator = class {
|
|
|
326
367
|
errors = Array.from(schema.Errors(value));
|
|
327
368
|
}
|
|
328
369
|
} else {
|
|
329
|
-
const schemified =
|
|
370
|
+
const schemified = this.schemify(schema);
|
|
330
371
|
if (import_value.Value.Check(schemified, value)) {
|
|
331
372
|
conversion = import_value.Value.Decode(schemified, value);
|
|
332
373
|
} else {
|
|
@@ -377,7 +418,7 @@ var TypeboxSchemaValidator = class {
|
|
|
377
418
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
378
419
|
*/
|
|
379
420
|
openapi(schema) {
|
|
380
|
-
const schemified =
|
|
421
|
+
const schemified = this.schemify(schema);
|
|
381
422
|
if (Object.hasOwn(schemified, "openapiType") || import_typebox.KindGuard.IsLiteral(schemified)) {
|
|
382
423
|
return schemified.openapiType;
|
|
383
424
|
}
|
|
@@ -409,6 +450,9 @@ var boolean = StaticSchemaValidator.boolean;
|
|
|
409
450
|
var date = StaticSchemaValidator.date;
|
|
410
451
|
var symbol = StaticSchemaValidator.symbol;
|
|
411
452
|
var nullish = StaticSchemaValidator.nullish;
|
|
453
|
+
var void_ = StaticSchemaValidator.void;
|
|
454
|
+
var null_ = StaticSchemaValidator.null;
|
|
455
|
+
var undefined_ = StaticSchemaValidator.undefined;
|
|
412
456
|
var any = StaticSchemaValidator.any;
|
|
413
457
|
var unknown = StaticSchemaValidator.unknown;
|
|
414
458
|
var never = StaticSchemaValidator.never;
|
|
@@ -424,6 +468,13 @@ var literal = StaticSchemaValidator.literal.bind(
|
|
|
424
468
|
StaticSchemaValidator
|
|
425
469
|
);
|
|
426
470
|
var enum_ = StaticSchemaValidator.enum_.bind(StaticSchemaValidator);
|
|
471
|
+
var function_ = StaticSchemaValidator.function_.bind(
|
|
472
|
+
StaticSchemaValidator
|
|
473
|
+
);
|
|
474
|
+
var record = StaticSchemaValidator.record.bind(StaticSchemaValidator);
|
|
475
|
+
var promise = StaticSchemaValidator.promise.bind(
|
|
476
|
+
StaticSchemaValidator
|
|
477
|
+
);
|
|
427
478
|
var isSchema = StaticSchemaValidator.isSchema.bind(
|
|
428
479
|
StaticSchemaValidator
|
|
429
480
|
);
|
|
@@ -444,20 +495,26 @@ var openapi = StaticSchemaValidator.openapi.bind(
|
|
|
444
495
|
date,
|
|
445
496
|
email,
|
|
446
497
|
enum_,
|
|
498
|
+
function_,
|
|
447
499
|
isSchema,
|
|
448
500
|
literal,
|
|
449
501
|
never,
|
|
502
|
+
null_,
|
|
450
503
|
nullish,
|
|
451
504
|
number,
|
|
452
505
|
openapi,
|
|
453
506
|
optional,
|
|
454
507
|
parse,
|
|
508
|
+
promise,
|
|
509
|
+
record,
|
|
455
510
|
schemify,
|
|
456
511
|
string,
|
|
457
512
|
symbol,
|
|
513
|
+
undefined_,
|
|
458
514
|
union,
|
|
459
515
|
unknown,
|
|
460
516
|
uri,
|
|
461
517
|
uuid,
|
|
462
|
-
validate
|
|
518
|
+
validate,
|
|
519
|
+
void_
|
|
463
520
|
});
|
|
@@ -139,6 +139,9 @@ var TypeboxSchemaValidator = class {
|
|
|
139
139
|
nullish = Type.Union([Type.Void(), Type.Null(), Type.Undefined()], {
|
|
140
140
|
errorType: "nullish"
|
|
141
141
|
});
|
|
142
|
+
void = Type.Void();
|
|
143
|
+
null = Type.Null();
|
|
144
|
+
undefined = Type.Undefined();
|
|
142
145
|
any = Type.Any();
|
|
143
146
|
unknown = Type.Unknown();
|
|
144
147
|
never = Type.Never();
|
|
@@ -194,7 +197,7 @@ var TypeboxSchemaValidator = class {
|
|
|
194
197
|
* @returns {TOptional<TResolve<T>>} The optional schema.
|
|
195
198
|
*/
|
|
196
199
|
optional(schema) {
|
|
197
|
-
const schemified =
|
|
200
|
+
const schemified = this.schemify(schema);
|
|
198
201
|
return Type.Optional(schemified);
|
|
199
202
|
}
|
|
200
203
|
/**
|
|
@@ -203,22 +206,22 @@ var TypeboxSchemaValidator = class {
|
|
|
203
206
|
* @returns {TArray<TResolve<T>>} The array schema.
|
|
204
207
|
*/
|
|
205
208
|
array(schema) {
|
|
206
|
-
const schemified =
|
|
209
|
+
const schemified = this.schemify(schema);
|
|
207
210
|
return Type.Array(schemified, {
|
|
208
211
|
errorType: `array of ${this.errorType(schemified)}`
|
|
209
212
|
});
|
|
210
213
|
}
|
|
211
214
|
/**
|
|
212
215
|
* Create a union schema.
|
|
213
|
-
* @param {
|
|
214
|
-
* @returns {TUnion<
|
|
216
|
+
* @param {TUnionTupleContainer} schemas - The schemas to union.
|
|
217
|
+
* @returns {TUnion<UnionTupleTResolve<T>>} The union schema.
|
|
215
218
|
*
|
|
216
219
|
* WARNING: If "nullish" or TUndefined is included in the union, the key will still be expected.
|
|
217
220
|
* This is a limitation of TypeBox. Consider using "optional" instead.
|
|
218
221
|
*/
|
|
219
222
|
union(schemas) {
|
|
220
223
|
const unionTypes = schemas.map((schema) => {
|
|
221
|
-
return
|
|
224
|
+
return this.schemify(schema);
|
|
222
225
|
});
|
|
223
226
|
return Type.Union(unionTypes, {
|
|
224
227
|
errorType: `any of ${unionTypes.map((s) => this.errorType(s)).join(", ")}`,
|
|
@@ -238,13 +241,45 @@ var TypeboxSchemaValidator = class {
|
|
|
238
241
|
/**
|
|
239
242
|
* Create an enum schema.
|
|
240
243
|
* @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
|
|
241
|
-
* @returns {TUnion<
|
|
244
|
+
* @returns {TUnion<UnionTupleTResolve<T[]>>} The enum schema.
|
|
242
245
|
*/
|
|
243
246
|
enum_(schemaEnum) {
|
|
244
247
|
return this.union(
|
|
245
248
|
Object.values(schemaEnum).map((value) => this.literal(value))
|
|
246
249
|
);
|
|
247
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Create a function schema.
|
|
253
|
+
* @param {TSchema[]} args - The arguments of the function.
|
|
254
|
+
* @param {TAny} returnType - The return type of the function.
|
|
255
|
+
* @returns {TFunction<Args, ReturnType>} The function schema.
|
|
256
|
+
*/
|
|
257
|
+
function_(args, returnType) {
|
|
258
|
+
const schemaArgs = args.map((schema) => {
|
|
259
|
+
return this.schemify(schema);
|
|
260
|
+
});
|
|
261
|
+
const schemaReturnType = this.schemify(returnType);
|
|
262
|
+
return Type.Function(schemaArgs, schemaReturnType);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Create a record schema.
|
|
266
|
+
* @param {TIdiomaticSchema} key - The key schema.
|
|
267
|
+
* @param {TIdiomaticSchema} value - The value schema.
|
|
268
|
+
* @returns {TRecord<TResolve<Key>, TResolve<Value>>} The record schema.
|
|
269
|
+
*/
|
|
270
|
+
record(key, value) {
|
|
271
|
+
const keySchema = this.schemify(key);
|
|
272
|
+
const valueSchema = this.schemify(value);
|
|
273
|
+
return Type.Record(keySchema, valueSchema);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Create a promise schema.
|
|
277
|
+
* @param {TIdiomaticSchema} schema - The schema to use for the promise.
|
|
278
|
+
* @returns {TPromise<TResolve<T>>} The promise schema.
|
|
279
|
+
*/
|
|
280
|
+
promise(schema) {
|
|
281
|
+
return Type.Promise(this.schemify(schema));
|
|
282
|
+
}
|
|
248
283
|
/**
|
|
249
284
|
* Check if a value is a TypeBox object schema.
|
|
250
285
|
* @param {unknown} value - The value to check.
|
|
@@ -264,7 +299,7 @@ var TypeboxSchemaValidator = class {
|
|
|
264
299
|
if (schema instanceof TypeCheck) {
|
|
265
300
|
return schema.Check(value);
|
|
266
301
|
} else {
|
|
267
|
-
const schemified =
|
|
302
|
+
const schemified = this.schemify(schema);
|
|
268
303
|
return Value.Check(schemified, value);
|
|
269
304
|
}
|
|
270
305
|
}
|
|
@@ -285,7 +320,7 @@ var TypeboxSchemaValidator = class {
|
|
|
285
320
|
errors = Array.from(schema.Errors(value));
|
|
286
321
|
}
|
|
287
322
|
} else {
|
|
288
|
-
const schemified =
|
|
323
|
+
const schemified = this.schemify(schema);
|
|
289
324
|
if (Value.Check(schemified, value)) {
|
|
290
325
|
conversion = Value.Decode(schemified, value);
|
|
291
326
|
} else {
|
|
@@ -336,7 +371,7 @@ var TypeboxSchemaValidator = class {
|
|
|
336
371
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
337
372
|
*/
|
|
338
373
|
openapi(schema) {
|
|
339
|
-
const schemified =
|
|
374
|
+
const schemified = this.schemify(schema);
|
|
340
375
|
if (Object.hasOwn(schemified, "openapiType") || KindGuard.IsLiteral(schemified)) {
|
|
341
376
|
return schemified.openapiType;
|
|
342
377
|
}
|
|
@@ -368,6 +403,9 @@ var boolean = StaticSchemaValidator.boolean;
|
|
|
368
403
|
var date = StaticSchemaValidator.date;
|
|
369
404
|
var symbol = StaticSchemaValidator.symbol;
|
|
370
405
|
var nullish = StaticSchemaValidator.nullish;
|
|
406
|
+
var void_ = StaticSchemaValidator.void;
|
|
407
|
+
var null_ = StaticSchemaValidator.null;
|
|
408
|
+
var undefined_ = StaticSchemaValidator.undefined;
|
|
371
409
|
var any = StaticSchemaValidator.any;
|
|
372
410
|
var unknown = StaticSchemaValidator.unknown;
|
|
373
411
|
var never = StaticSchemaValidator.never;
|
|
@@ -383,6 +421,13 @@ var literal = StaticSchemaValidator.literal.bind(
|
|
|
383
421
|
StaticSchemaValidator
|
|
384
422
|
);
|
|
385
423
|
var enum_ = StaticSchemaValidator.enum_.bind(StaticSchemaValidator);
|
|
424
|
+
var function_ = StaticSchemaValidator.function_.bind(
|
|
425
|
+
StaticSchemaValidator
|
|
426
|
+
);
|
|
427
|
+
var record = StaticSchemaValidator.record.bind(StaticSchemaValidator);
|
|
428
|
+
var promise = StaticSchemaValidator.promise.bind(
|
|
429
|
+
StaticSchemaValidator
|
|
430
|
+
);
|
|
386
431
|
var isSchema = StaticSchemaValidator.isSchema.bind(
|
|
387
432
|
StaticSchemaValidator
|
|
388
433
|
);
|
|
@@ -402,20 +447,26 @@ export {
|
|
|
402
447
|
date,
|
|
403
448
|
email,
|
|
404
449
|
enum_,
|
|
450
|
+
function_,
|
|
405
451
|
isSchema,
|
|
406
452
|
literal,
|
|
407
453
|
never,
|
|
454
|
+
null_,
|
|
408
455
|
nullish,
|
|
409
456
|
number,
|
|
410
457
|
openapi,
|
|
411
458
|
optional,
|
|
412
459
|
parse,
|
|
460
|
+
promise,
|
|
461
|
+
record,
|
|
413
462
|
schemify,
|
|
414
463
|
string,
|
|
415
464
|
symbol,
|
|
465
|
+
undefined_,
|
|
416
466
|
union,
|
|
417
467
|
unknown,
|
|
418
468
|
uri,
|
|
419
469
|
uuid,
|
|
420
|
-
validate
|
|
470
|
+
validate,
|
|
471
|
+
void_
|
|
421
472
|
};
|
package/lib/src/zod/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
|
-
import { Z as ZodSchemaValidator, p as ZodIdiomaticSchema, q as ZodResolve, r as ZodUnionContainer, s as UnionZodResolve, L as LiteralSchema, t as ZodCatchall, a as ParseResult } from '../../schema.types-
|
|
3
|
-
export {
|
|
2
|
+
import { Z as ZodSchemaValidator, p as ZodIdiomaticSchema, q as ZodResolve, r as ZodUnionContainer, s as UnionZodResolve, L as LiteralSchema, t as ZodTupleContainer, u as TupleZodResolve, v as ZodRecordKey, w as ZodCatchall, a as ParseResult } from '../../schema.types-BL6n8u4w.mjs';
|
|
3
|
+
export { C as UnboxedZodObjectSchema, z as ZodObject, y as ZodObjectShape, x as ZodOuterArray, B as ZodSchemaTranslate } from '../../schema.types-BL6n8u4w.mjs';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import '@forklaunch/common';
|
|
6
6
|
import '@sinclair/typebox';
|
|
@@ -51,6 +51,18 @@ declare const symbol: zod.ZodSymbol;
|
|
|
51
51
|
* Zod schema definition for undefined, null, void types.
|
|
52
52
|
*/
|
|
53
53
|
declare const nullish: zod.ZodUnion<[zod.ZodVoid, zod.ZodNull, zod.ZodUndefined]>;
|
|
54
|
+
/**
|
|
55
|
+
* Zod schema definition for void type.
|
|
56
|
+
*/
|
|
57
|
+
declare const void_: zod.ZodVoid;
|
|
58
|
+
/**
|
|
59
|
+
* Zod schema definition for null type.
|
|
60
|
+
*/
|
|
61
|
+
declare const null_: zod.ZodNull;
|
|
62
|
+
/**
|
|
63
|
+
* Zod schema definition for undefined type.
|
|
64
|
+
*/
|
|
65
|
+
declare const undefined_: zod.ZodUndefined;
|
|
54
66
|
/**
|
|
55
67
|
* Zod schema definition for any type.
|
|
56
68
|
*/
|
|
@@ -82,11 +94,23 @@ declare const union: <T extends ZodUnionContainer>(schemas: T) => zod.ZodUnion<U
|
|
|
82
94
|
/**
|
|
83
95
|
* Defines a literal for a valid schema.
|
|
84
96
|
*/
|
|
85
|
-
declare const literal: <T extends LiteralSchema>(value: T) => zod.ZodLiteral<
|
|
97
|
+
declare const literal: <T extends LiteralSchema>(value: T) => zod.ZodLiteral<T>;
|
|
86
98
|
/**
|
|
87
99
|
* Defines an enum for a valid schema.
|
|
88
100
|
*/
|
|
89
101
|
declare const enum_: <T extends Record<string, LiteralSchema>>(schemaEnum: T) => zod.ZodUnion<[{ [K in keyof T]: zod.ZodLiteral<T[K]>; }[keyof T]]>;
|
|
102
|
+
/**
|
|
103
|
+
* Defines a function for a valid schema.
|
|
104
|
+
*/
|
|
105
|
+
declare const function_: <Args extends ZodTupleContainer, ReturnType extends ZodIdiomaticSchema>(args: Args, returnType: ReturnType) => zod.ZodFunction<zod.ZodTuple<TupleZodResolve<Args>, null>, ZodResolve<ReturnType>>;
|
|
106
|
+
/**
|
|
107
|
+
* Defines a record for a valid schema.
|
|
108
|
+
*/
|
|
109
|
+
declare const record: <Key extends ZodIdiomaticSchema, Value extends ZodIdiomaticSchema>(key: Key, value: Value) => zod.ZodRecord<ZodRecordKey<Key>, ZodResolve<Value>>;
|
|
110
|
+
/**
|
|
111
|
+
* Defines a promise for a valid schema.
|
|
112
|
+
*/
|
|
113
|
+
declare const promise: <T extends ZodIdiomaticSchema>(schema: T) => zod.ZodPromise<ZodResolve<T>>;
|
|
90
114
|
/**
|
|
91
115
|
* Checks if a value is a Zod schema.
|
|
92
116
|
*/
|
|
@@ -104,4 +128,4 @@ declare const parse: <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T, val
|
|
|
104
128
|
*/
|
|
105
129
|
declare const openapi: <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T) => openapi3_ts_oas31.SchemaObject;
|
|
106
130
|
|
|
107
|
-
export { SchemaValidator, UnionZodResolve, ZodCatchall, ZodIdiomaticSchema, ZodResolve, ZodSchemaValidator, ZodUnionContainer, any, array, bigint, boolean, date, email, enum_, isSchema, literal, never, nullish, number, openapi, optional, parse, schemify, string, symbol, union, unknown, uri, uuid, validate };
|
|
131
|
+
export { SchemaValidator, TupleZodResolve, UnionZodResolve, ZodCatchall, ZodIdiomaticSchema, ZodRecordKey, ZodResolve, ZodSchemaValidator, ZodTupleContainer, ZodUnionContainer, any, array, bigint, boolean, date, email, enum_, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
package/lib/src/zod/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as openapi3_ts_oas31 from 'openapi3-ts/oas31';
|
|
2
|
-
import { Z as ZodSchemaValidator, p as ZodIdiomaticSchema, q as ZodResolve, r as ZodUnionContainer, s as UnionZodResolve, L as LiteralSchema, t as ZodCatchall, a as ParseResult } from '../../schema.types-
|
|
3
|
-
export {
|
|
2
|
+
import { Z as ZodSchemaValidator, p as ZodIdiomaticSchema, q as ZodResolve, r as ZodUnionContainer, s as UnionZodResolve, L as LiteralSchema, t as ZodTupleContainer, u as TupleZodResolve, v as ZodRecordKey, w as ZodCatchall, a as ParseResult } from '../../schema.types-BL6n8u4w.js';
|
|
3
|
+
export { C as UnboxedZodObjectSchema, z as ZodObject, y as ZodObjectShape, x as ZodOuterArray, B as ZodSchemaTranslate } from '../../schema.types-BL6n8u4w.js';
|
|
4
4
|
import * as zod from 'zod';
|
|
5
5
|
import '@forklaunch/common';
|
|
6
6
|
import '@sinclair/typebox';
|
|
@@ -51,6 +51,18 @@ declare const symbol: zod.ZodSymbol;
|
|
|
51
51
|
* Zod schema definition for undefined, null, void types.
|
|
52
52
|
*/
|
|
53
53
|
declare const nullish: zod.ZodUnion<[zod.ZodVoid, zod.ZodNull, zod.ZodUndefined]>;
|
|
54
|
+
/**
|
|
55
|
+
* Zod schema definition for void type.
|
|
56
|
+
*/
|
|
57
|
+
declare const void_: zod.ZodVoid;
|
|
58
|
+
/**
|
|
59
|
+
* Zod schema definition for null type.
|
|
60
|
+
*/
|
|
61
|
+
declare const null_: zod.ZodNull;
|
|
62
|
+
/**
|
|
63
|
+
* Zod schema definition for undefined type.
|
|
64
|
+
*/
|
|
65
|
+
declare const undefined_: zod.ZodUndefined;
|
|
54
66
|
/**
|
|
55
67
|
* Zod schema definition for any type.
|
|
56
68
|
*/
|
|
@@ -82,11 +94,23 @@ declare const union: <T extends ZodUnionContainer>(schemas: T) => zod.ZodUnion<U
|
|
|
82
94
|
/**
|
|
83
95
|
* Defines a literal for a valid schema.
|
|
84
96
|
*/
|
|
85
|
-
declare const literal: <T extends LiteralSchema>(value: T) => zod.ZodLiteral<
|
|
97
|
+
declare const literal: <T extends LiteralSchema>(value: T) => zod.ZodLiteral<T>;
|
|
86
98
|
/**
|
|
87
99
|
* Defines an enum for a valid schema.
|
|
88
100
|
*/
|
|
89
101
|
declare const enum_: <T extends Record<string, LiteralSchema>>(schemaEnum: T) => zod.ZodUnion<[{ [K in keyof T]: zod.ZodLiteral<T[K]>; }[keyof T]]>;
|
|
102
|
+
/**
|
|
103
|
+
* Defines a function for a valid schema.
|
|
104
|
+
*/
|
|
105
|
+
declare const function_: <Args extends ZodTupleContainer, ReturnType extends ZodIdiomaticSchema>(args: Args, returnType: ReturnType) => zod.ZodFunction<zod.ZodTuple<TupleZodResolve<Args>, null>, ZodResolve<ReturnType>>;
|
|
106
|
+
/**
|
|
107
|
+
* Defines a record for a valid schema.
|
|
108
|
+
*/
|
|
109
|
+
declare const record: <Key extends ZodIdiomaticSchema, Value extends ZodIdiomaticSchema>(key: Key, value: Value) => zod.ZodRecord<ZodRecordKey<Key>, ZodResolve<Value>>;
|
|
110
|
+
/**
|
|
111
|
+
* Defines a promise for a valid schema.
|
|
112
|
+
*/
|
|
113
|
+
declare const promise: <T extends ZodIdiomaticSchema>(schema: T) => zod.ZodPromise<ZodResolve<T>>;
|
|
90
114
|
/**
|
|
91
115
|
* Checks if a value is a Zod schema.
|
|
92
116
|
*/
|
|
@@ -104,4 +128,4 @@ declare const parse: <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T, val
|
|
|
104
128
|
*/
|
|
105
129
|
declare const openapi: <T extends ZodIdiomaticSchema | ZodCatchall>(schema: T) => openapi3_ts_oas31.SchemaObject;
|
|
106
130
|
|
|
107
|
-
export { SchemaValidator, UnionZodResolve, ZodCatchall, ZodIdiomaticSchema, ZodResolve, ZodSchemaValidator, ZodUnionContainer, any, array, bigint, boolean, date, email, enum_, isSchema, literal, never, nullish, number, openapi, optional, parse, schemify, string, symbol, union, unknown, uri, uuid, validate };
|
|
131
|
+
export { SchemaValidator, TupleZodResolve, UnionZodResolve, ZodCatchall, ZodIdiomaticSchema, ZodRecordKey, ZodResolve, ZodSchemaValidator, ZodTupleContainer, ZodUnionContainer, any, array, bigint, boolean, date, email, enum_, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|