chore: format node folder with biomejs

This commit is contained in:
SamTV12345 2025-09-03 21:23:40 +02:00
parent 16f0d1b4d8
commit ecff9058dc
68 changed files with 171 additions and 171 deletions

View file

@ -1,4 +1,4 @@
'use strict';
/**
* This module provides all API functions
*/
@ -22,7 +22,7 @@
import {deserializeOps} from '../../static/js/Changeset';
import ChatMessage from '../../static/js/ChatMessage';
import {Builder} from "../../static/js/Builder";
import {Attribute} from "../../static/js/types/Attribute";
import type {Attribute} from "../../static/js/types/Attribute";
const CustomError = require('../utils/customError');
const padManager = require('./PadManager');
const padMessageHandler = require('../handler/PadMessageHandler');

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The AuthorManager controlls all information about the Pad authors
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The DB Module provides a database initialized with the settings
@ -21,7 +21,7 @@
* limitations under the License.
*/
import {Database, DatabaseType} from 'ueberdb2';
import {Database, type DatabaseType} from 'ueberdb2';
import settings from '../utils/Settings';
import log4js from 'log4js';
const stats = require('../stats')

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The Group Manager provides functions to manage groups in the database
*/

View file

@ -1,7 +1,7 @@
'use strict';
import {Database} from "ueberdb2";
import {AChangeSet, APool, AText} from "../types/PadType";
import {MapArrayType} from "../types/MapType";
import type {Database} from "ueberdb2";
import {AChangeSet, APool, type AText} from "../types/PadType";
import type {MapArrayType} from "../types/MapType";
/**
* The pad object, defined with joose

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The Pad Manager is a Factory for pad Objects
*/
@ -19,8 +19,8 @@
* limitations under the License.
*/
import {MapArrayType} from "../types/MapType";
import {PadType} from "../types/PadType";
import type {MapArrayType} from "../types/MapType";
import type {PadType} from "../types/PadType";
const CustomError = require('../utils/customError');
const Pad = require('../db/Pad');

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The ReadOnlyManager manages the database and rendering releated to read only pads
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Controls the security of pad access
*/
@ -19,7 +19,7 @@
* limitations under the License.
*/
import {UserSettingsObject} from "../types/UserSettingsObject";
import type {UserSettingsObject} from "../types/UserSettingsObject";
const authorManager = require('./AuthorManager');
const hooks = require('../../static/js/pluginfw/hooks');

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The Session Manager provides functions to manage session in the database,
* it only provides session management for sessions created by the API

View file

@ -1,4 +1,4 @@
'use strict';
/*
* Copyright (c) 2011 RedHog (Egil Möller) <egil.moller@freecode.no>
*

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The API Handler handles all API http requests
*/
@ -19,16 +19,16 @@
* limitations under the License.
*/
import {MapArrayType} from "../types/MapType";
import type {MapArrayType} from "../types/MapType";
import { jwtDecode } from "jwt-decode";
const api = require('../db/API');
const padManager = require('../db/PadManager');
import settings from '../utils/Settings';
import createHTTPError from 'http-errors';
import {Http2ServerRequest} from "node:http2";
import type {Http2ServerRequest} from "node:http2";
import {publicKeyExported} from "../security/OAuth2Provider";
import {jwtVerify} from "jose";
import {APIFields, apikey} from './APIKeyHandler'
import {type APIFields, apikey} from './APIKeyHandler'
// a list of all functions
const version:MapArrayType<any> = {};

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Handles the export requests
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Handles the import requests
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The MessageHandler handles all Messages that comes from Socket.IO and controls the sessions
*/
@ -19,7 +19,7 @@
* limitations under the License.
*/
import {MapArrayType} from "../types/MapType";
import type {MapArrayType} from "../types/MapType";
import AttributeMap from '../../static/js/AttributeMap';
const padManager = require('../db/PadManager');
@ -44,10 +44,10 @@ const hooks = require('../../static/js/pluginfw/hooks');
const stats = require('../stats')
const assert = require('assert').strict;
import {RateLimiterMemory} from 'rate-limiter-flexible';
import {ChangesetRequest, PadUserInfo, SocketClientRequest} from "../types/SocketClientRequest";
import {APool, AText, PadAuthor, PadType} from "../types/PadType";
import {ChangeSet} from "../types/ChangeSet";
import {ChatMessageMessage, ClientReadyMessage, ClientSaveRevisionMessage, ClientSuggestUserName, ClientUserChangesMessage, ClientVarMessage, CustomMessage, PadDeleteMessage, UserNewInfoMessage} from "../../static/js/types/SocketIOMessage";
import {type ChangesetRequest, PadUserInfo, type SocketClientRequest} from "../types/SocketClientRequest";
import {APool, type AText, type PadAuthor, type PadType} from "../types/PadType";
import type {ChangeSet} from "../types/ChangeSet";
import type {ChatMessageMessage, ClientReadyMessage, ClientSaveRevisionMessage, ClientSuggestUserName, ClientUserChangesMessage, ClientVarMessage, CustomMessage, PadDeleteMessage, UserNewInfoMessage} from "../../static/js/types/SocketIOMessage";
import {Builder} from "../../static/js/Builder";
const webaccess = require('../hooks/express/webaccess');
const { checkValidRev } = require('../utils/checkValidRev');

View file

@ -1,7 +1,7 @@
import {ArgsExpressType} from "../types/ArgsExpressType";
import {MapArrayType} from "../types/MapType";
import type {ArgsExpressType} from "../types/ArgsExpressType";
import type {MapArrayType} from "../types/MapType";
import {IncomingForm} from "formidable";
import {ErrorCaused} from "../types/ErrorCaused";
import type {ErrorCaused} from "../types/ErrorCaused";
import createHTTPError from "http-errors";
const apiHandler = require('./APIHandler')
@ -1462,7 +1462,7 @@ export const expressCreateServer = async (hookName: string, {app}: ArgsExpressTy
let response;
try {
try {
let data = await apiHandler.handle(apiVersion, functionName, fields, req, res);
const data = await apiHandler.handle(apiVersion, functionName, fields, req, res);
// return in common format
response = {code: 0, message: 'ok', data: data || null};

View file

@ -1,4 +1,4 @@
'use strict';
/**
* This is the Socket.IO Router. It routes the Messages between the
* components of the Server. The components are at the moment: pad and timeslider
@ -20,8 +20,8 @@
* limitations under the License.
*/
import {MapArrayType} from "../types/MapType";
import {SocketModule} from "../types/SocketModule";
import type {MapArrayType} from "../types/MapType";
import type {SocketModule} from "../types/SocketModule";
import log4js from 'log4js';
import settings from '../utils/Settings';
const stats = require('../../node/stats')

View file

@ -1,13 +1,13 @@
'use strict';
import {Socket} from "node:net";
import type {Socket} from "node:net";
import type {MapArrayType} from "../types/MapType";
import _ from 'underscore';
import cookieParser from 'cookie-parser';
import events from 'events';
import express from 'express';
import expressSession, {Store} from 'express-session';
import expressSession, {type Store} from 'express-session';
import fs from 'fs';
const hooks = require('../../static/js/pluginfw/hooks');
import log4js from 'log4js';

View file

@ -1,8 +1,8 @@
'use strict';
import {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
import path from "path";
import fs from "fs";
import {MapArrayType} from "../../types/MapType";
import type {MapArrayType} from "../../types/MapType";
import settings from 'ep_etherpad-lite/node/utils/Settings';
@ -48,7 +48,7 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func
'.doc': 'application/msword'
};
fs.exists(pathname, function (exist) {
fs.exists(pathname, (exist) => {
if (!exist) {
// if the file is not found, return 404
res.statusCode = 200;
@ -63,7 +63,7 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func
}
// read file from file system
fs.readFile(pathname, function (err, data) {
fs.readFile(pathname, (err, data) => {
if (err) {
res.statusCode = 500;
res.end(`Error getting the file: ${err}.`);
@ -73,7 +73,7 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func
res.setHeader('Content-type', map[ext] || 'text/plain');
if (ext === ".html" || ext === ".js" || ext === ".css") {
if (req.header(PROXY_HEADER)) {
let string = data.toString()
const string = data.toString()
dataToSend = string.replaceAll("/admin", req.header(PROXY_HEADER) + "/admin")
dataToSend = dataToSend.replaceAll("/socket.io", req.header(PROXY_HEADER) + "/socket.io")
}

View file

@ -1,14 +1,14 @@
'use strict';
import {ArgsExpressType} from "../../types/ArgsExpressType";
import {ErrorCaused} from "../../types/ErrorCaused";
import {QueryType} from "../../types/QueryType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ErrorCaused} from "../../types/ErrorCaused";
import type {QueryType} from "../../types/QueryType";
import {getAvailablePlugins, install, search, uninstall} from "../../../static/js/pluginfw/installer";
import {PackageData, PackageInfo} from "../../types/PackageInfo";
import type {PackageData, PackageInfo} from "../../types/PackageInfo";
import semver from 'semver';
import log4js from 'log4js';
import {MapArrayType} from "../../types/MapType";
import type {MapArrayType} from "../../types/MapType";
const pluginDefs = require('../../../static/js/pluginfw/plugin_defs');
const logger = log4js.getLogger('adminPlugins');

View file

@ -1,7 +1,7 @@
'use strict';
import {PadQueryResult, PadSearchQuery} from "../../types/PadSearchQuery";
import type {PadQueryResult, PadSearchQuery} from "../../types/PadSearchQuery";
import log4js from 'log4js';
const fsp = require('fs').promises;
@ -80,8 +80,8 @@ exports.socketio = (hookName: string, {io}: any) => {
const clientHooks: Map<string, Map<string, string>> = plugins.getHooks('client_hooks', false);
function mapToObject(map: Map<string, any>) {
let obj = Object.create(null);
for (let [k, v] of map) {
const obj = Object.create(null);
for (const [k, v] of map) {
if (v instanceof Map) {
obj[k] = mapToObject(v);
} else {
@ -166,7 +166,7 @@ exports.socketio = (hookName: string, {io}: any) => {
} else if (query.sortBy === "revisionNumber") {
const currentWinners: PadQueryResult[] = []
const padMapping = [] as {padId: string, revisionNumber: number}[]
for (let res of result) {
for (const res of result) {
const pad = await padManager.getPad(res);
const revisionNumber = pad.getHeadRevisionNumber()
padMapping.push({padId: res, revisionNumber})
@ -178,7 +178,7 @@ exports.socketio = (hookName: string, {io}: any) => {
})
for (const padRetrieval of padMapping.slice(query.offset, query.offset + query.limit)) {
let pad = await padManager.getPad(padRetrieval.padId);
const pad = await padManager.getPad(padRetrieval.padId);
currentWinners.push({
padName: padRetrieval.padId,
lastEdited: await pad.getLastEdit(),
@ -191,7 +191,7 @@ exports.socketio = (hookName: string, {io}: any) => {
} else if (query.sortBy === "userCount") {
const currentWinners: PadQueryResult[] = []
const padMapping = [] as {padId: string, userCount: number}[]
for (let res of result) {
for (const res of result) {
const userCount = api.padUsersCount(res).padUsersCount
padMapping.push({padId: res, userCount})
}
@ -202,7 +202,7 @@ exports.socketio = (hookName: string, {io}: any) => {
})
for (const padRetrieval of padMapping.slice(query.offset, query.offset + query.limit)) {
let pad = await padManager.getPad(padRetrieval.padId);
const pad = await padManager.getPad(padRetrieval.padId);
currentWinners.push({
padName: padRetrieval.padId,
lastEdited: await pad.getLastEdit(),
@ -214,7 +214,7 @@ exports.socketio = (hookName: string, {io}: any) => {
} else if (query.sortBy === "lastEdited") {
const currentWinners: PadQueryResult[] = []
const padMapping = [] as {padId: string, lastEdited: string}[]
for (let res of result) {
for (const res of result) {
const pad = await padManager.getPad(res);
const lastEdited = await pad.getLastEdit();
padMapping.push({padId: res, lastEdited})
@ -226,7 +226,7 @@ exports.socketio = (hookName: string, {io}: any) => {
})
for (const padRetrieval of padMapping.slice(query.offset, query.offset + query.limit)) {
let pad = await padManager.getPad(padRetrieval.padId);
const pad = await padManager.getPad(padRetrieval.padId);
currentWinners.push({
padName: padRetrieval.padId,
lastEdited: padRetrieval.lastEdited,

View file

@ -1,4 +1,4 @@
'use strict';
import express from "express";
@ -12,7 +12,7 @@ const util = require('util');
function objectAsString(obj: any): string {
let output = '';
for (const property in obj) {
if(obj.hasOwnProperty(property) && typeof obj[property] !== 'function') {
if(Object.hasOwn(obj, property) && typeof obj[property] !== 'function') {
let value = obj[property];
if(typeof value === 'object' && !Array.isArray(value) && value !== null) {
value = '{' + objectAsString(value) + '}';

View file

@ -1,7 +1,7 @@
'use strict';
import {ArgsExpressType} from "../../types/ArgsExpressType";
import {ErrorCaused} from "../../types/ErrorCaused";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ErrorCaused} from "../../types/ErrorCaused";
const stats = require('../../stats')

View file

@ -1,6 +1,6 @@
'use strict';
import {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
const hasPadAccess = require('../../padaccess');
import settings, {exportAvailable} from '../../utils/Settings';

View file

@ -1,8 +1,8 @@
'use strict';
import {OpenAPIOperations, OpenAPISuccessResponse, SwaggerUIResource} from "../../types/SwaggerUIResource";
import {MapArrayType} from "../../types/MapType";
import {ErrorCaused} from "../../types/ErrorCaused";
import type {OpenAPIOperations, OpenAPISuccessResponse, SwaggerUIResource} from "../../types/SwaggerUIResource";
import type {MapArrayType} from "../../types/MapType";
import type {ErrorCaused} from "../../types/ErrorCaused";
/**
* node/hooks/express/openapi.js

View file

@ -1,6 +1,6 @@
'use strict';
import {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
const padManager = require('../../db/PadManager');

View file

@ -1,4 +1,4 @@
import {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
import settings from '../../utils/Settings';
const pwa = {

View file

@ -1,13 +1,13 @@
'use strict';
import {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
import events from 'events';
const express = require('../express');
import log4js from 'log4js';
const proxyaddr = require('proxy-addr');
import settings from '../../utils/Settings';
import {Server, Socket} from 'socket.io'
import {Server, type Socket} from 'socket.io'
const socketIORouter = require('../../handler/SocketIORouter');
const hooks = require('../../../static/js/pluginfw/hooks');
const padMessageHandler = require('../../handler/PadMessageHandler');

View file

@ -1,4 +1,4 @@
'use strict';
import path from 'node:path';
const eejs = require('../../eejs')
@ -12,7 +12,7 @@ const webaccess = require('./webaccess');
const plugins = require('../../../static/js/pluginfw/plugin_defs');
import {build, buildSync} from 'esbuild'
import {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
import prometheus from "../../prometheus";
let ioI: { sockets: { sockets: any[]; }; } | null = null
@ -131,7 +131,7 @@ const convertTypescript = (content: string) => {
const handleLiveReload = async (args: ArgsExpressType, padString: string, timeSliderString: string, indexString: any) => {
const chokidar = await import('chokidar')
const watcher = chokidar.watch(path.join(settings.root, 'src', 'static', 'js'), {});
let routeHandlers: { [key: string]: Function } = {};
const routeHandlers: { [key: string]: Function } = {};
const setRouteHandler = (path: string, newHandler: Function) => {
routeHandlers[path] = newHandler;

View file

@ -1,12 +1,12 @@
'use strict';
import {MapArrayType} from "../../types/MapType";
import {PartType} from "../../types/PartType";
import type {MapArrayType} from "../../types/MapType";
import type {PartType} from "../../types/PartType";
const fs = require('fs').promises;
import {minify} from '../../utils/Minify';
import path from 'node:path';
import {ArgsExpressType} from "../../types/ArgsExpressType";
import type {ArgsExpressType} from "../../types/ArgsExpressType";
const plugins = require('../../../static/js/pluginfw/plugin_defs');
import settings from '../../utils/Settings';

View file

@ -1,10 +1,10 @@
'use strict';
import {strict as assert} from "assert";
import log4js from 'log4js';
import {SocketClientRequest} from "../../types/SocketClientRequest";
import {WebAccessTypes} from "../../types/WebAccessTypes";
import {SettingsUser} from "../../types/SettingsUser";
import type {SocketClientRequest} from "../../types/SocketClientRequest";
import type {WebAccessTypes} from "../../types/WebAccessTypes";
import type {SettingsUser} from "../../types/SettingsUser";
const httpLogger = log4js.getLogger('http');
import settings from '../../utils/Settings';
const hooks = require('../../../static/js/pluginfw/hooks');

View file

@ -1,7 +1,7 @@
'use strict';
import type {MapArrayType} from "../types/MapType";
import {I18nPluginDefs} from "../types/I18nPluginDefs";
import type {I18nPluginDefs} from "../types/I18nPluginDefs";
const languages = require('languages4translatewiki');
import fs from 'fs';
@ -132,7 +132,7 @@ exports.expressPreSession = async (hookName:string, {app}:any) => {
app.get('/locales/:locale', (req:any, res:any) => {
// works with /locale/en and /locale/en.json requests
const locale = req.params.locale.split('.')[0];
if (Object.prototype.hasOwnProperty.call(exports.availableLangs, locale)) {
if (Object.hasOwn(exports.availableLangs, locale)) {
res.setHeader('Cache-Control', `public, max-age=${settings.maxAge}`);
res.setHeader('Content-Type', 'application/json; charset=utf-8');
res.send(`{"${locale}":${JSON.stringify(locales[locale])}}`);

View file

@ -1,4 +1,4 @@
'use strict';
const securityManager = require('./db/SecurityManager');
// checks for padAccess

View file

@ -1,7 +1,7 @@
import client from 'prom-client'
const db = require('./db/DB').db
const monitor = function () {
const monitor = () => {
const collectDefaultMetrics = client.collectDefaultMetrics;
const Registry = client.Registry;
const register = new Registry();

View file

@ -1,14 +1,14 @@
import {ArgsExpressType} from "../types/ArgsExpressType";
import Provider, {Account, Configuration} from 'oidc-provider';
import {generateKeyPair, exportJWK, CryptoKey} from 'jose'
import type {ArgsExpressType} from "../types/ArgsExpressType";
import Provider, {type Account, type Configuration} from 'oidc-provider';
import {generateKeyPair, exportJWK, type CryptoKey} from 'jose'
import MemoryAdapter from "./OIDCAdapter";
import path from "path";
import settings from '../utils/Settings';
import {IncomingForm} from 'formidable'
import express from 'express';
import {format} from 'url'
import {ParsedUrlQuery} from "node:querystring";
import {MapArrayType} from "../types/MapType";
import type {ParsedUrlQuery} from "node:querystring";
import type {MapArrayType} from "../types/MapType";
const configuration: Configuration = {
scopes: ['openid', 'profile', 'email'],
@ -136,7 +136,7 @@ export const expressCreateServer = async (hookName: string, args: ArgsExpressTyp
admin: account?.is_admin
};
} else if (token.kind === "ClientCredentials") {
let extraParams: MapArrayType<string> = {}
const extraParams: MapArrayType<string> = {}
settings.sso.clients && settings.sso.clients
.filter((client:any) => client.client_id === token.clientId)

View file

@ -1,7 +1,7 @@
import {DeriveModel} from "../types/DeriveModel";
import {LegacyParams} from "../types/LegacyParams";
import type {DeriveModel} from "../types/DeriveModel";
import type {LegacyParams} from "../types/LegacyParams";
const {Buffer} = require('buffer');
const crypto = require('./crypto');

View file

@ -1,4 +1,4 @@
'use strict';
const crypto = require('crypto');
const util = require('util');

View file

@ -22,8 +22,8 @@
* limitations under the License.
*/
import {PluginType} from "./types/Plugin";
import {ErrorCaused} from "./types/ErrorCaused";
import type {PluginType} from "./types/Plugin";
import type {ErrorCaused} from "./types/ErrorCaused";
import log4js from 'log4js';
import pkg from '../package.json';
import {checkForMigration} from "../static/js/pluginfw/installer";

View file

@ -1,4 +1,4 @@
'use strict';
const measured = require('measured-core');

View file

@ -1,6 +1,6 @@
import {Express} from "express";
import type {Express} from "express";
import {MapArrayType} from "./MapType";
import {SettingsType} from "../utils/Settings";
import type {SettingsType} from "../utils/Settings";
export type ArgsExpressType = {
app:Express,

View file

@ -1,5 +1,5 @@
import {MapArrayType} from "./MapType";
import AttributePool from "../../static/js/AttributePool";
import type {MapArrayType} from "./MapType";
import type AttributePool from "../../static/js/AttributePool";
export type PadType = {
id: string,

View file

@ -1,4 +1,4 @@
'use strict';
export type PluginType = {

View file

@ -1,4 +1,4 @@
import {AChangeSet} from "./PadType";
import type {AChangeSet} from "./PadType";
export type Revision = {
changeset: AChangeSet,

View file

@ -1,4 +1,4 @@
import {SettingsUser} from "./SettingsUser";
import type {SettingsUser} from "./SettingsUser";
export type WebAccessTypes = {
username?: string|null;

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Controls the communication with the Abiword application
*/
@ -19,8 +19,8 @@
* limitations under the License.
*/
import {ChildProcess} from "node:child_process";
import {AsyncQueueTask} from "../types/AsyncQueueTask";
import type {ChildProcess} from "node:child_process";
import type {AsyncQueueTask} from "../types/AsyncQueueTask";
const spawn = require('child_process').spawn;
const async = require('async');

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Library for deterministic relative filename expansion for Etherpad.
*/

View file

@ -1,7 +1,7 @@
'use strict'
import {AChangeSet} from "../types/PadType";
import {Revision} from "../types/Revision";
import type {AChangeSet} from "../types/PadType";
import type {Revision} from "../types/Revision";
import {timesLimit, firstSatisfies} from './promises';
const padManager = require('ep_etherpad-lite/node/db/PadManager');
@ -44,7 +44,7 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro
logger.debug('Start cleanup revisions', padId)
let pad = await padManager.getPad(padId);
const pad = await padManager.getPad(padId);
await pad.check()
logger.debug('Initial pad is valid')
@ -73,10 +73,10 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro
await db.remove(`pad:${padId}:revs:${i}`, null);
});
let padContent = await db.get(`pad:${padId}`)
const padContent = await db.get(`pad:${padId}`)
padContent.head = keepRevisions
if (padContent.savedRevisions) {
let newSavedRevisions = []
const newSavedRevisions = []
for (let i = 0; i < padContent.savedRevisions.length; i++) {
if (padContent.savedRevisions[i].revNum > cleanupUntilRevision) {
@ -89,7 +89,7 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro
await db.set(`pad:${padId}`, padContent);
let newAText = Changeset.makeAText('\n');
let pool = pad.apool()
const pool = pad.apool()
newAText = Changeset.applyToAText(changeset, newAText, pool);
@ -130,7 +130,7 @@ export const deleteRevisions = async (padId: string, keepRevisions: number): Pro
padManager.unloadPad(padId);
let newPad = await padManager.getPad(padId);
const newPad = await padManager.getPad(padId);
await newPad.check();
return true

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The CLI module handles command line parameters
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* 2014 John McLear (Etherpad Foundation / McLear Ltd)
*

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Helpers for export requests
*/
@ -20,7 +20,7 @@
*/
import AttributeMap from '../../static/js/AttributeMap';
import AttributePool from "../../static/js/AttributePool";
import type AttributePool from "../../static/js/AttributePool";
import {deserializeOps, splitAttributionLines, subattribution} from '../../static/js/Changeset';
const { checkValidRev } = require('./checkValidRev');

View file

@ -1,6 +1,6 @@
'use strict';
import {AText, PadType} from "../types/PadType";
import {MapArrayType} from "../types/MapType";
import type {AText, PadType} from "../types/PadType";
import type {MapArrayType} from "../types/MapType";
/**
* Copyright 2009 Google Inc.

View file

@ -1,4 +1,4 @@
'use strict';
/**
* TXT export
*/
@ -19,8 +19,8 @@
* limitations under the License.
*/
import {AText, PadType} from "../types/PadType";
import {MapType} from "../types/MapType";
import type {AText, PadType} from "../types/PadType";
import type {MapType} from "../types/MapType";
import {deserializeOps, splitAttributionLines, subattribution} from '../../static/js/Changeset';
import {StringIterator} from "../../static/js/StringIterator";

View file

@ -1,4 +1,4 @@
'use strict';
import {APool} from "../types/PadType";

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Copyright Yaco Sistemas S.L. 2011.
*
@ -19,7 +19,7 @@ import log4js from 'log4js';
import {deserializeOps} from '../../static/js/Changeset';
const contentcollector = require('../../static/js/contentcollector');
import jsdom from 'jsdom';
import {PadType} from "../types/PadType";
import type {PadType} from "../types/PadType";
import {Builder} from "../../static/js/Builder";
const apiLogger = log4js.getLogger('ImportHtml');

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Controls the communication with LibreOffice
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* This Module manages all /minified/* requests. It controls the
@ -21,7 +21,7 @@
* limitations under the License.
*/
import {TransformResult} from "esbuild";
import type {TransformResult} from "esbuild";
import mime from 'mime-types';
import log4js from 'log4js';
import {compressCSS, compressJS} from './MinifyWorker'
@ -64,7 +64,7 @@ const requestURI = async (url: string | URL, method: any, headers: { [x: string]
writeHead: (_status: number, _headers: { [x: string]: any; }) => {
status = _status;
for (const header in _headers) {
if (Object.prototype.hasOwnProperty.call(_headers, header)) {
if (Object.hasOwn(_headers, header)) {
headers[header] = _headers[header];
}
}

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Worker thread to minify JS & CSS files out of the main NodeJS thread
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Checks related to Node runtime version
*/

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The Settings module reads the settings out of settings.json and provides
* this information to the other modules
@ -27,7 +27,7 @@
* limitations under the License.
*/
import {MapArrayType} from "../types/MapType";
import type {MapArrayType} from "../types/MapType";
import {SettingsNode} from "./SettingsTree";
import * as absolutePaths from './AbsolutePaths';
@ -807,7 +807,7 @@ const coerceValue = (stringValue: string) => {
*/
const lookupEnvironmentVariables = (obj: MapArrayType<any>) => {
const replaceEnvs = (obj: MapArrayType<any>) => {
for (let [key, value] of Object.entries(obj)) {
for (const [key, value] of Object.entries(obj)) {
/*
* the first invocation of replacer() is with an empty key. Just go on, or
* we would zap the entire object.
@ -907,16 +907,16 @@ const lookupEnvironmentVariables = (obj: MapArrayType<any>) => {
* If the key contains a double underscore, it's a plugin variable
* E.g.
*/
let treeEntries = new Map<string, string | undefined>
const treeEntries = new Map<string, string | undefined>
const root = new SettingsNode("EP")
for (let [env, envVal] of Object.entries(process.env)) {
for (const [env, envVal] of Object.entries(process.env)) {
if (!env.startsWith("EP")) continue
treeEntries.set(env, envVal)
}
treeEntries.forEach((value, key) => {
let pathToKey = key.split("__")
let currentNode = root
const pathToKey = key.split("__")
const currentNode = root
let depth = 0
depth++
currentNode.addChild(pathToKey, value!)

View file

@ -1,4 +1,4 @@
import {MapArrayType} from "../types/MapType";
import type {MapArrayType} from "../types/MapType";
export class SettingsTree {
private children: Map<string, SettingsNode>;
@ -61,7 +61,7 @@ export class SettingsNode {
public collectFromLeafsUpwards() {
let collected:MapArrayType<any> = {};
const collected:MapArrayType<any> = {};
for (const key in this.children) {
const child = this.children[key];
if (child.hasChildren()) {

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Wrapper around any iterable that adds convenience methods that standard JavaScript iterable

View file

@ -1,4 +1,4 @@
'use strict';
import semver from 'semver';
import settings, {getEpVersion} from './Settings';
import axios from 'axios';

View file

@ -1,4 +1,4 @@
'use strict';
const CustomError = require('../utils/customError');

View file

@ -1,4 +1,4 @@
'use strict';
/**
* CustomError
*

View file

@ -1,7 +1,7 @@
'use strict';
import {PadAuthor, PadType} from "../types/PadType";
import {MapArrayType} from "../types/MapType";
import type {PadAuthor, PadType} from "../types/PadType";
import type {MapArrayType} from "../types/MapType";
import AttributeMap from '../../static/js/AttributeMap';
import {applyToAText, checkRep, compose, deserializeOps, pack, splitAttributionLines, splitTextLines, unpack} from '../../static/js/Changeset';
@ -461,7 +461,7 @@ class PadDiff {
// this method is 80% like Changeset.inverse. I just changed so instead of reverting,
// it adds deletions and attribute changes to the atext.
// @ts-ignore
PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) {
PadDiff.prototype._createDeletionChangeset = (cs, startAText, apool) => {
};

View file

@ -1,4 +1,4 @@
'use strict';
import fs from 'node:fs';
const check = (path:string) => {

View file

@ -1,4 +1,4 @@
'use strict';
/**
* Helpers to manipulate promises (like async but for promises).
*/

View file

@ -1,9 +1,9 @@
'use strict';
import {ErrorExtended, RunCMDOptions, RunCMDPromise} from "../types/RunCMDOptions";
import {ChildProcess} from "node:child_process";
import {PromiseWithStd} from "../types/PromiseWithStd";
import {Readable} from "node:stream";
import {type ErrorExtended, type RunCMDOptions, RunCMDPromise} from "../types/RunCMDOptions";
import type {ChildProcess} from "node:child_process";
import type {PromiseWithStd} from "../types/PromiseWithStd";
import type {Readable} from "node:stream";
import spawn from 'cross-spawn';
import log4js from 'log4js';

View file

@ -1,4 +1,4 @@
'use strict';
/**
* The Toolbar Module creates and renders the toolbars and buttons
*/
@ -56,7 +56,7 @@ class ButtonGroup {
this.buttons = []
}
public static fromArray = function (array: string[]) {
public static fromArray = (array: string[]) => {
const btnGroup = new ButtonGroup();
each(array, (btnName: string) => {
const button = Button.load(btnName) as Button