As astutely pointed out by @JasperJuergensen in
https://github.com/open-feature/js-sdk/issues/1227, we added API surface
in core which we use in the latest web, but did't accordingly update the
min version of core in web.
(I also updated the min core version in server, just because).
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
- Updates readme examples to include a try/catch around
setProviderAndWait
- Improves the setProviderAndWait JS Doc
### Related Issues
Fixes#1179
### Notes
https://cloud-native.slack.com/archives/C0344AANLA1/p1745326882304199
---------
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
## This PR
- add a top-level method for accessing providers
### Notes
While working on some improvements to the way Suspense works in the
React SDK, I ran into a few scenarios were having access to the provider
itself was important. I needed a way to confidently tell that a provider
was the noop provider since it has special properties like never being
in a ready state. There are a few ways could could achieve this but I
noticed that the Java SDK [already has
methods](https://github.com/open-feature/java-sdk/blob/main/src/main/java/dev/openfeature/sdk/OpenFeatureAPI.java#L279)
that expose the provider. It also allowed me to improve some of our
existing tests.
### How to test
Unit tests have been updated accordingly.
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
## This PR
- adds evaluation details to the `finally` stage in hooks.
### Notes
This breaks the signature of the `finally` stages based on [this spec
enhancement](https://github.com/open-feature/spec/pull/280). It is
**not** considered a breaking change to the SDK because hooks are marked
as experimental in the spec, and the change has no impact on known
hooks.
The noteworthy change to the interface is:
```diff
- finally?(hookContext: Readonly<HookContext<T>>, hookHints?: HookHints): HooksReturn;
+ finally?(hookContext: Readonly<HookContext<T>>, evaluationDetails: EvaluationDetails<T>, hookHints?: HookHints): HooksReturn;
```
### Follow-up Tasks
- Update the JS contribs repo
---------
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
## This PR
- updates the context and trackingEventDetails on the tracking interface
to not be optional since they're always supplied by the SDK.
### Notes
This is a small QoL improvement for provider devs implementing the
tracking interface.
### How to test
The SDK still compiles, and the tests don't need to be modified.
---------
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
- Fixes incorrect comment in the README for the Hook implementation's
`after` method.
Signed-off-by: Christian Llontop <me@chrisllontop.com>
📣 This was a draft for a while, but is now ready for review! 📣
This implements tracking as per spec, in the server, web, and react
SDKs.
I don't think the Angular or Nest SDKs need specific implementations,
but please advise (cc @luizgribeiro @lukas-reining).
Fixes: https://github.com/open-feature/js-sdk/issues/1033
Fixes: https://github.com/open-feature/js-sdk/issues/1034
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Inspired by [this
comment](https://github.com/open-feature/js-sdk/pull/1020#discussion_r1777829664)
I've added a lint rule to enforce `import type`, and some additional
package changes to add a `lint:fix`.
The only changes I made manually here is to add the lint rule, and the
package.json script. All the changes are auto-generated by the
`lint:fix`.
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
There's no bug here, but this adds some asserts for a tricky bug I
recently found in the Java SDK:
https://github.com/open-feature/java-sdk/pull/1049
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
- replace the es2022 error cause with a custom implementation
- lower compilation target from es2022 to es2015
### Related Issues
Fixes#956
### Notes
The tests pass, but I still want to manually build and test the outputs
in a real application to ensure everything works as expected.
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
<!-- add the description of the PR here -->
Removes Node 16 as it is deprecated.
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
As discussed here
https://github.com/open-feature/js-sdk/pull/750#discussion_r1450896230,
we should not export `OpenFeatureClient` from the server and web SDK.
The type used outside the SDK should be `Client`, which is also used in
the public APIs like `OpenFeatureApi`.
The question is, if we should mark this as breaking.
Technically it will break code that imports `OpenFeatureClient` instead
of `Client`, but as @toddbaert said code using it could also be seen as
"used wrong" while being technically fine.
I am still leaning towards marking it as breaking, to be sure we are not
breaking something that is technically fine, just because it is
unintended use. But I could also live with non-beaking.
---------
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
## This PR
- overloads the set provider methods to support defining context in the
web SDK
- updates the web sdk readme
## Related Issues
Fixes https://github.com/open-feature/js-sdk/issues/748
## Notes
I decided to only support setting context in the web SDK because it is
less valuable on the server and the expected behavior was less clear due
to `domains`.
The behavior may need to be spec'd out. An issue in the spec repo has
been created.
https://github.com/open-feature/spec/issues/219
---------
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
- runs error hook when provider returns reason error or error code
### Related Issues
Fixes#925
### Notes
Based on a conversation in Slack:
https://cloud-native.slack.com/archives/C06E4DE6S07/p1714581197391509
---------
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
## This PR
- adds tip to node.js about web
- adds tip to web about node.js
### Notes
Related to the PR opened by @dabeeeenster.
https://github.com/open-feature/openfeature.dev/pull/552
---------
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
<!-- add the description of the PR here -->
Removes OpenFeatureClient class from exports and makes event details
readonly as described here:
https://github.com/open-feature/js-sdk/issues/799
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
## This PR
- bump spec version badge to v0.8.0
### Notes
The SDKs have been complimented with the latest spec release, but we
neglected to bump the badge version.
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Clients were incorrectly populating the hook context provider metadata
field with metadata from the default provider instead of the one bound
to the client.
Signed-off-by: Federico Bond <federicobond@gmail.com>
Adds a blurb out peer deps and lib development, installation.
@beeme1mr I also added a bit about `--legacy-peer-deps` after the
closure of https://github.com/open-feature/js-sdk/issues/834
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>