This commit is contained in:
Andras Schmelczer 2025-03-22 18:10:50 +00:00
commit 7153c06c63
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
3 changed files with 9 additions and 8 deletions

View file

@ -1,13 +1,14 @@
import type { WorkspaceLeaf } from "obsidian"; import type { WorkspaceLeaf } from "obsidian";
import { ItemView } from "obsidian"; import { ItemView } from "obsidian";
import { LogLevel, LogLine, type SyncClient } from "sync-client"; import type { LogLine } from "sync-client";
import { LogLevel, type SyncClient } from "sync-client";
export class LogsView extends ItemView { export class LogsView extends ItemView {
public static readonly TYPE = "logs-view"; public static readonly TYPE = "logs-view";
public static readonly ICON = "logs"; public static readonly ICON = "logs";
private logsContainer: HTMLElement | undefined; private logsContainer: HTMLElement | undefined;
private logLineToElement: Map<LogLine, HTMLElement> = new Map(); private readonly logLineToElement = new Map<LogLine, HTMLElement>();
public constructor( public constructor(
private readonly client: SyncClient, private readonly client: SyncClient,

View file

@ -1,5 +1,5 @@
export class SyncResetError extends Error { export class SyncResetError extends Error {
constructor() { public constructor() {
super("Sync was reset"); super("Sync was reset");
this.name = "SyncResetError"; this.name = "SyncResetError";
} }

View file

@ -70,7 +70,7 @@ export class SyncService {
relativePath: RelativePath; relativePath: RelativePath;
contentBytes: Uint8Array; contentBytes: Uint8Array;
}): Promise<components["schemas"]["DocumentVersionWithoutContent"]> { }): Promise<components["schemas"]["DocumentVersionWithoutContent"]> {
const vaultName = this.settings.getSettings().vaultName; const { vaultName } = this.settings.getSettings();
return this.withRetries(async () => { return this.withRetries(async () => {
const formData = new FormData(); const formData = new FormData();
@ -123,7 +123,7 @@ export class SyncService {
relativePath: RelativePath; relativePath: RelativePath;
contentBytes: Uint8Array; contentBytes: Uint8Array;
}): Promise<components["schemas"]["DocumentUpdateResponse"]> { }): Promise<components["schemas"]["DocumentUpdateResponse"]> {
const vaultName = this.settings.getSettings().vaultName; const { vaultName } = this.settings.getSettings();
return this.withRetries(async () => { return this.withRetries(async () => {
this.logger.debug( this.logger.debug(
@ -175,7 +175,7 @@ export class SyncService {
relativePath: RelativePath; relativePath: RelativePath;
}): Promise<components["schemas"]["DocumentVersionWithoutContent"]> { }): Promise<components["schemas"]["DocumentVersionWithoutContent"]> {
return this.withRetries(async () => { return this.withRetries(async () => {
const vaultName = this.settings.getSettings().vaultName; const { vaultName } = this.settings.getSettings();
const response = await this.client.DELETE( const response = await this.client.DELETE(
"/vaults/{vault_id}/documents/{document_id}", "/vaults/{vault_id}/documents/{document_id}",
@ -212,7 +212,7 @@ export class SyncService {
}: { }: {
documentId: DocumentId; documentId: DocumentId;
}): Promise<components["schemas"]["DocumentVersion"]> { }): Promise<components["schemas"]["DocumentVersion"]> {
const vaultName = this.settings.getSettings().vaultName; const { vaultName } = this.settings.getSettings();
return this.withRetries(async () => { return this.withRetries(async () => {
const response = await this.client.GET( const response = await this.client.GET(
@ -248,7 +248,7 @@ export class SyncService {
since?: VaultUpdateId since?: VaultUpdateId
): Promise<components["schemas"]["FetchLatestDocumentsResponse"]> { ): Promise<components["schemas"]["FetchLatestDocumentsResponse"]> {
return this.withRetries(async () => { return this.withRetries(async () => {
const vaultName = this.settings.getSettings().vaultName; const { vaultName } = this.settings.getSettings();
const response = await this.client.GET( const response = await this.client.GET(
"/vaults/{vault_id}/documents", "/vaults/{vault_id}/documents",