@forklaunch/validator 0.6.16 → 0.7.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.
@@ -1,18 +1,10 @@
1
1
  import { SchemaObject } from 'openapi3-ts/oas31';
2
- import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-CDVoqb4z.mjs';
2
+ import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-DuGvAboK.mjs';
3
3
  import '@forklaunch/common';
4
4
  import '@sinclair/typebox';
5
5
  import '@sinclair/typebox/compiler';
6
6
  import 'zod';
7
7
 
8
- declare module '@forklaunch/validator' {
9
- interface SchemaResolve<T> {
10
- Mock: T;
11
- }
12
- interface SchemaTranslate<T> {
13
- Mock: T;
14
- }
15
- }
16
8
  /**
17
9
  * Creates a union type string from an array of string literals.
18
10
  *
@@ -1,18 +1,10 @@
1
1
  import { SchemaObject } from 'openapi3-ts/oas31';
2
- import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-CDVoqb4z.js';
2
+ import { S as SchemaValidator, L as LiteralSchema, a as ParseResult } from '../../schema.types-DuGvAboK.js';
3
3
  import '@forklaunch/common';
4
4
  import '@sinclair/typebox';
5
5
  import '@sinclair/typebox/compiler';
6
6
  import 'zod';
7
7
 
8
- declare module '@forklaunch/validator' {
9
- interface SchemaResolve<T> {
10
- Mock: T;
11
- }
12
- interface SchemaTranslate<T> {
13
- Mock: T;
14
- }
15
- }
16
8
  /**
17
9
  * Creates a union type string from an array of string literals.
18
10
  *
package/lib/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ParseError } from './schema.types-CDVoqb4z.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-CDVoqb4z.mjs';
1
+ import { P as ParseError } from './schema.types-DuGvAboK.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-DuGvAboK.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-CDVoqb4z.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-CDVoqb4z.js';
1
+ import { P as ParseError } from './schema.types-DuGvAboK.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-DuGvAboK.js';
3
3
  import '@forklaunch/common';
4
4
  import 'openapi3-ts/oas31';
5
5
  import '@sinclair/typebox';
@@ -1,6 +1,6 @@
1
- import { MimeType, Prettify } from '@forklaunch/common';
1
+ import { Prettify } from '@forklaunch/common';
2
2
  import { SchemaObject } from 'openapi3-ts/oas31';
3
- import { TProperties, TOptional, TArray, TUnion, TLiteral, TFunction, TRecord, TPromise, TSchema, TString, TTransform, TNumber, TBoolean, TNull, TBigInt, TDate, TSymbol, TVoid, TUndefined, TAny, TUnknown, TNever, TKind, TObject as TObject$1, StaticDecode } from '@sinclair/typebox';
3
+ import { TProperties, TOptional, TArray, TUnion, TLiteral, TFunction, TRecord, TPromise, TSchema, TString, TTransform, TNumber, TBoolean, TNull, TBigInt, TDate, TSymbol, TVoid, TUndefined, TAny, TUnknown, TNever, TKind, TObject, StaticDecode } from '@sinclair/typebox';
4
4
  import { TypeCheck } from '@sinclair/typebox/compiler';
5
5
  import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodFunction, ZodTuple, ZodRecord, ZodPromise, ZodType, z, ZodUnknown, ZodPipeline, ZodTypeAny, ZodEffects, ZodNever } from 'zod';
6
6
 
@@ -15,14 +15,14 @@ import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion,
15
15
  * Class representing a TypeBox schema definition.
16
16
  * @implements {SchemaValidator}
17
17
  */
18
- declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObject<TProperties>>(schema: T) => TypeCheck<T>), <T extends TIdiomaticSchema>(schema: T) => TResolve<T>, <T extends TIdiomaticSchema>(schema: T) => TOptional<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => TArray<TResolve<T>>, <T extends TUnionTupleContainer>(schemas: [...T]) => TUnion<UnionTupleTResolve<T>>, <T extends LiteralSchema>(value: T) => TLiteral<T>, <T extends Record<string, LiteralSchema>>(schemaEnum: T) => TUnion<[
18
+ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends SafeTObject<TProperties>>(schema: T) => TypeCheck<T>), <T extends TIdiomaticSchema>(schema: T) => TResolve<T>, <T extends TIdiomaticSchema>(schema: T) => TOptional<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => TArray<TResolve<T>>, <T extends TUnionTupleContainer>(schemas: [...T]) => TUnion<UnionTupleTResolve<T>>, <T extends LiteralSchema>(value: T) => TLiteral<T>, <T extends Record<string, LiteralSchema>>(schemaEnum: T) => TUnion<[
19
19
  {
20
20
  [K in keyof T]: TLiteral<T[K]>;
21
21
  }[keyof T]
22
22
  ]>, <Args extends TUnionTupleContainer, ReturnType extends TIdiomaticSchema>(args: [...Args], returnType: ReturnType) => TFunction<UnionTupleTResolve<Args>, TResolve<ReturnType>>, <Key extends TIdiomaticSchema, Value extends TIdiomaticSchema>(key: Key, value: Value) => TRecord<TResolve<Key>, TResolve<Value>>, <T extends TIdiomaticSchema>(schema: T) => TPromise<TResolve<T>>, (value: unknown) => value is TSchema, <T extends TCatchall>(value: object, type: T) => value is T, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => boolean, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => ParseResult<TSchemaTranslate<TResolve<T>>>, <T extends TIdiomaticSchema | TCatchall>(schema: T) => SchemaObject> {
23
23
  _Type: "TypeBox";
24
24
  _SchemaCatchall: TCatchall;
25
- _ValidSchemaObject: TObject<TProperties> | TArray<TObject<TProperties>>;
25
+ _ValidSchemaObject: SafeTObject<TProperties> | TArray<SafeTObject<TProperties>>;
26
26
  string: TString;
27
27
  uuid: TString;
28
28
  email: TString;
@@ -40,7 +40,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObj
40
40
  unknown: TUnknown;
41
41
  never: TNever;
42
42
  binary: TTransform<TString, Uint8Array>;
43
- file: TTransform<TString, (name: string, type: MimeType) => File>;
43
+ file: TTransform<TString, Blob>;
44
44
  type: <T>() => TTransform<TAny, T>;
45
45
  /**
46
46
  * Extracts the error type of a schema for error messages.
@@ -55,7 +55,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObj
55
55
  * @param {TObject<TProperties>} schema - The schema to compile.
56
56
  * @returns {TypeCheck<T>} - The compiled schema.
57
57
  */
58
- compile<T extends TObject<TProperties>>(schema: T): TypeCheck<T>;
58
+ compile<T extends SafeTObject<TProperties>>(schema: T): TypeCheck<T>;
59
59
  /**
60
60
  * Convert a schema to a TypeBox schema.
61
61
  * @param {TIdiomaticSchema} schema - The schema to convert.
@@ -175,7 +175,7 @@ type TObjectShape = TProperties;
175
175
  *
176
176
  * @template T - The type to check and possibly convert to an object schema.
177
177
  */
178
- type TObject<T> = T extends TObjectShape ? TObject$1<T> : TNever;
178
+ type SafeTObject<T> = T extends TObjectShape ? TObject<T> : TNever;
179
179
  /**
180
180
  * Translates a schema type T to its static type if T extends TCatchall. Otherwise, it returns TNever.
181
181
  *
@@ -211,7 +211,7 @@ type UnionTupleTResolve<T extends TUnionTupleContainer, Acc extends TIdiomaticSc
211
211
  * @template T - The schema type to resolve.
212
212
  * @template Depth - The current depth of the resolution.
213
213
  */
214
- type TResolve<T, Depth extends number = 0> = Depth extends 12 ? TUnknown : T extends LiteralSchema ? TLiteral<T> : T extends TSchema ? T : T extends TKind ? T : T extends UnboxedTObjectSchema ? TObject<{
214
+ type TResolve<T, Depth extends number = 0> = Depth extends 12 ? TUnknown : T extends LiteralSchema ? TLiteral<T> : T extends TSchema ? T : T extends TKind ? T : T extends UnboxedTObjectSchema ? SafeTObject<{
215
215
  [K in keyof T]: TResolve<T[K], Increment<Depth>>;
216
216
  }> extends infer R ? R : TNever : T extends TypeCheck<infer Type> ? TResolve<Type, Increment<Depth>> : TNever;
217
217
 
@@ -251,7 +251,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObjec
251
251
  unknown: z.ZodUnknown;
252
252
  never: z.ZodNever;
253
253
  binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBufferLike>, string>;
254
- file: z.ZodEffects<z.ZodString, (name: string, type: MimeType) => File, string>;
254
+ file: z.ZodEffects<z.ZodString, Blob, string>;
255
255
  type: <T>() => ZodType<T>;
256
256
  /**
257
257
  * Compiles schema if this exists, for optimal performance.
@@ -438,7 +438,7 @@ type UnionZodResolve<T extends ZodUnionContainer> = T extends [
438
438
  * @template T - The Zod schema type to resolve.
439
439
  * @template Depth - The current depth of the resolution.
440
440
  */
441
- type ZodResolve<T, Depth extends number = 0> = Depth extends 29 ? ZodUnknown : T extends ZodPipeline<ZodTypeAny, infer R> ? R : T extends ZodEffects<infer R> ? R : T extends LiteralSchema ? ZodLiteral<T> : T extends ZodType ? T : T extends UnboxedZodObjectSchema ? ZodObject<{
441
+ type ZodResolve<T, Depth extends number = 0> = Depth extends 28 ? ZodUnknown : T extends ZodPipeline<ZodTypeAny, infer R> ? R : T extends ZodEffects<infer R> ? R : T extends LiteralSchema ? ZodLiteral<T> : T extends ZodType ? T : T extends UnboxedZodObjectSchema ? ZodObject<{
442
442
  [K in keyof T]: ZodResolve<T[K], Increment<Depth>>;
443
443
  }> extends infer R ? R : ZodNever : ZodNever;
444
444
  /**
@@ -685,6 +685,10 @@ interface SchemaResolve<T> {
685
685
  * Schema resolution for TypeBox.
686
686
  */
687
687
  TypeBox: TResolve<T>;
688
+ /**
689
+ * Mock schema resolution.
690
+ */
691
+ Mock: T;
688
692
  }
689
693
  /**
690
694
  * Interface representing schema translation for different validation libraries.
@@ -700,6 +704,10 @@ interface SchemaTranslate<T> {
700
704
  * Schema translation for TypeBox.
701
705
  */
702
706
  TypeBox: TSchemaTranslate<T>;
707
+ /**
708
+ * Mock schema translation.
709
+ */
710
+ Mock: T;
703
711
  }
704
712
  /**
705
713
  * Type representing the prettified schema translation.
@@ -707,7 +715,7 @@ interface SchemaTranslate<T> {
707
715
  * @template T - The type of the schema to translate.
708
716
  * @template SV - The type of the schema validator.
709
717
  */
710
- type SchemaPrettify<T, SV extends AnySchemaValidator> = Prettify<SchemaTranslate<T>[SV['_Type']]>;
718
+ type SchemaPrettify<T, SV extends AnySchemaValidator> = SchemaTranslate<T>[SV['_Type']] extends infer Schema ? Schema extends Blob | Uint8Array ? Schema : Prettify<Schema> : never;
711
719
  /**
712
720
  * Type representing a schema, which can be a valid schema object or an idiomatic schema.
713
721
  *
@@ -744,4 +752,4 @@ type Increment<T extends number> = T extends 0 ? 1 : T extends 1 ? 2 : T extends
744
752
  */
745
753
  type KeyTypes = string | number;
746
754
 
747
- export { type AnySchemaValidator as A, type ZodResolve as B, type ZodRecordKey as C, type IdiomaticSchema as I, type KeyTypes as K, type LiteralSchema as L, type ParseError as P, type SchemaValidator as S, TypeboxSchemaValidator as T, type UnboxedObjectSchema as U, ZodSchemaValidator as Z, type ParseResult as a, type SchemaResolve as b, type SchemaTranslate as c, type Schema as d, type Increment as e, type TCatchall as f, type TOuterArray as g, type TObjectShape as h, type TObject as i, type TSchemaTranslate as j, type UnboxedTObjectSchema as k, type TIdiomaticSchema as l, type TUnionTupleContainer as m, type UnionTupleTResolve as n, type TResolve as o, type ZodObject as p, type ZodCatchall as q, type ZodOuterArray as r, type ZodObjectShape as s, type ZodSchemaTranslate as t, type UnboxedZodObjectSchema as u, type ZodIdiomaticSchema as v, type ZodTupleContainer as w, type TupleZodResolve as x, type ZodUnionContainer as y, type UnionZodResolve as z };
755
+ export { type AnySchemaValidator as A, type ZodRecordKey as B, type IdiomaticSchema as I, type KeyTypes as K, type LiteralSchema as L, type ParseError as P, type SchemaValidator as S, TypeboxSchemaValidator as T, type UnboxedObjectSchema as U, ZodSchemaValidator as Z, type ParseResult as a, type SchemaResolve as b, type SchemaTranslate as c, type Schema as d, type Increment as e, type TCatchall as f, type TOuterArray as g, type TObjectShape as h, type SafeTObject as i, type TSchemaTranslate as j, type UnboxedTObjectSchema as k, type TIdiomaticSchema as l, type TUnionTupleContainer as m, type UnionTupleTResolve as n, type TResolve as o, type ZodCatchall as p, type ZodOuterArray as q, type ZodObjectShape as r, type ZodSchemaTranslate as s, type UnboxedZodObjectSchema as t, type ZodIdiomaticSchema as u, type ZodTupleContainer as v, type TupleZodResolve as w, type ZodUnionContainer as x, type UnionZodResolve as y, type ZodResolve as z };
@@ -1,6 +1,6 @@
1
- import { MimeType, Prettify } from '@forklaunch/common';
1
+ import { Prettify } from '@forklaunch/common';
2
2
  import { SchemaObject } from 'openapi3-ts/oas31';
3
- import { TProperties, TOptional, TArray, TUnion, TLiteral, TFunction, TRecord, TPromise, TSchema, TString, TTransform, TNumber, TBoolean, TNull, TBigInt, TDate, TSymbol, TVoid, TUndefined, TAny, TUnknown, TNever, TKind, TObject as TObject$1, StaticDecode } from '@sinclair/typebox';
3
+ import { TProperties, TOptional, TArray, TUnion, TLiteral, TFunction, TRecord, TPromise, TSchema, TString, TTransform, TNumber, TBoolean, TNull, TBigInt, TDate, TSymbol, TVoid, TUndefined, TAny, TUnknown, TNever, TKind, TObject, StaticDecode } from '@sinclair/typebox';
4
4
  import { TypeCheck } from '@sinclair/typebox/compiler';
5
5
  import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodFunction, ZodTuple, ZodRecord, ZodPromise, ZodType, z, ZodUnknown, ZodPipeline, ZodTypeAny, ZodEffects, ZodNever } from 'zod';
