@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/client-core",
3
- "version": "3.25.6",
3
+ "version": "3.26.0",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -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
- if (abortController) {
137
- // Modern path: true cancellation with AbortController
138
- response = yield func(populatedUrl, config);
139
- clearTimeout(timeoutHandle);
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}`);
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "3.25.6";
1
+ export declare const SDK_VERSION = "3.26.0";
2
2
  export type StatsigMetadata = {
3
3
  readonly [key: string]: string | undefined | null;
4
4
  readonly appVersion?: string;
@@ -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.25.6';
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