@dxos/react-client
    Preparing search index...

    Interface Database

    ECHO Database interface.

    interface Database {
        "[TypeId]": typeof Database.TypeId;
        query: QueryFn;
        get graph(): Hypergraph;
        get schemaRegistry(): SchemaRegistry;
        get spaceId(): SpaceId;
        add<T extends Entity.Unknown = Entity.Unknown>(
            obj: T,
            opts?: AddOptions,
        ): T;
        flush(opts?: FlushOptions): Promise<void>;
        getObjectById<T extends Unknown = Obj<AnyProperties>>(
            id: string,
            opts?: GetObjectByIdOptions,
        ): undefined | T;
        makeRef<T extends Entity.Unknown = Entity.Unknown>(dxn: DXN): Ref<T>;
        remove(obj: Entity.Unknown): void;
        toJSON(): object;
    }

    Hierarchy (View Summary)

    Index

    Properties

    "[TypeId]": typeof Database.TypeId
    query: QueryFn

    Query objects.

    Accessors

    • get graph(): Hypergraph

      Returns Hypergraph

    • get schemaRegistry(): SchemaRegistry

      Returns SchemaRegistry

    • get spaceId(): SpaceId

      Returns SpaceId

    Methods

    • Wait for all pending changes to be saved to disk. Optionaly waits for changes to be propagated to indexes and event handlers.

      Parameters

      Returns Promise<void>

    • Return object by local ID.

      Type Parameters

      • T extends Unknown = Obj<AnyProperties>

      Parameters

      Returns undefined | T

    • Creates a reference to an existing object in the database.

      NOTE: The reference may be dangling if the object is not present in the database. NOTE: Difference from Ref.fromDXN Ref.fromDXN(dxn) returns an unhydrated reference. The .load and .target APIs will not work. db.makeRef(dxn) is preferable in cases with access to the database.

      Type Parameters

      Parameters

      • dxn: DXN

      Returns Ref<T>

    • Removes object from the database.

      Parameters

      Returns void

    • Returns object