# Class BNote

Trilium's main entity, which can represent text note, image, code note, file attachment etc.

#### Hierarchy (View Summary)

- AbstractBeccaEntity < BNote >
  - BNote

- Defined in src/becca/entities/bnote.ts:81

##### Index

### Constructors

constructor

### Properties

__flatTextCache
blobId?
children
contentAndAttachmentsAndRevisionsSize
contentAndAttachmentsSize
contentSize
dateCreated?
dateModified?
isBeingDeleted
isDecrypted
isProtected?
isSynced?
mime
noteId
ownedAttributes
parentBranches
parents
revisionCount
targetRelations
title
type
utcDateCreated
utcDateModified?

### Accessors

attributeCount
becca
childrenCount
dateCreatedObj
dateModifiedObj
isArchived
isDeleted
labelCount
ownedAttributeCount
ownedLabelCount
ownedRelationCount
ownedRelationCountIncludingLinks
parentCount
relationCount
relationCountIncludingLinks
targetRelationCount
targetRelationCountIncludingLinks
utcDateCreatedObj
utcDateModifiedObj
entityName
hashedProperties
primaryKeyName

### Methods

__validateTypeName
_getContent
_setContent
addAttribute
addLabel
addRelation
areAllNotePathsArchived
beforeSaving
cloneTo
convertToParentAttachment
decrypt
deleteNote
eraseExcessRevisionSnapshots
generateHash
getAllNotePaths
getAncestorNoteIds
getAncestors
getAttachmentById
getAttachmentByTitle
getAttachments
getAttachmentsByRole
getAttribute
getAttributeCaseInsensitive
getAttributes
getAttributeValue
getBestNotePath
getBestNotePathString
getBranches
getChildBranches
getChildNotes
getContent
getDescendantNoteIds
getDistanceToAncestor
getFileName
getFilteredChildBranches
getFlatText
getIcon
getInheritingNotes
getJsonContent
getJsonContentSafely
getLabel
getLabelDefinitions
getLabels
getLabelValue
getLabelValues
getOwnedAttribute
getOwnedAttributes
getOwnedAttributeValue
getOwnedLabel
getOwnedLabels
getOwnedLabelValue
getOwnedLabelValues
getOwnedRelation
getOwnedRelations
getOwnedRelationValue
getParentBranches
getParentNotes
getPojo
getPojoToSave
getRelation
getRelationDefinitions
getRelations
getRelationTarget
getRelationValue
getRevisions
getScriptEnv
getSearchResultNotes
getSortedNotePathRecords
getStrongParentBranches
getSubtree
getSubtreeNoteIds
getSubtreeNotesIncludingTemplated
getTargetRelations
getTitleOrProtected
getUtcDateChanged
hasAncestor
hasAttribute
hasChildren
hasInheritableArchivedLabel
hasLabel
hasOwnedAttribute
hasOwnedLabel
hasOwnedRelation
hasRelation
hasStringContent
init
invalidateSubTree
invalidateThisCache
isContentAvailable
isDescendantOfNote
isEligibleForConversionToAttachment
isFolder
isHiddenCompletely
isHtml
isImage
isInherited
isInHiddenSubtree
isJavaScript
isJson
isLabelTruthy
isLaunchBarConfig
isOptions
isRoot
isStringNote
markAsDeleted
markAsDeletedSimple
putEntityChange
removeAttribute
removeLabel
removeRelation
save
saveAttachment
saveRevision
searchNoteInSubtree
searchNotesInSubtree
setAttribute
setContent
setJsonContent
setLabel
setRelation
sortChildren
sortParents
toggleAttribute
toggleLabel
toggleRelation
update
updateFromRow

## Constructors

### constructor

- new BNote(row?: Partial < NoteRow >): BNote

  #### Parameters

  - `Optional` row: Partial < NoteRow >

  #### Returns BNote

  Overrides AbstractBeccaEntity.constructor

  - Defined in src/becca/entities/bnote.ts:122

## Properties

### __flatTextCache

__flatTextCache: null | string

- Defined in src/becca/entities/bnote.ts:106

### `Optional` blobId

blobId?: string

Inherited from AbstractBeccaEntity.blobId

- Defined in src/becca/entities/abstract_becca_entity.ts:34

### children

children: BNote []

- Defined in src/becca/entities/bnote.ts:103

### contentAndAttachmentsAndRevisionsSize

contentAndAttachmentsAndRevisionsSize: null | number

size of the note content, attachment contents and revision contents in bytes

- Defined in src/becca/entities/bnote.ts:118

### contentAndAttachmentsSize

contentAndAttachmentsSize: null | number

size of the note content, attachment contents in bytes

- Defined in src/becca/entities/bnote.ts:116

### contentSize

contentSize: null | number

size of the content in bytes

- Defined in src/becca/entities/bnote.ts:114

### `Optional` dateCreated

dateCreated?: string

Inherited from AbstractBeccaEntity.dateCreated

- Defined in src/becca/entities/abstract_becca_entity.ts:27

### `Optional` dateModified

dateModified?: string

Inherited from AbstractBeccaEntity.dateModified

- Defined in src/becca/entities/abstract_becca_entity.ts:28

### isBeingDeleted

isBeingDeleted: boolean

set during the deletion operation, before it is completed (removed from becca completely).

- Defined in src/becca/entities/bnote.ts:97

### isDecrypted

isDecrypted: boolean

- Defined in src/becca/entities/bnote.ts:98

### `Optional` isProtected

isProtected?: boolean

Inherited from AbstractBeccaEntity.isProtected

- Defined in src/becca/entities/abstract_becca_entity.ts:32

### `Optional` isSynced

isSynced?: boolean

Inherited from AbstractBeccaEntity.isSynced

- Defined in src/becca/entities/abstract_becca_entity.ts:33

### mime

mime: string

- Defined in src/becca/entities/bnote.ts:95

### noteId

noteId: string

- Defined in src/becca/entities/bnote.ts:92

### ownedAttributes

ownedAttributes: BAttribute []

- Defined in src/becca/entities/bnote.ts:100

### parentBranches

parentBranches: BBranch []

- Defined in src/becca/entities/bnote.ts:101

### parents

parents: BNote []

- Defined in src/becca/entities/bnote.ts:102

### revisionCount

revisionCount: null | number

number of note revisions for this note

- Defined in src/becca/entities/bnote.ts:120

### targetRelations

targetRelations: BAttribute []

- Defined in src/becca/entities/bnote.ts:104

### title

title: string

- Defined in src/becca/entities/bnote.ts:93

### type

type:
| "canvas"
| "code"
| "search"
| "image"
| "text"
| "file"
| "noteMap"
| "launcher"
| "doc"
| "contentWidget"
| "relationMap"
| "render"
| "mermaid"
| "book"
| "webView"
| "mindMap"
| "geoMap"

- Defined in src/becca/entities/bnote.ts:94

### utcDateCreated

utcDateCreated: string

Inherited from AbstractBeccaEntity.utcDateCreated

- Defined in src/becca/entities/abstract_becca_entity.ts:30

### `Optional` utcDateModified

utcDateModified?: string

Inherited from AbstractBeccaEntity.utcDateModified

- Defined in src/becca/entities/abstract_becca_entity.ts:26

## Accessors

### attributeCount

- get attributeCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:1014

### `Protected` becca

- get becca(): default

  #### Returns default

  Inherited from AbstractBeccaEntity.becca

  - Defined in src/becca/entities/abstract_becca_entity.ts:47

### childrenCount

- get childrenCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:978

### dateCreatedObj

- get dateCreatedObj(): null | Dayjs

  #### Returns null | Dayjs

  - Defined in src/becca/entities/bnote.ts:271

### dateModifiedObj

- get dateModifiedObj(): null | Dayjs

  #### Returns null | Dayjs

  - Defined in src/becca/entities/bnote.ts:279

### isArchived

