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.
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.Fieldsto 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 (
requestedFieldsnull/empty) or there are no rows. Never mutates input rows.