@statsig/client-core 3.31.2-beta.2 → 3.32.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.
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PendingEvents = void 0;
4
+ const Log_1 = require("./Log");
5
+ class PendingEvents {
6
+ constructor(batchSize) {
7
+ this._pendingEvents = [];
8
+ this._batchSize = batchSize;
9
+ }
10
+ addToPendingEventsQueue(event) {
11
+ this._pendingEvents.push(event);
12
+ Log_1.Log.debug('Enqueued Event:', event);
13
+ }
14
+ hasEventsForFullBatch() {
15
+ return this._pendingEvents.length >= this._batchSize;
16
+ }
17
+ takeAll() {
18
+ const events = this._pendingEvents;
19
+ this._pendingEvents = [];
20
+ return events;
21
+ }
22
+ isEmpty() {
23
+ return this._pendingEvents.length === 0;
24
+ }
25
+ }
26
+ exports.PendingEvents = PendingEvents;
@@ -41,8 +41,8 @@ class StatsigClientBase {
41
41
  this._options = options !== null && options !== void 0 ? options : {};
42
42
  this._memoCache = {};
43
43
  this.overrideAdapter = (_a = options === null || options === void 0 ? void 0 : options.overrideAdapter) !== null && _a !== void 0 ? _a : null;
44
- this._logger = new EventLogger_1.EventLogger(sdkKey, emitter, network, options);
45
44
  this._errorBoundary = new ErrorBoundary_1.ErrorBoundary(sdkKey, options, emitter);
45
+ this._logger = new EventLogger_1.EventLogger(sdkKey, emitter, network, options, this._errorBoundary);
46
46
  this._errorBoundary.wrap(this);
47
47
  this._errorBoundary.wrap(adapter);
48
48
  this._errorBoundary.wrap(this._logger);
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "3.31.2-beta.2";
1
+ export declare const SDK_VERSION = "3.32.0";
2
2
  export type StatsigMetadata = {
3
3
  readonly [key: string]: string | undefined | null;
4
4
  readonly appVersion?: string;
@@ -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.31.2-beta.2';
4
+ exports.SDK_VERSION = '3.32.0';
5
5
  let metadata = {
6
6
  sdkVersion: exports.SDK_VERSION,
7
7
  sdkType: 'js-mono', // js-mono is overwritten by Precomp and OnDevice clients
@@ -119,13 +119,11 @@ export type StatsigOptionsCommon<NetworkConfig extends NetworkConfigCommon> = St
119
119
  /**
120
120
  * The maximum number of events to batch before flushing logs to Statsig.
121
121
  *
122
- * default: `50`
122
+ * default: `100`
123
123
  */
124
124
  loggingBufferMaxSize?: number;
125
125
  /**
126
- * How often (in milliseconds) to flush logs to Statsig.
127
- *
128
- * default: `10,000 ms` (10 seconds)
126
+ * @deprecated The event logger now has built in flush timing.
129
127
  */
130
128
  loggingIntervalMs?: number;
131
129
  /**