import type { Knex } from 'knex'; import type { CountResult, ID } from '../types'; import { QueryBuilder } from '../query/query-builder'; export type Data = Record; export type Params = { where?: any; filters?: any; select?: any; populate?: any; orderBy?: any; _q?: string; data?: any; page?: number; pageSize?: number; limit?: number; offset?: number; count?: boolean; }; export type PaginatedResult = { results: any[]; pagination: { page: number; pageSize: number; pageCount: number; total: number; }; }; /** * Populate fragment for the loaded relation, plus the page to load. Required, since the * page defaults are read from it. */ export type LoadPagesParams = Pick & { ordering?: 'asc' | 'desc'; }; export type FindOneParams = Pick; export interface Repository { findOne(params?: FindOneParams): Promise; findMany(params?: Params): Promise; findWithCount(params?: Params): Promise<[any[], number]>; findPage(params: Params): Promise; create(params: Params): Promise; createMany(params: Params): Promise; update(params: Params): Promise; updateMany(params: Params): Promise; delete(params: Params): Promise; deleteMany(params?: Params): Promise; count(params?: Params): Promise; attachRelations(id: ID, data: Data): Promise; updateRelations(id: ID, data: Data): Promise; deleteRelations(id: ID): Promise; populate(entity: Entity, populate: Params['populate']): Promise; load(entity: any, field: string | string[], populate?: Params['populate']): Promise; loadPages(entity: any, field: TField, params: LoadPagesParams): Promise; } export type Entity = { id: ID; [key: string]: any; }; export interface EntityManager { findOne(uid: string, params: Params): Promise; findMany(uid: string, params: Params): Promise; count(uid: string, params?: Params): Promise; create(uid: string, params: Params): Promise; createMany(uid: string, params: Params): Promise; update(uid: string, params: Params): Promise; updateMany(uid: string, params: Params): Promise; delete(uid: string, params: Params): Promise; deleteMany(uid: string, params: Params): Promise; populate(uid: string, entity: Entity, populate: Params['populate']): Promise; load(uid: string, entity: Entity, field: string | string[], populate?: Params['populate']): Promise; attachRelations(uid: string, id: ID, data: any, options?: { transaction?: Knex.Transaction; }): Promise; updateRelations(uid: string, id: ID, data: any, options?: { transaction?: Knex.Transaction; }): Promise; deleteRelations(uid: string, id: ID, options?: { transaction?: Knex.Transaction; }): Promise; deleteManyRelations(uid: string, ids: ID[], options?: { transaction?: Knex.Transaction; }): Promise; insertJoinTableRows(joinTableName: string, rows: Record[], trx: any, options?: { onConflict?: string[]; merge?: string[]; ignore?: boolean; }): Promise; createQueryBuilder(uid: string): QueryBuilder; getRepository(uid: string): Repository; } //# sourceMappingURL=types.d.ts.map