@statsig/client-core 3.19.0 → 3.20.1

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.19.0",
3
+ "version": "3.20.1",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -0,0 +1 @@
1
+ export declare const _fastApproxSizeOf: (obj: Record<string, unknown> | Array<unknown>, max: number) => number;
package/src/SizeOf.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._fastApproxSizeOf = void 0;
4
+ const CURLY_AND_SQUARE_BRACKET_SIZE = 2; // [] for array, {} for object
5
+ const APPROX_ADDITIONAL_SIZE = 1; // additional size for comma and stuff
6
+ const _fastApproxSizeOf = (obj, max) => {
7
+ let size = 0;
8
+ const keys = Object.keys(obj);
9
+ for (let i = 0; i < keys.length; i++) {
10
+ const key = keys[i];
11
+ const value = obj[key];
12
+ size += key.length;
13
+ if (typeof value === 'object' && value !== null) {
14
+ size += (0, exports._fastApproxSizeOf)(value, max) + CURLY_AND_SQUARE_BRACKET_SIZE;
15
+ }
16
+ else {
17
+ size += String(value).length + APPROX_ADDITIONAL_SIZE;
18
+ }
19
+ if (size >= max) {
20
+ // exit early if we've exceeded the max
21
+ return size;
22
+ }
23
+ }
24
+ return size;
25
+ };
26
+ exports._fastApproxSizeOf = _fastApproxSizeOf;
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "3.19.0";
1
+ export declare const SDK_VERSION = "3.20.1";
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.19.0';
4
+ exports.SDK_VERSION = '3.20.1';
5
5
  let metadata = {
6
6
  sdkVersion: exports.SDK_VERSION,
7
7
  sdkType: 'js-mono', // js-mono is overwritten by Precomp and OnDevice clients
@@ -1,5 +1,5 @@
1
1
  import { StatsigClientInterface } from './ClientInterfaces';
2
2
  export type StatsigPlugin<T extends StatsigClientInterface> = {
3
- readonly __plugin: 'session-replay' | 'auto-capture' | 'triggered-session-replay';
3
+ readonly __plugin: 'session-replay' | 'auto-capture' | 'triggered-session-replay' | 'cli-session-replay-node' | (string & {});
4
4
  bind: (client: T) => void;
5
5
  };
@@ -6,7 +6,7 @@ function _typeOf(input) {
6
6
  }
7
7
  exports._typeOf = _typeOf;
8
8
  function _isTypeMatch(a, b) {
9
- const typeOf = (x) => (Array.isArray(x) ? 'array' : typeof x);
9
+ const typeOf = (x) => Array.isArray(x) ? 'array' : x === null ? 'null' : typeof x;
10
10
  return typeOf(a) === typeOf(b);
11
11
  }
12
12
  exports._isTypeMatch = _isTypeMatch;
package/src/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export * from './ParamStoreTypes';
24
24
  export * from './SafeJs';
25
25
  export * from './SDKType';
26
26
  export * from './SessionID';
27
+ export * from './SizeOf';
27
28
  export * from './StableID';
28
29
  export * from './StatsigClientBase';
29
30
  export * from './StatsigClientEventEmitter';
package/src/index.js CHANGED
@@ -47,6 +47,7 @@ __exportStar(require("./ParamStoreTypes"), exports);
47
47
  __exportStar(require("./SafeJs"), exports);
48
48
  __exportStar(require("./SDKType"), exports);
49
49
  __exportStar(require("./SessionID"), exports);
50
+ __exportStar(require("./SizeOf"), exports);
50
51
  __exportStar(require("./StableID"), exports);
51
52
  __exportStar(require("./StatsigClientBase"), exports);
52
53
  __exportStar(require("./StatsigClientEventEmitter"), exports);