@hey-api/openapi-ts 0.58.0 → 0.59.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.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { rmSync } from 'node:fs';
1
+ import fs from 'node:fs';
2
2
  import ts from 'typescript';
3
3
 
4
4
  interface ImportExportItemObject {
@@ -4165,7 +4165,7 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
4165
4165
  interface Config$9 extends Plugin.Name<'@hey-api/transformers'> {
4166
4166
  /**
4167
4167
  * Convert date strings into Date objects?
4168
- * @default false
4168
+ * @default true
4169
4169
  */
4170
4170
  dates?: boolean;
4171
4171
  /**
@@ -4408,12 +4408,6 @@ type Formatters = 'biome' | 'prettier';
4408
4408
  type Linters = 'biome' | 'eslint' | 'oxlint';
4409
4409
  type StringCase = 'camelCase' | 'PascalCase' | 'preserve' | 'snake_case' | 'SCREAMING_SNAKE_CASE';
4410
4410
  interface ClientConfig {
4411
- /**
4412
- * Manually set base in OpenAPI config instead of inferring from server value
4413
- *
4414
- * @deprecated
4415
- */
4416
- base?: string;
4417
4411
  /**
4418
4412
  * HTTP client to generate
4419
4413
  */
@@ -4439,12 +4433,6 @@ interface ClientConfig {
4439
4433
  * config file name, or it's not located in the project root.
4440
4434
  */
4441
4435
  configFile?: string;
4442
- /**
4443
- * Run in debug mode?
4444
- *
4445
- * @default false
4446
- */
4447
- debug?: boolean;
4448
4436
  /**
4449
4437
  * Skip writing files to disk?
4450
4438
  *
@@ -4457,12 +4445,6 @@ interface ClientConfig {
4457
4445
  * @default false
4458
4446
  */
4459
4447
  experimentalParser?: boolean;
4460
- /**
4461
- * Generate core client classes?
4462
- *
4463
- * @default true
4464
- */
4465
- exportCore?: boolean;
4466
4448
  /**
4467
4449
  * Path to the OpenAPI specification. This can be either local or remote path.
4468
4450
  * Both JSON and YAML file formats are supported. You can also pass the parsed
@@ -4486,7 +4468,7 @@ interface ClientConfig {
4486
4468
  exclude?: string;
4487
4469
  /**
4488
4470
  * **This feature works only with the experimental parser**
4489
-
4471
+ *
4490
4472
  * Process only parts matching the regular expression. You can select both
4491
4473
  * operations and components by reference within the bundled input. In
4492
4474
  * case of conflicts, `exclude` takes precedence over `include`.
@@ -4504,14 +4486,36 @@ interface ClientConfig {
4504
4486
  path: string | Record<string, unknown>;
4505
4487
  };
4506
4488
  /**
4507
- * Custom client class name. Please note this option is deprecated and
4508
- * will be removed in favor of clients.
4509
- *
4510
- * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name
4489
+ * The relative location of the logs folder
4511
4490
  *
4512
- * @deprecated
4491
+ * @default process.cwd()
4513
4492
  */
4514
- name?: string;
4493
+ logs?: string | {
4494
+ /**
4495
+ * The logging level to control the verbosity of log output.
4496
+ * Determines which messages are logged based on their severity.
4497
+ *
4498
+ * Available levels (in increasing order of severity):
4499
+ * - `trace`: Detailed debug information, primarily for development.
4500
+ * - `debug`: Diagnostic information useful during debugging.
4501
+ * - `info`: General operational messages that indicate normal application behavior.
4502
+ * - `warn`: Potentially problematic situations that require attention.
4503
+ * - `error`: Errors that prevent some functionality but do not crash the application.
4504
+ * - `fatal`: Critical errors that cause the application to terminate.
4505
+ * - `silent`: Disables all logging.
4506
+ *
4507
+ * Messages with a severity equal to or higher than the specified level will be logged.
4508
+ *
4509
+ * @default 'info'
4510
+ */
4511
+ level?: 'debug' | 'error' | 'fatal' | 'info' | 'silent' | 'trace' | 'warn';
4512
+ /**
4513
+ * The relative location of the logs folder
4514
+ *
4515
+ * @default process.cwd()
4516
+ */
4517
+ path?: string;
4518
+ };
4515
4519
  /**
4516
4520
  * The relative location of the output folder
4517
4521
  */
@@ -4552,9 +4556,36 @@ interface ClientConfig {
4552
4556
  path: string;
4553
4557
  };
4554
4558
  /**
4555
- * Plugins are used to generate artifacts from provided input.
4559
+ * Plugins generate artifacts from `input`. By default, we generate SDK
4560
+ * functions and TypeScript interfaces. If you manually define `plugins`,
4561
+ * you need to include the default plugins if you wish to use them.
4562
+ *
4563
+ * @default ['@hey-api/typescript', '@hey-api/sdk']
4556
4564
  */
4557
4565
  plugins?: ReadonlyArray<UserPlugins['name'] | UserPlugins>;
4566
+ /**
4567
+ * Manually set base in OpenAPI config instead of inferring from server value
4568
+ *
4569
+ * @deprecated
4570
+ */
4571
+ base?: string;
4572
+ /**
4573
+ * Generate core client classes?
4574
+ *
4575
+ * @deprecated
4576
+ *
4577
+ * @default true
4578
+ */
4579
+ exportCore?: boolean;
4580
+ /**
4581
+ * Custom client class name. Please note this option is deprecated and
4582
+ * will be removed in favor of clients.
4583
+ *
4584
+ * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name
4585
+ *
4586
+ * @deprecated
4587
+ */
4588
+ name?: string;
4558
4589
  /**
4559
4590
  * Path to custom request file. Please note this option is deprecated and
4560
4591
  * will be removed in favor of clients.
@@ -4578,11 +4609,12 @@ interface ClientConfig {
4578
4609
  }
4579
4610
  interface UserConfig extends ClientConfig {
4580
4611
  }
4581
- type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'input' | 'name' | 'output' | 'plugins' | 'request'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
4612
+ type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'input' | 'logs' | 'name' | 'output' | 'plugins' | 'request'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
4582
4613
  client: Extract<Required<ClientConfig>['client'], object>;
4583
4614
  input: ExtractWithDiscriminator<ClientConfig['input'], {
4584
4615
  path: unknown;
4585
4616
  }>;
4617
+ logs: Extract<Required<ClientConfig['logs']>, object>;
4586
4618
  output: Extract<ClientConfig['output'], object>;
4587
4619
  pluginOrder: ReadonlyArray<ClientPlugins['name']>;
4588
4620
  plugins: ArrayOfObjectsToObjectMap<ExtractArrayOfObjects<ReadonlyArray<ClientPlugins>, {
@@ -4665,7 +4697,7 @@ declare class TypeScriptFile {
4665
4697
  context: IRContext;
4666
4698
  id: string;
4667
4699
  }): string;
4668
- remove(options?: Parameters<typeof rmSync>[1]): void;
4700
+ remove(options?: Parameters<typeof fs.rmSync>[1]): void;
4669
4701
  /**
4670
4702
  * Removes last node form the stack. Works as undo.
4671
4703
  */
@@ -4679,8 +4711,11 @@ interface EnsureUniqueIdentifierData {
4679
4711
  case: StringCase | undefined;
4680
4712
  count?: number;
4681
4713
  create?: boolean;
4714
+ /**
4715
+ * Transforms name obtained from `$ref` before it's passed to `stringCase()`.
4716
+ */
4717
+ nameTransformer?: (name: string) => string;
4682
4718
  namespace: Namespace;
4683
- validNameTransformer?: (value: string) => string;
4684
4719
  }
4685
4720
 
4686
4721
  interface ContextFile {
@@ -5586,6 +5621,10 @@ interface Client extends Omit<Client$1, 'operations'> {
5586
5621
  * @param userConfig {@link UserConfig} passed to the `createClient()` method
5587
5622
  */
5588
5623
  declare function createClient(userConfig: UserConfig): Promise<ReadonlyArray<Client>>;
5624
+ /**
5625
+ * Default plugins used to generate artifacts if plugins aren't specified.
5626
+ */
5627
+ declare const defaultPlugins: readonly ["@hey-api/typescript", "@hey-api/sdk"];
5589
5628
  /**
5590
5629
  * Type helper for openapi-ts.config.ts, returns {@link UserConfig} object
5591
5630
  */
@@ -5595,4 +5634,4 @@ declare const _default: {
5595
5634
  defineConfig: (config: UserConfig) => UserConfig;
5596
5635
  };
5597
5636
 
5598
- export { type OpenApiV3_0_X, type OpenApiV3_1_X, Plugin, type UserConfig, createClient, _default as default, defineConfig };
5637
+ export { type OpenApiV3_0_X, type OpenApiV3_1_X, Plugin, type UserConfig, createClient, _default as default, defaultPlugins, defineConfig };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { rmSync } from 'node:fs';
1
+ import fs from 'node:fs';
2
2
  import ts from 'typescript';
3
3
 
4
4
  interface ImportExportItemObject {
@@ -4165,7 +4165,7 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
4165
4165
  interface Config$9 extends Plugin.Name<'@hey-api/transformers'> {
4166
4166
  /**
4167
4167
  * Convert date strings into Date objects?
4168
- * @default false
4168
+ * @default true
4169
4169
  */
4170
4170
  dates?: boolean;
4171
4171
  /**
@@ -4408,12 +4408,6 @@ type Formatters = 'biome' | 'prettier';
4408
4408
  type Linters = 'biome' | 'eslint' | 'oxlint';
4409
4409
  type StringCase = 'camelCase' | 'PascalCase' | 'preserve' | 'snake_case' | 'SCREAMING_SNAKE_CASE';
4410
4410
  interface ClientConfig {
4411
- /**
4412
- * Manually set base in OpenAPI config instead of inferring from server value
4413
- *
4414
- * @deprecated
4415
- */
4416
- base?: string;
4417
4411
  /**
4418
4412
  * HTTP client to generate
4419
4413
  */
@@ -4439,12 +4433,6 @@ interface ClientConfig {
4439
4433
  * config file name, or it's not located in the project root.
4440
4434
  */
4441
4435
  configFile?: string;
4442
- /**
4443
- * Run in debug mode?
4444
- *
4445
- * @default false
4446
- */
4447
- debug?: boolean;
4448
4436
  /**
4449
4437
  * Skip writing files to disk?
4450
4438
  *
@@ -4457,12 +4445,6 @@ interface ClientConfig {
4457
4445
  * @default false
4458
4446
  */
4459
4447
  experimentalParser?: boolean;
4460
- /**
4461
- * Generate core client classes?
4462
- *
4463
- * @default true
4464
- */
4465
- exportCore?: boolean;
4466
4448
  /**
4467
4449
  * Path to the OpenAPI specification. This can be either local or remote path.
4468
4450
  * Both JSON and YAML file formats are supported. You can also pass the parsed
@@ -4486,7 +4468,7 @@ interface ClientConfig {
4486
4468
  exclude?: string;
4487
4469
  /**
4488
4470
  * **This feature works only with the experimental parser**
4489
-
4471
+ *
4490
4472
  * Process only parts matching the regular expression. You can select both
4491
4473
  * operations and components by reference within the bundled input. In
4492
4474
  * case of conflicts, `exclude` takes precedence over `include`.
@@ -4504,14 +4486,36 @@ interface ClientConfig {
4504
4486
  path: string | Record<string, unknown>;
4505
4487
  };
4506
4488
  /**
4507
- * Custom client class name. Please note this option is deprecated and
4508
- * will be removed in favor of clients.
4509
- *
4510
- * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name
4489
+ * The relative location of the logs folder
4511
4490
  *
4512
- * @deprecated
4491
+ * @default process.cwd()
4513
4492
  */
4514
- name?: string;
4493
+ logs?: string | {
4494
+ /**
4495
+ * The logging level to control the verbosity of log output.
4496
+ * Determines which messages are logged based on their severity.
4497
+ *
4498
+ * Available levels (in increasing order of severity):
4499
+ * - `trace`: Detailed debug information, primarily for development.
4500
+ * - `debug`: Diagnostic information useful during debugging.
4501
+ * - `info`: General operational messages that indicate normal application behavior.
4502
+ * - `warn`: Potentially problematic situations that require attention.
4503
+ * - `error`: Errors that prevent some functionality but do not crash the application.
4504
+ * - `fatal`: Critical errors that cause the application to terminate.
4505
+ * - `silent`: Disables all logging.
4506
+ *
4507
+ * Messages with a severity equal to or higher than the specified level will be logged.
4508
+ *
4509
+ * @default 'info'
4510
+ */
4511
+ level?: 'debug' | 'error' | 'fatal' | 'info' | 'silent' | 'trace' | 'warn';
4512
+ /**
4513
+ * The relative location of the logs folder
4514
+ *
4515
+ * @default process.cwd()
4516
+ */
4517
+ path?: string;
4518
+ };
4515
4519
  /**
4516
4520
  * The relative location of the output folder
4517
4521
  */
@@ -4552,9 +4556,36 @@ interface ClientConfig {
4552
4556
  path: string;
4553
4557
  };
4554
4558
  /**
4555
- * Plugins are used to generate artifacts from provided input.
4559
+ * Plugins generate artifacts from `input`. By default, we generate SDK
4560
+ * functions and TypeScript interfaces. If you manually define `plugins`,
4561
+ * you need to include the default plugins if you wish to use them.
4562
+ *
4563
+ * @default ['@hey-api/typescript', '@hey-api/sdk']
4556
4564
  */
4557
4565
  plugins?: ReadonlyArray<UserPlugins['name'] | UserPlugins>;
4566
+ /**
4567
+ * Manually set base in OpenAPI config instead of inferring from server value
4568
+ *
4569
+ * @deprecated
4570
+ */
4571
+ base?: string;
4572
+ /**
4573
+ * Generate core client classes?
4574
+ *
4575
+ * @deprecated
4576
+ *
4577
+ * @default true
4578
+ */
4579
+ exportCore?: boolean;
4580
+ /**
4581
+ * Custom client class name. Please note this option is deprecated and
4582
+ * will be removed in favor of clients.
4583
+ *
4584
+ * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name
4585
+ *
4586
+ * @deprecated
4587
+ */
4588
+ name?: string;
4558
4589
  /**
4559
4590
  * Path to custom request file. Please note this option is deprecated and
4560
4591
  * will be removed in favor of clients.
@@ -4578,11 +4609,12 @@ interface ClientConfig {
4578
4609
  }
4579
4610
  interface UserConfig extends ClientConfig {
4580
4611
  }
4581
- type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'input' | 'name' | 'output' | 'plugins' | 'request'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
4612
+ type Config = Omit<Required<ClientConfig>, 'base' | 'client' | 'input' | 'logs' | 'name' | 'output' | 'plugins' | 'request'> & Pick<ClientConfig, 'base' | 'name' | 'request'> & {
4582
4613
  client: Extract<Required<ClientConfig>['client'], object>;
4583
4614
  input: ExtractWithDiscriminator<ClientConfig['input'], {
4584
4615
  path: unknown;
4585
4616
  }>;
4617
+ logs: Extract<Required<ClientConfig['logs']>, object>;
4586
4618
  output: Extract<ClientConfig['output'], object>;
4587
4619
  pluginOrder: ReadonlyArray<ClientPlugins['name']>;
4588
4620
  plugins: ArrayOfObjectsToObjectMap<ExtractArrayOfObjects<ReadonlyArray<ClientPlugins>, {
@@ -4665,7 +4697,7 @@ declare class TypeScriptFile {
4665
4697
  context: IRContext;
4666
4698
  id: string;
4667
4699
  }): string;
4668
- remove(options?: Parameters<typeof rmSync>[1]): void;
4700
+ remove(options?: Parameters<typeof fs.rmSync>[1]): void;
4669
4701
  /**
4670
4702
  * Removes last node form the stack. Works as undo.
4671
4703
  */
@@ -4679,8 +4711,11 @@ interface EnsureUniqueIdentifierData {
4679
4711
  case: StringCase | undefined;
4680
4712
  count?: number;
4681
4713
  create?: boolean;
4714
+ /**
4715
+ * Transforms name obtained from `$ref` before it's passed to `stringCase()`.
4716
+ */
4717
+ nameTransformer?: (name: string) => string;
4682
4718
  namespace: Namespace;
4683
- validNameTransformer?: (value: string) => string;
4684
4719
  }
4685
4720
 
4686
4721
  interface ContextFile {
@@ -5586,6 +5621,10 @@ interface Client extends Omit<Client$1, 'operations'> {
5586
5621
  * @param userConfig {@link UserConfig} passed to the `createClient()` method
5587
5622
  */
5588
5623
  declare function createClient(userConfig: UserConfig): Promise<ReadonlyArray<Client>>;
5624
+ /**
5625
+ * Default plugins used to generate artifacts if plugins aren't specified.
5626
+ */
5627
+ declare const defaultPlugins: readonly ["@hey-api/typescript", "@hey-api/sdk"];
5589
5628
  /**
5590
5629
  * Type helper for openapi-ts.config.ts, returns {@link UserConfig} object
5591
5630
  */
@@ -5595,4 +5634,4 @@ declare const _default: {
5595
5634
  defineConfig: (config: UserConfig) => UserConfig;
5596
5635
  };
5597
5636
 
5598
- export { type OpenApiV3_0_X, type OpenApiV3_1_X, Plugin, type UserConfig, createClient, _default as default, defineConfig };
5637
+ export { type OpenApiV3_0_X, type OpenApiV3_1_X, Plugin, type UserConfig, createClient, _default as default, defaultPlugins, defineConfig };