Commit Graph

5 Commits

Author SHA1 Message Date
Michael Beemer 98ba00a28d
feat: add support for domains (#805)
## This PR

- adds domain as a concept to the server and web SDK
- adds a deprecation warning anywhere client name was exposed to users.
- fixes an issue in the web SDK where context set on a domain before a
provider is registered was not used.

## Addresses

fixes #820
4aa965721f

### Notes

This change is based on [this
spec](https://github.com/open-feature/spec/pull/229) change. I tried to
make it a non-breaking change but I may have missed an untested
condition. Please carefully review to make sure I didn't miss anything.

### Follow-up Tasks

- Update the doc readme parser to support "domain".
- Update the NestJS and React SDKS. We should consider making those a
breaking change since they're sub 1.0.

---------

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>
2024-02-20 16:33:34 +00:00
Todd Baert 7906bbedbd
feat: add PROVIDER_CONTEXT_CHANGED event (web-sdk only) (#731)
This PR:

- adds `PROVIDER_CONTEXT_CHANGED` events, which, in the static paradigm,
can be used to inform the SDK that the flags should be re-evaluated
(important for UI repaints in React, for instance (note this event is
only available in the web-sdk)
- runs the associated `PROVIDER_CONTEXT_CHANGED` handlers if the
provider's context handler function ran successfully or `PROVIDER_ERROR`
handlers otherwise.
- adds associated tests

A decent amount of this is just typing magic to reduce duplicated code
while making the new event only available in the web-sdk.

See: [associated spec
change](https://github.com/open-feature/spec/pull/200)

Fixes: https://github.com/open-feature/js-sdk/issues/729

---------

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2024-01-08 20:19:35 +00:00
Todd Baert f0e2aa617f
fix: missing events bundled dep (#660)
Fixes: https://github.com/open-feature/js-sdk/issues/659

This PR fixes an issue created with [this
change](https://github.com/open-feature/js-sdk/pull/650), which removed
the `events` polyfill package from `@openfeature/core` where is wasn't
always needed (see that issue for details). The problem was that we
still imported `events` in the `@openfeature/core` module, but can't use
the `events` bundled in the `@openfeature/web-sdk` since the bundled
package there isn't accessible from imports in `@openfeature/core`.

This PR _**removes all imports of `events`**_ from `@openfeature/core`,
and instead only imports types. Imports of `events` only now occur in
the web-sdk (where it's bundled) and server-sdk (where it's made
available by the node runtime), not in the common module.

Unfortunately this issue was a bit tough to track down, because `events`
is VERY common, and lots of bundlers, etc will add it, so it's
frequently available "accidentally".

Thanks to @juanparadox for the report.

---------

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2023-11-09 13:57:52 +00:00
Todd Baert c3ee90b2e0
feat: extract and publish core package (#629)
This PR addresses: https://github.com/open-feature/js-sdk/issues/616 by:

- configuring CI to release a new module (in addition to
server/web/react we now release the "core" module (previously called
"shared").
- adding a peer dep to the above module to server/web/react
- adding a workflow to ensure that `shared` is released ahead of
associated web/server/react changes, and which also auto-increments the
peer dep version when the core module is released
- unrelated `typedoc` improvements/updates

> [!NOTE]  
> I intend to create a new PR that will rename the dir structure
according to the packages... so `shared/` will become `core/` and
`client/` will become `web/`. I just didn't want to add confusion and
noise to this PR.

---------

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2023-10-31 17:03:37 +00:00
Luiz Guilherme Ribeiro 5e044efc6d
feat(server): add in memory provider (#585)
## This PR

Implements the following features for `inMemoryProvider`:
- default value for flags
- reason for flag evaluation
- Context based evaluation

### Related Issues

It's part of #565 


---------

Signed-off-by: Luiz Ribeiro <ltrindaderibeiro@gmail.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2023-10-11 10:06:21 -04:00