From c3e93a3188db6b499bbf7c876b985d7cff24d09a Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 6 Dec 2023 19:01:39 -0300 Subject: [PATCH 1/5] Update LocalStorage to clear storage if either SDK key or filter criteria changes --- package-lock.json | 14 +-- package.json | 2 +- .../browserSuites/push-corner-cases.spec.js | 2 + .../browserSuites/ready-from-cache.spec.js | 87 +++++++------------ src/__tests__/errorCatching/browser.spec.js | 2 + 5 files changed, 41 insertions(+), 66 deletions(-) diff --git a/package-lock.json b/package-lock.json index e6332b074..94960a6e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "10.24.0", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "1.12.0", + "@splitsoftware/splitio-commons": "1.12.1-rc.5", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -874,9 +874,9 @@ "dev": true }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.0.tgz", - "integrity": "sha512-1k8AXqRsY0vbuvKDbHAevrZpLs1FKoQWOJ0yzeDLA3KWQLEuMW5eRfc6gnGfiWwamInHXrEo+rlaNNU9+C7BVg==", + "version": "1.12.1-rc.5", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.5.tgz", + "integrity": "sha512-pM+08d98dnN2EtIQ+Eo3g5f7NEOktILYfYDiTjomVdIw9BmEfiwqE9lXCPbp0LXdf8fvyxZM93QM7RSFAikZsA==", "dependencies": { "tslib": "^2.3.1" }, @@ -8446,9 +8446,9 @@ "dev": true }, "@splitsoftware/splitio-commons": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.0.tgz", - "integrity": "sha512-1k8AXqRsY0vbuvKDbHAevrZpLs1FKoQWOJ0yzeDLA3KWQLEuMW5eRfc6gnGfiWwamInHXrEo+rlaNNU9+C7BVg==", + "version": "1.12.1-rc.5", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.5.tgz", + "integrity": "sha512-pM+08d98dnN2EtIQ+Eo3g5f7NEOktILYfYDiTjomVdIw9BmEfiwqE9lXCPbp0LXdf8fvyxZM93QM7RSFAikZsA==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index 986a418dd..e33f02a12 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "node": ">=6" }, "dependencies": { - "@splitsoftware/splitio-commons": "1.12.0", + "@splitsoftware/splitio-commons": "1.12.1-rc.5", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", diff --git a/src/__tests__/browserSuites/push-corner-cases.spec.js b/src/__tests__/browserSuites/push-corner-cases.spec.js index 57ae84228..6171659fc 100644 --- a/src/__tests__/browserSuites/push-corner-cases.spec.js +++ b/src/__tests__/browserSuites/push-corner-cases.spec.js @@ -9,6 +9,7 @@ window.EventSource = EventSourceMock; import { SplitFactory } from '../../'; import { settingsFactory } from '../../settings'; +import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; const userKey = 'nicolas@split.io'; @@ -47,6 +48,7 @@ export function testSplitKillOnReadyFromCache(fetchMock, assert) { // prepare localstorage to allow SPLIT_KILL kill locally localStorage.clear(); + localStorage.setItem('pushCornerCase.SPLITIO.hash', getStorageHash(settings)); localStorage.setItem('pushCornerCase.SPLITIO.splits.till', 25); localStorage.setItem('pushCornerCase.SPLITIO.split.whitelist', JSON.stringify({ 'name': 'whitelist', diff --git a/src/__tests__/browserSuites/ready-from-cache.spec.js b/src/__tests__/browserSuites/ready-from-cache.spec.js index 0ab98eb87..83eec8841 100644 --- a/src/__tests__/browserSuites/ready-from-cache.spec.js +++ b/src/__tests__/browserSuites/ready-from-cache.spec.js @@ -3,6 +3,7 @@ import { SplitFactory } from '../../'; import splitChangesMock1 from '../mocks/splitchanges.since.-1.json'; import splitChangesMock2 from '../mocks/splitchanges.since.1457552620999.json'; import mySegmentsNicolas from '../mocks/mysegments.nicolas@split.io.json'; +import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; import { nearlyEqual } from '../testUtils'; @@ -82,6 +83,9 @@ const baseConfig = { streamingEnabled: false }; +const expectedHashNullFilter = '9507ef4'; // for SDK key '' and filter query null +const expectedHashWithFilter = '6a596ded'; // for SDK key '' and filter query '&names=p1__split,p2__split' + export default function (fetchMock, assert) { assert.test(t => { // Testing when we start from scratch @@ -102,7 +106,7 @@ export default function (fetchMock, assert) { ...baseConfig, core: { ...baseConfig.core, - authorizationKey: '', + authorizationKey: '', }, storage: { type: 'LOCALSTORAGE', @@ -162,6 +166,7 @@ export default function (fetchMock, assert) { localStorage.setItem('some_user_item', 'user_item'); localStorage.setItem('readyFromCache_2.SPLITIO.splits.till', 25); localStorage.setItem('readyFromCache_2.SPLITIO.split.always_on', alwaysOnSplitInverted); + localStorage.setItem('readyFromCache_2.SPLITIO.hash', expectedHashNullFilter); const startTime = Date.now(); const splitio = SplitFactory({ @@ -272,6 +277,7 @@ export default function (fetchMock, assert) { localStorage.setItem('readyFromCache_3.SPLITIO.splits.till', 25); localStorage.setItem('readyFromCache_3.SPLITIO.splits.lastUpdated', Date.now()); localStorage.setItem('readyFromCache_3.SPLITIO.split.always_on', alwaysOnSplitInverted); + localStorage.setItem('readyFromCache_3.SPLITIO.hash', expectedHashNullFilter); const startTime = Date.now(); const splitio = SplitFactory({ @@ -389,6 +395,7 @@ export default function (fetchMock, assert) { localStorage.setItem('readyFromCache_4.SPLITIO.splits.till', 25); localStorage.setItem('readyFromCache_4.SPLITIO.splits.lastUpdated', Date.now() - DEFAULT_CACHE_EXPIRATION_IN_MILLIS - 1); // -1 to ensure having an expired lastUpdated item localStorage.setItem('readyFromCache_4.SPLITIO.split.always_on', alwaysOnSplitInverted); + localStorage.setItem('readyFromCache_4.SPLITIO.hash', expectedHashNullFilter); const startTime = Date.now(); const splitio = SplitFactory({ @@ -471,13 +478,13 @@ export default function (fetchMock, assert) { /** Fetch specific splits **/ - assert.test(t => { // Testing when we start with cached data without split filter, and a valid split filter config + assert.test(t => { // Testing when we start with cached data without storage hash (previous version), and a valid split filter config const testUrls = { sdk: 'https://sdk.baseurl/readyFromCache_5', events: 'https://events.baseurl/readyFromCache_5' }; localStorage.clear(); - t.plan(6); + t.plan(7); 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 // fetchMock.getOnce(testUrls.sdk + '/splitChanges?since=1457552620999&names=p1__split', { status: 200, body: { splits: [], since: 1457552620999, till: 1457552620999 } }); @@ -487,6 +494,7 @@ export default function (fetchMock, assert) { localStorage.setItem('readyFromCache_5.SPLITIO.splits.till', 25); localStorage.setItem('readyFromCache_5.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split)); localStorage.setItem('readyFromCache_5.SPLITIO.split.p3__split', JSON.stringify(splitDeclarations.p3__split)); + localStorage.setItem('readyFromCache_5.SPLITIO.splits.filterQuery', '&names=p2__split,p3__split'); // Deprecated item, should be cleaned const splitio = SplitFactory({ ...baseConfig, @@ -509,54 +517,15 @@ export default function (fetchMock, assert) { }); client.once(client.Event.SDK_READY, () => { - t.deepEqual(manager.names(), ['p1__split', 'p2__split'], 'p1__split should be added for evaluation'); + t.deepEqual(manager.names().sort(), ['p1__split', 'p2__split'], 'p1__split should be added for evaluation'); client.destroy().then(() => { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.filterQuery'), '&names=p1__split,p2__split', 'splits.filterQuery must correspond to the split filter query'); - t.end(); - }); - }); - }); - - assert.test(t => { // Testing when we start with cached data with split filter, and the same split filter is provided in the config - const testUrls = { - sdk: 'https://sdk.baseurl/readyFromCache_5', - events: 'https://events.baseurl/readyFromCache_5' - }; - - localStorage.clear(); - t.plan(1); - - fetchMock.getOnce(testUrls.sdk + '/splitChanges?since=25&names=p2__split,p3__split', { status: 200, body: { splits: [splitDeclarations.p2__split, splitDeclarations.p3__split], since: -1, till: 1457552620999 } }, { delay: 10 }); // short delay to let emit SDK_READY_FROM_CACHE - fetchMock.getOnce(testUrls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { mySegments: [] } }); - - localStorage.setItem('some_user_item', 'user_item'); - localStorage.setItem('readyFromCache_5.SPLITIO.splits.till', 25); - localStorage.setItem('readyFromCache_5.SPLITIO.splits.filterQuery', '&names=p2__split,p3__split'); - localStorage.setItem('readyFromCache_5.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split)); - localStorage.setItem('readyFromCache_5.SPLITIO.split.p3__split', JSON.stringify(splitDeclarations.p3__split)); - - const splitio = SplitFactory({ - ...baseConfig, - storage: { - type: 'LOCALSTORAGE', - prefix: 'readyFromCache_5' - }, - urls: testUrls, - sync: { - splitFilters: [{ type: 'byName', values: ['p2__split', 'p3__split'] }] - }, - debug: true - }); - const client = splitio.client(); - - client.once(client.Event.SDK_READY_FROM_CACHE, () => { - t.assert('It should emit SDK_READY_FROM_CACHE because there is cached data for the same queryFilter'); - client.destroy().then(() => { + 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'); + t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.filterQuery'), null); t.end(); }); }); @@ -600,13 +569,13 @@ export default function (fetchMock, assert) { t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.splits.filterQuery'), '&names=p1__split,p2__split', 'splits.filterQuery must correspond to the split filter query'); + t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.hash'), expectedHashWithFilter, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); }); }); - assert.test(t => { // Testing when we start with cached data with split filter, and the same split filter config + assert.test(t => { // Testing when we start with cached data with split filter, and the same split filter is provided in the config const testUrls = { sdk: 'https://sdk.baseurl/readyFromCache_6', events: 'https://events.baseurl/readyFromCache_6' @@ -617,11 +586,12 @@ export default function (fetchMock, assert) { 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 fetchMock.getOnce(testUrls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { mySegments: [] } }); + const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' } } }); localStorage.setItem('some_user_item', 'user_item'); localStorage.setItem('readyFromCache_6.SPLITIO.splits.till', 25); localStorage.setItem('readyFromCache_6.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split)); localStorage.setItem('readyFromCache_6.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split)); - localStorage.setItem('readyFromCache_6.SPLITIO.splits.filterQuery', '&names=p2__split&prefixes=p1'); + localStorage.setItem('readyFromCache_6.SPLITIO.hash', expectedHash); const splitio = SplitFactory({ ...baseConfig, @@ -650,13 +620,13 @@ export default function (fetchMock, assert) { t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.splits.filterQuery'), '&names=p2__split&prefixes=p1', 'splits.filterQuery must correspond to the split filter query'); + t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.hash'), expectedHash, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); }); }); - assert.test(t => { // Testing when we start with cached data with split filter but expired, and the same split filter config + 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 const testUrls = { sdk: 'https://sdk.baseurl/readyFromCache_7', events: 'https://events.baseurl/readyFromCache_7' @@ -667,11 +637,12 @@ export default function (fetchMock, assert) { 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 fetchMock.getOnce(testUrls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { mySegments: [] } }); + const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&prefixes=p1,p2' } } }); localStorage.setItem('some_user_item', 'user_item'); localStorage.setItem('readyFromCache_7.SPLITIO.splits.till', 25); localStorage.setItem('readyFromCache_7.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split)); localStorage.setItem('readyFromCache_7.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split)); - localStorage.setItem('readyFromCache_7.SPLITIO.splits.filterQuery', '&prefixes=p1,p2'); + localStorage.setItem('readyFromCache_7.SPLITIO.hash', expectedHash); localStorage.setItem('readyFromCache_7.SPLITIO.splits.lastUpdated', Date.now() - DEFAULT_CACHE_EXPIRATION_IN_MILLIS - 1); // -1 to ensure having an expired lastUpdated item const splitio = SplitFactory({ @@ -702,7 +673,7 @@ export default function (fetchMock, assert) { t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.splits.filterQuery'), '&prefixes=p1,p2', 'splits.filterQuery must correspond to the split filter query'); + t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.hash'), expectedHash, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); }); @@ -737,7 +708,7 @@ export default function (fetchMock, assert) { localStorage.setItem('readyFromCache_8.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split)); localStorage.setItem('readyFromCache_8.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split)); localStorage.setItem('readyFromCache_8.SPLITIO.split.deleted__split', '{ "name": "deleted_split" }'); - localStorage.setItem('readyFromCache_8.SPLITIO.splits.filterQuery', '&names=p2__split&prefixes=p1'); + localStorage.setItem('readyFromCache_8.SPLITIO.hash', expectedHashWithFilter); const splitio = SplitFactory({ ...baseConfig, @@ -758,7 +729,7 @@ export default function (fetchMock, assert) { }); client.once(client.Event.SDK_READY, () => { - t.deepEqual(manager.names(), ['p1__split', 'p2__split', 'p3__split'], 'active splits should be present for evaluation'); + t.deepEqual(manager.names().sort(), ['p1__split', 'p2__split', 'p3__split'], 'active splits should be present for evaluation'); client.destroy().then(() => { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); @@ -766,7 +737,7 @@ export default function (fetchMock, assert) { t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.splits.filterQuery'), null, 'splits.filterQuery must correspond to the split filter query'); + t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.hash'), expectedHashNullFilter, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); }); @@ -775,7 +746,7 @@ export default function (fetchMock, assert) { }); }); - assert.test(t => { // Testing when we start with cached data with split filter, and a new valid split filter config + assert.test(t => { // Testing when we start with cached data with split filter, and a new split filter is provided in the config const testUrls = { sdk: 'https://sdk.baseurl/readyFromCache_9', events: 'https://events.baseurl/readyFromCache_9' @@ -790,7 +761,7 @@ export default function (fetchMock, assert) { localStorage.setItem('readyFromCache_9.SPLITIO.splits.till', 25); localStorage.setItem('readyFromCache_9.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split)); localStorage.setItem('readyFromCache_9.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split)); - localStorage.setItem('readyFromCache_9.SPLITIO.splits.filterQuery', '&names=p2__split&prefixes=p1'); + localStorage.setItem('readyFromCache_9.SPLITIO.hash', getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' } } })); const splitio = SplitFactory({ ...baseConfig, @@ -815,7 +786,7 @@ export default function (fetchMock, assert) { t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'split declarations must be cached'); - 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'); + 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' } } }), 'splits.filterQuery must correspond to the split filter query'); t.end(); }); }); diff --git a/src/__tests__/errorCatching/browser.spec.js b/src/__tests__/errorCatching/browser.spec.js index 1460b6199..3b6b4a534 100644 --- a/src/__tests__/errorCatching/browser.spec.js +++ b/src/__tests__/errorCatching/browser.spec.js @@ -9,6 +9,7 @@ import splitChangesMock2 from '../mocks/splitChanges.since.1500492097547.till.15 import splitChangesMock3 from '../mocks/splitChanges.since.1500492297547.json'; import { SplitFactory } from '../../'; import { settingsFactory } from '../../settings'; +import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; const settings = settingsFactory({ core: { @@ -20,6 +21,7 @@ const settings = settingsFactory({ // prepare localstorage to emit SDK_READY_FROM_CACHE localStorage.clear(); localStorage.setItem('SPLITIO.splits.till', 25); +localStorage.setItem('SPLITIO.hash', getStorageHash({ core: { authorizationKey: '' }, sync: { __splitFiltersValidation: { queryString: null } } })); fetchMock.get(url(settings, '/splitChanges?since=25'), function () { return new Promise((res) => { setTimeout(() => res({ status: 200, body: splitChangesMock1 }), 1000); }); From 3e49e7030961942ff82c3009710d1a568599a9bf Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Thu, 7 Dec 2023 12:35:57 -0300 Subject: [PATCH 2/5] Add changelog entry --- CHANGES.txt | 4 ++++ package-lock.json | 14 +++++++------- package.json | 2 +- .../browserSuites/ready-from-cache.spec.js | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 660656038..f940ecf71 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +10.24.1 (December XX, 2023) + - 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. + - Updated @splitsoftware/splitio-commons package to version 1.12.1. + 10.24.0 (December 4, 2023) - Added support for Flag Sets on the SDK, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation): - Added new variations of the get treatment methods to support evaluating flags in given flag set/s. diff --git a/package-lock.json b/package-lock.json index 94960a6e9..bb47feb5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "10.24.0", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "1.12.1-rc.5", + "@splitsoftware/splitio-commons": "1.12.1-rc.6", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -874,9 +874,9 @@ "dev": true }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.12.1-rc.5", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.5.tgz", - "integrity": "sha512-pM+08d98dnN2EtIQ+Eo3g5f7NEOktILYfYDiTjomVdIw9BmEfiwqE9lXCPbp0LXdf8fvyxZM93QM7RSFAikZsA==", + "version": "1.12.1-rc.6", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.6.tgz", + "integrity": "sha512-cAfo6xpgWgxzzhItcJi33yf0RgNetKme0mi/t4RmCaCgv21l2JNOd+9cdjLXl7pfuRkXZs7XievRHP771di2Yg==", "dependencies": { "tslib": "^2.3.1" }, @@ -8446,9 +8446,9 @@ "dev": true }, "@splitsoftware/splitio-commons": { - "version": "1.12.1-rc.5", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.5.tgz", - "integrity": "sha512-pM+08d98dnN2EtIQ+Eo3g5f7NEOktILYfYDiTjomVdIw9BmEfiwqE9lXCPbp0LXdf8fvyxZM93QM7RSFAikZsA==", + "version": "1.12.1-rc.6", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.6.tgz", + "integrity": "sha512-cAfo6xpgWgxzzhItcJi33yf0RgNetKme0mi/t4RmCaCgv21l2JNOd+9cdjLXl7pfuRkXZs7XievRHP771di2Yg==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index e33f02a12..a49e59240 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "node": ">=6" }, "dependencies": { - "@splitsoftware/splitio-commons": "1.12.1-rc.5", + "@splitsoftware/splitio-commons": "1.12.1-rc.6", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", diff --git a/src/__tests__/browserSuites/ready-from-cache.spec.js b/src/__tests__/browserSuites/ready-from-cache.spec.js index 83eec8841..567da23e0 100644 --- a/src/__tests__/browserSuites/ready-from-cache.spec.js +++ b/src/__tests__/browserSuites/ready-from-cache.spec.js @@ -139,7 +139,7 @@ export default function (fetchMock, assert) { }); - assert.test(t => { // Testing when we start with cached data but without lastUpdate item (previous version) + assert.test(t => { // Testing when we start with cached data but without lastUpdate item (JS SDK version 10.13.0 and below) const testUrls = { sdk: 'https://sdk.baseurl/readyFromCacheWithData', events: 'https://events.baseurl/readyFromCacheWithData' @@ -478,7 +478,7 @@ export default function (fetchMock, assert) { /** Fetch specific splits **/ - assert.test(t => { // Testing when we start with cached data without storage hash (previous version), and a valid split filter config + assert.test(t => { // Testing when we start with cached data but without storage hash (JS SDK version 10.24.0 and below), and a valid split filter config const testUrls = { sdk: 'https://sdk.baseurl/readyFromCache_5', events: 'https://events.baseurl/readyFromCache_5' From f907103d61f9ab87ed4e5c9af4b12e41b2041237 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Mon, 11 Dec 2023 16:56:19 -0300 Subject: [PATCH 3/5] Update tests --- package-lock.json | 14 +++--- package.json | 2 +- .../browserSuites/push-corner-cases.spec.js | 2 +- .../browserSuites/ready-from-cache.spec.js | 44 ++++++++++--------- src/__tests__/errorCatching/browser.spec.js | 2 +- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index bb47feb5e..fab93fe7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "10.24.0", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "1.12.1-rc.6", + "@splitsoftware/splitio-commons": "1.12.1-rc.7", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -874,9 +874,9 @@ "dev": true }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.12.1-rc.6", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.6.tgz", - "integrity": "sha512-cAfo6xpgWgxzzhItcJi33yf0RgNetKme0mi/t4RmCaCgv21l2JNOd+9cdjLXl7pfuRkXZs7XievRHP771di2Yg==", + "version": "1.12.1-rc.7", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.7.tgz", + "integrity": "sha512-Kr5fW2dOAPKOZXetwTTk6iu+yfthEiw1r3ZqBLLC7TQqQPLYGP6XH6SrNJtuLEb2sEGHIrsVQYlNmVyiYcbTCQ==", "dependencies": { "tslib": "^2.3.1" }, @@ -8446,9 +8446,9 @@ "dev": true }, "@splitsoftware/splitio-commons": { - "version": "1.12.1-rc.6", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.6.tgz", - "integrity": "sha512-cAfo6xpgWgxzzhItcJi33yf0RgNetKme0mi/t4RmCaCgv21l2JNOd+9cdjLXl7pfuRkXZs7XievRHP771di2Yg==", + "version": "1.12.1-rc.7", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.7.tgz", + "integrity": "sha512-Kr5fW2dOAPKOZXetwTTk6iu+yfthEiw1r3ZqBLLC7TQqQPLYGP6XH6SrNJtuLEb2sEGHIrsVQYlNmVyiYcbTCQ==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index a49e59240..a090f5906 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "node": ">=6" }, "dependencies": { - "@splitsoftware/splitio-commons": "1.12.1-rc.6", + "@splitsoftware/splitio-commons": "1.12.1-rc.7", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", diff --git a/src/__tests__/browserSuites/push-corner-cases.spec.js b/src/__tests__/browserSuites/push-corner-cases.spec.js index 6171659fc..7c6ec7db4 100644 --- a/src/__tests__/browserSuites/push-corner-cases.spec.js +++ b/src/__tests__/browserSuites/push-corner-cases.spec.js @@ -1,3 +1,4 @@ +import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; import splitChangesMock1 from '../mocks/splitchanges.since.-1.json'; import splitKillMessage from '../mocks/message.SPLIT_KILL.1457552650000.json'; import authPushEnabledNicolas from '../mocks/auth.pushEnabled.nicolas@split.io.json'; @@ -9,7 +10,6 @@ window.EventSource = EventSourceMock; import { SplitFactory } from '../../'; import { settingsFactory } from '../../settings'; -import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; const userKey = 'nicolas@split.io'; diff --git a/src/__tests__/browserSuites/ready-from-cache.spec.js b/src/__tests__/browserSuites/ready-from-cache.spec.js index 567da23e0..9330b0bb8 100644 --- a/src/__tests__/browserSuites/ready-from-cache.spec.js +++ b/src/__tests__/browserSuites/ready-from-cache.spec.js @@ -1,9 +1,9 @@ +import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; import { SplitFactory } from '../../'; import splitChangesMock1 from '../mocks/splitchanges.since.-1.json'; import splitChangesMock2 from '../mocks/splitchanges.since.1457552620999.json'; import mySegmentsNicolas from '../mocks/mysegments.nicolas@split.io.json'; -import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; import { nearlyEqual } from '../testUtils'; @@ -256,7 +256,7 @@ export default function (fetchMock, assert) { t.plan(12 * 2 + 5); fetchMock.get(testUrls.sdk + '/splitChanges?since=25', function () { - t.equal(localStorage.getItem('readyFromCache_3.SPLITIO.split.always_on'), alwaysOnSplitInverted, 'splits must not be cleaned from cache'); + t.equal(localStorage.getItem('readyFromCache_3.SPLITIO.split.always_on'), alwaysOnSplitInverted, 'feature flags must not be cleaned from cache'); return new Promise(res => { setTimeout(() => res({ status: 200, body: { ...splitChangesMock1, since: 25 }, headers: {} }), 200); }); // 400ms is how long it'll take to reply with Splits, no SDK_READY should be emitted before that. }); fetchMock.get(testUrls.sdk + '/splitChanges?since=1457552620999', { status: 200, body: splitChangesMock2 }); @@ -371,11 +371,11 @@ export default function (fetchMock, assert) { events: 'https://events.baseurl/readyFromCacheWithData4' }; localStorage.clear(); - t.plan(9 * 2 + 5); fetchMock.get(testUrls.sdk + '/splitChanges?since=-1', function () { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); - t.equal(localStorage.length, 1, 'split cache data must be cleaned from localStorage'); + t.equal(localStorage.getItem('readyFromCache_4.SPLITIO.hash'), expectedHashNullFilter, 'storage hash must not be changed'); + t.equal(localStorage.length, 2, 'feature flags cache data must be cleaned from localStorage'); return { status: 200, body: splitChangesMock1 }; }); fetchMock.get(testUrls.sdk + '/splitChanges?since=1457552620999', { status: 200, body: splitChangesMock2 }); @@ -461,6 +461,8 @@ export default function (fetchMock, assert) { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); t.equal(localStorage.getItem('readyFromCache_4.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); t.true(nearlyEqual(parseInt(localStorage.getItem('readyFromCache_4.SPLITIO.splits.lastUpdated')), Date.now() - 1000 /* 1000 ms between last Split and MySegments fetch */), 'lastUpdated must correspond to the timestamp of the last successfully fetched Splits'); + + t.end(); }); }); t.true(Date.now() - startTime >= 1000, 'It should emit SDK_READY after syncing with the cloud.'); @@ -478,7 +480,7 @@ export default function (fetchMock, assert) { /** Fetch specific splits **/ - assert.test(t => { // Testing when we start with cached data but without storage hash (JS SDK version 10.24.0 and below), and a valid split filter config + 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 const testUrls = { sdk: 'https://sdk.baseurl/readyFromCache_5', events: 'https://events.baseurl/readyFromCache_5' @@ -512,7 +514,7 @@ export default function (fetchMock, assert) { const manager = splitio.manager(); client.once(client.Event.SDK_READY_FROM_CACHE, () => { - t.fail('It should not emit SDK_READY_FROM_CACHE because localstorage is cleaned and there isn\'t cached data'); + t.fail('It should not emit SDK_READY_FROM_CACHE because localStorage is cleaned and there isn\'t cached feature flags'); t.end(); }); @@ -522,8 +524,8 @@ export default function (fetchMock, assert) { client.destroy().then(() => { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); - t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'feature flag declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached'); 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'); t.equal(localStorage.getItem('readyFromCache_5.SPLITIO.splits.filterQuery'), null); t.end(); @@ -567,8 +569,8 @@ export default function (fetchMock, assert) { client.destroy().then(() => { t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); - t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'feature flag declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_5B.SPLITIO.hash'), expectedHashWithFilter, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); @@ -618,8 +620,8 @@ export default function (fetchMock, assert) { client.destroy().then(() => { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); - t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'feature flag declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_6.SPLITIO.hash'), expectedHash, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); @@ -671,8 +673,8 @@ export default function (fetchMock, assert) { client.destroy().then(() => { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); - t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'feature flag declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_7.SPLITIO.hash'), expectedHash, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); @@ -724,7 +726,7 @@ export default function (fetchMock, assert) { const manager = splitio.manager(); client.once(client.Event.SDK_READY_FROM_CACHE, () => { - t.fail('It should not emit SDK_READY_FROM_CACHE because all splits were removed from cache since the filter query changed.'); + t.fail('It should not emit SDK_READY_FROM_CACHE because all feature flags were removed from cache since the filter query changed.'); t.end(); }); @@ -734,9 +736,9 @@ export default function (fetchMock, assert) { client.destroy().then(() => { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); - t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'split declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p1__split'), JSON.stringify(splitDeclarations.p1__split), 'feature flag declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'feature flag declarations must be cached'); t.equal(localStorage.getItem('readyFromCache_8.SPLITIO.hash'), expectedHashNullFilter, 'Storage hash must correspond to the split filter query and SDK key'); t.end(); }); @@ -784,9 +786,9 @@ export default function (fetchMock, assert) { client.destroy().then(() => { t.equal(localStorage.getItem('some_user_item'), 'user_item', 'user items at localStorage must not be changed'); t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits'); - t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'split declarations must be cached'); - t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'split declarations must be cached'); - 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' } } }), 'splits.filterQuery must correspond to the split filter query'); + t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached'); + t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'feature flag declarations must be cached'); + 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'); t.end(); }); }); diff --git a/src/__tests__/errorCatching/browser.spec.js b/src/__tests__/errorCatching/browser.spec.js index 3b6b4a534..b006b6759 100644 --- a/src/__tests__/errorCatching/browser.spec.js +++ b/src/__tests__/errorCatching/browser.spec.js @@ -1,4 +1,5 @@ // Here we are testing exceptions and the handler should be ours, we need to avoid tape-catch +import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; import tape from 'tape'; import includes from 'lodash/includes'; import fetchMock from '../testUtils/fetchMock'; @@ -9,7 +10,6 @@ import splitChangesMock2 from '../mocks/splitChanges.since.1500492097547.till.15 import splitChangesMock3 from '../mocks/splitChanges.since.1500492297547.json'; import { SplitFactory } from '../../'; import { settingsFactory } from '../../settings'; -import { getStorageHash } from '@splitsoftware/splitio-commons/src/storages/KeyBuilder'; const settings = settingsFactory({ core: { From 87f60ace0d05dfa549f816578bbb5bf34240363d Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Tue, 12 Dec 2023 11:55:22 -0300 Subject: [PATCH 4/5] Prepare stable version --- CHANGES.txt | 2 +- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- src/settings/defaults/version.js | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f940ecf71..6b1f51501 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,4 @@ -10.24.1 (December XX, 2023) +10.24.1 (December 12, 2023) - 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. - Updated @splitsoftware/splitio-commons package to version 1.12.1. diff --git a/package-lock.json b/package-lock.json index fab93fe7d..3bc281cea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@splitsoftware/splitio", - "version": "10.24.0", + "version": "10.24.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio", - "version": "10.24.0", + "version": "10.24.1", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "1.12.1-rc.7", + "@splitsoftware/splitio-commons": "1.12.1", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -874,9 +874,9 @@ "dev": true }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.12.1-rc.7", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.7.tgz", - "integrity": "sha512-Kr5fW2dOAPKOZXetwTTk6iu+yfthEiw1r3ZqBLLC7TQqQPLYGP6XH6SrNJtuLEb2sEGHIrsVQYlNmVyiYcbTCQ==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1.tgz", + "integrity": "sha512-EkCcqlYvVafazs9c5i+pmhf6rIyj3A70dqQ4U3BKE646t7tf6mxGzqZz1sAl540xNyYI7CA/iIqisEWvDtJc0A==", "dependencies": { "tslib": "^2.3.1" }, @@ -8446,9 +8446,9 @@ "dev": true }, "@splitsoftware/splitio-commons": { - "version": "1.12.1-rc.7", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1-rc.7.tgz", - "integrity": "sha512-Kr5fW2dOAPKOZXetwTTk6iu+yfthEiw1r3ZqBLLC7TQqQPLYGP6XH6SrNJtuLEb2sEGHIrsVQYlNmVyiYcbTCQ==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.12.1.tgz", + "integrity": "sha512-EkCcqlYvVafazs9c5i+pmhf6rIyj3A70dqQ4U3BKE646t7tf6mxGzqZz1sAl540xNyYI7CA/iIqisEWvDtJc0A==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index a090f5906..686c6b397 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio", - "version": "10.24.0", + "version": "10.24.1", "description": "Split SDK", "files": [ "README.md", @@ -40,7 +40,7 @@ "node": ">=6" }, "dependencies": { - "@splitsoftware/splitio-commons": "1.12.1-rc.7", + "@splitsoftware/splitio-commons": "1.12.1", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", diff --git a/src/settings/defaults/version.js b/src/settings/defaults/version.js index cde4ada1e..9877b7949 100644 --- a/src/settings/defaults/version.js +++ b/src/settings/defaults/version.js @@ -1 +1 @@ -export const packageVersion = '10.24.0'; +export const packageVersion = '10.24.1'; From 5c15bf41d67ef2e0d91dda08c32f3b06e215dd76 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Tue, 12 Dec 2023 14:09:31 -0300 Subject: [PATCH 5/5] Update changelog entry --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6b1f51501..958fc1951 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,5 @@ 10.24.1 (December 12, 2023) - - 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. + - 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, to avoid using invalid cached data when the SDK is ready from cache. - Updated @splitsoftware/splitio-commons package to version 1.12.1. 10.24.0 (December 4, 2023)