import { Class } from '@spinajs/di'; import { SchemaProvider } from '@spinajs/validation'; import { IModelDescriptor } from './interfaces.js'; /** * Resolves an ORM model name to its column schema plus relations. A name → model * class map is built once at initialization (see `resolve`) and reused on every * lookup, so we don't rescan the `'__models__'` registry per call. */ export declare class ModelSchemaProvider extends SchemaProvider { protected Models: Map>; resolve(): void; getSchema(typeName: string): Record | undefined; /** * The same set of columns as `getSchema`, but WITHOUT `required`, without the `@Hidden()` * columns, and with the types this driver really returns (`descriptor.ResponseSchema`). * * A response is partial by nature: `dehydrateWithRelations({ skipUndefined: true })` drops * fields the query did not load, and `include` decides which relations show up at all. The * list of required columns describes an INSERT, not what goes out to the client - published * on a response it breaks validation on the first row that has no password or no relation. * * @param typeName - the model class name */ getResponseSchema(typeName: string): Record | undefined; /** * The model's columns plus its relations as properties. `includeRequired` distinguishes * the write contract (getSchema) from the read one (getResponseSchema). * * @param typeName - the model class name * @param includeRequired - whether to include the list of required columns (write contract) */ protected buildSchema(typeName: string, includeRequired: boolean): Record | undefined; /** * The read schema off the descriptor. `Orm.reloadTableInfo` builds it alongside `Schema`; * when it is absent (the model never got a connection, or the descriptor was assembled by * hand in a test) we fall back to `Schema` and strip from it what a response never carries * anyway - the `@Hidden()` columns. Describing a read with the write contract beats not * describing it at all. * * @param descriptor - the model descriptor */ protected responseColumns(descriptor: IModelDescriptor | undefined): { properties?: Record; required?: string[]; } | undefined; } //# sourceMappingURL=schema-providers.d.ts.map