Skip to content

Commit

Permalink
Merge pull request #816 from splitio/SDKS-8407_polishing
Browse files Browse the repository at this point in the history
Large Segments support: localhost mode
  • Loading branch information
EmilianoSanchez authored Aug 20, 2024
2 parents b009049 + bbdc7d9 commit 049ee4e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 17 deletions.
18 changes: 9 additions & 9 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",
"version": "10.27.1-rc.0",
"version": "10.27.1-rc.2",
"description": "Split SDK",
"files": [
"README.md",
Expand Down Expand Up @@ -40,7 +40,7 @@
"node": ">=6"
},
"dependencies": {
"@splitsoftware/splitio-commons": "1.16.1-rc.6",
"@splitsoftware/splitio-commons": "1.16.1-rc.8",
"@types/google.analytics": "0.0.40",
"@types/ioredis": "^4.28.0",
"bloom-filters": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/telemetry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default async function telemetryBrowserSuite(fetchMock, t) {
delete data.tR; // delete to validate other properties

assert.deepEqual(data, {
oM: 0, st: 'memory', aF: 1, rF: 0, sE: false, lE: false,
oM: 0, st: 'memory', aF: 1, rF: 0, sE: false,
rR: { sp: 99999, ms: 60, im: 300, ev: 60, te: 1 } /* override featuresRefreshRate */,
uO: { s: true, e: true, a: false, st: false, t: true } /* override sdk, events and telemetry URLs */,
iQ: 30000, eQ: 500, iM: 0, iL: false, hP: false, nR: 1 /* 1 non ready usage */, t: [], i: [], uC: 2 /* Default GRANTED */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"type": "message",
"data": "{\"data\":\"{\\\"type\\\":\\\"MY_LARGE_SEGMENTS_UPDATE\\\",\\\"changeNumber\\\":1457552650000,\\\"largeSegments\\\":[],\\\"c\\\": 0,\\\"u\\\": 0,\\\"d\\\":\\\"\\\",\\\"i\\\":300,\\\"h\\\":0,\\\"s\\\":0}\"}"
"data": "{\"data\":\"{\\\"type\\\":\\\"MY_LARGE_SEGMENTS_UPDATE\\\",\\\"changeNumber\\\":1457552650000,\\\"largeSegments\\\":[],\\\"c\\\": 0,\\\"u\\\": 0,\\\"d\\\":\\\"\\\",\\\"i\\\":300,\\\"h\\\":1,\\\"s\\\":0}\"}"
}
2 changes: 1 addition & 1 deletion src/__tests__/mocks/mylargesegments.employees.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"myLargeSegments": [
"employees"
],
"changeNumber": 1234567890
"till": 1234567890
}
6 changes: 5 additions & 1 deletion src/__tests__/offline/browser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ tape('Browser offline mode', function (assert) {
startup: {
eventsFirstPushWindow: 0
},
features: originalFeaturesMap
features: originalFeaturesMap,
sync: {
// ignored
largeSegmentsEnabled: true
}
};
const factory = SplitFactory(config);
const manager = factory.manager();
Expand Down
8 changes: 7 additions & 1 deletion src/settings/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { validateRuntime } from '@splitsoftware/splitio-commons/src/utils/settin
import { validateLogger } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/logger/builtinLogger';
import { LocalhostFromObject } from '@splitsoftware/splitio-commons/src/sync/offline/LocalhostFromObject';
import { validateConsent } from '@splitsoftware/splitio-commons/src/utils/settingsValidation/consent';
import { STANDALONE_MODE } from '@splitsoftware/splitio-commons/src/utils/constants';

import { defaults } from './defaults/browser';
import { validateStorage } from './storage/browser';
Expand All @@ -20,5 +21,10 @@ const params = {
};

export function settingsFactory(config) {
return settingsValidation(config, params);
const settings = settingsValidation(config, params);

// Override in localhost mode to emit SDK_READY event
if (settings.mode !== STANDALONE_MODE) settings.sync.largeSegmentsEnabled = false;

return settings;
}
2 changes: 1 addition & 1 deletion src/settings/defaults/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const packageVersion = '10.27.1-rc.0';
export const packageVersion = '10.27.1-rc.2';

0 comments on commit 049ee4e

Please sign in to comment.