diff --git a/package.json b/package.json index 45e1aaf322de1087cd69a292cd2a65ec55b957b5..27172919f2707b05e8f250a832fc416c8e26c7ae 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "p-queue": "^6.4.0", "pg-promise": "^10.5.6", "prom-client": "^12.0.0", + "uuid": "^8.3.1", "winston": "^3.2.1", "winston-daily-rotate-file": "^4.5.0" }, @@ -58,14 +59,15 @@ "@istanbuljs/nyc-config-typescript": "^1.0.1", "@typescript-eslint/eslint-plugin": "^2.14.0", "@typescript-eslint/parser": "^2.14.0", + "@types/better-sqlite3": "^5.4.1", "@types/chai": "^4.2.11", "@types/command-line-args": "^5.0.0", + "@types/express": "^4.17.9", "@types/js-yaml": "^3.12.4", "@types/marked": "^1.1.0", "@types/mime": "^2.0.2", "@types/mocha": "^7.0.2", "@types/node": "^12", - "@types/better-sqlite3": "^5.4.1", "chai": "^4.2.0", "mocha": "^8.0.1", "nyc": "^15.1.0", diff --git a/src/db/roomstore.ts b/src/db/roomstore.ts index dc442162d1b34008d049ecb027b92b18b28913ce..4b526c7c392a7eef5e0d0f43a7903faf52f16060 100644 --- a/src/db/roomstore.ts +++ b/src/db/roomstore.ts @@ -17,7 +17,7 @@ import { Log } from "../log"; import { IDatabaseConnector } from "./connector"; import { Util } from "../util"; -import * as uuid from "uuid/v4"; +import { v4 as uuid } from "uuid"; import { MetricPeg } from "../metrics"; import { TimedCache } from "../structures/timedcache"; diff --git a/src/discordas.ts b/src/discordas.ts index 621ddcefb15efdaaec38ca31cad8834df25a70f8..930e20349bc729bc424c4a14fe6cdf58bfaa176e 100644 --- a/src/discordas.ts +++ b/src/discordas.ts @@ -23,9 +23,10 @@ import { Log } from "./log"; import "source-map-support/register"; import * as cliArgs from "command-line-args"; import * as usage from "command-line-usage"; -import * as uuid from "uuid/v4"; +import { v4 as uuid } from "uuid"; import { IMatrixEvent } from "./matrixtypes"; import { MetricPeg, PrometheusBridgeMetrics } from "./metrics"; +import { Response } from "express"; const log = new Log("DiscordAS"); @@ -178,6 +179,15 @@ async function run(): Promise<void> { const roomhandler = discordbot.RoomHandler; const eventProcessor = discordbot.MxEventProcessor; + // 2020-12-07: If this fails to build in TypeScript with + // "Namespace 'serveStatic' has no exported member 'RequestHandlerConstructor'.", + // remove @types/express-serve-static-core and @types/serve-static from yarn.lock + // and run yarn. + // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/49595 + appservice.expressAppInstance.get("/health", (_, res: Response) => { + res.status(200).send(""); + }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any appservice.on("query.room", async (roomAlias: string, createRoom: (opts: any) => Promise<void>) => { try { diff --git a/yarn.lock b/yarn.lock index 6930d9c56339623dae1a184a51cd964535a87158..d2cb11abd4fdb0e9a775917685a885e5ef7e9c79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -299,9 +299,9 @@ integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== "@types/express-serve-static-core@*": - version "4.17.13" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.13.tgz#d9af025e925fc8b089be37423b8d1eac781be084" - integrity sha512-RgDi5a4nuzam073lRGKTUIaL3eF2+H7LJvJ8eUnCI0wA6SNjXc44DCmWNiTLs/AZ7QlsFWZiw/gTG3nSQGL0fA== + version "4.17.14" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.14.tgz#cabf91debeeb3cb04b798e2cff908864e89b6106" + integrity sha512-uFTLwu94TfUFMToXNgRZikwPuZdOtDgs3syBtAIr/OXorL1kJqUJT9qCLnRZ5KBOWfZQikQ2xKgR2tnDj1OgDA== dependencies: "@types/node" "*" "@types/qs" "*" @@ -317,6 +317,16 @@ "@types/qs" "*" "@types/serve-static" "*" +"@types/express@^4.17.9": + version "4.17.9" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.9.tgz#f5f2df6add703ff28428add52bdec8a1091b0a78" + integrity sha512-SDzEIZInC4sivGIFY4Sz1GG6J9UObPwCInYJjko2jzOf/Imx/dlpume6Xxwj1ORL82tBbmN4cPDIDkLbWHk9hw== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "*" + "@types/qs" "*" + "@types/serve-static" "*" + "@types/http-cache-semantics@*": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz#9140779736aa2655635ee756e2467d787cfe8a2a" @@ -400,9 +410,9 @@ "@types/node" "*" "@types/serve-static@*": - version "1.13.6" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.6.tgz#866b1b8dec41c36e28c7be40ac725b88be43c5c1" - integrity sha512-nuRJmv7jW7VmCVTn+IgYDkkbbDGyIINOeu/G0d74X3lm6E5KfMeQPJhxIt1ayQeQB3cSxvYs1RA/wipYoFB4EA== + version "1.13.8" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.8.tgz#851129d434433c7082148574ffec263d58309c46" + integrity sha512-MoJhSQreaVoL+/hurAZzIm8wafFR6ajiTM1m4A0kv6AGeVBl4r4pOV8bGFrjjq1sGxDTnCoF8i22o0/aE5XCyA== dependencies: "@types/mime" "*" "@types/node" "*" @@ -3856,6 +3866,11 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" integrity sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== +uuid@^8.3.1: + version "8.3.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31" + integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg== + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"