@upstash/react-redis-browser 0.2.14-rc.11 → 0.2.14-rc.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2668,8 +2668,44 @@ var isTest = typeof window !== "undefined" && window.__PLAYWRIGHT__ === true;
2668
2668
  var jsonToJsLiteral = (json) => {
2669
2669
  return json.replaceAll(/"([$A-Z_a-z][\w$]*)"\s*:/g, "$1:");
2670
2670
  };
2671
+ var MAX_INLINE_KEYS = 2;
2672
+ var isInlineable = (value) => {
2673
+ if (typeof value !== "object" || value === null) return true;
2674
+ if (Array.isArray(value)) return value.every((v) => typeof v !== "object" || v === null);
2675
+ const entries = Object.entries(value);
2676
+ return entries.length <= MAX_INLINE_KEYS && entries.every(([, v]) => typeof v !== "object" || v === null);
2677
+ };
2678
+ var prettyPrint = (value, indent) => {
2679
+ if (value === void 0 || value === null) return String(value);
2680
+ if (typeof value !== "object") return JSON.stringify(value);
2681
+ const prefix = " ".repeat(indent);
2682
+ const childPrefix = " ".repeat(indent + 1);
2683
+ if (Array.isArray(value)) {
2684
+ if (value.length === 0) return "[]";
2685
+ if (value.every((v) => isInlineable(v))) {
2686
+ const inline = `[${value.map((v) => prettyPrint(v, 0)).join(", ")}]`;
2687
+ if (!inline.includes("\n")) return inline;
2688
+ }
2689
+ const items = value.map((v) => `${childPrefix}${prettyPrint(v, indent + 1)}`);
2690
+ return `[
2691
+ ${items.join(",\n")}
2692
+ ${prefix}]`;
2693
+ }
2694
+ const entries = Object.entries(value);
2695
+ if (entries.length === 0) return "{}";
2696
+ if (indent > 0 && entries.length <= MAX_INLINE_KEYS && entries.every(([, v]) => isInlineable(v))) {
2697
+ const inline = `{ ${entries.map(([k, v]) => `${JSON.stringify(k)}: ${prettyPrint(v, 0)}`).join(", ")} }`;
2698
+ if (!inline.includes("\n")) return inline;
2699
+ }
2700
+ const parts = entries.map(
2701
+ ([k, v]) => `${childPrefix}${JSON.stringify(k)}: ${prettyPrint(v, indent + 1)}`
2702
+ );
2703
+ return `{
2704
+ ${parts.join(",\n")}
2705
+ ${prefix}}`;
2706
+ };
2671
2707
  var toJsLiteral = (obj) => {
2672
- return jsonToJsLiteral(JSON.stringify(obj, null, 2));
2708
+ return jsonToJsLiteral(prettyPrint(obj, 0));
2673
2709
  };
2674
2710
  var formatUpstashErrorMessage = (error) => {
2675
2711
  if (error.name !== "UpstashError") return error.message;
@@ -4004,16 +4040,22 @@ function parseFields(content, prefix, flatSchema) {
4004
4040
  if (fieldName.startsWith('"') && fieldName.endsWith('"') || fieldName.startsWith("'") && fieldName.endsWith("'")) {
4005
4041
  fieldName = fieldName.slice(1, -1);
4006
4042
  }
4043
+ if (fieldName.length === 0) {
4044
+ throw new Error("Field name cannot be empty");
4045
+ }
4007
4046
  const valueStr = entry.slice(colonIndex + 1).trim();
4008
4047
  const fullKey = prefix ? `${prefix}.${fieldName}` : fieldName;
4009
4048
  if (valueStr.startsWith("s.object(")) {
4010
4049
  const nestedContent = extractObjectContent(valueStr);
4011
- if (nestedContent !== null) {
4012
- parseFields(nestedContent, fullKey, flatSchema);
4013
- continue;
4050
+ if (nestedContent === void 0) {
4051
+ throw new Error(
4052
+ `Malformed s.object() for field "${fullKey}": missing closing brace or parenthesis`
4053
+ );
4014
4054
  }
4055
+ parseFields(nestedContent, fullKey, flatSchema);
4056
+ continue;
4015
4057
  }
4016
- const fieldValue = parseFieldBuilder(valueStr);
4058
+ const fieldValue = parseFieldBuilder(valueStr, fullKey);
4017
4059
  if (fieldValue) {
4018
4060
  flatSchema[fullKey] = fieldValue;
4019
4061
  }
@@ -4074,15 +4116,15 @@ function findColonIndex(entry) {
4074
4116
  }
4075
4117
  function extractObjectContent(str) {
4076
4118
  const match = str.match(/^s\.object\s*\(\s*{([\S\s]*)}\s*\)/);
4077
- return match ? match[1] : null;
4119
+ return match ? match[1] : void 0;
4078
4120
  }
4079
4121
  function extractFromValue(str) {
4080
4122
  const fromIndex = str.indexOf(".from(");
4081
- if (fromIndex === -1) return null;
4123
+ if (fromIndex === -1) return void 0;
4082
4124
  const start = fromIndex + 6;
4083
- if (start >= str.length) return null;
4125
+ if (start >= str.length) return void 0;
4084
4126
  const quoteChar = str[start];
4085
- if (quoteChar !== '"' && quoteChar !== "'") return null;
4127
+ if (quoteChar !== '"' && quoteChar !== "'") return void 0;
4086
4128
  let result = "";
4087
4129
  let i = start + 1;
4088
4130
  while (i < str.length) {
@@ -4098,151 +4140,61 @@ function extractFromValue(str) {
4098
4140
  result += char;
4099
4141
  i++;
4100
4142
  }
4101
- return null;
4143
+ return void 0;
4102
4144
  }
4103
- function parseFieldBuilder(str) {
4145
+ function parseFieldBuilder(str, fieldName) {
4104
4146
  str = str.trim().replace(/,\s*$/, "");
4105
4147
  if (str.startsWith("s.string()")) {
4106
4148
  const noTokenize = str.includes(".noTokenize()");
4107
4149
  const noStem = str.includes(".noStem()");
4108
4150
  const fromValue = extractFromValue(str);
4109
- if (!noTokenize && !noStem && fromValue === null) return "TEXT";
4151
+ if (!noTokenize && !noStem && fromValue === void 0) return "TEXT";
4110
4152
  return {
4111
4153
  type: "TEXT",
4112
4154
  ...noTokenize && { noTokenize: true },
4113
4155
  ...noStem && { noStem: true },
4114
- ...fromValue !== null && { from: fromValue }
4156
+ ...fromValue !== void 0 && { from: fromValue }
4115
4157
  };
4116
4158
  }
4117
4159
  if (str.startsWith("s.number(")) {
4118
4160
  const typeMatch = str.match(/s\.number\(\s*["']?(U64|I64|F64)?["']?\s*\)/);
4119
4161
  const numType = _optionalChain([typeMatch, 'optionalAccess', _31 => _31[1]]) || "F64";
4120
4162
  const fromValue = extractFromValue(str);
4121
- if (fromValue === null) return numType;
4163
+ if (fromValue === void 0) return numType;
4122
4164
  return { type: numType, from: fromValue };
4123
4165
  }
4124
4166
  if (str.startsWith("s.boolean()")) {
4125
4167
  const fast = str.includes(".fast()");
4126
4168
  const fromValue = extractFromValue(str);
4127
- if (!fast && fromValue === null) return "BOOL";
4169
+ if (!fast && fromValue === void 0) return "BOOL";
4128
4170
  return {
4129
4171
  type: "BOOL",
4130
4172
  ...fast && { fast: true },
4131
- ...fromValue !== null && { from: fromValue }
4173
+ ...fromValue !== void 0 && { from: fromValue }
4132
4174
  };
4133
4175
  }
4134
4176
  if (str.startsWith("s.date()")) {
4135
4177
  const fast = str.includes(".fast()");
4136
4178
  const fromValue = extractFromValue(str);
4137
- if (!fast && fromValue === null) return "DATE";
4179
+ if (!fast && fromValue === void 0) return "DATE";
4138
4180
  return {
4139
4181
  type: "DATE",
4140
4182
  ...fast && { fast: true },
4141
- ...fromValue !== null && { from: fromValue }
4183
+ ...fromValue !== void 0 && { from: fromValue }
4142
4184
  };
4143
4185
  }
4144
- return null;
4145
- }
4146
- function schemaToEditorValue(flatSchema) {
4147
- const nested = unflattenSchema(flatSchema);
4148
- const body = renderObject(nested, 1);
4149
- return `const schema: Schema = s.object({
4150
- ${body}})`;
4151
- }
4152
- function unflattenSchema(flat) {
4153
- const result = {};
4154
- for (const [key, value] of Object.entries(flat)) {
4155
- const parts = key.split(".");
4156
- let current = result;
4157
- for (let i = 0; i < parts.length - 1; i++) {
4158
- const part = parts[i];
4159
- if (!current[part] || typeof current[part] !== "object") {
4160
- current[part] = {};
4161
- }
4162
- current = current[part];
4163
- }
4164
- current[parts.at(-1)] = value;
4165
- }
4166
- return result;
4167
- }
4168
- function renderObject(obj, indent) {
4169
- const pad = " ".repeat(indent);
4170
- const lines = [];
4171
- for (const [key, value] of Object.entries(obj)) {
4172
- if (isFieldValue(value)) {
4173
- lines.push(`${pad}${key}: ${fieldToBuilder(value)},`);
4174
- } else {
4175
- const nested = renderObject(value, indent + 1);
4176
- lines.push(`${pad}${key}: s.object({`);
4177
- lines.push(nested.trimEnd());
4178
- lines.push(`${pad}}),`);
4179
- }
4180
- }
4181
- return lines.join("\n") + "\n";
4182
- }
4183
- function isFieldValue(value) {
4184
- if (typeof value === "string") return true;
4185
- if (typeof value === "object" && value !== null) {
4186
- return "type" in value;
4187
- }
4188
- return false;
4189
- }
4190
- function fieldToBuilder(value) {
4191
- if (typeof value === "string") {
4192
- switch (value) {
4193
- case "TEXT": {
4194
- return "s.string()";
4195
- }
4196
- case "BOOL": {
4197
- return "s.boolean()";
4198
- }
4199
- case "DATE": {
4200
- return "s.date()";
4201
- }
4202
- case "U64":
4203
- case "I64":
4204
- case "F64": {
4205
- return `s.number("${value}")`;
4206
- }
4207
- default: {
4208
- return "s.string()";
4209
- }
4210
- }
4186
+ if (str.startsWith("s.keyword()")) {
4187
+ return "KEYWORD";
4211
4188
  }
4212
- const v = value;
4213
- const type = v.type;
4214
- let builder = "";
4215
- switch (type) {
4216
- case "TEXT": {
4217
- builder = "s.string()";
4218
- if (v.noTokenize) builder += ".noTokenize()";
4219
- if (v.noStem) builder += ".noStem()";
4220
- break;
4221
- }
4222
- case "U64":
4223
- case "I64":
4224
- case "F64": {
4225
- builder = `s.number("${type}")`;
4226
- break;
4227
- }
4228
- case "BOOL": {
4229
- builder = "s.boolean()";
4230
- if (v.fast) builder += ".fast()";
4231
- break;
4232
- }
4233
- case "DATE": {
4234
- builder = "s.date()";
4235
- if (v.fast) builder += ".fast()";
4236
- break;
4237
- }
4238
- default: {
4239
- builder = "s.string()";
4240
- }
4189
+ if (str.startsWith("s.facet()")) {
4190
+ return "FACET";
4241
4191
  }
4242
- if (v.from) {
4243
- builder += `.from("${v.from}")`;
4192
+ if (str.startsWith("s.")) {
4193
+ const typeMatch = str.match(/^s\.(\w+)\(/);
4194
+ const typeName = _nullishCoalesce(_optionalChain([typeMatch, 'optionalAccess', _32 => _32[1]]), () => ( "unknown"));
4195
+ throw new Error(`Unknown field type "s.${typeName}()" for field "${fieldName}"`);
4244
4196
  }
4245
- return builder;
4197
+ return void 0;
4246
4198
  }
4247
4199
 
4248
4200
  // src/components/databrowser/hooks/use-create-search-index-schema.tsx
@@ -4282,13 +4234,89 @@ var useCreateSearchIndexSchema = () => {
4282
4234
  // src/components/databrowser/components/display/display-header.tsx
4283
4235
 
4284
4236
 
4237
+ // src/components/ui/scroll-area.tsx
4238
+
4239
+ var _reactscrollarea = require('@radix-ui/react-scroll-area'); var ScrollAreaPrimitive = _interopRequireWildcard(_reactscrollarea);
4240
+
4241
+ var ScrollArea = React7.forwardRef(
4242
+ ({
4243
+ className,
4244
+ scrollBarClassName,
4245
+ scrollBarForceMount,
4246
+ children,
4247
+ onScroll,
4248
+ disableRoundedInherit = false,
4249
+ orientation = "vertical",
4250
+ ...props
4251
+ }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
4252
+ ScrollAreaPrimitive.Root,
4253
+ {
4254
+ ref,
4255
+ className: cn("relative overflow-hidden", className),
4256
+ ...props,
4257
+ children: [
4258
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4259
+ ScrollAreaPrimitive.Viewport,
4260
+ {
4261
+ onScroll,
4262
+ className: cn(
4263
+ "h-full w-full [&>div]:!block",
4264
+ !disableRoundedInherit && "rounded-[inherit]"
4265
+ ),
4266
+ children
4267
+ }
4268
+ ),
4269
+ (orientation === "vertical" || orientation === "both") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4270
+ ScrollBar,
4271
+ {
4272
+ className: scrollBarClassName,
4273
+ forceMount: scrollBarForceMount,
4274
+ orientation: "vertical"
4275
+ }
4276
+ ),
4277
+ (orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4278
+ ScrollBar,
4279
+ {
4280
+ className: scrollBarClassName,
4281
+ forceMount: scrollBarForceMount,
4282
+ orientation: "horizontal"
4283
+ }
4284
+ ),
4285
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollAreaPrimitive.Corner, {})
4286
+ ]
4287
+ }
4288
+ )
4289
+ );
4290
+ ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
4291
+ var ScrollBar = React7.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4292
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
4293
+ {
4294
+ ref,
4295
+ orientation,
4296
+ className: cn(
4297
+ "flex touch-none select-none transition-colors",
4298
+ orientation === "vertical" && "mr-1 h-full w-2",
4299
+ orientation === "horizontal" && "mb-1 h-2 w-full flex-col",
4300
+ className
4301
+ ),
4302
+ ...props,
4303
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4304
+ ScrollAreaPrimitive.ScrollAreaThumb,
4305
+ {
4306
+ className: cn("relative flex-1 rounded-full bg-zinc-400/70")
4307
+ }
4308
+ )
4309
+ }
4310
+ ));
4311
+ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
4312
+
4285
4313
  // src/components/ui/tooltip.tsx
4286
4314
 
4287
4315
 
4288
4316
 
4289
4317
  var Tooltip = TooltipPrimitive.Root;
4290
4318
  var TooltipTrigger = TooltipPrimitive.Trigger;
4291
- var TooltipContent = React7.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4319
+ var TooltipContent = React8.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4292
4320
  TooltipPrimitive.Content,
4293
4321
  {
4294
4322
  ref,
@@ -4543,7 +4571,7 @@ var useFetchListItems = ({ dataKey, type }) => {
4543
4571
  // +1 since first message is the last one
4544
4572
  LIST_DISPLAY_PAGE_SIZE + 1
4545
4573
  );
4546
- const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access', _32 => _32.at, 'call', _33 => _33(-1), 'optionalAccess', _34 => _34[0]]) : void 0;
4574
+ const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access', _33 => _33.at, 'call', _34 => _34(-1), 'optionalAccess', _35 => _35[0]]) : void 0;
4547
4575
  return {
4548
4576
  cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
4549
4577
  keys: messages.map(([id, fields]) => ({
@@ -4622,6 +4650,9 @@ var useDeleteKeyCache = () => {
4622
4650
  queryClient.invalidateQueries({
4623
4651
  queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, key]
4624
4652
  });
4653
+ queryClient.invalidateQueries({
4654
+ queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY]
4655
+ });
4625
4656
  if (isValuesSearchSelected && valuesSearch.index) {
4626
4657
  queryClient.invalidateQueries({
4627
4658
  queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, valuesSearch.index]
@@ -4715,7 +4746,7 @@ var useEditListItem = () => {
4715
4746
  }
4716
4747
  case "stream": {
4717
4748
  if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
4718
- const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess', _35 => _35.split, 'call', _36 => _36("\n")]), () => ( []))).map(
4749
+ const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess', _36 => _36.split, 'call', _37 => _37("\n")]), () => ( []))).map(
4719
4750
  ({ key, value }) => [key, value]
4720
4751
  );
4721
4752
  pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
@@ -4753,7 +4784,7 @@ var _reactpopover = require('@radix-ui/react-popover'); var PopoverPrimitive = _
4753
4784
 
4754
4785
  var Popover = PopoverPrimitive.Root;
4755
4786
  var PopoverTrigger = PopoverPrimitive.Trigger;
4756
- var PopoverContent = React8.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4787
+ var PopoverContent = React9.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4757
4788
  PopoverPrimitive.Content,
4758
4789
  {
4759
4790
  ref,
@@ -5022,7 +5053,7 @@ var LengthBadge = ({
5022
5053
  content
5023
5054
  }) => {
5024
5055
  const { data, isLoading } = useFetchKeyLength({ dataKey, type });
5025
- const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _37 => _37.length]), () => ( data));
5056
+ const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _38 => _38.length]), () => ( data));
5026
5057
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Badge, { label: "Length:", children: isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : length });
5027
5058
  };
5028
5059
  var SizeBadge = ({ dataKey }) => {
@@ -5058,7 +5089,7 @@ var _reactdropdownmenu = require('@radix-ui/react-dropdown-menu'); var DropdownM
5058
5089
 
5059
5090
  var DropdownMenu = DropdownMenuPrimitive.Root;
5060
5091
  var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
5061
- var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5092
+ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5062
5093
  DropdownMenuPrimitive.SubTrigger,
5063
5094
  {
5064
5095
  ref,
@@ -5075,7 +5106,7 @@ var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ..
5075
5106
  }
5076
5107
  ));
5077
5108
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
5078
- var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5109
+ var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5079
5110
  DropdownMenuPrimitive.SubContent,
5080
5111
  {
5081
5112
  ref,
@@ -5087,7 +5118,7 @@ var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) =>
5087
5118
  }
5088
5119
  ));
5089
5120
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
5090
- var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5121
+ var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5091
5122
  DropdownMenuPrimitive.Content,
5092
5123
  {
5093
5124
  ref,
@@ -5101,7 +5132,7 @@ var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...pro
5101
5132
  }
5102
5133
  ) }));
