@splitsoftware/splitio 11.0.0-rc.0 → 11.0.0-rc.1

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,15 +1,18 @@
1
1
  11.0.0 (October XX, 2024)
2
2
  - Added support for targeting rules based on large segments for browsers.
3
+ - Added `factory.getState()` method for standalone server-side SDKs, which returns the rollout plan snapshot from the storage.
4
+ - Added `preloadedData` configuration option for standalone client-side SDKs, which allows preloading the SDK storage with a snapshot of the rollout plan.
3
5
  - Added `factory.destroy()` method, which invokes the `destroy` method of all clients created by the factory.
4
6
  - Updated @splitsoftware/splitio-commons package to version 2.0.0 that includes major updates and updated some transitive dependencies for vulnerability fixes.
7
+ - Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for EcmaScript Modules build.
5
8
  - BREAKING CHANGES:
6
- - Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for EcmaScript Modules build.
7
- - Drop support for NodeJS v6. The SDK now requires NodeJS v14 or above.
8
- - Removed internal ponyfills for `Map`, `Set` and `Array.from` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or to provide a polyfill.
9
- - Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations.
10
- - Removed clients with bound traffic type. the `core.trafficType` configuration option. The SDK now uses the `core.trafficType` value from the factory configuration to create clients.
11
- - Updated TypeScript definitions.
12
- - Bugfixing - Removed an overloaded `client` method in the `SplitIO.ISDK` interface that accepted a key and trafficType parameters. This interface corresponds to the SDK factory instance in NodeJS, which, unlike `SplitIO.IBrowserSDK` for the Browser, does not handle multiple client instances based on keys or traffic types.
9
+ - Dropped support for NodeJS v6. The SDK now requires NodeJS v14 or above.
10
+ - Removed internal ponyfills for the `Map` and `Set` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or provide a polyfill.
11
+ - Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations. The `integrations` configuration option has been removed from the SDK factory configuration, along with the associated interfaces in the TypeScript definitions.
12
+ - Removed the `core.trafficType` configuration option (`SplitIO.IBrowserSettings['core']['trafficType]`) and the `trafficType` parameter from the SDK `client()` method in Browser (`SplitIO.IBrowserSDK['client']`). As a result, traffic types can no longer be bound to SDK clients, and the traffic type must be provided in the `track` method.
13
+ - TypeScript definitions:
14
+ - Removed an overloaded `client` method in the `SplitIO.ISDK` interface that accepted `key` and `trafficType` parameters. This interface corresponds to the SDK factory instance in NodeJS, which, unlike `SplitIO.IBrowserSDK` for the Browser, does not handle multiple client instances based on keys.
15
+ - Updated the `SplitIO.IBrowserSDK` and `SplitIO.IBrowserClient` interfaces to no longer extend the `SplitIO.ISDK` and `SplitIO.IClient` interfaces respectively, as the SDK factory instance in NodeJS or server-side (`SplitIO.ISDK`) has a different API than the SDK client instance in the Browser or client-side (`SplitIO.IBrowserClient`).
13
16
 
14
17
  10.28.0 (September 6, 2024)
15
18
  - Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
