Commit 28ff809
feat: add startsWith operator to routing forms (calcom#23026)
* feat: add startsWith operator to routing forms
- Implement startsWith operator in BasicConfig.ts for RAQB
- Add custom JsonLogic operation for startsWith evaluation
- Add startsWith support to jsonLogicToPrisma for reporting
- Supports both form field response routing and attribute routing
- Uses case-insensitive matching via normalize function
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* test: add comprehensive unit tests for startsWith operator
- Add tests for operator availability in FormFieldsBaseConfig and AttributesBaseConfig
- Add tests for JsonLogic configuration validation
- Add tests for text widget operator integration
- All 15 tests pass including new startsWith operator tests
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* test: move startsWith operator tests to jsonLogic.test.ts
- Add comprehensive startsWith tests to packages/lib/raqb/jsonLogic.test.ts
- Remove startsWith tests from packages/app-store/routing-forms/__tests__/config.test.ts
- Tests verify case-insensitive matching, edge cases, and falsy value handling
- All tests pass: jsonLogic.test.ts (18 passed) and config.test.ts (12 passed)
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* refactor: remove unused startsWith operator from jsonLogicToPrisma.ts
- Remove startsWith entry from OPERATOR_MAP in jsonLogicToPrisma.ts
- File is currently unused so this cleanup keeps PR focused
- Core startsWith functionality remains intact in jsonLogic.ts and BasicConfig.ts
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* test: add comprehensive edge case tests for startsWith operator
- Add test cases for non-string first argument (haystack) handling
- Cover null, undefined, numbers, booleans, arrays, and objects
- Update startsWith implementation to safely handle non-string inputs
- Ensure operation returns false without throwing runtime errors
- All tests now pass: 19 passed | 1 skipped
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* refactor: improve startsWith operation with type guards and String.prototype.startsWith
- Change argument types from string to unknown for better type safety
- Add type guards to return false when either operand is not a string
- Use String.prototype.startsWith instead of indexOf for cleaner implementation
- Keep existing empty-second check and normalize function calls
- All tests continue to pass: 19 passed | 1 skipped
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 8e73421 commit 28ff809
3 files changed
Lines changed: 53 additions & 9 deletions
File tree
- packages
- app-store/routing-forms/components/react-awesome-query-builder/config
- lib/raqb
Lines changed: 6 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
108 | 105 | | |
109 | 106 | | |
110 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
228 | 261 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
53 | 67 | | |
0 commit comments