Skip to content
Open
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
32 changes: 22 additions & 10 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio",
"version": "11.11.2",
"version": "11.11.2-rc.0",
"description": "Split SDK",
"files": [
"README.md",
Expand Down Expand Up @@ -38,7 +38,7 @@
"node": ">=14.0.0"
},
"dependencies": {
"@splitsoftware/splitio-commons": "2.12.1",
"@splitsoftware/splitio-commons": "3.0.0-rc.7",
"bloom-filters": "^3.0.4",
"ioredis": "^4.28.0 || ^5.0.0",
"js-yaml": "^4.2.0",
Expand Down Expand Up @@ -99,7 +99,7 @@
"test-browser-e2e-push": "cross-env NODE_ENV=test karma start karma/e2e.push.karma.conf.js",
"test-node": "npm run test-node-unit && npm run test-node-e2e",
"test-node-unit": "cross-env NODE_ENV=test tape -r ./ts-node.register \"src/*/**/__tests__/**/!(browser).spec.js\" | tap-min",
"test-node-e2e": "npm run test-node-e2e-online && npm run test-node-e2e-offline && npm run test-node-e2e-destroy && npm run test-node-e2e-errorCatching && npm run test-node-e2e-push && npm run test-node-e2e-redis",
"test-node-e2e": "npm run test-node-e2e-online && npm run test-node-e2e-offline && npm run test-node-e2e-destroy && npm run test-node-e2e-errorCatching && npm run test-node-e2e-push",
"test-node-e2e-online": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/online/node.spec.js | tap-min",
"test-node-e2e-offline": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/offline/node.spec.js | tap-min",
"test-node-e2e-destroy": "cross-env NODE_ENV=test tape -r ./ts-node.register src/__tests__/destroy/node.spec.js | tap-min",
Expand Down
4 changes: 1 addition & 3 deletions src/__tests__/browserSuites/ready-promise.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function assertGetTreatmentWhenReady(assert, client) {
function assertGetTreatmentControlNotReady(assert, client) {
consoleSpy.log.resetHistory();
assert.equal(client.getTreatment('hierarchical_splits_test'), 'control', 'We should get control if client is not ready.');
assert.true(consoleSpy.log.calledWithExactly('[WARN] splitio => getTreatment: the SDK is not ready to evaluate. Results may be incorrect for feature flag hierarchical_splits_test. Make sure to wait for SDK readiness before using this method.'), 'Telling us that calling getTreatment would return CONTROL since SDK is not ready at this point.');
assert.true(consoleSpy.log.calledWithExactly('[WARN] splitio => getTreatment: the SDK is not ready to evaluate. Results may be incorrect. Make sure to wait for SDK readiness before using this method.'), 'Telling us that calling getTreatment would return CONTROL since SDK is not ready at this point.');
}

function assertGetTreatmentControlNotReadyOnDestroy(assert, client) {
Expand Down Expand Up @@ -538,8 +538,6 @@ export default function readyPromiseAssertions(fetchMock, assert) {
consoleSpy.log.resetHistory();
const sharedClientWithCb = splitio.client('nicolas@split.io');
sharedClientWithCb.on(client.Event.SDK_READY, () => {
t.false(consoleSpy.log.calledWithExactly('[WARN] splitio => No listeners for SDK_READY event detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet synchronized with the backend.'),
'No warning logged');

const sharedClientWithoutCb = splitio.client('emiliano@split.io');
setTimeout(() => {
Expand Down
51 changes: 0 additions & 51 deletions src/__tests__/mocks/splitchanges.real.withSegments.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,57 +66,6 @@
}
],
"configurations": {}
},
{
"trafficTypeName": "user",
"name": "real_split_2",
"trafficAllocation": 100,
"trafficAllocationSeed": -1427479928,
"seed": 769174959,
"status": "ACTIVE",
"killed": false,
"defaultTreatment": "on",
"changeNumber": 1550099287990,
"algo": 2,
"conditions": [
{
"conditionType": "ROLLOUT",
"matcherGroup": {
"combiner": "AND",
"matchers": [
{
"keySelector": {
"trafficType": "user",
"attribute": null
},
"matcherType": "ALL_KEYS",
"negate": false,
"userDefinedSegmentMatcherData": null,
"whitelistMatcherData": null,
"unaryNumericMatcherData": null,
"betweenMatcherData": null,
"booleanMatcherData": null,
"dependencyMatcherData": null,
"stringMatcherData": null
}
]
},
"partitions": [
{
"treatment": "on",
"size": 100
},
{
"treatment": "off",
"size": 0
}
],
"label": "default rule"
}
],
"configurations": {
"on": "{\"color\":\"brown\",\"dimensions\":{\"height\":12,\"width\":14},\"text\":{\"inner\":\"click me\"}}"
}
}
],
"s": -1,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/nodeSuites/push-fallback.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import streamingResetMessage from '../mocks/message.STREAMING_RESET.json';
import { nearlyEqual, mockSegmentChanges, url } from '../testUtils';

import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';
import { __setEventSource } from '../../platform/getEventSource/node';
import { __setEventSource } from '@splitsoftware/splitio-commons/src/platform/getEventSource/node';

import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/nodeSuites/push-flag-sets.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SplitFactory } from '../..';
import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';
import { __setEventSource } from '../../platform/getEventSource/node';
import { __setEventSource } from '@splitsoftware/splitio-commons/src/platform/getEventSource/node';
import { mockSegmentChanges } from '../testUtils';

import notification1 from '../mocks/message.SPLIT_UPDATE.FS.1.json';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import authInvalidCredentials from '../mocks/auth.invalidCredentials.txt';
import authNoUserSpecified from '../mocks/auth.noUserSpecified.txt';
import { nearlyEqual, url } from '../testUtils';

import { __setEventSource, __restore } from '../../platform/getEventSource/node';
import { __setEventSource, __restore } from '@splitsoftware/splitio-commons/src/platform/getEventSource/node';
import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';

const baseUrls = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import authPushBadToken from '../mocks/auth.pushBadToken.json';
import { nearlyEqual, url } from '../testUtils';

import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';
import { __setEventSource } from '../../platform/getEventSource/node';
import { __setEventSource } from '@splitsoftware/splitio-commons/src/platform/getEventSource/node';

import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/nodeSuites/push-refresh-token.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import authPushDisabled from '../mocks/auth.pushDisabled.json';
import { nearlyEqual, mockSegmentChanges, url } from '../testUtils';

import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';
import { __setEventSource } from '../../platform/getEventSource/node';
import { __setEventSource } from '@splitsoftware/splitio-commons/src/platform/getEventSource/node';

import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { nearlyEqual, mockSegmentChanges, url } from '../testUtils';
import { Backoff } from '@splitsoftware/splitio-commons/src/utils/Backoff';

import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';
import { __setEventSource } from '../../platform/getEventSource/node';
import { __setEventSource } from '@splitsoftware/splitio-commons/src/platform/getEventSource/node';

import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/nodeSuites/push-synchronization.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import authPushEnabled from '../mocks/auth.pushEnabled.node.json';
import { nearlyEqual, mockSegmentChanges, url, hasNoCacheHeader } from '../testUtils';

import EventSourceMock, { setMockListener } from '../testUtils/eventSourceMock';
import { __setEventSource } from '../../platform/getEventSource/node';
import { __setEventSource } from '@splitsoftware/splitio-commons/src/platform/getEventSource/node';

import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/nodeSuites/ready-promise.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function assertGetTreatmentWhenReady(assert, client, key) {
function assertGetTreatmentControlNotReady(assert, client, key) {
consoleSpy.log.resetHistory();
assert.equal(client.getTreatment(key, 'hierarchical_splits_test'), 'control', 'We should get control if client is not ready.');
assert.true(consoleSpy.log.calledWithExactly('[WARN] splitio => getTreatment: the SDK is not ready to evaluate. Results may be incorrect for feature flag hierarchical_splits_test. Make sure to wait for SDK readiness before using this method.'), 'Telling us that calling getTreatment would return CONTROL since SDK is not ready at this point.');
assert.true(consoleSpy.log.calledWithExactly('[WARN] splitio => getTreatment: the SDK is not ready to evaluate. Results may be incorrect. Make sure to wait for SDK readiness before using this method.'), 'Telling us that calling getTreatment would return CONTROL since SDK is not ready at this point.');
}

function assertGetTreatmentControlNotReadyOnDestroy(assert, client, key) {
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/testUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ export function hasNoCacheHeader(fetchMockOpts) {

const telemetryEndpointMatcher = /^\/v1\/(metrics|keys)\/(config|usage|ss|cs)/;
const eventsEndpointMatcher = /^\/(testImpressions|metrics|events)/;
const authEndpointMatcher = /^\/v2\/auth/;
const authEndpointMatcher = /^\/(v2|v3)\/auth/;
const streamingEndpointMatcher = /^\/(sse|event-stream)/;
const configsEndpointMatcher = /^\/v1\/(configs|segmentChanges)/;

/**
* Switch URLs servers based on target.
Expand All @@ -69,5 +70,8 @@ export function url(settings, target) {
if (streamingEndpointMatcher.test(target)) {
return `${settings.urls.streaming}${target}`;
}
if (configsEndpointMatcher.test(target)) {
return `${settings.urls.configs}${target}`;
}
return `${settings.urls.sdk}${target}`;
}
2 changes: 1 addition & 1 deletion src/__tests__/testUtils/nodeFetchMock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fetchMock from 'fetch-mock';
import { __setFetch } from '../../platform/getFetch/node';
import { __setFetch } from '@splitsoftware/splitio-commons/src/platform/getFetch/node';

const sandboxFetchMock = fetchMock.sandbox();

Expand Down
8 changes: 3 additions & 5 deletions src/factory/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { createUserConsentAPI } from '@splitsoftware/splitio-commons/src/consent
import { localhostFromObjectFactory } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';

import { settingsFactory } from '../settings/browser';
import { platform, SignalListener } from '../platform';
import { platform } from '../platform';

const syncManagerOnlineCSFactory = syncManagerOnlineFactory(pollingManagerCSFactory, pushManagerFactory);

Expand All @@ -39,16 +39,14 @@ function getModules(settings) {

storageFactory: getStorage(settings),

splitApiFactory,
serviceApiFactory: splitApiFactory,

syncManagerFactory: syncManagerOnlineCSFactory,

sdkManagerFactory,

sdkClientMethodFactory: sdkClientMethodCSFactory,

SignalListener,

impressionsObserverFactory: impressionObserverCSFactory,

extraProps: (params) => {
Expand All @@ -60,7 +58,7 @@ function getModules(settings) {

switch (settings.mode) {
case LOCALHOST_MODE:
modules.splitApiFactory = undefined;
modules.serviceApiFactory = undefined;
modules.syncManagerFactory = localhostFromObjectFactory;
modules.SignalListener = undefined;
break;
Expand Down
10 changes: 4 additions & 6 deletions src/factory/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { isConsumerMode } from '@splitsoftware/splitio-commons/src/utils/setting

import { localhostFromFileFactory } from '../sync/offline/LocalhostFromFile';
import { settingsFactory } from '../settings/node';
import { platform, SignalListener } from '../platform';
import { bloomFilterFactory } from '../platform/filter/bloomFilter';
import { platform } from '../platform';
import { bloomFilterFactory } from '@splitsoftware/splitio-commons/src/utils/filter/bloomFilter';

const syncManagerOnlineSSFactory = syncManagerOnlineFactory(pollingManagerSSFactory, pushManagerFactory);

Expand All @@ -38,16 +38,14 @@ function getModules(settings) {

storageFactory: getStorage(settings),

splitApiFactory,
serviceApiFactory: splitApiFactory,

syncManagerFactory: syncManagerOnlineSSFactory,

sdkManagerFactory,

sdkClientMethodFactory,

SignalListener,

impressionsObserverFactory: impressionObserverSSFactory,

filterAdapterFactory: bloomFilterFactory,
Expand All @@ -65,7 +63,7 @@ function getModules(settings) {

switch (settings.mode) {
case LOCALHOST_MODE:
modules.splitApiFactory = undefined;
modules.serviceApiFactory = undefined;
modules.syncManagerFactory = localhostFromFileFactory;
modules.SignalListener = undefined;
break;
Expand Down
Loading
Loading