import { Entity, EntityManager, EntityQuery, ExpandClause } from '../breeze.js'; /** * An {@link EntityManager} with `getEntityGraph`, which returns entities together with everything * an expand path reaches from them in the cache, including deleted entities. Importing * `breeze-client/mixin-get-entity-graph` adds the method to every manager, but changes the * prototype rather than the `EntityManager` type, so cast to this type to call it: * * ```ts * import 'breeze-client/mixin-get-entity-graph'; * import type { HasEntityGraph } from 'breeze-client/mixin-get-entity-graph'; * * const graph = (em as HasEntityGraph).getEntityGraph(customer, 'orders.orderDetails'); * ``` */ export interface HasEntityGraph extends EntityManager { /** Get related entities of root entity (or root entities) as specified by expand. @example const graph = (em as HasEntityGraph).getEntityGraph(customer, 'orders.orderDetails'); // the customer, all of its orders, and their details - including deleted ones @param roots {Entity|Array of Entity} The root entity or root entities. @param expand {String|Array of String|Object} an expand string, a query expand clause, or array of string paths @returns {Array of Entity} root entities and their related entities, including deleted entities. Duplicates are removed and entity order is indeterminate. */ getEntityGraph(roots: Entity | Array, expand: string | Array | ExpandClause): Array; /** Execute query locally and return both the query results and their related entities as specified by the optional expand parameter or the query's expand clause. @example const query = EntityQuery.from(Customer) .where('companyName', 'startsWith', 'Alfred') .expand('orders.orderDetails'); const graph = (em as HasEntityGraph).getEntityGraph(query); // the 'Alfred' customers, their orders, and their details - including deleted ones @param query {EntityQuery} A query to be executed against the manager's local cache. @param [expand] {String|Array of String|Object} an expand string, a query expand clause, or array of string paths @returns {Array of Entity} local queried root entities and their related entities, including deleted entities. Duplicates are removed and entity order is indeterminate. */ getEntityGraph(query: EntityQuery, expand?: string | Array | ExpandClause): Array; } /** * Adds `getEntityGraph` to `EntityManager.prototype`. * * Importing this module calls it, so an application only needs the import: * * ```ts * import 'breeze-client/mixin-get-entity-graph'; * import type { HasEntityGraph } from 'breeze-client/mixin-get-entity-graph'; * * const graph = (em as HasEntityGraph).getEntityGraph(customer, 'orders.orderDetails'); * ``` * * Calling it yourself is for a bundler aggressive enough to drop a module imported only for its * effect. This is the one module in the package that `sideEffects` in package.json names for * that reason. * * @param emclass - Accepted for backwards compatibility and not used: the method always goes on * `EntityManager.prototype`. Adding it twice is a no-op. * * @see {@link HasEntityGraph} for the method it adds. */ export declare function mixinEntityGraph(emclass: { new (): EntityManager; }): void;