@antscorp/antsomi-ui 2.0.103 → 2.0.105
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/es/__mocks__/sql-query.json +56 -0
- package/es/assets/css/main.scss +2 -2
- package/es/components/atoms/App/App.d.ts +7 -0
- package/es/components/atoms/App/App.js +5 -0
- package/es/components/atoms/App/index.d.ts +1 -0
- package/es/components/atoms/App/index.js +1 -0
- package/es/components/atoms/Input/Input.d.ts +11 -17
- package/es/components/atoms/Input/Input.js +11 -12
- package/es/components/atoms/List/List.d.ts +1 -0
- package/es/components/atoms/List/List.js +1 -0
- package/es/components/atoms/List/index.d.ts +1 -0
- package/es/components/atoms/List/index.js +1 -0
- package/es/components/atoms/Scrollbars/Scrollbars.d.ts +3 -4
- package/es/components/atoms/Scrollbars/Scrollbars.js +2 -1
- package/es/components/atoms/SlideBar/SlideBar.js +1 -1
- package/es/components/atoms/Tag/Tag.js +1 -1
- package/es/components/atoms/index.d.ts +3 -0
- package/es/components/atoms/index.js +2 -0
- package/es/components/icons/FeedbackOutlinedIcon.d.ts +3 -0
- package/es/components/icons/FeedbackOutlinedIcon.js +7 -0
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +5 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +5 -0
- package/es/components/icons/NavigateBeforeIcon.d.ts +3 -0
- package/es/components/icons/NavigateBeforeIcon.js +7 -0
- package/es/components/icons/NavigateNextIcon.d.ts +3 -0
- package/es/components/icons/NavigateNextIcon.js +7 -0
- package/es/components/icons/PenSparkIcon.d.ts +3 -0
- package/es/components/icons/PenSparkIcon.js +7 -0
- package/es/components/icons/StatusSuccessIcon.d.ts +3 -0
- package/es/components/icons/StatusSuccessIcon.js +7 -0
- package/es/components/icons/SummarizeIconIcon.d.ts +3 -0
- package/es/components/icons/SummarizeIconIcon.js +7 -0
- package/es/components/icons/index.d.ts +5 -0
- package/es/components/icons/index.js +5 -0
- package/es/components/index.scss +1 -0
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.d.ts +1 -2
- package/es/components/molecules/CalendarSelection/constants.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/constants.js +1 -1
- package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +8 -2
- package/es/components/molecules/CaptureScreen/CaptureScreen.js +2 -2
- package/es/components/molecules/DrawerDetail/DrawerDetail.js +19 -7
- package/es/components/molecules/DrawerDetail/types.d.ts +5 -0
- package/es/components/molecules/EditingListV2/components/Loadable.d.ts +1 -1
- package/es/components/molecules/EditorScript/EditorScript.d.ts +1 -2
- package/es/components/molecules/EditorScript/EditorScript.js +5 -1
- package/es/components/molecules/FontSizeInput/index.scss +15 -0
- package/es/components/molecules/Select/styled.js +1 -1
- package/es/components/molecules/SelectAccount/type.d.ts +1 -1
- package/es/components/molecules/TagifyInput/utils.style.js +1 -0
- package/es/components/molecules/TemplateSaveAs/hooks/useTemplateSave.d.ts +1 -1
- package/es/components/organism/AccountProfile/components/AccountSetting/AccountSetting.js +2 -1
- package/es/components/organism/AccountProfile/components/AccountSetting/components/LanguageSelector/styles.d.ts +1 -1
- package/es/components/organism/AccountProfile/components/AccountSetting/components/LanguageSelector/styles.js +1 -1
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -0
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -0
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +5 -4
- package/es/components/organism/Login/components/LoginWithEmail/styled.js +1 -1
- package/es/components/organism/Login/components/SetupGGAuthenticator/styled.js +1 -1
- package/es/components/organism/Login/components/SignIn/styled.js +1 -1
- package/es/components/organism/Login/components/WidgetLayout/styled.js +1 -1
- package/es/components/organism/Login/styled.d.ts +3 -3
- package/es/components/organism/Login/styled.js +11 -11
- package/es/components/organism/ModifyColumnModal/styled.d.ts +2 -2
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.d.ts +1 -2
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +3 -1
- package/es/components/organism/SQLGeneration/SQLGeneration.d.ts +3 -0
- package/es/components/organism/SQLGeneration/SQLGeneration.js +26 -0
- package/es/components/organism/SQLGeneration/components/CheckboxShowDiff.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/CheckboxShowDiff.js +16 -0
- package/es/components/organism/SQLGeneration/components/EditTableSourcesDrawer.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/EditTableSourcesDrawer.js +56 -0
- package/es/components/organism/SQLGeneration/components/ErrorDisplay.d.ts +21 -0
- package/es/components/organism/SQLGeneration/components/ErrorDisplay.js +69 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationActions.d.ts +4 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationActions.js +23 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationCodeBlock.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationCodeBlock.js +22 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationEditPrompt.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationEditPrompt.js +66 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationHeader.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationHeader.js +10 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationModal.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationModal.js +35 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPagination.d.ts +4 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPagination.js +13 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPrompt.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPrompt.js +31 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPromptDisplay.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationPromptDisplay.js +15 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationQuerySummary.d.ts +2 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationQuerySummary.js +17 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationRefine.d.ts +1 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationRefine.js +55 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationResult.d.ts +5 -0
- package/es/components/organism/SQLGeneration/components/SQLGenerationResult.js +29 -0
- package/es/components/organism/SQLGeneration/components/index.d.ts +9 -0
- package/es/components/organism/SQLGeneration/components/index.js +9 -0
- package/es/components/organism/SQLGeneration/components/styled.d.ts +52 -0
- package/es/components/organism/SQLGeneration/components/styled.js +382 -0
- package/es/components/organism/SQLGeneration/constants.d.ts +48 -0
- package/es/components/organism/SQLGeneration/constants.js +48 -0
- package/es/components/organism/SQLGeneration/hooks/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/hooks/index.js +1 -0
- package/es/components/organism/SQLGeneration/hooks/useKeyboardNavigation.d.ts +14 -0
- package/es/components/organism/SQLGeneration/hooks/useKeyboardNavigation.js +123 -0
- package/es/components/organism/SQLGeneration/index.d.ts +10 -0
- package/es/components/organism/SQLGeneration/index.js +6 -0
- package/es/components/organism/SQLGeneration/index.scss +1 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/index.js +1 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/index.scss +4 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useAceEditor.d.ts +9 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useAceEditor.js +24 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useEnhancePlaceholder.d.ts +10 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useEnhancePlaceholder.js +172 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useInsertQuery.d.ts +8 -0
- package/es/components/organism/SQLGeneration/integrations/AceEditor/useInsertQuery.js +21 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/index.js +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/useAntsomiAI.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiAI/useAntsomiAI.js +35 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/index.d.ts +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/index.js +1 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/useAntsomiSqlWS.d.ts +7 -0
- package/es/components/organism/SQLGeneration/integrations/AntsomiSqlWS/useAntsomiSqlWS.js +10 -0
- package/es/components/organism/SQLGeneration/selectors.d.ts +857 -0
- package/es/components/organism/SQLGeneration/selectors.js +61 -0
- package/es/components/organism/SQLGeneration/store/index.d.ts +2 -0
- package/es/components/organism/SQLGeneration/store/index.js +1 -0
- package/es/components/organism/SQLGeneration/store/provider.d.ts +7 -0
- package/es/components/organism/SQLGeneration/store/provider.js +40 -0
- package/es/components/organism/SQLGeneration/store/store.d.ts +383 -0
- package/es/components/organism/SQLGeneration/store/store.js +309 -0
- package/es/components/organism/SQLGeneration/store/types.d.ts +97 -0
- package/es/components/organism/SQLGeneration/store/types.js +1 -0
- package/es/components/organism/SQLGeneration/types.d.ts +29 -0
- package/es/components/organism/SQLGeneration/types.js +1 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/organism/index.scss +1 -0
- package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +3 -4
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +1 -0
- package/es/hooks/useFocusManagement.d.ts +14 -0
- package/es/hooks/useFocusManagement.js +124 -0
- package/es/locales/ja/google-sheet.json +2 -2
- package/es/providers/ConfigProvider/ConfigProvider.js +4 -1
- package/es/providers/ConfigProvider/GlobalStyle.js +153 -46
- package/es/queries/AI/index.d.ts +23 -0
- package/es/queries/AI/index.js +4 -0
- package/es/queries/AI/useSqlGeneration.d.ts +25 -0
- package/es/queries/AI/useSqlGeneration.js +13 -0
- package/es/queries/TemplateListing/index.d.ts +2 -2
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/services/AI/index.d.ts +15 -0
- package/es/services/AI/index.js +15 -0
- package/es/types/auth.d.ts +25 -0
- package/es/types/auth.js +1 -0
- package/es/types/index.d.ts +1 -0
- package/es/types/index.js +1 -0
- package/es/utils/common.d.ts +1 -0
- package/es/utils/common.js +16 -1
- package/es/utils/web.d.ts +16 -3
- package/es/utils/web.js +36 -3
- package/es/utils/zustand.d.ts +10 -0
- package/es/utils/zustand.js +8 -0
- package/package.json +16 -11
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
import { cloneDeep, last } from 'lodash';
|
|
3
|
+
// Careful with selectors that return objects or arrays
|
|
4
|
+
// They are cached by reference, so if you mutate the returned object or array, you'll mutate the cache
|
|
5
|
+
// If you need to mutate the returned object or array, return a new object or array
|
|
6
|
+
// Ex: export const selectPreviousCurrentResult = createSelector(
|
|
7
|
+
// [selectAllPreviousResults],
|
|
8
|
+
// previousResults => previousResults.pop(),
|
|
9
|
+
// );
|
|
10
|
+
export const selectTableSources = createSelector([(state) => state.tableSources], tableSources => tableSources);
|
|
11
|
+
export const selectSelctedTableSources = createSelector([selectTableSources], tableSources => tableSources.filter(t => t.selected));
|
|
12
|
+
export const selectIsEditTableSourcesOpen = (state) => state.isEditTableSourcesOpen;
|
|
13
|
+
export const selectIsEditingPrompt = (state) => state.isEditingPrompt;
|
|
14
|
+
export const selectIsOpen = (state) => state.isOpen;
|
|
15
|
+
export const selectPrompt = (state) => state.prompt;
|
|
16
|
+
// Error selectors
|
|
17
|
+
export const selectError = (state) => state.error;
|
|
18
|
+
export const selectGenerateSQLError = (state) => state.generateSQLError;
|
|
19
|
+
export const selectRefineSQLError = (state) => state.refineSQLError;
|
|
20
|
+
export const selectQuerySummaryError = (state) => state.querySummaryError;
|
|
21
|
+
export const selectHasAnyError = createSelector([selectGenerateSQLError, selectRefineSQLError, selectQuerySummaryError], (generateError, refineError, summaryError) => !!(generateError || refineError || summaryError));
|
|
22
|
+
export const selectIsLoading = (state) => state.isLoading;
|
|
23
|
+
export const selectCurrentResultKey = (state) => state.currentResultKey;
|
|
24
|
+
export const selectResults = (state) => state.results;
|
|
25
|
+
export const selectResultsByKey = (state) => state.results.byKey;
|
|
26
|
+
export const selectResultsAllKeys = (state) => state.results.allKeys;
|
|
27
|
+
export const selectCurrentResult = createSelector([selectResultsByKey, selectCurrentResultKey], (resultsByKey, currentResultKey) => currentResultKey ? resultsByKey[currentResultKey] : undefined);
|
|
28
|
+
export const selectCurrentResultIndex = createSelector([selectCurrentResultKey, selectResultsAllKeys], (currentResultKey, allKeys) => allKeys.findIndex(i => i === currentResultKey));
|
|
29
|
+
export const selectIsEmptyResult = createSelector([selectResultsAllKeys], allKeys => allKeys.length === 0);
|
|
30
|
+
export const selectIsLastResult = createSelector([selectCurrentResultIndex, selectResultsAllKeys], (currentResultIndex, allKeys) => currentResultIndex === allKeys.length - 1);
|
|
31
|
+
export const selectAllResults = createSelector([selectResultsByKey], resultsByKey => Object.values(resultsByKey));
|
|
32
|
+
export const selectAllPreviousResultKeys = createSelector([selectCurrentResultIndex, selectResultsAllKeys], (currentResultIndex, allKeys) => allKeys.slice(0, currentResultIndex));
|
|
33
|
+
export const selectAllPreviousResults = createSelector([selectAllPreviousResultKeys, selectResultsByKey], (allKeys, resultsByKey) => allKeys.map(key => cloneDeep(resultsByKey[key])));
|
|
34
|
+
export const selectAllNextResultKeys = createSelector([selectCurrentResultIndex, selectResultsAllKeys], (currentResultIndex, allKeys) => allKeys.slice(currentResultIndex + 1));
|
|
35
|
+
export const selectAllNextResults = createSelector([selectAllNextResultKeys, selectResultsByKey], (allKeys, resultsByKey) => allKeys.map(key => resultsByKey[key]));
|
|
36
|
+
export const selectTotalResults = createSelector([selectResultsAllKeys], allKeys => allKeys.length);
|
|
37
|
+
export const selectHasResult = createSelector([selectResultsAllKeys, selectCurrentResult], (allKeys, currentResult) => allKeys.length > 0 && !!currentResult);
|
|
38
|
+
export const selectCurrentResultSummary = createSelector([selectCurrentResult], currentResult => currentResult?.summary);
|
|
39
|
+
export const selectIsSummaryLoading = createSelector([(state) => state.isSummaryLoading], isSummaryLoading => isSummaryLoading);
|
|
40
|
+
export const selectRefinePrompt = createSelector([(state) => state.refinePrompt], refinePrompt => refinePrompt);
|
|
41
|
+
export const selectIsRefining = createSelector([(state) => state.isRefining], isRefining => isRefining);
|
|
42
|
+
export const selectResultSettings = createSelector([(state) => state.results.byKeySettings], byKeySettings => byKeySettings);
|
|
43
|
+
export const selectCurrentResultSettings = createSelector([selectResultSettings, selectCurrentResultKey], (byKeySettings, currentResultKey) => currentResultKey ? byKeySettings[currentResultKey] : undefined);
|
|
44
|
+
export const selectCurrentResultShowDiff = createSelector([selectCurrentResultSettings], currentResultSettings => currentResultSettings?.showDiff);
|
|
45
|
+
export const selectPreviousCurrentResult = createSelector([selectAllPreviousResults], previousResults => last(previousResults));
|
|
46
|
+
export const selectCurrentOperationError = createSelector([
|
|
47
|
+
selectIsLoading,
|
|
48
|
+
selectIsRefining,
|
|
49
|
+
selectIsSummaryLoading,
|
|
50
|
+
selectGenerateSQLError,
|
|
51
|
+
selectRefineSQLError,
|
|
52
|
+
selectQuerySummaryError,
|
|
53
|
+
], (isLoading, isRefining, isSummaryLoading, generateError, refineError, summaryError) => {
|
|
54
|
+
if (isLoading)
|
|
55
|
+
return generateError;
|
|
56
|
+
if (isRefining)
|
|
57
|
+
return refineError;
|
|
58
|
+
if (isSummaryLoading)
|
|
59
|
+
return summaryError;
|
|
60
|
+
return generateError || refineError || summaryError;
|
|
61
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SQLGenerationProvider, useSQLGenerationStore, } from './provider';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type SQLGenerationStore, SQLGenerationStoreInitialProps } from './types';
|
|
3
|
+
export interface SQLGenerationProviderProps extends SQLGenerationStoreInitialProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const SQLGenerationProvider: ({ children, ...props }: SQLGenerationProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const useSQLGenerationStore: <T>(selector: (store: SQLGenerationStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useContext, useEffect } from 'react';
|
|
3
|
+
import { useStoreWithEqualityFn } from 'zustand/traditional';
|
|
4
|
+
import { shallow } from 'zustand/shallow';
|
|
5
|
+
import { SQLGenerationContext, createSQLGenerationStore } from './store';
|
|
6
|
+
export const SQLGenerationProvider = ({ children, ...props }) => {
|
|
7
|
+
const { onGenerateSQL, onInsertSQL, onQuerySummary, onRefineSQL, env = 'production' } = props;
|
|
8
|
+
const storeRef = useRef();
|
|
9
|
+
if (!storeRef.current) {
|
|
10
|
+
storeRef.current = createSQLGenerationStore({ ...props, env });
|
|
11
|
+
}
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (onGenerateSQL) {
|
|
14
|
+
storeRef.current?.setState({ onGenerateSQL });
|
|
15
|
+
}
|
|
16
|
+
}, [onGenerateSQL]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (onInsertSQL) {
|
|
19
|
+
storeRef.current?.setState({ onInsertSQL });
|
|
20
|
+
}
|
|
21
|
+
}, [onInsertSQL]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (onQuerySummary) {
|
|
24
|
+
storeRef.current?.setState({ onQuerySummary });
|
|
25
|
+
}
|
|
26
|
+
}, [onQuerySummary]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (onRefineSQL) {
|
|
29
|
+
storeRef.current?.setState({ onRefineSQL });
|
|
30
|
+
}
|
|
31
|
+
}, [onRefineSQL]);
|
|
32
|
+
return (_jsx(SQLGenerationContext.Provider, { value: storeRef.current, children: children }));
|
|
33
|
+
};
|
|
34
|
+
export const useSQLGenerationStore = (selector, equalityFn) => {
|
|
35
|
+
const context = useContext(SQLGenerationContext);
|
|
36
|
+
if (!context) {
|
|
37
|
+
throw new Error('useSQLGenerationStore must be used within SQLGenerationStoreProvider');
|
|
38
|
+
}
|
|
39
|
+
return useStoreWithEqualityFn(context, selector, equalityFn || shallow);
|
|
40
|
+
};
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SQLGenerationState, SQLGenerationStore, SQLGenerationStoreInitialProps } from './types';
|
|
3
|
+
export declare const createSQLGenerationStore: (initProps?: SQLGenerationStoreInitialProps) => Omit<Omit<import("zustand").StoreApi<SQLGenerationStore>, "setState"> & {
|
|
4
|
+
setState<A extends string | {
|
|
5
|
+
type: string;
|
|
6
|
+
}>(partial: SQLGenerationStore | Partial<SQLGenerationStore> | ((state: SQLGenerationStore) => SQLGenerationStore | Partial<SQLGenerationStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
7
|
+
}, "setState"> & {
|
|
8
|
+
setState(nextStateOrUpdater: SQLGenerationStore | Partial<SQLGenerationStore> | ((state: {
|
|
9
|
+
abortControllers: {
|
|
10
|
+
generateSQL?: {
|
|
11
|
+
signal: {
|
|
12
|
+
aborted: boolean;
|
|
13
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
14
|
+
reason: any;
|
|
15
|
+
throwIfAborted: {
|
|
16
|
+
(): void;
|
|
17
|
+
(): void;
|
|
18
|
+
};
|
|
19
|
+
addEventListener: {
|
|
20
|
+
<K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
21
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
22
|
+
};
|
|
23
|
+
removeEventListener: {
|
|
24
|
+
<K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
25
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
26
|
+
};
|
|
27
|
+
dispatchEvent: (event: Event) => boolean;
|
|
28
|
+
};
|
|
29
|
+
abort: {
|
|
30
|
+
(reason?: any): void;
|
|
31
|
+
(reason?: any): void;
|
|
32
|
+
};
|
|
33
|
+
} | undefined;
|
|
34
|
+
querySummary?: {
|
|
35
|
+
signal: {
|
|
36
|
+
aborted: boolean;
|
|
37
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
38
|
+
reason: any;
|
|
39
|
+
throwIfAborted: {
|
|
40
|
+
(): void;
|
|
41
|
+
(): void;
|
|
42
|
+
};
|
|
43
|
+
addEventListener: {
|
|
44
|
+
<K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
45
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
46
|
+
};
|
|
47
|
+
removeEventListener: {
|
|
48
|
+
<K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
49
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
50
|
+
};
|
|
51
|
+
dispatchEvent: (event: Event) => boolean;
|
|
52
|
+
};
|
|
53
|
+
abort: {
|
|
54
|
+
(reason?: any): void;
|
|
55
|
+
(reason?: any): void;
|
|
56
|
+
};
|
|
57
|
+
} | undefined;
|
|
58
|
+
refineSQL?: {
|
|
59
|
+
signal: {
|
|
60
|
+
aborted: boolean;
|
|
61
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
62
|
+
reason: any;
|
|
63
|
+
throwIfAborted: {
|
|
64
|
+
(): void;
|
|
65
|
+
(): void;
|
|
66
|
+
};
|
|
67
|
+
addEventListener: {
|
|
68
|
+
<K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
69
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
70
|
+
};
|
|
71
|
+
removeEventListener: {
|
|
72
|
+
<K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
73
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
74
|
+
};
|
|
75
|
+
dispatchEvent: (event: Event) => boolean;
|
|
76
|
+
};
|
|
77
|
+
abort: {
|
|
78
|
+
(reason?: any): void;
|
|
79
|
+
(reason?: any): void;
|
|
80
|
+
};
|
|
81
|
+
} | undefined;
|
|
82
|
+
};
|
|
83
|
+
isOpen: boolean;
|
|
84
|
+
isLoading: boolean;
|
|
85
|
+
isRefining: boolean;
|
|
86
|
+
isSummaryLoading: boolean;
|
|
87
|
+
isEditTableSourcesOpen: boolean;
|
|
88
|
+
isEditingPrompt: boolean;
|
|
89
|
+
currentResultKey: string | null;
|
|
90
|
+
error: {
|
|
91
|
+
message: string;
|
|
92
|
+
code?: string | undefined;
|
|
93
|
+
timestamp: number;
|
|
94
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
95
|
+
} | null;
|
|
96
|
+
generateSQLError: {
|
|
97
|
+
message: string;
|
|
98
|
+
code?: string | undefined;
|
|
99
|
+
timestamp: number;
|
|
100
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
101
|
+
} | null;
|
|
102
|
+
refineSQLError: {
|
|
103
|
+
message: string;
|
|
104
|
+
code?: string | undefined;
|
|
105
|
+
timestamp: number;
|
|
106
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
107
|
+
} | null;
|
|
108
|
+
querySummaryError: {
|
|
109
|
+
message: string;
|
|
110
|
+
code?: string | undefined;
|
|
111
|
+
timestamp: number;
|
|
112
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
113
|
+
} | null;
|
|
114
|
+
prompt: string;
|
|
115
|
+
refinePrompt: string;
|
|
116
|
+
tableSources: {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
dataset: string;
|
|
120
|
+
project: string;
|
|
121
|
+
selected: boolean;
|
|
122
|
+
}[];
|
|
123
|
+
searchQuery: string;
|
|
124
|
+
results: {
|
|
125
|
+
byKey: {
|
|
126
|
+
[x: string]: {
|
|
127
|
+
key: string;
|
|
128
|
+
prompt: string;
|
|
129
|
+
sqlSuggestion: string;
|
|
130
|
+
summary?: string | undefined;
|
|
131
|
+
refinePrompt?: string | undefined;
|
|
132
|
+
explanation?: string | undefined;
|
|
133
|
+
processedDataSize?: string | undefined;
|
|
134
|
+
estimatedCost?: string | undefined;
|
|
135
|
+
queryComplexity?: "medium" | "simple" | "complex" | undefined;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
byKeySettings: {
|
|
139
|
+
[x: string]: {
|
|
140
|
+
showDiff: boolean;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
allKeys: string[];
|
|
144
|
+
};
|
|
145
|
+
onGenerateSQL?: ((prompt: string, context: import("../types").SQLGenerationContext, options: {
|
|
146
|
+
signal: AbortSignal;
|
|
147
|
+
}) => Promise<import("..").SQLGenerationResult>) | undefined;
|
|
148
|
+
onRefineSQL?: ((refinePrompt: string, context: import("../types").SQLGenerationContext, options: {
|
|
149
|
+
signal: AbortSignal;
|
|
150
|
+
}) => Promise<import("..").SQLGenerationResult>) | undefined;
|
|
151
|
+
onInsertSQL?: ((sql: string) => void) | undefined;
|
|
152
|
+
onQuerySummary?: ((sql: string, options: {
|
|
153
|
+
signal: AbortSignal;
|
|
154
|
+
}) => Promise<string>) | undefined;
|
|
155
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
156
|
+
setState: (update: Partial<SQLGenerationState>) => void;
|
|
157
|
+
reset: () => void;
|
|
158
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
159
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
160
|
+
setIsSummaryLoading: (isLoading: boolean) => void;
|
|
161
|
+
setIsEditTableSourcesOpen: (isOpen: boolean) => void;
|
|
162
|
+
setIsEditingPrompt: (isEditing: boolean) => void;
|
|
163
|
+
setCurrentResultKey: (key: string) => void;
|
|
164
|
+
setPrompt: (prompt: string) => void;
|
|
165
|
+
setResults: (results: import("./types").SQLResults) => void;
|
|
166
|
+
setTableSources: (sources: import("..").TableSource[]) => void;
|
|
167
|
+
setSearchQuery: (query: string) => void;
|
|
168
|
+
setRefinePrompt: (prompt: string) => void;
|
|
169
|
+
setIsRefining: (isRefining: boolean) => void;
|
|
170
|
+
setCurrentResultSettings: (updateFn: (draft: {
|
|
171
|
+
showDiff: boolean;
|
|
172
|
+
}) => void) => void;
|
|
173
|
+
setError: (error: import("./types").SQLGenerationError | null) => void;
|
|
174
|
+
setGenerateSQLError: (error: import("./types").SQLGenerationError | null) => void;
|
|
175
|
+
setRefineSQLError: (error: import("./types").SQLGenerationError | null) => void;
|
|
176
|
+
setQuerySummaryError: (error: import("./types").SQLGenerationError | null) => void;
|
|
177
|
+
clearErrors: () => void;
|
|
178
|
+
clearError: (operation: "generateSQL" | "refineSQL" | "querySummary") => void;
|
|
179
|
+
generateSQL: () => Promise<void>;
|
|
180
|
+
insertSQL: () => void;
|
|
181
|
+
querySummary: () => Promise<void>;
|
|
182
|
+
refineSQL: () => Promise<void>;
|
|
183
|
+
abortGenerateSQL: () => void;
|
|
184
|
+
abortQuerySummary: () => void;
|
|
185
|
+
abortRefineSQL: () => void;
|
|
186
|
+
retryGenerateSQL: () => Promise<void>;
|
|
187
|
+
retryRefineSQL: () => Promise<void>;
|
|
188
|
+
retryQuerySummary: () => Promise<void>;
|
|
189
|
+
}) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
190
|
+
type: string;
|
|
191
|
+
} | undefined): void;
|
|
192
|
+
};
|
|
193
|
+
export type SQLGenerationStoreApi = ReturnType<typeof createSQLGenerationStore>;
|
|
194
|
+
export declare const SQLGenerationContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<SQLGenerationStore>, "setState"> & {
|
|
195
|
+
setState<A extends string | {
|
|
196
|
+
type: string;
|
|
197
|
+
}>(partial: SQLGenerationStore | Partial<SQLGenerationStore> | ((state: SQLGenerationStore) => SQLGenerationStore | Partial<SQLGenerationStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
198
|
+
}, "setState"> & {
|
|
199
|
+
setState(nextStateOrUpdater: SQLGenerationStore | Partial<SQLGenerationStore> | ((state: {
|
|
200
|
+
abortControllers: {
|
|
201
|
+
generateSQL?: {
|
|
202
|
+
signal: {
|
|
203
|
+
aborted: boolean;
|
|
204
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
205
|
+
reason: any;
|
|
206
|
+
throwIfAborted: {
|
|
207
|
+
(): void;
|
|
208
|
+
(): void;
|
|
209
|
+
};
|
|
210
|
+
addEventListener: {
|
|
211
|
+
<K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
212
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
213
|
+
};
|
|
214
|
+
removeEventListener: {
|
|
215
|
+
<K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
216
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
217
|
+
};
|
|
218
|
+
dispatchEvent: (event: Event) => boolean;
|
|
219
|
+
};
|
|
220
|
+
abort: {
|
|
221
|
+
(reason?: any): void;
|
|
222
|
+
(reason?: any): void;
|
|
223
|
+
};
|
|
224
|
+
} | undefined;
|
|
225
|
+
querySummary?: {
|
|
226
|
+
signal: {
|
|
227
|
+
aborted: boolean;
|
|
228
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
229
|
+
reason: any;
|
|
230
|
+
throwIfAborted: {
|
|
231
|
+
(): void;
|
|
232
|
+
(): void;
|
|
233
|
+
};
|
|
234
|
+
addEventListener: {
|
|
235
|
+
<K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
236
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
237
|
+
};
|
|
238
|
+
removeEventListener: {
|
|
239
|
+
<K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
240
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
241
|
+
};
|
|
242
|
+
dispatchEvent: (event: Event) => boolean;
|
|
243
|
+
};
|
|
244
|
+
abort: {
|
|
245
|
+
(reason?: any): void;
|
|
246
|
+
(reason?: any): void;
|
|
247
|
+
};
|
|
248
|
+
} | undefined;
|
|
249
|
+
refineSQL?: {
|
|
250
|
+
signal: {
|
|
251
|
+
aborted: boolean;
|
|
252
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
253
|
+
reason: any;
|
|
254
|
+
throwIfAborted: {
|
|
255
|
+
(): void;
|
|
256
|
+
(): void;
|
|
257
|
+
};
|
|
258
|
+
addEventListener: {
|
|
259
|
+
<K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
260
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
261
|
+
};
|
|
262
|
+
removeEventListener: {
|
|
263
|
+
<K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
|
264
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
265
|
+
};
|
|
266
|
+
dispatchEvent: (event: Event) => boolean;
|
|
267
|
+
};
|
|
268
|
+
abort: {
|
|
269
|
+
(reason?: any): void;
|
|
270
|
+
(reason?: any): void;
|
|
271
|
+
};
|
|
272
|
+
} | undefined;
|
|
273
|
+
};
|
|
274
|
+
isOpen: boolean;
|
|
275
|
+
isLoading: boolean;
|
|
276
|
+
isRefining: boolean;
|
|
277
|
+
isSummaryLoading: boolean;
|
|
278
|
+
isEditTableSourcesOpen: boolean;
|
|
279
|
+
isEditingPrompt: boolean;
|
|
280
|
+
currentResultKey: string | null;
|
|
281
|
+
error: {
|
|
282
|
+
message: string;
|
|
283
|
+
code?: string | undefined;
|
|
284
|
+
timestamp: number;
|
|
285
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
286
|
+
} | null;
|
|
287
|
+
generateSQLError: {
|
|
288
|
+
message: string;
|
|
289
|
+
code?: string | undefined;
|
|
290
|
+
timestamp: number;
|
|
291
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
292
|
+
} | null;
|
|
293
|
+
refineSQLError: {
|
|
294
|
+
message: string;
|
|
295
|
+
code?: string | undefined;
|
|
296
|
+
timestamp: number;
|
|
297
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
298
|
+
} | null;
|
|
299
|
+
querySummaryError: {
|
|
300
|
+
message: string;
|
|
301
|
+
code?: string | undefined;
|
|
302
|
+
timestamp: number;
|
|
303
|
+
operation: "generateSQL" | "refineSQL" | "querySummary";
|
|
304
|
+
} | null;
|
|
305
|
+
prompt: string;
|
|
306
|
+
refinePrompt: string;
|
|
307
|
+
tableSources: {
|
|
308
|
+
id: string;
|
|
309
|
+
name: string;
|
|
310
|
+
dataset: string;
|
|
311
|
+
project: string;
|
|
312
|
+
selected: boolean;
|
|
313
|
+
}[];
|
|
314
|
+
searchQuery: string;
|
|
315
|
+
results: {
|
|
316
|
+
byKey: {
|
|
317
|
+
[x: string]: {
|
|
318
|
+
key: string;
|
|
319
|
+
prompt: string;
|
|
320
|
+
sqlSuggestion: string;
|
|
321
|
+
summary?: string | undefined;
|
|
322
|
+
refinePrompt?: string | undefined;
|
|
323
|
+
explanation?: string | undefined;
|
|
324
|
+
processedDataSize?: string | undefined;
|
|
325
|
+
estimatedCost?: string | undefined;
|
|
326
|
+
queryComplexity?: "medium" | "simple" | "complex" | undefined;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
byKeySettings: {
|
|
330
|
+
[x: string]: {
|
|
331
|
+
showDiff: boolean;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
allKeys: string[];
|
|
335
|
+
};
|
|
336
|
+
onGenerateSQL?: ((prompt: string, context: import("../types").SQLGenerationContext, options: {
|
|
337
|
+
signal: AbortSignal;
|
|
338
|
+
}) => Promise<import("..").SQLGenerationResult>) | undefined;
|
|
339
|
+
onRefineSQL?: ((refinePrompt: string, context: import("../types").SQLGenerationContext, options: {
|
|
340
|
+
signal: AbortSignal;
|
|
341
|
+
}) => Promise<import("..").SQLGenerationResult>) | undefined;
|
|
342
|
+
onInsertSQL?: ((sql: string) => void) | undefined;
|
|
343
|
+
onQuerySummary?: ((sql: string, options: {
|
|
344
|
+
signal: AbortSignal;
|
|
345
|
+
}) => Promise<string>) | undefined;
|
|
346
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
347
|
+
setState: (update: Partial<SQLGenerationState>) => void;
|
|
348
|
+
reset: () => void;
|
|
349
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
350
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
351
|
+
setIsSummaryLoading: (isLoading: boolean) => void;
|
|
352
|
+
setIsEditTableSourcesOpen: (isOpen: boolean) => void;
|
|
353
|
+
setIsEditingPrompt: (isEditing: boolean) => void;
|
|
354
|
+
setCurrentResultKey: (key: string) => void;
|
|
355
|
+
setPrompt: (prompt: string) => void;
|
|
356
|
+
setResults: (results: import("./types").SQLResults) => void;
|
|
357
|
+
setTableSources: (sources: import("..").TableSource[]) => void;
|
|
358
|
+
setSearchQuery: (query: string) => void;
|
|
359
|
+
setRefinePrompt: (prompt: string) => void;
|
|
360
|
+
setIsRefining: (isRefining: boolean) => void;
|
|
361
|
+
setCurrentResultSettings: (updateFn: (draft: {
|
|
362
|
+
showDiff: boolean;
|
|
363
|
+
}) => void) => void;
|
|
364
|
+
setError: (error: import("./types").SQLGenerationError | null) => void;
|
|
365
|
+
setGenerateSQLError: (error: import("./types").SQLGenerationError | null) => void;
|
|
366
|
+
setRefineSQLError: (error: import("./types").SQLGenerationError | null) => void;
|
|
367
|
+
setQuerySummaryError: (error: import("./types").SQLGenerationError | null) => void;
|
|
368
|
+
clearErrors: () => void;
|
|
369
|
+
clearError: (operation: "generateSQL" | "refineSQL" | "querySummary") => void;
|
|
370
|
+
generateSQL: () => Promise<void>;
|
|
371
|
+
insertSQL: () => void;
|
|
372
|
+
querySummary: () => Promise<void>;
|
|
373
|
+
refineSQL: () => Promise<void>;
|
|
374
|
+
abortGenerateSQL: () => void;
|
|
375
|
+
abortQuerySummary: () => void;
|
|
376
|
+
abortRefineSQL: () => void;
|
|
377
|
+
retryGenerateSQL: () => Promise<void>;
|
|
378
|
+
retryRefineSQL: () => Promise<void>;
|
|
379
|
+
retryQuerySummary: () => Promise<void>;
|
|
380
|
+
}) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
381
|
+
type: string;
|
|
382
|
+
} | undefined): void;
|
|
383
|
+
}) | undefined>;
|