From c51e39069a542c0dd8ce96ec8646c11e0c24848f Mon Sep 17 00:00:00 2001 From: James Kebinger Date: Thu, 10 Apr 2025 16:39:22 -0500 Subject: [PATCH 1/2] start documenting new operators --- .../features/rules-and-segmentation.md | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/docs/explanations/features/rules-and-segmentation.md b/docs/explanations/features/rules-and-segmentation.md index e7c38589..ff75bd62 100644 --- a/docs/explanations/features/rules-and-segmentation.md +++ b/docs/explanations/features/rules-and-segmentation.md @@ -21,9 +21,37 @@ Note that the variant determined by percentage rollouts is "sticky" to the provi ## Available Rules -| Name | Function | Example usage | -|---------------|--------------------------|----------------------------------------------------------------------------| -| `Property Is One Of` | Use `Property Is One Of` to target users with specific attributes. | If you set `Criteria Property` to `subscription` and `Criteria Values` to `pro,advanced` then it will match users with a `pro` or `advanced` subscription. | -| `Property Is Not One Of` | Use `Property Is Not One Of` to target users who do not match a specific attribute. | If you set `Criteria Property` to `subscription` and `Criteria Values` to `pro,advanced` then it will match users who have neither a `pro` nor an `advanced` subscription. | -| `Property Ends With One Of` | Use `Property Ends With One Of` to target users with an attribute that ends with a value. | If you set `Criteria Property` to `email` and `Criteria Values` to `@example.com` then it will match users who have an `email` ending with `@example.com` | -| `Property Does Not End With One Of` | Use `Property Does Not End With One Of` to target users with an attribute that does not end with a value. | If you set `Criteria Property` to `email` and `Criteria Values` to `@gmail.com,@yahoo.com` then it will match users who have an `email` that does not end with `@gmail.com` or `@yahoo.com`. | +## String Rules + +| Name | Function | Example usage | Notes | +|---------------|--------------------------|----------------------------------------------------------------------------|-------| +| `Property Is One Of` | Use `Property Is One Of` to target users with specific attributes. | If you set `Criteria Property` to `subscription` and `Criteria Values` to `pro,advanced` then it will match users with a `pro` or `advanced` subscription. || +| `Property Is Not One Of` | Use `Property Is Not One Of` to target users who do not match a specific attribute. | If you set `Criteria Property` to `subscription` and `Criteria Values` to `pro,advanced` then it will match users who have neither a `pro` nor an `advanced` subscription. || +| `Property Ends With One Of` | Use `Property Ends With One Of` to target users with an attribute that ends with a value. | If you set `Criteria Property` to `email` and `Criteria Values` to `@example.com` then it will match users who have an `email` ending with `@example.com` || +| `Property Does Not End With One Of` | Use `Property Does Not End With One Of` to target users with an attribute that does not end with a value. | If you set `Criteria Property` to `email` and `Criteria Values` to `@gmail.com,@yahoo.com` then it will match users who have an `email` that does not end with `@gmail.com` or `@yahoo.com`. || +| `Property Starts With One Of` | Use `Property Starts With One Of` to target users with an attribute that starts with a value. || See note below on SDK version requirements for new rule operators | +| `Property Does Not Start With One Of` | Use `Property Does Not Starts With One Of` to target users with an attribute that does not start with a value. || See note below on SDK version requirements for new rule operators| +| `Property Contains One Of` | Use `Property Contains One Of` to target users with an attribute that contains a value. || See note below on SDK version requirements for new rule operators | +| `Property Does Not Contain One Of` | Use `Property Does Not Contain One Of` to target users with an attribute that does not contain a value. || See note below on SDK version requirements for new rule operators| + +## Numeric Rules + +| Name | Function | Example usage | Notes | +|---------------|--------------------------|----------------------------------------------------------------------------|-------| +| `Property Is Greater Than` | Use `Property Is Greater Than` to target with a numeric attribute greater than a threshold | If you set `Criteria Property` to `company.employees` and `Criteria Value` to 100, then the rule will match users belonging to a company with more than 100 employees |See note below on SDK version requirements for new rule operators| +| `Property Is Greater Than Or Equal To` | Use `Property Is Greater Than Or Equal To` to target with a numeric attribute greater than or equal threshold | If you set `Criteria Property` to `company.employees` and `Criteria Value` to 100, then the rule will match users belonging to a company with 100 or more employees |See note below on SDK version requirements for new rule operators| +| `Property Is Less Than` | Use `Property Is Less Than` to target with a numeric attribute less than a threshold | If you set `Criteria Property` to `company.employees` and `Criteria Value` to 100, then the rule will match users belonging to a company with less than 100 employees |See note below on SDK version requirements for new rule operators| +| `Property Is Less Than Or Equal To` | Use `Property Is Less Than Or Equal To` to target with a numeric attribute less than than or equal to a threshold | If you set `Criteria Property` to `company.employees` and `Criteria Value` to 100, then the rule will match users belonging to a company with 100 or fewer employees |See note below on SDK version requirements for new rule operators| + + +## Date Rules + +Note: Date context values can be specified as milliseconds since epoch or RFC3339 formatted strings + +| Name | Function | Example usage | Notes | +|---------------|--------------------------|----------------------------------------------------------------------------|-------| +| `Property Is Before` | Use `Property Is Before` to target with a date attribute before than a threshold | If you set `Criteria Property` to `user.createdAt` and `Criteria Value` to '2025-01-01T00:00:00Z', then the rule will match users created before Jan 1, 2025. | See note below on SDK version requirements for new rule operators | +| `Property Is After` | Use `Property Is After` to target with a date attribute after a threshold | If you set `Criteria Property` to `user.createdAt` and `Criteria Value` to '2025-01-01T00:00:00Z', then the rule will match users created after Jan 1, 2025. | See note below on SDK version requirements for new rule operators | + + + From c4bbda74f74a64870cc4cdba49c795da07b83b71 Mon Sep 17 00:00:00 2001 From: James Kebinger Date: Thu, 10 Apr 2025 16:50:58 -0500 Subject: [PATCH 2/2] More rules --- .../features/rules-and-segmentation.md | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/docs/explanations/features/rules-and-segmentation.md b/docs/explanations/features/rules-and-segmentation.md index ff75bd62..1f1bb94c 100644 --- a/docs/explanations/features/rules-and-segmentation.md +++ b/docs/explanations/features/rules-and-segmentation.md @@ -21,7 +21,7 @@ Note that the variant determined by percentage rollouts is "sticky" to the provi ## Available Rules -## String Rules +### String Rules | Name | Function | Example usage | Notes | |---------------|--------------------------|----------------------------------------------------------------------------|-------| @@ -33,8 +33,10 @@ Note that the variant determined by percentage rollouts is "sticky" to the provi | `Property Does Not Start With One Of` | Use `Property Does Not Starts With One Of` to target users with an attribute that does not start with a value. || See note below on SDK version requirements for new rule operators| | `Property Contains One Of` | Use `Property Contains One Of` to target users with an attribute that contains a value. || See note below on SDK version requirements for new rule operators | | `Property Does Not Contain One Of` | Use `Property Does Not Contain One Of` to target users with an attribute that does not contain a value. || See note below on SDK version requirements for new rule operators| +| `Property Matches` | Use `Property Matches` to target users with an attribute that matches a regular expression (Regex) || See note below on SDK version requirements for new rule operators | +| `Property Does Not Match` | Use `Property Does Not Match` to target users with an attribute that does not match a regular expression (Regex) || See note below on SDK version requirements for new rule operators| -## Numeric Rules +### Numeric Rules | Name | Function | Example usage | Notes | |---------------|--------------------------|----------------------------------------------------------------------------|-------| @@ -44,7 +46,7 @@ Note that the variant determined by percentage rollouts is "sticky" to the provi | `Property Is Less Than Or Equal To` | Use `Property Is Less Than Or Equal To` to target with a numeric attribute less than than or equal to a threshold | If you set `Criteria Property` to `company.employees` and `Criteria Value` to 100, then the rule will match users belonging to a company with 100 or fewer employees |See note below on SDK version requirements for new rule operators| -## Date Rules +### Date Rules Note: Date context values can be specified as milliseconds since epoch or RFC3339 formatted strings @@ -54,4 +56,27 @@ Note: Date context values can be specified as milliseconds since epoch or RFC333 | `Property Is After` | Use `Property Is After` to target with a date attribute after a threshold | If you set `Criteria Property` to `user.createdAt` and `Criteria Value` to '2025-01-01T00:00:00Z', then the rule will match users created after Jan 1, 2025. | See note below on SDK version requirements for new rule operators | +### Semantic Version Rules + +| Name | Function | Example usage | Notes | +|---------------|--------------------------|----------------------------------------------------------------------------|-------| +| `Property Is Semver Less Than` | Use `Property Is Semver Less Than` to target an attribute referring to a software version | If you set `Criteria Property` to `sdk.version` and `Criteria Value` to '2.0.0', then the rule will match versions less than `2.0.0` | See note below on SDK version requirements for new rule operators | +| `Property Is Semver Equal To` | Use `Property Is Semver Equal To` to target an attribute referring to a software version | If you set `Criteria Property` to `sdk.version` and `Criteria Value` to '2.0.0', then the rule will match versions equal to than `2.0.0` | See note below on SDK version requirements for new rule operators | +| `Property Is Semver Greater To` | Use `Property Is Semver Greater Than` to target an attribute referring to a software version | If you set `Criteria Property` to `sdk.version` and `Criteria Value` to '2.0.0', then the rule will match versions greater than `2.0.0` | See note below on SDK version requirements for new rule operators | + + +## SDK Compatibility + +The prefab-js and prefab-react SDKs evaluate rules remotely so any version will support the operaters with SDK Version requirements. + +For in-process evaluation of the newer rules marked above these are the minimum versions + +| Language | Version | +|----------| --------| +| Go | 0.0.8 | +| Java | 0.3.25 | +| Node | 0.4.4 | +| Python | 0.11.0 | +| Ruby | 1.8.8 | +