6
6
 
@@ -15,14 +15,14 @@ import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion,
15
15
  * Class representing a TypeBox schema definition.
16
16
  * @implements {SchemaValidator}
17
17
  */
18
- declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObject<TProperties>>(schema: T) => TypeCheck<T>), <T extends TIdiomaticSchema>(schema: T) => TResolve<T>, <T extends TIdiomaticSchema>(schema: T) => TOptional<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => TArray<TResolve<T>>, <T extends TUnionTupleContainer>(schemas: [...T]) => TUnion<UnionTupleTResolve<T>>, <T extends LiteralSchema>(value: T) => TLiteral<T>, <T extends Record<string, LiteralSchema>>(schemaEnum: T) => TUnion<[
18
+ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends SafeTObject<TProperties>>(schema: T) => TypeCheck<T>), <T extends TIdiomaticSchema>(schema: T) => TResolve<T>, <T extends TIdiomaticSchema>(schema: T) => TOptional<TResolve<T>>, <T extends TIdiomaticSchema>(schema: T) => TArray<TResolve<T>>, <T extends TUnionTupleContainer>(schemas: [...T]) => TUnion<UnionTupleTResolve<T>>, <T extends LiteralSchema>(value: T) => TLiteral<T>, <T extends Record<string, LiteralSchema>>(schemaEnum: T) => TUnion<[
19
19
  {
20
20
  [K in keyof T]: TLiteral<T[K]>;
21
21
  }[keyof T]
22
22
  ]>, <Args extends TUnionTupleContainer, ReturnType extends TIdiomaticSchema>(args: [...Args], returnType: ReturnType) => TFunction<UnionTupleTResolve<Args>, TResolve<ReturnType>>, <Key extends TIdiomaticSchema, Value extends TIdiomaticSchema>(key: Key, value: Value) => TRecord<TResolve<Key>, TResolve<Value>>, <T extends TIdiomaticSchema>(schema: T) => TPromise<TResolve<T>>, (value: unknown) => value is TSchema, <T extends TCatchall>(value: object, type: T) => value is T, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => boolean, <T extends TIdiomaticSchema | TCatchall>(schema: T, value: unknown) => ParseResult<TSchemaTranslate<TResolve<T>>>, <T extends TIdiomaticSchema | TCatchall>(schema: T) => SchemaObject> {
23
23
  _Type: "TypeBox";
24
24
  _SchemaCatchall: TCatchall;
25
- _ValidSchemaObject: TObject<TProperties> | TArray<TObject<TProperties>>;
25
+ _ValidSchemaObject: SafeTObject<TProperties> | TArray<SafeTObject<TProperties>>;
26
26
  string: TString;
27
27
  uuid: TString;
28
28
  email: TString;
@@ -40,7 +40,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObj
40
40
  unknown: TUnknown;
41
41
  never: TNever;
42
42
  binary: TTransform<TString, Uint8Array>;
43
- file: TTransform<TString, (name: string, type: MimeType) => File>;
43
+ file: TTransform<TString, Blob>;
44
44
  type: <T>() => TTransform<TAny, T>;
45
45
  /**
46
46
  * Extracts the error type of a schema for error messages.
@@ -55,7 +55,7 @@ declare class TypeboxSchemaValidator implements SchemaValidator<(<T extends TObj
55
55
  * @param {TObject<TProperties>} schema - The schema to compile.
56
56
  * @returns {TypeCheck<T>} - The compiled schema.
57
57
  */
58
- compile<T extends TObject<TProperties>>(schema: T): TypeCheck<T>;
58
+ compile<T extends SafeTObject<TProperties>>(schema: T): TypeCheck<T>;
59
59
  /**
60
60
  * Convert a schema to a TypeBox schema.
61
61
  * @param {TIdiomaticSchema} schema - The schema to convert.
@@ -175,7 +175,7 @@ type TObjectShape = TProperties;
175
175
  *
176
176
  * @template T - The type to check and possibly convert to an object schema.
177
177
  */
178
- type TObject<T> = T extends TObjectShape ? TObject$1<T> : TNever;
178
+ type SafeTObject<T> = T extends TObjectShape ? TObject<T> : TNever;
179
179
  /**
180
180
  * Translates a schema type T to its static type if T extends TCatchall. Otherwise, it returns TNever.
181
181
  *
@@ -211,7 +211,7 @@ type UnionTupleTResolve<T extends TUnionTupleContainer, Acc extends TIdiomaticSc
211
211
  * @template T - The schema type to resolve.
212
212
  * @template Depth - The current depth of the resolution.
213
213
  */
214
- type TResolve<T, Depth extends number = 0> = Depth extends 12 ? TUnknown : T extends LiteralSchema ? TLiteral<T> : T extends TSchema ? T : T extends TKind ? T : T extends UnboxedTObjectSchema ? TObject<{
214
+ type TResolve<T, Depth extends number = 0> = Depth extends 12 ? TUnknown : T extends LiteralSchema ? TLiteral<T> : T extends TSchema ? T : T extends TKind ? T : T extends UnboxedTObjectSchema ? SafeTObject<{
215
215
  [K in keyof T]: TResolve<T[K], Increment<Depth>>;
216
216
  }> extends infer R ? R : TNever : T extends TypeCheck<infer Type> ? TResolve<Type, Increment<Depth>> : TNever;
217
217
 
@@ -251,7 +251,7 @@ declare class ZodSchemaValidator implements SchemaValidator<(<T extends ZodObjec
251
251
  unknown: z.ZodUnknown;
252
252
  never: z.ZodNever;
253
253
  binary: z.ZodEffects<z.ZodString, Uint8Array<ArrayBufferLike>, string>;
254
- file: z.ZodEffects<z.ZodString, (name: string, type: MimeType) => File, string>;
254
+ file: z.ZodEffects<z.ZodString, Blob, string>;
255
255
  type: <T>() => ZodType<T>;
256
256
  /**
257
257
  * Compiles schema if this exists, for optimal performance.
@@ -438,7 +438,7 @@ type UnionZodResolve<T extends ZodUnionContainer> = T extends [
438
438
  * @template T - The Zod schema type to resolve.
439
439
  * @template Depth - The current depth of the resolution.
440
440
  */
441
- type ZodResolve<T, Depth extends number = 0> = Depth extends 29 ? ZodUnknown : T extends ZodPipeline<ZodTypeAny, infer R> ? R : T extends ZodEffects<infer R> ? R : T extends LiteralSchema ? ZodLiteral<T> : T extends ZodType ? T : T extends UnboxedZodObjectSchema ? ZodObject<{
441
+ type ZodResolve<T, Depth extends number = 0> = Depth extends 28 ? ZodUnknown : T extends ZodPipeline<ZodTypeAny, infer R> ? R : T extends ZodEffects<infer R> ? R : T extends LiteralSchema ? ZodLiteral<T> : T extends ZodType ? T : T extends UnboxedZodObjectSchema ? ZodObject<{
442
442
  [K in keyof T]: ZodResolve<T[K], Increment<Depth>>;
443
443
  }> extends infer R ? R : ZodNever : ZodNever;
444
444
  /**
@@ -685,6 +685,10 @@ interface SchemaResolve<T> {
685
685
  * Schema resolution for TypeBox.
686
686
  */
687
687
  TypeBox: TResolve<T>;
688
+ /**
689
+ * Mock schema resolution.
690
+ */
691
+ Mock: T;
688
692
  }
689
693
  /**
690
694
  * Interface representing schema translation for different validation libraries.
@@ -700,6 +704,10 @@ interface SchemaTranslate<T> {
700
704
  * Schema translation for TypeBox.
701
705
  */
702
706
  TypeBox: TSchemaTranslate<T>;
707
+ /**
708
+ * Mock schema translation.
709
+ */
710
+ Mock: T;
703
711
  }
704
712
  /**
705
713
  * Type representing the prettified schema translation.
@@ -707,7 +715,7 @@ interface SchemaTranslate<T> {
707
715
  * @template T - The type of the schema to translate.
708
716
  * @template SV - The type of the schema validator.
709
717
  */
710
- type SchemaPrettify<T, SV extends AnySchemaValidator> = Prettify<SchemaTranslate<T>[SV['_Type']]>;
718
+ type SchemaPrettify<T, SV extends AnySchemaValidator> = SchemaTranslate<T>[SV['_Type']] extends infer Schema ? Schema extends Blob | Uint8Array ? Schema : Prettify<Schema> : never;
711
719
  /**
712
720
  * Type representing a schema, which can be a valid schema object or an idiomatic schema.
713
721
  *
@@ -744,4 +752,4 @@ type Increment<T extends number> = T extends 0 ? 1 : T extends 1 ? 2 : T extends
744
752
  */
745
753
  type KeyTypes = string | number;
746
754
 
747
- export { type AnySchemaValidator as A, type ZodResolve as B, type ZodRecordKey as C, type IdiomaticSchema as I, type KeyTypes as K, type LiteralSchema as L, type ParseError as P, type SchemaValidator as S, TypeboxSchemaValidator as T, type UnboxedObjectSchema as U, ZodSchemaValidator as Z, type ParseResult as a, type SchemaResolve as b, type SchemaTranslate as c, type Schema as d, type Increment as e, type TCatchall as f, type TOuterArray as g, type TObjectShape as h, type TObject as i, type TSchemaTranslate as j, type UnboxedTObjectSchema as k, type TIdiomaticSchema as l, type TUnionTupleContainer as m, type UnionTupleTResolve as n, type TResolve as o, type ZodObject as p, type ZodCatchall as q, type ZodOuterArray as r, type ZodObjectShape as s, type ZodSchemaTranslate as t, type UnboxedZodObjectSchema as u, type ZodIdiomaticSchema as v, type ZodTupleContainer as w, type TupleZodResolve as x, type ZodUnionContainer as y, type UnionZodResolve as z };
755
+ export { type AnySchemaValidator as A, type ZodRecordKey as B, type IdiomaticSchema as I, type KeyTypes as K, type LiteralSchema as L, type ParseError as P, type SchemaValidator as S, TypeboxSchemaValidator as T, type UnboxedObjectSchema as U, ZodSchemaValidator as Z, type ParseResult as a, type SchemaResolve as b, type SchemaTranslate as c, type Schema as d, type Increment as e, type TCatchall as f, type TOuterArray as g, type TObjectShape as h, type SafeTObject as i, type TSchemaTranslate as j, type UnboxedTObjectSchema as k, type TIdiomaticSchema as l, type TUnionTupleContainer as m, type UnionTupleTResolve as n, type TResolve as o, type ZodCatchall as p, type ZodOuterArray as q, type ZodObjectShape as r, type ZodSchemaTranslate as s, type UnboxedZodObjectSchema as t, type ZodIdiomaticSchema as u, type ZodTupleContainer as v, type TupleZodResolve as w, type ZodUnionContainer as x, type UnionZodResolve as y, type ZodResolve as z };
@@ -1,8 +1,8 @@
1
- import { T as TypeboxSchemaValidator } from '../../schema.types-CDVoqb4z.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-CDVoqb4z.mjs';
1
+ export * from '@sinclair/typebox';
2
+ import { T as TypeboxSchemaValidator } from '../../schema.types-DuGvAboK.mjs';
3
+ export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-DuGvAboK.mjs';
3
4
  import '@forklaunch/common';
4
5
  import 'openapi3-ts/oas31';
5
- import '@sinclair/typebox';
6
6
  import '@sinclair/typebox/compiler';
7
7
  import 'zod';
8
8
 
@@ -1,8 +1,8 @@
1
- import { T as TypeboxSchemaValidator } from '../../schema.types-CDVoqb4z.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-CDVoqb4z.js';
1
+ export * from '@sinclair/typebox';
2
+ import { T as TypeboxSchemaValidator } from '../../schema.types-DuGvAboK.js';
3
+ export { i as SafeTObject, f as TCatchall, l as TIdiomaticSchema, h as TObjectShape, g as TOuterArray, o as TResolve, j as TSchemaTranslate, m as TUnionTupleContainer, k as UnboxedTObjectSchema, n as UnionTupleTResolve } from '../../schema.types-DuGvAboK.js';
3
4
  import '@forklaunch/common';
4
5
  import 'openapi3-ts/oas31';
5
- import '@sinclair/typebox';
6
6
  import '@sinclair/typebox/compiler';
7
7
  import 'zod';
8
8
 
@@ -15,12 +15,14 @@ var __copyProps = (to, from, except, desc) => {
15
15
  }
16
16
  return to;
17
17
  };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
20
 
20
21
  // src/typebox/index.ts
21
22
  var typebox_exports = {};
22
23
  __export(typebox_exports, {
23
24
  SchemaValidator: () => SchemaValidator,
25
+ TypeboxSchemaValidator: () => TypeboxSchemaValidator,
24
26
  any: () => any,
25
27
  array: () => array,
26
28
  bigint: () => bigint,
@@ -55,6 +57,7 @@ __export(typebox_exports, {
55
57
  void_: () => void_
56
58
  });
57
59
  module.exports = __toCommonJS(typebox_exports);
60
+ __reExport(typebox_exports, require("@sinclair/typebox"), module.exports);
58
61
 
59
62
  // src/typebox/typeboxSchemaValidator.ts
60
63
  var import_common = require("@forklaunch/common");
@@ -257,12 +260,10 @@ var TypeboxSchemaValidator = class {
257
260
  import_typebox.Type.String({
258
261
  errorType: "binary",
259
262
  format: "binary",
260
- example: "a utf-8 encodable string",
263
+ example: "a utf-8 encodable blob or file",
261
264
  title: "File"
262
265
  })
263
- ).Decode(
264
- (value) => (name, type2) => new import_common.InMemoryFile(value, name, { type: type2 })
265
- ).Encode((value) => value("name", "type").content);
266
+ ).Decode((value) => new import_common.InMemoryBlob(value)).Encode((value) => value.content);
266
267
  type = () => this.any;
267
268
  /**
268
269
  * Extracts the error type of a schema for error messages.
@@ -563,6 +564,7 @@ var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
563
564
  // Annotate the CommonJS export names for ESM import in node:
564
565
  0 && (module.exports = {
565
566
  SchemaValidator,
567
+ TypeboxSchemaValidator,
566
568
  any,
567
569
  array,
568
570
  bigint,
@@ -594,5 +596,6 @@ var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
594
596
  uri,
595
597
  uuid,
596
598
  validate,
597
- void_
599
+ void_,
600
+ ...require("@sinclair/typebox")
598
601
  });
@@ -1,5 +1,8 @@
1
+ // src/typebox/index.ts
2
+ export * from "@sinclair/typebox";
3
+
1
4
  // src/typebox/typeboxSchemaValidator.ts
2
- import { InMemoryFile } from "@forklaunch/common";
5
+ import { InMemoryBlob } from "@forklaunch/common";
3
6
  import {
4
7
  FormatRegistry,
5
8
  Kind,
@@ -208,12 +211,10 @@ var TypeboxSchemaValidator = class {
208
211
  Type.String({
209
212
  errorType: "binary",
210
213
  format: "binary",
211
- example: "a utf-8 encodable string",
214
+ example: "a utf-8 encodable blob or file",
212
215
  title: "File"
213
216
  })
214
- ).Decode(
215
- (value) => (name, type2) => new InMemoryFile(value, name, { type: type2 })
216
- ).Encode((value) => value("name", "type").content);
217
+ ).Decode((value) => new InMemoryBlob(value)).Encode((value) => value.content);
217
218
  type = () => this.any;
218
219
  /**
219
220
  * Extracts the error type of a schema for error messages.
@@ -513,6 +514,7 @@ var parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
513
514
  var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
514
515
  export {
515
516
  SchemaValidator,
517
+ TypeboxSchemaValidator,
516
518
  any,
517
519
  array,
518
520
  bigint,
@@ -1,6 +1,6 @@
1
- import { Z as ZodSchemaValidator } from '../../schema.types-CDVoqb4z.mjs';
2
- export { p as OriginalZodObject, x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, q as ZodCatchall, v as ZodIdiomaticSchema, p as ZodObject, s as ZodObjectShape, r as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-CDVoqb4z.mjs';
3
- export { ZodArray, ZodEffects, ZodLiteral, ZodNever, ZodPipeline, ZodRawShape, ZodType, ZodTypeAny, ZodUnknown } from 'zod';
1
+ export { ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodDate, ZodEffects, ZodEnum, ZodFunction, ZodLiteral, ZodNever, ZodNull, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodRecord, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod';
2
+ import { Z as ZodSchemaValidator } from '../../schema.types-DuGvAboK.mjs';
3
+ export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-DuGvAboK.mjs';
4
4
  import '@forklaunch/common';
5
5
  import 'openapi3-ts/oas31';
6
6
  import '@sinclair/typebox';
@@ -1,6 +1,6 @@
1
- import { Z as ZodSchemaValidator } from '../../schema.types-CDVoqb4z.js';
2
- export { p as OriginalZodObject, x as TupleZodResolve, u as UnboxedZodObjectSchema, z as UnionZodResolve, q as ZodCatchall, v as ZodIdiomaticSchema, p as ZodObject, s as ZodObjectShape, r as ZodOuterArray, C as ZodRecordKey, B as ZodResolve, t as ZodSchemaTranslate, w as ZodTupleContainer, y as ZodUnionContainer } from '../../schema.types-CDVoqb4z.js';
3
- export { ZodArray, ZodEffects, ZodLiteral, ZodNever, ZodPipeline, ZodRawShape, ZodType, ZodTypeAny, ZodUnknown } from 'zod';
1
+ export { ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodDate, ZodEffects, ZodEnum, ZodFunction, ZodLiteral, ZodNever, ZodNull, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodRawShape, ZodRecord, ZodString, ZodSymbol, ZodTuple, ZodType, ZodTypeAny, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid } from 'zod';
2
+ import { Z as ZodSchemaValidator } from '../../schema.types-DuGvAboK.js';
3
+ export { w as TupleZodResolve, t as UnboxedZodObjectSchema, y as UnionZodResolve, p as ZodCatchall, u as ZodIdiomaticSchema, r as ZodObjectShape, q as ZodOuterArray, B as ZodRecordKey, z as ZodResolve, s as ZodSchemaTranslate, v as ZodTupleContainer, x as ZodUnionContainer } from '../../schema.types-DuGvAboK.js';
4
4
  import '@forklaunch/common';
5
5
  import 'openapi3-ts/oas31';
6
6
  import '@sinclair/typebox';
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var zod_exports = {};
22
22
  __export(zod_exports, {
23
23
  SchemaValidator: () => SchemaValidator,
24
+ ZodSchemaValidator: () => ZodSchemaValidator,
24
25
  any: () => any,
25
26
  array: () => array,
26
27
  bigint: () => bigint,
@@ -194,15 +195,12 @@ var ZodSchemaValidator = class {
194
195
  example: "a utf-8 encodable string"
195
196
  });
196
197
  file = import_zod.z.string().transform((val) => {
197
- return (name, type2) => new File([val], name, {
198
- type: type2,
199
- lastModified: Date.now()
200
- });
198
+ return new Blob([val]);
201
199
  }).openapi({
202
200
  title: "File",
203
201
  type: "string",
204
202
  format: "binary",
205
- example: "a utf-8 encodable string"
203
+ example: "a utf-8 encodable blob or file"
206
204
  });
207
205
  type = () => this.any;
208
206
  /**
@@ -424,6 +422,7 @@ var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
424
422
  // Annotate the CommonJS export names for ESM import in node:
425
423
  0 && (module.exports = {
426
424
  SchemaValidator,
425
+ ZodSchemaValidator,
427
426
  any,
428
427
  array,
429
428
  bigint,
@@ -139,15 +139,12 @@ var ZodSchemaValidator = class {
139
139
  example: "a utf-8 encodable string"
140
140
  });
141
141
  file = z.string().transform((val) => {
142
- return (name, type2) => new File([val], name, {
143
- type: type2,
144
- lastModified: Date.now()
145
- });
142
+ return new Blob([val]);
146
143
  }).openapi({
147
144
  title: "File",
148
145
  type: "string",
149
146
  format: "binary",
150
- example: "a utf-8 encodable string"
147
+ example: "a utf-8 encodable blob or file"
151
148
  });
152
149
  type = () => this.any;
153
150
  /**
@@ -368,6 +365,7 @@ var parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
368
365
  var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
369
366
  export {
370
367
  SchemaValidator,
368
+ ZodSchemaValidator,
371
369
  any,
372
370
  array,
373
371
  bigint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/validator",
3
- "version": "0.6.16",
3
+ "version": "0.7.0",
4
4
  "description": "Schema validator for ForkLaunch components.",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -59,29 +59,29 @@
59
59
  ],
60
60
  "dependencies": {
61
61
  "@anatine/zod-openapi": "^2.2.8",
62
- "@sinclair/typebox": "^0.34.35",
62
+ "@sinclair/typebox": "^0.34.37",
63
63
  "zod": "^3.25.67",
64
- "@forklaunch/common": "0.3.14"
64
+ "@forklaunch/common": "0.4.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@eslint/js": "^9.29.0",
67
+ "@eslint/js": "^9.30.0",
68
68
  "@types/jest": "^30.0.0",
69
- "@types/node": "^24.0.3",
70
- "@typescript/native-preview": "7.0.0-dev.20250619.1",
69
+ "@types/node": "^24.0.7",
70
+ "@typescript/native-preview": "7.0.0-dev.20250630.1",
71
71
  "@vitest/coverage-v8": "^3.2.4",
72
72
  "eslint-config-prettier": "^10.1.5",
73
- "eslint-plugin-prettier": "^5.5.0",
73
+ "eslint-plugin-prettier": "^5.5.1",
74
74
  "globals": "^16.2.0",
75
- "jest": "^30.0.2",
76
- "openapi3-ts": "^4.4.0",
75
+ "jest": "^30.0.3",
76
+ "openapi3-ts": "^4.5.0",
77
77
  "ts-jest": "^29.4.0",
78
78
  "ts-node": "^10.9.2",
79
79
  "tsup": "^8.5.0",
80
- "typedoc": "^0.28.5",
81
- "typescript-eslint": "^8.34.1"
80
+ "typedoc": "^0.28.7",
81
+ "typescript-eslint": "^8.35.1"
82
82
  },
83
83
  "scripts": {
84
- "build": "tsc --noEmit && tsup index.ts src/typebox/index.ts src/zod/index.ts __test__/utils/mockSchemaValidator.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --dts --clean",
84
+ "build": "tsgo --noEmit && tsup index.ts src/typebox/index.ts src/zod/index.ts __test__/utils/mockSchemaValidator.ts --format cjs,esm --no-splitting --tsconfig tsconfig.json --outDir lib --dts --clean",
85
85
  "check": "depcheck",
86
86
  "clean": "rm -rf lib pnpm.lock.yaml node_modules",
87
87
  "docs": "typedoc --out docs *",