mechanomeld 0.1.1-aarch64-linux → 0.1.2-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56a05490ff440fbbca11aff5c26701a00832e4cbfe3a9a8987787cccf68c1377
4
- data.tar.gz: 4e5206b4597ae0ff0f4f1f35664f55d4574493b61570513876bc1b19548cc74a
3
+ metadata.gz: 2d42272b336f68fed23ee1d15e02e99c08d7556463faa4f4225336b1b74fe24b
4
+ data.tar.gz: eeafc5c2d01ea793db19ac3fe0c29ae1732bbcfaf14a8ec92d28ec53a565880c
5
5
  SHA512:
6
- metadata.gz: d833c0259cddf9c69713a99f72dc564ecf1b3b4e55ece452201c16fa9d7bf3484c6cb438bba8de1b423684ef0f817c1ffcb8bc25ae9087b4b11f1657a5e421a8
7
- data.tar.gz: 9be601c6d4f4920f4cee1d79fe69bede69c2e11d80253ed0fd260caf7719f489141204cfccb681c37e7f9fb0e53cf79df27d9d0cde0a9f06a766fd4baa2aae35
6
+ metadata.gz: 4420b5375a0f668904af90f71577377c6498d92f1a0e8c17363f3215ae3a7475a934178f1cc854a1618dd080408c6e00c8a9298cd46f8f7eb383ec1330f50aa0
7
+ data.tar.gz: fdddaff7404b565263d62a72c5ef4f51d8baf2b23cc8f00853fa20735d71b96b6c6e03a5d3cbe8dedb754a12a53a4b734d1cddc4ce78c5f746ba975095dd0fec
data/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
+ ## [0.1.2] - 2026-09-28
9
+
10
+ ### Added
11
+
12
+ - Document#diff(from_heads, to_heads = heads) returns Automerge's patches between two versions of a document, as Hashes (9c9bf6d)
13
+
8
14
  ## [0.1.1] - 2026-09-25
9
15
 
10
16
  ### Added
@@ -19,18 +25,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
19
25
  ### Changed
20
26
 
21
27
  - releases also publish an x86_64-linux-musl platform gem (159dd59)
22
-
23
- ## [0.1.0] - 2026-09-17
24
-
25
- ### Added
26
-
27
- - Initial release
28
- - Mechanomeld::Counter, Timestamp, Uint, Bytes, and Text value classes (6df6951)
29
- - Mechanomeld::Document.load reads documents saved by JavaScript Automerge (c7d31d8)
30
- - Document#get, #[], and #to_h read values by path (c7d31d8)
31
- - Document#keys and #length for maps, lists, and text (1d80c0b)
32
- - Mechanomeld::Document.new(actor_id:) creates an empty document (bccb69c)
33
- - Document#put, #[]=, #delete, and #save (bccb69c)
34
- - Document#commit(message:, timestamp:) and #rollback (a8ef491)
35
- - Document#change commits a block and rolls back if it raises (a8ef491)
36
- - Mechanomeld::Document.from builds a committed document from a Hash (a8ef491)
data/README.md CHANGED
@@ -49,6 +49,31 @@ doc.includes_heads?(heads) # => true when the document is at or past `heads`
49
49
 
50
50
  Both take hex. automerge-repo's `handle.heads()` returns base58 URL heads, which are not accepted; send `Automerge.getHeads(handle.doc())` from JavaScript instead. A hash that is not 32 bytes of hex raises `Mechanomeld::Error`; a well-formed hash the document does not have is simply not included. Like `save`, both commit any pending change first.
51
51
 
52
+ ### What changed between two versions
53
+
54
+ `Document#diff(from_heads, to_heads = doc.heads)` is Automerge's diff: the patches that take the document from one version to another, as Hashes with String keys. Both arguments are hex heads as `Document#heads` returns them; `to_heads` defaults to the current heads, and `[]` as `from_heads` diffs from the empty document.
55
+
56
+ ```ruby
57
+ before = doc.heads
58
+ doc.change { |d| d[["scores", "bravo"]] = 7 }
59
+ doc.diff(before)
60
+ # => [{"action" => "put", "path" => ["scores", "bravo"], "value" => 7, "conflict" => false}]
61
+ ```
62
+
63
+ Every patch has `"action"` and `"path"`. The path addresses the property the patch touches from the root, map keys as Strings and list indexes as Integers, as JavaScript's `Automerge.diff` reports it. The other keys depend on the action:
64
+
65
+ | action | keys |
66
+ |---|---|
67
+ | `put` | `value`, `conflict` (true when this value won a concurrent write) |
68
+ | `delete` | `index` and `length` when deleting from a list; nothing more for a map key |
69
+ | `insert` | `values`, the elements inserted at `path`'s index, in order |
70
+ | `splice_text` | `value`, the String spliced into a `Text` at `path`'s index |
71
+ | `increment` | `value`, the amount a `Counter` changed by, which may be negative |
72
+ | `conflict` | nothing more: a concurrent write now conflicts at `path` |
73
+ | `mark` | `marks`, each `{"name", "value", "start", "end"}` on a `Text` |
74
+
75
+ Putting or inserting a map, list, or `Text` yields the empty container (`{}`, `[]`, or `Mechanomeld::Text.new("")`); its contents follow as their own patches. Values use the same Ruby types as `get`. A head that is not hex, or that names a change the document does not contain, raises `Mechanomeld::Error`. Like `save`, `diff` commits any pending change first.
76
+
52
77
  ### Syncing with a peer
53
78
 
54
79
  `Document#generate_sync_message` and `Document#receive_sync_message` run Automerge's per-document sync protocol, so a Ruby document can exchange just the changes each side lacks with another Automerge peer: JavaScript's `Automerge.generateSyncMessage` / `receiveSyncMessage`, or another Ruby document. A `Mechanomeld::SyncState` tracks what one peer is known to have; keep one per peer for each document.
Binary file
Binary file
Binary file
Binary file
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Mechanomeld
4
4
  # Native methods (new, load, load_incremental, get, keys, length, put, delete, commit,
5
- # rollback, save, heads, includes_heads?, generate_sync_message, receive_sync_message)
6
- # are defined in ext/mechanomeld/src/document.rs.
5
+ # rollback, save, heads, includes_heads?, diff, generate_sync_message,
6
+ # receive_sync_message) are defined in ext/mechanomeld/src/document.rs.
7
7
  class Document
8
8
  def self.from(hash, actor_id: nil)
9
9
  raise ArgumentError, "Automerge document root must be a Hash" unless hash.is_a?(Hash)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mechanomeld
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mechanomeld
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Jim Gay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-25 00:00:00.000000000 Z
11
+ date: 2026-09-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A native extension wrapping the Rust automerge crate so Ruby can load,
14
14
  read, create, and save Automerge documents shared with JavaScript.