@statsig/client-core 2.0.0 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/client-core",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "dependencies": {},
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -10,7 +10,7 @@ exports.Diagnostics = {
10
10
  return MARKER_MAP.get(sdkKey);
11
11
  },
12
12
  _markInitOverallStart: (sdkKey) => {
13
- _addMarker(sdkKey, _createMarker({}, ACT_START));
13
+ _addMarker(sdkKey, _createMarker({}, ACT_START, 'overall'));
14
14
  },
15
15
  _markInitOverallEnd: (sdkKey, success, evaluationDetails) => {
16
16
  _addMarker(sdkKey, _createMarker({
@@ -19,19 +19,19 @@ exports.Diagnostics = {
19
19
  ? undefined
20
20
  : { name: 'InitializeError', message: 'Failed to initialize' },
21
21
  evaluationDetails,
22
- }, ACT_END));
22
+ }, ACT_END, 'overall'));
23
23
  },
24
24
  _markInitNetworkReqStart: (sdkKey, data) => {
25
- _addMarker(sdkKey, _createMarker(data, ACT_START));
25
+ _addMarker(sdkKey, _createMarker(data, ACT_START, 'initialize', 'network_request'));
26
26
  },
27
27
  _markInitNetworkReqEnd: (sdkKey, data) => {
28
- _addMarker(sdkKey, _createMarker(data, ACT_END));
28
+ _addMarker(sdkKey, _createMarker(data, ACT_END, 'initialize', 'network_request'));
29
29
  },
30
30
  _markInitProcessStart: (sdkKey) => {
31
- _addMarker(sdkKey, _createMarker({}, ACT_START));
31
+ _addMarker(sdkKey, _createMarker({}, ACT_START, 'initialize', 'process'));
32
32
  },
33
33
  _markInitProcessEnd: (sdkKey, data) => {
34
- _addMarker(sdkKey, _createMarker(data, ACT_END));
34
+ _addMarker(sdkKey, _createMarker(data, ACT_END, 'initialize', 'process'));
35
35
  },
36
36
  _clearMarkers: (sdkKey) => {
37
37
  MARKER_MAP.delete(sdkKey);
@@ -71,8 +71,8 @@ exports.Diagnostics = {
71
71
  logger.enqueue(event);
72
72
  },
73
73
  };
74
- function _createMarker(data, action) {
75
- return Object.assign({ key: 'initialize', action: action, timestamp: Date.now() }, data);
74
+ function _createMarker(data, action, key, step) {
75
+ return Object.assign({ key: key, action: action, step: step, timestamp: Date.now() }, data);
76
76
  }
77
77
  function _makeDiagnosticsEvent(user, data) {
78
78
  const latencyEvent = {
@@ -26,6 +26,15 @@ export type DataAdapterAsyncOptions = {
26
26
  */
27
27
  readonly priority?: NetworkPriority;
28
28
  };
29
+ export type DataAdapterSyncOptions = {
30
+ /**
31
+ * The flag to disable background cache refresh.
32
+ * If set to true, the cache will not be updated in the background and will only use the data adatpter values.
33
+ *
34
+ * default: false
35
+ */
36
+ readonly disableBackgroundCacheRefresh?: boolean;
37
+ };
29
38
  export declare const DataAdapterCachePrefix = "statsig.cached";
30
39
  /**
31
40
  * Describes a type that is used during intialize/update operations of a Statsig client.
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "2.0.0";
1
+ export declare const SDK_VERSION = "2.1.0";
2
2
  export type StatsigMetadata = {
3
3
  readonly [key: string]: string | undefined;
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 = '2.0.0';
4
+ exports.SDK_VERSION = '2.1.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