Skip to content

Release v0.14.1 #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.14.1 (June 14, 2024)
- Updated @splitsoftware/splitio-commons package to version 1.16.0 that includes some vulnerability and bug fixes.
- Bugfixing - Restored some input validation error logs that were removed in version 0.12.0. The logs inform the user when the `getTreatment(s)` methods are called with an invalid value as feature flag name or flag set name.
- Bugfixing - Fixed localhost mode to emit SDK_UPDATE when mocked feature flags are updated in the `features` object map of the config object (Related to issue https://github.com/splitio/javascript-browser-client/issues/119).

0.14.0 (May 6, 2024)
- Updated @splitsoftware/splitio-commons package to version 1.14.0 that includes minor updates:
- Added support for targeting rules based on semantic versions (https://semver.org/).
Expand Down Expand Up @@ -77,7 +82,7 @@
- Updated some dependencies for vulnerability fixes.

0.7.0 (June 29, 2022)
- Added a new config option to control the tasks that listen or poll for updates on feature flags and segments, via the new config sync.enabled . Running online, Split will always pull the most recent updates upon initialization, this only affects updates fetching on a running instance. Useful when a consistent session experience is a must or to save resources when updates are not being used.
- Added a new config option to control the tasks that listen or poll for updates on feature flags and segments, via the new config `sync.enabled`. Running online, Split will always pull the most recent updates upon initialization, this only affects updates fetching on a running instance. Useful when a consistent session experience is a must or to save resources when updates are not being used.
- Updated telemetry logic to track the anonymous config for user consent flag set to declined or unknown.
- Updated submitters logic, to avoid duplicating the post of impressions to Split cloud when the SDK is destroyed while its periodic post of impressions is running.
- Bugfixing - Updated submitters logic, to avoid dropping impressions and events that are being tracked while POST request is pending.
Expand Down
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-browserjs",
"version": "0.14.0",
"version": "0.14.1",
"description": "Split SDK for JavaScript on Browser",
"main": "cjs/index.js",
"module": "esm/index.js",
Expand Down Expand Up @@ -64,7 +64,7 @@
"bugs": "https://github.com/splitio/javascript-browser-client/issues",
"homepage": "https://github.com/splitio/javascript-browser-client#readme",
"dependencies": {
"@splitsoftware/splitio-commons": "1.14.0",
"@splitsoftware/splitio-commons": "1.16.0",
"@types/google.analytics": "0.0.40",
"tslib": "^2.3.1",
"unfetch": "^4.2.0"
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/browserSuites/ready-from-cache.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ export default function (fetchMock, assert) {
fetchMock.getOnce(testUrls.sdk + '/splitChanges?s=1.1&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' } } });
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' }, flagSpecVersion: '1.1' } });
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));
Expand Down Expand Up @@ -633,7 +633,7 @@ export default function (fetchMock, assert) {
fetchMock.getOnce(testUrls.sdk + '/splitChanges?s=1.1&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' } } });
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&prefixes=p1,p2' }, flagSpecVersion: '1.1' } });
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));
Expand Down Expand Up @@ -755,7 +755,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.hash', getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' } } }));
localStorage.setItem('readyFromCache_9.SPLITIO.hash', getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' }, flagSpecVersion: '1.1' } }));

const splitio = SplitFactory({
...baseConfig,
Expand Down Expand Up @@ -784,7 +784,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), '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.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' }, flagSpecVersion: '1.1' } }), 'Storage hash must correspond to the split filter query and SDK key');
t.end();
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/errorCatching/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +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: '<fake-token-1>' }, sync: { __splitFiltersValidation: { queryString: null } } }));
localStorage.setItem('SPLITIO.hash', getStorageHash({ core: { authorizationKey: '<fake-token-1>' }, sync: { __splitFiltersValidation: { queryString: null }, flagSpecVersion: '1.1' } }));

fetchMock.get(url(settings, '/splitChanges?s=1.1&since=25'), function () {
return new Promise((res) => { setTimeout(() => res({ status: 200, body: splitChangesMock1 }), 1000); });
Expand Down
34 changes: 25 additions & 9 deletions src/__tests__/offline/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,13 @@ tape('Browser offline mode', function (assert) {
SplitFactory({ ...config, storage: InLocalStorage() }),
SplitFactorySlim({ ...config, storage: InLocalStorage(), sync: { localhostMode: LocalhostFromObject() } }) // slim factory requires localhostFromObject module
];
const factoriesReady = [ // Multiple factories must handle their own `features` mock, even if instantiated with the same config.
SplitFactory(config),
SplitFactory({ ...config }),
SplitFactory({ ...config, features: { ...config.features }, storage: InLocalStorage /* invalid */, sync: { localhostMode: LocalhostFromObject /* invalid */ } }),
const configs = [
{ ...config, features: { ...config.features }, storage: InLocalStorage /* invalid */, sync: { localhostMode: LocalhostFromObject /* invalid */ } },
{ ...config },
config,
];
const factoriesReady = [
...configs.map(config => SplitFactory(config)),
...factoriesReadyFromCache
];
const factoriesTimeout = [ // slim factory without a valid localhostFromObject module will timeout
Expand All @@ -115,7 +118,7 @@ tape('Browser offline mode', function (assert) {
readyCount++;
});
client.on(client.Event.SDK_UPDATE, () => {
assert.deepEqual(manager.names(), ['testing_split', 'testing_split_2', 'testing_split_3', 'testing_split_with_config']);
assert.deepEqual(manager.names().sort(), ['testing_split', 'testing_split_2', 'testing_split_3', 'testing_split_with_config']);
assert.equal(client.getTreatment('testing_split_with_config'), 'nope');
updateCount++;
});
Expand Down Expand Up @@ -225,7 +228,7 @@ tape('Browser offline mode', function (assert) {
});

setTimeout(() => {
// Update the features
// Update features reference in settings
factory.settings.features = {
testing_split: 'on',
testing_split_2: 'off',
Expand All @@ -235,10 +238,23 @@ tape('Browser offline mode', function (assert) {
config: null
}
};
// Update the features in all factories except one
for (let i = 1; i < factories.length; i++) {
factories[i].settings.features = factory.settings.features;

// Update features properties in config
configs[0].features['testing_split'] = 'on';
configs[0].features['testing_split_2'] = 'off';
configs[0].features['testing_split_3'] = 'custom_treatment';
configs[0].features['testing_split_with_config'] = {
treatment: 'nope',
config: null
};

// Update the features in all remaining factories except the last one
for (let i = 1; i < factoriesReady.length - 1; i++) {
factoriesReady[i].settings.features = factory.settings.features;
}

// Assigning a new object to the features property in the config object doesn't trigger an update
configs[configs.length - 1].features = { ...factory.settings.features };
}, 1000);

setTimeout(() => { factory.settings.features = originalFeaturesMap; }, 200);
Expand Down
2 changes: 1 addition & 1 deletion src/settings/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LogLevels, isLogLevelString } from '@splitsoftware/splitio-commons/src/
import { ConsentStatus, LogLevel } from '@splitsoftware/splitio-commons/src/types';
import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants';

const packageVersion = '0.14.0';
const packageVersion = '0.14.1';

/**
* In browser, the default debug level, can be set via the `localStorage.splitio_debug` item.
Expand Down
Loading