@hey-api/openapi-ts 0.69.2 → 0.70.0

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,6 +1,6 @@
1
1
  import { JSONSchema } from '@hey-api/json-schema-ref-parser';
2
- import { c as Config, I as IR, W as WatchValues } from './types.d-CuSvND4p.cjs';
3
- export { i as initConfigs } from './types.d-CuSvND4p.cjs';
2
+ import { c as Config, I as IR, W as WatchValues } from './types.d-B4ySIeCs.cjs';
3
+ export { i as initConfigs } from './types.d-B4ySIeCs.cjs';
4
4
  import 'node:fs';
5
5
  import 'typescript';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { JSONSchema } from '@hey-api/json-schema-ref-parser';
2
- import { c as Config, I as IR, W as WatchValues } from './types.d-CuSvND4p.js';
3
- export { i as initConfigs } from './types.d-CuSvND4p.js';
2
+ import { c as Config, I as IR, W as WatchValues } from './types.d-B4ySIeCs.js';
3
+ export { i as initConfigs } from './types.d-B4ySIeCs.js';
4
4
  import 'node:fs';
5
5
  import 'typescript';
6
6
 
package/dist/internal.js CHANGED
@@ -1,2 +1,2 @@
1
- import {createRequire}from'module';export{o as getSpec,x as initConfigs,r as parseOpenApiSpec}from'./chunk-7JYB3OMB.js';createRequire(import.meta.url);//# sourceMappingURL=internal.js.map
1
+ import {createRequire}from'module';export{o as getSpec,x as initConfigs,r as parseOpenApiSpec}from'./chunk-LDP2PZAC.js';createRequire(import.meta.url);//# sourceMappingURL=internal.js.map
2
2
  //# sourceMappingURL=internal.js.map
@@ -6760,6 +6760,14 @@ interface Config$b extends Plugin.Name<'@hey-api/sdk'> {
6760
6760
  * @default 'sdk'
6761
6761
  */
6762
6762
  output?: string;
6763
+ /**
6764
+ * **This feature works only with the Fetch client**
6765
+ *
6766
+ * Should we return only data or multiple fields (data, error, response, etc.)?
6767
+ *
6768
+ * @default 'fields'
6769
+ */
6770
+ responseStyle?: 'data' | 'fields';
6763
6771
  /**
6764
6772
  * Customize the generated service class names. The name variable is
6765
6773
  * obtained from your OpenAPI specification tags.
@@ -7703,30 +7711,44 @@ interface Identifier {
7703
7711
  */
7704
7712
  name: string | false;
7705
7713
  }
7706
- type Namespace = Record<string, Pick<Identifier, 'name'> & {
7714
+ type NamespaceEntry = Pick<Identifier, 'name'> & {
7707
7715
  /**
7708
7716
  * Ref to the type in OpenAPI specification.
7709
7717
  */
7710
7718
  $ref: string;
7711
- }>;
7712
- interface Namespaces {
7719
+ };
7720
+ type Identifiers = Record<string, {
7721
+ /**
7722
+ * TypeScript enum only namespace.
7723
+ *
7724
+ * @example
7725
+ * ```ts
7726
+ * export enum Foo = {
7727
+ * FOO = 'foo'
7728
+ * }
7729
+ * ```
7730
+ */
7731
+ enum?: Record<string, NamespaceEntry>;
7713
7732
  /**
7714
7733
  * Type namespace. Types, interfaces, and type aliases exist here.
7734
+ *
7715
7735
  * @example
7716
7736
  * ```ts
7717
7737
  * export type Foo = string;
7718
7738
  * ```
7719
7739
  */
7720
- type: Namespace;
7740
+ type?: Record<string, NamespaceEntry>;
7721
7741
  /**
7722
7742
  * Value namespace. Variables, functions, classes, and constants exist here.
7743
+ *
7723
7744
  * @example
7724
7745
  * ```js
7725
7746
  * export const foo = '';
7726
7747
  * ```
7727
7748
  */
7728
- value: Namespace;
7729
- }
7749
+ value?: Record<string, NamespaceEntry>;
7750
+ }>;
7751
+ type Namespace = keyof Identifiers[keyof Identifiers];
7730
7752
  type FileImportResult = Pick<ImportExportItemObject, 'asType' | 'name'>;
7731
7753
  declare class TypeScriptFile {
7732
7754
  /**
@@ -7740,7 +7762,7 @@ declare class TypeScriptFile {
7740
7762
  private _items;
7741
7763
  private _name;
7742
7764
  private _path;
7743
- namespaces: Namespaces;
7765
+ identifiers: Identifiers;
7744
7766
  /**
7745
7767
  * Path relative to the client output root.
7746
7768
  */
@@ -7767,12 +7789,12 @@ declare class TypeScriptFile {
7767
7789
  * we want to avoid attempting to create since we know it won't happen.
7768
7790
  */
7769
7791
  blockIdentifier({ $ref, namespace, }: Pick<EnsureUniqueIdentifierData, '$ref'> & {
7770
- namespace: keyof Namespaces;
7792
+ namespace: Namespace;
7771
7793
  }): Identifier;
7772
7794
  get exportFromIndex(): boolean;
7773
7795
  get id(): string;
7774
- identifier({ namespace, ...args }: Omit<EnsureUniqueIdentifierData, 'case' | 'namespace'> & {
7775
- namespace: keyof Namespaces;
7796
+ identifier(args: Pick<EnsureUniqueIdentifierData, '$ref' | 'count' | 'create' | 'nameTransformer'> & {
7797
+ namespace: Namespace;
7776
7798
  }): Identifier;
7777
7799
  /**
7778
7800
  * Adds an import to the provided module. Handles duplication, returns added
@@ -7802,6 +7824,7 @@ interface EnsureUniqueIdentifierData {
7802
7824
  case: StringCase | undefined;
7803
7825
  count?: number;
7804
7826
  create?: boolean;
7827
+ identifiers: Identifiers;
7805
7828
  /**
7806
7829
  * Transforms name obtained from `$ref` before it's passed to `stringCase()`.
7807
7830
  */
@@ -6760,6 +6760,14 @@ interface Config$b extends Plugin.Name<'@hey-api/sdk'> {
6760
6760
  * @default 'sdk'
6761
6761
  */
6762
6762
  output?: string;
6763
+ /**
6764
+ * **This feature works only with the Fetch client**
6765
+ *
6766
+ * Should we return only data or multiple fields (data, error, response, etc.)?
6767
+ *
6768
+ * @default 'fields'
6769
+ */
6770
+ responseStyle?: 'data' | 'fields';
6763
6771
  /**
6764
6772
  * Customize the generated service class names. The name variable is
6765
6773
  * obtained from your OpenAPI specification tags.
@@ -7703,30 +7711,44 @@ interface Identifier {
7703
7711
  */
7704
7712
  name: string | false;
7705
7713
  }
7706
- type Namespace = Record<string, Pick<Identifier, 'name'> & {
7714
+ type NamespaceEntry = Pick<Identifier, 'name'> & {
7707
7715
  /**
7708
7716
  * Ref to the type in OpenAPI specification.
7709
7717
  */
7710
7718
  $ref: string;
7711
- }>;
7712
- interface Namespaces {
7719
+ };
7720
+ type Identifiers = Record<string, {
7721
+ /**
7722
+ * TypeScript enum only namespace.
7723
+ *
7724
+ * @example
7725
+ * ```ts
7726
+ * export enum Foo = {
7727
+ * FOO = 'foo'
7728
+ * }
7729
+ * ```
7730
+ */
7731
+ enum?: Record<string, NamespaceEntry>;
7713
7732
  /**
7714
7733
  * Type namespace. Types, interfaces, and type aliases exist here.
7734
+ *
7715
7735
  * @example
7716
7736
  * ```ts
7717
7737
  * export type Foo = string;
7718
7738
  * ```
7719
7739
  */
7720
- type: Namespace;
7740
+ type?: Record<string, NamespaceEntry>;
7721
7741
  /**
7722
7742
  * Value namespace. Variables, functions, classes, and constants exist here.
7743
+ *
7723
7744
  * @example
7724
7745
  * ```js
7725
7746
  * export const foo = '';
7726
7747
  * ```
7727
7748
  */
7728
- value: Namespace;
7729
- }
7749
+ value?: Record<string, NamespaceEntry>;
7750
+ }>;
7751
+ type Namespace = keyof Identifiers[keyof Identifiers];
7730
7752
  type FileImportResult = Pick<ImportExportItemObject, 'asType' | 'name'>;
7731
7753
  declare class TypeScriptFile {
7732
7754
  /**
@@ -7740,7 +7762,7 @@ declare class TypeScriptFile {
7740
7762
  private _items;
7741
7763
  private _name;
7742
7764
  private _path;
7743
- namespaces: Namespaces;
7765
+ identifiers: Identifiers;
7744
7766
  /**
7745
7767
  * Path relative to the client output root.
7746
7768
  */
@@ -7767,12 +7789,12 @@ declare class TypeScriptFile {
7767
7789
  * we want to avoid attempting to create since we know it won't happen.
7768
7790
  */
7769
7791
  blockIdentifier({ $ref, namespace, }: Pick<EnsureUniqueIdentifierData, '$ref'> & {
7770
- namespace: keyof Namespaces;
7792
+ namespace: Namespace;
7771
7793
  }): Identifier;
7772
7794
  get exportFromIndex(): boolean;
7773
7795
  get id(): string;
7774
- identifier({ namespace, ...args }: Omit<EnsureUniqueIdentifierData, 'case' | 'namespace'> & {
7775
- namespace: keyof Namespaces;
7796
+ identifier(args: Pick<EnsureUniqueIdentifierData, '$ref' | 'count' | 'create' | 'nameTransformer'> & {
7797
+ namespace: Namespace;
7776
7798
  }): Identifier;
7777
7799
  /**
7778
7800
  * Adds an import to the provided module. Handles duplication, returns added
@@ -7802,6 +7824,7 @@ interface EnsureUniqueIdentifierData {
7802
7824
  case: StringCase | undefined;
7803
7825
  count?: number;
7804
7826
  create?: boolean;
7827
+ identifiers: Identifiers;
7805
7828
  /**
7806
7829
  * Transforms name obtained from `$ref` before it's passed to `stringCase()`.
7807
7830
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hey-api/openapi-ts",
3
- "version": "0.69.2",
3
+ "version": "0.70.0",
4
4
  "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.",
5
5
  "homepage": "https://heyapi.dev/",
6
6
  "repository": {