Skip to content

Commit 9084085

Browse files
Merge pull request #13 from splitio/add-lint
Add lint
2 parents 420c7f1 + e344782 commit 9084085

File tree

11 files changed

+1717
-371
lines changed

11 files changed

+1717
-371
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ jobs:
2525
- name: npm ci
2626
run: npm ci
2727

28+
- name: npm check
29+
run: npm run check
30+
2831
- name: npm test
2932
run: npm run test

CHANGES.txt

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1+
1.2.0 (September 9, 2025)
2+
- Up to date with @openfeature/server-sdk 1.19.0
3+
- Added tracking support
4+
- Added “evaluate with details” support
5+
16
1.1.0 (June 16, 2025)
2-
- Uses renamed @openfeature/js-sdk to @openfeature/server-sdk
3-
- Up to date with spec 0.8.0 and @openfeature/server-sdk 1.18.0
4-
- Uses split sdk 11.4.0
7+
- Uses renamed @openfeature/js-sdk to @openfeature/server-sdk
8+
- Up to date with spec 0.8.0 and @openfeature/server-sdk 1.18.0
9+
- Uses split sdk 11.4.0
10+
511
1.0.4
6-
- Fixes issue with TS build
7-
- Up to date with spec 0.5.0 and @openfeature/js-sdk 0.5.0
12+
- Fixes issue with TS build
13+
- Up to date with spec 0.5.0 and @openfeature/js-sdk 0.5.0
14+
815
1.0.3
9-
- Adds types definitions for TypeScript
10-
- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0
16+
- Adds types definitions for TypeScript
17+
- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0
18+
1119
1.0.2
12-
- Changes name from Node-specific implementation to generic JSON
13-
- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0
20+
- Changes name from Node-specific implementation to generic JSON
21+
- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0
22+
1423
1.0.1
15-
- Fixes issues with flag details and error codes in negative cases, adds unit tests
16-
- Up to date with spec 0.4.0 and @openfeature/nodejs-sdk v0.3.2
24+
- Fixes issues with flag details and error codes in negative cases, adds unit tests
25+
- Up to date with spec 0.4.0 and @openfeature/nodejs-sdk v0.3.2
26+
1727
1.0.0
18-
- First release. Up to date with spec 0.4.0, and @openfeature/nodejs-sdk v0.2.0
28+
- First release. Up to date with spec 0.4.0, and @openfeature/nodejs-sdk v0.2.0

README.md

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This 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
@@ -59,9 +60,40 @@ const context: EvaluationContext = {
5960
targetingKey: 'TARGETING_KEY',
6061
};
6162
OpenFeatureAPI.getInstance().setCtx(context)
62-
````
63+
```
6364
If the context was set at the client or api level, it is not required to provide it during flag evaluation.
6465

66+
## Evaluate with details
67+
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"]
68+
69+
```js
70+
const booleanTreatment = await client.getBooleanDetails('boolFlag', false, context);
71+
72+
const config = booleanTreatment.flagMetadata.config
73+
```
74+
75+
## Tracking
76+
77+
To use track(eventName, context, details) you must provide:
78+
79+
- A non-blank `eventName`.
80+
- A context with:
81+
- `targetingKey` (non-blank).
82+
- `trafficType` (string, e.g. "user" or "account").
83+
84+
Optional:
85+
86+
- details with:
87+
- `value`: numeric event value (defaults to 0).
88+
- `properties`: map of attributes (prefer primitives: string/number/boolean/null).
89+
90+
Example:
91+
```js
92+
const context = { targetingKey: 'user-123', trafficType: 'account' }
93+
const details = { value: 19.99, plan: 'pro', coupon: 'WELCOME10' }
94+
95+
client.track('checkout.completed', context, details)
96+
```
6597
## Submitting issues
6698

6799
The 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 +112,24 @@ To learn more about Split, contact [email protected], or get started with feature f
80112

81113
Split has built and maintains SDKs for:
82114

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)
86115
* .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)
91116
* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
117+
* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
118+
* 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)
119+
* Flutter [Github](https://github.com/splitio/flutter-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/8096158017165-Flutter-plugin)
120+
* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
92121
* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
122+
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
123+
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
124+
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
125+
* Node.js [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
126+
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
127+
* 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)
128+
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
129+
* React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
130+
* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
131+
* Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK)
132+
* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
93133

94134
For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
95135

eslint.config.mts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import tseslint from "typescript-eslint";
4+
import { defineConfig } from "eslint/config";
5+
import jestPlugin from 'eslint-plugin-jest';
6+
7+
8+
export default defineConfig([
9+
{
10+
files: ["**/*.{js,ts}"],
11+
plugins: { js },
12+
extends: ["js/recommended"],
13+
languageOptions: {
14+
globals: globals.browser
15+
}
16+
},
17+
{
18+
files: ['**/*.{test,spec}.{js,ts,jsx,tsx}', '**/__tests__/**/*.{js,ts,jsx,tsx}'],
19+
plugins: { jest: jestPlugin },
20+
rules: {
21+
...jestPlugin.configs.recommended.rules,
22+
},
23+
languageOptions: {
24+
globals: {
25+
...globals.jest,
26+
},
27+
},
28+
},
29+
tseslint.configs.recommended,
30+
]);

0 commit comments

Comments
 (0)