@upstash/redis 1.8.0 → 1.9.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/pkg/commands/lpos.js +19 -0
- package/esm/pkg/commands/mod.js +1 -0
- package/esm/pkg/commands/sdiffstore.js +1 -1
- package/esm/pkg/pipeline.js +10 -1
- package/esm/pkg/redis.js +10 -1
- package/package.json +2 -2
- package/script/pkg/commands/lpos.js +23 -0
- package/script/pkg/commands/mod.js +1 -0
- package/script/pkg/commands/sdiffstore.js +1 -1
- package/script/pkg/pipeline.js +9 -0
- package/script/pkg/redis.js +9 -0
- package/types/pkg/commands/lpos.d.ts +15 -0
- package/types/pkg/commands/mod.d.ts +1 -0
- package/types/pkg/commands/sdiffstore.d.ts +1 -1
- package/types/pkg/commands/spop.d.ts +2 -2
- package/types/pkg/pipeline.d.ts +8 -0
- package/types/pkg/redis.d.ts +8 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from "./command.js";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://redis.io/commands/lpos
|
|
4
|
+
*/
|
|
5
|
+
export class LPosCommand extends Command {
|
|
6
|
+
constructor(cmd, opts) {
|
|
7
|
+
const args = ["lpos", cmd[0], cmd[1]];
|
|
8
|
+
if (typeof cmd[2]?.rank === "number") {
|
|
9
|
+
args.push("rank", cmd[2].rank);
|
|
10
|
+
}
|
|
11
|
+
if (typeof cmd[2]?.count === "number") {
|
|
12
|
+
args.push("count", cmd[2].count);
|
|
13
|
+
}
|
|
14
|
+
if (typeof cmd[2]?.maxLen === "number") {
|
|
15
|
+
args.push("maxLen", cmd[2].maxLen);
|
|
16
|
+
}
|
|
17
|
+
super(args, opts);
|
|
18
|
+
}
|
|
19
|
+
}
|
package/esm/pkg/commands/mod.js
CHANGED
package/esm/pkg/pipeline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
1
|
+
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
2
2
|
import { UpstashError } from "./error.js";
|
|
3
3
|
/**
|
|
4
4
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
@@ -475,6 +475,15 @@ export class Pipeline {
|
|
|
475
475
|
writable: true,
|
|
476
476
|
value: (...args) => this.chain(new LPopCommand(args, this.commandOptions))
|
|
477
477
|
});
|
|
478
|
+
/**
|
|
479
|
+
* @see https://redis.io/commands/lpos
|
|
480
|
+
*/
|
|
481
|
+
Object.defineProperty(this, "lpos", {
|
|
482
|
+
enumerable: true,
|
|
483
|
+
configurable: true,
|
|
484
|
+
writable: true,
|
|
485
|
+
value: (...args) => this.chain(new LPosCommand(args, this.commandOptions))
|
|
486
|
+
});
|
|
478
487
|
/**
|
|
479
488
|
* @see https://redis.io/commands/lpush
|
|
480
489
|
*/
|
package/esm/pkg/redis.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
1
|
+
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
2
2
|
import { Pipeline } from "./pipeline.js";
|
|
3
3
|
/**
|
|
4
4
|
* Serverless redis client for upstash.
|
|
@@ -426,6 +426,15 @@ export class Redis {
|
|
|
426
426
|
writable: true,
|
|
427
427
|
value: (...args) => new LPopCommand(args, this.opts).exec(this.client)
|
|
428
428
|
});
|
|
429
|
+
/**
|
|
430
|
+
* @see https://redis.io/commands/lpos
|
|
431
|
+
*/
|
|
432
|
+
Object.defineProperty(this, "lpos", {
|
|
433
|
+
enumerable: true,
|
|
434
|
+
configurable: true,
|
|
435
|
+
writable: true,
|
|
436
|
+
value: (...args) => new LPosCommand(args, this.opts).exec(this.client)
|
|
437
|
+
});
|
|
429
438
|
/**
|
|
430
439
|
* @see https://redis.io/commands/lpush
|
|
431
440
|
*/
|
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
"main": "./script/platforms/nodejs.js",
|
|
4
4
|
"types": "./types/platforms/nodejs.d.ts",
|
|
5
5
|
"name": "@upstash/redis",
|
|
6
|
-
"version": "v1.8.0",
|
|
7
6
|
"description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
@@ -97,5 +96,6 @@
|
|
|
97
96
|
"require": "./script/platforms/node_with_fetch.js",
|
|
98
97
|
"types": "./types/platforms/node_with_fetch.d.ts"
|
|
99
98
|
}
|
|
100
|
-
}
|
|
99
|
+
},
|
|
100
|
+
"version": "1.9.1-next.1"
|
|
101
101
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LPosCommand = void 0;
|
|
4
|
+
const command_js_1 = require("./command.js");
|
|
5
|
+
/**
|
|
6
|
+
* @see https://redis.io/commands/lpos
|
|
7
|
+
*/
|
|
8
|
+
class LPosCommand extends command_js_1.Command {
|
|
9
|
+
constructor(cmd, opts) {
|
|
10
|
+
const args = ["lpos", cmd[0], cmd[1]];
|
|
11
|
+
if (typeof cmd[2]?.rank === "number") {
|
|
12
|
+
args.push("rank", cmd[2].rank);
|
|
13
|
+
}
|
|
14
|
+
if (typeof cmd[2]?.count === "number") {
|
|
15
|
+
args.push("count", cmd[2].count);
|
|
16
|
+
}
|
|
17
|
+
if (typeof cmd[2]?.maxLen === "number") {
|
|
18
|
+
args.push("maxLen", cmd[2].maxLen);
|
|
19
|
+
}
|
|
20
|
+
super(args, opts);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.LPosCommand = LPosCommand;
|
|
@@ -58,6 +58,7 @@ __exportStar(require("./lindex.js"), exports);
|
|
|
58
58
|
__exportStar(require("./linsert.js"), exports);
|
|
59
59
|
__exportStar(require("./llen.js"), exports);
|
|
60
60
|
__exportStar(require("./lpop.js"), exports);
|
|
61
|
+
__exportStar(require("./lpos.js"), exports);
|
|
61
62
|
__exportStar(require("./lpush.js"), exports);
|
|
62
63
|
__exportStar(require("./lpushx.js"), exports);
|
|
63
64
|
__exportStar(require("./lrange.js"), exports);
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SDiffStoreCommand = void 0;
|
|
4
4
|
const command_js_1 = require("./command.js");
|
|
5
5
|
/**
|
|
6
|
-
* @see https://redis.io/commands/
|
|
6
|
+
* @see https://redis.io/commands/sdiffstore
|
|
7
7
|
*/
|
|
8
8
|
class SDiffStoreCommand extends command_js_1.Command {
|
|
9
9
|
constructor(cmd, opts) {
|
package/script/pkg/pipeline.js
CHANGED
|
@@ -478,6 +478,15 @@ class Pipeline {
|
|
|
478
478
|
writable: true,
|
|
479
479
|
value: (...args) => this.chain(new mod_js_1.LPopCommand(args, this.commandOptions))
|
|
480
480
|
});
|
|
481
|
+
/**
|
|
482
|
+
* @see https://redis.io/commands/lpos
|
|
483
|
+
*/
|
|
484
|
+
Object.defineProperty(this, "lpos", {
|
|
485
|
+
enumerable: true,
|
|
486
|
+
configurable: true,
|
|
487
|
+
writable: true,
|
|
488
|
+
value: (...args) => this.chain(new mod_js_1.LPosCommand(args, this.commandOptions))
|
|
489
|
+
});
|
|
481
490
|
/**
|
|
482
491
|
* @see https://redis.io/commands/lpush
|
|
483
492
|
*/
|
package/script/pkg/redis.js
CHANGED
|
@@ -429,6 +429,15 @@ class Redis {
|
|
|
429
429
|
writable: true,
|
|
430
430
|
value: (...args) => new mod_js_1.LPopCommand(args, this.opts).exec(this.client)
|
|
431
431
|
});
|
|
432
|
+
/**
|
|
433
|
+
* @see https://redis.io/commands/lpos
|
|
434
|
+
*/
|
|
435
|
+
Object.defineProperty(this, "lpos", {
|
|
436
|
+
enumerable: true,
|
|
437
|
+
configurable: true,
|
|
438
|
+
writable: true,
|
|
439
|
+
value: (...args) => new mod_js_1.LPosCommand(args, this.opts).exec(this.client)
|
|
440
|
+
});
|
|
432
441
|
/**
|
|
433
442
|
* @see https://redis.io/commands/lpush
|
|
434
443
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command, CommandOptions } from "./command.js";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://redis.io/commands/lpos
|
|
4
|
+
*/
|
|
5
|
+
export declare class LPosCommand<TData = number> extends Command<TData, TData> {
|
|
6
|
+
constructor(cmd: [
|
|
7
|
+
key: string,
|
|
8
|
+
element: unknown,
|
|
9
|
+
opts?: {
|
|
10
|
+
rank?: number;
|
|
11
|
+
count?: number;
|
|
12
|
+
maxLen?: number;
|
|
13
|
+
}
|
|
14
|
+
], opts?: CommandOptions<TData, TData>);
|
|
15
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, CommandOptions } from "./command.js";
|
|
2
2
|
/**
|
|
3
|
-
* @see https://redis.io/commands/
|
|
3
|
+
* @see https://redis.io/commands/sdiffstore
|
|
4
4
|
*/
|
|
5
5
|
export declare class SDiffStoreCommand extends Command<number, number> {
|
|
6
6
|
constructor(cmd: [destination: string, ...keys: string[]], opts?: CommandOptions<number, number>);
|
|
@@ -2,6 +2,6 @@ import { Command, CommandOptions } from "./command.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @see https://redis.io/commands/spop
|
|
4
4
|
*/
|
|
5
|
-
export declare class SPopCommand<TData> extends Command<string | null, TData | null> {
|
|
6
|
-
constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | null, TData | null>);
|
|
5
|
+
export declare class SPopCommand<TData> extends Command<string | string[] | null, TData | null> {
|
|
6
|
+
constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | string[] | null, TData | null>);
|
|
7
7
|
}
|
package/types/pkg/pipeline.d.ts
CHANGED
|
@@ -242,6 +242,14 @@ export declare class Pipeline {
|
|
|
242
242
|
* @see https://redis.io/commands/lpop
|
|
243
243
|
*/
|
|
244
244
|
lpop: <TData>(key: string, count?: number | undefined) => this;
|
|
245
|
+
/**
|
|
246
|
+
* @see https://redis.io/commands/lpos
|
|
247
|
+
*/
|
|
248
|
+
lpos: <TData>(key: string, element: unknown, opts?: {
|
|
249
|
+
rank?: number | undefined;
|
|
250
|
+
count?: number | undefined;
|
|
251
|
+
maxLen?: number | undefined;
|
|
252
|
+
} | undefined) => this;
|
|
245
253
|
/**
|
|
246
254
|
* @see https://redis.io/commands/lpush
|
|
247
255
|
*/
|
package/types/pkg/redis.d.ts
CHANGED
|
@@ -215,6 +215,14 @@ export declare class Redis {
|
|
|
215
215
|
* @see https://redis.io/commands/lpop
|
|
216
216
|
*/
|
|
217
217
|
lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
|
|
218
|
+
/**
|
|
219
|
+
* @see https://redis.io/commands/lpos
|
|
220
|
+
*/
|
|
221
|
+
lpos: <TData = number>(key: string, element: unknown, opts?: {
|
|
222
|
+
rank?: number | undefined;
|
|
223
|
+
count?: number | undefined;
|
|
224
|
+
maxLen?: number | undefined;
|
|
225
|
+
} | undefined) => Promise<TData>;
|
|
218
226
|
/**
|
|
219
227
|
* @see https://redis.io/commands/lpush
|
|
220
228
|
*/
|