@@ -7,6 +7,7 @@ var pushManager_1 = require("@splitsoftware/splitio-commons/cjs/sync/streaming/p
7
7
  var pollingManagerSS_1 = require("@splitsoftware/splitio-commons/cjs/sync/polling/pollingManagerSS");
8
8
  var inRedis_1 = require("@splitsoftware/splitio-commons/cjs/storages/inRedis");
9
9
  var InMemoryStorage_1 = require("@splitsoftware/splitio-commons/cjs/storages/inMemory/InMemoryStorage");
10
+ var dataLoader_1 = require("@splitsoftware/splitio-commons/cjs/storages/dataLoader");
10
11
  var sdkManager_1 = require("@splitsoftware/splitio-commons/cjs/sdkManager");
11
12
  var sdkClientMethod_1 = require("@splitsoftware/splitio-commons/cjs/sdkClient/sdkClientMethod");
12
13
  var impressionObserverSS_1 = require("@splitsoftware/splitio-commons/cjs/trackers/impressionObserver/impressionObserverSS");
@@ -36,7 +37,16 @@ function getModules(settings) {
36
37
  sdkClientMethodFactory: sdkClientMethod_1.sdkClientMethodFactory,
37
38
  SignalListener: platform_1.SignalListener,
38
39
  impressionsObserverFactory: impressionObserverSS_1.impressionObserverSSFactory,
39
- filterAdapterFactory: bloomFilter_1.bloomFilterFactory
40
+ filterAdapterFactory: bloomFilter_1.bloomFilterFactory,
41
+ extraProps: function (params) {
42
+ if (params.settings.mode !== constants_1.CONSUMER_MODE) {
43
+ return {
44
+ getState: function (userKeys) {
45
+ return (0, dataLoader_1.getSnapshot)(params.storage, userKeys);
46
+ }
47
+ };
48
+ }
49
+ }
40
50
  };
41
51
  switch (settings.mode) {
42
52
  case constants_1.LOCALHOST_MODE:
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageVersion = void 0;
4
- exports.packageVersion = '11.0.0-rc.0';
4
+ exports.packageVersion = '11.0.0-rc.1';
@@ -4,6 +4,7 @@ import { pushManagerFactory } from '@splitsoftware/splitio-commons/esm/sync/stre
4
4
  import { pollingManagerSSFactory } from '@splitsoftware/splitio-commons/esm/sync/polling/pollingManagerSS';
5
5
  import { InRedisStorage } from '@splitsoftware/splitio-commons/esm/storages/inRedis';
6
6
  import { InMemoryStorageFactory } from '@splitsoftware/splitio-commons/esm/storages/inMemory/InMemoryStorage';
7
+ import { getSnapshot } from '@splitsoftware/splitio-commons/esm/storages/dataLoader';
7
8
  import { sdkManagerFactory } from '@splitsoftware/splitio-commons/esm/sdkManager';
8
9
  import { sdkClientMethodFactory } from '@splitsoftware/splitio-commons/esm/sdkClient/sdkClientMethod';
9
10
  import { impressionObserverSSFactory } from '@splitsoftware/splitio-commons/esm/trackers/impressionObserver/impressionObserverSS';
@@ -33,7 +34,16 @@ function getModules(settings) {
33
34
  sdkClientMethodFactory: sdkClientMethodFactory,
34
35
  SignalListener: SignalListener,
35
36
  impressionsObserverFactory: impressionObserverSSFactory,
36
- filterAdapterFactory: bloomFilterFactory
37
+ filterAdapterFactory: bloomFilterFactory,
38
+ extraProps: function (params) {
39
+ if (params.settings.mode !== CONSUMER_MODE) {
40
+ return {
41
+ getState: function (userKeys) {
42
+ return getSnapshot(params.storage, userKeys);
43
+ }
44
+ };
45
+ }
46
+ }
37
47
  };
38
48
  switch (settings.mode) {
39
49
  case LOCALHOST_MODE:
@@ -1 +1 @@
1
- export var packageVersion = '11.0.0-rc.0';
1
+ export var packageVersion = '11.0.0-rc.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio",
3
- "version": "11.0.0-rc.0",
3
+ "version": "11.0.0-rc.1",
4
4
  "description": "Split SDK",
5
5
  "files": [
6
6
  "README.md",
@@ -38,7 +38,7 @@
38
38
  "node": ">=14.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@splitsoftware/splitio-commons": "2.0.0-rc.0",
41
+ "@splitsoftware/splitio-commons": "2.0.0-rc.2",
42
42
  "@types/ioredis": "^4.28.0",
43
43
  "bloom-filters": "^3.0.0",
44
44
  "ioredis": "^4.28.0",
@@ -4,6 +4,7 @@ import { pushManagerFactory } from '@splitsoftware/splitio-commons/src/sync/stre
4
4
  import { pollingManagerSSFactory } from '@splitsoftware/splitio-commons/src/sync/polling/pollingManagerSS';
5
5
  import { InRedisStorage } from '@splitsoftware/splitio-commons/src/storages/inRedis';
6
6
  import { InMemoryStorageFactory } from '@splitsoftware/splitio-commons/src/storages/inMemory/InMemoryStorage';
7
+ import { getSnapshot } from '@splitsoftware/splitio-commons/src/storages/dataLoader';
7
8
  import { sdkManagerFactory } from '@splitsoftware/splitio-commons/src/sdkManager';
8
9
  import { sdkClientMethodFactory } from '@splitsoftware/splitio-commons/src/sdkClient/sdkClientMethod';
9
10
  import { impressionObserverSSFactory } from '@splitsoftware/splitio-commons/src/trackers/impressionObserver/impressionObserverSS';
@@ -47,7 +48,17 @@ function getModules(settings) {
47
48
 
48
49
  impressionsObserverFactory: impressionObserverSSFactory,
49
50
 
50
- filterAdapterFactory: bloomFilterFactory
51
+ filterAdapterFactory: bloomFilterFactory,
52
+
53
+ extraProps: (params) => {
54
+ if (params.settings.mode !== CONSUMER_MODE) {
55
+ return {
56
+ getState(userKeys) {
57
+ return getSnapshot(params.storage, userKeys);
58
+ }
59
+ };
60
+ }
61
+ }
51
62
  };
52
63
 
53
64
  switch (settings.mode) {
@@ -1 +1 @@
1
- export const packageVersion = '11.0.0-rc.0';
1
+ export const packageVersion = '11.0.0-rc.1';
@@ -92,6 +92,7 @@ interface ISettings {
92
92
  options: Object,
93
93
  type: StorageType
94
94
  },
95
+ readonly preloadedData?: SplitIO.PreloadedData,
95
96
  readonly urls: {
96
97
  events: string,
97
98
  sdk: string,
@@ -441,7 +442,17 @@ interface IStatusInterface extends EventEmitter {
441
442
  /**
442
443
  * Returns a promise that resolves once the SDK has finished loading (`SDK_READY` event emitted) or rejected if the SDK has timedout (`SDK_READY_TIMED_OUT` event emitted).
443
444
  * As it's meant to provide similar flexibility to the event approach, given that the SDK might be eventually ready after a timeout event, the `ready` method will return a resolved promise once the SDK is ready.
444
- * You must handle the promise rejection to avoid an unhandled promise rejection error, or you can set the `startup.readyTimeout` configuration option to 0 to avoid the timeout and thus the rejection.
445
+ *
446
+ * Caveats: the method was designed to avoid an unhandled Promise rejection if the rejection case is not handled, so that `onRejected` handler is optional when using promises.
447
+ * However, when using async/await syntax, the rejection should be explicitly propagated like in the following example:
448
+ * ```
449
+ * try {
450
+ * await client.ready().catch((e) => { throw e; });
451
+ * // SDK is ready
452
+ * } catch(e) {
453
+ * // SDK has timedout
454
+ * }
455
+ * ```
445
456
  *
446
457
  * @function ready
447
458
  * @returns {Promise<void>}
@@ -788,6 +799,10 @@ declare namespace SplitIO {
788
799
  * @typedef {string} ConsentStatus
789
800
  */
790
801
  type ConsentStatus = 'GRANTED' | 'DECLINED' | 'UNKNOWN';
802
+ /**
803
+ * Defines the format of rollout plan data to preload on the factory storage (cache).
804
+ */
805
+ type PreloadedData = Object;
791
806
  /**
792
807
  * Settings interface for SDK instances created on the browser
793
808
  * @interface IBrowserSettings
@@ -946,6 +961,10 @@ declare namespace SplitIO {
946
961
  */
947
962
  prefix?: string
948
963
  },
964
+ /**
965
+ * @TODO Add description. Should be inside storage?
966
+ */
967
+ preloadedData?: SplitIO.PreloadedData,
949
968
  /**
950
969
  * List of URLs that the SDK will use as base for it's synchronization functionalities, applicable only when running as standalone.
951
970
  * Do not change these settings unless you're working an advanced use case, like connecting to the Split proxy.
@@ -1211,7 +1230,11 @@ declare namespace SplitIO {
1211
1230
  * @function manager
1212
1231
  * @returns {IManager} The manager instance.
1213
1232
  */
1214
- manager(): IManager
1233
+ manager(): IManager,
1234
+ /**
1235
+ * @TODO add description
1236
+ */
1237
+ getState(keys?: SplitKey[]): PreloadedData,
1215
1238
  }
1216
1239
  /**
1217
1240
  * This represents the interface for the SDK instance with synchronous storage.