UNPKG

harperdb

Version:

HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.

50 lines (49 loc) 1.89 kB
/** * A tracked class cacheable, (potentially) frozen read-only record, designed to facilitate record updates, * and tracks property (and sub-object/array) changes so that on commit, any property changes can be written as part of * the commit. This will also track specific updates so can record information in CRDTs. */ /** * assignObjectAccessors add methods to the prototype of the provided Target class to make * it a tracked object. * @param Target Class to add accessors to * @param typeDef Type definition for determining property */ export declare function assignTrackedAccessors(Target: any, typeDef: any, useFullPropertyProxy?: boolean): void; export declare class GenericTrackedObject<T extends object = any> { #private; constructor(sourceObject?: GenericTrackedObject<T> | T); getRecord(): T; setRecord(record: T): void; getChanges(): Partial<T>; _setChanges(changes: Partial<T>): void; } /** * Collapse the changed and transitive and source/record data into single object that * can be directly serialized. Performed recursively * @param target * @returns */ export declare function collapseData(target: any): any; /** * Collapse the changed data and source/record data into single object * that is frozen and suitable for storage and caching * @param target * @returns */ export declare function updateAndFreeze(target: any, changes?: any): any; /** * Determine if any changes have been made to this tracked object * @param target * @returns */ export declare function hasChanges(target: any): boolean; export declare function copyRecord(record: any, targetResource: any, attributes: any): void; export declare const NOT_COPIED_YET: {}; export declare function withoutCopying(callback: any): any; export declare class Addition { __op__: string; value: any; constructor(value: any); update(previousValue: any): any; }