@upstash/redis 1.36.0-rc.7 → 1.36.1

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/fastly.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");
375
+ }
376
+ if (namespace === "root" && command === "functions") {
377
+ return createAutoPipelineProxy(redis2, "functions");
360
378
  }
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];
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 isFunction = json ? typeof redis2.autoPipelineExecutor.pipeline.json[command] === "function" : typeof redis2.autoPipelineExecutor.pipeline[command] === "function";
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
  }
@@ -400,7 +417,7 @@ var AutoPipelineExecutor = class {
400
417
  this.activePipeline = pipeline;
401
418
  this.indexInCurrentPipeline = 0;
402
419
  }
403
- const index2 = this.indexInCurrentPipeline++;
420
+ const index = this.indexInCurrentPipeline++;
404
421
  executeWithPipeline(pipeline);
405
422
  const pipelineDone = this.deferExecution().then(() => {
406
423
  if (!this.pipelinePromises.has(pipeline)) {
@@ -412,7 +429,7 @@ var AutoPipelineExecutor = class {
412
429
  return this.pipelinePromises.get(pipeline);
413
430
  });
414
431
  const results = await pipelineDone;
415
- const commandResult = results[index2];
432
+ const commandResult = results[index];
416
433
  if (commandResult.error) {
417
434
  throw new UpstashError(`Command failed: ${commandResult.error}`);
418
435
  }
@@ -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) {
@@ -2488,329 +2601,6 @@ var ZUnionStoreCommand = class extends Command {
2488
2601
  }
2489
2602
  };
2490
2603
 
2491
- // pkg/commands/search/types.ts
2492
- var FIELD_TYPES = ["TEXT", "U64", "I64", "F64", "BOOL", "DATE"];
2493
-
2494
- // pkg/commands/search/utils.ts
2495
- function isFieldType(value) {
2496
- return typeof value === "string" && FIELD_TYPES.includes(value);
2497
- }
2498
- function isDetailedField(value) {
2499
- return typeof value === "object" && value !== null && "type" in value && isFieldType(value.type);
2500
- }
2501
- function isNestedSchema(value) {
2502
- return typeof value === "object" && value !== null && !isDetailedField(value);
2503
- }
2504
- function flattenSchema(schema, pathPrefix = []) {
2505
- const fields = [];
2506
- for (const [key, value] of Object.entries(schema)) {
2507
- const currentPath = [...pathPrefix, key];
2508
- const pathString = currentPath.join(".");
2509
- if (isFieldType(value)) {
2510
- fields.push({
2511
- path: pathString,
2512
- type: value
2513
- });
2514
- } else if (isDetailedField(value)) {
2515
- fields.push({
2516
- path: pathString,
2517
- type: value.type,
2518
- fast: "fast" in value ? value.fast : void 0,
2519
- noTokenize: "noTokenize" in value ? value.noTokenize : void 0,
2520
- noStem: "noStem" in value ? value.noStem : void 0
2521
- });
2522
- } else if (isNestedSchema(value)) {
2523
- const nestedFields = flattenSchema(value, currentPath);
2524
- fields.push(...nestedFields);
2525
- }
2526
- }
2527
- return fields;
2528
- }
2529
- function deserializeQueryResponse(rawResponse) {
2530
- return rawResponse.map((itemRaw) => {
2531
- const raw = itemRaw;
2532
- const key = raw[0];
2533
- const score = raw[1];
2534
- const rawFields = raw[2];
2535
- if (rawFields === void 0) {
2536
- return { key, score };
2537
- }
2538
- if (!Array.isArray(rawFields) || rawFields.length === 0) {
2539
- return { key, score, data: {} };
2540
- }
2541
- let data = {};
2542
- for (const fieldRaw of rawFields) {
2543
- const key2 = fieldRaw[0];
2544
- const value = fieldRaw[1];
2545
- const pathParts = key2.split(".");
2546
- if (pathParts.length == 1) {
2547
- data[key2] = value;
2548
- } else {
2549
- let currentObj = data;
2550
- for (let i = 0; i < pathParts.length - 1; i++) {
2551
- const pathPart = pathParts[i];
2552
- if (!(pathPart in currentObj)) {
2553
- currentObj[pathPart] = {};
2554
- }
2555
- currentObj = currentObj[pathPart];
2556
- }
2557
- currentObj[pathParts.at(-1)] = value;
2558
- }
2559
- }
2560
- if ("$" in data) {
2561
- data = data["$"];
2562
- }
2563
- return { key, score, data };
2564
- });
2565
- }
2566
- function deserializeDescribeResponse(rawResponse) {
2567
- const description = {};
2568
- for (let i = 0; i < rawResponse.length; i += 2) {
2569
- const descriptor = rawResponse[i];
2570
- switch (descriptor) {
2571
- case "name": {
2572
- description["name"] = rawResponse[i + 1];
2573
- break;
2574
- }
2575
- case "type": {
2576
- description["dataType"] = rawResponse[i + 1].toLowerCase();
2577
- break;
2578
- }
2579
- case "prefixes": {
2580
- description["prefixes"] = rawResponse[i + 1];
2581
- break;
2582
- }
2583
- case "language": {
2584
- description["language"] = rawResponse[i + 1];
2585
- break;
2586
- }
2587
- case "schema": {
2588
- const schema = {};
2589
- for (const fieldDescription of rawResponse[i + 1]) {
2590
- const fieldName = fieldDescription[0];
2591
- const fieldInfo = { type: fieldDescription[1] };
2592
- if (fieldDescription.length > 2) {
2593
- for (let j = 2; j < fieldDescription.length; j++) {
2594
- const fieldOption = fieldDescription[j];
2595
- switch (fieldOption) {
2596
- case "NOSTEM": {
2597
- fieldInfo.noStem = true;
2598
- break;
2599
- }
2600
- case "NOTOKENIZE": {
2601
- fieldInfo.noTokenize = true;
2602
- break;
2603
- }
2604
- case "FAST": {
2605
- fieldInfo.fast = true;
2606
- break;
2607
- }
2608
- }
2609
- }
2610
- }
2611
- schema[fieldName] = fieldInfo;
2612
- }
2613
- description["schema"] = schema;
2614
- break;
2615
- }
2616
- }
2617
- }
2618
- return description;
2619
- }
2620
- function parseCountResponse(rawResponse) {
2621
- return typeof rawResponse === "number" ? rawResponse : Number.parseInt(rawResponse, 10);
2622
- }
2623
-
2624
- // pkg/commands/search/command-builder.ts
2625
- function buildQueryCommand(redisCommand, name, options) {
2626
- const query = JSON.stringify(options?.filter ?? {});
2627
- const command = [redisCommand, name, query];
2628
- if (options?.limit !== void 0) {
2629
- command.push("LIMIT", options.limit.toString());
2630
- }
2631
- if (options?.offset !== void 0) {
2632
- command.push("OFFSET", options.offset.toString());
2633
- }
2634
- if (options?.select && Object.keys(options.select).length === 0) {
2635
- command.push("NOCONTENT");
2636
- }
2637
- if (options?.orderBy) {
2638
- command.push("SORTBY");
2639
- for (const [field, direction] of Object.entries(options.orderBy)) {
2640
- command.push(field, direction);
2641
- }
2642
- }
2643
- if (options?.highlight) {
2644
- command.push(
2645
- "HIGHLIGHT",
2646
- "FIELDS",
2647
- options.highlight.fields.length.toString(),
2648
- ...options.highlight.fields
2649
- );
2650
- if (options.highlight.preTag && options.highlight.postTag) {
2651
- command.push("TAGS", options.highlight.preTag, options.highlight.postTag);
2652
- }
2653
- }
2654
- if (options?.select && Object.keys(options.select).length > 0) {
2655
- command.push(
2656
- "RETURN",
2657
- Object.keys(options.select).length.toString(),
2658
- ...Object.keys(options.select)
2659
- );
2660
- }
2661
- return command;
2662
- }
2663
- function buildCreateIndexCommand(props) {
2664
- const { name, schema, dataType, prefix, language } = props;
2665
- const prefixArray = Array.isArray(prefix) ? prefix : [prefix];
2666
- const payload = [
2667
- name,
2668
- "ON",
2669
- dataType.toUpperCase(),
2670
- "PREFIX",
2671
- prefixArray.length.toString(),
2672
- ...prefixArray,
2673
- ...language ? ["LANGUAGE", language] : [],
2674
- "SCHEMA"
2675
- ];
2676
- const fields = flattenSchema(schema);
2677
- for (const field of fields) {
2678
- payload.push(field.path, field.type);
2679
- if (field.fast) {
2680
- payload.push("FAST");
2681
- }
2682
- if (field.noTokenize) {
2683
- payload.push("NOTOKENIZE");
2684
- }
2685
- if (field.noStem) {
2686
- payload.push("NOSTEM");
2687
- }
2688
- }
2689
- return ["SEARCH.CREATE", ...payload];
2690
- }
2691
-
2692
- // pkg/commands/search/search.ts
2693
- var SearchIndex = class {
2694
- name;
2695
- schema;
2696
- client;
2697
- constructor({ name, schema, client }) {
2698
- this.name = name;
2699
- this.schema = schema;
2700
- this.client = client;
2701
- }
2702
- async waitIndexing() {
2703
- const command = ["SEARCH.WAITINDEXING", this.name];
2704
- const result = await new ExecCommand(command).exec(
2705
- this.client
2706
- );
2707
- return result;
2708
- }
2709
- async describe() {
2710
- const command = ["SEARCH.DESCRIBE", this.name];
2711
- const rawResult = await new ExecCommand(command).exec(
2712
- this.client
2713
- );
2714
- return deserializeDescribeResponse(rawResult);
2715
- }
2716
- async query(options) {
2717
- const command = buildQueryCommand("SEARCH.QUERY", this.name, options);
2718
- const rawResult = await new ExecCommand(command).exec(
2719
- this.client
2720
- );
2721
- return deserializeQueryResponse(rawResult);
2722
- }
2723
- async count({ filter }) {
2724
- const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
2725
- const rawResult = await new ExecCommand(command).exec(
2726
- this.client
2727
- );
2728
- return { count: parseCountResponse(rawResult) };
2729
- }
2730
- async drop() {
2731
- const command = ["SEARCH.DROP", this.name];
2732
- const result = await new ExecCommand(command).exec(
2733
- this.client
2734
- );
2735
- return result;
2736
- }
2737
- };
2738
- async function createIndex(props) {
2739
- const { name, schema, client } = props;
2740
- const createIndexCommand = buildCreateIndexCommand(props);
2741
- await new ExecCommand(createIndexCommand).exec(client);
2742
- return index(client, name, schema);
2743
- }
2744
- function index(client, name, schema) {
2745
- return new SearchIndex({ name, schema, client });
2746
- }
2747
-
2748
- // pkg/commands/search/schema-builder.ts
2749
- var BUILD = Symbol("build");
2750
- var TextFieldBuilder = class _TextFieldBuilder {
2751
- _noTokenize;
2752
- _noStem;
2753
- constructor(noTokenize = { noTokenize: false }, noStem = { noStem: false }) {
2754
- this._noTokenize = noTokenize;
2755
- this._noStem = noStem;
2756
- }
2757
- noTokenize() {
2758
- return new _TextFieldBuilder({ noTokenize: true }, this._noStem);
2759
- }
2760
- noStem() {
2761
- return new _TextFieldBuilder(this._noTokenize, { noStem: true });
2762
- }
2763
- [BUILD]() {
2764
- return this._noTokenize.noTokenize || this._noStem.noStem ? {
2765
- type: "TEXT",
2766
- ...this._noTokenize.noTokenize ? { noTokenize: true } : {},
2767
- ...this._noStem.noStem ? { noStem: true } : {}
2768
- } : "TEXT";
2769
- }
2770
- };
2771
- var NumericFieldBuilder = class {
2772
- type;
2773
- constructor(type) {
2774
- this.type = type;
2775
- }
2776
- [BUILD]() {
2777
- return {
2778
- type: this.type,
2779
- fast: true
2780
- };
2781
- }
2782
- };
2783
- var BoolFieldBuilder = class _BoolFieldBuilder {
2784
- _fast;
2785
- constructor(fast = { fast: false }) {
2786
- this._fast = fast;
2787
- }
2788
- fast() {
2789
- return new _BoolFieldBuilder({ fast: true });
2790
- }
2791
- [BUILD]() {
2792
- return this._fast.fast ? {
2793
- type: "BOOL",
2794
- fast: true
2795
- } : "BOOL";
2796
- }
2797
- };
2798
- var DateFieldBuilder = class _DateFieldBuilder {
2799
- _fast;
2800
- constructor(fast = { fast: false }) {
2801
- this._fast = fast;
2802
- }
2803
- fast() {
2804
- return new _DateFieldBuilder({ fast: true });
2805
- }
2806
- [BUILD]() {
2807
- return this._fast.fast ? {
2808
- type: "DATE",
2809
- fast: true
2810
- } : "DATE";
2811
- }
2812
- };
2813
-
2814
2604
  // pkg/commands/psubscribe.ts
2815
2605
  var PSubscribeCommand = class extends Command {
2816
2606
  constructor(cmd, opts) {
@@ -3384,7 +3174,7 @@ var Pipeline = class {
3384
3174
  /**
3385
3175
  * @see https://redis.io/commands/lset
3386
3176
  */
3387
- lset = (key, index2, value) => this.chain(new LSetCommand([key, index2, value], this.commandOptions));
3177
+ lset = (key, index, value) => this.chain(new LSetCommand([key, index, value], this.commandOptions));
3388
3178
  /**
3389
3179
  * @see https://redis.io/commands/ltrim
3390
3180
  */
@@ -3836,6 +3626,38 @@ var Pipeline = class {
3836
3626
  type: (...args) => this.chain(new JsonTypeCommand(args, this.commandOptions))
3837
3627
  };
3838
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
+ }
3839
3661
  };
3840
3662
 
3841
3663
  // pkg/script.ts
@@ -3897,8 +3719,8 @@ var Script = class {
3897
3719
  /**
3898
3720
  * Compute the sha1 hash of the script and return its hex representation.
3899
3721
  */
3900
- async digest(s2) {
3901
- const data = new TextEncoder().encode(s2);
3722
+ async digest(s) {
3723
+ const data = new TextEncoder().encode(s);
3902
3724
  const hashBuffer = await import_uncrypto.subtle.digest("SHA-1", data);
3903
3725
  const hashArray = [...new Uint8Array(hashBuffer)];
3904
3726
  return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
@@ -3961,8 +3783,8 @@ var ScriptRO = class {
3961
3783
  /**
3962
3784
  * Compute the sha1 hash of the script and return its hex representation.
3963
3785
  */
3964
- async digest(s2) {
3965
- const data = new TextEncoder().encode(s2);
3786
+ async digest(s) {
3787
+ const data = new TextEncoder().encode(s);
3966
3788
  const hashBuffer = await import_uncrypto2.subtle.digest("SHA-1", data);
3967
3789
  const hashArray = [...new Uint8Array(hashBuffer)];
3968
3790
  return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
@@ -4097,6 +3919,40 @@ var Redis = class {
4097
3919
  type: (...args) => new JsonTypeCommand(args, this.opts).exec(this.client)
4098
3920
  };
4099
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
+ }
4100
3956
  /**
4101
3957
  * Wrap a new middleware around the HTTP client.
4102
3958
  */
@@ -4147,19 +4003,6 @@ var Redis = class {
4147
4003
  createScript(script, opts) {
4148
4004
  return opts?.readonly ? new ScriptRO(this, script) : new Script(this, script);
4149
4005
  }
4150
- get search() {
4151
- return {
4152
- createIndex: (props) => {
4153
- return createIndex({
4154
- ...props,
4155
- client: this.client
4156
- });
4157
- },
4158
- index: (name, schema) => {
4159
- return index(this.client, name, schema);
4160
- }
4161
- };
4162
- }
4163
4006
  /**
4164
4007
  * Create a new pipeline that allows you to send requests in bulk.
4165
4008
  *
@@ -4496,7 +4339,7 @@ var Redis = class {
4496
4339
  /**
4497
4340
  * @see https://redis.io/commands/lset
4498
4341
  */
4499
- lset = (key, index2, value) => new LSetCommand([key, index2, value], this.opts).exec(this.client);
4342
+ lset = (key, index, value) => new LSetCommand([key, index, value], this.opts).exec(this.client);
4500
4343
  /**
4501
4344
  * @see https://redis.io/commands/ltrim
4502
4345
  */
@@ -4867,7 +4710,7 @@ var Redis = class {
4867
4710
  };
4868
4711
 
4869
4712
  // version.ts
4870
- var VERSION = "v1.36.0-rc.7";
4713
+ var VERSION = "v1.36.1";
4871
4714
 
4872
4715
  // platforms/fastly.ts
4873
4716
  var Redis2 = class extends Redis {