feat: export parseParams and related sanitizers#16788
Open
tak-amboss wants to merge 1 commit into
Open
Conversation
Exposes parseParams, sanitizeSortParams, the JoinParams type, and the RawParams/ParsedParams types from the main payload entrypoint so custom REST endpoints that shadow built-in routes can apply the same query coercion as the default handlers (booleans, numbers, sort splitting, where/data JSON parsing, populate/select/joins sanitization) without vendoring the implementation.
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.
Summary
parseParamsfrom the mainpayloadentrypoint along with itsRawParams/ParsedParamstypessanitizeSortParams(the remaining sanitizer used insideparseParams) and theJoinParamstype for completeness alongside the already-exportedsanitizeJoinParams/sanitizePopulateParam/sanitizeSelectParamWhy
Custom REST endpoints that shadow a built-in route (e.g. a collection endpoint at
/versions/:idwith additional customization) need the same query-string coercion the default handlers run.parseParamsalready implements all of this, but it is not part of the package'sexportsmap, which forces consumers to either deep-import viapayload/dist/...or vendor a copy. Exposing it lets endpoint authors stay aligned with core behavior automatically.sanitizeSortParamsis the only sanitizer used byparseParamsthat was not already re-exported, andJoinParamsis the input type of the already-exportedsanitizeJoinParams— including both rounds out the surface.