@hey-api/openapi-ts 0.53.7 → 0.53.9

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.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,3 @@
1
- import { rmSync } from 'node:fs';
2
- import ts from 'typescript';
3
-
4
1
  interface Dictionary<T = unknown> {
5
2
  [key: string]: T;
6
3
  }
@@ -324,99 +321,7 @@ interface Client$1 extends Omit<Client$2, 'operations'> {
324
321
  services: Service[];
325
322
  }
326
323
 
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 {
324
+ interface Config$3 {
420
325
  /**
421
326
  * 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
327
  * @default true
@@ -443,10 +348,10 @@ interface PluginConfig$3 extends PluginDefinition {
443
348
  */
444
349
  queryOptions?: boolean;
445
350
  }
446
- interface UserConfig$4 extends Pick<PluginConfig$3, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
351
+ interface UserConfig$4 extends Omit<Config$3, 'output'> {
447
352
  }
448
353
 
449
- interface PluginConfig$2 extends PluginDefinition {
354
+ interface Config$2 {
450
355
  /**
451
356
  * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
452
357
  * @default true
@@ -473,10 +378,10 @@ interface PluginConfig$2 extends PluginDefinition {
473
378
  */
474
379
  queryOptions?: boolean;
475
380
  }
476
- interface UserConfig$3 extends Pick<PluginConfig$2, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
381
+ interface UserConfig$3 extends Omit<Config$2, 'output'> {
477
382
  }
478
383
 
479
- interface PluginConfig$1 extends PluginDefinition {
384
+ interface Config$1 {
480
385
  /**
481
386
  * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
482
387
  * @default true
@@ -503,10 +408,10 @@ interface PluginConfig$1 extends PluginDefinition {
503
408
  */
504
409
  queryOptions?: boolean;
505
410
  }
506
- interface UserConfig$2 extends Pick<PluginConfig$1, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
411
+ interface UserConfig$2 extends Omit<Config$1, 'output'> {
507
412
  }
508
413
 
509
- interface PluginConfig extends PluginDefinition {
414
+ interface Config {
510
415
  /**
511
416
  * 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.
512
417
  * @default true
@@ -533,14 +438,13 @@ interface PluginConfig extends PluginDefinition {
533
438
  */
534
439
  queryOptions?: boolean;
535
440
  }
536
- interface UserConfig$1 extends Pick<PluginConfig, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
441
+ interface UserConfig$1 extends Omit<Config, 'output'> {
537
442
  }
538
443
 
539
444
  /**
540
445
  * User-facing plugin types.
541
446
  */
542
447
  type UserPlugins = UserConfig$4 | UserConfig$3 | UserConfig$2 | UserConfig$1;
543
- type ClientPlugins = PluginConfig$6 | PluginConfig$5 | PluginConfig$4 | PluginConfig$3 | PluginConfig$2 | PluginConfig$1 | PluginConfig;
544
448
 
545
449
  declare const CLIENTS: readonly ["@hey-api/client-axios", "@hey-api/client-fetch", "legacy/angular", "legacy/axios", "legacy/fetch", "legacy/node", "legacy/xhr"];
546
450
  type Client = (typeof CLIENTS)[number];
@@ -758,16 +662,6 @@ interface ClientConfig {
758
662
  }
759
663
  interface UserConfig extends ClientConfig {
760
664
  }
761
- type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'name' | 'output' | 'plugins' | 'request' | 'schemas' | 'services' | 'types'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
762
- client: Extract<Required<ClientConfig>['client'], object>;
763
- output: Extract<Required<ClientConfig>['output'], object>;
764
- plugins: ExtractArrayOfObjects<ReadonlyArray<ClientPlugins>, {
765
- name: string;
766
- }>;
767
- schemas: Extract<Required<ClientConfig>['schemas'], object>;
768
- services: Extract<Required<ClientConfig>['services'], object>;
769
- types: Extract<Required<ClientConfig>['types'], object>;
770
- };
771
665
 
772
666
  interface OpenApiV3_0_3 {
773
667
  /**
package/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import { rmSync } from 'node:fs';
2
- import ts from 'typescript';
3
-
4
1
  interface Dictionary<T = unknown> {
5
2
  [key: string]: T;
6
3
  }
@@ -324,99 +321,7 @@ interface Client$1 extends Omit<Client$2, 'operations'> {
324
321
  services: Service[];
325
322
  }
326
323
 
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 {
324
+ interface Config$3 {
420
325
  /**
421
326
  * 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
327
  * @default true
@@ -443,10 +348,10 @@ interface PluginConfig$3 extends PluginDefinition {
443
348
  */
444
349
  queryOptions?: boolean;
445
350
  }
446
- interface UserConfig$4 extends Pick<PluginConfig$3, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
351
+ interface UserConfig$4 extends Omit<Config$3, 'output'> {
447
352
  }
448
353
 
449
- interface PluginConfig$2 extends PluginDefinition {
354
+ interface Config$2 {
450
355
  /**
451
356
  * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
452
357
  * @default true
@@ -473,10 +378,10 @@ interface PluginConfig$2 extends PluginDefinition {
473
378
  */
474
379
  queryOptions?: boolean;
475
380
  }
476
- interface UserConfig$3 extends Pick<PluginConfig$2, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
381
+ interface UserConfig$3 extends Omit<Config$2, 'output'> {
477
382
  }
478
383
 
479
- interface PluginConfig$1 extends PluginDefinition {
384
+ interface Config$1 {
480
385
  /**
481
386
  * Generate `createInfiniteQuery()` helpers? These will be generated from GET and POST requests where a pagination parameter is detected.
482
387
  * @default true
@@ -503,10 +408,10 @@ interface PluginConfig$1 extends PluginDefinition {
503
408
  */
504
409
  queryOptions?: boolean;
505
410
  }
506
- interface UserConfig$2 extends Pick<PluginConfig$1, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
411
+ interface UserConfig$2 extends Omit<Config$1, 'output'> {
507
412
  }
508
413
 
509
- interface PluginConfig extends PluginDefinition {
414
+ interface Config {
510
415
  /**
511
416
  * 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.
512
417
  * @default true
@@ -533,14 +438,13 @@ interface PluginConfig extends PluginDefinition {
533
438
  */
534
439
  queryOptions?: boolean;
535
440
  }
536
- interface UserConfig$1 extends Pick<PluginConfig, 'infiniteQueryOptions' | 'mutationOptions' | 'name' | 'queryOptions'> {
441
+ interface UserConfig$1 extends Omit<Config, 'output'> {
537
442
  }
538
443
 
539
444
  /**
540
445
  * User-facing plugin types.
541
446
  */
542
447
  type UserPlugins = UserConfig$4 | UserConfig$3 | UserConfig$2 | UserConfig$1;
543
- type ClientPlugins = PluginConfig$6 | PluginConfig$5 | PluginConfig$4 | PluginConfig$3 | PluginConfig$2 | PluginConfig$1 | PluginConfig;
544
448
 
545
449
  declare const CLIENTS: readonly ["@hey-api/client-axios", "@hey-api/client-fetch", "legacy/angular", "legacy/axios", "legacy/fetch", "legacy/node", "legacy/xhr"];
546
450
  type Client = (typeof CLIENTS)[number];
@@ -758,16 +662,6 @@ interface ClientConfig {
758
662
  }
759
663
  interface UserConfig extends ClientConfig {
760
664
  }
761
- type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'name' | 'output' | 'plugins' | 'request' | 'schemas' | 'services' | 'types'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
762
- client: Extract<Required<ClientConfig>['client'], object>;
763
- output: Extract<Required<ClientConfig>['output'], object>;
764
- plugins: ExtractArrayOfObjects<ReadonlyArray<ClientPlugins>, {
765
- name: string;
766
- }>;
767
- schemas: Extract<Required<ClientConfig>['schemas'], object>;
768
- services: Extract<Required<ClientConfig>['services'], object>;
769
- types: Extract<Required<ClientConfig>['types'], object>;
770
- };
771
665
 
772
666
  interface OpenApiV3_0_3 {
773
667
  /**