Skip to content

Commit 5eb0027

Browse files
Merge pull request #386 from splitio/development
Release v2.0.3
2 parents 5014820 + 7ea84aa commit 5eb0027

File tree

20 files changed

+35
-42
lines changed

20 files changed

+35
-42
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2.0.3 (January 9, 2025)
2+
- Bugfixing - Properly handle rejected promises when using targeting rules with segment matchers in consumer modes (e.g., Redis and Pluggable storages).
3+
14
2.0.2 (December 3, 2024)
25
- Updated the factory `init` and `destroy` methods to support re-initialization after destruction. This update ensures compatibility of the React SDK with React Strict Mode, where the factory's `init` and `destroy` effects are executed an extra time to validate proper resource cleanup.
36
- Bugfixing - Sanitize the `SplitSDKMachineName` header value to avoid exceptions on HTTP/S requests when it contains non ISO-8859-1 characters (Related to issue https://github.com/splitio/javascript-client/issues/847).

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2024 Split Software, Inc.
1+
Copyright © 2025 Split Software, Inc.
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This library is compatible with JavaScript ES5 and above.
1414
Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to submit a Pull Request (PR).
1515

1616
## License
17-
Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/).
17+
Licensed under the Apache License, Version 2.0. See: [Apache License](https://www.apache.org/licenses/).
1818

1919
## About Split
2020

@@ -46,4 +46,4 @@ For a comprehensive list of open source projects visit our [Github page](https:/
4646

4747
**Learn more about Split:**
4848

49-
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information.
49+
Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](https://help.split.io) for more detailed information.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio-commons",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Split JavaScript SDK common components",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
import { MaybeThenable } from '../../dtos/types';
22
import { ISegmentsCacheBase } from '../../storages/types';
3-
import { thenable } from '../../utils/promise/thenable';
43

54
export function largeSegmentMatcherContext(largeSegmentName: string, storage: { largeSegments?: ISegmentsCacheBase }) {
65

76
return function largeSegmentMatcher(key: string): MaybeThenable<boolean> {
87
const isInLargeSegment = storage.largeSegments ? storage.largeSegments.isInSegment(largeSegmentName, key) : false;
98

10-
if (thenable(isInLargeSegment)) {
11-
isInLargeSegment.then(result => {
12-
return result;
13-
});
14-
}
15-
169
return isInLargeSegment;
1710
};
1811
}

src/evaluator/matchers/segment.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
import { MaybeThenable } from '../../dtos/types';
22
import { ISegmentsCacheBase } from '../../storages/types';
3-
import { thenable } from '../../utils/promise/thenable';
43

54
export function segmentMatcherContext(segmentName: string, storage: { segments: ISegmentsCacheBase }) {
65

76
return function segmentMatcher(key: string): MaybeThenable<boolean> {
87
const isInSegment = storage.segments.isInSegment(segmentName, key);
98

10-
if (thenable(isInSegment)) {
11-
isInSegment.then(result => {
12-
return result;
13-
});
14-
}
15-
169
return isInSegment;
1710
};
1811
}

src/listeners/node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class NodeSignalListener implements ISignalListener {
5656
// Cleaned up, remove handlers.
5757
this.stop();
5858

59-
// This handler prevented the default behaviour, start again.
59+
// This handler prevented the default behavior, start again.
6060
// eslint-disable-next-line no-undef
6161
process.kill(process.pid, SIGTERM);
6262
};
@@ -72,7 +72,7 @@ export class NodeSignalListener implements ISignalListener {
7272
}
7373

7474
if (thenable(handlerResult)) {
75-
// Always exit, even with errors. The promise is returned for UT purposses.
75+
// Always exit, even with errors. The promise is returned for UT purposes.
7676
return handlerResult.then(wrapUp).catch(wrapUp);
7777
} else {
7878
wrapUp();

src/logger/__tests__/index.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,22 @@ function testLogLevels(levelToTest: SplitIO.LogLevel) {
9797

9898
}
9999

100-
test('SPLIT LOGGER / Logger class public methods behaviour - instance.debug', () => {
100+
test('SPLIT LOGGER / Logger class public methods behavior - instance.debug', () => {
101101
testLogLevels(LogLevels.DEBUG);
102102

103103
});
104104

105-
test('SPLIT LOGGER / Logger class public methods behaviour - instance.info', () => {
105+
test('SPLIT LOGGER / Logger class public methods behavior - instance.info', () => {
106106
testLogLevels(LogLevels.INFO);
107107

108108
});
109109

110-
test('SPLIT LOGGER / Logger class public methods behaviour - instance.warn', () => {
110+
test('SPLIT LOGGER / Logger class public methods behavior - instance.warn', () => {
111111
testLogLevels(LogLevels.WARN);
112112

113113
});
114114

115-
test('SPLIT LOGGER / Logger class public methods behaviour - instance.error', () => {
115+
test('SPLIT LOGGER / Logger class public methods behavior - instance.error', () => {
116116
testLogLevels(LogLevels.ERROR);
117117

118118
});

src/readiness/__tests__/readinessManager.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ test('READINESS MANAGER / Cancel timeout if ready fired', (done) => {
214214

215215
const readinessManager = readinessManagerFactory(EventEmitter, settingsWithTimeout);
216216
readinessManager.init(); // Start the timeout
217+
readinessManager.destroy(); // Should cancel the timeout
218+
readinessManager.init(); // Start the timeout again
217219

218220
readinessManager.gate.on(SDK_READY_TIMED_OUT, () => { sdkReadyTimedoutCalled = true; });
219221
readinessManager.gate.once(SDK_READY, () => { sdkReadyCalled = true; });

0 commit comments

Comments
 (0)