diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f5e52ed920..4e1a74f031 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -25,12 +25,8 @@ updates: # see issue #2214 for rationale for each of these - dependency-name: '@xmldom/xmldom' versions: [ '>=0.9.0' ] - - dependency-name: 'bcryptjs' - versions: [ '>=3.0.0' ] - dependency-name: 'bootstrap' versions: [ '>=5.0.0' ] - - dependency-name: 'bson' - versions: [ '>=5.0.0' ] - dependency-name: 'cbor' versions: [ '>=10.0.0' ] - dependency-name: 'eslint' diff --git a/package-lock.json b/package-lock.json index fefb548f49..246477a293 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "bootstrap-colorpicker": "^3.4.0", "bootstrap-material-design": "^4.1.3", "browserify-zlib": "^0.2.0", - "bson": "^4.7.2", + "bson": "^7.2.0", "buffer": "^6.0.3", "cbor": "9.0.2", "chi-squared": "^1.1.0", @@ -6512,39 +6512,12 @@ } }, "node_modules/bson": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz", - "integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.2.0.tgz", + "integrity": "sha512-YCEo7KjMlbNlyHhz7zAZNDpIpQbd+wOEHJYezv0nMYTn4x31eIUM2yomNNubclAt63dObUzKHWsBLJ9QcZNSnQ==", "license": "Apache-2.0", - "dependencies": { - "buffer": "^5.6.0" - }, "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/bson/node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "node": ">=20.19.0" } }, "node_modules/buffer": { diff --git a/package.json b/package.json index 56e1390063..475d2c368f 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "bootstrap-colorpicker": "^3.4.0", "bootstrap-material-design": "^4.1.3", "browserify-zlib": "^0.2.0", - "bson": "^4.7.2", + "bson": "^7.2.0", "buffer": "^6.0.3", "cbor": "9.0.2", "chi-squared": "^1.1.0", diff --git a/src/core/operations/BSONDeserialise.mjs b/src/core/operations/BSONDeserialise.mjs index cb46b357e8..d52bde1bdd 100644 --- a/src/core/operations/BSONDeserialise.mjs +++ b/src/core/operations/BSONDeserialise.mjs @@ -5,7 +5,7 @@ */ import Operation from "../Operation.mjs"; -import bson from "bson"; +import { deserialize } from "bson"; import OperationError from "../errors/OperationError.mjs"; /** @@ -37,7 +37,7 @@ class BSONDeserialise extends Operation { if (!input.byteLength) return ""; try { - const data = bson.deserialize(new Buffer(input)); + const data = deserialize(new Uint8Array(input)); return JSON.stringify(data, null, 2); } catch (err) { throw new OperationError(err.toString()); diff --git a/src/core/operations/BSONSerialise.mjs b/src/core/operations/BSONSerialise.mjs index 25eed876d9..cd975cbbfa 100644 --- a/src/core/operations/BSONSerialise.mjs +++ b/src/core/operations/BSONSerialise.mjs @@ -5,7 +5,7 @@ */ import Operation from "../Operation.mjs"; -import bson from "bson"; +import { serialize } from "bson"; import OperationError from "../errors/OperationError.mjs"; /** @@ -38,7 +38,8 @@ class BSONSerialise extends Operation { try { const data = JSON.parse(input); - return bson.serialize(data).buffer; + const result = serialize(data); + return result.buffer.slice(result.byteOffset, result.byteOffset + result.byteLength); } catch (err) { throw new OperationError(err.toString()); } diff --git a/src/core/operations/ParseObjectIDTimestamp.mjs b/src/core/operations/ParseObjectIDTimestamp.mjs index f86c098e7b..1b16f68ab3 100644 --- a/src/core/operations/ParseObjectIDTimestamp.mjs +++ b/src/core/operations/ParseObjectIDTimestamp.mjs @@ -6,7 +6,7 @@ import Operation from "../Operation.mjs"; import OperationError from "../errors/OperationError.mjs"; -import BSON from "bson"; +import { ObjectId } from "bson"; /** * Parse ObjectID timestamp operation @@ -35,7 +35,7 @@ class ParseObjectIDTimestamp extends Operation { */ run(input, args) { try { - const objectId = new BSON.ObjectID(input); + const objectId = new ObjectId(input); return objectId.getTimestamp().toISOString(); } catch (err) { throw new OperationError(err);