diff --git a/db/demo.zip b/db/demo.zip
index a2327ff33..e4740b49b 100644
Binary files a/db/demo.zip and b/db/demo.zip differ
diff --git a/docs/backend_api/AbstractEntity.html b/docs/backend_api/AbstractEntity.html
index ab08501ce..b39f717a3 100644
--- a/docs/backend_api/AbstractEntity.html
+++ b/docs/backend_api/AbstractEntity.html
@@ -139,10 +139,576 @@
+
Members
+
+
+
+(protected) becca
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -267,7 +833,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -355,7 +921,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
diff --git a/docs/backend_api/Attribute.html b/docs/backend_api/Attribute.html
index 8633da77b..3b7696898 100644
--- a/docs/backend_api/Attribute.html
+++ b/docs/backend_api/Attribute.html
@@ -223,6 +223,69 @@ and relation (representing named relationship between source and target note)(protected) becca
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isInheritable :boolean
@@ -703,6 +766,362 @@ and relation (representing named relationship between source and target note)Methods
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -757,7 +1176,7 @@ and relation (representing named relationship between source and target note)Source:
@@ -808,6 +1227,95 @@ and relation (representing named relationship between source and target note)(protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -862,7 +1370,7 @@ and relation (representing named relationship between source and target note)Source:
@@ -913,6 +1421,95 @@ and relation (representing named relationship between source and target note)(protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -967,7 +1564,7 @@ and relation (representing named relationship between source and target note)Source:
@@ -1144,7 +1741,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1237,7 +1834,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
diff --git a/docs/backend_api/Branch.html b/docs/backend_api/Branch.html
index f89ff45ad..db8e9e0c6 100644
--- a/docs/backend_api/Branch.html
+++ b/docs/backend_api/Branch.html
@@ -155,6 +155,69 @@ parents.
+(protected) becca
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
branchId :string
@@ -751,6 +814,184 @@ parents.
Methods
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -955,6 +1196,362 @@ parents.
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1084,7 +1681,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1177,7 +1774,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
diff --git a/docs/backend_api/EtapiToken.html b/docs/backend_api/EtapiToken.html
index b675d8cdc..da6e56f2f 100644
--- a/docs/backend_api/EtapiToken.html
+++ b/docs/backend_api/EtapiToken.html
@@ -160,6 +160,69 @@ from tokenHash and token.
+(protected) becca
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
etapiTokenId :string
@@ -572,6 +635,540 @@ from tokenHash and token.
Methods
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -701,7 +1298,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -794,7 +1391,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html
index 2afe54588..b8f53d2d9 100644
--- a/docs/backend_api/Note.html
+++ b/docs/backend_api/Note.html
@@ -93,7 +93,7 @@
Source:
@@ -154,23 +154,13 @@
-children :Array.<Note>
+(protected) becca
- Type:
-
- -
-
-Array.<Note>
-
-
-
-
-
@@ -184,27 +174,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
- -
- becca/entities/note.js, line 94
+
- Overrides:
+
@@ -213,58 +185,6 @@
-
-
-
-
-
-
-
-
-
-contentSize :int|null
-
-
-
-
-
- size of the content in bytes
-
-
-
-
- Type:
-
- -
-
-int
-|
-
-null
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -279,7 +199,7 @@
- Source:
@@ -347,7 +267,7 @@
- Source:
@@ -415,7 +335,7 @@
- Source:
@@ -486,7 +406,7 @@
- Source:
@@ -554,7 +474,7 @@
- Source:
@@ -622,7 +542,7 @@
- Source:
@@ -690,7 +610,7 @@
- Source:
@@ -758,429 +678,7 @@
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-noteSize :int|null
-
-
-
-
-
- size of the content and note revision contents in bytes
-
-
-
-
- Type:
-
- -
-
-int
-|
-
-null
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ownedAttributes :Array.<Attribute>
-
-
-
-
-
-
- Type:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-parentBranches :Array.<Branch>
-
-
-
-
-
-
- Type:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-parents :Array.<Note>
-
-
-
-
-
-
- Type:
-
- -
-
-Array.<Note>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-revisionCount :int|null
-
-
-
-
-
- number of note revisions for this note
-
-
-
-
- Type:
-
- -
-
-int
-|
-
-null
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-targetRelations :Array.<Attribute>
-
-
-
-
-
-
- Type:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Source:
-
@@ -1248,7 +746,7 @@
- Source:
@@ -1316,7 +814,7 @@
- Source:
@@ -1384,7 +882,7 @@
- Source:
@@ -1452,7 +950,7 @@
- Source:
@@ -1480,108 +978,6 @@
- __getInheritableAttributes() → {Array.<Attribute>}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Returns:
-
-
-
-
-
- -
- Type
-
- -
-
-Array.<Attribute>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
addAttribute() → {Attribute}
@@ -1630,7 +1026,7 @@
- Source:
@@ -1678,6 +1074,184 @@
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1830,7 +1404,185 @@
- Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
@@ -1914,7 +1666,7 @@
- Source:
@@ -2020,7 +1772,7 @@
- Source:
@@ -2194,7 +1946,7 @@
- Source:
@@ -2394,7 +2146,7 @@
- Source:
@@ -2572,7 +2324,7 @@
- Source:
@@ -2683,7 +2435,7 @@
- Source:
@@ -2785,7 +2537,7 @@
- Source:
@@ -2887,7 +2639,7 @@
- Source:
@@ -2989,7 +2741,7 @@
- Source:
@@ -3091,7 +2843,7 @@
- Source:
@@ -3199,7 +2951,7 @@
- Source:
@@ -3305,7 +3057,7 @@
- Source:
@@ -3456,7 +3208,7 @@
- Source:
@@ -3626,7 +3378,7 @@
- Source:
@@ -3781,7 +3533,7 @@
- Source:
@@ -3951,7 +3703,7 @@
- Source:
@@ -4057,7 +3809,7 @@
- Source:
@@ -4117,7 +3869,7 @@ This method can be significantly faster than the getAttribute()
- getOwnedAttributes(typeopt, nameopt) → {Array.<Attribute>}
+ getOwnedAttributes(typeopt, nameopt, valueopt) → {Array.<Attribute>}
@@ -4222,6 +3974,39 @@ This method can be significantly faster than the getAttribute()
+
+
+
+ value |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ (optional) attribute value to filter |
+
+
+
@@ -4259,7 +4044,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -4437,7 +4222,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -4595,7 +4380,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -4765,7 +4550,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -4920,7 +4705,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -5090,7 +4875,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -5245,7 +5030,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -5415,7 +5200,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -5570,7 +5355,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -5679,7 +5464,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -5781,7 +5566,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -5829,6 +5614,95 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ (protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -5932,7 +5806,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6102,7 +5976,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6257,7 +6131,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6366,7 +6240,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6475,7 +6349,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6577,7 +6451,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6679,7 +6553,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6781,7 +6655,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6834,6 +6708,95 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ (protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6888,7 +6851,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -6990,7 +6953,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -7044,7 +7007,7 @@ This method can be significantly faster than the getAttribute()
- hasLabel(name) → {boolean}
+ hasLabel(name, valueopt) → {boolean}
@@ -7072,6 +7035,8 @@ This method can be significantly faster than the getAttribute()
Type |
+ Attributes |
+
@@ -7097,6 +7062,14 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ |
+
@@ -7104,6 +7077,39 @@ This method can be significantly faster than the getAttribute()
+
+
+
+ value |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ label value |
+
+
+
@@ -7141,7 +7147,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -7199,7 +7205,7 @@ This method can be significantly faster than the getAttribute()
- hasOwnedAttribute(type, name) → {boolean}
+ hasOwnedAttribute(type, name, valueopt) → {boolean}
@@ -7227,6 +7233,8 @@ This method can be significantly faster than the getAttribute()
Type |
+ Attributes |
+
@@ -7252,6 +7260,14 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ |
+
@@ -7275,6 +7291,14 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ |
+
@@ -7282,6 +7306,39 @@ This method can be significantly faster than the getAttribute()
+
+
+
+ value |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ attribute value |
+
+
+
@@ -7319,7 +7376,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -7377,7 +7434,7 @@ This method can be significantly faster than the getAttribute()
- hasOwnedLabel(name) → {boolean}
+ hasOwnedLabel(name, valueopt) → {boolean}
@@ -7405,6 +7462,8 @@ This method can be significantly faster than the getAttribute()
Type |
+ Attributes |
+
@@ -7430,6 +7489,14 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ |
+
@@ -7437,6 +7504,39 @@ This method can be significantly faster than the getAttribute()
+
+
+
+ value |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ label value |
+
+
+
@@ -7474,7 +7574,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -7532,7 +7632,7 @@ This method can be significantly faster than the getAttribute()
- hasOwnedRelation(name) → {boolean}
+ hasOwnedRelation(name, valueopt) → {boolean}
@@ -7560,6 +7660,8 @@ This method can be significantly faster than the getAttribute()
Type |
+ Attributes |
+
@@ -7585,6 +7687,14 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ |
+
@@ -7592,6 +7702,39 @@ This method can be significantly faster than the getAttribute()
+
+
+
+ value |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ relation value |
+
+
+
@@ -7629,7 +7772,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -7687,7 +7830,7 @@ This method can be significantly faster than the getAttribute()
- hasRelation(name) → {boolean}
+ hasRelation(name, valueopt) → {boolean}
@@ -7715,6 +7858,8 @@ This method can be significantly faster than the getAttribute()
Type |
+ Attributes |
+
@@ -7740,6 +7885,14 @@ This method can be significantly faster than the getAttribute()
+
+
+
+
+
+
+ |
+
@@ -7747,6 +7900,39 @@ This method can be significantly faster than the getAttribute()
+
+
+
+ value |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+ relation value |
+
+
+
@@ -7784,7 +7970,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -7934,7 +8120,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -8040,7 +8226,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -8146,7 +8332,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -8252,7 +8438,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -8358,7 +8544,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -8464,7 +8650,7 @@ This method can be significantly faster than the getAttribute()
- Source:
@@ -8645,7 +8831,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -8856,7 +9042,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -9036,7 +9222,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -9216,7 +9402,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -9309,7 +9495,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -9411,7 +9597,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -9643,7 +9829,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -9823,7 +10009,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -9983,7 +10169,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -10225,7 +10411,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -10436,7 +10622,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -10647,7 +10833,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html
index ad8b80285..ca0fb5b83 100644
--- a/docs/backend_api/NoteRevision.html
+++ b/docs/backend_api/NoteRevision.html
@@ -155,6 +155,69 @@ It's used for seamless note versioning.
+(protected) becca
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
contentLength :number
@@ -975,6 +1038,362 @@ It's used for seamless note versioning.
Methods
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1179,6 +1598,184 @@ It's used for seamless note versioning.
+
+
+
+
+
+
+ (protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1414,7 +2011,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -1507,7 +2104,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.html
index c812d8ea6..bd356c359 100644
--- a/docs/backend_api/Option.html
+++ b/docs/backend_api/Option.html
@@ -154,6 +154,69 @@
+(protected) becca
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isSynced :boolean
@@ -430,6 +493,540 @@
Methods
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -559,7 +1156,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -652,7 +1249,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.html
index 621598ed2..39babc507 100644
--- a/docs/backend_api/RecentNote.html
+++ b/docs/backend_api/RecentNote.html
@@ -154,6 +154,69 @@
+(protected) becca
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
noteId :string
@@ -362,6 +425,540 @@
Methods
+
+
+
+
+
+
+ (protected) addEntityChange()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) beforeSaving()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateHash()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) generateIdIfNecessary()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getPojoToSave()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (protected) getUtcDateChanged()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Overrides:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -491,7 +1088,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
@@ -584,7 +1181,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
- Source:
diff --git a/docs/backend_api/becca_entities_abstract_entity.js.html b/docs/backend_api/becca_entities_abstract_entity.js.html
index a66b5654a..5b8a48e51 100644
--- a/docs/backend_api/becca_entities_abstract_entity.js.html
+++ b/docs/backend_api/becca_entities_abstract_entity.js.html
@@ -42,16 +42,19 @@ let becca = null;
* Base class for all backend entities.
*/
class AbstractEntity {
+ /** @protected */
beforeSaving() {
this.generateIdIfNecessary();
}
+ /** @protected */
generateIdIfNecessary() {
if (!this[this.constructor.primaryKeyName]) {
this[this.constructor.primaryKeyName] = utils.newEntityId();
}
}
+ /** @protected */
generateHash(isDeleted = false) {
let contentToHash = "";
@@ -66,10 +69,12 @@ class AbstractEntity {
return utils.hash(contentToHash).substr(0, 10);
}
+ /** @protected */
getUtcDateChanged() {
return this.utcDateModified || this.utcDateCreated;
}
+ /** @protected */
get becca() {
if (!becca) {
becca = require('../becca');
@@ -78,6 +83,7 @@ class AbstractEntity {
return becca;
}
+ /** @protected */
addEntityChange(isDeleted = false) {
entityChangesService.addEntityChange({
entityName: this.constructor.entityName,
@@ -89,6 +95,7 @@ class AbstractEntity {
});
}
+ /** @protected */
getPojoToSave() {
return this.getPojo();
}
diff --git a/docs/backend_api/becca_entities_attribute.js.html b/docs/backend_api/becca_entities_attribute.js.html
index 10515c065..ac020be8e 100644
--- a/docs/backend_api/becca_entities_attribute.js.html
+++ b/docs/backend_api/becca_entities_attribute.js.html
@@ -90,6 +90,7 @@ class Attribute extends AbstractEntity {
return this;
}
+
init() {
if (this.attributeId) {
this.becca.attributes[this.attributeId] = this;
diff --git a/docs/backend_api/becca_entities_branch.js.html b/docs/backend_api/becca_entities_branch.js.html
index 73fd62a3b..d02cd4fb7 100644
--- a/docs/backend_api/becca_entities_branch.js.html
+++ b/docs/backend_api/becca_entities_branch.js.html
@@ -33,9 +33,9 @@ const AbstractEntity = require("./abstract_entity");
const sql = require("../../services/sql");
const dateUtils = require("../../services/date_utils");
const utils = require("../../services/utils.js");
-const TaskContext = require("../../services/task_context.js");
-const cls = require("../../services/cls.js");
-const log = require("../../services/log.js");
+const TaskContext = require("../../services/task_context");
+const cls = require("../../services/cls");
+const log = require("../../services/log");
/**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
@@ -165,6 +165,18 @@ class Branch extends AbstractEntity {
taskContext.increaseProgressCount();
+ const note = this.getNote();
+
+ if (!taskContext.noteDeletionHandlerTriggered) {
+ const parentBranches = note.getParentBranches();
+
+ if (parentBranches.length === 1 && parentBranches[0] === this) {
+ // needs to be run before branches and attributes are deleted and thus attached relations disappear
+ const handlers = require("../../services/handlers");
+ handlers.runAttachedRelations(note, 'runOnNoteDeletion', note);
+ }
+ }
+
if (this.branchId === 'root'
|| this.noteId === 'root'
|| this.noteId === cls.getHoistedNoteId()) {
@@ -174,7 +186,6 @@ class Branch extends AbstractEntity {
this.markAsDeleted(deleteId);
- const note = this.getNote();
const notDeletedBranches = note.getParentBranches();
if (notDeletedBranches.length === 0) {
diff --git a/docs/backend_api/becca_entities_note.js.html b/docs/backend_api/becca_entities_note.js.html
index 57d0527e7..c73b7e304 100644
--- a/docs/backend_api/becca_entities_note.js.html
+++ b/docs/backend_api/becca_entities_note.js.html
@@ -36,9 +36,10 @@ const dateUtils = require('../../services/date_utils');
const entityChangesService = require('../../services/entity_changes');
const AbstractEntity = require("./abstract_entity");
const NoteRevision = require("./note_revision");
-const TaskContext = require("../../services/task_context.js");
-const optionService = require("../../services/options.js");
-const noteRevisionService = require("../../services/note_revisions.js");
+const TaskContext = require("../../services/task_context");
+const dayjs = require("dayjs");
+const utc = require('dayjs/plugin/utc')
+dayjs.extend(utc)
const LABEL = 'label';
const RELATION = 'relation';
@@ -114,13 +115,17 @@ class Note extends AbstractEntity {
}
init() {
- /** @type {Branch[]} */
+ /** @type {Branch[]}
+ * @private */
this.parentBranches = [];
- /** @type {Note[]} */
+ /** @type {Note[]}
+ * @private */
this.parents = [];
- /** @type {Note[]} */
+ /** @type {Note[]}
+ * @private*/
this.children = [];
- /** @type {Attribute[]} */
+ /** @type {Attribute[]}
+ * @private */
this.ownedAttributes = [];
/** @type {Attribute[]|null}
@@ -130,7 +135,8 @@ class Note extends AbstractEntity {
* @private*/
this.inheritableAttributeCache = null;
- /** @type {Attribute[]} */
+ /** @type {Attribute[]}
+ * @private*/
this.targetRelations = [];
this.becca.addNote(this.noteId, this);
@@ -144,16 +150,19 @@ class Note extends AbstractEntity {
/**
* size of the content in bytes
* @type {int|null}
+ * @private
*/
this.contentSize = null;
/**
* size of the content and note revision contents in bytes
* @type {int|null}
+ * @private
*/
this.noteSize = null;
/**
* number of note revisions for this note
* @type {int|null}
+ * @private
*/
this.revisionCount = null;
}
@@ -255,6 +264,22 @@ class Note extends AbstractEntity {
WHERE noteId = ?`, [this.noteId]);
}
+ get dateCreatedObj() {
+ return this.dateCreated === null ? null : dayjs(this.dateCreated);
+ }
+
+ get utcDateCreatedObj() {
+ return this.utcDateCreated === null ? null : dayjs.utc(this.utcDateCreated);
+ }
+
+ get dateModifiedObj() {
+ return this.dateModified === null ? null : dayjs(this.dateModified);
+ }
+
+ get utcDateModifiedObj() {
+ return this.utcDateModified === null ? null : dayjs.utc(this.utcDateModified);
+ }
+
/** @returns {*} */
getJsonContent() {
const content = this.getContent();
@@ -380,6 +405,7 @@ class Note extends AbstractEntity {
}
}
+ /** @private */
__getAttributes(path) {
if (path.includes(this.noteId)) {
return [];
@@ -402,7 +428,11 @@ class Note extends AbstractEntity {
const templateNote = this.becca.notes[ownedAttr.value];
if (templateNote) {
- templateAttributes.push(...templateNote.__getAttributes(newPath));
+ templateAttributes.push(
+ ...templateNote.__getAttributes(newPath)
+ // template attr is used as a marker for templates, but it's not meant to be inherited
+ .filter(attr => !(attr.type === 'label' && attr.name === 'template'))
+ );
}
}
}
@@ -431,7 +461,10 @@ class Note extends AbstractEntity {
return this.__attributeCache;
}
- /** @returns {Attribute[]} */
+ /**
+ * @private
+ * @returns {Attribute[]}
+ */
__getInheritableAttributes(path) {
if (path.includes(this.noteId)) {
return [];
@@ -444,8 +477,12 @@ class Note extends AbstractEntity {
return this.inheritableAttributeCache;
}
- hasAttribute(type, name) {
- return !!this.getAttributes().find(attr => attr.type === type && attr.name === name);
+ hasAttribute(type, name, value) {
+ return !!this.getAttributes().find(attr =>
+ attr.type === type
+ && attr.name === name
+ && (value === undefined || value === null || attr.value === value)
+ );
}
getAttributeCaseInsensitive(type, name, value) {
@@ -466,27 +503,31 @@ class Note extends AbstractEntity {
/**
* @param {string} name - label name
+ * @param {string} [value] - label value
* @returns {boolean} true if label exists (including inherited)
*/
- hasLabel(name) { return this.hasAttribute(LABEL, name); }
+ hasLabel(name, value) { return this.hasAttribute(LABEL, name, value); }
/**
* @param {string} name - label name
+ * @param {string} [value] - label value
* @returns {boolean} true if label exists (excluding inherited)
*/
- hasOwnedLabel(name) { return this.hasOwnedAttribute(LABEL, name); }
+ hasOwnedLabel(name, value) { return this.hasOwnedAttribute(LABEL, name, value); }
/**
* @param {string} name - relation name
+ * @param {string} [value] - relation value
* @returns {boolean} true if relation exists (including inherited)
*/
- hasRelation(name) { return this.hasAttribute(RELATION, name); }
+ hasRelation(name, value) { return this.hasAttribute(RELATION, name, value); }
/**
* @param {string} name - relation name
+ * @param {string} [value] - relation value
* @returns {boolean} true if relation exists (excluding inherited)
*/
- hasOwnedRelation(name) { return this.hasOwnedAttribute(RELATION, name); }
+ hasOwnedRelation(name, value) { return this.hasOwnedAttribute(RELATION, name, value); }
/**
* @param {string} name - label name
@@ -539,10 +580,11 @@ class Note extends AbstractEntity {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
+ * @param {string} [value] - attribute value
* @returns {boolean} true if note has an attribute with given type and name (excluding inherited)
*/
- hasOwnedAttribute(type, name) {
- return !!this.getOwnedAttribute(type, name);
+ hasOwnedAttribute(type, name, value) {
+ return !!this.getOwnedAttribute(type, name, value);
}
/**
@@ -629,15 +671,19 @@ class Note extends AbstractEntity {
/**
* @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter
+ * @param {string} [value] - (optional) attribute value to filter
* @returns {Attribute[]} note's "owned" attributes - excluding inherited ones
*/
- getOwnedAttributes(type, name) {
+ getOwnedAttributes(type, name, value) {
// it's a common mistake to include # or ~ into attribute name
if (name && ["#", "~"].includes(name[0])) {
name = name.substr(1);
}
- if (type && name) {
+ if (type && name && value !== undefined && value !== null) {
+ return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name && attr.value === value);
+ }
+ else if (type && name) {
return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name);
}
else if (type) {
@@ -656,8 +702,8 @@ class Note extends AbstractEntity {
*
* This method can be significantly faster than the getAttribute()
*/
- getOwnedAttribute(type, name) {
- const attrs = this.getOwnedAttributes(type, name);
+ getOwnedAttribute(type, name, value) {
+ const attrs = this.getOwnedAttributes(type, name, value);
return attrs.length > 0 ? attrs[0] : null;
}
@@ -1163,6 +1209,10 @@ class Note extends AbstractEntity {
* @param {TaskContext} [taskContext]
*/
deleteNote(deleteId, taskContext) {
+ if (this.isDeleted) {
+ return;
+ }
+
if (!deleteId) {
deleteId = utils.randomString(10);
}
@@ -1171,6 +1221,11 @@ class Note extends AbstractEntity {
taskContext = new TaskContext('no-progress-reporting');
}
+ // needs to be run before branches and attributes are deleted and thus attached relations disappear
+ const handlers = require("../../services/handlers");
+ handlers.runAttachedRelations(this, 'runOnNoteDeletion', this);
+ taskContext.noteDeletionHandlerTriggered = true;
+
for (const branch of this.getParentBranches()) {
branch.deleteBranch(deleteId, taskContext);
}
@@ -1212,7 +1267,7 @@ class Note extends AbstractEntity {
title: this.title,
type: this.type,
mime: this.mime,
- isProtected: false, // will be fixed in the protectNoteRevisions() call
+ isProtected: this.isProtected,
utcDateLastEdited: this.utcDateModified > contentMetadata.utcDateModified
? this.utcDateModified
: contentMetadata.utcDateModified,
diff --git a/docs/backend_api/services_sql.js.html b/docs/backend_api/services_sql.js.html
index ccfeaa984..7af2575ee 100644
--- a/docs/backend_api/services_sql.js.html
+++ b/docs/backend_api/services_sql.js.html
@@ -270,9 +270,9 @@ function transactional(func) {
return ret;
}
catch (e) {
- const entityChanges = cls.getAndClearEntityChangeIds();
+ const entityChangeIds = cls.getAndClearEntityChangeIds();
- if (entityChanges.length > 0) {
+ if (entityChangeIds.length > 0) {
log.info("Transaction rollback dirtied the becca, forcing reload.");
require('../becca/becca_loader').load();
diff --git a/docs/frontend_api/Attribute.html b/docs/frontend_api/Attribute.html
index 2dd81757d..27344c376 100644
--- a/docs/frontend_api/Attribute.html
+++ b/docs/frontend_api/Attribute.html
@@ -742,7 +742,7 @@ and relation (representing named relationship between source and target note)
diff --git a/docs/frontend_api/Branch.html b/docs/frontend_api/Branch.html
index 62f0c7722..00f7dbb78 100644
--- a/docs/frontend_api/Branch.html
+++ b/docs/frontend_api/Branch.html
@@ -1056,7 +1056,7 @@ parents.
diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.html
index a6b3044b7..becbb6eae 100644
--- a/docs/frontend_api/FrontendScriptApi.html
+++ b/docs/frontend_api/FrontendScriptApi.html
@@ -8009,7 +8009,7 @@ Typical use case is when new note has been created, we should wait until it is s
diff --git a/docs/frontend_api/NoteComplement.html b/docs/frontend_api/NoteComplement.html
index 53a162fef..d922a07ae 100644
--- a/docs/frontend_api/NoteComplement.html
+++ b/docs/frontend_api/NoteComplement.html
@@ -775,7 +775,7 @@
diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.html
index 9796f8771..1e7dd6ff4 100644
--- a/docs/frontend_api/NoteShort.html
+++ b/docs/frontend_api/NoteShort.html
@@ -167,7 +167,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -267,7 +267,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -335,7 +335,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -403,7 +403,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -471,7 +471,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -543,7 +543,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -611,7 +611,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -679,7 +679,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -747,7 +747,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -815,7 +815,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -883,7 +883,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -955,7 +955,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1103,7 +1103,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1303,7 +1303,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1481,7 +1481,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1589,7 +1589,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1693,7 +1693,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1795,7 +1795,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1897,7 +1897,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -1999,7 +1999,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -2150,7 +2150,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -2317,7 +2317,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -2472,7 +2472,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -2582,7 +2582,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -2756,7 +2756,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -2956,7 +2956,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -3134,7 +3134,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -3289,7 +3289,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -3456,7 +3456,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -3611,7 +3611,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -3766,7 +3766,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -3933,7 +3933,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4088,7 +4088,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4194,7 +4194,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4296,7 +4296,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4398,7 +4398,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4500,7 +4500,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4651,7 +4651,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4818,7 +4818,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -4973,7 +4973,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -5143,7 +5143,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -5294,7 +5294,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -5400,7 +5400,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -5513,7 +5513,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -5619,7 +5619,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -5721,7 +5721,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -5895,7 +5895,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6001,7 +6001,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6152,7 +6152,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6330,7 +6330,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6485,7 +6485,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6640,7 +6640,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6795,7 +6795,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6903,7 +6903,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -6987,7 +6987,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -7093,7 +7093,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -7199,7 +7199,7 @@ This note's representation is used in note tree and is kept in Froca.
- Source:
@@ -7263,7 +7263,7 @@ This note's representation is used in note tree and is kept in Froca.
diff --git a/docs/frontend_api/entities_attribute.js.html b/docs/frontend_api/entities_attribute.js.html
index 387d4eb2e..e43585495 100644
--- a/docs/frontend_api/entities_attribute.js.html
+++ b/docs/frontend_api/entities_attribute.js.html
@@ -104,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 0ef296b32..abf328ead 100644
--- a/docs/frontend_api/entities_branch.js.html
+++ b/docs/frontend_api/entities_branch.js.html
@@ -93,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 eb5f6203a..93cd2ef27 100644
--- a/docs/frontend_api/entities_note_complement.js.html
+++ b/docs/frontend_api/entities_note_complement.js.html
@@ -76,7 +76,7 @@ export default NoteComplement;
diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.html
index 8e27a11a8..323a0ef60 100644
--- a/docs/frontend_api/entities_note_short.js.html
+++ b/docs/frontend_api/entities_note_short.js.html
@@ -45,7 +45,8 @@ const NOTE_TYPE_ICONS = {
"book": "bx bx-book",
"note-map": "bx bx-map-alt",
"mermaid": "bx bx-selection",
- "canvas": "bx bx-pen"
+ "canvas": "bx bx-pen",
+ "web-view": "bx bx-globe-alt"
};
/**
@@ -290,7 +291,11 @@ class NoteShort {
const templateNote = this.froca.notes[templateAttr.value];
if (templateNote && templateNote.noteId !== this.noteId) {
- attrArrs.push(templateNote.__getCachedAttributes(newPath));
+ attrArrs.push(
+ templateNote.__getCachedAttributes(newPath)
+ // template attr is used as a marker for templates, but it's not meant to be inherited
+ .filter(attr => !(attr.type === 'label' && attr.name === 'template'))
+ );
}
}
@@ -663,13 +668,18 @@ class NoteShort {
return [];
}
- return this.getAttributes()
+ const promotedAttrs = this.getAttributes()
.filter(attr => attr.isDefinition())
.filter(attr => {
const def = attr.getDefinition();
return def && def.isPromoted;
});
+
+ // attrs are not resorted if position changes after initial load
+ promotedAttrs.sort((a, b) => a.position < b.position ? -1 : 1);
+
+ return promotedAttrs;
}
hasAncestor(ancestorNoteId, visitedNoteIds = null) {
@@ -843,7 +853,7 @@ export default NoteShort;
diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.html
index 8879721e8..30e91a656 100644
--- a/docs/frontend_api/global.html
+++ b/docs/frontend_api/global.html
@@ -156,7 +156,7 @@
- Source:
@@ -425,7 +425,7 @@
diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.html
index 590530faa..0eb4b2332 100644
--- a/docs/frontend_api/index.html
+++ b/docs/frontend_api/index.html
@@ -50,7 +50,7 @@
diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html
index da00296e1..e27c5db16 100644
--- a/docs/frontend_api/services_frontend_script_api.js.html
+++ b/docs/frontend_api/services_frontend_script_api.js.html
@@ -635,7 +635,7 @@ export default FrontendScriptApi;
diff --git a/docs/frontend_api/widgets_collapsible_widget.js.html b/docs/frontend_api/widgets_collapsible_widget.js.html
index ed31ad9b3..0411406f7 100644
--- a/docs/frontend_api/widgets_collapsible_widget.js.html
+++ b/docs/frontend_api/widgets_collapsible_widget.js.html
@@ -37,6 +37,9 @@ const WIDGET_TPL = `
</div>
</div>`;
+/**
+ * TODO: rename, it's not collapsible anymore
+ */
export default class CollapsibleWidget extends NoteContextAwareWidget {
get widgetTitle() { return "Untitled widget"; }
@@ -60,10 +63,6 @@ export default class CollapsibleWidget extends NoteContextAwareWidget {
/** for overriding */
async doRenderBody() {}
-
- isExpanded() {
- return this.$bodyWrapper.hasClass("show");
- }
}
@@ -75,7 +74,7 @@ export default class CollapsibleWidget extends NoteContextAwareWidget {
diff --git a/src/becca/entities/note.js b/src/becca/entities/note.js
index d562b5e5d..2c6e49df5 100644
--- a/src/becca/entities/note.js
+++ b/src/becca/entities/note.js
@@ -449,8 +449,18 @@ class Note extends AbstractEntity {
return this.inheritableAttributeCache;
}
- hasAttribute(type, name) {
- return !!this.getAttributes().find(attr => attr.type === type && attr.name === name);
+ /**
+ * @param type
+ * @param name
+ * @param [value]
+ * @returns {boolean}
+ */
+ hasAttribute(type, name, value) {
+ return !!this.getAttributes().find(attr =>
+ attr.type === type
+ && attr.name === name
+ && (value === undefined || value === null || attr.value === value)
+ );
}
getAttributeCaseInsensitive(type, name, value) {
@@ -471,27 +481,31 @@ class Note extends AbstractEntity {
/**
* @param {string} name - label name
+ * @param {string} [value] - label value
* @returns {boolean} true if label exists (including inherited)
*/
- hasLabel(name) { return this.hasAttribute(LABEL, name); }
+ hasLabel(name, value) { return this.hasAttribute(LABEL, name, value); }
/**
* @param {string} name - label name
+ * @param {string} [value] - label value
* @returns {boolean} true if label exists (excluding inherited)
*/
- hasOwnedLabel(name) { return this.hasOwnedAttribute(LABEL, name); }
+ hasOwnedLabel(name, value) { return this.hasOwnedAttribute(LABEL, name, value); }
/**
* @param {string} name - relation name
+ * @param {string} [value] - relation value
* @returns {boolean} true if relation exists (including inherited)
*/
- hasRelation(name) { return this.hasAttribute(RELATION, name); }
+ hasRelation(name, value) { return this.hasAttribute(RELATION, name, value); }
/**
* @param {string} name - relation name
+ * @param {string} [value] - relation value
* @returns {boolean} true if relation exists (excluding inherited)
*/
- hasOwnedRelation(name) { return this.hasOwnedAttribute(RELATION, name); }
+ hasOwnedRelation(name, value) { return this.hasOwnedAttribute(RELATION, name, value); }
/**
* @param {string} name - label name
@@ -544,10 +558,11 @@ class Note extends AbstractEntity {
/**
* @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name
+ * @param {string} [value] - attribute value
* @returns {boolean} true if note has an attribute with given type and name (excluding inherited)
*/
- hasOwnedAttribute(type, name) {
- return !!this.getOwnedAttribute(type, name);
+ hasOwnedAttribute(type, name, value) {
+ return !!this.getOwnedAttribute(type, name, value);
}
/**
@@ -634,15 +649,19 @@ class Note extends AbstractEntity {
/**
* @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter
+ * @param {string} [value] - (optional) attribute value to filter
* @returns {Attribute[]} note's "owned" attributes - excluding inherited ones
*/
- getOwnedAttributes(type, name) {
+ getOwnedAttributes(type, name, value) {
// it's a common mistake to include # or ~ into attribute name
if (name && ["#", "~"].includes(name[0])) {
name = name.substr(1);
}
- if (type && name) {
+ if (type && name && value !== undefined && value !== null) {
+ return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name && attr.value === value);
+ }
+ else if (type && name) {
return this.ownedAttributes.filter(attr => attr.type === type && attr.name === name);
}
else if (type) {
@@ -661,8 +680,8 @@ class Note extends AbstractEntity {
*
* This method can be significantly faster than the getAttribute()
*/
- getOwnedAttribute(type, name) {
- const attrs = this.getOwnedAttributes(type, name);
+ getOwnedAttribute(type, name, value) {
+ const attrs = this.getOwnedAttributes(type, name, value);
return attrs.length > 0 ? attrs[0] : null;
}
diff --git a/src/services/notes.js b/src/services/notes.js
index e3b14de22..25239e4a0 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -155,16 +155,19 @@ function createNewNote(params) {
scanForLinks(note);
+ copyChildAttributes(parentNote, note);
+
if (params.templateNoteId) {
if (!becca.getNote(params.templateNoteId)) {
throw new Error(`Template note '${params.templateNoteId}' does not exist.`);
}
- note.addRelation('template', params.templateNoteId);
+ // could be already copied from the parent via `child:`, no need to have 2
+ if (!note.hasOwnedRelation('template', params.templateNoteId)) {
+ note.addRelation('template', params.templateNoteId);
+ }
}
- copyChildAttributes(parentNote, note);
-
triggerNoteTitleChanged(note);
triggerChildNoteCreated(note, parentNote);