import { IDataClass, IEntity } from '../http/catalog.interfaces'; import { Client } from './client.class'; import { Collection } from './collection.class'; import { IKeyValue } from '../http/http-client.class'; import { Catalog } from './catalog.class'; export declare class Entity { private static client; protected static meta: IDataClass; protected static catalog: Catalog; private static attributes; private _doc; private proxy; private modifiedAttributes; private collection; private index; private _loaded; static bulkSave(entities: any[]): Promise; /** * Proxy handler definition */ private handler; constructor(data: T, className?: string); /** * __COLLECTION accessors */ set __COLLECTION(collection: Collection); get __COLLECTION(): Collection; /** * __INDEX accessors */ set __INDEX(index: number); get __INDEX(): number; /** * (Re)Set the start value for the autosequence number of the datastore class. * @param counter New start value for entity counter */ static setAutoSequenceNumber(counter: number): boolean; /** * Check if a target is an entity * @param target The object to check if it is an instance of an entity */ static isEntity(target: unknown): boolean; /** * Get the current DataClass name */ static getName(): string; /** * Return if an entity is loaded or not */ isLoaded(): boolean; /** * Create an entity collection to preserve wakanda syntax */ static createEntityCollection(): Promise>; /** * Create an entity collection for internal use */ static createEntityColl(): Collection; /** * Query the database by a query string * @param {string} queryString The query string * @param {...any} args List of arguments */ static query(queryString?: string, ...args: any[]): Collection; /** * Finds a specific entity * @param queryString The query string * @param args List of placeholders values */ static find(queryString: string, ...args: any[]): Promise>; /** * Save an entity */ save(): Promise>; /** * Get an attribute value */ get(prop: string): any; /** * Set an attribute value * @param {string} prop The attribute name * @param {any} value The attribute value */ set(prop: string, value: unknown): Entity; /** * Get the key of the current record */ getKey(): string; /** * Get the json presentation of the current entity */ toJSON(): T; /** * Filter the database by a query string * @param {string} queryString The query string * @param {...any} args List of arguments */ static filter(queryString: string): Collection; /** * The statistical calculations on the attribute or list of attributes passed as the parameter * @param attribute * @param distinct */ static compute(attribute: string, distinct?: string): Collection; /** * Method creates an array and returns in it all the distinct values * @param attribute */ static distinctValues(attribute: string): Collection; /** * Method returns the arithmetic average of all the non-null values of attribute * @param attribute */ static average(attribute: string): Collection; /** * Delete an entity */ remove(): Promise; /** * Remove all entities of a given dataclass */ static remove(): Promise; static getByKey(key: string, params?: IKeyValue): Promise>; /** * Returns the first record */ static first(): Promise>; /** * Returns max */ static max(attribute: string): Promise; /** * Returns min */ static min(attribute: string): Promise; /** * count */ static count(): Promise; /** * OrderBy */ static orderBy(order: string): Promise>; /** * Sum */ static sum(attribute: string): Promise; /** * All */ static all(): Promise>; /** * toArray */ static toArray(attrs?: string): Collection; static setClient(client: Client): void; static getClient(): Client; static setMeta(meta: IDataClass): void; static getMeta(): IDataClass; static getAttributes(): Array; static setAttributes(attributes: Array): void; /** * The getTimeStamp method returns the timestamp of the last save of the entity to which it is applied. */ getTimeStamp(): Date; /** * The getStamp( ) method returns the current value of the internal stamp of the entity to which it is applied. */ getStamp(): number; /** * The getModifiedAttributes method returns an array containing the names of attributes that have been modified in the entity */ getModifiedAttributes(): Array; /** * validate */ validate(): Promise; /** * the getDataclass( ) method returns the current dataclass of the entity to which it is applied . */ getDataClass(): typeof Entity; /** * The next method works with the entity iterator. It puts the entity pointer on the next entity within an iteration of entities, for example in a for loop. */ next(): Promise; /** * The isModified method returns True or False depending on whether the entity to which it is applied has been modified since the last time it was loaded from the datastore */ isModified(): boolean; /** * The toSring method returns a string representation of the entity or entity collection */ toString(): string; /** * The toSring method returns a string representation of the entity or entity collection */ static toString(): string; /** * This function creates entities from an array of objects */ static fromArray(arrayToAdd: Array): Promise; /** * The isNew( ) method returns True if the entity to which it is applied has just been * created and has not yet been saved in the datastore. Otherwise, it returns False. */ isNew(): boolean; /** * Loop over all items of the current dataclass * @param cb The callback * @param pageSize Number of elements per page */ static forEach(cb: (item: any, index: number, Entity: any) => void, pageSize?: number): Promise; /** * The release() method releases the entity from memory. */ release(): Entity; /** * Change the lock status of the current entity * @param lock true to lock the current entity, false otherwise */ private setLock; /** * Lock the current entity */ lock(): Promise; /** * Unlock the current entity */ unlock(): Promise; /** * The refresh() method reloads the entity as it is stored in the datastore. */ refresh(): Promise; /** * The importFromJSON() method imports all the entities stored in JSON format from the file(s) located in the importFolder folder. */ static importFromJSON(folder: string): Promise; } //# sourceMappingURL=entity.class.d.ts.map