Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aed6c3d

Browse files
Merge pull request #873 from splitio/development
Release v11.3.0
2 parents 976509a + 53e0740 commit aed6c3d

File tree

7 files changed

+151
-109
lines changed

7 files changed

+151
-109
lines changed

.github/workflows/sonar-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fetch-depth: 0
2121

2222
- name: Set up Node.js
23-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2424
with:
2525
node-version: 'lts/*'
2626
cache: 'npm'

CHANGES.txt

Lines changed: 74 additions & 66 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 17 additions & 15 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",
3-
"version": "11.2.0",
3+
"version": "11.3.0",
44
"description": "Split SDK",
55
"files": [
66
"README.md",
@@ -38,7 +38,7 @@
3838
"node": ">=14.0.0"
3939
},
4040
"dependencies": {
41-
"@splitsoftware/splitio-commons": "2.2.0",
41+
"@splitsoftware/splitio-commons": "2.3.0",
4242
"bloom-filters": "^3.0.4",
4343
"ioredis": "^4.28.0",
4444
"js-yaml": "^3.13.1",

src/__tests__/consumer/node_redis.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ tape('Node.js Redis', function (t) {
104104
const client = sdk.client();
105105
const manager = sdk.manager();
106106

107-
/** Evaluation, track and manager methods before SDK_READY */
108-
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.'));
109-
client.getTreatment('other', 'UT_IN_SEGMENT').then(result => assert.equal(result, 'control', 'Evaluations using Redis storage should be control until connection is stablished.'));
107+
/** Evaluation, track and manager methods before SDK_READY (but SDK_READY_FROM_CACHE) */
108+
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.'));
109+
client.getTreatment('other', 'UT_IN_SEGMENT').then(result => assert.equal(result, 'off', 'Evaluations using Redis storage should be control until connection is stablished.'));
110110

111-
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'));
112-
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'));
113-
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'));
111+
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'));
112+
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'));
113+
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'));
114114

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

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

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

688688
const client = sdk.client();
689689

690-
client.getTreatmentsWithConfigByFlagSets('other', ['set_one']).then(result => assert.deepEqual(result, {}, 'Flag sets evaluations using Redis storage should be empty until connection is ready.'));
690+
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.'));
691691

692692
await client.ready();
693693

src/settings/defaults/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const packageVersion = '11.2.0';
1+
export const packageVersion = '11.3.0';

ts-tests/index.ts

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ const attributes: SplitIO.Attributes = {
8484
attr6: [1, 2],
8585
attr7: true
8686
};
87+
const evaluationOptions: SplitIO.EvaluationOptions = {
88+
properties: {
89+
prop1: 1,
90+
prop2: '2',
91+
prop3: true,
92+
prop4: null
93+
}
94+
};
8795
const splitKeyObj: SplitIO.SplitKeyObject = {
8896
matchingKey: 'matchingKey',
8997
bucketingKey: 'bucketingKey'
@@ -254,58 +262,74 @@ promise = SDK.destroy();
254262
// We can call getTreatment with or without a key.
255263
treatment = client.getTreatment(splitKey, 'mySplit');
256264
treatment = browserClient.getTreatment('mySplit');
257-
// Attributes parameter is optional on both signatures.
265+
// Attributes and EvaluationOptions parameters are optional
258266
treatment = client.getTreatment(splitKey, 'mySplit', attributes);
267+
treatment = client.getTreatment(splitKey, 'mySplit', undefined, evaluationOptions);
259268
treatment = browserClient.getTreatment('mySplit', attributes);
269+
treatment = browserClient.getTreatment('mySplit', undefined, evaluationOptions);
260270

261271
// We can call getTreatments with or without a key.
262272
treatments = client.getTreatments(splitKey, ['mySplit']);
263273
treatments = browserClient.getTreatments(['mySplit']);
264-
// Attributes parameter is optional on both signatures.
274+
// Attributes and EvaluationOptions parameters are optional
265275
treatments = client.getTreatments(splitKey, ['mySplit'], attributes);
276+
treatments = client.getTreatments(splitKey, ['mySplit'], undefined, evaluationOptions);
266277
treatments = browserClient.getTreatments(['mySplit'], attributes);
278+
treatments = browserClient.getTreatments(['mySplit'], undefined, evaluationOptions);
267279

268280
// We can call getTreatmentWithConfig with or without a key.
269281
treatmentWithConfig = client.getTreatmentWithConfig(splitKey, 'mySplit');
270282
treatmentWithConfig = browserClient.getTreatmentWithConfig('mySplit');
271-
// Attributes parameter is optional on both signatures.
283+
// Attributes and EvaluationOptions parameters are optional
272284
treatmentWithConfig = client.getTreatmentWithConfig(splitKey, 'mySplit', attributes);
285+
treatmentWithConfig = client.getTreatmentWithConfig(splitKey, 'mySplit', undefined, evaluationOptions);
273286
treatmentWithConfig = browserClient.getTreatmentWithConfig('mySplit', attributes);
287+
treatmentWithConfig = browserClient.getTreatmentWithConfig('mySplit', undefined, evaluationOptions);
274288

275289
// We can call getTreatmentsWithConfig with or without a key.
276290
treatmentsWithConfig = client.getTreatmentsWithConfig(splitKey, ['mySplit']);
277291
treatmentsWithConfig = browserClient.getTreatmentsWithConfig(['mySplit']);
278-
// Attributes parameter is optional on both signatures.
292+
// Attributes and EvaluationOptions parameters are optional
279293
treatmentsWithConfig = client.getTreatmentsWithConfig(splitKey, ['mySplit'], attributes);
294+
treatmentsWithConfig = client.getTreatmentsWithConfig(splitKey, ['mySplit'], undefined, evaluationOptions);
280295
treatmentsWithConfig = browserClient.getTreatmentsWithConfig(['mySplit'], attributes);
296+
treatmentsWithConfig = browserClient.getTreatmentsWithConfig(['mySplit'], undefined, evaluationOptions);
281297

282298
// We can call getTreatmentsByFlagSet with or without a key.
283299
treatments = client.getTreatmentsByFlagSet(splitKey, 'set_a');
284300
treatments = browserClient.getTreatmentsByFlagSet('set_a');
285-
// Attributes parameter is optional.
301+
// Attributes and EvaluationOptions parameters are optional
286302
treatments = client.getTreatmentsByFlagSet(splitKey, 'set_a', attributes);
303+
treatments = client.getTreatmentsByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);
287304
treatments = browserClient.getTreatmentsByFlagSet('set_a', attributes);
305+
treatments = browserClient.getTreatmentsByFlagSet('set_a', undefined, evaluationOptions);
288306

289307
// We can call getTreatmentsByFlagSets with or without a key.
290308
treatments = client.getTreatmentsByFlagSets(splitKey, ['set_a']);
291309
treatments = browserClient.getTreatmentsByFlagSets(['set_a']);
292-
// Attributes parameter is optional.
310+
// Attributes and EvaluationOptions parameters are optional
293311
treatments = client.getTreatmentsByFlagSets(splitKey, ['set_a'], attributes);
312+
treatments = client.getTreatmentsByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);
294313
treatments = browserClient.getTreatmentsByFlagSets(['set_a'], attributes);
314+
treatments = browserClient.getTreatmentsByFlagSets(['set_a'], undefined, evaluationOptions);
295315

296316
// We can call getTreatmentsWithConfigByFlagSet with or without a key.
297317
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a');
298318
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSet('set_a');
299-
// Attributes parameter is optional.
319+
// Attributes and EvaluationOptions parameters are optional
300320
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', attributes);
321+
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);
301322
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSet('set_a', attributes);
323+
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSet('set_a', undefined, evaluationOptions);
302324

303325
// We can call getTreatmentsWithConfigByFlagSets with or without a key.
304326
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a']);
305327
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSets(['set_a']);
306-
// Attributes parameter is optional.
328+
// Attributes and EvaluationOptions parameters are optional
307329
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], attributes);
330+
treatmentsWithConfig = client.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);
308331
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSets(['set_a'], attributes);
332+
treatmentsWithConfig = browserClient.getTreatmentsWithConfigByFlagSets(['set_a'], undefined, evaluationOptions);
309333

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

