docs/Script API/classes/Backend_Script_API.BBranch.html
Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple parents.
Note that you should not rely on the branch's identity, since it can change easily with a note's move. Always check noteId instead.
blobId?branchId?dateCreated?dateModified?isExpandedisProtected?isSynced?noteIdnotePositionparentNoteIdprefixutcDateCreatedutcDateModified?
beccachildNoteisDeletedisWeakparentNoteentityNamehashedPropertiesprimaryKeyName
_getContent_setContentbeforeSavingcreateClonedeleteBranchgenerateHashgetNotegetPojogetPojoToSavegetUtcDateChangedhasStringContentinitmarkAsDeletedmarkAsDeletedSimpleputEntityChangesaveupdateupdateFromRow
new BBranch(row?: BranchRow): BBranch
Optionalrow: BranchRowOptionalblobIdblobId?: string
OptionalbranchIdbranchId?: string
OptionaldateCreateddateCreated?: string
OptionaldateModifieddateModified?: string
isExpanded: boolean
OptionalisProtectedisProtected?: boolean
OptionalisSyncedisSynced?: boolean
noteId: string
notePosition: number
parentNoteId: string
prefix: null | string
utcDateCreated: string
OptionalutcDateModifiedutcDateModified?: string
Protectedbeccaget becca(): default
get childNote(): BNote
get isDeleted(): boolean
get isWeak(): boolean
Branch is weak when its existence should not hinder deletion of its note. As a result, note with only weak branches should be immediately deleted. An example is shared or bookmarked clones - they are created automatically and exist for technical reasons, not as user-intended actions. From user perspective, they don't count as real clones and for the purpose of deletion should not act as a clone.
get parentNote(): undefined | BNote
root branch will have undefined parent, all other branches have to have a parent note
StaticentityNameget entityName(): string
StatichashedPropertiesget hashedProperties(): string[]
StaticprimaryKeyNameget primaryKeyName(): string
Protected_getContent_getContent(): string | Buffer<ArrayBufferLike>
Protected_setContent_setContent(content: string | Buffer<ArrayBufferLike>, opts?: ContentOpts): void
beforeSaving(): void
createClone(parentNoteId: string, notePosition?: number): BBranch
OptionalnotePosition: numberdeleteBranch(deleteId?: string, taskContext?: TaskContext): boolean
Delete a branch. If this is a last note's branch, delete the note as well.
OptionaldeleteId: stringoptional delete identified
OptionaltaskContext: TaskContexttrue if note has been deleted, false otherwise
generateHash(isDeleted?: boolean): string
OptionalisDeleted: booleangetNote(): BNote
getPojo(): {
branchId: undefined
| string;
isDeleted: boolean;
isExpanded: boolean;
noteId: string;
notePosition: number;
parentNoteId: string;
prefix: null | string;
utcDateModified: undefined | string;
}
ProtectedgetPojoToSavegetPojoToSave(): {}
getUtcDateChanged(): string
hasStringContent(): boolean
init(): void
markAsDeleted(deleteId?: null | string): void
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.
markAsDeletedSimple(): void
ProtectedputEntityChangeputEntityChange(isDeleted: boolean): void
save(opts?: {}): this
Saves entity - executes SQL, but doesn't commit the transaction on its own
Optionalopts: {}update(__namedParameters: any): BBranch
updateFromRow(row: BranchRow): void
Member Visibility
ThemeOSLightDark
Constructors constructor Properties blobIdbranchIddateCreateddateModifiedisExpandedisProtectedisSyncednoteIdnotePositionparentNoteIdprefixutcDateCreatedutcDateModified Accessors beccachildNoteisDeletedisWeakparentNoteentityNamehashedPropertiesprimaryKeyName Methods _getContent_setContentbeforeSavingcreateClonedeleteBranchgenerateHashgetNotegetPojogetPojoToSavegetUtcDateChangedhasStringContentinitmarkAsDeletedmarkAsDeletedSimpleputEntityChangesaveupdateupdateFromRow