Skip to content

Commit

Permalink
Update our dependencies (#1798)
Browse files Browse the repository at this point in the history
* Upgrade our dependencies

* Require Node 20

* More minor typings updates

* Update jest

* Update node container versions in Github test workflows

* Changelog

Signed-off-by: Tadeusz „tadzik” Sośnierz <[email protected]>

* Linting

* Move eslint disabler to the correct line

Signed-off-by: Tadeusz „tadzik” Sośnierz <[email protected]>

* Update .node-version

Signed-off-by: Tadeusz „tadzik” Sośnierz <[email protected]>

* Add nedb, update matrix-* packages

* Update matrix-bot-sdk

---------

Signed-off-by: Tadeusz „tadzik” Sośnierz <[email protected]>
Co-authored-by: Will Hunt <[email protected]>
  • Loading branch information
tadzik and Half-Shot authored Mar 27, 2024
1 parent 4af7d30 commit ef5eb44
Show file tree
Hide file tree
Showing 10 changed files with 2,680 additions and 2,000 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

lint:
runs-on: ubuntu-20.04
container: node:18
container: node:20
steps:
- uses: actions/checkout@v3
- run: yarn --strict-semver --frozen-lockfile
Expand All @@ -32,7 +32,7 @@ jobs:
test:
strategy:
matrix:
node-version: [18, 20]
node-version: [20]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
Expand All @@ -43,9 +43,9 @@ jobs:
- run: yarn --strict-semver --frozen-lockfile
- run: yarn test

test-18-postgres:
test-postgres:
runs-on: ubuntu-20.04
container: node:18
container: node:20
services:
postgres:
image: postgres:latest
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN git clone https://github.com/matrix-org/freebindfree.git
RUN cd freebindfree && make

# Typescript build
FROM node:18 as builder
FROM node:20 as builder

WORKDIR /build

Expand All @@ -22,7 +22,7 @@ RUN yarn --strict-semver --frozen-lockfile
RUN rm -rf node_modules && yarn cache clean && yarn install --production

# Runtime container image
FROM node:18-slim
FROM node:20-slim

RUN apt-get update && apt-get install -y sipcalc iproute2 openssl --no-install-recommends
RUN rm -rf /var/lib/apt/lists/*
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1798.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update dependencies.
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "app.js",
"bin": "./bin/matrix-appservice-irc",
"engines": {
"node": ">=18"
"node": ">=20"
},
"scripts": {
"start": "node app.js",
Expand All @@ -32,7 +32,7 @@
"url": "https://github.com/matrix-org/matrix-appservice-irc/issues"
},
"dependencies": {
"@sentry/node": "^6.17.9",
"@sentry/node": "^7.107.0",
"ajv": "^8.12.0",
"bluebird": "^3.7.2",
"diff": "^5.1.0",
Expand All @@ -41,50 +41,51 @@
"he": "^1.2.0",
"ioredis": "^5.3.1",
"logform": "^2.4.2",
"matrix-appservice-bridge": "^9.0.1",
"matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.6.6-element.1",
"matrix-org-irc": "^2.1.0",
"nopt": "^6.0.0",
"p-queue": "^6.6.2",
"matrix-appservice-bridge": "^10.1.0",
"matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.7.0-element.1",
"matrix-org-irc": "^3.0.0",
"nopt": "^7.2.0",
"nedb": "^1.8.0",
"p-queue": "^8.0.1",
"pg": "^8.8.0",
"quick-lru": "^5.1.1",
"sanitize-html": "^2.7.2",
"semver": "^7.5.4",
"typed-emitter": "^2.1.0",
"winston": "^3.8.2",
"winston-daily-rotate-file": "^4.7.1"
"winston-daily-rotate-file": "^5.0.0"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.3",
"@tsconfig/node18": "^2",
"@tsconfig/node20": "^20.1.2",
"@types/bluebird": "^3.5.36",
"@types/diff": "^5.0.2",
"@types/express": "4.17.14",
"@types/express-serve-static-core": "4.17.31",
"@types/express": "4.17.21",
"@types/express-serve-static-core": "4.17.43",
"@types/extend": "^3.0.1",
"@types/he": "^1.1.2",
"@types/jasmine": "^4.3.1",
"@types/jasmine": "^5.1.4",
"@types/nedb": "^1.8.12",
"@types/node": "^18",
"@types/node": "^20.11.29",
"@types/nopt": "^3.0.29",
"@types/pg": "^8.6.5",
"@types/pg": "^8.11.3",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@types/sanitize-html": "^2.6.2",
"@types/semver": "^7.5.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"@vitejs/plugin-react": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.13",
"classnames": "^2.3.2",
"cross-fetch": "^3.1.5",
"cross-fetch": "^4.0.0",
"eslint": "^8.24.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"homerunner-client": "^0.0.6",
"jasmine": "^3.99.0",
"jest": "^29.1.1",
"jest": "29.7.0",
"matrix-widget-api": "^1.4.0",
"node-mocks-http": "^1.12.1",
"nyc": "^15.1.0",
Expand All @@ -97,6 +98,6 @@
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"url-join": "^5.0.0",
"vite": "^4.0.4"
"vite": "^5.1.6"
}
}
19 changes: 12 additions & 7 deletions src/datastore/postgres/PgDataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ export class PgDataStore implements DataStore, ProvisioningStore {
"server"
],
),
[counter, homeserver || "*", server.domain],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[counter, homeserver || "*", server.domain] as any[],
);
}

Expand Down Expand Up @@ -548,7 +549,8 @@ export class PgDataStore implements DataStore, ProvisioningStore {
};
const statement = PgDataStore.BuildUpsertStatement(
"client_config", "ON CONSTRAINT cons_client_config_unique", Object.keys(parameters));
await this.pgPool.query(statement, Object.values(parameters));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await this.pgPool.query(statement, Object.values(parameters) as any[]);
}


Expand Down Expand Up @@ -650,7 +652,7 @@ export class PgDataStore implements DataStore, ProvisioningStore {
if (res.rowCount === 0) {
return undefined;
}
else if (res.rowCount > 1) {
else if (res.rowCount! > 1) {
log.error("getMatrixUserByUsername returned %s results for %s on %s", res.rowCount, username, domain);
}
return new MatrixUser(res.rows[0].user_id, res.rows[0].data);
Expand All @@ -673,7 +675,8 @@ export class PgDataStore implements DataStore, ProvisioningStore {
"user_id",
"ts",
]);
await this.pgPool.query(statement, [userId, Date.now()]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await this.pgPool.query(statement, [userId, Date.now()] as any[]);
}

public async getLastSeenTimeForUsers(): Promise<{ user_id: string; ts: number }[]> {
Expand Down Expand Up @@ -705,17 +708,19 @@ export class PgDataStore implements DataStore, ProvisioningStore {
"room_id",
"visibility",
]);
await this.pgPool.query(statement, [roomId, visibility === "public"]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await this.pgPool.query(statement, [roomId, visibility === "public"] as any[]);
log.info(`setRoomVisibility ${roomId} => ${visibility}`);
}

public async isUserDeactivated(userId: string): Promise<boolean> {
const res = await this.pgPool.query(`SELECT user_id FROM deactivated_users WHERE user_id = $1`, [userId]);
return res.rowCount > 0;
return res.rowCount! > 0;
}

public async deactivateUser(userId: string) {
await this.pgPool.query("INSERT INTO deactivated_users VALUES ($1, $2)", [userId, Date.now()]);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await this.pgPool.query("INSERT INTO deactivated_users VALUES ($1, $2)", [userId, Date.now()] as any[]);
}

public async ensureSchema() {
Expand Down
7 changes: 5 additions & 2 deletions src/datastore/postgres/schema/v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ export async function runSchema(connection: PoolClient) {
// No servers to migrate?
throw Error("No client_configs found with ipv6 addresses, but counter was found");
}
else if (serverConfigsRes.rowCount > 1) {
else if (serverConfigsRes.rowCount! > 1) {
log.warn("More than one IPv6 server configured, starting both ipv6 counters from the same value.");
}
// Because we cannot determine which IRC network(s) are using the existing counter
// (owing to a bug where we treated the counter as global across all networks), this assumes
// that both networks start from the same counter value.
const [statement, values] = domainSetToValues(serverConfigsRes.rows.map(d => d.domain), existingCounter);
await connection.query(`INSERT INTO ipv6_counter (count, homeserver, server) VALUES ${statement}`, values);
await connection.query(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
`INSERT INTO ipv6_counter (count, homeserver, server) VALUES ${statement}`, values as any[]
);
}

await connection.query(`
Expand Down
8 changes: 3 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ export async function runBridge(
environment: config.sentry.environment,
serverName: config.sentry.serverName,
});
Sentry.configureScope((scope) => {
const firstNetwork = Object.keys(config.ircService.servers)[0];
scope.setTag("irc_network", firstNetwork);
});
const firstNetwork = Object.keys(config.ircService.servers)[0];
Sentry.getCurrentScope().setTag("irc_network", firstNetwork);
}
// configure global stuff for the process
if (config.ircService.logging) {
Expand Down Expand Up @@ -127,7 +125,7 @@ export async function runBridge(
}

await ircBridge.run(port);
Sentry.captureMessage("Bridge has started", Sentry.Severity.Info);
Sentry.captureMessage("Bridge has started", 'info');
return ircBridge;
}

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@tsconfig/node18/tsconfig.json",
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"incremental": true,
"allowJs": true,
Expand Down
Loading

0 comments on commit ef5eb44

Please sign in to comment.