fixed jsdoc script API generation, closes #2313

This commit is contained in:
zadam
2021-11-10 21:30:54 +01:00
parent 5710c9e997
commit 600c16551a
72 changed files with 5844 additions and 11296 deletions

View File

@@ -33,6 +33,10 @@ const AbstractEntity = require("./abstract_entity.js");
const sql = require("../../services/sql.js");
const dateUtils = require("../../services/date_utils.js");
/**
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
* parents.
*/
class Branch extends AbstractEntity {
static get entityName() { return "branches"; }
static get primaryKeyName() { return "branchId"; }
@@ -63,19 +67,19 @@ class Branch extends AbstractEntity {
}
update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) {
/** @param {string} */
/** @type {string} */
this.branchId = branchId;
/** @param {string} */
/** @type {string} */
this.noteId = noteId;
/** @param {string} */
/** @type {string} */
this.parentNoteId = parentNoteId;
/** @param {string} */
/** @type {string} */
this.prefix = prefix;
/** @param {int} */
/** @type {int} */
this.notePosition = notePosition;
/** @param {boolean} */
/** @type {boolean} */
this.isExpanded = !!isExpanded;
/** @param {string} */
/** @type {string} */
this.utcDateModified = utcDateModified;
return this;
@@ -89,20 +93,27 @@ class Branch extends AbstractEntity {
const childNote = this.childNote;
const parentNote = this.parentNote;
childNote.parents.push(parentNote);
childNote.parentBranches.push(this);
if (!childNote.parents.includes(parentNote)) {
childNote.parents.push(parentNote);
}
parentNote.children.push(childNote);
if (!childNote.parentBranches.includes(this)) {
childNote.parentBranches.push(this);
}
if (!parentNote.children.includes(childNote)) {
parentNote.children.push(childNote);
}
this.becca.branches[this.branchId] = this;
this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this;
}
/** @return {Note} */
/** @returns {Note} */
get childNote() {
if (!(this.noteId in this.becca.notes)) {
// entities can come out of order in sync, create skeleton which will be filled later
this.becca.notes[this.noteId] = new Note({noteId: this.noteId});
this.becca.addNote(this.noteId, new Note({noteId: this.noteId}));
}
return this.becca.notes[this.noteId];
@@ -112,16 +123,20 @@ class Branch extends AbstractEntity {
return this.childNote;
}
/** @return {Note} */
/** @returns {Note} */
get parentNote() {
if (!(this.parentNoteId in this.becca.notes)) {
// entities can come out of order in sync, create skeleton which will be filled later
this.becca.notes[this.parentNoteId] = new Note({noteId: this.parentNoteId});
this.becca.addNote(this.parentNoteId, new Note({noteId: this.parentNoteId}));
}
return this.becca.notes[this.parentNoteId];
}
get isDeleted() {
return !(this.branchId in this.becca.branches);
}
beforeSaving() {
if (this.notePosition === undefined || this.notePosition === null) {
// TODO finding new position can be refactored into becca
@@ -177,7 +192,7 @@ module.exports = Branch;
</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="BackendScriptApi.html">BackendScriptApi</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="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">