trilium/packages/commons/src/lib/server_api.ts
2025-08-19 13:46:13 +03:00

157 lines
3.1 KiB
TypeScript

import { AttributeRow, NoteType } from "./rows.js";
type Response = {
success: true,
message?: string;
} | {
success: false;
message: string;
}
export interface AppInfo {
appVersion: string;
dbVersion: number;
nodeVersion: string;
syncVersion: number;
buildDate: string;
buildRevision: string;
dataDirectory: string;
clipperProtocolVersion: string;
/** for timezone inference */
utcDateTime: string;
}
export interface DeleteNotesPreview {
noteIdsToBeDeleted: string[];
brokenRelations: AttributeRow[];
}
export interface RevisionItem {
noteId: string;
revisionId?: string;
dateLastEdited?: string;
contentLength?: number;
type: NoteType;
title: string;
isProtected?: boolean;
mime: string;
}
export interface RevisionPojo {
revisionId?: string;
noteId: string;
type: NoteType;
mime: string;
isProtected?: boolean;
title: string;
blobId?: string;
dateLastEdited?: string;
dateCreated?: string;
utcDateLastEdited?: string;
utcDateCreated?: string;
utcDateModified?: string;
content?: string | Buffer<ArrayBufferLike>;
contentLength?: number;
}
export interface RecentChangeRow {
noteId: string;
current_isDeleted: boolean;
current_deleteId: string;
current_title: string;
current_isProtected: boolean;
title: string;
utcDate: string;
date: string;
canBeUndeleted?: boolean;
}
export interface BulkActionAffectedNotes {
affectedNoteCount: number;
}
export interface DatabaseCheckIntegrityResponse {
results: {
integrity_check: string;
}[];
}
export interface DatabaseAnonymizeResponse {
success: boolean;
anonymizedFilePath: string;
}
export interface AnonymizedDbResponse {
filePath: string;
fileName: string;
}
export type SyncTestResponse = Response;
export interface EtapiToken {
name: string;
utcDateCreated: string;
etapiTokenId?: string;
}
export interface PostTokensResponse {
authToken: string;
}
export interface BackupDatabaseNowResponse {
backupFile: string;
}
export interface DatabaseBackup {
fileName: string;
filePath: string;
mtime: Date;
}
export type ChangePasswordResponse = Response;
export interface TOTPStatus {
set: boolean;
}
export interface TOTPGenerate {
success: boolean;
message: string;
}
export interface TOTPRecoveryKeysResponse {
success: boolean;
recoveryCodes?: string[];
keysExist?: boolean;
usedRecoveryCodes?: string[];
}
export interface OAuthStatus {
enabled: boolean;
name?: string;
email?: string;
missingVars?: string[];
}
// Interface for the Ollama model response
export interface OllamaModelResponse {
success: boolean;
models: Array<{
name: string;
model: string;
details?: {
family?: string;
parameter_size?: string;
}
}>;
}
export interface OpenAiOrAnthropicModelResponse {
success: boolean;
chatModels: Array<{
id: string;
name: string;
type: string;
}>;
}