@oai-statsig/statsig-node-core 0.36.0-rc.1 → 0.36.0-rc.3

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
@@ -2,10 +2,12 @@ import type { Message } from '@bufbuild/protobuf';
2
2
  import type { TypedConfigSchema } from './typed_config_schema';
3
3
  import { DynamicConfigEvaluationOptions, ExperimentEvaluationOptions, FeatureGateEvaluationOptions, LayerEvaluationOptions, SdkEvent, StatsigNapiInternal, StatsigOptions, StatsigResult, StatsigUser } from './statsig-generated';
4
4
  import { DynamicConfig, Experiment, FeatureGate, Layer, TypedDynamicConfig } from './statsig_types';
5
+ import { TypedConfigEvaluationOptions } from './typed_config';
5
6
  export * from './statsig-generated';
6
7
  export * from './statsig_types';
7
8
  export { TypedConfigUnavailableError, TypedConfigConversionError } from './typed_config';
8
- export declare const SDK_VERSION = "0.36.0-rc.1";
9
+ export type { TypedConfigEvaluationOptions } from './typed_config';
10
+ export declare const SDK_VERSION = "0.36.0-rc.3";
9
11
  export declare class Statsig extends StatsigNapiInternal {
10
12
  private static _sharedInstance;
11
13
  private _typedConfigs?;
@@ -20,7 +22,7 @@ export declare class Statsig extends StatsigNapiInternal {
20
22
  subscribe(eventName: SdkEvent, callback: (event: any) => void): string;
21
23
  getFeatureGate(user: StatsigUser, gateName: string, options?: FeatureGateEvaluationOptions): FeatureGate;
22
24
  getDynamicConfig(user: StatsigUser, configName: string, options?: DynamicConfigEvaluationOptions): DynamicConfig;
23
- getTypedConfig<T extends Message>(user: StatsigUser, configName: string, schema: TypedConfigSchema<T>, options?: DynamicConfigEvaluationOptions): TypedDynamicConfig<T>;
25
+ getTypedConfig<T extends Message>(user: StatsigUser, configName: string, schema: TypedConfigSchema<T>, options?: TypedConfigEvaluationOptions): TypedDynamicConfig<T>;
24
26
  registerTypedConfigCallback<T extends Message>(user: StatsigUser, configName: string, schema: TypedConfigSchema<T>, callback: (result: TypedDynamicConfig<T>) => void | Promise<void>): void;
25
27
  getExperiment(user: StatsigUser, experimentName: string, options?: ExperimentEvaluationOptions): Experiment;
26
28
  getExperimentByGroupName(experimentName: string, groupName: string): Experiment;
package/index.js CHANGED
@@ -35,7 +35,7 @@ __exportStar(require("./statsig_types"), exports);
35
35
  var typed_config_2 = require("./typed_config");
36
36
  Object.defineProperty(exports, "TypedConfigUnavailableError", { enumerable: true, get: function () { return typed_config_2.TypedConfigUnavailableError; } });
37
37
  Object.defineProperty(exports, "TypedConfigConversionError", { enumerable: true, get: function () { return typed_config_2.TypedConfigConversionError; } });
38
- exports.SDK_VERSION = '0.36.0-rc.1';
38
+ exports.SDK_VERSION = '0.36.0-rc.3';
39
39
  const inspectSym = Symbol.for('nodejs.util.inspect.custom');
40
40
  // @ts-expect-error - prototype assignment
41
41
  statsig_generated_1.StatsigUser.prototype[inspectSym] = function () {
@@ -128,8 +128,6 @@ class Statsig extends statsig_generated_1.StatsigNapiInternal {
128
128
  }
129
129
  getTypedConfig(user, configName, schema, options) {
130
130
  var _a;
131
- if (this._typedClosed)
132
- throw new typed_config_1.TypedConfigUnavailableError();
133
131
  (_a = this._typedConfigs) !== null && _a !== void 0 ? _a : (this._typedConfigs = new typed_config_1.TypedConfigs(this));
134
132
  return this._typedConfigs.get(user, configName, schema, options);
135
133
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@oai-statsig/statsig-node-core",
3
- "version": "0.36.0-rc.1",
3
+ "version": "0.36.0-rc.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "jest --colors",
7
- "generate:typed-fixture": "protoc -I src/__tests__/fixtures --es_out=src/__tests__/fixtures --es_opt=target=ts,import_extension=js src/__tests__/fixtures/typed_config.proto"
7
+ "generate:typed-fixture": "protoc -I src/__tests__/fixtures --es_out=src/__tests__/fixtures --es_opt=target=ts,import_extension=js src/__tests__/fixtures/typed_config.proto src/__tests__/fixtures/packaged_config.proto"
8
8
  },
9
9
  "keywords": [],
10
10
  "author": "",
@@ -63,13 +63,13 @@
63
63
  }
64
64
  },
65
65
  "optionalDependencies": {
66
- "@oai-statsig/statsig-node-core-darwin-arm64": "0.36.0-rc.1",
67
- "@oai-statsig/statsig-node-core-darwin-x64": "0.36.0-rc.1",
68
- "@oai-statsig/statsig-node-core-linux-arm64-gnu": "0.36.0-rc.1",
69
- "@oai-statsig/statsig-node-core-linux-arm64-musl": "0.36.0-rc.1",
70
- "@oai-statsig/statsig-node-core-linux-x64-gnu": "0.36.0-rc.1",
71
- "@oai-statsig/statsig-node-core-linux-x64-musl": "0.36.0-rc.1",
72
- "@oai-statsig/statsig-node-core-win32-ia32-msvc": "0.36.0-rc.1",
73
- "@oai-statsig/statsig-node-core-win32-x64-msvc": "0.36.0-rc.1"
66
+ "@oai-statsig/statsig-node-core-darwin-arm64": "0.36.0-rc.3",
67
+ "@oai-statsig/statsig-node-core-darwin-x64": "0.36.0-rc.3",
68
+ "@oai-statsig/statsig-node-core-linux-arm64-gnu": "0.36.0-rc.3",
69
+ "@oai-statsig/statsig-node-core-linux-arm64-musl": "0.36.0-rc.3",
70
+ "@oai-statsig/statsig-node-core-linux-x64-gnu": "0.36.0-rc.3",
71
+ "@oai-statsig/statsig-node-core-linux-x64-musl": "0.36.0-rc.3",
72
+ "@oai-statsig/statsig-node-core-win32-ia32-msvc": "0.36.0-rc.3",
73
+ "@oai-statsig/statsig-node-core-win32-x64-msvc": "0.36.0-rc.3"
74
74
  }
75
75
  }
