diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/.gitignore b/.gitignore index d67a2e2..b1320c5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ docs/.vitepress/cache *.iml *.tsbuildinfo .running +.direnv diff --git a/flake.lock b/flake.lock index e3ea18e..455d989 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "cargo-chef": { "flake": false, "locked": { - "lastModified": 1672901199, - "narHash": "sha256-MHTuR4aQ1rQaBKx1vWDy2wbvcT0ZAzpkVB2zylSC+k0=", + "lastModified": 1695999026, + "narHash": "sha256-UtLoZd7YBRSF9uXStfC3geEFqSqZXFh1rLHaP8hre0Y=", "owner": "LukeMathWalker", "repo": "cargo-chef", - "rev": "5c9f11578a2e0783cce27666737d50f84510b8b5", + "rev": "6e96ae5cd023b718ae40d608981e50a6e7d7facf", "type": "github" }, "original": { @@ -36,20 +36,17 @@ }, "crane": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", "nixpkgs": [ "holochain", "nixpkgs" - ], - "rust-overlay": "rust-overlay" + ] }, "locked": { - "lastModified": 1675475924, - "narHash": "sha256-KWdfV9a6+zG6Ij/7PZYLnomjBZZUu8gdRy+hfjGrrJQ=", + "lastModified": 1707363936, + "narHash": "sha256-QbqyvGFYt84QNOQLOOTWplZZkzkyDhYrAl/N/9H0vFM=", "owner": "ipetkov", "repo": "crane", - "rev": "1bde9c762ebf26de9f8ecf502357c92105bc4577", + "rev": "9107434eda6991e9388ad87b815dafa337446d16", "type": "github" }, "original": { @@ -61,11 +58,11 @@ "crate2nix": { "flake": false, "locked": { - "lastModified": 1693149153, - "narHash": "sha256-HUszQcnIal1FFRAWraODDbxTp0HECwczRTD+Zf0v9o0=", + "lastModified": 1706909251, + "narHash": "sha256-T7G9Uhh77P0kKri/u+Mwa/4YnXwdPsJSwYCiJCCW+fs=", "owner": "kolloch", "repo": "crate2nix", - "rev": "8749f46953b46d44fd181b002399e4a20371f323", + "rev": "15656bb6cb15f55ee3344bf4362e6489feb93db6", "type": "github" }, "original": { @@ -93,27 +90,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -127,11 +108,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1675295133, - "narHash": "sha256-dU8fuLL98WFXG0VnRgM00bqKX6CEPBLybhiIDIgO45o=", + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "bf53492df08f3178ce85e0c9df8ed8d03c030c9f", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", "type": "github" }, "original": { @@ -140,21 +121,6 @@ } }, "flake-utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { "inputs": { "systems": "systems" }, @@ -179,7 +145,7 @@ "crane": "crane", "crate2nix": "crate2nix", "empty": "empty", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "flake-parts": "flake-parts", "holochain": [ "holochain", @@ -197,7 +163,7 @@ "nixpkgs": "nixpkgs", "pre-commit-hooks-nix": "pre-commit-hooks-nix", "repo-git": "repo-git", - "rust-overlay": "rust-overlay_2", + "rust-overlay": "rust-overlay", "scaffolding": [ "holochain", "empty" @@ -207,11 +173,11 @@ ] }, "locked": { - "lastModified": 1707374039, - "narHash": "sha256-StXSdvaN24nXxKPxEym7HMAexhkhXt2DT02sLuacHn8=", + "lastModified": 1709016941, + "narHash": "sha256-dcfach7ioZMTotVYRztdqqAFPChhetQ5TQ4n1TpHdGc=", "owner": "holochain", "repo": "holochain", - "rev": "9352e7e2d96b152e045c71b0399cd2fcdb136712", + "rev": "dc49141a3d70b7fe323dc4a8ba18fe637d900c12", "type": "github" }, "original": { @@ -273,11 +239,11 @@ }, "nix-filter": { "locked": { - "lastModified": 1675361037, - "narHash": "sha256-CTbDuDxFD3U3g/dWUB+r+B/snIe+qqP1R+1myuFGe2I=", + "lastModified": 1705332318, + "narHash": "sha256-kcw1yFeJe9N4PjQji9ZeX47jg0p9A0DuU4djKvg1a7I=", "owner": "numtide", "repo": "nix-filter", - "rev": "e1b2f96c2a31415f362268bc48c3fccf47dff6eb", + "rev": "3449dc925982ad46246cfc36469baf66e1b64f17", "type": "github" }, "original": { @@ -288,11 +254,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1707092692, - "narHash": "sha256-ZbHsm+mGk/izkWtT4xwwqz38fdlwu7nUUKXTOmm4SyE=", + "lastModified": 1708807242, + "narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "faf912b086576fd1a15fca610166c98d47bc667e", + "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", "type": "github" }, "original": { @@ -304,11 +270,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1675183161, - "narHash": "sha256-Zq8sNgAxDckpn7tJo7V1afRSk2eoVbu3OjI1QklGLNg=", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e1e1b192c1a5aab2960bf0a0bd53a2e8124fa18e", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", "type": "github" }, "original": { @@ -322,11 +288,11 @@ "pre-commit-hooks-nix": { "flake": false, "locked": { - "lastModified": 1676513100, - "narHash": "sha256-MK39nQV86L2ag4TmcK5/+r1ULpzRLPbbfvWbPvIoYJE=", + "lastModified": 1707297608, + "narHash": "sha256-ADjo/5VySGlvtCW3qR+vdFF4xM9kJFlRDqcC9ZGI8EA=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "5f0cba88ac4d6dd8cad5c6f6f1540b3d6a21a798", + "rev": "0db2e67ee49910adfa13010e7f012149660af7f0", "type": "github" }, "original": { @@ -359,45 +325,18 @@ }, "rust-overlay": { "inputs": { - "flake-utils": [ - "holochain", - "crane", - "flake-utils" - ], - "nixpkgs": [ - "holochain", - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1675391458, - "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_2": { - "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": [ "holochain", "nixpkgs" ] }, "locked": { - "lastModified": 1707358215, - "narHash": "sha256-Nuhi8KEJ2e+2nTimSyEIPqN5eh7ECVWd+AnPXG6L+SY=", + "lastModified": 1708999822, + "narHash": "sha256-X55GxqI3oDEfqy38Pt7xyypYNly4bkd/RajFE+FGn+A=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "dd917bb1b67fc049fd56fe6de70266a9ab74a4aa", + "rev": "1a618c62479a6896ac497aaa0d969c6bd8e24911", "type": "github" }, "original": { @@ -409,11 +348,11 @@ "scaffolding": { "flake": false, "locked": { - "lastModified": 1705076186, - "narHash": "sha256-O914XeBuFulky5RqTOvsog+fbO12v0ppW+mIdO6lvKU=", + "lastModified": 1708376918, + "narHash": "sha256-zjjAmu8t566/PUxo2g0EFZ4GAdUu/UbkGA8hsVbFEoQ=", "owner": "holochain", "repo": "scaffolding", - "rev": "42e025fe23ac0b4cd659d95e6752d2d300a8d076", + "rev": "ddb8b5a950e7be81d704000e662564696bef5d6b", "type": "github" }, "original": { @@ -447,11 +386,11 @@ }, "locked": { "dir": "versions/0_2", - "lastModified": 1707374039, - "narHash": "sha256-StXSdvaN24nXxKPxEym7HMAexhkhXt2DT02sLuacHn8=", + "lastModified": 1709016941, + "narHash": "sha256-dcfach7ioZMTotVYRztdqqAFPChhetQ5TQ4n1TpHdGc=", "owner": "holochain", "repo": "holochain", - "rev": "9352e7e2d96b152e045c71b0399cd2fcdb136712", + "rev": "dc49141a3d70b7fe323dc4a8ba18fe637d900c12", "type": "github" }, "original": { diff --git a/package-lock.json b/package-lock.json index 6aabb27..6c37591 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8102,9 +8102,9 @@ }, "packages/client": { "name": "@holochain-syn/client", - "version": "0.11.1", + "version": "0.11.3", "dependencies": { - "@holochain-open-dev/utils": "^0.16.3", + "@holochain-open-dev/utils": "^0.16.5", "@holochain/client": "^0.16.1", "@msgpack/msgpack": "^2.7.0", "automerge": "^1.0.1-preview.7" @@ -8142,11 +8142,11 @@ }, "packages/store": { "name": "@holochain-syn/store", - "version": "0.11.1", + "version": "0.11.3", "dependencies": { "@holochain-open-dev/stores": "^0.8.11", "@holochain-open-dev/utils": "^0.16.5", - "@holochain-syn/client": "^0.11.1", + "@holochain-syn/client": "^0.11.3", "@holochain/client": "^0.16.1", "@msgpack/msgpack": "^2.7.2", "automerge": "^1.0.1-preview.7", @@ -8161,7 +8161,7 @@ }, "packages/text-editor": { "name": "@holochain-syn/text-editor", - "version": "0.12.0", + "version": "0.12.1", "dependencies": { "@holochain-open-dev/elements": "^0.8.0", "@holochain-open-dev/profiles": "^0.17.3", diff --git a/packages/client/package.json b/packages/client/package.json index 91fc4fb..9c514c0 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@holochain-syn/client", - "version": "0.11.3", + "version": "0.11.4", "main": "./dist/index.js", "module": "./dist/index.js", "type": "module", diff --git a/packages/client/src/client.ts b/packages/client/src/client.ts index 1365439..003d6e6 100644 --- a/packages/client/src/client.ts +++ b/packages/client/src/client.ts @@ -53,6 +53,11 @@ export class SynClient extends ZomeClient { return new EntryRecord(record); } + + public async getAuthorsForDocument(documentHash: AnyDhtHash): Promise> { + return this.callZome('get_authors_for_document', documentHash); + } + public async tagDocument( documentHash: AnyDhtHash, tag: string @@ -86,7 +91,7 @@ export class SynClient extends ZomeClient { signal.type === 'EntryCreated' && signal.app_entry.type === 'Commit' && cleanNodeDecoding(commit.document_hash).toString() === - cleanNodeDecoding(signal.app_entry.document_hash).toString() + cleanNodeDecoding(signal.app_entry.document_hash).toString() ) { unsubs(); @@ -118,7 +123,13 @@ export class SynClient extends ZomeClient { public async getCommitsForDocument( documentHash: AnyDhtHash ): Promise> { - return this.callZome('get_commits_for_document', documentHash); + const commits: Array = await this.callZome('get_commits_for_document', documentHash); + + if (commits.length > 600) { + console.warn(`THERE ARE ${commits.length} FOR THIS DOCUMENT. THIS SHOULDN'T HAPPEN! REPORT TO THE SYN DEVS ABOUT THIS (guillemcordoba)`); + } + + return commits; } /** Workspaces */ diff --git a/packages/store/package.json b/packages/store/package.json index d93c2a1..f3cec84 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -1,6 +1,6 @@ { "name": "@holochain-syn/store", - "version": "0.11.3", + "version": "0.11.4", "main": "./dist/index.js", "types": "./dist/index.d.ts", "type": "module", diff --git a/packages/store/src/document-store.ts b/packages/store/src/document-store.ts index 6ce0e99..dc1d80b 100644 --- a/packages/store/src/document-store.ts +++ b/packages/store/src/document-store.ts @@ -1,12 +1,10 @@ import { ActionHash, - AgentPubKey, AnyDhtHash, EntryHash, } from '@holochain/client'; import { AsyncReadable, - joinAsync, liveLinksStore, pipe, retryUntilSuccess, @@ -15,7 +13,9 @@ import { import { EntryRecord, GetonlyMap, + HashType, LazyHoloHashMap, + retype, slice, } from '@holochain-open-dev/utils'; import { Commit } from '@holochain-syn/client'; @@ -36,7 +36,7 @@ export function sliceStrings( } export class DocumentStore { - constructor(public synStore: SynStore, public documentHash: AnyDhtHash) {} + constructor(public synStore: SynStore, public documentHash: AnyDhtHash) { } record = retryUntilSuccess(async () => { const document = await this.synStore.client.getDocument(this.documentHash); @@ -86,7 +86,7 @@ export class DocumentStore { return commit; }, 700, - 100 + 10 ) ); @@ -101,17 +101,16 @@ export class DocumentStore { * Keeps an up to date array of the all the agents that have participated in any commit in this document */ allAuthors = pipe( - joinAsync([this.record, this.allCommits]), - ([_document, commits]) => joinAsync(Array.from(commits.values())), - (commits, [document]) => { - const agents = commits.map(c => c.entry.authors); - const agentsFlat = ([document.action.author] as AgentPubKey[]).concat( - ...agents - ); - return uniquify(agentsFlat); - } + liveLinksStore( + this.synStore.client, + this.documentHash, + () => this.synStore.client.getAuthorsForDocument(this.documentHash), + 'DocumentToAuthors' + ), + links => uniquify(links.map(l => retype(l.target, HashType.AGENT))) ); + async createWorkspace( workspaceName: string, initialTipHash: EntryHash | undefined diff --git a/packages/store/src/session-store.ts b/packages/store/src/session-store.ts index 47d4b91..2d8ef5f 100644 --- a/packages/store/src/session-store.ts +++ b/packages/store/src/session-store.ts @@ -112,7 +112,7 @@ export class SessionStore implements SliceStore { return derived(this._currentTip, i => i); } - private unsubscribe: () => void = () => {}; + private unsubscribe: () => void = () => { }; private intervals: any[] = []; private deltaCount = 0; @@ -173,21 +173,27 @@ export class SessionStore implements SliceStore { previous_commit.toString() === currentTip.actionHash.toString() ) ) { - newCommit = await this.workspaceStore.merge([ - currentTip.actionHash, - newCommit.actionHash, - ]); - - this.workspaceStore.documentStore.synStore.client.sendMessage( - Array.from(get(this._participants).keys()), - { - workspace_hash: this.workspaceStore.workspaceHash, - payload: { - type: 'NewCommit', - new_commit: newCommit.record, - }, - } - ); + // We are out of sync with the author of the commit: sync again + this.requestSync(message.payload.new_commit.signed_action.hashed.content.author); + + // TODO: This was old merge conflict management, lead to many commits being created + // What to do about this? + + // newCommit = await this.workspaceStore.merge([ + // currentTip.actionHash, + // newCommit.actionHash, + // ]); + + // this.workspaceStore.documentStore.synStore.client.sendMessage( + // Array.from(get(this._participants).keys()), + // { + // workspace_hash: this.workspaceStore.workspaceHash, + // payload: { + // type: 'NewCommit', + // new_commit: newCommit.record, + // }, + // } + // ); } this._currentTip.set(newCommit); @@ -210,13 +216,13 @@ export class SessionStore implements SliceStore { synSignal.provenance, message.payload.sync_message ? (decode( - message.payload.sync_message - ) as Automerge.BinarySyncMessage) + message.payload.sync_message + ) as Automerge.BinarySyncMessage) : undefined, message.payload.ephemeral_sync_message ? (decode( - message.payload.ephemeral_sync_message - ) as Automerge.BinarySyncMessage) + message.payload.ephemeral_sync_message + ) as Automerge.BinarySyncMessage) : undefined ); } @@ -490,6 +496,8 @@ export class SessionStore implements SliceStore { participantInfo.syncStates.state, syncMessage ); + const changes = Automerge.getChanges(state, nextDoc); + this.deltaCount += changes.length; participantInfo.syncStates.state = nextSyncState; return nextDoc; @@ -518,7 +526,16 @@ export class SessionStore implements SliceStore { this.requestSync(from); } + _previousCommitPromise: Promise | undefined; + async commitChanges(meta?: any) { + if (this._previousCommitPromise) await this._previousCommitPromise; + this._previousCommitPromise = this.commitChangesInternal(meta); + + return this._previousCommitPromise; + } + + private async commitChangesInternal(meta?: any) { const latestSnapshot = await toPromise(this.workspaceStore.latestSnapshot); if ( diff --git a/tests/src/lib/syn-store.test.ts b/tests/src/lib/syn-store.test.ts index d8cde4c..dfb4b84 100644 --- a/tests/src/lib/syn-store.test.ts +++ b/tests/src/lib/syn-store.test.ts @@ -37,7 +37,7 @@ test('SynStore, DocumentStore, WorkspaceStore and SessionStore work', async () = sampleGrammar.initialState() ); - const authors = await toPromise(aliceDocumentStore.allAuthors); + let authors = await toPromise(aliceDocumentStore.allAuthors); assert.equal(authors.length, 1); @@ -193,6 +193,10 @@ test('SynStore, DocumentStore, WorkspaceStore and SessionStore work', async () = await aliceSessionStore.leaveSession(); + authors = await toPromise(aliceDocumentStore.allAuthors); + + assert.equal(authors.length, 2); + latestState = await toPromise(aliceWorkspaceStore.latestState); assert.deepEqual(latestState, state); diff --git a/zomes/syn/coordinator/src/commit.rs b/zomes/syn/coordinator/src/commit.rs index 845d681..04ca24a 100644 --- a/zomes/syn/coordinator/src/commit.rs +++ b/zomes/syn/coordinator/src/commit.rs @@ -1,18 +1,30 @@ -use crate::utils::*; use hc_zome_syn_integrity::*; use hdk::prelude::*; +use crate::{document::get_authors_for_document, utils::*}; + #[hdk_extern] pub fn create_commit(commit: Commit) -> ExternResult { let c = EntryTypes::Commit(commit.clone()); let action_hash = create_relaxed(c, commit.clone().try_into()?)?; - let _ = create_link_relaxed( - commit.document_hash, - action_hash.clone(), - LinkTypes::DocumentToCommits, - (), - )?; + let current_authors_links = get_authors_for_document(commit.document_hash.clone())?; + + let current_authors: Vec = current_authors_links + .into_iter() + .filter_map(|link| link.target.into_agent_pub_key()) + .collect(); + + for author in commit.authors { + if !current_authors.contains(&author) { + create_link_relaxed( + commit.document_hash.clone(), + author, + LinkTypes::DocumentToAuthors, + (), + )?; + } + } let record = get(action_hash, GetOptions::default())?; @@ -21,6 +33,24 @@ pub fn create_commit(commit: Commit) -> ExternResult { )))) } +#[derive(Serialize, Deserialize, Debug)] +pub struct LinkDocumentToCommitInput { + pub document_hash: AnyDhtHash, + pub commit_hash: ActionHash, +} + +#[hdk_extern] +pub fn link_document_to_commit(input: LinkDocumentToCommitInput) -> ExternResult<()> { + create_link_relaxed( + input.document_hash.clone(), + input.commit_hash, + LinkTypes::DocumentToCommits, + (), + )?; + + Ok(()) +} + #[hdk_extern] pub fn get_commit(commit_hash: ActionHash) -> ExternResult> { get(commit_hash, GetOptions::default()) diff --git a/zomes/syn/coordinator/src/document.rs b/zomes/syn/coordinator/src/document.rs index 6593912..9666aa4 100644 --- a/zomes/syn/coordinator/src/document.rs +++ b/zomes/syn/coordinator/src/document.rs @@ -4,6 +4,12 @@ use hdk::prelude::*; #[hdk_extern] pub fn create_document(document: Document) -> ExternResult { let document_hash = create_entry(EntryTypes::Document(document.clone()))?; + create_link( + document_hash.clone(), + agent_info()?.agent_latest_pubkey, + LinkTypes::DocumentToAuthors, + (), + )?; let maybe_record = get(document_hash, GetOptions::default())?; let record = maybe_record.ok_or(wasm_error!(WasmErrorInner::Guest(String::from( @@ -17,3 +23,8 @@ pub fn create_document(document: Document) -> ExternResult { pub fn get_document(document_hash: AnyDhtHash) -> ExternResult> { get(document_hash, GetOptions::default()) } + +#[hdk_extern] +pub fn get_authors_for_document(document_hash: AnyDhtHash) -> ExternResult> { + get_links(document_hash, LinkTypes::DocumentToAuthors, None) +} diff --git a/zomes/syn/coordinator/src/lib.rs b/zomes/syn/coordinator/src/lib.rs index 82d0e1f..aee5f9d 100644 --- a/zomes/syn/coordinator/src/lib.rs +++ b/zomes/syn/coordinator/src/lib.rs @@ -1,3 +1,4 @@ +use commit::LinkDocumentToCommitInput; use hc_zome_syn_integrity::*; use hdk::prelude::*; use messages::SessionMessage; @@ -106,6 +107,23 @@ fn signal_action(action: SignedActionHashed) -> ExternResult<()> { } Action::Create(_create) => { if let Ok(Some(app_entry)) = get_entry_for_action(&action.hashed.hash) { + if let EntryTypes::Commit(commit) = &app_entry { + let response = call_remote( + agent_info()?.agent_latest_pubkey, + zome_info()?.name, + FunctionName::from("link_document_to_commit"), + None, + LinkDocumentToCommitInput { + document_hash: commit.document_hash.clone(), + commit_hash: action.hashed.hash.clone(), + }, + )?; + + match response { + ZomeCallResponse::Ok(_) => {} + _ => error!("Error linking document to commit: {response:?}"), + } + } emit_signal(Signal::EntryCreated { action, app_entry })?; } Ok(()) diff --git a/zomes/syn/integrity/src/lib.rs b/zomes/syn/integrity/src/lib.rs index 7617307..70b20d8 100644 --- a/zomes/syn/integrity/src/lib.rs +++ b/zomes/syn/integrity/src/lib.rs @@ -23,6 +23,7 @@ pub enum EntryTypes { #[hdk_link_types] pub enum LinkTypes { TagToDocument, + DocumentToAuthors, DocumentToWorkspaces, DocumentToCommits, WorkspaceToTip,