@likec4/config 1.39.4 → 1.40.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.
@@ -0,0 +1,1589 @@
1
+ import { LikeC4Model, ElementModel, RelationshipModel, DeploymentRelationModel, LikeC4ViewModel, DeploymentElementModel } from '@likec4/core/model';
2
+ import { aux, ProjectId } from '@likec4/core/types';
3
+ import { URI } from 'vscode-uri';
4
+
5
+ /** The Standard Schema interface. */
6
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
7
+ /** The Standard Schema properties. */
8
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
9
+ }
10
+ declare namespace StandardSchemaV1 {
11
+ /** The Standard Schema properties interface. */
12
+ interface Props<Input = unknown, Output = Input> {
13
+ /** The version number of the standard. */
14
+ readonly version: 1;
15
+ /** The vendor name of the schema library. */
16
+ readonly vendor: string;
17
+ /** Validates unknown input values. */
18
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
19
+ /** Inferred types associated with the schema. */
20
+ readonly types?: Types<Input, Output> | undefined;
21
+ }
22
+ /** The result interface of the validate function. */
23
+ type Result<Output> = SuccessResult<Output> | FailureResult;
24
+ /** The result interface if validation succeeds. */
25
+ interface SuccessResult<Output> {
26
+ /** The typed output value. */
27
+ readonly value: Output;
28
+ /** The non-existent issues. */
29
+ readonly issues?: undefined;
30
+ }
31
+ /** The result interface if validation fails. */
32
+ interface FailureResult {
33
+ /** The issues of failed validation. */
34
+ readonly issues: ReadonlyArray<Issue>;
35
+ }
36
+ /** The issue interface of the failure output. */
37
+ interface Issue {
38
+ /** The error message of the issue. */
39
+ readonly message: string;
40
+ /** The path of the issue, if any. */
41
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
42
+ }
43
+ /** The path segment interface of the issue. */
44
+ interface PathSegment {
45
+ /** The key representing a path segment. */
46
+ readonly key: PropertyKey;
47
+ }
48
+ /** The Standard Schema types interface. */
49
+ interface Types<Input = unknown, Output = Input> {
50
+ /** The input type of the schema. */
51
+ readonly input: Input;
52
+ /** The output type of the schema. */
53
+ readonly output: Output;
54
+ }
55
+ /** Infers the input type of a Standard Schema. */
56
+ type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
57
+ /** Infers the output type of a Standard Schema. */
58
+ type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
59
+ }
60
+
61
+ type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
62
+ type IsAny<T> = 0 extends 1 & T ? true : false;
63
+ type Omit$1<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
64
+ type MakePartial<T, K extends keyof T> = Omit$1<T, K> & InexactPartial<Pick<T, K>>;
65
+ type NoUndefined<T> = T extends undefined ? never : T;
66
+ type LoosePartial<T extends object> = InexactPartial<T> & {
67
+ [k: string]: unknown;
68
+ };
69
+ type Mask<Keys extends PropertyKey> = {
70
+ [K in Keys]?: true;
71
+ };
72
+ type InexactPartial<T> = {
73
+ [P in keyof T]?: T[P] | undefined;
74
+ };
75
+ type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
76
+ readonly [Symbol.toStringTag]: string;
77
+ } | Date | Error | Generator | Promise<unknown> | RegExp;
78
+ type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
79
+ type SomeObject = Record<PropertyKey, any>;
80
+ type Identity<T> = T;
81
+ type Flatten<T> = Identity<{
82
+ [k in keyof T]: T[k];
83
+ }>;
84
+ type Prettify<T> = {
85
+ [K in keyof T]: T[K];
86
+ } & {};
87
+ type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : {
88
+ [K in keyof A as K extends keyof B ? never : K]: A[K];
89
+ } & {
90
+ [K in keyof B]: B[K];
91
+ }>;
92
+ type AnyFunc = (...args: any[]) => any;
93
+ type MaybeAsync<T> = T | Promise<T>;
94
+ type EnumValue = string | number;
95
+ type EnumLike = Readonly<Record<string, EnumValue>>;
96
+ type ToEnum<T extends EnumValue> = Flatten<{
97
+ [k in T]: k;
98
+ }>;
99
+ type Primitive = string | number | symbol | bigint | boolean | null | undefined;
100
+ type HasLength = {
101
+ length: number;
102
+ };
103
+ type PropValues = Record<string, Set<Primitive>>;
104
+ type PrimitiveSet = Set<Primitive>;
105
+ type EmptyToNever<T> = keyof T extends never ? never : T;
106
+ declare abstract class Class {
107
+ constructor(..._args: any[]);
108
+ }
109
+
110
+ declare const version: {
111
+ readonly major: 4;
112
+ readonly minor: 0;
113
+ readonly patch: number;
114
+ };
115
+
116
+ interface ParseContext<T extends $ZodIssueBase = never> {
117
+ /** Customize error messages. */
118
+ readonly error?: $ZodErrorMap<T>;
119
+ /** Include the `input` field in issue objects. Default `false`. */
120
+ readonly reportInput?: boolean;
121
+ /** Skip eval-based fast path. Default `false`. */
122
+ readonly jitless?: boolean;
123
+ }
124
+ /** @internal */
125
+ interface ParseContextInternal<T extends $ZodIssueBase = never> extends ParseContext<T> {
126
+ readonly async?: boolean | undefined;
127
+ }
128
+ interface ParsePayload<T = unknown> {
129
+ value: T;
130
+ issues: $ZodRawIssue[];
131
+ }
132
+ type CheckFn<T> = (input: ParsePayload<T>) => MaybeAsync<void>;
133
+ interface $ZodTypeDef {
134
+ type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "custom";
135
+ error?: $ZodErrorMap<never> | undefined;
136
+ checks?: $ZodCheck<never>[];
137
+ }
138
+ interface _$ZodTypeInternals {
139
+ /** The `@zod/core` version of this schema */
140
+ version: typeof version;
141
+ /** Schema definition. */
142
+ def: $ZodTypeDef;
143
+ /** @internal Randomly generated ID for this schema. */
144
+ /** @internal List of deferred initializers. */
145
+ deferred: AnyFunc[] | undefined;
146
+ /** @internal Parses input and runs all checks (refinements). */
147
+ run(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
148
+ /** @internal Parses input, doesn't run checks. */
149
+ parse(payload: ParsePayload<any>, ctx: ParseContextInternal): MaybeAsync<ParsePayload>;
150
+ /** @internal Stores identifiers for the set of traits implemented by this schema. */
151
+ traits: Set<string>;
152
+ /** @internal Indicates that a schema output type should be considered optional inside objects.
153
+ * @default Required
154
+ */
155
+ /** @internal */
156
+ optin?: "optional" | undefined;
157
+ /** @internal */
158
+ optout?: "optional" | undefined;
159
+ /** @internal The set of literal values that will pass validation. Must be an exhaustive set. Used to determine optionality in z.record().
160
+ *
161
+ * Defined on: enum, const, literal, null, undefined
162
+ * Passthrough: optional, nullable, branded, default, catch, pipe
163
+ * Todo: unions?
164
+ */
165
+ values?: PrimitiveSet | undefined;
166
+ /** Default value bubbled up from */
167
+ /** @internal A set of literal discriminators used for the fast path in discriminated unions. */
168
+ propValues?: PropValues | undefined;
169
+ /** @internal This flag indicates that a schema validation can be represented with a regular expression. Used to determine allowable schemas in z.templateLiteral(). */
170
+ pattern: RegExp | undefined;
171
+ /** @internal The constructor function of this schema. */
172
+ constr: new (def: any) => $ZodType;
173
+ /** @internal A catchall object for bag metadata related to this schema. Commonly modified by checks using `onattach`. */
174
+ bag: Record<string, unknown>;
175
+ /** @internal The set of issues this schema might throw during type checking. */
176
+ isst: $ZodIssueBase;
177
+ /** An optional method used to override `toJSONSchema` logic. */
178
+ toJSONSchema?: () => unknown;
179
+ /** @internal The parent of this schema. Only set during certain clone operations. */
180
+ parent?: $ZodType | undefined;
181
+ }
182
+ /** @internal */
183
+ interface $ZodTypeInternals<out O = unknown, out I = unknown> extends _$ZodTypeInternals {
184
+ /** @internal The inferred output type */
185
+ output: O;
186
+ /** @internal The inferred input type */
187
+ input: I;
188
+ }
189
+ type $ZodStandardSchema<T> = StandardSchemaV1.Props<input<T>, output<T>>;
190
+ type SomeType = {
191
+ _zod: _$ZodTypeInternals;
192
+ };
193
+ interface $ZodType<O = unknown, I = unknown, Internals extends $ZodTypeInternals<O, I> = $ZodTypeInternals<O, I>> {
194
+ _zod: Internals;
195
+ "~standard": $ZodStandardSchema<this>;
196
+ }
197
+ declare const $ZodType: $constructor<$ZodType>;
198
+
199
+ interface $ZodStringDef extends $ZodTypeDef {
200
+ type: "string";
201
+ coerce?: boolean;
202
+ checks?: $ZodCheck<string>[];
203
+ }
204
+ interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, Input> {
205
+ def: $ZodStringDef;
206
+ /** @deprecated Internal API, use with caution (not deprecated) */
207
+ pattern: RegExp;
208
+ /** @deprecated Internal API, use with caution (not deprecated) */
209
+ isst: $ZodIssueInvalidType;
210
+ bag: LoosePartial<{
211
+ minimum: number;
212
+ maximum: number;
213
+ patterns: Set<RegExp>;
214
+ format: string;
215
+ contentEncoding: string;
216
+ }>;
217
+ }
218
+ interface $ZodStringFormatDef<Format extends string = string> extends $ZodStringDef, $ZodCheckStringFormatDef<Format> {
219
+ }
220
+ interface $ZodStringFormatInternals<Format extends string = string> extends $ZodStringInternals<string>, $ZodCheckStringFormatInternals {
221
+ def: $ZodStringFormatDef<Format>;
222
+ }
223
+ interface $ZodStringFormat<Format extends string = string> extends $ZodType {
224
+ _zod: $ZodStringFormatInternals<Format>;
225
+ }
226
+ declare const $ZodStringFormat: $constructor<$ZodStringFormat>;
227
+ interface $ZodGUIDInternals extends $ZodStringFormatInternals<"guid"> {
228
+ }
229
+ interface $ZodGUID extends $ZodType {
230
+ _zod: $ZodGUIDInternals;
231
+ }
232
+ declare const $ZodGUID: $constructor<$ZodGUID>;
233
+ interface $ZodUUIDDef extends $ZodStringFormatDef<"uuid"> {
234
+ version?: "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" | "v8";
235
+ }
236
+ interface $ZodUUIDInternals extends $ZodStringFormatInternals<"uuid"> {
237
+ def: $ZodUUIDDef;
238
+ }
239
+ interface $ZodUUID extends $ZodType {
240
+ _zod: $ZodUUIDInternals;
241
+ }
242
+ declare const $ZodUUID: $constructor<$ZodUUID>;
243
+ interface $ZodEmailInternals extends $ZodStringFormatInternals<"email"> {
244
+ }
245
+ interface $ZodEmail extends $ZodType {
246
+ _zod: $ZodEmailInternals;
247
+ }
248
+ declare const $ZodEmail: $constructor<$ZodEmail>;
249
+ interface $ZodURLDef extends $ZodStringFormatDef<"url"> {
250
+ hostname?: RegExp | undefined;
251
+ protocol?: RegExp | undefined;
252
+ normalize?: boolean | undefined;
253
+ }
254
+ interface $ZodURLInternals extends $ZodStringFormatInternals<"url"> {
255
+ def: $ZodURLDef;
256
+ }
257
+ interface $ZodURL extends $ZodType {
258
+ _zod: $ZodURLInternals;
259
+ }
260
+ declare const $ZodURL: $constructor<$ZodURL>;
261
+ interface $ZodEmojiInternals extends $ZodStringFormatInternals<"emoji"> {
262
+ }
263
+ interface $ZodEmoji extends $ZodType {
264
+ _zod: $ZodEmojiInternals;
265
+ }
266
+ declare const $ZodEmoji: $constructor<$ZodEmoji>;
267
+ interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {
268
+ }
269
+ interface $ZodNanoID extends $ZodType {
270
+ _zod: $ZodNanoIDInternals;
271
+ }
272
+ declare const $ZodNanoID: $constructor<$ZodNanoID>;
273
+ interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {
274
+ }
275
+ interface $ZodCUID extends $ZodType {
276
+ _zod: $ZodCUIDInternals;
277
+ }
278
+ declare const $ZodCUID: $constructor<$ZodCUID>;
279
+ interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {
280
+ }
281
+ interface $ZodCUID2 extends $ZodType {
282
+ _zod: $ZodCUID2Internals;
283
+ }
284
+ declare const $ZodCUID2: $constructor<$ZodCUID2>;
285
+ interface $ZodULIDInternals extends $ZodStringFormatInternals<"ulid"> {
286
+ }
287
+ interface $ZodULID extends $ZodType {
288
+ _zod: $ZodULIDInternals;
289
+ }
290
+ declare const $ZodULID: $constructor<$ZodULID>;
291
+ interface $ZodXIDInternals extends $ZodStringFormatInternals<"xid"> {
292
+ }
293
+ interface $ZodXID extends $ZodType {
294
+ _zod: $ZodXIDInternals;
295
+ }
296
+ declare const $ZodXID: $constructor<$ZodXID>;
297
+ interface $ZodKSUIDInternals extends $ZodStringFormatInternals<"ksuid"> {
298
+ }
299
+ interface $ZodKSUID extends $ZodType {
300
+ _zod: $ZodKSUIDInternals;
301
+ }
302
+ declare const $ZodKSUID: $constructor<$ZodKSUID>;
303
+ interface $ZodISODateTimeDef extends $ZodStringFormatDef<"datetime"> {
304
+ precision: number | null;
305
+ offset: boolean;
306
+ local: boolean;
307
+ }
308
+ interface $ZodISODateTimeInternals extends $ZodStringFormatInternals {
309
+ def: $ZodISODateTimeDef;
310
+ }
311
+ interface $ZodISODateTime extends $ZodType {
312
+ _zod: $ZodISODateTimeInternals;
313
+ }
314
+ declare const $ZodISODateTime: $constructor<$ZodISODateTime>;
315
+ interface $ZodISODateInternals extends $ZodStringFormatInternals<"date"> {
316
+ }
317
+ interface $ZodISODate extends $ZodType {
318
+ _zod: $ZodISODateInternals;
319
+ }
320
+ declare const $ZodISODate: $constructor<$ZodISODate>;
321
+ interface $ZodISOTimeDef extends $ZodStringFormatDef<"time"> {
322
+ precision?: number | null;
323
+ }
324
+ interface $ZodISOTimeInternals extends $ZodStringFormatInternals<"time"> {
325
+ def: $ZodISOTimeDef;
326
+ }
327
+ interface $ZodISOTime extends $ZodType {
328
+ _zod: $ZodISOTimeInternals;
329
+ }
330
+ declare const $ZodISOTime: $constructor<$ZodISOTime>;
331
+ interface $ZodISODurationInternals extends $ZodStringFormatInternals<"duration"> {
332
+ }
333
+ interface $ZodISODuration extends $ZodType {
334
+ _zod: $ZodISODurationInternals;
335
+ }
336
+ declare const $ZodISODuration: $constructor<$ZodISODuration>;
337
+ interface $ZodIPv4Def extends $ZodStringFormatDef<"ipv4"> {
338
+ version?: "v4";
339
+ }
340
+ interface $ZodIPv4Internals extends $ZodStringFormatInternals<"ipv4"> {
341
+ def: $ZodIPv4Def;
342
+ }
343
+ interface $ZodIPv4 extends $ZodType {
344
+ _zod: $ZodIPv4Internals;
345
+ }
346
+ declare const $ZodIPv4: $constructor<$ZodIPv4>;
347
+ interface $ZodIPv6Def extends $ZodStringFormatDef<"ipv6"> {
348
+ version?: "v6";
349
+ }
350
+ interface $ZodIPv6Internals extends $ZodStringFormatInternals<"ipv6"> {
351
+ def: $ZodIPv6Def;
352
+ }
353
+ interface $ZodIPv6 extends $ZodType {
354
+ _zod: $ZodIPv6Internals;
355
+ }
356
+ declare const $ZodIPv6: $constructor<$ZodIPv6>;
357
+ interface $ZodCIDRv4Def extends $ZodStringFormatDef<"cidrv4"> {
358
+ version?: "v4";
359
+ }
360
+ interface $ZodCIDRv4Internals extends $ZodStringFormatInternals<"cidrv4"> {
361
+ def: $ZodCIDRv4Def;
362
+ }
363
+ interface $ZodCIDRv4 extends $ZodType {
364
+ _zod: $ZodCIDRv4Internals;
365
+ }
366
+ declare const $ZodCIDRv4: $constructor<$ZodCIDRv4>;
367
+ interface $ZodCIDRv6Def extends $ZodStringFormatDef<"cidrv6"> {
368
+ version?: "v6";
369
+ }
370
+ interface $ZodCIDRv6Internals extends $ZodStringFormatInternals<"cidrv6"> {
371
+ def: $ZodCIDRv6Def;
372
+ }
373
+ interface $ZodCIDRv6 extends $ZodType {
374
+ _zod: $ZodCIDRv6Internals;
375
+ }
376
+ declare const $ZodCIDRv6: $constructor<$ZodCIDRv6>;
377
+ interface $ZodBase64Internals extends $ZodStringFormatInternals<"base64"> {
378
+ }
379
+ interface $ZodBase64 extends $ZodType {
380
+ _zod: $ZodBase64Internals;
381
+ }
382
+ declare const $ZodBase64: $constructor<$ZodBase64>;
383
+ interface $ZodBase64URLInternals extends $ZodStringFormatInternals<"base64url"> {
384
+ }
385
+ interface $ZodBase64URL extends $ZodType {
386
+ _zod: $ZodBase64URLInternals;
387
+ }
388
+ declare const $ZodBase64URL: $constructor<$ZodBase64URL>;
389
+ interface $ZodE164Internals extends $ZodStringFormatInternals<"e164"> {
390
+ }
391
+ interface $ZodE164 extends $ZodType {
392
+ _zod: $ZodE164Internals;
393
+ }
394
+ declare const $ZodE164: $constructor<$ZodE164>;
395
+ interface $ZodJWTDef extends $ZodStringFormatDef<"jwt"> {
396
+ alg?: JWTAlgorithm | undefined;
397
+ }
398
+ interface $ZodJWTInternals extends $ZodStringFormatInternals<"jwt"> {
399
+ def: $ZodJWTDef;
400
+ }
401
+ interface $ZodJWT extends $ZodType {
402
+ _zod: $ZodJWTInternals;
403
+ }
404
+ declare const $ZodJWT: $constructor<$ZodJWT>;
405
+ interface $ZodArrayDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
406
+ type: "array";
407
+ element: T;
408
+ }
409
+ interface $ZodArrayInternals<T extends SomeType = $ZodType> extends _$ZodTypeInternals {
410
+ def: $ZodArrayDef<T>;
411
+ isst: $ZodIssueInvalidType;
412
+ output: output<T>[];
413
+ input: input<T>[];
414
+ }
415
+ interface $ZodArray<T extends SomeType = $ZodType> extends $ZodType<any, any, $ZodArrayInternals<T>> {
416
+ }
417
+ declare const $ZodArray: $constructor<$ZodArray>;
418
+ type OptionalOutSchema = {
419
+ _zod: {
420
+ optout: "optional";
421
+ };
422
+ };
423
+ type OptionalInSchema = {
424
+ _zod: {
425
+ optin: "optional";
426
+ };
427
+ };
428
+ type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
429
+ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"];
430
+ } & {
431
+ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"];
432
+ } & Extra>;
433
+ type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{
434
+ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"];
435
+ } & {
436
+ -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"];
437
+ } & Extra>;
438
+ type $ZodObjectConfig = {
439
+ out: Record<string, unknown>;
440
+ in: Record<string, unknown>;
441
+ };
442
+ type $loose = {
443
+ out: Record<string, unknown>;
444
+ in: Record<string, unknown>;
445
+ };
446
+ type $strict = {
447
+ out: {};
448
+ in: {};
449
+ };
450
+ type $strip = {
451
+ out: {};
452
+ in: {};
453
+ };
454
+ type $catchall<T extends SomeType> = {
455
+ out: {
456
+ [k: string]: output<T>;
457
+ };
458
+ in: {
459
+ [k: string]: input<T>;
460
+ };
461
+ };
462
+ type $ZodShape = Readonly<{
463
+ [k: string]: $ZodType;
464
+ }>;
465
+ interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef {
466
+ type: "object";
467
+ shape: Shape;
468
+ catchall?: $ZodType | undefined;
469
+ }
470
+ interface $ZodObjectInternals<
471
+ /** @ts-ignore Cast variance */
472
+ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
473
+ def: $ZodObjectDef<Shape>;
474
+ config: Config;
475
+ isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys;
476
+ propValues: PropValues;
477
+ output: $InferObjectOutput<Shape, Config["out"]>;
478
+ input: $InferObjectInput<Shape, Config["in"]>;
479
+ optin?: "optional" | undefined;
480
+ optout?: "optional" | undefined;
481
+ }
482
+ type $ZodLooseShape = Record<string, any>;
483
+ interface $ZodObject<
484
+ /** @ts-ignore Cast variance */
485
+ out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {
486
+ "~standard": $ZodStandardSchema<this>;
487
+ }
488
+ declare const $ZodObject: $constructor<$ZodObject>;
489
+ type $InferUnionOutput<T extends SomeType> = T extends any ? output<T> : never;
490
+ type $InferUnionInput<T extends SomeType> = T extends any ? input<T> : never;
491
+ interface $ZodUnionDef<Options extends readonly SomeType[] = readonly $ZodType[]> extends $ZodTypeDef {
492
+ type: "union";
493
+ options: Options;
494
+ }
495
+ type IsOptionalIn<T extends SomeType> = T extends OptionalInSchema ? true : false;
496
+ type IsOptionalOut<T extends SomeType> = T extends OptionalOutSchema ? true : false;
497
+ interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $ZodType[]> extends _$ZodTypeInternals {
498
+ def: $ZodUnionDef<T>;
499
+ isst: $ZodIssueInvalidUnion;
500
+ pattern: T[number]["_zod"]["pattern"];
501
+ values: T[number]["_zod"]["values"];
502
+ output: $InferUnionOutput<T[number]>;
503
+ input: $InferUnionInput<T[number]>;
504
+ optin: IsOptionalIn<T[number]> extends false ? "optional" | undefined : "optional";
505
+ optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
506
+ }
507
+ interface $ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends $ZodType<any, any, $ZodUnionInternals<T>> {
508
+ _zod: $ZodUnionInternals<T>;
509
+ }
510
+ declare const $ZodUnion: $constructor<$ZodUnion>;
511
+ interface $ZodIntersectionDef<Left extends SomeType = $ZodType, Right extends SomeType = $ZodType> extends $ZodTypeDef {
512
+ type: "intersection";
513
+ left: Left;
514
+ right: Right;
515
+ }
516
+ interface $ZodIntersectionInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _$ZodTypeInternals {
517
+ def: $ZodIntersectionDef<A, B>;
518
+ isst: never;
519
+ optin: A["_zod"]["optin"] | B["_zod"]["optin"];
520
+ optout: A["_zod"]["optout"] | B["_zod"]["optout"];
521
+ output: output<A> & output<B>;
522
+ input: input<A> & input<B>;
523
+ }
524
+ interface $ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
525
+ _zod: $ZodIntersectionInternals<A, B>;
526
+ }
527
+ declare const $ZodIntersection: $constructor<$ZodIntersection>;
528
+ type $ZodRecordKey = $ZodType<string | number | symbol, string | number | symbol>;
529
+ interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeDef {
530
+ type: "record";
531
+ keyType: Key;
532
+ valueType: Value;
533
+ }
534
+ type $InferZodRecordOutput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<output<Key>, output<Value>>> : Record<output<Key>, output<Value>>;
535
+ type $InferZodRecordInput<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> = Key extends $partial ? Partial<Record<input<Key>, input<Value>>> : Record<input<Key>, input<Value>>;
536
+ interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
537
+ def: $ZodRecordDef<Key, Value>;
538
+ isst: $ZodIssueInvalidType | $ZodIssueInvalidKey<Record<PropertyKey, unknown>>;
539
+ optin?: "optional" | undefined;
540
+ optout?: "optional" | undefined;
541
+ }
542
+ type $partial = {
543
+ "~~partial": true;
544
+ };
545
+ interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends $ZodType {
546
+ _zod: $ZodRecordInternals<Key, Value>;
547
+ }
548
+ declare const $ZodRecord: $constructor<$ZodRecord>;
549
+ type $InferEnumOutput<T extends EnumLike> = T[keyof T] & {};
550
+ type $InferEnumInput<T extends EnumLike> = T[keyof T] & {};
551
+ interface $ZodEnumDef<T extends EnumLike = EnumLike> extends $ZodTypeDef {
552
+ type: "enum";
553
+ entries: T;
554
+ }
555
+ interface $ZodEnumInternals<
556
+ /** @ts-ignore Cast variance */
557
+ out T extends EnumLike = EnumLike> extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
558
+ def: $ZodEnumDef<T>;
559
+ /** @deprecated Internal API, use with caution (not deprecated) */
560
+ values: PrimitiveSet;
561
+ /** @deprecated Internal API, use with caution (not deprecated) */
562
+ pattern: RegExp;
563
+ isst: $ZodIssueInvalidValue;
564
+ }
565
+ interface $ZodEnum<T extends EnumLike = EnumLike> extends $ZodType {
566
+ _zod: $ZodEnumInternals<T>;
567
+ }
568
+ declare const $ZodEnum: $constructor<$ZodEnum>;
569
+ interface $ZodTransformDef extends $ZodTypeDef {
570
+ type: "transform";
571
+ transform: (input: unknown, payload: ParsePayload<unknown>) => MaybeAsync<unknown>;
572
+ }
573
+ interface $ZodTransformInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I> {
574
+ def: $ZodTransformDef;
575
+ isst: never;
576
+ }
577
+ interface $ZodTransform<O = unknown, I = unknown> extends $ZodType {
578
+ _zod: $ZodTransformInternals<O, I>;
579
+ }
580
+ declare const $ZodTransform: $constructor<$ZodTransform>;
581
+ interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
582
+ type: "optional";
583
+ innerType: T;
584
+ }
585
+ interface $ZodOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | undefined, input<T> | undefined> {
586
+ def: $ZodOptionalDef<T>;
587
+ optin: "optional";
588
+ optout: "optional";
589
+ isst: never;
590
+ values: T["_zod"]["values"];
591
+ pattern: T["_zod"]["pattern"];
592
+ }
593
+ interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
594
+ _zod: $ZodOptionalInternals<T>;
595
+ }
596
+ declare const $ZodOptional: $constructor<$ZodOptional>;
597
+ interface $ZodNullableDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
598
+ type: "nullable";
599
+ innerType: T;
600
+ }
601
+ interface $ZodNullableInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T> | null, input<T> | null> {
602
+ def: $ZodNullableDef<T>;
603
+ optin: T["_zod"]["optin"];
604
+ optout: T["_zod"]["optout"];
605
+ isst: never;
606
+ values: T["_zod"]["values"];
607
+ pattern: T["_zod"]["pattern"];
608
+ }
609
+ interface $ZodNullable<T extends SomeType = $ZodType> extends $ZodType {
610
+ _zod: $ZodNullableInternals<T>;
611
+ }
612
+ declare const $ZodNullable: $constructor<$ZodNullable>;
613
+ interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
614
+ type: "default";
615
+ innerType: T;
616
+ /** The default value. May be a getter. */
617
+ defaultValue: NoUndefined<output<T>>;
618
+ }
619
+ interface $ZodDefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
620
+ def: $ZodDefaultDef<T>;
621
+ optin: "optional";
622
+ optout?: "optional" | undefined;
623
+ isst: never;
624
+ values: T["_zod"]["values"];
625
+ }
626
+ interface $ZodDefault<T extends SomeType = $ZodType> extends $ZodType {
627
+ _zod: $ZodDefaultInternals<T>;
628
+ }
629
+ declare const $ZodDefault: $constructor<$ZodDefault>;
630
+ interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
631
+ type: "prefault";
632
+ innerType: T;
633
+ /** The default value. May be a getter. */
634
+ defaultValue: input<T>;
635
+ }
636
+ interface $ZodPrefaultInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, input<T> | undefined> {
637
+ def: $ZodPrefaultDef<T>;
638
+ optin: "optional";
639
+ optout?: "optional" | undefined;
640
+ isst: never;
641
+ values: T["_zod"]["values"];
642
+ }
643
+ interface $ZodPrefault<T extends SomeType = $ZodType> extends $ZodType {
644
+ _zod: $ZodPrefaultInternals<T>;
645
+ }
646
+ declare const $ZodPrefault: $constructor<$ZodPrefault>;
647
+ interface $ZodNonOptionalDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
648
+ type: "nonoptional";
649
+ innerType: T;
650
+ }
651
+ interface $ZodNonOptionalInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<NoUndefined<output<T>>, NoUndefined<input<T>>> {
652
+ def: $ZodNonOptionalDef<T>;
653
+ isst: $ZodIssueInvalidType;
654
+ values: T["_zod"]["values"];
655
+ optin: "optional" | undefined;
656
+ optout: "optional" | undefined;
657
+ }
658
+ interface $ZodNonOptional<T extends SomeType = $ZodType> extends $ZodType {
659
+ _zod: $ZodNonOptionalInternals<T>;
660
+ }
661
+ declare const $ZodNonOptional: $constructor<$ZodNonOptional>;
662
+ interface $ZodCatchCtx extends ParsePayload {
663
+ /** @deprecated Use `ctx.issues` */
664
+ error: {
665
+ issues: $ZodIssue[];
666
+ };
667
+ /** @deprecated Use `ctx.value` */
668
+ input: unknown;
669
+ }
670
+ interface $ZodCatchDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
671
+ type: "catch";
672
+ innerType: T;
673
+ catchValue: (ctx: $ZodCatchCtx) => unknown;
674
+ }
675
+ interface $ZodCatchInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<output<T>, input<T>> {
676
+ def: $ZodCatchDef<T>;
677
+ optin: T["_zod"]["optin"];
678
+ optout: T["_zod"]["optout"];
679
+ isst: never;
680
+ values: T["_zod"]["values"];
681
+ }
682
+ interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
683
+ _zod: $ZodCatchInternals<T>;
684
+ }
685
+ declare const $ZodCatch: $constructor<$ZodCatch>;
686
+ interface $ZodPipeDef<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeDef {
687
+ type: "pipe";
688
+ in: A;
689
+ out: B;
690
+ }
691
+ interface $ZodPipeInternals<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodTypeInternals<output<B>, input<A>> {
692
+ def: $ZodPipeDef<A, B>;
693
+ isst: never;
694
+ values: A["_zod"]["values"];
695
+ optin: A["_zod"]["optin"];
696
+ optout: B["_zod"]["optout"];
697
+ propValues: A["_zod"]["propValues"];
698
+ }
699
+ interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends $ZodType {
700
+ _zod: $ZodPipeInternals<A, B>;
701
+ }
702
+ declare const $ZodPipe: $constructor<$ZodPipe>;
703
+ interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
704
+ type: "readonly";
705
+ innerType: T;
706
+ }
707
+ interface $ZodReadonlyInternals<T extends SomeType = $ZodType> extends $ZodTypeInternals<MakeReadonly<output<T>>, MakeReadonly<input<T>>> {
708
+ def: $ZodReadonlyDef<T>;
709
+ optin: T["_zod"]["optin"];
710
+ optout: T["_zod"]["optout"];
711
+ isst: never;
712
+ propValues: T["_zod"]["propValues"];
713
+ values: T["_zod"]["values"];
714
+ }
715
+ interface $ZodReadonly<T extends SomeType = $ZodType> extends $ZodType {
716
+ _zod: $ZodReadonlyInternals<T>;
717
+ }
718
+ declare const $ZodReadonly: $constructor<$ZodReadonly>;
719
+ interface $ZodCustomDef<O = unknown> extends $ZodTypeDef, $ZodCheckDef {
720
+ type: "custom";
721
+ check: "custom";
722
+ path?: PropertyKey[] | undefined;
723
+ error?: $ZodErrorMap | undefined;
724
+ params?: Record<string, any> | undefined;
725
+ fn: (arg: O) => unknown;
726
+ }
727
+ interface $ZodCustomInternals<O = unknown, I = unknown> extends $ZodTypeInternals<O, I>, $ZodCheckInternals<O> {
728
+ def: $ZodCustomDef;
729
+ issc: $ZodIssue;
730
+ isst: never;
731
+ bag: LoosePartial<{
732
+ Class: typeof Class;
733
+ }>;
734
+ }
735
+ interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
736
+ _zod: $ZodCustomInternals<O, I>;
737
+ }
738
+ declare const $ZodCustom: $constructor<$ZodCustom>;
739
+
740
+ interface $ZodCheckDef {
741
+ check: string;
742
+ error?: $ZodErrorMap<never> | undefined;
743
+ /** If true, no later checks will be executed if this check fails. Default `false`. */
744
+ abort?: boolean | undefined;
745
+ /** If provided, this check will only be executed if the function returns `true`. Defaults to `payload => z.util.isAborted(payload)`. */
746
+ when?: ((payload: ParsePayload) => boolean) | undefined;
747
+ }
748
+ interface $ZodCheckInternals<T> {
749
+ def: $ZodCheckDef;
750
+ /** The set of issues this check might throw. */
751
+ issc?: $ZodIssueBase;
752
+ check(payload: ParsePayload<T>): MaybeAsync<void>;
753
+ onattach: ((schema: $ZodType) => void)[];
754
+ }
755
+ interface $ZodCheck<in T = never> {
756
+ _zod: $ZodCheckInternals<T>;
757
+ }
758
+ declare const $ZodCheck: $constructor<$ZodCheck<any>>;
759
+ interface $ZodCheckMaxLengthDef extends $ZodCheckDef {
760
+ check: "max_length";
761
+ maximum: number;
762
+ }
763
+ interface $ZodCheckMaxLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
764
+ def: $ZodCheckMaxLengthDef;
765
+ issc: $ZodIssueTooBig<T>;
766
+ }
767
+ interface $ZodCheckMaxLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
768
+ _zod: $ZodCheckMaxLengthInternals<T>;
769
+ }
770
+ declare const $ZodCheckMaxLength: $constructor<$ZodCheckMaxLength>;
771
+ interface $ZodCheckMinLengthDef extends $ZodCheckDef {
772
+ check: "min_length";
773
+ minimum: number;
774
+ }
775
+ interface $ZodCheckMinLengthInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
776
+ def: $ZodCheckMinLengthDef;
777
+ issc: $ZodIssueTooSmall<T>;
778
+ }
779
+ interface $ZodCheckMinLength<T extends HasLength = HasLength> extends $ZodCheck<T> {
780
+ _zod: $ZodCheckMinLengthInternals<T>;
781
+ }
782
+ declare const $ZodCheckMinLength: $constructor<$ZodCheckMinLength>;
783
+ interface $ZodCheckLengthEqualsDef extends $ZodCheckDef {
784
+ check: "length_equals";
785
+ length: number;
786
+ }
787
+ interface $ZodCheckLengthEqualsInternals<T extends HasLength = HasLength> extends $ZodCheckInternals<T> {
788
+ def: $ZodCheckLengthEqualsDef;
789
+ issc: $ZodIssueTooBig<T> | $ZodIssueTooSmall<T>;
790
+ }
791
+ interface $ZodCheckLengthEquals<T extends HasLength = HasLength> extends $ZodCheck<T> {
792
+ _zod: $ZodCheckLengthEqualsInternals<T>;
793
+ }
794
+ declare const $ZodCheckLengthEquals: $constructor<$ZodCheckLengthEquals>;
795
+ type $ZodStringFormats = "email" | "url" | "emoji" | "uuid" | "guid" | "nanoid" | "cuid" | "cuid2" | "ulid" | "xid" | "ksuid" | "datetime" | "date" | "time" | "duration" | "ipv4" | "ipv6" | "cidrv4" | "cidrv6" | "base64" | "base64url" | "json_string" | "e164" | "lowercase" | "uppercase" | "regex" | "jwt" | "starts_with" | "ends_with" | "includes";
796
+ interface $ZodCheckStringFormatDef<Format extends string = string> extends $ZodCheckDef {
797
+ check: "string_format";
798
+ format: Format;
799
+ pattern?: RegExp | undefined;
800
+ }
801
+ interface $ZodCheckStringFormatInternals extends $ZodCheckInternals<string> {
802
+ def: $ZodCheckStringFormatDef;
803
+ issc: $ZodIssueInvalidStringFormat;
804
+ }
805
+ interface $ZodCheckRegexDef extends $ZodCheckStringFormatDef {
806
+ format: "regex";
807
+ pattern: RegExp;
808
+ }
809
+ interface $ZodCheckRegexInternals extends $ZodCheckInternals<string> {
810
+ def: $ZodCheckRegexDef;
811
+ issc: $ZodIssueInvalidStringFormat;
812
+ }
813
+ interface $ZodCheckRegex extends $ZodCheck<string> {
814
+ _zod: $ZodCheckRegexInternals;
815
+ }
816
+ declare const $ZodCheckRegex: $constructor<$ZodCheckRegex>;
817
+ interface $ZodCheckLowerCaseDef extends $ZodCheckStringFormatDef<"lowercase"> {
818
+ }
819
+ interface $ZodCheckLowerCaseInternals extends $ZodCheckInternals<string> {
820
+ def: $ZodCheckLowerCaseDef;
821
+ issc: $ZodIssueInvalidStringFormat;
822
+ }
823
+ interface $ZodCheckLowerCase extends $ZodCheck<string> {
824
+ _zod: $ZodCheckLowerCaseInternals;
825
+ }
826
+ declare const $ZodCheckLowerCase: $constructor<$ZodCheckLowerCase>;
827
+ interface $ZodCheckUpperCaseDef extends $ZodCheckStringFormatDef<"uppercase"> {
828
+ }
829
+ interface $ZodCheckUpperCaseInternals extends $ZodCheckInternals<string> {
830
+ def: $ZodCheckUpperCaseDef;
831
+ issc: $ZodIssueInvalidStringFormat;
832
+ }
833
+ interface $ZodCheckUpperCase extends $ZodCheck<string> {
834
+ _zod: $ZodCheckUpperCaseInternals;
835
+ }
836
+ declare const $ZodCheckUpperCase: $constructor<$ZodCheckUpperCase>;
837
+ interface $ZodCheckIncludesDef extends $ZodCheckStringFormatDef<"includes"> {
838
+ includes: string;
839
+ position?: number | undefined;
840
+ }
841
+ interface $ZodCheckIncludesInternals extends $ZodCheckInternals<string> {
842
+ def: $ZodCheckIncludesDef;
843
+ issc: $ZodIssueInvalidStringFormat;
844
+ }
845
+ interface $ZodCheckIncludes extends $ZodCheck<string> {
846
+ _zod: $ZodCheckIncludesInternals;
847
+ }
848
+ declare const $ZodCheckIncludes: $constructor<$ZodCheckIncludes>;
849
+ interface $ZodCheckStartsWithDef extends $ZodCheckStringFormatDef<"starts_with"> {
850
+ prefix: string;
851
+ }
852
+ interface $ZodCheckStartsWithInternals extends $ZodCheckInternals<string> {
853
+ def: $ZodCheckStartsWithDef;
854
+ issc: $ZodIssueInvalidStringFormat;
855
+ }
856
+ interface $ZodCheckStartsWith extends $ZodCheck<string> {
857
+ _zod: $ZodCheckStartsWithInternals;
858
+ }
859
+ declare const $ZodCheckStartsWith: $constructor<$ZodCheckStartsWith>;
860
+ interface $ZodCheckEndsWithDef extends $ZodCheckStringFormatDef<"ends_with"> {
861
+ suffix: string;
862
+ }
863
+ interface $ZodCheckEndsWithInternals extends $ZodCheckInternals<string> {
864
+ def: $ZodCheckEndsWithDef;
865
+ issc: $ZodIssueInvalidStringFormat;
866
+ }
867
+ interface $ZodCheckEndsWith extends $ZodCheckInternals<string> {
868
+ _zod: $ZodCheckEndsWithInternals;
869
+ }
870
+ declare const $ZodCheckEndsWith: $constructor<$ZodCheckEndsWith>;
871
+
872
+ interface $ZodIssueBase {
873
+ readonly code?: string;
874
+ readonly input?: unknown;
875
+ readonly path: PropertyKey[];
876
+ readonly message: string;
877
+ }
878
+ interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
879
+ readonly code: "invalid_type";
880
+ readonly expected: $ZodType["_zod"]["def"]["type"];
881
+ readonly input?: Input;
882
+ }
883
+ interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
884
+ readonly code: "too_big";
885
+ readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
886
+ readonly maximum: number | bigint;
887
+ readonly inclusive?: boolean;
888
+ readonly exact?: boolean;
889
+ readonly input?: Input;
890
+ }
891
+ interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
892
+ readonly code: "too_small";
893
+ readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
894
+ readonly minimum: number | bigint;
895
+ /** True if the allowable range includes the minimum */
896
+ readonly inclusive?: boolean;
897
+ /** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
898
+ readonly exact?: boolean;
899
+ readonly input?: Input;
900
+ }
901
+ interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
902
+ readonly code: "invalid_format";
903
+ readonly format: $ZodStringFormats | (string & {});
904
+ readonly pattern?: string;
905
+ readonly input?: string;
906
+ }
907
+ interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
908
+ readonly code: "not_multiple_of";
909
+ readonly divisor: number;
910
+ readonly input?: Input;
911
+ }
912
+ interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
913
+ readonly code: "unrecognized_keys";
914
+ readonly keys: string[];
915
+ readonly input?: Record<string, unknown>;
916
+ }
917
+ interface $ZodIssueInvalidUnion extends $ZodIssueBase {
918
+ readonly code: "invalid_union";
919
+ readonly errors: $ZodIssue[][];
920
+ readonly input?: unknown;
921
+ readonly discriminator?: string | undefined;
922
+ }
923
+ interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
924
+ readonly code: "invalid_key";
925
+ readonly origin: "map" | "record";
926
+ readonly issues: $ZodIssue[];
927
+ readonly input?: Input;
928
+ }
929
+ interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
930
+ readonly code: "invalid_element";
931
+ readonly origin: "map" | "set";
932
+ readonly key: unknown;
933
+ readonly issues: $ZodIssue[];
934
+ readonly input?: Input;
935
+ }
936
+ interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
937
+ readonly code: "invalid_value";
938
+ readonly values: Primitive[];
939
+ readonly input?: Input;
940
+ }
941
+ interface $ZodIssueCustom extends $ZodIssueBase {
942
+ readonly code: "custom";
943
+ readonly params?: Record<string, any> | undefined;
944
+ readonly input?: unknown;
945
+ }
946
+ type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
947
+ type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue$1<T> : never;
948
+ type RawIssue$1<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
949
+ /** The input data */
950
+ readonly input: unknown;
951
+ /** The schema or check that originated this issue. */
952
+ readonly inst?: $ZodType | $ZodCheck;
953
+ /** If `true`, Zod will continue executing checks/refinements after this issue. */
954
+ readonly continue?: boolean | undefined;
955
+ } & Record<string, unknown>> : never;
956
+ type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
957
+ interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
958
+ (issue: $ZodRawIssue<T>): {
959
+ message: string;
960
+ } | string | undefined | null;
961
+ }
962
+ interface $ZodError<T = unknown> extends Error {
963
+ type: T;
964
+ issues: $ZodIssue[];
965
+ _zod: {
966
+ output: T;
967
+ def: $ZodIssue[];
968
+ };
969
+ stack?: string;
970
+ name: string;
971
+ }
972
+ declare const $ZodError: $constructor<$ZodError>;
973
+ type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
974
+ type _FlattenedError<T, U = string> = {
975
+ formErrors: U[];
976
+ fieldErrors: {
977
+ [P in keyof T]?: U[];
978
+ };
979
+ };
980
+ type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {
981
+ [K in keyof T]?: $ZodFormattedError<T[K], U>;
982
+ } : T extends any[] ? {
983
+ [k: number]: $ZodFormattedError<T[number], U>;
984
+ } : T extends object ? Flatten<{
985
+ [K in keyof T]?: $ZodFormattedError<T[K], U>;
986
+ }> : any;
987
+ type $ZodFormattedError<T, U = string> = {
988
+ _errors: U[];
989
+ } & Flatten<_ZodFormattedError<T, U>>;
990
+
991
+ type ZodTrait = {
992
+ _zod: {
993
+ def: any;
994
+ [k: string]: any;
995
+ };
996
+ };
997
+ interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
998
+ new (def: D): T;
999
+ init(inst: T, def: D): asserts inst is T;
1000
+ }
1001
+ declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void, params?: {
1002
+ Parent?: typeof Class;
1003
+ }): $constructor<T, D>;
1004
+ declare const $brand: unique symbol;
1005
+ type $brand<T extends string | number | symbol = string | number | symbol> = {
1006
+ [$brand]: {
1007
+ [k in T]: true;
1008
+ };
1009
+ };
1010
+ type $ZodBranded<T extends SomeType, Brand extends string | number | symbol> = T & Record<"_zod", Record<"output", output<T> & $brand<Brand>>>;
1011
+ type input<T> = T extends {
1012
+ _zod: {
1013
+ input: any;
1014
+ };
1015
+ } ? T["_zod"]["input"] : unknown;
1016
+ type output<T> = T extends {
1017
+ _zod: {
1018
+ output: any;
1019
+ };
1020
+ } ? T["_zod"]["output"] : unknown;
1021
+
1022
+ declare const $output: unique symbol;
1023
+ type $output = typeof $output;
1024
+ declare const $input: unique symbol;
1025
+ type $input = typeof $input;
1026
+ type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends (...args: infer P) => infer R ? (...args: {
1027
+ [K in keyof P]: $replace<P[K], S>;
1028
+ }) => $replace<R, S> : Meta extends object ? {
1029
+ [K in keyof Meta]: $replace<Meta[K], S>;
1030
+ } : Meta;
1031
+ type MetadataType = object | undefined;
1032
+ declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
1033
+ _meta: Meta;
1034
+ _schema: Schema;
1035
+ _map: Map<Schema, $replace<Meta, Schema>>;
1036
+ _idmap: Map<string, Schema>;
1037
+ add<S extends Schema>(schema: S, ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]): this;
1038
+ clear(): this;
1039
+ remove(schema: Schema): this;
1040
+ get<S extends Schema>(schema: S): $replace<Meta, S> | undefined;
1041
+ has(schema: Schema): boolean;
1042
+ }
1043
+ interface JSONSchemaMeta {
1044
+ id?: string | undefined;
1045
+ title?: string | undefined;
1046
+ description?: string | undefined;
1047
+ deprecated?: boolean | undefined;
1048
+ [k: string]: unknown;
1049
+ }
1050
+ interface GlobalMeta extends JSONSchemaMeta {
1051
+ }
1052
+
1053
+ type Params<T extends $ZodType | $ZodCheck, IssueTypes extends $ZodIssueBase, OmitKeys extends keyof T["_zod"]["def"] = never> = Flatten<Partial<EmptyToNever<Omit<T["_zod"]["def"], OmitKeys> & ([IssueTypes] extends [never] ? {} : {
1054
+ error?: string | $ZodErrorMap<IssueTypes> | undefined;
1055
+ /** @deprecated This parameter is deprecated. Use `error` instead. */
1056
+ message?: string | undefined;
1057
+ })>>>;
1058
+ type TypeParams<T extends $ZodType = $ZodType & {
1059
+ _isst: never;
1060
+ }, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error"> = never> = Params<T, NonNullable<T["_zod"]["isst"]>, "type" | "checks" | "error" | AlsoOmit>;
1061
+ type CheckParams<T extends $ZodCheck = $ZodCheck, // & { _issc: never },
1062
+ AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
1063
+ type CheckStringFormatParams<T extends $ZodStringFormat = $ZodStringFormat, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "coerce" | "checks" | "error" | "check" | "format"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "type" | "coerce" | "checks" | "error" | "check" | "format" | AlsoOmit>;
1064
+ type CheckTypeParams<T extends $ZodType & $ZodCheck = $ZodType & $ZodCheck, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error" | "check"> = never> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
1065
+ type $ZodCheckEmailParams = CheckStringFormatParams<$ZodEmail, "when">;
1066
+ type $ZodCheckGUIDParams = CheckStringFormatParams<$ZodGUID, "pattern" | "when">;
1067
+ type $ZodCheckUUIDParams = CheckStringFormatParams<$ZodUUID, "pattern" | "when">;
1068
+ type $ZodCheckURLParams = CheckStringFormatParams<$ZodURL, "when">;
1069
+ type $ZodCheckEmojiParams = CheckStringFormatParams<$ZodEmoji, "when">;
1070
+ type $ZodCheckNanoIDParams = CheckStringFormatParams<$ZodNanoID, "when">;
1071
+ type $ZodCheckCUIDParams = CheckStringFormatParams<$ZodCUID, "when">;
1072
+ type $ZodCheckCUID2Params = CheckStringFormatParams<$ZodCUID2, "when">;
1073
+ type $ZodCheckULIDParams = CheckStringFormatParams<$ZodULID, "when">;
1074
+ type $ZodCheckXIDParams = CheckStringFormatParams<$ZodXID, "when">;
1075
+ type $ZodCheckKSUIDParams = CheckStringFormatParams<$ZodKSUID, "when">;
1076
+ type $ZodCheckIPv4Params = CheckStringFormatParams<$ZodIPv4, "pattern" | "when" | "version">;
1077
+ type $ZodCheckIPv6Params = CheckStringFormatParams<$ZodIPv6, "pattern" | "when" | "version">;
1078
+ type $ZodCheckCIDRv4Params = CheckStringFormatParams<$ZodCIDRv4, "pattern" | "when">;
1079
+ type $ZodCheckCIDRv6Params = CheckStringFormatParams<$ZodCIDRv6, "pattern" | "when">;
1080
+ type $ZodCheckBase64Params = CheckStringFormatParams<$ZodBase64, "pattern" | "when">;
1081
+ type $ZodCheckBase64URLParams = CheckStringFormatParams<$ZodBase64URL, "pattern" | "when">;
1082
+ type $ZodCheckE164Params = CheckStringFormatParams<$ZodE164, "when">;
1083
+ type $ZodCheckJWTParams = CheckStringFormatParams<$ZodJWT, "pattern" | "when">;
1084
+ type $ZodCheckISODateTimeParams = CheckStringFormatParams<$ZodISODateTime, "pattern" | "when">;
1085
+ type $ZodCheckISODateParams = CheckStringFormatParams<$ZodISODate, "pattern" | "when">;
1086
+ type $ZodCheckISOTimeParams = CheckStringFormatParams<$ZodISOTime, "pattern" | "when">;
1087
+ type $ZodCheckISODurationParams = CheckStringFormatParams<$ZodISODuration, "when">;
1088
+ type $ZodCheckMaxLengthParams = CheckParams<$ZodCheckMaxLength, "maximum" | "when">;
1089
+ type $ZodCheckMinLengthParams = CheckParams<$ZodCheckMinLength, "minimum" | "when">;
1090
+ type $ZodCheckLengthEqualsParams = CheckParams<$ZodCheckLengthEquals, "length" | "when">;
1091
+ type $ZodCheckRegexParams = CheckParams<$ZodCheckRegex, "format" | "pattern" | "when">;
1092
+ type $ZodCheckLowerCaseParams = CheckParams<$ZodCheckLowerCase, "format" | "when">;
1093
+ type $ZodCheckUpperCaseParams = CheckParams<$ZodCheckUpperCase, "format" | "when">;
1094
+ type $ZodCheckIncludesParams = CheckParams<$ZodCheckIncludes, "includes" | "format" | "when" | "pattern">;
1095
+ type $ZodCheckStartsWithParams = CheckParams<$ZodCheckStartsWith, "prefix" | "format" | "when" | "pattern">;
1096
+ type $ZodCheckEndsWithParams = CheckParams<$ZodCheckEndsWith, "suffix" | "format" | "pattern" | "when">;
1097
+ type $ZodEnumParams = TypeParams<$ZodEnum, "entries">;
1098
+ type $ZodNonOptionalParams = TypeParams<$ZodNonOptional, "innerType">;
1099
+ type $ZodCustomParams = CheckTypeParams<$ZodCustom, "fn">;
1100
+ type $ZodSuperRefineIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
1101
+ type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
1102
+ /** The schema or check that originated this issue. */
1103
+ readonly inst?: $ZodType | $ZodCheck;
1104
+ /** If `true`, Zod will continue executing checks/refinements after this issue. */
1105
+ readonly continue?: boolean | undefined;
1106
+ } & Record<string, unknown>> : never;
1107
+ interface $RefinementCtx<T = unknown> extends ParsePayload<T> {
1108
+ addIssue(arg: string | $ZodSuperRefineIssue): void;
1109
+ }
1110
+
1111
+ /** An Error-like class used to store Zod validation issues. */
1112
+ interface ZodError<T = unknown> extends $ZodError<T> {
1113
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
1114
+ format(): $ZodFormattedError<T>;
1115
+ format<U>(mapper: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
1116
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
1117
+ flatten(): $ZodFlattenedError<T>;
1118
+ flatten<U>(mapper: (issue: $ZodIssue) => U): $ZodFlattenedError<T, U>;
1119
+ /** @deprecated Push directly to `.issues` instead. */
1120
+ addIssue(issue: $ZodIssue): void;
1121
+ /** @deprecated Push directly to `.issues` instead. */
1122
+ addIssues(issues: $ZodIssue[]): void;
1123
+ /** @deprecated Check `err.issues.length === 0` instead. */
1124
+ isEmpty: boolean;
1125
+ }
1126
+ declare const ZodError: $constructor<ZodError>;
1127
+
1128
+ type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
1129
+ type ZodSafeParseSuccess<T> = {
1130
+ success: true;
1131
+ data: T;
1132
+ error?: never;
1133
+ };
1134
+ type ZodSafeParseError<T> = {
1135
+ success: false;
1136
+ data?: never;
1137
+ error: ZodError<T>;
1138
+ };
1139
+
1140
+ interface _ZodType<out Internals extends $ZodTypeInternals = $ZodTypeInternals> extends ZodType<any, any, Internals> {
1141
+ }
1142
+ interface ZodType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
1143
+ def: Internals["def"];
1144
+ type: Internals["def"]["type"];
1145
+ /** @deprecated Use `.def` instead. */
1146
+ _def: Internals["def"];
1147
+ /** @deprecated Use `z.output<typeof schema>` instead. */
1148
+ _output: Internals["output"];
1149
+ /** @deprecated Use `z.input<typeof schema>` instead. */
1150
+ _input: Internals["input"];
1151
+ check(...checks: (CheckFn<output<this>> | $ZodCheck<output<this>>)[]): this;
1152
+ clone(def?: Internals["def"], params?: {
1153
+ parent: boolean;
1154
+ }): this;
1155
+ register<R extends $ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [$replace<R["_meta"], this>?] : [$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
1156
+ brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : $ZodBranded<this, T>;
1157
+ parse(data: unknown, params?: ParseContext<$ZodIssue>): output<this>;
1158
+ safeParse(data: unknown, params?: ParseContext<$ZodIssue>): ZodSafeParseResult<output<this>>;
1159
+ parseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<output<this>>;
1160
+ safeParseAsync(data: unknown, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
1161
+ spa: (data: unknown, params?: ParseContext<$ZodIssue>) => Promise<ZodSafeParseResult<output<this>>>;
1162
+ refine(check: (arg: output<this>) => unknown | Promise<unknown>, params?: string | $ZodCustomParams): this;
1163
+ superRefine(refinement: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => void | Promise<void>): this;
1164
+ overwrite(fn: (x: output<this>) => output<this>): this;
1165
+ optional(): ZodOptional<this>;
1166
+ nonoptional(params?: string | $ZodNonOptionalParams): ZodNonOptional<this>;
1167
+ nullable(): ZodNullable<this>;
1168
+ nullish(): ZodOptional<ZodNullable<this>>;
1169
+ default(def: output<this>): ZodDefault<this>;
1170
+ default(def: () => NoUndefined<output<this>>): ZodDefault<this>;
1171
+ prefault(def: () => input<this>): ZodPrefault<this>;
1172
+ prefault(def: input<this>): ZodPrefault<this>;
1173
+ array(): ZodArray<this>;
1174
+ or<T extends SomeType>(option: T): ZodUnion<[this, T]>;
1175
+ and<T extends SomeType>(incoming: T): ZodIntersection<this, T>;
1176
+ transform<NewOut>(transform: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, output<this>>>;
1177
+ catch(def: output<this>): ZodCatch<this>;
1178
+ catch(def: (ctx: $ZodCatchCtx) => output<this>): ZodCatch<this>;
1179
+ pipe<T extends $ZodType<any, output<this>>>(target: T | $ZodType<any, output<this>>): ZodPipe<this, T>;
1180
+ readonly(): ZodReadonly<this>;
1181
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
1182
+ describe(description: string): this;
1183
+ description?: string;
1184
+ /** Returns the metadata associated with this instance in `z.globalRegistry` */
1185
+ meta(): $replace<GlobalMeta, this> | undefined;
1186
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
1187
+ meta(data: $replace<GlobalMeta, this>): this;
1188
+ /** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
1189
+ *
1190
+ * ```ts
1191
+ * const schema = z.string().optional();
1192
+ * const isOptional = schema.safeParse(undefined).success; // true
1193
+ * ```
1194
+ */
1195
+ isOptional(): boolean;
1196
+ /**
1197
+ * @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
1198
+ *
1199
+ * ```ts
1200
+ * const schema = z.string().nullable();
1201
+ * const isNullable = schema.safeParse(null).success; // true
1202
+ * ```
1203
+ */
1204
+ isNullable(): boolean;
1205
+ }
1206
+ declare const ZodType: $constructor<ZodType>;
1207
+ interface _ZodString<T extends $ZodStringInternals<unknown> = $ZodStringInternals<unknown>> extends _ZodType<T> {
1208
+ format: string | null;
1209
+ minLength: number | null;
1210
+ maxLength: number | null;
1211
+ regex(regex: RegExp, params?: string | $ZodCheckRegexParams): this;
1212
+ includes(value: string, params?: $ZodCheckIncludesParams): this;
1213
+ startsWith(value: string, params?: string | $ZodCheckStartsWithParams): this;
1214
+ endsWith(value: string, params?: string | $ZodCheckEndsWithParams): this;
1215
+ min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
1216
+ max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
1217
+ length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
1218
+ nonempty(params?: string | $ZodCheckMinLengthParams): this;
1219
+ lowercase(params?: string | $ZodCheckLowerCaseParams): this;
1220
+ uppercase(params?: string | $ZodCheckUpperCaseParams): this;
1221
+ trim(): this;
1222
+ normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
1223
+ toLowerCase(): this;
1224
+ toUpperCase(): this;
1225
+ }
1226
+ /** @internal */
1227
+ declare const _ZodString: $constructor<_ZodString>;
1228
+ interface ZodString extends _ZodString<$ZodStringInternals<string>> {
1229
+ /** @deprecated Use `z.email()` instead. */
1230
+ email(params?: string | $ZodCheckEmailParams): this;
1231
+ /** @deprecated Use `z.url()` instead. */
1232
+ url(params?: string | $ZodCheckURLParams): this;
1233
+ /** @deprecated Use `z.jwt()` instead. */
1234
+ jwt(params?: string | $ZodCheckJWTParams): this;
1235
+ /** @deprecated Use `z.emoji()` instead. */
1236
+ emoji(params?: string | $ZodCheckEmojiParams): this;
1237
+ /** @deprecated Use `z.guid()` instead. */
1238
+ guid(params?: string | $ZodCheckGUIDParams): this;
1239
+ /** @deprecated Use `z.uuid()` instead. */
1240
+ uuid(params?: string | $ZodCheckUUIDParams): this;
1241
+ /** @deprecated Use `z.uuid()` instead. */
1242
+ uuidv4(params?: string | $ZodCheckUUIDParams): this;
1243
+ /** @deprecated Use `z.uuid()` instead. */
1244
+ uuidv6(params?: string | $ZodCheckUUIDParams): this;
1245
+ /** @deprecated Use `z.uuid()` instead. */
1246
+ uuidv7(params?: string | $ZodCheckUUIDParams): this;
1247
+ /** @deprecated Use `z.nanoid()` instead. */
1248
+ nanoid(params?: string | $ZodCheckNanoIDParams): this;
1249
+ /** @deprecated Use `z.guid()` instead. */
1250
+ guid(params?: string | $ZodCheckGUIDParams): this;
1251
+ /** @deprecated Use `z.cuid()` instead. */
1252
+ cuid(params?: string | $ZodCheckCUIDParams): this;
1253
+ /** @deprecated Use `z.cuid2()` instead. */
1254
+ cuid2(params?: string | $ZodCheckCUID2Params): this;
1255
+ /** @deprecated Use `z.ulid()` instead. */
1256
+ ulid(params?: string | $ZodCheckULIDParams): this;
1257
+ /** @deprecated Use `z.base64()` instead. */
1258
+ base64(params?: string | $ZodCheckBase64Params): this;
1259
+ /** @deprecated Use `z.base64url()` instead. */
1260
+ base64url(params?: string | $ZodCheckBase64URLParams): this;
1261
+ /** @deprecated Use `z.xid()` instead. */
1262
+ xid(params?: string | $ZodCheckXIDParams): this;
1263
+ /** @deprecated Use `z.ksuid()` instead. */
1264
+ ksuid(params?: string | $ZodCheckKSUIDParams): this;
1265
+ /** @deprecated Use `z.ipv4()` instead. */
1266
+ ipv4(params?: string | $ZodCheckIPv4Params): this;
1267
+ /** @deprecated Use `z.ipv6()` instead. */
1268
+ ipv6(params?: string | $ZodCheckIPv6Params): this;
1269
+ /** @deprecated Use `z.cidrv4()` instead. */
1270
+ cidrv4(params?: string | $ZodCheckCIDRv4Params): this;
1271
+ /** @deprecated Use `z.cidrv6()` instead. */
1272
+ cidrv6(params?: string | $ZodCheckCIDRv6Params): this;
1273
+ /** @deprecated Use `z.e164()` instead. */
1274
+ e164(params?: string | $ZodCheckE164Params): this;
1275
+ /** @deprecated Use `z.iso.datetime()` instead. */
1276
+ datetime(params?: string | $ZodCheckISODateTimeParams): this;
1277
+ /** @deprecated Use `z.iso.date()` instead. */
1278
+ date(params?: string | $ZodCheckISODateParams): this;
1279
+ /** @deprecated Use `z.iso.time()` instead. */
1280
+ time(params?: string | $ZodCheckISOTimeParams): this;
1281
+ /** @deprecated Use `z.iso.duration()` instead. */
1282
+ duration(params?: string | $ZodCheckISODurationParams): this;
1283
+ }
1284
+ declare const ZodString: $constructor<ZodString>;
1285
+ interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInternals<T>>, $ZodArray<T> {
1286
+ element: T;
1287
+ min(minLength: number, params?: string | $ZodCheckMinLengthParams): this;
1288
+ nonempty(params?: string | $ZodCheckMinLengthParams): this;
1289
+ max(maxLength: number, params?: string | $ZodCheckMaxLengthParams): this;
1290
+ length(len: number, params?: string | $ZodCheckLengthEqualsParams): this;
1291
+ unwrap(): T;
1292
+ }
1293
+ declare const ZodArray: $constructor<ZodArray>;
1294
+ interface ZodObject<
1295
+ /** @ts-ignore Cast variance */
1296
+ out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
1297
+ shape: Shape;
1298
+ keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
1299
+ /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
1300
+ catchall<T extends SomeType>(schema: T): ZodObject<Shape, $catchall<T>>;
1301
+ /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
1302
+ passthrough(): ZodObject<Shape, $loose>;
1303
+ /** Consider `z.looseObject(A.shape)` instead */
1304
+ loose(): ZodObject<Shape, $loose>;
1305
+ /** Consider `z.strictObject(A.shape)` instead */
1306
+ strict(): ZodObject<Shape, $strict>;
1307
+ /** This is the default behavior. This method call is likely unnecessary. */
1308
+ strip(): ZodObject<Shape, $strip>;
1309
+ extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, U>, Config>;
1310
+ /**
1311
+ * @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
1312
+ */
1313
+ merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
1314
+ pick<M extends Mask<keyof Shape>>(mask: M): ZodObject<Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
1315
+ omit<M extends Mask<keyof Shape>>(mask: M): ZodObject<Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
1316
+ partial(): ZodObject<{
1317
+ [k in keyof Shape]: ZodOptional<Shape[k]>;
1318
+ }, Config>;
1319
+ partial<M extends Mask<keyof Shape>>(mask: M): ZodObject<{
1320
+ [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k];
1321
+ }, Config>;
1322
+ required(): ZodObject<{
1323
+ [k in keyof Shape]: ZodNonOptional<Shape[k]>;
1324
+ }, Config>;
1325
+ required<M extends Mask<keyof Shape>>(mask: M): ZodObject<{
1326
+ [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k];
1327
+ }, Config>;
1328
+ }
1329
+ declare const ZodObject: $constructor<ZodObject>;
1330
+ interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
1331
+ options: T;
1332
+ }
1333
+ declare const ZodUnion: $constructor<ZodUnion>;
1334
+ interface ZodIntersection<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodIntersectionInternals<A, B>>, $ZodIntersection<A, B> {
1335
+ }
1336
+ declare const ZodIntersection: $constructor<ZodIntersection>;
1337
+ interface ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType> extends _ZodType<$ZodRecordInternals<Key, Value>>, $ZodRecord<Key, Value> {
1338
+ keyType: Key;
1339
+ valueType: Value;
1340
+ }
1341
+ declare const ZodRecord: $constructor<ZodRecord>;
1342
+ interface ZodEnum<
1343
+ /** @ts-ignore Cast variance */
1344
+ out T extends EnumLike = EnumLike> extends _ZodType<$ZodEnumInternals<T>>, $ZodEnum<T> {
1345
+ enum: T;
1346
+ options: Array<T[keyof T]>;
1347
+ extract<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Pick<T, U[number]>>>;
1348
+ exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | $ZodEnumParams): ZodEnum<Flatten<Omit<T, U[number]>>>;
1349
+ }
1350
+ declare const ZodEnum: $constructor<ZodEnum>;
1351
+ interface ZodTransform<O = unknown, I = unknown> extends _ZodType<$ZodTransformInternals<O, I>>, $ZodTransform<O, I> {
1352
+ }
1353
+ declare const ZodTransform: $constructor<ZodTransform>;
1354
+ interface ZodOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodOptionalInternals<T>>, $ZodOptional<T> {
1355
+ unwrap(): T;
1356
+ }
1357
+ declare const ZodOptional: $constructor<ZodOptional>;
1358
+ interface ZodNullable<T extends SomeType = $ZodType> extends _ZodType<$ZodNullableInternals<T>>, $ZodNullable<T> {
1359
+ unwrap(): T;
1360
+ }
1361
+ declare const ZodNullable: $constructor<ZodNullable>;
1362
+ interface ZodDefault<T extends SomeType = $ZodType> extends _ZodType<$ZodDefaultInternals<T>>, $ZodDefault<T> {
1363
+ unwrap(): T;
1364
+ /** @deprecated Use `.unwrap()` instead. */
1365
+ removeDefault(): T;
1366
+ }
1367
+ declare const ZodDefault: $constructor<ZodDefault>;
1368
+ interface ZodPrefault<T extends SomeType = $ZodType> extends _ZodType<$ZodPrefaultInternals<T>>, $ZodPrefault<T> {
1369
+ unwrap(): T;
1370
+ }
1371
+ declare const ZodPrefault: $constructor<ZodPrefault>;
1372
+ interface ZodNonOptional<T extends SomeType = $ZodType> extends _ZodType<$ZodNonOptionalInternals<T>>, $ZodNonOptional<T> {
1373
+ unwrap(): T;
1374
+ }
1375
+ declare const ZodNonOptional: $constructor<ZodNonOptional>;
1376
+ interface ZodCatch<T extends SomeType = $ZodType> extends _ZodType<$ZodCatchInternals<T>>, $ZodCatch<T> {
1377
+ unwrap(): T;
1378
+ /** @deprecated Use `.unwrap()` instead. */
1379
+ removeCatch(): T;
1380
+ }
1381
+ declare const ZodCatch: $constructor<ZodCatch>;
1382
+ interface ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $ZodType> extends _ZodType<$ZodPipeInternals<A, B>>, $ZodPipe<A, B> {
1383
+ in: A;
1384
+ out: B;
1385
+ }
1386
+ declare const ZodPipe: $constructor<ZodPipe>;
1387
+ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadonlyInternals<T>>, $ZodReadonly<T> {
1388
+ unwrap(): T;
1389
+ }
1390
+ declare const ZodReadonly: $constructor<ZodReadonly>;
1391
+
1392
+ declare const LikeC4ProjectJsonConfigSchema: ZodObject<{
1393
+ name: ZodPipe<ZodString, ZodTransform<ProjectId, string>>;
1394
+ title: ZodOptional<ZodString>;
1395
+ contactPerson: ZodOptional<ZodString>;
1396
+ imageAliases: ZodOptional<ZodRecord<ZodString, ZodString>>;
1397
+ exclude: ZodOptional<ZodArray<ZodString>>;
1398
+ }, $strip>;
1399
+ type LikeC4ProjectJsonConfig = input<typeof LikeC4ProjectJsonConfigSchema>;
1400
+ interface GeneratorFnContext {
1401
+ /**
1402
+ * Workspace root directory
1403
+ */
1404
+ readonly workspace: URI;
1405
+ /**
1406
+ * Current project
1407
+ */
1408
+ readonly project: {
1409
+ /**
1410
+ * Project name
1411
+ */
1412
+ readonly id: ProjectId;
1413
+ readonly title?: string;
1414
+ /**
1415
+ * Project folder
1416
+ */
1417
+ readonly folder: URI;
1418
+ };
1419
+ /**
1420
+ * Returns the location of the specified element, relation, view or deployment element
1421
+ */
1422
+ locate(target: ElementModel | RelationshipModel | DeploymentRelationModel | LikeC4ViewModel | DeploymentElementModel): {
1423
+ /**
1424
+ * Range inside the source file
1425
+ */
1426
+ range: {
1427
+ start: {
1428
+ line: number;
1429
+ character: number;
1430
+ };
1431
+ end: {
1432
+ line: number;
1433
+ character: number;
1434
+ };
1435
+ };
1436
+ /**
1437
+ * Full path to the source file
1438
+ */
1439
+ document: URI;
1440
+ /**
1441
+ * Document path relative to the project folder
1442
+ */
1443
+ relativePath: string;
1444
+ /**
1445
+ * Folder, containing the source file ("dirname" of document)
1446
+ */
1447
+ folder: string;
1448
+ /**
1449
+ * Source file name ("basename" of document)
1450
+ */
1451
+ filename: string;
1452
+ };
1453
+ /**
1454
+ * Write a file
1455
+ * @param path - Path to the file, either absolute or relative to the project folder
1456
+ * All folders will be created automatically
1457
+ * @param content - Content of the file
1458
+ */
1459
+ write(file: {
1460
+ path: string | string[] | URI;
1461
+ content: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | NodeJS.ReadableStream;
1462
+ }): Promise<void>;
1463
+ /**
1464
+ * Abort the process
1465
+ */
1466
+ abort(reason?: string): never;
1467
+ }
1468
+ type GeneratorFnParams = {
1469
+ /**
1470
+ * LikeC4 model
1471
+ */
1472
+ likec4model: LikeC4Model<aux.UnknownLayouted>;
1473
+ /**
1474
+ * Generator context
1475
+ */
1476
+ ctx: GeneratorFnContext;
1477
+ };
1478
+ interface GeneratorFn {
1479
+ (params: GeneratorFnParams): Promise<void> | void;
1480
+ }
1481
+ /**
1482
+ * LikeC4 project configuration
1483
+ *
1484
+ * @example
1485
+ * ```ts
1486
+ * export default defineConfig({
1487
+ * name: 'my-project',
1488
+ * generators: {
1489
+ * 'my-generator': async ({ likec4model, ctx }) => {
1490
+ * await ctx.write('my-generator.txt', likec4model.project.id)
1491
+ * }
1492
+ * }
1493
+ * })
1494
+ * ```
1495
+ */
1496
+ type LikeC4ProjectConfig = input<typeof LikeC4ProjectJsonConfigSchema> & {
1497
+ /**
1498
+ * Add custom generators to the project
1499
+ * @example
1500
+ * ```ts
1501
+ * export default defineConfig({
1502
+ * name: 'my-project',
1503
+ * generators: {
1504
+ * 'my-generator': async ({ likec4model, ctx }) => {
1505
+ * await ctx.write('my-generator.txt', likec4model.project.id)
1506
+ * }
1507
+ * }
1508
+ * })
1509
+ * ```
1510
+ *
1511
+ * Execute generator:
1512
+ * ```bash
1513
+ * likec4 gen my-generator
1514
+ * ```
1515
+ */
1516
+ generators?: Record<string, GeneratorFn> | undefined;
1517
+ };
1518
+ /**
1519
+ * Validates JSON string or JSON object into a LikeC4ProjectConfig object.
1520
+ */
1521
+ declare function validateProjectConfig<C extends string | Record<string, unknown>>(config: C): LikeC4ProjectConfig;
1522
+ /**
1523
+ * Converts a LikeC4ProjectConfig object into a LikeC4ProjectJsonConfig object.
1524
+ * Omit generators property (as it is not serializable)
1525
+ */
1526
+ declare function serializableLikeC4ProjectConfig({ generators, ...config }: LikeC4ProjectConfig): LikeC4ProjectJsonConfig;
1527
+
1528
+ declare const configJsonFilenames: readonly [".likec4rc", ".likec4.config.json", "likec4.config.json"];
1529
+ declare const configNonJsonFilenames: readonly ["likec4.config.js", "likec4.config.mjs", "likec4.config.ts", "likec4.config.mts"];
1530
+ declare const ConfigFilenames: readonly [".likec4rc", ".likec4.config.json", "likec4.config.json", "likec4.config.js", "likec4.config.mjs", "likec4.config.ts", "likec4.config.mts"];
1531
+ /**
1532
+ * Checks if the given filename is a LikeC4 JSON config file (JSON, RC).
1533
+ */
1534
+ declare function isLikeC4JsonConfig(filename: string): filename is typeof configJsonFilenames[number];
1535
+ /**
1536
+ * Checks if the given filename is a LikeC4 non-JSON config file (JS, MJS, TS, MTS)
1537
+ */
1538
+ declare function isLikeC4NonJsonConfig(filename: string): filename is typeof configNonJsonFilenames[number];
1539
+ /**
1540
+ * Checks if the given filename is a LikeC4 config file (JSON or non-JSON)
1541
+ */
1542
+ declare function isLikeC4Config(filename: string): filename is typeof ConfigFilenames[number];
1543
+
1544
+ /**
1545
+ * Defines LikeC4 Project, allows custom generators that can be executed using CLI:
1546
+ *
1547
+ * `$ likec4 gen <generator-name>`
1548
+ *
1549
+ * or VSCode command `LikeC4: Run code generator`
1550
+ *
1551
+ * @example
1552
+ * ```ts
1553
+ * export default defineConfig({
1554
+ * name: 'my-project',
1555
+ * title: 'My Project',
1556
+ * exclude: ['picomatch pattern'],
1557
+ * generators: {
1558
+ * 'my-generator': async ({ likec4model, ctx }) => {
1559
+ * await ctx.write('my-generator.txt', likec4model.project.id)
1560
+ * }
1561
+ * }
1562
+ * })
1563
+ * ```
1564
+ */
1565
+ declare function defineConfig<const C extends LikeC4ProjectConfig>(config: C): C;
1566
+ /**
1567
+ * Define reusable custom generators
1568
+ *
1569
+ * @example
1570
+ * ```ts
1571
+ * // generators.ts
1572
+ * export default defineGenerators({
1573
+ * 'my-generator': async ({ likec4model, ctx }) => {
1574
+ * await ctx.write('my-generator.txt', likec4model.project.id)
1575
+ * }
1576
+ * })
1577
+ *
1578
+ * // likec4.config.ts
1579
+ * import generators from './generators'
1580
+ *
1581
+ * export default defineConfig({
1582
+ * name: 'my-project',
1583
+ * generators,
1584
+ * })
1585
+ * ```
1586
+ */
1587
+ declare function defineGenerators<const G extends Record<string, GeneratorFn>>(generators: G): G;
1588
+
1589
+ export { ConfigFilenames, type GeneratorFn, type GeneratorFnContext, type GeneratorFnParams, type LikeC4ProjectConfig, type LikeC4ProjectJsonConfig, defineConfig, defineGenerators, isLikeC4Config, isLikeC4JsonConfig, isLikeC4NonJsonConfig, serializableLikeC4ProjectConfig, validateProjectConfig };