@upstash/redis 0.0.0-ci.f6da5d747c9564bc95fccdbfe16a9aa10cd30367-20251125191507 → 0.0.0-ci.f725f60c40a2b7f0e25dd9bf83a931c24624cdf6-20260123181037
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-WTYE7OV3.mjs → chunk-SGAAV5RA.mjs} +206 -27
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +221 -38
- package/cloudflare.mjs +14 -10
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +208 -29
- package/fastly.mjs +1 -1
- package/nodejs.d.mts +2 -2
- package/nodejs.d.ts +2 -2
- package/nodejs.js +214 -33
- package/nodejs.mjs +7 -5
- package/package.json +1 -1
- package/{zmscore-xbfRql7X.d.mts → zmscore-0SAuWM0q.d.mts} +135 -3
- package/{zmscore-xbfRql7X.d.ts → zmscore-0SAuWM0q.d.ts} +135 -3
package/cloudflare.js
CHANGED
|
@@ -98,8 +98,18 @@ function mergeHeaders(...headers) {
|
|
|
98
98
|
}
|
|
99
99
|
return merged;
|
|
100
100
|
}
|
|
101
|
+
function kvArrayToObject(v) {
|
|
102
|
+
if (typeof v === "object" && v !== null && !Array.isArray(v)) return v;
|
|
103
|
+
if (!Array.isArray(v)) return {};
|
|
104
|
+
const obj = {};
|
|
105
|
+
for (let i = 0; i < v.length; i += 2) {
|
|
106
|
+
if (typeof v[i] === "string") obj[v[i]] = v[i + 1];
|
|
107
|
+
}
|
|
108
|
+
return obj;
|
|
109
|
+
}
|
|
101
110
|
|
|
102
111
|
// pkg/http.ts
|
|
112
|
+
var MAX_BUFFER_SIZE = 1024 * 1024;
|
|
103
113
|
var HttpClient = class {
|
|
104
114
|
baseUrl;
|
|
105
115
|
headers;
|
|
@@ -223,11 +233,16 @@ var HttpClient = class {
|
|
|
223
233
|
const decoder = new TextDecoder();
|
|
224
234
|
(async () => {
|
|
225
235
|
try {
|
|
236
|
+
let buffer = "";
|
|
226
237
|
while (true) {
|
|
227
238
|
const { value, done } = await reader.read();
|
|
228
239
|
if (done) break;
|
|
229
|
-
|
|
230
|
-
const lines =
|
|
240
|
+
buffer += decoder.decode(value, { stream: true });
|
|
241
|
+
const lines = buffer.split("\n");
|
|
242
|
+
buffer = lines.pop() || "";
|
|
243
|
+
if (buffer.length > MAX_BUFFER_SIZE) {
|
|
244
|
+
throw new Error("Buffer size exceeded (1MB)");
|
|
245
|
+
}
|
|
231
246
|
for (const line of lines) {
|
|
232
247
|
if (line.startsWith("data: ")) {
|
|
233
248
|
const data = line.slice(6);
|
|
@@ -345,7 +360,7 @@ var EXCLUDE_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
345
360
|
"zrange",
|
|
346
361
|
"exec"
|
|
347
362
|
]);
|
|
348
|
-
function createAutoPipelineProxy(_redis,
|
|
363
|
+
function createAutoPipelineProxy(_redis, namespace = "root") {
|
|
349
364
|
const redis = _redis;
|
|
350
365
|
if (!redis.autoPipelineExecutor) {
|
|
351
366
|
redis.autoPipelineExecutor = new AutoPipelineExecutor(redis);
|
|
@@ -355,29 +370,31 @@ function createAutoPipelineProxy(_redis, json) {
|
|
|
355
370
|
if (command === "pipelineCounter") {
|
|
356
371
|
return redis2.autoPipelineExecutor.pipelineCounter;
|
|
357
372
|
}
|
|
358
|
-
if (command === "json") {
|
|
359
|
-
return createAutoPipelineProxy(redis2,
|
|
373
|
+
if (namespace === "root" && command === "json") {
|
|
374
|
+
return createAutoPipelineProxy(redis2, "json");
|
|
375
|
+
}
|
|
376
|
+
if (namespace === "root" && command === "functions") {
|
|
377
|
+
return createAutoPipelineProxy(redis2, "functions");
|
|
360
378
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
379
|
+
if (namespace === "root") {
|
|
380
|
+
const commandInRedisButNotPipeline = command in redis2 && !(command in redis2.autoPipelineExecutor.pipeline);
|
|
381
|
+
const isCommandExcluded = EXCLUDE_COMMANDS.has(command);
|
|
382
|
+
if (commandInRedisButNotPipeline || isCommandExcluded) {
|
|
383
|
+
return redis2[command];
|
|
384
|
+
}
|
|
365
385
|
}
|
|
366
|
-
const
|
|
386
|
+
const pipeline = redis2.autoPipelineExecutor.pipeline;
|
|
387
|
+
const targetFunction = namespace === "json" ? pipeline.json[command] : namespace === "functions" ? pipeline.functions[command] : pipeline[command];
|
|
388
|
+
const isFunction = typeof targetFunction === "function";
|
|
367
389
|
if (isFunction) {
|
|
368
390
|
return (...args) => {
|
|
369
|
-
return redis2.autoPipelineExecutor.withAutoPipeline((
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
...args
|
|
373
|
-
);
|
|
374
|
-
} else {
|
|
375
|
-
pipeline[command](...args);
|
|
376
|
-
}
|
|
391
|
+
return redis2.autoPipelineExecutor.withAutoPipeline((pipeline2) => {
|
|
392
|
+
const targetFunction2 = namespace === "json" ? pipeline2.json[command] : namespace === "functions" ? pipeline2.functions[command] : pipeline2[command];
|
|
393
|
+
targetFunction2(...args);
|
|
377
394
|
});
|
|
378
395
|
};
|
|
379
396
|
}
|
|
380
|
-
return
|
|
397
|
+
return targetFunction;
|
|
381
398
|
}
|
|
382
399
|
});
|
|
383
400
|
}
|
|
@@ -670,6 +687,23 @@ var ExpireAtCommand = class extends Command {
|
|
|
670
687
|
}
|
|
671
688
|
};
|
|
672
689
|
|
|
690
|
+
// pkg/commands/fcall.ts
|
|
691
|
+
var FCallCommand = class extends Command {
|
|
692
|
+
constructor([functionName, keys, args], opts) {
|
|
693
|
+
super(["fcall", functionName, ...keys ? [keys.length, ...keys] : [0], ...args ?? []], opts);
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
// pkg/commands/fcall_ro.ts
|
|
698
|
+
var FCallRoCommand = class extends Command {
|
|
699
|
+
constructor([functionName, keys, args], opts) {
|
|
700
|
+
super(
|
|
701
|
+
["fcall_ro", functionName, ...keys ? [keys.length, ...keys] : [0], ...args ?? []],
|
|
702
|
+
opts
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
|
|
673
707
|
// pkg/commands/flushall.ts
|
|
674
708
|
var FlushAllCommand = class extends Command {
|
|
675
709
|
constructor(args, opts) {
|
|
@@ -692,6 +726,85 @@ var FlushDBCommand = class extends Command {
|
|
|
692
726
|
}
|
|
693
727
|
};
|
|
694
728
|
|
|
729
|
+
// pkg/commands/function_delete.ts
|
|
730
|
+
var FunctionDeleteCommand = class extends Command {
|
|
731
|
+
constructor([libraryName], opts) {
|
|
732
|
+
super(["function", "delete", libraryName], opts);
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
// pkg/commands/function_flush.ts
|
|
737
|
+
var FunctionFlushCommand = class extends Command {
|
|
738
|
+
constructor(opts) {
|
|
739
|
+
super(["function", "flush"], opts);
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
// pkg/commands/function_list.ts
|
|
744
|
+
var FunctionListCommand = class extends Command {
|
|
745
|
+
constructor([args], opts) {
|
|
746
|
+
const command = ["function", "list"];
|
|
747
|
+
if (args?.libraryName) {
|
|
748
|
+
command.push("libraryname", args.libraryName);
|
|
749
|
+
}
|
|
750
|
+
if (args?.withCode) {
|
|
751
|
+
command.push("withcode");
|
|
752
|
+
}
|
|
753
|
+
super(command, { deserialize, ...opts });
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
function deserialize(result) {
|
|
757
|
+
if (!Array.isArray(result)) return [];
|
|
758
|
+
return result.map((libRaw) => {
|
|
759
|
+
const lib = kvArrayToObject(libRaw);
|
|
760
|
+
const functionsParsed = lib.functions.map(
|
|
761
|
+
(fnRaw) => kvArrayToObject(fnRaw)
|
|
762
|
+
);
|
|
763
|
+
return {
|
|
764
|
+
libraryName: lib.library_name,
|
|
765
|
+
engine: lib.engine,
|
|
766
|
+
functions: functionsParsed.map((fn) => ({
|
|
767
|
+
name: fn.name,
|
|
768
|
+
description: fn.description ?? void 0,
|
|
769
|
+
flags: fn.flags
|
|
770
|
+
})),
|
|
771
|
+
libraryCode: lib.library_code
|
|
772
|
+
};
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
// pkg/commands/function_load.ts
|
|
777
|
+
var FunctionLoadCommand = class extends Command {
|
|
778
|
+
constructor([args], opts) {
|
|
779
|
+
super(["function", "load", ...args.replace ? ["replace"] : [], args.code], opts);
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// pkg/commands/function_stats.ts
|
|
784
|
+
var FunctionStatsCommand = class extends Command {
|
|
785
|
+
constructor(opts) {
|
|
786
|
+
super(["function", "stats"], { deserialize: deserialize2, ...opts });
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
function deserialize2(result) {
|
|
790
|
+
const rawEngines = kvArrayToObject(kvArrayToObject(result).engines);
|
|
791
|
+
const parsedEngines = Object.fromEntries(
|
|
792
|
+
Object.entries(rawEngines).map(([key, value]) => [key, kvArrayToObject(value)])
|
|
793
|
+
);
|
|
794
|
+
const final = {
|
|
795
|
+
engines: Object.fromEntries(
|
|
796
|
+
Object.entries(parsedEngines).map(([key, value]) => [
|
|
797
|
+
key,
|
|
798
|
+
{
|
|
799
|
+
librariesCount: value.libraries_count,
|
|
800
|
+
functionsCount: value.functions_count
|
|
801
|
+
}
|
|
802
|
+
])
|
|
803
|
+
)
|
|
804
|
+
};
|
|
805
|
+
return final;
|
|
806
|
+
}
|
|
807
|
+
|
|
695
808
|
// pkg/commands/geo_add.ts
|
|
696
809
|
var GeoAddCommand = class extends Command {
|
|
697
810
|
constructor([key, arg1, ...arg2], opts) {
|
|
@@ -1038,7 +1151,7 @@ var HGetCommand = class extends Command {
|
|
|
1038
1151
|
};
|
|
1039
1152
|
|
|
1040
1153
|
// pkg/commands/hgetall.ts
|
|
1041
|
-
function
|
|
1154
|
+
function deserialize3(result) {
|
|
1042
1155
|
if (result.length === 0) {
|
|
1043
1156
|
return null;
|
|
1044
1157
|
}
|
|
@@ -1058,7 +1171,7 @@ function deserialize(result) {
|
|
|
1058
1171
|
var HGetAllCommand = class extends Command {
|
|
1059
1172
|
constructor(cmd, opts) {
|
|
1060
1173
|
super(["hgetall", ...cmd], {
|
|
1061
|
-
deserialize: (result) =>
|
|
1174
|
+
deserialize: (result) => deserialize3(result),
|
|
1062
1175
|
...opts
|
|
1063
1176
|
});
|
|
1064
1177
|
}
|
|
@@ -1093,7 +1206,7 @@ var HLenCommand = class extends Command {
|
|
|
1093
1206
|
};
|
|
1094
1207
|
|
|
1095
1208
|
// pkg/commands/hmget.ts
|
|
1096
|
-
function
|
|
1209
|
+
function deserialize4(fields, result) {
|
|
1097
1210
|
if (result.every((field) => field === null)) {
|
|
1098
1211
|
return null;
|
|
1099
1212
|
}
|
|
@@ -1110,7 +1223,7 @@ function deserialize2(fields, result) {
|
|
|
1110
1223
|
var HMGetCommand = class extends Command {
|
|
1111
1224
|
constructor([key, ...fields], opts) {
|
|
1112
1225
|
super(["hmget", key, ...fields], {
|
|
1113
|
-
deserialize: (result) =>
|
|
1226
|
+
deserialize: (result) => deserialize4(fields, result),
|
|
1114
1227
|
...opts
|
|
1115
1228
|
});
|
|
1116
1229
|
}
|
|
@@ -1124,7 +1237,7 @@ var HMSetCommand = class extends Command {
|
|
|
1124
1237
|
};
|
|
1125
1238
|
|
|
1126
1239
|
// pkg/commands/hrandfield.ts
|
|
1127
|
-
function
|
|
1240
|
+
function deserialize5(result) {
|
|
1128
1241
|
if (result.length === 0) {
|
|
1129
1242
|
return null;
|
|
1130
1243
|
}
|
|
@@ -1151,7 +1264,7 @@ var HRandFieldCommand = class extends Command {
|
|
|
1151
1264
|
}
|
|
1152
1265
|
super(command, {
|
|
1153
1266
|
// @ts-expect-error to silence compiler
|
|
1154
|
-
deserialize: cmd[2] ? (result) =>
|
|
1267
|
+
deserialize: cmd[2] ? (result) => deserialize5(result) : opts?.deserialize,
|
|
1155
1268
|
...opts
|
|
1156
1269
|
});
|
|
1157
1270
|
}
|
|
@@ -2121,7 +2234,7 @@ var XPendingCommand = class extends Command {
|
|
|
2121
2234
|
};
|
|
2122
2235
|
|
|
2123
2236
|
// pkg/commands/xrange.ts
|
|
2124
|
-
function
|
|
2237
|
+
function deserialize6(result) {
|
|
2125
2238
|
const obj = {};
|
|
2126
2239
|
for (const e of result) {
|
|
2127
2240
|
for (let i = 0; i < e.length; i += 2) {
|
|
@@ -2150,7 +2263,7 @@ var XRangeCommand = class extends Command {
|
|
|
2150
2263
|
command.push("COUNT", count);
|
|
2151
2264
|
}
|
|
2152
2265
|
super(command, {
|
|
2153
|
-
deserialize: (result) =>
|
|
2266
|
+
deserialize: (result) => deserialize6(result),
|
|
2154
2267
|
...opts
|
|
2155
2268
|
});
|
|
2156
2269
|
}
|
|
@@ -2213,12 +2326,12 @@ var XRevRangeCommand = class extends Command {
|
|
|
2213
2326
|
command.push("COUNT", count);
|
|
2214
2327
|
}
|
|
2215
2328
|
super(command, {
|
|
2216
|
-
deserialize: (result) =>
|
|
2329
|
+
deserialize: (result) => deserialize7(result),
|
|
2217
2330
|
...opts
|
|
2218
2331
|
});
|
|
2219
2332
|
}
|
|
2220
2333
|
};
|
|
2221
|
-
function
|
|
2334
|
+
function deserialize7(result) {
|
|
2222
2335
|
const obj = {};
|
|
2223
2336
|
for (const e of result) {
|
|
2224
2337
|
for (let i = 0; i < e.length; i += 2) {
|
|
@@ -3513,6 +3626,38 @@ var Pipeline = class {
|
|
|
3513
3626
|
type: (...args) => this.chain(new JsonTypeCommand(args, this.commandOptions))
|
|
3514
3627
|
};
|
|
3515
3628
|
}
|
|
3629
|
+
get functions() {
|
|
3630
|
+
return {
|
|
3631
|
+
/**
|
|
3632
|
+
* @see https://redis.io/docs/latest/commands/function-load/
|
|
3633
|
+
*/
|
|
3634
|
+
load: (...args) => this.chain(new FunctionLoadCommand(args, this.commandOptions)),
|
|
3635
|
+
/**
|
|
3636
|
+
* @see https://redis.io/docs/latest/commands/function-list/
|
|
3637
|
+
*/
|
|
3638
|
+
list: (...args) => this.chain(new FunctionListCommand(args, this.commandOptions)),
|
|
3639
|
+
/**
|
|
3640
|
+
* @see https://redis.io/docs/latest/commands/function-delete/
|
|
3641
|
+
*/
|
|
3642
|
+
delete: (...args) => this.chain(new FunctionDeleteCommand(args, this.commandOptions)),
|
|
3643
|
+
/**
|
|
3644
|
+
* @see https://redis.io/docs/latest/commands/function-flush/
|
|
3645
|
+
*/
|
|
3646
|
+
flush: () => this.chain(new FunctionFlushCommand(this.commandOptions)),
|
|
3647
|
+
/**
|
|
3648
|
+
* @see https://redis.io/docs/latest/commands/function-stats/
|
|
3649
|
+
*/
|
|
3650
|
+
stats: () => this.chain(new FunctionStatsCommand(this.commandOptions)),
|
|
3651
|
+
/**
|
|
3652
|
+
* @see https://redis.io/docs/latest/commands/fcall/
|
|
3653
|
+
*/
|
|
3654
|
+
call: (...args) => this.chain(new FCallCommand(args, this.commandOptions)),
|
|
3655
|
+
/**
|
|
3656
|
+
* @see https://redis.io/docs/latest/commands/fcall_ro/
|
|
3657
|
+
*/
|
|
3658
|
+
callRo: (...args) => this.chain(new FCallRoCommand(args, this.commandOptions))
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3516
3661
|
};
|
|
3517
3662
|
|
|
3518
3663
|
// pkg/script.ts
|
|
@@ -3774,6 +3919,40 @@ var Redis = class {
|
|
|
3774
3919
|
type: (...args) => new JsonTypeCommand(args, this.opts).exec(this.client)
|
|
3775
3920
|
};
|
|
3776
3921
|
}
|
|
3922
|
+
get functions() {
|
|
3923
|
+
return {
|
|
3924
|
+
/**
|
|
3925
|
+
* @see https://redis.io/docs/latest/commands/function-load/
|
|
3926
|
+
*/
|
|
3927
|
+
load: (...args) => new FunctionLoadCommand(args, this.opts).exec(this.client),
|
|
3928
|
+
/**
|
|
3929
|
+
* @see https://redis.io/docs/latest/commands/function-list/
|
|
3930
|
+
*/
|
|
3931
|
+
list: (...args) => new FunctionListCommand(args, this.opts).exec(this.client),
|
|
3932
|
+
/**
|
|
3933
|
+
* @see https://redis.io/docs/latest/commands/function-delete/
|
|
3934
|
+
*/
|
|
3935
|
+
delete: (...args) => new FunctionDeleteCommand(args, this.opts).exec(this.client),
|
|
3936
|
+
/**
|
|
3937
|
+
* @see https://redis.io/docs/latest/commands/function-flush/
|
|
3938
|
+
*/
|
|
3939
|
+
flush: () => new FunctionFlushCommand(this.opts).exec(this.client),
|
|
3940
|
+
/**
|
|
3941
|
+
* @see https://redis.io/docs/latest/commands/function-stats/
|
|
3942
|
+
*
|
|
3943
|
+
* Note: `running_script` field is not supported and therefore not included in the type.
|
|
3944
|
+
*/
|
|
3945
|
+
stats: () => new FunctionStatsCommand(this.opts).exec(this.client),
|
|
3946
|
+
/**
|
|
3947
|
+
* @see https://redis.io/docs/latest/commands/fcall/
|
|
3948
|
+
*/
|
|
3949
|
+
call: (...args) => new FCallCommand(args, this.opts).exec(this.client),
|
|
3950
|
+
/**
|
|
3951
|
+
* @see https://redis.io/docs/latest/commands/fcall_ro/
|
|
3952
|
+
*/
|
|
3953
|
+
callRo: (...args) => new FCallRoCommand(args, this.opts).exec(this.client)
|
|
3954
|
+
};
|
|
3955
|
+
}
|
|
3777
3956
|
/**
|
|
3778
3957
|
* Wrap a new middleware around the HTTP client.
|
|
3779
3958
|
*/
|
|
@@ -4600,16 +4779,20 @@ var Redis2 = class _Redis extends Redis {
|
|
|
4600
4779
|
* ```
|
|
4601
4780
|
*/
|
|
4602
4781
|
static fromEnv(env, opts) {
|
|
4603
|
-
const url = env?.UPSTASH_REDIS_REST_URL ??
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4782
|
+
const url = env?.UPSTASH_REDIS_REST_URL ?? // @ts-expect-error These will be defined by cloudflare
|
|
4783
|
+
(typeof UPSTASH_REDIS_REST_URL === "string" ? (
|
|
4784
|
+
// @ts-expect-error These will be defined by cloudflare
|
|
4785
|
+
UPSTASH_REDIS_REST_URL
|
|
4786
|
+
) : void 0);
|
|
4787
|
+
const token = env?.UPSTASH_REDIS_REST_TOKEN ?? // @ts-expect-error These will be defined by cloudflare
|
|
4788
|
+
(typeof UPSTASH_REDIS_REST_TOKEN === "string" ? (
|
|
4789
|
+
// @ts-expect-error These will be defined by cloudflare
|
|
4790
|
+
UPSTASH_REDIS_REST_TOKEN
|
|
4791
|
+
) : void 0);
|
|
4792
|
+
const messageInfo = !url && !token ? "Unable to find environment variables: `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`" : url ? token ? void 0 : "Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`" : "Unable to find environment variable: `UPSTASH_REDIS_REST_URL`";
|
|
4793
|
+
if (messageInfo) {
|
|
4611
4794
|
console.warn(
|
|
4612
|
-
|
|
4795
|
+
`[Upstash Redis] ${messageInfo}. Please add it via \`wrangler secret put ${url ? "UPSTASH_REDIS_REST_TOKEN" : "UPSTASH_REDIS_REST_URL"}\` and provide it as an argument to the \`Redis.fromEnv\` function`
|
|
4613
4796
|
);
|
|
4614
4797
|
}
|
|
4615
4798
|
return new _Redis({ ...opts, url, token }, env);
|
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-SGAAV5RA.mjs";
|
|
7
7
|
|
|
8
8
|
// platforms/cloudflare.ts
|
|
9
9
|
var Redis2 = class _Redis extends Redis {
|
|
@@ -72,16 +72,20 @@ var Redis2 = class _Redis extends Redis {
|
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
74
|
static fromEnv(env, opts) {
|
|
75
|
-
const url = env?.UPSTASH_REDIS_REST_URL ??
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const url = env?.UPSTASH_REDIS_REST_URL ?? // @ts-expect-error These will be defined by cloudflare
|
|
76
|
+
(typeof UPSTASH_REDIS_REST_URL === "string" ? (
|
|
77
|
+
// @ts-expect-error These will be defined by cloudflare
|
|
78
|
+
UPSTASH_REDIS_REST_URL
|
|
79
|
+
) : void 0);
|
|
80
|
+
const token = env?.UPSTASH_REDIS_REST_TOKEN ?? // @ts-expect-error These will be defined by cloudflare
|
|
81
|
+
(typeof UPSTASH_REDIS_REST_TOKEN === "string" ? (
|
|
82
|
+
// @ts-expect-error These will be defined by cloudflare
|
|
83
|
+
UPSTASH_REDIS_REST_TOKEN
|
|
84
|
+
) : void 0);
|
|
85
|
+
const messageInfo = !url && !token ? "Unable to find environment variables: `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`" : url ? token ? void 0 : "Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`" : "Unable to find environment variable: `UPSTASH_REDIS_REST_URL`";
|
|
86
|
+
if (messageInfo) {
|
|
78
87
|
console.warn(
|
|
79
|
-
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
if (!token) {
|
|
83
|
-
console.warn(
|
|
84
|
-
"[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`"
|
|
88
|
+
`[Upstash Redis] ${messageInfo}. Please add it via \`wrangler secret put ${url ? "UPSTASH_REDIS_REST_TOKEN" : "UPSTASH_REDIS_REST_URL"}\` and provide it as an argument to the \`Redis.fromEnv\` function`
|
|
85
89
|
);
|
|
86
90
|
}
|
|
87
91
|
return new _Redis({ ...opts, url, token }, env);
|
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, l as EvalCommand, k as EvalROCommand, n as EvalshaCommand, m as EvalshaROCommand, o as ExistsCommand, r as ExpireAtCommand, p as ExpireCommand, q as ExpireOption, F as FlushAllCommand, s as FlushDBCommand, G as GeoAddCommand, t as GeoAddCommandOptions, v as GeoDistCommand, w as GeoHashCommand, u as GeoMember, x as GeoPosCommand, y as GeoSearchCommand, z as GeoSearchStoreCommand, J as GetBitCommand, I as GetCommand, K as GetDelCommand, L as GetExCommand, M as GetRangeCommand, N as GetSetCommand, O as HDelCommand, Q as HExistsCommand, T as HExpireAtCommand, S as HExpireCommand, V as HExpireTimeCommand, a1 as HGetAllCommand, a0 as HGetCommand, a2 as HIncrByCommand, a3 as HIncrByFloatCommand, a4 as HKeysCommand, a5 as HLenCommand, a6 as HMGetCommand, a7 as HMSetCommand, Y as HPExpireAtCommand, X as HPExpireCommand, Z as HPExpireTimeCommand, _ as HPTtlCommand, $ as HPersistCommand, a8 as HRandFieldCommand, a9 as HScanCommand, aa as HSetCommand, ab as HSetNXCommand, ac as HStrLenCommand, W as HTtlCommand, ad as HValsCommand, af as IncrByCommand, ag as IncrByFloatCommand, ae as IncrCommand, ah as JsonArrAppendCommand, ai as JsonArrIndexCommand, aj as JsonArrInsertCommand, ak as JsonArrLenCommand, al as JsonArrPopCommand, am as JsonArrTrimCommand, an as JsonClearCommand, ao as JsonDelCommand, ap as JsonForgetCommand, aq as JsonGetCommand, as as JsonMGetCommand, ar as JsonMergeCommand, at as JsonNumIncrByCommand, au as JsonNumMultByCommand, av as JsonObjKeysCommand, aw as JsonObjLenCommand, ax as JsonRespCommand, ay as JsonSetCommand, az as JsonStrAppendCommand, aA as JsonStrLenCommand, aB as JsonToggleCommand, aC as JsonTypeCommand, aD as KeysCommand, aE as LIndexCommand, aF as LInsertCommand, aG as LLenCommand, aH as LMoveCommand, aI as LPopCommand, aJ as LPushCommand, aK as LPushXCommand, aL as LRangeCommand, aM as LRemCommand, aN as LSetCommand, aO as LTrimCommand, aP as MGetCommand, aQ as MSetCommand, aR as MSetNXCommand, aU as PExpireAtCommand, aT as PExpireCommand, aW as PSetEXCommand, aX as PTtlCommand, aS as PersistCommand, aV as PingCommand, P as Pipeline, aY as PublishCommand, b0 as RPopCommand, b1 as RPushCommand, b2 as RPushXCommand, aZ as RandomKeyCommand, a_ as RenameCommand, a$ as RenameNXCommand, c as Requester, b3 as SAddCommand, b6 as SCardCommand, ba as SDiffCommand, bb as SDiffStoreCommand, bi as SInterCommand, bj as SInterStoreCommand, bk as SIsMemberCommand, bm as SMIsMemberCommand, bl as SMembersCommand, bn as SMoveCommand, bo as SPopCommand, bp as SRandMemberCommand, bq as SRemCommand, br as SScanCommand, bt as SUnionCommand, bu as SUnionStoreCommand, b4 as ScanCommand, b5 as ScanCommandOptions, bD as ScoreMember, b7 as ScriptExistsCommand, b8 as ScriptFlushCommand, b9 as ScriptLoadCommand, be as SetBitCommand, bc as SetCommand, bd as SetCommandOptions, bf as SetExCommand, bg as SetNxCommand, bh as SetRangeCommand, bs as StrLenCommand, bv as TimeCommand, bw as TouchCommand, bx as TtlCommand, by as Type, bz as TypeCommand, bA as UnlinkCommand, U as UpstashRequest, d as UpstashResponse, bB as XAddCommand, bC as XRangeCommand, bF as ZAddCommand, bE as ZAddCommandOptions, bG as ZCardCommand, bH as ZCountCommand, bI as ZDiffStoreCommand, bJ as ZIncrByCommand, bK as ZInterStoreCommand, bL as ZInterStoreCommandOptions, bM as ZLexCountCommand, bN as ZMScoreCommand, bO as ZPopMaxCommand, bP as ZPopMinCommand, bQ as ZRangeCommand, bR as ZRangeCommandOptions, bS as ZRankCommand, bT as ZRemCommand, bU as ZRemRangeByLexCommand, bV as ZRemRangeByRankCommand, bW as ZRemRangeByScoreCommand, bX as ZRevRankCommand, bY as ZScanCommand, bZ as ZScoreCommand, b_ as ZUnionCommand, b$ as ZUnionCommandOptions, c0 as ZUnionStoreCommand, c1 as ZUnionStoreCommandOptions, e as errors } from './zmscore-
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-0SAuWM0q.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, l as EvalCommand, k as EvalROCommand, n as EvalshaCommand, m as EvalshaROCommand, o as ExistsCommand, r as ExpireAtCommand, p as ExpireCommand, q as ExpireOption, F as FlushAllCommand, s as FlushDBCommand, G as GeoAddCommand, t as GeoAddCommandOptions, v as GeoDistCommand, w as GeoHashCommand, u as GeoMember, x as GeoPosCommand, y as GeoSearchCommand, z as GeoSearchStoreCommand, J as GetBitCommand, I as GetCommand, K as GetDelCommand, L as GetExCommand, M as GetRangeCommand, N as GetSetCommand, O as HDelCommand, Q as HExistsCommand, T as HExpireAtCommand, S as HExpireCommand, V as HExpireTimeCommand, a1 as HGetAllCommand, a0 as HGetCommand, a2 as HIncrByCommand, a3 as HIncrByFloatCommand, a4 as HKeysCommand, a5 as HLenCommand, a6 as HMGetCommand, a7 as HMSetCommand, Y as HPExpireAtCommand, X as HPExpireCommand, Z as HPExpireTimeCommand, _ as HPTtlCommand, $ as HPersistCommand, a8 as HRandFieldCommand, a9 as HScanCommand, aa as HSetCommand, ab as HSetNXCommand, ac as HStrLenCommand, W as HTtlCommand, ad as HValsCommand, af as IncrByCommand, ag as IncrByFloatCommand, ae as IncrCommand, ah as JsonArrAppendCommand, ai as JsonArrIndexCommand, aj as JsonArrInsertCommand, ak as JsonArrLenCommand, al as JsonArrPopCommand, am as JsonArrTrimCommand, an as JsonClearCommand, ao as JsonDelCommand, ap as JsonForgetCommand, aq as JsonGetCommand, as as JsonMGetCommand, ar as JsonMergeCommand, at as JsonNumIncrByCommand, au as JsonNumMultByCommand, av as JsonObjKeysCommand, aw as JsonObjLenCommand, ax as JsonRespCommand, ay as JsonSetCommand, az as JsonStrAppendCommand, aA as JsonStrLenCommand, aB as JsonToggleCommand, aC as JsonTypeCommand, aD as KeysCommand, aE as LIndexCommand, aF as LInsertCommand, aG as LLenCommand, aH as LMoveCommand, aI as LPopCommand, aJ as LPushCommand, aK as LPushXCommand, aL as LRangeCommand, aM as LRemCommand, aN as LSetCommand, aO as LTrimCommand, aP as MGetCommand, aQ as MSetCommand, aR as MSetNXCommand, aU as PExpireAtCommand, aT as PExpireCommand, aW as PSetEXCommand, aX as PTtlCommand, aS as PersistCommand, aV as PingCommand, P as Pipeline, aY as PublishCommand, b0 as RPopCommand, b1 as RPushCommand, b2 as RPushXCommand, aZ as RandomKeyCommand, a_ as RenameCommand, a$ as RenameNXCommand, c as Requester, b3 as SAddCommand, b6 as SCardCommand, ba as SDiffCommand, bb as SDiffStoreCommand, bi as SInterCommand, bj as SInterStoreCommand, bk as SIsMemberCommand, bm as SMIsMemberCommand, bl as SMembersCommand, bn as SMoveCommand, bo as SPopCommand, bp as SRandMemberCommand, bq as SRemCommand, br as SScanCommand, bt as SUnionCommand, bu as SUnionStoreCommand, b4 as ScanCommand, b5 as ScanCommandOptions, bD as ScoreMember, b7 as ScriptExistsCommand, b8 as ScriptFlushCommand, b9 as ScriptLoadCommand, be as SetBitCommand, bc as SetCommand, bd as SetCommandOptions, bf as SetExCommand, bg as SetNxCommand, bh as SetRangeCommand, bs as StrLenCommand, bv as TimeCommand, bw as TouchCommand, bx as TtlCommand, by as Type, bz as TypeCommand, bA as UnlinkCommand, U as UpstashRequest, d as UpstashResponse, bB as XAddCommand, bC as XRangeCommand, bF as ZAddCommand, bE as ZAddCommandOptions, bG as ZCardCommand, bH as ZCountCommand, bI as ZDiffStoreCommand, bJ as ZIncrByCommand, bK as ZInterStoreCommand, bL as ZInterStoreCommandOptions, bM as ZLexCountCommand, bN as ZMScoreCommand, bO as ZPopMaxCommand, bP as ZPopMinCommand, bQ as ZRangeCommand, bR as ZRangeCommandOptions, bS as ZRankCommand, bT as ZRemCommand, bU as ZRemRangeByLexCommand, bV as ZRemRangeByRankCommand, bW as ZRemRangeByScoreCommand, bX as ZRevRankCommand, bY as ZScanCommand, bZ as ZScoreCommand, b_ as ZUnionCommand, b$ as ZUnionCommandOptions, c0 as ZUnionStoreCommand, c1 as ZUnionStoreCommandOptions, e as errors } from './zmscore-0SAuWM0q.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, l as EvalCommand, k as EvalROCommand, n as EvalshaCommand, m as EvalshaROCommand, o as ExistsCommand, r as ExpireAtCommand, p as ExpireCommand, q as ExpireOption, F as FlushAllCommand, s as FlushDBCommand, G as GeoAddCommand, t as GeoAddCommandOptions, v as GeoDistCommand, w as GeoHashCommand, u as GeoMember, x as GeoPosCommand, y as GeoSearchCommand, z as GeoSearchStoreCommand, J as GetBitCommand, I as GetCommand, K as GetDelCommand, L as GetExCommand, M as GetRangeCommand, N as GetSetCommand, O as HDelCommand, Q as HExistsCommand, T as HExpireAtCommand, S as HExpireCommand, V as HExpireTimeCommand, a1 as HGetAllCommand, a0 as HGetCommand, a2 as HIncrByCommand, a3 as HIncrByFloatCommand, a4 as HKeysCommand, a5 as HLenCommand, a6 as HMGetCommand, a7 as HMSetCommand, Y as HPExpireAtCommand, X as HPExpireCommand, Z as HPExpireTimeCommand, _ as HPTtlCommand, $ as HPersistCommand, a8 as HRandFieldCommand, a9 as HScanCommand, aa as HSetCommand, ab as HSetNXCommand, ac as HStrLenCommand, W as HTtlCommand, ad as HValsCommand, af as IncrByCommand, ag as IncrByFloatCommand, ae as IncrCommand, ah as JsonArrAppendCommand, ai as JsonArrIndexCommand, aj as JsonArrInsertCommand, ak as JsonArrLenCommand, al as JsonArrPopCommand, am as JsonArrTrimCommand, an as JsonClearCommand, ao as JsonDelCommand, ap as JsonForgetCommand, aq as JsonGetCommand, as as JsonMGetCommand, ar as JsonMergeCommand, at as JsonNumIncrByCommand, au as JsonNumMultByCommand, av as JsonObjKeysCommand, aw as JsonObjLenCommand, ax as JsonRespCommand, ay as JsonSetCommand, az as JsonStrAppendCommand, aA as JsonStrLenCommand, aB as JsonToggleCommand, aC as JsonTypeCommand, aD as KeysCommand, aE as LIndexCommand, aF as LInsertCommand, aG as LLenCommand, aH as LMoveCommand, aI as LPopCommand, aJ as LPushCommand, aK as LPushXCommand, aL as LRangeCommand, aM as LRemCommand, aN as LSetCommand, aO as LTrimCommand, aP as MGetCommand, aQ as MSetCommand, aR as MSetNXCommand, aU as PExpireAtCommand, aT as PExpireCommand, aW as PSetEXCommand, aX as PTtlCommand, aS as PersistCommand, aV as PingCommand, P as Pipeline, aY as PublishCommand, b0 as RPopCommand, b1 as RPushCommand, b2 as RPushXCommand, aZ as RandomKeyCommand, a_ as RenameCommand, a$ as RenameNXCommand, c as Requester, b3 as SAddCommand, b6 as SCardCommand, ba as SDiffCommand, bb as SDiffStoreCommand, bi as SInterCommand, bj as SInterStoreCommand, bk as SIsMemberCommand, bm as SMIsMemberCommand, bl as SMembersCommand, bn as SMoveCommand, bo as SPopCommand, bp as SRandMemberCommand, bq as SRemCommand, br as SScanCommand, bt as SUnionCommand, bu as SUnionStoreCommand, b4 as ScanCommand, b5 as ScanCommandOptions, bD as ScoreMember, b7 as ScriptExistsCommand, b8 as ScriptFlushCommand, b9 as ScriptLoadCommand, be as SetBitCommand, bc as SetCommand, bd as SetCommandOptions, bf as SetExCommand, bg as SetNxCommand, bh as SetRangeCommand, bs as StrLenCommand, bv as TimeCommand, bw as TouchCommand, bx as TtlCommand, by as Type, bz as TypeCommand, bA as UnlinkCommand, U as UpstashRequest, d as UpstashResponse, bB as XAddCommand, bC as XRangeCommand, bF as ZAddCommand, bE as ZAddCommandOptions, bG as ZCardCommand, bH as ZCountCommand, bI as ZDiffStoreCommand, bJ as ZIncrByCommand, bK as ZInterStoreCommand, bL as ZInterStoreCommandOptions, bM as ZLexCountCommand, bN as ZMScoreCommand, bO as ZPopMaxCommand, bP as ZPopMinCommand, bQ as ZRangeCommand, bR as ZRangeCommandOptions, bS as ZRankCommand, bT as ZRemCommand, bU as ZRemRangeByLexCommand, bV as ZRemRangeByRankCommand, bW as ZRemRangeByScoreCommand, bX as ZRevRankCommand, bY as ZScanCommand, bZ as ZScoreCommand, b_ as ZUnionCommand, b$ as ZUnionCommandOptions, c0 as ZUnionStoreCommand, c1 as ZUnionStoreCommandOptions, e as errors } from './zmscore-
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './zmscore-0SAuWM0q.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, l as EvalCommand, k as EvalROCommand, n as EvalshaCommand, m as EvalshaROCommand, o as ExistsCommand, r as ExpireAtCommand, p as ExpireCommand, q as ExpireOption, F as FlushAllCommand, s as FlushDBCommand, G as GeoAddCommand, t as GeoAddCommandOptions, v as GeoDistCommand, w as GeoHashCommand, u as GeoMember, x as GeoPosCommand, y as GeoSearchCommand, z as GeoSearchStoreCommand, J as GetBitCommand, I as GetCommand, K as GetDelCommand, L as GetExCommand, M as GetRangeCommand, N as GetSetCommand, O as HDelCommand, Q as HExistsCommand, T as HExpireAtCommand, S as HExpireCommand, V as HExpireTimeCommand, a1 as HGetAllCommand, a0 as HGetCommand, a2 as HIncrByCommand, a3 as HIncrByFloatCommand, a4 as HKeysCommand, a5 as HLenCommand, a6 as HMGetCommand, a7 as HMSetCommand, Y as HPExpireAtCommand, X as HPExpireCommand, Z as HPExpireTimeCommand, _ as HPTtlCommand, $ as HPersistCommand, a8 as HRandFieldCommand, a9 as HScanCommand, aa as HSetCommand, ab as HSetNXCommand, ac as HStrLenCommand, W as HTtlCommand, ad as HValsCommand, af as IncrByCommand, ag as IncrByFloatCommand, ae as IncrCommand, ah as JsonArrAppendCommand, ai as JsonArrIndexCommand, aj as JsonArrInsertCommand, ak as JsonArrLenCommand, al as JsonArrPopCommand, am as JsonArrTrimCommand, an as JsonClearCommand, ao as JsonDelCommand, ap as JsonForgetCommand, aq as JsonGetCommand, as as JsonMGetCommand, ar as JsonMergeCommand, at as JsonNumIncrByCommand, au as JsonNumMultByCommand, av as JsonObjKeysCommand, aw as JsonObjLenCommand, ax as JsonRespCommand, ay as JsonSetCommand, az as JsonStrAppendCommand, aA as JsonStrLenCommand, aB as JsonToggleCommand, aC as JsonTypeCommand, aD as KeysCommand, aE as LIndexCommand, aF as LInsertCommand, aG as LLenCommand, aH as LMoveCommand, aI as LPopCommand, aJ as LPushCommand, aK as LPushXCommand, aL as LRangeCommand, aM as LRemCommand, aN as LSetCommand, aO as LTrimCommand, aP as MGetCommand, aQ as MSetCommand, aR as MSetNXCommand, aU as PExpireAtCommand, aT as PExpireCommand, aW as PSetEXCommand, aX as PTtlCommand, aS as PersistCommand, aV as PingCommand, P as Pipeline, aY as PublishCommand, b0 as RPopCommand, b1 as RPushCommand, b2 as RPushXCommand, aZ as RandomKeyCommand, a_ as RenameCommand, a$ as RenameNXCommand, c as Requester, b3 as SAddCommand, b6 as SCardCommand, ba as SDiffCommand, bb as SDiffStoreCommand, bi as SInterCommand, bj as SInterStoreCommand, bk as SIsMemberCommand, bm as SMIsMemberCommand, bl as SMembersCommand, bn as SMoveCommand, bo as SPopCommand, bp as SRandMemberCommand, bq as SRemCommand, br as SScanCommand, bt as SUnionCommand, bu as SUnionStoreCommand, b4 as ScanCommand, b5 as ScanCommandOptions, bD as ScoreMember, b7 as ScriptExistsCommand, b8 as ScriptFlushCommand, b9 as ScriptLoadCommand, be as SetBitCommand, bc as SetCommand, bd as SetCommandOptions, bf as SetExCommand, bg as SetNxCommand, bh as SetRangeCommand, bs as StrLenCommand, bv as TimeCommand, bw as TouchCommand, bx as TtlCommand, by as Type, bz as TypeCommand, bA as UnlinkCommand, U as UpstashRequest, d as UpstashResponse, bB as XAddCommand, bC as XRangeCommand, bF as ZAddCommand, bE as ZAddCommandOptions, bG as ZCardCommand, bH as ZCountCommand, bI as ZDiffStoreCommand, bJ as ZIncrByCommand, bK as ZInterStoreCommand, bL as ZInterStoreCommandOptions, bM as ZLexCountCommand, bN as ZMScoreCommand, bO as ZPopMaxCommand, bP as ZPopMinCommand, bQ as ZRangeCommand, bR as ZRangeCommandOptions, bS as ZRankCommand, bT as ZRemCommand, bU as ZRemRangeByLexCommand, bV as ZRemRangeByRankCommand, bW as ZRemRangeByScoreCommand, bX as ZRevRankCommand, bY as ZScanCommand, bZ as ZScoreCommand, b_ as ZUnionCommand, b$ as ZUnionCommandOptions, c0 as ZUnionStoreCommand, c1 as ZUnionStoreCommandOptions, e as errors } from './zmscore-0SAuWM0q.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash redis.
|