Switch to mongodb-legacy

GitOrigin-RevId: 11e09528c153de6b7766d18c3c90d94962190371
This commit is contained in:
andrew rumble 2024-08-02 17:27:31 +01:00 committed by Copybot
parent 04b46fa5ff
commit 032deaf05c
113 changed files with 156 additions and 129 deletions

23
package-lock.json generated
View file

@ -44629,7 +44629,7 @@
"minimist": "^1.2.7", "minimist": "^1.2.7",
"mmmagic": "^0.5.3", "mmmagic": "^0.5.3",
"moment": "^2.29.4", "moment": "^2.29.4",
"mongodb": "5.9.2", "mongodb-legacy": "5.0.0",
"mongoose": "^7.8.0", "mongoose": "^7.8.0",
"multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e", "multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e",
"nocache": "^2.1.0", "nocache": "^2.1.0",
@ -45844,6 +45844,17 @@
} }
} }
}, },
"services/web/node_modules/mongodb-legacy": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/mongodb-legacy/-/mongodb-legacy-5.0.0.tgz",
"integrity": "sha512-q2G+MRwde6114bCAF/EZLmMXSsebIKMHmzsfOJq6M/Tj4gr3wLT50+rJsJNkiR0e0kjFx3dllWjqwRR1n11Zsw==",
"dependencies": {
"mongodb": "^5.0.0"
},
"engines": {
"node": ">=14.20.1"
}
},
"services/web/node_modules/mongoose": { "services/web/node_modules/mongoose": {
"version": "7.8.0", "version": "7.8.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz",
@ -53393,7 +53404,7 @@
"mocha-each": "^2.0.1", "mocha-each": "^2.0.1",
"mock-fs": "^5.1.2", "mock-fs": "^5.1.2",
"moment": "^2.29.4", "moment": "^2.29.4",
"mongodb": "5.9.2", "mongodb-legacy": "5.0.0",
"mongoose": "^7.8.0", "mongoose": "^7.8.0",
"multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e", "multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e",
"nocache": "^2.1.0", "nocache": "^2.1.0",
@ -54199,6 +54210,14 @@
"socks": "^2.7.1" "socks": "^2.7.1"
} }
}, },
"mongodb-legacy": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/mongodb-legacy/-/mongodb-legacy-5.0.0.tgz",
"integrity": "sha512-q2G+MRwde6114bCAF/EZLmMXSsebIKMHmzsfOJq6M/Tj4gr3wLT50+rJsJNkiR0e0kjFx3dllWjqwRR1n11Zsw==",
"requires": {
"mongodb": "^5.0.0"
}
},
"mongoose": { "mongoose": {
"version": "7.8.0", "version": "7.8.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz",

View file

@ -1,5 +1,5 @@
const { callbackify } = require('util') const { callbackify } = require('util')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const CollaboratorsGetter = require('../Collaborators/CollaboratorsGetter') const CollaboratorsGetter = require('../Collaborators/CollaboratorsGetter')
const CollaboratorsHandler = require('../Collaborators/CollaboratorsHandler') const CollaboratorsHandler = require('../Collaborators/CollaboratorsHandler')
const ProjectGetter = require('../Project/ProjectGetter') const ProjectGetter = require('../Project/ProjectGetter')

View file

@ -1,6 +1,6 @@
const AuthorizationManager = require('./AuthorizationManager') const AuthorizationManager = require('./AuthorizationManager')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../Errors/Errors') const Errors = require('../Errors/Errors')
const HttpErrorHandler = require('../Errors/HttpErrorHandler') const HttpErrorHandler = require('../Errors/HttpErrorHandler')
const AuthenticationController = require('../Authentication/AuthenticationController') const AuthenticationController = require('../Authentication/AuthenticationController')

View file

@ -1,6 +1,6 @@
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const HttpErrorHandler = require('../../Features/Errors/HttpErrorHandler') const HttpErrorHandler = require('../../Features/Errors/HttpErrorHandler')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const CollaboratorsHandler = require('./CollaboratorsHandler') const CollaboratorsHandler = require('./CollaboratorsHandler')
const CollaboratorsGetter = require('./CollaboratorsGetter') const CollaboratorsGetter = require('./CollaboratorsGetter')
const OwnershipTransferHandler = require('./OwnershipTransferHandler') const OwnershipTransferHandler = require('./OwnershipTransferHandler')

View file

@ -1,6 +1,6 @@
const { callbackify } = require('util') const { callbackify } = require('util')
const pLimit = require('p-limit') const pLimit = require('p-limit')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')

View file

@ -1,5 +1,5 @@
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { ObjectId: MongooseObjectId } = require('mongoose').mongo const { ObjectId: MongooseObjectId } = require('mongoose').mongo
function _getObjectIdInstance(id) { function _getObjectIdInstance(id) {

View file

@ -1,7 +1,7 @@
// @ts-check // @ts-check
const { callbackify } = require('util') const { callbackify } = require('util')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const HistoryManager = require('../History/HistoryManager') const HistoryManager = require('../History/HistoryManager')

View file

@ -4,7 +4,7 @@ const DocstoreManager = require('../Docstore/DocstoreManager')
const ProjectGetter = require('../Project/ProjectGetter') const ProjectGetter = require('../Project/ProjectGetter')
const ProjectUpdateHandler = require('../Project/ProjectUpdateHandler') const ProjectUpdateHandler = require('../Project/ProjectUpdateHandler')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { READ_PREFERENCE_SECONDARY } = require('../../infrastructure/mongodb') const { READ_PREFERENCE_SECONDARY } = require('../../infrastructure/mongodb')
const { callbackifyAll } = require('@overleaf/promise-utils') const { callbackifyAll } = require('@overleaf/promise-utils')

View file

@ -2,7 +2,7 @@ const {
callbackifyAll, callbackifyAll,
promiseMapWithLimit, promiseMapWithLimit,
} = require('@overleaf/promise-utils') } = require('@overleaf/promise-utils')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const { fetchJson } = require('@overleaf/fetch-utils') const { fetchJson } = require('@overleaf/fetch-utils')

View file

@ -1,6 +1,6 @@
const Path = require('path') const Path = require('path')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
module.exports = { buildFolderStructure } module.exports = { buildFolderStructure }

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
const { callbackifyAll } = require('@overleaf/promise-utils') const { callbackifyAll } = require('@overleaf/promise-utils')

View file

@ -5,7 +5,7 @@ const { setTimeout } = require('timers/promises')
const pProps = require('p-props') const pProps = require('p-props')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const { expressify } = require('@overleaf/promise-utils') const { expressify } = require('@overleaf/promise-utils')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const ProjectDeleter = require('./ProjectDeleter') const ProjectDeleter = require('./ProjectDeleter')
const ProjectDuplicator = require('./ProjectDuplicator') const ProjectDuplicator = require('./ProjectDuplicator')
const ProjectCreationHandler = require('./ProjectCreationHandler') const ProjectCreationHandler = require('./ProjectCreationHandler')

View file

@ -1,7 +1,7 @@
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const metrics = require('@overleaf/metrics') const metrics = require('@overleaf/metrics')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Features = require('../../infrastructure/Features') const Features = require('../../infrastructure/Features')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
const { Folder } = require('../../models/Folder') const { Folder } = require('../../models/Folder')

View file

@ -2,7 +2,7 @@ const { callbackify } = require('util')
const { callbackifyMultiResult } = require('@overleaf/promise-utils') const { callbackifyMultiResult } = require('@overleaf/promise-utils')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const path = require('path') const path = require('path')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const CooldownManager = require('../Cooldown/CooldownManager') const CooldownManager = require('../Cooldown/CooldownManager')

View file

@ -1,5 +1,5 @@
// ts-check // ts-check
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const _ = require('lodash') const _ = require('lodash')
const { promisify } = require('util') const { promisify } = require('util')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')

View file

@ -1,6 +1,6 @@
const { callbackify } = require('util') const { callbackify } = require('util')
const _ = require('lodash') const _ = require('lodash')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const SessionManager = require('../Authentication/SessionManager') const SessionManager = require('../Authentication/SessionManager')

View file

@ -1,6 +1,6 @@
const AnalyticsManager = require('../Analytics/AnalyticsManager') const AnalyticsManager = require('../Analytics/AnalyticsManager')
const SubscriptionEmailHandler = require('./SubscriptionEmailHandler') const SubscriptionEmailHandler = require('./SubscriptionEmailHandler')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const INVOICE_SUBSCRIPTION_LIMIT = 10 const INVOICE_SUBSCRIPTION_LIMIT = 10

View file

@ -3,7 +3,7 @@ const crypto = require('crypto')
const settings = require('@overleaf/settings') const settings = require('@overleaf/settings')
const Modules = require('../../infrastructure/Modules') const Modules = require('../../infrastructure/Modules')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { Subscription } = require('../../models/Subscription') const { Subscription } = require('../../models/Subscription')
const { SSOConfig } = require('../../models/SSOConfig') const { SSOConfig } = require('../../models/SSOConfig')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const _ = require('lodash') const _ = require('lodash')
const { callbackify } = require('util') const { callbackify } = require('util')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')

View file

@ -1,7 +1,7 @@
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
const PublicAccessLevels = require('../Authorization/PublicAccessLevels') const PublicAccessLevels = require('../Authorization/PublicAccessLevels')
const PrivilegeLevels = require('../Authorization/PrivilegeLevels') const PrivilegeLevels = require('../Authorization/PrivilegeLevels')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Metrics = require('@overleaf/metrics') const Metrics = require('@overleaf/metrics')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger') const logger = require('@overleaf/logger')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const EmailHandler = require('../Email/EmailHandler') const EmailHandler = require('../Email/EmailHandler')
const Errors = require('../Errors/Errors') const Errors = require('../Errors/Errors')
const InstitutionsAPI = require('../Institutions/InstitutionsAPI') const InstitutionsAPI = require('../Institutions/InstitutionsAPI')

View file

@ -1,6 +1,6 @@
const UserGetter = require('./UserGetter') const UserGetter = require('./UserGetter')
const SessionManager = require('../Authentication/SessionManager') const SessionManager = require('../Authentication/SessionManager')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
function getLoggedInUsersPersonalInfo(req, res, next) { function getLoggedInUsersPersonalInfo(req, res, next) {
const userId = SessionManager.getLoggedInUserId(req.session) const userId = SessionManager.getLoggedInUserId(req.session)

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { promisifyAll, callbackify } = require('@overleaf/promise-utils') const { promisifyAll, callbackify } = require('@overleaf/promise-utils')
const EntityModels = { const EntityModels = {
Institution: require('../../models/Institution').Institution, Institution: require('../../models/Institution').Institution,

View file

@ -1,5 +1,5 @@
const { Joi: CelebrateJoi, celebrate, errors } = require('celebrate') const { Joi: CelebrateJoi, celebrate, errors } = require('celebrate')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const objectIdValidator = { const objectIdValidator = {
type: 'objectId', type: 'objectId',

View file

@ -1,4 +1,4 @@
const mongodb = require('mongodb') const mongodb = require('mongodb-legacy')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const Mongoose = require('./Mongoose') const Mongoose = require('./Mongoose')

View file

@ -1,4 +1,4 @@
const { ObjectId, ReadPreference } = require('mongodb') const { ObjectId, ReadPreference } = require('mongodb-legacy')
const BATCH_SIZE = parseInt(process.env.BATCH_SIZE || '1000', 10) const BATCH_SIZE = parseInt(process.env.BATCH_SIZE || '1000', 10)
const MIN_ID = process.env.MIN_ID const MIN_ID = process.env.MIN_ID

View file

@ -12,7 +12,7 @@
*/ */
const _ = require('lodash') const _ = require('lodash')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const User = require('../../../../../test/acceptance/src/helpers/User') const User = require('../../../../../test/acceptance/src/helpers/User')
const MockProjectHistoryApiClass = require('../../../../../test/acceptance/src/mocks/MockProjectHistoryApi') const MockProjectHistoryApiClass = require('../../../../../test/acceptance/src/mocks/MockProjectHistoryApi')

View file

@ -1,5 +1,5 @@
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Path = require('path') const Path = require('path')
const fs = require('fs') const fs = require('fs')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { waitForDb, db } = require('../../../app/src/infrastructure/mongodb') const { waitForDb, db } = require('../../../app/src/infrastructure/mongodb')
const { getMongoClient } = require('../../../app/src/infrastructure/Mongoose') const { getMongoClient } = require('../../../app/src/infrastructure/Mongoose')

View file

@ -137,7 +137,7 @@
"minimist": "^1.2.7", "minimist": "^1.2.7",
"mmmagic": "^0.5.3", "mmmagic": "^0.5.3",
"moment": "^2.29.4", "moment": "^2.29.4",
"mongodb": "5.9.2", "mongodb-legacy": "5.0.0",
"mongoose": "^7.8.0", "mongoose": "^7.8.0",
"multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e", "multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e",
"nocache": "^2.1.0", "nocache": "^2.1.0",

View file

@ -7,7 +7,7 @@ const {
} = require('../../app/src/models/DeletedSubscription') } = require('../../app/src/models/DeletedSubscription')
const minimist = require('minimist') const minimist = require('minimist')
const _ = require('lodash') const _ = require('lodash')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
let FETCH_LIMIT, COMMIT, VERBOSE let FETCH_LIMIT, COMMIT, VERBOSE

View file

@ -1,5 +1,5 @@
const { promisify } = require('util') const { promisify } = require('util')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { const {
db, db,
waitForDb, waitForDb,

View file

@ -3,7 +3,7 @@
*/ */
const minimist = require('minimist') const minimist = require('minimist')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { db, waitForDb } = require('../app/src/infrastructure/mongodb') const { db, waitForDb } = require('../app/src/infrastructure/mongodb')
const Errors = require('../app/src/Features/Errors/Errors') const Errors = require('../app/src/Features/Errors/Errors')

View file

@ -13,7 +13,7 @@ process.env.BATCH_SIZE = BATCH_SIZE
process.env.MONGO_SOCKET_TIMEOUT = process.env.MONGO_SOCKET_TIMEOUT =
parseInt(process.env.MONGO_SOCKET_TIMEOUT, 10) || 600000 parseInt(process.env.MONGO_SOCKET_TIMEOUT, 10) || 600000
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { promiseMapWithLimit } = require('@overleaf/promise-utils') const { promiseMapWithLimit } = require('@overleaf/promise-utils')
const { batchedUpdate } = require('./helpers/batchedUpdate') const { batchedUpdate } = require('./helpers/batchedUpdate')
const ChatApiHandler = require('../app/src/Features/Chat/ChatApiHandler') const ChatApiHandler = require('../app/src/Features/Chat/ChatApiHandler')

View file

@ -1,6 +1,6 @@
const DocstoreManager = require('../app/src/Features/Docstore/DocstoreManager') const DocstoreManager = require('../app/src/Features/Docstore/DocstoreManager')
const { promisify } = require('util') const { promisify } = require('util')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { const {
db, db,
waitForDb, waitForDb,

View file

@ -3,7 +3,7 @@ const SubscriptionUpdater = require('../app/src/Features/Subscription/Subscripti
const minimist = require('minimist') const minimist = require('minimist')
const { waitForDb } = require('../app/src/infrastructure/mongodb') const { waitForDb } = require('../app/src/infrastructure/mongodb')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const run = async () => { const run = async () => {
for (const id of ids) { for (const id of ids) {

View file

@ -5,7 +5,7 @@
* This is the output format of each line in the find_malformed_filetrees.js * This is the output format of each line in the find_malformed_filetrees.js
* script. * script.
*/ */
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { db, waitForDb } = require('../app/src/infrastructure/mongodb') const { db, waitForDb } = require('../app/src/infrastructure/mongodb')
const ProjectLocator = require('../app/src/Features/Project/ProjectLocator') const ProjectLocator = require('../app/src/Features/Project/ProjectLocator')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { db, waitForDb } = require('../app/src/infrastructure/mongodb') const { db, waitForDb } = require('../app/src/infrastructure/mongodb')
const DocumentUpdaterHandler = require('../app/src/Features/DocumentUpdater/DocumentUpdaterHandler') const DocumentUpdaterHandler = require('../app/src/Features/DocumentUpdater/DocumentUpdaterHandler')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { const {
db, db,
waitForDb, waitForDb,

View file

@ -1,5 +1,5 @@
const minimist = require('minimist') const minimist = require('minimist')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { waitForDb, db } = require('../../app/src/infrastructure/mongodb') const { waitForDb, db } = require('../../app/src/infrastructure/mongodb')
const { const {
hashSecret, hashSecret,

View file

@ -1,6 +1,6 @@
const { db, waitForDb } = require('../app/src/infrastructure/mongodb') const { db, waitForDb } = require('../app/src/infrastructure/mongodb')
const { batchedUpdate } = require('./helpers/batchedUpdate') const { batchedUpdate } = require('./helpers/batchedUpdate')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const minimist = require('minimist') const minimist = require('minimist')
const CollaboratorsHandler = require('../app/src/Features/Collaborators/CollaboratorsHandler') const CollaboratorsHandler = require('../app/src/Features/Collaborators/CollaboratorsHandler')
const { const {

View file

@ -1,5 +1,5 @@
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { Project } = require('../app/src/models/Project') const { Project } = require('../app/src/models/Project')
async function main() { async function main() {

View file

@ -8,4 +8,4 @@ chai.use(require('chai-exclude'))
chai.config.truncateThreshold = 0 chai.config.truncateThreshold = 0
// ensure every ObjectId has the id string as a property for correct comparisons // ensure every ObjectId has the id string as a property for correct comparisons
require('mongodb').ObjectId.cacheHexString = true require('mongodb-legacy').ObjectId.cacheHexString = true

View file

@ -1,5 +1,5 @@
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Settings = require('@overleaf/settings') const Settings = require('@overleaf/settings')
const User = require('./helpers/User').promises const User = require('./helpers/User').promises

View file

@ -1,6 +1,6 @@
const { expect } = require('chai') const { expect } = require('chai')
const { exec } = require('child_process') const { exec } = require('child_process')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const User = require('./helpers/User').promises const User = require('./helpers/User').promises

View file

@ -2,7 +2,7 @@ const User = require('./helpers/User')
const request = require('./helpers/request') const request = require('./helpers/request')
const { expect } = require('chai') const { expect } = require('chai')
const settings = require('@overleaf/settings') const settings = require('@overleaf/settings')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('DocUpdate', function () { describe('DocUpdate', function () {
beforeEach(function (done) { beforeEach(function (done) {

View file

@ -1,6 +1,6 @@
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId: NativeObjectId } = require('mongodb') const { ObjectId: NativeObjectId } = require('mongodb-legacy')
const { ObjectId: MongooseObjectId } = require('mongoose').mongo const { ObjectId: MongooseObjectId } = require('mongoose').mongo
const { User: UserModel } = require('../../../app/src/models/User') const { User: UserModel } = require('../../../app/src/models/User')

View file

@ -1,7 +1,7 @@
const { expect } = require('chai') const { expect } = require('chai')
const User = require('./helpers/User').promises const User = require('./helpers/User').promises
const { Project } = require('../../../app/src/models/Project') const { Project } = require('../../../app/src/models/Project')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const cheerio = require('cheerio') const cheerio = require('cheerio')
const { Subscription } = require('../../../app/src/models/Subscription') const { Subscription } = require('../../../app/src/models/Subscription')
const Features = require('../../../app/src/infrastructure/Features') const Features = require('../../../app/src/infrastructure/Features')

View file

@ -1,5 +1,5 @@
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Path = require('path') const Path = require('path')
const fs = require('fs') const fs = require('fs')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const InstitutionModel = const InstitutionModel =
require('../../../../app/src/models/Institution').Institution require('../../../../app/src/models/Institution').Institution

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const PublisherModel = require('../../../../app/src/models/Publisher').Publisher const PublisherModel = require('../../../../app/src/models/Publisher').Publisher
const { callbackifyClass } = require('@overleaf/promise-utils') const { callbackifyClass } = require('@overleaf/promise-utils')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Subscription = require('./Subscription') const Subscription = require('./Subscription')
const MockRecurlyApiClass = require('../mocks/MockRecurlyApi') const MockRecurlyApiClass = require('../mocks/MockRecurlyApi')
const RecurlyWrapper = require('../../../../app/src/Features/Subscription/RecurlyWrapper') const RecurlyWrapper = require('../../../../app/src/Features/Subscription/RecurlyWrapper')

View file

@ -8,7 +8,7 @@ const UserUpdater = require('../../../../app/src/Features/User/UserUpdater')
const moment = require('moment') const moment = require('moment')
const fetch = require('node-fetch') const fetch = require('node-fetch')
const { db } = require('../../../../app/src/infrastructure/mongodb') const { db } = require('../../../../app/src/infrastructure/mongodb')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { const {
UserAuditLogEntry, UserAuditLogEntry,
} = require('../../../../app/src/models/UserAuditLogEntry') } = require('../../../../app/src/models/UserAuditLogEntry')

View file

@ -1,6 +1,6 @@
const AbstractMockApi = require('./AbstractMockApi') const AbstractMockApi = require('./AbstractMockApi')
const _ = require('lodash') const _ = require('lodash')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { const {
plainTextResponse, plainTextResponse,
} = require('../../../../app/src/infrastructure/Response') } = require('../../../../app/src/infrastructure/Response')

View file

@ -23,7 +23,7 @@ chai.config.truncateThreshold = 0
require('sinon-mongoose') require('sinon-mongoose')
// ensure every ObjectId has the id string as a property for correct comparisons // ensure every ObjectId has the id string as a property for correct comparisons
require('mongodb').ObjectId.cacheHexString = true require('mongodb-legacy').ObjectId.cacheHexString = true
/* /*
* Global stubs * Global stubs

View file

@ -4,7 +4,7 @@ const sinon = require('sinon')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
const { assert } = require('chai') const { assert } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = path.join( const MODULE_PATH = path.join(
__dirname, __dirname,

View file

@ -6,7 +6,7 @@ const SandboxedModule = require('sandboxed-module')
const tk = require('timekeeper') const tk = require('timekeeper')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const AuthenticationErrors = require('../../../../app/src/Features/Authentication/AuthenticationErrors') const AuthenticationErrors = require('../../../../app/src/Features/Authentication/AuthenticationErrors')
describe('AuthenticationController', function () { describe('AuthenticationController', function () {

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const AuthenticationErrors = require('../../../../app/src/Features/Authentication/AuthenticationErrors') const AuthenticationErrors = require('../../../../app/src/Features/Authentication/AuthenticationErrors')
const tk = require('timekeeper') const tk = require('timekeeper')

View file

@ -4,7 +4,7 @@ const modulePath =
'../../../../app/src/Features/Authentication/SessionManager.js' '../../../../app/src/Features/Authentication/SessionManager.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const tk = require('timekeeper') const tk = require('timekeeper')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('SessionManager', function () { describe('SessionManager', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -6,7 +6,7 @@ const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const PrivilegeLevels = require('../../../../app/src/Features/Authorization/PrivilegeLevels') const PrivilegeLevels = require('../../../../app/src/Features/Authorization/PrivilegeLevels')
const PublicAccessLevels = require('../../../../app/src/Features/Authorization/PublicAccessLevels') const PublicAccessLevels = require('../../../../app/src/Features/Authorization/PublicAccessLevels')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('AuthorizationManager', function () { describe('AuthorizationManager', function () {
beforeEach(function () { beforeEach(function () {
@ -48,7 +48,7 @@ describe('AuthorizationManager', function () {
this.AuthorizationManager = SandboxedModule.require(modulePath, { this.AuthorizationManager = SandboxedModule.require(modulePath, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter, '../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter,
'../Collaborators/CollaboratorsHandler': this.CollaboratorsHandler, '../Collaborators/CollaboratorsHandler': this.CollaboratorsHandler,
'../Project/ProjectGetter': this.ProjectGetter, '../Project/ProjectGetter': this.ProjectGetter,

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const MODULE_PATH = const MODULE_PATH =
@ -39,6 +39,7 @@ describe('AuthorizationMiddleware', function () {
requires: { requires: {
'./AuthorizationManager': this.AuthorizationManager, './AuthorizationManager': this.AuthorizationManager,
'../Errors/HttpErrorHandler': this.HttpErrorHandler, '../Errors/HttpErrorHandler': this.HttpErrorHandler,
'mongodb-legacy': { ObjectId },
'../Authentication/AuthenticationController': '../Authentication/AuthenticationController':
this.AuthenticationController, this.AuthenticationController,
'../Authentication/SessionManager': this.SessionManager, '../Authentication/SessionManager': this.SessionManager,

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
@ -79,7 +79,7 @@ describe('CollaboratorsController', function () {
this.CollaboratorsController = SandboxedModule.require(MODULE_PATH, { this.CollaboratorsController = SandboxedModule.require(MODULE_PATH, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'./CollaboratorsHandler': this.CollaboratorsHandler, './CollaboratorsHandler': this.CollaboratorsHandler,
'./CollaboratorsGetter': this.CollaboratorsGetter, './CollaboratorsGetter': this.CollaboratorsGetter,
'./OwnershipTransferHandler': this.OwnershipTransferHandler, './OwnershipTransferHandler': this.OwnershipTransferHandler,

View file

@ -2,7 +2,7 @@ const Path = require('path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
@ -53,7 +53,7 @@ describe('CollaboratorsGetter', function () {
} }
this.CollaboratorsGetter = SandboxedModule.require(MODULE_PATH, { this.CollaboratorsGetter = SandboxedModule.require(MODULE_PATH, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'../User/UserGetter': this.UserGetter, '../User/UserGetter': this.UserGetter,
'../../models/Project': { Project }, '../../models/Project': { Project },
'../Project/ProjectGetter': this.ProjectGetter, '../Project/ProjectGetter': this.ProjectGetter,

View file

@ -5,7 +5,7 @@ const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = path.join( const MODULE_PATH = path.join(
__dirname, __dirname,

View file

@ -3,7 +3,7 @@ const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const _ = require('lodash') const _ = require('lodash')

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Crypto = require('crypto') const Crypto = require('crypto')
const MODULE_PATH = const MODULE_PATH =

View file

@ -3,7 +3,7 @@ const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const PrivilegeLevels = require('../../../../app/src/Features/Authorization/PrivilegeLevels') const PrivilegeLevels = require('../../../../app/src/Features/Authorization/PrivilegeLevels')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = const MODULE_PATH =
'../../../../app/src/Features/Collaborators/OwnershipTransferHandler' '../../../../app/src/Features/Collaborators/OwnershipTransferHandler'

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const path = require('path') const path = require('path')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const modulePath = path.join( const modulePath = path.join(
__dirname, __dirname,
'../../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler' '../../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler'

View file

@ -21,7 +21,7 @@ const modulePath = require('path').join(
) )
const MockClient = require('../helpers/MockClient') const MockClient = require('../helpers/MockClient')
const assert = require('assert') const assert = require('assert')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('EditorController', function () { describe('EditorController', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -2,7 +2,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')

View file

@ -1,7 +1,7 @@
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = '../../../../app/src/Features/History/HistoryManager' const MODULE_PATH = '../../../../app/src/Features/History/HistoryManager'

View file

@ -5,7 +5,7 @@ const modulePath = path.join(
__dirname, __dirname,
'../../../../app/src/Features/InactiveData/InactiveProjectManager' '../../../../app/src/Features/InactiveData/InactiveProjectManager'
) )
const { ObjectId, ReadPreference } = require('mongodb') const { ObjectId, ReadPreference } = require('mongodb-legacy')
const { expect } = require('chai') const { expect } = require('chai')
describe('InactiveProjectManager', function () { describe('InactiveProjectManager', function () {
@ -26,7 +26,7 @@ describe('InactiveProjectManager', function () {
this.ProjectGetter = { promises: { getProject: sinon.stub() } } this.ProjectGetter = { promises: { getProject: sinon.stub() } }
this.InactiveProjectManager = SandboxedModule.require(modulePath, { this.InactiveProjectManager = SandboxedModule.require(modulePath, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'@overleaf/settings': this.settings, '@overleaf/settings': this.settings,
'../Docstore/DocstoreManager': this.DocstoreManager, '../Docstore/DocstoreManager': this.DocstoreManager,
'../Project/ProjectUpdateHandler': this.ProjectUpdateHandler, '../Project/ProjectUpdateHandler': this.ProjectUpdateHandler,

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const path = require('path') const path = require('path')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const modulePath = path.join( const modulePath = path.join(
__dirname, __dirname,
'../../../../app/src/Features/Institutions/InstitutionsManager' '../../../../app/src/Features/Institutions/InstitutionsManager'
@ -136,7 +136,7 @@ describe('InstitutionsManager', function () {
'../Subscription/SubscriptionLocator': this.SubscriptionLocator, '../Subscription/SubscriptionLocator': this.SubscriptionLocator,
'../../models/Institution': this.InstitutionModel, '../../models/Institution': this.InstitutionModel,
'../../models/Subscription': SubscriptionModel, '../../models/Subscription': SubscriptionModel,
mongodb: this.Mongo, 'mongodb-legacy': this.Mongo,
'@overleaf/settings': { '@overleaf/settings': {
features: { professional: { 'test-feature': true } }, features: { professional: { 'test-feature': true } },
}, },

View file

@ -1,6 +1,6 @@
const { expect } = require('chai') const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const sinon = require('sinon') const sinon = require('sinon')
const MODULE_PATH = const MODULE_PATH =
@ -8,7 +8,9 @@ const MODULE_PATH =
describe('FolderStructureBuilder', function () { describe('FolderStructureBuilder', function () {
beforeEach(function () { beforeEach(function () {
this.FolderStructureBuilder = SandboxedModule.require(MODULE_PATH, {}) this.FolderStructureBuilder = SandboxedModule.require(MODULE_PATH, {
requires: { 'mongodb-legacy': { ObjectId } },
})
}) })
describe('buildFolderStructure', function () { describe('buildFolderStructure', function () {

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Path = require('path') const Path = require('path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai') const { expect } = require('chai')
@ -19,7 +19,7 @@ describe('ProjectCollabratecDetailsHandler', function () {
modulePath, modulePath,
{ {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'../../models/Project': { Project: this.ProjectModel }, '../../models/Project': { Project: this.ProjectModel },
}, },
} }

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const path = require('path') const path = require('path')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = path.join( const MODULE_PATH = path.join(
__dirname, __dirname,
@ -203,7 +203,7 @@ describe('ProjectController', function () {
this.ProjectController = SandboxedModule.require(MODULE_PATH, { this.ProjectController = SandboxedModule.require(MODULE_PATH, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'@overleaf/settings': this.settings, '@overleaf/settings': this.settings,
'@overleaf/metrics': this.Metrics, '@overleaf/metrics': this.Metrics,
'../SplitTests/SplitTestHandler': this.SplitTestHandler, '../SplitTests/SplitTestHandler': this.SplitTestHandler,

View file

@ -6,7 +6,7 @@ const tk = require('timekeeper')
const moment = require('moment') const moment = require('moment')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
const { DeletedProject } = require('../helpers/models/DeletedProject') const { DeletedProject } = require('../helpers/models/DeletedProject')
const { ObjectId, ReadPreference } = require('mongodb') const { ObjectId, ReadPreference } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
describe('ProjectDeleter', function () { describe('ProjectDeleter', function () {

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const ProjectHelper = require('../../../../app/src/Features/Project/ProjectHelper') const ProjectHelper = require('../../../../app/src/Features/Project/ProjectHelper')

View file

@ -1,7 +1,7 @@
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = '../../../../app/src/Features/Project/ProjectDuplicator.js' const MODULE_PATH = '../../../../app/src/Features/Project/ProjectDuplicator.js'

View file

@ -2,7 +2,7 @@ const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const tk = require('timekeeper') const tk = require('timekeeper')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { DeletedFile } = require('../helpers/models/DeletedFile') const { DeletedFile } = require('../helpers/models/DeletedFile')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
@ -191,7 +191,7 @@ describe('ProjectEntityMongoUpdateHandler', function () {
this.subject = SandboxedModule.require(MODULE_PATH, { this.subject = SandboxedModule.require(MODULE_PATH, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'@overleaf/settings': this.Settings, '@overleaf/settings': this.Settings,
'../Cooldown/CooldownManager': this.CooldownManager, '../Cooldown/CooldownManager': this.CooldownManager,
'../../models/Folder': { Folder: this.FolderModel }, '../../models/Folder': { Folder: this.FolderModel },

View file

@ -2,7 +2,7 @@ const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = const MODULE_PATH =
'../../../../app/src/Features/Project/ProjectEntityUpdateHandler' '../../../../app/src/Features/Project/ProjectEntityUpdateHandler'

View file

@ -2,7 +2,7 @@ const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const modulePath = '../../../../app/src/Features/Project/ProjectGetter.js' const modulePath = '../../../../app/src/Features/Project/ProjectGetter.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('ProjectGetter', function () { describe('ProjectGetter', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -1,6 +1,6 @@
const { expect } = require('chai') const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = '../../../../app/src/Features/Project/ProjectHelper.js' const MODULE_PATH = '../../../../app/src/Features/Project/ProjectHelper.js'
@ -37,7 +37,7 @@ describe('ProjectHelper', function () {
this.ProjectHelper = SandboxedModule.require(MODULE_PATH, { this.ProjectHelper = SandboxedModule.require(MODULE_PATH, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'@overleaf/settings': this.Settings, '@overleaf/settings': this.Settings,
}, },
}) })

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const path = require('path') const path = require('path')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const MODULE_PATH = path.join( const MODULE_PATH = path.join(
@ -141,7 +141,7 @@ describe('ProjectListController', function () {
this.ProjectListController = SandboxedModule.require(MODULE_PATH, { this.ProjectListController = SandboxedModule.require(MODULE_PATH, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'@overleaf/settings': this.settings, '@overleaf/settings': this.settings,
'@overleaf/metrics': this.Metrics, '@overleaf/metrics': this.Metrics,
'../SplitTests/SplitTestHandler': this.SplitTestHandler, '../SplitTests/SplitTestHandler': this.SplitTestHandler,

View file

@ -17,7 +17,7 @@ const { expect } = require('chai')
const modulePath = const modulePath =
'../../../../app/src/Features/Project/ProjectOptionsHandler.js' '../../../../app/src/Features/Project/ProjectOptionsHandler.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('ProjectOptionsHandler', function () { describe('ProjectOptionsHandler', function () {
const projectId = '4eecaffcbffa66588e000008' const projectId = '4eecaffcbffa66588e000008'

View file

@ -12,7 +12,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = const modulePath =
'../../../../app/src/Features/Project/ProjectRootDocManager.js' '../../../../app/src/Features/Project/ProjectRootDocManager.js'

View file

@ -1,7 +1,7 @@
const Path = require('path') const Path = require('path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { assert, expect } = require('chai') const { assert, expect } = require('chai')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')

View file

@ -2,6 +2,7 @@ const Path = require('path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = Path.join( const MODULE_PATH = Path.join(
__dirname, __dirname,
@ -59,6 +60,7 @@ describe('SplitTestSessionHandler', function () {
'./SplitTestCache': this.SplitTestCache, './SplitTestCache': this.SplitTestCache,
'./SplitTestUserGetter': this.SplitTestUserGetter, './SplitTestUserGetter': this.SplitTestUserGetter,
'@overleaf/metrics': this.Metrics, '@overleaf/metrics': this.Metrics,
'mongodb-legacy': { ObjectId },
}, },
}) })
}) })

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = '../../../../app/src/Features/Subscription/FeaturesUpdater' const MODULE_PATH = '../../../../app/src/Features/Subscription/FeaturesUpdater'

View file

@ -1,4 +1,5 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb-legacy')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = const modulePath =
'../../../../app/src/Features/Subscription/RecurlyEventHandler' '../../../../app/src/Features/Subscription/RecurlyEventHandler'
@ -27,6 +28,7 @@ describe('RecurlyEventHandler', function () {
this.RecurlyEventHandler = SandboxedModule.require(modulePath, { this.RecurlyEventHandler = SandboxedModule.require(modulePath, {
requires: { requires: {
'mongodb-legacy': { ObjectId },
'./SubscriptionEmailHandler': (this.SubscriptionEmailHandler = { './SubscriptionEmailHandler': (this.SubscriptionEmailHandler = {
sendTrialOnboardingEmail: sinon.stub(), sendTrialOnboardingEmail: sinon.stub(),
}), }),

View file

@ -3,7 +3,7 @@ const sinon = require('sinon')
const modulePath = const modulePath =
'../../../../app/src/Features/Subscription/SubscriptionUpdater' '../../../../app/src/Features/Subscription/SubscriptionUpdater'
const { assert, expect } = require('chai') const { assert, expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('SubscriptionUpdater', function () { describe('SubscriptionUpdater', function () {
beforeEach(function () { beforeEach(function () {

View file

@ -4,7 +4,7 @@ const { expect } = require('chai')
const modulePath = const modulePath =
'../../../../app/src/Features/Subscription/TeamInvitesHandler' '../../../../app/src/Features/Subscription/TeamInvitesHandler'
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
describe('TeamInvitesHandler', function () { describe('TeamInvitesHandler', function () {
@ -111,7 +111,7 @@ describe('TeamInvitesHandler', function () {
this.TeamInvitesHandler = SandboxedModule.require(modulePath, { this.TeamInvitesHandler = SandboxedModule.require(modulePath, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
crypto: this.crypto, crypto: this.crypto,
'@overleaf/settings': { siteUrl: 'http://example.com' }, '@overleaf/settings': { siteUrl: 'http://example.com' },
'../../models/TeamInvite': { TeamInvite: (this.TeamInvite = {}) }, '../../models/TeamInvite': { TeamInvite: (this.TeamInvite = {}) },

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const { Tag } = require('../helpers/models/Tag') const { Tag } = require('../helpers/models/Tag')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const modulePath = require('path').join( const modulePath = require('path').join(
__dirname, __dirname,
'../../../../app/src/Features/Tags/TagsHandler.js' '../../../../app/src/Features/Tags/TagsHandler.js'

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { expect } = require('chai') const { expect } = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')

View file

@ -1,7 +1,7 @@
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
const MODULE_PATH = const MODULE_PATH =

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const MODULE_PATH = const MODULE_PATH =

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const path = require('path') const path = require('path')
const sinon = require('sinon') const sinon = require('sinon')
@ -72,7 +72,7 @@ describe('TpdsUpdateSender', function () {
} }
this.TpdsUpdateSender = SandboxedModule.require(modulePath, { this.TpdsUpdateSender = SandboxedModule.require(modulePath, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'@overleaf/settings': this.settings, '@overleaf/settings': this.settings,
'@overleaf/fetch-utils': this.FetchUtils, '@overleaf/fetch-utils': this.FetchUtils,
'../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter, '../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter,

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { Writable } = require('stream') const { Writable } = require('stream')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MODULE_PATH = const MODULE_PATH =
'../../../../app/src/Features/ThirdPartyDataStore/UpdateMerger.js' '../../../../app/src/Features/ThirdPartyDataStore/UpdateMerger.js'

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
const PrivilegeLevels = require('../../../../app/src/Features/Authorization/PrivilegeLevels') const PrivilegeLevels = require('../../../../app/src/Features/Authorization/PrivilegeLevels')

View file

@ -6,7 +6,7 @@ const modulePath = path.join(
'../../../../app/src/Features/TokenAccess/TokenAccessHandler' '../../../../app/src/Features/TokenAccess/TokenAccessHandler'
) )
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongodb') const { ObjectId } = require('mongodb-legacy')
describe('TokenAccessHandler', function () { describe('TokenAccessHandler', function () {
beforeEach(function () { beforeEach(function () {
@ -21,7 +21,7 @@ describe('TokenAccessHandler', function () {
this.req = {} this.req = {}
this.TokenAccessHandler = SandboxedModule.require(modulePath, { this.TokenAccessHandler = SandboxedModule.require(modulePath, {
requires: { requires: {
mongodb: { ObjectId }, 'mongodb-legacy': { ObjectId },
'../../models/Project': { Project: (this.Project = {}) }, '../../models/Project': { Project: (this.Project = {}) },
'@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }), '@overleaf/metrics': (this.Metrics = { inc: sinon.stub() }),
'@overleaf/settings': (this.settings = {}), '@overleaf/settings': (this.settings = {}),

Some files were not shown because too many files have changed in this diff Show more