UNPKG

@webda/core

Version:

Expose API with Lambda

108 lines (107 loc) 2.83 kB
import { CoreModel } from "../models/coremodel.js"; import { Store, StoreFindResult, StoreParameters } from "./store.js"; import { WebdaQL } from "./webdaql/query.js"; declare class FileStoreParameters extends StoreParameters { /** * Local path where to store all `json` files */ folder: string; /** * Parameter sent to JSON.stringify when storing the json */ beautify?: string | number; /** * Disable memory cache * * Useful if several process update storage files * * @default false */ noCache?: boolean; } /** * Simple file storage of object * * Storage structure * /folder/{uuid} * * * Parameters: * folder: to store to * * @category CoreServices * @WebdaModda */ declare class FileStore<T extends CoreModel, K extends FileStoreParameters = FileStoreParameters> extends Store<T, K> { static EXTENSION: string; /** * Load the parameters for a service */ loadParameters(params: any): FileStoreParameters; /** * Create the storage folder if does not exist */ computeParameters(): void; /** * Get the file path of an object * @param uid of the object * @returns */ file(uid: any): string; /** * @override */ _exists(uid: any): Promise<boolean>; /** * @override */ find(query: WebdaQL.Query): Promise<StoreFindResult<T>>; /** * @override */ _save(object: T): Promise<T>; /** * @inheritdoc */ _upsertItemToCollection(uid: string, prop: string, item: any, index: number, itemWriteCondition: any, itemWriteConditionField: string, updateDate: Date): Promise<void>; /** * @inheritdoc */ _removeAttribute(uuid: string, attribute: string, writeCondition?: any, writeConditionField?: string): Promise<void>; /** * @inheritdoc */ _deleteItemFromCollection(uid: string, prop: string, index: number, itemWriteCondition: any, itemWriteConditionField: string, updateDate: Date): Promise<T>; /** * @inheritdoc */ _delete(uid: string): Promise<void>; /** * @inheritdoc */ _patch(object: any, uid: string, writeCondition?: any, writeConditionField?: string): Promise<any>; /** * @override */ _update(object: any, uid: string, writeCondition?: any, writeConditionField?: string): Promise<any>; /** * @override */ getAll(uids?: string[]): Promise<any>; /** * @override */ _get(uid: string, raiseIfNotFound?: boolean): Promise<T>; /** * @override */ _incrementAttributes(uid: string, params: { property: string; value: number; }[], updateDate: Date): Promise<any>; /** * @override */ __clean(): Promise<void>; } export { FileStore };