@upstash/react-redis-browser 0.2.11-canary → 0.2.11

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.d.mts CHANGED
@@ -3,7 +3,13 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  type DarkModeOption = "dark" | "light";
4
4
 
5
5
  type RedisCredentials = {
6
+ /**
7
+ * The URL of the redis database.
8
+ */
6
9
  url?: string;
10
+ /**
11
+ * The token of the redis database.
12
+ */
7
13
  token?: string;
8
14
  };
9
15
 
@@ -14,7 +20,19 @@ type RedisBrowserStorage = {
14
20
  set: (value: string) => void;
15
21
  get: () => string | null;
16
22
  };
17
- declare const RedisBrowser: ({ token, url, hideTabs, storage, onFullScreenClick, theme, }: RedisCredentials & {
23
+ declare const RedisBrowser: ({ url, token, hideTabs, storage, disableTelemetry, onFullScreenClick, theme, }: RedisCredentials & {
24
+ /**
25
+ * Whether to disable telemetry.
26
+ *
27
+ * The redis client sends telemetry data to help us improve your experience.
28
+ * We collect the following:
29
+ * - SDK version
30
+ * - Platform (Deno, Cloudflare, Vercel)
31
+ * - Runtime version (node@18.x)
32
+ *
33
+ * @default false
34
+ */
35
+ disableTelemetry?: boolean;
18
36
  hideTabs?: boolean;
19
37
  /**
20
38
  * If defined, the databrowser will have a full screen button in the tab bar.
package/dist/index.d.ts CHANGED
@@ -3,7 +3,13 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  type DarkModeOption = "dark" | "light";
4
4
 
5
5
  type RedisCredentials = {
6
+ /**
7
+ * The URL of the redis database.
8
+ */
6
9
  url?: string;
10
+ /**
11
+ * The token of the redis database.
12
+ */
7
13
  token?: string;
8
14
  };
9
15
 
@@ -14,7 +20,19 @@ type RedisBrowserStorage = {
14
20
  set: (value: string) => void;
15
21
  get: () => string | null;
16
22
  };
17
- declare const RedisBrowser: ({ token, url, hideTabs, storage, onFullScreenClick, theme, }: RedisCredentials & {
23
+ declare const RedisBrowser: ({ url, token, hideTabs, storage, disableTelemetry, onFullScreenClick, theme, }: RedisCredentials & {
24
+ /**
25
+ * Whether to disable telemetry.
26
+ *
27
+ * The redis client sends telemetry data to help us improve your experience.
28
+ * We collect the following:
29
+ * - SDK version
30
+ * - Platform (Deno, Cloudflare, Vercel)
31
+ * - Runtime version (node@18.x)
32
+ *
33
+ * @default false
34
+ */
35
+ disableTelemetry?: boolean;
18
36
  hideTabs?: boolean;
19
37
  /**
20
38
  * If defined, the databrowser will have a full screen button in the tab bar.
package/dist/index.js CHANGED
@@ -151,7 +151,8 @@ function useToast() {
151
151
  // src/lib/clients.ts
152
152
  var redisClient = ({
153
153
  credentials,
154
- pipelining
154
+ pipelining,
155
+ telemetry
155
156
  }) => {
156
157
  const safeProcess = typeof process === "undefined" ? { env: {} } : process;
157
158
  const token = _optionalChain([credentials, 'optionalAccess', _2 => _2.token]) || safeProcess.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
@@ -167,7 +168,8 @@ var redisClient = ({
167
168
  token,
168
169
  enableAutoPipelining: pipelining,
169
170
  automaticDeserialization: false,
170
- keepAlive: false
171
+ keepAlive: false,
172
+ enableTelemetry: telemetry
171
173
  });
172
174
  return redis;
173
175
  };
@@ -203,15 +205,16 @@ var queryClient = new (0, _reactquery.QueryClient)({
203
205
  var RedisContext = _react.createContext.call(void 0, void 0);
204
206
  var RedisProvider = ({
205
207
  children,
206
- redisCredentials
208
+ redisCredentials,
209
+ telemetry
207
210
  }) => {
208
211
  const redisInstance = _react.useMemo.call(void 0,
209
- () => redisClient({ credentials: redisCredentials, pipelining: true }),
210
- [redisCredentials]
212
+ () => redisClient({ credentials: redisCredentials, pipelining: true, telemetry }),
213
+ [redisCredentials, telemetry]
211
214
  );
212
215
  const redisInstanceNoPipeline = _react.useMemo.call(void 0,
213
- () => redisClient({ credentials: redisCredentials, pipelining: false }),
214
- [redisCredentials]
216
+ () => redisClient({ credentials: redisCredentials, pipelining: false, telemetry }),
217
+ [redisCredentials, telemetry]
215
218
  );
216
219
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
217
220
  RedisContext.Provider,
@@ -3811,7 +3814,7 @@ var useFetchKeySize = (dataKey) => {
3811
3814
  return _reactquery.useQuery.call(void 0, {
3812
3815
  queryKey: [FETCH_KEY_SIZE_QUERY_KEY, dataKey],
3813
3816
  queryFn: async () => {
3814
- return await redis.eval(`return redis.call("MEMORY", "USAGE", KEYS[1])`, [dataKey], []);
3817
+ return await redis.exec(["MEMORY", "USAGE", dataKey]);
3815
3818
  }
3816
3819
  });
3817
3820
  };
@@ -6782,10 +6785,11 @@ function TabsListButton({
6782
6785
  // src/components/databrowser/index.tsx
6783
6786
 
6784
6787
  var RedisBrowser = ({
6785
- token,
6786
6788
  url,
6789
+ token,
6787
6790
  hideTabs,
6788
6791
  storage,
6792
+ disableTelemetry,
6789
6793
  onFullScreenClick,
6790
6794
  theme = "light"
6791
6795
  }) => {
@@ -6794,7 +6798,7 @@ var RedisBrowser = ({
6794
6798
  _react.useEffect.call(void 0, () => {
6795
6799
  queryClient.resetQueries();
6796
6800
  }, [credentials.url]);
6797
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RedisProvider, { redisCredentials: credentials, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DarkModeProvider, { theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacttooltip.TooltipProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6801
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RedisProvider, { redisCredentials: credentials, telemetry: !disableTelemetry, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DarkModeProvider, { theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacttooltip.TooltipProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
6798
6802
  RedisBrowserRoot,
6799
6803
  {
6800
6804
  hideTabs,
package/dist/index.mjs CHANGED
@@ -151,7 +151,8 @@ function useToast() {
151
151
  // src/lib/clients.ts
152
152
  var redisClient = ({
153
153
  credentials,
154
- pipelining
154
+ pipelining,
155
+ telemetry
155
156
  }) => {
156
157
  const safeProcess = typeof process === "undefined" ? { env: {} } : process;
157
158
  const token = credentials?.token || safeProcess.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
@@ -167,7 +168,8 @@ var redisClient = ({
167
168
  token,
168
169
  enableAutoPipelining: pipelining,
169
170
  automaticDeserialization: false,
170
- keepAlive: false
171
+ keepAlive: false,
172
+ enableTelemetry: telemetry
171
173
  });
172
174
  return redis;
173
175
  };
@@ -203,15 +205,16 @@ import { jsx as jsx2 } from "react/jsx-runtime";
203
205
  var RedisContext = createContext2(void 0);
204
206
  var RedisProvider = ({
205
207
  children,
206
- redisCredentials
208
+ redisCredentials,
209
+ telemetry
207
210
  }) => {
208
211
  const redisInstance = useMemo(
209
- () => redisClient({ credentials: redisCredentials, pipelining: true }),
210
- [redisCredentials]
212
+ () => redisClient({ credentials: redisCredentials, pipelining: true, telemetry }),
213
+ [redisCredentials, telemetry]
211
214
  );
212
215
  const redisInstanceNoPipeline = useMemo(
213
- () => redisClient({ credentials: redisCredentials, pipelining: false }),
214
- [redisCredentials]
216
+ () => redisClient({ credentials: redisCredentials, pipelining: false, telemetry }),
217
+ [redisCredentials, telemetry]
215
218
  );
216
219
  return /* @__PURE__ */ jsx2(
217
220
  RedisContext.Provider,
@@ -3811,7 +3814,7 @@ var useFetchKeySize = (dataKey) => {
3811
3814
  return useQuery5({
3812
3815
  queryKey: [FETCH_KEY_SIZE_QUERY_KEY, dataKey],
3813
3816
  queryFn: async () => {
3814
- return await redis.eval(`return redis.call("MEMORY", "USAGE", KEYS[1])`, [dataKey], []);
3817
+ return await redis.exec(["MEMORY", "USAGE", dataKey]);
3815
3818
  }
3816
3819
  });
3817
3820
  };
@@ -6782,10 +6785,11 @@ function TabsListButton({
6782
6785
  // src/components/databrowser/index.tsx
6783
6786
  import { jsx as jsx54, jsxs as jsxs36 } from "react/jsx-runtime";
6784
6787
  var RedisBrowser = ({
6785
- token,
6786
6788
  url,
6789
+ token,
6787
6790
  hideTabs,
6788
6791
  storage,
6792
+ disableTelemetry,
6789
6793
  onFullScreenClick,
6790
6794
  theme = "light"
6791
6795
  }) => {
@@ -6794,7 +6798,7 @@ var RedisBrowser = ({
6794
6798
  useEffect14(() => {
6795
6799
  queryClient.resetQueries();
6796
6800
  }, [credentials.url]);
6797
- return /* @__PURE__ */ jsx54(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx54(RedisProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsx54(DarkModeProvider, { theme, children: /* @__PURE__ */ jsx54(DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ jsx54(TooltipProvider, { children: /* @__PURE__ */ jsx54(
6801
+ return /* @__PURE__ */ jsx54(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx54(RedisProvider, { redisCredentials: credentials, telemetry: !disableTelemetry, children: /* @__PURE__ */ jsx54(DarkModeProvider, { theme, children: /* @__PURE__ */ jsx54(DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ jsx54(TooltipProvider, { children: /* @__PURE__ */ jsx54(
6798
6802
  RedisBrowserRoot,
6799
6803
  {
6800
6804
  hideTabs,
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "v0.2.11-canary", "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": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", "@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.1.14", "@radix-ui/react-dropdown-menu": "^2.1.15", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@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.35.7", "bytes": "^3.1.2", "cmdk": "^1.1.1", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "@playwright/test": "^1.56.1", "@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", "dotenv": "^16.5.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "postcss-prefix-selector": "^2.1.0", "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" } }
1
+ { "name": "@upstash/react-redis-browser", "version": "v0.2.11", "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": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", "@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.1.14", "@radix-ui/react-dropdown-menu": "^2.1.15", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@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.35.8", "bytes": "^3.1.2", "cmdk": "^1.1.1", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "@playwright/test": "^1.56.1", "@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", "dotenv": "^16.5.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "postcss-prefix-selector": "^2.1.0", "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" } }