method IDataSource.findById
IDataSource.findById(id: EntityKey): Promise<Record<string, unknown> | null>

Find a single entity by its primary key value.

The key is an EntityKey: a scalar string/number or a composite record. A composite record is refused by the backend when it maps to a single column (e.g. Prisma's where: { id }), so widening this parameter is source-compatible for callers but breaking for an out-of-repo implementor whose method still declares the scalar-only form.

Parameters

The primary key value (scalar or composite record)

Return Type

Promise<Record<string, unknown> | null>

The row, or null when no row has that key

Usage

import { type IDataSource } from "common/src/index.ts";