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
various javaDoc improvements
zadam79c5645964f1
diff --git a/docs/backend_api/ApiToken.html b/docs/backend_api/ApiToken.htmlindex 2faeafef38..8f00267651 100644--- a/docs/backend_api/ApiToken.html+++ b/docs/backend_api/ApiToken.html@@ -287,7 +287,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/Attribute.html b/docs/backend_api/Attribute.htmlindex 378b1db051..dfdc8ead76 100644--- a/docs/backend_api/Attribute.html+++ b/docs/backend_api/Attribute.html@@ -744,7 +744,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/BackendScriptApi.html b/docs/backend_api/BackendScriptApi.htmlindex 2d62dd2483..09ccf78085 100644--- a/docs/backend_api/BackendScriptApi.html+++ b/docs/backend_api/BackendScriptApi.html@@ -81,7 +81,7 @@<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#line23">line 23</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line24">line 24</a></li></ul></dd>@@ -131,6 +131,116 @@+<h4 class="name" id="axios"><span class="type-signature"></span>axios<span class="type-signature"></span></h4>+++++++++++ <h5 class="subsection-title">Properties:</h5>++++<table class="props">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>++++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>Axios</code></td>+++ <td class="type">+++<span class="param-type">axios</span>++++ </td>++++++ <td class="description last">library for HTTP requests. See https://axios-http.com/ for documentation</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#line37">line 37</a>+ </li></ul></dd>++++++++</dl>++++++++<h4 class="name" id="currentNote"><span class="type-signature"></span>currentNote<span class="type-signature"></span></h4>@@ -168,13 +278,343 @@<tr>- <td class="name"><code>note</code></td>+ <td class="name"><code>note</code></td>+++ <td class="type">+++<span class="param-type"><a href="Note.html">Note</a></span>++++ </td>++++++ <td class="description last">where script is currently executing. Don't mix this up with concept of active note</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#line28">line 28</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="dayjs"><span class="type-signature"></span>dayjs<span class="type-signature"></span></h4>+++++++++++ <h5 class="subsection-title">Properties:</h5>++++<table class="props">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>++++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>day.js</code></td>+++ <td class="type">+++<span class="param-type">dayjs</span>++++ </td>++++++ <td class="description last">library for date manipulation. See https://day.js.org/ for documentation</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#line39">line 39</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="originEntity"><span class="type-signature"></span>originEntity<span class="type-signature"></span></h4>+++++++++++ <h5 class="subsection-title">Properties:</h5>++++<table class="props">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>++++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>entity</code></td>+++ <td class="type">+++<span class="param-type"><a href="Entity.html">Entity</a></span>++++ </td>++++++ <td class="description last">whose event triggered this executions</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#line30">line 30</a>+ </li></ul></dd>++++++++</dl>+++++++++<h4 class="name" id="sql"><span class="type-signature"></span>sql<span class="type-signature"></span></h4>+++++++++++ <h5 class="subsection-title">Properties:</h5>++++<table class="props">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>++++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>sql</code></td><td class="type">-<span class="param-type"><a href="Note.html">Note</a></span>+<span class="param-type"><a href="module-sql.html">module:sql</a></span>@@ -184,7 +624,7 @@- <td class="description last">where script is currently executing. Don't mix this up with concept of active note</td>+ <td class="description last"></td></tr>@@ -223,7 +663,7 @@<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#line27">line 27</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line424">line 424</a></li></ul></dd>@@ -241,7 +681,7 @@-<h4 class="name" id="originEntity"><span class="type-signature"></span>originEntity<span class="type-signature"></span></h4>+<h4 class="name" id="startNote"><span class="type-signature"></span>startNote<span class="type-signature"></span></h4>@@ -278,13 +718,13 @@<tr>- <td class="name"><code>entity</code></td>+ <td class="name"><code>note</code></td><td class="type">-<span class="param-type"><a href="Entity.html">Entity</a></span>+<span class="param-type"><a href="Note.html">Note</a></span>@@ -294,7 +734,7 @@- <td class="description last">whose event triggered this executions</td>+ <td class="description last">where script started executing</td></tr>@@ -333,7 +773,7 @@<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#line29">line 29</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line26">line 26</a></li></ul></dd>@@ -351,7 +791,7 @@-<h4 class="name" id="startNote"><span class="type-signature"></span>startNote<span class="type-signature"></span></h4>+<h4 class="name" id="xml2js"><span class="type-signature"></span>xml2js<span class="type-signature"></span></h4>@@ -388,13 +828,13 @@<tr>- <td class="name"><code>note</code></td>+ <td class="name"><code>xml2js</code></td><td class="type">-<span class="param-type"><a href="Note.html">Note</a></span>+<span class="param-type">axios</span>@@ -404,7 +844,7 @@- <td class="description last">where script started executing</td>+ <td class="description last">library for XML parsing. See https://github.com/Leonidas-from-XIV/node-xml2js for documentation</td></tr>@@ -443,7 +883,7 @@<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#line25">line 25</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line41">line 41</a></li></ul></dd>@@ -619,7 +1059,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#line207">line 207</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line217">line 217</a></li></ul></dd>@@ -647,6 +1087,10 @@ JSON MIME type. See also createNewNote() for more options.<h5>Returns:</h5>+<div class="param-desc">+ object having "note" and "branch" keys representing respective objects+</div>+<dl>@@ -782,7 +1226,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#line234">line 234</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line244">line 244</a></li></ul></dd>@@ -1068,7 +1512,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#line262">line 262</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line272">line 272</a></li></ul></dd>@@ -1273,7 +1717,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#line191">line 191</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line201">line 201</a></li></ul></dd>@@ -1301,6 +1745,10 @@ JSON MIME type. See also createNewNote() for more options.<h5>Returns:</h5>+<div class="param-desc">+ - object having "note" and "branch" keys representing respective objects+</div>+<dl>@@ -1443,6 +1891,207 @@ 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#line172">line 172</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">void</span>+++ </dd>+</dl>++++++++++++++ <h4 class="name" id="ensureNoteIsPresentInParent"><span class="type-signature"></span>ensureNoteIsPresentInParent<span class="signature">(noteId, parentNoteId, prefix)</span><span class="type-signature"> → {void}</span></h4>+++++++<div class="description">+ If there's no branch between note and parent note, create one. Otherwise do nothing.+</div>++++++++++ <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>noteId</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>++++++ <td class="description last"></td>+ </tr>++++ <tr>++ <td class="name"><code>parentNoteId</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>++++++ <td class="description last"></td>+ </tr>++++ <tr>++ <td class="name"><code>prefix</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>++++++ <td class="description last">if branch will be create between note and parent note, set this prefix</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">++++++++++++++++++++@@ -1505,17 +2154,13 @@ JSON MIME type. See also createNewNote() for more options.- <h4 class="name" id="ensureNoteIsPresentInParent"><span class="type-signature"></span>ensureNoteIsPresentInParent<span class="signature">(noteId, parentNoteId, prefix)</span><span class="type-signature"> → {void}</span></h4>+ <h4 class="name" id="escapeHtml"><span class="type-signature"></span>escapeHtml<span class="signature">(string)</span><span class="type-signature"> → {string}</span></h4>-<div class="description">- If there's no branch between note and parent note, create one. Otherwise do nothing.-</div>-@@ -1549,53 +2194,7 @@ JSON MIME type. See also createNewNote() for more options.<tr>- <td class="name"><code>noteId</code></td>--- <td class="type">---<span class="param-type">string</span>---- </td>------ <td class="description last"></td>- </tr>---- <tr>-- <td class="name"><code>parentNoteId</code></td>--- <td class="type">---<span class="param-type">string</span>---- </td>------ <td class="description last"></td>- </tr>---- <tr>-- <td class="name"><code>prefix</code></td>+ <td class="name"><code>string</code></td><td class="type">@@ -1611,7 +2210,7 @@ JSON MIME type. See also createNewNote() for more options.- <td class="description last">if branch will be create between note and parent note, set this prefix</td>+ <td class="description last">to escape</td></tr>@@ -1652,7 +2251,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#line152">line 152</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line412">line 412</a></li></ul></dd>@@ -1680,6 +2279,10 @@ JSON MIME type. See also createNewNote() for more options.<h5>Returns:</h5>+<div class="param-desc">+ escaped string+</div>+<dl>@@ -1688,7 +2291,7 @@ JSON MIME type. See also createNewNote() for more options.</dt><dd>-<span class="param-type">void</span>+<span class="param-type">string</span></dd>@@ -1754,7 +2357,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#line399">line 399</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line435">line 435</a></li></ul></dd>@@ -1912,7 +2515,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#line69">line 69</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line75">line 75</a></li></ul></dd>@@ -2066,7 +2669,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#line62">line 62</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line68">line 68</a></li></ul></dd>@@ -2224,7 +2827,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#line320">line 320</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line330">line 330</a></li></ul></dd>@@ -2401,7 +3004,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#line87">line 87</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line93">line 93</a></li></ul></dd>@@ -2579,7 +3182,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#line85">line 85</a></li></ul></dd>@@ -2689,7 +3292,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#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#line54">line 54</a></li></ul></dd>@@ -2847,7 +3450,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#line347">line 347</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>@@ -3001,7 +3604,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#line55">line 55</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line61">line 61</a></li></ul></dd>@@ -3202,7 +3805,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#line131">line 131</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line141">line 141</a></li></ul></dd>@@ -3400,7 +4003,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#line141">line 141</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line151">line 151</a></li></ul></dd>@@ -3509,7 +4112,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#line311">line 311</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line321">line 321</a></li></ul></dd>@@ -3618,7 +4221,188 @@ 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#line328">line 328</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line338">line 338</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type"><a href="Note.html">Note</a></span>+|++<span class="param-type">null</span>+++ </dd>+</dl>++++++++++++++ <h4 class="name" id="getWeekNote"><span class="type-signature"></span>getWeekNote<span class="signature">(date, options)</span><span class="type-signature"> → {<a href="Note.html">Note</a>|null}</span></h4>+++++++<div class="description">+ Returns note for the first date of the week of the given date.+</div>++++++++++ <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>date</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>++++++ <td class="description last">in YYYY-MM-DD format</td>+ </tr>++++ <tr>++ <td class="name"><code>options</code></td>+++ <td class="type">+++<span class="param-type">object</span>++++ </td>++++++ <td class="description last">"startOfTheWeek" - either "monday" (default) or "sunday"</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#line348">line 348</a></li></ul></dd>@@ -3675,7 +4459,7 @@ if some action needs to happen on only one specific instance.- <h4 class="name" id="getWeekNote"><span class="type-signature"></span>getWeekNote<span class="signature">(date, options)</span><span class="type-signature"> → {<a href="Note.html">Note</a>|null}</span></h4>+ <h4 class="name" id="getYearNote"><span class="type-signature"></span>getYearNote<span class="signature">(year)</span><span class="type-signature"> → {<a href="Note.html">Note</a>|null}</span></h4>@@ -3683,7 +4467,7 @@ if some action needs to happen on only one specific instance.<div class="description">- Returns note for the first date of the week of the given date.+ Returns year note for given year. If such note doesn't exist, it is created.</div>@@ -3719,7 +4503,7 @@ if some action needs to happen on only one specific instance.<tr>- <td class="name"><code>date</code></td>+ <td class="name"><code>year</code></td><td class="type">@@ -3735,30 +4519,7 @@ if some action needs to happen on only one specific instance.- <td class="description last">in YYYY-MM-DD format</td>- </tr>---- <tr>-- <td class="name"><code>options</code></td>--- <td class="type">---<span class="param-type">object</span>---- </td>------ <td class="description last">"startOfTheWeek" - either "monday" (default) or "sunday"</td>+ <td class="description last">in YYYY format</td></tr>@@ -3799,7 +4560,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#line338">line 338</a>+ <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></li></ul></dd>@@ -3856,7 +4617,7 @@ if some action needs to happen on only one specific instance.- <h4 class="name" id="getYearNote"><span class="type-signature"></span>getYearNote<span class="signature">(year)</span><span class="type-signature"> → {<a href="Note.html">Note</a>|null}</span></h4>+ <h4 class="name" id="log"><span class="type-signature"></span>log<span class="signature">(message)</span><span class="type-signature"></span></h4>@@ -3864,7 +4625,7 @@ if some action needs to happen on only one specific instance.<div class="description">- Returns year note for given year. If such note doesn't exist, it is created.+ Log given message to trilium logs.</div>@@ -3900,23 +4661,18 @@ if some action needs to happen on only one specific instance.<tr>- <td class="name"><code>year</code></td>+ <td class="name"><code>message</code></td><td class="type">--<span class="param-type">string</span>---</td>- <td class="description last">in YYYY format</td>+ <td class="description last"></td></tr>@@ -3957,7 +4713,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#line313">line 313</a></li></ul></dd>@@ -3982,27 +4738,6 @@ if some action needs to happen on only one specific instance.-<h5>Returns:</h5>-----<dl>- <dt>- Type- </dt>- <dd>--<span class="param-type"><a href="Note.html">Note</a></span>-|--<span class="param-type">null</span>--- </dd>-</dl>--@@ -4014,7 +4749,7 @@ if some action needs to happen on only one specific instance.- <h4 class="name" id="log"><span class="type-signature"></span>log<span class="signature">(message)</span><span class="type-signature"></span></h4>+ <h4 class="name" id="randomString"><span class="type-signature"></span>randomString<span class="signature">(length)</span><span class="type-signature"> → {string}</span></h4>@@ -4022,7 +4757,7 @@ if some action needs to happen on only one specific instance.<div class="description">- Log given message to trilium logs.+ Return randomly generated string of given length. This random string generation is NOT cryptographically secure.</div>@@ -4058,18 +4793,23 @@ if some action needs to happen on only one specific instance.<tr>- <td class="name"><code>message</code></td>+ <td class="name"><code>length</code></td><td class="type">++<span class="param-type">number</span>+++</td>- <td class="description last"></td>+ <td class="description last">of the string</td></tr>@@ -4110,7 +4850,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#line303">line 303</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line405">line 405</a></li></ul></dd>@@ -4135,6 +4875,28 @@ if some action needs to happen on only one specific instance.+<h5>Returns:</h5>+++<div class="param-desc">+ random string+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">string</span>+++ </dd>+</dl>++@@ -4196,7 +4958,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#line394">line 394</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line430">line 430</a></li></ul></dd>@@ -4334,7 +5096,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#line117">line 117</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line127">line 127</a></li></ul></dd>@@ -4536,7 +5298,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#line98">line 98</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line104">line 104</a></li></ul></dd>@@ -4745,7 +5507,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#line376">line 376</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line386">line 386</a></li></ul></dd>@@ -4781,7 +5543,7 @@ This method looks similar to toggleNoteInParent() but differs because we're look- <h4 class="name" id="sortNotesAlphabetically"><span class="type-signature"></span>sortNotesAlphabetically<span class="signature">(parentNoteId)</span><span class="type-signature"></span></h4>+ <h4 class="name" id="sortNotesByTitle"><span class="type-signature"></span>sortNotesByTitle<span class="signature">(parentNoteId)</span><span class="type-signature"></span></h4>@@ -4878,7 +5640,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#line362">line 362</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line372">line 372</a></li></ul></dd>@@ -5084,7 +5846,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#line174">line 174</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line184">line 184</a></li></ul></dd>@@ -5240,7 +6002,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#line386">line 386</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line396">line 396</a></li></ul></dd>@@ -5293,6 +6055,161 @@ exists, then we'll use that transaction.++++++ <h4 class="name" id="unescapeHtml"><span class="type-signature"></span>unescapeHtml<span class="signature">(string)</span><span class="type-signature"> → {string}</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>string</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>++++++ <td class="description last">to unescape</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#line419">line 419</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++<div class="param-desc">+ unescaped string+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">string</span>+++ </dd>+</dl>++++++++@@ -5308,7 +6225,7 @@ exists, then we'll use that transaction.</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/Branch.html b/docs/backend_api/Branch.htmlindex cb92ae68c5..407a6edef1 100644--- a/docs/backend_api/Branch.html+++ b/docs/backend_api/Branch.html@@ -643,7 +643,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/Entity.html b/docs/backend_api/Entity.htmlindex 10330a6af3..b9dbd11e2d 100644--- a/docs/backend_api/Entity.html+++ b/docs/backend_api/Entity.html@@ -212,7 +212,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.htmlindex ed874bc304..0f075977cb 100644--- a/docs/backend_api/Note.html+++ b/docs/backend_api/Note.html@@ -537,7 +537,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line537">line 537</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line541">line 541</a></li></ul></dd>@@ -639,7 +639,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line861">line 861</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line865">line 865</a></li></ul></dd>@@ -817,7 +817,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line436">line 436</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line440">line 440</a></li></ul></dd>@@ -1017,7 +1017,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line274">line 274</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line279">line 279</a></li></ul></dd>@@ -1195,7 +1195,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line447">line 447</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line451">line 451</a></li></ul></dd>@@ -1304,7 +1304,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line807">line 807</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line811">line 811</a></li></ul></dd>@@ -1406,7 +1406,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line835">line 835</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line839">line 839</a></li></ul></dd>@@ -1512,7 +1512,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line821">line 821</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line825">line 825</a></li></ul></dd>@@ -1618,7 +1618,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line70">line 70</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line75">line 75</a></li></ul></dd>@@ -1720,7 +1720,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line106">line 106</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line111">line 111</a></li></ul></dd>@@ -1822,7 +1822,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line707">line 707</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line711">line 711</a></li></ul></dd>@@ -2055,7 +2055,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line730">line 730</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line734">line 734</a></li></ul></dd>@@ -2253,7 +2253,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line768">line 768</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line772">line 772</a></li></ul></dd>@@ -2451,7 +2451,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line777">line 777</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line781">line 781</a></li></ul></dd>@@ -2553,7 +2553,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line117">line 117</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line122">line 122</a></li></ul></dd>@@ -2704,7 +2704,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line590">line 590</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line594">line 594</a></li></ul></dd>@@ -2874,7 +2874,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line297">line 297</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line302">line 302</a></li></ul></dd>@@ -3029,7 +3029,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line614">line 614</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line618">line 618</a></li></ul></dd>@@ -3144,7 +3144,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line794">line 794</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line798">line 798</a></li></ul></dd>@@ -3246,7 +3246,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line256">line 256</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line261">line 261</a></li></ul></dd>@@ -3453,7 +3453,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line232">line 232</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line237">line 237</a></li></ul></dd>@@ -3631,7 +3631,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line458">line 458</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line462">line 462</a></li></ul></dd>@@ -3789,7 +3789,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line596">line 596</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line600">line 600</a></li></ul></dd>@@ -3959,7 +3959,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line305">line 305</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line310">line 310</a></li></ul></dd>@@ -4114,7 +4114,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line620">line 620</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line624">line 624</a></li></ul></dd>@@ -4272,7 +4272,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line608">line 608</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line612">line 612</a></li></ul></dd>@@ -4442,7 +4442,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line321">line 321</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line326">line 326</a></li></ul></dd>@@ -4597,7 +4597,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line648">line 648</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line652">line 652</a></li></ul></dd>@@ -4755,7 +4755,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line632">line 632</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line636">line 636</a></li></ul></dd>@@ -4864,7 +4864,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line847">line 847</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line851">line 851</a></li></ul></dd>@@ -5019,7 +5019,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line602">line 602</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line606">line 606</a></li></ul></dd>@@ -5189,7 +5189,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line313">line 313</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line318">line 318</a></li></ul></dd>@@ -5344,7 +5344,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line638">line 638</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line642">line 642</a></li></ul></dd>@@ -5514,7 +5514,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line329">line 329</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line334">line 334</a></li></ul></dd>@@ -5665,7 +5665,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line626">line 626</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line630">line 630</a></li></ul></dd>@@ -5778,7 +5778,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line784">line 784</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line788">line 788</a></li></ul></dd>@@ -5880,7 +5880,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line203">line 203</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line208">line 208</a></li></ul></dd>@@ -5986,7 +5986,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line265">line 265</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line270">line 270</a></li></ul></dd>@@ -6164,7 +6164,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line418">line 418</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line422">line 422</a></li></ul></dd>@@ -6270,7 +6270,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line814">line 814</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line818">line 818</a></li></ul></dd>@@ -6425,7 +6425,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line566">line 566</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line570">line 570</a></li></ul></dd>@@ -6603,7 +6603,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line427">line 427</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line431">line 431</a></li></ul></dd>@@ -6758,7 +6758,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line572">line 572</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line576">line 576</a></li></ul></dd>@@ -6913,7 +6913,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line584">line 584</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line588">line 588</a></li></ul></dd>@@ -7068,7 +7068,7 @@ Use when inheritance is not needed and/or in batch/performance sensitive operati<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line578">line 578</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line582">line 582</a></li></ul></dd>@@ -7179,7 +7179,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line344">line 344</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line349">line 349</a></li></ul></dd>@@ -7307,7 +7307,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line892">line 892</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line896">line 896</a></li></ul></dd>@@ -7413,7 +7413,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line193">line 193</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line198">line 198</a></li></ul></dd>@@ -7519,7 +7519,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line185">line 185</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line190">line 190</a></li></ul></dd>@@ -7625,7 +7625,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line180">line 180</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line185">line 185</a></li></ul></dd>@@ -7731,7 +7731,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line175">line 175</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line180">line 180</a></li></ul></dd>@@ -7837,7 +7837,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line198">line 198</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line203">line 203</a></li></ul></dd>@@ -8070,7 +8070,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line521">line 521</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line525">line 525</a></li></ul></dd>@@ -8250,7 +8250,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line694">line 694</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line698">line 698</a></li></ul></dd>@@ -8430,7 +8430,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line702">line 702</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line706">line 706</a></li></ul></dd>@@ -8641,7 +8641,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line488">line 488</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line492">line 492</a></li></ul></dd>@@ -8821,7 +8821,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line678">line 678</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line682">line 682</a></li></ul></dd>@@ -8857,7 +8857,7 @@ Cache is note instance scoped.- <h4 class="name" id="setRelation"><span class="type-signature"></span>setRelation<span class="signature">(name, value<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>+ <h4 class="name" id="setRelation"><span class="type-signature"></span>setRelation<span class="signature">(name, value)</span><span class="type-signature"></span></h4>@@ -8889,8 +8889,6 @@ Cache is note instance scoped.<th>Type</th>- <th>Attributes</th>-@@ -8916,14 +8914,6 @@ Cache is note instance scoped.</td>- <td class="attributes">------ </td>-@@ -8947,16 +8937,6 @@ Cache is note instance scoped.</td>- <td class="attributes">-- <optional><br>------ </td>-@@ -9001,7 +8981,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line686">line 686</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line690">line 690</a></li></ul></dd>@@ -9243,7 +9223,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line472">line 472</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line476">line 476</a></li></ul></dd>@@ -9454,7 +9434,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line661">line 661</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line665">line 665</a></li></ul></dd>@@ -9665,7 +9645,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line670">line 670</a>+ <a href="entities_note.js.html">entities/note.js</a>, <a href="entities_note.js.html#line674">line 674</a></li></ul></dd>@@ -9711,7 +9691,7 @@ Cache is note instance scoped.</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.htmlindex fdaa8cb45e..12ab87c6e7 100644--- a/docs/backend_api/NoteRevision.html+++ b/docs/backend_api/NoteRevision.html@@ -660,7 +660,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.htmlindex b65e9eb5e1..2ecb347511 100644--- a/docs/backend_api/Option.html+++ b/docs/backend_api/Option.html@@ -310,7 +310,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.htmlindex e3bea97537..6831a401dd 100644--- a/docs/backend_api/RecentNote.html+++ b/docs/backend_api/RecentNote.html@@ -264,7 +264,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_api_token.js.html b/docs/backend_api/entities_api_token.js.htmlindex 0d4db291c2..01d3dd10ac 100644--- a/docs/backend_api/entities_api_token.js.html+++ b/docs/backend_api/entities_api_token.js.html@@ -69,7 +69,7 @@ module.exports = ApiToken;</code></pre></div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_attribute.js.html b/docs/backend_api/entities_attribute.js.htmlindex 0e833e2832..4485a8aa56 100644--- a/docs/backend_api/entities_attribute.js.html+++ b/docs/backend_api/entities_attribute.js.html@@ -160,7 +160,7 @@ module.exports = Attribute;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_branch.js.html b/docs/backend_api/entities_branch.js.htmlindex c71894b9d4..6c28da4f8e 100644--- a/docs/backend_api/entities_branch.js.html+++ b/docs/backend_api/entities_branch.js.html@@ -113,7 +113,7 @@ module.exports = Branch;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_entity.js.html b/docs/backend_api/entities_entity.js.htmlindex 78a82ea00d..c6a8b1dcb1 100644--- a/docs/backend_api/entities_entity.js.html+++ b/docs/backend_api/entities_entity.js.html@@ -69,7 +69,7 @@ class Entity {}getUtcDateChanged() {- return this.utcDateModified;+ return this.utcDateModified || this.utcDateCreated;}get repository() {@@ -98,7 +98,7 @@ module.exports = Entity;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.htmlindex 778234c83f..ab5ec04433 100644--- a/docs/backend_api/entities_note.js.html+++ b/docs/backend_api/entities_note.js.html@@ -77,7 +77,12 @@ class Note extends Entity {this.isContentAvailable = protectedSessionService.isProtectedSessionAvailable();if (this.isContentAvailable) {- this.title = protectedSessionService.decryptString(this.title);+ try {+ this.title = protectedSessionService.decryptString(this.title);+ }+ catch (e) {+ throw new Error(`Could not decrypt title of note ${this.noteId}: ${e.message} ${e.stack}`)+ }}else {this.title = "[protected]";@@ -184,14 +189,14 @@ class Note extends Entity {sql.upsert("note_contents", "noteId", pojo);- const hash = utils.hash(this.noteId + "|" + content.toString());+ const hash = utils.hash(this.noteId + "|" + pojo.content.toString());entityChangesService.addEntityChange({entityName: 'note_contents',entityId: this.noteId,hash: hash,isErased: false,- utcDateChanged: this.getUtcDateChanged()+ utcDateChanged: pojo.utcDateModified}, null);}@@ -393,7 +398,6 @@ class Note extends Entity {WHERE attributes.isDeleted = 0AND attributes.type = 'relation'AND attributes.name = 'template'- AND (treeWithAttrs.level = 0 OR attributes.isInheritable = 1))SELECT attributes.* FROM attributes JOIN treeWithAttrs ON attributes.noteId = treeWithAttrs.noteIdWHERE attributes.isDeleted = 0 AND (attributes.isInheritable = 1 OR treeWithAttrs.level = 0)@@ -709,7 +713,7 @@ class Note extends Entity {* Update's given relation's value or creates it if it doesn't exist** @param {string} name - relation name- * @param {string} [value] - relation value (noteId)+ * @param {string} value - relation value (noteId)*/setRelation(name, value) { return this.setAttribute(RELATION, name, value); }@@ -974,7 +978,7 @@ module.exports = Note;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_note_revision.js.html b/docs/backend_api/entities_note_revision.js.htmlindex 371bc3c061..f42910fcc4 100644--- a/docs/backend_api/entities_note_revision.js.html+++ b/docs/backend_api/entities_note_revision.js.html@@ -189,7 +189,7 @@ module.exports = NoteRevision;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_option.js.html b/docs/backend_api/entities_option.js.htmlindex c1bbab9ff5..7ee1a2d7f5 100644--- a/docs/backend_api/entities_option.js.html+++ b/docs/backend_api/entities_option.js.html@@ -75,7 +75,7 @@ module.exports = Option;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/entities_recent_note.js.html b/docs/backend_api/entities_recent_note.js.htmlindex 7af54b3ae5..0efca547db 100644--- a/docs/backend_api/entities_recent_note.js.html+++ b/docs/backend_api/entities_recent_note.js.html@@ -64,7 +64,7 @@ module.exports = RecentNote;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/global.html b/docs/backend_api/global.htmlindex bfb7edec31..7bf9e2d7ad 100644--- a/docs/backend_api/global.html+++ b/docs/backend_api/global.html@@ -391,7 +391,7 @@<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#line215">line 215</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line225">line 225</a></li></ul></dd>@@ -579,7 +579,7 @@<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#line176">line 176</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line186">line 186</a></li></ul></dd>@@ -767,7 +767,7 @@<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#line236">line 236</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line246">line 246</a></li></ul></dd>@@ -1053,7 +1053,7 @@<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#line243">line 243</a>+ <a href="services_backend_script_api.js.html">services/backend_script_api.js</a>, <a href="services_backend_script_api.js.html#line253">line 253</a></li></ul></dd>@@ -1083,7 +1083,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/index.html b/docs/backend_api/index.htmlindex 4051b8b8fc..16d0a14a74 100644--- a/docs/backend_api/index.html+++ b/docs/backend_api/index.html@@ -50,7 +50,7 @@</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/module-sql.html b/docs/backend_api/module-sql.htmlnew file mode 100644index 0000000000..290599ca1d--- /dev/null+++ b/docs/backend_api/module-sql.html@@ -0,0 +1,1267 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="utf-8">+ <title>JSDoc: Module: sql</title>++ <script src="scripts/prettify/prettify.js"> </script>+ <script src="scripts/prettify/lang-css.js"> </script>+ <!--[if lt IE 9]>+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>+ <![endif]-->+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">+</head>++<body>++<div id="main">++ <h1 class="page-title">Module: sql</h1>+++++++<section>++<header>++++</header>++<article>+ <div class="container-overview">++++++ </div>+++++++++++++++++ <h3 class="subsection-title">Methods</h3>++++++++ <h4 class="name" id=".execute"><span class="type-signature">(static) </span>execute<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>+++++++<div class="description">+ Execute SQL+</div>++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>+++ <th>Attributes</th>+++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>query</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>+++ <td class="attributes">++++++ </td>+++++ <td class="description last">SQL query with ? used as parameter placeholder</td>+ </tr>++++ <tr>++ <td class="name"><code>params</code></td>+++ <td class="type">+++<span class="param-type">Array.<object></span>++++ </td>+++ <td class="attributes">++ <optional><br>++++++ </td>+++++ <td class="description last">array of params if needed</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line341">line 341</a>+ </li></ul></dd>++++++++</dl>+++++++++++++++++++++++++++ <h4 class="name" id=".getColumn"><span class="type-signature">(static) </span>getColumn<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<object>}</span></h4>+++++++<div class="description">+ Get a first column in an array.+</div>++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>+++ <th>Attributes</th>+++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>query</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>+++ <td class="attributes">++++++ </td>+++++ <td class="description last">SQL query with ? used as parameter placeholder</td>+ </tr>++++ <tr>++ <td class="name"><code>params</code></td>+++ <td class="type">+++<span class="param-type">Array.<object></span>++++ </td>+++ <td class="attributes">++ <optional><br>++++++ </td>+++++ <td class="description last">array of params if needed</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line332">line 332</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++<div class="param-desc">+ - array of first column of all returned rows+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">Array.<object></span>+++ </dd>+</dl>++++++++++++++ <h4 class="name" id=".getMap"><span class="type-signature">(static) </span>getMap<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {object}</span></h4>+++++++<div class="description">+ Get a map of first column mapping to second column.+</div>++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>+++ <th>Attributes</th>+++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>query</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>+++ <td class="attributes">++++++ </td>+++++ <td class="description last">SQL query with ? used as parameter placeholder</td>+ </tr>++++ <tr>++ <td class="name"><code>params</code></td>+++ <td class="type">+++<span class="param-type">Array.<object></span>++++ </td>+++ <td class="attributes">++ <optional><br>++++++ </td>+++++ <td class="description last">array of params if needed</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line322">line 322</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++<div class="param-desc">+ - map of first column to second column+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">object</span>+++ </dd>+</dl>++++++++++++++ <h4 class="name" id=".getRow"><span class="type-signature">(static) </span>getRow<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {object}</span></h4>+++++++<div class="description">+ Get first returned row.+</div>++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>+++ <th>Attributes</th>+++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>query</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>+++ <td class="attributes">++++++ </td>+++++ <td class="description last">SQL query with ? used as parameter placeholder</td>+ </tr>++++ <tr>++ <td class="name"><code>params</code></td>+++ <td class="type">+++<span class="param-type">Array.<object></span>++++ </td>+++ <td class="attributes">++ <optional><br>++++++ </td>+++++ <td class="description last">array of params if needed</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line299">line 299</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++<div class="param-desc">+ - map of column name to column value+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">object</span>+++ </dd>+</dl>++++++++++++++ <h4 class="name" id=".getRows"><span class="type-signature">(static) </span>getRows<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<object>}</span></h4>+++++++<div class="description">+ Get all returned rows.+</div>++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>+++ <th>Attributes</th>+++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>query</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>+++ <td class="attributes">++++++ </td>+++++ <td class="description last">SQL query with ? used as parameter placeholder</td>+ </tr>++++ <tr>++ <td class="name"><code>params</code></td>+++ <td class="type">+++<span class="param-type">Array.<object></span>++++ </td>+++ <td class="attributes">++ <optional><br>++++++ </td>+++++ <td class="description last">array of params if needed</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line310">line 310</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++<div class="param-desc">+ - array of all rows, each row is a map of column name to column value+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">Array.<object></span>+++ </dd>+</dl>++++++++++++++ <h4 class="name" id=".getValue"><span class="type-signature">(static) </span>getValue<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>+++++++<div class="description">+ Get single value from the given query - first column from first returned row.+</div>++++++++++ <h5>Parameters:</h5>+++<table class="params">+ <thead>+ <tr>++ <th>Name</th>+++ <th>Type</th>+++ <th>Attributes</th>+++++ <th class="last">Description</th>+ </tr>+ </thead>++ <tbody>+++ <tr>++ <td class="name"><code>query</code></td>+++ <td class="type">+++<span class="param-type">string</span>++++ </td>+++ <td class="attributes">++++++ </td>+++++ <td class="description last">SQL query with ? used as parameter placeholder</td>+ </tr>++++ <tr>++ <td class="name"><code>params</code></td>+++ <td class="type">+++<span class="param-type">Array.<object></span>++++ </td>+++ <td class="attributes">++ <optional><br>++++++ </td>+++++ <td class="description last">array of params if needed</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line289">line 289</a>+ </li></ul></dd>++++++++</dl>++++++++++++++++<h5>Returns:</h5>+++<div class="param-desc">+ [object] - single value+</div>++++++++++++++++</article>++</section>+++++</div>++<nav>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+</nav>++<br class="clear">++<footer>+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>+</footer>++<script> prettyPrint(); </script>+<script src="scripts/linenumber.js"> </script>+</body>+</html>\ No newline at end of filediff --git a/docs/backend_api/services_backend_script_api.js.html b/docs/backend_api/services_backend_script_api.js.htmlindex 98bf9c0fd4..cb310abc5a 100644--- a/docs/backend_api/services_backend_script_api.js.html+++ b/docs/backend_api/services_backend_script_api.js.html@@ -37,6 +37,7 @@ const config = require('./config');const repository = require('./repository');const axios = require('axios');const dayjs = require('dayjs');+const xml2js = require('xml2js');const cloningService = require('./cloning');const appInfo = require('./app_info');const searchService = require('./search/services/search');@@ -60,9 +61,14 @@ function BackendScriptApi(currentNote, apiParams) {this[key] = apiParams[key];}+ /** @property {axios} Axios library for HTTP requests. See https://axios-http.com/ for documentation */this.axios = axios;+ /** @property {dayjs} day.js library for date manipulation. See https://day.js.org/ for documentation */this.dayjs = dayjs;+ /** @property {axios} xml2js library for XML parsing. See https://github.com/Leonidas-from-XIV/node-xml2js for documentation */+ this.xml2js = xml2js;+ // DEPRECATED - use direct api.unescapeHtmlthis.utils = {unescapeHtml: utils.unescapeHtml};@@ -128,6 +134,10 @@ function BackendScriptApi(currentNote, apiParams) {searchParams.includeArchivedNotes = true;}+ if (searchParams.ignoreHoistedNote === undefined) {+ searchParams.ignoreHoistedNote = true;+ }+const noteIds = searchService.findNotesWithQuery(query, new SearchContext(searchParams)).map(sr => sr.noteId);@@ -214,7 +224,7 @@ function BackendScriptApi(currentNote, apiParams) {* @param {string} parentNoteId* @param {string} title* @param {string} content- * @return {{note: Note, branch: Branch}}+ * @return {{note: Note, branch: Branch}} - object having "note" and "branch" keys representing respective objects*/this.createTextNote = (parentNoteId, title, content = '') => noteService.createNewNote({parentNoteId,@@ -230,7 +240,7 @@ function BackendScriptApi(currentNote, apiParams) {* @param {string} parentNoteId* @param {string} title* @param {object} content- * @return {{note: Note, branch: Branch}}+ * @return {{note: Note, branch: Branch}} object having "note" and "branch" keys representing respective objects*/this.createDataNote = (parentNoteId, title, content = {}) => noteService.createNewNote({parentNoteId,@@ -387,7 +397,7 @@ function BackendScriptApi(currentNote, apiParams) {* @method* @param {string} parentNoteId - this note's child notes will be sorted*/- this.sortNotesAlphabetically = treeService.sortNotesAlphabetically;+ this.sortNotesByTitle = treeService.sortNotesByTitle;/*** This method finds note by its noteId and prefix and either sets it to the given parentNoteId@@ -413,6 +423,32 @@ function BackendScriptApi(currentNote, apiParams) {*/this.transactional = sql.transactional;+ /**+ * Return randomly generated string of given length. This random string generation is NOT cryptographically secure.+ *+ * @method+ * @param {number} length of the string+ * @returns {string} random string+ */+ this.randomString = utils.randomString;++ /**+ * @method+ * @param {string} string to escape+ * @returns {string} escaped string+ */+ this.escapeHtml = utils.escapeHtml;++ /**+ * @method+ * @param {string} string to unescape+ * @returns {string} unescaped string+ */+ this.unescapeHtml = utils.unescapeHtml;++ /**+ * @property {module:sql} sql+ */this.sql = sql;/**@@ -438,7 +474,7 @@ module.exports = BackendScriptApi;</div><nav>- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3></nav><br class="clear">diff --git a/docs/backend_api/services_sql.js.html b/docs/backend_api/services_sql.js.htmlnew file mode 100644index 0000000000..6ad8e618a1--- /dev/null+++ b/docs/backend_api/services_sql.js.html@@ -0,0 +1,399 @@+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="utf-8">+ <title>JSDoc: Source: services/sql.js</title>++ <script src="scripts/prettify/prettify.js"> </script>+ <script src="scripts/prettify/lang-css.js"> </script>+ <!--[if lt IE 9]>+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>+ <![endif]-->+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">+</head>++<body>++<div id="main">++ <h1 class="page-title">Source: services/sql.js</h1>+++++++ <section>+ <article>+ <pre class="prettyprint source linenums"><code>"use strict";++/**+ * @module sql+ */++const log = require('./log');+const Database = require('better-sqlite3');+const dataDir = require('./data_dir');+const cls = require('./cls');++const dbConnection = new Database(dataDir.DOCUMENT_PATH);+dbConnection.pragma('journal_mode = WAL');++[`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach(eventType => {+ process.on(eventType, () => {+ if (dbConnection) {+ // closing connection is especially important to fold -wal file into the main DB file+ // (see https://sqlite.org/tempfiles.html for details)+ dbConnection.close();+ }+ });+});++function insert(tableName, rec, replace = false) {+ const keys = Object.keys(rec);+ if (keys.length === 0) {+ log.error("Can't insert empty object into table " + tableName);+ return;+ }++ const columns = keys.join(", ");+ const questionMarks = keys.map(p => "?").join(", ");++ const query = "INSERT " + (replace ? "OR REPLACE" : "") + " INTO " + tableName + "(" + columns + ") VALUES (" + questionMarks + ")";++ const res = execute(query, Object.values(rec));++ return res ? res.lastInsertRowid : null;+}++function replace(tableName, rec) {+ return insert(tableName, rec, true);+}++function upsert(tableName, primaryKey, rec) {+ const keys = Object.keys(rec);+ if (keys.length === 0) {+ log.error("Can't upsert empty object into table " + tableName);+ return;+ }++ const columns = keys.join(", ");++ const questionMarks = keys.map(colName => "@" + colName).join(", ");++ const updateMarks = keys.map(colName => `${colName} = @${colName}`).join(", ");++ const query = `INSERT INTO ${tableName} (${columns}) VALUES (${questionMarks})+ ON CONFLICT (${primaryKey}) DO UPDATE SET ${updateMarks}`;++ for (const idx in rec) {+ if (rec[idx] === true || rec[idx] === false) {+ rec[idx] = rec[idx] ? 1 : 0;+ }+ }++ execute(query, rec);+}++const statementCache = {};++function stmt(sql) {+ if (!(sql in statementCache)) {+ statementCache[sql] = dbConnection.prepare(sql);+ }++ return statementCache[sql];+}++function getRow(query, params = []) {+ return wrap(query, s => s.get(params));+}++function getRowOrNull(query, params = []) {+ const all = getRows(query, params);++ return all.length > 0 ? all[0] : null;+}++function getValue(query, params = []) {+ const row = getRowOrNull(query, params);++ if (!row) {+ return null;+ }++ return row[Object.keys(row)[0]];+}++// smaller values can result in better performance due to better usage of statement cache+const PARAM_LIMIT = 100;++function getManyRows(query, params) {+ let results = [];++ while (params.length > 0) {+ const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT));+ params = params.slice(curParams.length);++ const curParamsObj = {};++ let j = 1;+ for (const param of curParams) {+ curParamsObj['param' + j++] = param;+ }++ let i = 1;+ const questionMarks = curParams.map(() => ":param" + i++).join(",");+ const curQuery = query.replace(/\?\?\?/g, questionMarks);++ const statement = curParams.length === PARAM_LIMIT+ ? stmt(curQuery)+ : dbConnection.prepare(curQuery);++ const subResults = statement.all(curParamsObj);+ results = results.concat(subResults);+ }++ return results;+}++function getRows(query, params = []) {+ return wrap(query, s => s.all(params));+}++function iterateRows(query, params = []) {+ return stmt(query).iterate(params);+}++function getMap(query, params = []) {+ const map = {};+ const results = getRows(query, params);++ for (const row of results) {+ const keys = Object.keys(row);++ map[row[keys[0]]] = row[keys[1]];+ }++ return map;+}++function getColumn(query, params = []) {+ const list = [];+ const result = getRows(query, params);++ if (result.length === 0) {+ return list;+ }++ const key = Object.keys(result[0])[0];++ for (const row of result) {+ list.push(row[key]);+ }++ return list;+}++function execute(query, params = []) {+ return wrap(query, s => s.run(params));+}++function executeWithoutTransaction(query, params = []) {+ dbConnection.run(query, params);+}++function executeMany(query, params) {+ while (params.length > 0) {+ const curParams = params.slice(0, Math.min(params.length, PARAM_LIMIT));+ params = params.slice(curParams.length);++ const curParamsObj = {};++ let j = 1;+ for (const param of curParams) {+ curParamsObj['param' + j++] = param;+ }++ let i = 1;+ const questionMarks = curParams.map(() => ":param" + i++).join(",");+ const curQuery = query.replace(/\?\?\?/g, questionMarks);++ dbConnection.prepare(curQuery).run(curParamsObj);+ }+}++function executeScript(query) {+ return dbConnection.exec(query);+}++function wrap(query, func) {+ const startTimestamp = Date.now();+ let result;++ try {+ result = func(stmt(query));+ }+ catch (e) {+ if (e.message.includes("The database connection is not open")) {+ // this often happens on killing the app which puts these alerts in front of user+ // in these cases error should be simply ignored.+ console.log(e.message);++ return null+ }++ throw e;+ }++ const milliseconds = Date.now() - startTimestamp;++ if (milliseconds >= 20) {+ if (query.includes("WITH RECURSIVE")) {+ log.info(`Slow recursive query took ${milliseconds}ms.`);+ }+ else {+ log.info(`Slow query took ${milliseconds}ms: ${query.trim().replace(/\s+/g, " ")}`);+ }+ }++ return result;+}++function transactional(func) {+ try {+ const ret = dbConnection.transaction(func).deferred();++ if (!dbConnection.inTransaction) { // i.e. transaction was really committed (and not just savepoint released)+ require('./ws.js').sendTransactionEntityChangesToAllClients();+ }++ return ret;+ }+ catch (e) {+ cls.clearEntityChanges();++ throw e;+ }+}++function fillParamList(paramIds, truncate = true) {+ if (paramIds.length === 0) {+ return;+ }++ if (truncate) {+ execute("DELETE FROM param_list");+ }++ paramIds = Array.from(new Set(paramIds));++ if (paramIds.length > 30000) {+ fillParamList(paramIds.slice(30000), false);++ paramIds = paramIds.slice(0, 30000);+ }++ // doing it manually to avoid this showing up on the sloq query list+ const s = stmt(`INSERT INTO param_list VALUES ` + paramIds.map(paramId => `(?)`).join(','), paramIds);++ s.run(paramIds);+}++module.exports = {+ dbConnection,+ insert,+ replace,++ /**+ * Get single value from the given query - first column from first returned row.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return [object] - single value+ */+ getValue,++ /**+ * Get first returned row.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object} - map of column name to column value+ */+ getRow,+ getRowOrNull,++ /**+ * Get all returned rows.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object[]} - array of all rows, each row is a map of column name to column value+ */+ getRows,+ iterateRows,+ getManyRows,++ /**+ * Get a map of first column mapping to second column.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object} - map of first column to second column+ */+ getMap,++ /**+ * Get a first column in an array.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object[]} - array of first column of all returned rows+ */+ getColumn,++ /**+ * Execute SQL+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ */+ execute,+ executeWithoutTransaction,+ executeMany,+ executeScript,+ transactional,+ upsert,+ fillParamList+};+</code></pre>+ </article>+ </section>+++++</div>++<nav>+ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>+</nav>++<br class="clear">++<footer>+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a>+</footer>++<script> prettyPrint(); </script>+<script src="scripts/linenumber.js"> </script>+</body>+</html>diff --git a/docs/frontend_api/FrontendScriptApi.html b/docs/frontend_api/FrontendScriptApi.htmlindex 2b0aac4484..7dabc35d28 100644--- a/docs/frontend_api/FrontendScriptApi.html+++ b/docs/frontend_api/FrontendScriptApi.html@@ -81,7 +81,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line22">line 22</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line23">line 23</a></li></ul></dd>@@ -223,7 +223,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line26">line 26</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line27">line 27</a></li></ul></dd>@@ -329,7 +329,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line48">line 48</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line49">line 49</a></li></ul></dd>@@ -435,7 +435,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line39">line 39</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line40">line 40</a></li></ul></dd>@@ -545,7 +545,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line31">line 31</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line32">line 32</a></li></ul></dd>@@ -658,7 +658,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line33">line 33</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line34">line 34</a></li></ul></dd>@@ -768,7 +768,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line29">line 29</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line30">line 30</a></li></ul></dd>@@ -874,7 +874,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line42">line 42</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line43">line 43</a></li></ul></dd>@@ -980,7 +980,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line45">line 45</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line46">line 46</a></li></ul></dd>@@ -1109,7 +1109,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line67">line 67</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line68">line 68</a></li></ul></dd>@@ -1264,7 +1264,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line57">line 57</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line58">line 58</a></li></ul></dd>@@ -1419,7 +1419,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line101">line 101</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line105">line 105</a></li></ul></dd>@@ -1556,7 +1556,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line302">line 302</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line310">line 310</a></li></ul></dd>@@ -1712,7 +1712,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line413">line 413</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line421">line 421</a></li></ul></dd>@@ -2033,7 +2033,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line294">line 294</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line302">line 302</a></li></ul></dd>@@ -2166,7 +2166,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line253">line 253</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line261">line 261</a></li></ul></dd>@@ -2272,7 +2272,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line308">line 308</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line316">line 316</a></li></ul></dd>@@ -2378,7 +2378,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line322">line 322</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line330">line 330</a></li></ul></dd>@@ -2532,7 +2532,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line316">line 316</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line324">line 324</a></li></ul></dd>@@ -2669,7 +2669,7 @@<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line373">line 373</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line381">line 381</a></li></ul></dd>@@ -2776,7 +2776,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_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line246">line 246</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line254">line 254</a></li></ul></dd>@@ -2931,7 +2931,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_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line382">line 382</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line390">line 390</a></li></ul></dd>@@ -3087,7 +3087,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_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line218">line 218</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line226">line 226</a></li></ul></dd>@@ -3288,7 +3288,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line230">line 230</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line238">line 238</a></li></ul></dd>@@ -3394,7 +3394,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line364">line 364</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line372">line 372</a></li></ul></dd>@@ -3549,7 +3549,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line391">line 391</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line399">line 399</a></li></ul></dd>@@ -3727,7 +3727,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line81">line 81</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line82">line 82</a></li></ul></dd>@@ -3878,7 +3878,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line260">line 260</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line268">line 268</a></li></ul></dd>@@ -3986,7 +3986,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line334">line 334</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line342">line 342</a></li></ul></dd>@@ -4142,7 +4142,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line345">line 345</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line353">line 353</a></li></ul></dd>@@ -4298,7 +4298,144 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line354">line 354</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line362">line 362</a>+ </li></ul></dd>++++++++</dl>+++++++++++++++++++++++++++ <h4 class="name" id="randomString"><span class="type-signature"></span>randomString<span class="signature">(length)</span><span class="type-signature"> → {string}</span></h4>+++++++<div class="description">+ Return randomly generated string of given length. This random string generation is NOT cryptographically secure.+</div>++++++++++ <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>length</code></td>+++ <td class="type">+++<span class="param-type">number</span>++++ </td>++++++ <td class="description last">of the string</td>+ </tr>+++ </tbody>+</table>+++++++<dl class="details">+++++++++++++++++++++++++++ <dt class="tag-source">Source:</dt>+ <dd class="tag-source"><ul class="dummy"><li>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line448">line 448</a></li></ul></dd>@@ -4323,6 +4460,28 @@ otherwise (by e.g. createNoteLink())+<h5>Returns:</h5>+++<div class="param-desc">+ random string+</div>++++<dl>+ <dt>+ Type+ </dt>+ <dd>++<span class="param-type">string</span>+++ </dd>+</dl>++@@ -4430,7 +4589,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line431">line 431</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line439">line 439</a></li></ul></dd>@@ -4516,7 +4675,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line282">line 282</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line290">line 290</a></li></ul></dd>@@ -4653,7 +4812,7 @@ otherwise (by e.g. createNoteLink())<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line238">line 238</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line246">line 246</a></li></ul></dd>@@ -4814,7 +4973,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line151">line 151</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line164">line 164</a></li></ul></dd>@@ -4922,7 +5081,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line180">line 180</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line192">line 192</a></li></ul></dd>@@ -5060,7 +5219,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line206">line 206</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line214">line 214</a></li></ul></dd>@@ -5216,7 +5375,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line190">line 190</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line202">line 202</a></li></ul></dd>@@ -5371,7 +5530,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line400">line 400</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line408">line 408</a></li></ul></dd>@@ -5522,7 +5681,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line328">line 328</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line336">line 336</a></li></ul></dd>@@ -5659,7 +5818,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line276">line 276</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line284">line 284</a></li></ul></dd>@@ -5796,7 +5955,7 @@ Internally this serializes the anonymous function into string and sends it to ba<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line268">line 268</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line276">line 276</a></li></ul></dd>@@ -5888,7 +6047,7 @@ Typical use case is when new note has been created, we should wait until it is s<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line424">line 424</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line432">line 432</a></li></ul></dd>diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.htmlindex 89045666e0..72ad5005e2 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 TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line24">line 24</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line25">line 25</a></li></ul></dd>@@ -267,7 +267,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line33">line 33</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line34">line 34</a></li></ul></dd>@@ -335,7 +335,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line41">line 41</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line42">line 42</a></li></ul></dd>@@ -403,7 +403,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line47">line 47</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line48">line 48</a></li></ul></dd>@@ -461,7 +461,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line64">line 64</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line65">line 65</a></li></ul></dd>@@ -519,7 +519,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line58">line 58</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line59">line 59</a></li></ul></dd>@@ -577,7 +577,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line62">line 62</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line63">line 63</a></li></ul></dd>@@ -635,7 +635,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line54">line 54</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line55">line 55</a></li></ul></dd>@@ -703,7 +703,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line39">line 39</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line40">line 40</a></li></ul></dd>@@ -771,7 +771,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line44">line 44</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line45">line 45</a></li></ul></dd>@@ -839,7 +839,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line36">line 36</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line37">line 37</a></li></ul></dd>@@ -897,7 +897,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line56">line 56</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line57">line 57</a></li></ul></dd>@@ -955,7 +955,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line60">line 60</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line61">line 61</a></li></ul></dd>@@ -1103,7 +1103,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line377">line 377</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line464">line 464</a></li></ul></dd>@@ -1303,7 +1303,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line189">line 189</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line210">line 210</a></li></ul></dd>@@ -1481,7 +1481,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line399">line 399</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line486">line 486</a></li></ul></dd>@@ -1587,7 +1587,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line132">line 132</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line133">line 133</a></li></ul></dd>@@ -1689,7 +1689,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line127">line 127</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line128">line 128</a></li></ul></dd>@@ -1791,7 +1791,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line144">line 144</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line145">line 145</a></li></ul></dd>@@ -1893,7 +1893,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line162">line 162</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line183">line 183</a></li></ul></dd>@@ -1995,7 +1995,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line167">line 167</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line188">line 188</a></li></ul></dd>@@ -2146,7 +2146,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line439">line 439</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line526">line 526</a></li></ul></dd>@@ -2313,7 +2313,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line266">line 266</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line353">line 353</a></li></ul></dd>@@ -2468,7 +2468,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line463">line 463</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line550">line 550</a></li></ul></dd>@@ -2578,7 +2578,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line588">line 588</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line675">line 675</a></li></ul></dd>@@ -2752,7 +2752,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line366">line 366</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line453">line 453</a></li></ul></dd>@@ -2952,7 +2952,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line176">line 176</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line197">line 197</a></li></ul></dd>@@ -3130,7 +3130,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line388">line 388</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line475">line 475</a></li></ul></dd>@@ -3285,7 +3285,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line433">line 433</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line520">line 520</a></li></ul></dd>@@ -3452,7 +3452,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line258">line 258</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line345">line 345</a></li></ul></dd>@@ -3607,7 +3607,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line457">line 457</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line544">line 544</a></li></ul></dd>@@ -3762,7 +3762,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line445">line 445</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line532">line 532</a></li></ul></dd>@@ -3929,7 +3929,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line331">line 331</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line418">line 418</a></li></ul></dd>@@ -4084,7 +4084,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line469">line 469</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line556">line 556</a></li></ul></dd>@@ -4190,7 +4190,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line152">line 152</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line153">line 153</a></li></ul></dd>@@ -4292,7 +4292,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line157">line 157</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line158">line 158</a></li></ul></dd>@@ -4443,7 +4443,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line451">line 451</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line538">line 538</a></li></ul></dd>@@ -4610,7 +4610,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line339">line 339</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line426">line 426</a></li></ul></dd>@@ -4765,7 +4765,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line481">line 481</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line568">line 568</a></li></ul></dd>@@ -4935,7 +4935,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line491">line 491</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line578">line 578</a></li></ul></dd>@@ -5086,7 +5086,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line475">line 475</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line562">line 562</a></li></ul></dd>@@ -5196,7 +5196,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line567">line 567</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line654">line 654</a></li></ul></dd>@@ -5302,7 +5302,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line577">line 577</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line664">line 664</a></li></ul></dd>@@ -5404,7 +5404,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line505">line 505</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line592">line 592</a></li></ul></dd>@@ -5578,7 +5578,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line348">line 348</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line435">line 435</a></li></ul></dd>@@ -5684,7 +5684,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line139">line 139</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line140">line 140</a></li></ul></dd>@@ -5835,7 +5835,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line415">line 415</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line502">line 502</a></li></ul></dd>@@ -6013,7 +6013,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line357">line 357</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line444">line 444</a></li></ul></dd>@@ -6168,7 +6168,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line409">line 409</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line496">line 496</a></li></ul></dd>@@ -6323,7 +6323,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line421">line 421</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line508">line 508</a></li></ul></dd>@@ -6478,7 +6478,7 @@ This note's representation is used in note tree and is kept in TreeCache.</div><dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line427">line 427</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line514">line 514</a></li></ul></dd>@@ -6589,7 +6589,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line558">line 558</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line645">line 645</a></li></ul></dd>@@ -6673,7 +6673,7 @@ Cache is note instance scoped.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line102">line 102</a>+ <a href="entities_note_short.js.html">entities/note_short.js</a>, <a href="entities_note_short.js.html#line103">line 103</a></li></ul></dd>diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.htmlindex c81f0b014d..69f2d1dc9e 100644--- a/docs/frontend_api/entities_note_short.js.html+++ b/docs/frontend_api/entities_note_short.js.html@@ -30,6 +30,7 @@import noteAttributeCache from "../services/note_attribute_cache.js";import ws from "../services/ws.js";import options from "../services/options.js";+import treeCache from "../services/tree_cache.js";const LABEL = 'label';const RELATION = 'relation';@@ -186,6 +187,26 @@ class NoteShort {return this.treeCache.getNotesFromCache(this.parents);}+ // will sort the parents so that non-search & non-archived are first and archived at the end+ // this is done so that non-search & non-archived paths are always explored as first when looking for note path+ resortParents() {+ this.parents.sort((aNoteId, bNoteId) => {+ const aBranchId = this.parentToBranch[aNoteId];++ if (aBranchId && aBranchId.startsWith('virt-')) {+ return 1;+ }++ const aNote = this.treeCache.getNoteFromCache([aNoteId]);++ if (aNote.hasLabel('archived')) {+ return 1;+ }++ return -1;+ });+ }+/** @returns {string[]} */getChildNoteIds() {return this.children;@@ -261,6 +282,72 @@ class NoteShort {return noteAttributeCache.attributes[this.noteId];}+ getAllNotePaths(encounteredNoteIds = null) {+ if (this.noteId === 'root') {+ return [['root']];+ }++ if (!encounteredNoteIds) {+ encounteredNoteIds = new Set();+ }++ encounteredNoteIds.add(this.noteId);++ const parentNotes = this.getParentNotes();+ let paths;++ if (parentNotes.length === 1) { // optimization for the most common case+ if (encounteredNoteIds.has(parentNotes[0].noteId)) {+ return [];+ }+ else {+ paths = parentNotes[0].getAllNotePaths(encounteredNoteIds);+ }+ }+ else {+ paths = [];++ for (const parentNote of parentNotes) {+ if (encounteredNoteIds.has(parentNote.noteId)) {+ continue;+ }++ const newSet = new Set(encounteredNoteIds);++ paths.push(...parentNote.getAllNotePaths(newSet));+ }+ }++ for (const path of paths) {+ path.push(this.noteId);+ }++ return paths;+ }++ getSortedNotePaths(hoistedNotePath = 'root') {+ const notePaths = this.getAllNotePaths().map(path => ({+ notePath: path,+ isInHoistedSubTree: path.includes(hoistedNotePath),+ isArchived: path.find(noteId => treeCache.notes[noteId].hasLabel('archived')),+ isSearch: path.find(noteId => treeCache.notes[noteId].type === 'search')+ }));++ notePaths.sort((a, b) => {+ if (a.isInHoistedSubTree !== b.isInHoistedSubTree) {+ return a.isInHoistedSubTree ? -1 : 1;+ } else if (a.isSearch !== b.isSearch) {+ return a.isSearch ? 1 : -1;+ } else if (a.isArchived !== b.isArchived) {+ return a.isArchived ? 1 : -1;+ } else {+ return a.notePath.length - b.notePath.length;+ }+ });++ return notePaths;+ }+__filterAttrs(attributes, type, name) {if (!type && !name) {return attributes;@@ -300,7 +387,7 @@ class NoteShort {const workspaceIconClass = this.getWorkspaceIconClass();if (iconClassLabels.length > 0) {- return iconClassLabels.map(l => l.value).join(' ');+ return iconClassLabels[0].value;}else if (workspaceIconClass) {return workspaceIconClass;@@ -550,7 +637,7 @@ class NoteShort {});}- hasAncestor(ancestorNote, visitedNoteIds) {+ hasAncestor(ancestorNote, visitedNoteIds = null) {if (this.noteId === ancestorNote.noteId) {return true;}diff --git a/docs/frontend_api/global.html b/docs/frontend_api/global.htmlindex c0139c1446..7fe7edd242 100644--- a/docs/frontend_api/global.html+++ b/docs/frontend_api/global.html@@ -572,7 +572,7 @@ separately but should behave uniformly for the user.<dt class="tag-source">Source:</dt><dd class="tag-source"><ul class="dummy"><li>- <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line88">line 88</a>+ <a href="services_frontend_script_api.js.html">services/frontend_script_api.js</a>, <a href="services_frontend_script_api.js.html#line92">line 92</a></li></ul></dd>diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.htmlindex 55df0a765a..d16aeadcc4 100644--- a/docs/frontend_api/services_frontend_script_api.js.html+++ b/docs/frontend_api/services_frontend_script_api.js.html@@ -34,6 +34,7 @@ import treeCache from './tree_cache.js';import noteTooltipService from './note_tooltip.js';import protectedSessionService from './protected_session.js';import dateNotesService from './date_notes.js';+import searchService from './search.js';import CollapsibleWidget from '../widgets/collapsible_widget.js';import ws from "./ws.js";import appContext from "./app_context.js";@@ -110,7 +111,10 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $containawait ws.waitForMaxKnownEntityChangeId();await appContext.tabManager.openTabWithNote(notePath, activate);- appContext.triggerEvent('focusAndSelectTitle');++ if (activate) {+ appContext.triggerEvent('focusAndSelectTitle');+ }};/**@@ -129,9 +133,18 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $containthis.addButtonToToolbar = opts => {const buttonId = "toolbar-button-" + opts.title.replace(/\s/g, "-");- const button = $('<button class="noborder">')- .addClass("btn btn-sm")- .on('click', opts.action);+ let button;+ if (utils.isMobile()) {+ $('#plugin-buttons-placeholder').remove();+ button = $('<a class="dropdown-item" href="#">')+ .on('click', () => {+ setTimeout(() => $pluginButtons.dropdown('hide'), 0);+ });+ } else {+ button = $('<button class="noborder">')+ .addClass("btn btn-sm");+ }+ button = button.on('click', opts.action);if (opts.icon) {button.append($("<span>").addClass("bx bx-" + opts.icon))@@ -191,8 +204,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain}, "script");if (ret.success) {- // wait until all the changes done in the script has been synced to frontend before continuing- await ws.waitForEntityChangeId(ret.maxEntityChangeId);+ await ws.waitForMaxKnownEntityChangeId();return ret.executionResult;}@@ -216,11 +228,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain* @returns {Promise<NoteShort[]>}*/this.searchForNotes = async searchString => {- const noteIds = await this.runOnBackend(- searchString => api.searchForNotes(searchString).map(note => note.noteId),- [searchString]);-- return await treeCache.getNotes(noteIds);+ return await searchService.searchForNotes(searchString);};/**@@ -457,6 +465,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain* @param includedNoteId - noteId of the included note*/this.refreshIncludedNote = includedNoteId => appContext.triggerEvent('refreshIncludedNote', {noteId: includedNoteId});++ /**+ * Return randomly generated string of given length. This random string generation is NOT cryptographically secure.+ *+ * @method+ * @param {number} length of the string+ * @returns {string} random string+ */+ this.randomString = utils.randomString;}export default FrontendScriptApi;diff --git a/package.json b/package.jsonindex c20ab4f1d2..d5307d4bf9 100644--- a/package.json+++ b/package.json@@ -15,7 +15,7 @@"scripts": {"start-server": "cross-env TRILIUM_ENV=dev node ./src/www","start-electron": "cross-env TRILIUM_ENV=dev electron --inspect=5858 .",- "build-backend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/entities/*.js src/services/backend_script_api.js",+ "build-backend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/entities/*.js src/services/backend_script_api.js src/services/sql.js","build-frontend-docs": "./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/frontend_api src/public/app/entities/*.js src/public/app/services/frontend_script_api.js src/public/app/widgets/collapsible_widget.js","build-docs": "npm run build-backend-docs && npm run build-frontend-docs","webpack": "npx webpack -c webpack-desktop.config.js && npx webpack -c webpack-mobile.config.js && npx webpack -c webpack-setup.config.js",@@ -87,7 +87,7 @@"jsdoc": "3.6.6","lorem-ipsum": "2.0.3","rcedit": "3.0.0",- "webpack": "5.30.0",+ "webpack": "5.31.0","webpack-cli": "4.6.0"},"optionalDependencies": {diff --git a/src/public/app/services/frontend_script_api.js b/src/public/app/services/frontend_script_api.jsindex f396b12748..935c6b819e 100644--- a/src/public/app/services/frontend_script_api.js+++ b/src/public/app/services/frontend_script_api.js@@ -437,6 +437,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain* @param includedNoteId - noteId of the included note*/this.refreshIncludedNote = includedNoteId => appContext.triggerEvent('refreshIncludedNote', {noteId: includedNoteId});++ /**+ * Return randomly generated string of given length. This random string generation is NOT cryptographically secure.+ *+ * @method+ * @param {number} length of the string+ * @returns {string} random string+ */+ this.randomString = utils.randomString;}export default FrontendScriptApi;diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.jsindex 45f60f2b01..527b5d98f2 100644--- a/src/services/backend_script_api.js+++ b/src/services/backend_script_api.js@@ -33,10 +33,14 @@ function BackendScriptApi(currentNote, apiParams) {this[key] = apiParams[key];}+ /** @property {axios} Axios library for HTTP requests. See https://axios-http.com/ for documentation */this.axios = axios;+ /** @property {dayjs} day.js library for date manipulation. See https://day.js.org/ for documentation */this.dayjs = dayjs;+ /** @property {axios} xml2js library for XML parsing. See https://github.com/Leonidas-from-XIV/node-xml2js for documentation */this.xml2js = xml2js;+ // DEPRECATED - use direct api.unescapeHtmlthis.utils = {unescapeHtml: utils.unescapeHtml};@@ -192,7 +196,7 @@ function BackendScriptApi(currentNote, apiParams) {* @param {string} parentNoteId* @param {string} title* @param {string} content- * @return {{note: Note, branch: Branch}}+ * @return {{note: Note, branch: Branch}} - object having "note" and "branch" keys representing respective objects*/this.createTextNote = (parentNoteId, title, content = '') => noteService.createNewNote({parentNoteId,@@ -208,7 +212,7 @@ function BackendScriptApi(currentNote, apiParams) {* @param {string} parentNoteId* @param {string} title* @param {object} content- * @return {{note: Note, branch: Branch}}+ * @return {{note: Note, branch: Branch}} object having "note" and "branch" keys representing respective objects*/this.createDataNote = (parentNoteId, title, content = {}) => noteService.createNewNote({parentNoteId,@@ -391,6 +395,32 @@ function BackendScriptApi(currentNote, apiParams) {*/this.transactional = sql.transactional;+ /**+ * Return randomly generated string of given length. This random string generation is NOT cryptographically secure.+ *+ * @method+ * @param {number} length of the string+ * @returns {string} random string+ */+ this.randomString = utils.randomString;++ /**+ * @method+ * @param {string} string to escape+ * @returns {string} escaped string+ */+ this.escapeHtml = utils.escapeHtml;++ /**+ * @method+ * @param {string} string to unescape+ * @returns {string} unescaped string+ */+ this.unescapeHtml = utils.unescapeHtml;++ /**+ * @property {module:sql} sql+ */this.sql = sql;/**diff --git a/src/services/sql.js b/src/services/sql.jsindex a043898ef5..3768624b42 100644--- a/src/services/sql.js+++ b/src/services/sql.js@@ -1,5 +1,9 @@"use strict";+/**+ * @module sql+ */+const log = require('./log');const Database = require('better-sqlite3');const dataDir = require('./data_dir');@@ -273,14 +277,67 @@ module.exports = {dbConnection,insert,replace,++ /**+ * Get single value from the given query - first column from first returned row.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return [object] - single value+ */getValue,++ /**+ * Get first returned row.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object} - map of column name to column value+ */getRow,getRowOrNull,++ /**+ * Get all returned rows.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object[]} - array of all rows, each row is a map of column name to column value+ */getRows,iterateRows,getManyRows,++ /**+ * Get a map of first column mapping to second column.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object} - map of first column to second column+ */getMap,++ /**+ * Get a first column in an array.+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ * @return {object[]} - array of first column of all returned rows+ */getColumn,++ /**+ * Execute SQL+ *+ * @method+ * @param {string} query - SQL query with ? used as parameter placeholder+ * @param {object[]} [params] - array of params if needed+ */execute,executeWithoutTransaction,executeMany,