mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
server-ts: Port becca/becca_service
This commit is contained in:
parent
3b7812f829
commit
9f99b4282a
@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
const becca = require('./becca');
|
||||
const cls = require('../services/cls');
|
||||
const log = require('../services/log');
|
||||
import becca = require('./becca');
|
||||
import cls = require('../services/cls');
|
||||
import log = require('../services/log');
|
||||
|
||||
function isNotePathArchived(notePath) {
|
||||
function isNotePathArchived(notePath: string[]) {
|
||||
const noteId = notePath[notePath.length - 1];
|
||||
const note = becca.notes[noteId];
|
||||
|
||||
@ -24,9 +24,9 @@ function isNotePathArchived(notePath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getNoteTitle(childNoteId, parentNoteId) {
|
||||
function getNoteTitle(childNoteId: string, parentNoteId?: string) {
|
||||
const childNote = becca.notes[childNoteId];
|
||||
const parentNote = becca.notes[parentNoteId];
|
||||
const parentNote = parentNoteId ? becca.notes[parentNoteId] : null;
|
||||
|
||||
if (!childNote) {
|
||||
log.info(`Cannot find note '${childNoteId}'`);
|
||||
@ -40,7 +40,7 @@ function getNoteTitle(childNoteId, parentNoteId) {
|
||||
return `${(branch && branch.prefix) ? `${branch.prefix} - ` : ''}${title}`;
|
||||
}
|
||||
|
||||
function getNoteTitleArrayForPath(notePathArray) {
|
||||
function getNoteTitleArrayForPath(notePathArray: string[]) {
|
||||
if (!notePathArray || !Array.isArray(notePathArray)) {
|
||||
throw new Error(`${notePathArray} is not an array.`);
|
||||
}
|
||||
@ -76,13 +76,13 @@ function getNoteTitleArrayForPath(notePathArray) {
|
||||
return titles;
|
||||
}
|
||||
|
||||
function getNoteTitleForPath(notePathArray) {
|
||||
function getNoteTitleForPath(notePathArray: string[]) {
|
||||
const titles = getNoteTitleArrayForPath(notePathArray);
|
||||
|
||||
return titles.join(' / ');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
export = {
|
||||
getNoteTitle,
|
||||
getNoteTitleForPath,
|
||||
isNotePathArchived
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
const beccaService = require('../../becca/becca_service.js');
|
||||
const beccaService = require('../../becca/becca_service');
|
||||
const searchService = require('../../services/search/services/search.js');
|
||||
const log = require('../../services/log');
|
||||
const utils = require('../../services/utils');
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
const beccaService = require('../../becca/becca_service.js');
|
||||
const beccaService = require('../../becca/becca_service');
|
||||
const revisionService = require('../../services/revisions');
|
||||
const utils = require('../../services/utils');
|
||||
const sql = require('../../services/sql');
|
||||
|
@ -14,7 +14,7 @@ class NoteFlatTextExp extends Expression {
|
||||
|
||||
execute(inputNoteSet, executionContext, searchContext) {
|
||||
// has deps on SQL which breaks unit test so needs to be dynamically required
|
||||
const beccaService = require('../../../becca/becca_service.js');
|
||||
const beccaService = require('../../../becca/becca_service');
|
||||
const resultNoteSet = new NoteSet();
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
const beccaService = require('../../becca/becca_service.js');
|
||||
const beccaService = require('../../becca/becca_service');
|
||||
const becca = require('../../becca/becca');
|
||||
|
||||
class SearchResult {
|
||||
|
@ -7,7 +7,7 @@ const parse = require('./parse.js');
|
||||
const SearchResult = require('../search_result.js');
|
||||
const SearchContext = require('../search_context.js');
|
||||
const becca = require('../../../becca/becca');
|
||||
const beccaService = require('../../../becca/becca_service.js');
|
||||
const beccaService = require('../../../becca/becca_service');
|
||||
const utils = require('../../utils');
|
||||
const log = require('../../log');
|
||||
const hoistedNoteService = require('../../hoisted_note.js');
|
||||
|
Loading…
x
Reference in New Issue
Block a user