axios-annotations 2.1.1 → 2.3.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/lib/decorator/delete-mapping.d.ts +1 -1
- package/lib/decorator/get-mapping.d.ts +1 -1
- package/lib/decorator/patch-mapping.d.ts +1 -1
- package/lib/decorator/post-mapping.d.ts +1 -1
- package/lib/decorator/put-mapping.d.ts +1 -1
- package/lib/decorator/request-mapping.d.ts +1 -1
- package/lib/plugins/auth/queue.js +21 -13
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function DeleteMapping(path?: string): MethodDecorator;
|
|
1
|
+
export default function DeleteMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function GetMapping(path?: string): MethodDecorator;
|
|
1
|
+
export default function GetMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function PatchMapping(path?: string): MethodDecorator;
|
|
1
|
+
export default function PatchMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function PostMapping(path?: string): MethodDecorator;
|
|
1
|
+
export default function PostMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function PutMapping(path?: string): MethodDecorator;
|
|
1
|
+
export default function PutMapping<M = undefined>(path?: string): MethodDecorator;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
type DecoratorTargetType<M> = M extends string ? MethodDecorator : ClassDecorator;
|
|
2
|
-
export default function RequestMapping<M = undefined>(path: string, method?: M): DecoratorTargetType<M>;
|
|
2
|
+
export default function RequestMapping<M = undefined>(path: string, method?: M | string): DecoratorTargetType<M>;
|
|
3
3
|
export {};
|
|
@@ -158,19 +158,21 @@ var PendingQueue = /** @class */ function() {
|
|
|
158
158
|
}
|
|
159
159
|
PendingQueue.prototype.resend = function(error_1) {
|
|
160
160
|
return __awaiter(this, arguments, void 0, function(error, retries) {
|
|
161
|
-
var i, session, axios, e_1;
|
|
161
|
+
var maxTimes, i, session, axios, e_1;
|
|
162
162
|
if (retries === void 0) {
|
|
163
163
|
retries = 3;
|
|
164
164
|
}
|
|
165
165
|
return __generator(this, function(_a) {
|
|
166
166
|
switch(_a.label){
|
|
167
167
|
case 0:
|
|
168
|
+
maxTimes = Math.max(this._retryTimes, retries, 1);
|
|
169
|
+
console.log(maxTimes);
|
|
168
170
|
i = 0;
|
|
169
171
|
_a.label = 1;
|
|
170
172
|
case 1:
|
|
171
|
-
if (!(i <
|
|
173
|
+
if (!(i < maxTimes)) return [
|
|
172
174
|
3 /*break*/ ,
|
|
173
|
-
|
|
175
|
+
10
|
|
174
176
|
];
|
|
175
177
|
if (!(i > 0)) return [
|
|
176
178
|
3 /*break*/ ,
|
|
@@ -198,37 +200,43 @@ var PendingQueue = /** @class */ function() {
|
|
|
198
200
|
case 5:
|
|
199
201
|
_a.trys.push([
|
|
200
202
|
5,
|
|
201
|
-
|
|
203
|
+
8,
|
|
202
204
|
,
|
|
203
|
-
|
|
205
|
+
9
|
|
204
206
|
]);
|
|
205
207
|
return [
|
|
206
208
|
4 /*yield*/ ,
|
|
207
|
-
this._config.
|
|
209
|
+
this._config.axiosProvider.get()
|
|
208
210
|
];
|
|
209
211
|
case 6:
|
|
210
|
-
axios = _a.sent();
|
|
212
|
+
axios = _a.sent().create();
|
|
211
213
|
this._authorizer.withAuthentication(error.config, session);
|
|
212
214
|
return [
|
|
213
|
-
|
|
215
|
+
4 /*yield*/ ,
|
|
214
216
|
axios.request(error.config)
|
|
215
217
|
];
|
|
216
218
|
case 7:
|
|
219
|
+
// fix: 401 循环 忘了加 await
|
|
220
|
+
return [
|
|
221
|
+
2 /*return*/ ,
|
|
222
|
+
_a.sent()
|
|
223
|
+
];
|
|
224
|
+
case 8:
|
|
217
225
|
e_1 = _a.sent();
|
|
218
|
-
if (i >=
|
|
226
|
+
if (i >= maxTimes) {
|
|
219
227
|
throw e_1;
|
|
220
228
|
}
|
|
221
229
|
return [
|
|
222
230
|
3 /*break*/ ,
|
|
223
|
-
|
|
231
|
+
9
|
|
224
232
|
];
|
|
225
|
-
case
|
|
226
|
-
|
|
233
|
+
case 9:
|
|
234
|
+
i++;
|
|
227
235
|
return [
|
|
228
236
|
3 /*break*/ ,
|
|
229
237
|
1
|
|
230
238
|
];
|
|
231
|
-
case
|
|
239
|
+
case 10:
|
|
232
240
|
throw error;
|
|
233
241
|
}
|
|
234
242
|
});
|