@upstash/redis 1.4.0 → 1.5.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.
@@ -5,16 +5,7 @@ import { Command } from "./command.js";
5
5
  export class ScriptExistsCommand extends Command {
6
6
  constructor(hashes, opts) {
7
7
  super(["script", "exists", ...hashes], {
8
- deserialize: (result) => {
9
- /**
10
- * This isn't very pretty but it does the job.
11
- * The user facing api is clean and will return a single `string` if they provided
12
- * a single script hash, and an array of strings of the same length when given an
13
- * array of hashes.
14
- */
15
- const parsed = result;
16
- return parsed.length === 1 ? parsed[0] : parsed;
17
- },
8
+ deserialize: (result) => result,
18
9
  ...opts,
19
10
  });
20
11
  }
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.5.0",
6
7
  "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
7
8
  "repository": {
8
9
  "type": "git",
@@ -15,24 +16,27 @@
15
16
  "edge",
16
17
  "upstash"
17
18
  ],
18
- "author": "Andreas Thomas <andreas.thomas@chronark.com>",
19
+ "author": "Andreas Thomas <dev@chronark.com>",
19
20
  "license": "MIT",
20
21
  "bugs": {
21
22
  "url": "https://github.com/upstash/upstash-redis/issues"
22
23
  },
23
- "dependencies": {
24
- "isomorphic-fetch": "^3.0.0"
25
- },
26
24
  "homepage": "https://github.com/upstash/upstash-redis#readme",
27
- "browser": {
28
- "isomorphic-fetch": false,
29
- "http": false,
30
- "https": false
31
- },
32
25
  "devDependencies": {
33
26
  "@size-limit/preset-small-lib": "latest",
34
27
  "size-limit": "latest"
35
28
  },
29
+ "dependencies": {
30
+ "isomorphic-fetch": "^3.0.0"
31
+ },
32
+ "typesVersions": {
33
+ "*": {
34
+ "nodejs": "./types/platforms/nodejs.d.ts",
35
+ "cloudflare": "./types/platforms/cloudflare.d.ts",
36
+ "fastly": "./types/platforms/fastly.d.ts",
37
+ "with-fetch": "./types/platforms/node_with_fetch.d.ts"
38
+ }
39
+ },
36
40
  "size-limit": [
37
41
  {
38
42
  "path": "esm/platforms/nodejs.js",
@@ -46,6 +50,10 @@
46
50
  "path": "esm/platforms/cloudflare.js",
47
51
  "limit": "5 KB"
48
52
  },
53
+ {
54
+ "path": "esm/platforms/node_with_fetch.js",
55
+ "limit": "15 KB"
56
+ },
49
57
  {
50
58
  "path": "script/platforms/nodejs.js",
51
59
  "limit": "10 KB"
@@ -57,6 +65,10 @@
57
65
  {
58
66
  "path": "script/platforms/cloudflare.js",
59
67
  "limit": "10 KB"
68
+ },
69
+ {
70
+ "path": "script/platforms/node_with_fetch.js",
71
+ "limit": "15 KB"
60
72
  }
61
73
  ],
62
74
  "exports": {
@@ -85,6 +97,5 @@
85
97
  "require": "./script/platforms/node_with_fetch.js",
86
98
  "types": "./types/platforms/node_with_fetch.d.ts"
87
99
  }
88
- },
89
- "version": "1.4.0"
100
+ }
90
101
  }
@@ -8,16 +8,7 @@ const command_js_1 = require("./command.js");
8
8
  class ScriptExistsCommand extends command_js_1.Command {
9
9
  constructor(hashes, opts) {
10
10
  super(["script", "exists", ...hashes], {
11
- deserialize: (result) => {
12
- /**
13
- * This isn't very pretty but it does the job.
14
- * The user facing api is clean and will return a single `string` if they provided
15
- * a single script hash, and an array of strings of the same length when given an
16
- * array of hashes.
17
- */
18
- const parsed = result;
19
- return parsed.length === 1 ? parsed[0] : parsed;
20
- },
11
+ deserialize: (result) => result,
21
12
  ...opts,
22
13
  });
23
14
  }
@@ -2,8 +2,8 @@ import { Command, CommandOptions } from "./command.js";
2
2
  /**
3
3
  * @see https://redis.io/commands/hmset
4
4
  */
5
- export declare class HMSetCommand<TData> extends Command<number, number> {
5
+ export declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
6
6
  constructor([key, kv]: [key: string, kv: {
7
7
  [field: string]: TData;
8
- }], opts?: CommandOptions<number, number>);
8
+ }], opts?: CommandOptions<"OK", "OK">);
9
9
  }
