# Class: FNote

## FNote(froca, row)

Note is the main node and concept in Trilium.

## Constructor

#### new FNote(froca, row)

##### Parameters:

Name | Type | Description
--- | --- | ---
`froca` | Froca |
`row` | Object.<string, Object> |

Source:
  - entities/fnote.js, line 47

### Members

#### attachments :Array.<FAttachment>|null

##### Type:

- Array.<FAttachment> | null

Source:
  - entities/fnote.js, line 74

#### attributes :Array.<string>

##### Type:

- Array.<string>

Source:
  - entities/fnote.js, line 57

#### childToBranch :Object.<string, string>

##### Type:

- Object.<string, string>

Source:
  - entities/fnote.js, line 71

#### children :Array.<string>

##### Type:

- Array.<string>

Source:
  - entities/fnote.js, line 65

#### froca :Froca

##### Type:

- Froca

Source:
  - entities/fnote.js, line 54

#### isProtected :boolean

##### Type:

- boolean

Source:
  - entities/fnote.js, line 85

#### mime :string

content-type, e.g. "application/json"

##### Type:

- string

Source:
  - entities/fnote.js, line 95

#### noteId :string

##### Type:

- string

Source:
  - entities/fnote.js, line 81

#### parentToBranch :Object.<string, string>

##### Type:

- Object.<string, string>

Source:
  - entities/fnote.js, line 68

#### parents :Array.<string>

##### Type:

- Array.<string>

Source:
  - entities/fnote.js, line 63

#### targetRelations :Array.<string>

##### Type:

- Array.<string>

Source:
  - entities/fnote.js, line 60

#### title :string

##### Type:

- string

Source:
  - entities/fnote.js, line 83

#### type :NoteType

See {@see NoteType} for info on values.

##### Type:

- NoteType

Source:
  - entities/fnote.js, line 90

### Methods

#### getAllNotePaths() → {Array.<Array.<string>>}

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

Source:
  - entities/fnote.js, line 381

##### Returns:

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

Type
  Array.<Array.<string>>

#### (async) getAttachmentById() → {Promise.<FAttachment>}

Source:
  - entities/fnote.js, line 268

##### Returns:

Type
  Promise.<FAttachment>

#### (async) getAttachments() → {Promise.<Array.<FAttachment>>}

Source:
  - entities/fnote.js, line 253

##### Returns:

Type
  Promise.<Array.<FAttachment>>

#### (async) getAttachmentsByRole() → {Promise.<Array.<FAttachment>>}

Source:
  - entities/fnote.js, line 262

##### Returns:

Type
  Promise.<Array.<FAttachment>>

#### getAttribute(type, name) → {FAttribute}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | AttributeType | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - entities/fnote.js, line 644

##### Returns:

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.

Type
  FAttribute

#### getAttributeValue(type, name) → {string}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | AttributeType | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - entities/fnote.js, line 666

##### Returns:

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

Type
  string

#### getAttributes(typeopt, nameopt) → {Array.<FAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`type` | string | <optional> | (optional) attribute type to filter
`name` | string | <optional> | (optional) attribute name to filter

Source:
  - entities/fnote.js, line 315

##### Returns:

all note's attributes, including inherited ones

Type
  Array.<FAttribute>

#### getBestNotePath(hoistedNoteIdopt) → {Array.<string>}

Returns the note path considered to be the "best"

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`hoistedNoteId` | string | <optional> | 'root' |

Source:
  - entities/fnote.js, line 437

##### Returns:

array of noteIds constituting the particular note path

Type
  Array.<string>

#### getBestNotePathString(hoistedNoteIdopt) → {string}

Returns the note path considered to be the "best"

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`hoistedNoteId` | string | <optional> | 'root' |

Source:
  - entities/fnote.js, line 447

##### Returns:

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

Type
  string

#### (async) getBlob() → {Promise.<FBlob>}

Source:
  - entities/fnote.js, line 891

##### Returns:

