@statsig/client-core 3.25.6 → 3.26.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/package.json +1 -1
- package/src/NetworkCore.js +8 -19
- package/src/StatsigMetadata.d.ts +1 -1
- package/src/StatsigMetadata.js +1 -1
package/package.json
CHANGED
package/src/NetworkCore.js
CHANGED
|
@@ -108,12 +108,7 @@ class NetworkCore {
|
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
110
110
|
const currentAttempt = attempt !== null && attempt !== void 0 ? attempt : 1;
|
|
111
|
-
const abortController = typeof AbortController !== 'undefined' ? new AbortController() : null;
|
|
112
111
|
let reqTimedOut = false;
|
|
113
|
-
const timeoutHandle = setTimeout(() => {
|
|
114
|
-
reqTimedOut = true;
|
|
115
|
-
abortController === null || abortController === void 0 ? void 0 : abortController.abort();
|
|
116
|
-
}, this._timeout);
|
|
117
112
|
const populatedUrl = this._getPopulatedURL(args);
|
|
118
113
|
let response = null;
|
|
119
114
|
const keepalive = (0, VisibilityObserving_1._isUnloading)();
|
|
@@ -122,7 +117,6 @@ class NetworkCore {
|
|
|
122
117
|
method,
|
|
123
118
|
body,
|
|
124
119
|
headers: Object.assign({}, args.headers),
|
|
125
|
-
signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
|
|
126
120
|
priority: args.priority,
|
|
127
121
|
keepalive,
|
|
128
122
|
};
|
|
@@ -133,21 +127,16 @@ class NetworkCore {
|
|
|
133
127
|
this._leakyBucket[endpoint] = bucket;
|
|
134
128
|
}
|
|
135
129
|
const func = (_a = this._netConfig.networkOverrideFunc) !== null && _a !== void 0 ? _a : fetch;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
else {
|
|
142
|
-
// Fallback path: Promise.race timeout
|
|
143
|
-
response = yield Promise.race([
|
|
144
|
-
func(populatedUrl, config),
|
|
145
|
-
new Promise((_, reject) => setTimeout(() => {
|
|
130
|
+
let timeoutId;
|
|
131
|
+
response = yield Promise.race([
|
|
132
|
+
func(populatedUrl, config).finally(() => clearTimeout(timeoutId)),
|
|
133
|
+
new Promise((_, reject) => {
|
|
134
|
+
timeoutId = setTimeout(() => {
|
|
146
135
|
reqTimedOut = true;
|
|
147
136
|
reject(new Error(`Timeout of ${this._timeout}ms expired.`));
|
|
148
|
-
}, this._timeout)
|
|
149
|
-
|
|
150
|
-
|
|
137
|
+
}, this._timeout);
|
|
138
|
+
}),
|
|
139
|
+
]);
|
|
151
140
|
if (!response.ok) {
|
|
152
141
|
const text = yield response.text().catch(() => 'No Text');
|
|
153
142
|
const err = new Error(`NetworkError: ${populatedUrl} ${text}`);
|
package/src/StatsigMetadata.d.ts
CHANGED
package/src/StatsigMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatsigMetadataProvider = exports.SDK_VERSION = void 0;
|
|
4
|
-
exports.SDK_VERSION = '3.
|
|
4
|
+
exports.SDK_VERSION = '3.26.0';
|
|
5
5
|
let metadata = {
|
|
6
6
|
sdkVersion: exports.SDK_VERSION,
|
|
7
7
|
sdkType: 'js-mono', // js-mono is overwritten by Precomp and OnDevice clients
|