@statsig/client-core 1.1.0 → 1.2.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.d.ts +0 -1
- package/src/NetworkCore.js +1 -24
- package/src/StatsigMetadata.d.ts +1 -1
- package/src/StatsigMetadata.js +1 -1
package/package.json
CHANGED
package/src/NetworkCore.d.ts
CHANGED
package/src/NetworkCore.js
CHANGED
|
@@ -44,9 +44,6 @@ class NetworkCore {
|
|
|
44
44
|
if (args.isStatsigEncodable) {
|
|
45
45
|
body = this._attemptToEncodeString(args, body);
|
|
46
46
|
}
|
|
47
|
-
else if (args.isCompressable) {
|
|
48
|
-
body = yield this._attemptToCompressBody(args, body);
|
|
49
|
-
}
|
|
50
47
|
return this._sendRequest(Object.assign({ method: 'POST', body }, args));
|
|
51
48
|
});
|
|
52
49
|
}
|
|
@@ -62,8 +59,7 @@ class NetworkCore {
|
|
|
62
59
|
if (!_ensureValidSdkKey(args)) {
|
|
63
60
|
return false;
|
|
64
61
|
}
|
|
65
|
-
|
|
66
|
-
body = yield this._attemptToCompressBody(args, body);
|
|
62
|
+
const body = yield this._getPopulatedBody(args);
|
|
67
63
|
const url = yield this._getPopulatedURL(args);
|
|
68
64
|
const nav = navigator;
|
|
69
65
|
return nav.sendBeacon.bind(nav)(url, body);
|
|
@@ -162,25 +158,6 @@ class NetworkCore {
|
|
|
162
158
|
return input;
|
|
163
159
|
}
|
|
164
160
|
}
|
|
165
|
-
_attemptToCompressBody(args, body) {
|
|
166
|
-
var _a;
|
|
167
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
if (!args.isCompressable ||
|
|
169
|
-
this._options.disableCompression ||
|
|
170
|
-
(0, __StatsigGlobal_1._getStatsigGlobalFlag)('no-compress') != null ||
|
|
171
|
-
typeof CompressionStream === 'undefined' ||
|
|
172
|
-
typeof TextEncoder === 'undefined') {
|
|
173
|
-
return body;
|
|
174
|
-
}
|
|
175
|
-
const bytes = new TextEncoder().encode(body);
|
|
176
|
-
const stream = new CompressionStream('gzip');
|
|
177
|
-
const writer = stream.writable.getWriter();
|
|
178
|
-
writer.write(bytes).catch(Log_1.Log.error);
|
|
179
|
-
writer.close().catch(Log_1.Log.error);
|
|
180
|
-
args.params = Object.assign(Object.assign({}, ((_a = args.params) !== null && _a !== void 0 ? _a : {})), { [NetworkConfig_1.NetworkParam.IsGzipped]: '1' });
|
|
181
|
-
return yield new Response(stream.readable).arrayBuffer();
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
161
|
}
|
|
185
162
|
exports.NetworkCore = NetworkCore;
|
|
186
163
|
const _ensureValidSdkKey = (args) => {
|
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.
|
|
4
|
+
exports.SDK_VERSION = '1.2.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
|