@upstash/redis 1.37.0-rc.6 → 1.37.0-rc.7

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.
@@ -77,8 +77,18 @@ function mergeHeaders(...headers) {
77
77
  }
78
78
  return merged;
79
79
  }
80
+ function kvArrayToObject(v) {
81
+ if (typeof v === "object" && v !== null && !Array.isArray(v)) return v;
82
+ if (!Array.isArray(v)) return {};
83
+ const obj = {};
84
+ for (let i = 0; i < v.length; i += 2) {
85
+ if (typeof v[i] === "string") obj[v[i]] = v[i + 1];
86
+ }
87
+ return obj;
88
+ }
80
89
 
81
90
  // pkg/http.ts
91
+ var MAX_BUFFER_SIZE = 1024 * 1024;
82
92
  var HttpClient = class {
83
93
  baseUrl;
84
94
  headers;
@@ -202,11 +212,16 @@ var HttpClient = class {
202
212
  const decoder = new TextDecoder();
203
213
  (async () => {
204
214
  try {
215
+ let buffer = "";
205
216
  while (true) {
206
217
  const { value, done } = await reader.read();
207
218
  if (done) break;
208
- const chunk = decoder.decode(value);
209
- const lines = chunk.split("\n");
219
+ buffer += decoder.decode(value, { stream: true });
220
+ const lines = buffer.split("\n");
221
+ buffer = lines.pop() || "";
222
+ if (buffer.length > MAX_BUFFER_SIZE) {
223
+ throw new Error("Buffer size exceeded (1MB)");
224
+ }
210
225
  for (const line of lines) {
211
226
  if (line.startsWith("data: ")) {
212
227
  const data = line.slice(6);
@@ -519,6 +534,69 @@ function deserializeDescribeResponse(rawResponse) {
519
534
  function parseCountResponse(rawResponse) {
520
535
  return typeof rawResponse === "number" ? rawResponse : Number.parseInt(rawResponse, 10);
521
536
  }
537
+ function deserializeAggregateResponse(rawResponse, hasLimit) {
538
+ if (hasLimit && rawResponse.length === 2 && Array.isArray(rawResponse[0]) && Array.isArray(rawResponse[1])) {
539
+ const aggregationResult = parseAggregationArray(rawResponse[0]);
540
+ const searchResults = deserializeQueryResponse(rawResponse[1]);
541
+ return [aggregationResult, searchResults];
542
+ }
543
+ if (Array.isArray(rawResponse) && rawResponse.length === 1 && Array.isArray(rawResponse[0])) {
544
+ return parseAggregationArray(rawResponse[0]);
545
+ }
546
+ return rawResponse;
547
+ }
548
+ function parseAggregationArray(arr) {
549
+ const result = {};
550
+ for (let i = 0; i < arr.length; i += 2) {
551
+ const key = arr[i];
552
+ const value = arr[i + 1];
553
+ if (Array.isArray(value)) {
554
+ if (value.length > 0 && typeof value[0] === "string") {
555
+ result[key] = value[0] === "buckets" ? parseBucketsValue(value) : parseStatsValue(value);
556
+ } else {
557
+ result[key] = parseAggregationArray(value);
558
+ }
559
+ } else {
560
+ result[key] = value;
561
+ }
562
+ }
563
+ return result;
564
+ }
565
+ function parseStatsValue(arr) {
566
+ const result = {};
567
+ for (let i = 0; i < arr.length; i += 2) {
568
+ const key = arr[i];
569
+ const value = arr[i + 1];
570
+ if (Array.isArray(value) && value.length > 0) {
571
+ if (typeof value[0] === "string") {
572
+ result[key] = parseStatsValue(value);
573
+ } else if (Array.isArray(value[0]) && typeof value[0][0] === "string") {
574
+ result[key] = value.map((item) => parseStatsValue(item));
575
+ } else {
576
+ result[key] = value;
577
+ }
578
+ } else {
579
+ result[key] = value;
580
+ }
581
+ }
582
+ return result;
583
+ }
584
+ function parseBucketsValue(arr) {
585
+ if (arr[0] === "buckets" && Array.isArray(arr[1])) {
586
+ return {
587
+ buckets: arr[1].map((bucket) => {
588
+ const bucketObj = {};
589
+ for (let i = 0; i < bucket.length; i += 2) {
590
+ const key = bucket[i];
591
+ const value = bucket[i + 1];
592
+ bucketObj[key] = Array.isArray(value) && value.length > 0 && typeof value[0] === "string" ? parseStatsValue(value) : value;
593
+ }
594
+ return bucketObj;
595
+ })
596
+ };
597
+ }
598
+ return arr;
599
+ }
522
600
 
523
601
  // pkg/commands/search/command-builder.ts
524
602
  function buildQueryCommand(redisCommand, name, options) {
@@ -636,6 +714,15 @@ function buildCreateIndexCommand(params) {
636
714
  }
637
715
  return ["SEARCH.CREATE", ...payload];
638
716
  }
717
+ function buildAggregateCommand(name, options) {
718
+ const query = JSON.stringify(options?.filter ?? {});
719
+ const aggregations = JSON.stringify(options.aggregations);
720
+ const command = ["SEARCH.AGGREGATE", name, query, aggregations];
721
+ if (options?.limit !== void 0) {
722
+ command.push("LIMIT", options.limit.toString());
723
+ }
724
+ return command;
725
+ }
639
726
 
640
727
  // pkg/commands/search/search.ts
641
728
  var SearchIndex = class {
@@ -665,6 +752,13 @@ var SearchIndex = class {
665
752
  );
666
753
  return deserializeQueryResponse(rawResult);
667
754
  }
755
+ async aggregate(options) {
756
+ const command = buildAggregateCommand(this.name, options);
757
+ const rawResult = await new ExecCommand(
758
+ command
759
+ ).exec(this.client);
760
+ return deserializeAggregateResponse(rawResult, Boolean(options.limit));
761
+ }
668
762
  async count({ filter }) {
669
763
  const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
670
764
  const rawResult = await new ExecCommand(command).exec(
@@ -677,6 +771,11 @@ var SearchIndex = class {
677
771
  const result = await new ExecCommand(command).exec(this.client);
678
772
  return result;
679
773
  }
774
+ async addAlias({ alias }) {
775
+ const command = ["SEARCH.ALIASADD", alias, this.name];
776
+ const result = await new ExecCommand(command).exec(this.client);
777
+ return result;
778
+ }
680
779
  };
681
780
  async function createIndex(client, params) {
682
781
  const { name, schema } = params;
@@ -688,6 +787,34 @@ function initIndex(client, params) {
688
787
  const { name, schema } = params;
689
788
  return new SearchIndex({ name, schema, client });
690
789
  }
790
+ async function listAliases(client) {
791
+ const command = ["SEARCH.LISTALIASES"];
792
+ const rawResult = await new ExecCommand(command).exec(client);
793
+ if (rawResult === 0 || Array.isArray(rawResult) && rawResult.length === 0) {
794
+ return {};
795
+ }
796
+ if (!Array.isArray(rawResult)) {
797
+ return {};
798
+ }
799
+ const aliases = {};
800
+ for (const pair of rawResult) {
801
+ if (Array.isArray(pair) && pair.length === 2) {
802
+ const [alias, index] = pair;
803
+ aliases[alias] = index;
804
+ }
805
+ }
806
+ return aliases;
807
+ }
808
+ async function addAlias(client, { indexName, alias }) {
809
+ const command = ["SEARCH.ALIASADD", alias, indexName];
810
+ const result = await new ExecCommand(command).exec(client);
811
+ return result;
812
+ }
813
+ async function delAlias(client, { alias }) {
814
+ const command = ["SEARCH.ALIASDEL", alias];
815
+ const result = await new ExecCommand(command).exec(client);
816
+ return result;
817
+ }
691
818
 
692
819
  // pkg/commands/hrandfield.ts
693
820
  function deserialize(result) {
@@ -789,6 +916,13 @@ var BitPosCommand = class extends Command {
789
916
  }
790
917
  };
791
918
 
919
+ // pkg/commands/client_setinfo.ts
920
+ var ClientSetInfoCommand = class extends Command {
921
+ constructor([attribute, value], opts) {
922
+ super(["CLIENT", "SETINFO", attribute.toUpperCase(), value], opts);
923
+ }
924
+ };
925
+
792
926
  // pkg/commands/copy.ts
793
927
  var CopyCommand = class extends Command {
794
928
  constructor([key, destinationKey, opts], commandOptions) {
@@ -888,6 +1022,23 @@ var ExpireAtCommand = class extends Command {
888
1022
  }
889
1023
  };
890
1024
 
1025
+ // pkg/commands/fcall.ts
1026
+ var FCallCommand = class extends Command {
1027
+ constructor([functionName, keys, args], opts) {
1028
+ super(["fcall", functionName, ...keys ? [keys.length, ...keys] : [0], ...args ?? []], opts);
1029
+ }
1030
+ };
1031
+
1032
+ // pkg/commands/fcall_ro.ts
1033
+ var FCallRoCommand = class extends Command {
1034
+ constructor([functionName, keys, args], opts) {
1035
+ super(
1036
+ ["fcall_ro", functionName, ...keys ? [keys.length, ...keys] : [0], ...args ?? []],
1037
+ opts
1038
+ );
1039
+ }
1040
+ };
1041
+
891
1042
  // pkg/commands/flushall.ts
892
1043
  var FlushAllCommand = class extends Command {
893
1044
  constructor(args, opts) {
@@ -910,6 +1061,85 @@ var FlushDBCommand = class extends Command {
910
1061
  }
911
1062
  };
912
1063
 
1064
+ // pkg/commands/function_delete.ts
1065
+ var FunctionDeleteCommand = class extends Command {
1066
+ constructor([libraryName], opts) {
1067
+ super(["function", "delete", libraryName], opts);
1068
+ }
1069
+ };
1070
+
1071
+ // pkg/commands/function_flush.ts
1072
+ var FunctionFlushCommand = class extends Command {
1073
+ constructor(opts) {
1074
+ super(["function", "flush"], opts);
1075
+ }
1076
+ };
1077
+
1078
+ // pkg/commands/function_list.ts
1079
+ var FunctionListCommand = class extends Command {
1080
+ constructor([args], opts) {
1081
+ const command = ["function", "list"];
1082
+ if (args?.libraryName) {
1083
+ command.push("libraryname", args.libraryName);
1084
+ }
1085
+ if (args?.withCode) {
1086
+ command.push("withcode");
1087
+ }
1088
+ super(command, { deserialize: deserialize2, ...opts });
1089
+ }
1090
+ };
1091
+ function deserialize2(result) {
1092
+ if (!Array.isArray(result)) return [];
1093
+ return result.map((libRaw) => {
1094
+ const lib = kvArrayToObject(libRaw);
1095
+ const functionsParsed = lib.functions.map(
1096
+ (fnRaw) => kvArrayToObject(fnRaw)
1097
+ );
1098
+ return {
1099
+ libraryName: lib.library_name,
1100
+ engine: lib.engine,
1101
+ functions: functionsParsed.map((fn) => ({
1102
+ name: fn.name,
1103
+ description: fn.description ?? void 0,
1104
+ flags: fn.flags
1105
+ })),
1106
+ libraryCode: lib.library_code
1107
+ };
1108
+ });
1109
+ }
1110
+
1111
+ // pkg/commands/function_load.ts
1112
+ var FunctionLoadCommand = class extends Command {
1113
+ constructor([args], opts) {
1114
+ super(["function", "load", ...args.replace ? ["replace"] : [], args.code], opts);
1115
+ }
1116
+ };
1117
+
1118
+ // pkg/commands/function_stats.ts
1119
+ var FunctionStatsCommand = class extends Command {
1120
+ constructor(opts) {
1121
+ super(["function", "stats"], { deserialize: deserialize3, ...opts });
1122
+ }
1123
+ };
1124
+ function deserialize3(result) {
1125
+ const rawEngines = kvArrayToObject(kvArrayToObject(result).engines);
1126
+ const parsedEngines = Object.fromEntries(
1127
+ Object.entries(rawEngines).map(([key, value]) => [key, kvArrayToObject(value)])
1128
+ );
1129
+ const final = {
1130
+ engines: Object.fromEntries(
1131
+ Object.entries(parsedEngines).map(([key, value]) => [
1132
+ key,
1133
+ {
1134
+ librariesCount: value.libraries_count,
1135
+ functionsCount: value.functions_count
1136
+ }
1137
+ ])
1138
+ )
1139
+ };
1140
+ return final;
1141
+ }
1142
+
913
1143
  // pkg/commands/geo_add.ts
914
1144
  var GeoAddCommand = class extends Command {
915
1145
  constructor([key, arg1, ...arg2], opts) {
@@ -1256,7 +1486,7 @@ var HGetCommand = class extends Command {
1256
1486
  };
1257
1487
 
1258
1488
  // pkg/commands/hgetall.ts
1259
- function deserialize2(result) {
1489
+ function deserialize4(result) {
1260
1490
  if (result.length === 0) {
1261
1491
  return null;
1262
1492
  }
@@ -1276,12 +1506,69 @@ function deserialize2(result) {
1276
1506
  var HGetAllCommand = class extends Command {
1277
1507
  constructor(cmd, opts) {
1278
1508
  super(["hgetall", ...cmd], {
1279
- deserialize: (result) => deserialize2(result),
1509
+ deserialize: (result) => deserialize4(result),
1510
+ ...opts
1511
+ });
1512
+ }
1513
+ };
1514
+
1515
+ // pkg/commands/hmget.ts
1516
+ function deserialize5(fields, result) {
1517
+ if (result.every((field) => field === null)) {
1518
+ return null;
1519
+ }
1520
+ const obj = {};
1521
+ for (const [i, field] of fields.entries()) {
1522
+ try {
1523
+ obj[field] = JSON.parse(result[i]);
1524
+ } catch {
1525
+ obj[field] = result[i];
1526
+ }
1527
+ }
1528
+ return obj;
1529
+ }
1530
+ var HMGetCommand = class extends Command {
1531
+ constructor([key, ...fields], opts) {
1532
+ super(["hmget", key, ...fields], {
1533
+ deserialize: (result) => deserialize5(fields, result),
1534
+ ...opts
1535
+ });
1536
+ }
1537
+ };
1538
+
1539
+ // pkg/commands/hgetdel.ts
1540
+ var HGetDelCommand = class extends Command {
1541
+ constructor([key, ...fields], opts) {
1542
+ super(["hgetdel", key, "FIELDS", fields.length, ...fields], {
1543
+ deserialize: (result) => deserialize5(fields.map(String), result),
1280
1544
  ...opts
1281
1545
  });
1282
1546
  }
1283
1547
  };
1284
1548
 
1549
+ // pkg/commands/hgetex.ts
1550
+ var HGetExCommand = class extends Command {
1551
+ constructor([key, opts, ...fields], cmdOpts) {
1552
+ const command = ["hgetex", key];
1553
+ if ("ex" in opts && typeof opts.ex === "number") {
1554
+ command.push("EX", opts.ex);
1555
+ } else if ("px" in opts && typeof opts.px === "number") {
1556
+ command.push("PX", opts.px);
1557
+ } else if ("exat" in opts && typeof opts.exat === "number") {
1558
+ command.push("EXAT", opts.exat);
1559
+ } else if ("pxat" in opts && typeof opts.pxat === "number") {
1560
+ command.push("PXAT", opts.pxat);
1561
+ } else if ("persist" in opts && opts.persist) {
1562
+ command.push("PERSIST");
1563
+ }
1564
+ command.push("FIELDS", fields.length, ...fields);
1565
+ super(command, {
1566
+ deserialize: (result) => deserialize5(fields.map(String), result),
1567
+ ...cmdOpts
1568
+ });
1569
+ }
1570
+ };
1571
+
1285
1572
  // pkg/commands/hincrby.ts
1286
1573
  var HIncrByCommand = class extends Command {
1287
1574
  constructor(cmd, opts) {
@@ -1310,30 +1597,6 @@ var HLenCommand = class extends Command {
1310
1597
  }
1311
1598
  };
1312
1599
 
1313
- // pkg/commands/hmget.ts
1314
- function deserialize3(fields, result) {
1315
- if (result.every((field) => field === null)) {
1316
- return null;
1317
- }
1318
- const obj = {};
1319
- for (const [i, field] of fields.entries()) {
1320
- try {
1321
- obj[field] = JSON.parse(result[i]);
1322
- } catch {
1323
- obj[field] = result[i];
1324
- }
1325
- }
1326
- return obj;
1327
- }
1328
- var HMGetCommand = class extends Command {
1329
- constructor([key, ...fields], opts) {
1330
- super(["hmget", key, ...fields], {
1331
- deserialize: (result) => deserialize3(fields, result),
1332
- ...opts
1333
- });
1334
- }
1335
- };
1336
-
1337
1600
  // pkg/commands/hmset.ts
1338
1601
  var HMSetCommand = class extends Command {
1339
1602
  constructor([key, kv], opts) {
@@ -1365,6 +1628,35 @@ var HSetCommand = class extends Command {
1365
1628
  }
1366
1629
  };
1367
1630
 
1631
+ // pkg/commands/hsetex.ts
1632
+ var HSetExCommand = class extends Command {
1633
+ constructor([key, opts, kv], cmdOpts) {
1634
+ const command = ["hsetex", key];
1635
+ if (opts.conditional) {
1636
+ command.push(opts.conditional.toUpperCase());
1637
+ }
1638
+ if (opts.expiration) {
1639
+ if ("ex" in opts.expiration && typeof opts.expiration.ex === "number") {
1640
+ command.push("EX", opts.expiration.ex);
1641
+ } else if ("px" in opts.expiration && typeof opts.expiration.px === "number") {
1642
+ command.push("PX", opts.expiration.px);
1643
+ } else if ("exat" in opts.expiration && typeof opts.expiration.exat === "number") {
1644
+ command.push("EXAT", opts.expiration.exat);
1645
+ } else if ("pxat" in opts.expiration && typeof opts.expiration.pxat === "number") {
1646
+ command.push("PXAT", opts.expiration.pxat);
1647
+ } else if ("keepttl" in opts.expiration && opts.expiration.keepttl) {
1648
+ command.push("KEEPTTL");
1649
+ }
1650
+ }
1651
+ const entries = Object.entries(kv);
1652
+ command.push("FIELDS", entries.length);
1653
+ for (const [field, value] of entries) {
1654
+ command.push(field, value);
1655
+ }
1656
+ super(command, cmdOpts);
1657
+ }
1658
+ };
1659
+
1368
1660
  // pkg/commands/hsetnx.ts
1369
1661
  var HSetNXCommand = class extends Command {
1370
1662
  constructor(cmd, opts) {
@@ -2148,6 +2440,16 @@ var XAckCommand = class extends Command {
2148
2440
  }
2149
2441
  };
2150
2442
 
2443
+ // pkg/commands/xackdel.ts
2444
+ var XAckDelCommand = class extends Command {
2445
+ constructor([key, group, opts, ...ids], cmdOpts) {
2446
+ const command = ["XACKDEL", key, group];
2447
+ command.push(opts.toUpperCase());
2448
+ command.push("IDS", ids.length, ...ids);
2449
+ super(command, cmdOpts);
2450
+ }
2451
+ };
2452
+
2151
2453
  // pkg/commands/xadd.ts
2152
2454
  var XAddCommand = class extends Command {
2153
2455
  constructor([key, id, entries, opts], commandOptions) {
@@ -2220,6 +2522,18 @@ var XDelCommand = class extends Command {
2220
2522
  }
2221
2523
  };
2222
2524
 
2525
+ // pkg/commands/xdelex.ts
2526
+ var XDelExCommand = class extends Command {
2527
+ constructor([key, opts, ...ids], cmdOpts) {
2528
+ const command = ["XDELEX", key];
2529
+ if (opts) {
2530
+ command.push(opts.toUpperCase());
2531
+ }
2532
+ command.push("IDS", ids.length, ...ids);
2533
+ super(command, cmdOpts);
2534
+ }
2535
+ };
2536
+
2223
2537
  // pkg/commands/xgroup.ts
2224
2538
  var XGroupCommand = class extends Command {
2225
2539
  constructor([key, opts], commandOptions) {
@@ -2305,7 +2619,7 @@ var XPendingCommand = class extends Command {
2305
2619
  };
2306
2620
 
2307
2621
  // pkg/commands/xrange.ts
2308
- function deserialize4(result) {
2622
+ function deserialize6(result) {
2309
2623
  const obj = {};
2310
2624
  for (const e of result) {
2311
2625
  for (let i = 0; i < e.length; i += 2) {
@@ -2334,7 +2648,7 @@ var XRangeCommand = class extends Command {
2334
2648
  command.push("COUNT", count);
2335
2649
  }
2336
2650
  super(command, {
2337
- deserialize: (result) => deserialize4(result),
2651
+ deserialize: (result) => deserialize6(result),
2338
2652
  ...opts
2339
2653
  });
2340
2654
  }
@@ -2397,12 +2711,12 @@ var XRevRangeCommand = class extends Command {
2397
2711
  command.push("COUNT", count);
2398
2712
  }
2399
2713
  super(command, {
2400
- deserialize: (result) => deserialize5(result),
2714
+ deserialize: (result) => deserialize7(result),
2401
2715
  ...opts
2402
2716
  });
2403
2717
  }
2404
2718
  };
2405
- function deserialize5(result) {
2719
+ function deserialize7(result) {
2406
2720
  const obj = {};
2407
2721
  for (const e of result) {
2408
2722
  for (let i = 0; i < e.length; i += 2) {
@@ -2784,6 +3098,10 @@ var Pipeline = class {
2784
3098
  * @see https://redis.io/commands/bitpos
2785
3099
  */
2786
3100
  bitpos = (...args) => this.chain(new BitPosCommand(args, this.commandOptions));
3101
+ /**
3102
+ * @see https://redis.io/commands/client-setinfo
3103
+ */
3104
+ clientSetinfo = (...args) => this.chain(new ClientSetInfoCommand(args, this.commandOptions));
2787
3105
  /**
2788
3106
  * @see https://redis.io/commands/copy
2789
3107
  */
@@ -2948,6 +3266,14 @@ var Pipeline = class {
2948
3266
  * @see https://redis.io/commands/hgetall
2949
3267
  */
2950
3268
  hgetall = (...args) => this.chain(new HGetAllCommand(args, this.commandOptions));
3269
+ /**
3270
+ * @see https://redis.io/commands/hgetdel
3271
+ */
3272
+ hgetdel = (...args) => this.chain(new HGetDelCommand(args, this.commandOptions));
3273
+ /**
3274
+ * @see https://redis.io/commands/hgetex
3275
+ */
3276
+ hgetex = (...args) => this.chain(new HGetExCommand(args, this.commandOptions));
2951
3277
  /**
2952
3278
  * @see https://redis.io/commands/hincrby
2953
3279
  */
@@ -2984,6 +3310,10 @@ var Pipeline = class {
2984
3310
  * @see https://redis.io/commands/hset
2985
3311
  */
2986
3312
  hset = (key, kv) => this.chain(new HSetCommand([key, kv], this.commandOptions));
3313
+ /**
3314
+ * @see https://redis.io/commands/hsetex
3315
+ */
3316
+ hsetex = (...args) => this.chain(new HSetExCommand(args, this.commandOptions));
2987
3317
  /**
2988
3318
  * @see https://redis.io/commands/hsetnx
2989
3319
  */
@@ -3288,10 +3618,18 @@ var Pipeline = class {
3288
3618
  * @see https://redis.io/commands/xack
3289
3619
  */
3290
3620
  xack = (...args) => this.chain(new XAckCommand(args, this.commandOptions));
3621
+ /**
3622
+ * @see https://redis.io/commands/xackdel
3623
+ */
3624
+ xackdel = (...args) => this.chain(new XAckDelCommand(args, this.commandOptions));
3291
3625
  /**
3292
3626
  * @see https://redis.io/commands/xdel
3293
3627
  */
3294
3628
  xdel = (...args) => this.chain(new XDelCommand(args, this.commandOptions));
3629
+ /**
3630
+ * @see https://redis.io/commands/xdelex
3631
+ */
3632
+ xdelex = (...args) => this.chain(new XDelExCommand(args, this.commandOptions));
3295
3633
  /**
3296
3634
  * @see https://redis.io/commands/xgroup
3297
3635
  */
@@ -3511,6 +3849,38 @@ var Pipeline = class {
3511
3849
  type: (...args) => this.chain(new JsonTypeCommand(args, this.commandOptions))
3512
3850
  };
3513
3851
  }
3852
+ get functions() {
3853
+ return {
3854
+ /**
3855
+ * @see https://redis.io/docs/latest/commands/function-load/
3856
+ */
3857
+ load: (...args) => this.chain(new FunctionLoadCommand(args, this.commandOptions)),
3858
+ /**
3859
+ * @see https://redis.io/docs/latest/commands/function-list/
3860
+ */
3861
+ list: (...args) => this.chain(new FunctionListCommand(args, this.commandOptions)),
3862
+ /**
3863
+ * @see https://redis.io/docs/latest/commands/function-delete/
3864
+ */
3865
+ delete: (...args) => this.chain(new FunctionDeleteCommand(args, this.commandOptions)),
3866
+ /**
3867
+ * @see https://redis.io/docs/latest/commands/function-flush/
3868
+ */
3869
+ flush: () => this.chain(new FunctionFlushCommand(this.commandOptions)),
3870
+ /**
3871
+ * @see https://redis.io/docs/latest/commands/function-stats/
3872
+ */
3873
+ stats: () => this.chain(new FunctionStatsCommand(this.commandOptions)),
3874
+ /**
3875
+ * @see https://redis.io/docs/latest/commands/fcall/
3876
+ */
3877
+ call: (...args) => this.chain(new FCallCommand(args, this.commandOptions)),
3878
+ /**
3879
+ * @see https://redis.io/docs/latest/commands/fcall_ro/
3880
+ */
3881
+ callRo: (...args) => this.chain(new FCallRoCommand(args, this.commandOptions))
3882
+ };
3883
+ }
3514
3884
  };
3515
3885
 
3516
3886
  // pkg/auto-pipeline.ts
@@ -3532,7 +3902,7 @@ var EXCLUDE_COMMANDS = /* @__PURE__ */ new Set([
3532
3902
  "zrange",
3533
3903
  "exec"
3534
3904
  ]);
3535
- function createAutoPipelineProxy(_redis, json) {
3905
+ function createAutoPipelineProxy(_redis, namespace = "root") {
3536
3906
  const redis = _redis;
3537
3907
  if (!redis.autoPipelineExecutor) {
3538
3908
  redis.autoPipelineExecutor = new AutoPipelineExecutor(redis);
@@ -3542,29 +3912,31 @@ function createAutoPipelineProxy(_redis, json) {
3542
3912
  if (command === "pipelineCounter") {
3543
3913
  return redis2.autoPipelineExecutor.pipelineCounter;
3544
3914
  }
3545
- if (command === "json") {
3546
- return createAutoPipelineProxy(redis2, true);
3915
+ if (namespace === "root" && command === "json") {
3916
+ return createAutoPipelineProxy(redis2, "json");
3547
3917
  }
3548
- const commandInRedisButNotPipeline = command in redis2 && !(command in redis2.autoPipelineExecutor.pipeline);
3549
- const isCommandExcluded = EXCLUDE_COMMANDS.has(command);
3550
- if (commandInRedisButNotPipeline || isCommandExcluded) {
3551
- return redis2[command];
3918
+ if (namespace === "root" && command === "functions") {
3919
+ return createAutoPipelineProxy(redis2, "functions");
3920
+ }
3921
+ if (namespace === "root") {
3922
+ const commandInRedisButNotPipeline = command in redis2 && !(command in redis2.autoPipelineExecutor.pipeline);
3923
+ const isCommandExcluded = EXCLUDE_COMMANDS.has(command);
3924
+ if (commandInRedisButNotPipeline || isCommandExcluded) {
3925
+ return redis2[command];
3926
+ }
3552
3927
  }
3553
- const isFunction = json ? typeof redis2.autoPipelineExecutor.pipeline.json[command] === "function" : typeof redis2.autoPipelineExecutor.pipeline[command] === "function";
3928
+ const pipeline = redis2.autoPipelineExecutor.pipeline;
3929
+ const targetFunction = namespace === "json" ? pipeline.json[command] : namespace === "functions" ? pipeline.functions[command] : pipeline[command];
3930
+ const isFunction = typeof targetFunction === "function";
3554
3931
  if (isFunction) {
3555
3932
  return (...args) => {
3556
- return redis2.autoPipelineExecutor.withAutoPipeline((pipeline) => {
3557
- if (json) {
3558
- pipeline.json[command](
3559
- ...args
3560
- );
3561
- } else {
3562
- pipeline[command](...args);
3563
- }
3933
+ return redis2.autoPipelineExecutor.withAutoPipeline((pipeline2) => {
3934
+ const targetFunction2 = namespace === "json" ? pipeline2.json[command] : namespace === "functions" ? pipeline2.functions[command] : pipeline2[command];
3935
+ targetFunction2(...args);
3564
3936
  });
3565
3937
  };
3566
3938
  }
3567
- return redis2.autoPipelineExecutor.pipeline[command];
3939
+ return targetFunction;
3568
3940
  }
3569
3941
  });
3570
3942
  }
@@ -4056,6 +4428,40 @@ var Redis = class {
4056
4428
  type: (...args) => new JsonTypeCommand(args, this.opts).exec(this.client)
4057
4429
  };
4058
4430
  }
4431
+ get functions() {
4432
+ return {
4433
+ /**
4434
+ * @see https://redis.io/docs/latest/commands/function-load/
4435
+ */
4436
+ load: (...args) => new FunctionLoadCommand(args, this.opts).exec(this.client),
4437
+ /**
4438
+ * @see https://redis.io/docs/latest/commands/function-list/
4439
+ */
4440
+ list: (...args) => new FunctionListCommand(args, this.opts).exec(this.client),
4441
+ /**
4442
+ * @see https://redis.io/docs/latest/commands/function-delete/
4443
+ */
4444
+ delete: (...args) => new FunctionDeleteCommand(args, this.opts).exec(this.client),
4445
+ /**
4446
+ * @see https://redis.io/docs/latest/commands/function-flush/
4447
+ */
4448
+ flush: () => new FunctionFlushCommand(this.opts).exec(this.client),
4449
+ /**
4450
+ * @see https://redis.io/docs/latest/commands/function-stats/
4451
+ *
4452
+ * Note: `running_script` field is not supported and therefore not included in the type.
4453
+ */
4454
+ stats: () => new FunctionStatsCommand(this.opts).exec(this.client),
4455
+ /**
4456
+ * @see https://redis.io/docs/latest/commands/fcall/
4457
+ */
4458
+ call: (...args) => new FCallCommand(args, this.opts).exec(this.client),
4459
+ /**
4460
+ * @see https://redis.io/docs/latest/commands/fcall_ro/
4461
+ */
4462
+ callRo: (...args) => new FCallRoCommand(args, this.opts).exec(this.client)
4463
+ };
4464
+ }
4059
4465
  /**
4060
4466
  * Wrap a new middleware around the HTTP client.
4061
4467
  */
@@ -4113,6 +4519,17 @@ var Redis = class {
4113
4519
  },
4114
4520
  index: (params) => {
4115
4521
  return initIndex(this.client, params);
4522
+ },
4523
+ alias: {
4524
+ list: () => {
4525
+ return listAliases(this.client);
4526
+ },
4527
+ add: ({ indexName, alias }) => {
4528
+ return addAlias(this.client, { indexName, alias });
4529
+ },
4530
+ delete: ({ alias }) => {
4531
+ return delAlias(this.client, { alias });
4532
+ }
4116
4533
  }
4117
4534
  };
4118
4535
  }
@@ -4177,6 +4594,10 @@ var Redis = class {
4177
4594
  * @see https://redis.io/commands/bitpos
4178
4595
  */
4179
4596
  bitpos = (...args) => new BitPosCommand(args, this.opts).exec(this.client);
4597
+ /**
4598
+ * @see https://redis.io/commands/client-setinfo
4599
+ */
4600
+ clientSetinfo = (...args) => new ClientSetInfoCommand(args, this.opts).exec(this.client);
4180
4601
  /**
4181
4602
  * @see https://redis.io/commands/copy
4182
4603
  */
@@ -4341,6 +4762,14 @@ var Redis = class {
4341
4762
  * @see https://redis.io/commands/hgetall
4342
4763
  */
4343
4764
  hgetall = (...args) => new HGetAllCommand(args, this.opts).exec(this.client);
4765
+ /**
4766
+ * @see https://redis.io/commands/hgetdel
4767
+ */
4768
+ hgetdel = (...args) => new HGetDelCommand(args, this.opts).exec(this.client);
4769
+ /**
4770
+ * @see https://redis.io/commands/hgetex
4771
+ */
4772
+ hgetex = (...args) => new HGetExCommand(args, this.opts).exec(this.client);
4344
4773
  /**
4345
4774
  * @see https://redis.io/commands/hincrby
4346
4775
  */
@@ -4377,6 +4806,10 @@ var Redis = class {
4377
4806
  * @see https://redis.io/commands/hset
4378
4807
  */
4379
4808
  hset = (key, kv) => new HSetCommand([key, kv], this.opts).exec(this.client);
4809
+ /**
4810
+ * @see https://redis.io/commands/hsetex
4811
+ */
4812
+ hsetex = (...args) => new HSetExCommand(args, this.opts).exec(this.client);
4380
4813
  /**
4381
4814
  * @see https://redis.io/commands/hsetnx
4382
4815
  */
@@ -4678,10 +5111,18 @@ var Redis = class {
4678
5111
  * @see https://redis.io/commands/xack
4679
5112
  */
4680
5113
  xack = (...args) => new XAckCommand(args, this.opts).exec(this.client);
5114
+ /**
5115
+ * @see https://redis.io/commands/xackdel
5116
+ */
5117
+ xackdel = (...args) => new XAckDelCommand(args, this.opts).exec(this.client);
4681
5118
  /**
4682
5119
  * @see https://redis.io/commands/xdel
4683
5120
  */
4684
5121
  xdel = (...args) => new XDelCommand(args, this.opts).exec(this.client);
5122
+ /**
5123
+ * @see https://redis.io/commands/xdelex
5124
+ */
5125
+ xdelex = (...args) => new XDelExCommand(args, this.opts).exec(this.client);
4685
5126
  /**
4686
5127
  * @see https://redis.io/commands/xgroup
4687
5128
  */
@@ -4823,7 +5264,7 @@ var Redis = class {
4823
5264
  };
4824
5265
 
4825
5266
  // version.ts
4826
- var VERSION = "v1.37.0-rc.6";
5267
+ var VERSION = "v1.37.0-rc.7";
4827
5268
 
4828
5269
  export {
4829
5270
  error_exports,