Răsfoiți Sursa

Merge pull request #79 from overleaf/msm-update-dependencies

Update dependencies
Miguel Serrano 6 ani în urmă
părinte
comite
54b51fec83

+ 0 - 1
services/track-changes/.eslintrc

@@ -1,7 +1,6 @@
 // this file was auto-generated, do not edit it directly.
 // instead run bin/update_build_scripts from
 // https://github.com/sharelatex/sharelatex-dev-environment
-// Version: 1.3.5
 {
   "extends": [
     "standard",

+ 0 - 1
services/track-changes/.prettierrc

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 {
   "semi": false,
   "singleQuote": true

+ 0 - 1
services/track-changes/Dockerfile

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 FROM node:10.19.0 as base
 

+ 0 - 1
services/track-changes/Makefile

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 BUILD_NUMBER ?= local
 BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)

+ 4 - 0
services/track-changes/app.js

@@ -46,8 +46,12 @@ const child_process = require('child_process')
 
 const HttpController = require('./app/js/HttpController')
 const express = require('express')
+const bodyParser = require('body-parser');
+
 const app = express()
 
+app.use(bodyParser.json())
+
 app.use(Metrics.http.monitor(logger))
 
 Metrics.injectMetricsRoute(app)

+ 10 - 10
services/track-changes/app/js/HttpController.js

@@ -36,7 +36,7 @@ module.exports = HttpController = {
         if (error != null) {
           return next(error)
         }
-        return res.send(204)
+        return res.sendStatus(204)
       }
     )
   },
@@ -53,7 +53,7 @@ module.exports = HttpController = {
         if (error != null) {
           return next(error)
         }
-        return res.send(204)
+        return res.sendStatus(204)
       }
     )
   },
@@ -134,7 +134,7 @@ module.exports = HttpController = {
       if (broken.length > 0) {
         return res.send(broken)
       } else {
-        return res.send(204)
+        return res.sendStatus(204)
       }
     })
   },
@@ -215,7 +215,7 @@ module.exports = HttpController = {
         if (error != null) {
           return next(error)
         }
-        return res.send(204)
+        return res.sendStatus(204)
       }
     )
   },
@@ -231,7 +231,7 @@ module.exports = HttpController = {
       if (error != null) {
         return next(error)
       }
-      return res.send(204)
+      return res.sendStatus(204)
     })
   },
 
@@ -246,7 +246,7 @@ module.exports = HttpController = {
       if (error != null) {
         return next(error)
       }
-      return res.send(204)
+      return res.sendStatus(204)
     })
   },
 
@@ -254,9 +254,9 @@ module.exports = HttpController = {
     return HealthChecker.check(function(err) {
       if (err != null) {
         logger.err({ err }, 'error performing health check')
-        return res.send(500)
+        return res.sendStatus(500)
       } else {
-        return res.send(200)
+        return res.sendStatus(200)
       }
     })
   },
@@ -265,9 +265,9 @@ module.exports = HttpController = {
     return HealthChecker.checkLock(function(err) {
       if (err != null) {
         logger.err({ err }, 'error performing lock check')
-        return res.send(500)
+        return res.sendStatus(500)
       } else {
-        return res.send(200)
+        return res.sendStatus(200)
       }
     })
   }

+ 5 - 5
services/track-changes/buildscript.txt

@@ -1,10 +1,10 @@
 track-changes
---public-repo=True
---language=es
---env-add=AWS_BUCKET=bucket
---node-version=10.19.0
 --acceptance-creds=None
 --dependencies=mongo,redis,s3
 --docker-repos=gcr.io/overleaf-ops
+--env-add=AWS_BUCKET=bucket
 --env-pass-through=
---script-version=1.3.5
+--language=es
+--node-version=10.19.0
+--public-repo=True
+--script-version=2.0.0

+ 0 - 1
services/track-changes/docker-compose.ci.yml

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 version: "2.3"
 