@@ -1,9 +1,7 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- declare type TupleOfLength<T, L extends number, R extends T[] = []> = R["length"] extends L ? R : TupleOfLength<T, L, [...R, T]>;
3
2
  /**
4
3
  * @see https://redis.io/commands/script-exists
5
4
  */
6
- export declare class ScriptExistsCommand<T extends [string, ...string[]]> extends Command<T extends [string] ? string : TupleOfLength<string, T["length"]>, TupleOfLength<string, T["length"]>> {
7
- constructor(hashes: T, opts?: CommandOptions<T extends [string] ? string : TupleOfLength<string, T["length"]>, TupleOfLength<string, T["length"]>>);
5
+ export declare class ScriptExistsCommand<T extends string[]> extends Command<string[], number[]> {
6
+ constructor(hashes: T, opts?: CommandOptions<string[], number[]>);
8
7
  }
9
- export {};
@@ -2,6 +2,6 @@ import { Command, CommandOptions } from "./command.js";
2
2
  /**
3
3
  * @see https://redis.io/commands/sinterstore
4
4
  */
5
- export declare class SInterStoreCommand<TData = string> extends Command<unknown[], TData[]> {
6
- constructor(cmd: [destination: string, key: string, ...keys: string[]], opts?: CommandOptions<unknown[], TData[]>);
5
+ export declare class SInterStoreCommand extends Command<number, number> {
6
+ constructor(cmd: [destination: string, key: string, ...keys: string[]], opts?: CommandOptions<number, number>);
7
7
  }
@@ -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 = number> extends Command<string | null, TData | null> {
5
+ export declare class SPopCommand<TData> extends Command<string | null, TData | null> {
6
6
  constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | null, TData | null>);
7
7
  }
@@ -1,4 +1,4 @@
1
- import { DelCommand, ExistsCommand, FlushAllCommand, PingCommand, ScoreMember, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
1
+ import { DelCommand, ExistsCommand, FlushAllCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
2
2
  import { CommandOptions } from "./commands/command.js";
3
3
  import { Requester } from "./http.js";
4
4
  import { CommandArgs } from "./types.js";
@@ -349,7 +349,7 @@ export declare class Pipeline {
349
349
  /**
350
350
  * @see https://redis.io/commands/script-exists
351
351
  */
352
- scriptExists: (args_0: string, ...args_1: string[]) => this;
352
+ scriptExists: (...args: CommandArgs<typeof ScriptExistsCommand>) => this;
353
353
  /**
354
354
  * @see https://redis.io/commands/script-flush
355
355
  */
@@ -1,4 +1,4 @@
1
- import { CommandOptions, DelCommand, ExistsCommand, FlushAllCommand, PingCommand, ScoreMember, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
1
+ import { CommandOptions, DelCommand, ExistsCommand, FlushAllCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
2
2
  import { Requester } from "./http.js";
3
3
  import { Pipeline } from "./pipeline.js";
4
4
  import type { CommandArgs } from "./types.js";
@@ -160,7 +160,7 @@ export declare class Redis {
160
160
  */
161
161
  hmset: <TData>(key: string, kv: {
162
162
  [field: string]: TData;
163
- }) => Promise<number>;
163
+ }) => Promise<"OK">;
164
164
  /**
165
165
  * @see https://redis.io/commands/hscan
166
166
  */
@@ -322,7 +322,7 @@ export declare class Redis {
322
322
  /**
323
323
  * @see https://redis.io/commands/script-exists
324
324
  */
325
- scriptExists: (args_0: string, ...args_1: string[]) => Promise<[]>;
325
+ scriptExists: (...args: CommandArgs<typeof ScriptExistsCommand>) => Promise<number[]>;
326
326
  /**
327
327
  * @see https://redis.io/commands/script-flush
328
328
  */
@@ -366,7 +366,7 @@ export declare class Redis {
366
366
  /**
367
367
  * @see https://redis.io/commands/sinterstore
368
368
  */
369
- sinterstore: (destination: string, key: string, ...keys: string[]) => Promise<string[]>;
369
+ sinterstore: (destination: string, key: string, ...keys: string[]) => Promise<number>;
370
370
  /**
371
371
  * @see https://redis.io/commands/sismember
372
372
  */