import type { Dictionary, EntityMetadata, EntityName, EntityProperty, FilterDef, FilterQuery } from '../typings.js'; import { type QueryOrderMap } from '../enums.js'; import type { Platform } from '../platforms/Platform.js'; import type { MetadataStorage } from '../metadata/MetadataStorage.js'; import type { FilterOptions } from '../drivers/IDatabaseDriver.js'; /** @internal */ export declare class QueryHelper { static readonly SUPPORTED_OPERATORS: string[]; /** * True when the property has multiple polymorph target types. Covers two structurally-equivalent * shapes routed through the same loading path: * 1. Union-target owner side — `Post.attachments: Collection` (one owner, many * target types, shared pivot with target-side discriminator). * 2. Merged inverse of Rails-style polymorphic M:N — `Tag.owners: Collection` * (many owner types pointing at one target, viewed from the target where "owners" looks * like a union of multiple types). * * Both cases are loaded via `loadFromUnionTargetPolymorphicPivotTable`, which buckets pivot rows * by discriminator and hydrates each target class separately. */ static isUnionTargetPolymorphic(prop: { polymorphic?: boolean; polymorphTargets?: readonly unknown[]; }): boolean; /** * Finds the discriminator value (key) for a given entity class in a discriminator map. * Walks up the prototype chain so TPT subclasses resolve to their root's key. */ static findDiscriminatorValue(discriminatorMap: Dictionary, targetClass: T): string | undefined; static processParams(params: unknown): any; static processObjectParams(params?: T): T; /** * converts `{ account: { $or: [ [Object], [Object] ] } }` * to `{ $or: [ { account: [Object] }, { account: [Object] } ] }` */ static liftGroupOperators(where: Dictionary, meta: EntityMetadata, metadata: MetadataStorage, key?: string): string | undefined; static inlinePrimaryKeyObjects(where: Dictionary, meta: EntityMetadata, metadata: MetadataStorage, key?: string): boolean; static processWhere(options: ProcessWhereOptions): FilterQuery; static getActiveFilters(meta: EntityMetadata, options: FilterOptions | undefined, filters: Dictionary): FilterDef[]; /** @internal Sentinel wrapping for arguments accessed while statically resolving an `rls` filter condition. */ static readonly RLS_SENTINEL_PREFIX = "__mikro_rls_arg__"; /** @internal */ static readonly RLS_SENTINEL_SUFFIX = "__"; /** * Resolves an `rls` filter's condition to a static `FilterQuery`. Function conditions are called with a proxy `args` * that yields a unique sentinel per accessed argument, real `type`/`entityName` strings (validated to not affect the * result), and a poison proxy or `undefined` for the remaining runtime-only parameters. * * @internal */ static resolveRlsFilterCond(filter: FilterDef, accessed: Set, entityName?: string): Dictionary; static mergePropertyFilters(propFilters: FilterOptions | undefined, options: FilterOptions | undefined): FilterOptions | undefined; static isFilterActive(meta: EntityMetadata, filterName: string, filter: FilterDef, options: Dictionary): boolean; static processCustomType(prop: EntityProperty, cond: FilterQuery, platform: Platform, key?: string, fromQuery?: boolean): FilterQuery; /** * Composite PK conditions are keyed by a hash of all the PK names, which `findProperty` cannot * resolve, so the custom types have to be applied positionally instead. */ private static processCompositeCustomTypes; private static isSupportedOperator; private static processJsonCondition; static findProperty(fieldName: string, options: ProcessWhereOptions): EntityProperty | undefined; /** * Converts entity references for composite FK properties into flat arrays * of correctly-ordered join column values, before processParams flattens them * incorrectly due to shared FK columns. */ private static convertCompositeEntityRefs; /** * Extracts values for a FK's join columns from an entity by traversing the FK chain. * Handles shared FK columns (e.g., tenant_id referenced by multiple FKs) correctly. */ private static extractJoinColumnValues; /** * Expands a polymorphic entity reference to `[discriminatorValue, ...joinColumnValues]`, * matching the column order of `prop.fieldNames`. */ private static extractPolymorphicJoinColumnValues; /** * Extracts the value for a specific column from an entity by finding which PK property * owns that column and recursively traversing FK references. */ private static extractColumnValue; /** * Merges multiple orderBy sources with key-level deduplication (first-seen key wins). * RawQueryFragment symbol keys are never deduped (each is unique). */ static mergeOrderBy(...sources: (QueryOrderMap | QueryOrderMap[] | undefined)[]): QueryOrderMap[]; } interface ProcessWhereOptions { where: FilterQuery; entityName: EntityName; metadata: MetadataStorage; platform: Platform; aliased?: boolean; aliasMap?: Dictionary; convertCustomTypes?: boolean; root?: boolean; type?: 'where' | 'orderBy'; } export {};