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.81 kB
TypeScript
/**
* 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 type_def Type definition for determining property
*/
export declare function assignTrackedAccessors(Target: any, type_def: any): void;
export declare class GenericTrackedObject {
#private;
constructor(source_object: any);
getRecord(): any;
setRecord(record: any): void;
getChanges(): any;
_setChanges(changes: any): 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, target_resource: any, attributes: any): void;
export declare const NOT_COPIED_YET: {};
export declare function withoutCopying(callback: any): any;
export declare class Addition {
value: any;
__op__: string;
constructor(value: any);
update(previous_value: any): any;
}