From 0e7631104e883bcfbff63895c284b6fad21c6902 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Fri, 19 Apr 2024 17:48:26 -0300 Subject: [PATCH 1/5] Fix error --- CHANGES.txt | 3 +++ package-lock.json | 4 ++-- package.json | 2 +- src/__tests__/selectors.test.ts | 7 ++++++- src/selectors.ts | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9c8c840..f0d5cf8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +1.11.1 (May XX, 2024) + - Bugfixing - Fixed error when calling `selectTreatmentValue` and `selectTreatmentWithConfig` selectors with an object as a key, caused by the key not being stringified correctly. + 1.11.0 (April 3, 2024) - Added `sideEffects: false` property in the package.json file to allow tree shaking. - Updated Redux-Thunk peer dependency range to include redux-thunk@3.x.x. diff --git a/package-lock.json b/package-lock.json index 76d7aff..da60e1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@splitsoftware/splitio-redux", - "version": "1.11.0", + "version": "1.11.1-rc.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio-redux", - "version": "1.11.0", + "version": "1.11.1-rc.0", "license": "Apache-2.0", "dependencies": { "@splitsoftware/splitio": "10.25.2", diff --git a/package.json b/package.json index 87d07c6..eb8e732 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-redux", - "version": "1.11.0", + "version": "1.11.1-rc.0", "description": "A library to easily use Split JS SDK with Redux and React Redux", "main": "lib/index.js", "module": "es/index.js", diff --git a/src/__tests__/selectors.test.ts b/src/__tests__/selectors.test.ts index d7deec3..f2a1fbf 100644 --- a/src/__tests__/selectors.test.ts +++ b/src/__tests__/selectors.test.ts @@ -20,6 +20,9 @@ describe('selectTreatmentValue', () => { it('returns the treatment value of the given feature flag name and key', () => { /** The treatment value for the USER_1 key for SPLIT_1 is 'off' */ expect(selectTreatmentValue(STATE_READY.splitio, SPLIT_2, USER_1)).toBe(OFF); + // Using a key object + expect(selectTreatmentValue(STATE_READY.splitio, SPLIT_2, { matchingKey: USER_1, bucketingKey: 'some_bucket' })).toBe(OFF); // @ts-expect-error bucketingKey is not in SplitKey type, but it's not used in the selector + expect(selectTreatmentValue(STATE_READY.splitio, SPLIT_2, { matchingKey: USER_1 })).toBe(OFF); }); it('returns "control" value if the given feature flag name or key are invalid (were not evaluated with getTreatment, or returned "control"', () => { @@ -46,6 +49,8 @@ describe('selectTreatmentWithConfig', () => { it('returns the treatment of the given feature flag name and key', () => { expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_2, USER_1)).toBe(STATE_READY.splitio.treatments[SPLIT_2][USER_1]); + // Using a key object + expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_2, { matchingKey: USER_1, bucketingKey: 'some_bucket' })).toBe(STATE_READY.splitio.treatments[SPLIT_2][USER_1]); }); it('returns "control" treatment if the given feature flag name or key are invalid (were not evaluated with getTreatment, or returned "control")', () => { @@ -54,7 +59,7 @@ describe('selectTreatmentWithConfig', () => { }); it('returns the passed default treatment insteaad of "control" if the given feature flag name or key are invalid', () => { - const DEFAULT_TREATMENT = {treatment: 'some_value', config: 'some_config'}; + const DEFAULT_TREATMENT = { treatment: 'some_value', config: 'some_config' }; expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_1, USER_INVALID, DEFAULT_TREATMENT)).toBe(DEFAULT_TREATMENT); expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_INVALID, USER_1, DEFAULT_TREATMENT)).toBe(DEFAULT_TREATMENT); diff --git a/src/selectors.ts b/src/selectors.ts index ef0683f..25ca3d0 100644 --- a/src/selectors.ts +++ b/src/selectors.ts @@ -1,5 +1,6 @@ import { ISplitState } from './types'; import { CONTROL, CONTROL_WITH_CONFIG, DEFAULT_SPLIT_STATE_SLICE, ERROR_SELECTOR_NO_SPLITSTATE } from './constants'; +import { matching } from './utils'; export const getStateSlice = (sliceName: string) => (state: any) => state[sliceName]; @@ -30,7 +31,7 @@ export function selectTreatmentWithConfig(splitState: ISplitState, featureFlagNa const treatment = splitTreatments ? key ? - splitTreatments[key.toString()] : + splitTreatments[matching(key)] : Object.values(splitTreatments)[0] : undefined; From 79e1493eee7a681b93246ee01f6d81a27b3aeec9 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 8 May 2024 11:04:59 -0300 Subject: [PATCH 2/5] Update changelog description --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index f0d5cf8..7b7c9ba 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,5 @@ 1.11.1 (May XX, 2024) - - Bugfixing - Fixed error when calling `selectTreatmentValue` and `selectTreatmentWithConfig` selectors with an object as a key, caused by the key not being stringified correctly. + - Bugfixing - Fixed error when calling `selectTreatmentValue` and `selectTreatmentWithConfig` selectors with an object as a key, caused by the key being stringified rather than using the `matchingKey` property of the object. 1.11.0 (April 3, 2024) - Added `sideEffects: false` property in the package.json file to allow tree shaking. From 72a2d0c85c57bc04e0264925652bc40c95be56c7 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 8 May 2024 11:21:51 -0300 Subject: [PATCH 3/5] Upgrade JS SDK dependency --- CHANGES.txt | 6 +++++- package-lock.json | 34 +++++++++++++++++----------------- package.json | 4 ++-- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 7b7c9ba..1c311cf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,8 @@ -1.11.1 (May XX, 2024) +1.12.0 (May 8, 2024) + - Updated @splitsoftware/splitio package to version 10.26.0 that includes minor updates: + - Added support for targeting rules based on semantic versions (https://semver.org/). + - Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment. + - Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints. - Bugfixing - Fixed error when calling `selectTreatmentValue` and `selectTreatmentWithConfig` selectors with an object as a key, caused by the key being stringified rather than using the `matchingKey` property of the object. 1.11.0 (April 3, 2024) diff --git a/package-lock.json b/package-lock.json index da60e1b..ffcd7b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@splitsoftware/splitio-redux", - "version": "1.11.1-rc.0", + "version": "1.12.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio-redux", - "version": "1.11.1-rc.0", + "version": "1.12.0", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio": "10.25.2", + "@splitsoftware/splitio": "10.26.0", "tslib": "^2.3.1" }, "devDependencies": { @@ -1503,11 +1503,11 @@ } }, "node_modules/@splitsoftware/splitio": { - "version": "10.25.2", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.25.2.tgz", - "integrity": "sha512-lX06PSoA+hcw66c889RxK9t9cd8evguBFk+x1pw2L4J/58+7XHxp/z1Nnbtb3AOw8s/sX4h87qlTiZqMGPmcmA==", + "version": "10.26.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.26.0.tgz", + "integrity": "sha512-sACjAcov/Zn1gYaN6m0qQb9G/LDk43c8rEzFaabhlnWOsH0W22ImVHGx8iU3I/DyC1S2wrsjXTSnW1GQlbb7+Q==", "dependencies": { - "@splitsoftware/splitio-commons": "1.13.1", + "@splitsoftware/splitio-commons": "1.14.0", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -1526,9 +1526,9 @@ } }, "node_modules/@splitsoftware/splitio-commons": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.13.1.tgz", - "integrity": "sha512-xGu94sLx+tJb6PeM26vH8/LEElsaVbh2BjoLvL5twR4gKsVezie5ZtHhejWT1+iCVCtJuhjZxKwOm4HGYoVIHQ==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.14.0.tgz", + "integrity": "sha512-ANP0NRPAMehi4bUQsb19kP5W5NVuCYUKRsDC5Nl78xHIu6cskAej1rXkjsocLnWerz2rO0H9kMjRKZj9lVsvKA==", "dependencies": { "tslib": "^2.3.1" }, @@ -11056,11 +11056,11 @@ } }, "@splitsoftware/splitio": { - "version": "10.25.2", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.25.2.tgz", - "integrity": "sha512-lX06PSoA+hcw66c889RxK9t9cd8evguBFk+x1pw2L4J/58+7XHxp/z1Nnbtb3AOw8s/sX4h87qlTiZqMGPmcmA==", + "version": "10.26.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio/-/splitio-10.26.0.tgz", + "integrity": "sha512-sACjAcov/Zn1gYaN6m0qQb9G/LDk43c8rEzFaabhlnWOsH0W22ImVHGx8iU3I/DyC1S2wrsjXTSnW1GQlbb7+Q==", "requires": { - "@splitsoftware/splitio-commons": "1.13.1", + "@splitsoftware/splitio-commons": "1.14.0", "@types/google.analytics": "0.0.40", "@types/ioredis": "^4.28.0", "bloom-filters": "^3.0.0", @@ -11073,9 +11073,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.13.1.tgz", - "integrity": "sha512-xGu94sLx+tJb6PeM26vH8/LEElsaVbh2BjoLvL5twR4gKsVezie5ZtHhejWT1+iCVCtJuhjZxKwOm4HGYoVIHQ==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.14.0.tgz", + "integrity": "sha512-ANP0NRPAMehi4bUQsb19kP5W5NVuCYUKRsDC5Nl78xHIu6cskAej1rXkjsocLnWerz2rO0H9kMjRKZj9lVsvKA==", "requires": { "tslib": "^2.3.1" } diff --git a/package.json b/package.json index eb8e732..83030b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-redux", - "version": "1.11.1-rc.0", + "version": "1.12.0", "description": "A library to easily use Split JS SDK with Redux and React Redux", "main": "lib/index.js", "module": "es/index.js", @@ -59,7 +59,7 @@ }, "homepage": "https://github.com/splitio/redux-client#readme", "dependencies": { - "@splitsoftware/splitio": "10.25.2", + "@splitsoftware/splitio": "10.26.0", "tslib": "^2.3.1" }, "devDependencies": { From 714cb7e5848ad7080884d227bf63b9c6af3f3f64 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 8 May 2024 11:39:07 -0300 Subject: [PATCH 4/5] Formatting --- CHANGES.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1c311cf..6e6f7a5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,8 @@ 1.12.0 (May 8, 2024) - Updated @splitsoftware/splitio package to version 10.26.0 that includes minor updates: - - Added support for targeting rules based on semantic versions (https://semver.org/). - - Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment. - - Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints. + - Added support for targeting rules based on semantic versions (https://semver.org/). + - Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment. + - Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints. - Bugfixing - Fixed error when calling `selectTreatmentValue` and `selectTreatmentWithConfig` selectors with an object as a key, caused by the key being stringified rather than using the `matchingKey` property of the object. 1.11.0 (April 3, 2024) From 709aadaf1a15ab92a09e62d34cbe67db32fdcf12 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Fri, 10 May 2024 11:35:11 -0300 Subject: [PATCH 5/5] Update changelog entry date --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6e6f7a5..926feea 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,4 @@ -1.12.0 (May 8, 2024) +1.12.0 (May 10, 2024) - Updated @splitsoftware/splitio package to version 10.26.0 that includes minor updates: - Added support for targeting rules based on semantic versions (https://semver.org/). - Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment.