@forklaunch/validator 0.7.6 → 0.7.7
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 +2 -2
- package/lib/__test__/utils/mockSchemaValidator.d.ts +2 -2
- package/lib/index.d.mts +3 -3
- package/lib/index.d.ts +3 -3
- package/lib/{schema.types-xFskiFwY.d.mts → schema.types-C3S1yoja.d.mts} +2 -2
- package/lib/{schema.types-xFskiFwY.d.ts → schema.types-C3S1yoja.d.ts} +2 -2
- package/lib/shims/zod-v3-openapi/zod-extensions.d.mts +15 -0
- package/lib/shims/zod-v3-openapi/zod-extensions.d.ts +15 -0
- package/lib/shims/zod-v3-openapi/zod-extensions.js +53 -0
- package/lib/shims/zod-v3-openapi/zod-extensions.mjs +26 -0
- package/lib/src/typebox/index.d.mts +3 -3
- package/lib/src/typebox/index.d.ts +3 -3
- package/lib/src/zod/index.d.mts +3 -3
- package/lib/src/zod/index.d.ts +3 -3
- package/lib/src/zod/index.js +616 -36
- package/lib/src/zod/index.mjs +613 -33
- package/package.json +5 -5
|
@@ -1,9 +1,9 @@
|
|
|
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-C3S1yoja.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
|
6
|
-
import 'zod';
|
|
6
|
+
import 'zod/v3';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a union type string from an array of string literals.
|
|
@@ -1,9 +1,9 @@
|
|
|
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-C3S1yoja.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import '@sinclair/typebox/compiler';
|
|
6
|
-
import 'zod';
|
|
6
|
+
import 'zod/v3';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a union type string from an array of string literals.
|
package/lib/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-C3S1yoja.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-C3S1yoja.mjs';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
|
7
|
-
import 'zod';
|
|
7
|
+
import 'zod/v3';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Pretty print parsing errors.
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-C3S1yoja.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-C3S1yoja.js';
|
|
3
3
|
import '@forklaunch/common';
|
|
4
4
|
import 'openapi3-ts/oas31';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
|
7
|
-
import 'zod';
|
|
7
|
+
import 'zod/v3';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Pretty print parsing errors.
|
|
@@ -2,7 +2,7 @@ import { Prettify } from '@forklaunch/common';
|
|
|
2
2
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
3
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
|
-
import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodFunction, ZodTuple, ZodRecord, ZodPromise, ZodType, z, ZodUnknown, ZodPipeline, ZodTypeAny, ZodEffects, ZodNever } from 'zod';
|
|
5
|
+
import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodFunction, ZodTuple, ZodRecord, ZodPromise, ZodType, z, ZodUnknown, ZodPipeline, ZodTypeAny, ZodEffects, ZodNever } from 'zod/v3';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* This module provides a TypeScript-based schema definition using the TypeBox library.
|
|
@@ -752,4 +752,4 @@ type Increment<T extends number> = T extends 0 ? 1 : T extends 1 ? 2 : T extends
|
|
|
752
752
|
*/
|
|
753
753
|
type KeyTypes = string | number;
|
|
754
754
|
|
|
755
|
-
export { type AnySchemaValidator as A, type
|
|
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 };
|
|
@@ -2,7 +2,7 @@ import { Prettify } from '@forklaunch/common';
|
|
|
2
2
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
3
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
|
-
import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodFunction, ZodTuple, ZodRecord, ZodPromise, ZodType, z, ZodUnknown, ZodPipeline, ZodTypeAny, ZodEffects, ZodNever } from 'zod';
|
|
5
|
+
import { ZodObject as ZodObject$1, ZodRawShape, ZodOptional, ZodArray, ZodUnion, ZodLiteral, ZodFunction, ZodTuple, ZodRecord, ZodPromise, ZodType, z, ZodUnknown, ZodPipeline, ZodTypeAny, ZodEffects, ZodNever } from 'zod/v3';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* This module provides a TypeScript-based schema definition using the TypeBox library.
|
|
@@ -752,4 +752,4 @@ type Increment<T extends number> = T extends 0 ? 1 : T extends 1 ? 2 : T extends
|
|
|
752
752
|
*/
|
|
753
753
|
type KeyTypes = string | number;
|
|
754
754
|
|
|
755
|
-
export { type AnySchemaValidator as A, type
|
|
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 };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ZodTypeDef, z } from 'zod/v3';
|
|
2
|
+
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
3
|
+
|
|
4
|
+
type AnatineSchemaObject = SchemaObject & {
|
|
5
|
+
hideDefinitions?: string[];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare module 'zod/v3' {
|
|
9
|
+
interface ZodSchema<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
10
|
+
openapi<T extends ZodSchema<Output, Def, Input>>(this: T, metadata: Partial<AnatineSchemaObject>): T;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare function extendZodWithOpenApi(zod: typeof z, forceOverride?: boolean): void;
|
|
14
|
+
|
|
15
|
+
export { extendZodWithOpenApi };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ZodTypeDef, z } from 'zod/v3';
|
|
2
|
+
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
3
|
+
|
|
4
|
+
type AnatineSchemaObject = SchemaObject & {
|
|
5
|
+
hideDefinitions?: string[];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare module 'zod/v3' {
|
|
9
|
+
interface ZodSchema<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
10
|
+
openapi<T extends ZodSchema<Output, Def, Input>>(this: T, metadata: Partial<AnatineSchemaObject>): T;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare function extendZodWithOpenApi(zod: typeof z, forceOverride?: boolean): void;
|
|
14
|
+
|
|
15
|
+
export { extendZodWithOpenApi };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// shims/zod-v3-openapi/zod-extensions.ts
|
|
21
|
+
var zod_extensions_exports = {};
|
|
22
|
+
__export(zod_extensions_exports, {
|
|
23
|
+
extendZodWithOpenApi: () => extendZodWithOpenApi
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(zod_extensions_exports);
|
|
26
|
+
|
|
27
|
+
// shims/zod-v3-openapi/zod-openapi.ts
|
|
28
|
+
var import_ts_deepmerge = require("ts-deepmerge");
|
|
29
|
+
var import_v3 = require("zod/v3");
|
|
30
|
+
function extendApi(schema, schemaObject = {}) {
|
|
31
|
+
const This = schema.constructor;
|
|
32
|
+
const newSchema = new This(schema._def);
|
|
33
|
+
newSchema.metaOpenApi = Object.assign(
|
|
34
|
+
{},
|
|
35
|
+
schema.metaOpenApi || {},
|
|
36
|
+
schemaObject
|
|
37
|
+
);
|
|
38
|
+
return newSchema;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// shims/zod-v3-openapi/zod-extensions.ts
|
|
42
|
+
function extendZodWithOpenApi(zod, forceOverride = false) {
|
|
43
|
+
if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
zod.ZodSchema.prototype.openapi = function(metadata) {
|
|
47
|
+
return extendApi(this, metadata);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
extendZodWithOpenApi
|
|
53
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// shims/zod-v3-openapi/zod-openapi.ts
|
|
2
|
+
import { merge } from "ts-deepmerge";
|
|
3
|
+
import { z } from "zod/v3";
|
|
4
|
+
function extendApi(schema, schemaObject = {}) {
|
|
5
|
+
const This = schema.constructor;
|
|
6
|
+
const newSchema = new This(schema._def);
|
|
7
|
+
newSchema.metaOpenApi = Object.assign(
|
|
8
|
+
{},
|
|
9
|
+
schema.metaOpenApi || {},
|
|
10
|
+
schemaObject
|
|
11
|
+
);
|
|
12
|
+
return newSchema;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// shims/zod-v3-openapi/zod-extensions.ts
|
|
16
|
+
function extendZodWithOpenApi(zod, forceOverride = false) {
|
|
17
|
+
if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
zod.ZodSchema.prototype.openapi = function(metadata) {
|
|
21
|
+
return extendApi(this, metadata);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
extendZodWithOpenApi
|
|
26
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from '@sinclair/typebox';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-C3S1yoja.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-C3S1yoja.mjs';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
|
7
|
-
import 'zod';
|
|
7
|
+
import 'zod/v3';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory function for creating a TypeboxSchemaValidator instance.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from '@sinclair/typebox';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { T as TypeboxSchemaValidator } from '../../schema.types-C3S1yoja.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-C3S1yoja.js';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox/compiler';
|
|
7
|
-
import 'zod';
|
|
7
|
+
import 'zod/v3';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory function for creating a TypeboxSchemaValidator instance.
|
package/lib/src/zod/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
-
export {
|
|
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/v3';
|
|
2
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-C3S1yoja.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-C3S1yoja.mjs';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox';
|
package/lib/src/zod/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
-
export {
|
|
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/v3';
|
|
2
|
+
import { Z as ZodSchemaValidator } from '../../schema.types-C3S1yoja.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-C3S1yoja.js';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import 'openapi3-ts/oas31';
|
|
6
6
|
import '@sinclair/typebox';
|