@kubb/plugin-zod 4.20.2 → 4.20.5

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.
Files changed (73) hide show
  1. package/dist/components.d.cts +2 -1
  2. package/dist/components.d.ts +2 -1
  3. package/dist/{generators-DWTQMdiR.js → generators-BawvbIJ1.js} +13 -7
  4. package/dist/generators-BawvbIJ1.js.map +1 -0
  5. package/dist/{generators-YkwNz13t.cjs → generators-DGBZd16i.cjs} +13 -7
  6. package/dist/generators-DGBZd16i.cjs.map +1 -0
  7. package/dist/generators.cjs +1 -1
  8. package/dist/generators.d.cts +1 -1
  9. package/dist/generators.d.ts +1 -1
  10. package/dist/generators.js +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.cts +3 -2
  13. package/dist/index.d.ts +3 -2
  14. package/dist/index.js +1 -1
  15. package/dist/types-23ND42NW.d.cts +696 -0
  16. package/dist/types-CyZ4p-xC.d.ts +695 -0
  17. package/package.json +10 -6
  18. package/src/generators/__snapshots__/anyof.ts +1 -1
  19. package/src/generators/__snapshots__/coercion.ts +1 -1
  20. package/src/generators/__snapshots__/coercionDates.ts +1 -1
  21. package/src/generators/__snapshots__/coercionNumbers.ts +1 -1
  22. package/src/generators/__snapshots__/coercionStrings.ts +1 -1
  23. package/src/generators/__snapshots__/createItemUnionWithReadOnly.ts +1 -1
  24. package/src/generators/__snapshots__/createPet.ts +1 -1
  25. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +1 -1
  26. package/src/generators/__snapshots__/deletePet.ts +1 -1
  27. package/src/generators/__snapshots__/discriminator.ts +1 -1
  28. package/src/generators/__snapshots__/enumBooleanLiteral.ts +1 -1
  29. package/src/generators/__snapshots__/enumNamesType.ts +1 -1
  30. package/src/generators/__snapshots__/enumNullable.ts +1 -1
  31. package/src/generators/__snapshots__/enumSingleLiteral.ts +1 -1
  32. package/src/generators/__snapshots__/enumVarNamesType.ts +1 -1
  33. package/src/generators/__snapshots__/example.ts +1 -1
  34. package/src/generators/__snapshots__/exclusiveNumbers.ts +1 -1
  35. package/src/generators/__snapshots__/getPets.ts +1 -1
  36. package/src/generators/__snapshots__/getPetsWithQueryFilter_wrapOutput_all_.ts +1 -1
  37. package/src/generators/__snapshots__/imageNullable.ts +1 -1
  38. package/src/generators/__snapshots__/mixedValueTypeConst.ts +1 -1
  39. package/src/generators/__snapshots__/nullable.ts +1 -1
  40. package/src/generators/__snapshots__/nullableString.ts +1 -1
  41. package/src/generators/__snapshots__/nullableStringUuid.ts +1 -1
  42. package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +1 -1
  43. package/src/generators/__snapshots__/numberValueConst.ts +1 -1
  44. package/src/generators/__snapshots__/oneof.ts +1 -1
  45. package/src/generators/__snapshots__/operations.ts +1 -1
  46. package/src/generators/__snapshots__/optionalPetInfer.ts +1 -1
  47. package/src/generators/__snapshots__/optionalPetTyped.ts +1 -1
  48. package/src/generators/__snapshots__/order.ts +1 -1
  49. package/src/generators/__snapshots__/orderDateTyeString.ts +1 -1
  50. package/src/generators/__snapshots__/orderDateTypeFalse.ts +1 -1
  51. package/src/generators/__snapshots__/orderDateTypeString.ts +1 -1
  52. package/src/generators/__snapshots__/pet.ts +1 -1
  53. package/src/generators/__snapshots__/petArray.ts +1 -1
  54. package/src/generators/__snapshots__/petCoercion.ts +1 -1
  55. package/src/generators/__snapshots__/petTupleObject.ts +1 -1
  56. package/src/generators/__snapshots__/petV4.ts +1 -1
  57. package/src/generators/__snapshots__/petWithMapper.ts +1 -1
  58. package/src/generators/__snapshots__/pets.ts +1 -1
  59. package/src/generators/__snapshots__/queryAllDefaulted.ts +1 -1
  60. package/src/generators/__snapshots__/recursive.ts +1 -1
  61. package/src/generators/__snapshots__/showPetById.ts +1 -1
  62. package/src/generators/__snapshots__/stringValueConst.ts +1 -1
  63. package/src/generators/__snapshots__/toy.ts +1 -1
  64. package/src/generators/__snapshots__/unionWithReadOnly.ts +1 -1
  65. package/src/generators/__snapshots__/updateItemUnionWithReadOnly.ts +1 -1
  66. package/src/generators/__snapshots__/uuidSchema.ts +1 -1
  67. package/src/generators/operationsGenerator.tsx +3 -1
  68. package/src/generators/zodGenerator.tsx +6 -2
  69. package/templates/ToZod.ts +1 -1
  70. package/dist/generators-DWTQMdiR.js.map +0 -1
  71. package/dist/generators-YkwNz13t.cjs.map +0 -1
  72. package/dist/types-BBLRijaO.d.ts +0 -1354
  73. package/dist/types-HQfz08mH.d.cts +0 -1355
