Skip to content

Commit 7462f40

Browse files
committed
Update dependencies
1 parent 23e1e5c commit 7462f40

File tree

7 files changed

+1312
-1095
lines changed

7 files changed

+1312
-1095
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14
1+
18

package.json

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,57 +24,57 @@
2424
"license": "ISC",
2525
"dependencies": {
2626
"@types/bluebird": "3.5.36",
27-
"algoliasearch": "4.12.0",
27+
"algoliasearch": "4.14.2",
2828
"bluebird": "3.7.2",
29-
"bufferutil": "4.0.3",
29+
"bufferutil": "4.0.6",
3030
"discord.js": "12.5.3",
3131
"dotenv": "10.0.0",
32-
"isolated-vm": "4.2.0",
33-
"mongodb": "4.0.0-beta.5",
34-
"monitorss": "6.13.19",
35-
"natural": "5.1.13",
32+
"isolated-vm": "4.4.1",
33+
"mongodb": "4.9.1",
34+
"monitorss": "6.14.11",
35+
"natural": "5.2.3",
3636
"node-cache": "5.1.2",
3737
"node-fetch": "2.6.1",
3838
"openai": "2.0.2",
3939
"polish-plurals": "1.1.0",
4040
"request": "2.88.2",
4141
"request-promise": "4.2.6",
42-
"secure-json-parse": "2.4.0",
43-
"typescript": "4.3.2",
42+
"secure-json-parse": "2.5.0",
43+
"typescript": "4.8.2",
4444
"zlib-sync": "0.1.7"
4545
},
4646
"devDependencies": {
47-
"@types/chai": "4.2.18",
48-
"@types/chai-as-promised": "7.1.4",
47+
"@types/chai": "4.3.3",
48+
"@types/chai-as-promised": "7.1.5",
4949
"@types/dotenv": "8.2.0",
50-
"@types/mocha": "8.2.2",
51-
"@types/natural": "5.1.0",
50+
"@types/mocha": "9.1.1",
51+
"@types/natural": "5.1.1",
5252
"@types/nock": "11.1.0",
53-
"@types/node": "14.14.41",
54-
"@types/node-fetch": "2.5.10",
55-
"@types/secure-json-parse": "1.0.2",
56-
"@types/sinon": "10.0.2",
57-
"@types/sinon-chai": "3.2.5",
58-
"@typescript-eslint/eslint-plugin": "4.26.0",
59-
"@typescript-eslint/parser": "4.26.0",
60-
"chai": "4.3.4",
53+
"@types/node": "18.7.14",
54+
"@types/node-fetch": "2.6.2",
55+
"@types/secure-json-parse": "1.0.3",
56+
"@types/sinon": "10.0.13",
57+
"@types/sinon-chai": "3.2.8",
58+
"@typescript-eslint/eslint-plugin": "5.36.1",
59+
"@typescript-eslint/parser": "5.36.1",
60+
"chai": "4.3.6",
6161
"chai-as-promised": "7.1.1",
6262
"cross-env": "7.0.3",
63-
"eslint": "7.27.0",
64-
"eslint-config-prettier": "8.3.0",
65-
"eslint-plugin-functional": "3.2.1",
66-
"eslint-plugin-import": "2.23.4",
67-
"husky": "6.0.0",
68-
"lint-staged": "11.0.0",
69-
"mocha": "8.4.0",
70-
"nock": "13.1.0",
63+
"eslint": "8.23.0",
64+
"eslint-config-prettier": "8.5.0",
65+
"eslint-plugin-functional": "4.2.2",
66+
"eslint-plugin-import": "2.26.0",
67+
"husky": "8.0.1",
68+
"lint-staged": "13.0.3",
69+
"mocha": "10.0.0",
70+
"nock": "13.2.9",
7171
"nyc": "15.1.0",
72-
"prettier": "2.3.0",
73-
"sinon": "11.1.1",
72+
"prettier": "2.7.1",
73+
"sinon": "14.0.0",
7474
"sinon-chai": "3.7.0",
75-
"source-map-support": "0.5.19",
76-
"ts-node": "10.0.0",
77-
"tsc-watch": "4.4.0"
75+
"source-map-support": "0.5.21",
76+
"ts-node": "10.9.1",
77+
"tsc-watch": "5.0.3"
7878
},
7979
"lint-staged": {
8080
"**/*.ts": [
@@ -85,6 +85,6 @@
8585
]
8686
},
8787
"engines": {
88-
"node": "^14.0.0"
88+
"node": "^18.0.0"
8989
}
9090
}

src/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { KARMA_REGEX } from './commands/karma';
88
import { getConfig } from './config';
99
import { createHttpServer } from './http-server';
1010
import { InvalidUsageError } from './types';
11-
import { getWeekNumber } from './utils';
11+
import { getWeekNumber, wrapErr } from './utils';
1212
import { getStatsCollection, initDb } from './db';
1313
import { messageToReflinks } from './commands/reflink';
1414
import { updateKarmaRoles } from './cron/roles/karma';
@@ -175,7 +175,7 @@ client.on('messageDelete', async (msg) => {
175175
try {
176176
await revertCommand(message);
177177
} catch (err) {
178-
errors.push(err);
178+
errors.push(wrapErr(err));
179179
}
180180
}
181181

@@ -202,7 +202,7 @@ async function init() {
202202
}
203203
}
204204

205-
init().catch((err) => errors.push(err));
205+
init().catch((err) => errors.push(wrapErr(err)));
206206

207207
const httpServer = createHttpServer(client, errors, warnings, debugs);
208208

@@ -212,7 +212,7 @@ const updateRoles = async (guild: Discord.Guild) => {
212212
await updateKarmaRoles(guild);
213213
console.log(`Updated roles`);
214214
} catch (err) {
215-
errors.push(err);
215+
errors.push(wrapErr(err));
216216
}
217217
};
218218

src/commands/execute.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { polishPlurals } from 'polish-plurals';
44
import * as ts from 'typescript';
55

66
import type { Command } from '../types';
7+
import { wrapErr } from '../utils';
78

89
const pluralize = (count: number) => polishPlurals('linia', 'linie', 'linii', count);
910

@@ -187,7 +188,7 @@ const execute: Command = {
187188
return msg.channel.send(`Błąd wykonania: \`\`\`\n${String(error)}\n\`\`\``);
188189
}
189190
} catch (error) {
190-
return msg.channel.send(errorMessage(error));
191+
return msg.channel.send(errorMessage(wrapErr(error)));
191192
}
192193
},
193194
};

src/data/karma.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export const getKarmaForMember = async (memberId: string, db: Db) => {
3030
const karmaCollection = getKarmaCollection(db);
3131

3232
const [agg] = await karmaCollection
33-
.aggregate<KarmaAgg | undefined>([{ $match: { to: memberId } }, ...karmaAggregateGroup])
33+
.aggregate<KarmaAgg>([{ $match: { to: memberId } }, ...karmaAggregateGroup])
3434
.toArray();
3535
return agg;
3636
};
3737

38-
export const getKarmaForMembers = async (db: Db, memberIds: string[]) => {
38+
export const getKarmaForMembers = async (db: Db, memberIds: readonly string[]) => {
3939
const karmaCollection = getKarmaCollection(db);
4040

4141
const agg = await karmaCollection

src/utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ export const offsetDateByWeeks = (d: Date, weeks: number): Date => {
3535

3636
return offsetDate;
3737
};
38+
39+
export const wrapErr = (err: unknown): Error => {
40+
if (err instanceof Error) {
41+
return err;
42+
}
43+
return new Error(String(err));
44+
};

0 commit comments

Comments
 (0)