Skip to content

Commit

Permalink
npm upgrades && docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Oct 23, 2023
1 parent 494b240 commit cc20d17
Show file tree
Hide file tree
Showing 8 changed files with 1,150 additions and 484 deletions.
62 changes: 60 additions & 2 deletions docs/backend_api/BNote.html
Original file line number Diff line number Diff line change
Expand Up @@ -13182,7 +13182,7 @@ <h5>Returns:</h5>



<h4 class="name" id="saveAttachment"><span class="type-signature"></span>saveAttachment<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="BAttachment.html">BAttachment</a>}</span></h4>
<h4 class="name" id="saveAttachment"><span class="type-signature"></span>saveAttachment<span class="signature">(matchBy)</span><span class="type-signature"> &rarr; {<a href="BAttachment.html">BAttachment</a>}</span></h4>



Expand All @@ -13197,6 +13197,64 @@ <h4 class="name" id="saveAttachment"><span class="type-signature"></span>saveAtt



<h5>Parameters:</h5>


<table class="params">
<thead>
<tr>

<th>Name</th>


<th>Type</th>




<th>Default</th>


<th class="last">Description</th>
</tr>
</thead>

<tbody>


<tr>

<td class="name"><code>matchBy</code></td>


<td class="type">


<span class="param-type">string</span>



</td>




<td class="default">

attachmentId

</td>


<td class="description last">choose by which property we detect if to update an existing attachment.
Supported values are either 'attachmentId' (default) or 'title'</td>
</tr>


</tbody>
</table>





Expand Down Expand Up @@ -13230,7 +13288,7 @@ <h4 class="name" id="saveAttachment"><span class="type-signature"></span>saveAtt

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1658">line 1658</a>
<a href="becca_entities_bnote.js.html">becca/entities/bnote.js</a>, <a href="becca_entities_bnote.js.html#line1660">line 1660</a>
</li></ul></dd>


Expand Down
246 changes: 205 additions & 41 deletions docs/backend_api/BackendScriptApi.html

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions docs/backend_api/becca_entities_bnote.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -1681,24 +1681,32 @@ <h1 class="page-title">Source: becca/entities/bnote.js</h1>
}

/**
* @param {string} matchBy - choose by which property we detect if to update an existing attachment.
* Supported values are either 'attachmentId' (default) or 'title'
* @returns {BAttachment}
*/
saveAttachment({attachmentId, role, mime, title, content, position}) {
saveAttachment({attachmentId, role, mime, title, content, position}, matchBy = 'attachmentId') {
if (!['attachmentId', 'title'].includes(matchBy)) {
throw new Error(`Unsupported value '${matchBy}' for matchBy param, has to be either 'attachmentId' or 'title'.`);
}

let attachment;

if (attachmentId) {
if (matchBy === 'title') {
attachment = this.getAttachmentByTitle(title);
} else if (matchBy === 'attachmentId' &amp;&amp; attachmentId) {
attachment = this.becca.getAttachmentOrThrow(attachmentId);
} else {
attachment = new BAttachment({
ownerId: this.noteId,
title,
role,
mime,
isProtected: this.isProtected,
position
});
}

attachment = attachment || new BAttachment({
ownerId: this.noteId,
title,
role,
mime,
isProtected: this.isProtected,
position
});

content = content || "";
attachment.setContent(content, {forceSave: true});

Expand Down
4 changes: 2 additions & 2 deletions docs/backend_api/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ <h5>Type:</h5>

<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#line30">line 30</a>
</li></ul></dd>


Expand Down Expand Up @@ -612,7 +612,7 @@ <h5>Type:</h5>

<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#line24">line 24</a>
<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>
</li></ul></dd>


Expand Down
12 changes: 6 additions & 6 deletions docs/backend_api/module-sql.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ <h5>Parameters:</h5>

<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#line364">line 364</a>
<a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line377">line 377</a>
</li></ul></dd>


Expand Down Expand Up @@ -430,7 +430,7 @@ <h5>Parameters:</h5>

<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#line355">line 355</a>
<a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line368">line 368</a>
</li></ul></dd>


Expand Down Expand Up @@ -632,7 +632,7 @@ <h5>Parameters:</h5>

<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#line345">line 345</a>
<a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line358">line 358</a>
</li></ul></dd>


Expand Down Expand Up @@ -834,7 +834,7 @@ <h5>Parameters:</h5>

<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#line321">line 321</a>
<a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line334">line 334</a>
</li></ul></dd>


Expand Down Expand Up @@ -1036,7 +1036,7 @@ <h5>Parameters:</h5>

<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>
<a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line345">line 345</a>
</li></ul></dd>


Expand Down Expand Up @@ -1238,7 +1238,7 @@ <h5>Parameters:</h5>

<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#line311">line 311</a>
<a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line324">line 324</a>
</li></ul></dd>


Expand Down
18 changes: 16 additions & 2 deletions docs/backend_api/services_sql.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ <h1 class="page-title">Source: services/sql.js</h1>

const milliseconds = Date.now() - startTimestamp;

if (milliseconds >= 20) {
if (milliseconds >= 20 &amp;&amp; !cls.isSlowQueryLoggingDisabled()) {
if (query.includes("WITH RECURSIVE")) {
log.info(`Slow recursive query took ${milliseconds}ms.`);
}
Expand Down Expand Up @@ -323,6 +323,19 @@ <h1 class="page-title">Source: services/sql.js</h1>
await dbConnection.backup(targetFilePath);
}

function disableSlowQueryLogging(cb) {
const orig = cls.isSlowQueryLoggingDisabled();

try {
cls.disableSlowQueryLogging(true);

return cb();
}
finally {
cls.disableSlowQueryLogging(orig);
}
}

module.exports = {
dbConnection,
insert,
Expand Down Expand Up @@ -395,7 +408,8 @@ <h1 class="page-title">Source: services/sql.js</h1>
transactional,
upsert,
fillParamList,
copyDatabase
copyDatabase,
disableSlowQueryLogging
};
</code></pre>
</article>
Expand Down
Loading

0 comments on commit cc20d17

Please sign in to comment.