Refactor Redis integration to use ioredis instead of redis, enhancing performance and compatibility. Updated connection handling and command syntax for improved functionality. Added new dependencies for ioredis and updated mongoose version in package.json.
Some checks failed
farmcontrol/farmcontrol-api/pipeline/head There was a failure building this commit

This commit is contained in:
Tom Butcher 2026-08-01 12:42:08 +01:00
parent 7a1b85bb19
commit 6a9cd2a2ea
3 changed files with 219 additions and 144 deletions

View File

@ -9,6 +9,7 @@
"@nats-io/transport-node": "^3.2.0", "@nats-io/transport-node": "^3.2.0",
"axios": "^1.13.2", "axios": "^1.13.2",
"bcrypt": "^6.0.0", "bcrypt": "^6.0.0",
"blurhash": "^2.0.5",
"body-parser": "^2.2.0", "body-parser": "^2.2.0",
"canonical-json": "^0.2.0", "canonical-json": "^0.2.0",
"cors": "^2.8.5", "cors": "^2.8.5",
@ -19,12 +20,13 @@
"express": "^5.1.0", "express": "^5.1.0",
"express-session": "^1.18.2", "express-session": "^1.18.2",
"i": "^0.3.7", "i": "^0.3.7",
"ioredis": "^6.0.0",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"keycloak-connect": "^26.1.1", "keycloak-connect": "^26.1.1",
"lodash": "^4.17.23", "lodash": "^4.17.23",
"log4js": "^6.9.1", "log4js": "^6.9.1",
"mongodb": "^6.21.0", "mongodb": "^6.21.0",
"mongoose": "^8.19.4", "mongoose": "^9.9.1",
"multer": "^2.0.2", "multer": "^2.0.2",
"nanoid": "^5.1.6", "nanoid": "^5.1.6",
"node-cache": "^5.1.2", "node-cache": "^5.1.2",
@ -33,10 +35,9 @@
"nodemon": "^3.1.11", "nodemon": "^3.1.11",
"pg": "^8.16.3", "pg": "^8.16.3",
"puppeteer": "^24.37.5", "puppeteer": "^24.37.5",
"redis": "^5.10.0",
"sequelize": "^6.37.7", "sequelize": "^6.37.7",
"sharp": "^0.34.3", "sharp": "^0.34.3",
"blurhash": "^2.0.5" "speedgoose": "^2.5.11"
}, },
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {

314
pnpm-lock.yaml generated
View File

@ -56,6 +56,9 @@ importers:
i: i:
specifier: ^0.3.7 specifier: ^0.3.7
version: 0.3.7 version: 0.3.7
ioredis:
specifier: ^6.0.0
version: 6.0.0
jsonwebtoken: jsonwebtoken:
specifier: ^9.0.2 specifier: ^9.0.2
version: 9.0.3 version: 9.0.3
@ -72,8 +75,8 @@ importers:
specifier: ^6.21.0 specifier: ^6.21.0
version: 6.21.0(socks@2.8.7) version: 6.21.0(socks@2.8.7)
mongoose: mongoose:
specifier: ^8.19.4 specifier: ^9.9.1
version: 8.22.0(socks@2.8.7) version: 9.9.1(socks@2.8.7)
multer: multer:
specifier: ^2.0.2 specifier: ^2.0.2
version: 2.0.2 version: 2.0.2
@ -98,15 +101,15 @@ importers:
puppeteer: puppeteer:
specifier: ^24.37.5 specifier: ^24.37.5
version: 24.37.5 version: 24.37.5
redis:
specifier: ^5.10.0
version: 5.10.0
sequelize: sequelize:
specifier: ^6.37.7 specifier: ^6.37.7
version: 6.37.7(pg@8.18.0) version: 6.37.7(pg@8.18.0)
sharp: sharp:
specifier: ^0.34.3 specifier: ^0.34.3
version: 0.34.5 version: 0.34.5
speedgoose:
specifier: ^2.5.11
version: 2.5.11(socks@2.8.7)
devDependencies: devDependencies:
'@babel/cli': '@babel/cli':
specifier: ^7.28.3 specifier: ^7.28.3
@ -1178,6 +1181,12 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@ioredis/commands@1.10.0':
resolution: {integrity: sha512-UmeW7z4LfctwoQ5wkhVzgq8tXkreED2xZGpX+Bg+zA+WJFZCT6c062AfCK/Dfk81xZnnwdhJCUMkitihRaoC2Q==}
'@ioredis/commands@2.0.0':
resolution: {integrity: sha512-vrx0AE/T0h7cRZwfo1M39Cr+ZhZrkf0V8mQN75wucKCxCLD9l/VX6no3gFvrLqD1IlG/1LtzWovqEw3t0Vr9zg==}
'@isaacs/cliui@8.0.2': '@isaacs/cliui@8.0.2':
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'} engines: {node: '>=12'}
@ -1288,6 +1297,9 @@ packages:
'@jridgewell/trace-mapping@0.3.31': '@jridgewell/trace-mapping@0.3.31':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@mongodb-js/saslprep@1.4.13':
resolution: {integrity: sha512-E3Sv4eCYAlKYUTx8S3ioQcDUscOif+8zZ5OnW1IzJ+Tt+EO+ke8mn+Y3FX6N1H79picwbdOavVOb1jPi2EOyrg==}
'@mongodb-js/saslprep@1.4.5': '@mongodb-js/saslprep@1.4.5':
resolution: {integrity: sha512-k64Lbyb7ycCSXHSLzxVdb2xsKGPMvYZfCICXvDsI8Z65CeWQzTEKS4YmGbnqw+U9RBvLPTsB6UCmwkgsDTGWIw==} resolution: {integrity: sha512-k64Lbyb7ycCSXHSLzxVdb2xsKGPMvYZfCICXvDsI8Z65CeWQzTEKS4YmGbnqw+U9RBvLPTsB6UCmwkgsDTGWIw==}
@ -1347,34 +1359,6 @@ packages:
engines: {node: '>=18'} engines: {node: '>=18'}
hasBin: true hasBin: true
'@redis/bloom@5.10.0':
resolution: {integrity: sha512-doIF37ob+l47n0rkpRNgU8n4iacBlKM9xLiP1LtTZTvz8TloJB8qx/MgvhMhKdYG+CvCY2aPBnN2706izFn/4A==}
engines: {node: '>= 18'}
peerDependencies:
'@redis/client': ^5.10.0
'@redis/client@5.10.0':
resolution: {integrity: sha512-JXmM4XCoso6C75Mr3lhKA3eNxSzkYi3nCzxDIKY+YOszYsJjuKbFgVtguVPbLMOttN4iu2fXoc2BGhdnYhIOxA==}
engines: {node: '>= 18'}
'@redis/json@5.10.0':
resolution: {integrity: sha512-B2G8XlOmTPUuZtD44EMGbtoepQG34RCDXLZbjrtON1Djet0t5Ri7/YPXvL9aomXqP8lLTreaprtyLKF4tmXEEA==}
engines: {node: '>= 18'}
peerDependencies:
'@redis/client': ^5.10.0
'@redis/search@5.10.0':
resolution: {integrity: sha512-3SVcPswoSfp2HnmWbAGUzlbUPn7fOohVu2weUQ0S+EMiQi8jwjL+aN2p6V3TI65eNfVsJ8vyPvqWklm6H6esmg==}
engines: {node: '>= 18'}
peerDependencies:
'@redis/client': ^5.10.0
'@redis/time-series@5.10.0':
resolution: {integrity: sha512-cPkpddXH5kc/SdRhF0YG0qtjL+noqFT0AcHbQ6axhsPsO7iqPi1cjxgdkE9TNeKiBUUdCaU1DbqkR/LzbzPBhg==}
engines: {node: '>= 18'}
peerDependencies:
'@redis/client': ^5.10.0
'@rtsao/scc@1.1.0': '@rtsao/scc@1.1.0':
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
@ -1603,6 +1587,9 @@ packages:
resolution: {integrity: sha512-4aUIteuyxtBUhVdiQqcDhKFitwfd9hqoSDYY2KRXiWtgoWJ9Bmise+KfEPDiVHWeJepvF8xJO9/9+WDIciMFFw==} resolution: {integrity: sha512-4aUIteuyxtBUhVdiQqcDhKFitwfd9hqoSDYY2KRXiWtgoWJ9Bmise+KfEPDiVHWeJepvF8xJO9/9+WDIciMFFw==}
engines: {node: '>=18.0.0'} engines: {node: '>=18.0.0'}
'@standard-schema/spec@1.1.0':
resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==}
'@testim/chrome-version@1.1.4': '@testim/chrome-version@1.1.4':
resolution: {integrity: sha512-kIhULpw9TrGYnHp/8VfdcneIcxKnLixmADtukQRtJUmsVlMg0niMkwV0xZmi8hqa57xqilIHjWFA0GKvEjVU5g==} resolution: {integrity: sha512-kIhULpw9TrGYnHp/8VfdcneIcxKnLixmADtukQRtJUmsVlMg0niMkwV0xZmi8hqa57xqilIHjWFA0GKvEjVU5g==}
@ -1666,6 +1653,9 @@ packages:
'@types/whatwg-url@11.0.5': '@types/whatwg-url@11.0.5':
resolution: {integrity: sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==} resolution: {integrity: sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==}
'@types/whatwg-url@13.0.0':
resolution: {integrity: sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==}
'@types/yargs-parser@21.0.3': '@types/yargs-parser@21.0.3':
resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==}
@ -2101,6 +2091,10 @@ packages:
resolution: {integrity: sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==} resolution: {integrity: sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==}
engines: {node: '>=16.20.1'} engines: {node: '>=16.20.1'}
bson@7.3.1:
resolution: {integrity: sha512-h/C0qe6857pQhcSJHLfsR1uYGj98Ge3wKAD3Ed9KqH3wcVh+BM4Jq4xISD7vs9OPuT07n+q3QQVjslJ286j6ag==}
engines: {node: '>=20.19.0'}
buffer-crc32@0.2.13: buffer-crc32@0.2.13:
resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}
@ -2178,8 +2172,8 @@ packages:
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
engines: {node: '>= 8.10.0'} engines: {node: '>= 8.10.0'}
chromedriver@151.0.1: chromedriver@151.0.2:
resolution: {integrity: sha512-pjpIi8+CuyqI594OwtBsL63h3rW5RQU24+Bi4eDXKQ11VQzN+8J5Dmy52MQkm39UtC0wrDnEkZQwYjWVQ99CYQ==} resolution: {integrity: sha512-p2NI0qrBSpoksa9S4lxqpML28I1U1oMtNPyvbjiMlBB+JOn9qRQC/cuiAWPf36lAdsYgrqhQczb12UH2he04MQ==}
engines: {node: '>=22'} engines: {node: '>=22'}
hasBin: true hasBin: true
@ -2210,8 +2204,8 @@ packages:
resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==} resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==}
engines: {node: '>=0.8'} engines: {node: '>=0.8'}
cluster-key-slot@1.1.2: cluster-key-slot@1.1.1:
resolution: {integrity: sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==} resolution: {integrity: sha512-rwHwUfXL40Chm1r08yrhU3qpUvdVlgkKNeyeGPOxnW8/SyVDvgRaed/Uz54AqWNaTCAThlj6QAs3TZcKI0xDEw==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
co@4.6.0: co@4.6.0:
@ -2426,6 +2420,10 @@ packages:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
denque@2.1.0:
resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==}
engines: {node: '>=0.10'}
depd@2.0.0: depd@2.0.0:
resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}
@ -3147,6 +3145,14 @@ packages:
resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
ioredis@5.11.1:
resolution: {integrity: sha512-ehuGcf94bQXhfagULNXrJdfnWO38v070jxSx/qE87Kjzmu2fU7ro5EFAb+OPituLqgfyuQaym5DlrNydW2sJ9A==}
engines: {node: '>=12.22.0'}
ioredis@6.0.0:
resolution: {integrity: sha512-f+Dtubxfpf6KYFq7WVXJoOLn0bk4TJrMrN9SzeE+jrWrCWj7XX3fA6vkryafhADX+GMymRxgDJDOI33COkJc0w==}
engines: {node: '>=20.0.0'}
ip-address@10.1.0: ip-address@10.1.0:
resolution: {integrity: sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==} resolution: {integrity: sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==}
engines: {node: '>= 12'} engines: {node: '>= 12'}
@ -3543,9 +3549,9 @@ packages:
jws@4.0.1: jws@4.0.1:
resolution: {integrity: sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==} resolution: {integrity: sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==}
kareem@2.6.3: kareem@3.3.0:
resolution: {integrity: sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==} resolution: {integrity: sha512-kpSuLD3/7RenBnjnJdOHXCKC8dTd1JzeOiJhN0necWWci6cC+qX+VuwPnMVgb+a4+KNJSfgqahpnfWaeDXCimw==}
engines: {node: '>=12.0.0'} engines: {node: '>=18.0.0'}
keycloak-connect@26.1.1: keycloak-connect@26.1.1:
resolution: {integrity: sha512-2wvNJXldB9Em+mp6liJ+AnftcJovFEvNhUgv3hblNDmVihBoBqn4zFlwLIN41lo0H8CicB2T86xZ5U2MiQ9FFA==} resolution: {integrity: sha512-2wvNJXldB9Em+mp6liJ+AnftcJovFEvNhUgv3hblNDmVihBoBqn4zFlwLIN41lo0H8CicB2T86xZ5U2MiQ9FFA==}
@ -3792,32 +3798,9 @@ packages:
mongodb-connection-string-url@3.0.2: mongodb-connection-string-url@3.0.2:
resolution: {integrity: sha512-rMO7CGo/9BFwyZABcKAWL8UJwH/Kc2x0g72uhDWzG48URRax5TCIcJ7Rc3RZqffZzO/Gwff/jyKwCU9TN8gehA==} resolution: {integrity: sha512-rMO7CGo/9BFwyZABcKAWL8UJwH/Kc2x0g72uhDWzG48URRax5TCIcJ7Rc3RZqffZzO/Gwff/jyKwCU9TN8gehA==}
mongodb@6.20.0: mongodb-connection-string-url@7.0.2:
resolution: {integrity: sha512-Tl6MEIU3K4Rq3TSHd+sZQqRBoGlFsOgNrH5ltAcFBV62Re3Fd+FcaVf8uSEQFOJ51SDowDVttBTONMfoYWrWlQ==} resolution: {integrity: sha512-ZoS07RoFqpKYQwAk59qmrx8+jJHNHU30UjlU96QktiGn1ltvDr+vCznLX5DiUBLEpMAHatHNWV1nM/74ul66kA==}
engines: {node: '>=16.20.1'} engines: {node: '>=20.19.0'}
peerDependencies:
'@aws-sdk/credential-providers': ^3.188.0
'@mongodb-js/zstd': ^1.1.0 || ^2.0.0
gcp-metadata: ^5.2.0
kerberos: ^2.0.1
mongodb-client-encryption: '>=6.0.0 <7'
snappy: ^7.3.2
socks: ^2.7.1
peerDependenciesMeta:
'@aws-sdk/credential-providers':
optional: true
'@mongodb-js/zstd':
optional: true
gcp-metadata:
optional: true
kerberos:
optional: true
mongodb-client-encryption:
optional: true
snappy:
optional: true
socks:
optional: true
mongodb@6.21.0: mongodb@6.21.0:
resolution: {integrity: sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==} resolution: {integrity: sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==}
@ -3846,17 +3829,44 @@ packages:
socks: socks:
optional: true optional: true
mongoose@8.22.0: mongodb@7.5.0:
resolution: {integrity: sha512-LKTPPqD3CVcSZJRzPcwKiSVYTmAvBZeVT0V34vUiqPEo9sBmOEg1y4TpDbUb90Zf2lO4N05ailQnKxiapCN08g==} resolution: {integrity: sha512-5FnrEDLnvp6ycUOGLNLLU33BfCx2qmp2mJjGPDwKLruYsVzXVSK5fsGpoDXvsXJwBfBsD7ebMRdawbDxC2814g==}
engines: {node: '>=16.20.1'} engines: {node: '>=20.19.0'}
peerDependencies:
'@aws-sdk/credential-providers': ^3.806.0
'@mongodb-js/zstd': ^7.0.0
gcp-metadata: ^7.0.1
kerberos: ^7.0.0
mongodb-client-encryption: ^7.2.0
snappy: ^7.3.2
socks: ^2.8.6
peerDependenciesMeta:
'@aws-sdk/credential-providers':
optional: true
'@mongodb-js/zstd':
optional: true
gcp-metadata:
optional: true
kerberos:
optional: true
mongodb-client-encryption:
optional: true
snappy:
optional: true
socks:
optional: true
mongoose@9.9.1:
resolution: {integrity: sha512-hI00baDVPjV5VfYA3j+oLuPvLfmCQICWot9zJZgkuDMXnWEYhIx9xCPEOt2IC3lDJz6ajsz2bpgO24E+xsP6wg==}
engines: {node: '>=20.19.0'}
mpath@0.9.0: mpath@0.9.0:
resolution: {integrity: sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==} resolution: {integrity: sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==}
engines: {node: '>=4.0.0'} engines: {node: '>=4.0.0'}
mquery@5.0.0: mquery@6.0.0:
resolution: {integrity: sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==} resolution: {integrity: sha512-b2KQNsmgtkscfeDgkYMcWGn9vZI9YoXh802VDEwE6qc50zxBFQ0Oo8ROkawbPAsXCY1/Z1yp0MagqsZStPWJjw==}
engines: {node: '>=14.0.0'} engines: {node: '>=20.19.0'}
ms@2.0.0: ms@2.0.0:
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
@ -4302,9 +4312,13 @@ packages:
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
engines: {node: '>=8.10.0'} engines: {node: '>=8.10.0'}
redis@5.10.0: redis-errors@1.2.0:
resolution: {integrity: sha512-0/Y+7IEiTgVGPrLFKy8oAEArSyEJkU0zvgV5xyi9NzNQ+SLZmyFbUsWIbgPcd4UdUh00opXGKlXJwMmsis5Byw==} resolution: {integrity: sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==}
engines: {node: '>= 18'} engines: {node: '>=4'}
redis-parser@3.0.0:
resolution: {integrity: sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==}
engines: {node: '>=4'}
reflect.getprototypeof@1.0.10: reflect.getprototypeof@1.0.10:
resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==}
@ -4592,6 +4606,10 @@ packages:
sparse-bitfield@3.0.3: sparse-bitfield@3.0.3:
resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==} resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==}
speedgoose@2.5.11:
resolution: {integrity: sha512-hiSHgk0LOpx/fxDqXMnofenqAGTHxaBUx49FyjJd/a2s4znDdu4UyDPgqwxh1z/6eatvlNEDI5KASwP8pp+PrA==}
engines: {node: '>=20.19.0'}
split2@4.2.0: split2@4.2.0:
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
engines: {node: '>= 10.x'} engines: {node: '>= 10.x'}
@ -4603,6 +4621,9 @@ packages:
resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
standard-as-callback@2.1.0:
resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==}
standard-engine@15.1.0: standard-engine@15.1.0:
resolution: {integrity: sha512-VHysfoyxFu/ukT+9v49d4BRXIokFRZuH3z1VRxzFArZdjSCFpro6rEIU3ji7e4AoAtuSfKBkiOmsrDqKW5ZSRw==} resolution: {integrity: sha512-VHysfoyxFu/ukT+9v49d4BRXIokFRZuH3z1VRxzFArZdjSCFpro6rEIU3ji7e4AoAtuSfKBkiOmsrDqKW5ZSRw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@ -4841,6 +4862,9 @@ packages:
typedarray@0.0.6: typedarray@0.0.6:
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
typedi@0.10.0:
resolution: {integrity: sha512-v3UJF8xm68BBj6AF4oQML3ikrfK2c9EmZUyLOfShpJuItAqVBHWP/KtpGinkSsIiP6EZyyb6Z3NXyW9dgS9X1w==}
uid-safe@2.1.5: uid-safe@2.1.5:
resolution: {integrity: sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==} resolution: {integrity: sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==}
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}
@ -6557,6 +6581,10 @@ snapshots:
'@img/sharp-win32-x64@0.34.5': '@img/sharp-win32-x64@0.34.5':
optional: true optional: true
'@ioredis/commands@1.10.0': {}
'@ioredis/commands@2.0.0': {}
'@isaacs/cliui@8.0.2': '@isaacs/cliui@8.0.2':
dependencies: dependencies:
string-width: 5.1.2 string-width: 5.1.2
@ -6774,6 +6802,10 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/sourcemap-codec': 1.5.5
'@mongodb-js/saslprep@1.4.13':
dependencies:
sparse-bitfield: 3.0.3
'@mongodb-js/saslprep@1.4.5': '@mongodb-js/saslprep@1.4.5':
dependencies: dependencies:
sparse-bitfield: 3.0.3 sparse-bitfield: 3.0.3
@ -6845,26 +6877,6 @@ snapshots:
- react-native-b4a - react-native-b4a
- supports-color - supports-color
'@redis/bloom@5.10.0(@redis/client@5.10.0)':
dependencies:
'@redis/client': 5.10.0
'@redis/client@5.10.0':
dependencies:
cluster-key-slot: 1.1.2
'@redis/json@5.10.0(@redis/client@5.10.0)':
dependencies:
'@redis/client': 5.10.0
'@redis/search@5.10.0(@redis/client@5.10.0)':
dependencies:
'@redis/client': 5.10.0
'@redis/time-series@5.10.0(@redis/client@5.10.0)':
dependencies:
'@redis/client': 5.10.0
'@rtsao/scc@1.1.0': {} '@rtsao/scc@1.1.0': {}
'@sinclair/typebox@0.34.48': {} '@sinclair/typebox@0.34.48': {}
@ -7215,6 +7227,8 @@ snapshots:
dependencies: dependencies:
tslib: 2.8.1 tslib: 2.8.1
'@standard-schema/spec@1.1.0': {}
'@testim/chrome-version@1.1.4': '@testim/chrome-version@1.1.4':
optional: true optional: true
@ -7284,6 +7298,10 @@ snapshots:
dependencies: dependencies:
'@types/webidl-conversions': 7.0.3 '@types/webidl-conversions': 7.0.3
'@types/whatwg-url@13.0.0':
dependencies:
'@types/webidl-conversions': 7.0.3
'@types/yargs-parser@21.0.3': {} '@types/yargs-parser@21.0.3': {}
'@types/yargs@17.0.35': '@types/yargs@17.0.35':
@ -7779,6 +7797,8 @@ snapshots:
bson@6.10.4: {} bson@6.10.4: {}
bson@7.3.1: {}
buffer-crc32@0.2.13: {} buffer-crc32@0.2.13: {}
buffer-equal-constant-time@1.0.1: {} buffer-equal-constant-time@1.0.1: {}
@ -7854,7 +7874,7 @@ snapshots:
optionalDependencies: optionalDependencies:
fsevents: 2.3.3 fsevents: 2.3.3
chromedriver@151.0.1: chromedriver@151.0.2:
dependencies: dependencies:
'@testim/chrome-version': 1.1.4 '@testim/chrome-version': 1.1.4
adm-zip: 0.5.18 adm-zip: 0.5.18
@ -7899,7 +7919,7 @@ snapshots:
clone@2.1.2: {} clone@2.1.2: {}
cluster-key-slot@1.1.2: {} cluster-key-slot@1.1.1: {}
co@4.6.0: {} co@4.6.0: {}
@ -8083,6 +8103,8 @@ snapshots:
delayed-stream@1.0.0: {} delayed-stream@1.0.0: {}
denque@2.1.0: {}
depd@2.0.0: {} depd@2.0.0: {}
detect-libc@2.1.2: {} detect-libc@2.1.2: {}
@ -8293,7 +8315,7 @@ snapshots:
eslint: 8.57.1 eslint: 8.57.1
eslint-plugin-react: 7.37.5(eslint@8.57.1) eslint-plugin-react: 7.37.5(eslint@8.57.1)
eslint-config-standard@17.1.0(eslint-plugin-import@2.32.0(eslint@9.39.2))(eslint-plugin-n@15.7.0(eslint@9.39.2))(eslint-plugin-promise@6.6.0(eslint@9.39.2))(eslint@8.57.1): eslint-config-standard@17.1.0(eslint-plugin-import@2.32.0(eslint@8.57.1))(eslint-plugin-n@15.7.0(eslint@8.57.1))(eslint-plugin-promise@6.6.0(eslint@8.57.1))(eslint@8.57.1):
dependencies: dependencies:
eslint: 8.57.1 eslint: 8.57.1
eslint-plugin-import: 2.32.0(eslint@8.57.1) eslint-plugin-import: 2.32.0(eslint@8.57.1)
@ -9032,6 +9054,29 @@ snapshots:
hasown: 2.0.2 hasown: 2.0.2
side-channel: 1.1.0 side-channel: 1.1.0
ioredis@5.11.1:
dependencies:
'@ioredis/commands': 1.10.0
cluster-key-slot: 1.1.1
debug: 4.4.3(supports-color@5.5.0)
denque: 2.1.0
redis-errors: 1.2.0
redis-parser: 3.0.0
standard-as-callback: 2.1.0
transitivePeerDependencies:
- supports-color
ioredis@6.0.0:
dependencies:
'@ioredis/commands': 2.0.0
cluster-key-slot: 1.1.1
debug: 4.4.3(supports-color@5.5.0)
denque: 2.1.0
redis-errors: 1.2.0
standard-as-callback: 2.1.0
transitivePeerDependencies:
- supports-color
ip-address@10.1.0: {} ip-address@10.1.0: {}
ip-regex@2.1.0: ip-regex@2.1.0:
@ -9642,13 +9687,13 @@ snapshots:
jwa: 2.0.1 jwa: 2.0.1
safe-buffer: 5.2.1 safe-buffer: 5.2.1
kareem@2.6.3: {} kareem@3.3.0: {}
keycloak-connect@26.1.1: keycloak-connect@26.1.1:
dependencies: dependencies:
jwk-to-pem: 2.0.7 jwk-to-pem: 2.0.7
optionalDependencies: optionalDependencies:
chromedriver: 151.0.1 chromedriver: 151.0.2
transitivePeerDependencies: transitivePeerDependencies:
- debug - debug
- kerberos - kerberos
@ -9855,13 +9900,10 @@ snapshots:
'@types/whatwg-url': 11.0.5 '@types/whatwg-url': 11.0.5
whatwg-url: 14.2.0 whatwg-url: 14.2.0
mongodb@6.20.0(socks@2.8.7): mongodb-connection-string-url@7.0.2:
dependencies: dependencies:
'@mongodb-js/saslprep': 1.4.5 '@types/whatwg-url': 13.0.0
bson: 6.10.4 whatwg-url: 14.2.0
mongodb-connection-string-url: 3.0.2
optionalDependencies:
socks: 2.8.7
mongodb@6.21.0(socks@2.8.7): mongodb@6.21.0(socks@2.8.7):
dependencies: dependencies:
@ -9871,13 +9913,21 @@ snapshots:
optionalDependencies: optionalDependencies:
socks: 2.8.7 socks: 2.8.7
mongoose@8.22.0(socks@2.8.7): mongodb@7.5.0(socks@2.8.7):
dependencies: dependencies:
bson: 6.10.4 '@mongodb-js/saslprep': 1.4.13
kareem: 2.6.3 bson: 7.3.1
mongodb: 6.20.0(socks@2.8.7) mongodb-connection-string-url: 7.0.2
optionalDependencies:
socks: 2.8.7
mongoose@9.9.1(socks@2.8.7):
dependencies:
'@standard-schema/spec': 1.1.0
kareem: 3.3.0
mongodb: 7.5.0(socks@2.8.7)
mpath: 0.9.0 mpath: 0.9.0
mquery: 5.0.0 mquery: 6.0.0
ms: 2.1.3 ms: 2.1.3
sift: 17.1.3 sift: 17.1.3
transitivePeerDependencies: transitivePeerDependencies:
@ -9888,15 +9938,10 @@ snapshots:
- mongodb-client-encryption - mongodb-client-encryption
- snappy - snappy
- socks - socks
- supports-color
mpath@0.9.0: {} mpath@0.9.0: {}
mquery@5.0.0: mquery@6.0.0: {}
dependencies:
debug: 4.4.3(supports-color@5.5.0)
transitivePeerDependencies:
- supports-color
ms@2.0.0: {} ms@2.0.0: {}
@ -10385,13 +10430,11 @@ snapshots:
dependencies: dependencies:
picomatch: 2.3.1 picomatch: 2.3.1
redis@5.10.0: redis-errors@1.2.0: {}
redis-parser@3.0.0:
dependencies: dependencies:
'@redis/bloom': 5.10.0(@redis/client@5.10.0) redis-errors: 1.2.0
'@redis/client': 5.10.0
'@redis/json': 5.10.0(@redis/client@5.10.0)
'@redis/search': 5.10.0(@redis/client@5.10.0)
'@redis/time-series': 5.10.0(@redis/client@5.10.0)
reflect.getprototypeof@1.0.10: reflect.getprototypeof@1.0.10:
dependencies: dependencies:
@ -10740,6 +10783,25 @@ snapshots:
dependencies: dependencies:
memory-pager: 1.5.0 memory-pager: 1.5.0
speedgoose@2.5.11(socks@2.8.7):
dependencies:
debug: 4.4.3(supports-color@5.5.0)
fastq: 1.20.1
ioredis: 5.11.1
keyv: 4.5.4
mongoose: 9.9.1(socks@2.8.7)
mpath: 0.9.0
typedi: 0.10.0
transitivePeerDependencies:
- '@aws-sdk/credential-providers'
- '@mongodb-js/zstd'
- gcp-metadata
- kerberos
- mongodb-client-encryption
- snappy
- socks
- supports-color
split2@4.2.0: {} split2@4.2.0: {}
sprintf-js@1.0.3: {} sprintf-js@1.0.3: {}
@ -10748,6 +10810,8 @@ snapshots:
dependencies: dependencies:
escape-string-regexp: 2.0.0 escape-string-regexp: 2.0.0
standard-as-callback@2.1.0: {}
standard-engine@15.1.0: standard-engine@15.1.0:
dependencies: dependencies:
get-stdin: 8.0.0 get-stdin: 8.0.0
@ -10758,7 +10822,7 @@ snapshots:
standard@17.1.2: standard@17.1.2:
dependencies: dependencies:
eslint: 8.57.1 eslint: 8.57.1
eslint-config-standard: 17.1.0(eslint-plugin-import@2.32.0(eslint@9.39.2))(eslint-plugin-n@15.7.0(eslint@9.39.2))(eslint-plugin-promise@6.6.0(eslint@9.39.2))(eslint@8.57.1) eslint-config-standard: 17.1.0(eslint-plugin-import@2.32.0(eslint@8.57.1))(eslint-plugin-n@15.7.0(eslint@8.57.1))(eslint-plugin-promise@6.6.0(eslint@8.57.1))(eslint@8.57.1)
eslint-config-standard-jsx: 11.0.0(eslint-plugin-react@7.37.5(eslint@8.57.1))(eslint@8.57.1) eslint-config-standard-jsx: 11.0.0(eslint-plugin-react@7.37.5(eslint@8.57.1))(eslint@8.57.1)
eslint-plugin-import: 2.32.0(eslint@8.57.1) eslint-plugin-import: 2.32.0(eslint@8.57.1)
eslint-plugin-n: 15.7.0(eslint@8.57.1) eslint-plugin-n: 15.7.0(eslint@8.57.1)
@ -11078,6 +11142,8 @@ snapshots:
typedarray@0.0.6: {} typedarray@0.0.6: {}
typedi@0.10.0: {}
uid-safe@2.1.5: uid-safe@2.1.5:
dependencies: dependencies:
random-bytes: 1.0.0 random-bytes: 1.0.0

