@hey-api/openapi-ts 0.80.1 → 0.80.2

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,4 +1,4 @@
1
- import { k as Config, c as IR, U as UserConfig, W as WatchValues } from './types.d-CXdSuWix.cjs';
1
+ import { k as Config, c as IR, U as UserConfig, W as WatchValues } from './types.d-CCdoSF-L.cjs';
2
2
  import { JSONSchema } from '@hey-api/json-schema-ref-parser';
3
3
  import 'semver';
4
4
  import 'node:fs';
@@ -1,4 +1,4 @@
1
- import { k as Config, c as IR, U as UserConfig, W as WatchValues } from './types.d-CXdSuWix.js';
1
+ import { k as Config, c as IR, U as UserConfig, W as WatchValues } from './types.d-CCdoSF-L.js';
2
2
  import { JSONSchema } from '@hey-api/json-schema-ref-parser';
3
3
  import 'semver';
4
4
  import 'node:fs';
package/dist/internal.js CHANGED
@@ -1,2 +1,2 @@
1
- import {createRequire}from'module';export{J as getSpec,I as initConfigs,G as parseOpenApiSpec}from'./chunk-RLV6NJ5Q.js';createRequire(import.meta.url);//# sourceMappingURL=internal.js.map
1
+ import {createRequire}from'module';export{K as getSpec,J as initConfigs,H as parseOpenApiSpec}from'./chunk-K4TMWMUE.js';createRequire(import.meta.url);//# sourceMappingURL=internal.js.map
2
2
  //# sourceMappingURL=internal.js.map
@@ -1,6 +1,6 @@
1
1
  import { SemVer, RangeOptions } from 'semver';
2
2
  import fs from 'node:fs';
3
- import ts__default from 'typescript';
3
+ import typescript__default from 'typescript';
4
4
 
5
5
  interface EnumExtensions {
6
6
  /**
@@ -2528,15 +2528,9 @@ interface ImportExportItemObject<Name extends string | undefined = string | unde
2528
2528
  * @returns string
2529
2529
  */
2530
2530
  declare function tsNodeToString({ node, unescape, }: {
2531
- node: ts__default.Node;
2531
+ node: typescript__default.Node;
2532
2532
  unescape?: boolean;
2533
2533
  }): string;
2534
- /**
2535
- * Convert a string to a TypeScript Node
2536
- * @param value the string to convert.
2537
- * @returns ts.Node
2538
- */
2539
- declare function stringToTsNodes(value: string): ts__default.Node;
2540
2534
  type CommentLines = Array<string | null | false | undefined>;
2541
2535
  type CommentObject = {
2542
2536
  jsdoc?: boolean;
@@ -2626,7 +2620,7 @@ type NodeInfo = {
2626
2620
  /**
2627
2621
  * Reference to the node object.
2628
2622
  */
2629
- node: ts__default.TypeReferenceNode;
2623
+ node: typescript__default.TypeReferenceNode;
2630
2624
  };
2631
2625
 
2632
2626
  type NodeReference<T = void> = {
@@ -2712,7 +2706,7 @@ declare class GeneratedFile {
2712
2706
  id: string;
2713
2707
  name: string;
2714
2708
  });
2715
- add(...nodes: Array<ts__default.Node | string>): void;
2709
+ add(...nodes: Array<typescript__default.Node | string>): void;
2716
2710
  /**
2717
2711
  * Adds a reference node for a name. This can be used later to rename
2718
2712
  * identifiers.
@@ -2790,7 +2784,7 @@ declare class GeneratedFile {
2790
2784
  * @returns noop
2791
2785
  */
2792
2786
  updateNodeReferences(id: string, name: string): void;
2793
- write(separator?: string, tsConfig?: ts__default.ParsedCommandLine | null): void;
2787
+ write(separator?: string, tsConfig?: typescript__default.ParsedCommandLine | null): void;
2794
2788
  }
2795
2789
  interface EnsureUniqueIdentifierData {
2796
2790
  $ref: string;
@@ -8420,10 +8414,22 @@ type HeyApiSdkPlugin = DefinePlugin<UserConfig$a, Config$8>;
8420
8414
 
8421
8415
  type ExpressionTransformer = ({ config, dataExpression, file, schema, }: {
8422
8416
  config: Omit<UserConfig$9, 'name'>;
8423
- dataExpression?: ts__default.Expression | string;
8417
+ dataExpression?: typescript__default.Expression | string;
8424
8418
  file: GeneratedFile;
8425
8419
  schema: IR.SchemaObject;
8426
- }) => Array<ts__default.Expression> | undefined;
8420
+ }) => Array<typescript__default.Expression> | undefined;
8421
+
8422
+ /**
8423
+ * Returns the TypeScript type node for a schema with a specific format.
8424
+ * If undefined is returned, the default type will be used.
8425
+ */
8426
+ type TypeTransformer = ({
8427
+ file,
8428
+ schema,
8429
+ }: {
8430
+ file: GeneratedFile;
8431
+ schema: IR.SchemaObject;
8432
+ }) => typescript__default.TypeNode | undefined;
8427
8433
 
