{"_id":"@abrovink/abmedium-automerge","_rev":"1-a4a518acd795e3077d5b4117fe629471","name":"@abrovink/abmedium-automerge","dist-tags":{"latest":"0.9.1"},"versions":{"0.9.1":{"name":"@abrovink/abmedium-automerge","version":"0.9.1","description":"A graph medium","main":"index.js","repository":{"type":"git","url":"git+ssh://git@gitlab.com/berling/abmedium.git"},"author":{"name":"Johan Berling","email":"johan.berling@abrovink.org"},"license":"AGPL-3.0","private":false,"scripts":{"test":"jest --watch"},"dependencies":{"@abrovink/abmedium":"^0.9.1","automerge":"^0.14.1"},"publishConfig":{"access":"public"},"gitHead":"29328abf6967ac4e8819bb103d1cc5500cac9497","bugs":{"url":"https://gitlab.com/berling/abmedium/issues"},"homepage":"https://gitlab.com/berling/abmedium#readme","_id":"@abrovink/abmedium-automerge@0.9.1","_nodeVersion":"14.2.0","_npmVersion":"lerna/3.22.0/node@v14.2.0+x64 (darwin)","_npmUser":{"name":"berling","email":"johan.berling@abrovink.org"},"dist":{"integrity":"sha512-b0iXD2OjubNt/uYwjEiXP/cahXC1LmE2sV8uRQ7Zvvcza5CyaaMTqWmQZhBAXR3tueKK5tqlpN+ytNz8uMS86Q==","shasum":"9d26856584dda07bb639334483fbfebaccfaeb38","tarball":"https://registry.npmjs.org/@abrovink/abmedium-automerge/-/abmedium-automerge-0.9.1.tgz","fileCount":8,"unpackedSize":41226,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe/awdCRA9TVsSAnZWagAABYsP/jXjXzSX+cAqY9lywu/N\nx11N7kFjPMWCsqZAvNRP4EhV0MszdXqJw9proAU9OoeIjniogrKTiAGE1NgA\nDdPHlkKj0T5uMBc8EmPGQO2uVvkeg5ImSG5QcDRAHJjIndZm1JajuI3gTP/G\n+caUcr3ePXfisvBcsY2yP/zklGQs5VOZUz8WqRlXkzcclslOFZjjjytsJlSt\nY3pZ6VnZyQ3R96ddtPFkfqFU7GYanx01BIgBoYBSAeTNL/tNGo46uBIkWp8X\nuxafLnXc+b4R69LOCS+lj/qIplcsGzU0yn9Ic/E0/Eqmd4m6TE7G6An+PqbO\nqazhuCm4nmeURMqb5bB6jlFuSEKsCYwNzbBxLW6t4fVJ6wgat0UvMSAJ+XLt\n0knVzXYexP4L/LDngpTtNYihktTLhZULLPYD4NxDKls5h2VU9C0x6SMZP/KQ\nwEEyP7dH0cp8vfPHsvgZAi/A+n4+iNlpga8X6X/WMWPab+2+eFLY525hN1ca\nuaXdSleJvr7vt9FQOhEc4jAbXDfuiuL82ULoZ8E6Gd2wy/NZ4nq4GWLL+2FJ\nNzSZX78CuUB/cANUj77WxPe1Ot6OkAUuqiBVaFL41ZjcjXFEf+xJMF1y70dx\nwb5FB5RclokHIAo76VN9vUJWn3QFLJYKuJbQmRZ5zeyuaWu0oGum05eXW3HZ\nn3hi\r\n=GEXo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjT7C+PdE7DpQ3Zt4i7vNEEnpj/Fnz6SSH5RE66QC+dgIhAJ+9zeQ4e9K8y1tLqoKX3w/wPqN3q265nK9b2IMLzu5i"}]},"maintainers":[{"name":"berling","email":"johan.berling@abrovink.org"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/abmedium-automerge_0.9.1_1593682972666_0.7068364994731893"},"_hasShrinkwrap":false}},"time":{"created":"2020-07-02T09:42:52.405Z","0.9.1":"2020-07-02T09:42:52.860Z","modified":"2022-04-04T11:01:50.482Z"},"maintainers":[{"name":"berling","email":"johan.berling@abrovink.org"}],"description":"A graph medium","homepage":"https://gitlab.com/berling/abmedium#readme","repository":{"type":"git","url":"git+ssh://git@gitlab.com/berling/abmedium.git"},"author":{"name":"Johan Berling","email":"johan.berling@abrovink.org"},"bugs":{"url":"https://gitlab.com/berling/abmedium/issues"},"license":"AGPL-3.0","readme":"# abmedium-automerge\n\nThis package combines [Abmedium](https://gitlab.com/berling/abmedium/-/tree/master/packages/abmedium) with [Automerge](https://github.com/automerge/automerge). Abmedium will handle alternative views of the content (with the help of layers). Automerge will handle the complexity around distributed editing. It will also handle serialization.\n\n## Document creation\n\nCreate a document.\n\n```javascript\nlet docA = document({ 0: seq(1, 2, 3), 1: sym(\"+\"), 2: num(100), 3: num(200) });\n```\n\nCreate an empty document.\n\n```javascript\nlet docB = document();\n```\n\nMerge documents as you do in Automerge.\n\n```javascript\ndocB = merge(docB, docA);\n\nconsole.log(\"1.\", docB);\n// 1. {\n//     '0': [ 'seq', [ 1, 2, 3 ] ],\n//     '1': [ 'sym', '+' ],\n//     '2': 100,\n//     '3': 200\n// }\n```\n\n## Simultaneities\n\nLet's update a document concurrently. (In a more realistic example this will of course happen in different processes.)\n\n```javascript\ndocA = change(docA, (doc) => {\n  doc[2] = 110;\n  doc[3] = 220;\n});\n\ndocB = change(docB, (doc) => {\n  doc[2] = 111;\n});\n\ndocB = merge(docB, docA);\n```\n\nIn the background Automerge kept track of the causality and registered a conflict: node 2 has been edited concurrently. Therefore a simultaneity has been created.\n\n```javascript\nconsole.log(\"2.\", docB);\n// 2. {\n//   '0': [ 'seq', [ 1, 2, 3 ] ],\n//   '1': [ 'sym', '+' ],\n//   '2': [ 'sim', [ 111, 110 ] ],\n//   '3': 220\n// }\n```\n\n## Txt\n\nThe str type in Abmedium is not suitable for collaborative work on longer content. Fortunately Automerge offers a data type that is: Text.\n\nLet's create a Text value.\n\n```javascript\nlet docC = document({ 0: txt(\"Hello!\") });\n```\n\nIt can be handled as other values in Abmedium. For example, `valtype` fully support it.\n\n```javascript\nconsole.log(\n  \"3. \",\n  treeOf(proj(docC), (value) => valtype(value, { txt: () => value.toString() }))\n);\n// 3. Hello!\n```\n\nFor further information, read about [Text](https://github.com/automerge/automerge#text) in Automerge.\n\n## Examples\n\nInspect the [examples](https://gitlab.com/berling/abmedium/-/tree/master/packages/abmedium-automerge/examples) directory for more examples. [from-readme.js](https://gitlab.com/berling/abmedium/-/tree/master/packages/abmedium-automerge/examples/from-readme.js) contains all the examples in this document.\n\n## Maturity Status\n\nThis package is not mature. It is not stable and will change a lot. It would be wonderful if you want to use it, but prepare for a bumpy ride. Maybe you want to [contribute](https://gitlab.com/berling/abmedium/-/blob/master/CONTRIBUTING.md) in that case?\n","readmeFilename":"README.md"}