@hey-api/openapi-ts 0.80.1 → 0.80.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.
- package/README.md +8 -0
- package/dist/chunk-K4TMWMUE.js +39 -0
- package/dist/chunk-K4TMWMUE.js.map +1 -0
- package/dist/clients/axios/client.ts +10 -4
- package/dist/clients/axios/types.ts +3 -3
- package/dist/index.cjs +53 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +503 -200
- package/dist/index.d.ts +503 -200
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +9 -9
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/{types.d-CXdSuWix.d.cts → types.d-CCdoSF-L.d.cts} +31 -20
- package/dist/{types.d-CXdSuWix.d.ts → types.d-CCdoSF-L.d.ts} +31 -20
- package/package.json +1 -1
- package/dist/chunk-RLV6NJ5Q.js +0 -39
- package/dist/chunk-RLV6NJ5Q.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AxiosError, RawAxiosRequestHeaders } from 'axios';
|
|
1
|
+
import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
|
|
4
4
|
import type { Client, Config } from './types';
|
|
@@ -13,9 +13,15 @@ import {
|
|
|
13
13
|
export const createClient = (config: Config = {}): Client => {
|
|
14
14
|
let _config = mergeConfigs(createConfig(), config);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let instance: AxiosInstance;
|
|
17
|
+
|
|
18
|
+
if (_config.axios && !('Axios' in _config.axios)) {
|
|
19
|
+
instance = _config.axios;
|
|
20
|
+
} else {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
+
const { auth, ...configWithoutAuth } = _config;
|
|
23
|
+
instance = axios.create(configWithoutAuth);
|
|
24
|
+
}
|
|
19
25
|
|
|
20
26
|
const getConfig = (): Config => ({ ..._config });
|
|
21
27
|
|
|
@@ -17,12 +17,12 @@ export interface Config<T extends ClientOptions = ClientOptions>
|
|
|
17
17
|
extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
|
|
18
18
|
CoreConfig {
|
|
19
19
|
/**
|
|
20
|
-
* Axios implementation. You can use this option to provide
|
|
21
|
-
*
|
|
20
|
+
* Axios implementation. You can use this option to provide either an
|
|
21
|
+
* `AxiosStatic` or an `AxiosInstance`.
|
|
22
22
|
*
|
|
23
23
|
* @default axios
|
|
24
24
|
*/
|
|
25
|
-
axios?: AxiosStatic;
|
|
25
|
+
axios?: AxiosStatic | AxiosInstance;
|
|
26
26
|
/**
|
|
27
27
|
* Base URL for all requests made by this client.
|
|
28
28
|
*/
|