@1szx1/vite-plugin-swagger2ts 1.3.5 → 1.3.6

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,16 +1,15 @@
1
- import * as axios from 'axios';
2
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
1
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
3
2
  import * as luch_request from 'luch-request';
4
3
  import luch_request__default, { HttpRequestConfig } from 'luch-request';
5
4
 
6
5
  type Get<T, K> = T[K & keyof T];
7
6
 
8
- declare function axiosAdapter<T>(httpInstance: AxiosInstance): {
7
+ declare function axiosAdapter<T, AxiosRes = true>(httpInstance: AxiosInstance): {
9
8
  request: <U extends string & keyof T, M extends string & keyof T[U]>(url: U, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (AxiosRequestConfig<any> & {
10
9
  data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
11
10
  params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
12
11
  path?: Get<T[U][M]["param" & keyof T[U][M]], "path"> | undefined;
13
- }) | undefined) => Promise<axios.AxiosResponse<T[U][M]["response" & keyof T[U][M]], any>>;
12
+ }) | undefined) => Promise<AxiosRes extends true ? AxiosResponse<T[U][M]["response" & keyof T[U][M]], any> : T[U][M]["response" & keyof T[U][M]]>;
14
13
  };
15
14
 
16
15
  declare function LuchAdapter<T extends Record<string, any>, C extends HttpRequestConfig = HttpRequestConfig>(httpInstance: luch_request__default): {
@@ -1,16 +1,15 @@
1
- import * as axios from 'axios';
2
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
1
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
3
2
  import * as luch_request from 'luch-request';
4
3
  import luch_request__default, { HttpRequestConfig } from 'luch-request';
5
4
 
6
5
  type Get<T, K> = T[K & keyof T];
7
6
 
8
- declare function axiosAdapter<T>(httpInstance: AxiosInstance): {
7
+ declare function axiosAdapter<T, AxiosRes = true>(httpInstance: AxiosInstance): {
9
8
  request: <U extends string & keyof T, M extends string & keyof T[U]>(url: U, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (AxiosRequestConfig<any> & {
10
9
  data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
11
10
  params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
12
11
  path?: Get<T[U][M]["param" & keyof T[U][M]], "path"> | undefined;
13
- }) | undefined) => Promise<axios.AxiosResponse<T[U][M]["response" & keyof T[U][M]], any>>;
12
+ }) | undefined) => Promise<AxiosRes extends true ? AxiosResponse<T[U][M]["response" & keyof T[U][M]], any> : T[U][M]["response" & keyof T[U][M]]>;
14
13
  };
15
14
 
16
15
  declare function LuchAdapter<T extends Record<string, any>, C extends HttpRequestConfig = HttpRequestConfig>(httpInstance: luch_request__default): {
@@ -1,16 +1,15 @@
1
- import * as axios from 'axios';
2
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
1
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
3
2
  import * as luch_request from 'luch-request';
4
3
  import luch_request__default, { HttpRequestConfig } from 'luch-request';
5
4
 
6
5
  type Get<T, K> = T[K & keyof T];
7
6
 
8
- declare function axiosAdapter<T>(httpInstance: AxiosInstance): {
7
+ declare function axiosAdapter<T, AxiosRes = true>(httpInstance: AxiosInstance): {
9
8
  request: <U extends string & keyof T, M extends string & keyof T[U]>(url: U, method: M, param?: Get<T[U][M]["param" & keyof T[U][M]], M extends "get" ? "query" : "body"> | undefined, config?: (AxiosRequestConfig<any> & {
10
9
  data?: Get<T[U][M]["param" & keyof T[U][M]], "body"> | undefined;
11
10
  params?: Get<T[U][M]["param" & keyof T[U][M]], "query"> | undefined;
12
11
  path?: Get<T[U][M]["param" & keyof T[U][M]], "path"> | undefined;
13
- }) | undefined) => Promise<axios.AxiosResponse<T[U][M]["response" & keyof T[U][M]], any>>;
12
+ }) | undefined) => Promise<AxiosRes extends true ? AxiosResponse<T[U][M]["response" & keyof T[U][M]], any> : T[U][M]["response" & keyof T[U][M]]>;
14
13
  };
15
14
 
16
15
  declare function LuchAdapter<T extends Record<string, any>, C extends HttpRequestConfig = HttpRequestConfig>(httpInstance: luch_request__default): {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@1szx1/vite-plugin-swagger2ts",
3
3
  "description": "forked from https://github.com/morelearn1990/vite-plugin-swagger2ts",
4
- "version": "1.3.5",
4
+ "version": "1.3.6",
5
5
  "license": "MIT",
6
6
  "author": "1SZX1 <2414126198@qq.com>",
7
7
  "repository": {