@upstash/redis 1.11.0-next.1 → 1.11.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.
@@ -6,17 +6,29 @@ export class SetCommand extends Command {
6
6
  constructor([key, value, opts], cmdOpts) {
7
7
  const command = ["set", key, value];
8
8
  if (opts) {
9
+ if ("nx" in opts && opts.nx) {
10
+ command.push("nx");
11
+ }
12
+ else if ("xx" in opts && opts.xx) {
13
+ command.push("xx");
14
+ }
15
+ if ("get" in opts && opts.get) {
16
+ command.push("get");
17
+ }
9
18
  if ("ex" in opts && typeof opts.ex === "number") {
10
19
  command.push("ex", opts.ex);
11
20
  }
12
21
  else if ("px" in opts && typeof opts.px === "number") {
13
22
  command.push("px", opts.px);
14
23
  }
15
- if ("nx" in opts && opts.nx) {
16
- command.push("nx");
24
+ else if ("exat" in opts && typeof opts.exat === "number") {
25
+ command.push("exat", opts.exat);
17
26
  }
18
- else if ("xx" in opts && opts.xx) {
19
- command.push("xx");
27
+ else if ("pxat" in opts && typeof opts.pxat === "number") {
28
+ command.push("pxat", opts.pxat);
29
+ }
30
+ else if ("keepTtl" in opts && opts.keepTtl) {
31
+ command.push("keepTtl", opts.keepTtl);
20
32
  }
21
33
  }
22
34
  super(command, cmdOpts);
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.11.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.11.0-next.1"
100
+ }
101
101
  }
@@ -9,17 +9,29 @@ class SetCommand extends command_js_1.Command {
9
9
  constructor([key, value, opts], cmdOpts) {
10
10
  const command = ["set", key, value];
11
11
  if (opts) {
12
+ if ("nx" in opts && opts.nx) {
13
+ command.push("nx");
14
+ }
15
+ else if ("xx" in opts && opts.xx) {
16
+ command.push("xx");
17
+ }
18
+ if ("get" in opts && opts.get) {
19
+ command.push("get");
20
+ }
12
21
  if ("ex" in opts && typeof opts.ex === "number") {
13
22
  command.push("ex", opts.ex);
14
23
  }
15
24
  else if ("px" in opts && typeof opts.px === "number") {
16
25
  command.push("px", opts.px);
17
26
  }
18
- if ("nx" in opts && opts.nx) {
19
- command.push("nx");
27
+ else if ("exat" in opts && typeof opts.exat === "number") {
28
+ command.push("exat", opts.exat);
20
29
  }
21
- else if ("xx" in opts && opts.xx) {
22
- command.push("xx");
30
+ else if ("pxat" in opts && typeof opts.pxat === "number") {
31
+ command.push("pxat", opts.pxat);
32
+ }
33
+ else if ("keepTtl" in opts && opts.keepTtl) {
34
+ command.push("keepTtl", opts.keepTtl);
23
35
  }
24
36
  }
25
37
  super(command, cmdOpts);
@@ -1,13 +1,42 @@
1
1
  import { Command, CommandOptions } from "./command.js";
2
- export declare type SetCommandOptions = ({
2
+ export declare type SetCommandOptions = {
3
+ get: boolean;
4
+ } | ({
3
5
  ex: number;
4
6
  px?: never;
7
+ exat?: never;
8
+ pxat?: never;
9
+ keepTtl?: never;
5
10
  } | {
6
11
  ex?: never;
7
12
  px: number;
13
+ exat?: never;
14
+ pxat?: never;
15
+ keepTtl?: never;
8
16
  } | {
9
17
  ex?: never;
10
18
  px?: never;
19
+ exat: number;
20
+ pxat?: never;
21
+ keepTtl?: never;
22
+ } | {
23
+ ex?: never;
24
+ px?: never;
25
+ exat?: never;
26
+ pxat: number;
27
+ keepTtl?: never;
28
+ } | {
29
+ ex?: never;
30
+ px?: never;
31
+ exat?: never;
32
+ pxat?: never;
33
+ keepTtl: true;
34
+ } | {
35
+ ex?: never;
36
+ px?: never;
37
+ exat?: never;
38
+ pxat?: never;
39
+ keepTtl?: never;
11
40
  }) & ({
12
41
  nx: true;
13
42
  xx?: never;
@@ -21,6 +50,6 @@ export declare type SetCommandOptions = ({
21
50
  /**
22
51
  * @see https://redis.io/commands/set
23
52
  */
24
- export declare class SetCommand<TData, TResult = "OK"> extends Command<TResult, TData> {
53
+ export declare class SetCommand<TData, TResult = TData | "OK" | null> extends Command<TResult, TData | "OK" | null> {
25
54
  constructor([key, value, opts]: [key: string, value: TData, opts?: SetCommandOptions], cmdOpts?: CommandOptions<TResult, TData>);
26
55
  }
@@ -354,7 +354,7 @@ export declare class Redis {
354
354
  /**
355
355
  * @see https://redis.io/commands/set
356
356
  */
357
- set: <TData>(key: string, value: TData, opts?: SetCommandOptions | undefined) => Promise<TData>;
357
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions | undefined) => Promise<"OK" | TData | null>;
358
358
  /**
359
359
  * @see https://redis.io/commands/setbit
360
360
  */