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.
@@ -0,0 +1,369 @@
1
+ /** biome-ignore-all assist/source/organizeImports: re-exporting */
2
+
3
+ export {
4
+ // string
5
+ // string,
6
+ // _ZodString,
7
+ // ZodString,
8
+ type ZodCoercedString,
9
+ // iso
10
+ iso,
11
+ ZodISODate,
12
+ ZodISODateTime,
13
+ ZodISODuration,
14
+ ZodISOTime,
15
+ // email
16
+ email,
17
+ ZodEmail,
18
+ // // guid (patched)
19
+ guid as originalGuid,
20
+ ZodGUID as OriginalZodGUID,
21
+ // // uuid (patched)
22
+ uuid as originalUuid,
23
+ ZodUUID as OriginalZodUUID,
24
+ // uuidv4 (patched)
25
+ uuidv4 as originalUuidv4,
26
+ // // uuidv6 (patched)
27
+ uuidv6 as originalUuidv6,
28
+ // // uuidv7 (patched)
29
+ uuidv7 as originalUuidv7,
30
+ // url
31
+ url,
32
+ ZodURL,
33
+ // httpUrl
34
+ httpUrl,
35
+ // emoji
36
+ emoji,
37
+ ZodEmoji,
38
+ // nanoid
39
+ nanoid,
40
+ ZodNanoID,
41
+ // cuid
42
+ cuid,
43
+ ZodCUID,
44
+ // cuid2
45
+ cuid2,
46
+ ZodCUID2,
47
+ // ulid
48
+ ulid,
49
+ ZodULID,
50
+ // xid
51
+ xid,
52
+ ZodXID,
53
+ // ksuid
54
+ ksuid,
55
+ ZodKSUID,
56
+ // ipv4
57
+ ipv4,
58
+ ZodIPv4,
59
+ // mac
60
+ mac,
61
+ ZodMAC,
62
+ // ipv6
63
+ ipv6,
64
+ ZodIPv6,
65
+ // cidrv4
66
+ cidrv4,
67
+ ZodCIDRv4,
68
+ // cidrv6
69
+ cidrv6,
70
+ ZodCIDRv6,
71
+ // base64
72
+ base64,
73
+ ZodBase64,
74
+ // base64url
75
+ base64url,
76
+ ZodBase64URL,
77
+ // e164
78
+ e164,
79
+ ZodE164,
80
+ // jwt
81
+ jwt,
82
+ ZodJWT,
83
+ // stringFormat
84
+ stringFormat,
85
+ ZodStringFormat,
86
+ ZodCustomStringFormat,
87
+ // hostname
88
+ hostname,
89
+ // hex
90
+ hex,
91
+ // hash
92
+ hash,
93
+ // number
94
+ number,
95
+ ZodNumber,
96
+ ZodNumberFormat,
97
+ type _ZodNumber,
98
+ type ZodCoercedNumber,
99
+ // int
100
+ int,
101
+ type ZodInt,
102
+ // float32
103
+ float32,
104
+ type ZodFloat32,
105
+ // float64
106
+ float64,
107
+ type ZodFloat64,
108
+ // int32
109
+ int32,
110
+ type ZodInt32,
111
+ // uint32
112
+ uint32,
113
+ type ZodUInt32,
114
+ // boolean
115
+ boolean,
116
+ type _ZodBoolean,
117
+ ZodBoolean,
118
+ type ZodCoercedBoolean,
119
+ // bigint
120
+ bigint,
121
+ type _ZodBigInt,
122
+ ZodBigInt,
123
+ ZodBigIntFormat,
124
+ type ZodCoercedBigInt,
125
+ // int64
126
+ int64,
127
+ // uint64
128
+ uint64,
129
+ // symbol
130
+ symbol,
131
+ ZodSymbol,
132
+ // undefined
133
+ undefined,
134
+ ZodUndefined,
135
+ // any
136
+ any,
137
+ ZodAny,
138
+ type ZodTypeAny,
139
+ // unknown
140
+ unknown,
141
+ ZodUnknown,
142
+ // never
143
+ never,
144
+ ZodNever,
145
+ // void
146
+ void,
147
+ ZodVoid,
148
+ // null
149
+ null,
150
+ ZodNull,
151
+ // date (patched)
152
+ date as originalDate,
153
+ type _ZodDate as _OriginalZodDate,
154
+ ZodDate as OriginalZodDate,
155
+ type ZodCoercedDate,
156
+ // array
157
+ array,
158
+ ZodArray,
159
+ // keyof
160
+ keyof,
161
+ // object
162
+ object,
163
+ ZodObject,
164
+ type ZodRawShape,
165
+ // strictObject
166
+ strictObject,
167
+ // looseObject
168
+ looseObject,
169
+ // union
170
+ union,
171
+ ZodUnion,
172
+ // discriminatedUnion
173
+ discriminatedUnion,
174
+ ZodDiscriminatedUnion,
175
+ // intersection
176
+ intersection,
177
+ ZodIntersection,
178
+ // tuple
179
+ // tuple,
180
+ // ZodTuple,
181
+ // record
182
+ record,
183
+ ZodRecord,
184
+ // partialRecord
185
+ partialRecord,
186
+ // map
187
+ map,
188
+ ZodMap,
189
+ // set
190
+ set,
191
+ ZodSet,
192
+ // enum
193
+ enum,
194
+ ZodEnum,
195
+ // nativeEnum
196
+ nativeEnum,
197
+ // literal
198
+ literal,
199
+ ZodLiteral,
200
+ // file
201
+ file,
202
+ ZodFile,
203
+ // transform
204
+ transform,
205
+ ZodTransform,
206
+ // optional
207
+ optional,
208
+ ZodOptional,
209
+ // nullable
210
+ nullable,
211
+ ZodNullable,
212
+ // nullish
213
+ nullish,
214
+ // default
215
+ _default,
216
+ ZodDefault,
217
+ // prefault
218
+ prefault,
219
+ ZodPrefault,
220
+ // nonoptional
221
+ nonoptional,
222
+ ZodNonOptional,
223
+ // success
224
+ success,
225
+ ZodSuccess,
226
+ // catch
227
+ catch,
228
+ ZodCatch,
229
+ // nan
230
+ nan,
231
+ ZodNaN,
232
+ // pipe
233
+ pipe,
234
+ ZodPipe,
235
+ // codec
236
+ codec,
237
+ ZodCodec,
238
+ // readonly
239
+ readonly,
240
+ ZodReadonly,
241
+ // templateLiteral
242
+ templateLiteral,
243
+ ZodTemplateLiteral,
244
+ // lazy
245
+ lazy,
246
+ ZodLazy,
247
+ // promise
248
+ promise,
249
+ ZodPromise,
250
+ // function
251
+ function,
252
+ _function,
253
+ ZodFunction,
254
+ // custom
255
+ custom,
256
+ ZodCustom,
257
+ //
258
+ // Others
259
+ //
260
+ clone,
261
+ coerce,
262
+ check,
263
+ // Error
264
+ ZodError,
265
+ ZodRealError,
266
+ type ZodErrorMap,
267
+ type ZodFlattenedError,
268
+ type ZodFormattedError,
269
+ formatError,
270
+ getErrorMap,
271
+ setErrorMap,
272
+ // Safe
273
+ decode,
274
+ decodeAsync,
275
+ safeDecode,
276
+ safeDecodeAsync,
277
+ encode,
278
+ encodeAsync,
279
+ safeEncode,
280
+ safeEncodeAsync,
281
+ parse,
282
+ parseAsync,
283
+ safeParse,
284
+ safeParseAsync,
285
+ type ZodSafeParseError,
286
+ type ZodSafeParseResult,
287
+ type ZodSafeParseSuccess,
288
+ type SafeExtendShape,
289
+ // output
290
+ type output,
291
+ $output,
292
+ // input
293
+ type input,
294
+ $input,
295
+ // brand
296
+ type BRAND,
297
+ $brand,
298
+ // meta
299
+ type GlobalMeta,
300
+ meta,
301
+ //
302
+ ZodFirstPartyTypeKind,
303
+ type ZodFirstPartySchemaTypes,
304
+ type inferFlattenedErrors,
305
+ type inferFormattedError,
306
+ type Infer,
307
+ type infer,
308
+ NEVER,
309
+ type RefinementCtx,
310
+ ZodType,
311
+ type _ZodType,
312
+ type Schema,
313
+ type ZodSchema,
314
+ TimePrecision,
315
+ type TypeOf,
316
+ type ZodJSONSchema,
317
+ type ZodJSONSchemaInternals,
318
+ config,
319
+ core,
320
+ endsWith,
321
+ startsWith,
322
+ describe,
323
+ flattenError,
324
+ globalRegistry,
325
+ gt,
326
+ gte,
327
+ lt,
328
+ lte,
329
+ includes,
330
+ instanceof,
331
+ json,
332
+ length,
333
+ locales,
334
+ lowercase,
335
+ toLowerCase,
336
+ uppercase,
337
+ toUpperCase,
338
+ minLength,
339
+ maxLength,
340
+ minSize,
341
+ maxSize,
342
+ size,
343
+ multipleOf,
344
+ negative,
345
+ nonnegative,
346
+ positive,
347
+ nonpositive,
348
+ property,
349
+ normalize,
350
+ overwrite,
351
+ preprocess,
352
+ prettifyError,
353
+ refine,
354
+ superRefine,
355
+ regexes,
356
+ mime,
357
+ regex,
358
+ slugify,
359
+ stringbool,
360
+ trim,
361
+ registry,
362
+ toJSONSchema,
363
+ treeifyError,
364
+ util,
365
+ z,
366
+ type IssueData,
367
+ ZodIssueCode,
368
+ type ZodIssue,
369
+ } from "zod/v4";
@@ -0,0 +1,138 @@
1
+ import type { Surreal, SurrealTransaction } from "surrealdb";
2
+ import * as classic from "zod/v4";
3
+ import * as core from "zod/v4/core";
4
+ import type * as _core_ from "./core";
5
+ import type { ZodSurrealType } from "./schema";
6
+
7
+ export interface ParseDbContext<T extends core.$ZodIssueBase = core.$ZodIssue>
8
+ extends core.ParseContext<T> {
9
+ db?: Surreal | SurrealTransaction;
10
+ }
11
+
12
+ export interface ParseDbContextInternal<
13
+ T extends core.$ZodIssueBase = core.$ZodIssue,
14
+ > extends core.ParseContextInternal<T> {
15
+ db?: Surreal | SurrealTransaction;
16
+ }
17
+
18
+ export type ZodSafeParseResult<T> =
19
+ | classic.ZodSafeParseSuccess<T>
20
+ | classic.ZodSafeParseError<T>;
21
+
22
+ export type ParsingEncodingDecodingMethodNames =
23
+ | "parse"
24
+ | "encode"
25
+ | "decode"
26
+ | "parseAsync"
27
+ | "encodeAsync"
28
+ | "decodeAsync"
29
+ | "safeParse"
30
+ | "safeEncode"
31
+ | "safeDecode"
32
+ | "safeParseAsync"
33
+ | "safeEncodeAsync"
34
+ | "safeDecodeAsync";
35
+
36
+ export interface ParsingEncodingDecodingMethods<
37
+ T extends _core_.$SomeSurrealType,
38
+ > {
39
+ parse<Ctx extends ParseDbContext>(
40
+ data: unknown,
41
+ params?: Ctx,
42
+ ): Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>;
43
+ encode<Ctx extends ParseDbContext>(
44
+ data: Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>,
45
+ params?: Ctx,
46
+ ): Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>;
47
+ decode<Ctx extends ParseDbContext>(
48
+ data: Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>,
49
+ params?: Ctx,
50
+ ): Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>;
51
+ parseAsync<Ctx extends ParseDbContext>(
52
+ data: unknown,
53
+ params?: Ctx,
54
+ ): Promise<Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>>;
55
+ encodeAsync<Ctx extends ParseDbContext>(
56
+ data: Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>,
57
+ params?: Ctx,
58
+ ): Promise<Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>>;
59
+ decodeAsync<Ctx extends ParseDbContext>(
60
+ data: Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>,
61
+ params?: Ctx,
62
+ ): Promise<Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>>;
63
+ safeParse<Ctx extends ParseDbContext>(
64
+ data: unknown,
65
+ params?: Ctx,
66
+ ): classic.ZodSafeParseResult<
67
+ Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>
68
+ >;
69
+ safeEncode<Ctx extends ParseDbContext>(
70
+ data: Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>,
71
+ params?: Ctx,
72
+ ): classic.ZodSafeParseResult<
73
+ Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>
74
+ >;
75
+ safeDecode<Ctx extends ParseDbContext>(
76
+ data: Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>,
77
+ params?: Ctx,
78
+ ): classic.ZodSafeParseResult<
79
+ Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>
80
+ >;
81
+ safeParseAsync<Ctx extends ParseDbContext>(
82
+ data: unknown,
83
+ params?: Ctx,
84
+ ): Promise<
85
+ classic.ZodSafeParseResult<
86
+ Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>
87
+ >
88
+ >;
89
+ spa<Ctx extends ParseDbContext>(
90
+ data: unknown,
91
+ params?: Ctx,
92
+ ): Promise<
93
+ classic.ZodSafeParseResult<
94
+ Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>
95
+ >
96
+ >;
97
+ safeEncodeAsync<Ctx extends ParseDbContext>(
98
+ data: Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>,
99
+ params?: Ctx,
100
+ ): Promise<
101
+ classic.ZodSafeParseResult<
102
+ Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>
103
+ >
104
+ >;
105
+ safeDecodeAsync<Ctx extends ParseDbContext>(
106
+ data: Ctx extends { db: any } ? _core_.dbinput<T> : core.input<T>,
107
+ params?: Ctx,
108
+ ): Promise<
109
+ classic.ZodSafeParseResult<
110
+ Ctx extends { db: any } ? _core_.dboutput<T> : core.output<T>
111
+ >
112
+ >;
113
+ }
114
+
115
+ export function assignParsingMethods(inst: ZodSurrealType) {
116
+ inst.parse = (data, params) => classic.parse(inst as any, data, params);
117
+ inst.decode = (data, params) => classic.decode(inst as any, data, params);
118
+ inst.encode = (data, params) => classic.encode(inst as any, data, params);
119
+ inst.parseAsync = (data, params) =>
120
+ classic.parseAsync(inst as any, data, params);
121
+ inst.decodeAsync = (data, params) =>
122
+ classic.decodeAsync(inst as any, data, params);
123
+ inst.encodeAsync = (data, params) =>
124
+ classic.encodeAsync(inst as any, data, params);
125
+ inst.safeParse = (data, params) =>
126
+ classic.safeParse(inst as any, data, params);
127
+ inst.safeDecode = (data, params) =>
128
+ classic.safeDecode(inst as any, data, params);
129
+ inst.safeEncode = (data, params) =>
130
+ classic.safeEncode(inst as any, data, params);
131
+ inst.safeParseAsync = (data, params) =>
132
+ classic.safeParseAsync(inst as any, data, params);
133
+ inst.spa = inst.safeParseAsync;
134
+ inst.safeDecodeAsync = (data, params) =>
135
+ classic.safeDecodeAsync(inst as any, data, params);
136
+ inst.safeEncodeAsync = (data, params) =>
137
+ classic.safeEncodeAsync(inst as any, data, params);
138
+ }