@statsig/statsig-node-core 0.6.0 → 0.6.1-beta.2

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/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { StatsigNapiInternal, StatsigOptions } from './statsig-generated';
2
2
  export * from './statsig-generated';
3
- export * from './sticky_values';
4
3
  export declare class Statsig extends StatsigNapiInternal {
5
4
  private static _sharedInstance;
6
5
  static shared(): Statsig;
package/index.js CHANGED
@@ -32,7 +32,6 @@ const node_fetch_1 = __importDefault(require("node-fetch"));
32
32
  const error_boundary_1 = require("./error_boundary");
33
33
  const statsig_generated_1 = require("./statsig-generated");
34
34
  __exportStar(require("./statsig-generated"), exports);
35
- __exportStar(require("./sticky_values"), exports);
36
35
  function createProxyAgent(options) {
37
36
  const proxy = options === null || options === void 0 ? void 0 : options.proxyConfig;
38
37
  if ((proxy === null || proxy === void 0 ? void 0 : proxy.proxyHost) && (proxy === null || proxy === void 0 ? void 0 : proxy.proxyProtocol)) {
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@statsig/statsig-node-core",
3
- "version": "0.6.0",
3
+ "version": "0.6.1-beta.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
- "test": "jest --colors",
7
- "build": "napi build --platform --js index.js --dts index.d.ts --output-dir ./build --strip"
6
+ "test": "jest --colors"
8
7
  },
9
8
  "keywords": [],
10
9
  "author": "",
@@ -45,13 +44,13 @@
45
44
  ]
46
45
  },
47
46
  "optionalDependencies": {
48
- "@statsig/statsig-node-core-linux-x64-musl": "0.6.0",
49
- "@statsig/statsig-node-core-linux-x64-gnu": "0.6.0",
50
- "@statsig/statsig-node-core-win32-x64-msvc": "0.6.0",
51
- "@statsig/statsig-node-core-darwin-x64": "0.6.0",
52
- "@statsig/statsig-node-core-win32-ia32-msvc": "0.6.0",
53
- "@statsig/statsig-node-core-linux-arm64-musl": "0.6.0",
54
- "@statsig/statsig-node-core-linux-arm64-gnu": "0.6.0",
55
- "@statsig/statsig-node-core-darwin-arm64": "0.6.0"
47
+ "@statsig/statsig-node-core-linux-x64-musl": "0.6.1-beta.2",
48
+ "@statsig/statsig-node-core-linux-x64-gnu": "0.6.1-beta.2",
49
+ "@statsig/statsig-node-core-win32-x64-msvc": "0.6.1-beta.2",
50
+ "@statsig/statsig-node-core-darwin-x64": "0.6.1-beta.2",
51
+ "@statsig/statsig-node-core-win32-ia32-msvc": "0.6.1-beta.2",
52
+ "@statsig/statsig-node-core-linux-arm64-musl": "0.6.1-beta.2",
53
+ "@statsig/statsig-node-core-linux-arm64-gnu": "0.6.1-beta.2",
54
+ "@statsig/statsig-node-core-darwin-arm64": "0.6.1-beta.2"
56
55
  }
57
56
  }
@@ -0,0 +1,21 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const GENERATED_FILE = 'src/lib/statsig-generated.d.ts';
5
+ const FILES_TO_APPEND = [
6
+ 'src/lib/persistent_storage_type.ts'
7
+ ];
8
+ const generatedFileFullPath = path.resolve(__dirname, '..', GENERATED_FILE);
9
+
10
+ FILES_TO_APPEND.forEach((filePath) => {
11
+ const fullPath = path.resolve(__dirname, '..', filePath);
12
+ let header = `// ---- Manually defined typing section ----- \n`
13
+ if (fs.existsSync(fullPath)) {
14
+ let content = fs.readFileSync(fullPath, 'utf8');
15
+ content = content.replace(/^\s*import\s+.*?from\s+['"]\.\/statsig-generated['"];\s*$/gm, '');
16
+ content = header + content;
17
+ fs.appendFileSync(generatedFileFullPath, content, 'utf8');
18
+ } else {
19
+ console.warn(`❌ File not found: ${filePath}`);
20
+ }
21
+ });
@@ -246,6 +246,7 @@ export interface StatsigOptions {
246
246
  configCompressionMode?: 'gzip' | 'dictionary'
247
247
  overrideAdapterConfig?: Array<OverrideAdapterConfig>
248
248
  serviceName?: string
249
+ persistentStorage?: PersistentStorage
249
250
  specAdaptersConfig?: Array<SpecAdapterConfig>
250
251
  specsSyncIntervalMs?: number
251
252
  specsUrl?: string
@@ -268,6 +269,22 @@ export interface StatsigUserArgs {
268
269
  country?: string
269
270
  locale?: string
270
271
  appVersion?: string
271
- custom?: Record<string, string | number | boolean | Array<string | number | boolean>>
272
- privateAttributes?: Record<string, string | number | boolean | Array<string | number | boolean>>
272
+ custom?: Record<string, string | number | boolean | Array<string | number | boolean> | null | Record<string, unknown>>
273
+ privateAttributes?: Record<string, string | number | boolean | Array<string | number | boolean> | null | Record<string, unknown>>
273
274
  }
275
+ // ---- Manually defined typing section -----
276
+
277
+ export type StickyValues = {
278
+ value: boolean;
279
+ json_value: Record<string, unknown>;
280
+ rule_id: string;
281
+ group_name: string | null;
282
+ secondary_exposures: SecondaryExposure[];
283
+ undelegated_secondary_exposures: SecondaryExposure[];
284
+ config_delegate: string | null;
285
+ explicit_parameters: string[] | null;
286
+ time: number;
287
+ configVersion?: number | undefined;
288
+ };
289
+
290
+ export type UserPersistedValues = Record<string, StickyValues>;