- get isArchived(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:717

### isDeleted

- get isDeleted(): boolean

  #### Returns boolean

  Overrides AbstractBeccaEntity.isDeleted

  - Defined in src/becca/entities/bnote.ts:1560

### labelCount

- get labelCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:982

### ownedAttributeCount

- get ownedAttributeCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:1018

### ownedLabelCount

- get ownedLabelCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:986

### ownedRelationCount

- get ownedRelationCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:998

### ownedRelationCountIncludingLinks

- get ownedRelationCountIncludingLinks(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:1002

### parentCount

- get parentCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:974

### relationCount

- get relationCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:990

### relationCountIncludingLinks

- get relationCountIncludingLinks(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:994

### targetRelationCount

- get targetRelationCount(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:1006

### targetRelationCountIncludingLinks

- get targetRelationCountIncludingLinks(): number

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:1010

### utcDateCreatedObj

- get utcDateCreatedObj(): null | Dayjs

  #### Returns null | Dayjs

  - Defined in src/becca/entities/bnote.ts:275

### utcDateModifiedObj

- get utcDateModifiedObj(): null | Dayjs

  #### Returns null | Dayjs

  - Defined in src/becca/entities/bnote.ts:283

### `Static` entityName

- get entityName(): string

  #### Returns string

  - Defined in src/becca/entities/bnote.ts:82

### `Static` hashedProperties

- get hashedProperties(): string[]

  #### Returns string[]

  - Defined in src/becca/entities/bnote.ts:88

### `Static` primaryKeyName

- get primaryKeyName(): string

  #### Returns string

  - Defined in src/becca/entities/bnote.ts:85

## Methods

### __validateTypeName

- __validateTypeName(type?: null | string, name?: null | string): void

  #### Parameters

  - `Optional` type: null | string
  - `Optional` name: null | string

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:445

### `Protected`_getContent

- _getContent(): string | Buffer< ArrayBufferLike >

  #### Returns string | Buffer< ArrayBufferLike >

  Inherited from AbstractBeccaEntity._getContent

  - Defined in src/becca/entities/abstract_becca_entity.ts:261

### `Protected`_setContent

- _setContent(content: string | Buffer< ArrayBufferLike >, opts?: ContentOpts ): void

  #### Parameters

  - content: string | Buffer< ArrayBufferLike >
  - opts: ContentOpts = {}

  #### Returns void

  Inherited from AbstractBeccaEntity._setContent

  - Defined in src/becca/entities/abstract_becca_entity.ts:140

### addAttribute

- addAttribute(
  type: AttributeType ,
  name: string,
  value?: string,
  isInheritable?: boolean,
  position?: null | number,
  ): BAttribute

  Adds a new attribute to this note. The attribute is saved and returned. See addLabel, addRelation for more specific methods.

  #### Parameters

  - type: AttributeType

    attribute type (label / relation)

  - name: string

    name of the attribute, not including the leading ~/#

  - value: string = ""

    value of the attribute - text for labels, target note ID for relations; optional.

  - isInheritable: boolean = false
  - position: null | number = null

  #### Returns BAttribute

  - Defined in src/becca/entities/bnote.ts:1306

### addLabel

- addLabel(name: string, value?: string, isInheritable?: boolean): BAttribute

  Adds a new label to this note. The label attribute is saved and returned.

  #### Parameters

  - name: string

    name of the label, not including the leading #

  - value: string = ""

    text value of the label; optional

  - isInheritable: boolean = false

  #### Returns BAttribute

  - Defined in src/becca/entities/bnote.ts:1323

### addRelation

- addRelation(
  name: string,
  targetNoteId: string,
  isInheritable?: boolean,
  ): BAttribute

  Adds a new relation to this note. The relation attribute is saved and returned.

  #### Parameters

  - name: string

    name of the relation, not including the leading ~

  - targetNoteId: string
  - isInheritable: boolean = false

  #### Returns BAttribute

  - Defined in src/becca/entities/bnote.ts:1333

### areAllNotePathsArchived

- areAllNotePathsArchived(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:721

### beforeSaving

- beforeSaving(): void

  #### Returns void

  Overrides AbstractBeccaEntity.beforeSaving

  - Defined in src/becca/entities/bnote.ts:1675

### cloneTo

- cloneTo(parentNoteId: string): CloneResponse

  #### Parameters

  - parentNoteId: string

  #### Returns CloneResponse

  - Defined in src/becca/entities/bnote.ts:1423

### convertToParentAttachment

- convertToParentAttachment(opts?: ConvertOpts ): null | BAttachment

  Some notes are eligible for conversion into an attachment of its parent, note must have these properties:

  - it has exactly one target relation
  - it has a relation from its parent note
  - it has no children
  - it has no clones
  - the parent is of type text
  - both notes are either unprotected or user is in protected session

  Currently, works only for image notes.

  In the future, this functionality might get more generic and some of the requirements relaxed.

  #### Parameters

  - opts: ConvertOpts = ...

  #### Returns null | BAttachment

  null if note is not eligible for conversion

  - Defined in src/becca/entities/bnote.ts:1475

### decrypt

- decrypt(): void

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1537

### deleteNote

- deleteNote(deleteId?: null | string, taskContext?: null | TaskContext ): void

  (Soft) delete a note and all its descendants.

  #### Parameters

  - deleteId: null | string = null

    optional delete identified

  - taskContext: null | TaskContext = null

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1515

### eraseExcessRevisionSnapshots

- eraseExcessRevisionSnapshots(): void

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1619

### generateHash

- generateHash(isDeleted?: boolean): string

  #### Parameters

  - `Optional` isDeleted: boolean

  #### Returns string

  Inherited from AbstractBeccaEntity.generateHash

  - Defined in src/becca/entities/abstract_becca_entity.ts:63

### getAllNotePaths

- getAllNotePaths(): string[][]

  Gives all possible note paths leading to this note. Paths containing search note are ignored (could form cycles)

  #### Returns string[][]

  array of notePaths (each represented by array of noteIds constituting the particular note path)

  - Defined in src/becca/entities/bnote.ts:1159

### getAncestorNoteIds

- getAncestorNoteIds(): string[]

  #### Returns string[]

  - Defined in src/becca/entities/bnote.ts:1047

### getAncestors

- getAncestors(): BNote []

  #### Returns BNote []

  - Defined in src/becca/entities/bnote.ts:1022

### getAttachmentById

- getAttachmentById(attachmentId: string, opts?: AttachmentOpts ): BAttachment

  #### Parameters

  - attachmentId: string
  - opts: AttachmentOpts = {}

  #### Returns BAttachment

  - Defined in src/becca/entities/bnote.ts:1121

### getAttachmentByTitle

- getAttachmentByTitle(title: string): undefined | BAttachment

  #### Parameters

  - title: string

  #### Returns undefined | BAttachment

  - Defined in src/becca/entities/bnote.ts:1149

### getAttachments

- getAttachments(opts?: AttachmentOpts ): BAttachment []

  #### Parameters

  - opts: AttachmentOpts = {}

  #### Returns BAttachment []

  - Defined in src/becca/entities/bnote.ts:1105

### getAttachmentsByRole

- getAttachmentsByRole(role: string): BAttachment []

  #### Parameters

  - role: string

  #### Returns BAttachment []

  - Defined in src/becca/entities/bnote.ts:1134

### getAttribute

- getAttribute(type: string, name: string): null | BAttribute

  #### Parameters

  - type: string

    attribute type (label, relation, etc.)

  - name: string

    attribute name

  #### Returns null | BAttribute

  attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.

  - Defined in src/becca/entities/bnote.ts:605

### getAttributeCaseInsensitive

- getAttributeCaseInsensitive(
  type: string,
  name: string,
  value?: null | string,
  ): undefined | BAttribute

  #### Parameters

  - type: string
  - name: string
  - `Optional` value: null | string

  #### Returns undefined | BAttribute

  - Defined in src/becca/entities/bnote.ts:462

### getAttributes

- getAttributes(type?: string, name?: string): BAttribute []

  Beware that the method must not create a copy of the array, but actually returns its internal array (for performance reasons)

  #### Parameters

  - `Optional` type: string

    (optional) attribute type to filter

  - `Optional` name: string

    (optional) attribute name to filter

  #### Returns BAttribute []

  all note's attributes, including inherited ones

  - Defined in src/becca/entities/bnote.ts:350

### getAttributeValue

- getAttributeValue(type: string, name: string): null | string

  #### Parameters

  - type: string

    attribute type (label, relation, etc.)

  - name: string

    attribute name

  #### Returns null | string

  attribute value of given type and name or null if no such attribute exists.

  - Defined in src/becca/entities/bnote.ts:616

### getBestNotePath

- getBestNotePath(hoistedNoteId?: string): string[]

  Returns a note path considered to be the "best"

  #### Parameters

  - hoistedNoteId: string = "root"

  #### Returns string[]

  array of noteIds constituting the particular note path

  - Defined in src/becca/entities/bnote.ts:1208

### getBestNotePathString

- getBestNotePathString(hoistedNoteId?: string): string

  Returns a note path considered to be the "best"

  #### Parameters

  - hoistedNoteId: string = "root"

  #### Returns string

  serialized note path (e.g. 'root/a1h315/js725h')

  - Defined in src/becca/entities/bnote.ts:1217

### getBranches

- getBranches(): BBranch []

  #### Returns BBranch []

  #### Deprecated

  use getParentBranches() instead

  - Defined in src/becca/entities/bnote.ts:207

### getChildBranches

- getChildBranches(): BBranch []

  #### Returns BBranch []

  - Defined in src/becca/entities/bnote.ts:223

### getChildNotes

- getChildNotes(): BNote []

  #### Returns BNote []

  - Defined in src/becca/entities/bnote.ts:215

### getContent

- getContent(): string | Buffer< ArrayBufferLike >

  Note content has quite special handling - it's not a separate entity, but a lazily loaded part of Note entity with its own sync. Reasons behind this hybrid design has been:

  - content can be quite large, and it's not necessary to load it / fill memory for any note access even if we don't need a content, especially for bulk operations like search
  - changes in the note metadata or title should not trigger note content sync (so we keep separate utcDateModified and entity changes records)
  - but to the user note content and title changes are one and the same - single dateModified (so all changes must go through Note and content is not a separate entity)

  #### Returns string | Buffer< ArrayBufferLike >

  - Defined in src/becca/entities/bnote.ts:235

### getDescendantNoteIds

- getDescendantNoteIds(): string[]

  #### Returns string[]

  #### Deprecated

  use getSubtreeNoteIds() instead

  - Defined in src/becca/entities/bnote.ts:970

### getDistanceToAncestor

- getDistanceToAncestor(ancestorNoteId: string): number

  #### Parameters

  - ancestorNoteId: string

  #### Returns number

  - Defined in src/becca/entities/bnote.ts:1087

### getFileName

- getFileName(): string

  #### Returns string

  - Defined in src/becca/entities/bnote.ts:1671

### getFilteredChildBranches

- getFilteredChildBranches(): BBranch []

  #### Returns BBranch []

  - Defined in src/becca/entities/bnote.ts:1745

### getFlatText

- getFlatText(): string

  This is used for:

  - fast searching
  - note similarity evaluation

  #### Returns string

  - returns flattened textual representation of note, prefixes and attributes
  - Defined in src/becca/entities/bnote.ts:784

### getIcon

- getIcon(): string

  #### Returns string

  - Defined in src/becca/entities/bnote.ts:1716

### getInheritingNotes

- getInheritingNotes(): BNote []

  #### Returns BNote []

  returns only notes which are templated, does not include their subtrees in effect returns notes which are influenced by note's non-inheritable attributes

  - Defined in src/becca/entities/bnote.ts:1071

### getJsonContent

- getJsonContent(): any

  #### Returns any

  #### Throws

  Error in case of invalid JSON

  - Defined in src/becca/entities/bnote.ts:242

### getJsonContentSafely

- getJsonContentSafely(): any

  #### Returns any

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

  - Defined in src/becca/entities/bnote.ts:253

### getLabel

- getLabel(name: string): null | BAttribute

  #### Parameters

  - name: string

    label name

  #### Returns null | BAttribute

  label if it exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:529

### getLabelDefinitions

- getLabelDefinitions(): BAttribute []

  #### Returns BAttribute []

  - Defined in src/becca/entities/bnote.ts:851

### getLabels

- getLabels(name?: string): BAttribute []

  #### Parameters

  - `Optional` name: string

    label name to filter

  #### Returns BAttribute []

  all note's labels (attributes with type label), including inherited ones

  - Defined in src/becca/entities/bnote.ts:637

### getLabelValue

- getLabelValue(name: string): null | string

  #### Parameters

  - name: string

    label name

  #### Returns null | string

  label value if label exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:561

### getLabelValues

- getLabelValues(name: string): string[]

  #### Parameters

  - name: string

    label name to filter

  #### Returns string[]

  all note's label values, including inherited ones

  - Defined in src/becca/entities/bnote.ts:645

### getOwnedAttribute

- getOwnedAttribute(
  type: string,
  name: string,
  value?: null | string,
  ): null | BAttribute

  #### Parameters

  - type: string
  - name: string
  - value: null | string = null

  #### Returns null | BAttribute

  attribute belonging to this specific note (excludes inherited attributes)

  This method can be significantly faster than the getAttribute()

  - Defined in src/becca/entities/bnote.ts:711

### getOwnedAttributes

- getOwnedAttributes(
  type?: null | string,
  name?: null | string,
  value?: null | string,
  ): BAttribute []

  Beware that the method must not create a copy of the array, but actually returns its internal array (for performance reasons)

  #### Parameters

  - type: null | string = null

    (optional) attribute type to filter

  - name: null | string = null

    (optional) attribute name to filter

  - value: null | string = null

    (optional) attribute value to filter

  #### Returns BAttribute []

  note's "owned" attributes - excluding inherited ones

  - Defined in src/becca/entities/bnote.ts:690

### getOwnedAttributeValue

- getOwnedAttributeValue(type: string, name: string): null | string

  #### Parameters

  - type: string

    attribute type (label, relation, etc.)

  - name: string

    attribute name

  #### Returns null | string

  attribute value of given type and name or null if no such attribute exists.

  - Defined in src/becca/entities/bnote.ts:627

### getOwnedLabel

- getOwnedLabel(name: string): null | BAttribute

  #### Parameters

  - name: string

    label name

  #### Returns null | BAttribute

  label if it exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:537

### getOwnedLabels

- getOwnedLabels(name: string): BAttribute []

  #### Parameters

  - name: string

    label name to filter

  #### Returns BAttribute []

  all note's labels (attributes with type label), excluding inherited ones

  - Defined in src/becca/entities/bnote.ts:653

### getOwnedLabelValue

- getOwnedLabelValue(name: string): null | string

  #### Parameters

  - name: string

    label name

  #### Returns null | string

  label value if label exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:569

### getOwnedLabelValues

- getOwnedLabelValues(name: string): string[]

  #### Parameters

  - name: string

    label name to filter

  #### Returns string[]

  all note's label values, excluding inherited ones

  - Defined in src/becca/entities/bnote.ts:661

### getOwnedRelation

- getOwnedRelation(name: string): null | BAttribute

  #### Parameters

  - name: string

    relation name

  #### Returns null | BAttribute

  relation if it exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:553

### getOwnedRelations

- getOwnedRelations(name?: null | string): BAttribute []

  #### Parameters

  - `Optional` name: null | string

    relation name to filter

  #### Returns BAttribute []

  all note's relations (attributes with type relation), excluding inherited ones

  - Defined in src/becca/entities/bnote.ts:677

### getOwnedRelationValue

- getOwnedRelationValue(name: string): null | string

  #### Parameters

  - name: string

    relation name

  #### Returns null | string

  relation value if relation exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:585

### getParentBranches

- getParentBranches(): BBranch []

  #### Returns BBranch []

  - Defined in src/becca/entities/bnote.ts:193

### getParentNotes

- getParentNotes(): BNote []

  #### Returns BNote []

  - Defined in src/becca/entities/bnote.ts:211

### getPojo

- getPojo(): NotePojo

  #### Returns NotePojo

  Overrides AbstractBeccaEntity.getPojo

  - Defined in src/becca/entities/bnote.ts:1684

### getPojoToSave

- getPojoToSave(): NotePojo

  #### Returns NotePojo

  Overrides AbstractBeccaEntity.getPojoToSave

  - Defined in src/becca/entities/bnote.ts:1700

### getRelation

- getRelation(name: string): null | BAttribute

  #### Parameters

  - name: string

    relation name

  #### Returns null | BAttribute

  relation if it exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:545

### getRelationDefinitions

- getRelationDefinitions(): BAttribute []

  #### Returns BAttribute []

  - Defined in src/becca/entities/bnote.ts:847

### getRelations

- getRelations(name?: string): BAttribute []

  #### Parameters

  - `Optional` name: string

    relation name to filter

  #### Returns BAttribute []

  all note's relations (attributes with type relation), including inherited ones

  - Defined in src/becca/entities/bnote.ts:669

### getRelationTarget

- getRelationTarget(name: string): undefined | null | BNote

  #### Parameters

  - name: string

  #### Returns undefined | null | BNote

  - Defined in src/becca/entities/bnote.ts:469

### getRelationValue

- getRelationValue(name: string): null | string

  #### Parameters

  - name: string

    relation name

  #### Returns null | string

  relation value if relation exists, null otherwise

  - Defined in src/becca/entities/bnote.ts:577

### getRevisions

- getRevisions(): BRevision []

  #### Returns BRevision []

  - Defined in src/becca/entities/bnote.ts:1101

### getScriptEnv

- getScriptEnv(): null | "frontend" | "backend"

  #### Returns null | "frontend" | "backend"

  JS script environment - either "frontend" or "backend"

  - Defined in src/becca/entities/bnote.ts:326

### getSearchResultNotes

- getSearchResultNotes(): BNote []

  #### Returns BNote []

  - Defined in src/becca/entities/bnote.ts:890

### getSortedNotePathRecords

- getSortedNotePathRecords(hoistedNoteId?: string): NotePathRecord []

  #### Parameters

  - hoistedNoteId: string = "root"

  #### Returns NotePathRecord []

  - Defined in src/becca/entities/bnote.ts:1178

### getStrongParentBranches

- getStrongParentBranches(): BBranch []

  Returns strong (as opposed to weak) parent branches. See isWeak for details.

  #### Returns BBranch []

  - Defined in src/becca/entities/bnote.ts:200

### getSubtree

- getSubtree(
  __namedParameters?: {
  includeArchived?: boolean;
  includeHidden?: boolean;
  resolveSearch?: boolean;
  },
  ): { notes: BNote []; relationships: Relationship [] }

  #### Parameters

  - __namedParameters: { includeArchived?: boolean; includeHidden?: boolean; resolveSearch?: boolean } = {}

  #### Returns { notes: BNote []; relationships: Relationship [] }

  - Defined in src/becca/entities/bnote.ts:905

### getSubtreeNoteIds

- getSubtreeNoteIds(
  __namedParameters?: {
  includeArchived?: boolean;
  includeHidden?: boolean;
  resolveSearch?: boolean;
  },
  ): string[]

  #### Parameters

  - __namedParameters: { includeArchived?: boolean; includeHidden?: boolean; resolveSearch?: boolean } = {}

  #### Returns string[]

  includes the subtree root note as well

  - Defined in src/becca/entities/bnote.ts:965

### getSubtreeNotesIncludingTemplated

- getSubtreeNotesIncludingTemplated(): BNote []

  #### Returns BNote []

  - Defined in src/becca/entities/bnote.ts:859

### getTargetRelations

- getTargetRelations(): BAttribute []

  #### Returns BAttribute []

  - Defined in src/becca/entities/bnote.ts:1065

### getTitleOrProtected

- getTitleOrProtected(): string

  #### Returns string

  - Defined in src/becca/entities/bnote.ts:189

### getUtcDateChanged

- getUtcDateChanged(): string

  #### Returns string

  Inherited from AbstractBeccaEntity.getUtcDateChanged

  - Defined in src/becca/entities/abstract_becca_entity.ts:43

### hasAncestor

- hasAncestor(ancestorNoteId: string): boolean

  #### Parameters

  - ancestorNoteId: string

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:1051

### hasAttribute

- hasAttribute(type: string, name: string, value?: null | string): boolean

  #### Parameters

  - type: string
  - name: string
  - value: null | string = null

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:458

### hasChildren

- hasChildren(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:219

### hasInheritableArchivedLabel

- hasInheritableArchivedLabel(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:736

### hasLabel

- hasLabel(name: string, value?: string): boolean

  #### Parameters

  - name: string

    label name

  - `Optional` value: string

    label value

  #### Returns boolean

  true if label exists (including inherited)

  - Defined in src/becca/entities/bnote.ts:480

### hasOwnedAttribute

- hasOwnedAttribute(type: string, name: string, value?: string): boolean

  #### Parameters

  - type: string
  - name: string

    attribute name

  - `Optional` value: string

    attribute value

  #### Returns boolean

  true if note has an attribute with given type and name (excluding inherited)

  - Defined in src/becca/entities/bnote.ts:595

### hasOwnedLabel

- hasOwnedLabel(name: string, value?: string): boolean

  #### Parameters

  - name: string

    label name

  - `Optional` value: string

    label value

  #### Returns boolean

  true if label exists (excluding inherited)

  - Defined in src/becca/entities/bnote.ts:503

### hasOwnedRelation

- hasOwnedRelation(name: string, value?: string): boolean

  #### Parameters

  - name: string

    relation name

  - `Optional` value: string

    relation value

  #### Returns boolean

  true if relation exists (excluding inherited)

  - Defined in src/becca/entities/bnote.ts:521

### hasRelation

- hasRelation(name: string, value?: string): boolean

  #### Parameters

  - name: string

    relation name

  - `Optional` value: string

    relation value

  #### Returns boolean

  true if relation exists (including inherited)

  - Defined in src/becca/entities/bnote.ts:512

### hasStringContent

- hasStringContent(): boolean

  #### Returns boolean

  true if the note has string content (not binary)

  Overrides AbstractBeccaEntity.hasStringContent

  - Defined in src/becca/entities/bnote.ts:321

### init

- init(): void

  #### Returns void

  Overrides AbstractBeccaEntity.init

  - Defined in src/becca/entities/bnote.ts:163

### invalidateSubTree

- invalidateSubTree(path?: string[]): void

  #### Parameters

  - path: string[] = []

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:821

### invalidateThisCache

- invalidateThisCache(): void

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:813

### isContentAvailable

- isContentAvailable(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:181

### isDescendantOfNote

- isDescendantOfNote(ancestorNoteId: string): boolean

  #### Parameters

  - ancestorNoteId: string

  #### Returns boolean

  true if ancestorNoteId occurs in at least one of the note's paths

  - Defined in src/becca/entities/bnote.ts:1247

### isEligibleForConversionToAttachment

- isEligibleForConversionToAttachment(opts?: ConvertOpts ): boolean

  #### Parameters

  - opts: ConvertOpts = ...

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:1435

### isFolder

- isFolder(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:1740

### isHiddenCompletely

- isHiddenCompletely(): boolean

  #### Returns boolean

  boolean - true if there's no non-hidden path, note is not cloned to the visible tree

  - Defined in src/becca/entities/bnote.ts:1226

### isHtml

- isHtml(): boolean

  #### Returns boolean

  true if this note is HTML

  - Defined in src/becca/entities/bnote.ts:306

### isImage

- isImage(): boolean

  #### Returns boolean

  true if this note is an image

  - Defined in src/becca/entities/bnote.ts:311

### isInherited

- isInherited(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:855

### isInHiddenSubtree

- isInHiddenSubtree(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:1061

### isJavaScript

- isJavaScript(): boolean

  #### Returns boolean

  true if this note is JavaScript (code or attachment)

  - Defined in src/becca/entities/bnote.ts:298

### isJson

- isJson(): boolean

  #### Returns boolean

  true if this note is of application/json content type

  - Defined in src/becca/entities/bnote.ts:293

### isLabelTruthy

- isLabelTruthy(name: string): boolean

  #### Parameters

  - name: string

    label name

  #### Returns boolean

  true if label exists (including inherited) and does not have "false" value.

  - Defined in src/becca/entities/bnote.ts:488

### isLaunchBarConfig

- isLaunchBarConfig(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:1550

### isOptions

- isOptions(): boolean

  #### Returns boolean

  - Defined in src/becca/entities/bnote.ts:1556

### isRoot

- isRoot(): boolean

  #### Returns boolean

  true if this note is the root of the note tree. Root note has "root" noteId

  - Defined in src/becca/entities/bnote.ts:288

### isStringNote

- isStringNote(): boolean

  #### Returns boolean

  #### Deprecated

  use hasStringContent() instead

  - Defined in src/becca/entities/bnote.ts:316

### markAsDeleted

- 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.

  #### Parameters

  - deleteId: null | string = null

  #### Returns void

  Inherited from AbstractBeccaEntity.markAsDeleted

  - Defined in src/becca/entities/abstract_becca_entity.ts:277

### markAsDeletedSimple

- markAsDeletedSimple(): void

  #### Returns void

  Inherited from AbstractBeccaEntity.markAsDeletedSimple

  - Defined in src/becca/entities/abstract_becca_entity.ts:303

### `Protected` putEntityChange

- putEntityChange(isDeleted: boolean): void

  #### Parameters

  - isDeleted: boolean

  #### Returns void

  Inherited from AbstractBeccaEntity.putEntityChange

  - Defined in src/becca/entities/abstract_becca_entity.ts:51

### removeAttribute

- removeAttribute(type: string, name: string, value?: string): void

  Removes given attribute name-value pair if it exists.

  #### Parameters

  - type: string

    attribute type (label, relation, etc.)

  - name: string

    attribute name

  - `Optional` value: string

    attribute value (optional)

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1288

### removeLabel

- removeLabel(name: string, value?: string): void

  Remove label name-value pair, if it exists.

  #### Parameters

  - name: string

    label name

  - `Optional` value: string

    label value

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1401

### removeRelation

- removeRelation(name: string, value?: string): void

  Remove the relation name-value pair, if it exists.

  #### Parameters

  - name: string

    relation name

  - `Optional` value: string

    relation value (noteId)

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1411

### save

- save(opts?: {}): this

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

  #### Parameters

  - `Optional` opts: {}

  #### Returns this

  Inherited from AbstractBeccaEntity.save

  - Defined in src/becca/entities/abstract_becca_entity.ts:103

### saveAttachment

- saveAttachment(
  __namedParameters: AttachmentRow ,
  matchBy?: undefined | "title" | "attachmentId",
  ): BAttachment

  #### Parameters

  - __namedParameters: AttachmentRow
  - matchBy: undefined | "title" | "attachmentId" = "attachmentId"

    choose by which property we detect if to update an existing attachment. Supported values are either 'attachmentId' (default) or 'title'

  #### Returns BAttachment

  - Defined in src/becca/entities/bnote.ts:1641

### saveRevision

- saveRevision(): BRevision

  #### Returns BRevision

  - Defined in src/becca/entities/bnote.ts:1566

### searchNoteInSubtree

- searchNoteInSubtree(searchString: string): BNote

  #### Parameters

  - searchString: string

  #### Returns BNote

  - Defined in src/becca/entities/bnote.ts:1419

### searchNotesInSubtree

- searchNotesInSubtree(searchString: string): BNote []

  #### Parameters

  - searchString: string

  #### Returns BNote []

  - Defined in src/becca/entities/bnote.ts:1415

### setAttribute

- setAttribute(type: AttributeType , name: string, value?: string): void

  Update's given attribute's value or creates it if it doesn't exist

  #### Parameters

  - type: AttributeType

    attribute type (label, relation, etc.)

  - name: string

    attribute name

  - `Optional` value: string

    attribute value (optional)

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1260

### setContent

- setContent(content: string | Buffer< ArrayBufferLike >, opts?: ContentOpts ): void

  #### Parameters

  - content: string | Buffer< ArrayBufferLike >
  - opts: ContentOpts = {}

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:261

### setJsonContent

- setJsonContent(content: {}): void

  #### Parameters

  - content: {}

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:267

### setLabel

- setLabel(name: string, value?: string): void

  Update's given label's value or creates it if it doesn't exist

  #### Parameters

  - name: string

    label name

  - `Optional` value: string

    label value

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1381

### setRelation

- setRelation(name: string, value?: string): void

  Update's given relation's value or creates it if it doesn't exist

  #### Parameters

  - name: string

    relation name

  - `Optional` value: string

    relation value (noteId)

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1391

### sortChildren

- sortChildren(): void

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:762

### sortParents

- sortParents(): void

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:748

### toggleAttribute

- toggleAttribute(
  type: AttributeType ,
  enabled: boolean,
  name: string,
  value?: string,
  ): void

  Based on enabled, the attribute is either set or removed.

  #### Parameters

  - type: AttributeType

    attribute type ('relation', 'label' etc.)

  - enabled: boolean

    toggle On or Off

  - name: string

    attribute name

  - `Optional` value: string

    attribute value (optional)

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1345

### toggleLabel

- toggleLabel(enabled: boolean, name: string, value?: string): void

  Based on enabled, label is either set or removed.

  #### Parameters

  - enabled: boolean

    toggle On or Off

  - name: string

    label name

  - `Optional` value: string

    label value (optional)

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1360

### toggleRelation

- toggleRelation(enabled: boolean, name: string, value?: string): void

  Based on enabled, relation is either set or removed.

  #### Parameters

  - enabled: boolean

    toggle On or Off

  - name: string

    relation name

  - `Optional` value: string

    relation value (noteId)

  #### Returns void

  - Defined in src/becca/entities/bnote.ts:1371

### update

- update(__namedParameters: any): BNote

  #### Parameters

  - __namedParameters: any

  #### Returns BNote

  - Defined in src/becca/entities/bnote.ts:137

### updateFromRow

- updateFromRow(row: Partial < NoteRow >): void

  #### Parameters

  - row: Partial < NoteRow >

  #### Returns void

  Overrides AbstractBeccaEntity.updateFromRow

  - Defined in src/becca/entities/bnote.ts:133