import { getWithDefault } from "../objects/get-with-default";
import { searchCatalogs } from "./searchCatalogs";
/**
 * Given an entity, execute a search on all the catalogs, and their associated with the entity
 * If the entity has no catalogs, an empty array is returned
 * If passed an IQuery, only collections using the same targetEntity will be searched
 * If passed a string, a query will be executed on all collections in all catalogs
 * @param entity
 * @param query - string or IQuery
 * @param options - IPagingOptions & ISortOptions - only num is used
 * @param context
 * @returns
 */
export async function searchEntityCatalogs(entity, query, options, context) {
    // collect all the catalogs from the entity, and search them
    const catalogs = getWithDefault(entity, "catalogs", []);
    return searchCatalogs(catalogs, query, options, context);
}
//# sourceMappingURL=searchEntityCatalogs.js.map