@upstash/react-redis-browser 0.2.15 → 0.2.17

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.css CHANGED
@@ -1223,6 +1223,9 @@
1223
1223
  .ups-db .max-w-32 {
1224
1224
  max-width: 8rem;
1225
1225
  }
1226
+ .ups-db .max-w-\[240px\] {
1227
+ max-width: 240px;
1228
+ }
1226
1229
  .ups-db .max-w-\[370px\] {
1227
1230
  max-width: 370px;
1228
1231
  }
@@ -1469,6 +1472,9 @@
1469
1472
  .ups-db .break-words {
1470
1473
  overflow-wrap: break-word;
1471
1474
  }
1475
+ .ups-db .break-all {
1476
+ word-break: break-all;
1477
+ }
1472
1478
  .ups-db .rounded {
1473
1479
  border-radius: 0.25rem;
1474
1480
  }
package/dist/index.js CHANGED
@@ -2662,7 +2662,7 @@ function formatTime(seconds) {
2662
2662
  if (parts.length === 0) {
2663
2663
  parts.push("0s");
2664
2664
  }
2665
- return parts.slice(0, 1).join(" ");
2665
+ return parts.slice(0, 2).join(" ");
2666
2666
  }
2667
2667
  var isTest = typeof window !== "undefined" && window.__PLAYWRIGHT__ === true;
2668
2668
  var jsonToJsLiteral = (json) => {
@@ -4183,8 +4183,11 @@ function parseFieldBuilder(str, fieldName) {
4183
4183
  const typeMatch = str.match(/s\.number\(\s*["']?(U64|I64|F64)?["']?\s*\)/);
4184
4184
  const numType = _optionalChain([typeMatch, 'optionalAccess', _35 => _35[1]]) || "F64";
4185
4185
  const fromValue = extractFromValue(str);
4186
- if (fromValue === void 0) return numType;
4187
- return { type: numType, from: fromValue };
4186
+ return {
4187
+ type: numType,
4188
+ fast: true,
4189
+ ...fromValue !== void 0 && { from: fromValue }
4190
+ };
4188
4191
  }
4189
4192
  if (str.startsWith("s.boolean()")) {
4190
4193
  const fast = str.includes(".fast()");
@@ -4207,10 +4210,14 @@ function parseFieldBuilder(str, fieldName) {
4207
4210
  };
4208
4211
  }
4209
4212
  if (str.startsWith("s.keyword()")) {
4210
- return "KEYWORD";
4213
+ const fromValue = extractFromValue(str);
4214
+ if (fromValue === void 0) return "KEYWORD";
4215
+ return { type: "KEYWORD", from: fromValue };
4211
4216
  }
4212
4217
  if (str.startsWith("s.facet()")) {
4213
- return "FACET";
4218
+ const fromValue = extractFromValue(str);
4219
+ if (fromValue === void 0) return "FACET";
4220
+ return { type: "FACET", from: fromValue };
4214
4221
  }
4215
4222
  if (str.startsWith("s.")) {
4216
4223
  const typeMatch = str.match(/^s\.(\w+)\(/);
@@ -5392,7 +5399,7 @@ function DeleteKeyModal({
5392
5399
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogContent, { children: [
5393
5400
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogHeader, { children: [
5394
5401
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogTitle, { children: isPlural ? `Delete ${count2} ${itemsLabel}` : `Delete ${itemLabel}` }),
5395
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogDescription, { className: "mt-5", children: [
5402
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogDescription, { className: "mt-5 break-all", children: [
5396
5403
  "Are you sure you want to delete",
5397
5404
  " ",
5398
5405
  name ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
@@ -5437,6 +5444,7 @@ function DeleteKeyModal({
5437
5444
  setIsPending(true);
5438
5445
  try {
5439
5446
  await onDeleteConfirm(e, { reindex });
5447
+ _optionalChain([setIsOpen, 'optionalCall', _44 => _44(false)]);
5440
5448
  } finally {
5441
5449
  setIsPending(false);
5442
5450
  }
@@ -5538,7 +5546,7 @@ function KeyActions({
5538
5546
  name: dataKey,
5539
5547
  showReindex: isValuesSearchSelected && type !== "search",
5540
5548
  onDeleteConfirm: async (_e, options) => {
5541
- await deleteKey({ keys: [dataKey], reindex: _optionalChain([options, 'optionalAccess', _44 => _44.reindex]) });
5549
+ await deleteKey({ keys: [dataKey], reindex: _optionalChain([options, 'optionalAccess', _45 => _45.reindex]) });
5542
5550
  },
5543
5551
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5544
5552
  DropdownMenuItem,
@@ -5570,7 +5578,7 @@ var DisplayHeader = ({
5570
5578
  };
5571
5579
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg", children: [
5572
5580
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-[26px] items-center justify-between gap-4", children: [
5573
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium text-zinc-950", children: dataKey }) }),
5581
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "min-w-0 grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium text-zinc-950", children: dataKey }) }),
5574
5582
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1", children: [
5575
5583
  type !== "string" && type !== "json" && type !== "search" && !showItemActions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
5576
5584
  showItemActions ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ItemActions, { dataKey, type }) : selectedListItem ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyActions, { dataKey, content, type })
@@ -5771,13 +5779,13 @@ var MonacoEditorWithTypes = ({
5771
5779
  const theme = useTheme();
5772
5780
  _react.useEffect.call(void 0, () => {
5773
5781
  if (!monaco) return;
5774
- _optionalChain([extraLibRef, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.dispose, 'call', _47 => _47()]);
5782
+ _optionalChain([extraLibRef, 'access', _46 => _46.current, 'optionalAccess', _47 => _47.dispose, 'call', _48 => _48()]);
5775
5783
  extraLibRef.current = monaco.languages.typescript.typescriptDefaults.addExtraLib(
5776
5784
  typeDefinitions,
5777
5785
  `file:///${filePath.replace(".ts", "-types.d.ts")}`
5778
5786
  );
5779
5787
  requestAnimationFrame(() => {
5780
- const model = _optionalChain([editorRef, 'access', _48 => _48.current, 'optionalAccess', _49 => _49.getModel, 'optionalCall', _50 => _50()]);
5788
+ const model = _optionalChain([editorRef, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.getModel, 'optionalCall', _51 => _51()]);
5781
5789
  if (model) {
5782
5790
  const currentValue = model.getValue();
5783
5791
  model.setValue(currentValue);
@@ -5786,10 +5794,10 @@ var MonacoEditorWithTypes = ({
5786
5794
  }, [monaco, typeDefinitions, filePath]);
5787
5795
  _react.useEffect.call(void 0, () => {
5788
5796
  return () => {
5789
- _optionalChain([extraLibRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.dispose, 'call', _53 => _53()]);
5797
+ _optionalChain([extraLibRef, 'access', _52 => _52.current, 'optionalAccess', _53 => _53.dispose, 'call', _54 => _54()]);
5790
5798
  if (monaco) {
5791
5799
  const model = monaco.editor.getModel(monaco.Uri.parse(filePath));
5792
- _optionalChain([model, 'optionalAccess', _54 => _54.dispose, 'call', _55 => _55()]);
5800
+ _optionalChain([model, 'optionalAccess', _55 => _55.dispose, 'call', _56 => _56()]);
5793
5801
  }
5794
5802
  };
5795
5803
  }, [monaco, filePath]);
@@ -5799,7 +5807,7 @@ var MonacoEditorWithTypes = ({
5799
5807
  } else if (newValue.trim() === "") {
5800
5808
  onChange(defaultValue);
5801
5809
  } else {
5802
- _optionalChain([editorRef, 'access', _56 => _56.current, 'optionalAccess', _57 => _57.setValue, 'optionalCall', _58 => _58(valueRef.current)]);
5810
+ _optionalChain([editorRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.setValue, 'optionalCall', _59 => _59(valueRef.current)]);
5803
5811
  }
5804
5812
  };
5805
5813
  _react.useEffect.call(void 0, () => {
@@ -6039,11 +6047,31 @@ declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
6039
6047
  from: TFrom["from"];
6040
6048
  } : { type: "DATE" };
6041
6049
  }
6042
- declare class KeywordFieldBuilder {
6043
- [BUILD](): { type: "KEYWORD" };
6050
+ declare class KeywordFieldBuilder<TFrom extends Record<"from", string | null> = {
6051
+ from: null;
6052
+ }> {
6053
+ private _from;
6054
+ constructor(from?: TFrom);
6055
+ from(field: string): KeywordFieldBuilder<{
6056
+ from: string;
6057
+ }>;
6058
+ [BUILD](): TFrom["from"] extends string ? {
6059
+ type: "KEYWORD";
6060
+ from: TFrom["from"];
6061
+ } : { type: "KEYWORD" };
6044
6062
  }
6045
- declare class FacetFieldBuilder {
6046
- [BUILD](): { type: "FACET" };
6063
+ declare class FacetFieldBuilder<TFrom extends Record<"from", string | null> = {
6064
+ from: null;
6065
+ }> {
6066
+ private _from;
6067
+ constructor(from?: TFrom);
6068
+ from(field: string): FacetFieldBuilder<{
6069
+ from: string;
6070
+ }>;
6071
+ [BUILD](): TFrom["from"] extends string ? {
6072
+ type: "FACET";
6073
+ from: TFrom["from"];
6074
+ } : { type: "FACET" };
6047
6075
  }
6048
6076
  type FieldBuilder = TextFieldBuilder<{
6049
6077
  noTokenize: boolean;
@@ -6061,7 +6089,11 @@ type FieldBuilder = TextFieldBuilder<{
6061
6089
  fast: boolean;
6062
6090
  }, {
6063
6091
  from: string | null;
6064
- }> | KeywordFieldBuilder | FacetFieldBuilder;
6092
+ }> | KeywordFieldBuilder<{
6093
+ from: string | null;
6094
+ }> | FacetFieldBuilder<{
6095
+ from: string | null;
6096
+ }>;
6065
6097
  declare const s: {
6066
6098
  string(): TextFieldBuilder;
6067
6099
  number<T extends NumericField["type"] = "F64">(type?: T): NumericFieldBuilder<T>;
@@ -6266,7 +6298,7 @@ var SearchDisplay = ({
6266
6298
  indexName: _nullishCoalesce(indexName, () => ( "")),
6267
6299
  editorValue: data.schema ? schemaToEditorValue(data.schema) : SCHEMA_DEFAULT,
6268
6300
  dataType: data.dataType || "string",
6269
- prefixes: _optionalChain([data, 'access', _59 => _59.prefixes, 'optionalAccess', _60 => _60.join, 'call', _61 => _61(", ")]) || "",
6301
+ prefixes: _optionalChain([data, 'access', _60 => _60.prefixes, 'optionalAccess', _61 => _61.join, 'call', _62 => _62(", ")]) || "",
6270
6302
  language: data.language || "english"
6271
6303
  });
6272
6304
  }, [data, reset, indexName]);
@@ -6382,7 +6414,7 @@ var SearchDisplay = ({
6382
6414
  DocsLink,
6383
6415
  {
6384
6416
  className: "absolute bottom-2 right-2 text-sm",
6385
- href: "https://upstash-search.mintlify.app/redis/search/schema-definition"
6417
+ href: "https://upstash.com/docs/redis/search/schema-definition"
6386
6418
  }
6387
6419
  )
6388
6420
  ] }),
@@ -6639,7 +6671,7 @@ var ItemContextMenu = ({
6639
6671
  editItem({
6640
6672
  type,
6641
6673
  dataKey,
6642
- itemKey: _optionalChain([data, 'optionalAccess', _62 => _62.key]),
6674
+ itemKey: _optionalChain([data, 'optionalAccess', _63 => _63.key]),
6643
6675
  // For deletion
6644
6676
  newKey: void 0
6645
6677
  });
@@ -6674,7 +6706,7 @@ var ItemContextMenu = ({
6674
6706
  {
6675
6707
  onClick: () => {
6676
6708
  if (!data) return;
6677
- navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _63 => _63.key]));
6709
+ navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _64 => _64.key]));
6678
6710
  toast({
6679
6711
  description: "Key copied to clipboard"
6680
6712
  });
@@ -6686,11 +6718,11 @@ var ItemContextMenu = ({
6686
6718
  ]
6687
6719
  }
6688
6720
  ),
6689
- _optionalChain([data, 'optionalAccess', _64 => _64.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
6721
+ _optionalChain([data, 'optionalAccess', _65 => _65.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
6690
6722
  ContextMenuItem,
6691
6723
  {
6692
6724
  onClick: () => {
6693
- navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _65 => _65.value]), () => ( "")));
6725
+ navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _66 => _66.value]), () => ( "")));
6694
6726
  toast({
6695
6727
  description: "Value copied to clipboard"
6696
6728
  });
@@ -6802,7 +6834,7 @@ var useSetHashTTL = () => {
6802
6834
  var HashFieldTTLBadge = ({ dataKey, field }) => {
6803
6835
  const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
6804
6836
  const { mutate: setTTL, isPending } = useSetHashTTL();
6805
- const expireAt = _optionalChain([data, 'optionalAccess', _66 => _66[field]]);
6837
+ const expireAt = _optionalChain([data, 'optionalAccess', _67 => _67[field]]);
6806
6838
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6807
6839
  TTLBadge,
6808
6840
  {
@@ -6899,7 +6931,7 @@ var MonacoEditor = ({
6899
6931
  if (!active || !monaco || !editorRef.current) {
6900
6932
  return;
6901
6933
  }
6902
- _optionalChain([monaco, 'optionalAccess', _67 => _67.editor, 'access', _68 => _68.setModelLanguage, 'call', _69 => _69(editorRef.current.getModel(), language)]);
6934
+ _optionalChain([monaco, 'optionalAccess', _68 => _68.editor, 'access', _69 => _69.setModelLanguage, 'call', _70 => _70(editorRef.current.getModel(), language)]);
6903
6935
  }, [monaco, language, active]);
6904
6936
  const editor = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6905
6937
  _react2.Editor,
@@ -7075,7 +7107,7 @@ var ListEditForm = ({
7075
7107
  dataKey
7076
7108
  });
7077
7109
  const findValue = () => {
7078
- for (const page of _nullishCoalesce(_optionalChain([query, 'access', _70 => _70.data, 'optionalAccess', _71 => _71.pages]), () => ( []))) {
7110
+ for (const page of _nullishCoalesce(_optionalChain([query, 'access', _71 => _71.data, 'optionalAccess', _72 => _72.pages]), () => ( []))) {
7079
7111
  const item = page.keys.find((item2) => item2.key === itemKey);
7080
7112
  if (item && "value" in item) return item.value;
7081
7113
  }
@@ -7229,7 +7261,7 @@ var HashFieldTTLInfo = ({
7229
7261
  fields
7230
7262
  }) => {
7231
7263
  const { data } = useFetchHashFieldExpires({ dataKey, fields });
7232
- const expireAt = _optionalChain([data, 'optionalAccess', _72 => _72[field]]);
7264
+ const expireAt = _optionalChain([data, 'optionalAccess', _73 => _73[field]]);
7233
7265
  const [ttl, setTTL] = _react.useState.call(void 0, () => calculateTTL(expireAt));
7234
7266
  _react.useEffect.call(void 0, () => {
7235
7267
  setTTL(calculateTTL(expireAt));
@@ -7254,7 +7286,7 @@ var headerLabels = {
7254
7286
  var ListDisplay = ({ dataKey, type }) => {
7255
7287
  const { selectedListItem } = useTab();
7256
7288
  const query = useFetchListItems({ dataKey, type });
7257
- const isEmpty = query.isFetched && _optionalChain([query, 'access', _73 => _73.data, 'optionalAccess', _74 => _74.pages, 'access', _75 => _75.every, 'call', _76 => _76((page) => page.keys.length === 0)]);
7289
+ const isEmpty = query.isFetched && _optionalChain([query, 'access', _74 => _74.data, 'optionalAccess', _75 => _75.pages, 'access', _76 => _76.every, 'call', _77 => _77((page) => page.keys.length === 0)]);
7258
7290
  if (isEmpty) {
7259
7291
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyDeleted, {});
7260
7292
  }
@@ -7270,7 +7302,7 @@ var ListItems = ({
7270
7302
  dataKey
7271
7303
  }) => {
7272
7304
  const { setSelectedListItem } = useTab();
7273
- const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _77 => _77.data, 'optionalAccess', _78 => _78.pages, 'access', _79 => _79.flatMap, 'call', _80 => _80((page) => page.keys)]), () => ( [])), [query.data]);
7305
+ const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _78 => _78.data, 'optionalAccess', _79 => _79.pages, 'access', _80 => _80.flatMap, 'call', _81 => _81((page) => page.keys)]), () => ( [])), [query.data]);
7274
7306
  const fields = _react.useMemo.call(void 0, () => keys.map((key) => key.key), [keys]);
7275
7307
  const { mutate: editItem } = useEditListItem();
7276
7308
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
@@ -7443,7 +7475,7 @@ function AddKeyModal() {
7443
7475
  setSelectedKey(key);
7444
7476
  setOpen(false);
7445
7477
  setTimeout(() => {
7446
- _optionalChain([window, 'access', _81 => _81.document, 'access', _82 => _82.querySelector, 'call', _83 => _83(`[data-key="${key}"]`), 'optionalAccess', _84 => _84.scrollIntoView, 'call', _85 => _85({
7478
+ _optionalChain([window, 'access', _82 => _82.document, 'access', _83 => _83.querySelector, 'call', _84 => _84(`[data-key="${key}"]`), 'optionalAccess', _85 => _85.scrollIntoView, 'call', _86 => _86({
7447
7479
  behavior: "smooth",
7448
7480
  block: "start",
7449
7481
  inline: "nearest"
@@ -7499,7 +7531,7 @@ function AddKeyModal() {
7499
7531
  }
7500
7532
  )
7501
7533
  ] }),
7502
- formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _86 => _86.errors, 'access', _87 => _87.key, 'optionalAccess', _88 => _88.message]) }),
7534
+ formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _87 => _87.errors, 'access', _88 => _88.key, 'optionalAccess', _89 => _89.message]) }),
7503
7535
  /* @__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" }),
7504
7536
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
7505
7537
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -7647,10 +7679,12 @@ export type DateField = {
7647
7679
 
7648
7680
  export type KeywordField = {
7649
7681
  type: "KEYWORD";
7682
+ from?: string;
7650
7683
  };
7651
7684
 
7652
7685
  export type FacetField = {
7653
7686
  type: "FACET";
7687
+ from?: string;
7654
7688
  };
7655
7689
 
7656
7690
  export type DetailedField =
@@ -8537,7 +8571,7 @@ var QueryWizardPopover = ({ onClose }) => {
8537
8571
  const fetchSampleKeys = _reactquery.useMutation.call(void 0, {
8538
8572
  mutationFn: async (index) => {
8539
8573
  const firstTenKeys = await scanKeys(redis, {
8540
- match: `${_optionalChain([index, 'access', _89 => _89.prefixes, 'optionalAccess', _90 => _90[0]])}*`,
8574
+ match: `${_optionalChain([index, 'access', _90 => _90.prefixes, 'optionalAccess', _91 => _91[0]])}*`,
8541
8575
  type: index.dataType,
8542
8576
  limit: 10
8543
8577
  });
@@ -8567,7 +8601,7 @@ var QueryWizardPopover = ({ onClose }) => {
8567
8601
  if (!input.trim() || !valuesSearch.index) return;
8568
8602
  try {
8569
8603
  let samples = sampleData;
8570
- if (samples.length === 0 && _optionalChain([indexData, 'optionalAccess', _91 => _91.prefixes, 'optionalAccess', _92 => _92[0]])) {
8604
+ if (samples.length === 0 && _optionalChain([indexData, 'optionalAccess', _92 => _92.prefixes, 'optionalAccess', _93 => _93[0]])) {
8571
8605
  samples = await fetchSampleKeys.mutateAsync(indexData);
8572
8606
  }
8573
8607
  const result = await generateQuery.mutateAsync({
@@ -8578,7 +8612,7 @@ var QueryWizardPopover = ({ onClose }) => {
8578
8612
  const queryString = toJsLiteral(result.query);
8579
8613
  setValuesSearchQuery(queryString);
8580
8614
  setQueryBuilderMode("code");
8581
- _optionalChain([onClose, 'optionalCall', _93 => _93()]);
8615
+ _optionalChain([onClose, 'optionalCall', _94 => _94()]);
8582
8616
  } catch (error) {
8583
8617
  console.error("Error generating query:", error);
8584
8618
  }
@@ -8638,7 +8672,7 @@ var QueryWizardPopover = ({ onClose }) => {
8638
8672
  ),
8639
8673
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
8640
8674
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs text-zinc-500", children: 'Example: Find people named "John", boost if older than 20.' }),
8641
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/overview" })
8675
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/overview" })
8642
8676
  ] })
8643
8677
  ] })
8644
8678
  ] }),
@@ -8683,7 +8717,7 @@ var CreateIndexModal = ({
8683
8717
  className: "max-w-2xl",
8684
8718
  onEscapeKeyDown: (e) => {
8685
8719
  const active = document.activeElement;
8686
- if (_optionalChain([active, 'optionalAccess', _94 => _94.closest, 'call', _95 => _95(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _96 => _96.tagName]) === "TEXTAREA") {
8720
+ if (_optionalChain([active, 'optionalAccess', _95 => _95.closest, 'call', _96 => _96(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _97 => _97.tagName]) === "TEXTAREA") {
8687
8721
  e.preventDefault();
8688
8722
  }
8689
8723
  },
@@ -8718,7 +8752,7 @@ var EditIndexModal = ({
8718
8752
  className: "min-h-[500px] max-w-2xl",
8719
8753
  onEscapeKeyDown: (e) => {
8720
8754
  const active = document.activeElement;
8721
- if (_optionalChain([active, 'optionalAccess', _97 => _97.closest, 'call', _98 => _98(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _99 => _99.tagName]) === "TEXTAREA") {
8755
+ if (_optionalChain([active, 'optionalAccess', _98 => _98.closest, 'call', _99 => _99(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _100 => _100.tagName]) === "TEXTAREA") {
8722
8756
  e.preventDefault();
8723
8757
  }
8724
8758
  },
@@ -8832,7 +8866,7 @@ var SearchInput = () => {
8832
8866
  } else if (e.key === "Escape") {
8833
8867
  setState("");
8834
8868
  setFocusedIndex(-1);
8835
- _optionalChain([inputRef, 'access', _100 => _100.current, 'optionalAccess', _101 => _101.blur, 'call', _102 => _102()]);
8869
+ _optionalChain([inputRef, 'access', _101 => _101.current, 'optionalAccess', _102 => _102.blur, 'call', _103 => _103()]);
8836
8870
  } else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
8837
8871
  e.preventDefault();
8838
8872
  if (focusedIndex < filteredHistory.length - 1) {
@@ -8846,7 +8880,7 @@ var SearchInput = () => {
8846
8880
  setFocusedIndex(focusedIndex - 1);
8847
8881
  } else if (filteredHistory.length > 0 && focusedIndex === 0) {
8848
8882
  setFocusedIndex(-1);
8849
- _optionalChain([inputRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.focus, 'call', _105 => _105()]);
8883
+ _optionalChain([inputRef, 'access', _104 => _104.current, 'optionalAccess', _105 => _105.focus, 'call', _106 => _106()]);
8850
8884
  } else if (filteredHistory.length > 0) {
8851
8885
  setFocusedIndex(filteredHistory.length - 1);
8852
8886
  }
@@ -9030,8 +9064,8 @@ var IndexSelector = () => {
9030
9064
  },
9031
9065
  modal: false,
9032
9066
  children: [
9033
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "flex min-w-[140px] items-center justify-between gap-2 rounded-r-lg border border-zinc-300 bg-emerald-50 px-3 py-[5px] text-sm font-medium text-emerald-800 transition-colors hover:bg-emerald-100", children: [
9034
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "truncate", children: index || "Select an index" }),
9067
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "flex min-w-[140px] max-w-[240px] items-center justify-between gap-2 rounded-r-lg border border-zinc-300 bg-emerald-50 px-3 py-[5px] text-sm font-medium text-emerald-800 transition-colors hover:bg-emerald-100", children: [
9068
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "min-w-0 truncate", children: index || "Select an index" }),
9035
9069
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconChevronDown, { className: "size-4 shrink-0 opacity-50" })
9036
9070
  ] }) }),
9037
9071
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverContent, { className: "p-2", align: "center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2", children: [
@@ -9051,8 +9085,8 @@ var IndexSelector = () => {
9051
9085
  ] }),
9052
9086
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "max-h-[200px] overflow-y-auto", children: [
9053
9087
  isLoading && !indexes && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconLoader2, { className: "size-4 animate-spin text-zinc-400" }) }),
9054
- !isLoading && _optionalChain([indexes, 'optionalAccess', _106 => _106.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
9055
- _optionalChain([indexes, 'optionalAccess', _107 => _107.map, 'call', _108 => _108((idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
9088
+ !isLoading && _optionalChain([indexes, 'optionalAccess', _107 => _107.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
9089
+ _optionalChain([indexes, 'optionalAccess', _108 => _108.map, 'call', _109 => _109((idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
9056
9090
  "div",
9057
9091
  {
9058
9092
  className: "flex h-9 items-center rounded-md px-2 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-200",
@@ -9064,13 +9098,13 @@ var IndexSelector = () => {
9064
9098
  setValuesSearchIndex(idx);
9065
9099
  setOpen(false);
9066
9100
  },
9067
- className: "flex flex-1 items-center gap-2 text-left text-sm",
9101
+ className: "flex min-w-0 flex-1 items-center gap-2 text-left text-sm",
9068
9102
  children: [
9069
9103
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9070
9104
  "span",
9071
9105
  {
9072
9106
  className: cn(
9073
- "flex size-5 items-center justify-center",
9107
+ "flex size-5 shrink-0 items-center justify-center",
9074
9108
  idx === index ? "text-emerald-600" : "text-transparent"
9075
9109
  ),
9076
9110
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconCircleCheck, { className: "size-5" })
@@ -9220,7 +9254,7 @@ var generateNestedInterface = (obj, indent = " ") => {
9220
9254
  var toAmbientTypes = (types) => types.replaceAll(/export const (\w+) = (\[.*?]) as const;/g, "declare const $1: readonly $2;").replaceAll("export ", "");
9221
9255
  var generateTypeDefinitions = (schema) => {
9222
9256
  let schemaFieldsInterface = "";
9223
- const schemaFields = _optionalChain([schema, 'optionalAccess', _109 => _109.schema]);
9257
+ const schemaFields = _optionalChain([schema, 'optionalAccess', _110 => _110.schema]);
9224
9258
  if (schemaFields && Object.keys(schemaFields).length > 0) {
9225
9259
  const nested = buildNestedSchema(schemaFields);
9226
9260
  const fieldLines = generateNestedInterface(nested);
@@ -9614,7 +9648,7 @@ var SearchEmptyState = () => {
9614
9648
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9615
9649
  "a",
9616
9650
  {
9617
- href: "https://upstash-search.mintlify.app/redis/search/introduction",
9651
+ href: "https://upstash.com/docs/redis/search/introduction",
9618
9652
  target: "_blank",
9619
9653
  rel: "noopener noreferrer",
9620
9654
  className: "mt-5 inline-block text-sm text-emerald-600 underline-offset-2 hover:underline",
@@ -9678,7 +9712,7 @@ var SidebarContextMenu = ({ children }) => {
9678
9712
  showReindex: isValuesSearchSelected,
9679
9713
  onDeleteConfirm: async (e, options) => {
9680
9714
  e.stopPropagation();
9681
- await deleteKey({ keys: contextKeys, reindex: _optionalChain([options, 'optionalAccess', _110 => _110.reindex]) });
9715
+ await deleteKey({ keys: contextKeys, reindex: _optionalChain([options, 'optionalAccess', _111 => _111.reindex]) });
9682
9716
  setAlertOpen(false);
9683
9717
  }
9684
9718
  }
@@ -10452,7 +10486,7 @@ var BoostBadge = ({
10452
10486
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `flex h-full cursor-default items-center px-2 ${labelBg} ${textColor}`, children: isNegative ? "Demote" : "Boost" }) }),
10453
10487
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, TooltipContent, { side: "bottom", className: "max-w-xs", children: [
10454
10488
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isNegative ? `Multiplies this condition's score by ${_nullishCoalesce(node.boost, () => ( 0))}, subtracting from the total.` : `Multiplies this condition's score by ${_nullishCoalesce(node.boost, () => ( 0))}.` }),
10455
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/boost" })
10489
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/boost" })
10456
10490
  ] })
10457
10491
  ] }),
10458
10492
  isStatic ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `px-2 ${textColor}`, children: node.boost }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex h-full items-center bg-white px-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -10574,7 +10608,7 @@ var QueryCondition = ({
10574
10608
  setLocalValue(formattedConditionValue);
10575
10609
  }
10576
10610
  const currentFieldInfo = fieldInfos.find((f) => f.name === condition.field);
10577
- const currentFieldType = _nullishCoalesce(_optionalChain([currentFieldInfo, 'optionalAccess', _111 => _111.type]), () => ( "unknown"));
10611
+ const currentFieldType = _nullishCoalesce(_optionalChain([currentFieldInfo, 'optionalAccess', _112 => _112.type]), () => ( "unknown"));
10578
10612
  const isUnknownField = condition.field && !fieldNames.includes(condition.field);
10579
10613
  const getValueTypeError = () => {
10580
10614
  if (isUnknownField || currentFieldType === "unknown" || currentFieldType === "string") {
@@ -10632,8 +10666,8 @@ var QueryCondition = ({
10632
10666
  }
10633
10667
  }, [currentFieldType, condition.value]);
10634
10668
  const handleFieldChange = (value) => {
10635
- const newFieldInfo = _optionalChain([fieldInfos, 'optionalAccess', _112 => _112.find, 'call', _113 => _113((f) => f.name === value)]);
10636
- const newFieldType = _nullishCoalesce(_optionalChain([newFieldInfo, 'optionalAccess', _114 => _114.type]), () => ( "unknown"));
10669
+ const newFieldInfo = _optionalChain([fieldInfos, 'optionalAccess', _113 => _113.find, 'call', _114 => _114((f) => f.name === value)]);
10670
+ const newFieldType = _nullishCoalesce(_optionalChain([newFieldInfo, 'optionalAccess', _115 => _115.type]), () => ( "unknown"));
10637
10671
  const validOperators = getOperatorsForFieldType(newFieldType);
10638
10672
  const isOperatorValid = validOperators.includes(condition.operator);
10639
10673
  let newValue = condition.value;
@@ -10774,10 +10808,10 @@ var QueryCondition = ({
10774
10808
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10775
10809
  "div",
10776
10810
  {
10777
- ref: _optionalChain([dragHandleProps, 'optionalAccess', _115 => _115.ref]),
10811
+ ref: _optionalChain([dragHandleProps, 'optionalAccess', _116 => _116.ref]),
10778
10812
  className: "flex cursor-grab items-center px-1 text-zinc-400 hover:text-zinc-600",
10779
- ..._optionalChain([dragHandleProps, 'optionalAccess', _116 => _116.attributes]),
10780
- ..._optionalChain([dragHandleProps, 'optionalAccess', _117 => _117.listeners]),
10813
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _117 => _117.attributes]),
10814
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _118 => _118.listeners]),
10781
10815
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconGripVertical, { size: 16 })
10782
10816
  }
10783
10817
  ),
@@ -11285,10 +11319,10 @@ var InnerGroup = ({
11285
11319
  !isRoot && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11286
11320
  "div",
11287
11321
  {
11288
- ref: _optionalChain([dragHandleProps, 'optionalAccess', _118 => _118.ref]),
11322
+ ref: _optionalChain([dragHandleProps, 'optionalAccess', _119 => _119.ref]),
11289
11323
  className: "flex cursor-grab items-center px-1 text-zinc-400",
11290
- ..._optionalChain([dragHandleProps, 'optionalAccess', _119 => _119.attributes]),
11291
- ..._optionalChain([dragHandleProps, 'optionalAccess', _120 => _120.listeners]),
11324
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _120 => _120.attributes]),
11325
+ ..._optionalChain([dragHandleProps, 'optionalAccess', _121 => _121.listeners]),
11292
11326
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconGripVertical, { size: 16 })
11293
11327
  }
11294
11328
  ),
@@ -11360,7 +11394,7 @@ var InnerGroup = ({
11360
11394
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "ml-2 mt-2 flex h-[26px] w-fit cursor-default select-none items-center rounded-md border border-zinc-300 bg-amber-50 px-2 text-sm font-medium capitalize text-amber-800", children: "Must Not" }) }),
11361
11395
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, TooltipContent, { side: "right", className: "max-w-xs", children: [
11362
11396
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Keys matching any of the conditions below are excluded from the results." }),
11363
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/must-not" })
11397
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/must-not" })
11364
11398
  ] })
11365
11399
  ] }),
11366
11400
  node.children.map(
@@ -11637,7 +11671,7 @@ var UIQueryBuilder = () => {
11637
11671
  const { valuesSearch } = useTab();
11638
11672
  const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
11639
11673
  const { queryState, setQueryState } = useQueryStateSync();
11640
- const fieldInfos = _optionalChain([indexDetails, 'optionalAccess', _121 => _121.schema]) ? extractFieldInfo(indexDetails.schema) : [];
11674
+ const fieldInfos = _optionalChain([indexDetails, 'optionalAccess', _122 => _122.schema]) ? extractFieldInfo(indexDetails.schema) : [];
11641
11675
  const hasNormalized = _react.useRef.call(void 0, false);
11642
11676
  _react.useEffect.call(void 0, () => {
11643
11677
  if (hasNormalized.current || fieldInfos.length === 0) return;
@@ -11656,7 +11690,7 @@ var UIQueryBuilder = () => {
11656
11690
  setHasBottomShadow(scrollTop + clientHeight < scrollHeight - 1);
11657
11691
  }, []);
11658
11692
  _react.useEffect.call(void 0, () => {
11659
- viewportRef.current = _optionalChain([scrollAreaRef, 'access', _122 => _122.current, 'optionalAccess', _123 => _123.querySelector, 'call', _124 => _124(
11693
+ viewportRef.current = _optionalChain([scrollAreaRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.querySelector, 'call', _125 => _125(
11660
11694
  "[data-radix-scroll-area-viewport]"
11661
11695
  )]);
11662
11696
  recomputeShadows();
@@ -11800,7 +11834,7 @@ var QueryBuilderContent = () => {
11800
11834
  DocsLink,
11801
11835
  {
11802
11836
  className: "absolute bottom-2 right-2 text-sm",
11803
- href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/overview"
11837
+ href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/overview"
11804
11838
  }
11805
11839
  )
11806
11840
  ] });
@@ -12005,7 +12039,7 @@ var useOverflow = () => {
12005
12039
  }
12006
12040
  if (!node) return;
12007
12041
  observerRef.current = new ResizeObserver((entries) => {
12008
- const el = _optionalChain([entries, 'access', _125 => _125.at, 'call', _126 => _126(0), 'optionalAccess', _127 => _127.target]);
12042
+ const el = _optionalChain([entries, 'access', _126 => _126.at, 'call', _127 => _127(0), 'optionalAccess', _128 => _128.target]);
12009
12043
  if (!el) return;
12010
12044
  setIsOverflow(el.scrollWidth > el.clientWidth);
12011
12045
  });
@@ -12013,7 +12047,7 @@ var useOverflow = () => {
12013
12047
  }, []);
12014
12048
  _react.useEffect.call(void 0, () => {
12015
12049
  return () => {
12016
- _optionalChain([observerRef, 'access', _128 => _128.current, 'optionalAccess', _129 => _129.disconnect, 'call', _130 => _130()]);
12050
+ _optionalChain([observerRef, 'access', _129 => _129.current, 'optionalAccess', _130 => _130.disconnect, 'call', _131 => _131()]);
12017
12051
  };
12018
12052
  }, []);
12019
12053
  return { ref, isOverflow };
@@ -12131,8 +12165,8 @@ var SortableTab = ({ id }) => {
12131
12165
  const [originalWidth, setOriginalWidth] = _react.useState.call(void 0, null);
12132
12166
  const textRef = _react.useRef.call(void 0, null);
12133
12167
  const { tabs } = useDatabrowserStore();
12134
- const tabData = _optionalChain([tabs, 'access', _131 => _131.find, 'call', _132 => _132(([tabId]) => tabId === id), 'optionalAccess', _133 => _133[1]]);
12135
- const isPinned = _optionalChain([tabData, 'optionalAccess', _134 => _134.pinned]);
12168
+ const tabData = _optionalChain([tabs, 'access', _132 => _132.find, 'call', _133 => _133(([tabId]) => tabId === id), 'optionalAccess', _134 => _134[1]]);
12169
+ const isPinned = _optionalChain([tabData, 'optionalAccess', _135 => _135.pinned]);
12136
12170
  const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = _sortable.useSortable.call(void 0, {
12137
12171
  id,
12138
12172
  disabled: isPinned,
@@ -12348,7 +12382,7 @@ function AddTabButton() {
12348
12382
  const tabsId = addTab();
12349
12383
  selectTab(tabsId);
12350
12384
  setTimeout(() => {
12351
- const tab = _optionalChain([rootRef, 'optionalAccess', _135 => _135.current, 'optionalAccess', _136 => _136.querySelector, 'call', _137 => _137(`#tab-${tabsId}`)]);
12385
+ const tab = _optionalChain([rootRef, 'optionalAccess', _136 => _136.current, 'optionalAccess', _137 => _137.querySelector, 'call', _138 => _138(`#tab-${tabsId}`)]);
12352
12386
  if (!tab) return;
12353
12387
  tab.scrollIntoView({ behavior: "smooth" });
12354
12388
  }, 20);
@@ -12382,7 +12416,7 @@ function TabsListButton({
12382
12416
  onSelectTab(id);
12383
12417
  setOpen(false);
12384
12418
  setTimeout(() => {
12385
- const tab = _optionalChain([rootRef, 'optionalAccess', _138 => _138.current, 'optionalAccess', _139 => _139.querySelector, 'call', _140 => _140(`#tab-${id}`)]);
12419
+ const tab = _optionalChain([rootRef, 'optionalAccess', _139 => _139.current, 'optionalAccess', _140 => _140.querySelector, 'call', _141 => _141(`#tab-${id}`)]);
12386
12420
  if (!tab) return;
12387
12421
  tab.scrollIntoView({ behavior: "smooth" });
12388
12422
  }, 20);
package/dist/index.mjs CHANGED
@@ -2662,7 +2662,7 @@ function formatTime(seconds) {
2662
2662
  if (parts.length === 0) {
2663
2663
  parts.push("0s");
2664
2664
  }
2665
- return parts.slice(0, 1).join(" ");
2665
+ return parts.slice(0, 2).join(" ");
2666
2666
  }
2667
2667
  var isTest = typeof window !== "undefined" && window.__PLAYWRIGHT__ === true;
2668
2668
  var jsonToJsLiteral = (json) => {
@@ -4183,8 +4183,11 @@ function parseFieldBuilder(str, fieldName) {
4183
4183
  const typeMatch = str.match(/s\.number\(\s*["']?(U64|I64|F64)?["']?\s*\)/);
4184
4184
  const numType = typeMatch?.[1] || "F64";
4185
4185
  const fromValue = extractFromValue(str);
4186
- if (fromValue === void 0) return numType;
4187
- return { type: numType, from: fromValue };
4186
+ return {
4187
+ type: numType,
4188
+ fast: true,
4189
+ ...fromValue !== void 0 && { from: fromValue }
4190
+ };
4188
4191
  }
4189
4192
  if (str.startsWith("s.boolean()")) {
4190
4193
  const fast = str.includes(".fast()");
@@ -4207,10 +4210,14 @@ function parseFieldBuilder(str, fieldName) {
4207
4210
  };
4208
4211
  }
4209
4212
  if (str.startsWith("s.keyword()")) {
4210
- return "KEYWORD";
4213
+ const fromValue = extractFromValue(str);
4214
+ if (fromValue === void 0) return "KEYWORD";
4215
+ return { type: "KEYWORD", from: fromValue };
4211
4216
  }
4212
4217
  if (str.startsWith("s.facet()")) {
4213
- return "FACET";
4218
+ const fromValue = extractFromValue(str);
4219
+ if (fromValue === void 0) return "FACET";
4220
+ return { type: "FACET", from: fromValue };
4214
4221
  }
4215
4222
  if (str.startsWith("s.")) {
4216
4223
  const typeMatch = str.match(/^s\.(\w+)\(/);
@@ -5392,7 +5399,7 @@ function DeleteKeyModal({
5392
5399
  /* @__PURE__ */ jsxs12(DialogContent, { children: [
5393
5400
  /* @__PURE__ */ jsxs12(DialogHeader, { children: [
5394
5401
  /* @__PURE__ */ jsx26(DialogTitle, { children: isPlural ? `Delete ${count2} ${itemsLabel}` : `Delete ${itemLabel}` }),
5395
- /* @__PURE__ */ jsxs12(DialogDescription, { className: "mt-5", children: [
5402
+ /* @__PURE__ */ jsxs12(DialogDescription, { className: "mt-5 break-all", children: [
5396
5403
  "Are you sure you want to delete",
5397
5404
  " ",
5398
5405
  name ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
@@ -5437,6 +5444,7 @@ function DeleteKeyModal({
5437
5444
  setIsPending(true);
5438
5445
  try {
5439
5446
  await onDeleteConfirm(e, { reindex });
5447
+ setIsOpen?.(false);
5440
5448
  } finally {
5441
5449
  setIsPending(false);
5442
5450
  }
@@ -5570,7 +5578,7 @@ var DisplayHeader = ({
5570
5578
  };
5571
5579
  return /* @__PURE__ */ jsxs15("div", { className: "rounded-lg", children: [
5572
5580
  /* @__PURE__ */ jsxs15("div", { className: "flex h-[26px] items-center justify-between gap-4", children: [
5573
- /* @__PURE__ */ jsx29("h2", { className: "grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ jsx29("span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ jsx29("span", { className: "font-medium text-zinc-950", children: dataKey }) }),
5581
+ /* @__PURE__ */ jsx29("h2", { className: "min-w-0 grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ jsx29("span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ jsx29("span", { className: "font-medium text-zinc-950", children: dataKey }) }),
5574
5582
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
5575
5583
  type !== "string" && type !== "json" && type !== "search" && !showItemActions && /* @__PURE__ */ jsx29(SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ jsx29(Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ jsx29(IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
5576
5584
  showItemActions ? /* @__PURE__ */ jsx29(ItemActions, { dataKey, type }) : selectedListItem ? void 0 : /* @__PURE__ */ jsx29(KeyActions, { dataKey, content, type })
@@ -6039,11 +6047,31 @@ declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
6039
6047
  from: TFrom["from"];
6040
6048
  } : { type: "DATE" };
6041
6049
  }
6042
- declare class KeywordFieldBuilder {
6043
- [BUILD](): { type: "KEYWORD" };
6050
+ declare class KeywordFieldBuilder<TFrom extends Record<"from", string | null> = {
6051
+ from: null;
6052
+ }> {
6053
+ private _from;
6054
+ constructor(from?: TFrom);
6055
+ from(field: string): KeywordFieldBuilder<{
6056
+ from: string;
6057
+ }>;
6058
+ [BUILD](): TFrom["from"] extends string ? {
6059
+ type: "KEYWORD";
6060
+ from: TFrom["from"];
6061
+ } : { type: "KEYWORD" };
6044
6062
  }
6045
- declare class FacetFieldBuilder {
6046
- [BUILD](): { type: "FACET" };
6063
+ declare class FacetFieldBuilder<TFrom extends Record<"from", string | null> = {
6064
+ from: null;
6065
+ }> {
6066
+ private _from;
6067
+ constructor(from?: TFrom);
6068
+ from(field: string): FacetFieldBuilder<{
6069
+ from: string;
6070
+ }>;
6071
+ [BUILD](): TFrom["from"] extends string ? {
6072
+ type: "FACET";
6073
+ from: TFrom["from"];
6074
+ } : { type: "FACET" };
6047
6075
  }
6048
6076
  type FieldBuilder = TextFieldBuilder<{
6049
6077
  noTokenize: boolean;
@@ -6061,7 +6089,11 @@ type FieldBuilder = TextFieldBuilder<{
6061
6089
  fast: boolean;
6062
6090
  }, {
6063
6091
  from: string | null;
6064
- }> | KeywordFieldBuilder | FacetFieldBuilder;
6092
+ }> | KeywordFieldBuilder<{
6093
+ from: string | null;
6094
+ }> | FacetFieldBuilder<{
6095
+ from: string | null;
6096
+ }>;
6065
6097
  declare const s: {
6066
6098
  string(): TextFieldBuilder;
6067
6099
  number<T extends NumericField["type"] = "F64">(type?: T): NumericFieldBuilder<T>;
@@ -6382,7 +6414,7 @@ var SearchDisplay = ({
6382
6414
  DocsLink,
6383
6415
  {
6384
6416
  className: "absolute bottom-2 right-2 text-sm",
6385
- href: "https://upstash-search.mintlify.app/redis/search/schema-definition"
6417
+ href: "https://upstash.com/docs/redis/search/schema-definition"
6386
6418
  }
6387
6419
  )
6388
6420
  ] }),
@@ -7647,10 +7679,12 @@ export type DateField = {
7647
7679
 
7648
7680
  export type KeywordField = {
7649
7681
  type: "KEYWORD";
7682
+ from?: string;
7650
7683
  };
7651
7684
 
7652
7685
  export type FacetField = {
7653
7686
  type: "FACET";
7687
+ from?: string;
7654
7688
  };
7655
7689
 
7656
7690
  export type DetailedField =
@@ -8638,7 +8672,7 @@ var QueryWizardPopover = ({ onClose }) => {
8638
8672
  ),
8639
8673
  /* @__PURE__ */ jsxs30("div", { children: [
8640
8674
  /* @__PURE__ */ jsx52("span", { className: "text-xs text-zinc-500", children: 'Example: Find people named "John", boost if older than 20.' }),
8641
- /* @__PURE__ */ jsx52(DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/overview" })
8675
+ /* @__PURE__ */ jsx52(DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/overview" })
8642
8676
  ] })
8643
8677
  ] })
8644
8678
  ] }),
@@ -9030,8 +9064,8 @@ var IndexSelector = () => {
9030
9064
  },
9031
9065
  modal: false,
9032
9066
  children: [
9033
- /* @__PURE__ */ jsx59(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs35("button", { className: "flex min-w-[140px] items-center justify-between gap-2 rounded-r-lg border border-zinc-300 bg-emerald-50 px-3 py-[5px] text-sm font-medium text-emerald-800 transition-colors hover:bg-emerald-100", children: [
9034
- /* @__PURE__ */ jsx59("span", { className: "truncate", children: index || "Select an index" }),
9067
+ /* @__PURE__ */ jsx59(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs35("button", { className: "flex min-w-[140px] max-w-[240px] items-center justify-between gap-2 rounded-r-lg border border-zinc-300 bg-emerald-50 px-3 py-[5px] text-sm font-medium text-emerald-800 transition-colors hover:bg-emerald-100", children: [
9068
+ /* @__PURE__ */ jsx59("span", { className: "min-w-0 truncate", children: index || "Select an index" }),
9035
9069
  /* @__PURE__ */ jsx59(IconChevronDown2, { className: "size-4 shrink-0 opacity-50" })
9036
9070
  ] }) }),
9037
9071
  /* @__PURE__ */ jsx59(PopoverContent, { className: "p-2", align: "center", children: /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-2", children: [
@@ -9064,13 +9098,13 @@ var IndexSelector = () => {
9064
9098
  setValuesSearchIndex(idx);
9065
9099
  setOpen(false);
9066
9100
  },
9067
- className: "flex flex-1 items-center gap-2 text-left text-sm",
9101
+ className: "flex min-w-0 flex-1 items-center gap-2 text-left text-sm",
9068
9102
  children: [
9069
9103
  /* @__PURE__ */ jsx59(
9070
9104
  "span",
9071
9105
  {
9072
9106
  className: cn(
9073
- "flex size-5 items-center justify-center",
9107
+ "flex size-5 shrink-0 items-center justify-center",
9074
9108
  idx === index ? "text-emerald-600" : "text-transparent"
9075
9109
  ),
9076
9110
  children: /* @__PURE__ */ jsx59(IconCircleCheck, { className: "size-5" })
@@ -9614,7 +9648,7 @@ var SearchEmptyState = () => {
9614
9648
  /* @__PURE__ */ jsx65(
9615
9649
  "a",
9616
9650
  {
9617
- href: "https://upstash-search.mintlify.app/redis/search/introduction",
9651
+ href: "https://upstash.com/docs/redis/search/introduction",
9618
9652
  target: "_blank",
9619
9653
  rel: "noopener noreferrer",
9620
9654
  className: "mt-5 inline-block text-sm text-emerald-600 underline-offset-2 hover:underline",
@@ -10452,7 +10486,7 @@ var BoostBadge = ({
10452
10486
  /* @__PURE__ */ jsx73(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx73("span", { className: `flex h-full cursor-default items-center px-2 ${labelBg} ${textColor}`, children: isNegative ? "Demote" : "Boost" }) }),
10453
10487
  /* @__PURE__ */ jsxs42(TooltipContent, { side: "bottom", className: "max-w-xs", children: [
10454
10488
  /* @__PURE__ */ jsx73("span", { children: isNegative ? `Multiplies this condition's score by ${node.boost ?? 0}, subtracting from the total.` : `Multiplies this condition's score by ${node.boost ?? 0}.` }),
10455
- /* @__PURE__ */ jsx73(DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/boost" })
10489
+ /* @__PURE__ */ jsx73(DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/boost" })
10456
10490
  ] })
10457
10491
  ] }),
10458
10492
  isStatic ? /* @__PURE__ */ jsx73("span", { className: `px-2 ${textColor}`, children: node.boost }) : /* @__PURE__ */ jsx73("span", { className: "flex h-full items-center bg-white px-2", children: /* @__PURE__ */ jsx73(
@@ -11360,7 +11394,7 @@ var InnerGroup = ({
11360
11394
  /* @__PURE__ */ jsx81(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx81("div", { className: "ml-2 mt-2 flex h-[26px] w-fit cursor-default select-none items-center rounded-md border border-zinc-300 bg-amber-50 px-2 text-sm font-medium capitalize text-amber-800", children: "Must Not" }) }),
11361
11395
  /* @__PURE__ */ jsxs48(TooltipContent, { side: "right", className: "max-w-xs", children: [
11362
11396
  /* @__PURE__ */ jsx81("span", { children: "Keys matching any of the conditions below are excluded from the results." }),
11363
- /* @__PURE__ */ jsx81(DocsLink, { href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/must-not" })
11397
+ /* @__PURE__ */ jsx81(DocsLink, { href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/must-not" })
11364
11398
  ] })
11365
11399
  ] }),
11366
11400
  node.children.map(
@@ -11800,7 +11834,7 @@ var QueryBuilderContent = () => {
11800
11834
  DocsLink,
11801
11835
  {
11802
11836
  className: "absolute bottom-2 right-2 text-sm",
11803
- href: "https://upstash-search.mintlify.app/redis/search/query-operators/boolean-operators/overview"
11837
+ href: "https://upstash.com/docs/redis/search/query-operators/boolean-operators/overview"
11804
11838
  }
11805
11839
  )
11806
11840
  ] });
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "0.2.15", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "git@github.com:upstash/react-redis-browser.git" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ./src", "test": "bun test src", "test:e2e": "playwright test", "prepare": "husky" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", "@ianvs/prettier-plugin-sort-imports": "^4.7.1", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-context-menu": "^2.2.16", "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-label": "^2.1.8", "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-portal": "^1.1.10", "@radix-ui/react-progress": "^1.1.8", "@radix-ui/react-scroll-area": "^1.2.10", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-switch": "^1.2.6", "@radix-ui/react-toast": "^1.2.15", "@radix-ui/react-tooltip": "^1.2.8", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "1.37.0-rc.12", "bytes": "^3.1.2", "cmdk": "^1.1.1", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "@playwright/test": "^1.56.1", "@types/bun": "^1.3.7", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "dotenv": "^16.5.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "husky": "^9.1.7", "lint-staged": "^16.2.7", "postcss": "^8.4.31", "postcss-prefix-selector": "^2.1.0", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }
1
+ { "name": "@upstash/react-redis-browser", "version": "0.2.17", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "repository": { "type": "git", "url": "git@github.com:upstash/react-redis-browser.git" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ./src", "test": "bun test src", "test:e2e": "playwright test", "prepare": "husky" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", "@ianvs/prettier-plugin-sort-imports": "^4.7.1", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-context-menu": "^2.2.16", "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-label": "^2.1.8", "@radix-ui/react-popover": "^1.1.15", "@radix-ui/react-portal": "^1.1.10", "@radix-ui/react-progress": "^1.1.8", "@radix-ui/react-scroll-area": "^1.2.10", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-switch": "^1.2.6", "@radix-ui/react-toast": "^1.2.15", "@radix-ui/react-tooltip": "^1.2.8", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "1.37.0", "bytes": "^3.1.2", "cmdk": "^1.1.1", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "@playwright/test": "^1.56.1", "@types/bun": "^1.3.7", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "dotenv": "^16.5.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "husky": "^9.1.7", "lint-staged": "^16.2.7", "postcss": "^8.4.31", "postcss-prefix-selector": "^2.1.0", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }