axios-annotations 2.2.0 → 3.0.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/LICENSE +21 -21
- package/README.md +977 -944
- package/es/core/builder.d.ts +33 -0
- package/es/core/builder.js +515 -0
- package/es/core/common.d.ts +36 -0
- package/es/core/common.js +148 -0
- package/es/core/config.d.ts +60 -0
- package/es/core/config.js +357 -0
- package/es/core/core-expect.js +3 -0
- package/es/core/expect.d.ts +2 -0
- package/es/core/expect.js +2 -0
- package/es/core/provider.d.ts +6 -0
- package/es/core/provider.js +172 -0
- package/es/core/service.d.ts +5 -0
- package/es/core/service.js +56 -0
- package/es/decorator/path-variables.d.ts +7 -0
- package/es/decorator/path-variables.js +32 -0
- package/es/decorator/request-body.d.ts +7 -0
- package/es/decorator/request-body.js +31 -0
- package/es/decorator/request-config.d.ts +7 -0
- package/es/decorator/request-config.js +25 -0
- package/es/decorator/request-header.d.ts +4 -0
- package/es/decorator/request-header.js +14 -0
- package/es/decorator/request-mapping.d.ts +6 -0
- package/es/decorator/request-mapping.js +56 -0
- package/es/decorator/request-param.d.ts +4 -0
- package/es/decorator/request-param.js +15 -0
- package/es/decorator/request-with.d.ts +3 -0
- package/es/decorator/request-with.js +8 -0
- package/es/index.d.ts +13 -0
- package/es/index.js +14 -0
- package/es/plugins/auth/authorizer.d.ts +24 -0
- package/es/plugins/auth/authorizer.js +268 -0
- package/es/plugins/auth/history.d.ts +15 -0
- package/es/plugins/auth/history.js +94 -0
- package/es/plugins/auth/index.d.ts +16 -0
- package/es/plugins/auth/index.js +358 -0
- package/es/plugins/auth/queue.d.ts +29 -0
- package/es/plugins/auth/queue.js +281 -0
- package/es/plugins/auth/storage.d.ts +6 -0
- package/es/plugins/auth/storage.js +203 -0
- package/lib/core/builder.d.ts +33 -0
- package/lib/core/builder.js +520 -0
- package/lib/core/common.d.ts +34 -4
- package/lib/core/common.js +139 -147
- package/lib/core/config.d.ts +15 -15
- package/lib/core/config.js +44 -14
- package/lib/core/core-expect.js +8 -0
- package/lib/core/expect.d.ts +2 -4
- package/lib/core/expect.js +2 -11
- package/lib/core/provider.d.ts +5 -5
- package/lib/core/provider.js +2 -2
- package/lib/core/service.d.ts +3 -151
- package/lib/core/service.js +42 -544
- package/lib/decorator/path-variables.d.ts +7 -0
- package/lib/decorator/path-variables.js +37 -0
- package/lib/decorator/request-body.d.ts +7 -1
- package/lib/decorator/request-body.js +28 -20
- package/lib/decorator/request-config.d.ts +6 -4
- package/lib/decorator/request-config.js +23 -16
- package/lib/decorator/request-header.d.ts +4 -2
- package/lib/decorator/request-header.js +11 -13
- package/lib/decorator/request-mapping.d.ts +6 -3
- package/lib/decorator/request-mapping.js +46 -43
- package/lib/decorator/request-param.d.ts +4 -1
- package/lib/decorator/request-param.js +12 -19
- package/lib/decorator/request-with.d.ts +3 -1
- package/lib/decorator/request-with.js +6 -13
- package/lib/index.d.ts +4 -11
- package/lib/index.js +19 -68
- package/lib/plugins/auth/authorizer.d.ts +6 -5
- package/lib/plugins/auth/authorizer.js +3 -2
- package/lib/plugins/auth/history.d.ts +5 -4
- package/lib/plugins/auth/history.js +2 -0
- package/lib/plugins/auth/index.d.ts +7 -0
- package/lib/plugins/auth/index.js +11 -3
- package/lib/plugins/auth/queue.d.ts +3 -2
- package/lib/plugins/auth/queue.js +40 -25
- package/lib/plugins/auth/storage.js +2 -2
- package/package.json +51 -16
- package/wechat-mp/core/builder.d.ts +33 -0
- package/wechat-mp/core/builder.js +520 -0
- package/wechat-mp/core/common.d.ts +36 -0
- package/wechat-mp/core/common.js +158 -0
- package/wechat-mp/core/config.d.ts +60 -0
- package/wechat-mp/core/config.js +362 -0
- package/wechat-mp/core/core-expect.js +8 -0
- package/wechat-mp/core/expect.d.ts +2 -0
- package/wechat-mp/core/expect.js +6 -0
- package/wechat-mp/core/provider.d.ts +6 -0
- package/wechat-mp/core/provider.js +178 -0
- package/wechat-mp/core/service.d.ts +5 -0
- package/wechat-mp/core/service.js +60 -0
- package/wechat-mp/decorator/path-variables.d.ts +7 -0
- package/wechat-mp/decorator/path-variables.js +37 -0
- package/wechat-mp/decorator/request-body.d.ts +7 -0
- package/wechat-mp/decorator/request-body.js +36 -0
- package/wechat-mp/decorator/request-config.d.ts +7 -0
- package/wechat-mp/decorator/request-config.js +30 -0
- package/wechat-mp/decorator/request-header.d.ts +4 -0
- package/wechat-mp/decorator/request-header.js +19 -0
- package/wechat-mp/decorator/request-mapping.d.ts +6 -0
- package/wechat-mp/decorator/request-mapping.js +61 -0
- package/wechat-mp/decorator/request-param.d.ts +4 -0
- package/wechat-mp/decorator/request-param.js +20 -0
- package/wechat-mp/decorator/request-with.d.ts +3 -0
- package/wechat-mp/decorator/request-with.js +13 -0
- package/wechat-mp/index.d.ts +13 -0
- package/wechat-mp/index.js +97 -0
- package/wechat-mp/plugins/auth/authorizer.d.ts +24 -0
- package/wechat-mp/plugins/auth/authorizer.js +272 -0
- package/wechat-mp/plugins/auth/history.d.ts +15 -0
- package/wechat-mp/plugins/auth/history.js +98 -0
- package/wechat-mp/plugins/auth/index.d.ts +16 -0
- package/wechat-mp/plugins/auth/index.js +376 -0
- package/wechat-mp/plugins/auth/queue.d.ts +29 -0
- package/wechat-mp/plugins/auth/queue.js +285 -0
- package/wechat-mp/plugins/auth/storage.d.ts +6 -0
- package/wechat-mp/plugins/auth/storage.js +207 -0
- package/index.d.ts +0 -1
- package/index.js +0 -127
- package/lib/core/cancel.d.ts +0 -30
- package/lib/core/cancel.js +0 -56
- package/lib/core/parser.d.ts +0 -19
- package/lib/core/parser.js +0 -79
- package/lib/decorator/abort-source.d.ts +0 -3
- package/lib/decorator/abort-source.js +0 -25
- package/lib/decorator/delete-mapping.d.ts +0 -1
- package/lib/decorator/delete-mapping.js +0 -13
- package/lib/decorator/get-mapping.d.ts +0 -1
- package/lib/decorator/get-mapping.js +0 -13
- package/lib/decorator/ignore-residual-params.d.ts +0 -1
- package/lib/decorator/ignore-residual-params.js +0 -24
- package/lib/decorator/patch-mapping.d.ts +0 -1
- package/lib/decorator/patch-mapping.js +0 -13
- package/lib/decorator/post-mapping.d.ts +0 -1
- package/lib/decorator/post-mapping.js +0 -13
- package/lib/decorator/put-mapping.d.ts +0 -1
- package/lib/decorator/put-mapping.js +0 -13
- package/plugins/auth/index.d.ts +0 -4
- package/plugins/auth/index.js +0 -26
package/lib/core/service.d.ts
CHANGED
|
@@ -1,153 +1,5 @@
|
|
|
1
|
-
import type { AxiosRequestConfig, AxiosResponse, CancelTokenSource } from "axios";
|
|
2
|
-
import AbortControllerAdapter from "./cancel";
|
|
3
|
-
import Config from "./config";
|
|
4
|
-
export type HeaderMappingValueType = string | ((...args: any[]) => string);
|
|
5
|
-
export type AxiosConfigOptionMappingType = keyof AxiosRequestConfig | ((...args: any[]) => (keyof AxiosRequestConfig));
|
|
6
|
-
export type AbortControllerGenerator = ((...args: any[]) => (AbortController | AbortControllerAdapter));
|
|
7
|
-
export type QueryStringEncodeFeatures = {
|
|
8
|
-
ignoreResidualParams?: boolean;
|
|
9
|
-
abortController?: (AbortController | AbortControllerAdapter) | AbortControllerGenerator;
|
|
10
|
-
};
|
|
11
|
-
export type RequestParamEncodeRule = {
|
|
12
|
-
body?: boolean;
|
|
13
|
-
required?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export type NextAbortVersionAxiosRequestConfig = AxiosRequestConfig & {
|
|
16
|
-
signal: AbortSignal;
|
|
17
|
-
};
|
|
18
|
-
export declare const ConfigMapping: {
|
|
19
|
-
requestHeaders(rules: Record<string, HeaderMappingValueType>, args?: any[]): Record<string, string>;
|
|
20
|
-
axiosConfig<D = any>(options: AxiosConfigOptionMappingType[], args: any[]): AxiosRequestConfig<D>;
|
|
21
|
-
querystring(features: QueryStringEncodeFeatures | null, rules: Record<string, RequestParamEncodeRule>, data: Record<string, any>): string;
|
|
22
|
-
/**
|
|
23
|
-
* 从参数对象中提取 body 所属字段
|
|
24
|
-
* @param rules
|
|
25
|
-
* @param data
|
|
26
|
-
*/
|
|
27
|
-
body(rules: Record<string, RequestParamEncodeRule>, data: Record<string, any>): any;
|
|
28
|
-
};
|
|
29
1
|
export default class Service {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_params: Record<string, Record<string, RequestParamEncodeRule>>;
|
|
34
|
-
_configs: Record<string, AxiosConfigOptionMappingType[]>;
|
|
35
|
-
_for: Record<string, string>;
|
|
36
|
-
_features: Record<string, QueryStringEncodeFeatures>;
|
|
37
|
-
constructor(path?: any);
|
|
38
|
-
get config(): Config<import("axios").AxiosStatic, import("axios").AxiosInstance>;
|
|
39
|
-
set config(value: Config<import("axios").AxiosStatic, import("axios").AxiosInstance>);
|
|
40
|
-
get path(): string;
|
|
41
|
-
set path(value: string);
|
|
42
|
-
params(id: string, name: string, config?: RequestParamEncodeRule): void;
|
|
43
|
-
headers(id: string, header: string, value: HeaderMappingValueType): void;
|
|
44
|
-
for(id: string, registrationName?: string): string;
|
|
45
|
-
abort(id: string, abortController: (AbortController | AbortControllerAdapter | AbortControllerGenerator)): void;
|
|
46
|
-
features(id: string, options?: QueryStringEncodeFeatures): QueryStringEncodeFeatures;
|
|
47
|
-
configs(id: string, options: AxiosConfigOptionMappingType): void;
|
|
48
|
-
/**
|
|
49
|
-
* 填充路径占位符 <br/>
|
|
50
|
-
* override this method to custom placeholder replacement <br>
|
|
51
|
-
* default implement: data = { id: 111 }; <br/>
|
|
52
|
-
* "/path/{id}" -> return "/path/111"
|
|
53
|
-
* @param path
|
|
54
|
-
* @param data
|
|
55
|
-
*/
|
|
56
|
-
pathVariable(path: string, data: Record<string, any>): string;
|
|
57
|
-
createRequestConfig(id: string, path: string, data: Record<string, any>, headerArgs?: any[], configArgs?: AxiosConfigOptionMappingType[]): {
|
|
58
|
-
path: string;
|
|
59
|
-
body: any;
|
|
60
|
-
config: AxiosRequestConfig<any>;
|
|
61
|
-
query: string;
|
|
62
|
-
};
|
|
63
|
-
request<T = any, R = AxiosResponse<T>, D = any>(method: string, path: string, data?: Record<string, any>, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
64
|
-
requestWith<T = any, R = AxiosResponse<T>, D = any>(method: string, path?: string): {
|
|
65
|
-
with(registration: string): {
|
|
66
|
-
with(registration: string): any;
|
|
67
|
-
param: (key: string, required?: boolean) => any;
|
|
68
|
-
abort(abortController: ((AbortController & {
|
|
69
|
-
source: CancelTokenSource;
|
|
70
|
-
}) | AbortControllerGenerator)): any;
|
|
71
|
-
ignoreResidualParams(ignore?: boolean): any;
|
|
72
|
-
header: (header: string, value: HeaderMappingValueType) => any;
|
|
73
|
-
body: (key: string) => any;
|
|
74
|
-
config: (cfg: AxiosConfigOptionMappingType) => any;
|
|
75
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
76
|
-
};
|
|
77
|
-
param: (key: string, required?: boolean) => {
|
|
78
|
-
with(registration: string): any;
|
|
79
|
-
param: (key: string, required?: boolean) => any;
|
|
80
|
-
abort(abortController: ((AbortController & {
|
|
81
|
-
source: CancelTokenSource;
|
|
82
|
-
}) | AbortControllerGenerator)): any;
|
|
83
|
-
ignoreResidualParams(ignore?: boolean): any;
|
|
84
|
-
header: (header: string, value: HeaderMappingValueType) => any;
|
|
85
|
-
body: (key: string) => any;
|
|
86
|
-
config: (cfg: AxiosConfigOptionMappingType) => any;
|
|
87
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
88
|
-
};
|
|
89
|
-
abort(abortController: ((AbortController & {
|
|
90
|
-
source: CancelTokenSource;
|
|
91
|
-
}) | AbortControllerGenerator)): {
|
|
92
|
-
with(registration: string): any;
|
|
93
|
-
param: (key: string, required?: boolean) => any;
|
|
94
|
-
abort(abortController: ((AbortController & {
|
|
95
|
-
source: CancelTokenSource;
|
|
96
|
-
}) | AbortControllerGenerator)): any;
|
|
97
|
-
ignoreResidualParams(ignore?: boolean): any;
|
|
98
|
-
header: (header: string, value: HeaderMappingValueType) => any;
|
|
99
|
-
body: (key: string) => any;
|
|
100
|
-
config: (cfg: AxiosConfigOptionMappingType) => any;
|
|
101
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
102
|
-
};
|
|
103
|
-
ignoreResidualParams(ignore?: boolean): {
|
|
104
|
-
with(registration: string): any;
|
|
105
|
-
param: (key: string, required?: boolean) => any;
|
|
106
|
-
abort(abortController: ((AbortController & {
|
|
107
|
-
source: CancelTokenSource;
|
|
108
|
-
}) | AbortControllerGenerator)): any;
|
|
109
|
-
ignoreResidualParams(ignore?: boolean): any;
|
|
110
|
-
header: (header: string, value: HeaderMappingValueType) => any;
|
|
111
|
-
body: (key: string) => any;
|
|
112
|
-
config: (cfg: AxiosConfigOptionMappingType) => any;
|
|
113
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
114
|
-
};
|
|
115
|
-
header: (header: string, value: HeaderMappingValueType) => {
|
|
116
|
-
with(registration: string): any;
|
|
117
|
-
param: (key: string, required?: boolean) => any;
|
|
118
|
-
abort(abortController: ((AbortController & {
|
|
119
|
-
source: CancelTokenSource;
|
|
120
|
-
}) | AbortControllerGenerator)): any;
|
|
121
|
-
ignoreResidualParams(ignore?: boolean): any;
|
|
122
|
-
header: (header: string, value: HeaderMappingValueType) => any;
|
|
123
|
-
body: (key: string) => any;
|
|
124
|
-
config: (cfg: AxiosConfigOptionMappingType) => any;
|
|
125
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
126
|
-
};
|
|
127
|
-
body: (key: string) => {
|
|
128
|
-
with(registration: string): any;
|
|
129
|
-
param: (key: string, required?: boolean) => any;
|
|
130
|
-
abort(abortController: ((AbortController & {
|
|
131
|
-
source: CancelTokenSource;
|
|
132
|
-
}) | AbortControllerGenerator)): any;
|
|
133
|
-
ignoreResidualParams(ignore?: boolean): any;
|
|
134
|
-
header: (header: string, value: HeaderMappingValueType) => any;
|
|
135
|
-
body: (key: string) => any;
|
|
136
|
-
config: (cfg: AxiosConfigOptionMappingType) => any;
|
|
137
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
138
|
-
};
|
|
139
|
-
config: (cfg: AxiosConfigOptionMappingType) => {
|
|
140
|
-
with(registration: string): any;
|
|
141
|
-
param: (key: string, required?: boolean) => any;
|
|
142
|
-
abort(abortController: ((AbortController & {
|
|
143
|
-
source: CancelTokenSource;
|
|
144
|
-
}) | AbortControllerGenerator)): any;
|
|
145
|
-
ignoreResidualParams(ignore?: boolean): any;
|
|
146
|
-
header: (header: string, value: HeaderMappingValueType) => any;
|
|
147
|
-
body: (key: string) => any;
|
|
148
|
-
config: (cfg: AxiosConfigOptionMappingType) => any;
|
|
149
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
150
|
-
};
|
|
151
|
-
send: (data?: Record<string, any>) => (Promise<R>);
|
|
152
|
-
};
|
|
2
|
+
config: import("./config").default;
|
|
3
|
+
path: string;
|
|
4
|
+
constructor();
|
|
153
5
|
}
|