@accounter/server
Version:
Accounter GraphQL server
17 lines (16 loc) • 873 B
TypeScript
import type { Injector } from 'graphql-modules';
import type { BusinessMembership } from '../../../shared/types/auth.js';
/**
* Business display names for a set of memberships, keyed by business id.
*
* A membership carries no name of its own — `business_users` stores only ids —
* so the name comes from the business's `financial_entities` row, which RLS
* narrows to the request's read scope. A request that sends no
* `X-Business-Scope` reads all of the user's memberships and resolves every
* name; a scoped one resolves only the businesses in scope, and the rest are
* simply absent from the map.
*
* Failures are per-id on purpose: one unreadable business must not blank the
* names of the others.
*/
export declare function resolveMembershipBusinessNames(injector: Injector, memberships: readonly BusinessMembership[]): Promise<Map<string, string>>;