@upstash/react-redis-browser 0.2.14-rc.2 → 0.2.14-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.css CHANGED
@@ -1179,6 +1179,9 @@
1179
1179
  .ups-db .max-w-md {
1180
1180
  max-width: 28rem;
1181
1181
  }
1182
+ .ups-db .max-w-xs {
1183
+ max-width: 20rem;
1184
+ }
1182
1185
  .ups-db .flex-1 {
1183
1186
  flex: 1 1 0%;
1184
1187
  }
@@ -1575,6 +1578,10 @@
1575
1578
  --tw-bg-opacity: 1;
1576
1579
  background-color: rgb(var(--color-amber-200) / var(--tw-bg-opacity));
1577
1580
  }
1581
+ .ups-db .bg-amber-300 {
1582
+ --tw-bg-opacity: 1;
1583
+ background-color: rgb(var(--color-amber-300) / var(--tw-bg-opacity));
1584
+ }
1578
1585
  .ups-db .bg-amber-50 {
1579
1586
  --tw-bg-opacity: 1;
1580
1587
  background-color: rgb(var(--color-amber-50) / var(--tw-bg-opacity));
@@ -1767,6 +1774,10 @@
1767
1774
  padding-top: 0px;
1768
1775
  padding-bottom: 0px;
1769
1776
  }
1777
+ .ups-db .py-0\.5 {
1778
+ padding-top: 0.125rem;
1779
+ padding-bottom: 0.125rem;
1780
+ }
1770
1781
  .ups-db .py-1 {
1771
1782
  padding-top: 0.25rem;
1772
1783
  padding-bottom: 0.25rem;
package/dist/index.js CHANGED
@@ -5301,80 +5301,87 @@ var MonacoEditorWithTypes = ({
5301
5301
  _react.useEffect.call(void 0, () => {
5302
5302
  if (!validateValue(value)) onChange(defaultValue);
5303
5303
  }, [value, editorRef.current, onChange, validateValue, defaultValue]);
5304
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5305
- _react2.Editor,
5304
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5305
+ "div",
5306
5306
  {
5307
- theme: theme === "dark" ? "vs-dark" : "light",
5308
- loading: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSpinner, {}),
5309
- beforeMount: handleBeforeMount,
5310
- onMount: (editor) => {
5311
- editorRef.current = editor;
5312
- },
5313
- value,
5314
- onChange: handleChange,
5315
- defaultLanguage: "typescript",
5316
- path: filePath,
5317
- options: {
5318
- wordWrap: "on",
5319
- overviewRulerBorder: false,
5320
- overviewRulerLanes: 0,
5321
- formatOnPaste: true,
5322
- formatOnType: true,
5323
- renderWhitespace: "none",
5324
- smoothScrolling: true,
5325
- scrollbar: {
5326
- verticalScrollbarSize: 6
5327
- },
5328
- autoIndent: "full",
5329
- guides: { indentation: false },
5330
- fontSize: 13,
5331
- cursorBlinking: "smooth",
5332
- minimap: { enabled: false },
5333
- folding: true,
5334
- glyphMargin: false,
5335
- lineNumbers: "on",
5336
- parameterHints: { enabled: true },
5337
- lineDecorationsWidth: 0,
5338
- automaticLayout: true,
5339
- scrollBeyondLastLine: false,
5340
- renderLineHighlight: "line",
5341
- renderLineHighlightOnlyWhenFocus: true,
5342
- selectionHighlight: false,
5343
- // @ts-expect-error "off" does not work
5344
- occurrencesHighlight: false,
5345
- hover: { enabled: true },
5346
- unusualLineTerminators: "auto",
5347
- padding: { top: 8, bottom: 8 },
5348
- quickSuggestions: true,
5349
- suggest: {
5350
- showFunctions: _nullishCoalesce(showFunctions, () => ( false)),
5351
- showVariables: false,
5352
- showConstants: false,
5353
- showClasses: false,
5354
- showInterfaces: false,
5355
- showModules: false,
5356
- showKeywords: false
5357
- },
5358
- suggestOnTriggerCharacters: true,
5359
- acceptSuggestionOnEnter: "on",
5360
- tabCompletion: "on",
5361
- tabSize: 2,
5362
- wordBasedSuggestions: "off",
5363
- // Disable navigation features
5364
- gotoLocation: {
5365
- multiple: "goto",
5366
- multipleDefinitions: "goto",
5367
- multipleTypeDefinitions: "goto",
5368
- multipleDeclarations: "goto",
5369
- multipleImplementations: "goto",
5370
- multipleReferences: "goto"
5371
- },
5372
- definitionLinkOpensInPeek: false,
5373
- contextmenu: false
5374
- },
5375
- className: "[&_.current-line]:!border-none [&_.current-line]:!bg-emerald-50 [&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent [&_[role='presentation']]:!bg-transparent"
5307
+ className: cn("group/editor relative", height === void 0 && "h-full"),
5308
+ style: { height },
5309
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5310
+ _react2.Editor,
5311
+ {
5312
+ theme: theme === "dark" ? "vs-dark" : "light",
5313
+ loading: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSpinner, {}),
5314
+ beforeMount: handleBeforeMount,
5315
+ onMount: (editor) => {
5316
+ editorRef.current = editor;
5317
+ },
5318
+ value,
5319
+ onChange: handleChange,
5320
+ defaultLanguage: "typescript",
5321
+ path: filePath,
5322
+ options: {
5323
+ wordWrap: "on",
5324
+ overviewRulerBorder: false,
5325
+ overviewRulerLanes: 0,
5326
+ formatOnPaste: true,
5327
+ formatOnType: true,
5328
+ renderWhitespace: "none",
5329
+ smoothScrolling: true,
5330
+ scrollbar: {
5331
+ verticalScrollbarSize: 6
5332
+ },
5333
+ autoIndent: "full",
5334
+ guides: { indentation: false },
5335
+ fontSize: 13,
5336
+ cursorBlinking: "smooth",
5337
+ minimap: { enabled: false },
5338
+ folding: true,
5339
+ glyphMargin: false,
5340
+ lineNumbers: "on",
5341
+ parameterHints: { enabled: true },
5342
+ lineDecorationsWidth: 0,
5343
+ automaticLayout: true,
5344
+ scrollBeyondLastLine: false,
5345
+ renderLineHighlight: "line",
5346
+ renderLineHighlightOnlyWhenFocus: true,
5347
+ selectionHighlight: false,
5348
+ // @ts-expect-error "off" does not work
5349
+ occurrencesHighlight: false,
5350
+ hover: { enabled: true },
5351
+ unusualLineTerminators: "auto",
5352
+ padding: { top: 8, bottom: 8 },
5353
+ quickSuggestions: true,
5354
+ suggest: {
5355
+ showFunctions: _nullishCoalesce(showFunctions, () => ( false)),
5356
+ showVariables: false,
5357
+ showConstants: false,
5358
+ showClasses: false,
5359
+ showInterfaces: false,
5360
+ showModules: false,
5361
+ showKeywords: false
5362
+ },
5363
+ suggestOnTriggerCharacters: true,
5364
+ acceptSuggestionOnEnter: "on",
5365
+ tabCompletion: "on",
5366
+ tabSize: 2,
5367
+ wordBasedSuggestions: "off",
5368
+ // Disable navigation features
5369
+ gotoLocation: {
5370
+ multiple: "goto",
5371
+ multipleDefinitions: "goto",
5372
+ multipleTypeDefinitions: "goto",
5373
+ multipleDeclarations: "goto",
5374
+ multipleImplementations: "goto",
5375
+ multipleReferences: "goto"
5376
+ },
5377
+ definitionLinkOpensInPeek: false,
5378
+ contextmenu: false
5379
+ },
5380
+ className: "[&_.current-line]:!border-none [&_.current-line]:!bg-emerald-50 [&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent [&_[role='presentation']]:!bg-transparent"
5381
+ }
5382
+ )
5376
5383
  }
