@upstash/redis 1.23.3 → 1.24.0-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.
@@ -0,0 +1,27 @@
1
+ import { Command } from "./command.js";
2
+ /**
3
+ * @see https://redis.io/commands/geoadd
4
+ */
5
+ export class GeoAddCommand extends Command {
6
+ constructor([key, arg1, ...arg2], opts) {
7
+ const command = ["geoadd", key];
8
+ if ("nx" in arg1 && arg1.nx) {
9
+ command.push("nx");
10
+ }
11
+ else if ("xx" in arg1 && arg1.xx) {
12
+ command.push("xx");
13
+ }
14
+ if ("ch" in arg1 && arg1.ch) {
15
+ command.push("ch");
16
+ }
17
+ if ("latitude" in arg1 && arg1.latitude) {
18
+ command.push(arg1.longitude, arg1.latitude, arg1.member);
19
+ }
20
+ command.push(...arg2.flatMap(({ latitude, longitude, member }) => [
21
+ longitude,
22
+ latitude,
23
+ member,
24
+ ]));
25
+ super(command, opts);
26
+ }
27
+ }
@@ -15,6 +15,7 @@ export * from "./expire.js";
15
15
  export * from "./expireat.js";
16
16
  export * from "./flushall.js";
17
17
  export * from "./flushdb.js";
18
+ export * from "./geo_add.js";
18
19
  export * from "./get.js";
19
20
  export * from "./getbit.js";
20
21
  export * from "./getdel.js";
@@ -1190,6 +1190,12 @@ export class Pipeline {
1190
1190
  this.commandOptions = opts.commandOptions;
1191
1191
  this.multiExec = opts.multiExec ?? false;
1192
1192
  }
1193
+ /**
1194
+ * Returns the length of pipeline before the execution
1195
+ */
1196
+ length() {
1197
+ return this.commands.length;
1198
+ }
1193
1199
  /**
1194
1200
  * Pushes a command into the pipeline and returns a chainable instance of the
1195
1201
  * pipeline
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, GetDelCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HRandFieldCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, JsonArrAppendCommand, JsonArrIndexCommand, JsonArrInsertCommand, JsonArrLenCommand, JsonArrPopCommand, JsonArrTrimCommand, JsonClearCommand, JsonDelCommand, JsonForgetCommand, JsonGetCommand, JsonMGetCommand, JsonNumIncrByCommand, JsonNumMultByCommand, JsonObjKeysCommand, JsonObjLenCommand, JsonRespCommand, JsonSetCommand, JsonStrAppendCommand, JsonStrLenCommand, JsonToggleCommand, JsonTypeCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LMoveCommand, 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, SMIsMemberCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, XAddCommand, XRangeCommand, 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, GeoAddCommand, GetBitCommand, GetCommand, GetDelCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HRandFieldCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, JsonArrAppendCommand, JsonArrIndexCommand, JsonArrInsertCommand, JsonArrLenCommand, JsonArrPopCommand, JsonArrTrimCommand, JsonClearCommand, JsonDelCommand, JsonForgetCommand, JsonGetCommand, JsonMGetCommand, JsonNumIncrByCommand, JsonNumMultByCommand, JsonObjKeysCommand, JsonObjLenCommand, JsonRespCommand, JsonSetCommand, JsonStrAppendCommand, JsonStrLenCommand, JsonToggleCommand, JsonTypeCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LMoveCommand, 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, SMIsMemberCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, XAddCommand, XRangeCommand, 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
  import { Script } from "./script.js";
4
4
  import { ZMScoreCommand } from "./commands/zmscore.js";
@@ -390,8 +390,7 @@ export class Redis {
390
390
  enumerable: true,
391
391
  configurable: true,
392
392
  writable: true,
393
- value: (key, count, withValues) => new HRandFieldCommand([key, count, withValues], this.opts)
394
- .exec(this.client)
393
+ value: (key, count, withValues) => new HRandFieldCommand([key, count, withValues], this.opts).exec(this.client)
395
394
  });
396
395
  /**
397
396
  * @see https://redis.io/commands/hscan
@@ -1250,6 +1249,10 @@ export class Redis {
1250
1249
  * @see https://redis.io/commands/json.forget
1251
1250
  */
1252
1251
  forget: (...args) => new JsonForgetCommand(args, this.opts).exec(this.client),
1252
+ /**
1253
+ * @see https://redis.io/commands/geoadd
1254
+ */
1255
+ geoadd: (...args) => new GeoAddCommand(args, this.opts).exec(this.client),
1253
1256
  /**
1254
1257
  * @see https://redis.io/commands/json.get
1255
1258
  */
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "v1.23.3";
1
+ export const VERSION = "v0.0.0";
package/package.json CHANGED
@@ -3,7 +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.23.3",
6
+ "version": "1.24.0-next.1",
7
7
  "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeoAddCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/geoadd
