Member Junction
    Preparing search index...

    Function ProjectRowsToFields

    • Projects plain-object rows down to a caller-requested field subset, matching field names case-insensitively (and ignoring surrounding whitespace).

      Used by the RunView caching pipeline: when a query is cacheable, the provider widens params.Fields to ALL entity fields so the cache entry is a universal superset that satisfies any future field subset. This helper restores the caller's originally requested shape — on cache hits (filtering the cached superset) AND on cache misses (filtering the widened DB result) — so callers always receive the same columns regardless of cache temperature.

      Returns the original array untouched when no projection is requested (requestedFields null/empty) or there are no rows. Never mutates input rows.

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • rows: T[]

        Plain-object result rows (NOT BaseEntity objects)

      • requestedFields: string[]

        The caller's original Fields list, or null for "all fields"

      Returns T[]