mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
wip conversion to ES modules
This commit is contained in:
parent
5205800720
commit
14d16a99d4
21
package-lock.json
generated
21
package-lock.json
generated
@ -41,6 +41,7 @@
|
||||
"http-proxy-agent": "7.0.0",
|
||||
"https-proxy-agent": "7.0.2",
|
||||
"image-type": "4.1.0",
|
||||
"import-sync": "^2.1.2",
|
||||
"ini": "3.0.1",
|
||||
"is-animated": "2.0.2",
|
||||
"is-svg": "4.3.2",
|
||||
@ -5540,7 +5541,6 @@
|
||||
"version": "3.2.25",
|
||||
"resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz",
|
||||
"integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
@ -7278,6 +7278,14 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/import-sync": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/import-sync/-/import-sync-2.1.2.tgz",
|
||||
"integrity": "sha512-Zz48pnwt7D6HWI/OV2J8FRCtalVJYWvQiJDEatimu9CcqEpNJNYmij9FfY+PktWHgGzTR+Bs9igYxRbKdyMaTQ==",
|
||||
"dependencies": {
|
||||
"esm": "^3.2.25"
|
||||
}
|
||||
},
|
||||
"node_modules/imurmurhash": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
@ -17848,8 +17856,7 @@
|
||||
"esm": {
|
||||
"version": "3.2.25",
|
||||
"resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz",
|
||||
"integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA=="
|
||||
},
|
||||
"espree": {
|
||||
"version": "9.6.1",
|
||||
@ -19136,6 +19143,14 @@
|
||||
"resolve-cwd": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"import-sync": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/import-sync/-/import-sync-2.1.2.tgz",
|
||||
"integrity": "sha512-Zz48pnwt7D6HWI/OV2J8FRCtalVJYWvQiJDEatimu9CcqEpNJNYmij9FfY+PktWHgGzTR+Bs9igYxRbKdyMaTQ==",
|
||||
"requires": {
|
||||
"esm": "^3.2.25"
|
||||
}
|
||||
},
|
||||
"imurmurhash": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
|
@ -68,6 +68,7 @@
|
||||
"http-proxy-agent": "7.0.0",
|
||||
"https-proxy-agent": "7.0.2",
|
||||
"image-type": "4.1.0",
|
||||
"import-sync": "^2.1.2",
|
||||
"ini": "3.0.1",
|
||||
"is-animated": "2.0.2",
|
||||
"is-svg": "4.3.2",
|
||||
|
@ -1,16 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../services/sql.js'
|
||||
import NoteSet from '../services/search/note_set.js'
|
||||
import NotFoundError from '../errors/not_found_error.js'
|
||||
|
||||
import BRevision from './entities/brevision.js' // avoiding circular dependency problems
|
||||
|
||||
import BAttachment from './entities/battachment.js' // avoiding circular dependency problems
|
||||
|
||||
import BBlob from './entities/bblob.js' // avoiding circular dependency problems
|
||||
|
||||
import BRecentNote from './entities/brecent_note.js' // avoiding circular dependency problems
|
||||
import importSync from "import-sync";
|
||||
|
||||
/**
|
||||
* Becca is a backend cache of all notes, branches, and attributes.
|
||||
@ -155,6 +146,7 @@ class Becca {
|
||||
/** @returns {BRevision|null} */
|
||||
getRevision(revisionId) {
|
||||
const row = sql.getRow("SELECT * FROM revisions WHERE revisionId = ?", [revisionId]);
|
||||
const BRevision = importSync('./entities/brevision.js');
|
||||
return row ? new BRevision(row) : null;
|
||||
}
|
||||
|
||||
@ -168,6 +160,7 @@ class Becca {
|
||||
JOIN blobs USING (blobId)
|
||||
WHERE attachmentId = ? AND isDeleted = 0`
|
||||
: `SELECT * FROM attachments WHERE attachmentId = ? AND isDeleted = 0`;
|
||||
const BAttachment = importSync('./entities/battachment.js');
|
||||
return sql.getRows(query, [attachmentId])
|
||||
.map(row => new BAttachment(row))[0];
|
||||
}
|
||||
@ -183,7 +176,7 @@ class Becca {
|
||||
|
||||
/** @returns {BAttachment[]} */
|
||||
getAttachments(attachmentIds) {
|
||||
// avoiding circular dependency problems
|
||||
const BAttachment = importSync('./entities/battachment.js');
|
||||
return sql.getManyRows("SELECT * FROM attachments WHERE attachmentId IN (???) AND isDeleted = 0", attachmentIds)
|
||||
.map(row => new BAttachment(row));
|
||||
}
|
||||
@ -191,6 +184,7 @@ class Becca {
|
||||
/** @returns {BBlob|null} */
|
||||
getBlob(entity) {
|
||||
const row = sql.getRow("SELECT *, LENGTH(content) AS contentLength FROM blobs WHERE blobId = ?", [entity.blobId]);
|
||||
const BBlob = importSync('./entities/bblob.js');
|
||||
return row ? new BBlob(row) : null;
|
||||
}
|
||||
|
||||
@ -238,12 +232,14 @@ class Becca {
|
||||
/** @returns {BRecentNote[]} */
|
||||
getRecentNotesFromQuery(query, params = []) {
|
||||
const rows = sql.getRows(query, params);
|
||||
const BRecentNote = importSync('./entities/brecentnote.js');
|
||||
return rows.map(row => new BRecentNote(row));
|
||||
}
|
||||
|
||||
/** @returns {BRevision[]} */
|
||||
getRevisionsFromQuery(query, params = []) {
|
||||
const rows = sql.getRows(query, params);
|
||||
const BRevision = importSync('./entities/brevision.js');
|
||||
return rows.map(row => new BRevision(row));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../services/sql.js'
|
||||
import eventService from '../services/events.js'
|
||||
import becca from './becca.js'
|
||||
@ -12,17 +10,14 @@ import BOption from './entities/boption.js'
|
||||
import BEtapiToken from './entities/betapi_token.js'
|
||||
import cls from '../services/cls.js'
|
||||
import entityConstructor from '../becca/entity_constructor.js'
|
||||
|
||||
import services from '../services/options_init.js'
|
||||
|
||||
import services0 from '../services/ws.js'
|
||||
import importSync from "import-sync";
|
||||
|
||||
const beccaLoaded = new Promise((res, rej) => {
|
||||
sqlInit.dbReady.then(() => {
|
||||
cls.init(() => {
|
||||
load();
|
||||
|
||||
services.initStartupOptions();
|
||||
importSync('../services/options_init.js').initStartupOptions();
|
||||
|
||||
res();
|
||||
});
|
||||
@ -75,7 +70,7 @@ function load() {
|
||||
function reload(reason) {
|
||||
load();
|
||||
|
||||
services0.reloadFrontend(reason || "becca reloaded");
|
||||
importSync('../services/ws.js').reloadFrontend(reason || "becca reloaded");
|
||||
}
|
||||
|
||||
eventService.subscribeBeccaLoader([eventService.ENTITY_CHANGE_SYNCED], ({entityName, entityRow}) => {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import becca from './becca.js'
|
||||
import cls from '../services/cls.js'
|
||||
import log from '../services/log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import utils from '../../services/utils.js'
|
||||
import sql from '../../services/sql.js'
|
||||
import entityChangesService from '../../services/entity_changes.js'
|
||||
@ -9,8 +7,7 @@ import cls from '../../services/cls.js'
|
||||
import log from '../../services/log.js'
|
||||
import protectedSessionService from '../../services/protected_session.js'
|
||||
import blobService from '../../services/blob.js'
|
||||
|
||||
import becca0 from '../becca.js'
|
||||
import importSync from "import-sync";
|
||||
|
||||
let becca = null;
|
||||
|
||||
@ -36,7 +33,7 @@ class AbstractBeccaEntity {
|
||||
*/
|
||||
get becca() {
|
||||
if (!becca) {
|
||||
becca = becca0;
|
||||
becca = importSync("../becca.js");
|
||||
}
|
||||
|
||||
return becca;
|
||||
|
@ -1,13 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
import utils from '../../services/utils.js'
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
import AbstractBeccaEntity from './abstract_becca_entity.js'
|
||||
import sql from '../../services/sql.js'
|
||||
import protectedSessionService from '../../services/protected_session.js'
|
||||
import log from '../../services/log.js'
|
||||
|
||||
import noteService from '../../services/notes.js'
|
||||
import importSync from "import-sync";
|
||||
|
||||
const attachmentRoleToNoteTypeMapping = {
|
||||
'image': 'image'
|
||||
@ -154,6 +151,8 @@ class BAttachment extends AbstractBeccaEntity {
|
||||
if (!this.isContentAvailable()) { // isProtected is the same for attachment
|
||||
throw new Error(`Cannot convert protected attachment outside of protected session`);
|
||||
}
|
||||
|
||||
const noteService = importSync('../../services/notes.js');
|
||||
const { note, branch } = noteService.createNewNote({
|
||||
parentNoteId: this.ownerId,
|
||||
title: this.title,
|
||||
|
@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
import BNote from './bnote.js'
|
||||
import AbstractBeccaEntity from './abstract_becca_entity.js'
|
||||
import sql from '../../services/sql.js'
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
import promotedAttributeDefinitionParser from '../../services/promoted_attribute_definition_parser.js'
|
||||
import { sanitizeAttributeName } from '../../services/sanitize_attribute_name.js';
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import BNote from './bnote.js'
|
||||
import AbstractBeccaEntity from './abstract_becca_entity.js'
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
import AbstractBeccaEntity from './abstract_becca_entity.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import protectedSessionService from '../../services/protected_session.js'
|
||||
import log from '../../services/log.js'
|
||||
import sql from '../../services/sql.js'
|
||||
@ -8,21 +6,11 @@ import dateUtils from '../../services/date_utils.js'
|
||||
import AbstractBeccaEntity from './abstract_becca_entity.js'
|
||||
import BRevision from './brevision.js'
|
||||
import BAttachment from './battachment.js'
|
||||
import BAttribute from './battribute.js'
|
||||
import TaskContext from '../../services/task_context.js'
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc.js";
|
||||
import eventService from '../../services/events.js'
|
||||
import searchService from '../../services/search/services/search.js'
|
||||
|
||||
import BAttribute from './battribute.js'
|
||||
|
||||
import cloningService from '../../services/cloning.js'
|
||||
|
||||
import noteService from '../../services/notes.js'
|
||||
|
||||
|
||||
// needs to be run before branches and attributes are deleted and thus attached relations disappear
|
||||
import handlers from '../../services/handlers.js'
|
||||
import importSync from "import-sync";
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
@ -279,6 +267,7 @@ class BNote extends AbstractBeccaEntity {
|
||||
setContent(content, opts) {
|
||||
this._setContent(content, opts);
|
||||
|
||||
const eventService = importSync('../../services/events.js');
|
||||
eventService.emit(eventService.NOTE_CONTENT_CHANGE, { entity: this });
|
||||
}
|
||||
|
||||
@ -915,6 +904,7 @@ class BNote extends AbstractBeccaEntity {
|
||||
}
|
||||
|
||||
try {
|
||||
const searchService = importSync('../../services/search/services/search.js');
|
||||
const {searchResultNoteIds} = searchService.searchFromNote(this);
|
||||
|
||||
const becca = this.becca;
|
||||
@ -1469,6 +1459,7 @@ class BNote extends AbstractBeccaEntity {
|
||||
cloneTo(parentNoteId) {
|
||||
const branch = this.becca.getNote(parentNoteId).getParentBranches()[0];
|
||||
|
||||
const cloningService = importSync('../../services/cloning.js');
|
||||
return cloningService.cloneNoteToBranch(this.noteId, branch.branchId);
|
||||
}
|
||||
|
||||
@ -1539,6 +1530,7 @@ class BNote extends AbstractBeccaEntity {
|
||||
const fixedContent = utils.replaceAll(parentContent, oldNoteUrl, newAttachmentUrl);
|
||||
|
||||
parentNote.setContent(fixedContent);
|
||||
const noteService = importSync('../../services/notes.js');
|
||||
noteService.asyncPostProcessContent(parentNote, fixedContent); // to mark an unused attachment for deletion
|
||||
|
||||
this.deleteNote();
|
||||
@ -1564,6 +1556,8 @@ class BNote extends AbstractBeccaEntity {
|
||||
if (!taskContext) {
|
||||
taskContext = new TaskContext('no-progress-reporting');
|
||||
}
|
||||
// needs to be run before branches and attributes are deleted and thus attached relations disappear
|
||||
const handlers = importSync('../../services/handlers.js');
|
||||
handlers.runAttachedRelations(this, 'runOnNoteDeletion', this);
|
||||
taskContext.noteDeletionHandlerTriggered = true;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
import AbstractBeccaEntity from './abstract_becca_entity.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
import AbstractBeccaEntity from './abstract_becca_entity.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import protectedSessionService from '../../services/protected_session.js'
|
||||
import utils from '../../services/utils.js'
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import appInfo from '../../services/app_info.js'
|
||||
|
||||
function getAppInfo() {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../../services/sql.js'
|
||||
import log from '../../services/log.js'
|
||||
import attributeService from '../../services/attributes.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import beccaService from '../../becca/becca_service.js'
|
||||
import searchService from '../../services/search/services/search.js'
|
||||
import log from '../../services/log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import fs from 'fs';
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
import dataDir from '../../services/data_dir.js';
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../../services/sql.js'
|
||||
import utils from '../../services/utils.js'
|
||||
import entityChangesService from '../../services/entity_changes.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import attributeService from '../../services/attributes.js'
|
||||
import cloneService from '../../services/cloning.js'
|
||||
import noteService from '../../services/notes.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import cloningService from '../../services/cloning.js'
|
||||
|
||||
function cloneNoteToBranch(req) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../../services/sql.js'
|
||||
import log from '../../services/log.js'
|
||||
import backupService from '../../services/backup.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import zipExportService from '../../services/export/zip.js'
|
||||
import singleExportService from '../../services/export/single.js'
|
||||
import opmlExportService from '../../services/export/opml.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import protectedSessionService from '../../services/protected_session.js'
|
||||
import utils from '../../services/utils.js'
|
||||
import log from '../../services/log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import imageService from '../../services/image.js'
|
||||
import becca from '../../becca/becca.js'
|
||||
import resourceDir from '../../services/resource_dir.js';
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import enexImportService from '../../services/import/enex.js'
|
||||
import opmlImportService from '../../services/import/opml.js'
|
||||
import zipImportService from '../../services/import/zip.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import keyboardActions from '../../services/keyboard_actions.js'
|
||||
import becca from '../../becca/becca.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import options from '../../services/options.js'
|
||||
import utils from '../../services/utils.js'
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import becca from '../../becca/becca.js'
|
||||
import { JSDOM } from 'jsdom';
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import noteService from '../../services/notes.js'
|
||||
import eraseService from '../../services/erase.js'
|
||||
import treeService from '../../services/tree.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import optionService from '../../services/options.js'
|
||||
import log from '../../services/log.js'
|
||||
import searchService from '../../services/search/services/search.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import passwordService from '../../services/encryption/password.js'
|
||||
import ValidationError from '../../errors/validation_error.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../../services/sql.js'
|
||||
import protectedSessionService from '../../services/protected_session.js'
|
||||
import noteService from '../../services/notes.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import BRecentNote from '../../becca/entities/brecent_note.js'
|
||||
import sql from '../../services/sql.js'
|
||||
import dateUtils from '../../services/date_utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import beccaService from '../../becca/becca_service.js'
|
||||
import revisionService from '../../services/revisions.js'
|
||||
import utils from '../../services/utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import scriptService from '../../services/script.js'
|
||||
import attributeService from '../../services/attributes.js'
|
||||
import becca from '../../becca/becca.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import becca from '../../becca/becca.js'
|
||||
import SearchContext from '../../services/search/search_context.js'
|
||||
import searchService from '../../services/search/services/search.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import imageType from 'image-type';
|
||||
import imageService from '../../services/image.js'
|
||||
import noteService from '../../services/notes.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sqlInit from '../../services/sql_init.js'
|
||||
import setupService from '../../services/setup.js'
|
||||
import log from '../../services/log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import similarityService from '../../becca/similarity.js'
|
||||
import becca from '../../becca/becca.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import dateNoteService from '../../services/date_notes.js'
|
||||
import sql from '../../services/sql.js'
|
||||
import cls from '../../services/cls.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../../services/sql.js'
|
||||
import becca from '../../becca/becca.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import syncService from '../../services/sync.js'
|
||||
import syncUpdateService from '../../services/sync_update.js'
|
||||
import entityChangesService from '../../services/entity_changes.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import becca from '../../becca/becca.js'
|
||||
import log from '../../services/log.js'
|
||||
import NotFoundError from '../../errors/not_found_error.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../services/sql.js'
|
||||
import attributeService from '../services/attributes.js'
|
||||
import config from '../services/config.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import utils from '../services/utils.js'
|
||||
import optionService from '../services/options.js'
|
||||
import myScryptService from '../services/encryption/my_scrypt.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import utils from '../services/utils.js'
|
||||
import multer from 'multer';
|
||||
import log from '../services/log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sqlInit from '../services/sql_init.js'
|
||||
import setupService from '../services/setup.js'
|
||||
import utils from '../services/utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import path from 'path';
|
||||
import resourceDir from './resource_dir.js';
|
||||
import log from './log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import build from './build.js'
|
||||
import packageJson from '../../package.json' assert { type: 'json' }
|
||||
import dataDir from './data_dir.js';
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
export function formatAttrForSearch(attr, searchWithValue) {
|
||||
let searchStr = '';
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import searchService from './search/services/search.js'
|
||||
import sql from './sql.js'
|
||||
import becca from '../becca/becca.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import etapiTokenService from './etapi_tokens.js'
|
||||
import log from './log.js'
|
||||
import sqlInit from './sql_init.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import dateUtils from './date_utils.js'
|
||||
import optionService from './options.js'
|
||||
import fs from 'fs-extra';
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from './sql.js'
|
||||
import eventChangesService from './entity_changes.js'
|
||||
import treeService from './tree.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import ini from 'ini';
|
||||
import fs from 'fs';
|
||||
import dataDir from './data_dir.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from './sql.js'
|
||||
import sqlInit from './sql_init.js'
|
||||
import log from './log.js'
|
||||
@ -15,8 +13,7 @@ import utils from '../services/utils.js'
|
||||
import eraseService from '../services/erase.js'
|
||||
import { sanitizeAttributeName } from './sanitize_attribute_name.js';
|
||||
import services from '../services/note_types.js'
|
||||
|
||||
import becca0 from '../becca/becca_loader.js'
|
||||
import importSync from "import-sync";
|
||||
|
||||
const noteTypes = services.getNoteTypeNames();
|
||||
|
||||
@ -767,7 +764,7 @@ class ConsistencyChecks {
|
||||
}
|
||||
|
||||
if (this.reloadNeeded) {
|
||||
becca0.reload("consistency checks need becca reload");
|
||||
importSync('../becca/becca_loader.js').reload("consistency checks need becca reload");
|
||||
}
|
||||
|
||||
return !this.unrecoveredConsistencyErrors;
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from './sql.js'
|
||||
import utils from './utils.js'
|
||||
import log from './log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* This file resolves trilium data path in this order of priority:
|
||||
* - if TRILIUM_DATA_DIR environment variable exists, then its value is used as the path
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import noteService from './notes.js'
|
||||
import attributeService from './attributes.js'
|
||||
import dateUtils from './date_utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import crypto from 'crypto';
|
||||
import log from '../log.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import optionService from '../options.js'
|
||||
import crypto from 'crypto';
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import sql from '../sql.js'
|
||||
import optionService from '../options.js'
|
||||
import myScryptService from './my_scrypt.js'
|
||||
|
@ -6,8 +6,7 @@ import utils from './utils.js'
|
||||
import instanceId from './instance_id.js'
|
||||
import becca from '../becca/becca.js'
|
||||
import blobService from '../services/blob.js'
|
||||
|
||||
import eventService from './events.js'
|
||||
import importSync from "import-sync";
|
||||
|
||||
let maxEntityChangeId = 0;
|
||||
|
||||
@ -54,6 +53,8 @@ function putNoteReorderingEntityChange(parentNoteId, componentId) {
|
||||
componentId,
|
||||
instanceId
|
||||
});
|
||||
|
||||
const eventService = importSync('./events.js');
|
||||
eventService.emit(eventService.ENTITY_CHANGED, {
|
||||
entityName: 'note_reordering',
|
||||
entity: sql.getMap(`SELECT branchId, notePosition FROM branches WHERE isDeleted = 0 AND parentNoteId = ?`, [parentNoteId])
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import TurndownService from 'turndown';
|
||||
import turndownPluginGfm from 'joplin-turndown-plugin-gfm';
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import utils from '../utils.js'
|
||||
import becca from '../../becca/becca.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import mimeTypes from 'mime-types';
|
||||
import html from 'html';
|
||||
import utils from '../utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import html from 'html';
|
||||
import dateUtils from '../date_utils.js'
|
||||
import path from 'path';
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import becca from '../becca/becca.js'
|
||||
import log from './log.js'
|
||||
import protectedSessionService from './protected_session.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import { marked } from 'marked';
|
||||
import htmlSanitizer from '../html_sanitizer.js'
|
||||
import importUtils from './utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import mimeTypes from 'mime-types';
|
||||
import path from 'path';
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import noteService from '../../services/notes.js'
|
||||
import { parseString } from 'xml2js';
|
||||
import protectedSessionService from '../protected_session.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import noteService from '../../services/notes.js'
|
||||
import imageService from '../../services/image.js'
|
||||
import protectedSessionService from '../protected_session.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function handleH1(content, title) {
|
||||
content = content.replace(/<h1>([^<]*)<\/h1>/gi, (match, text) => {
|
||||
if (title.trim() === text.trim()) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import BAttribute from '../../becca/entities/battribute.js'
|
||||
import utils from '../../services/utils.js'
|
||||
import log from '../../services/log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import optionService from './options.js'
|
||||
import log from './log.js'
|
||||
import utils from './utils.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import fs from 'fs';
|
||||
import dataDir from './data_dir.js'
|
||||
import cls from './cls.js'
|
||||
|
@ -1,9 +1,6 @@
|
||||
import becca from '../becca/becca.js'
|
||||
import sql from './sql.js'
|
||||
|
||||
|
||||
// to avoid circular dependency, need to find a better solution
|
||||
import BOption from "../becca/entities/boption.js";
|
||||
import importSync from "import-sync";
|
||||
|
||||
/** @returns {string|null} */
|
||||
function getOptionOrNull(name) {
|
||||
@ -76,6 +73,7 @@ function setOption(name, value) {
|
||||
}
|
||||
|
||||
function createOption(name, value, isSynced) {
|
||||
const BOption = importSync("../becca/entities/boption.js");
|
||||
new BOption({
|
||||
name: name,
|
||||
value: value,
|
||||
|
@ -1,11 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
import log from './log.js'
|
||||
import dataEncryptionService from './encryption/data_encryption.js'
|
||||
|
||||
import options from './options.js'
|
||||
|
||||
import ws from './ws.js'
|
||||
import importSync from "import-sync";
|
||||
|
||||
let dataKey = null;
|
||||
|
||||
@ -54,6 +49,7 @@ function touchProtectedSession() {
|
||||
}
|
||||
|
||||
function checkProtectedSessionExpiration() {
|
||||
const options = importSync('./options.js');
|
||||
const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout');
|
||||
if (isProtectedSessionAvailable()
|
||||
&& lastProtectedSessionOperationDate
|
||||
@ -63,7 +59,7 @@ function checkProtectedSessionExpiration() {
|
||||
|
||||
log.info("Expiring protected session");
|
||||
|
||||
ws.reloadFrontend("leaving protected session");
|
||||
importSync("./ws").reloadFrontend("leaving protected session");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import utils from './utils.js'
|
||||
import log from './log.js'
|
||||
import url from 'url';
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import log from './log.js'
|
||||
import sql from './sql.js'
|
||||
import protectedSessionService from './protected_session.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import log from '../../log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import TrueExp from './true.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import NoteSet from '../note_set.js'
|
||||
import becca from '../../../becca/becca.js'
|
||||
import Expression from './expression.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import becca from '../../../becca/becca.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
class Expression {
|
||||
constructor() {
|
||||
this.name = this.constructor.name; // for DEBUG mode to have expression name as part of dumped JSON
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import becca from '../../../becca/becca.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
|
||||
class NotExp extends Expression {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import log from '../../log.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import becca from '../../../becca/becca.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import TrueExp from './true.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import buildComparator from '../services/build_comparator.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
import NoteSet from '../note_set.js'
|
||||
import becca from '../../../becca/becca.js'
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import Expression from './expression.js'
|
||||
|
||||
class TrueExp extends Expression {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
class NoteSet {
|
||||
constructor(notes = []) {
|
||||
/** @type {BNote[]} */
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import hoistedNoteService from '../hoisted_note.js'
|
||||
|
||||
class SearchContext {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user