Merge pull request #1 from schmelczer/asch/test

Asch/test
This commit is contained in:
Andras Schmelczer 2025-01-06 22:00:13 +00:00 committed by GitHub
commit d123087322
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 32 additions and 14 deletions

8
backend/Cargo.lock generated
View file

@ -1479,7 +1479,7 @@ dependencies = [
[[package]]
name = "reconcile"
version = "0.0.16"
version = "0.0.17"
dependencies = [
"insta",
"pretty_assertions",
@ -1489,7 +1489,7 @@ dependencies = [
[[package]]
name = "reconcile-fuzz"
version = "0.0.16"
version = "0.0.17"
dependencies = [
"libfuzzer-sys",
"reconcile",
@ -2104,7 +2104,7 @@ dependencies = [
[[package]]
name = "sync_lib"
version = "0.0.16"
version = "0.0.17"
dependencies = [
"base64 0.22.1",
"console_error_panic_hook",
@ -2117,7 +2117,7 @@ dependencies = [
[[package]]
name = "sync_server"
version = "0.0.16"
version = "0.0.17"
dependencies = [
"aide",
"anyhow",

View file

@ -1,6 +1,6 @@
[package]
name = "reconcile-fuzz"
version = "0.0.16"
version = "0.0.17"
publish = false
edition = "2021"

View file

@ -1,6 +1,6 @@
[package]
name = "reconcile"
version = "0.0.16"
version = "0.0.17"
edition = "2021"
[dependencies]

View file

@ -1,6 +1,6 @@
[package]
name = "sync_lib"
version = "0.0.16"
version = "0.0.17"
authors = ["Andras Schmelczer <andras@schmelczer.dev>"]
edition = "2018"

View file

@ -1,6 +1,6 @@
[package]
name = "sync_server"
version = "0.0.16"
version = "0.0.17"
edition = "2021"
[dependencies]

View file

@ -33,6 +33,8 @@ npm version patch
echo "Updating frontend dependencies to match the new backend versions"
cd ../backend/sync_lib
wasm-pack build --target web --features console_error_panic_hook
cd ../../plugin
npm install
cd ..

View file

@ -1,7 +1,7 @@
{
"id": "vault-link",
"name": "VaultLink",
"version": "0.0.16",
"version": "0.0.17",
"minAppVersion": "0.0.0",
"description": "Self-hosted synchronization and collaboration for your Vault.",
"author": "Andras Schmelczer",

View file

@ -1,7 +1,7 @@
{
"id": "vault-link",
"name": "VaultLink",
"version": "0.0.16",
"version": "0.0.17",
"minAppVersion": "0.0.0",
"description": "Self-hosted synchronization and collaboration for your Vault.",
"author": "Andras Schmelczer",

View file

@ -1,12 +1,12 @@
{
"name": "vault-link-obsidian-plugin",
"version": "0.0.16",
"version": "0.0.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vault-link-obsidian-plugin",
"version": "0.0.16",
"version": "0.0.17",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
@ -46,7 +46,7 @@
},
"../backend/sync_lib/pkg": {
"name": "sync_lib",
"version": "0.0.16",
"version": "0.0.17",
"dev": true
},
"node_modules/@ampproject/remapping": {

View file

@ -1,6 +1,6 @@
{
"name": "vault-link-obsidian-plugin",
"version": "0.0.16",
"version": "0.0.17",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"main": "main.js",
"scripts": {

View file

@ -284,6 +284,7 @@ export class Syncer {
const localMetadata = this.database.getDocument(
oldPath ?? relativePath
);
console.log(JSON.stringify(localMetadata));
if (!localMetadata) {
if (this.database.getDocument(relativePath)) {
this.history.addHistoryEntry({
@ -299,9 +300,13 @@ export class Syncer {
`Document metadata not found for ${relativePath}. This implies a corrupt local database. Consider resetting the plugin's sync history.`
);
}
console.log("about to read", relativePath);
const contentBytes = await this.operations.read(relativePath);
console.log("has read", relativePath);
let contentHash = hash(contentBytes);
console.log("has hashed", relativePath);
if (
localMetadata.hash === contentHash &&
@ -316,6 +321,8 @@ export class Syncer {
return;
}
console.log("about to send", relativePath);
const response = await this.syncService.put({
documentId: localMetadata.documentId,
parentVersionId: localMetadata.parentVersionId,
@ -324,6 +331,8 @@ export class Syncer {
createdDate: updateTime
});
console.log("has sent", relativePath);
this.history.addHistoryEntry({
status: SyncStatus.SUCCESS,
source: SyncSource.PUSH,
@ -364,15 +373,22 @@ export class Syncer {
}
if (response.type === "MergingUpdate") {
console.log(
"about to deserialize",
response.contentBase64
);
const responseBytes = deserialize(
response.contentBase64
);
console.log("has deserialized", response.relativePath);
contentHash = hash(responseBytes);
console.log("about to write", response.relativePath);
await this.operations.write(
response.relativePath,
contentBytes,
responseBytes
);
console.log("has written", response.relativePath);
this.history.addHistoryEntry({
status: SyncStatus.SUCCESS,