surreal-zod 0.0.0-alpha.10 → 0.0.0-alpha.12
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/index.d.ts +4 -3
- package/lib/index.js +4 -3
- package/lib/registries.d.ts +7 -0
- package/lib/registries.js +5 -0
- package/lib/surql.d.ts +34 -17
- package/lib/surql.js +661 -265
- package/lib/zod/core.d.ts +262 -0
- package/lib/zod/core.js +10 -0
- package/lib/zod/index.d.ts +2 -0
- package/lib/zod/index.js +2 -0
- package/lib/zod/json-schema.d.ts +89 -0
- package/lib/zod/json-schema.js +629 -0
- package/lib/zod/original.d.ts +2 -0
- package/lib/zod/original.js +177 -0
- package/lib/zod/parse.d.ts +71 -0
- package/lib/zod/parse.js +17 -0
- package/lib/zod/schema.d.ts +1798 -233
- package/lib/zod/schema.js +2255 -278
- package/lib/zod/utils.d.ts +3 -2
- package/lib/zod/utils.js +0 -2
- package/package.json +6 -8
- package/src/index.ts +4 -3
- package/src/registries.ts +9 -0
- package/src/surql.ts +768 -324
- package/src/zod/core.ts +605 -0
- package/src/zod/index.ts +2 -0
- package/src/zod/json-schema.ts +892 -0
- package/src/zod/original.ts +369 -0
- package/src/zod/parse.ts +138 -0
- package/src/zod/schema.ts +7099 -984
- package/src/zod/utils.ts +15 -5
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import * as core from "zod/v4/core";
|
|
2
|
+
import type { ZodSurrealType } from "./schema";
|
|
3
|
+
export type Params<T extends $ZodSurrealType | core.$ZodCheck, IssueTypes extends core.$ZodIssueBase, OmitKeys extends keyof T["_zod"]["def"] = never> = core.util.Flatten<Partial<core.util.EmptyToNever<Omit<T["_zod"]["def"], OmitKeys> & ([IssueTypes] extends [never] ? {} : {
|
|
4
|
+
error?: string | core.$ZodErrorMap<IssueTypes> | undefined;
|
|
5
|
+
/** @deprecated This parameter is deprecated. Use `error` instead. */
|
|
6
|
+
message?: string | undefined;
|
|
7
|
+
})>>>;
|
|
8
|
+
export type TypeParams<T extends $ZodSurrealType = ZodSurrealType & {
|
|
9
|
+
_isst: never;
|
|
10
|
+
}, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error"> = never> = Params<T, NonNullable<T["_zod"]["isst"]>, "type" | "checks" | "error" | AlsoOmit>;
|
|
11
|
+
export interface $ZodSurrealTypeDef {
|
|
12
|
+
type: "string" | "number" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "any" | "unknown" | "never" | "void" | "date" | "array" | "object" | "union" | "intersection" | "tuple" | "record" | "map" | "set" | "enum" | "file" | "transform" | "literal" | "optional" | "nullable" | "default" | "prefault" | "nonoptional" | "success" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "lazy" | "promise" | "function" | "custom" | "record_id" | "table" | "field" | "duration";
|
|
13
|
+
error?: core.$ZodErrorMap<never> | undefined;
|
|
14
|
+
checks?: core.$ZodCheck<never>[];
|
|
15
|
+
surreal?: $ZodSurrealTypeDefInternals;
|
|
16
|
+
}
|
|
17
|
+
export interface $ZodSurrealTypeDefInternals {
|
|
18
|
+
type?: "string" | "number" | "int" | "float" | "bool" | "int" | "none" | "null" | "any" | "datetime" | "uuid" | "duration";
|
|
19
|
+
}
|
|
20
|
+
export interface _$ZodSurrealTypeInternals {
|
|
21
|
+
/** The `@zod/core` version of this schema */
|
|
22
|
+
version: typeof core.version;
|
|
23
|
+
/** Schema definition. */
|
|
24
|
+
def: $ZodSurrealTypeDef;
|
|
25
|
+
/** @internal Randomly generated ID for this schema. */
|
|
26
|
+
/** @internal List of deferred initializers. */
|
|
27
|
+
deferred: core.util.AnyFunc[] | undefined;
|
|
28
|
+
/** @internal Parses input and runs all checks (refinements). */
|
|
29
|
+
run(payload: core.ParsePayload<any>, ctx: core.ParseContextInternal): core.util.MaybeAsync<core.ParsePayload>;
|
|
30
|
+
/** @internal Parses input, doesn't run checks. */
|
|
31
|
+
parse(payload: core.ParsePayload<any>, ctx: core.ParseContextInternal): core.util.MaybeAsync<core.ParsePayload>;
|
|
32
|
+
/** @internal Stores identifiers for the set of traits implemented by this schema. */
|
|
33
|
+
traits: Set<string>;
|
|
34
|
+
/** @internal Indicates that a schema output type should be considered optional inside objects.
|
|
35
|
+
* @default Required
|
|
36
|
+
*/
|
|
37
|
+
/** @internal */
|
|
38
|
+
optin?: "optional" | undefined;
|
|
39
|
+
/** @internal */
|
|
40
|
+
optout?: "optional" | undefined;
|
|
41
|
+
/** @internal */
|
|
42
|
+
dboptin?: "optional" | undefined;
|
|
43
|
+
/** @internal */
|
|
44
|
+
dboptout?: "optional" | undefined;
|
|
45
|
+
/** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
|
|
46
|
+
*
|
|
47
|
+
* Defined on: enum, const, literal, null, undefined
|
|
48
|
+
* Passthrough: optional, nullable, branded, default, catch, pipe
|
|
49
|
+
* Todo: unions?
|
|
50
|
+
*/
|
|
51
|
+
values?: core.util.PrimitiveSet | undefined;
|
|
52
|
+
/** Default value bubbled up from */
|
|
53
|
+
/** @internal A set of literal discriminators used for the fast path in discriminated unions. */
|
|
54
|
+
propValues?: core.util.PropValues | undefined;
|
|
55
|
+
/** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
|
|
56
|
+
pattern: RegExp | undefined;
|
|
57
|
+
/** @internal The constructor function of this schema. */
|
|
58
|
+
constr: new (def: any) => $ZodSurrealType;
|
|
59
|
+
/** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
|
|
60
|
+
bag: Record<string, unknown>;
|
|
61
|
+
/** @internal The set of issues this schema might throw during type checking. */
|
|
62
|
+
isst: core.$ZodIssueBase;
|
|
63
|
+
/** @internal Subject to change, not a public API. */
|
|
64
|
+
processJSONSchema?: ((ctx: core.ToJSONSchemaContext, json: core.JSONSchema.BaseSchema, params: core.ProcessParams) => void) | undefined;
|
|
65
|
+
/** An optional method used to override `toJSONSchema` logic. */
|
|
66
|
+
toJSONSchema?: () => unknown;
|
|
67
|
+
/** @internal The parent of this schema. Only set during certain clone operations. */
|
|
68
|
+
parent?: $ZodSurrealType | undefined;
|
|
69
|
+
}
|
|
70
|
+
export interface $ZodSurrealTypeInternals<out O = unknown, out I = unknown, out DBO = O, out DBI = I> extends _$ZodSurrealTypeInternals {
|
|
71
|
+
/** @internal The inferred output type */
|
|
72
|
+
output: O;
|
|
73
|
+
/** @internal The inferred input type */
|
|
74
|
+
input: I;
|
|
75
|
+
/** @internal The inferred output type when using database context */
|
|
76
|
+
dboutput: DBO;
|
|
77
|
+
/** @internal The inferred input type when using database context */
|
|
78
|
+
dbinput: DBI;
|
|
79
|
+
}
|
|
80
|
+
export type $SomeSurrealType = {
|
|
81
|
+
_zod: _$ZodSurrealTypeInternals;
|
|
82
|
+
};
|
|
83
|
+
export type $ZodBranded<T extends $SomeSurrealType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
|
|
84
|
+
_zod: {
|
|
85
|
+
input: core.input<T> & core.$brand<Brand>;
|
|
86
|
+
output: core.output<T> & core.$brand<Brand>;
|
|
87
|
+
};
|
|
88
|
+
} : Dir extends "in" ? {
|
|
89
|
+
_zod: {
|
|
90
|
+
input: core.input<T> & core.$brand<Brand>;
|
|
91
|
+
};
|
|
92
|
+
} : {
|
|
93
|
+
_zod: {
|
|
94
|
+
output: core.output<T> & core.$brand<Brand>;
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
export interface $ZodSurrealType<out O = unknown, out I = unknown, out DBO = O, out DBI = I, out Internals extends $ZodSurrealTypeInternals<O, I, DBO, DBI> = $ZodSurrealTypeInternals<O, I, DBO, DBI>> {
|
|
98
|
+
_zod: Internals;
|
|
99
|
+
"~standard": core.$ZodStandardSchema<this>;
|
|
100
|
+
}
|
|
101
|
+
export type $catchall<T extends $SomeSurrealType> = {
|
|
102
|
+
out: {
|
|
103
|
+
[k: string]: core.output<T>;
|
|
104
|
+
};
|
|
105
|
+
in: {
|
|
106
|
+
[k: string]: core.input<T>;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export type $ZodSurrealShape = Readonly<{
|
|
110
|
+
[k: string]: $ZodSurrealType;
|
|
111
|
+
}>;
|
|
112
|
+
export type OptionalOutSchema = {
|
|
113
|
+
_zod: {
|
|
114
|
+
optout: "optional";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export type OptionalDbOutSchema = {
|
|
118
|
+
_zod: {
|
|
119
|
+
dboptout: "optional";
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export type OptionalInSchema = {
|
|
123
|
+
_zod: {
|
|
124
|
+
optin: "optional";
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export type OptionalDbInSchema = {
|
|
128
|
+
_zod: {
|
|
129
|
+
dboptin: "optional";
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export type IsOptionalIn<T extends $SomeSurrealType> = T extends OptionalInSchema ? true : false;
|
|
133
|
+
export type IsOptionalOut<T extends $SomeSurrealType> = T extends OptionalOutSchema ? true : false;
|
|
134
|
+
export type IsOptionalDbIn<T extends $SomeSurrealType> = T extends OptionalDbInSchema ? true : false;
|
|
135
|
+
export type IsOptionalDbOut<T extends $SomeSurrealType> = T extends OptionalDbOutSchema ? true : false;
|
|
136
|
+
export type $InferObjectDbOutput<T extends core.$ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? core.util.IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, dboutput<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : core.util.Prettify<{
|
|
137
|
+
-readonly [k in keyof T as T[k] extends OptionalDbOutSchema ? never : k]: T[k]["_zod"]["dboutput"];
|
|
138
|
+
} & {
|
|
139
|
+
-readonly [k in keyof T as T[k] extends OptionalDbOutSchema ? k : never]?: T[k]["_zod"]["dboutput"];
|
|
140
|
+
} & Extra>;
|
|
141
|
+
export type $InferObjectDbInput<T extends core.$ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? core.util.IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, dbinput<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : core.util.Prettify<{
|
|
142
|
+
-readonly [k in keyof T as T[k] extends OptionalDbInSchema ? never : k]: T[k]["_zod"]["dbinput"];
|
|
143
|
+
} & {
|
|
144
|
+
-readonly [k in keyof T as T[k] extends OptionalDbInSchema ? k : never]?: T[k]["_zod"]["dbinput"];
|
|
145
|
+
} & Extra>;
|
|
146
|
+
export type dbinput<T> = T extends {
|
|
147
|
+
_zod: {
|
|
148
|
+
dbinput: any;
|
|
149
|
+
};
|
|
150
|
+
} ? T["_zod"]["dbinput"] : T extends {
|
|
151
|
+
_zod: {
|
|
152
|
+
input: any;
|
|
153
|
+
};
|
|
154
|
+
} ? T["_zod"]["input"] : unknown;
|
|
155
|
+
export type dboutput<T> = T extends {
|
|
156
|
+
_zod: {
|
|
157
|
+
dboutput: any;
|
|
158
|
+
};
|
|
159
|
+
} ? T["_zod"]["dboutput"] : T extends {
|
|
160
|
+
_zod: {
|
|
161
|
+
output: any;
|
|
162
|
+
};
|
|
163
|
+
} ? T["_zod"]["output"] : unknown;
|
|
164
|
+
export type $InferUnionOutput<T extends $SomeSurrealType> = T extends any ? core.output<T> : never;
|
|
165
|
+
export type $InferUnionInput<T extends $SomeSurrealType> = T extends any ? core.input<T> : never;
|
|
166
|
+
export type $InferUnionDbOutput<T extends $SomeSurrealType> = T extends any ? dboutput<T> : never;
|
|
167
|
+
export type $InferUnionDbInput<T extends $SomeSurrealType> = T extends any ? dbinput<T> : never;
|
|
168
|
+
export interface $ZodSurrealTypeDiscriminableInternals extends $ZodSurrealTypeInternals {
|
|
169
|
+
propValues: core.util.PropValues;
|
|
170
|
+
}
|
|
171
|
+
export interface $ZodSurrealTypeDiscriminable extends $ZodSurrealType {
|
|
172
|
+
_zod: $ZodSurrealTypeDiscriminableInternals;
|
|
173
|
+
}
|
|
174
|
+
export type TupleItems = ReadonlyArray<$SomeSurrealType>;
|
|
175
|
+
export type $InferTupleInputType<T extends TupleItems, Rest extends $SomeSurrealType | null> = [
|
|
176
|
+
...TupleInputTypeWithOptionals<T>,
|
|
177
|
+
...(Rest extends $SomeSurrealType ? core.input<Rest>[] : [])
|
|
178
|
+
];
|
|
179
|
+
type TupleInputTypeNoOptionals<T extends TupleItems> = {
|
|
180
|
+
[k in keyof T]: core.input<T[k]>;
|
|
181
|
+
};
|
|
182
|
+
type TupleInputTypeWithOptionals<T extends TupleItems> = T extends readonly [
|
|
183
|
+
...infer Prefix extends $SomeSurrealType[],
|
|
184
|
+
infer Tail extends $SomeSurrealType
|
|
185
|
+
] ? Tail["_zod"]["optin"] extends "optional" ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
|
|
186
|
+
export type $InferTupleDbInputType<T extends TupleItems, Rest extends $SomeSurrealType | null> = [
|
|
187
|
+
...TupleDbInputTypeWithOptionals<T>,
|
|
188
|
+
...(Rest extends $SomeSurrealType ? dbinput<Rest>[] : [])
|
|
189
|
+
];
|
|
190
|
+
type TupleDbInputTypeNoOptionals<T extends TupleItems> = {
|
|
191
|
+
[k in keyof T]: dbinput<T[k]>;
|
|
192
|
+
};
|
|
193
|
+
type TupleDbInputTypeWithOptionals<T extends TupleItems> = T extends readonly [
|
|
194
|
+
...infer Prefix extends $SomeSurrealType[],
|
|
195
|
+
infer Tail extends $SomeSurrealType
|
|
196
|
+
] ? Tail["_zod"]["dboptin"] extends "optional" ? [...TupleDbInputTypeWithOptionals<Prefix>, dbinput<Tail>?] : TupleDbInputTypeNoOptionals<T> : [];
|
|
197
|
+
export type $InferTupleOutputType<T extends TupleItems, Rest extends $SomeSurrealType | null> = [
|
|
198
|
+
...TupleOutputTypeWithOptionals<T>,
|
|
199
|
+
...(Rest extends $SomeSurrealType ? core.output<Rest>[] : [])
|
|
200
|
+
];
|
|
201
|
+
type TupleOutputTypeNoOptionals<T extends TupleItems> = {
|
|
202
|
+
[k in keyof T]: core.output<T[k]>;
|
|
203
|
+
};
|
|
204
|
+
type TupleOutputTypeWithOptionals<T extends TupleItems> = T extends readonly [
|
|
205
|
+
...infer Prefix extends $SomeSurrealType[],
|
|
206
|
+
infer Tail extends $SomeSurrealType
|
|
207
|
+
] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, core.output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
|
|
208
|
+
export type $InferTupleDbOutputType<T extends TupleItems, Rest extends $SomeSurrealType | null> = [
|
|
209
|
+
...TupleDbOutputTypeWithOptionals<T>,
|
|
210
|
+
...(Rest extends $SomeSurrealType ? dboutput<Rest>[] : [])
|
|
211
|
+
];
|
|
212
|
+
type TupleDbOutputTypeNoOptionals<T extends TupleItems> = {
|
|
213
|
+
[k in keyof T]: dboutput<T[k]>;
|
|
214
|
+
};
|
|
215
|
+
type TupleDbOutputTypeWithOptionals<T extends TupleItems> = T extends readonly [
|
|
216
|
+
...infer Prefix extends $SomeSurrealType[],
|
|
217
|
+
infer Tail extends $SomeSurrealType
|
|
218
|
+
] ? Tail["_zod"]["dboptout"] extends "optional" ? [...TupleDbOutputTypeWithOptionals<Prefix>, dboutput<Tail>?] : TupleDbOutputTypeNoOptionals<T> : [];
|
|
219
|
+
export type $ZodRecordKey = $ZodSurrealType<string | number | symbol, unknown>;
|
|
220
|
+
export type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $SomeSurrealType = $ZodSurrealType> = Key extends core.$partial ? Partial<Record<core.output<Key>, core.output<Value>>> : Record<core.output<Key>, core.output<Value>>;
|
|
221
|
+
export type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $SomeSurrealType = $ZodSurrealType> = Key extends core.$partial ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>> : Record<core.input<Key> & PropertyKey, core.input<Value>>;
|
|
222
|
+
export type $InferZodRecordDbOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $SomeSurrealType = ZodSurrealType> = Key extends core.$partial ? Partial<Record<dboutput<Key>, dboutput<Value>>> : Record<dboutput<Key>, dboutput<Value>>;
|
|
223
|
+
export type $InferZodRecordDbInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends $SomeSurrealType = ZodSurrealType> = Key extends core.$partial ? Partial<Record<dbinput<Key> & PropertyKey, dbinput<Value>>> : Record<dbinput<Key> & PropertyKey, dbinput<Value>>;
|
|
224
|
+
export type $InferEnumDbOutput<T extends core.util.EnumLike> = T[keyof T] & {};
|
|
225
|
+
export type $InferEnumDbInput<T extends core.util.EnumLike> = T[keyof T] & {};
|
|
226
|
+
export type ZodSurrealFunctionArgs = ZodSurrealType<unknown[], unknown[]>;
|
|
227
|
+
export type ZodSurrealFunctionIn = ZodSurrealFunctionArgs;
|
|
228
|
+
export type ZodSurrealFunctionOut = ZodSurrealType;
|
|
229
|
+
export type $InferInnerFunctionType<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : core.output<Args>) => core.input<Returns>;
|
|
230
|
+
export type $InferInnerFunctionDbType<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : dboutput<Args>) => dbinput<Returns>;
|
|
231
|
+
export type $InferInnerFunctionTypeAsync<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : core.output<Args>) => core.util.MaybeAsync<core.input<Returns>>;
|
|
232
|
+
export type $InferInnerFunctionDbTypeAsync<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : dboutput<Args>) => core.util.MaybeAsync<dbinput<Returns>>;
|
|
233
|
+
export type $InferOuterFunctionType<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : core.input<Args>) => core.output<Returns>;
|
|
234
|
+
export type $InferOuterFunctionDbType<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : dbinput<Args>) => dboutput<Returns>;
|
|
235
|
+
export type $InferOuterFunctionTypeAsync<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : core.input<Args>) => Promise<core.output<Returns>>;
|
|
236
|
+
export type $InferOuterFunctionDbTypeAsync<Args extends ZodSurrealFunctionIn, Returns extends ZodSurrealFunctionOut> = (...args: ZodSurrealFunctionIn extends Args ? never[] : dbinput<Args>) => Promise<dboutput<Returns>>;
|
|
237
|
+
export interface ZodSurrealFunctionDef<In extends ZodSurrealFunctionIn = ZodSurrealFunctionIn, Out extends ZodSurrealFunctionOut = ZodSurrealFunctionOut> extends $ZodSurrealTypeDef {
|
|
238
|
+
type: "function";
|
|
239
|
+
input: In;
|
|
240
|
+
output: Out;
|
|
241
|
+
}
|
|
242
|
+
type LiteralPart = Exclude<core.util.Literal, symbol>;
|
|
243
|
+
interface SchemaPartInternals extends $ZodSurrealTypeInternals<LiteralPart, LiteralPart> {
|
|
244
|
+
pattern: RegExp;
|
|
245
|
+
}
|
|
246
|
+
interface SchemaPart extends $ZodSurrealType {
|
|
247
|
+
_zod: SchemaPartInternals;
|
|
248
|
+
}
|
|
249
|
+
export type $ZodSurrealTemplateLiteralPart = LiteralPart | SchemaPart;
|
|
250
|
+
type UndefinedToEmptyString<T> = T extends undefined ? "" : T;
|
|
251
|
+
type AppendToTemplateLiteral<Template extends string, Suffix extends LiteralPart | $ZodSurrealType> = Suffix extends LiteralPart ? `${Template}${UndefinedToEmptyString<Suffix>}` : Suffix extends $ZodSurrealType ? `${Template}${core.output<Suffix> extends infer T extends LiteralPart ? UndefinedToEmptyString<T> : never}` : never;
|
|
252
|
+
export type $PartsToTemplateLiteral<Parts extends $ZodSurrealTemplateLiteralPart[]> = [] extends Parts ? `` : Parts extends [
|
|
253
|
+
...infer Rest,
|
|
254
|
+
infer Last extends $ZodSurrealTemplateLiteralPart
|
|
255
|
+
] ? Rest extends $ZodSurrealTemplateLiteralPart[] ? AppendToTemplateLiteral<$PartsToTemplateLiteral<Rest>, Last> : never : never;
|
|
256
|
+
export declare function normalizeParams<T, S extends $ZodSurrealTypeDefInternals>(_params: T, surreal?: S): core.util.Normalize<T> & {
|
|
257
|
+
surreal: Exclude<S, undefined>;
|
|
258
|
+
};
|
|
259
|
+
export declare const clone: <T extends $ZodSurrealType>(inst: T, def?: T["_zod"]["def"], params?: {
|
|
260
|
+
parent: boolean;
|
|
261
|
+
}) => T;
|
|
262
|
+
export {};
|
package/lib/zod/core.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as core from "zod/v4/core";
|
|
2
|
+
///////////////////////////// Type Overriden Functions /////////////////////////
|
|
3
|
+
export function normalizeParams(_params, surreal) {
|
|
4
|
+
const params = core.util.normalizeParams(_params);
|
|
5
|
+
if (params && typeof params === "object") {
|
|
6
|
+
return { ...params, surreal: surreal ?? {} };
|
|
7
|
+
}
|
|
8
|
+
return params ?? { surreal: surreal ?? {} };
|
|
9
|
+
}
|
|
10
|
+
export const clone = core.clone;
|
package/lib/zod/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as core from "zod/v4/core";
|
|
2
|
+
export declare const stringProcessor: core.Processor<core.$ZodString>;
|
|
3
|
+
export declare const numberProcessor: core.Processor<core.$ZodNumber>;
|
|
4
|
+
export declare const booleanProcessor: core.Processor<core.$ZodBoolean>;
|
|
5
|
+
export declare const bigintProcessor: core.Processor<core.$ZodBigInt>;
|
|
6
|
+
export declare const symbolProcessor: core.Processor<core.$ZodSymbol>;
|
|
7
|
+
export declare const nullProcessor: core.Processor<core.$ZodNull>;
|
|
8
|
+
export declare const undefinedProcessor: core.Processor<core.$ZodUndefined>;
|
|
9
|
+
export declare const voidProcessor: core.Processor<core.$ZodVoid>;
|
|
10
|
+
export declare const neverProcessor: core.Processor<core.$ZodNever>;
|
|
11
|
+
export declare const anyProcessor: core.Processor<core.$ZodAny>;
|
|
12
|
+
export declare const unknownProcessor: core.Processor<core.$ZodUnknown>;
|
|
13
|
+
export declare const dateProcessor: core.Processor<core.$ZodDate>;
|
|
14
|
+
export declare const enumProcessor: core.Processor<core.$ZodEnum>;
|
|
15
|
+
export declare const literalProcessor: core.Processor<core.$ZodLiteral>;
|
|
16
|
+
export declare const nanProcessor: core.Processor<core.$ZodNaN>;
|
|
17
|
+
export declare const templateLiteralProcessor: core.Processor<core.$ZodTemplateLiteral>;
|
|
18
|
+
export declare const fileProcessor: core.Processor<core.$ZodFile>;
|
|
19
|
+
export declare const successProcessor: core.Processor<core.$ZodSuccess>;
|
|
20
|
+
export declare const customProcessor: core.Processor<core.$ZodCustom>;
|
|
21
|
+
export declare const functionProcessor: core.Processor<core.$ZodFunction>;
|
|
22
|
+
export declare const transformProcessor: core.Processor<core.$ZodTransform>;
|
|
23
|
+
export declare const mapProcessor: core.Processor<core.$ZodMap>;
|
|
24
|
+
export declare const setProcessor: core.Processor<core.$ZodSet>;
|
|
25
|
+
export declare const arrayProcessor: core.Processor<core.$ZodArray>;
|
|
26
|
+
export declare const objectProcessor: core.Processor<core.$ZodObject>;
|
|
27
|
+
export declare const unionProcessor: core.Processor<core.$ZodUnion>;
|
|
28
|
+
export declare const intersectionProcessor: core.Processor<core.$ZodIntersection>;
|
|
29
|
+
export declare const tupleProcessor: core.Processor<core.$ZodTuple>;
|
|
30
|
+
export declare const recordProcessor: core.Processor<core.$ZodRecord>;
|
|
31
|
+
export declare const nullableProcessor: core.Processor<core.$ZodNullable>;
|
|
32
|
+
export declare const nonoptionalProcessor: core.Processor<core.$ZodNonOptional>;
|
|
33
|
+
export declare const defaultProcessor: core.Processor<core.$ZodDefault>;
|
|
34
|
+
export declare const prefaultProcessor: core.Processor<core.$ZodPrefault>;
|
|
35
|
+
export declare const catchProcessor: core.Processor<core.$ZodCatch>;
|
|
36
|
+
export declare const pipeProcessor: core.Processor<core.$ZodPipe>;
|
|
37
|
+
export declare const readonlyProcessor: core.Processor<core.$ZodReadonly>;
|
|
38
|
+
export declare const promiseProcessor: core.Processor<core.$ZodPromise>;
|
|
39
|
+
export declare const optionalProcessor: core.Processor<core.$ZodOptional>;
|
|
40
|
+
export declare const lazyProcessor: core.Processor<core.$ZodLazy>;
|
|
41
|
+
export declare const allProcessors: {
|
|
42
|
+
string: core.Processor<core.$ZodString<unknown>>;
|
|
43
|
+
number: core.Processor<core.$ZodNumber<unknown>>;
|
|
44
|
+
boolean: core.Processor<core.$ZodBoolean<unknown>>;
|
|
45
|
+
bigint: core.Processor<core.$ZodBigInt<unknown>>;
|
|
46
|
+
symbol: core.Processor<core.$ZodSymbol>;
|
|
47
|
+
null: core.Processor<core.$ZodNull>;
|
|
48
|
+
undefined: core.Processor<core.$ZodUndefined>;
|
|
49
|
+
void: core.Processor<core.$ZodVoid>;
|
|
50
|
+
never: core.Processor<core.$ZodNever>;
|
|
51
|
+
any: core.Processor<core.$ZodAny>;
|
|
52
|
+
unknown: core.Processor<core.$ZodUnknown>;
|
|
53
|
+
date: core.Processor<core.$ZodDate<unknown>>;
|
|
54
|
+
enum: core.Processor<core.$ZodEnum<Readonly<Record<string, core.util.EnumValue>>>>;
|
|
55
|
+
literal: core.Processor<core.$ZodLiteral<core.util.Literal>>;
|
|
56
|
+
nan: core.Processor<core.$ZodNaN>;
|
|
57
|
+
template_literal: core.Processor<core.$ZodTemplateLiteral<string>>;
|
|
58
|
+
file: core.Processor<core.$ZodFile>;
|
|
59
|
+
success: core.Processor<core.$ZodSuccess<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
60
|
+
custom: core.Processor<core.$ZodCustom<unknown, unknown>>;
|
|
61
|
+
function: core.Processor<core.$ZodFunction<core.$ZodFunctionArgs, core.$ZodFunctionOut>>;
|
|
62
|
+
transform: core.Processor<core.$ZodTransform<unknown, unknown>>;
|
|
63
|
+
map: core.Processor<core.$ZodMap<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
64
|
+
set: core.Processor<core.$ZodSet<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
65
|
+
array: core.Processor<core.$ZodArray<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
66
|
+
object: core.Processor<core.$ZodObject<Readonly<Readonly<{
|
|
67
|
+
[k: string]: core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>;
|
|
68
|
+
}>>, core.$ZodObjectConfig>>;
|
|
69
|
+
union: core.Processor<core.$ZodUnion<readonly core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>[]>>;
|
|
70
|
+
intersection: core.Processor<core.$ZodIntersection<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
71
|
+
tuple: core.Processor<core.$ZodTuple<readonly core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>[], core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>> | null>>;
|
|
72
|
+
record: core.Processor<core.$ZodRecord<core.$ZodRecordKey, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
73
|
+
nullable: core.Processor<core.$ZodNullable<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
74
|
+
nonoptional: core.Processor<core.$ZodNonOptional<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
75
|
+
default: core.Processor<core.$ZodDefault<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
76
|
+
prefault: core.Processor<core.$ZodPrefault<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
77
|
+
catch: core.Processor<core.$ZodCatch<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
78
|
+
pipe: core.Processor<core.$ZodPipe<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
79
|
+
readonly: core.Processor<core.$ZodReadonly<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
80
|
+
promise: core.Processor<core.$ZodPromise<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
81
|
+
optional: core.Processor<core.$ZodOptional<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
82
|
+
lazy: core.Processor<core.$ZodLazy<core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
83
|
+
};
|
|
84
|
+
export declare function toJSONSchema<T extends core.$ZodType>(schema: T, params?: core.ToJSONSchemaParams): core.ZodStandardJSONSchemaPayload<T>;
|
|
85
|
+
export declare function toJSONSchema(registry: core.$ZodRegistry<{
|
|
86
|
+
id?: string | undefined;
|
|
87
|
+
}>, params?: core.RegistryToJSONSchemaParams): {
|
|
88
|
+
schemas: Record<string, core.ZodStandardJSONSchemaPayload<core.$ZodType>>;
|
|
89
|
+
};
|