Skip to content

buildMembershipShapeWhere

buildMembershipShapeWhere(columns, claims): SQL

Defined in: packages/contracts/src/supabase-rls.ts:564

The Electric shape where for a membership-scoped table — the read counterpart of the select policy in buildSupabaseMembershipNativePolicies: the row’s container must be one the caller is a member of. Columns are referenced bare via c (Electric’s grammar requires plain column refs) yet still through the real Drizzle column objects, so the reference is rename-safe; the subject rides as a typed interpolation and becomes a bound param once buildRowFilterShape serializes it (never a hand-escaped literal). The subquery is self-contained (uncorrelated) — it gets its own FROM, so the membership table’s bare column names resolve to it.

No subject → DENY_ALL (by reference, so a customWhere built on it probes claims-dependent), mirroring the policy, whose membership subquery matches nothing without a JWT sub.

SupabaseMembershipShapeColumns

{[key: string]: unknown; app_metadata?: {[key: string]: unknown; roles?: string[]; }; sub?: string; } | null

SQL