@upstash/react-redis-browser 0.1.5 → 0.1.6-canary

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.js CHANGED
@@ -132,9 +132,12 @@ function useToast() {
132
132
  }
133
133
 
134
134
  // src/lib/clients.ts
135
- var redisClient = (databrowser) => {
136
- const token = _optionalChain([databrowser, 'optionalAccess', _2 => _2.token]) || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
137
- const url = _optionalChain([databrowser, 'optionalAccess', _3 => _3.url]) || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL;
135
+ var redisClient = ({
136
+ credentials,
137
+ pipelining
138
+ }) => {
139
+ const token = _optionalChain([credentials, 'optionalAccess', _2 => _2.token]) || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
140
+ const url = _optionalChain([credentials, 'optionalAccess', _3 => _3.url]) || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL;
138
141
  if (!url) {
139
142
  throw new Error("Redis URL is missing!");
140
143
  }
@@ -144,7 +147,7 @@ var redisClient = (databrowser) => {
144
147
  const redis = new (0, _redis.Redis)({
145
148
  url,
146
149
  token,
147
- enableAutoPipelining: true,
150
+ enableAutoPipelining: pipelining,
148
151
  automaticDeserialization: false,
149
152
  keepAlive: false
150
153
  });
@@ -184,11 +187,12 @@ var DatabrowserProvider = ({
184
187
  children,
185
188
  redisCredentials
186
189
  }) => {
187
- const redisInstance = _react.useMemo.call(void 0, () => redisClient(redisCredentials), [redisCredentials]);
190
+ const redisInstance = _react.useMemo.call(void 0, () => redisClient({ credentials: redisCredentials, pipelining: true }), [redisCredentials]);
191
+ const redisInstanceNoPipeline = _react.useMemo.call(void 0, () => redisClient({ credentials: redisCredentials, pipelining: false }), [redisCredentials]);
188
192
  const [store] = _react.useState.call(void 0, () => {
189
193
  return createDatabrowserStore();
190
194
  });
191
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserContext.Provider, { value: { redis: redisInstance, store }, children });
195
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserContext.Provider, { value: { redis: redisInstance, redisNoPipeline: redisInstanceNoPipeline, store }, children });
192
196
  };
193
197
  var useDatabrowser = () => {
194
198
  const context = _react.useContext.call(void 0, DatabrowserContext);
@@ -2938,7 +2942,7 @@ var DATA_TYPE_NAMES = {
2938
2942
  var PAGE_SIZE = 30;
2939
2943
  var FETCH_COUNTS = [100, 200, 400, 800];
2940
2944
  var useFetchKeys = (search) => {
2941
- const { redis } = useDatabrowser();
2945
+ const { redisNoPipeline: redis } = useDatabrowser();
2942
2946
  const cache = _react.useRef.call(void 0, );
2943
2947
  const lastKey = _react.useRef.call(void 0, );
2944
2948
  const fetchKeys = _react.useCallback.call(void 0, () => {
@@ -3270,7 +3274,7 @@ var useAddKey = () => {
3270
3274
 
3271
3275
  var FETCH_SIMPLE_KEY_QUERY_KEY = "fetch-simple-key";
3272
3276
  var useFetchSimpleKey = (dataKey, type) => {
3273
- const { redis } = useDatabrowser();
3277
+ const { redisNoPipeline: redis } = useDatabrowser();
3274
3278
  const { deleteKeyCache } = useDeleteKeyCache();
3275
3279
  return _reactquery.useQuery.call(void 0, {
3276
3280
  queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY, dataKey],
@@ -3341,7 +3345,7 @@ var useDeleteKey = () => {
3341
3345
  var LIST_DISPLAY_PAGE_SIZE = 50;
3342
3346
  var FETCH_LIST_ITEMS_QUERY_KEY = "use-fetch-list-items";
3343
3347
  var useFetchListItems = ({ dataKey, type }) => {
3344
- const { redis } = useDatabrowser();
3348
+ const { redisNoPipeline: redis } = useDatabrowser();
3345
3349
  const setQuery = _reactquery.useInfiniteQuery.call(void 0, {
3346
3350
  enabled: type === "set",
3347
3351
  queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "set"],
package/dist/index.mjs CHANGED
@@ -132,9 +132,12 @@ function useToast() {
132
132
  }
133
133
 
134
134
  // src/lib/clients.ts
135
- var redisClient = (databrowser) => {
136
- const token = databrowser?.token || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
137
- const url = databrowser?.url || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL;
135
+ var redisClient = ({
136
+ credentials,
137
+ pipelining
138
+ }) => {
139
+ const token = credentials?.token || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
140
+ const url = credentials?.url || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL;
138
141
  if (!url) {
139
142
  throw new Error("Redis URL is missing!");
140
143
  }
@@ -144,7 +147,7 @@ var redisClient = (databrowser) => {
144
147
  const redis = new Redis({
145
148
  url,
146
149
  token,
147
- enableAutoPipelining: true,
150
+ enableAutoPipelining: pipelining,
148
151
  automaticDeserialization: false,
149
152
  keepAlive: false
150
153
  });
@@ -184,11 +187,12 @@ var DatabrowserProvider = ({
184
187
  children,
185
188
  redisCredentials
186
189
  }) => {
187
- const redisInstance = useMemo(() => redisClient(redisCredentials), [redisCredentials]);
190
+ const redisInstance = useMemo(() => redisClient({ credentials: redisCredentials, pipelining: true }), [redisCredentials]);
191
+ const redisInstanceNoPipeline = useMemo(() => redisClient({ credentials: redisCredentials, pipelining: false }), [redisCredentials]);
188
192
  const [store] = useState2(() => {
189
193
  return createDatabrowserStore();
190
194
  });
191
- return /* @__PURE__ */ jsx(DatabrowserContext.Provider, { value: { redis: redisInstance, store }, children });
195
+ return /* @__PURE__ */ jsx(DatabrowserContext.Provider, { value: { redis: redisInstance, redisNoPipeline: redisInstanceNoPipeline, store }, children });
192
196
  };
193
197
  var useDatabrowser = () => {
194
198
  const context = useContext(DatabrowserContext);
@@ -2938,7 +2942,7 @@ var DATA_TYPE_NAMES = {
2938
2942
  var PAGE_SIZE = 30;
2939
2943
  var FETCH_COUNTS = [100, 200, 400, 800];
2940
2944
  var useFetchKeys = (search) => {
2941
- const { redis } = useDatabrowser();
2945
+ const { redisNoPipeline: redis } = useDatabrowser();
2942
2946
  const cache = useRef();
2943
2947
  const lastKey = useRef();
2944
2948
  const fetchKeys = useCallback(() => {
@@ -3270,7 +3274,7 @@ import { useCallback as useCallback3 } from "react";
3270
3274
  import { useQuery as useQuery2 } from "@tanstack/react-query";
3271
3275
  var FETCH_SIMPLE_KEY_QUERY_KEY = "fetch-simple-key";
3272
3276
  var useFetchSimpleKey = (dataKey, type) => {
3273
- const { redis } = useDatabrowser();
3277
+ const { redisNoPipeline: redis } = useDatabrowser();
3274
3278
  const { deleteKeyCache } = useDeleteKeyCache();
3275
3279
  return useQuery2({
3276
3280
  queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY, dataKey],
@@ -3341,7 +3345,7 @@ import { useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
3341
3345
  var LIST_DISPLAY_PAGE_SIZE = 50;
3342
3346
  var FETCH_LIST_ITEMS_QUERY_KEY = "use-fetch-list-items";
3343
3347
  var useFetchListItems = ({ dataKey, type }) => {
3344
- const { redis } = useDatabrowser();
3348
+ const { redisNoPipeline: redis } = useDatabrowser();
3345
3349
  const setQuery = useInfiniteQuery2({
3346
3350
  enabled: type === "set",
3347
3351
  queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "set"],
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "v0.1.5", "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-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.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" } }
1
+ { "name": "@upstash/react-redis-browser", "version": "v0.1.6-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": { "@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-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.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" } }