Replace bson import with mongodb

GitOrigin-RevId: f353eb6f76bac55f576c932d868e26322e2e3967
This commit is contained in:
Alf Eaton 2024-07-30 16:55:25 +01:00 committed by Copybot
parent 907195931d
commit 9180d85c87
4 changed files with 202 additions and 20 deletions

218
package-lock.json generated
View file

@ -42260,7 +42260,6 @@
"@overleaf/stream-utils": "^0.1.0", "@overleaf/stream-utils": "^0.1.0",
"async": "^3.2.5", "async": "^3.2.5",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bson": "^6.1.0",
"bunyan": "^1.8.15", "bunyan": "^1.8.15",
"celebrate": "^15.0.3", "celebrate": "^15.0.3",
"express": "^4.19.2", "express": "^4.19.2",
@ -42280,14 +42279,6 @@
"typescript": "^5.0.4" "typescript": "^5.0.4"
} }
}, },
"services/docstore/node_modules/bson": {
"version": "6.8.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz",
"integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==",
"engines": {
"node": ">=16.20.1"
}
},
"services/docstore/node_modules/diff": { "services/docstore/node_modules/diff": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
@ -43892,15 +43883,33 @@
"lodash": "^4.17.19" "lodash": "^4.17.19"
}, },
"devDependencies": { "devDependencies": {
"bson": "^6.1.0",
"chai": "^4.3.6", "chai": "^4.3.6",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"mongodb": "^6.1.0",
"sandboxed-module": "^2.0.4", "sandboxed-module": "^2.0.4",
"sinon": "^9.2.4", "sinon": "^9.2.4",
"typescript": "^5.0.4" "typescript": "^5.0.4"
} }
}, },
"services/references/node_modules/@mongodb-js/saslprep": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz",
"integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==",
"dev": true,
"dependencies": {
"sparse-bitfield": "^3.0.3"
}
},
"services/references/node_modules/@types/whatwg-url": {
"version": "11.0.5",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz",
"integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==",
"dev": true,
"dependencies": {
"@types/webidl-conversions": "*"
}
},
"services/references/node_modules/bson": { "services/references/node_modules/bson": {
"version": "6.8.0", "version": "6.8.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz", "resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz",
@ -43910,6 +43919,111 @@
"node": ">=16.20.1" "node": ">=16.20.1"
} }
}, },
"services/references/node_modules/gcp-metadata": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-5.3.0.tgz",
"integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==",
"dev": true,
"optional": true,
"peer": true,
"dependencies": {
"gaxios": "^5.0.0",
"json-bigint": "^1.0.0"
},
"engines": {
"node": ">=12"
}
},
"services/references/node_modules/mongodb": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.9.0.tgz",
"integrity": "sha512-UMopBVx1LmEUbW/QE0Hw18u583PEDVQmUmVzzBRH0o/xtE9DBRA5ZYLOjpLIa03i8FXjzvQECJcqoMvCXftTUA==",
"dev": true,
"dependencies": {
"@mongodb-js/saslprep": "^1.1.5",
"bson": "^6.7.0",
"mongodb-connection-string-url": "^3.0.0"
},
"engines": {
"node": ">=16.20.1"
},
"peerDependencies": {
"@aws-sdk/credential-providers": "^3.188.0",
"@mongodb-js/zstd": "^1.1.0",
"gcp-metadata": "^5.2.0",
"kerberos": "^2.0.1",
"mongodb-client-encryption": ">=6.0.0 <7",
"snappy": "^7.2.2",
"socks": "^2.7.1"
},
"peerDependenciesMeta": {
"@aws-sdk/credential-providers": {
"optional": true
},
"@mongodb-js/zstd": {
"optional": true
},
"gcp-metadata": {
"optional": true
},
"kerberos": {
"optional": true
},
"mongodb-client-encryption": {
"optional": true
},
"snappy": {
"optional": true
},
"socks": {
"optional": true
}
}
},
"services/references/node_modules/mongodb-connection-string-url": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz",
"integrity": "sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==",
"dev": true,
"dependencies": {
"@types/whatwg-url": "^11.0.2",
"whatwg-url": "^13.0.0"
}
},
"services/references/node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"services/references/node_modules/tr46": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
"integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
"dev": true,
"dependencies": {
"punycode": "^2.3.0"
},
"engines": {
"node": ">=14"
}
},
"services/references/node_modules/whatwg-url": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
"integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==",
"dev": true,
"dependencies": {
"tr46": "^4.1.1",
"webidl-conversions": "^7.0.0"
},
"engines": {
"node": ">=16"
}
},
"services/spelling": { "services/spelling": {
"name": "@overleaf/spelling", "name": "@overleaf/spelling",
"version": "0.1.4", "version": "0.1.4",
@ -51933,7 +52047,6 @@
"@overleaf/stream-utils": "^0.1.0", "@overleaf/stream-utils": "^0.1.0",
"async": "^3.2.5", "async": "^3.2.5",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bson": "^6.1.0",
"bunyan": "^1.8.15", "bunyan": "^1.8.15",
"celebrate": "^15.0.3", "celebrate": "^15.0.3",
"chai": "^4.3.6", "chai": "^4.3.6",
@ -51950,11 +52063,6 @@
"typescript": "^5.0.4" "typescript": "^5.0.4"
}, },
"dependencies": { "dependencies": {
"bson": {
"version": "6.8.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz",
"integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ=="
},
"diff": { "diff": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
@ -52585,7 +52693,6 @@
"@overleaf/settings": "*", "@overleaf/settings": "*",
"async": "^3.2.5", "async": "^3.2.5",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bson": "^6.1.0",
"bunyan": "^1.8.15", "bunyan": "^1.8.15",
"chai": "^4.3.6", "chai": "^4.3.6",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
@ -52593,16 +52700,93 @@
"ioredis": "^4.16.1", "ioredis": "^4.16.1",
"lodash": "^4.17.19", "lodash": "^4.17.19",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"mongodb": "^6.1.0",
"sandboxed-module": "^2.0.4", "sandboxed-module": "^2.0.4",
"sinon": "^9.2.4", "sinon": "^9.2.4",
"typescript": "^5.0.4" "typescript": "^5.0.4"
}, },
"dependencies": { "dependencies": {
"@mongodb-js/saslprep": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz",
"integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==",
"dev": true,
"requires": {
"sparse-bitfield": "^3.0.3"
}
},
"@types/whatwg-url": {
"version": "11.0.5",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz",
"integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==",
"dev": true,
"requires": {
"@types/webidl-conversions": "*"
}
},
"bson": { "bson": {
"version": "6.8.0", "version": "6.8.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz", "resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz",
"integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==", "integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==",
"dev": true "dev": true
},
"gcp-metadata": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-5.3.0.tgz",
"integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==",
"dev": true,
"optional": true,
"peer": true,
"requires": {
"gaxios": "^5.0.0",
"json-bigint": "^1.0.0"
}
},
"mongodb": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.9.0.tgz",
"integrity": "sha512-UMopBVx1LmEUbW/QE0Hw18u583PEDVQmUmVzzBRH0o/xtE9DBRA5ZYLOjpLIa03i8FXjzvQECJcqoMvCXftTUA==",
"dev": true,
"requires": {
"@mongodb-js/saslprep": "^1.1.5",
"bson": "^6.7.0",
"mongodb-connection-string-url": "^3.0.0"
}
},
"mongodb-connection-string-url": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz",
"integrity": "sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==",
"dev": true,
"requires": {
"@types/whatwg-url": "^11.0.2",
"whatwg-url": "^13.0.0"
}
},
"punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"dev": true
},
"tr46": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
"integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
"dev": true,
"requires": {
"punycode": "^2.3.0"
}
},
"whatwg-url": {
"version": "13.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
"integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==",
"dev": true,
"requires": {
"tr46": "^4.1.1",
"webidl-conversions": "^7.0.0"
}
} }
} }
}, },

