mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	server: Fix the remainder of import issues
This commit is contained in:
		
							parent
							
								
									42f0073ab6
								
							
						
					
					
						commit
						24af2e55dc
					
				| @ -1,6 +1,6 @@ | |||||||
| import anonymizationService from "./services/anonymization.js"; | import anonymizationService from "./services/anonymization.js"; | ||||||
| import sqlInit from "./services/sql_init.js"; | import sqlInit from "./services/sql_init.js"; | ||||||
| await import("./becca/entity_constructor"); | await import("./becca/entity_constructor.js"); | ||||||
| 
 | 
 | ||||||
| sqlInit.dbReady.then(async () => { | sqlInit.dbReady.then(async () => { | ||||||
|     try { |     try { | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								src/app.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/app.ts
									
									
									
									
									
								
							| @ -15,8 +15,8 @@ import error_handlers from "./routes/error_handlers.js"; | |||||||
| import { startScheduledCleanup } from "./services/erase.js"; | import { startScheduledCleanup } from "./services/erase.js"; | ||||||
| import sql_init from "./services/sql_init.js"; | import sql_init from "./services/sql_init.js"; | ||||||
| 
 | 
 | ||||||
| await import('./services/handlers'); | await import('./services/handlers.js'); | ||||||
| await import('./becca/becca_loader'); | await import('./becca/becca_loader.js'); | ||||||
| 
 | 
 | ||||||
| const app = express(); | const app = express(); | ||||||
| 
 | 
 | ||||||
| @ -56,15 +56,15 @@ custom.register(app); | |||||||
| error_handlers.register(app); | error_handlers.register(app); | ||||||
| 
 | 
 | ||||||
| // triggers sync timer
 | // triggers sync timer
 | ||||||
| await import("./services/sync"); | await import("./services/sync.js"); | ||||||
| 
 | 
 | ||||||
| // triggers backup timer
 | // triggers backup timer
 | ||||||
| await import('./services/backup'); | await import('./services/backup.js'); | ||||||
| 
 | 
 | ||||||
| // trigger consistency checks timer
 | // trigger consistency checks timer
 | ||||||
| await import('./services/consistency_checks'); | await import('./services/consistency_checks.js'); | ||||||
| 
 | 
 | ||||||
| await import('./services/scheduler'); | await import('./services/scheduler.js'); | ||||||
| 
 | 
 | ||||||
| startScheduledCleanup(); | startScheduledCleanup(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -13,8 +13,7 @@ import { Router } from 'express'; | |||||||
| import { AppRequest } from '../routes/route-interface.js'; | import { AppRequest } from '../routes/route-interface.js'; | ||||||
| import { ParsedQs } from 'qs'; | import { ParsedQs } from 'qs'; | ||||||
| import { NoteParams } from '../services/note-interface.js'; | import { NoteParams } from '../services/note-interface.js'; | ||||||
| import BNote from "../becca/entities/bnote.js"; | import { SearchParams } from '../services/search/services/types.js'; | ||||||
| import { SearchParams } from '../services/search/services/types'; |  | ||||||
| import { ValidatorMap } from './etapi-interface.js'; | import { ValidatorMap } from './etapi-interface.js'; | ||||||
| 
 | 
 | ||||||
| function register(router: Router) { | function register(router: Router) { | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ function setupPage(req: Request, res: Response) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function handleElectronRedirect() { | async function handleElectronRedirect() { | ||||||
|     const windowService = (await import("../services/window")).default; |     const windowService = (await import("../services/window.js")).default; | ||||||
|     const { app } = await import("electron"); |     const { app } = await import("electron"); | ||||||
|     windowService.createMainWindow(app); |     windowService.createMainWindow(app); | ||||||
|     windowService.closeSetupWindow(); |     windowService.closeSetupWindow(); | ||||||
|  | |||||||
| @ -1,12 +1,11 @@ | |||||||
| import sql from "./sql.js"; | import sql from "./sql.js"; | ||||||
| import revisionService from "./revisions.js"; |  | ||||||
| import log from "./log.js"; | import log from "./log.js"; | ||||||
| import entityChangesService from "./entity_changes.js"; | import entityChangesService from "./entity_changes.js"; | ||||||
| import optionService from "./options.js"; | import optionService from "./options.js"; | ||||||
| import dateUtils from "./date_utils.js"; | import dateUtils from "./date_utils.js"; | ||||||
| import sqlInit from "./sql_init.js"; | import sqlInit from "./sql_init.js"; | ||||||
| import cls from "./cls.js"; | import cls from "./cls.js"; | ||||||
| import { EntityChange } from "./entity_changes_interface"; | import { EntityChange } from "./entity_changes_interface.js"; | ||||||
| 
 | 
 | ||||||
| function eraseNotes(noteIdsToErase: string[]) { | function eraseNotes(noteIdsToErase: string[]) { | ||||||
|     if (noteIdsToErase.length === 0) { |     if (noteIdsToErase.length === 0) { | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| import log from "./log"; | import log from "./log.js"; | ||||||
| 
 | 
 | ||||||
| const NOTE_TITLE_CHANGED = "NOTE_TITLE_CHANGED"; | const NOTE_TITLE_CHANGED = "NOTE_TITLE_CHANGED"; | ||||||
| const ENTER_PROTECTED_SESSION = "ENTER_PROTECTED_SESSION"; | const ENTER_PROTECTED_SESSION = "ENTER_PROTECTED_SESSION"; | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ import hiddenSubtreeService from "./hidden_subtree.js"; | |||||||
| import oneTimeTimer from "./one_time_timer.js"; | import oneTimeTimer from "./one_time_timer.js"; | ||||||
| import BNote from "../becca/entities/bnote.js"; | import BNote from "../becca/entities/bnote.js"; | ||||||
| import AbstractBeccaEntity from "../becca/entities/abstract_becca_entity.js"; | import AbstractBeccaEntity from "../becca/entities/abstract_becca_entity.js"; | ||||||
| import { DefinitionObject } from './promoted_attribute_definition_interface'; | import { DefinitionObject } from './promoted_attribute_definition_interface.js'; | ||||||
| 
 | 
 | ||||||
| type Handler = (definition: DefinitionObject, note: BNote, targetNote: BNote) => void; | type Handler = (definition: DefinitionObject, note: BNote, targetNote: BNote) => void; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| import mimeTypes from "mime-types"; | import mimeTypes from "mime-types"; | ||||||
| import path from "path"; | import path from "path"; | ||||||
| import { TaskData } from '../task_context_interface'; | import { TaskData } from '../task_context_interface.js'; | ||||||
| 
 | 
 | ||||||
| const CODE_MIME_TYPES: Record<string, boolean | string> = { | const CODE_MIME_TYPES: Record<string, boolean | string> = { | ||||||
|     'text/plain': true, |     'text/plain': true, | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ import mimeService from "./mime.js"; | |||||||
| import utils from "../../services/utils.js"; | import utils from "../../services/utils.js"; | ||||||
| import importUtils from "./utils.js"; | import importUtils from "./utils.js"; | ||||||
| import htmlSanitizer from "../html_sanitizer.js"; | import htmlSanitizer from "../html_sanitizer.js"; | ||||||
| import { File } from "./common"; | import { File } from "./common.js"; | ||||||
| 
 | 
 | ||||||
| function importSingleFile(taskContext: TaskContext, file: File, parentNote: BNote) { | function importSingleFile(taskContext: TaskContext, file: File, parentNote: BNote) { | ||||||
|     const mime = mimeService.getMime(file.originalname) || file.mimetype; |     const mime = mimeService.getMime(file.originalname) || file.mimetype; | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| import optionService from "./options.js"; | import optionService from "./options.js"; | ||||||
| import log from "./log.js"; | import log from "./log.js"; | ||||||
| import utils from "./utils.js"; | import utils from "./utils.js"; | ||||||
| import { KeyboardShortcut } from './keyboard_actions_interface'; | import { KeyboardShortcut } from './keyboard_actions_interface.js'; | ||||||
| 
 | 
 | ||||||
| const isMac = process.platform === "darwin"; | const isMac = process.platform === "darwin"; | ||||||
| const isElectron = utils.isElectron(); | const isElectron = utils.isElectron(); | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ import utils from "./utils.js"; | |||||||
| import log from "./log.js"; | import log from "./log.js"; | ||||||
| import dateUtils from "./date_utils.js"; | import dateUtils from "./date_utils.js"; | ||||||
| import keyboardActions from "./keyboard_actions.js"; | import keyboardActions from "./keyboard_actions.js"; | ||||||
| import { KeyboardShortcutWithRequiredActionName } from './keyboard_actions_interface'; | import { KeyboardShortcutWithRequiredActionName } from './keyboard_actions_interface.js'; | ||||||
| 
 | 
 | ||||||
| function initDocumentOptions() { | function initDocumentOptions() { | ||||||
|     optionService.createOption('documentId', utils.randomSecureToken(16), false); |     optionService.createOption('documentId', utils.randomSecureToken(16), false); | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| import { DefinitionObject } from "./promoted_attribute_definition_interface"; | import { DefinitionObject } from "./promoted_attribute_definition_interface.js"; | ||||||
| 
 | 
 | ||||||
| function parse(value: string): DefinitionObject { | function parse(value: string): DefinitionObject { | ||||||
|     const tokens = value.split(',').map(t => t.trim()); |     const tokens = value.split(',').map(t => t.trim()); | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ import cls from "./cls.js"; | |||||||
| import log from "./log.js"; | import log from "./log.js"; | ||||||
| import becca from "../becca/becca.js"; | import becca from "../becca/becca.js"; | ||||||
| import BNote from "../becca/entities/bnote.js"; | import BNote from "../becca/entities/bnote.js"; | ||||||
| import { ApiParams } from './backend_script_api_interface'; | import { ApiParams } from './backend_script_api_interface.js'; | ||||||
| 
 | 
 | ||||||
| interface Bundle { | interface Bundle { | ||||||
|     note?: BNote; |     note?: BNote; | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| import utils from "./utils.js"; | import utils from "./utils.js"; | ||||||
| import BackendScriptApi from "./backend_script_api.js"; | import BackendScriptApi from "./backend_script_api.js"; | ||||||
| import BNote from "../becca/entities/bnote.js"; | import BNote from "../becca/entities/bnote.js"; | ||||||
| import { ApiParams } from './backend_script_api_interface'; | import { ApiParams } from './backend_script_api_interface.js'; | ||||||
| 
 | 
 | ||||||
| type Module = { | type Module = { | ||||||
|     exports: any[]; |     exports: any[]; | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ import request from "./request.js"; | |||||||
| import appInfo from "./app_info.js"; | import appInfo from "./app_info.js"; | ||||||
| import utils from "./utils.js"; | import utils from "./utils.js"; | ||||||
| import becca from "../becca/becca.js"; | import becca from "../becca/becca.js"; | ||||||
| import { SetupStatusResponse, SetupSyncSeedResponse } from './api-interface'; | import { SetupStatusResponse, SetupSyncSeedResponse } from './api-interface.js'; | ||||||
| 
 | 
 | ||||||
| async function hasSyncServerSchemaAndSeed() { | async function hasSyncServerSchemaAndSeed() { | ||||||
|     const response = await requestToSyncServer<SetupStatusResponse>('GET', '/api/setup/status'); |     const response = await requestToSyncServer<SetupStatusResponse>('GET', '/api/setup/status'); | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| "use strict"; | "use strict"; | ||||||
| 
 | 
 | ||||||
| import { TaskData } from './task_context_interface'; | import { TaskData } from './task_context_interface.js'; | ||||||
| import ws from "./ws.js"; | import ws from "./ws.js"; | ||||||
| 
 | 
 | ||||||
| // taskId => TaskContext
 | // taskId => TaskContext
 | ||||||
|  | |||||||
| @ -69,7 +69,7 @@ async function startTrilium() { | |||||||
|     ws.init(httpServer, sessionParser as any); // TODO: Not sure why session parser is incompatible.
 |     ws.init(httpServer, sessionParser as any); // TODO: Not sure why session parser is incompatible.
 | ||||||
| 
 | 
 | ||||||
|     if (utils.isElectron()) { |     if (utils.isElectron()) { | ||||||
|         const electronRouting = await import('./routes/electron'); |         const electronRouting = await import('./routes/electron.js'); | ||||||
|         electronRouting.default(app); |         electronRouting.default(app); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran