@upstash/react-redis-browser 0.2.13-canary-2 → 0.2.13
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 +234 -282
- package/dist/index.js +609 -1398
- package/dist/index.mjs +921 -1710
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -193,10 +193,7 @@ var queryClient = new (0, _reactquery.QueryClient)({
|
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
195
|
queryCache: new (0, _reactquery.QueryCache)({
|
|
196
|
-
onError:
|
|
197
|
-
if (_optionalChain([query, 'access', _4 => _4.meta, 'optionalAccess', _5 => _5.hideToast])) return;
|
|
198
|
-
handleError(error);
|
|
199
|
-
}
|
|
196
|
+
onError: handleError
|
|
200
197
|
}),
|
|
201
198
|
mutationCache: new (0, _reactquery.MutationCache)({
|
|
202
199
|
onError: handleError
|
|
@@ -266,7 +263,7 @@ var DatabrowserProvider = ({
|
|
|
266
263
|
removeItem: () => {
|
|
267
264
|
}
|
|
268
265
|
},
|
|
269
|
-
version:
|
|
266
|
+
version: 5,
|
|
270
267
|
migrate: (originalState, version) => {
|
|
271
268
|
const state = originalState;
|
|
272
269
|
if (version <= 1) {
|
|
@@ -282,19 +279,6 @@ var DatabrowserProvider = ({
|
|
|
282
279
|
];
|
|
283
280
|
});
|
|
284
281
|
}
|
|
285
|
-
if (version <= 5) {
|
|
286
|
-
state.tabs = state.tabs.map(([id, data]) => {
|
|
287
|
-
const oldData = data;
|
|
288
|
-
return [
|
|
289
|
-
id,
|
|
290
|
-
{
|
|
291
|
-
...data,
|
|
292
|
-
valuesSearch: _nullishCoalesce(oldData.valuesSearch, () => ( { index: "", query: "" })),
|
|
293
|
-
isValuesSearchSelected: _nullishCoalesce(oldData.isValuesSearchSelected, () => ( false))
|
|
294
|
-
}
|
|
295
|
-
];
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
282
|
return state;
|
|
299
283
|
}
|
|
300
284
|
})
|
|
@@ -326,8 +310,6 @@ var storeCreator = (set, get) => ({
|
|
|
326
310
|
id,
|
|
327
311
|
selectedKeys: [],
|
|
328
312
|
search: { key: "", type: void 0 },
|
|
329
|
-
valuesSearch: { index: "", query: "" },
|
|
330
|
-
isValuesSearchSelected: false,
|
|
331
313
|
pinned: false
|
|
332
314
|
};
|
|
333
315
|
set((old) => ({
|
|
@@ -420,7 +402,7 @@ var storeCreator = (set, get) => ({
|
|
|
420
402
|
set({ selectedTab: id });
|
|
421
403
|
},
|
|
422
404
|
getSelectedKeys: (tabId) => {
|
|
423
|
-
return _nullishCoalesce(_optionalChain([get, 'call',
|
|
405
|
+
return _nullishCoalesce(_optionalChain([get, 'call', _4 => _4(), 'access', _5 => _5.tabs, 'access', _6 => _6.find, 'call', _7 => _7(([id]) => id === tabId), 'optionalAccess', _8 => _8[1], 'optionalAccess', _9 => _9.selectedKeys]), () => ( []));
|
|
424
406
|
},
|
|
425
407
|
setSelectedKey: (tabId, key) => {
|
|
426
408
|
get().setSelectedKeys(tabId, key ? [key] : []);
|
|
@@ -487,58 +469,6 @@ var storeCreator = (set, get) => ({
|
|
|
487
469
|
return { ...old, tabs: newTabs };
|
|
488
470
|
});
|
|
489
471
|
},
|
|
490
|
-
setValuesSearch: (tabId, valuesSearch) => {
|
|
491
|
-
set((old) => {
|
|
492
|
-
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
493
|
-
if (tabIndex === -1) return old;
|
|
494
|
-
const newTabs = [...old.tabs];
|
|
495
|
-
const [, tabData] = newTabs[tabIndex];
|
|
496
|
-
newTabs[tabIndex] = [tabId, { ...tabData, valuesSearch }];
|
|
497
|
-
return { ...old, tabs: newTabs };
|
|
498
|
-
});
|
|
499
|
-
},
|
|
500
|
-
setValuesSearchIndex: (tabId, index) => {
|
|
501
|
-
set((old) => {
|
|
502
|
-
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
503
|
-
if (tabIndex === -1) return old;
|
|
504
|
-
const newTabs = [...old.tabs];
|
|
505
|
-
const [, tabData] = newTabs[tabIndex];
|
|
506
|
-
newTabs[tabIndex] = [
|
|
507
|
-
tabId,
|
|
508
|
-
{
|
|
509
|
-
...tabData,
|
|
510
|
-
valuesSearch: { ...tabData.valuesSearch, index }
|
|
511
|
-
}
|
|
512
|
-
];
|
|
513
|
-
return { ...old, tabs: newTabs };
|
|
514
|
-
});
|
|
515
|
-
},
|
|
516
|
-
setValuesSearchQuery: (tabId, query) => {
|
|
517
|
-
set((old) => {
|
|
518
|
-
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
519
|
-
if (tabIndex === -1) return old;
|
|
520
|
-
const newTabs = [...old.tabs];
|
|
521
|
-
const [, tabData] = newTabs[tabIndex];
|
|
522
|
-
newTabs[tabIndex] = [
|
|
523
|
-
tabId,
|
|
524
|
-
{
|
|
525
|
-
...tabData,
|
|
526
|
-
valuesSearch: { ...tabData.valuesSearch, query }
|
|
527
|
-
}
|
|
528
|
-
];
|
|
529
|
-
return { ...old, tabs: newTabs };
|
|
530
|
-
});
|
|
531
|
-
},
|
|
532
|
-
setIsValuesSearchSelected: (tabId, isSelected) => {
|
|
533
|
-
set((old) => {
|
|
534
|
-
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
535
|
-
if (tabIndex === -1) return old;
|
|
536
|
-
const newTabs = [...old.tabs];
|
|
537
|
-
const [, tabData] = newTabs[tabIndex];
|
|
538
|
-
newTabs[tabIndex] = [tabId, { ...tabData, isValuesSearchSelected: isSelected }];
|
|
539
|
-
return { ...old, tabs: newTabs };
|
|
540
|
-
});
|
|
541
|
-
},
|
|
542
472
|
searchHistory: [],
|
|
543
473
|
addSearchHistory: (key) => {
|
|
544
474
|
set((old) => ({ ...old, searchHistory: [key, ...old.searchHistory] }));
|
|
@@ -568,37 +498,27 @@ var useTab = () => {
|
|
|
568
498
|
setSelectedListItem,
|
|
569
499
|
setSearch,
|
|
570
500
|
setSearchKey,
|
|
571
|
-
setSearchType
|
|
572
|
-
setValuesSearch,
|
|
573
|
-
setValuesSearchIndex,
|
|
574
|
-
setValuesSearchQuery,
|
|
575
|
-
setIsValuesSearchSelected
|
|
501
|
+
setSearchType
|
|
576
502
|
} = useDatabrowserStore();
|
|
577
503
|
const tabId = useTabId();
|
|
578
|
-
const tabData = _react.useMemo.call(void 0, () => _optionalChain([tabs, 'access',
|
|
504
|
+
const tabData = _react.useMemo.call(void 0, () => _optionalChain([tabs, 'access', _10 => _10.find, 'call', _11 => _11(([id]) => id === tabId), 'optionalAccess', _12 => _12[1]]), [tabs, tabId]);
|
|
579
505
|
if (!selectedTab) throw new Error("selectedTab is undefined when using useTab()");
|
|
580
506
|
if (!tabData) throw new Error("tabData is undefined when using useTab()");
|
|
581
507
|
return _react.useMemo.call(void 0,
|
|
582
508
|
() => ({
|
|
583
509
|
active: selectedTab === tabId,
|
|
584
|
-
selectedKey: _optionalChain([tabData, 'access',
|
|
510
|
+
selectedKey: _optionalChain([tabData, 'access', _13 => _13.selectedKeys, 'optionalAccess', _14 => _14[0]]),
|
|
585
511
|
// Backwards compatibility - first selected key
|
|
586
512
|
selectedKeys: _nullishCoalesce(tabData.selectedKeys, () => ( [])),
|
|
587
513
|
selectedListItem: tabData.selectedListItem,
|
|
588
514
|
search: tabData.search,
|
|
589
|
-
valuesSearch: tabData.valuesSearch,
|
|
590
|
-
isValuesSearchSelected: tabData.isValuesSearchSelected,
|
|
591
515
|
pinned: tabData.pinned,
|
|
592
516
|
setSelectedKey: (key) => setSelectedKey(tabId, key),
|
|
593
517
|
setSelectedKeys: (keys) => setSelectedKeys(tabId, keys),
|
|
594
518
|
setSelectedListItem: (item) => setSelectedListItem(tabId, item),
|
|
595
519
|
setSearch: (search) => setSearch(tabId, search),
|
|
596
520
|
setSearchKey: (key) => setSearchKey(tabId, key),
|
|
597
|
-
setSearchType: (type) => setSearchType(tabId, type)
|
|
598
|
-
setValuesSearch: (search) => setValuesSearch(tabId, search),
|
|
599
|
-
setValuesSearchIndex: (index) => setValuesSearchIndex(tabId, index),
|
|
600
|
-
setValuesSearchQuery: (query) => setValuesSearchQuery(tabId, query),
|
|
601
|
-
setIsValuesSearchSelected: (isSelected) => setIsValuesSearchSelected(tabId, isSelected)
|
|
521
|
+
setSearchType: (type) => setSearchType(tabId, type)
|
|
602
522
|
}),
|
|
603
523
|
[selectedTab, tabs, tabId]
|
|
604
524
|
);
|
|
@@ -683,15 +603,15 @@ var getGroupRecursive = (classParts, classPartObject) => {
|
|
|
683
603
|
return void 0;
|
|
684
604
|
}
|
|
685
605
|
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
686
|
-
return _optionalChain([classPartObject, 'access',
|
|
606
|
+
return _optionalChain([classPartObject, 'access', _15 => _15.validators, 'access', _16 => _16.find, 'call', _17 => _17(({
|
|
687
607
|
validator
|
|
688
|
-
}) => validator(classRest)), 'optionalAccess',
|
|
608
|
+
}) => validator(classRest)), 'optionalAccess', _18 => _18.classGroupId]);
|
|
689
609
|
};
|
|
690
610
|
var arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
691
611
|
var getGroupIdForArbitraryProperty = (className) => {
|
|
692
612
|
if (arbitraryPropertyRegex.test(className)) {
|
|
693
613
|
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
694
|
-
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess',
|
|
614
|
+
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess', _19 => _19.substring, 'call', _20 => _20(0, arbitraryPropertyClassName.indexOf(":"))]);
|
|
695
615
|
if (property) {
|
|
696
616
|
return "arbitrary.." + property;
|
|
697
617
|
}
|
|
@@ -1797,7 +1717,7 @@ var getDefaultConfig = () => {
|
|
|
1797
1717
|
* Font Variant Numeric
|
|
1798
1718
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
1799
1719
|
*/
|
|
1800
|
-
"fvn-fraction": ["diagonal-fractions", "stacked-
|
|
1720
|
+
"fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
|
|
1801
1721
|
/**
|
|
1802
1722
|
* Letter Spacing
|
|
1803
1723
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
@@ -3106,14 +3026,9 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
3106
3026
|
function cn(...inputs) {
|
|
3107
3027
|
return twMerge(clsx(inputs));
|
|
3108
3028
|
}
|
|
3109
|
-
function
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
jsonified = jsonified.replaceAll(/,\s*([\]}])/g, "$1");
|
|
3113
|
-
return JSON.parse(jsonified);
|
|
3114
|
-
} catch (e3) {
|
|
3115
|
-
return;
|
|
3116
|
-
}
|
|
3029
|
+
function formatNumber(value) {
|
|
3030
|
+
const intl = new Intl.NumberFormat("en-US");
|
|
3031
|
+
return intl.format(value);
|
|
3117
3032
|
}
|
|
3118
3033
|
var units = {
|
|
3119
3034
|
year: 24 * 60 * 60 * 1e3 * 365,
|
|
@@ -3147,64 +3062,49 @@ var _reactportal = require('@radix-ui/react-portal');
|
|
|
3147
3062
|
|
|
3148
3063
|
// src/components/ui/toast.tsx
|
|
3149
3064
|
|
|
3150
|
-
var _reacttoast = require('@radix-ui/react-toast'); var ToastPrimitives = _interopRequireWildcard(_reacttoast);
|
|
3151
3065
|
var _iconsreact = require('@tabler/icons-react');
|
|
3152
|
-
|
|
3153
|
-
// node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs
|
|
3154
|
-
function r2(e) {
|
|
3155
|
-
var t, f, n = "";
|
|
3156
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
3157
|
-
else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r2(e[t])) && (n && (n += " "), n += f);
|
|
3158
|
-
else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
3159
|
-
return n;
|
|
3160
|
-
}
|
|
3161
|
-
function clsx2() {
|
|
3162
|
-
for (var e, t, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (t = r2(e)) && (n && (n += " "), n += t);
|
|
3163
|
-
return n;
|
|
3164
|
-
}
|
|
3066
|
+
var _reacttoast = require('@radix-ui/react-toast'); var ToastPrimitives = _interopRequireWildcard(_reacttoast);
|
|
3165
3067
|
|
|
3166
3068
|
// node_modules/class-variance-authority/dist/index.mjs
|
|
3167
|
-
var falsyToString = (value) => typeof value === "boolean" ?
|
|
3168
|
-
var cx =
|
|
3169
|
-
var cva = (base, config) => {
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
const
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
if (value === void 0) {
|
|
3184
|
-
return acc;
|
|
3185
|
-
}
|
|
3186
|
-
acc[key] = value;
|
|
3069
|
+
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
3070
|
+
var cx = clsx;
|
|
3071
|
+
var cva = (base, config) => (props) => {
|
|
3072
|
+
var _config_compoundVariants;
|
|
3073
|
+
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
3074
|
+
const { variants, defaultVariants } = config;
|
|
3075
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
3076
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
3077
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
3078
|
+
if (variantProp === null) return null;
|
|
3079
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
3080
|
+
return variants[variant][variantKey];
|
|
3081
|
+
});
|
|
3082
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
3083
|
+
let [key, value] = param;
|
|
3084
|
+
if (value === void 0) {
|
|
3187
3085
|
return acc;
|
|
3188
|
-
}
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
...
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3086
|
+
}
|
|
3087
|
+
acc[key] = value;
|
|
3088
|
+
return acc;
|
|
3089
|
+
}, {});
|
|
3090
|
+
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
|
|
3091
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
3092
|
+
return Object.entries(compoundVariantOptions).every((param2) => {
|
|
3093
|
+
let [key, value] = param2;
|
|
3094
|
+
return Array.isArray(value) ? value.includes({
|
|
3095
|
+
...defaultVariants,
|
|
3096
|
+
...propsWithoutUndefined
|
|
3097
|
+
}[key]) : {
|
|
3098
|
+
...defaultVariants,
|
|
3099
|
+
...propsWithoutUndefined
|
|
3100
|
+
}[key] === value;
|
|
3101
|
+
}) ? [
|
|
3102
|
+
...acc,
|
|
3103
|
+
cvClass,
|
|
3104
|
+
cvClassName
|
|
3105
|
+
] : acc;
|
|
3106
|
+
}, []);
|
|
3107
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
3208
3108
|
};
|
|
3209
3109
|
|
|
3210
3110
|
// src/components/ui/toast.tsx
|
|
@@ -3309,6 +3209,19 @@ function Toaster() {
|
|
|
3309
3209
|
] }) });
|
|
3310
3210
|
}
|
|
3311
3211
|
|
|
3212
|
+
// src/types/index.ts
|
|
3213
|
+
var DATA_TYPES = ["string", "list", "hash", "set", "zset", "json", "stream"];
|
|
3214
|
+
var DATA_TYPE_NAMES = {
|
|
3215
|
+
string: "String",
|
|
3216
|
+
list: "List",
|
|
3217
|
+
hash: "Hash",
|
|
3218
|
+
set: "Set",
|
|
3219
|
+
zset: "Sorted Set",
|
|
3220
|
+
json: "JSON",
|
|
3221
|
+
stream: "Stream"
|
|
3222
|
+
};
|
|
3223
|
+
var SIMPLE_DATA_TYPES = ["string", "json"];
|
|
3224
|
+
|
|
3312
3225
|
// src/components/databrowser/hooks/use-keys.tsx
|
|
3313
3226
|
|
|
3314
3227
|
|
|
@@ -3327,39 +3240,15 @@ var useFetchKeyType = (key) => {
|
|
|
3327
3240
|
});
|
|
3328
3241
|
};
|
|
3329
3242
|
|
|
3330
|
-
// src/components/databrowser/hooks/use-fetch-search-index.tsx
|
|
3331
|
-
|
|
3332
|
-
var FETCH_SEARCH_INDEX_QUERY_KEY = "fetch-search-index";
|
|
3333
|
-
var useFetchSearchIndex = (indexName) => {
|
|
3334
|
-
const { redisNoPipeline: redis } = useRedis();
|
|
3335
|
-
return _reactquery.useQuery.call(void 0, {
|
|
3336
|
-
queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, indexName],
|
|
3337
|
-
queryFn: async () => {
|
|
3338
|
-
if (!indexName) return;
|
|
3339
|
-
const result = await redis.search.index(indexName).describe();
|
|
3340
|
-
return result;
|
|
3341
|
-
},
|
|
3342
|
-
enabled: Boolean(indexName)
|
|
3343
|
-
});
|
|
3344
|
-
};
|
|
3345
|
-
|
|
3346
3243
|
// src/components/databrowser/hooks/use-keys.tsx
|
|
3347
3244
|
|
|
3348
3245
|
var KeysContext = _react.createContext.call(void 0, void 0);
|
|
3349
3246
|
var FETCH_KEYS_QUERY_KEY = "use-fetch-keys";
|
|
3350
3247
|
var SCAN_COUNTS = [100, 300, 500];
|
|
3351
3248
|
var KeysProvider = ({ children }) => {
|
|
3352
|
-
const { active, search
|
|
3353
|
-
const { data: searchIndexDetails, isLoading: isIndexDetailsLoading } = useFetchSearchIndex(
|
|
3354
|
-
valuesSearch.index
|
|
3355
|
-
);
|
|
3249
|
+
const { active, search } = useTab();
|
|
3356
3250
|
const { redisNoPipeline: redis } = useRedis();
|
|
3357
|
-
const
|
|
3358
|
-
const isQueryEnabled = active && (isValuesSearchSelected ? Boolean(valuesSearch.index) && Boolean(searchIndexDetails) : true);
|
|
3359
|
-
const redisKeyScan = async ({
|
|
3360
|
-
count: count2,
|
|
3361
|
-
cursor
|
|
3362
|
-
}) => {
|
|
3251
|
+
const performScan = async (count2, cursor) => {
|
|
3363
3252
|
const args = [cursor];
|
|
3364
3253
|
if (search.key) {
|
|
3365
3254
|
args.push("MATCH", search.key);
|
|
@@ -3369,46 +3258,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3369
3258
|
}
|
|
3370
3259
|
args.push("COUNT", count2.toString());
|
|
3371
3260
|
if (!search.type) args.push("WITHTYPE");
|
|
3372
|
-
|
|
3373
|
-
const keys2 = [];
|
|
3374
|
-
let index = 0;
|
|
3375
|
-
while (true) {
|
|
3376
|
-
if (search.type) {
|
|
3377
|
-
if (index >= values.length) break;
|
|
3378
|
-
keys2.push({ key: values[index], type: search.type });
|
|
3379
|
-
index += 1;
|
|
3380
|
-
} else {
|
|
3381
|
-
if (index + 1 >= values.length) break;
|
|
3382
|
-
keys2.push({ key: values[index], type: values[index + 1] });
|
|
3383
|
-
index += 2;
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
return { cursor: newCursor, keys: keys2 };
|
|
3387
|
-
};
|
|
3388
|
-
const redisValueScan = async ({
|
|
3389
|
-
count: count2,
|
|
3390
|
-
cursor
|
|
3391
|
-
}) => {
|
|
3392
|
-
if (!searchIndexDetails) throw new Error("Attempted search while loading the search index");
|
|
3393
|
-
const offset = Number.parseInt(cursor, 10) || 0;
|
|
3394
|
-
const result = await redis.search.index(valuesSearch.index).query({
|
|
3395
|
-
filter: _nullishCoalesce(parsedValueQuery, () => ( {})),
|
|
3396
|
-
limit: count2,
|
|
3397
|
-
offset,
|
|
3398
|
-
select: {}
|
|
3399
|
-
});
|
|
3400
|
-
const keys2 = result.map((doc) => ({
|
|
3401
|
-
key: doc.key,
|
|
3402
|
-
type: searchIndexDetails.dataType
|
|
3403
|
-
}));
|
|
3404
|
-
const hasMore = keys2.length >= count2;
|
|
3405
|
-
const nextCursor = hasMore ? String(offset + keys2.length) : "0";
|
|
3406
|
-
return { cursor: nextCursor, keys: keys2 };
|
|
3407
|
-
};
|
|
3408
|
-
const performScan = async (count2, cursor) => {
|
|
3409
|
-
const scanFunction = isValuesSearchSelected ? redisValueScan : redisKeyScan;
|
|
3410
|
-
const result = await scanFunction({ count: count2, cursor });
|
|
3411
|
-
return [result.cursor, result.keys];
|
|
3261
|
+
return await redis.exec(["SCAN", ...args]);
|
|
3412
3262
|
};
|
|
3413
3263
|
const scanUntilAvailable = async (cursor) => {
|
|
3414
3264
|
let i = 0;
|
|
@@ -3422,12 +3272,25 @@ var KeysProvider = ({ children }) => {
|
|
|
3422
3272
|
}
|
|
3423
3273
|
};
|
|
3424
3274
|
const query = _reactquery.useInfiniteQuery.call(void 0, {
|
|
3425
|
-
queryKey: [FETCH_KEYS_QUERY_KEY, search
|
|
3426
|
-
|
|
3275
|
+
queryKey: [FETCH_KEYS_QUERY_KEY, search],
|
|
3276
|
+
// Only fetch when tab is active
|
|
3277
|
+
enabled: active,
|
|
3427
3278
|
initialPageParam: "0",
|
|
3428
3279
|
queryFn: async ({ pageParam: lastCursor }) => {
|
|
3429
3280
|
const [cursor, values] = await scanUntilAvailable(lastCursor);
|
|
3430
|
-
const keys2 =
|
|
3281
|
+
const keys2 = [];
|
|
3282
|
+
let index = 0;
|
|
3283
|
+
while (true) {
|
|
3284
|
+
if (search.type) {
|
|
3285
|
+
if (index >= values.length) break;
|
|
3286
|
+
keys2.push([values[index], search.type]);
|
|
3287
|
+
index += 1;
|
|
3288
|
+
} else {
|
|
3289
|
+
if (index + 1 >= values.length) break;
|
|
3290
|
+
keys2.push([values[index], values[index + 1]]);
|
|
3291
|
+
index += 2;
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3431
3294
|
for (const [key, type] of keys2) {
|
|
3432
3295
|
queryClient.setQueryData([FETCH_KEY_TYPE_QUERY_KEY, key], type);
|
|
3433
3296
|
}
|
|
@@ -3437,15 +3300,12 @@ var KeysProvider = ({ children }) => {
|
|
|
3437
3300
|
hasNextPage: cursor !== "0"
|
|
3438
3301
|
};
|
|
3439
3302
|
},
|
|
3440
|
-
meta: {
|
|
3441
|
-
hideToast: true
|
|
3442
|
-
},
|
|
3443
3303
|
select: (data) => data,
|
|
3444
3304
|
getNextPageParam: ({ cursor }) => cursor,
|
|
3445
3305
|
refetchOnMount: false
|
|
3446
3306
|
});
|
|
3447
3307
|
const keys = _react.useMemo.call(void 0, () => {
|
|
3448
|
-
const keys2 = _nullishCoalesce(_optionalChain([query, 'access',
|
|
3308
|
+
const keys2 = _nullishCoalesce(_optionalChain([query, 'access', _21 => _21.data, 'optionalAccess', _22 => _22.pages, 'access', _23 => _23.flatMap, 'call', _24 => _24((page) => page.keys)]), () => ( []));
|
|
3449
3309
|
const keysSet = /* @__PURE__ */ new Set();
|
|
3450
3310
|
const dedupedKeys = [];
|
|
3451
3311
|
for (const key of keys2) {
|
|
@@ -3460,10 +3320,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3460
3320
|
{
|
|
3461
3321
|
value: {
|
|
3462
3322
|
keys,
|
|
3463
|
-
query
|
|
3464
|
-
...query,
|
|
3465
|
-
isLoading: query.isLoading || isIndexDetailsLoading
|
|
3466
|
-
}
|
|
3323
|
+
query
|
|
3467
3324
|
},
|
|
3468
3325
|
children
|
|
3469
3326
|
}
|
|
@@ -3479,7 +3336,7 @@ var useKeys = () => {
|
|
|
3479
3336
|
var useKeyType = (key) => {
|
|
3480
3337
|
const { keys } = useKeys();
|
|
3481
3338
|
const keyTuple = _react.useMemo.call(void 0, () => keys.find(([k, _]) => k === key), [keys, key]);
|
|
3482
|
-
return _optionalChain([keyTuple, 'optionalAccess',
|
|
3339
|
+
return _optionalChain([keyTuple, 'optionalAccess', _25 => _25[1]]);
|
|
3483
3340
|
};
|
|
3484
3341
|
|
|
3485
3342
|
// src/components/databrowser/components/display/display-list.tsx
|
|
@@ -3491,24 +3348,24 @@ var useKeyType = (key) => {
|
|
|
3491
3348
|
var _reactslot = require('@radix-ui/react-slot');
|
|
3492
3349
|
|
|
3493
3350
|
var buttonVariants = cva(
|
|
3494
|
-
"inline-flex items-center justify-center rounded-
|
|
3351
|
+
"inline-flex items-center justify-center rounded-md text-sm ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
3495
3352
|
{
|
|
3496
3353
|
variants: {
|
|
3497
3354
|
variant: {
|
|
3498
|
-
default: "bg-white text-black border
|
|
3355
|
+
default: "bg-white text-black border shadow-sm border-zinc-300 hover:bg-white/70",
|
|
3499
3356
|
destructive: "bg-red-500 text-zinc-50 hover:bg-red-500/90",
|
|
3500
|
-
outline: "border border-zinc-
|
|
3501
|
-
primary: "bg-emerald-500 text-white
|
|
3357
|
+
outline: "border border-zinc-200 bg-white hover:bg-zinc-100 hover:text-zinc-900",
|
|
3358
|
+
primary: "bg-emerald-500 text-white shadow-sm hover:bg-emerald-600",
|
|
3502
3359
|
secondary: "bg-zinc-100 text-zinc-900 hover:bg-zinc-100/80",
|
|
3503
3360
|
ghost: "hover:bg-black/10",
|
|
3504
3361
|
link: "text-zinc-900 underline-offset-4 hover:underline"
|
|
3505
3362
|
},
|
|
3506
3363
|
size: {
|
|
3507
3364
|
default: "h-8 px-4 py-2",
|
|
3508
|
-
sm: "px-2 h-
|
|
3365
|
+
sm: "px-2 h-7 rounded-md",
|
|
3509
3366
|
lg: "h-10 px-8 rounded-md",
|
|
3510
3367
|
icon: "h-8 w-8",
|
|
3511
|
-
"icon-sm": "h-
|
|
3368
|
+
"icon-sm": "h-7 w-7",
|
|
3512
3369
|
"icon-xs": "h-5 w-5"
|
|
3513
3370
|
}
|
|
3514
3371
|
},
|
|
@@ -3528,6 +3385,37 @@ Button.displayName = "Button";
|
|
|
3528
3385
|
|
|
3529
3386
|
// src/components/databrowser/hooks/use-add-key.ts
|
|
3530
3387
|
|
|
3388
|
+
|
|
3389
|
+
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
// src/components/ui/skeleton.tsx
|
|
3393
|
+
|
|
3394
|
+
function Skeleton({ className, ...props }) {
|
|
3395
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("animate-pulse rounded-md bg-zinc-900/10", className), ...props });
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
// src/components/databrowser/components/sidebar/db-size.tsx
|
|
3399
|
+
|
|
3400
|
+
var FETCH_DB_SIZE_QUERY_KEY = "fetch-db-size";
|
|
3401
|
+
var DisplayDbSize = () => {
|
|
3402
|
+
const { redis } = useRedis();
|
|
3403
|
+
const { data: keyCount } = _reactquery.useQuery.call(void 0, {
|
|
3404
|
+
queryKey: [FETCH_DB_SIZE_QUERY_KEY],
|
|
3405
|
+
queryFn: async () => {
|
|
3406
|
+
return await redis.dbsize();
|
|
3407
|
+
}
|
|
3408
|
+
});
|
|
3409
|
+
if (keyCount === void 0) {
|
|
3410
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center gap-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "h-5 w-10 rounded" }) });
|
|
3411
|
+
}
|
|
3412
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "", children: [
|
|
3413
|
+
formatNumber(keyCount),
|
|
3414
|
+
" Keys"
|
|
3415
|
+
] });
|
|
3416
|
+
};
|
|
3417
|
+
|
|
3418
|
+
// src/components/databrowser/hooks/use-add-key.ts
|
|
3531
3419
|
var useAddKey = () => {
|
|
3532
3420
|
const { redis } = useRedis();
|
|
3533
3421
|
const mutation = _reactquery.useMutation.call(void 0, {
|
|
@@ -3577,6 +3465,9 @@ var useAddKey = () => {
|
|
|
3577
3465
|
}
|
|
3578
3466
|
},
|
|
3579
3467
|
onSuccess: (_, { key, type }) => {
|
|
3468
|
+
queryClient.invalidateQueries({
|
|
3469
|
+
queryKey: [FETCH_DB_SIZE_QUERY_KEY]
|
|
3470
|
+
});
|
|
3580
3471
|
queryClient.setQueriesData(
|
|
3581
3472
|
{
|
|
3582
3473
|
queryKey: [FETCH_KEYS_QUERY_KEY]
|
|
@@ -3689,7 +3580,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
3689
3580
|
// +1 since first message is the last one
|
|
3690
3581
|
LIST_DISPLAY_PAGE_SIZE + 1
|
|
3691
3582
|
);
|
|
3692
|
-
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access',
|
|
3583
|
+
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access', _26 => _26.at, 'call', _27 => _27(-1), 'optionalAccess', _28 => _28[0]]) : void 0;
|
|
3693
3584
|
return {
|
|
3694
3585
|
cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
|
|
3695
3586
|
keys: messages.map(([id, fields]) => ({
|
|
@@ -3784,6 +3675,9 @@ var useDeleteKey = () => {
|
|
|
3784
3675
|
},
|
|
3785
3676
|
onSuccess: (_, key) => {
|
|
3786
3677
|
deleteKeyCache(key);
|
|
3678
|
+
queryClient.invalidateQueries({
|
|
3679
|
+
queryKey: [FETCH_DB_SIZE_QUERY_KEY]
|
|
3680
|
+
});
|
|
3787
3681
|
}
|
|
3788
3682
|
});
|
|
3789
3683
|
return deleteKey;
|
|
@@ -3850,7 +3744,7 @@ var useEditListItem = () => {
|
|
|
3850
3744
|
}
|
|
3851
3745
|
case "stream": {
|
|
3852
3746
|
if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
|
|
3853
|
-
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess',
|
|
3747
|
+
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess', _29 => _29.split, 'call', _30 => _30("\n")]), () => ( []))).map(
|
|
3854
3748
|
({ key, value }) => [key, value]
|
|
3855
3749
|
);
|
|
3856
3750
|
pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
|
|
@@ -3878,12 +3772,6 @@ var useEditListItem = () => {
|
|
|
3878
3772
|
|
|
3879
3773
|
|
|
3880
3774
|
|
|
3881
|
-
// src/components/ui/skeleton.tsx
|
|
3882
|
-
|
|
3883
|
-
function Skeleton({ className, ...props }) {
|
|
3884
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("animate-pulse rounded-md bg-zinc-900/10", className), ...props });
|
|
3885
|
-
}
|
|
3886
|
-
|
|
3887
3775
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
3888
3776
|
var _bytes = require('bytes'); var _bytes2 = _interopRequireDefault(_bytes);
|
|
3889
3777
|
|
|
@@ -3911,9 +3799,6 @@ var useFetchKeyLength = ({ dataKey, type }) => {
|
|
|
3911
3799
|
case "stream": {
|
|
3912
3800
|
return await redis.xlen(dataKey);
|
|
3913
3801
|
}
|
|
3914
|
-
case "search": {
|
|
3915
|
-
return null;
|
|
3916
|
-
}
|
|
3917
3802
|
}
|
|
3918
3803
|
return null;
|
|
3919
3804
|
}
|
|
@@ -3941,7 +3826,7 @@ var LengthBadge = ({
|
|
|
3941
3826
|
content
|
|
3942
3827
|
}) => {
|
|
3943
3828
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
3944
|
-
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess',
|
|
3829
|
+
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _31 => _31.length]), () => ( data));
|
|
3945
3830
|
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 });
|
|
3946
3831
|
};
|
|
3947
3832
|
var SizeBadge = ({ dataKey }) => {
|
|
@@ -3962,8 +3847,8 @@ var HeaderTTLBadge = ({ dataKey }) => {
|
|
|
3962
3847
|
}
|
|
3963
3848
|
);
|
|
3964
3849
|
};
|
|
3965
|
-
var Badge = ({ children, label }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-
|
|
3966
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-zinc-500 dark:text-zinc-
|
|
3850
|
+
var Badge = ({ children, label }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-6 items-center gap-0.5 rounded-md bg-white px-2 text-xs text-zinc-700 dark:bg-zinc-200", children: [
|
|
3851
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-zinc-500 dark:text-zinc-600", children: label }),
|
|
3967
3852
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium", children })
|
|
3968
3853
|
] });
|
|
3969
3854
|
|
|
@@ -4025,7 +3910,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
|
|
|
4025
3910
|
{
|
|
4026
3911
|
ref,
|
|
4027
3912
|
className: cn(
|
|
4028
|
-
"relative flex h-8 w-full items-center justify-between rounded-
|
|
3913
|
+
"relative flex h-8 w-full items-center justify-between rounded-md border border-zinc-200 bg-white px-3 py-2 text-sm ring-offset-white placeholder:text-zinc-500 focus:ring-zinc-950 disabled:cursor-not-allowed disabled:opacity-50",
|
|
4029
3914
|
className
|
|
4030
3915
|
),
|
|
4031
3916
|
...props,
|
|
@@ -4099,7 +3984,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
4099
3984
|
),
|
|
4100
3985
|
...props,
|
|
4101
3986
|
children: [
|
|
4102
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3987
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4103
3988
|
"svg",
|
|
4104
3989
|
{
|
|
4105
3990
|
width: "15",
|
|
@@ -4118,7 +4003,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
4118
4003
|
}
|
|
4119
4004
|
)
|
|
4120
4005
|
}
|
|
4121
|
-
) }) }),
|
|
4006
|
+
) }) }) }),
|
|
4122
4007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectPrimitive.ItemText, { children })
|
|
4123
4008
|
]
|
|
4124
4009
|
}
|
|
@@ -4293,9 +4178,9 @@ var TTLBadge = ({
|
|
|
4293
4178
|
}, 1e3);
|
|
4294
4179
|
return () => clearInterval(interval);
|
|
4295
4180
|
}, [expireAt]);
|
|
4296
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Badge, { label, children: ttl === void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TTLPopover, { ttl, setTTL, isPending, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex
|
|
4297
|
-
ttl === TTL_INFINITE ? "
|
|
4298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconChevronDown, { className: "
|
|
4181
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Badge, { label, children: ttl === void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TTLPopover, { ttl, setTTL, isPending, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-[2px]", children: [
|
|
4182
|
+
ttl === TTL_INFINITE ? "Forever" : formatTime(ttl),
|
|
4183
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconChevronDown, { className: "mt-[1px] text-zinc-400", size: 12 })
|
|
4299
4184
|
] }) }) });
|
|
4300
4185
|
};
|
|
4301
4186
|
|
|
@@ -4365,8 +4250,8 @@ var useSetTTL = () => {
|
|
|
4365
4250
|
|
|
4366
4251
|
// src/components/databrowser/components/item-context-menu.tsx
|
|
4367
4252
|
|
|
4368
|
-
var _reactcontextmenu = require('@radix-ui/react-context-menu'); var ContextMenuPrimitive = _interopRequireWildcard(_reactcontextmenu);
|
|
4369
4253
|
|
|
4254
|
+
var _reactcontextmenu = require('@radix-ui/react-context-menu'); var ContextMenuPrimitive = _interopRequireWildcard(_reactcontextmenu);
|
|
4370
4255
|
|
|
4371
4256
|
// src/components/ui/context-menu.tsx
|
|
4372
4257
|
|
|
@@ -4579,8 +4464,7 @@ function DeleteAlertDialog({
|
|
|
4579
4464
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AlertDialogHeader, { children: [
|
|
4580
4465
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDialogTitle, { children: isPlural ? `Delete ${count2} ${itemsLabel}` : `Delete ${itemLabel}` }),
|
|
4581
4466
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AlertDialogDescription, { className: "mt-5", children: [
|
|
4582
|
-
"Are you sure you want to delete",
|
|
4583
|
-
" ",
|
|
4467
|
+
"Are you sure you want to delete ",
|
|
4584
4468
|
isPlural ? `these ${count2} ${deletionType}s` : `this ${deletionType}`,
|
|
4585
4469
|
"?",
|
|
4586
4470
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
|
|
@@ -4626,7 +4510,7 @@ var ItemContextMenu = ({
|
|
|
4626
4510
|
editItem({
|
|
4627
4511
|
type,
|
|
4628
4512
|
dataKey,
|
|
4629
|
-
itemKey: _optionalChain([data, 'optionalAccess',
|
|
4513
|
+
itemKey: _optionalChain([data, 'optionalAccess', _32 => _32.key]),
|
|
4630
4514
|
// For deletion
|
|
4631
4515
|
newKey: void 0
|
|
4632
4516
|
});
|
|
@@ -4661,7 +4545,7 @@ var ItemContextMenu = ({
|
|
|
4661
4545
|
{
|
|
4662
4546
|
onClick: () => {
|
|
4663
4547
|
if (!data) return;
|
|
4664
|
-
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess',
|
|
4548
|
+
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _33 => _33.key]));
|
|
4665
4549
|
toast({
|
|
4666
4550
|
description: "Key copied to clipboard"
|
|
4667
4551
|
});
|
|
@@ -4673,11 +4557,11 @@ var ItemContextMenu = ({
|
|
|
4673
4557
|
]
|
|
4674
4558
|
}
|
|
4675
4559
|
),
|
|
4676
|
-
_optionalChain([data, 'optionalAccess',
|
|
4560
|
+
_optionalChain([data, 'optionalAccess', _34 => _34.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4677
4561
|
ContextMenuItem,
|
|
4678
4562
|
{
|
|
4679
4563
|
onClick: () => {
|
|
4680
|
-
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
4564
|
+
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _35 => _35.value]), () => ( "")));
|
|
4681
4565
|
toast({
|
|
4682
4566
|
description: "Value copied to clipboard"
|
|
4683
4567
|
});
|
|
@@ -4734,38 +4618,33 @@ var ItemContextMenu = ({
|
|
|
4734
4618
|
|
|
4735
4619
|
var _reactscrollarea = require('@radix-ui/react-scroll-area'); var ScrollAreaPrimitive = _interopRequireWildcard(_reactscrollarea);
|
|
4736
4620
|
|
|
4737
|
-
var ScrollArea = React9.forwardRef(
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollAreaPrimitive.Corner, {})
|
|
4758
|
-
]
|
|
4759
|
-
}
|
|
4760
|
-
)
|
|
4761
|
-
);
|
|
4621
|
+
var ScrollArea = React9.forwardRef(({ className, children, onScroll, disableRoundedInherit = false, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4622
|
+
ScrollAreaPrimitive.Root,
|
|
4623
|
+
{
|
|
4624
|
+
ref,
|
|
4625
|
+
className: cn("relative overflow-hidden", className),
|
|
4626
|
+
...props,
|
|
4627
|
+
children: [
|
|
4628
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4629
|
+
ScrollAreaPrimitive.Viewport,
|
|
4630
|
+
{
|
|
4631
|
+
onScroll,
|
|
4632
|
+
className: cn("h-full w-full [&>div]:!block", !disableRoundedInherit && "rounded-[inherit]"),
|
|
4633
|
+
children
|
|
4634
|
+
}
|
|
4635
|
+
),
|
|
4636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollBar, {}),
|
|
4637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ScrollAreaPrimitive.Corner, {})
|
|
4638
|
+
]
|
|
4639
|
+
}
|
|
4640
|
+
));
|
|
4762
4641
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
4763
4642
|
var ScrollBar = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4764
4643
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4765
4644
|
{
|
|
4766
4645
|
ref,
|
|
4767
4646
|
orientation: "vertical",
|
|
4768
|
-
className: cn("
|
|
4647
|
+
className: cn("flex h-full w-2 touch-none select-none transition-colors", className),
|
|
4769
4648
|
...props,
|
|
4770
4649
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4771
4650
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
@@ -4816,7 +4695,10 @@ var InfiniteScroll = ({
|
|
|
4816
4695
|
type: "always",
|
|
4817
4696
|
onScroll: handleScroll,
|
|
4818
4697
|
...props,
|
|
4819
|
-
className: cn(
|
|
4698
|
+
className: cn(
|
|
4699
|
+
"block h-full w-full overflow-visible rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all",
|
|
4700
|
+
props.className
|
|
4701
|
+
),
|
|
4820
4702
|
ref: scrollRef,
|
|
4821
4703
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: contentRef, children: [
|
|
4822
4704
|
children,
|
|
@@ -4859,28 +4741,6 @@ var SimpleTooltip = ({
|
|
|
4859
4741
|
] });
|
|
4860
4742
|
};
|
|
4861
4743
|
|
|
4862
|
-
// src/types/index.ts
|
|
4863
|
-
var DATA_TYPES = [
|
|
4864
|
-
"string",
|
|
4865
|
-
"list",
|
|
4866
|
-
"hash",
|
|
4867
|
-
"set",
|
|
4868
|
-
"zset",
|
|
4869
|
-
"json",
|
|
4870
|
-
"stream",
|
|
4871
|
-
"search"
|
|
4872
|
-
];
|
|
4873
|
-
var DATA_TYPE_NAMES = {
|
|
4874
|
-
string: "String",
|
|
4875
|
-
list: "List",
|
|
4876
|
-
hash: "Hash",
|
|
4877
|
-
set: "Set",
|
|
4878
|
-
zset: "Sorted Set",
|
|
4879
|
-
json: "JSON",
|
|
4880
|
-
stream: "Stream",
|
|
4881
|
-
search: "Search Index"
|
|
4882
|
-
};
|
|
4883
|
-
|
|
4884
4744
|
// src/components/databrowser/components/type-tag.tsx
|
|
4885
4745
|
|
|
4886
4746
|
|
|
@@ -4899,8 +4759,7 @@ var iconsMap = {
|
|
|
4899
4759
|
json: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconCodeDots, { size: 15, stroke: 1.2 }),
|
|
4900
4760
|
zset: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconArrowsSort, { size: 15, stroke: 1.2 }),
|
|
4901
4761
|
list: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconList, { size: 15, stroke: 1.2 }),
|
|
4902
|
-
stream: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconList, { size: 15, stroke: 1.2 })
|
|
4903
|
-
search: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconSearch, { size: 15, stroke: 1.2 })
|
|
4762
|
+
stream: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconList, { size: 15, stroke: 1.2 })
|
|
4904
4763
|
};
|
|
4905
4764
|
var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-center", {
|
|
4906
4765
|
variants: {
|
|
@@ -4912,20 +4771,22 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4912
4771
|
json: "bg-purple-200 text-purple-800",
|
|
4913
4772
|
list: "bg-orange-200 text-orange-800",
|
|
4914
4773
|
stream: "bg-green-200 text-green-800",
|
|
4915
|
-
|
|
4774
|
+
default: "bg-gray-200 text-gray-800"
|
|
4916
4775
|
},
|
|
4917
4776
|
type: {
|
|
4918
4777
|
icon: "size-5",
|
|
4919
|
-
badge: "h-
|
|
4778
|
+
badge: "h-6 px-2 uppercase whitespace-nowrap text-xs font-medium leading-none tracking-wide"
|
|
4920
4779
|
}
|
|
4921
4780
|
},
|
|
4922
4781
|
defaultVariants: {
|
|
4923
|
-
variant: "
|
|
4782
|
+
variant: "default",
|
|
4924
4783
|
type: "icon"
|
|
4925
4784
|
}
|
|
4926
4785
|
});
|
|
4927
4786
|
function TypeTag({ className, variant, type }) {
|
|
4928
|
-
|
|
4787
|
+
const defaultIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconQuestionMark, { size: 15, stroke: 1.2 });
|
|
4788
|
+
const variantKey = variant && variant in iconsMap ? variant : "default";
|
|
4789
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: cn(tagVariants({ variant: variantKey, type, className })), children: type === "icon" ? _nullishCoalesce(iconsMap[variant], () => ( defaultIcon)) : _nullishCoalesce(_nullishCoalesce(DATA_TYPE_NAMES[variant], () => ( variant)), () => ( "Unknown")) });
|
|
4929
4790
|
}
|
|
4930
4791
|
|
|
4931
4792
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
@@ -5055,13 +4916,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
5055
4916
|
function KeyActions({ dataKey, content }) {
|
|
5056
4917
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
5057
4918
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DropdownMenu, { modal: false, children: [
|
|
5058
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5059
|
-
_iconsreact.IconDotsVertical,
|
|
5060
|
-
{
|
|
5061
|
-
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5062
|
-
fill: "rgb(var(--color-zinc-500))"
|
|
5063
|
-
}
|
|
5064
|
-
) }) }),
|
|
4919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconDotsVertical, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
5065
4920
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DropdownMenuContent, { className: "", align: "end", children: [
|
|
5066
4921
|
content && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5067
4922
|
DropdownMenuItem,
|
|
@@ -5114,15 +4969,15 @@ var DisplayHeader = ({
|
|
|
5114
4969
|
const handleAddItem = () => {
|
|
5115
4970
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
5116
4971
|
};
|
|
5117
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg", children: [
|
|
5118
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-
|
|
5119
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "grow truncate text-
|
|
4972
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100", children: [
|
|
4973
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-h-10 items-center justify-between gap-4", children: [
|
|
4974
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "grow truncate text-base", 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-semibold", children: dataKey }) }),
|
|
5120
4975
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1", children: [
|
|
5121
|
-
type !== "string" && type !== "json" &&
|
|
4976
|
+
type !== "string" && type !== "json" && /* @__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" }) }) }),
|
|
5122
4977
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyActions, { dataKey, content })
|
|
5123
4978
|
] })
|
|
5124
4979
|
] }),
|
|
5125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center gap-1.5
|
|
4980
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 flex-wrap items-center gap-1.5", children: [
|
|
5126
4981
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: type, type: "badge" }),
|
|
5127
4982
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SizeBadge, { dataKey }),
|
|
5128
4983
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LengthBadge, { dataKey, type, content }),
|
|
@@ -5194,7 +5049,7 @@ var useSetHashTTL = () => {
|
|
|
5194
5049
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
5195
5050
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
5196
5051
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
5197
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
5052
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _36 => _36[field]]);
|
|
5198
5053
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5199
5054
|
TTLBadge,
|
|
5200
5055
|
{
|
|
@@ -5291,7 +5146,7 @@ var MonacoEditor = ({
|
|
|
5291
5146
|
if (!active || !monaco || !editorRef.current) {
|
|
5292
5147
|
return;
|
|
5293
5148
|
}
|
|
5294
|
-
_optionalChain([monaco, 'optionalAccess',
|
|
5149
|
+
_optionalChain([monaco, 'optionalAccess', _37 => _37.editor, 'access', _38 => _38.setModelLanguage, 'call', _39 => _39(editorRef.current.getModel(), language)]);
|
|
5295
5150
|
}, [monaco, language, active]);
|
|
5296
5151
|
const editor = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5297
5152
|
_react2.Editor,
|
|
@@ -5432,7 +5287,7 @@ var checkIsValidJSON = (value) => {
|
|
|
5432
5287
|
try {
|
|
5433
5288
|
JSON.parse(value);
|
|
5434
5289
|
return true;
|
|
5435
|
-
} catch (
|
|
5290
|
+
} catch (e3) {
|
|
5436
5291
|
return false;
|
|
5437
5292
|
}
|
|
5438
5293
|
};
|
|
@@ -5456,7 +5311,7 @@ var ListEditForm = ({
|
|
|
5456
5311
|
dataKey
|
|
5457
5312
|
});
|
|
5458
5313
|
const findValue = () => {
|
|
5459
|
-
for (const page of _nullishCoalesce(_optionalChain([query, 'access',
|
|
5314
|
+
for (const page of _nullishCoalesce(_optionalChain([query, 'access', _40 => _40.data, 'optionalAccess', _41 => _41.pages]), () => ( []))) {
|
|
5460
5315
|
const item = page.keys.find((item2) => item2.key === itemKey);
|
|
5461
5316
|
if (item && "value" in item) return item.value;
|
|
5462
5317
|
}
|
|
@@ -5602,7 +5457,7 @@ var HashFieldTTLInfo = ({
|
|
|
5602
5457
|
fields
|
|
5603
5458
|
}) => {
|
|
5604
5459
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
5605
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
5460
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _42 => _42[field]]);
|
|
5606
5461
|
const [ttl, setTTL] = _react.useState.call(void 0, () => calculateTTL(expireAt));
|
|
5607
5462
|
_react.useEffect.call(void 0, () => {
|
|
5608
5463
|
setTTL(calculateTTL(expireAt));
|
|
@@ -5630,7 +5485,7 @@ var ListDisplay = ({ dataKey, type }) => {
|
|
|
5630
5485
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2", children: [
|
|
5631
5486
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayHeader, { dataKey, type }),
|
|
5632
5487
|
selectedListItem && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
5633
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfiniteScroll, { query,
|
|
5488
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfiniteScroll, { query, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "table", { className: "w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ItemContextMenu, { dataKey, type, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListItems, { dataKey, type, query }) }) }) }) }) })
|
|
5634
5489
|
] });
|
|
5635
5490
|
};
|
|
5636
5491
|
var ListItems = ({
|
|
@@ -5639,7 +5494,7 @@ var ListItems = ({
|
|
|
5639
5494
|
dataKey
|
|
5640
5495
|
}) => {
|
|
5641
5496
|
const { setSelectedListItem } = useTab();
|
|
5642
|
-
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access',
|
|
5497
|
+
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _43 => _43.data, 'optionalAccess', _44 => _44.pages, 'access', _45 => _45.flatMap, 'call', _46 => _46((page) => page.keys)]), () => ( [])), [query.data]);
|
|
5643
5498
|
const fields = _react.useMemo.call(void 0, () => keys.map((key) => key.key), [keys]);
|
|
5644
5499
|
const { mutate: editItem } = useEditListItem();
|
|
5645
5500
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -5651,7 +5506,7 @@ var ListItems = ({
|
|
|
5651
5506
|
setSelectedListItem({ key });
|
|
5652
5507
|
},
|
|
5653
5508
|
className: cn(
|
|
5654
|
-
"h-
|
|
5509
|
+
"h-10 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100 dark:border-b-zinc-200 dark:hover:bg-zinc-200"
|
|
5655
5510
|
),
|
|
5656
5511
|
children: [
|
|
5657
5512
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5715,17 +5570,6 @@ var ListItems = ({
|
|
|
5715
5570
|
)) });
|
|
5716
5571
|
};
|
|
5717
5572
|
|
|
5718
|
-
// src/components/databrowser/components/display/display-search.tsx
|
|
5719
|
-
|
|
5720
|
-
var SearchDisplay = ({ dataKey, type }) => {
|
|
5721
|
-
const { data, isLoading } = useFetchSearchIndex(dataKey);
|
|
5722
|
-
const content = data ? JSON.stringify(data, null, 2) : void 0;
|
|
5723
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full w-full flex-col gap-2", children: [
|
|
5724
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayHeader, { dataKey, type, content }),
|
|
5725
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full grow flex-col gap-2 rounded-md bg-zinc-100", children: isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoadingText: "", isLoading: true }) : data === null || data === void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-zinc-500", children: "No data found" }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grow overflow-auto rounded-md border border-zinc-300 bg-white p-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { className: "whitespace-pre-wrap break-words font-mono text-sm", children: JSON.stringify(data, null, 2) }) }) })
|
|
5726
|
-
] });
|
|
5727
|
-
};
|
|
5728
|
-
|
|
5729
5573
|
// src/components/databrowser/components/display/display-simple.tsx
|
|
5730
5574
|
|
|
5731
5575
|
|
|
@@ -5781,55 +5625,10 @@ var DataDisplay = () => {
|
|
|
5781
5625
|
const { selectedKey } = useTab();
|
|
5782
5626
|
const { query } = useKeys();
|
|
5783
5627
|
const type = useKeyType(selectedKey);
|
|
5784
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
var Segmented = ({
|
|
5790
|
-
options,
|
|
5791
|
-
value,
|
|
5792
|
-
onChange
|
|
5793
|
-
}) => {
|
|
5794
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-fit gap-[2px] rounded-lg bg-zinc-200 p-[2px] text-sm", children: options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5795
|
-
"button",
|
|
5796
|
-
{
|
|
5797
|
-
className: cn(
|
|
5798
|
-
"h-7 rounded-md px-3 transition-all",
|
|
5799
|
-
value === option.key ? "bg-white text-zinc-950" : "text-zinc-700"
|
|
5800
|
-
),
|
|
5801
|
-
onClick: () => {
|
|
5802
|
-
_optionalChain([onChange, 'optionalCall', _49 => _49(option.key)]);
|
|
5803
|
-
},
|
|
5804
|
-
children: option.label
|
|
5805
|
-
},
|
|
5806
|
-
option.key
|
|
5807
|
-
)) });
|
|
5808
|
-
};
|
|
5809
|
-
|
|
5810
|
-
// src/components/databrowser/hooks/use-fetch-search-indexes.tsx
|
|
5811
|
-
|
|
5812
|
-
var FETCH_SEARCH_INDEXES_QUERY_KEY = "fetch-search-indexes";
|
|
5813
|
-
var useFetchSearchIndexes = (match) => {
|
|
5814
|
-
const { redisNoPipeline: redis } = useRedis();
|
|
5815
|
-
return _reactquery.useQuery.call(void 0, {
|
|
5816
|
-
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY],
|
|
5817
|
-
queryFn: async () => {
|
|
5818
|
-
let cursor = "0";
|
|
5819
|
-
const finalResult = [];
|
|
5820
|
-
while (true) {
|
|
5821
|
-
const [newCursor, results] = await redis.scan(cursor, {
|
|
5822
|
-
count: 100,
|
|
5823
|
-
type: "search",
|
|
5824
|
-
match
|
|
5825
|
-
});
|
|
5826
|
-
finalResult.push(...results);
|
|
5827
|
-
if (newCursor === "0") break;
|
|
5828
|
-
cursor = newCursor;
|
|
5829
|
-
}
|
|
5830
|
-
return finalResult;
|
|
5831
|
-
}
|
|
5832
|
-
});
|
|
5628
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full p-4", children: !selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !type ? query.isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-zinc-500", children: "Loading..." }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !DATA_TYPES.includes(type) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-zinc-500", children: [
|
|
5629
|
+
"Unrecognized key type: ",
|
|
5630
|
+
type
|
|
5631
|
+
] }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: SIMPLE_DATA_TYPES.includes(type) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5833
5632
|
};
|
|
5834
5633
|
|
|
5835
5634
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
@@ -5837,7 +5636,6 @@ var useFetchSearchIndexes = (match) => {
|
|
|
5837
5636
|
var _reactdialog = require('@radix-ui/react-dialog'); var DialogPrimitive = _interopRequireWildcard(_reactdialog);
|
|
5838
5637
|
|
|
5839
5638
|
|
|
5840
|
-
|
|
5841
5639
|
// src/components/ui/dialog.tsx
|
|
5842
5640
|
|
|
5843
5641
|
|
|
@@ -5941,6 +5739,7 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
5941
5739
|
|
|
5942
5740
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5943
5741
|
|
|
5742
|
+
|
|
5944
5743
|
function AddKeyModal() {
|
|
5945
5744
|
const { setSelectedKey } = useTab();
|
|
5946
5745
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
@@ -5956,7 +5755,7 @@ function AddKeyModal() {
|
|
|
5956
5755
|
setSelectedKey(key);
|
|
5957
5756
|
setOpen(false);
|
|
5958
5757
|
setTimeout(() => {
|
|
5959
|
-
_optionalChain([window, 'access',
|
|
5758
|
+
_optionalChain([window, 'access', _47 => _47.document, 'access', _48 => _48.querySelector, 'call', _49 => _49(`[data-key="${key}"]`), 'optionalAccess', _50 => _50.scrollIntoView, 'call', _51 => _51({
|
|
5960
5759
|
behavior: "smooth",
|
|
5961
5760
|
block: "start",
|
|
5962
5761
|
inline: "nearest"
|
|
@@ -5972,18 +5771,7 @@ function AddKeyModal() {
|
|
|
5972
5771
|
setOpen(open2);
|
|
5973
5772
|
},
|
|
5974
5773
|
children: [
|
|
5975
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SimpleTooltip, { content: "Add key", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.
|
|
5976
|
-
Button,
|
|
5977
|
-
{
|
|
5978
|
-
variant: "primary",
|
|
5979
|
-
"data-testid": "add-key-button",
|
|
5980
|
-
className: "flex h-8 items-center gap-1 rounded-lg pl-2 pr-3 text-sm font-medium",
|
|
5981
|
-
children: [
|
|
5982
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "size-5" }),
|
|
5983
|
-
"Key"
|
|
5984
|
-
]
|
|
5985
|
-
}
|
|
5986
|
-
) }) }),
|
|
5774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SimpleTooltip, { content: "Add key", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "primary", size: "icon-sm", "data-testid": "add-key-button", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "size-4" }) }) }) }),
|
|
5987
5775
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogContent, { className: "max-w-[400px]", children: [
|
|
5988
5776
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogTitle, { children: "Create new key" }) }),
|
|
5989
5777
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "sr-only", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactdialog.DialogDescription, { children: "Create new key" }) }),
|
|
@@ -5996,7 +5784,7 @@ function AddKeyModal() {
|
|
|
5996
5784
|
name: "type",
|
|
5997
5785
|
render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
5998
5786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectValue, {}) }),
|
|
5999
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectGroup, { children: DATA_TYPES.
|
|
5787
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectGroup, { children: DATA_TYPES.map((type) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItem, { value: type, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: type, type: "badge" }) }, type)) }) })
|
|
6000
5788
|
] })
|
|
6001
5789
|
}
|
|
6002
5790
|
),
|
|
@@ -6012,7 +5800,7 @@ function AddKeyModal() {
|
|
|
6012
5800
|
}
|
|
6013
5801
|
)
|
|
6014
5802
|
] }),
|
|
6015
|
-
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access',
|
|
5803
|
+
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _52 => _52.errors, 'access', _53 => _53.key, 'optionalAccess', _54 => _54.message]) }),
|
|
6016
5804
|
/* @__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" }),
|
|
6017
5805
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
6018
5806
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6035,792 +5823,19 @@ function AddKeyModal() {
|
|
|
6035
5823
|
);
|
|
6036
5824
|
}
|
|
6037
5825
|
|
|
6038
|
-
// src/components/databrowser/components/sidebar/
|
|
5826
|
+
// src/components/databrowser/components/sidebar/empty.tsx
|
|
6039
5827
|
|
|
5828
|
+
var Empty = () => {
|
|
5829
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full w-full items-center justify-center rounded-md border bg-white px-4 py-6 text-center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-5", children: [
|
|
5830
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
5831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
5832
|
+
] }) });
|
|
5833
|
+
};
|
|
6040
5834
|
|
|
5835
|
+
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
6041
5836
|
|
|
6042
|
-
var ReloadButton = ({
|
|
6043
|
-
onClick,
|
|
6044
|
-
isLoading: isLoadingProp
|
|
6045
|
-
}) => {
|
|
6046
|
-
const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
|
|
6047
|
-
const handleClick = () => {
|
|
6048
|
-
setIsLoading(true);
|
|
6049
|
-
onClick();
|
|
6050
|
-
setTimeout(() => {
|
|
6051
|
-
setIsLoading(false);
|
|
6052
|
-
}, 350);
|
|
6053
|
-
};
|
|
6054
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SimpleTooltip, { content: "Refresh", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6055
|
-
Button,
|
|
6056
|
-
{
|
|
6057
|
-
variant: "outline",
|
|
6058
|
-
size: "icon",
|
|
6059
|
-
onClick: handleClick,
|
|
6060
|
-
disabled: isLoading || isLoadingProp,
|
|
6061
|
-
children: isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconLoader2, { className: "size-5 animate-spin text-zinc-500" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconRefresh, { className: "size-5 text-zinc-500 dark:text-zinc-600" })
|
|
6062
|
-
}
|
|
6063
|
-
) }) });
|
|
6064
|
-
};
|
|
6065
5837
|
|
|
6066
|
-
// src/components/databrowser/components/sidebar
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
var dedupeSearchHistory = (history) => {
|
|
6071
|
-
const seen = /* @__PURE__ */ new Set();
|
|
6072
|
-
return history.filter((item) => {
|
|
6073
|
-
if (!item || seen.has(item)) return false;
|
|
6074
|
-
seen.add(item);
|
|
6075
|
-
return true;
|
|
6076
|
-
});
|
|
6077
|
-
};
|
|
6078
|
-
var SearchInput = () => {
|
|
6079
|
-
const { setSearchKey, search } = useTab();
|
|
6080
|
-
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
6081
|
-
const [state, setState] = _react.useState.call(void 0, search.key);
|
|
6082
|
-
const [isFocus, setIsFocus] = _react.useState.call(void 0, false);
|
|
6083
|
-
const [focusedIndex, setFocusedIndex] = _react.useState.call(void 0, -1);
|
|
6084
|
-
const inputRef = _react.useRef.call(void 0, null);
|
|
6085
|
-
const historyItemRefs = _react.useRef.call(void 0, []);
|
|
6086
|
-
const handleSubmit = (value) => {
|
|
6087
|
-
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
6088
|
-
addSearchHistory(value);
|
|
6089
|
-
setSearchKey(value);
|
|
6090
|
-
setState(value);
|
|
6091
|
-
};
|
|
6092
|
-
const filteredHistory = dedupeSearchHistory(
|
|
6093
|
-
searchHistory.filter((item) => item.trim() !== "" && item.trim() !== "*").filter((item) => item.includes(state) && item !== state)
|
|
6094
|
-
).slice(0, 5).map((item) => item.endsWith("*") ? item.slice(0, -1) : item);
|
|
6095
|
-
_react.useEffect.call(void 0, () => {
|
|
6096
|
-
setFocusedIndex(-1);
|
|
6097
|
-
}, [filteredHistory.length]);
|
|
6098
|
-
const handleKeyDown = (e) => {
|
|
6099
|
-
if (e.key === "Enter") {
|
|
6100
|
-
const text = focusedIndex >= 0 && focusedIndex < filteredHistory.length ? filteredHistory[focusedIndex] : e.currentTarget.value;
|
|
6101
|
-
handleSubmit(text);
|
|
6102
|
-
} else if (e.key === "Escape") {
|
|
6103
|
-
setState("");
|
|
6104
|
-
setFocusedIndex(-1);
|
|
6105
|
-
_optionalChain([inputRef, 'access', _58 => _58.current, 'optionalAccess', _59 => _59.blur, 'call', _60 => _60()]);
|
|
6106
|
-
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
6107
|
-
e.preventDefault();
|
|
6108
|
-
if (focusedIndex < filteredHistory.length - 1) {
|
|
6109
|
-
setFocusedIndex(focusedIndex + 1);
|
|
6110
|
-
} else if (filteredHistory.length > 0) {
|
|
6111
|
-
setFocusedIndex(0);
|
|
6112
|
-
}
|
|
6113
|
-
} else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
|
|
6114
|
-
e.preventDefault();
|
|
6115
|
-
if (focusedIndex > 0) {
|
|
6116
|
-
setFocusedIndex(focusedIndex - 1);
|
|
6117
|
-
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
6118
|
-
setFocusedIndex(-1);
|
|
6119
|
-
_optionalChain([inputRef, 'access', _61 => _61.current, 'optionalAccess', _62 => _62.focus, 'call', _63 => _63()]);
|
|
6120
|
-
} else if (filteredHistory.length > 0) {
|
|
6121
|
-
setFocusedIndex(filteredHistory.length - 1);
|
|
6122
|
-
}
|
|
6123
|
-
}
|
|
6124
|
-
};
|
|
6125
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative grow", children: [
|
|
6126
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
6127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-8 rounded-md border border-zinc-300 font-normal", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6128
|
-
Input,
|
|
6129
|
-
{
|
|
6130
|
-
ref: inputRef,
|
|
6131
|
-
placeholder: "Search",
|
|
6132
|
-
className: "h-full border-none pr-6",
|
|
6133
|
-
onKeyDown: handleKeyDown,
|
|
6134
|
-
onChange: (e) => {
|
|
6135
|
-
setState(e.currentTarget.value);
|
|
6136
|
-
if (e.currentTarget.value.trim() === "") handleSubmit("");
|
|
6137
|
-
},
|
|
6138
|
-
value: state,
|
|
6139
|
-
onFocus: () => {
|
|
6140
|
-
setIsFocus(true);
|
|
6141
|
-
setFocusedIndex(-1);
|
|
6142
|
-
},
|
|
6143
|
-
onBlur: () => setIsFocus(false)
|
|
6144
|
-
}
|
|
6145
|
-
) }) }),
|
|
6146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6147
|
-
PopoverContent,
|
|
6148
|
-
{
|
|
6149
|
-
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
6150
|
-
autoFocus: false,
|
|
6151
|
-
onOpenAutoFocus: (e) => {
|
|
6152
|
-
e.preventDefault();
|
|
6153
|
-
e.stopPropagation();
|
|
6154
|
-
},
|
|
6155
|
-
children: filteredHistory.map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full py-[3px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6156
|
-
"button",
|
|
6157
|
-
{
|
|
6158
|
-
ref: (el) => {
|
|
6159
|
-
historyItemRefs.current[index] = el;
|
|
6160
|
-
},
|
|
6161
|
-
onClick: () => handleSubmit(item),
|
|
6162
|
-
onMouseEnter: () => setFocusedIndex(index),
|
|
6163
|
-
className: `block w-full truncate rounded-sm p-1 text-left transition-colors ${focusedIndex === index ? "bg-zinc-100" : "hover:bg-zinc-100"}`,
|
|
6164
|
-
children: item
|
|
6165
|
-
}
|
|
6166
|
-
) }, item))
|
|
6167
|
-
}
|
|
6168
|
-
)
|
|
6169
|
-
] }),
|
|
6170
|
-
state && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6171
|
-
Button,
|
|
6172
|
-
{
|
|
6173
|
-
type: "button",
|
|
6174
|
-
variant: "link",
|
|
6175
|
-
size: "icon",
|
|
6176
|
-
className: "absolute right-1 top-1/2 h-5 w-5 -translate-y-1/2 text-zinc-500 hover:text-zinc-900",
|
|
6177
|
-
onClick: () => {
|
|
6178
|
-
setSearchKey("");
|
|
6179
|
-
setState("");
|
|
6180
|
-
},
|
|
6181
|
-
children: [
|
|
6182
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconX, { size: 16 }),
|
|
6183
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: "Clear" })
|
|
6184
|
-
]
|
|
6185
|
-
}
|
|
6186
|
-
),
|
|
6187
|
-
" "
|
|
6188
|
-
] });
|
|
6189
|
-
};
|
|
6190
|
-
|
|
6191
|
-
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
6192
|
-
|
|
6193
|
-
var ALL_TYPES_KEY = "all";
|
|
6194
|
-
function DataTypeSelector() {
|
|
6195
|
-
const { search, setSearchType } = useTab();
|
|
6196
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6197
|
-
Select,
|
|
6198
|
-
{
|
|
6199
|
-
onValueChange: (type) => {
|
|
6200
|
-
if (type === ALL_TYPES_KEY) {
|
|
6201
|
-
setSearchType(void 0);
|
|
6202
|
-
} else {
|
|
6203
|
-
setSearchType(type);
|
|
6204
|
-
}
|
|
6205
|
-
},
|
|
6206
|
-
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
6207
|
-
children: [
|
|
6208
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectTrigger, { className: "!w-auto select-none whitespace-nowrap border-zinc-300 pr-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectValue, {}) }),
|
|
6209
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
6210
|
-
([key, value]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItem, { value: key, children: value }, key)
|
|
6211
|
-
) }) })
|
|
6212
|
-
]
|
|
6213
|
-
}
|
|
6214
|
-
);
|
|
6215
|
-
}
|
|
6216
|
-
|
|
6217
|
-
// src/components/databrowser/components/header/index.tsx
|
|
6218
|
-
|
|
6219
|
-
var Header = () => {
|
|
6220
|
-
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
6221
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1.5", children: [
|
|
6222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6223
|
-
Segmented,
|
|
6224
|
-
{
|
|
6225
|
-
options: [
|
|
6226
|
-
{
|
|
6227
|
-
key: "keys",
|
|
6228
|
-
label: "Keys"
|
|
6229
|
-
},
|
|
6230
|
-
{
|
|
6231
|
-
key: "values",
|
|
6232
|
-
label: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1", children: [
|
|
6233
|
-
"Values",
|
|
6234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-[18px] items-center rounded-md bg-emerald-100 px-[5px] text-[11px] text-emerald-700", children: "NEW" })
|
|
6235
|
-
] })
|
|
6236
|
-
}
|
|
6237
|
-
],
|
|
6238
|
-
value: isValuesSearchSelected ? "values" : "keys",
|
|
6239
|
-
onChange: (value) => {
|
|
6240
|
-
setIsValuesSearchSelected(value === "values");
|
|
6241
|
-
}
|
|
6242
|
-
}
|
|
6243
|
-
),
|
|
6244
|
-
isValuesSearchSelected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, IndexSelector, {}) }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
6245
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTypeSelector, {}),
|
|
6246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SearchInput, {})
|
|
6247
|
-
] }),
|
|
6248
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, RefreshButton, {}),
|
|
6249
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AddKeyModal, {})
|
|
6250
|
-
] });
|
|
6251
|
-
};
|
|
6252
|
-
var IndexSelector = () => {
|
|
6253
|
-
const {
|
|
6254
|
-
valuesSearch: { index },
|
|
6255
|
-
setValuesSearchIndex
|
|
6256
|
-
} = useTab();
|
|
6257
|
-
const { data } = useFetchSearchIndexes();
|
|
6258
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6259
|
-
Select,
|
|
6260
|
-
{
|
|
6261
|
-
value: index,
|
|
6262
|
-
onValueChange: (value) => {
|
|
6263
|
-
setValuesSearchIndex(value);
|
|
6264
|
-
},
|
|
6265
|
-
children: [
|
|
6266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectTrigger, { className: "select-none whitespace-nowrap border-zinc-300", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectValue, { placeholder: "Select an index" }) }),
|
|
6267
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectGroup, { children: _optionalChain([data, 'optionalAccess', _64 => _64.map, 'call', _65 => _65((index2) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItem, { value: index2, children: index2 }, index2))]) }) })
|
|
6268
|
-
]
|
|
6269
|
-
}
|
|
6270
|
-
);
|
|
6271
|
-
};
|
|
6272
|
-
var RefreshButton = () => {
|
|
6273
|
-
const { query } = useKeys();
|
|
6274
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6275
|
-
ReloadButton,
|
|
6276
|
-
{
|
|
6277
|
-
onClick: () => {
|
|
6278
|
-
queryClient.invalidateQueries({
|
|
6279
|
-
queryKey: [FETCH_KEYS_QUERY_KEY]
|
|
6280
|
-
});
|
|
6281
|
-
queryClient.invalidateQueries({
|
|
6282
|
-
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY]
|
|
6283
|
-
});
|
|
6284
|
-
queryClient.invalidateQueries({
|
|
6285
|
-
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY]
|
|
6286
|
-
});
|
|
6287
|
-
queryClient.invalidateQueries({
|
|
6288
|
-
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
6289
|
-
});
|
|
6290
|
-
},
|
|
6291
|
-
isLoading: query.isFetching
|
|
6292
|
-
}
|
|
6293
|
-
);
|
|
6294
|
-
};
|
|
6295
|
-
|
|
6296
|
-
// src/components/databrowser/components/header-error.tsx
|
|
6297
|
-
|
|
6298
|
-
var formatUpstashErrorMessage = (error) => {
|
|
6299
|
-
if (error.name !== "UpstashError") return error.message;
|
|
6300
|
-
const commandIndex = error.message.indexOf(", command was:");
|
|
6301
|
-
if (commandIndex !== -1) {
|
|
6302
|
-
return error.message.slice(0, commandIndex);
|
|
6303
|
-
}
|
|
6304
|
-
return error.message;
|
|
6305
|
-
};
|
|
6306
|
-
var HeaderError = () => {
|
|
6307
|
-
const { query } = useKeys();
|
|
6308
|
-
if (!query.error) return null;
|
|
6309
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-600 dark:text-red-400", children: formatUpstashErrorMessage(query.error) });
|
|
6310
|
-
};
|
|
6311
|
-
|
|
6312
|
-
// src/components/databrowser/components/query-builder.tsx
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
// src/components/databrowser/components/display/input/query-editor.tsx
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
// src/components/databrowser/components/display/input/generateTypeDefinitions.tsx
|
|
6320
|
-
var generateTypeDefinitions = (schema) => {
|
|
6321
|
-
let schemaFieldsInterface = "";
|
|
6322
|
-
if (schema && Object.keys(schema).length > 0) {
|
|
6323
|
-
const fieldLines = Object.entries(schema).map(([fieldName, fieldDef]) => {
|
|
6324
|
-
const fieldType = fieldDef.type;
|
|
6325
|
-
let operationType;
|
|
6326
|
-
switch (fieldType) {
|
|
6327
|
-
case "TEXT": {
|
|
6328
|
-
operationType = "StringOperations";
|
|
6329
|
-
break;
|
|
6330
|
-
}
|
|
6331
|
-
case "U64":
|
|
6332
|
-
case "I64":
|
|
6333
|
-
case "F64": {
|
|
6334
|
-
operationType = "NumberOperations";
|
|
6335
|
-
break;
|
|
6336
|
-
}
|
|
6337
|
-
case "BOOL": {
|
|
6338
|
-
operationType = "BooleanOperations";
|
|
6339
|
-
break;
|
|
6340
|
-
}
|
|
6341
|
-
case "DATE": {
|
|
6342
|
-
operationType = "DateOperations";
|
|
6343
|
-
break;
|
|
6344
|
-
}
|
|
6345
|
-
default: {
|
|
6346
|
-
operationType = "StringOperations";
|
|
6347
|
-
}
|
|
6348
|
-
}
|
|
6349
|
-
const escapedFieldName = fieldName.includes(".") ? `"${fieldName}"` : fieldName;
|
|
6350
|
-
return ` ${escapedFieldName}?: ${operationType};`;
|
|
6351
|
-
}).join("\n");
|
|
6352
|
-
schemaFieldsInterface = `
|
|
6353
|
-
/** Schema fields for the current index */
|
|
6354
|
-
interface SchemaFields {
|
|
6355
|
-
${fieldLines}
|
|
6356
|
-
}`;
|
|
6357
|
-
} else {
|
|
6358
|
-
schemaFieldsInterface = `
|
|
6359
|
-
/** Schema fields - no schema available, using dynamic fields */
|
|
6360
|
-
interface SchemaFields {
|
|
6361
|
-
[fieldName: string]: StringOperations | NumberOperations | BooleanOperations | DateOperations;
|
|
6362
|
-
}`;
|
|
6363
|
-
}
|
|
6364
|
-
return `
|
|
6365
|
-
// String operations for TEXT fields
|
|
6366
|
-
type StringOperationMap = {
|
|
6367
|
-
/** Exact match */
|
|
6368
|
-
$eq: string;
|
|
6369
|
-
/** Not equal */
|
|
6370
|
-
$ne: string;
|
|
6371
|
-
/** Match any value in array */
|
|
6372
|
-
$in: string[];
|
|
6373
|
-
/** Fuzzy match with optional distance */
|
|
6374
|
-
$fuzzy: string | { value: string; distance?: number; transpositionCostOne?: boolean };
|
|
6375
|
-
/** Phrase match */
|
|
6376
|
-
$phrase: string;
|
|
6377
|
-
/** Regular expression match */
|
|
6378
|
-
$regex: string;
|
|
6379
|
-
};
|
|
6380
|
-
|
|
6381
|
-
// Number operations for U64, I64, F64 fields
|
|
6382
|
-
type NumberOperationMap = {
|
|
6383
|
-
/** Exact match */
|
|
6384
|
-
$eq: number;
|
|
6385
|
-
/** Not equal */
|
|
6386
|
-
$ne: number;
|
|
6387
|
-
/** Match any value in array */
|
|
6388
|
-
$in: number[];
|
|
6389
|
-
/** Greater than */
|
|
6390
|
-
$gt: number;
|
|
6391
|
-
/** Greater than or equal */
|
|
6392
|
-
$gte: number;
|
|
6393
|
-
/** Less than */
|
|
6394
|
-
$lt: number;
|
|
6395
|
-
/** Less than or equal */
|
|
6396
|
-
$lte: number;
|
|
6397
|
-
};
|
|
6398
|
-
|
|
6399
|
-
// Boolean operations for BOOL fields
|
|
6400
|
-
type BooleanOperationMap = {
|
|
6401
|
-
/** Exact match */
|
|
6402
|
-
$eq: boolean;
|
|
6403
|
-
/** Not equal */
|
|
6404
|
-
$ne: boolean;
|
|
6405
|
-
/** Match any value in array */
|
|
6406
|
-
$in: boolean[];
|
|
6407
|
-
};
|
|
6408
|
-
|
|
6409
|
-
// Date operations for DATE fields
|
|
6410
|
-
type DateOperationMap = {
|
|
6411
|
-
/** Exact match */
|
|
6412
|
-
$eq: string | Date;
|
|
6413
|
-
/** Not equal */
|
|
6414
|
-
$ne: string | Date;
|
|
6415
|
-
/** Match any value in array */
|
|
6416
|
-
$in: (string | Date)[];
|
|
6417
|
-
};
|
|
6418
|
-
|
|
6419
|
-
// String field operations with optional boost
|
|
6420
|
-
type StringOperations =
|
|
6421
|
-
| { $eq: string; $boost?: number }
|
|
6422
|
-
| { $ne: string; $boost?: number }
|
|
6423
|
-
| { $in: string[]; $boost?: number }
|
|
6424
|
-
| { $fuzzy: string | { value: string; distance?: number; transpositionCostOne?: boolean }; $boost?: number }
|
|
6425
|
-
| { $phrase: string; $boost?: number }
|
|
6426
|
-
| { $regex: string; $boost?: number }
|
|
6427
|
-
| string;
|
|
6428
|
-
|
|
6429
|
-
// Number field operations with optional boost
|
|
6430
|
-
type NumberOperations =
|
|
6431
|
-
| { $eq: number; $boost?: number }
|
|
6432
|
-
| { $ne: number; $boost?: number }
|
|
6433
|
-
| { $in: number[]; $boost?: number }
|
|
6434
|
-
| { $gt: number; $boost?: number }
|
|
6435
|
-
| { $gte: number; $boost?: number }
|
|
6436
|
-
| { $lt: number; $boost?: number }
|
|
6437
|
-
| { $lte: number; $boost?: number }
|
|
6438
|
-
| number;
|
|
6439
|
-
|
|
6440
|
-
// Boolean field operations with optional boost
|
|
6441
|
-
type BooleanOperations =
|
|
6442
|
-
| { $eq: boolean; $boost?: number }
|
|
6443
|
-
| { $ne: boolean; $boost?: number }
|
|
6444
|
-
| { $in: boolean[]; $boost?: number }
|
|
6445
|
-
| boolean;
|
|
6446
|
-
|
|
6447
|
-
// Date field operations with optional boost
|
|
6448
|
-
type DateOperations =
|
|
6449
|
-
| { $eq: string | Date; $boost?: number }
|
|
6450
|
-
| { $ne: string | Date; $boost?: number }
|
|
6451
|
-
| { $in: (string | Date)[]; $boost?: number }
|
|
6452
|
-
| string
|
|
6453
|
-
| Date;
|
|
6454
|
-
|
|
6455
|
-
${schemaFieldsInterface}
|
|
6456
|
-
|
|
6457
|
-
// Query leaf - field conditions without logical operators
|
|
6458
|
-
type QueryLeaf = SchemaFields & {
|
|
6459
|
-
$and?: never;
|
|
6460
|
-
$or?: never;
|
|
6461
|
-
$must?: never;
|
|
6462
|
-
$should?: never;
|
|
6463
|
-
$mustNot?: never;
|
|
6464
|
-
$boost?: never;
|
|
6465
|
-
};
|
|
6466
|
-
|
|
6467
|
-
// Base type for boolean nodes - allows field conditions
|
|
6468
|
-
type BoolBase = SchemaFields;
|
|
6469
|
-
|
|
6470
|
-
// $and: all conditions must match
|
|
6471
|
-
type AndNode = BoolBase & {
|
|
6472
|
-
/** All conditions in this array must match */
|
|
6473
|
-
$and: QueryFilter[];
|
|
6474
|
-
/** Boost score for this node */
|
|
6475
|
-
$boost?: number;
|
|
6476
|
-
$or?: never;
|
|
6477
|
-
$must?: never;
|
|
6478
|
-
$should?: never;
|
|
6479
|
-
$mustNot?: never;
|
|
6480
|
-
};
|
|
6481
|
-
|
|
6482
|
-
// $or: at least one condition must match
|
|
6483
|
-
type OrNode = BoolBase & {
|
|
6484
|
-
/** At least one condition must match */
|
|
6485
|
-
$or: QueryFilter[];
|
|
6486
|
-
/** Boost score for this node */
|
|
6487
|
-
$boost?: number;
|
|
6488
|
-
$and?: never;
|
|
6489
|
-
$must?: never;
|
|
6490
|
-
$should?: never;
|
|
6491
|
-
$mustNot?: never;
|
|
6492
|
-
};
|
|
6493
|
-
|
|
6494
|
-
// $must only (Elasticsearch-style)
|
|
6495
|
-
type MustNode = BoolBase & {
|
|
6496
|
-
/** All conditions must match (similar to $and) */
|
|
6497
|
-
$must: QueryFilter[];
|
|
6498
|
-
/** Boost score for this node */
|
|
6499
|
-
$boost?: number;
|
|
6500
|
-
$and?: never;
|
|
6501
|
-
$or?: never;
|
|
6502
|
-
$should?: never;
|
|
6503
|
-
$mustNot?: never;
|
|
6504
|
-
};
|
|
6505
|
-
|
|
6506
|
-
// $should only (Elasticsearch-style)
|
|
6507
|
-
type ShouldNode = BoolBase & {
|
|
6508
|
-
/** At least one should match (affects scoring) */
|
|
6509
|
-
$should: QueryFilter[];
|
|
6510
|
-
/** Boost score for this node */
|
|
6511
|
-
$boost?: number;
|
|
6512
|
-
$and?: never;
|
|
6513
|
-
$or?: never;
|
|
6514
|
-
$must?: never;
|
|
6515
|
-
$mustNot?: never;
|
|
6516
|
-
};
|
|
6517
|
-
|
|
6518
|
-
// $must + $should combined
|
|
6519
|
-
type MustShouldNode = BoolBase & {
|
|
6520
|
-
/** All these must match */
|
|
6521
|
-
$must: QueryFilter[];
|
|
6522
|
-
/** At least one should match for higher score */
|
|
6523
|
-
$should: QueryFilter[];
|
|
6524
|
-
$and?: never;
|
|
6525
|
-
$or?: never;
|
|
6526
|
-
$mustNot?: never;
|
|
6527
|
-
};
|
|
6528
|
-
|
|
6529
|
-
// $mustNot only
|
|
6530
|
-
type NotNode = BoolBase & {
|
|
6531
|
-
/** None of these conditions should match */
|
|
6532
|
-
$mustNot: QueryFilter[];
|
|
6533
|
-
/** Boost score for this node */
|
|
6534
|
-
$boost?: number;
|
|
6535
|
-
$and?: never;
|
|
6536
|
-
$or?: never;
|
|
6537
|
-
$must?: never;
|
|
6538
|
-
$should?: never;
|
|
6539
|
-
};
|
|
6540
|
-
|
|
6541
|
-
// $and + $mustNot combined
|
|
6542
|
-
type AndNotNode = BoolBase & {
|
|
6543
|
-
$and: QueryFilter[];
|
|
6544
|
-
$mustNot: QueryFilter[];
|
|
6545
|
-
$boost?: number;
|
|
6546
|
-
$or?: never;
|
|
6547
|
-
$must?: never;
|
|
6548
|
-
$should?: never;
|
|
6549
|
-
};
|
|
6550
|
-
|
|
6551
|
-
// $or + $mustNot combined
|
|
6552
|
-
type OrNotNode = BoolBase & {
|
|
6553
|
-
$or: QueryFilter[];
|
|
6554
|
-
$mustNot: QueryFilter[];
|
|
6555
|
-
$boost?: number;
|
|
6556
|
-
$and?: never;
|
|
6557
|
-
$must?: never;
|
|
6558
|
-
$should?: never;
|
|
6559
|
-
};
|
|
6560
|
-
|
|
6561
|
-
// $should + $mustNot combined
|
|
6562
|
-
type ShouldNotNode = BoolBase & {
|
|
6563
|
-
$should: QueryFilter[];
|
|
6564
|
-
$mustNot: QueryFilter[];
|
|
6565
|
-
$boost?: number;
|
|
6566
|
-
$and?: never;
|
|
6567
|
-
$or?: never;
|
|
6568
|
-
$must?: never;
|
|
6569
|
-
};
|
|
6570
|
-
|
|
6571
|
-
// $must + $mustNot combined
|
|
6572
|
-
type MustNotNode = BoolBase & {
|
|
6573
|
-
$must: QueryFilter[];
|
|
6574
|
-
$mustNot: QueryFilter[];
|
|
6575
|
-
$boost?: number;
|
|
6576
|
-
$and?: never;
|
|
6577
|
-
$or?: never;
|
|
6578
|
-
$should?: never;
|
|
6579
|
-
};
|
|
6580
|
-
|
|
6581
|
-
// Full boolean node: $must + $should + $mustNot
|
|
6582
|
-
type BoolNode = BoolBase & {
|
|
6583
|
-
$must: QueryFilter[];
|
|
6584
|
-
$should: QueryFilter[];
|
|
6585
|
-
$mustNot: QueryFilter[];
|
|
6586
|
-
$boost?: number;
|
|
6587
|
-
$and?: never;
|
|
6588
|
-
$or?: never;
|
|
6589
|
-
};
|
|
6590
|
-
|
|
6591
|
-
// Query filter - union of all node types
|
|
6592
|
-
type QueryFilter =
|
|
6593
|
-
| QueryLeaf
|
|
6594
|
-
| AndNode
|
|
6595
|
-
| OrNode
|
|
6596
|
-
| MustNode
|
|
6597
|
-
| ShouldNode
|
|
6598
|
-
| MustShouldNode
|
|
6599
|
-
| NotNode
|
|
6600
|
-
| AndNotNode
|
|
6601
|
-
| OrNotNode
|
|
6602
|
-
| ShouldNotNode
|
|
6603
|
-
| MustNotNode
|
|
6604
|
-
| BoolNode;
|
|
6605
|
-
|
|
6606
|
-
// Root-level $or restriction (no field conditions at root with $or)
|
|
6607
|
-
type RootOrNode = {
|
|
6608
|
-
$or: QueryFilter[];
|
|
6609
|
-
$boost?: number;
|
|
6610
|
-
$and?: never;
|
|
6611
|
-
$must?: never;
|
|
6612
|
-
$should?: never;
|
|
6613
|
-
$mustNot?: never;
|
|
6614
|
-
};
|
|
6615
|
-
|
|
6616
|
-
// Root query filter - restricts $or from mixing with fields at root level
|
|
6617
|
-
type Query =
|
|
6618
|
-
| QueryLeaf
|
|
6619
|
-
| AndNode
|
|
6620
|
-
| RootOrNode
|
|
6621
|
-
| MustNode
|
|
6622
|
-
| ShouldNode
|
|
6623
|
-
| MustShouldNode
|
|
6624
|
-
| NotNode
|
|
6625
|
-
| AndNotNode
|
|
6626
|
-
| ShouldNotNode
|
|
6627
|
-
| MustNotNode
|
|
6628
|
-
| BoolNode;
|
|
6629
|
-
`;
|
|
6630
|
-
};
|
|
6631
|
-
|
|
6632
|
-
// src/components/databrowser/components/display/input/query-editor.tsx
|
|
6633
|
-
|
|
6634
|
-
var QueryEditor = (props) => {
|
|
6635
|
-
if (isTest) {
|
|
6636
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TestQueryEditor, { ...props });
|
|
6637
|
-
}
|
|
6638
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MonacoQueryEditor, { ...props });
|
|
6639
|
-
};
|
|
6640
|
-
var MonacoQueryEditor = ({ value, onChange, height, schema }) => {
|
|
6641
|
-
const monaco = _react2.useMonaco.call(void 0, );
|
|
6642
|
-
const editorRef = _react.useRef.call(void 0, null);
|
|
6643
|
-
const theme = useTheme();
|
|
6644
|
-
const libDisposableRef = _react.useRef.call(void 0, null);
|
|
6645
|
-
const typeDefinitions = _react.useMemo.call(void 0, () => generateTypeDefinitions(schema), [schema]);
|
|
6646
|
-
_react.useEffect.call(void 0, () => {
|
|
6647
|
-
if (!monaco) return;
|
|
6648
|
-
if (libDisposableRef.current) {
|
|
6649
|
-
libDisposableRef.current.dispose();
|
|
6650
|
-
}
|
|
6651
|
-
libDisposableRef.current = monaco.languages.typescript.typescriptDefaults.addExtraLib(
|
|
6652
|
-
typeDefinitions,
|
|
6653
|
-
"file:///query-types.d.ts"
|
|
6654
|
-
);
|
|
6655
|
-
return () => {
|
|
6656
|
-
if (libDisposableRef.current) {
|
|
6657
|
-
libDisposableRef.current.dispose();
|
|
6658
|
-
}
|
|
6659
|
-
};
|
|
6660
|
-
}, [monaco, typeDefinitions]);
|
|
6661
|
-
const handleBeforeMount = (monaco2) => {
|
|
6662
|
-
monaco2.languages.typescript.typescriptDefaults.setCompilerOptions({
|
|
6663
|
-
target: monaco2.languages.typescript.ScriptTarget.ES2020,
|
|
6664
|
-
allowNonTsExtensions: true,
|
|
6665
|
-
moduleResolution: monaco2.languages.typescript.ModuleResolutionKind.NodeJs,
|
|
6666
|
-
module: monaco2.languages.typescript.ModuleKind.CommonJS,
|
|
6667
|
-
noEmit: true,
|
|
6668
|
-
esModuleInterop: true,
|
|
6669
|
-
strict: true,
|
|
6670
|
-
allowJs: true
|
|
6671
|
-
});
|
|
6672
|
-
libDisposableRef.current = monaco2.languages.typescript.typescriptDefaults.addExtraLib(
|
|
6673
|
-
typeDefinitions,
|
|
6674
|
-
"file:///query-types.d.ts"
|
|
6675
|
-
);
|
|
6676
|
-
monaco2.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
6677
|
-
noSemanticValidation: false,
|
|
6678
|
-
noSyntaxValidation: false
|
|
6679
|
-
});
|
|
6680
|
-
monaco2.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
6681
|
-
};
|
|
6682
|
-
_react.useEffect.call(void 0, () => {
|
|
6683
|
-
const match = value.startsWith("const query: Query = {");
|
|
6684
|
-
const ending = value.endsWith("}");
|
|
6685
|
-
if (!match || !ending) {
|
|
6686
|
-
onChange("const query: Query = {}");
|
|
6687
|
-
}
|
|
6688
|
-
}, [value, editorRef.current, onChange]);
|
|
6689
|
-
const handleChange = (newValue) => {
|
|
6690
|
-
if (!newValue) {
|
|
6691
|
-
onChange("");
|
|
6692
|
-
return;
|
|
6693
|
-
}
|
|
6694
|
-
const match = newValue.startsWith("const query: Query = {");
|
|
6695
|
-
if (match) {
|
|
6696
|
-
onChange(newValue);
|
|
6697
|
-
} else {
|
|
6698
|
-
const editor = editorRef.current;
|
|
6699
|
-
if (editor) {
|
|
6700
|
-
editor.setValue(value);
|
|
6701
|
-
}
|
|
6702
|
-
}
|
|
6703
|
-
};
|
|
6704
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6705
|
-
_react2.Editor,
|
|
6706
|
-
{
|
|
6707
|
-
theme: theme === "dark" ? "vs-dark" : "light",
|
|
6708
|
-
loading: void 0,
|
|
6709
|
-
beforeMount: handleBeforeMount,
|
|
6710
|
-
onMount: (editor) => {
|
|
6711
|
-
editorRef.current = editor;
|
|
6712
|
-
},
|
|
6713
|
-
value,
|
|
6714
|
-
onChange: handleChange,
|
|
6715
|
-
defaultLanguage: "typescript",
|
|
6716
|
-
path: "query.ts",
|
|
6717
|
-
options: {
|
|
6718
|
-
wordWrap: "on",
|
|
6719
|
-
overviewRulerBorder: false,
|
|
6720
|
-
overviewRulerLanes: 0,
|
|
6721
|
-
formatOnPaste: true,
|
|
6722
|
-
formatOnType: true,
|
|
6723
|
-
renderWhitespace: "none",
|
|
6724
|
-
smoothScrolling: true,
|
|
6725
|
-
scrollbar: {
|
|
6726
|
-
verticalScrollbarSize: 12
|
|
6727
|
-
},
|
|
6728
|
-
autoIndent: "full",
|
|
6729
|
-
guides: { indentation: false },
|
|
6730
|
-
fontSize: 13,
|
|
6731
|
-
cursorBlinking: "smooth",
|
|
6732
|
-
minimap: { enabled: false },
|
|
6733
|
-
folding: true,
|
|
6734
|
-
glyphMargin: false,
|
|
6735
|
-
lineNumbers: "on",
|
|
6736
|
-
parameterHints: { enabled: true },
|
|
6737
|
-
lineDecorationsWidth: 0,
|
|
6738
|
-
automaticLayout: true,
|
|
6739
|
-
scrollBeyondLastLine: false,
|
|
6740
|
-
renderLineHighlight: "line",
|
|
6741
|
-
unusualLineTerminators: "auto",
|
|
6742
|
-
padding: { top: 8, bottom: 8 },
|
|
6743
|
-
quickSuggestions: true,
|
|
6744
|
-
suggest: {
|
|
6745
|
-
showVariables: false,
|
|
6746
|
-
showConstants: false,
|
|
6747
|
-
showFunctions: false,
|
|
6748
|
-
showClasses: false,
|
|
6749
|
-
showInterfaces: false,
|
|
6750
|
-
showModules: false,
|
|
6751
|
-
showKeywords: false
|
|
6752
|
-
},
|
|
6753
|
-
suggestOnTriggerCharacters: true,
|
|
6754
|
-
acceptSuggestionOnEnter: "on",
|
|
6755
|
-
tabCompletion: "on",
|
|
6756
|
-
wordBasedSuggestions: "off",
|
|
6757
|
-
// Disable navigation features
|
|
6758
|
-
gotoLocation: {
|
|
6759
|
-
multiple: "goto",
|
|
6760
|
-
multipleDefinitions: "goto",
|
|
6761
|
-
multipleTypeDefinitions: "goto",
|
|
6762
|
-
multipleDeclarations: "goto",
|
|
6763
|
-
multipleImplementations: "goto",
|
|
6764
|
-
multipleReferences: "goto"
|
|
6765
|
-
},
|
|
6766
|
-
definitionLinkOpensInPeek: false,
|
|
6767
|
-
contextmenu: false
|
|
6768
|
-
},
|
|
6769
|
-
className: "[&_.current-line]:!border-none [&_.current-line]:!bg-emerald-50 [&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!bg-transparent [&_[role='presentation']]:!bg-transparent"
|
|
6770
|
-
}
|
|
6771
|
-
) });
|
|
6772
|
-
};
|
|
6773
|
-
var TestQueryEditor = ({ value, onChange, height }) => {
|
|
6774
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("group/editor relative"), style: { height }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6775
|
-
"textarea",
|
|
6776
|
-
{
|
|
6777
|
-
"aria-label": "query-editor",
|
|
6778
|
-
value,
|
|
6779
|
-
onChange: (e) => onChange(e.target.value),
|
|
6780
|
-
className: "h-full w-full resize-none bg-transparent p-2 font-mono text-sm"
|
|
6781
|
-
}
|
|
6782
|
-
) });
|
|
6783
|
-
};
|
|
6784
|
-
|
|
6785
|
-
// src/components/databrowser/components/query-builder.tsx
|
|
6786
|
-
|
|
6787
|
-
var QueryBuilder = () => {
|
|
6788
|
-
const { valuesSearch, setValuesSearchQuery } = useTab();
|
|
6789
|
-
const [value, setValue] = _react.useState.call(void 0, valuesSearch.query);
|
|
6790
|
-
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
6791
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-lg border border-zinc-300 bg-white px-[6px] dark:border-zinc-700", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6792
|
-
QueryEditor,
|
|
6793
|
-
{
|
|
6794
|
-
height: 300,
|
|
6795
|
-
value,
|
|
6796
|
-
onChange: (value2) => {
|
|
6797
|
-
setValue(value2);
|
|
6798
|
-
const sliced = value2.slice(PREFIX.length);
|
|
6799
|
-
const parsed = parseJSObjectLiteral(sliced);
|
|
6800
|
-
const newValue = value2.slice(PREFIX.length);
|
|
6801
|
-
if (parsed && valuesSearch.query !== newValue) {
|
|
6802
|
-
setValuesSearchQuery(newValue);
|
|
6803
|
-
}
|
|
6804
|
-
},
|
|
6805
|
-
schema: _optionalChain([indexDetails, 'optionalAccess', _66 => _66.schema])
|
|
6806
|
-
}
|
|
6807
|
-
) });
|
|
6808
|
-
};
|
|
6809
|
-
|
|
6810
|
-
// src/components/databrowser/components/sidebar/empty.tsx
|
|
6811
|
-
|
|
6812
|
-
var Empty = () => {
|
|
6813
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full w-full items-center justify-center rounded-md border bg-white px-4 py-6 text-center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-5", children: [
|
|
6814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-md font-medium", children: "Data on a break" }),
|
|
6815
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-balance text-center", children: '"Quick, lure it back with some CLI magic!"' })
|
|
6816
|
-
] }) });
|
|
6817
|
-
};
|
|
6818
|
-
|
|
6819
|
-
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
5838
|
+
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
6824
5839
|
|
|
6825
5840
|
|
|
6826
5841
|
|
|
@@ -6829,13 +5844,8 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
6829
5844
|
const { mutate: deleteKey } = useDeleteKey();
|
|
6830
5845
|
const [isAlertOpen, setAlertOpen] = _react.useState.call(void 0, false);
|
|
6831
5846
|
const [contextKeys, setContextKeys] = _react.useState.call(void 0, []);
|
|
6832
|
-
const {
|
|
6833
|
-
|
|
6834
|
-
setSelectedKey: setSelectedKeyGlobal,
|
|
6835
|
-
selectTab,
|
|
6836
|
-
setSearch
|
|
6837
|
-
} = useDatabrowserStore();
|
|
6838
|
-
const { search: currentSearch, selectedKeys, setSelectedKey } = useTab();
|
|
5847
|
+
const { addTab, setSelectedKey: setSelectedKeyGlobal, selectTab, setSearch } = useDatabrowserStore();
|
|
5848
|
+
const { search: currentSearch, selectedKeys } = useTab();
|
|
6839
5849
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
6840
5850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6841
5851
|
DeleteAlertDialog,
|
|
@@ -6865,7 +5875,6 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
6865
5875
|
if (selectedKeys.includes(clickedKey)) {
|
|
6866
5876
|
setContextKeys(selectedKeys);
|
|
6867
5877
|
} else {
|
|
6868
|
-
setSelectedKey(clickedKey);
|
|
6869
5878
|
setContextKeys([clickedKey]);
|
|
6870
5879
|
}
|
|
6871
5880
|
} else {
|
|
@@ -6929,130 +5938,328 @@ var KeysList = () => {
|
|
|
6929
5938
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-px" }),
|
|
6930
5939
|
keys.map((data, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
6931
5940
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6932
|
-
KeyItem,
|
|
5941
|
+
KeyItem,
|
|
5942
|
+
{
|
|
5943
|
+
index: i,
|
|
5944
|
+
data,
|
|
5945
|
+
allKeys: keys,
|
|
5946
|
+
lastClickedIndexRef
|
|
5947
|
+
}
|
|
5948
|
+
),
|
|
5949
|
+
i !== keys.length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "-z-10 mx-2 h-px bg-zinc-100 dark:bg-zinc-200" })
|
|
5950
|
+
] }, data[0]))
|
|
5951
|
+
] }) });
|
|
5952
|
+
};
|
|
5953
|
+
var keyStyles = {
|
|
5954
|
+
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
5955
|
+
hash: "border-amber-400 !bg-amber-50 text-amber-900",
|
|
5956
|
+
set: "border-indigo-400 !bg-indigo-50 text-indigo-900",
|
|
5957
|
+
zset: "border-pink-400 !bg-pink-50 text-pink-900",
|
|
5958
|
+
json: "border-purple-400 !bg-purple-50 text-purple-900",
|
|
5959
|
+
list: "border-orange-400 !bg-orange-50 text-orange-900",
|
|
5960
|
+
stream: "border-green-400 !bg-green-50 text-green-900"
|
|
5961
|
+
};
|
|
5962
|
+
var defaultKeyStyle = "border-gray-400 !bg-gray-50 text-gray-900";
|
|
5963
|
+
var KeyItem = ({
|
|
5964
|
+
data,
|
|
5965
|
+
index,
|
|
5966
|
+
allKeys,
|
|
5967
|
+
lastClickedIndexRef
|
|
5968
|
+
}) => {
|
|
5969
|
+
const { selectedKeys, setSelectedKeys, setSelectedKey } = useTab();
|
|
5970
|
+
const [dataKey, dataType] = data;
|
|
5971
|
+
const isKeySelected = selectedKeys.includes(dataKey);
|
|
5972
|
+
const handleClick = (e) => {
|
|
5973
|
+
if (e.shiftKey && lastClickedIndexRef.current !== null) {
|
|
5974
|
+
const start = Math.min(lastClickedIndexRef.current, index);
|
|
5975
|
+
const end = Math.max(lastClickedIndexRef.current, index);
|
|
5976
|
+
const rangeKeys = allKeys.slice(start, end + 1).map(([key]) => key);
|
|
5977
|
+
setSelectedKeys(rangeKeys);
|
|
5978
|
+
} else if (e.metaKey || e.ctrlKey) {
|
|
5979
|
+
if (isKeySelected) {
|
|
5980
|
+
setSelectedKeys(selectedKeys.filter((k) => k !== dataKey));
|
|
5981
|
+
} else {
|
|
5982
|
+
setSelectedKeys([...selectedKeys, dataKey]);
|
|
5983
|
+
}
|
|
5984
|
+
lastClickedIndexRef.current = index;
|
|
5985
|
+
} else {
|
|
5986
|
+
setSelectedKey(dataKey);
|
|
5987
|
+
lastClickedIndexRef.current = index;
|
|
5988
|
+
}
|
|
5989
|
+
};
|
|
5990
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5991
|
+
Button,
|
|
5992
|
+
{
|
|
5993
|
+
"data-key": dataKey,
|
|
5994
|
+
variant: isKeySelected ? "default" : "ghost",
|
|
5995
|
+
className: cn(
|
|
5996
|
+
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 !ring-0 focus-visible:bg-zinc-50",
|
|
5997
|
+
"-my-px select-none border border-transparent text-left",
|
|
5998
|
+
isKeySelected && "shadow-sm",
|
|
5999
|
+
isKeySelected && (_nullishCoalesce(keyStyles[dataType], () => ( defaultKeyStyle)))
|
|
6000
|
+
),
|
|
6001
|
+
onClick: handleClick,
|
|
6002
|
+
children: [
|
|
6003
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: dataType, type: "icon" }),
|
|
6004
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "truncate whitespace-nowrap", children: dataKey })
|
|
6005
|
+
]
|
|
6006
|
+
}
|
|
6007
|
+
);
|
|
6008
|
+
};
|
|
6009
|
+
|
|
6010
|
+
// src/components/databrowser/components/sidebar/reload-button.tsx
|
|
6011
|
+
|
|
6012
|
+
|
|
6013
|
+
|
|
6014
|
+
var ReloadButton = ({
|
|
6015
|
+
onClick,
|
|
6016
|
+
isLoading: isLoadingProp
|
|
6017
|
+
}) => {
|
|
6018
|
+
const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
|
|
6019
|
+
const handleClick = () => {
|
|
6020
|
+
setIsLoading(true);
|
|
6021
|
+
onClick();
|
|
6022
|
+
setTimeout(() => {
|
|
6023
|
+
setIsLoading(false);
|
|
6024
|
+
}, 350);
|
|
6025
|
+
};
|
|
6026
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SimpleTooltip, { content: "Refresh", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6027
|
+
Button,
|
|
6028
|
+
{
|
|
6029
|
+
variant: "outline",
|
|
6030
|
+
size: "icon-sm",
|
|
6031
|
+
onClick: handleClick,
|
|
6032
|
+
disabled: isLoading || isLoadingProp,
|
|
6033
|
+
children: isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconLoader2, { className: "animate-spin text-zinc-500", size: 16 }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconRefresh, { className: "text-zinc-500 dark:text-zinc-600", size: 16 })
|
|
6034
|
+
}
|
|
6035
|
+
) }) });
|
|
6036
|
+
};
|
|
6037
|
+
|
|
6038
|
+
// src/components/databrowser/components/sidebar/search-input.tsx
|
|
6039
|
+
|
|
6040
|
+
|
|
6041
|
+
|
|
6042
|
+
var dedupeSearchHistory = (history) => {
|
|
6043
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6044
|
+
return history.filter((item) => {
|
|
6045
|
+
if (!item || seen.has(item)) return false;
|
|
6046
|
+
seen.add(item);
|
|
6047
|
+
return true;
|
|
6048
|
+
});
|
|
6049
|
+
};
|
|
6050
|
+
var SearchInput = () => {
|
|
6051
|
+
const { setSearchKey, search } = useTab();
|
|
6052
|
+
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
6053
|
+
const [state, setState] = _react.useState.call(void 0, search.key);
|
|
6054
|
+
const [isFocus, setIsFocus] = _react.useState.call(void 0, false);
|
|
6055
|
+
const [focusedIndex, setFocusedIndex] = _react.useState.call(void 0, -1);
|
|
6056
|
+
const inputRef = _react.useRef.call(void 0, null);
|
|
6057
|
+
const historyItemRefs = _react.useRef.call(void 0, []);
|
|
6058
|
+
const handleSubmit = (value) => {
|
|
6059
|
+
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
6060
|
+
addSearchHistory(value);
|
|
6061
|
+
setSearchKey(value);
|
|
6062
|
+
setState(value);
|
|
6063
|
+
};
|
|
6064
|
+
const filteredHistory = dedupeSearchHistory(
|
|
6065
|
+
searchHistory.filter((item) => item.trim() !== "" && item.trim() !== "*").filter((item) => item.includes(state) && item !== state)
|
|
6066
|
+
).slice(0, 5).map((item) => item.endsWith("*") ? item.slice(0, -1) : item);
|
|
6067
|
+
_react.useEffect.call(void 0, () => {
|
|
6068
|
+
setFocusedIndex(-1);
|
|
6069
|
+
}, [filteredHistory.length]);
|
|
6070
|
+
const handleKeyDown = (e) => {
|
|
6071
|
+
if (e.key === "Enter") {
|
|
6072
|
+
const text = focusedIndex >= 0 && focusedIndex < filteredHistory.length ? filteredHistory[focusedIndex] : e.currentTarget.value;
|
|
6073
|
+
handleSubmit(text);
|
|
6074
|
+
} else if (e.key === "Escape") {
|
|
6075
|
+
setState("");
|
|
6076
|
+
setFocusedIndex(-1);
|
|
6077
|
+
_optionalChain([inputRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.blur, 'call', _57 => _57()]);
|
|
6078
|
+
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
6079
|
+
e.preventDefault();
|
|
6080
|
+
if (focusedIndex < filteredHistory.length - 1) {
|
|
6081
|
+
setFocusedIndex(focusedIndex + 1);
|
|
6082
|
+
} else if (filteredHistory.length > 0) {
|
|
6083
|
+
setFocusedIndex(0);
|
|
6084
|
+
}
|
|
6085
|
+
} else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
|
|
6086
|
+
e.preventDefault();
|
|
6087
|
+
if (focusedIndex > 0) {
|
|
6088
|
+
setFocusedIndex(focusedIndex - 1);
|
|
6089
|
+
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
6090
|
+
setFocusedIndex(-1);
|
|
6091
|
+
_optionalChain([inputRef, 'access', _58 => _58.current, 'optionalAccess', _59 => _59.focus, 'call', _60 => _60()]);
|
|
6092
|
+
} else if (filteredHistory.length > 0) {
|
|
6093
|
+
setFocusedIndex(filteredHistory.length - 1);
|
|
6094
|
+
}
|
|
6095
|
+
}
|
|
6096
|
+
};
|
|
6097
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative grow", children: [
|
|
6098
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
6099
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-8 rounded-md rounded-l-none border border-zinc-300 font-normal", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6100
|
+
Input,
|
|
6101
|
+
{
|
|
6102
|
+
ref: inputRef,
|
|
6103
|
+
placeholder: "Search",
|
|
6104
|
+
className: "h-full rounded-l-none border-none pr-6",
|
|
6105
|
+
onKeyDown: handleKeyDown,
|
|
6106
|
+
onChange: (e) => {
|
|
6107
|
+
setState(e.currentTarget.value);
|
|
6108
|
+
if (e.currentTarget.value.trim() === "") handleSubmit("");
|
|
6109
|
+
},
|
|
6110
|
+
value: state,
|
|
6111
|
+
onFocus: () => {
|
|
6112
|
+
setIsFocus(true);
|
|
6113
|
+
setFocusedIndex(-1);
|
|
6114
|
+
},
|
|
6115
|
+
onBlur: () => setIsFocus(false)
|
|
6116
|
+
}
|
|
6117
|
+
) }) }),
|
|
6118
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6119
|
+
PopoverContent,
|
|
6933
6120
|
{
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6121
|
+
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
6122
|
+
autoFocus: false,
|
|
6123
|
+
onOpenAutoFocus: (e) => {
|
|
6124
|
+
e.preventDefault();
|
|
6125
|
+
e.stopPropagation();
|
|
6126
|
+
},
|
|
6127
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full py-[3px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6128
|
+
"button",
|
|
6129
|
+
{
|
|
6130
|
+
ref: (el) => {
|
|
6131
|
+
historyItemRefs.current[index] = el;
|
|
6132
|
+
},
|
|
6133
|
+
onClick: () => handleSubmit(item),
|
|
6134
|
+
onMouseEnter: () => setFocusedIndex(index),
|
|
6135
|
+
className: `block w-full truncate rounded-sm p-1 text-left transition-colors ${focusedIndex === index ? "bg-zinc-100" : "hover:bg-zinc-100"}`,
|
|
6136
|
+
children: item
|
|
6137
|
+
}
|
|
6138
|
+
) }, item))
|
|
6938
6139
|
}
|
|
6939
|
-
)
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
const end = Math.max(lastClickedIndexRef.current, index);
|
|
6957
|
-
const rangeKeys = allKeys.slice(start, end + 1).map(([key]) => key);
|
|
6958
|
-
setSelectedKeys(rangeKeys);
|
|
6959
|
-
} else if (e.metaKey || e.ctrlKey) {
|
|
6960
|
-
if (isKeySelected) {
|
|
6961
|
-
setSelectedKeys(selectedKeys.filter((k) => k !== dataKey));
|
|
6962
|
-
} else {
|
|
6963
|
-
setSelectedKeys([...selectedKeys, dataKey]);
|
|
6140
|
+
)
|
|
6141
|
+
] }),
|
|
6142
|
+
state && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6143
|
+
Button,
|
|
6144
|
+
{
|
|
6145
|
+
type: "button",
|
|
6146
|
+
variant: "link",
|
|
6147
|
+
size: "icon",
|
|
6148
|
+
className: "absolute right-1 top-1/2 h-5 w-5 -translate-y-1/2 text-zinc-500 hover:text-zinc-900",
|
|
6149
|
+
onClick: () => {
|
|
6150
|
+
setSearchKey("");
|
|
6151
|
+
setState("");
|
|
6152
|
+
},
|
|
6153
|
+
children: [
|
|
6154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconX, { size: 16 }),
|
|
6155
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: "Clear" })
|
|
6156
|
+
]
|
|
6964
6157
|
}
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
lastClickedIndexRef.current = index;
|
|
6969
|
-
}
|
|
6970
|
-
};
|
|
6971
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6972
|
-
"button",
|
|
6973
|
-
{
|
|
6974
|
-
"data-key": dataKey,
|
|
6975
|
-
className: cn(
|
|
6976
|
-
"relative flex h-10 w-full items-center justify-start gap-2 rounded-lg px-3 py-0 !ring-0 transition-colors focus-visible:bg-zinc-50",
|
|
6977
|
-
"-my-px select-none border border-transparent text-left",
|
|
6978
|
-
isKeySelected ? "border-zinc-300 bg-white font-medium text-zinc-950 shadow-[0_1px_2px_0_rgba(0,0,0,0.10)]" : "shadow-none hover:bg-zinc-200"
|
|
6979
|
-
),
|
|
6980
|
-
onClick: handleClick,
|
|
6981
|
-
children: [
|
|
6982
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: dataType, type: "icon" }),
|
|
6983
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "grow truncate whitespace-nowrap", children: dataKey }),
|
|
6984
|
-
isKeySelected && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconChevronRight, { className: "shrink-0 text-zinc-500", size: 20 })
|
|
6985
|
-
]
|
|
6986
|
-
}
|
|
6987
|
-
);
|
|
6158
|
+
),
|
|
6159
|
+
" "
|
|
6160
|
+
] });
|
|
6988
6161
|
};
|
|
6989
6162
|
|
|
6990
6163
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
6991
6164
|
|
|
6992
6165
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
6993
|
-
var LoadingSkeleton = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "block h-full w-full rounded-lg
|
|
6166
|
+
var LoadingSkeleton = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "block h-full w-full rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all", children: Array.from({ length: DEFAULT_SKELETON_COUNT }).fill(0).map((_, idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center gap-2 px-3", children: [
|
|
6994
6167
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
6995
6168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "h-4 grow rounded" })
|
|
6996
6169
|
] }, idx)) });
|
|
6997
6170
|
|
|
6171
|
+
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
6172
|
+
|
|
6173
|
+
var ALL_TYPES_KEY = "all";
|
|
6174
|
+
function DataTypeSelector() {
|
|
6175
|
+
const { search, setSearchType } = useTab();
|
|
6176
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6177
|
+
Select,
|
|
6178
|
+
{
|
|
6179
|
+
onValueChange: (type) => {
|
|
6180
|
+
if (type === ALL_TYPES_KEY) {
|
|
6181
|
+
setSearchType(void 0);
|
|
6182
|
+
} else {
|
|
6183
|
+
setSearchType(type);
|
|
6184
|
+
}
|
|
6185
|
+
},
|
|
6186
|
+
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
6187
|
+
children: [
|
|
6188
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectTrigger, { className: "!w-auto select-none whitespace-nowrap rounded-r-none border-r-0 border-zinc-300 pr-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectValue, {}) }),
|
|
6189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
6190
|
+
([key, value]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SelectItem, { value: key, children: value }, key)
|
|
6191
|
+
) }) })
|
|
6192
|
+
]
|
|
6193
|
+
}
|
|
6194
|
+
);
|
|
6195
|
+
}
|
|
6196
|
+
|
|
6998
6197
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
6999
6198
|
|
|
7000
6199
|
function Sidebar() {
|
|
7001
6200
|
const { keys, query } = useKeys();
|
|
7002
|
-
return /* @__PURE__ */ _jsxruntime.
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
6201
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 p-4", children: [
|
|
6202
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100", children: [
|
|
6203
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
6204
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayDbSize, {}),
|
|
6205
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
6206
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6207
|
+
ReloadButton,
|
|
6208
|
+
{
|
|
6209
|
+
onClick: () => {
|
|
6210
|
+
queryClient.invalidateQueries({
|
|
6211
|
+
queryKey: [FETCH_KEYS_QUERY_KEY]
|
|
6212
|
+
});
|
|
6213
|
+
queryClient.invalidateQueries({
|
|
6214
|
+
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY]
|
|
6215
|
+
});
|
|
6216
|
+
queryClient.invalidateQueries({
|
|
6217
|
+
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY]
|
|
6218
|
+
});
|
|
6219
|
+
queryClient.invalidateQueries({
|
|
6220
|
+
queryKey: [FETCH_DB_SIZE_QUERY_KEY]
|
|
6221
|
+
});
|
|
6222
|
+
queryClient.invalidateQueries({
|
|
6223
|
+
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
6224
|
+
});
|
|
6225
|
+
},
|
|
6226
|
+
isLoading: query.isFetching
|
|
6227
|
+
}
|
|
6228
|
+
),
|
|
6229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AddKeyModal, {})
|
|
6230
|
+
] })
|
|
6231
|
+
] }),
|
|
6232
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center", children: [
|
|
6233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTypeSelector, {}),
|
|
6234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SearchInput, {})
|
|
6235
|
+
] })
|
|
6236
|
+
] }),
|
|
6237
|
+
query.isLoading && keys.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
6238
|
+
// Infinite scroll already has a loader at the bottom
|
|
6239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfiniteScroll, { query, disableRoundedInherit: true, className: "min-h-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeysList, {}) })
|
|
6240
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Empty, {})
|
|
6241
|
+
] });
|
|
7015
6242
|
}
|
|
7016
6243
|
|
|
7017
6244
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
7018
6245
|
|
|
7019
|
-
var PREFIX = "const query: Query = ";
|
|
7020
6246
|
var DatabrowserInstance = ({ hidden }) => {
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
{
|
|
7038
|
-
autoSaveId: "persistence",
|
|
7039
|
-
direction: "horizontal",
|
|
7040
|
-
className: "h-full w-full text-sm antialiased",
|
|
7041
|
-
children: [
|
|
7042
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Sidebar, {}) }),
|
|
7043
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactresizablepanels.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: [
|
|
7044
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
7045
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" }),
|
|
7046
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[3px] w-[3px] rounded-full bg-zinc-300" })
|
|
7047
|
-
] }),
|
|
7048
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { minSize: 40, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataDisplay, {}) })
|
|
7049
|
-
]
|
|
7050
|
-
}
|
|
7051
|
-
),
|
|
7052
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Toaster, {})
|
|
7053
|
-
]
|
|
7054
|
-
}
|
|
7055
|
-
) });
|
|
6247
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeysProvider, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("min-h-0 grow rounded-md bg-zinc-100", hidden && "hidden"), children: [
|
|
6248
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6249
|
+
_reactresizablepanels.PanelGroup,
|
|
6250
|
+
{
|
|
6251
|
+
autoSaveId: "persistence",
|
|
6252
|
+
direction: "horizontal",
|
|
6253
|
+
className: "h-full w-full gap-0.5 text-sm antialiased",
|
|
6254
|
+
children: [
|
|
6255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Sidebar, {}) }),
|
|
6256
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.PanelResizeHandle, { className: "group flex h-full w-3 justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full border-r border-dashed border-zinc-200 transition-colors group-hover:border-zinc-500" }) }),
|
|
6257
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { minSize: 40, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataDisplay, {}) })
|
|
6258
|
+
]
|
|
6259
|
+
}
|
|
6260
|
+
),
|
|
6261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Toaster, {})
|
|
6262
|
+
] }) });
|
|
7056
6263
|
};
|
|
7057
6264
|
|
|
7058
6265
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
@@ -7072,9 +6279,9 @@ var _utilities = require('@dnd-kit/utilities');
|
|
|
7072
6279
|
|
|
7073
6280
|
// src/components/ui/command.tsx
|
|
7074
6281
|
|
|
7075
|
-
|
|
7076
6282
|
var _cmdk = require('cmdk');
|
|
7077
6283
|
|
|
6284
|
+
|
|
7078
6285
|
var Command = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7079
6286
|
_cmdk.Command,
|
|
7080
6287
|
{
|
|
@@ -7161,6 +6368,15 @@ CommandShortcut.displayName = "CommandShortcut";
|
|
|
7161
6368
|
|
|
7162
6369
|
|
|
7163
6370
|
|
|
6371
|
+
// src/components/databrowser/components/tab-type-icon.tsx
|
|
6372
|
+
|
|
6373
|
+
function TabTypeIcon({ selectedKey }) {
|
|
6374
|
+
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
6375
|
+
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "h-5 w-5 rounded" });
|
|
6376
|
+
if (!keyType || keyType === "none") return;
|
|
6377
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: keyType, type: "icon" });
|
|
6378
|
+
}
|
|
6379
|
+
|
|
7164
6380
|
// src/hooks/use-overflow.ts
|
|
7165
6381
|
|
|
7166
6382
|
var useOverflow = () => {
|
|
@@ -7173,7 +6389,7 @@ var useOverflow = () => {
|
|
|
7173
6389
|
}
|
|
7174
6390
|
if (!node) return;
|
|
7175
6391
|
observerRef.current = new ResizeObserver((entries) => {
|
|
7176
|
-
const el = _optionalChain([entries, 'access',
|
|
6392
|
+
const el = _optionalChain([entries, 'access', _61 => _61.at, 'call', _62 => _62(0), 'optionalAccess', _63 => _63.target]);
|
|
7177
6393
|
if (!el) return;
|
|
7178
6394
|
setIsOverflow(el.scrollWidth > el.clientWidth);
|
|
7179
6395
|
});
|
|
@@ -7181,25 +6397,16 @@ var useOverflow = () => {
|
|
|
7181
6397
|
}, []);
|
|
7182
6398
|
_react.useEffect.call(void 0, () => {
|
|
7183
6399
|
return () => {
|
|
7184
|
-
_optionalChain([observerRef, 'access',
|
|
6400
|
+
_optionalChain([observerRef, 'access', _64 => _64.current, 'optionalAccess', _65 => _65.disconnect, 'call', _66 => _66()]);
|
|
7185
6401
|
};
|
|
7186
6402
|
}, []);
|
|
7187
6403
|
return { ref, isOverflow };
|
|
7188
6404
|
};
|
|
7189
6405
|
|
|
7190
|
-
// src/components/databrowser/components/tab-type-icon.tsx
|
|
7191
|
-
|
|
7192
|
-
function TabTypeIcon({ selectedKey }) {
|
|
7193
|
-
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
7194
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "h-5 w-5 rounded" });
|
|
7195
|
-
if (!keyType || keyType === "none") return;
|
|
7196
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: keyType, type: "icon" });
|
|
7197
|
-
}
|
|
7198
|
-
|
|
7199
6406
|
// src/components/databrowser/components/tab.tsx
|
|
7200
6407
|
|
|
7201
6408
|
var Tab = ({ id, isList }) => {
|
|
7202
|
-
const { active, search, selectedKey,
|
|
6409
|
+
const { active, search, selectedKey, pinned } = useTab();
|
|
7203
6410
|
const {
|
|
7204
6411
|
selectTab,
|
|
7205
6412
|
removeTab,
|
|
@@ -7212,20 +6419,21 @@ var Tab = ({ id, isList }) => {
|
|
|
7212
6419
|
} = useDatabrowserStore();
|
|
7213
6420
|
const hasPinnedTabs = tabs.some(([, data]) => data.pinned);
|
|
7214
6421
|
const { ref, isOverflow } = useOverflow();
|
|
7215
|
-
const label =
|
|
7216
|
-
const iconNode =
|
|
6422
|
+
const label = search.key || selectedKey;
|
|
6423
|
+
const iconNode = search.key ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconSearch, { size: 15 }) : selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TabTypeIcon, { selectedKey }) : void 0;
|
|
7217
6424
|
const tabNode = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
7218
6425
|
"div",
|
|
7219
6426
|
{
|
|
7220
6427
|
id: isList ? `list-tab-${id}` : `tab-${id}`,
|
|
7221
6428
|
onClick: () => selectTab(id),
|
|
7222
6429
|
className: cn(
|
|
7223
|
-
"flex h-
|
|
6430
|
+
"flex h-9 w-full cursor-pointer items-center gap-2 px-3 text-[13px] transition-colors",
|
|
7224
6431
|
isList && "max-w-[370px]",
|
|
7225
|
-
!isList &&
|
|
6432
|
+
!isList && "rounded-t-lg border border-zinc-200",
|
|
6433
|
+
!isList && (active ? "border-b-white bg-white text-zinc-900" : "bg-zinc-100 hover:bg-zinc-50")
|
|
7226
6434
|
),
|
|
7227
6435
|
children: [
|
|
7228
|
-
|
|
6436
|
+
iconNode,
|
|
7229
6437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7230
6438
|
"span",
|
|
7231
6439
|
{
|
|
@@ -7242,7 +6450,7 @@ var Tab = ({ id, isList }) => {
|
|
|
7242
6450
|
e.stopPropagation();
|
|
7243
6451
|
removeTab(id);
|
|
7244
6452
|
},
|
|
7245
|
-
className: "p-
|
|
6453
|
+
className: "p-1 text-zinc-300 transition-colors hover:text-zinc-500 dark:text-zinc-400",
|
|
7246
6454
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconX, { size: 16 })
|
|
7247
6455
|
}
|
|
7248
6456
|
)
|
|
@@ -7299,8 +6507,8 @@ var SortableTab = ({ id }) => {
|
|
|
7299
6507
|
const [originalWidth, setOriginalWidth] = _react.useState.call(void 0, null);
|
|
7300
6508
|
const textRef = _react.useRef.call(void 0, null);
|
|
7301
6509
|
const { tabs } = useDatabrowserStore();
|
|
7302
|
-
const tabData = _optionalChain([tabs, 'access',
|
|
7303
|
-
const isPinned = _optionalChain([tabData, 'optionalAccess',
|
|
6510
|
+
const tabData = _optionalChain([tabs, 'access', _67 => _67.find, 'call', _68 => _68(([tabId]) => tabId === id), 'optionalAccess', _69 => _69[1]]);
|
|
6511
|
+
const isPinned = _optionalChain([tabData, 'optionalAccess', _70 => _70.pinned]);
|
|
7304
6512
|
const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = _sortable.useSortable.call(void 0, {
|
|
7305
6513
|
id,
|
|
7306
6514
|
disabled: isPinned,
|
|
@@ -7445,70 +6653,73 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
7445
6653
|
reorderTabs(oldIndex, newIndex);
|
|
7446
6654
|
}
|
|
7447
6655
|
};
|
|
7448
|
-
return /* @__PURE__ */ _jsxruntime.
|
|
7449
|
-
/* @__PURE__ */ _jsxruntime.
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
6656
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative mb-2 shrink-0", children: [
|
|
6657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute bottom-0 left-0 right-0 -z-10 h-[1px] w-full bg-zinc-200" }),
|
|
6658
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex translate-y-[1px] items-center gap-1", children: [
|
|
6659
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative min-w-0 flex-1", children: [
|
|
6660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6661
|
+
"div",
|
|
6662
|
+
{
|
|
6663
|
+
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"}`
|
|
6664
|
+
}
|
|
6665
|
+
),
|
|
6666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6667
|
+
"div",
|
|
6668
|
+
{
|
|
6669
|
+
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"}`
|
|
6670
|
+
}
|
|
6671
|
+
),
|
|
6672
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6673
|
+
"div",
|
|
6674
|
+
{
|
|
6675
|
+
ref: scrollRef,
|
|
6676
|
+
onScroll: recomputeShadows,
|
|
6677
|
+
className: "scrollbar-hide flex min-w-0 flex-1 items-center gap-1 overflow-x-auto pb-[1px] [&::-webkit-scrollbar]:hidden",
|
|
6678
|
+
children: [
|
|
6679
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6680
|
+
_core.DndContext,
|
|
6681
|
+
{
|
|
6682
|
+
sensors,
|
|
6683
|
+
collisionDetection: _core.closestCenter,
|
|
6684
|
+
onDragEnd: handleDragEnd,
|
|
6685
|
+
modifiers: [_modifiers.restrictToHorizontalAxis],
|
|
6686
|
+
measuring: {
|
|
6687
|
+
droppable: {
|
|
6688
|
+
strategy: _core.MeasuringStrategy.Always
|
|
6689
|
+
}
|
|
6690
|
+
},
|
|
6691
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6692
|
+
_sortable.SortableContext,
|
|
6693
|
+
{
|
|
6694
|
+
items: sortedTabs.map(([id]) => id),
|
|
6695
|
+
strategy: _sortable.horizontalListSortingStrategy,
|
|
6696
|
+
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SortableTab, { id }, id))
|
|
6697
|
+
}
|
|
6698
|
+
)
|
|
6699
|
+
}
|
|
6700
|
+
),
|
|
6701
|
+
!isOverflow && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1 pl-1 pr-1", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AddTabButton, {}) })
|
|
6702
|
+
]
|
|
6703
|
+
}
|
|
6704
|
+
)
|
|
6705
|
+
] }),
|
|
6706
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1 pl-1", children: [
|
|
6707
|
+
isOverflow && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AddTabButton, {}),
|
|
6708
|
+
tabs.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TabsListButton, { tabs, onSelectTab: selectTab }),
|
|
6709
|
+
onFullScreenClick && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6710
|
+
Button,
|
|
6711
|
+
{
|
|
6712
|
+
"aria-label": "Toggle fullscreen",
|
|
6713
|
+
variant: "secondary",
|
|
6714
|
+
size: "icon-sm",
|
|
6715
|
+
onClick: onFullScreenClick,
|
|
6716
|
+
className: "flex-shrink-0 bg-blue-100 hover:bg-blue-600 hover:text-white",
|
|
6717
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconMaximize, { size: 16 })
|
|
6718
|
+
}
|
|
6719
|
+
)
|
|
6720
|
+
] })
|
|
7510
6721
|
] })
|
|
7511
|
-
] })
|
|
6722
|
+
] });
|
|
7512
6723
|
};
|
|
7513
6724
|
function AddTabButton() {
|
|
7514
6725
|
const { addTab, selectTab } = useDatabrowserStore();
|
|
@@ -7517,7 +6728,7 @@ function AddTabButton() {
|
|
|
7517
6728
|
const tabsId = addTab();
|
|
7518
6729
|
selectTab(tabsId);
|
|
7519
6730
|
setTimeout(() => {
|
|
7520
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
6731
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _71 => _71.current, 'optionalAccess', _72 => _72.querySelector, 'call', _73 => _73(`#tab-${tabsId}`)]);
|
|
7521
6732
|
if (!tab) return;
|
|
7522
6733
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
7523
6734
|
}, 20);
|
|
@@ -7529,8 +6740,8 @@ function AddTabButton() {
|
|
|
7529
6740
|
variant: "secondary",
|
|
7530
6741
|
size: "icon-sm",
|
|
7531
6742
|
onClick: handleAddTab,
|
|
7532
|
-
className: "flex-shrink-0 bg-zinc-200
|
|
7533
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "text-zinc-600", size: 16 })
|
|
6743
|
+
className: "flex-shrink-0 dark:bg-zinc-200",
|
|
6744
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "text-zinc-500 dark:text-zinc-600", size: 16 })
|
|
7534
6745
|
}
|
|
7535
6746
|
);
|
|
7536
6747
|
}
|
|
@@ -7551,7 +6762,7 @@ function TabsListButton({
|
|
|
7551
6762
|
onSelectTab(id);
|
|
7552
6763
|
setOpen(false);
|
|
7553
6764
|
setTimeout(() => {
|
|
7554
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
6765
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _74 => _74.current, 'optionalAccess', _75 => _75.querySelector, 'call', _76 => _76(`#tab-${id}`)]);
|
|
7555
6766
|
if (!tab) return;
|
|
7556
6767
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
7557
6768
|
}, 20);
|
|
@@ -7562,7 +6773,7 @@ function TabsListButton({
|
|
|
7562
6773
|
{
|
|
7563
6774
|
variant: "secondary",
|
|
7564
6775
|
size: "sm",
|
|
7565
|
-
className: "gap-1
|
|
6776
|
+
className: "h-7 gap-1 px-2",
|
|
7566
6777
|
"aria-label": "Search in tabs",
|
|
7567
6778
|
children: [
|
|
7568
6779
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs text-zinc-600", children: tabs.length }),
|
|
@@ -7633,7 +6844,7 @@ var RedisBrowserRoot = ({
|
|
|
7633
6844
|
className: `ups-db ${theme === "dark" ? "dark" : ""}`,
|
|
7634
6845
|
style: { height: "100%" },
|
|
7635
6846
|
ref: rootRef,
|
|
7636
|
-
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col
|
|
6847
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col text-zinc-700", children: [
|
|
7637
6848
|
!hideTabs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserTabs, { onFullScreenClick }),
|
|
7638
6849
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserInstances, {})
|
|
7639
6850
|
] })
|