Skip to content

feat(query-graphql): expose computeAuthorizationFilter on Authorizer - #6

Closed
jtomaszewski wants to merge 1 commit into
tourneefrom
feat/expose-compute-authorization-filter
Closed

feat(query-graphql): expose computeAuthorizationFilter on Authorizer#6
jtomaszewski wants to merge 1 commit into
tourneefrom
feat/expose-compute-authorization-filter

Conversation

@jtomaszewski

Copy link
Copy Markdown

Summary

Adds a public computeAuthorizationFilter(context, authorizationContext)
method on the Authorizer<DTO> interface. It's an intention-revealing
alias of authorize()DefaultAuthorizer and the internal relation
authorizer 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
@Authorize pipeline produces must call authorize(). That works, but
the 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

  • New test should expose computeAuthorizationFilter as a public alias of authorize in default-crud-auth.service.spec.ts
  • yarn nx test query-graphql — 498 tests pass
  • yarn nx build query-graphql

🤖 Generated with Claude Code

@jtomaszewski jtomaszewski mentioned this pull request Apr 21, 2026
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
jtomaszewski force-pushed the feat/expose-compute-authorization-filter branch from 1b5dfb7 to 7e34b9f Compare April 21, 2026 22:58
@pkg-pr-new

pkg-pr-new Bot commented Apr 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@ptc-org/nestjs-query-core

npm i https://pkg.pr.new/@ptc-org/nestjs-query-core@6

@ptc-org/nestjs-query-graphql

npm i https://pkg.pr.new/@ptc-org/nestjs-query-graphql@6

@ptc-org/nestjs-query-mikro-orm

npm i https://pkg.pr.new/@ptc-org/nestjs-query-mikro-orm@6

@ptc-org/nestjs-query-mongoose

npm i https://pkg.pr.new/@ptc-org/nestjs-query-mongoose@6

@ptc-org/nestjs-query-sequelize

npm i https://pkg.pr.new/@ptc-org/nestjs-query-sequelize@6

@ptc-org/nestjs-query-typegoose

npm i https://pkg.pr.new/@ptc-org/nestjs-query-typegoose@6

@ptc-org/nestjs-query-typeorm

npm i https://pkg.pr.new/@ptc-org/nestjs-query-typeorm@6

commit: 7e34b9f

@jtomaszewski

Copy link
Copy Markdown
Author

Closing — this patch is a pure rename alias of authorize() with no behavior change. Consumers can call authorizer.authorize(ctx, authCtx) directly (or wrap in a one-line helper in the Tournee backend). Not worth the fork drift. Tracked in SPEC-001.

@jtomaszewski
jtomaszewski deleted the feat/expose-compute-authorization-filter branch April 22, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant