Skip to content

Document Lifecycle

Create, save, load, and manage Automerge documents

am_create()
Create a new Automerge document
am_load()
Load an Automerge document from binary format
am_save()
Save an Automerge document to binary format
am_fork()
Fork an Automerge document
am_merge()
Merge changes from another document
am_commit()
Commit pending changes
am_rollback()
Roll back pending operations
am_close()
Close an Automerge document
am_clone()
Clone an Automerge document
am_equal()
Test document equality
am_pending_ops()
Get the number of pending operations
am_commit_empty()
Create an empty change
am_save_incremental()
Save incremental changes
am_load_incremental()
Load incremental changes into a document

Actor Management

Get and set actor IDs

am_get_actor()
Get the actor ID of a document
am_get_actor_hex()
Get the actor ID as a hex string
am_set_actor()
Set the actor ID of a document

Object Operations

Create and manipulate maps, lists, and nested objects

am_put()
Put a value into an Automerge map or list
am_get()
Get a value from an Automerge map or list
am_delete()
Delete a key from a map or element from a list
am_insert()
Insert a value into an Automerge list
am_keys()
Get all keys from an Automerge map
am_values()
Get all values from a map or list
am_length()
Get the length of an Automerge map or list
am_items()
Get full item details from an object
am_list_range()
Get a range of list items
am_map_range()
Get a range of map items by key
am_list_get_all()
Get all conflicting values at a list position
am_map_get_all()
Get all conflicting values at a map key

Text Operations

Work with collaborative text objects

am_text()
Create an Automerge text object
am_text_content()
Get text content from a text object
am_text_splice()
Splice text in a text object
am_text_update()
Update text content
as.character(<am_text>)
Convert text object to character string

Counters

Create and increment CRDT counters

am_counter()
Create an Automerge counter
am_counter_increment()
Increment a counter value

Cursors and Marks

Stable positions, text formatting, and cursor serialization

am_cursor()
Create a cursor at a position in a text object
am_cursor_position()
Get the current position of a cursor
am_cursor_to_bytes()
Serialize a cursor to bytes
am_cursor_from_bytes()
Restore a cursor from bytes
am_cursor_to_string()
Serialize a cursor to a string
am_cursor_from_string()
Restore a cursor from a string
am_cursor_equal()
Test equality of two cursors
am_mark()
Create a mark on a text range
am_mark_clear()
Clear marks from a text range
am_marks()
Get all marks in a text object
am_marks_at()
Get marks at a specific position

Synchronization

Sync documents across peers

am_sync()
Bidirectional synchronization
am_sync_state()
Create a new sync state
am_sync_encode()
Generate a sync message
am_sync_decode()
Receive and apply a sync message
am_sync_state_encode()
Serialize a sync state
am_sync_state_decode()
Deserialize a sync state

History and Changes

Track document history and inspect changes

am_get_heads()
Get the current heads of a document
am_get_changes()
Get changes since specified heads
am_apply_changes()
Apply changes to a document
am_get_last_local_change()
Get the last change made by the local actor
am_get_change_by_hash()
Get a specific change by its hash
am_get_changes_added()
Get changes in one document that are not in another
am_change_from_bytes()
Parse a serialized change from raw bytes
am_change_to_bytes()
Serialize a change to raw bytes
am_change_hash()
Get the hash of a change
am_change_message()
Get the commit message of a change
am_change_time()
Get the timestamp of a change
am_change_actor_id()
Get the actor ID of a change
am_change_seq()
Get the sequence number of a change
am_change_deps()
Get the dependencies of a change
am_change_size()
Get the number of operations in a change
am_get_missing_deps()
Get missing dependencies
am_load_changes()
Load a document as individual changes

Type Constructors

Explicit type constructors for objects

am_list()
Create an Automerge list
am_map()
Create an Automerge map
am_uint64()
Create an unsigned 64-bit integer value

Path-Based Access

Navigate deep nested structures

am_get_path()
Navigate deep structures with path
am_put_path()
Set value at path
am_delete_path()
Delete value at path

Conversion Helpers

Convert between R lists and Automerge documents

as_automerge()
Convert R list to Automerge document
from_automerge()
Convert Automerge document to R list

Constants

Package constants and enumerations

S3 Methods

R methods for Automerge objects

`[[`(<am_doc>) `$`(<am_doc>)
Extract from Automerge document root
`[[<-`(<am_doc>) `$<-`(<am_doc>)
Replace in Automerge document root
`[[`(<am_object>) `$`(<am_object>)
Extract from Automerge object
`[[<-`(<am_object>) `$<-`(<am_object>)
Replace in Automerge object
length(<am_doc>)
Get length of document root
length(<am_object>)
Get length of Automerge object
names(<am_doc>)
Get names from document root
names(<am_map>)
Get names from Automerge map object
as.list(<am_doc>)
Convert document root to R list
str(<am_doc>)
Display the structure of an Automerge document