Interface ModelConstructor<TData, TVirtual, TInstance, TRelations> interface ModelConstructor < TData extends JsonObject = JsonObject , TVirtual extends JsonObject = JsonObject , TInstance extends ModelInstance < TData , TVirtual > = ModelInstance < TData , TVirtual > , TRelations extends string = string , > { new ModelConstructor ( data ?: Partial < TData & TVirtual > ) : TInstance ; dal : DataAccessLayer ; ops : FilterWhereOperators < TData > ; prototype : TInstance ; schema : Record < string , ModelSchemaField < unknown > > ; tableName : string ; addManyRelated ( relationName : TRelations , sourceId : string , targetIds : string [] , options ?: { onConflict ?: "error" | "ignore" } , ) : Promise < void > ; between ( startDate : Date , endDate : Date , options ?: JsonObject , ) : ModelQueryBuilder < TData , TVirtual , TInstance , TRelations > ; contains ( field : string , value : unknown , ) : ModelQueryBuilder < TData , TVirtual , TInstance , TRelations > ; create ( data : Partial < TData > , options ?: JsonObject ) : Promise < TInstance > ; createFromRow ( row : JsonObject ) : TInstance ; define ( name : string , handler : InstanceMethod < TInstance > ) : void ; defineRelation ( name : string , config : JsonObject ) : void ; defineView < TView extends JsonObject = JsonObject > ( name : string , definition : ModelViewDefinition < TInstance , TView > , ) : void ; delete ( id : string ) : Promise < boolean > ; fetchView < TView extends JsonObject = JsonObject > ( name : string , options ?: ModelViewFetchOptions < TData , TVirtual , TInstance , TRelations > , ) : Promise < TView [] > ; filterWhere ( criteria : Partial < { [ K in string | number | symbol ] : | TData [ K ] | OperatorResultForKey < FilterWhereOperators < TData > , K > } , > , ) : FilterWhereQueryBuilder < TData , TVirtual , TInstance , TRelations > ; get ( id : string , options ?: GetOptions ) : Promise < TInstance > ; getAll ( ... ids : string [] ) : Promise < TInstance [] > ; getJoin ( joinSpec : Partial < Record < TRelations , boolean | JsonObject > > , ) : ModelQueryBuilder < TData , TVirtual , TInstance , TRelations > ; getMultipleNotStaleOrDeleted ( ids : string [] , ) : ModelQueryBuilder < TData , TVirtual , TInstance , TRelations > ; getView < TView extends JsonObject = JsonObject > ( name : string , ) : ModelViewDefinition < TInstance , TView > ; limit ( count : number , ) : ModelQueryBuilder < TData , TVirtual , TInstance , TRelations > ; loadManyRelated ( relationName : TRelations , sourceIds : string [] , ) : Promise < Map < string , ModelInstance < JsonObject , JsonObject > [] > > ; orderBy ( field : string , direction ?: "ASC" | "DESC" , ) : ModelQueryBuilder < TData , TVirtual , TInstance , TRelations > ; update ( id : string , data : Partial < TData > ) : Promise < TInstance > ; [ key : string ]: unknown ; } Constructors Propertiestable Name tableName : string
Methodsadd Many Related addManyRelated ( relationName : TRelations , sourceId : string , targetIds : string [] , options ?: { onConflict ?: "error" | "ignore" } , ) : Promise < void > Parameters relationName : TRelations sourceId : string targetIds : string [] Optionaloptions : { onConflict ?: "error" | "ignore" } Returns Promise < void > between Parameters startDate : Date endDate : Date Optionaloptions : JsonObject contains Parameters field : string value : unknown define Relation defineRelation ( name : string , config : JsonObject ) : void delete delete ( id : string ) : Promise < boolean > get All getAll ( ... ids : string [] ) : Promise < TInstance [] > get Multiple Not Stale Or Deleted order By Parameters field : string Optionaldirection : "ASC" | "DESC" update Parameters id : string data : Partial < TData >
Runtime constructor exported by each manifest. It exposes the DAL's static helpers (
create,get,filterWhere, etc.) while producing instances typed as ModelInstance. Individual models extend this interface with their own static methods throughThisTypein the manifest definition.