Type
  Promise.<FBlob>

#### getBranchIds() → {Array.<string>}

Deprecated:
  - use getParentBranchIds() instead
Source:
  - entities/fnote.js, line 174

##### Returns:

Type
  Array.<string>

#### getBranches() → {Array.<FBranch>}

Deprecated:
  - use getParentBranches() instead
Source:
  - entities/fnote.js, line 191

##### Returns:

Type
  Array.<FBranch>

#### getChildBranches() → {Array.<FBranch>}

Source:
  - entities/fnote.js, line 201

##### Returns:

Type
  Array.<FBranch>

#### getChildNoteIds() → {Array.<string>}

Source:
  - entities/fnote.js, line 243

##### Returns:

Type
  Array.<string>

#### (async) getChildNotes() → {Promise.<Array.<FNote>>}

Source:
  - entities/fnote.js, line 248

##### Returns:

Type
  Promise.<Array.<FNote>>

#### getLabel(name) → {FAttribute}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - entities/fnote.js, line 720

##### Returns:

label if it exists, null otherwise

Type
  FAttribute

#### getLabelValue(name) → {string}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - entities/fnote.js, line 744

##### Returns:

label value if label exists, null otherwise

Type
  string

#### getLabels(nameopt) → {Array.<FAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | label name to filter

Source:
  - entities/fnote.js, line 530

##### Returns:

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

Type
  Array.<FAttribute>

#### (async) getMetadata() → {Promise.<{dateCreated: string, utcDateCreated: string, dateModified: string, utcDateModified: string}>}

Provides note's date metadata.

Source:
  - entities/fnote.js, line 1007

##### Returns:

Type
  Promise.<{dateCreated: string, utcDateCreated: string, dateModified: string, utcDateModified: string}>

#### (async) getNoteComplement() → {Promise.<FBlob>}

Deprecated:
  - use getBlob() instead
Source:
  - entities/fnote.js, line 886

##### Returns:

Type
  Promise.<FBlob>

#### getNotesToInheritAttributesFrom() → {Array.<FNote>}

Source:
  - entities/fnote.js, line 786

##### Returns:

Type
  Array.<FNote>

#### getOwnedAttribute(type, name) → {FAttribute}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | AttributeType | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - entities/fnote.js, line 633

##### Returns:

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.

Type
  FAttribute

#### getOwnedAttributeValue(type, name) → {string}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | AttributeType | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - entities/fnote.js, line 655

##### Returns:

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

Type
  string

#### getOwnedAttributes(typeopt, nameopt) → {Array.<FAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`type` | string | <optional> | (optional) attribute type to filter
`name` | string | <optional> | (optional) attribute name to filter

Source:
  - entities/fnote.js, line 302

##### Returns:

all note's attributes, including inherited ones

Type
  Array.<FAttribute>

#### getOwnedLabel(name) → {FAttribute}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - entities/fnote.js, line 714

##### Returns:

label if it exists, null otherwise

Type
  FAttribute

#### getOwnedLabelValue(name) → {string}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - entities/fnote.js, line 738

##### Returns:

label value if label exists, null otherwise

Type
  string

#### getOwnedLabels(nameopt) → {Array.<FAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | label name to filter

Source:
  - entities/fnote.js, line 522

##### Returns:

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

Type
  Array.<FAttribute>

#### getOwnedRelation(name) → {FAttribute}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - entities/fnote.js, line 726

##### Returns:

relation if it exists, null otherwise

Type
  FAttribute

#### getOwnedRelationValue(name) → {string}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - entities/fnote.js, line 750

##### Returns:

relation value if relation exists, null otherwise

Type
  string

#### getOwnedRelations(nameopt) → {Array.<FAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | relation name to filter

Source:
  - entities/fnote.js, line 596

##### Returns:

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

Type
  Array.<FAttribute>

#### getParentBranchIds() → {Array.<string>}

Source:
  - entities/fnote.js, line 166

##### Returns:

Type
  Array.<string>

