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