rename froca entities to have F-prefix, #3476

This commit is contained in:
zadam 2023-01-03 13:35:10 +01:00
parent 957640f163
commit 977a47bc27
14 changed files with 91 additions and 96 deletions

View File

@ -140,7 +140,7 @@ class NoteContext extends Component {
return resolvedNotePath; return resolvedNotePath;
} }
/** @property {NoteShort} */ /** @property {FNote} */
get note() { get note() {
if (!this.noteId || !(this.noteId in froca.notes)) { if (!this.noteId || !(this.noteId in froca.notes)) {
return null; return null;
@ -154,7 +154,7 @@ class NoteContext extends Component {
return this.notePath ? this.notePath.split('/') : []; return this.notePath ? this.notePath.split('/') : [];
} }
/** @returns {NoteComplement} */ /** @returns {FNoteComplement} */
async getNoteComplement() { async getNoteComplement() {
if (!this.noteId) { if (!this.noteId) {
return null; return null;

View File

@ -181,7 +181,7 @@ export default class TabManager extends Component {
return activeContext ? activeContext.notePath : null; return activeContext ? activeContext.notePath : null;
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
getActiveContextNote() { getActiveContextNote() {
const activeContext = this.getActiveContext(); const activeContext = this.getActiveContext();
return activeContext ? activeContext.note : null; return activeContext ? activeContext.note : null;

View File

@ -4,7 +4,7 @@ import promotedAttributeDefinitionParser from '../services/promoted_attribute_de
* Attribute is an abstract concept which has two real uses - label (key - value pair) * Attribute is an abstract concept which has two real uses - label (key - value pair)
* and relation (representing named relationship between source and target note) * and relation (representing named relationship between source and target note)
*/ */
class Attribute { class FAttribute {
constructor(froca, row) { constructor(froca, row) {
this.froca = froca; this.froca = froca;
@ -28,12 +28,12 @@ class Attribute {
this.isInheritable = !!row.isInheritable; this.isInheritable = !!row.isInheritable;
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
getNote() { getNote() {
return this.froca.notes[this.noteId]; return this.froca.notes[this.noteId];
} }
/** @returns {Promise<NoteShort>} */ /** @returns {Promise<FNote>} */
async getTargetNote() { async getTargetNote() {
const targetNoteId = this.targetNoteId; const targetNoteId = this.targetNoteId;
@ -42,7 +42,7 @@ class Attribute {
get targetNoteId() { // alias get targetNoteId() { // alias
if (this.type !== 'relation') { if (this.type !== 'relation') {
throw new Error(`Attribute ${this.attributeId} is not a relation`); throw new Error(`FAttribute ${this.attributeId} is not a relation`);
} }
return this.value; return this.value;
@ -53,7 +53,7 @@ class Attribute {
} }
get toString() { get toString() {
return `Attribute(attributeId=${this.attributeId}, type=${this.type}, name=${this.name}, value=${this.value})`; return `FAttribute(attributeId=${this.attributeId}, type=${this.type}, name=${this.name}, value=${this.value})`;
} }
isDefinition() { isDefinition() {
@ -76,4 +76,4 @@ class Attribute {
} }
} }
export default Attribute; export default FAttribute;

View File

@ -2,7 +2,7 @@
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
* parents. * parents.
*/ */
class Branch { class FBranch {
constructor(froca, row) { constructor(froca, row) {
this.froca = froca; this.froca = froca;
@ -29,17 +29,17 @@ class Branch {
this.fromSearchNote = !!row.fromSearchNote; this.fromSearchNote = !!row.fromSearchNote;
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async getNote() { async getNote() {
return this.froca.getNote(this.noteId); return this.froca.getNote(this.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
getNoteFromCache() { getNoteFromCache() {
return this.froca.getNoteFromCache(this.noteId); return this.froca.getNoteFromCache(this.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async getParentNote() { async getParentNote() {
return this.froca.getNote(this.parentNoteId); return this.froca.getNote(this.parentNoteId);
} }
@ -50,7 +50,7 @@ class Branch {
} }
get toString() { get toString() {
return `Branch(branchId=${this.branchId})`; return `FBranch(branchId=${this.branchId})`;
} }
get pojo() { get pojo() {
@ -60,4 +60,4 @@ class Branch {
} }
} }
export default Branch; export default FBranch;

View File

@ -26,12 +26,7 @@ const NOTE_TYPE_ICONS = {
"contentWidget": "bx bxs-widget" "contentWidget": "bx bxs-widget"
}; };
/** class FNote {
* FIXME: since there's no "full note" anymore we can rename this to Note
*
* This note's representation is used in note tree and is kept in Froca.
*/
class NoteShort {
/** /**
* @param {Froca} froca * @param {Froca} froca
* @param {Object.<string, Object>} row * @param {Object.<string, Object>} row
@ -153,7 +148,7 @@ class NoteShort {
} }
/** /**
* @returns {Branch[]} * @returns {FBranch[]}
*/ */
getParentBranches() { getParentBranches() {
const branchIds = Object.values(this.parentToBranch); const branchIds = Object.values(this.parentToBranch);
@ -162,7 +157,7 @@ class NoteShort {
} }
/** /**
* @returns {Branch[]} * @returns {FBranch[]}
* @deprecated use getParentBranches() instead * @deprecated use getParentBranches() instead
*/ */
getBranches() { getBranches() {
@ -174,7 +169,7 @@ class NoteShort {
return this.children.length > 0; return this.children.length > 0;
} }
/** @returns {Branch[]} */ /** @returns {FBranch[]} */
getChildBranches() { getChildBranches() {
// don't use Object.values() to guarantee order // don't use Object.values() to guarantee order
const branchIds = this.children.map(childNoteId => this.childToBranch[childNoteId]); const branchIds = this.children.map(childNoteId => this.childToBranch[childNoteId]);
@ -187,7 +182,7 @@ class NoteShort {
return this.parents; return this.parents;
} }
/** @returns {NoteShort[]} */ /** @returns {FNote[]} */
getParentNotes() { getParentNotes() {
return this.froca.getNotesFromCache(this.parents); return this.froca.getNotesFromCache(this.parents);
} }
@ -217,7 +212,7 @@ class NoteShort {
return this.children; return this.children;
} }
/** @returns {Promise<NoteShort[]>} */ /** @returns {Promise<FNote[]>} */
async getChildNotes() { async getChildNotes() {
return await this.froca.getNotes(this.children); return await this.froca.getNotes(this.children);
} }
@ -225,7 +220,7 @@ class NoteShort {
/** /**
* @param {string} [type] - (optional) attribute type to filter * @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter * @param {string} [name] - (optional) attribute name to filter
* @returns {Attribute[]} all note's attributes, including inherited ones * @returns {FAttribute[]} all note's attributes, including inherited ones
*/ */
getOwnedAttributes(type, name) { getOwnedAttributes(type, name) {
const attrs = this.attributes const attrs = this.attributes
@ -238,7 +233,7 @@ class NoteShort {
/** /**
* @param {string} [type] - (optional) attribute type to filter * @param {string} [type] - (optional) attribute type to filter
* @param {string} [name] - (optional) attribute name to filter * @param {string} [name] - (optional) attribute name to filter
* @returns {Attribute[]} all note's attributes, including inherited ones * @returns {FAttribute[]} all note's attributes, including inherited ones
*/ */
getAttributes(type, name) { getAttributes(type, name) {
return this.__filterAttrs(this.__getCachedAttributes([]), type, name); return this.__filterAttrs(this.__getCachedAttributes([]), type, name);
@ -399,7 +394,7 @@ class NoteShort {
/** /**
* @param {string} [name] - label name to filter * @param {string} [name] - label name to filter
* @returns {Attribute[]} all note's labels (attributes with type label), including inherited ones * @returns {FAttribute[]} all note's labels (attributes with type label), including inherited ones
*/ */
getOwnedLabels(name) { getOwnedLabels(name) {
return this.getOwnedAttributes(LABEL, name); return this.getOwnedAttributes(LABEL, name);
@ -407,7 +402,7 @@ class NoteShort {
/** /**
* @param {string} [name] - label name to filter * @param {string} [name] - label name to filter
* @returns {Attribute[]} all note's labels (attributes with type label), including inherited ones * @returns {FAttribute[]} all note's labels (attributes with type label), including inherited ones
*/ */
getLabels(name) { getLabels(name) {
return this.getAttributes(LABEL, name); return this.getAttributes(LABEL, name);
@ -480,7 +475,7 @@ class NoteShort {
/** /**
* @param {string} [name] - relation name to filter * @param {string} [name] - relation name to filter
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones * @returns {FAttribute[]} all note's relations (attributes with type relation), including inherited ones
*/ */
getOwnedRelations(name) { getOwnedRelations(name) {
return this.getOwnedAttributes(RELATION, name); return this.getOwnedAttributes(RELATION, name);
@ -488,7 +483,7 @@ class NoteShort {
/** /**
* @param {string} [name] - relation name to filter * @param {string} [name] - relation name to filter
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones * @returns {FAttribute[]} all note's relations (attributes with type relation), including inherited ones
*/ */
getRelations(name) { getRelations(name) {
return this.getAttributes(RELATION, name); return this.getAttributes(RELATION, name);
@ -515,7 +510,7 @@ class NoteShort {
/** /**
* @param {string} type - attribute type (label, relation, etc.) * @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name * @param {string} name - attribute name
* @returns {Attribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note. * @returns {FAttribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
*/ */
getOwnedAttribute(type, name) { getOwnedAttribute(type, name) {
const attributes = this.getOwnedAttributes(type, name); const attributes = this.getOwnedAttributes(type, name);
@ -526,7 +521,7 @@ class NoteShort {
/** /**
* @param {string} type - attribute type (label, relation, etc.) * @param {string} type - attribute type (label, relation, etc.)
* @param {string} name - attribute name * @param {string} name - attribute name
* @returns {Attribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note. * @returns {FAttribute} attribute of given type and name. If there's more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.
*/ */
getAttribute(type, name) { getAttribute(type, name) {
const attributes = this.getAttributes(type, name); const attributes = this.getAttributes(type, name);
@ -582,25 +577,25 @@ class NoteShort {
/** /**
* @param {string} name - label name * @param {string} name - label name
* @returns {Attribute} label if it exists, null otherwise * @returns {FAttribute} label if it exists, null otherwise
*/ */
getOwnedLabel(name) { return this.getOwnedAttribute(LABEL, name); } getOwnedLabel(name) { return this.getOwnedAttribute(LABEL, name); }
/** /**
* @param {string} name - label name * @param {string} name - label name
* @returns {Attribute} label if it exists, null otherwise * @returns {FAttribute} label if it exists, null otherwise
*/ */
getLabel(name) { return this.getAttribute(LABEL, name); } getLabel(name) { return this.getAttribute(LABEL, name); }
/** /**
* @param {string} name - relation name * @param {string} name - relation name
* @returns {Attribute} relation if it exists, null otherwise * @returns {FAttribute} relation if it exists, null otherwise
*/ */
getOwnedRelation(name) { return this.getOwnedAttribute(RELATION, name); } getOwnedRelation(name) { return this.getOwnedAttribute(RELATION, name); }
/** /**
* @param {string} name - relation name * @param {string} name - relation name
* @returns {Attribute} relation if it exists, null otherwise * @returns {FAttribute} relation if it exists, null otherwise
*/ */
getRelation(name) { return this.getAttribute(RELATION, name); } getRelation(name) { return this.getAttribute(RELATION, name); }
@ -630,7 +625,7 @@ class NoteShort {
/** /**
* @param {string} name * @param {string} name
* @returns {Promise<NoteShort>|null} target note of the relation or null (if target is empty or note was not found) * @returns {Promise<FNote>|null} target note of the relation or null (if target is empty or note was not found)
*/ */
async getRelationTarget(name) { async getRelationTarget(name) {
const targets = await this.getRelationTargets(name); const targets = await this.getRelationTargets(name);
@ -640,7 +635,7 @@ class NoteShort {
/** /**
* @param {string} [name] - relation name to filter * @param {string} [name] - relation name to filter
* @returns {Promise<NoteShort[]>} * @returns {Promise<FNote[]>}
*/ */
async getRelationTargets(name) { async getRelationTargets(name) {
const relations = this.getRelations(name); const relations = this.getRelations(name);
@ -654,7 +649,7 @@ class NoteShort {
} }
/** /**
* @returns {NoteShort[]} * @returns {FNote[]}
*/ */
getTemplateNotes() { getTemplateNotes() {
const relations = this.getRelations('template'); const relations = this.getRelations('template');
@ -722,7 +717,7 @@ class NoteShort {
/** /**
* Get relations which target this note * Get relations which target this note
* *
* @returns {Attribute[]} * @returns {FAttribute[]}
*/ */
getTargetRelations() { getTargetRelations() {
return this.targetRelations return this.targetRelations
@ -732,7 +727,7 @@ class NoteShort {
/** /**
* Get relations which target this note * Get relations which target this note
* *
* @returns {NoteShort[]} * @returns {FNote[]}
*/ */
async getTargetRelationSourceNotes() { async getTargetRelationSourceNotes() {
const targetRelations = this.getTargetRelations(); const targetRelations = this.getTargetRelations();
@ -743,7 +738,7 @@ class NoteShort {
/** /**
* Return note complement which is most importantly note's content * Return note complement which is most importantly note's content
* *
* @return {Promise<NoteComplement>} * @return {Promise<FNoteComplement>}
*/ */
async getNoteComplement() { async getNoteComplement() {
return await this.froca.getNoteComplement(this.noteId); return await this.froca.getNoteComplement(this.noteId);
@ -857,4 +852,4 @@ class NoteShort {
} }
} }
export default NoteShort; export default FNote;

View File

@ -1,7 +1,7 @@
/** /**
* Complements the NoteShort with the main note content and other extra attributes * Complements the FNote with the main note content and other extra attributes
*/ */
class NoteComplement { class FNoteComplement {
constructor(row) { constructor(row) {
/** @type {string} */ /** @type {string} */
this.noteId = row.noteId; this.noteId = row.noteId;
@ -37,4 +37,4 @@ class NoteComplement {
} }
} }
export default NoteComplement; export default FNoteComplement;

View File

@ -2,19 +2,19 @@ import froca from "./froca.js";
import server from "./server.js"; import server from "./server.js";
import ws from "./ws.js"; import ws from "./ws.js";
/** @returns {NoteShort} */ /** @returns {FNote} */
async function getInboxNote() { async function getInboxNote() {
const note = await server.get(`special-notes/inbox/${dayjs().format("YYYY-MM-DD")}`, "date-note"); const note = await server.get(`special-notes/inbox/${dayjs().format("YYYY-MM-DD")}`, "date-note");
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async function getTodayNote() { async function getTodayNote() {
return await getDayNote(dayjs().format("YYYY-MM-DD")); return await getDayNote(dayjs().format("YYYY-MM-DD"));
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async function getDayNote(date) { async function getDayNote(date) {
const note = await server.get(`special-notes/days/${date}`, "date-note"); const note = await server.get(`special-notes/days/${date}`, "date-note");
@ -23,7 +23,7 @@ async function getDayNote(date) {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async function getWeekNote(date) { async function getWeekNote(date) {
const note = await server.get(`special-notes/weeks/${date}`, "date-note"); const note = await server.get(`special-notes/weeks/${date}`, "date-note");
@ -32,7 +32,7 @@ async function getWeekNote(date) {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async function getMonthNote(month) { async function getMonthNote(month) {
const note = await server.get(`special-notes/months/${month}`, "date-note"); const note = await server.get(`special-notes/months/${month}`, "date-note");
@ -41,7 +41,7 @@ async function getMonthNote(month) {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async function getYearNote(year) { async function getYearNote(year) {
const note = await server.get(`special-notes/years/${year}`, "date-note"); const note = await server.get(`special-notes/years/${year}`, "date-note");
@ -50,7 +50,7 @@ async function getYearNote(year) {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async function createSqlConsole() { async function createSqlConsole() {
const note = await server.post('special-notes/sql-console'); const note = await server.post('special-notes/sql-console');
@ -59,7 +59,7 @@ async function createSqlConsole() {
return await froca.getNote(note.noteId); return await froca.getNote(note.noteId);
} }
/** @returns {NoteShort} */ /** @returns {FNote} */
async function createSearchNote(opts = {}) { async function createSearchNote(opts = {}) {
const note = await server.post('special-notes/search-note', opts); const note = await server.post('special-notes/search-note', opts);

View File

@ -1,9 +1,9 @@
import Branch from "../entities/branch.js"; import FBranch from "../entities/fbranch.js";
import NoteShort from "../entities/note_short.js"; import FNote from "../entities/fnote.js";
import Attribute from "../entities/attribute.js"; import FAttribute from "../entities/fattribute.js";
import server from "./server.js"; import server from "./server.js";
import appContext from "../components/app_context.js"; import appContext from "../components/app_context.js";
import NoteComplement from "../entities/note_complement.js"; import FNoteComplement from "../entities/fnote_complement.js";
/** /**
* Froca (FROntend CAche) keeps a read only cache of note tree structure in frontend's memory. * Froca (FROntend CAche) keeps a read only cache of note tree structure in frontend's memory.
@ -25,16 +25,16 @@ class Froca {
// clear the cache only directly before adding new content which is important for e.g. switching to protected session // clear the cache only directly before adding new content which is important for e.g. switching to protected session
/** @type {Object.<string, NoteShort>} */ /** @type {Object.<string, FNote>} */
this.notes = {}; this.notes = {};
/** @type {Object.<string, Branch>} */ /** @type {Object.<string, FBranch>} */
this.branches = {}; this.branches = {};
/** @type {Object.<string, Attribute>} */ /** @type {Object.<string, FAttribute>} */
this.attributes = {}; this.attributes = {};
/** @type {Object.<string, Promise<NoteComplement>>} */ /** @type {Object.<string, Promise<FNoteComplement>>} */
this.noteComplementPromises = {}; this.noteComplementPromises = {};
this.addResp(resp); this.addResp(resp);
@ -103,12 +103,12 @@ class Froca {
}); });
} }
else { else {
this.notes[noteId] = new NoteShort(this, noteRow); this.notes[noteId] = new FNote(this, noteRow);
} }
} }
for (const branchRow of branchRows) { for (const branchRow of branchRows) {
const branch = new Branch(this, branchRow); const branch = new FBranch(this, branchRow);
this.branches[branch.branchId] = branch; this.branches[branch.branchId] = branch;
@ -130,7 +130,7 @@ class Froca {
for (const attributeRow of attributeRows) { for (const attributeRow of attributeRows) {
const {attributeId} = attributeRow; const {attributeId} = attributeRow;
this.attributes[attributeId] = new Attribute(this, attributeRow); this.attributes[attributeId] = new FAttribute(this, attributeRow);
const note = this.notes[attributeRow.noteId]; const note = this.notes[attributeRow.noteId];
@ -212,7 +212,7 @@ class Froca {
return {error}; return {error};
} }
/** @returns {NoteShort[]} */ /** @returns {FNote[]} */
getNotesFromCache(noteIds, silentNotFoundError = false) { getNotesFromCache(noteIds, silentNotFoundError = false) {
return noteIds.map(noteId => { return noteIds.map(noteId => {
if (!this.notes[noteId] && !silentNotFoundError) { if (!this.notes[noteId] && !silentNotFoundError) {
@ -226,7 +226,7 @@ class Froca {
}).filter(note => !!note); }).filter(note => !!note);
} }
/** @returns {Promise<NoteShort[]>} */ /** @returns {Promise<FNote[]>} */
async getNotes(noteIds, silentNotFoundError = false) { async getNotes(noteIds, silentNotFoundError = false) {
noteIds = Array.from(new Set(noteIds)); // make unique noteIds = Array.from(new Set(noteIds)); // make unique
const missingNoteIds = noteIds.filter(noteId => !this.notes[noteId]); const missingNoteIds = noteIds.filter(noteId => !this.notes[noteId]);
@ -251,7 +251,7 @@ class Froca {
return notes.length === 1; return notes.length === 1;
} }
/** @returns {Promise<NoteShort>} */ /** @returns {Promise<FNote>} */
async getNote(noteId, silentNotFoundError = false) { async getNote(noteId, silentNotFoundError = false) {
if (noteId === 'none') { if (noteId === 'none') {
console.trace(`No 'none' note.`); console.trace(`No 'none' note.`);
@ -265,7 +265,7 @@ class Froca {
return (await this.getNotes([noteId], silentNotFoundError))[0]; return (await this.getNotes([noteId], silentNotFoundError))[0];
} }
/** @returns {Note|null} */ /** @returns {FNote|null} */
getNoteFromCache(noteId) { getNoteFromCache(noteId) {
if (!noteId) { if (!noteId) {
throw new Error("Empty noteId"); throw new Error("Empty noteId");
@ -274,14 +274,14 @@ class Froca {
return this.notes[noteId]; return this.notes[noteId];
} }
/** @returns {Branch[]} */ /** @returns {FBranch[]} */
getBranches(branchIds, silentNotFoundError = false) { getBranches(branchIds, silentNotFoundError = false) {
return branchIds return branchIds
.map(branchId => this.getBranch(branchId, silentNotFoundError)) .map(branchId => this.getBranch(branchId, silentNotFoundError))
.filter(b => !!b); .filter(b => !!b);
} }
/** @returns {Branch} */ /** @returns {FBranch} */
getBranch(branchId, silentNotFoundError = false) { getBranch(branchId, silentNotFoundError = false) {
if (!(branchId in this.branches)) { if (!(branchId in this.branches)) {
if (!silentNotFoundError) { if (!silentNotFoundError) {
@ -310,12 +310,12 @@ class Froca {
} }
/** /**
* @return {Promise<NoteComplement>} * @return {Promise<FNoteComplement>}
*/ */
async getNoteComplement(noteId) { async getNoteComplement(noteId) {
if (!this.noteComplementPromises[noteId]) { if (!this.noteComplementPromises[noteId]) {
this.noteComplementPromises[noteId] = server.get(`notes/${noteId}`) this.noteComplementPromises[noteId] = server.get(`notes/${noteId}`)
.then(row => new NoteComplement(row)) .then(row => new FNoteComplement(row))
.catch(e => console.error(`Cannot get note complement for note '${noteId}'`)); .catch(e => console.error(`Cannot get note complement for note '${noteId}'`));
// we don't want to keep large payloads forever in memory so we clean that up quite quickly // we don't want to keep large payloads forever in memory so we clean that up quite quickly

View File

@ -3,8 +3,8 @@ import froca from "./froca.js";
import utils from "./utils.js"; import utils from "./utils.js";
import options from "./options.js"; import options from "./options.js";
import noteAttributeCache from "./note_attribute_cache.js"; import noteAttributeCache from "./note_attribute_cache.js";
import Branch from "../entities/branch.js"; import FBranch from "../entities/fbranch.js";
import Attribute from "../entities/attribute.js"; import FAttribute from "../entities/fattribute.js";
async function processEntityChanges(entityChanges) { async function processEntityChanges(entityChanges) {
const loadResults = new LoadResults(entityChanges); const loadResults = new LoadResults(entityChanges);
@ -145,7 +145,7 @@ function processBranchChange(loadResults, ec) {
branch.update(ec.entity); branch.update(ec.entity);
} }
else if (childNote || parentNote) { else if (childNote || parentNote) {
froca.branches[ec.entityId] = branch = new Branch(froca, ec.entity); froca.branches[ec.entityId] = branch = new FBranch(froca, ec.entity);
} }
if (childNote) { if (childNote) {
@ -218,7 +218,7 @@ function processAttributeChange(loadResults, ec) {
if (attribute) { if (attribute) {
attribute.update(ec.entity); attribute.update(ec.entity);
} else if (sourceNote || targetNote) { } else if (sourceNote || targetNote) {
attribute = new Attribute(froca, ec.entity); attribute = new FAttribute(froca, ec.entity);
froca.attributes[attribute.attributeId] = attribute; froca.attributes[attribute.attributeId] = attribute;

View File

@ -208,7 +208,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @method * @method
* @param {string} searchString * @param {string} searchString
* @returns {Promise<NoteShort[]>} * @returns {Promise<FNote[]>}
*/ */
this.searchForNotes = async searchString => { this.searchForNotes = async searchString => {
return await searchService.searchForNotes(searchString); return await searchService.searchForNotes(searchString);
@ -220,7 +220,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @method * @method
* @param {string} searchString * @param {string} searchString
* @returns {Promise<NoteShort|null>} * @returns {Promise<FNote|null>}
*/ */
this.searchForNote = async searchString => { this.searchForNote = async searchString => {
const notes = await this.searchForNotes(searchString); const notes = await this.searchForNotes(searchString);
@ -232,7 +232,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* Returns note by given noteId. If note is missing from cache, it's loaded. * Returns note by given noteId. If note is missing from cache, it's loaded.
** **
* @param {string} noteId * @param {string} noteId
* @return {Promise<NoteShort>} * @return {Promise<FNote>}
*/ */
this.getNote = async noteId => await froca.getNote(noteId); this.getNote = async noteId => await froca.getNote(noteId);
@ -244,7 +244,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @param {string[]} noteIds * @param {string[]} noteIds
* @param {boolean} [silentNotFoundError] - don't report error if the note is not found * @param {boolean} [silentNotFoundError] - don't report error if the note is not found
* @return {Promise<NoteShort[]>} * @return {Promise<FNote[]>}
*/ */
this.getNotes = async (noteIds, silentNotFoundError = false) => await froca.getNotes(noteIds, silentNotFoundError); this.getNotes = async (noteIds, silentNotFoundError = false) => await froca.getNotes(noteIds, silentNotFoundError);
@ -355,7 +355,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
/** /**
* @method * @method
* @deprecated use getActiveContextNote() instead * @deprecated use getActiveContextNote() instead
* @returns {NoteShort} active note (loaded into right pane) * @returns {FNote} active note (loaded into right pane)
*/ */
this.getActiveTabNote = () => { this.getActiveTabNote = () => {
console.warn("api.getActiveTabNote() is deprecated, use getActiveContextNote() instead."); console.warn("api.getActiveTabNote() is deprecated, use getActiveContextNote() instead.");
@ -365,7 +365,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
/** /**
* @method * @method
* @returns {NoteShort} active note (loaded into right pane) * @returns {FNote} active note (loaded into right pane)
*/ */
this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote(); this.getActiveContextNote = () => appContext.tabManager.getActiveContextNote();
@ -471,7 +471,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* Returns date-note for today. If it doesn't exist, it is automatically created. * Returns date-note for today. If it doesn't exist, it is automatically created.
* *
* @method * @method
* @return {Promise<NoteShort>} * @return {Promise<FNote>}
*/ */
this.getTodayNote = dateNotesService.getTodayNote; this.getTodayNote = dateNotesService.getTodayNote;
@ -480,7 +480,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @method * @method
* @param {string} date - e.g. "2019-04-29" * @param {string} date - e.g. "2019-04-29"
* @return {Promise<NoteShort>} * @return {Promise<FNote>}
* @deprecated use getDayNote instead * @deprecated use getDayNote instead
*/ */
this.getDateNote = dateNotesService.getDayNote; this.getDateNote = dateNotesService.getDayNote;
@ -490,7 +490,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @method * @method
* @param {string} date - e.g. "2019-04-29" * @param {string} date - e.g. "2019-04-29"
* @return {Promise<NoteShort>} * @return {Promise<FNote>}
*/ */
this.getDayNote = dateNotesService.getDayNote; this.getDayNote = dateNotesService.getDayNote;
@ -499,7 +499,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @method * @method
* @param {string} date - e.g. "2019-04-29" * @param {string} date - e.g. "2019-04-29"
* @return {Promise<NoteShort>} * @return {Promise<FNote>}
*/ */
this.getWeekNote = dateNotesService.getWeekNote; this.getWeekNote = dateNotesService.getWeekNote;
@ -508,7 +508,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @method * @method
* @param {string} month - e.g. "2019-04" * @param {string} month - e.g. "2019-04"
* @return {Promise<NoteShort>} * @return {Promise<FNote>}
*/ */
this.getMonthNote = dateNotesService.getMonthNote; this.getMonthNote = dateNotesService.getMonthNote;
@ -517,7 +517,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain
* *
* @method * @method
* @param {string} year - e.g. "2019" * @param {string} year - e.g. "2019"
* @return {Promise<NoteShort>} * @return {Promise<FNote>}
*/ */
this.getYearNote = dateNotesService.getYearNote; this.getYearNote = dateNotesService.getYearNote;

View File

@ -65,7 +65,7 @@ export default class LoadResults {
this.attributes.push({attributeId, componentId}); this.attributes.push({attributeId, componentId});
} }
/** @returns {Attribute[]} */ /** @returns {FAttribute[]} */
getAttributes(componentId = 'none') { getAttributes(componentId = 'none') {
return this.attributes return this.attributes
.filter(row => row.componentId !== componentId) .filter(row => row.componentId !== componentId)

View File

@ -8,7 +8,7 @@ export default class AbstractLauncher extends OnClickButtonWidget {
this.class("launcher-button"); this.class("launcher-button");
/** @type {NoteShort} */ /** @type {FNote} */
this.launcherNote = launcherNote; this.launcherNote = launcherNote;
for (const label of launcherNote.getOwnedLabels('keyboardShortcut')) { for (const label of launcherNote.getOwnedLabels('keyboardShortcut')) {

View File

@ -641,7 +641,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
} }
/** /**
* @param {NoteShort} parentNote * @param {FNote} parentNote
*/ */
prepareChildren(parentNote) { prepareChildren(parentNote) {
utils.assertArguments(parentNote); utils.assertArguments(parentNote);
@ -704,7 +704,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
} }
/** /**
* @param {Branch} branch * @param {FBranch} branch
* @param {boolean} forceLazy * @param {boolean} forceLazy
*/ */
prepareNode(branch, forceLazy = false) { prepareNode(branch, forceLazy = false) {

View File

@ -12,7 +12,7 @@ export default class TypeWidget extends NoteContextAwareWidget {
} }
/** /**
* @param {NoteShort} note * @param {FNote} note
*/ */
async doRefresh(note) {} async doRefresh(note) {}