@splitsoftware/splitio-commons 2.0.0-rc.6 → 2.0.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/CHANGES.txt CHANGED
@@ -1,11 +1,11 @@
1
- 2.0.0 (October XX, 2024)
1
+ 2.0.0 (November 1, 2024)
2
2
  - Added support for targeting rules based on large segments.
3
3
  - Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
4
- - Added `SplitIO` namespace with the public TypeScript definitions to be reused by the SDKs, rather than having each SDK define its own types.
4
+ - Added `SplitIO` namespace with the public TypeScript definitions to be reused by the SDKs.
5
5
  - Updated the handling of timers and async operations inside an `init` factory method to enable lazy initialization of the SDK in standalone mode. This update is intended for the React SDK.
6
6
  - Bugfixing - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready.
7
7
  - BREAKING CHANGES:
8
- - Updated default flag spec version to 1.2.
8
+ - Updated default flag spec version to 1.2, which requires Split Proxy v5.9.0 or higher.
9
9
  - Removed `/mySegments` endpoint from SplitAPI module, as it is replaced by `/memberships` endpoint.
10
10
  - Removed support for MY_SEGMENTS_UPDATE and MY_SEGMENTS_UPDATE_V2 notification types, as they are replaced by MEMBERSHIPS_MS_UPDATE and MEMBERSHIPS_LS_UPDATE notification types.
11
11
  - Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations.
