@upstash/redis 1.36.0-rc.4 → 1.36.0-rc.6

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.
@@ -424,102 +424,104 @@ function flattenSchema(schema, pathPrefix = []) {
424
424
  }
425
425
  return fields;
426
426
  }
427
- function deserializeQueryResponse(rawResponse, options) {
428
- const hasEmptySelect = options?.select && Object.keys(options.select).length === 0;
427
+ function deserializeQueryResponse(rawResponse) {
429
428
  return rawResponse.map((itemRaw) => {
430
429
  const raw = itemRaw;
431
430
  const key = raw[0];
432
431
  const score = raw[1];
433
432
  const rawFields = raw[2];
434
- if (hasEmptySelect) {
433
+ if (rawFields === void 0) {
435
434
  return { key, score };
436
435
  }
437
436
  if (!Array.isArray(rawFields) || rawFields.length === 0) {
438
437
  return { key, score, data: {} };
439
438
  }
440
- const mergedFields = {};
439
+ let data = {};
441
440
  for (const fieldRaw of rawFields) {
442
- const fieldObj = kvArrayToObject(fieldRaw);
443
- Object.assign(mergedFields, fieldObj);
441
+ const key2 = fieldRaw[0];
442
+ const value = fieldRaw[1];
443
+ const pathParts = key2.split(".");
444
+ if (pathParts.length == 1) {
445
+ data[key2] = value;
446
+ } else {
447
+ let currentObj = data;
448
+ for (let i = 0; i < pathParts.length - 1; i++) {
449
+ const pathPart = pathParts[i];
450
+ if (!(pathPart in currentObj)) {
451
+ currentObj[pathPart] = {};
452
+ }
453
+ currentObj = currentObj[pathPart];
454
+ }
455
+ currentObj[pathParts.at(-1)] = value;
456
+ }
444
457
  }
445
- if ("$" in mergedFields) {
446
- const data2 = mergedFields["$"];
447
- return { key, score, data: data2 };
458
+ if ("$" in data) {
459
+ data = data["$"];
448
460
  }
449
- const data = dotNotationToNested(mergedFields);
450
461
  return { key, score, data };
451
462
  });
452
463
  }
453
- function parseFieldInfo(fieldRaw) {
454
- const fieldType = fieldRaw[1];
455
- const options = fieldRaw.slice(2);
456
- const fieldInfo = { type: fieldType };
457
- for (const option of options) {
458
- switch (option.toUpperCase()) {
459
- case "NOTOKENIZE":
460
- fieldInfo.noTokenize = true;
464
+ function deserializeDescribeResponse(rawResponse) {
465
+ const description = {};
466
+ for (let i = 0; i < rawResponse.length; i += 2) {
467
+ const descriptor = rawResponse[i];
468
+ switch (descriptor) {
469
+ case "name": {
470
+ description["name"] = rawResponse[i + 1];
461
471
  break;
462
- case "NOSTEM":
463
- fieldInfo.noStem = true;
472
+ }
473
+ case "type": {
474
+ description["dataType"] = rawResponse[i + 1].toLowerCase();
464
475
  break;
465
- case "FAST":
466
- fieldInfo.fast = true;
476
+ }
477
+ case "prefixes": {
478
+ description["prefixes"] = rawResponse[i + 1];
479
+ break;
480
+ }
481
+ case "language": {
482
+ description["language"] = rawResponse[i + 1];
483
+ break;
484
+ }
485
+ case "schema": {
486
+ const schema = {};
487
+ for (const fieldDescription of rawResponse[i + 1]) {
488
+ const fieldName = fieldDescription[0];
489
+ const fieldInfo = { type: fieldDescription[1] };
490
+ if (fieldDescription.length > 2) {
491
+ for (let j = 2; j < fieldDescription.length; j++) {
492
+ const fieldOption = fieldDescription[j];
493
+ switch (fieldOption) {
494
+ case "NOSTEM": {
495
+ fieldInfo.noStem = true;
496
+ break;
497
+ }
498
+ case "NOTOKENIZE": {
499
+ fieldInfo.noTokenize = true;
500
+ break;
501
+ }
502
+ case "FAST": {
503
+ fieldInfo.fast = true;
504
+ break;
505
+ }
506
+ }
507
+ }
508
+ }
509
+ schema[fieldName] = fieldInfo;
510
+ }
511
+ description["schema"] = schema;
467
512
  break;
468
- }
469
- }
470
- return fieldInfo;
471
- }
472
- function deserializeDescribeResponse(rawResponse) {
473
- const raw = kvArrayToObject(rawResponse);
474
- const schema = {};
475
- if (Array.isArray(raw.schema)) {
476
- for (const fieldRaw of raw.schema) {
477
- if (Array.isArray(fieldRaw) && fieldRaw.length >= 2) {
478
- const fieldName = fieldRaw[0];
479
- schema[fieldName] = parseFieldInfo(fieldRaw);
480
513
  }
481
514
  }
482
515
  }
483
- return {
484
- name: raw.name,
485
- dataType: raw.type.toLowerCase(),
486
- prefixes: raw.prefixes,
487
- ...raw.language && { language: raw.language },
488
- schema
489
- };
516
+ return description;
490
517
  }
491
518
  function parseCountResponse(rawResponse) {
492
- return typeof rawResponse === "number" ? rawResponse : parseInt(rawResponse, 10);
493
- }
494
- function kvArrayToObject(v) {
495
- if (typeof v === "object" && v !== null && !Array.isArray(v)) return v;
496
- if (!Array.isArray(v)) return {};
497
- const obj = {};
498
- for (let i = 0; i < v.length; i += 2) {
499
- if (typeof v[i] === "string") obj[v[i]] = v[i + 1];
500
- }
501
- return obj;
502
- }
503
- function dotNotationToNested(obj) {
504
- const result = {};
505
- for (const [key, value] of Object.entries(obj)) {
506
- const parts = key.split(".");
507
- let current = result;
508
- for (let i = 0; i < parts.length - 1; i++) {
509
- const part = parts[i];
510
- if (!(part in current)) {
511
- current[part] = {};
512
- }
513
- current = current[part];
514
- }
515
- current[parts[parts.length - 1]] = value;
516
- }
517
- return result;
519
+ return typeof rawResponse === "number" ? rawResponse : Number.parseInt(rawResponse, 10);
518
520
  }
519
521
 
520
522
  // pkg/commands/search/command-builder.ts
521
523
  function buildQueryCommand(redisCommand, name, options) {
522
- const query = JSON.stringify(options?.filter);
524
+ const query = JSON.stringify(options?.filter ?? {});
523
525
  const command = [redisCommand, name, query];
524
526
  if (options?.limit !== void 0) {
525
527
  command.push("LIMIT", options.limit.toString());
@@ -532,9 +534,9 @@ function buildQueryCommand(redisCommand, name, options) {
532
534
  }
533
535
  if (options?.orderBy) {
534
536
  command.push("SORTBY");
535
- Object.entries(options.orderBy).forEach(([field, direction]) => {
537
+ for (const [field, direction] of Object.entries(options.orderBy)) {
536
538
  command.push(field, direction);
537
- });
539
+ }
538
540
  }
539
541
  if (options?.highlight) {
540
542
  command.push(
@@ -596,7 +598,7 @@ var SearchIndex = class {
596
598
  this.client = client;
597
599
  }
598
600
  async waitIndexing() {
599
- const command = ["SEARCH.COMMIT", this.name];
601
+ const command = ["SEARCH.WAITINDEXING", this.name];
600
602
  const result = await new ExecCommand(command).exec(
601
603
  this.client
602
604
  );
@@ -614,7 +616,7 @@ var SearchIndex = class {
614
616
  const rawResult = await new ExecCommand(command).exec(
615
617
  this.client
616
618
  );
617
- return deserializeQueryResponse(rawResult, options);
619
+ return deserializeQueryResponse(rawResult);
618
620
  }
619
621
  async count({ filter }) {
620
622
  const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
@@ -4869,7 +4871,7 @@ var Redis = class {
4869
4871
  };
4870
4872
 
4871
4873
  // version.ts
4872
- var VERSION = "v1.36.0-rc.4";
4874
+ var VERSION = "v1.36.0-rc.6";
4873
4875
 
4874
4876
  export {
4875
4877
  error_exports,
package/cloudflare.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HttpClientConfig, R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-BfRVhSFL.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-BfRVhSFL.mjs';
1
+ import { H as HttpClientConfig, R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-y7M52X1J.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-y7M52X1J.mjs';
3
3
 
4
4
  type Env = {
5
5
  UPSTASH_DISABLE_TELEMETRY?: string;
package/cloudflare.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HttpClientConfig, R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-BfRVhSFL.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-BfRVhSFL.js';
1
+ import { H as HttpClientConfig, R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-y7M52X1J.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-y7M52X1J.js';
3
3
 
4
4
  type Env = {
5
5
  UPSTASH_DISABLE_TELEMETRY?: string;
package/cloudflare.js CHANGED
@@ -2526,102 +2526,104 @@ function flattenSchema(schema, pathPrefix = []) {
2526
2526
  }
2527
2527
  return fields;
2528
2528
  }
2529
- function deserializeQueryResponse(rawResponse, options) {
2530
- const hasEmptySelect = options?.select && Object.keys(options.select).length === 0;
2529
+ function deserializeQueryResponse(rawResponse) {
2531
2530
  return rawResponse.map((itemRaw) => {
2532
2531
  const raw = itemRaw;
2533
2532
  const key = raw[0];
2534
2533
  const score = raw[1];
2535
2534
  const rawFields = raw[2];
2536
- if (hasEmptySelect) {
2535
+ if (rawFields === void 0) {
2537
2536
  return { key, score };
2538
2537
  }
2539
2538
  if (!Array.isArray(rawFields) || rawFields.length === 0) {
2540
2539
  return { key, score, data: {} };
2541
2540
  }
2542
- const mergedFields = {};
2541
+ let data = {};
2543
2542
  for (const fieldRaw of rawFields) {
2544
- const fieldObj = kvArrayToObject(fieldRaw);
2545
- Object.assign(mergedFields, fieldObj);
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
+ }
2546
2559
  }
2547
- if ("$" in mergedFields) {
2548
- const data2 = mergedFields["$"];
2549
- return { key, score, data: data2 };
2560
+ if ("$" in data) {
2561
+ data = data["$"];
2550
2562
  }
2551
- const data = dotNotationToNested(mergedFields);
2552
2563
  return { key, score, data };
2553
2564
  });
2554
2565
  }
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;
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];
2563
2573
  break;
2564
- case "NOSTEM":
2565
- fieldInfo.noStem = true;
2574
+ }
2575
+ case "type": {
2576
+ description["dataType"] = rawResponse[i + 1].toLowerCase();
2566
2577
  break;
2567
- case "FAST":
2568
- fieldInfo.fast = true;
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;
2569
2614
  break;
2570
- }
2571
- }
2572
- return fieldInfo;
2573
- }
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
2615
  }
2583
2616
  }
2584
2617
  }
2585
- return {
2586
- name: raw.name,
2587
- dataType: raw.type.toLowerCase(),
2588
- prefixes: raw.prefixes,
2589
- ...raw.language && { language: raw.language },
2590
- schema
2591
- };
2618
+ return description;
2592
2619
  }
2593
2620
  function parseCountResponse(rawResponse) {
2594
- return typeof rawResponse === "number" ? rawResponse : parseInt(rawResponse, 10);
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;
2621
+ return typeof rawResponse === "number" ? rawResponse : Number.parseInt(rawResponse, 10);
2620
2622
  }
2621
2623
 
2622
2624
  // pkg/commands/search/command-builder.ts
2623
2625
  function buildQueryCommand(redisCommand, name, options) {
2624
- const query = JSON.stringify(options?.filter);
2626
+ const query = JSON.stringify(options?.filter ?? {});
2625
2627
  const command = [redisCommand, name, query];
2626
2628
  if (options?.limit !== void 0) {
2627
2629
  command.push("LIMIT", options.limit.toString());
@@ -2634,9 +2636,9 @@ function buildQueryCommand(redisCommand, name, options) {
2634
2636
  }
2635
2637
  if (options?.orderBy) {
2636
2638
  command.push("SORTBY");
2637
- Object.entries(options.orderBy).forEach(([field, direction]) => {
2639
+ for (const [field, direction] of Object.entries(options.orderBy)) {
2638
2640
  command.push(field, direction);
2639
- });
2641
+ }
2640
2642
  }
2641
2643
  if (options?.highlight) {
2642
2644
  command.push(
@@ -2698,7 +2700,7 @@ var SearchIndex = class {
2698
2700
  this.client = client;
2699
2701
  }
2700
2702
  async waitIndexing() {
2701
- const command = ["SEARCH.COMMIT", this.name];
2703
+ const command = ["SEARCH.WAITINDEXING", this.name];
2702
2704
  const result = await new ExecCommand(command).exec(
2703
2705
  this.client
2704
2706
  );
@@ -2716,7 +2718,7 @@ var SearchIndex = class {
2716
2718
  const rawResult = await new ExecCommand(command).exec(
2717
2719
  this.client
2718
2720
  );
2719
- return deserializeQueryResponse(rawResult, options);
2721
+ return deserializeQueryResponse(rawResult);
2720
2722
  }
2721
2723
  async count({ filter }) {
2722
2724
  const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
@@ -4865,7 +4867,7 @@ var Redis = class {
4865
4867
  };
4866
4868
 
4867
4869
  // version.ts
4868
- var VERSION = "v1.36.0-rc.4";
4870
+ var VERSION = "v1.36.0-rc.6";
4869
4871
 
4870
4872
  // platforms/cloudflare.ts
4871
4873
  var Redis2 = class _Redis extends Redis {
package/cloudflare.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-P45C5Z47.mjs";
6
+ } from "./chunk-6HWD2E2U.mjs";
7
7
 
8
8
  // platforms/cloudflare.ts
9
9
  var Redis2 = class _Redis extends Redis {
package/fastly.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-BfRVhSFL.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-BfRVhSFL.mjs';
1
+ import { R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-y7M52X1J.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-y7M52X1J.mjs';
3
3
 
4
4
  /**
5
5
  * Connection credentials for upstash redis.
package/fastly.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-BfRVhSFL.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-BfRVhSFL.js';
1
+ import { R as RedisOptions, b as RequesterConfig, c as Redis$1 } from './zmscore-y7M52X1J.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, 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, d as Requester, 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, 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, e as errors } from './zmscore-y7M52X1J.js';
3
3
 
4
4
  /**
5
5
  * Connection credentials for upstash redis.
package/fastly.js CHANGED
@@ -2526,102 +2526,104 @@ function flattenSchema(schema, pathPrefix = []) {
2526
2526
  }
2527
2527
  return fields;
2528
2528
  }
2529
- function deserializeQueryResponse(rawResponse, options) {
2530
- const hasEmptySelect = options?.select && Object.keys(options.select).length === 0;
2529
+ function deserializeQueryResponse(rawResponse) {
2531
2530
  return rawResponse.map((itemRaw) => {
2532
2531
  const raw = itemRaw;
2533
2532
  const key = raw[0];
2534
2533
  const score = raw[1];
2535
2534
  const rawFields = raw[2];
2536
- if (hasEmptySelect) {
2535
+ if (rawFields === void 0) {
2537
2536
  return { key, score };
2538
2537
  }
2539
2538
  if (!Array.isArray(rawFields) || rawFields.length === 0) {
2540
2539
  return { key, score, data: {} };
2541
2540
  }
2542
- const mergedFields = {};
2541
+ let data = {};
2543
2542
  for (const fieldRaw of rawFields) {
2544
- const fieldObj = kvArrayToObject(fieldRaw);
2545
- Object.assign(mergedFields, fieldObj);
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
+ }
2546
2559
  }
2547
- if ("$" in mergedFields) {
2548
- const data2 = mergedFields["$"];
2549
- return { key, score, data: data2 };
2560
+ if ("$" in data) {
2561
+ data = data["$"];
2550
2562
  }
2551
- const data = dotNotationToNested(mergedFields);
2552
2563
  return { key, score, data };
2553
2564
  });
2554
2565
  }
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;
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];
2563
2573
  break;
2564
- case "NOSTEM":
2565
- fieldInfo.noStem = true;
2574
+ }
2575
+ case "type": {
2576
+ description["dataType"] = rawResponse[i + 1].toLowerCase();
2566
2577
  break;
2567
- case "FAST":
2568
- fieldInfo.fast = true;
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;
2569
2614
  break;
2570
- }
2571
- }
2572
- return fieldInfo;
2573
- }
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
2615
  }
2583
2616
  }
2584
2617
  }
2585
- return {
2586
- name: raw.name,
2587
- dataType: raw.type.toLowerCase(),
2588
- prefixes: raw.prefixes,
2589
- ...raw.language && { language: raw.language },
2590
- schema
2591
- };
2618
+ return description;
2592
2619
  }
2593
2620
  function parseCountResponse(rawResponse) {
2594
- return typeof rawResponse === "number" ? rawResponse : parseInt(rawResponse, 10);
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;
2621
+ return typeof rawResponse === "number" ? rawResponse : Number.parseInt(rawResponse, 10);
2620
2622
  }
2621
2623
 
2622
2624
  // pkg/commands/search/command-builder.ts
2623
2625
  function buildQueryCommand(redisCommand, name, options) {
2624
- const query = JSON.stringify(options?.filter);
2626
+ const query = JSON.stringify(options?.filter ?? {});
2625
2627
  const command = [redisCommand, name, query];
2626
2628
  if (options?.limit !== void 0) {
2627
2629
  command.push("LIMIT", options.limit.toString());
@@ -2634,9 +2636,9 @@ function buildQueryCommand(redisCommand, name, options) {
2634
2636
  }
2635
2637
  if (options?.orderBy) {
2636
2638
  command.push("SORTBY");
2637
- Object.entries(options.orderBy).forEach(([field, direction]) => {
2639
+ for (const [field, direction] of Object.entries(options.orderBy)) {
2638
2640
  command.push(field, direction);
2639
- });
2641
+ }
2640
2642
  }
2641
2643
  if (options?.highlight) {
2642
2644
  command.push(
@@ -2698,7 +2700,7 @@ var SearchIndex = class {
2698
2700
  this.client = client;
2699
2701
  }
2700
2702
  async waitIndexing() {
2701
- const command = ["SEARCH.COMMIT", this.name];
2703
+ const command = ["SEARCH.WAITINDEXING", this.name];
2702
2704
  const result = await new ExecCommand(command).exec(
2703
2705
  this.client
2704
2706
  );
@@ -2716,7 +2718,7 @@ var SearchIndex = class {
2716
2718
  const rawResult = await new ExecCommand(command).exec(
2717
2719
  this.client
2718
2720
  );
2719
- return deserializeQueryResponse(rawResult, options);
2721
+ return deserializeQueryResponse(rawResult);
2720
2722
  }
2721
2723
  async count({ filter }) {
2722
2724
  const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
@@ -4865,7 +4867,7 @@ var Redis = class {
4865
4867
  };
4866
4868
 
4867
4869
  // version.ts
4868
- var VERSION = "v1.36.0-rc.4";
4870
+ var VERSION = "v1.36.0-rc.6";
4869
4871
 
4870
4872
  // platforms/fastly.ts
4871
4873
  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-P45C5Z47.mjs";
6
+ } from "./chunk-6HWD2E2U.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 NumericField, a as NestedIndexSchema, H as HttpClientConfig, R as RedisOptions, b as RequesterConfig, c as Redis$1, d as Requester } from './zmscore-BfRVhSFL.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-BfRVhSFL.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-y7M52X1J.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-y7M52X1J.mjs';
3
3
 
4
4
  declare const BUILD: unique symbol;
5
5
  declare class TextFieldBuilder<NoTokenize extends Record<"noTokenize", boolean> = {
package/nodejs.d.ts CHANGED
@@ -1,5 +1,5 @@
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-BfRVhSFL.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-BfRVhSFL.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-y7M52X1J.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-y7M52X1J.js';
3
3
 
4
4
  declare const BUILD: unique symbol;
5
5
  declare class TextFieldBuilder<NoTokenize extends Record<"noTokenize", boolean> = {
package/nodejs.js CHANGED
@@ -2529,102 +2529,104 @@ function flattenSchema(schema, pathPrefix = []) {
2529
2529
  }
2530
2530
  return fields;
2531
2531
  }
2532
- function deserializeQueryResponse(rawResponse, options) {
2533
- const hasEmptySelect = options?.select && Object.keys(options.select).length === 0;
2532
+ function deserializeQueryResponse(rawResponse) {
2534
2533
  return rawResponse.map((itemRaw) => {
2535
2534
  const raw = itemRaw;
2536
2535
  const key = raw[0];
2537
2536
  const score = raw[1];
2538
2537
  const rawFields = raw[2];
2539
- if (hasEmptySelect) {
2538
+ if (rawFields === void 0) {
2540
2539
  return { key, score };
2541
2540
  }
2542
2541
  if (!Array.isArray(rawFields) || rawFields.length === 0) {
2543
2542
  return { key, score, data: {} };
2544
2543
  }
2545
- const mergedFields = {};
2544
+ let data = {};
2546
2545
  for (const fieldRaw of rawFields) {
2547
- const fieldObj = kvArrayToObject(fieldRaw);
2548
- Object.assign(mergedFields, fieldObj);
2546
+ const key2 = fieldRaw[0];
2547
+ const value = fieldRaw[1];
2548
+ const pathParts = key2.split(".");
2549
+ if (pathParts.length == 1) {
2550
+ data[key2] = value;
2551
+ } else {
2552
+ let currentObj = data;
2553
+ for (let i = 0; i < pathParts.length - 1; i++) {
2554
+ const pathPart = pathParts[i];
2555
+ if (!(pathPart in currentObj)) {
2556
+ currentObj[pathPart] = {};
2557
+ }
2558
+ currentObj = currentObj[pathPart];
2559
+ }
2560
+ currentObj[pathParts.at(-1)] = value;
2561
+ }
2549
2562
  }
2550
- if ("$" in mergedFields) {
2551
- const data2 = mergedFields["$"];
2552
- return { key, score, data: data2 };
2563
+ if ("$" in data) {
2564
+ data = data["$"];
2553
2565
  }
2554
- const data = dotNotationToNested(mergedFields);
2555
2566
  return { key, score, data };
2556
2567
  });
2557
2568
  }
2558
- function parseFieldInfo(fieldRaw) {
2559
- const fieldType = fieldRaw[1];
2560
- const options = fieldRaw.slice(2);
2561
- const fieldInfo = { type: fieldType };
2562
- for (const option of options) {
2563
- switch (option.toUpperCase()) {
2564
- case "NOTOKENIZE":
2565
- fieldInfo.noTokenize = true;
2569
+ function deserializeDescribeResponse(rawResponse) {
2570
+ const description = {};
2571
+ for (let i = 0; i < rawResponse.length; i += 2) {
2572
+ const descriptor = rawResponse[i];
2573
+ switch (descriptor) {
2574
+ case "name": {
2575
+ description["name"] = rawResponse[i + 1];
2566
2576
  break;
2567
- case "NOSTEM":
2568
- fieldInfo.noStem = true;
2577
+ }
2578
+ case "type": {
2579
+ description["dataType"] = rawResponse[i + 1].toLowerCase();
2569
2580
  break;
2570
- case "FAST":
2571
- fieldInfo.fast = true;
2581
+ }
2582
+ case "prefixes": {
2583
+ description["prefixes"] = rawResponse[i + 1];
2584
+ break;
2585
+ }
2586
+ case "language": {
2587
+ description["language"] = rawResponse[i + 1];
2588
+ break;
2589
+ }
2590
+ case "schema": {
2591
+ const schema = {};
2592
+ for (const fieldDescription of rawResponse[i + 1]) {
2593
+ const fieldName = fieldDescription[0];
2594
+ const fieldInfo = { type: fieldDescription[1] };
2595
+ if (fieldDescription.length > 2) {
2596
+ for (let j = 2; j < fieldDescription.length; j++) {
2597
+ const fieldOption = fieldDescription[j];
2598
+ switch (fieldOption) {
2599
+ case "NOSTEM": {
2600
+ fieldInfo.noStem = true;
2601
+ break;
2602
+ }
2603
+ case "NOTOKENIZE": {
2604
+ fieldInfo.noTokenize = true;
2605
+ break;
2606
+ }
2607
+ case "FAST": {
2608
+ fieldInfo.fast = true;
2609
+ break;
2610
+ }
2611
+ }
2612
+ }
2613
+ }
2614
+ schema[fieldName] = fieldInfo;
2615
+ }
2616
+ description["schema"] = schema;
2572
2617
  break;
2573
- }
2574
- }
2575
- return fieldInfo;
2576
- }
2577
- function deserializeDescribeResponse(rawResponse) {
2578
- const raw = kvArrayToObject(rawResponse);
2579
- const schema = {};
2580
- if (Array.isArray(raw.schema)) {
2581
- for (const fieldRaw of raw.schema) {
2582
- if (Array.isArray(fieldRaw) && fieldRaw.length >= 2) {
2583
- const fieldName = fieldRaw[0];
2584
- schema[fieldName] = parseFieldInfo(fieldRaw);
2585
2618
  }
2586
2619
  }
2587
2620
  }
2588
- return {
2589
- name: raw.name,
2590
- dataType: raw.type.toLowerCase(),
2591
- prefixes: raw.prefixes,
2592
- ...raw.language && { language: raw.language },
2593
- schema
2594
- };
2621
+ return description;
2595
2622
  }
2596
2623
  function parseCountResponse(rawResponse) {
2597
- return typeof rawResponse === "number" ? rawResponse : parseInt(rawResponse, 10);
2598
- }
2599
- function kvArrayToObject(v) {
2600
- if (typeof v === "object" && v !== null && !Array.isArray(v)) return v;
2601
- if (!Array.isArray(v)) return {};
2602
- const obj = {};
2603
- for (let i = 0; i < v.length; i += 2) {
2604
- if (typeof v[i] === "string") obj[v[i]] = v[i + 1];
2605
- }
2606
- return obj;
2607
- }
2608
- function dotNotationToNested(obj) {
2609
- const result = {};
2610
- for (const [key, value] of Object.entries(obj)) {
2611
- const parts = key.split(".");
2612
- let current = result;
2613
- for (let i = 0; i < parts.length - 1; i++) {
2614
- const part = parts[i];
2615
- if (!(part in current)) {
2616
- current[part] = {};
2617
- }
2618
- current = current[part];
2619
- }
2620
- current[parts[parts.length - 1]] = value;
2621
- }
2622
- return result;
2624
+ return typeof rawResponse === "number" ? rawResponse : Number.parseInt(rawResponse, 10);
2623
2625
  }
2624
2626
 
2625
2627
  // pkg/commands/search/command-builder.ts
2626
2628
  function buildQueryCommand(redisCommand, name, options) {
2627
- const query = JSON.stringify(options?.filter);
2629
+ const query = JSON.stringify(options?.filter ?? {});
2628
2630
  const command = [redisCommand, name, query];
2629
2631
  if (options?.limit !== void 0) {
2630
2632
  command.push("LIMIT", options.limit.toString());
@@ -2637,9 +2639,9 @@ function buildQueryCommand(redisCommand, name, options) {
2637
2639
  }
2638
2640
  if (options?.orderBy) {
2639
2641
  command.push("SORTBY");
2640
- Object.entries(options.orderBy).forEach(([field, direction]) => {
2642
+ for (const [field, direction] of Object.entries(options.orderBy)) {
2641
2643
  command.push(field, direction);
2642
- });
2644
+ }
2643
2645
  }
2644
2646
  if (options?.highlight) {
2645
2647
  command.push(
@@ -2701,7 +2703,7 @@ var SearchIndex = class {
2701
2703
  this.client = client;
2702
2704
  }
2703
2705
  async waitIndexing() {
2704
- const command = ["SEARCH.COMMIT", this.name];
2706
+ const command = ["SEARCH.WAITINDEXING", this.name];
2705
2707
  const result = await new ExecCommand(command).exec(
2706
2708
  this.client
2707
2709
  );
@@ -2719,7 +2721,7 @@ var SearchIndex = class {
2719
2721
  const rawResult = await new ExecCommand(command).exec(
2720
2722
  this.client
2721
2723
  );
2722
- return deserializeQueryResponse(rawResult, options);
2724
+ return deserializeQueryResponse(rawResult);
2723
2725
  }
2724
2726
  async count({ filter }) {
2725
2727
  const command = buildQueryCommand("SEARCH.COUNT", this.name, { filter });
@@ -4893,7 +4895,7 @@ var Redis = class {
4893
4895
  };
4894
4896
 
4895
4897
  // version.ts
4896
- var VERSION = "v1.36.0-rc.4";
4898
+ var VERSION = "v1.36.0-rc.6";
4897
4899
 
4898
4900
  // platforms/nodejs.ts
4899
4901
  if (typeof atob === "undefined") {
package/nodejs.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  error_exports,
7
7
  index,
8
8
  s
9
- } from "./chunk-P45C5Z47.mjs";
9
+ } from "./chunk-6HWD2E2U.mjs";
10
10
 
11
11
  // platforms/nodejs.ts
12
12
  if (typeof atob === "undefined") {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/redis","version":"v1.36.0-rc.4","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"uncrypto":"^0.1.3"}}
1
+ {"name":"@upstash/redis","version":"v1.36.0-rc.6","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"uncrypto":"^0.1.3"}}
@@ -356,7 +356,7 @@ type InferSchemaData<TSchema> = {
356
356
  [K in keyof TSchema]: TSchema[K] extends FieldType ? FieldValueType<TSchema[K]> : TSchema[K] extends DetailedField ? FieldValueType<ExtractFieldType<TSchema[K]>> : TSchema[K] extends NestedIndexSchema ? InferSchemaData<TSchema[K]> : never;
357
357
  };
358
358
  type QueryOptions<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
359
- filter: RootQueryFilter<TSchema>;
359
+ filter?: RootQueryFilter<TSchema>;
360
360
  /** Maximum number of results to return */
361
361
  limit?: number;
362
362
  /** Number of results to skip */
@@ -421,7 +421,17 @@ type StringOperationMap<T extends string> = {
421
421
  distance?: number;
422
422
  transpositionCostOne?: boolean;
423
423
  };
424
- $phrase: T;
424
+ $phrase: T | {
425
+ value: T;
426
+ } | {
427
+ value: T;
428
+ slop: number;
429
+ prefix?: never;
430
+ } | {
431
+ value: T;
432
+ prefix: boolean;
433
+ slop?: never;
434
+ };
425
435
  $regex: T;
426
436
  };
427
437
  type NumberOperationMap<T extends number> = {
@@ -442,6 +452,10 @@ type DateOperationMap<T extends string | Date> = {
442
452
  $eq: T;
443
453
  $ne: T;
444
454
  $in: T[];
455
+ $gt: T;
456
+ $gte: T;
457
+ $lte: T;
458
+ $lt: T;
445
459
  };
446
460
  type StringOperations = {
447
461
  [K in keyof StringOperationMap<string>]: {
@@ -573,7 +587,7 @@ type BoolNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TS
573
587
  $or?: never;
574
588
  };
575
589
  type QueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> = QueryLeaf<TSchema> | AndNode<TSchema> | OrNode<TSchema> | MustNode<TSchema> | ShouldNode<TSchema> | MustShouldNode<TSchema> | NotNode<TSchema> | AndNotNode<TSchema> | OrNotNode<TSchema> | ShouldNotNode<TSchema> | MustNotNode<TSchema> | BoolNode<TSchema>;
576
- type RootQueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> = QueryLeaf<TSchema> | AndNode<TSchema> | RootOrNode<TSchema> | MustNode<TSchema> | ShouldNode<TSchema> | MustShouldNode<TSchema> | NotNode<TSchema> | AndNotNode<TSchema> | ShouldNotNode<TSchema> | MustNotNode<TSchema> | BoolNode<TSchema>;
590
+ type RootQueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> = QueryLeaf<TSchema> | AndNode<TSchema> | RootOrNode<TSchema> | MustNode<TSchema> | ShouldNode<TSchema> | MustShouldNode<TSchema> | AndNotNode<TSchema> | ShouldNotNode<TSchema> | MustNotNode<TSchema> | BoolNode<TSchema>;
577
591
  type RootOrNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
578
592
  [P in SchemaPaths<TSchema>]?: never;
579
593
  } & {
@@ -592,7 +606,7 @@ type DescribeFieldInfo = {
592
606
  };
593
607
  type IndexDescription<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
594
608
  name: string;
595
- dataType: "hash" | "string";
609
+ dataType: "hash" | "string" | "json";
596
610
  prefixes: string[];
597
611
  language?: Language;
598
612
  schema: Record<SchemaPaths<TSchema>, DescribeFieldInfo>;
@@ -607,6 +621,9 @@ type createIndexProps<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
607
621
  } & ({
608
622
  dataType: "string";
609
623
  schema: TSchema extends NestedIndexSchema ? TSchema : never;
624
+ } | {
625
+ dataType: "json";
626
+ schema: TSchema extends NestedIndexSchema ? TSchema : never;
610
627
  } | {
611
628
  dataType: "hash";
612
629
  schema: TSchema extends FlatIndexSchema ? TSchema : never;
@@ -623,7 +640,7 @@ declare class SearchIndex<TSchema extends NestedIndexSchema | FlatIndexSchema> {
623
640
  constructor({ name, schema, client }: SearchIndexProps<TSchema>);
624
641
  waitIndexing(): Promise<string>;
625
642
  describe(): Promise<IndexDescription<TSchema>>;
626
- query(options: QueryOptions<TSchema>): Promise<QueryResult<TSchema, QueryOptions<TSchema>>[]>;
643
+ query(options?: QueryOptions<TSchema>): Promise<QueryResult<TSchema, QueryOptions<TSchema>>[]>;
627
644
  count({ filter }: {
628
645
  filter: RootQueryFilter<TSchema>;
629
646
  }): Promise<{
@@ -631,7 +648,7 @@ declare class SearchIndex<TSchema extends NestedIndexSchema | FlatIndexSchema> {
631
648
  }>;
632
649
  drop(): Promise<string>;
633
650
  }
634
- declare function createIndex<TSchema extends NestedIndexSchema | FlatIndexSchema>(props: createIndexProps<TSchema>): Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
651
+ declare function createIndex<TSchema extends NestedIndexSchema | FlatIndexSchema>(props: createIndexProps<TSchema>): Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
635
652
  declare function index<TSchema extends NestedIndexSchema | FlatIndexSchema>(client: Requester, name: string, schema: TSchema): SearchIndex<TSchema>;
636
653
  declare function index(client: Requester, name: string): SearchIndex<any>;
637
654
 
@@ -3473,7 +3490,7 @@ declare class Redis {
3473
3490
  readonly?: TReadonly;
3474
3491
  }): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
3475
3492
  get search(): {
3476
- createIndex: <TSchema extends NestedIndexSchema | FlatIndexSchema>(props: Omit<createIndexProps<TSchema>, "client">) => Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
3493
+ createIndex: <TSchema extends NestedIndexSchema | FlatIndexSchema>(props: Omit<createIndexProps<TSchema>, "client">) => Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
3477
3494
  index: <TSchema extends NestedIndexSchema | FlatIndexSchema>(name: string, schema?: TSchema extends NestedIndexSchema ? TSchema : never) => SearchIndex<TSchema>;
3478
3495
  };
3479
3496
  /**
@@ -356,7 +356,7 @@ type InferSchemaData<TSchema> = {
356
356
  [K in keyof TSchema]: TSchema[K] extends FieldType ? FieldValueType<TSchema[K]> : TSchema[K] extends DetailedField ? FieldValueType<ExtractFieldType<TSchema[K]>> : TSchema[K] extends NestedIndexSchema ? InferSchemaData<TSchema[K]> : never;
357
357
  };
358
358
  type QueryOptions<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
359
- filter: RootQueryFilter<TSchema>;
359
+ filter?: RootQueryFilter<TSchema>;
360
360
  /** Maximum number of results to return */
361
361
  limit?: number;
362
362
  /** Number of results to skip */
@@ -421,7 +421,17 @@ type StringOperationMap<T extends string> = {
421
421
  distance?: number;
422
422
  transpositionCostOne?: boolean;
423
423
  };
424
- $phrase: T;
424
+ $phrase: T | {
425
+ value: T;
426
+ } | {
427
+ value: T;
428
+ slop: number;
429
+ prefix?: never;
430
+ } | {
431
+ value: T;
432
+ prefix: boolean;
433
+ slop?: never;
434
+ };
425
435
  $regex: T;
426
436
  };
427
437
  type NumberOperationMap<T extends number> = {
@@ -442,6 +452,10 @@ type DateOperationMap<T extends string | Date> = {
442
452
  $eq: T;
443
453
  $ne: T;
444
454
  $in: T[];
455
+ $gt: T;
456
+ $gte: T;
457
+ $lte: T;
458
+ $lt: T;
445
459
  };
446
460
  type StringOperations = {
447
461
  [K in keyof StringOperationMap<string>]: {
@@ -573,7 +587,7 @@ type BoolNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TS
573
587
  $or?: never;
574
588
  };
575
589
  type QueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> = QueryLeaf<TSchema> | AndNode<TSchema> | OrNode<TSchema> | MustNode<TSchema> | ShouldNode<TSchema> | MustShouldNode<TSchema> | NotNode<TSchema> | AndNotNode<TSchema> | OrNotNode<TSchema> | ShouldNotNode<TSchema> | MustNotNode<TSchema> | BoolNode<TSchema>;
576
- type RootQueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> = QueryLeaf<TSchema> | AndNode<TSchema> | RootOrNode<TSchema> | MustNode<TSchema> | ShouldNode<TSchema> | MustShouldNode<TSchema> | NotNode<TSchema> | AndNotNode<TSchema> | ShouldNotNode<TSchema> | MustNotNode<TSchema> | BoolNode<TSchema>;
590
+ type RootQueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> = QueryLeaf<TSchema> | AndNode<TSchema> | RootOrNode<TSchema> | MustNode<TSchema> | ShouldNode<TSchema> | MustShouldNode<TSchema> | AndNotNode<TSchema> | ShouldNotNode<TSchema> | MustNotNode<TSchema> | BoolNode<TSchema>;
577
591
  type RootOrNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
578
592
  [P in SchemaPaths<TSchema>]?: never;
579
593
  } & {
@@ -592,7 +606,7 @@ type DescribeFieldInfo = {
592
606
  };
593
607
  type IndexDescription<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
594
608
  name: string;
595
- dataType: "hash" | "string";
609
+ dataType: "hash" | "string" | "json";
596
610
  prefixes: string[];
597
611
  language?: Language;
598
612
  schema: Record<SchemaPaths<TSchema>, DescribeFieldInfo>;
@@ -607,6 +621,9 @@ type createIndexProps<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
607
621
  } & ({
608
622
  dataType: "string";
609
623
  schema: TSchema extends NestedIndexSchema ? TSchema : never;
624
+ } | {
625
+ dataType: "json";
626
+ schema: TSchema extends NestedIndexSchema ? TSchema : never;
610
627
  } | {
611
628
  dataType: "hash";
612
629
  schema: TSchema extends FlatIndexSchema ? TSchema : never;
@@ -623,7 +640,7 @@ declare class SearchIndex<TSchema extends NestedIndexSchema | FlatIndexSchema> {
623
640
  constructor({ name, schema, client }: SearchIndexProps<TSchema>);
624
641
  waitIndexing(): Promise<string>;
625
642
  describe(): Promise<IndexDescription<TSchema>>;
626
- query(options: QueryOptions<TSchema>): Promise<QueryResult<TSchema, QueryOptions<TSchema>>[]>;
643
+ query(options?: QueryOptions<TSchema>): Promise<QueryResult<TSchema, QueryOptions<TSchema>>[]>;
627
644
  count({ filter }: {
628
645
  filter: RootQueryFilter<TSchema>;
629
646
  }): Promise<{
@@ -631,7 +648,7 @@ declare class SearchIndex<TSchema extends NestedIndexSchema | FlatIndexSchema> {
631
648
  }>;
632
649
  drop(): Promise<string>;
633
650
  }
634
- declare function createIndex<TSchema extends NestedIndexSchema | FlatIndexSchema>(props: createIndexProps<TSchema>): Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
651
+ declare function createIndex<TSchema extends NestedIndexSchema | FlatIndexSchema>(props: createIndexProps<TSchema>): Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
635
652
  declare function index<TSchema extends NestedIndexSchema | FlatIndexSchema>(client: Requester, name: string, schema: TSchema): SearchIndex<TSchema>;
636
653
  declare function index(client: Requester, name: string): SearchIndex<any>;
637
654
 
@@ -3473,7 +3490,7 @@ declare class Redis {
3473
3490
  readonly?: TReadonly;
3474
3491
  }): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
3475
3492
  get search(): {
3476
- createIndex: <TSchema extends NestedIndexSchema | FlatIndexSchema>(props: Omit<createIndexProps<TSchema>, "client">) => Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
3493
+ createIndex: <TSchema extends NestedIndexSchema | FlatIndexSchema>(props: Omit<createIndexProps<TSchema>, "client">) => Promise<SearchIndex<(TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends NestedIndexSchema ? TSchema : never) | (TSchema extends FlatIndexSchema ? TSchema : never)>>;
3477
3494
  index: <TSchema extends NestedIndexSchema | FlatIndexSchema>(name: string, schema?: TSchema extends NestedIndexSchema ? TSchema : never) => SearchIndex<TSchema>;
3478
3495
  };
3479
3496
  /**