@upstash/redis 1.35.8-canary-2 → 1.36.0-rc.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
@@ -2488,6 +2488,271 @@ var ZUnionStoreCommand = class extends Command {
2488
2488
  }
2489
2489
  };
2490
2490
 
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 parseQueryResponse(rawResponse, options) {
2530
+ const results = [];
2531
+ if (options && "noContent" in options && options.noContent) {
2532
+ for (const item of rawResponse) {
2533
+ results.push({
2534
+ key: item[0],
2535
+ score: item[1]
2536
+ });
2537
+ }
2538
+ } else {
2539
+ for (const item of rawResponse) {
2540
+ const fields = Array.isArray(item[2]) ? item[2].map((field) => ({
2541
+ [field[0]]: field[1]
2542
+ })) : [];
2543
+ results.push({
2544
+ key: item[0],
2545
+ score: item[1],
2546
+ fields
2547
+ });
2548
+ }
2549
+ }
2550
+ return results;
2551
+ }
2552
+ function parseDescribeResponse(rawResponse) {
2553
+ return rawResponse;
2554
+ }
2555
+ function parseCountResponse(rawResponse) {
2556
+ return typeof rawResponse === "number" ? rawResponse : parseInt(rawResponse, 10);
2557
+ }
2558
+
2559
+ // pkg/commands/search/command-builder.ts
2560
+ function buildQueryCommand(redisCommand, indexName, query, options) {
2561
+ const command = [redisCommand, indexName, query];
2562
+ if (options?.limit !== void 0) {
2563
+ command.push("LIMIT", options.limit.toString());
2564
+ }
2565
+ if (options?.offset !== void 0) {
2566
+ command.push("OFFSET", options.offset.toString());
2567
+ }
2568
+ if (options?.noContent) {
2569
+ command.push("NOCONTENT");
2570
+ }
2571
+ if (options?.sortBy) {
2572
+ command.push("SORTBY", options.sortBy.field);
2573
+ if (options.sortBy.direction) {
2574
+ command.push(options.sortBy.direction);
2575
+ }
2576
+ }
2577
+ if (options && "highlight" in options && options.highlight) {
2578
+ command.push(
2579
+ "HIGHLIGHT",
2580
+ "FIELDS",
2581
+ options.highlight.fields.length.toString(),
2582
+ ...options.highlight.fields
2583
+ );
2584
+ if (options.highlight.preTag && options.highlight.postTag) {
2585
+ command.push("TAGS", options.highlight.preTag, options.highlight.postTag);
2586
+ }
2587
+ }
2588
+ if (options && "returnFields" in options && options.returnFields && options.returnFields.length > 0) {
2589
+ command.push("RETURN", options.returnFields.length.toString(), ...options.returnFields);
2590
+ }
2591
+ return command;
2592
+ }
2593
+ function buildCreateIndexCommand(props) {
2594
+ const { indexName, schema, dataType, prefix, language } = props;
2595
+ const prefixArray = Array.isArray(prefix) ? prefix : [prefix];
2596
+ const payload = [
2597
+ indexName,
2598
+ "ON",
2599
+ dataType.toUpperCase(),
2600
+ "PREFIX",
2601
+ prefixArray.length.toString(),
2602
+ ...prefixArray,
2603
+ ...language ? ["LANGUAGE", language] : [],
2604
+ "SCHEMA"
2605
+ ];
2606
+ const fields = flattenSchema(schema);
2607
+ for (const field of fields) {
2608
+ payload.push(field.path, field.type);
2609
+ if (field.fast) {
2610
+ payload.push("FAST");
2611
+ }
2612
+ if (field.noTokenize) {
2613
+ payload.push("NOTOKENIZE");
2614
+ }
2615
+ if (field.noStem) {
2616
+ payload.push("NOSTEM");
2617
+ }
2618
+ }
2619
+ return ["SEARCH.CREATE", ...payload];
2620
+ }
2621
+
2622
+ // pkg/commands/search/search.ts
2623
+ var SearchIndex = class {
2624
+ indexName;
2625
+ schema;
2626
+ client;
2627
+ constructor({ indexName, schema, client }) {
2628
+ this.indexName = indexName;
2629
+ this.schema = schema;
2630
+ this.client = client;
2631
+ }
2632
+ async waitIndexing() {
2633
+ let command = ["SEARCH.COMMIT", this.indexName];
2634
+ const result = await new ExecCommand(command).exec(
2635
+ this.client
2636
+ );
2637
+ return result;
2638
+ }
2639
+ async describe() {
2640
+ let command = ["SEARCH.DESCRIBE", this.indexName];
2641
+ const rawResult = await new ExecCommand(command).exec(
2642
+ this.client
2643
+ );
2644
+ return parseDescribeResponse(rawResult);
2645
+ }
2646
+ async query(filter, options) {
2647
+ const queryString = JSON.stringify(filter);
2648
+ const command = buildQueryCommand(
2649
+ "SEARCH.QUERY",
2650
+ this.indexName,
2651
+ queryString,
2652
+ options
2653
+ );
2654
+ const rawResult = await new ExecCommand(command).exec(
2655
+ this.client
2656
+ );
2657
+ return parseQueryResponse(rawResult, options);
2658
+ }
2659
+ async count(filter) {
2660
+ const queryString = JSON.stringify(filter);
2661
+ const command = buildQueryCommand("SEARCH.COUNT", this.indexName, queryString);
2662
+ const rawResult = await new ExecCommand(command).exec(
2663
+ this.client
2664
+ );
2665
+ return parseCountResponse(rawResult);
2666
+ }
2667
+ async drop() {
2668
+ let command = ["SEARCH.DROP", this.indexName];
2669
+ const result = await new ExecCommand(command).exec(
2670
+ this.client
2671
+ );
2672
+ return result;
2673
+ }
2674
+ };
2675
+ async function createSearchIndex(props) {
2676
+ const { indexName, schema, client } = props;
2677
+ const createIndexCommand = buildCreateIndexCommand(props);
2678
+ await new ExecCommand(createIndexCommand).exec(client);
2679
+ return getSearchIndex({ indexName, schema, client });
2680
+ }
2681
+ function getSearchIndex(props) {
2682
+ return new SearchIndex(props);
2683
+ }
2684
+
2685
+ // pkg/commands/search/schema-builder.ts
2686
+ var BUILD = Symbol("build");
2687
+ var TextFieldBuilder = class _TextFieldBuilder {
2688
+ _noTokenize;
2689
+ _noStem;
2690
+ constructor(noTokenize = { noTokenize: false }, noStem = { noStem: false }) {
2691
+ this._noTokenize = noTokenize;
2692
+ this._noStem = noStem;
2693
+ }
2694
+ noTokenize() {
2695
+ return new _TextFieldBuilder({ noTokenize: true }, this._noStem);
2696
+ }
2697
+ noStem() {
2698
+ return new _TextFieldBuilder(this._noTokenize, { noStem: true });
2699
+ }
2700
+ [BUILD]() {
2701
+ return this._noTokenize.noTokenize || this._noStem.noStem ? {
2702
+ type: "TEXT",
2703
+ ...this._noTokenize.noTokenize ? { noTokenize: true } : {},
2704
+ ...this._noStem.noStem ? { noStem: true } : {}
2705
+ } : "TEXT";
2706
+ }
2707
+ };
2708
+ var NumericFieldBuilder = class _NumericFieldBuilder {
2709
+ _fast;
2710
+ type;
2711
+ constructor(type, fast = { fast: false }) {
2712
+ this.type = type;
2713
+ this._fast = fast;
2714
+ }
2715
+ fast() {
2716
+ return new _NumericFieldBuilder(this.type, { fast: true });
2717
+ }
2718
+ [BUILD]() {
2719
+ return this._fast.fast ? {
2720
+ type: this.type,
2721
+ fast: true
2722
+ } : this.type;
2723
+ }
2724
+ };
2725
+ var BoolFieldBuilder = class _BoolFieldBuilder {
2726
+ _fast;
2727
+ constructor(fast = { fast: false }) {
2728
+ this._fast = fast;
2729
+ }
2730
+ fast() {
2731
+ return new _BoolFieldBuilder({ fast: true });
2732
+ }
2733
+ [BUILD]() {
2734
+ return this._fast.fast ? {
2735
+ type: "BOOL",
2736
+ fast: true
2737
+ } : "BOOL";
2738
+ }
2739
+ };
2740
+ var DateFieldBuilder = class _DateFieldBuilder {
2741
+ _fast;
2742
+ constructor(fast = { fast: false }) {
2743
+ this._fast = fast;
2744
+ }
2745
+ fast() {
2746
+ return new _DateFieldBuilder({ fast: true });
2747
+ }
2748
+ [BUILD]() {
2749
+ return this._fast.fast ? {
2750
+ type: "DATE",
2751
+ fast: true
2752
+ } : "DATE";
2753
+ }
2754
+ };
2755
+
2491
2756
  // pkg/commands/psubscribe.ts
