@hey-api/openapi-ts 0.69.1 → 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-DewPnfre.cjs';
3
- export { i as initConfigs } from './types.d-DewPnfre.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-DewPnfre.js';
3
- export { i as initConfigs } from './types.d-DewPnfre.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-QYTRELTS.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
@@ -6491,9 +6491,9 @@ declare namespace Plugin {
6491
6491
  Pick<Required<BaseConfig>, 'exportFromIndex' | 'output'>;
6492
6492
 
6493
6493
  /**
6494
- * @deprecated
6495
- *
6496
6494
  * Plugin implementation for legacy parser.
6495
+ *
6496
+ * @deprecated
6497
6497
  */
6498
6498
  export type LegacyHandler<Config extends BaseConfig> = (args: {
6499
6499
  client: Client$1;
@@ -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.
@@ -6799,8 +6807,6 @@ interface Config$b extends Plugin.Name<'@hey-api/sdk'> {
6799
6807
  // DEPRECATED OPTIONS BELOW
6800
6808
 
6801
6809
  /**
6802
- * @deprecated
6803
- *
6804
6810
  * **This feature works only with the legacy parser**
6805
6811
  *
6806
6812
  * Filter endpoints to be included in the generated SDK. The provided
@@ -6808,14 +6814,15 @@ interface Config$b extends Plugin.Name<'@hey-api/sdk'> {
6808
6814
  * included in the output. The input pattern this string will be tested
6809
6815
  * against is `{method} {path}`. For example, you can match
6810
6816
  * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
6817
+ *
6818
+ * @deprecated
6811
6819
  */
6812
6820
  // eslint-disable-next-line typescript-sort-keys/interface
6813
6821
  filter?: string;
6814
6822
  /**
6815
- * @deprecated
6816
- *
6817
6823
  * Define shape of returned value from service calls
6818
6824
  *
6825
+ * @deprecated
6819
6826
  * @default 'body'
6820
6827
  */
6821
6828
  response?: 'body' | 'response';
@@ -6928,32 +6935,30 @@ interface Config$9 extends Plugin.Name<'@hey-api/typescript'> {
6928
6935
  // DEPRECATED OPTIONS BELOW
6929
6936
 
6930
6937
  /**
6931
- * @deprecated
6932
- *
6933
6938
  * **This feature works only with the legacy parser**
6934
6939
  *
6935
6940
  * Include only types matching regular expression.
6941
+ *
6942
+ * @deprecated
6936
6943
  */
6937
6944
  // eslint-disable-next-line typescript-sort-keys/interface
6938
6945
  include?: string;
6939
6946
  /**
6940
- * @deprecated
6941
- *
6942
6947
  * **This feature works only with the legacy parser**
6943
6948
  *
6944
6949
  * Use your preferred naming pattern
6945
6950
  *
6951
+ * @deprecated
6946
6952
  * @default 'preserve'
6947
6953
  */
6948
6954
  style?: 'PascalCase' | 'preserve';
6949
6955
  /**
6950
- * @deprecated
6951
- *
6952
6956
  * **This feature works only with the legacy parser**
6953
6957
  *
6954
6958
  * Generate a tree of types containing all operations? It will be named
6955
6959
  * $OpenApiTs.
6956
6960
  *
6961
+ * @deprecated
6957
6962
  * @default false
6958
6963
  */
6959
6964
  tree?: boolean;
@@ -7230,6 +7235,27 @@ type StringCase =
7230
7235
  | 'snake_case'
7231
7236
  | 'SCREAMING_SNAKE_CASE';
7232
7237
 
7238
+ interface Watch {
7239
+ /**
7240
+ * Regenerate the client when the input file changes?
7241
+ *
7242
+ * @default false
7243
+ */
7244
+ enabled?: boolean;
7245
+ /**
7246
+ * How often should we attempt to detect the input file change? (in ms)
7247
+ *
7248
+ * @default 1000
7249
+ */
7250
+ interval?: number;
7251
+ /**
7252
+ * How long will we wait before the request times out?
7253
+ *
7254
+ * @default 60_000
7255
+ */
7256
+ timeout?: number;
7257
+ }
7258
+
7233
7259
  interface Input {
7234
7260
  /**
7235
7261
  * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
@@ -7436,7 +7462,15 @@ interface Input {
7436
7462
  * the first match will be returned.
7437
7463
  */
7438
7464
  tags?: ReadonlyArray<string>;
7439
-
7465
+ /**
7466
+ * **This is an experimental feature.**
7467
+ *
7468
+ * Validate the input before generating output? This is an experimental,
7469
+ * lightweight feature and support will be added on an ad hoc basis.
7470
+ *
7471
+ * @default false
7472
+ */
7473
+ validate_EXPERIMENTAL?: boolean;
7440
7474
  /**
7441
7475
  * **Requires `path` to start with `https://get.heyapi.dev` or be undefined**
7442
7476
  *
@@ -7445,6 +7479,13 @@ interface Input {
7445
7479
  * the value.
7446
7480
  */
7447
7481
  version?: string;
7482
+ /**
7483
+ * Regenerate the client when the input file changes? You can alternatively
7484
+ * pass a numeric value for the interval in ms.
7485
+ *
7486
+ * @default false
7487
+ */
7488
+ watch?: boolean | number | Watch;
7448
7489
  }
7449
7490
 
7450
7491
  interface UserConfig {
@@ -7580,90 +7621,59 @@ interface UserConfig {
7580
7621
  * @default ['@hey-api/typescript', '@hey-api/sdk']
7581
7622
  */
7582
7623
  plugins?: ReadonlyArray<UserPlugins['name'] | UserPlugins>;
7583
- /**
7584
- * Regenerate the client when the input file changes? You can alternatively
7585
- * pass a numeric value for the interval in ms.
7586
- *
7587
- * @default false
7588
- */
7589
- watch?:
7590
- | boolean
7591
- | number
7592
- | {
7593
- /**
7594
- * Regenerate the client when the input file changes?
7595
- *
7596
- * @default false
7597
- */
7598
- enabled?: boolean;
7599
- /**
7600
- * How often should we attempt to detect the input file change? (in ms)
7601
- *
7602
- * @default 1000
7603
- */
7604
- interval?: number;
7605
- /**
7606
- * How long will we wait before the request times out?
7607
- *
7608
- * @default 60_000
7609
- */
7610
- timeout?: number;
7611
- };
7612
7624
 
7613
7625
  // DEPRECATED OPTIONS BELOW
7614
7626
 
7615
7627
  /**
7616
- * @deprecated
7617
- *
7618
7628
  * Manually set base in OpenAPI config instead of inferring from server value
7629
+ *
7630
+ * @deprecated
7619
7631
  */
7620
7632
  // eslint-disable-next-line typescript-sort-keys/interface
7621
7633
  base?: string;
7622
7634
  /**
7623
- * @deprecated
7624
- *
7625
7635
  * Opt in to the experimental parser?
7626
7636
  *
7637
+ * @deprecated
7627
7638
  * @default true
7628
7639
  */
7629
7640
  experimentalParser?: boolean;
7630
7641
  /**
7631
- * @deprecated
7632
- *
7633
7642
  * Generate core client classes?
7634
7643
  *
7644
+ * @deprecated
7635
7645
  * @default true
7636
7646
  */
7637
7647
  exportCore?: boolean;
7638
7648
  /**
7639
- * @deprecated
7640
- *
7641
7649
  * Custom client class name. Please note this option is deprecated and
7642
7650
  * will be removed in favor of clients.
7643
7651
  *
7652
+ * @deprecated
7644
7653
  * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name
7645
7654
  */
7646
7655
  name?: string;
7647
7656
  /**
7648
- * @deprecated
7649
- *
7650
7657
  * Path to custom request file. Please note this option is deprecated and
7651
7658
  * will be removed in favor of clients.
7652
7659
  *
7660
+ * @deprecated
7653
7661
  * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-request
7654
7662
  */
7655
7663
  request?: string;
7656
7664
  /**
7657
- * @deprecated
7658
- *
7659
7665
  * Use options or arguments functions. Please note this option is deprecated and
7660
7666
  * will be removed in favor of clients.
7661
7667
  *
7662
- * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-useoptions
7663
- *
7668
+ * @deprecated
7664
7669
  * @default true
7670
+ * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-useoptions
7665
7671
  */
7666
7672
  useOptions?: boolean;
7673
+ /**
7674
+ * @deprecated use `input.watch` instead
7675
+ */
7676
+ watch?: boolean | number | Watch;
7667
7677
  }
7668
7678
 
7669
7679
  type Config = Omit<
@@ -7678,7 +7688,10 @@ type Config = Omit<
7678
7688
  | 'watch'
7679
7689
  > &
7680
7690
  Pick<UserConfig, 'base' | 'name' | 'request'> & {
7681
- input: Omit<Input, 'path'> & Pick<Required<Input>, 'path'>;
7691
+ input: Omit<Input, 'path' | 'validate_EXPERIMENTAL' | 'watch'> &
7692
+ Pick<Required<Input>, 'path' | 'validate_EXPERIMENTAL'> & {
7693
+ watch: Extract<Required<Required<Input>['watch']>, object>;
7694
+ };
7682
7695
  logs: Extract<Required<UserConfig['logs']>, object>;
7683
7696
  output: Extract<UserConfig['output'], object>;
7684
7697
  pluginOrder: ReadonlyArray<ClientPlugins['name']>;
@@ -7686,7 +7699,6 @@ type Config = Omit<
7686
7699
  ExtractArrayOfObjects<ReadonlyArray<ClientPlugins>, { name: string }>,
7687
7700
  'name'
7688
7701
  >;
7689
- watch: Extract<Required<UserConfig['watch']>, object>;
7690
7702
  };
7691
7703
 
7692
7704
  interface Identifier {
@@ -7699,30 +7711,44 @@ interface Identifier {
7699
7711
  */
7700
7712
  name: string | false;
7701
7713
  }
7702
- type Namespace = Record<string, Pick<Identifier, 'name'> & {
7714
+ type NamespaceEntry = Pick<Identifier, 'name'> & {
7703
7715
  /**
7704
7716
  * Ref to the type in OpenAPI specification.
7705
7717
  */
7706
7718
  $ref: string;
7707
- }>;
7708
- 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>;
7709
7732
  /**
7710
7733
  * Type namespace. Types, interfaces, and type aliases exist here.
7734
+ *
7711
7735
  * @example
7712
7736
  * ```ts
7713
7737
  * export type Foo = string;
7714
7738
  * ```
7715
7739
  */
7716
- type: Namespace;
7740
+ type?: Record<string, NamespaceEntry>;
7717
7741
  /**
7718
7742
  * Value namespace. Variables, functions, classes, and constants exist here.
7743
+ *
7719
7744
  * @example
7720
7745
  * ```js
7721
7746
  * export const foo = '';
7722
7747
  * ```
7723
7748
  */
7724
- value: Namespace;
7725
- }
7749
+ value?: Record<string, NamespaceEntry>;
7750
+ }>;
7751
+ type Namespace = keyof Identifiers[keyof Identifiers];
7726
7752
  type FileImportResult = Pick<ImportExportItemObject, 'asType' | 'name'>;
7727
7753
  declare class TypeScriptFile {
7728
7754
  /**
@@ -7736,7 +7762,7 @@ declare class TypeScriptFile {
7736
7762
  private _items;
7737
7763
  private _name;
7738
7764
  private _path;
7739
- namespaces: Namespaces;
7765
+ identifiers: Identifiers;
7740
7766
  /**
7741
7767
  * Path relative to the client output root.
7742
7768
  */
@@ -7763,12 +7789,12 @@ declare class TypeScriptFile {
7763
7789
  * we want to avoid attempting to create since we know it won't happen.
7764
7790
  */
7765
7791
  blockIdentifier({ $ref, namespace, }: Pick<EnsureUniqueIdentifierData, '$ref'> & {
7766
- namespace: keyof Namespaces;
7792
+ namespace: Namespace;
7767
7793
  }): Identifier;
7768
7794
  get exportFromIndex(): boolean;
7769
7795
  get id(): string;
7770
- identifier({ namespace, ...args }: Omit<EnsureUniqueIdentifierData, 'case' | 'namespace'> & {
7771
- namespace: keyof Namespaces;
7796
+ identifier(args: Pick<EnsureUniqueIdentifierData, '$ref' | 'count' | 'create' | 'nameTransformer'> & {
7797
+ namespace: Namespace;
7772
7798
  }): Identifier;
7773
7799
  /**
7774
7800
  * Adds an import to the provided module. Handles duplication, returns added
@@ -7798,6 +7824,7 @@ interface EnsureUniqueIdentifierData {
7798
7824
  case: StringCase | undefined;
7799
7825
  count?: number;
7800
7826
  create?: boolean;
7827
+ identifiers: Identifiers;
7801
7828
  /**
7802
7829
  * Transforms name obtained from `$ref` before it's passed to `stringCase()`.
7803
7830
  */