Commit Graph

21 Commits

Author SHA1 Message Date
Lukas Reining aa232a9d6a
feat: support Angular 20 (#1220)
Adds Angular 20 support.

This also remove the custom jest setup as it was not compatible with
Angular 20 and uses builtin support for vitest in Angular 20.
For this, Angular has been removed from the jest setup and the pipeline
runs it separately now.

Fixes #1206

---------

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
2025-07-25 18:48:38 +02:00
Todd Baert 5b19eb035a
chore: use server src not dist in nest tests (#1166)
Fixes issue where nest test suite was running using dist not source of
server sdk.

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2025-04-10 14:39:39 +02:00
Todd Baert c4ccf5f095
chore: centralize jest config for angular, module mapping (#1030)
see title.

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2024-10-01 16:30:47 -04:00
Lukas Reining 105fd95e34
feat: Angular SDK (#997)
<!-- 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 -->

Adds an Angular SDK as discussed in #976.
It mainly provides directives that conditionally render based on flag
value and provider state.

I did not inject any OpenFeature service or anything like that, as I
think the directives will be the way to access feature flags in the
templates, and the OpenFeature global API can be used directly in
services. But I am not 100% sure on that one.

Happy to receive feedback and opinions :)

A small test app can be found here:
https://github.com/open-feature/angular-test-app
This can be used with [yalc](https://github.com/wclr/yalc).

---------

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
2024-09-13 15:13:35 +00:00
Todd Baert df4e72eabc
chore: move client/ dir to web/ (#991)
I've been meaning to do this for a while... it just renames the
`client/` dir to `web/`. I think this is better because there will be
less confusion around the OpenFeature client object (which has it's own
dirs) and because it's more consistent with the associated artifact name
"web-sdk".

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2024-08-28 12:11:52 +00:00
Michael Beemer c6d0b5da9c
fix: run error hook when provider returns reason error or error code (#926)
## 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>
2024-05-08 17:38:04 +00:00
Todd Baert 0f2094e236
fix: re-render w/ useWhenProviderReady, add tests (#901)
This PR:

- brings react-sdk test coverage from 0% to ~95%
  - adds DOM-based testing (tests based on asserting DOM entity states)
    - tests for query-style, basic, and detailed evaluation APIs
- tests for suspense functionality and re-rendering on context change
  - tests for some util functions and hooks
  - `renderHook` tests for non suspending hooks
- fixes a bug where `useWhenProviderReady` didn't cause re-render after
the provider is ready if suspense wasn't used (leading to an out-of-date
return value for provider readiness)


![image](https://github.com/open-feature/js-sdk/assets/25272906/e8ee420f-0167-4048-94e3-53176bd883b9)

---------

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2024-04-11 17:41:13 +00:00
Todd Baert cfb0a69c42
feat: maintain state in SDK, add RECONCILING (#795)
Implements the newest spec changes
[here](https://github.com/open-feature/spec/pull/241).

- Provider state is deprecated (state is now maintained in the SDK
itself). This is non-breaking, we just ignore the provider's own state
now
- add RECONCILING events and state, fire related events with provider's
`on context change`
- add FATAL state

The new tests should help you understand the impact of the changes.

---------

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2024-03-01 14:09:09 +00:00
Michael Beemer 2170a9fa3a
ci: configure GitHub jest reporter (#791)
## This PR

- enables the Jest GitHub reporter

### Notes

https://jestjs.io/docs/configuration#github-actions-reporter

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2024-01-30 18:14:26 +00:00
Mohamed V J 696bf4adb8
fix: use in memory provider for e2e suites (#740)
## This PR
Removes setup using Flagd Provider and uses In-Memory Provider

Fixes #712

---------

Signed-off-by: Mohamed V J <muhammed8089@gmail.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
2024-01-05 17:44:49 +00:00
Lukas Reining ef874e0365
feat: implement draft for a Nest.js SDK (#718)
<!-- 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 -->

This is a first draft of a Nest.js SDK.
Currently it only handles injecting clients and feature flags.
I also added a context factory for the FeatureFlag decorators to be able
to use request information for the execution context.

### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->

Fixes #705 

### Notes
<!-- any additional notes for this PR -->

@toddbaert maybe we can do it as we did with the React SDK, merge this
fast and release as experimental to let people experiment and try out?

### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->
We will have to see if we want to stick with the injected feature flags
being wrapped in an observable.
To me this feels the most idiomatic for Nest.js.

### How to test
Tests for the current functionality are included.

---------

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Henry Chen <1474479+chenhunghan@users.noreply.github.com>
Co-authored-by: Luiz Guilherme Ribeiro <ltrindaderibeiro@gmail.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
2023-12-13 16:59:48 +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
Lukas Reining 5d55ea1d08
feat: add init/shutdown and events (#436)
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
2023-05-30 09:18:45 -04:00
Todd Baert 97fa63d87d
chore: rename integration tests e2e (#420)
These are end-to-end tests.

No functional changes. I did use `git mv` to try to preserve history as
best as possible.

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
2023-05-04 14:00:07 -04:00
Moritz Wiesinger f40c1536c2
test: add client SDK integration tests (#400)
- implements all integration tests from the test harness for the client
package

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
Co-authored-by: Todd Baert <toddbaert@gmail.com>
2023-04-24 15:11:26 -04:00
RealAnna 39f64742cf
test: add unit test to packages/client (#398)
Signed-off-by: RealAnna <89971034+RealAnna@users.noreply.github.com>
Co-authored-by: Todd Baert <toddbaert@gmail.com>
2023-04-11 19:04:14 -04:00
Todd Baert 39c3b1638e
chore: monorepo conversion + experimental web sdk (#353)
This PR transfroms this repo into a monorepo, with server (exsiting),
client (new) and shared (new) packages.

There are no tests yet for the client. Publishing _should_ work but is
yet untested.

The experimental web SDK will be published as `0.0.1-experimental` and
features:

- native browser events
- "close" functionality (implemented in server as well)
- async context setting
- sync evaluation

Though we want `close` and `events` in the server SDK, they are not
implemented in this PR (though it would be very easy to do so and I've
left TODO's about it). **There are no functional changes in the server
SDK with this PR.**

Here is a [direct
link](https://github.com/open-feature/js-sdk/blob/experimental-web-sdk/README.md)
to the README.md changes.

**_I'm not expecting reviewers to go through this with a fine-toothed
comb. Most of the changes are just establishing the monorepo, and the
functional stuff in the new web-sdk is just experimental._**.

Closes: https://github.com/open-feature/js-sdk/issues/367

---------

Signed-off-by: Todd Baert <toddbaert@gmail.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2023-03-09 14:43:41 -05:00
Todd Baert 9a9950d9f0
chore: add integration tests (#225)
Add integration test suite.

Signed-off-by: Todd Baert <toddbaert@gmail.com>
2022-10-03 12:32:44 -04:00
Todd Baert e2910fb2e8
Fix issues with extensions in ESM 2022-05-30 14:04:28 -04:00
Todd Baert dac783faa8
Add linting 2022-05-11 13:37:36 -04:00
Todd Baert e6eaecd386
Add testing 2022-05-10 14:51:16 -04:00