import { ViewEntity } from '../query-engine.js'; import { DBChanges, PreparedQuery } from '../types.js'; /** * * For each query and its subqueries, find all the relational variables that are referenced in the filters. * This is used in IVM to avoid unnecessary refetching of related data if the controlling variables * are unchanged. */ export declare function getReferencedRelationalVariables(query: PreparedQuery, stack?: PreparedQuery[], results?: Map>): Map>; /** * * For each query and its subqueries, find all the collections that the parent query * or the subquery references in the filters. * * This is used in IVM to determine "given a set of changes, can I avoid * iterating into this query and its subqueries?" * */ export declare function getCollectionsReferencedInSubqueries(query: PreparedQuery, stack?: number[], results?: Map>): Map>; export declare function hasSubqueryFilterAtAnyLevel(query: PreparedQuery): boolean; export declare function hasSubqueryOrderAtAnyLevel(query: PreparedQuery): boolean; /** * The idea here is not to replace inverted views with real values * But _not_ replace any other variables */ export declare function bindViewReferencesInQuery(query: PreparedQuery, views: Record, shouldClone?: boolean): PreparedQuery; export declare function createQueryWithExistsAddedToIncludes(query: PreparedQuery): PreparedQuery; export declare function createQueryWithRelationalOrderAddedToIncludes(query: PreparedQuery): PreparedQuery; /** * This will take two sets of changes and return a set of changes that need to be applied * to the old changes to get the new changes which means modeling missing changes as * deletes * @param oldChanges * @param newChanges */ export declare function diffChanges(oldChanges: DBChanges, newChanges: DBChanges): DBChanges; export declare function queryResultsToChanges(results: ViewEntity[], query: PreparedQuery, changes?: DBChanges): DBChanges;