[misc] update the bson package

This commit is contained in:
Jakob Ackermann 2020-09-10 14:23:04 +01:00
parent 0bfe84db47
commit c42561c38a
6 changed files with 11 additions and 19 deletions

View file

@ -16,7 +16,9 @@
let PackManager let PackManager
const async = require('async') const async = require('async')
const _ = require('underscore') const _ = require('underscore')
const { db, ObjectId, BSON } = require('./mongojs') const Bson = require('bson')
const BSON = new Bson()
const { db, ObjectId } = require('./mongojs')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const LockManager = require('./LockManager') const LockManager = require('./LockManager')
const MongoAWS = require('./MongoAWS') const MongoAWS = require('./MongoAWS')

View file

@ -18,7 +18,7 @@ let project_id, doc_id
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const async = require('async') const async = require('async')
const _ = require('underscore') const _ = require('underscore')
const { db, ObjectId, BSON } = require('./mongojs') const { db, ObjectId } = require('./mongojs')
const fs = require('fs') const fs = require('fs')
const Metrics = require('metrics-sharelatex') const Metrics = require('metrics-sharelatex')
Metrics.initialize('track-changes') Metrics.initialize('track-changes')

View file

@ -2,7 +2,6 @@
// Sanity-check the conversion and remove this comment. // Sanity-check the conversion and remove this comment.
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const mongojs = require('mongojs') const mongojs = require('mongojs')
const bson = require('bson')
const db = mongojs(Settings.mongo.url, [ const db = mongojs(Settings.mongo.url, [
'docHistory', 'docHistory',
'projectHistoryMetaData', 'projectHistoryMetaData',
@ -10,6 +9,5 @@ const db = mongojs(Settings.mongo.url, [
]) ])
module.exports = { module.exports = {
db, db,
ObjectId: mongojs.ObjectId, ObjectId: mongojs.ObjectId
BSON: new bson.BSONPure()
} }

View file

@ -1572,9 +1572,9 @@
"dev": true "dev": true
}, },
"bson": { "bson": {
"version": "0.4.23", "version": "1.1.5",
"resolved": "https://registry.npmjs.org/bson/-/bson-0.4.23.tgz", "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.5.tgz",
"integrity": "sha512-xMUimhLm6y4t9BTW6BQGRHs9PODB9082EUX/Gkx6M9T2ktuJ5LvMxY/20ukuk0Uc+WPL37pbMIy731XF7eTxjg==" "integrity": "sha512-kDuEzldR21lHciPQAIulLs1LZlCXdLziXI6Mb/TDkwXhb//UORJNPXgcRs2CuO4H0DcMkpfT3/ySsP3unoZjBg=="
}, },
"buffer": { "buffer": {
"version": "4.9.1", "version": "4.9.1",
@ -4727,13 +4727,6 @@
"require_optional": "^1.0.1", "require_optional": "^1.0.1",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"saslprep": "^1.0.0" "saslprep": "^1.0.0"
},
"dependencies": {
"bson": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.3.tgz",
"integrity": "sha512-TdiJxMVnodVS7r0BdL42y/pqC9cL2iKynVwA0Ho3qbsQYr428veL3l7BQyuqiw+Q5SqqoT0m4srSY/BlZ9AxXg=="
}
} }
}, },
"mongojs": { "mongojs": {

View file

@ -22,7 +22,7 @@
"async": "^2.6.3", "async": "^2.6.3",
"aws-sdk": "^2.643.0", "aws-sdk": "^2.643.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bson": "^0.4.20", "bson": "^1.1.5",
"byline": "^5.0.0", "byline": "^5.0.0",
"express": "4.17.1", "express": "4.17.1",
"heap": "^0.2.6", "heap": "^0.2.6",

View file

@ -18,8 +18,6 @@ const { expect } = chai
const modulePath = '../../../../app/js/PackManager.js' const modulePath = '../../../../app/js/PackManager.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongojs')
const bson = require('bson')
const BSON = new bson.BSONPure()
const _ = require('underscore') const _ = require('underscore')
const tk = require('timekeeper') const tk = require('timekeeper')
@ -29,7 +27,8 @@ describe('PackManager', function () {
tk.freeze(new Date()) tk.freeze(new Date())
this.PackManager = SandboxedModule.require(modulePath, { this.PackManager = SandboxedModule.require(modulePath, {
requires: { requires: {
'./mongojs': { db: (this.db = {}), ObjectId, BSON }, bson: require('bson'),
'./mongojs': { db: (this.db = {}), ObjectId },
'./LockManager': {}, './LockManager': {},
'./MongoAWS': {}, './MongoAWS': {},
'logger-sharelatex': { log: sinon.stub(), error: sinon.stub() }, 'logger-sharelatex': { log: sinon.stub(), error: sinon.stub() },