various javaDoc improvements

This commit is contained in:
zadam
2021-04-07 22:01:52 +02:00
parent 2f58b6b3c8
commit 79c5645964
31 changed files with 3225 additions and 263 deletions

View File

@@ -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.unescapeHtml
this.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">