@upstash/react-redis-browser 0.1.2-canary-6 → 0.1.2-canary-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +4 -0
- package/dist/index.js +29 -15
- package/dist/index.mjs +29 -15
- package/package.json +1 -1
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -3037,7 +3037,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3037
3037
|
queryKey: [FETCH_KEYS_QUERY_KEY, search],
|
|
3038
3038
|
initialPageParam: 0,
|
|
3039
3039
|
queryFn: async ({ pageParam: page }) => {
|
|
3040
|
-
if (pageRef.current
|
|
3040
|
+
if (pageRef.current >= page) resetCache();
|
|
3041
3041
|
pageRef.current = page;
|
|
3042
3042
|
return await fetchKeys();
|
|
3043
3043
|
},
|
|
@@ -3176,39 +3176,39 @@ var useAddKey = () => {
|
|
|
3176
3176
|
mutationFn: async ({ key, type }) => {
|
|
3177
3177
|
switch (type) {
|
|
3178
3178
|
case "set": {
|
|
3179
|
-
redis.sadd(key, "value");
|
|
3179
|
+
await redis.sadd(key, "value");
|
|
3180
3180
|
break;
|
|
3181
3181
|
}
|
|
3182
3182
|
case "zset": {
|
|
3183
|
-
redis.zadd(key, {
|
|
3183
|
+
await redis.zadd(key, {
|
|
3184
3184
|
member: "value",
|
|
3185
3185
|
score: 0
|
|
3186
3186
|
});
|
|
3187
3187
|
break;
|
|
3188
3188
|
}
|
|
3189
3189
|
case "hash": {
|
|
3190
|
-
redis.hset(key, {
|
|
3190
|
+
await redis.hset(key, {
|
|
3191
3191
|
field: "field",
|
|
3192
3192
|
value: "value"
|
|
3193
3193
|
});
|
|
3194
3194
|
break;
|
|
3195
3195
|
}
|
|
3196
3196
|
case "list": {
|
|
3197
|
-
redis.lpush(key, "value");
|
|
3197
|
+
await redis.lpush(key, "value");
|
|
3198
3198
|
break;
|
|
3199
3199
|
}
|
|
3200
3200
|
case "stream": {
|
|
3201
|
-
redis.xadd(key, "*", {
|
|
3201
|
+
await redis.xadd(key, "*", {
|
|
3202
3202
|
foo: "bar"
|
|
3203
3203
|
});
|
|
3204
3204
|
break;
|
|
3205
3205
|
}
|
|
3206
3206
|
case "string": {
|
|
3207
|
-
redis.set(key, "value");
|
|
3207
|
+
await redis.set(key, "value");
|
|
3208
3208
|
break;
|
|
3209
3209
|
}
|
|
3210
3210
|
case "json": {
|
|
3211
|
-
redis.json.set(key, "$", {
|
|
3211
|
+
await redis.json.set(key, "$", {
|
|
3212
3212
|
foo: "bar"
|
|
3213
3213
|
});
|
|
3214
3214
|
break;
|
|
@@ -4270,7 +4270,7 @@ var Spinner = ({
|
|
|
4270
4270
|
strokeWidth: "2",
|
|
4271
4271
|
strokeLinecap: "round",
|
|
4272
4272
|
strokeLinejoin: "round",
|
|
4273
|
-
className: "
|
|
4273
|
+
className: cn("h-4 w-4 animate-spin", isLoadingText ? "ml-2" : ""),
|
|
4274
4274
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
4275
4275
|
}
|
|
4276
4276
|
)
|
|
@@ -4567,7 +4567,14 @@ function KeyActions({ dataKey, content }) {
|
|
|
4567
4567
|
children: "Copy content"
|
|
4568
4568
|
}
|
|
4569
4569
|
),
|
|
4570
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4570
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4571
|
+
DeleteAlertDialog,
|
|
4572
|
+
{
|
|
4573
|
+
deletionType: "key",
|
|
4574
|
+
onDeleteConfirm: async () => await deleteKey(dataKey),
|
|
4575
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" })
|
|
4576
|
+
}
|
|
4577
|
+
)
|
|
4571
4578
|
] })
|
|
4572
4579
|
] });
|
|
4573
4580
|
}
|
|
@@ -4615,7 +4622,7 @@ var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }
|
|
|
4615
4622
|
ref,
|
|
4616
4623
|
sideOffset,
|
|
4617
4624
|
className: cn(
|
|
4618
|
-
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2
|
|
4625
|
+
"z-50 overflow-hidden rounded-md bg-zinc-900 px-3 py-1.5 text-xs text-zinc-50 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:bg-zinc-50 dark:text-zinc-900",
|
|
4619
4626
|
className
|
|
4620
4627
|
),
|
|
4621
4628
|
...props
|
|
@@ -5090,10 +5097,14 @@ var EditorDisplayForm = ({
|
|
|
5090
5097
|
|
|
5091
5098
|
var DataDisplay = () => {
|
|
5092
5099
|
const { selectedKey } = useDatabrowserStore();
|
|
5100
|
+
const { query } = useKeys();
|
|
5093
5101
|
const type = useKeyType(selectedKey);
|
|
5094
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full rounded-xl border p-1
|
|
5102
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full rounded-xl border bg-white p-1", children: !selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !type ? query.isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: type === "string" || type === "json" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5095
5103
|
};
|
|
5096
5104
|
|
|
5105
|
+
// src/components/databrowser/components/sidebar/index.tsx
|
|
5106
|
+
|
|
5107
|
+
|
|
5097
5108
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5098
5109
|
|
|
5099
5110
|
var _reactdialog = require('@radix-ui/react-dialog'); var DialogPrimitive = _interopRequireWildcard(_reactdialog);
|
|
@@ -5472,12 +5483,15 @@ function DataTypeSelector() {
|
|
|
5472
5483
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5473
5484
|
|
|
5474
5485
|
function Sidebar() {
|
|
5475
|
-
const { keys, query } = useKeys();
|
|
5476
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1
|
|
5486
|
+
const { keys, query, refetch } = useKeys();
|
|
5487
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 rounded-xl border bg-white p-1", children: [
|
|
5477
5488
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
|
|
5478
5489
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5479
5490
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayDbSize, {}),
|
|
5480
|
-
/* @__PURE__ */ _jsxruntime.
|
|
5491
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
5492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { className: "h-7 w-7 px-0", onClick: refetch, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconRefresh, { size: 16 }) }) }),
|
|
5493
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AddKeyModal, {})
|
|
5494
|
+
] })
|
|
5481
5495
|
] }),
|
|
5482
5496
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center", children: [
|
|
5483
5497
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTypeSelector, {}),
|
package/dist/index.mjs
CHANGED
|
@@ -3037,7 +3037,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3037
3037
|
queryKey: [FETCH_KEYS_QUERY_KEY, search],
|
|
3038
3038
|
initialPageParam: 0,
|
|
3039
3039
|
queryFn: async ({ pageParam: page }) => {
|
|
3040
|
-
if (pageRef.current
|
|
3040
|
+
if (pageRef.current >= page) resetCache();
|
|
3041
3041
|
pageRef.current = page;
|
|
3042
3042
|
return await fetchKeys();
|
|
3043
3043
|
},
|
|
@@ -3176,39 +3176,39 @@ var useAddKey = () => {
|
|
|
3176
3176
|
mutationFn: async ({ key, type }) => {
|
|
3177
3177
|
switch (type) {
|
|
3178
3178
|
case "set": {
|
|
3179
|
-
redis.sadd(key, "value");
|
|
3179
|
+
await redis.sadd(key, "value");
|
|
3180
3180
|
break;
|
|
3181
3181
|
}
|
|
3182
3182
|
case "zset": {
|
|
3183
|
-
redis.zadd(key, {
|
|
3183
|
+
await redis.zadd(key, {
|
|
3184
3184
|
member: "value",
|
|
3185
3185
|
score: 0
|
|
3186
3186
|
});
|
|
3187
3187
|
break;
|
|
3188
3188
|
}
|
|
3189
3189
|
case "hash": {
|
|
3190
|
-
redis.hset(key, {
|
|
3190
|
+
await redis.hset(key, {
|
|
3191
3191
|
field: "field",
|
|
3192
3192
|
value: "value"
|
|
3193
3193
|
});
|
|
3194
3194
|
break;
|
|
3195
3195
|
}
|
|
3196
3196
|
case "list": {
|
|
3197
|
-
redis.lpush(key, "value");
|
|
3197
|
+
await redis.lpush(key, "value");
|
|
3198
3198
|
break;
|
|
3199
3199
|
}
|
|
3200
3200
|
case "stream": {
|
|
3201
|
-
redis.xadd(key, "*", {
|
|
3201
|
+
await redis.xadd(key, "*", {
|
|
3202
3202
|
foo: "bar"
|
|
3203
3203
|
});
|
|
3204
3204
|
break;
|
|
3205
3205
|
}
|
|
3206
3206
|
case "string": {
|
|
3207
|
-
redis.set(key, "value");
|
|
3207
|
+
await redis.set(key, "value");
|
|
3208
3208
|
break;
|
|
3209
3209
|
}
|
|
3210
3210
|
case "json": {
|
|
3211
|
-
redis.json.set(key, "$", {
|
|
3211
|
+
await redis.json.set(key, "$", {
|
|
3212
3212
|
foo: "bar"
|
|
3213
3213
|
});
|
|
3214
3214
|
break;
|
|
@@ -4270,7 +4270,7 @@ var Spinner = ({
|
|
|
4270
4270
|
strokeWidth: "2",
|
|
4271
4271
|
strokeLinecap: "round",
|
|
4272
4272
|
strokeLinejoin: "round",
|
|
4273
|
-
className: "
|
|
4273
|
+
className: cn("h-4 w-4 animate-spin", isLoadingText ? "ml-2" : ""),
|
|
4274
4274
|
children: /* @__PURE__ */ jsx18("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
4275
4275
|
}
|
|
4276
4276
|
)
|
|
@@ -4567,7 +4567,14 @@ function KeyActions({ dataKey, content }) {
|
|
|
4567
4567
|
children: "Copy content"
|
|
4568
4568
|
}
|
|
4569
4569
|
),
|
|
4570
|
-
/* @__PURE__ */ jsx22(
|
|
4570
|
+
/* @__PURE__ */ jsx22(
|
|
4571
|
+
DeleteAlertDialog,
|
|
4572
|
+
{
|
|
4573
|
+
deletionType: "key",
|
|
4574
|
+
onDeleteConfirm: async () => await deleteKey(dataKey),
|
|
4575
|
+
children: /* @__PURE__ */ jsx22(DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" })
|
|
4576
|
+
}
|
|
4577
|
+
)
|
|
4571
4578
|
] })
|
|
4572
4579
|
] });
|
|
4573
4580
|
}
|
|
@@ -4615,7 +4622,7 @@ var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }
|
|
|
4615
4622
|
ref,
|
|
4616
4623
|
sideOffset,
|
|
4617
4624
|
className: cn(
|
|
4618
|
-
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2
|
|
4625
|
+
"z-50 overflow-hidden rounded-md bg-zinc-900 px-3 py-1.5 text-xs text-zinc-50 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:bg-zinc-50 dark:text-zinc-900",
|
|
4619
4626
|
className
|
|
4620
4627
|
),
|
|
4621
4628
|
...props
|
|
@@ -5090,10 +5097,14 @@ var EditorDisplayForm = ({
|
|
|
5090
5097
|
import { Fragment as Fragment7, jsx as jsx32 } from "react/jsx-runtime";
|
|
5091
5098
|
var DataDisplay = () => {
|
|
5092
5099
|
const { selectedKey } = useDatabrowserStore();
|
|
5100
|
+
const { query } = useKeys();
|
|
5093
5101
|
const type = useKeyType(selectedKey);
|
|
5094
|
-
return /* @__PURE__ */ jsx32("div", { className: "h-full rounded-xl border p-1
|
|
5102
|
+
return /* @__PURE__ */ jsx32("div", { className: "h-full rounded-xl border bg-white p-1", children: !selectedKey ? /* @__PURE__ */ jsx32("div", {}) : !type ? query.isLoading ? /* @__PURE__ */ jsx32("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx32("span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx32("div", {}) : /* @__PURE__ */ jsx32(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx32(EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx32(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5095
5103
|
};
|
|
5096
5104
|
|
|
5105
|
+
// src/components/databrowser/components/sidebar/index.tsx
|
|
5106
|
+
import { IconRefresh } from "@tabler/icons-react";
|
|
5107
|
+
|
|
5097
5108
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5098
5109
|
import { useState as useState8 } from "react";
|
|
5099
5110
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
@@ -5472,12 +5483,15 @@ function DataTypeSelector() {
|
|
|
5472
5483
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
5473
5484
|
import { jsx as jsx41, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5474
5485
|
function Sidebar() {
|
|
5475
|
-
const { keys, query } = useKeys();
|
|
5476
|
-
return /* @__PURE__ */ jsxs30("div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1
|
|
5486
|
+
const { keys, query, refetch } = useKeys();
|
|
5487
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex h-full flex-col gap-2 rounded-xl border bg-white p-1", children: [
|
|
5477
5488
|
/* @__PURE__ */ jsxs30("div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
|
|
5478
5489
|
/* @__PURE__ */ jsxs30("div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5479
5490
|
/* @__PURE__ */ jsx41(DisplayDbSize, {}),
|
|
5480
|
-
/* @__PURE__ */
|
|
5491
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex gap-1", children: [
|
|
5492
|
+
/* @__PURE__ */ jsx41(Button, { className: "h-7 w-7 px-0", onClick: refetch, children: /* @__PURE__ */ jsx41(Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ jsx41(IconRefresh, { size: 16 }) }) }),
|
|
5493
|
+
/* @__PURE__ */ jsx41(AddKeyModal, {})
|
|
5494
|
+
] })
|
|
5481
5495
|
] }),
|
|
5482
5496
|
/* @__PURE__ */ jsxs30("div", { className: "flex h-10 items-center", children: [
|
|
5483
5497
|
/* @__PURE__ */ jsx41(DataTypeSelector, {}),
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@upstash/react-redis-browser", "version": "v0.1.2-canary-
|
|
1
|
+
{ "name": "@upstash/react-redis-browser", "version": "v0.1.2-canary-7", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ./src" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "1.3.0", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "^1.34.3", "bytes": "^3.1.2", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "postcss-prefix-selector": "^2.1.0", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }
|