axios-annotations 2.3.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/README.md +774 -741
- 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 +6 -15
- 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 +31 -24
- package/lib/plugins/auth/storage.js +2 -2
- package/package.json +42 -7
- 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
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (void 0) && (void 0).__awaiter || function(thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) {
|
|
4
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
5
|
+
resolve(value);
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function rejected(value) {
|
|
17
|
+
try {
|
|
18
|
+
step(generator["throw"](value));
|
|
19
|
+
} catch (e) {
|
|
20
|
+
reject(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function step(result) {
|
|
24
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
25
|
+
}
|
|
26
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
var __generator = (void 0) && (void 0).__generator || function(thisArg, body) {
|
|
30
|
+
var _ = {
|
|
31
|
+
label: 0,
|
|
32
|
+
sent: function sent() {
|
|
33
|
+
if (t[0] & 1) throw t[1];
|
|
34
|
+
return t[1];
|
|
35
|
+
},
|
|
36
|
+
trys: [],
|
|
37
|
+
ops: []
|
|
38
|
+
}, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
39
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
40
|
+
return this;
|
|
41
|
+
}), g;
|
|
42
|
+
function verb(n) {
|
|
43
|
+
return function(v) {
|
|
44
|
+
return step([
|
|
45
|
+
n,
|
|
46
|
+
v
|
|
47
|
+
]);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function step(op) {
|
|
51
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
52
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
53
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
54
|
+
if (y = 0, t) op = [
|
|
55
|
+
op[0] & 2,
|
|
56
|
+
t.value
|
|
57
|
+
];
|
|
58
|
+
switch(op[0]){
|
|
59
|
+
case 0:
|
|
60
|
+
case 1:
|
|
61
|
+
t = op;
|
|
62
|
+
break;
|
|
63
|
+
case 4:
|
|
64
|
+
_.label++;
|
|
65
|
+
return {
|
|
66
|
+
value: op[1],
|
|
67
|
+
done: false
|
|
68
|
+
};
|
|
69
|
+
case 5:
|
|
70
|
+
_.label++;
|
|
71
|
+
y = op[1];
|
|
72
|
+
op = [
|
|
73
|
+
0
|
|
74
|
+
];
|
|
75
|
+
continue;
|
|
76
|
+
case 7:
|
|
77
|
+
op = _.ops.pop();
|
|
78
|
+
_.trys.pop();
|
|
79
|
+
continue;
|
|
80
|
+
default:
|
|
81
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
82
|
+
_ = 0;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
86
|
+
_.label = op[1];
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
90
|
+
_.label = t[1];
|
|
91
|
+
t = op;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (t && _.label < t[2]) {
|
|
95
|
+
_.label = t[2];
|
|
96
|
+
_.ops.push(op);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t[2]) _.ops.pop();
|
|
100
|
+
_.trys.pop();
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
op = body.call(thisArg, _);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
op = [
|
|
106
|
+
6,
|
|
107
|
+
e
|
|
108
|
+
];
|
|
109
|
+
y = 0;
|
|
110
|
+
} finally{
|
|
111
|
+
f = t = 0;
|
|
112
|
+
}
|
|
113
|
+
if (op[0] & 5) throw op[1];
|
|
114
|
+
return {
|
|
115
|
+
value: op[0] ? op[1] : void 0,
|
|
116
|
+
done: true
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
Object.defineProperty(exports, "__esModule", {
|
|
121
|
+
value: true
|
|
122
|
+
});
|
|
123
|
+
var SessionStorage = /** @class */ function() {
|
|
124
|
+
function SessionStorage() {
|
|
125
|
+
this._inMemoryStorage = {};
|
|
126
|
+
}
|
|
127
|
+
SessionStorage.prototype.set = function(key, value) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
129
|
+
return __generator(this, function(_a) {
|
|
130
|
+
if (window && window.sessionStorage) {
|
|
131
|
+
window.sessionStorage.setItem(key, JSON.stringify(value));
|
|
132
|
+
} else if (wx && wx.setStorageSync) {
|
|
133
|
+
wx.setStorageSync(key, value);
|
|
134
|
+
} else if (my && my.setStorageSync) {
|
|
135
|
+
my.setStorageSync(key, value);
|
|
136
|
+
} else if (tt && tt.setStorageSync) {
|
|
137
|
+
tt.setStorageSync(key, value);
|
|
138
|
+
} else {
|
|
139
|
+
// 使用内存环境
|
|
140
|
+
this._inMemoryStorage[key] = value;
|
|
141
|
+
}
|
|
142
|
+
return [
|
|
143
|
+
2 /*return*/
|
|
144
|
+
];
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
SessionStorage.prototype.get = function(key) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
150
|
+
var value;
|
|
151
|
+
return __generator(this, function(_a) {
|
|
152
|
+
if (window && window.sessionStorage) {
|
|
153
|
+
value = window.sessionStorage.getItem(key);
|
|
154
|
+
return [
|
|
155
|
+
2 /*return*/ ,
|
|
156
|
+
value ? JSON.parse(value) : value
|
|
157
|
+
];
|
|
158
|
+
} else if (wx && wx.getStorageSync) {
|
|
159
|
+
return [
|
|
160
|
+
2 /*return*/ ,
|
|
161
|
+
wx.getStorageSync(key)
|
|
162
|
+
];
|
|
163
|
+
} else if (my && my.getStorageSync) {
|
|
164
|
+
return [
|
|
165
|
+
2 /*return*/ ,
|
|
166
|
+
my.getStorageSync(key)
|
|
167
|
+
];
|
|
168
|
+
} else if (tt && tt.getStorageSync) {
|
|
169
|
+
return [
|
|
170
|
+
2 /*return*/ ,
|
|
171
|
+
tt.getStorageSync(key)
|
|
172
|
+
];
|
|
173
|
+
} else {
|
|
174
|
+
return [
|
|
175
|
+
2 /*return*/ ,
|
|
176
|
+
this._inMemoryStorage[key]
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
return [
|
|
180
|
+
2 /*return*/
|
|
181
|
+
];
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
SessionStorage.prototype.remove = function(key) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
187
|
+
return __generator(this, function(_a) {
|
|
188
|
+
if (window && window.sessionStorage) {
|
|
189
|
+
window.sessionStorage.removeItem(key);
|
|
190
|
+
} else if (wx && wx.removeStorageSync) {
|
|
191
|
+
wx.removeStorageSync(key);
|
|
192
|
+
} else if (my && my.removeStorageSync) {
|
|
193
|
+
my.removeStorageSync(key);
|
|
194
|
+
} else if (tt && tt.removeStorageSync) {
|
|
195
|
+
tt.removeStorageSync(key);
|
|
196
|
+
} else {
|
|
197
|
+
delete this._inMemoryStorage[key];
|
|
198
|
+
}
|
|
199
|
+
return [
|
|
200
|
+
2 /*return*/
|
|
201
|
+
];
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
return SessionStorage;
|
|
206
|
+
}();
|
|
207
|
+
exports["default"] = SessionStorage;
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Config, config, URLSearchParamsParser, AbortControllerAdapter, AxiosStaticInstanceProvider, Service, AbortSource, DeleteMapping, GetMapping, IgnoreResidualParams, PatchMapping, PostMapping, PutMapping, RequestBody, RequestConfig, RequestHeader, RequestMapping, RequestParam, RequestWith, Expect } from "./lib/index";
|
package/index.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// noinspection JSUnusedGlobalSymbols
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Expect = exports.RequestWith = exports.RequestParam = exports.RequestMapping = exports.RequestHeader = exports.RequestConfig = exports.RequestBody = exports.PutMapping = exports.PostMapping = exports.PatchMapping = exports.IgnoreResidualParams = exports.GetMapping = exports.DeleteMapping = exports.AbortSource = exports.Service = exports.AxiosStaticInstanceProvider = exports.AbortControllerAdapter = exports.URLSearchParamsParser = exports.config = exports.Config = void 0;
|
|
7
|
-
var index_1 = require("./lib/index");
|
|
8
|
-
Object.defineProperty(exports, "Config", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return index_1.Config;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "config", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function get() {
|
|
17
|
-
return index_1.config;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "URLSearchParamsParser", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function get() {
|
|
23
|
-
return index_1.URLSearchParamsParser;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(exports, "AbortControllerAdapter", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function get() {
|
|
29
|
-
return index_1.AbortControllerAdapter;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, "AxiosStaticInstanceProvider", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function get() {
|
|
35
|
-
return index_1.AxiosStaticInstanceProvider;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(exports, "Service", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function get() {
|
|
41
|
-
return index_1.Service;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, "AbortSource", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function get() {
|
|
47
|
-
return index_1.AbortSource;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(exports, "DeleteMapping", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function get() {
|
|
53
|
-
return index_1.DeleteMapping;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(exports, "GetMapping", {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
get: function get() {
|
|
59
|
-
return index_1.GetMapping;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(exports, "IgnoreResidualParams", {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
get: function get() {
|
|
65
|
-
return index_1.IgnoreResidualParams;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
Object.defineProperty(exports, "PatchMapping", {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
get: function get() {
|
|
71
|
-
return index_1.PatchMapping;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
Object.defineProperty(exports, "PostMapping", {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function get() {
|
|
77
|
-
return index_1.PostMapping;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(exports, "PutMapping", {
|
|
81
|
-
enumerable: true,
|
|
82
|
-
get: function get() {
|
|
83
|
-
return index_1.PutMapping;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
Object.defineProperty(exports, "RequestBody", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
get: function get() {
|
|
89
|
-
return index_1.RequestBody;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
Object.defineProperty(exports, "RequestConfig", {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
get: function get() {
|
|
95
|
-
return index_1.RequestConfig;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
Object.defineProperty(exports, "RequestHeader", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function get() {
|
|
101
|
-
return index_1.RequestHeader;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
Object.defineProperty(exports, "RequestMapping", {
|
|
105
|
-
enumerable: true,
|
|
106
|
-
get: function get() {
|
|
107
|
-
return index_1.RequestMapping;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
Object.defineProperty(exports, "RequestParam", {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function get() {
|
|
113
|
-
return index_1.RequestParam;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
Object.defineProperty(exports, "RequestWith", {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function get() {
|
|
119
|
-
return index_1.RequestWith;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
Object.defineProperty(exports, "Expect", {
|
|
123
|
-
enumerable: true,
|
|
124
|
-
get: function get() {
|
|
125
|
-
return index_1.Expect;
|
|
126
|
-
}
|
|
127
|
-
});
|
package/lib/core/cancel.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { CancelTokenSource, CancelTokenStatic } from "axios";
|
|
2
|
-
/**
|
|
3
|
-
* 兼容旧版CancelToken,包装成AbortController
|
|
4
|
-
*/
|
|
5
|
-
export default class AbortControllerAdapter {
|
|
6
|
-
/**
|
|
7
|
-
* {
|
|
8
|
-
* cancel: (message, config, request) => void;
|
|
9
|
-
* token: { promise, _listeners, reason: CanceledError }
|
|
10
|
-
* }
|
|
11
|
-
*/
|
|
12
|
-
_source: CancelTokenSource;
|
|
13
|
-
_signal: {
|
|
14
|
-
onabort?: (e: Event) => void;
|
|
15
|
-
reason?: string;
|
|
16
|
-
aborted: boolean;
|
|
17
|
-
};
|
|
18
|
-
constructor(CancelToken: CancelTokenStatic);
|
|
19
|
-
/**
|
|
20
|
-
* sham AbortSignal. <br/>
|
|
21
|
-
* signal struct: {aborted: true, reason: string, onabort: null} <br/>
|
|
22
|
-
*/
|
|
23
|
-
get signal(): {
|
|
24
|
-
onabort?: (e: Event) => void;
|
|
25
|
-
reason?: string;
|
|
26
|
-
aborted: boolean;
|
|
27
|
-
};
|
|
28
|
-
get source(): CancelTokenSource;
|
|
29
|
-
abort(message?: string): void;
|
|
30
|
-
}
|
package/lib/core/cancel.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
/**
|
|
6
|
-
* 兼容旧版CancelToken,包装成AbortController
|
|
7
|
-
*/ var AbortControllerAdapter = /** @class */ function() {
|
|
8
|
-
function AbortControllerAdapter(CancelToken) {
|
|
9
|
-
var _this = this;
|
|
10
|
-
// sham signal onabort
|
|
11
|
-
this._signal = {
|
|
12
|
-
onabort: undefined,
|
|
13
|
-
reason: "",
|
|
14
|
-
aborted: false
|
|
15
|
-
};
|
|
16
|
-
this._source = CancelToken.source();
|
|
17
|
-
this._source.token.promise.then(function() {
|
|
18
|
-
var _a;
|
|
19
|
-
if (typeof _this._signal.onabort === "function") {
|
|
20
|
-
_this._signal.onabort(new Event("abort"));
|
|
21
|
-
}
|
|
22
|
-
_this._signal.aborted = true;
|
|
23
|
-
_this._signal.reason = (_a = _this._source.token.reason) === null || _a === void 0 ? void 0 : _a.message;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(AbortControllerAdapter.prototype, "signal", {
|
|
27
|
-
/**
|
|
28
|
-
* sham AbortSignal. <br/>
|
|
29
|
-
* signal struct: {aborted: true, reason: string, onabort: null} <br/>
|
|
30
|
-
*/ get: function get() {
|
|
31
|
-
return this._signal;
|
|
32
|
-
},
|
|
33
|
-
enumerable: false,
|
|
34
|
-
configurable: true
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(AbortControllerAdapter.prototype, "source", {
|
|
37
|
-
get: function get() {
|
|
38
|
-
return this._source;
|
|
39
|
-
},
|
|
40
|
-
enumerable: false,
|
|
41
|
-
configurable: true
|
|
42
|
-
});
|
|
43
|
-
// sham AbortController.abort(reason)
|
|
44
|
-
AbortControllerAdapter.prototype.abort = function(message) {
|
|
45
|
-
if (message === void 0) {
|
|
46
|
-
message = "";
|
|
47
|
-
}
|
|
48
|
-
if (message) {
|
|
49
|
-
this._source.cancel(message);
|
|
50
|
-
} else {
|
|
51
|
-
this._source.cancel();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
return AbortControllerAdapter;
|
|
55
|
-
}();
|
|
56
|
-
exports["default"] = AbortControllerAdapter;
|
package/lib/core/parser.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
declare const URLSearchParamsParser: {
|
|
2
|
-
/**
|
|
3
|
-
* Converting encoder object to query string. <br/>
|
|
4
|
-
* Refer to the URLSearchParams description for more details <br/>
|
|
5
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
|
|
6
|
-
* @param encoder
|
|
7
|
-
*/
|
|
8
|
-
encode: (encoder: URLSearchParams | Record<string, any>) => string;
|
|
9
|
-
/**
|
|
10
|
-
* returns a new URLSearchParams object
|
|
11
|
-
* @param params
|
|
12
|
-
*/
|
|
13
|
-
decode: (params: string[][] | Record<string, any> | string | URLSearchParams) => URLSearchParams | Record<string, any>;
|
|
14
|
-
has(encoder: URLSearchParams | Record<string, any>, key: string): boolean;
|
|
15
|
-
delete: (encoder: URLSearchParams | Record<string, any>, key: string) => void;
|
|
16
|
-
get: (encoder: URLSearchParams | Record<string, any>, key: string) => any;
|
|
17
|
-
append: (encoder: URLSearchParams | Record<string, any>, key: string, value: any) => void;
|
|
18
|
-
};
|
|
19
|
-
export default URLSearchParamsParser;
|
package/lib/core/parser.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
var common_1 = require("./common");
|
|
6
|
-
var URLSearchParamsParser = {
|
|
7
|
-
/**
|
|
8
|
-
* Converting encoder object to query string. <br/>
|
|
9
|
-
* Refer to the URLSearchParams description for more details <br/>
|
|
10
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
|
|
11
|
-
* @param encoder
|
|
12
|
-
*/ encode: function encode(encoder) {
|
|
13
|
-
if (typeof URLSearchParams === "undefined") {
|
|
14
|
-
// URLSearchParams 将空值 null 转为 "null"
|
|
15
|
-
return Object.entries(encoder).reduce(function(arr, _a) {
|
|
16
|
-
var key = _a[0], _b = _a[1], value = _b === void 0 ? undefined : _b;
|
|
17
|
-
if (Array.isArray(value)) {
|
|
18
|
-
value.forEach(function(i) {
|
|
19
|
-
arr.push("".concat(key, "=").concat(encodeURIComponent(i === null ? "null" : i === undefined ? "" : i)));
|
|
20
|
-
});
|
|
21
|
-
} else {
|
|
22
|
-
arr.push("".concat(key, "=").concat(encodeURIComponent(value === null ? "null" : value === undefined ? "" : value)));
|
|
23
|
-
}
|
|
24
|
-
return arr;
|
|
25
|
-
}, []).join("&");
|
|
26
|
-
} else {
|
|
27
|
-
// typeof URLSearchParams
|
|
28
|
-
return encoder.toString();
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* returns a new URLSearchParams object
|
|
33
|
-
* @param params
|
|
34
|
-
*/ decode: function decode(params) {
|
|
35
|
-
if (typeof URLSearchParams === "undefined") {
|
|
36
|
-
return Object.assign({}, params);
|
|
37
|
-
} else {
|
|
38
|
-
return new URLSearchParams(params);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
has: function has(encoder, key) {
|
|
42
|
-
if (typeof URLSearchParams === "undefined") {
|
|
43
|
-
return key in encoder;
|
|
44
|
-
} else {
|
|
45
|
-
return encoder.has(key);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"delete": function _delete(encoder, key) {
|
|
49
|
-
if (typeof URLSearchParams === "undefined") {
|
|
50
|
-
if (encoder) {
|
|
51
|
-
delete encoder[key];
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
encoder["delete"](key);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
get: function get(encoder, key) {
|
|
58
|
-
if (typeof URLSearchParams === "undefined") {
|
|
59
|
-
return encoder ? encoder[key] : undefined;
|
|
60
|
-
} else {
|
|
61
|
-
return encoder.get(key);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
append: function append(encoder, key, value) {
|
|
65
|
-
if (typeof URLSearchParams === "undefined") {
|
|
66
|
-
if (encoder) {
|
|
67
|
-
var v = encoder[key];
|
|
68
|
-
if ((0, common_1.isNullOrEmpty)(v)) {
|
|
69
|
-
encoder[key] = value;
|
|
70
|
-
} else {
|
|
71
|
-
encoder[key] = [].concat(v).concat(value);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
encoder.append(key, value);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
exports["default"] = URLSearchParamsParser;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports["default"] = AbortSource;
|
|
6
|
-
// noinspection JSUnusedGlobalSymbols
|
|
7
|
-
function AbortSource(abortController) {
|
|
8
|
-
return function(_target, method, descriptor) {
|
|
9
|
-
if (descriptor) {
|
|
10
|
-
var fn_1 = descriptor.value;
|
|
11
|
-
descriptor.value = function() {
|
|
12
|
-
var args = [];
|
|
13
|
-
for(var _i = 0; _i < arguments.length; _i++){
|
|
14
|
-
args[_i] = arguments[_i];
|
|
15
|
-
}
|
|
16
|
-
var controller = abortController;
|
|
17
|
-
if (typeof abortController === "function") {
|
|
18
|
-
controller = abortController.apply(undefined, args);
|
|
19
|
-
}
|
|
20
|
-
this.abort(method, controller);
|
|
21
|
-
return fn_1.apply(this, args);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function DeleteMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports["default"] = DeleteMapping;
|
|
6
|
-
var request_mapping_1 = require("./request-mapping");
|
|
7
|
-
// noinspection JSUnusedGlobalSymbols
|
|
8
|
-
function DeleteMapping(path) {
|
|
9
|
-
if (path === void 0) {
|
|
10
|
-
path = "";
|
|
11
|
-
}
|
|
12
|
-
return (0, request_mapping_1["default"])(path, "DELETE");
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function GetMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports["default"] = GetMapping;
|
|
6
|
-
var request_mapping_1 = require("./request-mapping");
|
|
7
|
-
// noinspection JSUnusedGlobalSymbols
|
|
8
|
-
function GetMapping(path) {
|
|
9
|
-
if (path === void 0) {
|
|
10
|
-
path = "";
|
|
11
|
-
}
|
|
12
|
-
return (0, request_mapping_1["default"])(path, "GET");
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function IgnoreResidualParams(ignore?: boolean): MethodDecorator;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports["default"] = IgnoreResidualParams;
|
|
6
|
-
// noinspection JSUnusedGlobalSymbols
|
|
7
|
-
function IgnoreResidualParams(ignore) {
|
|
8
|
-
return function(_target, method, descriptor) {
|
|
9
|
-
if (descriptor) {
|
|
10
|
-
var fn_1 = descriptor.value;
|
|
11
|
-
descriptor.value = function() {
|
|
12
|
-
var args = [];
|
|
13
|
-
for(var _i = 0; _i < arguments.length; _i++){
|
|
14
|
-
args[_i] = arguments[_i];
|
|
15
|
-
}
|
|
16
|
-
var cfg = Object.assign(this.features(method) || {}, {
|
|
17
|
-
ignoreResidualParams: ignore !== false
|
|
18
|
-
});
|
|
19
|
-
this.features(method, cfg);
|
|
20
|
-
return fn_1.apply(this, args);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function PatchMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports["default"] = PatchMapping;
|
|
6
|
-
var request_mapping_1 = require("./request-mapping");
|
|
7
|
-
// noinspection JSUnusedGlobalSymbols
|
|
8
|
-
function PatchMapping(path) {
|
|
9
|
-
if (path === void 0) {
|
|
10
|
-
path = "";
|
|
11
|
-
}
|
|
12
|
-
return (0, request_mapping_1["default"])(path, "PATCH");
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function PostMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports["default"] = PostMapping;
|
|
6
|
-
var request_mapping_1 = require("./request-mapping");
|
|
7
|
-
// noinspection JSUnusedGlobalSymbols
|
|
8
|
-
function PostMapping(path) {
|
|
9
|
-
if (path === void 0) {
|
|
10
|
-
path = "";
|
|
11
|
-
}
|
|
12
|
-
return (0, request_mapping_1["default"])(path, "POST");
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function PutMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports["default"] = PutMapping;
|
|
6
|
-
var request_mapping_1 = require("./request-mapping");
|
|
7
|
-
// noinspection JSUnusedGlobalSymbols
|
|
8
|
-
function PutMapping(path) {
|
|
9
|
-
if (path === void 0) {
|
|
10
|
-
path = "";
|
|
11
|
-
}
|
|
12
|
-
return (0, request_mapping_1["default"])(path, "PUT");
|
|
13
|
-
}
|
package/plugins/auth/index.d.ts
DELETED