scopeQueryToPortal
function scopeQueryToPortal(query, grant): ScopedQuery;Defined in: src/portal.ts:226
Force a client query into a portal grant: the tenant is the token’s, and
every filter field is AND-ed in. A client parameter can only narrow the
view — action lists are intersected, exclusions are unioned, and a client
actorId / targetType / targetId that differs from the token’s makes
the result empty (empty: true) instead of widening it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
query |
AuditQuery |
grant |
PortalGrant |
Returns
Section titled “Returns”Example
Section titled “Example”const { query, empty } = scopeQueryToPortal(clientQuery, grant);const page = empty ? { items: [], pageInfo: { hasNextPage: false, endCursor: null } } : await audit.query(query);