7
+ */
8
+ class GeoAddCommand extends command_js_1.Command {
9
+ constructor([key, arg1, ...arg2], opts) {
10
+ const command = ["geoadd", key];
11
+ if ("nx" in arg1 && arg1.nx) {
12
+ command.push("nx");
13
+ }
14
+ else if ("xx" in arg1 && arg1.xx) {
15
+ command.push("xx");
16
+ }
17
+ if ("ch" in arg1 && arg1.ch) {
18
+ command.push("ch");
19
+ }
20
+ if ("latitude" in arg1 && arg1.latitude) {
21
+ command.push(arg1.longitude, arg1.latitude, arg1.member);
22
+ }
23
+ command.push(...arg2.flatMap(({ latitude, longitude, member }) => [
24
+ longitude,
25
+ latitude,
26
+ member,
27
+ ]));
28
+ super(command, opts);
29
+ }
30
+ }
31
+ exports.GeoAddCommand = GeoAddCommand;
@@ -31,6 +31,7 @@ __exportStar(require("./expire.js"), exports);
31
31
  __exportStar(require("./expireat.js"), exports);
32
32
  __exportStar(require("./flushall.js"), exports);
33
33
  __exportStar(require("./flushdb.js"), exports);
34
+ __exportStar(require("./geo_add.js"), exports);
34
35
  __exportStar(require("./get.js"), exports);
35
36
  __exportStar(require("./getbit.js"), exports);
36
37
  __exportStar(require("./getdel.js"), exports);
@@ -1193,6 +1193,12 @@ class Pipeline {
1193
1193
  this.commandOptions = opts.commandOptions;
1194
1194
  this.multiExec = opts.multiExec ?? false;
1195
1195
  }
1196
+ /**
1197
+ * Returns the length of pipeline before the execution
1198
+ */
1199
+ length() {
1200
+ return this.commands.length;
1201
+ }
1196
1202
  /**
1197
1203
  * Pushes a command into the pipeline and returns a chainable instance of the
1198
1204
  * pipeline
@@ -393,8 +393,7 @@ class Redis {
393
393
  enumerable: true,
394
394
  configurable: true,
395
395
  writable: true,
396
- value: (key, count, withValues) => new mod_js_1.HRandFieldCommand([key, count, withValues], this.opts)
397
- .exec(this.client)
396
+ value: (key, count, withValues) => new mod_js_1.HRandFieldCommand([key, count, withValues], this.opts).exec(this.client)
398
397
  });
399
398
  /**
400
399
  * @see https://redis.io/commands/hscan
@@ -1253,6 +1252,10 @@ class Redis {
1253
1252
  * @see https://redis.io/commands/json.forget
1254
1253
  */
1255
1254
  forget: (...args) => new mod_js_1.JsonForgetCommand(args, this.opts).exec(this.client),
1255
+ /**
1256
+ * @see https://redis.io/commands/geoadd
1257
+ */
1258
+ geoadd: (...args) => new mod_js_1.GeoAddCommand(args, this.opts).exec(this.client),
1256
1259
  /**
1257
1260
  * @see https://redis.io/commands/json.get
1258
1261
  */
package/script/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "v1.23.3";
4
+ exports.VERSION = "v0.0.0";
@@ -0,0 +1,25 @@
1
+ import { Command, CommandOptions } from "./command.js";
2
+ export type GeoAddCommandOptions = {
3
+ nx?: boolean;
4
+ xx?: never;
5
+ } | ({
6
+ nx?: never;
7
+ xx?: boolean;
8
+ } & {
9
+ ch?: boolean;
10
+ });
11
+ export interface GeoMember<TMemberType> {
12
+ latitude: number;
13
+ longitude: number;
14
+ member: TMemberType;
15
+ }
16
+ /**
17
+ * @see https://redis.io/commands/geoadd
18
+ */
19
+ export declare class GeoAddCommand<TMemberType = string> extends Command<number | null, number | null> {
20
+ constructor([key, arg1, ...arg2]: [
21
+ string,
22
+ GeoMember<TMemberType> | GeoAddCommandOptions,
23
+ ...GeoMember<TMemberType>[]
24
+ ], opts?: CommandOptions<number | null, number | null>);
25
+ }
@@ -15,6 +15,7 @@ export * from "./expire.js";
15
15
  export * from "./expireat.js";
16
16
  export * from "./flushall.js";
17
17
  export * from "./flushdb.js";
18
+ export * from "./geo_add.js";
18
19
  export * from "./get.js";
19
20
  export * from "./getbit.js";
20
21
  export * from "./getdel.js";
@@ -66,6 +66,10 @@ export declare class Pipeline<TCommands extends Command<any, any>[] = []> {
66
66
  * ```
67
67
  */
68
68
  exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
69
+ /**
70
+ * Returns the length of pipeline before the execution
71
+ */
72
+ length(): number;
69
73
  /**
70
74
  * Pushes a command into the pipeline and returns a chainable instance of the
71
75
  * pipeline
@@ -61,6 +61,10 @@ export declare class Redis {
61
61
  * @see https://redis.io/commands/json.forget
62
62
  */
63
63
  forget: (key: string, path?: string | undefined) => Promise<number>;
64
+ /**
65
+ * @see https://redis.io/commands/geoadd
66
+ */
67
+ geoadd: (args_0: string, args_1: import("./commands/geo_add.js").GeoAddCommandOptions | import("./commands/geo_add.js").GeoMember<unknown>, ...args_2: import("./commands/geo_add.js").GeoMember<unknown>[]) => Promise<number | null>;
64
68
  /**
65
69
  * @see https://redis.io/commands/json.get
66
70
  */
@@ -1 +1 @@
1
- export declare const VERSION = "v1.23.3";
1
+ export declare const VERSION = "v0.0.0";