redis-rank
Advanced tools
Comparing version 2.1.2 to 2.2.0
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
/// <reference types="node" /> | ||
import { Readable } from 'stream'; | ||
import { Redis, KeyType, Pipeline } from 'ioredis'; | ||
import { Redis, RedisKey, ChainableCommander } from 'ioredis'; | ||
/** Entry identifier */ | ||
@@ -71,3 +71,3 @@ export declare type ID = string; | ||
*/ | ||
constructor(client: Redis, key: KeyType, options: LeaderboardOptions); | ||
constructor(client: Redis, key: RedisKey, options: LeaderboardOptions); | ||
/** | ||
@@ -145,3 +145,3 @@ * Retrieve the score of an entry. If it doesn't exist, it returns null | ||
*/ | ||
limitPipe(pipeline: Pipeline): boolean; | ||
limitPipe(pipeline: ChainableCommander): boolean; | ||
/** | ||
@@ -157,3 +157,3 @@ * Uses IORedis.Pipeline to batch multiple Redis commands | ||
*/ | ||
updatePipe(entries: EntryUpdateQuery[], pipeline: Pipeline, updatePolicy?: UpdatePolicy): void; | ||
updatePipe(entries: EntryUpdateQuery[], pipeline: ChainableCommander, updatePolicy?: UpdatePolicy): void; | ||
/** | ||
@@ -259,3 +259,3 @@ * Remove one or more entries from the leaderboard | ||
get redisClient(): Redis; | ||
get redisKey(): KeyType; | ||
get redisKey(): RedisKey; | ||
get sortPolicy(): SortPolicy; | ||
@@ -269,3 +269,3 @@ get updatePolicy(): UpdatePolicy; | ||
*/ | ||
static execPipeline(pipeline: Pipeline): Promise<any[]>; | ||
static execPipeline(pipeline: ChainableCommander): Promise<any[]>; | ||
} |
@@ -276,3 +276,3 @@ "use strict"; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.zrem(this.key, ids)]; | ||
case 0: return [4 /*yield*/, this.client.zrem(this.key, typeof ids === 'string' ? [ids] : ids)]; | ||
case 1: | ||
@@ -538,2 +538,5 @@ _a.sent(); | ||
outputs = _b.sent(); | ||
/* istanbul ignore next */ | ||
if (outputs === null) | ||
throw new Error('Pipeline error'); | ||
results = []; | ||
@@ -540,0 +543,0 @@ for (_i = 0, outputs_1 = outputs; _i < outputs_1.length; _i++) { |
@@ -175,3 +175,3 @@ "use strict"; | ||
if (lb) | ||
pipeline.zrem(lb.redisKey, ids); | ||
pipeline.zrem(lb.redisKey, typeof ids === 'string' ? [ids] : ids); | ||
} | ||
@@ -178,0 +178,0 @@ } |
{ | ||
"name": "redis-rank", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Manage real-time leaderboards using Redis", | ||
@@ -33,14 +33,13 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/ioredis": "^4.28.7", | ||
"@types/jest": "^27.4.0", | ||
"@types/node": "^17.0.8", | ||
"@types/jest": "^27.4.1", | ||
"@types/node": "^17.0.23", | ||
"codecov": "^3.8.3", | ||
"ioredis": "^4.28.3", | ||
"jest": "^27.4.7", | ||
"ioredis": "^5.0.4", | ||
"jest": "^27.5.1", | ||
"nodemon": "^2.0.15", | ||
"ts-jest": "^27.1.2", | ||
"typescript": "^4.5.4" | ||
"ts-jest": "^27.1.4", | ||
"typescript": "^4.6.3" | ||
}, | ||
"peerDependencies": { | ||
"ioredis": ">=4.x" | ||
"ioredis": ">=5.x" | ||
}, | ||
@@ -47,0 +46,0 @@ "jest": { |
@@ -31,2 +31,4 @@ | ||
⚠️ For ioredis <= 4.x use `redis-rank@2.1.2`, for ioredis >= 5.x use the latest version. | ||
```shell | ||
@@ -33,0 +35,0 @@ $ npm install redis-rank ioredis |
Sorry, the diff of this file is not supported yet
96035
8
2021
117