@forklaunch/validator 0.6.9 → 0.6.10
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 +1 -1
- package/lib/__test__/utils/mockSchemaValidator.d.ts +1 -1
- package/lib/index.d.mts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/{schema.types-Df9EB_Ke.d.mts → schema.types-BbvfIwCw.d.mts} +2 -0
- package/lib/{schema.types-Df9EB_Ke.d.ts → schema.types-BbvfIwCw.d.ts} +2 -0
- package/lib/src/typebox/index.d.mts +7 -3
- package/lib/src/typebox/index.d.ts +7 -3
- package/lib/src/typebox/index.js +7 -3
- package/lib/src/typebox/index.mjs +6 -3
- package/lib/src/zod/index.d.mts +7 -3
- package/lib/src/zod/index.d.ts +7 -3
- package/lib/src/zod/index.js +8 -4
- package/lib/src/zod/index.mjs +7 -4
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
|
-
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-
|
|
2
|
+
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-BbvfIwCw.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
2
|
-
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-
|
|
2
|
+
import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-BbvfIwCw.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParseError } from './schema.types-
|
|
2
|
-
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-
|
|
1
|
+
import { P as ParseError } from './schema.types-BbvfIwCw.mjs';
|
|
2
|
+
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-BbvfIwCw.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ParseError } from './schema.types-
|
|
2
|
-
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-
|
|
1
|
+
import { P as ParseError } from './schema.types-BbvfIwCw.js';
|
|
2
|
+
export { A as AnySchemaValidator, I as IdiomaticSchema, e as Increment, K as KeyTypes, L as LiteralSchema, a as ParseResult, d as Schema, b as SchemaResolve, c as SchemaTranslate, S as SchemaValidator, U as UnboxedObjectSchema } from './schema.types-BbvfIwCw.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -41,6 +41,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObj
|
|
|
41
41
|
never: TNever;
|
|
42
42
|
binary: TTransform<TString, Uint8Array>;
|
|
43
43
|
file: TTransform<TString, (name: string, type: MimeType) => File>;
|
|
44
|
+
type: <T>() => T;
|
|
44
45
|
/**
|
|
45
46
|
* Extracts the error type of a schema for error messages.
|
|
46
47
|
*
|
|
@@ -251,6 +252,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObjec
|
|
|
251
252
|
never: z.ZodNever;
|
|
252
253
|
binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBufferLike>, string>;
|
|
253
254
|
file: z.ZodEffects<z.ZodString, (name: string, type: MimeType) => File, string>;
|
|
255
|
+
type: <T>() => ZodType<T>;
|
|
254
256
|
/**
|
|
255
257
|
* Compiles schema if this exists, for optimal performance.
|
|
256
258
|
*
|
|
@@ -41,6 +41,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObj
|
|
|
41
41
|
never: TNever;
|
|
42
42
|
binary: TTransform<TString, Uint8Array>;
|
|
43
43
|
file: TTransform<TString, (name: string, type: MimeType) => File>;
|
|
44
|
+
type: <T>() => T;
|
|
44
45
|
/**
|
|
45
46
|
* Extracts the error type of a schema for error messages.
|
|
46
47
|
*
|
|
@@ -251,6 +252,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObjec
|
|
|
251
252
|
never: z.ZodNever;
|
|
252
253
|
binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBufferLike>, string>;
|
|
253
254
|
file: z.ZodEffects<z.ZodString, (name: string, type: MimeType) => File, string>;
|
|
255
|
+
type: <T>() => ZodType<T>;
|
|
254
256
|
/**
|
|
255
257
|
* Compiles schema if this exists, for optimal performance.
|
|
256
258
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TypeboxSchemaValidator } from '../../schema.types-
|
|
2
|
-
export { f as TCatchall, l as TIdiomaticSchema, i as TObject, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-
|
|
1
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-BbvfIwCw.mjs';
|
|
2
|
+
export { f as TCatchall, l as TIdiomaticSchema, i as TObject, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-BbvfIwCw.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -84,6 +84,10 @@ declare const binary: typeof StaticSchemaValidator.binary;
|
|
|
84
84
|
* TypeBox schema definition for file type.
|
|
85
85
|
*/
|
|
86
86
|
declare const file: typeof StaticSchemaValidator.file;
|
|
87
|
+
/**
|
|
88
|
+
* TypeBox schema definition for type type.
|
|
89
|
+
*/
|
|
90
|
+
declare const type: typeof StaticSchemaValidator.type;
|
|
87
91
|
/**
|
|
88
92
|
* Transforms valid schema into TypeBox schema.
|
|
89
93
|
*/
|
|
@@ -137,4 +141,4 @@ declare const parse: typeof StaticSchemaValidator.parse;
|
|
|
137
141
|
*/
|
|
138
142
|
declare const openapi: typeof StaticSchemaValidator.openapi;
|
|
139
143
|
|
|
140
|
-
export { SchemaValidator, TypeboxSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
|
144
|
+
export { SchemaValidator, TypeboxSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, type, undefined_, union, unknown, uri, uuid, validate, void_ };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TypeboxSchemaValidator } from '../../schema.types-
|
|
2
|
-
export { f as TCatchall, l as TIdiomaticSchema, i as TObject, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-
|
|
1
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-BbvfIwCw.js';
|
|
2
|
+
export { f as TCatchall, l as TIdiomaticSchema, i as TObject, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-BbvfIwCw.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -84,6 +84,10 @@ declare const binary: typeof StaticSchemaValidator.binary;
|
|
|
84
84
|
* TypeBox schema definition for file type.
|
|
85
85
|
*/
|
|
86
86
|
declare const file: typeof StaticSchemaValidator.file;
|
|
87
|
+
/**
|
|
88
|
+
* TypeBox schema definition for type type.
|
|
89
|
+
*/
|
|
90
|
+
declare const type: typeof StaticSchemaValidator.type;
|
|
87
91
|
/**
|
|
88
92
|
* Transforms valid schema into TypeBox schema.
|
|
89
93
|
*/
|
|
@@ -137,4 +141,4 @@ declare const parse: typeof StaticSchemaValidator.parse;
|
|
|
137
141
|
*/
|
|
138
142
|
declare const openapi: typeof StaticSchemaValidator.openapi;
|
|
139
143
|
|
|
140
|
-
export { SchemaValidator, TypeboxSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
|
144
|
+
export { SchemaValidator, TypeboxSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, type, undefined_, union, unknown, uri, uuid, validate, void_ };
|
package/lib/src/typebox/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __export(typebox_exports, {
|
|
|
45
45
|
schemify: () => schemify,
|
|
46
46
|
string: () => string,
|
|
47
47
|
symbol: () => symbol,
|
|
48
|
+
type: () => type,
|
|
48
49
|
undefined_: () => undefined_,
|
|
49
50
|
union: () => union,
|
|
50
51
|
unknown: () => unknown,
|
|
@@ -260,8 +261,9 @@ var TypeboxSchemaValidator = class {
|
|
|
260
261
|
title: "File"
|
|
261
262
|
})
|
|
262
263
|
).Decode(
|
|
263
|
-
(value) => (name,
|
|
264
|
+
(value) => (name, type2) => new import_common.InMemoryFile(value, name, { type: type2 })
|
|
264
265
|
).Encode((value) => value("name", "type").content);
|
|
266
|
+
type = () => this.any;
|
|
265
267
|
/**
|
|
266
268
|
* Extracts the error type of a schema for error messages.
|
|
267
269
|
*
|
|
@@ -411,8 +413,8 @@ var TypeboxSchemaValidator = class {
|
|
|
411
413
|
* @param {TCatchall} type - The schema to check against.
|
|
412
414
|
* @returns {boolean} True if the value is an instance of the schema.
|
|
413
415
|
*/
|
|
414
|
-
isInstanceOf(value,
|
|
415
|
-
return typeof value === "object" && value != null && import_typebox.Kind in value && value[import_typebox.Kind] ===
|
|
416
|
+
isInstanceOf(value, type2) {
|
|
417
|
+
return typeof value === "object" && value != null && import_typebox.Kind in value && value[import_typebox.Kind] === type2[import_typebox.Kind];
|
|
416
418
|
}
|
|
417
419
|
/**
|
|
418
420
|
* Validate a value against a schema.
|
|
@@ -544,6 +546,7 @@ var unknown = StaticSchemaValidator.unknown;
|
|
|
544
546
|
var never = StaticSchemaValidator.never;
|
|
545
547
|
var binary = StaticSchemaValidator.binary;
|
|
546
548
|
var file = StaticSchemaValidator.file;
|
|
549
|
+
var type = StaticSchemaValidator.type;
|
|
547
550
|
var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
548
551
|
var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
549
552
|
var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
@@ -584,6 +587,7 @@ var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
|
|
|
584
587
|
schemify,
|
|
585
588
|
string,
|
|
586
589
|
symbol,
|
|
590
|
+
type,
|
|
587
591
|
undefined_,
|
|
588
592
|
union,
|
|
589
593
|
unknown,
|
|
@@ -212,8 +212,9 @@ var TypeboxSchemaValidator = class {
|
|
|
212
212
|
title: "File"
|
|
213
213
|
})
|
|
214
214
|
).Decode(
|
|
215
|
-
(value) => (name,
|
|
215
|
+
(value) => (name, type2) => new InMemoryFile(value, name, { type: type2 })
|
|
216
216
|
).Encode((value) => value("name", "type").content);
|
|
217
|
+
type = () => this.any;
|
|
217
218
|
/**
|
|
218
219
|
* Extracts the error type of a schema for error messages.
|
|
219
220
|
*
|
|
@@ -363,8 +364,8 @@ var TypeboxSchemaValidator = class {
|
|
|
363
364
|
* @param {TCatchall} type - The schema to check against.
|
|
364
365
|
* @returns {boolean} True if the value is an instance of the schema.
|
|
365
366
|
*/
|
|
366
|
-
isInstanceOf(value,
|
|
367
|
-
return typeof value === "object" && value != null && Kind in value && value[Kind] ===
|
|
367
|
+
isInstanceOf(value, type2) {
|
|
368
|
+
return typeof value === "object" && value != null && Kind in value && value[Kind] === type2[Kind];
|
|
368
369
|
}
|
|
369
370
|
/**
|
|
370
371
|
* Validate a value against a schema.
|
|
@@ -496,6 +497,7 @@ var unknown = StaticSchemaValidator.unknown;
|
|
|
496
497
|
var never = StaticSchemaValidator.never;
|
|
497
498
|
var binary = StaticSchemaValidator.binary;
|
|
498
499
|
var file = StaticSchemaValidator.file;
|
|
500
|
+
var type = StaticSchemaValidator.type;
|
|
499
501
|
var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
500
502
|
var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
501
503
|
var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
@@ -535,6 +537,7 @@ export {
|
|
|
535
537
|
schemify,
|
|
536
538
|
string,
|
|
537
539
|
symbol,
|
|
540
|
+
type,
|
|
538
541
|
undefined_,
|
|
539
542
|
union,
|
|
540
543
|
unknown,
|
package/lib/src/zod/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as ZodSchemaValidator } from '../../schema.types-
|
|
2
|
-
export { x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, p as ZodCatchall, v as ZodIdiomaticSchema, s as ZodObject, r as ZodObjectShape, q as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-
|
|
1
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-BbvfIwCw.mjs';
|
|
2
|
+
export { x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, p as ZodCatchall, v as ZodIdiomaticSchema, s as ZodObject, r as ZodObjectShape, q as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-BbvfIwCw.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -84,6 +84,10 @@ declare const binary: typeof StaticSchemaValidator.binary;
|
|
|
84
84
|
* Zod schema definition for file type.
|
|
85
85
|
*/
|
|
86
86
|
declare const file: typeof StaticSchemaValidator.file;
|
|
87
|
+
/**
|
|
88
|
+
* Zod schema definition for type type.
|
|
89
|
+
*/
|
|
90
|
+
declare const type: typeof StaticSchemaValidator.type;
|
|
87
91
|
/**
|
|
88
92
|
* Transforms valid schema into Zod schema.
|
|
89
93
|
*/
|
|
@@ -137,4 +141,4 @@ declare const parse: typeof StaticSchemaValidator.parse;
|
|
|
137
141
|
*/
|
|
138
142
|
declare const openapi: typeof StaticSchemaValidator.openapi;
|
|
139
143
|
|
|
140
|
-
export { SchemaValidator, ZodSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
|
144
|
+
export { SchemaValidator, ZodSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, type, undefined_, union, unknown, uri, uuid, validate, void_ };
|
package/lib/src/zod/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as ZodSchemaValidator } from '../../schema.types-
|
|
2
|
-
export { x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, p as ZodCatchall, v as ZodIdiomaticSchema, s as ZodObject, r as ZodObjectShape, q as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-
|
|
1
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-BbvfIwCw.js';
|
|
2
|
+
export { x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, p as ZodCatchall, v as ZodIdiomaticSchema, s as ZodObject, r as ZodObjectShape, q as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-BbvfIwCw.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
@@ -84,6 +84,10 @@ declare const binary: typeof StaticSchemaValidator.binary;
|
|
|
84
84
|
* Zod schema definition for file type.
|
|
85
85
|
*/
|
|
86
86
|
declare const file: typeof StaticSchemaValidator.file;
|
|
87
|
+
/**
|
|
88
|
+
* Zod schema definition for type type.
|
|
89
|
+
*/
|
|
90
|
+
declare const type: typeof StaticSchemaValidator.type;
|
|
87
91
|
/**
|
|
88
92
|
* Transforms valid schema into Zod schema.
|
|
89
93
|
*/
|
|
@@ -137,4 +141,4 @@ declare const parse: typeof StaticSchemaValidator.parse;
|
|
|
137
141
|
*/
|
|
138
142
|
declare const openapi: typeof StaticSchemaValidator.openapi;
|
|
139
143
|
|
|
140
|
-
export { SchemaValidator, ZodSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, undefined_, union, unknown, uri, uuid, validate, void_ };
|
|
144
|
+
export { SchemaValidator, ZodSchemaValidator, any, array, bigint, binary, boolean, date, email, enum_, file, function_, isSchema, literal, never, null_, nullish, number, openapi, optional, parse, promise, record, schemify, string, symbol, type, undefined_, union, unknown, uri, uuid, validate, void_ };
|
package/lib/src/zod/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __export(zod_exports, {
|
|
|
45
45
|
schemify: () => schemify,
|
|
46
46
|
string: () => string,
|
|
47
47
|
symbol: () => symbol,
|
|
48
|
+
type: () => type,
|
|
48
49
|
undefined_: () => undefined_,
|
|
49
50
|
union: () => union,
|
|
50
51
|
unknown: () => unknown,
|
|
@@ -193,8 +194,8 @@ var ZodSchemaValidator = class {
|
|
|
193
194
|
example: "a utf-8 encodable string"
|
|
194
195
|
});
|
|
195
196
|
file = import_zod.z.string().transform((val) => {
|
|
196
|
-
return (name,
|
|
197
|
-
type,
|
|
197
|
+
return (name, type2) => new File([val], name, {
|
|
198
|
+
type: type2,
|
|
198
199
|
lastModified: Date.now()
|
|
199
200
|
});
|
|
200
201
|
}).openapi({
|
|
@@ -203,6 +204,7 @@ var ZodSchemaValidator = class {
|
|
|
203
204
|
format: "binary",
|
|
204
205
|
example: "a utf-8 encodable string"
|
|
205
206
|
});
|
|
207
|
+
type = () => this.any;
|
|
206
208
|
/**
|
|
207
209
|
* Compiles schema if this exists, for optimal performance.
|
|
208
210
|
*
|
|
@@ -325,8 +327,8 @@ var ZodSchemaValidator = class {
|
|
|
325
327
|
* @param {ZodType} type - The schema to check against.
|
|
326
328
|
* @returns {boolean} True if the value is an instance of the schema.
|
|
327
329
|
*/
|
|
328
|
-
isInstanceOf(value,
|
|
329
|
-
return this.isSchema(value) &&
|
|
330
|
+
isInstanceOf(value, type2) {
|
|
331
|
+
return this.isSchema(value) && type2._def.typeName === value._def.typeName;
|
|
330
332
|
}
|
|
331
333
|
/**
|
|
332
334
|
* Validate a value against a schema.
|
|
@@ -405,6 +407,7 @@ var unknown = StaticSchemaValidator.unknown;
|
|
|
405
407
|
var never = StaticSchemaValidator.never;
|
|
406
408
|
var binary = StaticSchemaValidator.binary;
|
|
407
409
|
var file = StaticSchemaValidator.file;
|
|
410
|
+
var type = StaticSchemaValidator.type;
|
|
408
411
|
var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
409
412
|
var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
410
413
|
var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
@@ -445,6 +448,7 @@ var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
|
|
|
445
448
|
schemify,
|
|
446
449
|
string,
|
|
447
450
|
symbol,
|
|
451
|
+
type,
|
|
448
452
|
undefined_,
|
|
449
453
|
union,
|
|
450
454
|
unknown,
|
package/lib/src/zod/index.mjs
CHANGED
|
@@ -139,8 +139,8 @@ var ZodSchemaValidator = class {
|
|
|
139
139
|
example: "a utf-8 encodable string"
|
|
140
140
|
});
|
|
141
141
|
file = z.string().transform((val) => {
|
|
142
|
-
return (name,
|
|
143
|
-
type,
|
|
142
|
+
return (name, type2) => new File([val], name, {
|
|
143
|
+
type: type2,
|
|
144
144
|
lastModified: Date.now()
|
|
145
145
|
});
|
|
146
146
|
}).openapi({
|
|
@@ -149,6 +149,7 @@ var ZodSchemaValidator = class {
|
|
|
149
149
|
format: "binary",
|
|
150
150
|
example: "a utf-8 encodable string"
|
|
151
151
|
});
|
|
152
|
+
type = () => this.any;
|
|
152
153
|
/**
|
|
153
154
|
* Compiles schema if this exists, for optimal performance.
|
|
154
155
|
*
|
|
@@ -271,8 +272,8 @@ var ZodSchemaValidator = class {
|
|
|
271
272
|
* @param {ZodType} type - The schema to check against.
|
|
272
273
|
* @returns {boolean} True if the value is an instance of the schema.
|
|
273
274
|
*/
|
|
274
|
-
isInstanceOf(value,
|
|
275
|
-
return this.isSchema(value) &&
|
|
275
|
+
isInstanceOf(value, type2) {
|
|
276
|
+
return this.isSchema(value) && type2._def.typeName === value._def.typeName;
|
|
276
277
|
}
|
|
277
278
|
/**
|
|
278
279
|
* Validate a value against a schema.
|
|
@@ -351,6 +352,7 @@ var unknown = StaticSchemaValidator.unknown;
|
|
|
351
352
|
var never = StaticSchemaValidator.never;
|
|
352
353
|
var binary = StaticSchemaValidator.binary;
|
|
353
354
|
var file = StaticSchemaValidator.file;
|
|
355
|
+
var type = StaticSchemaValidator.type;
|
|
354
356
|
var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
|
|
355
357
|
var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
|
|
356
358
|
var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
|
|
@@ -390,6 +392,7 @@ export {
|
|
|
390
392
|
schemify,
|
|
391
393
|
string,
|
|
392
394
|
symbol,
|
|
395
|
+
type,
|
|
393
396
|
undefined_,
|
|
394
397
|
union,
|
|
395
398
|
unknown,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/validator",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "Schema validator for ForkLaunch components.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@anatine/zod-openapi": "^2.2.8",
|
|
62
62
|
"@sinclair/typebox": "^0.34.33",
|
|
63
|
-
"zod": "^3.25.
|
|
64
|
-
"@forklaunch/common": "0.3.
|
|
63
|
+
"zod": "^3.25.61",
|
|
64
|
+
"@forklaunch/common": "0.3.10"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@eslint/js": "^9.28.0",
|
|
68
68
|
"@types/jest": "^29.5.14",
|
|
69
69
|
"@types/node": "^24.0.0",
|
|
70
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
70
|
+
"@typescript/native-preview": "7.0.0-dev.20250611.1",
|
|
71
71
|
"@vitest/coverage-v8": "^3.2.3",
|
|
72
72
|
"eslint-config-prettier": "^10.1.5",
|
|
73
73
|
"eslint-plugin-prettier": "^5.4.1",
|