View file

@ -8,7 +8,7 @@ const { ReadableString } = require('@overleaf/stream-utils')
const RangeManager = require('./RangeManager') const RangeManager = require('./RangeManager')
const PersistorManager = require('./PersistorManager') const PersistorManager = require('./PersistorManager')
const pMap = require('p-map') const pMap = require('p-map')
const { BSON } = require('bson') const { BSON } = require('mongodb-legacy')
const PARALLEL_JOBS = Settings.parallelArchiveJobs const PARALLEL_JOBS = Settings.parallelArchiveJobs
const UN_ARCHIVE_BATCH_SIZE = Settings.unArchiveBatchSize const UN_ARCHIVE_BATCH_SIZE = Settings.unArchiveBatchSize

View file

@ -26,7 +26,6 @@
"@overleaf/stream-utils": "^0.1.0", "@overleaf/stream-utils": "^0.1.0",
"async": "^3.2.5", "async": "^3.2.5",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bson": "^6.1.0",
"bunyan": "^1.8.15", "bunyan": "^1.8.15",
"celebrate": "^15.0.3", "celebrate": "^15.0.3",
"express": "^4.19.2", "express": "^4.19.2",

View file

@ -35,7 +35,6 @@ SandboxedModule.configure({
'@overleaf/logger': stubs.logger, '@overleaf/logger': stubs.logger,
'timers/promises': timersPromises, 'timers/promises': timersPromises,
'mongodb-legacy': require('mongodb-legacy'), 'mongodb-legacy': require('mongodb-legacy'),
bson: require('bson'),
}, },
globals: { Buffer, JSON, Math, console, process }, globals: { Buffer, JSON, Math, console, process },
}) })