diff --git a/Sources/Automerge/Automerge.docc/Automerge.md b/Sources/Automerge/Automerge.docc/Automerge.md index fa211793..7dd22a52 100644 --- a/Sources/Automerge/Automerge.docc/Automerge.md +++ b/Sources/Automerge/Automerge.docc/Automerge.md @@ -84,6 +84,7 @@ Read to get a quick taste of how to use Automerge, or - - ``Automerge/ChangeHash`` +- ``Automerge/Change`` - ``Automerge/Patch`` - ``Automerge/PatchAction`` - ``Automerge/PathElement`` diff --git a/Sources/Automerge/Automerge.docc/Curation/Change.md b/Sources/Automerge/Automerge.docc/Curation/Change.md new file mode 100644 index 00000000..e9a3bfb3 --- /dev/null +++ b/Sources/Automerge/Automerge.docc/Curation/Change.md @@ -0,0 +1,17 @@ +# ``Automerge/Change`` + +## Topics + +### Inspecting a Change + +- ``Change/hash`` +- ``Change/actorId`` +- ``Change/deps`` +- ``Change/bytes`` +- ``ChangeHash/debugDescription`` + +### Inspecting Change Metadata + +- ``Change/message`` +- ``Change/timestamp`` + diff --git a/Sources/Automerge/Automerge.docc/Curation/Document.md b/Sources/Automerge/Automerge.docc/Curation/Document.md index 739cf5dc..7b41af2b 100644 --- a/Sources/Automerge/Automerge.docc/Curation/Document.md +++ b/Sources/Automerge/Automerge.docc/Curation/Document.md @@ -74,6 +74,7 @@ - ``heads()`` - ``getHistory()`` +- ``change(hash:)`` ### Reading historical map values @@ -100,6 +101,7 @@ ### Saving, forking, and merging documents - ``save()`` +- ``commitWith(message:timestamp:)`` - ``encodeNewChanges()`` - ``encodeChangesSince(heads:)`` - ``applyEncodedChanges(encoded:)`` diff --git a/Sources/Automerge/Change.swift b/Sources/Automerge/Change.swift index 9d93d291..70319c4e 100644 --- a/Sources/Automerge/Change.swift +++ b/Sources/Automerge/Change.swift @@ -3,12 +3,19 @@ import Foundation typealias FfiChange = AutomergeUniffi.Change +/// A type that encapsulates a change, and any associated metadata, to an Automerge document. public struct Change: Equatable { + /// The identity of the actor that made the change. public let actorId: ActorId + /// An optional message associated with the change. public let message: String? + /// The list of changes that this change depends upon. public let deps: [ChangeHash] + /// The timestamp of the change. public let timestamp: Date + /// The encoded bytes of the change operation. public let bytes: Data + /// The identity of the change, its hash. public let hash: ChangeHash init(_ ffi: FfiChange) { diff --git a/rust/src/doc.rs b/rust/src/doc.rs index c7d081ba..90c363cd 100644 --- a/rust/src/doc.rs +++ b/rust/src/doc.rs @@ -8,7 +8,7 @@ use crate::actor_id::ActorId; use crate::mark::{ExpandMark, Mark}; use crate::patches::Patch; use crate::{ - Change, ChangeHash, Cursor, ObjId, ObjType, PathElement, ScalarValue, SyncState, Value + Change, ChangeHash, Cursor, ObjId, ObjType, PathElement, ScalarValue, SyncState, Value, }; #[derive(Debug, thiserror::Error)]