Skip to content

Commit a0a95c4

Browse files
Merge branch 'rb_segments_baseline' into rb_segments_test_updates
2 parents 22d56cf + 844c904 commit a0a95c4

File tree

3 files changed

+50
-17
lines changed

3 files changed

+50
-17
lines changed

.github/workflows/sonar-scan.yml

+1-1
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

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- `storage.expirationDays` to specify the validity period of the rollout plan cache in days.
55
- `storage.clearOnInit` to clear the rollout plan cache on SDK initialization.
66
- Updated SDK_READY_FROM_CACHE event when using the `LOCALSTORAGE` storage type to be emitted alongside the SDK_READY event if it has not already been emitted.
7+
- Updated @splitsoftware/splitio-commons package to version 2.2.0.
78

89
11.1.0 (January 17, 2025)
910
- Added support for the new impressions tracking toggle available on feature flags, both respecting the setting and including the new field being returned on `SplitView` type objects. Read more in our docs.

ts-tests/index.ts

+48-16
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)