import { type Constructor } from "@decaf-ts/decoration"; import { Model, type ModelConstructor } from "@decaf-ts/decorator-validation"; import { type Repo } from "../repository/Repository"; import { Service } from "./services"; import type { AllOperationKeys, ContextOf, EventIds, ObserverFilter, PersistenceObservable, PersistenceObserver } from "../persistence/types"; import { type IRepository, type PrimaryKeyType } from "@decaf-ts/db-decorators"; import type { ContextualArgs, ContextualizedArgs, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass"; import { OrderDirection } from "../repository/constants"; import { type DirectionLimitOffset } from "../query/types"; import { type Observer } from "../interfaces"; export type ArrayMode = "one" | "many"; export declare class ModelService, R extends Repo = Repo> extends Service implements IRepository>, PersistenceObservable>, PersistenceObserver> { private readonly clazz; protected _repository: R; get class(): Constructor; get repo(): R; constructor(clazz: Constructor, name?: string); static getService, S extends ModelService>(name: string | symbol | Constructor): S; for(conf: any, ...args: any[]): this; create(model: M, ...args: MaybeContextualArg>): Promise; createAll(models: M[], ...args: MaybeContextualArg>): Promise; delete(key: PrimaryKeyType, ...args: MaybeContextualArg>): Promise; deleteAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg>): Promise; read(key: PrimaryKeyType, ...args: MaybeContextualArg>): Promise; readAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg>): Promise; query(methodName: string, ...args: unknown[]): Promise; update(model: M, ...args: MaybeContextualArg>): Promise; updateAll(models: M[], ...args: any[]): Promise; listBy(key: keyof M, order: OrderDirection, ...args: MaybeContextualArg>): Promise; paginateBy(key: keyof M, order: OrderDirection, ref: Omit, ...args: MaybeContextualArg>): Promise>; findOneBy(key: keyof M, value: any, ...args: MaybeContextualArg>): Promise; findBy(key: keyof M, value: any, ...args: MaybeContextualArg>): Promise; statement(name: string, ...args: MaybeContextualArg>): Promise; static forModel, S extends ModelService>(this: new (model: ModelConstructor) => S, model: ModelConstructor, alias?: string | symbol): S; refresh(table: Constructor, event: AllOperationKeys, id: EventIds, ...args: ContextualArgs>): Promise; observe(observer: Observer, filter?: ObserverFilter): void; unObserve(observer: Observer): void; updateObservers(model: Constructor, operation: AllOperationKeys, ids: EventIds, ...args: ContextualArgs>): Promise; protected logCtx(args: MaybeContextualArg, ARGS>, operation: METHOD): ContextualizedArgs, ARGS, METHOD extends string ? true : false>; protected logCtx(args: MaybeContextualArg, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs, ARGS, METHOD extends string ? true : false>; protected logCtx(args: MaybeContextualArg, ARGS>, operation: METHOD, allowCreate: true): Promise, ARGS, METHOD extends string ? true : false>>; }