From 5bc4bdaeef1a7078f55e7fd57da370ac0ac55b12 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 30 Jul 2025 08:38:06 +0300 Subject: [PATCH] fix(server/test): problematic cyclic dependency --- apps/server/src/becca/becca_loader.ts | 6 +++--- apps/server/src/services/sql_init.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/server/src/becca/becca_loader.ts b/apps/server/src/becca/becca_loader.ts index cef89b43f..81498519a 100644 --- a/apps/server/src/becca/becca_loader.ts +++ b/apps/server/src/becca/becca_loader.ts @@ -14,13 +14,13 @@ import entityConstructor from "../becca/entity_constructor.js"; import type { AttributeRow, BranchRow, EtapiTokenRow, NoteRow, OptionRow } from "@triliumnext/commons"; import type AbstractBeccaEntity from "./entities/abstract_becca_entity.js"; import ws from "../services/ws.js"; +import sql_init from "../services/sql_init.js"; -const beccaLoaded = new Promise(async (res, rej) => { - const sqlInit = (await import("../services/sql_init.js")).default; +export const beccaLoaded = new Promise(async (res, rej) => { // We have to import async since options init requires keyboard actions which require translations. const options_init = (await import("../services/options_init.js")).default; - sqlInit.dbReady.then(() => { + sql_init.dbReady.then(() => { cls.init(() => { load(); diff --git a/apps/server/src/services/sql_init.ts b/apps/server/src/services/sql_init.ts index 5fb0bd573..a77a58009 100644 --- a/apps/server/src/services/sql_init.ts +++ b/apps/server/src/services/sql_init.ts @@ -19,7 +19,7 @@ import password from "./encryption/password.js"; import backup from "./backup.js"; import eventService from "./events.js"; -const dbReady = deferred(); +export const dbReady = deferred(); function schemaExists() { return !!sql.getValue(/*sql*/`SELECT name FROM sqlite_master