An interface for a path based database for creating and storing values, which is agnostic to the particular type of store in the backend.

interface IModelDB {
    basePath: string;
    collaborators?: ICollaboratorMap;
    connected: Promise<void>;
    isCollaborative: boolean;
    isDisposed: boolean;
    isPrepopulated: boolean;
    createList<T>(path): IObservableUndoableList<T>;
    createMap(path): IObservableJSON;
    createString(path): IObservableString;
    createValue(path): IObservableValue;
    dispose(): void;
    get(path): undefined | IObservable;
    getValue(path): undefined | JSONValue;
    has(path): boolean;
    setValue(path, value): void;
    view(basePath): IModelDB;
}

Hierarchy

Implemented by

Properties

basePath: string

The base path for the IModelDB. This is prepended to all the paths that are passed in to the member functions of the object.

collaborators?: ICollaboratorMap

A map of the currently active collaborators for the database, including the local user.

connected: Promise<void>

A promise that resolves when the database has connected to its backend, if any.

isCollaborative: boolean

Whether the database is collaborative.

isDisposed: boolean

Whether the database has been disposed.

isPrepopulated: boolean

Whether the database has been populated with model values prior to connection.

Methods

  • Whether the IModelDB has an object at this path.

    Parameters

    • path: string

      the path for the object.

    Returns boolean

    a boolean for whether an object is at path.

  • Set a value at a path. That value must already have been created using createValue.

    Parameters

    • path: string

      the path for the value.

    • value: JSONValue

      the new value.

    Returns void

  • Create a view onto a subtree of the model database.

    Parameters

    • basePath: string

      the path for the root of the subtree.

    Returns IModelDB

    an IModelDB with a view onto the original IModelDB, with basePath prepended to all paths.