@statsig/statsig-node-core 0.1.0-beta.2 → 0.1.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/error-boundary.d.ts +5 -0
- package/error_boundary.js +51 -0
- package/package.json +9 -9
- package/statsig-generated.d.ts +11 -0
- package/statsig-generated.js +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorBoundary = void 0;
|
|
4
|
+
class ErrorBoundary {
|
|
5
|
+
static wrap(instance) {
|
|
6
|
+
try {
|
|
7
|
+
const obj = instance;
|
|
8
|
+
_getAllInstanceMethodNames(obj).forEach((name) => {
|
|
9
|
+
const original = obj[name];
|
|
10
|
+
if ('$EB' in original) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
obj[name] = (...args) => {
|
|
14
|
+
return this._capture(name, () => original.apply(instance, args));
|
|
15
|
+
};
|
|
16
|
+
obj[name].$EB = true;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
this._onError('eb:wrap', err);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
static _capture(tag, task) {
|
|
24
|
+
try {
|
|
25
|
+
const res = task();
|
|
26
|
+
if (res && res instanceof Promise) {
|
|
27
|
+
return res.catch((err) => this._onError(tag, err));
|
|
28
|
+
}
|
|
29
|
+
return res;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
this._onError(tag, error);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
static _onError(tag, error) {
|
|
37
|
+
console.error(tag, error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
41
|
+
function _getAllInstanceMethodNames(instance) {
|
|
42
|
+
const names = new Set();
|
|
43
|
+
let proto = Object.getPrototypeOf(instance);
|
|
44
|
+
while (proto && proto !== Object.prototype) {
|
|
45
|
+
Object.getOwnPropertyNames(proto)
|
|
46
|
+
.filter((prop) => typeof (proto === null || proto === void 0 ? void 0 : proto[prop]) === 'function')
|
|
47
|
+
.forEach((name) => names.add(name));
|
|
48
|
+
proto = Object.getPrototypeOf(proto);
|
|
49
|
+
}
|
|
50
|
+
return Array.from(names);
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/statsig-node-core",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest --colors",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
|
-
"@statsig/statsig-node-core-linux-x64-musl": "0.1.0
|
|
48
|
-
"@statsig/statsig-node-core-linux-x64-gnu": "0.1.0
|
|
49
|
-
"@statsig/statsig-node-core-win32-x64-msvc": "0.1.0
|
|
50
|
-
"@statsig/statsig-node-core-darwin-x64": "0.1.0
|
|
51
|
-
"@statsig/statsig-node-core-win32-ia32-msvc": "0.1.0
|
|
52
|
-
"@statsig/statsig-node-core-linux-arm64-musl": "0.1.0
|
|
53
|
-
"@statsig/statsig-node-core-linux-arm64-gnu": "0.1.0
|
|
54
|
-
"@statsig/statsig-node-core-darwin-arm64": "0.1.0
|
|
47
|
+
"@statsig/statsig-node-core-linux-x64-musl": "0.1.0",
|
|
48
|
+
"@statsig/statsig-node-core-linux-x64-gnu": "0.1.0",
|
|
49
|
+
"@statsig/statsig-node-core-win32-x64-msvc": "0.1.0",
|
|
50
|
+
"@statsig/statsig-node-core-darwin-x64": "0.1.0",
|
|
51
|
+
"@statsig/statsig-node-core-win32-ia32-msvc": "0.1.0",
|
|
52
|
+
"@statsig/statsig-node-core-linux-arm64-musl": "0.1.0",
|
|
53
|
+
"@statsig/statsig-node-core-linux-arm64-gnu": "0.1.0",
|
|
54
|
+
"@statsig/statsig-node-core-darwin-arm64": "0.1.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/statsig-generated.d.ts
CHANGED
|
@@ -38,6 +38,12 @@ export declare class Layer {
|
|
|
38
38
|
getSecondaryExposures(): Array<SecondaryExposure> | null
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export declare class ParameterStore {
|
|
42
|
+
name: string
|
|
43
|
+
getValue<T>(paramName: string, fallback?: T): T
|
|
44
|
+
getEvaluationDetails(): EvaluationDetails
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
export declare class StatsigNapiInternal {
|
|
42
48
|
constructor(networkFunc: NapiNetworkFunc, sdkKey: string, options?: StatsigOptions | undefined | null)
|
|
43
49
|
initialize(): Promise<StatsigResult>
|
|
@@ -53,6 +59,7 @@ export declare class StatsigNapiInternal {
|
|
|
53
59
|
getFieldsNeededForExperiment(experimentName: string): Array<string>
|
|
54
60
|
getLayer(user: StatsigUser, layerName: string, options?: LayerEvaluationOptions | undefined | null): Layer
|
|
55
61
|
getFieldsNeededForLayer(layerName: string): Array<string>
|
|
62
|
+
getParameterStore(user: StatsigUser, parameterStoreName: string, options?: ParameterStoreEvaluationOptions | undefined | null): ParameterStore
|
|
56
63
|
getClientInitializeResponse(user: StatsigUser, options?: ClientInitResponseOptions | undefined | null): string
|
|
57
64
|
manuallyLogFeatureGateExposure(user: StatsigUser, gateName: string): void
|
|
58
65
|
manuallyLogDynamicConfigExposure(user: StatsigUser, configName: string): void
|
|
@@ -164,6 +171,10 @@ export declare const enum OverrideAdapterType {
|
|
|
164
171
|
LocalOverride = 0
|
|
165
172
|
}
|
|
166
173
|
|
|
174
|
+
export interface ParameterStoreEvaluationOptions {
|
|
175
|
+
disableExposureLogging?: boolean
|
|
176
|
+
}
|
|
177
|
+
|
|
167
178
|
export interface SecondaryExposure {
|
|
168
179
|
gate: string
|
|
169
180
|
gateValue: string
|
package/statsig-generated.js
CHANGED
|
@@ -367,6 +367,7 @@ if (!nativeBinding) {
|
|
|
367
367
|
module.exports.DynamicConfig = nativeBinding.DynamicConfig
|
|
368
368
|
module.exports.Experiment = nativeBinding.Experiment
|
|
369
369
|
module.exports.Layer = nativeBinding.Layer
|
|
370
|
+
module.exports.ParameterStore = nativeBinding.ParameterStore
|
|
370
371
|
module.exports.StatsigNapiInternal = nativeBinding.StatsigNapiInternal
|
|
371
372
|
module.exports.StatsigUser = nativeBinding.StatsigUser
|
|
372
373
|
module.exports.__internal__testDataStore = nativeBinding.__internal__testDataStore
|