@upstash/redis 1.36.0-rc.2 → 1.36.0-rc.3

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
@@ -400,7 +400,7 @@ var AutoPipelineExecutor = class {
400
400
  this.activePipeline = pipeline;
401
401
  this.indexInCurrentPipeline = 0;
402
402
  }
403
- const index = this.indexInCurrentPipeline++;
403
+ const index2 = this.indexInCurrentPipeline++;
404
404
  executeWithPipeline(pipeline);
405
405
  const pipelineDone = this.deferExecution().then(() => {
406
406
  if (!this.pipelinePromises.has(pipeline)) {
@@ -412,7 +412,7 @@ var AutoPipelineExecutor = class {
412
412
  return this.pipelinePromises.get(pipeline);
413
413
  });
414
414
  const results = await pipelineDone;
415
- const commandResult = results[index];
415
+ const commandResult = results[index2];
416
416
  if (commandResult.error) {
417
417
  throw new UpstashError(`Command failed: ${commandResult.error}`);
418
418
  }
@@ -2526,55 +2526,119 @@ function flattenSchema(schema, pathPrefix = []) {
2526
2526
  }
2527
2527
  return fields;
2528
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
- });
2529
+ function deserializeQueryResponse(rawResponse, options) {
2530
+ const hasEmptySelect = options?.select && Object.keys(options.select).length === 0;
2531
+ return rawResponse.map((itemRaw) => {
2532
+ const raw = itemRaw;
2533
+ const key = raw[0];
2534
+ const score = raw[1];
2535
+ const rawFields = raw[2];
2536
+ if (hasEmptySelect) {
2537
+ return { key, score };
2538
+ }
2539
+ if (!Array.isArray(rawFields) || rawFields.length === 0) {
2540
+ return { key, score, data: {} };
2541
+ }
2542
+ const mergedFields = {};
2543
+ for (const fieldRaw of rawFields) {
2544
+ const fieldObj = kvArrayToObject(fieldRaw);
2545
+ Object.assign(mergedFields, fieldObj);
2546
+ }
2547
+ if ("$" in mergedFields) {
2548
+ const data2 = mergedFields["$"];
2549
+ return { key, score, data: data2 };
2550
+ }
2551
+ const data = dotNotationToNested(mergedFields);
2552
+ return { key, score, data };
2553
+ });
2554
+ }
2555
+ function parseFieldInfo(fieldRaw) {
2556
+ const fieldType = fieldRaw[1];
2557
+ const options = fieldRaw.slice(2);
2558
+ const fieldInfo = { type: fieldType };
2559
+ for (const option of options) {
2560
+ switch (option.toUpperCase()) {
2561
+ case "NOTOKENIZE":
2562
+ fieldInfo.noTokenize = true;
2563
+ break;
2564
+ case "NOSTEM":
2565
+ fieldInfo.noStem = true;
2566
+ break;
2567
+ case "FAST":
2568
+ fieldInfo.fast = true;
2569
+ break;
2548
2570
  }
2549
2571
  }
2550
- return results;
2572
+ return fieldInfo;
2551
2573
  }