View File

@ -1,4 +1,4 @@
import { createClient } from 'redis'; import Redis from 'ioredis';
import log4js from 'log4js'; import log4js from 'log4js';
import config from '../config.js'; import config from '../config.js';
@ -7,11 +7,14 @@ logger.level = config.server.logLevel;
class RedisServer { class RedisServer {
constructor() { constructor() {
const url = config.database.redis.url || `redis://${config.database.redis.host}:${config.database.redis.port}`; const url =
config.database.redis.url ||
`redis://${config.database.redis.host}:${config.database.redis.port}`;
const password = config.database.redis.password || undefined;
this.client = createClient({ this.client = new Redis(url, {
url, password,
password: config.database.redis.password || undefined, lazyConnect: true,
}); });
this.client.on('error', (err) => { this.client.on('error', (err) => {
@ -33,7 +36,7 @@ class RedisServer {
await this.connect(); await this.connect();
const payload = typeof value === 'string' ? value : JSON.stringify(value); const payload = typeof value === 'string' ? value : JSON.stringify(value);
if (ttlSeconds) { if (ttlSeconds) {
await this.client.set(key, payload, { EX: ttlSeconds }); await this.client.set(key, payload, 'EX', ttlSeconds);
} else { } else {
await this.client.set(key, payload); await this.client.set(key, payload);
} }
@ -57,7 +60,7 @@ class RedisServer {
async getAndDeleteKey(key) { async getAndDeleteKey(key) {
await this.connect(); await this.connect();
const value = await this.client.getDel(key); const value = await this.client.getdel(key);
if (value == null) return null; if (value == null) return null;
try { try {
return JSON.parse(value); return JSON.parse(value);
@ -68,10 +71,12 @@ class RedisServer {
async eval(script, keys = [], args = []) { async eval(script, keys = [], args = []) {
await this.connect(); await this.connect();
return this.client.eval(script, { return this.client.eval(
keys, script,
arguments: args.map((arg) => String(arg)), keys.length,
}); ...keys,
...args.map((arg) => String(arg))
);
} }
async getKeysByPattern(pattern) { async getKeysByPattern(pattern) {
@ -79,12 +84,15 @@ class RedisServer {
const keys = []; const keys = [];
let cursor = '0'; let cursor = '0';
do { do {
const result = await this.client.scan(cursor, { const [nextCursor, foundKeys] = await this.client.scan(
MATCH: pattern, cursor,
COUNT: 100, 'MATCH',
}); pattern,
cursor = result.cursor; 'COUNT',
keys.push(...result.keys); 100
);
cursor = nextCursor;
keys.push(...foundKeys);
} while (cursor !== '0'); } while (cursor !== '0');
return keys; return keys;
} }