@statsig/client-core 1.1.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/client-core",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "dependencies": {},
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -35,6 +35,5 @@ export declare class NetworkCore {
35
35
  private _getPopulatedURL;
36
36
  private _getPopulatedBody;
37
37
  private _attemptToEncodeString;
38
- private _attemptToCompressBody;
39
38
  }
40
39
  export {};
@@ -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
- let body = yield this._getPopulatedBody(args);
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) => {
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "1.1.1";
1
+ export declare const SDK_VERSION = "1.2.0";
2
2
  export type StatsigMetadata = {
3
3
  readonly [key: string]: string | undefined;
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 = '1.1.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