Skip to content

Release v11.3.0 #873

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

Merged
merged 13 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
Expand Down
140 changes: 74 additions & 66 deletions CHANGES.txt

Large diffs are not rendered by default.

32 changes: 17 additions & 15 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",
"version": "11.2.0",
"version": "11.3.0",
"description": "Split SDK",
"files": [
"README.md",
Expand Down Expand Up @@ -38,7 +38,7 @@
"node": ">=14.0.0"
},
"dependencies": {
"@splitsoftware/splitio-commons": "2.2.0",
"@splitsoftware/splitio-commons": "2.3.0",
"bloom-filters": "^3.0.4",
"ioredis": "^4.28.0",
"js-yaml": "^3.13.1",
Expand Down
16 changes: 8 additions & 8 deletions src/__tests__/consumer/node_redis.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ tape('Node.js Redis', function (t) {
const client = sdk.client();
const manager = sdk.manager();

/** Evaluation, track and manager methods before SDK_READY */
client.getTreatment('UT_Segment_member', 'UT_IN_SEGMENT').then(result => assert.equal(result, 'control', 'Evaluations using Redis storage should be control until connection is stablished.'));
client.getTreatment('other', 'UT_IN_SEGMENT').then(result => assert.equal(result, 'control', 'Evaluations using Redis storage should be control until connection is stablished.'));
/** Evaluation, track and manager methods before SDK_READY (but SDK_READY_FROM_CACHE) */
client.getTreatment('UT_Segment_member', 'UT_IN_SEGMENT').then(result => assert.equal(result, 'on', 'Evaluations using Redis storage should be control until connection is stablished.'));
client.getTreatment('other', 'UT_IN_SEGMENT').then(result => assert.equal(result, 'off', 'Evaluations using Redis storage should be control until connection is stablished.'));

manager.names().then((result) => assert.deepEqual(result, [], 'manager `names` method returns an empty list of split names if called before SDK_READY or Redis operation fail'));
manager.split(expectedSplitName).then((result) => assert.deepEqual(result, null, 'manager `split` method returns a null split view if called before SDK_READY or Redis operation fail'));
manager.splits().then((result) => assert.deepEqual(result, [], 'manager `splits` method returns an empty list of split views if called before SDK_READY or Redis operation fail'));
manager.names().then((result) => assert.equal(result.length, 26, 'manager `names` method returns an empty list of split names if called before SDK_READY or Redis operation fail'));
manager.split(expectedSplitName).then((result) => assert.deepEqual(result, expectedSplitView, 'manager `split` method returns a null split view if called before SDK_READY or Redis operation fail'));
manager.splits().then((result) => assert.equal(result.length, 26, 'manager `splits` method returns an empty list of split views if called before SDK_READY or Redis operation fail'));

client.track('[email protected]', 'user', 'before.ready', 18).then((result) => assert.true(result, 'Redis adapter queue "rpush" operations until it is ready.'));

Expand Down Expand Up @@ -453,7 +453,7 @@ tape('Node.js Redis', function (t) {
assert.plan(18);

client.getTreatment('UT_Segment_member', 'always-on').then(treatment => {
assert.equal(treatment, 'control', 'Evaluations using Redis storage should be control until Redis connection is stablished.');
assert.equal(treatment, 'on', 'Evaluations using Redis storage should be control until Redis connection is stablished.');
});
client.track('[email protected]', 'user', 'test.redis.event', 18).then(result => {
assert.true(result, 'If the event was successfully queued the promise will resolve to true once Redis connection is stablished');
Expand Down Expand Up @@ -687,7 +687,7 @@ tape('Node.js Redis', function (t) {

const client = sdk.client();

client.getTreatmentsWithConfigByFlagSets('other', ['set_one']).then(result => assert.deepEqual(result, {}, 'Flag sets evaluations using Redis storage should be empty until connection is ready.'));
client.getTreatmentsWithConfigByFlagSets('other', ['set_one']).then(result => assert.deepEqual(result, { 'always-on': { treatment: 'on', config: null }, 'always-off': { treatment: 'off', config: null } }, 'Flag sets evaluations using Redis storage should be empty until connection is ready.'));

await client.ready();

Expand Down
2 changes: 1 addition & 1 deletion src/settings/defaults/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const packageVersion = '11.2.0';
export const packageVersion = '11.3.0';
64 changes: 48 additions & 16 deletions ts-tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ const attributes: SplitIO.Attributes = {
attr6: [1, 2],
attr7: true
};
const evaluationOptions: SplitIO.EvaluationOptions = {
properties: {
prop1: 1,
prop2: '2',
prop3: true,
prop4: null
}
};
const splitKeyObj: SplitIO.SplitKeyObject = {
matchingKey: 'matchingKey',
bucketingKey: 'bucketingKey'
Expand Down Expand Up @@ -254,58 +262,74 @@ promise = SDK.destroy();
// We can call getTreatment with or without a key.
treatment = client.getTreatment(splitKey, 'mySplit');
treatment = browserClient.getTreatment('mySplit');
// Attributes parameter is optional on both signatures.
// Attributes and EvaluationOptions parameters are optional
treatment = client.getTreatment(splitKey, 'mySplit', attributes);
treatment = client.getTreatment(splitKey, 'mySplit', undefined, evaluationOptions);
treatment = browserClient.getTreatment('mySplit', attributes);
treatment = browserClient.getTreatment('mySplit', undefined, evaluationOptions);

// We can call getTreatments with or without a key.
treatments = client.getTreatments(splitKey, ['mySplit']);
treatments = browserClient.getTreatments(['mySplit']);
// Attributes parameter is optional on both signatures.
// Attributes and EvaluationOptions parameters are optional
treatments = client.getTreatments(splitKey, ['mySplit'], attributes);
treatments = client.getTreatments(splitKey, ['mySplit'], undefined, evaluationOptions);
treatments = browserClient.getTreatments(['mySplit'], attributes);
treatments = browserClient.getTreatments(['mySplit'], undefined, evaluationOptions);

// We can call getTreatmentWithConfig with or without a key.
treatmentWithConfig = client.getTreatmentWithConfig(splitKey, 'mySplit');
treatmentWithConfig = browserClient.getTreatmentWithConfig('mySplit');
// Attributes parameter is optional on both signatures.
// Attributes and EvaluationOptions parameters are optional
treatmentWithConfig = client.getTreatmentWithConfig(splitKey, 'mySplit', attributes);
treatmentWithConfig = client.getTreatmentWithConfig(splitKey, 'mySplit', undefined, evaluationOptions);
treatmentWithConfig = browserClient.getTreatmentWithConfig('mySplit', attributes);
treatmentWithConfig = browserClient.getTreatmentWithConfig('mySplit', undefined, evaluationOptions);

// We can call getTreatmentsWithConfig with or without a key.
treatmentsWithConfig = client.getTreatmentsWithConfig(splitKey, ['mySplit']);
treatmentsWithConfig = browserClient.getTreatmentsWithConfig(['mySplit']);
// Attributes parameter is optional on both signatures.
// Attributes and EvaluationOptions parameters are optional
treatmentsWithConfig = client.getTreatmentsWithConfig(splitKey, ['mySplit'], attributes);
treatmentsWithConfig = client.getTreatmentsWithConfig(splitKey, ['mySplit'], undefined, evaluationOptions);
treatmentsWithConfig = browserClient.getTreatmentsWithConfig(['mySplit'], attributes);
treatmentsWithConfig = browserClient.getTreatmentsWithConfig(['mySplit'], undefined, evaluationOptions);

// We can call getTreatmentsByFlagSet with or without a key.
treatments = client.getTreatmentsByFlagSet(splitKey, 'set_a');
treatments = browserClient.getTreatmentsByFlagSet('set_a');
// Attributes parameter is optional.
// Attributes and EvaluationOptions parameters are optional
treatments = client.getTreatmentsByFlagSet(splitKey, 'set_a', attributes);
treatments = client.getTreatmentsByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);
treatments = browserClient.getTreatmentsByFlagSet('set_a', attributes);
treatments = browserClient.getTreatmentsByFlagSet('set_a', undefined, evaluationOptions);

// We can call getTreatmentsByFlagSets with or without a key.
treatments = client.getTreatmentsByFlagSets(splitKey, ['set_a']);
treatments = browserClient.getTreatmentsByFlagSets(['set_a']);
// Attributes parameter is optional.
// Attributes and EvaluationOptions parameters are optional
treatments = client.getTreatmentsByFlagSets(splitKey, ['set_a'], attributes);
treatments = client.getTreatmentsByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);
treatments = browserClient.getTreatmentsByFlagSets(['set_a'], attributes);
treatments = browserClient.getTreatmentsByFlagSets(['set_a'], undefined, evaluationOptions);

// We can call getTreatmentsWithConfigByFlagSet with or without a key.
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a');
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSet('set_a');
// Attributes parameter is optional.
// Attributes and EvaluationOptions parameters are optional
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', attributes);
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSet('set_a', attributes);
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSet('set_a', undefined, evaluationOptions);

// We can call getTreatmentsWithConfigByFlagSets with or without a key.
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a']);
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSets(['set_a']);
// Attributes parameter is optional.
// Attributes and EvaluationOptions parameters are optional
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], attributes);
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSets(['set_a'], attributes);
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSets(['set_a'], undefined, evaluationOptions);

// We can call track with or without a key.
tracked = client.track(splitKey, 'myTrafficType', 'myEventType'); // all params
Expand Down Expand Up @@ -343,43 +367,51 @@ promise = AsyncSDK.destroy();

// We can call getTreatment but always with a key.
asyncTreatment = asyncClient.getTreatment(splitKey, 'mySplit');
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatment = asyncClient.getTreatment(splitKey, 'mySplit', attributes);
asyncTreatment = asyncClient.getTreatment(splitKey, 'mySplit', undefined, evaluationOptions);

// We can call getTreatments but always with a key.
asyncTreatments = asyncClient.getTreatments(splitKey, ['mySplit']);
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatments = asyncClient.getTreatments(splitKey, ['mySplit'], attributes);
asyncTreatments = asyncClient.getTreatments(splitKey, ['mySplit'], undefined, evaluationOptions);

// We can call getTreatmentWithConfig but always with a key.
asyncTreatmentWithConfig = asyncClient.getTreatmentWithConfig(splitKey, 'mySplit');
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatmentWithConfig = asyncClient.getTreatmentWithConfig(splitKey, 'mySplit', attributes);
asyncTreatmentWithConfig = asyncClient.getTreatmentWithConfig(splitKey, 'mySplit', undefined, evaluationOptions);

// We can call getTreatments but always with a key.
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfig(splitKey, ['mySplit']);
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfig(splitKey, ['mySplit'], attributes);
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfig(splitKey, ['mySplit'], undefined, evaluationOptions);

// We can call getTreatmentsByFlagSet
asyncTreatments = asyncClient.getTreatmentsByFlagSet(splitKey, 'set_a');
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatments = asyncClient.getTreatmentsByFlagSet(splitKey, 'set_a', attributes);
asyncTreatments = asyncClient.getTreatmentsByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);

// We can call getTreatmentsByFlagSets
asyncTreatments = asyncClient.getTreatmentsByFlagSets(splitKey, ['set_a']);
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatments = asyncClient.getTreatmentsByFlagSets(splitKey, ['set_a'], attributes);
asyncTreatments = asyncClient.getTreatmentsByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);

// We can call getTreatmentsWithConfigByFlagSet
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a');
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', attributes);
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);

// We can call getTreatmentsByFlagSets but always with a key.
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a']);
// Attributes parameter is optional
// Attributes and EvaluationOptions parameters are optional
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], attributes);
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);

// We can call track only with a key.
trackPromise = asyncClient.track(splitKey, 'myTrafficType', 'myEventType'); // all required params
Expand Down
Loading