idFieldNonGenerating
idFieldNonGenerating<
Brand>(codec):Omit<IdTransform<Brand>,"defaultQuery">
Defined in: src/adapters/prisma.ts:333
Non-generating sibling of idField for codec variants that do not expose a
synchronous generate() — Opaque Timestamp, Signed Timestamp, Wrapped key,
and Digest codecs all qualify.
Accepts any IdColumnCodec (the wider constraint that only requires
safeParse) and returns the full read/transform surface of IdTransform
minus defaultQuery. Because defaultQuery is the only method that calls
generate(), callers who only need the read path are not forced to provide a
synchronous generator.
The name reflects the provenance axis — this mapper does not generate IDs; it
parses and serialises a caller-supplied value. It is not read-only: the
return value includes a write method.
Type Parameters
Section titled “Type Parameters”Brand extends string
Parameters
Section titled “Parameters”IdColumnCodec<Brand>
Returns
Section titled “Returns”Omit<IdTransform<Brand>, "defaultQuery">
Example
Section titled “Example”import { idFieldNonGenerating } from "@smonn/ids/prisma";import { createOpaqueTimestampId } from "@smonn/ids/opaque";
const inv = createOpaqueTimestampId("inv", { key });const invoiceIdField = idFieldNonGenerating(inv);
const xprisma = prisma.$extends({ result: { invoice: { id: invoiceIdField.computeField("id") }, },});// xprisma.invoice.findUnique(…).id is typed as Id<"inv"> — no cast required