Trilium Backend API
    Preparing search index...

    Interface BRevision

    Revision represents a snapshot of note's title and content at some point in the past. It's used for seamless note versioning.

    interface BRevision {
        blobId?: string;
        content?: string | Buffer<ArrayBufferLike>;
        contentLength?: number;
        dateCreated?: string;
        dateLastEdited?: string;
        dateModified?: string;
        isProtected?: boolean;
        isSynced?: boolean;
        mime: string;
        noteId: string;
        revisionId?: string;
        title: string;
        type:
            | "image"
            | "file"
            | "search"
            | "noteMap"
            | "launcher"
            | "doc"
            | "contentWidget"
            | "text"
            | "relationMap"
            | "render"
            | "canvas"
            | "mermaid"
            | "book"
            | "webView"
            | "code"
            | "mindMap"
            | "aiChat";
        utcDateCreated: string;
        utcDateLastEdited?: string;
        utcDateModified?: string;
        get becca(): default;
        get isDeleted(): boolean;
        _getContent(): string | Buffer<ArrayBufferLike>;
        _setContent(
            content: string | Buffer<ArrayBufferLike>,
            opts?: ContentOpts,
        ): void;
        beforeSaving(): void;
        eraseRevision(): void;
        generateHash(isDeleted?: boolean): string;
        getAttachmentById(attachmentId: String, opts?: GetByIdOpts): BAttachment;
        getAttachmentByTitle(title: string): BAttachment;
        getAttachments(): BAttachment[];
        getAttachmentsByRole(role: string): BAttachment[];
        getContent(): string | Buffer<ArrayBufferLike>;
        getJsonContent(): {};
        getJsonContentSafely(): {};
        getNote(): BNote;
        getPojo(): {
            blobId: string;
            content: string
            | Buffer<ArrayBufferLike>;
            contentLength: number;
            dateCreated: string;
            dateLastEdited: string;
            isProtected: boolean;
            mime: string;
            noteId: string;
            revisionId: string;
            title: string;
            type:
                | "image"
                | "file"
                | "search"
                | "noteMap"
                | "launcher"
                | "doc"
                | "contentWidget"
                | "text"
                | "relationMap"
                | "render"
                | "canvas"
                | "mermaid"
                | "book"
                | "webView"
                | "code"
                | "mindMap"
                | "aiChat";
            utcDateCreated: string;
            utcDateLastEdited: string;
            utcDateModified: string;
        };
        getPojoToSave(): {
            blobId: string;
            content: string
            | Buffer<ArrayBufferLike>;
            contentLength: number;
            dateCreated: string;
            dateLastEdited: string;
            isProtected: boolean;
            mime: string;
            noteId: string;
            revisionId: string;
            title: string;
            type:
                | "image"
                | "file"
                | "search"
                | "noteMap"
                | "launcher"
                | "doc"
                | "contentWidget"
                | "text"
                | "relationMap"
                | "render"
                | "canvas"
                | "mermaid"
                | "book"
                | "webView"
                | "code"
                | "mindMap"
                | "aiChat";
            utcDateCreated: string;
            utcDateLastEdited: string;
            utcDateModified: string;
        };
        getUtcDateChanged(): string;
        hasStringContent(): boolean;
        init(): void;
        isContentAvailable(): boolean;
        markAsDeleted(deleteId?: string): void;
        markAsDeletedSimple(): void;
        putEntityChange(isDeleted: boolean): void;
        save(opts?: {}): this;
        setContent(
            content: string | Buffer<ArrayBufferLike>,
            opts?: ContentOpts,
        ): void;
        updateFromRow(row: RevisionRow): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    blobId?: string
    content?: string | Buffer<ArrayBufferLike>
    contentLength?: number
    dateCreated?: string
    dateLastEdited?: string
    dateModified?: string
    isProtected?: boolean
    isSynced?: boolean
    mime: string
    noteId: string
    revisionId?: string
    title: string
    type:
        | "image"
        | "file"
        | "search"
        | "noteMap"
        | "launcher"
        | "doc"
        | "contentWidget"
        | "text"
        | "relationMap"
        | "render"
        | "canvas"
        | "mermaid"
        | "book"
        | "webView"
        | "code"
        | "mindMap"
        | "aiChat"
    utcDateCreated: string
    utcDateLastEdited?: string
    utcDateModified?: string

    Accessors

    • get becca(): default

      Returns default

    • get isDeleted(): boolean

      Returns boolean

    Methods

    • Revisions are not soft-deletable, they are immediately hard-deleted (erased).

      Returns void

    • Parameters

      • OptionalisDeleted: boolean

      Returns string

    • Parameters

      • title: string

      Returns BAttachment

    • Returns BAttachment[]

    • Parameters

      • role: string

      Returns BAttachment[]

    • Returns {}

      Error in case of invalid JSON

    • Returns {}

      valid object or null if the content cannot be parsed as JSON

    • Returns BNote

    • Returns {
          blobId: string;
          content: string | Buffer<ArrayBufferLike>;
          contentLength: number;
          dateCreated: string;
          dateLastEdited: string;
          isProtected: boolean;
          mime: string;
          noteId: string;
          revisionId: string;
          title: string;
          type:
              | "image"
              | "file"
              | "search"
              | "noteMap"
              | "launcher"
              | "doc"
              | "contentWidget"
              | "text"
              | "relationMap"
              | "render"
              | "canvas"
              | "mermaid"
              | "book"
              | "webView"
              | "code"
              | "mindMap"
              | "aiChat";
          utcDateCreated: string;
          utcDateLastEdited: string;
          utcDateModified: string;
      }

    • Returns {
          blobId: string;
          content: string | Buffer<ArrayBufferLike>;
          contentLength: number;
          dateCreated: string;
          dateLastEdited: string;
          isProtected: boolean;
          mime: string;
          noteId: string;
          revisionId: string;
          title: string;
          type:
              | "image"
              | "file"
              | "search"
              | "noteMap"
              | "launcher"
              | "doc"
              | "contentWidget"
              | "text"
              | "relationMap"
              | "render"
              | "canvas"
              | "mermaid"
              | "book"
              | "webView"
              | "code"
              | "mindMap"
              | "aiChat";
          utcDateCreated: string;
          utcDateLastEdited: string;
          utcDateModified: string;
      }

    • Returns boolean

      true if the note has string content (not binary)

    • Returns void

    • Returns boolean

    • Mark the entity as (soft) deleted. It will be completely erased later.

      This is a low-level method, for notes and branches use note.deleteNote() and 'branch.deleteBranch()` instead.

      Parameters

      • OptionaldeleteId: string

      Returns void

    • Parameters

      • isDeleted: boolean

      Returns void

    • Saves entity - executes SQL, but doesn't commit the transaction on its own

      Parameters

      • Optionalopts: {}

      Returns this