Merge pull request #18167 from overleaf/em-simpler-typescript-backend

Simpler Typescript setup in the backend

GitOrigin-RevId: 3a90f26a5ac8029d14203faa98008375ce933e7d
This commit is contained in:
Eric Mc Sween
2024-05-07 08:04:00 +00:00
committed by Copybot
parent 5da8662fa8
commit e87df4a791
43 changed files with 63 additions and 155 deletions
+12
View File
@@ -96,6 +96,9 @@ module.exports = class RedisLocker {
return `locked:host=${HOST}:pid=${PID}:random=${RND}:time=${time}:count=${COUNT++}`
}
/**
* @param {Callback} callback
*/
tryLock(id, callback) {
if (callback == null) {
callback = function () {}
@@ -135,6 +138,9 @@ module.exports = class RedisLocker {
)
}
/**
* @param {Callback} callback
*/
getLock(id, callback) {
if (callback == null) {
callback = function () {}
@@ -166,6 +172,9 @@ module.exports = class RedisLocker {
attempt()
}
/**
* @param {Callback} callback
*/
checkLock(id, callback) {
if (callback == null) {
callback = function () {}
@@ -186,6 +195,9 @@ module.exports = class RedisLocker {
})
}
/**
* @param {Callback} callback
*/
releaseLock(id, lockValue, callback) {
const key = this.getKey(id)
return this.rclient.eval(
+1 -4
View File
@@ -3,7 +3,6 @@
"version": "2.1.0",
"description": "Redis wrapper for node which will either use cluster or single instance redis",
"main": "index.js",
"types": "types/index.d.ts",
"files": [
"index.js",
"Errors.js",
@@ -21,9 +20,7 @@
"test": "npm run lint && npm run format && npm run types:check && npm run test:unit",
"test:ci": "npm run test:unit",
"test:unit": "mocha --exit test/**/*.{js,cjs}",
"types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly",
"types:check": "tsc --noEmit",
"types:rebuild": "rm -rf types && npm run types:build"
"types:check": "tsc --noEmit"
},
"peerDependencies": {
"@overleaf/logger": "*",
-4
View File
@@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.backend.json",
"compilerOptions": {
"declaration": true,
"outDir": "types"
},
"include": [
"**/*.js",
"**/*.cjs"