@hey-api/openapi-ts 0.78.1 → 0.78.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 { i as Config, I as IR, U as UserConfig, W as WatchValues } from './types.d-DtZlpeRE.cjs';
1
+ import { k as Config, c as IR, U as UserConfig, W as WatchValues } from './types.d-CaH9PF-K.cjs';
2
2
  import { JSONSchema } from '@hey-api/json-schema-ref-parser';
3
3
  import 'node:fs';
4
4
  import 'typescript';
@@ -1,4 +1,4 @@
1
- import { i as Config, I as IR, U as UserConfig, W as WatchValues } from './types.d-DtZlpeRE.js';
1
+ import { k as Config, c as IR, U as UserConfig, W as WatchValues } from './types.d-CaH9PF-K.js';
2
2
  import { JSONSchema } from '@hey-api/json-schema-ref-parser';
3
3
  import 'node:fs';
4
4
  import 'typescript';
package/dist/internal.js CHANGED
@@ -1,2 +1,2 @@
1
- import {createRequire}from'module';export{I as getSpec,H as initConfigs,F as parseOpenApiSpec}from'./chunk-4AJU36PO.js';createRequire(import.meta.url);//# sourceMappingURL=internal.js.map
1
+ import {createRequire}from'module';export{I as getSpec,H as initConfigs,F as parseOpenApiSpec}from'./chunk-YJGQGZQU.js';createRequire(import.meta.url);//# sourceMappingURL=internal.js.map
2
2
  //# sourceMappingURL=internal.js.map
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs';
2
- import ts from 'typescript';
2
+ import ts__default from 'typescript';
3
3
 
4
4
  interface EnumExtensions {
5
5
  /**
@@ -2499,6 +2499,27 @@ interface ImportExportItemObject {
2499
2499
  asType?: boolean;
2500
2500
  name: string;
2501
2501
  }
2502
+ /**
2503
+ * Print a TypeScript node to a string.
2504
+ * @param node the node to print
2505
+ * @returns string
2506
+ */
2507
+ declare function tsNodeToString({ node, unescape, }: {
2508
+ node: ts__default.Node;
2509
+ unescape?: boolean;
2510
+ }): string;
2511
+ /**
2512
+ * Convert a string to a TypeScript Node
2513
+ * @param value the string to convert.
2514
+ * @returns ts.Node
2515
+ */
2516
+ declare function stringToTsNodes(value: string): ts__default.Node;
2517
+ type CommentLines = Array<string | null | false | undefined>;
2518
+ type CommentObject = {
2519
+ jsdoc?: boolean;
2520
+ lines: CommentLines;
2521
+ };
2522
+ type Comments = CommentLines | Array<CommentObject>;
2502
2523
 
2503
2524
  type StringCase =
2504
2525
  | 'camelCase'
@@ -2588,7 +2609,7 @@ declare class TypeScriptFile {
2588
2609
  identifierCase?: StringCase;
2589
2610
  name: string;
2590
2611
  });
2591
- add(...nodes: Array<ts.Node | string>): void;
2612
+ add(...nodes: Array<ts__default.Node | string>): void;
2592
2613
  /**
2593
2614
  * Prevents a specific identifier from being created. This is useful for
2594
2615
  * transformers where we know a certain transformer won't be needed, and
@@ -2624,7 +2645,7 @@ declare class TypeScriptFile {
2624
2645
  removeNode(): void;
2625
2646
  private _setName;
2626
2647
  private _toString;
2627
- write(separator?: string, tsConfig?: ts.ParsedCommandLine | null): void;
2648
+ write(separator?: string, tsConfig?: ts__default.ParsedCommandLine | null): void;
2628
2649
  }
2629
2650
  interface EnsureUniqueIdentifierData {
2630
2651
  $ref: string;
@@ -8219,6 +8240,13 @@ type ResolvedConfig$8 = Plugin.Name<'@hey-api/sdk'> & {
8219
8240
 
8220
8241
  type HeyApiSdkPlugin = DefinePlugin<Config$a, ResolvedConfig$8>;
8221
8242
 
8243
+ type ExpressionTransformer = ({ config, dataExpression, file, schema, }: {
8244
+ config: Omit<Config$9, 'name'>;
8245
+ dataExpression?: ts__default.Expression | string;
8246
+ file: TypeScriptFile;
8247
+ schema: IR.SchemaObject;
8248
+ }) => Array<ts__default.Expression> | undefined;
8249
+
8222
8250
  type Config$9 = Plugin.Name<'@hey-api/transformers'> & {
8223
8251
  /**
8224
8252
  * Convert long integers into BigInt values?
@@ -8245,6 +8273,10 @@ type Config$9 = Plugin.Name<'@hey-api/transformers'> & {
8245
8273
  * @default 'transformers'
8246
8274
  */
