feat(query-graphql): expose computeAuthorizationFilter on Authorizer - #6
Closed
jtomaszewski wants to merge 1 commit into
Closed
feat(query-graphql): expose computeAuthorizationFilter on Authorizer#6jtomaszewski wants to merge 1 commit into
jtomaszewski wants to merge 1 commit into
Conversation
2 tasks
Add a public `computeAuthorizationFilter(ctx, authorizationContext)` method on the `Authorizer<DTO>` interface as a thin, intention-revealing alias of `authorize()`. DefaultAuthorizer and the internal relation authorizer delegate to authorize(). This lets custom resolvers and domain services reuse the exact filter the `@Authorize` pipeline produces without duplicating operator mapping or reaching into the resolver internals. Co-Authored-By: Claude Opus 4.7 <[email protected]>
jtomaszewski
force-pushed
the
feat/expose-compute-authorization-filter
branch
from
April 21, 2026 22:58
1b5dfb7 to
7e34b9f
Compare
@ptc-org/nestjs-query-core
@ptc-org/nestjs-query-graphql
@ptc-org/nestjs-query-mikro-orm
@ptc-org/nestjs-query-mongoose
@ptc-org/nestjs-query-sequelize
@ptc-org/nestjs-query-typegoose
@ptc-org/nestjs-query-typeorm
commit: |
Author
|
Closing — this patch is a pure rename alias of |
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
Adds a public
computeAuthorizationFilter(context, authorizationContext)method on the
Authorizer<DTO>interface. It's an intention-revealingalias of
authorize()—DefaultAuthorizerand the internal relationauthorizer delegate to
authorize(), so behavior is unchanged.Motivation
Today, consumers outside the generated CRUD resolvers (custom resolvers,
domain services) that want to apply the same authorization filter the
@Authorizepipeline produces must callauthorize(). That works, butthe name reads as an extension hook, not a call site — readers routinely
misread domain-service code as mutating/deciding auth rather than just
reusing the decorator's output.
This method gives a clear, public, read-only name for the operation:
compute the auth filter I'd get from
@Authorize.Stacked on #5 (patch 1/4) conceptually; no code dependency.
Test plan
should expose computeAuthorizationFilter as a public alias of authorizeindefault-crud-auth.service.spec.tsyarn nx test query-graphql— 498 tests passyarn nx build query-graphql🤖 Generated with Claude Code