344368
// We can call getTreatment but always with a key.
345369
asyncTreatment = asyncClient.getTreatment(splitKey, 'mySplit');
346-
// Attributes parameter is optional
370+
// Attributes and EvaluationOptions parameters are optional
347371
asyncTreatment = asyncClient.getTreatment(splitKey, 'mySplit', attributes);
372+
asyncTreatment = asyncClient.getTreatment(splitKey, 'mySplit', undefined, evaluationOptions);
348373

349374
// We can call getTreatments but always with a key.
350375
asyncTreatments = asyncClient.getTreatments(splitKey, ['mySplit']);
351-
// Attributes parameter is optional
376+
// Attributes and EvaluationOptions parameters are optional
352377
asyncTreatments = asyncClient.getTreatments(splitKey, ['mySplit'], attributes);
378+
asyncTreatments = asyncClient.getTreatments(splitKey, ['mySplit'], undefined, evaluationOptions);
353379

354380
// We can call getTreatmentWithConfig but always with a key.
355381
asyncTreatmentWithConfig = asyncClient.getTreatmentWithConfig(splitKey, 'mySplit');
356-
// Attributes parameter is optional
382+
// Attributes and EvaluationOptions parameters are optional
357383
asyncTreatmentWithConfig = asyncClient.getTreatmentWithConfig(splitKey, 'mySplit', attributes);
384+
asyncTreatmentWithConfig = asyncClient.getTreatmentWithConfig(splitKey, 'mySplit', undefined, evaluationOptions);
358385

