@upstash/react-redis-browser 0.2.14-rc.3 → 0.2.14-rc.4
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 +69 -35
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1079 -462
- package/dist/index.mjs +1663 -1046
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/databrowser/index.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect20, useMemo as useMemo12, useRef as useRef11 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/dark-mode-context.tsx
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
@@ -3167,7 +3167,7 @@ var portalRoot = root;
|
|
|
3167
3167
|
var portalWrapper = wrapper;
|
|
3168
3168
|
|
|
3169
3169
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
3170
|
-
import { useState as
|
|
3170
|
+
import { useState as useState23 } from "react";
|
|
3171
3171
|
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
|
3172
3172
|
|
|
3173
3173
|
// src/components/ui/segmented.tsx
|
|
@@ -3179,30 +3179,21 @@ var Segmented = ({
|
|
|
3179
3179
|
className,
|
|
3180
3180
|
buttonClassName
|
|
3181
3181
|
}) => {
|
|
3182
|
-
return /* @__PURE__ */ jsx5(
|
|
3183
|
-
"
|
|
3182
|
+
return /* @__PURE__ */ jsx5("div", { className: cn("flex w-fit gap-[2px] rounded-lg bg-zinc-200 p-[2px] text-sm", className), children: options.map((option) => /* @__PURE__ */ jsx5(
|
|
3183
|
+
"button",
|
|
3184
3184
|
{
|
|
3185
3185
|
className: cn(
|
|
3186
|
-
"
|
|
3187
|
-
|
|
3186
|
+
"h-7 rounded-md px-3 transition-all",
|
|
3187
|
+
value === option.key ? "bg-white text-zinc-950" : "text-zinc-700",
|
|
3188
|
+
buttonClassName
|
|
3188
3189
|
),
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
),
|
|
3197
|
-
onClick: () => {
|
|
3198
|
-
onChange?.(option.key);
|
|
3199
|
-
},
|
|
3200
|
-
children: option.label
|
|
3201
|
-
},
|
|
3202
|
-
option.key
|
|
3203
|
-
))
|
|
3204
|
-
}
|
|
3205
|
-
);
|
|
3190
|
+
onClick: () => {
|
|
3191
|
+
onChange?.(option.key);
|
|
3192
|
+
},
|
|
3193
|
+
children: option.label
|
|
3194
|
+
},
|
|
3195
|
+
option.key
|
|
3196
|
+
)) });
|
|
3206
3197
|
};
|
|
3207
3198
|
|
|
3208
3199
|
// src/components/ui/toaster.tsx
|
|
@@ -3600,7 +3591,7 @@ var DATA_TYPE_NAMES = {
|
|
|
3600
3591
|
var SIMPLE_DATA_TYPES = ["string", "json"];
|
|
3601
3592
|
|
|
3602
3593
|
// src/components/databrowser/components/search/display-search.tsx
|
|
3603
|
-
import { useEffect as
|
|
3594
|
+
import { useEffect as useEffect8, useState as useState6 } from "react";
|
|
3604
3595
|
import { Controller as Controller2, useForm as useForm2 } from "react-hook-form";
|
|
3605
3596
|
|
|
3606
3597
|
// src/components/ui/button.tsx
|
|
@@ -3826,7 +3817,7 @@ var Spinner = ({
|
|
|
3826
3817
|
] }) : children });
|
|
3827
3818
|
};
|
|
3828
3819
|
|
|
3829
|
-
// src/components/databrowser/hooks/use-
|
|
3820
|
+
// src/components/databrowser/hooks/use-create-search-index-schema.tsx
|
|
3830
3821
|
import { useMutation } from "@tanstack/react-query";
|
|
3831
3822
|
|
|
3832
3823
|
// src/components/databrowser/components/search/schema-parser.ts
|
|
@@ -4133,8 +4124,8 @@ function fieldToBuilder(value) {
|
|
|
4133
4124
|
return builder;
|
|
4134
4125
|
}
|
|
4135
4126
|
|
|
4136
|
-
// src/components/databrowser/hooks/use-
|
|
4137
|
-
var
|
|
4127
|
+
// src/components/databrowser/hooks/use-create-search-index-schema.tsx
|
|
4128
|
+
var useCreateSearchIndexSchema = () => {
|
|
4138
4129
|
const { redisNoPipeline: redis } = useRedis();
|
|
4139
4130
|
return useMutation({
|
|
4140
4131
|
meta: { hideToast: true },
|
|
@@ -4148,7 +4139,6 @@ var useUpsertSearchIndexSchema = () => {
|
|
|
4148
4139
|
if (!indexName) throw new Error("Index name is required");
|
|
4149
4140
|
const result = parseSchemaFromEditorValue(editorValue);
|
|
4150
4141
|
if (!result.success) throw new Error(result.error);
|
|
4151
|
-
await redis.search.index({ name: indexName }).drop();
|
|
4152
4142
|
await redis.search.createIndex({
|
|
4153
4143
|
name: indexName,
|
|
4154
4144
|
dataType,
|
|
@@ -5240,17 +5230,247 @@ var DisplayHeader = ({
|
|
|
5240
5230
|
] });
|
|
5241
5231
|
};
|
|
5242
5232
|
|
|
5233
|
+
// src/components/databrowser/components/search/save-schema-modal.tsx
|
|
5234
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
5235
|
+
|
|
5236
|
+
// src/components/ui/dialog.tsx
|
|
5237
|
+
import * as React11 from "react";
|
|
5238
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5239
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5240
|
+
var Dialog = DialogPrimitive.Root;
|
|
5241
|
+
var DialogTrigger = DialogPrimitive.Trigger;
|
|
5242
|
+
var DialogPortal = (props) => /* @__PURE__ */ jsx26(DialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
5243
|
+
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
5244
|
+
var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
5245
|
+
DialogPrimitive.Overlay,
|
|
5246
|
+
{
|
|
5247
|
+
ref,
|
|
5248
|
+
className: cn(
|
|
5249
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
5250
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
5251
|
+
"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",
|
|
5252
|
+
className
|
|
5253
|
+
),
|
|
5254
|
+
...props
|
|
5255
|
+
}
|
|
5256
|
+
));
|
|
5257
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5258
|
+
var DialogContent = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs13(DialogPortal, { children: [
|
|
5259
|
+
/* @__PURE__ */ jsx26(DialogOverlay, {}),
|
|
5260
|
+
/* @__PURE__ */ jsxs13(
|
|
5261
|
+
DialogPrimitive.Content,
|
|
5262
|
+
{
|
|
5263
|
+
ref,
|
|
5264
|
+
className: cn(
|
|
5265
|
+
"antialiased",
|
|
5266
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out ",
|
|
5267
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ",
|
|
5268
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ",
|
|
5269
|
+
"data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",
|
|
5270
|
+
"data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
|
|
5271
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg ",
|
|
5272
|
+
"translate-x-[-50%] translate-y-[-50%] gap-4",
|
|
5273
|
+
"bg-white p-6 shadow-lg duration-200 ",
|
|
5274
|
+
"sm:rounded-lg md:w-full",
|
|
5275
|
+
className
|
|
5276
|
+
),
|
|
5277
|
+
...props,
|
|
5278
|
+
children: [
|
|
5279
|
+
children,
|
|
5280
|
+
/* @__PURE__ */ jsxs13(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-zinc-100 data-[state=open]:text-zinc-500", children: [
|
|
5281
|
+
/* @__PURE__ */ jsx26(
|
|
5282
|
+
"svg",
|
|
5283
|
+
{
|
|
5284
|
+
width: "15",
|
|
5285
|
+
height: "15",
|
|
5286
|
+
viewBox: "0 0 15 15",
|
|
5287
|
+
fill: "none",
|
|
5288
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5289
|
+
className: "h-4 w-4",
|
|
5290
|
+
children: /* @__PURE__ */ jsx26(
|
|
5291
|
+
"path",
|
|
5292
|
+
{
|
|
5293
|
+
d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",
|
|
5294
|
+
fill: "currentColor",
|
|
5295
|
+
fillRule: "evenodd",
|
|
5296
|
+
clipRule: "evenodd"
|
|
5297
|
+
}
|
|
5298
|
+
)
|
|
5299
|
+
}
|
|
5300
|
+
),
|
|
5301
|
+
/* @__PURE__ */ jsx26("span", { className: "sr-only", children: "Close" })
|
|
5302
|
+
] })
|
|
5303
|
+
]
|
|
5304
|
+
}
|
|
5305
|
+
)
|
|
5306
|
+
] }));
|
|
5307
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
5308
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx26("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
5309
|
+
DialogHeader.displayName = "DialogHeader";
|
|
5310
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx26(
|
|
5311
|
+
"div",
|
|
5312
|
+
{
|
|
5313
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
5314
|
+
...props
|
|
5315
|
+
}
|
|
5316
|
+
);
|
|
5317
|
+
DialogFooter.displayName = "DialogFooter";
|
|
5318
|
+
var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
5319
|
+
DialogPrimitive.Title,
|
|
5320
|
+
{
|
|
5321
|
+
ref,
|
|
5322
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
5323
|
+
...props
|
|
5324
|
+
}
|
|
5325
|
+
));
|
|
5326
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5327
|
+
var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
5328
|
+
DialogPrimitive.Description,
|
|
5329
|
+
{
|
|
5330
|
+
ref,
|
|
5331
|
+
className: cn("text-sm text-zinc-500", className),
|
|
5332
|
+
...props
|
|
5333
|
+
}
|
|
5334
|
+
));
|
|
5335
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
5336
|
+
|
|
5337
|
+
// src/components/ui/progress.tsx
|
|
5338
|
+
import * as React12 from "react";
|
|
5339
|
+
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
5340
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
5341
|
+
var Progress = React12.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx27(
|
|
5342
|
+
ProgressPrimitive.Root,
|
|
5343
|
+
{
|
|
5344
|
+
ref,
|
|
5345
|
+
className: cn(
|
|
5346
|
+
"relative h-2 w-full overflow-hidden rounded-full bg-neutral-900/20 dark:bg-neutral-50/20",
|
|
5347
|
+
className
|
|
5348
|
+
),
|
|
5349
|
+
...props,
|
|
5350
|
+
children: /* @__PURE__ */ jsx27(
|
|
5351
|
+
ProgressPrimitive.Indicator,
|
|
5352
|
+
{
|
|
5353
|
+
className: "h-full w-full flex-1 bg-neutral-900 transition-all dark:bg-neutral-50",
|
|
5354
|
+
style: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
5355
|
+
}
|
|
5356
|
+
)
|
|
5357
|
+
}
|
|
5358
|
+
));
|
|
5359
|
+
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
5360
|
+
|
|
5361
|
+
// src/components/databrowser/components/search/save-schema-modal.tsx
|
|
5362
|
+
import { Fragment as Fragment3, jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5363
|
+
var SaveSchemaModal = ({
|
|
5364
|
+
values,
|
|
5365
|
+
onClose
|
|
5366
|
+
}) => {
|
|
5367
|
+
const { redisNoPipeline: redis } = useRedis();
|
|
5368
|
+
const [status, setStatus] = useState5();
|
|
5369
|
+
const [progress, setProgress] = useState5(0);
|
|
5370
|
+
const [error, setError] = useState5();
|
|
5371
|
+
useEffect6(() => {
|
|
5372
|
+
if (!values) return;
|
|
5373
|
+
setProgress(0);
|
|
5374
|
+
setStatus(void 0);
|
|
5375
|
+
setError(void 0);
|
|
5376
|
+
}, [values]);
|
|
5377
|
+
const handleConfirm = async () => {
|
|
5378
|
+
if (!values) return;
|
|
5379
|
+
try {
|
|
5380
|
+
const result = parseSchemaFromEditorValue(values.editorValue);
|
|
5381
|
+
if (!result.success) throw new Error(result.error);
|
|
5382
|
+
setStatus("Saving index...");
|
|
5383
|
+
setProgress(33);
|
|
5384
|
+
await redis.search.index({ name: values.indexName }).drop();
|
|
5385
|
+
try {
|
|
5386
|
+
await redis.search.createIndex({
|
|
5387
|
+
name: values.indexName,
|
|
5388
|
+
dataType: values.dataType,
|
|
5389
|
+
prefix: values.prefixes.split(",").map((p) => p.trim()).filter(Boolean),
|
|
5390
|
+
language: values.language,
|
|
5391
|
+
schema: result.schema
|
|
5392
|
+
});
|
|
5393
|
+
} catch (txError) {
|
|
5394
|
+
const err = txError instanceof Error ? txError : new Error(String(txError));
|
|
5395
|
+
throw new Error(
|
|
5396
|
+
`Your index was deleted, but there was an error when trying to re-create it: ${formatUpstashErrorMessage(err)}`
|
|
5397
|
+
);
|
|
5398
|
+
}
|
|
5399
|
+
setStatus("Waiting for indexing...");
|
|
5400
|
+
setProgress(66);
|
|
5401
|
+
await redis.search.index({ name: values.indexName }).waitIndexing();
|
|
5402
|
+
setStatus("Done");
|
|
5403
|
+
setProgress(100);
|
|
5404
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
5405
|
+
queryClient.invalidateQueries({
|
|
5406
|
+
queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, values.indexName]
|
|
5407
|
+
});
|
|
5408
|
+
queryClient.invalidateQueries({
|
|
5409
|
+
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY]
|
|
5410
|
+
});
|
|
5411
|
+
onClose();
|
|
5412
|
+
} catch (catchedError) {
|
|
5413
|
+
setError(catchedError instanceof Error ? catchedError : new Error(String(catchedError)));
|
|
5414
|
+
setStatus(void 0);
|
|
5415
|
+
}
|
|
5416
|
+
};
|
|
5417
|
+
const isRunning = status !== void 0;
|
|
5418
|
+
return /* @__PURE__ */ jsx28(
|
|
5419
|
+
Dialog,
|
|
5420
|
+
{
|
|
5421
|
+
open: values !== void 0,
|
|
5422
|
+
onOpenChange: (open) => {
|
|
5423
|
+
if (!open && !isRunning) onClose();
|
|
5424
|
+
},
|
|
5425
|
+
children: /* @__PURE__ */ jsxs14(
|
|
5426
|
+
DialogContent,
|
|
5427
|
+
{
|
|
5428
|
+
onInteractOutside: (e) => {
|
|
5429
|
+
if (isRunning) e.preventDefault();
|
|
5430
|
+
},
|
|
5431
|
+
onEscapeKeyDown: (e) => {
|
|
5432
|
+
if (isRunning) e.preventDefault();
|
|
5433
|
+
},
|
|
5434
|
+
children: [
|
|
5435
|
+
/* @__PURE__ */ jsxs14(DialogHeader, { children: [
|
|
5436
|
+
/* @__PURE__ */ jsx28(DialogTitle, { children: "Save Schema Changes" }),
|
|
5437
|
+
!isRunning && !error && /* @__PURE__ */ jsxs14(DialogDescription, { children: [
|
|
5438
|
+
"Saving will drop and recreate the index. This will temporarily make the index unavailable.",
|
|
5439
|
+
/* @__PURE__ */ jsx28("br", {}),
|
|
5440
|
+
/* @__PURE__ */ jsx28("br", {}),
|
|
5441
|
+
"Are you sure you want to continue?"
|
|
5442
|
+
] })
|
|
5443
|
+
] }),
|
|
5444
|
+
isRunning && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2 py-4", children: [
|
|
5445
|
+
/* @__PURE__ */ jsx28("p", { className: "text-sm text-zinc-500", children: status }),
|
|
5446
|
+
/* @__PURE__ */ jsx28(Progress, { value: progress })
|
|
5447
|
+
] }),
|
|
5448
|
+
error && /* @__PURE__ */ jsx28("div", { className: "w-full break-words text-sm text-red-500", children: formatUpstashErrorMessage(error) }),
|
|
5449
|
+
/* @__PURE__ */ jsxs14(DialogFooter, { children: [
|
|
5450
|
+
!isRunning && !error && /* @__PURE__ */ jsxs14(Fragment3, { children: [
|
|
5451
|
+
/* @__PURE__ */ jsx28(Button, { onClick: onClose, children: "Cancel" }),
|
|
5452
|
+
/* @__PURE__ */ jsx28(Button, { variant: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
5453
|
+
] }),
|
|
5454
|
+
error && /* @__PURE__ */ jsx28(Button, { onClick: onClose, children: "Close" })
|
|
5455
|
+
] })
|
|
5456
|
+
]
|
|
5457
|
+
}
|
|
5458
|
+
)
|
|
5459
|
+
}
|
|
5460
|
+
);
|
|
5461
|
+
};
|
|
5462
|
+
|
|
5243
5463
|
// src/components/databrowser/components/search/schema-editor.tsx
|
|
5244
5464
|
import { useMemo as useMemo6 } from "react";
|
|
5245
5465
|
|
|
5246
5466
|
// src/components/common/editor-with-types.tsx
|
|
5247
|
-
import { useEffect as
|
|
5467
|
+
import { useEffect as useEffect7, useRef } from "react";
|
|
5248
5468
|
import { Editor, useMonaco } from "@monaco-editor/react";
|
|
5249
|
-
import { jsx as
|
|
5469
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5250
5470
|
var EditorWithTypes = (props) => {
|
|
5251
|
-
return isTest ? /* @__PURE__ */
|
|
5471
|
+
return isTest ? /* @__PURE__ */ jsx29(TestEditor, { ...props }) : /* @__PURE__ */ jsx29(MonacoEditorWithTypes, { ...props });
|
|
5252
5472
|
};
|
|
5253
|
-
var LoadingSpinner = () => /* @__PURE__ */
|
|
5473
|
+
var LoadingSpinner = () => /* @__PURE__ */ jsx29("div", { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsx29("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600" }) });
|
|
5254
5474
|
var MonacoEditorWithTypes = ({
|
|
5255
5475
|
value,
|
|
5256
5476
|
onChange,
|
|
@@ -5265,7 +5485,7 @@ var MonacoEditorWithTypes = ({
|
|
|
5265
5485
|
const editorRef = useRef(null);
|
|
5266
5486
|
const extraLibRef = useRef(null);
|
|
5267
5487
|
const theme = useTheme();
|
|
5268
|
-
|
|
5488
|
+
useEffect7(() => {
|
|
5269
5489
|
if (!monaco) return;
|
|
5270
5490
|
extraLibRef.current?.dispose();
|
|
5271
5491
|
extraLibRef.current = monaco.languages.typescript.typescriptDefaults.addExtraLib(
|
|
@@ -5280,7 +5500,7 @@ var MonacoEditorWithTypes = ({
|
|
|
5280
5500
|
}
|
|
5281
5501
|
});
|
|
5282
5502
|
}, [monaco, typeDefinitions, filePath]);
|
|
5283
|
-
|
|
5503
|
+
useEffect7(() => {
|
|
5284
5504
|
return () => {
|
|
5285
5505
|
extraLibRef.current?.dispose();
|
|
5286
5506
|
if (monaco) {
|
|
@@ -5298,19 +5518,19 @@ var MonacoEditorWithTypes = ({
|
|
|
5298
5518
|
editorRef.current?.setValue?.(value);
|
|
5299
5519
|
}
|
|
5300
5520
|
};
|
|
5301
|
-
|
|
5521
|
+
useEffect7(() => {
|
|
5302
5522
|
if (!validateValue(value)) onChange(defaultValue);
|
|
5303
5523
|
}, [value, editorRef.current, onChange, validateValue, defaultValue]);
|
|
5304
|
-
return /* @__PURE__ */
|
|
5524
|
+
return /* @__PURE__ */ jsx29(
|
|
5305
5525
|
"div",
|
|
5306
5526
|
{
|
|
5307
5527
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5308
5528
|
style: { height },
|
|
5309
|
-
children: /* @__PURE__ */
|
|
5529
|
+
children: /* @__PURE__ */ jsx29(
|
|
5310
5530
|
Editor,
|
|
5311
5531
|
{
|
|
5312
5532
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
5313
|
-
loading: /* @__PURE__ */
|
|
5533
|
+
loading: /* @__PURE__ */ jsx29(LoadingSpinner, {}),
|
|
5314
5534
|
beforeMount: handleBeforeMount,
|
|
5315
5535
|
onMount: (editor) => {
|
|
5316
5536
|
editorRef.current = editor;
|
|
@@ -5401,12 +5621,12 @@ var handleBeforeMount = (monaco) => {
|
|
|
5401
5621
|
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
5402
5622
|
};
|
|
5403
5623
|
var TestEditor = ({ value, onChange, height, testLabel }) => {
|
|
5404
|
-
return /* @__PURE__ */
|
|
5624
|
+
return /* @__PURE__ */ jsx29(
|
|
5405
5625
|
"div",
|
|
5406
5626
|
{
|
|
5407
5627
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5408
5628
|
style: { height },
|
|
5409
|
-
children: /* @__PURE__ */
|
|
5629
|
+
children: /* @__PURE__ */ jsx29(
|
|
5410
5630
|
"textarea",
|
|
5411
5631
|
{
|
|
5412
5632
|
"aria-label": testLabel,
|
|
@@ -5574,7 +5794,7 @@ type Schema = NestedIndexSchema | FlatIndexSchema;
|
|
|
5574
5794
|
};
|
|
5575
5795
|
|
|
5576
5796
|
// src/components/databrowser/components/search/schema-editor.tsx
|
|
5577
|
-
import { jsx as
|
|
5797
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
5578
5798
|
var SCHEMA_PREFIX = "const schema: Schema = s.object({";
|
|
5579
5799
|
var SCHEMA_SUFFIX = "})";
|
|
5580
5800
|
var SCHEMA_DEFAULT = "const schema: Schema = s.object({\n \n})";
|
|
@@ -5583,7 +5803,7 @@ var isSchemaStringValid = (value) => {
|
|
|
5583
5803
|
};
|
|
5584
5804
|
var SchemaEditor = ({ value, onChange, height }) => {
|
|
5585
5805
|
const typeDefinitions = useMemo6(() => generateSchemaTypeDefinitions(), []);
|
|
5586
|
-
return /* @__PURE__ */
|
|
5806
|
+
return /* @__PURE__ */ jsx30(
|
|
5587
5807
|
EditorWithTypes,
|
|
5588
5808
|
{
|
|
5589
5809
|
value,
|
|
@@ -5600,7 +5820,7 @@ var SchemaEditor = ({ value, onChange, height }) => {
|
|
|
5600
5820
|
};
|
|
5601
5821
|
|
|
5602
5822
|
// src/components/databrowser/components/search/display-search.tsx
|
|
5603
|
-
import { jsx as
|
|
5823
|
+
import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5604
5824
|
var SearchDisplay = ({
|
|
5605
5825
|
indexName,
|
|
5606
5826
|
isCreateModal,
|
|
@@ -5625,11 +5845,12 @@ var SearchDisplay = ({
|
|
|
5625
5845
|
});
|
|
5626
5846
|
const currentIndexName = watch("indexName");
|
|
5627
5847
|
const effectiveIndexName = isCreateModal ? currentIndexName : indexName ?? "";
|
|
5848
|
+
const [pendingFormValues, setPendingFormValues] = useState6();
|
|
5628
5849
|
const { data, isLoading } = useFetchSearchIndex(indexName, {
|
|
5629
5850
|
enabled: !isCreateModal
|
|
5630
5851
|
});
|
|
5631
|
-
const
|
|
5632
|
-
|
|
5852
|
+
const createSchema = useCreateSearchIndexSchema();
|
|
5853
|
+
useEffect8(() => {
|
|
5633
5854
|
if (!data) return;
|
|
5634
5855
|
reset({
|
|
5635
5856
|
indexName: indexName ?? "",
|
|
@@ -5640,29 +5861,33 @@ var SearchDisplay = ({
|
|
|
5640
5861
|
});
|
|
5641
5862
|
}, [data, reset, indexName]);
|
|
5642
5863
|
const onSubmit = (values) => {
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5864
|
+
if (isCreateModal) {
|
|
5865
|
+
createSchema.mutate(
|
|
5866
|
+
{
|
|
5867
|
+
...values,
|
|
5868
|
+
indexName: values.indexName
|
|
5869
|
+
},
|
|
5870
|
+
{
|
|
5871
|
+
onSuccess: () => {
|
|
5872
|
+
reset();
|
|
5873
|
+
if (onClose) onClose();
|
|
5874
|
+
}
|
|
5652
5875
|
}
|
|
5653
|
-
|
|
5654
|
-
|
|
5876
|
+
);
|
|
5877
|
+
} else {
|
|
5878
|
+
setPendingFormValues({ ...values, indexName });
|
|
5879
|
+
}
|
|
5655
5880
|
};
|
|
5656
5881
|
const handleCancel = () => {
|
|
5657
|
-
|
|
5882
|
+
createSchema.reset();
|
|
5658
5883
|
reset();
|
|
5659
5884
|
};
|
|
5660
|
-
return /* @__PURE__ */
|
|
5661
|
-
!isCreateModal && /* @__PURE__ */
|
|
5662
|
-
/* @__PURE__ */
|
|
5663
|
-
isCreateModal && /* @__PURE__ */
|
|
5664
|
-
/* @__PURE__ */
|
|
5665
|
-
/* @__PURE__ */
|
|
5885
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex h-full w-full min-w-0 flex-col gap-2", children: [
|
|
5886
|
+
!isCreateModal && /* @__PURE__ */ jsx31(DisplayHeader, { dataKey: effectiveIndexName, type: "search", hideTypeTag: isEditModal }),
|
|
5887
|
+
/* @__PURE__ */ jsx31("div", { className: "flex h-full min-w-0 grow flex-col gap-2 rounded-md", children: !isCreateModal && isLoading ? /* @__PURE__ */ jsx31(Spinner, { isLoadingText: "", isLoading: true }) : !isCreateModal && (data === null || data === void 0) ? /* @__PURE__ */ jsx31("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx31("span", { className: "text-zinc-500", children: "No data found" }) }) : /* @__PURE__ */ jsxs15("div", { className: "flex h-full w-full flex-col gap-3", children: [
|
|
5888
|
+
isCreateModal && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1.5", children: [
|
|
5889
|
+
/* @__PURE__ */ jsx31(Label, { htmlFor: "index-name", children: "Key" }),
|
|
5890
|
+
/* @__PURE__ */ jsx31(
|
|
5666
5891
|
Input,
|
|
5667
5892
|
{
|
|
5668
5893
|
id: "index-name",
|
|
@@ -5670,42 +5895,42 @@ var SearchDisplay = ({
|
|
|
5670
5895
|
placeholder: "idx_users"
|
|
5671
5896
|
}
|
|
5672
5897
|
),
|
|
5673
|
-
errors.indexName && /* @__PURE__ */
|
|
5898
|
+
errors.indexName && /* @__PURE__ */ jsx31("p", { className: "text-xs text-red-500", children: errors.indexName.message })
|
|
5674
5899
|
] }),
|
|
5675
|
-
/* @__PURE__ */
|
|
5676
|
-
/* @__PURE__ */
|
|
5677
|
-
/* @__PURE__ */
|
|
5678
|
-
/* @__PURE__ */
|
|
5679
|
-
/* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5900
|
+
/* @__PURE__ */ jsxs15("div", { className: "rounded-md border border-zinc-300 bg-white p-3", children: [
|
|
5901
|
+
/* @__PURE__ */ jsx31("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx31("h3", { className: "text-sm font-medium text-zinc-700", children: "Config" }) }),
|
|
5902
|
+
/* @__PURE__ */ jsxs15("div", { className: "mt-2 grid grid-cols-4 gap-4 text-sm", children: [
|
|
5903
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
5904
|
+
/* @__PURE__ */ jsx31("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Data Type" }),
|
|
5905
|
+
/* @__PURE__ */ jsx31(
|
|
5681
5906
|
Controller2,
|
|
5682
5907
|
{
|
|
5683
5908
|
name: "dataType",
|
|
5684
5909
|
control,
|
|
5685
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5686
|
-
/* @__PURE__ */
|
|
5687
|
-
/* @__PURE__ */
|
|
5910
|
+
render: ({ field }) => /* @__PURE__ */ jsxs15(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
5911
|
+
/* @__PURE__ */ jsx31(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx31(SelectValue, { placeholder: "Select type" }) }),
|
|
5912
|
+
/* @__PURE__ */ jsx31(SelectContent, { children: ["string", "hash", "json"].map((type) => /* @__PURE__ */ jsx31(SelectItem, { value: type, children: /* @__PURE__ */ jsx31(TypeTag, { variant: type, type: "badge" }) }, type)) })
|
|
5688
5913
|
] })
|
|
5689
5914
|
}
|
|
5690
5915
|
)
|
|
5691
5916
|
] }),
|
|
5692
|
-
/* @__PURE__ */
|
|
5693
|
-
/* @__PURE__ */
|
|
5694
|
-
/* @__PURE__ */
|
|
5917
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
5918
|
+
/* @__PURE__ */ jsx31("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Language" }),
|
|
5919
|
+
/* @__PURE__ */ jsx31(
|
|
5695
5920
|
Controller2,
|
|
5696
5921
|
{
|
|
5697
5922
|
name: "language",
|
|
5698
5923
|
control,
|
|
5699
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5700
|
-
/* @__PURE__ */
|
|
5701
|
-
/* @__PURE__ */
|
|
5924
|
+
render: ({ field }) => /* @__PURE__ */ jsxs15(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
5925
|
+
/* @__PURE__ */ jsx31(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx31(SelectValue, { placeholder: "Select language" }) }),
|
|
5926
|
+
/* @__PURE__ */ jsx31(SelectContent, { children: LANGUAGES.map((lang) => /* @__PURE__ */ jsx31(SelectItem, { value: lang, children: lang }, lang)) })
|
|
5702
5927
|
] })
|
|
5703
5928
|
}
|
|
5704
5929
|
)
|
|
5705
5930
|
] }),
|
|
5706
|
-
/* @__PURE__ */
|
|
5707
|
-
/* @__PURE__ */
|
|
5708
|
-
/* @__PURE__ */
|
|
5931
|
+
/* @__PURE__ */ jsxs15("div", { className: "col-span-2", children: [
|
|
5932
|
+
/* @__PURE__ */ jsx31("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Prefixes" }),
|
|
5933
|
+
/* @__PURE__ */ jsx31(
|
|
5709
5934
|
Input,
|
|
5710
5935
|
{
|
|
5711
5936
|
...register("prefixes", { required: "Please enter at least one prefix" }),
|
|
@@ -5713,18 +5938,18 @@ var SearchDisplay = ({
|
|
|
5713
5938
|
placeholder: "user:, post:"
|
|
5714
5939
|
}
|
|
5715
5940
|
),
|
|
5716
|
-
errors.prefixes && /* @__PURE__ */
|
|
5941
|
+
errors.prefixes && /* @__PURE__ */ jsx31("p", { className: "mt-1 text-xs text-red-500", children: errors.prefixes.message })
|
|
5717
5942
|
] })
|
|
5718
5943
|
] })
|
|
5719
5944
|
] }),
|
|
5720
|
-
/* @__PURE__ */
|
|
5721
|
-
/* @__PURE__ */
|
|
5722
|
-
/* @__PURE__ */
|
|
5945
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex min-h-0 flex-1 flex-col rounded-md border border-zinc-300 bg-white", children: [
|
|
5946
|
+
/* @__PURE__ */ jsx31("div", { className: "flex items-center justify-between border-b border-zinc-200 px-3 py-2", children: /* @__PURE__ */ jsx31("h3", { className: "text-sm font-medium text-zinc-700", children: "Schema" }) }),
|
|
5947
|
+
/* @__PURE__ */ jsx31("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx31("div", { className: "h-full px-1", children: /* @__PURE__ */ jsx31(
|
|
5723
5948
|
Controller2,
|
|
5724
5949
|
{
|
|
5725
5950
|
name: "editorValue",
|
|
5726
5951
|
control,
|
|
5727
|
-
render: ({ field }) => /* @__PURE__ */
|
|
5952
|
+
render: ({ field }) => /* @__PURE__ */ jsx31(
|
|
5728
5953
|
SchemaEditor,
|
|
5729
5954
|
{
|
|
5730
5955
|
value: field.value,
|
|
@@ -5735,9 +5960,9 @@ var SearchDisplay = ({
|
|
|
5735
5960
|
}
|
|
5736
5961
|
) }) })
|
|
5737
5962
|
] }),
|
|
5738
|
-
|
|
5739
|
-
/* @__PURE__ */
|
|
5740
|
-
(isDirty || isCreateModal || isEditModal) && /* @__PURE__ */
|
|
5963
|
+
isCreateModal && createSchema.error && /* @__PURE__ */ jsx31("div", { className: "w-full break-words text-xs text-red-500", children: createSchema.error.message.startsWith("ERR syntax error") ? "Invalid schema" : formatUpstashErrorMessage(createSchema.error) }),
|
|
5964
|
+
/* @__PURE__ */ jsx31("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs15("div", { className: "ml-auto flex gap-2", children: [
|
|
5965
|
+
(isDirty || isCreateModal || isEditModal) && /* @__PURE__ */ jsx31(
|
|
5741
5966
|
Button,
|
|
5742
5967
|
{
|
|
5743
5968
|
onClick: () => {
|
|
@@ -5750,8 +5975,19 @@ var SearchDisplay = ({
|
|
|
5750
5975
|
children: "Cancel"
|
|
5751
5976
|
}
|
|
5752
5977
|
),
|
|
5753
|
-
/* @__PURE__ */
|
|
5754
|
-
] }) })
|
|
5978
|
+
/* @__PURE__ */ jsx31(Button, { variant: "primary", onClick: handleSubmit(onSubmit), disabled: !isDirty, children: /* @__PURE__ */ jsx31(Spinner, { isLoading: createSchema.isPending, isLoadingText: "Saving", children: isCreateModal ? "Create" : "Save..." }) })
|
|
5979
|
+
] }) }),
|
|
5980
|
+
/* @__PURE__ */ jsx31(
|
|
5981
|
+
SaveSchemaModal,
|
|
5982
|
+
{
|
|
5983
|
+
values: pendingFormValues,
|
|
5984
|
+
onClose: () => {
|
|
5985
|
+
setPendingFormValues(void 0);
|
|
5986
|
+
reset();
|
|
5987
|
+
if (isEditModal && onClose) onClose();
|
|
5988
|
+
}
|
|
5989
|
+
}
|
|
5990
|
+
)
|
|
5755
5991
|
] }) })
|
|
5756
5992
|
] });
|
|
5757
5993
|
};
|
|
@@ -5781,22 +6017,30 @@ import { useMemo as useMemo8 } from "react";
|
|
|
5781
6017
|
import { IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
5782
6018
|
|
|
5783
6019
|
// src/components/common/infinite-scroll.tsx
|
|
5784
|
-
import { useEffect as
|
|
6020
|
+
import { useEffect as useEffect9, useRef as useRef2 } from "react";
|
|
5785
6021
|
import { IconLoader2 } from "@tabler/icons-react";
|
|
5786
6022
|
|
|
5787
6023
|
// src/components/ui/scroll-area.tsx
|
|
5788
|
-
import * as
|
|
6024
|
+
import * as React13 from "react";
|
|
5789
6025
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
5790
|
-
import { jsx as
|
|
5791
|
-
var ScrollArea =
|
|
5792
|
-
({
|
|
6026
|
+
import { jsx as jsx32, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6027
|
+
var ScrollArea = React13.forwardRef(
|
|
6028
|
+
({
|
|
6029
|
+
className,
|
|
6030
|
+
scrollBarClassName,
|
|
6031
|
+
scrollBarForceMount,
|
|
6032
|
+
children,
|
|
6033
|
+
onScroll,
|
|
6034
|
+
disableRoundedInherit = false,
|
|
6035
|
+
...props
|
|
6036
|
+
}, ref) => /* @__PURE__ */ jsxs16(
|
|
5793
6037
|
ScrollAreaPrimitive.Root,
|
|
5794
6038
|
{
|
|
5795
6039
|
ref,
|
|
5796
6040
|
className: cn("relative overflow-hidden", className),
|
|
5797
6041
|
...props,
|
|
5798
6042
|
children: [
|
|
5799
|
-
/* @__PURE__ */
|
|
6043
|
+
/* @__PURE__ */ jsx32(
|
|
5800
6044
|
ScrollAreaPrimitive.Viewport,
|
|
5801
6045
|
{
|
|
5802
6046
|
onScroll,
|
|
@@ -5807,24 +6051,24 @@ var ScrollArea = React11.forwardRef(
|
|
|
5807
6051
|
children
|
|
5808
6052
|
}
|
|
5809
6053
|
),
|
|
5810
|
-
/* @__PURE__ */
|
|
5811
|
-
/* @__PURE__ */
|
|
6054
|
+
/* @__PURE__ */ jsx32(ScrollBar, { className: scrollBarClassName, forceMount: scrollBarForceMount }),
|
|
6055
|
+
/* @__PURE__ */ jsx32(ScrollAreaPrimitive.Corner, {})
|
|
5812
6056
|
]
|
|
5813
6057
|
}
|
|
5814
6058
|
)
|
|
5815
6059
|
);
|
|
5816
6060
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
5817
|
-
var ScrollBar =
|
|
6061
|
+
var ScrollBar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
|
|
5818
6062
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
5819
6063
|
{
|
|
5820
6064
|
ref,
|
|
5821
6065
|
orientation: "vertical",
|
|
5822
6066
|
className: cn("mr-1 flex h-full w-2 touch-none select-none transition-colors", className),
|
|
5823
6067
|
...props,
|
|
5824
|
-
children: /* @__PURE__ */
|
|
6068
|
+
children: /* @__PURE__ */ jsx32(
|
|
5825
6069
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
5826
6070
|
{
|
|
5827
|
-
className: cn("relative flex-1 rounded-full bg-zinc-
|
|
6071
|
+
className: cn("relative flex-1 rounded-full bg-zinc-400/70")
|
|
5828
6072
|
}
|
|
5829
6073
|
)
|
|
5830
6074
|
}
|
|
@@ -5832,7 +6076,7 @@ var ScrollBar = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
5832
6076
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
5833
6077
|
|
|
5834
6078
|
// src/components/common/infinite-scroll.tsx
|
|
5835
|
-
import { jsx as
|
|
6079
|
+
import { jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5836
6080
|
var InfiniteScroll = ({
|
|
5837
6081
|
query,
|
|
5838
6082
|
children,
|
|
@@ -5859,12 +6103,12 @@ var InfiniteScroll = ({
|
|
|
5859
6103
|
query.fetchNextPage();
|
|
5860
6104
|
}
|
|
5861
6105
|
};
|
|
5862
|
-
|
|
6106
|
+
useEffect9(() => {
|
|
5863
6107
|
if (!active) return;
|
|
5864
6108
|
const timer = setTimeout(checkAndFetchMore, 100);
|
|
5865
6109
|
return () => clearTimeout(timer);
|
|
5866
6110
|
}, [active, query.data]);
|
|
5867
|
-
return /* @__PURE__ */
|
|
6111
|
+
return /* @__PURE__ */ jsx33(
|
|
5868
6112
|
ScrollArea,
|
|
5869
6113
|
{
|
|
5870
6114
|
type: "always",
|
|
@@ -5872,27 +6116,27 @@ var InfiniteScroll = ({
|
|
|
5872
6116
|
...props,
|
|
5873
6117
|
className: cn("block h-full w-full overflow-visible transition-all", props.className),
|
|
5874
6118
|
ref: scrollRef,
|
|
5875
|
-
children: /* @__PURE__ */
|
|
6119
|
+
children: /* @__PURE__ */ jsxs17("div", { ref: contentRef, children: [
|
|
5876
6120
|
children,
|
|
5877
|
-
/* @__PURE__ */
|
|
6121
|
+
/* @__PURE__ */ jsx33("div", { className: "flex h-[100px] justify-center py-2 text-zinc-300", children: query.isFetching && /* @__PURE__ */ jsx33(IconLoader2, { className: "animate-spin", size: 16 }) })
|
|
5878
6122
|
] })
|
|
5879
6123
|
}
|
|
5880
6124
|
);
|
|
5881
6125
|
};
|
|
5882
6126
|
|
|
5883
6127
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
5884
|
-
import { useState as
|
|
6128
|
+
import { useState as useState7 } from "react";
|
|
5885
6129
|
import { ContextMenuSeparator as ContextMenuSeparator2 } from "@radix-ui/react-context-menu";
|
|
5886
6130
|
import { IconCopy, IconExternalLink, IconTrash } from "@tabler/icons-react";
|
|
5887
6131
|
|
|
5888
6132
|
// src/components/ui/context-menu.tsx
|
|
5889
|
-
import * as
|
|
6133
|
+
import * as React14 from "react";
|
|
5890
6134
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
5891
6135
|
import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight2, IconCircleFilled as IconCircleFilled2 } from "@tabler/icons-react";
|
|
5892
|
-
import { jsx as
|
|
6136
|
+
import { jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5893
6137
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
5894
6138
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
5895
|
-
var ContextMenuSubTrigger =
|
|
6139
|
+
var ContextMenuSubTrigger = React14.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs18(
|
|
5896
6140
|
ContextMenuPrimitive.SubTrigger,
|
|
5897
6141
|
{
|
|
5898
6142
|
ref,
|
|
@@ -5904,12 +6148,12 @@ var ContextMenuSubTrigger = React12.forwardRef(({ className, inset, children, ..
|
|
|
5904
6148
|
...props,
|
|
5905
6149
|
children: [
|
|
5906
6150
|
children,
|
|
5907
|
-
/* @__PURE__ */
|
|
6151
|
+
/* @__PURE__ */ jsx34(IconChevronRight2, { className: "ml-auto h-4 w-4" })
|
|
5908
6152
|
]
|
|
5909
6153
|
}
|
|
5910
6154
|
));
|
|
5911
6155
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
5912
|
-
var ContextMenuSubContent =
|
|
6156
|
+
var ContextMenuSubContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5913
6157
|
ContextMenuPrimitive.SubContent,
|
|
5914
6158
|
{
|
|
5915
6159
|
ref,
|
|
@@ -5921,7 +6165,7 @@ var ContextMenuSubContent = React12.forwardRef(({ className, ...props }, ref) =>
|
|
|
5921
6165
|
}
|
|
5922
6166
|
));
|
|
5923
6167
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
5924
|
-
var ContextMenuContent =
|
|
6168
|
+
var ContextMenuContent = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(ContextMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx34(
|
|
5925
6169
|
ContextMenuPrimitive.Content,
|
|
5926
6170
|
{
|
|
5927
6171
|
ref,
|
|
@@ -5933,7 +6177,7 @@ var ContextMenuContent = React12.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5933
6177
|
}
|
|
5934
6178
|
) }));
|
|
5935
6179
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
5936
|
-
var ContextMenuItem =
|
|
6180
|
+
var ContextMenuItem = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5937
6181
|
ContextMenuPrimitive.Item,
|
|
5938
6182
|
{
|
|
5939
6183
|
ref,
|
|
@@ -5946,7 +6190,7 @@ var ContextMenuItem = React12.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
5946
6190
|
}
|
|
5947
6191
|
));
|
|
5948
6192
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
5949
|
-
var ContextMenuCheckboxItem =
|
|
6193
|
+
var ContextMenuCheckboxItem = React14.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs18(
|
|
5950
6194
|
ContextMenuPrimitive.CheckboxItem,
|
|
5951
6195
|
{
|
|
5952
6196
|
ref,
|
|
@@ -5957,13 +6201,13 @@ var ContextMenuCheckboxItem = React12.forwardRef(({ className, children, checked
|
|
|
5957
6201
|
checked,
|
|
5958
6202
|
...props,
|
|
5959
6203
|
children: [
|
|
5960
|
-
/* @__PURE__ */
|
|
6204
|
+
/* @__PURE__ */ jsx34("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx34(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx34(IconCheck2, { className: "h-4 w-4" }) }) }),
|
|
5961
6205
|
children
|
|
5962
6206
|
]
|
|
5963
6207
|
}
|
|
5964
6208
|
));
|
|
5965
6209
|
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
5966
|
-
var ContextMenuRadioItem =
|
|
6210
|
+
var ContextMenuRadioItem = React14.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs18(
|
|
5967
6211
|
ContextMenuPrimitive.RadioItem,
|
|
5968
6212
|
{
|
|
5969
6213
|
ref,
|
|
@@ -5973,13 +6217,13 @@ var ContextMenuRadioItem = React12.forwardRef(({ className, children, ...props }
|
|
|
5973
6217
|
),
|
|
5974
6218
|
...props,
|
|
5975
6219
|
children: [
|
|
5976
|
-
/* @__PURE__ */
|
|
6220
|
+
/* @__PURE__ */ jsx34("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx34(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx34(IconCircleFilled2, { className: "h-4 w-4" }) }) }),
|
|
5977
6221
|
children
|
|
5978
6222
|
]
|
|
5979
6223
|
}
|
|
5980
6224
|
));
|
|
5981
6225
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
5982
|
-
var ContextMenuLabel =
|
|
6226
|
+
var ContextMenuLabel = React14.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5983
6227
|
ContextMenuPrimitive.Label,
|
|
5984
6228
|
{
|
|
5985
6229
|
ref,
|
|
@@ -5988,7 +6232,7 @@ var ContextMenuLabel = React12.forwardRef(({ className, inset, ...props }, ref)
|
|
|
5988
6232
|
}
|
|
5989
6233
|
));
|
|
5990
6234
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
5991
|
-
var ContextMenuSeparator =
|
|
6235
|
+
var ContextMenuSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5992
6236
|
ContextMenuPrimitive.Separator,
|
|
5993
6237
|
{
|
|
5994
6238
|
ref,
|
|
@@ -5998,23 +6242,23 @@ var ContextMenuSeparator = React12.forwardRef(({ className, ...props }, ref) =>
|
|
|
5998
6242
|
));
|
|
5999
6243
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
6000
6244
|
var ContextMenuShortcut = ({ className, ...props }) => {
|
|
6001
|
-
return /* @__PURE__ */
|
|
6245
|
+
return /* @__PURE__ */ jsx34("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
6002
6246
|
};
|
|
6003
6247
|
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
6004
6248
|
|
|
6005
6249
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
6006
|
-
import { Fragment as
|
|
6250
|
+
import { Fragment as Fragment4, jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6007
6251
|
var ItemContextMenu = ({
|
|
6008
6252
|
children,
|
|
6009
6253
|
dataKey,
|
|
6010
6254
|
type
|
|
6011
6255
|
}) => {
|
|
6012
6256
|
const { mutate: editItem } = useEditListItem();
|
|
6013
|
-
const [isAlertOpen, setAlertOpen] =
|
|
6014
|
-
const [data, setData] =
|
|
6257
|
+
const [isAlertOpen, setAlertOpen] = useState7(false);
|
|
6258
|
+
const [data, setData] = useState7();
|
|
6015
6259
|
const { addTab, setSelectedKey, selectTab, setSelectedListItem } = useDatabrowserStore();
|
|
6016
|
-
return /* @__PURE__ */
|
|
6017
|
-
/* @__PURE__ */
|
|
6260
|
+
return /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
6261
|
+
/* @__PURE__ */ jsx35(
|
|
6018
6262
|
DeleteKeyModal,
|
|
6019
6263
|
{
|
|
6020
6264
|
deletionType: "item",
|
|
@@ -6035,8 +6279,8 @@ var ItemContextMenu = ({
|
|
|
6035
6279
|
}
|
|
6036
6280
|
}
|
|
6037
6281
|
),
|
|
6038
|
-
/* @__PURE__ */
|
|
6039
|
-
/* @__PURE__ */
|
|
6282
|
+
/* @__PURE__ */ jsxs19(ContextMenu, { modal: false, children: [
|
|
6283
|
+
/* @__PURE__ */ jsx35(
|
|
6040
6284
|
ContextMenuTrigger,
|
|
6041
6285
|
{
|
|
6042
6286
|
asChild: true,
|
|
@@ -6055,8 +6299,8 @@ var ItemContextMenu = ({
|
|
|
6055
6299
|
children
|
|
6056
6300
|
}
|
|
6057
6301
|
),
|
|
6058
|
-
/* @__PURE__ */
|
|
6059
|
-
/* @__PURE__ */
|
|
6302
|
+
/* @__PURE__ */ jsxs19(ContextMenuContent, { children: [
|
|
6303
|
+
/* @__PURE__ */ jsxs19(
|
|
6060
6304
|
ContextMenuItem,
|
|
6061
6305
|
{
|
|
6062
6306
|
onClick: () => {
|
|
@@ -6068,12 +6312,12 @@ var ItemContextMenu = ({
|
|
|
6068
6312
|
},
|
|
6069
6313
|
className: "gap-2",
|
|
6070
6314
|
children: [
|
|
6071
|
-
/* @__PURE__ */
|
|
6315
|
+
/* @__PURE__ */ jsx35(IconCopy, { size: 16 }),
|
|
6072
6316
|
"Copy key"
|
|
6073
6317
|
]
|
|
6074
6318
|
}
|
|
6075
6319
|
),
|
|
6076
|
-
data?.value && /* @__PURE__ */
|
|
6320
|
+
data?.value && /* @__PURE__ */ jsxs19(
|
|
6077
6321
|
ContextMenuItem,
|
|
6078
6322
|
{
|
|
6079
6323
|
onClick: () => {
|
|
@@ -6084,12 +6328,12 @@ var ItemContextMenu = ({
|
|
|
6084
6328
|
},
|
|
6085
6329
|
className: "gap-2",
|
|
6086
6330
|
children: [
|
|
6087
|
-
/* @__PURE__ */
|
|
6331
|
+
/* @__PURE__ */ jsx35(IconCopy, { size: 16 }),
|
|
6088
6332
|
"Copy value"
|
|
6089
6333
|
]
|
|
6090
6334
|
}
|
|
6091
6335
|
),
|
|
6092
|
-
/* @__PURE__ */
|
|
6336
|
+
/* @__PURE__ */ jsxs19(
|
|
6093
6337
|
ContextMenuItem,
|
|
6094
6338
|
{
|
|
6095
6339
|
onClick: () => {
|
|
@@ -6103,20 +6347,20 @@ var ItemContextMenu = ({
|
|
|
6103
6347
|
},
|
|
6104
6348
|
className: "gap-2",
|
|
6105
6349
|
children: [
|
|
6106
|
-
/* @__PURE__ */
|
|
6350
|
+
/* @__PURE__ */ jsx35(IconExternalLink, { size: 16 }),
|
|
6107
6351
|
"Open in new tab"
|
|
6108
6352
|
]
|
|
6109
6353
|
}
|
|
6110
6354
|
),
|
|
6111
|
-
/* @__PURE__ */
|
|
6112
|
-
/* @__PURE__ */
|
|
6355
|
+
/* @__PURE__ */ jsx35(ContextMenuSeparator2, {}),
|
|
6356
|
+
/* @__PURE__ */ jsxs19(
|
|
6113
6357
|
ContextMenuItem,
|
|
6114
6358
|
{
|
|
6115
6359
|
disabled: type === "stream",
|
|
6116
6360
|
onClick: () => setAlertOpen(true),
|
|
6117
6361
|
className: "gap-2",
|
|
6118
6362
|
children: [
|
|
6119
|
-
/* @__PURE__ */
|
|
6363
|
+
/* @__PURE__ */ jsx35(IconTrash, { size: 16 }),
|
|
6120
6364
|
"Delete item"
|
|
6121
6365
|
]
|
|
6122
6366
|
}
|
|
@@ -6185,12 +6429,12 @@ var useSetHashTTL = () => {
|
|
|
6185
6429
|
};
|
|
6186
6430
|
|
|
6187
6431
|
// src/components/databrowser/components/display/hash/hash-field-ttl-badge.tsx
|
|
6188
|
-
import { jsx as
|
|
6432
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
6189
6433
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
6190
6434
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
6191
6435
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
6192
6436
|
const expireAt = data?.[field];
|
|
6193
|
-
return /* @__PURE__ */
|
|
6437
|
+
return /* @__PURE__ */ jsx36(
|
|
6194
6438
|
TTLBadge,
|
|
6195
6439
|
{
|
|
6196
6440
|
label: "Field TTL:",
|
|
@@ -6202,38 +6446,38 @@ var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
|
6202
6446
|
};
|
|
6203
6447
|
|
|
6204
6448
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
6205
|
-
import { useEffect as
|
|
6449
|
+
import { useEffect as useEffect11, useState as useState9 } from "react";
|
|
6206
6450
|
import { useController } from "react-hook-form";
|
|
6207
6451
|
|
|
6208
6452
|
// src/components/databrowser/components/display/input/content-type-select.tsx
|
|
6209
6453
|
import { useMemo as useMemo7 } from "react";
|
|
6210
|
-
import { jsx as
|
|
6454
|
+
import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6211
6455
|
var ContentTypeSelect = ({
|
|
6212
6456
|
value,
|
|
6213
6457
|
onChange,
|
|
6214
6458
|
data
|
|
6215
6459
|
}) => {
|
|
6216
6460
|
const isValidJSON = useMemo7(() => checkIsValidJSON(data), [data]);
|
|
6217
|
-
return /* @__PURE__ */
|
|
6218
|
-
/* @__PURE__ */
|
|
6219
|
-
/* @__PURE__ */
|
|
6220
|
-
/* @__PURE__ */
|
|
6221
|
-
/* @__PURE__ */
|
|
6461
|
+
return /* @__PURE__ */ jsxs20(Select, { value, onValueChange: onChange, children: [
|
|
6462
|
+
/* @__PURE__ */ jsx37(SelectTrigger, { className: "h-6 w-auto border-none bg-transparent pl-0 pr-6 text-xs text-zinc-500", children: /* @__PURE__ */ jsx37(SelectValue, { placeholder: "Text" }) }),
|
|
6463
|
+
/* @__PURE__ */ jsx37(SelectContent, { children: /* @__PURE__ */ jsxs20(SelectGroup, { children: [
|
|
6464
|
+
/* @__PURE__ */ jsx37(SelectItem, { value: "Text", children: "Text" }),
|
|
6465
|
+
/* @__PURE__ */ jsx37(SelectItem, { disabled: !isValidJSON, value: "JSON", children: "JSON" })
|
|
6222
6466
|
] }) })
|
|
6223
6467
|
] });
|
|
6224
6468
|
};
|
|
6225
6469
|
|
|
6226
6470
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
6227
|
-
import { useEffect as
|
|
6471
|
+
import { useEffect as useEffect10, useRef as useRef3 } from "react";
|
|
6228
6472
|
import { Editor as Editor2, useMonaco as useMonaco2 } from "@monaco-editor/react";
|
|
6229
6473
|
|
|
6230
6474
|
// src/components/common/copy-button.tsx
|
|
6231
|
-
import { useState as
|
|
6475
|
+
import { useState as useState8 } from "react";
|
|
6232
6476
|
import { IconCheck as IconCheck3, IconCopy as IconCopy2 } from "@tabler/icons-react";
|
|
6233
|
-
import { jsx as
|
|
6477
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
6234
6478
|
function CopyButton({ value, ...props }) {
|
|
6235
|
-
const [copied, setCopied] =
|
|
6236
|
-
return /* @__PURE__ */
|
|
6479
|
+
const [copied, setCopied] = useState8(false);
|
|
6480
|
+
return /* @__PURE__ */ jsx38(
|
|
6237
6481
|
Button,
|
|
6238
6482
|
{
|
|
6239
6483
|
onClick: (e) => {
|
|
@@ -6250,7 +6494,7 @@ function CopyButton({ value, ...props }) {
|
|
|
6250
6494
|
variant: "secondary",
|
|
6251
6495
|
size: "icon-sm",
|
|
6252
6496
|
...props,
|
|
6253
|
-
children: copied ? /* @__PURE__ */
|
|
6497
|
+
children: copied ? /* @__PURE__ */ jsx38(IconCheck3, { className: "size-4 text-green-500" }) : /* @__PURE__ */ jsx38(IconCopy2, { className: "size-4 text-zinc-500" })
|
|
6254
6498
|
}
|
|
6255
6499
|
);
|
|
6256
6500
|
}
|
|
@@ -6263,12 +6507,12 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
6263
6507
|
};
|
|
6264
6508
|
|
|
6265
6509
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
6266
|
-
import { jsx as
|
|
6510
|
+
import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6267
6511
|
var CustomEditor = (props) => {
|
|
6268
6512
|
if (isTest) {
|
|
6269
|
-
return /* @__PURE__ */
|
|
6513
|
+
return /* @__PURE__ */ jsx39(TestEditor2, { ...props });
|
|
6270
6514
|
}
|
|
6271
|
-
return /* @__PURE__ */
|
|
6515
|
+
return /* @__PURE__ */ jsx39(MonacoEditor, { ...props });
|
|
6272
6516
|
};
|
|
6273
6517
|
var MonacoEditor = ({
|
|
6274
6518
|
language,
|
|
@@ -6282,13 +6526,13 @@ var MonacoEditor = ({
|
|
|
6282
6526
|
const monaco = useMonaco2();
|
|
6283
6527
|
const editorRef = useRef3();
|
|
6284
6528
|
const theme = useTheme();
|
|
6285
|
-
|
|
6529
|
+
useEffect10(() => {
|
|
6286
6530
|
if (!active || !monaco || !editorRef.current) {
|
|
6287
6531
|
return;
|
|
6288
6532
|
}
|
|
6289
6533
|
monaco?.editor.setModelLanguage(editorRef.current.getModel(), language);
|
|
6290
6534
|
}, [monaco, language, active]);
|
|
6291
|
-
const editor = /* @__PURE__ */
|
|
6535
|
+
const editor = /* @__PURE__ */ jsx39(
|
|
6292
6536
|
Editor2,
|
|
6293
6537
|
{
|
|
6294
6538
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
@@ -6333,14 +6577,14 @@ var MonacoEditor = ({
|
|
|
6333
6577
|
className: "[&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent"
|
|
6334
6578
|
}
|
|
6335
6579
|
);
|
|
6336
|
-
return /* @__PURE__ */
|
|
6580
|
+
return /* @__PURE__ */ jsxs21(
|
|
6337
6581
|
"div",
|
|
6338
6582
|
{
|
|
6339
6583
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
6340
6584
|
style: { height },
|
|
6341
6585
|
children: [
|
|
6342
6586
|
editor,
|
|
6343
|
-
showCopyButton && /* @__PURE__ */
|
|
6587
|
+
showCopyButton && /* @__PURE__ */ jsx39(
|
|
6344
6588
|
CopyButton,
|
|
6345
6589
|
{
|
|
6346
6590
|
value,
|
|
@@ -6352,14 +6596,14 @@ var MonacoEditor = ({
|
|
|
6352
6596
|
);
|
|
6353
6597
|
};
|
|
6354
6598
|
var TestEditor2 = ({ value, onChange, height, showCopyButton }) => {
|
|
6355
|
-
return /* @__PURE__ */
|
|
6599
|
+
return /* @__PURE__ */ jsxs21(
|
|
6356
6600
|
"div",
|
|
6357
6601
|
{
|
|
6358
6602
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
6359
6603
|
style: { height },
|
|
6360
6604
|
children: [
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
showCopyButton && /* @__PURE__ */
|
|
6605
|
+
/* @__PURE__ */ jsx39("input", { "aria-label": "editor", value, onChange: (e) => onChange(e.target.value) }),
|
|
6606
|
+
showCopyButton && /* @__PURE__ */ jsx39(
|
|
6363
6607
|
CopyButton,
|
|
6364
6608
|
{
|
|
6365
6609
|
value,
|
|
@@ -6372,7 +6616,7 @@ var TestEditor2 = ({ value, onChange, height, showCopyButton }) => {
|
|
|
6372
6616
|
};
|
|
6373
6617
|
|
|
6374
6618
|
// src/components/databrowser/components/display/input/use-field.tsx
|
|
6375
|
-
import { Fragment as
|
|
6619
|
+
import { Fragment as Fragment5, jsx as jsx40 } from "react/jsx-runtime";
|
|
6376
6620
|
var useField = ({
|
|
6377
6621
|
name,
|
|
6378
6622
|
form,
|
|
@@ -6385,10 +6629,10 @@ var useField = ({
|
|
|
6385
6629
|
name,
|
|
6386
6630
|
control: form.control
|
|
6387
6631
|
});
|
|
6388
|
-
const [contentType, setContentType] =
|
|
6632
|
+
const [contentType, setContentType] = useState9(
|
|
6389
6633
|
() => checkIsValidJSON(field.value) ? "JSON" : "Text"
|
|
6390
6634
|
);
|
|
6391
|
-
|
|
6635
|
+
useEffect11(() => {
|
|
6392
6636
|
if (contentType === "JSON" && checkIsValidJSON(data)) {
|
|
6393
6637
|
form.setValue(name, formatJSON(data), {
|
|
6394
6638
|
shouldDirty: false
|
|
@@ -6412,8 +6656,8 @@ var useField = ({
|
|
|
6412
6656
|
}
|
|
6413
6657
|
};
|
|
6414
6658
|
return {
|
|
6415
|
-
selector: /* @__PURE__ */
|
|
6416
|
-
editor: /* @__PURE__ */
|
|
6659
|
+
selector: /* @__PURE__ */ jsx40(ContentTypeSelect, { value: contentType, onChange: handleTypeChange, data: field.value }),
|
|
6660
|
+
editor: /* @__PURE__ */ jsx40(Fragment5, { children: /* @__PURE__ */ jsx40(
|
|
6417
6661
|
CustomEditor,
|
|
6418
6662
|
{
|
|
6419
6663
|
language: contentType === "JSON" ? "json" : "plaintext",
|
|
@@ -6437,13 +6681,13 @@ var checkIsValidJSON = (value) => {
|
|
|
6437
6681
|
};
|
|
6438
6682
|
|
|
6439
6683
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
6440
|
-
import { jsx as
|
|
6684
|
+
import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6441
6685
|
var ListEditDisplay = ({
|
|
6442
6686
|
dataKey,
|
|
6443
6687
|
type,
|
|
6444
6688
|
item
|
|
6445
6689
|
}) => {
|
|
6446
|
-
return /* @__PURE__ */
|
|
6690
|
+
return /* @__PURE__ */ jsx41("div", { className: "grow rounded-md bg-zinc-100", children: /* @__PURE__ */ jsx41(ListEditForm, { item, type, dataKey }, item.key) });
|
|
6447
6691
|
};
|
|
6448
6692
|
var ListEditForm = ({
|
|
6449
6693
|
type,
|
|
@@ -6482,11 +6726,11 @@ var ListEditForm = ({
|
|
|
6482
6726
|
});
|
|
6483
6727
|
setSelectedListItem(void 0);
|
|
6484
6728
|
});
|
|
6485
|
-
return /* @__PURE__ */
|
|
6486
|
-
/* @__PURE__ */
|
|
6487
|
-
type === "zset" && /* @__PURE__ */
|
|
6488
|
-
type !== "list" && /* @__PURE__ */
|
|
6489
|
-
type !== "set" && type !== "zset" && /* @__PURE__ */
|
|
6729
|
+
return /* @__PURE__ */ jsx41(FormProvider, { ...form, children: /* @__PURE__ */ jsxs22("form", { onSubmit, className: "flex h-full flex-col gap-2", children: [
|
|
6730
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex grow flex-col gap-2", children: [
|
|
6731
|
+
type === "zset" && /* @__PURE__ */ jsx41(NumberFormItem, { name: "value", label: valueLabel }),
|
|
6732
|
+
type !== "list" && /* @__PURE__ */ jsx41(FormItem, { readOnly: type === "stream", name: "key", label: keyLabel, data: itemKey }),
|
|
6733
|
+
type !== "set" && type !== "zset" && /* @__PURE__ */ jsx41(
|
|
6490
6734
|
FormItem,
|
|
6491
6735
|
{
|
|
6492
6736
|
readOnly: type === "stream",
|
|
@@ -6496,7 +6740,7 @@ var ListEditForm = ({
|
|
|
6496
6740
|
}
|
|
6497
6741
|
)
|
|
6498
6742
|
] }),
|
|
6499
|
-
/* @__PURE__ */
|
|
6743
|
+
/* @__PURE__ */ jsxs22(
|
|
6500
6744
|
"div",
|
|
6501
6745
|
{
|
|
6502
6746
|
className: cn(
|
|
@@ -6504,9 +6748,9 @@ var ListEditForm = ({
|
|
|
6504
6748
|
type === "hash" && itemKey !== "" ? "justify-between" : "justify-end"
|
|
6505
6749
|
),
|
|
6506
6750
|
children: [
|
|
6507
|
-
type === "hash" && itemKey !== "" && /* @__PURE__ */
|
|
6508
|
-
/* @__PURE__ */
|
|
6509
|
-
/* @__PURE__ */
|
|
6751
|
+
type === "hash" && itemKey !== "" && /* @__PURE__ */ jsx41(HashFieldTTLBadge, { dataKey, field: itemKey }),
|
|
6752
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-2", children: [
|
|
6753
|
+
/* @__PURE__ */ jsx41(
|
|
6510
6754
|
Button,
|
|
6511
6755
|
{
|
|
6512
6756
|
type: "button",
|
|
@@ -6516,17 +6760,17 @@ var ListEditForm = ({
|
|
|
6516
6760
|
children: "Cancel"
|
|
6517
6761
|
}
|
|
6518
6762
|
),
|
|
6519
|
-
/* @__PURE__ */
|
|
6763
|
+
/* @__PURE__ */ jsx41(
|
|
6520
6764
|
SimpleTooltip,
|
|
6521
6765
|
{
|
|
6522
6766
|
content: type === "stream" && !isNew ? "Streams are not mutable" : void 0,
|
|
6523
|
-
children: /* @__PURE__ */
|
|
6767
|
+
children: /* @__PURE__ */ jsx41(
|
|
6524
6768
|
Button,
|
|
6525
6769
|
{
|
|
6526
6770
|
variant: "primary",
|
|
6527
6771
|
type: "submit",
|
|
6528
6772
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
6529
|
-
children: /* @__PURE__ */
|
|
6773
|
+
children: /* @__PURE__ */ jsx41(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" })
|
|
6530
6774
|
}
|
|
6531
6775
|
)
|
|
6532
6776
|
}
|
|
@@ -6538,13 +6782,13 @@ var ListEditForm = ({
|
|
|
6538
6782
|
] }) });
|
|
6539
6783
|
};
|
|
6540
6784
|
var NumberFormItem = ({ name, label }) => {
|
|
6541
|
-
return /* @__PURE__ */
|
|
6542
|
-
/* @__PURE__ */
|
|
6543
|
-
/* @__PURE__ */
|
|
6785
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-1", children: [
|
|
6786
|
+
/* @__PURE__ */ jsx41("div", { className: "flex", children: /* @__PURE__ */ jsx41("span", { className: "text-xs font-medium text-zinc-700", children: label }) }),
|
|
6787
|
+
/* @__PURE__ */ jsx41(
|
|
6544
6788
|
Controller3,
|
|
6545
6789
|
{
|
|
6546
6790
|
name,
|
|
6547
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6791
|
+
render: ({ field }) => /* @__PURE__ */ jsx41(
|
|
6548
6792
|
"input",
|
|
6549
6793
|
{
|
|
6550
6794
|
className: "plain-input rounded-md border border-zinc-300 px-3 py-1 shadow-sm",
|
|
@@ -6572,14 +6816,14 @@ var FormItem = ({
|
|
|
6572
6816
|
readOnly,
|
|
6573
6817
|
data
|
|
6574
6818
|
});
|
|
6575
|
-
return /* @__PURE__ */
|
|
6576
|
-
/* @__PURE__ */
|
|
6577
|
-
/* @__PURE__ */
|
|
6819
|
+
return /* @__PURE__ */ jsxs22("div", { className: cn("flex flex-col gap-1", !height && "h-full"), children: [
|
|
6820
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
6821
|
+
/* @__PURE__ */ jsx41("span", { className: "font-medium text-zinc-700", children: label }),
|
|
6578
6822
|
" ",
|
|
6579
|
-
/* @__PURE__ */
|
|
6823
|
+
/* @__PURE__ */ jsx41("span", { className: "text-zinc-300", children: "/" }),
|
|
6580
6824
|
selector
|
|
6581
6825
|
] }),
|
|
6582
|
-
/* @__PURE__ */
|
|
6826
|
+
/* @__PURE__ */ jsx41(
|
|
6583
6827
|
"div",
|
|
6584
6828
|
{
|
|
6585
6829
|
className: cn(
|
|
@@ -6593,8 +6837,8 @@ var FormItem = ({
|
|
|
6593
6837
|
};
|
|
6594
6838
|
|
|
6595
6839
|
// src/components/databrowser/components/display/hash/hash-field-ttl-info.tsx
|
|
6596
|
-
import { useEffect as
|
|
6597
|
-
import { jsx as
|
|
6840
|
+
import { useEffect as useEffect12, useState as useState10 } from "react";
|
|
6841
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6598
6842
|
var HashFieldTTLInfo = ({
|
|
6599
6843
|
dataKey,
|
|
6600
6844
|
field,
|
|
@@ -6602,8 +6846,8 @@ var HashFieldTTLInfo = ({
|
|
|
6602
6846
|
}) => {
|
|
6603
6847
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
6604
6848
|
const expireAt = data?.[field];
|
|
6605
|
-
const [ttl, setTTL] =
|
|
6606
|
-
|
|
6849
|
+
const [ttl, setTTL] = useState10(() => calculateTTL(expireAt));
|
|
6850
|
+
useEffect12(() => {
|
|
6607
6851
|
setTTL(calculateTTL(expireAt));
|
|
6608
6852
|
const interval = setInterval(() => {
|
|
6609
6853
|
setTTL(calculateTTL(expireAt));
|
|
@@ -6611,11 +6855,11 @@ var HashFieldTTLInfo = ({
|
|
|
6611
6855
|
return () => clearInterval(interval);
|
|
6612
6856
|
}, [expireAt]);
|
|
6613
6857
|
if (!expireAt || expireAt === TTL_NOT_FOUND || expireAt === TTL_INFINITE) return;
|
|
6614
|
-
return /* @__PURE__ */
|
|
6858
|
+
return /* @__PURE__ */ jsx42("span", { className: "block min-w-[30px] whitespace-nowrap text-right text-red-600", children: formatTime(ttl ?? 0) });
|
|
6615
6859
|
};
|
|
6616
6860
|
|
|
6617
6861
|
// src/components/databrowser/components/display/display-list.tsx
|
|
6618
|
-
import { Fragment as
|
|
6862
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6619
6863
|
var headerLabels = {
|
|
6620
6864
|
list: ["Index", "Content"],
|
|
6621
6865
|
hash: ["Field", "Value"],
|
|
@@ -6626,10 +6870,10 @@ var headerLabels = {
|
|
|
6626
6870
|
var ListDisplay = ({ dataKey, type }) => {
|
|
6627
6871
|
const { selectedListItem } = useTab();
|
|
6628
6872
|
const query = useFetchListItems({ dataKey, type });
|
|
6629
|
-
return /* @__PURE__ */
|
|
6630
|
-
/* @__PURE__ */
|
|
6631
|
-
selectedListItem && /* @__PURE__ */
|
|
6632
|
-
/* @__PURE__ */
|
|
6873
|
+
return /* @__PURE__ */ jsxs23("div", { className: "flex h-full flex-col gap-2", children: [
|
|
6874
|
+
/* @__PURE__ */ jsx43(DisplayHeader, { dataKey, type }),
|
|
6875
|
+
selectedListItem && /* @__PURE__ */ jsx43(ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
6876
|
+
/* @__PURE__ */ jsx43("div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ jsx43(InfiniteScroll, { query, className: "rounded-lg border border-zinc-200 bg-white", children: /* @__PURE__ */ jsx43("table", { className: "w-full", children: /* @__PURE__ */ jsx43(ItemContextMenu, { dataKey, type, children: /* @__PURE__ */ jsx43("tbody", { children: /* @__PURE__ */ jsx43(ListItems, { dataKey, type, query }) }) }) }) }) })
|
|
6633
6877
|
] });
|
|
6634
6878
|
};
|
|
6635
6879
|
var ListItems = ({
|
|
@@ -6641,7 +6885,7 @@ var ListItems = ({
|
|
|
6641
6885
|
const keys = useMemo8(() => query.data?.pages.flatMap((page) => page.keys) ?? [], [query.data]);
|
|
6642
6886
|
const fields = useMemo8(() => keys.map((key) => key.key), [keys]);
|
|
6643
6887
|
const { mutate: editItem } = useEditListItem();
|
|
6644
|
-
return /* @__PURE__ */
|
|
6888
|
+
return /* @__PURE__ */ jsx43(Fragment6, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ jsxs23(
|
|
6645
6889
|
"tr",
|
|
6646
6890
|
{
|
|
6647
6891
|
"data-item-key": key,
|
|
@@ -6653,7 +6897,7 @@ var ListItems = ({
|
|
|
6653
6897
|
"h-9 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100 dark:border-b-zinc-200 dark:hover:bg-zinc-200"
|
|
6654
6898
|
),
|
|
6655
6899
|
children: [
|
|
6656
|
-
/* @__PURE__ */
|
|
6900
|
+
/* @__PURE__ */ jsx43(
|
|
6657
6901
|
"td",
|
|
6658
6902
|
{
|
|
6659
6903
|
className: cn(
|
|
@@ -6663,23 +6907,23 @@ var ListItems = ({
|
|
|
6663
6907
|
children: key
|
|
6664
6908
|
}
|
|
6665
6909
|
),
|
|
6666
|
-
value !== void 0 && /* @__PURE__ */
|
|
6910
|
+
value !== void 0 && /* @__PURE__ */ jsx43(
|
|
6667
6911
|
"td",
|
|
6668
6912
|
{
|
|
6669
6913
|
className: cn("cursor-pointer truncate px-3", type === "zset" ? "w-24" : "max-w-0"),
|
|
6670
6914
|
children: value
|
|
6671
6915
|
}
|
|
6672
6916
|
),
|
|
6673
|
-
type !== "stream" && /* @__PURE__ */
|
|
6917
|
+
type !== "stream" && /* @__PURE__ */ jsx43(
|
|
6674
6918
|
"td",
|
|
6675
6919
|
{
|
|
6676
6920
|
className: "w-0 min-w-0 p-0 pr-2",
|
|
6677
6921
|
onClick: (e) => {
|
|
6678
6922
|
e.stopPropagation();
|
|
6679
6923
|
},
|
|
6680
|
-
children: /* @__PURE__ */
|
|
6681
|
-
type === "hash" && /* @__PURE__ */
|
|
6682
|
-
/* @__PURE__ */
|
|
6924
|
+
children: /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-end gap-2", children: [
|
|
6925
|
+
type === "hash" && /* @__PURE__ */ jsx43(HashFieldTTLInfo, { dataKey, field: key, fields }),
|
|
6926
|
+
/* @__PURE__ */ jsx43(
|
|
6683
6927
|
DeleteKeyModal,
|
|
6684
6928
|
{
|
|
6685
6929
|
deletionType: "item",
|
|
@@ -6693,14 +6937,14 @@ var ListItems = ({
|
|
|
6693
6937
|
newKey: void 0
|
|
6694
6938
|
});
|
|
6695
6939
|
},
|
|
6696
|
-
children: /* @__PURE__ */
|
|
6940
|
+
children: /* @__PURE__ */ jsx43(
|
|
6697
6941
|
Button,
|
|
6698
6942
|
{
|
|
6699
6943
|
className: "",
|
|
6700
6944
|
size: "icon-sm",
|
|
6701
6945
|
variant: "secondary",
|
|
6702
6946
|
onClick: (e) => e.stopPropagation(),
|
|
6703
|
-
children: /* @__PURE__ */
|
|
6947
|
+
children: /* @__PURE__ */ jsx43(IconTrash2, { className: "size-4 text-zinc-500" })
|
|
6704
6948
|
}
|
|
6705
6949
|
)
|
|
6706
6950
|
}
|
|
@@ -6715,14 +6959,14 @@ var ListItems = ({
|
|
|
6715
6959
|
};
|
|
6716
6960
|
|
|
6717
6961
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
6718
|
-
import { useEffect as
|
|
6962
|
+
import { useEffect as useEffect13 } from "react";
|
|
6719
6963
|
import { useForm as useForm4 } from "react-hook-form";
|
|
6720
|
-
import { Fragment as
|
|
6964
|
+
import { Fragment as Fragment7, jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6721
6965
|
var EditorDisplay = ({ dataKey, type }) => {
|
|
6722
6966
|
const { data } = useFetchSimpleKey(dataKey, type);
|
|
6723
|
-
return /* @__PURE__ */
|
|
6724
|
-
/* @__PURE__ */
|
|
6725
|
-
/* @__PURE__ */
|
|
6967
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex h-full w-full flex-col gap-2", children: [
|
|
6968
|
+
/* @__PURE__ */ jsx44(DisplayHeader, { dataKey, type, content: data ?? void 0 }),
|
|
6969
|
+
/* @__PURE__ */ jsx44("div", { className: "flex h-full grow flex-col gap-2 rounded-md bg-zinc-100", children: data === void 0 ? /* @__PURE__ */ jsx44(Spinner, { isLoadingText: "", isLoading: true }) : data === null ? /* @__PURE__ */ jsx44(Fragment7, {}) : /* @__PURE__ */ jsx44(EditorDisplayForm, { dataKey, type, data }, dataKey) })
|
|
6726
6970
|
] });
|
|
6727
6971
|
};
|
|
6728
6972
|
var EditorDisplayForm = ({
|
|
@@ -6733,7 +6977,7 @@ var EditorDisplayForm = ({
|
|
|
6733
6977
|
const form = useForm4({
|
|
6734
6978
|
defaultValues: { value: data }
|
|
6735
6979
|
});
|
|
6736
|
-
|
|
6980
|
+
useEffect13(() => {
|
|
6737
6981
|
form.reset({ value: data });
|
|
6738
6982
|
}, [data]);
|
|
6739
6983
|
const { editor, selector } = useField({ name: "value", form, data });
|
|
@@ -6741,14 +6985,14 @@ var EditorDisplayForm = ({
|
|
|
6741
6985
|
const handleCancel = () => {
|
|
6742
6986
|
form.reset({ value: data });
|
|
6743
6987
|
};
|
|
6744
|
-
return /* @__PURE__ */
|
|
6745
|
-
/* @__PURE__ */
|
|
6746
|
-
/* @__PURE__ */
|
|
6747
|
-
/* @__PURE__ */
|
|
6988
|
+
return /* @__PURE__ */ jsxs24(Fragment7, { children: [
|
|
6989
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex grow flex-col gap-1", children: [
|
|
6990
|
+
/* @__PURE__ */ jsx44("div", { className: "flex shrink-0 items-center gap-2", children: type === "json" ? /* @__PURE__ */ jsx44("div", {}) : selector }),
|
|
6991
|
+
/* @__PURE__ */ jsx44("div", { className: "grow rounded-md border border-zinc-300 bg-white p-2", children: editor })
|
|
6748
6992
|
] }),
|
|
6749
|
-
/* @__PURE__ */
|
|
6750
|
-
form.formState.isDirty && /* @__PURE__ */
|
|
6751
|
-
/* @__PURE__ */
|
|
6993
|
+
/* @__PURE__ */ jsx44("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs24("div", { className: "ml-auto flex gap-2", children: [
|
|
6994
|
+
form.formState.isDirty && /* @__PURE__ */ jsx44(Button, { onClick: handleCancel, children: "Cancel" }),
|
|
6995
|
+
/* @__PURE__ */ jsx44(
|
|
6752
6996
|
Button,
|
|
6753
6997
|
{
|
|
6754
6998
|
variant: "primary",
|
|
@@ -6756,7 +7000,7 @@ var EditorDisplayForm = ({
|
|
|
6756
7000
|
await setKey(value);
|
|
6757
7001
|
}),
|
|
6758
7002
|
disabled: !form.formState.isValid || !form.formState.isDirty,
|
|
6759
|
-
children: /* @__PURE__ */
|
|
7003
|
+
children: /* @__PURE__ */ jsx44(Spinner, { isLoading: isSettingKey, isLoadingText: "Saving", children: "Save" })
|
|
6760
7004
|
}
|
|
6761
7005
|
)
|
|
6762
7006
|
] }) })
|
|
@@ -6764,30 +7008,30 @@ var EditorDisplayForm = ({
|
|
|
6764
7008
|
};
|
|
6765
7009
|
|
|
6766
7010
|
// src/components/databrowser/components/display/index.tsx
|
|
6767
|
-
import { Fragment as
|
|
7011
|
+
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6768
7012
|
var DataDisplay = () => {
|
|
6769
7013
|
const { selectedKey } = useTab();
|
|
6770
7014
|
const { query } = useKeys();
|
|
6771
7015
|
const type = useKeyType(selectedKey);
|
|
6772
|
-
return /* @__PURE__ */
|
|
7016
|
+
return /* @__PURE__ */ jsx45("div", { className: "h-full rounded-xl bg-zinc-100 p-5", children: !selectedKey ? /* @__PURE__ */ jsx45("div", {}) : !type ? query.isLoading ? /* @__PURE__ */ jsx45("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx45("span", { className: "text-zinc-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx45("div", {}) : !DATA_TYPES.includes(type) ? /* @__PURE__ */ jsx45("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxs25("span", { className: "text-zinc-500", children: [
|
|
6773
7017
|
"Unrecognized key type: ",
|
|
6774
7018
|
type
|
|
6775
|
-
] }) }) : /* @__PURE__ */
|
|
7019
|
+
] }) }) : /* @__PURE__ */ jsx45(Fragment8, { children: SIMPLE_DATA_TYPES.includes(type) ? /* @__PURE__ */ jsx45(EditorDisplay, { dataKey: selectedKey, type }) : type === "search" ? /* @__PURE__ */ jsx45(SearchDisplay, { indexName: selectedKey }) : /* @__PURE__ */ jsx45(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
6776
7020
|
};
|
|
6777
7021
|
|
|
6778
7022
|
// src/components/databrowser/components/header/index.tsx
|
|
6779
|
-
import { useState as
|
|
7023
|
+
import { useState as useState14 } from "react";
|
|
6780
7024
|
import { IconChevronDown as IconChevronDown2, IconCircleCheck, IconCirclePlus, IconSearch as IconSearch2 } from "@tabler/icons-react";
|
|
6781
7025
|
|
|
6782
7026
|
// src/components/common/reload-button.tsx
|
|
6783
|
-
import { useState as
|
|
7027
|
+
import { useState as useState11 } from "react";
|
|
6784
7028
|
import { IconLoader2 as IconLoader22, IconRefresh } from "@tabler/icons-react";
|
|
6785
|
-
import { jsx as
|
|
7029
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
6786
7030
|
var ReloadButton = ({
|
|
6787
7031
|
onClick,
|
|
6788
7032
|
isLoading: isLoadingProp
|
|
6789
7033
|
}) => {
|
|
6790
|
-
const [isLoading, setIsLoading] =
|
|
7034
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
6791
7035
|
const handleClick = () => {
|
|
6792
7036
|
setIsLoading(true);
|
|
6793
7037
|
onClick();
|
|
@@ -6795,151 +7039,48 @@ var ReloadButton = ({
|
|
|
6795
7039
|
setIsLoading(false);
|
|
6796
7040
|
}, 350);
|
|
6797
7041
|
};
|
|
6798
|
-
return /* @__PURE__ */
|
|
7042
|
+
return /* @__PURE__ */ jsx46("div", { children: /* @__PURE__ */ jsx46(SimpleTooltip, { content: "Refresh", children: /* @__PURE__ */ jsx46(
|
|
6799
7043
|
Button,
|
|
6800
7044
|
{
|
|
6801
7045
|
variant: "outline",
|
|
6802
7046
|
size: "icon",
|
|
6803
7047
|
onClick: handleClick,
|
|
6804
7048
|
disabled: isLoading || isLoadingProp,
|
|
6805
|
-
children: isLoading ? /* @__PURE__ */
|
|
7049
|
+
children: isLoading ? /* @__PURE__ */ jsx46(IconLoader22, { className: "size-5 animate-spin text-zinc-500" }) : /* @__PURE__ */ jsx46(IconRefresh, { className: "size-5 text-zinc-500 dark:text-zinc-600" })
|
|
6806
7050
|
}
|
|
6807
7051
|
) }) });
|
|
6808
7052
|
};
|
|
6809
7053
|
|
|
6810
7054
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
6811
|
-
import { useState as
|
|
7055
|
+
import { useState as useState12 } from "react";
|
|
6812
7056
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
6813
7057
|
import { IconPlus as IconPlus2 } from "@tabler/icons-react";
|
|
6814
7058
|
import { Controller as Controller4, useForm as useForm5 } from "react-hook-form";
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
{
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
)
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
/* @__PURE__ */ jsxs24(
|
|
6841
|
-
DialogPrimitive.Content,
|
|
6842
|
-
{
|
|
6843
|
-
ref,
|
|
6844
|
-
className: cn(
|
|
6845
|
-
"antialiased",
|
|
6846
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out ",
|
|
6847
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ",
|
|
6848
|
-
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 ",
|
|
6849
|
-
"data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]",
|
|
6850
|
-
"data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
|
|
6851
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg ",
|
|
6852
|
-
"translate-x-[-50%] translate-y-[-50%] gap-4",
|
|
6853
|
-
"bg-white p-6 shadow-lg duration-200 ",
|
|
6854
|
-
"sm:rounded-lg md:w-full",
|
|
6855
|
-
className
|
|
6856
|
-
),
|
|
6857
|
-
...props,
|
|
6858
|
-
children: [
|
|
6859
|
-
children,
|
|
6860
|
-
/* @__PURE__ */ jsxs24(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-zinc-100 data-[state=open]:text-zinc-500", children: [
|
|
6861
|
-
/* @__PURE__ */ jsx44(
|
|
6862
|
-
"svg",
|
|
6863
|
-
{
|
|
6864
|
-
width: "15",
|
|
6865
|
-
height: "15",
|
|
6866
|
-
viewBox: "0 0 15 15",
|
|
6867
|
-
fill: "none",
|
|
6868
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6869
|
-
className: "h-4 w-4",
|
|
6870
|
-
children: /* @__PURE__ */ jsx44(
|
|
6871
|
-
"path",
|
|
6872
|
-
{
|
|
6873
|
-
d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",
|
|
6874
|
-
fill: "currentColor",
|
|
6875
|
-
fillRule: "evenodd",
|
|
6876
|
-
clipRule: "evenodd"
|
|
6877
|
-
}
|
|
6878
|
-
)
|
|
6879
|
-
}
|
|
6880
|
-
),
|
|
6881
|
-
/* @__PURE__ */ jsx44("span", { className: "sr-only", children: "Close" })
|
|
6882
|
-
] })
|
|
6883
|
-
]
|
|
6884
|
-
}
|
|
6885
|
-
)
|
|
6886
|
-
] }));
|
|
6887
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
6888
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx44("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
6889
|
-
DialogHeader.displayName = "DialogHeader";
|
|
6890
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx44(
|
|
6891
|
-
"div",
|
|
6892
|
-
{
|
|
6893
|
-
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
6894
|
-
...props
|
|
6895
|
-
}
|
|
6896
|
-
);
|
|
6897
|
-
DialogFooter.displayName = "DialogFooter";
|
|
6898
|
-
var DialogTitle = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx44(
|
|
6899
|
-
DialogPrimitive.Title,
|
|
6900
|
-
{
|
|
6901
|
-
ref,
|
|
6902
|
-
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
6903
|
-
...props
|
|
6904
|
-
}
|
|
6905
|
-
));
|
|
6906
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
6907
|
-
var DialogDescription = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx44(
|
|
6908
|
-
DialogPrimitive.Description,
|
|
6909
|
-
{
|
|
6910
|
-
ref,
|
|
6911
|
-
className: cn("text-sm text-zinc-500", className),
|
|
6912
|
-
...props
|
|
6913
|
-
}
|
|
6914
|
-
));
|
|
6915
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
6916
|
-
|
|
6917
|
-
// src/components/databrowser/components/add-key-modal.tsx
|
|
6918
|
-
import { jsx as jsx45, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6919
|
-
function AddKeyModal() {
|
|
6920
|
-
const { setSelectedKey } = useTab();
|
|
6921
|
-
const [open, setOpen] = useState10(false);
|
|
6922
|
-
const { mutateAsync: addKey, isPending } = useAddKey();
|
|
6923
|
-
const { control, handleSubmit, formState, reset } = useForm5({
|
|
6924
|
-
defaultValues: {
|
|
6925
|
-
key: "",
|
|
6926
|
-
type: "string"
|
|
6927
|
-
}
|
|
6928
|
-
});
|
|
6929
|
-
const onSubmit = handleSubmit(async ({ key, type }) => {
|
|
6930
|
-
await addKey({ key, type });
|
|
6931
|
-
setSelectedKey(key);
|
|
6932
|
-
setOpen(false);
|
|
6933
|
-
setTimeout(() => {
|
|
6934
|
-
window.document.querySelector(`[data-key="${key}"]`)?.scrollIntoView({
|
|
6935
|
-
behavior: "smooth",
|
|
6936
|
-
block: "start",
|
|
6937
|
-
inline: "nearest"
|
|
6938
|
-
});
|
|
6939
|
-
}, 100);
|
|
6940
|
-
});
|
|
6941
|
-
return /* @__PURE__ */ jsxs25(
|
|
6942
|
-
Dialog,
|
|
7059
|
+
import { jsx as jsx47, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7060
|
+
function AddKeyModal() {
|
|
7061
|
+
const { setSelectedKey } = useTab();
|
|
7062
|
+
const [open, setOpen] = useState12(false);
|
|
7063
|
+
const { mutateAsync: addKey, isPending } = useAddKey();
|
|
7064
|
+
const { control, handleSubmit, formState, reset } = useForm5({
|
|
7065
|
+
defaultValues: {
|
|
7066
|
+
key: "",
|
|
7067
|
+
type: "string"
|
|
7068
|
+
}
|
|
7069
|
+
});
|
|
7070
|
+
const onSubmit = handleSubmit(async ({ key, type }) => {
|
|
7071
|
+
await addKey({ key, type });
|
|
7072
|
+
setSelectedKey(key);
|
|
7073
|
+
setOpen(false);
|
|
7074
|
+
setTimeout(() => {
|
|
7075
|
+
window.document.querySelector(`[data-key="${key}"]`)?.scrollIntoView({
|
|
7076
|
+
behavior: "smooth",
|
|
7077
|
+
block: "start",
|
|
7078
|
+
inline: "nearest"
|
|
7079
|
+
});
|
|
7080
|
+
}, 100);
|
|
7081
|
+
});
|
|
7082
|
+
return /* @__PURE__ */ jsxs26(
|
|
7083
|
+
Dialog,
|
|
6943
7084
|
{
|
|
6944
7085
|
open,
|
|
6945
7086
|
onOpenChange: (open2) => {
|
|
@@ -6947,35 +7088,35 @@ function AddKeyModal() {
|
|
|
6947
7088
|
setOpen(open2);
|
|
6948
7089
|
},
|
|
6949
7090
|
children: [
|
|
6950
|
-
/* @__PURE__ */
|
|
7091
|
+
/* @__PURE__ */ jsx47(SimpleTooltip, { content: "Add key", children: /* @__PURE__ */ jsx47(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs26(
|
|
6951
7092
|
Button,
|
|
6952
7093
|
{
|
|
6953
7094
|
variant: "primary",
|
|
6954
7095
|
"data-testid": "add-key-button",
|
|
6955
7096
|
className: "flex h-8 items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
6956
7097
|
children: [
|
|
6957
|
-
/* @__PURE__ */
|
|
7098
|
+
/* @__PURE__ */ jsx47(IconPlus2, { className: "size-5" }),
|
|
6958
7099
|
"Key"
|
|
6959
7100
|
]
|
|
6960
7101
|
}
|
|
6961
7102
|
) }) }),
|
|
6962
|
-
/* @__PURE__ */
|
|
6963
|
-
/* @__PURE__ */
|
|
6964
|
-
/* @__PURE__ */
|
|
6965
|
-
/* @__PURE__ */
|
|
6966
|
-
/* @__PURE__ */
|
|
6967
|
-
/* @__PURE__ */
|
|
7103
|
+
/* @__PURE__ */ jsxs26(DialogContent, { className: "max-w-[400px]", children: [
|
|
7104
|
+
/* @__PURE__ */ jsx47(DialogHeader, { children: /* @__PURE__ */ jsx47(DialogTitle, { children: "Create new key" }) }),
|
|
7105
|
+
/* @__PURE__ */ jsx47("div", { className: "sr-only", children: /* @__PURE__ */ jsx47(DialogDescription2, { children: "Create new key" }) }),
|
|
7106
|
+
/* @__PURE__ */ jsxs26("form", { className: "mt-4", onSubmit, children: [
|
|
7107
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
|
|
7108
|
+
/* @__PURE__ */ jsx47(
|
|
6968
7109
|
Controller4,
|
|
6969
7110
|
{
|
|
6970
7111
|
control,
|
|
6971
7112
|
name: "type",
|
|
6972
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6973
|
-
/* @__PURE__ */
|
|
6974
|
-
/* @__PURE__ */
|
|
7113
|
+
render: ({ field }) => /* @__PURE__ */ jsxs26(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
7114
|
+
/* @__PURE__ */ jsx47(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx47(SelectValue, {}) }),
|
|
7115
|
+
/* @__PURE__ */ jsx47(SelectContent, { children: /* @__PURE__ */ jsx47(SelectGroup, { children: DATA_TYPES.filter((t) => t !== "search").map((type) => /* @__PURE__ */ jsx47(SelectItem, { value: type, children: /* @__PURE__ */ jsx47(TypeTag, { variant: type, type: "badge" }) }, type)) }) })
|
|
6975
7116
|
] })
|
|
6976
7117
|
}
|
|
6977
7118
|
),
|
|
6978
|
-
/* @__PURE__ */
|
|
7119
|
+
/* @__PURE__ */ jsx47(
|
|
6979
7120
|
Controller4,
|
|
6980
7121
|
{
|
|
6981
7122
|
rules: {
|
|
@@ -6983,14 +7124,14 @@ function AddKeyModal() {
|
|
|
6983
7124
|
},
|
|
6984
7125
|
control,
|
|
6985
7126
|
name: "key",
|
|
6986
|
-
render: ({ field }) => /* @__PURE__ */
|
|
7127
|
+
render: ({ field }) => /* @__PURE__ */ jsx47(Input, { placeholder: "mykey", ...field, className: "h-8 grow" })
|
|
6987
7128
|
}
|
|
6988
7129
|
)
|
|
6989
7130
|
] }),
|
|
6990
|
-
formState.errors.key && /* @__PURE__ */
|
|
6991
|
-
/* @__PURE__ */
|
|
6992
|
-
/* @__PURE__ */
|
|
6993
|
-
/* @__PURE__ */
|
|
7131
|
+
formState.errors.key && /* @__PURE__ */ jsx47("p", { className: "mb-3 mt-2 text-xs text-red-500", children: formState.errors.key?.message }),
|
|
7132
|
+
/* @__PURE__ */ jsx47("p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
7133
|
+
/* @__PURE__ */ jsxs26("div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
7134
|
+
/* @__PURE__ */ jsx47(
|
|
6994
7135
|
Button,
|
|
6995
7136
|
{
|
|
6996
7137
|
type: "button",
|
|
@@ -7001,7 +7142,7 @@ function AddKeyModal() {
|
|
|
7001
7142
|
children: "Cancel"
|
|
7002
7143
|
}
|
|
7003
7144
|
),
|
|
7004
|
-
/* @__PURE__ */
|
|
7145
|
+
/* @__PURE__ */ jsx47(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx47(Spinner, { isLoading: isPending, isLoadingText: "Creating", children: "Create" }) })
|
|
7005
7146
|
] })
|
|
7006
7147
|
] })
|
|
7007
7148
|
] })
|
|
@@ -7011,36 +7152,36 @@ function AddKeyModal() {
|
|
|
7011
7152
|
}
|
|
7012
7153
|
|
|
7013
7154
|
// src/components/databrowser/components/search/create-index-modal.tsx
|
|
7014
|
-
import { jsx as
|
|
7155
|
+
import { jsx as jsx48, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7015
7156
|
var CreateIndexModal = ({
|
|
7016
7157
|
open,
|
|
7017
7158
|
onOpenChange
|
|
7018
7159
|
}) => {
|
|
7019
|
-
return /* @__PURE__ */
|
|
7020
|
-
/* @__PURE__ */
|
|
7021
|
-
/* @__PURE__ */
|
|
7022
|
-
/* @__PURE__ */
|
|
7160
|
+
return /* @__PURE__ */ jsx48(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs27(DialogContent, { className: "max-w-2xl", children: [
|
|
7161
|
+
/* @__PURE__ */ jsx48(DialogHeader, { children: /* @__PURE__ */ jsx48(DialogTitle, { children: "Create new Index" }) }),
|
|
7162
|
+
/* @__PURE__ */ jsx48("div", { className: "sr-only", children: /* @__PURE__ */ jsx48(DialogDescription, { children: "Create new search index" }) }),
|
|
7163
|
+
/* @__PURE__ */ jsx48(SearchDisplay, { isCreateModal: true, onClose: () => onOpenChange(false) })
|
|
7023
7164
|
] }) });
|
|
7024
7165
|
};
|
|
7025
7166
|
|
|
7026
7167
|
// src/components/databrowser/components/search/edit-index-modal.tsx
|
|
7027
|
-
import { jsx as
|
|
7168
|
+
import { jsx as jsx49, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7028
7169
|
var EditIndexModal = ({
|
|
7029
7170
|
open,
|
|
7030
7171
|
onOpenChange,
|
|
7031
7172
|
indexName
|
|
7032
7173
|
}) => {
|
|
7033
|
-
return /* @__PURE__ */
|
|
7034
|
-
/* @__PURE__ */
|
|
7035
|
-
/* @__PURE__ */
|
|
7036
|
-
indexName && /* @__PURE__ */
|
|
7174
|
+
return /* @__PURE__ */ jsx49(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs28(DialogContent, { className: "max-w-2xl", children: [
|
|
7175
|
+
/* @__PURE__ */ jsx49(DialogHeader, { children: /* @__PURE__ */ jsx49(DialogTitle, { children: "Edit Index" }) }),
|
|
7176
|
+
/* @__PURE__ */ jsx49("div", { className: "sr-only", children: /* @__PURE__ */ jsx49(DialogDescription, { children: "Edit search index schema" }) }),
|
|
7177
|
+
indexName && /* @__PURE__ */ jsx49(SearchDisplay, { indexName, isEditModal: true, onClose: () => onOpenChange(false) })
|
|
7037
7178
|
] }) });
|
|
7038
7179
|
};
|
|
7039
7180
|
|
|
7040
7181
|
// src/components/databrowser/components/sidebar/search-input.tsx
|
|
7041
|
-
import { useEffect as
|
|
7182
|
+
import { useEffect as useEffect14, useRef as useRef4, useState as useState13 } from "react";
|
|
7042
7183
|
import { IconX as IconX2 } from "@tabler/icons-react";
|
|
7043
|
-
import { jsx as
|
|
7184
|
+
import { jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7044
7185
|
var dedupeSearchHistory = (history) => {
|
|
7045
7186
|
const seen = /* @__PURE__ */ new Set();
|
|
7046
7187
|
return history.filter((item) => {
|
|
@@ -7052,9 +7193,9 @@ var dedupeSearchHistory = (history) => {
|
|
|
7052
7193
|
var SearchInput = () => {
|
|
7053
7194
|
const { setSearchKey, search } = useTab();
|
|
7054
7195
|
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
7055
|
-
const [state, setState] =
|
|
7056
|
-
const [isFocus, setIsFocus] =
|
|
7057
|
-
const [focusedIndex, setFocusedIndex] =
|
|
7196
|
+
const [state, setState] = useState13(search.key);
|
|
7197
|
+
const [isFocus, setIsFocus] = useState13(false);
|
|
7198
|
+
const [focusedIndex, setFocusedIndex] = useState13(-1);
|
|
7058
7199
|
const inputRef = useRef4(null);
|
|
7059
7200
|
const historyItemRefs = useRef4([]);
|
|
7060
7201
|
const handleSubmit = (value) => {
|
|
@@ -7066,7 +7207,7 @@ var SearchInput = () => {
|
|
|
7066
7207
|
const filteredHistory = dedupeSearchHistory(
|
|
7067
7208
|
searchHistory.filter((item) => item.trim() !== "" && item.trim() !== "*").filter((item) => item.includes(state) && item !== state)
|
|
7068
7209
|
).slice(0, 5).map((item) => item.endsWith("*") ? item.slice(0, -1) : item);
|
|
7069
|
-
|
|
7210
|
+
useEffect14(() => {
|
|
7070
7211
|
setFocusedIndex(-1);
|
|
7071
7212
|
}, [filteredHistory.length]);
|
|
7072
7213
|
const handleKeyDown = (e) => {
|
|
@@ -7096,9 +7237,9 @@ var SearchInput = () => {
|
|
|
7096
7237
|
}
|
|
7097
7238
|
}
|
|
7098
7239
|
};
|
|
7099
|
-
return /* @__PURE__ */
|
|
7100
|
-
/* @__PURE__ */
|
|
7101
|
-
/* @__PURE__ */
|
|
7240
|
+
return /* @__PURE__ */ jsxs29("div", { className: "relative grow", children: [
|
|
7241
|
+
/* @__PURE__ */ jsxs29(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
7242
|
+
/* @__PURE__ */ jsx50(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx50("div", { className: "h-8 rounded-md border border-zinc-300 font-normal", children: /* @__PURE__ */ jsx50(
|
|
7102
7243
|
Input,
|
|
7103
7244
|
{
|
|
7104
7245
|
ref: inputRef,
|
|
@@ -7117,7 +7258,7 @@ var SearchInput = () => {
|
|
|
7117
7258
|
onBlur: () => setIsFocus(false)
|
|
7118
7259
|
}
|
|
7119
7260
|
) }) }),
|
|
7120
|
-
/* @__PURE__ */
|
|
7261
|
+
/* @__PURE__ */ jsx50(
|
|
7121
7262
|
PopoverContent,
|
|
7122
7263
|
{
|
|
7123
7264
|
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
@@ -7126,7 +7267,7 @@ var SearchInput = () => {
|
|
|
7126
7267
|
e.preventDefault();
|
|
7127
7268
|
e.stopPropagation();
|
|
7128
7269
|
},
|
|
7129
|
-
children: filteredHistory.map((item, index) => /* @__PURE__ */
|
|
7270
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx50("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx50(
|
|
7130
7271
|
"button",
|
|
7131
7272
|
{
|
|
7132
7273
|
ref: (el) => {
|
|
@@ -7141,7 +7282,7 @@ var SearchInput = () => {
|
|
|
7141
7282
|
}
|
|
7142
7283
|
)
|
|
7143
7284
|
] }),
|
|
7144
|
-
state && /* @__PURE__ */
|
|
7285
|
+
state && /* @__PURE__ */ jsxs29(
|
|
7145
7286
|
Button,
|
|
7146
7287
|
{
|
|
7147
7288
|
type: "button",
|
|
@@ -7153,8 +7294,8 @@ var SearchInput = () => {
|
|
|
7153
7294
|
setState("");
|
|
7154
7295
|
},
|
|
7155
7296
|
children: [
|
|
7156
|
-
/* @__PURE__ */
|
|
7157
|
-
/* @__PURE__ */
|
|
7297
|
+
/* @__PURE__ */ jsx50(IconX2, { size: 16 }),
|
|
7298
|
+
/* @__PURE__ */ jsx50("span", { className: "sr-only", children: "Clear" })
|
|
7158
7299
|
]
|
|
7159
7300
|
}
|
|
7160
7301
|
),
|
|
@@ -7163,11 +7304,11 @@ var SearchInput = () => {
|
|
|
7163
7304
|
};
|
|
7164
7305
|
|
|
7165
7306
|
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
7166
|
-
import { jsx as
|
|
7307
|
+
import { jsx as jsx51, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7167
7308
|
var ALL_TYPES_KEY = "all";
|
|
7168
7309
|
function DataTypeSelector() {
|
|
7169
7310
|
const { search, setSearchType } = useTab();
|
|
7170
|
-
return /* @__PURE__ */
|
|
7311
|
+
return /* @__PURE__ */ jsxs30(
|
|
7171
7312
|
Select,
|
|
7172
7313
|
{
|
|
7173
7314
|
onValueChange: (type) => {
|
|
@@ -7179,9 +7320,9 @@ function DataTypeSelector() {
|
|
|
7179
7320
|
},
|
|
7180
7321
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
7181
7322
|
children: [
|
|
7182
|
-
/* @__PURE__ */
|
|
7183
|
-
/* @__PURE__ */
|
|
7184
|
-
([key, value]) => /* @__PURE__ */
|
|
7323
|
+
/* @__PURE__ */ jsx51(SelectTrigger, { className: "!w-auto select-none whitespace-nowrap border-zinc-300 pr-8", children: /* @__PURE__ */ jsx51(SelectValue, {}) }),
|
|
7324
|
+
/* @__PURE__ */ jsx51(SelectContent, { children: /* @__PURE__ */ jsx51(SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
7325
|
+
([key, value]) => /* @__PURE__ */ jsx51(SelectItem, { value: key, children: value }, key)
|
|
7185
7326
|
) }) })
|
|
7186
7327
|
]
|
|
7187
7328
|
}
|
|
@@ -7189,12 +7330,12 @@ function DataTypeSelector() {
|
|
|
7189
7330
|
}
|
|
7190
7331
|
|
|
7191
7332
|
// src/components/databrowser/components/header/index.tsx
|
|
7192
|
-
import { Fragment as
|
|
7193
|
-
var Header = () => {
|
|
7333
|
+
import { Fragment as Fragment9, jsx as jsx52, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7334
|
+
var Header = ({ hideSearchTab = false }) => {
|
|
7194
7335
|
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
7195
|
-
return /* @__PURE__ */
|
|
7196
|
-
/* @__PURE__ */
|
|
7197
|
-
/* @__PURE__ */
|
|
7336
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between gap-1.5", children: [
|
|
7337
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex grow items-center gap-1.5", children: [
|
|
7338
|
+
!hideSearchTab && /* @__PURE__ */ jsx52(
|
|
7198
7339
|
Segmented,
|
|
7199
7340
|
{
|
|
7200
7341
|
options: [
|
|
@@ -7204,9 +7345,9 @@ var Header = () => {
|
|
|
7204
7345
|
},
|
|
7205
7346
|
{
|
|
7206
7347
|
key: "values",
|
|
7207
|
-
label: /* @__PURE__ */
|
|
7348
|
+
label: /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1", children: [
|
|
7208
7349
|
"Search",
|
|
7209
|
-
/* @__PURE__ */
|
|
7350
|
+
/* @__PURE__ */ jsx52("div", { className: "flex h-[18px] items-center rounded-md bg-emerald-100 px-[5px] text-[11px] text-emerald-700", children: "NEW" })
|
|
7210
7351
|
] })
|
|
7211
7352
|
}
|
|
7212
7353
|
],
|
|
@@ -7216,14 +7357,14 @@ var Header = () => {
|
|
|
7216
7357
|
}
|
|
7217
7358
|
}
|
|
7218
7359
|
),
|
|
7219
|
-
isValuesSearchSelected ? /* @__PURE__ */
|
|
7220
|
-
/* @__PURE__ */
|
|
7221
|
-
/* @__PURE__ */
|
|
7360
|
+
isValuesSearchSelected ? /* @__PURE__ */ jsx52(IndexSelector, {}) : /* @__PURE__ */ jsxs31(Fragment9, { children: [
|
|
7361
|
+
/* @__PURE__ */ jsx52(DataTypeSelector, {}),
|
|
7362
|
+
/* @__PURE__ */ jsx52(SearchInput, {})
|
|
7222
7363
|
] })
|
|
7223
7364
|
] }),
|
|
7224
|
-
/* @__PURE__ */
|
|
7225
|
-
/* @__PURE__ */
|
|
7226
|
-
/* @__PURE__ */
|
|
7365
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-1.5", children: [
|
|
7366
|
+
/* @__PURE__ */ jsx52(RefreshButton, {}),
|
|
7367
|
+
/* @__PURE__ */ jsx52(AddKeyModal, {})
|
|
7227
7368
|
] })
|
|
7228
7369
|
] });
|
|
7229
7370
|
};
|
|
@@ -7233,17 +7374,17 @@ var IndexSelector = () => {
|
|
|
7233
7374
|
setValuesSearchIndex
|
|
7234
7375
|
} = useTab();
|
|
7235
7376
|
const { data: indexes } = useFetchSearchIndexes();
|
|
7236
|
-
const [open, setOpen] =
|
|
7237
|
-
const [search, setSearch] =
|
|
7238
|
-
const [editingIndex, setEditingIndex] =
|
|
7377
|
+
const [open, setOpen] = useState14(false);
|
|
7378
|
+
const [search, setSearch] = useState14("");
|
|
7379
|
+
const [editingIndex, setEditingIndex] = useState14(null);
|
|
7239
7380
|
const filteredIndexes = indexes?.filter((idx) => idx.toLowerCase().includes(search.toLowerCase()));
|
|
7240
7381
|
const handleEditIndex = (indexName) => {
|
|
7241
7382
|
setOpen(false);
|
|
7242
7383
|
setEditingIndex(indexName);
|
|
7243
7384
|
};
|
|
7244
|
-
return /* @__PURE__ */
|
|
7245
|
-
/* @__PURE__ */
|
|
7246
|
-
/* @__PURE__ */
|
|
7385
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex", children: [
|
|
7386
|
+
/* @__PURE__ */ jsx52("div", { className: "flex items-center rounded-l-lg border border-r-0 border-zinc-300 bg-white px-3 text-sm text-zinc-700", children: "Index" }),
|
|
7387
|
+
/* @__PURE__ */ jsxs31(
|
|
7247
7388
|
Popover,
|
|
7248
7389
|
{
|
|
7249
7390
|
open,
|
|
@@ -7253,16 +7394,16 @@ var IndexSelector = () => {
|
|
|
7253
7394
|
},
|
|
7254
7395
|
modal: false,
|
|
7255
7396
|
children: [
|
|
7256
|
-
/* @__PURE__ */
|
|
7257
|
-
/* @__PURE__ */
|
|
7258
|
-
/* @__PURE__ */
|
|
7397
|
+
/* @__PURE__ */ jsx52(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs31("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-1.5 text-sm font-medium text-emerald-800 transition-colors hover:bg-emerald-100", children: [
|
|
7398
|
+
/* @__PURE__ */ jsx52("span", { className: "truncate", children: index || "Select an index" }),
|
|
7399
|
+
/* @__PURE__ */ jsx52(IconChevronDown2, { className: "size-4 shrink-0 opacity-50" })
|
|
7259
7400
|
] }) }),
|
|
7260
|
-
/* @__PURE__ */
|
|
7261
|
-
/* @__PURE__ */
|
|
7262
|
-
/* @__PURE__ */
|
|
7263
|
-
/* @__PURE__ */
|
|
7264
|
-
/* @__PURE__ */
|
|
7265
|
-
/* @__PURE__ */
|
|
7401
|
+
/* @__PURE__ */ jsx52(PopoverContent, { className: "p-2", align: "center", children: /* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-2", children: [
|
|
7402
|
+
/* @__PURE__ */ jsx52(CreateIndexButton, {}),
|
|
7403
|
+
/* @__PURE__ */ jsx52("div", { className: "h-px bg-zinc-100" }),
|
|
7404
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex h-9 items-center rounded-md border border-zinc-300 px-2", children: [
|
|
7405
|
+
/* @__PURE__ */ jsx52(IconSearch2, { className: "size-5 text-zinc-400" }),
|
|
7406
|
+
/* @__PURE__ */ jsx52(
|
|
7266
7407
|
"input",
|
|
7267
7408
|
{
|
|
7268
7409
|
value: search,
|
|
@@ -7272,14 +7413,14 @@ var IndexSelector = () => {
|
|
|
7272
7413
|
}
|
|
7273
7414
|
)
|
|
7274
7415
|
] }),
|
|
7275
|
-
/* @__PURE__ */
|
|
7276
|
-
filteredIndexes?.length === 0 && /* @__PURE__ */
|
|
7277
|
-
filteredIndexes?.map((idx) => /* @__PURE__ */
|
|
7416
|
+
/* @__PURE__ */ jsxs31("div", { className: "max-h-[200px] overflow-y-auto", children: [
|
|
7417
|
+
filteredIndexes?.length === 0 && /* @__PURE__ */ jsx52("div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
|
|
7418
|
+
filteredIndexes?.map((idx) => /* @__PURE__ */ jsxs31(
|
|
7278
7419
|
"div",
|
|
7279
7420
|
{
|
|
7280
7421
|
className: "flex h-9 items-center rounded-md px-2 transition-colors hover:bg-zinc-100",
|
|
7281
7422
|
children: [
|
|
7282
|
-
/* @__PURE__ */
|
|
7423
|
+
/* @__PURE__ */ jsxs31(
|
|
7283
7424
|
"button",
|
|
7284
7425
|
{
|
|
7285
7426
|
onClick: () => {
|
|
@@ -7288,21 +7429,21 @@ var IndexSelector = () => {
|
|
|
7288
7429
|
},
|
|
7289
7430
|
className: "flex flex-1 items-center gap-2 text-left text-sm",
|
|
7290
7431
|
children: [
|
|
7291
|
-
/* @__PURE__ */
|
|
7432
|
+
/* @__PURE__ */ jsx52(
|
|
7292
7433
|
"span",
|
|
7293
7434
|
{
|
|
7294
7435
|
className: cn(
|
|
7295
7436
|
"flex size-5 items-center justify-center",
|
|
7296
7437
|
idx === index ? "text-emerald-600" : "text-transparent"
|
|
7297
7438
|
),
|
|
7298
|
-
children: /* @__PURE__ */
|
|
7439
|
+
children: /* @__PURE__ */ jsx52(IconCircleCheck, { className: "size-5" })
|
|
7299
7440
|
}
|
|
7300
7441
|
),
|
|
7301
|
-
/* @__PURE__ */
|
|
7442
|
+
/* @__PURE__ */ jsx52("span", { className: "truncate", children: idx })
|
|
7302
7443
|
]
|
|
7303
7444
|
}
|
|
7304
7445
|
),
|
|
7305
|
-
/* @__PURE__ */
|
|
7446
|
+
/* @__PURE__ */ jsx52(
|
|
7306
7447
|
"button",
|
|
7307
7448
|
{
|
|
7308
7449
|
onClick: (event) => {
|
|
@@ -7323,7 +7464,7 @@ var IndexSelector = () => {
|
|
|
7323
7464
|
]
|
|
7324
7465
|
}
|
|
7325
7466
|
),
|
|
7326
|
-
/* @__PURE__ */
|
|
7467
|
+
/* @__PURE__ */ jsx52(
|
|
7327
7468
|
EditIndexModal,
|
|
7328
7469
|
{
|
|
7329
7470
|
open: Boolean(editingIndex),
|
|
@@ -7334,9 +7475,9 @@ var IndexSelector = () => {
|
|
|
7334
7475
|
] });
|
|
7335
7476
|
};
|
|
7336
7477
|
var CreateIndexButton = () => {
|
|
7337
|
-
const [open, setOpen] =
|
|
7338
|
-
return /* @__PURE__ */
|
|
7339
|
-
/* @__PURE__ */
|
|
7478
|
+
const [open, setOpen] = useState14(false);
|
|
7479
|
+
return /* @__PURE__ */ jsxs31(Fragment9, { children: [
|
|
7480
|
+
/* @__PURE__ */ jsxs31(
|
|
7340
7481
|
"button",
|
|
7341
7482
|
{
|
|
7342
7483
|
onClick: (e) => {
|
|
@@ -7345,17 +7486,17 @@ var CreateIndexButton = () => {
|
|
|
7345
7486
|
},
|
|
7346
7487
|
className: "flex h-9 w-full items-center gap-2 rounded-md px-2 text-sm text-emerald-600 transition-colors hover:bg-zinc-50",
|
|
7347
7488
|
children: [
|
|
7348
|
-
/* @__PURE__ */
|
|
7349
|
-
/* @__PURE__ */
|
|
7489
|
+
/* @__PURE__ */ jsx52(IconCirclePlus, { className: "size-5" }),
|
|
7490
|
+
/* @__PURE__ */ jsx52("span", { className: "underline", children: "Create a new Index" })
|
|
7350
7491
|
]
|
|
7351
7492
|
}
|
|
7352
7493
|
),
|
|
7353
|
-
/* @__PURE__ */
|
|
7494
|
+
/* @__PURE__ */ jsx52(CreateIndexModal, { open, onOpenChange: setOpen })
|
|
7354
7495
|
] });
|
|
7355
7496
|
};
|
|
7356
7497
|
var RefreshButton = () => {
|
|
7357
7498
|
const { query } = useKeys();
|
|
7358
|
-
return /* @__PURE__ */
|
|
7499
|
+
return /* @__PURE__ */ jsx52(
|
|
7359
7500
|
ReloadButton,
|
|
7360
7501
|
{
|
|
7361
7502
|
onClick: () => {
|
|
@@ -7378,185 +7519,381 @@ var RefreshButton = () => {
|
|
|
7378
7519
|
};
|
|
7379
7520
|
|
|
7380
7521
|
// src/components/databrowser/components/header-error.tsx
|
|
7381
|
-
import { jsx as
|
|
7522
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
7382
7523
|
var HeaderError = () => {
|
|
7383
7524
|
const { query } = useKeys();
|
|
7384
7525
|
if (!query.error) return null;
|
|
7385
|
-
return /* @__PURE__ */
|
|
7526
|
+
return /* @__PURE__ */ jsx53("p", { className: "text-sm text-red-600 dark:text-red-400", children: formatUpstashErrorMessage(query.error) });
|
|
7386
7527
|
};
|
|
7387
7528
|
|
|
7388
7529
|
// src/components/databrowser/components/search/query-editor.tsx
|
|
7389
7530
|
import { useMemo as useMemo9 } from "react";
|
|
7390
7531
|
|
|
7391
|
-
// src/components/databrowser/components/search/
|
|
7392
|
-
var
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7532
|
+
// src/components/databrowser/components/search/search-types-file.ts
|
|
7533
|
+
var SEARCH_TYPES = `
|
|
7534
|
+
|
|
7535
|
+
export const FIELD_TYPES = ["TEXT", "U64", "I64", "F64", "BOOL", "DATE"] as const;
|
|
7536
|
+
export type FieldType = (typeof FIELD_TYPES)[number];
|
|
7537
|
+
|
|
7538
|
+
export type TextField = {
|
|
7539
|
+
type: "TEXT";
|
|
7540
|
+
noTokenize?: boolean;
|
|
7541
|
+
noStem?: boolean;
|
|
7542
|
+
from?: string;
|
|
7543
|
+
};
|
|
7544
|
+
|
|
7545
|
+
export type NumericField = {
|
|
7546
|
+
type: "U64" | "I64" | "F64";
|
|
7547
|
+
fast: true;
|
|
7548
|
+
from?: string;
|
|
7549
|
+
};
|
|
7550
|
+
|
|
7551
|
+
export type BoolField = {
|
|
7552
|
+
type: "BOOL";
|
|
7553
|
+
fast?: boolean;
|
|
7554
|
+
from?: string;
|
|
7555
|
+
};
|
|
7556
|
+
|
|
7557
|
+
export type DateField = {
|
|
7558
|
+
type: "DATE";
|
|
7559
|
+
fast?: boolean;
|
|
7560
|
+
from?: string;
|
|
7561
|
+
};
|
|
7562
|
+
|
|
7563
|
+
export type DetailedField = TextField | NumericField | BoolField | DateField;
|
|
7564
|
+
export type NestedIndexSchema = {
|
|
7565
|
+
[key: string]: FieldType | DetailedField | NestedIndexSchema;
|
|
7566
|
+
};
|
|
7567
|
+
|
|
7568
|
+
export type FlatIndexSchema = {
|
|
7569
|
+
[key: string]: FieldType | DetailedField;
|
|
7570
|
+
};
|
|
7571
|
+
|
|
7572
|
+
export type SchemaPaths<T, Prefix extends string = ""> = {
|
|
7573
|
+
[K in keyof T]: K extends string
|
|
7574
|
+
? T[K] extends FieldType | DetailedField
|
|
7575
|
+
? Prefix extends ""
|
|
7576
|
+
? K
|
|
7577
|
+
: \`\${Prefix}\${K}\`
|
|
7578
|
+
: T[K] extends object
|
|
7579
|
+
? SchemaPaths<T[K], \`\${Prefix}\${K}.\`>
|
|
7580
|
+
: never
|
|
7581
|
+
: never;
|
|
7582
|
+
}[keyof T];
|
|
7583
|
+
|
|
7584
|
+
export type ExtractFieldType<T> = T extends FieldType
|
|
7585
|
+
? T
|
|
7586
|
+
: T extends { type: infer U }
|
|
7587
|
+
? U extends FieldType
|
|
7588
|
+
? U
|
|
7589
|
+
: never
|
|
7590
|
+
: never;
|
|
7591
|
+
|
|
7592
|
+
export type GetFieldAtPath<
|
|
7593
|
+
TSchema,
|
|
7594
|
+
Path extends string,
|
|
7595
|
+
> = Path extends \`\${infer First}.\${infer Rest}\`
|
|
7596
|
+
? First extends keyof TSchema
|
|
7597
|
+
? GetFieldAtPath<TSchema[First], Rest>
|
|
7598
|
+
: never
|
|
7599
|
+
: Path extends keyof TSchema
|
|
7600
|
+
? TSchema[Path]
|
|
7601
|
+
: never;
|
|
7602
|
+
|
|
7603
|
+
type FieldValueType<T extends FieldType> = T extends "TEXT"
|
|
7604
|
+
? string
|
|
7605
|
+
: T extends "U64" | "I64" | "F64"
|
|
7606
|
+
? number
|
|
7607
|
+
: T extends "BOOL"
|
|
7608
|
+
? boolean
|
|
7609
|
+
: T extends "DATE"
|
|
7610
|
+
? string
|
|
7611
|
+
: never;
|
|
7612
|
+
|
|
7613
|
+
type GetFieldValueType<TSchema, Path extends string> =
|
|
7614
|
+
GetFieldAtPath<TSchema, Path> extends infer Field
|
|
7615
|
+
? Field extends FieldType | DetailedField
|
|
7616
|
+
? FieldValueType<ExtractFieldType<Field>>
|
|
7617
|
+
: never
|
|
7618
|
+
: never;
|
|
7619
|
+
|
|
7620
|
+
// Helper type to check if a field has a 'from' property
|
|
7621
|
+
type HasFrom<T> = T extends { from: string } ? true : false;
|
|
7622
|
+
|
|
7623
|
+
// Distributes field inference across unions so that
|
|
7624
|
+
// InferSchemaData<NestedIndexSchema | FlatIndexSchema> does not collapse to never
|
|
7625
|
+
type InferSchemaDataField<T> = T extends FieldType
|
|
7626
|
+
? FieldValueType<T>
|
|
7627
|
+
: T extends DetailedField
|
|
7628
|
+
? FieldValueType<ExtractFieldType<T>>
|
|
7629
|
+
: T extends NestedIndexSchema
|
|
7630
|
+
? InferSchemaData<T>
|
|
7631
|
+
: unknown;
|
|
7632
|
+
|
|
7633
|
+
type IsDefaultSchema<T> = [T] extends [NestedIndexSchema | FlatIndexSchema]
|
|
7634
|
+
? [NestedIndexSchema | FlatIndexSchema] extends [T]
|
|
7635
|
+
? true
|
|
7636
|
+
: false
|
|
7637
|
+
: false;
|
|
7638
|
+
|
|
7639
|
+
type AsAnyIfUnknown<T> = unknown extends T ? any : T;
|
|
7640
|
+
|
|
7641
|
+
export type InferSchemaData<TSchema> =
|
|
7642
|
+
IsDefaultSchema<TSchema> extends true
|
|
7643
|
+
? any
|
|
7644
|
+
: {
|
|
7645
|
+
[K in keyof TSchema as TSchema[K] extends DetailedField
|
|
7646
|
+
? HasFrom<TSchema[K]> extends true
|
|
7647
|
+
? never
|
|
7648
|
+
: K
|
|
7649
|
+
: K]: AsAnyIfUnknown<InferSchemaDataField<TSchema[K]>>;
|
|
7650
|
+
};
|
|
7651
|
+
|
|
7652
|
+
// Query Options Types
|
|
7653
|
+
// These are the options that can be used for the query command
|
|
7654
|
+
export type QueryOptions<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
|
|
7655
|
+
filter?: RootQueryFilter<TSchema>;
|
|
7656
|
+
/** Maximum number of results to return */
|
|
7657
|
+
limit?: number;
|
|
7658
|
+
/** Number of results to skip */
|
|
7659
|
+
offset?: number;
|
|
7660
|
+
select?: Partial<{ [K in SchemaPaths<TSchema>]: true }>; // {}
|
|
7661
|
+
highlight?: {
|
|
7662
|
+
fields: SchemaPaths<TSchema>[];
|
|
7663
|
+
preTag?: string;
|
|
7664
|
+
postTag?: string;
|
|
7665
|
+
};
|
|
7666
|
+
} & QueryOrderOption<TSchema>;
|
|
7667
|
+
|
|
7668
|
+
type CombineMode = "multiply" | "sum";
|
|
7669
|
+
type ScoreMode = "multiply" | "sum" | "replace";
|
|
7670
|
+
type ScoreModifier =
|
|
7671
|
+
| "none"
|
|
7672
|
+
| "log"
|
|
7673
|
+
| "log1p"
|
|
7674
|
+
| "log2p"
|
|
7675
|
+
| "ln"
|
|
7676
|
+
| "ln1p"
|
|
7677
|
+
| "ln2p"
|
|
7678
|
+
| "square"
|
|
7679
|
+
| "sqrt"
|
|
7680
|
+
| "reciprocal";
|
|
7681
|
+
|
|
7682
|
+
export type ScoreBy<TSchemaPaths extends string> =
|
|
7683
|
+
| ScoreByField<false, TSchemaPaths>
|
|
7684
|
+
| {
|
|
7685
|
+
fields: ScoreByField<true, TSchemaPaths>[];
|
|
7686
|
+
combineMode?: CombineMode;
|
|
7687
|
+
scoreMode?: ScoreMode;
|
|
7688
|
+
};
|
|
7689
|
+
|
|
7690
|
+
type ScoreByField<TMultiple extends boolean, TSchemaPaths extends string> =
|
|
7691
|
+
| {
|
|
7692
|
+
field: TSchemaPaths;
|
|
7693
|
+
modifier?: ScoreModifier;
|
|
7694
|
+
factor?: number;
|
|
7695
|
+
missing?: number;
|
|
7696
|
+
scoreMode?: TMultiple extends true ? never : ScoreMode;
|
|
7697
|
+
}
|
|
7698
|
+
| TSchemaPaths;
|
|
7699
|
+
|
|
7700
|
+
type QueryOrderOption<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
7701
|
+
| {
|
|
7702
|
+
orderBy?: {
|
|
7703
|
+
[K in SchemaPaths<TSchema>]: { [P in K]: "ASC" | "DESC" };
|
|
7704
|
+
}[SchemaPaths<TSchema>];
|
|
7705
|
+
}
|
|
7706
|
+
| {
|
|
7707
|
+
scoreFunc?: ScoreBy<SchemaPaths<TSchema>>;
|
|
7708
|
+
};
|
|
7709
|
+
|
|
7710
|
+
/**
|
|
7711
|
+
* Converts dot notation paths to nested object structure type
|
|
7712
|
+
* e.g. "content.title" | "content.author" becomes { content: { title: ..., author: ... } }
|
|
7713
|
+
*/
|
|
7714
|
+
type PathToNestedObject<
|
|
7715
|
+
TSchema,
|
|
7716
|
+
Path extends string,
|
|
7717
|
+
Value,
|
|
7718
|
+
> = Path extends \`\${ infer First }.\${ infer Rest }\`
|
|
7719
|
+
? { [K in First]: PathToNestedObject<TSchema, Rest, Value> }
|
|
7720
|
+
: { [K in Path]: Value };
|
|
7721
|
+
|
|
7722
|
+
/**
|
|
7723
|
+
* Merges intersection of objects into a single object type with proper nesting
|
|
7724
|
+
*/
|
|
7725
|
+
type DeepMerge<T> = T extends object
|
|
7726
|
+
? {
|
|
7727
|
+
[K in keyof T]: T[K] extends object ? DeepMerge<T[K]> : T[K];
|
|
7728
|
+
}
|
|
7729
|
+
: T;
|
|
7730
|
+
|
|
7731
|
+
/**
|
|
7732
|
+
* Build nested result type from selected paths
|
|
7733
|
+
*/
|
|
7734
|
+
type BuildNestedResult<TSchema, TFields> =
|
|
7735
|
+
IsDefaultSchema<TSchema> extends true
|
|
7736
|
+
? DeepMerge<
|
|
7737
|
+
UnionToIntersection<
|
|
7738
|
+
{
|
|
7739
|
+
[Path in keyof TFields & string]: PathToNestedObject<any, Path, any>;
|
|
7740
|
+
}[keyof TFields & string]
|
|
7741
|
+
>
|
|
7742
|
+
>
|
|
7743
|
+
: DeepMerge<
|
|
7744
|
+
UnionToIntersection<
|
|
7745
|
+
{
|
|
7746
|
+
[Path in keyof TFields & SchemaPaths<TSchema>]: PathToNestedObject<
|
|
7747
|
+
TSchema,
|
|
7748
|
+
Path & string,
|
|
7749
|
+
AsAnyIfUnknown<GetFieldValueType<TSchema, Path & string>>
|
|
7750
|
+
>;
|
|
7751
|
+
}[keyof TFields & SchemaPaths<TSchema>]
|
|
7752
|
+
>
|
|
7753
|
+
>;
|
|
7754
|
+
|
|
7755
|
+
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (
|
|
7756
|
+
k: infer I
|
|
7757
|
+
) => void
|
|
7758
|
+
? I
|
|
7759
|
+
: never;
|
|
7760
|
+
|
|
7761
|
+
export type QueryResult<
|
|
7762
|
+
TSchema extends NestedIndexSchema | FlatIndexSchema,
|
|
7763
|
+
TOptions extends QueryOptions<TSchema> | undefined = undefined,
|
|
7764
|
+
> = TOptions extends { select: infer TFields }
|
|
7765
|
+
? // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
7766
|
+
{} extends TFields
|
|
7767
|
+
? { key: string; score: number }
|
|
7768
|
+
: {
|
|
7769
|
+
key: string;
|
|
7770
|
+
score: number;
|
|
7771
|
+
data: BuildNestedResult<TSchema, TFields>;
|
|
7421
7772
|
}
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
interface SchemaFields {
|
|
7428
|
-
${fieldLines}
|
|
7429
|
-
}`;
|
|
7430
|
-
} else {
|
|
7431
|
-
schemaFieldsInterface = `
|
|
7432
|
-
/** Schema fields - no schema available, using dynamic fields */
|
|
7433
|
-
interface SchemaFields {
|
|
7434
|
-
[fieldName: string]: StringOperations | NumberOperations | BooleanOperations | DateOperations;
|
|
7435
|
-
}`;
|
|
7436
|
-
}
|
|
7437
|
-
return `
|
|
7438
|
-
// String operations for TEXT fields
|
|
7439
|
-
type StringOperationMap = {
|
|
7440
|
-
/** Exact match */
|
|
7441
|
-
$eq: string;
|
|
7442
|
-
/** Not equal */
|
|
7443
|
-
$ne: string;
|
|
7444
|
-
/** Match any value in array */
|
|
7445
|
-
$in: string[];
|
|
7446
|
-
/** Fuzzy match with optional distance */
|
|
7447
|
-
$fuzzy: string | { value: string; distance?: number; transpositionCostOne?: boolean };
|
|
7448
|
-
/** Phrase match with optional slop or prefix */
|
|
7449
|
-
$phrase: string | { value: string } | { value: string; slop: number; prefix?: never } | { value: string; prefix: boolean; slop?: never };
|
|
7450
|
-
/** Regular expression match */
|
|
7451
|
-
$regex: string;
|
|
7452
|
-
};
|
|
7453
|
-
|
|
7454
|
-
// Number operations for U64, I64, F64 fields
|
|
7455
|
-
type NumberOperationMap = {
|
|
7456
|
-
/** Exact match */
|
|
7457
|
-
$eq: number;
|
|
7458
|
-
/** Not equal */
|
|
7459
|
-
$ne: number;
|
|
7460
|
-
/** Match any value in array */
|
|
7461
|
-
$in: number[];
|
|
7462
|
-
/** Greater than */
|
|
7463
|
-
$gt: number;
|
|
7464
|
-
/** Greater than or equal */
|
|
7465
|
-
$gte: number;
|
|
7466
|
-
/** Less than */
|
|
7467
|
-
$lt: number;
|
|
7468
|
-
/** Less than or equal */
|
|
7469
|
-
$lte: number;
|
|
7470
|
-
};
|
|
7471
|
-
|
|
7472
|
-
// Boolean operations for BOOL fields
|
|
7473
|
-
type BooleanOperationMap = {
|
|
7474
|
-
/** Exact match */
|
|
7475
|
-
$eq: boolean;
|
|
7476
|
-
/** Not equal */
|
|
7477
|
-
$ne: boolean;
|
|
7478
|
-
/** Match any value in array */
|
|
7479
|
-
$in: boolean[];
|
|
7480
|
-
};
|
|
7481
|
-
|
|
7482
|
-
// Date operations for DATE fields
|
|
7483
|
-
type DateOperationMap = {
|
|
7484
|
-
/** Exact match */
|
|
7485
|
-
$eq: string | Date;
|
|
7486
|
-
/** Not equal */
|
|
7487
|
-
$ne: string | Date;
|
|
7488
|
-
/** Match any value in array */
|
|
7489
|
-
$in: (string | Date)[];
|
|
7490
|
-
/** Greater than */
|
|
7491
|
-
$gt: string | Date;
|
|
7492
|
-
/** Greater than or equal */
|
|
7493
|
-
$gte: string | Date;
|
|
7494
|
-
/** Less than */
|
|
7495
|
-
$lt: string | Date;
|
|
7496
|
-
/** Less than or equal */
|
|
7497
|
-
$lte: string | Date;
|
|
7498
|
-
};
|
|
7499
|
-
|
|
7500
|
-
// String field operations with optional boost
|
|
7501
|
-
type StringOperations =
|
|
7502
|
-
| { $eq: string; $boost?: number }
|
|
7503
|
-
| { $ne: string; $boost?: number }
|
|
7504
|
-
| { $in: string[]; $boost?: number }
|
|
7505
|
-
| { $fuzzy: string | { value: string; distance?: number; transpositionCostOne?: boolean }; $boost?: number }
|
|
7506
|
-
| { $phrase: string | { value: string } | { value: string; slop: number; prefix?: never } | { value: string; prefix: boolean; slop?: never }; $boost?: number }
|
|
7507
|
-
| { $regex: string; $boost?: number }
|
|
7508
|
-
| string;
|
|
7509
|
-
|
|
7510
|
-
// Number field operations with optional boost
|
|
7511
|
-
type NumberOperations =
|
|
7512
|
-
| { $eq: number; $boost?: number }
|
|
7513
|
-
| { $ne: number; $boost?: number }
|
|
7514
|
-
| { $in: number[]; $boost?: number }
|
|
7515
|
-
| { $gt: number; $boost?: number }
|
|
7516
|
-
| { $gte: number; $boost?: number }
|
|
7517
|
-
| { $lt: number; $boost?: number }
|
|
7518
|
-
| { $lte: number; $boost?: number }
|
|
7519
|
-
| number;
|
|
7520
|
-
|
|
7521
|
-
// Boolean field operations with optional boost
|
|
7522
|
-
type BooleanOperations =
|
|
7523
|
-
| { $eq: boolean; $boost?: number }
|
|
7524
|
-
| { $ne: boolean; $boost?: number }
|
|
7525
|
-
| { $in: boolean[]; $boost?: number }
|
|
7526
|
-
| boolean;
|
|
7527
|
-
|
|
7528
|
-
// Date field operations with optional boost
|
|
7529
|
-
type DateOperations =
|
|
7530
|
-
| { $eq: string | Date; $boost?: number }
|
|
7531
|
-
| { $ne: string | Date; $boost?: number }
|
|
7532
|
-
| { $in: (string | Date)[]; $boost?: number }
|
|
7533
|
-
| { $gt: string | Date; $boost?: number }
|
|
7534
|
-
| { $gte: string | Date; $boost?: number }
|
|
7535
|
-
| { $lt: string | Date; $boost?: number }
|
|
7536
|
-
| { $lte: string | Date; $boost?: number }
|
|
7537
|
-
| string
|
|
7538
|
-
| Date;
|
|
7773
|
+
: {
|
|
7774
|
+
key: string;
|
|
7775
|
+
score: number;
|
|
7776
|
+
data: InferSchemaData<TSchema>;
|
|
7777
|
+
};
|
|
7539
7778
|
|
|
7540
|
-
|
|
7779
|
+
export type PublicQueryResult<
|
|
7780
|
+
TSchema extends NestedIndexSchema | FlatIndexSchema,
|
|
7781
|
+
TSelectFields extends SchemaPaths<TSchema>[] | undefined = undefined,
|
|
7782
|
+
> = QueryResult<
|
|
7783
|
+
TSchema,
|
|
7784
|
+
TSelectFields extends SchemaPaths<TSchema>[]
|
|
7785
|
+
? {
|
|
7786
|
+
select: { [K in TSelectFields[number]]: true };
|
|
7787
|
+
}
|
|
7788
|
+
: undefined
|
|
7789
|
+
>;
|
|
7790
|
+
|
|
7791
|
+
// Query Filter Types
|
|
7792
|
+
// These are the operations that can be used for each field type
|
|
7793
|
+
type StringOperationMap<T extends string> = {
|
|
7794
|
+
$eq: T;
|
|
7795
|
+
$ne: T;
|
|
7796
|
+
$in: T[];
|
|
7797
|
+
$fuzzy: T | { value: T; distance?: number; transpositionCostOne?: boolean };
|
|
7798
|
+
$phrase:
|
|
7799
|
+
| T
|
|
7800
|
+
| { value: T }
|
|
7801
|
+
| { value: T; slop: number; prefix?: never }
|
|
7802
|
+
| { value: T; prefix: boolean; slop?: never };
|
|
7803
|
+
$regex: T;
|
|
7804
|
+
$smart: T;
|
|
7805
|
+
};
|
|
7806
|
+
|
|
7807
|
+
type NumberOperationMap<T extends number> = {
|
|
7808
|
+
$eq: T;
|
|
7809
|
+
$ne: T;
|
|
7810
|
+
$in: T[];
|
|
7811
|
+
$gt: T;
|
|
7812
|
+
$gte: T;
|
|
7813
|
+
$lt: T;
|
|
7814
|
+
$lte: T;
|
|
7815
|
+
};
|
|
7816
|
+
|
|
7817
|
+
type BooleanOperationMap<T extends boolean> = {
|
|
7818
|
+
$eq: T;
|
|
7819
|
+
$ne: T;
|
|
7820
|
+
$in: T[];
|
|
7821
|
+
};
|
|
7822
|
+
|
|
7823
|
+
type DateOperationMap<T extends string | Date> = {
|
|
7824
|
+
$eq: T;
|
|
7825
|
+
$ne: T;
|
|
7826
|
+
$in: T[];
|
|
7827
|
+
$gt: T;
|
|
7828
|
+
$gte: T;
|
|
7829
|
+
$lte: T;
|
|
7830
|
+
$lt: T;
|
|
7831
|
+
};
|
|
7832
|
+
|
|
7833
|
+
// Create union types for each field type
|
|
7834
|
+
type StringOperations = {
|
|
7835
|
+
[K in keyof StringOperationMap<string>]: { [P in K]: StringOperationMap<string>[K] } & {
|
|
7836
|
+
$boost?: number;
|
|
7837
|
+
};
|
|
7838
|
+
}[keyof StringOperationMap<string>];
|
|
7541
7839
|
|
|
7542
|
-
|
|
7543
|
-
|
|
7840
|
+
type NumberOperations = {
|
|
7841
|
+
[K in keyof NumberOperationMap<number>]: { [P in K]: NumberOperationMap<number>[K] } & {
|
|
7842
|
+
$boost?: number;
|
|
7843
|
+
};
|
|
7844
|
+
}[keyof NumberOperationMap<number>];
|
|
7845
|
+
|
|
7846
|
+
type BooleanOperations = {
|
|
7847
|
+
[K in keyof BooleanOperationMap<boolean>]: { [P in K]: BooleanOperationMap<boolean>[K] } & {
|
|
7848
|
+
$boost?: number;
|
|
7849
|
+
};
|
|
7850
|
+
}[keyof BooleanOperationMap<boolean>];
|
|
7851
|
+
|
|
7852
|
+
type DateOperations = {
|
|
7853
|
+
[K in keyof DateOperationMap<string | Date>]: { [P in K]: DateOperationMap<string | Date>[K] } & {
|
|
7854
|
+
$boost?: number;
|
|
7855
|
+
};
|
|
7856
|
+
}[keyof DateOperationMap<string | Date>];
|
|
7857
|
+
|
|
7858
|
+
// Create a union type for all operations for a given field type
|
|
7859
|
+
type OperationsForFieldType<T extends FieldType> = T extends "TEXT"
|
|
7860
|
+
? StringOperations
|
|
7861
|
+
: T extends "U64" | "I64" | "F64"
|
|
7862
|
+
? NumberOperations
|
|
7863
|
+
: T extends "BOOL"
|
|
7864
|
+
? BooleanOperations
|
|
7865
|
+
: T extends "DATE"
|
|
7866
|
+
? DateOperations
|
|
7867
|
+
: never;
|
|
7868
|
+
|
|
7869
|
+
// Create a union type for all operations for a given path
|
|
7870
|
+
type PathOperations<TSchema, TPath extends string> =
|
|
7871
|
+
GetFieldAtPath<TSchema, TPath> extends infer Field
|
|
7872
|
+
? Field extends FieldType | DetailedField
|
|
7873
|
+
? OperationsForFieldType<ExtractFieldType<Field>> | FieldValueType<ExtractFieldType<Field>>
|
|
7874
|
+
: never
|
|
7875
|
+
: never;
|
|
7876
|
+
|
|
7877
|
+
// Create a type for a query leaf (only field paths, no boolean operators)
|
|
7878
|
+
type QueryLeaf<TSchema> = {
|
|
7879
|
+
// allowed schema paths
|
|
7880
|
+
[K in SchemaPaths<TSchema>]?: PathOperations<TSchema, K>;
|
|
7881
|
+
} & {
|
|
7544
7882
|
$and?: never;
|
|
7545
7883
|
$or?: never;
|
|
7546
7884
|
$must?: never;
|
|
7547
7885
|
$should?: never;
|
|
7548
7886
|
$mustNot?: never;
|
|
7549
|
-
$boost?:
|
|
7887
|
+
$boost?: number;
|
|
7550
7888
|
};
|
|
7551
7889
|
|
|
7552
|
-
|
|
7553
|
-
|
|
7890
|
+
type BoolBase<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
|
|
7891
|
+
[P in SchemaPaths<TSchema>]?: PathOperations<TSchema, P>;
|
|
7892
|
+
};
|
|
7554
7893
|
|
|
7555
7894
|
// $and: all conditions must match
|
|
7556
|
-
type AndNode = BoolBase & {
|
|
7557
|
-
|
|
7558
|
-
$and: QueryFilter | QueryFilter[];
|
|
7559
|
-
/** Boost score for this node */
|
|
7895
|
+
type AndNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7896
|
+
$and: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7560
7897
|
$boost?: number;
|
|
7561
7898
|
$or?: never;
|
|
7562
7899
|
$must?: never;
|
|
@@ -7565,10 +7902,8 @@ type AndNode = BoolBase & {
|
|
|
7565
7902
|
};
|
|
7566
7903
|
|
|
7567
7904
|
// $or: at least one condition must match
|
|
7568
|
-
type OrNode = BoolBase & {
|
|
7569
|
-
|
|
7570
|
-
$or: QueryFilter | QueryFilter[];
|
|
7571
|
-
/** Boost score for this node */
|
|
7905
|
+
type OrNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7906
|
+
$or: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7572
7907
|
$boost?: number;
|
|
7573
7908
|
$and?: never;
|
|
7574
7909
|
$must?: never;
|
|
@@ -7576,11 +7911,9 @@ type OrNode = BoolBase & {
|
|
|
7576
7911
|
$mustNot?: never;
|
|
7577
7912
|
};
|
|
7578
7913
|
|
|
7579
|
-
// $must only
|
|
7580
|
-
type MustNode = BoolBase & {
|
|
7581
|
-
|
|
7582
|
-
$must: QueryFilter | QueryFilter[];
|
|
7583
|
-
/** Boost score for this node */
|
|
7914
|
+
// $must only
|
|
7915
|
+
type MustNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7916
|
+
$must: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7584
7917
|
$boost?: number;
|
|
7585
7918
|
$and?: never;
|
|
7586
7919
|
$or?: never;
|
|
@@ -7588,11 +7921,9 @@ type MustNode = BoolBase & {
|
|
|
7588
7921
|
$mustNot?: never;
|
|
7589
7922
|
};
|
|
7590
7923
|
|
|
7591
|
-
// $should only
|
|
7592
|
-
type ShouldNode = BoolBase & {
|
|
7593
|
-
|
|
7594
|
-
$should: QueryFilter | QueryFilter[];
|
|
7595
|
-
/** Boost score for this node */
|
|
7924
|
+
// $should only
|
|
7925
|
+
type ShouldNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7926
|
+
$should: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7596
7927
|
$boost?: number;
|
|
7597
7928
|
$and?: never;
|
|
7598
7929
|
$or?: never;
|
|
@@ -7601,21 +7932,16 @@ type ShouldNode = BoolBase & {
|
|
|
7601
7932
|
};
|
|
7602
7933
|
|
|
7603
7934
|
// $must + $should combined
|
|
7604
|
-
type MustShouldNode = BoolBase & {
|
|
7605
|
-
|
|
7606
|
-
$
|
|
7607
|
-
/** At least one should match for higher score */
|
|
7608
|
-
$should: QueryFilter | QueryFilter[];
|
|
7935
|
+
type MustShouldNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7936
|
+
$must: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7937
|
+
$should: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7609
7938
|
$and?: never;
|
|
7610
7939
|
$or?: never;
|
|
7611
|
-
$mustNot?: never;
|
|
7612
7940
|
};
|
|
7613
7941
|
|
|
7614
7942
|
// $mustNot only
|
|
7615
|
-
type NotNode = BoolBase & {
|
|
7616
|
-
|
|
7617
|
-
$mustNot: QueryFilter | QueryFilter[];
|
|
7618
|
-
/** Boost score for this node */
|
|
7943
|
+
type NotNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7944
|
+
$mustNot: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7619
7945
|
$boost?: number;
|
|
7620
7946
|
$and?: never;
|
|
7621
7947
|
$or?: never;
|
|
@@ -7623,20 +7949,18 @@ type NotNode = BoolBase & {
|
|
|
7623
7949
|
$should?: never;
|
|
7624
7950
|
};
|
|
7625
7951
|
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
$
|
|
7629
|
-
$mustNot: QueryFilter | QueryFilter[];
|
|
7952
|
+
type AndNotNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7953
|
+
$and: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7954
|
+
$mustNot: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7630
7955
|
$boost?: number;
|
|
7631
7956
|
$or?: never;
|
|
7632
7957
|
$must?: never;
|
|
7633
7958
|
$should?: never;
|
|
7634
7959
|
};
|
|
7635
7960
|
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
$
|
|
7639
|
-
$mustNot: QueryFilter | QueryFilter[];
|
|
7961
|
+
type OrNotNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7962
|
+
$or: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7963
|
+
$mustNot: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7640
7964
|
$boost?: number;
|
|
7641
7965
|
$and?: never;
|
|
7642
7966
|
$must?: never;
|
|
@@ -7644,19 +7968,18 @@ type OrNotNode = BoolBase & {
|
|
|
7644
7968
|
};
|
|
7645
7969
|
|
|
7646
7970
|
// $should + $mustNot combined
|
|
7647
|
-
type ShouldNotNode = BoolBase & {
|
|
7648
|
-
$should: QueryFilter | QueryFilter[];
|
|
7649
|
-
$mustNot: QueryFilter | QueryFilter[];
|
|
7971
|
+
type ShouldNotNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7972
|
+
$should: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7973
|
+
$mustNot: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7650
7974
|
$boost?: number;
|
|
7651
7975
|
$and?: never;
|
|
7652
7976
|
$or?: never;
|
|
7653
7977
|
$must?: never;
|
|
7654
7978
|
};
|
|
7655
7979
|
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
$
|
|
7659
|
-
$mustNot: QueryFilter | QueryFilter[];
|
|
7980
|
+
type MustNotNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7981
|
+
$must: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7982
|
+
$mustNot: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7660
7983
|
$boost?: number;
|
|
7661
7984
|
$and?: never;
|
|
7662
7985
|
$or?: never;
|
|
@@ -7664,33 +7987,47 @@ type MustNotNode = BoolBase & {
|
|
|
7664
7987
|
};
|
|
7665
7988
|
|
|
7666
7989
|
// Full boolean node: $must + $should + $mustNot
|
|
7667
|
-
type BoolNode = BoolBase & {
|
|
7668
|
-
$must: QueryFilter | QueryFilter[];
|
|
7669
|
-
$should: QueryFilter | QueryFilter[];
|
|
7670
|
-
$mustNot: QueryFilter | QueryFilter[];
|
|
7990
|
+
type BoolNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = BoolBase<TSchema> & {
|
|
7991
|
+
$must: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7992
|
+
$should: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7993
|
+
$mustNot: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7671
7994
|
$boost?: number;
|
|
7672
7995
|
$and?: never;
|
|
7673
7996
|
$or?: never;
|
|
7674
7997
|
};
|
|
7675
7998
|
|
|
7676
|
-
//
|
|
7677
|
-
type QueryFilter =
|
|
7678
|
-
| QueryLeaf
|
|
7679
|
-
| AndNode
|
|
7680
|
-
| OrNode
|
|
7681
|
-
| MustNode
|
|
7682
|
-
| ShouldNode
|
|
7683
|
-
| MustShouldNode
|
|
7684
|
-
| NotNode
|
|
7685
|
-
| AndNotNode
|
|
7686
|
-
| OrNotNode
|
|
7687
|
-
| ShouldNotNode
|
|
7688
|
-
| MustNotNode
|
|
7689
|
-
| BoolNode
|
|
7690
|
-
|
|
7691
|
-
//
|
|
7692
|
-
type
|
|
7693
|
-
|
|
7999
|
+
// Create a type for a query filter
|
|
8000
|
+
export type QueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8001
|
+
| QueryLeaf<TSchema>
|
|
8002
|
+
| AndNode<TSchema>
|
|
8003
|
+
| OrNode<TSchema>
|
|
8004
|
+
| MustNode<TSchema>
|
|
8005
|
+
| ShouldNode<TSchema>
|
|
8006
|
+
| MustShouldNode<TSchema>
|
|
8007
|
+
| NotNode<TSchema>
|
|
8008
|
+
| AndNotNode<TSchema>
|
|
8009
|
+
| OrNotNode<TSchema>
|
|
8010
|
+
| ShouldNotNode<TSchema>
|
|
8011
|
+
| MustNotNode<TSchema>
|
|
8012
|
+
| BoolNode<TSchema>;
|
|
8013
|
+
|
|
8014
|
+
// Create a type for root-level queries (restricts $or from mixing with fields)
|
|
8015
|
+
export type RootQueryFilter<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8016
|
+
| QueryLeaf<TSchema>
|
|
8017
|
+
| AndNode<TSchema>
|
|
8018
|
+
| RootOrNode<TSchema>
|
|
8019
|
+
| MustNode<TSchema>
|
|
8020
|
+
| ShouldNode<TSchema>
|
|
8021
|
+
| MustShouldNode<TSchema>
|
|
8022
|
+
| AndNotNode<TSchema>
|
|
8023
|
+
| ShouldNotNode<TSchema>
|
|
8024
|
+
| BoolNode<TSchema>;
|
|
8025
|
+
|
|
8026
|
+
// Restricted version of OrNode that doesn't allow field operations at root level
|
|
8027
|
+
type RootOrNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
|
|
8028
|
+
[P in SchemaPaths<TSchema>]?: never; // No field operations at root level with $or
|
|
8029
|
+
} & {
|
|
8030
|
+
$or: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7694
8031
|
$boost?: number;
|
|
7695
8032
|
$and?: never;
|
|
7696
8033
|
$must?: never;
|
|
@@ -7698,24 +8035,101 @@ type RootOrNode = {
|
|
|
7698
8035
|
$mustNot?: never;
|
|
7699
8036
|
};
|
|
7700
8037
|
|
|
7701
|
-
|
|
7702
|
-
type
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
8038
|
+
export type DescribeFieldInfo = {
|
|
8039
|
+
type: FieldType;
|
|
8040
|
+
noTokenize?: boolean;
|
|
8041
|
+
noStem?: boolean;
|
|
8042
|
+
fast?: boolean;
|
|
8043
|
+
};
|
|
8044
|
+
|
|
8045
|
+
export type IndexDescription<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
|
|
8046
|
+
name: string;
|
|
8047
|
+
dataType: "hash" | "string" | "json";
|
|
8048
|
+
prefixes: string[];
|
|
8049
|
+
language?: Language;
|
|
8050
|
+
schema: Record<SchemaPaths<TSchema>, DescribeFieldInfo>;
|
|
8051
|
+
};
|
|
8052
|
+
|
|
8053
|
+
export type Language =
|
|
8054
|
+
| "english"
|
|
8055
|
+
| "arabic"
|
|
8056
|
+
| "danish"
|
|
8057
|
+
| "dutch"
|
|
8058
|
+
| "finnish"
|
|
8059
|
+
| "french"
|
|
8060
|
+
| "german"
|
|
8061
|
+
| "greek"
|
|
8062
|
+
| "hungarian"
|
|
8063
|
+
| "italian"
|
|
8064
|
+
| "norwegian"
|
|
8065
|
+
| "portuguese"
|
|
8066
|
+
| "romanian"
|
|
8067
|
+
| "russian"
|
|
8068
|
+
| "spanish"
|
|
8069
|
+
| "swedish"
|
|
8070
|
+
| "tamil"
|
|
8071
|
+
| "turkish";
|
|
8072
|
+
|
|
8073
|
+
`;
|
|
8074
|
+
|
|
8075
|
+
// src/components/databrowser/components/search/generate-query-type-definitions.tsx
|
|
8076
|
+
var buildNestedSchema = (flatSchema) => {
|
|
8077
|
+
const nested = {};
|
|
8078
|
+
for (const [fieldPath, fieldDef] of Object.entries(flatSchema)) {
|
|
8079
|
+
const parts = fieldPath.split(".");
|
|
8080
|
+
let current = nested;
|
|
8081
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
8082
|
+
const part = parts[i];
|
|
8083
|
+
if (!current[part] || typeof current[part] === "string") {
|
|
8084
|
+
current[part] = {};
|
|
8085
|
+
}
|
|
8086
|
+
current = current[part];
|
|
8087
|
+
}
|
|
8088
|
+
current[parts.at(-1)] = `"${fieldDef.type}"`;
|
|
8089
|
+
}
|
|
8090
|
+
return nested;
|
|
8091
|
+
};
|
|
8092
|
+
var generateNestedInterface = (obj, indent = " ") => {
|
|
8093
|
+
const lines = [];
|
|
8094
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
8095
|
+
if (typeof value === "string") {
|
|
8096
|
+
lines.push(`${indent}${key}: ${value};`);
|
|
8097
|
+
} else {
|
|
8098
|
+
lines.push(`${indent}${key}: {`, generateNestedInterface(value, indent + " "), `${indent}};`);
|
|
8099
|
+
}
|
|
8100
|
+
}
|
|
8101
|
+
return lines.join("\n");
|
|
8102
|
+
};
|
|
8103
|
+
var toAmbientTypes = (types) => types.replaceAll(/export const (\w+) = (\[.*?]) as const;/g, "declare const $1: readonly $2;").replaceAll("export ", "");
|
|
8104
|
+
var generateTypeDefinitions = (schema) => {
|
|
8105
|
+
let schemaFieldsInterface = "";
|
|
8106
|
+
const schemaFields = schema?.schema;
|
|
8107
|
+
if (schemaFields && Object.keys(schemaFields).length > 0) {
|
|
8108
|
+
const nested = buildNestedSchema(schemaFields);
|
|
8109
|
+
const fieldLines = generateNestedInterface(nested);
|
|
8110
|
+
schemaFieldsInterface = `
|
|
8111
|
+
/** Schema fields for the current index */
|
|
8112
|
+
interface SchemaFields {
|
|
8113
|
+
${fieldLines}
|
|
8114
|
+
}`;
|
|
8115
|
+
} else {
|
|
8116
|
+
schemaFieldsInterface = `
|
|
8117
|
+
/** Schema fields - no schema available, using dynamic fields */
|
|
8118
|
+
interface SchemaFields {
|
|
8119
|
+
[fieldName: string]: FieldType | DetailedField | NestedIndexSchema;
|
|
8120
|
+
}`;
|
|
8121
|
+
}
|
|
8122
|
+
return `
|
|
8123
|
+
${toAmbientTypes(SEARCH_TYPES)}
|
|
8124
|
+
|
|
8125
|
+
${schemaFieldsInterface}
|
|
8126
|
+
|
|
8127
|
+
type Query = RootQueryFilter<SchemaFields>;
|
|
7714
8128
|
`;
|
|
7715
8129
|
};
|
|
7716
8130
|
|
|
7717
8131
|
// src/components/databrowser/components/search/query-editor.tsx
|
|
7718
|
-
import { jsx as
|
|
8132
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
7719
8133
|
var QUERY_PREFIX = "const query: Query = {";
|
|
7720
8134
|
var QUERY_DEFAULT = "const query: Query = {}";
|
|
7721
8135
|
var isQueryStringValid = (value) => {
|
|
@@ -7723,7 +8137,7 @@ var isQueryStringValid = (value) => {
|
|
|
7723
8137
|
};
|
|
7724
8138
|
var QueryEditor = ({ value, onChange, height, schema }) => {
|
|
7725
8139
|
const typeDefinitions = useMemo9(() => generateTypeDefinitions(schema), [schema]);
|
|
7726
|
-
return /* @__PURE__ */
|
|
8140
|
+
return /* @__PURE__ */ jsx54(
|
|
7727
8141
|
EditorWithTypes,
|
|
7728
8142
|
{
|
|
7729
8143
|
value,
|
|
@@ -7739,15 +8153,14 @@ var QueryEditor = ({ value, onChange, height, schema }) => {
|
|
|
7739
8153
|
};
|
|
7740
8154
|
|
|
7741
8155
|
// src/components/databrowser/components/query-builder.tsx
|
|
7742
|
-
import { jsx as
|
|
8156
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
7743
8157
|
var QueryBuilder = () => {
|
|
7744
8158
|
const { valuesSearch, setValuesSearchQuery } = useTab();
|
|
7745
8159
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
7746
8160
|
const editorValue = PREFIX + (valuesSearch.query || "{}");
|
|
7747
|
-
return /* @__PURE__ */
|
|
8161
|
+
return /* @__PURE__ */ jsx55("div", { className: "h-full rounded-lg border border-zinc-300 bg-white px-[6px]", children: /* @__PURE__ */ jsx55(
|
|
7748
8162
|
QueryEditor,
|
|
7749
8163
|
{
|
|
7750
|
-
height: 300,
|
|
7751
8164
|
value: editorValue,
|
|
7752
8165
|
onChange: (value) => {
|
|
7753
8166
|
const queryPart = value.slice(PREFIX.length);
|
|
@@ -7760,39 +8173,39 @@ var QueryBuilder = () => {
|
|
|
7760
8173
|
|
|
7761
8174
|
// src/components/databrowser/components/search-empty-state.tsx
|
|
7762
8175
|
import { IconCode, IconDatabase, IconDownload, IconSearch as IconSearch3 } from "@tabler/icons-react";
|
|
7763
|
-
import { jsx as
|
|
8176
|
+
import { jsx as jsx56, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7764
8177
|
var SearchEmptyState = () => {
|
|
7765
|
-
return /* @__PURE__ */
|
|
7766
|
-
/* @__PURE__ */
|
|
7767
|
-
/* @__PURE__ */
|
|
7768
|
-
/* @__PURE__ */
|
|
7769
|
-
/* @__PURE__ */
|
|
7770
|
-
/* @__PURE__ */
|
|
7771
|
-
/* @__PURE__ */
|
|
7772
|
-
/* @__PURE__ */
|
|
7773
|
-
/* @__PURE__ */
|
|
7774
|
-
/* @__PURE__ */
|
|
7775
|
-
/* @__PURE__ */
|
|
7776
|
-
/* @__PURE__ */
|
|
8178
|
+
return /* @__PURE__ */ jsxs32("div", { className: "flex gap-8 rounded-xl border border-zinc-200 bg-gradient-to-b from-zinc-50 to-white p-8", children: [
|
|
8179
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex-1", children: [
|
|
8180
|
+
/* @__PURE__ */ jsx56("h2", { className: "mb-2 text-lg font-semibold text-zinc-900", children: "Redis Search" }),
|
|
8181
|
+
/* @__PURE__ */ jsx56("p", { className: "mb-6 max-w-md text-sm leading-relaxed text-zinc-600", children: "Redis Search allows you to create indexes on your existing keys and perform fast, full-text searches across your data." }),
|
|
8182
|
+
/* @__PURE__ */ jsxs32("div", { className: "space-y-3", children: [
|
|
8183
|
+
/* @__PURE__ */ jsx56("h3", { className: "text-xs font-medium uppercase tracking-wider text-zinc-400", children: "How it works" }),
|
|
8184
|
+
/* @__PURE__ */ jsxs32("div", { className: "space-y-2.5", children: [
|
|
8185
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-start gap-3", children: [
|
|
8186
|
+
/* @__PURE__ */ jsx56("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx56(IconDatabase, { size: 16 }) }),
|
|
8187
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
8188
|
+
/* @__PURE__ */ jsx56("h4", { className: "text-sm font-medium text-zinc-900", children: "Store your data" }),
|
|
8189
|
+
/* @__PURE__ */ jsx56("p", { className: "text-sm text-zinc-500", children: "Add documents as JSON, Hash, or String keys (string content must be valid JSON)." })
|
|
7777
8190
|
] })
|
|
7778
8191
|
] }),
|
|
7779
|
-
/* @__PURE__ */
|
|
7780
|
-
/* @__PURE__ */
|
|
7781
|
-
/* @__PURE__ */
|
|
7782
|
-
/* @__PURE__ */
|
|
7783
|
-
/* @__PURE__ */
|
|
8192
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-start gap-3", children: [
|
|
8193
|
+
/* @__PURE__ */ jsx56("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx56(IconCode, { size: 16 }) }),
|
|
8194
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
8195
|
+
/* @__PURE__ */ jsx56("h4", { className: "text-sm font-medium text-zinc-900", children: "Create an index" }),
|
|
8196
|
+
/* @__PURE__ */ jsx56("p", { className: "text-sm text-zinc-500", children: "Define a search index specifying which fields to search on." })
|
|
7784
8197
|
] })
|
|
7785
8198
|
] }),
|
|
7786
|
-
/* @__PURE__ */
|
|
7787
|
-
/* @__PURE__ */
|
|
7788
|
-
/* @__PURE__ */
|
|
7789
|
-
/* @__PURE__ */
|
|
7790
|
-
/* @__PURE__ */
|
|
8199
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-start gap-3", children: [
|
|
8200
|
+
/* @__PURE__ */ jsx56("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-100 text-emerald-600", children: /* @__PURE__ */ jsx56(IconSearch3, { size: 16 }) }),
|
|
8201
|
+
/* @__PURE__ */ jsxs32("div", { children: [
|
|
8202
|
+
/* @__PURE__ */ jsx56("h4", { className: "text-sm font-medium text-zinc-900", children: "Search your data" }),
|
|
8203
|
+
/* @__PURE__ */ jsx56("p", { className: "text-sm text-zinc-500", children: "Query with filters, full-text search, and sorted results." })
|
|
7791
8204
|
] })
|
|
7792
8205
|
] })
|
|
7793
8206
|
] })
|
|
7794
8207
|
] }),
|
|
7795
|
-
/* @__PURE__ */
|
|
8208
|
+
/* @__PURE__ */ jsx56(
|
|
7796
8209
|
"a",
|
|
7797
8210
|
{
|
|
7798
8211
|
href: "https://upstash.com/docs/redis/sdks/ts/commands/search",
|
|
@@ -7803,11 +8216,11 @@ var SearchEmptyState = () => {
|
|
|
7803
8216
|
}
|
|
7804
8217
|
)
|
|
7805
8218
|
] }),
|
|
7806
|
-
/* @__PURE__ */
|
|
7807
|
-
/* @__PURE__ */
|
|
7808
|
-
/* @__PURE__ */
|
|
7809
|
-
/* @__PURE__ */
|
|
7810
|
-
/* @__PURE__ */
|
|
8219
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex w-72 flex-col items-center justify-center rounded-lg border border-dashed border-zinc-300 bg-white p-6", children: [
|
|
8220
|
+
/* @__PURE__ */ jsx56("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-zinc-100 text-zinc-500", children: /* @__PURE__ */ jsx56(IconDownload, { size: 24 }) }),
|
|
8221
|
+
/* @__PURE__ */ jsx56("h3", { className: "mb-1 text-sm font-medium text-zinc-900", children: "Get started quickly" }),
|
|
8222
|
+
/* @__PURE__ */ jsx56("p", { className: "mb-4 text-center text-xs text-zinc-500", children: "Import a sample dataset to try out Redis Search" }),
|
|
8223
|
+
/* @__PURE__ */ jsx56(
|
|
7811
8224
|
"button",
|
|
7812
8225
|
{
|
|
7813
8226
|
onClick: () => {
|
|
@@ -7821,27 +8234,27 @@ var SearchEmptyState = () => {
|
|
|
7821
8234
|
};
|
|
7822
8235
|
|
|
7823
8236
|
// src/components/databrowser/components/sidebar/empty.tsx
|
|
7824
|
-
import { jsx as
|
|
8237
|
+
import { jsx as jsx57, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7825
8238
|
var Empty = () => {
|
|
7826
|
-
return /* @__PURE__ */
|
|
7827
|
-
/* @__PURE__ */
|
|
7828
|
-
/* @__PURE__ */
|
|
8239
|
+
return /* @__PURE__ */ jsx57("div", { className: "flex h-full w-full items-center justify-center rounded-md border bg-white px-4 py-6 text-center", children: /* @__PURE__ */ jsxs33("div", { className: "space-y-5", children: [
|
|
8240
|
+
/* @__PURE__ */ jsx57("p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
8241
|
+
/* @__PURE__ */ jsx57("p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
7829
8242
|
] }) });
|
|
7830
8243
|
};
|
|
7831
8244
|
|
|
7832
8245
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
7833
|
-
import { Fragment as
|
|
8246
|
+
import { Fragment as Fragment11, useRef as useRef5 } from "react";
|
|
7834
8247
|
import { IconChevronRight as IconChevronRight3 } from "@tabler/icons-react";
|
|
7835
8248
|
|
|
7836
8249
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
7837
|
-
import { useState as
|
|
8250
|
+
import { useState as useState15 } from "react";
|
|
7838
8251
|
import { ContextMenuSeparator as ContextMenuSeparator3 } from "@radix-ui/react-context-menu";
|
|
7839
8252
|
import { IconCopy as IconCopy3, IconExternalLink as IconExternalLink2, IconTrash as IconTrash3 } from "@tabler/icons-react";
|
|
7840
|
-
import { Fragment as
|
|
8253
|
+
import { Fragment as Fragment10, jsx as jsx58, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7841
8254
|
var SidebarContextMenu = ({ children }) => {
|
|
7842
8255
|
const { mutate: deleteKey } = useDeleteKey();
|
|
7843
|
-
const [isAlertOpen, setAlertOpen] =
|
|
7844
|
-
const [contextKeys, setContextKeys] =
|
|
8256
|
+
const [isAlertOpen, setAlertOpen] = useState15(false);
|
|
8257
|
+
const [contextKeys, setContextKeys] = useState15([]);
|
|
7845
8258
|
const {
|
|
7846
8259
|
addTab,
|
|
7847
8260
|
setSelectedKey: setSelectedKeyGlobal,
|
|
@@ -7849,8 +8262,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
7849
8262
|
setSearch
|
|
7850
8263
|
} = useDatabrowserStore();
|
|
7851
8264
|
const { search: currentSearch, selectedKeys } = useTab();
|
|
7852
|
-
return /* @__PURE__ */
|
|
7853
|
-
/* @__PURE__ */
|
|
8265
|
+
return /* @__PURE__ */ jsxs34(Fragment10, { children: [
|
|
8266
|
+
/* @__PURE__ */ jsx58(
|
|
7854
8267
|
DeleteKeyModal,
|
|
7855
8268
|
{
|
|
7856
8269
|
deletionType: "key",
|
|
@@ -7866,8 +8279,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
7866
8279
|
}
|
|
7867
8280
|
}
|
|
7868
8281
|
),
|
|
7869
|
-
/* @__PURE__ */
|
|
7870
|
-
/* @__PURE__ */
|
|
8282
|
+
/* @__PURE__ */ jsxs34(ContextMenu, { modal: false, children: [
|
|
8283
|
+
/* @__PURE__ */ jsx58(
|
|
7871
8284
|
ContextMenuTrigger,
|
|
7872
8285
|
{
|
|
7873
8286
|
onContextMenu: (e) => {
|
|
@@ -7887,8 +8300,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
7887
8300
|
children
|
|
7888
8301
|
}
|
|
7889
8302
|
),
|
|
7890
|
-
/* @__PURE__ */
|
|
7891
|
-
/* @__PURE__ */
|
|
8303
|
+
/* @__PURE__ */ jsxs34(ContextMenuContent, { children: [
|
|
8304
|
+
/* @__PURE__ */ jsxs34(
|
|
7892
8305
|
ContextMenuItem,
|
|
7893
8306
|
{
|
|
7894
8307
|
onClick: () => {
|
|
@@ -7900,12 +8313,12 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
7900
8313
|
className: "gap-2",
|
|
7901
8314
|
disabled: contextKeys.length !== 1,
|
|
7902
8315
|
children: [
|
|
7903
|
-
/* @__PURE__ */
|
|
8316
|
+
/* @__PURE__ */ jsx58(IconCopy3, { size: 16 }),
|
|
7904
8317
|
"Copy key"
|
|
7905
8318
|
]
|
|
7906
8319
|
}
|
|
7907
8320
|
),
|
|
7908
|
-
/* @__PURE__ */
|
|
8321
|
+
/* @__PURE__ */ jsxs34(
|
|
7909
8322
|
ContextMenuItem,
|
|
7910
8323
|
{
|
|
7911
8324
|
onClick: () => {
|
|
@@ -7917,14 +8330,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
7917
8330
|
className: "gap-2",
|
|
7918
8331
|
disabled: contextKeys.length !== 1,
|
|
7919
8332
|
children: [
|
|
7920
|
-
/* @__PURE__ */
|
|
8333
|
+
/* @__PURE__ */ jsx58(IconExternalLink2, { size: 16 }),
|
|
7921
8334
|
"Open in new tab"
|
|
7922
8335
|
]
|
|
7923
8336
|
}
|
|
7924
8337
|
),
|
|
7925
|
-
/* @__PURE__ */
|
|
7926
|
-
/* @__PURE__ */
|
|
7927
|
-
/* @__PURE__ */
|
|
8338
|
+
/* @__PURE__ */ jsx58(ContextMenuSeparator3, {}),
|
|
8339
|
+
/* @__PURE__ */ jsxs34(ContextMenuItem, { onClick: () => setAlertOpen(true), className: "gap-2", children: [
|
|
8340
|
+
/* @__PURE__ */ jsx58(IconTrash3, { size: 16 }),
|
|
7928
8341
|
contextKeys.length > 1 ? `Delete ${contextKeys.length} keys` : "Delete key"
|
|
7929
8342
|
] })
|
|
7930
8343
|
] })
|
|
@@ -7933,14 +8346,14 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
7933
8346
|
};
|
|
7934
8347
|
|
|
7935
8348
|
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
7936
|
-
import { Fragment as
|
|
8349
|
+
import { Fragment as Fragment12, jsx as jsx59, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7937
8350
|
var KeysList = () => {
|
|
7938
8351
|
const { keys } = useKeys();
|
|
7939
8352
|
const lastClickedIndexRef = useRef5(null);
|
|
7940
|
-
return /* @__PURE__ */
|
|
7941
|
-
/* @__PURE__ */
|
|
7942
|
-
keys.map((data, i) => /* @__PURE__ */
|
|
7943
|
-
/* @__PURE__ */
|
|
8353
|
+
return /* @__PURE__ */ jsx59(SidebarContextMenu, { children: /* @__PURE__ */ jsxs35(Fragment12, { children: [
|
|
8354
|
+
/* @__PURE__ */ jsx59("div", { className: "h-px" }),
|
|
8355
|
+
keys.map((data, i) => /* @__PURE__ */ jsxs35(Fragment11, { children: [
|
|
8356
|
+
/* @__PURE__ */ jsx59(
|
|
7944
8357
|
KeyItem,
|
|
7945
8358
|
{
|
|
7946
8359
|
index: i,
|
|
@@ -7949,7 +8362,7 @@ var KeysList = () => {
|
|
|
7949
8362
|
lastClickedIndexRef
|
|
7950
8363
|
}
|
|
7951
8364
|
),
|
|
7952
|
-
i !== keys.length - 1 && /* @__PURE__ */
|
|
8365
|
+
i !== keys.length - 1 && /* @__PURE__ */ jsx59("div", { className: "-z-10 mx-[13px] h-px bg-zinc-200 dark:bg-zinc-200" })
|
|
7953
8366
|
] }, data[0]))
|
|
7954
8367
|
] }) });
|
|
7955
8368
|
};
|
|
@@ -7991,7 +8404,7 @@ var KeyItem = ({
|
|
|
7991
8404
|
lastClickedIndexRef.current = index;
|
|
7992
8405
|
}
|
|
7993
8406
|
};
|
|
7994
|
-
return /* @__PURE__ */
|
|
8407
|
+
return /* @__PURE__ */ jsxs35(
|
|
7995
8408
|
"button",
|
|
7996
8409
|
{
|
|
7997
8410
|
"data-key": dataKey,
|
|
@@ -8003,52 +8416,60 @@ var KeyItem = ({
|
|
|
8003
8416
|
),
|
|
8004
8417
|
onClick: handleClick,
|
|
8005
8418
|
children: [
|
|
8006
|
-
/* @__PURE__ */
|
|
8007
|
-
/* @__PURE__ */
|
|
8008
|
-
score !== void 0 && /* @__PURE__ */
|
|
8009
|
-
isKeySelected && /* @__PURE__ */
|
|
8419
|
+
/* @__PURE__ */ jsx59(TypeTag, { variant: dataType, type: "icon" }),
|
|
8420
|
+
/* @__PURE__ */ jsx59("p", { className: "grow truncate whitespace-nowrap", children: dataKey }),
|
|
8421
|
+
score !== void 0 && /* @__PURE__ */ jsx59("span", { className: "shrink-0 text-xs text-zinc-400", children: score.toFixed(2) }),
|
|
8422
|
+
isKeySelected && /* @__PURE__ */ jsx59(IconChevronRight3, { className: "shrink-0 text-zinc-500", size: 20 })
|
|
8010
8423
|
]
|
|
8011
8424
|
}
|
|
8012
8425
|
);
|
|
8013
8426
|
};
|
|
8014
8427
|
|
|
8015
8428
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
8016
|
-
import { jsx as
|
|
8429
|
+
import { jsx as jsx60, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
8017
8430
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
8018
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
8019
|
-
/* @__PURE__ */
|
|
8020
|
-
/* @__PURE__ */
|
|
8431
|
+
var LoadingSkeleton = () => /* @__PURE__ */ jsx60("div", { className: "block h-full w-full rounded-lg bg-zinc-100 p-1 pr-3 transition-all", children: Array.from({ length: DEFAULT_SKELETON_COUNT }).fill(0).map((_, idx) => /* @__PURE__ */ jsxs36("div", { className: "flex h-10 items-center gap-2 px-3", children: [
|
|
8432
|
+
/* @__PURE__ */ jsx60(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
8433
|
+
/* @__PURE__ */ jsx60(Skeleton, { className: "h-4 grow rounded" })
|
|
8021
8434
|
] }, idx)) });
|
|
8022
8435
|
|
|
8023
8436
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
8024
|
-
import { jsx as
|
|
8437
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
8025
8438
|
function Sidebar() {
|
|
8026
8439
|
const { keys, query } = useKeys();
|
|
8027
|
-
return /* @__PURE__ */
|
|
8440
|
+
return /* @__PURE__ */ jsx61("div", { className: "flex h-full flex-col gap-2", children: query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx61(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
8028
8441
|
// Infinite scroll already has a loader at the bottom
|
|
8029
|
-
/* @__PURE__ */
|
|
8442
|
+
/* @__PURE__ */ jsx61(
|
|
8030
8443
|
InfiniteScroll,
|
|
8031
8444
|
{
|
|
8032
8445
|
query,
|
|
8033
8446
|
disableRoundedInherit: true,
|
|
8034
8447
|
className: "min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4",
|
|
8035
8448
|
scrollBarClassName: "py-5",
|
|
8036
|
-
children: /* @__PURE__ */
|
|
8449
|
+
children: /* @__PURE__ */ jsx61(KeysList, {})
|
|
8037
8450
|
}
|
|
8038
8451
|
)
|
|
8039
|
-
) : /* @__PURE__ */
|
|
8452
|
+
) : /* @__PURE__ */ jsx61(Empty, {}) });
|
|
8040
8453
|
}
|
|
8041
8454
|
|
|
8042
8455
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
8043
|
-
import { useEffect as
|
|
8456
|
+
import { useCallback as useCallback4, useEffect as useEffect17, useRef as useRef8, useState as useState22 } from "react";
|
|
8044
8457
|
|
|
8045
8458
|
// src/components/databrowser/components/ui-query-builder/query-builder-context.tsx
|
|
8046
8459
|
import { createContext as createContext6, useCallback as useCallback2, useContext as useContext6, useMemo as useMemo10 } from "react";
|
|
8047
8460
|
|
|
8048
8461
|
// src/components/databrowser/components/ui-query-builder/types.ts
|
|
8049
|
-
var STRING_OPERATORS = [
|
|
8462
|
+
var STRING_OPERATORS = [
|
|
8463
|
+
"eq",
|
|
8464
|
+
"ne",
|
|
8465
|
+
"in",
|
|
8466
|
+
"phrase",
|
|
8467
|
+
"regex",
|
|
8468
|
+
"fuzzy",
|
|
8469
|
+
"smart"
|
|
8470
|
+
];
|
|
8050
8471
|
var NUMBER_OPERATORS = ["eq", "ne", "gt", "gte", "lt", "lte", "in"];
|
|
8051
|
-
var BOOLEAN_OPERATORS = ["eq", "ne"];
|
|
8472
|
+
var BOOLEAN_OPERATORS = ["eq", "ne", "in"];
|
|
8052
8473
|
var DATE_OPERATORS = ["eq", "ne", "gt", "gte", "lt", "lte", "in"];
|
|
8053
8474
|
var ALL_OPERATORS = [
|
|
8054
8475
|
"eq",
|
|
@@ -8058,8 +8479,10 @@ var ALL_OPERATORS = [
|
|
|
8058
8479
|
"lt",
|
|
8059
8480
|
"lte",
|
|
8060
8481
|
"in",
|
|
8061
|
-
"
|
|
8062
|
-
"
|
|
8482
|
+
"phrase",
|
|
8483
|
+
"regex",
|
|
8484
|
+
"fuzzy",
|
|
8485
|
+
"smart"
|
|
8063
8486
|
];
|
|
8064
8487
|
var OPERATOR_OPTIONS = [
|
|
8065
8488
|
{ value: "eq", label: "eq" },
|
|
@@ -8069,8 +8492,10 @@ var OPERATOR_OPTIONS = [
|
|
|
8069
8492
|
{ value: "lt", label: "lt" },
|
|
8070
8493
|
{ value: "lte", label: "lte" },
|
|
8071
8494
|
{ value: "in", label: "in" },
|
|
8072
|
-
{ value: "
|
|
8073
|
-
{ value: "
|
|
8495
|
+
{ value: "phrase", label: "phrase" },
|
|
8496
|
+
{ value: "regex", label: "regex" },
|
|
8497
|
+
{ value: "fuzzy", label: "fuzzy" },
|
|
8498
|
+
{ value: "smart", label: "smart" }
|
|
8074
8499
|
];
|
|
8075
8500
|
var getOperatorsForFieldType = (fieldType) => {
|
|
8076
8501
|
switch (fieldType) {
|
|
@@ -8152,6 +8577,8 @@ var parseFieldCondition = (field, fieldValue) => {
|
|
|
8152
8577
|
let operator = "eq";
|
|
8153
8578
|
let value = "";
|
|
8154
8579
|
let fuzzyDistance;
|
|
8580
|
+
let phraseSlop;
|
|
8581
|
+
let phrasePrefix;
|
|
8155
8582
|
let boost;
|
|
8156
8583
|
for (const op of ALL_OPERATORS) {
|
|
8157
8584
|
const key = `$${op}`;
|
|
@@ -8163,6 +8590,12 @@ var parseFieldCondition = (field, fieldValue) => {
|
|
|
8163
8590
|
value = fuzzyObj.value ?? "";
|
|
8164
8591
|
fuzzyDistance = fuzzyObj.distance ?? 1;
|
|
8165
8592
|
}
|
|
8593
|
+
if (op === "phrase" && typeof value === "object" && value !== null) {
|
|
8594
|
+
const phraseObj = value;
|
|
8595
|
+
value = phraseObj.value ?? "";
|
|
8596
|
+
phraseSlop = phraseObj.slop;
|
|
8597
|
+
phrasePrefix = phraseObj.prefix;
|
|
8598
|
+
}
|
|
8166
8599
|
break;
|
|
8167
8600
|
}
|
|
8168
8601
|
}
|
|
@@ -8177,6 +8610,8 @@ var parseFieldCondition = (field, fieldValue) => {
|
|
|
8177
8610
|
operator,
|
|
8178
8611
|
value,
|
|
8179
8612
|
fuzzyDistance,
|
|
8613
|
+
phraseSlop,
|
|
8614
|
+
phrasePrefix,
|
|
8180
8615
|
boost
|
|
8181
8616
|
}
|
|
8182
8617
|
};
|
|
@@ -8360,7 +8795,7 @@ var createInitialQueryState = () => ({
|
|
|
8360
8795
|
});
|
|
8361
8796
|
|
|
8362
8797
|
// src/components/databrowser/components/ui-query-builder/query-builder-context.tsx
|
|
8363
|
-
import { jsx as
|
|
8798
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
8364
8799
|
var QueryBuilderUIContext = createContext6(null);
|
|
8365
8800
|
var QueryBuilderUIProvider = ({
|
|
8366
8801
|
children,
|
|
@@ -8416,7 +8851,7 @@ var QueryBuilderUIProvider = ({
|
|
|
8416
8851
|
}),
|
|
8417
8852
|
[fieldInfos, updateNode, deleteNode, addChildToGroup, moveNode]
|
|
8418
8853
|
);
|
|
8419
|
-
return /* @__PURE__ */
|
|
8854
|
+
return /* @__PURE__ */ jsx62(QueryBuilderUIContext.Provider, { value, children });
|
|
8420
8855
|
};
|
|
8421
8856
|
var useQueryBuilderUI = () => {
|
|
8422
8857
|
const context = useContext6(QueryBuilderUIContext);
|
|
@@ -8494,16 +8929,16 @@ var moveNodeInTree = (root2, nodeId, newParentId, newIndex) => {
|
|
|
8494
8929
|
};
|
|
8495
8930
|
|
|
8496
8931
|
// src/components/databrowser/components/ui-query-builder/query-group.tsx
|
|
8497
|
-
import { useState as
|
|
8932
|
+
import { useState as useState20 } from "react";
|
|
8498
8933
|
import { IconGripVertical as IconGripVertical3, IconPlus as IconPlus3, IconX as IconX4 } from "@tabler/icons-react";
|
|
8499
8934
|
|
|
8500
8935
|
// src/components/databrowser/components/ui-query-builder/condition-common.tsx
|
|
8501
|
-
import { useState as
|
|
8936
|
+
import { useState as useState17 } from "react";
|
|
8502
8937
|
import { IconDots } from "@tabler/icons-react";
|
|
8503
8938
|
|
|
8504
8939
|
// src/components/databrowser/components/ui-query-builder/dynamic-width-input.tsx
|
|
8505
|
-
import { useLayoutEffect, useRef as useRef6, useState as
|
|
8506
|
-
import { jsx as
|
|
8940
|
+
import { useLayoutEffect, useRef as useRef6, useState as useState16 } from "react";
|
|
8941
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
8507
8942
|
var measureContext = null;
|
|
8508
8943
|
var getTextWidth = (text, font) => {
|
|
8509
8944
|
if (!measureContext) {
|
|
@@ -8526,7 +8961,7 @@ var DynamicWidthInput = ({
|
|
|
8526
8961
|
placeholder
|
|
8527
8962
|
}) => {
|
|
8528
8963
|
const inputRef = useRef6(null);
|
|
8529
|
-
const [width, setWidth] =
|
|
8964
|
+
const [width, setWidth] = useState16(minWidth);
|
|
8530
8965
|
useLayoutEffect(() => {
|
|
8531
8966
|
if (inputRef.current) {
|
|
8532
8967
|
const computedStyle = window.getComputedStyle(inputRef.current);
|
|
@@ -8535,7 +8970,7 @@ var DynamicWidthInput = ({
|
|
|
8535
8970
|
setWidth(Math.max(Math.ceil(textWidth), minWidth));
|
|
8536
8971
|
}
|
|
8537
8972
|
}, [value, minWidth, placeholder]);
|
|
8538
|
-
return /* @__PURE__ */
|
|
8973
|
+
return /* @__PURE__ */ jsx63(
|
|
8539
8974
|
"input",
|
|
8540
8975
|
{
|
|
8541
8976
|
ref: inputRef,
|
|
@@ -8552,14 +8987,14 @@ var DynamicWidthInput = ({
|
|
|
8552
8987
|
};
|
|
8553
8988
|
|
|
8554
8989
|
// src/components/databrowser/components/ui-query-builder/condition-common.tsx
|
|
8555
|
-
import { jsx as
|
|
8990
|
+
import { jsx as jsx64, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
8556
8991
|
var BoostBadge = ({
|
|
8557
8992
|
node,
|
|
8558
8993
|
static: isStatic
|
|
8559
8994
|
}) => {
|
|
8560
8995
|
const { updateNode } = useQueryBuilderUI();
|
|
8561
|
-
const [localValue, setLocalValue] =
|
|
8562
|
-
const [isFocused, setIsFocused] =
|
|
8996
|
+
const [localValue, setLocalValue] = useState17(String(node.boost ?? 0));
|
|
8997
|
+
const [isFocused, setIsFocused] = useState17(false);
|
|
8563
8998
|
const boostStr = String(node.boost ?? 0);
|
|
8564
8999
|
if (!isFocused && localValue !== boostStr) {
|
|
8565
9000
|
setLocalValue(boostStr);
|
|
@@ -8581,9 +9016,9 @@ var BoostBadge = ({
|
|
|
8581
9016
|
const isNegative = (node.boost ?? 0) < 0;
|
|
8582
9017
|
const labelBg = isNegative ? "bg-red-50" : "bg-purple-50";
|
|
8583
9018
|
const textColor = isNegative ? "text-red-800" : "text-purple-800";
|
|
8584
|
-
return /* @__PURE__ */
|
|
8585
|
-
/* @__PURE__ */
|
|
8586
|
-
isStatic ? /* @__PURE__ */
|
|
9019
|
+
return /* @__PURE__ */ jsxs37("span", { className: "relative flex h-[26px] items-center overflow-hidden rounded-md border border-zinc-300 text-sm font-medium", children: [
|
|
9020
|
+
/* @__PURE__ */ jsx64("span", { className: `flex h-full items-center px-2 ${labelBg} ${textColor}`, children: isNegative ? "Demote" : "Boost" }),
|
|
9021
|
+
isStatic ? /* @__PURE__ */ jsx64("span", { className: `px-2 ${textColor}`, children: node.boost }) : /* @__PURE__ */ jsx64("span", { className: "flex h-full items-center bg-white px-2", children: /* @__PURE__ */ jsx64(
|
|
8587
9022
|
DynamicWidthInput,
|
|
8588
9023
|
{
|
|
8589
9024
|
value: localValue,
|
|
@@ -8596,32 +9031,32 @@ var BoostBadge = ({
|
|
|
8596
9031
|
) })
|
|
8597
9032
|
] });
|
|
8598
9033
|
};
|
|
8599
|
-
var NotBadge = () => /* @__PURE__ */
|
|
9034
|
+
var NotBadge = () => /* @__PURE__ */ jsx64("span", { className: "flex h-[26px] items-center rounded-md border border-zinc-300 bg-amber-50 px-2 text-sm font-medium text-amber-800", children: "Not" });
|
|
8600
9035
|
var NodeActionsMenu = ({ node }) => {
|
|
8601
9036
|
const { updateNode } = useQueryBuilderUI();
|
|
8602
|
-
const [open, setOpen] =
|
|
9037
|
+
const [open, setOpen] = useState17(false);
|
|
8603
9038
|
const handleToggleBoost = () => {
|
|
8604
9039
|
updateNode(node.id, { boost: node.boost ? void 0 : 2 });
|
|
8605
9040
|
};
|
|
8606
9041
|
const handleToggleNot = () => {
|
|
8607
9042
|
updateNode(node.id, { not: !node.not });
|
|
8608
9043
|
};
|
|
8609
|
-
return /* @__PURE__ */
|
|
8610
|
-
/* @__PURE__ */
|
|
9044
|
+
return /* @__PURE__ */ jsxs37(DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
9045
|
+
/* @__PURE__ */ jsx64(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx64(
|
|
8611
9046
|
"button",
|
|
8612
9047
|
{
|
|
8613
9048
|
type: "button",
|
|
8614
9049
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-zinc-700",
|
|
8615
|
-
children: /* @__PURE__ */
|
|
9050
|
+
children: /* @__PURE__ */ jsx64(IconDots, { size: 16 })
|
|
8616
9051
|
}
|
|
8617
9052
|
) }),
|
|
8618
|
-
/* @__PURE__ */
|
|
8619
|
-
/* @__PURE__ */
|
|
8620
|
-
/* @__PURE__ */
|
|
9053
|
+
/* @__PURE__ */ jsxs37(DropdownMenuContent, { align: "end", children: [
|
|
9054
|
+
/* @__PURE__ */ jsx64(DropdownMenuItem, { onClick: handleToggleBoost, children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
|
|
9055
|
+
/* @__PURE__ */ jsx64(
|
|
8621
9056
|
"div",
|
|
8622
9057
|
{
|
|
8623
9058
|
className: `h-4 w-8 rounded-full transition-colors ${node.boost === void 0 ? "bg-zinc-200" : "bg-emerald-500"}`,
|
|
8624
|
-
children: /* @__PURE__ */
|
|
9059
|
+
children: /* @__PURE__ */ jsx64(
|
|
8625
9060
|
"div",
|
|
8626
9061
|
{
|
|
8627
9062
|
className: `h-4 w-4 transform rounded-full bg-white shadow transition-transform ${node.boost === void 0 ? "translate-x-0" : "translate-x-4"}`
|
|
@@ -8629,14 +9064,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
8629
9064
|
)
|
|
8630
9065
|
}
|
|
8631
9066
|
),
|
|
8632
|
-
/* @__PURE__ */
|
|
9067
|
+
/* @__PURE__ */ jsx64("span", { children: "Boost" })
|
|
8633
9068
|
] }) }),
|
|
8634
|
-
/* @__PURE__ */
|
|
8635
|
-
/* @__PURE__ */
|
|
9069
|
+
/* @__PURE__ */ jsx64(DropdownMenuItem, { onClick: handleToggleNot, children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
|
|
9070
|
+
/* @__PURE__ */ jsx64(
|
|
8636
9071
|
"div",
|
|
8637
9072
|
{
|
|
8638
9073
|
className: `h-4 w-8 rounded-full transition-colors ${node.not ? "bg-emerald-500" : "bg-zinc-200"}`,
|
|
8639
|
-
children: /* @__PURE__ */
|
|
9074
|
+
children: /* @__PURE__ */ jsx64(
|
|
8640
9075
|
"div",
|
|
8641
9076
|
{
|
|
8642
9077
|
className: `h-4 w-4 transform rounded-full bg-white shadow transition-transform ${node.not ? "translate-x-4" : "translate-x-0"}`
|
|
@@ -8644,14 +9079,14 @@ var NodeActionsMenu = ({ node }) => {
|
|
|
8644
9079
|
)
|
|
8645
9080
|
}
|
|
8646
9081
|
),
|
|
8647
|
-
/* @__PURE__ */
|
|
9082
|
+
/* @__PURE__ */ jsx64("span", { children: "Not" })
|
|
8648
9083
|
] }) })
|
|
8649
9084
|
] })
|
|
8650
9085
|
] });
|
|
8651
9086
|
};
|
|
8652
9087
|
|
|
8653
9088
|
// src/components/databrowser/components/ui-query-builder/dnd-context.tsx
|
|
8654
|
-
import { useState as
|
|
9089
|
+
import { useState as useState19 } from "react";
|
|
8655
9090
|
import {
|
|
8656
9091
|
DndContext,
|
|
8657
9092
|
PointerSensor,
|
|
@@ -8665,9 +9100,9 @@ import { DragOverlay as DndKitDragOverlay } from "@dnd-kit/core";
|
|
|
8665
9100
|
import { IconGripVertical as IconGripVertical2 } from "@tabler/icons-react";
|
|
8666
9101
|
|
|
8667
9102
|
// src/components/databrowser/components/ui-query-builder/query-condition.tsx
|
|
8668
|
-
import { useEffect as
|
|
9103
|
+
import { useEffect as useEffect15, useState as useState18 } from "react";
|
|
8669
9104
|
import { IconGripVertical, IconX as IconX3 } from "@tabler/icons-react";
|
|
8670
|
-
import { jsx as
|
|
9105
|
+
import { Fragment as Fragment13, jsx as jsx65, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
8671
9106
|
var formatValueForDisplay = (value) => {
|
|
8672
9107
|
if (Array.isArray(value)) {
|
|
8673
9108
|
return value.join(", ");
|
|
@@ -8685,8 +9120,8 @@ var QueryCondition = ({
|
|
|
8685
9120
|
const { fieldInfos, updateNode, deleteNode } = useQueryBuilderUI();
|
|
8686
9121
|
const { condition } = node;
|
|
8687
9122
|
const fieldNames = fieldInfos.map((f) => f.name);
|
|
8688
|
-
const [localValue, setLocalValue] =
|
|
8689
|
-
const [isValueFocused, setIsValueFocused] =
|
|
9123
|
+
const [localValue, setLocalValue] = useState18(() => formatValueForDisplay(condition.value));
|
|
9124
|
+
const [isValueFocused, setIsValueFocused] = useState18(false);
|
|
8690
9125
|
const formattedConditionValue = formatValueForDisplay(condition.value);
|
|
8691
9126
|
if (!isValueFocused && localValue !== formattedConditionValue) {
|
|
8692
9127
|
setLocalValue(formattedConditionValue);
|
|
@@ -8718,7 +9153,7 @@ var QueryCondition = ({
|
|
|
8718
9153
|
return void 0;
|
|
8719
9154
|
};
|
|
8720
9155
|
const valueTypeError = getValueTypeError();
|
|
8721
|
-
|
|
9156
|
+
useEffect15(() => {
|
|
8722
9157
|
if (currentFieldType === "boolean") {
|
|
8723
9158
|
if (condition.value === "true") {
|
|
8724
9159
|
updateNode(node.id, {
|
|
@@ -8782,10 +9217,18 @@ var QueryCondition = ({
|
|
|
8782
9217
|
} else if (value !== "fuzzy") {
|
|
8783
9218
|
updates.fuzzyDistance = void 0;
|
|
8784
9219
|
}
|
|
9220
|
+
if (value !== "phrase") {
|
|
9221
|
+
updates.phraseSlop = void 0;
|
|
9222
|
+
updates.phrasePrefix = void 0;
|
|
9223
|
+
}
|
|
8785
9224
|
if (value === "in" && !Array.isArray(condition.value)) {
|
|
8786
|
-
|
|
9225
|
+
if (currentFieldType === "boolean") {
|
|
9226
|
+
updates.value = [String(condition.value)];
|
|
9227
|
+
} else {
|
|
9228
|
+
updates.value = condition.value ? [String(condition.value)] : [];
|
|
9229
|
+
}
|
|
8787
9230
|
} else if (value !== "in" && Array.isArray(condition.value)) {
|
|
8788
|
-
updates.value = condition.value[0] || "";
|
|
9231
|
+
updates.value = currentFieldType === "boolean" ? Boolean(condition.value.includes("true")) : condition.value[0] || "";
|
|
8789
9232
|
}
|
|
8790
9233
|
updateNode(node.id, {
|
|
8791
9234
|
...node,
|
|
@@ -8825,6 +9268,54 @@ var QueryCondition = ({
|
|
|
8825
9268
|
condition: { ...condition, fuzzyDistance: distance }
|
|
8826
9269
|
});
|
|
8827
9270
|
};
|
|
9271
|
+
const phraseMode = condition.phrasePrefix ? "prefix" : condition.phraseSlop === void 0 ? "exact" : "slop";
|
|
9272
|
+
const handlePhraseModeChange = (mode) => {
|
|
9273
|
+
const updates = {};
|
|
9274
|
+
switch (mode) {
|
|
9275
|
+
case "exact": {
|
|
9276
|
+
updates.phraseSlop = void 0;
|
|
9277
|
+
updates.phrasePrefix = void 0;
|
|
9278
|
+
break;
|
|
9279
|
+
}
|
|
9280
|
+
case "slop": {
|
|
9281
|
+
updates.phraseSlop = condition.phraseSlop ?? 1;
|
|
9282
|
+
updates.phrasePrefix = void 0;
|
|
9283
|
+
break;
|
|
9284
|
+
}
|
|
9285
|
+
case "prefix": {
|
|
9286
|
+
updates.phraseSlop = void 0;
|
|
9287
|
+
updates.phrasePrefix = true;
|
|
9288
|
+
break;
|
|
9289
|
+
}
|
|
9290
|
+
}
|
|
9291
|
+
updateNode(node.id, {
|
|
9292
|
+
...node,
|
|
9293
|
+
condition: { ...condition, ...updates }
|
|
9294
|
+
});
|
|
9295
|
+
};
|
|
9296
|
+
const [localSlop, setLocalSlop] = useState18(String(condition.phraseSlop ?? 1));
|
|
9297
|
+
const [isSlopFocused, setIsSlopFocused] = useState18(false);
|
|
9298
|
+
const slopStr = String(condition.phraseSlop ?? 1);
|
|
9299
|
+
if (!isSlopFocused && localSlop !== slopStr) {
|
|
9300
|
+
setLocalSlop(slopStr);
|
|
9301
|
+
}
|
|
9302
|
+
const handlePhraseSlopChange = (value) => {
|
|
9303
|
+
setLocalSlop(value);
|
|
9304
|
+
const slop = Number(value);
|
|
9305
|
+
if (!Number.isNaN(slop) && value !== "" && slop >= 0) {
|
|
9306
|
+
updateNode(node.id, {
|
|
9307
|
+
...node,
|
|
9308
|
+
condition: { ...condition, phraseSlop: slop }
|
|
9309
|
+
});
|
|
9310
|
+
}
|
|
9311
|
+
};
|
|
9312
|
+
const handlePhraseSlopBlur = () => {
|
|
9313
|
+
setIsSlopFocused(false);
|
|
9314
|
+
const slop = Number(localSlop);
|
|
9315
|
+
if (Number.isNaN(slop) || localSlop === "") {
|
|
9316
|
+
setLocalSlop(String(condition.phraseSlop ?? 1));
|
|
9317
|
+
}
|
|
9318
|
+
};
|
|
8828
9319
|
const handleDelete = () => {
|
|
8829
9320
|
deleteNode(node.id);
|
|
8830
9321
|
};
|
|
@@ -8832,48 +9323,48 @@ var QueryCondition = ({
|
|
|
8832
9323
|
const filteredOperators = OPERATOR_OPTIONS.filter((op) => allowedOperators.includes(op.value));
|
|
8833
9324
|
const isInvalidOperator = !isUnknownField && currentFieldType !== "unknown" && !allowedOperators.includes(condition.operator);
|
|
8834
9325
|
const operatorError = isInvalidOperator ? `"${condition.operator}" is not valid for ${currentFieldType} fields` : void 0;
|
|
8835
|
-
return /* @__PURE__ */
|
|
8836
|
-
/* @__PURE__ */
|
|
9326
|
+
return /* @__PURE__ */ jsxs38("div", { className: "group/condition flex items-center gap-1 px-1", children: [
|
|
9327
|
+
/* @__PURE__ */ jsx65(
|
|
8837
9328
|
"div",
|
|
8838
9329
|
{
|
|
8839
9330
|
ref: dragHandleProps?.ref,
|
|
8840
9331
|
className: "flex cursor-grab items-center px-1 text-zinc-400 hover:text-zinc-600",
|
|
8841
9332
|
...dragHandleProps?.attributes,
|
|
8842
9333
|
...dragHandleProps?.listeners,
|
|
8843
|
-
children: /* @__PURE__ */
|
|
9334
|
+
children: /* @__PURE__ */ jsx65(IconGripVertical, { size: 16 })
|
|
8844
9335
|
}
|
|
8845
9336
|
),
|
|
8846
|
-
/* @__PURE__ */
|
|
8847
|
-
/* @__PURE__ */
|
|
8848
|
-
/* @__PURE__ */
|
|
9337
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex", children: [
|
|
9338
|
+
/* @__PURE__ */ jsxs38(Select, { value: condition.field, onValueChange: handleFieldChange, children: [
|
|
9339
|
+
/* @__PURE__ */ jsx65(
|
|
8849
9340
|
SimpleTooltip,
|
|
8850
9341
|
{
|
|
8851
9342
|
content: isUnknownField ? "This field is not defined in the schema" : void 0,
|
|
8852
9343
|
variant: "error",
|
|
8853
|
-
children: /* @__PURE__ */
|
|
9344
|
+
children: /* @__PURE__ */ jsx65(
|
|
8854
9345
|
SelectTrigger,
|
|
8855
9346
|
{
|
|
8856
9347
|
className: `h-[26px] w-32 gap-3 rounded-none rounded-l-md border-r-0 border-zinc-200 bg-white px-2 text-sm font-normal ${isUnknownField ? "text-red-500" : ""}`,
|
|
8857
|
-
children: /* @__PURE__ */
|
|
9348
|
+
children: /* @__PURE__ */ jsx65(SelectValue, { placeholder: "Select field" })
|
|
8858
9349
|
}
|
|
8859
9350
|
)
|
|
8860
9351
|
}
|
|
8861
9352
|
),
|
|
8862
|
-
/* @__PURE__ */
|
|
8863
|
-
isUnknownField && /* @__PURE__ */
|
|
8864
|
-
fieldNames.length > 0 ? fieldNames.map((field) => /* @__PURE__ */
|
|
9353
|
+
/* @__PURE__ */ jsxs38(SelectContent, { children: [
|
|
9354
|
+
isUnknownField && /* @__PURE__ */ jsx65(SelectItem, { value: condition.field, className: "text-red-500", children: condition.field }, condition.field),
|
|
9355
|
+
fieldNames.length > 0 ? fieldNames.map((field) => /* @__PURE__ */ jsx65(SelectItem, { value: field, children: field }, field)) : !isUnknownField && /* @__PURE__ */ jsx65("div", { className: "px-2 py-1.5 text-sm text-zinc-500", children: "No fields available" })
|
|
8865
9356
|
] })
|
|
8866
9357
|
] }),
|
|
8867
|
-
/* @__PURE__ */
|
|
8868
|
-
/* @__PURE__ */
|
|
9358
|
+
/* @__PURE__ */ jsxs38(Select, { value: condition.operator, onValueChange: handleOperatorChange, children: [
|
|
9359
|
+
/* @__PURE__ */ jsx65(SimpleTooltip, { content: operatorError || valueTypeError, variant: "error", children: /* @__PURE__ */ jsx65(
|
|
8869
9360
|
SelectTrigger,
|
|
8870
9361
|
{
|
|
8871
9362
|
className: `h-[26px] w-24 gap-3 rounded-none border-r-0 border-zinc-200 px-2 text-sm font-normal ${operatorError || valueTypeError ? "text-red-500" : ""}`,
|
|
8872
|
-
children: /* @__PURE__ */
|
|
9363
|
+
children: /* @__PURE__ */ jsx65(SelectValue, {})
|
|
8873
9364
|
}
|
|
8874
9365
|
) }),
|
|
8875
|
-
/* @__PURE__ */
|
|
8876
|
-
isInvalidOperator && /* @__PURE__ */
|
|
9366
|
+
/* @__PURE__ */ jsxs38(SelectContent, { children: [
|
|
9367
|
+
isInvalidOperator && /* @__PURE__ */ jsx65(
|
|
8877
9368
|
SelectItem,
|
|
8878
9369
|
{
|
|
8879
9370
|
value: condition.operator,
|
|
@@ -8882,10 +9373,49 @@ var QueryCondition = ({
|
|
|
8882
9373
|
},
|
|
8883
9374
|
condition.operator
|
|
8884
9375
|
),
|
|
8885
|
-
filteredOperators.map((op) => /* @__PURE__ */
|
|
9376
|
+
filteredOperators.map((op) => /* @__PURE__ */ jsx65(SelectItem, { value: op.value, children: op.label }, op.value))
|
|
8886
9377
|
] })
|
|
8887
9378
|
] }),
|
|
8888
|
-
currentFieldType === "boolean" ? /* @__PURE__ */
|
|
9379
|
+
currentFieldType === "boolean" && condition.operator === "in" ? /* @__PURE__ */ jsxs38("div", { className: "flex h-[26px] items-center gap-2 rounded-none rounded-r-md border border-zinc-200 bg-white px-2 text-sm", children: [
|
|
9380
|
+
/* @__PURE__ */ jsxs38("label", { className: "flex items-center gap-1", children: [
|
|
9381
|
+
/* @__PURE__ */ jsx65(
|
|
9382
|
+
"input",
|
|
9383
|
+
{
|
|
9384
|
+
type: "checkbox",
|
|
9385
|
+
checked: Array.isArray(condition.value) && condition.value.includes("true"),
|
|
9386
|
+
onChange: (e) => {
|
|
9387
|
+
const current = Array.isArray(condition.value) ? condition.value : [];
|
|
9388
|
+
const next = e.target.checked ? [...current.filter((v) => v !== "true"), "true"] : current.filter((v) => v !== "true");
|
|
9389
|
+
updateNode(node.id, {
|
|
9390
|
+
...node,
|
|
9391
|
+
condition: { ...condition, value: next }
|
|
9392
|
+
});
|
|
9393
|
+
},
|
|
9394
|
+
className: "h-3 w-3"
|
|
9395
|
+
}
|
|
9396
|
+
),
|
|
9397
|
+
/* @__PURE__ */ jsx65("span", { children: "true" })
|
|
9398
|
+
] }),
|
|
9399
|
+
/* @__PURE__ */ jsxs38("label", { className: "flex items-center gap-1", children: [
|
|
9400
|
+
/* @__PURE__ */ jsx65(
|
|
9401
|
+
"input",
|
|
9402
|
+
{
|
|
9403
|
+
type: "checkbox",
|
|
9404
|
+
checked: Array.isArray(condition.value) && condition.value.includes("false"),
|
|
9405
|
+
onChange: (e) => {
|
|
9406
|
+
const current = Array.isArray(condition.value) ? condition.value : [];
|
|
9407
|
+
const next = e.target.checked ? [...current.filter((v) => v !== "false"), "false"] : current.filter((v) => v !== "false");
|
|
9408
|
+
updateNode(node.id, {
|
|
9409
|
+
...node,
|
|
9410
|
+
condition: { ...condition, value: next }
|
|
9411
|
+
});
|
|
9412
|
+
},
|
|
9413
|
+
className: "h-3 w-3"
|
|
9414
|
+
}
|
|
9415
|
+
),
|
|
9416
|
+
/* @__PURE__ */ jsx65("span", { children: "false" })
|
|
9417
|
+
] })
|
|
9418
|
+
] }) : currentFieldType === "boolean" ? /* @__PURE__ */ jsxs38(
|
|
8889
9419
|
Select,
|
|
8890
9420
|
{
|
|
8891
9421
|
value: condition.value === true || condition.value === "true" ? "true" : condition.value === false || condition.value === "false" ? "false" : "true",
|
|
@@ -8897,14 +9427,14 @@ var QueryCondition = ({
|
|
|
8897
9427
|
});
|
|
8898
9428
|
},
|
|
8899
9429
|
children: [
|
|
8900
|
-
/* @__PURE__ */
|
|
8901
|
-
/* @__PURE__ */
|
|
8902
|
-
/* @__PURE__ */
|
|
8903
|
-
/* @__PURE__ */
|
|
9430
|
+
/* @__PURE__ */ jsx65(SelectTrigger, { className: "h-[26px] w-20 gap-3 rounded-none rounded-r-md border border-zinc-200 bg-white px-2 text-sm font-normal", children: /* @__PURE__ */ jsx65(SelectValue, {}) }),
|
|
9431
|
+
/* @__PURE__ */ jsxs38(SelectContent, { children: [
|
|
9432
|
+
/* @__PURE__ */ jsx65(SelectItem, { value: "true", children: "true" }),
|
|
9433
|
+
/* @__PURE__ */ jsx65(SelectItem, { value: "false", children: "false" })
|
|
8904
9434
|
] })
|
|
8905
9435
|
]
|
|
8906
9436
|
}
|
|
8907
|
-
) : /* @__PURE__ */
|
|
9437
|
+
) : /* @__PURE__ */ jsx65(
|
|
8908
9438
|
"input",
|
|
8909
9439
|
{
|
|
8910
9440
|
type: "text",
|
|
@@ -8917,34 +9447,56 @@ var QueryCondition = ({
|
|
|
8917
9447
|
}
|
|
8918
9448
|
)
|
|
8919
9449
|
] }),
|
|
8920
|
-
condition.operator === "fuzzy" && /* @__PURE__ */
|
|
9450
|
+
condition.operator === "fuzzy" && /* @__PURE__ */ jsxs38(
|
|
8921
9451
|
Select,
|
|
8922
9452
|
{
|
|
8923
9453
|
value: String(condition.fuzzyDistance || 1),
|
|
8924
9454
|
onValueChange: handleFuzzyDistanceChange,
|
|
8925
9455
|
children: [
|
|
8926
|
-
/* @__PURE__ */
|
|
8927
|
-
/* @__PURE__ */
|
|
8928
|
-
/* @__PURE__ */
|
|
8929
|
-
/* @__PURE__ */
|
|
9456
|
+
/* @__PURE__ */ jsx65(SelectTrigger, { className: "h-[26px] w-16 gap-3 border-zinc-200 bg-white px-2 text-sm", children: /* @__PURE__ */ jsx65(SelectValue, {}) }),
|
|
9457
|
+
/* @__PURE__ */ jsxs38(SelectContent, { children: [
|
|
9458
|
+
/* @__PURE__ */ jsx65(SelectItem, { value: "1", children: "1" }),
|
|
9459
|
+
/* @__PURE__ */ jsx65(SelectItem, { value: "2", children: "2" })
|
|
8930
9460
|
] })
|
|
8931
9461
|
]
|
|
8932
9462
|
}
|
|
8933
9463
|
),
|
|
8934
|
-
|
|
8935
|
-
|
|
9464
|
+
condition.operator === "phrase" && /* @__PURE__ */ jsxs38(Fragment13, { children: [
|
|
9465
|
+
/* @__PURE__ */ jsxs38(Select, { value: phraseMode, onValueChange: handlePhraseModeChange, children: [
|
|
9466
|
+
/* @__PURE__ */ jsx65(SelectTrigger, { className: "h-[26px] w-20 gap-3 border-zinc-200 bg-white px-2 text-sm font-normal", children: /* @__PURE__ */ jsx65(SelectValue, {}) }),
|
|
9467
|
+
/* @__PURE__ */ jsxs38(SelectContent, { children: [
|
|
9468
|
+
/* @__PURE__ */ jsx65(SelectItem, { value: "exact", children: "exact" }),
|
|
9469
|
+
/* @__PURE__ */ jsx65(SelectItem, { value: "slop", children: "slop" }),
|
|
9470
|
+
/* @__PURE__ */ jsx65(SelectItem, { value: "prefix", children: "prefix" })
|
|
9471
|
+
] })
|
|
9472
|
+
] }),
|
|
9473
|
+
phraseMode === "slop" && /* @__PURE__ */ jsx65(
|
|
9474
|
+
"input",
|
|
9475
|
+
{
|
|
9476
|
+
type: "number",
|
|
9477
|
+
min: 0,
|
|
9478
|
+
value: localSlop,
|
|
9479
|
+
onChange: (e) => handlePhraseSlopChange(e.target.value),
|
|
9480
|
+
onFocus: () => setIsSlopFocused(true),
|
|
9481
|
+
onBlur: handlePhraseSlopBlur,
|
|
9482
|
+
className: "h-[26px] w-10 appearance-none rounded-md border border-zinc-200 bg-white px-2 text-sm focus:border-zinc-400 focus:outline-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
9483
|
+
}
|
|
9484
|
+
)
|
|
9485
|
+
] }),
|
|
9486
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx65(BoostBadge, { node }),
|
|
9487
|
+
/* @__PURE__ */ jsxs38(
|
|
8936
9488
|
"div",
|
|
8937
9489
|
{
|
|
8938
9490
|
className: `flex items-center gap-1 transition-all duration-100 ${isDragging ? "opacity-0" : "-translate-x-[2px] opacity-0 group-hover/condition:translate-x-0 group-hover/condition:opacity-100 has-[[data-state=open]]:translate-x-0 has-[[data-state=open]]:opacity-100"}`,
|
|
8939
9491
|
children: [
|
|
8940
|
-
/* @__PURE__ */
|
|
8941
|
-
/* @__PURE__ */
|
|
9492
|
+
/* @__PURE__ */ jsx65(NodeActionsMenu, { node }),
|
|
9493
|
+
/* @__PURE__ */ jsx65(
|
|
8942
9494
|
"button",
|
|
8943
9495
|
{
|
|
8944
9496
|
type: "button",
|
|
8945
9497
|
onClick: handleDelete,
|
|
8946
9498
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-red-500",
|
|
8947
|
-
children: /* @__PURE__ */
|
|
9499
|
+
children: /* @__PURE__ */ jsx65(IconX3, { size: 16 })
|
|
8948
9500
|
}
|
|
8949
9501
|
)
|
|
8950
9502
|
]
|
|
@@ -8954,12 +9506,12 @@ var QueryCondition = ({
|
|
|
8954
9506
|
};
|
|
8955
9507
|
|
|
8956
9508
|
// src/components/databrowser/components/ui-query-builder/drag-overlay.tsx
|
|
8957
|
-
import { jsx as
|
|
9509
|
+
import { jsx as jsx66, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8958
9510
|
var QueryDragOverlay = ({
|
|
8959
9511
|
activeNode,
|
|
8960
9512
|
onDropAnimationComplete
|
|
8961
9513
|
}) => {
|
|
8962
|
-
return /* @__PURE__ */
|
|
9514
|
+
return /* @__PURE__ */ jsx66(
|
|
8963
9515
|
DndKitDragOverlay,
|
|
8964
9516
|
{
|
|
8965
9517
|
dropAnimation: {
|
|
@@ -8972,16 +9524,16 @@ var QueryDragOverlay = ({
|
|
|
8972
9524
|
};
|
|
8973
9525
|
}
|
|
8974
9526
|
},
|
|
8975
|
-
children: activeNode && activeNode.type === "condition" ? /* @__PURE__ */
|
|
8976
|
-
/* @__PURE__ */
|
|
8977
|
-
/* @__PURE__ */
|
|
8978
|
-
] }) : activeNode && activeNode.type === "group" ? /* @__PURE__ */
|
|
8979
|
-
/* @__PURE__ */
|
|
8980
|
-
/* @__PURE__ */
|
|
8981
|
-
/* @__PURE__ */
|
|
8982
|
-
/* @__PURE__ */
|
|
8983
|
-
/* @__PURE__ */
|
|
8984
|
-
/* @__PURE__ */
|
|
9527
|
+
children: activeNode && activeNode.type === "condition" ? /* @__PURE__ */ jsxs39("div", { className: "relative -mt-1", children: [
|
|
9528
|
+
/* @__PURE__ */ jsx66("div", { className: "drag-overlay-bg absolute -bottom-1 -top-1 left-0 right-0 rounded-md border border-zinc-300 bg-zinc-100/90 shadow-md" }),
|
|
9529
|
+
/* @__PURE__ */ jsx66("div", { className: "relative", children: /* @__PURE__ */ jsx66(QueryCondition, { node: activeNode, isDragging: true }) })
|
|
9530
|
+
] }) : activeNode && activeNode.type === "group" ? /* @__PURE__ */ jsxs39("div", { className: "relative", children: [
|
|
9531
|
+
/* @__PURE__ */ jsx66("div", { className: "drag-overlay-bg absolute -bottom-1 -top-1 left-0 right-0 rounded-md border border-zinc-300 bg-zinc-100/90 shadow-md" }),
|
|
9532
|
+
/* @__PURE__ */ jsxs39("div", { className: "relative flex items-center gap-1", children: [
|
|
9533
|
+
/* @__PURE__ */ jsx66("div", { className: "flex cursor-grab items-center text-zinc-400", children: /* @__PURE__ */ jsx66(IconGripVertical2, { size: 16 }) }),
|
|
9534
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex h-[26px] w-16 items-center justify-between rounded-md border border-zinc-300 bg-blue-50 px-2 text-sm font-medium capitalize text-zinc-700", children: [
|
|
9535
|
+
/* @__PURE__ */ jsx66("span", { children: activeNode.groupOperator === "and" ? "And" : "Or" }),
|
|
9536
|
+
/* @__PURE__ */ jsx66(
|
|
8985
9537
|
"svg",
|
|
8986
9538
|
{
|
|
8987
9539
|
className: "text-zinc-400",
|
|
@@ -8990,7 +9542,7 @@ var QueryDragOverlay = ({
|
|
|
8990
9542
|
viewBox: "0 0 16 16",
|
|
8991
9543
|
fill: "none",
|
|
8992
9544
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8993
|
-
children: /* @__PURE__ */
|
|
9545
|
+
children: /* @__PURE__ */ jsx66(
|
|
8994
9546
|
"path",
|
|
8995
9547
|
{
|
|
8996
9548
|
d: "M4 6L8 10L12 6",
|
|
@@ -9004,8 +9556,8 @@ var QueryDragOverlay = ({
|
|
|
9004
9556
|
}
|
|
9005
9557
|
)
|
|
9006
9558
|
] }),
|
|
9007
|
-
activeNode.boost !== void 0 && /* @__PURE__ */
|
|
9008
|
-
activeNode.not && /* @__PURE__ */
|
|
9559
|
+
activeNode.boost !== void 0 && /* @__PURE__ */ jsx66(BoostBadge, { node: activeNode, static: true }),
|
|
9560
|
+
activeNode.not && /* @__PURE__ */ jsx66(NotBadge, {})
|
|
9009
9561
|
] })
|
|
9010
9562
|
] }) : null
|
|
9011
9563
|
}
|
|
@@ -9013,7 +9565,7 @@ var QueryDragOverlay = ({
|
|
|
9013
9565
|
};
|
|
9014
9566
|
|
|
9015
9567
|
// src/components/databrowser/components/ui-query-builder/dnd-context.tsx
|
|
9016
|
-
import { jsx as
|
|
9568
|
+
import { jsx as jsx67, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9017
9569
|
var QueryDndProvider = ({
|
|
9018
9570
|
children,
|
|
9019
9571
|
rootNode,
|
|
@@ -9021,7 +9573,7 @@ var QueryDndProvider = ({
|
|
|
9021
9573
|
setDroppingId
|
|
9022
9574
|
}) => {
|
|
9023
9575
|
const { moveNode } = useQueryBuilderUI();
|
|
9024
|
-
const [activeId, setActiveId] =
|
|
9576
|
+
const [activeId, setActiveId] = useState19(null);
|
|
9025
9577
|
const sensors = useSensors(
|
|
9026
9578
|
useSensor(PointerSensor, {
|
|
9027
9579
|
activationConstraint: {
|
|
@@ -9085,7 +9637,7 @@ var QueryDndProvider = ({
|
|
|
9085
9637
|
moveNode(activeIdStr, targetGroupId, adjustedIndex);
|
|
9086
9638
|
};
|
|
9087
9639
|
const activeNode = activeId ? findNodeById(rootNode, String(activeId)) : null;
|
|
9088
|
-
return /* @__PURE__ */
|
|
9640
|
+
return /* @__PURE__ */ jsxs40(
|
|
9089
9641
|
DndContext,
|
|
9090
9642
|
{
|
|
9091
9643
|
sensors,
|
|
@@ -9095,7 +9647,7 @@ var QueryDndProvider = ({
|
|
|
9095
9647
|
onDragEnd: handleDragEnd,
|
|
9096
9648
|
children: [
|
|
9097
9649
|
children,
|
|
9098
|
-
/* @__PURE__ */
|
|
9650
|
+
/* @__PURE__ */ jsx67(
|
|
9099
9651
|
QueryDragOverlay,
|
|
9100
9652
|
{
|
|
9101
9653
|
activeNode,
|
|
@@ -9132,7 +9684,7 @@ var findParentGroup = (root2, targetId) => {
|
|
|
9132
9684
|
|
|
9133
9685
|
// src/components/databrowser/components/ui-query-builder/draggable-item.tsx
|
|
9134
9686
|
import { useDraggable } from "@dnd-kit/core";
|
|
9135
|
-
import { jsx as
|
|
9687
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
9136
9688
|
var DraggableItem = ({
|
|
9137
9689
|
id,
|
|
9138
9690
|
children,
|
|
@@ -9143,7 +9695,7 @@ var DraggableItem = ({
|
|
|
9143
9695
|
});
|
|
9144
9696
|
const isDropAnimating = droppingId === id;
|
|
9145
9697
|
const childElement = children;
|
|
9146
|
-
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */
|
|
9698
|
+
const childWithDragHandle = typeof children === "object" && children !== null && "type" in childElement ? /* @__PURE__ */ jsx68(
|
|
9147
9699
|
childElement.type,
|
|
9148
9700
|
{
|
|
9149
9701
|
...childElement.props,
|
|
@@ -9154,7 +9706,7 @@ var DraggableItem = ({
|
|
|
9154
9706
|
}
|
|
9155
9707
|
}
|
|
9156
9708
|
) : children;
|
|
9157
|
-
return /* @__PURE__ */
|
|
9709
|
+
return /* @__PURE__ */ jsx68(
|
|
9158
9710
|
"div",
|
|
9159
9711
|
{
|
|
9160
9712
|
ref: setNodeRef,
|
|
@@ -9166,10 +9718,10 @@ var DraggableItem = ({
|
|
|
9166
9718
|
|
|
9167
9719
|
// src/components/databrowser/components/ui-query-builder/drop-zone.tsx
|
|
9168
9720
|
import { useDroppable } from "@dnd-kit/core";
|
|
9169
|
-
import { jsx as
|
|
9721
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
9170
9722
|
var DropIndicator = ({ id, isOver }) => {
|
|
9171
9723
|
const { setNodeRef } = useDroppable({ id });
|
|
9172
|
-
return /* @__PURE__ */
|
|
9724
|
+
return /* @__PURE__ */ jsx69("div", { ref: setNodeRef, className: `relative flex h-2 items-center`, children: /* @__PURE__ */ jsx69(
|
|
9173
9725
|
"div",
|
|
9174
9726
|
{
|
|
9175
9727
|
className: cn(
|
|
@@ -9181,7 +9733,7 @@ var DropIndicator = ({ id, isOver }) => {
|
|
|
9181
9733
|
};
|
|
9182
9734
|
var EmptyGroupDropZone = ({ groupId, isOver }) => {
|
|
9183
9735
|
const { setNodeRef } = useDroppable({ id: `drop-${groupId}-end` });
|
|
9184
|
-
return /* @__PURE__ */
|
|
9736
|
+
return /* @__PURE__ */ jsx69(
|
|
9185
9737
|
"div",
|
|
9186
9738
|
{
|
|
9187
9739
|
ref: setNodeRef,
|
|
@@ -9192,22 +9744,22 @@ var EmptyGroupDropZone = ({ groupId, isOver }) => {
|
|
|
9192
9744
|
};
|
|
9193
9745
|
|
|
9194
9746
|
// src/components/databrowser/components/ui-query-builder/query-group.tsx
|
|
9195
|
-
import { Fragment as
|
|
9747
|
+
import { Fragment as Fragment14, jsx as jsx70, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9196
9748
|
var ChildRow = ({
|
|
9197
9749
|
groupId,
|
|
9198
9750
|
child,
|
|
9199
9751
|
depth,
|
|
9200
9752
|
activeOverId,
|
|
9201
9753
|
droppingId
|
|
9202
|
-
}) => /* @__PURE__ */
|
|
9203
|
-
/* @__PURE__ */
|
|
9754
|
+
}) => /* @__PURE__ */ jsxs41("div", { children: [
|
|
9755
|
+
/* @__PURE__ */ jsx70(
|
|
9204
9756
|
DropIndicator,
|
|
9205
9757
|
{
|
|
9206
9758
|
id: `drop-${groupId}-${child.id}`,
|
|
9207
9759
|
isOver: activeOverId === `drop-${groupId}-${child.id}`
|
|
9208
9760
|
}
|
|
9209
9761
|
),
|
|
9210
|
-
/* @__PURE__ */
|
|
9762
|
+
/* @__PURE__ */ jsx70(DraggableItem, { id: child.id, droppingId, children: child.type === "condition" ? /* @__PURE__ */ jsx70(QueryCondition, { node: child }) : /* @__PURE__ */ jsx70(
|
|
9211
9763
|
InnerGroup,
|
|
9212
9764
|
{
|
|
9213
9765
|
node: child,
|
|
@@ -9240,62 +9792,62 @@ var InnerGroup = ({
|
|
|
9240
9792
|
const handleDeleteGroup = () => {
|
|
9241
9793
|
deleteNode(node.id);
|
|
9242
9794
|
};
|
|
9243
|
-
return /* @__PURE__ */
|
|
9244
|
-
/* @__PURE__ */
|
|
9245
|
-
!isRoot && /* @__PURE__ */
|
|
9795
|
+
return /* @__PURE__ */ jsxs41("div", { children: [
|
|
9796
|
+
/* @__PURE__ */ jsxs41("div", { className: "group/group flex items-center gap-1 px-1", children: [
|
|
9797
|
+
!isRoot && /* @__PURE__ */ jsx70(
|
|
9246
9798
|
"div",
|
|
9247
9799
|
{
|
|
9248
9800
|
ref: dragHandleProps?.ref,
|
|
9249
9801
|
className: "flex cursor-grab items-center px-1 text-zinc-400",
|
|
9250
9802
|
...dragHandleProps?.attributes,
|
|
9251
9803
|
...dragHandleProps?.listeners,
|
|
9252
|
-
children: /* @__PURE__ */
|
|
9804
|
+
children: /* @__PURE__ */ jsx70(IconGripVertical3, { size: 16 })
|
|
9253
9805
|
}
|
|
9254
9806
|
),
|
|
9255
|
-
/* @__PURE__ */
|
|
9256
|
-
/* @__PURE__ */
|
|
9257
|
-
/* @__PURE__ */
|
|
9258
|
-
/* @__PURE__ */
|
|
9259
|
-
/* @__PURE__ */
|
|
9807
|
+
/* @__PURE__ */ jsxs41(Select, { value: node.groupOperator, onValueChange: handleOperatorChange, children: [
|
|
9808
|
+
/* @__PURE__ */ jsx70(SelectTrigger, { className: "h-[26px] w-16 gap-3 rounded-md border-zinc-300 bg-blue-50 px-2 text-sm font-medium capitalize text-zinc-700 [&>svg]:text-zinc-400", children: /* @__PURE__ */ jsx70(SelectValue, {}) }),
|
|
9809
|
+
/* @__PURE__ */ jsxs41(SelectContent, { children: [
|
|
9810
|
+
/* @__PURE__ */ jsx70(SelectItem, { value: "and", children: "And" }),
|
|
9811
|
+
/* @__PURE__ */ jsx70(SelectItem, { value: "or", children: "Or" })
|
|
9260
9812
|
] })
|
|
9261
9813
|
] }),
|
|
9262
|
-
/* @__PURE__ */
|
|
9263
|
-
/* @__PURE__ */
|
|
9814
|
+
/* @__PURE__ */ jsxs41(DropdownMenu, { children: [
|
|
9815
|
+
/* @__PURE__ */ jsx70(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx70(
|
|
9264
9816
|
"button",
|
|
9265
9817
|
{
|
|
9266
9818
|
type: "button",
|
|
9267
9819
|
className: "flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-zinc-700",
|
|
9268
|
-
children: /* @__PURE__ */
|
|
9820
|
+
children: /* @__PURE__ */ jsx70(IconPlus3, { size: 16 })
|
|
9269
9821
|
}
|
|
9270
9822
|
) }),
|
|
9271
|
-
/* @__PURE__ */
|
|
9272
|
-
/* @__PURE__ */
|
|
9273
|
-
/* @__PURE__ */
|
|
9823
|
+
/* @__PURE__ */ jsxs41(DropdownMenuContent, { align: "start", children: [
|
|
9824
|
+
/* @__PURE__ */ jsx70(DropdownMenuItem, { onClick: handleAddCondition, children: "Add Condition" }),
|
|
9825
|
+
/* @__PURE__ */ jsx70(DropdownMenuItem, { onClick: handleAddGroup, children: "Add Group" })
|
|
9274
9826
|
] })
|
|
9275
9827
|
] }),
|
|
9276
|
-
node.boost !== void 0 && /* @__PURE__ */
|
|
9277
|
-
!isRoot && /* @__PURE__ */
|
|
9828
|
+
node.boost !== void 0 && /* @__PURE__ */ jsx70(BoostBadge, { node }),
|
|
9829
|
+
!isRoot && /* @__PURE__ */ jsxs41(
|
|
9278
9830
|
"div",
|
|
9279
9831
|
{
|
|
9280
9832
|
className: `flex -translate-x-[2px] items-center gap-1 opacity-0 transition-all duration-100 group-hover/group:translate-x-0 group-hover/group:opacity-100 has-[[data-state=open]]:translate-x-0 has-[[data-state=open]]:opacity-100`,
|
|
9281
9833
|
children: [
|
|
9282
|
-
/* @__PURE__ */
|
|
9283
|
-
/* @__PURE__ */
|
|
9834
|
+
/* @__PURE__ */ jsx70(NodeActionsMenu, { node }),
|
|
9835
|
+
/* @__PURE__ */ jsx70(
|
|
9284
9836
|
"button",
|
|
9285
9837
|
{
|
|
9286
9838
|
type: "button",
|
|
9287
9839
|
onClick: handleDeleteGroup,
|
|
9288
9840
|
className: `flex h-[26px] w-[26px] items-center justify-center rounded-md border border-zinc-300 text-zinc-500 transition-colors hover:text-red-500`,
|
|
9289
|
-
children: /* @__PURE__ */
|
|
9841
|
+
children: /* @__PURE__ */ jsx70(IconX4, { size: 16 })
|
|
9290
9842
|
}
|
|
9291
9843
|
)
|
|
9292
9844
|
]
|
|
9293
9845
|
}
|
|
9294
9846
|
)
|
|
9295
9847
|
] }),
|
|
9296
|
-
/* @__PURE__ */
|
|
9848
|
+
/* @__PURE__ */ jsx70("div", { className: `min-h-[20px] ${isRoot ? "" : "ml-[15px] border-l-2 border-zinc-200 pl-3"}`, children: node.children.length === 0 ? /* @__PURE__ */ jsx70(EmptyGroupDropZone, { groupId: node.id, isOver: activeOverId === `drop-${node.id}-end` }) : /* @__PURE__ */ jsxs41(Fragment14, { children: [
|
|
9297
9849
|
node.children.map(
|
|
9298
|
-
(child) => !child.not && /* @__PURE__ */
|
|
9850
|
+
(child) => !child.not && /* @__PURE__ */ jsx70(
|
|
9299
9851
|
ChildRow,
|
|
9300
9852
|
{
|
|
9301
9853
|
groupId: node.id,
|
|
@@ -9307,16 +9859,12 @@ var InnerGroup = ({
|
|
|
9307
9859
|
child.id
|
|
9308
9860
|
)
|
|
9309
9861
|
),
|
|
9310
|
-
node.children.some((child) => child.not) && /* @__PURE__ */
|
|
9311
|
-
/* @__PURE__ */
|
|
9312
|
-
|
|
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: [
|
|
9862
|
+
node.children.some((child) => child.not) && /* @__PURE__ */ jsxs41(Tooltip, { delayDuration: 200, children: [
|
|
9863
|
+
/* @__PURE__ */ jsx70(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx70("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" }) }),
|
|
9864
|
+
/* @__PURE__ */ jsx70(TooltipContent, { side: "right", className: "max-w-xs", children: /* @__PURE__ */ jsxs41("p", { children: [
|
|
9317
9865
|
"Keys matching any of the conditions below are excluded from the results.",
|
|
9318
9866
|
" ",
|
|
9319
|
-
/* @__PURE__ */
|
|
9867
|
+
/* @__PURE__ */ jsx70(
|
|
9320
9868
|
"a",
|
|
9321
9869
|
{
|
|
9322
9870
|
href: "https://upstash.com/docs/vector/features/filtering/boolean-operators/must-not",
|
|
@@ -9329,7 +9877,7 @@ var InnerGroup = ({
|
|
|
9329
9877
|
] }) })
|
|
9330
9878
|
] }),
|
|
9331
9879
|
node.children.map(
|
|
9332
|
-
(child) => child.not && /* @__PURE__ */
|
|
9880
|
+
(child) => child.not && /* @__PURE__ */ jsx70(
|
|
9333
9881
|
ChildRow,
|
|
9334
9882
|
{
|
|
9335
9883
|
groupId: node.id,
|
|
@@ -9341,7 +9889,7 @@ var InnerGroup = ({
|
|
|
9341
9889
|
child.id
|
|
9342
9890
|
)
|
|
9343
9891
|
),
|
|
9344
|
-
/* @__PURE__ */
|
|
9892
|
+
/* @__PURE__ */ jsx70(
|
|
9345
9893
|
DropIndicator,
|
|
9346
9894
|
{
|
|
9347
9895
|
id: `drop-${node.id}-end`,
|
|
@@ -9352,11 +9900,11 @@ var InnerGroup = ({
|
|
|
9352
9900
|
] });
|
|
9353
9901
|
};
|
|
9354
9902
|
var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
9355
|
-
const [activeOverId, setActiveOverId] =
|
|
9356
|
-
const [droppingId, setDroppingId] =
|
|
9903
|
+
const [activeOverId, setActiveOverId] = useState20(null);
|
|
9904
|
+
const [droppingId, setDroppingId] = useState20(null);
|
|
9357
9905
|
if (node.type !== "group") return;
|
|
9358
9906
|
if (!isRoot) {
|
|
9359
|
-
return /* @__PURE__ */
|
|
9907
|
+
return /* @__PURE__ */ jsx70(
|
|
9360
9908
|
InnerGroup,
|
|
9361
9909
|
{
|
|
9362
9910
|
node,
|
|
@@ -9367,13 +9915,13 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
9367
9915
|
}
|
|
9368
9916
|
);
|
|
9369
9917
|
}
|
|
9370
|
-
return /* @__PURE__ */
|
|
9918
|
+
return /* @__PURE__ */ jsx70(
|
|
9371
9919
|
QueryDndProvider,
|
|
9372
9920
|
{
|
|
9373
9921
|
rootNode: node,
|
|
9374
9922
|
setActiveOverId,
|
|
9375
9923
|
setDroppingId,
|
|
9376
|
-
children: /* @__PURE__ */
|
|
9924
|
+
children: /* @__PURE__ */ jsx70(
|
|
9377
9925
|
InnerGroup,
|
|
9378
9926
|
{
|
|
9379
9927
|
node,
|
|
@@ -9388,7 +9936,7 @@ var QueryGroup = ({ node, isRoot = false, depth }) => {
|
|
|
9388
9936
|
};
|
|
9389
9937
|
|
|
9390
9938
|
// src/components/databrowser/components/ui-query-builder/use-query-state-sync.ts
|
|
9391
|
-
import { useCallback as useCallback3, useEffect as
|
|
9939
|
+
import { useCallback as useCallback3, useEffect as useEffect16, useRef as useRef7, useState as useState21 } from "react";
|
|
9392
9940
|
|
|
9393
9941
|
// src/components/databrowser/components/ui-query-builder/query-stringify.ts
|
|
9394
9942
|
var jsonToJsLiteral = (json) => {
|
|
@@ -9397,20 +9945,36 @@ var jsonToJsLiteral = (json) => {
|
|
|
9397
9945
|
var toJsLiteral = (obj) => {
|
|
9398
9946
|
return jsonToJsLiteral(JSON.stringify(obj, null, 2));
|
|
9399
9947
|
};
|
|
9400
|
-
var buildOperatorValue = (operator, value, fuzzyDistance) => {
|
|
9948
|
+
var buildOperatorValue = (operator, value, fuzzyDistance, phraseSlop, phrasePrefix) => {
|
|
9401
9949
|
if (operator === "fuzzy" && fuzzyDistance) {
|
|
9402
9950
|
return { value, distance: fuzzyDistance };
|
|
9403
9951
|
}
|
|
9952
|
+
if (operator === "phrase") {
|
|
9953
|
+
if (phraseSlop !== void 0) {
|
|
9954
|
+
return { value, slop: phraseSlop };
|
|
9955
|
+
}
|
|
9956
|
+
if (phrasePrefix) {
|
|
9957
|
+
return { value, prefix: true };
|
|
9958
|
+
}
|
|
9959
|
+
}
|
|
9404
9960
|
return value;
|
|
9405
9961
|
};
|
|
9406
9962
|
var conditionToObject = (node) => {
|
|
9407
|
-
const {
|
|
9963
|
+
const {
|
|
9964
|
+
field,
|
|
9965
|
+
operator,
|
|
9966
|
+
value,
|
|
9967
|
+
boost: conditionBoost,
|
|
9968
|
+
fuzzyDistance,
|
|
9969
|
+
phraseSlop,
|
|
9970
|
+
phrasePrefix
|
|
9971
|
+
} = node.condition;
|
|
9408
9972
|
const effectiveBoost = node.boost ?? conditionBoost;
|
|
9409
9973
|
if (operator === "eq" && !effectiveBoost) {
|
|
9410
9974
|
return { [field]: value };
|
|
9411
9975
|
}
|
|
9412
9976
|
const fieldCondition = {
|
|
9413
|
-
[`$${operator}`]: buildOperatorValue(operator, value, fuzzyDistance)
|
|
9977
|
+
[`$${operator}`]: buildOperatorValue(operator, value, fuzzyDistance, phraseSlop, phrasePrefix)
|
|
9414
9978
|
};
|
|
9415
9979
|
const finalBoost = node.boost ?? conditionBoost;
|
|
9416
9980
|
if (finalBoost && finalBoost !== 1) {
|
|
@@ -9497,12 +10061,12 @@ var stringifyQueryState = (state) => {
|
|
|
9497
10061
|
// src/components/databrowser/components/ui-query-builder/use-query-state-sync.ts
|
|
9498
10062
|
var useQueryStateSync = () => {
|
|
9499
10063
|
const { valuesSearch, setValuesSearchQuery } = useTab();
|
|
9500
|
-
const [queryState, setQueryStateInternal] =
|
|
10064
|
+
const [queryState, setQueryStateInternal] = useState21(() => {
|
|
9501
10065
|
return parseQueryString(valuesSearch.query) ?? createInitialQueryState();
|
|
9502
10066
|
});
|
|
9503
10067
|
const lastSyncedQuery = useRef7(valuesSearch.query);
|
|
9504
10068
|
const isOurUpdate = useRef7(false);
|
|
9505
|
-
|
|
10069
|
+
useEffect16(() => {
|
|
9506
10070
|
if (isOurUpdate.current) {
|
|
9507
10071
|
isOurUpdate.current = false;
|
|
9508
10072
|
lastSyncedQuery.current = valuesSearch.query;
|
|
@@ -9536,19 +10100,64 @@ var useQueryStateSync = () => {
|
|
|
9536
10100
|
};
|
|
9537
10101
|
|
|
9538
10102
|
// src/components/databrowser/components/ui-query-builder/ui-query-builder.tsx
|
|
9539
|
-
import { jsx as
|
|
10103
|
+
import { jsx as jsx71, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9540
10104
|
var UIQueryBuilder = () => {
|
|
9541
10105
|
const { valuesSearch } = useTab();
|
|
9542
10106
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
9543
10107
|
const { queryState, setQueryState } = useQueryStateSync();
|
|
9544
10108
|
const fieldInfos = indexDetails?.schema ? extractFieldInfo(indexDetails.schema) : [];
|
|
9545
10109
|
const hasNormalized = useRef8(false);
|
|
9546
|
-
|
|
10110
|
+
useEffect17(() => {
|
|
9547
10111
|
if (hasNormalized.current || fieldInfos.length === 0) return;
|
|
9548
10112
|
hasNormalized.current = true;
|
|
9549
10113
|
setQueryState((state) => normalizeQueryState(state, fieldInfos));
|
|
9550
10114
|
}, [fieldInfos, setQueryState]);
|
|
9551
|
-
|
|
10115
|
+
const scrollAreaRef = useRef8(null);
|
|
10116
|
+
const viewportRef = useRef8(null);
|
|
10117
|
+
const [hasTopShadow, setHasTopShadow] = useState22(false);
|
|
10118
|
+
const [hasBottomShadow, setHasBottomShadow] = useState22(false);
|
|
10119
|
+
const recomputeShadows = useCallback4(() => {
|
|
10120
|
+
const el = viewportRef.current;
|
|
10121
|
+
if (!el) return;
|
|
10122
|
+
const { scrollTop, scrollHeight, clientHeight } = el;
|
|
10123
|
+
setHasTopShadow(scrollTop > 0);
|
|
10124
|
+
setHasBottomShadow(scrollTop + clientHeight < scrollHeight - 1);
|
|
10125
|
+
}, []);
|
|
10126
|
+
useEffect17(() => {
|
|
10127
|
+
viewportRef.current = scrollAreaRef.current?.querySelector(
|
|
10128
|
+
"[data-radix-scroll-area-viewport]"
|
|
10129
|
+
);
|
|
10130
|
+
recomputeShadows();
|
|
10131
|
+
const el = viewportRef.current;
|
|
10132
|
+
if (!el) return;
|
|
10133
|
+
const obs = new ResizeObserver(() => recomputeShadows());
|
|
10134
|
+
obs.observe(el);
|
|
10135
|
+
return () => obs.disconnect();
|
|
10136
|
+
}, [recomputeShadows]);
|
|
10137
|
+
return /* @__PURE__ */ jsx71(QueryBuilderUIProvider, { fieldInfos, setQueryState, children: /* @__PURE__ */ jsxs42("div", { className: "relative h-full rounded-lg bg-zinc-50", children: [
|
|
10138
|
+
/* @__PURE__ */ jsx71(
|
|
10139
|
+
"div",
|
|
10140
|
+
{
|
|
10141
|
+
className: `scroll-shadow-top pointer-events-none absolute left-0 top-0 z-10 h-6 w-full rounded-t-lg transition-opacity duration-200 ${hasTopShadow ? "opacity-100" : "opacity-0"}`
|
|
10142
|
+
}
|
|
10143
|
+
),
|
|
10144
|
+
/* @__PURE__ */ jsx71(
|
|
10145
|
+
"div",
|
|
10146
|
+
{
|
|
10147
|
+
className: `scroll-shadow-bottom pointer-events-none absolute bottom-0 left-0 z-10 h-6 w-full rounded-b-lg transition-opacity duration-200 ${hasBottomShadow ? "opacity-100" : "opacity-0"}`
|
|
10148
|
+
}
|
|
10149
|
+
),
|
|
10150
|
+
/* @__PURE__ */ jsx71(
|
|
10151
|
+
ScrollArea,
|
|
10152
|
+
{
|
|
10153
|
+
ref: scrollAreaRef,
|
|
10154
|
+
onScroll: recomputeShadows,
|
|
10155
|
+
className: "h-full",
|
|
10156
|
+
scrollBarClassName: "py-1",
|
|
10157
|
+
children: /* @__PURE__ */ jsx71("div", { className: "p-4", children: /* @__PURE__ */ jsx71(QueryGroup, { node: queryState.root, isRoot: true, depth: 0 }) })
|
|
10158
|
+
}
|
|
10159
|
+
)
|
|
10160
|
+
] }) });
|
|
9552
10161
|
};
|
|
9553
10162
|
var normalizeValue = (value, fieldType) => {
|
|
9554
10163
|
if (fieldType === "number" && typeof value === "string" && value !== "") {
|
|
@@ -9567,16 +10176,16 @@ var normalizeValue = (value, fieldType) => {
|
|
|
9567
10176
|
var normalizeNode = (node, fieldInfos) => {
|
|
9568
10177
|
if (node.type === "condition") {
|
|
9569
10178
|
const fieldInfo = fieldInfos.find((f) => f.name === node.condition.field);
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
value: normalizeValue(node.condition.value, fieldInfo.type)
|
|
9576
|
-
}
|
|
9577
|
-
};
|
|
10179
|
+
const condition = { ...node.condition };
|
|
10180
|
+
if (fieldInfo) condition.value = normalizeValue(condition.value, fieldInfo.type);
|
|
10181
|
+
if (condition.phraseSlop !== void 0) {
|
|
10182
|
+
const num = Number(condition.phraseSlop);
|
|
10183
|
+
condition.phraseSlop = Number.isNaN(num) ? void 0 : num;
|
|
9578
10184
|
}
|
|
9579
|
-
|
|
10185
|
+
if (condition.phrasePrefix !== void 0) {
|
|
10186
|
+
condition.phrasePrefix = Boolean(condition.phrasePrefix);
|
|
10187
|
+
}
|
|
10188
|
+
return { ...node, condition };
|
|
9580
10189
|
}
|
|
9581
10190
|
if (node.type === "group") {
|
|
9582
10191
|
return {
|
|
@@ -9618,13 +10227,13 @@ var extractFieldInfo = (schema) => {
|
|
|
9618
10227
|
};
|
|
9619
10228
|
|
|
9620
10229
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
9621
|
-
import { jsx as
|
|
10230
|
+
import { jsx as jsx72, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
9622
10231
|
var PREFIX = "const query: Query = ";
|
|
9623
10232
|
var SearchContent = () => {
|
|
9624
10233
|
const { valuesSearch } = useTab();
|
|
9625
10234
|
const { data: indexes, isLoading } = useFetchSearchIndexes();
|
|
9626
|
-
const [mode, setMode] =
|
|
9627
|
-
const [switchError, setSwitchError] =
|
|
10235
|
+
const [mode, setMode] = useState23("builder");
|
|
10236
|
+
const [switchError, setSwitchError] = useState23(null);
|
|
9628
10237
|
const handleModeChange = (value) => {
|
|
9629
10238
|
const newMode = value;
|
|
9630
10239
|
if (newMode === "builder") {
|
|
@@ -9645,28 +10254,33 @@ var SearchContent = () => {
|
|
|
9645
10254
|
}
|
|
9646
10255
|
const hasIndexes = indexes && indexes.length > 0;
|
|
9647
10256
|
if (!hasIndexes) {
|
|
9648
|
-
return /* @__PURE__ */
|
|
10257
|
+
return /* @__PURE__ */ jsx72(SearchEmptyState, {});
|
|
9649
10258
|
}
|
|
9650
|
-
return /* @__PURE__ */
|
|
9651
|
-
/* @__PURE__ */
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
10259
|
+
return /* @__PURE__ */ jsxs43("div", { children: [
|
|
10260
|
+
/* @__PURE__ */ jsxs43("div", { className: "relative h-[300px] max-h-[600px] min-h-[150px] resize-y overflow-hidden", children: [
|
|
10261
|
+
/* @__PURE__ */ jsx72("div", { className: "absolute right-4 top-4 z-10", children: /* @__PURE__ */ jsx72(
|
|
10262
|
+
Segmented,
|
|
10263
|
+
{
|
|
10264
|
+
options: [
|
|
10265
|
+
{ key: "builder", label: "Query Builder" },
|
|
10266
|
+
{ key: "code", label: "Code Editor" }
|
|
10267
|
+
],
|
|
10268
|
+
value: mode,
|
|
10269
|
+
onChange: handleModeChange,
|
|
10270
|
+
buttonClassName: "h-6"
|
|
10271
|
+
}
|
|
10272
|
+
) }),
|
|
10273
|
+
mode === "builder" ? /* @__PURE__ */ jsx72(UIQueryBuilder, {}) : /* @__PURE__ */ jsx72(QueryBuilder, {})
|
|
10274
|
+
] }),
|
|
10275
|
+
switchError && /* @__PURE__ */ jsx72("p", { className: "mt-3 text-sm text-red-500", children: switchError })
|
|
9665
10276
|
] });
|
|
9666
10277
|
};
|
|
9667
|
-
var DatabrowserInstance = ({
|
|
10278
|
+
var DatabrowserInstance = ({
|
|
10279
|
+
hidden,
|
|
10280
|
+
hideSearchTab = false
|
|
10281
|
+
}) => {
|
|
9668
10282
|
const { isValuesSearchSelected } = useTab();
|
|
9669
|
-
return /* @__PURE__ */
|
|
10283
|
+
return /* @__PURE__ */ jsx72(KeysProvider, { children: /* @__PURE__ */ jsxs43(
|
|
9670
10284
|
"div",
|
|
9671
10285
|
{
|
|
9672
10286
|
className: cn(
|
|
@@ -9674,36 +10288,36 @@ var DatabrowserInstance = ({ hidden }) => {
|
|
|
9674
10288
|
hidden && "hidden"
|
|
9675
10289
|
),
|
|
9676
10290
|
children: [
|
|
9677
|
-
/* @__PURE__ */
|
|
9678
|
-
/* @__PURE__ */
|
|
9679
|
-
isValuesSearchSelected && /* @__PURE__ */
|
|
9680
|
-
/* @__PURE__ */
|
|
10291
|
+
/* @__PURE__ */ jsxs43("div", { className: "space-y-3 py-5", children: [
|
|
10292
|
+
/* @__PURE__ */ jsx72(Header, { hideSearchTab }),
|
|
10293
|
+
isValuesSearchSelected && /* @__PURE__ */ jsx72(SearchContent, {}),
|
|
10294
|
+
/* @__PURE__ */ jsx72(HeaderError, {})
|
|
9681
10295
|
] }),
|
|
9682
|
-
/* @__PURE__ */
|
|
10296
|
+
/* @__PURE__ */ jsxs43(
|
|
9683
10297
|
PanelGroup,
|
|
9684
10298
|
{
|
|
9685
10299
|
autoSaveId: "persistence",
|
|
9686
10300
|
direction: "horizontal",
|
|
9687
10301
|
className: "h-full w-full text-sm antialiased",
|
|
9688
10302
|
children: [
|
|
9689
|
-
/* @__PURE__ */
|
|
9690
|
-
/* @__PURE__ */
|
|
9691
|
-
/* @__PURE__ */
|
|
9692
|
-
/* @__PURE__ */
|
|
9693
|
-
/* @__PURE__ */
|
|
10303
|
+
/* @__PURE__ */ jsx72(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx72(Sidebar, {}) }),
|
|
10304
|
+
/* @__PURE__ */ jsxs43(PanelResizeHandle, { className: "group mx-[2px] flex h-full flex-col items-center justify-center gap-1 rounded-md px-[8px] transition-colors hover:bg-zinc-300/10", children: [
|
|
10305
|
+
/* @__PURE__ */ jsx72("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
10306
|
+
/* @__PURE__ */ jsx72("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
10307
|
+
/* @__PURE__ */ jsx72("div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" })
|
|
9694
10308
|
] }),
|
|
9695
|
-
/* @__PURE__ */
|
|
10309
|
+
/* @__PURE__ */ jsx72(Panel, { minSize: 40, children: /* @__PURE__ */ jsx72(DataDisplay, {}) })
|
|
9696
10310
|
]
|
|
9697
10311
|
}
|
|
9698
10312
|
),
|
|
9699
|
-
/* @__PURE__ */
|
|
10313
|
+
/* @__PURE__ */ jsx72(Toaster, {})
|
|
9700
10314
|
]
|
|
9701
10315
|
}
|
|
9702
10316
|
) });
|
|
9703
10317
|
};
|
|
9704
10318
|
|
|
9705
10319
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
9706
|
-
import { useCallback as
|
|
10320
|
+
import { useCallback as useCallback6, useEffect as useEffect19, useMemo as useMemo11, useRef as useRef10, useState as useState25 } from "react";
|
|
9707
10321
|
import {
|
|
9708
10322
|
closestCenter,
|
|
9709
10323
|
DndContext as DndContext2,
|
|
@@ -9718,11 +10332,11 @@ import { CSS } from "@dnd-kit/utilities";
|
|
|
9718
10332
|
import { IconChevronDown as IconChevronDown3, IconPlus as IconPlus4, IconWindowMaximize } from "@tabler/icons-react";
|
|
9719
10333
|
|
|
9720
10334
|
// src/components/ui/command.tsx
|
|
9721
|
-
import * as
|
|
10335
|
+
import * as React15 from "react";
|
|
9722
10336
|
import { IconSearch as IconSearch4 } from "@tabler/icons-react";
|
|
9723
10337
|
import { Command as CommandPrimitive } from "cmdk";
|
|
9724
|
-
import { jsx as
|
|
9725
|
-
var Command =
|
|
10338
|
+
import { jsx as jsx73, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10339
|
+
var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73(
|
|
9726
10340
|
CommandPrimitive,
|
|
9727
10341
|
{
|
|
9728
10342
|
ref,
|
|
@@ -9734,9 +10348,9 @@ var Command = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
9734
10348
|
}
|
|
9735
10349
|
));
|
|
9736
10350
|
Command.displayName = CommandPrimitive.displayName;
|
|
9737
|
-
var CommandInput =
|
|
9738
|
-
/* @__PURE__ */
|
|
9739
|
-
/* @__PURE__ */
|
|
10351
|
+
var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs44("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
10352
|
+
/* @__PURE__ */ jsx73(IconSearch4, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
10353
|
+
/* @__PURE__ */ jsx73(
|
|
9740
10354
|
CommandPrimitive.Input,
|
|
9741
10355
|
{
|
|
9742
10356
|
ref,
|
|
@@ -9749,7 +10363,7 @@ var CommandInput = React14.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
9749
10363
|
)
|
|
9750
10364
|
] }));
|
|
9751
10365
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
9752
|
-
var CommandList =
|
|
10366
|
+
var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73(
|
|
9753
10367
|
CommandPrimitive.List,
|
|
9754
10368
|
{
|
|
9755
10369
|
ref,
|
|
@@ -9758,9 +10372,9 @@ var CommandList = React14.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
9758
10372
|
}
|
|
9759
10373
|
));
|
|
9760
10374
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
9761
|
-
var CommandEmpty =
|
|
10375
|
+
var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */ jsx73(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
9762
10376
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
9763
|
-
var CommandGroup =
|
|
10377
|
+
var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73(
|
|
9764
10378
|
CommandPrimitive.Group,
|
|
9765
10379
|
{
|
|
9766
10380
|
ref,
|
|
@@ -9772,7 +10386,7 @@ var CommandGroup = React14.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
9772
10386
|
}
|
|
9773
10387
|
));
|
|
9774
10388
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
9775
|
-
var CommandSeparator =
|
|
10389
|
+
var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73(
|
|
9776
10390
|
CommandPrimitive.Separator,
|
|
9777
10391
|
{
|
|
9778
10392
|
ref,
|
|
@@ -9781,7 +10395,7 @@ var CommandSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
9781
10395
|
}
|
|
9782
10396
|
));
|
|
9783
10397
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
9784
|
-
var CommandItem =
|
|
10398
|
+
var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73(
|
|
9785
10399
|
CommandPrimitive.Item,
|
|
9786
10400
|
{
|
|
9787
10401
|
ref,
|
|
@@ -9794,7 +10408,7 @@ var CommandItem = React14.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
9794
10408
|
));
|
|
9795
10409
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
9796
10410
|
var CommandShortcut = ({ className, ...props }) => {
|
|
9797
|
-
return /* @__PURE__ */
|
|
10411
|
+
return /* @__PURE__ */ jsx73("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
9798
10412
|
};
|
|
9799
10413
|
CommandShortcut.displayName = "CommandShortcut";
|
|
9800
10414
|
|
|
@@ -9809,11 +10423,11 @@ import {
|
|
|
9809
10423
|
} from "@tabler/icons-react";
|
|
9810
10424
|
|
|
9811
10425
|
// src/hooks/use-overflow.ts
|
|
9812
|
-
import { useCallback as
|
|
10426
|
+
import { useCallback as useCallback5, useEffect as useEffect18, useRef as useRef9, useState as useState24 } from "react";
|
|
9813
10427
|
var useOverflow = () => {
|
|
9814
|
-
const [isOverflow, setIsOverflow] =
|
|
10428
|
+
const [isOverflow, setIsOverflow] = useState24(false);
|
|
9815
10429
|
const observerRef = useRef9(null);
|
|
9816
|
-
const ref =
|
|
10430
|
+
const ref = useCallback5((node) => {
|
|
9817
10431
|
if (observerRef.current) {
|
|
9818
10432
|
observerRef.current.disconnect();
|
|
9819
10433
|
observerRef.current = null;
|
|
@@ -9826,7 +10440,7 @@ var useOverflow = () => {
|
|
|
9826
10440
|
});
|
|
9827
10441
|
observerRef.current.observe(node);
|
|
9828
10442
|
}, []);
|
|
9829
|
-
|
|
10443
|
+
useEffect18(() => {
|
|
9830
10444
|
return () => {
|
|
9831
10445
|
observerRef.current?.disconnect();
|
|
9832
10446
|
};
|
|
@@ -9835,16 +10449,16 @@ var useOverflow = () => {
|
|
|
9835
10449
|
};
|
|
9836
10450
|
|
|
9837
10451
|
// src/components/databrowser/components/tab-type-icon.tsx
|
|
9838
|
-
import { jsx as
|
|
10452
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
9839
10453
|
function TabTypeIcon({ selectedKey }) {
|
|
9840
10454
|
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
9841
|
-
if (isLoading) return /* @__PURE__ */
|
|
10455
|
+
if (isLoading) return /* @__PURE__ */ jsx74(Skeleton, { className: "h-5 w-5 rounded" });
|
|
9842
10456
|
if (!keyType || keyType === "none") return;
|
|
9843
|
-
return /* @__PURE__ */
|
|
10457
|
+
return /* @__PURE__ */ jsx74(TypeTag, { variant: keyType, type: "icon" });
|
|
9844
10458
|
}
|
|
9845
10459
|
|
|
9846
10460
|
// src/components/databrowser/components/tab.tsx
|
|
9847
|
-
import { jsx as
|
|
10461
|
+
import { jsx as jsx75, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
9848
10462
|
var Tab = ({ id, isList }) => {
|
|
9849
10463
|
const { active, search, selectedKey, valuesSearch, pinned, isValuesSearchSelected } = useTab();
|
|
9850
10464
|
const {
|
|
@@ -9860,8 +10474,8 @@ var Tab = ({ id, isList }) => {
|
|
|
9860
10474
|
const hasPinnedTabs = tabs.some(([, data]) => data.pinned);
|
|
9861
10475
|
const { ref, isOverflow } = useOverflow();
|
|
9862
10476
|
const label = isValuesSearchSelected ? valuesSearch.index : search.key || selectedKey;
|
|
9863
|
-
const iconNode = isValuesSearchSelected ? /* @__PURE__ */
|
|
9864
|
-
const tabNode = /* @__PURE__ */
|
|
10477
|
+
const iconNode = isValuesSearchSelected ? /* @__PURE__ */ jsx75("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-emerald-200 text-emerald-800", children: /* @__PURE__ */ jsx75(IconSearch5, { size: 14 }) }) : search.key ? /* @__PURE__ */ jsx75("div", { className: "flex h-[20px] w-[20px] items-center justify-center rounded-md bg-zinc-100 text-zinc-600", children: /* @__PURE__ */ jsx75(IconSearch5, { size: 14 }) }) : selectedKey ? /* @__PURE__ */ jsx75(TabTypeIcon, { selectedKey }) : void 0;
|
|
10478
|
+
const tabNode = /* @__PURE__ */ jsxs45(
|
|
9865
10479
|
"div",
|
|
9866
10480
|
{
|
|
9867
10481
|
id: isList ? `list-tab-${id}` : `tab-${id}`,
|
|
@@ -9872,8 +10486,8 @@ var Tab = ({ id, isList }) => {
|
|
|
9872
10486
|
!isList && (active ? "bg-white text-zinc-950" : "bg-zinc-200 text-zinc-600 hover:bg-zinc-100")
|
|
9873
10487
|
),
|
|
9874
10488
|
children: [
|
|
9875
|
-
/* @__PURE__ */
|
|
9876
|
-
/* @__PURE__ */
|
|
10489
|
+
/* @__PURE__ */ jsx75("div", { className: cn(!active && "transition-colors"), children: iconNode }),
|
|
10490
|
+
/* @__PURE__ */ jsx75(
|
|
9877
10491
|
"span",
|
|
9878
10492
|
{
|
|
9879
10493
|
ref,
|
|
@@ -9881,8 +10495,8 @@ var Tab = ({ id, isList }) => {
|
|
|
9881
10495
|
children: label || "New Tab"
|
|
9882
10496
|
}
|
|
9883
10497
|
),
|
|
9884
|
-
pinned && /* @__PURE__ */
|
|
9885
|
-
tabs.length > 1 && !pinned && /* @__PURE__ */
|
|
10498
|
+
pinned && /* @__PURE__ */ jsx75(IconPin, { size: 14, className: "text-zinc-500" }),
|
|
10499
|
+
tabs.length > 1 && !pinned && /* @__PURE__ */ jsx75(
|
|
9886
10500
|
"button",
|
|
9887
10501
|
{
|
|
9888
10502
|
onClick: (e) => {
|
|
@@ -9890,46 +10504,46 @@ var Tab = ({ id, isList }) => {
|
|
|
9890
10504
|
removeTab(id);
|
|
9891
10505
|
},
|
|
9892
10506
|
className: "p-[2px] text-zinc-400 transition-colors hover:text-zinc-500",
|
|
9893
|
-
children: /* @__PURE__ */
|
|
10507
|
+
children: /* @__PURE__ */ jsx75(IconX5, { size: 16 })
|
|
9894
10508
|
}
|
|
9895
10509
|
)
|
|
9896
10510
|
]
|
|
9897
10511
|
}
|
|
9898
10512
|
);
|
|
9899
|
-
return /* @__PURE__ */
|
|
9900
|
-
/* @__PURE__ */
|
|
9901
|
-
/* @__PURE__ */
|
|
10513
|
+
return /* @__PURE__ */ jsxs45(ContextMenu, { children: [
|
|
10514
|
+
/* @__PURE__ */ jsx75(SimpleTooltip, { content: isOverflow ? label : void 0, children: /* @__PURE__ */ jsx75(ContextMenuTrigger, { asChild: true, children: tabNode }) }),
|
|
10515
|
+
/* @__PURE__ */ jsxs45(
|
|
9902
10516
|
ContextMenuContent,
|
|
9903
10517
|
{
|
|
9904
10518
|
onClick: (e) => {
|
|
9905
10519
|
e.stopPropagation();
|
|
9906
10520
|
},
|
|
9907
10521
|
children: [
|
|
9908
|
-
/* @__PURE__ */
|
|
9909
|
-
/* @__PURE__ */
|
|
10522
|
+
/* @__PURE__ */ jsxs45(ContextMenuItem, { onSelect: () => togglePinTab(id), className: "gap-2", children: [
|
|
10523
|
+
/* @__PURE__ */ jsx75(IconPin, { size: 16 }),
|
|
9910
10524
|
pinned ? "Unpin Tab" : "Pin Tab"
|
|
9911
10525
|
] }),
|
|
9912
|
-
/* @__PURE__ */
|
|
9913
|
-
/* @__PURE__ */
|
|
10526
|
+
/* @__PURE__ */ jsxs45(ContextMenuItem, { onSelect: () => duplicateTab(id), className: "gap-2", children: [
|
|
10527
|
+
/* @__PURE__ */ jsx75(IconCopyPlus, { size: 16 }),
|
|
9914
10528
|
"Duplicate Tab"
|
|
9915
10529
|
] }),
|
|
9916
|
-
/* @__PURE__ */
|
|
9917
|
-
/* @__PURE__ */
|
|
9918
|
-
/* @__PURE__ */
|
|
10530
|
+
/* @__PURE__ */ jsx75(ContextMenuSeparator, {}),
|
|
10531
|
+
/* @__PURE__ */ jsxs45(ContextMenuItem, { onSelect: () => forceRemoveTab(id), className: "gap-2", children: [
|
|
10532
|
+
/* @__PURE__ */ jsx75(IconX5, { size: 16 }),
|
|
9919
10533
|
"Close Tab"
|
|
9920
10534
|
] }),
|
|
9921
|
-
/* @__PURE__ */
|
|
9922
|
-
/* @__PURE__ */
|
|
10535
|
+
/* @__PURE__ */ jsxs45(ContextMenuItem, { onSelect: () => closeOtherTabs(id), className: "gap-2", children: [
|
|
10536
|
+
/* @__PURE__ */ jsx75(IconSquareX, { size: 16 }),
|
|
9923
10537
|
"Close Other Tabs"
|
|
9924
10538
|
] }),
|
|
9925
|
-
/* @__PURE__ */
|
|
10539
|
+
/* @__PURE__ */ jsxs45(
|
|
9926
10540
|
ContextMenuItem,
|
|
9927
10541
|
{
|
|
9928
10542
|
onSelect: () => closeAllButPinned(),
|
|
9929
10543
|
className: "gap-2",
|
|
9930
10544
|
disabled: !hasPinnedTabs,
|
|
9931
10545
|
children: [
|
|
9932
|
-
/* @__PURE__ */
|
|
10546
|
+
/* @__PURE__ */ jsx75(IconArrowsMinimize, { size: 16 }),
|
|
9933
10547
|
"Close All But Pinned"
|
|
9934
10548
|
]
|
|
9935
10549
|
}
|
|
@@ -9941,9 +10555,9 @@ var Tab = ({ id, isList }) => {
|
|
|
9941
10555
|
};
|
|
9942
10556
|
|
|
9943
10557
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
9944
|
-
import { jsx as
|
|
10558
|
+
import { jsx as jsx76, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
9945
10559
|
var SortableTab = ({ id }) => {
|
|
9946
|
-
const [originalWidth, setOriginalWidth] =
|
|
10560
|
+
const [originalWidth, setOriginalWidth] = useState25(null);
|
|
9947
10561
|
const textRef = useRef10(null);
|
|
9948
10562
|
const { tabs } = useDatabrowserStore();
|
|
9949
10563
|
const tabData = tabs.find(([tabId]) => tabId === id)?.[1];
|
|
@@ -9968,7 +10582,7 @@ var SortableTab = ({ id }) => {
|
|
|
9968
10582
|
}
|
|
9969
10583
|
setNodeRef(element);
|
|
9970
10584
|
};
|
|
9971
|
-
|
|
10585
|
+
useEffect19(() => {
|
|
9972
10586
|
if (textRef.current && isDragging) {
|
|
9973
10587
|
const originalMaxWidth = textRef.current.style.maxWidth;
|
|
9974
10588
|
const originalWhiteSpace = textRef.current.style.whiteSpace;
|
|
@@ -9988,7 +10602,7 @@ var SortableTab = ({ id }) => {
|
|
|
9988
10602
|
};
|
|
9989
10603
|
}
|
|
9990
10604
|
}, [isDragging]);
|
|
9991
|
-
|
|
10605
|
+
useEffect19(() => {
|
|
9992
10606
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
9993
10607
|
if (entries[0]) {
|
|
9994
10608
|
setOriginalWidth(entries[0].contentRect.width);
|
|
@@ -10009,7 +10623,7 @@ var SortableTab = ({ id }) => {
|
|
|
10009
10623
|
minWidth: originalWidth ? `${originalWidth}px` : void 0
|
|
10010
10624
|
} : {}
|
|
10011
10625
|
};
|
|
10012
|
-
return /* @__PURE__ */
|
|
10626
|
+
return /* @__PURE__ */ jsx76(
|
|
10013
10627
|
"div",
|
|
10014
10628
|
{
|
|
10015
10629
|
ref: measureRef,
|
|
@@ -10017,7 +10631,7 @@ var SortableTab = ({ id }) => {
|
|
|
10017
10631
|
className: isDragging ? "cursor-grabbing" : isPinned ? "cursor-default" : "cursor-grab",
|
|
10018
10632
|
...attributes,
|
|
10019
10633
|
...isPinned ? {} : listeners2,
|
|
10020
|
-
children: /* @__PURE__ */
|
|
10634
|
+
children: /* @__PURE__ */ jsx76(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx76(Tab, { id }) })
|
|
10021
10635
|
}
|
|
10022
10636
|
);
|
|
10023
10637
|
};
|
|
@@ -10031,10 +10645,10 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10031
10645
|
});
|
|
10032
10646
|
}, [tabs]);
|
|
10033
10647
|
const scrollRef = useRef10(null);
|
|
10034
|
-
const [hasLeftShadow, setHasLeftShadow] =
|
|
10035
|
-
const [hasRightShadow, setHasRightShadow] =
|
|
10036
|
-
const [isOverflow, setIsOverflow] =
|
|
10037
|
-
|
|
10648
|
+
const [hasLeftShadow, setHasLeftShadow] = useState25(false);
|
|
10649
|
+
const [hasRightShadow, setHasRightShadow] = useState25(false);
|
|
10650
|
+
const [isOverflow, setIsOverflow] = useState25(false);
|
|
10651
|
+
useEffect19(() => {
|
|
10038
10652
|
const el = scrollRef.current;
|
|
10039
10653
|
if (!el) return;
|
|
10040
10654
|
const onWheel = (event) => {
|
|
@@ -10056,7 +10670,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10056
10670
|
el.removeEventListener("wheel", onWheel);
|
|
10057
10671
|
};
|
|
10058
10672
|
}, []);
|
|
10059
|
-
const recomputeShadows =
|
|
10673
|
+
const recomputeShadows = useCallback6(() => {
|
|
10060
10674
|
const el = scrollRef.current;
|
|
10061
10675
|
if (!el) return;
|
|
10062
10676
|
const { scrollLeft, scrollWidth, clientWidth } = el;
|
|
@@ -10064,7 +10678,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10064
10678
|
setHasRightShadow(scrollLeft + clientWidth < scrollWidth - 1);
|
|
10065
10679
|
setIsOverflow(scrollWidth > clientWidth + 1);
|
|
10066
10680
|
}, []);
|
|
10067
|
-
|
|
10681
|
+
useEffect19(() => {
|
|
10068
10682
|
recomputeShadows();
|
|
10069
10683
|
const el = scrollRef.current;
|
|
10070
10684
|
if (!el) return;
|
|
@@ -10092,28 +10706,28 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10092
10706
|
reorderTabs(oldIndex, newIndex);
|
|
10093
10707
|
}
|
|
10094
10708
|
};
|
|
10095
|
-
return /* @__PURE__ */
|
|
10096
|
-
/* @__PURE__ */
|
|
10097
|
-
/* @__PURE__ */
|
|
10709
|
+
return /* @__PURE__ */ jsx76("div", { className: "relative shrink-0 overflow-hidden rounded-t-lg bg-zinc-300", children: /* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-1", children: [
|
|
10710
|
+
/* @__PURE__ */ jsxs46("div", { className: "relative min-w-0 flex-1", children: [
|
|
10711
|
+
/* @__PURE__ */ jsx76(
|
|
10098
10712
|
"div",
|
|
10099
10713
|
{
|
|
10100
10714
|
className: `tabs-shadow-left pointer-events-none absolute left-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasLeftShadow ? "opacity-100" : "opacity-0"}`
|
|
10101
10715
|
}
|
|
10102
10716
|
),
|
|
10103
|
-
/* @__PURE__ */
|
|
10717
|
+
/* @__PURE__ */ jsx76(
|
|
10104
10718
|
"div",
|
|
10105
10719
|
{
|
|
10106
10720
|
className: `tabs-shadow-right pointer-events-none absolute right-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasRightShadow ? "opacity-100" : "opacity-0"}`
|
|
10107
10721
|
}
|
|
10108
10722
|
),
|
|
10109
|
-
/* @__PURE__ */
|
|
10723
|
+
/* @__PURE__ */ jsxs46(
|
|
10110
10724
|
"div",
|
|
10111
10725
|
{
|
|
10112
10726
|
ref: scrollRef,
|
|
10113
10727
|
onScroll: recomputeShadows,
|
|
10114
10728
|
className: "scrollbar-hide flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [&::-webkit-scrollbar]:hidden",
|
|
10115
10729
|
children: [
|
|
10116
|
-
/* @__PURE__ */
|
|
10730
|
+
/* @__PURE__ */ jsx76(
|
|
10117
10731
|
DndContext2,
|
|
10118
10732
|
{
|
|
10119
10733
|
sensors,
|
|
@@ -10125,25 +10739,25 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10125
10739
|
strategy: MeasuringStrategy.Always
|
|
10126
10740
|
}
|
|
10127
10741
|
},
|
|
10128
|
-
children: /* @__PURE__ */
|
|
10742
|
+
children: /* @__PURE__ */ jsx76(
|
|
10129
10743
|
SortableContext,
|
|
10130
10744
|
{
|
|
10131
10745
|
items: sortedTabs.map(([id]) => id),
|
|
10132
10746
|
strategy: horizontalListSortingStrategy,
|
|
10133
|
-
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */
|
|
10747
|
+
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */ jsx76(SortableTab, { id }, id))
|
|
10134
10748
|
}
|
|
10135
10749
|
)
|
|
10136
10750
|
}
|
|
10137
10751
|
),
|
|
10138
|
-
!isOverflow && /* @__PURE__ */
|
|
10752
|
+
!isOverflow && /* @__PURE__ */ jsx76("div", { className: "flex items-center gap-1 pl-1 pr-1", children: /* @__PURE__ */ jsx76(AddTabButton, {}) })
|
|
10139
10753
|
]
|
|
10140
10754
|
}
|
|
10141
10755
|
)
|
|
10142
10756
|
] }),
|
|
10143
|
-
/* @__PURE__ */
|
|
10144
|
-
isOverflow && /* @__PURE__ */
|
|
10145
|
-
tabs.length > 1 && /* @__PURE__ */
|
|
10146
|
-
onFullScreenClick && /* @__PURE__ */
|
|
10757
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-1 pl-1", children: [
|
|
10758
|
+
isOverflow && /* @__PURE__ */ jsx76(AddTabButton, {}),
|
|
10759
|
+
tabs.length > 1 && /* @__PURE__ */ jsx76(TabsListButton, { tabs, onSelectTab: selectTab }),
|
|
10760
|
+
onFullScreenClick && /* @__PURE__ */ jsx76(
|
|
10147
10761
|
Button,
|
|
10148
10762
|
{
|
|
10149
10763
|
"aria-label": "Toggle fullscreen",
|
|
@@ -10151,7 +10765,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
10151
10765
|
size: "icon-sm",
|
|
10152
10766
|
onClick: onFullScreenClick,
|
|
10153
10767
|
className: "flex-shrink-0 bg-white text-zinc-500 dark:bg-zinc-100",
|
|
10154
|
-
children: /* @__PURE__ */
|
|
10768
|
+
children: /* @__PURE__ */ jsx76(IconWindowMaximize, { size: 16 })
|
|
10155
10769
|
}
|
|
10156
10770
|
)
|
|
10157
10771
|
] })
|
|
@@ -10169,7 +10783,7 @@ function AddTabButton() {
|
|
|
10169
10783
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
10170
10784
|
}, 20);
|
|
10171
10785
|
};
|
|
10172
|
-
return /* @__PURE__ */
|
|
10786
|
+
return /* @__PURE__ */ jsx76(
|
|
10173
10787
|
Button,
|
|
10174
10788
|
{
|
|
10175
10789
|
"aria-label": "Add new tab",
|
|
@@ -10177,7 +10791,7 @@ function AddTabButton() {
|
|
|
10177
10791
|
size: "icon-sm",
|
|
10178
10792
|
onClick: handleAddTab,
|
|
10179
10793
|
className: "flex-shrink-0 bg-zinc-200 ",
|
|
10180
|
-
children: /* @__PURE__ */
|
|
10794
|
+
children: /* @__PURE__ */ jsx76(IconPlus4, { className: "text-zinc-600", size: 16 })
|
|
10181
10795
|
}
|
|
10182
10796
|
);
|
|
10183
10797
|
}
|
|
@@ -10185,7 +10799,7 @@ function TabsListButton({
|
|
|
10185
10799
|
tabs,
|
|
10186
10800
|
onSelectTab
|
|
10187
10801
|
}) {
|
|
10188
|
-
const [open, setOpen] =
|
|
10802
|
+
const [open, setOpen] = useState25(false);
|
|
10189
10803
|
const sorted = useMemo11(() => {
|
|
10190
10804
|
return [...tabs].sort(([, a], [, b]) => {
|
|
10191
10805
|
if (a.pinned && !b.pinned) return -1;
|
|
@@ -10203,8 +10817,8 @@ function TabsListButton({
|
|
|
10203
10817
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
10204
10818
|
}, 20);
|
|
10205
10819
|
};
|
|
10206
|
-
return /* @__PURE__ */
|
|
10207
|
-
/* @__PURE__ */
|
|
10820
|
+
return /* @__PURE__ */ jsxs46(Popover, { open, onOpenChange: setOpen, children: [
|
|
10821
|
+
/* @__PURE__ */ jsx76(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs46(
|
|
10208
10822
|
Button,
|
|
10209
10823
|
{
|
|
10210
10824
|
variant: "secondary",
|
|
@@ -10212,14 +10826,14 @@ function TabsListButton({
|
|
|
10212
10826
|
className: "gap-1 bg-white px-2",
|
|
10213
10827
|
"aria-label": "Search in tabs",
|
|
10214
10828
|
children: [
|
|
10215
|
-
/* @__PURE__ */
|
|
10216
|
-
/* @__PURE__ */
|
|
10829
|
+
/* @__PURE__ */ jsx76("span", { className: "text-xs text-zinc-600", children: tabs.length }),
|
|
10830
|
+
/* @__PURE__ */ jsx76(IconChevronDown3, { className: "text-zinc-500", size: 16 })
|
|
10217
10831
|
]
|
|
10218
10832
|
}
|
|
10219
10833
|
) }),
|
|
10220
|
-
/* @__PURE__ */
|
|
10221
|
-
/* @__PURE__ */
|
|
10222
|
-
/* @__PURE__ */
|
|
10834
|
+
/* @__PURE__ */ jsx76(PopoverContent, { className: "w-96 p-0", align: "end", children: /* @__PURE__ */ jsx76(Command, { children: /* @__PURE__ */ jsxs46(CommandList, { children: [
|
|
10835
|
+
/* @__PURE__ */ jsx76(CommandEmpty, { children: "No tabs" }),
|
|
10836
|
+
/* @__PURE__ */ jsx76(CommandGroup, { children: sorted.map(([_id, item]) => /* @__PURE__ */ jsx76(
|
|
10223
10837
|
CommandItem,
|
|
10224
10838
|
{
|
|
10225
10839
|
style: {
|
|
@@ -10229,7 +10843,7 @@ function TabsListButton({
|
|
|
10229
10843
|
onSelect: () => {
|
|
10230
10844
|
handleSelectTab(item.id);
|
|
10231
10845
|
},
|
|
10232
|
-
children: /* @__PURE__ */
|
|
10846
|
+
children: /* @__PURE__ */ jsx76(TabIdProvider, { value: _id, children: /* @__PURE__ */ jsx76(Tab, { id: _id, isList: true }) })
|
|
10233
10847
|
},
|
|
10234
10848
|
item.id
|
|
10235
10849
|
)) })
|
|
@@ -10238,11 +10852,12 @@ function TabsListButton({
|
|
|
10238
10852
|
}
|
|
10239
10853
|
|
|
10240
10854
|
// src/components/databrowser/index.tsx
|
|
10241
|
-
import { jsx as
|
|
10855
|
+
import { jsx as jsx77, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10242
10856
|
var RedisBrowser = ({
|
|
10243
10857
|
url,
|
|
10244
10858
|
token,
|
|
10245
10859
|
hideTabs,
|
|
10860
|
+
hideSearchTab,
|
|
10246
10861
|
storage,
|
|
10247
10862
|
disableTelemetry,
|
|
10248
10863
|
onFullScreenClick,
|
|
@@ -10250,13 +10865,14 @@ var RedisBrowser = ({
|
|
|
10250
10865
|
}) => {
|
|
10251
10866
|
const credentials = useMemo12(() => ({ token, url }), [token, url]);
|
|
10252
10867
|
const rootRef = useRef11(null);
|
|
10253
|
-
|
|
10868
|
+
useEffect20(() => {
|
|
10254
10869
|
queryClient.resetQueries();
|
|
10255
10870
|
}, [credentials.url]);
|
|
10256
|
-
return /* @__PURE__ */
|
|
10871
|
+
return /* @__PURE__ */ jsx77(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx77(RedisProvider, { redisCredentials: credentials, telemetry: !disableTelemetry, children: /* @__PURE__ */ jsx77(DarkModeProvider, { theme, children: /* @__PURE__ */ jsx77(DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ jsx77(TooltipProvider, { children: /* @__PURE__ */ jsx77(
|
|
10257
10872
|
RedisBrowserRoot,
|
|
10258
10873
|
{
|
|
10259
10874
|
hideTabs,
|
|
10875
|
+
hideSearchTab,
|
|
10260
10876
|
rootRef,
|
|
10261
10877
|
onFullScreenClick
|
|
10262
10878
|
}
|
|
@@ -10264,38 +10880,39 @@ var RedisBrowser = ({
|
|
|
10264
10880
|
};
|
|
10265
10881
|
var RedisBrowserRoot = ({
|
|
10266
10882
|
hideTabs,
|
|
10883
|
+
hideSearchTab,
|
|
10267
10884
|
rootRef,
|
|
10268
10885
|
onFullScreenClick
|
|
10269
10886
|
}) => {
|
|
10270
10887
|
const theme = useTheme();
|
|
10271
|
-
|
|
10888
|
+
useEffect20(() => {
|
|
10272
10889
|
portalWrapper.classList.add("text-zinc-700");
|
|
10273
10890
|
portalWrapper.classList.toggle("dark", theme === "dark");
|
|
10274
10891
|
}, [theme]);
|
|
10275
10892
|
return (
|
|
10276
10893
|
/* ups-db is the custom class used to prefix every style in the css bundle */
|
|
10277
|
-
/* @__PURE__ */
|
|
10894
|
+
/* @__PURE__ */ jsx77(
|
|
10278
10895
|
"div",
|
|
10279
10896
|
{
|
|
10280
10897
|
className: `ups-db ${theme === "dark" ? "dark" : ""}`,
|
|
10281
10898
|
style: { height: "100%" },
|
|
10282
10899
|
ref: rootRef,
|
|
10283
|
-
children: /* @__PURE__ */
|
|
10284
|
-
!hideTabs && /* @__PURE__ */
|
|
10285
|
-
/* @__PURE__ */
|
|
10900
|
+
children: /* @__PURE__ */ jsxs47("div", { className: "flex h-full flex-col overflow-hidden rounded-[14px] border-[4px] border-zinc-300 text-zinc-700", children: [
|
|
10901
|
+
!hideTabs && /* @__PURE__ */ jsx77(DatabrowserTabs, { onFullScreenClick }),
|
|
10902
|
+
/* @__PURE__ */ jsx77(DatabrowserInstances, { hideSearchTab })
|
|
10286
10903
|
] })
|
|
10287
10904
|
}
|
|
10288
10905
|
)
|
|
10289
10906
|
);
|
|
10290
10907
|
};
|
|
10291
|
-
var DatabrowserInstances = () => {
|
|
10908
|
+
var DatabrowserInstances = ({ hideSearchTab }) => {
|
|
10292
10909
|
const { tabs, selectedTab, selectTab, addTab } = useDatabrowserStore();
|
|
10293
|
-
|
|
10910
|
+
useEffect20(() => {
|
|
10294
10911
|
if (tabs.length === 0) addTab();
|
|
10295
10912
|
else if (!selectedTab) selectTab(tabs[0][0]);
|
|
10296
10913
|
}, [tabs, selectedTab, addTab, selectTab]);
|
|
10297
10914
|
if (!selectedTab) return;
|
|
10298
|
-
return tabs.map(([id]) => /* @__PURE__ */
|
|
10915
|
+
return tabs.map(([id]) => /* @__PURE__ */ jsx77(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx77(DatabrowserInstance, { hidden: id !== selectedTab, hideSearchTab }) }, id));
|
|
10299
10916
|
};
|
|
10300
10917
|
export {
|
|
10301
10918
|
RedisBrowser
|