diff --git a/docs/backend_api/ApiToken.html b/docs/backend_api/ApiToken.html index 2d4a1d17c..fd85e3d53 100644 --- a/docs/backend_api/ApiToken.html +++ b/docs/backend_api/ApiToken.html @@ -139,6 +139,214 @@ +

Members

+ + + +

apiTokenId :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

token :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateCreated :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + @@ -155,7 +363,7 @@
diff --git a/docs/backend_api/Attribute.html b/docs/backend_api/Attribute.html index dfdc8ead7..f0dd9a7ec 100644 --- a/docs/backend_api/Attribute.html +++ b/docs/backend_api/Attribute.html @@ -30,7 +30,8 @@

Attribute()

-
Attribute is key value pair owned by a note.
+
Attribute is an abstract concept which has two real uses - label (key - value pair) +and relation (representing named relationship between source and target note)
@@ -64,268 +65,6 @@ -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
attributeId - - -string - - - - immutable
noteId - - -string - - - - immutable
type - - -string - - - - immutable
name - - -string - - - - immutable
value - - -string - - - -
position - - -int - - - -
isInheritable - - -boolean - - - - immutable
isDeleted - - -boolean - - - -
deleteId - - -string -| - -null - - - - ID identifying delete transaction
utcDateModified - - -string - - - -
- - - -
@@ -355,7 +94,7 @@
Source:
@@ -389,16 +128,55 @@ -

Extends

+ + + + + + + + + + + + +

Members

+ +

attributeId :string

+ + + + +
Type:
+ + + +
+ + + + + + + + + + + @@ -411,6 +189,504 @@ + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isInheritable :boolean

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

noteId :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

position :int

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateModified :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

value :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + @@ -470,7 +746,7 @@
Source:
@@ -575,7 +851,7 @@
Source:
@@ -680,7 +956,7 @@
Source:
@@ -744,13 +1020,13 @@
diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.html index b4c76a6b5..cf1a18ddb 100644 --- a/docs/backend_api/BackendScriptApi.html +++ b/docs/backend_api/BackendScriptApi.html @@ -5913,7 +5913,7 @@ exists, then we'll use that transaction.
diff --git a/docs/backend_api/Branch.html b/docs/backend_api/Branch.html index 407a6edef..d29b8e361 100644 --- a/docs/backend_api/Branch.html +++ b/docs/backend_api/Branch.html @@ -30,8 +30,8 @@

Branch()

-
Branch represents note's placement in the tree - it's essentially pair of noteId and parentNoteId. -Each note can have multiple (at least one) branches, meaning it can be placed into multiple places in the tree.
+
Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple +parents.
@@ -65,268 +65,6 @@ Each note can have multiple (at least one) branches, meaning it can be placed in -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
branchId - - -string - - - - primary key, immutable
noteId - - -string - - - - immutable
parentNoteId - - -string - - - - immutable
notePosition - - -int - - - -
prefix - - -string - - - -
isExpanded - - -boolean - - - -
isDeleted - - -boolean - - - -
deleteId - - -string -| - -null - - - - ID identifying delete transaction
utcDateModified - - -string - - - -
utcDateCreated - - -string - - - -
- - - -
@@ -356,7 +94,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
Source:
@@ -390,16 +128,45 @@ Each note can have multiple (at least one) branches, meaning it can be placed in -

Extends

+ + + + + + + + + + + + +

Members

+ +

branchId :string

+ + + + +
Type:
+ + + +
+ @@ -415,23 +182,37 @@ Each note can have multiple (at least one) branches, meaning it can be placed in -

Methods

+ + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + - - - - -

getNote() → {Note|null}

- - - - - - - - +

childNote

@@ -471,7 +252,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
Source:
@@ -487,58 +268,215 @@ Each note can have multiple (at least one) branches, meaning it can be placed in - - - - - - - - - -
Returns:
- + +

isExpanded :boolean

-
-
- Type -
-
- -Note -| - -null -
-
+ + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + +

noteId :string

+ + + + + + +
Type:
+ + + + + + +
-

getParentNote() → {Note|null}

+ + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + +

notePosition :int

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

parentNote

+ + @@ -576,7 +514,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
Source:
@@ -592,42 +530,213 @@ Each note can have multiple (at least one) branches, meaning it can be placed in - - - - - - - - - -
Returns:
- + +

parentNoteId :string

-
-
- Type -
-
- -Note -| - -null -
-
+ + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +

prefix :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateModified :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + @@ -643,13 +752,13 @@ Each note can have multiple (at least one) branches, meaning it can be placed in
diff --git a/docs/backend_api/Entity.html b/docs/backend_api/Entity.html deleted file mode 100644 index b9dbd11e2..000000000 --- a/docs/backend_api/Entity.html +++ /dev/null @@ -1,227 +0,0 @@ - - - - - JSDoc: Class: Entity - - - - - - - - - - -
- -

Class: Entity

- - - - - - -
- -
- -

Entity(rowopt)

- - -
- -
-
- - - - - - -

new Entity(rowopt)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
row - - -object - - - - - - <optional>
- - - - - -
database row representing given entity
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/backend_api/Image.html b/docs/backend_api/Image.html deleted file mode 100644 index 31e3f2762..000000000 --- a/docs/backend_api/Image.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - - JSDoc: Class: Image - - - - - - - - - - -
- -

Class: Image

- - - - - - -
- -
- -

Image(imageId, format, checksum, name, data, isDeleted, dateModified, dateCreated)

- -
This class represents image data.
- - -
- -
-
- - - - -

Constructor

- - - -

new Image(imageId, format, checksum, name, data, isDeleted, dateModified, dateCreated)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
imageId - - -string - - - -
format - - -string - - - -
checksum - - -string - - - -
name - - -string - - - -
data - - -blob - - - -
isDeleted - - -boolean - - - -
dateModified - - -string - - - -
dateCreated - - -string - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST) -
- - - - - \ No newline at end of file diff --git a/docs/backend_api/Link.html b/docs/backend_api/Link.html deleted file mode 100644 index d0933aff5..000000000 --- a/docs/backend_api/Link.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - JSDoc: Class: Link - - - - - - - - - - -
- -

Class: Link

- - - - - - -
- -
- -

Link(linkId, noteId, targetNoteId, type, isDeleted, utcDateModified, utcDateCreated)

- -
This class represents link from one note to another in the form of hyperlink or image reference. Note that -this is different concept than attribute/relation.
- - -
- -
-
- - - - -

Constructor

- - - - - - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
linkId - - -string - - - -
noteId - - -string - - - -
targetNoteId - - -string - - - -
type - - -string - - - -
isDeleted - - -boolean - - - -
utcDateModified - - -string - - - -
utcDateCreated - - -string - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html index 0f075977c..cb9c0307f 100644 --- a/docs/backend_api/Note.html +++ b/docs/backend_api/Note.html @@ -28,9 +28,9 @@
-

Note(row)

+

Note()

-
This represents a Note which is a central object in the Trilium Notes project.
+
Trilium's main entity which can represent text note, image, code note, file attachment etc.
@@ -45,7 +45,7 @@ -

new Note(row)

+

new Note()

@@ -60,335 +60,6 @@ -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
row - - object containing database row from "notes" table
- - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
noteId - - -string - - - - primary key
type - - -string - - - - one of "text", "code", "file" or "render"
mime - - -string - - - - MIME type, e.g. "text/html"
title - - -string - - - - note title
isProtected - - -boolean - - - - true if note is protected
isDeleted - - -boolean - - - - true if note is deleted
deleteId - - -string -| - -null - - - - ID identifying delete transaction
dateCreated - - -string - - - - local date time (with offset)
dateModified - - -string - - - - local date time (with offset)
utcDateCreated - - -string - - - -
utcDateModified - - -string - - - -
@@ -422,7 +93,7 @@
Source:
@@ -456,16 +127,55 @@ -

Extends

+ + + + + + + + + + + + +

Members

+ +

children :Array.<Note>

+ + + + +
Type:
+ + + +
+ + + + + + + + + + + @@ -478,6 +188,1276 @@ + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

contentSize :int|null

+ + + + +
+ size of the content in bytes +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

dateCreated :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

dateModified :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

flatTextCache :string|null

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isDecrypted :boolean

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isProtected :boolean

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

mime :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

noteId :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

noteSize :int|null

+ + + + +
+ size of the content and note revision contents in bytes +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

ownedAttributes :Array.<Attribute>

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

parentBranches :Array.<Branch>

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

parents :Array.<Note>

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

revisionCount :int|null

+ + + + +
+ number of note revisions for this note +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

targetRelations :Array.<Attribute>

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

title :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateCreated :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateModified :string

+ + + + + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + @@ -489,6 +1469,108 @@ +

