# Class default

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

#### Hierarchy (View Summary)

- default<default>
  - default

- Defined in becca/entities/bnote.ts:61

#####
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
getFlatText
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
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 default(row?: Partial<NoteRow>): default

- #### Parameters

  - `Optional` row: Partial<NoteRow>

  #### Returns default

  Overrides default.constructor

  - Defined in becca/entities/bnote.ts:96

##
Properties

### __flatTextCache

__flatTextCache: null | string

- Defined in becca/entities/bnote.ts:80

### `Optional` blobId

blobId?: string

Inherited from default.blobId

- Defined in becca/entities/abstract_becca_entity.ts:35

### children

children: default[]

- Defined in becca/entities/bnote.ts:77

### contentAndAttachmentsAndRevisionsSize

contentAndAttachmentsAndRevisionsSize: null | number

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

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

### contentAndAttachmentsSize

contentAndAttachmentsSize: null | number

size of the note content, attachment contents in bytes

- Defined in becca/entities/bnote.ts:90

### contentSize

contentSize: null | number

size of the content in bytes

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

### `Optional` dateCreated

dateCreated?: string

Inherited from default.dateCreated

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

### `Optional` dateModified

dateModified?: string

Inherited from default.dateModified

- Defined in becca/entities/abstract_becca_entity.ts:29

### isBeingDeleted

isBeingDeleted: boolean

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

- Defined in becca/entities/bnote.ts:71

### isDecrypted

isDecrypted: boolean

- Defined in becca/entities/bnote.ts:72

### `Optional` isProtected

isProtected?: boolean

Inherited from default.isProtected

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

### `Optional` isSynced

isSynced?: boolean

Inherited from default.isSynced

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

### mime

mime: string

- Defined in becca/entities/bnote.ts:69

### noteId

noteId: string

- Defined in becca/entities/bnote.ts:66

### ownedAttributes

ownedAttributes: default[]

- Defined in becca/entities/bnote.ts:74

### parentBranches

parentBranches: default[]

- Defined in becca/entities/bnote.ts:75

### parents

parents: default[]

- Defined in becca/entities/bnote.ts:76

### revisionCount

revisionCount: null | number

number of note revisions for this note

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

### targetRelations

targetRelations: default[]

- Defined in becca/entities/bnote.ts:78

### title

title: string

- Defined in becca/entities/bnote.ts:67

### type

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

- Defined in becca/entities/bnote.ts:68

### utcDateCreated

utcDateCreated: string

Inherited from default.utcDateCreated

- Defined in becca/entities/abstract_becca_entity.ts:31

### `Optional` utcDateModified

utcDateModified?: string

Inherited from default.utcDateModified

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

##
Accessors

### attributeCount

- get attributeCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1024

### `Protected` becca

- get becca(): Becca

- #### Returns Becca

  Inherited from AbstractBeccaEntity.becca

  - Defined in becca/entities/abstract_becca_entity.ts:48

### childrenCount

- get childrenCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:988

### dateCreatedObj

- get dateCreatedObj(): null | Dayjs

- #### Returns null | Dayjs

  - Defined in becca/entities/bnote.ts:256

### dateModifiedObj

- get dateModifiedObj(): null | Dayjs

- #### Returns null | Dayjs

  - Defined in becca/entities/bnote.ts:264

### isArchived

