@splitsoftware/splitio-commons 2.5.0-rc.1 → 2.5.1-rc.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 +13 -1
- package/cjs/storages/getRolloutPlan.js +1 -1
- package/cjs/storages/inLocalStorage/MySegmentsCacheInLocal.js +16 -16
- package/cjs/storages/inLocalStorage/RBSegmentsCacheInLocal.js +17 -17
- package/cjs/storages/inLocalStorage/SplitsCacheInLocal.js +33 -37
- package/cjs/storages/inLocalStorage/index.js +31 -13
- package/cjs/storages/inLocalStorage/storageAdapter.js +54 -0
- package/cjs/storages/inLocalStorage/validateCache.js +28 -23
- package/cjs/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
- package/cjs/sync/polling/updaters/mySegmentsUpdater.js +2 -0
- package/cjs/sync/polling/updaters/splitChangesUpdater.js +2 -0
- package/cjs/sync/syncManagerOnline.js +28 -24
- package/cjs/utils/env/isLocalStorageAvailable.js +22 -1
- package/cjs/utils/settingsValidation/storage/storageCS.js +1 -1
- package/esm/storages/getRolloutPlan.js +1 -1
- package/esm/storages/inLocalStorage/MySegmentsCacheInLocal.js +16 -16
- package/esm/storages/inLocalStorage/RBSegmentsCacheInLocal.js +17 -17
- package/esm/storages/inLocalStorage/SplitsCacheInLocal.js +33 -37
- package/esm/storages/inLocalStorage/index.js +32 -14
- package/esm/storages/inLocalStorage/storageAdapter.js +50 -0
- package/esm/storages/inLocalStorage/validateCache.js +28 -23
- package/esm/sync/offline/syncTasks/fromObjectSyncTask.js +2 -3
- package/esm/sync/polling/updaters/mySegmentsUpdater.js +2 -0
- package/esm/sync/polling/updaters/splitChangesUpdater.js +2 -0
- package/esm/sync/syncManagerOnline.js +28 -24
- package/esm/utils/env/isLocalStorageAvailable.js +19 -0
- package/esm/utils/settingsValidation/storage/storageCS.js +1 -1
- package/package.json +1 -1
- package/src/storages/getRolloutPlan.ts +1 -1
- package/src/storages/inLocalStorage/MySegmentsCacheInLocal.ts +18 -17
- package/src/storages/inLocalStorage/RBSegmentsCacheInLocal.ts +19 -18
- package/src/storages/inLocalStorage/SplitsCacheInLocal.ts +34 -37
- package/src/storages/inLocalStorage/index.ts +37 -16
- package/src/storages/inLocalStorage/storageAdapter.ts +62 -0
- package/src/storages/inLocalStorage/validateCache.ts +29 -23
- package/src/storages/types.ts +19 -1
- package/src/sync/offline/syncTasks/fromObjectSyncTask.ts +1 -2
- package/src/sync/polling/updaters/mySegmentsUpdater.ts +2 -0
- package/src/sync/polling/updaters/splitChangesUpdater.ts +3 -1
- package/src/sync/syncManagerOnline.ts +27 -22
- package/src/utils/env/isLocalStorageAvailable.ts +20 -0
- package/src/utils/settingsValidation/storage/storageCS.ts +1 -1
- package/types/splitio.d.ts +38 -1
package/types/splitio.d.ts
CHANGED
|
@@ -463,6 +463,24 @@ interface IClientSideSyncSharedSettings extends IClientSideSharedSettings, ISync
|
|
|
463
463
|
*/
|
|
464
464
|
declare namespace SplitIO {
|
|
465
465
|
|
|
466
|
+
interface StorageWrapper {
|
|
467
|
+
/**
|
|
468
|
+
* Returns the value associated with the given key, or null if the key does not exist.
|
|
469
|
+
* If the operation is asynchronous, returns a Promise.
|
|
470
|
+
*/
|
|
471
|
+
getItem(key: string): string | null | Promise<string | null>;
|
|
472
|
+
/**
|
|
473
|
+
* Sets the value for the given key, creating a new key/value pair if key does not exist.
|
|
474
|
+
* If the operation is asynchronous, returns a Promise.
|
|
475
|
+
*/
|
|
476
|
+
setItem(key: string, value: string): void | Promise<void>;
|
|
477
|
+
/**
|
|
478
|
+
* Removes the key/value pair for the given key, if the key exists.
|
|
479
|
+
* If the operation is asynchronous, returns a Promise.
|
|
480
|
+
*/
|
|
481
|
+
removeItem(key: string): void | Promise<void>;
|
|
482
|
+
}
|
|
483
|
+
|
|
466
484
|
/**
|
|
467
485
|
* EventEmitter interface based on a subset of the Node.js EventEmitter methods.
|
|
468
486
|
*/
|
|
@@ -978,6 +996,12 @@ declare namespace SplitIO {
|
|
|
978
996
|
* @defaultValue `false`
|
|
979
997
|
*/
|
|
980
998
|
clearOnInit?: boolean;
|
|
999
|
+
/**
|
|
1000
|
+
* Optional storage wrapper to persist rollout plan related data. If not provided, the SDK will use the default localStorage Web API.
|
|
1001
|
+
*
|
|
1002
|
+
* @defaultValue `window.localStorage`
|
|
1003
|
+
*/
|
|
1004
|
+
wrapper?: StorageWrapper;
|
|
981
1005
|
}
|
|
982
1006
|
/**
|
|
983
1007
|
* Storage for asynchronous (consumer) SDK.
|
|
@@ -1339,6 +1363,12 @@ declare namespace SplitIO {
|
|
|
1339
1363
|
* @defaultValue `false`
|
|
1340
1364
|
*/
|
|
1341
1365
|
clearOnInit?: boolean;
|
|
1366
|
+
/**
|
|
1367
|
+
* Optional storage wrapper to persist rollout plan related data. If not provided, the SDK will use the default localStorage Web API.
|
|
1368
|
+
*
|
|
1369
|
+
* @defaultValue `window.localStorage`
|
|
1370
|
+
*/
|
|
1371
|
+
wrapper?: StorageWrapper;
|
|
1342
1372
|
};
|
|
1343
1373
|
}
|
|
1344
1374
|
/**
|
|
@@ -1594,7 +1624,14 @@ declare namespace SplitIO {
|
|
|
1594
1624
|
/**
|
|
1595
1625
|
* Returns the current snapshot of the SDK rollout plan in cache.
|
|
1596
1626
|
*
|
|
1597
|
-
*
|
|
1627
|
+
* Wait for the SDK client to be ready before calling this method.
|
|
1628
|
+
*
|
|
1629
|
+
* ```js
|
|
1630
|
+
* await factory.client().ready();
|
|
1631
|
+
* const rolloutPlan = factory.getRolloutPlan();
|
|
1632
|
+
* ```
|
|
1633
|
+
*
|
|
1634
|
+
* @param options - An object of type RolloutPlanOptions for advanced options.
|
|
1598
1635
|
* @returns The current snapshot of the SDK rollout plan.
|
|
1599
1636
|
*/
|
|
1600
1637
|
getRolloutPlan(options?: RolloutPlanOptions): RolloutPlan;
|