@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/nodejs.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
- const chunk = decoder.decode(value);
230
- const lines = chunk.split("\n");
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, json) {
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, true);
373
+ if (namespace === "root" && command === "json") {
374
+ return createAutoPipelineProxy(redis2, "json");
360
375
  }
361
- const commandInRedisButNotPipeline = command in redis2 && !(command in redis2.autoPipelineExecutor.pipeline);
362
- const isCommandExcluded = EXCLUDE_COMMANDS.has(command);
363
- if (commandInRedisButNotPipeline || isCommandExcluded) {
364
- return redis2[command];
376
+ if (namespace === "root" && command === "functions") {
377
+ return createAutoPipelineProxy(redis2, "functions");
365
378
  }
366
- const isFunction = json ? typeof redis2.autoPipelineExecutor.pipeline.json[command] === "function" : typeof redis2.autoPipelineExecutor.pipeline[command] === "function";
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
+ }
385
+ }
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((pipeline) => {
370
- if (json) {
371
- pipeline.json[command](
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 redis2.autoPipelineExecutor.pipeline[command];
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 deserialize(result) {
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) => 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 deserialize2(fields, result) {
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) => deserialize2(fields, 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 deserialize3(result) {
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) => deserialize3(result) : opts?.deserialize,
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 deserialize4(result) {
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) => deserialize4(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) => deserialize5(result),
2329
+ deserialize: (result) => deserialize7(result),
2217
2330
  ...opts
2218
2331
  });
2219
2332
  }
2220
2333
  };
2221
- function deserialize5(result) {
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
  */
@@ -4589,18 +4768,20 @@ var Redis2 = class _Redis extends Redis {
4589
4768
  keepAlive: configOrRequester.keepAlive,
4590
4769
  readYourWrites: configOrRequester.readYourWrites
4591
4770
  });
4771
+ const safeEnv = typeof process === "object" && process && typeof process.env === "object" && process.env ? process.env : {};
4592
4772
  super(client, {
4593
4773
  automaticDeserialization: configOrRequester.automaticDeserialization,
4594
- enableTelemetry: configOrRequester.enableTelemetry ?? !process.env.UPSTASH_DISABLE_TELEMETRY,
4774
+ enableTelemetry: configOrRequester.enableTelemetry ?? !safeEnv.UPSTASH_DISABLE_TELEMETRY,
4595
4775
  latencyLogging: configOrRequester.latencyLogging,
4596
4776
  enableAutoPipelining: configOrRequester.enableAutoPipelining
4597
4777
  });
4778
+ const nodeVersion = typeof process === "object" && process ? process.version : void 0;
4598
4779
  this.addTelemetry({
4599
4780
  runtime: (
4600
4781
  // @ts-expect-error to silence compiler
4601
- typeof EdgeRuntime === "string" ? "edge-light" : `node@${process.version}`
4782
+ typeof EdgeRuntime === "string" ? "edge-light" : nodeVersion ? `node@${nodeVersion}` : "unknown"
4602
4783
  ),
4603
- platform: process.env.UPSTASH_CONSOLE ? "console" : process.env.VERCEL ? "vercel" : process.env.AWS_REGION ? "aws" : "unknown",
4784
+ platform: safeEnv.UPSTASH_CONSOLE ? "console" : safeEnv.VERCEL ? "vercel" : safeEnv.AWS_REGION ? "aws" : "unknown",
4604
4785
  sdk: `@upstash/redis@${VERSION}`
4605
4786
  });
4606
4787
  if (this.enableAutoPipelining) {
@@ -4621,7 +4802,7 @@ var Redis2 = class _Redis extends Redis {
4621
4802
  * that may use different naming conventions.
4622
4803
  */
4623
4804
  static fromEnv(config) {
4624
- if (process.env === void 0) {
4805
+ if (typeof process !== "object" || !process || typeof process.env !== "object" || !process.env) {
4625
4806
  throw new TypeError(
4626
4807
  '[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
4627
4808
  );
package/nodejs.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-WTYE7OV3.mjs";
6
+ } from "./chunk-SGAAV5RA.mjs";
7
7
 
8
8
  // platforms/nodejs.ts
9
9
  if (typeof atob === "undefined") {
@@ -61,18 +61,20 @@ var Redis2 = class _Redis extends Redis {
61
61
  keepAlive: configOrRequester.keepAlive,
62
62
  readYourWrites: configOrRequester.readYourWrites
63
63
  });
64
+ const safeEnv = typeof process === "object" && process && typeof process.env === "object" && process.env ? process.env : {};
64
65
  super(client, {
65
66
  automaticDeserialization: configOrRequester.automaticDeserialization,
66
- enableTelemetry: configOrRequester.enableTelemetry ?? !process.env.UPSTASH_DISABLE_TELEMETRY,
67
+ enableTelemetry: configOrRequester.enableTelemetry ?? !safeEnv.UPSTASH_DISABLE_TELEMETRY,
67
68
  latencyLogging: configOrRequester.latencyLogging,
68
69
  enableAutoPipelining: configOrRequester.enableAutoPipelining
69
70
  });
71
+ const nodeVersion = typeof process === "object" && process ? process.version : void 0;
70
72
  this.addTelemetry({
71
73
  runtime: (
72
74
  // @ts-expect-error to silence compiler
73
- typeof EdgeRuntime === "string" ? "edge-light" : `node@${process.version}`
75
+ typeof EdgeRuntime === "string" ? "edge-light" : nodeVersion ? `node@${nodeVersion}` : "unknown"
74
76
  ),
75
- platform: process.env.UPSTASH_CONSOLE ? "console" : process.env.VERCEL ? "vercel" : process.env.AWS_REGION ? "aws" : "unknown",
77
+ platform: safeEnv.UPSTASH_CONSOLE ? "console" : safeEnv.VERCEL ? "vercel" : safeEnv.AWS_REGION ? "aws" : "unknown",
76
78
  sdk: `@upstash/redis@${VERSION}`
77
79
  });
78
80
  if (this.enableAutoPipelining) {
@@ -93,7 +95,7 @@ var Redis2 = class _Redis extends Redis {
93
95
  * that may use different naming conventions.
94
96
  */
95
97
  static fromEnv(config) {
96
- if (process.env === void 0) {
98
+ if (typeof process !== "object" || !process || typeof process.env !== "object" || !process.env) {
97
99
  throw new TypeError(
98
100
  '[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
99
101
  );
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/redis","version":"v0.0.0-ci.f6da5d747c9564bc95fccdbfe16a9aa10cd30367-20251125191507","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","@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":{"uncrypto":"^0.1.3"}}
1
+ {"name":"@upstash/redis","version":"v0.0.0-ci.f725f60c40a2b7f0e25dd9bf83a931c24624cdf6-20260123181037","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","@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":{"uncrypto":"^0.1.3"}}
@@ -317,6 +317,40 @@ declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
317
317
  constructor(cmd: [key: string, seconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
318
318
  }
319
319
 
320
+ type FunctionListArgs = {
321
+ /**
322
+ * Pattern for matching library names. Supports glob patterns.
323
+ *
324
+ * Example: "my_library_*"
325
+ */
326
+ libraryName?: string;
327
+ /**
328
+ * Includes the library source code in the response.
329
+ *
330
+ * @default false
331
+ */
332
+ withCode?: boolean;
333
+ };
334
+
335
+ type FunctionLoadArgs = {
336
+ /**
337
+ * The Lua code to load.
338
+ *
339
+ * Example:
340
+ * ```lua
341
+ * #!lua name=mylib
342
+ * redis.register_function('myfunc', function() return 'ok' end)
343
+ * ```
344
+ */
345
+ code: string;
346
+ /**
347
+ * If true, the library will replace the existing library with the same name.
348
+ *
349
+ * @default false
350
+ */
351
+ replace?: boolean;
352
+ };
353
+
320
354
  /**
321
355
  * @see https://redis.io/commands/append
322
356
  */
@@ -1793,7 +1827,11 @@ declare class ZRemRangeByRankCommand extends Command<number, number> {
1793
1827
  * @see https://redis.io/commands/zremrangebyscore
1794
1828
  */
1795
1829
  declare class ZRemRangeByScoreCommand extends Command<number, number> {
1796
- constructor(cmd: [key: string, min: number, max: number], opts?: CommandOptions<number, number>);
1830
+ constructor(cmd: [
1831
+ key: string,
1832
+ min: number | `(${number}` | "-inf" | "+inf",
1833
+ max: number | `(${number}` | "-inf" | "+inf"
1834
+ ], opts?: CommandOptions<number, number>);
1797
1835
  }
1798
1836
 
1799
1837
  /**
@@ -2760,7 +2798,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2760
2798
  /**
2761
2799
  * @see https://redis.io/commands/zremrangebyscore
2762
2800
  */
2763
- zremrangebyscore: (key: string, min: number, max: number) => Pipeline<[...TCommands, Command<any, number>]>;
2801
+ zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Pipeline<[...TCommands, Command<any, number>]>;
2764
2802
  /**
2765
2803
  * @see https://redis.io/commands/zrevrank
2766
2804
  */
@@ -2884,6 +2922,52 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2884
2922
  */
2885
2923
  type: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, string[]>]>;
2886
2924
  };
2925
+ get functions(): {
2926
+ /**
2927
+ * @see https://redis.io/docs/latest/commands/function-load/
2928
+ */
2929
+ load: (args: FunctionLoadArgs) => Pipeline<[...TCommands, Command<any, string>]>;
2930
+ /**
2931
+ * @see https://redis.io/docs/latest/commands/function-list/
2932
+ */
2933
+ list: (args?: FunctionListArgs | undefined) => Pipeline<[...TCommands, Command<any, {
2934
+ libraryName: string;
2935
+ engine: string;
2936
+ functions: {
2937
+ name: string;
2938
+ description?: string;
2939
+ flags: string[];
2940
+ }[];
2941
+ libraryCode?: string;
2942
+ }[]>]>;
2943
+ /**
2944
+ * @see https://redis.io/docs/latest/commands/function-delete/
2945
+ */
2946
+ delete: (libraryName: string) => Pipeline<[...TCommands, Command<any, "OK">]>;
2947
+ /**
2948
+ * @see https://redis.io/docs/latest/commands/function-flush/
2949
+ */
2950
+ flush: () => Pipeline<[...TCommands, Command<any, "OK">]>;
2951
+ /**
2952
+ * @see https://redis.io/docs/latest/commands/function-stats/
2953
+ */
2954
+ stats: () => Pipeline<[...TCommands, Command<any, {
2955
+ engines: {
2956
+ [k: string]: {
2957
+ librariesCount: unknown;
2958
+ functionsCount: unknown;
2959
+ };
2960
+ };
2961
+ }>]>;
2962
+ /**
2963
+ * @see https://redis.io/docs/latest/commands/fcall/
2964
+ */
2965
+ call: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
2966
+ /**
2967
+ * @see https://redis.io/docs/latest/commands/fcall_ro/
2968
+ */
2969
+ callRo: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
2970
+ };
2887
2971
  }
2888
2972
 
2889
2973
  /**
@@ -3111,6 +3195,54 @@ declare class Redis {
3111
3195
  */
3112
3196
  type: (key: string, path?: string | undefined) => Promise<string[]>;
3113
3197
  };
3198
+ get functions(): {
3199
+ /**
3200
+ * @see https://redis.io/docs/latest/commands/function-load/
3201
+ */
3202
+ load: (args: FunctionLoadArgs) => Promise<string>;
3203
+ /**
3204
+ * @see https://redis.io/docs/latest/commands/function-list/
3205
+ */
3206
+ list: (args?: FunctionListArgs | undefined) => Promise<{
3207
+ libraryName: string;
3208
+ engine: string;
3209
+ functions: {
3210
+ name: string;
3211
+ description?: string;
3212
+ flags: string[];
3213
+ }[];
3214
+ libraryCode?: string;
3215
+ }[]>;
3216
+ /**
3217
+ * @see https://redis.io/docs/latest/commands/function-delete/
3218
+ */
3219
+ delete: (libraryName: string) => Promise<"OK">;
3220
+ /**
3221
+ * @see https://redis.io/docs/latest/commands/function-flush/
3222
+ */
3223
+ flush: () => Promise<"OK">;
3224
+ /**
3225
+ * @see https://redis.io/docs/latest/commands/function-stats/
3226
+ *
3227
+ * Note: `running_script` field is not supported and therefore not included in the type.
3228
+ */
3229
+ stats: () => Promise<{
3230
+ engines: {
3231
+ [k: string]: {
3232
+ librariesCount: unknown;
3233
+ functionsCount: unknown;
3234
+ };
3235
+ };
3236
+ }>;
3237
+ /**
3238
+ * @see https://redis.io/docs/latest/commands/fcall/
3239
+ */
3240
+ call: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise<TData>;
3241
+ /**
3242
+ * @see https://redis.io/docs/latest/commands/fcall_ro/
3243
+ */
3244
+ callRo: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise<TData>;
3245
+ };
3114
3246
  /**
3115
3247
  * Wrap a new middleware around the HTTP client.
3116
3248
  */
@@ -3994,7 +4126,7 @@ declare class Redis {
3994
4126
  /**
3995
4127
  * @see https://redis.io/commands/zremrangebyscore
3996
4128
  */
3997
- zremrangebyscore: (key: string, min: number, max: number) => Promise<number>;
4129
+ zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Promise<number>;
3998
4130
  /**
3999
4131
  * @see https://redis.io/commands/zrevrank
4000
4132
  */