2552
- function parseDescribeResponse(rawResponse) {
2553
- return rawResponse;
2574
+ function deserializeDescribeResponse(rawResponse) {
2575
+ const raw = kvArrayToObject(rawResponse);
2576
+ const schema = {};
2577
+ if (Array.isArray(raw.schema)) {
2578
+ for (const fieldRaw of raw.schema) {
2579
+ if (Array.isArray(fieldRaw) && fieldRaw.length >= 2) {
2580
+ const fieldName = fieldRaw[0];
2581
+ schema[fieldName] = parseFieldInfo(fieldRaw);
2582
+ }
2583
+ }
2584
+ }
2585
+ return {
2586
+ name: raw.name,
2587
+ dataType: raw.type.toLowerCase(),
2588
+ prefixes: raw.prefixes,
2589
+ ...raw.language && { language: raw.language },
2590
+ schema
2591
+ };
2554
2592
  }
2555
2593
  function parseCountResponse(rawResponse) {
2556
2594
  return typeof rawResponse === "number" ? rawResponse : parseInt(rawResponse, 10);
2557
2595
  }
2596
+ function kvArrayToObject(v) {
2597
+ if (typeof v === "object" && v !== null && !Array.isArray(v)) return v;
2598
+ if (!Array.isArray(v)) return {};
2599
+ const obj = {};
2600
+ for (let i = 0; i < v.length; i += 2) {
2601
+ if (typeof v[i] === "string") obj[v[i]] = v[i + 1];
2602
+ }
2603
+ return obj;
2604
+ }
2605
+ function dotNotationToNested(obj) {
2606
+ const result = {};
2607
+ for (const [key, value] of Object.entries(obj)) {
2608
+ const parts = key.split(".");
2609
+ let current = result;
2610
+ for (let i = 0; i < parts.length - 1; i++) {
2611
+ const part = parts[i];
2612
+ if (!(part in current)) {
2613
+ current[part] = {};
2614
+ }
2615
+ current = current[part];
2616
+ }
2617
+ current[parts[parts.length - 1]] = value;
2618
+ }
2619
+ return result;
2620
+ }
2558
2621
 
2559
2622
  // pkg/commands/search/command-builder.ts
2560
- function buildQueryCommand(redisCommand, indexName, query, options) {
2561
- const command = [redisCommand, indexName, query];
2623
+ function buildQueryCommand(redisCommand, name, options) {
2624
+ const query = JSON.stringify(options?.filter);
2625
+ const command = [redisCommand, name, query];
2562
2626
  if (options?.limit !== void 0) {
2563
2627
  command.push("LIMIT", options.limit.toString());
2564
2628
  }
2565
2629
  if (options?.offset !== void 0) {
2566
2630
  command.push("OFFSET", options.offset.toString());
2567
2631
  }
2568
- if (options?.noContent) {
2632
+ if (options?.select && Object.keys(options.select).length === 0) {
2569
2633
  command.push("NOCONTENT");
2570
2634
  }
2571
- if (options?.sortBy) {
2572
- command.push("SORTBY", options.sortBy.field);
2573
- if (options.sortBy.direction) {
2574
- command.push(options.sortBy.direction);
2575
- }
2635
+ if (options?.orderBy) {
2636
+ command.push("SORTBY");
2637
+ Object.entries(options.orderBy).forEach(([field, direction]) => {
2638
+ command.push(field, direction);
2639
+ });
2576
2640
  }
2577
- if (options && "highlight" in options && options.highlight) {
2641
+ if (options?.highlight) {
2578
2642
  command.push(
2579
2643
  "HIGHLIGHT",
2580
2644
  "FIELDS",
@@ -2585,16 +2649,20 @@ function buildQueryCommand(redisCommand, indexName, query, options) {
2585
2649
  command.push("TAGS", options.highlight.preTag, options.highlight.postTag);
2586
2650
  }
2587
2651
  }
2588
- if (options && "returnFields" in options && options.returnFields && options.returnFields.length > 0) {
2589
- command.push("RETURN", options.returnFields.length.toString(), ...options.returnFields);
2652
+ if (options?.select && Object.keys(options.select).length > 0) {
2653
+ command.push(
2654
+ "RETURN",
2655
+ Object.keys(options.select).length.toString(),
2656
+ ...Object.keys(options.select)
2657
+ );
2590
2658
  }
2591
2659
  return command;
2592
2660
  }
2593
2661
  function buildCreateIndexCommand(props) {
2594
- const { indexName, schema, dataType, prefix, language } = props;
2662
+ const { name, schema, dataType, prefix, language } = props;
2595
2663
  const prefixArray = Array.isArray(prefix) ? prefix : [prefix];
2596
2664
  const payload = [
2597
- indexName,
2665
+ name,
2598
2666
  "ON",
2599
2667
  dataType.toUpperCase(),
2600
2668
  "PREFIX",
@@ -2621,65 +2689,58 @@ function buildCreateIndexCommand(props) {
2621
2689
 
2622
2690
  // pkg/commands/search/search.ts
2623
2691
  var SearchIndex = class {
2624
- indexName;
2692
+ name;
2625
2693
  schema;
2626
2694
  client;
2627
- constructor({ indexName, schema, client }) {
2628
- this.indexName = indexName;
2695
+ constructor({ name, schema, client }) {
2696
+ this.name = name;
2629
2697
  this.schema = schema;
2630
2698
  this.client = client;
2631
2699
  }
2632
2700
  async waitIndexing() {
2633
- const command = ["SEARCH.COMMIT", this.indexName];
2701
+ const command = ["SEARCH.COMMIT", this.name];
2634
2702
  const result = await new ExecCommand(command).exec(
2635
2703
  this.client
2636
2704
  );
2637
2705
  return result;
2638
2706
  }
2639
2707
  async describe() {
2640
- const command = ["SEARCH.DESCRIBE", this.indexName];
2708
+ const command = ["SEARCH.DESCRIBE", this.name];
2641
2709
  const rawResult = await new ExecCommand(command).exec(
2642
2710
  this.client
2643
2711
  );
2644
- return parseDescribeResponse(rawResult);
2712
+ return deserializeDescribeResponse(rawResult);
2645
2713
  }
2646
2714
  async query(options) {
2647
- const queryString = JSON.stringify(options.filter);
2648
- const command = buildQueryCommand(
2649
- "SEARCH.QUERY",
2650
- this.indexName,
2651
- queryString,
2652
- options
2653
- );
2715
+ const command = buildQueryCommand("SEARCH.QUERY", this.name, options);
2654
2716
  const rawResult = await new ExecCommand(command).exec(
2655
2717
  this.client
2656
2718
  );
2657
- return parseQueryResponse(rawResult, options);
2719
+ return deserializeQueryResponse(rawResult, options);
2658
2720
  }
2659
- async count(filter) {
2660
- const queryString = JSON.stringify(filter);
2661
- const command = buildQueryCommand("SEARCH.COUNT", this.indexName, queryString);
2721
+ async count({ filter }) {
2722
+ const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
2662
2723
  const rawResult = await new ExecCommand(command).exec(
2663
2724
  this.client
2664
2725
  );
2665
- return parseCountResponse(rawResult);
2726
+ return { count: parseCountResponse(rawResult) };
2666
2727
  }
2667
2728
  async drop() {
2668
- const command = ["SEARCH.DROP", this.indexName];
2729
+ const command = ["SEARCH.DROP", this.name];
2669
2730
  const result = await new ExecCommand(command).exec(
2670
2731
  this.client
2671
2732
  );
2672
2733
  return result;
2673
2734
  }
2674
2735
  };
2675
- async function createSearchIndex(props) {
2676
- const { indexName, schema, client } = props;
2736
+ async function createIndex(props) {
2737
+ const { name, schema, client } = props;
2677
2738
  const createIndexCommand = buildCreateIndexCommand(props);
2678
2739
  await new ExecCommand(createIndexCommand).exec(client);
2679
- return getSearchIndex({ indexName, schema, client });
2740
+ return index(client, name, schema);
2680
2741
  }
2681
- function getSearchIndex(props) {
2682
- return new SearchIndex(props);
2742
+ function index(client, name, schema) {
2743
+ return new SearchIndex({ name, schema, client });
2683
2744
  }
2684
2745
 
2685
2746
  // pkg/commands/search/schema-builder.ts
@@ -2705,21 +2766,16 @@ var TextFieldBuilder = class _TextFieldBuilder {
2705
2766
  } : "TEXT";
2706
2767
  }
2707
2768
  };
2708
- var NumericFieldBuilder = class _NumericFieldBuilder {
2709
- _fast;
2769
+ var NumericFieldBuilder = class {
2710
2770
  type;
2711
- constructor(type, fast = { fast: false }) {
2771
+ constructor(type) {
2712
2772
  this.type = type;
2713
- this._fast = fast;
2714
- }
2715
- fast() {
2716
- return new _NumericFieldBuilder(this.type, { fast: true });
2717
2773
  }
2718
2774
  [BUILD]() {
2719
- return this._fast.fast ? {
2775
+ return {
2720
2776
  type: this.type,
2721
2777
  fast: true
2722
- } : this.type;
2778
+ };
2723
2779
  }
2724
2780
  };
2725
2781
  var BoolFieldBuilder = class _BoolFieldBuilder {
@@ -3326,7 +3382,7 @@ var Pipeline = class {
3326
3382
  /**
3327
3383
  * @see https://redis.io/commands/lset
3328
3384
  */
3329
- lset = (key, index, value) => this.chain(new LSetCommand([key, index, value], this.commandOptions));
3385
+ lset = (key, index2, value) => this.chain(new LSetCommand([key, index2, value], this.commandOptions));
3330
3386
  /**
3331
3387
  * @see https://redis.io/commands/ltrim
3332
3388
  */
@@ -4089,18 +4145,19 @@ var Redis = class {
4089
4145
  createScript(script, opts) {
4090
4146
  return opts?.readonly ? new ScriptRO(this, script) : new Script(this, script);
4091
4147
  }
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
- };
4148
+ get search() {
4149
+ return {
4150
+ createIndex: (props) => {
4151
+ return createIndex({
4152
+ ...props,
4153
+ client: this.client
4154
+ });
4155
+ },
4156
+ index: (name, schema) => {
4157
+ return index(this.client, name, schema);
4158
+ }
4159
+ };
4160
+ }
4104
4161
  /**
4105
4162
  * Create a new pipeline that allows you to send requests in bulk.
4106
4163
  *
@@ -4437,7 +4494,7 @@ var Redis = class {
4437
4494
  /**
4438
4495
  * @see https://redis.io/commands/lset
4439
4496
  */
4440
- lset = (key, index, value) => new LSetCommand([key, index, value], this.opts).exec(this.client);
4497
+ lset = (key, index2, value) => new LSetCommand([key, index2, value], this.opts).exec(this.client);
4441
4498
  /**
4442
4499
  * @see https://redis.io/commands/ltrim
4443
4500
  */
@@ -4808,7 +4865,7 @@ var Redis = class {
4808
4865
  };
4809
4866
 
4810
4867
  // version.ts
4811
- var VERSION = "v1.36.0-rc.2";
4868
+ var VERSION = "v1.36.0-rc.3";
4812
4869
 
4813
4870
  // platforms/fastly.ts
4814
4871
  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-TU3ADD2M.mjs";
6
+ } from "./chunk-2HN5OIX5.mjs";
7
7
 
8
8
  // platforms/fastly.ts
9
9
  var Redis2 = class extends Redis {
package/nodejs.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NestedIndexSchema, H as HttpClientConfig, R as RedisOptions, a as RequesterConfig, b as Redis$1, c as Requester } from './zmscore-DPwiA5Z8.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-DPwiA5Z8.mjs';
1
+ import { N as NumericField, a as NestedIndexSchema, H as HttpClientConfig, R as RedisOptions, b as RequesterConfig, c as Redis$1, d as Requester } from './zmscore-DQw_6S0p.mjs';
2
+ export { A as AppendCommand, B as BitCountCommand, g as BitOpCommand, h as BitPosCommand, C as CopyCommand, D as DBSizeCommand, j as DecrByCommand, i as DecrCommand, k as DelCommand, E as EchoCommand, m as EvalCommand, l as EvalROCommand, o as EvalshaCommand, n as EvalshaROCommand, p as ExistsCommand, s as ExpireAtCommand, q as ExpireCommand, r as ExpireOption, c8 as FlatIndexSchema, F as FlushAllCommand, t as FlushDBCommand, G as GeoAddCommand, u as GeoAddCommandOptions, w as GeoDistCommand, x as GeoHashCommand, v as GeoMember, y as GeoPosCommand, z as GeoSearchCommand, I as GeoSearchStoreCommand, K as GetBitCommand, J as GetCommand, L as GetDelCommand, M as GetExCommand, O as GetRangeCommand, Q as GetSetCommand, S as HDelCommand, T as HExistsCommand, W as HExpireAtCommand, V as HExpireCommand, X as HExpireTimeCommand, a3 as HGetAllCommand, a2 as HGetCommand, a4 as HIncrByCommand, a5 as HIncrByFloatCommand, a6 as HKeysCommand, a7 as HLenCommand, a8 as HMGetCommand, a9 as HMSetCommand, _ as HPExpireAtCommand, Z as HPExpireCommand, $ as HPExpireTimeCommand, a0 as HPTtlCommand, a1 as HPersistCommand, aa as HRandFieldCommand, ab as HScanCommand, ac as HSetCommand, ad as HSetNXCommand, ae as HStrLenCommand, Y as HTtlCommand, af as HValsCommand, ah as IncrByCommand, ai as IncrByFloatCommand, ag as IncrCommand, aj as JsonArrAppendCommand, ak as JsonArrIndexCommand, al as JsonArrInsertCommand, am as JsonArrLenCommand, an as JsonArrPopCommand, ao as JsonArrTrimCommand, ap as JsonClearCommand, aq as JsonDelCommand, ar as JsonForgetCommand, as as JsonGetCommand, au as JsonMGetCommand, at as JsonMergeCommand, av as JsonNumIncrByCommand, aw as JsonNumMultByCommand, ax as JsonObjKeysCommand, ay as JsonObjLenCommand, az as JsonRespCommand, aA as JsonSetCommand, aB as JsonStrAppendCommand, aC as JsonStrLenCommand, aD as JsonToggleCommand, aE as JsonTypeCommand, aF as KeysCommand, aG as LIndexCommand, aH as LInsertCommand, aI as LLenCommand, aJ as LMoveCommand, aK as LPopCommand, aL as LPushCommand, aM as LPushXCommand, aN as LRangeCommand, aO as LRemCommand, aP as LSetCommand, aQ as LTrimCommand, aR as MGetCommand, aS as MSetCommand, aT as MSetNXCommand, aW as PExpireAtCommand, aV as PExpireCommand, aY as PSetEXCommand, aZ as PTtlCommand, aU as PersistCommand, aX as PingCommand, P as Pipeline, a_ as PublishCommand, b2 as RPopCommand, b3 as RPushCommand, b4 as RPushXCommand, a$ as RandomKeyCommand, b0 as RenameCommand, b1 as RenameNXCommand, b5 as SAddCommand, b8 as SCardCommand, bc as SDiffCommand, bd as SDiffStoreCommand, bk as SInterCommand, bl as SInterStoreCommand, bm as SIsMemberCommand, bo as SMIsMemberCommand, bn as SMembersCommand, bp as SMoveCommand, bq as SPopCommand, br as SRandMemberCommand, bs as SRemCommand, bt as SScanCommand, bv as SUnionCommand, bw as SUnionStoreCommand, b6 as ScanCommand, b7 as ScanCommandOptions, bF as ScoreMember, b9 as ScriptExistsCommand, ba as ScriptFlushCommand, bb as ScriptLoadCommand, c6 as SearchIndexProps, bg as SetBitCommand, be as SetCommand, bf as SetCommandOptions, bh as SetExCommand, bi as SetNxCommand, bj as SetRangeCommand, bu as StrLenCommand, bx as TimeCommand, by as TouchCommand, bz as TtlCommand, bA as Type, bB as TypeCommand, bC as UnlinkCommand, U as UpstashRequest, f as UpstashResponse, bD as XAddCommand, bE as XRangeCommand, bH as ZAddCommand, bG as ZAddCommandOptions, bI as ZCardCommand, bJ as ZCountCommand, bK as ZDiffStoreCommand, bL as ZIncrByCommand, bM as ZInterStoreCommand, bN as ZInterStoreCommandOptions, bO as ZLexCountCommand, bP as ZMScoreCommand, bQ as ZPopMaxCommand, bR as ZPopMinCommand, bS as ZRangeCommand, bT as ZRangeCommandOptions, bU as ZRankCommand, bV as ZRemCommand, bW as ZRemRangeByLexCommand, bX as ZRemRangeByRankCommand, bY as ZRemRangeByScoreCommand, bZ as ZRevRankCommand, b_ as ZScanCommand, b$ as ZScoreCommand, c0 as ZUnionCommand, c1 as ZUnionCommandOptions, c2 as ZUnionStoreCommand, c3 as ZUnionStoreCommandOptions, c4 as createIndex, c7 as createIndexProps, e as errors, c5 as index } from './zmscore-DQw_6S0p.mjs';
3
3
 
4
4
  declare const BUILD: unique symbol;
5
5
  declare class TextFieldBuilder<NoTokenize extends Record<"noTokenize", boolean> = {
@@ -34,21 +34,13 @@ declare class TextFieldBuilder<NoTokenize extends Record<"noTokenize", boolean>
34
34
  noStem: true;
35
35
  } : "TEXT";
36
36
  }
37
- declare class NumericFieldBuilder<T extends "U64" | "I64" | "F64", Fast extends Record<"fast", boolean> = {
38
- fast: false;
39
- }> {
40
- private _fast;
37
+ declare class NumericFieldBuilder<T extends NumericField["type"]> {
41
38
  private type;
42
- constructor(type: T, fast?: Fast);
43
- fast(): NumericFieldBuilder<T, {
44
- fast: true;
45
- }>;
46
- [BUILD](): Fast extends {
47
- fast: true;
48
- } ? {
39
+ constructor(type: T);
40
+ [BUILD](): {
49
41
  type: T;
50
42
  fast: true;
51
- } : T;
43
+ };
52
44
  }
53
45
  declare class BoolFieldBuilder<Fast extends Record<"fast", boolean> = {
54
46
  fast: false;
@@ -84,70 +76,16 @@ type FieldBuilder = TextFieldBuilder<{
84
76
  noTokenize: boolean;
85
77
  }, {
86
78
  noStem: boolean;
87
- }> | NumericFieldBuilder<"U64" | "I64" | "F64", {
88
- fast: boolean;
89
- }> | BoolFieldBuilder<{
79
+ }> | NumericFieldBuilder<NumericField["type"]> | BoolFieldBuilder<{
90
80
  fast: boolean;
91
81
  }> | DateFieldBuilder<{
92
82
  fast: boolean;
93
83
  }>;
94
84
  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
- */
85
+ string(): TextFieldBuilder;
86
+ number<T extends NumericField["type"] = "F64">(type?: T): NumericFieldBuilder<T>;
87
+ boolean(): BoolFieldBuilder;
139
88
  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
89
  object<T extends ObjectFieldRecord<T>>(fields: T): { [K in keyof T]: T[K] extends FieldBuilder ? ReturnType<T[K][typeof BUILD]> : T[K]; };
152
90
  };
153
91
  type ObjectFieldRecord<T> = {
package/nodejs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as NestedIndexSchema, H as HttpClientConfig, R as RedisOptions, a as RequesterConfig, b as Redis$1, c as Requester } from './zmscore-DPwiA5Z8.js';
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-DPwiA5Z8.js';
1
+ import { N as NumericField, a as NestedIndexSchema, H as HttpClientConfig, R as RedisOptions, b as RequesterConfig, c as Redis$1, d as Requester } from './zmscore-DQw_6S0p.js';
2
+ export { A as AppendCommand, B as BitCountCommand, g as BitOpCommand, h as BitPosCommand, C as CopyCommand, D as DBSizeCommand, j as DecrByCommand, i as DecrCommand, k as DelCommand, E as EchoCommand, m as EvalCommand, l as EvalROCommand, o as EvalshaCommand, n as EvalshaROCommand, p as ExistsCommand, s as ExpireAtCommand, q as ExpireCommand, r as ExpireOption, c8 as FlatIndexSchema, F as FlushAllCommand, t as FlushDBCommand, G as GeoAddCommand, u as GeoAddCommandOptions, w as GeoDistCommand, x as GeoHashCommand, v as GeoMember, y as GeoPosCommand, z as GeoSearchCommand, I as GeoSearchStoreCommand, K as GetBitCommand, J as GetCommand, L as GetDelCommand, M as GetExCommand, O as GetRangeCommand, Q as GetSetCommand, S as HDelCommand, T as HExistsCommand, W as HExpireAtCommand, V as HExpireCommand, X as HExpireTimeCommand, a3 as HGetAllCommand, a2 as HGetCommand, a4 as HIncrByCommand, a5 as HIncrByFloatCommand, a6 as HKeysCommand, a7 as HLenCommand, a8 as HMGetCommand, a9 as HMSetCommand, _ as HPExpireAtCommand, Z as HPExpireCommand, $ as HPExpireTimeCommand, a0 as HPTtlCommand, a1 as HPersistCommand, aa as HRandFieldCommand, ab as HScanCommand, ac as HSetCommand, ad as HSetNXCommand, ae as HStrLenCommand, Y as HTtlCommand, af as HValsCommand, ah as IncrByCommand, ai as IncrByFloatCommand, ag as IncrCommand, aj as JsonArrAppendCommand, ak as JsonArrIndexCommand, al as JsonArrInsertCommand, am as JsonArrLenCommand, an as JsonArrPopCommand, ao as JsonArrTrimCommand, ap as JsonClearCommand, aq as JsonDelCommand, ar as JsonForgetCommand, as as JsonGetCommand, au as JsonMGetCommand, at as JsonMergeCommand, av as JsonNumIncrByCommand, aw as JsonNumMultByCommand, ax as JsonObjKeysCommand, ay as JsonObjLenCommand, az as JsonRespCommand, aA as JsonSetCommand, aB as JsonStrAppendCommand, aC as JsonStrLenCommand, aD as JsonToggleCommand, aE as JsonTypeCommand, aF as KeysCommand, aG as LIndexCommand, aH as LInsertCommand, aI as LLenCommand, aJ as LMoveCommand, aK as LPopCommand, aL as LPushCommand, aM as LPushXCommand, aN as LRangeCommand, aO as LRemCommand, aP as LSetCommand, aQ as LTrimCommand, aR as MGetCommand, aS as MSetCommand, aT as MSetNXCommand, aW as PExpireAtCommand, aV as PExpireCommand, aY as PSetEXCommand, aZ as PTtlCommand, aU as PersistCommand, aX as PingCommand, P as Pipeline, a_ as PublishCommand, b2 as RPopCommand, b3 as RPushCommand, b4 as RPushXCommand, a$ as RandomKeyCommand, b0 as RenameCommand, b1 as RenameNXCommand, b5 as SAddCommand, b8 as SCardCommand, bc as SDiffCommand, bd as SDiffStoreCommand, bk as SInterCommand, bl as SInterStoreCommand, bm as SIsMemberCommand, bo as SMIsMemberCommand, bn as SMembersCommand, bp as SMoveCommand, bq as SPopCommand, br as SRandMemberCommand, bs as SRemCommand, bt as SScanCommand, bv as SUnionCommand, bw as SUnionStoreCommand, b6 as ScanCommand, b7 as ScanCommandOptions, bF as ScoreMember, b9 as ScriptExistsCommand, ba as ScriptFlushCommand, bb as ScriptLoadCommand, c6 as SearchIndexProps, bg as SetBitCommand, be as SetCommand, bf as SetCommandOptions, bh as SetExCommand, bi as SetNxCommand, bj as SetRangeCommand, bu as StrLenCommand, bx as TimeCommand, by as TouchCommand, bz as TtlCommand, bA as Type, bB as TypeCommand, bC as UnlinkCommand, U as UpstashRequest, f as UpstashResponse, bD as XAddCommand, bE as XRangeCommand, bH as ZAddCommand, bG as ZAddCommandOptions, bI as ZCardCommand, bJ as ZCountCommand, bK as ZDiffStoreCommand, bL as ZIncrByCommand, bM as ZInterStoreCommand, bN as ZInterStoreCommandOptions, bO as ZLexCountCommand, bP as ZMScoreCommand, bQ as ZPopMaxCommand, bR as ZPopMinCommand, bS as ZRangeCommand, bT as ZRangeCommandOptions, bU as ZRankCommand, bV as ZRemCommand, bW as ZRemRangeByLexCommand, bX as ZRemRangeByRankCommand, bY as ZRemRangeByScoreCommand, bZ as ZRevRankCommand, b_ as ZScanCommand, b$ as ZScoreCommand, c0 as ZUnionCommand, c1 as ZUnionCommandOptions, c2 as ZUnionStoreCommand, c3 as ZUnionStoreCommandOptions, c4 as createIndex, c7 as createIndexProps, e as errors, c5 as index } from './zmscore-DQw_6S0p.js';
3
3
 
4
4
  declare const BUILD: unique symbol;
5
5
  declare class TextFieldBuilder<NoTokenize extends Record<"noTokenize", boolean> = {
@@ -34,21 +34,13 @@ declare class TextFieldBuilder<NoTokenize extends Record<"noTokenize", boolean>
34
34
  noStem: true;
35
35
  } : "TEXT";
36
36
  }
37
- declare class NumericFieldBuilder<T extends "U64" | "I64" | "F64", Fast extends Record<"fast", boolean> = {
38
- fast: false;
39
- }> {
40
- private _fast;
37
+ declare class NumericFieldBuilder<T extends NumericField["type"]> {
41
38
  private type;
42
- constructor(type: T, fast?: Fast);
43
- fast(): NumericFieldBuilder<T, {
44
- fast: true;
45
- }>;
46
- [BUILD](): Fast extends {
47
- fast: true;
48
- } ? {
39
+ constructor(type: T);
40
+ [BUILD](): {
49
41
  type: T;
50
42
  fast: true;
51
- } : T;
43
+ };
52
44
  }
53
45
  declare class BoolFieldBuilder<Fast extends Record<"fast", boolean> = {
54
46
  fast: false;
@@ -84,70 +76,16 @@ type FieldBuilder = TextFieldBuilder<{
84
76
  noTokenize: boolean;
85
77
  }, {
86
78
  noStem: boolean;
87
- }> | NumericFieldBuilder<"U64" | "I64" | "F64", {
88
- fast: boolean;
89
- }> | BoolFieldBuilder<{
79
+ }> | NumericFieldBuilder<NumericField["type"]> | BoolFieldBuilder<{
90
80
  fast: boolean;
91
81
  }> | DateFieldBuilder<{
92
82
  fast: boolean;
93
83
  }>;
94
84
  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
- */
85
+ string(): TextFieldBuilder;
86
+ number<T extends NumericField["type"] = "F64">(type?: T): NumericFieldBuilder<T>;
87
+ boolean(): BoolFieldBuilder;
139
88
  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
89
  object<T extends ObjectFieldRecord<T>>(fields: T): { [K in keyof T]: T[K] extends FieldBuilder ? ReturnType<T[K][typeof BUILD]> : T[K]; };
152
90
  };
153
91
  type ObjectFieldRecord<T> = {