@upstash/react-redis-browser 0.2.14-rc.11 → 0.2.14-rc.12
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/README.md +73 -6
- package/dist/index.css +15 -5
- package/dist/index.js +736 -284
- package/dist/index.mjs +863 -411
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2668,8 +2668,44 @@ var isTest = typeof window !== "undefined" && window.__PLAYWRIGHT__ === true;
|
|
|
2668
2668
|
var jsonToJsLiteral = (json) => {
|
|
2669
2669
|
return json.replaceAll(/"([$A-Z_a-z][\w$]*)"\s*:/g, "$1:");
|
|
2670
2670
|
};
|
|
2671
|
+
var MAX_INLINE_KEYS = 2;
|
|
2672
|
+
var isInlineable = (value) => {
|
|
2673
|
+
if (typeof value !== "object" || value === null) return true;
|
|
2674
|
+
if (Array.isArray(value)) return value.every((v) => typeof v !== "object" || v === null);
|
|
2675
|
+
const entries = Object.entries(value);
|
|
2676
|
+
return entries.length <= MAX_INLINE_KEYS && entries.every(([, v]) => typeof v !== "object" || v === null);
|
|
2677
|
+
};
|
|
2678
|
+
var prettyPrint = (value, indent) => {
|
|
2679
|
+
if (value === void 0 || value === null) return String(value);
|
|
2680
|
+
if (typeof value !== "object") return JSON.stringify(value);
|
|
2681
|
+
const prefix = " ".repeat(indent);
|
|
2682
|
+
const childPrefix = " ".repeat(indent + 1);
|
|
2683
|
+
if (Array.isArray(value)) {
|
|
2684
|
+
if (value.length === 0) return "[]";
|
|
2685
|
+
if (value.every((v) => isInlineable(v))) {
|
|
2686
|
+
const inline = `[${value.map((v) => prettyPrint(v, 0)).join(", ")}]`;
|
|
2687
|
+
if (!inline.includes("\n")) return inline;
|
|
2688
|
+
}
|
|
2689
|
+
const items = value.map((v) => `${childPrefix}${prettyPrint(v, indent + 1)}`);
|
|
2690
|
+
return `[
|
|
2691
|
+
${items.join(",\n")}
|
|
2692
|
+
${prefix}]`;
|
|
2693
|
+
}
|
|
2694
|
+
const entries = Object.entries(value);
|
|
2695
|
+
if (entries.length === 0) return "{}";
|
|
2696
|
+
if (indent > 0 && entries.length <= MAX_INLINE_KEYS && entries.every(([, v]) => isInlineable(v))) {
|
|
2697
|
+
const inline = `{ ${entries.map(([k, v]) => `${JSON.stringify(k)}: ${prettyPrint(v, 0)}`).join(", ")} }`;
|
|
2698
|
+
if (!inline.includes("\n")) return inline;
|
|
2699
|
+
}
|
|
2700
|
+
const parts = entries.map(
|
|
2701
|
+
([k, v]) => `${childPrefix}${JSON.stringify(k)}: ${prettyPrint(v, indent + 1)}`
|
|
2702
|
+
);
|
|
2703
|
+
return `{
|
|
2704
|
+
${parts.join(",\n")}
|
|
2705
|
+
${prefix}}`;
|
|
2706
|
+
};
|
|
2671
2707
|
var toJsLiteral = (obj) => {
|
|
2672
|
-
return jsonToJsLiteral(
|
|
2708
|
+
return jsonToJsLiteral(prettyPrint(obj, 0));
|
|
2673
2709
|
};
|
|
2674
2710
|
var formatUpstashErrorMessage = (error) => {
|
|
2675
2711
|
if (error.name !== "UpstashError") return error.message;
|
|
@@ -4004,16 +4040,22 @@ function parseFields(content, prefix, flatSchema) {
|
|
|
4004
4040
|
if (fieldName.startsWith('"') && fieldName.endsWith('"') || fieldName.startsWith("'") && fieldName.endsWith("'")) {
|
|
4005
4041
|
fieldName = fieldName.slice(1, -1);
|
|
4006
4042
|
}
|
|
4043
|
+
if (fieldName.length === 0) {
|
|
4044
|
+
throw new Error("Field name cannot be empty");
|
|
4045
|
+
}
|
|
4007
4046
|
const valueStr = entry.slice(colonIndex + 1).trim();
|
|
4008
4047
|
const fullKey = prefix ? `${prefix}.${fieldName}` : fieldName;
|
|
4009
4048
|
if (valueStr.startsWith("s.object(")) {
|
|
4010
4049
|
const nestedContent = extractObjectContent(valueStr);
|
|
4011
|
-
if (nestedContent
|
|
4012
|
-
|
|
4013
|
-
|
|
4050
|
+
if (nestedContent === void 0) {
|
|
4051
|
+
throw new Error(
|
|
4052
|
+
`Malformed s.object() for field "${fullKey}": missing closing brace or parenthesis`
|
|
4053
|
+
);
|
|
4014
4054
|
}
|
|
4055
|
+
parseFields(nestedContent, fullKey, flatSchema);
|
|
4056
|
+
continue;
|
|
4015
4057
|
}
|
|
4016
|
-
const fieldValue = parseFieldBuilder(valueStr);
|
|
4058
|
+
const fieldValue = parseFieldBuilder(valueStr, fullKey);
|
|
4017
4059
|
if (fieldValue) {
|
|
4018
4060
|
flatSchema[fullKey] = fieldValue;
|
|
4019
4061
|
}
|
|
@@ -4074,15 +4116,15 @@ function findColonIndex(entry) {
|
|
|
4074
4116
|
}
|
|
4075
4117
|
function extractObjectContent(str) {
|
|
4076
4118
|
const match = str.match(/^s\.object\s*\(\s*{([\S\s]*)}\s*\)/);
|
|
4077
|
-
return match ? match[1] :
|
|
4119
|
+
return match ? match[1] : void 0;
|
|
4078
4120
|
}
|
|
4079
4121
|
function extractFromValue(str) {
|
|
4080
4122
|
const fromIndex = str.indexOf(".from(");
|
|
4081
|
-
if (fromIndex === -1) return
|
|
4123
|
+
if (fromIndex === -1) return void 0;
|
|
4082
4124
|
const start = fromIndex + 6;
|
|
4083
|
-
if (start >= str.length) return
|
|
4125
|
+
if (start >= str.length) return void 0;
|
|
4084
4126
|
const quoteChar = str[start];
|
|
4085
|
-
if (quoteChar !== '"' && quoteChar !== "'") return
|
|
4127
|
+
if (quoteChar !== '"' && quoteChar !== "'") return void 0;
|
|
4086
4128
|
let result = "";
|
|
4087
4129
|
let i = start + 1;
|
|
4088
4130
|
while (i < str.length) {
|
|
@@ -4098,151 +4140,61 @@ function extractFromValue(str) {
|
|
|
4098
4140
|
result += char;
|
|
4099
4141
|
i++;
|
|
4100
4142
|
}
|
|
4101
|
-
return
|
|
4143
|
+
return void 0;
|
|
4102
4144
|
}
|
|
4103
|
-
function parseFieldBuilder(str) {
|
|
4145
|
+
function parseFieldBuilder(str, fieldName) {
|
|
4104
4146
|
str = str.trim().replace(/,\s*$/, "");
|
|
4105
4147
|
if (str.startsWith("s.string()")) {
|
|
4106
4148
|
const noTokenize = str.includes(".noTokenize()");
|
|
4107
4149
|
const noStem = str.includes(".noStem()");
|
|
4108
4150
|
const fromValue = extractFromValue(str);
|
|
4109
|
-
if (!noTokenize && !noStem && fromValue ===
|
|
4151
|
+
if (!noTokenize && !noStem && fromValue === void 0) return "TEXT";
|
|
4110
4152
|
return {
|
|
4111
4153
|
type: "TEXT",
|
|
4112
4154
|
...noTokenize && { noTokenize: true },
|
|
4113
4155
|
...noStem && { noStem: true },
|
|
4114
|
-
...fromValue !==
|
|
4156
|
+
...fromValue !== void 0 && { from: fromValue }
|
|
4115
4157
|
};
|
|
4116
4158
|
}
|
|
4117
4159
|
if (str.startsWith("s.number(")) {
|
|
4118
4160
|
const typeMatch = str.match(/s\.number\(\s*["']?(U64|I64|F64)?["']?\s*\)/);
|
|
4119
4161
|
const numType = typeMatch?.[1] || "F64";
|
|
4120
4162
|
const fromValue = extractFromValue(str);
|
|
4121
|
-
if (fromValue ===
|
|
4163
|
+
if (fromValue === void 0) return numType;
|
|
4122
4164
|
return { type: numType, from: fromValue };
|
|
4123
4165
|
}
|
|
4124
4166
|
if (str.startsWith("s.boolean()")) {
|
|
4125
4167
|
const fast = str.includes(".fast()");
|
|
4126
4168
|
const fromValue = extractFromValue(str);
|
|
4127
|
-
if (!fast && fromValue ===
|
|
4169
|
+
if (!fast && fromValue === void 0) return "BOOL";
|
|
4128
4170
|
return {
|
|
4129
4171
|
type: "BOOL",
|
|
4130
4172
|
...fast && { fast: true },
|
|
4131
|
-
...fromValue !==
|
|
4173
|
+
...fromValue !== void 0 && { from: fromValue }
|
|
4132
4174
|
};
|
|
4133
4175
|
}
|
|
4134
4176
|
if (str.startsWith("s.date()")) {
|
|
4135
4177
|
const fast = str.includes(".fast()");
|
|
4136
4178
|
const fromValue = extractFromValue(str);
|
|
4137
|
-
if (!fast && fromValue ===
|
|
4179
|
+
if (!fast && fromValue === void 0) return "DATE";
|
|
4138
4180
|
return {
|
|
4139
4181
|
type: "DATE",
|
|
4140
4182
|
...fast && { fast: true },
|
|
4141
|
-
...fromValue !==
|
|
4183
|
+
...fromValue !== void 0 && { from: fromValue }
|
|
4142
4184
|
};
|
|
4143
4185
|
}
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
function schemaToEditorValue(flatSchema) {
|
|
4147
|
-
const nested = unflattenSchema(flatSchema);
|
|
4148
|
-
const body = renderObject(nested, 1);
|
|
4149
|
-
return `const schema: Schema = s.object({
|
|
4150
|
-
${body}})`;
|
|
4151
|
-
}
|
|
4152
|
-
function unflattenSchema(flat) {
|
|
4153
|
-
const result = {};
|
|
4154
|
-
for (const [key, value] of Object.entries(flat)) {
|
|
4155
|
-
const parts = key.split(".");
|
|
4156
|
-
let current = result;
|
|
4157
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
4158
|
-
const part = parts[i];
|
|
4159
|
-
if (!current[part] || typeof current[part] !== "object") {
|
|
4160
|
-
current[part] = {};
|
|
4161
|
-
}
|
|
4162
|
-
current = current[part];
|
|
4163
|
-
}
|
|
4164
|
-
current[parts.at(-1)] = value;
|
|
4165
|
-
}
|
|
4166
|
-
return result;
|
|
4167
|
-
}
|
|
4168
|
-
function renderObject(obj, indent) {
|
|
4169
|
-
const pad = " ".repeat(indent);
|
|
4170
|
-
const lines = [];
|
|
4171
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
4172
|
-
if (isFieldValue(value)) {
|
|
4173
|
-
lines.push(`${pad}${key}: ${fieldToBuilder(value)},`);
|
|
4174
|
-
} else {
|
|
4175
|
-
const nested = renderObject(value, indent + 1);
|
|
4176
|
-
lines.push(`${pad}${key}: s.object({`);
|
|
4177
|
-
lines.push(nested.trimEnd());
|
|
4178
|
-
lines.push(`${pad}}),`);
|
|
4179
|
-
}
|
|
4180
|
-
}
|
|
4181
|
-
return lines.join("\n") + "\n";
|
|
4182
|
-
}
|
|
4183
|
-
function isFieldValue(value) {
|
|
4184
|
-
if (typeof value === "string") return true;
|
|
4185
|
-
if (typeof value === "object" && value !== null) {
|
|
4186
|
-
return "type" in value;
|
|
4187
|
-
}
|
|
4188
|
-
return false;
|
|
4189
|
-
}
|
|
4190
|
-
function fieldToBuilder(value) {
|
|
4191
|
-
if (typeof value === "string") {
|
|
4192
|
-
switch (value) {
|
|
4193
|
-
case "TEXT": {
|
|
4194
|
-
return "s.string()";
|
|
4195
|
-
}
|
|
4196
|
-
case "BOOL": {
|
|
4197
|
-
return "s.boolean()";
|
|
4198
|
-
}
|
|
4199
|
-
case "DATE": {
|
|
4200
|
-
return "s.date()";
|
|
4201
|
-
}
|
|
4202
|
-
case "U64":
|
|
4203
|
-
case "I64":
|
|
4204
|
-
case "F64": {
|
|
4205
|
-
return `s.number("${value}")`;
|
|
4206
|
-
}
|
|
4207
|
-
default: {
|
|
4208
|
-
return "s.string()";
|
|
4209
|
-
}
|
|
4210
|
-
}
|
|
4186
|
+
if (str.startsWith("s.keyword()")) {
|
|
4187
|
+
return "KEYWORD";
|
|
4211
4188
|
}
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
let builder = "";
|
|
4215
|
-
switch (type) {
|
|
4216
|
-
case "TEXT": {
|
|
4217
|
-
builder = "s.string()";
|
|
4218
|
-
if (v.noTokenize) builder += ".noTokenize()";
|
|
4219
|
-
if (v.noStem) builder += ".noStem()";
|
|
4220
|
-
break;
|
|
4221
|
-
}
|
|
4222
|
-
case "U64":
|
|
4223
|
-
case "I64":
|
|
4224
|
-
case "F64": {
|
|
4225
|
-
builder = `s.number("${type}")`;
|
|
4226
|
-
break;
|
|
4227
|
-
}
|
|
4228
|
-
case "BOOL": {
|
|
4229
|
-
builder = "s.boolean()";
|
|
4230
|
-
if (v.fast) builder += ".fast()";
|
|
4231
|
-
break;
|
|
4232
|
-
}
|
|
4233
|
-
case "DATE": {
|
|
4234
|
-
builder = "s.date()";
|
|
4235
|
-
if (v.fast) builder += ".fast()";
|
|
4236
|
-
break;
|
|
4237
|
-
}
|
|
4238
|
-
default: {
|
|
4239
|
-
builder = "s.string()";
|
|
4240
|
-
}
|
|
4189
|
+
if (str.startsWith("s.facet()")) {
|
|
4190
|
+
return "FACET";
|
|
4241
4191
|
}
|
|
4242
|
-
if (
|
|
4243
|
-
|
|
4192
|
+
if (str.startsWith("s.")) {
|
|
4193
|
+
const typeMatch = str.match(/^s\.(\w+)\(/);
|
|
4194
|
+
const typeName = typeMatch?.[1] ?? "unknown";
|
|
4195
|
+
throw new Error(`Unknown field type "s.${typeName}()" for field "${fieldName}"`);
|
|
4244
4196
|
}
|
|
4245
|
-
return
|
|
4197
|
+
return void 0;
|
|
4246
4198
|
}
|
|
4247
4199
|
|
|
4248
4200
|
// src/components/databrowser/hooks/use-create-search-index-schema.tsx
|
|
@@ -4282,13 +4234,89 @@ var useCreateSearchIndexSchema = () => {
|
|
|
4282
4234
|
// src/components/databrowser/components/display/display-header.tsx
|
|
4283
4235
|
import { IconPlus } from "@tabler/icons-react";
|
|
4284
4236
|
|
|
4285
|
-
// src/components/ui/
|
|
4237
|
+
// src/components/ui/scroll-area.tsx
|
|
4286
4238
|
import * as React7 from "react";
|
|
4239
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4240
|
+
import { jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
4241
|
+
var ScrollArea = React7.forwardRef(
|
|
4242
|
+
({
|
|
4243
|
+
className,
|
|
4244
|
+
scrollBarClassName,
|
|
4245
|
+
scrollBarForceMount,
|
|
4246
|
+
children,
|
|
4247
|
+
onScroll,
|
|
4248
|
+
disableRoundedInherit = false,
|
|
4249
|
+
orientation = "vertical",
|
|
4250
|
+
...props
|
|
4251
|
+
}, ref) => /* @__PURE__ */ jsxs5(
|
|
4252
|
+
ScrollAreaPrimitive.Root,
|
|
4253
|
+
{
|
|
4254
|
+
ref,
|
|
4255
|
+
className: cn("relative overflow-hidden", className),
|
|
4256
|
+
...props,
|
|
4257
|
+
children: [
|
|
4258
|
+
/* @__PURE__ */ jsx15(
|
|
4259
|
+
ScrollAreaPrimitive.Viewport,
|
|
4260
|
+
{
|
|
4261
|
+
onScroll,
|
|
4262
|
+
className: cn(
|
|
4263
|
+
"h-full w-full [&>div]:!block",
|
|
4264
|
+
!disableRoundedInherit && "rounded-[inherit]"
|
|
4265
|
+
),
|
|
4266
|
+
children
|
|
4267
|
+
}
|
|
4268
|
+
),
|
|
4269
|
+
(orientation === "vertical" || orientation === "both") && /* @__PURE__ */ jsx15(
|
|
4270
|
+
ScrollBar,
|
|
4271
|
+
{
|
|
4272
|
+
className: scrollBarClassName,
|
|
4273
|
+
forceMount: scrollBarForceMount,
|
|
4274
|
+
orientation: "vertical"
|
|
4275
|
+
}
|
|
4276
|
+
),
|
|
4277
|
+
(orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ jsx15(
|
|
4278
|
+
ScrollBar,
|
|
4279
|
+
{
|
|
4280
|
+
className: scrollBarClassName,
|
|
4281
|
+
forceMount: scrollBarForceMount,
|
|
4282
|
+
orientation: "horizontal"
|
|
4283
|
+
}
|
|
4284
|
+
),
|
|
4285
|
+
/* @__PURE__ */ jsx15(ScrollAreaPrimitive.Corner, {})
|
|
4286
|
+
]
|
|
4287
|
+
}
|
|
4288
|
+
)
|
|
4289
|
+
);
|
|
4290
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
4291
|
+
var ScrollBar = React7.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx15(
|
|
4292
|
+
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4293
|
+
{
|
|
4294
|
+
ref,
|
|
4295
|
+
orientation,
|
|
4296
|
+
className: cn(
|
|
4297
|
+
"flex touch-none select-none transition-colors",
|
|
4298
|
+
orientation === "vertical" && "mr-1 h-full w-2",
|
|
4299
|
+
orientation === "horizontal" && "mb-1 h-2 w-full flex-col",
|
|
4300
|
+
className
|
|
4301
|
+
),
|
|
4302
|
+
...props,
|
|
4303
|
+
children: /* @__PURE__ */ jsx15(
|
|
4304
|
+
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4305
|
+
{
|
|
4306
|
+
className: cn("relative flex-1 rounded-full bg-zinc-400/70")
|
|
4307
|
+
}
|
|
4308
|
+
)
|
|
4309
|
+
}
|
|
4310
|
+
));
|
|
4311
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
4312
|
+
|
|
4313
|
+
// src/components/ui/tooltip.tsx
|
|
4314
|
+
import * as React8 from "react";
|
|
4287
4315
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4288
|
-
import { Fragment as Fragment2, jsx as
|
|
4316
|
+
import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4289
4317
|
var Tooltip = TooltipPrimitive.Root;
|
|
4290
4318
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4291
|
-
var TooltipContent =
|
|
4319
|
+
var TooltipContent = React8.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx16(TooltipPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx16(
|
|
4292
4320
|
TooltipPrimitive.Content,
|
|
4293
4321
|
{
|
|
4294
4322
|
ref,
|
|
@@ -4306,10 +4334,10 @@ var SimpleTooltip = ({
|
|
|
4306
4334
|
children,
|
|
4307
4335
|
variant = "default"
|
|
4308
4336
|
}) => {
|
|
4309
|
-
if (!content) return /* @__PURE__ */
|
|
4310
|
-
return /* @__PURE__ */
|
|
4311
|
-
/* @__PURE__ */
|
|
4312
|
-
/* @__PURE__ */
|
|
4337
|
+
if (!content) return /* @__PURE__ */ jsx16(Fragment2, { children });
|
|
4338
|
+
return /* @__PURE__ */ jsxs6(Tooltip, { delayDuration: 100, children: [
|
|
4339
|
+
/* @__PURE__ */ jsx16(TooltipTrigger, { asChild: true, children }),
|
|
4340
|
+
/* @__PURE__ */ jsx16(
|
|
4313
4341
|
TooltipContent,
|
|
4314
4342
|
{
|
|
4315
4343
|
side: "top",
|
|
@@ -4331,16 +4359,16 @@ import {
|
|
|
4331
4359
|
IconQuote,
|
|
4332
4360
|
IconSearch
|
|
4333
4361
|
} from "@tabler/icons-react";
|
|
4334
|
-
import { jsx as
|
|
4362
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
4335
4363
|
var iconsMap = {
|
|
4336
|
-
string: /* @__PURE__ */
|
|
4337
|
-
set: /* @__PURE__ */
|
|
4338
|
-
hash: /* @__PURE__ */
|
|
4339
|
-
json: /* @__PURE__ */
|
|
4340
|
-
zset: /* @__PURE__ */
|
|
4341
|
-
list: /* @__PURE__ */
|
|
4342
|
-
stream: /* @__PURE__ */
|
|
4343
|
-
search: /* @__PURE__ */
|
|
4364
|
+
string: /* @__PURE__ */ jsx17(IconQuote, { size: 15, stroke: 1.2 }),
|
|
4365
|
+
set: /* @__PURE__ */ jsx17(IconLayersIntersect, { size: 15, stroke: 1.2 }),
|
|
4366
|
+
hash: /* @__PURE__ */ jsx17(IconHash, { size: 15, stroke: 1.2 }),
|
|
4367
|
+
json: /* @__PURE__ */ jsx17(IconCodeDots, { size: 15, stroke: 1.2 }),
|
|
4368
|
+
zset: /* @__PURE__ */ jsx17(IconArrowsSort, { size: 15, stroke: 1.2 }),
|
|
4369
|
+
list: /* @__PURE__ */ jsx17(IconList, { size: 15, stroke: 1.2 }),
|
|
4370
|
+
stream: /* @__PURE__ */ jsx17(IconList, { size: 15, stroke: 1.2 }),
|
|
4371
|
+
search: /* @__PURE__ */ jsx17(IconSearch, { size: 15, stroke: 1.2 })
|
|
4344
4372
|
};
|
|
4345
4373
|
var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-center", {
|
|
4346
4374
|
variants: {
|
|
@@ -4366,18 +4394,18 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4366
4394
|
}
|
|
4367
4395
|
});
|
|
4368
4396
|
function TypeTag({ className, variant, type }) {
|
|
4369
|
-
const defaultIcon = /* @__PURE__ */
|
|
4397
|
+
const defaultIcon = /* @__PURE__ */ jsx17(IconQuestionMark, { size: 15, stroke: 1.2 });
|
|
4370
4398
|
const variantKey = variant && variant in iconsMap ? variant : "default";
|
|
4371
|
-
return /* @__PURE__ */
|
|
4399
|
+
return /* @__PURE__ */ jsx17("span", { className: cn(tagVariants({ variant: variantKey, type, className })), children: type === "icon" ? iconsMap[variant] ?? defaultIcon : DATA_TYPE_NAMES[variant] ?? variant ?? "Unknown" });
|
|
4372
4400
|
}
|
|
4373
4401
|
|
|
4374
4402
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
4375
4403
|
import bytes from "bytes";
|
|
4376
4404
|
|
|
4377
4405
|
// src/components/ui/skeleton.tsx
|
|
4378
|
-
import { jsx as
|
|
4406
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
4379
4407
|
function Skeleton({ className, ...props }) {
|
|
4380
|
-
return /* @__PURE__ */
|
|
4408
|
+
return /* @__PURE__ */ jsx18("div", { className: cn("animate-pulse rounded-md bg-zinc-900/10", className), ...props });
|
|
4381
4409
|
}
|
|
4382
4410
|
|
|
4383
4411
|
// src/components/databrowser/hooks/use-add-key.ts
|
|
@@ -4622,6 +4650,9 @@ var useDeleteKeyCache = () => {
|
|
|
4622
4650
|
queryClient.invalidateQueries({
|
|
4623
4651
|
queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, key]
|
|
4624
4652
|
});
|
|
4653
|
+
queryClient.invalidateQueries({
|
|
4654
|
+
queryKey: [FETCH_SEARCH_INDEXES_QUERY_KEY]
|
|
4655
|
+
});
|
|
4625
4656
|
if (isValuesSearchSelected && valuesSearch.index) {
|
|
4626
4657
|
queryClient.invalidateQueries({
|
|
4627
4658
|
queryKey: [FETCH_SEARCH_INDEX_QUERY_KEY, valuesSearch.index]
|
|
@@ -4748,12 +4779,12 @@ import { useEffect as useEffect4, useMemo as useMemo5, useState as useState4 } f
|
|
|
4748
4779
|
import { Controller, useForm } from "react-hook-form";
|
|
4749
4780
|
|
|
4750
4781
|
// src/components/ui/popover.tsx
|
|
4751
|
-
import * as
|
|
4782
|
+
import * as React9 from "react";
|
|
4752
4783
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4753
|
-
import { jsx as
|
|
4784
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
4754
4785
|
var Popover = PopoverPrimitive.Root;
|
|
4755
4786
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
4756
|
-
var PopoverContent =
|
|
4787
|
+
var PopoverContent = React9.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx19(PopoverPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx19(
|
|
4757
4788
|
PopoverPrimitive.Content,
|
|
4758
4789
|
{
|
|
4759
4790
|
ref,
|
|
@@ -4769,7 +4800,7 @@ var PopoverContent = React8.forwardRef(({ className, align = "center", sideOffse
|
|
|
4769
4800
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
4770
4801
|
|
|
4771
4802
|
// src/components/databrowser/components/display/ttl-popover.tsx
|
|
4772
|
-
import { jsx as
|
|
4803
|
+
import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4773
4804
|
var timeUnits = [
|
|
4774
4805
|
{ label: "Seconds", value: 1 },
|
|
4775
4806
|
{ label: "Minutes", value: 60 },
|
|
@@ -4802,7 +4833,7 @@ function TTLPopover({
|
|
|
4802
4833
|
await setTTL(TTL_INFINITE);
|
|
4803
4834
|
setOpen(false);
|
|
4804
4835
|
};
|
|
4805
|
-
return /* @__PURE__ */
|
|
4836
|
+
return /* @__PURE__ */ jsxs7(
|
|
4806
4837
|
Popover,
|
|
4807
4838
|
{
|
|
4808
4839
|
open,
|
|
@@ -4811,8 +4842,8 @@ function TTLPopover({
|
|
|
4811
4842
|
setOpen(isOpen);
|
|
4812
4843
|
},
|
|
4813
4844
|
children: [
|
|
4814
|
-
/* @__PURE__ */
|
|
4815
|
-
/* @__PURE__ */
|
|
4845
|
+
/* @__PURE__ */ jsx20(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx20("button", { children }) }),
|
|
4846
|
+
/* @__PURE__ */ jsx20(PopoverContent, { className: "w-[300px]", align: "end", children: /* @__PURE__ */ jsxs7(
|
|
4816
4847
|
"form",
|
|
4817
4848
|
{
|
|
4818
4849
|
className: "space-y-4",
|
|
@@ -4821,10 +4852,10 @@ function TTLPopover({
|
|
|
4821
4852
|
e.stopPropagation();
|
|
4822
4853
|
},
|
|
4823
4854
|
children: [
|
|
4824
|
-
/* @__PURE__ */
|
|
4825
|
-
/* @__PURE__ */
|
|
4826
|
-
/* @__PURE__ */
|
|
4827
|
-
/* @__PURE__ */
|
|
4855
|
+
/* @__PURE__ */ jsx20("h4", { className: "font-medium leading-none", children: "Expiration" }),
|
|
4856
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
4857
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
|
|
4858
|
+
/* @__PURE__ */ jsx20(
|
|
4828
4859
|
Controller,
|
|
4829
4860
|
{
|
|
4830
4861
|
rules: {
|
|
@@ -4833,26 +4864,26 @@ function TTLPopover({
|
|
|
4833
4864
|
},
|
|
4834
4865
|
control,
|
|
4835
4866
|
name: "value",
|
|
4836
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4867
|
+
render: ({ field }) => /* @__PURE__ */ jsx20(Input, { min: "-1", ...field, className: "grow rounded-r-none" })
|
|
4837
4868
|
}
|
|
4838
4869
|
),
|
|
4839
|
-
/* @__PURE__ */
|
|
4870
|
+
/* @__PURE__ */ jsx20(
|
|
4840
4871
|
Controller,
|
|
4841
4872
|
{
|
|
4842
4873
|
control,
|
|
4843
4874
|
name: "type",
|
|
4844
|
-
render: ({ field }) => /* @__PURE__ */
|
|
4845
|
-
/* @__PURE__ */
|
|
4846
|
-
/* @__PURE__ */
|
|
4875
|
+
render: ({ field }) => /* @__PURE__ */ jsxs7(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
4876
|
+
/* @__PURE__ */ jsx20(SelectTrigger, { className: "w-auto rounded-l-none border-l-0 pr-8", children: /* @__PURE__ */ jsx20(SelectValue, {}) }),
|
|
4877
|
+
/* @__PURE__ */ jsx20(SelectContent, { children: timeUnits.map((unit) => /* @__PURE__ */ jsx20(SelectItem, { value: unit.label, children: unit.label }, unit.label)) })
|
|
4847
4878
|
] })
|
|
4848
4879
|
}
|
|
4849
4880
|
)
|
|
4850
4881
|
] }),
|
|
4851
|
-
formState.errors.value && /* @__PURE__ */
|
|
4852
|
-
/* @__PURE__ */
|
|
4882
|
+
formState.errors.value && /* @__PURE__ */ jsx20("p", { className: "mt-2 text-xs text-red-500", children: formState.errors.value.message }),
|
|
4883
|
+
/* @__PURE__ */ jsx20("p", { className: "mt-2 text-xs text-zinc-500", children: "TTL sets a timer to automatically delete keys after a defined period." })
|
|
4853
4884
|
] }),
|
|
4854
|
-
/* @__PURE__ */
|
|
4855
|
-
/* @__PURE__ */
|
|
4885
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex justify-between", children: [
|
|
4886
|
+
/* @__PURE__ */ jsx20(
|
|
4856
4887
|
Button,
|
|
4857
4888
|
{
|
|
4858
4889
|
type: "button",
|
|
@@ -4862,9 +4893,9 @@ function TTLPopover({
|
|
|
4862
4893
|
children: "Persist"
|
|
4863
4894
|
}
|
|
4864
4895
|
),
|
|
4865
|
-
/* @__PURE__ */
|
|
4866
|
-
/* @__PURE__ */
|
|
4867
|
-
/* @__PURE__ */
|
|
4896
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex gap-2", children: [
|
|
4897
|
+
/* @__PURE__ */ jsx20(Button, { variant: "outline", onClick: () => setOpen(false), type: "button", children: "Cancel" }),
|
|
4898
|
+
/* @__PURE__ */ jsx20(Button, { variant: "primary", type: "submit", children: /* @__PURE__ */ jsx20(Spinner, { isLoading: isPending, isLoadingText: "Saving", children: "Save" }) })
|
|
4868
4899
|
] })
|
|
4869
4900
|
] })
|
|
4870
4901
|
]
|
|
@@ -4876,7 +4907,7 @@ function TTLPopover({
|
|
|
4876
4907
|
}
|
|
4877
4908
|
|
|
4878
4909
|
// src/components/databrowser/components/display/ttl-badge.tsx
|
|
4879
|
-
import { jsx as
|
|
4910
|
+
import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4880
4911
|
var TTL_INFINITE = -1;
|
|
4881
4912
|
var TTL_NOT_FOUND = -2;
|
|
4882
4913
|
var calculateTTL = (expireAt) => {
|
|
@@ -4898,9 +4929,9 @@ var TTLBadge = ({
|
|
|
4898
4929
|
}, 1e3);
|
|
4899
4930
|
return () => clearInterval(interval);
|
|
4900
4931
|
}, [expireAt]);
|
|
4901
|
-
return /* @__PURE__ */
|
|
4932
|
+
return /* @__PURE__ */ jsx21(Badge, { label, children: ttl === void 0 ? /* @__PURE__ */ jsx21(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : /* @__PURE__ */ jsx21(TTLPopover, { ttl, setTTL, isPending, children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-[2px]", children: [
|
|
4902
4933
|
ttl === TTL_INFINITE ? "No" : formatTime(ttl),
|
|
4903
|
-
/* @__PURE__ */
|
|
4934
|
+
/* @__PURE__ */ jsx21(IconChevronDown, { className: "shrink-0 text-zinc-400", size: 16 })
|
|
4904
4935
|
] }) }) });
|
|
4905
4936
|
};
|
|
4906
4937
|
|
|
@@ -5015,7 +5046,7 @@ var useFetchKeySize = (dataKey) => {
|
|
|
5015
5046
|
};
|
|
5016
5047
|
|
|
5017
5048
|
// src/components/databrowser/components/display/header-badges.tsx
|
|
5018
|
-
import { jsx as
|
|
5049
|
+
import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5019
5050
|
var LengthBadge = ({
|
|
5020
5051
|
dataKey,
|
|
5021
5052
|
type,
|
|
@@ -5023,18 +5054,18 @@ var LengthBadge = ({
|
|
|
5023
5054
|
}) => {
|
|
5024
5055
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
5025
5056
|
const length = content?.length ?? data;
|
|
5026
|
-
return /* @__PURE__ */
|
|
5057
|
+
return /* @__PURE__ */ jsx22(Badge, { label: "Length:", children: isLoading ? /* @__PURE__ */ jsx22(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : length });
|
|
5027
5058
|
};
|
|
5028
5059
|
var SizeBadge = ({ dataKey }) => {
|
|
5029
5060
|
const { data: size } = useFetchKeySize(dataKey);
|
|
5030
|
-
return /* @__PURE__ */
|
|
5061
|
+
return /* @__PURE__ */ jsx22(Badge, { label: "Size:", children: size === void 0 || size === null ? /* @__PURE__ */ jsx22(Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : bytes(size, {
|
|
5031
5062
|
unitSeparator: " "
|
|
5032
5063
|
}) });
|
|
5033
5064
|
};
|
|
5034
5065
|
var HeaderTTLBadge = ({ dataKey }) => {
|
|
5035
5066
|
const { data: expireAt } = useFetchTTL(dataKey);
|
|
5036
5067
|
const { mutate: setTTL, isPending } = useSetTTL();
|
|
5037
|
-
return /* @__PURE__ */
|
|
5068
|
+
return /* @__PURE__ */ jsx22(
|
|
5038
5069
|
TTLBadge,
|
|
5039
5070
|
{
|
|
5040
5071
|
expireAt,
|
|
@@ -5043,22 +5074,22 @@ var HeaderTTLBadge = ({ dataKey }) => {
|
|
|
5043
5074
|
}
|
|
5044
5075
|
);
|
|
5045
5076
|
};
|
|
5046
|
-
var Badge = ({ children, label }) => /* @__PURE__ */
|
|
5047
|
-
/* @__PURE__ */
|
|
5048
|
-
/* @__PURE__ */
|
|
5077
|
+
var Badge = ({ children, label }) => /* @__PURE__ */ jsxs9("div", { className: "flex h-[26px] items-center gap-0.5 whitespace-nowrap rounded-md bg-zinc-200 px-2 text-xs text-zinc-700 dark:bg-zinc-300", children: [
|
|
5078
|
+
/* @__PURE__ */ jsx22("span", { className: "text-zinc-500 dark:text-zinc-600", children: label }),
|
|
5079
|
+
/* @__PURE__ */ jsx22("span", { className: "font-medium", children })
|
|
5049
5080
|
] });
|
|
5050
5081
|
|
|
5051
5082
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
5052
5083
|
import { IconDotsVertical } from "@tabler/icons-react";
|
|
5053
5084
|
|
|
5054
5085
|
// src/components/ui/dropdown-menu.tsx
|
|
5055
|
-
import * as
|
|
5086
|
+
import * as React10 from "react";
|
|
5056
5087
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
5057
5088
|
import { IconCheck, IconChevronRight, IconCircleFilled } from "@tabler/icons-react";
|
|
5058
|
-
import { jsx as
|
|
5089
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5059
5090
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
5060
5091
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
5061
|
-
var DropdownMenuSubTrigger =
|
|
5092
|
+
var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs10(
|
|
5062
5093
|
DropdownMenuPrimitive.SubTrigger,
|
|
5063
5094
|
{
|
|
5064
5095
|
ref,
|
|
@@ -5070,12 +5101,12 @@ var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ..
|
|
|
5070
5101
|
...props,
|
|
5071
5102
|
children: [
|
|
5072
5103
|
children,
|
|
5073
|
-
/* @__PURE__ */
|
|
5104
|
+
/* @__PURE__ */ jsx23(IconChevronRight, { className: "ml-auto" })
|
|
5074
5105
|
]
|
|
5075
5106
|
}
|
|
5076
5107
|
));
|
|
5077
5108
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
5078
|
-
var DropdownMenuSubContent =
|
|
5109
|
+
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
5079
5110
|
DropdownMenuPrimitive.SubContent,
|
|
5080
5111
|
{
|
|
5081
5112
|
ref,
|
|
@@ -5087,7 +5118,7 @@ var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) =>
|
|
|
5087
5118
|
}
|
|
5088
5119
|
));
|
|
5089
5120
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
5090
|
-
var DropdownMenuContent =
|
|
5121
|
+
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx23(DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx23(
|
|
5091
5122
|
DropdownMenuPrimitive.Content,
|
|
5092
5123
|
{
|
|
5093
5124
|
ref,
|
|
@@ -5101,7 +5132,7 @@ var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...pro
|
|
|
5101
5132
|
}
|
|
5102
5133
|
) }));
|
|
5103
5134
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
5104
|
-
var DropdownMenuItem =
|
|
5135
|
+
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
5105
5136
|
DropdownMenuPrimitive.Item,
|
|
5106
5137
|
{
|
|
5107
5138
|
ref,
|
|
@@ -5114,7 +5145,7 @@ var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
5114
5145
|
}
|
|
5115
5146
|
));
|
|
5116
5147
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
5117
|
-
var DropdownMenuCheckboxItem =
|
|
5148
|
+
var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs10(
|
|
5118
5149
|
DropdownMenuPrimitive.CheckboxItem,
|
|
5119
5150
|
{
|
|
5120
5151
|
ref,
|
|
@@ -5125,13 +5156,13 @@ var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked
|
|
|
5125
5156
|
checked,
|
|
5126
5157
|
...props,
|
|
5127
5158
|
children: [
|
|
5128
|
-
/* @__PURE__ */
|
|
5159
|
+
/* @__PURE__ */ jsx23("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx23(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx23(IconCheck, { className: "h-4 w-4" }) }) }),
|
|
5129
5160
|
children
|
|
5130
5161
|
]
|
|
5131
5162
|
}
|
|
5132
5163
|
));
|
|
5133
5164
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
5134
|
-
var DropdownMenuRadioItem =
|
|
5165
|
+
var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs10(
|
|
5135
5166
|
DropdownMenuPrimitive.RadioItem,
|
|
5136
5167
|
{
|
|
5137
5168
|
ref,
|
|
@@ -5141,13 +5172,13 @@ var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }
|
|
|
5141
5172
|
),
|
|
5142
5173
|
...props,
|
|
5143
5174
|
children: [
|
|
5144
|
-
/* @__PURE__ */
|
|
5175
|
+
/* @__PURE__ */ jsx23("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx23(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx23(IconCircleFilled, { className: "h-2 w-2" }) }) }),
|
|
5145
5176
|
children
|
|
5146
5177
|
]
|
|
5147
5178
|
}
|
|
5148
5179
|
));
|
|
5149
5180
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
5150
|
-
var DropdownMenuLabel =
|
|
5181
|
+
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
5151
5182
|
DropdownMenuPrimitive.Label,
|
|
5152
5183
|
{
|
|
5153
5184
|
ref,
|
|
@@ -5156,7 +5187,7 @@ var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref)
|
|
|
5156
5187
|
}
|
|
5157
5188
|
));
|
|
5158
5189
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
5159
|
-
var DropdownMenuSeparator =
|
|
5190
|
+
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
5160
5191
|
DropdownMenuPrimitive.Separator,
|
|
5161
5192
|
{
|
|
5162
5193
|
ref,
|
|
@@ -5166,7 +5197,7 @@ var DropdownMenuSeparator = React9.forwardRef(({ className, ...props }, ref) =>
|
|
|
5166
5197
|
));
|
|
5167
5198
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
5168
5199
|
var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
5169
|
-
return /* @__PURE__ */
|
|
5200
|
+
return /* @__PURE__ */ jsx23("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props });
|
|
5170
5201
|
};
|
|
5171
5202
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
5172
5203
|
|
|
@@ -5174,14 +5205,14 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
5174
5205
|
import { useState as useState6 } from "react";
|
|
5175
5206
|
|
|
5176
5207
|
// src/components/ui/dialog.tsx
|
|
5177
|
-
import * as
|
|
5208
|
+
import * as React11 from "react";
|
|
5178
5209
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5179
|
-
import { jsx as
|
|
5210
|
+
import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5180
5211
|
var Dialog = DialogPrimitive.Root;
|
|
5181
5212
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
5182
|
-
var DialogPortal = (props) => /* @__PURE__ */
|
|
5213
|
+
var DialogPortal = (props) => /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { container: portalRoot, ...props });
|
|
5183
5214
|
DialogPortal.displayName = DialogPrimitive.Portal.displayName;
|
|
5184
|
-
var DialogOverlay =
|
|
5215
|
+
var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
5185
5216
|
DialogPrimitive.Overlay,
|
|
5186
5217
|
{
|
|
5187
5218
|
ref,
|
|
@@ -5195,9 +5226,9 @@ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
5195
5226
|
}
|
|
5196
5227
|
));
|
|
5197
5228
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
5198
|
-
var DialogContent =
|
|
5199
|
-
/* @__PURE__ */
|
|
5200
|
-
/* @__PURE__ */
|
|
5229
|
+
var DialogContent = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs11(DialogPortal, { children: [
|
|
5230
|
+
/* @__PURE__ */ jsx24(DialogOverlay, {}),
|
|
5231
|
+
/* @__PURE__ */ jsxs11(
|
|
5201
5232
|
DialogPrimitive.Content,
|
|
5202
5233
|
{
|
|
5203
5234
|
ref,
|
|
@@ -5217,8 +5248,8 @@ var DialogContent = React10.forwardRef(({ className, children, ...props }, ref)
|
|
|
5217
5248
|
...props,
|
|
5218
5249
|
children: [
|
|
5219
5250
|
children,
|
|
5220
|
-
/* @__PURE__ */
|
|
5221
|
-
/* @__PURE__ */
|
|
5251
|
+
/* @__PURE__ */ jsxs11(DialogPrimitive.Close, { className: "absolute right-4 top-4 text-zinc-400 transition-colors hover:text-zinc-600 focus:outline-none disabled:pointer-events-none", children: [
|
|
5252
|
+
/* @__PURE__ */ jsx24(
|
|
5222
5253
|
"svg",
|
|
5223
5254
|
{
|
|
5224
5255
|
width: "20",
|
|
@@ -5227,7 +5258,7 @@ var DialogContent = React10.forwardRef(({ className, children, ...props }, ref)
|
|
|
5227
5258
|
fill: "none",
|
|
5228
5259
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5229
5260
|
className: "size-5",
|
|
5230
|
-
children: /* @__PURE__ */
|
|
5261
|
+
children: /* @__PURE__ */ jsx24(
|
|
5231
5262
|
"path",
|
|
5232
5263
|
{
|
|
5233
5264
|
d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",
|
|
@@ -5238,16 +5269,16 @@ var DialogContent = React10.forwardRef(({ className, children, ...props }, ref)
|
|
|
5238
5269
|
)
|
|
5239
5270
|
}
|
|
5240
5271
|
),
|
|
5241
|
-
/* @__PURE__ */
|
|
5272
|
+
/* @__PURE__ */ jsx24("span", { className: "sr-only", children: "Close" })
|
|
5242
5273
|
] })
|
|
5243
5274
|
]
|
|
5244
5275
|
}
|
|
5245
5276
|
)
|
|
5246
5277
|
] }));
|
|
5247
5278
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
5248
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
5279
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
5249
5280
|
DialogHeader.displayName = "DialogHeader";
|
|
5250
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
5281
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx24(
|
|
5251
5282
|
"div",
|
|
5252
5283
|
{
|
|
5253
5284
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
@@ -5255,7 +5286,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx23(
|
|
|
5255
5286
|
}
|
|
5256
5287
|
);
|
|
5257
5288
|
DialogFooter.displayName = "DialogFooter";
|
|
5258
|
-
var DialogTitle =
|
|
5289
|
+
var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
5259
5290
|
DialogPrimitive.Title,
|
|
5260
5291
|
{
|
|
5261
5292
|
ref,
|
|
@@ -5264,7 +5295,7 @@ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5264
5295
|
}
|
|
5265
5296
|
));
|
|
5266
5297
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5267
|
-
var DialogDescription =
|
|
5298
|
+
var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
|
|
5268
5299
|
DialogPrimitive.Description,
|
|
5269
5300
|
{
|
|
5270
5301
|
ref,
|
|
@@ -5275,10 +5306,10 @@ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5275
5306
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
5276
5307
|
|
|
5277
5308
|
// src/components/ui/switch.tsx
|
|
5278
|
-
import * as
|
|
5309
|
+
import * as React12 from "react";
|
|
5279
5310
|
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
5280
|
-
import { jsx as
|
|
5281
|
-
var Switch =
|
|
5311
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
5312
|
+
var Switch = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
|
|
5282
5313
|
SwitchPrimitives.Root,
|
|
5283
5314
|
{
|
|
5284
5315
|
className: cn(
|
|
@@ -5287,7 +5318,7 @@ var Switch = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5287
5318
|
),
|
|
5288
5319
|
...props,
|
|
5289
5320
|
ref,
|
|
5290
|
-
children: /* @__PURE__ */
|
|
5321
|
+
children: /* @__PURE__ */ jsx25(
|
|
5291
5322
|
SwitchPrimitives.Thumb,
|
|
5292
5323
|
{
|
|
5293
5324
|
className: cn(
|
|
@@ -5300,7 +5331,7 @@ var Switch = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
5300
5331
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
5301
5332
|
|
|
5302
5333
|
// src/components/databrowser/components/delete-key-modal.tsx
|
|
5303
|
-
import { jsx as
|
|
5334
|
+
import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5304
5335
|
function DeleteKeyModal({
|
|
5305
5336
|
children,
|
|
5306
5337
|
onDeleteConfirm,
|
|
@@ -5313,24 +5344,28 @@ function DeleteKeyModal({
|
|
|
5313
5344
|
const isPlural = count2 > 1;
|
|
5314
5345
|
const itemLabel = deletionType === "item" ? "Item" : "Key";
|
|
5315
5346
|
const itemsLabel = deletionType === "item" ? "Items" : "Keys";
|
|
5347
|
+
const [internalOpen, setInternalOpen] = useState6(false);
|
|
5316
5348
|
const [reindex, setReindex] = useState6(true);
|
|
5317
5349
|
const [isPending, setIsPending] = useState6(false);
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5350
|
+
const isControlled = open !== void 0;
|
|
5351
|
+
const isOpen = isControlled ? open : internalOpen;
|
|
5352
|
+
const setIsOpen = isControlled ? onOpenChange : setInternalOpen;
|
|
5353
|
+
return /* @__PURE__ */ jsxs12(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
5354
|
+
children && /* @__PURE__ */ jsx26(DialogTrigger, { asChild: true, children }),
|
|
5355
|
+
/* @__PURE__ */ jsxs12(DialogContent, { children: [
|
|
5356
|
+
/* @__PURE__ */ jsxs12(DialogHeader, { children: [
|
|
5357
|
+
/* @__PURE__ */ jsx26(DialogTitle, { children: isPlural ? `Delete ${count2} ${itemsLabel}` : `Delete ${itemLabel}` }),
|
|
5358
|
+
/* @__PURE__ */ jsxs12(DialogDescription, { className: "mt-5", children: [
|
|
5324
5359
|
"Are you sure you want to delete",
|
|
5325
5360
|
" ",
|
|
5326
5361
|
isPlural ? `these ${count2} ${deletionType}s` : `this ${deletionType}`,
|
|
5327
5362
|
"?",
|
|
5328
|
-
/* @__PURE__ */
|
|
5363
|
+
/* @__PURE__ */ jsx26("br", {}),
|
|
5329
5364
|
"This action cannot be undone."
|
|
5330
5365
|
] })
|
|
5331
5366
|
] }),
|
|
5332
|
-
showReindex && /* @__PURE__ */
|
|
5333
|
-
/* @__PURE__ */
|
|
5367
|
+
showReindex && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
5368
|
+
/* @__PURE__ */ jsx26(
|
|
5334
5369
|
Switch,
|
|
5335
5370
|
{
|
|
5336
5371
|
id: "reindex",
|
|
@@ -5339,20 +5374,20 @@ function DeleteKeyModal({
|
|
|
5339
5374
|
disabled: isPending
|
|
5340
5375
|
}
|
|
5341
5376
|
),
|
|
5342
|
-
/* @__PURE__ */
|
|
5377
|
+
/* @__PURE__ */ jsx26(Label, { htmlFor: "reindex", className: "cursor-pointer text-sm text-zinc-700", children: "Reindex after deletion" })
|
|
5343
5378
|
] }),
|
|
5344
|
-
/* @__PURE__ */
|
|
5345
|
-
/* @__PURE__ */
|
|
5379
|
+
/* @__PURE__ */ jsxs12(DialogFooter, { children: [
|
|
5380
|
+
/* @__PURE__ */ jsx26(
|
|
5346
5381
|
Button,
|
|
5347
5382
|
{
|
|
5348
5383
|
type: "button",
|
|
5349
5384
|
variant: "outline",
|
|
5350
5385
|
disabled: isPending,
|
|
5351
|
-
onClick: () =>
|
|
5386
|
+
onClick: () => setIsOpen?.(false),
|
|
5352
5387
|
children: "Cancel"
|
|
5353
5388
|
}
|
|
5354
5389
|
),
|
|
5355
|
-
/* @__PURE__ */
|
|
5390
|
+
/* @__PURE__ */ jsx26(
|
|
5356
5391
|
Button,
|
|
5357
5392
|
{
|
|
5358
5393
|
variant: "primary",
|
|
@@ -5366,7 +5401,7 @@ function DeleteKeyModal({
|
|
|
5366
5401
|
setIsPending(false);
|
|
5367
5402
|
}
|
|
5368
5403
|
},
|
|
5369
|
-
children: /* @__PURE__ */
|
|
5404
|
+
children: /* @__PURE__ */ jsx26(Spinner, { isLoading: isPending, isLoadingText: "Deleting", children: "Yes, Delete" })
|
|
5370
5405
|
}
|
|
5371
5406
|
)
|
|
5372
5407
|
] })
|
|
@@ -5375,7 +5410,7 @@ function DeleteKeyModal({
|
|
|
5375
5410
|
}
|
|
5376
5411
|
|
|
5377
5412
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
5378
|
-
import { jsx as
|
|
5413
|
+
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5379
5414
|
function KeyActions({
|
|
5380
5415
|
dataKey,
|
|
5381
5416
|
content,
|
|
@@ -5383,16 +5418,16 @@ function KeyActions({
|
|
|
5383
5418
|
}) {
|
|
5384
5419
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
5385
5420
|
const { isValuesSearchSelected } = useTab();
|
|
5386
|
-
return /* @__PURE__ */
|
|
5387
|
-
/* @__PURE__ */
|
|
5421
|
+
return /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
|
|
5422
|
+
/* @__PURE__ */ jsx27(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ jsx27(
|
|
5388
5423
|
IconDotsVertical,
|
|
5389
5424
|
{
|
|
5390
5425
|
className: "size-4 text-zinc-500 dark:text-zinc-600",
|
|
5391
5426
|
fill: "rgb(var(--color-zinc-500))"
|
|
5392
5427
|
}
|
|
5393
5428
|
) }) }),
|
|
5394
|
-
/* @__PURE__ */
|
|
5395
|
-
content && /* @__PURE__ */
|
|
5429
|
+
/* @__PURE__ */ jsxs13(DropdownMenuContent, { className: "", align: "end", children: [
|
|
5430
|
+
content && /* @__PURE__ */ jsx27(
|
|
5396
5431
|
DropdownMenuItem,
|
|
5397
5432
|
{
|
|
5398
5433
|
onClick: () => {
|
|
@@ -5404,7 +5439,7 @@ function KeyActions({
|
|
|
5404
5439
|
children: "Copy content"
|
|
5405
5440
|
}
|
|
5406
5441
|
),
|
|
5407
|
-
/* @__PURE__ */
|
|
5442
|
+
/* @__PURE__ */ jsx27(
|
|
5408
5443
|
DropdownMenuItem,
|
|
5409
5444
|
{
|
|
5410
5445
|
onClick: () => {
|
|
@@ -5413,7 +5448,7 @@ function KeyActions({
|
|
|
5413
5448
|
children: "Copy key"
|
|
5414
5449
|
}
|
|
5415
5450
|
),
|
|
5416
|
-
/* @__PURE__ */
|
|
5451
|
+
/* @__PURE__ */ jsx27(
|
|
5417
5452
|
DeleteKeyModal,
|
|
5418
5453
|
{
|
|
5419
5454
|
deletionType: "key",
|
|
@@ -5421,7 +5456,7 @@ function KeyActions({
|
|
|
5421
5456
|
onDeleteConfirm: async (_e, options) => {
|
|
5422
5457
|
await deleteKey({ keys: [dataKey], reindex: options?.reindex });
|
|
5423
5458
|
},
|
|
5424
|
-
children: /* @__PURE__ */
|
|
5459
|
+
children: /* @__PURE__ */ jsx27(
|
|
5425
5460
|
DropdownMenuItem,
|
|
5426
5461
|
{
|
|
5427
5462
|
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
@@ -5436,7 +5471,7 @@ function KeyActions({
|
|
|
5436
5471
|
}
|
|
5437
5472
|
|
|
5438
5473
|
// src/components/databrowser/components/display/display-header.tsx
|
|
5439
|
-
import { jsx as
|
|
5474
|
+
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5440
5475
|
var DisplayHeader = ({
|
|
5441
5476
|
dataKey,
|
|
5442
5477
|
type,
|
|
@@ -5447,34 +5482,34 @@ var DisplayHeader = ({
|
|
|
5447
5482
|
const handleAddItem = () => {
|
|
5448
5483
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
5449
5484
|
};
|
|
5450
|
-
return /* @__PURE__ */
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
type !== "string" && type !== "json" && type !== "search" && /* @__PURE__ */
|
|
5455
|
-
/* @__PURE__ */
|
|
5485
|
+
return /* @__PURE__ */ jsxs14("div", { className: "rounded-lg", children: [
|
|
5486
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex h-[26px] items-center justify-between gap-4", children: [
|
|
5487
|
+
/* @__PURE__ */ jsx28("h2", { className: "grow truncate text-sm", children: dataKey.trim() === "" ? /* @__PURE__ */ jsx28("span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ jsx28("span", { className: "font-medium text-zinc-950", children: dataKey }) }),
|
|
5488
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
|
|
5489
|
+
type !== "string" && type !== "json" && type !== "search" && /* @__PURE__ */ jsx28(SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ jsx28(Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ jsx28(IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
5490
|
+
/* @__PURE__ */ jsx28(KeyActions, { dataKey, content, type })
|
|
5456
5491
|
] })
|
|
5457
5492
|
] }),
|
|
5458
|
-
type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */
|
|
5459
|
-
!hideTypeTag && /* @__PURE__ */
|
|
5460
|
-
type !== "search" && /* @__PURE__ */
|
|
5461
|
-
type !== "search" && /* @__PURE__ */
|
|
5462
|
-
type !== "search" && /* @__PURE__ */
|
|
5463
|
-
] })
|
|
5493
|
+
type === "search" && hideTypeTag ? void 0 : /* @__PURE__ */ jsx28(ScrollArea, { orientation: "horizontal", className: "w-full whitespace-nowrap", children: /* @__PURE__ */ jsxs14("div", { className: "flex w-max items-center gap-1.5 pb-2 pt-1", children: [
|
|
5494
|
+
!hideTypeTag && /* @__PURE__ */ jsx28(TypeTag, { variant: type, type: "badge" }),
|
|
5495
|
+
type !== "search" && /* @__PURE__ */ jsx28(SizeBadge, { dataKey }),
|
|
5496
|
+
type !== "search" && /* @__PURE__ */ jsx28(LengthBadge, { dataKey, type, content }),
|
|
5497
|
+
type !== "search" && /* @__PURE__ */ jsx28(HeaderTTLBadge, { dataKey })
|
|
5498
|
+
] }) })
|
|
5464
5499
|
] });
|
|
5465
5500
|
};
|
|
5466
5501
|
|
|
5467
5502
|
// src/components/databrowser/components/display/key-deleted.tsx
|
|
5468
|
-
import { jsx as
|
|
5503
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
5469
5504
|
var KeyDeleted = () => {
|
|
5470
|
-
return /* @__PURE__ */
|
|
5505
|
+
return /* @__PURE__ */ jsx29("div", { className: "flex h-full items-center justify-center rounded-md border border-dashed border-zinc-300", children: /* @__PURE__ */ jsx29("span", { className: "text-zinc-500", children: "This key has been deleted" }) });
|
|
5471
5506
|
};
|
|
5472
5507
|
|
|
5473
5508
|
// src/components/databrowser/components/docs-link.tsx
|
|
5474
5509
|
import { IconExternalLink } from "@tabler/icons-react";
|
|
5475
|
-
import { jsx as
|
|
5510
|
+
import { jsx as jsx30, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5476
5511
|
var DocsLink = ({ href, className }) => {
|
|
5477
|
-
return /* @__PURE__ */
|
|
5512
|
+
return /* @__PURE__ */ jsxs15(
|
|
5478
5513
|
"a",
|
|
5479
5514
|
{
|
|
5480
5515
|
href,
|
|
@@ -5486,7 +5521,7 @@ var DocsLink = ({ href, className }) => {
|
|
|
5486
5521
|
),
|
|
5487
5522
|
children: [
|
|
5488
5523
|
"Docs",
|
|
5489
|
-
/* @__PURE__ */
|
|
5524
|
+
/* @__PURE__ */ jsx30(IconExternalLink, { size: 12 })
|
|
5490
5525
|
]
|
|
5491
5526
|
}
|
|
5492
5527
|
);
|
|
@@ -5496,10 +5531,10 @@ var DocsLink = ({ href, className }) => {
|
|
|
5496
5531
|
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
5497
5532
|
|
|
5498
5533
|
// src/components/ui/progress.tsx
|
|
5499
|
-
import * as
|
|
5534
|
+
import * as React13 from "react";
|
|
5500
5535
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
5501
|
-
import { jsx as
|
|
5502
|
-
var Progress =
|
|
5536
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5537
|
+
var Progress = React13.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx31(
|
|
5503
5538
|
ProgressPrimitive.Root,
|
|
5504
5539
|
{
|
|
5505
5540
|
ref,
|
|
@@ -5508,7 +5543,7 @@ var Progress = React12.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
5508
5543
|
className
|
|
5509
5544
|
),
|
|
5510
5545
|
...props,
|
|
5511
|
-
children: /* @__PURE__ */
|
|
5546
|
+
children: /* @__PURE__ */ jsx31(
|
|
5512
5547
|
ProgressPrimitive.Indicator,
|
|
5513
5548
|
{
|
|
5514
5549
|
className: "h-full w-full flex-1 bg-neutral-900 transition-all dark:bg-neutral-50",
|
|
@@ -5520,7 +5555,7 @@ var Progress = React12.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
5520
5555
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
5521
5556
|
|
|
5522
5557
|
// src/components/databrowser/components/search/save-schema-modal.tsx
|
|
5523
|
-
import { Fragment as Fragment3, jsx as
|
|
5558
|
+
import { Fragment as Fragment3, jsx as jsx32, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5524
5559
|
var SaveSchemaModal = ({
|
|
5525
5560
|
values,
|
|
5526
5561
|
onClose
|
|
@@ -5576,14 +5611,14 @@ var SaveSchemaModal = ({
|
|
|
5576
5611
|
}
|
|
5577
5612
|
};
|
|
5578
5613
|
const isRunning = status !== void 0;
|
|
5579
|
-
return /* @__PURE__ */
|
|
5614
|
+
return /* @__PURE__ */ jsx32(
|
|
5580
5615
|
Dialog,
|
|
5581
5616
|
{
|
|
5582
5617
|
open: values !== void 0,
|
|
5583
5618
|
onOpenChange: (open) => {
|
|
5584
5619
|
if (!open && !isRunning) onClose();
|
|
5585
5620
|
},
|
|
5586
|
-
children: /* @__PURE__ */
|
|
5621
|
+
children: /* @__PURE__ */ jsxs16(
|
|
5587
5622
|
DialogContent,
|
|
5588
5623
|
{
|
|
5589
5624
|
onInteractOutside: (e) => {
|
|
@@ -5593,26 +5628,26 @@ var SaveSchemaModal = ({
|
|
|
5593
5628
|
if (isRunning) e.preventDefault();
|
|
5594
5629
|
},
|
|
5595
5630
|
children: [
|
|
5596
|
-
/* @__PURE__ */
|
|
5597
|
-
/* @__PURE__ */
|
|
5598
|
-
!isRunning && !error && /* @__PURE__ */
|
|
5631
|
+
/* @__PURE__ */ jsxs16(DialogHeader, { children: [
|
|
5632
|
+
/* @__PURE__ */ jsx32(DialogTitle, { children: "Save Schema Changes" }),
|
|
5633
|
+
!isRunning && !error && /* @__PURE__ */ jsxs16(DialogDescription, { children: [
|
|
5599
5634
|
"Saving will drop and recreate the index. This will temporarily make the index unavailable.",
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
/* @__PURE__ */
|
|
5635
|
+
/* @__PURE__ */ jsx32("br", {}),
|
|
5636
|
+
/* @__PURE__ */ jsx32("br", {}),
|
|
5602
5637
|
"Are you sure you want to continue?"
|
|
5603
5638
|
] })
|
|
5604
5639
|
] }),
|
|
5605
|
-
isRunning && /* @__PURE__ */
|
|
5606
|
-
/* @__PURE__ */
|
|
5607
|
-
/* @__PURE__ */
|
|
5640
|
+
isRunning && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2 py-4", children: [
|
|
5641
|
+
/* @__PURE__ */ jsx32("p", { className: "text-sm text-zinc-500", children: status }),
|
|
5642
|
+
/* @__PURE__ */ jsx32(Progress, { value: progress })
|
|
5608
5643
|
] }),
|
|
5609
|
-
error && /* @__PURE__ */
|
|
5610
|
-
/* @__PURE__ */
|
|
5611
|
-
!isRunning && !error && /* @__PURE__ */
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5644
|
+
error && /* @__PURE__ */ jsx32("div", { className: "w-full break-words text-sm text-red-500", children: formatUpstashErrorMessage(error) }),
|
|
5645
|
+
/* @__PURE__ */ jsxs16(DialogFooter, { children: [
|
|
5646
|
+
!isRunning && !error && /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
5647
|
+
/* @__PURE__ */ jsx32(Button, { onClick: onClose, children: "Cancel" }),
|
|
5648
|
+
/* @__PURE__ */ jsx32(Button, { variant: "primary", onClick: handleConfirm, children: "Confirm" })
|
|
5614
5649
|
] }),
|
|
5615
|
-
error && /* @__PURE__ */
|
|
5650
|
+
error && /* @__PURE__ */ jsx32(Button, { onClick: onClose, children: "Close" })
|
|
5616
5651
|
] })
|
|
5617
5652
|
]
|
|
5618
5653
|
}
|
|
@@ -5627,11 +5662,11 @@ import { useMemo as useMemo6 } from "react";
|
|
|
5627
5662
|
// src/components/common/editor-with-types.tsx
|
|
5628
5663
|
import { useEffect as useEffect8, useRef as useRef2 } from "react";
|
|
5629
5664
|
import { Editor, useMonaco } from "@monaco-editor/react";
|
|
5630
|
-
import { jsx as
|
|
5665
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5631
5666
|
var EditorWithTypes = (props) => {
|
|
5632
|
-
return isTest ? /* @__PURE__ */
|
|
5667
|
+
return isTest ? /* @__PURE__ */ jsx33(TestEditor, { ...props }) : /* @__PURE__ */ jsx33(MonacoEditorWithTypes, { ...props });
|
|
5633
5668
|
};
|
|
5634
|
-
var LoadingSpinner = () => /* @__PURE__ */
|
|
5669
|
+
var LoadingSpinner = () => /* @__PURE__ */ jsx33("div", { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsx33("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600" }) });
|
|
5635
5670
|
var MonacoEditorWithTypes = ({
|
|
5636
5671
|
value,
|
|
5637
5672
|
onChange,
|
|
@@ -5684,16 +5719,16 @@ var MonacoEditorWithTypes = ({
|
|
|
5684
5719
|
useEffect8(() => {
|
|
5685
5720
|
if (!validateValue(value)) onChange(defaultValue);
|
|
5686
5721
|
}, [value, onChange, validateValue, defaultValue]);
|
|
5687
|
-
return /* @__PURE__ */
|
|
5722
|
+
return /* @__PURE__ */ jsx33(
|
|
5688
5723
|
"div",
|
|
5689
5724
|
{
|
|
5690
5725
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5691
5726
|
style: { height },
|
|
5692
|
-
children: /* @__PURE__ */
|
|
5727
|
+
children: /* @__PURE__ */ jsx33(
|
|
5693
5728
|
Editor,
|
|
5694
5729
|
{
|
|
5695
5730
|
theme: theme === "dark" ? "vs-dark" : "light",
|
|
5696
|
-
loading: /* @__PURE__ */
|
|
5731
|
+
loading: /* @__PURE__ */ jsx33(LoadingSpinner, {}),
|
|
5697
5732
|
beforeMount: handleBeforeMount,
|
|
5698
5733
|
onMount: (editor) => {
|
|
5699
5734
|
editorRef.current = editor;
|
|
@@ -5784,12 +5819,12 @@ var handleBeforeMount = (monaco) => {
|
|
|
5784
5819
|
monaco.languages.typescript.typescriptDefaults.setEagerModelSync(true);
|
|
5785
5820
|
};
|
|
5786
5821
|
var TestEditor = ({ value, onChange, height, testLabel }) => {
|
|
5787
|
-
return /* @__PURE__ */
|
|
5822
|
+
return /* @__PURE__ */ jsx33(
|
|
5788
5823
|
"div",
|
|
5789
5824
|
{
|
|
5790
5825
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5791
5826
|
style: { height },
|
|
5792
|
-
children: /* @__PURE__ */
|
|
5827
|
+
children: /* @__PURE__ */ jsx33(
|
|
5793
5828
|
"textarea",
|
|
5794
5829
|
{
|
|
5795
5830
|
"aria-label": testLabel,
|
|
@@ -5820,7 +5855,7 @@ type TextFieldBuild<TNoTokenize extends Record<"noTokenize", boolean>, TNoStem e
|
|
|
5820
5855
|
} : {}) : TFrom["from"] extends string ? {
|
|
5821
5856
|
type: "TEXT";
|
|
5822
5857
|
from: TFrom["from"];
|
|
5823
|
-
} : "TEXT";
|
|
5858
|
+
} : { type: "TEXT" };
|
|
5824
5859
|
declare const BUILD: unique symbol;
|
|
5825
5860
|
declare class TextFieldBuilder<TNoTokenize extends Record<"noTokenize", boolean> = {
|
|
5826
5861
|
noTokenize: false;
|
|
@@ -5888,7 +5923,7 @@ declare class BoolFieldBuilder<Fast extends Record<"fast", boolean> = {
|
|
|
5888
5923
|
} : TFrom["from"] extends string ? {
|
|
5889
5924
|
type: "BOOL";
|
|
5890
5925
|
from: TFrom["from"];
|
|
5891
|
-
} : "BOOL";
|
|
5926
|
+
} : { type: "BOOL" };
|
|
5892
5927
|
}
|
|
5893
5928
|
declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
|
|
5894
5929
|
fast: false;
|
|
@@ -5916,7 +5951,13 @@ declare class DateFieldBuilder<Fast extends Record<"fast", boolean> = {
|
|
|
5916
5951
|
} : TFrom["from"] extends string ? {
|
|
5917
5952
|
type: "DATE";
|
|
5918
5953
|
from: TFrom["from"];
|
|
5919
|
-
} : "DATE";
|
|
5954
|
+
} : { type: "DATE" };
|
|
5955
|
+
}
|
|
5956
|
+
declare class KeywordFieldBuilder {
|
|
5957
|
+
[BUILD](): { type: "KEYWORD" };
|
|
5958
|
+
}
|
|
5959
|
+
declare class FacetFieldBuilder {
|
|
5960
|
+
[BUILD](): { type: "FACET" };
|
|
5920
5961
|
}
|
|
5921
5962
|
type FieldBuilder = TextFieldBuilder<{
|
|
5922
5963
|
noTokenize: boolean;
|
|
@@ -5934,12 +5975,14 @@ type FieldBuilder = TextFieldBuilder<{
|
|
|
5934
5975
|
fast: boolean;
|
|
5935
5976
|
}, {
|
|
5936
5977
|
from: string | null;
|
|
5937
|
-
}
|
|
5978
|
+
}> | KeywordFieldBuilder | FacetFieldBuilder;
|
|
5938
5979
|
declare const s: {
|
|
5939
5980
|
string(): TextFieldBuilder;
|
|
5940
5981
|
number<T extends NumericField["type"] = "F64">(type?: T): NumericFieldBuilder<T>;
|
|
5941
5982
|
boolean(): BoolFieldBuilder;
|
|
5942
5983
|
date(): DateFieldBuilder;
|
|
5984
|
+
keyword(): KeywordFieldBuilder;
|
|
5985
|
+
facet(): FacetFieldBuilder;
|
|
5943
5986
|
object<T extends ObjectFieldRecord<T>>(fields: T): { [K in keyof T]: T[K] extends FieldBuilder ? ReturnType<T[K][typeof BUILD]> : T[K]; };
|
|
5944
5987
|
};
|
|
5945
5988
|
type ObjectFieldRecord<T> = {
|
|
@@ -5957,7 +6000,7 @@ type Schema = NestedIndexSchema | FlatIndexSchema;
|
|
|
5957
6000
|
};
|
|
5958
6001
|
|
|
5959
6002
|
// src/components/databrowser/components/search/schema-editor.tsx
|
|
5960
|
-
import { jsx as
|
|
6003
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5961
6004
|
var SCHEMA_PREFIX = "const schema: Schema = s.object({";
|
|
5962
6005
|
var SCHEMA_SUFFIX = "})";
|
|
5963
6006
|
var SCHEMA_DEFAULT = "const schema: Schema = s.object({\n name: s.string(),\n})";
|
|
@@ -5966,7 +6009,7 @@ var isSchemaStringValid = (value) => {
|
|
|
5966
6009
|
};
|
|
5967
6010
|
var SchemaEditor = ({ value, onChange, height }) => {
|
|
5968
6011
|
const typeDefinitions = useMemo6(() => generateSchemaTypeDefinitions(), []);
|
|
5969
|
-
return /* @__PURE__ */
|
|
6012
|
+
return /* @__PURE__ */ jsx34(
|
|
5970
6013
|
EditorWithTypes,
|
|
5971
6014
|
{
|
|
5972
6015
|
value,
|
|
@@ -5982,8 +6025,125 @@ var SchemaEditor = ({ value, onChange, height }) => {
|
|
|
5982
6025
|
);
|
|
5983
6026
|
};
|
|
5984
6027
|
|
|
6028
|
+
// src/components/databrowser/components/search/schema-stringify.ts
|
|
6029
|
+
function schemaToEditorValue(flatSchema) {
|
|
6030
|
+
const nested = unflattenSchema(flatSchema);
|
|
6031
|
+
const body = renderObject(nested, 1);
|
|
6032
|
+
return `const schema: Schema = s.object({
|
|
6033
|
+
${body}})`;
|
|
6034
|
+
}
|
|
6035
|
+
function unflattenSchema(flat) {
|
|
6036
|
+
const result = {};
|
|
6037
|
+
for (const [key, value] of Object.entries(flat)) {
|
|
6038
|
+
const parts = key.split(".");
|
|
6039
|
+
let current = result;
|
|
6040
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
6041
|
+
const part = parts[i];
|
|
6042
|
+
if (!current[part] || typeof current[part] !== "object") {
|
|
6043
|
+
current[part] = {};
|
|
6044
|
+
}
|
|
6045
|
+
current = current[part];
|
|
6046
|
+
}
|
|
6047
|
+
current[parts.at(-1)] = value;
|
|
6048
|
+
}
|
|
6049
|
+
return result;
|
|
6050
|
+
}
|
|
6051
|
+
function renderObject(obj, indent) {
|
|
6052
|
+
const pad = " ".repeat(indent);
|
|
6053
|
+
const lines = [];
|
|
6054
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
6055
|
+
if (isFieldValue(value)) {
|
|
6056
|
+
lines.push(`${pad}${key}: ${fieldToBuilder(value)},`);
|
|
6057
|
+
} else {
|
|
6058
|
+
const nested = renderObject(value, indent + 1);
|
|
6059
|
+
lines.push(`${pad}${key}: s.object({`);
|
|
6060
|
+
lines.push(nested.trimEnd());
|
|
6061
|
+
lines.push(`${pad}}),`);
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
6064
|
+
return lines.join("\n") + "\n";
|
|
6065
|
+
}
|
|
6066
|
+
function isFieldValue(value) {
|
|
6067
|
+
if (typeof value === "string") return true;
|
|
6068
|
+
if (typeof value === "object" && value !== null) {
|
|
6069
|
+
return "type" in value;
|
|
6070
|
+
}
|
|
6071
|
+
return false;
|
|
6072
|
+
}
|
|
6073
|
+
function fieldToBuilder(value) {
|
|
6074
|
+
if (typeof value === "string") {
|
|
6075
|
+
switch (value) {
|
|
6076
|
+
case "TEXT": {
|
|
6077
|
+
return "s.string()";
|
|
6078
|
+
}
|
|
6079
|
+
case "BOOL": {
|
|
6080
|
+
return "s.boolean()";
|
|
6081
|
+
}
|
|
6082
|
+
case "DATE": {
|
|
6083
|
+
return "s.date()";
|
|
6084
|
+
}
|
|
6085
|
+
case "U64":
|
|
6086
|
+
case "I64":
|
|
6087
|
+
case "F64": {
|
|
6088
|
+
return `s.number("${value}")`;
|
|
6089
|
+
}
|
|
6090
|
+
case "KEYWORD": {
|
|
6091
|
+
return "s.keyword()";
|
|
6092
|
+
}
|
|
6093
|
+
case "FACET": {
|
|
6094
|
+
return "s.facet()";
|
|
6095
|
+
}
|
|
6096
|
+
default: {
|
|
6097
|
+
return "s.string()";
|
|
6098
|
+
}
|
|
6099
|
+
}
|
|
6100
|
+
}
|
|
6101
|
+
const v = value;
|
|
6102
|
+
const type = v.type;
|
|
6103
|
+
let builder = "";
|
|
6104
|
+
switch (type) {
|
|
6105
|
+
case "TEXT": {
|
|
6106
|
+
builder = "s.string()";
|
|
6107
|
+
if (v.noTokenize) builder += ".noTokenize()";
|
|
6108
|
+
if (v.noStem) builder += ".noStem()";
|
|
6109
|
+
break;
|
|
6110
|
+
}
|
|
6111
|
+
case "U64":
|
|
6112
|
+
case "I64":
|
|
6113
|
+
case "F64": {
|
|
6114
|
+
builder = `s.number("${type}")`;
|
|
6115
|
+
break;
|
|
6116
|
+
}
|
|
6117
|
+
case "BOOL": {
|
|
6118
|
+
builder = "s.boolean()";
|
|
6119
|
+
if (v.fast) builder += ".fast()";
|
|
6120
|
+
break;
|
|
6121
|
+
}
|
|
6122
|
+
case "DATE": {
|
|
6123
|
+
builder = "s.date()";
|
|
6124
|
+
if (v.fast) builder += ".fast()";
|
|
6125
|
+
break;
|
|
6126
|
+
}
|
|
6127
|
+
case "KEYWORD": {
|
|
6128
|
+
builder = "s.keyword()";
|
|
6129
|
+
break;
|
|
6130
|
+
}
|
|
6131
|
+
case "FACET": {
|
|
6132
|
+
builder = "s.facet()";
|
|
6133
|
+
break;
|
|
6134
|
+
}
|
|
6135
|
+
default: {
|
|
6136
|
+
builder = "s.string()";
|
|
6137
|
+
}
|
|
6138
|
+
}
|
|
6139
|
+
if (v.from) {
|
|
6140
|
+
builder += `.from("${v.from}")`;
|
|
6141
|
+
}
|
|
6142
|
+
return builder;
|
|
6143
|
+
}
|
|
6144
|
+
|
|
5985
6145
|
// src/components/databrowser/components/search/display-search.tsx
|
|
5986
|
-
import { jsx as
|
|
6146
|
+
import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5987
6147
|
var SearchDisplay = ({
|
|
5988
6148
|
indexName,
|
|
5989
6149
|
isCreateModal,
|
|
@@ -6009,6 +6169,7 @@ var SearchDisplay = ({
|
|
|
6009
6169
|
const currentIndexName = watch("indexName");
|
|
6010
6170
|
const effectiveIndexName = isCreateModal ? currentIndexName : indexName ?? "";
|
|
6011
6171
|
const [pendingFormValues, setPendingFormValues] = useState8();
|
|
6172
|
+
const [parseError, setParseError] = useState8();
|
|
6012
6173
|
const { data, isLoading } = useFetchSearchIndex(indexName, {
|
|
6013
6174
|
enabled: !isCreateModal
|
|
6014
6175
|
});
|
|
@@ -6024,6 +6185,7 @@ var SearchDisplay = ({
|
|
|
6024
6185
|
});
|
|
6025
6186
|
}, [data, reset, indexName]);
|
|
6026
6187
|
const onSubmit = (values) => {
|
|
6188
|
+
setParseError(void 0);
|
|
6027
6189
|
if (isCreateModal) {
|
|
6028
6190
|
createSchema.mutate(
|
|
6029
6191
|
{
|
|
@@ -6038,6 +6200,11 @@ var SearchDisplay = ({
|
|
|
6038
6200
|
}
|
|
6039
6201
|
);
|
|
6040
6202
|
} else {
|
|
6203
|
+
const result = parseSchemaFromEditorValue(values.editorValue);
|
|
6204
|
+
if (!result.success) {
|
|
6205
|
+
setParseError(result.error);
|
|
6206
|
+
return;
|
|
6207
|
+
}
|
|
6041
6208
|
setPendingFormValues({ ...values, indexName });
|
|
6042
6209
|
}
|
|
6043
6210
|
};
|
|
@@ -6046,14 +6213,14 @@ var SearchDisplay = ({
|
|
|
6046
6213
|
reset();
|
|
6047
6214
|
};
|
|
6048
6215
|
if (!isCreateModal && !isLoading && (data === null || data === void 0)) {
|
|
6049
|
-
return /* @__PURE__ */
|
|
6050
|
-
}
|
|
6051
|
-
return /* @__PURE__ */
|
|
6052
|
-
!isCreateModal && /* @__PURE__ */
|
|
6053
|
-
/* @__PURE__ */
|
|
6054
|
-
isCreateModal && /* @__PURE__ */
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
/* @__PURE__ */
|
|
6216
|
+
return /* @__PURE__ */ jsx35(KeyDeleted, {});
|
|
6217
|
+
}
|
|
6218
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex h-full min-h-0 w-full min-w-0 flex-col gap-2", children: [
|
|
6219
|
+
!isCreateModal && /* @__PURE__ */ jsx35(DisplayHeader, { dataKey: effectiveIndexName, type: "search", hideTypeTag: isEditModal }),
|
|
6220
|
+
/* @__PURE__ */ jsx35("div", { className: "flex min-h-0 min-w-0 grow flex-col gap-2 rounded-md", children: !isCreateModal && isLoading ? /* @__PURE__ */ jsx35(Spinner, { isLoadingText: "", isLoading: true }) : /* @__PURE__ */ jsxs17("div", { className: "flex min-h-0 w-full flex-1 flex-col gap-3", children: [
|
|
6221
|
+
isCreateModal && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1.5", children: [
|
|
6222
|
+
/* @__PURE__ */ jsx35(Label, { htmlFor: "index-name", children: "Index Key" }),
|
|
6223
|
+
/* @__PURE__ */ jsx35(
|
|
6057
6224
|
Input,
|
|
6058
6225
|
{
|
|
6059
6226
|
id: "index-name",
|
|
@@ -6061,42 +6228,42 @@ var SearchDisplay = ({
|
|
|
6061
6228
|
placeholder: "idx_users"
|
|
6062
6229
|
}
|
|
6063
6230
|
),
|
|
6064
|
-
errors.indexName && /* @__PURE__ */
|
|
6231
|
+
errors.indexName && /* @__PURE__ */ jsx35("p", { className: "text-xs text-red-500", children: errors.indexName.message })
|
|
6065
6232
|
] }),
|
|
6066
|
-
/* @__PURE__ */
|
|
6067
|
-
/* @__PURE__ */
|
|
6068
|
-
/* @__PURE__ */
|
|
6069
|
-
/* @__PURE__ */
|
|
6070
|
-
/* @__PURE__ */
|
|
6071
|
-
/* @__PURE__ */
|
|
6233
|
+
/* @__PURE__ */ jsxs17("div", { className: "shrink-0 rounded-md border border-zinc-300 bg-white p-3", children: [
|
|
6234
|
+
/* @__PURE__ */ jsx35("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx35("h3", { className: "text-sm font-medium text-zinc-700", children: "Config" }) }),
|
|
6235
|
+
/* @__PURE__ */ jsxs17("div", { className: "mt-2 grid grid-cols-2 gap-4 text-sm lg:grid-cols-4", children: [
|
|
6236
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
6237
|
+
/* @__PURE__ */ jsx35("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Data Type" }),
|
|
6238
|
+
/* @__PURE__ */ jsx35(
|
|
6072
6239
|
Controller2,
|
|
6073
6240
|
{
|
|
6074
6241
|
name: "dataType",
|
|
6075
6242
|
control,
|
|
6076
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6077
|
-
/* @__PURE__ */
|
|
6078
|
-
/* @__PURE__ */
|
|
6243
|
+
render: ({ field }) => /* @__PURE__ */ jsxs17(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
6244
|
+
/* @__PURE__ */ jsx35(SelectTrigger, { className: "h-8 w-auto pl-[3px] pr-8", children: /* @__PURE__ */ jsx35(SelectValue, { placeholder: "Select type" }) }),
|
|
6245
|
+
/* @__PURE__ */ jsx35(SelectContent, { children: ["string", "hash", "json"].map((type) => /* @__PURE__ */ jsx35(SelectItem, { value: type, children: /* @__PURE__ */ jsx35(TypeTag, { variant: type, type: "badge" }) }, type)) })
|
|
6079
6246
|
] })
|
|
6080
6247
|
}
|
|
6081
6248
|
)
|
|
6082
6249
|
] }),
|
|
6083
|
-
/* @__PURE__ */
|
|
6084
|
-
/* @__PURE__ */
|
|
6085
|
-
/* @__PURE__ */
|
|
6250
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
6251
|
+
/* @__PURE__ */ jsx35("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Language" }),
|
|
6252
|
+
/* @__PURE__ */ jsx35(
|
|
6086
6253
|
Controller2,
|
|
6087
6254
|
{
|
|
6088
6255
|
name: "language",
|
|
6089
6256
|
control,
|
|
6090
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6091
|
-
/* @__PURE__ */
|
|
6092
|
-
/* @__PURE__ */
|
|
6257
|
+
render: ({ field }) => /* @__PURE__ */ jsxs17(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
6258
|
+
/* @__PURE__ */ jsx35(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsx35(SelectValue, { placeholder: "Select language" }) }),
|
|
6259
|
+
/* @__PURE__ */ jsx35(SelectContent, { children: LANGUAGES.map((lang) => /* @__PURE__ */ jsx35(SelectItem, { value: lang, children: lang.charAt(0).toUpperCase() + lang.slice(1) }, lang)) })
|
|
6093
6260
|
] })
|
|
6094
6261
|
}
|
|
6095
6262
|
)
|
|
6096
6263
|
] }),
|
|
6097
|
-
/* @__PURE__ */
|
|
6098
|
-
/* @__PURE__ */
|
|
6099
|
-
/* @__PURE__ */
|
|
6264
|
+
/* @__PURE__ */ jsxs17("div", { className: "col-span-2", children: [
|
|
6265
|
+
/* @__PURE__ */ jsx35("span", { className: "mb-1.5 block text-xs font-medium text-zinc-500", children: "Prefixes" }),
|
|
6266
|
+
/* @__PURE__ */ jsx35(
|
|
6100
6267
|
Input,
|
|
6101
6268
|
{
|
|
6102
6269
|
...register("prefixes", { required: "Please enter at least one prefix" }),
|
|
@@ -6104,18 +6271,18 @@ var SearchDisplay = ({
|
|
|
6104
6271
|
placeholder: "user:, post:"
|
|
6105
6272
|
}
|
|
6106
6273
|
),
|
|
6107
|
-
errors.prefixes && /* @__PURE__ */
|
|
6274
|
+
errors.prefixes && /* @__PURE__ */ jsx35("p", { className: "mt-1 text-xs text-red-500", children: errors.prefixes.message })
|
|
6108
6275
|
] })
|
|
6109
6276
|
] })
|
|
6110
6277
|
] }),
|
|
6111
|
-
/* @__PURE__ */
|
|
6112
|
-
/* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6278
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative flex min-h-0 flex-1 flex-col rounded-md border border-zinc-300 bg-white", children: [
|
|
6279
|
+
/* @__PURE__ */ jsx35("div", { className: "flex items-center justify-between border-b border-zinc-200 px-3 py-2", children: /* @__PURE__ */ jsx35("h3", { className: "text-sm font-medium text-zinc-700", children: "Schema" }) }),
|
|
6280
|
+
/* @__PURE__ */ jsx35("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx35("div", { className: "h-full px-1", children: /* @__PURE__ */ jsx35(
|
|
6114
6281
|
Controller2,
|
|
6115
6282
|
{
|
|
6116
6283
|
name: "editorValue",
|
|
6117
6284
|
control,
|
|
6118
|
-
render: ({ field }) => /* @__PURE__ */
|
|
6285
|
+
render: ({ field }) => /* @__PURE__ */ jsx35(
|
|
6119
6286
|
SchemaEditor,
|
|
6120
6287
|
{
|
|
6121
6288
|
value: field.value,
|
|
@@ -6125,7 +6292,7 @@ var SearchDisplay = ({
|
|
|
6125
6292
|
)
|
|
6126
6293
|
}
|
|
6127
6294
|
) }) }),
|
|
6128
|
-
/* @__PURE__ */
|
|
6295
|
+
/* @__PURE__ */ jsx35(
|
|
6129
6296
|
DocsLink,
|
|
6130
6297
|
{
|
|
6131
6298
|
className: "absolute bottom-2 right-2 text-sm",
|
|
@@ -6133,9 +6300,10 @@ var SearchDisplay = ({
|
|
|
6133
6300
|
}
|
|
6134
6301
|
)
|
|
6135
6302
|
] }),
|
|
6136
|
-
isCreateModal && createSchema.error && /* @__PURE__ */
|
|
6137
|
-
/* @__PURE__ */
|
|
6138
|
-
|
|
6303
|
+
isCreateModal && createSchema.error && /* @__PURE__ */ jsx35("div", { className: "w-full break-words text-xs text-red-500", children: createSchema.error.message.startsWith("ERR syntax error") ? "Invalid schema" : formatUpstashErrorMessage(createSchema.error) }),
|
|
6304
|
+
parseError && /* @__PURE__ */ jsx35("div", { className: "w-full break-words text-xs text-red-500", children: parseError }),
|
|
6305
|
+
/* @__PURE__ */ jsx35("div", { className: "flex shrink-0 items-center gap-2", children: /* @__PURE__ */ jsxs17("div", { className: "ml-auto flex gap-2", children: [
|
|
6306
|
+
(isDirty || isCreateModal || isEditModal) && /* @__PURE__ */ jsx35(
|
|
6139
6307
|
Button,
|
|
6140
6308
|
{
|
|
6141
6309
|
onClick: () => {
|
|
@@ -6148,15 +6316,14 @@ var SearchDisplay = ({
|
|
|
6148
6316
|
children: "Cancel"
|
|
6149
6317
|
}
|
|
6150
6318
|
),
|
|
6151
|
-
/* @__PURE__ */
|
|
6319
|
+
/* @__PURE__ */ jsx35(Button, { variant: "primary", onClick: handleSubmit(onSubmit), disabled: !isDirty, children: /* @__PURE__ */ jsx35(Spinner, { isLoading: createSchema.isPending, isLoadingText: "Saving", children: isCreateModal ? "Create" : "Save..." }) })
|
|
6152
6320
|
] }) }),
|
|
6153
|
-
/* @__PURE__ */
|
|
6321
|
+
/* @__PURE__ */ jsx35(
|
|
6154
6322
|
SaveSchemaModal,
|
|
6155
6323
|
{
|
|
6156
6324
|
values: pendingFormValues,
|
|
6157
6325
|
onClose: () => {
|
|
6158
6326
|
setPendingFormValues(void 0);
|
|
6159
|
-
reset();
|
|
6160
6327
|
if (isEditModal && onClose) onClose();
|
|
6161
6328
|
}
|
|
6162
6329
|
}
|
|
@@ -6192,63 +6359,6 @@ import { IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
|
6192
6359
|
// src/components/common/infinite-scroll.tsx
|
|
6193
6360
|
import { useEffect as useEffect10, useRef as useRef3 } from "react";
|
|
6194
6361
|
import { IconLoader2 } from "@tabler/icons-react";
|
|
6195
|
-
|
|
6196
|
-
// src/components/ui/scroll-area.tsx
|
|
6197
|
-
import * as React13 from "react";
|
|
6198
|
-
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
6199
|
-
import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6200
|
-
var ScrollArea = React13.forwardRef(
|
|
6201
|
-
({
|
|
6202
|
-
className,
|
|
6203
|
-
scrollBarClassName,
|
|
6204
|
-
scrollBarForceMount,
|
|
6205
|
-
children,
|
|
6206
|
-
onScroll,
|
|
6207
|
-
disableRoundedInherit = false,
|
|
6208
|
-
...props
|
|
6209
|
-
}, ref) => /* @__PURE__ */ jsxs17(
|
|
6210
|
-
ScrollAreaPrimitive.Root,
|
|
6211
|
-
{
|
|
6212
|
-
ref,
|
|
6213
|
-
className: cn("relative overflow-hidden", className),
|
|
6214
|
-
...props,
|
|
6215
|
-
children: [
|
|
6216
|
-
/* @__PURE__ */ jsx35(
|
|
6217
|
-
ScrollAreaPrimitive.Viewport,
|
|
6218
|
-
{
|
|
6219
|
-
onScroll,
|
|
6220
|
-
className: cn(
|
|
6221
|
-
"h-full w-full [&>div]:!block",
|
|
6222
|
-
!disableRoundedInherit && "rounded-[inherit]"
|
|
6223
|
-
),
|
|
6224
|
-
children
|
|
6225
|
-
}
|
|
6226
|
-
),
|
|
6227
|
-
/* @__PURE__ */ jsx35(ScrollBar, { className: scrollBarClassName, forceMount: scrollBarForceMount }),
|
|
6228
|
-
/* @__PURE__ */ jsx35(ScrollAreaPrimitive.Corner, {})
|
|
6229
|
-
]
|
|
6230
|
-
}
|
|
6231
|
-
)
|
|
6232
|
-
);
|
|
6233
|
-
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
6234
|
-
var ScrollBar = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx35(
|
|
6235
|
-
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
6236
|
-
{
|
|
6237
|
-
ref,
|
|
6238
|
-
orientation: "vertical",
|
|
6239
|
-
className: cn("mr-1 flex h-full w-2 touch-none select-none transition-colors", className),
|
|
6240
|
-
...props,
|
|
6241
|
-
children: /* @__PURE__ */ jsx35(
|
|
6242
|
-
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
6243
|
-
{
|
|
6244
|
-
className: cn("relative flex-1 rounded-full bg-zinc-400/70")
|
|
6245
|
-
}
|
|
6246
|
-
)
|
|
6247
|
-
}
|
|
6248
|
-
));
|
|
6249
|
-
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
6250
|
-
|
|
6251
|
-
// src/components/common/infinite-scroll.tsx
|
|
6252
6362
|
import { jsx as jsx36, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6253
6363
|
var InfiniteScroll = ({
|
|
6254
6364
|
query,
|
|
@@ -6287,7 +6397,7 @@ var InfiniteScroll = ({
|
|
|
6287
6397
|
type: "always",
|
|
6288
6398
|
onScroll: handleScroll,
|
|
6289
6399
|
...props,
|
|
6290
|
-
className: cn("block h-full w-full overflow-
|
|
6400
|
+
className: cn("block h-full min-h-0 w-full overflow-hidden transition-all", props.className),
|
|
6291
6401
|
ref: scrollRef,
|
|
6292
6402
|
children: /* @__PURE__ */ jsxs18("div", { ref: contentRef, children: [
|
|
6293
6403
|
children,
|
|
@@ -7377,8 +7487,16 @@ import { useMutation as useMutation8 } from "@tanstack/react-query";
|
|
|
7377
7487
|
|
|
7378
7488
|
// src/components/databrowser/components/search/search-types-file.ts
|
|
7379
7489
|
var SEARCH_TYPES = `
|
|
7380
|
-
|
|
7381
|
-
|
|
7490
|
+
export const FIELD_TYPES = [
|
|
7491
|
+
"TEXT",
|
|
7492
|
+
"U64",
|
|
7493
|
+
"I64",
|
|
7494
|
+
"F64",
|
|
7495
|
+
"BOOL",
|
|
7496
|
+
"DATE",
|
|
7497
|
+
"KEYWORD",
|
|
7498
|
+
"FACET",
|
|
7499
|
+
] as const;
|
|
7382
7500
|
export type FieldType = (typeof FIELD_TYPES)[number];
|
|
7383
7501
|
|
|
7384
7502
|
export type TextField = {
|
|
@@ -7406,7 +7524,21 @@ export type DateField = {
|
|
|
7406
7524
|
from?: string;
|
|
7407
7525
|
};
|
|
7408
7526
|
|
|
7409
|
-
export type
|
|
7527
|
+
export type KeywordField = {
|
|
7528
|
+
type: "KEYWORD";
|
|
7529
|
+
};
|
|
7530
|
+
|
|
7531
|
+
export type FacetField = {
|
|
7532
|
+
type: "FACET";
|
|
7533
|
+
};
|
|
7534
|
+
|
|
7535
|
+
export type DetailedField =
|
|
7536
|
+
| TextField
|
|
7537
|
+
| NumericField
|
|
7538
|
+
| BoolField
|
|
7539
|
+
| DateField
|
|
7540
|
+
| KeywordField
|
|
7541
|
+
| FacetField;
|
|
7410
7542
|
export type NestedIndexSchema = {
|
|
7411
7543
|
[key: string]: FieldType | DetailedField | NestedIndexSchema;
|
|
7412
7544
|
};
|
|
@@ -7454,7 +7586,11 @@ type FieldValueType<T extends FieldType> = T extends "TEXT"
|
|
|
7454
7586
|
? boolean
|
|
7455
7587
|
: T extends "DATE"
|
|
7456
7588
|
? string
|
|
7457
|
-
:
|
|
7589
|
+
: T extends "KEYWORD"
|
|
7590
|
+
? string
|
|
7591
|
+
: T extends "FACET"
|
|
7592
|
+
? string
|
|
7593
|
+
: never;
|
|
7458
7594
|
|
|
7459
7595
|
type GetFieldValueType<TSchema, Path extends string> =
|
|
7460
7596
|
GetFieldAtPath<TSchema, Path> extends infer Field
|
|
@@ -7561,7 +7697,7 @@ type PathToNestedObject<
|
|
|
7561
7697
|
TSchema,
|
|
7562
7698
|
Path extends string,
|
|
7563
7699
|
Value,
|
|
7564
|
-
> = Path extends \`\${
|
|
7700
|
+
> = Path extends \`\${infer First}.\${infer Rest}\`
|
|
7565
7701
|
? { [K in First]: PathToNestedObject<TSchema, Rest, Value> }
|
|
7566
7702
|
: { [K in Path]: Value };
|
|
7567
7703
|
|
|
@@ -7638,7 +7774,6 @@ export type PublicQueryResult<
|
|
|
7638
7774
|
// These are the operations that can be used for each field type
|
|
7639
7775
|
type StringOperationMap<T extends string> = {
|
|
7640
7776
|
$eq: T;
|
|
7641
|
-
$ne: T;
|
|
7642
7777
|
$in: T[];
|
|
7643
7778
|
$fuzzy: T | { value: T; distance?: number; transpositionCostOne?: boolean };
|
|
7644
7779
|
$phrase:
|
|
@@ -7652,7 +7787,15 @@ type StringOperationMap<T extends string> = {
|
|
|
7652
7787
|
|
|
7653
7788
|
type NumberOperationMap<T extends number> = {
|
|
7654
7789
|
$eq: T;
|
|
7655
|
-
$
|
|
7790
|
+
$in: T[];
|
|
7791
|
+
$gt: T;
|
|
7792
|
+
$gte: T;
|
|
7793
|
+
$lt: T;
|
|
7794
|
+
$lte: T;
|
|
7795
|
+
};
|
|
7796
|
+
|
|
7797
|
+
type KeywordOperationMap<T extends string> = {
|
|
7798
|
+
$eq: T;
|
|
7656
7799
|
$in: T[];
|
|
7657
7800
|
$gt: T;
|
|
7658
7801
|
$gte: T;
|
|
@@ -7662,13 +7805,11 @@ type NumberOperationMap<T extends number> = {
|
|
|
7662
7805
|
|
|
7663
7806
|
type BooleanOperationMap<T extends boolean> = {
|
|
7664
7807
|
$eq: T;
|
|
7665
|
-
$ne: T;
|
|
7666
7808
|
$in: T[];
|
|
7667
7809
|
};
|
|
7668
7810
|
|
|
7669
7811
|
type DateOperationMap<T extends string | Date> = {
|
|
7670
7812
|
$eq: T;
|
|
7671
|
-
$ne: T;
|
|
7672
7813
|
$in: T[];
|
|
7673
7814
|
$gt: T;
|
|
7674
7815
|
$gte: T;
|
|
@@ -7676,6 +7817,11 @@ type DateOperationMap<T extends string | Date> = {
|
|
|
7676
7817
|
$lt: T;
|
|
7677
7818
|
};
|
|
7678
7819
|
|
|
7820
|
+
type FacetOperationMap<T extends string> = {
|
|
7821
|
+
$eq: T;
|
|
7822
|
+
$in: T[];
|
|
7823
|
+
};
|
|
7824
|
+
|
|
7679
7825
|
// Create union types for each field type
|
|
7680
7826
|
type StringOperations = {
|
|
7681
7827
|
[K in keyof StringOperationMap<string>]: { [P in K]: StringOperationMap<string>[K] } & {
|
|
@@ -7701,6 +7847,18 @@ type DateOperations = {
|
|
|
7701
7847
|
};
|
|
7702
7848
|
}[keyof DateOperationMap<string | Date>];
|
|
7703
7849
|
|
|
7850
|
+
type KeywordOperations = {
|
|
7851
|
+
[K in keyof KeywordOperationMap<string>]: { [P in K]: KeywordOperationMap<string>[K] } & {
|
|
7852
|
+
$boost?: number;
|
|
7853
|
+
};
|
|
7854
|
+
}[keyof KeywordOperationMap<string>];
|
|
7855
|
+
|
|
7856
|
+
type FacetOperations = {
|
|
7857
|
+
[K in keyof FacetOperationMap<string>]: { [P in K]: FacetOperationMap<string>[K] } & {
|
|
7858
|
+
$boost?: number;
|
|
7859
|
+
};
|
|
7860
|
+
}[keyof FacetOperationMap<string>];
|
|
7861
|
+
|
|
7704
7862
|
// Create a union type for all operations for a given field type
|
|
7705
7863
|
type OperationsForFieldType<T extends FieldType> = T extends "TEXT"
|
|
7706
7864
|
? StringOperations
|
|
@@ -7710,7 +7868,11 @@ type OperationsForFieldType<T extends FieldType> = T extends "TEXT"
|
|
|
7710
7868
|
? BooleanOperations
|
|
7711
7869
|
: T extends "DATE"
|
|
7712
7870
|
? DateOperations
|
|
7713
|
-
:
|
|
7871
|
+
: T extends "KEYWORD"
|
|
7872
|
+
? KeywordOperations
|
|
7873
|
+
: T extends "FACET"
|
|
7874
|
+
? FacetOperations
|
|
7875
|
+
: never;
|
|
7714
7876
|
|
|
7715
7877
|
// Create a union type for all operations for a given path
|
|
7716
7878
|
type PathOperations<TSchema, TPath extends string> =
|
|
@@ -7878,7 +8040,7 @@ type RootOrNode<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
|
|
|
7878
8040
|
$and?: never;
|
|
7879
8041
|
$must?: never;
|
|
7880
8042
|
$should?: never;
|
|
7881
|
-
$mustNot?:
|
|
8043
|
+
$mustNot?: QueryFilter<TSchema> | QueryFilter<TSchema>[];
|
|
7882
8044
|
};
|
|
7883
8045
|
|
|
7884
8046
|
export type DescribeFieldInfo = {
|
|
@@ -7916,6 +8078,298 @@ export type Language =
|
|
|
7916
8078
|
| "tamil"
|
|
7917
8079
|
| "turkish";
|
|
7918
8080
|
|
|
8081
|
+
// Helper type to extract only FACET field paths from schema
|
|
8082
|
+
export type FacetPaths<T, Prefix extends string = ""> = {
|
|
8083
|
+
[K in keyof T]: K extends string
|
|
8084
|
+
? T[K] extends "FACET" | { type: "FACET" }
|
|
8085
|
+
? Prefix extends ""
|
|
8086
|
+
? K
|
|
8087
|
+
: \`\${Prefix}\${K}\`
|
|
8088
|
+
: T[K] extends FieldType | DetailedField
|
|
8089
|
+
? never
|
|
8090
|
+
: T[K] extends object
|
|
8091
|
+
? FacetPaths<T[K], \`\${Prefix}\${K}.\`>
|
|
8092
|
+
: never
|
|
8093
|
+
: never;
|
|
8094
|
+
}[keyof T];
|
|
8095
|
+
|
|
8096
|
+
// Aggregate Types
|
|
8097
|
+
export type AggregateOptions<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
|
|
8098
|
+
filter?: RootQueryFilter<TSchema>;
|
|
8099
|
+
aggregations: {
|
|
8100
|
+
[key: string]: Aggregation<TSchema>;
|
|
8101
|
+
};
|
|
8102
|
+
};
|
|
8103
|
+
|
|
8104
|
+
export type Aggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8105
|
+
| TermsAggregation<TSchema>
|
|
8106
|
+
| RangeAggregation<TSchema>
|
|
8107
|
+
| HistogramAggregation<TSchema>
|
|
8108
|
+
| StatsAggregation<TSchema>
|
|
8109
|
+
| AvgAggregation<TSchema>
|
|
8110
|
+
| SumAggregation<TSchema>
|
|
8111
|
+
| MinAggregation<TSchema>
|
|
8112
|
+
| MaxAggregation<TSchema>
|
|
8113
|
+
| CountAggregation<TSchema>
|
|
8114
|
+
| ExtendedStatsAggregation<TSchema>
|
|
8115
|
+
| PercentilesAggregation<TSchema>
|
|
8116
|
+
| CardinalityAggregation<TSchema>
|
|
8117
|
+
| FacetAggregation<TSchema>;
|
|
8118
|
+
|
|
8119
|
+
type BaseAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> = {
|
|
8120
|
+
$aggs?: {
|
|
8121
|
+
[key: string]: Aggregation<TSchema>;
|
|
8122
|
+
};
|
|
8123
|
+
};
|
|
8124
|
+
|
|
8125
|
+
export type TermsAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8126
|
+
BaseAggregation<TSchema> & {
|
|
8127
|
+
$terms: {
|
|
8128
|
+
field: SchemaPaths<TSchema>;
|
|
8129
|
+
size?: number;
|
|
8130
|
+
};
|
|
8131
|
+
};
|
|
8132
|
+
|
|
8133
|
+
export type RangeAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8134
|
+
BaseAggregation<TSchema> & {
|
|
8135
|
+
$range: {
|
|
8136
|
+
field: SchemaPaths<TSchema>;
|
|
8137
|
+
ranges: { from?: number; to?: number }[];
|
|
8138
|
+
};
|
|
8139
|
+
};
|
|
8140
|
+
|
|
8141
|
+
export type HistogramAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8142
|
+
BaseAggregation<TSchema> & {
|
|
8143
|
+
$histogram: {
|
|
8144
|
+
field: SchemaPaths<TSchema>;
|
|
8145
|
+
interval: number;
|
|
8146
|
+
};
|
|
8147
|
+
};
|
|
8148
|
+
|
|
8149
|
+
export type StatsAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8150
|
+
BaseAggregation<TSchema> & {
|
|
8151
|
+
$stats: {
|
|
8152
|
+
field: SchemaPaths<TSchema>;
|
|
8153
|
+
missing?: number;
|
|
8154
|
+
};
|
|
8155
|
+
};
|
|
8156
|
+
|
|
8157
|
+
export type AvgAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8158
|
+
BaseAggregation<TSchema> & {
|
|
8159
|
+
$avg: {
|
|
8160
|
+
field: SchemaPaths<TSchema>;
|
|
8161
|
+
missing?: number;
|
|
8162
|
+
};
|
|
8163
|
+
};
|
|
8164
|
+
|
|
8165
|
+
export type SumAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8166
|
+
BaseAggregation<TSchema> & {
|
|
8167
|
+
$sum: {
|
|
8168
|
+
field: SchemaPaths<TSchema>;
|
|
8169
|
+
missing?: number;
|
|
8170
|
+
};
|
|
8171
|
+
};
|
|
8172
|
+
|
|
8173
|
+
export type MinAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8174
|
+
BaseAggregation<TSchema> & {
|
|
8175
|
+
$min: {
|
|
8176
|
+
field: SchemaPaths<TSchema>;
|
|
8177
|
+
missing?: number;
|
|
8178
|
+
};
|
|
8179
|
+
};
|
|
8180
|
+
|
|
8181
|
+
export type MaxAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8182
|
+
BaseAggregation<TSchema> & {
|
|
8183
|
+
$max: {
|
|
8184
|
+
field: SchemaPaths<TSchema>;
|
|
8185
|
+
missing?: number;
|
|
8186
|
+
};
|
|
8187
|
+
};
|
|
8188
|
+
|
|
8189
|
+
export type CountAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8190
|
+
BaseAggregation<TSchema> & {
|
|
8191
|
+
$count: {
|
|
8192
|
+
field: SchemaPaths<TSchema>;
|
|
8193
|
+
};
|
|
8194
|
+
};
|
|
8195
|
+
|
|
8196
|
+
export type ExtendedStatsAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8197
|
+
BaseAggregation<TSchema> & {
|
|
8198
|
+
$extendedStats: {
|
|
8199
|
+
field: SchemaPaths<TSchema>;
|
|
8200
|
+
sigma?: number;
|
|
8201
|
+
missing?: number;
|
|
8202
|
+
};
|
|
8203
|
+
};
|
|
8204
|
+
|
|
8205
|
+
export type PercentilesAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8206
|
+
BaseAggregation<TSchema> & {
|
|
8207
|
+
$percentiles: {
|
|
8208
|
+
field: SchemaPaths<TSchema>;
|
|
8209
|
+
percents?: number[];
|
|
8210
|
+
keyed?: boolean;
|
|
8211
|
+
missing?: number;
|
|
8212
|
+
};
|
|
8213
|
+
};
|
|
8214
|
+
|
|
8215
|
+
export type CardinalityAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8216
|
+
BaseAggregation<TSchema> & {
|
|
8217
|
+
$cardinality: {
|
|
8218
|
+
field: SchemaPaths<TSchema>;
|
|
8219
|
+
};
|
|
8220
|
+
};
|
|
8221
|
+
|
|
8222
|
+
export type FacetAggregation<TSchema extends NestedIndexSchema | FlatIndexSchema> =
|
|
8223
|
+
BaseAggregation<TSchema> & {
|
|
8224
|
+
$facet: {
|
|
8225
|
+
field: FacetPaths<TSchema>;
|
|
8226
|
+
path: string;
|
|
8227
|
+
depth?: number;
|
|
8228
|
+
size?: number;
|
|
8229
|
+
minDocCount?: number;
|
|
8230
|
+
order?: { count: "desc" | "asc" };
|
|
8231
|
+
};
|
|
8232
|
+
};
|
|
8233
|
+
|
|
8234
|
+
export type AggregateResult<
|
|
8235
|
+
TSchema extends NestedIndexSchema | FlatIndexSchema,
|
|
8236
|
+
TOpts extends AggregateOptions<TSchema>,
|
|
8237
|
+
> = BuildAggregateResult<TSchema, TOpts["aggregations"]>;
|
|
8238
|
+
|
|
8239
|
+
type BuildAggregateResult<
|
|
8240
|
+
TSchema extends NestedIndexSchema | FlatIndexSchema,
|
|
8241
|
+
TAggs extends { [key: string]: Aggregation<TSchema> },
|
|
8242
|
+
> = {
|
|
8243
|
+
[K in keyof TAggs]: TAggs[K] extends TermsAggregation<TSchema>
|
|
8244
|
+
? TermsResult<TSchema, TAggs[K]>
|
|
8245
|
+
: TAggs[K] extends RangeAggregation<TSchema>
|
|
8246
|
+
? RangeResult<TSchema, TAggs[K]>
|
|
8247
|
+
: TAggs[K] extends HistogramAggregation<TSchema>
|
|
8248
|
+
? HistogramResult<TSchema, TAggs[K]>
|
|
8249
|
+
: TAggs[K] extends StatsAggregation<TSchema>
|
|
8250
|
+
? StatsResult
|
|
8251
|
+
: TAggs[K] extends AvgAggregation<TSchema>
|
|
8252
|
+
? MetricValueResult
|
|
8253
|
+
: TAggs[K] extends SumAggregation<TSchema>
|
|
8254
|
+
? MetricValueResult
|
|
8255
|
+
: TAggs[K] extends MinAggregation<TSchema>
|
|
8256
|
+
? MetricValueResult
|
|
8257
|
+
: TAggs[K] extends MaxAggregation<TSchema>
|
|
8258
|
+
? MetricValueResult
|
|
8259
|
+
: TAggs[K] extends CountAggregation<TSchema>
|
|
8260
|
+
? MetricValueResult
|
|
8261
|
+
: TAggs[K] extends CardinalityAggregation<TSchema>
|
|
8262
|
+
? MetricValueResult
|
|
8263
|
+
: TAggs[K] extends ExtendedStatsAggregation<TSchema>
|
|
8264
|
+
? ExtendedStatsResult<TAggs[K]>
|
|
8265
|
+
: TAggs[K] extends PercentilesAggregation<TSchema>
|
|
8266
|
+
? PercentilesResult<TAggs[K]>
|
|
8267
|
+
: TAggs[K] extends FacetAggregation<TSchema>
|
|
8268
|
+
? FacetResult
|
|
8269
|
+
: never;
|
|
8270
|
+
};
|
|
8271
|
+
|
|
8272
|
+
type Bucket<T> = {
|
|
8273
|
+
key: T;
|
|
8274
|
+
docCount: number;
|
|
8275
|
+
from?: number;
|
|
8276
|
+
to?: number;
|
|
8277
|
+
};
|
|
8278
|
+
|
|
8279
|
+
type TermsResult<
|
|
8280
|
+
TSchema extends NestedIndexSchema | FlatIndexSchema,
|
|
8281
|
+
TAgg extends TermsAggregation<TSchema>,
|
|
8282
|
+
> = TAgg["$aggs"] extends { [key: string]: Aggregation<TSchema> }
|
|
8283
|
+
? {
|
|
8284
|
+
buckets: (Bucket<GetFieldValueType<TSchema, TAgg["$terms"]["field"]>> &
|
|
8285
|
+
BuildAggregateResult<TSchema, TAgg["$aggs"]>)[];
|
|
8286
|
+
sumOtherDocCount: number;
|
|
8287
|
+
docCountErrorUpperBound: number;
|
|
8288
|
+
}
|
|
8289
|
+
: {
|
|
8290
|
+
buckets: Bucket<GetFieldValueType<TSchema, TAgg["$terms"]["field"]>>[];
|
|
8291
|
+
sumOtherDocCount: number;
|
|
8292
|
+
docCountErrorUpperBound: number;
|
|
8293
|
+
};
|
|
8294
|
+
|
|
8295
|
+
type RangeResult<
|
|
8296
|
+
TSchema extends NestedIndexSchema | FlatIndexSchema,
|
|
8297
|
+
TAgg extends RangeAggregation<TSchema>,
|
|
8298
|
+
> = TAgg["$aggs"] extends { [key: string]: Aggregation<TSchema> }
|
|
8299
|
+
? {
|
|
8300
|
+
buckets: (Bucket<string> & BuildAggregateResult<TSchema, TAgg["$aggs"]>)[];
|
|
8301
|
+
}
|
|
8302
|
+
: {
|
|
8303
|
+
buckets: Bucket<string>[];
|
|
8304
|
+
};
|
|
8305
|
+
|
|
8306
|
+
type HistogramResult<
|
|
8307
|
+
TSchema extends NestedIndexSchema | FlatIndexSchema,
|
|
8308
|
+
TAgg extends HistogramAggregation<TSchema>,
|
|
8309
|
+
> = TAgg["$aggs"] extends { [key: string]: Aggregation<TSchema> }
|
|
8310
|
+
? {
|
|
8311
|
+
buckets: (Bucket<number> & BuildAggregateResult<TSchema, TAgg["$aggs"]>)[];
|
|
8312
|
+
}
|
|
8313
|
+
: {
|
|
8314
|
+
buckets: Bucket<number>[];
|
|
8315
|
+
};
|
|
8316
|
+
|
|
8317
|
+
type MetricValueResult = {
|
|
8318
|
+
value: number;
|
|
8319
|
+
};
|
|
8320
|
+
|
|
8321
|
+
type StatsResult = {
|
|
8322
|
+
count: number;
|
|
8323
|
+
min: number;
|
|
8324
|
+
max: number;
|
|
8325
|
+
sum: number;
|
|
8326
|
+
avg: number;
|
|
8327
|
+
};
|
|
8328
|
+
|
|
8329
|
+
type ExtendedStatsResult<_TAgg> = {
|
|
8330
|
+
count: number;
|
|
8331
|
+
min: number;
|
|
8332
|
+
max: number;
|
|
8333
|
+
avg: number;
|
|
8334
|
+
sum: number;
|
|
8335
|
+
sumOfSquares: number;
|
|
8336
|
+
variance: number;
|
|
8337
|
+
variancePopulation: number;
|
|
8338
|
+
varianceSampling: number;
|
|
8339
|
+
stdDeviation: number;
|
|
8340
|
+
stdDeviationPopulation: number;
|
|
8341
|
+
stdDeviationSampling: number;
|
|
8342
|
+
stdDeviationBounds: {
|
|
8343
|
+
upper: number;
|
|
8344
|
+
lower: number;
|
|
8345
|
+
upperSampling: number;
|
|
8346
|
+
lowerSampling: number;
|
|
8347
|
+
upperPopulation: number;
|
|
8348
|
+
lowerPopulation: number;
|
|
8349
|
+
};
|
|
8350
|
+
};
|
|
8351
|
+
|
|
8352
|
+
type PercentilesResult<TAgg> = TAgg extends { $percentiles: { keyed: false } }
|
|
8353
|
+
? {
|
|
8354
|
+
values: Array<{ key: number; value: number }>;
|
|
8355
|
+
}
|
|
8356
|
+
: {
|
|
8357
|
+
values: { [key: string]: number };
|
|
8358
|
+
};
|
|
8359
|
+
|
|
8360
|
+
type FacetChildNode = {
|
|
8361
|
+
path: string;
|
|
8362
|
+
docCount: number;
|
|
8363
|
+
sumOtherDocCount: number;
|
|
8364
|
+
children?: FacetChildNode[];
|
|
8365
|
+
};
|
|
8366
|
+
|
|
8367
|
+
type FacetResult = {
|
|
8368
|
+
path: string;
|
|
8369
|
+
sumOtherDocCount: number;
|
|
8370
|
+
children: FacetChildNode[];
|
|
8371
|
+
};
|
|
8372
|
+
|
|
7919
8373
|
`;
|
|
7920
8374
|
|
|
7921
8375
|
// src/components/databrowser/components/query-wizard/use-query-wizard.tsx
|
|
@@ -8688,7 +9142,7 @@ var QueryBuilder = () => {
|
|
|
8688
9142
|
const { data: indexDetails } = useFetchSearchIndex(valuesSearch.index);
|
|
8689
9143
|
const editorValue = PREFIX + (valuesSearch.query || "{}");
|
|
8690
9144
|
if (!indexDetails) return;
|
|
8691
|
-
return /* @__PURE__ */ jsx61("div", { className: "flex h-full flex-col rounded-lg border border-zinc-300 bg-white px-[6px]", children: /* @__PURE__ */ jsx61("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx61(
|
|
9145
|
+
return /* @__PURE__ */ jsx61("div", { className: "flex h-full flex-col rounded-lg border border-zinc-300 bg-white px-[6px]", children: /* @__PURE__ */ jsx61("div", { className: "relative min-h-0 flex-1", children: /* @__PURE__ */ jsx61("div", { className: "absolute inset-0", children: /* @__PURE__ */ jsx61(
|
|
8692
9146
|
QueryEditor,
|
|
8693
9147
|
{
|
|
8694
9148
|
value: editorValue,
|
|
@@ -8698,7 +9152,7 @@ var QueryBuilder = () => {
|
|
|
8698
9152
|
},
|
|
8699
9153
|
schema: indexDetails
|
|
8700
9154
|
}
|
|
8701
|
-
) }) });
|
|
9155
|
+
) }) }) });
|
|
8702
9156
|
};
|
|
8703
9157
|
|
|
8704
9158
|
// src/components/databrowser/components/query-builder-error.tsx
|
|
@@ -9260,7 +9714,7 @@ function Sidebar() {
|
|
|
9260
9714
|
{
|
|
9261
9715
|
query,
|
|
9262
9716
|
disableRoundedInherit: true,
|
|
9263
|
-
className: "min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4 dark:bg-zinc-200",
|
|
9717
|
+
className: "h-full min-h-0 rounded-xl bg-zinc-100 px-2 py-5 pr-4 dark:bg-zinc-200",
|
|
9264
9718
|
scrollBarClassName: "py-5",
|
|
9265
9719
|
children: /* @__PURE__ */ jsx69(KeysList, {})
|
|
9266
9720
|
}
|
|
@@ -9275,22 +9729,13 @@ import { useCallback as useCallback4, useEffect as useEffect22, useRef as useRef
|
|
|
9275
9729
|
import { createContext as createContext7, useCallback as useCallback2, useContext as useContext7, useMemo as useMemo10 } from "react";
|
|
9276
9730
|
|
|
9277
9731
|
// src/components/databrowser/components/ui-query-builder/types.ts
|
|
9278
|
-
var STRING_OPERATORS = [
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
"ne",
|
|
9282
|
-
"in",
|
|
9283
|
-
"phrase",
|
|
9284
|
-
"regex",
|
|
9285
|
-
"fuzzy"
|
|
9286
|
-
];
|
|
9287
|
-
var NUMBER_OPERATORS = ["eq", "ne", "gt", "gte", "lt", "lte"];
|
|
9288
|
-
var BOOLEAN_OPERATORS = ["eq", "ne"];
|
|
9732
|
+
var STRING_OPERATORS = ["smart", "eq", "in", "phrase", "regex", "fuzzy"];
|
|
9733
|
+
var NUMBER_OPERATORS = ["eq", "gt", "gte", "lt", "lte"];
|
|
9734
|
+
var BOOLEAN_OPERATORS = ["eq"];
|
|
9289
9735
|
var DATE_OPERATORS = NUMBER_OPERATORS;
|
|
9290
9736
|
var ALL_OPERATORS = [
|
|
9291
9737
|
"smart",
|
|
9292
9738
|
"eq",
|
|
9293
|
-
"ne",
|
|
9294
9739
|
"gt",
|
|
9295
9740
|
"gte",
|
|
9296
9741
|
"lt",
|
|
@@ -9302,7 +9747,6 @@ var ALL_OPERATORS = [
|
|
|
9302
9747
|
];
|
|
9303
9748
|
var OPERATOR_DESCRIPTIONS = {
|
|
9304
9749
|
eq: "Equals",
|
|
9305
|
-
ne: "Not equals",
|
|
9306
9750
|
gt: "Greater than",
|
|
9307
9751
|
gte: "Greater than or equal",
|
|
9308
9752
|
lt: "Less than",
|
|
@@ -9316,7 +9760,6 @@ var OPERATOR_DESCRIPTIONS = {
|
|
|
9316
9760
|
var OPERATOR_OPTIONS = [
|
|
9317
9761
|
{ value: "smart", label: "smart" },
|
|
9318
9762
|
{ value: "eq", label: "eq" },
|
|
9319
|
-
{ value: "ne", label: "ne" },
|
|
9320
9763
|
{ value: "gt", label: "gt" },
|
|
9321
9764
|
{ value: "gte", label: "gte" },
|
|
9322
9765
|
{ value: "lt", label: "lt" },
|
|
@@ -11089,7 +11532,7 @@ var UIQueryBuilder = () => {
|
|
|
11089
11532
|
obs.observe(el);
|
|
11090
11533
|
return () => obs.disconnect();
|
|
11091
11534
|
}, [recomputeShadows]);
|
|
11092
|
-
return /* @__PURE__ */ jsx81(QueryBuilderUIProvider, { fieldInfos, setQueryState, children: /* @__PURE__ */ jsxs48("div", { className: "relative h-full rounded-lg bg-zinc-50 dark:bg-zinc-50/40", children: [
|
|
11535
|
+
return /* @__PURE__ */ jsx81(QueryBuilderUIProvider, { fieldInfos, setQueryState, children: /* @__PURE__ */ jsxs48("div", { className: "relative h-full min-h-0 rounded-lg bg-zinc-50 dark:bg-zinc-50/40", children: [
|
|
11093
11536
|
/* @__PURE__ */ jsx81(
|
|
11094
11537
|
"div",
|
|
11095
11538
|
{
|
|
@@ -11204,7 +11647,7 @@ var QueryBuilderContent = () => {
|
|
|
11204
11647
|
setQueryBuilderMode(newMode);
|
|
11205
11648
|
};
|
|
11206
11649
|
const errorMessage = switchError ?? (query.error ? formatUpstashErrorMessage(query.error) : void 0);
|
|
11207
|
-
return /* @__PURE__ */ jsxs49("div", { className: "relative h-full", children: [
|
|
11650
|
+
return /* @__PURE__ */ jsxs49("div", { className: "relative flex h-full min-h-0 flex-col", children: [
|
|
11208
11651
|
/* @__PURE__ */ jsx82("div", { className: "absolute right-4 top-4 z-[2]", children: /* @__PURE__ */ jsx82(
|
|
11209
11652
|
Segmented,
|
|
11210
11653
|
{
|
|
@@ -11242,7 +11685,7 @@ var DatabrowserInstance = ({
|
|
|
11242
11685
|
tabType,
|
|
11243
11686
|
allowSearch
|
|
11244
11687
|
}) => {
|
|
11245
|
-
const { isValuesSearchSelected, setIsValuesSearchSelected } = useTab();
|
|
11688
|
+
const { isValuesSearchSelected, queryBuilderMode, setIsValuesSearchSelected } = useTab();
|
|
11246
11689
|
const { data: indexes, isLoading } = useFetchSearchIndexes({
|
|
11247
11690
|
enabled: tabType === "search"
|
|
11248
11691
|
});
|
|
@@ -11271,9 +11714,18 @@ var DatabrowserInstance = ({
|
|
|
11271
11714
|
{
|
|
11272
11715
|
autoSaveId: "search-layout",
|
|
11273
11716
|
direction: "vertical",
|
|
11274
|
-
className: "h-full w-full text-sm antialiased",
|
|
11717
|
+
className: "h-full w-full !overflow-visible text-sm antialiased",
|
|
11275
11718
|
children: [
|
|
11276
|
-
/* @__PURE__ */ jsx82(
|
|
11719
|
+
/* @__PURE__ */ jsx82(
|
|
11720
|
+
Panel,
|
|
11721
|
+
{
|
|
11722
|
+
defaultSize: 30,
|
|
11723
|
+
minSize: 15,
|
|
11724
|
+
maxSize: 60,
|
|
11725
|
+
className: queryBuilderMode === "code" ? "!overflow-visible" : "",
|
|
11726
|
+
children: /* @__PURE__ */ jsx82(SearchContent, {})
|
|
11727
|
+
}
|
|
11728
|
+
),
|
|
11277
11729
|
/* @__PURE__ */ jsx82(ResizeHandle, { direction: "vertical" }),
|
|
11278
11730
|
/* @__PURE__ */ jsx82(Panel, { minSize: 30, children: /* @__PURE__ */ jsxs49(PanelGroup, { autoSaveId: "persistence", direction: "horizontal", className: "h-full w-full", children: [
|
|
11279
11731
|
/* @__PURE__ */ jsx82(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx82(Sidebar, {}) }),
|