Skip to content
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

Upgrade JS commons v1.18.0: large segments and factory destroy method #121

Merged
merged 43 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c18d4c6
Upgrade JS-commons. Add LS support and tests
EmilianoSanchez Jul 26, 2024
47d2a54
Validate largeSegmentsEnabled config in localhost and consumer modes
EmilianoSanchez Jul 26, 2024
248c6e2
Merge branch 'development' into SDKS-8407_baseline
EmilianoSanchez Jul 26, 2024
058b57e
Handle TS error
EmilianoSanchez Jul 26, 2024
3fdc52c
Upgrade JS-commons with FLAG_SPEC_VERSION 1.2
EmilianoSanchez Jul 31, 2024
79468f2
Merge pull request #125 from splitio/development
EmilianoSanchez Sep 13, 2024
3a8d020
Merge branch 'development' into SDKS-8407_baseline
EmilianoSanchez Sep 20, 2024
7cc83ff
Refactors for LS
EmilianoSanchez Sep 20, 2024
688ab58
rc
EmilianoSanchez Sep 20, 2024
fe6fd77
rollback ci-cd and fix type definitions
EmilianoSanchez Sep 20, 2024
32002c7
Remove unused waitForLargeSegments config
EmilianoSanchez Oct 14, 2024
9a787a8
Upgrade JS-commons. Updated type definitions & tests
EmilianoSanchez Oct 14, 2024
cfd4859
Revert some removed type definitions
EmilianoSanchez Oct 14, 2024
982bff3
Add type definition comment
EmilianoSanchez Oct 14, 2024
4c5f3c6
rc
EmilianoSanchez Oct 23, 2024
f0b7dfe
Remove sync.localhostMode option and validation utils
EmilianoSanchez Oct 25, 2024
23668a9
Remove 'full' subpackage, since there is not significant difference w…
EmilianoSanchez Oct 25, 2024
b935a91
1st step: move SplitIO namespace definition from Browser SDK to JS-Co…
EmilianoSanchez Oct 25, 2024
d5104b5
update JS-commons
EmilianoSanchez Oct 25, 2024
59106de
Merge branch 'remove_pluggable_localhost_mode' into remove_full_entry…
EmilianoSanchez Oct 25, 2024
d9a18dd
Update changelog entry
EmilianoSanchez Oct 25, 2024
1d4444c
Merge branch 'remove_pluggable_localhost_mode' into remove_full_entry…
EmilianoSanchez Oct 25, 2024
a331623
Merge branch 'remove_full_entrypoint' into refactor_type_definitions
EmilianoSanchez Oct 25, 2024
dabfdab
2nd step: move SplitIO namespace definition from React Native SDK to …
EmilianoSanchez Oct 25, 2024
3e5d640
3rd step: move SplitIO namespace definition from JS SDK to JS-Commons…
EmilianoSanchez Oct 26, 2024
41519cd
rc
EmilianoSanchez Oct 26, 2024
1fedc69
Update eslint config
EmilianoSanchez Oct 28, 2024
eb06c6a
Update comments
EmilianoSanchez Oct 28, 2024
cca40d9
Add TSDoc linter rules
EmilianoSanchez Oct 29, 2024
cf7c9c7
rc
EmilianoSanchez Oct 29, 2024
558dd0a
Fixes
EmilianoSanchez Oct 29, 2024
4cfbd3b
Merge pull request #128 from splitio/remove_pluggable_localhost_mode
EmilianoSanchez Oct 31, 2024
0ee9331
Revert "Remove 'full' subpackage, since there is not significant diff…
EmilianoSanchez Oct 31, 2024
32fed5c
Merge branch 'breaking_changes' into refactor_type_definitions
EmilianoSanchez Oct 31, 2024
752f1c4
Update ts test
EmilianoSanchez Oct 31, 2024
c7be832
Upgrade JS-commons
EmilianoSanchez Oct 31, 2024
964235a
rc
EmilianoSanchez Oct 31, 2024
be8b75f
Merge pull request #130 from splitio/refactor_type_definitions
EmilianoSanchez Nov 2, 2024
bfcf5c9
stable version
EmilianoSanchez Nov 2, 2024
b0f0118
Merge pull request #127 from splitio/breaking_changes
EmilianoSanchez Nov 2, 2024
b447c02
Merge branch 'main' into SDKS-8407_baseline
EmilianoSanchez Nov 2, 2024
1a6938e
Merge branch 'development' into SDKS-8407_baseline
EmilianoSanchez Nov 2, 2024
ed16252
Update changelog entry
EmilianoSanchez Nov 2, 2024
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
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.16.0 (September XX, 2024)
- Added `factory.destroy()` method, which invokes the `destroy` method on all SDK clients created by the factory.
- Updated @splitsoftware/splitio-commons package to version 1.18.0 that includes minor updates:
- Added support for targeting rules based on large segments for browsers.
- Updated some transitive dependencies for vulnerability fixes.

0.15.0 (September 13, 2024)
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
- Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.
Expand Down
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-browserjs",
"version": "0.15.0",
"version": "0.15.1-rc.0",
"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.17.0",
"@splitsoftware/splitio-commons": "1.17.1-rc.1",
"@types/google.analytics": "0.0.40",
"tslib": "^2.3.1",
"unfetch": "^4.2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/evaluations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export default function (config, fetchMock, assert) {
for (i; i < SDK_INSTANCES_TO_TEST; i++) {
let splitio = SplitFactory(config);

fetchMock.getOnce('https://sdk.split.io/api/mySegments/aaaaaaklmnbv', { status: 200, body: { mySegments: [] } });
fetchMock.getOnce('https://sdk.split.io/api/memberships/aaaaaaklmnbv', { status: 200, body: { ms: {} } });

// on TA tests, this is going to return one against the mocked seed.
let clientTABucket1 = splitio.client('aaaaaaklmnbv');
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/browserSuites/fetch-specific-splits.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export default function fetchSpecificSplits(fetchMock, assert) {
const queryString = queryStrings[i] || '';
let factory;

fetchMock.getOnce(urls.sdk + '/splitChanges?s=1.1&since=-1' + queryString, { status: 200, body: { splits: [], since: -1, till: 1457552620999 } });
fetchMock.getOnce(urls.sdk + '/splitChanges?s=1.1&since=1457552620999' + queryString, { status: 200, body: { splits: [], since: 1457552620999, till: 1457552620999 } });
fetchMock.getOnce(urls.sdk + '/splitChanges?s=1.1&since=1457552620999' + queryString, function () {
fetchMock.getOnce(urls.sdk + '/splitChanges?s=1.2&since=-1' + queryString, { status: 200, body: { splits: [], since: -1, till: 1457552620999 } });
fetchMock.getOnce(urls.sdk + '/splitChanges?s=1.2&since=1457552620999' + queryString, { status: 200, body: { splits: [], since: 1457552620999, till: 1457552620999 } });
fetchMock.getOnce(urls.sdk + '/splitChanges?s=1.2&since=1457552620999' + queryString, function () {
factory.client().destroy().then(() => {
assert.pass(`splitFilters #${i}`);
});
return { status: 200, body: { splits: [], since: 1457552620999, till: 1457552620999 } };
});
fetchMock.get(urls.sdk + '/mySegments/nicolas%40split.io', { status: 200, body: { 'mySegments': [] } });
fetchMock.get(urls.sdk + '/memberships/nicolas%40split.io', { status: 200, body: { 'ms': {} } });

factory = SplitFactory(config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ export default function (fetchMock, assert) {

// Mock GET endpoints before creating the client
const settings = settingsFactory(config);
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=-1'), { status: 200, body: splitChangesMock1 });
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=1457552620999'), { status: 200, body: { splits: [], since: 1457552620999, till: 1457552620999 } });
fetchMock.getOnce(url(settings, `/mySegments/${encodeURIComponent(config.core.key)}`), { status: 200, body: { mySegments: [] } });
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=-1'), { status: 200, body: splitChangesMock1 });
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=1457552620999'), { status: 200, body: { splits: [], since: 1457552620999, till: 1457552620999 } });
fetchMock.getOnce(url(settings, `/memberships/${encodeURIComponent(config.core.key)}`), { status: 200, body: { ms: {} } });

// Init Split client
const splitio = SplitFactory(config);
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/browserSuites/impressions.debug.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';
import splitChangesMock2 from '../mocks/splitchanges.since.1457552620999.json';
import mySegmentsFacundo from '../mocks/mysegments.facundo@split.io.json';
import membershipsFacundo from '../mocks/memberships.facundo@split.io.json';
import { DEBUG } from '@splitsoftware/splitio-commons/src/utils/constants';
import { url } from '../testUtils';

Expand All @@ -21,9 +21,9 @@ const settings = settingsFactory({

export default function (fetchMock, assert) {
// Mocking this specific route to make sure we only get the items we want to test from the handlers.
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=-1'), { status: 200, body: splitChangesMock1 });
fetchMock.get(url(settings, '/splitChanges?s=1.1&since=1457552620999'), { status: 200, body: splitChangesMock2 });
fetchMock.get(url(settings, '/mySegments/facundo%40split.io'), { status: 200, body: mySegmentsFacundo });
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=-1'), { status: 200, body: splitChangesMock1 });
fetchMock.get(url(settings, '/splitChanges?s=1.2&since=1457552620999'), { status: 200, body: splitChangesMock2 });
fetchMock.get(url(settings, '/memberships/facundo%40split.io'), { status: 200, body: membershipsFacundo });

const splitio = SplitFactory({
core: {
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/browserSuites/impressions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SplitFactory } from '../../';
import { settingsFactory } from '../../settings';
import splitChangesMock1 from '../mocks/splitchanges.since.-1.json';
import splitChangesMock2 from '../mocks/splitchanges.since.1457552620999.json';
import mySegmentsFacundo from '../mocks/mysegments.facundo@split.io.json';
import membershipsFacundo from '../mocks/memberships.facundo@split.io.json';
import { OPTIMIZED } from '@splitsoftware/splitio-commons/src/utils/constants';
import { truncateTimeFrame } from '@splitsoftware/splitio-commons/src/utils/time';
import { url } from '../testUtils';
Expand All @@ -24,9 +24,9 @@ let truncatedTimeFrame;

export default function (fetchMock, assert) {
// Mocking this specific route to make sure we only get the items we want to test from the handlers.
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=-1'), { status: 200, body: splitChangesMock1 });
fetchMock.get(url(settings, '/splitChanges?s=1.1&since=1457552620999'), { status: 200, body: splitChangesMock2 });
fetchMock.get(url(settings, '/mySegments/facundo%40split.io'), { status: 200, body: mySegmentsFacundo });
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=-1'), { status: 200, body: splitChangesMock1 });
fetchMock.get(url(settings, '/splitChanges?s=1.2&since=1457552620999'), { status: 200, body: splitChangesMock2 });
fetchMock.get(url(settings, '/memberships/facundo%40split.io'), { status: 200, body: membershipsFacundo });

const splitio = SplitFactory({
core: {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/browserSuites/manager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import map from 'lodash/map';
import { url } from '../testUtils';

export default async function (settings, fetchMock, assert) {
fetchMock.getOnce({ url: url(settings, '/splitChanges?s=1.1&since=-1'), overwriteRoutes: true }, { status: 200, body: splitChangesMockReal });
fetchMock.getOnce({ url: url(settings, '/splitChanges?s=1.2&since=-1'), overwriteRoutes: true }, { status: 200, body: splitChangesMockReal });

const mockSplits = splitChangesMockReal;

Expand Down
14 changes: 7 additions & 7 deletions src/__tests__/browserSuites/push-corner-cases.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const MILLIS_SPLIT_CHANGES_RESPONSE = 400;

/**
* Sequence of calls:
* 0.0 secs: initial SyncAll (/splitChanges, /mySegments/*), auth, SSE connection, SDK_READY_FROM_CACHE
* 0.1 secs: SSE connection opened -> syncAll (/splitChanges, /mySegments/*)
* 0.0 secs: initial SyncAll (/splitChanges, /memberships/*), auth, SSE connection, SDK_READY_FROM_CACHE
* 0.1 secs: SSE connection opened -> syncAll (/splitChanges, /memberships/*)
* 0.2 secs: SPLIT_KILL event -> /splitChanges
* 0.4 secs: /splitChanges response --> SDK_READY
*/
Expand Down Expand Up @@ -70,13 +70,13 @@ export function testSplitKillOnReadyFromCache(fetchMock, assert) {
});

// 1 auth request
fetchMock.getOnce(url(settings, `/v2/auth?s=1.1&users=${encodeURIComponent(userKey)}`), { status: 200, body: authPushEnabledNicolas });
// 2 mySegments requests: initial sync and after SSE opened
fetchMock.get({ url: url(settings, '/mySegments/nicolas%40split.io'), repeat: 2 }, { status: 200, body: { mySegments: [] } });
fetchMock.getOnce(url(settings, `/v2/auth?s=1.2&users=${encodeURIComponent(userKey)}`), { status: 200, body: authPushEnabledNicolas });
// 2 memberships requests: initial sync and after SSE opened
fetchMock.get({ url: url(settings, '/memberships/nicolas%40split.io'), repeat: 2 }, { status: 200, body: { ms: {} } });

// 2 splitChanges request: initial sync and after SSE opened. Sync after SPLIT_KILL is not performed because SplitsSyncTask is "executing"
fetchMock.getOnce(url(settings, '/splitChanges?s=1.1&since=25'), { status: 200, body: splitChangesMock1 }, { delay: MILLIS_SPLIT_CHANGES_RESPONSE, /* delay response */ });
fetchMock.getOnce(url(settings, `/splitChanges?s=1.1&since=${splitChangesMock1.till}`), { status: 200, body: { splits: [], since: splitChangesMock1.till, till: splitChangesMock1.till } }, { delay: MILLIS_SPLIT_CHANGES_RESPONSE - 100, /* delay response */ });
fetchMock.getOnce(url(settings, '/splitChanges?s=1.2&since=25'), { status: 200, body: splitChangesMock1 }, { delay: MILLIS_SPLIT_CHANGES_RESPONSE, /* delay response */ });
fetchMock.getOnce(url(settings, `/splitChanges?s=1.2&since=${splitChangesMock1.till}`), { status: 200, body: { splits: [], since: splitChangesMock1.till, till: splitChangesMock1.till } }, { delay: MILLIS_SPLIT_CHANGES_RESPONSE - 100, /* delay response */ });

fetchMock.get(new RegExp('.*'), function (url) {
assert.fail('unexpected GET request with url: ' + url);
Expand Down
Loading
Loading