import { ToStringable } from "../util"; import { EntityType, IEntity } from "../metadata"; import { Expansion } from "./expansion"; import { Extraction } from "./extraction"; import { Identity, ByIndexes } from "./identity"; import { Filter } from "./filter"; /** * Describes which entities and expansions should be considered for an operation. * * Immutable */ export declare class Query { /** * The entity type operated on. */ readonly entityType: EntityType; /** * Idenfitication of the set of entities operated on. */ readonly identity: Identity; /** * Included navigations for the operation. */ readonly expansions: ReadonlyArray; /** * The full expansion string of this query. */ readonly expansion: string; /** * Number of all expansions (including nested). */ readonly numExpansions: number; readonly filter?: Filter; /** * Extending this class and trying to use it will lead to random exceptions. */ constructor(args: { entityType: EntityType; identity: Identity; expand?: string | ArrayLike; filter?: Filter; }); /** * If this query points to a bigger or equal set of entities. */ isSupersetOf(other: Query): boolean; /** * If this query points to a lesser or equal set of entities. */ isSubsetOf(other: Query): boolean; /** * Reduce another query, trying to make its resulting set smaller. * * Returns the reduced query, or null if it was completely reduced. */ reduce(other: Query): Query; /** * Returns a query with all expansions matching the given predicate missing * and the expansions extracted in the process. * * Extractions are not applied recursively on extraced expansions. */ extract(predicate: (p: Expansion) => boolean): [Query, Extraction[]]; toString(): string; /** * Create a query pointing to all entities with an optional expansion & filter. */ static All(args: { entity: EntityType; expand?: string | ArrayLike; filter?: Filter.Criteria; }): Query; /** * Create a query pointing to entities with matching primary keys with an optional expansion & filter. */ static ByIds(args: { entity: EntityType; ids: ArrayLike; expand?: string | ArrayLike; filter?: Filter.Criteria; }): Query; /** * Create a query pointing to entities with matching indexed values with an optional expansion & filter. */ static ByIndexes(args: { entity: EntityType; criteria: ByIndexes.Criteria; expand?: string | ArrayLike; filter?: Filter.Criteria; }): Query; }