You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGES.txt
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
0.13.0 (December XX, 2023)
2
2
- Added support for Flag Sets in "consumer" and "partial consumer" modes (pluggable storage).
3
-
- Updated @splitsoftware/splitio-commons package to version 1.12.0 that includes flag sets support for "consumer" and "partial consumer" modes, and other improvements.
3
+
- Updated SDK cache for browsers using localStorage, to clear cached feature flag definitions before initiating the synchronization process, if the cache was previously synchronized with a different SDK key (i.e., a different environment) or different Split Filter criteria.
4
+
- Updated @splitsoftware/splitio-commons package to version 1.12.1 that includes flag sets support for "consumer" and "partial consumer" modes, and other improvements.
4
5
- Bugfixing - Fixed manager methods in consumer modes to return results in a promise when the SDK is not operational (not ready or destroyed).
localStorage.setItem('readyFromCache_4.SPLITIO.splits.lastUpdated',Date.now()-DEFAULT_CACHE_EXPIRATION_IN_MILLIS-1);// -1 to ensure having an expired lastUpdated item
@@ -467,13 +474,13 @@ export default function (fetchMock, assert) {
467
474
468
475
/** Fetch specific splits **/
469
476
470
-
assert.test(t=>{// Testing when we start with cached data without split filter, and a valid split filter config
477
+
assert.test(t=>{// Testing when we start with cached data but without storage hash (JS SDK <=v10.24.0 and Browser SDK <=v0.12.0), and a valid split filter config
471
478
consttestUrls={
472
479
sdk: 'https://sdk.baseurl/readyFromCache_5',
473
480
events: 'https://events.baseurl/readyFromCache_5'
474
481
};
475
482
localStorage.clear();
476
-
t.plan(6);
483
+
t.plan(7);
477
484
478
485
fetchMock.getOnce(testUrls.sdk+'/splitChanges?since=-1&names=p1__split,p2__split',{status: 200,body: {splits: [splitDeclarations.p1__split,splitDeclarations.p2__split],since: -1,till: 1457552620999}},{delay: 10});// short delay to let emit SDK_READY_FROM_CACHE
localStorage.setItem('readyFromCache_5.SPLITIO.splits.filterQuery','&names=p2__split,p3__split');// Deprecated item, should be cleaned
486
494
487
495
constsplitio=SplitFactory({
488
496
...baseConfig,
@@ -511,7 +519,8 @@ export default function (fetchMock, assert) {
511
519
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
512
520
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
513
521
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
514
-
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.filterQuery'),'&names=p1__split,p2__split','splits.filterQuery must correspond to the split filter query');
522
+
t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.hash'),expectedHashWithFilter,'Storage hash must correspond to the one for the SDK key and feature flag filter query');
@@ -554,13 +563,13 @@ export default function (fetchMock, assert) {
554
563
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
555
564
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
556
565
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
557
-
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.splits.filterQuery'),'&names=p1__split,p2__split','splits.filterQuery must correspond to the split filter query');
566
+
t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.hash'),expectedHashWithFilter,'Storage hash must correspond to the split filter query and SDK key');
558
567
t.end();
559
568
});
560
569
});
561
570
});
562
571
563
-
assert.test(t=>{// Testing when we start with cached data with split filter, and the same split filter config
572
+
assert.test(t=>{// Testing when we start with cached data with split filter, and the same split filter is provided in the config
564
573
consttestUrls={
565
574
sdk: 'https://sdk.baseurl/readyFromCache_6',
566
575
events: 'https://events.baseurl/readyFromCache_6'
@@ -571,11 +580,13 @@ export default function (fetchMock, assert) {
571
580
fetchMock.getOnce(testUrls.sdk+'/splitChanges?since=25&names=p2__split&prefixes=p1',{status: 200,body: {splits: [splitDeclarations.p1__split,splitDeclarations.p2__split],since: 25,till: 1457552620999}},{delay: 10});// short delay to let emit SDK_READY_FROM_CACHE
@@ -603,13 +614,13 @@ export default function (fetchMock, assert) {
603
614
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
604
615
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
605
616
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
606
-
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.splits.filterQuery'),'&names=p2__split&prefixes=p1','splits.filterQuery must correspond to the split filter query');
617
+
t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.hash'),expectedHash,'Storage hash must correspond to the split filter query and SDK key');
607
618
t.end();
608
619
});
609
620
});
610
621
});
611
622
612
-
assert.test(t=>{// Testing when we start with cached data with split filter but expired, and the same split filter config
623
+
assert.test(t=>{// Testing when we start with cached data with split filter but expired, and the same split filter is provided in the config
613
624
consttestUrls={
614
625
sdk: 'https://sdk.baseurl/readyFromCache_7',
615
626
events: 'https://events.baseurl/readyFromCache_7'
@@ -620,11 +631,12 @@ export default function (fetchMock, assert) {
620
631
fetchMock.getOnce(testUrls.sdk+'/splitChanges?since=-1&prefixes=p1,p2',{status: 200,body: {splits: [splitDeclarations.p1__split,splitDeclarations.p2__split],since: -1,till: 1457552620999}},{delay: 10});// short delay to let emit SDK_READY_FROM_CACHE
localStorage.setItem('readyFromCache_7.SPLITIO.splits.lastUpdated',Date.now()-DEFAULT_CACHE_EXPIRATION_IN_MILLIS-1);// -1 to ensure having an expired lastUpdated item
629
641
630
642
constsplitio=SplitFactory({
@@ -654,7 +666,7 @@ export default function (fetchMock, assert) {
654
666
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
655
667
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
656
668
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
657
-
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.splits.filterQuery'),'&prefixes=p1,p2','splits.filterQuery must correspond to the split filter query');
669
+
t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.hash'),expectedHash,'Storage hash must correspond to the split filter query and SDK key');
658
670
t.end();
659
671
});
660
672
});
@@ -689,7 +701,7 @@ export default function (fetchMock, assert) {
@@ -717,7 +729,7 @@ export default function (fetchMock, assert) {
717
729
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p1__split'),JSON.stringify(splitDeclarations.p1__split),'split declarations must be cached');
718
730
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
719
731
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p3__split'),JSON.stringify(splitDeclarations.p3__split),'split declarations must be cached');
720
-
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.splits.filterQuery'),null,'splits.filterQuery must correspond to the split filter query');
732
+
t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.hash'),expectedHashNullFilter,'Storage hash must correspond to the split filter query and SDK key');
721
733
t.end();
722
734
});
723
735
});
@@ -726,7 +738,7 @@ export default function (fetchMock, assert) {
726
738
});
727
739
});
728
740
729
-
assert.test(t=>{// Testing when we start with cached data with split filter, and a new valid split filter config
741
+
assert.test(t=>{// Testing when we start with cached data with split filter, and a new split filter is provided in the config
730
742
consttestUrls={
731
743
sdk: 'https://sdk.baseurl/readyFromCache_9',
732
744
events: 'https://events.baseurl/readyFromCache_9'
@@ -741,7 +753,7 @@ export default function (fetchMock, assert) {
@@ -770,7 +782,7 @@ export default function (fetchMock, assert) {
770
782
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.splits.till'),'1457552620999','splits.till must correspond to the till of the last successfully fetched Splits');
771
783
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'),JSON.stringify(splitDeclarations.p2__split),'split declarations must be cached');
772
784
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'),JSON.stringify(splitDeclarations.p3__split),'split declarations must be cached');
773
-
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.splits.filterQuery'),'&names=no%20exist%20trim,no_exist,p3__split&prefixes=no%20exist%20trim,p2','splits.filterQuery must correspond to the split filter query');
785
+
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.hash'),getStorageHash({ ...baseConfig,sync: {__splitFiltersValidation: {queryString: '&names=no%20exist%20trim,no_exist,p3__split&prefixes=no%20exist%20trim,p2'}}}),'Storage hash must correspond to the split filter query and SDK key');
0 commit comments