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(api): implement mappers for the different contexts in feature flags #3465

Merged
merged 1 commit into from
May 26, 2023

Conversation

p-fernandez
Copy link
Contributor

What change does this PR introduce?

Adds mapping for the different potential contexts we might have for the feature flags (organization, environment, user).

Why was this change needed?

We need to adapt Novu's context to Launch Darkly's one.

Other information (Screenshots)

I am missing for now adding other contexts such as version and region that were discussed but we still don't have the implementation for them in the apps. The implementation of the contexts in this PR should be enough to give an idea how to implement them in the future.

@linear
Copy link

linear bot commented May 19, 2023

NV-2324 Mappers around Launch Darkly API

Launch Darkly has their own schema to manage the feature flags implemented by them.

We need to be able to transform our own Novu information (user, environment, version) to the schema used by Launch Darkly and on reverse.

Definition of done

  • We achieve an abstraction with the mappers that could help us to manage the feature flags data.

@@ -49,7 +49,8 @@ export class FeatureFlagsService {
}
}

public async get<T>(key: FeatureFlagKey, context: IFeatureFlagContext, defaultValue: T): Promise<T> {
return await this.service.get(key, context, defaultValue);
public async get<T>(key: FeatureFlagKey, defaultValue: T, context: IFeatureFlagContext): Promise<T> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

swapped the order because I found it was a clearer API as the key and the default value are related and context might be optional in a further decision.

@p-fernandez p-fernandez force-pushed the nv-2324-mappers-around-launch-darkly-api branch from 8b3ae62 to 5c510db Compare May 19, 2023 14:27
Base automatically changed from nv-2353-retrieve-feature-flag-from-launch-darkly to nv-2323-implement-launch-darkly-node-sdk May 22, 2023 14:19
@p-fernandez p-fernandez force-pushed the nv-2323-implement-launch-darkly-node-sdk branch from 752a446 to 5c48630 Compare May 22, 2023 14:22
Base automatically changed from nv-2323-implement-launch-darkly-node-sdk to next May 23, 2023 08:20
@p-fernandez p-fernandez force-pushed the nv-2324-mappers-around-launch-darkly-api branch from 5c510db to d638ca4 Compare May 23, 2023 08:21
@p-fernandez p-fernandez added this pull request to the merge queue May 26, 2023
Merged via the queue into next with commit 67298e5 May 26, 2023
20 checks passed
@p-fernandez p-fernandez deleted the nv-2324-mappers-around-launch-darkly-api branch May 26, 2023 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants