@aws-amplify/core 4.7.7-unstable.2 → 4.7.7-unstable.7
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/dist/aws-amplify-core.js +768 -106
- package/dist/aws-amplify-core.js.map +1 -1
- package/dist/aws-amplify-core.min.js +5 -5
- package/dist/aws-amplify-core.min.js.map +1 -1
- package/lib/Credentials.d.ts +1 -1
- package/lib/Credentials.js +1 -1
- package/lib/Credentials.js.map +1 -1
- package/lib/Util/BackgroundProcessManager.d.ts +178 -0
- package/lib/Util/BackgroundProcessManager.js +385 -0
- package/lib/Util/BackgroundProcessManager.js.map +1 -0
- package/lib/Util/Retry.d.ts +2 -2
- package/lib/Util/Retry.js +76 -34
- package/lib/Util/Retry.js.map +1 -1
- package/lib/Util/index.d.ts +1 -0
- package/lib/Util/index.js +1 -0
- package/lib/Util/index.js.map +1 -1
- package/lib-esm/Credentials.d.ts +1 -1
- package/lib-esm/Credentials.js +1 -1
- package/lib-esm/Credentials.js.map +1 -1
- package/lib-esm/Util/BackgroundProcessManager.d.ts +178 -0
- package/lib-esm/Util/BackgroundProcessManager.js +383 -0
- package/lib-esm/Util/BackgroundProcessManager.js.map +1 -0
- package/lib-esm/Util/Retry.d.ts +2 -2
- package/lib-esm/Util/Retry.js +76 -34
- package/lib-esm/Util/Retry.js.map +1 -1
- package/lib-esm/Util/index.d.ts +1 -0
- package/lib-esm/Util/index.js +1 -0
- package/lib-esm/Util/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Credentials.ts +13 -14
- package/src/Util/BackgroundProcessManager.ts +415 -0
- package/src/Util/Retry.ts +66 -31
- package/src/Util/index.ts +1 -0
package/dist/aws-amplify-core.js
CHANGED
|
@@ -658,8 +658,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
658
658
|
/* harmony import */ var _whatwgEncodingApi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./whatwgEncodingApi */ "../../node_modules/@aws-crypto/sha256-browser/node_modules/@aws-sdk/util-utf8-browser/dist-es/whatwgEncodingApi.js");
|
|
659
659
|
|
|
660
660
|
|
|
661
|
-
|
|
662
|
-
|
|
661
|
+
var fromUtf8 = function (input) {
|
|
662
|
+
return typeof TextEncoder === "function" ? Object(_whatwgEncodingApi__WEBPACK_IMPORTED_MODULE_1__["fromUtf8"])(input) : Object(_pureJs__WEBPACK_IMPORTED_MODULE_0__["fromUtf8"])(input);
|
|
663
|
+
};
|
|
664
|
+
var toUtf8 = function (input) {
|
|
665
|
+
return typeof TextDecoder === "function" ? Object(_whatwgEncodingApi__WEBPACK_IMPORTED_MODULE_1__["toUtf8"])(input) : Object(_pureJs__WEBPACK_IMPORTED_MODULE_0__["toUtf8"])(input);
|
|
666
|
+
};
|
|
663
667
|
|
|
664
668
|
|
|
665
669
|
/***/ }),
|
|
@@ -675,44 +679,44 @@ const toUtf8 = (input) => typeof TextDecoder === "function" ? Object(_whatwgEnco
|
|
|
675
679
|
__webpack_require__.r(__webpack_exports__);
|
|
676
680
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromUtf8", function() { return fromUtf8; });
|
|
677
681
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUtf8", function() { return toUtf8; });
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
for (
|
|
681
|
-
|
|
682
|
+
var fromUtf8 = function (input) {
|
|
683
|
+
var bytes = [];
|
|
684
|
+
for (var i = 0, len = input.length; i < len; i++) {
|
|
685
|
+
var value = input.charCodeAt(i);
|
|
682
686
|
if (value < 0x80) {
|
|
683
687
|
bytes.push(value);
|
|
684
688
|
}
|
|
685
689
|
else if (value < 0x800) {
|
|
686
|
-
bytes.push((value >> 6) |
|
|
690
|
+
bytes.push((value >> 6) | 192, (value & 63) | 128);
|
|
687
691
|
}
|
|
688
692
|
else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
|
689
|
-
|
|
690
|
-
bytes.push((surrogatePair >> 18) |
|
|
693
|
+
var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);
|
|
694
|
+
bytes.push((surrogatePair >> 18) | 240, ((surrogatePair >> 12) & 63) | 128, ((surrogatePair >> 6) & 63) | 128, (surrogatePair & 63) | 128);
|
|
691
695
|
}
|
|
692
696
|
else {
|
|
693
|
-
bytes.push((value >> 12) |
|
|
697
|
+
bytes.push((value >> 12) | 224, ((value >> 6) & 63) | 128, (value & 63) | 128);
|
|
694
698
|
}
|
|
695
699
|
}
|
|
696
700
|
return Uint8Array.from(bytes);
|
|
697
701
|
};
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
for (
|
|
701
|
-
|
|
702
|
+
var toUtf8 = function (input) {
|
|
703
|
+
var decoded = "";
|
|
704
|
+
for (var i = 0, len = input.length; i < len; i++) {
|
|
705
|
+
var byte = input[i];
|
|
702
706
|
if (byte < 0x80) {
|
|
703
707
|
decoded += String.fromCharCode(byte);
|
|
704
708
|
}
|
|
705
|
-
else if (
|
|
706
|
-
|
|
707
|
-
decoded += String.fromCharCode(((byte &
|
|
709
|
+
else if (192 <= byte && byte < 224) {
|
|
710
|
+
var nextByte = input[++i];
|
|
711
|
+
decoded += String.fromCharCode(((byte & 31) << 6) | (nextByte & 63));
|
|
708
712
|
}
|
|
709
|
-
else if (
|
|
710
|
-
|
|
711
|
-
|
|
713
|
+
else if (240 <= byte && byte < 365) {
|
|
714
|
+
var surrogatePair = [byte, input[++i], input[++i], input[++i]];
|
|
715
|
+
var encoded = "%" + surrogatePair.map(function (byteValue) { return byteValue.toString(16); }).join("%");
|
|
712
716
|
decoded += decodeURIComponent(encoded);
|
|
713
717
|
}
|
|
714
718
|
else {
|
|
715
|
-
decoded += String.fromCharCode(((byte &
|
|
719
|
+
decoded += String.fromCharCode(((byte & 15) << 12) | ((input[++i] & 63) << 6) | (input[++i] & 63));
|
|
716
720
|
}
|
|
717
721
|
}
|
|
718
722
|
return decoded;
|
|
@@ -1249,8 +1253,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1249
1253
|
/* harmony import */ var _whatwgEncodingApi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./whatwgEncodingApi */ "../../node_modules/@aws-crypto/sha256-js/node_modules/@aws-sdk/util-utf8-browser/dist-es/whatwgEncodingApi.js");
|
|
1250
1254
|
|
|
1251
1255
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1256
|
+
var fromUtf8 = function (input) {
|
|
1257
|
+
return typeof TextEncoder === "function" ? Object(_whatwgEncodingApi__WEBPACK_IMPORTED_MODULE_1__["fromUtf8"])(input) : Object(_pureJs__WEBPACK_IMPORTED_MODULE_0__["fromUtf8"])(input);
|
|
1258
|
+
};
|
|
1259
|
+
var toUtf8 = function (input) {
|
|
1260
|
+
return typeof TextDecoder === "function" ? Object(_whatwgEncodingApi__WEBPACK_IMPORTED_MODULE_1__["toUtf8"])(input) : Object(_pureJs__WEBPACK_IMPORTED_MODULE_0__["toUtf8"])(input);
|
|
1261
|
+
};
|
|
1254
1262
|
|
|
1255
1263
|
|
|
1256
1264
|
/***/ }),
|
|
@@ -1266,44 +1274,44 @@ const toUtf8 = (input) => typeof TextDecoder === "function" ? Object(_whatwgEnco
|
|
|
1266
1274
|
__webpack_require__.r(__webpack_exports__);
|
|
1267
1275
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromUtf8", function() { return fromUtf8; });
|
|
1268
1276
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUtf8", function() { return toUtf8; });
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
for (
|
|
1272
|
-
|
|
1277
|
+
var fromUtf8 = function (input) {
|
|
1278
|
+
var bytes = [];
|
|
1279
|
+
for (var i = 0, len = input.length; i < len; i++) {
|
|
1280
|
+
var value = input.charCodeAt(i);
|
|
1273
1281
|
if (value < 0x80) {
|
|
1274
1282
|
bytes.push(value);
|
|
1275
1283
|
}
|
|
1276
1284
|
else if (value < 0x800) {
|
|
1277
|
-
bytes.push((value >> 6) |
|
|
1285
|
+
bytes.push((value >> 6) | 192, (value & 63) | 128);
|
|
1278
1286
|
}
|
|
1279
1287
|
else if (i + 1 < input.length && (value & 0xfc00) === 0xd800 && (input.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
|
1280
|
-
|
|
1281
|
-
bytes.push((surrogatePair >> 18) |
|
|
1288
|
+
var surrogatePair = 0x10000 + ((value & 1023) << 10) + (input.charCodeAt(++i) & 1023);
|
|
1289
|
+
bytes.push((surrogatePair >> 18) | 240, ((surrogatePair >> 12) & 63) | 128, ((surrogatePair >> 6) & 63) | 128, (surrogatePair & 63) | 128);
|
|
1282
1290
|
}
|
|
1283
1291
|
else {
|
|
1284
|
-
bytes.push((value >> 12) |
|
|
1292
|
+
bytes.push((value >> 12) | 224, ((value >> 6) & 63) | 128, (value & 63) | 128);
|
|
1285
1293
|
}
|
|
1286
1294
|
}
|
|
1287
1295
|
return Uint8Array.from(bytes);
|
|
1288
1296
|
};
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
for (
|
|
1292
|
-
|
|
1297
|
+
var toUtf8 = function (input) {
|
|
1298
|
+
var decoded = "";
|
|
1299
|
+
for (var i = 0, len = input.length; i < len; i++) {
|
|
1300
|
+
var byte = input[i];
|
|
1293
1301
|
if (byte < 0x80) {
|
|
1294
1302
|
decoded += String.fromCharCode(byte);
|
|
1295
1303
|
}
|
|
1296
|
-
else if (
|
|
1297
|
-
|
|
1298
|
-
decoded += String.fromCharCode(((byte &
|
|
1304
|
+
else if (192 <= byte && byte < 224) {
|
|
1305
|
+
var nextByte = input[++i];
|
|
1306
|
+
decoded += String.fromCharCode(((byte & 31) << 6) | (nextByte & 63));
|
|
1299
1307
|
}
|
|
1300
|
-
else if (
|
|
1301
|
-
|
|
1302
|
-
|
|
1308
|
+
else if (240 <= byte && byte < 365) {
|
|
1309
|
+
var surrogatePair = [byte, input[++i], input[++i], input[++i]];
|
|
1310
|
+
var encoded = "%" + surrogatePair.map(function (byteValue) { return byteValue.toString(16); }).join("%");
|
|
1303
1311
|
decoded += decodeURIComponent(encoded);
|
|
1304
1312
|
}
|
|
1305
1313
|
else {
|
|
1306
|
-
decoded += String.fromCharCode(((byte &
|
|
1314
|
+
decoded += String.fromCharCode(((byte & 15) << 12) | ((input[++i] & 63) << 6) | (input[++i] & 63));
|
|
1307
1315
|
}
|
|
1308
1316
|
}
|
|
1309
1317
|
return decoded;
|
|
@@ -23866,7 +23874,7 @@ function calculateBodyLength(body) {
|
|
|
23866
23874
|
"use strict";
|
|
23867
23875
|
__webpack_require__.r(__webpack_exports__);
|
|
23868
23876
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "locateWindow", function() { return locateWindow; });
|
|
23869
|
-
|
|
23877
|
+
var fallbackWindow = {};
|
|
23870
23878
|
function locateWindow() {
|
|
23871
23879
|
if (typeof window !== "undefined") {
|
|
23872
23880
|
return window;
|
|
@@ -35006,6 +35014,578 @@ function () {
|
|
|
35006
35014
|
|
|
35007
35015
|
|
|
35008
35016
|
|
|
35017
|
+
/***/ }),
|
|
35018
|
+
|
|
35019
|
+
/***/ "./lib-esm/Util/BackgroundProcessManager.js":
|
|
35020
|
+
/*!**************************************************!*\
|
|
35021
|
+
!*** ./lib-esm/Util/BackgroundProcessManager.js ***!
|
|
35022
|
+
\**************************************************/
|
|
35023
|
+
/*! exports provided: BackgroundProcessManager, BackgroundProcessManagerState */
|
|
35024
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35025
|
+
|
|
35026
|
+
"use strict";
|
|
35027
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35028
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BackgroundProcessManager", function() { return BackgroundProcessManager; });
|
|
35029
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BackgroundProcessManagerState", function() { return BackgroundProcessManagerState; });
|
|
35030
|
+
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
35031
|
+
function adopt(value) {
|
|
35032
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
35033
|
+
resolve(value);
|
|
35034
|
+
});
|
|
35035
|
+
}
|
|
35036
|
+
|
|
35037
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35038
|
+
function fulfilled(value) {
|
|
35039
|
+
try {
|
|
35040
|
+
step(generator.next(value));
|
|
35041
|
+
} catch (e) {
|
|
35042
|
+
reject(e);
|
|
35043
|
+
}
|
|
35044
|
+
}
|
|
35045
|
+
|
|
35046
|
+
function rejected(value) {
|
|
35047
|
+
try {
|
|
35048
|
+
step(generator["throw"](value));
|
|
35049
|
+
} catch (e) {
|
|
35050
|
+
reject(e);
|
|
35051
|
+
}
|
|
35052
|
+
}
|
|
35053
|
+
|
|
35054
|
+
function step(result) {
|
|
35055
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
35056
|
+
}
|
|
35057
|
+
|
|
35058
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35059
|
+
});
|
|
35060
|
+
};
|
|
35061
|
+
|
|
35062
|
+
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
35063
|
+
var _ = {
|
|
35064
|
+
label: 0,
|
|
35065
|
+
sent: function sent() {
|
|
35066
|
+
if (t[0] & 1) throw t[1];
|
|
35067
|
+
return t[1];
|
|
35068
|
+
},
|
|
35069
|
+
trys: [],
|
|
35070
|
+
ops: []
|
|
35071
|
+
},
|
|
35072
|
+
f,
|
|
35073
|
+
y,
|
|
35074
|
+
t,
|
|
35075
|
+
g;
|
|
35076
|
+
return g = {
|
|
35077
|
+
next: verb(0),
|
|
35078
|
+
"throw": verb(1),
|
|
35079
|
+
"return": verb(2)
|
|
35080
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
35081
|
+
return this;
|
|
35082
|
+
}), g;
|
|
35083
|
+
|
|
35084
|
+
function verb(n) {
|
|
35085
|
+
return function (v) {
|
|
35086
|
+
return step([n, v]);
|
|
35087
|
+
};
|
|
35088
|
+
}
|
|
35089
|
+
|
|
35090
|
+
function step(op) {
|
|
35091
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
35092
|
+
|
|
35093
|
+
while (_) {
|
|
35094
|
+
try {
|
|
35095
|
+
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;
|
|
35096
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35097
|
+
|
|
35098
|
+
switch (op[0]) {
|
|
35099
|
+
case 0:
|
|
35100
|
+
case 1:
|
|
35101
|
+
t = op;
|
|
35102
|
+
break;
|
|
35103
|
+
|
|
35104
|
+
case 4:
|
|
35105
|
+
_.label++;
|
|
35106
|
+
return {
|
|
35107
|
+
value: op[1],
|
|
35108
|
+
done: false
|
|
35109
|
+
};
|
|
35110
|
+
|
|
35111
|
+
case 5:
|
|
35112
|
+
_.label++;
|
|
35113
|
+
y = op[1];
|
|
35114
|
+
op = [0];
|
|
35115
|
+
continue;
|
|
35116
|
+
|
|
35117
|
+
case 7:
|
|
35118
|
+
op = _.ops.pop();
|
|
35119
|
+
|
|
35120
|
+
_.trys.pop();
|
|
35121
|
+
|
|
35122
|
+
continue;
|
|
35123
|
+
|
|
35124
|
+
default:
|
|
35125
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
35126
|
+
_ = 0;
|
|
35127
|
+
continue;
|
|
35128
|
+
}
|
|
35129
|
+
|
|
35130
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
35131
|
+
_.label = op[1];
|
|
35132
|
+
break;
|
|
35133
|
+
}
|
|
35134
|
+
|
|
35135
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
35136
|
+
_.label = t[1];
|
|
35137
|
+
t = op;
|
|
35138
|
+
break;
|
|
35139
|
+
}
|
|
35140
|
+
|
|
35141
|
+
if (t && _.label < t[2]) {
|
|
35142
|
+
_.label = t[2];
|
|
35143
|
+
|
|
35144
|
+
_.ops.push(op);
|
|
35145
|
+
|
|
35146
|
+
break;
|
|
35147
|
+
}
|
|
35148
|
+
|
|
35149
|
+
if (t[2]) _.ops.pop();
|
|
35150
|
+
|
|
35151
|
+
_.trys.pop();
|
|
35152
|
+
|
|
35153
|
+
continue;
|
|
35154
|
+
}
|
|
35155
|
+
|
|
35156
|
+
op = body.call(thisArg, _);
|
|
35157
|
+
} catch (e) {
|
|
35158
|
+
op = [6, e];
|
|
35159
|
+
y = 0;
|
|
35160
|
+
} finally {
|
|
35161
|
+
f = t = 0;
|
|
35162
|
+
}
|
|
35163
|
+
}
|
|
35164
|
+
|
|
35165
|
+
if (op[0] & 5) throw op[1];
|
|
35166
|
+
return {
|
|
35167
|
+
value: op[0] ? op[1] : void 0,
|
|
35168
|
+
done: true
|
|
35169
|
+
};
|
|
35170
|
+
}
|
|
35171
|
+
};
|
|
35172
|
+
|
|
35173
|
+
var __values = undefined && undefined.__values || function (o) {
|
|
35174
|
+
var s = typeof Symbol === "function" && Symbol.iterator,
|
|
35175
|
+
m = s && o[s],
|
|
35176
|
+
i = 0;
|
|
35177
|
+
if (m) return m.call(o);
|
|
35178
|
+
if (o && typeof o.length === "number") return {
|
|
35179
|
+
next: function next() {
|
|
35180
|
+
if (o && i >= o.length) o = void 0;
|
|
35181
|
+
return {
|
|
35182
|
+
value: o && o[i++],
|
|
35183
|
+
done: !o
|
|
35184
|
+
};
|
|
35185
|
+
}
|
|
35186
|
+
};
|
|
35187
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
35188
|
+
};
|
|
35189
|
+
/**
|
|
35190
|
+
* @private For internal Amplify use.
|
|
35191
|
+
*
|
|
35192
|
+
* Creates a new scope for promises, observables, and other types of work or
|
|
35193
|
+
* processes that may be running in the background. This manager provides
|
|
35194
|
+
* an singular entrypoint to request termination and await completion.
|
|
35195
|
+
*
|
|
35196
|
+
* As work completes on its own prior to close, the manager removes them
|
|
35197
|
+
* from the registry to avoid holding references to completed jobs.
|
|
35198
|
+
*/
|
|
35199
|
+
|
|
35200
|
+
|
|
35201
|
+
var BackgroundProcessManager =
|
|
35202
|
+
/** @class */
|
|
35203
|
+
function () {
|
|
35204
|
+
/**
|
|
35205
|
+
* Creates a new manager for promises, observables, and other types
|
|
35206
|
+
* of work that may be running in the background. This manager provides
|
|
35207
|
+
* a centralized mechanism to request termination and await completion.
|
|
35208
|
+
*/
|
|
35209
|
+
function BackgroundProcessManager() {
|
|
35210
|
+
/**
|
|
35211
|
+
* A string indicating whether the manager is accepting new work ("Open"),
|
|
35212
|
+
* waiting for work to complete ("Closing"), or fully done with all
|
|
35213
|
+
* submitted work and *not* accepting new jobs ("Closed").
|
|
35214
|
+
*/
|
|
35215
|
+
this._state = BackgroundProcessManagerState.Open;
|
|
35216
|
+
/**
|
|
35217
|
+
* The list of outstanding jobs we'll need to wait for upon `close()`
|
|
35218
|
+
*/
|
|
35219
|
+
|
|
35220
|
+
this.jobs = new Set();
|
|
35221
|
+
}
|
|
35222
|
+
|
|
35223
|
+
BackgroundProcessManager.prototype.add = function (jobOrDescription, optionalDescription) {
|
|
35224
|
+
var job;
|
|
35225
|
+
var description;
|
|
35226
|
+
|
|
35227
|
+
if (typeof jobOrDescription === 'string') {
|
|
35228
|
+
job = undefined;
|
|
35229
|
+
description = jobOrDescription;
|
|
35230
|
+
} else {
|
|
35231
|
+
job = jobOrDescription;
|
|
35232
|
+
description = optionalDescription;
|
|
35233
|
+
}
|
|
35234
|
+
|
|
35235
|
+
var error = this.closedFailure(description);
|
|
35236
|
+
if (error) return error;
|
|
35237
|
+
|
|
35238
|
+
if (job === undefined) {
|
|
35239
|
+
return this.addHook(description);
|
|
35240
|
+
} else if (typeof job === 'function') {
|
|
35241
|
+
return this.addFunction(job, description);
|
|
35242
|
+
} else if (job instanceof BackgroundProcessManager) {
|
|
35243
|
+
return this.addManager(job, description);
|
|
35244
|
+
} else {
|
|
35245
|
+
throw new Error('If `job` is provided, it must be an Observable, Function, or BackgroundProcessManager.');
|
|
35246
|
+
}
|
|
35247
|
+
};
|
|
35248
|
+
/**
|
|
35249
|
+
* Adds a **cleaner** function that doesn't immediately get executed.
|
|
35250
|
+
* Instead, the caller gets a **terminate** function back. The *cleaner* is
|
|
35251
|
+
* invoked only once the mananger *closes* or the returned **terminate**
|
|
35252
|
+
* function is called.
|
|
35253
|
+
*
|
|
35254
|
+
* @param clean The cleanup function.
|
|
35255
|
+
* @param description Optional description to help identify pending jobs.
|
|
35256
|
+
* @returns A terminate function.
|
|
35257
|
+
*/
|
|
35258
|
+
|
|
35259
|
+
|
|
35260
|
+
BackgroundProcessManager.prototype.addCleaner = function (clean, description) {
|
|
35261
|
+
var _this = this;
|
|
35262
|
+
|
|
35263
|
+
var _a = this.addHook(description),
|
|
35264
|
+
resolve = _a.resolve,
|
|
35265
|
+
onTerminate = _a.onTerminate;
|
|
35266
|
+
|
|
35267
|
+
var proxy = function proxy() {
|
|
35268
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
35269
|
+
return __generator(this, function (_a) {
|
|
35270
|
+
switch (_a.label) {
|
|
35271
|
+
case 0:
|
|
35272
|
+
return [4
|
|
35273
|
+
/*yield*/
|
|
35274
|
+
, clean()];
|
|
35275
|
+
|
|
35276
|
+
case 1:
|
|
35277
|
+
_a.sent();
|
|
35278
|
+
|
|
35279
|
+
resolve();
|
|
35280
|
+
return [2
|
|
35281
|
+
/*return*/
|
|
35282
|
+
];
|
|
35283
|
+
}
|
|
35284
|
+
});
|
|
35285
|
+
});
|
|
35286
|
+
};
|
|
35287
|
+
|
|
35288
|
+
onTerminate.then(proxy);
|
|
35289
|
+
return proxy;
|
|
35290
|
+
};
|
|
35291
|
+
|
|
35292
|
+
BackgroundProcessManager.prototype.addFunction = function (job, description) {
|
|
35293
|
+
// the function we call when we want to try to terminate this job.
|
|
35294
|
+
var terminate; // the promise the job can opt into listening to for termination.
|
|
35295
|
+
|
|
35296
|
+
var onTerminate = new Promise(function (resolve) {
|
|
35297
|
+
terminate = resolve;
|
|
35298
|
+
}); // finally! start the job.
|
|
35299
|
+
|
|
35300
|
+
var jobResult = job(onTerminate); // depending on what the job gives back, register the result
|
|
35301
|
+
// so we can monitor for completion.
|
|
35302
|
+
|
|
35303
|
+
if (typeof (jobResult === null || jobResult === void 0 ? void 0 : jobResult.then) === 'function') {
|
|
35304
|
+
this.registerPromise(jobResult, terminate, description);
|
|
35305
|
+
} // At the end of the day, or you know, method call, it doesn't matter
|
|
35306
|
+
// what the return value is at all; we just pass it through to the
|
|
35307
|
+
// caller.
|
|
35308
|
+
|
|
35309
|
+
|
|
35310
|
+
return jobResult;
|
|
35311
|
+
};
|
|
35312
|
+
|
|
35313
|
+
BackgroundProcessManager.prototype.addManager = function (manager, description) {
|
|
35314
|
+
var _this = this;
|
|
35315
|
+
|
|
35316
|
+
this.addCleaner(function () {
|
|
35317
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
35318
|
+
return __generator(this, function (_a) {
|
|
35319
|
+
switch (_a.label) {
|
|
35320
|
+
case 0:
|
|
35321
|
+
return [4
|
|
35322
|
+
/*yield*/
|
|
35323
|
+
, manager.close()];
|
|
35324
|
+
|
|
35325
|
+
case 1:
|
|
35326
|
+
return [2
|
|
35327
|
+
/*return*/
|
|
35328
|
+
, _a.sent()];
|
|
35329
|
+
}
|
|
35330
|
+
});
|
|
35331
|
+
});
|
|
35332
|
+
}, description);
|
|
35333
|
+
};
|
|
35334
|
+
/**
|
|
35335
|
+
* Creates and registers a fabricated job for processes that need to operate
|
|
35336
|
+
* with callbacks/hooks. The returned `resolve` and `reject`
|
|
35337
|
+
* functions can be used to signal the job is done successfully or not.
|
|
35338
|
+
* The returned `onTerminate` is a promise that will resolve when the
|
|
35339
|
+
* manager is requesting the termination of the job.
|
|
35340
|
+
*
|
|
35341
|
+
* @param description Optional description to help identify pending jobs.
|
|
35342
|
+
* @returns `{ resolve, reject, onTerminate }`
|
|
35343
|
+
*/
|
|
35344
|
+
|
|
35345
|
+
|
|
35346
|
+
BackgroundProcessManager.prototype.addHook = function (description) {
|
|
35347
|
+
// the resolve/reject functions we'll provide to the caller to signal
|
|
35348
|
+
// the state of the job.
|
|
35349
|
+
var resolve;
|
|
35350
|
+
var reject; // the underlying promise we'll use to manage it, pretty much like
|
|
35351
|
+
// any other promise.
|
|
35352
|
+
|
|
35353
|
+
var promise = new Promise(function (res, rej) {
|
|
35354
|
+
resolve = res;
|
|
35355
|
+
reject = rej;
|
|
35356
|
+
}); // the function we call when we want to try to terminate this job.
|
|
35357
|
+
|
|
35358
|
+
var terminate; // the promise the job can opt into listening to for termination.
|
|
35359
|
+
|
|
35360
|
+
var onTerminate = new Promise(function (resolveTerminate) {
|
|
35361
|
+
terminate = resolveTerminate;
|
|
35362
|
+
});
|
|
35363
|
+
this.registerPromise(promise, terminate, description);
|
|
35364
|
+
return {
|
|
35365
|
+
resolve: resolve,
|
|
35366
|
+
reject: reject,
|
|
35367
|
+
onTerminate: onTerminate
|
|
35368
|
+
};
|
|
35369
|
+
};
|
|
35370
|
+
/**
|
|
35371
|
+
* Adds a Promise based job to the list of jobs for monitoring and listens
|
|
35372
|
+
* for either a success or failure, upon which the job is considered "done"
|
|
35373
|
+
* and removed from the registry.
|
|
35374
|
+
*
|
|
35375
|
+
* @param promise A promise that is on its way to being returned to a
|
|
35376
|
+
* caller, which needs to be tracked as a background job.
|
|
35377
|
+
* @param terminate The termination function to register, which can be
|
|
35378
|
+
* invoked to request the job stop.
|
|
35379
|
+
* @param description Optional description to help identify pending jobs.
|
|
35380
|
+
*/
|
|
35381
|
+
|
|
35382
|
+
|
|
35383
|
+
BackgroundProcessManager.prototype.registerPromise = function (promise, terminate, description) {
|
|
35384
|
+
var _this = this;
|
|
35385
|
+
|
|
35386
|
+
var jobEntry = {
|
|
35387
|
+
promise: promise,
|
|
35388
|
+
terminate: terminate,
|
|
35389
|
+
description: description
|
|
35390
|
+
};
|
|
35391
|
+
this.jobs.add(jobEntry); // in all of my testing, it is safe to multi-subscribe to a promise.
|
|
35392
|
+
// so, rather than create another layer of promising, we're just going
|
|
35393
|
+
// to hook into the promise we already have, and when it's done
|
|
35394
|
+
// (successfully or not), we no longer need to wait for it upon close.
|
|
35395
|
+
//
|
|
35396
|
+
// sorry this is a bit hand-wavy:
|
|
35397
|
+
//
|
|
35398
|
+
// i believe we use `.then` and `.catch` instead of `.finally` because
|
|
35399
|
+
// `.finally` is invoked in a different order in the sequence, and this
|
|
35400
|
+
// breaks assumptions throughout and causes failures.
|
|
35401
|
+
|
|
35402
|
+
promise.then(function () {
|
|
35403
|
+
_this.jobs["delete"](jobEntry);
|
|
35404
|
+
})["catch"](function () {
|
|
35405
|
+
_this.jobs["delete"](jobEntry);
|
|
35406
|
+
});
|
|
35407
|
+
};
|
|
35408
|
+
|
|
35409
|
+
Object.defineProperty(BackgroundProcessManager.prototype, "length", {
|
|
35410
|
+
/**
|
|
35411
|
+
* The number of jobs being waited on.
|
|
35412
|
+
*
|
|
35413
|
+
* We don't use this for anything. It's just informational for the caller,
|
|
35414
|
+
* and can be used in logging and testing.
|
|
35415
|
+
*
|
|
35416
|
+
* @returns the number of jobs.
|
|
35417
|
+
*/
|
|
35418
|
+
get: function get() {
|
|
35419
|
+
return this.jobs.size;
|
|
35420
|
+
},
|
|
35421
|
+
enumerable: true,
|
|
35422
|
+
configurable: true
|
|
35423
|
+
});
|
|
35424
|
+
Object.defineProperty(BackgroundProcessManager.prototype, "state", {
|
|
35425
|
+
/**
|
|
35426
|
+
* The execution state of the manager. One of:
|
|
35427
|
+
*
|
|
35428
|
+
* 1. "Open" -> Accepting new jobs
|
|
35429
|
+
* 1. "Closing" -> Not accepting new work. Waiting for jobs to complete.
|
|
35430
|
+
* 1. "Closed" -> Not accepting new work. All submitted jobs are complete.
|
|
35431
|
+
*/
|
|
35432
|
+
get: function get() {
|
|
35433
|
+
return this._state;
|
|
35434
|
+
},
|
|
35435
|
+
enumerable: true,
|
|
35436
|
+
configurable: true
|
|
35437
|
+
});
|
|
35438
|
+
Object.defineProperty(BackgroundProcessManager.prototype, "pending", {
|
|
35439
|
+
/**
|
|
35440
|
+
* The registered `description` of all still-pending jobs.
|
|
35441
|
+
*
|
|
35442
|
+
* @returns descriptions as an array.
|
|
35443
|
+
*/
|
|
35444
|
+
get: function get() {
|
|
35445
|
+
return Array.from(this.jobs).map(function (job) {
|
|
35446
|
+
return job.description;
|
|
35447
|
+
});
|
|
35448
|
+
},
|
|
35449
|
+
enumerable: true,
|
|
35450
|
+
configurable: true
|
|
35451
|
+
});
|
|
35452
|
+
Object.defineProperty(BackgroundProcessManager.prototype, "isOpen", {
|
|
35453
|
+
/**
|
|
35454
|
+
* Whether the manager is accepting new jobs.
|
|
35455
|
+
*/
|
|
35456
|
+
get: function get() {
|
|
35457
|
+
return this._state === BackgroundProcessManagerState.Open;
|
|
35458
|
+
},
|
|
35459
|
+
enumerable: true,
|
|
35460
|
+
configurable: true
|
|
35461
|
+
});
|
|
35462
|
+
Object.defineProperty(BackgroundProcessManager.prototype, "isClosing", {
|
|
35463
|
+
/**
|
|
35464
|
+
* Whether the manager is rejecting new work, but still waiting for
|
|
35465
|
+
* submitted work to complete.
|
|
35466
|
+
*/
|
|
35467
|
+
get: function get() {
|
|
35468
|
+
return this._state === BackgroundProcessManagerState.Closing;
|
|
35469
|
+
},
|
|
35470
|
+
enumerable: true,
|
|
35471
|
+
configurable: true
|
|
35472
|
+
});
|
|
35473
|
+
Object.defineProperty(BackgroundProcessManager.prototype, "isClosed", {
|
|
35474
|
+
/**
|
|
35475
|
+
* Whether the manager is rejecting work and done waiting for submitted
|
|
35476
|
+
* work to complete.
|
|
35477
|
+
*/
|
|
35478
|
+
get: function get() {
|
|
35479
|
+
return this._state === BackgroundProcessManagerState.Closed;
|
|
35480
|
+
},
|
|
35481
|
+
enumerable: true,
|
|
35482
|
+
configurable: true
|
|
35483
|
+
});
|
|
35484
|
+
|
|
35485
|
+
BackgroundProcessManager.prototype.closedFailure = function (description) {
|
|
35486
|
+
if (!this.isOpen) {
|
|
35487
|
+
return Promise.reject(new Error(['The manager is closing or closed, which occurs after `close()` has been called.', "This error occurred trying to add \"" + description + "\".", "Pending jobs: [\n" + this.pending.map(function (t) {
|
|
35488
|
+
return ' ' + t;
|
|
35489
|
+
}).join(',\n') + "\n]"].join('\n')));
|
|
35490
|
+
}
|
|
35491
|
+
};
|
|
35492
|
+
/**
|
|
35493
|
+
* Signals jobs to stop (for those that accept interruptions) and waits
|
|
35494
|
+
* for confirmation that jobs have stopped.
|
|
35495
|
+
*
|
|
35496
|
+
* This immediately puts the manager into a closing state and just begins
|
|
35497
|
+
* to reject new work. After all work in the manager is complete, the
|
|
35498
|
+
* manager goes into a `Completed` state and `close()` returns.
|
|
35499
|
+
*
|
|
35500
|
+
* @returns The settled results of each job's promise.
|
|
35501
|
+
*/
|
|
35502
|
+
|
|
35503
|
+
|
|
35504
|
+
BackgroundProcessManager.prototype.close = function () {
|
|
35505
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
35506
|
+
var _a, _b, job, results;
|
|
35507
|
+
|
|
35508
|
+
var e_1, _c;
|
|
35509
|
+
|
|
35510
|
+
return __generator(this, function (_d) {
|
|
35511
|
+
switch (_d.label) {
|
|
35512
|
+
case 0:
|
|
35513
|
+
// prevents more jobs from being added
|
|
35514
|
+
this._state = BackgroundProcessManagerState.Closing;
|
|
35515
|
+
|
|
35516
|
+
try {
|
|
35517
|
+
for (_a = __values(Array.from(this.jobs)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
35518
|
+
job = _b.value;
|
|
35519
|
+
|
|
35520
|
+
try {
|
|
35521
|
+
job.terminate();
|
|
35522
|
+
} catch (error) {
|
|
35523
|
+
// Due to potential races with a job's natural completion, it's
|
|
35524
|
+
// reasonable to expect the termination call to fail. Hence,
|
|
35525
|
+
// not logging as an error.
|
|
35526
|
+
console.warn("Failed to send termination signal to job. Error: " + error.message, job);
|
|
35527
|
+
}
|
|
35528
|
+
}
|
|
35529
|
+
} catch (e_1_1) {
|
|
35530
|
+
e_1 = {
|
|
35531
|
+
error: e_1_1
|
|
35532
|
+
};
|
|
35533
|
+
} finally {
|
|
35534
|
+
try {
|
|
35535
|
+
if (_b && !_b.done && (_c = _a["return"])) _c.call(_a);
|
|
35536
|
+
} finally {
|
|
35537
|
+
if (e_1) throw e_1.error;
|
|
35538
|
+
}
|
|
35539
|
+
}
|
|
35540
|
+
|
|
35541
|
+
return [4
|
|
35542
|
+
/*yield*/
|
|
35543
|
+
, Promise.allSettled(Array.from(this.jobs).map(function (j) {
|
|
35544
|
+
return j.promise;
|
|
35545
|
+
}))];
|
|
35546
|
+
|
|
35547
|
+
case 1:
|
|
35548
|
+
results = _d.sent(); // At this point, we're already *not* accepting new work, and all
|
|
35549
|
+
// pending work is done. It's safe to set state to `Closed`. Any
|
|
35550
|
+
// process that's checking this property will be able to safely operate
|
|
35551
|
+
// on this value at this point.
|
|
35552
|
+
|
|
35553
|
+
this._state = BackgroundProcessManagerState.Closed;
|
|
35554
|
+
return [2
|
|
35555
|
+
/*return*/
|
|
35556
|
+
, results];
|
|
35557
|
+
}
|
|
35558
|
+
});
|
|
35559
|
+
});
|
|
35560
|
+
};
|
|
35561
|
+
|
|
35562
|
+
return BackgroundProcessManager;
|
|
35563
|
+
}();
|
|
35564
|
+
|
|
35565
|
+
|
|
35566
|
+
/**
|
|
35567
|
+
* All possible states a `BackgroundProcessManager` instance can be in.
|
|
35568
|
+
*/
|
|
35569
|
+
|
|
35570
|
+
var BackgroundProcessManagerState;
|
|
35571
|
+
|
|
35572
|
+
(function (BackgroundProcessManagerState) {
|
|
35573
|
+
/**
|
|
35574
|
+
* Accepting new jobs.
|
|
35575
|
+
*/
|
|
35576
|
+
BackgroundProcessManagerState["Open"] = "Open";
|
|
35577
|
+
/**
|
|
35578
|
+
* Not accepting new jobs. Waiting for submitted jobs to complete.
|
|
35579
|
+
*/
|
|
35580
|
+
|
|
35581
|
+
BackgroundProcessManagerState["Closing"] = "Closing";
|
|
35582
|
+
/**
|
|
35583
|
+
* Not accepting new jobs. All submitted jobs are complete.
|
|
35584
|
+
*/
|
|
35585
|
+
|
|
35586
|
+
BackgroundProcessManagerState["Closed"] = "Closed";
|
|
35587
|
+
})(BackgroundProcessManagerState || (BackgroundProcessManagerState = {}));
|
|
35588
|
+
|
|
35009
35589
|
/***/ }),
|
|
35010
35590
|
|
|
35011
35591
|
/***/ "./lib-esm/Util/Constants.js":
|
|
@@ -35380,6 +35960,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35380
35960
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jitteredBackoff", function() { return jitteredBackoff; });
|
|
35381
35961
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jitteredExponentialRetry", function() { return jitteredExponentialRetry; });
|
|
35382
35962
|
/* harmony import */ var _Logger_ConsoleLogger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Logger/ConsoleLogger */ "./lib-esm/Logger/ConsoleLogger.js");
|
|
35963
|
+
function _typeof(obj) {
|
|
35964
|
+
"@babel/helpers - typeof";
|
|
35965
|
+
|
|
35966
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
35967
|
+
return typeof obj;
|
|
35968
|
+
} : function (obj) {
|
|
35969
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
35970
|
+
}, _typeof(obj);
|
|
35971
|
+
}
|
|
35972
|
+
|
|
35383
35973
|
var __extends = undefined && undefined.__extends || function () {
|
|
35384
35974
|
var _extendStatics = function extendStatics(d, b) {
|
|
35385
35975
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -35614,80 +36204,142 @@ var isNonRetryableError = function isNonRetryableError(obj) {
|
|
|
35614
36204
|
*/
|
|
35615
36205
|
|
|
35616
36206
|
|
|
35617
|
-
function retry(functionToRetry, args, delayFn,
|
|
35618
|
-
if (attempt === void 0) {
|
|
35619
|
-
attempt = 1;
|
|
35620
|
-
}
|
|
35621
|
-
|
|
36207
|
+
function retry(functionToRetry, args, delayFn, onTerminate) {
|
|
35622
36208
|
return __awaiter(this, void 0, void 0, function () {
|
|
35623
|
-
var
|
|
36209
|
+
var _this = this;
|
|
36210
|
+
|
|
35624
36211
|
return __generator(this, function (_a) {
|
|
35625
|
-
|
|
35626
|
-
|
|
35627
|
-
|
|
35628
|
-
throw Error('functionToRetry must be a function');
|
|
35629
|
-
}
|
|
36212
|
+
if (typeof functionToRetry !== 'function') {
|
|
36213
|
+
throw Error('functionToRetry must be a function');
|
|
36214
|
+
}
|
|
35630
36215
|
|
|
35631
|
-
|
|
35632
|
-
|
|
36216
|
+
return [2
|
|
36217
|
+
/*return*/
|
|
36218
|
+
, new Promise(function (resolve, reject) {
|
|
36219
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
36220
|
+
var attempt, terminated, timeout, wakeUp, lastError, _loop_1, state_1;
|
|
35633
36221
|
|
|
35634
|
-
|
|
35635
|
-
|
|
36222
|
+
return __generator(this, function (_a) {
|
|
36223
|
+
switch (_a.label) {
|
|
36224
|
+
case 0:
|
|
36225
|
+
attempt = 0;
|
|
36226
|
+
terminated = false;
|
|
35636
36227
|
|
|
35637
|
-
|
|
35638
|
-
/*yield*/
|
|
35639
|
-
, functionToRetry.apply(void 0, __spread(args))];
|
|
36228
|
+
wakeUp = function wakeUp() {};
|
|
35640
36229
|
|
|
35641
|
-
|
|
35642
|
-
|
|
35643
|
-
|
|
35644
|
-
, _a.sent()];
|
|
36230
|
+
onTerminate && onTerminate.then(function () {
|
|
36231
|
+
// signal not to try anymore.
|
|
36232
|
+
terminated = true; // stop sleeping if we're sleeping.
|
|
35645
36233
|
|
|
35646
|
-
|
|
35647
|
-
|
|
35648
|
-
|
|
36234
|
+
clearTimeout(timeout);
|
|
36235
|
+
wakeUp();
|
|
36236
|
+
});
|
|
35649
36237
|
|
|
35650
|
-
|
|
35651
|
-
|
|
35652
|
-
throw err_1;
|
|
35653
|
-
}
|
|
36238
|
+
_loop_1 = function _loop_1() {
|
|
36239
|
+
var _a, _b, err_1, retryIn_1;
|
|
35654
36240
|
|
|
35655
|
-
|
|
35656
|
-
|
|
35657
|
-
|
|
35658
|
-
|
|
35659
|
-
|
|
35660
|
-
|
|
35661
|
-
/*yield*/
|
|
35662
|
-
, new Promise(function (res) {
|
|
35663
|
-
return setTimeout(res, retryIn_1);
|
|
35664
|
-
})];
|
|
36241
|
+
return __generator(this, function (_c) {
|
|
36242
|
+
switch (_c.label) {
|
|
36243
|
+
case 0:
|
|
36244
|
+
attempt++;
|
|
36245
|
+
logger.debug(functionToRetry.name + " attempt #" + attempt + " with this vars: " + JSON.stringify(args));
|
|
36246
|
+
_c.label = 1;
|
|
35665
36247
|
|
|
35666
|
-
|
|
35667
|
-
|
|
36248
|
+
case 1:
|
|
36249
|
+
_c.trys.push([1, 3,, 7]);
|
|
36250
|
+
|
|
36251
|
+
_a = {};
|
|
36252
|
+
_b = resolve;
|
|
36253
|
+
return [4
|
|
36254
|
+
/*yield*/
|
|
36255
|
+
, functionToRetry.apply(void 0, __spread(args))];
|
|
36256
|
+
|
|
36257
|
+
case 2:
|
|
36258
|
+
return [2
|
|
36259
|
+
/*return*/
|
|
36260
|
+
, (_a.value = _b.apply(void 0, [_c.sent()]), _a)];
|
|
36261
|
+
|
|
36262
|
+
case 3:
|
|
36263
|
+
err_1 = _c.sent();
|
|
36264
|
+
lastError = err_1;
|
|
36265
|
+
logger.debug("error on " + functionToRetry.name, err_1);
|
|
36266
|
+
|
|
36267
|
+
if (isNonRetryableError(err_1)) {
|
|
36268
|
+
logger.debug(functionToRetry.name + " non retryable error", err_1);
|
|
36269
|
+
return [2
|
|
36270
|
+
/*return*/
|
|
36271
|
+
, {
|
|
36272
|
+
value: reject(err_1)
|
|
36273
|
+
}];
|
|
36274
|
+
}
|
|
36275
|
+
|
|
36276
|
+
retryIn_1 = delayFn(attempt, args, err_1);
|
|
36277
|
+
logger.debug(functionToRetry.name + " retrying in " + retryIn_1 + " ms");
|
|
36278
|
+
if (!(retryIn_1 === false || terminated)) return [3
|
|
36279
|
+
/*break*/
|
|
36280
|
+
, 4];
|
|
36281
|
+
return [2
|
|
36282
|
+
/*return*/
|
|
36283
|
+
, {
|
|
36284
|
+
value: reject(err_1)
|
|
36285
|
+
}];
|
|
35668
36286
|
|
|
35669
|
-
|
|
35670
|
-
|
|
35671
|
-
|
|
36287
|
+
case 4:
|
|
36288
|
+
return [4
|
|
36289
|
+
/*yield*/
|
|
36290
|
+
, new Promise(function (r) {
|
|
36291
|
+
wakeUp = r; // export wakeUp for onTerminate handling
|
|
35672
36292
|
|
|
35673
|
-
|
|
35674
|
-
|
|
35675
|
-
/*return*/
|
|
35676
|
-
, _a.sent()];
|
|
36293
|
+
timeout = setTimeout(wakeUp, retryIn_1);
|
|
36294
|
+
})];
|
|
35677
36295
|
|
|
35678
|
-
|
|
35679
|
-
|
|
36296
|
+
case 5:
|
|
36297
|
+
_c.sent();
|
|
35680
36298
|
|
|
35681
|
-
|
|
35682
|
-
return [3
|
|
35683
|
-
/*break*/
|
|
35684
|
-
, 8];
|
|
36299
|
+
_c.label = 6;
|
|
35685
36300
|
|
|
35686
|
-
|
|
35687
|
-
|
|
35688
|
-
|
|
35689
|
-
|
|
35690
|
-
|
|
36301
|
+
case 6:
|
|
36302
|
+
return [3
|
|
36303
|
+
/*break*/
|
|
36304
|
+
, 7];
|
|
36305
|
+
|
|
36306
|
+
case 7:
|
|
36307
|
+
return [2
|
|
36308
|
+
/*return*/
|
|
36309
|
+
];
|
|
36310
|
+
}
|
|
36311
|
+
});
|
|
36312
|
+
};
|
|
36313
|
+
|
|
36314
|
+
_a.label = 1;
|
|
36315
|
+
|
|
36316
|
+
case 1:
|
|
36317
|
+
if (!!terminated) return [3
|
|
36318
|
+
/*break*/
|
|
36319
|
+
, 3];
|
|
36320
|
+
return [5
|
|
36321
|
+
/*yield**/
|
|
36322
|
+
, _loop_1()];
|
|
36323
|
+
|
|
36324
|
+
case 2:
|
|
36325
|
+
state_1 = _a.sent();
|
|
36326
|
+
if (_typeof(state_1) === "object") return [2
|
|
36327
|
+
/*return*/
|
|
36328
|
+
, state_1.value];
|
|
36329
|
+
return [3
|
|
36330
|
+
/*break*/
|
|
36331
|
+
, 1];
|
|
36332
|
+
|
|
36333
|
+
case 3:
|
|
36334
|
+
// reached if terminated while waiting for a timer.
|
|
36335
|
+
reject(lastError);
|
|
36336
|
+
return [2
|
|
36337
|
+
/*return*/
|
|
36338
|
+
];
|
|
36339
|
+
}
|
|
36340
|
+
});
|
|
36341
|
+
});
|
|
36342
|
+
})];
|
|
35691
36343
|
});
|
|
35692
36344
|
});
|
|
35693
36345
|
}
|
|
@@ -35714,12 +36366,12 @@ function jitteredBackoff(maxDelayMs) {
|
|
|
35714
36366
|
* Internal use of Amplify only
|
|
35715
36367
|
*/
|
|
35716
36368
|
|
|
35717
|
-
var jitteredExponentialRetry = function jitteredExponentialRetry(functionToRetry, args, maxDelayMs) {
|
|
36369
|
+
var jitteredExponentialRetry = function jitteredExponentialRetry(functionToRetry, args, maxDelayMs, onTerminate) {
|
|
35718
36370
|
if (maxDelayMs === void 0) {
|
|
35719
36371
|
maxDelayMs = MAX_DELAY_MS;
|
|
35720
36372
|
}
|
|
35721
36373
|
|
|
35722
|
-
return retry(functionToRetry, args, jitteredBackoff(maxDelayMs));
|
|
36374
|
+
return retry(functionToRetry, args, jitteredBackoff(maxDelayMs), onTerminate);
|
|
35723
36375
|
};
|
|
35724
36376
|
|
|
35725
36377
|
/***/ }),
|
|
@@ -35752,7 +36404,7 @@ function urlSafeDecode(hex) {
|
|
|
35752
36404
|
/*!*******************************!*\
|
|
35753
36405
|
!*** ./lib-esm/Util/index.js ***!
|
|
35754
36406
|
\*******************************/
|
|
35755
|
-
/*! exports provided: NonRetryableError, retry, jitteredBackoff, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES */
|
|
36407
|
+
/*! exports provided: NonRetryableError, retry, jitteredBackoff, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, BackgroundProcessManager, BackgroundProcessManagerState */
|
|
35756
36408
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35757
36409
|
|
|
35758
36410
|
"use strict";
|
|
@@ -35795,6 +36447,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35795
36447
|
|
|
35796
36448
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["RETRY_ERROR_CODES"]; });
|
|
35797
36449
|
|
|
36450
|
+
/* harmony import */ var _BackgroundProcessManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BackgroundProcessManager */ "./lib-esm/Util/BackgroundProcessManager.js");
|
|
36451
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BackgroundProcessManager", function() { return _BackgroundProcessManager__WEBPACK_IMPORTED_MODULE_6__["BackgroundProcessManager"]; });
|
|
36452
|
+
|
|
36453
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BackgroundProcessManagerState", function() { return _BackgroundProcessManager__WEBPACK_IMPORTED_MODULE_6__["BackgroundProcessManagerState"]; });
|
|
36454
|
+
|
|
36455
|
+
|
|
35798
36456
|
|
|
35799
36457
|
|
|
35800
36458
|
|
|
@@ -35848,7 +36506,7 @@ var USER_AGENT_HEADER = 'x-amz-user-agent';
|
|
|
35848
36506
|
/*!**************************!*\
|
|
35849
36507
|
!*** ./lib-esm/index.js ***!
|
|
35850
36508
|
\**************************/
|
|
35851
|
-
/*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredBackoff, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, Amplify, default */
|
|
36509
|
+
/*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredBackoff, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, BackgroundProcessManager, BackgroundProcessManagerState, Amplify, default */
|
|
35852
36510
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35853
36511
|
|
|
35854
36512
|
"use strict";
|
|
@@ -35989,6 +36647,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35989
36647
|
|
|
35990
36648
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["RETRY_ERROR_CODES"]; });
|
|
35991
36649
|
|
|
36650
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BackgroundProcessManager", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["BackgroundProcessManager"]; });
|
|
36651
|
+
|
|
36652
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BackgroundProcessManagerState", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["BackgroundProcessManagerState"]; });
|
|
36653
|
+
|
|
35992
36654
|
/*
|
|
35993
36655
|
* Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
35994
36656
|
*
|