#### getParentBranches() → {Array.<FBranch>}

Source:
  - entities/fnote.js, line 181

##### Returns:

Type
  Array.<FBranch>

#### getParentNoteIds() → {Array.<string>}

Source:
  - entities/fnote.js, line 209

##### Returns:

Type
  Array.<string>

#### getParentNotes() → {Array.<FNote>}

Source:
  - entities/fnote.js, line 214

##### Returns:

Type
  Array.<FNote>

#### getRelation(name) → {FAttribute}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - entities/fnote.js, line 732

##### Returns:

relation if it exists, null otherwise

Type
  FAttribute

#### (async) getRelationTarget(name) → {Promise.<FNote>|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string |

Source:
  - entities/fnote.js, line 762

##### Returns:

target note of the relation or null (if target is empty or note was not found)

Type
  Promise.<FNote> | null

#### (async) getRelationTargets(nameopt) → {Promise.<Array.<FNote>>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | relation name to filter

Source:
  - entities/fnote.js, line 772

##### Returns:

Type
  Promise.<Array.<FNote>>

#### getRelationValue(name) → {string}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - entities/fnote.js, line 756

##### Returns:

relation value if relation exists, null otherwise

Type
  string

#### getRelations(nameopt) → {Array.<FAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | relation name to filter

Source:
  - entities/fnote.js, line 604

##### Returns:

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

Type
  Array.<FAttribute>

#### getScriptEnv() → {string|null}

Source:
  - entities/fnote.js, line 935

##### Returns:

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

Type
  string | null

#### getSortedNotePathRecords(hoistedNoteIdopt) → {Array.<NotePathRecord>}

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`hoistedNoteId` | string | <optional> | 'root' |

Source:
  - entities/fnote.js, line 403

##### Returns:

Type
  Array.<NotePathRecord>

#### (async) getTargetRelationSourceNotes() → {Promise.<Array.<FNote>>}

Get relations which target this note

Source:
  - entities/fnote.js, line 876

##### Returns:

Type
  Promise.<Array.<FNote>>

#### getTargetRelations() → {Array.<FAttribute>}

Get relations which target this note

Source:
  - entities/fnote.js, line 866

##### Returns:

Type
  Array.<FAttribute>

#### hasAttribute(type, name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | AttributeType | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - entities/fnote.js, line 613

##### Returns:

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

Type
  boolean

#### hasChildren() → {boolean}

Source:
  - entities/fnote.js, line 196

##### Returns:

Type
  boolean

#### hasLabel(name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - entities/fnote.js, line 682

##### Returns:

true if label exists (including inherited)

Type
  boolean

#### hasOwnedAttribute(type, name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | AttributeType | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - entities/fnote.js, line 624

##### Returns:

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

Type
  boolean

#### hasOwnedLabel(name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - entities/fnote.js, line 676

##### Returns:

true if label exists (excluding inherited)

Type
  boolean

#### hasOwnedRelation(name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - entities/fnote.js, line 702

##### Returns:

true if relation exists (excluding inherited)

Type
  boolean

#### hasRelation(name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - entities/fnote.js, line 708

##### Returns:

true if relation exists (including inherited)

Type
  boolean

#### invalidateAttributeCache()

Deprecated:
  - NOOP
Source:
  - entities/fnote.js, line 859

#### isHiddenCompletely()

Source:
  - entities/fnote.js, line 456

##### Returns:

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

#### isHtml() → {boolean}

Source:
  - entities/fnote.js, line 930

##### Returns:

true if this note is HTML

Type
  boolean

#### isJavaScript() → {boolean}

Source:
  - entities/fnote.js, line 922

##### Returns:

true if this note is JavaScript (code or file)

Type
  boolean

#### isJson() → {boolean}

Source:
  - entities/fnote.js, line 140

##### Returns:

Type
  boolean

#### isLabelTruthy(name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - entities/fnote.js, line 688

##### Returns:

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

Type
  boolean