Prepare Release vnull - #5
Closed
github-actions[bot] wants to merge 6 commits into
Closed
Conversation
jsonApi.query() preloads the include tree for you, so a developer cannot reach those relation queries to scope them. withPreloadScopes(), a query builder macro, closes that: a map keyed by relation name constrains each included relation's preload query, at any depth, using callbacks that are the exact shape of Lucid's withScopes(), so a related model's own named scopes are reused rather than redefined. It composes after jsonApi.query() with Lucid's own withScopes() for the root. The map is read when the preload runs (execution), so chain order does not matter. applyIncludes keeps its old two-argument form working; the new model and preload-scope arguments are optional. Docs and a real end-to-end example test are included.
The scope map is keyed by the model's relation names, and each callback's scopes argument is the related model's scope bag, matching withScopes(): a wrong relation name or an undefined scope is a compile error. Deeper includes are constrained by nesting a preload of their own, typed to the next model down. This replaces the flat, any-depth-by-name shape (which could not be typed, and could apply a scope to a same-named relation on another branch) with a structural tree walked alongside the include tree. applyIncludes stays backward compatible.
Add withPreloadScopes to constrain included relations
github-actions
Bot
force-pushed
the
release-preview
branch
from
July 31, 2026 15:38
7ee6505 to
29679df
Compare
github-actions
Bot
force-pushed
the
release-preview
branch
from
July 31, 2026 15:41
29679df to
ba8af3c
Compare
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 PR is a preview of the release that release-plan has prepared. To release you should just merge this PR 👍