@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 +1 -1
- package/src/SizeOf.d.ts +1 -0
- package/src/SizeOf.js +26 -0
- package/src/StatsigMetadata.d.ts +1 -1
- package/src/StatsigMetadata.js +1 -1
- package/src/StatsigPlugin.d.ts +1 -1
- package/src/TypingUtils.js +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
package/src/SizeOf.d.ts
ADDED
|
@@ -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;
|
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 = '3.
|
|
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
|
package/src/StatsigPlugin.d.ts
CHANGED
|
@@ -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
|
};
|
package/src/TypingUtils.js
CHANGED
|
@@ -6,7 +6,7 @@ function _typeOf(input) {
|
|
|
6
6
|
}
|
|
7
7
|
exports._typeOf = _typeOf;
|
|
8
8
|
function _isTypeMatch(a, b) {
|
|
9
|
-
const 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);
|