Fix syncing when network latency is present (#4)

* WIP

* Add debug

* Dedupe inserts

* Add deterministic ordering

* Fix whitespaces

* Update insta

* Add integration test script

* Rename

* Add test

* Working for non-deletes

* omg it mostly works for deletes

* Isdeleted fix

* remove created dates

* update api

* Take document id

* No max attempt

* works

* Use string uuids

* .

* working!!!! (hopefully)

* Improve bundling

* Add module

* lint

* .

* lint

* Fix CI

* use toolchain

* clean up

* Add useSlowFileEvents

* Delete fuzz

* Fix CI

* use docker

* fix script

* clean up

* Clean up

* change node version

* Build docker image on every commit

* fix ci

* 1 db per vault

* Add scritps folder

* Bump versions

* Lint

* .

* Fix tests for real

* Style

* .

* try

* Consistent ordering

* Fix tests

* hmm

* .

* Clean up diff

* Fixes

* .

* Fix version bump

* .

* .

* .
This commit is contained in:
Andras Schmelczer 2025-03-16 20:13:49 +00:00 committed by GitHub
parent bcf48c428d
commit 8b8f1d91d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
91 changed files with 2252 additions and 1586 deletions

View file

@ -14,7 +14,7 @@
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.13.5",
"@types/node": "^22.13.10",
"css-loader": "^7.1.2",
"date-fns": "^4.1.0",
"file-loader": "^6.2.0",
@ -23,14 +23,14 @@
"mini-css-extract-plugin": "^2.9.2",
"obsidian": "1.8.7",
"resolve-url-loader": "^5.0.0",
"sass": "^1.85.0",
"sass": "^1.85.1",
"sass-loader": "^16.0.5",
"sync-client": "file:../sync-client",
"terser-webpack-plugin": "^5.3.11",
"terser-webpack-plugin": "^5.3.14",
"ts-jest": "^29.2.6",
"ts-loader": "^9.5.2",
"tslib": "2.8.1",
"typescript": "5.7.3",
"typescript": "5.8.2",
"url": "^0.11.4",
"virtual-scroller": "^1.13.1",
"webpack": "^5.98.0",

View file

@ -9,10 +9,7 @@ export class ObsidianFileEventHandler {
if (file instanceof TFile) {
this.client.logger.info(`File created: ${file.path}`);
await this.client.syncer.syncLocallyCreatedFile(
file.path,
new Date(file.stat.ctime)
);
await this.client.syncer.syncLocallyCreatedFile(file.path);
} else {
this.client.logger.debug(`Folder created: ${file.path}, ignored`);
}
@ -34,8 +31,7 @@ export class ObsidianFileEventHandler {
await this.client.syncer.syncLocallyUpdatedFile({
oldPath,
relativePath: file.path,
updateTime: new Date(file.stat.ctime)
relativePath: file.path
});
} else {
this.client.logger.debug(
@ -53,8 +49,7 @@ export class ObsidianFileEventHandler {
this.client.logger.info(`File modified: ${file.path}`);
await this.client.syncer.syncLocallyUpdatedFile({
relativePath: file.path,
updateTime: new Date(file.stat.ctime)
relativePath: file.path
});
} else {
this.client.logger.debug(`Folder modified: ${file.path}, ignored`);

View file

@ -60,7 +60,6 @@ export class HistoryView extends ItemView {
}
element.createEl("span", {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
text: entry.relativePath
});

View file

@ -1,6 +1,6 @@
import type { WorkspaceLeaf } from "obsidian";
import { ItemView } from "obsidian";
import type VaultLinkPlugin from "src/vault-link-plugin";
import type VaultLinkPlugin from "../vault-link-plugin";
import type { SyncClient } from "sync-client";
export class LogsView extends ItemView {

View file

@ -1,7 +1,7 @@
import type { App } from "obsidian";
import { Notice, PluginSettingTab, Setting } from "obsidian";
import type VaultLinkPlugin from "src/vault-link-plugin";
import type VaultLinkPlugin from "../vault-link-plugin";
import type { StatusDescription } from "./status-description";
import { LogsView } from "./logs-view";
import { HistoryView } from "./history-view";

View file

@ -1,5 +1,5 @@
import type { HistoryStats, SyncClient } from "sync-client";
import type VaultLinkPlugin from "src/vault-link-plugin";
import type VaultLinkPlugin from "../vault-link-plugin";
export class StatusBar {
private readonly statusBarItem: HTMLElement;

View file

@ -94,9 +94,6 @@ module.exports = (env, argv) => ({
alias: {
root: __dirname,
src: path.resolve(__dirname, "src")
},
fallback: {
url: require.resolve("url")
}
},
output: {