studiokit-scaffolding-js 4.7.1-alpha.5 → 4.7.1
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/utils/url.js +6 -8
- package/package.json +3 -3
package/lib/utils/url.js
CHANGED
|
@@ -75,7 +75,8 @@ function isUrlValid(url) {
|
|
|
75
75
|
return /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+$/.test(url);
|
|
76
76
|
}
|
|
77
77
|
exports.isUrlValid = isUrlValid;
|
|
78
|
-
|
|
78
|
+
/** The total number of tries for `fetchText`, including the initial request. */
|
|
79
|
+
var TRY_LIMIT = 5;
|
|
79
80
|
function wait(time) {
|
|
80
81
|
return new Promise(function (resolve) {
|
|
81
82
|
setTimeout(resolve, time);
|
|
@@ -83,16 +84,14 @@ function wait(time) {
|
|
|
83
84
|
}
|
|
84
85
|
function fetchText(url, options) {
|
|
85
86
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
var tryCount,
|
|
87
|
+
var tryCount, resp, text, error_1;
|
|
87
88
|
return __generator(this, function (_a) {
|
|
88
89
|
switch (_a.label) {
|
|
89
90
|
case 0:
|
|
90
91
|
tryCount = 0;
|
|
91
|
-
didFail = false;
|
|
92
92
|
_a.label = 1;
|
|
93
93
|
case 1:
|
|
94
94
|
tryCount++;
|
|
95
|
-
didFail = false;
|
|
96
95
|
_a.label = 2;
|
|
97
96
|
case 2:
|
|
98
97
|
_a.trys.push([2, 5, , 8]);
|
|
@@ -105,18 +104,17 @@ function fetchText(url, options) {
|
|
|
105
104
|
return [2 /*return*/, text];
|
|
106
105
|
case 5:
|
|
107
106
|
error_1 = _a.sent();
|
|
108
|
-
didFail = true;
|
|
109
107
|
logger_1.getLogger().error("Failed to fetch " + url + ". attempt: " + tryCount + ", error: " + error_1);
|
|
110
|
-
if (!(tryCount <
|
|
108
|
+
if (!(tryCount < TRY_LIMIT)) return [3 /*break*/, 7];
|
|
111
109
|
return [4 /*yield*/, wait(Math.pow(2, (tryCount - 1)) * 100)]; // 100, 200, 400, 800
|
|
112
110
|
case 6:
|
|
113
111
|
_a.sent(); // 100, 200, 400, 800
|
|
114
112
|
_a.label = 7;
|
|
115
113
|
case 7: return [3 /*break*/, 8];
|
|
116
114
|
case 8:
|
|
117
|
-
if (tryCount <
|
|
115
|
+
if (tryCount < TRY_LIMIT) return [3 /*break*/, 1];
|
|
118
116
|
_a.label = 9;
|
|
119
|
-
case 9: throw new Error("Failed to fetch " + url + " after " +
|
|
117
|
+
case 9: throw new Error("Failed to fetch " + url + " after " + TRY_LIMIT + " attempts.");
|
|
120
118
|
}
|
|
121
119
|
});
|
|
122
120
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "studiokit-scaffolding-js",
|
|
3
|
-
"version": "4.7.1
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "Common scaffolding for Studio apps at Purdue",
|
|
5
5
|
"repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"lodash": "^4.17.20",
|
|
93
93
|
"mixin-deep": "^1.3.2",
|
|
94
94
|
"set-value": "^2.0.1",
|
|
95
|
-
"studiokit-net-js": "^4.1.
|
|
95
|
+
"studiokit-net-js": "^4.1.4"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@material-ui/core": "^4.11.3",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"redux-saga": "^1.1.3",
|
|
149
149
|
"studiokit-auth-js": "^3.0.2",
|
|
150
150
|
"studiokit-caliper-js": "^1.0.23",
|
|
151
|
-
"studiokit-net-js": "^4.1.
|
|
151
|
+
"studiokit-net-js": "^4.1.4",
|
|
152
152
|
"tachyons": "^4.12.0",
|
|
153
153
|
"tslib": "^2.1.0",
|
|
154
154
|
"uuid": "^8.3.2"
|