* Set `node-fetch` to `^2.7.0`
* Update package-lock.json
```
# root
bin/npm update node-fetch
bin/npm update cross-fetch
# in other path in docker
npm update node-fetch
```
* Update node-fetch patch
* [fetch-utils] Skip the test: destroys the request body if it doesn't get consumed
```
1) fetch-utils
fetchJson
destroys the request body if it doesn't get consumed:
FetchError: Invalid response body while trying to fetch http://example.com:30001/json/ignore-request: write EPIPE
at PassThrough.<anonymous> (/overleaf/node_modules/node-fetch/lib/index.js:400:12)
at PassThrough.emit (node:events:529:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
```
* [fetch-utils] Delete the test: destroys the request body if it doesn't get consumed
* Remove the `setTimeout` in the node-fetch patch
Fixes a test and doesn't break filestore acceptance tests
* Update node-fetch patch again: bring changes from https://github.com/node-fetch/node-fetch/blob/e87b093/src/index.js
* Update node-fetch patch again: bring changes from https://github.com/node-fetch/node-fetch/blob/e87b093/src/index.js
* Update node-fetch patches back to single lines
Per https://github.com/overleaf/internal/pull/20165#discussion_r1739035513
GitOrigin-RevId: 945e5a12e838673b7bc87b588b7aca1bcd9109e2
* [fetch-utils] Fix FetchUtilsTests.js tests
* Cleanup between tests
* Define `AbortError`
* [fetch-utils] Add `expectConnectionCount` showcasing that the connection stays on when the stream is destroyed
* Revert "[fetch-utils] Add `expectConnectionCount` showcasing that the connection stays on when the stream is destroyed"
This reverts commit b10da7b3fc06a7345df8fd70f27fad70a478bbb4.
* [fetch-utils] Fix `supports abort signals` test
* [fetch-utils] Add tests "aborts the request when the request body is destroyed during transfer"
* [fetch-utils] Add extra waiting step before `expectRequestAborted`
* [fetch-utils] Add `while (!req?.destroyed) await wait(10)`
Unfortunately I couldn't find a better event to await.
To try with this to test flakiness
```
for i in {1..100}; do npm run test:unit || break; echo "Run $i completed"; done
```
* [fetch-utils] Replace arbitrary `wait(10)` by `this.server.waitForEvent('request-received')`
* [fetch-utils] Improve tests per PR comments
See https://github.com/overleaf/internal/pull/20210
1. Replace `waitForEvent` with `once`
2. Replace `waitForRequestAborted` by `expectRequestAborted`
3. Add comment in `expectRequestAborted` empty catch block
Non-flakiness rechecked with `for i in {1..100}; do npm run test:unit || break; echo "Run $i completed"; done`
* [fetch-utils] Add small wait before checking `lastReq === undefined`
Per https://github.com/overleaf/internal/pull/20210#discussion_r1743329462
GitOrigin-RevId: 5fe542e0a8e6011307e03237e2f81404d9a0e674
* Update `@google-cloud/storage` and remove its patches
* Re-add patch on `@google-cloud/storage/retry-request`
Replace mentions of `.pipe()` and run `patch-package @google-cloud/storage/retry-request`
It was very hard to test whether the package could still cause bugs, so I'd rather put the patch back
GitOrigin-RevId: be83b54b6d55849995ac131bfcf3c9acd9b6dd8e
* Add some JSDoc types to `@overleaf/logger`
* Update `logger.error` calls
* Fixup `logger.err` JSDoc
* Update `logger.err` calls
* Fix `args` type
* Remove "Error message" description
* Replace `arguments` by actual arguments of the method
* Fix: "ESLint: Unnecessary '.apply()'.(no-useless-call)"
* Add JSDoc params to `debug` `info` `warn`
* Remove extra `args` param in JSDoc so developers aren't invited to use it
Not sure if this is the best thing to do because it creates a warning in the IDE: "Parameter args is not described in JSDoc"
* Add comment about serialization of `err` `req` `res`
* Allow strings as first param in `debug` `info` `warn`
* Fix syntax for optional parameters in JSDoc
* Add 2 signatures, to avoid "string, string" params
* Fix `@signature` names copy-pastes
Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
* Revert the double `@param attributes`. It doesn't work
---------
Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: 086dee8bbf30d577c5e1f844a9df5e518c46aca7
* add RestoreFileOrigin in overleaf-editor-core
* support source to be an object
* use sourceOrOrigin as param
* rename to originOrSource so the priority is more clear
* get timestamp from version
* fix test
* include version and min_count in getUpdatesFromHistory
* extractOriginOrSource util function
* fix RestoreManagerTests
GitOrigin-RevId: 0ace05a6ade2794c753a9d0bffb4f858ecc6899a