server-esm: Change some more export object to export default object

This commit is contained in:
Elian Doran 2024-07-18 21:47:30 +03:00
parent 55eecb0f61
commit 0ceae0a65e
No known key found for this signature in database
90 changed files with 90 additions and 90 deletions

View File

@ -80,7 +80,7 @@ function note(title: string, extraParams = {}) {
return new NoteBuilder(note);
}
export = {
export default {
NoteBuilder,
findNoteByTitle,
note,

View File

@ -286,7 +286,7 @@ eventService.subscribeBeccaLoader(eventService.ENTER_PROTECTED_SESSION, () => {
eventService.subscribeBeccaLoader(eventService.LEAVE_PROTECTED_SESSION, load);
export = {
export default {
load,
reload,
beccaLoaded

View File

@ -82,7 +82,7 @@ function getNoteTitleForPath(notePathArray: string[]) {
return titles.join(' / ');
}
export = {
export default {
getNoteTitle,
getNoteTitleForPath,
isNotePathArchived

View File

@ -146,7 +146,7 @@ function validateAndPatch(target: any, source: any, allowedProperties: Validator
}
}
export = {
export default {
EtapiError,
sendError,
route,

View File

@ -64,7 +64,7 @@ function mapAttachmentToPojo(attachment: BAttachment) {
};
}
export = {
export default {
mapNoteToPojo,
mapBranchToPojo,
mapAttributeToPojo,

View File

@ -107,7 +107,7 @@ function isValidEntityId(obj: unknown) {
}
}
export = {
export default {
mandatory,
notNull,
isString,

View File

@ -97,7 +97,7 @@ function convertAttachmentToNote(req: Request) {
return attachment.convertToNote();
}
export = {
export default {
getAttachmentBlob,
getAttachments,
getAttachment,

View File

@ -238,7 +238,7 @@ function deleteRelation(req: Request) {
}
}
export = {
export default {
updateNoteAttributes,
updateNoteAttribute,
setNoteAttribute,

View File

@ -224,7 +224,7 @@ function setPrefix(req: Request) {
branch.save();
}
export = {
export default {
moveBranchToParent,
moveBranchBeforeNote,
moveBranchAfterNote,

View File

@ -43,7 +43,7 @@ function getAffectedNoteIds(noteIds: string[], includeDescendants: boolean) {
return affectedNoteIds;
}
export = {
export default {
execute,
getAffectedNoteCount
};

View File

@ -229,7 +229,7 @@ function findNotesByUrl(req: Request){
}
}
export = {
export default {
createNote,
addClipping,
openNote,

View File

@ -29,7 +29,7 @@ function toggleNoteInParent(req: Request) {
return cloningService.toggleNoteInParent(present === 'true', noteId, parentNoteId);
}
export = {
export default {
cloneNoteToBranch,
cloneNoteToParentNote,
cloneNoteAfter,

View File

@ -49,7 +49,7 @@ function checkIntegrity() {
};
}
export = {
export default {
getExistingBackups,
backupDatabase,
vacuumDatabase,

View File

@ -21,7 +21,7 @@ function deleteToken(req: Request) {
etapiTokenService.deleteToken(req.params.etapiTokenId);
}
export = {
export default {
getTokens,
createToken,
patchToken,

View File

@ -245,7 +245,7 @@ function uploadModifiedFileToAttachment(req: Request) {
attachment.setContent(fileContent);
}
export = {
export default {
updateFile,
updateAttachment,
openFile,

View File

@ -114,7 +114,7 @@ function updateImage(req: AppRequest) {
return { uploaded: true };
}
export = {
export default {
returnImageFromNote,
returnImageFromRevision,
returnAttachedImage,

View File

@ -136,7 +136,7 @@ async function importAttachmentsToNote(req: AppRequest) {
}
}
export = {
export default {
importNotesToBranch,
importAttachmentsToNote
};

View File

@ -14,7 +14,7 @@ function getShortcutsForNotes() {
return labels.filter(attr => becca.getNote(attr.noteId)?.type !== 'launcher');
}
export = {
export default {
getKeyboardActions,
getShortcutsForNotes
};

View File

@ -110,7 +110,7 @@ function token(req: Request) {
return { token: authToken };
}
export = {
export default {
loginSync,
loginToProtectedSession,
logoutFromProtectedSession,

View File

@ -385,7 +385,7 @@ function getBacklinks(req: Request) {
});
}
export = {
export default {
getLinkMap,
getTreeMap,
getBacklinkCount,

View File

@ -250,7 +250,7 @@ function convertNoteToAttachment(req: Request) {
};
}
export = {
export default {
getNote,
getNoteBlob,
getNoteMetadata,

View File

@ -136,7 +136,7 @@ function isAllowed(name: string) {
|| name.startsWith("hideArchivedNotes");
}
export = {
export default {
getOptions,
updateOption,
updateOptions,

View File

@ -35,7 +35,7 @@ function renderMarkdown(req: Request) {
};
}
export = {
export default {
getIconUsage,
renderMarkdown
};

View File

@ -22,7 +22,7 @@ function resetPassword(req: Request) {
return passwordService.resetPassword();
}
export = {
export default {
changePassword,
resetPassword
};

View File

@ -200,7 +200,7 @@ function getNotePathData(note: BNote): NotePath | undefined {
}
}
export = {
export default {
getRevisionBlob,
getRevisions,
getRevision,

View File

@ -131,7 +131,7 @@ function getBundle(req: Request) {
return scriptService.getScriptBundleForFrontend(note, script, params);
}
export = {
export default {
exec,
run,
getStartupBundles,

View File

@ -126,7 +126,7 @@ function searchTemplates() {
}).map(note => note.noteId);
}
export = {
export default {
searchFromNote,
searchAndExecute,
getRelatedNotes,

View File

@ -84,7 +84,7 @@ function saveNote(req: Request) {
};
}
export = {
export default {
uploadImage,
saveNote
};

View File

@ -51,7 +51,7 @@ function getSyncSeed() {
};
}
export = {
export default {
getStatus,
setupNewDocument,
setupSyncFromServer,

View File

@ -82,7 +82,7 @@ function createOrUpdateScriptLauncherFromApi(req: Request) {
return specialNotesService.createOrUpdateScriptLauncherFromApi(req.body);
}
export = {
export default {
getInboxNote,
getDayNote,
getWeekNote,

View File

@ -66,7 +66,7 @@ function execute(req: Request) {
}
}
export = {
export default {
getSchema,
execute
};

View File

@ -45,7 +45,7 @@ function getSubtreeSize(req: Request) {
};
}
export = {
export default {
getNoteSize,
getSubtreeSize
};

View File

@ -209,7 +209,7 @@ function checkEntityChanges() {
require('../../services/consistency_checks').runEntityChangesChecks();
}
export = {
export default {
testSync,
checkSync,
syncNow,

View File

@ -160,7 +160,7 @@ function load(req: Request) {
return getNotesAndBranchesAndAttributes(req.body.noteIds);
}
export = {
export default {
getTree,
load
};

View File

@ -102,7 +102,7 @@ function logout(req: AppRequest, res: Response) {
}
export = {
export default {
loginPage,
setPasswordPage,
setPassword,

View File

@ -90,7 +90,7 @@ function getExistingAnonymizedDatabases() {
}));
}
export = {
export default {
getFullAnonymizationScript,
createAnonymizedCopy,
getExistingAnonymizedDatabases

View File

@ -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,

View File

@ -110,7 +110,7 @@ function isAttributeDangerous(type: string, name: string): boolean {
);
}
export = {
export default {
getNotesWithLabel,
getNoteWithLabel,
createLabel,

View File

@ -126,7 +126,7 @@ function checkCredentials(req: AppRequest, res: Response, next: NextFunction) {
}
}
export = {
export default {
checkAuth,
checkApiAuth,
checkAppInitialized,

View File

@ -75,7 +75,7 @@ if (!fs.existsSync(dataDir.BACKUP_DIR)) {
fs.mkdirSync(dataDir.BACKUP_DIR, 0o700);
}
export = {
export default {
getExistingBackups,
backupNow,
regularBackup

View File

@ -54,7 +54,7 @@ function calculateContentHash({blobId, content}: Blob) {
return utils.hash(`${blobId}|${content.toString()}`);
}
export = {
export default {
getBlobPojo,
processContent,
calculateContentHash

View File

@ -44,7 +44,7 @@ function moveBranchToBranch(branchToMove: BBranch, targetParentBranch: BBranch,
return res;
}
export = {
export default {
moveBranchToBranch,
moveBranchToNote
};

View File

@ -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" };

View File

@ -175,7 +175,7 @@ function cloneNoteAfter(noteId: string, afterBranchId: string) {
return { success: true, branchId: branch.branchId };
}
export = {
export default {
cloneNoteToBranch,
cloneNoteToParentNote,
ensureNoteIsPresentInParent,

View File

@ -96,7 +96,7 @@ function ignoreEntityChangeIds() {
namespace.set('ignoreEntityChangeIds', true);
}
export = {
export default {
init,
wrap,
get,

View File

@ -913,7 +913,7 @@ sqlInit.dbReady.then(() => {
setTimeout(cls.wrap(runPeriodicChecks), 4 * 1000);
});
export = {
export default {
runOnDemandChecks,
runEntityChangesChecks
};

View File

@ -80,7 +80,7 @@ function checkContentHashes(otherHashes: Record<string, SectorHash>) {
return failedChecks;
}
export = {
export default {
getEntityHashes,
checkContentHashes
};

View File

@ -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,

View File

@ -226,7 +226,7 @@ function getWeekNote(dateStr: string, options: WeekNoteOpts = {}, rootNote: BNot
return getDayNote(dateStr, rootNote);
}
export = {
export default {
getRootCalendarNote,
getYearNote,
getMonthNote,

View File

@ -95,7 +95,7 @@ function validateUtcDateTime(str: string | undefined) {
}
}
export = {
export default {
utcNowDateTime,
localNowDateTime,
localNowDate,

View File

@ -112,7 +112,7 @@ function decryptString(dataKey: Buffer, cipherText: string) {
return buffer.toString('utf-8');
}
export = {
export default {
encrypt,
decrypt,
decryptString

View File

@ -22,7 +22,7 @@ function getScryptHash(password: crypto.BinaryLike, salt: crypto.BinaryLike) {
return hashed;
}
export = {
export default {
getVerificationHash,
getPasswordDerivedKey
};

View File

@ -78,7 +78,7 @@ function resetPassword() {
};
}
export = {
export default {
isPasswordSet,
changePassword,
setPassword,

View File

@ -33,7 +33,7 @@ function getDataKey(password: string) {
return decryptedDataKey;
}
export = {
export default {
verifyPassword,
getDataKey,
setDataKey

View File

@ -193,7 +193,7 @@ function recalculateMaxEntityChangeId() {
maxEntityChangeId = sql.getValue<number>("SELECT COALESCE(MAX(id), 0) FROM entity_changes");
}
export = {
export default {
putNoteReorderingEntityChange,
putEntityChangeForOtherInstances,
putEntityChangeWithForcedChange,

View File

@ -186,7 +186,7 @@ sqlInit.dbReady.then(() => {
setInterval(cls.wrap(() => eraseScheduledAttachments()), 3600 * 1000);
});
export = {
export default {
eraseDeletedNotesNow,
eraseUnusedAttachmentsNow,
eraseNotesWithDeleteId,

View File

@ -114,7 +114,7 @@ function deleteToken(etapiTokenId: string) {
etapiToken.markAsDeletedSimple();
}
export = {
export default {
getTokens,
createToken,
renameToken,

View File

@ -59,7 +59,7 @@ function emit(eventType: string, data?: any) {
}
}
export = {
export default {
subscribe,
subscribeBeccaLoader,
emit,

View File

@ -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
};

View File

@ -362,7 +362,7 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: Item) {
}
}
export = {
export default {
checkHiddenSubtree,
LBTPL_ROOT,
LBTPL_BASE,

View File

@ -33,7 +33,7 @@ function getWorkspaceNote() {
}
}
export = {
export default {
getHoistedNoteId,
getWorkspaceNote,
isHoistedInHiddenSubtree

View File

@ -47,7 +47,7 @@ function sanitize(dirtyHtml: string) {
});
}
export = {
export default {
sanitize,
sanitizeUrl: (url: string) => {
return sanitizeUrl.sanitizeUrl(url).trim();

View File

@ -234,7 +234,7 @@ async function resize(buffer: Buffer, quality: number) {
return resultBuffer;
}
export = {
export default {
saveImage,
saveImageToAttachment,
updateImage

View File

@ -409,4 +409,4 @@ function importEnex(taskContext: TaskContext, file: File, parentNote: BNote): Pr
});
}
export = { importEnex };
export default { importEnex };

View File

@ -110,7 +110,7 @@ function normalizeMimeType(mime: string) {
return undefined;
}
export = {
export default {
getMime,
getType,
normalizeMimeType

View File

@ -191,7 +191,7 @@ function importAttachment(taskContext: TaskContext, file: File, parentNote: BNot
}
}
export = {
export default {
importSingleFile,
importAttachment
};

View File

@ -637,7 +637,7 @@ function getKeyboardActions() {
return actions;
}
export = {
export default {
DEFAULT_KEYBOARD_ACTIONS,
getKeyboardActions
};

View File

@ -117,7 +117,7 @@ function formatDate() {
return `${pad(todaysMidnight.getFullYear())}-${pad(todaysMidnight.getMonth() + 1)}-${pad(todaysMidnight.getDate())}`;
}
export = {
export default {
info,
error,
request

View File

@ -143,7 +143,7 @@ async function migrateIfNecessary() {
}
}
export = {
export default {
migrateIfNecessary,
isDbUpToDate
};

View File

@ -26,7 +26,7 @@ function getDefaultMimeForNoteType(typeName: string) {
return typeRec.defaultMime;
}
export = {
export default {
getNoteTypeNames: () => noteTypes.map(nt => nt.type),
getDefaultMimeForNoteType
};

View File

@ -1037,7 +1037,7 @@ function getNoteIdMapping(origNote: BNote) {
return noteIdMapping;
}
export = {
export default {
createNewNote,
createNewNoteWithTarget,
updateNoteData,

View File

@ -93,7 +93,7 @@ function getOptionMap() {
return map;
}
export = {
export default {
getOption,
getOptionInt,
getOptionBool,

View File

@ -132,7 +132,7 @@ function getKeyboardDefaultOptions() {
}));
}
export = {
export default {
initDocumentOptions,
initNotSyncedOptions,
initStartupOptions

View File

@ -70,7 +70,7 @@ function checkProtectedSessionExpiration() {
}
}
export = {
export default {
setDataKey,
resetDataKey,
isProtectedSessionAvailable,

View File

@ -233,7 +233,7 @@ function generateError(opts: {
return new Error(`Request to ${opts.method} ${opts.url} failed, error: ${message}`);
}
export = {
export default {
exec,
getImage
};

View File

@ -20,7 +20,7 @@ if (!fs.existsSync(MIGRATIONS_DIR)) {
process.exit(1);
}
export = {
export default {
RESOURCE_DIR,
MIGRATIONS_DIR,
DB_INIT_DIR,

View File

@ -219,7 +219,7 @@ function sanitizeVariableName(str: string) {
return str.replace(/[^a-z0-9_]/gim, "");
}
export = {
export default {
executeNote,
executeNoteNoException,
executeScript,

View File

@ -444,7 +444,7 @@ function formatAttribute(attr: BAttribute) {
}
}
export = {
export default {
searchFromNote,
searchNotesForAutocomplete,
findResultsWithQuery,

View File

@ -110,7 +110,7 @@ function getSyncSeedOptions() {
];
}
export = {
export default {
hasSyncServerSchemaAndSeed,
triggerSync,
sendSeedToSyncServer,

View File

@ -287,7 +287,7 @@ function createOrUpdateScriptLauncherFromApi(opts: {
return launcherNote;
}
export = {
export default {
getInboxNote,
createSqlConsole,
saveSqlConsole,

View File

@ -314,7 +314,7 @@ function disableSlowQueryLogging<T>(cb: () => T) {
}
}
export = {
export default {
dbConnection,
insert,
replace,

View File

@ -184,7 +184,7 @@ function getDbSize() {
log.info(`DB size: ${getDbSize()} KB`);
export = {
export default {
dbReady,
schemaExists,
isDbInitialized,

View File

@ -453,7 +453,7 @@ require('../becca/becca_loader').beccaLoaded.then(() => {
getLastSyncedPush();
});
export = {
export default {
sync,
login,
getEntityChangeRecords,

View File

@ -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'),

View File

@ -261,7 +261,7 @@ function setNoteToParent(noteId: string, prefix: string, parentNoteId: string) {
}
}
export = {
export default {
validateParentChild,
sortNotes,
sortNotesIfNeeded,

View File

@ -311,7 +311,7 @@ function isString(x: any) {
return Object.prototype.toString.call(x) === "[object String]";
}
export = {
export default {
randomSecureToken,
randomString,
md5,

View File

@ -193,7 +193,7 @@ function getMainWindow() {
return mainWindow;
}
export = {
export default {
createMainWindow,
createSetupWindow,
closeSetupWindow,

View File

@ -275,7 +275,7 @@ function setLastSyncedPush(entityChangeId: number) {
lastSyncedPush = entityChangeId;
}
export = {
export default {
init,
sendMessageToAllClients,
syncPushInProgress,

View File

@ -92,7 +92,7 @@ eventService.subscribe([eventService.ENTITY_CREATED, eventService.ENTITY_CHANGED
shaca.reset();
});
export = {
export default {
load,
ensureLoad
};

View File

@ -27,7 +27,7 @@ function getColumn<T>(query: string, params: string[] = []): T[] {
return dbConnection.prepare(query).pluck().all(params) as T[];
}
export = {
export default {
getRawRows,
getRow,
getColumn