8247
8275
  output?: string;
8276
+ /**
8277
+ * Custom transforms to apply to the generated code.
8278
+ */
8279
+ transformers?: ReadonlyArray<ExpressionTransformer>;
8248
8280
  };
8249
8281
 
8250
8282
  type HeyApiTransformersPlugin = DefinePlugin<Config$9>;
@@ -9782,12 +9814,12 @@ type Api$1 = {
9782
9814
  file: TypeScriptFile;
9783
9815
  operation: IR.OperationObject;
9784
9816
  plugin: ValibotPlugin['Instance'];
9785
- }) => ts.ArrowFunction | undefined;
9817
+ }) => ts__default.ArrowFunction | undefined;
9786
9818
  createResponseValidator: (args: {
9787
9819
  file: TypeScriptFile;
9788
9820
  operation: IR.OperationObject;
9789
9821
  plugin: ValibotPlugin['Instance'];
9790
- }) => ts.ArrowFunction | undefined;
9822
+ }) => ts__default.ArrowFunction | undefined;
9791
9823
  };
9792
9824
 
9793
9825
  type Config = Plugin.Name<'zod'> & {
@@ -10089,12 +10121,12 @@ type Api = {
10089
10121
  file: TypeScriptFile;
10090
10122
  operation: IR.OperationObject;
10091
10123
  plugin: ZodPlugin['Instance'];
10092
- }) => ts.ArrowFunction | undefined;
10124
+ }) => ts__default.ArrowFunction | undefined;
10093
10125
  createResponseValidator: (args: {
10094
10126
  file: TypeScriptFile;
10095
10127
  operation: IR.OperationObject;
10096
10128
  plugin: ZodPlugin['Instance'];
10097
- }) => ts.ArrowFunction | undefined;
10129
+ }) => ts__default.ArrowFunction | undefined;
10098
10130
  };
10099
10131
 
10100
10132
  interface PluginConfigMap {
@@ -10457,4 +10489,4 @@ interface WatchValues {
10457
10489
  lastValue?: string;
10458
10490
  }
10459
10491
 
10460
- export { type Client$1 as C, type DefinePlugin as D, IR as I, LegacyIR as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type UserConfig as U, type WatchValues as W, Plugin as a, OpenApiMetaObject as b, OpenApiOperationObject as c, OpenApiParameterObject as d, OpenApiRequestBodyObject as e, OpenApiResponseObject as f, OpenApiSchemaObject as g, Client as h, type Config$l as i };
10492
+ 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 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$l as k, stringToTsNodes as s, tsNodeToString as t };
@@ -1,5 +1,5 @@
1
1
  import fs from 'node:fs';
2
- import ts from 'typescript';
2
+ import ts__default from 'typescript';
3
3
 
4
4
  interface EnumExtensions {
5
5
  /**
@@ -2499,6 +2499,27 @@ interface ImportExportItemObject {
2499
2499
  asType?: boolean;
2500
2500
  name: string;
2501
2501
  }
2502
+ /**
2503
+ * Print a TypeScript node to a string.
2504
+ * @param node the node to print
2505
+ * @returns string
2506
+ */
2507
+ declare function tsNodeToString({ node, unescape, }: {
2508
+ node: ts__default.Node;
2509
+ unescape?: boolean;
2510
+ }): string;
2511
+ /**
2512
+ * Convert a string to a TypeScript Node
2513
+ * @param value the string to convert.
2514
+ * @returns ts.Node
2515
+ */
2516
+ declare function stringToTsNodes(value: string): ts__default.Node;
2517
+ type CommentLines = Array<string | null | false | undefined>;
2518
+ type CommentObject = {
2519
+ jsdoc?: boolean;
2520
+ lines: CommentLines;
2521
+ };
2522
+ type Comments = CommentLines | Array<CommentObject>;
2502
2523
 
2503
2524
  type StringCase =
2504
2525
  | 'camelCase'
@@ -2588,7 +2609,7 @@ declare class TypeScriptFile {
2588
2609
  identifierCase?: StringCase;
2589
2610
  name: string;
2590
2611
  });
2591
- add(...nodes: Array<ts.Node | string>): void;
2612
+ add(...nodes: Array<ts__default.Node | string>): void;
2592
2613
  /**
2593
2614
  * Prevents a specific identifier from being created. This is useful for
2594
2615
  * transformers where we know a certain transformer won't be needed, and
@@ -2624,7 +2645,7 @@ declare class TypeScriptFile {
2624
2645
  removeNode(): void;
2625
2646
  private _setName;
2626
2647
  private _toString;
2627
- write(separator?: string, tsConfig?: ts.ParsedCommandLine | null): void;
2648
+ write(separator?: string, tsConfig?: ts__default.ParsedCommandLine | null): void;
2628
2649
  }
2629
2650
  interface EnsureUniqueIdentifierData {
2630
2651
  $ref: string;
@@ -8219,6 +8240,13 @@ type ResolvedConfig$8 = Plugin.Name<'@hey-api/sdk'> & {
8219
8240
 
8220
8241
  type HeyApiSdkPlugin = DefinePlugin<Config$a, ResolvedConfig$8>;
8221
8242
 
8243
+ type ExpressionTransformer = ({ config, dataExpression, file, schema, }: {
8244
+ config: Omit<Config$9, 'name'>;
8245
+ dataExpression?: ts__default.Expression | string;
8246
+ file: TypeScriptFile;
8247
+ schema: IR.SchemaObject;
8248
+ }) => Array<ts__default.Expression> | undefined;
8249
+
8222
8250
  type Config$9 = Plugin.Name<'@hey-api/transformers'> & {
8223
8251
  /**
8224
8252
  * Convert long integers into BigInt values?
@@ -8245,6 +8273,10 @@ type Config$9 = Plugin.Name<'@hey-api/transformers'> & {
8245
8273
  * @default 'transformers'
8246
8274
  */
8247
8275
  output?: string;
8276
+ /**
8277
+ * Custom transforms to apply to the generated code.
8278
+ */
8279
+ transformers?: ReadonlyArray<ExpressionTransformer>;
8248
8280
  };
8249
8281
 
8250
8282
  type HeyApiTransformersPlugin = DefinePlugin<Config$9>;
@@ -9782,12 +9814,12 @@ type Api$1 = {
9782
9814
  file: TypeScriptFile;
9783
9815
  operation: IR.OperationObject;
9784
9816
  plugin: ValibotPlugin['Instance'];
9785
- }) => ts.ArrowFunction | undefined;
9817
+ }) => ts__default.ArrowFunction | undefined;
9786
9818
  createResponseValidator: (args: {
9787
9819
  file: TypeScriptFile;
9788
9820
  operation: IR.OperationObject;
9789
9821
  plugin: ValibotPlugin['Instance'];
9790
- }) => ts.ArrowFunction | undefined;
9822
+ }) => ts__default.ArrowFunction | undefined;
9791
9823
  };
9792
9824
 
9793
9825
  type Config = Plugin.Name<'zod'> & {
@@ -10089,12 +10121,12 @@ type Api = {
10089
10121
  file: TypeScriptFile;
10090
10122
  operation: IR.OperationObject;
10091
10123
  plugin: ZodPlugin['Instance'];
10092
- }) => ts.ArrowFunction | undefined;
10124
+ }) => ts__default.ArrowFunction | undefined;
10093
10125
  createResponseValidator: (args: {
10094
10126
  file: TypeScriptFile;
10095
10127
  operation: IR.OperationObject;
10096
10128
  plugin: ZodPlugin['Instance'];
10097
- }) => ts.ArrowFunction | undefined;
10129
+ }) => ts__default.ArrowFunction | undefined;
10098
10130
  };
10099
10131
 
10100
10132
  interface PluginConfigMap {
@@ -10457,4 +10489,4 @@ interface WatchValues {
10457
10489
  lastValue?: string;
10458
10490
  }
10459
10491
 
10460
- export { type Client$1 as C, type DefinePlugin as D, IR as I, LegacyIR as L, OpenApi$3 as O, type PluginHandler as P, type StringCase as S, type UserConfig as U, type WatchValues as W, Plugin as a, OpenApiMetaObject as b, OpenApiOperationObject as c, OpenApiParameterObject as d, OpenApiRequestBodyObject as e, OpenApiResponseObject as f, OpenApiSchemaObject as g, Client as h, type Config$l as i };
10492
+ 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 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$l as k, stringToTsNodes as s, tsNodeToString as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hey-api/openapi-ts",
3
- "version": "0.78.1",
3
+ "version": "0.78.2",
4
4
  "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.",
5
5
  "homepage": "https://heyapi.dev/",
6
6
  "repository": {