359386
// We can call getTreatments but always with a key.
360387
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfig(splitKey, ['mySplit']);
361-
// Attributes parameter is optional
388+
// Attributes and EvaluationOptions parameters are optional
362389
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfig(splitKey, ['mySplit'], attributes);
390+
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfig(splitKey, ['mySplit'], undefined, evaluationOptions);
363391

364392
// We can call getTreatmentsByFlagSet
365393
asyncTreatments = asyncClient.getTreatmentsByFlagSet(splitKey, 'set_a');
366-
// Attributes parameter is optional
394+
// Attributes and EvaluationOptions parameters are optional
367395
asyncTreatments = asyncClient.getTreatmentsByFlagSet(splitKey, 'set_a', attributes);
396+
asyncTreatments = asyncClient.getTreatmentsByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);
368397

369398
// We can call getTreatmentsByFlagSets
370399
asyncTreatments = asyncClient.getTreatmentsByFlagSets(splitKey, ['set_a']);
371-
// Attributes parameter is optional
400+
// Attributes and EvaluationOptions parameters are optional
372401
asyncTreatments = asyncClient.getTreatmentsByFlagSets(splitKey, ['set_a'], attributes);
402+
asyncTreatments = asyncClient.getTreatmentsByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);
373403

374404
// We can call getTreatmentsWithConfigByFlagSet
375405
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a');
376-
// Attributes parameter is optional
406+
// Attributes and EvaluationOptions parameters are optional
377407
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', attributes);
408+
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSet(splitKey, 'set_a', undefined, evaluationOptions);
378409

379410
// We can call getTreatmentsByFlagSets but always with a key.
380411
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a']);
381-
// Attributes parameter is optional
412+
// Attributes and EvaluationOptions parameters are optional
382413
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], attributes);
414+
asyncTreatmentsWithConfig = asyncClient.getTreatmentsWithConfigByFlagSets(splitKey, ['set_a'], undefined, evaluationOptions);
383415

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

0 commit comments

Comments
 (0)