You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
add buffer support to a bunch of commands
This commit is contained in:
282
package-lock.json
generated
282
package-lock.json
generated
@@ -12,9 +12,10 @@
|
|||||||
"./packages/*"
|
"./packages/*"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@node-redis/client": "^1.0.0",
|
"@node-redis/client": "^1.0.1",
|
||||||
"@node-redis/json": "^1.0.0",
|
"@node-redis/json": "^1.0.1",
|
||||||
"@node-redis/search": "^1.0.0"
|
"@node-redis/search": "^1.0.1",
|
||||||
|
"@node-redis/time-series": "^1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node12": "^1.0.9",
|
"@tsconfig/node12": "^1.0.9",
|
||||||
@@ -49,19 +50,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/core": {
|
"node_modules/@babel/core": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.5.tgz",
|
||||||
"integrity": "sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ==",
|
"integrity": "sha512-wUcenlLzuWMZ9Zt8S0KmFwGlH6QKRh3vsm/dhDA3CHkiTA45YuG1XkHRcNRl73EFPXDp/d5kVOU0/y7x2w6OaQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.16.0",
|
"@babel/code-frame": "^7.16.0",
|
||||||
"@babel/generator": "^7.16.0",
|
"@babel/generator": "^7.16.5",
|
||||||
"@babel/helper-compilation-targets": "^7.16.0",
|
"@babel/helper-compilation-targets": "^7.16.3",
|
||||||
"@babel/helper-module-transforms": "^7.16.0",
|
"@babel/helper-module-transforms": "^7.16.5",
|
||||||
"@babel/helpers": "^7.16.0",
|
"@babel/helpers": "^7.16.5",
|
||||||
"@babel/parser": "^7.16.0",
|
"@babel/parser": "^7.16.5",
|
||||||
"@babel/template": "^7.16.0",
|
"@babel/template": "^7.16.0",
|
||||||
"@babel/traverse": "^7.16.0",
|
"@babel/traverse": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0",
|
"@babel/types": "^7.16.0",
|
||||||
"convert-source-map": "^1.7.0",
|
"convert-source-map": "^1.7.0",
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
@@ -79,9 +80,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/generator": {
|
"node_modules/@babel/generator": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.5.tgz",
|
||||||
"integrity": "sha512-RR8hUCfRQn9j9RPKEVXo9LiwoxLPYn6hNZlvUOR8tSnaxlD0p0+la00ZP9/SnRt6HchKr+X0fO2r8vrETiJGew==",
|
"integrity": "sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/types": "^7.16.0",
|
"@babel/types": "^7.16.0",
|
||||||
@@ -110,6 +111,18 @@
|
|||||||
"@babel/core": "^7.0.0"
|
"@babel/core": "^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@babel/helper-environment-visitor": {
|
||||||
|
"version": "7.16.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.5.tgz",
|
||||||
|
"integrity": "sha512-ODQyc5AnxmZWm/R2W7fzhamOk1ey8gSguo5SGvF0zcB3uUzRpTRmM/jmLSm9bDMyPlvbyJ+PwPEK0BWIoZ9wjg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/types": "^7.16.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@babel/helper-function-name": {
|
"node_modules/@babel/helper-function-name": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz",
|
||||||
@@ -148,18 +161,6 @@
|
|||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-member-expression-to-functions": {
|
|
||||||
"version": "7.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.0.tgz",
|
|
||||||
"integrity": "sha512-bsjlBFPuWT6IWhl28EdrQ+gTvSvj5tqVP5Xeftp07SEuz5pLnsXZuDkDD3Rfcxy0IsHmbZ+7B2/9SHzxO0T+sQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/types": "^7.16.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@babel/helper-module-imports": {
|
"node_modules/@babel/helper-module-imports": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz",
|
||||||
@@ -173,45 +174,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helper-module-transforms": {
|
"node_modules/@babel/helper-module-transforms": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.5.tgz",
|
||||||
"integrity": "sha512-My4cr9ATcaBbmaEa8M0dZNA74cfI6gitvUAskgDtAFmAqyFKDSHQo5YstxPbN+lzHl2D9l/YOEFqb2mtUh4gfA==",
|
"integrity": "sha512-CkvMxgV4ZyyioElFwcuWnDCcNIeyqTkCm9BxXZi73RR1ozqlpboqsbGUNvRTflgZtFbbJ1v5Emvm+lkjMYY/LQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/helper-environment-visitor": "^7.16.5",
|
||||||
"@babel/helper-module-imports": "^7.16.0",
|
"@babel/helper-module-imports": "^7.16.0",
|
||||||
"@babel/helper-replace-supers": "^7.16.0",
|
|
||||||
"@babel/helper-simple-access": "^7.16.0",
|
"@babel/helper-simple-access": "^7.16.0",
|
||||||
"@babel/helper-split-export-declaration": "^7.16.0",
|
"@babel/helper-split-export-declaration": "^7.16.0",
|
||||||
"@babel/helper-validator-identifier": "^7.15.7",
|
"@babel/helper-validator-identifier": "^7.15.7",
|
||||||
"@babel/template": "^7.16.0",
|
"@babel/template": "^7.16.0",
|
||||||
"@babel/traverse": "^7.16.0",
|
"@babel/traverse": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@babel/helper-optimise-call-expression": {
|
|
||||||
"version": "7.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz",
|
|
||||||
"integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/types": "^7.16.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@babel/helper-replace-supers": {
|
|
||||||
"version": "7.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.0.tgz",
|
|
||||||
"integrity": "sha512-TQxuQfSCdoha7cpRNJvfaYxxxzmbxXw/+6cS7V02eeDYyhxderSoMVALvwupA54/pZcOTtVeJ0xccp1nGWladA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/helper-member-expression-to-functions": "^7.16.0",
|
|
||||||
"@babel/helper-optimise-call-expression": "^7.16.0",
|
|
||||||
"@babel/traverse": "^7.16.0",
|
|
||||||
"@babel/types": "^7.16.0"
|
"@babel/types": "^7.16.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -261,13 +235,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/helpers": {
|
"node_modules/@babel/helpers": {
|
||||||
"version": "7.16.3",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.5.tgz",
|
||||||
"integrity": "sha512-Xn8IhDlBPhvYTvgewPKawhADichOsbkZuzN7qz2BusOM0brChsyXMDJvldWaYMMUNiCQdQzNEioXTp3sC8Nt8w==",
|
"integrity": "sha512-TLgi6Lh71vvMZGEkFuIxzaPsyeYCHQ5jJOOX1f0xXn0uciFuE8cEk0wyBquMcCxBXZ5BJhE2aUB7pnWTD150Tw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/template": "^7.16.0",
|
"@babel/template": "^7.16.0",
|
||||||
"@babel/traverse": "^7.16.3",
|
"@babel/traverse": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0"
|
"@babel/types": "^7.16.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -351,9 +325,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/parser": {
|
"node_modules/@babel/parser": {
|
||||||
"version": "7.16.4",
|
"version": "7.16.6",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.6.tgz",
|
||||||
"integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==",
|
"integrity": "sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"parser": "bin/babel-parser.js"
|
"parser": "bin/babel-parser.js"
|
||||||
@@ -377,17 +351,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/traverse": {
|
"node_modules/@babel/traverse": {
|
||||||
"version": "7.16.3",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.5.tgz",
|
||||||
"integrity": "sha512-eolumr1vVMjqevCpwVO99yN/LoGL0EyHiLO5I043aYQvwOJ9eR5UsZSClHVCzfhBduMAsSzgA/6AyqPjNayJag==",
|
"integrity": "sha512-FOCODAzqUMROikDYLYxl4nmwiLlu85rNqBML/A5hKRVXG2LV8d0iMqgPzdYTcIpjZEBB7D6UDU9vxRZiriASdQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.16.0",
|
"@babel/code-frame": "^7.16.0",
|
||||||
"@babel/generator": "^7.16.0",
|
"@babel/generator": "^7.16.5",
|
||||||
|
"@babel/helper-environment-visitor": "^7.16.5",
|
||||||
"@babel/helper-function-name": "^7.16.0",
|
"@babel/helper-function-name": "^7.16.0",
|
||||||
"@babel/helper-hoist-variables": "^7.16.0",
|
"@babel/helper-hoist-variables": "^7.16.0",
|
||||||
"@babel/helper-split-export-declaration": "^7.16.0",
|
"@babel/helper-split-export-declaration": "^7.16.0",
|
||||||
"@babel/parser": "^7.16.3",
|
"@babel/parser": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0",
|
"@babel/types": "^7.16.0",
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
"globals": "^11.1.0"
|
"globals": "^11.1.0"
|
||||||
@@ -896,9 +871,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "16.11.12",
|
"version": "16.11.13",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.12.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.13.tgz",
|
||||||
"integrity": "sha512-+2Iggwg7PxoO5Kyhvsq9VarmPbIelXP070HMImEpbtGCoyWNINQj4wzjbQCXzdHTRXnqufutJb5KAURZANNBAw==",
|
"integrity": "sha512-eUXZzHLHoZqj1frtUetNkUetYoJ6X55UmrVnFD4DMhVeAmwLjniZhtBmsRiemQh4uq4G3vUra/Ws/hs9vEvL3Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/parse-json": {
|
"node_modules/@types/parse-json": {
|
||||||
@@ -1503,13 +1478,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/browserslist": {
|
"node_modules/browserslist": {
|
||||||
"version": "4.18.1",
|
"version": "4.19.1",
|
||||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz",
|
||||||
"integrity": "sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==",
|
"integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"caniuse-lite": "^1.0.30001280",
|
"caniuse-lite": "^1.0.30001286",
|
||||||
"electron-to-chromium": "^1.3.896",
|
"electron-to-chromium": "^1.4.17",
|
||||||
"escalade": "^3.1.1",
|
"escalade": "^3.1.1",
|
||||||
"node-releases": "^2.0.1",
|
"node-releases": "^2.0.1",
|
||||||
"picocolors": "^1.0.0"
|
"picocolors": "^1.0.0"
|
||||||
@@ -2108,9 +2083,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.4.17",
|
"version": "1.4.19",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.17.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.19.tgz",
|
||||||
"integrity": "sha512-zhk1MravPtq/KBhmGB7TLBILmXTgRG9TFSI3qS3DbgyfHzIl72iiTE37r/BHIbPCJJlWIo5rySyxiH4vWhu2ZA==",
|
"integrity": "sha512-TeAjwsC/vhvxEtX/xN1JQUMkl+UrwKXlB4rwLyuLYVuBuRtqJJrU4Jy5pCVihMQg4m1ceZ3MEJ0yYuxHj8vC+w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/email-addresses": {
|
"node_modules/email-addresses": {
|
||||||
@@ -6026,9 +6001,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.5.3",
|
"version": "4.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
|
||||||
"integrity": "sha512-eVYaEHALSt+s9LbvgEv4Ef+Tdq7hBiIZgii12xXJnukryt3pMgJf6aKhoCZ3FWQsu6sydEnkg11fYXLzhLBjeQ==",
|
"integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
@@ -6473,7 +6448,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/client": {
|
"packages/client": {
|
||||||
"version": "1.0.0",
|
"name": "@node-redis/client",
|
||||||
|
"version": "1.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cluster-key-slot": "1.1.0",
|
"cluster-key-slot": "1.1.0",
|
||||||
@@ -6504,7 +6480,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/json": {
|
"packages/json": {
|
||||||
"version": "1.0.0-rc.0",
|
"name": "@node-redis/json",
|
||||||
|
"version": "1.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
@@ -6522,7 +6499,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/search": {
|
"packages/search": {
|
||||||
"version": "1.0.0",
|
"name": "@node-redis/search",
|
||||||
|
"version": "1.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
@@ -6540,6 +6518,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/test-utils": {
|
"packages/test-utils": {
|
||||||
|
"name": "@node-redis/test-utils",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@types/mocha": "^9.0.0",
|
"@types/mocha": "^9.0.0",
|
||||||
@@ -6558,6 +6537,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/time-series": {
|
"packages/time-series": {
|
||||||
|
"name": "@node-redis/time-series",
|
||||||
"version": "1.0.0-rc.0",
|
"version": "1.0.0-rc.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -6593,19 +6573,19 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/core": {
|
"@babel/core": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.5.tgz",
|
||||||
"integrity": "sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ==",
|
"integrity": "sha512-wUcenlLzuWMZ9Zt8S0KmFwGlH6QKRh3vsm/dhDA3CHkiTA45YuG1XkHRcNRl73EFPXDp/d5kVOU0/y7x2w6OaQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.16.0",
|
"@babel/code-frame": "^7.16.0",
|
||||||
"@babel/generator": "^7.16.0",
|
"@babel/generator": "^7.16.5",
|
||||||
"@babel/helper-compilation-targets": "^7.16.0",
|
"@babel/helper-compilation-targets": "^7.16.3",
|
||||||
"@babel/helper-module-transforms": "^7.16.0",
|
"@babel/helper-module-transforms": "^7.16.5",
|
||||||
"@babel/helpers": "^7.16.0",
|
"@babel/helpers": "^7.16.5",
|
||||||
"@babel/parser": "^7.16.0",
|
"@babel/parser": "^7.16.5",
|
||||||
"@babel/template": "^7.16.0",
|
"@babel/template": "^7.16.0",
|
||||||
"@babel/traverse": "^7.16.0",
|
"@babel/traverse": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0",
|
"@babel/types": "^7.16.0",
|
||||||
"convert-source-map": "^1.7.0",
|
"convert-source-map": "^1.7.0",
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
@@ -6616,9 +6596,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/generator": {
|
"@babel/generator": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.5.tgz",
|
||||||
"integrity": "sha512-RR8hUCfRQn9j9RPKEVXo9LiwoxLPYn6hNZlvUOR8tSnaxlD0p0+la00ZP9/SnRt6HchKr+X0fO2r8vrETiJGew==",
|
"integrity": "sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/types": "^7.16.0",
|
"@babel/types": "^7.16.0",
|
||||||
@@ -6638,6 +6618,15 @@
|
|||||||
"semver": "^6.3.0"
|
"semver": "^6.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@babel/helper-environment-visitor": {
|
||||||
|
"version": "7.16.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.5.tgz",
|
||||||
|
"integrity": "sha512-ODQyc5AnxmZWm/R2W7fzhamOk1ey8gSguo5SGvF0zcB3uUzRpTRmM/jmLSm9bDMyPlvbyJ+PwPEK0BWIoZ9wjg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/types": "^7.16.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@babel/helper-function-name": {
|
"@babel/helper-function-name": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz",
|
||||||
@@ -6667,15 +6656,6 @@
|
|||||||
"@babel/types": "^7.16.0"
|
"@babel/types": "^7.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-member-expression-to-functions": {
|
|
||||||
"version": "7.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.0.tgz",
|
|
||||||
"integrity": "sha512-bsjlBFPuWT6IWhl28EdrQ+gTvSvj5tqVP5Xeftp07SEuz5pLnsXZuDkDD3Rfcxy0IsHmbZ+7B2/9SHzxO0T+sQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@babel/types": "^7.16.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@babel/helper-module-imports": {
|
"@babel/helper-module-imports": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.0",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz",
|
||||||
@@ -6686,39 +6666,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/helper-module-transforms": {
|
"@babel/helper-module-transforms": {
|
||||||
"version": "7.16.0",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.5.tgz",
|
||||||
"integrity": "sha512-My4cr9ATcaBbmaEa8M0dZNA74cfI6gitvUAskgDtAFmAqyFKDSHQo5YstxPbN+lzHl2D9l/YOEFqb2mtUh4gfA==",
|
"integrity": "sha512-CkvMxgV4ZyyioElFwcuWnDCcNIeyqTkCm9BxXZi73RR1ozqlpboqsbGUNvRTflgZtFbbJ1v5Emvm+lkjMYY/LQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@babel/helper-environment-visitor": "^7.16.5",
|
||||||
"@babel/helper-module-imports": "^7.16.0",
|
"@babel/helper-module-imports": "^7.16.0",
|
||||||
"@babel/helper-replace-supers": "^7.16.0",
|
|
||||||
"@babel/helper-simple-access": "^7.16.0",
|
"@babel/helper-simple-access": "^7.16.0",
|
||||||
"@babel/helper-split-export-declaration": "^7.16.0",
|
"@babel/helper-split-export-declaration": "^7.16.0",
|
||||||
"@babel/helper-validator-identifier": "^7.15.7",
|
"@babel/helper-validator-identifier": "^7.15.7",
|
||||||
"@babel/template": "^7.16.0",
|
"@babel/template": "^7.16.0",
|
||||||
"@babel/traverse": "^7.16.0",
|
"@babel/traverse": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@babel/helper-optimise-call-expression": {
|
|
||||||
"version": "7.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz",
|
|
||||||
"integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@babel/types": "^7.16.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@babel/helper-replace-supers": {
|
|
||||||
"version": "7.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.0.tgz",
|
|
||||||
"integrity": "sha512-TQxuQfSCdoha7cpRNJvfaYxxxzmbxXw/+6cS7V02eeDYyhxderSoMVALvwupA54/pZcOTtVeJ0xccp1nGWladA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"@babel/helper-member-expression-to-functions": "^7.16.0",
|
|
||||||
"@babel/helper-optimise-call-expression": "^7.16.0",
|
|
||||||
"@babel/traverse": "^7.16.0",
|
|
||||||
"@babel/types": "^7.16.0"
|
"@babel/types": "^7.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -6753,13 +6712,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/helpers": {
|
"@babel/helpers": {
|
||||||
"version": "7.16.3",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.5.tgz",
|
||||||
"integrity": "sha512-Xn8IhDlBPhvYTvgewPKawhADichOsbkZuzN7qz2BusOM0brChsyXMDJvldWaYMMUNiCQdQzNEioXTp3sC8Nt8w==",
|
"integrity": "sha512-TLgi6Lh71vvMZGEkFuIxzaPsyeYCHQ5jJOOX1f0xXn0uciFuE8cEk0wyBquMcCxBXZ5BJhE2aUB7pnWTD150Tw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/template": "^7.16.0",
|
"@babel/template": "^7.16.0",
|
||||||
"@babel/traverse": "^7.16.3",
|
"@babel/traverse": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0"
|
"@babel/types": "^7.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -6827,9 +6786,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/parser": {
|
"@babel/parser": {
|
||||||
"version": "7.16.4",
|
"version": "7.16.6",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.6.tgz",
|
||||||
"integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==",
|
"integrity": "sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@babel/template": {
|
"@babel/template": {
|
||||||
@@ -6844,17 +6803,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@babel/traverse": {
|
"@babel/traverse": {
|
||||||
"version": "7.16.3",
|
"version": "7.16.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.3.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.5.tgz",
|
||||||
"integrity": "sha512-eolumr1vVMjqevCpwVO99yN/LoGL0EyHiLO5I043aYQvwOJ9eR5UsZSClHVCzfhBduMAsSzgA/6AyqPjNayJag==",
|
"integrity": "sha512-FOCODAzqUMROikDYLYxl4nmwiLlu85rNqBML/A5hKRVXG2LV8d0iMqgPzdYTcIpjZEBB7D6UDU9vxRZiriASdQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.16.0",
|
"@babel/code-frame": "^7.16.0",
|
||||||
"@babel/generator": "^7.16.0",
|
"@babel/generator": "^7.16.5",
|
||||||
|
"@babel/helper-environment-visitor": "^7.16.5",
|
||||||
"@babel/helper-function-name": "^7.16.0",
|
"@babel/helper-function-name": "^7.16.0",
|
||||||
"@babel/helper-hoist-variables": "^7.16.0",
|
"@babel/helper-hoist-variables": "^7.16.0",
|
||||||
"@babel/helper-split-export-declaration": "^7.16.0",
|
"@babel/helper-split-export-declaration": "^7.16.0",
|
||||||
"@babel/parser": "^7.16.3",
|
"@babel/parser": "^7.16.5",
|
||||||
"@babel/types": "^7.16.0",
|
"@babel/types": "^7.16.0",
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
"globals": "^11.1.0"
|
"globals": "^11.1.0"
|
||||||
@@ -7355,9 +7315,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "16.11.12",
|
"version": "16.11.13",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.12.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.13.tgz",
|
||||||
"integrity": "sha512-+2Iggwg7PxoO5Kyhvsq9VarmPbIelXP070HMImEpbtGCoyWNINQj4wzjbQCXzdHTRXnqufutJb5KAURZANNBAw==",
|
"integrity": "sha512-eUXZzHLHoZqj1frtUetNkUetYoJ6X55UmrVnFD4DMhVeAmwLjniZhtBmsRiemQh4uq4G3vUra/Ws/hs9vEvL3Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/parse-json": {
|
"@types/parse-json": {
|
||||||
@@ -7793,13 +7753,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"version": "4.18.1",
|
"version": "4.19.1",
|
||||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz",
|
||||||
"integrity": "sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==",
|
"integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"caniuse-lite": "^1.0.30001280",
|
"caniuse-lite": "^1.0.30001286",
|
||||||
"electron-to-chromium": "^1.3.896",
|
"electron-to-chromium": "^1.4.17",
|
||||||
"escalade": "^3.1.1",
|
"escalade": "^3.1.1",
|
||||||
"node-releases": "^2.0.1",
|
"node-releases": "^2.0.1",
|
||||||
"picocolors": "^1.0.0"
|
"picocolors": "^1.0.0"
|
||||||
@@ -8240,9 +8200,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.4.17",
|
"version": "1.4.19",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.17.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.19.tgz",
|
||||||
"integrity": "sha512-zhk1MravPtq/KBhmGB7TLBILmXTgRG9TFSI3qS3DbgyfHzIl72iiTE37r/BHIbPCJJlWIo5rySyxiH4vWhu2ZA==",
|
"integrity": "sha512-TeAjwsC/vhvxEtX/xN1JQUMkl+UrwKXlB4rwLyuLYVuBuRtqJJrU4Jy5pCVihMQg4m1ceZ3MEJ0yYuxHj8vC+w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"email-addresses": {
|
"email-addresses": {
|
||||||
@@ -11149,9 +11109,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.5.3",
|
"version": "4.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
|
||||||
"integrity": "sha512-eVYaEHALSt+s9LbvgEv4Ef+Tdq7hBiIZgii12xXJnukryt3pMgJf6aKhoCZ3FWQsu6sydEnkg11fYXLzhLBjeQ==",
|
"integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"unique-string": {
|
"unique-string": {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import * as LinkedList from 'yallist';
|
import * as LinkedList from 'yallist';
|
||||||
import { AbortError } from '../errors';
|
import { AbortError } from '../errors';
|
||||||
import { RedisCommandArguments, RedisCommandRawReply } from '../commands';
|
import { RedisCommandArgument, RedisCommandArguments, RedisCommandRawReply } from '../commands';
|
||||||
|
|
||||||
// We need to use 'require', because it's not possible with Typescript to import
|
// We need to use 'require', because it's not possible with Typescript to import
|
||||||
// classes that are exported as 'module.exports = class`, without esModuleInterop
|
// classes that are exported as 'module.exports = class`, without esModuleInterop
|
||||||
@@ -40,8 +40,6 @@ export enum PubSubUnsubscribeCommands {
|
|||||||
PUNSUBSCRIBE = 'PUNSUBSCRIBE'
|
PUNSUBSCRIBE = 'PUNSUBSCRIBE'
|
||||||
}
|
}
|
||||||
|
|
||||||
type PubSubArgumentTypes = Buffer | string;
|
|
||||||
|
|
||||||
export type PubSubListener<
|
export type PubSubListener<
|
||||||
BUFFER_MODE extends boolean = false,
|
BUFFER_MODE extends boolean = false,
|
||||||
T = BUFFER_MODE extends true ? Buffer : string
|
T = BUFFER_MODE extends true ? Buffer : string
|
||||||
@@ -197,12 +195,12 @@ export default class RedisCommandsQueue {
|
|||||||
|
|
||||||
subscribe<T extends boolean>(
|
subscribe<T extends boolean>(
|
||||||
command: PubSubSubscribeCommands,
|
command: PubSubSubscribeCommands,
|
||||||
channels: PubSubArgumentTypes | Array<PubSubArgumentTypes>,
|
channels: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||||
listener: PubSubListener<T>,
|
listener: PubSubListener<T>,
|
||||||
bufferMode?: T
|
bufferMode?: T
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const pubSubState = this.#initiatePubSubState(),
|
const pubSubState = this.#initiatePubSubState(),
|
||||||
channelsToSubscribe: Array<PubSubArgumentTypes> = [],
|
channelsToSubscribe: Array<RedisCommandArgument> = [],
|
||||||
listenersMap = command === PubSubSubscribeCommands.SUBSCRIBE ? pubSubState.listeners.channels : pubSubState.listeners.patterns;
|
listenersMap = command === PubSubSubscribeCommands.SUBSCRIBE ? pubSubState.listeners.channels : pubSubState.listeners.patterns;
|
||||||
for (const channel of (Array.isArray(channels) ? channels : [channels])) {
|
for (const channel of (Array.isArray(channels) ? channels : [channels])) {
|
||||||
const channelString = typeof channel === 'string' ? channel : channel.toString();
|
const channelString = typeof channel === 'string' ? channel : channel.toString();
|
||||||
@@ -271,12 +269,12 @@ export default class RedisCommandsQueue {
|
|||||||
return this.#pushPubSubCommand(command, channelsToUnsubscribe);
|
return this.#pushPubSubCommand(command, channelsToUnsubscribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pushPubSubCommand(command: PubSubSubscribeCommands | PubSubUnsubscribeCommands, channels: number | Array<PubSubArgumentTypes>): Promise<void> {
|
#pushPubSubCommand(command: PubSubSubscribeCommands | PubSubUnsubscribeCommands, channels: number | Array<RedisCommandArgument>): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const pubSubState = this.#initiatePubSubState(),
|
const pubSubState = this.#initiatePubSubState(),
|
||||||
isSubscribe = command === PubSubSubscribeCommands.SUBSCRIBE || command === PubSubSubscribeCommands.PSUBSCRIBE,
|
isSubscribe = command === PubSubSubscribeCommands.SUBSCRIBE || command === PubSubSubscribeCommands.PSUBSCRIBE,
|
||||||
inProgressKey = isSubscribe ? 'subscribing' : 'unsubscribing',
|
inProgressKey = isSubscribe ? 'subscribing' : 'unsubscribing',
|
||||||
commandArgs: Array<PubSubArgumentTypes> = [command];
|
commandArgs: Array<RedisCommandArgument> = [command];
|
||||||
|
|
||||||
let channelsCounter: number;
|
let channelsCounter: number;
|
||||||
if (typeof channels === 'number') { // unsubscribe only
|
if (typeof channels === 'number') { // unsubscribe only
|
||||||
|
@@ -575,7 +575,7 @@ export default class RedisClient<M extends RedisModules, S extends RedisScripts>
|
|||||||
} while (cursor !== 0);
|
} while (cursor !== 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async* zScanIterator(key: string, options?: ScanOptions): AsyncIterable<ZMember> {
|
async* zScanIterator(key: string, options?: ScanOptions): AsyncIterable<ZMember<string>> {
|
||||||
let cursor = 0;
|
let cursor = 0;
|
||||||
do {
|
do {
|
||||||
const reply = await (this as any).zScan(key, cursor, options);
|
const reply = await (this as any).zScan(key, cursor, options);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import RedisClient, { InstantiableRedisClient, RedisClientType } from '../client';
|
import RedisClient, { InstantiableRedisClient, RedisClientType } from '../client';
|
||||||
import { RedisClusterMasterNode, RedisClusterReplicaNode } from '../commands/CLUSTER_NODES';
|
import { RedisClusterMasterNode, RedisClusterReplicaNode } from '../commands/CLUSTER_NODES';
|
||||||
import { RedisClusterClientOptions, RedisClusterOptions } from '.';
|
import { RedisClusterClientOptions, RedisClusterOptions } from '.';
|
||||||
import { RedisModules, RedisScripts } from '../commands';
|
import { RedisCommandArgument, RedisModules, RedisScripts } from '../commands';
|
||||||
|
|
||||||
// We need to use 'require', because it's not possible with Typescript to import
|
// We need to use 'require', because it's not possible with Typescript to import
|
||||||
// function that are exported as 'module.exports = function`, without esModuleInterop
|
// function that are exported as 'module.exports = function`, without esModuleInterop
|
||||||
@@ -202,7 +202,7 @@ export default class RedisClusterSlots<M extends RedisModules, S extends RedisSc
|
|||||||
return value.client;
|
return value.client;
|
||||||
}
|
}
|
||||||
|
|
||||||
getClient(firstKey?: string | Buffer, isReadonly?: boolean): RedisClientType<M, S> {
|
getClient(firstKey?: RedisCommandArgument, isReadonly?: boolean): RedisClientType<M, S> {
|
||||||
if (!firstKey) {
|
if (!firstKey) {
|
||||||
return this.#getRandomClient();
|
return this.#getRandomClient();
|
||||||
}
|
}
|
||||||
|
@@ -4,9 +4,13 @@ import * as BITCOUNT from '../commands/BITCOUNT';
|
|||||||
import * as BITFIELD from '../commands/BITFIELD';
|
import * as BITFIELD from '../commands/BITFIELD';
|
||||||
import * as BITOP from '../commands/BITOP';
|
import * as BITOP from '../commands/BITOP';
|
||||||
import * as BITPOS from '../commands/BITPOS';
|
import * as BITPOS from '../commands/BITPOS';
|
||||||
|
import * as BLMOVE_BUFFER from '../commands/BLMOVE_BUFFER';
|
||||||
import * as BLMOVE from '../commands/BLMOVE';
|
import * as BLMOVE from '../commands/BLMOVE';
|
||||||
|
import * as BLPOP_BUFFER from '../commands/BLPOP_BUFFER';
|
||||||
import * as BLPOP from '../commands/BLPOP';
|
import * as BLPOP from '../commands/BLPOP';
|
||||||
|
import * as BRPOP_BUFFER from '../commands/BRPOP_BUFFER';
|
||||||
import * as BRPOP from '../commands/BRPOP';
|
import * as BRPOP from '../commands/BRPOP';
|
||||||
|
import * as BRPOPLPUSH_BUFFER from '../commands/BRPOPLPUSH_BUFFER';
|
||||||
import * as BRPOPLPUSH from '../commands/BRPOPLPUSH';
|
import * as BRPOPLPUSH from '../commands/BRPOPLPUSH';
|
||||||
import * as BZPOPMAX from '../commands/BZPOPMAX';
|
import * as BZPOPMAX from '../commands/BZPOPMAX';
|
||||||
import * as BZPOPMIN from '../commands/BZPOPMIN';
|
import * as BZPOPMIN from '../commands/BZPOPMIN';
|
||||||
@@ -36,13 +40,16 @@ import * as GETRANGE from '../commands/GETRANGE';
|
|||||||
import * as GETSET from '../commands/GETSET';
|
import * as GETSET from '../commands/GETSET';
|
||||||
import * as HDEL from '../commands/HDEL';
|
import * as HDEL from '../commands/HDEL';
|
||||||
import * as HEXISTS from '../commands/HEXISTS';
|
import * as HEXISTS from '../commands/HEXISTS';
|
||||||
|
import * as HGET_BUFFER from '../commands/HGET_BUFFER';
|
||||||
import * as HGET from '../commands/HGET';
|
import * as HGET from '../commands/HGET';
|
||||||
|
import * as HGETALL_BUFFER from '../commands/HGETALL_BUFFER';
|
||||||
import * as HGETALL from '../commands/HGETALL';
|
import * as HGETALL from '../commands/HGETALL';
|
||||||
import * as HINCRBY from '../commands/HINCRBY';
|
import * as HINCRBY from '../commands/HINCRBY';
|
||||||
import * as HINCRBYFLOAT from '../commands/HINCRBYFLOAT';
|
import * as HINCRBYFLOAT from '../commands/HINCRBYFLOAT';
|
||||||
import * as HKEYS from '../commands/HKEYS';
|
import * as HKEYS from '../commands/HKEYS';
|
||||||
import * as HLEN from '../commands/HLEN';
|
import * as HLEN from '../commands/HLEN';
|
||||||
import * as HMGET from '../commands/HMGET';
|
import * as HMGET from '../commands/HMGET';
|
||||||
|
import * as HRANDFIELD_COUNT_WITHVALUES_BUFFER from '../commands/HRANDFIELD_COUNT_WITHVALUES_BUFFER';
|
||||||
import * as HRANDFIELD_COUNT_WITHVALUES from '../commands/HRANDFIELD_COUNT_WITHVALUES';
|
import * as HRANDFIELD_COUNT_WITHVALUES from '../commands/HRANDFIELD_COUNT_WITHVALUES';
|
||||||
import * as HRANDFIELD_COUNT from '../commands/HRANDFIELD_COUNT';
|
import * as HRANDFIELD_COUNT from '../commands/HRANDFIELD_COUNT';
|
||||||
import * as HRANDFIELD from '../commands/HRANDFIELD';
|
import * as HRANDFIELD from '../commands/HRANDFIELD';
|
||||||
@@ -119,10 +126,14 @@ import * as UNLINK from '../commands/UNLINK';
|
|||||||
import * as WATCH from '../commands/WATCH';
|
import * as WATCH from '../commands/WATCH';
|
||||||
import * as XACK from '../commands/XACK';
|
import * as XACK from '../commands/XACK';
|
||||||
import * as XADD from '../commands/XADD';
|
import * as XADD from '../commands/XADD';
|
||||||
|
import * as XAUTOCLAIM_JUSTID_BUFFER from '../commands/XAUTOCLAIM_JUSTID_BUFFER';
|
||||||
|
import * as XAUTOCLAIM_BUFFER from '../commands/XAUTOCLAIM_BUFFER';
|
||||||
import * as XAUTOCLAIM_JUSTID from '../commands/XAUTOCLAIM_JUSTID';
|
import * as XAUTOCLAIM_JUSTID from '../commands/XAUTOCLAIM_JUSTID';
|
||||||
import * as XAUTOCLAIM from '../commands/XAUTOCLAIM';
|
import * as XAUTOCLAIM from '../commands/XAUTOCLAIM';
|
||||||
import * as XCLAIM from '../commands/XCLAIM';
|
import * as XCLAIM_JUSTID_BUFFER from '../commands/XCLAIM_JUSTID_BUFFER';
|
||||||
|
import * as XCLAIM_BUFFER from '../commands/XCLAIM_BUFFER';
|
||||||
import * as XCLAIM_JUSTID from '../commands/XCLAIM_JUSTID';
|
import * as XCLAIM_JUSTID from '../commands/XCLAIM_JUSTID';
|
||||||
|
import * as XCLAIM from '../commands/XCLAIM';
|
||||||
import * as XDEL from '../commands/XDEL';
|
import * as XDEL from '../commands/XDEL';
|
||||||
import * as XGROUP_CREATE from '../commands/XGROUP_CREATE';
|
import * as XGROUP_CREATE from '../commands/XGROUP_CREATE';
|
||||||
import * as XGROUP_CREATECONSUMER from '../commands/XGROUP_CREATECONSUMER';
|
import * as XGROUP_CREATECONSUMER from '../commands/XGROUP_CREATECONSUMER';
|
||||||
@@ -135,9 +146,13 @@ import * as XINFO_STREAM from '../commands/XINFO_STREAM';
|
|||||||
import * as XLEN from '../commands/XLEN';
|
import * as XLEN from '../commands/XLEN';
|
||||||
import * as XPENDING_RANGE from '../commands/XPENDING_RANGE';
|
import * as XPENDING_RANGE from '../commands/XPENDING_RANGE';
|
||||||
import * as XPENDING from '../commands/XPENDING';
|
import * as XPENDING from '../commands/XPENDING';
|
||||||
|
import * as XRANGE_BUFFER from '../commands/XRANGE_BUFFER';
|
||||||
import * as XRANGE from '../commands/XRANGE';
|
import * as XRANGE from '../commands/XRANGE';
|
||||||
|
import * as XREAD_BUFFER from '../commands/XREAD_BUFFER';
|
||||||
import * as XREAD from '../commands/XREAD';
|
import * as XREAD from '../commands/XREAD';
|
||||||
|
import * as XREADGROUP_BUFFER from '../commands/XREADGROUP_BUFFER';
|
||||||
import * as XREADGROUP from '../commands/XREADGROUP';
|
import * as XREADGROUP from '../commands/XREADGROUP';
|
||||||
|
import * as XREVRANGE_BUFFER from '../commands/XREVRANGE_BUFFER';
|
||||||
import * as XREVRANGE from '../commands/XREVRANGE';
|
import * as XREVRANGE from '../commands/XREVRANGE';
|
||||||
import * as XTRIM from '../commands/XTRIM';
|
import * as XTRIM from '../commands/XTRIM';
|
||||||
import * as ZADD from '../commands/ZADD';
|
import * as ZADD from '../commands/ZADD';
|
||||||
@@ -188,12 +203,20 @@ export default {
|
|||||||
bitOp: BITOP,
|
bitOp: BITOP,
|
||||||
BITPOS,
|
BITPOS,
|
||||||
bitPos: BITPOS,
|
bitPos: BITPOS,
|
||||||
|
BLMOVE_BUFFER,
|
||||||
|
blMoveBuffer: BLMOVE_BUFFER,
|
||||||
BLMOVE,
|
BLMOVE,
|
||||||
blMove: BLMOVE,
|
blMove: BLMOVE,
|
||||||
|
BLPOP_BUFFER,
|
||||||
|
blPopBuffer: BLPOP_BUFFER,
|
||||||
BLPOP,
|
BLPOP,
|
||||||
blPop: BLPOP,
|
blPop: BLPOP,
|
||||||
|
BRPOP_BUFFER,
|
||||||
|
brPopBuffer: BRPOP_BUFFER,
|
||||||
BRPOP,
|
BRPOP,
|
||||||
brPop: BRPOP,
|
brPop: BRPOP,
|
||||||
|
BRPOPLPUSH_BUFFER,
|
||||||
|
brPopLPushBuffer: BRPOPLPUSH_BUFFER,
|
||||||
BRPOPLPUSH,
|
BRPOPLPUSH,
|
||||||
brPopLPush: BRPOPLPUSH,
|
brPopLPush: BRPOPLPUSH,
|
||||||
BZPOPMAX,
|
BZPOPMAX,
|
||||||
@@ -252,8 +275,12 @@ export default {
|
|||||||
hDel: HDEL,
|
hDel: HDEL,
|
||||||
HEXISTS,
|
HEXISTS,
|
||||||
hExists: HEXISTS,
|
hExists: HEXISTS,
|
||||||
|
HGET_BUFFER,
|
||||||
|
hGetBuffer: HGET_BUFFER,
|
||||||
HGET,
|
HGET,
|
||||||
hGet: HGET,
|
hGet: HGET,
|
||||||
|
HGETALL_BUFFER,
|
||||||
|
hGetAllBuffer: HGETALL_BUFFER,
|
||||||
HGETALL,
|
HGETALL,
|
||||||
hGetAll: HGETALL,
|
hGetAll: HGETALL,
|
||||||
HINCRBY,
|
HINCRBY,
|
||||||
@@ -266,6 +293,8 @@ export default {
|
|||||||
hLen: HLEN,
|
hLen: HLEN,
|
||||||
HMGET,
|
HMGET,
|
||||||
hmGet: HMGET,
|
hmGet: HMGET,
|
||||||
|
HRANDFIELD_COUNT_WITHVALUES_BUFFER,
|
||||||
|
hRandFieldCountWithValuesBuffer: HRANDFIELD_COUNT_WITHVALUES_BUFFER,
|
||||||
HRANDFIELD_COUNT_WITHVALUES,
|
HRANDFIELD_COUNT_WITHVALUES,
|
||||||
hRandFieldCountWithValues: HRANDFIELD_COUNT_WITHVALUES,
|
hRandFieldCountWithValues: HRANDFIELD_COUNT_WITHVALUES,
|
||||||
HRANDFIELD_COUNT,
|
HRANDFIELD_COUNT,
|
||||||
@@ -418,12 +447,20 @@ export default {
|
|||||||
xAck: XACK,
|
xAck: XACK,
|
||||||
XADD,
|
XADD,
|
||||||
xAdd: XADD,
|
xAdd: XADD,
|
||||||
|
XAUTOCLAIM_JUSTID_BUFFER,
|
||||||
|
xAutoClaimJustIdBuffer: XAUTOCLAIM_JUSTID_BUFFER,
|
||||||
|
XAUTOCLAIM_BUFFER,
|
||||||
|
xAutoClaimBuffer: XAUTOCLAIM_BUFFER,
|
||||||
XAUTOCLAIM_JUSTID,
|
XAUTOCLAIM_JUSTID,
|
||||||
xAutoClaimJustId: XAUTOCLAIM_JUSTID,
|
xAutoClaimJustId: XAUTOCLAIM_JUSTID,
|
||||||
XAUTOCLAIM,
|
XAUTOCLAIM,
|
||||||
xAutoClaim: XAUTOCLAIM,
|
xAutoClaim: XAUTOCLAIM,
|
||||||
XCLAIM,
|
XCLAIM,
|
||||||
xClaim: XCLAIM,
|
xClaim: XCLAIM,
|
||||||
|
XCLAIM_JUSTID_BUFFER,
|
||||||
|
xClaimJustIdBuffer: XCLAIM_JUSTID_BUFFER,
|
||||||
|
XCLAIM_BUFFER,
|
||||||
|
xClaimBuffer: XCLAIM_BUFFER,
|
||||||
XCLAIM_JUSTID,
|
XCLAIM_JUSTID,
|
||||||
xClaimJustId: XCLAIM_JUSTID,
|
xClaimJustId: XCLAIM_JUSTID,
|
||||||
XDEL,
|
XDEL,
|
||||||
@@ -450,12 +487,20 @@ export default {
|
|||||||
xPendingRange: XPENDING_RANGE,
|
xPendingRange: XPENDING_RANGE,
|
||||||
XPENDING,
|
XPENDING,
|
||||||
xPending: XPENDING,
|
xPending: XPENDING,
|
||||||
|
XRANGE_BUFFER,
|
||||||
|
xRangeBuffer: XRANGE_BUFFER,
|
||||||
XRANGE,
|
XRANGE,
|
||||||
xRange: XRANGE,
|
xRange: XRANGE,
|
||||||
|
XREAD_BUFFER,
|
||||||
|
xReadBuffer: XREAD_BUFFER,
|
||||||
XREAD,
|
XREAD,
|
||||||
xRead: XREAD,
|
xRead: XREAD,
|
||||||
|
XREADGROUP_BUFFER,
|
||||||
|
xReadGroupBuffer: XREADGROUP_BUFFER,
|
||||||
XREADGROUP,
|
XREADGROUP,
|
||||||
xReadGroup: XREADGROUP,
|
xReadGroup: XREADGROUP,
|
||||||
|
XREVRANGE_BUFFER,
|
||||||
|
xRevRangeBuffer: XREVRANGE_BUFFER,
|
||||||
XREVRANGE,
|
XREVRANGE,
|
||||||
xRevRange: XREVRANGE,
|
xRevRange: XREVRANGE,
|
||||||
XTRIM,
|
XTRIM,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import COMMANDS from './commands';
|
import COMMANDS from './commands';
|
||||||
import { RedisCommand, RedisCommandArguments, RedisCommandReply, RedisModules, RedisPlugins, RedisScript, RedisScripts } from '../commands';
|
import { RedisCommand, RedisCommandArgument, RedisCommandArguments, RedisCommandReply, RedisModules, RedisPlugins, RedisScript, RedisScripts } from '../commands';
|
||||||
import { ClientCommandOptions, RedisClientCommandSignature, RedisClientOptions, RedisClientType, WithModules, WithScripts } from '../client';
|
import { ClientCommandOptions, RedisClientCommandSignature, RedisClientOptions, RedisClientType, WithModules, WithScripts } from '../client';
|
||||||
import RedisClusterSlots, { ClusterNode } from './cluster-slots';
|
import RedisClusterSlots, { ClusterNode } from './cluster-slots';
|
||||||
import { extendWithModulesAndScripts, transformCommandArguments, transformCommandReply, extendWithCommands } from '../commander';
|
import { extendWithModulesAndScripts, transformCommandArguments, transformCommandReply, extendWithCommands } from '../commander';
|
||||||
@@ -24,7 +24,7 @@ export type RedisClusterType<M extends RedisModules = Record<string, never>, S e
|
|||||||
RedisCluster<M, S> & WithCommands & WithModules<M> & WithScripts<S>;
|
RedisCluster<M, S> & WithCommands & WithModules<M> & WithScripts<S>;
|
||||||
|
|
||||||
export default class RedisCluster<M extends RedisModules = Record<string, never>, S extends RedisScripts = Record<string, never>> extends EventEmitter {
|
export default class RedisCluster<M extends RedisModules = Record<string, never>, S extends RedisScripts = Record<string, never>> extends EventEmitter {
|
||||||
static extractFirstKey(command: RedisCommand, originalArgs: Array<unknown>, redisArgs: RedisCommandArguments): string | Buffer | undefined {
|
static extractFirstKey(command: RedisCommand, originalArgs: Array<unknown>, redisArgs: RedisCommandArguments): RedisCommandArgument | undefined {
|
||||||
if (command.FIRST_KEY_INDEX === undefined) {
|
if (command.FIRST_KEY_INDEX === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
} else if (typeof command.FIRST_KEY_INDEX === 'number') {
|
} else if (typeof command.FIRST_KEY_INDEX === 'number') {
|
||||||
@@ -84,7 +84,7 @@ export default class RedisCluster<M extends RedisModules = Record<string, never>
|
|||||||
}
|
}
|
||||||
|
|
||||||
async sendCommand<C extends RedisCommand>(
|
async sendCommand<C extends RedisCommand>(
|
||||||
firstKey: string | Buffer | undefined,
|
firstKey: RedisCommandArgument | undefined,
|
||||||
isReadonly: boolean | undefined,
|
isReadonly: boolean | undefined,
|
||||||
args: RedisCommandArguments,
|
args: RedisCommandArguments,
|
||||||
options?: ClientCommandOptions,
|
options?: ClientCommandOptions,
|
||||||
@@ -175,9 +175,9 @@ export default class RedisCluster<M extends RedisModules = Record<string, never>
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
multi(routing?: string | Buffer): RedisClusterMultiCommandType<M, S> {
|
multi(routing?: RedisCommandArgument): RedisClusterMultiCommandType<M, S> {
|
||||||
return new this.#Multi(
|
return new this.#Multi(
|
||||||
async (commands: Array<RedisMultiQueuedCommand>, firstKey?: string | Buffer, chainId?: symbol) => {
|
async (commands: Array<RedisMultiQueuedCommand>, firstKey?: RedisCommandArgument, chainId?: symbol) => {
|
||||||
return this.#slots
|
return this.#slots
|
||||||
.getClient(firstKey)
|
.getClient(firstKey)
|
||||||
.multiExecutor(commands, chainId);
|
.multiExecutor(commands, chainId);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import COMMANDS from './commands';
|
import COMMANDS from './commands';
|
||||||
import { RedisCommand, RedisCommandArguments, RedisCommandRawReply, RedisModules, RedisPlugins, RedisScript, RedisScripts } from '../commands';
|
import { RedisCommand, RedisCommandArgument, RedisCommandArguments, RedisCommandRawReply, RedisModules, RedisPlugins, RedisScript, RedisScripts } from '../commands';
|
||||||
import RedisMultiCommand, { RedisMultiQueuedCommand } from '../multi-command';
|
import RedisMultiCommand, { RedisMultiQueuedCommand } from '../multi-command';
|
||||||
import { extendWithCommands, extendWithModulesAndScripts } from '../commander';
|
import { extendWithCommands, extendWithModulesAndScripts } from '../commander';
|
||||||
import RedisCluster from '.';
|
import RedisCluster from '.';
|
||||||
@@ -24,12 +24,12 @@ type WithScripts<M extends RedisModules, S extends RedisScripts> = {
|
|||||||
export type RedisClusterMultiCommandType<M extends RedisModules = Record<string, never>, S extends RedisScripts = Record<string, never>> =
|
export type RedisClusterMultiCommandType<M extends RedisModules = Record<string, never>, S extends RedisScripts = Record<string, never>> =
|
||||||
RedisClusterMultiCommand & WithCommands<M, S> & WithModules<M, S> & WithScripts<M, S>;
|
RedisClusterMultiCommand & WithCommands<M, S> & WithModules<M, S> & WithScripts<M, S>;
|
||||||
|
|
||||||
export type RedisClusterMultiExecutor = (queue: Array<RedisMultiQueuedCommand>, firstKey?: string | Buffer, chainId?: symbol) => Promise<Array<RedisCommandRawReply>>;
|
export type RedisClusterMultiExecutor = (queue: Array<RedisMultiQueuedCommand>, firstKey?: RedisCommandArgument, chainId?: symbol) => Promise<Array<RedisCommandRawReply>>;
|
||||||
|
|
||||||
export default class RedisClusterMultiCommand {
|
export default class RedisClusterMultiCommand {
|
||||||
readonly #multi = new RedisMultiCommand();
|
readonly #multi = new RedisMultiCommand();
|
||||||
readonly #executor: RedisClusterMultiExecutor;
|
readonly #executor: RedisClusterMultiExecutor;
|
||||||
#firstKey: string | Buffer | undefined;
|
#firstKey: RedisCommandArgument | undefined;
|
||||||
|
|
||||||
static extend<M extends RedisModules, S extends RedisScripts>(
|
static extend<M extends RedisModules, S extends RedisScripts>(
|
||||||
plugins?: RedisPlugins<M, S>
|
plugins?: RedisPlugins<M, S>
|
||||||
@@ -43,7 +43,7 @@ export default class RedisClusterMultiCommand {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(executor: RedisClusterMultiExecutor, firstKey?: string | Buffer) {
|
constructor(executor: RedisClusterMultiExecutor, firstKey?: RedisCommandArgument) {
|
||||||
this.#executor = executor;
|
this.#executor = executor;
|
||||||
this.#firstKey = firstKey;
|
this.#firstKey = firstKey;
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ export default class RedisClusterMultiCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addCommand(
|
addCommand(
|
||||||
firstKey: string | Buffer | undefined,
|
firstKey: RedisCommandArgument | undefined,
|
||||||
args: RedisCommandArguments,
|
args: RedisCommandArguments,
|
||||||
transformReply?: RedisCommand['transformReply']
|
transformReply?: RedisCommand['transformReply']
|
||||||
): this {
|
): this {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { CommandOptions, isCommandOptions } from './command-options';
|
import { CommandOptions, isCommandOptions } from './command-options';
|
||||||
import { RedisCommand, RedisCommandArguments, RedisCommandRawReply, RedisCommandReply, RedisCommands, RedisModules, RedisScript, RedisScripts } from './commands';
|
import { RedisCommand, RedisCommandArgument, RedisCommandArguments, RedisCommandRawReply, RedisCommandReply, RedisCommands, RedisModules, RedisScript, RedisScripts } from './commands';
|
||||||
|
|
||||||
type Instantiable<T = any> = new(...args: Array<any>) => T;
|
type Instantiable<T = any> = new(...args: Array<any>) => T;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ export function transformCommandArguments<T = unknown>(
|
|||||||
|
|
||||||
const DELIMITER = '\r\n';
|
const DELIMITER = '\r\n';
|
||||||
|
|
||||||
export function* encodeCommand(args: RedisCommandArguments): IterableIterator<string | Buffer> {
|
export function* encodeCommand(args: RedisCommandArguments): IterableIterator<RedisCommandArgument> {
|
||||||
let strings = `*${args.length}${DELIMITER}`,
|
let strings = `*${args.length}${DELIMITER}`,
|
||||||
stringsLength = 0;
|
stringsLength = 0;
|
||||||
for (const arg of args) {
|
for (const arg of args) {
|
||||||
|
@@ -1,7 +1,12 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(key: string, value: string): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
value: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['APPEND', key, value];
|
return ['APPEND', key, value];
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare function transformReply(): string;
|
export declare function transformReply(): number;
|
||||||
|
@@ -1,14 +1,15 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
import { LMoveSide } from './LMOVE';
|
import { LMoveSide } from './LMOVE';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(
|
export function transformArguments(
|
||||||
source: string,
|
source: RedisCommandArgument,
|
||||||
destination: string,
|
destination: RedisCommandArgument,
|
||||||
sourceDirection: LMoveSide,
|
sourceDirection: LMoveSide,
|
||||||
destinationDirection: LMoveSide,
|
destinationDirection: LMoveSide,
|
||||||
timeout: number
|
timeout: number
|
||||||
): Array<string> {
|
): RedisCommandArguments {
|
||||||
return [
|
return [
|
||||||
'BLMOVE',
|
'BLMOVE',
|
||||||
source,
|
source,
|
||||||
|
5
packages/client/lib/commands/BLMOVE_BUFFER.ts
Normal file
5
packages/client/lib/commands/BLMOVE_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './BLMOVE';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export declare function transformReply(): Buffer | null;
|
@@ -1,9 +1,12 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
import { pushVerdictArguments } from './generic-transformers';
|
import { pushVerdictArguments } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(keys: string | Buffer | Array<string | Buffer>, timeout: number): RedisCommandArguments {
|
export function transformArguments(
|
||||||
|
keys: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||||
|
timeout: number
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = pushVerdictArguments(['BLPOP'], keys);
|
const args = pushVerdictArguments(['BLPOP'], keys);
|
||||||
|
|
||||||
args.push(timeout.toString());
|
args.push(timeout.toString());
|
||||||
@@ -11,12 +14,12 @@ export function transformArguments(keys: string | Buffer | Array<string | Buffer
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
type BLPOPReply = null | {
|
type BLPopReply = null | {
|
||||||
key: string;
|
key: string;
|
||||||
element: string;
|
element: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function transformReply(reply: null | [string, string]): BLPOPReply {
|
export function transformReply(reply: null | [string, string]): BLPopReply {
|
||||||
if (reply === null) return null;
|
if (reply === null) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
17
packages/client/lib/commands/BLPOP_BUFFER.ts
Normal file
17
packages/client/lib/commands/BLPOP_BUFFER.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './BLPOP';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
type BLPopBufferReply = null | {
|
||||||
|
key: Buffer;
|
||||||
|
element: Buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function transformReply(reply: null | [Buffer, Buffer]): BLPopBufferReply {
|
||||||
|
if (reply === null) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
key: reply[0],
|
||||||
|
element: reply[1]
|
||||||
|
};
|
||||||
|
}
|
@@ -11,16 +11,4 @@ export function transformArguments(key: string | Array<string>, timeout: number)
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
type BRPOPReply = null | {
|
export { transformReply } from './BLPOP';
|
||||||
key: string;
|
|
||||||
element: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function transformReply(reply: null | [string, string]): BRPOPReply {
|
|
||||||
if (reply === null) return null;
|
|
||||||
|
|
||||||
return {
|
|
||||||
key: reply[0],
|
|
||||||
element: reply[1]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
@@ -1,7 +1,13 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(source: string, destination: string, timeout: number): Array<string> {
|
export function transformArguments(
|
||||||
|
source: RedisCommandArgument,
|
||||||
|
destination: RedisCommandArgument,
|
||||||
|
timeout: number
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['BRPOPLPUSH', source, destination, timeout.toString()];
|
return ['BRPOPLPUSH', source, destination, timeout.toString()];
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare function transformReply(): number | null;
|
export declare function transformReply(): string | null;
|
||||||
|
5
packages/client/lib/commands/BRPOPLPUSH_BUFFER.ts
Normal file
5
packages/client/lib/commands/BRPOPLPUSH_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './BRPOPLPUSH';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export declare function transformReply(): Buffer | null;
|
3
packages/client/lib/commands/BRPOP_BUFFER.ts
Normal file
3
packages/client/lib/commands/BRPOP_BUFFER.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './BRPOP';
|
||||||
|
|
||||||
|
export { BUFFER_MODE, transformReply } from './BLPOP_BUFFER';
|
@@ -1,9 +1,12 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers';
|
import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(key: string | Array<string>, timeout: number): RedisCommandArguments {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||||
|
timeout: number
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = pushVerdictArguments(['BZPOPMAX'], key);
|
const args = pushVerdictArguments(['BZPOPMAX'], key);
|
||||||
|
|
||||||
args.push(timeout.toString());
|
args.push(timeout.toString());
|
||||||
@@ -11,7 +14,7 @@ export function transformArguments(key: string | Array<string>, timeout: number)
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ZMemberWithKey extends ZMember {
|
interface ZMemberWithKey extends ZMember<string> {
|
||||||
key: string;
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ export function transformArguments(key: string | Array<string>, timeout: number)
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ZMemberWithKey extends ZMember {
|
interface ZMemberWithKey extends ZMember<string> {
|
||||||
key: string;
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,4 +2,4 @@ export function transformArguments(parameter: string): Array<string> {
|
|||||||
return ['CONFIG', 'GET', parameter];
|
return ['CONFIG', 'GET', parameter];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyTuples as transformReply } from './generic-transformers';
|
export { transformReplyStringTuples as transformReply } from './generic-transformers';
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string | Buffer): RedisCommandArguments {
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
return ['GET', key];
|
return ['GET', key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,14 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(key: string, field: string): Array<string> {
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
field: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['HGET', key, field];
|
return ['HGET', key, field];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReply(reply?: string): string | undefined {
|
export declare function transformReply(): string | undefined;
|
||||||
return reply;
|
|
||||||
}
|
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string): Array<string> {
|
export function transformArguments(key: string): Array<string> {
|
||||||
return ['HGETALL', key];
|
return ['HGETALL', key];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyTuples as transformReply } from './generic-transformers';
|
export { transformReplyStringTuples as transformReply } from './generic-transformers';
|
||||||
|
5
packages/client/lib/commands/HGETALL_BUFFER.ts
Normal file
5
packages/client/lib/commands/HGETALL_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './HGETALL';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export { transformReplyBufferTuples as transformReply } from './generic-transformers';
|
5
packages/client/lib/commands/HGET_BUFFER.ts
Normal file
5
packages/client/lib/commands/HGET_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './HGET';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export declare function transformReply(): Buffer | undefined;
|
@@ -1,5 +1,7 @@
|
|||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string): Array<string> {
|
export function transformArguments(key: string): Array<string> {
|
||||||
return ['HRANDFIELD', key];
|
return ['HRANDFIELD', key];
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { transformArguments as transformHRandFieldArguments } from './HRANDFIELD';
|
import { transformArguments as transformHRandFieldArguments } from './HRANDFIELD';
|
||||||
|
|
||||||
export { FIRST_KEY_INDEX } from './HRANDFIELD';
|
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './HRANDFIELD';
|
||||||
|
|
||||||
export function transformArguments(key: string, count: number): Array<string> {
|
export function transformArguments(key: string, count: number): Array<string> {
|
||||||
return [
|
return [
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { transformArguments as transformHRandFieldCountArguments } from './HRANDFIELD_COUNT';
|
import { transformArguments as transformHRandFieldCountArguments } from './HRANDFIELD_COUNT';
|
||||||
|
|
||||||
export { FIRST_KEY_INDEX } from './HRANDFIELD_COUNT';
|
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './HRANDFIELD_COUNT';
|
||||||
|
|
||||||
export function transformArguments(key: string, count: number): Array<string> {
|
export function transformArguments(key: string, count: number): Array<string> {
|
||||||
return [
|
return [
|
||||||
@@ -9,4 +9,4 @@ export function transformArguments(key: string, count: number): Array<string> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyTuples as transformReply } from './generic-transformers';
|
export { transformReplyStringTuples as transformReply } from './generic-transformers';
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './HRANDFIELD_COUNT';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export { transformReplyBufferTuples as transformReply } from './generic-transformers';
|
@@ -1,4 +1,4 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
type Types = string | number | Buffer;
|
type Types = string | number | Buffer;
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ type HSETTuples = Array<[Types, Types]> | Array<Types>;
|
|||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
type GenericArguments = [key: string | Buffer];
|
type GenericArguments = [key: RedisCommandArgument];
|
||||||
|
|
||||||
type SingleFieldArguments = [...generic: GenericArguments, field: Types, value: Types];
|
type SingleFieldArguments = [...generic: GenericArguments, field: Types, value: Types];
|
||||||
|
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export function transformArguments(channel: string | Buffer, message: string | Buffer): RedisCommandArguments {
|
export function transformArguments(
|
||||||
|
channel: RedisCommandArgument,
|
||||||
|
message: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['PUBLISH', channel, message];
|
return ['PUBLISH', channel, message];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
@@ -24,7 +24,11 @@ interface SetCommonOptions {
|
|||||||
|
|
||||||
type SetOptions = SetTTL & SetGuards & SetCommonOptions;
|
type SetOptions = SetTTL & SetGuards & SetCommonOptions;
|
||||||
|
|
||||||
export function transformArguments(key: string | Buffer, value: string | number | Buffer, options?: SetOptions): RedisCommandArguments {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
value: RedisCommandArgument | number,
|
||||||
|
options?: SetOptions
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = [
|
const args = [
|
||||||
'SET',
|
'SET',
|
||||||
key,
|
key,
|
||||||
|
@@ -1,8 +1,12 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(key: string | Buffer, seconds: number, value: string): RedisCommandArguments {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
seconds: number,
|
||||||
|
value: string
|
||||||
|
): RedisCommandArguments {
|
||||||
return [
|
return [
|
||||||
'SETEX',
|
'SETEX',
|
||||||
key,
|
key,
|
||||||
|
@@ -1,9 +1,13 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
import { pushVerdictArguments } from './generic-transformers';
|
import { pushVerdictArguments } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string, id: string | Array<string>): RedisCommandArguments {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument,
|
||||||
|
id: RedisCommandArgument | Array<RedisCommandArgument>
|
||||||
|
): RedisCommandArguments {
|
||||||
return pushVerdictArguments(['XACK', key, group], id);
|
return pushVerdictArguments(['XACK', key, group], id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { TuplesObject } from './generic-transformers';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
@@ -9,10 +9,15 @@ interface XAddOptions {
|
|||||||
strategyModifier?: '=' | '~';
|
strategyModifier?: '=' | '~';
|
||||||
threshold: number;
|
threshold: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(key: string, id: string, message: TuplesObject, options?: XAddOptions): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
id: RedisCommandArgument,
|
||||||
|
message: Record<string, RedisCommandArgument>,
|
||||||
|
options?: XAddOptions
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = ['XADD', key];
|
const args = ['XADD', key];
|
||||||
|
|
||||||
if (options?.NOMKSTREAM) {
|
if (options?.NOMKSTREAM) {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { StreamMessagesReply, transformReplyStreamMessages } from './generic-transformers';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
import { StreamStringsMessagesReply, transformReplyStreamStringMessages } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
@@ -7,13 +8,13 @@ export interface XAutoClaimOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(
|
export function transformArguments(
|
||||||
key: string,
|
key: RedisCommandArgument,
|
||||||
group: string,
|
group: RedisCommandArgument,
|
||||||
consumer: string,
|
consumer: RedisCommandArgument,
|
||||||
minIdleTime: number,
|
minIdleTime: number,
|
||||||
start: string,
|
start: string,
|
||||||
options?: XAutoClaimOptions
|
options?: XAutoClaimOptions
|
||||||
): Array<string> {
|
): RedisCommandArguments {
|
||||||
const args = ['XAUTOCLAIM', key, group, consumer, minIdleTime.toString(), start];
|
const args = ['XAUTOCLAIM', key, group, consumer, minIdleTime.toString(), start];
|
||||||
|
|
||||||
if (options?.COUNT) {
|
if (options?.COUNT) {
|
||||||
@@ -25,12 +26,12 @@ export function transformArguments(
|
|||||||
|
|
||||||
interface XAutoClaimReply {
|
interface XAutoClaimReply {
|
||||||
nextId: string;
|
nextId: string;
|
||||||
messages: StreamMessagesReply;
|
messages: StreamStringsMessagesReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReply(reply: [string, Array<any>]): XAutoClaimReply {
|
export function transformReply(reply: [string, Array<any>]): XAutoClaimReply {
|
||||||
return {
|
return {
|
||||||
nextId: reply[0],
|
nextId: reply[0],
|
||||||
messages: transformReplyStreamMessages(reply[1])
|
messages: transformReplyStreamStringMessages(reply[1])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
17
packages/client/lib/commands/XAUTOCLAIM_BUFFER.ts
Normal file
17
packages/client/lib/commands/XAUTOCLAIM_BUFFER.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { StreamBufferMessagesReply, transformReplyStreamBufferMessages } from './generic-transformers';
|
||||||
|
|
||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './XAUTOCLAIM';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
interface XAutoClaimReply {
|
||||||
|
nextId: Buffer;
|
||||||
|
messages: StreamBufferMessagesReply;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function transformReply(reply: [Buffer, Array<any>]): XAutoClaimReply {
|
||||||
|
return {
|
||||||
|
nextId: reply[0],
|
||||||
|
messages: transformReplyStreamBufferMessages(reply[1])
|
||||||
|
};
|
||||||
|
}
|
@@ -1,8 +1,9 @@
|
|||||||
|
import { RedisCommandArguments } from '.';
|
||||||
import { transformArguments as transformXAutoClaimArguments } from './XAUTOCLAIM';
|
import { transformArguments as transformXAutoClaimArguments } from './XAUTOCLAIM';
|
||||||
|
|
||||||
export { FIRST_KEY_INDEX } from './XAUTOCLAIM';
|
export { FIRST_KEY_INDEX } from './XAUTOCLAIM';
|
||||||
|
|
||||||
export function transformArguments(...args: Parameters<typeof transformXAutoClaimArguments>): Array<string> {
|
export function transformArguments(...args: Parameters<typeof transformXAutoClaimArguments>): RedisCommandArguments {
|
||||||
return [
|
return [
|
||||||
...transformXAutoClaimArguments(...args),
|
...transformXAutoClaimArguments(...args),
|
||||||
'JUSTID'
|
'JUSTID'
|
||||||
|
13
packages/client/lib/commands/XAUTOCLAIM_JUSTID_BUFFER.ts
Normal file
13
packages/client/lib/commands/XAUTOCLAIM_JUSTID_BUFFER.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './XAUTOCLAIM_JUSTID';
|
||||||
|
|
||||||
|
interface XAutoClaimJustIdBufferReply {
|
||||||
|
nextId: Buffer;
|
||||||
|
messages: Array<Buffer>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function transformReply(reply: [Buffer, Array<Buffer>]): XAutoClaimJustIdBufferReply {
|
||||||
|
return {
|
||||||
|
nextId: reply[0],
|
||||||
|
messages: reply[1]
|
||||||
|
};
|
||||||
|
}
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
import { pushVerdictArguments } from './generic-transformers';
|
import { pushVerdictArguments } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
@@ -10,13 +11,13 @@ export interface XClaimOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(
|
export function transformArguments(
|
||||||
key: string,
|
key: RedisCommandArgument,
|
||||||
group: string,
|
group: RedisCommandArgument,
|
||||||
consumer: string,
|
consumer: RedisCommandArgument,
|
||||||
minIdleTime: number,
|
minIdleTime: number,
|
||||||
id: string | Array<string>,
|
id: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||||
options?: XClaimOptions
|
options?: XClaimOptions
|
||||||
): Array<string> {
|
): RedisCommandArguments {
|
||||||
const args = ['XCLAIM', key, group, consumer, minIdleTime.toString()];
|
const args = ['XCLAIM', key, group, consumer, minIdleTime.toString()];
|
||||||
|
|
||||||
pushVerdictArguments(args, id);
|
pushVerdictArguments(args, id);
|
||||||
@@ -43,4 +44,4 @@ export function transformArguments(
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyStreamMessages as transformReply } from './generic-transformers';
|
export { transformReplyStreamStringMessages as transformReply } from './generic-transformers';
|
||||||
|
5
packages/client/lib/commands/XCLAIM_BUFFER.ts
Normal file
5
packages/client/lib/commands/XCLAIM_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './XCLAIM';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export { transformReplyStreamBufferMessages as transformReply } from './generic-transformers';
|
@@ -1,10 +1,11 @@
|
|||||||
import { transformArguments as transformArgumentsXClaim } from './XCLAIM';
|
import { RedisCommandArguments } from '.';
|
||||||
|
import { transformArguments as transformXClaimArguments } from './XCLAIM';
|
||||||
|
|
||||||
export { FIRST_KEY_INDEX } from './XCLAIM';
|
export { FIRST_KEY_INDEX } from './XCLAIM';
|
||||||
|
|
||||||
export function transformArguments(...args: Parameters<typeof transformArgumentsXClaim>): Array<string> {
|
export function transformArguments(...args: Parameters<typeof transformXClaimArguments>): RedisCommandArguments {
|
||||||
return [
|
return [
|
||||||
...transformArgumentsXClaim(...args),
|
...transformXClaimArguments(...args),
|
||||||
'JUSTID'
|
'JUSTID'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
5
packages/client/lib/commands/XCLAIM_JUSTID_BUFFER.ts
Normal file
5
packages/client/lib/commands/XCLAIM_JUSTID_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, transformArguments } from './XCLAIM_JUSTID';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export declare function transformReply(): Array<Buffer>;
|
@@ -1,9 +1,12 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
import { pushVerdictArguments } from './generic-transformers';
|
import { pushVerdictArguments } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export function transformArguments(key: string, id: string | Array<string>): RedisCommandArguments {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
id: RedisCommandArgument | Array<RedisCommandArgument>
|
||||||
|
): RedisCommandArguments {
|
||||||
return pushVerdictArguments(['XDEL', key], id);
|
return pushVerdictArguments(['XDEL', key], id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,10 +1,17 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
interface XGroupCreateOptions {
|
interface XGroupCreateOptions {
|
||||||
MKSTREAM?: true;
|
MKSTREAM?: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string, id: string, options?: XGroupCreateOptions): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument,
|
||||||
|
id: RedisCommandArgument,
|
||||||
|
options?: XGroupCreateOptions
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = ['XGROUP', 'CREATE', key, group, id];
|
const args = ['XGROUP', 'CREATE', key, group, id];
|
||||||
|
|
||||||
if (options?.MKSTREAM) {
|
if (options?.MKSTREAM) {
|
||||||
@@ -14,4 +21,4 @@ export function transformArguments(key: string, group: string, id: string, optio
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare function transformReply(): string;
|
export declare function transformReply(): 'OK';
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string, consumer: string): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument,
|
||||||
|
consumer: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['XGROUP', 'CREATECONSUMER', key, group, consumer];
|
return ['XGROUP', 'CREATECONSUMER', key, group, consumer];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string, consumer: string): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument,
|
||||||
|
consumer: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['XGROUP', 'DELCONSUMER', key, group, consumer];
|
return ['XGROUP', 'DELCONSUMER', key, group, consumer];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,11 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['XGROUP', 'DESTROY', key, group];
|
return ['XGROUP', 'DESTROY', key, group];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,13 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string, id: string): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument,
|
||||||
|
id: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['XGROUP', 'SETID', key, group, id];
|
return ['XGROUP', 'SETID', key, group, id];
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare function transformReply(): string;
|
export declare function transformReply(): 'OK';
|
||||||
|
@@ -1,8 +1,13 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['XINFO', 'CONSUMERS', key, group];
|
return ['XINFO', 'CONSUMERS', key, group];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string): Array<string> {
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
return ['XINFO', 'GROUPS', key];
|
return ['XINFO', 'GROUPS', key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { StreamMessageReply, transformReplyTuples } from './generic-transformers';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
import { StreamStringsMessageReply, transformReplyStringTuples } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 2;
|
export const FIRST_KEY_INDEX = 2;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string): Array<string> {
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
return ['XINFO', 'STREAM', key];
|
return ['XINFO', 'STREAM', key];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,8 +15,8 @@ interface XInfoStreamReply {
|
|||||||
radixTreeNodes: number;
|
radixTreeNodes: number;
|
||||||
groups: number;
|
groups: number;
|
||||||
lastGeneratedId: string;
|
lastGeneratedId: string;
|
||||||
firstEntry: StreamMessageReply | null;
|
firstEntry: StreamStringsMessageReply | null;
|
||||||
lastEntry: StreamMessageReply | null;
|
lastEntry: StreamStringsMessageReply | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReply(rawReply: Array<any>): XInfoStreamReply {
|
export function transformReply(rawReply: Array<any>): XInfoStreamReply {
|
||||||
@@ -46,14 +47,14 @@ export function transformReply(rawReply: Array<any>): XInfoStreamReply {
|
|||||||
case 'first-entry':
|
case 'first-entry':
|
||||||
parsedReply.firstEntry = rawReply[i + 1] ? {
|
parsedReply.firstEntry = rawReply[i + 1] ? {
|
||||||
id: rawReply[i + 1][0],
|
id: rawReply[i + 1][0],
|
||||||
message: transformReplyTuples(rawReply[i + 1][1])
|
message: transformReplyStringTuples(rawReply[i + 1][1])
|
||||||
} : null;
|
} : null;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'last-entry':
|
case 'last-entry':
|
||||||
parsedReply.lastEntry = rawReply[i + 1] ? {
|
parsedReply.lastEntry = rawReply[i + 1] ? {
|
||||||
id: rawReply[i + 1][0],
|
id: rawReply[i + 1][0],
|
||||||
message: transformReplyTuples(rawReply[i + 1][1])
|
message: transformReplyStringTuples(rawReply[i + 1][1])
|
||||||
} : null;
|
} : null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string): Array<string> {
|
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||||
return ['XLEN', key];
|
return ['XLEN', key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,23 +1,44 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string, group: string): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
group: RedisCommandArgument
|
||||||
|
): RedisCommandArguments {
|
||||||
return ['XPENDING', key, group];
|
return ['XPENDING', key, group];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type XPendingRawReply = [
|
||||||
|
pending: number,
|
||||||
|
firstId: string | null,
|
||||||
|
lastId: string | null,
|
||||||
|
consumers: Array<[
|
||||||
|
name: string,
|
||||||
|
deliveriesCounter: number
|
||||||
|
]> | null
|
||||||
|
]
|
||||||
|
|
||||||
interface XPendingReply {
|
interface XPendingReply {
|
||||||
pending: number;
|
pending: number;
|
||||||
firstId: string | null;
|
firstId: string | null;
|
||||||
lastId: number | null
|
lastId: string | null
|
||||||
consumers: Array<string> | null;
|
consumers: Array<{
|
||||||
|
name: string,
|
||||||
|
deliveriesCounter: number
|
||||||
|
}> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReply(reply: [number, string | null, number | null, Array<string> | null]): XPendingReply {
|
export function transformReply(reply: XPendingRawReply): XPendingReply {
|
||||||
return {
|
return {
|
||||||
pending: reply[0],
|
pending: reply[0],
|
||||||
firstId: reply[1],
|
firstId: reply[1],
|
||||||
lastId: reply[2],
|
lastId: reply[2],
|
||||||
consumers: reply[3]
|
consumers: reply[3] === null ? null : reply[3].map(([name, deliveriesCounter]) => ({
|
||||||
|
name,
|
||||||
|
deliveriesCounter
|
||||||
|
}))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
@@ -8,13 +10,13 @@ interface XPendingRangeOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(
|
export function transformArguments(
|
||||||
key: string,
|
key: RedisCommandArgument,
|
||||||
group: string,
|
group: RedisCommandArgument,
|
||||||
start: string,
|
start: string,
|
||||||
end: string,
|
end: string,
|
||||||
count: number,
|
count: number,
|
||||||
options?: XPendingRangeOptions
|
options?: XPendingRangeOptions
|
||||||
): Array<string> {
|
): RedisCommandArguments {
|
||||||
const args = ['XPENDING', key, group];
|
const args = ['XPENDING', key, group];
|
||||||
|
|
||||||
if (options?.IDLE) {
|
if (options?.IDLE) {
|
||||||
@@ -30,4 +32,25 @@ export function transformArguments(
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyStreamMessages as transformReply } from './generic-transformers';
|
type XPendingRangeRawReply = Array<[
|
||||||
|
id: number,
|
||||||
|
consumer: string,
|
||||||
|
millisecondsSinceLastDelivery: number,
|
||||||
|
deliveriesCounter: number
|
||||||
|
]>;
|
||||||
|
|
||||||
|
type XPendingRangeReply = Array<{
|
||||||
|
id: number;
|
||||||
|
owner: string;
|
||||||
|
millisecondsSinceLastDelivery: number;
|
||||||
|
deliveriesCounter: number;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export function transformReply(reply: XPendingRangeRawReply): XPendingRangeReply {
|
||||||
|
return reply.map(([id, owner, millisecondsSinceLastDelivery, deliveriesCounter]) => ({
|
||||||
|
id,
|
||||||
|
owner,
|
||||||
|
millisecondsSinceLastDelivery,
|
||||||
|
deliveriesCounter
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
@@ -6,7 +8,12 @@ interface XRangeOptions {
|
|||||||
COUNT?: number;
|
COUNT?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(key: string, start: string, end: string, options?: XRangeOptions): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
start: RedisCommandArgument,
|
||||||
|
end: RedisCommandArgument,
|
||||||
|
options?: XRangeOptions
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = ['XRANGE', key, start, end];
|
const args = ['XRANGE', key, start, end];
|
||||||
|
|
||||||
if (options?.COUNT) {
|
if (options?.COUNT) {
|
||||||
@@ -16,4 +23,4 @@ export function transformArguments(key: string, start: string, end: string, opti
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyStreamMessages as transformReply } from './generic-transformers';
|
export { transformReplyStreamStringMessages as transformReply } from './generic-transformers';
|
||||||
|
5
packages/client/lib/commands/XRANGE_BUFFER.ts
Normal file
5
packages/client/lib/commands/XRANGE_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './XRANGE';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export { transformReplyStreamBufferMessages as transformReply } from './generic-transformers';
|
@@ -1,12 +1,14 @@
|
|||||||
export const FIRST_KEY_INDEX = (streams: Array<XReadStream> | XReadStream): string => {
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = (streams: Array<XReadStream> | XReadStream): RedisCommandArgument => {
|
||||||
return Array.isArray(streams) ? streams[0].key : streams.key;
|
return Array.isArray(streams) ? streams[0].key : streams.key;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
interface XReadStream {
|
interface XReadStream {
|
||||||
key: string;
|
key: RedisCommandArgument;
|
||||||
id: string;
|
id: RedisCommandArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface XReadOptions {
|
interface XReadOptions {
|
||||||
@@ -14,8 +16,11 @@ interface XReadOptions {
|
|||||||
BLOCK?: number;
|
BLOCK?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(streams: Array<XReadStream> | XReadStream, options?: XReadOptions): Array<string> {
|
export function transformArguments(
|
||||||
const args = ['XREAD'];
|
streams: Array<XReadStream> | XReadStream,
|
||||||
|
options?: XReadOptions
|
||||||
|
): RedisCommandArguments {
|
||||||
|
const args: RedisCommandArguments = ['XREAD'];
|
||||||
|
|
||||||
if (options?.COUNT) {
|
if (options?.COUNT) {
|
||||||
args.push('COUNT', options.COUNT.toString());
|
args.push('COUNT', options.COUNT.toString());
|
||||||
@@ -38,4 +43,4 @@ export function transformArguments(streams: Array<XReadStream> | XReadStream, op
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyStreamsMessages as transformReply } from './generic-transformers';
|
export { transformReplyStreamsStringMessages as transformReply } from './generic-transformers';
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export interface XReadGroupStream {
|
export interface XReadGroupStream {
|
||||||
key: string;
|
key: RedisCommandArgument;
|
||||||
id: string;
|
id: RedisCommandArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface XReadGroupOptions {
|
export interface XReadGroupOptions {
|
||||||
@@ -10,21 +12,21 @@ export interface XReadGroupOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = (
|
export const FIRST_KEY_INDEX = (
|
||||||
_group: string,
|
_group: RedisCommandArgument,
|
||||||
_consumer: string,
|
_consumer: RedisCommandArgument,
|
||||||
streams: Array<XReadGroupStream> | XReadGroupStream
|
streams: Array<XReadGroupStream> | XReadGroupStream
|
||||||
): string => {
|
): RedisCommandArgument => {
|
||||||
return Array.isArray(streams) ? streams[0].key : streams.key;
|
return Array.isArray(streams) ? streams[0].key : streams.key;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(
|
export function transformArguments(
|
||||||
group: string,
|
group: RedisCommandArgument,
|
||||||
consumer: string,
|
consumer: RedisCommandArgument,
|
||||||
streams: Array<XReadGroupStream> | XReadGroupStream,
|
streams: Array<XReadGroupStream> | XReadGroupStream,
|
||||||
options?: XReadGroupOptions
|
options?: XReadGroupOptions
|
||||||
): Array<string> {
|
): RedisCommandArguments {
|
||||||
const args = ['XREADGROUP', 'GROUP', group, consumer];
|
const args = ['XREADGROUP', 'GROUP', group, consumer];
|
||||||
|
|
||||||
if (options?.COUNT) {
|
if (options?.COUNT) {
|
||||||
@@ -52,4 +54,4 @@ export function transformArguments(
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyStreamsMessages as transformReply } from './generic-transformers';
|
export { transformReplyStreamsStringMessages as transformReply } from './generic-transformers';
|
||||||
|
6
packages/client/lib/commands/XREADGROUP_BUFFER.ts
Normal file
6
packages/client/lib/commands/XREADGROUP_BUFFER.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './XREADGROUP';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export { transformReplyStreamsBufferMessages as transformReply } from './generic-transformers';
|
5
packages/client/lib/commands/XREAD_BUFFER.ts
Normal file
5
packages/client/lib/commands/XREAD_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './XREAD';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export { transformReplyStreamsBufferMessages as transformReply } from './generic-transformers';
|
@@ -2,6 +2,10 @@ interface XRangeRevOptions {
|
|||||||
COUNT?: number;
|
COUNT?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
export function transformArguments(key: string, start: string, end: string, options?: XRangeRevOptions): Array<string> {
|
export function transformArguments(key: string, start: string, end: string, options?: XRangeRevOptions): Array<string> {
|
||||||
const args = ['XREVRANGE', key, start, end];
|
const args = ['XREVRANGE', key, start, end];
|
||||||
|
|
||||||
@@ -12,4 +16,4 @@ export function transformArguments(key: string, start: string, end: string, opti
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplyStreamMessages as transformReply } from './generic-transformers';
|
export { transformReplyStreamStringMessages as transformReply } from './generic-transformers';
|
||||||
|
5
packages/client/lib/commands/XREVRANGE_BUFFER.ts
Normal file
5
packages/client/lib/commands/XREVRANGE_BUFFER.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './XREVRANGE';
|
||||||
|
|
||||||
|
export const BUFFER_MODE = true;
|
||||||
|
|
||||||
|
export { transformReplyStreamBufferMessages as transformReply } from './generic-transformers';
|
@@ -1,3 +1,5 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
interface XTrimOptions {
|
interface XTrimOptions {
|
||||||
@@ -5,7 +7,12 @@ interface XTrimOptions {
|
|||||||
LIMIT?: number;
|
LIMIT?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(key: string, strategy: 'MAXLEN' | 'MINID', threshold: number, options?: XTrimOptions): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
strategy: 'MAXLEN' | 'MINID',
|
||||||
|
threshold: number,
|
||||||
|
options?: XTrimOptions
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = ['XTRIM', key, strategy];
|
const args = ['XTRIM', key, strategy];
|
||||||
|
|
||||||
if (options?.strategyModifier) {
|
if (options?.strategyModifier) {
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
import { transformArgumentNumberInfinity, ZMember } from './generic-transformers';
|
import { transformArgumentNumberInfinity, ZMember } from './generic-transformers';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
@@ -28,7 +29,11 @@ interface INCR {
|
|||||||
|
|
||||||
type ZAddOptions = (NX | (XX & LT & GT)) & CH & INCR;
|
type ZAddOptions = (NX | (XX & LT & GT)) & CH & INCR;
|
||||||
|
|
||||||
export function transformArguments(key: string, members: ZMember | Array<ZMember>, options?: ZAddOptions): Array<string> {
|
export function transformArguments(
|
||||||
|
key: RedisCommandArgument,
|
||||||
|
members: ZMember | Array<ZMember>,
|
||||||
|
options?: ZAddOptions
|
||||||
|
): RedisCommandArguments {
|
||||||
const args = ['ZADD', key];
|
const args = ['ZADD', key];
|
||||||
|
|
||||||
if ((<NX>options)?.NX) {
|
if ((<NX>options)?.NX) {
|
||||||
|
@@ -10,4 +10,4 @@ export function transformArguments(...args: Parameters<typeof transformZDiffArgu
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -10,4 +10,4 @@ export function transformArguments(...args: Parameters<typeof transformZInterArg
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -9,9 +9,9 @@ export function transformArguments(key: string): Array<string> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReply(reply: [string, string] | []): ZMember | null {
|
export function transformReply(reply: [string, string] | []): ZMember<string> | null {
|
||||||
if (!reply.length) return null;
|
if (!reply.length) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
value: reply[0],
|
value: reply[0],
|
||||||
score: transformReplyNumberInfinity(reply[1])
|
score: transformReplyNumberInfinity(reply[1])
|
||||||
|
@@ -9,4 +9,4 @@ export function transformArguments(key: string, count: number): Array<string> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -9,9 +9,9 @@ export function transformArguments(key: string): Array<string> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReply(reply: [string, string] | []): ZMember | null {
|
export function transformReply(reply: [string, string] | []): ZMember<string> | null {
|
||||||
if (!reply.length) return null;
|
if (!reply.length) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
value: reply[0],
|
value: reply[0],
|
||||||
score: transformReplyNumberInfinity(reply[1])
|
score: transformReplyNumberInfinity(reply[1])
|
||||||
|
@@ -9,4 +9,4 @@ export function transformArguments(key: string, count: number): Array<string> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -9,4 +9,4 @@ export function transformArguments(...args: Parameters<typeof transformZRandMemb
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -15,4 +15,4 @@ export function transformArguments(
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -9,4 +9,4 @@ export function transformArguments(...args: Parameters<typeof transformZRangeArg
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -13,11 +13,11 @@ export function transformArguments(key: string, cursor: number, options?: ScanOp
|
|||||||
|
|
||||||
interface ZScanReply {
|
interface ZScanReply {
|
||||||
cursor: number;
|
cursor: number;
|
||||||
members: Array<ZMember>;
|
members: Array<ZMember<string>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReply([cursor, rawMembers]: [string, Array<string>]): ZScanReply {
|
export function transformReply([cursor, rawMembers]: [string, Array<string>]): ZScanReply {
|
||||||
const parsedMembers: Array<ZMember> = [];
|
const parsedMembers: Array<ZMember<string>> = [];
|
||||||
for (let i = 0; i < rawMembers.length; i += 2) {
|
for (let i = 0; i < rawMembers.length; i += 2) {
|
||||||
parsedMembers.push({
|
parsedMembers.push({
|
||||||
value: rawMembers[i],
|
value: rawMembers[i],
|
||||||
|
@@ -10,4 +10,4 @@ export function transformArguments(...args: Parameters<typeof transformZUnionArg
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformReplySortedSetWithScores as transformReply } from './generic-transformers';
|
export { transformReplySortedStringsSetWithScores as transformReply } from './generic-transformers';
|
||||||
|
@@ -8,10 +8,14 @@ import {
|
|||||||
transformReplyNumberInfinityNull,
|
transformReplyNumberInfinityNull,
|
||||||
transformArgumentNumberInfinity,
|
transformArgumentNumberInfinity,
|
||||||
transformArgumentStringNumberInfinity,
|
transformArgumentStringNumberInfinity,
|
||||||
transformReplyTuples,
|
transformReplyStringTuples,
|
||||||
transformReplyStreamMessages,
|
transformReplyBufferTuples,
|
||||||
transformReplyStreamsMessages,
|
transformReplyStreamStringMessages,
|
||||||
transformReplySortedSetWithScores,
|
transformReplyStreamBufferMessages,
|
||||||
|
transformReplyStreamsStringMessages,
|
||||||
|
transformReplyStreamsBufferMessages,
|
||||||
|
transformReplySortedStringsSetWithScores,
|
||||||
|
transformReplySortedBuffersSetWithScores,
|
||||||
pushGeoCountArgument,
|
pushGeoCountArgument,
|
||||||
pushGeoSearchArguments,
|
pushGeoSearchArguments,
|
||||||
GeoReplyWith,
|
GeoReplyWith,
|
||||||
@@ -192,9 +196,9 @@ describe('Generic Transformers', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('transformReplyTuples', () => {
|
it('transformReplyStringTuples', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformReplyTuples(['key1', 'value1', 'key2', 'value2']),
|
transformReplyStringTuples(['key1', 'value1', 'key2', 'value2']),
|
||||||
Object.create(null, {
|
Object.create(null, {
|
||||||
key1: {
|
key1: {
|
||||||
value: 'value1',
|
value: 'value1',
|
||||||
@@ -210,9 +214,27 @@ describe('Generic Transformers', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('transformReplyStreamMessages', () => {
|
it('transformReplyBufferTuples', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformReplyStreamMessages([['0-0', ['0key', '0value']], ['1-0', ['1key', '1value']]]),
|
transformReplyBufferTuples([Buffer.from('key1'), Buffer.from('value1'), Buffer.from('key2'), Buffer.from('value2')]),
|
||||||
|
Object.create(null, {
|
||||||
|
key1: {
|
||||||
|
value: Buffer.from('value1'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
},
|
||||||
|
key2: {
|
||||||
|
value: Buffer.from('value2'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('transformReplyStreamStringMessages', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformReplyStreamStringMessages([['0-0', ['0key', '0value']], ['1-0', ['1key', '1value']]]),
|
||||||
[{
|
[{
|
||||||
id: '0-0',
|
id: '0-0',
|
||||||
message: Object.create(null, {
|
message: Object.create(null, {
|
||||||
@@ -235,17 +257,45 @@ describe('Generic Transformers', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('transformReplyStreamsMessages', () => {
|
it('transformReplyStreamBufferMessages', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformReplyStreamBufferMessages([
|
||||||
|
[Buffer.from('0-0'), [Buffer.from('0key'), Buffer.from('0value')]],
|
||||||
|
[Buffer.from('1-0'), [Buffer.from('1key'), Buffer.from('1value')]]
|
||||||
|
]),
|
||||||
|
[{
|
||||||
|
id: Buffer.from('0-0'),
|
||||||
|
message: Object.create(null, {
|
||||||
|
'0key': {
|
||||||
|
value: Buffer.from('0value'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, {
|
||||||
|
id: Buffer.from('1-0'),
|
||||||
|
message: Object.create(null, {
|
||||||
|
'1key': {
|
||||||
|
value: Buffer.from('1value'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('transformReplyStreamsStringMessages', () => {
|
||||||
it('null', () => {
|
it('null', () => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
transformReplyStreamsMessages(null),
|
transformReplyStreamsStringMessages(null),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('with messages', () => {
|
it('with messages', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformReplyStreamsMessages([['stream1', [['0-1', ['11key', '11value']], ['1-1', ['12key', '12value']]]], ['stream2', [['0-2', ['2key1', '2value1', '2key2', '2value2']]]]]),
|
transformReplyStreamsStringMessages([['stream1', [['0-1', ['11key', '11value']], ['1-1', ['12key', '12value']]]], ['stream2', [['0-2', ['2key1', '2value1', '2key2', '2value2']]]]]),
|
||||||
[{
|
[{
|
||||||
name: 'stream1',
|
name: 'stream1',
|
||||||
messages: [{
|
messages: [{
|
||||||
@@ -289,9 +339,77 @@ describe('Generic Transformers', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('transformReplySortedSetWithScores', () => {
|
describe('transformReplyStreamsBufferMessages', () => {
|
||||||
|
it('null', () => {
|
||||||
|
assert.equal(
|
||||||
|
transformReplyStreamsBufferMessages(null),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('with messages', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformReplyStreamsBufferMessages([
|
||||||
|
[
|
||||||
|
Buffer.from('stream1'),
|
||||||
|
[
|
||||||
|
[Buffer.from('0-1'), [Buffer.from('11key'), Buffer.from('11value')]],
|
||||||
|
[Buffer.from('1-1'), [Buffer.from('12key'), Buffer.from('12value')]]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
Buffer.from('stream2'),
|
||||||
|
[
|
||||||
|
[Buffer.from('0-2'), [Buffer.from('2key1'), Buffer.from('2value1'), Buffer.from('2key2'), Buffer.from('2value2')]]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]),
|
||||||
|
[{
|
||||||
|
name: Buffer.from('stream1'),
|
||||||
|
messages: [{
|
||||||
|
id: Buffer.from('0-1'),
|
||||||
|
message: Object.create(null, {
|
||||||
|
'11key': {
|
||||||
|
value: Buffer.from('11value'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, {
|
||||||
|
id: Buffer.from('1-1'),
|
||||||
|
message: Object.create(null, {
|
||||||
|
'12key': {
|
||||||
|
value: Buffer.from('12value'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
name: Buffer.from('stream2'),
|
||||||
|
messages: [{
|
||||||
|
id: Buffer.from('0-2'),
|
||||||
|
message: Object.create(null, {
|
||||||
|
'2key1': {
|
||||||
|
value: Buffer.from('2value1'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
},
|
||||||
|
'2key2': {
|
||||||
|
value: Buffer.from('2value2'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('transformReplySortedStringsSetWithScores', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformReplySortedSetWithScores(['member1', '0.5', 'member2', '+inf', 'member3', '-inf']),
|
transformReplySortedStringsSetWithScores(['member1', '0.5', 'member2', '+inf', 'member3', '-inf']),
|
||||||
[{
|
[{
|
||||||
value: 'member1',
|
value: 'member1',
|
||||||
score: 0.5
|
score: 0.5
|
||||||
@@ -305,6 +423,29 @@ describe('Generic Transformers', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('transformReplySortedBuffersSetWithScores', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformReplySortedBuffersSetWithScores([
|
||||||
|
Buffer.from('member1'),
|
||||||
|
Buffer.from('0.5'),
|
||||||
|
Buffer.from('member2'),
|
||||||
|
Buffer.from('+inf'),
|
||||||
|
Buffer.from('member3'),
|
||||||
|
Buffer.from('-inf')
|
||||||
|
]),
|
||||||
|
[{
|
||||||
|
value: Buffer.from('member1'),
|
||||||
|
score: 0.5
|
||||||
|
}, {
|
||||||
|
value: Buffer.from('member2'),
|
||||||
|
score: Infinity
|
||||||
|
}, {
|
||||||
|
value: Buffer.from('member3'),
|
||||||
|
score: -Infinity
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe('pushGeoCountArgument', () => {
|
describe('pushGeoCountArgument', () => {
|
||||||
it('undefined', () => {
|
it('undefined', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { RedisCommandArguments } from '.';
|
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||||
|
|
||||||
export function transformReplyBoolean(reply: number): boolean {
|
export function transformReplyBoolean(reply: number): boolean {
|
||||||
return reply === 1;
|
return reply === 1;
|
||||||
@@ -75,11 +75,7 @@ export function transformArgumentStringNumberInfinity(num: string | number): str
|
|||||||
return transformArgumentNumberInfinity(num);
|
return transformArgumentNumberInfinity(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TuplesObject {
|
export function transformReplyStringTuples(reply: Array<string>): Record<string, string> {
|
||||||
[field: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function transformReplyTuples(reply: Array<string>): TuplesObject {
|
|
||||||
const message = Object.create(null);
|
const message = Object.create(null);
|
||||||
|
|
||||||
for (let i = 0; i < reply.length; i += 2) {
|
for (let i = 0; i < reply.length; i += 2) {
|
||||||
@@ -89,46 +85,91 @@ export function transformReplyTuples(reply: Array<string>): TuplesObject {
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StreamMessageReply {
|
|
||||||
id: string;
|
export function transformReplyBufferTuples(reply: Array<Buffer>): Record<string, Buffer> {
|
||||||
message: TuplesObject;
|
const message = Object.create(null);
|
||||||
|
|
||||||
|
for (let i = 0; i < reply.length; i += 2) {
|
||||||
|
message[reply[i].toString()] = reply[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type StreamMessagesReply = Array<StreamMessageReply>;
|
export interface StreamStringsMessageReply {
|
||||||
|
id: string;
|
||||||
|
message: Record<string, string>;
|
||||||
|
}
|
||||||
|
|
||||||
export function transformReplyStreamMessages(reply: Array<any>): StreamMessagesReply {
|
export type StreamStringsMessagesReply = Array<StreamStringsMessageReply>;
|
||||||
|
|
||||||
|
export function transformReplyStreamStringMessages(reply: Array<any>): StreamStringsMessagesReply {
|
||||||
const messages = [];
|
const messages = [];
|
||||||
|
|
||||||
for (const [id, message] of reply) {
|
for (const [id, message] of reply) {
|
||||||
messages.push({
|
messages.push({
|
||||||
id,
|
id,
|
||||||
message: transformReplyTuples(message)
|
message: transformReplyStringTuples(message)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type StreamsMessagesReply = Array<{
|
interface StreamBufferMessageReply {
|
||||||
|
id: Buffer;
|
||||||
|
message: Record<string, Buffer>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StreamBufferMessagesReply = Array<StreamBufferMessageReply>;
|
||||||
|
|
||||||
|
export function transformReplyStreamBufferMessages(reply: Array<any>): StreamBufferMessagesReply {
|
||||||
|
const messages = [];
|
||||||
|
|
||||||
|
for (const [id, message] of reply) {
|
||||||
|
messages.push({
|
||||||
|
id,
|
||||||
|
message: transformReplyBufferTuples(message)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StreamsStringMessagesReply = Array<{
|
||||||
name: string;
|
name: string;
|
||||||
messages: StreamMessagesReply;
|
messages: StreamStringsMessagesReply;
|
||||||
}> | null;
|
}> | null;
|
||||||
|
|
||||||
export function transformReplyStreamsMessages(reply: Array<any> | null): StreamsMessagesReply | null {
|
export function transformReplyStreamsStringMessages(reply: Array<any> | null): StreamsStringMessagesReply | null {
|
||||||
if (reply === null) return null;
|
if (reply === null) return null;
|
||||||
|
|
||||||
return reply.map(([name, rawMessages]) => ({
|
return reply.map(([name, rawMessages]) => ({
|
||||||
name,
|
name,
|
||||||
messages: transformReplyStreamMessages(rawMessages)
|
messages: transformReplyStreamStringMessages(rawMessages)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ZMember {
|
export type StreamsBufferMessagesReply = Array<{
|
||||||
score: number;
|
name: Buffer;
|
||||||
value: string;
|
messages: StreamBufferMessagesReply;
|
||||||
|
}> | null;
|
||||||
|
|
||||||
|
export function transformReplyStreamsBufferMessages(reply: Array<any> | null): StreamsBufferMessagesReply | null {
|
||||||
|
if (reply === null) return null;
|
||||||
|
|
||||||
|
return reply.map(([name, rawMessages]) => ({
|
||||||
|
name,
|
||||||
|
messages: transformReplyStreamBufferMessages(rawMessages)
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transformReplySortedSetWithScores(reply: Array<string>): Array<ZMember> {
|
export interface ZMember<T = RedisCommandArgument> {
|
||||||
|
score: number;
|
||||||
|
value: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function transformReplySortedStringsSetWithScores(reply: Array<string>): Array<ZMember<string>> {
|
||||||
const members = [];
|
const members = [];
|
||||||
|
|
||||||
for (let i = 0; i < reply.length; i += 2) {
|
for (let i = 0; i < reply.length; i += 2) {
|
||||||
@@ -141,6 +182,19 @@ export function transformReplySortedSetWithScores(reply: Array<string>): Array<Z
|
|||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function transformReplySortedBuffersSetWithScores(reply: Array<Buffer>): Array<ZMember<Buffer>> {
|
||||||
|
const members = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < reply.length; i += 2) {
|
||||||
|
members.push({
|
||||||
|
value: reply[i],
|
||||||
|
score: transformReplyNumberInfinity(reply[i + 1].toString())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return members;
|
||||||
|
}
|
||||||
|
|
||||||
type GeoCountArgument = number | {
|
type GeoCountArgument = number | {
|
||||||
value: number;
|
value: number;
|
||||||
ANY?: true
|
ANY?: true
|
||||||
@@ -314,7 +368,7 @@ export function pushStringTuplesArguments(args: Array<string>, tuples: StringTup
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pushVerdictArguments(args: RedisCommandArguments, value: string | Buffer | Array<string | Buffer>): RedisCommandArguments {
|
export function pushVerdictArguments(args: RedisCommandArguments, value: RedisCommandArgument | Array<RedisCommandArgument>): RedisCommandArguments {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
args.push(...value);
|
args.push(...value);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -2,10 +2,12 @@ import { RedisScriptConfig, SHA1 } from '../lua-script';
|
|||||||
|
|
||||||
export type RedisCommandRawReply = string | number | Buffer | Array<RedisCommandRawReply> | null | undefined;
|
export type RedisCommandRawReply = string | number | Buffer | Array<RedisCommandRawReply> | null | undefined;
|
||||||
|
|
||||||
export type RedisCommandArguments = Array<string | Buffer> & { preserve?: unknown };
|
export type RedisCommandArgument = string | Buffer;
|
||||||
|
|
||||||
|
export type RedisCommandArguments = Array<RedisCommandArgument> & { preserve?: unknown };
|
||||||
|
|
||||||
export interface RedisCommand {
|
export interface RedisCommand {
|
||||||
FIRST_KEY_INDEX?: number | ((...args: Array<any>) => string);
|
FIRST_KEY_INDEX?: number | ((...args: Array<any>) => RedisCommandArgument);
|
||||||
IS_READ_ONLY?: boolean;
|
IS_READ_ONLY?: boolean;
|
||||||
transformArguments(this: void, ...args: Array<any>): RedisCommandArguments;
|
transformArguments(this: void, ...args: Array<any>): RedisCommandArguments;
|
||||||
BUFFER_MODE?: boolean;
|
BUFFER_MODE?: boolean;
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
declare module 'cluster-key-slot' {
|
|
||||||
export default function calculateSlot(key: string | Buffer): number;
|
|
||||||
}
|
|
@@ -17,10 +17,6 @@
|
|||||||
"./lib"
|
"./lib"
|
||||||
],
|
],
|
||||||
"entryPointStrategy": "expand",
|
"entryPointStrategy": "expand",
|
||||||
"exclude": [
|
|
||||||
"./lib/ts-declarations",
|
|
||||||
"./lib/test-utils.ts"
|
|
||||||
],
|
|
||||||
"out": "../../documentation/client"
|
"out": "../../documentation/client"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,10 +15,6 @@
|
|||||||
"./lib"
|
"./lib"
|
||||||
],
|
],
|
||||||
"entryPointStrategy": "expand",
|
"entryPointStrategy": "expand",
|
||||||
"exclude": [
|
|
||||||
"./lib/test-utils.ts",
|
|
||||||
"./lib/**/*.spec.ts"
|
|
||||||
],
|
|
||||||
"out": "../../documentation/json"
|
"out": "../../documentation/json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
||||||
import { pushVerdictArgument, transformReplyTuples, TuplesObject } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
import { pushVerdictArgument, transformReplyStringTuples } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
||||||
import { AggregateReply, PropertyName, pushArgumentsWithLength, pushSortByArguments, SortByProperty } from '.';
|
import { AggregateReply, PropertyName, pushArgumentsWithLength, pushSortByArguments, SortByProperty } from '.';
|
||||||
|
|
||||||
export enum AggregateSteps {
|
export enum AggregateSteps {
|
||||||
@@ -125,8 +125,8 @@ export interface AggregateOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function transformArguments(
|
export function transformArguments(
|
||||||
index: string,
|
index: string,
|
||||||
query: string,
|
query: string,
|
||||||
options?: AggregateOptions
|
options?: AggregateOptions
|
||||||
): RedisCommandArguments {
|
): RedisCommandArguments {
|
||||||
|
|
||||||
@@ -277,10 +277,10 @@ export type AggregateRawReply = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export function transformReply(rawReply: AggregateRawReply): AggregateReply {
|
export function transformReply(rawReply: AggregateRawReply): AggregateReply {
|
||||||
const results: Array<TuplesObject> = [];
|
const results: Array<Record<string, string>> = [];
|
||||||
for (let i = 1; i < rawReply.length; i++) {
|
for (let i = 1; i < rawReply.length; i++) {
|
||||||
results.push(
|
results.push(
|
||||||
transformReplyTuples(rawReply[i] as Array<string>)
|
transformReplyStringTuples(rawReply[i] as Array<string>)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
||||||
import { transformReplyTuples } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
import { transformReplyStringTuples } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
||||||
import { pushSearchOptions, RedisSearchLanguages, PropertyName, SortByProperty, SearchReply } from '.';
|
import { pushSearchOptions, RedisSearchLanguages, PropertyName, SortByProperty, SearchReply } from '.';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export const FIRST_KEY_INDEX = 1;
|
||||||
@@ -76,7 +76,7 @@ export function transformReply(reply: SearchRawReply): SearchReply {
|
|||||||
id: reply[i],
|
id: reply[i],
|
||||||
value: tuples.length === 2 && tuples[0] === '$' ?
|
value: tuples.length === 2 && tuples[0] === '$' ?
|
||||||
JSON.parse(tuples[1]) :
|
JSON.parse(tuples[1]) :
|
||||||
transformReplyTuples(tuples)
|
transformReplyStringTuples(tuples)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ import * as SYNDUMP from './SYNDUMP';
|
|||||||
import * as SYNUPDATE from './SYNUPDATE';
|
import * as SYNUPDATE from './SYNUPDATE';
|
||||||
import * as TAGVALS from './TAGVALS';
|
import * as TAGVALS from './TAGVALS';
|
||||||
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
||||||
import { pushOptionalVerdictArgument, pushVerdictArgument, TuplesObject } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
import { pushOptionalVerdictArgument, pushVerdictArgument } from '@node-redis/client/dist/lib/commands/generic-transformers';
|
||||||
import { SearchOptions } from './SEARCH';
|
import { SearchOptions } from './SEARCH';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -398,7 +398,7 @@ export interface SearchReply {
|
|||||||
|
|
||||||
export interface AggregateReply {
|
export interface AggregateReply {
|
||||||
total: number;
|
total: number;
|
||||||
results: Array<TuplesObject>;
|
results: Array<Record<string, string>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProfileOptions {
|
export interface ProfileOptions {
|
||||||
|
@@ -15,10 +15,6 @@
|
|||||||
"./lib"
|
"./lib"
|
||||||
],
|
],
|
||||||
"entryPointStrategy": "expand",
|
"entryPointStrategy": "expand",
|
||||||
"exclude": [
|
|
||||||
"./lib/test-utils.ts",
|
|
||||||
"./lib/**/*.spec.ts"
|
|
||||||
],
|
|
||||||
"out": "../../documentation/search"
|
"out": "../../documentation/search"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,10 +15,6 @@
|
|||||||
"./lib"
|
"./lib"
|
||||||
],
|
],
|
||||||
"entryPointStrategy": "expand",
|
"entryPointStrategy": "expand",
|
||||||
"exclude": [
|
|
||||||
"./lib/test-utils.ts",
|
|
||||||
"./lib/**/*.spec.ts"
|
|
||||||
],
|
|
||||||
"out": "../../documentation/time-series"
|
"out": "../../documentation/time-series"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,9 +6,6 @@
|
|||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"esModuleInterop": false
|
"esModuleInterop": false
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
"./packages/client/lib/ts-declarations/cluster-key-slot.d.ts"
|
|
||||||
],
|
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
"files": true
|
"files": true
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user