@maverickcer/env-cap
    Preparing search index...

    Function groupVariablesByOwner

    • Groups every variable under its effective owner (its own, falling back to its contract's), preserving input order within each owner.

      Type Parameters

      Parameters

      • contracts: readonly C[]
      • ownerOf: (contract: C, variable: VariableOf<C>) => string | undefined

      Returns ReadonlyMap<string, readonly { contract: C; variable: VariableOf<C> }[]>

      The single implementation of "who owns what, rolled up per owner", shared by the ownershipSummary projection and docs.ts's own rendered ownership matrix. Kept as one function precisely so env-cap's generated Markdown and the projection a consumer reads can never disagree about the grouping -- the same reason effectiveOwner() is the single resolution rule (ADR 0028). Variables with no effective owner are omitted entirely rather than bucketed under a synthetic "unowned" key, which would read as a real team name; callers that need them ask for them separately.

      ownerOf is supplied by the caller so a model whose owners are already resolved (OwnershipModel) and one whose aren't (ContractModel) both work without this function guessing which it was handed.