You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGES.txt
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,7 @@
1
+
1.7.0 (January 28, 2026)
2
+
- Updated @splitsoftware/splitio-commons package to version 2.11.0, which:
3
+
- Added functionality to provide metadata alongside SDK update and READY events. Read more in our docs.
4
+
1
5
1.6.1 (December 30, 2025)
2
6
- Updated @splitsoftware/splitio-commons package to version 2.10.1 and other transitive dependencies for vulnerability fixes.
3
7
- Updated the order of storage operations to prevent inconsistent states when using the `InLocalStorage` module and the browser’s `localStorage` fails due to quota limits.
t.true(Date.now()-startTime<400,'It should emit SDK_READY_FROM_CACHE on every client if there was data in the cache and we subscribe on time. Should be considerably faster than actual readiness from the cloud.');
335
335
t.equal(client.getTreatment('always_on'),'off','It should evaluate treatments with data from cache instead of control due to Input Validation');
336
+
// SdkReadyMetadata: when ready from cache, initialCacheLoad is false; lastUpdateTimestamp is number or undefined
337
+
t.true(metadata!=null&&typeofmetadata.initialCacheLoad==='boolean','SDK_READY_FROM_CACHE must receive SdkReadyMetadata with initialCacheLoad');
338
+
t.true(metadata.initialCacheLoad===false,'When ready from existing cache, initialCacheLoad must be false');
339
+
t.true(metadata.lastUpdateTimestamp===undefined||typeofmetadata.lastUpdateTimestamp==='number','SdkReadyMetadata.lastUpdateTimestamp must be number or undefined');
336
340
337
341
constclient4=splitio.client('nicolas4@split.io');
338
342
t.equal(client4.getTreatment('always_on'),'off','It should evaluate treatments with data from cache instead of control');
@@ -350,9 +354,10 @@ export default function (fetchMock, assert) {
350
354
t.equal(client3.getTreatment('always_on'),'off','It should evaluate treatments with data from cache instead of control due to Input Validation');
351
355
});
352
356
353
-
client.on(client.Event.SDK_READY,()=>{
357
+
client.on(client.Event.SDK_READY,(metadata)=>{
354
358
t.true(Date.now()-startTime>=400,'It should emit SDK_READY too but after syncing with the cloud.');
355
359
t.equal(client.getTreatment('always_on'),'on','It should evaluate treatments with updated data after syncing with the cloud.');
360
+
t.true(metadata!=null&&typeofmetadata.initialCacheLoad==='boolean','SDK_READY must receive SdkReadyMetadata with initialCacheLoad');
356
361
});
357
362
client.ready().then(()=>{
358
363
t.true(Date.now()-startTime>=400,'It should resolve ready promise after syncing with the cloud.');
Copy file name to clipboardExpand all lines: src/__tests__/browserSuites/ready-promise.spec.js
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,9 @@ export default function readyPromiseAssertions(fetchMock, assert) {
119
119
constmanager=splitio.manager();
120
120
121
121
manager.whenReady()
122
-
.then(()=>{
122
+
.then((metadata)=>{
123
+
t.true(metadata!=null&&typeofmetadata.initialCacheLoad==='boolean','whenReady must resolve with SdkReadyMetadata.initialCacheLoad');
124
+
t.true(metadata.lastUpdateTimestamp===undefined||typeofmetadata.lastUpdateTimestamp==='number','whenReady SdkReadyMetadata.lastUpdateTimestamp must be number or undefined');
123
125
t.pass('### SDK IS READY - the retry request is under the limits.');
124
126
assertGetTreatmentWhenReady(t,client);
125
127
@@ -521,7 +523,10 @@ export default function readyPromiseAssertions(fetchMock, assert) {
521
523
522
524
consoleSpy.log.resetHistory();
523
525
setTimeout(()=>{
524
-
client.whenReadyFromCache().then((isReady)=>t.true(isReady,'SDK IS READY (& READY FROM CACHE) - Should resolve')).catch(()=>t.fail('SDK TIMED OUT - Should not reject'));
526
+
client.whenReadyFromCache().then((metadata)=>{
527
+
t.true(metadata!=null&&typeofmetadata.initialCacheLoad==='boolean','whenReadyFromCache must resolve with SdkReadyMetadata');
528
+
t.true(metadata.lastUpdateTimestamp===undefined||typeofmetadata.lastUpdateTimestamp==='number','whenReadyFromCache SdkReadyMetadata.lastUpdateTimestamp must be number or undefined');
529
+
}).catch(()=>t.fail('SDK TIMED OUT - Should not reject'));
assert.true(metadata!=null&&typeofmetadata.type==='string'&&['FLAGS_UPDATE','SEGMENTS_UPDATE'].includes(metadata.type),'SDK_UPDATE must receive SdkUpdateMetadata with type FLAGS_UPDATE or SEGMENTS_UPDATE');
113
+
assert.true(Array.isArray(metadata.names),'SDK_UPDATE must receive SdkUpdateMetadata with names array');
111
114
updateCount++;
112
115
});
113
116
client.on(client.Event.SDK_READY_TIMED_OUT,()=>{
@@ -252,8 +255,10 @@ tape('Browser offline mode', function (assert) {
assert.true((Date.now()-readyTimestamp)>1000,'Should only emit SDK_UPDATE after a real update.');
260
+
assert.true(metadata!=null&&typeofmetadata.type==='string'&&['FLAGS_UPDATE','SEGMENTS_UPDATE'].includes(metadata.type),'SDK_UPDATE must receive SdkUpdateMetadata with type');
261
+
assert.true(Array.isArray(metadata.names),'SDK_UPDATE must receive SdkUpdateMetadata with names array');
257
262
258
263
client.once(client.Event.SDK_UPDATE,function(){assert.fail('Should not emit a second SDK_UPDATE event');});
0 commit comments