@hey-api/openapi-ts 0.82.5 → 0.83.1

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.
@@ -1,5 +1,5 @@
1
1
  import { SemVer, RangeOptions } from 'semver';
2
- import { CodegenProject } from '@hey-api/codegen-core';
2
+ import { CodegenProject, ICodegenSymbolSelector, ICodegenFile, ICodegenSymbolOut } from '@hey-api/codegen-core';
3
3
  import fs from 'node:fs';
4
4
  import typescript__default from 'typescript';
5
5
 
@@ -2496,15 +2496,6 @@ type JsonSchemaTypes$1 =
2496
2496
  | 'object'
2497
2497
  | 'string';
2498
2498
 
2499
- type StringCase =
2500
- | 'camelCase'
2501
- | 'PascalCase'
2502
- | 'preserve'
2503
- | 'snake_case'
2504
- | 'SCREAMING_SNAKE_CASE';
2505
-
2506
- type StringName = string | ((name: string) => string);
2507
-
2508
2499
  type Package = {
2509
2500
  /**
2510
2501
  * Get the installed version of a package.
@@ -2548,98 +2539,11 @@ type CommentObject = {
2548
2539
  };
2549
2540
  type Comments = CommentLines | Array<CommentObject>;
2550
2541
 
2551
- interface Identifier {
2552
- /**
2553
- * Did this function add a new property to the file's `identifiers` map?
2554
- */
2555
- created: boolean;
2556
- /**
2557
- * The resolved identifier name. False means the identifier has been blacklisted.
2558
- */
2559
- name: string | false;
2560
- }
2561
-
2562
- type NamespaceEntry = Pick<Identifier, 'name'> & {
2563
- /**
2564
- * Ref to the type in OpenAPI specification.
2565
- */
2566
- $ref: string;
2567
- };
2568
-
2569
- type Identifiers = Record<
2570
- string,
2571
- {
2572
- /**
2573
- * TypeScript enum only namespace.
2574
- *
2575
- * @example
2576
- * ```ts
2577
- * export enum Foo = {
2578
- * FOO = 'foo'
2579
- * }
2580
- * ```
2581
- */
2582
- enum?: Record<string, NamespaceEntry>;
2583
- /**
2584
- * Type namespace. Types, interfaces, and type aliases exist here.
2585
- *
2586
- * @example
2587
- * ```ts
2588
- * export type Foo = string;
2589
- * ```
2590
- */
2591
- type?: Record<string, NamespaceEntry>;
2592
- /**
2593
- * Value namespace. Variables, functions, classes, and constants exist here.
2594
- *
2595
- * @example
2596
- * ```js
2597
- * export const foo = '';
2598
- * ```
2599
- */
2600
- value?: Record<string, NamespaceEntry>;
2601
- }
2602
- >;
2603
-
2604
- type Namespace = keyof Identifiers[keyof Identifiers];
2605
-
2606
- type FileImportResult<
2607
- Name extends string | undefined = string | undefined,
2608
- Alias extends string | undefined = undefined,
2609
- > = {
2610
- asType?: boolean;
2611
- name: Alias extends string ? Alias : Name;
2612
- };
2613
-
2614
- type NodeInfo = {
2615
- /**
2616
- * Is this node exported from the file?
2617
- *
2618
- * @default false
2619
- */
2620
- exported?: boolean;
2621
- /**
2622
- * Reference to the node object.
2623
- */
2624
- node: typescript__default.TypeReferenceNode;
2625
- };
2626
-
2627
- type NodeReference<T = void> = {
2628
- /**
2629
- * Factory function that creates the node reference.
2630
- *
2631
- * @param name Identifier name.
2632
- * @returns Reference to the node object.
2633
- */
2634
- factory: (name: string) => T;
2635
- /**
2636
- * Reference to the node object.
2637
- */
2638
- node: T;
2542
+ type FileImportResult<Name extends string | undefined = string | undefined, Alias extends string | undefined = undefined> = {
2543
+ asType?: boolean;
2544
+ name: Alias extends string ? Alias : Name;
2639
2545
  };
2640
-
2641
2546
  declare class GeneratedFile {
2642
- private _case;
2643
2547
  /**
2644
2548
  * Should the exports from this file be re-exported in the index barrel file?
2645
2549
  */
@@ -2650,49 +2554,7 @@ declare class GeneratedFile {
2650
2554
  private _items;
2651
2555
  private _name;
2652
2556
  private _path;
2653
- /** @deprecated use `names` and `nodes` */
2654
- identifiers: Identifiers;
2655
- /**
2656
- * Map of node IDs. This can be used to obtain actual node names. Keys are
2657
- * node IDs which can be any string, values are names. Values are kept in
2658
- * sync with `nodes`.
2659
- *
2660
- * @example
2661
- * ```json
2662
- * {
2663
- * "#/my-id": "final_name",
2664
- * "anyId": "name"
2665
- * }
2666
- * ```
2667
- */
2668
- private names;
2669
- /**
2670
- * Another approach for named nodes, with proper support for renaming. Keys
2671
- * are node IDs and values are an array of references for given ID.
2672
- */
2673
- private nodeReferences;
2674
- /**
2675
- * Text value from node is kept in sync with `names`.
2676
- *
2677
- * @deprecated
2678
- * @example
2679
- * ```js
2680
- * {
2681
- * "#/my-id": {
2682
- * "node": TypeReferenceNode
2683
- * },
2684
- * "anyId": {
2685
- * "node": TypeReferenceNode
2686
- * }
2687
- * }
2688
- * ```
2689
- */
2690
- private nodes;
2691
- /**
2692
- * Path relative to the client output root.
2693
- */
2694
- constructor({ case: _case, dir, exportFromIndex, header, id, name, }: {
2695
- case?: StringCase;
2557
+ constructor({ dir, exportFromIndex, header, id, name, }: {
2696
2558
  dir: string;
2697
2559
  /**
2698
2560
  * Should the exports from this file be re-exported in the index barrel file?
@@ -2708,33 +2570,8 @@ declare class GeneratedFile {
2708
2570
  name: string;
2709
2571
  });
2710
2572
  add(...nodes: Array<typescript__default.Node | string>): void;
2711
- /**
2712
- * Adds a reference node for a name. This can be used later to rename
2713
- * identifiers.
2714
- */
2715
- addNodeReference<T>(id: string, node: Pick<NodeReference<T>, 'factory'>): T;
2716
2573
  get exportFromIndex(): boolean;
2717
- /**
2718
- * Returns an actual node name. If node doesn't exist throws an error.
2719
- *
2720
- * @param id Node ID.
2721
- * @returns Actual node name.
2722
- */
2723
- getName(id: string): string | undefined;
2724
- /**
2725
- * Returns a node. If node doesn't exist, creates a blank reference.
2726
- *
2727
- * @deprecated
2728
- * @param id Node ID.
2729
- * @returns Information about the node.
2730
- */
2731
- getNode(id: string): NodeInfo;
2732
2574
  get id(): string;
2733
- /** @deprecated use `names` and `nodes` */
2734
- identifier(args: Pick<EnsureUniqueIdentifierData, '$ref' | 'count' | 'create' | 'nameTransformer'> & {
2735
- case?: StringCase;
2736
- namespace: Namespace;
2737
- }): Identifier;
2738
2575
  /**
2739
2576
  * Adds an import to the provided module. Handles duplication, returns added
2740
2577
  * import. Returns the imported name. If we import an aliased export, `name`
@@ -2758,39 +2595,8 @@ declare class GeneratedFile {
2758
2595
  removeNode_LEGACY(): void;
2759
2596
  private _setName;
2760
2597
  private _toString;
2761
- /**
2762
- * Inserts or updates a node.
2763
- *
2764
- * @deprecated
2765
- * @param id Node ID.
2766
- * @param args Information about the node.
2767
- * @returns Updated node.
2768
- */
2769
- updateNode(id: string, args: Pick<NodeInfo, 'exported'> & {
2770
- name: string;
2771
- }): NodeInfo;
2772
- /**
2773
- * Updates collected reference nodes for a name with the latest value.
2774
- *
2775
- * @param id Node ID.
2776
- * @param name Updated name for the nodes.
2777
- * @returns noop
2778
- */
2779
- updateNodeReferences(id: string, name: string): void;
2780
2598
  write(separator?: string, tsConfig?: typescript__default.ParsedCommandLine | null): void;
2781
2599
  }
2782
- interface EnsureUniqueIdentifierData {
2783
- $ref: string;
2784
- case: StringCase | undefined;
2785
- count?: number;
2786
- create?: boolean;
2787
- identifiers: Identifiers;
2788
- /**
2789
- * Transforms name obtained from `$ref` before it's passed to `stringCase()`.
2790
- */
2791
- nameTransformer?: ((name: string) => string) | string;
2792
- namespace: Namespace;
2793
- }
2794
2600
 
2795
2601
  type ObjectType<T> = Extract<T, Record<string, any>> extends never ? Record<string, any> : Extract<T, Record<string, any>>;
2796
2602
  type NotArray<T> = T extends any[] ? never : T;
@@ -2954,6 +2760,15 @@ type Logs = {
2954
2760
  path?: string;
2955
2761
  };
2956
2762
 
2763
+ type StringCase =
2764
+ | 'camelCase'
2765
+ | 'PascalCase'
2766
+ | 'preserve'
2767
+ | 'snake_case'
2768
+ | 'SCREAMING_SNAKE_CASE';
2769
+
2770
+ type StringName = string | ((name: string) => string);
2771
+
2957
2772
  type Formatters = 'biome' | 'prettier';
2958
2773
 
2959
2774
  type Linters = 'biome' | 'eslint' | 'oxlint';
@@ -6833,7 +6648,7 @@ interface UserConfig$o {
6833
6648
  watch?: boolean | number | Watch;
6834
6649
  }
6835
6650
 
6836
- type Config$b = Omit<
6651
+ type Config$c = Omit<
6837
6652
  Required<UserConfig$o>,
6838
6653
  | 'base'
6839
6654
  | 'input'
@@ -7115,7 +6930,7 @@ interface Client$2 {
7115
6930
  * Configuration for parsing and generating the output. This
7116
6931
  * is a mix of user-provided and default values.
7117
6932
  */
7118
- config: Config$b;
6933
+ config: Config$c;
7119
6934
  models: Model[];
7120
6935
  operations: Operation$1[];
7121
6936
  server: string;
@@ -7787,6 +7602,15 @@ declare class PluginInstance<T extends Plugin.Types = Plugin.Types> {
7787
7602
  * @returns The plugin instance if found, undefined otherwise.
7788
7603
  */
7789
7604
  getPlugin<T extends keyof PluginConfigMap>(name: T): T extends any ? PluginInstance<PluginConfigMap[T]> | undefined : never;
7605
+ /**
7606
+ * Retrieves a registered plugin instance by its name from the context. This
7607
+ * allows plugins to access other plugins that have been registered in the
7608
+ * same context, enabling cross-plugin communication and dependencies.
7609
+ *
7610
+ * @param name Plugin name as defined in the configuration.
7611
+ * @returns The plugin instance if found, throw otherwise.
7612
+ */
7613
+ getPluginOrThrow<T extends keyof PluginConfigMap>(name: T): T extends any ? PluginInstance<PluginConfigMap[T]> : never;
7790
7614
  hooks: {
7791
7615
  operation: {
7792
7616
  isMutation: (operation: IR$1.OperationObject) => boolean;
@@ -7967,6 +7791,22 @@ type DefinePlugin<
7967
7791
  Types: Plugin.Types<Config, ResolvedConfig, Api>;
7968
7792
  };
7969
7793
 
7794
+ type SelectorType$i = 'class' | 'httpRequest' | 'httpResource' | 'HttpRequest' | 'inject' | 'Injectable';
7795
+ type IApi$i = {
7796
+ /**
7797
+ * @param type Selector type.
7798
+ * @param value Depends on `type`:
7799
+ * - `class`: raw string entry from path
7800
+ * - `httpRequest`: `operation.id` string
7801
+ * - `httpResource`: never
7802
+ * - `HttpRequest`: never
7803
+ * - `inject`: never
7804
+ * - `Injectable`: never
7805
+ * @returns Selector array
7806
+ */
7807
+ getSelector: (type: SelectorType$i, value?: string) => ICodegenSymbolSelector;
7808
+ };
7809
+
7970
7810
  type UserConfig$n = Plugin.Name<'@angular/common'> & {
7971
7811
  /**
7972
7812
  * Should the exports from the generated files be re-exported in the index
@@ -8046,7 +7886,7 @@ type UserConfig$n = Plugin.Name<'@angular/common'> & {
8046
7886
  output?: string;
8047
7887
  };
8048
7888
 
8049
- type Config$a = Plugin.Name<'@angular/common'> & {
7889
+ type Config$b = Plugin.Name<'@angular/common'> & {
8050
7890
  /**
8051
7891
  * Should the exports from the generated files be re-exported in the index
8052
7892
  * barrel file?
@@ -8116,7 +7956,29 @@ type Config$a = Plugin.Name<'@angular/common'> & {
8116
7956
  output: string;
8117
7957
  };
8118
7958
 
8119
- type AngularCommonPlugin = DefinePlugin<UserConfig$n, Config$a>;
7959
+ type AngularCommonPlugin = DefinePlugin<UserConfig$n, Config$b, IApi$i>;
7960
+
7961
+ type SelectorType$h = 'client';
7962
+ type IApi$h = {
7963
+ /**
7964
+ * @param type Selector type.
7965
+ * @param value Depends on `type`:
7966
+ * - `client`: never
7967
+ * @returns Selector array
7968
+ */
7969
+ getSelector: (type: SelectorType$h, value?: string) => ICodegenSymbolSelector;
7970
+ };
7971
+
7972
+ type SelectorType$g = 'client';
7973
+ type IApi$g = {
7974
+ /**
7975
+ * @param type Selector type.
7976
+ * @param value Depends on `type`:
7977
+ * - `client`: never
7978
+ * @returns Selector array
7979
+ */
7980
+ getSelector: (type: SelectorType$g, value?: string) => ICodegenSymbolSelector;
7981
+ };
8120
7982
 
8121
7983
  type UserConfig$m = Plugin.Name<'@hey-api/client-axios'> &
8122
7984
  Client.Config & {
@@ -8128,7 +7990,22 @@ type UserConfig$m = Plugin.Name<'@hey-api/client-axios'> &
8128
7990
  throwOnError?: boolean;
8129
7991
  };
8130
7992
 
8131
- type HeyApiClientAxiosPlugin = DefinePlugin<UserConfig$m>;
7993
+ type HeyApiClientAxiosPlugin = DefinePlugin<
7994
+ UserConfig$m,
7995
+ UserConfig$m,
7996
+ IApi$g
7997
+ >;
7998
+
7999
+ type SelectorType$f = 'client';
8000
+ type IApi$f = {
8001
+ /**
8002
+ * @param type Selector type.
8003
+ * @param value Depends on `type`:
8004
+ * - `client`: never
8005
+ * @returns Selector array
8006
+ */
8007
+ getSelector: (type: SelectorType$f, value?: string) => ICodegenSymbolSelector;
8008
+ };
8132
8009
 
8133
8010
  type UserConfig$l = Plugin.Name<'@hey-api/client-fetch'> &
8134
8011
  Client.Config & {
@@ -8140,7 +8017,22 @@ type UserConfig$l = Plugin.Name<'@hey-api/client-fetch'> &
8140
8017
  throwOnError?: boolean;
8141
8018
  };
8142
8019
 
8143
- type HeyApiClientFetchPlugin = DefinePlugin<UserConfig$l>;
8020
+ type HeyApiClientFetchPlugin = DefinePlugin<
8021
+ UserConfig$l,
8022
+ UserConfig$l,
8023
+ IApi$f
8024
+ >;
8025
+
8026
+ type SelectorType$e = 'client';
8027
+ type IApi$e = {
8028
+ /**
8029
+ * @param type Selector type.
8030
+ * @param value Depends on `type`:
8031
+ * - `client`: never
8032
+ * @returns Selector array
8033
+ */
8034
+ getSelector: (type: SelectorType$e, value?: string) => ICodegenSymbolSelector;
8035
+ };
8144
8036
 
8145
8037
  type UserConfig$k = Plugin.Name<'@hey-api/client-next'> &
8146
8038
  Client.Config & {
@@ -8152,18 +8044,30 @@ type UserConfig$k = Plugin.Name<'@hey-api/client-next'> &
8152
8044
  throwOnError?: boolean;
8153
8045
  };
8154
8046
 
8155
- type HeyApiClientNextPlugin = DefinePlugin<UserConfig$k>;
8047
+ type HeyApiClientNextPlugin = DefinePlugin<UserConfig$k, UserConfig$k, IApi$e>;
8048
+
8049
+ type SelectorType$d = 'client';
8050
+ type IApi$d = {
8051
+ /**
8052
+ * @param type Selector type.
8053
+ * @param value Depends on `type`:
8054
+ * - `client`: never
8055
+ * @returns Selector array
8056
+ */
8057
+ getSelector: (type: SelectorType$d, value?: string) => ICodegenSymbolSelector;
8058
+ };
8156
8059
 
8157
8060
  type UserConfig$j = Plugin.Name<'@hey-api/client-nuxt'> & Client.Config;
8158
8061
 
8159
- type HeyApiClientNuxtPlugin = DefinePlugin<UserConfig$j>;
8062
+ type HeyApiClientNuxtPlugin = DefinePlugin<UserConfig$j, UserConfig$j, IApi$d>;
8160
8063
 
8161
- type PluginHandler =
8162
- | HeyApiClientAngularPlugin['Handler']
8163
- | HeyApiClientAxiosPlugin['Handler']
8164
- | HeyApiClientFetchPlugin['Handler']
8165
- | HeyApiClientNextPlugin['Handler']
8166
- | HeyApiClientNuxtPlugin['Handler'];
8064
+ interface PluginHandler {
8065
+ (...args: Parameters<HeyApiClientAngularPlugin['Handler']>): void;
8066
+ (...args: Parameters<HeyApiClientAxiosPlugin['Handler']>): void;
8067
+ (...args: Parameters<HeyApiClientFetchPlugin['Handler']>): void;
8068
+ (...args: Parameters<HeyApiClientNextPlugin['Handler']>): void;
8069
+ (...args: Parameters<HeyApiClientNuxtPlugin['Handler']>): void;
8070
+ }
8167
8071
 
8168
8072
  /**
8169
8073
  * Public Client API.
@@ -8239,7 +8143,11 @@ type UserConfig$i = Plugin.Name<'@hey-api/client-angular'> &
8239
8143
  throwOnError?: boolean;
8240
8144
  };
8241
8145
 
8242
- type HeyApiClientAngularPlugin = DefinePlugin<UserConfig$i>;
8146
+ type HeyApiClientAngularPlugin = DefinePlugin<
8147
+ UserConfig$i,
8148
+ UserConfig$i,
8149
+ IApi$h
8150
+ >;
8243
8151
 
8244
8152
  type UserConfig$h = Plugin.Name<'legacy/angular'> &
8245
8153
  Pick<Client.Config, 'output'>;
@@ -8266,6 +8174,17 @@ type UserConfig$d = Plugin.Name<'legacy/xhr'> &
8266
8174
 
8267
8175
  type HeyApiClientLegacyXhrPlugin = DefinePlugin<UserConfig$d>;
8268
8176
 
8177
+ type SelectorType$c = 'ref';
8178
+ type IApi$c = {
8179
+ /**
8180
+ * @param type Selector type.
8181
+ * @param value Depends on `type`:
8182
+ * - `ref`: `$ref` JSON pointer
8183
+ * @returns Selector array
8184
+ */
8185
+ getSelector: (type: SelectorType$c, value?: string) => ICodegenSymbolSelector;
8186
+ };
8187
+
8269
8188
  type UserConfig$c = Plugin.Name<'@hey-api/schemas'> & {
8270
8189
  /**
8271
8190
  * Should the exports from the generated files be re-exported in the index
@@ -8309,7 +8228,24 @@ type UserConfig$c = Plugin.Name<'@hey-api/schemas'> & {
8309
8228
  type?: 'form' | 'json';
8310
8229
  };
8311
8230
 
8312
- type HeyApiSchemasPlugin = DefinePlugin<UserConfig$c>;
8231
+ type HeyApiSchemasPlugin = DefinePlugin<UserConfig$c, UserConfig$c, IApi$c>;
8232
+
8233
+ type SelectorType$b = 'buildClientParams' | 'class' | 'Client' | 'formDataBodySerializer' | 'function' | 'Options' | 'urlSearchParamsBodySerializer';
8234
+ type IApi$b = {
8235
+ /**
8236
+ * @param type Selector type.
8237
+ * @param value Depends on `type`:
8238
+ * - `buildClientParams`: never
8239
+ * - `class`: current class name
8240
+ * - `Client`: never
8241
+ * - `formDataBodySerializer`: never
8242
+ * - `function`: `operation.id` string
8243
+ * - `Options`: never
8244
+ * - `urlSearchParamsBodySerializer`: never
8245
+ * @returns Selector array
8246
+ */
8247
+ getSelector: (type: SelectorType$b, value?: string) => ICodegenSymbolSelector;
8248
+ };
8313
8249
 
8314
8250
  type UserConfig$b = Plugin.Name<'@hey-api/sdk'> & {
8315
8251
  /**
@@ -8486,7 +8422,7 @@ type UserConfig$b = Plugin.Name<'@hey-api/sdk'> & {
8486
8422
  response?: 'body' | 'response';
8487
8423
  };
8488
8424
 
8489
- type Config$9 = Plugin.Name<'@hey-api/sdk'> & {
8425
+ type Config$a = Plugin.Name<'@hey-api/sdk'> & {
8490
8426
  /**
8491
8427
  * Group operation methods into classes? When enabled, you can select which
8492
8428
  * classes to export with `sdk.include` and/or transform their names with
@@ -8640,12 +8576,24 @@ type Config$9 = Plugin.Name<'@hey-api/sdk'> & {
8640
8576
  response: 'body' | 'response';
8641
8577
  };
8642
8578
 
8643
- type HeyApiSdkPlugin = DefinePlugin<UserConfig$b, Config$9>;
8579
+ type HeyApiSdkPlugin = DefinePlugin<UserConfig$b, Config$a, IApi$b>;
8580
+
8581
+ type SelectorType$a = 'response' | 'response-ref';
8582
+ type IApi$a = {
8583
+ /**
8584
+ * @param type Selector type.
8585
+ * @param value Depends on `type`:
8586
+ * - `response`: `operation.id` string
8587
+ * - `response-ref`: `$ref` JSON pointer
8588
+ * @returns Selector array
8589
+ */
8590
+ getSelector: (type: SelectorType$a, value?: string) => ICodegenSymbolSelector;
8591
+ };
8644
8592
 
8645
8593
  type ExpressionTransformer = ({ config, dataExpression, file, schema, }: {
8646
8594
  config: Omit<UserConfig$a, 'name'>;
8647
8595
  dataExpression?: typescript__default.Expression | string;
8648
- file: GeneratedFile;
8596
+ file: ICodegenFile;
8649
8597
  schema: IR$1.SchemaObject;
8650
8598
  }) => Array<typescript__default.Expression> | undefined;
8651
8599
 
@@ -8657,7 +8605,7 @@ type TypeTransformer = ({
8657
8605
  file,
8658
8606
  schema,
8659
8607
  }: {
8660
- file: GeneratedFile;
8608
+ file: ICodegenFile;
8661
8609
  schema: IR$1.SchemaObject;
8662
8610
  }) => typescript__default.TypeNode | undefined;
8663
8611
 
@@ -8691,14 +8639,49 @@ type UserConfig$a = Plugin.Name<'@hey-api/transformers'> & {
8691
8639
  * Custom transforms to apply to the generated code.
8692
8640
  */
8693
8641
  transformers?: ReadonlyArray<ExpressionTransformer>;
8694
-
8695
8642
  /**
8696
8643
  * Custom type transformers that modify the TypeScript types generated.
8697
8644
  */
8698
8645
  typeTransformers?: ReadonlyArray<TypeTransformer>;
8699
8646
  };
8700
8647
 
8701
- type HeyApiTransformersPlugin = DefinePlugin<UserConfig$a>;
8648
+ type Config$9 = Plugin.Name<'@hey-api/transformers'> & {
8649
+ /**
8650
+ * Convert long integers into BigInt values?
8651
+ *
8652
+ * @default true
8653
+ */
8654
+ bigInt: boolean;
8655
+ /**
8656
+ * Convert date strings into Date objects?
8657
+ *
8658
+ * @default true
8659
+ */
8660
+ dates: boolean;
8661
+ /**
8662
+ * Should the exports from the generated files be re-exported in the index
8663
+ * barrel file?
8664
+ *
8665
+ * @default false
8666
+ */
8667
+ exportFromIndex: boolean;
8668
+ /**
8669
+ * Name of the generated file.
8670
+ *
8671
+ * @default 'transformers'
8672
+ */
8673
+ output: string;
8674
+ /**
8675
+ * Custom transforms to apply to the generated code.
8676
+ */
8677
+ transformers: ReadonlyArray<ExpressionTransformer>;
8678
+ /**
8679
+ * Custom type transformers that modify the TypeScript types generated.
8680
+ */
8681
+ typeTransformers: ReadonlyArray<TypeTransformer>;
8682
+ };
8683
+
8684
+ type HeyApiTransformersPlugin = DefinePlugin<UserConfig$a, Config$9, IApi$a>;
8702
8685
 
8703
8686
  type EnumsType = 'javascript' | 'typescript' | 'typescript-const';
8704
8687
 
@@ -8897,6 +8880,16 @@ type UserConfig$9 = Plugin.Name<'@hey-api/typescript'> & {
8897
8880
  */
8898
8881
  response?: StringName;
8899
8882
  };
8883
+ /**
8884
+ * The top type to use for untyped or unspecified schema values.
8885
+ *
8886
+ * Can be:
8887
+ * - `unknown` (default): safe top type, you must narrow before use
8888
+ * - `any`: disables type checking, can be used anywhere
8889
+ *
8890
+ * @default 'unknown'
8891
+ */
8892
+ topType?: 'any' | 'unknown';
8900
8893
  /**
8901
8894
  * Configuration for webhook-specific types.
8902
8895
  *
@@ -9127,6 +9120,12 @@ type Config$8 = Plugin.Name<'@hey-api/typescript'> & {
9127
9120
  */
9128
9121
  response: StringName;
9129
9122
  };
9123
+ /**
9124
+ * The top type to use for untyped or unspecified schema values.
9125
+ *
9126
+ * @default 'unknown'
9127
+ */
9128
+ topType: 'any' | 'unknown';
9130
9129
  /**
9131
9130
  * Configuration for webhook-specific types.
9132
9131
  *
@@ -9191,9 +9190,9 @@ interface PluginState {
9191
9190
  usedTypeIDs: Set<string>;
9192
9191
  }
9193
9192
 
9194
- type HeyApiTypeScriptPlugin = DefinePlugin<UserConfig$9, Config$8, Api$2>;
9193
+ type HeyApiTypeScriptPlugin = DefinePlugin<UserConfig$9, Config$8, IApi$9>;
9195
9194
 
9196
- type OnRef = (id: string) => void;
9195
+ type OnRef = (symbol: ICodegenSymbolOut) => void;
9197
9196
  declare const schemaToType: ({ onRef, plugin, schema, state, }: {
9198
9197
  /**
9199
9198
  * Callback that can be used to perform side-effects when we encounter a
@@ -9205,18 +9204,43 @@ declare const schemaToType: ({ onRef, plugin, schema, state, }: {
9205
9204
  state: PluginState;
9206
9205
  }) => typescript__default.TypeNode;
9207
9206
 
9208
- type GetIdArgs$1 = {
9209
- type: 'ClientOptions' | 'Webhooks';
9210
- } | {
9211
- operation: IR$1.OperationObject;
9212
- type: 'data' | 'error' | 'errors' | 'response' | 'responses' | 'webhook-payload' | 'webhook-request';
9213
- } | {
9214
- type: 'ref';
9215
- value: string;
9207
+ type SelectorType$9 = 'ClientOptions' | 'data' | 'error' | 'errors' | 'ref' | 'response' | 'responses' | 'webhook-payload' | 'webhook-request' | 'Webhooks';
9208
+ type SchemaToTypeArgs = Omit<Parameters<typeof schemaToType>[0], 'onRef'> & Pick<Partial<Parameters<typeof schemaToType>[0]>, 'onRef'>;
9209
+ type IApi$9 = {
9210
+ /**
9211
+ * @param type Selector type.
9212
+ * @param value Depends on `type`:
9213
+ * - `ClientOptions`: never
9214
+ * - `data`: `operation.id` string
9215
+ * - `error`: `operation.id` string
9216
+ * - `errors`: `operation.id` string
9217
+ * - `ref`: `$ref` JSON pointer
9218
+ * - `response`: `operation.id` string
9219
+ * - `responses`: `operation.id` string
9220
+ * - `webhook-payload`: `operation.id` string
9221
+ * - `webhook-request`: `operation.id` string
9222
+ * - `Webhooks`: never
9223
+ * @returns Selector array
9224
+ */
9225
+ getSelector: (type: SelectorType$9, value?: string) => ICodegenSymbolSelector;
9226
+ schemaToType: (args: SchemaToTypeArgs) => typescript__default.TypeNode;
9216
9227
  };
9217
- type Api$2 = {
9218
- getId: (args: GetIdArgs$1) => string;
9219
- schemaToType: (args: Omit<Parameters<typeof schemaToType>[0], 'onRef'> & Pick<Partial<Parameters<typeof schemaToType>[0]>, 'onRef'>) => typescript__default.TypeNode;
9228
+
9229
+ type SelectorType$8 = '_JSONValue' | 'AxiosError' | 'createQueryKey' | 'queryOptionsFn' | 'QueryKey' | 'UseMutationOptions' | 'UseQueryOptions';
9230
+ type IApi$8 = {
9231
+ /**
9232
+ * @param type Selector type.
9233
+ * @param value Depends on `type`:
9234
+ * - `_JSONValue`: never
9235
+ * - `AxiosError`: never
9236
+ * - `createQueryKey`: never
9237
+ * - `queryOptionsFn`: `operation.id` string
9238
+ * - `QueryKey`: never
9239
+ * - `UseMutationOptions`: never
9240
+ * - `UseQueryOptions`: never
9241
+ * @returns Selector array
9242
+ */
9243
+ getSelector: (type: SelectorType$8, value?: string) => ICodegenSymbolSelector;
9220
9244
  };
9221
9245
 
9222
9246
  type UserConfig$8 = Plugin.Name<'@pinia/colada'> &
@@ -9245,14 +9269,6 @@ type UserConfig$8 = Plugin.Name<'@pinia/colada'> &
9245
9269
  * @default false
9246
9270
  */
9247
9271
  exportFromIndex?: boolean;
9248
- /**
9249
- * Group generated files by OpenAPI tags. When enabled, operations will be organized
9250
- * into separate files based on their tags, allowing for better code organization
9251
- * and tree-shaking.
9252
- *
9253
- * @default false
9254
- */
9255
- groupByTag?: boolean;
9256
9272
  /**
9257
9273
  * Configuration for generated mutation options helpers.
9258
9274
  *
@@ -9442,14 +9458,6 @@ type Config$7 = Plugin.Name<'@pinia/colada'> &
9442
9458
  * @default false
9443
9459
  */
9444
9460
  exportFromIndex: boolean;
9445
- /**
9446
- * Group generated files by OpenAPI tags. When enabled, operations will be organized
9447
- * into separate files based on their tags, allowing for better code organization
9448
- * and tree-shaking.
9449
- *
9450
- * @default false
9451
- */
9452
- groupByTag: boolean;
9453
9461
  /**
9454
9462
  * Resolved configuration for generated mutation options helpers.
9455
9463
  */
@@ -9591,7 +9599,28 @@ type Config$7 = Plugin.Name<'@pinia/colada'> &
9591
9599
  };
9592
9600
  };
9593
9601
 
9594
- type PiniaColadaPlugin = DefinePlugin<UserConfig$8, Config$7>;
9602
+ type PiniaColadaPlugin = DefinePlugin<UserConfig$8, Config$7, IApi$8>;
9603
+
9604
+ type SelectorType$7 = 'AxiosError' | 'createInfiniteParams' | 'createQueryKey' | 'DefaultError' | 'infiniteQueryOptions' | 'InfiniteData' | 'MutationOptions' | 'queryOptions' | 'queryOptionsFn' | 'QueryKey' | 'useQuery';
9605
+ type IApi$7 = {
9606
+ /**
9607
+ * @param type Selector type.
9608
+ * @param value Depends on `type`:
9609
+ * - `AxiosError`: never
9610
+ * - `createInfiniteParams`: never
9611
+ * - `createQueryKey`: never
9612
+ * - `DefaultError`: never
9613
+ * - `infiniteQueryOptions`: never
9614
+ * - `InfiniteData`: never
9615
+ * - `MutationOptions`: never
9616
+ * - `queryOptions`: never
9617
+ * - `queryOptionsFn`: `operation.id` string
9618
+ * - `QueryKey`: never
9619
+ * - `useQuery`: never
9620
+ * @returns Selector array
9621
+ */
9622
+ getSelector: (type: SelectorType$7, value?: string) => ICodegenSymbolSelector;
9623
+ };
9595
9624
 
9596
9625
  type UserConfig$7 = Plugin.Name<'@tanstack/angular-query-experimental'> &
9597
9626
  Plugin.Hooks & {
@@ -10146,7 +10175,28 @@ type Config$6 = Plugin.Name<'@tanstack/angular-query-experimental'> &
10146
10175
  };
10147
10176
  };
10148
10177
 
10149
- type TanStackAngularQueryPlugin = DefinePlugin<UserConfig$7, Config$6>;
10178
+ type TanStackAngularQueryPlugin = DefinePlugin<UserConfig$7, Config$6, IApi$7>;
10179
+
10180
+ type SelectorType$6 = 'AxiosError' | 'createInfiniteParams' | 'createQueryKey' | 'DefaultError' | 'infiniteQueryOptions' | 'InfiniteData' | 'MutationOptions' | 'queryOptions' | 'queryOptionsFn' | 'QueryKey' | 'useQuery';
10181
+ type IApi$6 = {
10182
+ /**
10183
+ * @param type Selector type.
10184
+ * @param value Depends on `type`:
10185
+ * - `AxiosError`: never
10186
+ * - `createInfiniteParams`: never
10187
+ * - `createQueryKey`: never
10188
+ * - `DefaultError`: never
10189
+ * - `infiniteQueryOptions`: never
10190
+ * - `InfiniteData`: never
10191
+ * - `MutationOptions`: never
10192
+ * - `queryOptions`: never
10193
+ * - `queryOptionsFn`: `operation.id` string
10194
+ * - `QueryKey`: never
10195
+ * - `useQuery`: never
10196
+ * @returns Selector array
10197
+ */
10198
+ getSelector: (type: SelectorType$6, value?: string) => ICodegenSymbolSelector;
10199
+ };
10150
10200
 
10151
10201
  type UserConfig$6 = Plugin.Name<'@tanstack/react-query'> &
10152
10202
  Plugin.Hooks & {
@@ -10779,7 +10829,28 @@ type Config$5 = Plugin.Name<'@tanstack/react-query'> &
10779
10829
  };
10780
10830
  };
10781
10831
 
10782
- type TanStackReactQueryPlugin = DefinePlugin<UserConfig$6, Config$5>;
10832
+ type TanStackReactQueryPlugin = DefinePlugin<UserConfig$6, Config$5, IApi$6>;
10833
+
10834
+ type SelectorType$5 = 'AxiosError' | 'createInfiniteParams' | 'createQueryKey' | 'DefaultError' | 'infiniteQueryOptions' | 'InfiniteData' | 'MutationOptions' | 'queryOptions' | 'queryOptionsFn' | 'QueryKey' | 'useQuery';
10835
+ type IApi$5 = {
10836
+ /**
10837
+ * @param type Selector type.
10838
+ * @param value Depends on `type`:
10839
+ * - `AxiosError`: never
10840
+ * - `createInfiniteParams`: never
10841
+ * - `createQueryKey`: never
10842
+ * - `DefaultError`: never
10843
+ * - `infiniteQueryOptions`: never
10844
+ * - `InfiniteData`: never
10845
+ * - `MutationOptions`: never
10846
+ * - `queryOptions`: never
10847
+ * - `queryOptionsFn`: `operation.id` string
10848
+ * - `QueryKey`: never
10849
+ * - `useQuery`: never
10850
+ * @returns Selector array
10851
+ */
10852
+ getSelector: (type: SelectorType$5, value?: string) => ICodegenSymbolSelector;
10853
+ };
10783
10854
 
10784
10855
  type UserConfig$5 = Plugin.Name<'@tanstack/solid-query'> &
10785
10856
  Plugin.Hooks & {
@@ -11335,7 +11406,28 @@ type Config$4 = Plugin.Name<'@tanstack/solid-query'> &
11335
11406
  };
11336
11407
  };
11337
11408
 
11338
- type TanStackSolidQueryPlugin = DefinePlugin<UserConfig$5, Config$4>;
11409
+ type TanStackSolidQueryPlugin = DefinePlugin<UserConfig$5, Config$4, IApi$5>;
11410
+
11411
+ type SelectorType$4 = 'AxiosError' | 'createInfiniteParams' | 'createQueryKey' | 'DefaultError' | 'infiniteQueryOptions' | 'InfiniteData' | 'MutationOptions' | 'queryOptions' | 'queryOptionsFn' | 'QueryKey' | 'useQuery';
11412
+ type IApi$4 = {
11413
+ /**
11414
+ * @param type Selector type.
11415
+ * @param value Depends on `type`:
11416
+ * - `AxiosError`: never
11417
+ * - `createInfiniteParams`: never
11418
+ * - `createQueryKey`: never
11419
+ * - `DefaultError`: never
11420
+ * - `infiniteQueryOptions`: never
11421
+ * - `InfiniteData`: never
11422
+ * - `MutationOptions`: never
11423
+ * - `queryOptions`: never
11424
+ * - `queryOptionsFn`: `operation.id` string
11425
+ * - `QueryKey`: never
11426
+ * - `useQuery`: never
11427
+ * @returns Selector array
11428
+ */
11429
+ getSelector: (type: SelectorType$4, value?: string) => ICodegenSymbolSelector;
11430
+ };
11339
11431
 
11340
11432
  type UserConfig$4 = Plugin.Name<'@tanstack/svelte-query'> &
11341
11433
  Plugin.Hooks & {
@@ -11890,7 +11982,28 @@ type Config$3 = Plugin.Name<'@tanstack/svelte-query'> &
11890
11982
  };
11891
11983
  };
11892
11984
 
11893
- type TanStackSvelteQueryPlugin = DefinePlugin<UserConfig$4, Config$3>;
11985
+ type TanStackSvelteQueryPlugin = DefinePlugin<UserConfig$4, Config$3, IApi$4>;
11986
+
11987
+ type SelectorType$3 = 'AxiosError' | 'createInfiniteParams' | 'createQueryKey' | 'DefaultError' | 'infiniteQueryOptions' | 'InfiniteData' | 'MutationOptions' | 'queryOptions' | 'queryOptionsFn' | 'QueryKey' | 'useQuery';
11988
+ type IApi$3 = {
11989
+ /**
11990
+ * @param type Selector type.
11991
+ * @param value Depends on `type`:
11992
+ * - `AxiosError`: never
11993
+ * - `createInfiniteParams`: never
11994
+ * - `createQueryKey`: never
11995
+ * - `DefaultError`: never
11996
+ * - `infiniteQueryOptions`: never
11997
+ * - `InfiniteData`: never
11998
+ * - `MutationOptions`: never
11999
+ * - `queryOptions`: never
12000
+ * - `queryOptionsFn`: `operation.id` string
12001
+ * - `QueryKey`: never
12002
+ * - `useQuery`: never
12003
+ * @returns Selector array
12004
+ */
12005
+ getSelector: (type: SelectorType$3, value?: string) => ICodegenSymbolSelector;
12006
+ };
11894
12007
 
11895
12008
  type UserConfig$3 = Plugin.Name<'@tanstack/vue-query'> &
11896
12009
  Plugin.Hooks & {
@@ -12451,7 +12564,18 @@ type Config$2 = Plugin.Name<'@tanstack/vue-query'> &
12451
12564
  };
12452
12565
  };
