Skip to content

scoping.Interface.ScopeOptions

github-actions[bot] edited this page Nov 30, 2026 · 26 revisions

Interface: ScopeOptions<TFilter>

Defined in: packages/graphql-casl/src/scoping.ts:54

Options for scopeArgs.

Type Parameters

TFilter

TFilter

Properties

adapter

adapter: FilterAdapter<TFilter>;

Defined in: packages/graphql-casl/src/scoping.ts:60

The dialect to fold the ability's rules into. Must produce whatever the target argument's input type actually accepts — see the coercion warning in this module's description.


into?

optional into?: string;

Defined in: packages/graphql-casl/src/scoping.ts:70

The argument to inject the filter into.

Remarks

Default 'where'.

applyPermissions checks that the field really has an argument by this name and refuses the map if it does not.


merge?

optional merge?: (clientFilter, scope) => unknown;

Defined in: packages/graphql-casl/src/scoping.ts:82

How to combine the caller's own filter with the scope.

Parameters

clientFilter

unknown

scope

TFilter

Returns

unknown

Remarks

The default is a top-level AND via the adapter — adapter.and([clientFilter, scope]).

Override it only if the dialect needs a different combining shape. Do not "merge" by spreading keys: a client filter of { OR: [...] } sits beside the scope's keys rather than under it, and the scope stops applying.


onDenyAll?

optional onDenyAll?: OnDenyAll;

Defined in: packages/graphql-casl/src/scoping.ts:92

What to do when the ability permits no row of this subject.

Remarks

  • 'deny' (default) — throw Forbidden. Honest, and the only safe choice for a mutation: a forbidden delete must fail, not silently match nothing.
  • 'nothing' — inject adapter.nothing() so the field resolves to an empty result. Requires the adapter to supply nothing.

API Reference

Clone this wiki locally