import { Executor, ConfigurationProvider, CoreModelDefinition, CoreModel, Context } from "../index"; /** * This class handle NoSQL storage and mapping (duplication) between NoSQL object * TODO Create the mapping documentation * * It use basic CRUD, and can expose those 4 to through HTTP * * It emits events : * Store.Save: Before saving the object * Store.Saved: After saving the object * Store.Update: Before updating the object * Store.Updated: After updating the object * Store.Delete: Before deleting the object * Store.Deleted: After deleting the object * Store.Get: When getting the object * Store.Action: When an action will be done on an object * Store.Actioned: When an action has been done on an object * * Mapping: * * * Parameters * * map: { ... } * expose: { // Enable the HTTP exposure * url: '', // The url to expose to by default it is service name in lowercase ( users for example ) * restrict: { * create: true, // Don't expose the POST /users * update: true, // Don't expose the PUT /users/{uuid} * delete: true, // Don't expose the DELETE /users/{uuid} * get: true // Don't expose the GET /users/{uuid} * } * } */ declare class Store extends Executor implements ConfigurationProvider { _reverseMap: any[]; _cascade: any[]; _writeConditionField: string; _model: CoreModelDefinition; _exposeUrl: string; _lastUpdateField: string; _creationDateField: string; /** @ignore */ normalizeParams(): void; init(): Promise; initRoutes(): void; getUrl(): string; initModel(object: any): T; addReverseMap(prop: any, cascade: any, store: any): void; isMapped(property: string): boolean; _incrementAttribute(uid: any, prop: any, value: any, updateDate: Date): Promise; incrementAttribute(uid: any, prop: any, value: any): Promise; upsertItemToCollection(uid: any, prop: any, item: any, index?: any, itemWriteCondition?: any, itemWriteConditionField?: any): Promise; _handleMapFromPartial(uid: string, updateDate: Date, prop?: string): Promise; _upsertItemToCollection(uid: any, prop: any, item: any, index: any, itemWriteCondition: any, itemWriteConditionField: any, updateDate: Date): Promise; deleteItemFromCollection(uid: any, prop: any, index: any, itemWriteCondition: any, itemWriteConditionField: any): Promise; _deleteItemFromCollection(uid: any, prop: any, index: any, itemWriteCondition: any, itemWriteConditionField: any, updateDate: Date): Promise; initMap(map: any): void; toString(): string; generateUid(): any; /** * Save an object * * @param {Object} Object to save * @param {String} Uuid to use, if not specified take the object.uuid or generate one if not found * @return {Promise} with saved object */ save(object: any, uid?: any): Promise; _save(object: CoreModel, uid: string): Promise; patch(object: any, uid?: string, reverseMap?: boolean): Promise; /** * Update an object * * @param {Object} Object to save * @param {String} Uuid to use, if not specified take the object.uuid or generate one if not found * @param {Boolean} reverseMap internal use only, for disable map resolution * @return {Promise} with saved object */ update(object: any, uid?: string, reverseMap?: boolean, partial?: boolean): Promise; getMapper(map: any, uuid: any): number; removeMapper(map: any, uuid: any): boolean; _handleUpdatedMap(object: any, map: any, mapped: any, store: any, updates: any): Promise; _handleUpdatedMapTransferOut(object: any, map: any, mapped: any, store: any, updates: any): any; _handleUpdatedMapTransferIn(object: any, map: any, store: any, updates: any): any; _handleUpdatedMapMapper(object: any, map: any, mapped: any, store: any, updates: any): any; _handleDeletedMap(object: any, map: any, mapped: any, store: any): any; _handleCreatedMap(object: any, map: any, mapped: any, store: any): any; _handleMapProperty(store: any, object: any, property: any, updates: any): Promise; _removeAttribute(uuid: string, attribute: string): Promise; handleIndex(object: CoreModel, updates: object | string): Promise; handleMap(object: any, map: any, updates: any): Promise; _update(object: any, uid: any, writeCondition?: any): Promise; _patch(object: any, uid: string, writeCondition?: any): Promise; cascadeDelete(obj: any, uuid: string): Promise; /** * Delete an object * * @param {String} uuid to delete * @param {Boolean} delete sync even if asyncDelete is active * @return {Promise} the deletion promise */ delete(uid: any, sync?: boolean): Promise; /** * Check if an object exists * @abstract * @params {String} uuid of the object */ exists(uid: string): Promise; _delete(uid: string, writeCondition?: any): Promise; _get(uid: string): Promise; /** * Get an object * * @param {Array} uuid to gets if undefined then retrieve the all table * @return {Promise} the objects retrieved ( can be [] if not found ) */ getAll(list?: any): Promise; /** * Provide a way to store configuration in store * @param {string} id * @returns {Promise>} */ getConfiguration(id: string): Promise>; /** * Get an object * * @param {String} uuid to get * @return {Promise} the object retrieved ( can be undefined if not found ) */ get(uid: string): Promise; find(request?: any, offset?: number, limit?: number): Promise; _find(request: any, offset: any, limit: any): Promise; httpCreate(ctx: Context): Promise; httpAction(ctx: Context): Promise; httpGlobalAction(ctx: Context): Promise; httpUpdate(ctx: Context): Promise; httpGet(ctx: Context): Promise; httpRoute(ctx: Context): Promise; } export { Store };