Skip to content

Commit 2459b10

Browse files
Merge branch 'breaking_changes_update_supported_runtimes' into breaking_changes_remove_deprecated_features
2 parents 464102f + c7a2002 commit 2459b10

File tree

14 files changed

+34
-16
lines changed

14 files changed

+34
-16
lines changed

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
- Removed `/mySegments` endpoint from SplitAPI module, as it is replaced by `/memberships` endpoint.
88
- 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.
99
- Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations.
10-
- Removed internal ponyfills for `Map`, `Set` and `Array.from` 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.
1110
- Removed the migration logic for the old format of MySegments keys in LocalStorage introduced in JavaScript SDK v10.17.3.
1211
- 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.
12+
- 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.
1313

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

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/index.ts

Lines changed: 2 additions & 2 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 { returnSetsUnion } 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 = {
@@ -113,7 +113,7 @@ export function evaluateFeaturesByFlagSets(
113113
}
114114

115115
return featureFlags.size ?
116-
evaluateFeatures(log, key, Array.from(featureFlags), attributes, storage) :
116+
evaluateFeatures(log, key, setToArray(featureFlags), attributes, storage) :
117117
{};
118118
}
119119

src/storages/inLocalStorage/SplitsCacheInLocal.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ILogger } from '../../logger/types';
66
import { LOG_PREFIX } from './constants';
77
import { ISettings } from '../../types';
88
import { getStorageHash } from '../KeyBuilder';
9+
import { setToArray } from '../../utils/lang/sets';
910

1011
/**
1112
* ISplitsCacheSync implementation that stores split definitions in browser LocalStorage.
@@ -281,7 +282,7 @@ export class SplitsCacheInLocal extends AbstractSplitsCacheSync {
281282
const flagSetCache = new Set(flagSetFromLocalStorage ? JSON.parse(flagSetFromLocalStorage) : []);
282283
flagSetCache.add(featureFlag.name);
283284

284-
localStorage.setItem(flagSetKey, JSON.stringify(Array.from(flagSetCache)));
285+
localStorage.setItem(flagSetKey, JSON.stringify(setToArray(flagSetCache)));
285286
});
286287
}
287288

@@ -308,7 +309,7 @@ export class SplitsCacheInLocal extends AbstractSplitsCacheSync {
308309
return;
309310
}
310311

311-
localStorage.setItem(flagSetKey, JSON.stringify(Array.from(flagSetCache)));
312+
localStorage.setItem(flagSetKey, JSON.stringify(setToArray(flagSetCache)));
312313
}
313314

314315
}

src/storages/inLocalStorage/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function InLocalStorage(options: InLocalStorageOptions = {}): IStorageSyn
6565
this.uniqueKeys?.clear();
6666
},
6767

68-
// When using shared instanciation with MEMORY we reuse everything but segments (they are customer per key).
68+
// When using shared instantiation with MEMORY we reuse everything but segments (they are customer per key).
6969
shared(matchingKey: string) {
7070

7171
return {

src/storages/inMemory/InMemoryStorageCS.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function InMemoryStorageCSFactory(params: IStorageFactoryParams): IStorag
4141
this.uniqueKeys && this.uniqueKeys.clear();
4242
},
4343

44-
// When using shared instanciation with MEMORY we reuse everything but segments (they are unique per key)
44+
// When using shared instantiation with MEMORY we reuse everything but segments (they are unique per key)
4545
shared() {
4646
return {
4747
splits: this.splits,

src/storages/inMemory/UniqueKeysCacheInMemory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { IUniqueKeysCacheBase } from '../types';
22
import { UniqueKeysPayloadSs } from '../../sync/submitters/types';
33
import { DEFAULT_CACHE_SIZE } from '../inRedis/constants';
4+
import { setToArray } from '../../utils/lang/sets';
45

56
/**
67
* Converts `uniqueKeys` data from cache into request payload for SS.
@@ -10,7 +11,7 @@ export function fromUniqueKeysCollector(uniqueKeys: { [featureName: string]: Set
1011
const featureNames = Object.keys(uniqueKeys);
1112
for (let i = 0; i < featureNames.length; i++) {
1213
const featureName = featureNames[i];
13-
const userKeys = Array.from(uniqueKeys[featureName]);
14+
const userKeys = setToArray(uniqueKeys[featureName]);
1415
const uniqueKeysPayload = {
1516
f: featureName,
1617
ks: userKeys

src/storages/inMemory/UniqueKeysCacheInMemoryCS.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { IUniqueKeysCacheBase } from '../types';
22
import { UniqueKeysPayloadCs } from '../../sync/submitters/types';
33
import { DEFAULT_CACHE_SIZE } from '../inRedis/constants';
4+
import { setToArray } from '../../utils/lang/sets';
45

56
export class UniqueKeysCacheInMemoryCS implements IUniqueKeysCacheBase {
67

@@ -70,7 +71,7 @@ export class UniqueKeysCacheInMemoryCS implements IUniqueKeysCacheBase {
7071
const userKeys = Object.keys(uniqueKeys);
7172
for (let k = 0; k < userKeys.length; k++) {
7273
const userKey = userKeys[k];
73-
const featureNames = Array.from(uniqueKeys[userKey]);
74+
const featureNames = setToArray(uniqueKeys[userKey]);
7475
const uniqueKeysPayload = {
7576
k: userKey,
7677
fs: featureNames

src/storages/inRedis/RedisAdapter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ILogger } from '../../logger/types';
33
import { merge, isString } from '../../utils/lang';
44
import { thenable } from '../../utils/promise/thenable';
55
import { timeout } from '../../utils/promise/timeout';
6+
import { setToArray } from '../../utils/lang/sets';
67

78
const LOG_PREFIX = 'storage:redis-adapter: ';
89

@@ -149,7 +150,7 @@ export class RedisAdapter extends ioredis {
149150
if (instance._runningCommands.size > 0) {
150151
instance.log.info(LOG_PREFIX + `Attempting to disconnect but there are ${instance._runningCommands.size} commands still waiting for resolution. Defering disconnection until those finish.`);
151152

152-
Promise.all(Array.from(instance._runningCommands))
153+
Promise.all(setToArray(instance._runningCommands))
153154
.then(() => {
154155
instance.log.debug(LOG_PREFIX + 'Pending commands finished successfully, disconnecting.');
155156
originalMethod.apply(instance, params);

src/storages/inRedis/UniqueKeysCacheInRedis.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { LOG_PREFIX } from './constants';
55
import { ILogger } from '../../logger/types';
66
import { UniqueKeysItemSs } from '../../sync/submitters/types';
77
import type { RedisAdapter } from './RedisAdapter';
8+
import { setToArray } from '../../utils/lang/sets';
89

910
export class UniqueKeysCacheInRedis extends UniqueKeysCacheInMemory implements IUniqueKeysCacheBase {
1011

@@ -28,7 +29,7 @@ export class UniqueKeysCacheInRedis extends UniqueKeysCacheInMemory implements I
2829
if (!featureNames.length) return Promise.resolve(false);
2930

3031
const uniqueKeysArray = featureNames.map((featureName) => {
31-
const featureKeys = Array.from(this.uniqueKeysTracker[featureName]);
32+
const featureKeys = setToArray(this.uniqueKeysTracker[featureName]);
3233
const uniqueKeysPayload = {
3334
f: featureName,
3435
ks: featureKeys

0 commit comments

Comments
 (0)