import { ToStringable } from "../util"; /** * An Identity points to a specific set of entities. */ export declare type Identity = All | ByIds | ByIndexes; /** * All the types of identities. */ export declare type Identities = Identity["type"]; /** * Common code of identities. */ export declare abstract class IdentityBase { abstract type: any; /** * How likely it is to reduce another identity (lower is better). */ abstract priority: any; /** * Reduce another identity, trying to make its resulting set smaller. */ abstract reduce(other: Identity): Identity; protected _toString: string; constructor(toString?: string); /** * If this identity points to a bigger or equal set of entities. */ isSupersetOf(other: Identity): boolean; /** * If this identity points to a lesser or equal set of entities. */ isSubsetOf(other: Identity): boolean; /** * If this identity points to the same set of entities. */ equals(other: Identity): boolean; toString(): string; } /** * Points to all entities. */ export declare class All extends IdentityBase { readonly type: "all"; /** @inheritdoc */ readonly priority: number; constructor(); /** @inheritdoc */ reduce(other: Identity): Identity | null; } /** * Points a set of entities specified by their primary keys. */ export declare class ByIds extends IdentityBase { readonly type: "ids"; /** @inheritdoc */ readonly priority: number; readonly ids: ReadonlyArray; constructor(ids: ArrayLike); /** @inheritdoc */ reduce(other: Identity): Identity | null; } /** * Points to a set of entities specified by the values of indexed properties. */ export declare class ByIndexes extends IdentityBase { readonly type: "indexes"; /** @inheritdoc */ readonly priority: number; /** * Specific values indexed properties of entities must have. */ readonly criteria: Readonly; constructor(criteria: ByIndexes.Criteria); /** @inheritdoc */ reduce(other: Identity): Identity | null; } export declare module ByIndexes { /** * Specific values indexed properties of entities must have. */ type Criteria = { [key: string]: ToStringable; }; }