Przeglądaj źródła

Merge pull request #18289 from overleaf/ac-ar-eslint-return-await

Add ESLint rule @typescript-eslint/return-await to backend services

GitOrigin-RevId: 75e3e32597827fcc852e69d479515fc72e8f45e4
Andrew Rumble 2 lat temu
rodzic
commit
71187a51ba
43 zmienionych plików z 747 dodań i 211 usunięć
  1. 7 1
      libraries/access-token-encryptor/lib/js/AccessTokenEncryptor.js
  2. 1 1
      libraries/access-token-encryptor/scripts/helpers/re-encrypt-tokens.js
  3. 5 0
      libraries/fetch-utils/index.js
  4. 1 0
      libraries/fetch-utils/package.json
  5. 1 1
      libraries/object-persistor/src/GcsPersistor.js
  6. 28 13
      libraries/object-persistor/src/MigrationPersistor.js
  7. 2 2
      libraries/object-persistor/src/S3Persistor.js
  8. 2 2
      libraries/object-persistor/test/unit/MigrationPersistorTests.js
  9. 1 1
      libraries/overleaf-editor-core/lib/file_data/lazy_string_file_data.js
  10. 4 0
      libraries/overleaf-editor-core/lib/history.js
  11. 601 139
      package-lock.json
  12. 1 0
      package.json
  13. 6 1
      services/chat/app/js/Features/Messages/MessageHttpController.js
  14. 6 2
      services/chat/app/js/Features/Messages/MessageManager.js
  15. 2 2
      services/chat/app/js/Features/Threads/ThreadManager.js
  16. 14 14
      services/chat/test/acceptance/js/helpers/ChatClient.js
  17. 2 1
      services/chat/tsconfig.json
  18. 3 0
      services/clsi/app/js/ContentCacheManager.js
  19. 1 1
      services/clsi/app/js/OutputCacheManager.js
  20. 1 0
      services/clsi/package.json
  21. 2 1
      services/clsi/tsconfig.json
  22. 2 1
      services/contacts/tsconfig.json
  23. 1 1
      services/docstore/app/js/DocArchiveManager.js
  24. 12 0
      services/docstore/app/js/DocManager.js
  25. 2 2
      services/docstore/test/acceptance/js/helpers/DocstoreClient.js
  26. 2 1
      services/docstore/tsconfig.json
  27. 1 1
      services/document-updater/scripts/flush_all.js
  28. 4 1
      services/document-updater/tsconfig.json
  29. 3 3
      services/filestore/app/js/FileConverter.js
  30. 6 6
      services/filestore/app/js/FileHandler.js
  31. 1 1
      services/filestore/test/acceptance/js/FilestoreApp.js
  32. 1 1
      services/filestore/test/acceptance/js/FilestoreTests.js
  33. 1 1
      services/filestore/test/acceptance/js/TestHelper.js
  34. 2 1
      services/filestore/tsconfig.json
  35. 1 1
      services/history-v1/storage/lib/blob_store/index.js
  36. 1 1
      services/history-v1/storage/tasks/copy_project_blobs.js
  37. 1 1
      services/history-v1/test/acceptance/js/storage/tasks.test.js
  38. 6 1
      services/history-v1/tsconfig.json
  39. 2 1
      services/notifications/tsconfig.json
  40. 1 1
      services/project-history/app/js/LockManager.js
  41. 2 1
      services/project-history/tsconfig.json
  42. 2 1
      services/real-time/tsconfig.json
  43. 2 1
      services/spelling/tsconfig.json

+ 7 - 1
libraries/access-token-encryptor/lib/js/AccessTokenEncryptor.js

@@ -80,7 +80,13 @@ class AccessTokenSchemeWithGenericKeyFn extends AbstractAccessTokenScheme {
 class AccessTokenSchemeV3 extends AccessTokenSchemeWithGenericKeyFn {
   async keyFn(salt) {
     const optionalInfo = ''
-    return cryptoHkdf('sha512', this.cipherPassword, salt, optionalInfo, 32)
+    return await cryptoHkdf(
+      'sha512',
+      this.cipherPassword,
+      salt,
+      optionalInfo,
+      32
+    )
   }
 }
 

+ 1 - 1
libraries/access-token-encryptor/scripts/helpers/re-encrypt-tokens.js

@@ -10,7 +10,7 @@ const DRY_RUN = !process.argv.includes('--dry-run=false')
  * @return {Promise<string>}
  */
 async function reEncryptTokens(accessTokenEncryptor, encryptedJson) {
-  return new Promise((resolve, reject) => {
+  return await new Promise((resolve, reject) => {
     accessTokenEncryptor.decryptToJson(encryptedJson, (err, json) => {
       if (err) return reject(err)
       accessTokenEncryptor.encryptJson(json, (err, reEncryptedJson) => {

+ 5 - 0
libraries/fetch-utils/index.js

@@ -239,6 +239,11 @@ async function discardResponseBody(response) {
   }
 }
 
+/**
+ * @typedef {import('node-fetch').Response} Response
+ *
+ * @param {Response} response
+ */
 async function maybeGetResponseBody(response) {
   try {
     return await response.text()

+ 1 - 0
libraries/fetch-utils/package.json

@@ -16,6 +16,7 @@
   "author": "Overleaf (https://www.overleaf.com)",
   "license": "AGPL-3.0-only",
   "devDependencies": {
+    "@types/node-fetch": "^2.6.11",
     "body-parser": "^1.20.2",
     "chai": "^4.3.6",
     "chai-as-promised": "^7.1.1",

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

@@ -42,7 +42,7 @@ module.exports = class GcsPersistor extends AbstractPersistor {
   }
 
   async sendFile(bucketName, key, fsPath) {
-    return this.sendStream(bucketName, key, fs.createReadStream(fsPath))
+    return await this.sendStream(bucketName, key, fs.createReadStream(fsPath))
   }
 
   async sendStream(bucketName, key, readStream, opts = {}) {

+ 28 - 13
libraries/object-persistor/src/MigrationPersistor.js

@@ -17,55 +17,65 @@ const { NotFoundError, WriteError } = require('./Errors')
 // }
 
 module.exports = class MigrationPersistor extends AbstractPersistor {
+  /**
+   * @param {AbstractPersistor} primaryPersistor
+   * @param {AbstractPersistor} fallbackPersistor
+   * @param settings
+   */
   constructor(primaryPersistor, fallbackPersistor, settings) {
     super()
 
+    /**
+     * @type {AbstractPersistor}
+     */
     this.primaryPersistor = primaryPersistor
+    /**
+     * @type {AbstractPersistor}
+     */
     this.fallbackPersistor = fallbackPersistor
     this.settings = settings
   }
 
   async sendFile(...args) {
-    return this.primaryPersistor.sendFile(...args)
+    return await this.primaryPersistor.sendFile(...args)
   }
 
   async sendStream(...args) {
-    return this.primaryPersistor.sendStream(...args)
+    return await this.primaryPersistor.sendStream(...args)
   }
 
   async getRedirectUrl(...args) {
-    return this.primaryPersistor.getRedirectUrl(...args)
+    return await this.primaryPersistor.getRedirectUrl(...args)
   }
 
   async getObjectMd5Hash(...args) {
-    return this._runWithFallback('getObjectMd5Hash', ...args)
+    return await this._runWithFallback('getObjectMd5Hash', ...args)
   }
 
   async checkIfObjectExists(...args) {
-    return this._runWithFallback('checkIfObjectExists', ...args)
+    return await this._runWithFallback('checkIfObjectExists', ...args)
   }
 
   async getObjectSize(...args) {
-    return this._runWithFallback('getObjectSize', ...args)
+    return await this._runWithFallback('getObjectSize', ...args)
   }
 
   async directorySize(...args) {
-    return this._runWithFallback('directorySize', ...args)
+    return await this._runWithFallback('directorySize', ...args)
   }
 
   async deleteObject(...args) {
-    return this._runOnBoth('deleteObject', ...args)
+    return await this._runOnBoth('deleteObject', ...args)
   }
 
   async deleteDirectory(...args) {
-    return this._runOnBoth('deleteDirectory', ...args)
+    return await this._runOnBoth('deleteDirectory', ...args)
   }
 
   async getObjectStream(bucket, key, opts = {}) {
     const shouldCopy = this.settings.copyOnMiss && !opts.start && !opts.end
 
     try {
-      // 'return await' so we catch NotFoundError before returning
       return await this.primaryPersistor.getObjectStream(bucket, key, opts)
     } catch (err) {
       if (err instanceof NotFoundError) {
@@ -140,7 +150,7 @@ module.exports = class MigrationPersistor extends AbstractPersistor {
           })
         }
         // copy from sourceKey -> destKey
-        return this._copyStreamFromFallbackAndVerify(
+        return await this._copyStreamFromFallbackAndVerify(
           copyStream,
           fallbackBucket,
           bucket,
@@ -217,9 +227,14 @@ module.exports = class MigrationPersistor extends AbstractPersistor {
     ])
   }
 
+  /**
+   * @param {keyof AbstractPersistor} methodName
+   * @param bucket
+   * @param key
+   * @param moreArgs
+   */
   async _runWithFallback(methodName, bucket, key, ...moreArgs) {
     try {
-      // 'return await' so we catch NotFoundError before returning
       return await this.primaryPersistor[methodName](bucket, key, ...moreArgs)
     } catch (err) {
       if (err instanceof NotFoundError) {
@@ -241,7 +256,7 @@ module.exports = class MigrationPersistor extends AbstractPersistor {
             Logger.warn({ err }, 'failed to copy file from fallback')
           })
         }
-        return this.fallbackPersistor[methodName](
+        return await this.fallbackPersistor[methodName](
           fallbackBucket,
           key,
           ...moreArgs

+ 2 - 2
libraries/object-persistor/src/S3Persistor.js

@@ -24,7 +24,7 @@ module.exports = class S3Persistor extends AbstractPersistor {
   }
 
   async sendFile(bucketName, key, fsPath) {
-    return this.sendStream(bucketName, key, fs.createReadStream(fsPath))
+    return await this.sendStream(bucketName, key, fs.createReadStream(fsPath))
   }
 
   async sendStream(bucketName, key, readStream, opts = {}) {
@@ -231,7 +231,7 @@ module.exports = class S3Persistor extends AbstractPersistor {
       if (this.settings.Metrics) {
         this.settings.Metrics.inc('s3.md5Download')
       }
-      return PersistorHelper.calculateStreamMd5(
+      return await PersistorHelper.calculateStreamMd5(
         await this.getObjectStream(bucketName, key)
       )
     } catch (err) {

+ 2 - 2
libraries/object-persistor/test/unit/MigrationPersistorTests.js

@@ -225,7 +225,7 @@ describe('MigrationPersistorTests', function () {
           newPersistor(false),
           Settings
         )
-        return expect(
+        await expect(
           migrationPersistor.getObjectStream(bucket, key)
         ).to.eventually.be.rejected.and.be.an.instanceOf(Errors.NotFoundError)
       })
@@ -322,7 +322,7 @@ describe('MigrationPersistorTests', function () {
     describe('when the primary persistor throws an error', function () {
       it('returns the error', async function () {
         primaryPersistor.sendStream.rejects(notFoundError)
-        return expect(
+        await expect(
           migrationPersistor.sendStream(bucket, key, fileStream)
         ).to.eventually.be.rejected.and.be.an.instanceOf(Errors.NotFoundError)
       })

+ 1 - 1
libraries/overleaf-editor-core/lib/file_data/lazy_string_file_data.js

@@ -155,7 +155,7 @@ class LazyStringFileData extends FileData {
     }
     const eager = await this.toEager(blobStore)
     this.operations.length = 0
-    return eager.store(blobStore)
+    return await eager.store(blobStore)
   }
 }
 

+ 4 - 0
libraries/overleaf-editor-core/lib/history.js

@@ -25,6 +25,7 @@ class History {
     assert.maybe.array.of.instance(changes, Change, 'bad changes')
 
     this.snapshot = snapshot
+    /** @type {Array<Change>} */
     this.changes = changes || []
   }
 
@@ -113,6 +114,9 @@ class History {
   async store(blobStore, concurrency) {
     assert.maybe.number(concurrency, 'bad concurrency')
 
+    /**
+     * @param {Change} change
+     */
     async function storeChange(change) {
       return await change.store(blobStore, concurrency)
     }

Plik diff jest za duży
+ 601 - 139
package-lock.json


+ 1 - 0
package.json

@@ -6,6 +6,7 @@
   },
   "devDependencies": {
     "@types/mocha": "^10.0.6",
+    "@typescript-eslint/eslint-plugin": "^6.7.4",
     "eslint": "^8.15.0",
     "eslint-config-prettier": "^8.5.0",
     "eslint-config-standard": "^17.0.0",

+ 6 - 1
services/chat/app/js/Features/Messages/MessageHttpController.js

@@ -7,7 +7,7 @@ import { ObjectId } from '../../mongodb.js'
 const DEFAULT_MESSAGE_LIMIT = 50
 const MAX_MESSAGE_LENGTH = 10 * 1024 // 10kb, about 1,500 words
 
-async function readContext(context, req) {
+function readContext(context, req) {
   req.body = context.requestBody
   req.params = context.params.path
   req.query = context.params.query
@@ -23,6 +23,11 @@ async function readContext(context, req) {
   }
 }
 
+/**
+ * @param context
+ * @param {(req: unknown, res: unknown) => Promise<unknown>} ControllerMethod
+ * @returns {Promise<*>}
+ */
 export async function callMessageHttpController(context, ControllerMethod) {
   const req = {}
   readContext(context, req)

+ 6 - 2
services/chat/app/js/Features/Messages/MessageManager.js

@@ -19,11 +19,15 @@ export async function getMessages(roomId, limit, before) {
     query.timestamp = { $lt: before }
   }
   query = _ensureIdsAreObjectIds(query)
-  return db.messages.find(query).sort({ timestamp: -1 }).limit(limit).toArray()
+  return await db.messages
+    .find(query)
+    .sort({ timestamp: -1 })
+    .limit(limit)
+    .toArray()
 }
 
 export async function findAllMessagesInRooms(roomIds) {
-  return db.messages
+  return await db.messages
     .find({
       room_id: { $in: roomIds },
     })

+ 2 - 2
services/chat/app/js/Features/Threads/ThreadManager.js

@@ -37,7 +37,7 @@ export async function findOrCreateThread(projectId, threadId) {
 }
 
 export async function findAllThreadRooms(projectId) {
-  return db.rooms
+  return await db.rooms
     .find(
       {
         project_id: new ObjectId(projectId.toString()),
@@ -52,7 +52,7 @@ export async function findAllThreadRooms(projectId) {
 }
 
 export async function findAllThreadRoomsAndGlobalThread(projectId) {
-  return db.rooms
+  return await db.rooms
     .find(
       {
         project_id: new ObjectId(projectId.toString()),

+ 14 - 14
services/chat/test/acceptance/js/helpers/ChatClient.js

@@ -5,7 +5,7 @@ const request = Request.defaults({
 })
 
 async function asyncRequest(options) {
-  return new Promise((resolve, reject) => {
+  return await new Promise((resolve, reject) => {
     request(options, (err, response, body) => {
       if (err) {
         reject(err)
@@ -17,7 +17,7 @@ async function asyncRequest(options) {
 }
 
 export async function sendGlobalMessage(projectId, userId, content) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'post',
     url: `/project/${projectId}/messages`,
     json: {
@@ -28,7 +28,7 @@ export async function sendGlobalMessage(projectId, userId, content) {
 }
 
 export async function getGlobalMessages(projectId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'get',
     url: `/project/${projectId}/messages`,
     json: true,
@@ -36,7 +36,7 @@ export async function getGlobalMessages(projectId) {
 }
 
 export async function sendMessage(projectId, threadId, userId, content) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'post',
     url: `/project/${projectId}/thread/${threadId}/messages`,
     json: {
@@ -47,7 +47,7 @@ export async function sendMessage(projectId, threadId, userId, content) {
 }
 
 export async function getThreads(projectId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'get',
     url: `/project/${projectId}/threads`,
     json: true,
@@ -55,7 +55,7 @@ export async function getThreads(projectId) {
 }
 
 export async function resolveThread(projectId, threadId, userId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'post',
     url: `/project/${projectId}/thread/${threadId}/resolve`,
     json: {
@@ -65,7 +65,7 @@ export async function resolveThread(projectId, threadId, userId) {
 }
 
 export async function getResolvedThreadIds(projectId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'get',
     url: `/project/${projectId}/resolved-thread-ids`,
     json: true,
@@ -73,7 +73,7 @@ export async function getResolvedThreadIds(projectId) {
 }
 
 export async function editMessage(projectId, threadId, messageId, content) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'post',
     url: `/project/${projectId}/thread/${threadId}/messages/${messageId}/edit`,
     json: {
@@ -89,7 +89,7 @@ export async function editMessageWithUser(
   userId,
   content
 ) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'post',
     url: `/project/${projectId}/thread/${threadId}/messages/${messageId}/edit`,
     json: {
@@ -100,7 +100,7 @@ export async function editMessageWithUser(
 }
 
 export async function checkStatus() {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'get',
     url: `/status`,
     json: true,
@@ -118,28 +118,28 @@ export async function getMetric(matcher) {
 }
 
 export async function reopenThread(projectId, threadId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'post',
     url: `/project/${projectId}/thread/${threadId}/reopen`,
   })
 }
 
 export async function deleteThread(projectId, threadId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'delete',
     url: `/project/${projectId}/thread/${threadId}`,
   })
 }
 
 export async function deleteMessage(projectId, threadId, messageId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'delete',
     url: `/project/${projectId}/thread/${threadId}/messages/${messageId}`,
   })
 }
 
 export async function destroyProject(projectId) {
-  return asyncRequest({
+  return await asyncRequest({
     method: 'delete',
     url: `/project/${projectId}`,
   })

+ 2 - 1
services/chat/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 3 - 0
services/clsi/app/js/ContentCacheManager.js

@@ -18,6 +18,9 @@ const {
 const workerpool = require('workerpool')
 const Metrics = require('@overleaf/metrics')
 
+/**
+ * @type {import('workerpool').WorkerPool}
+ */
 let WORKER_POOL
 // NOTE: Check for main thread to avoid recursive start of pool.
 if (Settings.pdfCachingEnableWorkerPool && workerpool.isMainThread) {

+ 1 - 1
services/clsi/app/js/OutputCacheManager.js

@@ -74,7 +74,7 @@ async function runBulkCleanup() {
 }
 
 async function cleanupDirectory(dir, options) {
-  return queueDirOperation(dir, async () => {
+  return await queueDirOperation(dir, async () => {
     try {
       await OutputCacheManager.promises.expireOutputFiles(dir, options)
     } catch (err) {

+ 1 - 0
services/clsi/package.json

@@ -37,6 +37,7 @@
     "workerpool": "^6.1.5"
   },
   "devDependencies": {
+    "@types/workerpool": "^6.1.0",
     "chai": "^4.3.6",
     "chai-as-promised": "^7.1.1",
     "mocha": "^10.2.0",

+ 2 - 1
services/clsi/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 2 - 1
services/contacts/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 1 - 1
services/docstore/app/js/DocArchiveManager.js

@@ -203,7 +203,7 @@ async function _streamToBuffer(projectId, docId, stream) {
     )
     logged = true
   }
-  return new Promise((resolve, reject) => {
+  return await new Promise((resolve, reject) => {
     stream.on('data', chunk => {
       size += chunk.byteLength
       logIfTooLarge(false)

+ 12 - 0
services/docstore/app/js/DocManager.js

@@ -8,7 +8,19 @@ const Settings = require('@overleaf/settings')
 const { callbackifyAll } = require('@overleaf/promise-utils')
 const { setTimeout } = require('timers/promises')
 
+/**
+ * @typedef {import('mongodb').Document} Document
+ * @typedef {import('mongodb').WithId} WithId
+ */
+
 const DocManager = {
+  /**
+   * @param {string} projectId
+   * @param {string} docId
+   * @param {{inS3: boolean}} filter
+   * @returns {Promise<WithId<Document>>}
+   * @private
+   */
   async _getDoc(projectId, docId, filter) {
     if (filter == null) {
       filter = {}

+ 2 - 2
services/docstore/test/acceptance/js/helpers/DocstoreClient.js

@@ -5,7 +5,7 @@ const Persistor = require('../../../../app/js/PersistorManager')
 
 async function streamToString(stream) {
   const chunks = []
-  return new Promise((resolve, reject) => {
+  return await new Promise((resolve, reject) => {
     stream.on('data', chunk => chunks.push(chunk))
     stream.on('error', reject)
     stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')))
@@ -15,7 +15,7 @@ async function streamToString(stream) {
 async function getStringFromPersistor(persistor, bucket, key) {
   const stream = await persistor.getObjectStream(bucket, key, {})
   stream.resume()
-  return streamToString(stream)
+  return await streamToString(stream)
 }
 
 module.exports = DocstoreClient = {

+ 2 - 1
services/docstore/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 1 - 1
services/document-updater/scripts/flush_all.js

@@ -2,7 +2,7 @@ const ProjectFlusher = require('../app/js/ProjectFlusher')
 
 async function main() {
   console.log('Flushing all projects')
-  return new Promise((resolve, reject) => {
+  return await new Promise((resolve, reject) => {
     const options = {
       limit: 100000,
       concurrency: 5,

+ 4 - 1
services/document-updater/tsconfig.json

@@ -2,7 +2,10 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "expire_docops.js",
+    "app/js/**/*",
+    "benchmarks/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 3 - 3
services/filestore/app/js/FileConverter.js

@@ -22,7 +22,7 @@ module.exports = {
 
 async function convert(sourcePath, requestedFormat) {
   const width = '600x'
-  return _convert(sourcePath, requestedFormat, [
+  return await _convert(sourcePath, requestedFormat, [
     'convert',
     '-define',
     `pdf:fit-page=${width}`,
@@ -35,7 +35,7 @@ async function convert(sourcePath, requestedFormat) {
 
 async function thumbnail(sourcePath) {
   const width = '260x'
-  return convert(sourcePath, 'png', [
+  return await convert(sourcePath, 'png', [
     'convert',
     '-flatten',
     '-background',
@@ -52,7 +52,7 @@ async function thumbnail(sourcePath) {
 
 async function preview(sourcePath) {
   const width = '548x'
-  return convert(sourcePath, 'png', [
+  return await convert(sourcePath, 'png', [
     'convert',
     '-flatten',
     '-background',

+ 6 - 6
services/filestore/app/js/FileHandler.js

@@ -72,9 +72,9 @@ async function deleteProject(bucket, key) {
 async function getFile(bucket, key, opts) {
   opts = opts || {}
   if (!opts.format && !opts.style) {
-    return PersistorManager.getObjectStream(bucket, key, opts)
+    return await PersistorManager.getObjectStream(bucket, key, opts)
   } else {
-    return _getConvertedFile(bucket, key, opts)
+    return await _getConvertedFile(bucket, key, opts)
   }
 }
 
@@ -114,7 +114,7 @@ async function getRedirectUrl(bucket, key, opts) {
 }
 
 async function getFileSize(bucket, key) {
-  return PersistorManager.getObjectSize(bucket, key)
+  return await PersistorManager.getObjectSize(bucket, key)
 }
 
 async function getDirectorySize(bucket, projectId) {
@@ -128,9 +128,9 @@ async function _getConvertedFile(bucket, key, opts) {
     convertedKey
   )
   if (exists) {
-    return PersistorManager.getObjectStream(bucket, convertedKey, opts)
+    return await PersistorManager.getObjectStream(bucket, convertedKey, opts)
   } else {
-    return _getConvertedFileAndCache(bucket, key, convertedKey, opts)
+    return await _getConvertedFileAndCache(bucket, key, convertedKey, opts)
   }
 }
 
@@ -212,5 +212,5 @@ async function _convertFile(bucket, originalKey, opts) {
 
 async function _writeFileToDisk(bucket, key, opts) {
   const fileStream = await PersistorManager.getObjectStream(bucket, key, opts)
-  return LocalFileWriter.promises.writeStream(fileStream, key)
+  return await LocalFileWriter.promises.writeStream(fileStream, key)
 }

+ 1 - 1
services/filestore/test/acceptance/js/FilestoreApp.js

@@ -23,7 +23,7 @@ class FilestoreApp {
     }
 
     if (this.initing) {
-      return this.waitForInit()
+      return await this.waitForInit()
     }
     this.initing = true
 

+ 1 - 1
services/filestore/test/acceptance/js/FilestoreTests.js

@@ -332,7 +332,7 @@ describe('Filestore', function () {
         ]
 
         before(async function () {
-          return Promise.all([
+          return await Promise.all([
             fsWriteFile(localFileReadPaths[0], constantFileContents[0]),
             fsWriteFile(localFileReadPaths[1], constantFileContents[1]),
             fsWriteFile(localFileReadPaths[2], constantFileContents[2]),

+ 1 - 1
services/filestore/test/acceptance/js/TestHelper.js

@@ -38,7 +38,7 @@ async function uploadStringToPersistor(persistor, bucket, key, content) {
 
 async function getStringFromPersistor(persistor, bucket, key) {
   const stream = await persistor.getObjectStream(bucket, key, {})
-  return streamToString(stream)
+  return await streamToString(stream)
 }
 
 async function expectPersistorToHaveFile(persistor, bucket, key, content) {

+ 2 - 1
services/filestore/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 1 - 1
services/history-v1/storage/lib/blob_store/index.js

@@ -216,7 +216,7 @@ class BlobStore {
   async putObject(obj) {
     assert.object(obj, 'bad object')
     const string = JSON.stringify(obj)
-    return this.putString(string)
+    return await this.putString(string)
   }
 
   /**

+ 1 - 1
services/history-v1/storage/tasks/copy_project_blobs.js

@@ -82,7 +82,7 @@ async function run(options) {
       const results = await BPromise.map(
         projectIds,
         async projectId =>
-          processProject(
+          await processProject(
             projectId,
             chunkIdsByProject.get(projectId),
             globalBlobs

+ 1 - 1
services/history-v1/test/acceptance/js/storage/tasks.test.js

@@ -99,7 +99,7 @@ async function expectChunksExist(minChunkId, maxChunkId, expected) {
     keys.push(`100/000/000/${i.toString().padStart(9, '0')}`)
     keys.push(`fed/cba/fedcbafedcbafedcba/${i.toString().padStart(24, '0')}`)
   }
-  return Promise.all(
+  return await Promise.all(
     keys.map(async key => {
       const exists = await persistor.checkIfObjectExists(
         CHUNK_STORE_BUCKET,

+ 6 - 1
services/history-v1/tsconfig.json

@@ -2,7 +2,12 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "api/**/*",
+    "app/js/**/*",
+    "benchmarks/**/*",
+    "config/**/*",
+    "migrations/**/*",
+    "storage/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 2 - 1
services/notifications/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 1 - 1
services/project-history/app/js/LockManager.js

@@ -293,7 +293,7 @@ async function runWithLockPromises(key, runner) {
       })
   }
 
-  return new Promise((resolve, reject) => {
+  return await new Promise((resolve, reject) => {
     runWithLock(key, runnerCb, (err, result) => {
       if (err) {
         reject(err)

+ 2 - 1
services/project-history/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 2 - 1
services/real-time/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

+ 2 - 1
services/spelling/tsconfig.json

@@ -2,7 +2,8 @@
   "extends": "../../tsconfig.backend.json",
   "include": [
     "app.js",
-    "app/src/**/*",
+    "app/js/**/*",
+    "config/**/*",
     "scripts/**/*",
     "test/**/*"
   ]

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików