Skip to content

Commit 80b00ad

Browse files
Merge branch 'breaking_changes_baseline' into refactor_storage_emits_ready_from_cache
2 parents a21b098 + e954789 commit 80b00ad

File tree

80 files changed

+355
-2251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+355
-2251
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"message": "Don't declare const enum, because it is not supported by Babel used for building RN SDK"
8181
}
8282
],
83-
"compat/compat": ["error", "defaults, ie 10, node 6"],
83+
"compat/compat": ["error", "defaults, node >=14"],
8484
"no-throw-literal": "error",
8585
"import/no-default-export": "error",
8686
"import/no-self-import": "error"

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- Updated default flag spec version to 1.2.
99
- Removed `/mySegments` endpoint from SplitAPI module, as it is replaced by `/memberships` endpoint.
1010
- Removed support for MY_SEGMENTS_UPDATE and MY_SEGMENTS_UPDATE_V2 notification types, as they are replaced by MEMBERSHIPS_MS_UPDATE and MEMBERSHIPS_LS_UPDATE notification types.
11+
- Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations.
12+
- Removed the migration logic for the old format of MySegments keys in LocalStorage introduced in JavaScript SDK v10.17.3.
13+
- Removed the `sdkClientMethodCSWithTT` function, which handled the logic to bound an optional traffic type to SDK clients. Client-side SDK implementations must use `sdkClientMethodCS` module, which, unlike the previous function, does not allow passing a traffic type but simplifies the SDK API.
14+
- Removed internal ponyfills for `Map` and `Set` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or to provide a polyfill.
1115

1216
1.17.0 (September 6, 2024)
1317
- Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.

package-lock.json

Lines changed: 106 additions & 92 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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio-commons",
3-
"version": "1.17.1-rc.4",
3+
"version": "2.0.0-rc.0",
44
"description": "Split JavaScript SDK common components",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",
@@ -64,7 +64,7 @@
6464
"@typescript-eslint/parser": "^6.6.0",
6565
"cross-env": "^7.0.2",
6666
"eslint": "^8.48.0",
67-
"eslint-plugin-compat": "^4.2.0",
67+
"eslint-plugin-compat": "^6.0.1",
6868
"eslint-plugin-import": "^2.25.3",
6969
"fetch-mock": "^9.11.0",
7070
"ioredis": "^4.28.0",

src/evaluator/Engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class Engine {
2121

2222
constructor(private baseInfo: ISplit, private evaluator: IEvaluator) {
2323

24-
// in case we don't have a default treatment in the instanciation, use 'control'
24+
// in case we don't have a default treatment in the instantiation, use 'control'
2525
if (typeof this.baseInfo.defaultTreatment !== 'string') {
2626
this.baseInfo.defaultTreatment = CONTROL;
2727
}

src/evaluator/__tests__/evaluate-features.spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { evaluateFeatures, evaluateFeaturesByFlagSets } from '../index';
33
import { EXCEPTION, NOT_IN_SPLIT, SPLIT_ARCHIVED, SPLIT_KILLED, SPLIT_NOT_FOUND } from '../../utils/labels';
44
import { loggerMock } from '../../logger/__tests__/sdkLogger.mock';
5-
import { _Set } from '../../utils/lang/sets';
65
import { WARN_FLAGSET_WITHOUT_FLAGS } from '../../logger/constants';
76

87
const splitsMock = {
@@ -17,8 +16,8 @@ const splitsMock = {
1716
};
1817

1918
const flagSetsMock = {
20-
reg_and_config: new _Set(['regular', 'config']),
21-
arch_and_killed: new _Set(['killed', 'archived']),
19+
reg_and_config: new Set(['regular', 'config']),
20+
arch_and_killed: new Set(['killed', 'archived']),
2221
};
2322

2423
const mockStorage = {
@@ -38,7 +37,7 @@ const mockStorage = {
3837
return splits;
3938
},
4039
getNamesByFlagSets(flagSets) {
41-
return flagSets.map(flagset => flagSetsMock[flagset] || new _Set());
40+
return flagSets.map(flagset => flagSetsMock[flagset] || new Set());
4241
}
4342
}
4443
};
@@ -192,7 +191,7 @@ describe('EVALUATOR - Multiple evaluations at once by flag sets', () => {
192191
// Should support async storage too
193192
expect(await getResultsByFlagsets(['inexistent_set1', 'inexistent_set2'], {
194193
splits: {
195-
getNamesByFlagSets(flagSets) { return Promise.resolve(flagSets.map(flagset => flagSetsMock[flagset] || new _Set())); }
194+
getNamesByFlagSets(flagSets) { return Promise.resolve(flagSets.map(flagset => flagSetsMock[flagset] || new Set())); }
196195
}
197196
})).toEqual({});
198197
expect(loggerMock.warn.mock.calls).toEqual([

src/evaluator/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IStorageAsync, IStorageSync } from '../storages/types';
77
import { IEvaluationResult } from './types';
88
import { SplitIO } from '../types';
99
import { ILogger } from '../logger/types';
10-
import { ISet, setToArray, returnSetsUnion, _Set } from '../utils/lang/sets';
10+
import { returnSetsUnion, setToArray } from '../utils/lang/sets';
1111
import { WARN_FLAGSET_WITHOUT_FLAGS } from '../logger/constants';
1212

1313
const treatmentException = {
@@ -97,12 +97,12 @@ export function evaluateFeaturesByFlagSets(
9797
storage: IStorageSync | IStorageAsync,
9898
method: string,
9999
): MaybeThenable<Record<string, IEvaluationResult>> {
100-
let storedFlagNames: MaybeThenable<ISet<string>[]>;
100+
let storedFlagNames: MaybeThenable<Set<string>[]>;
101101

102102
function evaluate(
103-
featureFlagsByFlagSets: ISet<string>[],
103+
featureFlagsByFlagSets: Set<string>[],
104104
) {
105-
let featureFlags = new _Set();
105+
let featureFlags = new Set<string>();
106106
for (let i = 0; i < flagSets.length; i++) {
107107
const featureFlagByFlagSet = featureFlagsByFlagSets[i];
108108
if (featureFlagByFlagSet.size) {

src/evaluator/matchers/semver_inlist.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { _Set } from '../../utils/lang/sets';
21
import { Semver } from '../../utils/Semver';
32

43
export function inListSemverMatcherContext(ruleAttr: string[]) {
54
// @TODO ruleAttr validation should be done at the `parser` or `matchersTransform` level to reuse for all matchers
65
if (!ruleAttr || ruleAttr.length === 0) throw new Error('whitelistMatcherData is required for IN_LIST_SEMVER matcher type');
76

8-
const listOfSemvers = new _Set(ruleAttr.map((version) => new Semver(version).version));
7+
const listOfSemvers = new Set(ruleAttr.map((version) => new Semver(version).version));
98

109
return function inListSemverMatcher(runtimeAttr: string): boolean {
1110
const runtimeSemver = new Semver(runtimeAttr).version;

src/evaluator/matchers/whitelist.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { _Set } from '../../utils/lang/sets';
2-
31
export function whitelistMatcherContext(ruleAttr: string[]) {
4-
const whitelistSet = new _Set(ruleAttr);
2+
const whitelistSet = new Set(ruleAttr);
53

64
return function whitelistMatcher(runtimeAttr: string): boolean {
75
const isInWhitelist = whitelistSet.has(runtimeAttr);

src/integrations/__tests__/browser.spec.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/integrations/browser.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)