From 324696bc5477cad66b53ed77e78ff92e1ad103eb Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 9 Jan 2025 18:36:24 +0200 Subject: [PATCH] refactor(ts): enable verbatim module syntax --- spec/search/becca_mocking.ts | 2 +- spec/search/parens.spec.ts | 2 +- src/becca/becca-interface.ts | 2 +- src/becca/becca_loader.ts | 2 +- src/becca/entities/abstract_becca_entity.ts | 2 +- src/becca/entities/battachment.ts | 2 +- src/becca/entities/battribute.ts | 2 +- src/becca/entities/bblob.ts | 2 +- src/becca/entities/bbranch.ts | 2 +- src/becca/entities/betapi_token.ts | 2 +- src/becca/entities/bnote.ts | 6 +++--- src/becca/entities/boption.ts | 2 +- src/becca/entities/brecent_note.ts | 2 +- src/becca/entities/brevision.ts | 2 +- src/becca/entity_constructor.ts | 2 +- src/etapi/attachments.ts | 4 ++-- src/etapi/attributes.ts | 4 ++-- src/etapi/auth.ts | 2 +- src/etapi/branches.ts | 2 +- src/etapi/etapi_utils.ts | 6 +++--- src/etapi/notes.ts | 10 +++++----- src/public/app/components/app_context.ts | 18 +++++++++--------- src/public/app/components/component.ts | 2 +- src/public/app/components/entrypoints.ts | 2 +- src/public/app/components/events.ts | 4 ++-- src/public/app/components/note_context.ts | 4 ++-- .../app/components/root_command_executor.ts | 2 +- .../app/components/shortcut_component.ts | 4 ++-- src/public/app/entities/fattachment.ts | 2 +- src/public/app/entities/fattribute.ts | 2 +- src/public/app/entities/fbranch.ts | 2 +- src/public/app/entities/fnote.ts | 4 ++-- src/public/app/menus/context_menu.ts | 2 +- src/public/app/menus/electron_context_menu.ts | 4 ++-- src/public/app/menus/launcher_context_menu.ts | 6 +++--- src/public/app/menus/link_context_menu.ts | 2 +- src/public/app/menus/tree_context_menu.ts | 8 ++++---- src/public/app/server_types.ts | 2 +- .../app/services/attribute_autocomplete.ts | 2 +- src/public/app/services/attribute_parser.ts | 2 +- src/public/app/services/attributes.ts | 2 +- src/public/app/services/branches.ts | 6 +++--- src/public/app/services/bundle.ts | 2 +- src/public/app/services/date_notes.ts | 2 +- src/public/app/services/dialog.ts | 4 ++-- src/public/app/services/froca.ts | 12 ++++++------ src/public/app/services/froca_updater.ts | 8 ++++---- src/public/app/services/hoisted_note.ts | 2 +- src/public/app/services/import.ts | 2 +- src/public/app/services/keyboard_actions.ts | 2 +- src/public/app/services/link.ts | 2 +- src/public/app/services/load_results.ts | 4 ++-- src/public/app/services/note_create.ts | 2 +- src/public/app/services/note_types.ts | 4 ++-- src/public/app/services/render.ts | 2 +- src/public/app/services/script_context.ts | 2 +- src/public/app/services/ws.ts | 2 +- .../attribute_widgets/attribute_detail.ts | 4 +--- .../attribute_widgets/attribute_editor.ts | 6 +++--- .../app/widgets/buttons/command_button.ts | 6 +++--- .../app/widgets/buttons/onclick_button.ts | 2 +- src/public/app/widgets/containers/launcher.ts | 2 +- .../widgets/containers/launcher_container.ts | 2 +- src/public/app/widgets/dialogs/delete_notes.ts | 2 +- .../app/widgets/dialogs/note_type_chooser.ts | 4 ++-- src/public/app/widgets/highlights_list.ts | 2 +- .../mobile_widgets/sidebar_container.ts | 6 +++--- .../app/widgets/note_context_aware_widget.ts | 2 +- .../type_widgets/options/appearance/fonts.ts | 2 +- .../type_widgets/options/options_widget.ts | 4 ++-- src/routes/api/attachments.ts | 2 +- src/routes/api/attributes.ts | 2 +- src/routes/api/autocomplete.ts | 2 +- src/routes/api/branches.ts | 2 +- src/routes/api/bulk_action.ts | 2 +- src/routes/api/clipper.ts | 2 +- src/routes/api/cloning.ts | 2 +- src/routes/api/database.ts | 2 +- src/routes/api/etapi_tokens.ts | 2 +- src/routes/api/export.ts | 2 +- src/routes/api/files.ts | 2 +- src/routes/api/fonts.ts | 4 ++-- src/routes/api/image.ts | 2 +- src/routes/api/import.ts | 2 +- src/routes/api/login.ts | 2 +- src/routes/api/note_map.ts | 2 +- src/routes/api/notes.ts | 4 ++-- src/routes/api/options.ts | 2 +- src/routes/api/other.ts | 2 +- src/routes/api/password.ts | 2 +- src/routes/api/recent_changes.ts | 4 ++-- src/routes/api/recent_notes.ts | 2 +- src/routes/api/relation-map.ts | 2 +- src/routes/api/revisions.ts | 4 ++-- src/routes/api/script.ts | 2 +- src/routes/api/search.ts | 4 ++-- src/routes/api/sender.ts | 2 +- src/routes/api/setup.ts | 2 +- src/routes/api/similar_notes.ts | 2 +- src/routes/api/special_notes.ts | 2 +- src/routes/api/sql.ts | 2 +- src/routes/api/stats.ts | 2 +- src/routes/api/sync.ts | 4 ++-- src/routes/api/tree.ts | 2 +- src/routes/custom.ts | 2 +- src/routes/electron.ts | 2 +- src/routes/error_handlers.ts | 2 +- src/routes/index.ts | 2 +- src/routes/login.ts | 2 +- src/routes/setup.ts | 2 +- src/services/api-interface.ts | 2 +- src/services/attribute_formatter.ts | 2 +- src/services/attributes.ts | 2 +- src/services/backend_script_api.ts | 6 +++--- src/services/backend_script_api_interface.ts | 2 +- src/services/cls.ts | 2 +- src/services/consistency_checks.ts | 4 ++-- src/services/entity_changes.ts | 2 +- src/services/erase.ts | 2 +- src/services/export/opml.ts | 2 +- src/services/export/single.ts | 2 +- src/services/export/zip.ts | 8 ++++---- src/services/handlers.ts | 2 +- src/services/hidden_subtree.ts | 2 +- src/services/import/enex.ts | 4 ++-- src/services/import/mime.ts | 2 +- src/services/import/single.ts | 2 +- src/services/import/zip.ts | 6 +++--- src/services/keyboard_actions.ts | 2 +- src/services/log.ts | 2 +- src/services/meta/attachment_meta.ts | 4 +--- src/services/meta/attribute_meta.ts | 6 ++---- src/services/meta/note_meta.ts | 8 +++----- src/services/note-interface.ts | 2 +- src/services/notes.ts | 4 ++-- src/services/options.ts | 4 ++-- src/services/options_init.ts | 2 +- src/services/options_interface.ts | 2 +- .../promoted_attribute_definition_parser.ts | 2 +- src/services/request.ts | 2 +- src/services/script.ts | 2 +- src/services/script_context.ts | 2 +- .../expressions/note_content_fulltext.ts | 4 ++-- src/services/search/search_context.ts | 2 +- src/services/search/services/handle_parens.ts | 2 +- src/services/search/services/lex.ts | 2 +- src/services/search/services/parse.ts | 2 +- src/services/search/services/search.ts | 18 +++++++++--------- src/services/setup.ts | 2 +- src/services/sql_init.ts | 2 +- src/services/sync.ts | 4 ++-- src/services/sync_update.ts | 2 +- src/services/task_context.ts | 2 +- src/services/window.ts | 3 ++- src/services/ws.ts | 2 +- src/share/shaca/entities/sattachment.ts | 4 ++-- src/share/shaca/entities/sattribute.ts | 2 +- src/share/shaca/entities/sbranch.ts | 2 +- src/share/shaca/entities/snote.ts | 4 ++-- src/share/shaca/shaca_loader.ts | 2 +- tsconfig.json | 3 ++- 161 files changed, 244 insertions(+), 250 deletions(-) diff --git a/spec/search/becca_mocking.ts b/spec/search/becca_mocking.ts index 0bc7116cb..76ee955f6 100644 --- a/spec/search/becca_mocking.ts +++ b/spec/search/becca_mocking.ts @@ -4,7 +4,7 @@ import BAttribute from "../../src/becca/entities/battribute.js"; import becca from "../../src/becca/becca.js"; import randtoken from "rand-token"; import SearchResult from "../../src/services/search/search_result.js"; -import { NoteType } from "../../src/becca/entities/rows.js"; +import type { NoteType } from "../../src/becca/entities/rows.js"; randtoken.generator({ source: "crypto" }); function findNoteByTitle(searchResults: Array, title: string): BNote | undefined { diff --git a/spec/search/parens.spec.ts b/spec/search/parens.spec.ts index cea7fc5de..33163e188 100644 --- a/spec/search/parens.spec.ts +++ b/spec/search/parens.spec.ts @@ -1,5 +1,5 @@ import handleParens from "../../src/services/search/services/handle_parens.js"; -import { TokenStructure } from "../../src/services/search/services/types.js"; +import type { TokenStructure } from "../../src/services/search/services/types.js"; describe("Parens handler", () => { it("handles parens", () => { diff --git a/src/becca/becca-interface.ts b/src/becca/becca-interface.ts index 0a89899b0..6497dad7d 100644 --- a/src/becca/becca-interface.ts +++ b/src/becca/becca-interface.ts @@ -8,7 +8,7 @@ import BAttribute from "./entities/battribute.js"; import BBranch from "./entities/bbranch.js"; import BRevision from "./entities/brevision.js"; import BAttachment from "./entities/battachment.js"; -import { AttachmentRow, BlobRow, RevisionRow } from "./entities/rows.js"; +import type { AttachmentRow, BlobRow, RevisionRow } from "./entities/rows.js"; import BBlob from "./entities/bblob.js"; import BRecentNote from "./entities/brecent_note.js"; import AbstractBeccaEntity from "./entities/abstract_becca_entity.js"; diff --git a/src/becca/becca_loader.ts b/src/becca/becca_loader.ts index e48c4ed7b..a461828ac 100644 --- a/src/becca/becca_loader.ts +++ b/src/becca/becca_loader.ts @@ -11,7 +11,7 @@ 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 { AttributeRow, BranchRow, EtapiTokenRow, NoteRow, OptionRow } from "./entities/rows.js"; +import type { AttributeRow, BranchRow, EtapiTokenRow, NoteRow, OptionRow } from "./entities/rows.js"; import AbstractBeccaEntity from "./entities/abstract_becca_entity.js"; import ws from "../services/ws.js"; diff --git a/src/becca/entities/abstract_becca_entity.ts b/src/becca/entities/abstract_becca_entity.ts index f0e7b6edc..b964a2d43 100644 --- a/src/becca/entities/abstract_becca_entity.ts +++ b/src/becca/entities/abstract_becca_entity.ts @@ -9,7 +9,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 Becca, { ConstructorData } from "../becca-interface.js"; +import Becca, { type ConstructorData } from "../becca-interface.js"; import becca from "../becca.js"; interface ContentOpts { diff --git a/src/becca/entities/battachment.ts b/src/becca/entities/battachment.ts index b88b1df2c..1e47fc9bf 100644 --- a/src/becca/entities/battachment.ts +++ b/src/becca/entities/battachment.ts @@ -6,7 +6,7 @@ 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 { AttachmentRow } from "./rows.js"; +import type { AttachmentRow } from "./rows.js"; import BNote from "./bnote.js"; import BBranch from "./bbranch.js"; import noteService from "../../services/notes.js"; diff --git a/src/becca/entities/battribute.ts b/src/becca/entities/battribute.ts index 746f493a1..3bdf208c8 100644 --- a/src/becca/entities/battribute.ts +++ b/src/becca/entities/battribute.ts @@ -5,7 +5,7 @@ import AbstractBeccaEntity from "./abstract_becca_entity.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"; -import { AttributeRow, AttributeType } from "./rows.js"; +import type { AttributeRow, AttributeType } from "./rows.js"; interface SavingOpts { skipValidation?: boolean; diff --git a/src/becca/entities/bblob.ts b/src/becca/entities/bblob.ts index f72453578..e52286ba7 100644 --- a/src/becca/entities/bblob.ts +++ b/src/becca/entities/bblob.ts @@ -1,5 +1,5 @@ import AbstractBeccaEntity from "./abstract_becca_entity.js"; -import { BlobRow } from "./rows.js"; +import type { BlobRow } from "./rows.js"; // TODO: Why this does not extend the abstract becca? class BBlob extends AbstractBeccaEntity { diff --git a/src/becca/entities/bbranch.ts b/src/becca/entities/bbranch.ts index 443cbfd15..0160ef61b 100644 --- a/src/becca/entities/bbranch.ts +++ b/src/becca/entities/bbranch.ts @@ -7,7 +7,7 @@ import utils from "../../services/utils.js"; import TaskContext from "../../services/task_context.js"; import cls from "../../services/cls.js"; import log from "../../services/log.js"; -import { BranchRow } from "./rows.js"; +import type { BranchRow } from "./rows.js"; import handlers from "../../services/handlers.js"; /** diff --git a/src/becca/entities/betapi_token.ts b/src/becca/entities/betapi_token.ts index d315029a2..e6e9500c0 100644 --- a/src/becca/entities/betapi_token.ts +++ b/src/becca/entities/betapi_token.ts @@ -1,6 +1,6 @@ "use strict"; -import { EtapiTokenRow } from "./rows.js"; +import type { EtapiTokenRow } from "./rows.js"; import dateUtils from "../../services/date_utils.js"; import AbstractBeccaEntity from "./abstract_becca_entity.js"; diff --git a/src/becca/entities/bnote.ts b/src/becca/entities/bnote.ts index b8aa69614..d83a263ff 100644 --- a/src/becca/entities/bnote.ts +++ b/src/becca/entities/bnote.ts @@ -14,12 +14,12 @@ 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 { AttachmentRow, AttributeType, NoteRow, NoteType, RevisionRow } from "./rows.js"; +import type { AttachmentRow, AttributeType, NoteRow, NoteType, RevisionRow } from "./rows.js"; import BBranch from "./bbranch.js"; import BAttribute from "./battribute.js"; -import { NotePojo } from "../becca-interface.js"; +import type { NotePojo } from "../becca-interface.js"; import searchService from "../../services/search/services/search.js"; -import cloningService, { CloneResponse } from "../../services/cloning.js"; +import cloningService, { type CloneResponse } from "../../services/cloning.js"; import noteService from "../../services/notes.js"; import handlers from "../../services/handlers.js"; dayjs.extend(utc); diff --git a/src/becca/entities/boption.ts b/src/becca/entities/boption.ts index f18be2986..5839ccbe9 100644 --- a/src/becca/entities/boption.ts +++ b/src/becca/entities/boption.ts @@ -2,7 +2,7 @@ import dateUtils from "../../services/date_utils.js"; import AbstractBeccaEntity from "./abstract_becca_entity.js"; -import { OptionRow } from "./rows.js"; +import type { OptionRow } from "./rows.js"; /** * Option represents a name-value pair, either directly configurable by the user or some system property. diff --git a/src/becca/entities/brecent_note.ts b/src/becca/entities/brecent_note.ts index d4c54ba2e..4ede28c61 100644 --- a/src/becca/entities/brecent_note.ts +++ b/src/becca/entities/brecent_note.ts @@ -1,6 +1,6 @@ "use strict"; -import { RecentNoteRow } from "./rows.js"; +import type { RecentNoteRow } from "./rows.js"; import dateUtils from "../../services/date_utils.js"; import AbstractBeccaEntity from "./abstract_becca_entity.js"; diff --git a/src/becca/entities/brevision.ts b/src/becca/entities/brevision.ts index 352302318..6167ad4b2 100644 --- a/src/becca/entities/brevision.ts +++ b/src/becca/entities/brevision.ts @@ -7,7 +7,7 @@ import becca from "../becca.js"; import AbstractBeccaEntity from "./abstract_becca_entity.js"; import sql from "../../services/sql.js"; import BAttachment from "./battachment.js"; -import { AttachmentRow, RevisionRow } from "./rows.js"; +import type { AttachmentRow, RevisionRow } from "./rows.js"; import eraseService from "../../services/erase.js"; interface ContentOpts { diff --git a/src/becca/entity_constructor.ts b/src/becca/entity_constructor.ts index b6dd4c52b..83c5bd62c 100644 --- a/src/becca/entity_constructor.ts +++ b/src/becca/entity_constructor.ts @@ -1,4 +1,4 @@ -import { ConstructorData } from "./becca-interface.js"; +import type { ConstructorData } from "./becca-interface.js"; import AbstractBeccaEntity from "./entities/abstract_becca_entity.js"; import BAttachment from "./entities/battachment.js"; import BAttribute from "./entities/battribute.js"; diff --git a/src/etapi/attachments.ts b/src/etapi/attachments.ts index 38b7d9603..5d3ce57e4 100644 --- a/src/etapi/attachments.ts +++ b/src/etapi/attachments.ts @@ -4,8 +4,8 @@ import mappers from "./mappers.js"; import v from "./validators.js"; import utils from "../services/utils.js"; import { Router } from "express"; -import { AttachmentRow } from "../becca/entities/rows.js"; -import { ValidatorMap } from "./etapi-interface.js"; +import type { AttachmentRow } from "../becca/entities/rows.js"; +import type { ValidatorMap } from "./etapi-interface.js"; function register(router: Router) { const ALLOWED_PROPERTIES_FOR_CREATE_ATTACHMENT: ValidatorMap = { diff --git a/src/etapi/attributes.ts b/src/etapi/attributes.ts index 94e2e23ec..3b9cf3451 100644 --- a/src/etapi/attributes.ts +++ b/src/etapi/attributes.ts @@ -4,8 +4,8 @@ import mappers from "./mappers.js"; import attributeService from "../services/attributes.js"; import v from "./validators.js"; import { Router } from "express"; -import { AttributeRow } from "../becca/entities/rows.js"; -import { ValidatorMap } from "./etapi-interface.js"; +import type { AttributeRow } from "../becca/entities/rows.js"; +import type { ValidatorMap } from "./etapi-interface.js"; function register(router: Router) { eu.route(router, "get", "/etapi/attributes/:attributeId", (req, res, next) => { diff --git a/src/etapi/auth.ts b/src/etapi/auth.ts index ce44eaab1..5ca7bde42 100644 --- a/src/etapi/auth.ts +++ b/src/etapi/auth.ts @@ -2,7 +2,7 @@ import becca from "../becca/becca.js"; import eu from "./etapi_utils.js"; import passwordEncryptionService from "../services/encryption/password_encryption.js"; import etapiTokenService from "../services/etapi_tokens.js"; -import { RequestHandler, Router } from "express"; +import type { RequestHandler, Router } from "express"; function register(router: Router, loginMiddleware: RequestHandler[]) { eu.NOT_AUTHENTICATED_ROUTE(router, "post", "/etapi/auth/login", loginMiddleware, (req, res, next) => { diff --git a/src/etapi/branches.ts b/src/etapi/branches.ts index ab1425947..59f87c3c8 100644 --- a/src/etapi/branches.ts +++ b/src/etapi/branches.ts @@ -6,7 +6,7 @@ import mappers from "./mappers.js"; import BBranch from "../becca/entities/bbranch.js"; import entityChangesService from "../services/entity_changes.js"; import v from "./validators.js"; -import { BranchRow } from "../becca/entities/rows.js"; +import type { BranchRow } from "../becca/entities/rows.js"; function register(router: Router) { eu.route(router, "get", "/etapi/branches/:branchId", (req, res, next) => { diff --git a/src/etapi/etapi_utils.ts b/src/etapi/etapi_utils.ts index ae6e310d7..ce5a840a9 100644 --- a/src/etapi/etapi_utils.ts +++ b/src/etapi/etapi_utils.ts @@ -4,9 +4,9 @@ import log from "../services/log.js"; import becca from "../becca/becca.js"; import etapiTokenService from "../services/etapi_tokens.js"; import config from "../services/config.js"; -import { NextFunction, Request, RequestHandler, Response, Router } from "express"; -import { ValidatorMap } from "./etapi-interface.js"; -import { ApiRequestHandler } from "../routes/routes.js"; +import type { NextFunction, Request, RequestHandler, Response, Router } from "express"; +import type { ValidatorMap } from "./etapi-interface.js"; +import type { ApiRequestHandler } from "../routes/routes.js"; const GENERIC_CODE = "GENERIC"; type HttpMethod = "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head"; diff --git a/src/etapi/notes.ts b/src/etapi/notes.ts index 855cb0c95..05b120195 100644 --- a/src/etapi/notes.ts +++ b/src/etapi/notes.ts @@ -9,11 +9,11 @@ import searchService from "../services/search/services/search.js"; import SearchContext from "../services/search/search_context.js"; import zipExportService from "../services/export/zip.js"; import zipImportService from "../services/import/zip.js"; -import { Request, Router } from "express"; -import { ParsedQs } from "qs"; -import { NoteParams } from "../services/note-interface.js"; -import { SearchParams } from "../services/search/services/types.js"; -import { ValidatorMap } from "./etapi-interface.js"; +import { type Request, Router } from "express"; +import type { ParsedQs } from "qs"; +import type { NoteParams } from "../services/note-interface.js"; +import type { SearchParams } from "../services/search/services/types.js"; +import type { ValidatorMap } from "./etapi-interface.js"; function register(router: Router) { eu.route(router, "get", "/etapi/notes", (req, res, next) => { diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts index 035eeb0f8..bccd2a6cc 100644 --- a/src/public/app/components/app_context.ts +++ b/src/public/app/components/app_context.ts @@ -1,28 +1,28 @@ import froca from "../services/froca.js"; import bundleService from "../services/bundle.js"; import RootCommandExecutor from "./root_command_executor.js"; -import Entrypoints, { SqlExecuteResults } from "./entrypoints.js"; +import Entrypoints, { type SqlExecuteResults } from "./entrypoints.js"; import options from "../services/options.js"; import utils from "../services/utils.js"; import zoomComponent from "./zoom.js"; import TabManager from "./tab_manager.js"; import Component from "./component.js"; import keyboardActionsService from "../services/keyboard_actions.js"; -import linkService, { ViewScope } from "../services/link.js"; -import MobileScreenSwitcherExecutor, { Screen } from "./mobile_screen_switcher.js"; +import linkService, { type ViewScope } from "../services/link.js"; +import MobileScreenSwitcherExecutor, { type Screen } from "./mobile_screen_switcher.js"; import MainTreeExecutors from "./main_tree_executors.js"; import toast from "../services/toast.js"; import ShortcutComponent from "./shortcut_component.js"; import { t, initLocale } from "../services/i18n.js"; import NoteDetailWidget from "../widgets/note_detail.js"; -import { ResolveOptions } from "../widgets/dialogs/delete_notes.js"; -import { PromptDialogOptions } from "../widgets/dialogs/prompt.js"; -import { ConfirmWithMessageOptions, ConfirmWithTitleOptions } from "../widgets/dialogs/confirm.js"; -import { Node } from "../services/tree.js"; +import type { ResolveOptions } from "../widgets/dialogs/delete_notes.js"; +import type { PromptDialogOptions } from "../widgets/dialogs/prompt.js"; +import type { ConfirmWithMessageOptions, ConfirmWithTitleOptions } from "../widgets/dialogs/confirm.js"; +import type { Node } from "../services/tree.js"; import LoadResults from "../services/load_results.js"; -import { Attribute } from "../services/attribute_parser.js"; +import type { Attribute } from "../services/attribute_parser.js"; import NoteTreeWidget from "../widgets/note_tree.js"; -import NoteContext, { GetTextEditorCallback } from "./note_context.js"; +import NoteContext, { type GetTextEditorCallback } from "./note_context.js"; interface Layout { getRootWidget: (appContext: AppContext) => RootWidget; diff --git a/src/public/app/components/component.ts b/src/public/app/components/component.ts index cb8f0d9bf..569b5d433 100644 --- a/src/public/app/components/component.ts +++ b/src/public/app/components/component.ts @@ -1,5 +1,5 @@ import utils from "../services/utils.js"; -import { CommandMappings, CommandNames } from "./app_context.js"; +import type { CommandMappings, CommandNames } from "./app_context.js"; /** * Abstract class for all components in the Trilium's frontend. diff --git a/src/public/app/components/entrypoints.ts b/src/public/app/components/entrypoints.ts index 571d554b2..b62cfdeb3 100644 --- a/src/public/app/components/entrypoints.ts +++ b/src/public/app/components/entrypoints.ts @@ -2,7 +2,7 @@ import utils from "../services/utils.js"; import dateNoteService from "../services/date_notes.js"; import protectedSessionHolder from "../services/protected_session_holder.js"; import server from "../services/server.js"; -import appContext, { NoteCommandData } from "./app_context.js"; +import appContext, { type NoteCommandData } from "./app_context.js"; import Component from "./component.js"; import toastService from "../services/toast.js"; import ws from "../services/ws.js"; diff --git a/src/public/app/components/events.ts b/src/public/app/components/events.ts index 4445ce8c7..d98fdf8dd 100644 --- a/src/public/app/components/events.ts +++ b/src/public/app/components/events.ts @@ -1,5 +1,5 @@ -import { MenuCommandItem } from "../menus/context_menu.js"; -import { CommandNames } from "./app_context.js"; +import type { MenuCommandItem } from "../menus/context_menu.js"; +import type { CommandNames } from "./app_context.js"; type ListenerReturnType = void | Promise; diff --git a/src/public/app/components/note_context.ts b/src/public/app/components/note_context.ts index 7af3f94af..95db39501 100644 --- a/src/public/app/components/note_context.ts +++ b/src/public/app/components/note_context.ts @@ -1,13 +1,13 @@ import protectedSessionHolder from "../services/protected_session_holder.js"; import server from "../services/server.js"; import utils from "../services/utils.js"; -import appContext, { EventData, EventListener } from "./app_context.js"; +import appContext, { type EventData, type EventListener } from "./app_context.js"; import treeService from "../services/tree.js"; import Component from "./component.js"; import froca from "../services/froca.js"; import hoistedNoteService from "../services/hoisted_note.js"; import options from "../services/options.js"; -import { ViewScope } from "../services/link.js"; +import type { ViewScope } from "../services/link.js"; import FNote from "../entities/fnote.js"; interface SetNoteOpts { diff --git a/src/public/app/components/root_command_executor.ts b/src/public/app/components/root_command_executor.ts index 643f02c7b..899bfebd2 100644 --- a/src/public/app/components/root_command_executor.ts +++ b/src/public/app/components/root_command_executor.ts @@ -1,5 +1,5 @@ import Component from "./component.js"; -import appContext, { CommandData, CommandListenerData } from "./app_context.js"; +import appContext, { type CommandData, type CommandListenerData } from "./app_context.js"; import dateNoteService from "../services/date_notes.js"; import treeService from "../services/tree.js"; import openService from "../services/open.js"; diff --git a/src/public/app/components/shortcut_component.ts b/src/public/app/components/shortcut_component.ts index d2b1ee8b0..11c20342a 100644 --- a/src/public/app/components/shortcut_component.ts +++ b/src/public/app/components/shortcut_component.ts @@ -1,9 +1,9 @@ -import appContext, { EventData, EventListener } from "./app_context.js"; +import appContext, { type EventData, type EventListener } from "./app_context.js"; import shortcutService from "../services/shortcuts.js"; import server from "../services/server.js"; import Component from "./component.js"; import froca from "../services/froca.js"; -import { AttributeRow } from "../services/load_results.js"; +import type { AttributeRow } from "../services/load_results.js"; export default class ShortcutComponent extends Component implements EventListener<"entitiesReloaded"> { constructor() { diff --git a/src/public/app/entities/fattachment.ts b/src/public/app/entities/fattachment.ts index 67215b33f..274c1bbdb 100644 --- a/src/public/app/entities/fattachment.ts +++ b/src/public/app/entities/fattachment.ts @@ -1,4 +1,4 @@ -import { Froca } from "../services/froca-interface.js"; +import type { Froca } from "../services/froca-interface.js"; export interface FAttachmentRow { attachmentId: string; diff --git a/src/public/app/entities/fattribute.ts b/src/public/app/entities/fattribute.ts index 5ad29db6b..07a2b22c4 100644 --- a/src/public/app/entities/fattribute.ts +++ b/src/public/app/entities/fattribute.ts @@ -1,4 +1,4 @@ -import { Froca } from "../services/froca-interface.js"; +import type { Froca } from "../services/froca-interface.js"; import promotedAttributeDefinitionParser from "../services/promoted_attribute_definition_parser.js"; /** diff --git a/src/public/app/entities/fbranch.ts b/src/public/app/entities/fbranch.ts index fb1879b38..f63401b2d 100644 --- a/src/public/app/entities/fbranch.ts +++ b/src/public/app/entities/fbranch.ts @@ -1,4 +1,4 @@ -import { Froca } from "../services/froca-interface.js"; +import type { Froca } from "../services/froca-interface.js"; export interface FBranchRow { branchId: string; diff --git a/src/public/app/entities/fnote.ts b/src/public/app/entities/fnote.ts index 27ede68ce..ed42257e1 100644 --- a/src/public/app/entities/fnote.ts +++ b/src/public/app/entities/fnote.ts @@ -4,9 +4,9 @@ import ws from "../services/ws.js"; import froca from "../services/froca.js"; import protectedSessionHolder from "../services/protected_session_holder.js"; import cssClassManager from "../services/css_class_manager.js"; -import { Froca } from "../services/froca-interface.js"; +import type { Froca } from "../services/froca-interface.js"; import FAttachment from "./fattachment.js"; -import FAttribute, { AttributeType } from "./fattribute.js"; +import FAttribute, { type AttributeType } from "./fattribute.js"; import utils from "../services/utils.js"; const LABEL = "label"; diff --git a/src/public/app/menus/context_menu.ts b/src/public/app/menus/context_menu.ts index 25e45e38a..8719cc59f 100644 --- a/src/public/app/menus/context_menu.ts +++ b/src/public/app/menus/context_menu.ts @@ -1,4 +1,4 @@ -import { CommandNames } from "../components/app_context.js"; +import type { CommandNames } from "../components/app_context.js"; import keyboardActionService from "../services/keyboard_actions.js"; import utils from "../services/utils.js"; diff --git a/src/public/app/menus/electron_context_menu.ts b/src/public/app/menus/electron_context_menu.ts index 43a504d6d..80c5a7dc2 100644 --- a/src/public/app/menus/electron_context_menu.ts +++ b/src/public/app/menus/electron_context_menu.ts @@ -1,10 +1,10 @@ import utils from "../services/utils.js"; import options from "../services/options.js"; import zoomService from "../components/zoom.js"; -import contextMenu, { MenuItem } from "./context_menu.js"; +import contextMenu, { type MenuItem } from "./context_menu.js"; import { t } from "../services/i18n.js"; import type { BrowserWindow } from "electron"; -import { CommandNames } from "../components/app_context.js"; +import type { CommandNames } from "../components/app_context.js"; function setupContextMenu() { const electron = utils.dynamicRequire("electron"); diff --git a/src/public/app/menus/launcher_context_menu.ts b/src/public/app/menus/launcher_context_menu.ts index da69cb3a9..d61e0e372 100644 --- a/src/public/app/menus/launcher_context_menu.ts +++ b/src/public/app/menus/launcher_context_menu.ts @@ -1,12 +1,12 @@ -import treeService, { Node } from "../services/tree.js"; +import treeService, { type Node } from "../services/tree.js"; import froca from "../services/froca.js"; -import contextMenu, { MenuCommandItem, MenuItem } from "./context_menu.js"; +import contextMenu, { type MenuCommandItem, type MenuItem } from "./context_menu.js"; import dialogService from "../services/dialog.js"; import server from "../services/server.js"; import { t } from "../services/i18n.js"; import type { SelectMenuItemEventListener } from "../components/events.js"; import NoteTreeWidget from "../widgets/note_tree.js"; -import { FilteredCommandNames, ContextMenuCommandData } from "../components/app_context.js"; +import type { FilteredCommandNames, ContextMenuCommandData } from "../components/app_context.js"; type LauncherCommandNames = FilteredCommandNames; diff --git a/src/public/app/menus/link_context_menu.ts b/src/public/app/menus/link_context_menu.ts index e1ecef06d..a099f306d 100644 --- a/src/public/app/menus/link_context_menu.ts +++ b/src/public/app/menus/link_context_menu.ts @@ -1,7 +1,7 @@ import { t } from "../services/i18n.js"; import contextMenu from "./context_menu.js"; import appContext from "../components/app_context.js"; -import { ViewScope } from "../services/link.js"; +import type { ViewScope } from "../services/link.js"; function openContextMenu(notePath: string, e: PointerEvent, viewScope: ViewScope = {}, hoistedNoteId: string | null = null) { contextMenu.show({ diff --git a/src/public/app/menus/tree_context_menu.ts b/src/public/app/menus/tree_context_menu.ts index 15e125ffe..be7983faa 100644 --- a/src/public/app/menus/tree_context_menu.ts +++ b/src/public/app/menus/tree_context_menu.ts @@ -1,9 +1,9 @@ -import treeService, { Node } from "../services/tree.js"; +import treeService, { type Node } from "../services/tree.js"; import froca from "../services/froca.js"; import clipboard from "../services/clipboard.js"; import noteCreateService from "../services/note_create.js"; -import contextMenu, { MenuCommandItem, MenuItem } from "./context_menu.js"; -import appContext, { ContextMenuCommandData, FilteredCommandNames } from "../components/app_context.js"; +import contextMenu, { type MenuCommandItem, type MenuItem } from "./context_menu.js"; +import appContext, { type ContextMenuCommandData, type FilteredCommandNames } from "../components/app_context.js"; import noteTypesService from "../services/note_types.js"; import server from "../services/server.js"; import toastService from "../services/toast.js"; @@ -11,7 +11,7 @@ import dialogService from "../services/dialog.js"; import { t } from "../services/i18n.js"; import NoteTreeWidget from "../widgets/note_tree.js"; import FAttachment from "../entities/fattachment.js"; -import { SelectMenuItemEventListener } from "../components/events.js"; +import type { SelectMenuItemEventListener } from "../components/events.js"; // TODO: Deduplicate once client/server is well split. interface ConvertToAttachmentResponse { diff --git a/src/public/app/server_types.ts b/src/public/app/server_types.ts index 0909e932c..2b8459600 100644 --- a/src/public/app/server_types.ts +++ b/src/public/app/server_types.ts @@ -1,4 +1,4 @@ -import { EntityRowNames } from "./services/load_results.js"; +import type { EntityRowNames } from "./services/load_results.js"; // TODO: Deduplicate with src/services/entity_changes_interface.ts export interface EntityChange { diff --git a/src/public/app/services/attribute_autocomplete.ts b/src/public/app/services/attribute_autocomplete.ts index 2721c13d8..22d99d49b 100644 --- a/src/public/app/services/attribute_autocomplete.ts +++ b/src/public/app/services/attribute_autocomplete.ts @@ -1,4 +1,4 @@ -import { AttributeType } from "../entities/fattribute.js"; +import type { AttributeType } from "../entities/fattribute.js"; import server from "./server.js"; interface InitOptions { diff --git a/src/public/app/services/attribute_parser.ts b/src/public/app/services/attribute_parser.ts index d97f6a9c0..7fa442cf4 100644 --- a/src/public/app/services/attribute_parser.ts +++ b/src/public/app/services/attribute_parser.ts @@ -1,4 +1,4 @@ -import FAttribute, { AttributeType, FAttributeRow } from "../entities/fattribute.js"; +import type { AttributeType, FAttributeRow } from "../entities/fattribute.js"; import utils from "./utils.js"; interface Token { diff --git a/src/public/app/services/attributes.ts b/src/public/app/services/attributes.ts index 48ec1c336..b594630c5 100644 --- a/src/public/app/services/attributes.ts +++ b/src/public/app/services/attributes.ts @@ -1,7 +1,7 @@ import server from "./server.js"; import froca from "./froca.js"; import FNote from "../entities/fnote.js"; -import { AttributeRow } from "./load_results.js"; +import type { AttributeRow } from "./load_results.js"; async function addLabel(noteId: string, name: string, value: string = "") { await server.put(`notes/${noteId}/attribute`, { diff --git a/src/public/app/services/branches.ts b/src/public/app/services/branches.ts index 401ee7b30..9c546b731 100644 --- a/src/public/app/services/branches.ts +++ b/src/public/app/services/branches.ts @@ -1,13 +1,13 @@ import utils from "./utils.js"; import server from "./server.js"; -import toastService, { ToastOptions } from "./toast.js"; +import toastService, { type ToastOptions } from "./toast.js"; import froca from "./froca.js"; import hoistedNoteService from "./hoisted_note.js"; import ws from "./ws.js"; import appContext from "../components/app_context.js"; import { t } from "./i18n.js"; -import { Node } from "./tree.js"; -import { ResolveOptions } from "../widgets/dialogs/delete_notes.js"; +import type { Node } from "./tree.js"; +import type { ResolveOptions } from "../widgets/dialogs/delete_notes.js"; // TODO: Deduplicate type with server interface Response { diff --git a/src/public/app/services/bundle.ts b/src/public/app/services/bundle.ts index a5498348e..e4fc31de2 100644 --- a/src/public/app/services/bundle.ts +++ b/src/public/app/services/bundle.ts @@ -4,7 +4,7 @@ import toastService from "./toast.js"; import froca from "./froca.js"; import utils from "./utils.js"; import { t } from "./i18n.js"; -import { Entity } from "./frontend_script_api.js"; +import type { Entity } from "./frontend_script_api.js"; // TODO: Deduplicate with server. export interface Bundle { diff --git a/src/public/app/services/date_notes.ts b/src/public/app/services/date_notes.ts index 0d604cfa8..17aa7b963 100644 --- a/src/public/app/services/date_notes.ts +++ b/src/public/app/services/date_notes.ts @@ -1,5 +1,5 @@ import dayjs from "dayjs"; -import { FNoteRow } from "../entities/fnote.js"; +import type { FNoteRow } from "../entities/fnote.js"; import froca from "./froca.js"; import server from "./server.js"; import ws from "./ws.js"; diff --git a/src/public/app/services/dialog.ts b/src/public/app/services/dialog.ts index c83edde19..f419232cc 100644 --- a/src/public/app/services/dialog.ts +++ b/src/public/app/services/dialog.ts @@ -1,6 +1,6 @@ import appContext from "../components/app_context.js"; -import { ConfirmDialogOptions, ConfirmWithMessageOptions } from "../widgets/dialogs/confirm.js"; -import { PromptDialogOptions } from "../widgets/dialogs/prompt.js"; +import type { ConfirmDialogOptions, ConfirmWithMessageOptions } from "../widgets/dialogs/confirm.js"; +import type { PromptDialogOptions } from "../widgets/dialogs/prompt.js"; async function info(message: string) { return new Promise((res) => appContext.triggerCommand("showInfoDialog", { message, callback: res })); diff --git a/src/public/app/services/froca.ts b/src/public/app/services/froca.ts index 265cefda8..8849d6331 100644 --- a/src/public/app/services/froca.ts +++ b/src/public/app/services/froca.ts @@ -1,11 +1,11 @@ -import FBranch, { FBranchRow } from "../entities/fbranch.js"; -import FNote, { FNoteRow } from "../entities/fnote.js"; -import FAttribute, { FAttributeRow } from "../entities/fattribute.js"; +import FBranch, { type FBranchRow } from "../entities/fbranch.js"; +import FNote, { type FNoteRow } from "../entities/fnote.js"; +import FAttribute, { type FAttributeRow } from "../entities/fattribute.js"; import server from "./server.js"; import appContext from "../components/app_context.js"; -import FBlob, { FBlobRow } from "../entities/fblob.js"; -import FAttachment, { FAttachmentRow } from "../entities/fattachment.js"; -import { Froca } from "./froca-interface.js"; +import FBlob, { type FBlobRow } from "../entities/fblob.js"; +import FAttachment, { type FAttachmentRow } from "../entities/fattachment.js"; +import type { Froca } from "./froca-interface.js"; interface SubtreeResponse { notes: FNoteRow[]; diff --git a/src/public/app/services/froca_updater.ts b/src/public/app/services/froca_updater.ts index 684213336..89de8c5b7 100644 --- a/src/public/app/services/froca_updater.ts +++ b/src/public/app/services/froca_updater.ts @@ -3,10 +3,10 @@ import froca from "./froca.js"; import utils from "./utils.js"; import options from "./options.js"; import noteAttributeCache from "./note_attribute_cache.js"; -import FBranch, { FBranchRow } from "../entities/fbranch.js"; -import FAttribute, { FAttributeRow } from "../entities/fattribute.js"; -import FAttachment, { FAttachmentRow } from "../entities/fattachment.js"; -import FNote, { FNoteRow } from "../entities/fnote.js"; +import FBranch, { type FBranchRow } from "../entities/fbranch.js"; +import FAttribute, { type FAttributeRow } from "../entities/fattribute.js"; +import FAttachment, { type FAttachmentRow } from "../entities/fattachment.js"; +import FNote, { type FNoteRow } from "../entities/fnote.js"; import type { EntityChange } from "../server_types.js"; async function processEntityChanges(entityChanges: EntityChange[]) { diff --git a/src/public/app/services/hoisted_note.ts b/src/public/app/services/hoisted_note.ts index d05a2c3c8..53d62c081 100644 --- a/src/public/app/services/hoisted_note.ts +++ b/src/public/app/services/hoisted_note.ts @@ -1,5 +1,5 @@ import appContext from "../components/app_context.js"; -import treeService, { Node } from "./tree.js"; +import treeService, { type Node } from "./tree.js"; import dialogService from "./dialog.js"; import froca from "./froca.js"; import NoteContext from "../components/note_context.js"; diff --git a/src/public/app/services/import.ts b/src/public/app/services/import.ts index 77b6d489e..9f06807f2 100644 --- a/src/public/app/services/import.ts +++ b/src/public/app/services/import.ts @@ -1,4 +1,4 @@ -import toastService, { ToastOptions } from "./toast.js"; +import toastService, { type ToastOptions } from "./toast.js"; import server from "./server.js"; import ws from "./ws.js"; import utils from "./utils.js"; diff --git a/src/public/app/services/keyboard_actions.ts b/src/public/app/services/keyboard_actions.ts index 5cadd2219..bdd13e28b 100644 --- a/src/public/app/services/keyboard_actions.ts +++ b/src/public/app/services/keyboard_actions.ts @@ -1,5 +1,5 @@ import server from "./server.js"; -import appContext, { CommandNames } from "../components/app_context.js"; +import appContext, { type CommandNames } from "../components/app_context.js"; import shortcutService from "./shortcuts.js"; import Component from "../components/component.js"; diff --git a/src/public/app/services/link.ts b/src/public/app/services/link.ts index b24107f5e..17879ff22 100644 --- a/src/public/app/services/link.ts +++ b/src/public/app/services/link.ts @@ -1,6 +1,6 @@ import treeService from "./tree.js"; import linkContextMenuService from "../menus/link_context_menu.js"; -import appContext, { NoteCommandData } from "../components/app_context.js"; +import appContext, { type NoteCommandData } from "../components/app_context.js"; import froca from "./froca.js"; import utils from "./utils.js"; diff --git a/src/public/app/services/load_results.ts b/src/public/app/services/load_results.ts index b0a5b2eeb..0f96cee93 100644 --- a/src/public/app/services/load_results.ts +++ b/src/public/app/services/load_results.ts @@ -1,5 +1,5 @@ -import { AttributeType } from "../entities/fattribute.js"; -import { EntityChange } from "../server_types.js"; +import type { AttributeType } from "../entities/fattribute.js"; +import type { EntityChange } from "../server_types.js"; // TODO: Deduplicate with server. diff --git a/src/public/app/services/note_create.ts b/src/public/app/services/note_create.ts index 50c4e62d5..a7fd5ec76 100644 --- a/src/public/app/services/note_create.ts +++ b/src/public/app/services/note_create.ts @@ -8,7 +8,7 @@ import toastService from "./toast.js"; import { t } from "./i18n.js"; import FNote from "../entities/fnote.js"; import FBranch from "../entities/fbranch.js"; -import { ChooseNoteTypeResponse } from "../widgets/dialogs/note_type_chooser.js"; +import type { ChooseNoteTypeResponse } from "../widgets/dialogs/note_type_chooser.js"; interface CreateNoteOpts { isProtected?: boolean; diff --git a/src/public/app/services/note_types.ts b/src/public/app/services/note_types.ts index 61b71775b..433931ae0 100644 --- a/src/public/app/services/note_types.ts +++ b/src/public/app/services/note_types.ts @@ -1,8 +1,8 @@ import server from "./server.js"; import froca from "./froca.js"; import { t } from "./i18n.js"; -import { MenuItem } from "../menus/context_menu.js"; -import { ContextMenuCommandData, FilteredCommandNames } from "../components/app_context.js"; +import type { MenuItem } from "../menus/context_menu.js"; +import type { ContextMenuCommandData, FilteredCommandNames } from "../components/app_context.js"; type NoteTypeCommandNames = FilteredCommandNames; diff --git a/src/public/app/services/render.ts b/src/public/app/services/render.ts index 5c48fd3f0..0eb02c7a7 100644 --- a/src/public/app/services/render.ts +++ b/src/public/app/services/render.ts @@ -1,5 +1,5 @@ import server from "./server.js"; -import bundleService, { Bundle } from "./bundle.js"; +import bundleService, { type Bundle } from "./bundle.js"; import FNote from "../entities/fnote.js"; async function render(note: FNote, $el: JQuery) { diff --git a/src/public/app/services/script_context.ts b/src/public/app/services/script_context.ts index a654fa3d9..27a8a7d44 100644 --- a/src/public/app/services/script_context.ts +++ b/src/public/app/services/script_context.ts @@ -1,4 +1,4 @@ -import FrontendScriptApi, { Entity } from "./frontend_script_api.js"; +import FrontendScriptApi, { type Entity } from "./frontend_script_api.js"; import utils from "./utils.js"; import froca from "./froca.js"; diff --git a/src/public/app/services/ws.ts b/src/public/app/services/ws.ts index d6c392b5c..7f735c458 100644 --- a/src/public/app/services/ws.ts +++ b/src/public/app/services/ws.ts @@ -5,7 +5,7 @@ import options from "./options.js"; import frocaUpdater from "./froca_updater.js"; import appContext from "../components/app_context.js"; import { t } from "./i18n.js"; -import { EntityChange } from "../server_types.js"; +import type { EntityChange } from "../server_types.js"; type MessageHandler = (message: any) => void; const messageHandlers: MessageHandler[] = []; diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.ts b/src/public/app/widgets/attribute_widgets/attribute_detail.ts index 17d4d1d2f..7ea7061a9 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_detail.ts +++ b/src/public/app/widgets/attribute_widgets/attribute_detail.ts @@ -10,9 +10,7 @@ import SpacedUpdate from "../../services/spaced_update.js"; import utils from "../../services/utils.js"; import shortcutService from "../../services/shortcuts.js"; import appContext from "../../components/app_context.js"; -import FAttribute from "../../entities/fattribute.js"; -import FNote, { FNoteRow } from "../../entities/fnote.js"; -import { Attribute } from "../../services/attribute_parser.js"; +import type { Attribute } from "../../services/attribute_parser.js"; const TPL = `
diff --git a/src/public/app/widgets/attribute_widgets/attribute_editor.ts b/src/public/app/widgets/attribute_widgets/attribute_editor.ts index 68dafbcbc..0119bcd3b 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_editor.ts +++ b/src/public/app/widgets/attribute_widgets/attribute_editor.ts @@ -3,7 +3,7 @@ import NoteContextAwareWidget from "../note_context_aware_widget.js"; import noteAutocompleteService from "../../services/note_autocomplete.js"; import server from "../../services/server.js"; import contextMenuService from "../../menus/context_menu.js"; -import attributeParser, { Attribute } from "../../services/attribute_parser.js"; +import attributeParser from "../../services/attribute_parser.js"; import libraryLoader from "../../services/library_loader.js"; import froca from "../../services/froca.js"; import attributeRenderer from "../../services/attribute_renderer.js"; @@ -11,8 +11,8 @@ import noteCreateService from "../../services/note_create.js"; import attributeService from "../../services/attributes.js"; import linkService from "../../services/link.js"; import AttributeDetailWidget from "./attribute_detail.js"; -import { CommandData, EventData, EventListener, FilteredCommandNames } from "../../components/app_context.js"; -import FAttribute, { AttributeType } from "../../entities/fattribute.js"; +import type { CommandData, EventData, EventListener, FilteredCommandNames } from "../../components/app_context.js"; +import FAttribute, { type AttributeType } from "../../entities/fattribute.js"; import FNote from "../../entities/fnote.js"; const HELP_TEXT = ` diff --git a/src/public/app/widgets/buttons/command_button.ts b/src/public/app/widgets/buttons/command_button.ts index 0bfb8625c..8929f49a8 100644 --- a/src/public/app/widgets/buttons/command_button.ts +++ b/src/public/app/widgets/buttons/command_button.ts @@ -1,6 +1,6 @@ -import { CommandNames } from "../../components/app_context.js"; -import keyboardActionsService, { Action } from "../../services/keyboard_actions.js"; -import AbstractButtonWidget, { AbstractButtonWidgetSettings } from "./abstract_button.js"; +import type { CommandNames } from "../../components/app_context.js"; +import keyboardActionsService, { type Action } from "../../services/keyboard_actions.js"; +import AbstractButtonWidget, { type AbstractButtonWidgetSettings } from "./abstract_button.js"; let actions: Action[]; diff --git a/src/public/app/widgets/buttons/onclick_button.ts b/src/public/app/widgets/buttons/onclick_button.ts index 90ef6661c..b3630695a 100644 --- a/src/public/app/widgets/buttons/onclick_button.ts +++ b/src/public/app/widgets/buttons/onclick_button.ts @@ -1,4 +1,4 @@ -import AbstractButtonWidget, { AbstractButtonWidgetSettings } from "./abstract_button.js"; +import AbstractButtonWidget, { type AbstractButtonWidgetSettings } from "./abstract_button.js"; import { t } from "../../services/i18n.js"; export type ClickHandler = (widget: OnClickButtonWidget, e: JQuery.ClickEvent) => void; diff --git a/src/public/app/widgets/containers/launcher.ts b/src/public/app/widgets/containers/launcher.ts index a1b86cdda..41024073a 100644 --- a/src/public/app/widgets/containers/launcher.ts +++ b/src/public/app/widgets/containers/launcher.ts @@ -12,7 +12,7 @@ import TodayLauncher from "../buttons/launcher/today_launcher.js"; import HistoryNavigationButton from "../buttons/history_navigation.js"; import QuickSearchLauncherWidget from "../quick_search_launcher.js"; import FNote from "../../entities/fnote.js"; -import { CommandNames } from "../../components/app_context.js"; +import type { CommandNames } from "../../components/app_context.js"; interface InnerWidget extends BasicWidget { settings?: { diff --git a/src/public/app/widgets/containers/launcher_container.ts b/src/public/app/widgets/containers/launcher_container.ts index 55d83030b..9c5a6eec7 100644 --- a/src/public/app/widgets/containers/launcher_container.ts +++ b/src/public/app/widgets/containers/launcher_container.ts @@ -1,6 +1,6 @@ import FlexContainer from "./flex_container.js"; import froca from "../../services/froca.js"; -import appContext, { EventData } from "../../components/app_context.js"; +import appContext, { type EventData } from "../../components/app_context.js"; import LauncherWidget from "./launcher.js"; import utils from "../../services/utils.js"; diff --git a/src/public/app/widgets/dialogs/delete_notes.ts b/src/public/app/widgets/dialogs/delete_notes.ts index 0781c4618..abf3907d3 100644 --- a/src/public/app/widgets/dialogs/delete_notes.ts +++ b/src/public/app/widgets/dialogs/delete_notes.ts @@ -4,7 +4,7 @@ import linkService from "../../services/link.js"; import utils from "../../services/utils.js"; import BasicWidget from "../basic_widget.js"; import { t } from "../../services/i18n.js"; -import FAttribute, { FAttributeRow } from "../../entities/fattribute.js"; +import type { FAttributeRow } from "../../entities/fattribute.js"; // TODO: Use common with server. interface Response { diff --git a/src/public/app/widgets/dialogs/note_type_chooser.ts b/src/public/app/widgets/dialogs/note_type_chooser.ts index 21178433a..bc81ad999 100644 --- a/src/public/app/widgets/dialogs/note_type_chooser.ts +++ b/src/public/app/widgets/dialogs/note_type_chooser.ts @@ -1,5 +1,5 @@ -import { CommandNames } from "../../components/app_context.js"; -import { MenuCommandItem } from "../../menus/context_menu.js"; +import type { CommandNames } from "../../components/app_context.js"; +import type { MenuCommandItem } from "../../menus/context_menu.js"; import { t } from "../../services/i18n.js"; import noteTypesService from "../../services/note_types.js"; import BasicWidget from "../basic_widget.js"; diff --git a/src/public/app/widgets/highlights_list.ts b/src/public/app/widgets/highlights_list.ts index ab314bf0a..8b8fb06de 100644 --- a/src/public/app/widgets/highlights_list.ts +++ b/src/public/app/widgets/highlights_list.ts @@ -10,7 +10,7 @@ import attributeService from "../services/attributes.js"; import RightPanelWidget from "./right_panel_widget.js"; import options from "../services/options.js"; import OnClickButtonWidget from "./buttons/onclick_button.js"; -import appContext, { EventData } from "../components/app_context.js"; +import appContext, { type EventData } from "../components/app_context.js"; import libraryLoader from "../services/library_loader.js"; import FNote from "../entities/fnote.js"; diff --git a/src/public/app/widgets/mobile_widgets/sidebar_container.ts b/src/public/app/widgets/mobile_widgets/sidebar_container.ts index b1bf58e6f..cbb56e901 100644 --- a/src/public/app/widgets/mobile_widgets/sidebar_container.ts +++ b/src/public/app/widgets/mobile_widgets/sidebar_container.ts @@ -1,7 +1,7 @@ -import { EventData } from "../../components/app_context.js"; -import { Screen } from "../../components/mobile_screen_switcher.js"; +import type { EventData } from "../../components/app_context.js"; +import type { Screen } from "../../components/mobile_screen_switcher.js"; import BasicWidget from "../basic_widget.js"; -import FlexContainer, { FlexDirection } from "../containers/flex_container.js"; +import FlexContainer, { type FlexDirection } from "../containers/flex_container.js"; const DRAG_STATE_NONE = 0; const DRAG_STATE_INITIAL_DRAG = 1; diff --git a/src/public/app/widgets/note_context_aware_widget.ts b/src/public/app/widgets/note_context_aware_widget.ts index 596b92ac6..a9b0be97f 100644 --- a/src/public/app/widgets/note_context_aware_widget.ts +++ b/src/public/app/widgets/note_context_aware_widget.ts @@ -1,5 +1,5 @@ import BasicWidget from "./basic_widget.js"; -import appContext, { EventData } from "../components/app_context.js"; +import appContext, { type EventData } from "../components/app_context.js"; import FNote from "../entities/fnote.js"; import NoteContext from "../components/note_context.js"; diff --git a/src/public/app/widgets/type_widgets/options/appearance/fonts.ts b/src/public/app/widgets/type_widgets/options/appearance/fonts.ts index 0cbcd32ab..fe6327ad3 100644 --- a/src/public/app/widgets/type_widgets/options/appearance/fonts.ts +++ b/src/public/app/widgets/type_widgets/options/appearance/fonts.ts @@ -1,7 +1,7 @@ import OptionsWidget from "../options_widget.js"; import utils from "../../../../services/utils.js"; import { t } from "../../../../services/i18n.js"; -import { FontFamily, OptionMap, OptionNames } from "../../../../../../services/options_interface.js"; +import type { FontFamily, OptionMap, OptionNames } from "../../../../../../services/options_interface.js"; interface FontFamilyEntry { value: FontFamily; diff --git a/src/public/app/widgets/type_widgets/options/options_widget.ts b/src/public/app/widgets/type_widgets/options/options_widget.ts index 77d52bb69..1248a37d1 100644 --- a/src/public/app/widgets/type_widgets/options/options_widget.ts +++ b/src/public/app/widgets/type_widgets/options/options_widget.ts @@ -1,5 +1,5 @@ -import { FilterOptionsByType, OptionDefinitions, OptionMap, OptionNames } from "../../../../../services/options_interface.js"; -import { EventData, EventListener } from "../../../components/app_context.js"; +import type { FilterOptionsByType, OptionDefinitions, OptionMap, OptionNames } from "../../../../../services/options_interface.js"; +import type { EventData, EventListener } from "../../../components/app_context.js"; import FNote from "../../../entities/fnote.js"; import { t } from "../../../services/i18n.js"; import server from "../../../services/server.js"; diff --git a/src/routes/api/attachments.ts b/src/routes/api/attachments.ts index b5f54fce0..a609b93dc 100644 --- a/src/routes/api/attachments.ts +++ b/src/routes/api/attachments.ts @@ -2,7 +2,7 @@ import becca from "../../becca/becca.js"; import blobService from "../../services/blob.js"; import ValidationError from "../../errors/validation_error.js"; import imageService from "../../services/image.js"; -import { Request } from "express"; +import type { Request } from "express"; function getAttachmentBlob(req: Request) { const preview = req.query.preview === "true"; diff --git a/src/routes/api/attributes.ts b/src/routes/api/attributes.ts index 647e1a206..b28ca4b4f 100644 --- a/src/routes/api/attributes.ts +++ b/src/routes/api/attributes.ts @@ -6,7 +6,7 @@ import attributeService from "../../services/attributes.js"; import BAttribute from "../../becca/entities/battribute.js"; import becca from "../../becca/becca.js"; import ValidationError from "../../errors/validation_error.js"; -import { Request } from "express"; +import type { Request } from "express"; function getEffectiveNoteAttributes(req: Request) { const note = becca.getNote(req.params.noteId); diff --git a/src/routes/api/autocomplete.ts b/src/routes/api/autocomplete.ts index 012065c5d..27d2e69f3 100644 --- a/src/routes/api/autocomplete.ts +++ b/src/routes/api/autocomplete.ts @@ -6,7 +6,7 @@ import log from "../../services/log.js"; import utils from "../../services/utils.js"; import cls from "../../services/cls.js"; import becca from "../../becca/becca.js"; -import { Request } from "express"; +import type { Request } from "express"; import ValidationError from "../../errors/validation_error.js"; function getAutocomplete(req: Request) { diff --git a/src/routes/api/branches.ts b/src/routes/api/branches.ts index a80805db0..746ebb92a 100644 --- a/src/routes/api/branches.ts +++ b/src/routes/api/branches.ts @@ -11,7 +11,7 @@ import branchService from "../../services/branches.js"; import log from "../../services/log.js"; import ValidationError from "../../errors/validation_error.js"; import eventService from "../../services/events.js"; -import { Request } from "express"; +import type { Request } from "express"; /** * Code in this file deals with moving and cloning branches. The relationship between note and parent note is unique diff --git a/src/routes/api/bulk_action.ts b/src/routes/api/bulk_action.ts index 4688b5c43..d2b35dd20 100644 --- a/src/routes/api/bulk_action.ts +++ b/src/routes/api/bulk_action.ts @@ -1,4 +1,4 @@ -import { Request } from "express"; +import type { Request } from "express"; import becca from "../../becca/becca.js"; import bulkActionService from "../../services/bulk_actions.js"; diff --git a/src/routes/api/clipper.ts b/src/routes/api/clipper.ts index 98b7d3d44..08fd2bc94 100644 --- a/src/routes/api/clipper.ts +++ b/src/routes/api/clipper.ts @@ -1,6 +1,6 @@ "use strict"; -import { Request } from "express"; +import type { Request } from "express"; import attributeService from "../../services/attributes.js"; import cloneService from "../../services/cloning.js"; diff --git a/src/routes/api/cloning.ts b/src/routes/api/cloning.ts index c000575dc..175fcfd9b 100644 --- a/src/routes/api/cloning.ts +++ b/src/routes/api/cloning.ts @@ -1,6 +1,6 @@ "use strict"; -import { Request } from "express"; +import type { Request } from "express"; import cloningService from "../../services/cloning.js"; function cloneNoteToBranch(req: Request) { diff --git a/src/routes/api/database.ts b/src/routes/api/database.ts index 2329a8863..6d2856c23 100644 --- a/src/routes/api/database.ts +++ b/src/routes/api/database.ts @@ -5,7 +5,7 @@ import log from "../../services/log.js"; import backupService from "../../services/backup.js"; import anonymizationService from "../../services/anonymization.js"; import consistencyChecksService from "../../services/consistency_checks.js"; -import { Request } from "express"; +import type { Request } from "express"; import ValidationError from "../../errors/validation_error.js"; import sql_init from "../../services/sql_init.js"; import becca_loader from "../../becca/becca_loader.js"; diff --git a/src/routes/api/etapi_tokens.ts b/src/routes/api/etapi_tokens.ts index ffcdb6c61..fa1b73b17 100644 --- a/src/routes/api/etapi_tokens.ts +++ b/src/routes/api/etapi_tokens.ts @@ -1,4 +1,4 @@ -import { Request } from "express"; +import type { Request } from "express"; import etapiTokenService from "../../services/etapi_tokens.js"; function getTokens() { diff --git a/src/routes/api/export.ts b/src/routes/api/export.ts index c99b5396f..9023125f9 100644 --- a/src/routes/api/export.ts +++ b/src/routes/api/export.ts @@ -7,7 +7,7 @@ import becca from "../../becca/becca.js"; import TaskContext from "../../services/task_context.js"; import log from "../../services/log.js"; import NotFoundError from "../../errors/not_found_error.js"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import ValidationError from "../../errors/validation_error.js"; function exportBranch(req: Request, res: Response) { diff --git a/src/routes/api/files.ts b/src/routes/api/files.ts index 67db64317..38987e3b2 100644 --- a/src/routes/api/files.ts +++ b/src/routes/api/files.ts @@ -11,7 +11,7 @@ import chokidar from "chokidar"; import ws from "../../services/ws.js"; import becca from "../../becca/becca.js"; import ValidationError from "../../errors/validation_error.js"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import BNote from "../../becca/entities/bnote.js"; import BAttachment from "../../becca/entities/battachment.js"; diff --git a/src/routes/api/fonts.ts b/src/routes/api/fonts.ts index 38a784354..9bdc3aa5b 100644 --- a/src/routes/api/fonts.ts +++ b/src/routes/api/fonts.ts @@ -1,6 +1,6 @@ -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import optionService from "../../services/options.js"; -import { OptionMap } from "../../services/options_interface.js"; +import type { OptionMap } from "../../services/options_interface.js"; const SYSTEM_SANS_SERIF = [ "system-ui", diff --git a/src/routes/api/image.ts b/src/routes/api/image.ts index 4712e9a34..55cea89a1 100644 --- a/src/routes/api/image.ts +++ b/src/routes/api/image.ts @@ -3,7 +3,7 @@ import imageService from "../../services/image.js"; import becca from "../../becca/becca.js"; import fs from "fs"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import BNote from "../../becca/entities/bnote.js"; import BRevision from "../../becca/entities/brevision.js"; import { RESOURCE_DIR } from "../../services/resource_dir.js"; diff --git a/src/routes/api/import.ts b/src/routes/api/import.ts index 5e65fb58e..661cf3bb9 100644 --- a/src/routes/api/import.ts +++ b/src/routes/api/import.ts @@ -11,7 +11,7 @@ import beccaLoader from "../../becca/becca_loader.js"; import log from "../../services/log.js"; import TaskContext from "../../services/task_context.js"; import ValidationError from "../../errors/validation_error.js"; -import { Request } from "express"; +import type { Request } from "express"; import BNote from "../../becca/entities/bnote.js"; async function importNotesToBranch(req: Request) { diff --git a/src/routes/api/login.ts b/src/routes/api/login.ts index 598136fbe..3a6d43e99 100644 --- a/src/routes/api/login.ts +++ b/src/routes/api/login.ts @@ -12,7 +12,7 @@ import sqlInit from "../../services/sql_init.js"; import sql from "../../services/sql.js"; import ws from "../../services/ws.js"; import etapiTokenService from "../../services/etapi_tokens.js"; -import { Request } from "express"; +import type { Request } from "express"; function loginSync(req: Request) { if (!sqlInit.schemaExists()) { diff --git a/src/routes/api/note_map.ts b/src/routes/api/note_map.ts index 2b2b43eec..960938717 100644 --- a/src/routes/api/note_map.ts +++ b/src/routes/api/note_map.ts @@ -4,7 +4,7 @@ import becca from "../../becca/becca.js"; import { JSDOM } from "jsdom"; import BNote from "../../becca/entities/bnote.js"; import BAttribute from "../../becca/entities/battribute.js"; -import { Request } from "express"; +import type { Request } from "express"; function buildDescendantCountMap(noteIdsToCount: string[]) { if (!Array.isArray(noteIdsToCount)) { diff --git a/src/routes/api/notes.ts b/src/routes/api/notes.ts index 622acfc77..b155a95bd 100644 --- a/src/routes/api/notes.ts +++ b/src/routes/api/notes.ts @@ -10,9 +10,9 @@ import TaskContext from "../../services/task_context.js"; import becca from "../../becca/becca.js"; import ValidationError from "../../errors/validation_error.js"; import blobService from "../../services/blob.js"; -import { Request } from "express"; +import type { Request } from "express"; import BBranch from "../../becca/entities/bbranch.js"; -import { AttributeRow } from "../../becca/entities/rows.js"; +import type { AttributeRow } from "../../becca/entities/rows.js"; function getNote(req: Request) { return becca.getNoteOrThrow(req.params.noteId); diff --git a/src/routes/api/options.ts b/src/routes/api/options.ts index 87e0f47ba..257344cab 100644 --- a/src/routes/api/options.ts +++ b/src/routes/api/options.ts @@ -4,7 +4,7 @@ import optionService from "../../services/options.js"; import log from "../../services/log.js"; import searchService from "../../services/search/services/search.js"; import ValidationError from "../../errors/validation_error.js"; -import { Request } from "express"; +import type { Request } from "express"; import { changeLanguage } from "../../services/i18n.js"; import { listSyntaxHighlightingThemes } from "../../services/code_block_theme.js"; import type { OptionNames } from "../../services/options_interface.js"; diff --git a/src/routes/api/other.ts b/src/routes/api/other.ts index 38fbbc280..f18644d9c 100644 --- a/src/routes/api/other.ts +++ b/src/routes/api/other.ts @@ -1,4 +1,4 @@ -import { Request } from "express"; +import type { Request } from "express"; import becca from "../../becca/becca.js"; import markdownService from "../../services/import/markdown.js"; diff --git a/src/routes/api/password.ts b/src/routes/api/password.ts index 18f89b493..b3292dcc4 100644 --- a/src/routes/api/password.ts +++ b/src/routes/api/password.ts @@ -2,7 +2,7 @@ import passwordService from "../../services/encryption/password.js"; import ValidationError from "../../errors/validation_error.js"; -import { Request } from "express"; +import type { Request } from "express"; function changePassword(req: Request) { if (passwordService.isPasswordSet()) { diff --git a/src/routes/api/recent_changes.ts b/src/routes/api/recent_changes.ts index 4c0de24ae..55a5ee9da 100644 --- a/src/routes/api/recent_changes.ts +++ b/src/routes/api/recent_changes.ts @@ -4,8 +4,8 @@ import sql from "../../services/sql.js"; import protectedSessionService from "../../services/protected_session.js"; import noteService from "../../services/notes.js"; import becca from "../../becca/becca.js"; -import { Request } from "express"; -import { RevisionRow } from "../../becca/entities/rows.js"; +import type { Request } from "express"; +import type { RevisionRow } from "../../becca/entities/rows.js"; interface RecentChangeRow { noteId: string; diff --git a/src/routes/api/recent_notes.ts b/src/routes/api/recent_notes.ts index 2ac0216fc..b09e166d7 100644 --- a/src/routes/api/recent_notes.ts +++ b/src/routes/api/recent_notes.ts @@ -3,7 +3,7 @@ import BRecentNote from "../../becca/entities/brecent_note.js"; import sql from "../../services/sql.js"; import dateUtils from "../../services/date_utils.js"; -import { Request } from "express"; +import type { Request } from "express"; function addRecentNote(req: Request) { new BRecentNote({ diff --git a/src/routes/api/relation-map.ts b/src/routes/api/relation-map.ts index b83e5e89b..503bb36ef 100644 --- a/src/routes/api/relation-map.ts +++ b/src/routes/api/relation-map.ts @@ -1,4 +1,4 @@ -import { Request } from "express"; +import type { Request } from "express"; import becca from "../../becca/becca.js"; import sql from "../../services/sql.js"; diff --git a/src/routes/api/revisions.ts b/src/routes/api/revisions.ts index 39ea76a72..0df082199 100644 --- a/src/routes/api/revisions.ts +++ b/src/routes/api/revisions.ts @@ -9,10 +9,10 @@ import path from "path"; import becca from "../../becca/becca.js"; import blobService from "../../services/blob.js"; import eraseService from "../../services/erase.js"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import BRevision from "../../becca/entities/brevision.js"; import BNote from "../../becca/entities/bnote.js"; -import { NotePojo } from "../../becca/becca-interface.js"; +import { type NotePojo } from "../../becca/becca-interface.js"; interface NotePath { noteId: string; diff --git a/src/routes/api/script.ts b/src/routes/api/script.ts index 916a017cf..6907a5d9c 100644 --- a/src/routes/api/script.ts +++ b/src/routes/api/script.ts @@ -5,7 +5,7 @@ import attributeService from "../../services/attributes.js"; import becca from "../../becca/becca.js"; import syncService from "../../services/sync.js"; import sql from "../../services/sql.js"; -import { Request } from "express"; +import type { Request } from "express"; interface ScriptBody { script: string; diff --git a/src/routes/api/search.ts b/src/routes/api/search.ts index d5d500161..b8d153c16 100644 --- a/src/routes/api/search.ts +++ b/src/routes/api/search.ts @@ -1,10 +1,10 @@ "use strict"; -import { Request } from "express"; +import type { Request } from "express"; import becca from "../../becca/becca.js"; import SearchContext from "../../services/search/search_context.js"; -import searchService, { EMPTY_RESULT, SearchNoteResult } from "../../services/search/services/search.js"; +import searchService, { EMPTY_RESULT, type SearchNoteResult } from "../../services/search/services/search.js"; import bulkActionService from "../../services/bulk_actions.js"; import cls from "../../services/cls.js"; import attributeFormatter from "../../services/attribute_formatter.js"; diff --git a/src/routes/api/sender.ts b/src/routes/api/sender.ts index d77298983..d9b1dbf29 100644 --- a/src/routes/api/sender.ts +++ b/src/routes/api/sender.ts @@ -5,7 +5,7 @@ import imageService from "../../services/image.js"; import noteService from "../../services/notes.js"; import sanitizeAttributeName from "../../services/sanitize_attribute_name.js"; import specialNotesService from "../../services/special_notes.js"; -import { Request } from "express"; +import type { Request } from "express"; async function uploadImage(req: Request) { const file = req.file; diff --git a/src/routes/api/setup.ts b/src/routes/api/setup.ts index 863247381..e4e5a6729 100644 --- a/src/routes/api/setup.ts +++ b/src/routes/api/setup.ts @@ -4,7 +4,7 @@ import sqlInit from "../../services/sql_init.js"; import setupService from "../../services/setup.js"; import log from "../../services/log.js"; import appInfo from "../../services/app_info.js"; -import { Request } from "express"; +import type { Request } from "express"; function getStatus() { return { diff --git a/src/routes/api/similar_notes.ts b/src/routes/api/similar_notes.ts index a845ee3a5..930f53282 100644 --- a/src/routes/api/similar_notes.ts +++ b/src/routes/api/similar_notes.ts @@ -1,6 +1,6 @@ "use strict"; -import { Request } from "express"; +import type { Request } from "express"; import similarityService from "../../becca/similarity.js"; import becca from "../../becca/becca.js"; diff --git a/src/routes/api/special_notes.ts b/src/routes/api/special_notes.ts index 282adbc83..7a5a1f616 100644 --- a/src/routes/api/special_notes.ts +++ b/src/routes/api/special_notes.ts @@ -5,7 +5,7 @@ import sql from "../../services/sql.js"; import cls from "../../services/cls.js"; import specialNotesService from "../../services/special_notes.js"; import becca from "../../becca/becca.js"; -import { Request } from "express"; +import type { Request } from "express"; function getInboxNote(req: Request) { return specialNotesService.getInboxNote(req.params.date); diff --git a/src/routes/api/sql.ts b/src/routes/api/sql.ts index 6e9ead1e4..ed440f42d 100644 --- a/src/routes/api/sql.ts +++ b/src/routes/api/sql.ts @@ -2,7 +2,7 @@ import sql from "../../services/sql.js"; import becca from "../../becca/becca.js"; -import { Request } from "express"; +import type { Request } from "express"; import ValidationError from "../../errors/validation_error.js"; function getSchema() { diff --git a/src/routes/api/stats.ts b/src/routes/api/stats.ts index 21fd728e0..15e28f083 100644 --- a/src/routes/api/stats.ts +++ b/src/routes/api/stats.ts @@ -1,6 +1,6 @@ import sql from "../../services/sql.js"; import becca from "../../becca/becca.js"; -import { Request } from "express"; +import type { Request } from "express"; function getNoteSize(req: Request) { const { noteId } = req.params; diff --git a/src/routes/api/sync.ts b/src/routes/api/sync.ts index 704c6fbed..d157fb4ed 100644 --- a/src/routes/api/sync.ts +++ b/src/routes/api/sync.ts @@ -11,8 +11,8 @@ import log from "../../services/log.js"; import syncOptions from "../../services/sync_options.js"; import utils from "../../services/utils.js"; import ws from "../../services/ws.js"; -import { Request } from "express"; -import { EntityChange } from "../../services/entity_changes_interface.js"; +import type { Request } from "express"; +import type { EntityChange } from "../../services/entity_changes_interface.js"; import ValidationError from "../../errors/validation_error.js"; import consistencyChecksService from "../../services/consistency_checks.js"; import { t } from "i18next"; diff --git a/src/routes/api/tree.ts b/src/routes/api/tree.ts index f404ff7b7..fb2d4f2ef 100644 --- a/src/routes/api/tree.ts +++ b/src/routes/api/tree.ts @@ -3,7 +3,7 @@ import becca from "../../becca/becca.js"; import log from "../../services/log.js"; import NotFoundError from "../../errors/not_found_error.js"; -import { Request } from "express"; +import type { Request } from "express"; import BNote from "../../becca/entities/bnote.js"; function getNotesAndBranchesAndAttributes(_noteIds: string[] | Set) { diff --git a/src/routes/custom.ts b/src/routes/custom.ts index 3d6ff93d3..f2b961f80 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -4,7 +4,7 @@ import scriptService from "../services/script.js"; import cls from "../services/cls.js"; import sql from "../services/sql.js"; import becca from "../becca/becca.js"; -import { Request, Response, Router } from "express"; +import type { Request, Response, Router } from "express"; function handleRequest(req: Request, res: Response) { // express puts content after first slash into 0 index element diff --git a/src/routes/electron.ts b/src/routes/electron.ts index 186ff98ad..13147a803 100644 --- a/src/routes/electron.ts +++ b/src/routes/electron.ts @@ -1,5 +1,5 @@ import { ipcMain } from "electron"; -import { Application } from "express"; +import type { Application } from "express"; interface Response { statusCode: number; diff --git a/src/routes/error_handlers.ts b/src/routes/error_handlers.ts index eb1aa0f91..a73599e38 100644 --- a/src/routes/error_handlers.ts +++ b/src/routes/error_handlers.ts @@ -1,4 +1,4 @@ -import { Application, NextFunction, Request, Response } from "express"; +import type { Application, NextFunction, Request, Response } from "express"; import log from "../services/log.js"; function register(app: Application) { diff --git a/src/routes/index.ts b/src/routes/index.ts index 70758c2e9..5115630a0 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -11,7 +11,7 @@ import protectedSessionService from "../services/protected_session.js"; import packageJson from "../../package.json" with { type: "json" }; import assetPath from "../services/asset_path.js"; import appPath from "../services/app_path.js"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import BNote from "../becca/entities/bnote.js"; function index(req: Request, res: Response) { diff --git a/src/routes/login.ts b/src/routes/login.ts index 26a8e4280..cbb746c30 100644 --- a/src/routes/login.ts +++ b/src/routes/login.ts @@ -8,7 +8,7 @@ import passwordService from "../services/encryption/password.js"; import assetPath from "../services/asset_path.js"; import appPath from "../services/app_path.js"; import ValidationError from "../errors/validation_error.js"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; function loginPage(req: Request, res: Response) { res.render("login", { diff --git a/src/routes/setup.ts b/src/routes/setup.ts index 15fd0b470..a186ba51d 100644 --- a/src/routes/setup.ts +++ b/src/routes/setup.ts @@ -5,7 +5,7 @@ import setupService from "../services/setup.js"; import utils from "../services/utils.js"; import assetPath from "../services/asset_path.js"; import appPath from "../services/app_path.js"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; function setupPage(req: Request, res: Response) { if (sqlInit.isDbInitialized()) { diff --git a/src/services/api-interface.ts b/src/services/api-interface.ts index 908e8dc0c..bc6506be2 100644 --- a/src/services/api-interface.ts +++ b/src/services/api-interface.ts @@ -1,4 +1,4 @@ -import { OptionRow } from "../becca/entities/rows.js"; +import type { OptionRow } from "../becca/entities/rows.js"; /** * Response for /api/setup/status. diff --git a/src/services/attribute_formatter.ts b/src/services/attribute_formatter.ts index fa0d75838..4385debf3 100644 --- a/src/services/attribute_formatter.ts +++ b/src/services/attribute_formatter.ts @@ -1,6 +1,6 @@ "use strict"; -import { AttributeRow } from "../becca/entities/rows.js"; +import type { AttributeRow } from "../becca/entities/rows.js"; function formatAttrForSearch(attr: AttributeRow, searchWithValue: boolean) { let searchStr = ""; diff --git a/src/services/attributes.ts b/src/services/attributes.ts index 69de8d864..dc70ff75f 100644 --- a/src/services/attributes.ts +++ b/src/services/attributes.ts @@ -7,7 +7,7 @@ import BAttribute from "../becca/entities/battribute.js"; import attributeFormatter from "./attribute_formatter.js"; import BUILTIN_ATTRIBUTES from "./builtin_attributes.js"; import BNote from "../becca/entities/bnote.js"; -import { AttributeRow } from "../becca/entities/rows.js"; +import type { AttributeRow } from "../becca/entities/rows.js"; const ATTRIBUTE_TYPES = new Set(["label", "relation"]); diff --git a/src/services/backend_script_api.ts b/src/services/backend_script_api.ts index a5655caf4..ca34ddbfd 100644 --- a/src/services/backend_script_api.ts +++ b/src/services/backend_script_api.ts @@ -31,10 +31,10 @@ import BAttachment from "../becca/entities/battachment.js"; import BRevision from "../becca/entities/brevision.js"; import BEtapiToken from "../becca/entities/betapi_token.js"; import BOption from "../becca/entities/boption.js"; -import { AttributeRow } from "../becca/entities/rows.js"; +import type { AttributeRow } from "../becca/entities/rows.js"; import Becca from "../becca/becca-interface.js"; -import { NoteParams } from "./note-interface.js"; -import { ApiParams } from "./backend_script_api_interface.js"; +import type { NoteParams } from "./note-interface.js"; +import type { ApiParams } from "./backend_script_api_interface.js"; /** * A whole number diff --git a/src/services/backend_script_api_interface.ts b/src/services/backend_script_api_interface.ts index 6c0525a1e..55cfe0a36 100644 --- a/src/services/backend_script_api_interface.ts +++ b/src/services/backend_script_api_interface.ts @@ -1,4 +1,4 @@ -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import AbstractBeccaEntity from "../becca/entities/abstract_becca_entity.js"; import BNote from "../becca/entities/bnote.js"; diff --git a/src/services/cls.ts b/src/services/cls.ts index b07e1026a..cd213748b 100644 --- a/src/services/cls.ts +++ b/src/services/cls.ts @@ -1,5 +1,5 @@ import clsHooked from "cls-hooked"; -import { EntityChange } from "./entity_changes_interface.js"; +import type { EntityChange } from "./entity_changes_interface.js"; const namespace = clsHooked.createNamespace("trilium"); type Callback = (...args: any[]) => any; diff --git a/src/services/consistency_checks.ts b/src/services/consistency_checks.ts index 743765af0..8e7da9c9e 100644 --- a/src/services/consistency_checks.ts +++ b/src/services/consistency_checks.ts @@ -14,8 +14,8 @@ import { hash as getHash, hashedBlobId, randomString } from "../services/utils.j import eraseService from "../services/erase.js"; import sanitizeAttributeName from "./sanitize_attribute_name.js"; import noteTypesService from "../services/note_types.js"; -import { BranchRow } from "../becca/entities/rows.js"; -import { EntityChange } from "./entity_changes_interface.js"; +import type { BranchRow } from "../becca/entities/rows.js"; +import type { EntityChange } from "./entity_changes_interface.js"; import becca_loader from "../becca/becca_loader.js"; const noteTypes = noteTypesService.getNoteTypeNames(); diff --git a/src/services/entity_changes.ts b/src/services/entity_changes.ts index 4f7a3fe3f..f3abfba5d 100644 --- a/src/services/entity_changes.ts +++ b/src/services/entity_changes.ts @@ -6,7 +6,7 @@ import { randomString } from "./utils.js"; import instanceId from "./instance_id.js"; import becca from "../becca/becca.js"; import blobService from "../services/blob.js"; -import { EntityChange } from "./entity_changes_interface.js"; +import type { EntityChange } from "./entity_changes_interface.js"; import type { Blob } from "./blob-interface.js"; import eventService from "./events.js"; diff --git a/src/services/erase.ts b/src/services/erase.ts index 806c5232b..e07cfaa4c 100644 --- a/src/services/erase.ts +++ b/src/services/erase.ts @@ -5,7 +5,7 @@ import optionService from "./options.js"; import dateUtils from "./date_utils.js"; import sqlInit from "./sql_init.js"; import cls from "./cls.js"; -import { EntityChange } from "./entity_changes_interface.js"; +import type { EntityChange } from "./entity_changes_interface.js"; function eraseNotes(noteIdsToErase: string[]) { if (noteIdsToErase.length === 0) { diff --git a/src/services/export/opml.ts b/src/services/export/opml.ts index 146716016..bf02899aa 100644 --- a/src/services/export/opml.ts +++ b/src/services/export/opml.ts @@ -4,7 +4,7 @@ import { getContentDisposition, stripTags } from "../utils.js"; import becca from "../../becca/becca.js"; import TaskContext from "../task_context.js"; import BBranch from "../../becca/entities/bbranch.js"; -import { Response } from "express"; +import type { Response } from "express"; function exportToOpml(taskContext: TaskContext, branch: BBranch, version: string, res: Response) { if (!["1.0", "2.0"].includes(version)) { diff --git a/src/services/export/single.ts b/src/services/export/single.ts index 713e42a00..2c7b8a83f 100644 --- a/src/services/export/single.ts +++ b/src/services/export/single.ts @@ -7,7 +7,7 @@ import mdService from "./md.js"; import becca from "../../becca/becca.js"; import TaskContext from "../task_context.js"; import BBranch from "../../becca/entities/bbranch.js"; -import { Response } from "express"; +import type { Response } from "express"; function exportSingleNote(taskContext: TaskContext, branch: BBranch, format: "html" | "markdown", res: Response) { const note = branch.getNote(); diff --git a/src/services/export/zip.ts b/src/services/export/zip.ts index 26e73fea4..3f0093cd0 100644 --- a/src/services/export/zip.ts +++ b/src/services/export/zip.ts @@ -15,11 +15,11 @@ import archiver from "archiver"; import log from "../log.js"; import TaskContext from "../task_context.js"; import ValidationError from "../../errors/validation_error.js"; -import NoteMeta from "../meta/note_meta.js"; -import AttachmentMeta from "../meta/attachment_meta.js"; -import AttributeMeta from "../meta/attribute_meta.js"; +import type NoteMeta from "../meta/note_meta.js"; +import type AttachmentMeta from "../meta/attachment_meta.js"; +import type AttributeMeta from "../meta/attribute_meta.js"; import BBranch from "../../becca/entities/bbranch.js"; -import { Response } from "express"; +import type { Response } from "express"; import { RESOURCE_DIR } from "../resource_dir.js"; async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "html" | "markdown", res: Response | fs.WriteStream, setHeaders = true) { diff --git a/src/services/handlers.ts b/src/services/handlers.ts index 31e6fa01d..053f84d0f 100644 --- a/src/services/handlers.ts +++ b/src/services/handlers.ts @@ -8,7 +8,7 @@ import hiddenSubtreeService from "./hidden_subtree.js"; import oneTimeTimer from "./one_time_timer.js"; import BNote from "../becca/entities/bnote.js"; import AbstractBeccaEntity from "../becca/entities/abstract_becca_entity.js"; -import { DefinitionObject } from "./promoted_attribute_definition_interface.js"; +import type { DefinitionObject } from "./promoted_attribute_definition_interface.js"; type Handler = (definition: DefinitionObject, note: BNote, targetNote: BNote) => void; diff --git a/src/services/hidden_subtree.ts b/src/services/hidden_subtree.ts index 677f82010..afb7384fa 100644 --- a/src/services/hidden_subtree.ts +++ b/src/services/hidden_subtree.ts @@ -1,5 +1,5 @@ import BAttribute from "../becca/entities/battribute.js"; -import { AttributeType, NoteType } from "../becca/entities/rows.js"; +import type { AttributeType, NoteType } from "../becca/entities/rows.js"; import becca from "../becca/becca.js"; import noteService from "./notes.js"; diff --git a/src/services/import/enex.ts b/src/services/import/enex.ts index f7557351f..0699b0376 100644 --- a/src/services/import/enex.ts +++ b/src/services/import/enex.ts @@ -11,8 +11,8 @@ import htmlSanitizer from "../html_sanitizer.js"; import sanitizeAttributeName from "../sanitize_attribute_name.js"; import TaskContext from "../task_context.js"; import BNote from "../../becca/entities/bnote.js"; -import { File } from "./common.js"; -import { AttributeType } from "../../becca/entities/rows.js"; +import type { File } from "./common.js"; +import type { AttributeType } from "../../becca/entities/rows.js"; /** * date format is e.g. 20181121T193703Z or 2013-04-14T16:19:00.000Z (Mac evernote, see #3496) diff --git a/src/services/import/mime.ts b/src/services/import/mime.ts index 14e9f5d48..10463c242 100644 --- a/src/services/import/mime.ts +++ b/src/services/import/mime.ts @@ -2,7 +2,7 @@ import mimeTypes from "mime-types"; import path from "path"; -import { TaskData } from "../task_context_interface.js"; +import type { TaskData } from "../task_context_interface.js"; const CODE_MIME_TYPES: Record = { "text/plain": true, diff --git a/src/services/import/single.ts b/src/services/import/single.ts index 0b6f1401e..ceea7dede 100644 --- a/src/services/import/single.ts +++ b/src/services/import/single.ts @@ -11,7 +11,7 @@ import mimeService from "./mime.js"; import { getNoteTitle } from "../../services/utils.js"; import importUtils from "./utils.js"; import htmlSanitizer from "../html_sanitizer.js"; -import { File } from "./common.js"; +import type { File } from "./common.js"; function importSingleFile(taskContext: TaskContext, file: File, parentNote: BNote) { const mime = mimeService.getMime(file.originalname) || file.mimetype; diff --git a/src/services/import/zip.ts b/src/services/import/zip.ts index 8d5bb9105..e552ef7d1 100644 --- a/src/services/import/zip.ts +++ b/src/services/import/zip.ts @@ -17,10 +17,10 @@ import BAttachment from "../../becca/entities/battachment.js"; import markdownService from "./markdown.js"; import TaskContext from "../task_context.js"; import BNote from "../../becca/entities/bnote.js"; -import NoteMeta from "../meta/note_meta.js"; -import AttributeMeta from "../meta/attribute_meta.js"; +import type NoteMeta from "../meta/note_meta.js"; +import type AttributeMeta from "../meta/attribute_meta.js"; import { Stream } from "stream"; -import { ALLOWED_NOTE_TYPES, NoteType } from "../../becca/entities/rows.js"; +import { ALLOWED_NOTE_TYPES, type NoteType } from "../../becca/entities/rows.js"; interface MetaFile { files: NoteMeta[]; diff --git a/src/services/keyboard_actions.ts b/src/services/keyboard_actions.ts index 0bb338046..aca668568 100644 --- a/src/services/keyboard_actions.ts +++ b/src/services/keyboard_actions.ts @@ -3,7 +3,7 @@ import optionService from "./options.js"; import log from "./log.js"; import { isElectron as getIsElectron, isMac as getIsMac } from "./utils.js"; -import { KeyboardShortcut } from "./keyboard_actions_interface.js"; +import type { KeyboardShortcut } from "./keyboard_actions_interface.js"; import { t } from "i18next"; const isMac = getIsMac(); diff --git a/src/services/log.ts b/src/services/log.ts index 257f4f81b..fe877dbcc 100644 --- a/src/services/log.ts +++ b/src/services/log.ts @@ -1,6 +1,6 @@ "use strict"; -import { Request, Response } from "express"; +import type { Request, Response } from "express"; import fs from "fs"; import dataDir from "./data_dir.js"; import cls from "./cls.js"; diff --git a/src/services/meta/attachment_meta.ts b/src/services/meta/attachment_meta.ts index 6fef1989a..f0c50360f 100644 --- a/src/services/meta/attachment_meta.ts +++ b/src/services/meta/attachment_meta.ts @@ -1,4 +1,4 @@ -interface AttachmentMeta { +export default interface AttachmentMeta { attachmentId?: string; title: string; role: string; @@ -6,5 +6,3 @@ interface AttachmentMeta { position?: number; dataFileName: string; } - -export default AttachmentMeta; diff --git a/src/services/meta/attribute_meta.ts b/src/services/meta/attribute_meta.ts index 648dc1c1d..1946b5132 100644 --- a/src/services/meta/attribute_meta.ts +++ b/src/services/meta/attribute_meta.ts @@ -1,6 +1,6 @@ -import { AttributeType } from "../../becca/entities/rows.js"; +import type { AttributeType } from "../../becca/entities/rows.js"; -interface AttributeMeta { +export default interface AttributeMeta { noteId?: string; type: AttributeType; name: string; @@ -8,5 +8,3 @@ interface AttributeMeta { isInheritable?: boolean; position?: number; } - -export default AttributeMeta; diff --git a/src/services/meta/note_meta.ts b/src/services/meta/note_meta.ts index a613c4781..79d2e4cd2 100644 --- a/src/services/meta/note_meta.ts +++ b/src/services/meta/note_meta.ts @@ -1,7 +1,7 @@ -import AttachmentMeta from "./attachment_meta.js"; -import AttributeMeta from "./attribute_meta.js"; +import type AttachmentMeta from "./attachment_meta.js"; +import type AttributeMeta from "./attribute_meta.js"; -interface NoteMeta { +export default interface NoteMeta { noteId?: string; notePath?: string[]; isClone?: boolean; @@ -22,5 +22,3 @@ interface NoteMeta { attachments?: AttachmentMeta[]; children?: NoteMeta[]; } - -export default NoteMeta; diff --git a/src/services/note-interface.ts b/src/services/note-interface.ts index 5d86587a9..4efa62eb0 100644 --- a/src/services/note-interface.ts +++ b/src/services/note-interface.ts @@ -1,4 +1,4 @@ -import { NoteType } from "../becca/entities/rows.js"; +import type { NoteType } from "../becca/entities/rows.js"; export interface NoteParams { /** optionally can force specific noteId */ diff --git a/src/services/notes.ts b/src/services/notes.ts index 9582b7281..518166e3a 100644 --- a/src/services/notes.ts +++ b/src/services/notes.ts @@ -23,9 +23,9 @@ import noteTypesService from "./note_types.js"; import fs from "fs"; import ws from "./ws.js"; import html2plaintext from "html2plaintext"; -import { AttachmentRow, AttributeRow, BranchRow, NoteRow, NoteType } from "../becca/entities/rows.js"; +import type { AttachmentRow, AttributeRow, BranchRow, NoteRow } from "../becca/entities/rows.js"; import TaskContext from "./task_context.js"; -import { NoteParams } from "./note-interface.js"; +import type { NoteParams } from "./note-interface.js"; import imageService from "./image.js"; import { t } from "i18next"; diff --git a/src/services/options.ts b/src/services/options.ts index 980a730a6..a5516df1a 100644 --- a/src/services/options.ts +++ b/src/services/options.ts @@ -14,8 +14,8 @@ import becca from "../becca/becca.js"; import BOption from "../becca/entities/boption.js"; -import { OptionRow } from "../becca/entities/rows.js"; -import { FilterOptionsByType, OptionDefinitions, OptionMap, OptionNames } from "./options_interface.js"; +import type { OptionRow } from "../becca/entities/rows.js"; +import type { FilterOptionsByType, OptionDefinitions, OptionMap, OptionNames } from "./options_interface.js"; import sql from "./sql.js"; function getOptionOrNull(name: OptionNames): string | null { diff --git a/src/services/options_init.ts b/src/services/options_init.ts index b7d3fdf8e..f4a98cf23 100644 --- a/src/services/options_init.ts +++ b/src/services/options_init.ts @@ -5,7 +5,7 @@ import { randomSecureToken, isWindows } from "./utils.js"; import log from "./log.js"; import dateUtils from "./date_utils.js"; import keyboardActions from "./keyboard_actions.js"; -import { KeyboardShortcutWithRequiredActionName } from "./keyboard_actions_interface.js"; +import type { KeyboardShortcutWithRequiredActionName } from "./keyboard_actions_interface.js"; function initDocumentOptions() { optionService.createOption("documentId", randomSecureToken(16), false); diff --git a/src/services/options_interface.ts b/src/services/options_interface.ts index 36c78be76..9e30019c9 100644 --- a/src/services/options_interface.ts +++ b/src/services/options_interface.ts @@ -1,4 +1,4 @@ -import { KeyboardActionNames } from "./keyboard_actions_interface.js"; +import type { KeyboardActionNames } from "./keyboard_actions_interface.js"; /** * A dictionary where the keys are the option keys (e.g. `theme`) and their corresponding values. diff --git a/src/services/promoted_attribute_definition_parser.ts b/src/services/promoted_attribute_definition_parser.ts index 53a7d8e85..630c57a72 100644 --- a/src/services/promoted_attribute_definition_parser.ts +++ b/src/services/promoted_attribute_definition_parser.ts @@ -1,4 +1,4 @@ -import { DefinitionObject } from "./promoted_attribute_definition_interface.js"; +import type { DefinitionObject } from "./promoted_attribute_definition_interface.js"; function parse(value: string): DefinitionObject { const tokens = value.split(",").map((t) => t.trim()); diff --git a/src/services/request.ts b/src/services/request.ts index d06339fc8..0d000cba2 100644 --- a/src/services/request.ts +++ b/src/services/request.ts @@ -4,7 +4,7 @@ import { isElectron } from "./utils.js"; import log from "./log.js"; import url from "url"; import syncOptions from "./sync_options.js"; -import { ExecOpts } from "./request_interface.js"; +import type { ExecOpts } from "./request_interface.js"; // this service provides abstraction over node's HTTP/HTTPS and electron net.client APIs // this allows supporting system proxy diff --git a/src/services/script.ts b/src/services/script.ts index 300b2af98..fedc1edc7 100644 --- a/src/services/script.ts +++ b/src/services/script.ts @@ -3,7 +3,7 @@ import cls from "./cls.js"; import log from "./log.js"; import becca from "../becca/becca.js"; import BNote from "../becca/entities/bnote.js"; -import { ApiParams } from "./backend_script_api_interface.js"; +import type { ApiParams } from "./backend_script_api_interface.js"; interface Bundle { note?: BNote; diff --git a/src/services/script_context.ts b/src/services/script_context.ts index cd183b6ff..e30f6369b 100644 --- a/src/services/script_context.ts +++ b/src/services/script_context.ts @@ -1,7 +1,7 @@ import { toObject } from "./utils.js"; import BackendScriptApi from "./backend_script_api.js"; import BNote from "../becca/entities/bnote.js"; -import { ApiParams } from "./backend_script_api_interface.js"; +import type { ApiParams } from "./backend_script_api_interface.js"; type Module = { exports: any[]; diff --git a/src/services/search/expressions/note_content_fulltext.ts b/src/services/search/expressions/note_content_fulltext.ts index 15c722b08..741a54a03 100644 --- a/src/services/search/expressions/note_content_fulltext.ts +++ b/src/services/search/expressions/note_content_fulltext.ts @@ -1,6 +1,6 @@ "use strict"; -import { NoteRow } from "../../../becca/entities/rows.js"; +import type { NoteRow } from "../../../becca/entities/rows.js"; import SearchContext from "../search_context.js"; import Expression from "./expression.js"; @@ -58,7 +58,7 @@ class NoteContentFulltextExp extends Expression { for (const row of sql.iterateRows(` SELECT noteId, type, mime, content, isProtected - FROM notes JOIN blobs USING (blobId) + FROM notes JOIN blobs USING (blobId) WHERE type IN ('text', 'code', 'mermaid', 'canvas', 'mindMap') AND isDeleted = 0`)) { this.findInText(row, inputNoteSet, resultNoteSet); } diff --git a/src/services/search/search_context.ts b/src/services/search/search_context.ts index 1b96e7474..5efc890a8 100644 --- a/src/services/search/search_context.ts +++ b/src/services/search/search_context.ts @@ -1,7 +1,7 @@ "use strict"; import hoistedNoteService from "../hoisted_note.js"; -import { SearchParams } from "./services/types.js"; +import type { SearchParams } from "./services/types.js"; class SearchContext { fastSearch: boolean; diff --git a/src/services/search/services/handle_parens.ts b/src/services/search/services/handle_parens.ts index 63deed2d1..6fe182cab 100644 --- a/src/services/search/services/handle_parens.ts +++ b/src/services/search/services/handle_parens.ts @@ -1,4 +1,4 @@ -import { TokenData, TokenStructure } from "./types.js"; +import type { TokenData, TokenStructure } from "./types.js"; /** * This will create a recursive object from a list of tokens - tokens between parenthesis are grouped in a single array diff --git a/src/services/search/services/lex.ts b/src/services/search/services/lex.ts index 3247e0fda..5b80691d9 100644 --- a/src/services/search/services/lex.ts +++ b/src/services/search/services/lex.ts @@ -1,4 +1,4 @@ -import { TokenData } from "./types.js"; +import type { TokenData } from "./types.js"; function lex(str: string) { str = str.toLowerCase(); diff --git a/src/services/search/services/parse.ts b/src/services/search/services/parse.ts index 38c08c692..25ff8395a 100644 --- a/src/services/search/services/parse.ts +++ b/src/services/search/services/parse.ts @@ -21,7 +21,7 @@ import { removeDiacritic } from "../../utils.js"; import TrueExp from "../expressions/true.js"; import IsHiddenExp from "../expressions/is_hidden.js"; import SearchContext from "../search_context.js"; -import { TokenData, TokenStructure } from "./types.js"; +import type { TokenData, TokenStructure } from "./types.js"; import Expression from "../expressions/expression.js"; function getFulltext(_tokens: TokenData[], searchContext: SearchContext) { diff --git a/src/services/search/services/search.ts b/src/services/search/services/search.ts index 586f42c01..842c7a272 100644 --- a/src/services/search/services/search.ts +++ b/src/services/search/services/search.ts @@ -13,7 +13,7 @@ import log from "../../log.js"; import hoistedNoteService from "../../hoisted_note.js"; import BNote from "../../../becca/entities/bnote.js"; import BAttribute from "../../../becca/entities/battribute.js"; -import { SearchParams, TokenStructure } from "./types.js"; +import type { SearchParams, TokenStructure } from "./types.js"; import Expression from "../expressions/expression.js"; import sql from "../../sql.js"; import scriptService from "../../script.js"; @@ -122,12 +122,12 @@ function loadNeededInfoFromDatabase() { length: number; }; const noteContentLengths = sql.getRows(` - SELECT - noteId, + SELECT + noteId, blobId, - LENGTH(content) AS length + LENGTH(content) AS length FROM notes - JOIN blobs USING(blobId) + JOIN blobs USING(blobId) WHERE notes.isDeleted = 0`); for (const { noteId, blobId, length } of noteContentLengths) { @@ -155,7 +155,7 @@ function loadNeededInfoFromDatabase() { FROM attachments JOIN notes ON attachments.ownerId = notes.noteId JOIN blobs ON attachments.blobId = blobs.blobId - WHERE attachments.isDeleted = 0 + WHERE attachments.isDeleted = 0 AND notes.isDeleted = 0`); for (const { noteId, blobId, length } of attachmentContentLengths) { @@ -183,13 +183,13 @@ function loadNeededInfoFromDatabase() { isNoteRevision: true; }; const revisionContentLengths = sql.getRows(` - SELECT - noteId, + SELECT + noteId, revisions.blobId, LENGTH(content) AS length, 1 AS isNoteRevision FROM notes - JOIN revisions USING(noteId) + JOIN revisions USING(noteId) JOIN blobs ON revisions.blobId = blobs.blobId WHERE notes.isDeleted = 0 UNION ALL diff --git a/src/services/setup.ts b/src/services/setup.ts index b1b09a621..a20fb670f 100644 --- a/src/services/setup.ts +++ b/src/services/setup.ts @@ -7,7 +7,7 @@ import request from "./request.js"; import appInfo from "./app_info.js"; import { timeLimit } from "./utils.js"; import becca from "../becca/becca.js"; -import { SetupStatusResponse, SetupSyncSeedResponse } from "./api-interface.js"; +import type { SetupStatusResponse, SetupSyncSeedResponse } from "./api-interface.js"; async function hasSyncServerSchemaAndSeed() { const response = await requestToSyncServer("GET", "/api/setup/status"); diff --git a/src/services/sql_init.ts b/src/services/sql_init.ts index a870c26ae..8c68a3898 100644 --- a/src/services/sql_init.ts +++ b/src/services/sql_init.ts @@ -10,7 +10,7 @@ import TaskContext from "./task_context.js"; import migrationService from "./migration.js"; import cls from "./cls.js"; import config from "./config.js"; -import { OptionRow } from "../becca/entities/rows.js"; +import type { OptionRow } from "../becca/entities/rows.js"; import BNote from "../becca/entities/bnote.js"; import BBranch from "../becca/entities/bbranch.js"; import zipImportService from "./import/zip.js"; diff --git a/src/services/sync.ts b/src/services/sync.ts index 052ba6542..bfaf828f9 100644 --- a/src/services/sync.ts +++ b/src/services/sync.ts @@ -17,8 +17,8 @@ import ws from "./ws.js"; import entityChangesService from "./entity_changes.js"; import entityConstructor from "../becca/entity_constructor.js"; import becca from "../becca/becca.js"; -import { EntityChange, EntityChangeRecord, EntityRow } from "./entity_changes_interface.js"; -import { CookieJar, ExecOpts } from "./request_interface.js"; +import type { EntityChange, EntityChangeRecord, EntityRow } from "./entity_changes_interface.js"; +import type { CookieJar, ExecOpts } from "./request_interface.js"; import setupService from "./setup.js"; import consistency_checks from "./consistency_checks.js"; import becca_loader from "../becca/becca_loader.js"; diff --git a/src/services/sync_update.ts b/src/services/sync_update.ts index 326fc5d11..fae50dd70 100644 --- a/src/services/sync_update.ts +++ b/src/services/sync_update.ts @@ -4,7 +4,7 @@ import entityChangesService from "./entity_changes.js"; import eventService from "./events.js"; import entityConstructor from "../becca/entity_constructor.js"; import ws from "./ws.js"; -import { EntityChange, EntityChangeRecord, EntityRow } from "./entity_changes_interface.js"; +import type { EntityChange, EntityChangeRecord, EntityRow } from "./entity_changes_interface.js"; interface UpdateContext { alreadyErased: number; diff --git a/src/services/task_context.ts b/src/services/task_context.ts index 9319b84a8..f83154147 100644 --- a/src/services/task_context.ts +++ b/src/services/task_context.ts @@ -1,6 +1,6 @@ "use strict"; -import { TaskData } from "./task_context_interface.js"; +import type { TaskData } from "./task_context_interface.js"; import ws from "./ws.js"; // taskId => TaskContext diff --git a/src/services/window.ts b/src/services/window.ts index 8333fe727..c9307cba9 100644 --- a/src/services/window.ts +++ b/src/services/window.ts @@ -8,7 +8,8 @@ import sqlInit from "./sql_init.js"; import cls from "./cls.js"; import keyboardActionsService from "./keyboard_actions.js"; import remoteMain from "@electron/remote/main/index.js"; -import { App, BrowserWindow, BrowserWindowConstructorOptions, WebContents, ipcMain } from "electron"; +import type { App, BrowserWindow, BrowserWindowConstructorOptions, WebContents } from "electron"; +import { ipcMain } from "electron"; import { isMac, isWindows } from "./utils.js"; import { fileURLToPath } from "url"; diff --git a/src/services/ws.ts b/src/services/ws.ts index 19252d921..e38e06129 100644 --- a/src/services/ws.ts +++ b/src/services/ws.ts @@ -11,7 +11,7 @@ import AbstractBeccaEntity from "../becca/entities/abstract_becca_entity.js"; import env from "./env.js"; import { IncomingMessage, Server } from "http"; -import { EntityChange } from "./entity_changes_interface.js"; +import type { EntityChange } from "./entity_changes_interface.js"; if (env.isDev()) { const chokidar = (await import("chokidar")).default; diff --git a/src/share/shaca/entities/sattachment.ts b/src/share/shaca/entities/sattachment.ts index aa7a8a9ee..c2bb7f755 100644 --- a/src/share/shaca/entities/sattachment.ts +++ b/src/share/shaca/entities/sattachment.ts @@ -4,8 +4,8 @@ import sql from "../../sql.js"; import utils from "../../../services/utils.js"; import AbstractShacaEntity from "./abstract_shaca_entity.js"; import SNote from "./snote.js"; -import { Blob } from "../../../services/blob-interface.js"; -import { SAttachmentRow } from "./rows.js"; +import type { Blob } from "../../../services/blob-interface.js"; +import type { SAttachmentRow } from "./rows.js"; class SAttachment extends AbstractShacaEntity { private attachmentId: string; diff --git a/src/share/shaca/entities/sattribute.ts b/src/share/shaca/entities/sattribute.ts index ba80c0a12..66c8fadc7 100644 --- a/src/share/shaca/entities/sattribute.ts +++ b/src/share/shaca/entities/sattribute.ts @@ -1,7 +1,7 @@ "use strict"; import AbstractShacaEntity from "./abstract_shaca_entity.js"; -import { SAttributeRow } from "./rows.js"; +import type { SAttributeRow } from "./rows.js"; import SNote from "./snote.js"; class SAttribute extends AbstractShacaEntity { diff --git a/src/share/shaca/entities/sbranch.ts b/src/share/shaca/entities/sbranch.ts index 82a8170ca..4d5e54052 100644 --- a/src/share/shaca/entities/sbranch.ts +++ b/src/share/shaca/entities/sbranch.ts @@ -1,7 +1,7 @@ "use strict"; import AbstractShacaEntity from "./abstract_shaca_entity.js"; -import { SBranchRow } from "./rows.js"; +import type { SBranchRow } from "./rows.js"; import SNote from "./snote.js"; class SBranch extends AbstractShacaEntity { diff --git a/src/share/shaca/entities/snote.ts b/src/share/shaca/entities/snote.ts index 511789f13..404125257 100644 --- a/src/share/shaca/entities/snote.ts +++ b/src/share/shaca/entities/snote.ts @@ -4,11 +4,11 @@ import sql from "../../sql.js"; import utils from "../../../services/utils.js"; import AbstractShacaEntity from "./abstract_shaca_entity.js"; import escape from "escape-html"; -import { Blob } from "../../../services/blob-interface.js"; +import type { Blob } from "../../../services/blob-interface.js"; import SAttachment from "./sattachment.js"; import SAttribute from "./sattribute.js"; import SBranch from "./sbranch.js"; -import { SNoteRow } from "./rows.js"; +import type { SNoteRow } from "./rows.js"; const LABEL = "label"; const RELATION = "relation"; diff --git a/src/share/shaca/shaca_loader.ts b/src/share/shaca/shaca_loader.ts index 1766cdce4..474f5be37 100644 --- a/src/share/shaca/shaca_loader.ts +++ b/src/share/shaca/shaca_loader.ts @@ -9,7 +9,7 @@ import SAttribute from "./entities/sattribute.js"; import SAttachment from "./entities/sattachment.js"; import shareRoot from "../share_root.js"; import eventService from "../../services/events.js"; -import { SAttachmentRow, SAttributeRow, SBranchRow, SNoteRow } from "./entities/rows.js"; +import type { SAttachmentRow, SAttributeRow, SBranchRow, SNoteRow } from "./entities/rows.js"; function load() { const start = Date.now(); diff --git a/tsconfig.json b/tsconfig.json index 03f9119c9..3f5a12b91 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,8 @@ "lib": ["ES2022"], "downlevelIteration": true, "skipLibCheck": true, - "esModuleInterop": true + "esModuleInterop": true, + "verbatimModuleSyntax": true }, "include": ["./src/**/*.js", "./src/**/*.ts", "./*.ts", "./spec/**/*.ts"], "exclude": ["./node_modules/**/*", "./spec-es6/**/*.ts"],