Преглед изворни кода

Merge pull request #5214 from overleaf/bg-migrate-node-uuid-to-uuid

migrate node-uuid to uuid

GitOrigin-RevId: 742fd4d3f039c6a026b3d35c3b0a7d54c00ca183
Brian Gough пре 4 година
родитељ
комит
9ee1e29286

Разлика између датотеке није приказан због своје велике величине
+ 324 - 236
libraries/object-persistor/package-lock.json


+ 3 - 3
libraries/object-persistor/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@overleaf/object-persistor",
-  "version": "1.0.2",
+  "version": "1.0.3",
   "description": "Module for storing objects in multiple backends, with fallback on 404 to assist migration between them",
   "main": "index.js",
   "scripts": {
@@ -24,9 +24,9 @@
     "fast-crc32c": "^2.0.0",
     "glob": "^7.1.6",
     "logger-sharelatex": "^2.1.1",
-    "node-uuid": "^1.4.8",
     "range-parser": "^1.2.1",
-    "tiny-async-pool": "^1.1.0"
+    "tiny-async-pool": "^1.1.0",
+    "uuid": "^8.3.2"
   },
   "devDependencies": {
     "chai": "^4.2.0",

+ 1 - 1
libraries/object-persistor/src/FSPersistor.js

@@ -1,6 +1,6 @@
 const fs = require('fs')
 const glob = require('glob')
-const uuid = require('node-uuid')
+const uuid = require('uuid')
 const path = require('path')
 const Stream = require('stream')
 const { promisify } = require('util')

+ 13 - 13
libraries/object-persistor/test/unit/FSPersistorTests.js

@@ -26,10 +26,10 @@ describe('FSPersistorTests', function () {
     readStream = {
       name: 'readStream',
       on: sinon.stub().yields(),
-      pipe: sinon.stub()
+      pipe: sinon.stub(),
     }
     uuid = {
-      v1: () => randomNumber
+      v1: () => randomNumber,
     }
     tempFile = `/tmp/${randomNumber}`
     fs = {
@@ -37,21 +37,21 @@ describe('FSPersistorTests', function () {
       createWriteStream: sinon.stub().returns(writeStream),
       unlink: sinon.stub().yields(),
       open: sinon.stub().yields(null, fd),
-      stat: sinon.stub().yields(null, stat)
+      stat: sinon.stub().yields(null, stat),
     }
     glob = sinon.stub().yields(null, globs)
     stream = {
       pipeline: sinon.stub().yields(),
-      Transform: StreamModule.Transform
+      Transform: StreamModule.Transform,
     }
     Hash = {
       end: sinon.stub(),
       read: sinon.stub().returns(md5),
       digest: sinon.stub().returns(md5),
-      setEncoding: sinon.stub()
+      setEncoding: sinon.stub(),
     }
     crypto = {
-      createHash: sinon.stub().returns(Hash)
+      createHash: sinon.stub().returns(Hash),
     }
     FSPersistor = new (SandboxedModule.require(modulePath, {
       requires: {
@@ -60,11 +60,11 @@ describe('FSPersistorTests', function () {
         glob,
         stream,
         crypto,
-        'node-uuid': uuid,
+        uuid: uuid,
         // imported by PersistorHelper but otherwise unused here
-        'logger-sharelatex': {}
+        'logger-sharelatex': {},
       },
-      globals: { console }
+      globals: { console },
     }))({ paths: { uploadFolder: '/tmp' } })
   })
 
@@ -114,7 +114,7 @@ describe('FSPersistorTests', function () {
       it('should return a write error', async function () {
         await expect(
           FSPersistor.sendStream(location, files[0], remoteStream, {
-            sourceMd5: '00000000'
+            sourceMd5: '00000000',
           })
         )
           .to.eventually.be.rejected.and.be.an.instanceOf(Errors.WriteError)
@@ -124,7 +124,7 @@ describe('FSPersistorTests', function () {
       it('deletes the copied file', async function () {
         try {
           await FSPersistor.sendStream(location, files[0], remoteStream, {
-            sourceMd5: '00000000'
+            sourceMd5: '00000000',
           })
         } catch (_) {}
         expect(fs.unlink).to.have.been.calledWith(
@@ -145,12 +145,12 @@ describe('FSPersistorTests', function () {
     it('should pass the options to createReadStream', async function () {
       await FSPersistor.getObjectStream(location, files[0], {
         start: 0,
-        end: 8
+        end: 8,
       })
       expect(fs.createReadStream).to.have.been.calledWith(null, {
         start: 0,
         end: 8,
-        fd
+        fd,
       })
     })
 

+ 1 - 1
services/filestore/app/js/LocalFileWriter.js

@@ -1,5 +1,5 @@
 const fs = require('fs')
-const uuid = require('node-uuid')
+const uuid = require('uuid')
 const path = require('path')
 const Stream = require('stream')
 const { callbackify, promisify } = require('util')

Разлика између датотеке није приказан због своје велике величине
+ 160 - 869
services/filestore/package-lock.json


+ 2 - 2
services/filestore/package.json

@@ -32,12 +32,12 @@
     "glob": "^7.1.6",
     "lodash.once": "^4.1.1",
     "logger-sharelatex": "^2.2.0",
-    "node-uuid": "~1.4.8",
     "range-parser": "^1.2.1",
     "request": "^2.88.2",
     "request-promise-native": "^1.0.8",
     "stream-buffers": "~0.2.6",
-    "tiny-async-pool": "^1.1.0"
+    "tiny-async-pool": "^1.1.0",
+    "uuid": "^8.3.2"
   },
   "devDependencies": {
     "@google-cloud/storage": "^5.1.2",

Неке датотеке нису приказане због велике количине промена