@upstash/redis 0.0.0-ci.e3757170 → 0.0.0-ci.e4fa3be6-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 +42 -278
- package/esm/deps/deno.land/x/base64@v0.2.1/base.js +100 -0
- package/esm/deps/deno.land/x/base64@v0.2.1/base64url.js +9 -0
- package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +1 -0
- package/esm/deps/deno.land/x/sha1@v1.0.3/mod.js +191 -0
- package/esm/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +50 -0
- package/esm/pkg/commands/command.js +12 -3
- package/esm/pkg/commands/geo_add.js +27 -0
- package/esm/pkg/commands/getdel.js +9 -0
- package/esm/pkg/commands/hgetall.js +0 -4
- package/esm/pkg/commands/hrandfield.js +39 -0
- 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/lmove.js +9 -0
- package/esm/pkg/commands/lpos.js +19 -0
- package/esm/pkg/commands/mod.js +30 -0
- package/esm/pkg/commands/scan.js +3 -0
- package/esm/pkg/commands/sdiffstore.js +1 -1
- package/esm/pkg/commands/set.js +16 -4
- package/esm/pkg/commands/smismember.js +9 -0
- package/esm/pkg/commands/xadd.js +26 -0
- package/esm/pkg/commands/xrange.js +36 -0
- package/esm/pkg/commands/zdiffstore.js +9 -0
- package/esm/pkg/commands/zmscore.js +10 -0
- package/esm/pkg/commands/zrange.js +6 -0
- package/esm/pkg/commands/zunion.js +30 -0
- package/esm/pkg/http.js +100 -3
- package/esm/pkg/pipeline.js +194 -12
- package/esm/pkg/redis.js +260 -3
- package/esm/pkg/script.js +77 -0
- package/esm/platforms/cloudflare.js +10 -2
- package/esm/platforms/fastly.js +6 -0
- package/esm/platforms/node_with_fetch.js +26 -1
- package/esm/platforms/nodejs.js +24 -1
- package/esm/version.js +1 -0
- package/package.json +53 -58
- package/script/deps/deno.land/x/base64@v0.2.1/base.js +104 -0
- package/script/deps/deno.land/x/base64@v0.2.1/base64url.js +13 -0
- package/script/deps/deno.land/x/sha1@v1.0.3/deps.js +6 -0
- package/script/deps/deno.land/x/sha1@v1.0.3/mod.js +196 -0
- package/script/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +55 -0
- package/script/pkg/commands/command.js +12 -3
- package/script/pkg/commands/geo_add.js +31 -0
- package/script/pkg/commands/getdel.js +13 -0
- package/script/pkg/commands/hgetall.js +0 -4
- package/script/pkg/commands/hrandfield.js +43 -0
- 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/lmove.js +13 -0
- package/script/pkg/commands/lpos.js +23 -0
- package/script/pkg/commands/mod.js +30 -0
- package/script/pkg/commands/scan.js +3 -0
- package/script/pkg/commands/sdiffstore.js +1 -1
- package/script/pkg/commands/set.js +16 -4
- package/script/pkg/commands/smismember.js +13 -0
- package/script/pkg/commands/xadd.js +30 -0
- package/script/pkg/commands/xrange.js +40 -0
- package/script/pkg/commands/zdiffstore.js +13 -0
- package/script/pkg/commands/zmscore.js +14 -0
- package/script/pkg/commands/zrange.js +6 -0
- package/script/pkg/commands/zunion.js +34 -0
- package/script/pkg/http.js +100 -3
- package/script/pkg/pipeline.js +193 -11
- package/script/pkg/redis.js +259 -2
- package/script/pkg/script.js +81 -0
- package/script/platforms/cloudflare.js +10 -2
- package/script/platforms/fastly.js +6 -0
- package/script/platforms/node_with_fetch.js +26 -1
- package/script/platforms/nodejs.js +24 -1
- package/script/version.js +4 -0
- package/types/deps/deno.land/x/base64@v0.2.1/base.d.ts +5 -0
- package/types/deps/deno.land/x/base64@v0.2.1/base64url.d.ts +1 -0
- package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +1 -0
- package/types/deps/deno.land/x/sha1@v1.0.3/mod.d.ts +26 -0
- package/types/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.d.ts +3 -0
- package/types/pkg/commands/bitop.d.ts +0 -1
- package/types/pkg/commands/bitpos.d.ts +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/getdel.d.ts +7 -0
- package/types/pkg/commands/hdel.d.ts +1 -1
- package/types/pkg/commands/hrandfield.d.ts +9 -0
- 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/lmove.d.ts +12 -0
- package/types/pkg/commands/lpop.d.ts +1 -1
- package/types/pkg/commands/lpos.d.ts +15 -0
- package/types/pkg/commands/mget.d.ts +1 -1
- package/types/pkg/commands/mod.d.ts +30 -0
- package/types/pkg/commands/rpop.d.ts +2 -2
- package/types/pkg/commands/scan.d.ts +2 -1
- package/types/pkg/commands/script_flush.d.ts +1 -1
- package/types/pkg/commands/sdiffstore.d.ts +1 -1
- package/types/pkg/commands/set.d.ts +31 -2
- package/types/pkg/commands/smembers.d.ts +2 -2
- package/types/pkg/commands/smismember.d.ts +7 -0
- package/types/pkg/commands/spop.d.ts +2 -2
- 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 +4 -4
- package/types/pkg/commands/zdiffstore.d.ts +7 -0
- package/types/pkg/commands/zinterstore.d.ts +1 -1
- package/types/pkg/commands/zmscore.d.ts +7 -0
- package/types/pkg/commands/zrange.d.ts +8 -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 +48 -7
- package/types/pkg/pipeline.d.ts +270 -124
- package/types/pkg/redis.d.ts +195 -19
- package/types/pkg/script.d.ts +42 -0
- package/types/pkg/types.d.ts +27 -1
- package/types/platforms/cloudflare.d.ts +9 -8
- package/types/platforms/fastly.d.ts +3 -7
- package/types/platforms/node_with_fetch.d.ts +3 -22
- package/types/platforms/nodejs.d.ts +4 -7
- package/types/version.d.ts +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command, CommandOptions } from "./command.js";
|
|
2
|
-
export
|
|
2
|
+
export type ZRangeCommandOptions = {
|
|
3
3
|
withScores?: boolean;
|
|
4
|
+
rev?: boolean;
|
|
4
5
|
} & ({
|
|
5
6
|
byScore: true;
|
|
6
7
|
byLex?: never;
|
|
@@ -10,6 +11,12 @@ export declare type ZRangeCommandOptions = {
|
|
|
10
11
|
} | {
|
|
11
12
|
byScore?: never;
|
|
12
13
|
byLex?: never;
|
|
14
|
+
}) & ({
|
|
15
|
+
offset: number;
|
|
16
|
+
count: number;
|
|
17
|
+
} | {
|
|
18
|
+
offset?: never;
|
|
19
|
+
count?: never;
|
|
13
20
|
});
|
|
14
21
|
/**
|
|
15
22
|
* @see https://redis.io/commands/zrange
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Command, CommandOptions } from "./command.js";
|
|
2
|
+
export type ZUnionCommandOptions = {
|
|
3
|
+
withScores?: boolean;
|
|
4
|
+
aggregate?: "sum" | "min" | "max";
|
|
5
|
+
} & ({
|
|
6
|
+
weight: number;
|
|
7
|
+
weights?: never;
|
|
8
|
+
} | {
|
|
9
|
+
weight?: never;
|
|
10
|
+
weights: number[];
|
|
11
|
+
} | {
|
|
12
|
+
weight?: never;
|
|
13
|
+
weights?: never;
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* @see https://redis.io/commands/zunion
|
|
17
|
+
*/
|
|
18
|
+
export declare class ZUnionCommand<TData extends unknown[]> extends Command<string[], TData> {
|
|
19
|
+
constructor(cmd: [
|
|
20
|
+
numKeys: 1,
|
|
21
|
+
key: string,
|
|
22
|
+
opts?: ZUnionCommandOptions
|
|
23
|
+
], cmdOpts?: CommandOptions<string[], TData>);
|
|
24
|
+
constructor(cmd: [
|
|
25
|
+
numKeys: number,
|
|
26
|
+
keys: string[],
|
|
27
|
+
opts?: ZUnionCommandOptions
|
|
28
|
+
], cmdOpts?: CommandOptions<string[], TData>);
|
|
29
|
+
}
|
package/types/pkg/http.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { Telemetry } from "./types.js";
|
|
2
|
+
type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
|
3
|
+
export type UpstashRequest = {
|
|
2
4
|
path?: string[];
|
|
3
5
|
/**
|
|
4
6
|
* Request body will be serialized to json
|
|
5
7
|
*/
|
|
6
8
|
body?: unknown;
|
|
7
9
|
};
|
|
8
|
-
export
|
|
10
|
+
export type UpstashResponse<TResult> = {
|
|
9
11
|
result?: TResult;
|
|
10
12
|
error?: string;
|
|
11
13
|
};
|
|
12
14
|
export interface Requester {
|
|
13
15
|
request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
|
|
14
16
|
}
|
|
15
|
-
export
|
|
17
|
+
export type RetryConfig = false | {
|
|
16
18
|
/**
|
|
17
19
|
* The number of retries to attempt before giving up.
|
|
18
20
|
*
|
|
@@ -29,26 +31,65 @@ export declare type RetryConfig = false | {
|
|
|
29
31
|
*/
|
|
30
32
|
backoff?: (retryCount: number) => number;
|
|
31
33
|
};
|
|
32
|
-
|
|
34
|
+
export type Options = {
|
|
33
35
|
backend?: string;
|
|
34
36
|
};
|
|
35
|
-
export
|
|
37
|
+
export type RequesterConfig = {
|
|
38
|
+
/**
|
|
39
|
+
* Configure the retry behaviour in case of network errors
|
|
40
|
+
*/
|
|
41
|
+
retry?: RetryConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Due to the nature of dynamic and custom data, it is possible to write data to redis that is not
|
|
44
|
+
* valid json and will therefore cause errors when deserializing. This used to happen very
|
|
45
|
+
* frequently with non-utf8 data, such as emojis.
|
|
46
|
+
*
|
|
47
|
+
* By default we will therefore encode the data as base64 on the server, before sending it to the
|
|
48
|
+
* client. The client will then decode the base64 data and parse it as utf8.
|
|
49
|
+
*
|
|
50
|
+
* For very large entries, this can add a few milliseconds, so if you are sure that your data is
|
|
51
|
+
* valid utf8, you can disable this behaviour by setting this option to false.
|
|
52
|
+
*
|
|
53
|
+
* Here's what the response body looks like:
|
|
54
|
+
*
|
|
55
|
+
* ```json
|
|
56
|
+
* {
|
|
57
|
+
* result?: "base64-encoded",
|
|
58
|
+
* error?: string
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @default "base64"
|
|
63
|
+
*/
|
|
64
|
+
responseEncoding?: false | "base64";
|
|
65
|
+
/**
|
|
66
|
+
* Configure the cache behaviour
|
|
67
|
+
* @default "no-store"
|
|
68
|
+
*/
|
|
69
|
+
cache?: CacheSetting;
|
|
70
|
+
};
|
|
71
|
+
export type HttpClientConfig = {
|
|
36
72
|
headers?: Record<string, string>;
|
|
37
73
|
baseUrl: string;
|
|
38
74
|
options?: Options;
|
|
39
75
|
retry?: RetryConfig;
|
|
40
|
-
|
|
76
|
+
agent?: any;
|
|
77
|
+
} & RequesterConfig;
|
|
41
78
|
export declare class HttpClient implements Requester {
|
|
42
79
|
baseUrl: string;
|
|
43
80
|
headers: Record<string, string>;
|
|
44
|
-
readonly options
|
|
81
|
+
readonly options: {
|
|
45
82
|
backend?: string;
|
|
83
|
+
agent: any;
|
|
84
|
+
responseEncoding?: false | "base64";
|
|
85
|
+
cache?: CacheSetting;
|
|
46
86
|
};
|
|
47
87
|
readonly retry: {
|
|
48
88
|
attempts: number;
|
|
49
89
|
backoff: (retryCount: number) => number;
|
|
50
90
|
};
|
|
51
91
|
constructor(config: HttpClientConfig);
|
|
92
|
+
mergeTelemetry(telemetry: Telemetry): void;
|
|
52
93
|
request<TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>>;
|
|
53
94
|
}
|
|
54
95
|
export {};
|