import { FindOperator } from "./FindOperator"; import { QueryRunner } from ".."; /** * Value of order by in find options. */ export declare type FindOptionsOrderByValue = "ASC" | "DESC" | "asc" | "desc" | 1 | -1 | { direction?: "asc" | "desc" | "ASC" | "DESC"; nulls?: "first" | "last" | "FIRST" | "LAST"; }; /** * Order by find options. */ export declare type FindOptionsOrder = { [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsOrder : E[P] extends Promise ? FindOptionsOrder : E[P] extends object ? FindOptionsOrder : FindOptionsOrderByValue; }; /** * Filters and lefts only object-type properties from the object. * Used in relations find options. */ export declare type FindOptionsRelationKeyName = { [K in keyof E]: E[K] extends object ? K : E[K] extends object | null ? K : E[K] extends object | undefined ? K : never; }[keyof E]; /** * Flattens array type in the object. * Used in relations find options. */ export declare type FindOptionsRelationKey = { [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsRelation | boolean : E[P] extends Promise ? FindOptionsRelation | boolean : FindOptionsRelation | boolean; }; /** * Relations find options. */ export declare type FindOptionsRelation = FindOptionsRelationKeyName[] | FindOptionsRelationKey>>; /** * Select find options. */ export declare type FindOptionsSelect = (keyof E)[] | { [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsSelect | boolean : E[P] extends Promise ? FindOptionsSelect | boolean : E[P] extends object ? FindOptionsSelect | boolean : boolean; }; /** * "where" in find options. */ export declare type FindOptionsWhereCondition = { [P in keyof E]?: E[P] extends (infer R)[] ? FindOptionsWhere | boolean | FindOperator | FindAltOperator : E[P] extends Promise ? FindOptionsWhere | boolean : E[P] extends Object ? FindOperator | FindAltOperator | FindOptionsWhere | boolean : FindOperator | FindAltOperator | E[P]; }; /** * "where" in find options. * Includes "array where" as well. */ export declare type FindOptionsWhere = FindOptionsWhereCondition | FindOptionsWhereCondition[]; /** * Alternative FindOperator syntax. */ export declare type FindAltOperator = { $any: T[] | FindAltOperator; } | { $between: [T, T]; } | { $equal: T | FindAltOperator; } | { $iLike: T | FindAltOperator; } | { $in: T[] | FindAltOperator; } | { $lessThan: T | FindAltOperator; } | { $like: T | FindAltOperator; } | { $moreThan: T | FindAltOperator; } | { $not: T | FindAltOperator; } | { $raw: string; }; /** * Extra options that can be applied to FindOptions. */ export declare type FindExtraOptions = { /** * Indicates if eager relations should be loaded or not. * Enabled by default. */ eagerRelations?: boolean; /** * Indicates if special pagination query shall be applied to the query * if skip or take in conjunction with joins is used. * Enabled by default. */ pagination?: boolean; /** * Indicates if listeners must be executed before and after the query execution. * Enabled by default. */ listeners?: boolean; /** * Indicates if observers must be executed before and after the query execution. * Enabled by default. */ observers?: boolean; /** * If sets to true then loads all relation ids of the entity and maps them into relation values (not relation objects). * If array of strings is given then loads only relation ids of the given properties. */ loadRelationIds?: boolean | { relations?: string[]; disableMixedMap?: boolean; }; /** * Uses provided query runner for query execution. */ queryRunner?: QueryRunner; }; /** * Advanced caching options for FindOptions. */ export declare type FindCacheOptions = { /** * Cache identifier. */ id?: any; /** * Caching time in milliseconds. */ milliseconds?: number; }; /** * Set of criteria and options to return entities by. */ export declare type FindOptions = { /** * Specifies what columns should be selected. * Used for partial selections. */ select?: FindOptionsSelect; /** * Conditions that should be applied to match entities. */ where?: FindOptionsWhere; /** * Order, in which entities should be ordered. */ order?: FindOptionsOrder; /** * Relations that needs to be loaded in a separate SQL queries. * If you have lot of data returned by your query then its more efficient to load it using relations instead of joins. */ relations?: FindOptionsRelation; /** * Query caching options. * Disabled by default. * If set to true then caching is enabled based on global options. * You can also provide a number of milliseconds - caching time. */ cache?: boolean | number | FindCacheOptions; /** * Extra options. */ options?: FindExtraOptions; /** * Offset (paginated) where from entities should be taken. */ skip?: number; /** * Limit (paginated) - max number of entities should be taken. */ take?: number; };