@upstash/react-redis-browser 0.1.2-canary-2 → 0.1.2-canary-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -25
- package/dist/index.css +0 -5
- package/dist/index.js +7 -10
- package/dist/index.mjs +2 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,17 @@
|
|
|
1
1
|
# RedisBrowser for Upstash Redis
|
|
2
|
+
`@upstash/react-redis-browser` is a React component that provides a UI for browsing and editing data in your Upstash Redis instances.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
<img src="public%2Fredis-browser.png" width="640px" />
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- [Install](#1-install)
|
|
8
|
-
- [Configuration](#2-configuration)
|
|
9
|
-
- [Usage](#3-usage)
|
|
10
|
-
|
|
11
|
-
## 1. Install
|
|
6
|
+
### Install
|
|
12
7
|
|
|
13
8
|
Install the databrowser component via npm:
|
|
14
9
|
|
|
15
|
-
```
|
|
10
|
+
```bash
|
|
16
11
|
$ npm install @upstash/react-redis-browser
|
|
17
12
|
```
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
### Environment Variables
|
|
22
|
-
|
|
23
|
-
Configure your Upstash Redis REST URL and token as environment variables:
|
|
24
|
-
|
|
25
|
-
```sh-session
|
|
26
|
-
NEXT_PUBLIC_UPSTASH_REDIS_REST_URL=YOUR_REDIS_REST_URL
|
|
27
|
-
NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN=YOUR_REDIS_REST_TOKEN
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## 3. Usage
|
|
31
|
-
|
|
32
|
-
### Creating the Data Browser Component
|
|
33
|
-
|
|
34
|
-
In your React application, create a new component that will utilize @upstash/react-redis-browser.
|
|
14
|
+
### Usage
|
|
35
15
|
|
|
36
16
|
Here's a basic example of how to use the component:
|
|
37
17
|
|
package/dist/index.css
CHANGED
|
@@ -360,11 +360,6 @@
|
|
|
360
360
|
max-width: 1536px;
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
.ups-db input[type=number].plain-input::-webkit-inner-spin-button,
|
|
364
|
-
.ups-db input[type=number].plain-input::-webkit-outer-spin-button {
|
|
365
|
-
-webkit-appearance: none;
|
|
366
|
-
margin: 0;
|
|
367
|
-
}
|
|
368
363
|
.ups-db .sr-only {
|
|
369
364
|
position: absolute;
|
|
370
365
|
width: 1px;
|
package/dist/index.js
CHANGED
|
@@ -4552,8 +4552,6 @@ var DisplayHeader = ({
|
|
|
4552
4552
|
type,
|
|
4553
4553
|
content
|
|
4554
4554
|
}) => {
|
|
4555
|
-
const size = _optionalChain([content, 'optionalAccess', _21 => _21.length]);
|
|
4556
|
-
const length = _optionalChain([content, 'optionalAccess', _22 => _22.length]);
|
|
4557
4555
|
const { setSelectedListItem } = useDatabrowserStore();
|
|
4558
4556
|
const handleAddItem = () => {
|
|
4559
4557
|
setSelectedListItem({ key: type === "stream" ? "*" : "", value: "", isNew: true });
|
|
@@ -4570,7 +4568,6 @@ var DisplayHeader = ({
|
|
|
4570
4568
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: type, type: "badge" }),
|
|
4571
4569
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SizeBadge, { dataKey }),
|
|
4572
4570
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LengthBadge, { dataKey, type, content }),
|
|
4573
|
-
length && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Badge, { label: "Length:", children: size }),
|
|
4574
4571
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TTLBadge, { dataKey })
|
|
4575
4572
|
] })
|
|
4576
4573
|
] });
|
|
@@ -4685,7 +4682,7 @@ var CustomEditor = ({
|
|
|
4685
4682
|
if (!monaco || !editorRef.current) {
|
|
4686
4683
|
return;
|
|
4687
4684
|
}
|
|
4688
|
-
_optionalChain([monaco, 'optionalAccess',
|
|
4685
|
+
_optionalChain([monaco, 'optionalAccess', _21 => _21.editor, 'access', _22 => _22.setModelLanguage, 'call', _23 => _23(editorRef.current.getModel(), language)]);
|
|
4689
4686
|
}, [monaco, language]);
|
|
4690
4687
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4691
4688
|
"div",
|
|
@@ -4935,7 +4932,7 @@ var ListItems = ({
|
|
|
4935
4932
|
dataKey
|
|
4936
4933
|
}) => {
|
|
4937
4934
|
const { setSelectedListItem } = useDatabrowserStore();
|
|
4938
|
-
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access',
|
|
4935
|
+
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _24 => _24.data, 'optionalAccess', _25 => _25.pages, 'access', _26 => _26.flatMap, 'call', _27 => _27((page) => page.keys)]), () => ( [])), [query.data]);
|
|
4939
4936
|
const { mutate: editItem } = useEditListItem();
|
|
4940
4937
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4941
4938
|
ItemContextMenu,
|
|
@@ -5058,7 +5055,7 @@ var EditorDisplayForm = ({
|
|
|
5058
5055
|
var DataDisplay = () => {
|
|
5059
5056
|
const { selectedKey } = useDatabrowserStore();
|
|
5060
5057
|
const type = useKeyType(selectedKey);
|
|
5061
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full rounded-xl border p-1", children: !selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !type ? /* @__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, _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 }) }) });
|
|
5058
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full rounded-xl border p-1 bg-white", children: !selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !type ? /* @__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, _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 }) }) });
|
|
5062
5059
|
};
|
|
5063
5060
|
|
|
5064
5061
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
@@ -5185,7 +5182,7 @@ function AddKeyModal() {
|
|
|
5185
5182
|
setSelectedKey(key);
|
|
5186
5183
|
setOpen(false);
|
|
5187
5184
|
setTimeout(() => {
|
|
5188
|
-
_optionalChain([window, 'access',
|
|
5185
|
+
_optionalChain([window, 'access', _28 => _28.document, 'access', _29 => _29.querySelector, 'call', _30 => _30(`[data-key="${key}"]`), 'optionalAccess', _31 => _31.scrollIntoView, 'call', _32 => _32({
|
|
5189
5186
|
behavior: "smooth",
|
|
5190
5187
|
block: "start",
|
|
5191
5188
|
inline: "nearest"
|
|
@@ -5235,7 +5232,7 @@ function AddKeyModal() {
|
|
|
5235
5232
|
}
|
|
5236
5233
|
)
|
|
5237
5234
|
] }),
|
|
5238
|
-
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access',
|
|
5235
|
+
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _33 => _33.errors, 'access', _34 => _34.key, 'optionalAccess', _35 => _35.message]) }),
|
|
5239
5236
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
5240
5237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5241
5238
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5316,7 +5313,7 @@ var SidebarContextMenu = ({
|
|
|
5316
5313
|
|
|
5317
5314
|
var KeysList = () => {
|
|
5318
5315
|
const { keys } = useKeys();
|
|
5319
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pr-3", children: keys.map((data, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyItem, { nextKey: _nullishCoalesce(_optionalChain([keys, 'access',
|
|
5316
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pr-3", children: keys.map((data, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyItem, { nextKey: _nullishCoalesce(_optionalChain([keys, 'access', _36 => _36.at, 'call', _37 => _37(i + 1), 'optionalAccess', _38 => _38[0]]), () => ( "")), data }, data[0])) });
|
|
5320
5317
|
};
|
|
5321
5318
|
var keyStyles = {
|
|
5322
5319
|
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
@@ -5425,7 +5422,7 @@ function DataTypeSelector() {
|
|
|
5425
5422
|
|
|
5426
5423
|
function Sidebar() {
|
|
5427
5424
|
const { keys, query } = useKeys();
|
|
5428
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1", children: [
|
|
5425
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1 bg-white", children: [
|
|
5429
5426
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
|
|
5430
5427
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5431
5428
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayDbSize, {}),
|
package/dist/index.mjs
CHANGED
|
@@ -4552,8 +4552,6 @@ var DisplayHeader = ({
|
|
|
4552
4552
|
type,
|
|
4553
4553
|
content
|
|
4554
4554
|
}) => {
|
|
4555
|
-
const size = content?.length;
|
|
4556
|
-
const length = content?.length;
|
|
4557
4555
|
const { setSelectedListItem } = useDatabrowserStore();
|
|
4558
4556
|
const handleAddItem = () => {
|
|
4559
4557
|
setSelectedListItem({ key: type === "stream" ? "*" : "", value: "", isNew: true });
|
|
@@ -4570,7 +4568,6 @@ var DisplayHeader = ({
|
|
|
4570
4568
|
/* @__PURE__ */ jsx23(TypeTag, { variant: type, type: "badge" }),
|
|
4571
4569
|
/* @__PURE__ */ jsx23(SizeBadge, { dataKey }),
|
|
4572
4570
|
/* @__PURE__ */ jsx23(LengthBadge, { dataKey, type, content }),
|
|
4573
|
-
length && /* @__PURE__ */ jsx23(Badge, { label: "Length:", children: size }),
|
|
4574
4571
|
/* @__PURE__ */ jsx23(TTLBadge, { dataKey })
|
|
4575
4572
|
] })
|
|
4576
4573
|
] });
|
|
@@ -5058,7 +5055,7 @@ import { Fragment as Fragment7, jsx as jsx32 } from "react/jsx-runtime";
|
|
|
5058
5055
|
var DataDisplay = () => {
|
|
5059
5056
|
const { selectedKey } = useDatabrowserStore();
|
|
5060
5057
|
const type = useKeyType(selectedKey);
|
|
5061
|
-
return /* @__PURE__ */ jsx32("div", { className: "h-full rounded-xl border p-1", children: !selectedKey ? /* @__PURE__ */ jsx32("div", {}) : !type ? /* @__PURE__ */ jsx32("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx32("span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx32(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx32(EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx32(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5058
|
+
return /* @__PURE__ */ jsx32("div", { className: "h-full rounded-xl border p-1 bg-white", children: !selectedKey ? /* @__PURE__ */ jsx32("div", {}) : !type ? /* @__PURE__ */ jsx32("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx32("span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx32(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx32(EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx32(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5062
5059
|
};
|
|
5063
5060
|
|
|
5064
5061
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
@@ -5425,7 +5422,7 @@ function DataTypeSelector() {
|
|
|
5425
5422
|
import { jsx as jsx41, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5426
5423
|
function Sidebar() {
|
|
5427
5424
|
const { keys, query } = useKeys();
|
|
5428
|
-
return /* @__PURE__ */ jsxs30("div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1", children: [
|
|
5425
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1 bg-white", children: [
|
|
5429
5426
|
/* @__PURE__ */ jsxs30("div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
|
|
5430
5427
|
/* @__PURE__ */ jsxs30("div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5431
5428
|
/* @__PURE__ */ jsx41(DisplayDbSize, {}),
|
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-4", "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 ." }, "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.31.6", "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" } }
|