-
-
Notifications
You must be signed in to change notification settings - Fork 818
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance(delegate): refactor core delegation transforms (#3206)
* refactor ExpandAbstractTypes as PrepareGatewayRequest will consolidate remaining pre-user supplied transforms into this transform to hopefully reduce repetition also adds memoization of schema metadata * small refactors * add visitorKeys argument * small refactor * import WrapConcreteFields into PrepareGatewayRequest this does not use the same visitors and does not visit beneath fields, so can just be inlined * info should be optional in DelegationContext * fix types * Consolidate VisitSelectionSets * rename var * internalize PrepareGatewayDocument as transform as prepareGatewayDocument function * move varName generator out of loop to prevent recurrent looping * refactor AddArgumentsAsVariables * rename AddArgumentsAsVariables to FinalizeGatewayRequest to consolidate post custom transforms * arguments should be added to target final targetSchema not transformedSchema * move FilterToSchema tests to delegate package * starting refacotr of FilterToSchema * add visitorArgs also -- unfortunately -- requires another visit pass to properly remove variables if an object or interface field does not have selections -- another approach could be to keep track of variable uses, and subtract at the end of the first pass * integrate FilterToSchema into FinalizeGatewayRequest * fold AddTypenameToAbstract into FinalizeGatewayRequest * extract finalizeGatewayRequest function from the transform * retire all delegation transforms * fix build * typo * Add changeset Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
- Loading branch information
Showing
24 changed files
with
1,237 additions
and
1,335 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'@graphql-tools/delegate': major | ||
--- | ||
|
||
BREAKING CHANGES; | ||
|
||
Refactor the core delegation transforms into individual functions to modify request and results. This will improve the performance considerably by reducing the number of visits over the request document. | ||
- Replace `CheckResultAndHandleErrors` with `checkResultAndHandleErrors` | ||
- Remove `delegationBindings` | ||
- Replace `AddArgumentsAsVariables`, `AddSelectionSets`, `AddTypenameToAbstract`, `ExpandAbstractTypes`, `FilterToSchema`, `VisitSelectionSets` and `WrapConcreteTypes` with `prepareGatewayRequest` and `finalizeGatewayRequest` |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.