2492
2757
  var PSubscribeCommand = class extends Command {
2493
2758
  constructor(cmd, opts) {
@@ -3574,8 +3839,8 @@ var Script = class {
3574
3839
  /**
3575
3840
  * Compute the sha1 hash of the script and return its hex representation.
3576
3841
  */
3577
- async digest(s) {
3578
- const data = new TextEncoder().encode(s);
3842
+ async digest(s2) {
3843
+ const data = new TextEncoder().encode(s2);
3579
3844
  const hashBuffer = await import_uncrypto.subtle.digest("SHA-1", data);
3580
3845
  const hashArray = [...new Uint8Array(hashBuffer)];
3581
3846
  return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
@@ -3638,8 +3903,8 @@ var ScriptRO = class {
3638
3903
  /**
3639
3904
  * Compute the sha1 hash of the script and return its hex representation.
3640
3905
  */
3641
- async digest(s) {
3642
- const data = new TextEncoder().encode(s);
3906
+ async digest(s2) {
3907
+ const data = new TextEncoder().encode(s2);
3643
3908
  const hashBuffer = await import_uncrypto2.subtle.digest("SHA-1", data);
3644
3909
  const hashArray = [...new Uint8Array(hashBuffer)];
3645
3910
  return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
@@ -3824,6 +4089,18 @@ var Redis = class {
3824
4089
  createScript(script, opts) {
3825
4090
  return opts?.readonly ? new ScriptRO(this, script) : new Script(this, script);
3826
4091
  }
4092
+ createSearchIndex = (props) => {
4093
+ return createSearchIndex({
4094
+ ...props,
4095
+ client: this.client
4096
+ });
4097
+ };
4098
+ getSearchIndex = (props) => {
4099
+ return getSearchIndex({
4100
+ ...props,
4101
+ client: this.client
4102
+ });
4103
+ };
3827
4104
  /**
3828
4105
  * Create a new pipeline that allows you to send requests in bulk.
3829
4106
  *
@@ -4531,7 +4808,7 @@ var Redis = class {
4531
4808
  };
4532
4809
 
4533
4810
  // version.ts
4534
- var VERSION = "v1.35.8-canary-2";
4811
+ var VERSION = "v1.36.0-rc.1";
4535
4812
 
4536
4813
  // platforms/fastly.ts
4537
4814
  var Redis2 = class extends Redis {
package/fastly.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-E5HCYSG3.mjs";
6
+ } from "./chunk-U5HO3NMB.mjs";
7
7
 
8
8
  // platforms/fastly.ts
9
9
  var Redis2 = class extends Redis {
package/nodejs.d.mts CHANGED
@@ -1,5 +1,158 @@
1
- import { H as HttpClientConfig, R as RedisOptions, a as RequesterConfig, b as Redis$1, c as Requester } from './zmscore-DhpQcqpW.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, 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-DhpQcqpW.mjs';
1
+ import { N as NestedIndexSchema, H as HttpClientConfig, R as RedisOptions, a as RequesterConfig, b as Redis$1, c as Requester } from './zmscore-BVyzI3wx.mjs';
2
+ export { A as AppendCommand, B as BitCountCommand, f as BitOpCommand, g as BitPosCommand, C as CopyCommand, c6 as CreateSearchIndexProps, 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, c7 as FlatIndexSchema, 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, O as GetSetCommand, Q as HDelCommand, S as HExistsCommand, V as HExpireAtCommand, T as HExpireCommand, W as HExpireTimeCommand, a2 as HGetAllCommand, a1 as HGetCommand, a3 as HIncrByCommand, a4 as HIncrByFloatCommand, a5 as HKeysCommand, a6 as HLenCommand, a7 as HMGetCommand, a8 as HMSetCommand, Z as HPExpireAtCommand, Y as HPExpireCommand, _ as HPExpireTimeCommand, $ as HPTtlCommand, a0 as HPersistCommand, a9 as HRandFieldCommand, aa as HScanCommand, ab as HSetCommand, ac as HSetNXCommand, ad as HStrLenCommand, X as HTtlCommand, ae as HValsCommand, ag as IncrByCommand, ah as IncrByFloatCommand, af as IncrCommand, ai as JsonArrAppendCommand, aj as JsonArrIndexCommand, ak as JsonArrInsertCommand, al as JsonArrLenCommand, am as JsonArrPopCommand, an as JsonArrTrimCommand, ao as JsonClearCommand, ap as JsonDelCommand, aq as JsonForgetCommand, ar as JsonGetCommand, at as JsonMGetCommand, as as JsonMergeCommand, au as JsonNumIncrByCommand, av as JsonNumMultByCommand, aw as JsonObjKeysCommand, ax as JsonObjLenCommand, ay as JsonRespCommand, az as JsonSetCommand, aA as JsonStrAppendCommand, aB as JsonStrLenCommand, aC as JsonToggleCommand, aD as JsonTypeCommand, aE as KeysCommand, aF as LIndexCommand, aG as LInsertCommand, aH as LLenCommand, aI as LMoveCommand, aJ as LPopCommand, aK as LPushCommand, aL as LPushXCommand, aM as LRangeCommand, aN as LRemCommand, aO as LSetCommand, aP as LTrimCommand, aQ as MGetCommand, aR as MSetCommand, aS as MSetNXCommand, aV as PExpireAtCommand, aU as PExpireCommand, aX as PSetEXCommand, aY as PTtlCommand, aT as PersistCommand, aW as PingCommand, P as Pipeline, aZ as PublishCommand, b1 as RPopCommand, b2 as RPushCommand, b3 as RPushXCommand, a_ as RandomKeyCommand, a$ as RenameCommand, b0 as RenameNXCommand, b4 as SAddCommand, b7 as SCardCommand, bb as SDiffCommand, bc as SDiffStoreCommand, bj as SInterCommand, bk as SInterStoreCommand, bl as SIsMemberCommand, bn as SMIsMemberCommand, bm as SMembersCommand, bo as SMoveCommand, bp as SPopCommand, bq as SRandMemberCommand, br as SRemCommand, bs as SScanCommand, bu as SUnionCommand, bv as SUnionStoreCommand, b5 as ScanCommand, b6 as ScanCommandOptions, bE as ScoreMember, b8 as ScriptExistsCommand, b9 as ScriptFlushCommand, ba as ScriptLoadCommand, c5 as SearchIndexProps, bf as SetBitCommand, bd as SetCommand, be as SetCommandOptions, bg as SetExCommand, bh as SetNxCommand, bi as SetRangeCommand, bt as StrLenCommand, bw as TimeCommand, bx as TouchCommand, by as TtlCommand, bz as Type, bA as TypeCommand, bB as UnlinkCommand, U as UpstashRequest, d as UpstashResponse, bC as XAddCommand, bD as XRangeCommand, bG as ZAddCommand, bF as ZAddCommandOptions, bH as ZCardCommand, bI as ZCountCommand, bJ as ZDiffStoreCommand, bK as ZIncrByCommand, bL as ZInterStoreCommand, bM as ZInterStoreCommandOptions, bN as ZLexCountCommand, bO as ZMScoreCommand, bP as ZPopMaxCommand, bQ as ZPopMinCommand, bR as ZRangeCommand, bS as ZRangeCommandOptions, bT as ZRankCommand, bU as ZRemCommand, bV as ZRemRangeByLexCommand, bW as ZRemRangeByRankCommand, bX as ZRemRangeByScoreCommand, bY as ZRevRankCommand, bZ as ZScanCommand, b_ as ZScoreCommand, b$ as ZUnionCommand, c0 as ZUnionCommandOptions, c1 as ZUnionStoreCommand, c2 as ZUnionStoreCommandOptions, c3 as createSearchIndex, e as errors, c4 as getSearchIndex } from './zmscore-BVyzI3wx.mjs';
3
+
4
+ declare const BUILD: unique symbol;
5
+ declare class TextFieldBuilder<NoTokenize extends Record<"noTokenize", boolean> = {
6
+ noTokenize: false;
7
+ }, NoStem extends Record<"noStem", boolean> = {
8
+ noStem: false;
9
+ }> {
10
+ private _noTokenize;
11
+ private _noStem;
12
+ constructor(noTokenize?: NoTokenize, noStem?: NoStem);
13
+ noTokenize(): TextFieldBuilder<{
14
+ noTokenize: true;
15
+ }, NoStem>;
16
+ noStem(): TextFieldBuilder<NoTokenize, {
17
+ noStem: true;
18
+ }>;
19
+ [BUILD](): NoTokenize extends {
20
+ noTokenize: true;
21
+ } ? NoStem extends {
22
+ noStem: true;
23
+ } ? {
24
+ type: "TEXT";
25
+ noTokenize: true;
26
+ noStem: true;
27
+ } : {
28
+ type: "TEXT";
29
+ noTokenize: true;
30
+ } : NoStem extends {
31
+ noStem: true;
32
+ } ? {
33
+ type: "TEXT";
34
+ noStem: true;
35
+ } : "TEXT";
36
+ }
37
+ declare class NumericFieldBuilder<T extends "U64" | "I64" | "F64", Fast extends Record<"fast", boolean> = {
38
+ fast: false;
39
+ }> {
40
+ private _fast;
41
+ private type;
42
+ constructor(type: T, fast?: Fast);
43
+ fast(): NumericFieldBuilder<T, {
44
+ fast: true;
45
+ }>;
46
+ [BUILD](): Fast extends {
47
+ fast: true;
48
+ } ? {
49
+ type: T;
50
+ fast: true;
51
+ } : T;
52
+ }
53
+ declare class BoolFieldBuilder<Fast extends Record<"fast", boolean> = {
54
+ fast: false;
55
+ }> {
56
+ private _fast;
57
+ constructor(fast?: Fast);
58
+ fast(): BoolFieldBuilder<{
59
+ fast: true;
60
+ }>;
61
+ [BUILD](): Fast extends {
62
+ fast: true;
63
+ } ? {
64
+ type: "BOOL";
65
+ fast: true;
66
+ } : "BOOL";
67
+ }
68
+ declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
69
+ fast: false;
70
+ }> {
71
+ private _fast;
72
+ constructor(fast?: Fast);
73
+ fast(): DateFieldBuilder<{
74
+ fast: true;
75
+ }>;
76
+ [BUILD](): Fast extends {
77
+ fast: true;
78
+ } ? {
79
+ type: "DATE";
80
+ fast: true;
81
+ } : "DATE";
82
+ }
83
+ type FieldBuilder = TextFieldBuilder<{
84
+ noTokenize: boolean;
85
+ }, {
86
+ noStem: boolean;
87
+ }> | NumericFieldBuilder<"U64" | "I64" | "F64", {
88
+ fast: boolean;
89
+ }> | BoolFieldBuilder<{
90
+ fast: boolean;
91
+ }> | DateFieldBuilder<{
92
+ fast: boolean;
93
+ }>;
94
+ declare const s: {
95
+ /**
96
+ * Full-text search field (TEXT)
97
+ * @example
98
+ * s.text() // Simple text field
99
+ * s.text().noTokenize() // Exact phrase matching
100
+ * s.text().noStem() // Disable stemming
101
+ */
102
+ text(): TextFieldBuilder;
103
+ /**
104
+ * Unsigned 64-bit integer (U64)
105
+ * Range: 0 to 2^64-1
106
+ * @example
107
+ * s.unsigned() // Simple unsigned field
108
+ * s.unsigned().fast() // Enable sorting and range queries
109
+ */
110
+ unsignedInteger(): NumericFieldBuilder<"U64">;
111
+ /**
112
+ * Signed 64-bit integer (I64)
113
+ * Range: -2^63 to 2^63-1
114
+ * @example
115
+ * s.integer() // Simple integer field
116
+ * s.integer().fast() // Enable sorting and range queries
117
+ */
118
+ integer(): NumericFieldBuilder<"I64">;
119
+ /**
120
+ * 64-bit floating point (F64)
121
+ * @example
122
+ * s.float() // Simple float field
123
+ * s.float().fast() // Enable sorting and range queries
124
+ */
125
+ float(): NumericFieldBuilder<"F64">;
126
+ /**
127
+ * Boolean field (BOOL)
128
+ * @example
129
+ * s.bool() // Simple boolean field
130
+ * s.bool().fast() // Enable efficient filtering
131
+ */
132
+ bool(): BoolFieldBuilder;
133
+ /**
134
+ * ISO 8601 date field (DATE)
135
+ * @example
136
+ * s.date() // Simple date field
137
+ * s.date().fast() // Enable sorting and range queries
138
+ */
139
+ date(): DateFieldBuilder;
140
+ /**
141
+ * Create a string/JSON index schema (supports nesting)
142
+ * @example
143
+ * s.object({
144
+ * name: s.text(),
145
+ * profile: s.object({
146
+ * age: s.unsigned(),
147
+ * city: s.text()
148
+ * })
149
+ * })
150
+ */
151
+ object<T extends ObjectFieldRecord<T>>(fields: T): { [K in keyof T]: T[K] extends FieldBuilder ? ReturnType<T[K][typeof BUILD]> : T[K]; };
152
+ };
153
+ type ObjectFieldRecord<T> = {
154
+ [K in keyof T]: K extends string ? K extends `${infer _}.${infer _}` ? never : T[K] extends FieldBuilder | NestedIndexSchema ? T[K] : never : never;
155
+ };
3
156
 
4
157
  /**
5
158
  * Connection credentials for upstash redis.
@@ -78,4 +231,4 @@ declare class Redis extends Redis$1 {
78
231
  static fromEnv(config?: Omit<RedisConfigNodejs, "url" | "token">): Redis;
79
232
  }
80
233
 
81
- export { Redis, type RedisConfigNodejs, Requester };
234
+ export { NestedIndexSchema, Redis, type RedisConfigNodejs, Requester, s };