import { IEntity, IDataClass, ICollection, ICollectionCache } from '../http/catalog.interfaces'; import { IRequest } from '../http/http-client.class'; import { Client } from './client.class'; import { Entity } from './entity.class'; import { Catalog } from './catalog.class'; export declare class Collection { private meta; private catalog; private client; private parent; private cache; private subUrl; protected current: ICollection>; request: IRequest; length: number; queryPlan: any; queryPath: any; constructor(meta: IDataClass, client: Client, catalog: Catalog, request?: IRequest); /** * Reset the collection request */ reset(): void; /** * Check if a target is a collection * @param target The object to check if it is an instance of a collection */ static isCollection(target: unknown): boolean; /** * Checks if a body is a collection * @param {any} body The body to check */ static isCollectionLike(body: unknown): boolean; /** * Executes the query * * ####Examples: * * const promise = query.exec(); * * @return {Promise} * @api public */ exec(): Promise>; /** * fill the cache object with the current collection * @param collection */ setCache(page: number, collection: Collection): Collection; /** * get the cache object */ getCache(): ICollectionCache; /** * Sort the collection using a specific atttribute * @param order The attribute to sort with */ orderBy(order: string): Collection; /** * Expand related attributes * @param attributes List of attributes to expand */ expand(...attributes: string[]): Collection; /** * Select attributes * @param attributes List of attributes to select */ select(...attributes: string[]): Collection; /** * Skip a number of records * @param nb Number of records to skip */ skip(nb: number): Collection; /** * Limit number of records to return * @param nb Number of records to return */ limit(nb: number): Collection; /** * creates and returns a JavaScript array where each element is an object * containing a set of properties and values corresponding to the attribute * names and values for a datastore class or an entity collection. * @param attrs a string containing the attribute names or paths that belong to the datastore class */ toArray(attrs?: string): Collection; /** * Get the entity set key from the entity set URL */ getKey(): string; /** * Count number of records in the current collection */ count(): Promise; /** * Get the first item of the collection */ first(): Promise>; /** * Loop over all items of the current collection * @param cb The callback * @param pageSize Number of elements per page */ forEach(cb: (item: Entity, index: number, Collection: any) => void, pageSize?: number): Promise>; /** * Implementation of the async iterator over the collection */ [Symbol.asyncIterator](): AsyncIterator>; /** * Query by a query string * @param {string} queryString The query string * @param {...any} args List of arguments */ query(queryString?: string, ...args: any[]): Collection; /** * Release a collection */ release(): Promise; /** * Find by a query string * @param {string} queryString The query string * @param {...any} args List of arguments */ find(queryString: string, ...args: any[]): Promise>; /** * Remove all items of the current collection */ remove(): Promise; /** * Get the dataclass of the current collection */ getDataClass(): typeof Entity; /** * Sum the values of an attribute of the current collection * @param attribute Attribute that will be used to calculate the sum */ sum(attribute: string): Promise; /** * Calculate the max value of an attribute of the current collection * @param attribute Attribute that will be used to calculate the max */ max(attribute: string): Promise; /** * Calculate the min value of an attribute of the current collection * @param attribute Attribute that will be used to calculate the min */ min(attribute: string): Promise; /** * Method creates an array and returns in it all the distinct values * @param attribute */ distinctValues(attribute: string): Collection; /** * filter by a string * @param {string} queryString The query string */ filter(queryString: string): Collection; /** * Returns the query plan as it was passed */ getQueryPath(): Collection; /** * Returns the query as it was executed */ getQueryPlan(): Collection; /** * Method returns the arithmetic average of all the non-null values of attribute * @param attribute */ average(attribute: string): Collection; /** * The statistical calculations on the attribute or list of attributes passed as the parameter * @param attribute * @param distinct */ compute(attribute: string, distinct?: string): Collection; /** * Method compares the entity collection to which it is applied and the collection2 and returns a new entity collection * @param collectionOrEntity */ and(secondOperator: Collection | Entity): Promise>; /** * Method creates a new entity collection that contains all the entities from the entity collection * to which it is applied and all the entities from the collection2 entity collection * @param collectionOrEntity */ or(secondOperator: Collection | Entity): Promise>; /** * Method excludes from the entity collection to which it is applied the entities that are in the * collection2 and returns the resulting entity collection * @param collectionOrEntity */ minus(secondOperator: Collection | Entity): Promise>; /** * Method creates a new entity collection that contains all the entities from the entity collection * to which it is applied and all the entities from the collection2 entity collection * @param collectionOrEntity */ add(secondOperator: Collection | Entity): Promise>; /** * create entity collection and gets it's "__ENTITYSET" ID * @param entity */ private create; /** * The all( ) method returns an object of type EntityCollection containing all * the entities in the datastore class to which it was applied. * @param collection */ all(): Collection; /** * Use toString method to get a string representation of the data in the entities. */ toString(): Array; get(index: number): Promise>; /** * creates and returns a array of json entities where each element is an object * containing a set of properties and values corresponding to the attribute * names and values for a datastore class or an entity collection. * @param attrs a string containing the attribute names or paths that belong to the datastore class */ toJSON(): Promise>; } //# sourceMappingURL=collection.class.d.ts.map