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

[SDKS-7557/7554] getTreatment/s byFlagset withConfig/s #250

Merged
merged 7 commits into from
Sep 27, 2023

Conversation

emmaz90
Copy link
Contributor

@emmaz90 emmaz90 commented Sep 21, 2023

Javascript commons library

What did you accomplish?

Added getTreatments methods for flagsets

  • getTreatmentsByFlagSet
  • getTreatmentsWithConfigByFlagSet
  • getTreatmentsByFlagSets
  • getTreatmentsWithConfigByFlagSets

Added evaluation methods for flagsets in evaluator

  • evaluateFeaturesByFlagSets

make sets property optional

How do we test the changes introduced in this PR?

unit tests included

Extra Notes

@emmaz90 emmaz90 requested a review from a team as a code owner September 21, 2023 17:52
@emmaz90 emmaz90 changed the title [SDKS-7557/7554] getTreatment/s byFlagset withConfig/s [WIP] [SDKS-7557/7554] getTreatment/s byFlagset withConfig/s Sep 21, 2023
@emmaz90 emmaz90 changed the title [WIP] [SDKS-7557/7554] getTreatment/s byFlagset withConfig/s [SDKS-7557/7554] getTreatment/s byFlagset withConfig/s Sep 25, 2023
Base automatically changed from storage-typo to sdks-7437 September 25, 2023 14:52
src/evaluator/index.ts Outdated Show resolved Hide resolved
src/sdkClient/client.ts Outdated Show resolved Hide resolved
const attributes = validateAttributes(log, maybeAttributes, methodName);
const isNotDestroyed = validateIfNotDestroyed(log, readinessManager, methodName);
// @todo maybeFlagSets validation method
const flagSetOrFlagSets = maybeFlagSetNameOrNames;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can reuse validateSplits to validate flag sets, in order to avoid increasing the code size. Check validateSplits and you will see that you can pass additional params (listName and item) to customize the logging (should log "... flag set" rather than "... feature flag name").

You can also simplify the maybeFlagSetNameOrNames param as string[] | undefined (e.g., for getTreatmentsByFlagSets you can call it with [maybeFlagSet]). This way you don't need to use the multi variable here, and only call validateSplits (the plural version of validateSplit), of course with listName and item params updated to log errors and warnings properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add input validation in another pr, but I will take this into account

src/sdkClient/clientInputValidation.ts Outdated Show resolved Hide resolved
src/sdkClient/clientInputValidation.ts Outdated Show resolved Hide resolved
src/types.ts Show resolved Hide resolved
src/types.ts Show resolved Hide resolved
Copy link
Contributor

@EmilianoSanchez EmilianoSanchez left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Emma for the updates!

@emmaz90 emmaz90 merged commit 85f3498 into sdks-7437 Sep 27, 2023
1 check passed
@emmaz90 emmaz90 deleted the sdks-7557-b branch September 27, 2023 14:28
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.

2 participants