Skip to content

Commit abaa604

Browse files
Merge pull request #20 from splitio/fme-12878
Fme 12878
2 parents 94447df + 32137c5 commit abaa604

18 files changed

+1548
-902
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ dist
105105
.tern-port
106106

107107
# Build output
108-
es/
109-
lib/
110-
types/
108+
/es/
109+
/lib/
110+
/types/

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.3.0 (March 2, 2026)
2+
- Updated ConfigurationChanged event to forward SDK_UPDATE metadata from Split (flagsChanged, metadata with type and names)
3+
- Requires @splitsoftware/splitio ^11.10.0 for SDK_UPDATE metadata support
4+
15
1.2.0 (November 7, 2025)
26
- Updated @openfeature/server-sdk to 1.20.0
37
- Updated @splitsoftware/splitio to 11.8.0

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ const OpenFeatureSplitProvider = require('@splitsoftware/openfeature-js-split-pr
3030

3131
const authorizationKey = 'your auth key'
3232
const provider = new OpenFeatureSplitProvider(authorizationKey);
33-
OpenFeature.setProvider(provider);
33+
await OpenFeature.setProviderAndWait(provider);
34+
const client = OpenFeature.getClient('my-app');
35+
// safe to evaluate
3436
```
3537

3638
### Register the Split provider with OpenFeature using splitFactory
@@ -42,7 +44,9 @@ const OpenFeatureSplitProvider = require('@splitsoftware/openfeature-js-split-pr
4244
const authorizationKey = 'your auth key'
4345
const splitFactory = SplitFactory({core: {authorizationKey}});
4446
const provider = new OpenFeatureSplitProvider(splitFactory);
45-
OpenFeature.setProvider(provider);
47+
await OpenFeature.setProviderAndWait(provider);
48+
const client = OpenFeature.getClient('my-app');
49+
// safe to evaluate
4650
```
4751

4852
### Register the Split provider with OpenFeature using splitClient
@@ -54,7 +58,9 @@ const OpenFeatureSplitProvider = require('@splitsoftware/openfeature-js-split-pr
5458
const authorizationKey = 'your auth key'
5559
const splitClient = SplitFactory({core: {authorizationKey}}).client();
5660
const provider = new OpenFeatureSplitProvider({splitClient});
57-
OpenFeature.setProvider(provider);
61+
await OpenFeature.setProviderAndWait(provider);
62+
const client = OpenFeature.getClient('my-app');
63+
// safe to evaluate
5864
```
5965

6066
## Use of OpenFeature with Split
@@ -94,6 +100,22 @@ const booleanTreatment = await client.getBooleanDetails('boolFlag', false, conte
94100
const config = booleanTreatment.flagMetadata.config
95101
```
96102

103+
## Configuration changed event (SDK_UPDATE)
104+
105+
When the Split SDK emits the `SDK_UPDATE` **event** (flags or segments changed), the provider emits OpenFeature’s `ConfigurationChanged` and forwards the event metadata. The metadata shape matches [javascript-commons SdkUpdateMetadata](https://github.com/splitio/javascript-commons): `type` is `'FLAGS_UPDATE' | 'SEGMENTS_UPDATE'` and `names` is the list of flag or segment names that were updated. Handlers receive [Provider Event Details](https://openfeature.dev/specification/types#provider-event-details): `flagsChanged` (when `type === 'FLAGS_UPDATE'`, the `names` array) and `metadata` (`type` as string).
106+
107+
Requires `@splitsoftware/splitio` **11.10.0 or later** (metadata was added in 11.10.0).
108+
109+
```js
110+
const { OpenFeature, ProviderEvents } = require('@openfeature/server-sdk');
111+
112+
const client = OpenFeature.getClient();
113+
client.addHandler(ProviderEvents.ConfigurationChanged, (eventDetails) => {
114+
console.log('Flags changed:', eventDetails.flagsChanged);
115+
console.log('Event metadata:', eventDetails.metadata);
116+
});
117+
```
118+
97119
## Tracking
98120

99121
To use track(eventName, context, details) you must provide:

0 commit comments

Comments
 (0)