From ce4e7512921c2935a3adec9d9b94848c0fac5ba1 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 10 Oct 2021 11:03:04 +0200 Subject: :art: clean up dependencies --- bundle/package.json | 85 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 26 deletions(-) (limited to 'bundle/package.json') diff --git a/bundle/package.json b/bundle/package.json index a7f5358b..05cefaab 100644 --- a/bundle/package.json +++ b/bundle/package.json @@ -4,11 +4,10 @@ "description": "", "main": "src/start.js", "scripts": { - "setup": "cd ../util && npm --production=false i && cd ../api && npm --production=false i && cd ../cdn && npm --production=false i && cd ../gateway && npm --production=false i && cd ../bundle/ && npm --production=false i && npm run build", + "setup": "node scripts/install.js && npm install && ts-patch install -s && patch-package --patch-dir ../api/patches/ && npm run build", "build": "node scripts/build.js", - "build:bundle": "npx tsc -b .", - "start": "node scripts/build.js && node -r tsconfig-paths/register dist/start.js", - "start:bundle": "node -r tsconfig-paths/register dist/start.js", + "start": "node scripts/build.js && node dist/bundle/src/start.js", + "start:bundle": "node dist/bundle/src/start.js", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { @@ -23,42 +22,76 @@ }, "homepage": "https://fosscord.com", "devDependencies": { - "@swc/cli": "^0.1.51", - "@swc/core": "^1.2.93", + "@babel/core": "^7.15.5", + "@babel/preset-env": "^7.15.6", + "@babel/preset-typescript": "^7.15.0", "@types/amqplib": "^0.8.1", - "@types/async-exit-hook": "^2.0.0", "@types/bcrypt": "^5.0.0", - "@types/express": "^4.17.9", + "@types/body-parser": "^1.19.0", + "@types/btoa": "^1.2.3", + "@types/dotenv": "^8.2.0", + "@types/express": "^4.17.12", + "@types/fs-extra": "^9.0.12", "@types/i18next-node-fs-backend": "^2.1.0", + "@types/jest": "^27.0.1", + "@types/jest-expect-message": "^1.0.3", "@types/jsonwebtoken": "^8.5.0", - "@types/mongodb": "^3.6.9", - "@types/mongoose-autopopulate": "^0.10.1", - "@types/mongoose-lean-virtuals": "^0.5.1", - "@types/multer": "^1.4.5", - "@types/node": "^14.17.20", - "@types/node-fetch": "^2.5.7", + "@types/multer": "^1.4.7", + "@types/node": "^14.17.9", + "@types/node-fetch": "^2.5.12", "@types/node-os-utils": "^1.2.0", - "@types/uuid": "^8.3.0", + "@types/supertest": "^2.0.11", "@types/ws": "^7.4.0", "@zerollup/ts-transform-paths": "^1.7.18", - "esbuild": "^0.13.4", - "esbuild-plugin-tsc": "^0.3.0", - "ts-node": "^10.2.1", + "jest": "^27.0.6", + "jest-expect-message": "^1.0.2", + "jest-runtime": "^27.2.1", + "ts-node": "^9.1.1", + "ts-node-dev": "^1.1.6", "ts-patch": "^1.4.4", - "tsconfig-paths": "^3.11.0", - "typescript": "^4.4.3" + "typescript": "^4.2.3", + "typescript-json-schema": "0.50.1", + "@types/morgan": "^1.9.3" }, "dependencies": { - "@fosscord/api": "file:../api", - "@fosscord/cdn": "file:../cdn", - "@fosscord/gateway": "file:../gateway", - "@fosscord/util": "file:../util", + "ajv": "8.6.2", + "ajv-formats": "^2.1.1", + "amqplib": "^0.8.0", + "assert": "^1.5.0", "async-exit-hook": "^2.0.1", - "dotenv": "^10.0.0", + "bcrypt": "^5.0.1", + "body-parser": "^1.19.0", + "btoa": "^1.2.1", + "dotenv": "^8.2.0", + "exif-be-gone": "^1.2.0", "express": "^4.17.1", + "express-async-errors": "^3.1.1", + "file-type": "^16.5.0", + "form-data": "^3.0.0", + "fs-extra": "^10.0.0", + "i18next": "^19.9.2", + "i18next-http-middleware": "^3.1.3", + "i18next-node-fs-backend": "^2.1.3", + "image-size": "^1.0.0", + "jest": "^27.0.6", + "jsonwebtoken": "^8.5.1", + "lambert-db": "^1.2.3", + "lambert-server": "^1.2.11", "missing-native-js-functions": "^1.2.17", + "morgan": "^1.10.0", + "multer": "^1.4.2", "nanocolors": "^0.2.12", + "node-fetch": "^2.6.1", "node-os-utils": "^1.3.5", - "reflect-metadata": "^0.1.13" + "patch-package": "^6.4.7", + "pg": "^8.7.1", + "reflect-metadata": "^0.1.13", + "sqlite3": "^5.0.2", + "supertest": "^6.1.6", + "typeorm": "^0.2.37", + "typescript": "^4.1.2", + "typescript-json-schema": "^0.50.1", + "ws": "^7.4.2", + "cheerio": "^1.0.0-rc.10" } } -- cgit 1.5.1 From 57c9813f2fca9b8f4e02f09d71515bc7f59b4010 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 10 Oct 2021 11:08:55 +0200 Subject: :bug: convert bigint literal to object --- api/src/routes/channels/#channel_id/permissions.ts | 4 ++-- api/src/routes/guilds/#guild_id/roles.ts | 9 +++++++-- api/src/routes/guilds/templates/index.ts | 2 +- bundle/package.json | 2 +- gateway/src/opcodes/Identify.ts | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) (limited to 'bundle/package.json') diff --git a/api/src/routes/channels/#channel_id/permissions.ts b/api/src/routes/channels/#channel_id/permissions.ts index 6ebf721a..2eded853 100644 --- a/api/src/routes/channels/#channel_id/permissions.ts +++ b/api/src/routes/channels/#channel_id/permissions.ts @@ -44,8 +44,8 @@ router.put( }; channel.permission_overwrites!.push(overwrite); } - overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || 0n)); - overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || 0n)); + overwrite.allow = String(req.permission!.bitfield & (BigInt(body.allow) || BigInt("0"))); + overwrite.deny = String(req.permission!.bitfield & (BigInt(body.deny) || BigInt("0"))); await Promise.all([ channel.save(), diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts index d1d60906..0a57c6a2 100644 --- a/api/src/routes/guilds/#guild_id/roles.ts +++ b/api/src/routes/guilds/#guild_id/roles.ts @@ -57,7 +57,7 @@ router.post("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" }) ...body, guild_id: guild_id, managed: false, - permissions: String(req.permission!.bitfield & (body.permissions || 0n)), + permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))), tags: undefined }); @@ -105,7 +105,12 @@ router.patch("/:role_id", route({ body: "RoleModifySchema", permission: "MANAGE_ const { role_id, guild_id } = req.params; const body = req.body as RoleModifySchema; - const role = new Role({ ...body, id: role_id, guild_id, permissions: String(req.permission!.bitfield & (body.permissions || 0n)) }); + const role = new Role({ + ...body, + id: role_id, + guild_id, + permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))) + }); await Promise.all([ role.save(), diff --git a/api/src/routes/guilds/templates/index.ts b/api/src/routes/guilds/templates/index.ts index b5e243e9..86316d23 100644 --- a/api/src/routes/guilds/templates/index.ts +++ b/api/src/routes/guilds/templates/index.ts @@ -47,7 +47,7 @@ router.post("/:code", route({ body: "GuildTemplateCreateSchema" }), async (req: managed: true, mentionable: true, name: "@everyone", - permissions: 2251804225n, + permissions: BigInt("2251804225"), position: 0, tags: null }).save() diff --git a/bundle/package.json b/bundle/package.json index 05cefaab..3bed5b07 100644 --- a/bundle/package.json +++ b/bundle/package.json @@ -94,4 +94,4 @@ "ws": "^7.4.2", "cheerio": "^1.0.0-rc.10" } -} +} \ No newline at end of file diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts index b81c7bf4..5d5b72d1 100644 --- a/gateway/src/opcodes/Identify.ts +++ b/gateway/src/opcodes/Identify.ts @@ -41,7 +41,7 @@ export async function onIdentify(this: WebSocket, data: Payload) { return this.close(CLOSECODES.Authentication_failed); } this.user_id = decoded.id; - if (!identify.intents) identify.intents = 0b11111111111111n; + if (!identify.intents) identify.intents = BigInt("0b11111111111111"); this.intents = new Intents(identify.intents); if (identify.shard) { this.shard_id = identify.shard[0]; -- cgit 1.5.1