@hey-api/openapi-ts 0.64.15 → 0.66.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.
package/dist/index.d.cts CHANGED
@@ -6468,7 +6468,7 @@ declare namespace Plugin {
6468
6468
  };
6469
6469
 
6470
6470
  export type DefineConfig<Config extends BaseConfig> = (
6471
- config?: Plugin.UserConfig<Config>,
6471
+ config?: Plugin.UserConfig<Omit<Config, 'name'>>,
6472
6472
  ) => Omit<Plugin.Config<Config>, 'name'> & {
6473
6473
  /**
6474
6474
  * Cast name to `any` so it doesn't throw type error in `plugins` array.
@@ -6538,6 +6538,14 @@ interface Config$i
6538
6538
  extends Plugin.Name<'@hey-api/client-nuxt'>,
6539
6539
  Client.Config {}
6540
6540
 
6541
+ type PluginHandler<ReturnType = void> = Plugin.Handler<
6542
+ Omit<
6543
+ Config$h | Config$k | Config$j | Config$i,
6544
+ 'name'
6545
+ >,
6546
+ ReturnType
6547
+ >;
6548
+
6541
6549
  /**
6542
6550
  * Public Client API.
6543
6551
  */
@@ -6567,6 +6575,16 @@ declare namespace Client {
6567
6575
  * @default false
6568
6576
  */
6569
6577
  bundle?: boolean;
6578
+ /**
6579
+ * **This is an experimental feature.**
6580
+ *
6581
+ * When `bundle` is set to `true`, you can optionally set this option
6582
+ * to `true` to bundle the client source code instead of the `dist` folder.
6583
+ * This will copy the TypeScript files instead of CJS/ESM JavaScript files.
6584
+ *
6585
+ * @default false
6586
+ */
6587
+ bundleSource_EXPERIMENTAL?: boolean;
6570
6588
  /**
6571
6589
  * Should the exports from the generated files be re-exported in the index
6572
6590
  * barrel file?
@@ -6715,18 +6733,6 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
6715
6733
  * @default true
6716
6734
  */
6717
6735
  exportFromIndex?: boolean;
6718
- /**
6719
- * @deprecated
6720
- *
6721
- * **This feature works only with the legacy parser**
6722
- *
6723
- * Filter endpoints to be included in the generated SDK. The provided
6724
- * string should be a regular expression where matched results will be
6725
- * included in the output. The input pattern this string will be tested
6726
- * against is `{method} {path}`. For example, you can match
6727
- * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
6728
- */
6729
- filter?: string;
6730
6736
  /**
6731
6737
  * Include only service classes with names matching regular expression
6732
6738
  *
@@ -6750,14 +6756,6 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
6750
6756
  * @default 'sdk'
6751
6757
  */
6752
6758
  output?: string;
6753
- /**
6754
- * @deprecated
6755
- *
6756
- * Define shape of returned value from service calls
6757
- *
6758
- * @default 'body'
6759
- */
6760
- response?: 'body' | 'response';
6761
6759
  /**
6762
6760
  * Customize the generated service class names. The name variable is
6763
6761
  * obtained from your OpenAPI specification tags.
@@ -6793,6 +6791,30 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
6793
6791
  * @default false
6794
6792
  */
6795
6793
  validator?: PluginValidatorNames | boolean;
6794
+
6795
+ // DEPRECATED OPTIONS BELOW
6796
+
6797
+ /**
6798
+ * @deprecated
6799
+ *
6800
+ * **This feature works only with the legacy parser**
6801
+ *
6802
+ * Filter endpoints to be included in the generated SDK. The provided
6803
+ * string should be a regular expression where matched results will be
6804
+ * included in the output. The input pattern this string will be tested
6805
+ * against is `{method} {path}`. For example, you can match
6806
+ * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
6807
+ */
6808
+ // eslint-disable-next-line typescript-sort-keys/interface
6809
+ filter?: string;
6810
+ /**
6811
+ * @deprecated
6812
+ *
6813
+ * Define shape of returned value from service calls
6814
+ *
6815
+ * @default 'body'
6816
+ */
6817
+ response?: 'body' | 'response';
6796
6818
  }
6797
6819
 
6798
6820
  interface Config$9 extends Plugin.Name<'@hey-api/transformers'> {
@@ -6861,6 +6883,37 @@ interface Config$8 extends Plugin.Name<'@hey-api/typescript'> {
6861
6883
  * @default 'PascalCase'
6862
6884
  */
6863
6885
  identifierCase?: Exclude<StringCase, 'SCREAMING_SNAKE_CASE'>;
6886
+ /**
6887
+ * Name of the generated file.
6888
+ *
6889
+ * @default 'types'
6890
+ */
6891
+ output?: string;
6892
+ /**
6893
+ * Choose how to handle types containing read-only or write-only fields?
6894
+ * This option exists for backward compatibility with outputs created before
6895
+ * this feature existed.
6896
+ *
6897
+ * @default 'split'
6898
+ */
6899
+ readOnlyWriteOnlyBehavior?: 'off' | 'split';
6900
+ /**
6901
+ * Customize the name of types used in responses or containing read-only
6902
+ * fields.
6903
+ *
6904
+ * @default '{{name}}Readable'
6905
+ */
6906
+ readableNameBuilder?: string;
6907
+ /**
6908
+ * Customize the name of types used in payloads or containing write-only
6909
+ * fields.
6910
+ *
6911
+ * @default '{{name}}Writable'
6912
+ */
6913
+ writableNameBuilder?: string;
6914
+
6915
+ // DEPRECATED OPTIONS BELOW
6916
+
6864
6917
  /**
6865
6918
  * @deprecated
6866
6919
  *
@@ -6868,13 +6921,8 @@ interface Config$8 extends Plugin.Name<'@hey-api/typescript'> {
6868
6921
  *
6869
6922
  * Include only types matching regular expression.
6870
6923
  */
6924
+ // eslint-disable-next-line typescript-sort-keys/interface
6871
6925
  include?: string;
6872
- /**
6873
- * Name of the generated file.
6874
- *
6875
- * @default 'types'
6876
- */
6877
- output?: string;
6878
6926
  /**
6879
6927
  * @deprecated
6880
6928
  *
@@ -7160,6 +7208,11 @@ interface Input {
7160
7208
  * schema: '^#/components/schemas/Foo$'
7161
7209
  */
7162
7210
  exclude?: string;
7211
+ /**
7212
+ * You pass any valid Fetch API options to the request for fetching your
7213
+ * specification. This is useful if your file is behind auth for example.
7214
+ */
7215
+ fetch?: RequestInit;
7163
7216
  /**
7164
7217
  * Process only parts matching the regular expression. You can select both
7165
7218
  * operations and components by reference within the bundled input. In
@@ -7244,7 +7297,7 @@ interface UserConfig {
7244
7297
  input:
7245
7298
  | 'https://get.heyapi.dev/<organization>/<project>'
7246
7299
  | (string & {})
7247
- | Record<string, unknown>
7300
+ | (Record<string, unknown> & { path?: never })
7248
7301
  | Input;
7249
7302
  /**
7250
7303
  * The relative location of the logs folder
@@ -7254,6 +7307,12 @@ interface UserConfig {
7254
7307
  logs?:
7255
7308
  | string
7256
7309
  | {
7310
+ /**
7311
+ * Whether or not error logs should be written to a file or not
7312
+ *
7313
+ * @default true
7314
+ * */
7315
+ file?: boolean;
7257
7316
  /**
7258
7317
  * The logging level to control the verbosity of log output.
7259
7318
  * Determines which messages are logged based on their severity.
@@ -7279,6 +7338,7 @@ interface UserConfig {
7279
7338
  | 'silent'
7280
7339
  | 'trace'
7281
7340
  | 'warn';
7341
+
7282
7342
  /**
7283
7343
  * The relative location of the logs folder
7284
7344
  *
@@ -7370,6 +7430,9 @@ interface UserConfig {
7370
7430
  */
7371
7431
  timeout?: number;
7372
7432
  };
7433
+
7434
+ // DEPRECATED OPTIONS BELOW
7435
+
7373
7436
  /**
7374
7437
  * @deprecated
7375
7438
  *
@@ -7795,9 +7858,16 @@ interface IRSchemaObject
7795
7858
  > {
7796
7859
  /**
7797
7860
  * If the schema is intended to be used as an object property, it can be
7798
- * marked as read-only or write-only.
7861
+ * marked as read-only or write-only. This value controls whether the schema
7862
+ * receives the "readonly" TypeScript keyword.
7799
7863
  */
7800
7864
  accessScope?: 'read' | 'write';
7865
+ /**
7866
+ * Similar to `accessScope`, but tells us whether the schema as a whole
7867
+ * contains any read-only or write-only fields. This value controls whether
7868
+ * we split the schema into individual schemas for payloads and responses.
7869
+ */
7870
+ accessScopes?: ReadonlyArray<'read' | 'write'>;
7801
7871
  /**
7802
7872
  * If type is `object`, `additionalProperties` can be used to either define
7803
7873
  * a schema for properties not included in `properties` or disallow such
@@ -7875,6 +7945,17 @@ declare namespace IR {
7875
7945
  */
7876
7946
  declare const defaultPlugins: readonly ["@hey-api/typescript", "@hey-api/sdk"];
7877
7947
 
7948
+ declare const clientDefaultConfig: {
7949
+ readonly _dependencies: readonly ["@hey-api/typescript"];
7950
+ readonly _tags: readonly ["client"];
7951
+ readonly baseUrl: true;
7952
+ readonly bundle: false;
7953
+ readonly exportFromIndex: false;
7954
+ readonly output: "client";
7955
+ };
7956
+
7957
+ declare const clientPluginHandler: PluginHandler;
7958
+
7878
7959
  declare namespace LegacyIR {
7879
7960
  export type LegacyOperation = Operation;
7880
7961
  }
@@ -7899,4 +7980,4 @@ declare const createClient: (userConfig?: Configs) => Promise<ReadonlyArray<Clie
7899
7980
  */
7900
7981
  declare const defineConfig: (config: Configs) => Promise<UserConfig>;
7901
7982
 
7902
- export { IR, LegacyIR, OpenApi, Plugin, type UserConfig, createClient, defaultPlugins, defineConfig, utils };
7983
+ export { Client, IR, LegacyIR, OpenApi, Plugin, type UserConfig, clientDefaultConfig, clientPluginHandler, createClient, defaultPlugins, defineConfig, utils };
package/dist/index.d.ts CHANGED
@@ -6468,7 +6468,7 @@ declare namespace Plugin {
6468
6468
  };
6469
6469
 
6470
6470
  export type DefineConfig<Config extends BaseConfig> = (
6471
- config?: Plugin.UserConfig<Config>,
6471
+ config?: Plugin.UserConfig<Omit<Config, 'name'>>,
6472
6472
  ) => Omit<Plugin.Config<Config>, 'name'> & {
6473
6473
  /**
6474
6474
  * Cast name to `any` so it doesn't throw type error in `plugins` array.
@@ -6538,6 +6538,14 @@ interface Config$i
6538
6538
  extends Plugin.Name<'@hey-api/client-nuxt'>,
6539
6539
  Client.Config {}
6540
6540
 
6541
+ type PluginHandler<ReturnType = void> = Plugin.Handler<
6542
+ Omit<
6543
+ Config$h | Config$k | Config$j | Config$i,
6544
+ 'name'
6545
+ >,
6546
+ ReturnType
6547
+ >;
6548
+
6541
6549
  /**
6542
6550
  * Public Client API.
6543
6551
  */
@@ -6567,6 +6575,16 @@ declare namespace Client {
6567
6575
  * @default false
6568
6576
  */
6569
6577
  bundle?: boolean;
6578
+ /**
6579
+ * **This is an experimental feature.**
6580
+ *
6581
+ * When `bundle` is set to `true`, you can optionally set this option
6582
+ * to `true` to bundle the client source code instead of the `dist` folder.
6583
+ * This will copy the TypeScript files instead of CJS/ESM JavaScript files.
6584
+ *
6585
+ * @default false
6586
+ */
6587
+ bundleSource_EXPERIMENTAL?: boolean;
6570
6588
  /**
6571
6589
  * Should the exports from the generated files be re-exported in the index
6572
6590
  * barrel file?
@@ -6715,18 +6733,6 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
6715
6733
  * @default true
6716
6734
  */
6717
6735
  exportFromIndex?: boolean;
6718
- /**
6719
- * @deprecated
6720
- *
6721
- * **This feature works only with the legacy parser**
6722
- *
6723
- * Filter endpoints to be included in the generated SDK. The provided
6724
- * string should be a regular expression where matched results will be
6725
- * included in the output. The input pattern this string will be tested
6726
- * against is `{method} {path}`. For example, you can match
6727
- * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
6728
- */
6729
- filter?: string;
6730
6736
  /**
6731
6737
  * Include only service classes with names matching regular expression
6732
6738
  *
@@ -6750,14 +6756,6 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
6750
6756
  * @default 'sdk'
6751
6757
  */
6752
6758
  output?: string;
6753
- /**
6754
- * @deprecated
6755
- *
6756
- * Define shape of returned value from service calls
6757
- *
6758
- * @default 'body'
6759
- */
6760
- response?: 'body' | 'response';
6761
6759
  /**
6762
6760
  * Customize the generated service class names. The name variable is
6763
6761
  * obtained from your OpenAPI specification tags.
@@ -6793,6 +6791,30 @@ interface Config$a extends Plugin.Name<'@hey-api/sdk'> {
6793
6791
  * @default false
6794
6792
  */
6795
6793
  validator?: PluginValidatorNames | boolean;
6794
+
6795
+ // DEPRECATED OPTIONS BELOW
6796
+
6797
+ /**
6798
+ * @deprecated
6799
+ *
6800
+ * **This feature works only with the legacy parser**
6801
+ *
6802
+ * Filter endpoints to be included in the generated SDK. The provided
6803
+ * string should be a regular expression where matched results will be
6804
+ * included in the output. The input pattern this string will be tested
6805
+ * against is `{method} {path}`. For example, you can match
6806
+ * `POST /api/v1/foo` with `^POST /api/v1/foo$`.
6807
+ */
6808
+ // eslint-disable-next-line typescript-sort-keys/interface
6809
+ filter?: string;
6810
+ /**
6811
+ * @deprecated
6812
+ *
6813
+ * Define shape of returned value from service calls
6814
+ *
6815
+ * @default 'body'
6816
+ */
6817
+ response?: 'body' | 'response';
6796
6818
  }
6797
6819
 
6798
6820
  interface Config$9 extends Plugin.Name<'@hey-api/transformers'> {
@@ -6861,6 +6883,37 @@ interface Config$8 extends Plugin.Name<'@hey-api/typescript'> {
6861
6883
  * @default 'PascalCase'
6862
6884
  */
6863
6885
  identifierCase?: Exclude<StringCase, 'SCREAMING_SNAKE_CASE'>;
6886
+ /**
6887
+ * Name of the generated file.
6888
+ *
6889
+ * @default 'types'
6890
+ */
6891
+ output?: string;
6892
+ /**
6893
+ * Choose how to handle types containing read-only or write-only fields?
6894
+ * This option exists for backward compatibility with outputs created before
6895
+ * this feature existed.
6896
+ *
6897
+ * @default 'split'
6898
+ */
6899
+ readOnlyWriteOnlyBehavior?: 'off' | 'split';
6900
+ /**
6901
+ * Customize the name of types used in responses or containing read-only
6902
+ * fields.
6903
+ *
6904
+ * @default '{{name}}Readable'
6905
+ */
6906
+ readableNameBuilder?: string;
6907
+ /**
6908
+ * Customize the name of types used in payloads or containing write-only
6909
+ * fields.
6910
+ *
6911
+ * @default '{{name}}Writable'
6912
+ */
6913
+ writableNameBuilder?: string;
6914
+
6915
+ // DEPRECATED OPTIONS BELOW
6916
+
6864
6917
  /**
6865
6918
  * @deprecated
6866
6919
  *
@@ -6868,13 +6921,8 @@ interface Config$8 extends Plugin.Name<'@hey-api/typescript'> {
6868
6921
  *
6869
6922
  * Include only types matching regular expression.
6870
6923
  */
6924
+ // eslint-disable-next-line typescript-sort-keys/interface
6871
6925
  include?: string;
6872
- /**
6873
- * Name of the generated file.
6874
- *
6875
- * @default 'types'
6876
- */
6877
- output?: string;
6878
6926
  /**
6879
6927
  * @deprecated
6880
6928
  *
@@ -7160,6 +7208,11 @@ interface Input {
7160
7208
  * schema: '^#/components/schemas/Foo$'
7161
7209
  */
7162
7210
  exclude?: string;
7211
+ /**
7212
+ * You pass any valid Fetch API options to the request for fetching your
7213
+ * specification. This is useful if your file is behind auth for example.
7214
+ */
7215
+ fetch?: RequestInit;
7163
7216
  /**
7164
7217
  * Process only parts matching the regular expression. You can select both
7165
7218
  * operations and components by reference within the bundled input. In
@@ -7244,7 +7297,7 @@ interface UserConfig {
7244
7297
  input:
7245
7298
  | 'https://get.heyapi.dev/<organization>/<project>'
7246
7299
  | (string & {})
7247
- | Record<string, unknown>
7300
+ | (Record<string, unknown> & { path?: never })
7248
7301
  | Input;
7249
7302
  /**
7250
7303
  * The relative location of the logs folder
@@ -7254,6 +7307,12 @@ interface UserConfig {
7254
7307
  logs?:
7255
7308
  | string
7256
7309
  | {
7310
+ /**
7311
+ * Whether or not error logs should be written to a file or not
7312
+ *
7313
+ * @default true
7314
+ * */
7315
+ file?: boolean;
7257
7316
  /**
7258
7317
  * The logging level to control the verbosity of log output.
7259
7318
  * Determines which messages are logged based on their severity.
@@ -7279,6 +7338,7 @@ interface UserConfig {
7279
7338
  | 'silent'
7280
7339
  | 'trace'
7281
7340
  | 'warn';
7341
+
7282
7342
  /**
7283
7343
  * The relative location of the logs folder
7284
7344
  *
@@ -7370,6 +7430,9 @@ interface UserConfig {
7370
7430
  */
7371
7431
  timeout?: number;
7372
7432
  };
7433
+
7434
+ // DEPRECATED OPTIONS BELOW
7435
+
7373
7436
  /**
7374
7437
  * @deprecated
7375
7438
  *
@@ -7795,9 +7858,16 @@ interface IRSchemaObject
7795
7858
  > {
7796
7859
  /**
7797
7860
  * If the schema is intended to be used as an object property, it can be
7798
- * marked as read-only or write-only.
7861
+ * marked as read-only or write-only. This value controls whether the schema
7862
+ * receives the "readonly" TypeScript keyword.
7799
7863
  */
7800
7864
  accessScope?: 'read' | 'write';
7865
+ /**
7866
+ * Similar to `accessScope`, but tells us whether the schema as a whole
7867
+ * contains any read-only or write-only fields. This value controls whether
7868
+ * we split the schema into individual schemas for payloads and responses.
7869
+ */
7870
+ accessScopes?: ReadonlyArray<'read' | 'write'>;
7801
7871
  /**
7802
7872
  * If type is `object`, `additionalProperties` can be used to either define
7803
7873
  * a schema for properties not included in `properties` or disallow such
@@ -7875,6 +7945,17 @@ declare namespace IR {
7875
7945
  */
7876
7946
  declare const defaultPlugins: readonly ["@hey-api/typescript", "@hey-api/sdk"];
7877
7947
 
7948
+ declare const clientDefaultConfig: {
7949
+ readonly _dependencies: readonly ["@hey-api/typescript"];
7950
+ readonly _tags: readonly ["client"];
7951
+ readonly baseUrl: true;
7952
+ readonly bundle: false;
7953
+ readonly exportFromIndex: false;
7954
+ readonly output: "client";
7955
+ };
7956
+
7957
+ declare const clientPluginHandler: PluginHandler;
7958
+
7878
7959
  declare namespace LegacyIR {
7879
7960
  export type LegacyOperation = Operation;
7880
7961
  }
@@ -7899,4 +7980,4 @@ declare const createClient: (userConfig?: Configs) => Promise<ReadonlyArray<Clie
7899
7980
  */
7900
7981
  declare const defineConfig: (config: Configs) => Promise<UserConfig>;
7901
7982
 
7902
- export { IR, LegacyIR, OpenApi, Plugin, type UserConfig, createClient, defaultPlugins, defineConfig, utils };
7983
+ export { Client, IR, LegacyIR, OpenApi, Plugin, type UserConfig, clientDefaultConfig, clientPluginHandler, createClient, defaultPlugins, defineConfig, utils };