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",
"mmmagic": "^0.5.3",
"moment": "^2.29.4",
"mongodb": "5.9.2",
"mongodb-legacy": "5.0.0",
"mongoose": "^7.8.0",
"multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e",
"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": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz",
@ -53393,7 +53404,7 @@
"mocha-each": "^2.0.1",
"mock-fs": "^5.1.2",
"moment": "^2.29.4",
"mongodb": "5.9.2",
"mongodb-legacy": "5.0.0",
"mongoose": "^7.8.0",
"multer": "overleaf/multer#e1df247fbf8e7590520d20ae3601eaef9f3d2e9e",
"nocache": "^2.1.0",
@ -54199,6 +54210,14 @@
"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": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.8.0.tgz",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
const { Project } = require('../../models/Project')
const PublicAccessLevels = require('../Authorization/PublicAccessLevels')
const PrivilegeLevels = require('../Authorization/PrivilegeLevels')
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const Metrics = require('@overleaf/metrics')
const Settings = require('@overleaf/settings')
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 Errors = require('../Errors/Errors')
const InstitutionsAPI = require('../Institutions/InstitutionsAPI')

View file

@ -1,6 +1,6 @@
const UserGetter = require('./UserGetter')
const SessionManager = require('../Authentication/SessionManager')
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
function getLoggedInUsersPersonalInfo(req, res, next) {
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 EntityModels = {
Institution: require('../../models/Institution').Institution,

View file

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

View file

@ -1,4 +1,4 @@
const mongodb = require('mongodb')
const mongodb = require('mongodb-legacy')
const OError = require('@overleaf/o-error')
const Settings = require('@overleaf/settings')
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 MIN_ID = process.env.MIN_ID

View file

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

View file

@ -1,5 +1,5 @@
const { expect } = require('chai')
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const Path = require('path')
const fs = require('fs')
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 { getMongoClient } = require('../../../app/src/infrastructure/Mongoose')

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
*/
const minimist = require('minimist')
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const { db, waitForDb } = require('../app/src/infrastructure/mongodb')
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 =
parseInt(process.env.MONGO_SOCKET_TIMEOUT, 10) || 600000
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const { promiseMapWithLimit } = require('@overleaf/promise-utils')
const { batchedUpdate } = require('./helpers/batchedUpdate')
const ChatApiHandler = require('../app/src/Features/Chat/ChatApiHandler')

View file

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

View file

@ -3,7 +3,7 @@ const SubscriptionUpdater = require('../app/src/Features/Subscription/Subscripti
const minimist = require('minimist')
const { waitForDb } = require('../app/src/infrastructure/mongodb')
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const run = async () => {
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
* script.
*/
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const { db, waitForDb } = require('../app/src/infrastructure/mongodb')
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 DocumentUpdaterHandler = require('../app/src/Features/DocumentUpdater/DocumentUpdaterHandler')

View file

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

View file

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

View file

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

View file

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

View file

@ -8,4 +8,4 @@ chai.use(require('chai-exclude'))
chai.config.truncateThreshold = 0
// 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 { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const Settings = require('@overleaf/settings')
const User = require('./helpers/User').promises

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const InstitutionModel =
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 { 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 MockRecurlyApiClass = require('../mocks/MockRecurlyApi')
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 fetch = require('node-fetch')
const { db } = require('../../../../app/src/infrastructure/mongodb')
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const {
UserAuditLogEntry,
} = require('../../../../app/src/models/UserAuditLogEntry')

View file

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

View file

@ -23,7 +23,7 @@ chai.config.truncateThreshold = 0
require('sinon-mongoose')
// 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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@ const tk = require('timekeeper')
const moment = require('moment')
const { Project } = require('../helpers/models/Project')
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')
describe('ProjectDeleter', function () {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ const SandboxedModule = require('sandboxed-module')
const { expect } = require('chai')
const sinon = require('sinon')
const { Tag } = require('../helpers/models/Tag')
const { ObjectId } = require('mongodb')
const { ObjectId } = require('mongodb-legacy')
const modulePath = require('path').join(
__dirname,
'../../../../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 SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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