5377
- ) });
5384
+ );
5378
5385
  };
5379
5386
  var handleBeforeMount = (monaco) => {
5380
5387
  monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
@@ -5394,15 +5401,22 @@ var handleBeforeMount = (monaco) => {
5394
5401
  monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
5395
5402
  };
5396
5403
  var TestEditor = ({ value, onChange, height, testLabel }) => {
5397
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5398
- "textarea",
5404
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5405
+ "div",
5399
5406
  {
5400
- "aria-label": testLabel,
5401
- value,
5402
- onChange: (e) => onChange(e.target.value),
5403
- className: "h-full w-full resize-none bg-transparent p-2 font-mono text-sm"
5407
+ className: cn("group/editor relative", height === void 0 && "h-full"),
5408
+ style: { height },
5409
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5410
+ "textarea",
5411
+ {
5412
+ "aria-label": testLabel,
5413
+ value,
5414
+ onChange: (e) => onChange(e.target.value),
5415
+ className: "h-full w-full resize-none bg-transparent p-2 font-mono text-sm"
5416
+ }
5417
+ )
5404
5418
  }
5405
- ) });
5419
+ );
5406
5420
  };
5407
5421
 
5408
5422
  // src/components/databrowser/components/search/generate-schema-type-definitions.tsx
@@ -5710,7 +5724,14 @@ var SearchDisplay = ({
5710
5724
  {
5711
5725
  name: "editorValue",
5712
5726
  control,
5713
- render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SchemaEditor, { value: field.value, onChange: field.onChange, height: 300 })
5727
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5728
+ SchemaEditor,
5729
+ {
5730
+ value: field.value,
5731
+ onChange: field.onChange,
5732
+ height: isCreateModal || isEditModal ? 300 : void 0
5733
+ }
5734
+ )
5714
5735
  }
5715
5736
  ) }) })
5716
5737
  ] }),
@@ -8208,20 +8229,48 @@ var parseGroup = (groupValue, operator, boost) => {
8208
8229
  }
8209
8230
  return null;
8210
8231
  };
8232
+ var addMustNotChildren = (group, mustNotValue) => {
8233
+ if (Array.isArray(mustNotValue)) {
8234
+ for (const item of mustNotValue) {
8235
+ const child = objectToQueryNode(item);
8236
+ if (child) {
8237
+ child.not = true;
8238
+ group.children.push(child);
8239
+ }
8240
+ }
8241
+ } else if (typeof mustNotValue === "object" && mustNotValue !== null) {
8242
+ const child = objectToQueryNode(mustNotValue);
8243
+ if (child) {
8244
+ child.not = true;
8245
+ group.children.push(child);
8246
+ }
8247
+ }
8248
+ };
8211
8249
  var objectToQueryNode = (obj) => {
8212
8250
  if (!obj || typeof obj !== "object") return null;
8213
8251
  const keys = Object.keys(obj);
8214
8252
  if (keys.length === 0) return null;
8215
- if ("$mustNot" in obj) {
8216
- return parseMustNot(obj.$mustNot);
8217
- }
8218
- if ("$and" in obj || "$or" in obj) {
8253
+ const hasGroup = "$and" in obj || "$or" in obj;
8254
+ const hasMustNot = "$mustNot" in obj;
8255
+ const nonOperatorKeys = keys.filter((key) => !isOperatorKey(key));
8256
+ if (hasGroup) {
8219
8257
  const operator = "$and" in obj ? "and" : "or";
8220
8258
  const groupValue = _nullishCoalesce(obj["$and"], () => ( obj["$or"]));
8221
8259
  const boost = "$boost" in obj ? obj.$boost : void 0;
8222
- return parseGroup(groupValue, operator, boost);
8260
+ const groupNode = parseGroup(groupValue, operator, boost);
8261
+ if (groupNode && groupNode.type === "group" && hasMustNot) {
8262
+ addMustNotChildren(groupNode, obj.$mustNot);
8263
+ }
8264
+ return groupNode;
8265
+ }
8266
+ if (hasMustNot) {
8267
+ if (nonOperatorKeys.length > 0) {
8268
+ const group = parseMultiFieldObject(obj, "and");
8269
+ addMustNotChildren(group, obj.$mustNot);
8270
+ return group;
8271
+ }
8272
+ return parseMustNot(obj.$mustNot);
8223
8273
  }
8224
- const nonOperatorKeys = keys.filter((key) => !isOperatorKey(key));
8225
8274
  if (nonOperatorKeys.length === 0) return null;
8226
8275
  const nodeBoost = "$boost" in obj ? obj.$boost : void 0;
8227
8276
  if (nonOperatorKeys.length === 1) {
@@ -8883,7 +8932,6 @@ var QueryCondition = ({
8883
8932
  }
8884
8933
  ),
8885
8934
  node.boost !== void 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoostBadge, { node }),
8886
- node.not && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NotBadge, {}),
8887
8935
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
8888
8936
  "div",
8889
8937
  {
@@ -9004,11 +9052,15 @@ var QueryDndProvider = ({
9004
9052
  const currentParent = findParentGroup(rootNode, activeIdStr);
9005
9053
  if (!currentParent) return;
9006
9054
  if (!overIdStr.startsWith("drop-")) return;
9007
- const parts = overIdStr.split("-");
9008
- if (parts.length < 3) return;
9009
- const targetGroupId = parts[1];
9010
- const targetIndex = Number.parseInt(parts[2], 10);
9011
- if (Number.isNaN(targetIndex)) return;
9055
+ const firstDash = overIdStr.indexOf("-");
9056
+ const secondDash = overIdStr.indexOf("-", firstDash + 1);
9057
+ if (firstDash === -1 || secondDash === -1) return;
9058
+ const targetGroupId = overIdStr.slice(firstDash + 1, secondDash);
9059
+ const dropRef = overIdStr.slice(secondDash + 1);
9060
+ const targetGroup = findNodeById(rootNode, targetGroupId);
9061
+ if (!targetGroup || targetGroup.type !== "group") return;
9062
+ const targetIndex = dropRef === "end" ? targetGroup.children.length : targetGroup.children.findIndex((c) => c.id === dropRef);
9063
+ if (targetIndex === -1) return;
9012
9064
  const currentIndex = currentParent.children.findIndex((c) => c.id === activeIdStr);
9013
9065
  if (currentParent.id === targetGroupId && // Same group: if dropping at current or current+1 position, it's a no-op
9014
9066
  (targetIndex === currentIndex || targetIndex === currentIndex + 1)) {
@@ -9128,7 +9180,7 @@ var DropIndicator = ({ id, isOver }) => {
9128
9180
  ) });
9129
9181
  };
9130
9182
  var EmptyGroupDropZone = ({ groupId, isOver }) => {
9131
- const { setNodeRef } = _core.useDroppable.call(void 0, { id: `drop-${groupId}-0` });
9183
+ const { setNodeRef } = _core.useDroppable.call(void 0, { id: `drop-${groupId}-end` });
9132
9184
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9133
9185
  "div",
9134
9186
  {
@@ -9141,6 +9193,30 @@ var EmptyGroupDropZone = ({ groupId, isOver }) => {
9141
9193
 
9142
9194
  // src/components/databrowser/components/ui-query-builder/query-group.tsx
9143
9195
 
9196
+ var ChildRow = ({
9197
+ groupId,
9198
+ child,
9199
+ depth,
9200
+ activeOverId,
9201
+ droppingId
9202
+ }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
9203
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9204
+ DropIndicator,
9205
+ {
9206
+ id: `drop-${groupId}-${child.id}`,
9207
+ isOver: activeOverId === `drop-${groupId}-${child.id}`
9208
+ }
9209
+ ),
9210
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QueryCondition, { node: child }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9211
+ InnerGroup,
9212
+ {
9213
+ node: child,
9214
+ depth: depth + 1,
9215
+ activeOverId,
9216
+ droppingId
9217
+ }
9218
+ ) })
9219
+ ] });
9144
9220
  var InnerGroup = ({
9145
9221
  node,
9146
9222
  isRoot = false,
@@ -9165,12 +9241,12 @@ var InnerGroup = ({
9165
9241
  deleteNode(node.id);
9166
9242
  };
9167
9243
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
9168
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "group/group flex items-center gap-1", children: [
9244
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "group/group flex items-center gap-1 px-1", children: [
9169
9245
  !isRoot && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9170
9246
  "div",
9171
9247
  {
9172
9248
  ref: _optionalChain([dragHandleProps, 'optionalAccess', _97 => _97.ref]),
9173
- className: "flex cursor-grab items-center text-zinc-400",
9249
+ className: "flex cursor-grab items-center px-1 text-zinc-400",
9174
9250
  ..._optionalChain([dragHandleProps, 'optionalAccess', _98 => _98.attributes]),
9175
9251
  ..._optionalChain([dragHandleProps, 'optionalAccess', _99 => _99.listeners]),
9176
9252
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconGripVertical, { size: 16 })
@@ -9198,7 +9274,6 @@ var InnerGroup = ({
9198
9274
  ] })
9199
9275
  ] }),
9200
9276
  node.boost !== void 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoostBadge, { node }),
9201
- node.not && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NotBadge, {}),
9202
9277
  !isRoot && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
9203
9278
  "div",
9204
9279
  {
@@ -9218,30 +9293,59 @@ var InnerGroup = ({
9218
9293
  }
9219
9294
  )
9220
9295
  ] }),
9221
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `min-h-[20px] ${isRoot ? "" : "ml-2 border-l-2 border-zinc-200 pl-3"}`, children: node.children.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EmptyGroupDropZone, { groupId: node.id, isOver: activeOverId === `drop-${node.id}-0` }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
9222
- node.children.map((child, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
9223
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9224
- DropIndicator,
9296
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `min-h-[20px] ${isRoot ? "" : "ml-2 border-l-2 border-zinc-200 pl-3"}`, children: node.children.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EmptyGroupDropZone, { groupId: node.id, isOver: activeOverId === `drop-${node.id}-end` }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
9297
+ node.children.map(
9298
+ (child) => !child.not && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9299
+ ChildRow,
9225
9300
  {
9226
- id: `drop-${node.id}-${index}`,
9227
- isOver: activeOverId === `drop-${node.id}-${index}`
9228
- }
9229
- ),
9230
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QueryCondition, { node: child }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9231
- InnerGroup,
9301
+ groupId: node.id,
9302
+ child,
9303
+ depth,
9304
+ activeOverId,
9305
+ droppingId
9306
+ },
9307
+ child.id
9308
+ )
9309
+ ),
9310
+ node.children.some((child) => child.not) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Tooltip, { delayDuration: 200, children: [
9311
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 px-1 py-1.5", children: [
9312
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-px flex-1 bg-amber-300" }),
9313
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "cursor-default select-none rounded bg-amber-50 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wider text-amber-800", children: "Must Not" }),
9314
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-px flex-1 bg-amber-300" })
9315
+ ] }) }),
9316
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { children: [
9317
+ "Keys matching any of the conditions below are excluded from the results.",
9318
+ " ",
9319
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9320
+ "a",
9321
+ {
9322
+ href: "https://upstash.com/docs/vector/features/filtering/boolean-operators/must-not",
9323
+ target: "_blank",
9324
+ rel: "noopener noreferrer",
9325
+ className: "underline",
9326
+ children: "Learn more"
9327
+ }
9328
+ )
9329
+ ] }) })
9330
+ ] }),
9331
+ node.children.map(
9332
+ (child) => child.not && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9333
+ ChildRow,
9232
9334
  {
9233
- node: child,
9234
- depth: depth + 1,
9335
+ groupId: node.id,
9336
+ child,
9337
+ depth,
9235
9338
  activeOverId,
9236
9339
  droppingId
9237
- }
9238
- ) })
9239
- ] }, child.id)),
9340
+ },
9341
+ child.id
9342
+ )
9343
+ ),
9240
9344
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
9241
9345
  DropIndicator,
9242
9346
  {
9243
- id: `drop-${node.id}-${node.children.length}`,
9244
- isOver: activeOverId === `drop-${node.id}-${node.children.length}`
9347
+ id: `drop-${node.id}-end`,
9348
+ isOver: activeOverId === `drop-${node.id}-end`
9245
9349
  }
9246
9350
  )
9247
9351
  ] }) })
@@ -9302,7 +9406,7 @@ var buildOperatorValue = (operator, value, fuzzyDistance) => {
9302
9406
  var conditionToObject = (node) => {
9303
9407
  const { field, operator, value, boost: conditionBoost, fuzzyDistance } = node.condition;
9304
9408
  const effectiveBoost = _nullishCoalesce(node.boost, () => ( conditionBoost));
9305
- if (operator === "eq" && !effectiveBoost && !node.not) {
9409
+ if (operator === "eq" && !effectiveBoost) {
9306
9410
  return { [field]: value };
9307
9411
  }
9308
9412
  const fieldCondition = {
@@ -9312,11 +9416,7 @@ var conditionToObject = (node) => {
9312
9416
  if (finalBoost && finalBoost !== 1) {
9313
9417
  fieldCondition.$boost = finalBoost;
9314
9418
  }
9315
- const condition = { [field]: fieldCondition };
9316
- if (node.not) {
9317
- return { $mustNot: [condition] };
9318
- }
9319
- return condition;
9419
+ return { [field]: fieldCondition };
9320
9420
  };
9321
9421
  var canMergeChildren = (children) => {
9322
9422
  return children.every(
@@ -9337,35 +9437,48 @@ var mergeConditions = (children, boost) => {
9337
9437
  };
9338
9438
  var groupToObject = (node, isRoot) => {
9339
9439
  const { groupOperator, children, boost, not } = node;
9440
+ const normalChildren = children.filter((c) => !c.not);
9441
+ const negatedChildren = children.filter((c) => c.not);
9340
9442
  if (isRoot && children.length === 0 && !not && !boost) {
9341
9443
  return {};
9342
9444
  }
9343
- if (isRoot && groupOperator === "and" && children.length === 1 && !not && !boost) {
9344
- return queryNodeToObject(children[0], false);
9445
+ if (not) {
9446
+ const withoutNot = { ...node, not: void 0 };
9447
+ const inner = groupToObject(withoutNot, false);
9448
+ if (groupOperator === "or" && !boost && negatedChildren.length === 0) {
9449
+ const childObjects = normalChildren.map((child) => queryNodeToObject(child, false));
9450
+ return { $mustNot: childObjects };
9451
+ }
9452
+ return { $mustNot: [inner] };
9453
+ }
9454
+ if (isRoot && groupOperator === "and" && normalChildren.length === 1 && negatedChildren.length === 0 && !boost) {
9455
+ return queryNodeToObject(normalChildren[0], false);
9345
9456
  }
9346
- if (children.length > 0 && !not && canMergeChildren(children)) {
9347
- const merged = mergeConditions(children, boost);
9457
+ if (normalChildren.length > 0 && negatedChildren.length === 0 && canMergeChildren(normalChildren)) {
9458
+ const merged = mergeConditions(normalChildren, boost);
9348
9459
  if (isRoot && groupOperator === "and") {
9349
9460
  return merged;
9350
9461
  }
9351
- const result = { [`$${groupOperator}`]: merged };
9462
+ const result2 = { [`$${groupOperator}`]: merged };
9352
9463
  if (boost && boost !== 1) {
9353
- result.$boost = boost;
9464
+ result2.$boost = boost;
9354
9465
  }
9355
- return result;
9466
+ return result2;
9356
9467
  }
9357
- const childObjects = children.map((child) => queryNodeToObject(child, false));
9358
- const group = { [`$${groupOperator}`]: childObjects };
9359
- if (boost && boost !== 1) {
9360
- group.$boost = boost;
9468
+ const result = {};
9469
+ if (normalChildren.length > 0) {
9470
+ result[`$${groupOperator}`] = normalChildren.map((child) => queryNodeToObject(child, false));
9361
9471
  }
9362
- if (not) {
9363
- if (groupOperator === "or" && !boost) {
9364
- return { $mustNot: childObjects };
9365
- }
9366
- return { $mustNot: [group] };
9472
+ if (negatedChildren.length > 0) {
9473
+ result.$mustNot = negatedChildren.map((child) => {
9474
+ const withoutNot = { ...child, not: void 0 };
9475
+ return queryNodeToObject(withoutNot, false);
9476
+ });
9367
9477
  }
9368
- return group;
9478
+ if (boost && boost !== 1) {
9479
+ result.$boost = boost;
9480
+ }
9481
+ return result;
9369
9482
  };
9370
9483
  var queryNodeToObject = (node, isRoot = false) => {
9371
9484
  if (node.type === "condition") {
package/dist/index.mjs CHANGED
@@ -5301,80 +5301,87 @@ var MonacoEditorWithTypes = ({
5301
5301
  useEffect6(() => {
5302
5302
  if (!validateValue(value)) onChange(defaultValue);
5303
5303
  }, [value, editorRef.current, onChange, validateValue, defaultValue]);
5304
- return /* @__PURE__ */ jsx26("div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ jsx26(
5305
- Editor,
5304
+ return /* @__PURE__ */ jsx26(
5305
+ "div",
5306
5306
  {
5307
- theme: theme === "dark" ? "vs-dark" : "light",
5308
- loading: /* @__PURE__ */ jsx26(LoadingSpinner, {}),
5309
- beforeMount: handleBeforeMount,
5310
- onMount: (editor) => {
5311
- editorRef.current = editor;
5312
- },
5313
- value,
5314
- onChange: handleChange,
5315
- defaultLanguage: "typescript",
5316
- path: filePath,
5317
- options: {
5318
- wordWrap: "on",
5319
- overviewRulerBorder: false,
5320
- overviewRulerLanes: 0,
5321
- formatOnPaste: true,
5322
- formatOnType: true,
5323
- renderWhitespace: "none",
5324
- smoothScrolling: true,
5325
- scrollbar: {
5326
- verticalScrollbarSize: 6
5327
- },
5328
- autoIndent: "full",
5329
- guides: { indentation: false },
5330
- fontSize: 13,
5331
- cursorBlinking: "smooth",
5332
- minimap: { enabled: false },
5333
- folding: true,
5334
- glyphMargin: false,
5335
- lineNumbers: "on",
5336
- parameterHints: { enabled: true },
5337
- lineDecorationsWidth: 0,
5338
- automaticLayout: true,
5339
- scrollBeyondLastLine: false,
5340
- renderLineHighlight: "line",
5341
- renderLineHighlightOnlyWhenFocus: true,
5342
- selectionHighlight: false,
5343
- // @ts-expect-error "off" does not work
5344
- occurrencesHighlight: false,
5345
- hover: { enabled: true },
5346
- unusualLineTerminators: "auto",
5347
- padding: { top: 8, bottom: 8 },
5348
- quickSuggestions: true,
5349
- suggest: {
5350
- showFunctions: showFunctions ?? false,
5351
- showVariables: false,
5352
- showConstants: false,
5353
- showClasses: false,
5354
- showInterfaces: false,
5355
- showModules: false,
5356
- showKeywords: false
5357
- },
5358
- suggestOnTriggerCharacters: true,
5359
- acceptSuggestionOnEnter: "on",
5360
- tabCompletion: "on",
5361
- tabSize: 2,
5362
- wordBasedSuggestions: "off",
5363
- // Disable navigation features
5364
- gotoLocation: {
5365
- multiple: "goto",
5366
- multipleDefinitions: "goto",
5367
- multipleTypeDefinitions: "goto",
5368
- multipleDeclarations: "goto",
5369
- multipleImplementations: "goto",
5370
- multipleReferences: "goto"
5371
- },
5372
- definitionLinkOpensInPeek: false,
5373
- contextmenu: false
5374
- },
5375
- className: "[&_.current-line]:!border-none [&_.current-line]:!bg-emerald-50 [&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent [&_[role='presentation']]:!bg-transparent"
5307
+ className: cn("group/editor relative", height === void 0 && "h-full"),
5308
+ style: { height },
5309
+ children: /* @__PURE__ */ jsx26(
5310
+ Editor,
5311
+ {
5312
+ theme: theme === "dark" ? "vs-dark" : "light",
5313
+ loading: /* @__PURE__ */ jsx26(LoadingSpinner, {}),
5314
+ beforeMount: handleBeforeMount,
5315
+ onMount: (editor) => {
5316
+ editorRef.current = editor;
5317
+ },
5318
+ value,
5319
+ onChange: handleChange,
5320
+ defaultLanguage: "typescript",
5321
+ path: filePath,
5322
+ options: {
5323
+ wordWrap: "on",
5324
+ overviewRulerBorder: false,
5325
+ overviewRulerLanes: 0,
5326
+ formatOnPaste: true,
5327
+ formatOnType: true,
5328
+ renderWhitespace: "none",
5329
+ smoothScrolling: true,
5330
+ scrollbar: {
5331
+ verticalScrollbarSize: 6
5332
+ },
5333
+ autoIndent: "full",
5334
+ guides: { indentation: false },
5335
+ fontSize: 13,
5336
+ cursorBlinking: "smooth",
5337
+ minimap: { enabled: false },
5338
+ folding: true,
5339
+ glyphMargin: false,
5340
+ lineNumbers: "on",
5341
+ parameterHints: { enabled: true },
5342
+ lineDecorationsWidth: 0,
5343
+ automaticLayout: true,
5344
+ scrollBeyondLastLine: false,
5345
+ renderLineHighlight: "line",
5346
+ renderLineHighlightOnlyWhenFocus: true,
5347
+ selectionHighlight: false,
5348
+ // @ts-expect-error "off" does not work
5349
+ occurrencesHighlight: false,
5350
+ hover: { enabled: true },
5351
+ unusualLineTerminators: "auto",
5352
+ padding: { top: 8, bottom: 8 },
5353
+ quickSuggestions: true,
5354
+ suggest: {
5355
+ showFunctions: showFunctions ?? false,
5356
+ showVariables: false,
5357
+ showConstants: false,
5358
+ showClasses: false,
5359
+ showInterfaces: false,
5360
+ showModules: false,
5361
+ showKeywords: false
5362
+ },
5363
+ suggestOnTriggerCharacters: true,
5364
+ acceptSuggestionOnEnter: "on",
5365
+ tabCompletion: "on",
5366
+ tabSize: 2,
5367
+ wordBasedSuggestions: "off",
5368
+ // Disable navigation features
5369
+ gotoLocation: {
5370
+ multiple: "goto",
5371
+ multipleDefinitions: "goto",
5372
+ multipleTypeDefinitions: "goto",
5373
+ multipleDeclarations: "goto",
5374
+ multipleImplementations: "goto",
5375
+ multipleReferences: "goto"
5376
+ },
5377
+ definitionLinkOpensInPeek: false,
5378
+ contextmenu: false
5379
+ },
5380
+ className: "[&_.current-line]:!border-none [&_.current-line]:!bg-emerald-50 [&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent [&_[role='presentation']]:!bg-transparent"
5381
+ }
5382
+ )
5376
5383
  }
5377
- ) });
5384
+ );
5378
5385
  };
5379
5386
  var handleBeforeMount = (monaco) => {
5380
5387
  monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
@@ -5394,15 +5401,22 @@ var handleBeforeMount = (monaco) => {
5394
5401
  monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
5395
5402
  };
5396
5403
  var TestEditor = ({ value, onChange, height, testLabel }) => {
5397
- return /* @__PURE__ */ jsx26("div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ jsx26(
5398
- "textarea",
5404
+ return /* @__PURE__ */ jsx26(
5405
+ "div",
5399
5406
  {
5400
- "aria-label": testLabel,
5401
- value,
5402
- onChange: (e) => onChange(e.target.value),
5403
- className: "h-full w-full resize-none bg-transparent p-2 font-mono text-sm"
5407
+ className: cn("group/editor relative", height === void 0 && "h-full"),
5408
+ style: { height },
5409
+ children: /* @__PURE__ */ jsx26(
5410
+ "textarea",
5411
+ {
5412
+ "aria-label": testLabel,
5413
+ value,
5414
+ onChange: (e) => onChange(e.target.value),
5415
+ className: "h-full w-full resize-none bg-transparent p-2 font-mono text-sm"
5416
+ }
5417
+ )
5404
5418
  }
5405
- ) });
5419
+ );
5406
5420
  };
5407
5421
 
5408
5422
  // src/components/databrowser/components/search/generate-schema-type-definitions.tsx
@@ -5710,7 +5724,14 @@ var SearchDisplay = ({
5710
5724
  {
5711
5725
  name: "editorValue",
5712
5726
  control,
5713
- render: ({ field }) => /* @__PURE__ */ jsx28(SchemaEditor, { value: field.value, onChange: field.onChange, height: 300 })
5727
+ render: ({ field }) => /* @__PURE__ */ jsx28(
5728
+ SchemaEditor,
5729
+ {
5730
+ value: field.value,
5731
+ onChange: field.onChange,
5732
+ height: isCreateModal || isEditModal ? 300 : void 0
5733
+ }
5734
+ )
5714
5735
  }
5715
5736
  ) }) })
5716
5737
  ] }),
@@ -8208,20 +8229,48 @@ var parseGroup = (groupValue, operator, boost) => {
8208
8229
  }
8209
8230
  return null;
8210
8231
  };
8232
+ var addMustNotChildren = (group, mustNotValue) => {
8233
+ if (Array.isArray(mustNotValue)) {
8234
+ for (const item of mustNotValue) {
8235
+ const child = objectToQueryNode(item);
8236
+ if (child) {
8237
+ child.not = true;
8238
+ group.children.push(child);
8239
+ }
8240
+ }
8241
+ } else if (typeof mustNotValue === "object" && mustNotValue !== null) {
8242
+ const child = objectToQueryNode(mustNotValue);
8243
+ if (child) {
8244
+ child.not = true;
8245
+ group.children.push(child);
8246
+ }
8247
+ }
8248
+ };
8211
8249
  var objectToQueryNode = (obj) => {
8212
8250
  if (!obj || typeof obj !== "object") return null;
8213
8251
  const keys = Object.keys(obj);
8214
8252
  if (keys.length === 0) return null;
8215
- if ("$mustNot" in obj) {
8216
- return parseMustNot(obj.$mustNot);
8217
- }
8218
- if ("$and" in obj || "$or" in obj) {
8253
+ const hasGroup = "$and" in obj || "$or" in obj;
8254
+ const hasMustNot = "$mustNot" in obj;
8255
+ const nonOperatorKeys = keys.filter((key) => !isOperatorKey(key));
8256
+ if (hasGroup) {
8219
8257
  const operator = "$and" in obj ? "and" : "or";
8220
8258
  const groupValue = obj["$and"] ?? obj["$or"];
8221
8259
  const boost = "$boost" in obj ? obj.$boost : void 0;
8222
- return parseGroup(groupValue, operator, boost);
8260
+ const groupNode = parseGroup(groupValue, operator, boost);
8261
+ if (groupNode && groupNode.type === "group" && hasMustNot) {
8262
+ addMustNotChildren(groupNode, obj.$mustNot);
8263
+ }
8264
+ return groupNode;
8265
+ }
8266
+ if (hasMustNot) {
8267
+ if (nonOperatorKeys.length > 0) {
8268
+ const group = parseMultiFieldObject(obj, "and");
8269
+ addMustNotChildren(group, obj.$mustNot);
8270
+ return group;
8271
+ }
8272
+ return parseMustNot(obj.$mustNot);
8223
8273
  }
8224
- const nonOperatorKeys = keys.filter((key) => !isOperatorKey(key));
8225
8274
  if (nonOperatorKeys.length === 0) return null;
8226
8275
  const nodeBoost = "$boost" in obj ? obj.$boost : void 0;
8227
8276
  if (nonOperatorKeys.length === 1) {
@@ -8883,7 +8932,6 @@ var QueryCondition = ({
8883
8932
  }
8884
8933
  ),
8885
8934
  node.boost !== void 0 && /* @__PURE__ */ jsx63(BoostBadge, { node }),
8886
- node.not && /* @__PURE__ */ jsx63(NotBadge, {}),
8887
8935
  /* @__PURE__ */ jsxs37(
8888
8936
  "div",
8889
8937
  {
@@ -9004,11 +9052,15 @@ var QueryDndProvider = ({
9004
9052
  const currentParent = findParentGroup(rootNode, activeIdStr);
9005
9053
  if (!currentParent) return;
9006
9054
  if (!overIdStr.startsWith("drop-")) return;
9007
- const parts = overIdStr.split("-");
9008
- if (parts.length < 3) return;
9009
- const targetGroupId = parts[1];
9010
- const targetIndex = Number.parseInt(parts[2], 10);
9011
- if (Number.isNaN(targetIndex)) return;
9055
+ const firstDash = overIdStr.indexOf("-");
9056
+ const secondDash = overIdStr.indexOf("-", firstDash + 1);
9057
+ if (firstDash === -1 || secondDash === -1) return;
9058
+ const targetGroupId = overIdStr.slice(firstDash + 1, secondDash);
9059
+ const dropRef = overIdStr.slice(secondDash + 1);
9060
+ const targetGroup = findNodeById(rootNode, targetGroupId);
9061
+ if (!targetGroup || targetGroup.type !== "group") return;
9062
+ const targetIndex = dropRef === "end" ? targetGroup.children.length : targetGroup.children.findIndex((c) => c.id === dropRef);
9063
+ if (targetIndex === -1) return;
9012
9064
  const currentIndex = currentParent.children.findIndex((c) => c.id === activeIdStr);
9013
9065
  if (currentParent.id === targetGroupId && // Same group: if dropping at current or current+1 position, it's a no-op
9014
9066
  (targetIndex === currentIndex || targetIndex === currentIndex + 1)) {
@@ -9128,7 +9180,7 @@ var DropIndicator = ({ id, isOver }) => {
9128
9180
  ) });
9129
9181
  };
9130
9182
  var EmptyGroupDropZone = ({ groupId, isOver }) => {
9131
- const { setNodeRef } = useDroppable({ id: `drop-${groupId}-0` });
9183
+ const { setNodeRef } = useDroppable({ id: `drop-${groupId}-end` });
9132
9184
  return /* @__PURE__ */ jsx67(
9133
9185
  "div",
9134
9186
  {
@@ -9141,6 +9193,30 @@ var EmptyGroupDropZone = ({ groupId, isOver }) => {
9141
9193
 
9142
9194
  // src/components/databrowser/components/ui-query-builder/query-group.tsx
9143
9195
  import { Fragment as Fragment12, jsx as jsx68, jsxs as jsxs40 } from "react/jsx-runtime";
9196
+ var ChildRow = ({
9197
+ groupId,
9198
+ child,
9199
+ depth,
9200
+ activeOverId,
9201
+ droppingId
9202
+ }) => /* @__PURE__ */ jsxs40("div", { children: [
9203
+ /* @__PURE__ */ jsx68(
9204
+ DropIndicator,
9205
+ {
9206
+ id: `drop-${groupId}-${child.id}`,
9207
+ isOver: activeOverId === `drop-${groupId}-${child.id}`
9208
+ }
9209
+ ),
9210
+ /* @__PURE__ */ jsx68(DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ jsx68(QueryCondition, { node: child }) : /* @__PURE__ */ jsx68(
9211
+ InnerGroup,
9212
+ {
9213
+ node: child,
9214
+ depth: depth + 1,
9215
+ activeOverId,
9216
+ droppingId
9217
+ }
9218
+ ) })
9219
+ ] });
9144
9220
  var InnerGroup = ({
9145
9221
  node,
9146
9222
  isRoot = false,
@@ -9165,12 +9241,12 @@ var InnerGroup = ({
9165
9241
  deleteNode(node.id);
9166
9242
  };
9167
9243
  return /* @__PURE__ */ jsxs40("div", { children: [
9168
- /* @__PURE__ */ jsxs40("div", { className: "group/group flex items-center gap-1", children: [
9244
+ /* @__PURE__ */ jsxs40("div", { className: "group/group flex items-center gap-1 px-1", children: [
9169
9245
  !isRoot && /* @__PURE__ */ jsx68(
9170
9246
  "div",
9171
9247
  {
9172
9248
  ref: dragHandleProps?.ref,
9173
- className: "flex cursor-grab items-center text-zinc-400",
9249
+ className: "flex cursor-grab items-center px-1 text-zinc-400",
9174
9250
  ...dragHandleProps?.attributes,
9175
9251
  ...dragHandleProps?.listeners,
9176
9252
  children: /* @__PURE__ */ jsx68(IconGripVertical3, { size: 16 })
@@ -9198,7 +9274,6 @@ var InnerGroup = ({
9198
9274
  ] })
9199
9275
  ] }),
9200
9276
  node.boost !== void 0 && /* @__PURE__ */ jsx68(BoostBadge, { node }),
9201
- node.not && /* @__PURE__ */ jsx68(NotBadge, {}),
9202
9277
  !isRoot && /* @__PURE__ */ jsxs40(
9203
9278
  "div",
9204
9279
  {
@@ -9218,30 +9293,59 @@ var InnerGroup = ({
9218
9293
  }
9219
9294
  )
9220
9295
  ] }),
9221
- /* @__PURE__ */ jsx68("div", { className: `min-h-[20px] ${isRoot ? "" : "ml-2 border-l-2 border-zinc-200 pl-3"}`, children: node.children.length === 0 ? /* @__PURE__ */ jsx68(EmptyGroupDropZone, { groupId: node.id, isOver: activeOverId === `drop-${node.id}-0` }) : /* @__PURE__ */ jsxs40(Fragment12, { children: [
9222
- node.children.map((child, index) => /* @__PURE__ */ jsxs40("div", { children: [
9223
- /* @__PURE__ */ jsx68(
9224
- DropIndicator,
9296
+ /* @__PURE__ */ jsx68("div", { className: `min-h-[20px] ${isRoot ? "" : "ml-2 border-l-2 border-zinc-200 pl-3"}`, children: node.children.length === 0 ? /* @__PURE__ */ jsx68(EmptyGroupDropZone, { groupId: node.id, isOver: activeOverId === `drop-${node.id}-end` }) : /* @__PURE__ */ jsxs40(Fragment12, { children: [
9297
+ node.children.map(
9298
+ (child) => !child.not && /* @__PURE__ */ jsx68(
9299
+ ChildRow,
9225
9300
  {
9226
- id: `drop-${node.id}-${index}`,
9227
- isOver: activeOverId === `drop-${node.id}-${index}`
9228
- }
9229
- ),
9230
- /* @__PURE__ */ jsx68(DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ jsx68(QueryCondition, { node: child }) : /* @__PURE__ */ jsx68(
9231
- InnerGroup,
9301
+ groupId: node.id,
9302
+ child,
9303
+ depth,
9304
+ activeOverId,
9305
+ droppingId
9306
+ },
9307
+ child.id
9308
+ )
9309
+ ),
9310
+ node.children.some((child) => child.not) && /* @__PURE__ */ jsxs40(Tooltip, { delayDuration: 200, children: [
9311
+ /* @__PURE__ */ jsx68(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2 px-1 py-1.5", children: [
9312
+ /* @__PURE__ */ jsx68("div", { className: "h-px flex-1 bg-amber-300" }),
9313
+ /* @__PURE__ */ jsx68("span", { className: "cursor-default select-none rounded bg-amber-50 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wider text-amber-800", children: "Must Not" }),
9314
+ /* @__PURE__ */ jsx68("div", { className: "h-px flex-1 bg-amber-300" })
9315
+ ] }) }),
9316
+ /* @__PURE__ */ jsx68(TooltipContent, { side: "top", className: "max-w-xs", children: /* @__PURE__ */ jsxs40("p", { children: [
9317
+ "Keys matching any of the conditions below are excluded from the results.",
9318
+ " ",
9319
+ /* @__PURE__ */ jsx68(
9320
+ "a",
9321
+ {
9322
+ href: "https://upstash.com/docs/vector/features/filtering/boolean-operators/must-not",
9323
+ target: "_blank",
9324
+ rel: "noopener noreferrer",
9325
+ className: "underline",
9326
+ children: "Learn more"
9327
+ }
9328
+ )
9329
+ ] }) })
9330
+ ] }),
9331
+ node.children.map(
9332
+ (child) => child.not && /* @__PURE__ */ jsx68(
9333
+ ChildRow,
9232
9334
  {
9233
- node: child,
9234
- depth: depth + 1,
9335
+ groupId: node.id,
9336
+ child,
9337
+ depth,
9235
9338
  activeOverId,
9236
9339
  droppingId
9237
- }
9238
- ) })
9239
- ] }, child.id)),
9340
+ },
9341
+ child.id
9342
+ )
9343
+ ),
9240
9344
  /* @__PURE__ */ jsx68(
9241
9345
  DropIndicator,
9242
9346
  {
9243
- id: `drop-${node.id}-${node.children.length}`,
9244
- isOver: activeOverId === `drop-${node.id}-${node.children.length}`
9347
+ id: `drop-${node.id}-end`,
9348
+ isOver: activeOverId === `drop-${node.id}-end`
9245
9349
  }
9246
9350
  )
9247
9351
  ] }) })
@@ -9302,7 +9406,7 @@ var buildOperatorValue = (operator, value, fuzzyDistance) => {
9302
9406
  var conditionToObject = (node) => {
9303
9407
  const { field, operator, value, boost: conditionBoost, fuzzyDistance } = node.condition;
9304
9408
  const effectiveBoost = node.boost ?? conditionBoost;
9305
- if (operator === "eq" && !effectiveBoost && !node.not) {
9409
+ if (operator === "eq" && !effectiveBoost) {
9306
9410
  return { [field]: value };
9307
9411
  }
9308
9412
  const fieldCondition = {
@@ -9312,11 +9416,7 @@ var conditionToObject = (node) => {
9312
9416
  if (finalBoost && finalBoost !== 1) {
9313
9417
  fieldCondition.$boost = finalBoost;
9314
9418
  }
9315
- const condition = { [field]: fieldCondition };
9316
- if (node.not) {
9317
- return { $mustNot: [condition] };
9318
- }
9319
- return condition;
9419
+ return { [field]: fieldCondition };
9320
9420
  };
9321
9421
  var canMergeChildren = (children) => {
9322
9422
  return children.every(
@@ -9337,35 +9437,48 @@ var mergeConditions = (children, boost) => {
9337
9437
  };
9338
9438
  var groupToObject = (node, isRoot) => {
9339
9439
  const { groupOperator, children, boost, not } = node;
9440
+ const normalChildren = children.filter((c) => !c.not);
9441
+ const negatedChildren = children.filter((c) => c.not);
9340
9442
  if (isRoot && children.length === 0 && !not && !boost) {
9341
9443
  return {};
9342
9444
  }
9343
- if (isRoot && groupOperator === "and" && children.length === 1 && !not && !boost) {
9344
- return queryNodeToObject(children[0], false);
9445
+ if (not) {
9446
+ const withoutNot = { ...node, not: void 0 };
9447
+ const inner = groupToObject(withoutNot, false);
9448
+ if (groupOperator === "or" && !boost && negatedChildren.length === 0) {
9449
+ const childObjects = normalChildren.map((child) => queryNodeToObject(child, false));
9450
+ return { $mustNot: childObjects };
9451
+ }
9452
+ return { $mustNot: [inner] };
9345
9453
  }
9346
- if (children.length > 0 && !not && canMergeChildren(children)) {
9347
- const merged = mergeConditions(children, boost);
9454
+ if (isRoot && groupOperator === "and" && normalChildren.length === 1 && negatedChildren.length === 0 && !boost) {
9455
+ return queryNodeToObject(normalChildren[0], false);
9456
+ }
9457
+ if (normalChildren.length > 0 && negatedChildren.length === 0 && canMergeChildren(normalChildren)) {
9458
+ const merged = mergeConditions(normalChildren, boost);
9348
9459
  if (isRoot && groupOperator === "and") {
9349
9460
  return merged;
9350
9461
  }
9351
- const result = { [`$${groupOperator}`]: merged };
9462
+ const result2 = { [`$${groupOperator}`]: merged };
9352
9463
  if (boost && boost !== 1) {
9353
- result.$boost = boost;
9464
+ result2.$boost = boost;
9354
9465
  }
9355
- return result;
9466
+ return result2;
9356
9467
  }
9357
- const childObjects = children.map((child) => queryNodeToObject(child, false));
9358
- const group = { [`$${groupOperator}`]: childObjects };
9359
- if (boost && boost !== 1) {
9360
- group.$boost = boost;
9468
+ const result = {};
9469
+ if (normalChildren.length > 0) {
9470
+ result[`$${groupOperator}`] = normalChildren.map((child) => queryNodeToObject(child, false));
9361
9471
  }
9362
- if (not) {
9363
- if (groupOperator === "or" && !boost) {
9364
- return { $mustNot: childObjects };
9365
- }
9366
- return { $mustNot: [group] };
9472
+ if (negatedChildren.length > 0) {
9473
+ result.$mustNot = negatedChildren.map((child) => {
9474
+ const withoutNot = { ...child, not: void 0 };
9475
+ return queryNodeToObject(withoutNot, false);
9476
+ });
9367
9477
  }
9368
- return group;
9478
+ if (boost && boost !== 1) {
9479
+ result.$boost = boost;
9480
+ }
9481
+ return result;
9369
9482
  };
9370
9483
  var queryNodeToObject = (node, isRoot = false) => {
9371
9484
  if (node.type === "condition") {
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "v0.2.14-rc.2", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "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", "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.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.1.14", "@radix-ui/react-dropdown-menu": "^2.1.15", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "1.37.0-rc.4", "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": "v0.2.14-rc.3", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "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", "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.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.1.14", "@radix-ui/react-dropdown-menu": "^2.1.15", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "1.37.0-rc.4", "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" } }