@upstash/redis 0.0.0-ci.bafaa360-20230119 → 0.0.0-ci.bc4f4560-20231018
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.
- package/README.md +1 -1
- package/esm/pkg/commands/command.js +12 -3
- package/esm/pkg/commands/geo_add.js +27 -0
- package/esm/pkg/commands/geo_hash.js +14 -0
- package/esm/pkg/commands/hgetall.js +9 -1
- package/esm/pkg/commands/json_arrappend.js +9 -0
- package/esm/pkg/commands/json_arrindex.js +9 -0
- package/esm/pkg/commands/json_arrinsert.js +9 -0
- package/esm/pkg/commands/json_arrlen.js +9 -0
- package/esm/pkg/commands/json_arrpop.js +9 -0
- package/esm/pkg/commands/json_arrtrim.js +12 -0
- package/esm/pkg/commands/json_clear.js +9 -0
- package/esm/pkg/commands/json_del.js +9 -0
- package/esm/pkg/commands/json_forget.js +9 -0
- package/esm/pkg/commands/json_get.js +30 -0
- package/esm/pkg/commands/json_mget.js +9 -0
- package/esm/pkg/commands/json_numincrby.js +9 -0
- package/esm/pkg/commands/json_nummultby.js +9 -0
- package/esm/pkg/commands/json_objkeys.js +9 -0
- package/esm/pkg/commands/json_objlen.js +9 -0
- package/esm/pkg/commands/json_resp.js +9 -0
- package/esm/pkg/commands/json_set.js +18 -0
- package/esm/pkg/commands/json_strappend.js +9 -0
- package/esm/pkg/commands/json_strlen.js +9 -0
- package/esm/pkg/commands/json_toggle.js +9 -0
- package/esm/pkg/commands/json_type.js +9 -0
- package/esm/pkg/commands/mod.js +27 -1
- package/esm/pkg/commands/set.js +1 -1
- package/esm/pkg/commands/xadd.js +26 -0
- package/esm/pkg/commands/xrange.js +36 -0
- package/esm/pkg/commands/zunion.js +30 -0
- package/esm/pkg/http.js +19 -19
- package/esm/pkg/pipeline.js +119 -7
- package/esm/pkg/redis.js +135 -1
- package/esm/platforms/cloudflare.js +6 -6
- package/esm/platforms/fastly.js +5 -0
- package/esm/platforms/node_with_fetch.js +10 -11
- package/esm/platforms/nodejs.js +13 -11
- package/esm/version.js +1 -1
- package/package.json +53 -20
- package/script/pkg/commands/command.js +12 -3
- package/script/pkg/commands/geo_add.js +31 -0
- package/script/pkg/commands/geo_hash.js +18 -0
- package/script/pkg/commands/hgetall.js +9 -1
- package/script/pkg/commands/json_arrappend.js +13 -0
- package/script/pkg/commands/json_arrindex.js +13 -0
- package/script/pkg/commands/json_arrinsert.js +13 -0
- package/script/pkg/commands/json_arrlen.js +13 -0
- package/script/pkg/commands/json_arrpop.js +13 -0
- package/script/pkg/commands/json_arrtrim.js +16 -0
- package/script/pkg/commands/json_clear.js +13 -0
- package/script/pkg/commands/json_del.js +13 -0
- package/script/pkg/commands/json_forget.js +13 -0
- package/script/pkg/commands/json_get.js +34 -0
- package/script/pkg/commands/json_mget.js +13 -0
- package/script/pkg/commands/json_numincrby.js +13 -0
- package/script/pkg/commands/json_nummultby.js +13 -0
- package/script/pkg/commands/json_objkeys.js +13 -0
- package/script/pkg/commands/json_objlen.js +13 -0
- package/script/pkg/commands/json_resp.js +13 -0
- package/script/pkg/commands/json_set.js +22 -0
- package/script/pkg/commands/json_strappend.js +13 -0
- package/script/pkg/commands/json_strlen.js +13 -0
- package/script/pkg/commands/json_toggle.js +13 -0
- package/script/pkg/commands/json_type.js +13 -0
- package/script/pkg/commands/mod.js +27 -1
- package/script/pkg/commands/set.js +1 -1
- package/script/pkg/commands/xadd.js +30 -0
- package/script/pkg/commands/xrange.js +40 -0
- package/script/pkg/commands/zunion.js +34 -0
- package/script/pkg/http.js +19 -19
- package/script/pkg/pipeline.js +118 -6
- package/script/pkg/redis.js +134 -0
- package/script/platforms/cloudflare.js +6 -6
- package/script/platforms/fastly.js +5 -0
- package/script/platforms/node_with_fetch.js +10 -11
- package/script/platforms/nodejs.js +13 -11
- package/script/version.js +1 -1
- package/types/pkg/commands/command.d.ts +5 -5
- package/types/pkg/commands/geo_add.d.ts +25 -0
- package/types/pkg/commands/geo_hash.d.ts +7 -0
- package/types/pkg/commands/hdel.d.ts +1 -1
- package/types/pkg/commands/json_arrappend.d.ts +7 -0
- package/types/pkg/commands/json_arrindex.d.ts +13 -0
- package/types/pkg/commands/json_arrinsert.d.ts +7 -0
- package/types/pkg/commands/json_arrlen.d.ts +7 -0
- package/types/pkg/commands/json_arrpop.d.ts +7 -0
- package/types/pkg/commands/json_arrtrim.d.ts +7 -0
- package/types/pkg/commands/json_clear.d.ts +7 -0
- package/types/pkg/commands/json_del.d.ts +7 -0
- package/types/pkg/commands/json_forget.d.ts +7 -0
- package/types/pkg/commands/json_get.d.ts +15 -0
- package/types/pkg/commands/json_mget.d.ts +7 -0
- package/types/pkg/commands/json_numincrby.d.ts +7 -0
- package/types/pkg/commands/json_nummultby.d.ts +7 -0
- package/types/pkg/commands/json_objkeys.d.ts +7 -0
- package/types/pkg/commands/json_objlen.d.ts +7 -0
- package/types/pkg/commands/json_resp.d.ts +7 -0
- package/types/pkg/commands/json_set.d.ts +18 -0
- package/types/pkg/commands/json_strappend.d.ts +7 -0
- package/types/pkg/commands/json_strlen.d.ts +7 -0
- package/types/pkg/commands/json_toggle.d.ts +7 -0
- package/types/pkg/commands/json_type.d.ts +7 -0
- package/types/pkg/commands/mod.d.ts +27 -1
- package/types/pkg/commands/scan.d.ts +1 -1
- package/types/pkg/commands/script_flush.d.ts +1 -1
- package/types/pkg/commands/set.d.ts +3 -3
- package/types/pkg/commands/type.d.ts +1 -1
- package/types/pkg/commands/xadd.d.ts +31 -0
- package/types/pkg/commands/xrange.d.ts +9 -0
- package/types/pkg/commands/zadd.d.ts +3 -3
- package/types/pkg/commands/zinterstore.d.ts +1 -1
- package/types/pkg/commands/zrange.d.ts +1 -1
- package/types/pkg/commands/zunion.d.ts +29 -0
- package/types/pkg/commands/zunionstore.d.ts +1 -1
- package/types/pkg/http.d.ts +14 -7
- package/types/pkg/pipeline.d.ts +242 -129
- package/types/pkg/redis.d.ts +138 -13
- package/types/pkg/types.d.ts +11 -2
- package/types/platforms/cloudflare.d.ts +2 -2
- package/types/platforms/fastly.d.ts +1 -1
- package/types/platforms/node_with_fetch.d.ts +1 -1
- package/types/platforms/nodejs.d.ts +1 -1
- package/types/version.d.ts +1 -1
package/types/pkg/redis.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { CommandOptions, DelCommand, ExistsCommand, FlushAllCommand, MGetCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
|
|
1
|
+
import { CommandOptions, DelCommand, ExistsCommand, FlushAllCommand, JsonGetCommand, MGetCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
|
|
2
2
|
import { Requester, UpstashRequest, UpstashResponse } from "./http.js";
|
|
3
3
|
import { Pipeline } from "./pipeline.js";
|
|
4
4
|
import type { CommandArgs } from "./types.js";
|
|
5
5
|
import { Script } from "./script.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
12
|
-
automaticDeserialization?: boolean;
|
|
13
|
-
};
|
|
6
|
+
import type { RedisOptions, Telemetry } from "./types.js";
|
|
7
|
+
import { GeoHashCommand } from "./commands/geo_hash.js";
|
|
8
|
+
export type { RedisOptions } from "./types.js";
|
|
14
9
|
/**
|
|
15
10
|
* Serverless redis client for upstash.
|
|
16
11
|
*/
|
|
17
12
|
export declare class Redis {
|
|
18
13
|
protected client: Requester;
|
|
19
14
|
protected opts?: CommandOptions<any, any>;
|
|
15
|
+
protected enableTelemetry: boolean;
|
|
20
16
|
/**
|
|
21
17
|
* Create a new redis client
|
|
22
18
|
*
|
|
@@ -29,6 +25,106 @@ export declare class Redis {
|
|
|
29
25
|
* ```
|
|
30
26
|
*/
|
|
31
27
|
constructor(client: Requester, opts?: RedisOptions);
|
|
28
|
+
get json(): {
|
|
29
|
+
/**
|
|
30
|
+
* @see https://redis.io/commands/json.arrappend
|
|
31
|
+
*/
|
|
32
|
+
arrappend: (key: string, path: string, ...values: unknown[]) => Promise<(number | null)[]>;
|
|
33
|
+
/**
|
|
34
|
+
* @see https://redis.io/commands/json.arrindex
|
|
35
|
+
*/
|
|
36
|
+
arrindex: (key: string, path: string, value: unknown, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>;
|
|
37
|
+
/**
|
|
38
|
+
* @see https://redis.io/commands/json.arrinsert
|
|
39
|
+
*/
|
|
40
|
+
arrinsert: (key: string, path: string, index: number, ...values: unknown[]) => Promise<(number | null)[]>;
|
|
41
|
+
/**
|
|
42
|
+
* @see https://redis.io/commands/json.arrlen
|
|
43
|
+
*/
|
|
44
|
+
arrlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
|
|
45
|
+
/**
|
|
46
|
+
* @see https://redis.io/commands/json.arrpop
|
|
47
|
+
*/
|
|
48
|
+
arrpop: (key: string, path?: string | undefined, index?: number | undefined) => Promise<unknown[]>;
|
|
49
|
+
/**
|
|
50
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
51
|
+
*/
|
|
52
|
+
arrtrim: (key: string, path?: string | undefined, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>;
|
|
53
|
+
/**
|
|
54
|
+
* @see https://redis.io/commands/json.clear
|
|
55
|
+
*/
|
|
56
|
+
clear: (key: string, path?: string | undefined) => Promise<number>;
|
|
57
|
+
/**
|
|
58
|
+
* @see https://redis.io/commands/json.del
|
|
59
|
+
*/
|
|
60
|
+
del: (key: string, path?: string | undefined) => Promise<number>;
|
|
61
|
+
/**
|
|
62
|
+
* @see https://redis.io/commands/json.forget
|
|
63
|
+
*/
|
|
64
|
+
forget: (key: string, path?: string | undefined) => Promise<number>;
|
|
65
|
+
/**
|
|
66
|
+
* @see https://redis.io/commands/geoadd
|
|
67
|
+
*/
|
|
68
|
+
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>;
|
|
69
|
+
/**
|
|
70
|
+
* @see https://redis.io/commands/geohash
|
|
71
|
+
*/
|
|
72
|
+
geohash: (...args: CommandArgs<typeof GeoHashCommand>) => Promise<any>;
|
|
73
|
+
/**
|
|
74
|
+
* @see https://redis.io/commands/json.get
|
|
75
|
+
*/
|
|
76
|
+
get: (...args: CommandArgs<typeof JsonGetCommand>) => Promise<any>;
|
|
77
|
+
/**
|
|
78
|
+
* @see https://redis.io/commands/json.mget
|
|
79
|
+
*/
|
|
80
|
+
mget: (keys: string[], path: string) => Promise<any>;
|
|
81
|
+
/**
|
|
82
|
+
* @see https://redis.io/commands/json.numincrby
|
|
83
|
+
*/
|
|
84
|
+
numincrby: (key: string, path: string, value: number) => Promise<(number | null)[]>;
|
|
85
|
+
/**
|
|
86
|
+
* @see https://redis.io/commands/json.nummultby
|
|
87
|
+
*/
|
|
88
|
+
nummultby: (key: string, path: string, value: number) => Promise<(number | null)[]>;
|
|
89
|
+
/**
|
|
90
|
+
* @see https://redis.io/commands/json.objkeys
|
|
91
|
+
*/
|
|
92
|
+
objkeys: (key: string, path?: string | undefined) => Promise<(string[] | null)[]>;
|
|
93
|
+
/**
|
|
94
|
+
* @see https://redis.io/commands/json.objlen
|
|
95
|
+
*/
|
|
96
|
+
objlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
|
|
97
|
+
/**
|
|
98
|
+
* @see https://redis.io/commands/json.resp
|
|
99
|
+
*/
|
|
100
|
+
resp: (key: string, path?: string | undefined) => Promise<any>;
|
|
101
|
+
/**
|
|
102
|
+
* @see https://redis.io/commands/json.set
|
|
103
|
+
*/
|
|
104
|
+
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
105
|
+
nx: true;
|
|
106
|
+
xx?: undefined;
|
|
107
|
+
} | {
|
|
108
|
+
nx?: undefined;
|
|
109
|
+
xx: true;
|
|
110
|
+
} | undefined) => Promise<"OK" | null>;
|
|
111
|
+
/**
|
|
112
|
+
* @see https://redis.io/commands/json.strappend
|
|
113
|
+
*/
|
|
114
|
+
strappend: (key: string, path: string, value: string) => Promise<(number | null)[]>;
|
|
115
|
+
/**
|
|
116
|
+
* @see https://redis.io/commands/json.strlen
|
|
117
|
+
*/
|
|
118
|
+
strlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
|
|
119
|
+
/**
|
|
120
|
+
* @see https://redis.io/commands/json.toggle
|
|
121
|
+
*/
|
|
122
|
+
toggle: (key: string, path: string) => Promise<number[]>;
|
|
123
|
+
/**
|
|
124
|
+
* @see https://redis.io/commands/json.type
|
|
125
|
+
*/
|
|
126
|
+
type: (key: string, path?: string | undefined) => Promise<string[]>;
|
|
127
|
+
};
|
|
32
128
|
/**
|
|
33
129
|
* Wrap a new middleware around the HTTP client.
|
|
34
130
|
*/
|
|
@@ -36,14 +132,14 @@ export declare class Redis {
|
|
|
36
132
|
/**
|
|
37
133
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
38
134
|
*/
|
|
39
|
-
|
|
135
|
+
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
40
136
|
createScript(script: string): Script;
|
|
41
137
|
/**
|
|
42
138
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
43
139
|
*
|
|
44
140
|
* @see {@link Pipeline}
|
|
45
141
|
*/
|
|
46
|
-
pipeline: () => Pipeline
|
|
142
|
+
pipeline: () => Pipeline<[]>;
|
|
47
143
|
/**
|
|
48
144
|
* Create a new transaction to allow executing multiple steps atomically.
|
|
49
145
|
*
|
|
@@ -53,7 +149,7 @@ export declare class Redis {
|
|
|
53
149
|
*
|
|
54
150
|
* @see {@link Pipeline}
|
|
55
151
|
*/
|
|
56
|
-
multi: () => Pipeline
|
|
152
|
+
multi: () => Pipeline<[]>;
|
|
57
153
|
/**
|
|
58
154
|
* @see https://redis.io/commands/append
|
|
59
155
|
*/
|
|
@@ -146,7 +242,7 @@ export declare class Redis {
|
|
|
146
242
|
/**
|
|
147
243
|
* @see https://redis.io/commands/hdel
|
|
148
244
|
*/
|
|
149
|
-
hdel: (key: string,
|
|
245
|
+
hdel: (key: string, ...fields: string[]) => Promise<0 | 1>;
|
|
150
246
|
/**
|
|
151
247
|
* @see https://redis.io/commands/hexists
|
|
152
248
|
*/
|
|
@@ -475,6 +571,31 @@ export declare class Redis {
|
|
|
475
571
|
* @see https://redis.io/commands/unlink
|
|
476
572
|
*/
|
|
477
573
|
unlink: (...args: CommandArgs<typeof UnlinkCommand>) => Promise<number>;
|
|
574
|
+
/**
|
|
575
|
+
* @see https://redis.io/commands/xadd
|
|
576
|
+
*/
|
|
577
|
+
xadd: (key: string, id: string, entries: {
|
|
578
|
+
[field: string]: unknown;
|
|
579
|
+
}, opts?: {
|
|
580
|
+
nomkStream?: boolean | undefined;
|
|
581
|
+
trim?: (({
|
|
582
|
+
type: "MAXLEN" | "maxlen";
|
|
583
|
+
threshold: number;
|
|
584
|
+
} | {
|
|
585
|
+
type: "MINID" | "minid";
|
|
586
|
+
threshold: string;
|
|
587
|
+
}) & ({
|
|
588
|
+
comparison: "~";
|
|
589
|
+
limit?: number | undefined;
|
|
590
|
+
} | {
|
|
591
|
+
comparison: "=";
|
|
592
|
+
limit?: undefined;
|
|
593
|
+
})) | undefined;
|
|
594
|
+
} | undefined) => Promise<string>;
|
|
595
|
+
/**
|
|
596
|
+
* @see https://redis.io/commands/xrange
|
|
597
|
+
*/
|
|
598
|
+
xrange: (key: string, start: string, end: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
|
|
478
599
|
/**
|
|
479
600
|
* @see https://redis.io/commands/zadd
|
|
480
601
|
*/
|
|
@@ -565,6 +686,10 @@ export declare class Redis {
|
|
|
565
686
|
* @see https://redis.io/commands/zscore
|
|
566
687
|
*/
|
|
567
688
|
zscore: <TData>(key: string, member: TData) => Promise<number | null>;
|
|
689
|
+
/**
|
|
690
|
+
* @see https://redis.io/commands/zunion
|
|
691
|
+
*/
|
|
692
|
+
zunion: (numKeys: number, keys: string[], opts?: import("./commands/zunion.js").ZUnionCommandOptions | undefined) => Promise<any>;
|
|
568
693
|
/**
|
|
569
694
|
* @see https://redis.io/commands/zunionstore
|
|
570
695
|
*/
|
package/types/pkg/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type CommandArgs<TCommand extends new (...args: any) => any> = ConstructorParameters<TCommand>[0];
|
|
2
|
+
export type Telemetry = {
|
|
3
3
|
/**
|
|
4
4
|
* Upstash-Telemetry-Sdk
|
|
5
5
|
* @example @upstash/redis@v1.1.1
|
|
@@ -16,3 +16,12 @@ export declare type Telemetry = {
|
|
|
16
16
|
*/
|
|
17
17
|
runtime?: string;
|
|
18
18
|
};
|
|
19
|
+
export type RedisOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* Automatically try to deserialize the returned data from upstash using `JSON.deserialize`
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
automaticDeserialization?: boolean;
|
|
26
|
+
enableTelemetry?: boolean;
|
|
27
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as core from "../pkg/redis.js";
|
|
2
2
|
import type { Requester, UpstashRequest, UpstashResponse } from "../pkg/http.js";
|
|
3
3
|
import { RequesterConfig } from "../pkg/http.js";
|
|
4
|
-
|
|
4
|
+
type Env = {
|
|
5
5
|
UPSTASH_DISABLE_TELEMETRY?: string;
|
|
6
6
|
};
|
|
7
7
|
export type { Requester, UpstashRequest, UpstashResponse };
|
|
@@ -9,7 +9,7 @@ export type { Requester, UpstashRequest, UpstashResponse };
|
|
|
9
9
|
* Connection credentials for upstash redis.
|
|
10
10
|
* Get them from https://console.upstash.com/redis/<uuid>
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type RedisConfigCloudflare = {
|
|
13
13
|
/**
|
|
14
14
|
* UPSTASH_REDIS_REST_URL
|
|
15
15
|
*/
|
|
@@ -5,7 +5,7 @@ export type { Requester, UpstashRequest, UpstashResponse };
|
|
|
5
5
|
* Connection credentials for upstash redis.
|
|
6
6
|
* Get them from https://console.upstash.com/redis/<uuid>
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type RedisConfigFastly = {
|
|
9
9
|
/**
|
|
10
10
|
* UPSTASH_REDIS_REST_URL
|
|
11
11
|
*/
|
|
@@ -6,7 +6,7 @@ export type { Requester, UpstashRequest, UpstashResponse };
|
|
|
6
6
|
* Connection credentials for upstash redis.
|
|
7
7
|
* Get them from https://console.upstash.com/redis/<uuid>
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type RedisConfigNodejs = {
|
|
10
10
|
/**
|
|
11
11
|
* UPSTASH_REDIS_REST_URL
|
|
12
12
|
*/
|
|
@@ -5,7 +5,7 @@ export type { Requester, UpstashRequest, UpstashResponse };
|
|
|
5
5
|
* Connection credentials for upstash redis.
|
|
6
6
|
* Get them from https://console.upstash.com/redis/<uuid>
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type RedisConfigNodejs = {
|
|
9
9
|
/**
|
|
10
10
|
* UPSTASH_REDIS_REST_URL
|
|
11
11
|
*/
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "v0.0.0-ci.
|
|
1
|
+
export declare const VERSION = "v0.0.0-ci.bc4f4560-20231018";
|