Merge pull request #17034 from overleaf/dp-remove-access-token-encryptor-mongo-dependency

Remove mongodb dependency for libraries/access-token-encryptor

GitOrigin-RevId: 47241e200df6a9cba34d1effc6ef3203ea95a8a7
This commit is contained in:
David 2024-02-13 08:52:02 +00:00 committed by Copybot
parent 32d2603adb
commit 19aaed64f8
3 changed files with 3 additions and 8 deletions

View file

@ -21,9 +21,6 @@
"dependencies": { "dependencies": {
"lodash": "^4.17.21" "lodash": "^4.17.21"
}, },
"peerDependencies": {
"mongodb": "*"
},
"devDependencies": { "devDependencies": {
"chai": "^4.3.6", "chai": "^4.3.6",
"mocha": "^10.2.0", "mocha": "^10.2.0",

View file

@ -1,4 +1,3 @@
const { ReadPreference } = require('mongodb')
const _ = require('lodash') const _ = require('lodash')
const { formatTokenUsageStats } = require('./format-usage-stats') const { formatTokenUsageStats } = require('./format-usage-stats')
@ -26,12 +25,14 @@ async function reEncryptTokens(accessTokenEncryptor, encryptedJson) {
* @param {AccessTokenEncryptor} accessTokenEncryptor * @param {AccessTokenEncryptor} accessTokenEncryptor
* @param {Collection} collection * @param {Collection} collection
* @param {Object} paths * @param {Object} paths
* @param {Object} queryOptions
* @return {Promise<{}>} * @return {Promise<{}>}
*/ */
async function reEncryptTokensInCollection({ async function reEncryptTokensInCollection({
accessTokenEncryptor, accessTokenEncryptor,
collection, collection,
paths, paths,
queryOptions,
}) { }) {
const { collectionName } = collection const { collectionName } = collection
const stats = {} const stats = {}
@ -56,7 +57,7 @@ async function reEncryptTokensInCollection({
const cursor = collection.find( const cursor = collection.find(
{}, {},
{ {
readPreference: ReadPreference.secondaryPreferred, ...queryOptions,
projection, projection,
} }
) )

3
package-lock.json generated
View file

@ -90,9 +90,6 @@
"mocha": "^10.2.0", "mocha": "^10.2.0",
"sandboxed-module": "^2.0.4", "sandboxed-module": "^2.0.4",
"typescript": "^5.0.4" "typescript": "^5.0.4"
},
"peerDependencies": {
"mongodb": "*"
} }
}, },
"libraries/eslint-plugin": { "libraries/eslint-plugin": {