Commit Graph

10 Commits

Author SHA1 Message Date
Michael Beemer 2135254c4b
feat: add evaluation details to finally hook (#1087)
## 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>
2024-12-12 13:49:09 +00:00
Todd Baert 01fcb933d2
chore: import type lint rule and fixes (#1039)
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>
2024-10-16 14:33:47 -04: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
Federico Bond fd84025bdf
fix: return metadata for the bound provider in hookContext (#883)
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>
2024-03-26 11:11:33 +00:00
Michael Beemer 0b9ca1814c
fix: type support for Promise<void> before hook (#693)
## This PR

- Updates the server-side before hook type to perform async work without
modifying context.

### Related Issues

Fixes #689

### Notes

I added a test but the test runner isn't not validating types.

---------

Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
2023-11-30 17:26:12 +00:00
Lukas Reining a7d0b954dc
fix: make hooks in client sdk only return void (#671)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR

Fixes return type of hooks in client SDK. 

Maybe we should make this more clear in the spec @toddbaert.

### Related Issues
Fixes #630 

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

### 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 -->

### How to test
<!-- if applicable, add testing instructions under this section -->

---------

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
2023-11-21 16:31:33 +00:00
Michael Beemer a3a907f348
feat: add support for clearing providers (#578)
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
2023-10-13 10:18:31 -04:00
Lukas Reining e15bf8c8e8
chore: Refactor SDK structure (#473)
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
Splits up the types file and restructures the SDK by functionalities.
Feeling quite good with the structure now.
The PR became quite huge, but I could even move one or two more things
(for the client) to the shared implementation.
@toddbaert @beeme1mr Please give feedback if you think the structure is
completely off or something seems odd to you🙂

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

Fixes #437

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-05 13:22:24 -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