@sambath999/localize-token 12.4.4 → 12.4.5
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/bundles/sambath999-localize-token.umd.js +18 -31
- package/bundles/sambath999-localize-token.umd.js.map +1 -1
- package/esm2015/localize-token/helpers/loccalize.api.helper.js +1 -10
- package/esm2015/localize-token/localize.api.service.js +13 -7
- package/fesm2015/sambath999-localize-token.js +12 -15
- package/fesm2015/sambath999-localize-token.js.map +1 -1
- package/package.json +1 -1
|
@@ -1035,15 +1035,6 @@
|
|
|
1035
1035
|
? normalizedUrl.slice(0, -1)
|
|
1036
1036
|
: normalizedUrl;
|
|
1037
1037
|
};
|
|
1038
|
-
// normalizeError(error: HttpErrorResponse): INormalizedError {
|
|
1039
|
-
// return {
|
|
1040
|
-
// error: error.error || {},
|
|
1041
|
-
// code: error.error?.code || `HTTP_${error.status}`,
|
|
1042
|
-
// message: error.error?.message || error.message,
|
|
1043
|
-
// details: error.error?.details,
|
|
1044
|
-
// status: error.status
|
|
1045
|
-
// };
|
|
1046
|
-
// }
|
|
1047
1038
|
LocalizeApiHelper.prototype.invokeHook = function (callback) {
|
|
1048
1039
|
return __awaiter(this, void 0, void 0, function () {
|
|
1049
1040
|
var result;
|
|
@@ -1277,12 +1268,12 @@
|
|
|
1277
1268
|
case 0:
|
|
1278
1269
|
if (error.status !== 401)
|
|
1279
1270
|
throw error;
|
|
1280
|
-
return [4 /*yield*/, waitUntil(function () { return !_this.isResolvingStartup; },
|
|
1271
|
+
return [4 /*yield*/, waitUntil(function () { return !_this.isResolvingStartup; }, 50)];
|
|
1281
1272
|
case 1:
|
|
1282
1273
|
_e.sent();
|
|
1283
1274
|
return [4 /*yield*/, ApiHelper.performRetry({
|
|
1284
1275
|
maxRetries: function () { return 1000; },
|
|
1285
|
-
delay:
|
|
1276
|
+
delay: 10,
|
|
1286
1277
|
retryUnless: function (error) { return error.status === 401 || ApiHelper.isConnectionError(error); },
|
|
1287
1278
|
callback: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1288
1279
|
return __generator(this, function (_e) {
|
|
@@ -1385,32 +1376,28 @@
|
|
|
1385
1376
|
LocalizeApiService.prototype.toWaitForPreviousRequest = function () {
|
|
1386
1377
|
var _a;
|
|
1387
1378
|
return __awaiter(this, void 0, void 0, function () {
|
|
1388
|
-
var
|
|
1379
|
+
var waitMilliseconds;
|
|
1389
1380
|
var _this = this;
|
|
1390
|
-
return __generator(this, function (
|
|
1391
|
-
switch (
|
|
1381
|
+
return __generator(this, function (_e) {
|
|
1382
|
+
switch (_e.label) {
|
|
1392
1383
|
case 0:
|
|
1393
|
-
|
|
1394
|
-
|
|
1384
|
+
if (!this.isRevokingToken) return [3 /*break*/, 2];
|
|
1385
|
+
// console.warn('A token refresh is in progress. Request is waiting.');
|
|
1395
1386
|
return [4 /*yield*/, waitUntil(function () { return !_this.isRevokingToken; })];
|
|
1396
1387
|
case 1:
|
|
1397
|
-
|
|
1398
|
-
|
|
1388
|
+
// console.warn('A token refresh is in progress. Request is waiting.');
|
|
1389
|
+
_e.sent();
|
|
1390
|
+
_e.label = 2;
|
|
1399
1391
|
case 2:
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
// to wait for each request in 50ms, even if the request is not completed
|
|
1405
|
-
return [3 /*break*/, 4];
|
|
1406
|
-
return [4 /*yield*/, waitFor(this.config.waitEachRequest.milliseconds, this.isRequesting)];
|
|
1392
|
+
waitMilliseconds = (_a = this.config.waitEachRequest) === null || _a === void 0 ? void 0 : _a.milliseconds;
|
|
1393
|
+
if (!(waitMilliseconds && this.isRequesting)) return [3 /*break*/, 4];
|
|
1394
|
+
// console.warn(`Request throttling: Another request is in progress. Waiting for ${waitMilliseconds}ms.`);
|
|
1395
|
+
return [4 /*yield*/, waitFor(waitMilliseconds, this.isRequesting)];
|
|
1407
1396
|
case 3:
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
_f;
|
|
1413
|
-
return [2 /*return*/];
|
|
1397
|
+
// console.warn(`Request throttling: Another request is in progress. Waiting for ${waitMilliseconds}ms.`);
|
|
1398
|
+
_e.sent();
|
|
1399
|
+
_e.label = 4;
|
|
1400
|
+
case 4: return [2 /*return*/];
|
|
1414
1401
|
}
|
|
1415
1402
|
});
|
|
1416
1403
|
});
|