@upstash/redis 1.7.1-next.1 → 1.9.0

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.
@@ -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
+ }
@@ -42,6 +42,7 @@ export * from "./lindex.js";
42
42
  export * from "./linsert.js";
43
43
  export * from "./llen.js";
44
44
  export * from "./lpop.js";
45
+ export * from "./lpos.js";
45
46
  export * from "./lpush.js";
46
47
  export * from "./lpushx.js";
47
48
  export * from "./lrange.js";
@@ -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,6 +3,7 @@
3
3
  "main": "./script/platforms/nodejs.js",
4
4
  "types": "./types/platforms/nodejs.d.ts",
5
5
  "name": "@upstash/redis",
6
+ "version": "v1.9.0",
6
7
  "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
7
8
  "repository": {
8
9
  "type": "git",
@@ -96,6 +97,5 @@
96
97
  "require": "./script/platforms/node_with_fetch.js",
97
98
  "types": "./types/platforms/node_with_fetch.d.ts"
98
99
  }
99
- },
100
- "version": "1.7.1-next.1"
100
+ }
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);
@@ -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
  */
@@ -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
+ }
@@ -42,6 +42,7 @@ export * from "./lindex.js";
42
42
  export * from "./linsert.js";
43
43
  export * from "./llen.js";
44
44
  export * from "./lpop.js";
45
+ export * from "./lpos.js";
45
46
  export * from "./lpush.js";
46
47
  export * from "./lpushx.js";
47
48
  export * from "./lrange.js";
@@ -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
  */
@@ -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
  */