@upstash/react-redis-browser 0.2.14 → 0.2.15
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 +4 -0
- package/dist/index.js +234 -97
- package/dist/index.mjs +884 -747
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3468,43 +3468,51 @@ function Toaster() {
|
|
|
3468
3468
|
// src/components/databrowser/hooks/use-fetch-search-indexes.tsx
|
|
3469
3469
|
|
|
3470
3470
|
|
|
3471
|
-
// src/lib/
|
|
3472
|
-
async function
|
|
3471
|
+
// src/lib/list-search-indexes.ts
|
|
3472
|
+
async function listSearchIndexes(redis, {
|
|
3473
3473
|
match,
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
});
|
|
3486
|
-
result.push(...keys);
|
|
3487
|
-
if (limit && result.length >= limit) {
|
|
3488
|
-
return result.slice(0, limit);
|
|
3489
|
-
}
|
|
3490
|
-
if (newCursor === "0") break;
|
|
3491
|
-
cursor = newCursor;
|
|
3492
|
-
}
|
|
3493
|
-
return result;
|
|
3474
|
+
limit,
|
|
3475
|
+
offset = 0
|
|
3476
|
+
}) {
|
|
3477
|
+
const args = ["search.listindexes"];
|
|
3478
|
+
if (match) args.push("MATCH", match);
|
|
3479
|
+
args.push("LIMIT", String(limit), "OFFSET", String(offset));
|
|
3480
|
+
const result = await redis.exec(args);
|
|
3481
|
+
return parseListIndexesResponse(result);
|
|
3482
|
+
}
|
|
3483
|
+
function parseListIndexesResponse(result) {
|
|
3484
|
+
return result.map((entry) => entry[1]);
|
|
3494
3485
|
}
|
|
3495
3486
|
|
|
3496
3487
|
// src/components/databrowser/hooks/use-fetch-search-indexes.tsx
|
|
3497
3488
|
var FETCH_SEARCH_INDEXES_QUERY_KEY = "fetch-search-indexes";
|
|
3489
|
+
var PAGE_SIZE = 30;
|
|
3498
3490
|
var useFetchSearchIndexes = ({
|
|
3499
3491
|
match,
|
|
3500
3492
|
enabled
|
|
3501
3493
|
} = {}) => {
|
|
3502
3494
|
const { redisNoPipeline: redis } = useRedis();
|
|
3503
|
-
|
|
3504
|
-
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY],
|
|
3495
|
+
const query = _reactquery.useInfiniteQuery.call(void 0, {
|
|
3496
|
+
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY, match],
|
|
3505
3497
|
enabled: _nullishCoalesce(enabled, () => ( true)),
|
|
3506
|
-
|
|
3498
|
+
initialPageParam: 0,
|
|
3499
|
+
queryFn: async ({ pageParam: offset }) => {
|
|
3500
|
+
const names = await listSearchIndexes(redis, { match, limit: PAGE_SIZE, offset });
|
|
3501
|
+
return {
|
|
3502
|
+
names,
|
|
3503
|
+
nextOffset: names.length >= PAGE_SIZE ? offset + names.length : void 0
|
|
3504
|
+
};
|
|
3505
|
+
},
|
|
3506
|
+
getNextPageParam: (lastPage) => lastPage.nextOffset
|
|
3507
3507
|
});
|
|
3508
|
+
const indexes = _optionalChain([query, 'access', _26 => _26.data, 'optionalAccess', _27 => _27.pages, 'access', _28 => _28.flatMap, 'call', _29 => _29((page) => page.names)]);
|
|
3509
|
+
return {
|
|
3510
|
+
data: indexes,
|
|
3511
|
+
isLoading: query.isLoading || query.isFetching && !query.isFetchingNextPage,
|
|
3512
|
+
hasNextPage: query.hasNextPage,
|
|
3513
|
+
fetchNextPage: query.fetchNextPage,
|
|
3514
|
+
isFetchingNextPage: query.isFetchingNextPage
|
|
3515
|
+
};
|
|
3508
3516
|
};
|
|
3509
3517
|
|
|
3510
3518
|
// src/components/databrowser/hooks/use-keys.tsx
|
|
@@ -3586,6 +3594,21 @@ var KeysProvider = ({ children }) => {
|
|
|
3586
3594
|
}
|
|
3587
3595
|
return { cursor: newCursor, keys: keys2 };
|
|
3588
3596
|
};
|
|
3597
|
+
const redisSearchIndexScan = async ({
|
|
3598
|
+
count: count2,
|
|
3599
|
+
cursor
|
|
3600
|
+
}) => {
|
|
3601
|
+
const offset = Number.parseInt(cursor, 10) || 0;
|
|
3602
|
+
const names = await listSearchIndexes(redis, {
|
|
3603
|
+
match: search.key || void 0,
|
|
3604
|
+
limit: count2,
|
|
3605
|
+
offset
|
|
3606
|
+
});
|
|
3607
|
+
const keys2 = names.map((name) => ({ key: name, type: "search" }));
|
|
3608
|
+
const hasMore = keys2.length >= count2;
|
|
3609
|
+
const nextCursor = hasMore ? String(offset + keys2.length) : "0";
|
|
3610
|
+
return { cursor: nextCursor, keys: keys2 };
|
|
3611
|
+
};
|
|
3589
3612
|
const redisValueScan = async ({
|
|
3590
3613
|
count: count2,
|
|
3591
3614
|
cursor
|
|
@@ -3611,7 +3634,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3611
3634
|
return { cursor: nextCursor, keys: keys2 };
|
|
3612
3635
|
};
|
|
3613
3636
|
const performScan = async (count2, cursor) => {
|
|
3614
|
-
const scanFunction = isValuesSearchSelected ? redisValueScan : redisKeyScan;
|
|
3637
|
+
const scanFunction = isValuesSearchSelected ? redisValueScan : search.type === "search" ? redisSearchIndexScan : redisKeyScan;
|
|
3615
3638
|
const result = await scanFunction({ count: count2, cursor });
|
|
3616
3639
|
return [result.cursor, result.keys];
|
|
3617
3640
|
};
|
|
@@ -3650,7 +3673,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3650
3673
|
refetchOnMount: false
|
|
3651
3674
|
});
|
|
3652
3675
|
const keys = _react.useMemo.call(void 0, () => {
|
|
3653
|
-
const keys2 = _nullishCoalesce(_optionalChain([query, 'access',
|
|
3676
|
+
const keys2 = _nullishCoalesce(_optionalChain([query, 'access', _30 => _30.data, 'optionalAccess', _31 => _31.pages, 'access', _32 => _32.flatMap, 'call', _33 => _33((page) => page.keys)]), () => ( []));
|
|
3654
3677
|
const keysSet = /* @__PURE__ */ new Set();
|
|
3655
3678
|
const dedupedKeys = [];
|
|
3656
3679
|
for (const key of keys2) {
|
|
@@ -3684,7 +3707,7 @@ var useKeys = () => {
|
|
|
3684
3707
|
var useKeyType = (key) => {
|
|
3685
3708
|
const { keys } = useKeys();
|
|
3686
3709
|
const keyTuple = _react.useMemo.call(void 0, () => keys.find(([k, _]) => k === key), [keys, key]);
|
|
3687
|
-
return _optionalChain([keyTuple, 'optionalAccess',
|
|
3710
|
+
return _optionalChain([keyTuple, 'optionalAccess', _34 => _34[1]]);
|
|
3688
3711
|
};
|
|
3689
3712
|
|
|
3690
3713
|
// src/types/index.ts
|
|
@@ -4158,7 +4181,7 @@ function parseFieldBuilder(str, fieldName) {
|
|
|
4158
4181
|
}
|
|
4159
4182
|
if (str.startsWith("s.number(")) {
|
|
4160
4183
|
const typeMatch = str.match(/s\.number\(\s*["']?(U64|I64|F64)?["']?\s*\)/);
|
|
4161
|
-
const numType = _optionalChain([typeMatch, 'optionalAccess',
|
|
4184
|
+
const numType = _optionalChain([typeMatch, 'optionalAccess', _35 => _35[1]]) || "F64";
|
|
4162
4185
|
const fromValue = extractFromValue(str);
|
|
4163
4186
|
if (fromValue === void 0) return numType;
|
|
4164
4187
|
return { type: numType, from: fromValue };
|
|
@@ -4191,7 +4214,7 @@ function parseFieldBuilder(str, fieldName) {
|
|
|
4191
4214
|
}
|
|
4192
4215
|
if (str.startsWith("s.")) {
|
|
4193
4216
|
const typeMatch = str.match(/^s\.(\w+)\(/);
|
|
4194
|
-
const typeName = _nullishCoalesce(_optionalChain([typeMatch, 'optionalAccess',
|
|
4217
|
+
const typeName = _nullishCoalesce(_optionalChain([typeMatch, 'optionalAccess', _36 => _36[1]]), () => ( "unknown"));
|
|
4195
4218
|
throw new Error(`Unknown field type "s.${typeName}()" for field "${fieldName}"`);
|
|
4196
4219
|
}
|
|
4197
4220
|
return void 0;
|
|
@@ -4480,6 +4503,18 @@ var useAddKey = () => {
|
|
|
4480
4503
|
|
|
4481
4504
|
// src/components/databrowser/hooks/use-debounce.ts
|
|
4482
4505
|
|
|
4506
|
+
function useDebounce(value, delay) {
|
|
4507
|
+
const [debouncedValue, setDebouncedValue] = _react.useState.call(void 0, value);
|
|
4508
|
+
_react.useEffect.call(void 0, () => {
|
|
4509
|
+
const handler = setTimeout(() => {
|
|
4510
|
+
setDebouncedValue(value);
|
|
4511
|
+
}, delay);
|
|
4512
|
+
return () => {
|
|
4513
|
+
clearTimeout(handler);
|
|
4514
|
+
};
|
|
4515
|
+
}, [value, delay]);
|
|
4516
|
+
return debouncedValue;
|
|
4517
|
+
}
|
|
4483
4518
|
|
|
4484
4519
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
4485
4520
|
|
|
@@ -4571,7 +4606,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
4571
4606
|
// +1 since first message is the last one
|
|
4572
4607
|
LIST_DISPLAY_PAGE_SIZE + 1
|
|
4573
4608
|
);
|
|
4574
|
-
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access',
|
|
4609
|
+
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access', _37 => _37.at, 'call', _38 => _38(-1), 'optionalAccess', _39 => _39[0]]) : void 0;
|
|
4575
4610
|
return {
|
|
4576
4611
|
cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
|
|
4577
4612
|
keys: messages.map(([id, fields]) => ({
|
|
@@ -4746,7 +4781,7 @@ var useEditListItem = () => {
|
|
|
4746
4781
|
}
|
|
4747
4782
|
case "stream": {
|
|
4748
4783
|
if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
|
|
4749
|
-
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess',
|
|
4784
|
+
const opts = transformArray((_nullishCoalesce(_optionalChain([newValue, 'optionalAccess', _40 => _40.split, 'call', _41 => _41("\n")]), () => ( []))).filter(Boolean)).map(
|
|
4750
4785
|
({ key, value }) => [key, value]
|
|
4751
4786
|
);
|
|
4752
4787
|
pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
|
|
@@ -5053,7 +5088,7 @@ var LengthBadge = ({
|
|
|
5053
5088
|
content
|
|
5054
5089
|
}) => {
|
|
5055
5090
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
5056
|
-
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess',
|
|
5091
|
+
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _42 => _42.length]), () => ( data));
|
|
5057
5092
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Badge, { label: "Length:", children: isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : length });
|
|
5058
5093
|
};
|
|
5059
5094
|
var SizeBadge = ({ dataKey }) => {
|
|
@@ -5079,7 +5114,7 @@ var Badge = ({ children, label }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void
|
|
|
5079
5114
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium", children })
|
|
5080
5115
|
] });
|
|
5081
5116
|
|
|
5082
|
-
// src/components/databrowser/components/display/
|
|
5117
|
+
// src/components/databrowser/components/display/item-actions.tsx
|
|
5083
5118
|
|
|
5084
5119
|
|
|
5085
5120
|
// src/components/ui/dropdown-menu.tsx
|
|
@@ -5339,7 +5374,9 @@ function DeleteKeyModal({
|
|
|
5339
5374
|
onOpenChange,
|
|
5340
5375
|
deletionType,
|
|
5341
5376
|
count: count2 = 1,
|
|
5342
|
-
showReindex
|
|
5377
|
+
showReindex,
|
|
5378
|
+
name,
|
|
5379
|
+
nameLabel
|
|
5343
5380
|
}) {
|
|
5344
5381
|
const isPlural = count2 > 1;
|
|
5345
5382
|
const itemLabel = deletionType === "item" ? "Item" : "Key";
|
|
@@ -5358,7 +5395,10 @@ function DeleteKeyModal({
|
|
|
5358
5395
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogDescription, { className: "mt-5", children: [
|
|
5359
5396
|
"Are you sure you want to delete",
|
|
5360
5397
|
" ",
|
|
5361
|
-
|
|
5398
|
+
name ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5399
|
+
`${_nullishCoalesce(nameLabel, () => ( deletionType))} `,
|
|
5400
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium text-zinc-900 dark:text-zinc-100", children: nameLabel ? name : `"${name}"` })
|
|
5401
|
+
] }) : isPlural ? `these ${count2} ${deletionType}s` : `this ${deletionType}`,
|
|
5362
5402
|
"?",
|
|
5363
5403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
|
|
5364
5404
|
"This action cannot be undone."
|
|
@@ -5383,7 +5423,7 @@ function DeleteKeyModal({
|
|
|
5383
5423
|
type: "button",
|
|
5384
5424
|
variant: "outline",
|
|
5385
5425
|
disabled: isPending,
|
|
5386
|
-
onClick: () => _optionalChain([setIsOpen, 'optionalCall',
|
|
5426
|
+
onClick: () => _optionalChain([setIsOpen, 'optionalCall', _43 => _43(false)]),
|
|
5387
5427
|
children: "Cancel"
|
|
5388
5428
|
}
|
|
5389
5429
|
),
|
|
@@ -5409,8 +5449,51 @@ function DeleteKeyModal({
|
|
|
5409
5449
|
] });
|
|
5410
5450
|
}
|
|
5411
5451
|
|
|
5452
|
+
// src/components/databrowser/components/display/item-actions.tsx
|
|
5453
|
+
|
|
5454
|
+
function ItemActions({ dataKey, type }) {
|
|
5455
|
+
const { selectedListItem, setSelectedListItem } = useTab();
|
|
5456
|
+
const { mutateAsync: editItem } = useEditListItem();
|
|
5457
|
+
if (!selectedListItem) return;
|
|
5458
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DropdownMenu, { modal: false, children: [
|
|
5459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { size: "icon-sm", "aria-label": "Item actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5460
|
+
_iconsreact.IconDotsVertical,
|
|
5461
|
+
{
|
|
5462
|
+
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5463
|
+
fill: "rgb(var(--color-zinc-500))"
|
|
5464
|
+
}
|
|
5465
|
+
) }) }),
|
|
5466
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuContent, { align: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5467
|
+
DeleteKeyModal,
|
|
5468
|
+
{
|
|
5469
|
+
deletionType: "item",
|
|
5470
|
+
name: selectedListItem.key,
|
|
5471
|
+
nameLabel: type === "list" ? "item at index" : void 0,
|
|
5472
|
+
onDeleteConfirm: async () => {
|
|
5473
|
+
await editItem({
|
|
5474
|
+
type,
|
|
5475
|
+
dataKey,
|
|
5476
|
+
itemKey: selectedListItem.key,
|
|
5477
|
+
newKey: void 0
|
|
5478
|
+
});
|
|
5479
|
+
setSelectedListItem(void 0);
|
|
5480
|
+
},
|
|
5481
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5482
|
+
DropdownMenuItem,
|
|
5483
|
+
{
|
|
5484
|
+
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
5485
|
+
onSelect: (e) => e.preventDefault(),
|
|
5486
|
+
children: "Delete item"
|
|
5487
|
+
}
|
|
5488
|
+
)
|
|
5489
|
+
}
|
|
5490
|
+
) })
|
|
5491
|
+
] });
|
|
5492
|
+
}
|
|
5493
|
+
|
|
5412
5494
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
5413
5495
|
|
|
5496
|
+
|
|
5414
5497
|
function KeyActions({
|
|
5415
5498
|
dataKey,
|
|
5416
5499
|
content,
|
|
@@ -5452,9 +5535,10 @@ function KeyActions({
|
|
|
5452
5535
|
DeleteKeyModal,
|
|
5453
5536
|
{
|
|
5454
5537
|
deletionType: "key",
|
|
5538
|
+
name: dataKey,
|
|
5455
5539
|
showReindex: isValuesSearchSelected && type !== "search",
|
|
5456
5540
|
onDeleteConfirm: async (_e, options) => {
|
|
5457
|
-
await deleteKey({ keys: [dataKey], reindex: _optionalChain([options, 'optionalAccess',
|
|
5541
|
+
await deleteKey({ keys: [dataKey], reindex: _optionalChain([options, 'optionalAccess', _44 => _44.reindex]) });
|
|
5458
5542
|
},
|
|
5459
5543
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5460
5544
|
DropdownMenuItem,
|
|
@@ -5478,7 +5562,9 @@ var DisplayHeader = ({
|
|
|
5478
5562
|
content,
|
|
5479
5563
|
hideTypeTag
|
|
5480
5564
|
}) => {
|
|
5481
|
-
const { setSelectedListItem } = useTab();
|
|
5565
|
+
const { setSelectedListItem, selectedListItem } = useTab();
|
|
5566
|
+
const isListType = type !== "string" && type !== "json" && type !== "search" && type !== "stream";
|
|
5567
|
+
const showItemActions = isListType && Boolean(selectedListItem);
|
|
5482
5568
|
const handleAddItem = () => {
|
|
5483
5569
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
5484
5570
|
};
|
|
@@ -5486,8 +5572,8 @@ var DisplayHeader = ({
|
|
|
5486
5572
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-[26px] items-center justify-between gap-4", children: [
|
|
5487
5573
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium text-zinc-950", children: dataKey }) }),
|
|
5488
5574
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1", children: [
|
|
5489
|
-
type !== "string" && type !== "json" && type !== "search" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
5490
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyActions, { dataKey, content, type })
|
|
5575
|
+
type !== "string" && type !== "json" && type !== "search" && !showItemActions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
5576
|
+
showItemActions ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ItemActions, { dataKey, type }) : selectedListItem ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyActions, { dataKey, content, type })
|
|
5491
5577
|
] })
|
|
5492
5578
|
] }),
|
|
5493
5579
|
type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollArea, { orientation: "horizontal", className: "w-full whitespace-nowrap", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-max items-center gap-1.5 pb-2 pt-1", children: [
|
|
@@ -5685,13 +5771,13 @@ var MonacoEditorWithTypes = ({
|
|
|
5685
5771
|
const theme = useTheme();
|
|
5686
5772
|
_react.useEffect.call(void 0, () => {
|
|
5687
5773
|
if (!monaco) return;
|
|
5688
|
-
_optionalChain([extraLibRef, 'access',
|
|
5774
|
+
_optionalChain([extraLibRef, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.dispose, 'call', _47 => _47()]);
|
|
5689
5775
|
extraLibRef.current = monaco.languages.typescript.typescriptDefaults.addExtraLib(
|
|
5690
5776
|
typeDefinitions,
|
|
5691
5777
|
`file:///${filePath.replace(".ts", "-types.d.ts")}`
|
|
5692
5778
|
);
|
|
5693
5779
|
requestAnimationFrame(() => {
|
|
5694
|
-
const model = _optionalChain([editorRef, 'access',
|
|
5780
|
+
const model = _optionalChain([editorRef, 'access', _48 => _48.current, 'optionalAccess', _49 => _49.getModel, 'optionalCall', _50 => _50()]);
|
|
5695
5781
|
if (model) {
|
|
5696
5782
|
const currentValue = model.getValue();
|
|
5697
5783
|
model.setValue(currentValue);
|
|
@@ -5700,10 +5786,10 @@ var MonacoEditorWithTypes = ({
|
|
|
5700
5786
|
}, [monaco, typeDefinitions, filePath]);
|
|
5701
5787
|
_react.useEffect.call(void 0, () => {
|
|
5702
5788
|
return () => {
|
|
5703
|
-
_optionalChain([extraLibRef, 'access',
|
|
5789
|
+
_optionalChain([extraLibRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.dispose, 'call', _53 => _53()]);
|
|
5704
5790
|
if (monaco) {
|
|
5705
5791
|
const model = monaco.editor.getModel(monaco.Uri.parse(filePath));
|
|
5706
|
-
_optionalChain([model, 'optionalAccess',
|
|
5792
|
+
_optionalChain([model, 'optionalAccess', _54 => _54.dispose, 'call', _55 => _55()]);
|
|
5707
5793
|
}
|
|
5708
5794
|
};
|
|
5709
5795
|
}, [monaco, filePath]);
|
|
@@ -5713,7 +5799,7 @@ var MonacoEditorWithTypes = ({
|
|
|
5713
5799
|
} else if (newValue.trim() === "") {
|
|
5714
5800
|
onChange(defaultValue);
|
|
5715
5801
|
} else {
|
|
5716
|
-
_optionalChain([editorRef, 'access',
|
|
5802
|
+
_optionalChain([editorRef, 'access', _56 => _56.current, 'optionalAccess', _57 => _57.setValue, 'optionalCall', _58 => _58(valueRef.current)]);
|
|
5717
5803
|
}
|
|
5718
5804
|
};
|
|
5719
5805
|
_react.useEffect.call(void 0, () => {
|
|
@@ -6180,7 +6266,7 @@ var SearchDisplay = ({
|
|
|
6180
6266
|
indexName: _nullishCoalesce(indexName, () => ( "")),
|
|
6181
6267
|
editorValue: data.schema ? schemaToEditorValue(data.schema) : SCHEMA_DEFAULT,
|
|
6182
6268
|
dataType: data.dataType || "string",
|
|
6183
|
-
prefixes: _optionalChain([data, 'access',
|
|
6269
|
+
prefixes: _optionalChain([data, 'access', _59 => _59.prefixes, 'optionalAccess', _60 => _60.join, 'call', _61 => _61(", ")]) || "",
|
|
6184
6270
|
language: data.language || "english"
|
|
6185
6271
|
});
|
|
6186
6272
|
}, [data, reset, indexName]);
|
|
@@ -6553,7 +6639,7 @@ var ItemContextMenu = ({
|
|
|
6553
6639
|
editItem({
|
|
6554
6640
|
type,
|
|
6555
6641
|
dataKey,
|
|
6556
|
-
itemKey: _optionalChain([data, 'optionalAccess',
|
|
6642
|
+
itemKey: _optionalChain([data, 'optionalAccess', _62 => _62.key]),
|
|
6557
6643
|
// For deletion
|
|
6558
6644
|
newKey: void 0
|
|
6559
6645
|
});
|
|
@@ -6588,7 +6674,7 @@ var ItemContextMenu = ({
|
|
|
6588
6674
|
{
|
|
6589
6675
|
onClick: () => {
|
|
6590
6676
|
if (!data) return;
|
|
6591
|
-
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess',
|
|
6677
|
+
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _63 => _63.key]));
|
|
6592
6678
|
toast({
|
|
6593
6679
|
description: "Key copied to clipboard"
|
|
6594
6680
|
});
|
|
@@ -6600,11 +6686,11 @@ var ItemContextMenu = ({
|
|
|
6600
6686
|
]
|
|
6601
6687
|
}
|
|
6602
6688
|
),
|
|
6603
|
-
_optionalChain([data, 'optionalAccess',
|
|
6689
|
+
_optionalChain([data, 'optionalAccess', _64 => _64.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6604
6690
|
ContextMenuItem,
|
|
6605
6691
|
{
|
|
6606
6692
|
onClick: () => {
|
|
6607
|
-
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
6693
|
+
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _65 => _65.value]), () => ( "")));
|
|
6608
6694
|
toast({
|
|
6609
6695
|
description: "Value copied to clipboard"
|
|
6610
6696
|
});
|
|
@@ -6716,7 +6802,7 @@ var useSetHashTTL = () => {
|
|
|
6716
6802
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
6717
6803
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
6718
6804
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
6719
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
6805
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _66 => _66[field]]);
|
|
6720
6806
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6721
6807
|
TTLBadge,
|
|
6722
6808
|
{
|
|
@@ -6813,7 +6899,7 @@ var MonacoEditor = ({
|
|
|
6813
6899
|
if (!active || !monaco || !editorRef.current) {
|
|
6814
6900
|
return;
|
|
6815
6901
|
}
|
|
6816
|
-
_optionalChain([monaco, 'optionalAccess',
|
|
6902
|
+
_optionalChain([monaco, 'optionalAccess', _67 => _67.editor, 'access', _68 => _68.setModelLanguage, 'call', _69 => _69(editorRef.current.getModel(), language)]);
|
|
6817
6903
|
}, [monaco, language, active]);
|
|
6818
6904
|
const editor = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6819
6905
|
_react2.Editor,
|
|
@@ -6989,7 +7075,7 @@ var ListEditForm = ({
|
|
|
6989
7075
|
dataKey
|
|
6990
7076
|
});
|
|
6991
7077
|
const findValue = () => {
|
|
6992
|
-
for (const page of _nullishCoalesce(_optionalChain([query, 'access',
|
|
7078
|
+
for (const page of _nullishCoalesce(_optionalChain([query, 'access', _70 => _70.data, 'optionalAccess', _71 => _71.pages]), () => ( []))) {
|
|
6993
7079
|
const item = page.keys.find((item2) => item2.key === itemKey);
|
|
6994
7080
|
if (item && "value" in item) return item.value;
|
|
6995
7081
|
}
|
|
@@ -7019,11 +7105,19 @@ var ListEditForm = ({
|
|
|
7019
7105
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacthookform.FormProvider, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit, className: "flex h-full min-h-0 flex-col gap-2", children: [
|
|
7020
7106
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-h-0 grow flex-col gap-2", children: [
|
|
7021
7107
|
type === "zset" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NumberFormItem, { name: "value", label: valueLabel }),
|
|
7022
|
-
type !== "list" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7108
|
+
type !== "list" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7109
|
+
FormItem,
|
|
7110
|
+
{
|
|
7111
|
+
readOnly: type === "stream" && !isNew,
|
|
7112
|
+
name: "key",
|
|
7113
|
+
label: keyLabel,
|
|
7114
|
+
data: itemKey
|
|
7115
|
+
}
|
|
7116
|
+
),
|
|
7023
7117
|
type !== "set" && type !== "zset" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7024
7118
|
FormItem,
|
|
7025
7119
|
{
|
|
7026
|
-
readOnly: type === "stream",
|
|
7120
|
+
readOnly: type === "stream" && !isNew,
|
|
7027
7121
|
name: "value",
|
|
7028
7122
|
label: valueLabel,
|
|
7029
7123
|
data: _nullishCoalesce(itemValue, () => ( ""))
|
|
@@ -7060,7 +7154,7 @@ var ListEditForm = ({
|
|
|
7060
7154
|
variant: "primary",
|
|
7061
7155
|
type: "submit",
|
|
7062
7156
|
disabled: !form.formState.isValid || !form.formState.isDirty || type === "stream" && !isNew,
|
|
7063
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" })
|
|
7157
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoading: isPending, isLoadingText: isNew ? "Adding" : "Saving", children: isNew ? "Add Item" : "Save" })
|
|
7064
7158
|
}
|
|
7065
7159
|
)
|
|
7066
7160
|
}
|
|
@@ -7135,7 +7229,7 @@ var HashFieldTTLInfo = ({
|
|
|
7135
7229
|
fields
|
|
7136
7230
|
}) => {
|
|
7137
7231
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
7138
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
7232
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _72 => _72[field]]);
|
|
7139
7233
|
const [ttl, setTTL] = _react.useState.call(void 0, () => calculateTTL(expireAt));
|
|
7140
7234
|
_react.useEffect.call(void 0, () => {
|
|
7141
7235
|
setTTL(calculateTTL(expireAt));
|
|
@@ -7160,7 +7254,7 @@ var headerLabels = {
|
|
|
7160
7254
|
var ListDisplay = ({ dataKey, type }) => {
|
|
7161
7255
|
const { selectedListItem } = useTab();
|
|
7162
7256
|
const query = useFetchListItems({ dataKey, type });
|
|
7163
|
-
const isEmpty = query.isFetched && _optionalChain([query, 'access',
|
|
7257
|
+
const isEmpty = query.isFetched && _optionalChain([query, 'access', _73 => _73.data, 'optionalAccess', _74 => _74.pages, 'access', _75 => _75.every, 'call', _76 => _76((page) => page.keys.length === 0)]);
|
|
7164
7258
|
if (isEmpty) {
|
|
7165
7259
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyDeleted, {});
|
|
7166
7260
|
}
|
|
@@ -7176,7 +7270,7 @@ var ListItems = ({
|
|
|
7176
7270
|
dataKey
|
|
7177
7271
|
}) => {
|
|
7178
7272
|
const { setSelectedListItem } = useTab();
|
|
7179
|
-
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access',
|
|
7273
|
+
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _77 => _77.data, 'optionalAccess', _78 => _78.pages, 'access', _79 => _79.flatMap, 'call', _80 => _80((page) => page.keys)]), () => ( [])), [query.data]);
|
|
7180
7274
|
const fields = _react.useMemo.call(void 0, () => keys.map((key) => key.key), [keys]);
|
|
7181
7275
|
const { mutate: editItem } = useEditListItem();
|
|
7182
7276
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -7327,6 +7421,7 @@ var DataDisplay = () => {
|
|
|
7327
7421
|
|
|
7328
7422
|
|
|
7329
7423
|
|
|
7424
|
+
|
|
7330
7425
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
7331
7426
|
|
|
7332
7427
|
|
|
@@ -7348,7 +7443,7 @@ function AddKeyModal() {
|
|
|
7348
7443
|
setSelectedKey(key);
|
|
7349
7444
|
setOpen(false);
|
|
7350
7445
|
setTimeout(() => {
|
|
7351
|
-
_optionalChain([window, 'access',
|
|
7446
|
+
_optionalChain([window, 'access', _81 => _81.document, 'access', _82 => _82.querySelector, 'call', _83 => _83(`[data-key="${key}"]`), 'optionalAccess', _84 => _84.scrollIntoView, 'call', _85 => _85({
|
|
7352
7447
|
behavior: "smooth",
|
|
7353
7448
|
block: "start",
|
|
7354
7449
|
inline: "nearest"
|
|
@@ -7404,7 +7499,7 @@ function AddKeyModal() {
|
|
|
7404
7499
|
}
|
|
7405
7500
|
)
|
|
7406
7501
|
] }),
|
|
7407
|
-
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access',
|
|
7502
|
+
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _86 => _86.errors, 'access', _87 => _87.key, 'optionalAccess', _88 => _88.message]) }),
|
|
7408
7503
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
7409
7504
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
7410
7505
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -7432,6 +7527,31 @@ function AddKeyModal() {
|
|
|
7432
7527
|
|
|
7433
7528
|
|
|
7434
7529
|
|
|
7530
|
+
// src/lib/scan-keys.ts
|
|
7531
|
+
async function scanKeys(redis, {
|
|
7532
|
+
match,
|
|
7533
|
+
type,
|
|
7534
|
+
count: count2 = 100,
|
|
7535
|
+
limit
|
|
7536
|
+
} = {}) {
|
|
7537
|
+
let cursor = "0";
|
|
7538
|
+
const result = [];
|
|
7539
|
+
while (true) {
|
|
7540
|
+
const [newCursor, keys] = await redis.scan(cursor, {
|
|
7541
|
+
count: count2,
|
|
7542
|
+
type,
|
|
7543
|
+
match
|
|
7544
|
+
});
|
|
7545
|
+
result.push(...keys);
|
|
7546
|
+
if (limit && result.length >= limit) {
|
|
7547
|
+
return result.slice(0, limit);
|
|
7548
|
+
}
|
|
7549
|
+
if (newCursor === "0") break;
|
|
7550
|
+
cursor = newCursor;
|
|
7551
|
+
}
|
|
7552
|
+
return result;
|
|
7553
|
+
}
|
|
7554
|
+
|
|
7435
7555
|
// src/components/databrowser/components/query-wizard/consent-prompt.tsx
|
|
7436
7556
|
|
|
7437
7557
|
|
|
@@ -8417,7 +8537,7 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8417
8537
|
const fetchSampleKeys = _reactquery.useMutation.call(void 0, {
|
|
8418
8538
|
mutationFn: async (index) => {
|
|
8419
8539
|
const firstTenKeys = await scanKeys(redis, {
|
|
8420
|
-
match: `${_optionalChain([index, 'access',
|
|
8540
|
+
match: `${_optionalChain([index, 'access', _89 => _89.prefixes, 'optionalAccess', _90 => _90[0]])}*`,
|
|
8421
8541
|
type: index.dataType,
|
|
8422
8542
|
limit: 10
|
|
8423
8543
|
});
|
|
@@ -8447,7 +8567,7 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8447
8567
|
if (!input.trim() || !valuesSearch.index) return;
|
|
8448
8568
|
try {
|
|
8449
8569
|
let samples = sampleData;
|
|
8450
|
-
if (samples.length === 0 && _optionalChain([indexData, 'optionalAccess',
|
|
8570
|
+
if (samples.length === 0 && _optionalChain([indexData, 'optionalAccess', _91 => _91.prefixes, 'optionalAccess', _92 => _92[0]])) {
|
|
8451
8571
|
samples = await fetchSampleKeys.mutateAsync(indexData);
|
|
8452
8572
|
}
|
|
8453
8573
|
const result = await generateQuery.mutateAsync({
|
|
@@ -8458,7 +8578,7 @@ var QueryWizardPopover = ({ onClose }) => {
|
|
|
8458
8578
|
const queryString = toJsLiteral(result.query);
|
|
8459
8579
|
setValuesSearchQuery(queryString);
|
|
8460
8580
|
setQueryBuilderMode("code");
|
|
8461
|
-
_optionalChain([onClose, 'optionalCall',
|
|
8581
|
+
_optionalChain([onClose, 'optionalCall', _93 => _93()]);
|
|
8462
8582
|
} catch (error) {
|
|
8463
8583
|
console.error("Error generating query:", error);
|
|
8464
8584
|
}
|
|
@@ -8563,7 +8683,7 @@ var CreateIndexModal = ({
|
|
|
8563
8683
|
className: "max-w-2xl",
|
|
8564
8684
|
onEscapeKeyDown: (e) => {
|
|
8565
8685
|
const active = document.activeElement;
|
|
8566
|
-
if (_optionalChain([active, 'optionalAccess',
|
|
8686
|
+
if (_optionalChain([active, 'optionalAccess', _94 => _94.closest, 'call', _95 => _95(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _96 => _96.tagName]) === "TEXTAREA") {
|
|
8567
8687
|
e.preventDefault();
|
|
8568
8688
|
}
|
|
8569
8689
|
},
|
|
@@ -8598,7 +8718,7 @@ var EditIndexModal = ({
|
|
|
8598
8718
|
className: "min-h-[500px] max-w-2xl",
|
|
8599
8719
|
onEscapeKeyDown: (e) => {
|
|
8600
8720
|
const active = document.activeElement;
|
|
8601
|
-
if (_optionalChain([active, 'optionalAccess',
|
|
8721
|
+
if (_optionalChain([active, 'optionalAccess', _97 => _97.closest, 'call', _98 => _98(".monaco-editor")]) || _optionalChain([active, 'optionalAccess', _99 => _99.tagName]) === "TEXTAREA") {
|
|
8602
8722
|
e.preventDefault();
|
|
8603
8723
|
}
|
|
8604
8724
|
},
|
|
@@ -8712,7 +8832,7 @@ var SearchInput = () => {
|
|
|
8712
8832
|
} else if (e.key === "Escape") {
|
|
8713
8833
|
setState("");
|
|
8714
8834
|
setFocusedIndex(-1);
|
|
8715
|
-
_optionalChain([inputRef, 'access',
|
|
8835
|
+
_optionalChain([inputRef, 'access', _100 => _100.current, 'optionalAccess', _101 => _101.blur, 'call', _102 => _102()]);
|
|
8716
8836
|
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
8717
8837
|
e.preventDefault();
|
|
8718
8838
|
if (focusedIndex < filteredHistory.length - 1) {
|
|
@@ -8726,7 +8846,7 @@ var SearchInput = () => {
|
|
|
8726
8846
|
setFocusedIndex(focusedIndex - 1);
|
|
8727
8847
|
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
8728
8848
|
setFocusedIndex(-1);
|
|
8729
|
-
_optionalChain([inputRef, 'access',
|
|
8849
|
+
_optionalChain([inputRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.focus, 'call', _105 => _105()]);
|
|
8730
8850
|
} else if (filteredHistory.length > 0) {
|
|
8731
8851
|
setFocusedIndex(filteredHistory.length - 1);
|
|
8732
8852
|
}
|
|
@@ -8874,19 +8994,26 @@ var IndexSelector = () => {
|
|
|
8874
8994
|
valuesSearch: { index },
|
|
8875
8995
|
setValuesSearchIndex
|
|
8876
8996
|
} = useTab();
|
|
8877
|
-
const { data: indexes, isLoading } = useFetchSearchIndexes();
|
|
8878
8997
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
8998
|
+
const [search, setSearch] = _react.useState.call(void 0, "");
|
|
8999
|
+
const debouncedSearch = useDebounce(search, 150);
|
|
9000
|
+
const match = debouncedSearch ? `${debouncedSearch}*` : void 0;
|
|
9001
|
+
const {
|
|
9002
|
+
data: indexes,
|
|
9003
|
+
isLoading,
|
|
9004
|
+
hasNextPage,
|
|
9005
|
+
fetchNextPage,
|
|
9006
|
+
isFetchingNextPage
|
|
9007
|
+
} = useFetchSearchIndexes({ match });
|
|
9008
|
+
const [editingIndex, setEditingIndex] = _react.useState.call(void 0, );
|
|
8879
9009
|
_react.useEffect.call(void 0, () => {
|
|
8880
|
-
if (!indexes || isLoading) return;
|
|
9010
|
+
if (!indexes || isLoading || debouncedSearch) return;
|
|
8881
9011
|
if (index && !indexes.includes(index)) {
|
|
8882
9012
|
setValuesSearchIndex("");
|
|
8883
9013
|
} else if (!index && indexes.length > 0) {
|
|
8884
9014
|
setValuesSearchIndex(indexes[0]);
|
|
8885
9015
|
}
|
|
8886
|
-
}, [indexes, index, isLoading, setValuesSearchIndex]);
|
|
8887
|
-
const [search, setSearch] = _react.useState.call(void 0, "");
|
|
8888
|
-
const [editingIndex, setEditingIndex] = _react.useState.call(void 0, );
|
|
8889
|
-
const filteredIndexes = _optionalChain([indexes, 'optionalAccess', _102 => _102.filter, 'call', _103 => _103((idx) => idx.toLowerCase().includes(search.toLowerCase()))]);
|
|
9016
|
+
}, [indexes, index, isLoading, setValuesSearchIndex, debouncedSearch]);
|
|
8890
9017
|
const handleEditIndex = (indexName) => {
|
|
8891
9018
|
setOpen(false);
|
|
8892
9019
|
setEditingIndex(indexName);
|
|
@@ -8923,8 +9050,9 @@ var IndexSelector = () => {
|
|
|
8923
9050
|
)
|
|
8924
9051
|
] }),
|
|
8925
9052
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "max-h-[200px] overflow-y-auto", children: [
|
|
8926
|
-
|
|
8927
|
-
_optionalChain([
|
|
9053
|
+
isLoading && !indexes && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconLoader2, { className: "size-4 animate-spin text-zinc-400" }) }),
|
|
9054
|
+
!isLoading && _optionalChain([indexes, 'optionalAccess', _106 => _106.length]) === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-4 text-center text-sm text-zinc-500", children: "No indexes found" }),
|
|
9055
|
+
_optionalChain([indexes, 'optionalAccess', _107 => _107.map, 'call', _108 => _108((idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
8928
9056
|
"div",
|
|
8929
9057
|
{
|
|
8930
9058
|
className: "flex h-9 items-center rounded-md px-2 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-200",
|
|
@@ -8967,7 +9095,16 @@ var IndexSelector = () => {
|
|
|
8967
9095
|
]
|
|
8968
9096
|
},
|
|
8969
9097
|
idx
|
|
8970
|
-
))])
|
|
9098
|
+
))]),
|
|
9099
|
+
hasNextPage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
9100
|
+
"button",
|
|
9101
|
+
{
|
|
9102
|
+
onClick: () => fetchNextPage(),
|
|
9103
|
+
disabled: isFetchingNextPage,
|
|
9104
|
+
className: "flex h-9 w-full items-center justify-center rounded-md text-sm text-emerald-600 transition-colors hover:bg-zinc-100 disabled:opacity-50",
|
|
9105
|
+
children: isFetchingNextPage ? "Loading..." : "Load more"
|
|
9106
|
+
}
|
|
9107
|
+
)
|
|
8971
9108
|
] })
|
|
8972
9109
|
] }) })
|
|
8973
9110
|
]
|
|
@@ -9083,7 +9220,7 @@ var generateNestedInterface = (obj, indent = " ") => {
|
|
|
9083
9220
|
var toAmbientTypes = (types) => types.replaceAll(/export const (\w+) = (\[.*?]) as const;/g, "declare const $1: readonly $2;").replaceAll("export ", "");
|
|
9084
9221
|
var generateTypeDefinitions = (schema) => {
|
|
9085
9222
|
let schemaFieldsInterface = "";
|
|
9086
|
-
const schemaFields = _optionalChain([schema, 'optionalAccess',
|
|
9223
|
+
const schemaFields = _optionalChain([schema, 'optionalAccess', _109 => _109.schema]);
|
|
9087
9224
|
if (schemaFields && Object.keys(schemaFields).length > 0) {
|
|
9088
9225
|
const nested = buildNestedSchema(schemaFields);
|
|
9089
9226
|
const fieldLines = generateNestedInterface(nested);
|
|
@@ -9541,7 +9678,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
9541
9678
|
showReindex: isValuesSearchSelected,
|
|
9542
9679
|
onDeleteConfirm: async (e, options) => {
|
|
9543
9680
|
e.stopPropagation();
|
|
9544
|
-
await deleteKey({ keys: contextKeys, reindex: _optionalChain([options, 'optionalAccess',
|
|
9681
|
+
await deleteKey({ keys: contextKeys, reindex: _optionalChain([options, 'optionalAccess', _110 => _110.reindex]) });
|
|
9545
9682
|
setAlertOpen(false);
|
|
9546
9683
|
}
|
|
9547
9684
|
}
|
|
@@ -10437,7 +10574,7 @@ var QueryCondition = ({
|
|
|
10437
10574
|
setLocalValue(formattedConditionValue);
|
|
10438
10575
|
}
|
|
10439
10576
|
const currentFieldInfo = fieldInfos.find((f) => f.name === condition.field);
|
|
10440
|
-
const currentFieldType = _nullishCoalesce(_optionalChain([currentFieldInfo, 'optionalAccess',
|
|
10577
|
+
const currentFieldType = _nullishCoalesce(_optionalChain([currentFieldInfo, 'optionalAccess', _111 => _111.type]), () => ( "unknown"));
|
|
10441
10578
|
const isUnknownField = condition.field && !fieldNames.includes(condition.field);
|
|
10442
10579
|
const getValueTypeError = () => {
|
|
10443
10580
|
if (isUnknownField || currentFieldType === "unknown" || currentFieldType === "string") {
|
|
@@ -10495,8 +10632,8 @@ var QueryCondition = ({
|
|
|
10495
10632
|
}
|
|
10496
10633
|
}, [currentFieldType, condition.value]);
|
|
10497
10634
|
const handleFieldChange = (value) => {
|
|
10498
|
-
const newFieldInfo = _optionalChain([fieldInfos, 'optionalAccess',
|
|
10499
|
-
const newFieldType = _nullishCoalesce(_optionalChain([newFieldInfo, 'optionalAccess',
|
|
10635
|
+
const newFieldInfo = _optionalChain([fieldInfos, 'optionalAccess', _112 => _112.find, 'call', _113 => _113((f) => f.name === value)]);
|
|
10636
|
+
const newFieldType = _nullishCoalesce(_optionalChain([newFieldInfo, 'optionalAccess', _114 => _114.type]), () => ( "unknown"));
|
|
10500
10637
|
const validOperators = getOperatorsForFieldType(newFieldType);
|
|
10501
10638
|
const isOperatorValid = validOperators.includes(condition.operator);
|
|
10502
10639
|
let newValue = condition.value;
|
|
@@ -10637,10 +10774,10 @@ var QueryCondition = ({
|
|
|
10637
10774
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10638
10775
|
"div",
|
|
10639
10776
|
{
|
|
10640
|
-
ref: _optionalChain([dragHandleProps, 'optionalAccess',
|
|
10777
|
+
ref: _optionalChain([dragHandleProps, 'optionalAccess', _115 => _115.ref]),
|
|
10641
10778
|
className: "flex cursor-grab items-center px-1 text-zinc-400 hover:text-zinc-600",
|
|
10642
|
-
..._optionalChain([dragHandleProps, 'optionalAccess',
|
|
10643
|
-
..._optionalChain([dragHandleProps, 'optionalAccess',
|
|
10779
|
+
..._optionalChain([dragHandleProps, 'optionalAccess', _116 => _116.attributes]),
|
|
10780
|
+
..._optionalChain([dragHandleProps, 'optionalAccess', _117 => _117.listeners]),
|
|
10644
10781
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconGripVertical, { size: 16 })
|
|
10645
10782
|
}
|
|
10646
10783
|
),
|
|
@@ -11148,10 +11285,10 @@ var InnerGroup = ({
|
|
|
11148
11285
|
!isRoot && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11149
11286
|
"div",
|
|
11150
11287
|
{
|
|
11151
|
-
ref: _optionalChain([dragHandleProps, 'optionalAccess',
|
|
11288
|
+
ref: _optionalChain([dragHandleProps, 'optionalAccess', _118 => _118.ref]),
|
|
11152
11289
|
className: "flex cursor-grab items-center px-1 text-zinc-400",
|
|
11153
|
-
..._optionalChain([dragHandleProps, 'optionalAccess',
|
|
11154
|
-
..._optionalChain([dragHandleProps, 'optionalAccess',
|
|
11290
|
+
..._optionalChain([dragHandleProps, 'optionalAccess', _119 => _119.attributes]),
|
|
11291
|
+
..._optionalChain([dragHandleProps, 'optionalAccess', _120 => _120.listeners]),
|
|
11155
11292
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconGripVertical, { size: 16 })
|
|
11156
11293
|
}
|
|
11157
11294
|
),
|
|
@@ -11500,7 +11637,7 @@ var UIQueryBuilder = () => {
|
|
|
11500
11637
|
const { valuesSearch } = useTab();
|
|
11501
11638
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
11502
11639
|
const { queryState, setQueryState } = useQueryStateSync();
|
|
11503
|
-
const fieldInfos = _optionalChain([indexDetails, 'optionalAccess',
|
|
11640
|
+
const fieldInfos = _optionalChain([indexDetails, 'optionalAccess', _121 => _121.schema]) ? extractFieldInfo(indexDetails.schema) : [];
|
|
11504
11641
|
const hasNormalized = _react.useRef.call(void 0, false);
|
|
11505
11642
|
_react.useEffect.call(void 0, () => {
|
|
11506
11643
|
if (hasNormalized.current || fieldInfos.length === 0) return;
|
|
@@ -11519,7 +11656,7 @@ var UIQueryBuilder = () => {
|
|
|
11519
11656
|
setHasBottomShadow(scrollTop + clientHeight < scrollHeight - 1);
|
|
11520
11657
|
}, []);
|
|
11521
11658
|
_react.useEffect.call(void 0, () => {
|
|
11522
|
-
viewportRef.current = _optionalChain([scrollAreaRef, 'access',
|
|
11659
|
+
viewportRef.current = _optionalChain([scrollAreaRef, 'access', _122 => _122.current, 'optionalAccess', _123 => _123.querySelector, 'call', _124 => _124(
|
|
11523
11660
|
"[data-radix-scroll-area-viewport]"
|
|
11524
11661
|
)]);
|
|
11525
11662
|
recomputeShadows();
|
|
@@ -11868,7 +12005,7 @@ var useOverflow = () => {
|
|
|
11868
12005
|
}
|
|
11869
12006
|
if (!node) return;
|
|
11870
12007
|
observerRef.current = new ResizeObserver((entries) => {
|
|
11871
|
-
const el = _optionalChain([entries, 'access',
|
|
12008
|
+
const el = _optionalChain([entries, 'access', _125 => _125.at, 'call', _126 => _126(0), 'optionalAccess', _127 => _127.target]);
|
|
11872
12009
|
if (!el) return;
|
|
11873
12010
|
setIsOverflow(el.scrollWidth > el.clientWidth);
|
|
11874
12011
|
});
|
|
@@ -11876,7 +12013,7 @@ var useOverflow = () => {
|
|
|
11876
12013
|
}, []);
|
|
11877
12014
|
_react.useEffect.call(void 0, () => {
|
|
11878
12015
|
return () => {
|
|
11879
|
-
_optionalChain([observerRef, 'access',
|
|
12016
|
+
_optionalChain([observerRef, 'access', _128 => _128.current, 'optionalAccess', _129 => _129.disconnect, 'call', _130 => _130()]);
|
|
11880
12017
|
};
|
|
11881
12018
|
}, []);
|
|
11882
12019
|
return { ref, isOverflow };
|
|
@@ -11994,8 +12131,8 @@ var SortableTab = ({ id }) => {
|
|
|
11994
12131
|
const [originalWidth, setOriginalWidth] = _react.useState.call(void 0, null);
|
|
11995
12132
|
const textRef = _react.useRef.call(void 0, null);
|
|
11996
12133
|
const { tabs } = useDatabrowserStore();
|
|
11997
|
-
const tabData = _optionalChain([tabs, 'access',
|
|
11998
|
-
const isPinned = _optionalChain([tabData, 'optionalAccess',
|
|
12134
|
+
const tabData = _optionalChain([tabs, 'access', _131 => _131.find, 'call', _132 => _132(([tabId]) => tabId === id), 'optionalAccess', _133 => _133[1]]);
|
|
12135
|
+
const isPinned = _optionalChain([tabData, 'optionalAccess', _134 => _134.pinned]);
|
|
11999
12136
|
const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = _sortable.useSortable.call(void 0, {
|
|
12000
12137
|
id,
|
|
12001
12138
|
disabled: isPinned,
|
|
@@ -12211,7 +12348,7 @@ function AddTabButton() {
|
|
|
12211
12348
|
const tabsId = addTab();
|
|
12212
12349
|
selectTab(tabsId);
|
|
12213
12350
|
setTimeout(() => {
|
|
12214
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
12351
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _135 => _135.current, 'optionalAccess', _136 => _136.querySelector, 'call', _137 => _137(`#tab-${tabsId}`)]);
|
|
12215
12352
|
if (!tab) return;
|
|
12216
12353
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
12217
12354
|
}, 20);
|
|
@@ -12245,7 +12382,7 @@ function TabsListButton({
|
|
|
12245
12382
|
onSelectTab(id);
|
|
12246
12383
|
setOpen(false);
|
|
12247
12384
|
setTimeout(() => {
|
|
12248
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
12385
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _138 => _138.current, 'optionalAccess', _139 => _139.querySelector, 'call', _140 => _140(`#tab-${id}`)]);
|
|
12249
12386
|
if (!tab) return;
|
|
12250
12387
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
12251
12388
|
}, 20);
|