- get isArchived(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:716

### isDeleted

- get isDeleted(): boolean

- #### Returns boolean

  Overrides AbstractBeccaEntity.isDeleted

  - Defined in becca/entities/bnote.ts:1569

### labelCount

- get labelCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:992

### ownedAttributeCount

- get ownedAttributeCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1028

### ownedLabelCount

- get ownedLabelCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:996

### ownedRelationCount

- get ownedRelationCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1008

### ownedRelationCountIncludingLinks

- get ownedRelationCountIncludingLinks(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1012

### parentCount

- get parentCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:984

### relationCount

- get relationCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1000

### relationCountIncludingLinks

- get relationCountIncludingLinks(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1004

### targetRelationCount

- get targetRelationCount(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1016

### targetRelationCountIncludingLinks

- get targetRelationCountIncludingLinks(): number

- #### Returns number

  - Defined in becca/entities/bnote.ts:1020

### utcDateCreatedObj

- get utcDateCreatedObj(): null | Dayjs

- #### Returns null | Dayjs

  - Defined in becca/entities/bnote.ts:260

### utcDateModifiedObj

- get utcDateModifiedObj(): null | Dayjs

- #### Returns null | Dayjs

  - Defined in becca/entities/bnote.ts:268

### `Static` entityName

- get entityName(): string

- #### Returns string

  - Defined in becca/entities/bnote.ts:62

### `Static` hashedProperties

- get hashedProperties(): string[]

- #### Returns string[]

  - Defined in becca/entities/bnote.ts:64

### `Static` primaryKeyName

- get primaryKeyName(): string

- #### Returns string

  - Defined in becca/entities/bnote.ts:63

##
Methods

### __validateTypeName

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

- #### Parameters

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

  #### Returns void

  - Defined in becca/entities/bnote.ts:433

### `Protected`_getContent

- _getContent(): string | Buffer<ArrayBufferLike>

- #### Returns string | Buffer<ArrayBufferLike>

  Inherited from default._getContent

  - Defined in becca/entities/abstract_becca_entity.ts:264

### `Protected`_setContent

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

- #### Parameters

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

  #### Returns void

  Inherited from default._setContent

  - Defined in becca/entities/abstract_becca_entity.ts:141

### addAttribute

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

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

  - Defined in becca/entities/bnote.ts:1315

### addLabel

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

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

  - Defined in becca/entities/bnote.ts:1332

### addRelation

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

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

  - Defined in becca/entities/bnote.ts:1342

### areAllNotePathsArchived

- areAllNotePathsArchived(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:720

### beforeSaving

- beforeSaving(): void

- #### Returns void

  Overrides default.beforeSaving

  - Defined in becca/entities/bnote.ts:1678

### cloneTo

- cloneTo(parentNoteId: string): CloneResponse

- #### Parameters

  - parentNoteId: string

  #### Returns CloneResponse

  - Defined in becca/entities/bnote.ts:1433

### convertToParentAttachment

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

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

  null if note is not eligible for conversion

  - Defined in becca/entities/bnote.ts:1485

### decrypt

- decrypt(): void

- #### Returns void

  - Defined in becca/entities/bnote.ts:1547

### 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 becca/entities/bnote.ts:1525

### eraseExcessRevisionSnapshots

- eraseExcessRevisionSnapshots(): void

- #### Returns void

  - Defined in becca/entities/bnote.ts:1624

### generateHash

- generateHash(isDeleted?: boolean): string

- #### Parameters

  - `Optional` isDeleted: boolean

  #### Returns string

  Inherited from default.generateHash

  - Defined in becca/entities/abstract_becca_entity.ts:64

### 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 becca/entities/bnote.ts:1168

### getAncestorNoteIds

- getAncestorNoteIds(): string[]

- #### Returns string[]

  - Defined in becca/entities/bnote.ts:1057

### getAncestors

- getAncestors(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:1032

### getAttachmentById

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

- #### Parameters

  - attachmentId: string
  - opts: AttachmentOpts = {}

  #### Returns default

  - Defined in becca/entities/bnote.ts:1133

### getAttachmentByTitle

- getAttachmentByTitle(title: string): undefined | default

- #### Parameters

  - title: string

  #### Returns undefined | default

  - Defined in becca/entities/bnote.ts:1158

### getAttachments

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

- #### Parameters

  - opts: AttachmentOpts = {}

  #### Returns default[]

  - Defined in becca/entities/bnote.ts:1116

### getAttachmentsByRole

- getAttachmentsByRole(role: string): default[]

- #### Parameters

  - role: string

  #### Returns default[]

  - Defined in becca/entities/bnote.ts:1147

### getAttribute

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

- #### Parameters

  - type: string

    attribute type (label, relation, etc.)

  - name: string

    attribute name

  #### Returns null | default

  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 becca/entities/bnote.ts:600

### getAttributeCaseInsensitive

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

- #### Parameters

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

  #### Returns undefined | default

  - Defined in becca/entities/bnote.ts:454

### getAttributes

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

- 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 default[]

  all note's attributes, including inherited ones

  - Defined in becca/entities/bnote.ts:337

### 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 becca/entities/bnote.ts:611

### 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 becca/entities/bnote.ts:1216

### 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 becca/entities/bnote.ts:1225

### getBranches

- getBranches(): default[]

- #### Returns default[]

  #### Deprecated

  use getParentBranches() instead

  - Defined in becca/entities/bnote.ts:190

### getChildBranches

- getChildBranches(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:206

### getChildNotes

- getChildNotes(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:198

### 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 becca/entities/bnote.ts:219

### getDescendantNoteIds

- getDescendantNoteIds(): string[]

- #### Returns string[]

  #### Deprecated

  use getSubtreeNoteIds() instead

  - Defined in becca/entities/bnote.ts:980

### getDistanceToAncestor

- getDistanceToAncestor(ancestorNoteId: string): number

- #### Parameters

  - ancestorNoteId: string

  #### Returns number

  - Defined in becca/entities/bnote.ts:1097

### getFileName

- getFileName(): string

- #### Returns string

  - Defined in becca/entities/bnote.ts:1674

### 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 becca/entities/bnote.ts:785

### getInheritingNotes

- getInheritingNotes(): default[]

- #### Returns default[]

  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 becca/entities/bnote.ts:1081

### getJsonContent

- getJsonContent(): any

- #### Returns any

  #### Throws

  Error in case of invalid JSON

  - Defined in becca/entities/bnote.ts:226

### getJsonContentSafely

- getJsonContentSafely(): any

- #### Returns any

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

  - Defined in becca/entities/bnote.ts:237

### getLabel

- getLabel(name: string): null | default

- #### Parameters

  - name: string

    label name

  #### Returns null | default

  label if it exists, null otherwise

  - Defined in becca/entities/bnote.ts:524

### getLabelDefinitions

- getLabelDefinitions(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:853

### getLabels

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

- #### Parameters

  - `Optional` name: string

    label name to filter

  #### Returns default[]

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

  - Defined in becca/entities/bnote.ts:632

### getLabelValue

- getLabelValue(name: string): null | string

- #### Parameters

  - name: string

    label name

  #### Returns null | string

  label value if label exists, null otherwise

  - Defined in becca/entities/bnote.ts:556

### getLabelValues

- getLabelValues(name: string): string[]

- #### Parameters

  - name: string

    label name to filter

  #### Returns string[]

  all note's label values, including inherited ones

  - Defined in becca/entities/bnote.ts:640

### getOwnedAttribute

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

- #### Parameters

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

  #### Returns null | default

  attribute belonging to this specific note (excludes inherited attributes)

  This method can be significantly faster than the getAttribute()

  - Defined in becca/entities/bnote.ts:710

### getOwnedAttributes

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

- 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 default[]

  note's "owned" attributes - excluding inherited ones

  - Defined in becca/entities/bnote.ts:685

### 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 becca/entities/bnote.ts:622

### getOwnedLabel

- getOwnedLabel(name: string): null | default

- #### Parameters

  - name: string

    label name

  #### Returns null | default

  label if it exists, null otherwise

  - Defined in becca/entities/bnote.ts:532

### getOwnedLabels

- getOwnedLabels(name: string): default[]

- #### Parameters

  - name: string

    label name to filter

  #### Returns default[]

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

  - Defined in becca/entities/bnote.ts:648

### getOwnedLabelValue

- getOwnedLabelValue(name: string): null | string

- #### Parameters

  - name: string

    label name

  #### Returns null | string

  label value if label exists, null otherwise

  - Defined in becca/entities/bnote.ts:564

### getOwnedLabelValues

- getOwnedLabelValues(name: string): string[]

- #### Parameters

  - name: string

    label name to filter

  #### Returns string[]

  all note's label values, excluding inherited ones

  - Defined in becca/entities/bnote.ts:656

### getOwnedRelation

- getOwnedRelation(name: string): null | default

- #### Parameters

  - name: string

    relation name

  #### Returns null | default

  relation if it exists, null otherwise

  - Defined in becca/entities/bnote.ts:548

### getOwnedRelations

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

- #### Parameters

  - `Optional` name: null | string

    relation name to filter

  #### Returns default[]

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

  - Defined in becca/entities/bnote.ts:672

### getOwnedRelationValue

- getOwnedRelationValue(name: string): null | string

- #### Parameters

  - name: string

    relation name

  #### Returns null | string

  relation value if relation exists, null otherwise

  - Defined in becca/entities/bnote.ts:580

### getParentBranches

- getParentBranches(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:176

### getParentNotes

- getParentNotes(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:194

### getPojo

- getPojo(): NotePojo

- #### Returns NotePojo

  Overrides default.getPojo

  - Defined in becca/entities/bnote.ts:1687

### getPojoToSave

- getPojoToSave(): NotePojo

- #### Returns NotePojo

  Overrides default.getPojoToSave

  - Defined in becca/entities/bnote.ts:1703

### getRelation

- getRelation(name: string): null | default

- #### Parameters

  - name: string

    relation name

  #### Returns null | default

  relation if it exists, null otherwise

  - Defined in becca/entities/bnote.ts:540

### getRelationDefinitions

- getRelationDefinitions(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:848

### getRelations

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

- #### Parameters

  - `Optional` name: string

    relation name to filter

  #### Returns default[]

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

  - Defined in becca/entities/bnote.ts:664

### getRelationTarget

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

- #### Parameters

  - name: string

  #### Returns undefined | null | default

  - Defined in becca/entities/bnote.ts:464

### getRelationValue

- getRelationValue(name: string): null | string

- #### Parameters

  - name: string

    relation name

  #### Returns null | string

  relation value if relation exists, null otherwise

  - Defined in becca/entities/bnote.ts:572

### getRevisions

- getRevisions(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:1111

### getScriptEnv

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

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

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

  - Defined in becca/entities/bnote.ts:313

### getSearchResultNotes

- getSearchResultNotes(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:893

### getSortedNotePathRecords

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

- #### Parameters

  - hoistedNoteId: string = 'root'

  #### Returns NotePathRecord[]

  - Defined in becca/entities/bnote.ts:1186

### getStrongParentBranches

- getStrongParentBranches(): default[]

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

  #### Returns default[]

  - Defined in becca/entities/bnote.ts:183

### getSubtree

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

- #### Parameters

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

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

  - Defined in becca/entities/bnote.ts:911

### 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 becca/entities/bnote.ts:973

### getSubtreeNotesIncludingTemplated

- getSubtreeNotesIncludingTemplated(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:862

### getTargetRelations

- getTargetRelations(): default[]

- #### Returns default[]

  - Defined in becca/entities/bnote.ts:1075

### getTitleOrProtected

- getTitleOrProtected(): string

- #### Returns string

  - Defined in becca/entities/bnote.ts:172

### getUtcDateChanged

- getUtcDateChanged(): string

- #### Returns string

  Inherited from default.getUtcDateChanged

  - Defined in becca/entities/abstract_becca_entity.ts:44

### hasAncestor

- hasAncestor(ancestorNoteId: string): boolean

- #### Parameters

  - ancestorNoteId: string

  #### Returns boolean

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

### hasAttribute

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

- #### Parameters

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

  #### Returns boolean

  - Defined in becca/entities/bnote.ts:446

### hasChildren

- hasChildren(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:202

### hasInheritableArchivedLabel

- hasInheritableArchivedLabel(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:735

### 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 becca/entities/bnote.ts:475

### 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 becca/entities/bnote.ts:590

### 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 becca/entities/bnote.ts:498

### 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 becca/entities/bnote.ts:516

### 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 becca/entities/bnote.ts:507

### hasStringContent

- hasStringContent(): boolean

- #### Returns boolean

  true if the note has string content (not binary)

  Overrides default.hasStringContent

  - Defined in becca/entities/bnote.ts:308

### init

- init(): void

- #### Returns void

  Overrides default.init

  - Defined in becca/entities/bnote.ts:148

### invalidateSubTree

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

- #### Parameters

  - path: string[] = []

  #### Returns void

  - Defined in becca/entities/bnote.ts:822

### invalidateThisCache

- invalidateThisCache(): void

- #### Returns void

  - Defined in becca/entities/bnote.ts:814

### isContentAvailable

- isContentAvailable(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:166

### 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 becca/entities/bnote.ts:1255

### isEligibleForConversionToAttachment

- isEligibleForConversionToAttachment(opts?: ConvertOpts): boolean

- #### Parameters

  - opts: ConvertOpts = ...

  #### Returns boolean

  - Defined in becca/entities/bnote.ts:1445

### isHiddenCompletely

- isHiddenCompletely(): boolean

- #### Returns boolean

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

  - Defined in becca/entities/bnote.ts:1234

### isHtml

- isHtml(): boolean

- #### Returns boolean

  true if this note is HTML

  - Defined in becca/entities/bnote.ts:291

### isImage

- isImage(): boolean

- #### Returns boolean

  true if this note is an image

  - Defined in becca/entities/bnote.ts:297

### isInherited

- isInherited(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:858

### isInHiddenSubtree

- isInHiddenSubtree(): boolean

- #### Returns boolean

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

### isJavaScript

- isJavaScript(): boolean

- #### Returns boolean

  true if this note is JavaScript (code or attachment)

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

### isJson

- isJson(): boolean

- #### Returns boolean

  true if this note is of application/json content type

  - Defined in becca/entities/bnote.ts:278

### 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 becca/entities/bnote.ts:483

### isLaunchBarConfig

- isLaunchBarConfig(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:1561

### isOptions

- isOptions(): boolean

- #### Returns boolean

  - Defined in becca/entities/bnote.ts:1565

### isRoot

- isRoot(): boolean

- #### Returns boolean

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

  - Defined in becca/entities/bnote.ts:273

### isStringNote

- isStringNote(): boolean

- #### Returns boolean

  #### Deprecated

  use hasStringContent() instead

  - Defined in becca/entities/bnote.ts:303

### 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 default.markAsDeleted

  - Defined in becca/entities/abstract_becca_entity.ts:280

### markAsDeletedSimple

- markAsDeletedSimple(): void

- #### Returns void

  Inherited from default.markAsDeletedSimple

  - Defined in becca/entities/abstract_becca_entity.ts:305

### `Protected` putEntityChange

- putEntityChange(isDeleted: boolean): void

- #### Parameters

  - isDeleted: boolean

  #### Returns void

  Inherited from default.putEntityChange

  - Defined in becca/entities/abstract_becca_entity.ts:52

### 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 becca/entities/bnote.ts:1297

### 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 becca/entities/bnote.ts:1411

### 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 becca/entities/bnote.ts:1421

### save

- save(opts?: {}): this

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

  #### Parameters

  - `Optional` opts: {}

  #### Returns this

  Inherited from default.save

  - Defined in becca/entities/abstract_becca_entity.ts:104

### saveAttachment

- saveAttachment(__namedParameters: AttachmentRow, matchBy?: string): default

- #### Parameters

  - __namedParameters: AttachmentRow
  - matchBy: string = 'attachmentId'

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

  #### Returns default

  - Defined in becca/entities/bnote.ts:1646

### saveRevision

- saveRevision(): default

- #### Returns default

  - Defined in becca/entities/bnote.ts:1575

### searchNoteInSubtree

- searchNoteInSubtree(searchString: string): default

- #### Parameters

  - searchString: string

  #### Returns default

  - Defined in becca/entities/bnote.ts:1429

### searchNotesInSubtree

- searchNotesInSubtree(searchString: string): default[]

- #### Parameters

  - searchString: string

  #### Returns default[]

  - Defined in becca/entities/bnote.ts:1425

### 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 becca/entities/bnote.ts:1268

### setContent

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

- #### Parameters

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

  #### Returns void

  - Defined in becca/entities/bnote.ts:246

### setJsonContent

- setJsonContent(content: {}): void

- #### Parameters

  - content: {}

  #### Returns void

  - Defined in becca/entities/bnote.ts:252

### 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 becca/entities/bnote.ts:1391

### 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 becca/entities/bnote.ts:1401

### sortChildren

- sortChildren(): void

- #### Returns void

  - Defined in becca/entities/bnote.ts:763

### sortParents

- sortParents(): void

- #### Returns void

  - Defined in becca/entities/bnote.ts:747

### 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 becca/entities/bnote.ts:1354

### 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 becca/entities/bnote.ts:1370

### 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 becca/entities/bnote.ts:1381

### update

- update(__namedParameters: any): default

- #### Parameters

  - __namedParameters: any

  #### Returns default

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

### updateFromRow

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

- #### Parameters

  - row: Partial<NoteRow>

  #### Returns void

  Overrides default.updateFromRow

  - Defined in becca/entities/bnote.ts:107