@upstash/redis 1.34.3-canary → 1.34.3
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/{chunk-FC2CKVKB.mjs → chunk-FV6JMGNF.mjs} +18 -21
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +23 -28
- package/cloudflare.mjs +6 -8
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +23 -28
- package/fastly.mjs +6 -8
- package/nodejs.d.mts +2 -2
- package/nodejs.d.ts +2 -2
- package/nodejs.js +25 -30
- package/nodejs.mjs +8 -10
- package/package.json +1 -1
- package/{zmscore-BLgYk16R.d.mts → zmscore-Dc6Llqgr.d.mts} +34 -13
- package/{zmscore-BLgYk16R.d.ts → zmscore-Dc6Llqgr.d.ts} +34 -13
|
@@ -46,7 +46,7 @@ var HttpClient = class {
|
|
|
46
46
|
};
|
|
47
47
|
this.upstashSyncToken = "";
|
|
48
48
|
this.readYourWrites = config.readYourWrites ?? true;
|
|
49
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
49
|
+
this.baseUrl = (config.baseUrl || "").replace(/\/$/, "");
|
|
50
50
|
const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
|
|
51
51
|
if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
|
|
52
52
|
throw new UrlError(this.baseUrl);
|
|
@@ -88,7 +88,7 @@ var HttpClient = class {
|
|
|
88
88
|
backend: this.options.backend
|
|
89
89
|
};
|
|
90
90
|
if (!this.hasCredentials) {
|
|
91
|
-
|
|
91
|
+
console.warn(
|
|
92
92
|
"[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
|
|
93
93
|
);
|
|
94
94
|
}
|
|
@@ -2122,9 +2122,9 @@ var Pipeline = class {
|
|
|
2122
2122
|
this.multiExec = opts.multiExec ?? false;
|
|
2123
2123
|
if (this.commandOptions?.latencyLogging) {
|
|
2124
2124
|
const originalExec = this.exec.bind(this);
|
|
2125
|
-
this.exec = async () => {
|
|
2125
|
+
this.exec = async (options) => {
|
|
2126
2126
|
const start = performance.now();
|
|
2127
|
-
const result = await originalExec();
|
|
2127
|
+
const result = await (options ? originalExec(options) : originalExec());
|
|
2128
2128
|
const end = performance.now();
|
|
2129
2129
|
const loggerResult = (end - start).toFixed(2);
|
|
2130
2130
|
console.log(
|
|
@@ -2134,19 +2134,7 @@ var Pipeline = class {
|
|
|
2134
2134
|
};
|
|
2135
2135
|
}
|
|
2136
2136
|
}
|
|
2137
|
-
|
|
2138
|
-
* Send the pipeline request to upstash.
|
|
2139
|
-
*
|
|
2140
|
-
* Returns an array with the results of all pipelined commands.
|
|
2141
|
-
*
|
|
2142
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
2143
|
-
* ```ts
|
|
2144
|
-
* const p = redis.pipeline()
|
|
2145
|
-
* p.get("key")
|
|
2146
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
2147
|
-
* ```
|
|
2148
|
-
*/
|
|
2149
|
-
exec = async () => {
|
|
2137
|
+
exec = async (options) => {
|
|
2150
2138
|
if (this.commands.length === 0) {
|
|
2151
2139
|
throw new Error("Pipeline is empty");
|
|
2152
2140
|
}
|
|
@@ -2155,7 +2143,12 @@ var Pipeline = class {
|
|
|
2155
2143
|
path,
|
|
2156
2144
|
body: Object.values(this.commands).map((c) => c.command)
|
|
2157
2145
|
});
|
|
2158
|
-
return res.map(({ error, result }, i) => {
|
|
2146
|
+
return options?.keepErrors ? res.map(({ error, result }, i) => {
|
|
2147
|
+
return {
|
|
2148
|
+
error,
|
|
2149
|
+
result: this.commands[i].deserialize(result)
|
|
2150
|
+
};
|
|
2151
|
+
}) : res.map(({ error, result }, i) => {
|
|
2159
2152
|
if (error) {
|
|
2160
2153
|
throw new UpstashError(
|
|
2161
2154
|
`Command ${i + 1} [ ${this.commands[i].command[0]} ] failed: ${error}`
|
|
@@ -2949,7 +2942,7 @@ var AutoPipelineExecutor = class {
|
|
|
2949
2942
|
executeWithPipeline(pipeline);
|
|
2950
2943
|
const pipelineDone = this.deferExecution().then(() => {
|
|
2951
2944
|
if (!this.pipelinePromises.has(pipeline)) {
|
|
2952
|
-
const pipelinePromise = pipeline.exec();
|
|
2945
|
+
const pipelinePromise = pipeline.exec({ keepErrors: true });
|
|
2953
2946
|
this.pipelineCounter += 1;
|
|
2954
2947
|
this.pipelinePromises.set(pipeline, pipelinePromise);
|
|
2955
2948
|
this.activePipeline = null;
|
|
@@ -2957,7 +2950,11 @@ var AutoPipelineExecutor = class {
|
|
|
2957
2950
|
return this.pipelinePromises.get(pipeline);
|
|
2958
2951
|
});
|
|
2959
2952
|
const results = await pipelineDone;
|
|
2960
|
-
|
|
2953
|
+
const commandResult = results[index];
|
|
2954
|
+
if (commandResult.error) {
|
|
2955
|
+
throw new UpstashError(`Command failed: ${commandResult.error}`);
|
|
2956
|
+
}
|
|
2957
|
+
return commandResult.result;
|
|
2961
2958
|
}
|
|
2962
2959
|
async deferExecution() {
|
|
2963
2960
|
await Promise.resolve();
|
|
@@ -3800,7 +3797,7 @@ var Redis = class {
|
|
|
3800
3797
|
};
|
|
3801
3798
|
|
|
3802
3799
|
// version.ts
|
|
3803
|
-
var VERSION = "
|
|
3800
|
+
var VERSION = "v1.34.3";
|
|
3804
3801
|
|
|
3805
3802
|
export {
|
|
3806
3803
|
error_exports,
|
package/cloudflare.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-
|
|
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-
|
|
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
|
type Env = {
|
|
5
5
|
UPSTASH_DISABLE_TELEMETRY?: string;
|
package/cloudflare.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-
|
|
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-
|
|
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
|
type Env = {
|
|
5
5
|
UPSTASH_DISABLE_TELEMETRY?: string;
|
package/cloudflare.js
CHANGED
|
@@ -77,7 +77,7 @@ var HttpClient = class {
|
|
|
77
77
|
};
|
|
78
78
|
this.upstashSyncToken = "";
|
|
79
79
|
this.readYourWrites = config.readYourWrites ?? true;
|
|
80
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
80
|
+
this.baseUrl = (config.baseUrl || "").replace(/\/$/, "");
|
|
81
81
|
const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
|
|
82
82
|
if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
|
|
83
83
|
throw new UrlError(this.baseUrl);
|
|
@@ -119,7 +119,7 @@ var HttpClient = class {
|
|
|
119
119
|
backend: this.options.backend
|
|
120
120
|
};
|
|
121
121
|
if (!this.hasCredentials) {
|
|
122
|
-
|
|
122
|
+
console.warn(
|
|
123
123
|
"[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
|
|
124
124
|
);
|
|
125
125
|
}
|
|
@@ -289,7 +289,7 @@ var AutoPipelineExecutor = class {
|
|
|
289
289
|
executeWithPipeline(pipeline);
|
|
290
290
|
const pipelineDone = this.deferExecution().then(() => {
|
|
291
291
|
if (!this.pipelinePromises.has(pipeline)) {
|
|
292
|
-
const pipelinePromise = pipeline.exec();
|
|
292
|
+
const pipelinePromise = pipeline.exec({ keepErrors: true });
|
|
293
293
|
this.pipelineCounter += 1;
|
|
294
294
|
this.pipelinePromises.set(pipeline, pipelinePromise);
|
|
295
295
|
this.activePipeline = null;
|
|
@@ -297,7 +297,11 @@ var AutoPipelineExecutor = class {
|
|
|
297
297
|
return this.pipelinePromises.get(pipeline);
|
|
298
298
|
});
|
|
299
299
|
const results = await pipelineDone;
|
|
300
|
-
|
|
300
|
+
const commandResult = results[index];
|
|
301
|
+
if (commandResult.error) {
|
|
302
|
+
throw new UpstashError(`Command failed: ${commandResult.error}`);
|
|
303
|
+
}
|
|
304
|
+
return commandResult.result;
|
|
301
305
|
}
|
|
302
306
|
async deferExecution() {
|
|
303
307
|
await Promise.resolve();
|
|
@@ -2228,9 +2232,9 @@ var Pipeline = class {
|
|
|
2228
2232
|
this.multiExec = opts.multiExec ?? false;
|
|
2229
2233
|
if (this.commandOptions?.latencyLogging) {
|
|
2230
2234
|
const originalExec = this.exec.bind(this);
|
|
2231
|
-
this.exec = async () => {
|
|
2235
|
+
this.exec = async (options) => {
|
|
2232
2236
|
const start = performance.now();
|
|
2233
|
-
const result = await originalExec();
|
|
2237
|
+
const result = await (options ? originalExec(options) : originalExec());
|
|
2234
2238
|
const end = performance.now();
|
|
2235
2239
|
const loggerResult = (end - start).toFixed(2);
|
|
2236
2240
|
console.log(
|
|
@@ -2240,19 +2244,7 @@ var Pipeline = class {
|
|
|
2240
2244
|
};
|
|
2241
2245
|
}
|
|
2242
2246
|
}
|
|
2243
|
-
|
|
2244
|
-
* Send the pipeline request to upstash.
|
|
2245
|
-
*
|
|
2246
|
-
* Returns an array with the results of all pipelined commands.
|
|
2247
|
-
*
|
|
2248
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
2249
|
-
* ```ts
|
|
2250
|
-
* const p = redis.pipeline()
|
|
2251
|
-
* p.get("key")
|
|
2252
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
2253
|
-
* ```
|
|
2254
|
-
*/
|
|
2255
|
-
exec = async () => {
|
|
2247
|
+
exec = async (options) => {
|
|
2256
2248
|
if (this.commands.length === 0) {
|
|
2257
2249
|
throw new Error("Pipeline is empty");
|
|
2258
2250
|
}
|
|
@@ -2261,7 +2253,12 @@ var Pipeline = class {
|
|
|
2261
2253
|
path,
|
|
2262
2254
|
body: Object.values(this.commands).map((c) => c.command)
|
|
2263
2255
|
});
|
|
2264
|
-
return res.map(({ error, result }, i) => {
|
|
2256
|
+
return options?.keepErrors ? res.map(({ error, result }, i) => {
|
|
2257
|
+
return {
|
|
2258
|
+
error,
|
|
2259
|
+
result: this.commands[i].deserialize(result)
|
|
2260
|
+
};
|
|
2261
|
+
}) : res.map(({ error, result }, i) => {
|
|
2265
2262
|
if (error) {
|
|
2266
2263
|
throw new UpstashError(
|
|
2267
2264
|
`Command ${i + 1} [ ${this.commands[i].command[0]} ] failed: ${error}`
|
|
@@ -3831,7 +3828,7 @@ var Redis = class {
|
|
|
3831
3828
|
};
|
|
3832
3829
|
|
|
3833
3830
|
// version.ts
|
|
3834
|
-
var VERSION = "
|
|
3831
|
+
var VERSION = "v1.34.3";
|
|
3835
3832
|
|
|
3836
3833
|
// platforms/cloudflare.ts
|
|
3837
3834
|
var Redis2 = class _Redis extends Redis {
|
|
@@ -3851,18 +3848,16 @@ var Redis2 = class _Redis extends Redis {
|
|
|
3851
3848
|
console.warn(
|
|
3852
3849
|
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
3853
3850
|
);
|
|
3854
|
-
}
|
|
3855
|
-
if (!config.token) {
|
|
3851
|
+
} else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
|
|
3856
3852
|
console.warn(
|
|
3857
|
-
|
|
3853
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
3858
3854
|
);
|
|
3859
3855
|
}
|
|
3860
|
-
if (config.
|
|
3856
|
+
if (!config.token) {
|
|
3861
3857
|
console.warn(
|
|
3862
|
-
|
|
3858
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
3863
3859
|
);
|
|
3864
|
-
}
|
|
3865
|
-
if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
3860
|
+
} else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
3866
3861
|
console.warn(
|
|
3867
3862
|
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
3868
3863
|
);
|
package/cloudflare.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Redis,
|
|
4
4
|
VERSION,
|
|
5
5
|
error_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FV6JMGNF.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/cloudflare.ts
|
|
9
9
|
var Redis2 = class _Redis extends Redis {
|
|
@@ -23,18 +23,16 @@ var Redis2 = class _Redis extends Redis {
|
|
|
23
23
|
console.warn(
|
|
24
24
|
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
25
25
|
);
|
|
26
|
-
}
|
|
27
|
-
if (!config.token) {
|
|
26
|
+
} else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
|
|
28
27
|
console.warn(
|
|
29
|
-
|
|
28
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
30
29
|
);
|
|
31
30
|
}
|
|
32
|
-
if (config.
|
|
31
|
+
if (!config.token) {
|
|
33
32
|
console.warn(
|
|
34
|
-
|
|
33
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
35
34
|
);
|
|
36
|
-
}
|
|
37
|
-
if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
35
|
+
} else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
38
36
|
console.warn(
|
|
39
37
|
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
40
38
|
);
|
package/fastly.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-
|
|
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-
|
|
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.
|
package/fastly.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-
|
|
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-
|
|
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.
|
package/fastly.js
CHANGED
|
@@ -77,7 +77,7 @@ var HttpClient = class {
|
|
|
77
77
|
};
|
|
78
78
|
this.upstashSyncToken = "";
|
|
79
79
|
this.readYourWrites = config.readYourWrites ?? true;
|
|
80
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
80
|
+
this.baseUrl = (config.baseUrl || "").replace(/\/$/, "");
|
|
81
81
|
const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
|
|
82
82
|
if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
|
|
83
83
|
throw new UrlError(this.baseUrl);
|
|
@@ -119,7 +119,7 @@ var HttpClient = class {
|
|
|
119
119
|
backend: this.options.backend
|
|
120
120
|
};
|
|
121
121
|
if (!this.hasCredentials) {
|
|
122
|
-
|
|
122
|
+
console.warn(
|
|
123
123
|
"[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
|
|
124
124
|
);
|
|
125
125
|
}
|
|
@@ -289,7 +289,7 @@ var AutoPipelineExecutor = class {
|
|
|
289
289
|
executeWithPipeline(pipeline);
|
|
290
290
|
const pipelineDone = this.deferExecution().then(() => {
|
|
291
291
|
if (!this.pipelinePromises.has(pipeline)) {
|
|
292
|
-
const pipelinePromise = pipeline.exec();
|
|
292
|
+
const pipelinePromise = pipeline.exec({ keepErrors: true });
|
|
293
293
|
this.pipelineCounter += 1;
|
|
294
294
|
this.pipelinePromises.set(pipeline, pipelinePromise);
|
|
295
295
|
this.activePipeline = null;
|
|
@@ -297,7 +297,11 @@ var AutoPipelineExecutor = class {
|
|
|
297
297
|
return this.pipelinePromises.get(pipeline);
|
|
298
298
|
});
|
|
299
299
|
const results = await pipelineDone;
|
|
300
|
-
|
|
300
|
+
const commandResult = results[index];
|
|
301
|
+
if (commandResult.error) {
|
|
302
|
+
throw new UpstashError(`Command failed: ${commandResult.error}`);
|
|
303
|
+
}
|
|
304
|
+
return commandResult.result;
|
|
301
305
|
}
|
|
302
306
|
async deferExecution() {
|
|
303
307
|
await Promise.resolve();
|
|
@@ -2228,9 +2232,9 @@ var Pipeline = class {
|
|
|
2228
2232
|
this.multiExec = opts.multiExec ?? false;
|
|
2229
2233
|
if (this.commandOptions?.latencyLogging) {
|
|
2230
2234
|
const originalExec = this.exec.bind(this);
|
|
2231
|
-
this.exec = async () => {
|
|
2235
|
+
this.exec = async (options) => {
|
|
2232
2236
|
const start = performance.now();
|
|
2233
|
-
const result = await originalExec();
|
|
2237
|
+
const result = await (options ? originalExec(options) : originalExec());
|
|
2234
2238
|
const end = performance.now();
|
|
2235
2239
|
const loggerResult = (end - start).toFixed(2);
|
|
2236
2240
|
console.log(
|
|
@@ -2240,19 +2244,7 @@ var Pipeline = class {
|
|
|
2240
2244
|
};
|
|
2241
2245
|
}
|
|
2242
2246
|
}
|
|
2243
|
-
|
|
2244
|
-
* Send the pipeline request to upstash.
|
|
2245
|
-
*
|
|
2246
|
-
* Returns an array with the results of all pipelined commands.
|
|
2247
|
-
*
|
|
2248
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
2249
|
-
* ```ts
|
|
2250
|
-
* const p = redis.pipeline()
|
|
2251
|
-
* p.get("key")
|
|
2252
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
2253
|
-
* ```
|
|
2254
|
-
*/
|
|
2255
|
-
exec = async () => {
|
|
2247
|
+
exec = async (options) => {
|
|
2256
2248
|
if (this.commands.length === 0) {
|
|
2257
2249
|
throw new Error("Pipeline is empty");
|
|
2258
2250
|
}
|
|
@@ -2261,7 +2253,12 @@ var Pipeline = class {
|
|
|
2261
2253
|
path,
|
|
2262
2254
|
body: Object.values(this.commands).map((c) => c.command)
|
|
2263
2255
|
});
|
|
2264
|
-
return res.map(({ error, result }, i) => {
|
|
2256
|
+
return options?.keepErrors ? res.map(({ error, result }, i) => {
|
|
2257
|
+
return {
|
|
2258
|
+
error,
|
|
2259
|
+
result: this.commands[i].deserialize(result)
|
|
2260
|
+
};
|
|
2261
|
+
}) : res.map(({ error, result }, i) => {
|
|
2265
2262
|
if (error) {
|
|
2266
2263
|
throw new UpstashError(
|
|
2267
2264
|
`Command ${i + 1} [ ${this.commands[i].command[0]} ] failed: ${error}`
|
|
@@ -3831,7 +3828,7 @@ var Redis = class {
|
|
|
3831
3828
|
};
|
|
3832
3829
|
|
|
3833
3830
|
// version.ts
|
|
3834
|
-
var VERSION = "
|
|
3831
|
+
var VERSION = "v1.34.3";
|
|
3835
3832
|
|
|
3836
3833
|
// platforms/fastly.ts
|
|
3837
3834
|
var Redis2 = class extends Redis {
|
|
@@ -3852,18 +3849,16 @@ var Redis2 = class extends Redis {
|
|
|
3852
3849
|
console.warn(
|
|
3853
3850
|
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
3854
3851
|
);
|
|
3855
|
-
}
|
|
3856
|
-
if (!config.token) {
|
|
3852
|
+
} else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
|
|
3857
3853
|
console.warn(
|
|
3858
|
-
|
|
3854
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
3859
3855
|
);
|
|
3860
3856
|
}
|
|
3861
|
-
if (config.
|
|
3857
|
+
if (!config.token) {
|
|
3862
3858
|
console.warn(
|
|
3863
|
-
|
|
3859
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
3864
3860
|
);
|
|
3865
|
-
}
|
|
3866
|
-
if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
3861
|
+
} else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
3867
3862
|
console.warn(
|
|
3868
3863
|
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
3869
3864
|
);
|
package/fastly.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Redis,
|
|
4
4
|
VERSION,
|
|
5
5
|
error_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FV6JMGNF.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/fastly.ts
|
|
9
9
|
var Redis2 = class extends Redis {
|
|
@@ -24,18 +24,16 @@ var Redis2 = class extends Redis {
|
|
|
24
24
|
console.warn(
|
|
25
25
|
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
26
26
|
);
|
|
27
|
-
}
|
|
28
|
-
if (!config.token) {
|
|
27
|
+
} else if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
|
|
29
28
|
console.warn(
|
|
30
|
-
|
|
29
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
31
30
|
);
|
|
32
31
|
}
|
|
33
|
-
if (config.
|
|
32
|
+
if (!config.token) {
|
|
34
33
|
console.warn(
|
|
35
|
-
|
|
34
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
36
35
|
);
|
|
37
|
-
}
|
|
38
|
-
if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
36
|
+
} else if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
|
|
39
37
|
console.warn(
|
|
40
38
|
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
41
39
|
);
|
package/nodejs.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-
|
|
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-
|
|
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.
|
package/nodejs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-
|
|
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-
|
|
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.
|
package/nodejs.js
CHANGED
|
@@ -77,7 +77,7 @@ var HttpClient = class {
|
|
|
77
77
|
};
|
|
78
78
|
this.upstashSyncToken = "";
|
|
79
79
|
this.readYourWrites = config.readYourWrites ?? true;
|
|
80
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
80
|
+
this.baseUrl = (config.baseUrl || "").replace(/\/$/, "");
|
|
81
81
|
const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
|
|
82
82
|
if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
|
|
83
83
|
throw new UrlError(this.baseUrl);
|
|
@@ -119,7 +119,7 @@ var HttpClient = class {
|
|
|
119
119
|
backend: this.options.backend
|
|
120
120
|
};
|
|
121
121
|
if (!this.hasCredentials) {
|
|
122
|
-
|
|
122
|
+
console.warn(
|
|
123
123
|
"[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
|
|
124
124
|
);
|
|
125
125
|
}
|
|
@@ -289,7 +289,7 @@ var AutoPipelineExecutor = class {
|
|
|
289
289
|
executeWithPipeline(pipeline);
|
|
290
290
|
const pipelineDone = this.deferExecution().then(() => {
|
|
291
291
|
if (!this.pipelinePromises.has(pipeline)) {
|
|
292
|
-
const pipelinePromise = pipeline.exec();
|
|
292
|
+
const pipelinePromise = pipeline.exec({ keepErrors: true });
|
|
293
293
|
this.pipelineCounter += 1;
|
|
294
294
|
this.pipelinePromises.set(pipeline, pipelinePromise);
|
|
295
295
|
this.activePipeline = null;
|
|
@@ -297,7 +297,11 @@ var AutoPipelineExecutor = class {
|
|
|
297
297
|
return this.pipelinePromises.get(pipeline);
|
|
298
298
|
});
|
|
299
299
|
const results = await pipelineDone;
|
|
300
|
-
|
|
300
|
+
const commandResult = results[index];
|
|
301
|
+
if (commandResult.error) {
|
|
302
|
+
throw new UpstashError(`Command failed: ${commandResult.error}`);
|
|
303
|
+
}
|
|
304
|
+
return commandResult.result;
|
|
301
305
|
}
|
|
302
306
|
async deferExecution() {
|
|
303
307
|
await Promise.resolve();
|
|
@@ -2228,9 +2232,9 @@ var Pipeline = class {
|
|
|
2228
2232
|
this.multiExec = opts.multiExec ?? false;
|
|
2229
2233
|
if (this.commandOptions?.latencyLogging) {
|
|
2230
2234
|
const originalExec = this.exec.bind(this);
|
|
2231
|
-
this.exec = async () => {
|
|
2235
|
+
this.exec = async (options) => {
|
|
2232
2236
|
const start = performance.now();
|
|
2233
|
-
const result = await originalExec();
|
|
2237
|
+
const result = await (options ? originalExec(options) : originalExec());
|
|
2234
2238
|
const end = performance.now();
|
|
2235
2239
|
const loggerResult = (end - start).toFixed(2);
|
|
2236
2240
|
console.log(
|
|
@@ -2240,19 +2244,7 @@ var Pipeline = class {
|
|
|
2240
2244
|
};
|
|
2241
2245
|
}
|
|
2242
2246
|
}
|
|
2243
|
-
|
|
2244
|
-
* Send the pipeline request to upstash.
|
|
2245
|
-
*
|
|
2246
|
-
* Returns an array with the results of all pipelined commands.
|
|
2247
|
-
*
|
|
2248
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
2249
|
-
* ```ts
|
|
2250
|
-
* const p = redis.pipeline()
|
|
2251
|
-
* p.get("key")
|
|
2252
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
2253
|
-
* ```
|
|
2254
|
-
*/
|
|
2255
|
-
exec = async () => {
|
|
2247
|
+
exec = async (options) => {
|
|
2256
2248
|
if (this.commands.length === 0) {
|
|
2257
2249
|
throw new Error("Pipeline is empty");
|
|
2258
2250
|
}
|
|
@@ -2261,7 +2253,12 @@ var Pipeline = class {
|
|
|
2261
2253
|
path,
|
|
2262
2254
|
body: Object.values(this.commands).map((c) => c.command)
|
|
2263
2255
|
});
|
|
2264
|
-
return res.map(({ error, result }, i) => {
|
|
2256
|
+
return options?.keepErrors ? res.map(({ error, result }, i) => {
|
|
2257
|
+
return {
|
|
2258
|
+
error,
|
|
2259
|
+
result: this.commands[i].deserialize(result)
|
|
2260
|
+
};
|
|
2261
|
+
}) : res.map(({ error, result }, i) => {
|
|
2265
2262
|
if (error) {
|
|
2266
2263
|
throw new UpstashError(
|
|
2267
2264
|
`Command ${i + 1} [ ${this.commands[i].command[0]} ] failed: ${error}`
|
|
@@ -3831,7 +3828,7 @@ var Redis = class {
|
|
|
3831
3828
|
};
|
|
3832
3829
|
|
|
3833
3830
|
// version.ts
|
|
3834
|
-
var VERSION = "
|
|
3831
|
+
var VERSION = "v1.34.3";
|
|
3835
3832
|
|
|
3836
3833
|
// platforms/nodejs.ts
|
|
3837
3834
|
if (typeof atob === "undefined") {
|
|
@@ -3864,18 +3861,16 @@ var Redis2 = class _Redis extends Redis {
|
|
|
3864
3861
|
console.warn(
|
|
3865
3862
|
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
3866
3863
|
);
|
|
3867
|
-
}
|
|
3868
|
-
if (!configOrRequester.token) {
|
|
3864
|
+
} else if (configOrRequester.url.startsWith(" ") || configOrRequester.url.endsWith(" ") || /\r|\n/.test(configOrRequester.url)) {
|
|
3869
3865
|
console.warn(
|
|
3870
|
-
|
|
3866
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
3871
3867
|
);
|
|
3872
3868
|
}
|
|
3873
|
-
if (configOrRequester.
|
|
3869
|
+
if (!configOrRequester.token) {
|
|
3874
3870
|
console.warn(
|
|
3875
|
-
|
|
3871
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
3876
3872
|
);
|
|
3877
|
-
}
|
|
3878
|
-
if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
|
|
3873
|
+
} else if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
|
|
3879
3874
|
console.warn(
|
|
3880
3875
|
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
3881
3876
|
);
|
|
@@ -3924,11 +3919,11 @@ var Redis2 = class _Redis extends Redis {
|
|
|
3924
3919
|
'[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
|
|
3925
3920
|
);
|
|
3926
3921
|
}
|
|
3927
|
-
const url = process.env.UPSTASH_REDIS_REST_URL;
|
|
3922
|
+
const url = process.env.UPSTASH_REDIS_REST_URL || process.env.KV_REST_API_URL;
|
|
3928
3923
|
if (!url) {
|
|
3929
3924
|
console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
|
|
3930
3925
|
}
|
|
3931
|
-
const token = process.env.UPSTASH_REDIS_REST_TOKEN;
|
|
3926
|
+
const token = process.env.UPSTASH_REDIS_REST_TOKEN || process.env.KV_REST_API_TOKEN;
|
|
3932
3927
|
if (!token) {
|
|
3933
3928
|
console.warn(
|
|
3934
3929
|
"[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`"
|
package/nodejs.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Redis,
|
|
4
4
|
VERSION,
|
|
5
5
|
error_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FV6JMGNF.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/nodejs.ts
|
|
9
9
|
if (typeof atob === "undefined") {
|
|
@@ -36,18 +36,16 @@ var Redis2 = class _Redis extends Redis {
|
|
|
36
36
|
console.warn(
|
|
37
37
|
`[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
|
|
38
38
|
);
|
|
39
|
-
}
|
|
40
|
-
if (!configOrRequester.token) {
|
|
39
|
+
} else if (configOrRequester.url.startsWith(" ") || configOrRequester.url.endsWith(" ") || /\r|\n/.test(configOrRequester.url)) {
|
|
41
40
|
console.warn(
|
|
42
|
-
|
|
41
|
+
"[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
|
|
43
42
|
);
|
|
44
43
|
}
|
|
45
|
-
if (configOrRequester.
|
|
44
|
+
if (!configOrRequester.token) {
|
|
46
45
|
console.warn(
|
|
47
|
-
|
|
46
|
+
`[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
|
|
48
47
|
);
|
|
49
|
-
}
|
|
50
|
-
if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
|
|
48
|
+
} else if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
|
|
51
49
|
console.warn(
|
|
52
50
|
"[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
|
|
53
51
|
);
|
|
@@ -96,11 +94,11 @@ var Redis2 = class _Redis extends Redis {
|
|
|
96
94
|
'[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
|
|
97
95
|
);
|
|
98
96
|
}
|
|
99
|
-
const url = process.env.UPSTASH_REDIS_REST_URL;
|
|
97
|
+
const url = process.env.UPSTASH_REDIS_REST_URL || process.env.KV_REST_API_URL;
|
|
100
98
|
if (!url) {
|
|
101
99
|
console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
|
|
102
100
|
}
|
|
103
|
-
const token = process.env.UPSTASH_REDIS_REST_TOKEN;
|
|
101
|
+
const token = process.env.UPSTASH_REDIS_REST_TOKEN || process.env.KV_REST_API_TOKEN;
|
|
104
102
|
if (!token) {
|
|
105
103
|
console.warn(
|
|
106
104
|
"[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`"
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@upstash/redis","version":"
|
|
1
|
+
{"name":"@upstash/redis","version":"v1.34.3","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@types/crypto-js":"^4.1.3","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"crypto-js":"^4.2.0"}}
|
|
@@ -1602,6 +1602,39 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1602
1602
|
type InferResponseData<T extends unknown[]> = {
|
|
1603
1603
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1604
1604
|
};
|
|
1605
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1606
|
+
/**
|
|
1607
|
+
* Send the pipeline request to upstash.
|
|
1608
|
+
*
|
|
1609
|
+
* Returns an array with the results of all pipelined commands.
|
|
1610
|
+
*
|
|
1611
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1612
|
+
* ```ts
|
|
1613
|
+
* const p = redis.pipeline()
|
|
1614
|
+
* p.get("key")
|
|
1615
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1616
|
+
* ```
|
|
1617
|
+
*
|
|
1618
|
+
* If one of the commands get an error, the whole pipeline fails. Alternatively, you can set the keepErrors option to true in order to get the errors individually.
|
|
1619
|
+
*
|
|
1620
|
+
* If keepErrors is set to true, a list of objects is returned where each object corresponds to a command and is of type: `{ result: unknown, error?: string }`.
|
|
1621
|
+
*
|
|
1622
|
+
* ```ts
|
|
1623
|
+
* const p = redis.pipeline()
|
|
1624
|
+
* p.get("key")
|
|
1625
|
+
*
|
|
1626
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1627
|
+
* const getResult = result[0].result
|
|
1628
|
+
* const getError = result[0].error
|
|
1629
|
+
* ```
|
|
1630
|
+
*/
|
|
1631
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1632
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1633
|
+
keepErrors: true;
|
|
1634
|
+
}): Promise<{
|
|
1635
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1636
|
+
}>;
|
|
1637
|
+
}
|
|
1605
1638
|
/**
|
|
1606
1639
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1607
1640
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1650,19 +1683,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1650
1683
|
commandOptions?: CommandOptions<any, any>;
|
|
1651
1684
|
multiExec?: boolean;
|
|
1652
1685
|
});
|
|
1653
|
-
|
|
1654
|
-
* Send the pipeline request to upstash.
|
|
1655
|
-
*
|
|
1656
|
-
* Returns an array with the results of all pipelined commands.
|
|
1657
|
-
*
|
|
1658
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1659
|
-
* ```ts
|
|
1660
|
-
* const p = redis.pipeline()
|
|
1661
|
-
* p.get("key")
|
|
1662
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1663
|
-
* ```
|
|
1664
|
-
*/
|
|
1665
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
1686
|
+
exec: ExecMethod<TCommands>;
|
|
1666
1687
|
/**
|
|
1667
1688
|
* Returns the length of pipeline before the execution
|
|
1668
1689
|
*/
|
|
@@ -1602,6 +1602,39 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1602
1602
|
type InferResponseData<T extends unknown[]> = {
|
|
1603
1603
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1604
1604
|
};
|
|
1605
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1606
|
+
/**
|
|
1607
|
+
* Send the pipeline request to upstash.
|
|
1608
|
+
*
|
|
1609
|
+
* Returns an array with the results of all pipelined commands.
|
|
1610
|
+
*
|
|
1611
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1612
|
+
* ```ts
|
|
1613
|
+
* const p = redis.pipeline()
|
|
1614
|
+
* p.get("key")
|
|
1615
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1616
|
+
* ```
|
|
1617
|
+
*
|
|
1618
|
+
* If one of the commands get an error, the whole pipeline fails. Alternatively, you can set the keepErrors option to true in order to get the errors individually.
|
|
1619
|
+
*
|
|
1620
|
+
* If keepErrors is set to true, a list of objects is returned where each object corresponds to a command and is of type: `{ result: unknown, error?: string }`.
|
|
1621
|
+
*
|
|
1622
|
+
* ```ts
|
|
1623
|
+
* const p = redis.pipeline()
|
|
1624
|
+
* p.get("key")
|
|
1625
|
+
*
|
|
1626
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1627
|
+
* const getResult = result[0].result
|
|
1628
|
+
* const getError = result[0].error
|
|
1629
|
+
* ```
|
|
1630
|
+
*/
|
|
1631
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1632
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1633
|
+
keepErrors: true;
|
|
1634
|
+
}): Promise<{
|
|
1635
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1636
|
+
}>;
|
|
1637
|
+
}
|
|
1605
1638
|
/**
|
|
1606
1639
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1607
1640
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1650,19 +1683,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1650
1683
|
commandOptions?: CommandOptions<any, any>;
|
|
1651
1684
|
multiExec?: boolean;
|
|
1652
1685
|
});
|
|
1653
|
-
|
|
1654
|
-
* Send the pipeline request to upstash.
|
|
1655
|
-
*
|
|
1656
|
-
* Returns an array with the results of all pipelined commands.
|
|
1657
|
-
*
|
|
1658
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1659
|
-
* ```ts
|
|
1660
|
-
* const p = redis.pipeline()
|
|
1661
|
-
* p.get("key")
|
|
1662
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1663
|
-
* ```
|
|
1664
|
-
*/
|
|
1665
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
1686
|
+
exec: ExecMethod<TCommands>;
|
|
1666
1687
|
/**
|
|
1667
1688
|
* Returns the length of pipeline before the execution
|
|
1668
1689
|
*/
|