@hey-api/openapi-ts 0.53.1 → 0.53.3

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,776 @@
1
+ import { rmSync } from 'node:fs';
2
+ import ts from 'typescript';
3
+
4
+ interface Dictionary<T = unknown> {
5
+ [key: string]: T;
6
+ }
7
+
8
+ /**
9
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object
10
+ */
11
+ interface OpenApiReference$1 {
12
+ $ref?: string;
13
+ }
14
+
15
+ /**
16
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object
17
+ */
18
+ interface OpenApiExample extends OpenApiReference$1 {
19
+ description?: string;
20
+ externalValue?: string;
21
+ summary?: string;
22
+ value?: unknown;
23
+ }
24
+
25
+ interface WithEnumExtension {
26
+ 'x-enum-descriptions'?: ReadonlyArray<string>;
27
+ 'x-enum-varnames'?: ReadonlyArray<string>;
28
+ 'x-enumNames'?: ReadonlyArray<string>;
29
+ }
30
+
31
+ /**
32
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#discriminator-object
33
+ */
34
+ interface OpenApiDiscriminator {
35
+ mapping?: Dictionary<string>;
36
+ propertyName: string;
37
+ }
38
+
39
+ /**
40
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#external-documentation-object
41
+ */
42
+ interface OpenApiExternalDocs$1 {
43
+ description?: string;
44
+ url: string;
45
+ }
46
+
47
+ /**
48
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#xml-object
49
+ */
50
+ interface OpenApiXml$1 {
51
+ attribute?: boolean;
52
+ name?: string;
53
+ namespace?: string;
54
+ prefix?: string;
55
+ wrapped?: boolean;
56
+ }
57
+
58
+ /**
59
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
60
+ */
61
+ interface OpenApiSchema$1 extends OpenApiReference$1, WithEnumExtension {
62
+ additionalProperties?: boolean | OpenApiSchema$1;
63
+ allOf?: OpenApiSchema$1[];
64
+ anyOf?: OpenApiSchema$1[];
65
+ const?: string | number | boolean | null;
66
+ default?: unknown;
67
+ deprecated?: boolean;
68
+ description?: string;
69
+ discriminator?: OpenApiDiscriminator;
70
+ enum?: (string | number)[];
71
+ example?: unknown;
72
+ exclusiveMaximum?: boolean;
73
+ exclusiveMinimum?: boolean;
74
+ externalDocs?: OpenApiExternalDocs$1;
75
+ format?: 'binary' | 'boolean' | 'byte' | 'date-time' | 'date' | 'double' | 'float' | 'int32' | 'int64' | 'password' | 'string';
76
+ items?: OpenApiSchema$1;
77
+ maxItems?: number;
78
+ maxLength?: number;
79
+ maxProperties?: number;
80
+ maximum?: number;
81
+ minItems?: number;
82
+ minLength?: number;
83
+ minProperties?: number;
84
+ minimum?: number;
85
+ multipleOf?: number;
86
+ not?: OpenApiSchema$1[];
87
+ nullable?: boolean;
88
+ oneOf?: OpenApiSchema$1[];
89
+ pattern?: string;
90
+ prefixItems?: OpenApiSchema$1[];
91
+ properties?: Dictionary<OpenApiSchema$1>;
92
+ readOnly?: boolean;
93
+ required?: string[];
94
+ title?: string;
95
+ type?: string | string[];
96
+ uniqueItems?: boolean;
97
+ writeOnly?: boolean;
98
+ xml?: OpenApiXml$1;
99
+ }
100
+
101
+ /**
102
+ * add only one type for now as that's needed to resolve the reported issue,
103
+ * more types should be added though
104
+ * {@link https://github.com/hey-api/openapi-ts/issues/612}
105
+ */
106
+ type MediaType = 'application/json';
107
+ /**
108
+ * encoding interface should be added, not adding it for now as it's not needed
109
+ * to resolve the issue reported
110
+ * {@link https://github.com/hey-api/openapi-ts/issues/612}
111
+ */
112
+ interface MediaTypeObject {
113
+ example?: unknown;
114
+ examples?: Dictionary<OpenApiExample>;
115
+ schema: OpenApiSchema$1;
116
+ }
117
+ /**
118
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object
119
+ */
120
+ interface OpenApiParameter extends OpenApiReference$1 {
121
+ allowEmptyValue?: boolean;
122
+ allowReserved?: boolean;
123
+ content?: Record<MediaType, MediaTypeObject>;
124
+ deprecated?: boolean;
125
+ description?: string;
126
+ example?: unknown;
127
+ examples?: Dictionary<OpenApiExample>;
128
+ explode?: boolean;
129
+ in: 'cookie' | 'formData' | 'header' | 'path' | 'query';
130
+ name: string;
131
+ nullable?: boolean;
132
+ required?: boolean;
133
+ schema?: OpenApiSchema$1;
134
+ style?: string;
135
+ }
136
+
137
+ interface Enum {
138
+ customDescription?: string;
139
+ customName?: string;
140
+ description?: string;
141
+ value: string | number;
142
+ }
143
+ interface OperationParameter extends Model {
144
+ in: 'body' | 'cookie' | 'formData' | 'header' | 'path' | 'query';
145
+ mediaType: string | null;
146
+ prop: string;
147
+ }
148
+ interface OperationParameters extends Pick<Model, '$refs' | 'imports'> {
149
+ parameters: OperationParameter[];
150
+ parametersBody: OperationParameter | null;
151
+ parametersCookie: OperationParameter[];
152
+ parametersForm: OperationParameter[];
153
+ parametersHeader: OperationParameter[];
154
+ parametersPath: OperationParameter[];
155
+ parametersQuery: OperationParameter[];
156
+ }
157
+ interface OperationResponse extends Model {
158
+ code: number | 'default' | '1XX' | '2XX' | '3XX' | '4XX' | '5XX';
159
+ in: 'header' | 'response';
160
+ responseTypes: Array<'error' | 'success'>;
161
+ }
162
+ type Method = 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE';
163
+ interface Operation$1 extends OperationParameters {
164
+ deprecated: boolean;
165
+ description: string | null;
166
+ /**
167
+ * The operationId from OpenAPI specification.
168
+ */
169
+ id: string | null;
170
+ method: Method;
171
+ name: string;
172
+ path: string;
173
+ responseHeader: string | null;
174
+ /**
175
+ * All operation responses defined in OpenAPI specification.
176
+ * Sorted by status code.
177
+ */
178
+ responses: OperationResponse[];
179
+ summary: string | null;
180
+ tags: string[] | null;
181
+ }
182
+ interface Schema {
183
+ default?: unknown;
184
+ exclusiveMaximum?: boolean;
185
+ exclusiveMinimum?: boolean;
186
+ format?: 'binary' | 'boolean' | 'byte' | 'date-time' | 'date' | 'double' | 'float' | 'int32' | 'int64' | 'password' | 'string';
187
+ isDefinition: boolean;
188
+ isNullable: boolean;
189
+ isReadOnly: boolean;
190
+ isRequired: boolean;
191
+ maxItems?: number;
192
+ maxLength?: number;
193
+ maxProperties?: number;
194
+ maximum?: number;
195
+ minItems?: number;
196
+ minLength?: number;
197
+ minProperties?: number;
198
+ minimum?: number;
199
+ multipleOf?: number;
200
+ pattern?: string;
201
+ uniqueItems?: boolean;
202
+ }
203
+ interface ModelMeta {
204
+ /**
205
+ * Ref to the type in OpenAPI specification.
206
+ */
207
+ $ref: string;
208
+ /**
209
+ * Name passed to the initial `getModel()` call.
210
+ */
211
+ name: string;
212
+ }
213
+ interface Model extends Schema {
214
+ /**
215
+ * **Experimental.** Contains list of original refs so they can be used
216
+ * to access the schema from anywhere instead of relying on string name.
217
+ * This allows us to do things like detect type of ref.
218
+ */
219
+ $refs: string[];
220
+ base: string;
221
+ deprecated?: boolean;
222
+ description: string | null;
223
+ enum: Enum[];
224
+ enums: Model[];
225
+ export: 'all-of' | 'any-of' | 'array' | 'const' | 'dictionary' | 'enum' | 'generic' | 'interface' | 'one-of' | 'reference';
226
+ imports: string[];
227
+ in: OperationParameter['in'] | OpenApiParameter['in'] | OperationResponse['in'] | '';
228
+ link: Model | Model[] | null;
229
+ meta?: ModelMeta;
230
+ /**
231
+ * @deprecated use `meta.name` instead
232
+ */
233
+ name: string;
234
+ properties: Model[];
235
+ template: string | null;
236
+ type: string;
237
+ }
238
+ interface Client$2 {
239
+ models: Model[];
240
+ operations: Operation$1[];
241
+ server: string;
242
+ /**
243
+ * Map of generated types where type names are keys. This is used to track
244
+ * uniquely generated types as we may want to deduplicate if there are
245
+ * multiple definitions with the same name but different value, or if we
246
+ * want to transform names.
247
+ */
248
+ types: Record<string, ModelMeta>;
249
+ version: string;
250
+ }
251
+
252
+ /**
253
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#external-documentation-object
254
+ */
255
+ interface OpenApiExternalDocs {
256
+ description?: string;
257
+ url: string;
258
+ }
259
+
260
+ interface WithNullableExtension {
261
+ 'x-nullable'?: boolean;
262
+ }
263
+
264
+ /**
265
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#reference-object
266
+ */
267
+ interface OpenApiReference {
268
+ $ref?: string;
269
+ }
270
+
271
+ /**
272
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#xml-object
273
+ */
274
+ interface OpenApiXml {
275
+ attribute?: boolean;
276
+ name?: string;
277
+ namespace?: string;
278
+ prefix?: string;
279
+ wrapped?: boolean;
280
+ }
281
+
282
+ /**
283
+ * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#schema-object
284
+ */
285
+ interface OpenApiSchema extends OpenApiReference, WithEnumExtension, WithNullableExtension {
286
+ additionalProperties?: boolean | OpenApiSchema;
287
+ allOf?: OpenApiSchema[];
288
+ default?: unknown;
289
+ description?: string;
290
+ discriminator?: string;
291
+ enum?: (string | number)[];
292
+ example?: unknown;
293
+ exclusiveMaximum?: boolean;
294
+ exclusiveMinimum?: boolean;
295
+ externalDocs?: OpenApiExternalDocs;
296
+ format?: 'int32' | 'int64' | 'float' | 'double' | 'string' | 'boolean' | 'byte' | 'binary' | 'date' | 'date-time' | 'password';
297
+ items?: OpenApiSchema;
298
+ maxItems?: number;
299
+ maxLength?: number;
300
+ maxProperties?: number;
301
+ maximum?: number;
302
+ minItems?: number;
303
+ minLength?: number;
304
+ minProperties?: number;
305
+ minimum?: number;
306
+ multipleOf?: number;
307
+ pattern?: string;
308
+ properties?: Dictionary<OpenApiSchema>;
309
+ readOnly?: boolean;
310
+ required?: string[];
311
+ title?: string;
312
+ type?: string;
313
+ uniqueItems?: boolean;
314
+ xml?: OpenApiXml;
315
+ }
316
+
317
+ interface Operation extends Omit<Operation$1, 'tags'> {
318
+ service: string;
319
+ }
320
+ interface Service extends Pick<Model, '$refs' | 'imports' | 'name'> {
321
+ operations: Operation[];
322
+ }
323
+ interface Client$1 extends Omit<Client$2, 'operations'> {
324
+ services: Service[];
325
+ }
326
+
327
+ interface ImportExportItemObject {
328
+ alias?: string;
329
+ asType?: boolean;
330
+ name: string;
331
+ }
332
+
333
+ declare class TypeScriptFile {
334
+ private _headers;
335
+ private _imports;
336
+ private _items;
337
+ private _name;
338
+ private _path;
339
+ constructor({ dir, name, header, }: {
340
+ dir: string;
341
+ header?: boolean;
342
+ name: string;
343
+ });
344
+ add(...nodes: Array<ts.Node | string>): void;
345
+ /**
346
+ * Adds an import to the provided module. Handles duplication, returns added import.
347
+ */
348
+ import({ module, ...importedItem }: ImportExportItemObject & {
349
+ module: string;
350
+ }): ImportExportItemObject;
351
+ getName(withExtension?: boolean): string;
352
+ isEmpty(): boolean;
353
+ remove(options?: Parameters<typeof rmSync>[1]): void;
354
+ /**
355
+ * Removes last node form the stack. Works as undo.
356
+ */
357
+ removeNode(): void;
358
+ private _setName;
359
+ toString(separator?: string): string;
360
+ write(separator?: string): void;
361
+ }
362
+
363
+ type ExtractFromArray<T, Discriminator> = T extends Discriminator ? Required<T> : never;
364
+ /**
365
+ * Accepts an array of elements union and attempts to extract only objects.
366
+ * For example, Array<string | number | { id: string }> would result in
367
+ * Array<{ id: string }>.
368
+ */
369
+ type ExtractArrayOfObjects<T, Discriminator> = T extends Array<infer U> ? Array<ExtractFromArray<U, Discriminator>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<ExtractFromArray<U, Discriminator>> : never;
370
+ type Files = Record<string, TypeScriptFile>;
371
+
372
+ interface PluginDefinition {
373
+ handler: (args: {
374
+ client: Client$1;
375
+ files: Files;
376
+ outputParts: string[];
377
+ plugin: Config['plugins'][number];
378
+ }) => void;
379
+ name: string;
380
+ output?: string;
381
+ }
382
+
383
+ interface PluginConfig$6 extends PluginDefinition {
384
+ /**
385
+ * Generate Hey API schemas from the provided input.
386
+ */
387
+ name: '@hey-api/schemas';
388
+ /**
389
+ * Name of the generated file.
390
+ * @default 'schemas'
391
+ */
392
+ output?: string;
393
+ }
394
+
395
+ interface PluginConfig$5 extends PluginDefinition {
396
+ /**
397
+ * Generate Hey API services from the provided input.
398
+ */
399
+ name: '@hey-api/services';
400
+ /**
401
+ * Name of the generated file.
402
+ * @default 'services'
403
+ */
404
+ output?: string;
405
+ }
406
+
407
+ interface PluginConfig$4 extends PluginDefinition {
408
+ /**
409
+ * Generate Hey API types from the provided input.
410
+ */
411
+ name: '@hey-api/types';
412
+ /**
413
+ * Name of the generated file.
414
+ * @default 'types'
415
+ */
416
+ output?: string;
417
+ }
418
+
419
+ interface PluginConfig$3 extends PluginDefinition {
420
+ /**
421
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
422
+ * @default true
423
+ */
424
+ infiniteQueryOptions?: boolean;
425
+ /**
426
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/useMutation `useMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests.
427
+ * @default true
428
+ */
429
+ mutationOptions?: boolean;
430
+ /**
431
+ * Generate TanStack React Query output from the provided input.
432
+ */
433
+ name: '@tanstack/react-query';
434
+ /**
435
+ * Name of the generated file.
436
+ * @default '@tanstack/react-query'
437
+ */
438
+ output?: string;
439
+ /**
440
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/react/reference/queryOptions `queryOptions()`} helpers?
441
+ * These will be generated from all requests.
442
+ * @default true
443
+ */
444
+ queryOptions?: boolean;
445
+ }
446
+
447
+ interface PluginConfig$2 extends PluginDefinition {
448
+ /**
449
+ * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
450
+ * @default true
451
+ */
452
+ infiniteQueryOptions?: boolean;
453
+ /**
454
+ * Generate `createMutation()` helpers? These will be generated from DELETE, PATCH, POST, and PUT requests.
455
+ * @default true
456
+ */
457
+ mutationOptions?: boolean;
458
+ /**
459
+ * Generate TanStack Solid Query output from the provided input.
460
+ */
461
+ name: '@tanstack/solid-query';
462
+ /**
463
+ * Name of the generated file.
464
+ * @default '@tanstack/solid-query'
465
+ */
466
+ output?: string;
467
+ /**
468
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/solid/reference/createQuery `createQuery()`} helpers?
469
+ * These will be generated from all requests.
470
+ * @default true
471
+ */
472
+ queryOptions?: boolean;
473
+ }
474
+
475
+ interface PluginConfig$1 extends PluginDefinition {
476
+ /**
477
+ * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
478
+ * @default true
479
+ */
480
+ infiniteQueryOptions?: boolean;
481
+ /**
482
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/svelte/reference/functions/createmutation `createMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests.
483
+ * @default true
484
+ */
485
+ mutationOptions?: boolean;
486
+ /**
487
+ * Generate TanStack Svelte Query output from the provided input.
488
+ */
489
+ name: '@tanstack/svelte-query';
490
+ /**
491
+ * Name of the generated file.
492
+ * @default '@tanstack/svelte-query'
493
+ */
494
+ output?: string;
495
+ /**
496
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/svelte/reference/functions/createquery `createQuery()`} helpers?
497
+ * These will be generated from all requests.
498
+ * @default true
499
+ */
500
+ queryOptions?: boolean;
501
+ }
502
+
503
+ interface PluginConfig extends PluginDefinition {
504
+ /**
505
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/infiniteQueryOptions `infiniteQueryOptions()`} helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
506
+ * @default true
507
+ */
508
+ infiniteQueryOptions?: boolean;
509
+ /**
510
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/reference/useMutation `useMutation()`} helpers? These will be generated from DELETE, PATCH, POST, and PUT requests.
511
+ * @default true
512
+ */
513
+ mutationOptions?: boolean;
514
+ /**
515
+ * Generate TanStack Vue Query output from the provided input.
516
+ */
517
+ name: '@tanstack/vue-query';
518
+ /**
519
+ * Name of the generated file.
520
+ * @default '@tanstack/vue-query'
521
+ */
522
+ output?: string;
523
+ /**
524
+ * Generate {@link https://tanstack.com/query/v5/docs/framework/vue/guides/query-options `queryOptions()`} helpers?
525
+ * These will be generated from all requests.
526
+ * @default true
527
+ */
528
+ queryOptions?: boolean;
529
+ }
530
+
531
+ type Plugins = PluginConfig$6 | PluginConfig$5 | PluginConfig$4 | PluginConfig$3 | PluginConfig$2 | PluginConfig$1 | PluginConfig;
532
+
533
+ declare const CLIENTS: readonly ["@hey-api/client-axios", "@hey-api/client-fetch", "legacy/angular", "legacy/axios", "legacy/fetch", "legacy/node", "legacy/xhr"];
534
+ type Client = (typeof CLIENTS)[number];
535
+ interface ClientConfig {
536
+ /**
537
+ * Manually set base in OpenAPI config instead of inferring from server value
538
+ * @deprecated
539
+ */
540
+ base?: string;
541
+ /**
542
+ * HTTP client to generate
543
+ */
544
+ client?: Client | false | {
545
+ /**
546
+ * Bundle the client module? Set this to true if you're using a standalone
547
+ * client package and don't want to declare it as a separate dependency.
548
+ * When true, the client module will be generated from the standalone
549
+ * package and bundled with the rest of the generated output. This is
550
+ * useful if you're repackaging the output, publishing it to other users,
551
+ * and you don't want them to install any dependencies.
552
+ * @default false
553
+ */
554
+ bundle?: boolean;
555
+ /**
556
+ * HTTP client to generate
557
+ */
558
+ name: Client;
559
+ };
560
+ /**
561
+ * Path to the config file. Set this value if you don't use the default
562
+ * config file name, or it's not located in the project root.
563
+ */
564
+ configFile?: string;
565
+ /**
566
+ * Run in debug mode?
567
+ * @default false
568
+ */
569
+ debug?: boolean;
570
+ /**
571
+ * Skip writing files to disk?
572
+ * @default false
573
+ */
574
+ dryRun?: boolean;
575
+ /**
576
+ * Use the experimental parser?
577
+ * @default false
578
+ */
579
+ experimental_parser?: boolean;
580
+ /**
581
+ * Generate core client classes?
582
+ * @default true
583
+ */
584
+ exportCore?: boolean;
585
+ /**
586
+ * The relative location of the OpenAPI spec
587
+ */
588
+ input: string | Record<string, unknown>;
589
+ /**
590
+ * Custom client class name
591
+ * @deprecated
592
+ */
593
+ name?: string;
594
+ /**
595
+ * The relative location of the output directory
596
+ */
597
+ output: string | {
598
+ /**
599
+ * Process output folder with formatter?
600
+ * @default false
601
+ */
602
+ format?: 'biome' | 'prettier' | false;
603
+ /**
604
+ * Process output folder with linter?
605
+ * @default false
606
+ */
607
+ lint?: 'biome' | 'eslint' | false;
608
+ /**
609
+ * The relative location of the output directory
610
+ */
611
+ path: string;
612
+ };
613
+ /**
614
+ * Plugins are used to generate additional output files from provided input.
615
+ */
616
+ plugins?: ReadonlyArray<Plugins['name'] | Plugins>;
617
+ /**
618
+ * Path to custom request file
619
+ * @deprecated
620
+ */
621
+ request?: string;
622
+ /**
623
+ * Generate JSON schemas?
624
+ * @default true
625
+ */
626
+ schemas?: boolean | {
627
+ /**
628
+ * Generate JSON schemas?
629
+ * @default true
630
+ */
631
+ export?: boolean;
632
+ /**
633
+ * Customise the schema name. By default, `{{name}}Schema` is used. `name` is a
634
+ * valid JavaScript/TypeScript identifier, e.g. if your schema name is
635
+ * "Foo-Bar", `name` value would be "FooBar".
636
+ */
637
+ name?: (name: string, schema: OpenApiSchema | OpenApiSchema$1) => string;
638
+ /**
639
+ * Choose schema type to generate. Select 'form' if you don't want
640
+ * descriptions to reduce bundle size and you plan to use schemas
641
+ * for form validation
642
+ * @default 'json'
643
+ */
644
+ type?: 'form' | 'json';
645
+ };
646
+ /**
647
+ * Generate services?
648
+ * @default true
649
+ */
650
+ services?: boolean | string | {
651
+ /**
652
+ * Group operation methods into service classes? When enabled, you can
653
+ * select which classes to export with `services.include` and/or
654
+ * transform their names with `services.name`.
655
+ *
656
+ * Note that by enabling this option, your services will **NOT**
657
+ * support {@link https://developer.mozilla.org/docs/Glossary/Tree_shaking tree-shaking}.
658
+ * For this reason, it is disabled by default.
659
+ * @default false
660
+ */
661
+ asClass?: boolean;
662
+ /**
663
+ * Generate services?
664
+ * @default true
665
+ */
666
+ export?: boolean;
667
+ /**
668
+ * Filter endpoints to be included in the generated services.
669
+ * The provided string should be a regular expression where matched
670
+ * results will be included in the output. The input pattern this
671
+ * string will be tested against is `{method} {path}`. For example,
672
+ * you can match `POST /api/v1/foo` with `^POST /api/v1/foo$`.
673
+ */
674
+ filter?: string;
675
+ /**
676
+ * Include only service classes with names matching regular expression
677
+ *
678
+ * This option has no effect if `services.asClass` is `false`.
679
+ */
680
+ include?: string;
681
+ /**
682
+ * Customise the name of methods within the service. By default, {@link Operation.name} is used.
683
+ */
684
+ methodNameBuilder?: (operation: Operation) => string;
685
+ /**
686
+ * Customize the generated service class names. The name variable is
687
+ * obtained from your OpenAPI specification tags.
688
+ *
689
+ * This option has no effect if `services.asClass` is `false`.
690
+ * @default '{{name}}Service'
691
+ */
692
+ name?: string;
693
+ /**
694
+ * Use operation ID to generate operation names?
695
+ * @default true
696
+ */
697
+ operationId?: boolean;
698
+ /**
699
+ * Define shape of returned value from service calls
700
+ * @default 'body'
701
+ * @deprecated
702
+ */
703
+ response?: 'body' | 'response';
704
+ };
705
+ /**
706
+ * Generate types?
707
+ * @default true
708
+ */
709
+ types?: boolean | string | {
710
+ /**
711
+ * Output Date type and possibly runtime transform instead of string for format "date-time"
712
+ * @default false
713
+ */
714
+ dates?: boolean | 'types+transform' | 'types';
715
+ /**
716
+ * Generate enum definitions?
717
+ * @default false
718
+ */
719
+ enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false;
720
+ /**
721
+ * Generate types?
722
+ * @default true
723
+ */
724
+ export?: boolean;
725
+ /**
726
+ * Include only types matching regular expression
727
+ */
728
+ include?: string;
729
+ /**
730
+ * Use your preferred naming pattern
731
+ * @default 'preserve'
732
+ */
733
+ name?: 'PascalCase' | 'preserve';
734
+ /**
735
+ * Generate a tree of types containing all operations? It will be named
736
+ * $OpenApiTs and is generated by default only when not using services.
737
+ */
738
+ tree?: boolean;
739
+ };
740
+ /**
741
+ * Use options or arguments functions
742
+ * @deprecated
743
+ * @default true
744
+ */
745
+ useOptions?: boolean;
746
+ }
747
+ interface UserConfig extends ClientConfig {
748
+ }
749
+ type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'name' | 'output' | 'plugins' | 'request' | 'schemas' | 'services' | 'types'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
750
+ client: Extract<Required<ClientConfig>['client'], object>;
751
+ output: Extract<Required<ClientConfig>['output'], object>;
752
+ plugins: ExtractArrayOfObjects<Required<ClientConfig>['plugins'], {
753
+ name: string;
754
+ }>;
755
+ schemas: Extract<Required<ClientConfig>['schemas'], object>;
756
+ services: Extract<Required<ClientConfig>['services'], object>;
757
+ types: Extract<Required<ClientConfig>['types'], object>;
758
+ };
759
+
760
+ /**
761
+ * Generate the OpenAPI client. This method will read the OpenAPI specification and based on the
762
+ * given language it will generate the client, including the typed models, validation schemas,
763
+ * service layer, etc.
764
+ * @param userConfig {@link UserConfig} passed to the `createClient()` method
765
+ */
766
+ declare function createClient(userConfig: UserConfig): Promise<ReadonlyArray<Client$1>>;
767
+ /**
768
+ * Type helper for openapi-ts.config.ts, returns {@link UserConfig} object
769
+ */
770
+ declare const defineConfig: (config: UserConfig) => UserConfig;
771
+ declare const _default: {
772
+ createClient: typeof createClient;
773
+ defineConfig: (config: UserConfig) => UserConfig;
774
+ };
775
+
776
+ export { type UserConfig, createClient, _default as default, defineConfig };