@@ -65,7 +65,7 @@ export declare class StatsigNapiInternal {
65
65
  getExperimentList(): Array<string>
66
66
  getParameterStoreList(): Array<string>
67
67
  getParsedUserAgentValueForUser(user: StatsigUser): Record<string, string | undefined | null> | null
68
- __INTERNAL_getTypedConfig(user: StatsigUser, name: string, options?: DynamicConfigEvaluationOptions | undefined | null): Record<string, unknown>
68
+ __INTERNAL_getTypedConfig(user: StatsigUser, name: string, options?: DynamicConfigEvaluationOptions | undefined | null, allowPackagedFallback?: boolean | undefined | null): Record<string, unknown>
69
69
  __INTERNAL_typedConfigContext(user: StatsigUser, name: string): TypedConfigContext
70
70
  __INTERNAL_startTypedConfigUpdates(callback: () => void): void
71
71
  __INTERNAL_closeTypedConfigUpdates(): void
@@ -320,7 +320,7 @@ export interface StatsigOptions {
320
320
  downloadIdListFileApi?: string
321
321
  /**
322
322
  * Total initialization deadline including specs, ID lists, retries, hydration, and fallback.
323
- * Unset now imposes a 3000 ms total deadline. Zero preserves immediate-timeout behavior.
323
+ * Unset leaves initialization without a total deadline. Zero preserves immediate-timeout behavior.
324
324
  */
325
325
  initTimeoutMs?: number
326
326
  logEventUrl?: string
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('@oai-statsig/statsig-node-core-android-arm64')
79
79
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('@oai-statsig/statsig-node-core-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('@oai-statsig/statsig-node-core-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('@oai-statsig/statsig-node-core-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@oai-statsig/statsig-node-core-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('@oai-statsig/statsig-node-core-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('@oai-statsig/statsig-node-core-darwin-universal')
184
184
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('@oai-statsig/statsig-node-core-darwin-x64')
200
200
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('@oai-statsig/statsig-node-core-darwin-arm64')
216
216
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('@oai-statsig/statsig-node-core-freebsd-x64')
236
236
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('@oai-statsig/statsig-node-core-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('@oai-statsig/statsig-node-core-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('@oai-statsig/statsig-node-core-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('@oai-statsig/statsig-node-core-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('@oai-statsig/statsig-node-core-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('@oai-statsig/statsig-node-core-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('@oai-statsig/statsig-node-core-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('@oai-statsig/statsig-node-core-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('@oai-statsig/statsig-node-core-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@oai-statsig/statsig-node-core-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('@oai-statsig/statsig-node-core-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@oai-statsig/statsig-node-core-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@oai-statsig/statsig-node-core-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('@oai-statsig/statsig-node-core-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('@oai-statsig/statsig-node-core-openharmony-x64')
494
494
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('@oai-statsig/statsig-node-core-openharmony-arm')
510
510
  const bindingPackageVersion = require('@oai-statsig/statsig-node-core-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.36.0-rc.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '0.36.0-rc.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 0.36.0-rc.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -28,7 +28,8 @@ export declare class DynamicConfig extends BaseEvaluation {
28
28
  /** A fresh protobuf message and metadata from the same native evaluation. */
29
29
  export declare class TypedDynamicConfig<T extends Message> extends BaseEvaluation {
30
30
  readonly value: T;
31
- constructor(name: string, raw: Record<string, unknown>, value: T);
31
+ readonly valueSource: 'statsig' | 'packaged';
32
+ constructor(name: string, raw: Record<string, unknown>, value: T, valueSource?: 'statsig' | 'packaged');
32
33
  getName(): string;
33
34
  getValue(): T;
34
35
  }
package/statsig_types.js CHANGED
@@ -50,9 +50,10 @@ class DynamicConfig extends BaseEvaluation {
50
50
  exports.DynamicConfig = DynamicConfig;
51
51
  /** A fresh protobuf message and metadata from the same native evaluation. */
52
52
  class TypedDynamicConfig extends BaseEvaluation {
53
- constructor(name, raw, value) {
53
+ constructor(name, raw, value, valueSource = 'statsig') {
54
54
  super(name, raw);
55
55
  this.value = value;
56
+ this.valueSource = valueSource;
56
57
  }
57
58
  getName() {
58
59
  return this.name;
package/typed_config.d.ts CHANGED
@@ -3,13 +3,20 @@ import type { TypedConfigSchema } from './typed_config_schema';
3
3
  import { DynamicConfigEvaluationOptions, StatsigNapiInternal, StatsigUser } from './statsig-generated';
4
4
  import { TypedDynamicConfig } from './statsig_types';
5
5
  export declare class TypedConfigUnavailableError extends Error {
6
- constructor(message?: string);
6
+ readonly cause?: unknown;
7
+ constructor(message?: string, cause?: unknown);
7
8
  }
8
9
  export declare class TypedConfigConversionError extends Error {
9
10
  readonly cause: unknown;
10
- constructor(cause: unknown);
11
+ constructor(cause: unknown, message?: string);
11
12
  }
12
- /** Internal coordinator; ordinary reads retain no context, observer, or result. */
13
+ export interface TypedConfigEvaluationOptions extends DynamicConfigEvaluationOptions {
14
+ /** Allow a packaged default before any native specs are accepted. Defaults to true; set false to opt out. */
15
+ allowPackagedFallback?: boolean;
16
+ /** Override the inferred package resource. This does not override allowPackagedFallback: false. */
17
+ packagedFallback?: () => string;
18
+ }
19
+ /** Internal coordinator; reads retain no user context, observer, or typed result. */
13
20
  export declare class TypedConfigs {
14
21
  private readonly sdk;
15
22
  private closed;
@@ -19,11 +26,12 @@ export declare class TypedConfigs {
19
26
  private worker?;
20
27
  private observers;
21
28
  constructor(sdk: StatsigNapiInternal);
22
- get<T extends Message>(user: StatsigUser, name: string, schema: TypedConfigSchema<T>, options?: DynamicConfigEvaluationOptions): TypedDynamicConfig<T>;
29
+ get<T extends Message>(user: StatsigUser, name: string, schema: TypedConfigSchema<T>, options?: TypedConfigEvaluationOptions): TypedDynamicConfig<T>;
23
30
  register<T extends Message>(user: StatsigUser, name: string, schema: TypedConfigSchema<T>, callback: (result: TypedDynamicConfig<T>) => void | Promise<void>): void;
24
31
  close(): Promise<void>;
25
32
  private ensureOpen;
26
33
  private ensureUsable;
34
+ private getPackaged;
27
35
  private convert;
28
36
  private notify;
29
37
  private drain;
package/typed_config.js CHANGED
@@ -13,20 +13,24 @@ exports.TypedConfigs = exports.TypedConfigConversionError = exports.TypedConfigU
13
13
  const statsig_generated_1 = require("./statsig-generated");
14
14
  const statsig_types_1 = require("./statsig_types");
15
15
  class TypedConfigUnavailableError extends Error {
16
- constructor(message = 'Typed config has no usable native value or the SDK is closed') {
16
+ constructor(message = 'Typed config has no usable native value', cause) {
17
17
  super(message);
18
18
  this.name = 'TypedConfigUnavailableError';
19
+ this.cause = cause;
19
20
  }
20
21
  }
21
22
  exports.TypedConfigUnavailableError = TypedConfigUnavailableError;
22
23
  class TypedConfigConversionError extends Error {
23
- constructor(cause) {
24
- super('Failed to convert typed config to the requested protobuf message');
24
+ constructor(cause, message = 'Failed to convert typed config to the requested protobuf message') {
25
+ super(message);
25
26
  this.name = 'TypedConfigConversionError';
26
27
  this.cause = cause;
27
28
  }
28
29
  }
29
30
  exports.TypedConfigConversionError = TypedConfigConversionError;
31
+ const maxPackagedDocuments = 64;
32
+ // Packaged build artifacts are shared across SDK instances in this JS runtime.
33
+ const packagedDocuments = new Map();
30
34
  let protobuf;
31
35
  let callbackScope;
32
36
  function runtime() {
@@ -106,8 +110,11 @@ function validateArguments(user, name, options) {
106
110
  }
107
111
  if (options !== undefined && (options === null || typeof options !== 'object' || Array.isArray(options) ||
108
112
  (options.disableExposureLogging !== undefined &&
109
- typeof options.disableExposureLogging !== 'boolean'))) {
110
- throw new TypeError('options must be DynamicConfigEvaluationOptions');
113
+ typeof options.disableExposureLogging !== 'boolean') ||
114
+ (options.allowPackagedFallback !== undefined &&
115
+ typeof options.allowPackagedFallback !== 'boolean') ||
116
+ (options.packagedFallback !== undefined && typeof options.packagedFallback !== 'function'))) {
117
+ throw new TypeError('options must be TypedConfigEvaluationOptions');
111
118
  }
112
119
  }
113
120
  function errorKind(error) {
@@ -131,7 +138,7 @@ function warn(operation, kind) {
131
138
  // Application-provided console hooks must not stop other observers.
132
139
  }
133
140
  }
134
- /** Internal coordinator; ordinary reads retain no context, observer, or result. */
141
+ /** Internal coordinator; reads retain no user context, observer, or typed result. */
135
142
  class TypedConfigs {
136
143
  constructor(sdk) {
137
144
  this.sdk = sdk;
@@ -143,12 +150,17 @@ class TypedConfigs {
143
150
  }
144
151
  get(user, name, schema, options) {
145
152
  validateArguments(user, name, options);
146
- this.ensureOpen();
147
- const raw = this.sdk.__INTERNAL_getTypedConfig(user, name, options);
153
+ const loader = options === null || options === void 0 ? void 0 : options.packagedFallback;
154
+ const allowPackaged = (options === null || options === void 0 ? void 0 : options.allowPackagedFallback) !== false;
155
+ const nativeOptions = options === undefined ? undefined : {
156
+ disableExposureLogging: options.disableExposureLogging,
157
+ };
158
+ const raw = this.sdk.__INTERNAL_getTypedConfig(user, name, nativeOptions, allowPackaged);
159
+ if (allowPackaged && raw.__typed_packaged_fallback_eligible === true) {
160
+ return this.getPackaged(name, schema, loader, raw.__typed_packaged_fallback_tier);
161
+ }
148
162
  this.ensureUsable(raw);
149
- const result = this.convert(name, raw, schema);
150
- this.ensureOpen();
151
- return result;
163
+ return this.convert(name, raw, schema);
152
164
  }
153
165
  register(user, name, schema, callback) {
154
166
  validateArguments(user, name);
@@ -213,7 +225,7 @@ class TypedConfigs {
213
225
  }
214
226
  ensureOpen() {
215
227
  if (this.closed)
216
- throw new TypedConfigUnavailableError();
228
+ throw new TypedConfigUnavailableError('Statsig has been shut down');
217
229
  }
218
230
  ensureUsable(raw) {
219
231
  if (!raw.__typedUsable || typeof raw.__typedRevision !== 'string' ||
@@ -221,7 +233,80 @@ class TypedConfigs {
221
233
  throw new TypedConfigUnavailableError();
222
234
  }
223
235
  }
224
- convert(name, raw, schema) {
236
+ getPackaged(name, schema, loader, tier) {
237
+ if (tier !== undefined && tier !== null && typeof tier !== 'string') {
238
+ throw new TypedConfigUnavailableError('Native packaged fallback tier is invalid');
239
+ }
240
+ let cacheKey;
241
+ let packageResource;
242
+ let cwd;
243
+ if (loader !== undefined) {
244
+ cacheKey = loader;
245
+ }
246
+ else {
247
+ const match = /^oaiproto\.statsig_configs\.([A-Za-z_][A-Za-z0-9_]*)\./.exec(schema.typeName);
248
+ if (!match) {
249
+ throw new TypedConfigUnavailableError(`Cannot infer packaged fallback for typed config ${name}; supply packagedFallback for a nonstandard package`);
250
+ }
251
+ packageResource = `${match[1]}/fallback.json`;
252
+ try {
253
+ cwd = process.cwd();
254
+ }
255
+ catch (error) {
256
+ throw new TypedConfigUnavailableError(`Failed to load packaged fallback for typed config ${name}`, error);
257
+ }
258
+ cacheKey = `${cwd}\0${packageResource}`;
259
+ }
260
+ let document = packagedDocuments.get(cacheKey);
261
+ if (document === undefined) {
262
+ let text;
263
+ try {
264
+ if (typeof cacheKey === 'function') {
265
+ text = cacheKey();
266
+ }
267
+ else {
268
+ const { readFileSync } = require('node:fs');
269
+ const { createRequire } = require('node:module');
270
+ const { join } = require('node:path');
271
+ const resource = createRequire(join(cwd, 'package.json')).resolve(packageResource);
272
+ text = readFileSync(resource, 'utf8');
273
+ }
274
+ }
275
+ catch (error) {
276
+ throw new TypedConfigUnavailableError(`Failed to load packaged fallback for typed config ${name}`, error);
277
+ }
278
+ try {
279
+ if (typeof text !== 'string')
280
+ throw new TypeError('Packaged fallback loader must return JSON text');
281
+ const parsed = JSON.parse(text);
282
+ if (!isJsonObject(parsed) || !Object.prototype.hasOwnProperty.call(parsed, 'default') ||
283
+ !isJsonObject(parsed.default)) {
284
+ throw new TypeError('Packaged fallback requires a default object');
285
+ }
286
+ const environments = parsed.environments === undefined ? {} : parsed.environments;
287
+ if (!isJsonObject(environments) || !Object.entries(environments).every(([key, value]) => key.length > 0 && key.trim() === key && isJsonObject(value))) {
288
+ throw new TypeError('Packaged fallback environments must contain objects');
289
+ }
290
+ document = { default: parsed.default, environments: environments };
291
+ }
292
+ catch (error) {
293
+ throw new TypedConfigConversionError(error, `Invalid packaged fallback for typed config ${name}`);
294
+ }
295
+ }
296
+ // Cache JSON independently of schema conversion; each read returns a fresh proto.
297
+ packagedDocuments.delete(cacheKey);
298
+ packagedDocuments.set(cacheKey, document);
299
+ if (packagedDocuments.size > maxPackagedDocuments) {
300
+ packagedDocuments.delete(packagedDocuments.keys().next().value);
301
+ }
302
+ const value = typeof tier === 'string' && Object.prototype.hasOwnProperty.call(document.environments, tier)
303
+ ? document.environments[tier] : document.default;
304
+ return this.convert(name, {
305
+ value,
306
+ details: { reason: 'PackagedFallback', lcut: 0, received_at: 0, version: 0 },
307
+ }, schema, 'packaged');
308
+ }
309
+ convert(name, raw, schema, valueSource = 'statsig') {
225
310
  let value;
226
311
  try {
227
312
  // Both module formats use equivalent descriptors at runtime. Normalize the
@@ -230,9 +315,10 @@ class TypedConfigs {
230
315
  value = runtime().fromJson(descriptor, omitUnknownEnumMapValues(descriptor, raw.value), { ignoreUnknownFields: true });
231
316
  }
232
317
  catch (error) {
233
- throw new TypedConfigConversionError(error);
318
+ throw new TypedConfigConversionError(error, valueSource === 'packaged'
319
+ ? `Failed to convert packaged fallback for typed config ${name}` : undefined);
234
320
  }
235
- return new statsig_types_1.TypedDynamicConfig(name, raw, value);
321
+ return new statsig_types_1.TypedDynamicConfig(name, raw, value, valueSource);
236
322
  }
237
323
  notify() {
238
324
  if (this.closed)