Remote / foldkit-remote-drizzle

normalize

function · packages/remote-drizzle/src/index.ts:186

function normalize(
  binding: AnyEntityBinding,
  rows: ReadonlyArray<Record<string, unknown>>,
  fields: readonly string[],
): ReadonlyArray<NormalizedPatch>

Maps rows a mutation returned (e.g. Drizzle returning) to entity patches, rewriting a one relation's foreign key to its ref key. fields is the set of columns the query selected (see selectColumns). A collection relation is left as its raw key; load it with source.