Skip to content

Commit

Permalink
Merge pull request #808 from splitio/development
Browse files Browse the repository at this point in the history
Release v10.26.1
  • Loading branch information
EmilianoSanchez committed Jun 14, 2024
2 parents e06c342 + 7fad01b commit 04e3f08
Show file tree
Hide file tree
Showing 23 changed files with 645 additions and 133 deletions.
9 changes: 8 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
10.26.1 (June 14, 2024)
- Updated the internal imports of 'os' and 'ioredis' modules for NodeJS, to use EcmaScript 'import' rather than CommonJS 'require' for the ES modules build. This avoids runtime errors on some scenarios when bundling the SDK into a .mjs file or importing it from a .mjs file.
- Updated eventsource dependency for NodeJS. The eventsource v1.1.2 dependency was removed, and the SDK now uses an embedded adaptation that can accept an HTTP(S) agent option, like other HTTP(S) requests.
- 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 10.24.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).

10.26.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 @@ -80,7 +87,7 @@
- Bugfixing - Moved js-yaml dependency from @splitsoftware/splitio-commons to avoid resolution to an incompatible version on certain npm versions when installing third-party dependencies that also define js-yaml as transitive dependency (Related to issue https://github.com/splitio/javascript-client/issues/662).

10.20.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.

Expand Down
64 changes: 23 additions & 41 deletions package-lock.json

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

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio",
"version": "10.26.0",
"version": "10.26.1",
"description": "Split SDK",
"files": [
"README.md",
Expand Down Expand Up @@ -40,7 +40,7 @@
"node": ">=6"
},
"dependencies": {
"@splitsoftware/splitio-commons": "1.14.0",
"@splitsoftware/splitio-commons": "1.16.0",
"@types/google.analytics": "0.0.40",
"@types/ioredis": "^4.28.0",
"bloom-filters": "^3.0.0",
Expand All @@ -50,9 +50,6 @@
"tslib": "^2.3.1",
"unfetch": "^4.2.0"
},
"optionalDependencies": {
"eventsource": "^1.1.2"
},
"devDependencies": {
"@types/node-fetch": "^2.6.10",
"@types/seedrandom": "^3.0.2",
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 @@ -588,7 +588,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 @@ -639,7 +639,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 @@ -763,7 +763,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 All @@ -788,7 +788,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__/consumer/node_redis.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console */

import osFunction from 'os';
import ipFunction from '../../utils/ip';
import * as ipFunction from '../../utils/ip';
import tape from 'tape';
import sinon from 'sinon';
import RedisServer from 'redis-server';
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import osFunction from 'os';
import ipFunction from '../../utils/ip';
import * as ipFunction from '../../utils/ip';
import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/nodeSuites/ip-addresses-setting.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import osFunction from 'os';
import ipFunction from '../../utils/ip';
import * as ipFunction from '../../utils/ip';
import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/nodeSuites/push-initialization-nopush.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ function testInitializationFail(fetchMock, assert, fallbackToPolling) {
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=1457552620999'), function () {
assert.true(ready, 'client ready');
const lapse = Date.now() - start;
assert.true(nearlyEqual(lapse, 0), 'polling (first fetch)');
assert.true(nearlyEqual(lapse, 0, 100), 'polling (first fetch)');
return { status: 200, body: splitChangesMock2 };
});
}

fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=1457552620999'), function () {
assert.true(ready, 'client ready');
const lapse = Date.now() - start;
assert.true(nearlyEqual(lapse, settings.scheduler.featuresRefreshRate), 'polling (second fetch)');
assert.true(nearlyEqual(lapse, settings.scheduler.featuresRefreshRate, 100), 'polling (second fetch)');
client.destroy().then(() => {
assert.end();
});
Expand Down
16 changes: 7 additions & 9 deletions src/__tests__/nodeSuites/push-synchronization.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const MILLIS_IFFU_UPDATE_EVENT_WITH_NEW_SEGMENTS = 700;
const MILLIS_IFFU_UPDATE_EVENT_WITH_WRONG_COMPRESS = 800;
const MILLIS_IFFU_UPDATE_EVENT_WITH_OLD_CHANGENUMBER = 900;
const MILLIS_IFFU_UPDATE_EVENT_WITH_ZERO_PCN = 1000;
const MILLIS_IFFU_UPDATE_EVENT_WITH_MISSING_PCN= 1100;
const MILLIS_IFFU_UPDATE_EVENT_WITH_MISSING_PCN = 1100;
const MILLIS_IFFU_UPDATE_EVENT_WITH_ARCHIVED = 1200;
const MILLIS_DESTROY = 1300;

Expand Down Expand Up @@ -89,13 +89,11 @@ export function testSynchronization(fetchMock, assert) {
setMockListener(function (eventSourceInstance) {
const expectedSSEurl = `${url(settings, '/sse')}?channels=NzM2MDI5Mzc0_NDEzMjQ1MzA0Nw%3D%3D_segments,NzM2MDI5Mzc0_NDEzMjQ1MzA0Nw%3D%3D_splits,%5B%3Foccupancy%3Dmetrics.publishers%5Dcontrol_pri,%5B%3Foccupancy%3Dmetrics.publishers%5Dcontrol_sec&accessToken=${authPushEnabled.token}&v=1.1&heartbeats=true`;
assert.equals(eventSourceInstance.url, expectedSSEurl, 'EventSource URL is the expected');
assert.deepEqual(eventSourceInstance.__eventSourceInitDict, {
headers: {
SplitSDKClientKey: 'h-1>',
SplitSDKVersion: settings.version,
SplitSDKMachineIP: settings.runtime.ip,
SplitSDKMachineName: settings.runtime.hostname
}
assert.deepEqual(eventSourceInstance.__eventSourceInitDict.headers, {
SplitSDKClientKey: 'h-1>',
SplitSDKVersion: settings.version,
SplitSDKMachineIP: settings.runtime.ip,
SplitSDKMachineName: settings.runtime.hostname
}, 'EventSource headers are the expected');

setTimeout(() => {
Expand Down Expand Up @@ -285,7 +283,7 @@ export function testSynchronization(fetchMock, assert) {

// fetch segments due to IFFU SPLIT_UPDATE event with new segments
fetchMock.getOnce(url(settings, '/segmentChanges/maur-2?since=-1'), function () {
return { status: 200, body: { since: 1457552650000, till: 1457552650000, name: 'maur-2', added: ['admin','mauro','nico'], removed: [] } };
return { status: 200, body: { since: 1457552650000, till: 1457552650000, name: 'maur-2', added: ['admin', 'mauro', 'nico'], removed: [] } };
});

// fetch feature flags due to IFFU SPLIT_UPDATE event with wrong compress code
Expand Down
Loading

0 comments on commit 04e3f08

Please sign in to comment.