@upstash/redis 1.12.0-rc.1 → 1.13.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.
Files changed (26) hide show
  1. package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +1 -0
  2. package/esm/deps/{denopkg.com/chiefbiiko/sha1@master → deno.land/x/sha1@v1.0.3}/mod.js +0 -0
  3. package/esm/deps/denopkg.com/chiefbiiko/{std-encoding@v1.1.1 → std-encoding@v1.0.0}/mod.js +4 -8
  4. package/esm/pkg/commands/zmscore.js +11 -0
  5. package/esm/pkg/pipeline.js +10 -0
  6. package/esm/pkg/redis.js +10 -0
  7. package/esm/pkg/script.js +1 -1
  8. package/package.json +1 -1
  9. package/script/deps/{denopkg.com/chiefbiiko/sha1@master → deno.land/x/sha1@v1.0.3}/deps.js +1 -1
  10. package/script/deps/{denopkg.com/chiefbiiko/sha1@master → deno.land/x/sha1@v1.0.3}/mod.js +0 -0
  11. package/script/deps/denopkg.com/chiefbiiko/{std-encoding@v1.1.1 → std-encoding@v1.0.0}/mod.js +4 -31
  12. package/script/pkg/commands/zmscore.js +15 -0
  13. package/script/pkg/pipeline.js +10 -0
  14. package/script/pkg/redis.js +10 -0
  15. package/script/pkg/script.js +1 -1
  16. package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +1 -0
  17. package/types/deps/{denopkg.com/chiefbiiko/sha1@master → deno.land/x/sha1@v1.0.3}/mod.d.ts +0 -0
  18. package/types/deps/denopkg.com/chiefbiiko/{std-encoding@v1.1.1 → std-encoding@v1.0.0}/mod.d.ts +0 -0
  19. package/types/pkg/commands/zmscore.d.ts +7 -0
  20. package/types/pkg/pipeline.d.ts +5 -1
  21. package/types/pkg/redis.d.ts +5 -1
  22. package/esm/deps/deno.land/x/base64@v0.2.1/mod.js +0 -13
  23. package/esm/deps/denopkg.com/chiefbiiko/sha1@master/deps.js +0 -1
  24. package/script/deps/deno.land/x/base64@v0.2.1/mod.js +0 -17
  25. package/types/deps/deno.land/x/base64@v0.2.1/mod.d.ts +0 -1
  26. package/types/deps/denopkg.com/chiefbiiko/sha1@master/deps.d.ts +0 -1
@@ -0,0 +1 @@
1
+ export { encode, decode } from "../../../denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js";
@@ -1,5 +1,4 @@
1
- import * as base64 from "../../../deno.land/x/base64@v0.2.1/mod.js";
2
- import * as base64url from "../../../deno.land/x/base64@v0.2.1/base64url.js";
1
+ import { toUint8Array, fromUint8Array } from "../../../deno.land/x/base64@v0.2.1/base64url.js";
3
2
  const decoder = new TextDecoder();
4
3
  const encoder = new TextEncoder();
5
4
  /** Serializes a Uint8Array to a hexadecimal string. */
@@ -26,10 +25,7 @@ export function decode(buf, encoding = "utf8") {
26
25
  return decoder.decode(buf);
27
26
  }
28
27
  else if (/^base64$/i.test(encoding)) {
29
- return base64.fromUint8Array(buf);
30
- }
31
- else if (/^base64url$/i.test(encoding)) {
32
- return base64url.fromUint8Array(buf);
28
+ return fromUint8Array(buf);
33
29
  }
34
30
  else if (/^hex(?:adecimal)?$/i.test(encoding)) {
35
31
  return toHexString(buf);
@@ -42,8 +38,8 @@ export function encode(str, encoding = "utf8") {
42
38
  if (/^utf-?8$/i.test(encoding)) {
43
39
  return encoder.encode(str);
44
40
  }
45
- else if (/^base64(?:url)?$/i.test(encoding)) {
46
- return base64.toUint8Array(str);
41
+ else if (/^base64$/i.test(encoding)) {
42
+ return toUint8Array(str);
47
43
  }
48
44
  else if (/^hex(?:adecimal)?$/i.test(encoding)) {
49
45
  return fromHexString(str);
@@ -0,0 +1,11 @@
1
+ import { Command } from "./command.js";
2
+ /**
3
+ * @see https://redis.io/commands/zscore
4
+ */
5
+ export class ZMScoreCommand extends Command {
6
+ constructor(cmd, opts) {
7
+ const [key, members] = cmd;
8
+ console.log({ key, members });
9
+ super(["zmscore", key, ...members], opts);
10
+ }
11
+ }
@@ -1,5 +1,6 @@
1
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
+ import { ZMScoreCommand } from "./commands/zmscore.js";
3
4
  /**
4
5
  * Upstash REST API supports command pipelining to send multiple commands in
5
6
  * batch, instead of sending each command one by one and waiting for a response.
@@ -1011,6 +1012,15 @@ export class Pipeline {
1011
1012
  writable: true,
1012
1013
  value: (...args) => this.chain(new ZLexCountCommand(args, this.commandOptions))
1013
1014
  });
1015
+ /**
1016
+ * @see https://redis.io/commands/zmscore
1017
+ */
1018
+ Object.defineProperty(this, "zmscore", {
1019
+ enumerable: true,
1020
+ configurable: true,
1021
+ writable: true,
1022
+ value: (...args) => this.chain(new ZMScoreCommand(args, this.commandOptions))
1023
+ });
1014
1024
  /**
1015
1025
  * @see https://redis.io/commands/zpopmax
1016
1026
  */
package/esm/pkg/redis.js CHANGED
@@ -1,6 +1,7 @@
1
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
  import { Script } from "./script.js";
4
+ import { ZMScoreCommand } from "./commands/zmscore.js";
4
5
  /**
5
6
  * Serverless redis client for upstash.
6
7
  */
@@ -975,6 +976,15 @@ export class Redis {
975
976
  writable: true,
976
977
  value: (...args) => new ZLexCountCommand(args, this.opts).exec(this.client)
977
978
  });
979
+ /**
980
+ * @see https://redis.io/commands/zmscore
981
+ */
982
+ Object.defineProperty(this, "zmscore", {
983
+ enumerable: true,
984
+ configurable: true,
985
+ writable: true,
986
+ value: (...args) => new ZMScoreCommand(args, this.opts).exec(this.client)
987
+ });
978
988
  /**
979
989
  * @see https://redis.io/commands/zpopmax
980
990
  */
package/esm/pkg/script.js CHANGED
@@ -1,4 +1,4 @@
1
- import { sha1 as digest } from "../deps/denopkg.com/chiefbiiko/sha1@master/mod.js";
1
+ import { sha1 as digest } from "../deps/deno.land/x/sha1@v1.0.3/mod.js";
2
2
  /**
3
3
  * Creates a new script.
4
4
  *
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.12.0-rc.1",
6
+ "version": "v1.13.0",
7
7
  "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decode = exports.encode = void 0;
4
- var mod_js_1 = require("../std-encoding@v1.1.1/mod.js");
4
+ var mod_js_1 = require("../../../denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js");
5
5
  Object.defineProperty(exports, "encode", { enumerable: true, get: function () { return mod_js_1.encode; } });
6
6
  Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return mod_js_1.decode; } });
@@ -1,31 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.encode = exports.decode = void 0;
27
- const base64 = __importStar(require("../../../deno.land/x/base64@v0.2.1/mod.js"));
28
- const base64url = __importStar(require("../../../deno.land/x/base64@v0.2.1/base64url.js"));
4
+ const base64url_js_1 = require("../../../deno.land/x/base64@v0.2.1/base64url.js");
29
5
  const decoder = new TextDecoder();
30
6
  const encoder = new TextEncoder();
31
7
  /** Serializes a Uint8Array to a hexadecimal string. */
@@ -52,10 +28,7 @@ function decode(buf, encoding = "utf8") {
52
28
  return decoder.decode(buf);
53
29
  }
54
30
  else if (/^base64$/i.test(encoding)) {
55
- return base64.fromUint8Array(buf);
56
- }
57
- else if (/^base64url$/i.test(encoding)) {
58
- return base64url.fromUint8Array(buf);
31
+ return (0, base64url_js_1.fromUint8Array)(buf);
59
32
  }
60
33
  else if (/^hex(?:adecimal)?$/i.test(encoding)) {
61
34
  return toHexString(buf);
@@ -69,8 +42,8 @@ function encode(str, encoding = "utf8") {
69
42
  if (/^utf-?8$/i.test(encoding)) {
70
43
  return encoder.encode(str);
71
44
  }
72
- else if (/^base64(?:url)?$/i.test(encoding)) {
73
- return base64.toUint8Array(str);
45
+ else if (/^base64$/i.test(encoding)) {
46
+ return (0, base64url_js_1.toUint8Array)(str);
74
47
  }
75
48
  else if (/^hex(?:adecimal)?$/i.test(encoding)) {
76
49
  return fromHexString(str);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZMScoreCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/zscore
7
+ */
8
+ class ZMScoreCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ const [key, members] = cmd;
11
+ console.log({ key, members });
12
+ super(["zmscore", key, ...members], opts);
13
+ }
14
+ }
15
+ exports.ZMScoreCommand = ZMScoreCommand;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Pipeline = void 0;
4
4
  const mod_js_1 = require("./commands/mod.js");
5
5
  const error_js_1 = require("./error.js");
6
+ const zmscore_js_1 = require("./commands/zmscore.js");
6
7
  /**
7
8
  * Upstash REST API supports command pipelining to send multiple commands in
8
9
  * batch, instead of sending each command one by one and waiting for a response.
@@ -1014,6 +1015,15 @@ class Pipeline {
1014
1015
  writable: true,
1015
1016
  value: (...args) => this.chain(new mod_js_1.ZLexCountCommand(args, this.commandOptions))
1016
1017
  });
1018
+ /**
1019
+ * @see https://redis.io/commands/zmscore
1020
+ */
1021
+ Object.defineProperty(this, "zmscore", {
1022
+ enumerable: true,
1023
+ configurable: true,
1024
+ writable: true,
1025
+ value: (...args) => this.chain(new zmscore_js_1.ZMScoreCommand(args, this.commandOptions))
1026
+ });
1017
1027
  /**
1018
1028
  * @see https://redis.io/commands/zpopmax
1019
1029
  */
@@ -4,6 +4,7 @@ exports.Redis = void 0;
4
4
  const mod_js_1 = require("./commands/mod.js");
5
5
  const pipeline_js_1 = require("./pipeline.js");
6
6
  const script_js_1 = require("./script.js");
7
+ const zmscore_js_1 = require("./commands/zmscore.js");
7
8
  /**
8
9
  * Serverless redis client for upstash.
9
10
  */
@@ -978,6 +979,15 @@ class Redis {
978
979
  writable: true,
979
980
  value: (...args) => new mod_js_1.ZLexCountCommand(args, this.opts).exec(this.client)
980
981
  });
982
+ /**
983
+ * @see https://redis.io/commands/zmscore
984
+ */
985
+ Object.defineProperty(this, "zmscore", {
986
+ enumerable: true,
987
+ configurable: true,
988
+ writable: true,
989
+ value: (...args) => new zmscore_js_1.ZMScoreCommand(args, this.opts).exec(this.client)
990
+ });
981
991
  /**
982
992
  * @see https://redis.io/commands/zpopmax
983
993
  */
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Script = void 0;
4
- const mod_js_1 = require("../deps/denopkg.com/chiefbiiko/sha1@master/mod.js");
4
+ const mod_js_1 = require("../deps/deno.land/x/sha1@v1.0.3/mod.js");
5
5
  /**
6
6
  * Creates a new script.
7
7
  *
@@ -0,0 +1 @@
1
+ export { encode, decode } from "../../../denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js";
@@ -0,0 +1,7 @@
1
+ import { Command, CommandOptions } from "./command.js";
2
+ /**
3
+ * @see https://redis.io/commands/zscore
4
+ */
5
+ export declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] | null> {
6
+ constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
7
+ }
@@ -374,7 +374,7 @@ export declare class Pipeline {
374
374
  /**
375
375
  * @see https://redis.io/commands/set
376
376
  */
377
- set: <TData>(key: string, value: TData, opts?: SetCommandOptions | undefined) => this;
377
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions) => this;
378
378
  /**
379
379
  * @see https://redis.io/commands/setbit
380
380
  */
@@ -483,6 +483,10 @@ export declare class Pipeline {
483
483
  * @see https://redis.io/commands/zlexcount
484
484
  */
485
485
  zlexcount: (key: string, min: string, max: string) => this;
486
+ /**
487
+ * @see https://redis.io/commands/zmscore
488
+ */
489
+ zmscore: (key: string, members: unknown[]) => this;
486
490
  /**
487
491
  * @see https://redis.io/commands/zpopmax
488
492
  */
@@ -356,7 +356,7 @@ export declare class Redis {
356
356
  /**
357
357
  * @see https://redis.io/commands/set
358
358
  */
359
- set: <TData>(key: string, value: TData, opts?: SetCommandOptions | undefined) => Promise<"OK" | TData | null>;
359
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions) => Promise<"OK" | TData | null>;
360
360
  /**
361
361
  * @see https://redis.io/commands/setbit
362
362
  */
@@ -465,6 +465,10 @@ export declare class Redis {
465
465
  * @see https://redis.io/commands/zlexcount
466
466
  */
467
467
  zlexcount: (key: string, min: string, max: string) => Promise<number>;
468
+ /**
469
+ * @see https://redis.io/commands/zmscore
470
+ */
471
+ zmscore: (key: string, members: unknown[]) => Promise<number[] | null>;
468
472
  /**
469
473
  * @see https://redis.io/commands/zpopmax
470
474
  */
@@ -1,13 +0,0 @@
1
- import { init } from "./base.js";
2
- const lookup = [];
3
- const revLookup = [];
4
- const code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
5
- for (let i = 0, l = code.length; i < l; ++i) {
6
- lookup[i] = code[i];
7
- revLookup[code.charCodeAt(i)] = i;
8
- }
9
- // Support decoding URL-safe base64 strings, as Node.js does.
10
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
11
- revLookup["-".charCodeAt(0)] = 62;
12
- revLookup["_".charCodeAt(0)] = 63;
13
- export const { byteLength, toUint8Array, fromUint8Array } = init(lookup, revLookup);
@@ -1 +0,0 @@
1
- export { encode, decode } from "../std-encoding@v1.1.1/mod.js";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.fromUint8Array = exports.toUint8Array = exports.byteLength = void 0;
5
- const base_js_1 = require("./base.js");
6
- const lookup = [];
7
- const revLookup = [];
8
- const code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
9
- for (let i = 0, l = code.length; i < l; ++i) {
10
- lookup[i] = code[i];
11
- revLookup[code.charCodeAt(i)] = i;
12
- }
13
- // Support decoding URL-safe base64 strings, as Node.js does.
14
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
15
- revLookup["-".charCodeAt(0)] = 62;
16
- revLookup["_".charCodeAt(0)] = 63;
17
- _a = (0, base_js_1.init)(lookup, revLookup), exports.byteLength = _a.byteLength, exports.toUint8Array = _a.toUint8Array, exports.fromUint8Array = _a.fromUint8Array;
@@ -1 +0,0 @@
1
- export declare const byteLength: (b64: string) => number, toUint8Array: (b64: string) => Uint8Array, fromUint8Array: (buf: Uint8Array) => string;
@@ -1 +0,0 @@
1
- export { encode, decode } from "../std-encoding@v1.1.1/mod.js";