@varlet/axle 0.11.0 → 0.11.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/lib/api.d.cts +2 -2
- package/lib/api.d.ts +2 -2
- package/lib/index.d.cts +2 -2
- package/lib/index.d.ts +2 -2
- package/lib/{instance-ab0b388e.d.ts → instance-857fe07c.d.ts} +4 -3
- package/lib/use.cjs +1 -1
- package/lib/use.d.cts +1 -1
- package/lib/use.d.ts +1 -1
- package/lib/use.js +2 -2
- package/package.json +1 -1
package/lib/api.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseAxleOptions, UseAxle, UseAxleInstance } from './use.cjs';
|
|
2
|
-
import { e as AxleInstance, d as RunnerMethod, A as AxleRequestConfig } from './instance-
|
|
2
|
+
import { e as AxleInstance, d as RunnerMethod, A as AxleRequestConfig } from './instance-857fe07c.js';
|
|
3
3
|
import 'vue';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ type ApiUseOptions<V, R, P, D> = Partial<UseAxleOptions<V, R, P, D>> & {
|
|
|
9
9
|
};
|
|
10
10
|
declare function createApi(axle: AxleInstance, useAxle: UseAxle): <R = any, P = Record<string, any>, D = Record<string, any>>(url: string, method: RunnerMethod) => {
|
|
11
11
|
url: string;
|
|
12
|
-
load: (params?: P | undefined, pathParams?: ApiPathParams, config?: AxleRequestConfig<D
|
|
12
|
+
load: (params?: P | undefined, pathParams?: ApiPathParams, config?: AxleRequestConfig<D, Record<string, any>> | undefined) => Promise<R>;
|
|
13
13
|
use: <V = R>(options?: ApiUseOptions<V, R, P, D>) => UseAxleInstance<V, R, P, D>;
|
|
14
14
|
patchUrl: (url: string, pathParams: ApiPathParams) => string;
|
|
15
15
|
};
|
package/lib/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseAxleOptions, UseAxle, UseAxleInstance } from './use.js';
|
|
2
|
-
import { e as AxleInstance, d as RunnerMethod, A as AxleRequestConfig } from './instance-
|
|
2
|
+
import { e as AxleInstance, d as RunnerMethod, A as AxleRequestConfig } from './instance-857fe07c.js';
|
|
3
3
|
import 'vue';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ type ApiUseOptions<V, R, P, D> = Partial<UseAxleOptions<V, R, P, D>> & {
|
|
|
9
9
|
};
|
|
10
10
|
declare function createApi(axle: AxleInstance, useAxle: UseAxle): <R = any, P = Record<string, any>, D = Record<string, any>>(url: string, method: RunnerMethod) => {
|
|
11
11
|
url: string;
|
|
12
|
-
load: (params?: P | undefined, pathParams?: ApiPathParams, config?: AxleRequestConfig<D
|
|
12
|
+
load: (params?: P | undefined, pathParams?: ApiPathParams, config?: AxleRequestConfig<D, Record<string, any>> | undefined) => Promise<R>;
|
|
13
13
|
use: <V = R>(options?: ApiUseOptions<V, R, P, D>) => UseAxleInstance<V, R, P, D>;
|
|
14
14
|
patchUrl: (url: string, pathParams: ApiPathParams) => string;
|
|
15
15
|
};
|
package/lib/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestInterceptor, a as ResponseInterceptor } from './instance-
|
|
2
|
-
export { e as AxleInstance, A as AxleRequestConfig, b as FetchMethod, F as FetchRunner, I as Interceptor, c as ModifyMethod, M as ModifyRunner, d as RunnerMethod, h as createAxle, f as createFetchRunner, g as createModifyRunner } from './instance-
|
|
1
|
+
import { R as RequestInterceptor, a as ResponseInterceptor } from './instance-857fe07c.js';
|
|
2
|
+
export { e as AxleInstance, A as AxleRequestConfig, b as FetchMethod, F as FetchRunner, I as Interceptor, c as ModifyMethod, M as ModifyRunner, d as RunnerMethod, h as createAxle, f as createFetchRunner, g as createModifyRunner } from './instance-857fe07c.js';
|
|
3
3
|
import { AxiosResponse, AxiosInterceptorOptions, AxiosRequestConfig } from 'axios';
|
|
4
4
|
export { AxiosError, AxiosInstance, AxiosInterceptorOptions, AxiosRequestConfig, AxiosRequestHeaders, AxiosResponse, HeadersDefaults, InternalAxiosRequestConfig, ResponseType, isAxiosError } from 'axios';
|
|
5
5
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequestInterceptor, a as ResponseInterceptor } from './instance-
|
|
2
|
-
export { e as AxleInstance, A as AxleRequestConfig, b as FetchMethod, F as FetchRunner, I as Interceptor, c as ModifyMethod, M as ModifyRunner, d as RunnerMethod, h as createAxle, f as createFetchRunner, g as createModifyRunner } from './instance-
|
|
1
|
+
import { R as RequestInterceptor, a as ResponseInterceptor } from './instance-857fe07c.js';
|
|
2
|
+
export { e as AxleInstance, A as AxleRequestConfig, b as FetchMethod, F as FetchRunner, I as Interceptor, c as ModifyMethod, M as ModifyRunner, d as RunnerMethod, h as createAxle, f as createFetchRunner, g as createModifyRunner } from './instance-857fe07c.js';
|
|
3
3
|
import { AxiosResponse, AxiosInterceptorOptions, AxiosRequestConfig } from 'axios';
|
|
4
4
|
export { AxiosError, AxiosInstance, AxiosInterceptorOptions, AxiosRequestConfig, AxiosRequestHeaders, AxiosResponse, HeadersDefaults, InternalAxiosRequestConfig, ResponseType, isAxiosError } from 'axios';
|
|
5
5
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AxiosRequestConfig, AxiosResponse, AxiosInterceptorOptions, InternalAxiosRequestConfig, HeadersDefaults, AxiosInstance, ResponseType } from 'axios';
|
|
2
2
|
|
|
3
|
-
interface AxleRequestConfig<D = any
|
|
3
|
+
interface AxleRequestConfig<D = any, E = Record<string, any>> extends AxiosRequestConfig<D> {
|
|
4
|
+
extra?: E;
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
type FetchRunner = <R = AxiosResponse, P = Record<string, any>, D = Record<string, any>>(url: string, params?: P, config?: AxleRequestConfig<D>) => Promise<R>;
|
|
@@ -56,8 +57,8 @@ type AxleInstance = {
|
|
|
56
57
|
useResponseInterceptor(...interceptors: ResponseInterceptor[]): void;
|
|
57
58
|
axios: AxiosInstance;
|
|
58
59
|
};
|
|
59
|
-
declare function createFetchRunner(service: AxiosInstance, method: FetchMethod, responseType: ResponseType): <R = AxiosResponse<any, any>, P = Record<string, any>, D = Record<string, any>>(url: string, params?: P | undefined, config?: AxleRequestConfig<D
|
|
60
|
-
declare function createModifyRunner(service: AxiosInstance, method: ModifyMethod, contentType: 'application/json' | 'multipart/form-data' | 'application/x-www-form-urlencoded'): <R = AxiosResponse<any, any>, P = Record<string, any>, D = Record<string, any>>(url: string, params?: P | undefined, config?: AxleRequestConfig<D
|
|
60
|
+
declare function createFetchRunner(service: AxiosInstance, method: FetchMethod, responseType: ResponseType): <R = AxiosResponse<any, any>, P = Record<string, any>, D = Record<string, any>>(url: string, params?: P | undefined, config?: AxleRequestConfig<D, Record<string, any>> | undefined) => Promise<R>;
|
|
61
|
+
declare function createModifyRunner(service: AxiosInstance, method: ModifyMethod, contentType: 'application/json' | 'multipart/form-data' | 'application/x-www-form-urlencoded'): <R = AxiosResponse<any, any>, P = Record<string, any>, D = Record<string, any>>(url: string, params?: P | undefined, config?: AxleRequestConfig<D, Record<string, any>> | undefined) => Promise<R>;
|
|
61
62
|
declare function createAxle(config?: AxleRequestConfig): AxleInstance;
|
|
62
63
|
|
|
63
64
|
export { AxleRequestConfig as A, FetchRunner as F, Interceptor as I, ModifyRunner as M, RequestInterceptor as R, ResponseInterceptor as a, FetchMethod as b, ModifyMethod as c, RunnerMethod as d, AxleInstance as e, createFetchRunner as f, createModifyRunner as g, createAxle as h };
|
package/lib/use.cjs
CHANGED
|
@@ -198,7 +198,7 @@ function createUseAxle(options) {
|
|
|
198
198
|
config: normalizeValueGetter(initialConfigOrGetter)
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
if (abortOnUnmount) {
|
|
201
|
+
if (abortOnUnmount && (0, import_vue4.getCurrentInstance)()) {
|
|
202
202
|
(0, import_vue4.onUnmounted)(() => {
|
|
203
203
|
abort();
|
|
204
204
|
});
|
package/lib/use.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref, WritableComputedRef } from 'vue';
|
|
2
|
-
import { A as AxleRequestConfig, d as RunnerMethod, e as AxleInstance } from './instance-
|
|
2
|
+
import { A as AxleRequestConfig, d as RunnerMethod, e as AxleInstance } from './instance-857fe07c.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
5
|
declare function useValues<T extends Ref<any>[]>(...valueCollection: T): WritableComputedRef<T[number]['value'][]>;
|
package/lib/use.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref, WritableComputedRef } from 'vue';
|
|
2
|
-
import { A as AxleRequestConfig, d as RunnerMethod, e as AxleInstance } from './instance-
|
|
2
|
+
import { A as AxleRequestConfig, d as RunnerMethod, e as AxleInstance } from './instance-857fe07c.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
5
|
declare function useValues<T extends Ref<any>[]>(...valueCollection: T): WritableComputedRef<T[number]['value'][]>;
|
package/lib/use.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-G2ADBYYC.js";
|
|
4
4
|
|
|
5
5
|
// src/use.ts
|
|
6
|
-
import { onUnmounted, ref as ref3 } from "vue";
|
|
6
|
+
import { getCurrentInstance, onUnmounted, ref as ref3 } from "vue";
|
|
7
7
|
import { isFunction } from "rattail";
|
|
8
8
|
|
|
9
9
|
// src/composables/useValues.ts
|
|
@@ -160,7 +160,7 @@ function createUseAxle(options) {
|
|
|
160
160
|
config: normalizeValueGetter(initialConfigOrGetter)
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
if (abortOnUnmount) {
|
|
163
|
+
if (abortOnUnmount && getCurrentInstance()) {
|
|
164
164
|
onUnmounted(() => {
|
|
165
165
|
abort();
|
|
166
166
|
});
|