8428
8434
  type UserConfig$9 = Plugin.Name<'@hey-api/transformers'> & {
8429
8435
  /**
@@ -8455,6 +8461,11 @@ type UserConfig$9 = Plugin.Name<'@hey-api/transformers'> & {
8455
8461
  * Custom transforms to apply to the generated code.
8456
8462
  */
8457
8463
  transformers?: ReadonlyArray<ExpressionTransformer>;
8464
+
8465
+ /**
8466
+ * Custom type transformers that modify the TypeScript types generated.
8467
+ */
8468
+ typeTransformers?: ReadonlyArray<TypeTransformer>;
8458
8469
  };
8459
8470
 
8460
8471
  type HeyApiTransformersPlugin = DefinePlugin<UserConfig$9>;
@@ -8898,7 +8909,7 @@ declare const schemaToType: ({ onRef, plugin, schema, state, }: {
8898
8909
  plugin: HeyApiTypeScriptPlugin["Instance"];
8899
8910
  schema: IR.SchemaObject;
8900
8911
  state: PluginState;
8901
- }) => ts__default.TypeNode;
8912
+ }) => typescript__default.TypeNode;
8902
8913
 
8903
8914
  type GetIdArgs$1 = {
8904
8915
  type: 'ClientOptions';
@@ -8911,7 +8922,7 @@ type GetIdArgs$1 = {
8911
8922
  };
8912
8923
  type Api$2 = {
8913
8924
  getId: (args: GetIdArgs$1) => string;
8914
- schemaToType: (args: Omit<Parameters<typeof schemaToType>[0], 'onRef'> & Pick<Partial<Parameters<typeof schemaToType>[0]>, 'onRef'>) => ts__default.TypeNode;
8925
+ schemaToType: (args: Omit<Parameters<typeof schemaToType>[0], 'onRef'> & Pick<Partial<Parameters<typeof schemaToType>[0]>, 'onRef'>) => typescript__default.TypeNode;
8915
8926
  };
8916
8927
 
8917
8928
  type UserConfig$7 = Plugin.Name<'@tanstack/angular-query-experimental'> & {
@@ -11077,12 +11088,12 @@ type Api$1 = {
11077
11088
  file: GeneratedFile;
11078
11089
  operation: IR.OperationObject;
11079
11090
  plugin: ValibotPlugin['Instance'];
11080
- }) => ts__default.ArrowFunction | undefined;
11091
+ }) => typescript__default.ArrowFunction | undefined;
11081
11092
  createResponseValidator: (args: {
11082
11093
  file: GeneratedFile;
11083
11094
  operation: IR.OperationObject;
11084
11095
  plugin: ValibotPlugin['Instance'];
11085
- }) => ts__default.ArrowFunction | undefined;
11096
+ }) => typescript__default.ArrowFunction | undefined;
11086
11097
  };
11087
11098
 
11088
11099
  type UserConfig = Plugin.Name<'zod'> & {
@@ -11693,12 +11704,12 @@ type Api = {
11693
11704
  file: GeneratedFile;
11694
11705
  operation: IR.OperationObject;
11695
11706
  plugin: ZodPlugin['Instance'];
11696
- }) => ts__default.ArrowFunction | undefined;
11707
+ }) => typescript__default.ArrowFunction | undefined;
11697
11708
  createResponseValidator: (args: {
11698
11709
  file: GeneratedFile;
11699
11710
  operation: IR.OperationObject;
11700
11711
  plugin: ZodPlugin['Instance'];
11701
- }) => ts__default.ArrowFunction | undefined;
11712
+ }) => typescript__default.ArrowFunction | undefined;
11702
11713
  getId: (args: GetIdArgs) => string;
11703
11714
  };
11704
11715
 
@@ -12071,4 +12082,4 @@ interface WatchValues {
12071
12082
  lastValue?: string;
12072
12083
  }
12073
12084
 
12074
- export { type Comments as C, type DefinePlugin as D, type ExpressionTransformer as E, type ImportExportItemObject as I, LegacyIR as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type UserConfig$l as U, type WatchValues as W, Plugin as a, type Client$1 as b, IR as c, OpenApiMetaObject as d, OpenApiOperationObject as e, OpenApiParameterObject as f, OpenApiRequestBodyObject as g, OpenApiResponseObject as h, OpenApiSchemaObject as i, Client as j, type Config$9 as k, stringToTsNodes as s, tsNodeToString as t };
12085
+ export { type Comments as C, type DefinePlugin as D, type ExpressionTransformer as E, type ImportExportItemObject as I, LegacyIR as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type TypeTransformer as T, type UserConfig$l as U, type WatchValues as W, Plugin as a, type Client$1 as b, IR as c, OpenApiMetaObject as d, OpenApiOperationObject as e, OpenApiParameterObject as f, OpenApiRequestBodyObject as g, OpenApiResponseObject as h, OpenApiSchemaObject as i, Client as j, type Config$9 as k, tsNodeToString as t };
@@ -1,6 +1,6 @@
1
1
  import { SemVer, RangeOptions } from 'semver';
2
2
  import fs from 'node:fs';
3
- import ts__default from 'typescript';
3
+ import typescript__default from 'typescript';
4
4
 
5
5
  interface EnumExtensions {
6
6
  /**
@@ -2528,15 +2528,9 @@ interface ImportExportItemObject<Name extends string | undefined = string | unde
2528
2528
  * @returns string
2529
2529
  */
2530
2530
  declare function tsNodeToString({ node, unescape, }: {
2531
- node: ts__default.Node;
2531
+ node: typescript__default.Node;
2532
2532
  unescape?: boolean;
2533
2533
  }): string;
2534
- /**
2535
- * Convert a string to a TypeScript Node
2536
- * @param value the string to convert.
2537
- * @returns ts.Node
2538
- */
2539
- declare function stringToTsNodes(value: string): ts__default.Node;
2540
2534
  type CommentLines = Array<string | null | false | undefined>;
2541
2535
  type CommentObject = {
2542
2536
  jsdoc?: boolean;
@@ -2626,7 +2620,7 @@ type NodeInfo = {
2626
2620
  /**
2627
2621
  * Reference to the node object.
2628
2622
  */
2629
- node: ts__default.TypeReferenceNode;
2623
+ node: typescript__default.TypeReferenceNode;
2630
2624
  };
2631
2625
 
2632
2626
  type NodeReference<T = void> = {
@@ -2712,7 +2706,7 @@ declare class GeneratedFile {
2712
2706
  id: string;
2713
2707
  name: string;
2714
2708
  });
2715
- add(...nodes: Array<ts__default.Node | string>): void;
2709
+ add(...nodes: Array<typescript__default.Node | string>): void;
2716
2710
  /**
2717
2711
  * Adds a reference node for a name. This can be used later to rename
2718
2712
  * identifiers.
@@ -2790,7 +2784,7 @@ declare class GeneratedFile {
2790
2784
  * @returns noop
2791
2785
  */
2792
2786
  updateNodeReferences(id: string, name: string): void;
2793
- write(separator?: string, tsConfig?: ts__default.ParsedCommandLine | null): void;
2787
+ write(separator?: string, tsConfig?: typescript__default.ParsedCommandLine | null): void;
2794
2788
  }
2795
2789
  interface EnsureUniqueIdentifierData {
2796
2790
  $ref: string;
@@ -8420,10 +8414,22 @@ type HeyApiSdkPlugin = DefinePlugin<UserConfig$a, Config$8>;
8420
8414
 
8421
8415
  type ExpressionTransformer = ({ config, dataExpression, file, schema, }: {
8422
8416
  config: Omit<UserConfig$9, 'name'>;
8423
- dataExpression?: ts__default.Expression | string;
8417
+ dataExpression?: typescript__default.Expression | string;
8424
8418
  file: GeneratedFile;
8425
8419
  schema: IR.SchemaObject;
8426
- }) => Array<ts__default.Expression> | undefined;
8420
+ }) => Array<typescript__default.Expression> | undefined;
8421
+
8422
+ /**
8423
+ * Returns the TypeScript type node for a schema with a specific format.
8424
+ * If undefined is returned, the default type will be used.
8425
+ */
8426
+ type TypeTransformer = ({
8427
+ file,
8428
+ schema,
8429
+ }: {
8430
+ file: GeneratedFile;
8431
+ schema: IR.SchemaObject;
8432
+ }) => typescript__default.TypeNode | undefined;
8427
8433
 
8428
8434
  type UserConfig$9 = Plugin.Name<'@hey-api/transformers'> & {
8429
8435
  /**
@@ -8455,6 +8461,11 @@ type UserConfig$9 = Plugin.Name<'@hey-api/transformers'> & {
8455
8461
  * Custom transforms to apply to the generated code.
8456
8462
  */
8457
8463
  transformers?: ReadonlyArray<ExpressionTransformer>;
8464
+
8465
+ /**
8466
+ * Custom type transformers that modify the TypeScript types generated.
8467
+ */
8468
+ typeTransformers?: ReadonlyArray<TypeTransformer>;
8458
8469
  };
