@statsig/client-core 1.8.0-beta.13 → 1.8.0-beta.14
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 +12 -37
- package/src/StatsigMetadata.d.ts +1 -1
- package/src/StatsigMetadata.js +1 -1
package/package.json
CHANGED
package/src/NetworkCore.js
CHANGED
|
@@ -95,16 +95,25 @@ class NetworkCore {
|
|
|
95
95
|
controller === null || controller === void 0 ? void 0 : controller.abort(`Timeout of ${this._timeout}ms expired.`);
|
|
96
96
|
}, this._timeout);
|
|
97
97
|
const proxyUrl = (_a = args.proxyUrl) !== null && _a !== void 0 ? _a : this._proxy.getProxyUrl(args.sdkKey, args.url);
|
|
98
|
-
console.log('1');
|
|
99
98
|
const url = yield this._getPopulatedURL(Object.assign({ proxyUrl }, args));
|
|
100
|
-
console.log('2');
|
|
101
99
|
const isProxy = !url.includes('https://statsigapi.net/v1');
|
|
102
100
|
const parsedUrl = new URL(url);
|
|
103
101
|
const endpoint = parsedUrl.pathname;
|
|
104
102
|
let response = null;
|
|
105
103
|
const keepalive = (0, VisibilityObserving_1._isUnloading)();
|
|
106
|
-
console.log('3');
|
|
107
104
|
try {
|
|
105
|
+
if (!url.includes('https://prodregistryv2.org')) {
|
|
106
|
+
this.networkEvents.push({
|
|
107
|
+
value: isProxy ? 'proxy' : 'statsig',
|
|
108
|
+
eventName: 'proxy::network_request_tracking',
|
|
109
|
+
metadata: {
|
|
110
|
+
url,
|
|
111
|
+
endpoint,
|
|
112
|
+
},
|
|
113
|
+
time: Date.now(),
|
|
114
|
+
user: null,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
108
117
|
const config = {
|
|
109
118
|
method,
|
|
110
119
|
body,
|
|
@@ -113,7 +122,6 @@ class NetworkCore {
|
|
|
113
122
|
priority: args.priority,
|
|
114
123
|
keepalive,
|
|
115
124
|
};
|
|
116
|
-
console.log('3');
|
|
117
125
|
if (args.isInitialize) {
|
|
118
126
|
Diagnostics_1.Diagnostics._markInitNetworkReqStart(args.sdkKey, {
|
|
119
127
|
attempt: currentAttempt,
|
|
@@ -122,11 +130,9 @@ class NetworkCore {
|
|
|
122
130
|
const func = (_b = this._netConfig.networkOverrideFunc) !== null && _b !== void 0 ? _b : fetch;
|
|
123
131
|
response = yield func(url, config);
|
|
124
132
|
clearTimeout(handle);
|
|
125
|
-
console.log('4');
|
|
126
133
|
if (!response.ok) {
|
|
127
134
|
const text = yield response.text().catch(() => 'No Text');
|
|
128
135
|
const err = new Error(`NetworkError: ${url} ${text}`);
|
|
129
|
-
console.log('response not ok!!', err);
|
|
130
136
|
err.name = 'NetworkError';
|
|
131
137
|
throw err;
|
|
132
138
|
}
|
|
@@ -134,42 +140,12 @@ class NetworkCore {
|
|
|
134
140
|
if (args.isInitialize) {
|
|
135
141
|
Diagnostics_1.Diagnostics._markInitNetworkReqEnd(args.sdkKey, Diagnostics_1.Diagnostics._getDiagnosticsData(response, currentAttempt, text));
|
|
136
142
|
}
|
|
137
|
-
console.log('network success!!');
|
|
138
|
-
if (!url.includes('https://prodregistryv2.org')) {
|
|
139
|
-
console.log('pushing success network event!!');
|
|
140
|
-
this.networkEvents.push({
|
|
141
|
-
value: isProxy ? 'proxy' : 'statsig',
|
|
142
|
-
eventName: 'proxy::network_request_tracking',
|
|
143
|
-
metadata: {
|
|
144
|
-
url,
|
|
145
|
-
success: true,
|
|
146
|
-
endpoint,
|
|
147
|
-
},
|
|
148
|
-
time: Date.now(),
|
|
149
|
-
user: null,
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
143
|
return {
|
|
153
144
|
body: text,
|
|
154
145
|
code: response.status,
|
|
155
146
|
};
|
|
156
147
|
}
|
|
157
148
|
catch (error) {
|
|
158
|
-
console.log('network error!!', error);
|
|
159
|
-
if (!url.includes('https://prodregistryv2.org')) {
|
|
160
|
-
console.log('pushing failure network event!!');
|
|
161
|
-
this.networkEvents.push({
|
|
162
|
-
value: isProxy ? 'proxy' : 'statsig',
|
|
163
|
-
eventName: 'proxy::network_request_tracking',
|
|
164
|
-
metadata: {
|
|
165
|
-
url,
|
|
166
|
-
success: false,
|
|
167
|
-
endpoint,
|
|
168
|
-
},
|
|
169
|
-
time: Date.now(),
|
|
170
|
-
user: null,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
149
|
const errorMessage = _getErrorMessage(controller, error);
|
|
174
150
|
const timedOut = _didTimeout(controller);
|
|
175
151
|
if (args.isInitialize) {
|
|
@@ -238,7 +214,6 @@ class NetworkCore {
|
|
|
238
214
|
}
|
|
239
215
|
_flushNetworkEvents() {
|
|
240
216
|
var _a;
|
|
241
|
-
console.log('flushing network events!!', this.networkEvents);
|
|
242
217
|
if (this.networkEvents.length === 0) {
|
|
243
218
|
return;
|
|
244
219
|
}
|
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 = '1.8.0-beta.
|
|
4
|
+
exports.SDK_VERSION = '1.8.0-beta.14';
|
|
5
5
|
let metadata = {
|
|
6
6
|
sdkVersion: exports.SDK_VERSION,
|
|
7
7
|
sdkType: 'js-mono', // js-mono is overwritten by Precomp and OnDevice clients
|