Feat/new util simplify query#41
Merged
Merged
Conversation
Deploying feathers-utils with
|
| Latest commit: |
b54e954
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://be00b13a.feathers-utils.pages.dev |
| Branch Preview URL: | https://feat-new-util-simplify-query.feathers-utils.pages.dev |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to query merging and logical operator handling, as well as code cleanup and test enhancements. The main focus is on normalizing and flattening nested logical query structures (
$and,$or) to avoid unnecessary nesting, which simplifies downstream processing and results in more predictable query shapes. Additionally, the codebase is refactored for clarity, and tests are updated to cover new behaviors.closes #40
Query normalization and logical operator flattening
flattenAndBranchesandflattenOrBranchesutilities to recursively hoist nested$andand$orbranches, ensuring logical operators do not nest within themselves and queries are represented in a canonical, flat form. [1] [2]mergeQueryBodiesto useflattenAndBrancheswhen merging$andqueries, preventing nested$andstructures and ensuring flat, clean query ASTs.mergeQueryfunction to normalize queries before merging by applyingsimplifyQuery, which drops redundant wrappers and hoists nested operators.Code organization and exports
dedupeBranchesto a more appropriate location, and updated imports throughout the codebase for consistency. [1] [2]dedupeBranches,flattenAndBranches,flattenOrBranches) from the common index for shared use.simplifyQueryto the utilities index for broader access.Test coverage and behavioral improvements
Minor code cleanup
simplify-queryutility.These changes together make query merging more robust and maintainable, reduce the risk of deeply nested logical structures, and improve test coverage for edge cases.