Skip to main content
Module

x/automerge/stable.ts

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
Go to Latest
import * as automerge from "https://deno.land/x/automerge@2.2.0/stable.ts";

Classes

The most basic CRDT: an integer value that can be changed only by incrementing and decrementing. Since addition of integers is commutative, the value trivially converges.

Functions

Apply changes received from another document

Update the contents of an automerge document

Make a change to the document as it was at a particular point in history

Make a full writable copy of an automerge document

Decode some binary data into a SyncState

Function for use in change which deletes values from a list at a given index

Create a set of patches representing the change from one set of heads to another

Make a change to a document which does not modify the document

encode a SyncState into binary to send over the network

Explicity free the memory backing a document. Note that this is note necessary in environments which support FinalizationRegistry

Create an automerge document from a POJO

Generate a sync message to send to the peer represented by inState

Get the actor ID associated with the document

Get all the changes in a document

Get the changes which are in newState but not in oldState. The returned changes can be loaded in oldState via applyChanges.

Get the conflicts associated with a property

Get the hashes of the heads of this document

Get the binary representation of the last change which was made to this doc

Get any changes in doc which are not dependencies of heads

Return the object ID of an arbitrary javascript value

Create a new automerge document

Create a new, blank SyncState

Function for use in change which inserts values into a list at a given index

Load an automerge document from a compressed document produce by save

Load changes produced by saveIncremental, or partial changes

Merge remote into local

Update a document and our sync state on receiving a sync message

Export the contents of a document to a compressed format

Create binary save data to be appended to a save file or fed into loadIncremental

Make an immutable view of an automerge document as at heads

Interfaces

A List is an extended Array that adds the two helper methods deleteAt and insertAt.

Type Aliases

The type returned from changeAt

Function which is called by change when making changes to a Doc<T>

Options passed to change, and emptyChange

The type of conflicts for particular key or index

An automerge document.

Options to be passed to init or load

Callback which is called by various methods in this library to notify the user of what changes have been made.

An opaque type tracking the state of sync with a remote peer