139 lines
3.2 KiB
TypeScript
Raw Normal View History

2024-02-18 20:29:23 +02:00
// TODO: Booleans should probably be numbers instead (as SQLite does not have booleans.);
2024-02-17 01:00:38 +02:00
export interface AttachmentRow {
attachmentId?: string;
2024-02-17 10:56:27 +02:00
ownerId?: string;
role: string;
mime: string;
title: string;
position?: number;
2024-02-17 10:56:27 +02:00
blobId?: string;
isProtected?: boolean;
dateModified?: string;
utcDateModified?: string;
utcDateScheduledForErasureSince?: string;
contentLength?: number;
content?: Buffer | string;
}
export interface RevisionRow {
2024-02-17 10:56:27 +02:00
revisionId?: string;
noteId: string;
type: string;
mime: string;
2024-02-17 10:56:27 +02:00
isProtected?: boolean;
title: string;
2024-02-17 10:56:27 +02:00
blobId?: string;
dateLastEdited?: string;
dateCreated: string;
2024-02-17 10:56:27 +02:00
utcDateLastEdited?: string;
utcDateCreated: string;
utcDateModified: string;
contentLength?: number;
}
export interface RecentNoteRow {
noteId: string;
notePath: string;
utcDateCreated?: string;
}
2024-02-17 01:00:38 +02:00
2024-11-02 00:55:45 +02:00
/**
* Database representation of an option.
2024-12-22 15:45:54 +02:00
*
2024-11-02 00:55:45 +02:00
* 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).
*/
2024-02-17 01:00:38 +02:00
export interface OptionRow {
2024-11-02 00:55:45 +02:00
/** The name of the option. */
2024-02-17 01:00:38 +02:00
name: string;
2024-11-02 00:55:45 +02:00
/** The value of the option. */
2024-02-17 01:00:38 +02:00
value: string;
2024-11-02 00:55:45 +02:00
/** `true` if the value should be synced across multiple instances (e.g. locale) or `false` if it should be local-only (e.g. theme). */
2024-02-17 01:00:38 +02:00
isSynced: boolean;
utcDateModified?: string;
2024-02-17 01:03:38 +02:00
}
export interface EtapiTokenRow {
2024-02-17 19:55:40 +02:00
etapiTokenId?: string;
2024-02-17 01:03:38 +02:00
name: string;
tokenHash: string;
utcDateCreated?: string;
utcDateModified?: string;
2024-02-17 19:55:40 +02:00
isDeleted?: boolean;
2024-02-17 01:06:07 +02:00
}
export interface BlobRow {
blobId: string;
content: string | Buffer;
contentLength: number;
dateModified: string;
utcDateModified: string;
2024-02-17 01:19:49 +02:00
}
2024-04-03 22:46:14 +03:00
export type AttributeType = "label" | "relation" | "label-definition" | "relation-definition";
2024-02-17 01:19:49 +02:00
export interface AttributeRow {
attributeId?: string;
2024-02-18 11:26:05 +02:00
noteId?: string;
2024-02-17 01:19:49 +02:00
type: AttributeType;
name: string;
2024-07-18 22:58:12 +03:00
position?: number | null;
value?: string;
isInheritable?: boolean;
2024-02-17 10:56:27 +02:00
utcDateModified?: string;
}
export interface BranchRow {
branchId?: string;
noteId: string;
parentNoteId: string;
prefix?: string | null;
2024-02-18 11:47:32 +02:00
notePosition?: number | null;
isExpanded?: boolean;
isDeleted?: boolean;
utcDateModified?: string;
2024-02-17 10:56:27 +02:00
}
/**
* 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.
*/
2025-01-09 18:07:02 +02:00
export const ALLOWED_NOTE_TYPES = [
"file",
"image",
"search",
"noteMap",
"launcher",
"doc",
"contentWidget",
"text",
"relationMap",
"render",
"canvas",
"mermaid",
"book",
"webView",
"code",
2025-01-20 18:45:56 +02:00
"mindMap",
"geoMap"
2025-01-09 18:07:02 +02:00
] as const;
export type NoteType = (typeof ALLOWED_NOTE_TYPES)[number];
2024-02-17 10:56:27 +02:00
export interface NoteRow {
noteId: string;
deleteId: string;
2024-02-17 10:56:27 +02:00
title: string;
type: NoteType;
mime: string;
isProtected: boolean;
isDeleted: boolean;
2024-02-17 10:56:27 +02:00
blobId: string;
dateCreated: string;
dateModified: string;
utcDateCreated: string;
utcDateModified: string;
content?: string | Buffer;
}