__getInheritableAttributes() → {Array.<Attribute>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<Attribute> + + +
+
+ + + + + + + + + + + + +

addAttribute() → {Attribute}

@@ -537,7 +1619,7 @@
Source:
@@ -639,7 +1721,7 @@
Source:
@@ -697,6 +1779,108 @@ +

getAncestors() → {Array.<Note>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<Note> + + +
+
+ + + + + + + + + + + + +

getAttribute(type, name) → {Attribute}

@@ -817,7 +2001,7 @@
Source:
@@ -1017,7 +2201,7 @@
Source:
@@ -1195,7 +2379,7 @@
Source:
@@ -1304,7 +2488,7 @@
Source:
@@ -1406,7 +2590,7 @@
Source:
@@ -1434,10 +2618,6 @@
Returns:
-
- child branches of this note -
-
@@ -1512,7 +2692,7 @@
Source:
@@ -1540,10 +2720,6 @@
Returns:
-
- child notes of this note -
-
@@ -1618,7 +2794,7 @@
Source:
@@ -1720,7 +2896,7 @@
Source:
@@ -1774,13 +2950,19 @@ -

getDescendantNoteIds() → {Array.<string>}

+

getFlatText() → {string}

+
+ This is used for: +- fast searching +- note similarity evaluation +
+ @@ -1822,7 +3004,7 @@
Source:
@@ -1851,7 +3033,7 @@
- return list of all descendant noteIds of this note. Returning just noteIds because number of notes can be huge. Includes also this note's noteId + - returns flattened textual representation of note, prefixes and attributes
@@ -1862,634 +3044,9 @@
-Array.<string> - - -
-
- - - - - - - - - - - - - -

getDescendantNotesWithAttribute(type, name, valueopt) → {Array.<Note>}

- - - - - - -
- Finds descendant notes with given attribute name and value. Only own attributes are considered, not inherited ones -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
type - - string - - - - - - - - attribute type (label, relation, etc.)
name - - -string - - - - - - - - - - attribute name
value - - -string - - - - - - <optional>
- - - - - -
attribute value
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array.<Note> - - -
-
- - - - - - - - - - - - - -

getDescendantNotesWithLabel(name, valueopt) → {Array.<Note>}

- - - - - - -
- Finds descendant notes with given label name and value. Only own labels are considered, not inherited ones -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
name - - -string - - - - - - - - - - label name
value - - -string - - - - - - <optional>
- - - - - -
label value
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array.<Note> - - -
-
- - - - - - - - - - - - - -

getDescendantNotesWithRelation(name, valueopt) → {Array.<Note>}

- - - - - - -
- Finds descendant notes with given relation name and value. Only own relations are considered, not inherited ones -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
name - - -string - - - - - - - - - - relation name
value - - -string - - - - - - <optional>
- - - - - -
relation value
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array.<Note> - -
@@ -2553,7 +3110,7 @@
Source:
@@ -2704,7 +3261,7 @@
Source:
@@ -2874,7 +3431,7 @@
Source:
@@ -3029,7 +3586,7 @@
Source:
@@ -3090,16 +3647,13 @@ - +

getLabelValues(nameopt) → {Array.<string>}

-
- Get list of links coming out of this note. -
@@ -3108,6 +3662,66 @@ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +
label name to filter
+ @@ -3130,8 +3744,6 @@ -
Deprecated:
  • - not intended for general use
- @@ -3144,7 +3756,7 @@
Source:
@@ -3172,6 +3784,10 @@
Returns:
+
+ all note's label values, including inherited ones +
+
@@ -3180,7 +3796,7 @@
-Array.<Attribute> +Array.<string>
@@ -3246,7 +3862,7 @@
Source:
@@ -3313,11 +3929,6 @@ This method can be significantly faster than the getAttribute() -
- This method is a faster variant of getAttributes() which looks for only owned attributes. -Use when inheritance is not needed and/or in batch/performance sensitive operations. -
- @@ -3453,7 +4064,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -3631,7 +4242,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -3789,7 +4400,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -3959,7 +4570,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -4114,7 +4725,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -4175,6 +4786,173 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati +

getOwnedLabelValues(nameopt) → {Array.<string>}

+ + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
name + + +string + + + + + + <optional>
+ + + + + +
label name to filter
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ all note's label values, excluding inherited ones +
+ + + +
+
+ Type +
+
+ +Array.<string> + + +
+
+ + + + + + + + + + + + +

getOwnedRelation(name) → {Attribute|null}

@@ -4272,7 +5050,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -4442,7 +5220,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -4500,164 +5278,6 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati -

getOwnedRelationTarget(name) → {Note|null}

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- target note of the relation or null (if target is empty or note was not found) -
- - - -
-
- Type -
-
- -Note -| - -null - - -
-
- - - - - - - - - - - - -

getOwnedRelationValue(name) → {string|null}

@@ -4755,7 +5375,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -4816,6 +5436,108 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati +

getParentBranches() → {Array.<Branch>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<Branch> + + +
+
+ + + + + + + + + + + + +

getParentNotes() → {Array.<Note>}

@@ -4864,7 +5586,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -4892,10 +5614,6 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Returns:
-
- parent notes of this note (note can have multiple parents because of cloning) -
-
@@ -5019,7 +5737,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -5189,7 +5907,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -5247,327 +5965,6 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati -

getRelationTarget(name) → {Note|null}

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
name - - -string - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- target note of the relation or null (if target is empty or note was not found) -
- - - -
-
- Type -
-
- -Note -| - -null - - -
-
- - - - - - - - - - - - - -

getRelationTargets(nameopt) → {Array.<Note>}

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
name - - -string - - - - - - <optional>
- - - - - -
relation name to filter
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array.<Note> - - -
-
- - - - - - - - - - - - -

getRelationValue(name) → {string|null}

@@ -5665,7 +6062,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -5726,113 +6123,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati -

getRevisions() → {Array.<NoteRevision>}

- - - - - - -
- Returns note revisions of this note. -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array.<NoteRevision> - - -
-
- - - - - - - - - - - - - -

getScriptEnv() → {string}

+

getScriptEnv() → {string|null}

@@ -5880,7 +6171,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -5921,6 +6212,9 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
string +| + +null
@@ -5938,7 +6232,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati -

getTargetRelations() → {Array.<Attribute>}

+

getSubtreeNoteIds() → {Array.<String>}

@@ -5986,7 +6280,313 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<String> + + +
+
+ + + + + + + + + + + + + +

getSubtreeNotes() → {Array.<Note>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<Note> + + +
+
+ + + + + + + + + + + + + +

getSubtreeNotesIncludingTemplated() → {Array.<Note>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<Note> + + +
+
+ + + + + + + + + + + + + +

getTemplatedNotes() → {Array.<Note>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -6015,7 +6615,8 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
- relations targetting this specific note + - returns only notes which are templated, does not include their subtrees + in effect returns notes which are influenced by note's non-inheritable attributes
@@ -6026,7 +6627,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
-Array.<Attribute> +Array.<Note>
@@ -6044,7 +6645,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati -

hasAttribute(type, name) → {boolean}

+

hasAncestor() → {boolean}

@@ -6059,78 +6660,6 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
type - - -string - - - - attribute type (label, relation, etc.)
name - - -string - - - - attribute name
- - @@ -6164,7 +6693,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -6192,10 +6721,6 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Returns:
-
- true if note has an attribute with given type and name (including inherited) -
-
@@ -6270,7 +6795,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -6298,10 +6823,6 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Returns:
-
- - true if note has children -
-
@@ -6425,7 +6946,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -6603,7 +7124,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -6758,7 +7279,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -6913,7 +7434,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -7068,7 +7589,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati
Source:
@@ -7120,95 +7641,6 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati - - - - - - -

invalidateAttributeCache()

- - - - - - -
- Clear note's attributes cache to force fresh reload for next attribute request. -Cache is note instance scoped. -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - @@ -7307,7 +7739,7 @@ Cache is note instance scoped.
Source:
@@ -7413,7 +7845,7 @@ Cache is note instance scoped.
Source:
@@ -7519,7 +7951,7 @@ Cache is note instance scoped.
Source:
@@ -7625,7 +8057,7 @@ Cache is note instance scoped.
Source:
@@ -7731,7 +8163,7 @@ Cache is note instance scoped.
Source:
@@ -7837,7 +8269,7 @@ Cache is note instance scoped.
Source:
@@ -8070,7 +8502,7 @@ Cache is note instance scoped.
Source:
@@ -8250,7 +8682,7 @@ Cache is note instance scoped.
Source:
@@ -8430,7 +8862,7 @@ Cache is note instance scoped.
Source:
@@ -8641,7 +9073,7 @@ Cache is note instance scoped.
Source:
@@ -8821,7 +9253,7 @@ Cache is note instance scoped.
Source:
@@ -8981,7 +9413,7 @@ Cache is note instance scoped.
Source:
@@ -9223,7 +9655,7 @@ Cache is note instance scoped.
Source:
@@ -9434,7 +9866,7 @@ Cache is note instance scoped.
Source:
@@ -9645,7 +10077,7 @@ Cache is note instance scoped.
Source:
@@ -9691,13 +10123,13 @@ Cache is note instance scoped.
diff --git a/docs/backend_api/NoteImage.html b/docs/backend_api/NoteImage.html deleted file mode 100644 index 28b67ea8f..000000000 --- a/docs/backend_api/NoteImage.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - - JSDoc: Class: NoteImage - - - - - - - - - - -
- -

Class: NoteImage

- - - - - - -
- -
- -

NoteImage(noteImageId, noteId, imageId, isDeleted, dateModified, dateCreated)

- -
This class represents image's placement in the note(s). One image may be placed into several notes.
- - -
- -
-
- - - - -

Constructor

- - - -

new NoteImage(noteImageId, noteId, imageId, isDeleted, dateModified, dateCreated)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
noteImageId - - -string - - - -
noteId - - -string - - - -
imageId - - -string - - - -
isDeleted - - -boolean - - - -
dateModified - - -string - - - -
dateCreated - - -string - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST) -
- - - - - \ No newline at end of file diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html index df87d061b..4c5ba9ca9 100644 --- a/docs/backend_api/NoteRevision.html +++ b/docs/backend_api/NoteRevision.html @@ -30,7 +30,8 @@

NoteRevision()

-
NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning.
+
NoteRevision represents snapshot of note's title and content at some point in the past. +It's used for seamless note versioning.
@@ -93,7 +94,7 @@
Source:
@@ -143,13 +144,23 @@ -

contentLength

+

contentLength :number

+
Type:
+
    +
  • + +number + + +
  • +
+ @@ -183,7 +194,7 @@
Source:
@@ -201,13 +212,23 @@ -

dateCreated

+

dateCreated :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -241,7 +262,7 @@
Source:
@@ -259,13 +280,23 @@ -

dateLastEdited

+

dateLastEdited :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -299,7 +330,7 @@
Source:
@@ -317,13 +348,23 @@ -

isProtected

+

isProtected :boolean

+
Type:
+
    +
  • + +boolean + + +
  • +
+ @@ -357,7 +398,7 @@
Source:
@@ -375,13 +416,23 @@ -

mime

+

mime :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -415,7 +466,7 @@
Source:
@@ -433,13 +484,23 @@ -

noteId

+

noteId :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -473,7 +534,7 @@
Source:
@@ -491,13 +552,23 @@ -

noteRevisionId

+

noteRevisionId :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -531,7 +602,7 @@
Source:
@@ -549,13 +620,23 @@ -

title

+

title :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -589,7 +670,7 @@
Source:
@@ -607,13 +688,23 @@ -

type

+

type :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -647,7 +738,7 @@
Source:
@@ -665,13 +756,23 @@ -

utcDateCreated

+

utcDateCreated :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -705,7 +806,7 @@
Source:
@@ -723,13 +824,23 @@ -

utcDateLastEdited

+

utcDateLastEdited :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -763,7 +874,7 @@
Source:
@@ -781,13 +892,23 @@ -

utcDateModified

+

utcDateModified :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -821,7 +942,7 @@
Source:
@@ -897,7 +1018,7 @@
Source:
@@ -999,7 +1120,7 @@
Source:
@@ -1101,7 +1222,7 @@
Source:
@@ -1169,7 +1290,7 @@
diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.html index ef481bf80..f0f20a329 100644 --- a/docs/backend_api/Option.html +++ b/docs/backend_api/Option.html @@ -139,6 +139,282 @@ +

Members

+ + + +

isSynced :boolean

+ + + + + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateModified :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

value :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + @@ -155,7 +431,7 @@
diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.html index 3aeec055d..a03691ba7 100644 --- a/docs/backend_api/RecentNote.html +++ b/docs/backend_api/RecentNote.html @@ -139,6 +139,214 @@ +

Members

+ + + +

noteId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

notePath :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateCreated :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + @@ -155,7 +363,7 @@
diff --git a/docs/backend_api/backend_script_api.js.html b/docs/backend_api/backend_script_api.js.html deleted file mode 100644 index b47696c4b..000000000 --- a/docs/backend_api/backend_script_api.js.html +++ /dev/null @@ -1,472 +0,0 @@ - - - - - JSDoc: Source: backend_script_api.js - - - - - - - - - - -
- -

Source: backend_script_api.js

- - - - - - -
-
-
const log = require('./log');
-const noteService = require('./notes');
-const sql = require('./sql');
-const utils = require('./utils');
-const attributeService = require('./attributes');
-const dateNoteService = require('./date_notes');
-const treeService = require('./tree');
-const config = require('./config');
-const axios = require('axios');
-const dayjs = require('dayjs');
-const xml2js = require('xml2js');
-const cloningService = require('./cloning');
-const appInfo = require('./app_info');
-const searchService = require('./search/services/search');
-const SearchContext = require("./search/search_context");
-const becca = require("../becca/becca");
-
-/**
- * This is the main backend API interface for scripts. It's published in the local "api" object.
- *
- * @constructor
- * @hideconstructor
- */
-function BackendScriptApi(currentNote, apiParams) {
-    /** @property {Note} note where script started executing */
-    this.startNote = apiParams.startNote;
-    /** @property {Note} note where script is currently executing. Don't mix this up with concept of active note */
-    this.currentNote = currentNote;
-    /** @property {Entity} entity whose event triggered this executions */
-    this.originEntity = apiParams.originEntity;
-
-    for (const key in apiParams) {
-        this[key] = apiParams[key];
-    }
-
-    /** @property {axios} Axios library for HTTP requests. See https://axios-http.com/ for documentation */
-    this.axios = axios;
-    /** @property {dayjs} day.js library for date manipulation. See https://day.js.org/ for documentation */
-    this.dayjs = dayjs;
-    /** @property {axios} xml2js library for XML parsing. See https://github.com/Leonidas-from-XIV/node-xml2js for documentation */
-    this.xml2js = xml2js;
-
-    // DEPRECATED - use direct api.unescapeHtml
-    this.utils = {
-        unescapeHtml: utils.unescapeHtml
-    };
-
-    /**
-     * Instance name identifies particular Trilium instance. It can be useful for scripts
-     * if some action needs to happen on only one specific instance.
-     *
-     * @returns {string|null}
-     */
-    this.getInstanceName = () => config.General ? config.General.instanceName : null;
-
-    /**
-     * @method
-     * @param {string} noteId
-     * @returns {Note|null}
-     */
-    this.getNote = becca.getNote;
-
-    /**
-     * @method
-     * @param {string} branchId
-     * @returns {Branch|null}
-     */
-    this.getBranch = becca.getBranch;
-
-    /**
-     * @method
-     * @param {string} attributeId
-     * @returns {Attribute|null}
-     */
-    this.getAttribute = becca.getAttribute;
-
-    /**
-     * This is a powerful search method - you can search by attributes and their values, e.g.:
-     * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
-     *
-     * @method
-     * @param {string} query
-     * @param {Object} [searchParams]
-     * @returns {Note[]}
-     */
-    this.searchForNotes = (query, searchParams = {}) => {
-        if (searchParams.includeArchivedNotes === undefined) {
-            searchParams.includeArchivedNotes = true;
-        }
-
-        if (searchParams.ignoreHoistedNote === undefined) {
-            searchParams.ignoreHoistedNote = true;
-        }
-
-        const noteIds = searchService.findResultsWithQuery(query, new SearchContext(searchParams))
-            .map(sr => sr.noteId);
-
-        return becca.getNotes(noteIds);
-    };
-
-    /**
-     * This is a powerful search method - you can search by attributes and their values, e.g.:
-     * "#dateModified =* MONTH AND #log". See full documentation for all options at: https://github.com/zadam/trilium/wiki/Search
-     *
-     * @method
-     * @param {string} query
-     * @param {Object} [searchParams]
-     * @returns {Note|null}
-     */
-    this.searchForNote = (query, searchParams = {}) => {
-        const notes = this.searchForNotes(query, searchParams);
-
-        return notes.length > 0 ? notes[0] : null;
-    };
-
-    /**
-     * Retrieves notes with given label name & value
-     *
-     * @method
-     * @param {string} name - attribute name
-     * @param {string} [value] - attribute value
-     * @returns {Note[]}
-     */
-    this.getNotesWithLabel = attributeService.getNotesWithLabel;
-
-    /**
-     * Retrieves first note with given label name & value
-     *
-     * @method
-     * @param {string} name - attribute name
-     * @param {string} [value] - attribute value
-     * @returns {Note|null}
-     */
-    this.getNoteWithLabel = attributeService.getNoteWithLabel;
-
-    /**
-     * If there's no branch between note and parent note, create one. Otherwise do nothing.
-     *
-     * @method
-     * @param {string} noteId
-     * @param {string} parentNoteId
-     * @param {string} prefix - if branch will be create between note and parent note, set this prefix
-     * @returns {void}
-     */
-    this.ensureNoteIsPresentInParent = cloningService.ensureNoteIsPresentInParent;
-
-    /**
-     * If there's a branch between note and parent note, remove it. Otherwise do nothing.
-     *
-     * @method
-     * @param {string} noteId
-     * @param {string} parentNoteId
-     * @returns {void}
-     */
-    this.ensureNoteIsAbsentFromParent = cloningService.ensureNoteIsAbsentFromParent;
-
-    /**
-     * Based on the value, either create or remove branch between note and parent note.
-     *
-     * @method
-     * @param {boolean} present - true if we want the branch to exist, false if we want it gone
-     * @param {string} noteId
-     * @param {string} parentNoteId
-     * @param {string} prefix - if branch will be create between note and parent note, set this prefix
-     * @returns {void}
-     */
-    this.toggleNoteInParent = cloningService.toggleNoteInParent;
-
-    /**
-     * @typedef {object} CreateNoteAttribute
-     * @property {string} type - attribute type - label, relation etc.
-     * @property {string} name - attribute name
-     * @property {string} [value] - attribute value
-     */
-
-    /**
-     * Create text note. See also createNewNote() for more options.
-     *
-     * @param {string} parentNoteId
-     * @param {string} title
-     * @param {string} content
-     * @return {{note: Note, branch: Branch}} - object having "note" and "branch" keys representing respective objects
-     */
-    this.createTextNote = (parentNoteId, title, content = '') => noteService.createNewNote({
-        parentNoteId,
-        title,
-        content,
-        type: 'text'
-    });
-
-    /**
-     * Create data note - data in this context means object serializable to JSON. Created note will be of type 'code' and
-     * JSON MIME type. See also createNewNote() for more options.
-     *
-     * @param {string} parentNoteId
-     * @param {string} title
-     * @param {object} content
-     * @return {{note: Note, branch: Branch}} object having "note" and "branch" keys representing respective objects
-     */
-    this.createDataNote = (parentNoteId, title, content = {}) => noteService.createNewNote({
-        parentNoteId,
-        title,
-        content: JSON.stringify(content, null, '\t'),
-        type: 'code',
-        mime: 'application/json'
-    });
-
-    /**
-     * @typedef {object} CreateNewNoteParams
-     * @property {string} parentNoteId - MANDATORY
-     * @property {string} title - MANDATORY
-     * @property {string|buffer} content - MANDATORY
-     * @property {string} type - text, code, file, image, search, book, relation-map - MANDATORY
-     * @property {string} mime - value is derived from default mimes for type
-     * @property {boolean} isProtected - default is false
-     * @property {boolean} isExpanded - default is false
-     * @property {string} prefix - default is empty string
-     * @property {int} notePosition - default is last existing notePosition in a parent + 10
-     */
-
-    /**
-     * @method
-     *
-     * @param {CreateNewNoteParams} [params]
-     * @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch
-     */
-    this.createNewNote = noteService.createNewNote;
-
-    /**
-     * @typedef {object} CreateNoteAttribute
-     * @property {string} type - attribute type - label, relation etc.
-     * @property {string} name - attribute name
-     * @property {string} [value] - attribute value
-     */
-
-    /**
-     * @typedef {object} CreateNoteExtraOptions
-     * @property {boolean} [json=false] - should the note be JSON
-     * @property {boolean} [isProtected=false] - should the note be protected
-     * @property {string} [type='text'] - note type
-     * @property {string} [mime='text/html'] - MIME type of the note
-     * @property {CreateNoteAttribute[]} [attributes=[]] - attributes to be created for this note
-     */
-
-    /**
-     * @method
-     * @deprecated please use createTextNote() with similar API for simpler use cases or createNewNote() for more complex needs
-     *
-     * @param {string} parentNoteId - create new note under this parent
-     * @param {string} title
-     * @param {string} [content=""]
-     * @param {CreateNoteExtraOptions} [extraOptions={}]
-     * @returns {{note: Note, branch: Branch}} object contains newly created entities note and branch
-     */
-    this.createNote = (parentNoteId, title, content = "", extraOptions= {}) => {
-        extraOptions.parentNoteId = parentNoteId;
-        extraOptions.title = title;
-
-        const parentNote = becca.getNote(parentNoteId);
-
-        // code note type can be inherited, otherwise text is default
-        extraOptions.type = parentNote.type === 'code' ? 'code' : 'text';
-        extraOptions.mime = parentNote.type === 'code' ? parentNote.mime : 'text/html';
-
-        if (extraOptions.json) {
-            extraOptions.content = JSON.stringify(content || {}, null, '\t');
-            extraOptions.type = 'code';
-            extraOptions.mime = 'application/json';
-        }
-        else {
-            extraOptions.content = content;
-        }
-
-        return sql.transactional(() => {
-            const {note, branch} = noteService.createNewNote(extraOptions);
-
-            for (const attr of extraOptions.attributes || []) {
-                attributeService.createAttribute({
-                    noteId: note.noteId,
-                    type: attr.type,
-                    name: attr.name,
-                    value: attr.value,
-                    isInheritable: !!attr.isInheritable
-                });
-            }
-
-            return {note, branch};
-        });
-    };
-
-    /**
-     * Log given message to trilium logs.
-     *
-     * @param message
-     */
-    this.log = message => log.info(`Script "${currentNote.title}" (${currentNote.noteId}): ${message}`);
-
-    /**
-     * Returns root note of the calendar.
-     *
-     * @method
-     * @returns {Note|null}
-     */
-    this.getRootCalendarNote = dateNoteService.getRootCalendarNote;
-
-    /**
-     * Returns day note for given date. If such note doesn't exist, it is created.
-     *
-     * @method
-     * @param {string} date in YYYY-MM-DD format
-     * @returns {Note|null}
-     */
-    this.getDateNote = dateNoteService.getDateNote;
-
-    /**
-     * Returns today's day note. If such note doesn't exist, it is created.
-     *
-     * @method
-     * @returns {Note|null}
-     */
-    this.getTodayNote = dateNoteService.getTodayNote;
-
-    /**
-     * Returns note for the first date of the week of the given date.
-     *
-     * @method
-     * @param {string} date in YYYY-MM-DD format
-     * @param {object} options - "startOfTheWeek" - either "monday" (default) or "sunday"
-     * @returns {Note|null}
-     */
-    this.getWeekNote = dateNoteService.getWeekNote;
-
-    /**
-     * Returns month note for given date. If such note doesn't exist, it is created.
-     *
-     * @method
-     * @param {string} date in YYYY-MM format
-     * @returns {Note|null}
-     */
-    this.getMonthNote = dateNoteService.getMonthNote;
-
-    /**
-     * Returns year note for given year. If such note doesn't exist, it is created.
-     *
-     * @method
-     * @param {string} year in YYYY format
-     * @returns {Note|null}
-     */
-    this.getYearNote = dateNoteService.getYearNote;
-
-    /**
-     * @method
-     * @param {string} parentNoteId - this note's child notes will be sorted
-     */
-    this.sortNotesByTitle = parentNoteId => treeService.sortNotes(parentNoteId);
-
-    /**
-     * This method finds note by its noteId and prefix and either sets it to the given parentNoteId
-     * or removes the branch (if parentNoteId is not given).
-     *
-     * This method looks similar to toggleNoteInParent() but differs because we're looking up branch by prefix.
-     *
-     * @method
-     * @deprecated - this method is pretty confusing and serves specialized purpose only
-     * @param {string} noteId
-     * @param {string} prefix
-     * @param {string|null} parentNoteId
-     */
-    this.setNoteToParent = treeService.setNoteToParent;
-
-    /**
-     * This functions wraps code which is supposed to be running in transaction. If transaction already
-     * exists, then we'll use that transaction.
-     *
-     * @method
-     * @param {function} func
-     * @returns {?} result of func callback
-     */
-    this.transactional = sql.transactional;
-
-    /**
-     * Return randomly generated string of given length. This random string generation is NOT cryptographically secure.
-     *
-     * @method
-     * @param {number} length of the string
-     * @returns {string} random string
-     */
-    this.randomString = utils.randomString;
-
-    /**
-     * @method
-     * @param {string} string to escape
-     * @returns {string} escaped string
-     */
-    this.escapeHtml = utils.escapeHtml;
-
-    /**
-     * @method
-     * @param {string} string to unescape
-     * @returns {string} unescaped string
-     */
-    this.unescapeHtml = utils.unescapeHtml;
-
-    /**
-     * @property {module:sql} sql
-     */
-    this.sql = sql;
-
-    /**
-     * @method
-     * @deprecated - this is now no-op since all the changes should be gracefully handled per widget
-     */
-    this.refreshTree = () => {};
-
-    /**
-     * @return {{syncVersion, appVersion, buildRevision, dbVersion, dataDirectory, buildDate}|*} - object representing basic info about running Trilium version
-     */
-    this.getAppInfo = () => appInfo
-}
-
-module.exports = BackendScriptApi;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/becca_entities_api_token.js.html b/docs/backend_api/becca_entities_api_token.js.html index ec881d8ed..62e869de9 100644 --- a/docs/backend_api/becca_entities_api_token.js.html +++ b/docs/backend_api/becca_entities_api_token.js.html @@ -42,8 +42,11 @@ class ApiToken extends AbstractEntity { constructor(row) { super(); + /** @type {string} */ this.apiTokenId = row.apiTokenId; + /** @type {string} */ this.token = row.token; + /** @type {string} */ this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); } @@ -67,7 +70,7 @@ module.exports = ApiToken;
diff --git a/docs/backend_api/becca_entities_attribute.js.html b/docs/backend_api/becca_entities_attribute.js.html index 933968145..2fe091dbd 100644 --- a/docs/backend_api/becca_entities_attribute.js.html +++ b/docs/backend_api/becca_entities_attribute.js.html @@ -34,6 +34,10 @@ const sql = require("../../services/sql.js"); const dateUtils = require("../../services/date_utils.js"); const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser"); +/** + * Attribute is an abstract concept which has two real uses - label (key - value pair) + * and relation (representing named relationship between source and target note) + */ class Attribute extends AbstractEntity { static get entityName() { return "attributes"; } static get primaryKeyName() { return "attributeId"; } @@ -64,21 +68,21 @@ class Attribute extends AbstractEntity { } update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) { - /** @param {string} */ + /** @type {string} */ this.attributeId = attributeId; - /** @param {string} */ + /** @type {string} */ this.noteId = noteId; - /** @param {string} */ + /** @type {string} */ this.type = type; - /** @param {string} */ + /** @type {string} */ this.name = name; - /** @param {int} */ + /** @type {int} */ this.position = position; - /** @param {string} */ + /** @type {string} */ this.value = value; - /** @param {boolean} */ + /** @type {boolean} */ this.isInheritable = !!isInheritable; - /** @param {string} */ + /** @type {string} */ this.utcDateModified = utcDateModified; return this; @@ -91,7 +95,7 @@ class Attribute extends AbstractEntity { if (!(this.noteId in this.becca.notes)) { // entities can come out of order in sync, create skeleton which will be filled later - this.becca.notes[this.noteId] = new Note({noteId: this.noteId}); + this.becca.addNote(this.noteId, new Note({noteId: this.noteId})); } this.becca.notes[this.noteId].ownedAttributes.push(this); @@ -173,6 +177,10 @@ class Attribute extends AbstractEntity { } } + get isDeleted() { + return !(this.attributeId in this.becca.attributes); + } + beforeSaving() { if (!this.value) { if (this.type === 'relation') { @@ -237,7 +245,7 @@ module.exports = Attribute;
diff --git a/docs/backend_api/becca_entities_branch.js.html b/docs/backend_api/becca_entities_branch.js.html index f5b83e478..860191014 100644 --- a/docs/backend_api/becca_entities_branch.js.html +++ b/docs/backend_api/becca_entities_branch.js.html @@ -33,6 +33,10 @@ const AbstractEntity = require("./abstract_entity.js"); const sql = require("../../services/sql.js"); const dateUtils = require("../../services/date_utils.js"); +/** + * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple + * parents. + */ class Branch extends AbstractEntity { static get entityName() { return "branches"; } static get primaryKeyName() { return "branchId"; } @@ -63,19 +67,19 @@ class Branch extends AbstractEntity { } update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) { - /** @param {string} */ + /** @type {string} */ this.branchId = branchId; - /** @param {string} */ + /** @type {string} */ this.noteId = noteId; - /** @param {string} */ + /** @type {string} */ this.parentNoteId = parentNoteId; - /** @param {string} */ + /** @type {string} */ this.prefix = prefix; - /** @param {int} */ + /** @type {int} */ this.notePosition = notePosition; - /** @param {boolean} */ + /** @type {boolean} */ this.isExpanded = !!isExpanded; - /** @param {string} */ + /** @type {string} */ this.utcDateModified = utcDateModified; return this; @@ -89,20 +93,27 @@ class Branch extends AbstractEntity { const childNote = this.childNote; const parentNote = this.parentNote; - childNote.parents.push(parentNote); - childNote.parentBranches.push(this); + if (!childNote.parents.includes(parentNote)) { + childNote.parents.push(parentNote); + } - parentNote.children.push(childNote); + if (!childNote.parentBranches.includes(this)) { + childNote.parentBranches.push(this); + } + + if (!parentNote.children.includes(childNote)) { + parentNote.children.push(childNote); + } this.becca.branches[this.branchId] = this; this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; } - /** @return {Note} */ + /** @returns {Note} */ get childNote() { if (!(this.noteId in this.becca.notes)) { // entities can come out of order in sync, create skeleton which will be filled later - this.becca.notes[this.noteId] = new Note({noteId: this.noteId}); + this.becca.addNote(this.noteId, new Note({noteId: this.noteId})); } return this.becca.notes[this.noteId]; @@ -112,16 +123,20 @@ class Branch extends AbstractEntity { return this.childNote; } - /** @return {Note} */ + /** @returns {Note} */ get parentNote() { if (!(this.parentNoteId in this.becca.notes)) { // entities can come out of order in sync, create skeleton which will be filled later - this.becca.notes[this.parentNoteId] = new Note({noteId: this.parentNoteId}); + this.becca.addNote(this.parentNoteId, new Note({noteId: this.parentNoteId})); } return this.becca.notes[this.parentNoteId]; } + get isDeleted() { + return !(this.branchId in this.becca.branches); + } + beforeSaving() { if (this.notePosition === undefined || this.notePosition === null) { // TODO finding new position can be refactored into becca @@ -177,7 +192,7 @@ module.exports = Branch;
diff --git a/docs/backend_api/becca_entities_note.js.html b/docs/backend_api/becca_entities_note.js.html index 888251975..a16635153 100644 --- a/docs/backend_api/becca_entities_note.js.html +++ b/docs/backend_api/becca_entities_note.js.html @@ -40,6 +40,9 @@ const NoteRevision = require("./note_revision.js"); const LABEL = 'label'; const RELATION = 'relation'; +/** + * Trilium's main entity which can represent text note, image, code note, file attachment etc. + */ class Note extends AbstractEntity { static get entityName() { return "notes"; } static get primaryKeyName() { return "noteId"; } @@ -73,68 +76,80 @@ class Note extends AbstractEntity { update([noteId, title, type, mime, isProtected, dateCreated, dateModified, utcDateCreated, utcDateModified]) { // ------ Database persisted attributes ------ - /** @param {string} */ + /** @type {string} */ this.noteId = noteId; - /** @param {string} */ + /** @type {string} */ this.title = title; - /** @param {boolean} */ + /** @type {boolean} */ this.isProtected = !!isProtected; - /** @param {string} */ + /** @type {string} */ this.type = type; - /** @param {string} */ + /** @type {string} */ this.mime = mime; - /** @param {string} */ + /** @type {string} */ this.dateCreated = dateCreated || dateUtils.localNowDateTime(); - /** @param {string} */ + /** @type {string} */ this.dateModified = dateModified; - /** @param {string} */ + /** @type {string} */ this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime(); - /** @param {string} */ + /** @type {string} */ this.utcDateModified = utcDateModified; // ------ Derived attributes ------ - /** @param {boolean} */ - this.isDecrypted = !this.isProtected; + /** @type {boolean} */ + this.isDecrypted = !this.noteId || !this.isProtected; this.decrypt(); - /** @param {string|null} */ + /** @type {string|null} */ this.flatTextCache = null; return this; } init() { - /** @param {Branch[]} */ + /** @type {Branch[]} */ this.parentBranches = []; - /** @param {Note[]} */ + /** @type {Note[]} */ this.parents = []; - /** @param {Note[]} */ + /** @type {Note[]} */ this.children = []; - /** @param {Attribute[]} */ + /** @type {Attribute[]} */ this.ownedAttributes = []; - /** @param {Attribute[]|null} */ + /** @type {Attribute[]|null} + * @private */ this.__attributeCache = null; - /** @param {Attribute[]|null} */ + /** @type {Attribute[]|null} + * @private*/ this.inheritableAttributeCache = null; - /** @param {Attribute[]} */ + /** @type {Attribute[]} */ this.targetRelations = []; - this.becca.notes[this.noteId] = this; + this.becca.addNote(this.noteId, this); - /** @param {Note[]|null} */ + /** @type {Note[]|null} + * @private */ this.ancestorCache = null; // following attributes are filled during searching from database - /** @param {int} size of the content in bytes */ + /** + * size of the content in bytes + * @type {int|null} + */ this.contentSize = null; - /** @param {int} size of the content and note revision contents in bytes */ + /** + * size of the content and note revision contents in bytes + * @type {int|null} + */ this.noteSize = null; - /** @param {int} number of note revisions for this note */ + /** + * number of note revisions for this note + * @type {int|null} + */ this.revisionCount = null; } @@ -144,26 +159,32 @@ class Note extends AbstractEntity { || protectedSessionService.isProtectedSessionAvailable() } + /** @returns {Branch[]} */ getParentBranches() { return this.parentBranches; } + /** @returns {Branch[]} */ getBranches() { return this.parentBranches; } + /** @returns {Note[]} */ getParentNotes() { return this.parents; } + /** @returns {Note[]} */ getChildNotes() { return this.children; } + /** @returns {boolean} */ hasChildren() { return this.children && this.children.length > 0; } + /** @returns {Branch[]} */ getChildBranches() { return this.children.map(childNote => this.becca.getBranchFromChildAndParent(childNote.noteId, this.noteId)); } @@ -398,7 +419,7 @@ class Note extends AbstractEntity { return this.__attributeCache; } - /** @return {Attribute[]} */ + /** @returns {Attribute[]} */ __getInheritableAttributes(path) { if (path.includes(this.noteId)) { return []; @@ -639,7 +660,7 @@ class Note extends AbstractEntity { // will sort the parents so that non-search & non-archived are first and archived at the end // this is done so that non-search & non-archived paths are always explored as first when looking for note path - resortParents() { + sortParents() { this.parentBranches.sort((a, b) => a.branchId.startsWith('virt-') || a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1); @@ -749,28 +770,38 @@ class Note extends AbstractEntity { return !!this.targetRelations.find(rel => rel.name === 'template'); } - /** @return {Note[]} */ + /** @returns {Note[]} */ getSubtreeNotesIncludingTemplated() { - const arr = [[this]]; + const set = new Set(); - for (const childNote of this.children) { - arr.push(childNote.getSubtreeNotesIncludingTemplated()); - } + function inner(note) { + if (set.has(note)) { + return; + } - for (const targetRelation of this.targetRelations) { - if (targetRelation.name === 'template') { - const note = targetRelation.note; + set.add(note); - if (note) { - arr.push(note.getSubtreeNotesIncludingTemplated()); + for (const childNote of note.children) { + inner(childNote); + } + + for (const targetRelation of note.targetRelations) { + if (targetRelation.name === 'template') { + const targetNote = targetRelation.note; + + if (targetNote) { + inner(targetNote); + } } } } - return arr.flat(); + inner(this); + + return Array.from(set); } - /** @return {Note[]} */ + /** @returns {Note[]} */ getSubtreeNotes(includeArchived = true) { const noteSet = new Set(); @@ -791,9 +822,9 @@ class Note extends AbstractEntity { return Array.from(noteSet); } - /** @return {String[]} */ - getSubtreeNoteIds() { - return this.getSubtreeNotes().map(note => note.noteId); + /** @returns {String[]} */ + getSubtreeNoteIds(includeArchived = true) { + return this.getSubtreeNotes(includeArchived).map(note => note.noteId); } getDescendantNoteIds() { @@ -848,6 +879,7 @@ class Note extends AbstractEntity { return this.getAttributes().length; } + /** @returns {Note[]} */ getAncestors() { if (!this.ancestorCache) { const noteIds = new Set(); @@ -871,11 +903,22 @@ class Note extends AbstractEntity { return this.ancestorCache; } + /** @returns {boolean} */ + hasAncestor(ancestorNoteId) { + for (const ancestorNote of this.getAncestors()) { + if (ancestorNote.noteId === ancestorNoteId) { + return true; + } + } + + return false; + } + getTargetRelations() { return this.targetRelations; } - /** @return {Note[]} - returns only notes which are templated, does not include their subtrees + /** @returns {Note[]} - returns only notes which are templated, does not include their subtrees * in effect returns notes which are influenced by note's non-inheritable attributes */ getTemplatedNotes() { const arr = [this]; @@ -1112,10 +1155,14 @@ class Note extends AbstractEntity { } } + get isDeleted() { + return !(this.noteId in this.becca.notes); + } + beforeSaving() { super.beforeSaving(); - this.becca.notes[this.noteId] = this; + this.becca.addNote(this.noteId, this); this.dateModified = dateUtils.localNowDateTime(); this.utcDateModified = dateUtils.utcNowDateTime(); @@ -1164,7 +1211,7 @@ module.exports = Note;
diff --git a/docs/backend_api/becca_entities_note_revision.js.html b/docs/backend_api/becca_entities_note_revision.js.html index 63a014b97..cd16ba839 100644 --- a/docs/backend_api/becca_entities_note_revision.js.html +++ b/docs/backend_api/becca_entities_note_revision.js.html @@ -37,7 +37,8 @@ const entityChangesService = require('../../services/entity_changes'); const AbstractEntity = require("./abstract_entity.js"); /** - * NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning. + * NoteRevision represents snapshot of note's title and content at some point in the past. + * It's used for seamless note versioning. */ class NoteRevision extends AbstractEntity { static get entityName() { return "note_revisions"; } @@ -47,29 +48,29 @@ class NoteRevision extends AbstractEntity { constructor(row) { super(); - /** @param {string} */ + /** @type {string} */ this.noteRevisionId = row.noteRevisionId; - /** @param {string} */ + /** @type {string} */ this.noteId = row.noteId; - /** @param {string} */ + /** @type {string} */ this.type = row.type; - /** @param {string} */ + /** @type {string} */ this.mime = row.mime; - /** @param {boolean} */ + /** @type {boolean} */ this.isProtected = !!row.isProtected; - /** @param {string} */ + /** @type {string} */ this.title = row.title; - /** @param {string} */ + /** @type {string} */ this.dateLastEdited = row.dateLastEdited; - /** @param {string} */ + /** @type {string} */ this.dateCreated = row.dateCreated; - /** @param {string} */ + /** @type {string} */ this.utcDateLastEdited = row.utcDateLastEdited; - /** @param {string} */ + /** @type {string} */ this.utcDateCreated = row.utcDateCreated; - /** @param {string} */ + /** @type {string} */ this.utcDateModified = row.utcDateModified; - /** @param {number} */ + /** @type {number} */ this.contentLength = row.contentLength; if (this.isProtected) { @@ -77,7 +78,7 @@ class NoteRevision extends AbstractEntity { this.title = protectedSessionService.decryptString(this.title); } else { - this.title = "[Protected]"; + this.title = "[protected]"; } } } @@ -194,12 +195,14 @@ class NoteRevision extends AbstractEntity { utcDateLastEdited: this.utcDateLastEdited, utcDateCreated: this.utcDateCreated, utcDateModified: this.utcDateModified, + content: this.content, contentLength: this.contentLength }; } getPojoToSave() { const pojo = this.getPojo(); + delete pojo.content; // not getting persisted delete pojo.contentLength; // not getting persisted if (pojo.isProtected) { @@ -227,7 +230,7 @@ module.exports = NoteRevision;
diff --git a/docs/backend_api/becca_entities_option.js.html b/docs/backend_api/becca_entities_option.js.html index 1a5c269d8..c9cc7ae32 100644 --- a/docs/backend_api/becca_entities_option.js.html +++ b/docs/backend_api/becca_entities_option.js.html @@ -42,9 +42,13 @@ class Option extends AbstractEntity { constructor(row) { super(); + /** @type {string} */ this.name = row.name; + /** @type {string} */ this.value = row.value; + /** @type {boolean} */ this.isSynced = !!row.isSynced; + /** @type {string} */ this.utcDateModified = row.utcDateModified; this.becca.options[this.name] = this; @@ -79,7 +83,7 @@ module.exports = Option;
diff --git a/docs/backend_api/becca_entities_recent_note.js.html b/docs/backend_api/becca_entities_recent_note.js.html index ea9a1fae3..627f16937 100644 --- a/docs/backend_api/becca_entities_recent_note.js.html +++ b/docs/backend_api/becca_entities_recent_note.js.html @@ -41,8 +41,11 @@ class RecentNote extends AbstractEntity { constructor(row) { super(); + /** @type {string} */ this.noteId = row.noteId; + /** @type {string} */ this.notePath = row.notePath; + /** @type {string} */ this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); } @@ -66,7 +69,7 @@ module.exports = RecentNote;
diff --git a/docs/backend_api/entities_api_token.js.html b/docs/backend_api/entities_api_token.js.html deleted file mode 100644 index 01d3dd10a..000000000 --- a/docs/backend_api/entities_api_token.js.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - JSDoc: Source: entities/api_token.js - - - - - - - - - - -
- -

Source: entities/api_token.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const dateUtils = require('../services/date_utils');
-
-/**
- * ApiToken is an entity representing token used to authenticate against Trilium API from client applications. Currently used only by Trilium Sender.
- *
- * @property {string} apiTokenId - primary key
- * @property {string} token
- * @property {boolean} isDeleted - true if API token is deleted
- * @property {string} utcDateCreated
- *
- * @extends Entity
- */
-class ApiToken extends Entity {
-    static get entityName() { return "api_tokens"; }
-    static get primaryKeyName() { return "apiTokenId"; }
-    static get hashedProperties() { return ["apiTokenId", "token", "utcDateCreated", "isDeleted"]; }
-
-    beforeSaving() {
-        if (!this.isDeleted) {
-            this.isDeleted = false;
-        }
-
-        if (!this.utcDateCreated) {
-            this.utcDateCreated = dateUtils.utcNowDateTime();
-        }
-
-        super.beforeSaving();
-    }
-}
-
-module.exports = ApiToken;
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_attribute.js.html b/docs/backend_api/entities_attribute.js.html deleted file mode 100644 index 4485a8aa5..000000000 --- a/docs/backend_api/entities_attribute.js.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - JSDoc: Source: entities/attribute.js - - - - - - - - - - -
- -

Source: entities/attribute.js

- - - - - - -
-
-
"use strict";
-
-
-const Entity = require('./entity');
-const dateUtils = require('../services/date_utils');
-const sql = require('../services/sql');
-const promotedAttributeDefinitionParser = require("../services/promoted_attribute_definition_parser");
-
-/**
- * Attribute is key value pair owned by a note.
- *
- * @property {string} attributeId - immutable
- * @property {string} noteId - immutable
- * @property {string} type - immutable
- * @property {string} name - immutable
- * @property {string} value
- * @property {int} position
- * @property {boolean} isInheritable - immutable
- * @property {boolean} isDeleted
- * @property {string|null} deleteId - ID identifying delete transaction
- * @property {string} utcDateModified
- *
- * @extends Entity
- */
-class Attribute extends Entity {
-    static get entityName() { return "attributes"; }
-    static get primaryKeyName() { return "attributeId"; }
-    static get hashedProperties() { return ["attributeId", "noteId", "type", "name", "value", "isInheritable", "isDeleted"]; }
-
-    constructor(row) {
-        super(row);
-
-        this.isInheritable = !!this.isInheritable;
-    }
-
-    isAutoLink() {
-        return this.type === 'relation' && ['internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink'].includes(this.name);
-    }
-
-    /**
-     * @returns {Note|null}
-     */
-    getNote() {
-        return this.repository.getNote(this.noteId);
-    }
-
-    /**
-     * @returns {Note|null}
-     */
-    getTargetNote() {
-        if (this.type !== 'relation') {
-            throw new Error(`Attribute ${this.attributeId} is not relation`);
-        }
-
-        if (!this.value) {
-            return null;
-        }
-
-        return this.repository.getNote(this.value);
-    }
-
-    /**
-     * @return {boolean}
-     */
-    isDefinition() {
-        return this.type === 'label' && (this.name.startsWith('label:') || this.name.startsWith('relation:'));
-    }
-
-    getDefinition() {
-        return promotedAttributeDefinitionParser.parse(this.value);
-    }
-
-    getDefinedName() {
-        if (this.type === 'label' && this.name.startsWith('label:')) {
-            return this.name.substr(6);
-        } else if (this.type === 'label' && this.name.startsWith('relation:')) {
-            return this.name.substr(9);
-        } else {
-            return this.name;
-        }
-    }
-
-    beforeSaving() {
-        if (!this.value) {
-            if (this.type === 'relation') {
-                throw new Error(`Cannot save relation ${this.name} since it does not target any note.`);
-            }
-
-            // null value isn't allowed
-            this.value = "";
-        }
-
-        if (this.position === undefined) {
-            this.position = 1 + sql.getValue(`SELECT COALESCE(MAX(position), 0) FROM attributes WHERE noteId = ?`, [this.noteId]);
-        }
-
-        if (!this.isInheritable) {
-            this.isInheritable = false;
-        }
-
-        if (!this.isDeleted) {
-            this.isDeleted = false;
-        }
-
-        super.beforeSaving();
-
-        this.utcDateModified = dateUtils.utcNowDateTime();
-    }
-
-    createClone(type, name, value, isInheritable) {
-        return new Attribute({
-            noteId: this.noteId,
-            type: type,
-            name: name,
-            value: value,
-            position: this.position,
-            isInheritable: isInheritable,
-            isDeleted: false,
-            utcDateModified: this.utcDateModified
-        });
-    }
-}
-
-module.exports = Attribute;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_branch.js.html b/docs/backend_api/entities_branch.js.html deleted file mode 100644 index 6c28da4f8..000000000 --- a/docs/backend_api/entities_branch.js.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - JSDoc: Source: entities/branch.js - - - - - - - - - - -
- -

Source: entities/branch.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const dateUtils = require('../services/date_utils');
-const sql = require('../services/sql');
-
-/**
- * Branch represents note's placement in the tree - it's essentially pair of noteId and parentNoteId.
- * Each note can have multiple (at least one) branches, meaning it can be placed into multiple places in the tree.
- *
- * @property {string} branchId - primary key, immutable
- * @property {string} noteId - immutable
- * @property {string} parentNoteId - immutable
- * @property {int} notePosition
- * @property {string} prefix
- * @property {boolean} isExpanded
- * @property {boolean} isDeleted
- * @property {string|null} deleteId - ID identifying delete transaction
- * @property {string} utcDateModified
- * @property {string} utcDateCreated
- *
- * @extends Entity
- */
-class Branch extends Entity {
-    static get entityName() { return "branches"; }
-    static get primaryKeyName() { return "branchId"; }
-    // notePosition is not part of hash because it would produce a lot of updates in case of reordering
-    static get hashedProperties() { return ["branchId", "noteId", "parentNoteId", "isDeleted", "deleteId", "prefix"]; }
-
-    /** @returns {Note|null} */
-    getNote() {
-        return this.repository.getNote(this.noteId);
-    }
-
-    /** @returns {Note|null} */
-    getParentNote() {
-        return this.repository.getNote(this.parentNoteId);
-    }
-
-    beforeSaving() {
-        if (this.notePosition === undefined || this.notePosition === null) {
-            const maxNotePos = sql.getValue('SELECT MAX(notePosition) FROM branches WHERE parentNoteId = ? AND isDeleted = 0', [this.parentNoteId]);
-            this.notePosition = maxNotePos === null ? 0 : maxNotePos + 10;
-        }
-
-        if (!this.isExpanded) {
-            this.isExpanded = false;
-        }
-
-        if (!this.isDeleted) {
-            this.isDeleted = false;
-        }
-
-        if (!this.utcDateCreated) {
-            this.utcDateCreated = dateUtils.utcNowDateTime();
-        }
-
-        super.beforeSaving();
-
-        this.utcDateModified = dateUtils.utcNowDateTime();
-    }
-
-    createClone(parentNoteId, notePosition) {
-        return new Branch({
-            noteId: this.noteId,
-            parentNoteId: parentNoteId,
-            notePosition: notePosition,
-            prefix: this.prefix,
-            isExpanded: this.isExpanded,
-            isDeleted: false,
-            utcDateCreated: this.utcDateCreated,
-            utcDateModified: this.utcDateModified
-        });
-    }
-}
-
-module.exports = Branch;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_entity.js.html b/docs/backend_api/entities_entity.js.html deleted file mode 100644 index c6a8b1dcb..000000000 --- a/docs/backend_api/entities_entity.js.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - JSDoc: Source: entities/entity.js - - - - - - - - - - -
- -

Source: entities/entity.js

- - - - - - -
-
-
"use strict";
-
-const utils = require('../services/utils');
-let repo = null;
-
-class Entity {
-    /**
-     * @param {object} [row] - database row representing given entity
-     */
-    constructor(row = {}) {
-        for (const key in row) {
-            // ! is used when joint-fetching notes and note_contents objects for performance
-            if (!key.startsWith('!')) {
-                this[key] = row[key];
-            }
-        }
-
-        if ('isDeleted' in this && this.constructor.entityName !== 'recent_notes') {
-            this.isDeleted = !!this.isDeleted;
-        }
-    }
-
-    beforeSaving() {
-        this.generateIdIfNecessary();
-    }
-
-    generateIdIfNecessary() {
-        if (!this[this.constructor.primaryKeyName]) {
-            this[this.constructor.primaryKeyName] = utils.newEntityId();
-        }
-    }
-
-    generateHash() {
-        let contentToHash = "";
-
-        for (const propertyName of this.constructor.hashedProperties) {
-            contentToHash += "|" + this[propertyName];
-        }
-
-        return utils.hash(contentToHash).substr(0, 10);
-    }
-
-    getUtcDateChanged() {
-        return this.utcDateModified || this.utcDateCreated;
-    }
-
-    get repository() {
-        if (!repo) {
-            repo = require('../services/repository');
-        }
-
-        return repo;
-    }
-
-    save() {
-        this.repository.updateEntity(this);
-
-        return this;
-    }
-}
-
-module.exports = Entity;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_image.js.html b/docs/backend_api/entities_image.js.html deleted file mode 100644 index 8ef53d133..000000000 --- a/docs/backend_api/entities_image.js.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - JSDoc: Source: entities/image.js - - - - - - - - - - -
- -

Source: entities/image.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const dateUtils = require('../services/date_utils');
-
-/**
- * This class represents image data.
- *
- * @param {string} imageId
- * @param {string} format
- * @param {string} checksum
- * @param {string} name
- * @param {blob} data
- * @param {boolean} isDeleted
- * @param {string} dateModified
- * @param {string} dateCreated
- *
- * @extends Entity
- */
-class Image extends Entity {
-    static get entityName() { return "images"; }
-    static get primaryKeyName() { return "imageId"; }
-    static get hashedProperties() { return ["imageId", "format", "checksum", "name", "isDeleted", "dateCreated"]; }
-
-    beforeSaving() {
-        if (!this.isDeleted) {
-            this.isDeleted = false;
-        }
-
-        if (!this.dateCreated) {
-            this.dateCreated = dateUtils.nowDate();
-        }
-
-        super.beforeSaving();
-
-        if (this.isChanged) {
-            this.dateModified = dateUtils.nowDate();
-        }
-    }
-}
-
-module.exports = Image;
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST) -
- - - - - diff --git a/docs/backend_api/entities_link.js.html b/docs/backend_api/entities_link.js.html deleted file mode 100644 index b4f0f1376..000000000 --- a/docs/backend_api/entities_link.js.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - JSDoc: Source: entities/link.js - - - - - - - - - - -
- -

Source: entities/link.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const repository = require('../services/repository');
-const dateUtils = require('../services/date_utils');
-
-/**
- * This class represents link from one note to another in the form of hyperlink or image reference. Note that
- * this is different concept than attribute/relation.
- *
- * @param {string} linkId
- * @param {string} noteId
- * @param {string} targetNoteId
- * @param {string} type
- * @param {boolean} isDeleted
- * @param {string} utcDateModified
- * @param {string} utcDateCreated
- *
- * @extends Entity
- */
-class Link extends Entity {
-    static get entityName() { return "links"; }
-    static get primaryKeyName() { return "linkId"; }
-    static get hashedProperties() { return ["linkId", "noteId", "targetNoteId", "type", "isDeleted", "utcDateCreated", "utcDateModified"]; }
-
-    async getNote() {
-        return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
-    }
-
-    async getTargetNote() {
-        return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.targetNoteId]);
-    }
-
-    beforeSaving() {
-        if (!this.isDeleted) {
-            this.isDeleted = false;
-        }
-
-        if (!this.utcDateCreated) {
-            this.utcDateCreated = dateUtils.utcNowDateTime();
-        }
-
-        super.beforeSaving();
-
-        if (this.isChanged) {
-            this.utcDateModified = dateUtils.utcNowDateTime();
-        }
-    }
-}
-
-module.exports = Link;
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.html deleted file mode 100644 index 1e1e26482..000000000 --- a/docs/backend_api/entities_note.js.html +++ /dev/null @@ -1,993 +0,0 @@ - - - - - JSDoc: Source: entities/note.js - - - - - - - - - - -
- -

Source: entities/note.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const Attribute = require('./attribute');
-const protectedSessionService = require('../services/protected_session');
-const sql = require('../services/sql');
-const utils = require('../services/utils');
-const dateUtils = require('../services/date_utils');
-const entityChangesService = require('../services/entity_changes.js');
-
-const LABEL = 'label';
-const RELATION = 'relation';
-
-/**
- * This represents a Note which is a central object in the Trilium Notes project.
- *
- * @property {string} noteId - primary key
- * @property {string} type - one of "text", "code", "file" or "render"
- * @property {string} mime - MIME type, e.g. "text/html"
- * @property {string} title - note title
- * @property {boolean} isProtected - true if note is protected
- * @property {boolean} isDeleted - true if note is deleted
- * @property {string|null} deleteId - ID identifying delete transaction
- * @property {string} dateCreated - local date time (with offset)
- * @property {string} dateModified - local date time (with offset)
- * @property {string} utcDateCreated
- * @property {string} utcDateModified
- *
- * @extends Entity
- */
-class Note extends Entity {
-    static get entityName() { return "notes"; }
-    static get primaryKeyName() { return "noteId"; }
-    static get hashedProperties() { return ["noteId", "title", "type", "mime", "isProtected", "isDeleted", "deleteId"]; }
-
-    /**
-     * @param row - object containing database row from "notes" table
-     */
-    constructor(row) {
-        super(row);
-
-        this.isProtected = !!this.isProtected;
-        /* true if content is either not encrypted
-         * or encrypted, but with available protected session (so effectively decrypted) */
-        this.isContentAvailable = true;
-
-        // check if there's noteId, otherwise this is a new entity which wasn't encrypted yet
-        if (this.isProtected && this.noteId) {
-            this.isContentAvailable = protectedSessionService.isProtectedSessionAvailable();
-
-            if (this.isContentAvailable) {
-                try {
-                    this.title = protectedSessionService.decryptString(this.title);
-                }
-                catch (e) {
-                    throw new Error(`Could not decrypt title of note ${this.noteId}: ${e.message} ${e.stack}`)
-                }
-            }
-            else {
-                this.title = "[protected]";
-            }
-        }
-    }
-
-    /*
-     * Note content has quite special handling - it's not a separate entity, but a lazily loaded
-     * part of Note entity with it's 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 {*} */
-    getContent(silentNotFoundError = false) {
-        if (this.content === undefined) {
-            const row = sql.getRow(`SELECT content FROM note_contents WHERE noteId = ?`, [this.noteId]);
-
-            if (!row) {
-                if (silentNotFoundError) {
-                    return undefined;
-                }
-                else {
-                    throw new Error("Cannot find note content for noteId=" + this.noteId);
-                }
-            }
-
-            this.content = row.content;
-
-            if (this.isProtected) {
-                if (this.isContentAvailable) {
-                    this.content = this.content === null ? null : protectedSessionService.decrypt(this.content);
-                }
-                else {
-                    this.content = "";
-                }
-            }
-        }
-
-        if (this.isStringNote()) {
-            return this.content === null
-                ? ""
-                : this.content.toString("UTF-8");
-        }
-        else {
-            return this.content;
-        }
-    }
-
-    /** @returns {{contentLength, dateModified, utcDateModified}} */
-    getContentMetadata() {
-        return sql.getRow(`
-            SELECT 
-                LENGTH(content) AS contentLength, 
-                dateModified,
-                utcDateModified 
-            FROM note_contents 
-            WHERE noteId = ?`, [this.noteId]);
-    }
-
-    /** @returns {*} */
-    getJsonContent() {
-        const content = this.getContent();
-
-        if (!content || !content.trim()) {
-            return null;
-        }
-
-        return JSON.parse(content);
-    }
-
-    setContent(content) {
-        if (content === null || content === undefined) {
-            throw new Error(`Cannot set null content to note ${this.noteId}`);
-        }
-
-        if (this.isStringNote()) {
-            content = content.toString();
-        }
-        else {
-            content = Buffer.isBuffer(content) ? content : Buffer.from(content);
-        }
-
-        this.content = content;
-
-        const pojo = {
-            noteId: this.noteId,
-            content: content,
-            dateModified: dateUtils.localNowDateTime(),
-            utcDateModified: dateUtils.utcNowDateTime()
-        };
-
-        if (this.isProtected) {
-            if (this.isContentAvailable) {
-                pojo.content = protectedSessionService.encrypt(pojo.content);
-            }
-            else {
-                throw new Error(`Cannot update content of noteId=${this.noteId} since we're out of protected session.`);
-            }
-        }
-
-        sql.upsert("note_contents", "noteId", pojo);
-
-        const hash = utils.hash(this.noteId + "|" + pojo.content.toString());
-
-        entityChangesService.addEntityChange({
-            entityName: 'note_contents',
-            entityId: this.noteId,
-            hash: hash,
-            isErased: false,
-            utcDateChanged: pojo.utcDateModified
-        }, null);
-    }
-
-    setJsonContent(content) {
-        this.setContent(JSON.stringify(content, null, '\t'));
-    }
-
-    /** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
-    isRoot() {
-        return this.noteId === 'root';
-    }
-
-    /** @returns {boolean} true if this note is of application/json content type */
-    isJson() {
-        return this.mime === "application/json";
-    }
-
-    /** @returns {boolean} true if this note is JavaScript (code or attachment) */
-    isJavaScript() {
-        return (this.type === "code" || this.type === "file")
-            && (this.mime.startsWith("application/javascript")
-                || this.mime === "application/x-javascript"
-                || this.mime === "text/javascript");
-    }
-
-    /** @returns {boolean} true if this note is HTML */
-    isHtml() {
-        return (this.type === "code" || this.type === "file" || this.type === "render") && this.mime === "text/html";
-    }
-
-    /** @returns {boolean} true if the note has string content (not binary) */
-    isStringNote() {
-        return utils.isStringNote(this.type, this.mime);
-    }
-
-    /** @returns {string} JS script environment - either "frontend" or "backend" */
-    getScriptEnv() {
-        if (this.isHtml() || (this.isJavaScript() && this.mime.endsWith('env=frontend'))) {
-            return "frontend";
-        }
-
-        if (this.type === 'render') {
-            return "frontend";
-        }
-
-        if (this.isJavaScript() && this.mime.endsWith('env=backend')) {
-            return "backend";
-        }
-
-        return null;
-    }
-
-    loadOwnedAttributesToCache() {
-        this.__ownedAttributeCache = this.repository.getEntities(`SELECT * FROM attributes WHERE isDeleted = 0 AND noteId = ?`, [this.noteId]);
-        return this.__ownedAttributeCache;
-    }
-
-    /**
-     * This method is a faster variant of getAttributes() which looks for only owned attributes.
-     * Use when inheritance is not needed and/or in batch/performance sensitive operations.
-     *
-     * @param {string} [type] - (optional) attribute type to filter
-     * @param {string} [name] - (optional) attribute name to filter
-     * @returns {Attribute[]} note's "owned" attributes - excluding inherited ones
-     */
-    getOwnedAttributes(type, name) {
-        if (!this.__ownedAttributeCache) {
-            this.loadOwnedAttributesToCache();
-        }
-
-        if (type && name) {
-            return this.__ownedAttributeCache.filter(attr => attr.type === type && attr.name === name);
-        }
-        else if (type) {
-            return this.__ownedAttributeCache.filter(attr => attr.type === type);
-        }
-        else if (name) {
-            return this.__ownedAttributeCache.filter(attr => attr.name === name);
-        }
-        else {
-            return this.__ownedAttributeCache.slice();
-        }
-    }
-
-    /**
-     * @returns {Attribute} attribute belonging to this specific note (excludes inherited attributes)
-     *
-     * This method can be significantly faster than the getAttribute()
-     */
-    getOwnedAttribute(type, name) {
-        const attrs = this.getOwnedAttributes(type, name);
-
-        return attrs.length > 0 ? attrs[0] : null;
-    }
-
-    /**
-     * @returns {Attribute[]} relations targetting this specific note
-     */
-    getTargetRelations() {
-        return this.repository.getEntities("SELECT * FROM attributes WHERE type = 'relation' AND isDeleted = 0 AND value = ?", [this.noteId]);
-    }
-
-    /**
-     * @param {string} [type] - (optional) attribute type to filter
-     * @param {string} [name] - (optional) attribute name to filter
-     * @returns {Attribute[]} all note's attributes, including inherited ones
-     */
-    getAttributes(type, name) {
-        if (!this.__attributeCache) {
-            this.loadAttributesToCache();
-        }
-
-        if (type && name) {
-            return this.__attributeCache.filter(attr => attr.type === type && attr.name === name);
-        }
-        else if (type) {
-            return this.__attributeCache.filter(attr => attr.type === type);
-        }
-        else if (name) {
-            return this.__attributeCache.filter(attr => attr.name === name);
-        }
-        else {
-            return this.__attributeCache.slice();
-        }
-    }
-
-    /**
-     * @param {string} [name] - label name to filter
-     * @returns {Attribute[]} all note's labels (attributes with type label), including inherited ones
-     */
-    getLabels(name) {
-        return this.getAttributes(LABEL, name);
-    }
-
-    /**
-     * @param {string} [name] - label name to filter
-     * @returns {Attribute[]} all note's labels (attributes with type label), excluding inherited ones
-     */
-    getOwnedLabels(name) {
-        return this.getOwnedAttributes(LABEL, name);
-    }
-
-    /**
-     * @param {string} [name] - relation name to filter
-     * @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones
-     */
-    getRelations(name) {
-        return this.getAttributes(RELATION, name);
-    }
-
-    /**
-     * @param {string} [name] - relation name to filter
-     * @returns {Attribute[]} all note's relations (attributes with type relation), excluding inherited ones
-     */
-    getOwnedRelations(name) {
-        return this.getOwnedAttributes(RELATION, name);
-    }
-
-    /**
-     * @param {string} [name] - relation name to filter
-     * @returns {Note[]}
-     */
-    getRelationTargets(name) {
-        const relations = this.getRelations(name);
-        const targets = [];
-
-        for (const relation of relations) {
-            targets.push(relation.getTargetNote());
-        }
-
-        return targets;
-    }
-
-    /**
-     * Clear note's attributes cache to force fresh reload for next attribute request.
-     * Cache is note instance scoped.
-     */
-    invalidateAttributeCache() {
-        this.__attributeCache = null;
-        this.__ownedAttributeCache = null;
-    }
-
-    loadAttributesToCache() {
-        const attributes = this.repository.getEntities(`
-            WITH RECURSIVE
-            tree(noteId, level) AS (
-                SELECT ?, 0
-                UNION
-                SELECT branches.parentNoteId, tree.level + 1 
-                    FROM branches
-                    JOIN tree ON branches.noteId = tree.noteId
-                WHERE branches.isDeleted = 0
-            ),
-            treeWithAttrs(noteId, level) AS (
-                SELECT * FROM tree
-                UNION
-                SELECT attributes.value, treeWithAttrs.level FROM attributes
-                     JOIN treeWithAttrs ON treeWithAttrs.noteId = attributes.noteId
-                WHERE attributes.isDeleted = 0
-                  AND attributes.type = 'relation'
-                  AND attributes.name = 'template'
-                )
-            SELECT attributes.* FROM attributes JOIN treeWithAttrs ON attributes.noteId = treeWithAttrs.noteId
-            WHERE attributes.isDeleted = 0 AND (attributes.isInheritable = 1 OR treeWithAttrs.level = 0)
-            ORDER BY level, noteId, position`, [this.noteId]);
-        // attributes are ordered so that "closest" attributes are first
-        // we order by noteId so that attributes from same note stay together. Actual noteId ordering doesn't matter.
-
-        const filteredAttributes = attributes.filter((attr, index) => {
-            // if this exact attribute already appears then don't include it (can happen via cloning)
-            if (attributes.findIndex(it => it.attributeId === attr.attributeId) !== index) {
-                return false;
-            }
-
-            // FIXME: this code is quite questionable, one problem is that other caches (Froca, Becca) have nothing like that
-            if (attr.isDefinition()) {
-                const firstDefinitionIndex = attributes.findIndex(el => el.type === attr.type && el.name === attr.name);
-
-                // keep only if this element is the first definition for this type & name
-                return firstDefinitionIndex === index;
-            }
-            else {
-                const definitionAttr = attributes.find(el => el.type === 'label' && el.name === attr.type + ':' + attr.name);
-
-                if (!definitionAttr) {
-                    return true;
-                }
-
-                const definition = definitionAttr.getDefinition();
-
-                if (definition.multiplicity === 'multi') {
-                    return true;
-                }
-                else {
-                    const firstAttrIndex = attributes.findIndex(el => el.type === attr.type && el.name === attr.name);
-
-                    // in case of single-valued attribute we'll keep it only if it's first (closest)
-                    return firstAttrIndex === index;
-                }
-            }
-        });
-
-        this.__attributeCache = filteredAttributes;
-    }
-
-    /**
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @returns {boolean} true if note has an attribute with given type and name (including inherited)
-     */
-    hasAttribute(type, name) {
-        return !!this.getAttribute(type, name);
-    }
-
-    /**
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @returns {boolean} true if note has an attribute with given type and name (excluding inherited)
-     */
-    hasOwnedAttribute(type, name) {
-        return !!this.getOwnedAttribute(type, name);
-    }
-
-    /**
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @returns {Attribute} attribute of given type and name. If there's more such attributes, first is  returned. Returns null if there's no such attribute belonging to this note.
-     */
-    getAttribute(type, name) {
-        const attributes = this.getAttributes();
-
-        return attributes.find(attr => attr.type === type && attr.name === name);
-    }
-
-    /**
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @returns {string|null} attribute value of given type and name or null if no such attribute exists.
-     */
-    getAttributeValue(type, name) {
-        const attr = this.getAttribute(type, name);
-
-        return attr ? attr.value : null;
-    }
-
-    /**
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @returns {string|null} attribute value of given type and name or null if no such attribute exists.
-     */
-    getOwnedAttributeValue(type, name) {
-        const attr = this.getOwnedAttribute(type, name);
-
-        return attr ? attr.value : null;
-    }
-
-    /**
-     * Based on enabled, attribute is either set or removed.
-     *
-     * @param {string} type - attribute type ('relation', 'label' etc.)
-     * @param {boolean} enabled - toggle On or Off
-     * @param {string} name - attribute name
-     * @param {string} [value] - attribute value (optional)
-     */
-    toggleAttribute(type, enabled, name, value) {
-        if (enabled) {
-            this.setAttribute(type, name, value);
-        }
-        else {
-            this.removeAttribute(type, name, value);
-        }
-    }
-
-    /**
-     * Update's given attribute's value or creates it if it doesn't exist
-     *
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @param {string} [value] - attribute value (optional)
-     */
-    setAttribute(type, name, value) {
-        const attributes = this.loadOwnedAttributesToCache();
-        let attr = attributes.find(attr => attr.type === type && attr.name === name);
-
-        if (attr) {
-            if (attr.value !== value) {
-                attr.value = value;
-                attr.save();
-
-                this.invalidateAttributeCache();
-            }
-        }
-        else {
-            attr = new Attribute({
-                noteId: this.noteId,
-                type: type,
-                name: name,
-                value: value !== undefined ? value : ""
-            });
-
-            attr.save();
-
-            this.invalidateAttributeCache();
-        }
-    }
-
-    /**
-     * Removes given attribute name-value pair if it exists.
-     *
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @param {string} [value] - attribute value (optional)
-     */
-    removeAttribute(type, name, value) {
-        const attributes = this.loadOwnedAttributesToCache();
-
-        for (const attribute of attributes) {
-            if (attribute.type === type && attribute.name === name && (value === undefined || value === attribute.value)) {
-                attribute.isDeleted = true;
-                attribute.save();
-
-                this.invalidateAttributeCache();
-            }
-        }
-    }
-
-    /**
-     * @return {Attribute}
-     */
-    addAttribute(type, name, value = "", isInheritable = false, position = 1000) {
-        const attr = new Attribute({
-            noteId: this.noteId,
-            type: type,
-            name: name,
-            value: value,
-            isInheritable: isInheritable,
-            position: position
-        });
-
-        attr.save();
-
-        this.invalidateAttributeCache();
-
-        return attr;
-    }
-
-    addLabel(name, value = "", isInheritable = false) {
-        return this.addAttribute(LABEL, name, value, isInheritable);
-    }
-
-    addRelation(name, targetNoteId, isInheritable = false) {
-        return this.addAttribute(RELATION, name, targetNoteId, isInheritable);
-    }
-
-    /**
-     * @param {string} name - label name
-     * @returns {boolean} true if label exists (including inherited)
-     */
-    hasLabel(name) { return this.hasAttribute(LABEL, name); }
-
-    /**
-     * @param {string} name - label name
-     * @returns {boolean} true if label exists (excluding inherited)
-     */
-    hasOwnedLabel(name) { return this.hasOwnedAttribute(LABEL, name); }
-
-    /**
-     * @param {string} name - relation name
-     * @returns {boolean} true if relation exists (including inherited)
-     */
-    hasRelation(name) { return this.hasAttribute(RELATION, name); }
-
-    /**
-     * @param {string} name - relation name
-     * @returns {boolean} true if relation exists (excluding inherited)
-     */
-    hasOwnedRelation(name) { return this.hasOwnedAttribute(RELATION, name); }
-
-    /**
-     * @param {string} name - label name
-     * @returns {Attribute|null} label if it exists, null otherwise
-     */
-    getLabel(name) { return this.getAttribute(LABEL, name); }
-
-    /**
-     * @param {string} name - label name
-     * @returns {Attribute|null} label if it exists, null otherwise
-     */
-    getOwnedLabel(name) { return this.getOwnedAttribute(LABEL, name); }
-
-    /**
-     * @param {string} name - relation name
-     * @returns {Attribute|null} relation if it exists, null otherwise
-     */
-    getRelation(name) { return this.getAttribute(RELATION, name); }
-
-    /**
-     * @param {string} name - relation name
-     * @returns {Attribute|null} relation if it exists, null otherwise
-     */
-    getOwnedRelation(name) { return this.getOwnedAttribute(RELATION, name); }
-
-    /**
-     * @param {string} name - label name
-     * @returns {string|null} label value if label exists, null otherwise
-     */
-    getLabelValue(name) { return this.getAttributeValue(LABEL, name); }
-
-    /**
-     * @param {string} name - label name
-     * @returns {string|null} label value if label exists, null otherwise
-     */
-    getOwnedLabelValue(name) { return this.getOwnedAttributeValue(LABEL, name); }
-
-    /**
-     * @param {string} name - relation name
-     * @returns {string|null} relation value if relation exists, null otherwise
-     */
-    getRelationValue(name) { return this.getAttributeValue(RELATION, name); }
-
-    /**
-     * @param {string} name - relation name
-     * @returns {string|null} relation value if relation exists, null otherwise
-     */
-    getOwnedRelationValue(name) { return this.getOwnedAttributeValue(RELATION, name); }
-
-    /**
-     * @param {string} name
-     * @returns {Note|null} target note of the relation or null (if target is empty or note was not found)
-     */
-    getRelationTarget(name) {
-        const relation = this.getRelation(name);
-
-        return relation ? this.repository.getNote(relation.value) : null;
-    }
-
-    /**
-     * @param {string} name
-     * @returns {Note|null} target note of the relation or null (if target is empty or note was not found)
-     */
-    getOwnedRelationTarget(name) {
-        const relation = this.getOwnedRelation(name);
-
-        return relation ? this.repository.getNote(relation.value) : null;
-    }
-
-    /**
-     * Based on enabled, label is either set or removed.
-     *
-     * @param {boolean} enabled - toggle On or Off
-     * @param {string} name - label name
-     * @param {string} [value] - label value (optional)
-     */
-    toggleLabel(enabled, name, value) { return this.toggleAttribute(LABEL, enabled, name, value); }
-
-    /**
-     * Based on enabled, relation is either set or removed.
-     *
-     * @param {boolean} enabled - toggle On or Off
-     * @param {string} name - relation name
-     * @param {string} [value] - relation value (noteId)
-     */
-    toggleRelation(enabled, name, value) { return this.toggleAttribute(RELATION, enabled, name, value); }
-
-    /**
-     * Update's given label's value or creates it if it doesn't exist
-     *
-     * @param {string} name - label name
-     * @param {string} [value] - label value
-     */
-    setLabel(name, value) { return this.setAttribute(LABEL, name, value); }
-
-    /**
-     * Update's given relation's value or creates it if it doesn't exist
-     *
-     * @param {string} name - relation name
-     * @param {string} value - relation value (noteId)
-     */
-    setRelation(name, value) { return this.setAttribute(RELATION, name, value); }
-
-    /**
-     * Remove label name-value pair, if it exists.
-     *
-     * @param {string} name - label name
-     * @param {string} [value] - label value
-     */
-    removeLabel(name, value) { return this.removeAttribute(LABEL, name, value); }
-
-    /**
-     * Remove relation name-value pair, if it exists.
-     *
-     * @param {string} name - relation name
-     * @param {string} [value] - relation value (noteId)
-     */
-    removeRelation(name, value) { return this.removeAttribute(RELATION, name, value); }
-
-    /**
-     * @return {string[]} return list of all descendant noteIds of this note. Returning just noteIds because number of notes can be huge. Includes also this note's noteId
-     */
-    getDescendantNoteIds() {
-        return sql.getColumn(`
-            WITH RECURSIVE
-            tree(noteId) AS (
-                SELECT ?
-                UNION
-                SELECT branches.noteId FROM branches
-                    JOIN tree ON branches.parentNoteId = tree.noteId
-                    JOIN notes ON notes.noteId = branches.noteId
-                WHERE notes.isDeleted = 0
-                  AND branches.isDeleted = 0
-            )
-            SELECT noteId FROM tree`, [this.noteId]);
-    }
-
-    /**
-     * Finds descendant notes with given attribute name and value. Only own attributes are considered, not inherited ones
-     *
-     * @param {string} type - attribute type (label, relation, etc.)
-     * @param {string} name - attribute name
-     * @param {string} [value] - attribute value
-     * @returns {Note[]}
-     */
-    getDescendantNotesWithAttribute(type, name, value) {
-        const params = [this.noteId, name];
-        let valueCondition = "";
-
-        if (value !== undefined) {
-            params.push(value);
-            valueCondition = " AND attributes.value = ?";
-        }
-
-        const notes = this.repository.getEntities(`
-            WITH RECURSIVE
-            tree(noteId) AS (
-                SELECT ?
-                UNION
-                SELECT branches.noteId FROM branches
-                    JOIN tree ON branches.parentNoteId = tree.noteId
-                    JOIN notes ON notes.noteId = branches.noteId
-                WHERE notes.isDeleted = 0
-                  AND branches.isDeleted = 0
-            )
-            SELECT notes.* FROM notes 
-            JOIN tree ON tree.noteId = notes.noteId
-            JOIN attributes ON attributes.noteId = notes.noteId
-            WHERE attributes.isDeleted = 0 
-              AND attributes.name = ?
-              ${valueCondition} 
-            ORDER BY noteId, position`, params);
-
-        return notes;
-    }
-
-    /**
-     * Finds descendant notes with given label name and value. Only own labels are considered, not inherited ones
-     *
-     * @param {string} name - label name
-     * @param {string} [value] - label value
-     * @returns {Note[]}
-     */
-    getDescendantNotesWithLabel(name, value) { return this.getDescendantNotesWithAttribute(LABEL, name, value); }
-
-    /**
-     * Finds descendant notes with given relation name and value. Only own relations are considered, not inherited ones
-     *
-     * @param {string} name - relation name
-     * @param {string} [value] - relation value
-     * @returns {Note[]}
-     */
-    getDescendantNotesWithRelation(name, value) { return this.getDescendantNotesWithAttribute(RELATION, name, value); }
-
-    /**
-     * Returns note revisions of this note.
-     *
-     * @returns {NoteRevision[]}
-     */
-    getRevisions() {
-        return this.repository.getEntities("SELECT * FROM note_revisions WHERE noteId = ?", [this.noteId]);
-    }
-
-    /**
-     * Get list of links coming out of this note.
-     *
-     * @deprecated - not intended for general use
-     * @returns {Attribute[]}
-     */
-    getLinks() {
-        return this.repository.getEntities(`
-            SELECT * 
-            FROM attributes 
-            WHERE noteId = ? AND 
-                  isDeleted = 0 AND
-                  type = 'relation' AND
-                  name IN ('internalLink', 'imageLink', 'relationMapLink', 'includeNoteLink')`, [this.noteId]);
-    }
-
-    /**
-     * @returns {Branch[]}
-     */
-    getBranches() {
-        return this.repository.getEntities("SELECT * FROM branches WHERE isDeleted = 0 AND noteId = ?", [this.noteId]);
-    }
-
-    /**
-     * @returns {boolean} - true if note has children
-     */
-    hasChildren() {
-        return this.getChildNotes().length > 0;
-    }
-
-    /**
-     * @returns {Note[]} child notes of this note
-     */
-    getChildNotes() {
-        return this.repository.getEntities(`
-          SELECT notes.* 
-          FROM branches 
-            JOIN notes USING(noteId) 
-          WHERE notes.isDeleted = 0
-                AND branches.isDeleted = 0
-                AND branches.parentNoteId = ?
-          ORDER BY branches.notePosition`, [this.noteId]);
-    }
-
-    /**
-     * @returns {Branch[]} child branches of this note
-     */
-    getChildBranches() {
-        return this.repository.getEntities(`
-          SELECT branches.* 
-          FROM branches 
-          WHERE branches.isDeleted = 0
-                AND branches.parentNoteId = ?
-          ORDER BY branches.notePosition`, [this.noteId]);
-    }
-
-    /**
-     * @returns {Note[]} parent notes of this note (note can have multiple parents because of cloning)
-     */
-    getParentNotes() {
-        return this.repository.getEntities(`
-          SELECT parent_notes.* 
-          FROM 
-            branches AS child_tree 
-            JOIN notes AS parent_notes ON parent_notes.noteId = child_tree.parentNoteId 
-          WHERE child_tree.noteId = ?
-                AND child_tree.isDeleted = 0
-                AND parent_notes.isDeleted = 0`, [this.noteId]);
-    }
-
-    /**
-     * @return {string[][]} - array of notePaths (each represented by array of noteIds constituting the particular note path)
-     */
-    getAllNotePaths() {
-        if (this.noteId === 'root') {
-            return [['root']];
-        }
-
-        const notePaths = [];
-
-        for (const parentNote of this.getParentNotes()) {
-            for (const parentPath of parentNote.getAllNotePaths()) {
-                parentPath.push(this.noteId);
-                notePaths.push(parentPath);
-            }
-        }
-
-        return notePaths;
-    }
-
-    getRelationDefinitions() {
-        return this.getLabels()
-            .filter(l => l.name.startsWith("relation:"));
-    }
-
-    getLabelDefinitions() {
-        return this.getLabels()
-            .filter(l => l.name.startsWith("relation:"));
-    }
-
-    /**
-     * @param ancestorNoteId
-     * @return {boolean} - true if ancestorNoteId occurs in at least one of the note's paths
-     */
-    isDescendantOfNote(ancestorNoteId) {
-        const notePaths = this.getAllNotePaths();
-
-        return notePaths.some(path => path.includes(ancestorNoteId));
-    }
-
-    beforeSaving() {
-        if (!this.isDeleted) {
-            this.isDeleted = false;
-        }
-
-        if (!this.dateCreated) {
-            this.dateCreated = dateUtils.localNowDateTime();
-        }
-
-        if (!this.utcDateCreated) {
-            this.utcDateCreated = dateUtils.utcNowDateTime();
-        }
-
-        super.beforeSaving();
-
-        this.dateModified = dateUtils.localNowDateTime();
-        this.utcDateModified = dateUtils.utcNowDateTime();
-    }
-
-    // cannot be static!
-    updatePojo(pojo) {
-        if (pojo.isProtected) {
-            if (this.isContentAvailable) {
-                pojo.title = protectedSessionService.encrypt(pojo.title);
-            }
-            else {
-                // updating protected note outside of protected session means we will keep original ciphertexts
-                delete pojo.title;
-            }
-        }
-
-        delete pojo.isContentAvailable;
-        delete pojo.__attributeCache;
-        delete pojo.__ownedAttributeCache;
-        delete pojo.content;
-        /** zero references to contentHash, probably can be removed */
-        delete pojo.contentHash;
-    }
-}
-
-module.exports = Note;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_note_image.js.html b/docs/backend_api/entities_note_image.js.html deleted file mode 100644 index 67990ae63..000000000 --- a/docs/backend_api/entities_note_image.js.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - JSDoc: Source: entities/note_image.js - - - - - - - - - - -
- -

Source: entities/note_image.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const repository = require('../services/repository');
-const dateUtils = require('../services/date_utils');
-
-/**
- * This class represents image's placement in the note(s). One image may be placed into several notes.
- *
- * @param {string} noteImageId
- * @param {string} noteId
- * @param {string} imageId
- * @param {boolean} isDeleted
- * @param {string} dateModified
- * @param {string} dateCreated
- *
- * @extends Entity
- */
-class NoteImage extends Entity {
-    static get entityName() { return "note_images"; }
-    static get primaryKeyName() { return "noteImageId"; }
-    static get hashedProperties() { return ["noteImageId", "noteId", "imageId", "isDeleted", "dateCreated"]; }
-
-    async getNote() {
-        return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
-    }
-
-    async getImage() {
-        return await repository.getEntity("SELECT * FROM images WHERE imageId = ?", [this.imageId]);
-    }
-
-    beforeSaving() {
-        if (!this.isDeleted) {
-            this.isDeleted = false;
-        }
-
-        if (!this.dateCreated) {
-            this.dateCreated = dateUtils.nowDate();
-        }
-
-        super.beforeSaving();
-
-        if (this.isChanged) {
-            this.dateModified = dateUtils.nowDate();
-        }
-    }
-}
-
-module.exports = NoteImage;
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Sun Oct 07 2018 16:26:59 GMT+0200 (CEST) -
- - - - - diff --git a/docs/backend_api/entities_note_revision.js.html b/docs/backend_api/entities_note_revision.js.html deleted file mode 100644 index f42910fcc..000000000 --- a/docs/backend_api/entities_note_revision.js.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - JSDoc: Source: entities/note_revision.js - - - - - - - - - - -
- -

Source: entities/note_revision.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const protectedSessionService = require('../services/protected_session');
-const utils = require('../services/utils');
-const sql = require('../services/sql');
-const dateUtils = require('../services/date_utils');
-const entityChangesService = require('../services/entity_changes.js');
-
-/**
- * NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning.
- *
- * @property {string} noteRevisionId
- * @property {string} noteId
- * @property {string} type
- * @property {string} mime
- * @property {string} title
- * @property {boolean} isProtected
- * @property {string} dateLastEdited
- * @property {string} dateCreated
- * @property {string} utcDateLastEdited
- * @property {string} utcDateCreated
- * @property {string} utcDateModified
- *
- * @extends Entity
- */
-class NoteRevision extends Entity {
-    static get entityName() { return "note_revisions"; }
-    static get primaryKeyName() { return "noteRevisionId"; }
-    static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; }
-
-    constructor(row) {
-        super(row);
-
-        this.isProtected = !!this.isProtected;
-
-        if (this.isProtected) {
-            if (protectedSessionService.isProtectedSessionAvailable()) {
-                this.title = protectedSessionService.decryptString(this.title);
-            }
-            else {
-                this.title = "[Protected]";
-            }
-        }
-    }
-
-    getNote() {
-        return this.repository.getNote(this.noteId);
-    }
-
-    /** @returns {boolean} true if the note has string content (not binary) */
-    isStringNote() {
-        return utils.isStringNote(this.type, this.mime);
-    }
-
-    /*
-     * Note revision content has quite special handling - it's not a separate entity, but a lazily loaded
-     * part of NoteRevision entity with it's own sync. Reason behind this hybrid design is that
-     * 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.
-     *
-     * This is the same approach as is used for Note's content.
-     */
-
-    /** @returns {*} */
-    getContent(silentNotFoundError = false) {
-        if (this.content === undefined) {
-            const res = sql.getRow(`SELECT content FROM note_revision_contents WHERE noteRevisionId = ?`, [this.noteRevisionId]);
-
-            if (!res) {
-                if (silentNotFoundError) {
-                    return undefined;
-                }
-                else {
-                    throw new Error("Cannot find note revision content for noteRevisionId=" + this.noteRevisionId);
-                }
-            }
-
-            this.content = res.content;
-            if (this.isProtected) {
-                if (protectedSessionService.isProtectedSessionAvailable()) {
-                    this.content = protectedSessionService.decrypt(this.content);
-                }
-                else {
-                    this.content = "";
-                }
-            }
-        }
-
-        if (this.isStringNote()) {
-            return this.content === null
-                ? ""
-                : this.content.toString("UTF-8");
-        }
-        else {
-            return this.content;
-        }
-    }
-
-    setContent(content) {
-        this.content = content;
-
-        const pojo = {
-            noteRevisionId: this.noteRevisionId,
-            content: content,
-            utcDateModified: dateUtils.utcNowDateTime()
-        };
-
-        if (this.isProtected) {
-            if (protectedSessionService.isProtectedSessionAvailable()) {
-                pojo.content = protectedSessionService.encrypt(pojo.content);
-            }
-            else {
-                throw new Error(`Cannot update content of noteRevisionId=${this.noteRevisionId} since we're out of protected session.`);
-            }
-        }
-
-        sql.upsert("note_revision_contents", "noteRevisionId", pojo);
-
-        const hash = utils.hash(this.noteRevisionId + "|" + content);
-
-        entityChangesService.addEntityChange({
-            entityName: 'note_revision_contents',
-            entityId: this.noteRevisionId,
-            hash: hash,
-            isErased: false,
-            utcDateChanged: this.getUtcDateChanged()
-        }, null);
-    }
-
-    beforeSaving() {
-        super.beforeSaving();
-
-        this.utcDateModified = dateUtils.utcNowDateTime();
-    }
-
-    // cannot be static!
-    updatePojo(pojo) {
-        if (pojo.isProtected) {
-            if (protectedSessionService.isProtectedSessionAvailable()) {
-                pojo.title = protectedSessionService.encrypt(pojo.title);
-            }
-            else {
-                // updating protected note outside of protected session means we will keep original ciphertexts
-                delete pojo.title;
-            }
-        }
-
-        delete pojo.content;
-    }
-}
-
-module.exports = NoteRevision;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_option.js.html b/docs/backend_api/entities_option.js.html deleted file mode 100644 index 7ee1a2d7f..000000000 --- a/docs/backend_api/entities_option.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - JSDoc: Source: entities/option.js - - - - - - - - - - -
- -

Source: entities/option.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const dateUtils = require('../services/date_utils');
-
-/**
- * Option represents name-value pair, either directly configurable by the user or some system property.
- *
- * @property {string} name
- * @property {string} value
- * @property {boolean} isSynced
- * @property {string} utcDateModified
- * @property {string} utcDateCreated
- *
- * @extends Entity
- */
-class Option extends Entity {
-    static get entityName() { return "options"; }
-    static get primaryKeyName() { return "name"; }
-    static get hashedProperties() { return ["name", "value"]; }
-
-    constructor(row) {
-        super(row);
-
-        this.isSynced = !!this.isSynced;
-    }
-
-    beforeSaving() {
-        if (!this.utcDateCreated) {
-            this.utcDateCreated = dateUtils.utcNowDateTime();
-        }
-
-        super.beforeSaving();
-
-        this.utcDateModified = dateUtils.utcNowDateTime();
-    }
-}
-
-module.exports = Option;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/entities_recent_note.js.html b/docs/backend_api/entities_recent_note.js.html deleted file mode 100644 index 0efca547d..000000000 --- a/docs/backend_api/entities_recent_note.js.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - JSDoc: Source: entities/recent_note.js - - - - - - - - - - -
- -

Source: entities/recent_note.js

- - - - - - -
-
-
"use strict";
-
-const Entity = require('./entity');
-const dateUtils = require('../services/date_utils');
-
-/**
- * RecentNote represents recently visited note.
- *
- * @property {string} noteId
- * @property {string} notePath
- * @property {string} utcDateCreated
- *
- * @extends Entity
- */
-class RecentNote extends Entity {
-    static get entityName() { return "recent_notes"; }
-    static get primaryKeyName() { return "noteId"; }
-
-    beforeSaving() {
-        if (!this.utcDateCreated) {
-            this.utcDateCreated = dateUtils.utcNowDateTime();
-        }
-
-        super.beforeSaving();
-    }
-}
-
-module.exports = RecentNote;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/backend_api/global.html b/docs/backend_api/global.html index 19416cf68..aa443d260 100644 --- a/docs/backend_api/global.html +++ b/docs/backend_api/global.html @@ -1083,7 +1083,7 @@
diff --git a/docs/backend_api/index.html b/docs/backend_api/index.html index db1dc7202..9c94014d0 100644 --- a/docs/backend_api/index.html +++ b/docs/backend_api/index.html @@ -50,7 +50,7 @@
diff --git a/docs/backend_api/module-sql.html b/docs/backend_api/module-sql.html index e4ea35b11..1f457e4ce 100644 --- a/docs/backend_api/module-sql.html +++ b/docs/backend_api/module-sql.html @@ -1252,7 +1252,7 @@
diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.html index 6bdededcb..9c72d1736 100644 --- a/docs/backend_api/services_backend_script_api.js.html +++ b/docs/backend_api/services_backend_script_api.js.html @@ -86,21 +86,21 @@ function BackendScriptApi(currentNote, apiParams) { * @param {string} noteId * @returns {Note|null} */ - this.getNote = becca.getNote; + this.getNote = noteId => becca.getNote(noteId); /** * @method * @param {string} branchId * @returns {Branch|null} */ - this.getBranch = becca.getBranch; + this.getBranch = branchId => becca.getBranch(branchId); /** * @method * @param {string} attributeId * @returns {Attribute|null} */ - this.getAttribute = becca.getAttribute; + this.getAttribute = attributeId => becca.getAttribute(attributeId); /** * This is a powerful search method - you can search by attributes and their values, e.g.: @@ -457,7 +457,7 @@ module.exports = BackendScriptApi;
diff --git a/docs/backend_api/services_sql.js.html b/docs/backend_api/services_sql.js.html index 6f39b4b0e..9576eb954 100644 --- a/docs/backend_api/services_sql.js.html +++ b/docs/backend_api/services_sql.js.html @@ -395,7 +395,7 @@ module.exports = {
diff --git a/docs/backend_api/sql.js.html b/docs/backend_api/sql.js.html deleted file mode 100644 index 6acf22d50..000000000 --- a/docs/backend_api/sql.js.html +++ /dev/null @@ -1,410 +0,0 @@ - - - - - JSDoc: Source: sql.js - - - - - - - - - - -
- -

Source: sql.js

- - - - - - -
-
-
"use strict";
-
-/**
- * @module sql
- */
-
-const log = require('./log');
-const Database = require('better-sqlite3');
-const dataDir = require('./data_dir');
-const cls = require('./cls');
-
-const dbConnection = new Database(dataDir.DOCUMENT_PATH);
-dbConnection.pragma('journal_mode = WAL');
-
-[`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach(eventType => {
-    process.on(eventType, () => {
-        if (dbConnection) {
-            // closing connection is especially important to fold -wal file into the main DB file
-            // (see https://sqlite.org/tempfiles.html for details)
-            dbConnection.close();
-        }
-    });
-});
-
-function insert(tableName, rec, replace = false) {
-    const keys = Object.keys(rec);
-    if (keys.length === 0) {
-        log.error("Can't insert empty object into table " + tableName);
-        return;
-    }
-
-    const columns = keys.join(", ");
-    const questionMarks = keys.map(p => "?").join(", ");
-
-    const query = "INSERT " + (replace ? "OR REPLACE" : "") + " INTO " + tableName + "(" + columns + ") VALUES (" + questionMarks + ")";
-
-    const res = execute(query, Object.values(rec));
-
-    return res ? res.lastInsertRowid : null;
-}
-
-function replace(tableName, rec) {
-    return insert(tableName, rec, true);
-}
-
-function upsert(tableName, primaryKey, rec) {
-    const keys = Object.keys(rec);
-    if (keys.length === 0) {
-        log.error("Can't upsert empty object into table " + tableName);
-        return;
-    }
-
-    const columns = keys.join(", ");
-
-    const questionMarks = keys.map(colName => "@" + colName).join(", ");
-
-    const updateMarks = keys.map(colName => `${colName} = @${colName}`).join(", ");
-
-    const query = `INSERT INTO ${tableName} (${columns}) VALUES (${questionMarks}) 
-                   ON CONFLICT (${primaryKey}) DO UPDATE SET ${updateMarks}`;
-
-    for (const idx in rec) {
-        if (rec[idx] === true || rec[idx] === false) {
-            rec[idx] = rec[idx] ? 1 : 0;
-        }
-    }
-
-    execute(query, rec);
-}
-
-const statementCache = {};
-
-function stmt(sql) {
-    if (!(sql in statementCache)) {
-        statementCache[sql] = dbConnection.prepare(sql);
-    }
-
-    return statementCache[sql];
-}
-
-function getRow(query, params = []) {
-    return wrap(query, s => s.get(params));
-}
-
-function getRowOrNull(query, params = []) {
-    const all = getRows(query, params);
-
-    return all.length > 0 ? all[0] : null;
-}
-
-function getValue(query, params = []) {
-    const row = getRowOrNull(query, params);
-
-    if (!row) {
-        return null;
-    }
-
-    return row[Object.keys(row)[0]];
-}
-
-// smaller values can result in better performance due to better usage of statement cache
-const PARAM_LIMIT = 100;
-
-function getManyRows(query, params) {
-    let results = [];
-
-    while (params.length > 0) {
-        const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT));
-        params = params.slice(curParams.length);
-
-        const curParamsObj = {};
-
-        let j = 1;
-        for (const param of curParams) {
-            curParamsObj['param' + j++] = param;
-        }
-
-        let i = 1;
-        const questionMarks = curParams.map(() => ":param" + i++).join(",");
-        const curQuery = query.replace(/\?\?\?/g, questionMarks);
-
-        const statement = curParams.length === PARAM_LIMIT
-            ? stmt(curQuery)
-            : dbConnection.prepare(curQuery);
-
-        const subResults = statement.all(curParamsObj);
-        results = results.concat(subResults);
-    }
-
-    return results;
-}
-
-function getRows(query, params = []) {
-    return wrap(query, s => s.all(params));
-}
-
-function getRawRows(query, params = []) {
-    return wrap(query, s => s.raw().all(params));
-}
-
-function iterateRows(query, params = []) {
-    return stmt(query).iterate(params);
-}
-
-function getMap(query, params = []) {
-    const map = {};
-    const results = getRows(query, params);
-
-    for (const row of results) {
-        const keys = Object.keys(row);
-
-        map[row[keys[0]]] = row[keys[1]];
-    }
-
-    return map;
-}
-
-function getColumn(query, params = []) {
-    const list = [];
-    const result = getRows(query, params);
-
-    if (result.length === 0) {
-        return list;
-    }
-
-    const key = Object.keys(result[0])[0];
-
-    for (const row of result) {
-        list.push(row[key]);
-    }
-
-    return list;
-}
-
-function execute(query, params = []) {
-    return wrap(query, s => s.run(params));
-}
-
-function executeWithoutTransaction(query, params = []) {
-    dbConnection.run(query, params);
-}
-
-function executeMany(query, params) {
-    while (params.length > 0) {
-        const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT));
-        params = params.slice(curParams.length);
-
-        const curParamsObj = {};
-
-        let j = 1;
-        for (const param of curParams) {
-            curParamsObj['param' + j++] = param;
-        }
-
-        let i = 1;
-        const questionMarks = curParams.map(() => ":param" + i++).join(",");
-        const curQuery = query.replace(/\?\?\?/g, questionMarks);
-
-        dbConnection.prepare(curQuery).run(curParamsObj);
-    }
-}
-
-function executeScript(query) {
-    return dbConnection.exec(query);
-}
-
-function wrap(query, func) {
-    const startTimestamp = Date.now();
-    let result;
-
-    try {
-        result = func(stmt(query));
-    }
-    catch (e) {
-        if (e.message.includes("The database connection is not open")) {
-            // this often happens on killing the app which puts these alerts in front of user
-            // in these cases error should be simply ignored.
-            console.log(e.message);
-
-            return null
-        }
-
-        throw e;
-    }
-
-    const milliseconds = Date.now() - startTimestamp;
-
-    if (milliseconds >= 20) {
-        if (query.includes("WITH RECURSIVE")) {
-            log.info(`Slow recursive query took ${milliseconds}ms.`);
-        }
-        else {
-            log.info(`Slow query took ${milliseconds}ms: ${query.trim().replace(/\s+/g, " ")}`);
-        }
-    }
-
-    return result;
-}
-
-function transactional(func) {
-    try {
-        const ret = dbConnection.transaction(func).deferred();
-
-        if (!dbConnection.inTransaction) { // i.e. transaction was really committed (and not just savepoint released)
-            require('./ws').sendTransactionEntityChangesToAllClients();
-        }
-
-        return ret;
-    }
-    catch (e) {
-        const entityChanges = cls.getAndClearEntityChangeIds();
-
-        if (entityChanges.length > 0) {
-            log.info("Transaction rollback dirtied the becca, forcing reload.");
-
-            require('../becca/becca_loader').load();
-        }
-
-        throw e;
-    }
-}
-
-function fillParamList(paramIds, truncate = true) {
-    if (paramIds.length === 0) {
-        return;
-    }
-
-    if (truncate) {
-        execute("DELETE FROM param_list");
-    }
-
-    paramIds = Array.from(new Set(paramIds));
-
-    if (paramIds.length > 30000) {
-        fillParamList(paramIds.slice(30000), false);
-
-        paramIds = paramIds.slice(0, 30000);
-    }
-
-    // doing it manually to avoid this showing up on the sloq query list
-    const s = stmt(`INSERT INTO param_list VALUES ` + paramIds.map(paramId => `(?)`).join(','), paramIds);
-
-    s.run(paramIds);
-}
-
-module.exports = {
-    dbConnection,
-    insert,
-    replace,
-
-    /**
-     * Get single value from the given query - first column from first returned row.
-     *
-     * @method
-     * @param {string} query - SQL query with ? used as parameter placeholder
-     * @param {object[]} [params] - array of params if needed
-     * @return [object] - single value
-     */
-    getValue,
-
-    /**
-     * Get first returned row.
-     *
-     * @method
-     * @param {string} query - SQL query with ? used as parameter placeholder
-     * @param {object[]} [params] - array of params if needed
-     * @return {object} - map of column name to column value
-     */
-    getRow,
-    getRowOrNull,
-
-    /**
-     * Get all returned rows.
-     *
-     * @method
-     * @param {string} query - SQL query with ? used as parameter placeholder
-     * @param {object[]} [params] - array of params if needed
-     * @return {object[]} - array of all rows, each row is a map of column name to column value
-     */
-    getRows,
-    getRawRows,
-    iterateRows,
-    getManyRows,
-
-    /**
-     * Get a map of first column mapping to second column.
-     *
-     * @method
-     * @param {string} query - SQL query with ? used as parameter placeholder
-     * @param {object[]} [params] - array of params if needed
-     * @return {object} - map of first column to second column
-     */
-    getMap,
-
-    /**
-     * Get a first column in an array.
-     *
-     * @method
-     * @param {string} query - SQL query with ? used as parameter placeholder
-     * @param {object[]} [params] - array of params if needed
-     * @return {object[]} - array of first column of all returned rows
-     */
-    getColumn,
-
-    /**
-     * Execute SQL
-     *
-     * @method
-     * @param {string} query - SQL query with ? used as parameter placeholder
-     * @param {object[]} [params] - array of params if needed
-     */
-    execute,
-    executeWithoutTransaction,
-    executeMany,
-    executeScript,
-    transactional,
-    upsert,
-    fillParamList
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/frontend_api/Attribute.html b/docs/frontend_api/Attribute.html new file mode 100644 index 000000000..d3623966a --- /dev/null +++ b/docs/frontend_api/Attribute.html @@ -0,0 +1,757 @@ + + + + + JSDoc: Class: Attribute + + + + + + + + + + +
+ +

Class: Attribute

+ + + + + + +
+ +
+ +

Attribute()

+ +
Attribute is an abstract concept which has two real uses - label (key - value pair) +and relation (representing named relationship between source and target note)
+ + +
+ +
+
+ + + + +

Constructor

+ + + +

new Attribute()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

attributeId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isInheritable :boolean

+ + + + + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

noteId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

position :int

+ + + + + + +
Type:
+
    +
  • + +int + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

type :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

value :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + + +

getNote() → {NoteShort}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +NoteShort + + +
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/frontend_api/Branch.html b/docs/frontend_api/Branch.html index 67d43ea40..dd5aec666 100644 --- a/docs/frontend_api/Branch.html +++ b/docs/frontend_api/Branch.html @@ -30,7 +30,8 @@

Branch()

-
Represents mapping between note and parent note
+
Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple +parents.
@@ -93,7 +94,7 @@
Source:
@@ -143,244 +144,26 @@ -

branchId

+

branchId :string

+
+ primary key +
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - +
Type:
+
    +
  • -

    fromSearchNote

    - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - -

    isExpanded

    - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - -

    noteId

    - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - -

    notePosition

    - - - +string +
  • +
@@ -433,13 +216,23 @@ -

parentNoteId

+

fromSearchNote :boolean

+
Type:
+
    +
  • + +boolean + + +
  • +
+ @@ -473,7 +266,7 @@
Source:
@@ -491,13 +284,91 @@ -

prefix

+

isExpanded :boolean

+
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

noteId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ @@ -548,6 +419,210 @@ + +

notePosition :int

+ + + + + + +
Type:
+
    +
  • + +int + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

parentNoteId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

prefix :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + @@ -607,7 +682,7 @@
Source:
@@ -709,7 +784,7 @@
Source:
@@ -811,7 +886,7 @@
Source:
@@ -913,7 +988,7 @@
Source:
@@ -981,7 +1056,7 @@
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html index 77182b3f3..bc614f7d5 100644 --- a/docs/frontend_api/FrontendScriptApi.html +++ b/docs/frontend_api/FrontendScriptApi.html @@ -1928,7 +1928,7 @@
Source:
@@ -3147,7 +3147,7 @@ if some action needs to happen on only one specific instance.
Source:
@@ -3635,6 +3635,161 @@ otherwise (by e.g. createNoteLink()) +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<NoteShort> + + +
+
+ + + + + + + + + + + + + +

getWeekNote(date) → {Promise.<NoteShort>}

+ + + + + + +
+ Returns date-note for the first date of the week of the given date. If it doesn't exist, it is automatically created. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
date + + +string + + + + e.g. "2019-04-29"
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
Returns:
@@ -3765,7 +3920,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4651,7 +4806,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -4805,7 +4960,7 @@ otherwise (by e.g. createNoteLink())
Source:
@@ -5746,7 +5901,7 @@ Internally this serializes the anonymous function into string and sends it to ba
Source:
@@ -6263,7 +6418,7 @@ Typical use case is when new note has been created, we should wait until it is s
Source:
@@ -6309,7 +6464,7 @@ Typical use case is when new note has been created, we should wait until it is s
diff --git a/docs/frontend_api/KeyboardAction.html b/docs/frontend_api/KeyboardAction.html deleted file mode 100644 index 1877d3729..000000000 --- a/docs/frontend_api/KeyboardAction.html +++ /dev/null @@ -1,2266 +0,0 @@ - - - - - JSDoc: Class: KeyboardAction - - - - - - - - - - -
- -

Class: KeyboardAction

- - - - - - -
- -
- -

KeyboardAction()

- -
blaa vlaa
- - -
- -
-
- - - - -

Constructor

- - - -

new KeyboardAction()

- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(static) AddLinkToText

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) BackInNoteHistory

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ClipboardCopy

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ClipboardCut

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ClipboardPaste

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) CloneNotesTo

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) CloseTab

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) CollapseTree

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) CreateNoteAfter

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) CreateNoteInto

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) FindInText

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) FocusNote

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ForwardInNoteHistory

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) InsertDateTime

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) JumpToNote

- - - - -
- Open "Jump to note" dialog -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) MarkdownToHTML

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) MoveNotesTo

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) NewTab

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) NextTab

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) OpenDevTools

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) OpenSQLConsole

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) PreviousTab

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Redo

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ReloadApp

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) RunCurrentNote

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) RunSQL

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ScrollToActiveNote

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) SearchNotes

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) SelectAllNotesInParent

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ShowAttributes

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ShowHelp

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ToggleFullscreen

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ToggleZenMode

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Undo

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ZoomIn

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ZoomOut

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/frontend_api/KeyboardActions.html b/docs/frontend_api/KeyboardActions.html deleted file mode 100644 index 0e5a93353..000000000 --- a/docs/frontend_api/KeyboardActions.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - JSDoc: Class: KeyboardActions - - - - - - - - - - -
- -

Class: KeyboardActions

- - - - - - -
- -
- -

KeyboardActions()

- -
blaa vlaa
- - -
- -
-
- - - - -

Constructor

- - - -

new KeyboardActions()

- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

JUMP_TO

- - - - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDescription
- - -string - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/frontend_api/NoteComplement.html b/docs/frontend_api/NoteComplement.html index 7833bdd4a..be954630b 100644 --- a/docs/frontend_api/NoteComplement.html +++ b/docs/frontend_api/NoteComplement.html @@ -143,13 +143,23 @@ -

combinedDateModified

+

combinedDateModified :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -183,7 +193,7 @@
Source:
@@ -201,13 +211,23 @@ -

combinedUtcDateModified

+

combinedUtcDateModified :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -241,7 +261,7 @@
Source:
@@ -259,14 +279,28 @@ -

content

+

content :string

+
+ can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) +
+
Type:
+
    +
  • + +string + + +
  • +
+ + @@ -299,7 +333,7 @@
Source:
@@ -317,13 +351,23 @@ -

contentLength

+

contentLength :int

+
Type:
+
    +
  • + +int + + +
  • +
+ @@ -357,7 +401,7 @@
Source:
@@ -375,13 +419,23 @@ -

dateCreated

+

dateCreated :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -415,7 +469,7 @@
Source:
@@ -433,13 +487,23 @@ -

dateModified

+

dateModified :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -473,7 +537,7 @@
Source:
@@ -491,13 +555,23 @@ -

noteId

+

noteId :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -549,13 +623,23 @@ -

utcDateCreated

+

utcDateCreated :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -589,7 +673,7 @@
Source:
@@ -607,13 +691,23 @@ -

utcDateModified

+

utcDateModified :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -647,7 +741,7 @@
Source:
@@ -681,7 +775,7 @@
diff --git a/docs/frontend_api/NoteFull.html b/docs/frontend_api/NoteFull.html deleted file mode 100644 index 890782f59..000000000 --- a/docs/frontend_api/NoteFull.html +++ /dev/null @@ -1,464 +0,0 @@ - - - - - JSDoc: Class: NoteFull - - - - - - - - - - -
- -

Class: NoteFull

- - - - - - -
- -
- -

NoteFull()

- -
Represents full note, specifically including note's content.
- - -
- -
-
- - - - -

Constructor

- - - -

new NoteFull()

- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

content

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

dateCreated

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

dateModified

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

utcDateCreated

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

utcDateModified

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.html index 4bd75c9e0..be44835e5 100644 --- a/docs/frontend_api/NoteShort.html +++ b/docs/frontend_api/NoteShort.html @@ -421,13 +421,23 @@ This note's representation is used in note tree and is kept in Froca. -

isProtected

+

isProtected :boolean

+
Type:
+
    +
  • + +boolean + + +
  • +
+ @@ -479,14 +489,28 @@ This note's representation is used in note tree and is kept in Froca. -

mime

+

mime :string

+
+ content-type, e.g. "application/json" +
+
Type:
+
    +
  • + +string + + +
  • +
+ + @@ -519,7 +543,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -537,13 +561,23 @@ This note's representation is used in note tree and is kept in Froca. -

noteId

+

noteId :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -799,13 +833,23 @@ This note's representation is used in note tree and is kept in Froca. -

title

+

title :string

+
Type:
+
    +
  • + +string + + +
  • +
+ @@ -857,14 +901,28 @@ This note's representation is used in note tree and is kept in Froca. -

type

+

type :string

+
+ one of 'text', 'code', 'file' or 'render' +
+
Type:
+
    +
  • + +string + + +
  • +
+ + @@ -897,7 +955,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1045,7 +1103,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1245,7 +1303,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1423,7 +1481,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1529,7 +1587,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1631,7 +1689,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1733,7 +1791,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1835,7 +1893,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -1937,7 +1995,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2088,7 +2146,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2255,7 +2313,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2410,7 +2468,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2520,7 +2578,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2694,7 +2752,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -2894,7 +2952,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3072,7 +3130,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3227,7 +3285,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3394,7 +3452,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3549,7 +3607,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3704,7 +3762,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -3871,7 +3929,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4026,7 +4084,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4132,7 +4190,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4234,7 +4292,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4385,7 +4443,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4552,7 +4610,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4707,7 +4765,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -4877,7 +4935,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5028,7 +5086,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5134,7 +5192,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5247,7 +5305,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5353,7 +5411,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5455,7 +5513,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5629,7 +5687,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5735,7 +5793,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -5886,7 +5944,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6064,7 +6122,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6219,7 +6277,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6374,7 +6432,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6529,7 +6587,7 @@ This note's representation is used in note tree and is kept in Froca.
Source:
@@ -6594,11 +6652,6 @@ This note's representation is used in note tree and is kept in Froca. -
- Clear note's attributes cache to force fresh reload for next attribute request. -Cache is note instance scoped. -
- @@ -6628,6 +6681,8 @@ Cache is note instance scoped. +
Deprecated:
  • NOOP
+ @@ -6640,7 +6695,7 @@ Cache is note instance scoped.
Source:
@@ -6724,7 +6779,7 @@ Cache is note instance scoped.
Source:
@@ -6830,7 +6885,7 @@ Cache is note instance scoped.
Source:
@@ -6936,7 +6991,7 @@ Cache is note instance scoped.
Source:
@@ -7000,7 +7055,7 @@ Cache is note instance scoped.
diff --git a/docs/frontend_api/branch.js.html b/docs/frontend_api/branch.js.html deleted file mode 100644 index 0fbbe0806..000000000 --- a/docs/frontend_api/branch.js.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - JSDoc: Source: branch.js - - - - - - - - - - -
- -

Source: branch.js

- - - - - - -
-
-
/** Represents mapping between note and parent note */
-class Branch {
-    constructor(froca, row) {
-        this.froca = froca;
-        /** @param {string} primary key */
-        this.branchId = row.branchId;
-        /** @param {string} */
-        this.noteId = row.noteId;
-        this.note = null;
-        /** @param {string} */
-        this.parentNoteId = row.parentNoteId;
-        /** @param {int} */
-        this.notePosition = row.notePosition;
-        /** @param {string} */
-        this.prefix = row.prefix;
-        /** @param {boolean} */
-        this.isExpanded = row.isExpanded;
-    }
-
-    /** @returns {NoteShort} */
-    async getNote() {
-        return await this.froca.getNote(this.noteId);
-    }
-
-    /** @returns {boolean} true if it's top level, meaning its parent is root note */
-    isTopLevel() {
-        return this.parentNoteId === 'root';
-    }
-
-    get toString() {
-        return `Branch(branchId=${this.branchId})`;
-    }
-}
-
-export default Branch;
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Thu Aug 23 2018 12:50:56 GMT+0200 (CEST) -
- - - - - diff --git a/docs/frontend_api/entities_attribute.js.html b/docs/frontend_api/entities_attribute.js.html index 4c99cf6ae..9f859d8ae 100644 --- a/docs/frontend_api/entities_attribute.js.html +++ b/docs/frontend_api/entities_attribute.js.html @@ -28,6 +28,10 @@
import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js';
 
+/**
+ * Attribute is an abstract concept which has two real uses - label (key - value pair)
+ * and relation (representing named relationship between source and target note)
+ */
 class Attribute {
     constructor(froca, row) {
         this.froca = froca;
@@ -36,19 +40,19 @@ class Attribute {
     }
 
     update(row) {
-        /** @param {string} attributeId */
+        /** @type {string} */
         this.attributeId = row.attributeId;
-        /** @param {string} noteId */
+        /** @type {string} */
         this.noteId = row.noteId;
-        /** @param {string} type */
+        /** @type {string} */
         this.type = row.type;
-        /** @param {string} name */
+        /** @type {string} */
         this.name = row.name;
-        /** @param {string} value */
+        /** @type {string} */
         this.value = row.value;
-        /** @param {int} position */
+        /** @type {int} */
         this.position = row.position;
-        /** @param {boolean} isInheritable */
+        /** @type {boolean} */
         this.isInheritable = !!row.isInheritable;
     }
 
@@ -100,7 +104,7 @@ export default Attribute;
 
 
 
 
 
diff --git a/docs/frontend_api/entities_branch.js.html b/docs/frontend_api/entities_branch.js.html index aa3f353c5..b5a53597d 100644 --- a/docs/frontend_api/entities_branch.js.html +++ b/docs/frontend_api/entities_branch.js.html @@ -26,7 +26,10 @@
-
/** Represents mapping between note and parent note */
+            
/**
+ * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
+ * parents.
+ */
 class Branch {
     constructor(froca, row) {
         this.froca = froca;
@@ -35,19 +38,22 @@ class Branch {
     }
 
     update(row) {
-        /** @param {string} primary key */
+        /**
+         * primary key
+         * @type {string}
+         */
         this.branchId = row.branchId;
-        /** @param {string} */
+        /** @type {string} */
         this.noteId = row.noteId;
-        /** @param {string} */
+        /** @type {string} */
         this.parentNoteId = row.parentNoteId;
-        /** @param {int} */
+        /** @type {int} */
         this.notePosition = row.notePosition;
-        /** @param {string} */
+        /** @type {string} */
         this.prefix = row.prefix;
-        /** @param {boolean} */
+        /** @type {boolean} */
         this.isExpanded = !!row.isExpanded;
-        /** @param {boolean} */
+        /** @type {boolean} */
         this.fromSearchNote = !!row.fromSearchNote;
     }
 
@@ -87,7 +93,7 @@ export default Branch;
 
 
 
 
 
diff --git a/docs/frontend_api/entities_note_complement.js.html b/docs/frontend_api/entities_note_complement.js.html index 838b3f857..1a17e1c48 100644 --- a/docs/frontend_api/entities_note_complement.js.html +++ b/docs/frontend_api/entities_note_complement.js.html @@ -31,35 +31,36 @@ */ class NoteComplement { constructor(row) { - /** @param {string} */ + /** @type {string} */ this.noteId = row.noteId; /** - * @param {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) + * can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) + * @type {string} */ this.content = row.content; - /** @param {int} */ + /** @type {int} */ this.contentLength = row.contentLength; - /** @param {string} */ + /** @type {string} */ this.dateCreated = row.dateCreated; - /** @param {string} */ + /** @type {string} */ this.dateModified = row.dateModified; - /** @param {string} */ + /** @type {string} */ this.utcDateCreated = row.utcDateCreated; - /** @param {string} */ + /** @type {string} */ this.utcDateModified = row.utcDateModified; // "combined" date modified give larger out of note's and note_content's dateModified - /** @param {string} */ + /** @type {string} */ this.combinedDateModified = row.combinedDateModified; - /** @param {string} */ + /** @type {string} */ this.combinedUtcDateModified = row.combinedUtcDateModified; } } @@ -75,7 +76,7 @@ export default NoteComplement;
diff --git a/docs/frontend_api/entities_note_full.js.html b/docs/frontend_api/entities_note_full.js.html deleted file mode 100644 index 64503a4e4..000000000 --- a/docs/frontend_api/entities_note_full.js.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - JSDoc: Source: entities/note_full.js - - - - - - - - - - -
- -

Source: entities/note_full.js

- - - - - - -
-
-
import NoteShort from './note_short.js';
-
-/**
- * Represents full note, specifically including note's content.
- */
-class NoteFull extends NoteShort {
-    constructor(froca, row, noteShort) {
-        super(froca, row, []);
-
-        /** @param {string} */
-        this.content = row.content;
-
-        /** @param {string} */
-        this.dateCreated = row.dateCreated;
-
-        /** @param {string} */
-        this.dateModified = row.dateModified;
-
-        /** @param {string} */
-        this.utcDateCreated = row.utcDateCreated;
-
-        /** @param {string} */
-        this.utcDateModified = row.utcDateModified;
-
-        /* ugly */
-        this.parents = noteShort.parents;
-        this.parentToBranch = noteShort.parentToBranch;
-        this.children = noteShort.children;
-        this.childToBranch = noteShort.childToBranch;
-    }
-}
-
-export default NoteFull;
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.html index 407282a76..5e3f31250 100644 --- a/docs/frontend_api/entities_note_short.js.html +++ b/docs/frontend_api/entities_note_short.js.html @@ -81,15 +81,21 @@ class NoteShort { } update(row) { - /** @param {string} */ + /** @type {string} */ this.noteId = row.noteId; - /** @param {string} */ + /** @type {string} */ this.title = row.title; - /** @param {boolean} */ + /** @type {boolean} */ this.isProtected = !!row.isProtected; - /** @param {string} one of 'text', 'code', 'file' or 'render' */ + /** + * one of 'text', 'code', 'file' or 'render' + * @type {string} + */ this.type = row.type; - /** @param {string} content-type, e.g. "application/json" */ + /** + * content-type, e.g. "application/json" + * @type {string} + */ this.mime = row.mime; } @@ -672,12 +678,9 @@ class NoteShort { } /** - * Clear note's attributes cache to force fresh reload for next attribute request. - * Cache is note instance scoped. + * @deprecated NOOP */ - invalidateAttributeCache() { - this.__attributeCache = null; - } + invalidateAttributeCache() {} /** * Get relations which target this note @@ -709,7 +712,7 @@ class NoteShort { return await this.froca.getNoteComplement(this.noteId); } - get toString() { + toString() { return `Note(noteId=${this.noteId}, title=${this.title})`; } @@ -796,7 +799,7 @@ export default NoteShort;
diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html index f7bdbe3ca..441ecb139 100644 --- a/docs/frontend_api/global.html +++ b/docs/frontend_api/global.html @@ -425,7 +425,7 @@
diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.html index 68f6692d0..3ea1a69d5 100644 --- a/docs/frontend_api/index.html +++ b/docs/frontend_api/index.html @@ -50,7 +50,7 @@
diff --git a/docs/frontend_api/module.exports.html b/docs/frontend_api/module.exports.html deleted file mode 100644 index 4050b4d16..000000000 --- a/docs/frontend_api/module.exports.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - JSDoc: Class: exports - - - - - - - - - - -
- -

Class: exports

- - - - - - -
- -
- -

exports()

- -
blaa vlaa
- - -
- -
-
- - - - -

Constructor

- - - -

new exports()

- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

JUMP_TO

- - - - - - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeDescription
- - -string - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/docs/frontend_api/note_full.js.html b/docs/frontend_api/note_full.js.html deleted file mode 100644 index c930a3e57..000000000 --- a/docs/frontend_api/note_full.js.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - JSDoc: Source: note_full.js - - - - - - - - - - -
- -

Source: note_full.js

- - - - - - -
-
-
import NoteShort from './note_short.js';
-
-/**
- * Represents full note, specifically including note's content.
- */
-class NoteFull extends NoteShort {
-    constructor(froca, row) {
-        super(froca, row);
-
-        /** @param {string} */
-        this.content = row.content;
-
-        if (this.content !== "" && this.isJson()) {
-            try {
-                /** @param {object} */
-                this.jsonContent = JSON.parse(this.content);
-            }
-            catch(e) {}
-        }
-    }
-}
-
-export default NoteFull;
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Thu Aug 23 2018 12:50:56 GMT+0200 (CEST) -
- - - - - diff --git a/docs/frontend_api/note_short.js.html b/docs/frontend_api/note_short.js.html deleted file mode 100644 index 63401a301..000000000 --- a/docs/frontend_api/note_short.js.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - JSDoc: Source: note_short.js - - - - - - - - - - -
- -

Source: note_short.js

- - - - - - -
-
-
/**
- * This note's representation is used in note tree and is kept in Froca.
- * Its notable omission is the note content.
- */
-class NoteShort {
-    constructor(froca, row) {
-        this.froca = froca;
-        /** @param {string} */
-        this.noteId = row.noteId;
-        /** @param {string} */
-        this.title = row.title;
-        /** @param {boolean} */
-        this.isProtected = row.isProtected;
-        /** @param {string} one of 'text', 'code', 'file' or 'render' */
-        this.type = row.type;
-        /** @param {string} content-type, e.g. "application/json" */
-        this.mime = row.mime;
-        /** @param {boolean} */
-        this.archived = row.archived;
-        this.cssClass = row.cssClass;
-    }
-
-    /** @returns {boolean} */
-    isJson() {
-        return this.mime === "application/json";
-    }
-
-    /** @returns {Promise<Array.<Branch>>} */
-    async getBranches() {
-        const branchIds = this.froca.parents[this.noteId].map(
-            parentNoteId => this.froca.getBranchIdByChildParent(this.noteId, parentNoteId));
-
-        return this.froca.getBranches(branchIds);
-    }
-
-    /** @returns {boolean} */
-    hasChildren() {
-        return this.froca.children[this.noteId]
-            && this.froca.children[this.noteId].length > 0;
-    }
-
-    /** @returns {Promise<Array.<Branch>>} */
-    async getChildBranches() {
-        if (!this.froca.children[this.noteId]) {
-            return [];
-        }
-
-        const branchIds = this.froca.children[this.noteId].map(
-            childNoteId => this.froca.getBranchIdByChildParent(childNoteId, this.noteId));
-
-        return await this.froca.getBranches(branchIds);
-    }
-
-    /** @returns {Array.<string>} */
-    getParentNoteIds() {
-        return this.froca.parents[this.noteId] || [];
-    }
-
-    /** @returns {Promise<Array.<NoteShort>>} */
-    async getParentNotes() {
-        return await this.froca.getNotes(this.getParentNoteIds());
-    }
-
-    /** @returns {Array.<string>} */
-    getChildNoteIds() {
-        return this.froca.children[this.noteId] || [];
-    }
-
-    /** @returns {Promise<Array.<NoteShort>>} */
-    async getChildNotes() {
-        return await this.froca.getNotes(this.getChildNoteIds());
-    }
-
-    get toString() {
-        return `Note(noteId=${this.noteId}, title=${this.title})`;
-    }
-
-    get dto() {
-        const dto = Object.assign({}, this);
-        delete dto.froca;
-        delete dto.archived;
-
-        return dto;
-    }
-}
-
-export default NoteShort;
-
-
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.5.5 on Thu Aug 23 2018 12:50:56 GMT+0200 (CEST) -
- - - - - diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index 18b9328b0..36c0f90d8 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -424,6 +424,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain */ this.getDateNote = dateNotesService.getDateNote; + /** + * Returns date-note for the first date of the week of the given date. If it doesn't exist, it is automatically created. + * + * @method + * @param {string} date - e.g. "2019-04-29" + * @return {Promise<NoteShort>} + */ + this.getWeekNote = dateNotesService.getWeekNote; + /** * Returns month-note. If it doesn't exist, it is automatically created. * @@ -503,7 +512,7 @@ export default FrontendScriptApi;
diff --git a/docs/frontend_api/services_keyboard_action.js.html b/docs/frontend_api/services_keyboard_action.js.html deleted file mode 100644 index f477850d8..000000000 --- a/docs/frontend_api/services_keyboard_action.js.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - JSDoc: Source: services/keyboard_action.js - - - - - - - - - - -
- -

Source: services/keyboard_action.js

- - - - - - -
-
-
/**
- * blaa vlaa
- */
-class KeyboardAction {
-    constructor(params) {
-        this.optionName = params.optionName;
-    }
-}
-
-/**
- * Open "Jump to note" dialog
- * @static
- */
-KeyboardAction.JumpToNote = new KeyboardAction({
-	optionName: "JumpToNote",
-	defaultShortcuts: "mod+j",
-	description: 'Open "Jump to note" dialog'
-});
-
-/** @static */
-KeyboardAction.MarkdownToHTML = new KeyboardAction({
-	optionName: "MarkdownToHTML",
-	defaultShortcuts: "mod+return"
-});
-
-/** @static */
-KeyboardAction.NewTab = new KeyboardAction({
-	optionName: "NewTab",
-	defaultShortcuts: "mod+t"
-});
-
-/** @static */
-KeyboardAction.CloseTab = new KeyboardAction({
-	optionName: "CloseTab",
-	defaultShortcuts: "mod+w"
-});
-
-/** @static */
-KeyboardAction.NextTab = new KeyboardAction({
-	optionName: "NextTab",
-	defaultShortcuts: "mod+tab"
-});
-
-/** @static */
-KeyboardAction.PreviousTab = new KeyboardAction({
-	optionName: "PreviousTab",
-	defaultShortcuts: "mod+shift+tab"
-});
-
-/** @static */
-KeyboardAction.CreateNoteAfter = new KeyboardAction({
-	optionName: "CreateNoteAfter",
-	defaultShortcuts: "mod+o"
-});
-
-/** @static */
-KeyboardAction.CreateNoteInto = new KeyboardAction({
-	optionName: "CreateNoteInto",
-	defaultShortcuts: "mod+p"
-});
-
-/** @static */
-KeyboardAction.ScrollToActiveNote = new KeyboardAction({
-	optionName: "ScrollToActiveNote",
-	defaultShortcuts: "mod+."
-});
-
-/** @static */
-KeyboardAction.CollapseTree = new KeyboardAction({
-	optionName: "CollapseTree",
-	defaultShortcuts: "alt+c"
-});
-
-/** @static */
-KeyboardAction.RunSQL = new KeyboardAction({
-	optionName: "RunSQL",
-	defaultShortcuts: "mod+return"
-});
-
-/** @static */
-KeyboardAction.FocusNote = new KeyboardAction({
-	optionName: "FocusNote",
-	defaultShortcuts: "return"
-});
-
-/** @static */
-KeyboardAction.RunCurrentNote = new KeyboardAction({
-	optionName: "RunCurrentNote",
-	defaultShortcuts: "mod+return"
-});
-
-/** @static */
-KeyboardAction.ClipboardCopy = new KeyboardAction({
-	optionName: "ClipboardCopy",
-	defaultShortcuts: "mod+c"
-});
-
-/** @static */
-KeyboardAction.ClipboardPaste = new KeyboardAction({
-	optionName: "ClipboardPaste",
-	defaultShortcuts: "mod+v"
-});
-
-/** @static */
-KeyboardAction.ClipboardCut = new KeyboardAction({
-	optionName: "ClipboardCut",
-	defaultShortcuts: "mod+x"
-});
-
-/** @static */
-KeyboardAction.SelectAllNotesInParent = new KeyboardAction({
-	optionName: "SelectAllNotesInParent",
-	defaultShortcuts: "mod+a"
-});
-
-/** @static */
-KeyboardAction.Undo = new KeyboardAction({
-	optionName: "Undo",
-	defaultShortcuts: "mod+z"
-});
-
-/** @static */
-KeyboardAction.Redo = new KeyboardAction({
-	optionName: "Redo",
-	defaultShortcuts: "mod+y"
-});
-
-/** @static */
-KeyboardAction.AddLinkToText = new KeyboardAction({
-	optionName: "AddLinkToText",
-	defaultShortcuts: "mod+l"
-});
-
-/** @static */
-KeyboardAction.CloneNotesTo = new KeyboardAction({
-	optionName: "CloneNotesTo",
-	defaultShortcuts: "mod+shift+c"
-});
-
-/** @static */
-KeyboardAction.MoveNotesTo = new KeyboardAction({
-	optionName: "MoveNotesTo",
-	defaultShortcuts: "mod+shift+c"
-});
-
-/** @static */
-KeyboardAction.SearchNotes = new KeyboardAction({
-	optionName: "SearchNotes",
-	defaultShortcuts: "mod+s"
-});
-
-/** @static */
-KeyboardAction.ShowAttributes = new KeyboardAction({
-	optionName: "ShowAttributes",
-	defaultShortcuts: "alt+a"
-});
-
-/** @static */
-KeyboardAction.ShowHelp = new KeyboardAction({
-	optionName: "ShowHelp",
-	defaultShortcuts: "f1"
-});
-
-/** @static */
-KeyboardAction.OpenSQLConsole = new KeyboardAction({
-	optionName: "OpenSQLConsole",
-	defaultShortcuts: "alt+o"
-});
-
-/** @static */
-KeyboardAction.BackInNoteHistory = new KeyboardAction({
-	optionName: "BackInNoteHistory",
-	defaultShortcuts: "alt+left"
-});
-
-/** @static */
-KeyboardAction.ForwardInNoteHistory = new KeyboardAction({
-	optionName: "ForwardInNoteHistory",
-	defaultShortcuts: "alt+right"
-});
-
-/** @static */
-KeyboardAction.ToggleZenMode = new KeyboardAction({
-	optionName: "ToggleZenMode",
-	defaultShortcuts: "alt+m"
-});
-
-/** @static */
-KeyboardAction.InsertDateTime = new KeyboardAction({
-	optionName: "InsertDateTime",
-	defaultShortcuts: "alt+t"
-});
-
-/** @static */
-KeyboardAction.ReloadApp = new KeyboardAction({
-    optionName: "ReloadApp",
-    defaultShortcuts: ["f5", "mod+r"]
-});
-
-/** @static */
-KeyboardAction.OpenDevTools = new KeyboardAction({
-	optionName: "OpenDevTools",
-	defaultShortcuts: "mod+shift+i"
-});
-
-/** @static */
-KeyboardAction.FindInText = new KeyboardAction({
-	optionName: "FindInText",
-	defaultShortcuts: "mod+f"
-});
-
-/** @static */
-KeyboardAction.ToggleFullscreen = new KeyboardAction({
-	optionName: "ToggleFullscreen",
-	defaultShortcuts: "f11"
-});
-
-/** @static */
-KeyboardAction.ZoomOut = new KeyboardAction({
-	optionName: "ZoomOut",
-	defaultShortcuts: "mod+-"
-});
-
-/** @static */
-KeyboardAction.ZoomIn = new KeyboardAction({
-	optionName: "ZoomIn",
-	defaultShortcuts: "mod+="
-});
-
-export default KeyboardAction;
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/frontend_api/services_keyboard_actions.js.html b/docs/frontend_api/services_keyboard_actions.js.html deleted file mode 100644 index 6e24019bd..000000000 --- a/docs/frontend_api/services_keyboard_actions.js.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - JSDoc: Source: services/keyboard_action.js - - - - - - - - - - -
- -

Source: services/keyboard_action.js

- - - - - - -
-
-
/**
- * blaa vlaa
- */
-class KeyboardActions {
-    constructor() {
-        /** @property {string} */
-        this.JUMP_TO = "";
-    }
-}
-
-export default KeyboardActions;
-
-
- - - - -
- - - -
- - - - - - - diff --git a/docs/frontend_api/widgets_collapsible_widget.js.html b/docs/frontend_api/widgets_collapsible_widget.js.html index a2bdb927b..905052e62 100644 --- a/docs/frontend_api/widgets_collapsible_widget.js.html +++ b/docs/frontend_api/widgets_collapsible_widget.js.html @@ -75,7 +75,7 @@ export default class CollapsibleWidget extends NoteContextAwareWidget {
diff --git a/package.json b/package.json index 32f1ec9aa..ddbddcaec 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "scripts": { "start-server": "cross-env TRILIUM_ENV=dev node ./src/www", "start-electron": "cross-env TRILIUM_ENV=dev electron --inspect=5858 .", - "build-backend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js", - "build-frontend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js", + "build-backend-docs": "rm -r ./docs/backend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js", + "build-frontend-docs": "rm -r ./docs/frontend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js", "build-docs": "npm run build-backend-docs && npm run build-frontend-docs", "webpack": "npx webpack -c webpack-desktop.config.js && npx webpack -c webpack-mobile.config.js && npx webpack -c webpack-setup.config.js", "test": "jasmine", diff --git a/src/becca/entities/api_token.js b/src/becca/entities/api_token.js index a445fef6e..dcd205591 100644 --- a/src/becca/entities/api_token.js +++ b/src/becca/entities/api_token.js @@ -14,8 +14,11 @@ class ApiToken extends AbstractEntity { constructor(row) { super(); + /** @type {string} */ this.apiTokenId = row.apiTokenId; + /** @type {string} */ this.token = row.token; + /** @type {string} */ this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); } diff --git a/src/becca/entities/attribute.js b/src/becca/entities/attribute.js index c990b44c9..47f0bebb2 100644 --- a/src/becca/entities/attribute.js +++ b/src/becca/entities/attribute.js @@ -6,6 +6,10 @@ const sql = require("../../services/sql.js"); const dateUtils = require("../../services/date_utils.js"); const promotedAttributeDefinitionParser = require("../../services/promoted_attribute_definition_parser"); +/** + * Attribute is an abstract concept which has two real uses - label (key - value pair) + * and relation (representing named relationship between source and target note) + */ class Attribute extends AbstractEntity { static get entityName() { return "attributes"; } static get primaryKeyName() { return "attributeId"; } diff --git a/src/becca/entities/branch.js b/src/becca/entities/branch.js index 83f77b2bc..6b2031ddb 100644 --- a/src/becca/entities/branch.js +++ b/src/becca/entities/branch.js @@ -5,6 +5,10 @@ const AbstractEntity = require("./abstract_entity.js"); const sql = require("../../services/sql.js"); const dateUtils = require("../../services/date_utils.js"); +/** + * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple + * parents. + */ class Branch extends AbstractEntity { static get entityName() { return "branches"; } static get primaryKeyName() { return "branchId"; } diff --git a/src/becca/entities/note.js b/src/becca/entities/note.js index 449951b9f..6566bf831 100644 --- a/src/becca/entities/note.js +++ b/src/becca/entities/note.js @@ -12,6 +12,9 @@ const NoteRevision = require("./note_revision.js"); const LABEL = 'label'; const RELATION = 'relation'; +/** + * Trilium's main entity which can represent text note, image, code note, file attachment etc. + */ class Note extends AbstractEntity { static get entityName() { return "notes"; } static get primaryKeyName() { return "noteId"; } @@ -78,35 +81,47 @@ class Note extends AbstractEntity { } init() { - /** @param {Branch[]} */ + /** @type {Branch[]} */ this.parentBranches = []; - /** @param {Note[]} */ + /** @type {Note[]} */ this.parents = []; - /** @param {Note[]} */ + /** @type {Note[]} */ this.children = []; - /** @param {Attribute[]} */ + /** @type {Attribute[]} */ this.ownedAttributes = []; - /** @param {Attribute[]|null} */ + /** @type {Attribute[]|null} + * @private */ this.__attributeCache = null; - /** @param {Attribute[]|null} */ + /** @type {Attribute[]|null} + * @private*/ this.inheritableAttributeCache = null; - /** @param {Attribute[]} */ + /** @type {Attribute[]} */ this.targetRelations = []; this.becca.addNote(this.noteId, this); - /** @param {Note[]|null} */ + /** @type {Note[]|null} + * @private */ this.ancestorCache = null; // following attributes are filled during searching from database - /** @param {int} size of the content in bytes */ + /** + * size of the content in bytes + * @type {int|null} + */ this.contentSize = null; - /** @param {int} size of the content and note revision contents in bytes */ + /** + * size of the content and note revision contents in bytes + * @type {int|null} + */ this.noteSize = null; - /** @param {int} number of note revisions for this note */ + /** + * number of note revisions for this note + * @type {int|null} + */ this.revisionCount = null; } diff --git a/src/becca/entities/note_revision.js b/src/becca/entities/note_revision.js index 1dd6aceef..59e3855d2 100644 --- a/src/becca/entities/note_revision.js +++ b/src/becca/entities/note_revision.js @@ -9,7 +9,8 @@ const entityChangesService = require('../../services/entity_changes'); const AbstractEntity = require("./abstract_entity.js"); /** - * NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning. + * NoteRevision represents snapshot of note's title and content at some point in the past. + * It's used for seamless note versioning. */ class NoteRevision extends AbstractEntity { static get entityName() { return "note_revisions"; } diff --git a/src/becca/entities/option.js b/src/becca/entities/option.js index 599840975..f38e3f45b 100644 --- a/src/becca/entities/option.js +++ b/src/becca/entities/option.js @@ -14,9 +14,13 @@ class Option extends AbstractEntity { constructor(row) { super(); + /** @type {string} */ this.name = row.name; + /** @type {string} */ this.value = row.value; + /** @type {boolean} */ this.isSynced = !!row.isSynced; + /** @type {string} */ this.utcDateModified = row.utcDateModified; this.becca.options[this.name] = this; diff --git a/src/becca/entities/recent_note.js b/src/becca/entities/recent_note.js index 06776d965..3cb213c04 100644 --- a/src/becca/entities/recent_note.js +++ b/src/becca/entities/recent_note.js @@ -13,8 +13,11 @@ class RecentNote extends AbstractEntity { constructor(row) { super(); + /** @type {string} */ this.noteId = row.noteId; + /** @type {string} */ this.notePath = row.notePath; + /** @type {string} */ this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime(); } diff --git a/src/public/app/entities/attribute.js b/src/public/app/entities/attribute.js index 99c5416eb..80f255d6c 100644 --- a/src/public/app/entities/attribute.js +++ b/src/public/app/entities/attribute.js @@ -1,5 +1,9 @@ import promotedAttributeDefinitionParser from '../services/promoted_attribute_definition_parser.js'; +/** + * Attribute is an abstract concept which has two real uses - label (key - value pair) + * and relation (representing named relationship between source and target note) + */ class Attribute { constructor(froca, row) { this.froca = froca; @@ -8,19 +12,19 @@ class Attribute { } update(row) { - /** @type {string} attributeId */ + /** @type {string} */ this.attributeId = row.attributeId; - /** @type {string} noteId */ + /** @type {string} */ this.noteId = row.noteId; - /** @type {string} type */ + /** @type {string} */ this.type = row.type; - /** @type {string} name */ + /** @type {string} */ this.name = row.name; - /** @type {string} value */ + /** @type {string} */ this.value = row.value; - /** @type {int} position */ + /** @type {int} */ this.position = row.position; - /** @type {boolean} isInheritable */ + /** @type {boolean} */ this.isInheritable = !!row.isInheritable; } diff --git a/src/public/app/entities/branch.js b/src/public/app/entities/branch.js index 14fa4951b..5abbbcc44 100644 --- a/src/public/app/entities/branch.js +++ b/src/public/app/entities/branch.js @@ -1,4 +1,7 @@ -/** Represents mapping between note and parent note */ +/** + * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple + * parents. + */ class Branch { constructor(froca, row) { this.froca = froca; @@ -7,7 +10,10 @@ class Branch { } update(row) { - /** @type {string} primary key */ + /** + * primary key + * @type {string} + */ this.branchId = row.branchId; /** @type {string} */ this.noteId = row.noteId; diff --git a/src/public/app/entities/note_complement.js b/src/public/app/entities/note_complement.js index 639f91655..e2c0e1250 100644 --- a/src/public/app/entities/note_complement.js +++ b/src/public/app/entities/note_complement.js @@ -7,7 +7,8 @@ class NoteComplement { this.noteId = row.noteId; /** - * @type {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) + * can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) + * @type {string} */ this.content = row.content; diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js index 1e3494030..3001486a1 100644 --- a/src/public/app/entities/note_short.js +++ b/src/public/app/entities/note_short.js @@ -59,9 +59,15 @@ class NoteShort { this.title = row.title; /** @type {boolean} */ this.isProtected = !!row.isProtected; - /** @type {string} one of 'text', 'code', 'file' or 'render' */ + /** + * one of 'text', 'code', 'file' or 'render' + * @type {string} + */ this.type = row.type; - /** @type {string} content-type, e.g. "application/json" */ + /** + * content-type, e.g. "application/json" + * @type {string} + */ this.mime = row.mime; }