mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 10:40:41 +01:00
server-esm: Change some more export object to export default object
This commit is contained in:
@@ -90,7 +90,7 @@ function getExistingAnonymizedDatabases() {
|
||||
}));
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getFullAnonymizationScript,
|
||||
createAnonymizedCopy,
|
||||
getExistingAnonymizedDatabases
|
||||
|
||||
@@ -8,7 +8,7 @@ const APP_DB_VERSION = 228;
|
||||
const SYNC_VERSION = 32;
|
||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||
|
||||
export = {
|
||||
export default {
|
||||
appVersion: packageJson.version,
|
||||
dbVersion: APP_DB_VERSION,
|
||||
nodeVersion: process.version,
|
||||
|
||||
@@ -110,7 +110,7 @@ function isAttributeDangerous(type: string, name: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getNotesWithLabel,
|
||||
getNoteWithLabel,
|
||||
createLabel,
|
||||
|
||||
@@ -126,7 +126,7 @@ function checkCredentials(req: AppRequest, res: Response, next: NextFunction) {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
checkAuth,
|
||||
checkApiAuth,
|
||||
checkAppInitialized,
|
||||
|
||||
@@ -75,7 +75,7 @@ if (!fs.existsSync(dataDir.BACKUP_DIR)) {
|
||||
fs.mkdirSync(dataDir.BACKUP_DIR, 0o700);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getExistingBackups,
|
||||
backupNow,
|
||||
regularBackup
|
||||
|
||||
@@ -54,7 +54,7 @@ function calculateContentHash({blobId, content}: Blob) {
|
||||
return utils.hash(`${blobId}|${content.toString()}`);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getBlobPojo,
|
||||
processContent,
|
||||
calculateContentHash
|
||||
|
||||
@@ -44,7 +44,7 @@ function moveBranchToBranch(branchToMove: BBranch, targetParentBranch: BBranch,
|
||||
return res;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
moveBranchToBranch,
|
||||
moveBranchToNote
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
export = { buildDate:"2024-07-14T22:32:45+03:00", buildRevision: "b811f3d399aed7e740bd8e92ef7edc7d15de7038" };
|
||||
export default { buildDate:"2024-07-14T22:32:45+03:00", buildRevision: "b811f3d399aed7e740bd8e92ef7edc7d15de7038" };
|
||||
|
||||
@@ -175,7 +175,7 @@ function cloneNoteAfter(noteId: string, afterBranchId: string) {
|
||||
return { success: true, branchId: branch.branchId };
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
cloneNoteToBranch,
|
||||
cloneNoteToParentNote,
|
||||
ensureNoteIsPresentInParent,
|
||||
|
||||
@@ -96,7 +96,7 @@ function ignoreEntityChangeIds() {
|
||||
namespace.set('ignoreEntityChangeIds', true);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
init,
|
||||
wrap,
|
||||
get,
|
||||
|
||||
@@ -913,7 +913,7 @@ sqlInit.dbReady.then(() => {
|
||||
setTimeout(cls.wrap(runPeriodicChecks), 4 * 1000);
|
||||
});
|
||||
|
||||
export = {
|
||||
export default {
|
||||
runOnDemandChecks,
|
||||
runEntityChangesChecks
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ function checkContentHashes(otherHashes: Record<string, SectorHash>) {
|
||||
return failedChecks;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getEntityHashes,
|
||||
checkContentHashes
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ const LOG_DIR = process.env.TRILIUM_LOG_DIR || `${DIR_SEP}log`;
|
||||
const ANONYMIZED_DB_DIR = process.env.TRILIUM_ANONYMIZED_DB_DIR || `${DIR_SEP}anonymized-db`;
|
||||
const CONFIG_INI_PATH = process.env.TRILIUM_CONFIG_INI_PATH || `${DIR_SEP}config.ini`;
|
||||
|
||||
export = {
|
||||
export default {
|
||||
TRILIUM_DATA_DIR,
|
||||
DOCUMENT_PATH,
|
||||
BACKUP_DIR,
|
||||
|
||||
@@ -226,7 +226,7 @@ function getWeekNote(dateStr: string, options: WeekNoteOpts = {}, rootNote: BNot
|
||||
return getDayNote(dateStr, rootNote);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getRootCalendarNote,
|
||||
getYearNote,
|
||||
getMonthNote,
|
||||
|
||||
@@ -95,7 +95,7 @@ function validateUtcDateTime(str: string | undefined) {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
utcNowDateTime,
|
||||
localNowDateTime,
|
||||
localNowDate,
|
||||
|
||||
@@ -112,7 +112,7 @@ function decryptString(dataKey: Buffer, cipherText: string) {
|
||||
return buffer.toString('utf-8');
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
encrypt,
|
||||
decrypt,
|
||||
decryptString
|
||||
|
||||
@@ -22,7 +22,7 @@ function getScryptHash(password: crypto.BinaryLike, salt: crypto.BinaryLike) {
|
||||
return hashed;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getVerificationHash,
|
||||
getPasswordDerivedKey
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ function resetPassword() {
|
||||
};
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
isPasswordSet,
|
||||
changePassword,
|
||||
setPassword,
|
||||
|
||||
@@ -33,7 +33,7 @@ function getDataKey(password: string) {
|
||||
return decryptedDataKey;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
verifyPassword,
|
||||
getDataKey,
|
||||
setDataKey
|
||||
|
||||
@@ -193,7 +193,7 @@ function recalculateMaxEntityChangeId() {
|
||||
maxEntityChangeId = sql.getValue<number>("SELECT COALESCE(MAX(id), 0) FROM entity_changes");
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
putNoteReorderingEntityChange,
|
||||
putEntityChangeForOtherInstances,
|
||||
putEntityChangeWithForcedChange,
|
||||
|
||||
@@ -186,7 +186,7 @@ sqlInit.dbReady.then(() => {
|
||||
setInterval(cls.wrap(() => eraseScheduledAttachments()), 3600 * 1000);
|
||||
});
|
||||
|
||||
export = {
|
||||
export default {
|
||||
eraseDeletedNotesNow,
|
||||
eraseUnusedAttachmentsNow,
|
||||
eraseNotesWithDeleteId,
|
||||
|
||||
@@ -114,7 +114,7 @@ function deleteToken(etapiTokenId: string) {
|
||||
etapiToken.markAsDeletedSimple();
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getTokens,
|
||||
createToken,
|
||||
renameToken,
|
||||
|
||||
@@ -59,7 +59,7 @@ function emit(eventType: string, data?: any) {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
subscribe,
|
||||
subscribeBeccaLoader,
|
||||
emit,
|
||||
|
||||
@@ -582,7 +582,7 @@ async function exportToZipFile(noteId: string, format: "markdown" | "html", zipF
|
||||
log.info(`Exported '${noteId}' with format '${format}' to '${zipFilePath}'`);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
exportToZip,
|
||||
exportToZipFile
|
||||
};
|
||||
|
||||
@@ -362,7 +362,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: Item) {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
checkHiddenSubtree,
|
||||
LBTPL_ROOT,
|
||||
LBTPL_BASE,
|
||||
|
||||
@@ -33,7 +33,7 @@ function getWorkspaceNote() {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getHoistedNoteId,
|
||||
getWorkspaceNote,
|
||||
isHoistedInHiddenSubtree
|
||||
|
||||
@@ -47,7 +47,7 @@ function sanitize(dirtyHtml: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
sanitize,
|
||||
sanitizeUrl: (url: string) => {
|
||||
return sanitizeUrl.sanitizeUrl(url).trim();
|
||||
|
||||
@@ -234,7 +234,7 @@ async function resize(buffer: Buffer, quality: number) {
|
||||
return resultBuffer;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
saveImage,
|
||||
saveImageToAttachment,
|
||||
updateImage
|
||||
|
||||
@@ -409,4 +409,4 @@ function importEnex(taskContext: TaskContext, file: File, parentNote: BNote): Pr
|
||||
});
|
||||
}
|
||||
|
||||
export = { importEnex };
|
||||
export default { importEnex };
|
||||
|
||||
@@ -110,7 +110,7 @@ function normalizeMimeType(mime: string) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getMime,
|
||||
getType,
|
||||
normalizeMimeType
|
||||
|
||||
@@ -191,7 +191,7 @@ function importAttachment(taskContext: TaskContext, file: File, parentNote: BNot
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
importSingleFile,
|
||||
importAttachment
|
||||
};
|
||||
|
||||
@@ -637,7 +637,7 @@ function getKeyboardActions() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
DEFAULT_KEYBOARD_ACTIONS,
|
||||
getKeyboardActions
|
||||
};
|
||||
|
||||
@@ -117,7 +117,7 @@ function formatDate() {
|
||||
return `${pad(todaysMidnight.getFullYear())}-${pad(todaysMidnight.getMonth() + 1)}-${pad(todaysMidnight.getDate())}`;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
info,
|
||||
error,
|
||||
request
|
||||
|
||||
@@ -143,7 +143,7 @@ async function migrateIfNecessary() {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
migrateIfNecessary,
|
||||
isDbUpToDate
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ function getDefaultMimeForNoteType(typeName: string) {
|
||||
return typeRec.defaultMime;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getNoteTypeNames: () => noteTypes.map(nt => nt.type),
|
||||
getDefaultMimeForNoteType
|
||||
};
|
||||
|
||||
@@ -1037,7 +1037,7 @@ function getNoteIdMapping(origNote: BNote) {
|
||||
return noteIdMapping;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
createNewNote,
|
||||
createNewNoteWithTarget,
|
||||
updateNoteData,
|
||||
|
||||
@@ -93,7 +93,7 @@ function getOptionMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getOption,
|
||||
getOptionInt,
|
||||
getOptionBool,
|
||||
|
||||
@@ -132,7 +132,7 @@ function getKeyboardDefaultOptions() {
|
||||
}));
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
initDocumentOptions,
|
||||
initNotSyncedOptions,
|
||||
initStartupOptions
|
||||
|
||||
@@ -70,7 +70,7 @@ function checkProtectedSessionExpiration() {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
setDataKey,
|
||||
resetDataKey,
|
||||
isProtectedSessionAvailable,
|
||||
|
||||
@@ -233,7 +233,7 @@ function generateError(opts: {
|
||||
return new Error(`Request to ${opts.method} ${opts.url} failed, error: ${message}`);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
exec,
|
||||
getImage
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!fs.existsSync(MIGRATIONS_DIR)) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
RESOURCE_DIR,
|
||||
MIGRATIONS_DIR,
|
||||
DB_INIT_DIR,
|
||||
|
||||
@@ -219,7 +219,7 @@ function sanitizeVariableName(str: string) {
|
||||
return str.replace(/[^a-z0-9_]/gim, "");
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
executeNote,
|
||||
executeNoteNoException,
|
||||
executeScript,
|
||||
|
||||
@@ -444,7 +444,7 @@ function formatAttribute(attr: BAttribute) {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
searchFromNote,
|
||||
searchNotesForAutocomplete,
|
||||
findResultsWithQuery,
|
||||
|
||||
@@ -110,7 +110,7 @@ function getSyncSeedOptions() {
|
||||
];
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
hasSyncServerSchemaAndSeed,
|
||||
triggerSync,
|
||||
sendSeedToSyncServer,
|
||||
|
||||
@@ -287,7 +287,7 @@ function createOrUpdateScriptLauncherFromApi(opts: {
|
||||
return launcherNote;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
getInboxNote,
|
||||
createSqlConsole,
|
||||
saveSqlConsole,
|
||||
|
||||
@@ -314,7 +314,7 @@ function disableSlowQueryLogging<T>(cb: () => T) {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
dbConnection,
|
||||
insert,
|
||||
replace,
|
||||
|
||||
@@ -184,7 +184,7 @@ function getDbSize() {
|
||||
|
||||
log.info(`DB size: ${getDbSize()} KB`);
|
||||
|
||||
export = {
|
||||
export default {
|
||||
dbReady,
|
||||
schemaExists,
|
||||
isDbInitialized,
|
||||
|
||||
@@ -453,7 +453,7 @@ require('../becca/becca_loader').beccaLoaded.then(() => {
|
||||
getLastSyncedPush();
|
||||
});
|
||||
|
||||
export = {
|
||||
export default {
|
||||
sync,
|
||||
login,
|
||||
getEntityChangeRecords,
|
||||
|
||||
@@ -14,7 +14,7 @@ function get(name: string) {
|
||||
return (config['Sync'] && config['Sync'][name]) || optionService.getOption(name);
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
// env variable is the easiest way to guarantee we won't overwrite prod data during development
|
||||
// after copying prod document/data directory
|
||||
getSyncServerHost: () => process.env.TRILIUM_SYNC_SERVER_HOST || get('syncServerHost'),
|
||||
|
||||
@@ -261,7 +261,7 @@ function setNoteToParent(noteId: string, prefix: string, parentNoteId: string) {
|
||||
}
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
validateParentChild,
|
||||
sortNotes,
|
||||
sortNotesIfNeeded,
|
||||
|
||||
@@ -311,7 +311,7 @@ function isString(x: any) {
|
||||
return Object.prototype.toString.call(x) === "[object String]";
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
randomSecureToken,
|
||||
randomString,
|
||||
md5,
|
||||
|
||||
@@ -193,7 +193,7 @@ function getMainWindow() {
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
createMainWindow,
|
||||
createSetupWindow,
|
||||
closeSetupWindow,
|
||||
|
||||
@@ -275,7 +275,7 @@ function setLastSyncedPush(entityChangeId: number) {
|
||||
lastSyncedPush = entityChangeId;
|
||||
}
|
||||
|
||||
export = {
|
||||
export default {
|
||||
init,
|
||||
sendMessageToAllClients,
|
||||
syncPushInProgress,
|
||||
|
||||
Reference in New Issue
Block a user