12453
12566
 
12454
- type TanStackVueQueryPlugin = DefinePlugin<UserConfig$3, Config$2>;
12567
+ type TanStackVueQueryPlugin = DefinePlugin<UserConfig$3, Config$2, IApi$3>;
12568
+
12569
+ type SelectorType$2 = 'RouteHandler';
12570
+ type IApi$2 = {
12571
+ /**
12572
+ * @param type Selector type.
12573
+ * @param value Depends on `type`:
12574
+ * - `RouteHandler`: never
12575
+ * @returns Selector array
12576
+ */
12577
+ getSelector: (type: SelectorType$2, value?: string) => ICodegenSymbolSelector;
12578
+ };
12455
12579
 
12456
12580
  type UserConfig$2 = Plugin.Name<'fastify'> & {
12457
12581
  /**
@@ -12469,7 +12593,7 @@ type UserConfig$2 = Plugin.Name<'fastify'> & {
12469
12593
  output?: string;
12470
12594
  };
12471
12595
 
12472
- type FastifyPlugin = DefinePlugin<UserConfig$2>;
12596
+ type FastifyPlugin = DefinePlugin<UserConfig$2, UserConfig$2, IApi$2>;
12473
12597
 
12474
12598
  type UserConfig$1 = Plugin.Name<'valibot'> & {
12475
12599
  /**
@@ -12791,19 +12915,28 @@ type Config$1 = Plugin.Name<'valibot'> & {
12791
12915
  };
12792
12916
  };
12793
12917
 
12794
- type ValibotPlugin = DefinePlugin<UserConfig$1, Config$1, Api$1>;
12795
-
12796
- type Api$1 = {
12797
- createRequestValidator: (args: {
12798
- file: GeneratedFile;
12799
- operation: IR$1.OperationObject;
12800
- plugin: ValibotPlugin['Instance'];
12801
- }) => typescript__default.ArrowFunction | undefined;
12802
- createResponseValidator: (args: {
12803
- file: GeneratedFile;
12804
- operation: IR$1.OperationObject;
12805
- plugin: ValibotPlugin['Instance'];
12806
- }) => typescript__default.ArrowFunction | undefined;
12918
+ type ValibotPlugin = DefinePlugin<UserConfig$1, Config$1, IApi$1>;
12919
+
12920
+ type SelectorType$1 = 'data' | 'import' | 'ref' | 'responses' | 'webhook-request';
12921
+ type ValidatorArgs$1 = {
12922
+ file: ICodegenFile;
12923
+ operation: IR$1.OperationObject;
12924
+ plugin: ValibotPlugin['Instance'];
12925
+ };
12926
+ type IApi$1 = {
12927
+ createRequestValidator: (args: ValidatorArgs$1) => typescript__default.ArrowFunction | undefined;
12928
+ createResponseValidator: (args: ValidatorArgs$1) => typescript__default.ArrowFunction | undefined;
12929
+ /**
12930
+ * @param type Selector type.
12931
+ * @param value Depends on `type`:
12932
+ * - `data`: `operation.id` string
12933
+ * - `import`: headless symbols representing module imports
12934
+ * - `ref`: `$ref` JSON pointer
12935
+ * - `responses`: `operation.id` string
12936
+ * - `webhook-request`: `operation.id` string
12937
+ * @returns Selector array
12938
+ */
12939
+ getSelector: (type: SelectorType$1, value?: string) => ICodegenSymbolSelector;
12807
12940
  };
12808
12941
 
12809
12942
  type UserConfig = Plugin.Name<'zod'> & {
@@ -13552,27 +13685,32 @@ type Config = Plugin.Name<'zod'> & {
13552
13685
  };
13553
13686
  };
13554
13687
 
13555
- type ZodPlugin = DefinePlugin<UserConfig, Config, Api>;
13688
+ type ZodPlugin = DefinePlugin<UserConfig, Config, IApi>;
13556
13689
 
13557
- type GetIdArgs = {
13690
+ type SelectorType = 'data' | 'import' | 'ref' | 'responses' | 'type-infer-data' | 'type-infer-ref' | 'type-infer-responses' | 'type-infer-webhook-request' | 'webhook-request';
13691
+ type ValidatorArgs = {
13692
+ file: ICodegenFile;
13558
13693
  operation: IR$1.OperationObject;
13559
- type: 'data' | 'responses' | 'type-infer-data' | 'type-infer-responses' | 'type-infer-webhook-request' | 'webhook-request';
13560
- } | {
13561
- type: 'ref' | 'type-infer-ref';
13562
- value: string;
13694
+ plugin: ZodPlugin['Instance'];
13563
13695
  };
13564
- type Api = {
13565
- createRequestValidator: (args: {
13566
- file: GeneratedFile;
13567
- operation: IR$1.OperationObject;
13568
- plugin: ZodPlugin['Instance'];
13569
- }) => typescript__default.ArrowFunction | undefined;
13570
- createResponseValidator: (args: {
13571
- file: GeneratedFile;
13572
- operation: IR$1.OperationObject;
13573
- plugin: ZodPlugin['Instance'];
13574
- }) => typescript__default.ArrowFunction | undefined;
13575
- getId: (args: GetIdArgs) => string;
13696
+ type IApi = {
13697
+ createRequestValidator: (args: ValidatorArgs) => typescript__default.ArrowFunction | undefined;
13698
+ createResponseValidator: (args: ValidatorArgs) => typescript__default.ArrowFunction | undefined;
13699
+ /**
13700
+ * @param type Selector type.
13701
+ * @param value Depends on `type`:
13702
+ * - `data`: `operation.id` string
13703
+ * - `import`: headless symbols representing module imports
13704
+ * - `ref`: `$ref` JSON pointer
13705
+ * - `responses`: `operation.id` string
13706
+ * - `type-infer-data`: `operation.id` string
13707
+ * - `type-infer-ref`: `$ref` JSON pointer
13708
+ * - `type-infer-responses`: `operation.id` string
13709
+ * - `type-infer-webhook-request`: `operation.id` string
13710
+ * - `webhook-request`: `operation.id` string
13711
+ * @returns Selector array
13712
+ */
13713
+ getSelector: (type: SelectorType, value?: string) => ICodegenSymbolSelector;
13576
13714
  };
13577
13715
 
13578
13716
  interface PluginConfigMap {
@@ -13607,7 +13745,7 @@ declare class IRContext<Spec extends Record<string, any> = any> {
13607
13745
  * Configuration for parsing and generating the output. This
13608
13746
  * is a mix of user-provided and default values.
13609
13747
  */
13610
- config: Config$b;
13748
+ config: Config$c;
13611
13749
  /**
13612
13750
  * A map of files that will be generated from `spec`.
13613
13751
  */
@@ -13637,7 +13775,7 @@ declare class IRContext<Spec extends Record<string, any> = any> {
13637
13775
  */
13638
13776
  spec: Spec;
13639
13777
  constructor({ config, dependencies, logger, spec, }: {
13640
- config: Config$b;
13778
+ config: Config$c;
13641
13779
  dependencies: Record<string, string>;
13642
13780
  logger: Logger;
13643
13781
  spec: Spec;
@@ -13700,10 +13838,6 @@ interface IRComponentsObject {
13700
13838
  }
13701
13839
 
13702
13840
  interface IRContextFile {
13703
- /**
13704
- * Define casing for identifiers in this file.
13705
- */
13706
- case?: StringCase;
13707
13841
  /**
13708
13842
  * Should the exports from this file be re-exported in the index barrel file?
13709
13843
  */
@@ -14022,4 +14156,4 @@ interface WatchValues {
14022
14156
  lastValue?: string;
14023
14157
  }
14024
14158
 
14025
- export { type Comments as C, type DefinePlugin as D, type ExpressionTransformer as E, type ImportExportItemObject as I, Logger as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type TypeTransformer as T, type UserConfig$o as U, type WatchValues as W, Plugin as a, type Client$1 as b, IR$1 as c, OpenApiMetaObject as d, OpenApiOperationObject as e, OpenApiParameterObject as f, OpenApiRequestBodyObject as g, OpenApiResponseObject as h, OpenApiSchemaObject as i, Client as j, LegacyIR as k, type Config$b as l, tsNodeToString as t };
14159
+ export { type Comments as C, type DefinePlugin as D, type ExpressionTransformer as E, type ImportExportItemObject as I, Logger as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type TypeTransformer as T, type UserConfig$o as U, type WatchValues as W, Plugin as a, type Client$1 as b, IR$1 as c, OpenApiMetaObject as d, OpenApiOperationObject as e, OpenApiParameterObject as f, OpenApiRequestBodyObject as g, OpenApiResponseObject as h, OpenApiSchemaObject as i, Client as j, LegacyIR as k, type Config$c as l, tsNodeToString as t };