UNPKG

reactronic

Version:

Reactronic - Transactional Reactive State Management

67 lines (66 loc) 3.48 kB
import { Kind } from "../Enums.js"; import { SnapshotOptions } from "../Options.js"; import { AbstractChangeset, ObjectVersion, FieldKey, ObjectHandle, ContentFootprint, OperationFootprint } from "./Data.js"; export declare const MAX_REVISION: number; export declare const UNDEFINED_REVISION: number; export declare class Changeset implements AbstractChangeset { static idGen: number; private static stampGen; private static pending; private static oldest; static garbageCollectionSummaryInterval: number; static lastGarbageCollectionSummaryTimestamp: number; static totalObjectHandleCount: number; static totalObjectSnapshotCount: number; readonly id: number; readonly options: SnapshotOptions; readonly parent?: Changeset; get hint(): string; get timestamp(): number; private revision; private bumper; items: Map<ObjectHandle, ObjectVersion>; obsolete: OperationFootprint[]; sealed: boolean; constructor(options: SnapshotOptions | null, parent?: Changeset); static current: () => Changeset; static edit: () => Changeset; static markUsed: (cf: ContentFootprint, ov: ObjectVersion, fk: FieldKey, h: ObjectHandle, kind: Kind, weak: boolean) => void; static markEdited: (oldValue: any, newValue: any, edited: boolean, ov: ObjectVersion, fk: FieldKey, h: ObjectHandle) => void; static tryResolveConflict: (theirValue: any, ourFormerValue: any, ourValue: any) => { isResolved: boolean; resolvedValue: any; }; static propagateAllChangesToListeners: (changeset: Changeset) => void; static discardAllListeners: (changeset: Changeset) => void; static enqueueReactionsToRun: (reactions: Array<OperationFootprint>) => void; lookupObjectVersion(h: ObjectHandle, fk: FieldKey, editing: boolean): ObjectVersion; getObjectVersion(h: ObjectHandle, fk: FieldKey): ObjectVersion; getEditableObjectVersion(h: ObjectHandle, fk: FieldKey, value: any, token?: any): ObjectVersion; setFieldContent(h: ObjectHandle, fk: FieldKey, ov: ObjectVersion, content: any, receiver: any, sensitivity: boolean): void; static takeSnapshot<T>(obj: T): T; static dispose(obj: any): void; static doDispose(ctx: Changeset, h: ObjectHandle): ObjectVersion; private isNewObjectVersionRequired; acquire(outer: Changeset): boolean; bumpBy(timestamp: number): void; rebase(): ObjectVersion[] | undefined; private merge; seal(): void; sealObjectVersion(h: ObjectHandle, ov: ObjectVersion): void; static sealFieldVersion(cf: ContentFootprint | symbol, fk: FieldKey, typeName: string): void; static freezeObjectVersion(ov: ObjectVersion): ObjectVersion; triggerGarbageCollection(): void; private unlinkHistory; static _init(): void; } export declare class Dump { static valueHint: (value: any) => string; static obj(h: ObjectHandle | undefined, fk?: FieldKey | undefined, stamp?: number, changesetId?: number, lastEditorChangesetId?: number, value?: any): string; static snapshot2(h: ObjectHandle, s: AbstractChangeset, fk?: FieldKey, cf?: ContentFootprint): string; static snapshot(ov: ObjectVersion, fk?: FieldKey): string; static conflicts(conflicts: ObjectVersion[]): string; static conflictingMemberHint(fk: FieldKey, ours: ObjectVersion, theirs: ObjectVersion): string; } export declare const EMPTY_OBJECT_VERSION: ObjectVersion; export declare const DefaultSnapshotOptions: SnapshotOptions;