Skip to content

Commit 04e3f08

Browse files
Merge pull request #808 from splitio/development
Release v10.26.1
2 parents e06c342 + 7fad01b commit 04e3f08

File tree

23 files changed

+645
-133
lines changed

23 files changed

+645
-133
lines changed

CHANGES.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
10.26.1 (June 14, 2024)
2+
- 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.
3+
- 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.
4+
- Updated @splitsoftware/splitio-commons package to version 1.16.0 that includes some vulnerability and bug fixes.
5+
- 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.
6+
- 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).
7+
18
10.26.0 (May 6, 2024)
29
- Updated @splitsoftware/splitio-commons package to version 1.14.0 that includes minor updates:
310
- Added support for targeting rules based on semantic versions (https://semver.org/).
@@ -80,7 +87,7 @@
8087
- 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).
8188

8289
10.20.0 (June 29, 2022)
83-
- 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.
90+
- 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.
8491
- Updated telemetry logic to track the anonymous config for user consent flag set to declined or unknown.
8592
- 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.
8693

package-lock.json

Lines changed: 23 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio",
3-
"version": "10.26.0",
3+
"version": "10.26.1",
44
"description": "Split SDK",
55
"files": [
66
"README.md",
@@ -40,7 +40,7 @@
4040
"node": ">=6"
4141
},
4242
"dependencies": {
43-
"@splitsoftware/splitio-commons": "1.14.0",
43+
"@splitsoftware/splitio-commons": "1.16.0",
4444
"@types/google.analytics": "0.0.40",
4545
"@types/ioredis": "^4.28.0",
4646
"bloom-filters": "^3.0.0",
@@ -50,9 +50,6 @@
5050
"tslib": "^2.3.1",
5151
"unfetch": "^4.2.0"
5252
},
53-
"optionalDependencies": {
54-
"eventsource": "^1.1.2"
55-
},
5653
"devDependencies": {
5754
"@types/node-fetch": "^2.6.10",
5855
"@types/seedrandom": "^3.0.2",

src/__tests__/browserSuites/ready-from-cache.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ export default function (fetchMock, assert) {
588588
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
589589
fetchMock.getOnce(testUrls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { mySegments: [] } });
590590

591-
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' } } });
591+
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' }, flagSpecVersion: '1.1' } });
592592
localStorage.setItem('some_user_item', 'user_item');
593593
localStorage.setItem('readyFromCache_6.SPLITIO.splits.till', 25);
594594
localStorage.setItem('readyFromCache_6.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split));
@@ -639,7 +639,7 @@ export default function (fetchMock, assert) {
639639
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
640640
fetchMock.getOnce(testUrls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { mySegments: [] } });
641641

642-
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&prefixes=p1,p2' } } });
642+
const expectedHash = getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&prefixes=p1,p2' }, flagSpecVersion: '1.1' } });
643643
localStorage.setItem('some_user_item', 'user_item');
644644
localStorage.setItem('readyFromCache_7.SPLITIO.splits.till', 25);
645645
localStorage.setItem('readyFromCache_7.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split));
@@ -763,7 +763,7 @@ export default function (fetchMock, assert) {
763763
localStorage.setItem('readyFromCache_9.SPLITIO.splits.till', 25);
764764
localStorage.setItem('readyFromCache_9.SPLITIO.split.p1__split', JSON.stringify(splitDeclarations.p1__split));
765765
localStorage.setItem('readyFromCache_9.SPLITIO.split.p2__split', JSON.stringify(splitDeclarations.p2__split));
766-
localStorage.setItem('readyFromCache_9.SPLITIO.hash', getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' } } }));
766+
localStorage.setItem('readyFromCache_9.SPLITIO.hash', getStorageHash({ ...baseConfig, sync: { __splitFiltersValidation: { queryString: '&names=p2__split&prefixes=p1' }, flagSpecVersion: '1.1' } }));
767767

768768
const splitio = SplitFactory({
769769
...baseConfig,
@@ -788,7 +788,7 @@ export default function (fetchMock, assert) {
788788
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.splits.till'), '1457552620999', 'splits.till must correspond to the till of the last successfully fetched Splits');
789789
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p2__split'), JSON.stringify(splitDeclarations.p2__split), 'feature flag declarations must be cached');
790790
t.equal(localStorage.getItem('readyFromCache_9.SPLITIO.split.p3__split'), JSON.stringify(splitDeclarations.p3__split), 'feature flag declarations must be cached');
791-
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');
791+
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');
792792
t.end();
793793
});
794794
});

src/__tests__/consumer/node_redis.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
22

33
import osFunction from 'os';
4-
import ipFunction from '../../utils/ip';
4+
import * as ipFunction from '../../utils/ip';
55
import tape from 'tape';
66
import sinon from 'sinon';
77
import RedisServer from 'redis-server';

src/__tests__/errorCatching/browser.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const settings = settingsFactory({
2121
// prepare localstorage to emit SDK_READY_FROM_CACHE
2222
localStorage.clear();
2323
localStorage.setItem('SPLITIO.splits.till', 25);
24-
localStorage.setItem('SPLITIO.hash', getStorageHash({ core: { authorizationKey: '<fake-token-1>' }, sync: { __splitFiltersValidation: { queryString: null } } }));
24+
localStorage.setItem('SPLITIO.hash', getStorageHash({ core: { authorizationKey: '<fake-token-1>' }, sync: { __splitFiltersValidation: { queryString: null }, flagSpecVersion: '1.1' } }));
2525

2626
fetchMock.get(url(settings, '/splitChanges?s=1.1&since=25'), function () {
2727
return new Promise((res) => { setTimeout(() => res({ status: 200, body: splitChangesMock1 }), 1000); });

src/__tests__/nodeSuites/ip-addresses-setting.debug.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import osFunction from 'os';
2-
import ipFunction from '../../utils/ip';
2+
import * as ipFunction from '../../utils/ip';
33
import { SplitFactory } from '../../';
44
import { settingsFactory } from '../../settings';
55
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';

src/__tests__/nodeSuites/ip-addresses-setting.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import osFunction from 'os';
2-
import ipFunction from '../../utils/ip';
2+
import * as ipFunction from '../../utils/ip';
33
import { SplitFactory } from '../../';
44
import { settingsFactory } from '../../settings';
55
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';

src/__tests__/nodeSuites/push-initialization-nopush.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ function testInitializationFail(fetchMock, assert, fallbackToPolling) {
5353
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=1457552620999'), function () {
5454
assert.true(ready, 'client ready');
5555
const lapse = Date.now() - start;
56-
assert.true(nearlyEqual(lapse, 0), 'polling (first fetch)');
56+
assert.true(nearlyEqual(lapse, 0, 100), 'polling (first fetch)');
5757
return { status: 200, body: splitChangesMock2 };
5858
});
5959
}
6060

6161
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=1457552620999'), function () {
6262
assert.true(ready, 'client ready');
6363
const lapse = Date.now() - start;
64-
assert.true(nearlyEqual(lapse, settings.scheduler.featuresRefreshRate), 'polling (second fetch)');
64+
assert.true(nearlyEqual(lapse, settings.scheduler.featuresRefreshRate, 100), 'polling (second fetch)');
6565
client.destroy().then(() => {
6666
assert.end();
6767
});

src/__tests__/nodeSuites/push-synchronization.spec.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const MILLIS_IFFU_UPDATE_EVENT_WITH_NEW_SEGMENTS = 700;
5858
const MILLIS_IFFU_UPDATE_EVENT_WITH_WRONG_COMPRESS = 800;
5959
const MILLIS_IFFU_UPDATE_EVENT_WITH_OLD_CHANGENUMBER = 900;
6060
const MILLIS_IFFU_UPDATE_EVENT_WITH_ZERO_PCN = 1000;
61-
const MILLIS_IFFU_UPDATE_EVENT_WITH_MISSING_PCN= 1100;
61+
const MILLIS_IFFU_UPDATE_EVENT_WITH_MISSING_PCN = 1100;
6262
const MILLIS_IFFU_UPDATE_EVENT_WITH_ARCHIVED = 1200;
6363
const MILLIS_DESTROY = 1300;
6464

@@ -89,13 +89,11 @@ export function testSynchronization(fetchMock, assert) {
8989
setMockListener(function (eventSourceInstance) {
9090
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`;
9191
assert.equals(eventSourceInstance.url, expectedSSEurl, 'EventSource URL is the expected');
92-
assert.deepEqual(eventSourceInstance.__eventSourceInitDict, {
93-
headers: {
94-
SplitSDKClientKey: 'h-1>',
95-
SplitSDKVersion: settings.version,
96-
SplitSDKMachineIP: settings.runtime.ip,
97-
SplitSDKMachineName: settings.runtime.hostname
98-
}
92+
assert.deepEqual(eventSourceInstance.__eventSourceInitDict.headers, {
93+
SplitSDKClientKey: 'h-1>',
94+
SplitSDKVersion: settings.version,
95+
SplitSDKMachineIP: settings.runtime.ip,
96+
SplitSDKMachineName: settings.runtime.hostname
9997
}, 'EventSource headers are the expected');
10098

10199
setTimeout(() => {
@@ -285,7 +283,7 @@ export function testSynchronization(fetchMock, assert) {
285283

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

291289
// fetch feature flags due to IFFU SPLIT_UPDATE event with wrong compress code

0 commit comments

Comments
 (0)