Skip to content

Support targeting context accessor #93

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

Merged
merged 11 commits into from
Mar 26, 2025

Conversation

zhiyuanliang-ms
Copy link
Contributor

@zhiyuanliang-ms zhiyuanliang-ms commented Feb 6, 2025

Why this PR?

#55

Support targeting context accessor pattern, align with other FM libraries

Usage

An example application can be found #105

const featureManager = new FeatureManager(provider, {targetingContextAccessor: () => ({ userId: "xxx", groups: [] }) });

If targeting context is explicitly provided within isEnabled or getVariant call, it will have the higher priority than the targeting context accessor. See the testcases and comment

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • src/feature-management/package-lock.json: Language not supported
  • src/feature-management/src/filter/TargetingFilter.ts: Evaluated as low risk

@zhiyuanliang-ms
Copy link
Contributor Author

Example are added in #105

@zhiyuanliang-ms zhiyuanliang-ms merged commit a7694d6 into preview Mar 26, 2025
3 checks passed
@zhiyuanliang-ms zhiyuanliang-ms deleted the zhiyuanliang/targeting-context-accessor branch March 26, 2025 02:39
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.

5 participants