import { TableBuilder, SchemaDefinition, ExtractColumns, ExtractNavigations } from './table-builder'; import { DbCollection, DbReference, DbNavigationCollection, DbNavigation } from './navigation'; import { CollectionQueryBuilder } from '../query/query-builder'; import { InferColumnType } from './table-builder'; import { FieldRef } from '../query/conditions'; /** * Infer the row type for queries from a table builder * This includes both columns (as FieldRef) and navigation properties (as query builders) */ export type InferRowType> = TBuilder extends TableBuilder ? InferRowTypeFromSchema : never; /** * Infer row type from schema definition */ type InferRowTypeFromSchema = { readonly [K in keyof ExtractColumns]: FieldRef[K]>>; } & { readonly [K in keyof ExtractNavigations]: ExtractNavigations[K] extends DbNavigationCollection ? CollectionQueryBuilder> : ExtractNavigations[K] extends DbNavigation ? InferRowType : ExtractNavigations[K] extends DbCollection ? CollectionQueryBuilder> : ExtractNavigations[K] extends DbReference ? InferRowType : never; }; /** * Infer the data type (actual values) from a table builder */ export type InferDataType> = TBuilder extends TableBuilder ? { [K in keyof ExtractColumns]: ExtractColumns[K] extends infer Col ? InferColumnType : never; } : never; export {}; //# sourceMappingURL=row-type.d.ts.map