deriveDataLayer() function
Derive the data-layer config from an emitted contract.
Signature:
export declare function deriveDataLayer(input: DeriveOptions): DerivedDataLayer;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
input |
Returns:
Config for dataLayer() and the individual middlewares.
Exceptions
When scope names a model the contract does not define.
Remarks
This replaces the Prisma 7 generator that wrote SOFT_DELETE_MODELS, AUTHORSHIP_MODELS and the rest into src/generated. Prisma Next has no custom-generator protocol and does not need one: the contract already names every model, field and physical column, so the same config is a lookup rather than a build step, and nothing can go stale against the schema.
Membership is by convention, which is what softDelete = "auto" and authorship = "auto" meant. Everything is keyed by **physical table**, because that is what a statement names — resolving a table back to a model at query time would have to go through the contract's roots, which is keyed by bare table name only while that name is unique across namespaces.
Example
const layer = deriveDataLayer({
contract: contractJson,
scope: { Portfolio: { portfolio: ['id'] } },
});
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.