@@ -0,0 +1,695 @@
1
+ import { t as __name } from "./chunk-eQyhnF5A.js";
2
+ import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
3
+ import { Fabric } from "@kubb/react-fabric";
4
+ import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
5
+ import BaseOas from "oas";
6
+ import { Operation } from "oas/operation";
7
+ import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
8
+ import { KubbFile } from "@kubb/fabric-core/types";
9
+ import { FabricReactNode } from "@kubb/react-fabric/types";
10
+
11
+ //#region ../oas/src/types.d.ts
12
+ type contentType = 'application/json' | (string & {});
13
+ type SchemaObject$1 = SchemaObject & {
14
+ 'x-nullable'?: boolean;
15
+ $ref?: string;
16
+ };
17
+ type HttpMethod = HttpMethods;
18
+ type Document = OASDocument;
19
+ type Operation$1 = Operation;
20
+ type DiscriminatorObject$1 = DiscriminatorObject;
21
+ //#endregion
22
+ //#region ../oas/src/Oas.d.ts
23
+ type OasOptions = {
24
+ contentType?: contentType;
25
+ discriminator?: 'strict' | 'inherit';
26
+ /**
27
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
28
+ * @default false
29
+ */
30
+ collisionDetection?: boolean;
31
+ };
32
+ declare class Oas extends BaseOas {
33
+ #private;
34
+ document: Document;
35
+ constructor(document: Document);
36
+ setOptions(options: OasOptions): void;
37
+ get options(): OasOptions;
38
+ get<T = unknown>($ref: string): T | null;
39
+ getKey($ref: string): string | undefined;
40
+ set($ref: string, value: unknown): false | undefined;
41
+ getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
42
+ dereferenceWithRef<T = unknown>(schema?: T): T;
43
+ getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
44
+ getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
45
+ getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
46
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
47
+ flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
48
+ /**
49
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
50
+ * Returns schemas in dependency order along with name mapping for collision resolution.
51
+ */
52
+ getSchemas(options?: {
53
+ contentType?: contentType;
54
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
55
+ collisionDetection?: boolean;
56
+ }): {
57
+ schemas: Record<string, SchemaObject$1>;
58
+ nameMapping: Map<string, string>;
59
+ };
60
+ }
61
+ //#endregion
62
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
63
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
64
+ #private;
65
+ constructor(maxListener?: number);
66
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
67
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
68
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
69
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
70
+ removeAll(): void;
71
+ }
72
+ //#endregion
73
+ //#region ../core/src/types.d.ts
74
+ declare global {
75
+ namespace Kubb {
76
+ interface PluginContext {}
77
+ }
78
+ }
79
+ /**
80
+ * Config used in `kubb.config.ts`
81
+ *
82
+ * @example
83
+ * import { defineConfig } from '@kubb/core'
84
+ * export default defineConfig({
85
+ * ...
86
+ * })
87
+ */
88
+ //#endregion
89
+ //#region ../plugin-oas/src/SchemaMapper.d.ts
90
+ type SchemaKeywordMapper = {
91
+ object: {
92
+ keyword: 'object';
93
+ args: {
94
+ properties: {
95
+ [x: string]: Schema[];
96
+ };
97
+ additionalProperties: Schema[];
98
+ patternProperties?: Record<string, Schema[]>;
99
+ strict?: boolean;
100
+ };
101
+ };
102
+ url: {
103
+ keyword: 'url';
104
+ };
105
+ readOnly: {
106
+ keyword: 'readOnly';
107
+ };
108
+ writeOnly: {
109
+ keyword: 'writeOnly';
110
+ };
111
+ uuid: {
112
+ keyword: 'uuid';
113
+ };
114
+ email: {
115
+ keyword: 'email';
116
+ };
117
+ firstName: {
118
+ keyword: 'firstName';
119
+ };
120
+ lastName: {
121
+ keyword: 'lastName';
122
+ };
123
+ phone: {
124
+ keyword: 'phone';
125
+ };
126
+ password: {
127
+ keyword: 'password';
128
+ };
129
+ date: {
130
+ keyword: 'date';
131
+ args: {
132
+ type?: 'date' | 'string';
133
+ };
134
+ };
135
+ time: {
136
+ keyword: 'time';
137
+ args: {
138
+ type?: 'date' | 'string';
139
+ };
140
+ };
141
+ datetime: {
142
+ keyword: 'datetime';
143
+ args: {
144
+ offset?: boolean;
145
+ local?: boolean;
146
+ };
147
+ };
148
+ tuple: {
149
+ keyword: 'tuple';
150
+ args: {
151
+ items: Schema[];
152
+ min?: number;
153
+ max?: number;
154
+ rest?: Schema;
155
+ };
156
+ };
157
+ array: {
158
+ keyword: 'array';
159
+ args: {
160
+ items: Schema[];
161
+ min?: number;
162
+ max?: number;
163
+ unique?: boolean;
164
+ };
165
+ };
166
+ enum: {
167
+ keyword: 'enum';
168
+ args: {
169
+ name: string;
170
+ typeName: string;
171
+ asConst: boolean;
172
+ items: Array<{
173
+ name: string | number;
174
+ format: 'string' | 'number' | 'boolean';
175
+ value?: string | number | boolean;
176
+ }>;
177
+ };
178
+ };
179
+ and: {
180
+ keyword: 'and';
181
+ args: Schema[];
182
+ };
183
+ const: {
184
+ keyword: 'const';
185
+ args: {
186
+ name: string | number;
187
+ format: 'string' | 'number' | 'boolean';
188
+ value?: string | number | boolean;
189
+ };
190
+ };
191
+ union: {
192
+ keyword: 'union';
193
+ args: Schema[];
194
+ };
195
+ ref: {
196
+ keyword: 'ref';
197
+ args: {
198
+ name: string;
199
+ $ref: string;
200
+ /**
201
+ * Full qualified path.
202
+ */
203
+ path: KubbFile.Path;
204
+ /**
205
+ * When true `File.Import` is used.
206
+ * When false a reference is used inside the current file.
207
+ */
208
+ isImportable: boolean;
209
+ };
210
+ };
211
+ matches: {
212
+ keyword: 'matches';
213
+ args?: string;
214
+ };
215
+ boolean: {
216
+ keyword: 'boolean';
217
+ };
218
+ default: {
219
+ keyword: 'default';
220
+ args: string | number | boolean;
221
+ };
222
+ string: {
223
+ keyword: 'string';
224
+ };
225
+ integer: {
226
+ keyword: 'integer';
227
+ };
228
+ number: {
229
+ keyword: 'number';
230
+ };
231
+ max: {
232
+ keyword: 'max';
233
+ args: number;
234
+ };
235
+ min: {
236
+ keyword: 'min';
237
+ args: number;
238
+ };
239
+ exclusiveMaximum: {
240
+ keyword: 'exclusiveMaximum';
241
+ args: number;
242
+ };
243
+ exclusiveMinimum: {
244
+ keyword: 'exclusiveMinimum';
245
+ args: number;
246
+ };
247
+ describe: {
248
+ keyword: 'describe';
249
+ args: string;
250
+ };
251
+ example: {
252
+ keyword: 'example';
253
+ args: string;
254
+ };
255
+ deprecated: {
256
+ keyword: 'deprecated';
257
+ };
258
+ optional: {
259
+ keyword: 'optional';
260
+ };
261
+ undefined: {
262
+ keyword: 'undefined';
263
+ };
264
+ nullish: {
265
+ keyword: 'nullish';
266
+ };
267
+ nullable: {
268
+ keyword: 'nullable';
269
+ };
270
+ null: {
271
+ keyword: 'null';
272
+ };
273
+ any: {
274
+ keyword: 'any';
275
+ };
276
+ unknown: {
277
+ keyword: 'unknown';
278
+ };
279
+ void: {
280
+ keyword: 'void';
281
+ };
282
+ blob: {
283
+ keyword: 'blob';
284
+ };
285
+ schema: {
286
+ keyword: 'schema';
287
+ args: {
288
+ type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
289
+ format?: string;
290
+ };
291
+ };
292
+ name: {
293
+ keyword: 'name';
294
+ args: string;
295
+ };
296
+ catchall: {
297
+ keyword: 'catchall';
298
+ };
299
+ interface: {
300
+ keyword: 'interface';
301
+ };
302
+ };
303
+ type Schema = {
304
+ keyword: string;
305
+ } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
306
+ //#endregion
307
+ //#region ../plugin-oas/src/types.d.ts
308
+ type GetOasOptions = {
309
+ validate?: boolean;
310
+ };
311
+ type Context$2 = {
312
+ getOas(options?: GetOasOptions): Promise<Oas>;
313
+ getBaseURL(): Promise<string | undefined>;
314
+ };
315
+ declare global {
316
+ namespace Kubb {
317
+ interface PluginContext extends Context$2 {}
318
+ }
319
+ }
320
+ type ResolvePathOptions = {
321
+ pluginKey?: Plugin['key'];
322
+ group?: {
323
+ tag?: string;
324
+ path?: string;
325
+ };
326
+ type?: ResolveNameParams['type'];
327
+ };
328
+ /**
329
+ * `propertyName` is the ref name + resolved with the nameResolver
330
+ * @example import { Pet } from './Pet'
331
+ *
332
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
333
+ *
334
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
335
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
336
+ */
337
+ type Ref = {
338
+ propertyName: string;
339
+ originalName: string;
340
+ path: KubbFile.Path;
341
+ pluginKey?: Plugin['key'];
342
+ };
343
+ type Refs = Record<string, Ref>;
344
+ type OperationSchema = {
345
+ /**
346
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
347
+ */
348
+ name: string;
349
+ schema: SchemaObject$1;
350
+ operation?: Operation$1;
351
+ /**
352
+ * OperationName in PascalCase, only being used in OperationGenerator
353
+ */
354
+ operationName: string;
355
+ description?: string;
356
+ statusCode?: number;
357
+ keys?: string[];
358
+ keysToOmit?: string[];
359
+ withData?: boolean;
360
+ };
361
+ type OperationSchemas = {
362
+ pathParams?: OperationSchema & {
363
+ keysToOmit?: never;
364
+ };
365
+ queryParams?: OperationSchema & {
366
+ keysToOmit?: never;
367
+ };
368
+ headerParams?: OperationSchema & {
369
+ keysToOmit?: never;
370
+ };
371
+ request?: OperationSchema;
372
+ response: OperationSchema;
373
+ responses: Array<OperationSchema>;
374
+ statusCodes?: Array<OperationSchema>;
375
+ errors?: Array<OperationSchema>;
376
+ };
377
+ type ByTag = {
378
+ type: 'tag';
379
+ pattern: string | RegExp;
380
+ };
381
+ type ByOperationId = {
382
+ type: 'operationId';
383
+ pattern: string | RegExp;
384
+ };
385
+ type ByPath = {
386
+ type: 'path';
387
+ pattern: string | RegExp;
388
+ };
389
+ type ByMethod = {
390
+ type: 'method';
391
+ pattern: HttpMethod | RegExp;
392
+ };
393
+ type BySchemaName = {
394
+ type: 'schemaName';
395
+ pattern: string | RegExp;
396
+ };
397
+ type ByContentType = {
398
+ type: 'contentType';
399
+ pattern: string | RegExp;
400
+ };
401
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
402
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
403
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
404
+ options: Partial<TOptions>;
405
+ };
406
+ //#endregion
407
+ //#region ../plugin-oas/src/SchemaGenerator.d.ts
408
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
409
+ fabric: Fabric;
410
+ oas: Oas;
411
+ pluginManager: PluginManager;
412
+ events?: AsyncEventEmitter<KubbEvents>;
413
+ /**
414
+ * Current plugin
415
+ */
416
+ plugin: Plugin<TPluginOptions>;
417
+ mode: KubbFile.Mode;
418
+ include?: Array<'schemas' | 'responses' | 'requestBodies'>;
419
+ override: Array<Override<TOptions>> | undefined;
420
+ contentType?: contentType;
421
+ output?: string;
422
+ };
423
+ type SchemaGeneratorOptions = {
424
+ dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
425
+ unknownType: 'any' | 'unknown' | 'void';
426
+ emptySchemaType: 'any' | 'unknown' | 'void';
427
+ enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
428
+ enumSuffix?: string;
429
+ /**
430
+ * @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
431
+ * When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
432
+ * @internal
433
+ */
434
+ usedEnumNames?: Record<string, number>;
435
+ mapper?: Record<string, string>;
436
+ typed?: boolean;
437
+ transformers: {
438
+ /**
439
+ * Customize the names based on the type that is provided by the plugin.
440
+ */
441
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
442
+ /**
443
+ * Receive schema and name(propertyName) and return FakerMeta array
444
+ * TODO TODO add docs
445
+ * @beta
446
+ */
447
+ schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
448
+ };
449
+ };
450
+ type SchemaProps$1 = {
451
+ schema: SchemaObject$1 | null;
452
+ name: string | null;
453
+ parentName: string | null;
454
+ rootName?: string | null;
455
+ };
456
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
457
+ #private;
458
+ refs: Refs;
459
+ /**
460
+ * Creates a type node from a given schema.
461
+ * Delegates to getBaseTypeFromSchema internally and
462
+ * optionally adds a union with null.
463
+ */
464
+ parse(props: SchemaProps$1): Schema[];
465
+ static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
466
+ static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
467
+ static combineObjects(tree: Schema[] | undefined): Schema[];
468
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
469
+ }
470
+ //#endregion
471
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
472
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
473
+ name: string;
474
+ type: 'core';
475
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
476
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
477
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
478
+ };
479
+ //#endregion
480
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
481
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
482
+ name: string;
483
+ type: 'react';
484
+ Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
485
+ Operation: (props: OperationProps<TOptions>) => FabricReactNode;
486
+ Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
487
+ };
488
+ //#endregion
489
+ //#region ../plugin-oas/src/generators/types.d.ts
490
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
491
+ config: Config;
492
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
493
+ plugin: Plugin<TOptions>;
494
+ operations: Array<Operation$1>;
495
+ };
496
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
497
+ config: Config;
498
+ generator: Omit<OperationGenerator<TOptions>, 'build'>;
499
+ plugin: Plugin<TOptions>;
500
+ operation: Operation$1;
501
+ };
502
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
503
+ config: Config;
504
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
505
+ plugin: Plugin<TOptions>;
506
+ schema: {
507
+ name: string;
508
+ tree: Array<Schema>;
509
+ value: SchemaObject$1;
510
+ };
511
+ };
512
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
513
+ //#endregion
514
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
515
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
516
+ fabric: Fabric;
517
+ oas: Oas;
518
+ exclude: Array<Exclude$1> | undefined;
519
+ include: Array<Include> | undefined;
520
+ override: Array<Override<TOptions>> | undefined;
521
+ contentType: contentType | undefined;
522
+ pluginManager: PluginManager;
523
+ events?: AsyncEventEmitter<KubbEvents>;
524
+ /**
525
+ * Current plugin
526
+ */
527
+ plugin: Plugin<TPluginOptions>;
528
+ mode: KubbFile.Mode;
529
+ UNSTABLE_NAMING?: true;
530
+ };
531
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
532
+ #private;
533
+ getOptions(operation: Operation$1, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
534
+ getSchemas(operation: Operation$1, {
535
+ resolveName
536
+ }?: {
537
+ resolveName?: (name: string) => string;
538
+ }): OperationSchemas;
539
+ getOperations(): Promise<Array<{
540
+ path: string;
541
+ method: HttpMethod;
542
+ operation: Operation$1;
543
+ }>>;
544
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
545
+ }
546
+ //#endregion
547
+ //#region src/types.d.ts
548
+ type Options = {
549
+ /**
550
+ * @default 'zod'
551
+ */
552
+ output?: Output<Oas>;
553
+ /**
554
+ * Define which contentType should be used.
555
+ * By default, the first JSON valid mediaType is used
556
+ */
557
+ contentType?: contentType;
558
+ /**
559
+ * Group the Zod schemas based on the provided name.
560
+ */
561
+ group?: Group;
562
+ /**
563
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
564
+ */
565
+ exclude?: Array<Exclude$1>;
566
+ /**
567
+ * Array containing include parameters to include tags/operations/methods/paths.
568
+ */
569
+ include?: Array<Include>;
570
+ /**
571
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
572
+ */
573
+ override?: Array<Override<ResolvedOptions>>;
574
+ /**
575
+ * Path to Zod
576
+ * It used as `import { z } from '${importPath}'`.
577
+ * Accepts relative and absolute paths.
578
+ * Path is used as-is; relative paths are based on the generated file location.
579
+ * @default 'zod'
580
+ */
581
+ importPath?: string;
582
+ /**
583
+ * Choose to use date or datetime as JavaScript Date instead of string.
584
+ * - false falls back to a simple z.string() format.
585
+ * - 'string' uses z.string().datetime() for datetime validation.
586
+ * - 'stringOffset' uses z.string().datetime({ offset: true }) for datetime with timezone offset validation.
587
+ * - 'stringLocal' uses z.string().datetime({ local: true }) for local datetime validation.
588
+ * - 'date' uses z.date() for JavaScript Date objects.
589
+ * @default 'string'
590
+ * @note 'stringOffset' will become the default in Kubb v3.
591
+ */
592
+ dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
593
+ /**
594
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
595
+ * - 'any' allows any value.
596
+ * - 'unknown' requires type narrowing before use.
597
+ * - 'void' represents no value.
598
+ * @default 'any'
599
+ */
600
+ unknownType?: 'any' | 'unknown' | 'void';
601
+ /**
602
+ * Which type to use for empty schema values.
603
+ * - 'any' allows any value.
604
+ * - 'unknown' requires type narrowing before use.
605
+ * - 'void' represents no value.
606
+ * @default `unknownType`
607
+ */
608
+ emptySchemaType?: 'any' | 'unknown' | 'void';
609
+ /**
610
+ * Use TypeScript(`@kubb/plugin-ts`) to add type annotation.
611
+ */
612
+ typed?: boolean;
613
+ /**
614
+ * Return Zod generated schema as type with z.infer<TYPE>
615
+ */
616
+ inferred?: boolean;
617
+ /**
618
+ * Use of z.coerce.string() instead of z.string()
619
+ * can also be an object to enable coercion for dates, strings, and numbers
620
+ */
621
+ coercion?: boolean | {
622
+ dates?: boolean;
623
+ strings?: boolean;
624
+ numbers?: boolean;
625
+ };
626
+ operations?: boolean;
627
+ mapper?: Record<string, string>;
628
+ transformers?: {
629
+ /**
630
+ * Customize the names based on the type that is provided by the plugin.
631
+ */
632
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
633
+ /**
634
+ * Receive schema and baseName(propertyName) and return FakerMeta array
635
+ * TODO TODO add docs
636
+ * @beta
637
+ */
638
+ schema?: (props: {
639
+ schema: SchemaObject$1 | null;
640
+ name: string | null;
641
+ parentName: string | null;
642
+ }, defaultSchemas: Schema[]) => Schema[] | undefined;
643
+ };
644
+ /**
645
+ * Which version of Zod should be used.
646
+ * - '3' uses Zod v3.x syntax and features.
647
+ * - '4' uses Zod v4.x syntax and features.
648
+ * @default '3'
649
+ */
650
+ version?: '3' | '4';
651
+ /**
652
+ * Use Zod Mini's functional API for better tree-shaking support.
653
+ * When enabled, generates functional syntax (e.g., `z.optional(z.string())`) instead of chainable methods (e.g., `z.string().optional()`).
654
+ * Requires Zod v4 or later. When `mini: true`, `version` is set to '4' and `importPath` will default to 'zod/mini'.
655
+ * @default false
656
+ */
657
+ mini?: boolean;
658
+ /**
659
+ * Callback function to wrap the output of the generated zod schema
660
+ *
661
+ * This is useful for edge case scenarios where you might leverage something like `z.object({ ... }).openapi({ example: { some: "complex-example" }})`
662
+ * or `extendApi(z.object({ ... }), { example: { some: "complex-example", ...otherOpenApiProperties }})`
663
+ * while going from openapi -> zod -> openapi
664
+ */
665
+ wrapOutput?: (arg: {
666
+ output: string;
667
+ schema: SchemaObject$1;
668
+ }) => string | undefined;
669
+ /**
670
+ * Define some generators next to the zod generators
671
+ */
672
+ generators?: Array<Generator<PluginZod>>;
673
+ };
674
+ type ResolvedOptions = {
675
+ output: Output<Oas>;
676
+ group: Options['group'];
677
+ override: NonNullable<Options['override']>;
678
+ transformers: NonNullable<Options['transformers']>;
679
+ dateType: NonNullable<Options['dateType']>;
680
+ unknownType: NonNullable<Options['unknownType']>;
681
+ emptySchemaType: NonNullable<Options['emptySchemaType']>;
682
+ typed: NonNullable<Options['typed']>;
683
+ inferred: NonNullable<Options['inferred']>;
684
+ mapper: NonNullable<Options['mapper']>;
685
+ importPath: NonNullable<Options['importPath']>;
686
+ coercion: NonNullable<Options['coercion']>;
687
+ operations: NonNullable<Options['operations']>;
688
+ wrapOutput: Options['wrapOutput'];
689
+ version: NonNullable<Options['version']>;
690
+ mini: NonNullable<Options['mini']>;
691
+ };
692
+ type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
693
+ //#endregion
694
+ export { Operation$1 as a, Schema as i, PluginZod as n, SchemaObject$1 as o, ReactGenerator as r, Options as t };
695
+ //# sourceMappingURL=types-CyZ4p-xC.d.ts.map