8459
8470
 
8460
8471
  type HeyApiTransformersPlugin = DefinePlugin<UserConfig$9>;
@@ -8898,7 +8909,7 @@ declare const schemaToType: ({ onRef, plugin, schema, state, }: {
8898
8909
  plugin: HeyApiTypeScriptPlugin["Instance"];
8899
8910
  schema: IR.SchemaObject;
8900
8911
  state: PluginState;
8901
- }) => ts__default.TypeNode;
8912
+ }) => typescript__default.TypeNode;
8902
8913
 
8903
8914
  type GetIdArgs$1 = {
8904
8915
  type: 'ClientOptions';
@@ -8911,7 +8922,7 @@ type GetIdArgs$1 = {
8911
8922
  };
8912
8923
  type Api$2 = {
8913
8924
  getId: (args: GetIdArgs$1) => string;
8914
- schemaToType: (args: Omit<Parameters<typeof schemaToType>[0], 'onRef'> & Pick<Partial<Parameters<typeof schemaToType>[0]>, 'onRef'>) => ts__default.TypeNode;
8925
+ schemaToType: (args: Omit<Parameters<typeof schemaToType>[0], 'onRef'> & Pick<Partial<Parameters<typeof schemaToType>[0]>, 'onRef'>) => typescript__default.TypeNode;
8915
8926
  };
8916
8927
 
8917
8928
  type UserConfig$7 = Plugin.Name<'@tanstack/angular-query-experimental'> & {
@@ -11077,12 +11088,12 @@ type Api$1 = {
11077
11088
  file: GeneratedFile;
11078
11089
  operation: IR.OperationObject;
11079
11090
  plugin: ValibotPlugin['Instance'];
11080
- }) => ts__default.ArrowFunction | undefined;
11091
+ }) => typescript__default.ArrowFunction | undefined;
11081
11092
  createResponseValidator: (args: {
11082
11093
  file: GeneratedFile;
11083
11094
  operation: IR.OperationObject;
11084
11095
  plugin: ValibotPlugin['Instance'];
11085
- }) => ts__default.ArrowFunction | undefined;
11096
+ }) => typescript__default.ArrowFunction | undefined;
11086
11097
  };
11087
11098
 
11088
11099
  type UserConfig = Plugin.Name<'zod'> & {
@@ -11693,12 +11704,12 @@ type Api = {
11693
11704
  file: GeneratedFile;
11694
11705
  operation: IR.OperationObject;
11695
11706
  plugin: ZodPlugin['Instance'];
11696
- }) => ts__default.ArrowFunction | undefined;
11707
+ }) => typescript__default.ArrowFunction | undefined;
11697
11708
  createResponseValidator: (args: {
11698
11709
  file: GeneratedFile;
11699
11710
  operation: IR.OperationObject;
11700
11711
  plugin: ZodPlugin['Instance'];
11701
- }) => ts__default.ArrowFunction | undefined;
11712
+ }) => typescript__default.ArrowFunction | undefined;
11702
11713
  getId: (args: GetIdArgs) => string;
11703
11714
  };
11704
11715
 
@@ -12071,4 +12082,4 @@ interface WatchValues {
12071
12082
  lastValue?: string;
12072
12083
  }
12073
12084
 
12074
- export { type Comments as C, type DefinePlugin as D, type ExpressionTransformer as E, type ImportExportItemObject as I, LegacyIR as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type UserConfig$l as U, type WatchValues as W, Plugin as a, type Client$1 as b, IR as c, OpenApiMetaObject as d, OpenApiOperationObject as e, OpenApiParameterObject as f, OpenApiRequestBodyObject as g, OpenApiResponseObject as h, OpenApiSchemaObject as i, Client as j, type Config$9 as k, stringToTsNodes as s, tsNodeToString as t };
12085
+ export { type Comments as C, type DefinePlugin as D, type ExpressionTransformer as E, type ImportExportItemObject as I, LegacyIR as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type TypeTransformer as T, type UserConfig$l as U, type WatchValues as W, Plugin as a, type Client$1 as b, IR as c, OpenApiMetaObject as d, OpenApiOperationObject as e, OpenApiParameterObject as f, OpenApiRequestBodyObject as g, OpenApiResponseObject as h, OpenApiSchemaObject as i, Client as j, type Config$9 as k, tsNodeToString as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hey-api/openapi-ts",
3
- "version": "0.80.1",
3
+ "version": "0.80.2",
4
4
  "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.",
5
5
  "homepage": "https://heyapi.dev/",
6
6
  "repository": {