mirror of
https://github.com/zadam/trilium.git
synced 2026-07-25 13:20:26 +02:00
; Conflicts: ; apps/client/src/layouts/mobile_layout.tsx ; apps/client/src/services/promoted_attribute_definition_parser.ts ; apps/server/package.json ; apps/server/src/becca/entities/bnote.ts ; apps/server/src/etapi/etapi_utils.ts ; apps/server/src/etapi/notes.ts ; apps/server/src/routes/api/clipper.ts ; apps/server/src/routes/api/export.ts ; apps/server/src/routes/api/files.ts ; apps/server/src/routes/api/image.ts ; apps/server/src/routes/api/import.ts ; apps/server/src/routes/api/note_map.ts ; apps/server/src/routes/api/search.ts ; apps/server/src/routes/api/similar_notes.ts ; apps/server/src/routes/api/sync.ts ; apps/server/src/routes/error_handlers.ts ; apps/server/src/routes/index.ts ; apps/server/src/routes/route_api.ts ; apps/server/src/routes/routes.ts ; apps/server/src/services/anonymization.ts ; apps/server/src/services/app_info.ts ; apps/server/src/services/builtin_attributes.ts ; apps/server/src/services/export/zip.ts ; apps/server/src/services/hidden_subtree.ts ; apps/server/src/services/llm/ai_service_manager.ts ; apps/server/src/services/llm/context/modules/context_formatter.ts ; apps/server/src/services/llm/context/note_content.ts ; apps/server/src/services/llm/formatters/base_formatter.ts ; apps/server/src/services/llm/formatters/ollama_formatter.ts ; apps/server/src/services/llm/formatters/openai_formatter.ts ; apps/server/src/services/llm/tools/read_note_tool.ts ; apps/server/src/services/note_types.ts ; apps/server/src/services/notes.ts ; apps/server/src/services/options.ts ; apps/server/src/services/options_init.ts ; apps/server/src/services/search/expressions/note_content_fulltext.ts ; apps/server/src/services/utils.ts ; apps/server/src/services/ws.ts ; apps/server/src/share/content_renderer.ts ; packages/commons/src/lib/builtin_attributes.ts ; packages/commons/src/lib/rows.ts ; packages/trilium-core/src/routes/api/attachments.ts ; packages/trilium-core/src/routes/api/attributes.ts ; packages/trilium-core/src/routes/api/branches.ts ; packages/trilium-core/src/routes/api/notes.ts ; packages/trilium-core/src/routes/api/recent_changes.ts ; packages/trilium-core/src/routes/api/revisions.ts ; packages/trilium-core/src/routes/api/sql.ts ; packages/trilium-core/src/routes/api/stats.ts ; packages/trilium-core/src/services/attributes.ts ; packages/trilium-core/src/services/builtin_attributes.ts ; packages/trilium-core/src/services/promoted_attribute_definition_parser.ts ; pnpm-lock.yaml
145 lines
3.5 KiB
TypeScript
145 lines
3.5 KiB
TypeScript
// TODO: Booleans should probably be numbers instead (as SQLite does not have booleans.);
|
|
// TODO: check against schema.sql which properties really are "optional"
|
|
|
|
export interface AttachmentRow {
|
|
attachmentId?: string;
|
|
ownerId: string;
|
|
role: string;
|
|
mime: string;
|
|
title: string;
|
|
position?: number;
|
|
blobId?: string;
|
|
isProtected?: boolean;
|
|
dateModified?: string;
|
|
utcDateModified?: string;
|
|
utcDateScheduledForErasureSince?: string | null;
|
|
isDeleted?: boolean;
|
|
deleteId?: string;
|
|
contentLength?: number;
|
|
content?: Uint8Array | string;
|
|
/** If set to `"base64"`, the `content` string will be decoded from base64 to binary before storage. */
|
|
encoding?: "base64";
|
|
}
|
|
|
|
export interface RevisionRow {
|
|
revisionId?: string;
|
|
noteId: string;
|
|
type: NoteType;
|
|
mime: string;
|
|
isProtected?: boolean;
|
|
title: string;
|
|
blobId?: string;
|
|
dateLastEdited?: string;
|
|
dateCreated?: string;
|
|
utcDateLastEdited?: string;
|
|
utcDateCreated: string;
|
|
utcDateModified?: string;
|
|
contentLength?: number;
|
|
}
|
|
|
|
export interface RecentNoteRow {
|
|
noteId: string;
|
|
notePath: string;
|
|
utcDateCreated?: string;
|
|
}
|
|
|
|
/**
|
|
* Database representation of an option.
|
|
*
|
|
* Options are key-value pairs that are used to store information such as user preferences (for example
|
|
* the current theme, sync server information), but also information about the state of the application).
|
|
*/
|
|
export interface OptionRow {
|
|
/** The name of the option. */
|
|
name: string;
|
|
/** The value of the option. */
|
|
value: string;
|
|
/** `true` if the value should be synced across multiple instances (e.g. locale) or `false` if it should be local-only (e.g. theme). */
|
|
isSynced: boolean;
|
|
utcDateModified?: string;
|
|
}
|
|
|
|
export interface EtapiTokenRow {
|
|
etapiTokenId?: string;
|
|
name: string;
|
|
tokenHash: string;
|
|
utcDateCreated?: string;
|
|
utcDateModified?: string;
|
|
isDeleted?: boolean;
|
|
}
|
|
|
|
export interface BlobRow {
|
|
blobId: string;
|
|
content: string | Uint8Array;
|
|
contentLength: number;
|
|
dateModified: string;
|
|
utcDateModified: string;
|
|
}
|
|
|
|
export type AttributeType = "label" | "relation" | "label-definition" | "relation-definition";
|
|
|
|
export interface AttributeRow {
|
|
attributeId?: string;
|
|
noteId?: string;
|
|
type: AttributeType;
|
|
name: string;
|
|
position?: number | null;
|
|
value?: string;
|
|
isInheritable?: boolean;
|
|
utcDateModified?: string;
|
|
}
|
|
|
|
export interface BranchRow {
|
|
branchId?: string;
|
|
noteId: string;
|
|
parentNoteId: string;
|
|
prefix?: string | null;
|
|
notePosition?: number | null;
|
|
isExpanded?: boolean;
|
|
isDeleted?: boolean;
|
|
utcDateModified?: string;
|
|
}
|
|
|
|
/**
|
|
* There are many different Note types, some of which are entirely opaque to the
|
|
* end user. Those types should be used only for checking against, they are
|
|
* not for direct use.
|
|
*/
|
|
export const ALLOWED_NOTE_TYPES = [
|
|
"file",
|
|
"image",
|
|
"search",
|
|
"noteMap",
|
|
"launcher",
|
|
"doc",
|
|
"contentWidget",
|
|
"text",
|
|
"relationMap",
|
|
"render",
|
|
"canvas",
|
|
"mermaid",
|
|
"book",
|
|
"webView",
|
|
"code",
|
|
"mindMap",
|
|
"spreadsheet"
|
|
] as const;
|
|
export type NoteType = (typeof ALLOWED_NOTE_TYPES)[number];
|
|
|
|
export interface NoteRow {
|
|
noteId: string;
|
|
deleteId?: string;
|
|
title: string;
|
|
type: NoteType;
|
|
mime: string;
|
|
isProtected?: boolean;
|
|
isDeleted?: boolean;
|
|
blobId?: string;
|
|
dateCreated?: string;
|
|
dateModified?: string;
|
|
utcDateCreated?: string;
|
|
utcDateModified?: string;
|
|
content?: string | Uint8Array;
|
|
}
|
|
|