+ 0 - 1
services/track-changes/docker-compose.yml

@@ -1,7 +1,6 @@
 # This file was auto-generated, do not edit it directly.
 # Instead run bin/update_build_scripts from
 # https://github.com/sharelatex/sharelatex-dev-environment
-# Version: 1.3.5
 
 version: "2.3"
 

Fișier diff suprimat deoarece este prea mare
+ 678 - 111
services/track-changes/package-lock.json


+ 28 - 27
services/track-changes/package.json

@@ -14,56 +14,57 @@
     "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
     "nodemon": "nodemon --config nodemon.json",
     "lint": "node_modules/.bin/eslint .",
-    "format": "node_modules/.bin/prettier-eslint '**/*.js' --list-different",
-    "format:fix": "node_modules/.bin/prettier-eslint '**/*.js' --write"
+    "format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
+    "format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
   },
   "dependencies": {
-    "JSONStream": "^1.0.4",
-    "async": "~0.2.10",
-    "aws-sdk": "^2.102.0",
+    "JSONStream": "^1.3.5",
+    "async": "^2.6.3",
+    "aws-sdk": "^2.643.0",
+    "body-parser": "^1.19.0",
     "bson": "^0.4.20",
-    "byline": "^4.2.1",
-    "cli": "^0.6.6",
-    "express": "3.3.5",
+    "byline": "^5.0.0",
+    "express": "4.17.1",
     "heap": "^0.2.6",
-    "line-reader": "^0.2.4",
-    "logger-sharelatex": "^1.7.0",
-    "metrics-sharelatex": "^2.2.0",
+    "line-reader": "^0.4.0",
+    "logger-sharelatex": "^1.9.0",
+    "metrics-sharelatex": "^2.6.1",
     "mongo-uri": "^0.1.2",
-    "mongojs": "2.4.0",
+    "mongojs": "3.1.0",
     "redis": "~0.10.1",
-    "redis-sharelatex": "^1.0.8",
+    "redis-sharelatex": "^1.0.11",
     "request": "~2.88.2",
     "requestretry": "^4.1.0",
-    "s3-streams": "^0.3.0",
+    "s3-streams": "^0.4.0",
     "settings-sharelatex": "^1.1.0",
-    "underscore": "~1.7.0"
+    "underscore": "~1.9.2"
   },
   "devDependencies": {
-    "babel-eslint": "^10.0.3",
+    "babel-eslint": "^10.1.0",
     "bunyan": "~2.0.2",
-    "chai": "~4.1.1",
-    "eslint": "^6.6.0",
-    "eslint-config-prettier": "^6.10.0",
-    "eslint-config-standard": "^14.1.0",
+    "chai": "~4.2.0",
+    "cli": "^1.0.1",
+    "eslint": "^6.8.0",
+    "eslint-config-prettier": "^6.10.1",
+    "eslint-config-standard": "^14.1.1",
     "eslint-config-standard-jsx": "^8.1.0",
     "eslint-config-standard-react": "^9.2.0",
     "eslint-plugin-chai-expect": "^2.1.0",
     "eslint-plugin-chai-friendly": "^0.5.0",
     "eslint-plugin-import": "^2.20.1",
     "eslint-plugin-jsx-a11y": "^6.2.3",
-    "eslint-plugin-mocha": "^6.2.2",
+    "eslint-plugin-mocha": "^6.3.0",
     "eslint-plugin-node": "^11.0.0",
     "eslint-plugin-prettier": "^3.1.2",
     "eslint-plugin-promise": "^4.2.1",
-    "eslint-plugin-react": "^7.18.3",
+    "eslint-plugin-react": "^7.19.0",
     "eslint-plugin-standard": "^4.0.1",
     "memorystream": "0.3.1",
-    "mocha": "^4.0.1",
-    "prettier": "^1.19.1",
+    "mocha": "^7.1.1",
+    "prettier": "^2.0.1",
     "prettier-eslint-cli": "^5.0.0",
-    "sandboxed-module": "~0.3.0",
-    "sinon": "~3.2.1",
-    "timekeeper": "0.0.4"
+    "sandboxed-module": "~2.0.3",
+    "sinon": "~9.0.1",
+    "timekeeper": "2.2.0"
   }
 }

