Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
add api.backupNow() to backend API, closes #4455
zadam88067c071c37
diff --git a/docs/backend_api/BNote.html b/docs/backend_api/BNote.htmlindex 5fe97e3d17..6dabec0572 100644--- a/docs/backend_api/BNote.html+++ b/docs/backend_api/BNote.html@@ -1588,7 +1588,7 @@ See addLabel, addRelation for more specific methods.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1333">line 1333</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1327">line 1327</a></li></ul></dd>@@ -1835,7 +1835,7 @@ See addLabel, addRelation for more specific methods.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1354">line 1354</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1348">line 1348</a></li></ul></dd>@@ -2081,7 +2081,7 @@ returned.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1367">line 1367</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1361">line 1361</a></li></ul></dd>@@ -2316,7 +2316,7 @@ returned.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1452">line 1452</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1446">line 1446</a></li></ul></dd>@@ -2432,7 +2432,7 @@ In the future, this functionality might get more generic and some of the require<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1504">line 1504</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1498">line 1498</a></li></ul></dd>@@ -2653,7 +2653,7 @@ In the future, this functionality might get more generic and some of the require<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1542">line 1542</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1536">line 1536</a></li></ul></dd>@@ -2848,7 +2848,7 @@ In the future, this functionality might get more generic and some of the require<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1174">line 1174</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1168">line 1168</a></li></ul></dd>@@ -4207,7 +4207,7 @@ In the future, this functionality might get more generic and some of the require<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1227">line 1227</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1221">line 1221</a></li></ul></dd>@@ -4386,7 +4386,7 @@ In the future, this functionality might get more generic and some of the require<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1237">line 1237</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1231">line 1231</a></li></ul></dd>@@ -9019,7 +9019,7 @@ This method can be significantly faster than the getAttribute()<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1196">line 1196</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1190">line 1190</a></li></ul></dd>@@ -11329,7 +11329,7 @@ This method can be significantly faster than the getAttribute()<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1268">line 1268</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1262">line 1262</a></li></ul></dd>@@ -11435,7 +11435,7 @@ This method can be significantly faster than the getAttribute()<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1246">line 1246</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1240">line 1240</a></li></ul></dd>@@ -12675,7 +12675,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1312">line 1312</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1306">line 1306</a></li></ul></dd>@@ -12855,7 +12855,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1428">line 1428</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1422">line 1422</a></li></ul></dd>@@ -13035,7 +13035,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1436">line 1436</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1430">line 1430</a></li></ul></dd>@@ -13182,7 +13182,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '- <h4 class="name" id="saveAttachment"><span class="type-signature"></span>saveAttachment<span class="signature">()</span><span class="type-signature"> → {<a href="BAttachment.html">BAttachment</a>}</span></h4>+ <h4 class="name" id="saveAttachment"><span class="type-signature"></span>saveAttachment<span class="signature">(matchBy)</span><span class="type-signature"> → {<a href="BAttachment.html">BAttachment</a>}</span></h4>@@ -13197,6 +13197,64 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '+ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>+++++ <th>Default</th>+++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>matchBy</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>+++++ <td class="default">++ attachmentId++ </td>+++ <td class="description last">choose by which property we detect if to update an existing attachment.+ Supported values are either 'attachmentId' (default) or 'title'</td>+ </tr>+++ </tbody>+</table>++@@ -13230,7 +13288,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1640">line 1640</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1636">line 1636</a></li></ul></dd>@@ -13332,7 +13390,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1596">line 1596</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1590">line 1590</a></li></ul></dd>@@ -13564,7 +13622,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1281">line 1281</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1275">line 1275</a></li></ul></dd>@@ -14023,7 +14081,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1412">line 1412</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1406">line 1406</a></li></ul></dd>@@ -14183,7 +14241,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1420">line 1420</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1414">line 1414</a></li></ul></dd>@@ -14425,7 +14483,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1379">line 1379</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1373">line 1373</a></li></ul></dd>@@ -14636,7 +14694,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1395">line 1395</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1389">line 1389</a></li></ul></dd>@@ -14847,7 +14905,7 @@ This is a low-level method, for notes and branches use `note.deleteNote()` and '<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1404">line 1404</a>+ <a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1398">line 1398</a></li></ul></dd>diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.htmlindex 73fbd12952..401f5a1c61 100644--- a/docs/backend_api/BackendScriptApi.html+++ b/docs/backend_api/BackendScriptApi.html@@ -94,7 +94,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line30">line 30</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line31">line 31</a></li></ul></dd>@@ -240,7 +240,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line594">line 594</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line602">line 602</a></li></ul></dd>@@ -352,7 +352,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line46">line 46</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line47">line 47</a></li></ul></dd>@@ -462,7 +462,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line34">line 34</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line35">line 35</a></li></ul></dd>@@ -572,7 +572,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line48">line 48</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line49">line 49</a></li></ul></dd>@@ -682,7 +682,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line36">line 36</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line37">line 37</a></li></ul></dd>@@ -792,7 +792,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line438">line 438</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line439">line 439</a></li></ul></dd>@@ -902,7 +902,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line32">line 32</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line33">line 33</a></li></ul></dd>@@ -1012,7 +1012,7 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line50">line 50</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line51">line 51</a></li></ul></dd>@@ -1040,6 +1040,161 @@ available in the JS backend notes. You can use e.g. <code>api.log(api.startNote.+ <h4 class="name" id="backupNow"><span class="type-signature"></span>backupNow<span class="signature">(backupName)</span><span class="type-signature"> → {Promise}</span></h4>+++++++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>++++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>backupName</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>++++++ <td class="description last">If the backupName is e.g. "now", then the backup will be written to "backup-now.db" file</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line595">line 595</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++<div class="param-desc">+ - resolves once the backup is finished+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">Promise</span>+++ </dd>+</dl>+++++++++++++<h4 class="name" id="createDataNote"><span class="type-signature"></span>createDataNote<span class="signature">(parentNoteId, title, content)</span><span class="type-signature"> → {Object}</span></h4>@@ -1188,7 +1343,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line199">line 199</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line200">line 200</a></li></ul></dd>@@ -1691,7 +1846,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line222">line 222</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line223">line 223</a></li></ul></dd>@@ -2311,7 +2466,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line242">line 242</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line243">line 243</a></li></ul></dd>@@ -2817,7 +2972,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line465">line 465</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line466">line 466</a></li></ul></dd>@@ -3018,7 +3173,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line182">line 182</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line183">line 183</a></li></ul></dd>@@ -3200,7 +3355,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line159">line 159</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line160">line 160</a></li></ul></dd>@@ -3401,7 +3556,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line149">line 149</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line150">line 150</a></li></ul></dd>@@ -3552,7 +3707,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line426">line 426</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line427">line 427</a></li></ul></dd>@@ -3753,7 +3908,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line531">line 531</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line532">line 532</a></li></ul></dd>@@ -3855,7 +4010,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line444">line 444</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line445">line 445</a></li></ul></dd>@@ -4013,7 +4168,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line79">line 79</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line80">line 80</a></li></ul></dd>@@ -4167,7 +4322,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line72">line 72</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line73">line 73</a></li></ul></dd>@@ -4368,7 +4523,7 @@ JSON MIME type. See also createNewNote() for more options.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line325">line 325</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line326">line 326</a></li></ul></dd>@@ -4478,7 +4633,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line58">line 58</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line59">line 59</a></li></ul></dd>@@ -4679,7 +4834,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line356">line 356</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line357">line 357</a></li></ul></dd>@@ -4833,7 +4988,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line65">line 65</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line66">line 66</a></li></ul></dd>@@ -5034,7 +5189,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line138">line 138</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line139">line 139</a></li></ul></dd>@@ -5235,7 +5390,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line128">line 128</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line129">line 129</a></li></ul></dd>@@ -5341,7 +5496,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line315">line 315</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line316">line 316</a></li></ul></dd>@@ -5511,7 +5666,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line334">line 334</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line335">line 335</a></li></ul></dd>@@ -5814,7 +5969,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line346">line 346</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line347">line 347</a></li></ul></dd>@@ -6015,7 +6170,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line366">line 366</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line367">line 367</a></li></ul></dd>@@ -6168,7 +6323,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line288">line 288</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line289">line 289</a></li></ul></dd>@@ -6323,7 +6478,7 @@ if some action needs to happen on only one specific instance.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line419">line 419</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line420">line 420</a></li></ul></dd>@@ -6508,7 +6663,7 @@ instances execute the given function.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line544">line 544</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line545">line 545</a></li></ul></dd>@@ -6672,7 +6827,7 @@ you need to make some DB changes, you need to surround your call with api.transa<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line587">line 587</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line588">line 588</a></li></ul></dd>@@ -6875,7 +7030,7 @@ you need to make some DB changes, you need to surround your call with api.transa<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line114">line 114</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line115">line 115</a></li></ul></dd>@@ -7077,7 +7232,7 @@ you need to make some DB changes, you need to surround your call with api.transa<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line90">line 90</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line91">line 91</a></li></ul></dd>@@ -7286,7 +7441,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line400">line 400</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line401">line 401</a></li></ul></dd>@@ -7629,7 +7784,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line380">line 380</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line381">line 381</a></li></ul></dd>@@ -7853,7 +8008,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line171">line 171</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line172">line 172</a></li></ul></dd>@@ -8009,7 +8164,7 @@ exists, then we'll use that transaction.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line410">line 410</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line411">line 411</a></li></ul></dd>@@ -8164,7 +8319,7 @@ exists, then we'll use that transaction.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line433">line 433</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line434">line 434</a></li></ul></dd>diff --git a/docs/backend_api/becca_entities_bnote.js.html b/docs/backend_api/becca_entities_bnote.js.htmlindex 8d3cd266b3..318afc1775 100644--- a/docs/backend_api/becca_entities_bnote.js.html+++ b/docs/backend_api/becca_entities_bnote.js.html@@ -1184,14 +1184,8 @@ class BNote extends AbstractBeccaEntity {/** @returns {BAttachment} */getAttachmentByTitle(title) {- return sql.getRows(`- SELECT attachments.*- FROM attachments- WHERE ownerId = ?- AND title = ?- AND isDeleted = 0- ORDER BY position`, [this.noteId, title])- .map(row => new BAttachment(row))[0];+ // cannot use SQL to filter by title since it can be encrypted+ return this.getAttachments().filter(attachment => attachment.title === title)[0];}/**@@ -1663,24 +1657,32 @@ class BNote extends AbstractBeccaEntity {}/**+ * @param {string} matchBy - choose by which property we detect if to update an existing attachment.+ * Supported values are either 'attachmentId' (default) or 'title'* @returns {BAttachment}*/- saveAttachment({attachmentId, role, mime, title, content, position}) {+ saveAttachment({attachmentId, role, mime, title, content, position}, matchBy = 'attachmentId') {+ if (!['attachmentId', 'title'].includes(matchBy)) {+ throw new Error(`Unsupported value '${matchBy}' for matchBy param, has to be either 'attachmentId' or 'title'.`);+ }+let attachment;- if (attachmentId) {+ if (matchBy === 'title') {+ attachment = this.getAttachmentByTitle(title);+ } else if (matchBy === 'attachmentId' && attachmentId) {attachment = this.becca.getAttachmentOrThrow(attachmentId);- } else {- attachment = new BAttachment({- ownerId: this.noteId,- title,- role,- mime,- isProtected: this.isProtected,- position- });}+ attachment = attachment || new BAttachment({+ ownerId: this.noteId,+ title,+ role,+ mime,+ isProtected: this.isProtected,+ position+ });+content = content || "";attachment.setContent(content, {forceSave: true});diff --git a/docs/backend_api/becca_entities_brevision.js.html b/docs/backend_api/becca_entities_brevision.js.htmlindex 009e72a2e4..b493ce8a0a 100644--- a/docs/backend_api/becca_entities_brevision.js.html+++ b/docs/backend_api/becca_entities_brevision.js.html@@ -185,14 +185,8 @@ class BRevision extends AbstractBeccaEntity {/** @returns {BAttachment} */getAttachmentByTitle(title) {- return sql.getRows(`- SELECT attachments.*- FROM attachments- WHERE ownerId = ?- AND title = ?- AND isDeleted = 0- ORDER BY position`, [this.revisionId, title])- .map(row => new BAttachment(row))[0];+ // cannot use SQL to filter by title since it can be encrypted+ return this.getAttachments().filter(attachment => attachment.title === title)[0];}beforeSaving() {diff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.htmlindex 4bc787c464..0f6b3c3ec5 100644--- a/docs/backend_api/services_backend_script_api.js.html+++ b/docs/backend_api/services_backend_script_api.js.html@@ -47,7 +47,8 @@ const SpacedUpdate = require("./spaced_update");const specialNotesService = require("./special_notes");const branchService = require("./branches");const exportService = require("./export/zip");-const syncMutex = require("./sync_mutex.js");+const syncMutex = require("./sync_mutex");+const backupService = require("./backup");/*** <p>This is the main backend API interface for scripts. All the properties and methods are published in the "api" object@@ -614,6 +615,13 @@ function BackendScriptApi(currentNote, apiParams) {*/this.runOutsideOfSync = syncMutex.doExclusively;+ /**+ * @method+ * @param {string} backupName - If the backupName is e.g. "now", then the backup will be written to "backup-now.db" file+ * @returns {Promise} - resolves once the backup is finished+ */+ this.backupNow = backupService.backupNow;+/*** This object contains "at your risk" and "no BC guarantees" objects for advanced use cases.*diff --git a/docs/frontend_api/FAttribute.html b/docs/frontend_api/FAttribute.htmlindex 8956485710..c4f3cc0b9a 100644--- a/docs/frontend_api/FAttribute.html+++ b/docs/frontend_api/FAttribute.html@@ -912,7 +912,7 @@ and relation (representing named relationship between source and target note)</d</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/FBranch.html b/docs/frontend_api/FBranch.htmlindex 3220829d1a..c624710502 100644--- a/docs/frontend_api/FBranch.html+++ b/docs/frontend_api/FBranch.html@@ -1124,7 +1124,7 @@ parents.</div></div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/FNote.html b/docs/frontend_api/FNote.htmlindex 3e2ffb611c..4e9edf3e5f 100644--- a/docs/frontend_api/FNote.html+++ b/docs/frontend_api/FNote.html@@ -6570,7 +6570,7 @@- <h4 class="name" id="getSortedNotePathRecords"><span class="type-signature"></span>getSortedNotePathRecords<span class="signature">(hoistedNoteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, notePath: Array.<string>, isHidden: boolean}>}</span></h4>+ <h4 class="name" id="getSortedNotePathRecords"><span class="type-signature"></span>getSortedNotePathRecords<span class="signature">(hoistedNoteId<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, <a href="global.html#notePath">notePath</a>: Array.<string>, isHidden: boolean}>}</span></h4>@@ -6723,7 +6723,7 @@</dt><dd>-<span class="param-type">Array.<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, notePath: Array.<string>, isHidden: boolean}></span>+<span class="param-type">Array.<{isArchived: boolean, isInHoistedSubTree: boolean, isSearch: boolean, <a href="global.html#notePath">notePath</a>: Array.<string>, isHidden: boolean}></span></dd>@@ -8690,7 +8690,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.htmlindex 3b340b60af..ab2da083f1 100644--- a/docs/frontend_api/FrontendScriptApi.html+++ b/docs/frontend_api/FrontendScriptApi.html@@ -293,7 +293,7 @@ available in the JS frontend notes. You can use e.g. <code>api.showMessage(api.s<td class="type">-<span class="param-type">BasicWidget</span>+<span class="param-type"><a href="BasicWidget.html">BasicWidget</a></span>@@ -8356,7 +8356,7 @@ Typical use case is when a new note has been created, we should wait until it is</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/entities_fattachment.js.html b/docs/frontend_api/entities_fattachment.js.htmlindex c49ab8dd2c..7b320d8954 100644--- a/docs/frontend_api/entities_fattachment.js.html+++ b/docs/frontend_api/entities_fattachment.js.html@@ -80,7 +80,7 @@ export default FAttachment;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/entities_fattribute.js.html b/docs/frontend_api/entities_fattribute.js.htmlindex 7daa67ff2e..7b1bd8625b 100644--- a/docs/frontend_api/entities_fattribute.js.html+++ b/docs/frontend_api/entities_fattribute.js.html@@ -116,7 +116,7 @@ export default FAttribute;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/entities_fblob.js.html b/docs/frontend_api/entities_fblob.js.htmlindex e98ee01c63..70d0dc3122 100644--- a/docs/frontend_api/entities_fblob.js.html+++ b/docs/frontend_api/entities_fblob.js.html@@ -75,7 +75,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/entities_fbranch.js.html b/docs/frontend_api/entities_fbranch.js.htmlindex f2049871d7..44268f7616 100644--- a/docs/frontend_api/entities_fbranch.js.html+++ b/docs/frontend_api/entities_fbranch.js.html@@ -100,7 +100,7 @@ export default FBranch;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/entities_fnote.js.html b/docs/frontend_api/entities_fnote.js.htmlindex d6f68bcca2..4ccd4ac22a 100644--- a/docs/frontend_api/entities_fnote.js.html+++ b/docs/frontend_api/entities_fnote.js.html@@ -1021,7 +1021,7 @@ export default FNote;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.htmlindex 518a2455d2..b474645766 100644--- a/docs/frontend_api/global.html+++ b/docs/frontend_api/global.html@@ -91,11 +91,247 @@++++ <h3 class="subsection-title">Members</h3>++++<h4 class="name" id="hoistedNoteId"><span class="type-signature"></span>hoistedNoteId<span class="type-signature"></span></h4>+++++++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="widgets_note_context_aware_widget.js.html">widgets/note_context_aware_widget.js</a>, <a href="widgets_note_context_aware_widget.js.html#line38">line 38</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="note"><span class="type-signature"></span>note<span class="type-signature"></span></h4>+++++++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="widgets_note_context_aware_widget.js.html">widgets/note_context_aware_widget.js</a>, <a href="widgets_note_context_aware_widget.js.html#line23">line 23</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="noteId"><span class="type-signature"></span>noteId<span class="type-signature"></span></h4>+++++++++++<dl class="details">++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="widgets_note_context_aware_widget.js.html">widgets/note_context_aware_widget.js</a>, <a href="widgets_note_context_aware_widget.js.html#line28">line 28</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="notePath"><span class="type-signature"></span>notePath<span class="type-signature"></span></h4>+++++++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="widgets_note_context_aware_widget.js.html">widgets/note_context_aware_widget.js</a>, <a href="widgets_note_context_aware_widget.js.html#line33">line 33</a>+ </li></ul></dd>++++++++</dl>++++++++++<h3 class="subsection-title">Methods</h3>@@ -322,6 +558,157 @@++++++ <h4 class="name" id="refreshWithNote"><span class="type-signature">(async) </span>refreshWithNote<span class="signature">(note)</span><span class="type-signature"> → {Promise.<void>}</span></h4>+++++++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>++++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>note</code></td>+++ <td class="type">+++<span class="param-type"><a href="FNote.html">FNote</a></span>++++ </td>++++++ <td class="description last"></td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="widgets_note_context_aware_widget.js.html">widgets/note_context_aware_widget.js</a>, <a href="widgets_note_context_aware_widget.js.html#line64">line 64</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">Promise.<void></span>+++ </dd>+</dl>++++++++@@ -337,7 +724,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/index.html b/docs/frontend_api/index.htmlindex 1fc84f3649..1a696bafb4 100644--- a/docs/frontend_api/index.html+++ b/docs/frontend_api/index.html@@ -50,7 +50,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.htmlindex 3c978b25cb..350a4ba2f6 100644--- a/docs/frontend_api/services_frontend_script_api.js.html+++ b/docs/frontend_api/services_frontend_script_api.js.html@@ -601,7 +601,7 @@ export default FrontendScriptApi;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li><li><a href="global.html#hoistedNoteId">hoistedNoteId</a></li><li><a href="global.html#note">note</a></li><li><a href="global.html#noteId">noteId</a></li><li><a href="global.html#notePath">notePath</a></li><li><a href="global.html#refreshWithNote">refreshWithNote</a></li></ul></nav><br class="clear">diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.jsindex 5854e002fd..3a47761a9d 100644--- a/src/services/backend_script_api.js+++ b/src/services/backend_script_api.js@@ -19,7 +19,8 @@ const SpacedUpdate = require("./spaced_update");const specialNotesService = require("./special_notes");const branchService = require("./branches");const exportService = require("./export/zip");-const syncMutex = require("./sync_mutex.js");+const syncMutex = require("./sync_mutex");+const backupService = require("./backup");/*** <p>This is the main backend API interface for scripts. All the properties and methods are published in the "api" object@@ -586,6 +587,13 @@ function BackendScriptApi(currentNote, apiParams) {*/this.runOutsideOfSync = syncMutex.doExclusively;+ /**+ * @method+ * @param {string} backupName - If the backupName is e.g. "now", then the backup will be written to "backup-now.db" file+ * @returns {Promise} - resolves once the backup is finished+ */+ this.backupNow = backupService.backupNow;+/*** This object contains "at your risk" and "no BC guarantees" objects for advanced use cases.*