Skip to content
Open
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
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ dist
.tern-port

# Build output
es/
lib/
types/
/es/
/lib/
/types/
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.3.0 (February 12, 2026)
- ConfigurationChanged event now forwards SDK_UPDATE metadata from Split (flagsChanged, metadata with type and names)
- Requires @splitsoftware/splitio ^11.10.0 for SDK_UPDATE metadata support

1.2.0 (November 7, 2025)
- Updated @openfeature/server-sdk to 1.20.0
- Updated @splitsoftware/splitio to 11.8.0
Expand Down
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const OpenFeatureSplitProvider = require('@splitsoftware/openfeature-js-split-pr

const authorizationKey = 'your auth key'
const provider = new OpenFeatureSplitProvider(authorizationKey);
OpenFeature.setProvider(provider);
await OpenFeature.setProviderAndWait(provider);
const client = OpenFeature.getClient('my-app');
// safe to evaluate
```

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

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

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

## Configuration changed event (SDK_UPDATE)

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).

Requires `@splitsoftware/splitio` **11.10.0 or later** (metadata was added in 11.10.0).

```js
const { OpenFeature, ProviderEvents } = require('@openfeature/server-sdk');

const client = OpenFeature.getClient();
client.addHandler(ProviderEvents.ConfigurationChanged, (eventDetails) => {
console.log('Flags changed:', eventDetails.flagsChanged);
console.log('Event metadata:', eventDetails.metadata);
});
```

## Tracking

To use track(eventName, context, details) you must provide:
Expand Down
Loading