Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement draft for a Nest.js SDK #718

Merged
merged 15 commits into from
Dec 13, 2023
Merged

Conversation

lukas-reining
Copy link
Member

@lukas-reining lukas-reining commented Dec 12, 2023

This PR

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

Fixes #705

Notes

@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

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.

@lukas-reining lukas-reining self-assigned this Dec 12, 2023
@lukas-reining lukas-reining requested a review from a team as a code owner December 12, 2023 11:23
@lukas-reining lukas-reining mentioned this pull request Dec 12, 2023
4 tasks
Copy link
Contributor

@weyert weyert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks similar to what I am having at work

@lukas-reining
Copy link
Member Author

lukas-reining commented Dec 12, 2023

Just also added the contextFactory parameter to the FeatureFlag decorators for dynamically setting the execution context based on request values such as headers, ip, user-id from token, ....
Maybe someone has a nicer way than this :)

packages/nest/README.md Outdated Show resolved Hide resolved
packages/nest/README.md Outdated Show resolved Hide resolved
packages/nest/src/open-feature.module.ts Outdated Show resolved Hide resolved
packages/nest/src/open-feature.module.ts Show resolved Hide resolved
packages/nest/README.md Show resolved Hide resolved
packages/nest/README.md Outdated Show resolved Hide resolved
packages/nest/README.md Outdated Show resolved Hide resolved
@toddbaert
Copy link
Member

@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?

Yep that works for me! You'll have to manually add an entry in https://github.com/open-feature/js-sdk/blob/main/.release-please-manifest.json though.

packages/nest/package.json Outdated Show resolved Hide resolved
packages/nest/package.json Show resolved Hide resolved
@lukas-reining
Copy link
Member Author

Yep that works for me! You'll have to manually add an entry in https://github.com/open-feature/js-sdk/blob/main/.release-please-manifest.json though.

Great, changed that.

Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as an experimental release!

I added a couple more suggestions.

lukas-reining and others added 11 commits December 13, 2023 17:34
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
…context

Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
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>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Henry Chen <1474479+chenhunghan@users.noreply.github.com>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Henry Chen <1474479+chenhunghan@users.noreply.github.com>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
@lukas-reining
Copy link
Member Author

I would merge this now, so we can work together on different questions.
@luizgribeiro lets open an issue for all open questions, e.g. the feature flag injection to services.

@lukas-reining lukas-reining added this pull request to the merge queue Dec 13, 2023
Merged via the queue into main with commit ef874e0 Dec 13, 2023
7 checks passed
@lukas-reining lukas-reining deleted the feat/nestjs-sdk-draft branch December 13, 2023 17:01
github-merge-queue bot pushed a commit that referenced this pull request Dec 13, 2023
🤖 I have created a release *beep* *boop*
---


##
[0.0.2-experimental](nestjs-sdk-v0.0.1-experimental...nestjs-sdk-v0.0.2-experimental)
(2023-12-13)


### ✨ New Features

* implement draft for a Nest.js SDK
([#718](#718))
([ef874e0](ef874e0))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @openfeature/core bumped from * to 0.0.21
    * @openfeature/server-sdk bumped from * to 1.8.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
toddbaert added a commit that referenced this pull request Jan 11, 2024
<!-- 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>
toddbaert added a commit that referenced this pull request Jan 11, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.0.2-experimental](nestjs-sdk-v0.0.1-experimental...nestjs-sdk-v0.0.2-experimental)
(2023-12-13)


### ✨ New Features

* implement draft for a Nest.js SDK
([#718](#718))
([ef874e0](ef874e0))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @openfeature/core bumped from * to 0.0.21
    * @openfeature/server-sdk bumped from * to 1.8.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nest.js SDK
6 participants