+ 2 - 2
services/track-changes/test/acceptance/js/helpers/MockDocStoreApi.js

@@ -28,10 +28,10 @@ module.exports = MockDocUpdaterApi = {
     app.get('/project/:project_id/doc', (req, res, next) => {
       return this.getAllDoc(req.params.project_id, (error, docs) => {
         if (error != null) {
-          res.send(500)
+          res.sendStatus(500)
         }
         if (docs == null) {
-          return res.send(404)
+          return res.sendStatus(404)
         } else {
           return res.send(JSON.stringify(docs))
         }

+ 6 - 5
services/track-changes/test/acceptance/js/helpers/MockDocUpdaterApi.js

@@ -13,7 +13,9 @@
  */
 let MockDocUpdaterApi
 const express = require('express')
+const bodyParser = require('body-parser')
 const app = express()
+app.use(bodyParser.json())
 
 module.exports = MockDocUpdaterApi = {
   docs: {},
@@ -43,10 +45,10 @@ module.exports = MockDocUpdaterApi = {
         req.params.doc_id,
         (error, doc) => {
           if (error != null) {
-            res.send(500)
+            res.sendStatus(500)
           }
           if (doc == null) {
-            return res.send(404)
+            return res.sendStatus(404)
           } else {
             return res.send(JSON.stringify(doc))
           }
@@ -56,7 +58,6 @@ module.exports = MockDocUpdaterApi = {
 
     app.post(
       '/project/:project_id/doc/:doc_id',
-      express.bodyParser(),
       (req, res, next) => {
         return this.setDoc(
           req.params.project_id,
@@ -66,9 +67,9 @@ module.exports = MockDocUpdaterApi = {
           req.body.undoing,
           (errr, doc) => {
             if (typeof error !== 'undefined' && error !== null) {
-              return res.send(500)
+              return res.sendStatus(500)
             } else {
-              return res.send(204)
+              return res.sendStatus(204)
             }
           }
         )

+ 4 - 4
services/track-changes/test/acceptance/js/helpers/MockWebApi.js

@@ -37,10 +37,10 @@ module.exports = MockWebApi = {
     app.get('/user/:user_id/personal_info', (req, res, next) => {
       return this.getUserInfo(req.params.user_id, (error, user) => {
         if (error != null) {
-          res.send(500)
+          res.sendStatus(500)
         }
         if (user == null) {
-          return res.send(404)
+          return res.sendStatus(404)
         } else {
           return res.send(JSON.stringify(user))
         }
@@ -50,10 +50,10 @@ module.exports = MockWebApi = {
     app.get('/project/:project_id/details', (req, res, next) => {
       return this.getProjectDetails(req.params.project_id, (error, project) => {
         if (error != null) {
-          res.send(500)
+          res.sendStatus(500)
         }
         if (project == null) {
-          return res.send(404)
+          return res.sendStatus(404)
         } else {
           return res.send(JSON.stringify(project))
         }

+ 8 - 4
services/track-changes/test/unit/js/DiffManager/DiffManagerTests.js

@@ -181,7 +181,7 @@ describe('DiffManager', function() {
       })
     })
 
-    return describe('when the updates are inconsistent', function() {
+    describe('when the updates are inconsistent', function() {
       beforeEach(function() {
         this.DiffManager.getLatestDocAndUpdates = sinon
           .stub()
@@ -189,7 +189,9 @@ describe('DiffManager', function() {
         this.DiffGenerator.buildDiff = sinon
           .stub()
           .throws((this.error = new Error('inconsistent!')))
-        return this.DiffManager.getDiff(
+        this.DiffGenerator.rewindUpdates = sinon
+            .stub()
+        this.DiffManager.getDiff(
           this.project_id,
           this.doc_id,
           this.fromVersion,
@@ -198,8 +200,10 @@ describe('DiffManager', function() {
         )
       })
 
-      return it('should call the callback with an error', function() {
-        return this.callback.calledWith(this.error).should.equal(true)
+      it('should call the callback with an error', function() {
+        this.callback.calledWith(sinon.match(Error)).should.equal(true)
+        const errorObj = this.callback.args[0][0]
+        expect(errorObj.message).to.include('inconsistent!')
       })
     })
   })

+ 1 - 0
services/track-changes/test/unit/js/DocArchive/MongoAWS.js

@@ -21,6 +21,7 @@ const zlib = require('zlib')
 describe('MongoAWS', function() {
   beforeEach(function() {
     this.MongoAWS = SandboxedModule.require(modulePath, {
+      singleOnly: true,
       requires: {
         'settings-sharelatex': (this.settings = {
           trackchanges: {

+ 7 - 6
services/track-changes/test/unit/js/HttpController/HttpControllerTests.js

@@ -19,6 +19,7 @@ const SandboxedModule = require('sandboxed-module')
 describe('HttpController', function() {
   beforeEach(function() {
     this.HttpController = SandboxedModule.require(modulePath, {
+      singleOnly: true,
       requires: {
         'logger-sharelatex': { log: sinon.stub() },
         './UpdatesManager': (this.UpdatesManager = {}),
@@ -44,7 +45,7 @@ describe('HttpController', function() {
           project_id: this.project_id
         }
       }
-      this.res = { send: sinon.stub() }
+      this.res = { sendStatus: sinon.stub() }
       this.UpdatesManager.processUncompressedUpdatesWithLock = sinon
         .stub()
         .callsArg(2)
@@ -58,7 +59,7 @@ describe('HttpController', function() {
     })
 
     return it('should return a success code', function() {
-      return this.res.send.calledWith(204).should.equal(true)
+      return this.res.sendStatus.calledWith(204).should.equal(true)
     })
   })
 
@@ -69,7 +70,7 @@ describe('HttpController', function() {
           project_id: this.project_id
         }
       }
-      this.res = { send: sinon.stub() }
+      this.res = { sendStatus: sinon.stub() }
       this.UpdatesManager.processUncompressedUpdatesForProject = sinon
         .stub()
         .callsArg(1)
@@ -83,7 +84,7 @@ describe('HttpController', function() {
     })
 
     return it('should return a success code', function() {
-      return this.res.send.calledWith(204).should.equal(true)
+      return this.res.sendStatus.calledWith(204).should.equal(true)
     })
   })
 
@@ -177,7 +178,7 @@ describe('HttpController', function() {
           'x-user-id': this.user_id
         }
       }
-      this.res = { send: sinon.stub() }
+      this.res = { sendStatus: sinon.stub() }
 
       this.RestoreManager.restoreToBeforeVersion = sinon.stub().callsArg(4)
       return this.HttpController.restore(this.req, this.res, this.next)
@@ -195,7 +196,7 @@ describe('HttpController', function() {
     })
 
     return it('should return a success code', function() {
-      return this.res.send.calledWith(204).should.equal(true)
+      return this.res.sendStatus.calledWith(204).should.equal(true)
     })
   })
 })

+ 1 - 0
services/track-changes/test/unit/js/UpdatesManager/UpdatesManagerTests.js

@@ -23,6 +23,7 @@ const SandboxedModule = require('sandboxed-module')
 describe('UpdatesManager', function() {
   beforeEach(function() {
     this.UpdatesManager = SandboxedModule.require(modulePath, {
+      singleOnly: true,
       requires: {
         './UpdateCompressor': (this.UpdateCompressor = {}),
         './MongoManager': (this.MongoManager = {}),

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff