ConstraintsCallbackProps
ConstraintsCallbackProps<
TData,TUser,TOrg,TQ> =object& [TOrg] extends [never] ?unknown:object
Defined in: packages/core/src/access/types.ts:144
Props for a rule’s constraints callback: the caller, optionally the
organization, and q — the builder the rule records onto. No data:
constraints run once per query, before any document is read (contrast
PermissionCallbackProps, which the sibling filter property uses).
q’s TYPE is what gates index pushdown per action (DD 14). A query-shaped
action gets an AccessQueryBuilder — filter plus withIndex; every
other action gets an AccessPredicateBuilder, the same shape minus
withIndex, so a rule reads identically either way and q.withIndex is simply
absent where there is no query to narrow. One property, two builder types, and
nothing to discriminate at the object level.
Type Declaration
Section titled “Type Declaration”q:
TQ
user:
TUser
Type Parameters
Section titled “Type Parameters”TData = unknown
Document type constraints are typed against.
TUser = Record<string, unknown>
User document shape.
TOrg = Record<string, unknown>
Organization document shape; never if not configured.
TQ = AccessPredicateBuilder<TData>
The builder for this action: AccessQueryBuilder on query
actions, AccessPredicateBuilder on mutations.