@@ -7,7 +7,7 @@ function splitsEventEmitterFactory(EventEmitter) {
7
7
  var splitsEventEmitter = (0, objectAssign_1.objectAssign)(new EventEmitter(), {
8
8
  splitsArrived: false,
9
9
  splitsCacheLoaded: false,
10
- initialized: false,
10
+ hasInit: false,
11
11
  initCallbacks: []
12
12
  });
13
13
  // `isSplitKill` condition avoids an edge-case of wrongly emitting SDK_READY if:
@@ -56,7 +56,7 @@ function readinessManagerFactory(EventEmitter, settings, splits) {
56
56
  }
57
57
  var readyTimeoutId;
58
58
  if (readyTimeout > 0) {
59
- if (splits.initialized)
59
+ if (splits.hasInit)
60
60
  readyTimeoutId = setTimeout(timeout, readyTimeout);
61
61
  else
62
62
  splits.initCallbacks.push(function () { readyTimeoutId = setTimeout(timeout, readyTimeout); });
@@ -122,9 +122,9 @@ function readinessManagerFactory(EventEmitter, settings, splits) {
122
122
  // tracking and evaluations, while keeping event listeners to emit SDK_READY_TIMED_OUT event
123
123
  setDestroyed: function () { isDestroyed = true; },
124
124
  init: function () {
125
- if (splits.initialized)
125
+ if (splits.hasInit)
126
126
  return;
127
- splits.initialized = true;
127
+ splits.hasInit = true;
128
128
  splits.initCallbacks.forEach(function (cb) { return cb(); });
129
129
  },
130
130
  destroy: function () {
@@ -4,7 +4,7 @@ function splitsEventEmitterFactory(EventEmitter) {
4
4
  var splitsEventEmitter = objectAssign(new EventEmitter(), {
5
5
  splitsArrived: false,
6
6
  splitsCacheLoaded: false,
7
- initialized: false,
7
+ hasInit: false,
8
8
  initCallbacks: []
9
9
  });
10
10
  // `isSplitKill` condition avoids an edge-case of wrongly emitting SDK_READY if:
@@ -53,7 +53,7 @@ export function readinessManagerFactory(EventEmitter, settings, splits) {
53
53
  }
54
54
  var readyTimeoutId;
55
55
  if (readyTimeout > 0) {
56
- if (splits.initialized)
56
+ if (splits.hasInit)
57
57
  readyTimeoutId = setTimeout(timeout, readyTimeout);
58
58
  else
59
59
  splits.initCallbacks.push(function () { readyTimeoutId = setTimeout(timeout, readyTimeout); });
@@ -119,9 +119,9 @@ export function readinessManagerFactory(EventEmitter, settings, splits) {
119
119
  // tracking and evaluations, while keeping event listeners to emit SDK_READY_TIMED_OUT event
120
120
  setDestroyed: function () { isDestroyed = true; },
121
121
  init: function () {
122
- if (splits.initialized)
122
+ if (splits.hasInit)
123
123
  return;
124
- splits.initialized = true;
124
+ splits.hasInit = true;
125
125
  splits.initCallbacks.forEach(function (cb) { return cb(); });
126
126
  },
127
127
  destroy: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "2.0.0-rc.6",
3
+ "version": "2.0.0",
4
4
  "description": "Split JavaScript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -8,7 +8,7 @@ function splitsEventEmitterFactory(EventEmitter: new () => SplitIO.IEventEmitter
8
8
  const splitsEventEmitter = objectAssign(new EventEmitter(), {
9
9
  splitsArrived: false,
10
10
  splitsCacheLoaded: false,
11
- initialized: false,
11
+ hasInit: false,
12
12
  initCallbacks: []
13
13
  });
14
14
 
@@ -68,7 +68,7 @@ export function readinessManagerFactory(
68
68
 
69
69
  let readyTimeoutId: ReturnType<typeof setTimeout>;
70
70
  if (readyTimeout > 0) {
71
- if (splits.initialized) readyTimeoutId = setTimeout(timeout, readyTimeout);
71
+ if (splits.hasInit) readyTimeoutId = setTimeout(timeout, readyTimeout);
72
72
  else splits.initCallbacks.push(() => { readyTimeoutId = setTimeout(timeout, readyTimeout); });
73
73
  }
74
74
 
@@ -137,8 +137,8 @@ export function readinessManagerFactory(
137
137
  setDestroyed() { isDestroyed = true; },
138
138
 
139
139
  init() {
140
- if (splits.initialized) return;
141
- splits.initialized = true;
140
+ if (splits.hasInit) return;
141
+ splits.hasInit = true;
142
142
  splits.initCallbacks.forEach(cb => cb());
143
143
  },
144
144
 
@@ -13,7 +13,7 @@ export interface ISplitsEventEmitter extends SplitIO.IEventEmitter {
13
13
  once(event: ISplitsEvent, listener: (...args: any[]) => void): this;
14
14
  splitsArrived: boolean
15
15
  splitsCacheLoaded: boolean
16
- initialized: boolean,
16
+ hasInit: boolean,
17
17
  initCallbacks: (() => void)[]
18
18
  }
19
19
 
@@ -84,7 +84,7 @@ interface ISharedSettings {
84
84
  urls?: SplitIO.UrlSettings;
85
85
  }
86
86
  /**
87
- * Common settings properties for SDKs with synchronous API (standalone and localhost modes).
87
+ * Common settings properties for SDKs with synchronous API (standalone and localhost modes).
88
88
  */
89
89
  interface ISyncSharedSettings extends ISharedSettings {
90
90
  /**
@@ -117,9 +117,9 @@ interface ISyncSharedSettings extends ISharedSettings {
117
117
  };
118
118
  }
119
119
  /**
120
- * Common settings properties for SDKs with pluggable configuration.
120
+ * Common settings properties for SDKs with pluggable options.
121
121
  */
122
- interface IPluggableSettings {
122
+ interface IPluggableSharedSettings {
123
123
  /**
124
124
  * Boolean value to indicate whether the logger should be enabled or disabled by default, or a log level string or a Logger object.
125
125
  * Passing a logger object is required to get descriptive log messages. Otherwise most logs will print with message codes.
@@ -143,9 +143,9 @@ interface IPluggableSettings {
143
143
  integrations?: SplitIO.IntegrationFactory[];
144
144
  }
145
145
  /**
146
- * Common settings properties for SDKs without pluggable configuration.
146
+ * Common settings properties for SDKs without pluggable options.
147
147
  */
148
- interface INonPluggableSettings {
148
+ interface INonPluggableSharedSettings {
149
149
  /**
150
150
  * Boolean value to indicate whether the logger should be enabled or disabled, or a log level string.
151
151
  *
@@ -160,7 +160,7 @@ interface INonPluggableSettings {
160
160
  debug?: boolean | SplitIO.LogLevel;
161
161
  }
162
162
  /**
163
- * Common settings properties for server-side SDKs.
163
+ * Common settings properties for SDKs with server-side API.
164
164
  */
165
165
  interface IServerSideSharedSettings {
166
166
  /**
@@ -295,7 +295,7 @@ interface IServerSideSharedSettings {
295
295
  features?: SplitIO.MockedFeaturesFilePath;
296
296
  }
297
297
  /**
298
- * Common settings properties for client-side SDKs.
298
+ * Common settings properties for SDKs with client-side API.
299
299
  */
300
300
  interface IClientSideSharedSettings {
301
301
  /**
@@ -333,7 +333,7 @@ interface IClientSideSharedSettings {
333
333
  userConsent?: SplitIO.ConsentStatus;
334
334
  }
335
335
  /**
336
- * Common settings properties for client-side standalone SDKs.
336
+ * Common settings properties for SDKs with client-side and synchronous API (standalone and localhost modes).
337
337
  */
338
338
  interface IClientSideSyncSharedSettings extends IClientSideSharedSettings, ISyncSharedSettings {
339
339
  /**
@@ -1096,7 +1096,7 @@ declare namespace SplitIO {
1096
1096
  *
1097
1097
  * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#configuration}
1098
1098
  */
1099
- interface IClientSideSettings extends IClientSideSyncSharedSettings, IPluggableSettings {
1099
+ interface IClientSideSettings extends IClientSideSyncSharedSettings, IPluggableSharedSettings {
1100
1100
  /**
1101
1101
  * Defines the factory function to instantiate the storage. If not provided, the default in-memory storage is used.
1102
1102
  *
@@ -1124,7 +1124,7 @@ declare namespace SplitIO {
1124
1124
  *
1125
1125
  * @see {@link https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK#sharing-state-with-a-pluggable-storage}
1126
1126
  */
1127
- interface IClientSideAsyncSettings extends IClientSideSharedSettings, ISharedSettings, IPluggableSettings {
1127
+ interface IClientSideAsyncSettings extends IClientSideSharedSettings, ISharedSettings, IPluggableSharedSettings {
1128
1128
  /**
1129
1129
  * The SDK mode. When using `PluggableStorage` as storage, the possible values are "consumer" and "consumer_partial".
1130
1130
  *
@@ -1216,7 +1216,7 @@ declare namespace SplitIO {
1216
1216
  *
1217
1217
  * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#configuration}
1218
1218
  */
1219
- interface IBrowserSettings extends IClientSideSyncSharedSettings, INonPluggableSettings {
1219
+ interface IBrowserSettings extends IClientSideSyncSharedSettings, INonPluggableSharedSettings {
1220
1220
  /**
1221
1221
  * Defines which kind of storage we can instantiate on the browser.
1222
1222
  * Possible storage types are 'MEMORY', which is the default, and 'LOCALSTORAGE'.
@@ -1242,7 +1242,7 @@ declare namespace SplitIO {
1242
1242
  *
1243
1243
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
1244
1244
  */
1245
- interface INodeSettings extends IServerSideSharedSettings, ISyncSharedSettings, INonPluggableSettings {
1245
+ interface INodeSettings extends IServerSideSharedSettings, ISyncSharedSettings, INonPluggableSharedSettings {
1246
1246
  /**
1247
1247
  * Defines which kind of storage we can instantiate on NodeJS for 'standalone' mode.
1248
1248
  * The only possible storage type is 'MEMORY', which is the default.
@@ -1324,7 +1324,7 @@ declare namespace SplitIO {
1324
1324
  *
1325
1325
  * @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
1326
1326
  */
1327
- interface INodeAsyncSettings extends IServerSideSharedSettings, ISharedSettings, INonPluggableSettings {
1327
+ interface INodeAsyncSettings extends IServerSideSharedSettings, ISharedSettings, INonPluggableSharedSettings {
1328
1328
  /**
1329
1329
  * The SDK mode. When using 'REDIS' storage type, the only possible value is "consumer", which is required.
1330
1330
  *