@statsig/statsig-node-core 0.11.0 → 0.11.1-beta.2510300237

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.js CHANGED
@@ -34,6 +34,7 @@ class ErrorBoundary {
34
34
  }
35
35
  }
36
36
  static _onError(tag, error) {
37
+ _tryConvertInvalidArgError(error);
37
38
  console.error(tag, error);
38
39
  }
39
40
  }
@@ -49,3 +50,19 @@ function _getAllInstanceMethodNames(instance) {
49
50
  }
50
51
  return Array.from(names);
51
52
  }
53
+ function _tryConvertInvalidArgError(error) {
54
+ if (typeof error !== 'object' || error === null) {
55
+ return;
56
+ }
57
+ if (!('code' in error) || error.code !== 'InvalidArg') {
58
+ return;
59
+ }
60
+ if (!('message' in error) || typeof error.message !== 'string') {
61
+ return;
62
+ }
63
+ if (error.message.startsWith('Failed to recover `StatsigUser` type from napi value')) {
64
+ error.message =
65
+ 'Expected StatsigUser instance, plain javascript object is not supported. Please create a StatsigUser instance using `new StatsigUser(...)` instead.';
66
+ return;
67
+ }
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/statsig-node-core",
3
- "version": "0.11.0",
3
+ "version": "0.11.1-beta.2510300237",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "jest --colors"
@@ -53,13 +53,13 @@
53
53
  ]
54
54
  },
55
55
  "optionalDependencies": {
56
- "@statsig/statsig-node-core-linux-x64-musl": "0.11.0",
57
- "@statsig/statsig-node-core-linux-x64-gnu": "0.11.0",
58
- "@statsig/statsig-node-core-win32-x64-msvc": "0.11.0",
59
- "@statsig/statsig-node-core-darwin-x64": "0.11.0",
60
- "@statsig/statsig-node-core-win32-ia32-msvc": "0.11.0",
61
- "@statsig/statsig-node-core-linux-arm64-musl": "0.11.0",
62
- "@statsig/statsig-node-core-linux-arm64-gnu": "0.11.0",
63
- "@statsig/statsig-node-core-darwin-arm64": "0.11.0"
56
+ "@statsig/statsig-node-core-linux-x64-musl": "0.11.1-beta.2510300237",
57
+ "@statsig/statsig-node-core-linux-x64-gnu": "0.11.1-beta.2510300237",
58
+ "@statsig/statsig-node-core-win32-x64-msvc": "0.11.1-beta.2510300237",
59
+ "@statsig/statsig-node-core-darwin-x64": "0.11.1-beta.2510300237",
60
+ "@statsig/statsig-node-core-win32-ia32-msvc": "0.11.1-beta.2510300237",
61
+ "@statsig/statsig-node-core-linux-arm64-musl": "0.11.1-beta.2510300237",
62
+ "@statsig/statsig-node-core-linux-arm64-gnu": "0.11.1-beta.2510300237",
63
+ "@statsig/statsig-node-core-darwin-arm64": "0.11.1-beta.2510300237"
64
64
  }
65
65
  }
@@ -55,8 +55,8 @@ export declare class ParameterStore {
55
55
  }
56
56
 
57
57
  export declare class StatsigNapiInternal {
58
- subscribe(eventName: '*' | 'gate_evaluated' | 'dynamic_config_evaluated' | 'experiment_evaluated' | 'layer_evaluated', callback: (event: any) => void): string
59
- unsubscribe(eventName: '*' | 'gate_evaluated' | 'dynamic_config_evaluated' | 'experiment_evaluated' | 'layer_evaluated'): void
58
+ subscribe(eventName: '*' | 'gate_evaluated' | 'dynamic_config_evaluated' | 'experiment_evaluated' | 'layer_evaluated' | 'specs_updated', callback: (event: any) => void): string
59
+ unsubscribe(eventName: '*' | 'gate_evaluated' | 'dynamic_config_evaluated' | 'experiment_evaluated' | 'layer_evaluated' | 'specs_updated'): void
60
60
  unsubscribeById(subscriptionId: string): void
61
61
  unsubscribeAll(): void
62
62
  constructor(networkFunc: unknown, sdkKey: string, options?: StatsigOptions | undefined | null)
@@ -109,6 +109,8 @@ export declare class StatsigUser {
109
109
  set custom(value: Record<string, string | number | boolean | Array<string | number | boolean>> | null)
110
110
  get privateAttributes(): Record<string, string> | null
111
111
  set privateAttributes(value: Record<string, string | number | boolean | Array<string | number | boolean>> | null)
112
+ get statsigEnvironment(): Record<string, string> | null
113
+ set statsigEnvironment(value: { tier?: string, [key: string]: string | undefined } | null | undefined)
112
114
  get userID(): string | null
113
115
  set userID(value: any)
114
116
  get email(): string | null
@@ -303,6 +305,7 @@ export interface StatsigUserArgs {
303
305
  country?: string
304
306
  locale?: string
305
307
  appVersion?: string
308
+ statsigEnvironment?: { tier?: string, [key: string]: string | undefined } | null | undefined
306
309
  custom?: Record<string, string | number | boolean | Array<string | number | boolean> | null | Record<string, unknown>>
307
310
  privateAttributes?: Record<string, string | number | boolean | Array<string | number | boolean> | null | Record<string, unknown>>
308
311
  }