@upstash/react-redis-browser 0.2.14-rc.9 → 0.2.14
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 +258 -60
- package/dist/index.d.mts +48 -2
- package/dist/index.d.ts +48 -2
- package/dist/index.js +2293 -1182
- package/dist/index.mjs +2950 -1839
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Redis } from '@upstash/redis';
|
|
2
3
|
|
|
3
4
|
type DarkModeOption = "dark" | "light";
|
|
4
5
|
|
|
@@ -13,6 +14,24 @@ type RedisCredentials = {
|
|
|
13
14
|
token?: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
17
|
+
type RedisSearchDescribeFunc = ReturnType<Redis["search"]["index"]>["describe"];
|
|
18
|
+
type SearchIndex = NonNullable<Awaited<ReturnType<RedisSearchDescribeFunc>>>;
|
|
19
|
+
|
|
20
|
+
type SampleDataItem = {
|
|
21
|
+
key: string;
|
|
22
|
+
data: Record<string, any> | string | null;
|
|
23
|
+
};
|
|
24
|
+
type QueryWizardContext = {
|
|
25
|
+
prompt: string;
|
|
26
|
+
searchIndex: SearchIndex | undefined;
|
|
27
|
+
sampleData: SampleDataItem[];
|
|
28
|
+
searchTypes: string;
|
|
29
|
+
};
|
|
30
|
+
type QueryWizardResponse = {
|
|
31
|
+
query: any;
|
|
32
|
+
};
|
|
33
|
+
type UseQueryWizard = (context: QueryWizardContext) => Promise<QueryWizardResponse>;
|
|
34
|
+
|
|
16
35
|
/**
|
|
17
36
|
* Persistence storage interface for the Databrowser.
|
|
18
37
|
*/
|
|
@@ -21,7 +40,7 @@ type RedisBrowserStorage = {
|
|
|
21
40
|
get: () => string | null;
|
|
22
41
|
};
|
|
23
42
|
type TabType = "keys" | "search" | "all";
|
|
24
|
-
declare const RedisBrowser: ({ url, token, hideTabs, tabType, storage, disableTelemetry, onFullScreenClick, theme, allowSearch, }: RedisCredentials & {
|
|
43
|
+
declare const RedisBrowser: ({ url, token, hideTabs, tabType, storage, disableTelemetry, onFullScreenClick, theme, allowSearch, useQueryWizard, }: RedisCredentials & {
|
|
25
44
|
/**
|
|
26
45
|
* Whether to disable telemetry.
|
|
27
46
|
*
|
|
@@ -84,6 +103,33 @@ declare const RedisBrowser: ({ url, token, hideTabs, tabType, storage, disableTe
|
|
|
84
103
|
* @default true
|
|
85
104
|
*/
|
|
86
105
|
allowSearch?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* AI Query Wizard function for generating Redis search queries from natural language.
|
|
108
|
+
* When provided, a wizard button (🪄) appears in the Search tab that allows users to
|
|
109
|
+
* generate queries using AI.
|
|
110
|
+
*
|
|
111
|
+
* The function receives:
|
|
112
|
+
* - prompt: User's natural language query
|
|
113
|
+
* - schema: Current index schema
|
|
114
|
+
* - sampleData: First ~10 items from the database
|
|
115
|
+
* - searchTypes: Redis search type definitions
|
|
116
|
+
*
|
|
117
|
+
* And should return a query object.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <RedisBrowser
|
|
122
|
+
* useQueryWizard={async ({ prompt, schema, sampleData, searchTypes }) => {
|
|
123
|
+
* const response = await fetch('/api/generate-query', {
|
|
124
|
+
* method: 'POST',
|
|
125
|
+
* body: JSON.stringify({ prompt, schema, sampleData, searchTypes }),
|
|
126
|
+
* })
|
|
127
|
+
* return await response.json()
|
|
128
|
+
* }}
|
|
129
|
+
* />
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
useQueryWizard?: UseQueryWizard;
|
|
87
133
|
}) => react_jsx_runtime.JSX.Element;
|
|
88
134
|
|
|
89
|
-
export { type DarkModeOption, RedisBrowser, type RedisBrowserStorage };
|
|
135
|
+
export { type DarkModeOption, type QueryWizardContext, type QueryWizardResponse, RedisBrowser, type RedisBrowserStorage, type SampleDataItem, type UseQueryWizard };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Redis } from '@upstash/redis';
|
|
2
3
|
|
|
3
4
|
type DarkModeOption = "dark" | "light";
|
|
4
5
|
|
|
@@ -13,6 +14,24 @@ type RedisCredentials = {
|
|
|
13
14
|
token?: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
17
|
+
type RedisSearchDescribeFunc = ReturnType<Redis["search"]["index"]>["describe"];
|
|
18
|
+
type SearchIndex = NonNullable<Awaited<ReturnType<RedisSearchDescribeFunc>>>;
|
|
19
|
+
|
|
20
|
+
type SampleDataItem = {
|
|
21
|
+
key: string;
|
|
22
|
+
data: Record<string, any> | string | null;
|
|
23
|
+
};
|
|
24
|
+
type QueryWizardContext = {
|
|
25
|
+
prompt: string;
|
|
26
|
+
searchIndex: SearchIndex | undefined;
|
|
27
|
+
sampleData: SampleDataItem[];
|
|
28
|
+
searchTypes: string;
|
|
29
|
+
};
|
|
30
|
+
type QueryWizardResponse = {
|
|
31
|
+
query: any;
|
|
32
|
+
};
|
|
33
|
+
type UseQueryWizard = (context: QueryWizardContext) => Promise<QueryWizardResponse>;
|
|
34
|
+
|
|
16
35
|
/**
|
|
17
36
|
* Persistence storage interface for the Databrowser.
|
|
18
37
|
*/
|
|
@@ -21,7 +40,7 @@ type RedisBrowserStorage = {
|
|
|
21
40
|
get: () => string | null;
|
|
22
41
|
};
|
|
23
42
|
type TabType = "keys" | "search" | "all";
|
|
24
|
-
declare const RedisBrowser: ({ url, token, hideTabs, tabType, storage, disableTelemetry, onFullScreenClick, theme, allowSearch, }: RedisCredentials & {
|
|
43
|
+
declare const RedisBrowser: ({ url, token, hideTabs, tabType, storage, disableTelemetry, onFullScreenClick, theme, allowSearch, useQueryWizard, }: RedisCredentials & {
|
|
25
44
|
/**
|
|
26
45
|
* Whether to disable telemetry.
|
|
27
46
|
*
|
|
@@ -84,6 +103,33 @@ declare const RedisBrowser: ({ url, token, hideTabs, tabType, storage, disableTe
|
|
|
84
103
|
* @default true
|
|
85
104
|
*/
|
|
86
105
|
allowSearch?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* AI Query Wizard function for generating Redis search queries from natural language.
|
|
108
|
+
* When provided, a wizard button (🪄) appears in the Search tab that allows users to
|
|
109
|
+
* generate queries using AI.
|
|
110
|
+
*
|
|
111
|
+
* The function receives:
|
|
112
|
+
* - prompt: User's natural language query
|
|
113
|
+
* - schema: Current index schema
|
|
114
|
+
* - sampleData: First ~10 items from the database
|
|
115
|
+
* - searchTypes: Redis search type definitions
|
|
116
|
+
*
|
|
117
|
+
* And should return a query object.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* <RedisBrowser
|
|
122
|
+
* useQueryWizard={async ({ prompt, schema, sampleData, searchTypes }) => {
|
|
123
|
+
* const response = await fetch('/api/generate-query', {
|
|
124
|
+
* method: 'POST',
|
|
125
|
+
* body: JSON.stringify({ prompt, schema, sampleData, searchTypes }),
|
|
126
|
+
* })
|
|
127
|
+
* return await response.json()
|
|
128
|
+
* }}
|
|
129
|
+
* />
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
useQueryWizard?: UseQueryWizard;
|
|
87
133
|
}) => react_jsx_runtime.JSX.Element;
|
|
88
134
|
|
|
89
|
-
export { type DarkModeOption, RedisBrowser, type RedisBrowserStorage };
|
|
135
|
+
export { type DarkModeOption, type QueryWizardContext, type QueryWizardResponse, RedisBrowser, type RedisBrowserStorage, type SampleDataItem, type UseQueryWizard };
|