flagsmith-nodejs 3.3.2 → 3.3.3
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/build/sdk/utils.js +10 -3
- package/package.json +1 -1
- package/sdk/utils.ts +9 -1
package/build/sdk/utils.js
CHANGED
|
@@ -87,11 +87,18 @@ var retryFetch = function (url, fetchOptions, retries, timeout // set an overall
|
|
|
87
87
|
};
|
|
88
88
|
var requestWrapper = function () {
|
|
89
89
|
return new Promise(function (resolve, reject) {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
var timeoutId;
|
|
91
|
+
if (timeout) {
|
|
92
|
+
timeoutId = setTimeout(function () { return reject('error: timeout'); }, timeout);
|
|
93
|
+
}
|
|
92
94
|
return (0, node_fetch_1.default)(url, fetchOptions)
|
|
93
95
|
.then(function (res) { return resolve(res); })
|
|
94
|
-
.catch(function (err) { return reject(err); })
|
|
96
|
+
.catch(function (err) { return reject(err); })
|
|
97
|
+
.finally(function () {
|
|
98
|
+
if (timeoutId) {
|
|
99
|
+
clearTimeout(timeoutId);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
95
102
|
});
|
|
96
103
|
};
|
|
97
104
|
retryWrapper(retries);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flagsmith-nodejs",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "Flagsmith lets you manage features flags and remote config across web, mobile and server side applications. Deliver true Continuous Integration. Get builds out faster. Control who has access to new features.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"repository": {
|
package/sdk/utils.ts
CHANGED
|
@@ -38,10 +38,18 @@ export const retryFetch = (
|
|
|
38
38
|
|
|
39
39
|
const requestWrapper = (): Promise<Response> => {
|
|
40
40
|
return new Promise((resolve, reject) => {
|
|
41
|
-
|
|
41
|
+
let timeoutId: NodeJS.Timeout;
|
|
42
|
+
if (timeout) {
|
|
43
|
+
timeoutId = setTimeout(() => reject('error: timeout'), timeout);
|
|
44
|
+
}
|
|
42
45
|
return fetch(url, fetchOptions)
|
|
43
46
|
.then(res => resolve(res))
|
|
44
47
|
.catch(err => reject(err))
|
|
48
|
+
.finally(() => {
|
|
49
|
+
if (timeoutId) {
|
|
50
|
+
clearTimeout(timeoutId);
|
|
51
|
+
}
|
|
52
|
+
})
|
|
45
53
|
})
|
|
46
54
|
}
|
|
47
55
|
|