55This Provider is designed to allow the use of OpenFeature with Split, the platform for controlled rollouts, serving features to your users via the Split feature flag to manage your complete customer experience.
66
77## Compatibility
8+ It supports ** Node.js version 14.x or later** .
89
910
1011## Getting started
@@ -19,19 +20,41 @@ npm install @splitsoftware/openfeature-js-split-provider
1920### Confirm peer dependencies are installed
2021``` sh
2122npm install @splitsoftware/splitio
22- npm install @openfeature/js -sdk
23+ npm install @openfeature/server -sdk
2324```
2425
25- ### Register the Split provider with OpenFeature
26+ ### Register the Split provider with OpenFeature using sdk apiKey
2627``` js
27- const OpenFeature = require (' @openfeature/js-sdk' ).OpenFeature ;
28+ const OpenFeature = require (' @openfeature/server-sdk' ).OpenFeature ;
29+ const OpenFeatureSplitProvider = require (' @splitsoftware/openfeature-js-split-provider' ).OpenFeatureSplitProvider ;
30+
31+ const authorizationKey = ' your auth key'
32+ const provider = new OpenFeatureSplitProvider (authorizationKey);
33+ OpenFeature .setProvider (provider);
34+ ```
35+
36+ ### Register the Split provider with OpenFeature using splitFactory
37+ ``` js
38+ const OpenFeature = require (' @openfeature/server-sdk' ).OpenFeature ;
39+ const SplitFactory = require (' @splitsoftware/splitio' ).SplitFactory ;
40+ const OpenFeatureSplitProvider = require (' @splitsoftware/openfeature-js-split-provider' ).OpenFeatureSplitProvider ;
41+
42+ const authorizationKey = ' your auth key'
43+ const splitFactory = SplitFactory ({core: {authorizationKey}});
44+ const provider = new OpenFeatureSplitProvider (splitFactory);
45+ OpenFeature .setProvider (provider);
46+ ```
47+
48+ ### Register the Split provider with OpenFeature using splitClient
49+ ``` js
50+ const OpenFeature = require (' @openfeature/server-sdk' ).OpenFeature ;
2851const SplitFactory = require (' @splitsoftware/splitio' ).SplitFactory ;
2952const OpenFeatureSplitProvider = require (' @splitsoftware/openfeature-js-split-provider' ).OpenFeatureSplitProvider ;
3053
3154const authorizationKey = ' your auth key'
3255const splitClient = SplitFactory ({core: {authorizationKey}}).client ();
3356const provider = new OpenFeatureSplitProvider ({splitClient});
34- openFeature .setProvider (provider);
57+ OpenFeature .setProvider (provider);
3558```
3659
3760## Use of OpenFeature with Split
@@ -59,9 +82,40 @@ const context: EvaluationContext = {
5982 targetingKey: ' TARGETING_KEY' ,
6083};
6184OpenFeatureAPI .getInstance ().setCtx (context)
62- ````
85+ ```
6386If the context was set at the client or api level, it is not required to provide it during flag evaluation.
6487
88+ ## Evaluate with details
89+ Use the get* Details(...) APIs to get the value and rich context (variant, reason, error code, metadata). This provider includes the Split treatment config as a raw JSON string under flagMetadata[ "config"]
90+
91+ ``` js
92+ const booleanTreatment = await client .getBooleanDetails (' boolFlag' , false , context);
93+
94+ const config = booleanTreatment .flagMetadata .config
95+ ```
96+
97+ ## Tracking
98+
99+ To use track(eventName, context, details) you must provide:
100+
101+ - A non-blank ` eventName ` .
102+ - A context with:
103+ - ` targetingKey ` (non-blank).
104+ - ` trafficType ` (string, e.g. "user" or "account").
105+
106+ Optional:
107+
108+ - details with:
109+ - ` value ` : numeric event value (defaults to 0).
110+ - ` properties ` : map of attributes (prefer primitives: string/number/boolean/null).
111+
112+ Example:
113+ ``` js
114+ const context = { targetingKey: ' user-123' , trafficType: ' account' }
115+ const details = { value: 19.99 , plan: ' pro' , coupon: ' WELCOME10' }
116+
117+ client .track (' checkout.completed' , context, details)
118+ ```
65119## Submitting issues
66120
67121The Split team monitors all issues submitted to this [ issue tracker] ( https://github.com/splitio/split-openfeature-provider-nodejs/issues ) . We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.
@@ -80,16 +134,24 @@ To learn more about Split, contact
[email protected] , or get started with feature f
80134
81135Split has built and maintains SDKs for:
82136
83- * Java [Github](https: // github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
84- * Javascript [Github](https: // github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
85- * Node [Github](https: // github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
86137* .NET [ Github] ( https://github.com/splitio/dotnet-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020240172--NET-SDK )
87- * Ruby [Github](https: // github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
88- * PHP [Github](https: // github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
89- * Python [Github](https: // github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
90- * GO [Github](https: // github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
91138* Android [ Github] ( https://github.com/splitio/android-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020343291-Android-SDK )
139+ * Angular [ Github] ( https://github.com/splitio/angular-sdk-plugin ) [ Docs] ( https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities )
140+ * Elixir thin-client [ Github] ( https://github.com/splitio/elixir-thin-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/26988707417869-Elixir-Thin-Client-SDK )
141+ * Flutter [ Github] ( https://github.com/splitio/flutter-sdk-plugin ) [ Docs] ( https://help.split.io/hc/en-us/articles/8096158017165-Flutter-plugin )
142+ * GO [ Github] ( https://github.com/splitio/go-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020093652-Go-SDK )
92143* iOS [ Github] ( https://github.com/splitio/ios-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK )
144+ * Java [ Github] ( https://github.com/splitio/java-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020405151-Java-SDK )
145+ * JavaScript [ Github] ( https://github.com/splitio/javascript-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK )
146+ * JavaScript for Browser [ Github] ( https://github.com/splitio/javascript-browser-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK )
147+ * Node.js [ Github] ( https://github.com/splitio/javascript-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK )
148+ * PHP [ Github] ( https://github.com/splitio/php-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK )
149+ * PHP thin-client [ Github] ( https://github.com/splitio/php-thin-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/18305128673933-PHP-Thin-Client-SDK )
150+ * Python [ Github] ( https://github.com/splitio/python-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020359652-Python-SDK )
151+ * React [ Github] ( https://github.com/splitio/react-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360038825091-React-SDK )
152+ * React Native [ Github] ( https://github.com/splitio/react-native-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK )
153+ * Redux [ Github] ( https://github.com/splitio/redux-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK )
154+ * Ruby [ Github] ( https://github.com/splitio/ruby-client ) [ Docs] ( https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK )
93155
94156For a comprehensive list of open source projects visit our [ Github page] ( https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20 ) .
95157
0 commit comments