jsdoc @param => @type

This commit is contained in:
zadam 2021-10-29 21:37:12 +02:00
parent 9ce224d4c5
commit da74272f13
9 changed files with 76 additions and 68 deletions

View File

@ -36,21 +36,21 @@ class Attribute extends AbstractEntity {
} }
update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) { update([attributeId, noteId, type, name, value, isInheritable, position, utcDateModified]) {
/** @param {string} */ /** @type {string} */
this.attributeId = attributeId; this.attributeId = attributeId;
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.type = type; this.type = type;
/** @param {string} */ /** @type {string} */
this.name = name; this.name = name;
/** @param {int} */ /** @type {int} */
this.position = position; this.position = position;
/** @param {string} */ /** @type {string} */
this.value = value; this.value = value;
/** @param {boolean} */ /** @type {boolean} */
this.isInheritable = !!isInheritable; this.isInheritable = !!isInheritable;
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
return this; return this;

View File

@ -35,19 +35,19 @@ class Branch extends AbstractEntity {
} }
update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) { update([branchId, noteId, parentNoteId, prefix, notePosition, isExpanded, utcDateModified]) {
/** @param {string} */ /** @type {string} */
this.branchId = branchId; this.branchId = branchId;
/** @param {string} */ /** @type {string} */
this.noteId = noteId; this.noteId = noteId;
/** @param {string} */ /** @type {string} */
this.parentNoteId = parentNoteId; this.parentNoteId = parentNoteId;
/** @param {string} */ /** @type {string} */
this.prefix = prefix; this.prefix = prefix;
/** @param {int} */ /** @type {int} */
this.notePosition = notePosition; this.notePosition = notePosition;
/** @param {boolean} */ /** @type {boolean} */
this.isExpanded = !!isExpanded; this.isExpanded = !!isExpanded;
/** @param {string} */ /** @type {string} */
this.utcDateModified = utcDateModified; this.utcDateModified = utcDateModified;
return this; return this;

View File

@ -19,29 +19,29 @@ class NoteRevision extends AbstractEntity {
constructor(row) { constructor(row) {
super(); super();
/** @param {string} */ /** @type {string} */
this.noteRevisionId = row.noteRevisionId; this.noteRevisionId = row.noteRevisionId;
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.type = row.type; this.type = row.type;
/** @param {string} */ /** @type {string} */
this.mime = row.mime; this.mime = row.mime;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!row.isProtected; this.isProtected = !!row.isProtected;
/** @param {string} */ /** @type {string} */
this.title = row.title; this.title = row.title;
/** @param {string} */ /** @type {string} */
this.dateLastEdited = row.dateLastEdited; this.dateLastEdited = row.dateLastEdited;
/** @param {string} */ /** @type {string} */
this.dateCreated = row.dateCreated; this.dateCreated = row.dateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateLastEdited = row.utcDateLastEdited; this.utcDateLastEdited = row.utcDateLastEdited;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = row.utcDateCreated; this.utcDateCreated = row.utcDateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
/** @param {number} */ /** @type {number} */
this.contentLength = row.contentLength; this.contentLength = row.contentLength;
if (this.isProtected) { if (this.isProtected) {

View File

@ -8,19 +8,19 @@ class Attribute {
} }
update(row) { update(row) {
/** @param {string} attributeId */ /** @type {string} attributeId */
this.attributeId = row.attributeId; this.attributeId = row.attributeId;
/** @param {string} noteId */ /** @type {string} noteId */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} type */ /** @type {string} type */
this.type = row.type; this.type = row.type;
/** @param {string} name */ /** @type {string} name */
this.name = row.name; this.name = row.name;
/** @param {string} value */ /** @type {string} value */
this.value = row.value; this.value = row.value;
/** @param {int} position */ /** @type {int} position */
this.position = row.position; this.position = row.position;
/** @param {boolean} isInheritable */ /** @type {boolean} isInheritable */
this.isInheritable = !!row.isInheritable; this.isInheritable = !!row.isInheritable;
} }

View File

@ -7,19 +7,19 @@ class Branch {
} }
update(row) { update(row) {
/** @param {string} primary key */ /** @type {string} primary key */
this.branchId = row.branchId; this.branchId = row.branchId;
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.parentNoteId = row.parentNoteId; this.parentNoteId = row.parentNoteId;
/** @param {int} */ /** @type {int} */
this.notePosition = row.notePosition; this.notePosition = row.notePosition;
/** @param {string} */ /** @type {string} */
this.prefix = row.prefix; this.prefix = row.prefix;
/** @param {boolean} */ /** @type {boolean} */
this.isExpanded = !!row.isExpanded; this.isExpanded = !!row.isExpanded;
/** @param {boolean} */ /** @type {boolean} */
this.fromSearchNote = !!row.fromSearchNote; this.fromSearchNote = !!row.fromSearchNote;
} }

View File

@ -3,35 +3,35 @@
*/ */
class NoteComplement { class NoteComplement {
constructor(row) { constructor(row) {
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** /**
* @param {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images) * @type {string} - can either contain the whole content (in e.g. string notes), only part (large text notes) or nothing at all (binary notes, images)
*/ */
this.content = row.content; this.content = row.content;
/** @param {int} */ /** @type {int} */
this.contentLength = row.contentLength; this.contentLength = row.contentLength;
/** @param {string} */ /** @type {string} */
this.dateCreated = row.dateCreated; this.dateCreated = row.dateCreated;
/** @param {string} */ /** @type {string} */
this.dateModified = row.dateModified; this.dateModified = row.dateModified;
/** @param {string} */ /** @type {string} */
this.utcDateCreated = row.utcDateCreated; this.utcDateCreated = row.utcDateCreated;
/** @param {string} */ /** @type {string} */
this.utcDateModified = row.utcDateModified; this.utcDateModified = row.utcDateModified;
// "combined" date modified give larger out of note's and note_content's dateModified // "combined" date modified give larger out of note's and note_content's dateModified
/** @param {string} */ /** @type {string} */
this.combinedDateModified = row.combinedDateModified; this.combinedDateModified = row.combinedDateModified;
/** @param {string} */ /** @type {string} */
this.combinedUtcDateModified = row.combinedUtcDateModified; this.combinedUtcDateModified = row.combinedUtcDateModified;
} }
} }

View File

@ -53,15 +53,15 @@ class NoteShort {
} }
update(row) { update(row) {
/** @param {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
/** @param {string} */ /** @type {string} */
this.title = row.title; this.title = row.title;
/** @param {boolean} */ /** @type {boolean} */
this.isProtected = !!row.isProtected; this.isProtected = !!row.isProtected;
/** @param {string} one of 'text', 'code', 'file' or 'render' */ /** @type {string} one of 'text', 'code', 'file' or 'render' */
this.type = row.type; this.type = row.type;
/** @param {string} content-type, e.g. "application/json" */ /** @type {string} content-type, e.g. "application/json" */
this.mime = row.mime; this.mime = row.mime;
} }
@ -678,7 +678,7 @@ class NoteShort {
return await this.froca.getNoteComplement(this.noteId); return await this.froca.getNoteComplement(this.noteId);
} }
get toString() { toString() {
return `Note(noteId=${this.noteId}, title=${this.title})`; return `Note(noteId=${this.noteId}, title=${this.title})`;
} }

View File

@ -106,6 +106,10 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
const someNotePathSegments = getSomeNotePathSegments(note, hoistedNoteId); const someNotePathSegments = getSomeNotePathSegments(note, hoistedNoteId);
if (!someNotePathSegments) {
throw new Error(`Did not find any path segments for ${note.toString()}, hoisted note ${hoistedNoteId}`);
}
// if there isn't actually any note path with hoisted note then return the original resolved note path // if there isn't actually any note path with hoisted note then return the original resolved note path
return someNotePathSegments.includes(hoistedNoteId) ? someNotePathSegments : effectivePathSegments; return someNotePathSegments.includes(hoistedNoteId) ? someNotePathSegments : effectivePathSegments;
} }

View File

@ -33,6 +33,7 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget {
constructor() { constructor() {
super(); super();
/** @type {AttributeDetailWidget} */
this.attributeDetailWidget = new AttributeDetailWidget().setParent(this); this.attributeDetailWidget = new AttributeDetailWidget().setParent(this);
this.child(this.attributeDetailWidget); this.child(this.attributeDetailWidget);
} }
@ -65,18 +66,21 @@ export default class InheritedAttributesWidget extends NoteContextAwareWidget {
for (const attribute of inheritedAttributes) { for (const attribute of inheritedAttributes) {
const $attr = (await attributeRenderer.renderAttribute(attribute, false)) const $attr = (await attributeRenderer.renderAttribute(attribute, false))
.on('click', e => this.attributeDetailWidget.showAttributeDetail({ .on('click', e => {
attribute: { setTimeout(() =>
noteId: attribute.noteId, this.attributeDetailWidget.showAttributeDetail({
type: attribute.type, attribute: {
name: attribute.name, noteId: attribute.noteId,
value: attribute.value, type: attribute.type,
isInheritable: attribute.isInheritable name: attribute.name,
}, value: attribute.value,
isOwned: false, isInheritable: attribute.isInheritable
x: e.pageX, },
y: e.pageY isOwned: false,
})); x: e.pageX,
y: e.pageY
}), 100);
});
this.$container this.$container
.append($attr) .append($attr)