migrate to "export default"

also, set no-use-before-define in linter
This commit is contained in:
Girish Ramakrishnan
2026-02-14 15:43:24 +01:00
parent ddb46646fa
commit 36aa641cb9
231 changed files with 2846 additions and 2728 deletions
+29 -28
View File
@@ -1,6 +1,6 @@
import assert from 'node:assert';
import BoxError from './boxerror.js';
import * as database from './database.js';
import database from './database.js';
import debugModule from 'debug';
import eventlog from './eventlog.js';
import hat from './hat.js';
@@ -12,33 +12,6 @@ const debug = debugModule('box:backups');
const BACKUP_TYPE_APP = 'app';
const BACKUP_STATE_NORMAL = 'normal';
export default {
get,
getByIdentifierAndStatePaged,
getLatestInTargetByIdentifier, // brutal function name
add,
update,
listByTypePaged,
del,
removePrivateFields,
clearTasks,
startIntegrityCheck,
stopIntegrityCheck,
setIntegrityResult,
BACKUP_IDENTIFIER_BOX: 'box',
BACKUP_IDENTIFIER_MAIL: 'mail',
BACKUP_TYPE_APP,
BACKUP_TYPE_BOX: 'box',
BACKUP_TYPE_MAIL: 'mail',
BACKUP_STATE_NORMAL,
BACKUP_STATE_CREATING: 'creating',
BACKUP_STATE_ERROR: 'error',
};
const BACKUPS_FIELDS = [ 'id', 'remotePath', 'label', 'identifier', 'creationTime', 'packageVersion', 'type', 'integrityJson',
'statsJson', 'dependsOnJson', 'state', 'manifestJson', 'preserveSecs', 'encryptionVersion', 'appConfigJson', 'siteId',
@@ -254,3 +227,31 @@ async function stopIntegrityCheck(backup, auditSource) {
async function clearTasks() {
await database.query('UPDATE backups SET integrityCheckTaskId = NULL');
}
export default {
get,
getByIdentifierAndStatePaged,
getLatestInTargetByIdentifier, // brutal function name
add,
update,
listByTypePaged,
del,
removePrivateFields,
clearTasks,
startIntegrityCheck,
stopIntegrityCheck,
setIntegrityResult,
BACKUP_IDENTIFIER_BOX: 'box',
BACKUP_IDENTIFIER_MAIL: 'mail',
BACKUP_TYPE_APP,
BACKUP_TYPE_BOX: 'box',
BACKUP_TYPE_MAIL: 'mail',
BACKUP_STATE_NORMAL,
BACKUP_STATE_CREATING: 'creating',
BACKUP_STATE_ERROR: 'error',
};