@upstash/redis 0.0.0-ci.fd62df5f23c9d3ce31f52781474d711bbed876d2-20231031095501 → 0.0.0-ci.ff7a0b135b28ff50a7e2634a78123684be3ed71f-20241105152627
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 +7 -3
- package/chunk-O2BCOVQA.mjs +3809 -0
- package/cloudflare.d.mts +15 -5
- package/cloudflare.d.ts +15 -5
- package/cloudflare.js +3921 -1
- package/cloudflare.mjs +93 -1
- package/fastly.d.mts +10 -5
- package/fastly.d.ts +10 -5
- package/fastly.js +3894 -1
- package/fastly.mjs +66 -1
- package/nodejs.d.mts +17 -24
- package/nodejs.d.ts +17 -24
- package/nodejs.js +3941 -1
- package/nodejs.mjs +113 -1
- package/package.json +1 -1
- package/{zmscore-10fd3773.d.ts → zmscore-Dc6Llqgr.d.mts} +721 -338
- package/zmscore-Dc6Llqgr.d.ts +3509 -0
- package/chunk-6556OV4Z.mjs +0 -1
- package/chunk-ZI3I2JE2.js +0 -1
package/fastly.mjs
CHANGED
|
@@ -1 +1,66 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
HttpClient,
|
|
3
|
+
Redis,
|
|
4
|
+
VERSION,
|
|
5
|
+
error_exports
|
|
6
|
+
} from "./chunk-O2BCOVQA.mjs";
|
|
7
|
+
|
|
8
|
+
// platforms/fastly.ts
|
|
9
|
+
var Redis2 = class extends Redis {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new redis client
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const redis = new Redis({
|
|
16
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
17
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
18
|
+
* backend: "upstash-db",
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
constructor(config) {
|
|
23
|
+
if (!config.url) {
|
|
24
|
+
console.warn(
|
|
25
|
+
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
26
|
+
);
|
|
27
|
+
} else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
|
|
28
|
+
console.warn(
|
|
29
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (!config.token) {
|
|
33
|
+
console.warn(
|
|
34
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
35
|
+
);
|
|
36
|
+
} else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
37
|
+
console.warn(
|
|
38
|
+
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const client = new HttpClient({
|
|
42
|
+
baseUrl: config.url,
|
|
43
|
+
retry: config.retry,
|
|
44
|
+
headers: { authorization: `Bearer ${config.token}` },
|
|
45
|
+
options: { backend: config.backend },
|
|
46
|
+
responseEncoding: config.responseEncoding,
|
|
47
|
+
keepAlive: config.keepAlive,
|
|
48
|
+
readYourWrites: config.readYourWrites
|
|
49
|
+
});
|
|
50
|
+
super(client, {
|
|
51
|
+
automaticDeserialization: config.automaticDeserialization,
|
|
52
|
+
enableAutoPipelining: config.enableAutoPipelining
|
|
53
|
+
});
|
|
54
|
+
this.addTelemetry({
|
|
55
|
+
sdk: `@upstash/redis@${VERSION}`,
|
|
56
|
+
platform: "fastly"
|
|
57
|
+
});
|
|
58
|
+
if (this.enableAutoPipelining) {
|
|
59
|
+
return this.autoPipeline();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
Redis2 as Redis,
|
|
65
|
+
error_exports as errors
|
|
66
|
+
};
|
package/nodejs.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1
|
|
2
|
-
export { A as AppendCommand, B as BitCountCommand,
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-Dc6Llqgr.mjs';
|
|
2
|
+
export { A as AppendCommand, B as BitCountCommand, f as BitOpCommand, g as BitPosCommand, C as CopyCommand, D as DBSizeCommand, i as DecrByCommand, h as DecrCommand, j as DelCommand, E as EchoCommand, k as EvalCommand, l as EvalshaCommand, m as ExistsCommand, o as ExpireAtCommand, n as ExpireCommand, F as FlushAllCommand, p as FlushDBCommand, G as GeoAddCommand, q as GeoAddCommandOptions, s as GeoDistCommand, t as GeoHashCommand, r as GeoMember, u as GeoPosCommand, v as GeoSearchCommand, w as GeoSearchStoreCommand, y as GetBitCommand, x as GetCommand, z as GetDelCommand, H as GetRangeCommand, I as GetSetCommand, J as HDelCommand, K as HExistsCommand, M as HGetAllCommand, L as HGetCommand, N as HIncrByCommand, O as HIncrByFloatCommand, Q as HKeysCommand, S as HLenCommand, T as HMGetCommand, V as HMSetCommand, W as HRandFieldCommand, X as HScanCommand, Y as HSetCommand, Z as HSetNXCommand, _ as HStrLenCommand, $ as HValsCommand, a1 as IncrByCommand, a2 as IncrByFloatCommand, a0 as IncrCommand, a3 as JsonArrAppendCommand, a4 as JsonArrIndexCommand, a5 as JsonArrInsertCommand, a6 as JsonArrLenCommand, a7 as JsonArrPopCommand, a8 as JsonArrTrimCommand, a9 as JsonClearCommand, aa as JsonDelCommand, ab as JsonForgetCommand, ac as JsonGetCommand, ad as JsonMGetCommand, ae as JsonNumIncrByCommand, af as JsonNumMultByCommand, ag as JsonObjKeysCommand, ah as JsonObjLenCommand, ai as JsonRespCommand, aj as JsonSetCommand, ak as JsonStrAppendCommand, al as JsonStrLenCommand, am as JsonToggleCommand, an as JsonTypeCommand, ao as KeysCommand, ap as LIndexCommand, aq as LInsertCommand, ar as LLenCommand, as as LMoveCommand, at as LPopCommand, au as LPushCommand, av as LPushXCommand, aw as LRangeCommand, ax as LRemCommand, ay as LSetCommand, az as LTrimCommand, aA as MGetCommand, aB as MSetCommand, aC as MSetNXCommand, aF as PExpireAtCommand, aE as PExpireCommand, aH as PSetEXCommand, aI as PTtlCommand, aD as PersistCommand, aG as PingCommand, P as Pipeline, aJ as PublishCommand, aN as RPopCommand, aO as RPushCommand, aP as RPushXCommand, aK as RandomKeyCommand, aL as RenameCommand, aM as RenameNXCommand, d as Requester, aQ as SAddCommand, aT as SCardCommand, aX as SDiffCommand, aY as SDiffStoreCommand, b3 as SInterCommand, b4 as SInterStoreCommand, b5 as SIsMemberCommand, b7 as SMIsMemberCommand, b6 as SMembersCommand, b8 as SMoveCommand, b9 as SPopCommand, ba as SRandMemberCommand, bb as SRemCommand, bc as SScanCommand, be as SUnionCommand, bf as SUnionStoreCommand, aR as ScanCommand, aS as ScanCommandOptions, bo as ScoreMember, aU as ScriptExistsCommand, aV as ScriptFlushCommand, aW as ScriptLoadCommand, a$ as SetBitCommand, aZ as SetCommand, a_ as SetCommandOptions, b0 as SetExCommand, b1 as SetNxCommand, b2 as SetRangeCommand, bd as StrLenCommand, bg as TimeCommand, bh as TouchCommand, bi as TtlCommand, bj as Type, bk as TypeCommand, bl as UnlinkCommand, U as UpstashRequest, c as UpstashResponse, bm as XAddCommand, bn as XRangeCommand, bq as ZAddCommand, bp as ZAddCommandOptions, br as ZCardCommand, bs as ZCountCommand, bt as ZDiffStoreCommand, bu as ZIncrByCommand, bv as ZInterStoreCommand, bw as ZInterStoreCommandOptions, bx as ZLexCountCommand, by as ZMScoreCommand, bz as ZPopMaxCommand, bA as ZPopMinCommand, bB as ZRangeCommand, bC as ZRangeCommandOptions, bD as ZRankCommand, bE as ZRemCommand, bF as ZRemRangeByLexCommand, bG as ZRemRangeByRankCommand, bH as ZRemRangeByScoreCommand, bI as ZRevRankCommand, bJ as ZScanCommand, bK as ZScoreCommand, bL as ZUnionCommand, bM as ZUnionCommandOptions, bN as ZUnionStoreCommand, bO as ZUnionStoreCommandOptions, e as errors } from './zmscore-Dc6Llqgr.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash redis.
|
|
@@ -9,11 +9,11 @@ type RedisConfigNodejs = {
|
|
|
9
9
|
/**
|
|
10
10
|
* UPSTASH_REDIS_REST_URL
|
|
11
11
|
*/
|
|
12
|
-
url: string;
|
|
12
|
+
url: string | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* UPSTASH_REDIS_REST_TOKEN
|
|
15
15
|
*/
|
|
16
|
-
token: string;
|
|
16
|
+
token: string | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* An agent allows you to reuse connections to reduce latency for multiple sequential requests.
|
|
19
19
|
*
|
|
@@ -29,7 +29,18 @@ type RedisConfigNodejs = {
|
|
|
29
29
|
* }
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The signal will allow aborting requests on the fly.
|
|
34
|
+
* For more check: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
35
|
+
*/
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
latencyLogging?: boolean;
|
|
38
|
+
agent?: unknown;
|
|
39
|
+
keepAlive?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When this flag is enabled, any subsequent commands issued by this client are guaranteed to observe the effects of all earlier writes submitted by the same client.
|
|
42
|
+
*/
|
|
43
|
+
readYourWrites?: boolean;
|
|
33
44
|
} & RedisOptions & RequesterConfig;
|
|
34
45
|
/**
|
|
35
46
|
* Serverless redis client for upstash.
|
|
@@ -47,24 +58,6 @@ declare class Redis extends Redis$1 {
|
|
|
47
58
|
* ```
|
|
48
59
|
*/
|
|
49
60
|
constructor(config: RedisConfigNodejs);
|
|
50
|
-
/**
|
|
51
|
-
* Create a new redis client by providing a custom `Requester` implementation
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```ts
|
|
55
|
-
*
|
|
56
|
-
* import { UpstashRequest, Requester, UpstashResponse, Redis } from "@upstash/redis"
|
|
57
|
-
*
|
|
58
|
-
* const requester: Requester = {
|
|
59
|
-
* request: <TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>> => {
|
|
60
|
-
* // ...
|
|
61
|
-
* }
|
|
62
|
-
* }
|
|
63
|
-
*
|
|
64
|
-
* const redis = new Redis(requester)
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
constructor(requesters: Requester);
|
|
68
61
|
/**
|
|
69
62
|
* Create a new Upstash Redis instance from environment variables.
|
|
70
63
|
*
|
|
@@ -77,4 +70,4 @@ declare class Redis extends Redis$1 {
|
|
|
77
70
|
static fromEnv(config?: Omit<RedisConfigNodejs, "url" | "token">): Redis;
|
|
78
71
|
}
|
|
79
72
|
|
|
80
|
-
export { Redis, RedisConfigNodejs
|
|
73
|
+
export { Redis, type RedisConfigNodejs };
|
package/nodejs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1
|
|
2
|
-
export { A as AppendCommand, B as BitCountCommand,
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-Dc6Llqgr.js';
|
|
2
|
+
export { A as AppendCommand, B as BitCountCommand, f as BitOpCommand, g as BitPosCommand, C as CopyCommand, D as DBSizeCommand, i as DecrByCommand, h as DecrCommand, j as DelCommand, E as EchoCommand, k as EvalCommand, l as EvalshaCommand, m as ExistsCommand, o as ExpireAtCommand, n as ExpireCommand, F as FlushAllCommand, p as FlushDBCommand, G as GeoAddCommand, q as GeoAddCommandOptions, s as GeoDistCommand, t as GeoHashCommand, r as GeoMember, u as GeoPosCommand, v as GeoSearchCommand, w as GeoSearchStoreCommand, y as GetBitCommand, x as GetCommand, z as GetDelCommand, H as GetRangeCommand, I as GetSetCommand, J as HDelCommand, K as HExistsCommand, M as HGetAllCommand, L as HGetCommand, N as HIncrByCommand, O as HIncrByFloatCommand, Q as HKeysCommand, S as HLenCommand, T as HMGetCommand, V as HMSetCommand, W as HRandFieldCommand, X as HScanCommand, Y as HSetCommand, Z as HSetNXCommand, _ as HStrLenCommand, $ as HValsCommand, a1 as IncrByCommand, a2 as IncrByFloatCommand, a0 as IncrCommand, a3 as JsonArrAppendCommand, a4 as JsonArrIndexCommand, a5 as JsonArrInsertCommand, a6 as JsonArrLenCommand, a7 as JsonArrPopCommand, a8 as JsonArrTrimCommand, a9 as JsonClearCommand, aa as JsonDelCommand, ab as JsonForgetCommand, ac as JsonGetCommand, ad as JsonMGetCommand, ae as JsonNumIncrByCommand, af as JsonNumMultByCommand, ag as JsonObjKeysCommand, ah as JsonObjLenCommand, ai as JsonRespCommand, aj as JsonSetCommand, ak as JsonStrAppendCommand, al as JsonStrLenCommand, am as JsonToggleCommand, an as JsonTypeCommand, ao as KeysCommand, ap as LIndexCommand, aq as LInsertCommand, ar as LLenCommand, as as LMoveCommand, at as LPopCommand, au as LPushCommand, av as LPushXCommand, aw as LRangeCommand, ax as LRemCommand, ay as LSetCommand, az as LTrimCommand, aA as MGetCommand, aB as MSetCommand, aC as MSetNXCommand, aF as PExpireAtCommand, aE as PExpireCommand, aH as PSetEXCommand, aI as PTtlCommand, aD as PersistCommand, aG as PingCommand, P as Pipeline, aJ as PublishCommand, aN as RPopCommand, aO as RPushCommand, aP as RPushXCommand, aK as RandomKeyCommand, aL as RenameCommand, aM as RenameNXCommand, d as Requester, aQ as SAddCommand, aT as SCardCommand, aX as SDiffCommand, aY as SDiffStoreCommand, b3 as SInterCommand, b4 as SInterStoreCommand, b5 as SIsMemberCommand, b7 as SMIsMemberCommand, b6 as SMembersCommand, b8 as SMoveCommand, b9 as SPopCommand, ba as SRandMemberCommand, bb as SRemCommand, bc as SScanCommand, be as SUnionCommand, bf as SUnionStoreCommand, aR as ScanCommand, aS as ScanCommandOptions, bo as ScoreMember, aU as ScriptExistsCommand, aV as ScriptFlushCommand, aW as ScriptLoadCommand, a$ as SetBitCommand, aZ as SetCommand, a_ as SetCommandOptions, b0 as SetExCommand, b1 as SetNxCommand, b2 as SetRangeCommand, bd as StrLenCommand, bg as TimeCommand, bh as TouchCommand, bi as TtlCommand, bj as Type, bk as TypeCommand, bl as UnlinkCommand, U as UpstashRequest, c as UpstashResponse, bm as XAddCommand, bn as XRangeCommand, bq as ZAddCommand, bp as ZAddCommandOptions, br as ZCardCommand, bs as ZCountCommand, bt as ZDiffStoreCommand, bu as ZIncrByCommand, bv as ZInterStoreCommand, bw as ZInterStoreCommandOptions, bx as ZLexCountCommand, by as ZMScoreCommand, bz as ZPopMaxCommand, bA as ZPopMinCommand, bB as ZRangeCommand, bC as ZRangeCommandOptions, bD as ZRankCommand, bE as ZRemCommand, bF as ZRemRangeByLexCommand, bG as ZRemRangeByRankCommand, bH as ZRemRangeByScoreCommand, bI as ZRevRankCommand, bJ as ZScanCommand, bK as ZScoreCommand, bL as ZUnionCommand, bM as ZUnionCommandOptions, bN as ZUnionStoreCommand, bO as ZUnionStoreCommandOptions, e as errors } from './zmscore-Dc6Llqgr.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash redis.
|
|
@@ -9,11 +9,11 @@ type RedisConfigNodejs = {
|
|
|
9
9
|
/**
|
|
10
10
|
* UPSTASH_REDIS_REST_URL
|
|
11
11
|
*/
|
|
12
|
-
url: string;
|
|
12
|
+
url: string | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* UPSTASH_REDIS_REST_TOKEN
|
|
15
15
|
*/
|
|
16
|
-
token: string;
|
|
16
|
+
token: string | undefined;
|
|
17
17
|
/**
|
|
18
18
|
* An agent allows you to reuse connections to reduce latency for multiple sequential requests.
|
|
19
19
|
*
|
|
@@ -29,7 +29,18 @@ type RedisConfigNodejs = {
|
|
|
29
29
|
* }
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The signal will allow aborting requests on the fly.
|
|
34
|
+
* For more check: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
35
|
+
*/
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
latencyLogging?: boolean;
|
|
38
|
+
agent?: unknown;
|
|
39
|
+
keepAlive?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When this flag is enabled, any subsequent commands issued by this client are guaranteed to observe the effects of all earlier writes submitted by the same client.
|
|
42
|
+
*/
|
|
43
|
+
readYourWrites?: boolean;
|
|
33
44
|
} & RedisOptions & RequesterConfig;
|
|
34
45
|
/**
|
|
35
46
|
* Serverless redis client for upstash.
|
|
@@ -47,24 +58,6 @@ declare class Redis extends Redis$1 {
|
|
|
47
58
|
* ```
|
|
48
59
|
*/
|
|
49
60
|
constructor(config: RedisConfigNodejs);
|
|
50
|
-
/**
|
|
51
|
-
* Create a new redis client by providing a custom `Requester` implementation
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```ts
|
|
55
|
-
*
|
|
56
|
-
* import { UpstashRequest, Requester, UpstashResponse, Redis } from "@upstash/redis"
|
|
57
|
-
*
|
|
58
|
-
* const requester: Requester = {
|
|
59
|
-
* request: <TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>> => {
|
|
60
|
-
* // ...
|
|
61
|
-
* }
|
|
62
|
-
* }
|
|
63
|
-
*
|
|
64
|
-
* const redis = new Redis(requester)
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
constructor(requesters: Requester);
|
|
68
61
|
/**
|
|
69
62
|
* Create a new Upstash Redis instance from environment variables.
|
|
70
63
|
*
|
|
@@ -77,4 +70,4 @@ declare class Redis extends Redis$1 {
|
|
|
77
70
|
static fromEnv(config?: Omit<RedisConfigNodejs, "url" | "token">): Redis;
|
|
78
71
|
}
|
|
79
72
|
|
|
80
|
-
export { Redis, RedisConfigNodejs
|
|
73
|
+
export { Redis, type RedisConfigNodejs };
|