-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(core): add user * feat(core): add user segments and flag rule sets to schema fix(web): update feature flag component to use link and improve data handling * feat(web): enhance flag detail page with history and environment details * feat(web): add prebuild script and update lint ignore comments in RuleSetEditor and error page * chore: update dependencies and improve accessibility in various components * feat(web): add user segments settings and display component * feat(core): add updateUserProperties method and improve user property notification * feat(docs): add user segments and operators documentation * fix: clean up imports and formatting in FeatureFlag and AddFeatureFlagModal components * feat(core): enhance LocalData type to include ruleSet for flags and remoteConfig * feat(tests): set currentEnvironment to "development" in node tests * feat(tests): set currentEnvironment to "development" in Koa and Express tests * fix: clean up formatting in package.json and koa.test.ts * feat(tests): add additional flags and remoteConfig to mock data * feat(api): add v2 project data route and update fetch URL * fix(flags): change findUnique to findFirst for feature flag retrieval and enhance user validation * chore: update package versions and dependencies across multiple packages * fix: standardize "files" field formatting in package.json across multiple packages * feat(tests): update API version in mock handlers to v2 across multiple packages * test: skip A/B tests and feature flag assertions in node tests * fix(tests): skip feature flag test and enable A/B test in express tests
- Loading branch information
Showing
95 changed files
with
3,729 additions
and
651 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Rule Operators | ||
|
||
When configuring conditional rules for feature flags, you can use different operators based on the property type. | ||
|
||
## String Operators | ||
|
||
| Operator | Description | Example | | ||
| ----------- | --------------------------------- | ------------------------------- | | ||
| eq | Exact string match | `role eq "admin"` | | ||
| neq | Not equal | `role neq "guest"` | | ||
| contains | String contains substring | `email contains "@company.com"` | | ||
| notContains | String does not contain substring | `plan notContains "free"` | | ||
| startsWith | String starts with prefix | `country startsWith "US"` | | ||
| endsWith | String ends with suffix | `domain endsWith ".edu"` | | ||
| regex | String matches regular expression | `email regex "^[a-z]+@.*$"` | | ||
|
||
## Number Operators | ||
|
||
| Operator | Description | Example | | ||
| -------- | ------------------------ | -------------------------- | | ||
| eq | Equal to | `age eq 21` | | ||
| neq | Not equal to | `loginCount neq 0` | | ||
| gt | Greater than | `purchaseCount gt 5` | | ||
| gte | Greater than or equal to | `subscriptionMonths gte 3` | | ||
| lt | Less than | `errorCount lt 10` | | ||
| lte | Less than or equal to | `failedAttempts lte 3` | | ||
|
||
## Boolean Operators | ||
|
||
| Operator | Description | Example | | ||
| -------- | ----------- | ---------------------- | | ||
| eq | Equal to | `isSubscribed eq true` | | ||
|
||
## Rule Groups | ||
|
||
Rules can be combined into groups using logical operators: | ||
|
||
| Operator | Description | Example | | ||
| -------- | -------------------------------------- | ----------------------------------------------- | | ||
| and | All conditions in the group must match | `role eq "admin" AND subscriptionDays gt 30` | | ||
| or | Any condition in the group can match | `isTeamMember eq true OR hasBetaAccess eq true` | | ||
|
||
### Example Rule Sets | ||
|
||
```typescript | ||
// Single rule | ||
{ | ||
propertyName: "role", | ||
propertyType: "string", | ||
operator: "eq", | ||
value: "admin", | ||
thenValue: true | ||
} | ||
|
||
// Rule group with AND logic | ||
{ | ||
operator: "and", | ||
rules: [ | ||
{ | ||
propertyName: "subscriptionTier", | ||
propertyType: "string", | ||
operator: "eq", | ||
value: "premium" | ||
}, | ||
{ | ||
propertyName: "usageCount", | ||
propertyType: "number", | ||
operator: "gt", | ||
value: 100 | ||
} | ||
], | ||
thenValue: true | ||
} | ||
|
||
// Rule group with OR logic | ||
{ | ||
operator: "or", | ||
rules: [ | ||
{ | ||
propertyName: "isAdmin", | ||
propertyType: "boolean", | ||
operator: "eq", | ||
value: true | ||
}, | ||
{ | ||
propertyName: "email", | ||
propertyType: "string", | ||
operator: "endsWith", | ||
value: "@company.com" | ||
} | ||
], | ||
thenValue: true | ||
} | ||
``` | ||
|
||
When evaluating rules: | ||
|
||
1. Rules are evaluated in order | ||
2. The first matching rule's `thenValue` is used | ||
3. If no rules match, the environment's default value is used |
Oops, something went wrong.