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
feat(openfeature-node-provider): improve flag resolution and context handling (#318)
- Enhanced flag resolution methods with more robust error handling
- Added support for more context attributes in context translator
- Improved type checking and resolution for different flag types
- Updated README with more detailed usage and resolution method
explanations
- Bumped node-sdk dependency to 1.6.0-alpha.3
The provider uses the [Bucket Node.js SDK](https://docs.bucket.co/quickstart/supported-languages-frameworks/node.js-sdk).
26
-
27
24
The available options can be found in the [Bucket Node.js SDK](https://github.com/bucketco/bucket-javascript-sdk/tree/main/packages/node-sdk#initialization-options).
The Bucket OpenFeature Provider implements the OpenFeature evaluation interface for different value types. Each method handles the resolution of feature flags according to the OpenFeature specification.
59
+
60
+
### Common behavior
61
+
62
+
All resolution methods share these behaviors:
63
+
64
+
- Return default value with `PROVIDER_NOT_READY` if client is not initialized,
65
+
- Return default value with `FLAG_NOT_FOUND` if flag doesn't exist,
66
+
- Return default value with `ERROR` if there was a type mismatch,
67
+
- Return evaluated value with `TARGETING_MATCH` on successful resolution.
68
+
69
+
### Type-Specific Methods
70
+
71
+
#### Boolean Resolution
72
+
73
+
```ts
74
+
client.getBooleanValue("my-flag", false);
75
+
```
76
+
77
+
Returns the feature's enabled state. This is the most common use case for feature flags.
78
+
79
+
#### String Resolution
80
+
81
+
```ts
82
+
client.getStringValue("my-flag", "default");
83
+
```
84
+
85
+
Returns the feature's remote config key (also known as "variant"). Useful for multi-variate use cases.
86
+
87
+
#### Number Resolution
88
+
89
+
```ts
90
+
client.getNumberValue("my-flag", 0);
91
+
```
92
+
93
+
Not directly supported by Bucket. Use `getObjectValue` instead for numeric configurations.
0 commit comments