mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-08 08:01:02 -04:00
Converted more files to typescript.
This commit is contained in:
parent
93dffc0e37
commit
c24ae14cf4
14 changed files with 94 additions and 51 deletions
|
@ -47,13 +47,13 @@ exports.init = async () => {
|
||||||
}
|
}
|
||||||
for (const fn of ['get', 'set', 'findKeys', 'getSub', 'setSub', 'remove']) {
|
for (const fn of ['get', 'set', 'findKeys', 'getSub', 'setSub', 'remove']) {
|
||||||
const f = exports.db[fn];
|
const f = exports.db[fn];
|
||||||
exports[fn] = async (...args) => await f.call(exports.db, ...args);
|
exports[fn] = async (...args:string[]) => await f.call(exports.db, ...args);
|
||||||
Object.setPrototypeOf(exports[fn], Object.getPrototypeOf(f));
|
Object.setPrototypeOf(exports[fn], Object.getPrototypeOf(f));
|
||||||
Object.defineProperties(exports[fn], Object.getOwnPropertyDescriptors(f));
|
Object.defineProperties(exports[fn], Object.getOwnPropertyDescriptors(f));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.shutdown = async (hookName, context) => {
|
exports.shutdown = async (hookName: string, context:any) => {
|
||||||
if (exports.db != null) await exports.db.close();
|
if (exports.db != null) await exports.db.close();
|
||||||
exports.db = null;
|
exports.db = null;
|
||||||
logger.log('Database closed');
|
logger.log('Database closed');
|
|
@ -34,9 +34,10 @@ class SessionStore extends Store {
|
||||||
for (const {timeout} of this._expirations.values()) clearTimeout(timeout);
|
for (const {timeout} of this._expirations.values()) clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _updateExpirations(sid, sess, updateDbExp = true) {
|
async _updateExpirations(sid: string, sess: any, updateDbExp = true) {
|
||||||
const exp = this._expirations.get(sid) || {};
|
const exp = this._expirations.get(sid) || {};
|
||||||
clearTimeout(exp.timeout);
|
clearTimeout(exp.timeout);
|
||||||
|
// @ts-ignore
|
||||||
const {cookie: {expires} = {}} = sess || {};
|
const {cookie: {expires} = {}} = sess || {};
|
||||||
if (expires) {
|
if (expires) {
|
||||||
const sessExp = new Date(expires).getTime();
|
const sessExp = new Date(expires).getTime();
|
||||||
|
@ -63,23 +64,23 @@ class SessionStore extends Store {
|
||||||
return sess;
|
return sess;
|
||||||
}
|
}
|
||||||
|
|
||||||
async _write(sid, sess) {
|
async _write(sid: string, sess: any) {
|
||||||
await DB.set(`sessionstorage:${sid}`, sess);
|
await DB.set(`sessionstorage:${sid}`, sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _get(sid) {
|
async _get(sid: string) {
|
||||||
logger.debug(`GET ${sid}`);
|
logger.debug(`GET ${sid}`);
|
||||||
const s = await DB.get(`sessionstorage:${sid}`);
|
const s = await DB.get(`sessionstorage:${sid}`);
|
||||||
return await this._updateExpirations(sid, s);
|
return await this._updateExpirations(sid, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _set(sid, sess) {
|
async _set(sid: string, sess:any) {
|
||||||
logger.debug(`SET ${sid}`);
|
logger.debug(`SET ${sid}`);
|
||||||
sess = await this._updateExpirations(sid, sess);
|
sess = await this._updateExpirations(sid, sess);
|
||||||
if (sess != null) await this._write(sid, sess);
|
if (sess != null) await this._write(sid, sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _destroy(sid) {
|
async _destroy(sid:string) {
|
||||||
logger.debug(`DESTROY ${sid}`);
|
logger.debug(`DESTROY ${sid}`);
|
||||||
clearTimeout((this._expirations.get(sid) || {}).timeout);
|
clearTimeout((this._expirations.get(sid) || {}).timeout);
|
||||||
this._expirations.delete(sid);
|
this._expirations.delete(sid);
|
||||||
|
@ -89,7 +90,7 @@ class SessionStore extends Store {
|
||||||
// Note: express-session might call touch() before it calls set() for the first time. Ideally this
|
// Note: express-session might call touch() before it calls set() for the first time. Ideally this
|
||||||
// would behave like set() in that case but it's OK if it doesn't -- express-session will call
|
// would behave like set() in that case but it's OK if it doesn't -- express-session will call
|
||||||
// set() soon enough.
|
// set() soon enough.
|
||||||
async _touch(sid, sess) {
|
async _touch(sid: string, sess:any) {
|
||||||
logger.debug(`TOUCH ${sid}`);
|
logger.debug(`TOUCH ${sid}`);
|
||||||
sess = await this._updateExpirations(sid, sess, false);
|
sess = await this._updateExpirations(sid, sess, false);
|
||||||
if (sess == null) return; // Already expired.
|
if (sess == null) return; // Already expired.
|
5
src/node/models/AsyncQueueTask.ts
Normal file
5
src/node/models/AsyncQueueTask.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export type AsyncQueueTask = {
|
||||||
|
srcFile: string,
|
||||||
|
destFile: string,
|
||||||
|
type: string
|
||||||
|
}
|
8
src/node/models/PromiseWithStd.ts
Normal file
8
src/node/models/PromiseWithStd.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import {Readable} from "node:stream";
|
||||||
|
import {ChildProcess} from "node:child_process";
|
||||||
|
|
||||||
|
export type PromiseWithStd = {
|
||||||
|
stdout?: Readable|null,
|
||||||
|
stderr?: Readable|null,
|
||||||
|
child?: ChildProcess
|
||||||
|
} & Promise<any>
|
15
src/node/models/RunCMDOptions.ts
Normal file
15
src/node/models/RunCMDOptions.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
export type RunCMDOptions = {
|
||||||
|
cwd?: string,
|
||||||
|
stdio?: string[],
|
||||||
|
env?: NodeJS.ProcessEnv
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RunCMDPromise = {
|
||||||
|
stdout?:Function,
|
||||||
|
stderr?:Function
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ErrorExtended = {
|
||||||
|
code?: number|null,
|
||||||
|
signal?: NodeJS.Signals|null
|
||||||
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
const securityManager = require('./db/SecurityManager');
|
const securityManager = require('./db/SecurityManager');
|
||||||
|
|
||||||
// checks for padAccess
|
// checks for padAccess
|
||||||
module.exports = async (req, res) => {
|
module.exports = async (req: { params?: any; cookies?: any; session?: any; }, res: { status: (arg0: number) => { (): any; new(): any; send: { (arg0: string): void; new(): any; }; }; }) => {
|
||||||
const {session: {user} = {}} = req;
|
const {session: {user} = {}} = req;
|
||||||
const accessObj = await securityManager.checkAccess(
|
const accessObj = await securityManager.checkAccess(
|
||||||
req.params.pad, req.cookies.sessionID, req.cookies.token, user);
|
req.params.pad, req.cookies.sessionID, req.cookies.token, user);
|
|
@ -4,6 +4,6 @@ const measured = require('measured-core');
|
||||||
|
|
||||||
module.exports = measured.createCollection();
|
module.exports = measured.createCollection();
|
||||||
|
|
||||||
module.exports.shutdown = async (hookName, context) => {
|
module.exports.shutdown = async (hookName: string, context:any) => {
|
||||||
module.exports.end();
|
module.exports.end();
|
||||||
};
|
};
|
|
@ -19,6 +19,9 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {ChildProcess} from "node:child_process";
|
||||||
|
import {AsyncQueueTask} from "../models/AsyncQueueTask";
|
||||||
|
|
||||||
const spawn = require('child_process').spawn;
|
const spawn = require('child_process').spawn;
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
const settings = require('./Settings');
|
const settings = require('./Settings');
|
||||||
|
@ -27,13 +30,13 @@ const os = require('os');
|
||||||
// on windows we have to spawn a process for each convertion,
|
// on windows we have to spawn a process for each convertion,
|
||||||
// cause the plugin abicommand doesn't exist on this platform
|
// cause the plugin abicommand doesn't exist on this platform
|
||||||
if (os.type().indexOf('Windows') > -1) {
|
if (os.type().indexOf('Windows') > -1) {
|
||||||
exports.convertFile = async (srcFile, destFile, type) => {
|
exports.convertFile = async (srcFile: string, destFile: string, type: string) => {
|
||||||
const abiword = spawn(settings.abiword, [`--to=${destFile}`, srcFile]);
|
const abiword = spawn(settings.abiword, [`--to=${destFile}`, srcFile]);
|
||||||
let stdoutBuffer = '';
|
let stdoutBuffer = '';
|
||||||
abiword.stdout.on('data', (data) => { stdoutBuffer += data.toString(); });
|
abiword.stdout.on('data', (data: string) => { stdoutBuffer += data.toString(); });
|
||||||
abiword.stderr.on('data', (data) => { stdoutBuffer += data.toString(); });
|
abiword.stderr.on('data', (data: string) => { stdoutBuffer += data.toString(); });
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
abiword.on('exit', (code) => {
|
abiword.on('exit', (code: number) => {
|
||||||
if (code !== 0) return reject(new Error(`Abiword died with exit code ${code}`));
|
if (code !== 0) return reject(new Error(`Abiword died with exit code ${code}`));
|
||||||
if (stdoutBuffer !== '') {
|
if (stdoutBuffer !== '') {
|
||||||
console.log(stdoutBuffer);
|
console.log(stdoutBuffer);
|
||||||
|
@ -46,13 +49,13 @@ if (os.type().indexOf('Windows') > -1) {
|
||||||
// communicate with it via stdin/stdout
|
// communicate with it via stdin/stdout
|
||||||
// thats much faster, about factor 10
|
// thats much faster, about factor 10
|
||||||
} else {
|
} else {
|
||||||
let abiword;
|
let abiword: ChildProcess;
|
||||||
let stdoutCallback = null;
|
let stdoutCallback: Function|null = null;
|
||||||
const spawnAbiword = () => {
|
const spawnAbiword = () => {
|
||||||
abiword = spawn(settings.abiword, ['--plugin', 'AbiCommand']);
|
abiword = spawn(settings.abiword, ['--plugin', 'AbiCommand']);
|
||||||
let stdoutBuffer = '';
|
let stdoutBuffer = '';
|
||||||
let firstPrompt = true;
|
let firstPrompt = true;
|
||||||
abiword.stderr.on('data', (data) => { stdoutBuffer += data.toString(); });
|
abiword.stderr!.on('data', (data) => { stdoutBuffer += data.toString(); });
|
||||||
abiword.on('exit', (code) => {
|
abiword.on('exit', (code) => {
|
||||||
spawnAbiword();
|
spawnAbiword();
|
||||||
if (stdoutCallback != null) {
|
if (stdoutCallback != null) {
|
||||||
|
@ -60,7 +63,7 @@ if (os.type().indexOf('Windows') > -1) {
|
||||||
stdoutCallback = null;
|
stdoutCallback = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
abiword.stdout.on('data', (data) => {
|
abiword.stdout!.on('data', (data) => {
|
||||||
stdoutBuffer += data.toString();
|
stdoutBuffer += data.toString();
|
||||||
// we're searching for the prompt, cause this means everything we need is in the buffer
|
// we're searching for the prompt, cause this means everything we need is in the buffer
|
||||||
if (stdoutBuffer.search('AbiWord:>') !== -1) {
|
if (stdoutBuffer.search('AbiWord:>') !== -1) {
|
||||||
|
@ -76,15 +79,15 @@ if (os.type().indexOf('Windows') > -1) {
|
||||||
};
|
};
|
||||||
spawnAbiword();
|
spawnAbiword();
|
||||||
|
|
||||||
const queue = async.queue((task, callback) => {
|
const queue = async.queue((task: AsyncQueueTask, callback:Function) => {
|
||||||
abiword.stdin.write(`convert ${task.srcFile} ${task.destFile} ${task.type}\n`);
|
abiword.stdin!.write(`convert ${task.srcFile} ${task.destFile} ${task.type}\n`);
|
||||||
stdoutCallback = (err) => {
|
stdoutCallback = (err: string) => {
|
||||||
if (err != null) console.error('Abiword File failed to convert', err);
|
if (err != null) console.error('Abiword File failed to convert', err);
|
||||||
callback(err);
|
callback(err);
|
||||||
};
|
};
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
exports.convertFile = async (srcFile, destFile, type) => {
|
exports.convertFile = async (srcFile: string, destFile: string, type: string) => {
|
||||||
await queue.pushAsync({srcFile, destFile, type});
|
await queue.pushAsync({srcFile, destFile, type});
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -18,7 +18,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const _ = require('underscore');
|
const _ = require('underscore');
|
||||||
|
@ -29,7 +28,7 @@ const absPathLogger = log4js.getLogger('AbsolutePaths');
|
||||||
* findEtherpadRoot() computes its value only on first invocation.
|
* findEtherpadRoot() computes its value only on first invocation.
|
||||||
* Subsequent invocations are served from this variable.
|
* Subsequent invocations are served from this variable.
|
||||||
*/
|
*/
|
||||||
let etherpadRoot = null;
|
let etherpadRoot: string|null = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If stringArray's last elements are exactly equal to lastDesiredElements,
|
* If stringArray's last elements are exactly equal to lastDesiredElements,
|
||||||
|
@ -41,7 +40,7 @@ let etherpadRoot = null;
|
||||||
* @return {string[]|boolean} The shortened array, or false if there was no
|
* @return {string[]|boolean} The shortened array, or false if there was no
|
||||||
* overlap.
|
* overlap.
|
||||||
*/
|
*/
|
||||||
const popIfEndsWith = (stringArray, lastDesiredElements) => {
|
const popIfEndsWith = (stringArray: string[], lastDesiredElements: string[]): string[] | false => {
|
||||||
if (stringArray.length <= lastDesiredElements.length) {
|
if (stringArray.length <= lastDesiredElements.length) {
|
||||||
absPathLogger.debug(`In order to pop "${lastDesiredElements.join(path.sep)}" ` +
|
absPathLogger.debug(`In order to pop "${lastDesiredElements.join(path.sep)}" ` +
|
||||||
`from "${stringArray.join(path.sep)}", it should contain at least ` +
|
`from "${stringArray.join(path.sep)}", it should contain at least ` +
|
||||||
|
@ -131,7 +130,7 @@ exports.findEtherpadRoot = () => {
|
||||||
* it is returned unchanged. Otherwise it is interpreted
|
* it is returned unchanged. Otherwise it is interpreted
|
||||||
* relative to exports.root.
|
* relative to exports.root.
|
||||||
*/
|
*/
|
||||||
exports.makeAbsolute = (somePath) => {
|
exports.makeAbsolute = (somePath: string) => {
|
||||||
if (path.isAbsolute(somePath)) {
|
if (path.isAbsolute(somePath)) {
|
||||||
return somePath;
|
return somePath;
|
||||||
}
|
}
|
||||||
|
@ -150,10 +149,8 @@ exports.makeAbsolute = (somePath) => {
|
||||||
* a subdirectory of the base one
|
* a subdirectory of the base one
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
exports.isSubdir = (parent, arbitraryDir) => {
|
exports.isSubdir = (parent: string, arbitraryDir: string): boolean => {
|
||||||
// modified from: https://stackoverflow.com/questions/37521893/determine-if-a-path-is-subdirectory-of-another-in-node-js#45242825
|
// modified from: https://stackoverflow.com/questions/37521893/determine-if-a-path-is-subdirectory-of-another-in-node-js#45242825
|
||||||
const relative = path.relative(parent, arbitraryDir);
|
const relative = path.relative(parent, arbitraryDir);
|
||||||
const isSubdir = !!relative && !relative.startsWith('..') && !path.isAbsolute(relative);
|
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative);
|
||||||
|
|
||||||
return isSubdir;
|
|
||||||
};
|
};
|
|
@ -3,8 +3,8 @@
|
||||||
* Generates a random String with the given length. Is needed to generate the
|
* Generates a random String with the given length. Is needed to generate the
|
||||||
* Author, Group, readonly, session Ids
|
* Author, Group, readonly, session Ids
|
||||||
*/
|
*/
|
||||||
const crypto = require('crypto');
|
const cryptoMod = require('crypto');
|
||||||
|
|
||||||
const randomString = (len) => crypto.randomBytes(len).toString('hex');
|
const randomString = (len: string) => cryptoMod.randomBytes(len).toString('hex');
|
||||||
|
|
||||||
module.exports = randomString;
|
module.exports = randomString;
|
|
@ -1,5 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import {ErrorExtended, RunCMDOptions, RunCMDPromise} from "../models/RunCMDOptions";
|
||||||
|
import {ChildProcess} from "node:child_process";
|
||||||
|
import {PromiseWithStd} from "../models/PromiseWithStd";
|
||||||
|
import {Readable} from "node:stream";
|
||||||
|
|
||||||
const spawn = require('cross-spawn');
|
const spawn = require('cross-spawn');
|
||||||
const log4js = require('log4js');
|
const log4js = require('log4js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
@ -7,12 +12,12 @@ const settings = require('./Settings');
|
||||||
|
|
||||||
const logger = log4js.getLogger('runCmd');
|
const logger = log4js.getLogger('runCmd');
|
||||||
|
|
||||||
const logLines = (readable, logLineFn) => {
|
const logLines = (readable: undefined | Readable | null, logLineFn: (arg0: (string | undefined)) => void) => {
|
||||||
readable.setEncoding('utf8');
|
readable!.setEncoding('utf8');
|
||||||
// The process won't necessarily write full lines every time -- it might write a part of a line
|
// The process won't necessarily write full lines every time -- it might write a part of a line
|
||||||
// then write the rest of the line later.
|
// then write the rest of the line later.
|
||||||
let leftovers = '';
|
let leftovers: string| undefined = '';
|
||||||
readable.on('data', (chunk) => {
|
readable!.on('data', (chunk) => {
|
||||||
const lines = chunk.split('\n');
|
const lines = chunk.split('\n');
|
||||||
if (lines.length === 0) return;
|
if (lines.length === 0) return;
|
||||||
lines[0] = leftovers + lines[0];
|
lines[0] = leftovers + lines[0];
|
||||||
|
@ -21,7 +26,7 @@ const logLines = (readable, logLineFn) => {
|
||||||
logLineFn(line);
|
logLineFn(line);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
readable.on('end', () => {
|
readable!.on('end', () => {
|
||||||
if (leftovers !== '') logLineFn(leftovers);
|
if (leftovers !== '') logLineFn(leftovers);
|
||||||
leftovers = '';
|
leftovers = '';
|
||||||
});
|
});
|
||||||
|
@ -69,7 +74,7 @@ const logLines = (readable, logLineFn) => {
|
||||||
* - `stderr`: Similar to `stdout` but for stderr.
|
* - `stderr`: Similar to `stdout` but for stderr.
|
||||||
* - `child`: The ChildProcess object.
|
* - `child`: The ChildProcess object.
|
||||||
*/
|
*/
|
||||||
module.exports = exports = (args, opts = {}) => {
|
module.exports = exports = (args: string[], opts:RunCMDOptions = {}) => {
|
||||||
logger.debug(`Executing command: ${args.join(' ')}`);
|
logger.debug(`Executing command: ${args.join(' ')}`);
|
||||||
|
|
||||||
opts = {cwd: settings.root, ...opts};
|
opts = {cwd: settings.root, ...opts};
|
||||||
|
@ -82,8 +87,8 @@ module.exports = exports = (args, opts = {}) => {
|
||||||
: opts.stdio === 'string' ? [null, 'string', 'string']
|
: opts.stdio === 'string' ? [null, 'string', 'string']
|
||||||
: Array(3).fill(opts.stdio);
|
: Array(3).fill(opts.stdio);
|
||||||
const cmdLogger = log4js.getLogger(`runCmd|${args[0]}`);
|
const cmdLogger = log4js.getLogger(`runCmd|${args[0]}`);
|
||||||
if (stdio[1] == null) stdio[1] = (line) => cmdLogger.info(line);
|
if (stdio[1] == null) stdio[1] = (line: string) => cmdLogger.info(line);
|
||||||
if (stdio[2] == null) stdio[2] = (line) => cmdLogger.error(line);
|
if (stdio[2] == null) stdio[2] = (line: string) => cmdLogger.error(line);
|
||||||
const stdioLoggers = [];
|
const stdioLoggers = [];
|
||||||
const stdioSaveString = [];
|
const stdioSaveString = [];
|
||||||
for (const fd of [1, 2]) {
|
for (const fd of [1, 2]) {
|
||||||
|
@ -116,13 +121,13 @@ module.exports = exports = (args, opts = {}) => {
|
||||||
|
|
||||||
// Create an error object to use in case the process fails. This is done here rather than in the
|
// Create an error object to use in case the process fails. This is done here rather than in the
|
||||||
// process's `exit` handler so that we get a useful stack trace.
|
// process's `exit` handler so that we get a useful stack trace.
|
||||||
const procFailedErr = new Error();
|
const procFailedErr: Error & ErrorExtended = new Error();
|
||||||
|
|
||||||
const proc = spawn(args[0], args.slice(1), opts);
|
const proc: ChildProcess = spawn(args[0], args.slice(1), opts);
|
||||||
const streams = [undefined, proc.stdout, proc.stderr];
|
const streams:[undefined, Readable|null, Readable|null] = [undefined, proc.stdout, proc.stderr];
|
||||||
|
|
||||||
let px;
|
let px: { reject: any; resolve: any; };
|
||||||
const p = new Promise((resolve, reject) => { px = {resolve, reject}; });
|
const p:PromiseWithStd = new Promise<string>((resolve, reject) => { px = {resolve, reject}; });
|
||||||
[, p.stdout, p.stderr] = streams;
|
[, p.stdout, p.stderr] = streams;
|
||||||
p.child = proc;
|
p.child = proc;
|
||||||
|
|
||||||
|
@ -132,9 +137,10 @@ module.exports = exports = (args, opts = {}) => {
|
||||||
if (stdioLoggers[fd] != null) {
|
if (stdioLoggers[fd] != null) {
|
||||||
logLines(streams[fd], stdioLoggers[fd]);
|
logLines(streams[fd], stdioLoggers[fd]);
|
||||||
} else if (stdioSaveString[fd]) {
|
} else if (stdioSaveString[fd]) {
|
||||||
|
// @ts-ignore
|
||||||
p[[null, 'stdout', 'stderr'][fd]] = stdioStringPromises[fd] = (async () => {
|
p[[null, 'stdout', 'stderr'][fd]] = stdioStringPromises[fd] = (async () => {
|
||||||
const chunks = [];
|
const chunks = [];
|
||||||
for await (const chunk of streams[fd]) chunks.push(chunk);
|
for await (const chunk of streams[fd]!) chunks.push(chunk);
|
||||||
return Buffer.concat(chunks).toString().replace(/\n+$/g, '');
|
return Buffer.concat(chunks).toString().replace(/\n+$/g, '');
|
||||||
})();
|
})();
|
||||||
}
|
}
|
6
src/package-lock.json
generated
6
src/package-lock.json
generated
|
@ -409,6 +409,12 @@
|
||||||
"integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
|
"integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/async": {
|
||||||
|
"version": "3.2.24",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/async/-/async-3.2.24.tgz",
|
||||||
|
"integrity": "sha512-8iHVLHsCCOBKjCF2KwFe0p9Z3rfM9mL+sSP8btyR5vTjJRAqpBYD28/ZLgXPf0pjG1VxOvtCV/BgXkQbpSe8Hw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/debug": {
|
"@types/debug": {
|
||||||
"version": "4.1.12",
|
"version": "4.1.12",
|
||||||
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
|
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
|
||||||
|
|
|
@ -68,17 +68,18 @@
|
||||||
"terser": "^5.27.0",
|
"terser": "^5.27.0",
|
||||||
"threads": "^1.7.0",
|
"threads": "^1.7.0",
|
||||||
"tinycon": "0.6.8",
|
"tinycon": "0.6.8",
|
||||||
|
"tsx": "^4.7.0",
|
||||||
"ueberdb2": "^4.2.48",
|
"ueberdb2": "^4.2.48",
|
||||||
"underscore": "1.13.6",
|
"underscore": "1.13.6",
|
||||||
"unorm": "1.6.0",
|
"unorm": "1.6.0",
|
||||||
"wtfnode": "^0.9.1",
|
"wtfnode": "^0.9.1"
|
||||||
"tsx": "^4.7.0"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"etherpad-healthcheck": "bin/etherpad-healthcheck",
|
"etherpad-healthcheck": "bin/etherpad-healthcheck",
|
||||||
"etherpad-lite": "node/server.ts"
|
"etherpad-lite": "node/server.ts"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/async": "^3.2.24",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
"@types/node": "^20.11.5",
|
"@types/node": "^20.11.5",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"lib": ["es6"],
|
||||||
/* Projects */
|
/* Projects */
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
/* Language and Environment */
|
/* Language and Environment */
|
||||||
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
"target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue