import { DirectionLimitOffset, OrderDirection, Repository } from "@decaf-ts/core"; import type { ContextOf, MaybeContextualArg, SerializedPage } from "@decaf-ts/core"; import { Model } from "@decaf-ts/decorator-validation"; import { Constructor } from "@decaf-ts/decoration"; import { HttpAdapter } from "./adapter"; /** * @description Repository for REST API interactions * @summary A specialized repository implementation for interacting with REST APIs. * This class extends the core Repository class and works with HTTP adapters to * provide CRUD operations for models via REST endpoints. * This Is NOT the default repository for the HTTP adapter. That would be {@link RestService}. * Use this only in the specific case of needing to run the CURD model logic (decoration) before submitting to the backend * @template M - The model type, extending Model * @template Q - The query type used by the adapter * @template A - The HTTP adapter type, extending HttpAdapter * @template F - The HTTP flags type, extending HttpFlags * @template C - The context type, extending Context * @param {A} adapter - The HTTP adapter instance * @param {Constructor} [clazz] - Optional constructor for the model class * @class RestRepository * @example * ```typescript * // Create a repository for User model with Axios adapter * const axiosAdapter = new AxiosAdapter({ * protocol: 'https', * host: 'api.example.com' * }); * const userRepository = new RestRepository(axiosAdapter, User); * * // Use the repository for CRUD operations * const user = await userRepository.findById('123'); * ``` * @see {@link RestService} */ export declare class RestRepository, Q = A extends HttpAdapter ? Q : never> extends Repository { protected _overrides: Partial>> & { allowRawStatements: boolean; forcePrepareSimpleQueries: boolean; forcePrepareComplexQueries: boolean; }; constructor(adapter: A, clazz?: Constructor); url(tableName: string | Constructor): string; url(tableName: string | Constructor, pathParams: string[]): string; url(tableName: string | Constructor, queryParams: Record | undefined): string; paginateBy(key: keyof M, order: OrderDirection, ref?: Omit, ...args: MaybeContextualArg>): Promise>; listBy(key: keyof M, order: OrderDirection, ...args: MaybeContextualArg>): Promise; findBy(key: keyof M, value: any, ...args: MaybeContextualArg>): Promise; findOneBy(key: keyof M, value: any, ...args: MaybeContextualArg>): Promise; find(value: string, order?: OrderDirection, ...args: MaybeContextualArg>): Promise; page(value: string, direction?: OrderDirection, ref?: Omit, ...args: MaybeContextualArg>): Promise>; statement(name: string, ...args: MaybeContextualArg>): Promise; private convertStatementResult; private convertPageResult; private revertRecord; request(details: Q, ...args: MaybeContextualArg>): Promise; countOf(key?: keyof M, ...args: MaybeContextualArg>): Promise; maxOf(key: K, ...args: MaybeContextualArg>): Promise; minOf(key: K, ...args: MaybeContextualArg>): Promise; avgOf(key: K, ...args: MaybeContextualArg>): Promise; sumOf(key: K, ...args: MaybeContextualArg>): Promise; distinctOf(key: K, ...args: MaybeContextualArg>): Promise; groupOf(key: K, ...args: MaybeContextualArg>): Promise>; }