import { EntityType, Navigation } from "../metadata"; import { Path } from "./path"; import { Extraction } from "./extraction"; /** * An expansion defines which navigations should be considered for execution * by representing them in a tree-like structure. * * * Create one by using Expansion.parse() * * Compare expansions via equals(), isSupersetOf(), isSubsetOf() * * Create modified versions via add(), minus(), extract() * * Immutable */ export declare class Expansion { /** * The navigation that is being expanded. */ readonly property: Navigation; /** * Further expansions on the navigation. */ readonly expansions: ReadonlyArray; /** * Number of all expansions (including nested). */ readonly numExpansions: number; /** * Is lazily evaluated @ toString() */ private _toStringValue; private constructor(); /** * Equality comparison between two queries by checking equality of their string representations. */ static equals(a: Expansion, b: Expansion): boolean; /** * Determines if x is a superset of y, securing that an operation using expansion(s) x * leads to a superset of y if the same operation were to be used with expansion(s) y. */ static isSuperset(x: Expansion, y: Expansion): boolean; static isSuperset(x: ArrayLike, y: ArrayLike): boolean; /** * Merges (?) two expansions together. */ static add(x: ArrayLike, y: ArrayLike): Expansion[]; /** * Subtracts y from x. */ static minus(x: ArrayLike, y: ArrayLike): Expansion[]; /** * Create expansions starting at ownerType, crawling down * navigations as defined in the expansion string. * * Expansion string may contain spaces and newlines. * * Example: Expansion.parse(artistMetadata, "albums/{songs,tags}") */ static parse(ownerType: EntityType, expansion: string): Expansion[]; /** * Parses a single expansion string that may contain nested expansions. */ private static _parse(ownerType, expansion); /** * Split a string that may contain multiple expansions into single expansion strings. */ private static _splitExpansions(str); /** * Determines if this is a superset of 'other', securing that an operation on this expansion * leads to a superset of 'other' when using the same operation on 'other'. */ isSupersetOf(other: Expansion): boolean; isSubsetOf(other: Expansion): boolean; /** * If this expansion equals another expansion (string representation is used for equality check). */ equals(other: Expansion): boolean; /** * Extract expansions that match the predicate. Children of extracted expansions are not extracted again. * * Returns the reduced expansion and the extractions. */ extract(predicate: (p: Expansion) => boolean): [Expansion, Extraction[]]; /** * Returns a flattened representation of this expansion. */ toPaths(): Path[]; toString(): string; }