5103
5134
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
5104
- var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5135
+ var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5105
5136
  DropdownMenuPrimitive.Item,
5106
5137
  {
5107
5138
  ref,
@@ -5114,7 +5145,7 @@ var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) =
5114
5145
  }
5115
5146
  ));
5116
5147
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
5117
- var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5148
+ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5118
5149
  DropdownMenuPrimitive.CheckboxItem,
5119
5150
  {
5120
5151
  ref,
@@ -5131,7 +5162,7 @@ var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked
5131
5162
  }
5132
5163
  ));
5133
5164
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
5134
- var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5165
+ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5135
5166
  DropdownMenuPrimitive.RadioItem,
5136
5167
  {
5137
5168
  ref,
@@ -5147,7 +5178,7 @@ var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }
5147
5178
  }
5148
5179
  ));
5149
5180
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
5150
- var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5181
+ var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5151
5182
  DropdownMenuPrimitive.Label,
5152
5183
  {
5153
5184
  ref,
@@ -5156,7 +5187,7 @@ var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref)
5156
5187
  }
5157
5188
  ));
5158
5189
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
5159
- var DropdownMenuSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5190
+ var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5160
5191
  DropdownMenuPrimitive.Separator,
5161
5192
  {
5162
5193
  ref,
@@ -5181,7 +5212,7 @@ var Dialog = DialogPrimitive.Root;
5181
5212
  var DialogTrigger = DialogPrimitive.Trigger;
5182
5213
  var DialogPortal = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogPrimitive.Portal, { container: portalRoot, ...props });
5183
5214
  DialogPortal.displayName = DialogPrimitive.Portal.displayName;
5184
- var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5215
+ var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5185
5216
  DialogPrimitive.Overlay,
5186
5217
  {
5187
5218
  ref,
@@ -5195,7 +5226,7 @@ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__P
5195
5226
  }
5196
5227
  ));
5197
5228
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
5198
- var DialogContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogPortal, { children: [
5229
+ var DialogContent = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogPortal, { children: [
5199
5230
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogOverlay, {}),
5200
5231
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5201
5232
  DialogPrimitive.Content,
@@ -5255,7 +5286,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ _jsxruntime.jsx.
5255
5286
  }
5256
5287
  );
5257
5288
  DialogFooter.displayName = "DialogFooter";
5258
- var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5289
+ var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5259
5290
  DialogPrimitive.Title,
5260
5291
  {
5261
5292
  ref,
@@ -5264,7 +5295,7 @@ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PUR
5264
5295
  }
5265
5296
  ));
5266
5297
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
5267
- var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5298
+ var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5268
5299
  DialogPrimitive.Description,
5269
5300
  {
5270
5301
  ref,
@@ -5278,7 +5309,7 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
5278
5309
 
5279
5310
  var _reactswitch = require('@radix-ui/react-switch'); var SwitchPrimitives = _interopRequireWildcard(_reactswitch);
5280
5311
 
5281
- var Switch = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5312
+ var Switch = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5282
5313
  SwitchPrimitives.Root,
5283
5314
  {
5284
5315
  className: cn(
@@ -5313,9 +5344,13 @@ function DeleteKeyModal({
5313
5344
  const isPlural = count2 > 1;
5314
5345
  const itemLabel = deletionType === "item" ? "Item" : "Key";
5315
5346
  const itemsLabel = deletionType === "item" ? "Items" : "Keys";
5347
+ const [internalOpen, setInternalOpen] = _react.useState.call(void 0, false);
5316
5348
  const [reindex, setReindex] = _react.useState.call(void 0, true);
5317
5349
  const [isPending, setIsPending] = _react.useState.call(void 0, false);
5318
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog, { open, onOpenChange, children: [
5350
+ const isControlled = open !== void 0;
5351
+ const isOpen = isControlled ? open : internalOpen;
5352
+ const setIsOpen = isControlled ? onOpenChange : setInternalOpen;
5353
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
5319
5354
  children && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogTrigger, { asChild: true, children }),
5320
5355
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogContent, { children: [
5321
5356
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogHeader, { children: [
@@ -5348,7 +5383,7 @@ function DeleteKeyModal({
5348
5383
  type: "button",
5349
5384
  variant: "outline",
5350
5385
  disabled: isPending,
5351
- onClick: () => _optionalChain([onOpenChange, 'optionalCall', _38 => _38(false)]),
5386
+ onClick: () => _optionalChain([setIsOpen, 'optionalCall', _39 => _39(false)]),
5352
5387
  children: "Cancel"
5353
5388
  }
5354
5389
  ),
@@ -5419,7 +5454,7 @@ function KeyActions({
5419
5454
  deletionType: "key",
5420
5455
  showReindex: isValuesSearchSelected && type !== "search",
5421
5456
  onDeleteConfirm: async (_e, options) => {
5422
- await deleteKey({ keys: [dataKey], reindex: _optionalChain([options, 'optionalAccess', _39 => _39.reindex]) });
5457
+ await deleteKey({ keys: [dataKey], reindex: _optionalChain([options, 'optionalAccess', _40 => _40.reindex]) });
5423
5458
  },
5424
5459
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5425
5460
  DropdownMenuItem,
@@ -5455,12 +5490,12 @@ var DisplayHeader = ({
5455
5490
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyActions, { dataKey, content, type })
5456
5491
  ] })
5457
5492
  ] }),
5458
- type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center gap-1.5 overflow-x-scroll", children: [
5493
+ type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollArea, { orientation: "horizontal", className: "w-full whitespace-nowrap", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-max items-center gap-1.5 pb-2 pt-1", children: [
5459
5494
  !hideTypeTag && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: type, type: "badge" }),
5460
5495
  type !== "search" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SizeBadge, { dataKey }),
5461
5496
  type !== "search" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LengthBadge, { dataKey, type, content }),
5462
5497
  type !== "search" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HeaderTTLBadge, { dataKey })
5463
- ] })
5498
+ ] }) })
5464
5499
  ] });
5465
5500
  };
5466
5501
 
@@ -5499,7 +5534,7 @@ var DocsLink = ({ href, className }) => {
5499
5534
 
5500
5535
  var _reactprogress = require('@radix-ui/react-progress'); var ProgressPrimitive = _interopRequireWildcard(_reactprogress);
5501
5536
 
5502
- var Progress = React12.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5537
+ var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5503
5538
  ProgressPrimitive.Root,
5504
5539
  {
5505
5540
  ref,
@@ -5650,13 +5685,13 @@ var MonacoEditorWithTypes = ({
5650
5685
  const theme = useTheme();
5651
5686
  _react.useEffect.call(void 0, () => {
5652
5687
  if (!monaco) return;
5653
- _optionalChain([extraLibRef, 'access', _40 => _40.current, 'optionalAccess', _41 => _41.dispose, 'call', _42 => _42()]);
5688
+ _optionalChain([extraLibRef, 'access', _41 => _41.current, 'optionalAccess', _42 => _42.dispose, 'call', _43 => _43()]);
5654
5689
  extraLibRef.current = monaco.languages.typescript.typescriptDefaults.addExtraLib(
5655
5690
  typeDefinitions,
5656
5691
  `file:///${filePath.replace(".ts", "-types.d.ts")}`
5657
5692
  );
5658
5693
  requestAnimationFrame(() => {
5659
- const model = _optionalChain([editorRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.getModel, 'optionalCall', _45 => _45()]);
5694
+ const model = _optionalChain([editorRef, 'access', _44 => _44.current, 'optionalAccess', _45 => _45.getModel, 'optionalCall', _46 => _46()]);
5660
5695
  if (model) {
5661
5696
  const currentValue = model.getValue();
5662
5697
  model.setValue(currentValue);
@@ -5665,10 +5700,10 @@ var MonacoEditorWithTypes = ({
5665
5700
  }, [monaco, typeDefinitions, filePath]);
5666
5701
  _react.useEffect.call(void 0, () => {
5667
5702
  return () => {
5668
- _optionalChain([extraLibRef, 'access', _46 => _46.current, 'optionalAccess', _47 => _47.dispose, 'call', _48 => _48()]);
5703
+ _optionalChain([extraLibRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.dispose, 'call', _49 => _49()]);
5669
5704
  if (monaco) {
5670
5705
  const model = monaco.editor.getModel(monaco.Uri.parse(filePath));
5671
- _optionalChain([model, 'optionalAccess', _49 => _49.dispose, 'call', _50 => _50()]);
5706
+ _optionalChain([model, 'optionalAccess', _50 => _50.dispose, 'call', _51 => _51()]);
5672
5707
  }
5673
5708
  };
5674
5709
  }, [monaco, filePath]);
@@ -5678,7 +5713,7 @@ var MonacoEditorWithTypes = ({
5678
5713
  } else if (newValue.trim() === "") {
5679
5714
  onChange(defaultValue);
5680
5715
  } else {
5681
- _optionalChain([editorRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.setValue, 'optionalCall', _53 => _53(valueRef.current)]);
5716
+ _optionalChain([editorRef, 'access', _52 => _52.current, 'optionalAccess', _53 => _53.setValue, 'optionalCall', _54 => _54(valueRef.current)]);
5682
5717
  }
5683
5718
  };
5684
5719
  _react.useEffect.call(void 0, () => {
@@ -5820,7 +5855,7 @@ type TextFieldBuild<TNoTokenize extends Record<"noTokenize", boolean>, TNoStem e
5820
5855
  } : {}) : TFrom["from"] extends string ? {
5821
5856
  type: "TEXT";
5822
5857
  from: TFrom["from"];
5823
- } : "TEXT";
5858
+ } : { type: "TEXT" };
5824
5859
  declare const BUILD: unique symbol;
5825
5860
  declare class TextFieldBuilder<TNoTokenize extends Record<"noTokenize", boolean> = {
5826
5861
  noTokenize: false;
@@ -5888,7 +5923,7 @@ declare class BoolFieldBuilder<Fast extends Record<"fast", boolean> = {
5888
5923
  } : TFrom["from"] extends string ? {
5889
5924
  type: "BOOL";
5890
5925
  from: TFrom["from"];
5891
- } : "BOOL";
5926
+ } : { type: "BOOL" };
5892
5927
  }
5893
5928
  declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
5894
5929
  fast: false;
@@ -5916,7 +5951,13 @@ declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
5916
5951
  } : TFrom["from"] extends string ? {
5917
5952
  type: "DATE";
5918
5953
  from: TFrom["from"];
5919
- } : "DATE";
5954
+ } : { type: "DATE" };
5955
+ }
5956
+ declare class KeywordFieldBuilder {
5957
+ [BUILD](): { type: "KEYWORD" };
5958
+ }
5959
+ declare class FacetFieldBuilder {
5960
+ [BUILD](): { type: "FACET" };
5920
5961
  }
5921
5962
  type FieldBuilder = TextFieldBuilder<{
5922
5963
  noTokenize: boolean;
@@ -5934,12 +5975,14 @@ type FieldBuilder = TextFieldBuilder<{
5934
5975
  fast: boolean;
5935
5976
  }, {
5936
5977
  from: string | null;
5937
- }>;
5978
+ }> | KeywordFieldBuilder | FacetFieldBuilder;
5938
5979
  declare const s: {
5939
5980
  string(): TextFieldBuilder;
5940
5981
  number<T extends NumericField["type"] = "F64">(type?: T): NumericFieldBuilder<T>;
5941
5982
  boolean(): BoolFieldBuilder;
5942
5983
  date(): DateFieldBuilder;
5984
+ keyword(): KeywordFieldBuilder;
5985
+ facet(): FacetFieldBuilder;
5943
5986
  object<T extends ObjectFieldRecord<T>>(fields: T): { [K in keyof T]: T[K] extends FieldBuilder ? ReturnType<T[K][typeof BUILD]> : T[K]; };
5944
5987
  };
5945
5988
  type ObjectFieldRecord<T> = {
@@ -5982,6 +6025,123 @@ var SchemaEditor = ({ value, onChange, height }) => {
5982
6025
  );
5983
6026
  };
5984
6027
 
6028
+ // src/components/databrowser/components/search/schema-stringify.ts
6029
+ function schemaToEditorValue(flatSchema) {
6030
+ const nested = unflattenSchema(flatSchema);
6031
+ const body = renderObject(nested, 1);
6032
+ return `const schema: Schema = s.object({
6033
+ ${body}})`;
6034
+ }
6035
+ function unflattenSchema(flat) {
6036
+ const result = {};
6037
+ for (const [key, value] of Object.entries(flat)) {
6038
+ const parts = key.split(".");
6039
+ let current = result;
6040
+ for (let i = 0; i < parts.length - 1; i++) {
6041
+ const part = parts[i];
6042
+ if (!current[part] || typeof current[part] !== "object") {
6043
+ current[part] = {};
6044
+ }
6045
+ current = current[part];
6046
+ }
6047
+ current[parts.at(-1)] = value;
6048
+ }
6049
+ return result;
6050
+ }
6051
+ function renderObject(obj, indent) {
6052
+ const pad = " ".repeat(indent);
6053
+ const lines = [];
6054
+ for (const [key, value] of Object.entries(obj)) {
6055
+ if (isFieldValue(value)) {
6056
+ lines.push(`${pad}${key}: ${fieldToBuilder(value)},`);
6057
+ } else {
6058
+ const nested = renderObject(value, indent + 1);
6059
+ lines.push(`${pad}${key}: s.object({`);
6060
+ lines.push(nested.trimEnd());
6061
+ lines.push(`${pad}}),`);
6062
+ }
6063
+ }
6064
+ return lines.join("\n") + "\n";
6065
+ }
6066
+ function isFieldValue(value) {
6067
+ if (typeof value === "string") return true;
6068
+ if (typeof value === "object" && value !== null) {
6069
+ return "type" in value;
6070
+ }
6071
+ return false;
6072
+ }
6073
+ function fieldToBuilder(value) {
6074
+ if (typeof value === "string") {
6075
+ switch (value) {
6076
+ case "TEXT": {
6077
+ return "s.string()";
6078
+ }
6079
+ case "BOOL": {
6080
+ return "s.boolean()";
6081
+ }
6082
+ case "DATE": {
6083
+ return "s.date()";
6084
+ }
6085
+ case "U64":
6086
+ case "I64":
6087
+ case "F64": {
6088
+ return `s.number("${value}")`;
6089
+ }
6090
+ case "KEYWORD": {
6091
+ return "s.keyword()";
6092
+ }
6093
+ case "FACET": {
6094
+ return "s.facet()";
6095
+ }
6096
+ default: {
6097
+ return "s.string()";
6098
+ }
6099
+ }
6100
+ }
6101
+ const v = value;
6102
+ const type = v.type;
6103
+ let builder = "";
6104
+ switch (type) {
6105
+ case "TEXT": {
6106
+ builder = "s.string()";
6107
+ if (v.noTokenize) builder += ".noTokenize()";
6108
+ if (v.noStem) builder += ".noStem()";
6109
+ break;
6110
+ }
6111
+ case "U64":
6112
+ case "I64":
6113
+ case "F64": {
6114
+ builder = `s.number("${type}")`;
6115
+ break;
6116
+ }
6117
+ case "BOOL": {
6118
+ builder = "s.boolean()";
6119
+ if (v.fast) builder += ".fast()";
6120
+ break;
6121
+ }
6122
+ case "DATE": {
6123
+ builder = "s.date()";
6124
+ if (v.fast) builder += ".fast()";
6125
+ break;
6126
+ }
6127
+ case "KEYWORD": {
6128
+ builder = "s.keyword()";
6129
+ break;
6130
+ }
6131
+ case "FACET": {
6132
+ builder = "s.facet()";
6133
+ break;
6134
+ }
6135
+ default: {
6136
+ builder = "s.string()";
6137
+ }
6138
+ }
6139
+ if (v.from) {
6140
+ builder += `.from("${v.from}")`;
6141
+ }
6142
+ return builder;
6143
+ }
6144
+
5985
6145
  // src/components/databrowser/components/search/display-search.tsx
5986
6146
 
5987
6147
  var SearchDisplay = ({
@@ -6009,6 +6169,7 @@ var SearchDisplay = ({
6009
6169
  const currentIndexName = watch("indexName");
6010
6170
  const effectiveIndexName = isCreateModal ? currentIndexName : _nullishCoalesce(indexName, () => ( ""));
6011
6171
  const [pendingFormValues, setPendingFormValues] = _react.useState.call(void 0, );
6172
+ const [parseError, setParseError] = _react.useState.call(void 0, );
6012
6173
  const { data, isLoading } = useFetchSearchIndex(indexName, {
6013
6174
  enabled: !isCreateModal
6014
6175
  });
@@ -6019,11 +6180,12 @@ var SearchDisplay = ({
6019
6180
  indexName: _nullishCoalesce(indexName, () => ( "")),
6020
6181
  editorValue: data.schema ? schemaToEditorValue(data.schema) : SCHEMA_DEFAULT,
6021
6182
  dataType: data.dataType || "string",
6022
- prefixes: _optionalChain([data, 'access', _54 => _54.prefixes, 'optionalAccess', _55 => _55.join, 'call', _56 => _56(", ")]) || "",
6183
+ prefixes: _optionalChain([data, 'access', _55 => _55.prefixes, 'optionalAccess', _56 => _56.join, 'call', _57 => _57(", ")]) || "",
6023
6184
  language: data.language || "english"
6024
6185
  });
6025
6186
  }, [data, reset, indexName]);
6026
6187
  const onSubmit = (values) => {
6188
+ setParseError(void 0);
6027
6189
  if (isCreateModal) {
6028
6190
  createSchema.mutate(
6029
6191
  {
@@ -6038,6 +6200,11 @@ var SearchDisplay = ({
6038
6200
  }
6039
6201
  );
6040
6202
  } else {
6203
+ const result = parseSchemaFromEditorValue(values.editorValue);
6204
+ if (!result.success) {
6205
+ setParseError(result.error);
6206
+ return;
6207
+ }
6041
6208
  setPendingFormValues({ ...values, indexName });
6042
6209
  }
6043
6210
  };
@@ -6052,7 +6219,7 @@ var SearchDisplay = ({
6052
6219
  !isCreateModal && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayHeader, { dataKey: effectiveIndexName, type: "search", hideTypeTag: isEditModal }),
6053
6220
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex min-h-0 min-w-0 grow flex-col gap-2 rounded-md", children: !isCreateModal && isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoadingText: "", isLoading: true }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-h-0 w-full flex-1 flex-col gap-3", children: [
6054
6221
  isCreateModal && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-1.5", children: [
6055
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Label, { htmlFor: "index-name", children: "Key" }),
6222
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Label, { htmlFor: "index-name", children: "Index Key" }),
6056
6223
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6057
6224
  Input,
6058
6225
  {
@@ -6134,6 +6301,7 @@ var SearchDisplay = ({
6134
6301
  )
6135
6302
  ] }),
6136
6303
  isCreateModal && createSchema.error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full break-words text-xs text-red-500", children: createSchema.error.message.startsWith("ERR syntax error") ? "Invalid schema" : formatUpstashErrorMessage(createSchema.error) }),
6304
+ parseError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full break-words text-xs text-red-500", children: parseError }),
6137
6305
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "ml-auto flex gap-2", children: [
6138
6306
  (isDirty || isCreateModal || isEditModal) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6139
6307
  Button,
@@ -6156,7 +6324,6 @@ var SearchDisplay = ({
6156
6324
  values: pendingFormValues,
6157
6325
  onClose: () => {
6158
6326
  setPendingFormValues(void 0);
6159
- reset();
6160
6327
  if (isEditModal && onClose) onClose();
6161
6328
  }
6162
6329
  }
@@ -6193,63 +6360,6 @@ var LANGUAGES = [
6193
6360
 
6194
6361
 
6195
6362
 
6196
- // src/components/ui/scroll-area.tsx
6197
-
6198
- var _reactscrollarea = require('@radix-ui/react-scroll-area'); var ScrollAreaPrimitive = _interopRequireWildcard(_reactscrollarea);
6199
-
6200
- var ScrollArea = React13.forwardRef(
6201
- ({
6202
- className,
6203
- scrollBarClassName,
6204
- scrollBarForceMount,
6205
- children,
6206
- onScroll,
6207
- disableRoundedInherit = false,
6208
- ...props
6209
- }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
6210
- ScrollAreaPrimitive.Root,
6211
- {
6212
- ref,
6213
- className: cn("relative overflow-hidden", className),
6214
- ...props,
6215
- children: [
6216
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6217
- ScrollAreaPrimitive.Viewport,
6218
- {
6219
- onScroll,
6220
- className: cn(
6221
- "h-full w-full [&>div]:!block",
6222
- !disableRoundedInherit && "rounded-[inherit]"
6223
- ),
6224
- children
6225
- }
6226
- ),
6227
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollBar, { className: scrollBarClassName, forceMount: scrollBarForceMount }),
6228
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollAreaPrimitive.Corner, {})
6229
- ]
6230
- }
6231
- )
6232
- );
6233
- ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
6234
- var ScrollBar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6235
- ScrollAreaPrimitive.ScrollAreaScrollbar,
6236
- {
6237
- ref,
6238
- orientation: "vertical",
6239
- className: cn("mr-1 flex h-full w-2 touch-none select-none transition-colors", className),
6240
- ...props,
6241
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6242
- ScrollAreaPrimitive.ScrollAreaThumb,
6243
- {
6244
- className: cn("relative flex-1 rounded-full bg-zinc-400/70")
6245
- }
6246
- )
6247
- }
6248
- ));
6249
- ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
6250
-
6251
- // src/components/common/infinite-scroll.tsx
6252
-
6253
6363
  var InfiniteScroll = ({
6254
6364
  query,
6255
6365
  children,
@@ -6287,7 +6397,7 @@ var InfiniteScroll = ({
6287
6397
  type: "always",
6288
6398
  onScroll: handleScroll,
6289
6399
  ...props,
6290
- className: cn("block h-full w-full overflow-visible transition-all", props.className),
6400
+ className: cn("block h-full min-h-0 w-full overflow-hidden transition-all", props.className),
6291
6401
  ref: scrollRef,
6292
6402
  children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: contentRef, children: [
6293
6403
  children,
@@ -6443,7 +6553,7 @@ var ItemContextMenu = ({
6443
6553
  editItem({
6444
6554
  type,
6445
6555
  dataKey,
6446
- itemKey: _optionalChain([data, 'optionalAccess', _57 => _57.key]),
6556
+ itemKey: _optionalChain([data, 'optionalAccess', _58 => _58.key]),
6447
6557
  // For deletion
6448
6558
  newKey: void 0
6449
6559
  });
@@ -6478,7 +6588,7 @@ var ItemContextMenu = ({
6478
6588
  {
6479
6589
  onClick: () => {
6480
6590
  if (!data) return;
6481
- navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _58 => _58.key]));
6591
+ navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _59 => _59.key]));
6482
6592
  toast({
6483
6593
  description: "Key copied to clipboard"
6484
6594
  });
@@ -6490,11 +6600,11 @@ var ItemContextMenu = ({
6490
6600
  ]
6491
6601
  }
6492
6602
  ),
6493
- _optionalChain([data, 'optionalAccess', _59 => _59.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
6603
+ _optionalChain([data, 'optionalAccess', _60 => _60.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
6494
6604
  ContextMenuItem,
6495
6605
  {
6496
6606
  onClick: () => {
6497
- navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _60 => _60.value]), () => ( "")));
6607
+ navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _61 => _61.value]), () => ( "")));
6498
6608
  toast({
6499
6609
  description: "Value copied to clipboard"
6500
6610
  });
@@ -6606,7 +6716,7 @@ var useSetHashTTL = () => {
6606
6716
  var HashFieldTTLBadge = ({ dataKey, field }) => {
6607
6717
  const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
6608
6718
  const { mutate: setTTL, isPending } = useSetHashTTL();
6609
- const expireAt = _optionalChain([data, 'optionalAccess', _61 => _61[field]]);
6719
+ const expireAt = _optionalChain([data, 'optionalAccess', _62 => _62[field]]);
6610
6720
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6611
6721
  TTLBadge,
6612
6722
  {
@@ -6703,7 +6813,7 @@ var MonacoEditor = ({
6703
6813
  if (!active || !monaco || !editorRef.current) {
6704
6814
  return;
6705
6815
  }
6706
- _optionalChain([monaco, 'optionalAccess', _62 => _62.editor, 'access', _63 => _63.setModelLanguage, 'call', _64 => _64(editorRef.current.getModel(), language)]);
6816
+ _optionalChain([monaco, 'optionalAccess', _63 => _63.editor, 'access', _64 => _64.setModelLanguage, 'call', _65 => _65(editorRef.current.getModel(), language)]);
6707
6817
  }, [monaco, language, active]);
6708
6818
  const editor = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6709
6819
  _react2.Editor,
@@ -6879,7 +6989,7 @@ var ListEditForm = ({
6879
6989
  dataKey
6880
6990
  });
6881
6991
  const findValue = () => {
6882
- for (const page of _nullishCoalesce(_optionalChain([query, 'access', _65 => _65.data, 'optionalAccess', _66 => _66.pages]), () => ( []))) {
6992
+ for (const page of _nullishCoalesce(_optionalChain([query, 'access', _66 => _66.data, 'optionalAccess', _67 => _67.pages]), () => ( []))) {
6883
6993
  const item = page.keys.find((item2) => item2.key === itemKey);
6884
6994
  if (item && "value" in item) return item.value;
6885
6995
  }
@@ -7025,7 +7135,7 @@ var HashFieldTTLInfo = ({
7025
7135
  fields
7026
7136
  }) => {
7027
7137
  const { data } = useFetchHashFieldExpires({ dataKey, fields });
7028
- const expireAt = _optionalChain([data, 'optionalAccess', _67 => _67[field]]);
7138
+ const expireAt = _optionalChain([data, 'optionalAccess', _68 => _68[field]]);
7029
7139
  const [ttl, setTTL] = _react.useState.call(void 0, () => calculateTTL(expireAt));
7030
7140
  _react.useEffect.call(void 0, () => {
7031
7141
  setTTL(calculateTTL(expireAt));
@@ -7050,7 +7160,7 @@ var headerLabels = {
7050
7160
  var ListDisplay = ({ dataKey, type }) => {
7051
7161
  const { selectedListItem } = useTab();
7052
7162
  const query = useFetchListItems({ dataKey, type });
7053
- const isEmpty = query.isFetched && _optionalChain([query, 'access', _68 => _68.data, 'optionalAccess', _69 => _69.pages, 'access', _70 => _70.every, 'call', _71 => _71((page) => page.keys.length === 0)]);
7163
+ const isEmpty = query.isFetched && _optionalChain([query, 'access', _69 => _69.data, 'optionalAccess', _70 => _70.pages, 'access', _71 => _71.every, 'call', _72 => _72((page) => page.keys.length === 0)]);
7054
7164
  if (isEmpty) {
7055
7165
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyDeleted, {});
7056
7166
  }
@@ -7066,7 +7176,7 @@ var ListItems = ({
7066
7176
  dataKey
7067
7177
  }) => {
7068
7178
  const { setSelectedListItem } = useTab();
7069
- const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _72 => _72.data, 'optionalAccess', _73 => _73.pages, 'access', _74 => _74.flatMap, 'call', _75 => _75((page) => page.keys)]), () => ( [])), [query.data]);
7179
+ const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _73 => _73.data, 'optionalAccess', _74 => _74.pages, 'access', _75 => _75.flatMap, 'call', _76 => _76((page) => page.keys)]), () => ( [])), [query.data]);
7070
7180
  const fields = _react.useMemo.call(void 0, () => keys.map((key) => key.key), [keys]);
7071
7181
  const { mutate: editItem } = useEditListItem();
7072
7182
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
@@ -7238,7 +7348,7 @@ function AddKeyModal() {
7238
7348
  setSelectedKey(key);
7239
7349
  setOpen(false);
7240
7350
  setTimeout(() => {
7241
- _optionalChain([window, 'access', _76 => _76.document, 'access', _77 => _77.querySelector, 'call', _78 => _78(`[data-key="${key}"]`), 'optionalAccess', _79 => _79.scrollIntoView, 'call', _80 => _80({
7351
+ _optionalChain([window, 'access', _77 => _77.document, 'access', _78 => _78.querySelector, 'call', _79 => _79(`[data-key="${key}"]`), 'optionalAccess', _80 => _80.scrollIntoView, 'call', _81 => _81({
7242
7352
  behavior: "smooth",
7243
7353
  block: "start",
7244
7354
  inline: "nearest"
@@ -7294,7 +7404,7 @@ function AddKeyModal() {
7294
7404
  }
7295
7405
  )
7296
7406
  ] }),
7297
- formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _81 => _81.errors, 'access', _82 => _82.key, 'optionalAccess', _83 => _83.message]) }),
7407
+ formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _82 => _82.errors, 'access', _83 => _83.key, 'optionalAccess', _84 => _84.message]) }),
7298
7408
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
7299
7409
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
7300
7410
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -7377,8 +7487,16 @@ var ConsentPrompt = ({ onClose }) => {
7377
7487
 
7378
7488
  // src/components/databrowser/components/search/search-types-file.ts
7379
7489
  var SEARCH_TYPES = `
7380
-
7381
- export const FIELD_TYPES = ["TEXT", "U64", "I64", "F64", "BOOL", "DATE"] as const;
7490
+ export const FIELD_TYPES = [
7491
+ "TEXT",
7492
+ "U64",
7493
+ "I64",
7494
+ "F64",
7495
+ "BOOL",
7496
+ "DATE",
7497
+ "KEYWORD",
7498
+ "FACET",
7499
+ ] as const;
7382
7500
  export type FieldType = (typeof FIELD_TYPES)[number];
7383
7501
 
7384
7502
  export type TextField = {
@@ -7406,7 +7524,21 @@ export type DateField = {
7406
7524
  from?: string;
7407
7525
  };
7408
7526
 
7409
- export type DetailedField = TextField | NumericField | BoolField | DateField;
7527
+ export type KeywordField = {
7528
+ type: "KEYWORD";
7529
+ };
7530
+
7531
+ export type FacetField = {
7532
+ type: "FACET";
7533
+ };
7534
+
7535
+ export type DetailedField =
7536
+ | TextField
7537
+ | NumericField
7538
+ | BoolField
7539
+ | DateField
7540
+ | KeywordField
7541
+ | FacetField;
7410
7542
  export type NestedIndexSchema = {
7411
7543
  [key: string]: FieldType | DetailedField | NestedIndexSchema;
7412
7544
  };
@@ -7454,7 +7586,11 @@ type FieldValueType<T extends FieldType> = T extends "TEXT"
7454
7586
  ? boolean
7455
7587
  : T extends "DATE"
7456
7588
  ? string
7457
- : never;
7589
+ : T extends "KEYWORD"
7590
+ ? string
7591
+ : T extends "FACET"
7592
+ ? string
7593
+ : never;
7458
7594
 
7459
7595
  type GetFieldValueType<TSchema, Path extends string> =
7460
7596
  GetFieldAtPath<TSchema, Path> extends infer Field
@@ -7561,7 +7697,7 @@ type PathToNestedObject<
7561
7697
  TSchema,
7562
7698
  Path extends string,
7563
7699
  Value,
7564
- > = Path extends \`\${ infer First }.\${ infer Rest }\`
7700
+ > = Path extends \`\${infer First}.\${infer Rest}\`
7565
7701
  ? { [K in First]: PathToNestedObject<TSchema, Rest, Value> }
7566
7702
  : { [K in Path]: Value };
7567
7703
 
@@ -7638,7 +7774,6 @@ export type PublicQueryResult<
7638
7774
  // These are the operations that can be used for each field type
7639
7775
  type StringOperationMap<T extends string> = {
7640
7776
  $eq: T;
7641
- $ne: T;
7642
7777
  $in: T[];
7643
7778
  $fuzzy: T | { value: T; distance?: number; transpositionCostOne?: boolean };
7644
7779
  $phrase:
@@ -7652,7 +7787,15 @@ type StringOperationMap<T extends string> = {
7652
7787
 
7653
7788
  type NumberOperationMap<T extends number> = {
7654
7789
  $eq: T;
7655
- $ne: T;
7790
+ $in: T[];
7791
+ $gt: T;
7792
+ $gte: T;
7793
+ $lt: T;
7794
+ $lte: T;
7795
+ };
7796
+
7797
+ type KeywordOperationMap<T extends string> = {
7798
+ $eq: T;
7656
7799
  $in: T[];
7657
7800
  $gt: T;
7658
7801
  $gte: T;
@@ -7662,13 +7805,11 @@ type NumberOperationMap<T extends number> = {
7662
7805
 
7663
7806
  type BooleanOperationMap<T extends boolean> = {
7664
7807
  $eq: T;
7665
- $ne: T;
7666
7808
  $in: T[];
7667
7809
  };
7668
7810
 
7669
7811
  type DateOperationMap<T extends string | Date> = {
7670
7812
  $eq: T;
7671
- $ne: T;
7672
7813
  $in: T[];
7673
7814
  $gt: T;
7674
7815
  $gte: T;
@@ -7676,6 +7817,11 @@ type DateOperationMap<T extends string | Date> = {
7676
7817
  $lt: T;
7677
7818
  };
7678
7819
 
7820
+ type FacetOperationMap<T extends string> = {
7821
+ $eq: T;
7822
+ $in: T[];
7823
+ };
7824
+
7679
7825
  // Create union types for each field type
7680
7826
  type StringOperations = {
7681
7827
  [K in keyof StringOperationMap<string>]: { [P in K]: StringOperationMap<string>[K] } & {
@@ -7701,6 +7847,18 @@ type DateOperations = {
7701
7847
  };
7702
7848
  }[keyof DateOperationMap<string | Date>];
7703
7849
 
7850
+ type KeywordOperations = {
7851
+ [K in keyof KeywordOperationMap<string>]: { [P in K]: KeywordOperationMap<string>[K] } & {
7852
+ $boost?: number;
7853
+ };
7854
+ }[keyof KeywordOperationMap<string>];
7855
+
7856
+ type FacetOperations = {
7857
+ [K in keyof FacetOperationMap<string>]: { [P in K]: FacetOperationMap<string>[K] } & {
7858
+ $boost?: number;
7859
+ };
7860
+ }[keyof FacetOperationMap<string>];
7861
+
7704
7862
  // Create a union type for all operations for a given field type
7705
7863
  type OperationsForFieldType<T extends FieldType> = T extends "TEXT"
7706
7864
  ? StringOperations
@@ -7710,7 +7868,11 @@ type OperationsForFieldType<T extends FieldType> = T extends "TEXT"
7710
7868
  ? BooleanOperations
7711
7869
  : T extends "DATE"
7712
7870
  ? DateOperations
7713
- : never;
7871
+ : T extends "KEYWORD"
7872
+ ? KeywordOperations
7873
+ : T extends "FACET"
7874
+ ? FacetOperations
7875
+ : never;
7714
7876
 
7715
7877
  // Create a union type for all operations for a given path
7716
7878
  type PathOperations<TSchema, TPath extends string> =
@@ -7878,7 +8040,7 @@ type RootOrNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
7878
8040
  $and?: never;
7879
8041
  $must?: never;
7880
8042
  $should?: never;
7881
- $mustNot?: never;
8043
+ $mustNot?: QueryFilter<TSchema> | QueryFilter<TSchema>[];
7882
8044
  };
7883
8045
 
7884
8046
  export type DescribeFieldInfo = {
@@ -7916,6 +8078,298 @@ export type Language =
7916
8078
  | "tamil"
7917
8079
  | "turkish";
7918
8080
 
8081
+ // Helper type to extract only FACET field paths from schema
8082
+ export type FacetPaths<T, Prefix extends string = ""> = {
8083
+ [K in keyof T]: K extends string
8084
+ ? T[K] extends "FACET" | { type: "FACET" }
8085
+ ? Prefix extends ""
8086
+ ? K
8087
+ : \`\${Prefix}\${K}\`
8088
+ : T[K] extends FieldType | DetailedField
8089
+ ? never
8090
+ : T[K] extends object
8091
+ ? FacetPaths<T[K], \`\${Prefix}\${K}.\`>
8092
+ : never
8093
+ : never;
8094
+ }[keyof T];
8095
+
8096
+ // Aggregate Types
8097
+ export type AggregateOptions<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
8098
+ filter?: RootQueryFilter<TSchema>;
8099
+ aggregations: {
8100
+ [key: string]: Aggregation<TSchema>;
8101
+ };
8102
+ };
8103
+
8104
+ export type Aggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8105
+ | TermsAggregation<TSchema>
8106
+ | RangeAggregation<TSchema>
8107
+ | HistogramAggregation<TSchema>
8108
+ | StatsAggregation<TSchema>
8109
+ | AvgAggregation<TSchema>
8110
+ | SumAggregation<TSchema>
8111
+ | MinAggregation<TSchema>
8112
+ | MaxAggregation<TSchema>
8113
+ | CountAggregation<TSchema>
8114
+ | ExtendedStatsAggregation<TSchema>
8115
+ | PercentilesAggregation<TSchema>
8116
+ | CardinalityAggregation<TSchema>
8117
+ | FacetAggregation<TSchema>;
8118
+
8119
+ type BaseAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
8120
+ $aggs?: {
8121
+ [key: string]: Aggregation<TSchema>;
8122
+ };
8123
+ };
8124
+
8125
+ export type TermsAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8126
+ BaseAggregation<TSchema> & {
8127
+ $terms: {
8128
+ field: SchemaPaths<TSchema>;
8129
+ size?: number;
8130
+ };
8131
+ };
8132
+
8133
+ export type RangeAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8134
+ BaseAggregation<TSchema> & {
8135
+ $range: {
8136
+ field: SchemaPaths<TSchema>;
8137
+ ranges: { from?: number; to?: number }[];
8138
+ };
8139
+ };
8140
+
8141
+ export type HistogramAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8142
+ BaseAggregation<TSchema> & {
8143
+ $histogram: {
8144
+ field: SchemaPaths<TSchema>;
8145
+ interval: number;
8146
+ };
8147
+ };
8148
+
8149
+ export type StatsAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8150
+ BaseAggregation<TSchema> & {
8151
+ $stats: {
8152
+ field: SchemaPaths<TSchema>;
8153
+ missing?: number;
8154
+ };
8155
+ };
8156
+
8157
+ export type AvgAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8158
+ BaseAggregation<TSchema> & {
8159
+ $avg: {
8160
+ field: SchemaPaths<TSchema>;
8161
+ missing?: number;
8162
+ };
8163
+ };
8164
+
8165
+ export type SumAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8166
+ BaseAggregation<TSchema> & {
8167
+ $sum: {
8168
+ field: SchemaPaths<TSchema>;
8169
+ missing?: number;
8170
+ };
8171
+ };
8172
+
8173
+ export type MinAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8174
+ BaseAggregation<TSchema> & {
8175
+ $min: {
8176
+ field: SchemaPaths<TSchema>;
8177
+ missing?: number;
8178
+ };
8179
+ };
8180
+
8181
+ export type MaxAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8182
+ BaseAggregation<TSchema> & {
8183
+ $max: {
8184
+ field: SchemaPaths<TSchema>;
8185
+ missing?: number;
8186
+ };
8187
+ };
8188
+
8189
+ export type CountAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8190
+ BaseAggregation<TSchema> & {
8191
+ $count: {
8192
+ field: SchemaPaths<TSchema>;
8193
+ };
8194
+ };
8195
+
8196
+ export type ExtendedStatsAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8197
+ BaseAggregation<TSchema> & {
8198
+ $extendedStats: {
8199
+ field: SchemaPaths<TSchema>;
8200
+ sigma?: number;
8201
+ missing?: number;
8202
+ };
8203
+ };
8204
+
8205
+ export type PercentilesAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8206
+ BaseAggregation<TSchema> & {
8207
+ $percentiles: {
8208
+ field: SchemaPaths<TSchema>;
8209
+ percents?: number[];
8210
+ keyed?: boolean;
8211
+ missing?: number;
8212
+ };
8213
+ };
8214
+
8215
+ export type CardinalityAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8216
+ BaseAggregation<TSchema> & {
8217
+ $cardinality: {
8218
+ field: SchemaPaths<TSchema>;
8219
+ };
8220
+ };
8221
+
8222
+ export type FacetAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
8223
+ BaseAggregation<TSchema> & {
8224
+ $facet: {
8225
+ field: FacetPaths<TSchema>;
8226
+ path: string;
8227
+ depth?: number;
8228
+ size?: number;
8229
+ minDocCount?: number;
8230
+ order?: { count: "desc" | "asc" };
8231
+ };
8232
+ };
8233
+
8234
+ export type AggregateResult<
8235
+ TSchema extends NestedIndexSchema | FlatIndexSchema,
8236
+ TOpts extends AggregateOptions<TSchema>,
8237
+ > = BuildAggregateResult<TSchema, TOpts["aggregations"]>;
8238
+
8239
+ type BuildAggregateResult<
8240
+ TSchema extends NestedIndexSchema | FlatIndexSchema,
8241
+ TAggs extends { [key: string]: Aggregation<TSchema> },
8242
+ > = {
8243
+ [K in keyof TAggs]: TAggs[K] extends TermsAggregation<TSchema>
8244
+ ? TermsResult<TSchema, TAggs[K]>
8245
+ : TAggs[K] extends RangeAggregation<TSchema>
8246
+ ? RangeResult<TSchema, TAggs[K]>
8247
+ : TAggs[K] extends HistogramAggregation<TSchema>
8248
+ ? HistogramResult<TSchema, TAggs[K]>
8249
+ : TAggs[K] extends StatsAggregation<TSchema>
8250
+ ? StatsResult
8251
+ : TAggs[K] extends AvgAggregation<TSchema>
8252
+ ? MetricValueResult
8253
+ : TAggs[K] extends SumAggregation<TSchema>
8254
+ ? MetricValueResult
8255
+ : TAggs[K] extends MinAggregation<TSchema>
8256
+ ? MetricValueResult
8257
+ : TAggs[K] extends MaxAggregation<TSchema>
8258
+ ? MetricValueResult
8259
+ : TAggs[K] extends CountAggregation<TSchema>
8260
+ ? MetricValueResult
8261
+ : TAggs[K] extends CardinalityAggregation<TSchema>
8262
+ ? MetricValueResult
8263
+ : TAggs[K] extends ExtendedStatsAggregation<TSchema>
8264
+ ? ExtendedStatsResult<TAggs[K]>
8265
+ : TAggs[K] extends PercentilesAggregation<TSchema>
8266
+ ? PercentilesResult<TAggs[K]>
8267
+ : TAggs[K] extends FacetAggregation<TSchema>
8268
+ ? FacetResult
8269
+ : never;
8270
+ };
8271
+
8272
+ type Bucket<T> = {
8273
+ key: T;
8274
+ docCount: number;
8275
+ from?: number;
8276
+ to?: number;
8277
+ };
8278
+
8279
+ type TermsResult<
8280
+ TSchema extends NestedIndexSchema | FlatIndexSchema,
8281
+ TAgg extends TermsAggregation<TSchema>,
8282
+ > = TAgg["$aggs"] extends { [key: string]: Aggregation<TSchema> }
8283
+ ? {
8284
+ buckets: (Bucket<GetFieldValueType<TSchema, TAgg["$terms"]["field"]>> &
8285
+ BuildAggregateResult<TSchema, TAgg["$aggs"]>)[];
8286
+ sumOtherDocCount: number;
8287
+ docCountErrorUpperBound: number;
8288
+ }
8289
+ : {
8290
+ buckets: Bucket<GetFieldValueType<TSchema, TAgg["$terms"]["field"]>>[];
8291
+ sumOtherDocCount: number;
8292
+ docCountErrorUpperBound: number;
8293
+ };
8294
+
8295
+ type RangeResult<
8296
+ TSchema extends NestedIndexSchema | FlatIndexSchema,
8297
+ TAgg extends RangeAggregation<TSchema>,
8298
+ > = TAgg["$aggs"] extends { [key: string]: Aggregation<TSchema> }
8299
+ ? {
8300
+ buckets: (Bucket<string> & BuildAggregateResult<TSchema, TAgg["$aggs"]>)[];
8301
+ }
8302
+ : {
8303
+ buckets: Bucket<string>[];
8304
+ };
8305
+
8306
+ type HistogramResult<
8307
+ TSchema extends NestedIndexSchema | FlatIndexSchema,
8308
+ TAgg extends HistogramAggregation<TSchema>,
8309
+ > = TAgg["$aggs"] extends { [key: string]: Aggregation<TSchema> }
8310
+ ? {
8311
+ buckets: (Bucket<number> & BuildAggregateResult<TSchema, TAgg["$aggs"]>)[];
8312
+ }
8313
+ : {
8314
+ buckets: Bucket<number>[];
8315
+ };
8316
+
8317
+ type MetricValueResult = {
8318
+ value: number;
8319
+ };
8320
+
8321
+ type StatsResult = {
8322
+ count: number;
8323
+ min: number;
8324
+ max: number;
8325
+ sum: number;
8326
+ avg: number;
8327
+ };
8328
+
8329
+ type ExtendedStatsResult<_TAgg> = {
8330
+ count: number;
8331
+ min: number;
8332
+ max: number;
8333
+ avg: number;
8334
+ sum: number;
8335
+ sumOfSquares: number;
8336
+ variance: number;
8337
+ variancePopulation: number;
8338
+ varianceSampling: number;
8339
+ stdDeviation: number;
8340
+ stdDeviationPopulation: number;
8341
+ stdDeviationSampling: number;
8342
+ stdDeviationBounds: {
8343
+ upper: number;
8344
+ lower: number;
8345
+ upperSampling: number;
8346
+ lowerSampling: number;
8347
+ upperPopulation: number;
8348
+ lowerPopulation: number;
8349
+ };
8350
+ };
8351
+
8352
+ type PercentilesResult<TAgg> = TAgg extends { $percentiles: { keyed: false } }
8353
+ ? {
8354
+ values: Array<{ key: number; value: number }>;
8355
+ }
8356
+ : {
8357
+ values: { [key: string]: number };
8358
+ };
8359
+
8360
+ type FacetChildNode = {
8361
+ path: string;
8362
+ docCount: number;
8363
+ sumOtherDocCount: number;
8364
+ children?: FacetChildNode[];
8365
+ };
8366
+
8367
+ type FacetResult = {
8368
+ path: string;
8369
+ sumOtherDocCount: number;
8370
+ children: FacetChildNode[];
8371
+ };
8372
+
7919
8373
  `;
7920
8374
 
7921
8375
  // src/components/databrowser/components/query-wizard/use-query-wizard.tsx
@@ -7963,7 +8417,7 @@ var QueryWizardPopover = ({ onClose }) => {
7963
8417
  if (!input.trim() || !valuesSearch.index) return;
7964
8418
  try {
7965
8419
  let samples = sampleData;
7966
- if (samples.length === 0 && _optionalChain([indexData, 'optionalAccess', _84 => _84.prefixes, 'optionalAccess', _85 => _85[0]])) {
8420
+ if (samples.length === 0 && _optionalChain([indexData, 'optionalAccess', _85 => _85.prefixes, 'optionalAccess', _86 => _86[0]])) {
7967
8421
  try {
7968
8422
  const firstTenKeys = await scanKeys(redis, {
7969
8423
  match: `${indexData.prefixes[0]}*`,
@@ -8001,7 +8455,7 @@ var QueryWizardPopover = ({ onClose }) => {
8001
8455
  const queryString = toJsLiteral(result.query);
8002
8456
  setValuesSearchQuery(queryString);
8003
8457
  setQueryBuilderMode("code");
8004
- _optionalChain([onClose, 'optionalCall', _86 => _86()]);
8458
+ _optionalChain([onClose, 'optionalCall', _87 => _87()]);
8005
8459
  } catch (error) {
8006
8460
  console.error("Error generating query:", error);
8007
8461
  }
@@ -8112,7 +8566,7 @@ var CreateIndexModal = ({
8112
8566
  className: "max-w-2xl",
8113
8567
  onEscapeKeyDown: (e) => {
8114
8568
  const active = document.activeElement;
8115
- if (_optionalChain([active, 'optionalAccess', _87 => _87.closest, 'call', _88 => _88(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _89 => _89.tagName]) === "TEXTAREA") {
8569
+ if (_optionalChain([active, 'optionalAccess', _88 => _88.closest, 'call', _89 => _89(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _90 => _90.tagName]) === "TEXTAREA") {
8116
8570
  e.preventDefault();
8117
8571
  }
8118
8572
  },
@@ -8147,7 +8601,7 @@ var EditIndexModal = ({
8147
8601
  className: "min-h-[500px] max-w-2xl",
8148
8602
  onEscapeKeyDown: (e) => {
8149
8603
  const active = document.activeElement;
8150
- if (_optionalChain([active, 'optionalAccess', _90 => _90.closest, 'call', _91 => _91(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _92 => _92.tagName]) === "TEXTAREA") {
8604
+ if (_optionalChain([active, 'optionalAccess', _91 => _91.closest, 'call', _92 => _92(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _93 => _93.tagName]) === "TEXTAREA") {
8151
8605
  e.preventDefault();
8152
8606
  }
8153
8607
  },
@@ -8261,7 +8715,7 @@ var SearchInput = () => {
8261
8715
  } else if (e.key === "Escape") {
8262
8716
  setState("");
8263
8717
  setFocusedIndex(-1);
8264
- _optionalChain([inputRef, 'access', _93 => _93.current, 'optionalAccess', _94 => _94.blur, 'call', _95 => _95()]);
8718
+ _optionalChain([inputRef, 'access', _94 => _94.current, 'optionalAccess', _95 => _95.blur, 'call', _96 => _96()]);
8265
8719
  } else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
8266
8720
  e.preventDefault();
8267
8721
  if (focusedIndex < filteredHistory.length - 1) {
@@ -8275,7 +8729,7 @@ var SearchInput = () => {
8275
8729
  setFocusedIndex(focusedIndex - 1);
8276
8730
  } else if (filteredHistory.length > 0 && focusedIndex === 0) {
8277
8731
  setFocusedIndex(-1);
8278
- _optionalChain([inputRef, 'access', _96 => _96.current, 'optionalAccess', _97 => _97.focus, 'call', _98 => _98()]);
8732
+ _optionalChain([inputRef, 'access', _97 => _97.current, 'optionalAccess', _98 => _98.focus, 'call', _99 => _99()]);
8279
8733
  } else if (filteredHistory.length > 0) {
8280
8734
  setFocusedIndex(filteredHistory.length - 1);
8281
8735
  }
@@ -8435,7 +8889,7 @@ var IndexSelector = () => {
8435
8889
  }, [indexes, index, isLoading, setValuesSearchIndex]);
8436
8890
  const [search, setSearch] = _react.useState.call(void 0, "");
8437
8891
  const [editingIndex, setEditingIndex] = _react.useState.call(void 0, );
8438
- const filteredIndexes = _optionalChain([indexes, 'optionalAccess', _99 => _99.filter, 'call', _100 => _100((idx) => idx.toLowerCase().includes(search.toLowerCase()))]);
8892
+ const filteredIndexes = _optionalChain([indexes, 'optionalAccess', _100 => _100.filter, 'call', _101 => _101((idx) => idx.toLowerCase().includes(search.toLowerCase()))]);
8439
8893
  const handleEditIndex = (indexName) => {
8440
8894
  setOpen(false);
8441
8895
  setEditingIndex(indexName);
@@ -8472,8 +8926,8 @@ var IndexSelector = () => {
8472
8926
  )
8473
8927
  ] }),
8474
8928
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "max-h-[200px] overflow-y-auto", children: [
8475
- _optionalChain([filteredIndexes, 'optionalAccess', _101 => _101.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
8476
- _optionalChain([filteredIndexes, 'optionalAccess', _102 => _102.map, 'call', _103 => _103((idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
8929
+ _optionalChain([filteredIndexes, 'optionalAccess', _102 => _102.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
8930
+ _optionalChain([filteredIndexes, 'optionalAccess', _103 => _103.map, 'call', _104 => _104((idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
8477
8931
  "div",
8478
8932
  {
8479
8933
  className: "flex h-9 items-center rounded-md px-2 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-200",
@@ -8632,7 +9086,7 @@ var generateNestedInterface = (obj, indent = " ") => {
8632
9086
  var toAmbientTypes = (types) => types.replaceAll(/export const (\w+) = (\[.*?]) as const;/g, "declare const $1: readonly $2;").replaceAll("export ", "");
8633
9087
  var generateTypeDefinitions = (schema) => {
8634
9088
  let schemaFieldsInterface = "";
8635
- const schemaFields = _optionalChain([schema, 'optionalAccess', _104 => _104.schema]);
9089
+ const schemaFields = _optionalChain([schema, 'optionalAccess', _105 => _105.schema]);
8636
9090
  if (schemaFields && Object.keys(schemaFields).length > 0) {
8637
9091
  const nested = buildNestedSchema(schemaFields);
8638
9092
  const fieldLines = generateNestedInterface(nested);
@@ -8688,7 +9142,7 @@ var QueryBuilder = () => {
8688
9142
  const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
8689
9143
  const editorValue = PREFIX + (valuesSearch.query || "{}");
8690
9144
  if (!indexDetails) return;
8691
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full flex-col rounded-lg border border-zinc-300 bg-white px-[6px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9145
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full flex-col rounded-lg border border-zinc-300 bg-white px-[6px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "relative min-h-0 flex-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute inset-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
8692
9146
  QueryEditor,
8693
9147
  {
8694
9148
  value: editorValue,
@@ -8698,7 +9152,7 @@ var QueryBuilder = () => {
8698
9152
  },
8699
9153
  schema: indexDetails
8700
9154
  }
8701
- ) }) });
9155
+ ) }) }) });
8702
9156
  };
8703
9157
 
8704
9158
  // src/components/databrowser/components/query-builder-error.tsx
@@ -9090,7 +9544,7 @@ var SidebarContextMenu = ({ children }) => {
9090
9544
  showReindex: isValuesSearchSelected,
9091
9545
  onDeleteConfirm: async (e, options) => {
9092
9546
  e.stopPropagation();
9093
- await deleteKey({ keys: contextKeys, reindex: _optionalChain([options, 'optionalAccess', _105 => _105.reindex]) });
9547
+ await deleteKey({ keys: contextKeys, reindex: _optionalChain([options, 'optionalAccess', _106 => _106.reindex]) });
9094
9548
  setAlertOpen(false);
9095
9549
  }
9096
9550
  }
@@ -9260,7 +9714,7 @@ function Sidebar() {
9260
9714
  {
9261
9715
  query,
9262
9716
  disableRoundedInherit: true,
9263
- className: "min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4 dark:bg-zinc-200",
9717
+ className: "h-full min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4 dark:bg-zinc-200",
9264
9718
  scrollBarClassName: "py-5",
9265
9719
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeysList, {})
9266
9720
  }
@@ -9275,22 +9729,13 @@ function Sidebar() {
9275
9729
 
9276
9730
 
9277
9731
  // src/components/databrowser/components/ui-query-builder/types.ts
9278
- var STRING_OPERATORS = [
9279
- "smart",
9280
- "eq",
9281
- "ne",
9282
- "in",
9283
- "phrase",
9284
- "regex",
9285
- "fuzzy"
9286
- ];
9287
- var NUMBER_OPERATORS = ["eq", "ne", "gt", "gte", "lt", "lte"];
9288
- var BOOLEAN_OPERATORS = ["eq", "ne"];
9732
+ var STRING_OPERATORS = ["smart", "eq", "in", "phrase", "regex", "fuzzy"];
9733
+ var NUMBER_OPERATORS = ["eq", "gt", "gte", "lt", "lte"];
9734
+ var BOOLEAN_OPERATORS = ["eq"];
9289
9735
  var DATE_OPERATORS = NUMBER_OPERATORS;
9290
9736
  var ALL_OPERATORS = [
9291
9737
  "smart",
9292
9738
  "eq",
9293
- "ne",
9294
9739
  "gt",
9295
9740
  "gte",
9296
9741
  "lt",
@@ -9302,7 +9747,6 @@ var ALL_OPERATORS = [
9302
9747
  ];
9303
9748
  var OPERATOR_DESCRIPTIONS = {
9304
9749
  eq: "Equals",
9305
- ne: "Not equals",
9306
9750
  gt: "Greater than",
9307
9751
  gte: "Greater than or equal",
9308
9752
  lt: "Less than",
@@ -9316,7 +9760,6 @@ var OPERATOR_DESCRIPTIONS = {
9316
9760
  var OPERATOR_OPTIONS = [
9317
9761
  { value: "smart", label: "smart" },
9318
9762
  { value: "eq", label: "eq" },
9319
- { value: "ne", label: "ne" },
9320
9763
  { value: "gt", label: "gt" },
9321
9764
  { value: "gte", label: "gte" },
9322
9765
  { value: "lt", label: "lt" },
@@ -9997,7 +10440,7 @@ var QueryCondition = ({
9997
10440
  setLocalValue(formattedConditionValue);
9998
10441
  }
9999
10442
  const currentFieldInfo = fieldInfos.find((f) => f.name === condition.field);
10000
- const currentFieldType = _nullishCoalesce(_optionalChain([currentFieldInfo, 'optionalAccess', _106 => _106.type]), () => ( "unknown"));
10443
+ const currentFieldType = _nullishCoalesce(_optionalChain([currentFieldInfo, 'optionalAccess', _107 => _107.type]), () => ( "unknown"));
10001
10444
  const isUnknownField = condition.field && !fieldNames.includes(condition.field);
10002
10445
  const getValueTypeError = () => {
10003
10446
  if (isUnknownField || currentFieldType === "unknown" || currentFieldType === "string") {
@@ -10055,8 +10498,8 @@ var QueryCondition = ({
10055
10498
  }
10056
10499
  }, [currentFieldType, condition.value]);
10057
10500
  const handleFieldChange = (value) => {
10058
- const newFieldInfo = _optionalChain([fieldInfos, 'optionalAccess', _107 => _107.find, 'call', _108 => _108((f) => f.name === value)]);
10059
- const newFieldType = _nullishCoalesce(_optionalChain([newFieldInfo, 'optionalAccess', _109 => _109.type]), () => ( "unknown"));
10501
+ const newFieldInfo = _optionalChain([fieldInfos, 'optionalAccess', _108 => _108.find, 'call', _109 => _109((f) => f.name === value)]);
10502
+ const newFieldType = _nullishCoalesce(_optionalChain([newFieldInfo, 'optionalAccess', _110 => _110.type]), () => ( "unknown"));
10060
10503
  const validOperators = getOperatorsForFieldType(newFieldType);
10061
10504
  const isOperatorValid = validOperators.includes(condition.operator);
10062
10505
  let newValue = condition.value;
@@ -10197,10 +10640,10 @@ var QueryCondition = ({
10197
10640
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10198
10641
  "div",
10199
10642
  {
10200
- ref: _optionalChain([dragHandleProps, 'optionalAccess', _110 => _110.ref]),
10643
+ ref: _optionalChain([dragHandleProps, 'optionalAccess', _111 => _111.ref]),
10201
10644
  className: "flex cursor-grab items-center px-1 text-zinc-400 hover:text-zinc-600",
10202
- ..._optionalChain([dragHandleProps, 'optionalAccess', _111 => _111.attributes]),
10203
- ..._optionalChain([dragHandleProps, 'optionalAccess', _112 => _112.listeners]),
10645
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _112 => _112.attributes]),
10646
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _113 => _113.listeners]),
10204
10647
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconGripVertical, { size: 16 })
10205
10648
  }
10206
10649
  ),
@@ -10708,10 +11151,10 @@ var InnerGroup = ({
10708
11151
  !isRoot && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10709
11152
  "div",
10710
11153
  {
10711
- ref: _optionalChain([dragHandleProps, 'optionalAccess', _113 => _113.ref]),
11154
+ ref: _optionalChain([dragHandleProps, 'optionalAccess', _114 => _114.ref]),
10712
11155
  className: "flex cursor-grab items-center px-1 text-zinc-400",
10713
- ..._optionalChain([dragHandleProps, 'optionalAccess', _114 => _114.attributes]),
10714
- ..._optionalChain([dragHandleProps, 'optionalAccess', _115 => _115.listeners]),
11156
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _115 => _115.attributes]),
11157
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _116 => _116.listeners]),
10715
11158
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconGripVertical, { size: 16 })
10716
11159
  }
10717
11160
  ),
@@ -11060,7 +11503,7 @@ var UIQueryBuilder = () => {
11060
11503
  const { valuesSearch } = useTab();
11061
11504
  const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
11062
11505
  const { queryState, setQueryState } = useQueryStateSync();
11063
- const fieldInfos = _optionalChain([indexDetails, 'optionalAccess', _116 => _116.schema]) ? extractFieldInfo(indexDetails.schema) : [];
11506
+ const fieldInfos = _optionalChain([indexDetails, 'optionalAccess', _117 => _117.schema]) ? extractFieldInfo(indexDetails.schema) : [];
11064
11507
  const hasNormalized = _react.useRef.call(void 0, false);
11065
11508
  _react.useEffect.call(void 0, () => {
11066
11509
  if (hasNormalized.current || fieldInfos.length === 0) return;
@@ -11079,7 +11522,7 @@ var UIQueryBuilder = () => {
11079
11522
  setHasBottomShadow(scrollTop + clientHeight < scrollHeight - 1);
11080
11523
  }, []);
11081
11524
  _react.useEffect.call(void 0, () => {
11082
- viewportRef.current = _optionalChain([scrollAreaRef, 'access', _117 => _117.current, 'optionalAccess', _118 => _118.querySelector, 'call', _119 => _119(
11525
+ viewportRef.current = _optionalChain([scrollAreaRef, 'access', _118 => _118.current, 'optionalAccess', _119 => _119.querySelector, 'call', _120 => _120(
11083
11526
  "[data-radix-scroll-area-viewport]"
11084
11527
  )]);
11085
11528
  recomputeShadows();
@@ -11089,7 +11532,7 @@ var UIQueryBuilder = () => {
11089
11532
  obs.observe(el);
11090
11533
  return () => obs.disconnect();
11091
11534
  }, [recomputeShadows]);
11092
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QueryBuilderUIProvider, { fieldInfos, setQueryState, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative h-full rounded-lg bg-zinc-50 dark:bg-zinc-50/40", children: [
11535
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QueryBuilderUIProvider, { fieldInfos, setQueryState, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative h-full min-h-0 rounded-lg bg-zinc-50 dark:bg-zinc-50/40", children: [
11093
11536
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11094
11537
  "div",
11095
11538
  {
@@ -11204,7 +11647,7 @@ var QueryBuilderContent = () => {
11204
11647
  setQueryBuilderMode(newMode);
11205
11648
  };
11206
11649
  const errorMessage = _nullishCoalesce(switchError, () => ( (query.error ? formatUpstashErrorMessage(query.error) : void 0)));
11207
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative h-full", children: [
11650
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative flex h-full min-h-0 flex-col", children: [
11208
11651
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute right-4 top-4 z-[2]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11209
11652
  Segmented,
11210
11653
  {
@@ -11242,7 +11685,7 @@ var DatabrowserInstance = ({
11242
11685
  tabType,
11243
11686
  allowSearch
11244
11687
  }) => {
11245
- const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
11688
+ const { isValuesSearchSelected, queryBuilderMode, setIsValuesSearchSelected } = useTab();
11246
11689
  const { data: indexes, isLoading } = useFetchSearchIndexes({
11247
11690
  enabled: tabType === "search"
11248
11691
  });
@@ -11271,9 +11714,18 @@ var DatabrowserInstance = ({
11271
11714
  {
11272
11715
  autoSaveId: "search-layout",
11273
11716
  direction: "vertical",
11274
- className: "h-full w-full text-sm antialiased",
11717
+ className: "h-full w-full !overflow-visible text-sm antialiased",
11275
11718
  children: [
11276
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { defaultSize: 30, minSize: 15, maxSize: 60, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SearchContent, {}) }),
11719
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11720
+ _reactresizablepanels.Panel,
11721
+ {
11722
+ defaultSize: 30,
11723
+ minSize: 15,
11724
+ maxSize: 60,
11725
+ className: queryBuilderMode === "code" ? "!overflow-visible" : "",
11726
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SearchContent, {})
11727
+ }
11728
+ ),
11277
11729
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ResizeHandle, { direction: "vertical" }),
11278
11730
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { minSize: 30, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactresizablepanels.PanelGroup, { autoSaveId: "persistence", direction: "horizontal", className: "h-full w-full", children: [
11279
11731
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Sidebar, {}) }),
@@ -11419,7 +11871,7 @@ var useOverflow = () => {
11419
11871
  }
11420
11872
  if (!node) return;
11421
11873
  observerRef.current = new ResizeObserver((entries) => {
11422
- const el = _optionalChain([entries, 'access', _120 => _120.at, 'call', _121 => _121(0), 'optionalAccess', _122 => _122.target]);
11874
+ const el = _optionalChain([entries, 'access', _121 => _121.at, 'call', _122 => _122(0), 'optionalAccess', _123 => _123.target]);
11423
11875
  if (!el) return;
11424
11876
  setIsOverflow(el.scrollWidth > el.clientWidth);
11425
11877
  });
@@ -11427,7 +11879,7 @@ var useOverflow = () => {
11427
11879
  }, []);
11428
11880
  _react.useEffect.call(void 0, () => {
11429
11881
  return () => {
11430
- _optionalChain([observerRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.disconnect, 'call', _125 => _125()]);
11882
+ _optionalChain([observerRef, 'access', _124 => _124.current, 'optionalAccess', _125 => _125.disconnect, 'call', _126 => _126()]);
11431
11883
  };
11432
11884
  }, []);
11433
11885
  return { ref, isOverflow };
@@ -11545,8 +11997,8 @@ var SortableTab = ({ id }) => {
11545
11997
  const [originalWidth, setOriginalWidth] = _react.useState.call(void 0, null);
11546
11998
  const textRef = _react.useRef.call(void 0, null);
11547
11999
  const { tabs } = useDatabrowserStore();
11548
- const tabData = _optionalChain([tabs, 'access', _126 => _126.find, 'call', _127 => _127(([tabId]) => tabId === id), 'optionalAccess', _128 => _128[1]]);
11549
- const isPinned = _optionalChain([tabData, 'optionalAccess', _129 => _129.pinned]);
12000
+ const tabData = _optionalChain([tabs, 'access', _127 => _127.find, 'call', _128 => _128(([tabId]) => tabId === id), 'optionalAccess', _129 => _129[1]]);
12001
+ const isPinned = _optionalChain([tabData, 'optionalAccess', _130 => _130.pinned]);
11550
12002
  const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = _sortable.useSortable.call(void 0, {
11551
12003
  id,
11552
12004
  disabled: isPinned,
@@ -11762,7 +12214,7 @@ function AddTabButton() {
11762
12214
  const tabsId = addTab();
11763
12215
  selectTab(tabsId);
11764
12216
  setTimeout(() => {
11765
- const tab = _optionalChain([rootRef, 'optionalAccess', _130 => _130.current, 'optionalAccess', _131 => _131.querySelector, 'call', _132 => _132(`#tab-${tabsId}`)]);
12217
+ const tab = _optionalChain([rootRef, 'optionalAccess', _131 => _131.current, 'optionalAccess', _132 => _132.querySelector, 'call', _133 => _133(`#tab-${tabsId}`)]);
11766
12218
  if (!tab) return;
11767
12219
  tab.scrollIntoView({ behavior: "smooth" });
11768
12220
  }, 20);
@@ -11796,7 +12248,7 @@ function TabsListButton({
11796
12248
  onSelectTab(id);
11797
12249
  setOpen(false);
11798
12250
  setTimeout(() => {
11799
- const tab = _optionalChain([rootRef, 'optionalAccess', _133 => _133.current, 'optionalAccess', _134 => _134.querySelector, 'call', _135 => _135(`#tab-${id}`)]);
12251
+ const tab = _optionalChain([rootRef, 'optionalAccess', _134 => _134.current, 'optionalAccess', _135 => _135.querySelector, 'call', _136 => _136(`#tab-${id}`)]);
11800
12252
  if (!tab) return;
11801
12253
  tab.scrollIntoView({ behavior: "smooth" });
11802
12254
  }, 20);