@sqlrooms/sql-editor 0.21.0 → 0.23.0
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/SqlEditor.d.ts.map +1 -1
- package/dist/SqlEditor.js +3 -1
- package/dist/SqlEditor.js.map +1 -1
- package/dist/SqlMonacoEditor.d.ts +2 -1
- package/dist/SqlMonacoEditor.d.ts.map +1 -1
- package/dist/SqlMonacoEditor.js +22 -9
- package/dist/SqlMonacoEditor.js.map +1 -1
- package/dist/components/CreateTableModal.d.ts.map +1 -1
- package/dist/components/CreateTableModal.js +3 -1
- package/dist/components/CreateTableModal.js.map +1 -1
- package/dist/components/QueryEditorPanel.d.ts.map +1 -1
- package/dist/components/QueryEditorPanel.js +3 -1
- package/dist/components/QueryEditorPanel.js.map +1 -1
- package/dist/components/QueryEditorPanelEditor.d.ts.map +1 -1
- package/dist/components/QueryEditorPanelEditor.js +5 -4
- package/dist/components/QueryEditorPanelEditor.js.map +1 -1
- package/dist/constants/duckdb-dialect.d.ts +3 -65
- package/dist/constants/duckdb-dialect.d.ts.map +1 -1
- package/dist/constants/duckdb-dialect.js +468 -233
- package/dist/constants/duckdb-dialect.js.map +1 -1
- package/dist/constants/functionSuggestions.d.ts +6 -0
- package/dist/constants/functionSuggestions.d.ts.map +1 -0
- package/dist/constants/functionSuggestions.js +102 -0
- package/dist/constants/functionSuggestions.js.map +1 -0
- package/package.json +12 -12
package/dist/SqlEditor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlEditor.d.ts","sourceRoot":"","sources":["../src/SqlEditor.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EAEL,wBAAwB,EACzB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG;IAC3B;;0EAEsE;IACtE,MAAM,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC5C,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,0DAA0D;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"SqlEditor.d.ts","sourceRoot":"","sources":["../src/SqlEditor.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EAEL,wBAAwB,EACzB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG;IAC3B;;0EAEsE;IACtE,MAAM,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAC5C,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,0DAA0D;IAC1D,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AA+FF,QAAA,MAAM,SAAS,4CAA4B,CAAC;AAE5C,eAAe,SAAS,CAAC"}
|
package/dist/SqlEditor.js
CHANGED
|
@@ -30,7 +30,9 @@ const SqlEditorBase = (props) => {
|
|
|
30
30
|
const handleCreateTable = useCallback(() => {
|
|
31
31
|
setCreateTableModalOpen(true);
|
|
32
32
|
}, []);
|
|
33
|
-
return (_jsxs("div", { className: "relative flex h-full w-full flex-col overflow-hidden", children: [_jsx(SqlEditorHeader, { title: "SQL Editor", showDocs: showDocs, documentationPanel: documentationPanel, onToggleDocs: handleToggleDocs }), _jsx("div", { className: "bg-muted h-full flex-grow", children: _jsxs(ResizablePanelGroup, { direction: "horizontal", className: "h-full", children: [_jsx(ResizablePanel, { defaultSize: showDocs ? 70 : 100, children: _jsxs(ResizablePanelGroup, { direction: "vertical", className: "h-full", children: [_jsx(ResizablePanel, { defaultSize: 50, className: "flex flex-row", children: _jsxs(ResizablePanelGroup, { direction: "horizontal", children: [_jsx(ResizablePanel, { defaultSize: 20, children: _jsx(TableStructurePanel, { schema: schema }) }), _jsx(ResizableHandle, { withHandle: true }), _jsx(ResizablePanel, { defaultSize: 80,
|
|
33
|
+
return (_jsxs("div", { className: "relative flex h-full w-full flex-col overflow-hidden", children: [_jsx(SqlEditorHeader, { title: "SQL Editor", showDocs: showDocs, documentationPanel: documentationPanel, onToggleDocs: handleToggleDocs }), _jsx("div", { className: "bg-muted h-full flex-grow", children: _jsxs(ResizablePanelGroup, { direction: "horizontal", className: "h-full", children: [_jsx(ResizablePanel, { defaultSize: showDocs ? 70 : 100, children: _jsxs(ResizablePanelGroup, { direction: "vertical", className: "h-full", children: [_jsx(ResizablePanel, { defaultSize: 50, className: "flex flex-row", children: _jsxs(ResizablePanelGroup, { direction: "horizontal", children: [_jsx(ResizablePanel, { defaultSize: 20, children: _jsx(TableStructurePanel, { schema: schema }) }), _jsx(ResizableHandle, { withHandle: true }), _jsx(ResizablePanel, { defaultSize: 80,
|
|
34
|
+
// this is for Monaco's completion menu to not being cut off
|
|
35
|
+
className: "!overflow-visible", children: _jsx(QueryEditorPanel, {}) })] }) }), _jsx(ResizableHandle, { withHandle: true }), _jsx(ResizablePanel, { defaultSize: 50, children: _jsx(QueryResultPanel, { renderActions: () => (_jsx("div", { className: "flex gap-2", children: _jsxs(Button, { size: "xs", onClick: handleCreateTable, children: [_jsx(PlusIcon, { className: "h-4 w-4" }), "New table"] }) })) }) })] }) }), showDocs && (_jsxs(_Fragment, { children: [_jsx(ResizableHandle, { withHandle: true }), _jsx(ResizablePanel, { defaultSize: 30, children: documentationPanel })] }))] }) }), _jsx(CreateTableModal, { query: lastQueryStatement, isOpen: createTableModalOpen, onClose: () => setCreateTableModalOpen(false), onAddOrUpdateSqlQuery: addOrUpdateSqlQueryDataSource })] }));
|
|
34
36
|
};
|
|
35
37
|
// Wrap with React.memo to prevent unnecessary re-renders
|
|
36
38
|
const SqlEditor = React.memo(SqlEditorBase);
|
package/dist/SqlEditor.js.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AG,EAC9B,KAAC,cAAc,IAAC,WAAW,EAAE,EAAE,YAC7B,KAAC,gBAAgB,IACf,aAAa,EAAE,GAAG,EAAE,CAAC,CACnB,cAAK,SAAS,EAAC,YAAY,YACzB,MAAC,MAAM,IAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,iBAAiB,aAC1C,KAAC,QAAQ,IAAC,SAAS,EAAC,SAAS,GAAG,iBAEzB,GACL,CACP,GACD,GACa,IACG,GACP,EAChB,QAAQ,IAAI,CACX,8BACE,KAAC,eAAe,IAAC,UAAU,SAAG,EAC9B,KAAC,cAAc,IAAC,WAAW,EAAE,EAAE,YAC5B,kBAAkB,GACJ,IAChB,CACJ,IACmB,GAClB,EACN,KAAC,gBAAgB,IACf,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAC7C,qBAAqB,EAAE,6BAA6B,GACpD,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,yDAAyD;AACzD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAE5C,eAAe,SAAS,CAAC","sourcesContent":["import {useBaseRoomShellStore} from '@sqlrooms/room-shell';\nimport {\n Button,\n ResizableHandle,\n ResizablePanel,\n ResizablePanelGroup,\n} from '@sqlrooms/ui';\nimport {PlusIcon} from 'lucide-react';\nimport React, {useCallback, useState} from 'react';\nimport CreateTableModal from './components/CreateTableModal';\nimport {QueryEditorPanel} from './components/QueryEditorPanel';\nimport {QueryResultPanel} from './components/QueryResultPanel';\nimport {SqlEditorHeader} from './components/SqlEditorHeader';\nimport {\n TableStructurePanel,\n TableStructurePanelProps,\n} from './components/TableStructurePanel';\nimport {useStoreWithSqlEditor} from './SqlEditorSlice';\nexport type SqlEditorProps = {\n /** The database schema to use. Defaults to '*'.\n * If '*' is provided, all tables will be shown.\n * If a function is provided, it will be used to filter the tables. */\n schema?: TableStructurePanelProps['schema'];\n /** Whether the SQL editor is currently visible */\n isOpen: boolean;\n /** Optional component to render SQL documentation in the side panel */\n documentationPanel?: React.ReactNode;\n /** Callback fired when the SQL editor should be closed */\n onClose: () => void;\n};\n\nconst SqlEditorBase: React.FC<SqlEditorProps> = (props) => {\n const {schema = '*', documentationPanel} = props;\n\n // Store access\n const addOrUpdateSqlQueryDataSource = useBaseRoomShellStore(\n (state) => state.room.addOrUpdateSqlQueryDataSource,\n );\n const lastQueryStatement = useStoreWithSqlEditor((s) =>\n s.sqlEditor.queryResult?.status === 'success' &&\n s.sqlEditor.queryResult?.type === 'select'\n ? s.sqlEditor.queryResult.lastQueryStatement\n : '',\n );\n // const currentQuery = useStoreWithSqlEditor((s) =>\n // s.sqlEditor.getCurrentQuery(),\n // );\n\n // UI state\n const [showDocs, setShowDocs] = useState(false);\n const [createTableModalOpen, setCreateTableModalOpen] = useState(false);\n\n // Handlers\n const handleToggleDocs = useCallback((show: boolean) => {\n setShowDocs(show);\n }, []);\n\n const handleCreateTable = useCallback(() => {\n setCreateTableModalOpen(true);\n }, []);\n\n return (\n <div className=\"relative flex h-full w-full flex-col overflow-hidden\">\n <SqlEditorHeader\n title=\"SQL Editor\"\n showDocs={showDocs}\n documentationPanel={documentationPanel}\n onToggleDocs={handleToggleDocs}\n />\n <div className=\"bg-muted h-full flex-grow\">\n <ResizablePanelGroup direction=\"horizontal\" className=\"h-full\">\n <ResizablePanel defaultSize={showDocs ? 70 : 100}>\n <ResizablePanelGroup direction=\"vertical\" className=\"h-full\">\n <ResizablePanel defaultSize={50} className=\"flex flex-row\">\n <ResizablePanelGroup direction=\"horizontal\">\n <ResizablePanel defaultSize={20}>\n <TableStructurePanel schema={schema} />\n </ResizablePanel>\n <ResizableHandle withHandle />\n <ResizablePanel\n defaultSize={80}\n // this is for Monaco's completion menu to not being cut off\n className=\"!overflow-visible\"\n >\n <QueryEditorPanel />\n </ResizablePanel>\n </ResizablePanelGroup>\n </ResizablePanel>\n <ResizableHandle withHandle />\n <ResizablePanel defaultSize={50}>\n <QueryResultPanel\n renderActions={() => (\n <div className=\"flex gap-2\">\n <Button size=\"xs\" onClick={handleCreateTable}>\n <PlusIcon className=\"h-4 w-4\" />\n New table\n </Button>\n </div>\n )}\n />\n </ResizablePanel>\n </ResizablePanelGroup>\n </ResizablePanel>\n {showDocs && (\n <>\n <ResizableHandle withHandle />\n <ResizablePanel defaultSize={30}>\n {documentationPanel}\n </ResizablePanel>\n </>\n )}\n </ResizablePanelGroup>\n </div>\n <CreateTableModal\n query={lastQueryStatement}\n isOpen={createTableModalOpen}\n onClose={() => setCreateTableModalOpen(false)}\n onAddOrUpdateSqlQuery={addOrUpdateSqlQueryDataSource}\n />\n </div>\n );\n};\n\n// Wrap with React.memo to prevent unnecessary re-renders\nconst SqlEditor = React.memo(SqlEditorBase);\n\nexport default SqlEditor;\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { MonacoEditorProps } from '@sqlrooms/monaco-editor';
|
|
3
|
-
import type { DataTable } from '@sqlrooms/duckdb';
|
|
3
|
+
import type { DataTable, DuckDbConnector } from '@sqlrooms/duckdb';
|
|
4
4
|
export interface SqlMonacoEditorProps extends Omit<MonacoEditorProps, 'language'> {
|
|
5
|
+
connector?: DuckDbConnector;
|
|
5
6
|
/**
|
|
6
7
|
* Custom SQL keywords to add to the completion provider
|
|
7
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlMonacoEditor.d.ts","sourceRoot":"","sources":["../src/SqlMonacoEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAQ/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SqlMonacoEditor.d.ts","sourceRoot":"","sources":["../src/SqlMonacoEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAQ/D,OAAO,KAAK,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAKjE,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC;IAC3C,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC;IAC3B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM;QACvB,YAAY,EAAE,SAAS,EAAE,CAAC;KAC3B,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqQ1D,CAAC"}
|
package/dist/SqlMonacoEditor.js
CHANGED
|
@@ -3,11 +3,13 @@ import { useCallback, useEffect, useRef } from 'react';
|
|
|
3
3
|
import { MonacoEditor } from '@sqlrooms/monaco-editor';
|
|
4
4
|
import { DUCKDB_KEYWORDS, DUCKDB_FUNCTIONS, SQL_LANGUAGE_CONFIGURATION, } from './constants/duckdb-dialect';
|
|
5
5
|
import { cn } from '@sqlrooms/ui';
|
|
6
|
+
import { getFunctionSuggestions } from './constants/functionSuggestions';
|
|
7
|
+
import { languages } from 'monaco-editor';
|
|
6
8
|
/**
|
|
7
9
|
* A Monaco editor for editing SQL with DuckDB syntax highlighting and autocompletion
|
|
8
10
|
* This is an internal component used by SqlEditor
|
|
9
11
|
*/
|
|
10
|
-
export const SqlMonacoEditor = ({ customKeywords = [], customFunctions = [], tableSchemas = [], getLatestSchemas, onMount, className, ...props }) => {
|
|
12
|
+
export const SqlMonacoEditor = ({ connector, customKeywords = [], customFunctions = [], tableSchemas = [], getLatestSchemas, onMount, className, ...props }) => {
|
|
11
13
|
// Store references to editor and monaco
|
|
12
14
|
const editorRef = useRef(null);
|
|
13
15
|
const monacoRef = useRef(null);
|
|
@@ -24,7 +26,7 @@ export const SqlMonacoEditor = ({ customKeywords = [], customFunctions = [], tab
|
|
|
24
26
|
// Register SQL completion provider
|
|
25
27
|
const disposable = monaco.languages.registerCompletionItemProvider('sql', {
|
|
26
28
|
triggerCharacters: [' ', '.', ',', '(', '='],
|
|
27
|
-
provideCompletionItems: (model, position) => {
|
|
29
|
+
provideCompletionItems: async (model, position) => {
|
|
28
30
|
try {
|
|
29
31
|
// Get the latest schemas if the callback is provided
|
|
30
32
|
let currentSchemas = tableSchemas;
|
|
@@ -78,6 +80,23 @@ export const SqlMonacoEditor = ({ customKeywords = [], customFunctions = [], tab
|
|
|
78
80
|
sortText: isTableContext ? 'z' + func : 'b' + func, // Lower priority in table context
|
|
79
81
|
});
|
|
80
82
|
});
|
|
83
|
+
if (connector) {
|
|
84
|
+
const functionSuggestions = await getFunctionSuggestions(connector, word.word);
|
|
85
|
+
for (const { name, documentation } of functionSuggestions) {
|
|
86
|
+
suggestions.push({
|
|
87
|
+
label: name,
|
|
88
|
+
insertText: name,
|
|
89
|
+
documentation: {
|
|
90
|
+
value: documentation,
|
|
91
|
+
isTrusted: true,
|
|
92
|
+
supportHtml: true,
|
|
93
|
+
},
|
|
94
|
+
range: range,
|
|
95
|
+
kind: languages.CompletionItemKind.Function,
|
|
96
|
+
sortText: isTableContext ? 'z' + name : 'b' + name, // Lower priority in table context
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
81
100
|
}
|
|
82
101
|
// Add table and column suggestions from schemas
|
|
83
102
|
currentSchemas.forEach((table) => {
|
|
@@ -190,13 +209,7 @@ export const SqlMonacoEditor = ({ customKeywords = [], customFunctions = [], tab
|
|
|
190
209
|
if (onMount) {
|
|
191
210
|
onMount(editor, monaco);
|
|
192
211
|
}
|
|
193
|
-
}, [
|
|
194
|
-
customKeywords,
|
|
195
|
-
customFunctions,
|
|
196
|
-
tableSchemas,
|
|
197
|
-
onMount,
|
|
198
|
-
registerCompletionProvider,
|
|
199
|
-
]);
|
|
212
|
+
}, [customKeywords, customFunctions, onMount, registerCompletionProvider]);
|
|
200
213
|
return (_jsx(MonacoEditor, { language: "sql", onMount: handleEditorDidMount, className: cn('h-full', className), options: {
|
|
201
214
|
formatOnPaste: true,
|
|
202
215
|
formatOnType: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SqlMonacoEditor.js","sourceRoot":"","sources":["../src/SqlMonacoEditor.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAyBhC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC,CAAC,EAC9D,cAAc,GAAG,EAAE,EACnB,eAAe,GAAG,EAAE,EACpB,YAAY,GAAG,EAAE,EACjB,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,EAAE;IACH,wCAAwC;IACxC,MAAM,SAAS,GAAG,MAAM,CAAM,IAAI,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,MAAM,CAAM,IAAI,CAAC,CAAC;IACpC,MAAM,aAAa,GAAG,MAAM,CAAM,IAAI,CAAC,CAAC;IAExC,+CAA+C;IAC/C,MAAM,0BAA0B,GAAG,WAAW,CAAC,GAAG,EAAE;QAClD,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE,OAAO;QAErD,MAAM,MAAM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E,CAAC;YACZ,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,EACD;QACE,cAAc;QACd,eAAe;QACf,YAAY;QACZ,OAAO;QACP,0BAA0B;KAC3B,CACF,CAAC;IAEF,OAAO,CACL,KAAC,YAAY,IACX,QAAQ,EAAC,KAAK,EACd,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClC,OAAO,EAAE;YACP,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACf,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, {useCallback, useEffect, useRef} from 'react';\nimport {MonacoEditor} from '@sqlrooms/monaco-editor';\nimport type {MonacoEditorProps} from '@sqlrooms/monaco-editor';\nimport type {OnMount} from '@monaco-editor/react';\nimport type * as Monaco from 'monaco-editor';\nimport {\n DUCKDB_KEYWORDS,\n DUCKDB_FUNCTIONS,\n SQL_LANGUAGE_CONFIGURATION,\n} from './constants/duckdb-dialect';\nimport type {DataTable} from '@sqlrooms/duckdb';\nimport {cn} from '@sqlrooms/ui';\n\nexport interface SqlMonacoEditorProps\n extends Omit<MonacoEditorProps, 'language'> {\n /**\n * Custom SQL keywords to add to the completion provider\n */\n customKeywords?: string[];\n /**\n * Custom SQL functions to add to the completion provider\n */\n customFunctions?: string[];\n /**\n * Table schemas for autocompletion\n */\n tableSchemas?: DataTable[];\n /**\n * Callback to get the latest table schemas\n * This is called from within provideCompletionItems to ensure we have the latest data\n */\n getLatestSchemas?: () => {\n tableSchemas: DataTable[];\n };\n}\n\n/**\n * A Monaco editor for editing SQL with DuckDB syntax highlighting and autocompletion\n * This is an internal component used by SqlEditor\n */\nexport const SqlMonacoEditor: React.FC<SqlMonacoEditorProps> = ({\n customKeywords = [],\n customFunctions = [],\n tableSchemas = [],\n getLatestSchemas,\n onMount,\n className,\n ...props\n}) => {\n // Store references to editor and monaco\n const editorRef = useRef<any>(null);\n const monacoRef = useRef<any>(null);\n const disposableRef = useRef<any>(null);\n\n // Function to register the completion provider\n const registerCompletionProvider = useCallback(() => {\n if (!editorRef.current || !monacoRef.current) return;\n\n const monaco = monacoRef.current;\n\n // Dispose previous provider if it exists\n if (disposableRef.current) {\n disposableRef.current.dispose();\n }\n\n // Register SQL completion provider\n const disposable = monaco.languages.registerCompletionItemProvider('sql', {\n triggerCharacters: [' ', '.', ',', '(', '='],\n provideCompletionItems: (model: any, position: any) => {\n try {\n // Get the latest schemas if the callback is provided\n let currentSchemas = tableSchemas;\n\n if (getLatestSchemas) {\n const latest = getLatestSchemas();\n currentSchemas = latest.tableSchemas;\n }\n\n const suggestions: Monaco.languages.CompletionItem[] = [];\n const word = model.getWordUntilPosition(position);\n const range = {\n startLineNumber: position.lineNumber,\n endLineNumber: position.lineNumber,\n startColumn: word.startColumn,\n endColumn: word.endColumn,\n };\n\n // Get the text before the cursor to determine context\n const lineContent = model.getLineContent(position.lineNumber);\n const textBeforeCursor = lineContent\n .substring(0, position.column - 1)\n .trim()\n .toLowerCase();\n\n // Check if we're after a FROM, JOIN, or similar clause to prioritize table suggestions\n const isTableContext = /\\b(from|join|into|update|table)\\s+\\w*$/.test(\n textBeforeCursor,\n );\n\n // Check if we're after a table name and period to prioritize column suggestions\n const isColumnContext = /\\b(\\w+)\\.\\w*$/.test(textBeforeCursor);\n\n // Combine keywords and functions with custom ones\n const keywords = [...DUCKDB_KEYWORDS, ...customKeywords];\n const functions = [...DUCKDB_FUNCTIONS, ...customFunctions];\n\n // Add keyword suggestions (if not in a specific context)\n if (!isColumnContext) {\n keywords.forEach((keyword) => {\n suggestions.push({\n label: keyword,\n kind: monaco.languages.CompletionItemKind.Keyword,\n insertText: keyword,\n range: range,\n detail: 'Keyword',\n sortText: isTableContext ? 'z' + keyword : 'a' + keyword, // Lower priority in table context\n });\n });\n }\n\n // Add function suggestions (if not in a specific context)\n if (!isColumnContext) {\n functions.forEach((func) => {\n suggestions.push({\n label: func,\n kind: monaco.languages.CompletionItemKind.Function,\n insertText: func,\n range: range,\n detail: 'Function',\n sortText: isTableContext ? 'z' + func : 'b' + func, // Lower priority in table context\n });\n });\n }\n\n // Add table and column suggestions from schemas\n currentSchemas.forEach((table) => {\n const tableName = table.tableName;\n\n // Add table suggestion\n suggestions.push({\n label: tableName,\n kind: monaco.languages.CompletionItemKind.Class,\n insertText: tableName,\n range: range,\n detail: 'Table',\n documentation: {\n value: `Table: ${tableName}`,\n isTrusted: true,\n },\n sortText: isTableContext ? 'a' + tableName : 'c' + tableName, // Higher priority in table context\n });\n\n // Extract table name from context if we're in a column context\n let contextTableName = '';\n if (isColumnContext) {\n const match = textBeforeCursor.match(/\\b(\\w+)\\.\\w*$/);\n if (match && match[1]) {\n contextTableName = match[1];\n }\n }\n\n // Only add columns for the current table if we're in a column context\n if (!isColumnContext || contextTableName === tableName) {\n // Add column suggestions\n table.columns.forEach((column) => {\n const columnName = column.name;\n const columnType = column.type;\n\n suggestions.push({\n label: columnName,\n kind: monaco.languages.CompletionItemKind.Field,\n insertText: columnName,\n range: range,\n detail: `Column (${columnType})`,\n documentation: {\n value: `Column from table ${tableName}`,\n isTrusted: true,\n },\n sortText:\n isColumnContext && contextTableName === tableName\n ? 'a' + columnName\n : 'd' + columnName,\n });\n\n // Only add table.column suggestions if not in a column context\n if (!isColumnContext) {\n suggestions.push({\n label: `${tableName}.${columnName}`,\n kind: monaco.languages.CompletionItemKind.Field,\n insertText: `${tableName}.${columnName}`,\n range: range,\n detail: `Column (${columnType})`,\n documentation: {\n value: `Column from table ${tableName}`,\n isTrusted: true,\n },\n sortText: 'e' + tableName + columnName,\n });\n }\n });\n }\n });\n\n return {\n suggestions,\n };\n } catch (error) {\n console.error('Error in SQL completion provider:', error);\n return {suggestions: []};\n }\n },\n });\n\n // Store the disposable to clean up later\n disposableRef.current = disposable;\n }, [customKeywords, customFunctions, tableSchemas, getLatestSchemas]);\n\n // Re-register completion provider when tableSchemas change\n useEffect(() => {\n if (editorRef.current && monacoRef.current) {\n registerCompletionProvider();\n }\n }, [tableSchemas, registerCompletionProvider]);\n\n // Handle editor mounting to configure SQL language features\n const handleEditorDidMount = useCallback<OnMount>(\n (editor, monaco) => {\n // Store references\n editorRef.current = editor;\n monacoRef.current = monaco;\n\n // Register SQL language if not already registered\n if (\n !monaco.languages.getLanguages().some((lang: any) => lang.id === 'sql')\n ) {\n monaco.languages.register({id: 'sql'});\n }\n\n // Combine keywords and functions with custom ones\n const keywords = [...DUCKDB_KEYWORDS, ...customKeywords];\n const functions = [...DUCKDB_FUNCTIONS, ...customFunctions];\n\n // Set the language configuration\n monaco.languages.setMonarchTokensProvider('sql', {\n ...SQL_LANGUAGE_CONFIGURATION,\n keywords,\n builtinFunctions: functions,\n } as any); // Using 'as any' to bypass the type checking issue\n\n // Register the completion provider\n registerCompletionProvider();\n\n // Store the disposable to clean up later if needed\n editor.onDidDispose(() => {\n if (disposableRef.current) {\n disposableRef.current.dispose();\n }\n });\n\n // Call the original onMount if provided\n if (onMount) {\n onMount(editor, monaco);\n }\n },\n [\n customKeywords,\n customFunctions,\n tableSchemas,\n onMount,\n registerCompletionProvider,\n ],\n );\n\n return (\n <MonacoEditor\n language=\"sql\"\n onMount={handleEditorDidMount}\n className={cn('h-full', className)}\n options={{\n formatOnPaste: true,\n formatOnType: true,\n wordWrap: 'on',\n }}\n {...props}\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"SqlMonacoEditor.js","sourceRoot":"","sources":["../src/SqlMonacoEditor.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,EAAE,EAAC,MA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CAAC,CAAC;QAEH,wCAAwC;QACxC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,EACD,CAAC,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,0BAA0B,CAAC,CACvE,CAAC;IAEF,OAAO,CACL,KAAC,YAAY,IACX,QAAQ,EAAC,KAAK,EACd,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClC,OAAO,EAAE;YACP,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACf,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, {useCallback, useEffect, useRef} from 'react';\nimport {MonacoEditor} from '@sqlrooms/monaco-editor';\nimport type {MonacoEditorProps} from '@sqlrooms/monaco-editor';\nimport type {OnMount} from '@monaco-editor/react';\nimport type * as Monaco from 'monaco-editor';\nimport {\n DUCKDB_KEYWORDS,\n DUCKDB_FUNCTIONS,\n SQL_LANGUAGE_CONFIGURATION,\n} from './constants/duckdb-dialect';\nimport type {DataTable, DuckDbConnector} from '@sqlrooms/duckdb';\nimport {cn} from '@sqlrooms/ui';\nimport {getFunctionSuggestions} from './constants/functionSuggestions';\nimport {languages} from 'monaco-editor';\n\nexport interface SqlMonacoEditorProps\n extends Omit<MonacoEditorProps, 'language'> {\n connector?: DuckDbConnector;\n /**\n * Custom SQL keywords to add to the completion provider\n */\n customKeywords?: string[];\n /**\n * Custom SQL functions to add to the completion provider\n */\n customFunctions?: string[];\n /**\n * Table schemas for autocompletion\n */\n tableSchemas?: DataTable[];\n /**\n * Callback to get the latest table schemas\n * This is called from within provideCompletionItems to ensure we have the latest data\n */\n getLatestSchemas?: () => {\n tableSchemas: DataTable[];\n };\n}\n\n/**\n * A Monaco editor for editing SQL with DuckDB syntax highlighting and autocompletion\n * This is an internal component used by SqlEditor\n */\nexport const SqlMonacoEditor: React.FC<SqlMonacoEditorProps> = ({\n connector,\n customKeywords = [],\n customFunctions = [],\n tableSchemas = [],\n getLatestSchemas,\n onMount,\n className,\n ...props\n}) => {\n // Store references to editor and monaco\n const editorRef = useRef<any>(null);\n const monacoRef = useRef<any>(null);\n const disposableRef = useRef<any>(null);\n\n // Function to register the completion provider\n const registerCompletionProvider = useCallback(() => {\n if (!editorRef.current || !monacoRef.current) return;\n\n const monaco = monacoRef.current;\n\n // Dispose previous provider if it exists\n if (disposableRef.current) {\n disposableRef.current.dispose();\n }\n\n // Register SQL completion provider\n const disposable = monaco.languages.registerCompletionItemProvider('sql', {\n triggerCharacters: [' ', '.', ',', '(', '='],\n provideCompletionItems: async (model: any, position: any) => {\n try {\n // Get the latest schemas if the callback is provided\n let currentSchemas = tableSchemas;\n\n if (getLatestSchemas) {\n const latest = getLatestSchemas();\n currentSchemas = latest.tableSchemas;\n }\n\n const suggestions: Monaco.languages.CompletionItem[] = [];\n const word = model.getWordUntilPosition(position);\n const range = {\n startLineNumber: position.lineNumber,\n endLineNumber: position.lineNumber,\n startColumn: word.startColumn,\n endColumn: word.endColumn,\n };\n\n // Get the text before the cursor to determine context\n const lineContent = model.getLineContent(position.lineNumber);\n const textBeforeCursor = lineContent\n .substring(0, position.column - 1)\n .trim()\n .toLowerCase();\n\n // Check if we're after a FROM, JOIN, or similar clause to prioritize table suggestions\n const isTableContext = /\\b(from|join|into|update|table)\\s+\\w*$/.test(\n textBeforeCursor,\n );\n\n // Check if we're after a table name and period to prioritize column suggestions\n const isColumnContext = /\\b(\\w+)\\.\\w*$/.test(textBeforeCursor);\n\n // Combine keywords and functions with custom ones\n const keywords = [...DUCKDB_KEYWORDS, ...customKeywords];\n const functions = [...DUCKDB_FUNCTIONS, ...customFunctions];\n\n // Add keyword suggestions (if not in a specific context)\n if (!isColumnContext) {\n keywords.forEach((keyword) => {\n suggestions.push({\n label: keyword,\n kind: monaco.languages.CompletionItemKind.Keyword,\n insertText: keyword,\n range: range,\n detail: 'Keyword',\n sortText: isTableContext ? 'z' + keyword : 'a' + keyword, // Lower priority in table context\n });\n });\n }\n\n // Add function suggestions (if not in a specific context)\n if (!isColumnContext) {\n functions.forEach((func) => {\n suggestions.push({\n label: func,\n kind: monaco.languages.CompletionItemKind.Function,\n insertText: func,\n range: range,\n detail: 'Function',\n sortText: isTableContext ? 'z' + func : 'b' + func, // Lower priority in table context\n });\n });\n if (connector) {\n const functionSuggestions = await getFunctionSuggestions(\n connector,\n word.word,\n );\n for (const {name, documentation} of functionSuggestions) {\n suggestions.push({\n label: name,\n insertText: name,\n documentation: {\n value: documentation,\n isTrusted: true,\n supportHtml: true,\n },\n range: range,\n kind: languages.CompletionItemKind.Function,\n sortText: isTableContext ? 'z' + name : 'b' + name, // Lower priority in table context\n });\n }\n }\n }\n\n // Add table and column suggestions from schemas\n currentSchemas.forEach((table) => {\n const tableName = table.tableName;\n\n // Add table suggestion\n suggestions.push({\n label: tableName,\n kind: monaco.languages.CompletionItemKind.Class,\n insertText: tableName,\n range: range,\n detail: 'Table',\n documentation: {\n value: `Table: ${tableName}`,\n isTrusted: true,\n },\n sortText: isTableContext ? 'a' + tableName : 'c' + tableName, // Higher priority in table context\n });\n\n // Extract table name from context if we're in a column context\n let contextTableName = '';\n if (isColumnContext) {\n const match = textBeforeCursor.match(/\\b(\\w+)\\.\\w*$/);\n if (match && match[1]) {\n contextTableName = match[1];\n }\n }\n\n // Only add columns for the current table if we're in a column context\n if (!isColumnContext || contextTableName === tableName) {\n // Add column suggestions\n table.columns.forEach((column) => {\n const columnName = column.name;\n const columnType = column.type;\n\n suggestions.push({\n label: columnName,\n kind: monaco.languages.CompletionItemKind.Field,\n insertText: columnName,\n range: range,\n detail: `Column (${columnType})`,\n documentation: {\n value: `Column from table ${tableName}`,\n isTrusted: true,\n },\n sortText:\n isColumnContext && contextTableName === tableName\n ? 'a' + columnName\n : 'd' + columnName,\n });\n\n // Only add table.column suggestions if not in a column context\n if (!isColumnContext) {\n suggestions.push({\n label: `${tableName}.${columnName}`,\n kind: monaco.languages.CompletionItemKind.Field,\n insertText: `${tableName}.${columnName}`,\n range: range,\n detail: `Column (${columnType})`,\n documentation: {\n value: `Column from table ${tableName}`,\n isTrusted: true,\n },\n sortText: 'e' + tableName + columnName,\n });\n }\n });\n }\n });\n\n return {\n suggestions,\n };\n } catch (error) {\n console.error('Error in SQL completion provider:', error);\n return {suggestions: []};\n }\n },\n });\n\n // Store the disposable to clean up later\n disposableRef.current = disposable;\n }, [customKeywords, customFunctions, tableSchemas, getLatestSchemas]);\n\n // Re-register completion provider when tableSchemas change\n useEffect(() => {\n if (editorRef.current && monacoRef.current) {\n registerCompletionProvider();\n }\n }, [tableSchemas, registerCompletionProvider]);\n\n // Handle editor mounting to configure SQL language features\n const handleEditorDidMount = useCallback<OnMount>(\n (editor, monaco) => {\n // Store references\n editorRef.current = editor;\n monacoRef.current = monaco;\n\n // Register SQL language if not already registered\n if (\n !monaco.languages.getLanguages().some((lang: any) => lang.id === 'sql')\n ) {\n monaco.languages.register({id: 'sql'});\n }\n\n // Combine keywords and functions with custom ones\n const keywords = [...DUCKDB_KEYWORDS, ...customKeywords];\n const functions = [...DUCKDB_FUNCTIONS, ...customFunctions];\n\n // Set the language configuration\n monaco.languages.setMonarchTokensProvider('sql', {\n ...SQL_LANGUAGE_CONFIGURATION,\n keywords,\n builtinFunctions: functions,\n } as any); // Using 'as any' to bypass the type checking issue\n\n // Register the completion provider\n registerCompletionProvider();\n\n // Store the disposable to clean up later if needed\n editor.onDidDispose(() => {\n if (disposableRef.current) {\n disposableRef.current.dispose();\n }\n });\n\n // Call the original onMount if provided\n if (onMount) {\n onMount(editor, monaco);\n }\n },\n [customKeywords, customFunctions, onMount, registerCompletionProvider],\n );\n\n return (\n <MonacoEditor\n language=\"sql\"\n onMount={handleEditorDidMount}\n className={cn('h-full', className)}\n options={{\n formatOnPaste: true,\n formatOnType: true,\n wordWrap: 'on',\n }}\n {...props}\n />\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateTableModal.d.ts","sourceRoot":"","sources":["../../src/components/CreateTableModal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAmBxD,OAAO,EAAC,EAAE,EAAc,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateTableModal.d.ts","sourceRoot":"","sources":["../../src/components/CreateTableModal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAmBxD,OAAO,EAAC,EAAE,EAAc,MAAM,OAAO,CAAC;AAmBtC,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,qBAAqB,EAAE,CACrB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,KAClB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA6G/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { useCallback } from 'react';
|
|
|
5
5
|
import { useForm } from 'react-hook-form';
|
|
6
6
|
import * as z from 'zod';
|
|
7
7
|
import { SqlMonacoEditor } from '../SqlMonacoEditor';
|
|
8
|
+
import { useStoreWithSqlEditor } from '../SqlEditorSlice';
|
|
8
9
|
const VALID_TABLE_OR_COLUMN_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/;
|
|
9
10
|
const formSchema = z.object({
|
|
10
11
|
tableName: z
|
|
@@ -15,6 +16,7 @@ const formSchema = z.object({
|
|
|
15
16
|
});
|
|
16
17
|
const CreateTableModal = (props) => {
|
|
17
18
|
const { editDataSource, isOpen, onClose, onAddOrUpdateSqlQuery } = props;
|
|
19
|
+
const connector = useStoreWithSqlEditor((state) => state.db.connector);
|
|
18
20
|
const form = useForm({
|
|
19
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
22
|
resolver: zodResolver(formSchema),
|
|
@@ -36,7 +38,7 @@ const CreateTableModal = (props) => {
|
|
|
36
38
|
}, [onAddOrUpdateSqlQuery, editDataSource?.tableName, onClose, form]);
|
|
37
39
|
return (_jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: _jsx(DialogContent, { className: "sm:max-w-[800px]", children: _jsx(Form, { ...form, children: _jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: editDataSource
|
|
38
40
|
? 'Edit table query'
|
|
39
|
-
: 'Create table from query' }), !editDataSource && (_jsx(DialogDescription, { children: "Create a new table from the results of an SQL query." }))] }), form.formState.errors.root && (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { className: "whitespace-pre-wrap font-mono text-xs", children: form.formState.errors.root.message }) })), _jsx(FormField, { control: form.control, name: "tableName", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Table name:" }), _jsx(FormControl, { children: _jsx(Input, { ...field, className: "font-mono", autoFocus: true }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "query", render: ({ field }) => (_jsxs(FormItem, { className: "flex flex-col", children: [_jsx(FormLabel, { children: "SQL query:" }), _jsx(FormControl, { children: _jsx(SqlMonacoEditor, { value: field.value, onChange: field.onChange, className: "h-[200px] w-full", options: {
|
|
41
|
+
: 'Create table from query' }), !editDataSource && (_jsx(DialogDescription, { children: "Create a new table from the results of an SQL query." }))] }), form.formState.errors.root && (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { className: "whitespace-pre-wrap font-mono text-xs", children: form.formState.errors.root.message }) })), _jsx(FormField, { control: form.control, name: "tableName", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Table name:" }), _jsx(FormControl, { children: _jsx(Input, { ...field, className: "font-mono", autoFocus: true }) }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "query", render: ({ field }) => (_jsxs(FormItem, { className: "flex flex-col", children: [_jsx(FormLabel, { children: "SQL query:" }), _jsx(FormControl, { children: _jsx(SqlMonacoEditor, { connector: connector, value: field.value, onChange: field.onChange, className: "h-[200px] w-full", options: {
|
|
40
42
|
scrollBeyondLastLine: false,
|
|
41
43
|
automaticLayout: true,
|
|
42
44
|
minimap: { enabled: false },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateTableModal.js","sourceRoot":"","sources":["../../src/components/CreateTableModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,GACN,MAAM,cAAc,CAAC;AACtB,OAAO,EAAK,WAAW,EAAC,MAAM,OAAO,CAAC;AACtC,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateTableModal.js","sourceRoot":"","sources":["../../src/components/CreateTableModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,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","sourcesContent":["import {zodResolver} from '@hookform/resolvers/zod';\nimport {SqlQueryDataSource} from '@sqlrooms/room-shell';\nimport {\n Alert,\n AlertDescription,\n Button,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n Input,\n} from '@sqlrooms/ui';\nimport {FC, useCallback} from 'react';\nimport {useForm} from 'react-hook-form';\nimport * as z from 'zod';\nimport {SqlMonacoEditor} from '../SqlMonacoEditor';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\n\nconst VALID_TABLE_OR_COLUMN_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]{0,62}$/;\n\nconst formSchema = z.object({\n tableName: z\n .string()\n .min(1, 'Table name is required')\n .regex(\n VALID_TABLE_OR_COLUMN_REGEX,\n 'Only letters, digits and underscores are allowed; should not start with a digit',\n ),\n query: z.string().min(1, 'Query is required'),\n});\n\nexport type CreateTableModalProps = {\n query: string;\n isOpen: boolean;\n onClose: () => void;\n editDataSource?: SqlQueryDataSource;\n onAddOrUpdateSqlQuery: (\n tableName: string,\n query: string,\n oldTableName?: string,\n ) => Promise<void>;\n};\n\nconst CreateTableModal: FC<CreateTableModalProps> = (props) => {\n const {editDataSource, isOpen, onClose, onAddOrUpdateSqlQuery} = props;\n\n const connector = useStoreWithSqlEditor((state) => state.db.connector);\n const form = useForm<z.infer<typeof formSchema>>({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: zodResolver(formSchema as any),\n defaultValues: {\n tableName: editDataSource?.tableName ?? '',\n query: editDataSource?.sqlQuery ?? props.query.trim(),\n },\n });\n\n const onSubmit = useCallback(\n async (values: z.infer<typeof formSchema>) => {\n try {\n const {tableName, query} = values;\n await onAddOrUpdateSqlQuery(\n tableName,\n query,\n editDataSource?.tableName,\n );\n form.reset();\n onClose();\n } catch (err) {\n form.setError('root', {type: 'manual', message: `${err}`});\n }\n },\n [onAddOrUpdateSqlQuery, editDataSource?.tableName, onClose, form],\n );\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogContent className=\"sm:max-w-[800px]\">\n <Form {...form}>\n <form onSubmit={form.handleSubmit(onSubmit)} className=\"space-y-4\">\n <DialogHeader>\n <DialogTitle>\n {editDataSource\n ? 'Edit table query'\n : 'Create table from query'}\n </DialogTitle>\n {!editDataSource && (\n <DialogDescription>\n Create a new table from the results of an SQL query.\n </DialogDescription>\n )}\n </DialogHeader>\n\n {form.formState.errors.root && (\n <Alert variant=\"destructive\">\n <AlertDescription className=\"whitespace-pre-wrap font-mono text-xs\">\n {form.formState.errors.root.message}\n </AlertDescription>\n </Alert>\n )}\n\n <FormField\n control={form.control}\n name=\"tableName\"\n render={({field}) => (\n <FormItem>\n <FormLabel>Table name:</FormLabel>\n <FormControl>\n <Input {...field} className=\"font-mono\" autoFocus />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <FormField\n control={form.control}\n name=\"query\"\n render={({field}) => (\n <FormItem className=\"flex flex-col\">\n <FormLabel>SQL query:</FormLabel>\n <FormControl>\n <SqlMonacoEditor\n connector={connector}\n value={field.value}\n onChange={field.onChange}\n className=\"h-[200px] w-full\"\n options={{\n scrollBeyondLastLine: false,\n automaticLayout: true,\n minimap: {enabled: false},\n wordWrap: 'on',\n }}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n\n <DialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n Cancel\n </Button>\n <Button type=\"submit\" disabled={form.formState.isSubmitting}>\n {editDataSource ? 'Update' : 'Create'}\n </Button>\n </DialogFooter>\n </form>\n </Form>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default CreateTableModal;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEditorPanel.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditorPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"QueryEditorPanel.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditorPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA2C5D,CAAC"}
|
|
@@ -9,6 +9,8 @@ export const QueryEditorPanel = ({ className, }) => {
|
|
|
9
9
|
const selectedQueryId = useStoreWithSqlEditor((s) => s.config.sqlEditor.selectedQueryId);
|
|
10
10
|
const queries = useStoreWithSqlEditor((s) => s.config.sqlEditor.queries);
|
|
11
11
|
const setSelectedQueryId = useStoreWithSqlEditor((s) => s.sqlEditor.setSelectedQueryId);
|
|
12
|
-
return (_jsxs(Tabs, { value: selectedQueryId, onValueChange: setSelectedQueryId, className: cn('flex h-full flex-col
|
|
12
|
+
return (_jsxs(Tabs, { value: selectedQueryId, onValueChange: setSelectedQueryId, className: cn('flex h-full flex-col',
|
|
13
|
+
// this is for Monaco's completion menu to not being cut off
|
|
14
|
+
'overflow-visible', className), children: [_jsxs("div", { className: "border-border flex items-center border-b p-1", children: [_jsx(QueryEditorPanelActions, {}), _jsx(QueryEditorPanelTabsList, {})] }), queries.map((q) => (_jsx(TabsContent, { value: q.id, className: "relative h-full flex-grow flex-col data-[state=active]:flex", children: _jsx("div", { className: "absolute inset-0 h-full w-full flex-grow", children: q.id === selectedQueryId && (_jsx(QueryEditorPanelEditor, { queryId: q.id })) }) }, q.id)))] }));
|
|
13
15
|
};
|
|
14
16
|
//# sourceMappingURL=QueryEditorPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEditorPanel.js","sourceRoot":"","sources":["../../src/components/QueryEditorPanel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAOpE,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAChE,SAAS,GACV,EAAE,EAAE;IACH,oDAAoD;IAEpD,MAAM,eAAe,GAAG,qBAAqB,CAC3C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAC1C,CAAC;IACF,MAAM,OAAO,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzE,MAAM,kBAAkB,GAAG,qBAAqB,CAC9C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,kBAAkB,CACtC,CAAC;IAEF,OAAO,CACL,MAAC,IAAI,IACH,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,kBAAkB,EACjC,SAAS,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"QueryEditorPanel.js","sourceRoot":"","sources":["../../src/components/QueryEditorPanel.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2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lrooms/ui';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\nimport {QueryEditorPanelActions} from './QueryEditorPanelActions';\nimport {QueryEditorPanelEditor} from './QueryEditorPanelEditor';\nimport {QueryEditorPanelTabsList} from './QueryEditorPanelTabsList';\n\nexport interface QueryEditorPanelProps {\n /** Custom class name for styling */\n className?: string;\n}\n\nexport const QueryEditorPanel: React.FC<QueryEditorPanelProps> = ({\n className,\n}) => {\n // Get state and actions from store in a single call\n\n const selectedQueryId = useStoreWithSqlEditor(\n (s) => s.config.sqlEditor.selectedQueryId,\n );\n const queries = useStoreWithSqlEditor((s) => s.config.sqlEditor.queries);\n const setSelectedQueryId = useStoreWithSqlEditor(\n (s) => s.sqlEditor.setSelectedQueryId,\n );\n\n return (\n <Tabs\n value={selectedQueryId}\n onValueChange={setSelectedQueryId}\n className={cn(\n 'flex h-full flex-col',\n // this is for Monaco's completion menu to not being cut off\n 'overflow-visible',\n className,\n )}\n >\n <div className=\"border-border flex items-center border-b p-1\">\n <QueryEditorPanelActions />\n <QueryEditorPanelTabsList />\n </div>\n {queries.map((q) => (\n <TabsContent\n key={q.id}\n value={q.id}\n className=\"relative h-full flex-grow flex-col data-[state=active]:flex\"\n >\n <div className=\"absolute inset-0 h-full w-full flex-grow\">\n {q.id === selectedQueryId && (\n <QueryEditorPanelEditor queryId={q.id} />\n )}\n </div>\n </TabsContent>\n ))}\n </Tabs>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEditorPanelEditor.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditorPanelEditor.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,
|
|
1
|
+
{"version":3,"file":"QueryEditorPanelEditor.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditorPanelEditor.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CA+DA,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from '@sqlrooms/ui';
|
|
3
|
+
import { useCallback, useRef } from 'react';
|
|
3
4
|
import { useStoreWithSqlEditor } from '../SqlEditorSlice';
|
|
4
5
|
import { SqlMonacoEditor } from '../SqlMonacoEditor';
|
|
5
|
-
import { cn } from '@sqlrooms/ui';
|
|
6
6
|
export const QueryEditorPanelEditor = ({ className, queryId }) => {
|
|
7
7
|
const tableSchemas = useStoreWithSqlEditor((s) => s.db.tables);
|
|
8
8
|
const runQuery = useStoreWithSqlEditor((s) => s.sqlEditor.parseAndRunQuery);
|
|
9
|
+
const connector = useStoreWithSqlEditor((s) => s.db.connector);
|
|
9
10
|
const queryText = useStoreWithSqlEditor((s) => s.config.sqlEditor.queries.find((q) => q.id === queryId)?.query);
|
|
10
11
|
const updateQueryText = useStoreWithSqlEditor((s) => s.sqlEditor.updateQueryText);
|
|
11
12
|
// Editor instance ref for keyboard shortcuts
|
|
@@ -31,7 +32,7 @@ export const QueryEditorPanelEditor = ({ className, queryId }) => {
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
}, [runQuery]);
|
|
34
|
-
return (_jsx(SqlMonacoEditor, { value: queryText ?? '', onChange: handleUpdateQuery, className: cn('h-full w-full flex-grow', className), options: {
|
|
35
|
+
return (_jsx(SqlMonacoEditor, { connector: connector, value: queryText ?? '', onChange: handleUpdateQuery, className: cn('h-full w-full flex-grow', className), options: {
|
|
35
36
|
scrollBeyondLastLine: false,
|
|
36
37
|
automaticLayout: true,
|
|
37
38
|
minimap: { enabled: false },
|
|
@@ -40,6 +41,6 @@ export const QueryEditorPanelEditor = ({ className, queryId }) => {
|
|
|
40
41
|
suggestOnTriggerCharacters: true,
|
|
41
42
|
}, onMount: (editor, monaco) => {
|
|
42
43
|
handleEditorMount(editor, monaco, queryId);
|
|
43
|
-
}, tableSchemas: tableSchemas
|
|
44
|
+
}, tableSchemas: tableSchemas }));
|
|
44
45
|
};
|
|
45
46
|
//# sourceMappingURL=QueryEditorPanelEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEditorPanelEditor.js","sourceRoot":"","sources":["../../src/components/QueryEditorPanelEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"QueryEditorPanelEditor.js","sourceRoot":"","sources":["../../src/components/QueryEditorPanelEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAEhC,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAKnD,MAAM,CAAC,MAAM,sBAAsB,GAG9B,CAAC,EAAC,SAAS,EAAE,OAAO,EAAC,EAAE,EAAE;IAC5B,MAAM,YAAY,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5E,MAAM,SAAS,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAE/D,MAAM,SAAS,GAAG,qBAAqB,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAA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CACX,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,IACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,EACnD,OAAO,EAAE;YACP,oBAAoB,EAAE,KAAK;YAC3B,eAAe,EAAE,IAAI;YACrB,OAAO,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC;YACzB,QAAQ,EAAE,IAAI;YACd,gBAAgB,EAAE,IAAI;YACtB,0BAA0B,EAAE,IAAI;SACjC,EACD,OAAO,EAAE,CAAC,MAAsB,EAAE,MAAsB,EAAE,EAAE;YAC1D,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC,EACD,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {cn} from '@sqlrooms/ui';\nimport type * as Monaco from 'monaco-editor';\nimport {useCallback, useRef} from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\nimport {SqlMonacoEditor} from '../SqlMonacoEditor';\n\ntype EditorInstance = Monaco.editor.IStandaloneCodeEditor;\ntype MonacoInstance = typeof Monaco;\n\nexport const QueryEditorPanelEditor: React.FC<{\n className?: string;\n queryId: string;\n}> = ({className, queryId}) => {\n const tableSchemas = useStoreWithSqlEditor((s) => s.db.tables);\n const runQuery = useStoreWithSqlEditor((s) => s.sqlEditor.parseAndRunQuery);\n const connector = useStoreWithSqlEditor((s) => s.db.connector);\n\n const queryText = useStoreWithSqlEditor(\n (s) => s.config.sqlEditor.queries.find((q) => q.id === queryId)?.query,\n );\n const updateQueryText = useStoreWithSqlEditor(\n (s) => s.sqlEditor.updateQueryText,\n );\n // Editor instance ref for keyboard shortcuts\n const editorRef = useRef<{\n [key: string]: EditorInstance;\n }>({});\n\n // Handle query text update\n const handleUpdateQuery = useCallback(\n (value: string | undefined) => {\n if (!value) return;\n updateQueryText(queryId, value);\n },\n [queryId, updateQueryText],\n );\n\n // Handle editor mount\n const handleEditorMount = useCallback(\n (editor: EditorInstance, monaco: MonacoInstance, queryId: string) => {\n editorRef.current[queryId] = editor;\n // Add keyboard shortcut for running query\n editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter, () => {\n const model = editor.getModel();\n const selection = editor.getSelection();\n if (model && selection && !selection.isEmpty()) {\n runQuery(model.getValueInRange(selection));\n } else {\n runQuery(editor.getValue());\n }\n });\n },\n [runQuery],\n );\n\n return (\n <SqlMonacoEditor\n connector={connector}\n value={queryText ?? ''}\n onChange={handleUpdateQuery}\n className={cn('h-full w-full flex-grow', className)}\n options={{\n scrollBeyondLastLine: false,\n automaticLayout: true,\n minimap: {enabled: false},\n wordWrap: 'on',\n quickSuggestions: true,\n suggestOnTriggerCharacters: true,\n }}\n onMount={(editor: EditorInstance, monaco: MonacoInstance) => {\n handleEditorMount(editor, monaco, queryId);\n }}\n tableSchemas={tableSchemas}\n />\n );\n};\n"]}
|
|
@@ -1,73 +1,11 @@
|
|
|
1
|
+
import type * as Monaco from 'monaco-editor';
|
|
1
2
|
/**
|
|
2
3
|
* DuckDB SQL language constants for Monaco Editor
|
|
3
4
|
*/
|
|
4
5
|
export declare const DUCKDB_KEYWORDS: string[];
|
|
5
|
-
export declare const DUCKDB_FUNCTIONS:
|
|
6
|
+
export declare const DUCKDB_FUNCTIONS: never[];
|
|
6
7
|
export declare const SQL_OPERATORS: string[];
|
|
7
8
|
export declare const SQL_VARIABLES: string[];
|
|
8
9
|
export declare const SQL_PSEUDO_COLUMNS: string[];
|
|
9
|
-
export declare const SQL_LANGUAGE_CONFIGURATION:
|
|
10
|
-
defaultToken: string;
|
|
11
|
-
tokenPostfix: string;
|
|
12
|
-
ignoreCase: boolean;
|
|
13
|
-
brackets: {
|
|
14
|
-
open: string;
|
|
15
|
-
close: string;
|
|
16
|
-
token: string;
|
|
17
|
-
}[];
|
|
18
|
-
keywords: string[];
|
|
19
|
-
operators: string[];
|
|
20
|
-
builtinFunctions: string[];
|
|
21
|
-
builtinVariables: string[];
|
|
22
|
-
pseudoColumns: string[];
|
|
23
|
-
tokenizer: {
|
|
24
|
-
root: ((string | RegExp)[] | {
|
|
25
|
-
include: string;
|
|
26
|
-
} | (RegExp | {
|
|
27
|
-
cases: {
|
|
28
|
-
'@keywords': string;
|
|
29
|
-
'@operators': string;
|
|
30
|
-
'@builtinFunctions': string;
|
|
31
|
-
'@builtinVariables': string;
|
|
32
|
-
'@pseudoColumns': string;
|
|
33
|
-
'@default': string;
|
|
34
|
-
};
|
|
35
|
-
})[])[];
|
|
36
|
-
whitespace: (string | RegExp)[][];
|
|
37
|
-
comments: ((string | RegExp)[] | (RegExp | {
|
|
38
|
-
token: string;
|
|
39
|
-
next: string;
|
|
40
|
-
})[])[];
|
|
41
|
-
comment: ((string | RegExp)[] | (RegExp | {
|
|
42
|
-
token: string;
|
|
43
|
-
next: string;
|
|
44
|
-
})[])[];
|
|
45
|
-
numbers: (string | RegExp)[][];
|
|
46
|
-
strings: (RegExp | {
|
|
47
|
-
token: string;
|
|
48
|
-
next: string;
|
|
49
|
-
})[][];
|
|
50
|
-
string: ((string | RegExp)[] | (RegExp | {
|
|
51
|
-
token: string;
|
|
52
|
-
next: string;
|
|
53
|
-
})[])[];
|
|
54
|
-
stringDouble: ((string | RegExp)[] | (RegExp | {
|
|
55
|
-
token: string;
|
|
56
|
-
next: string;
|
|
57
|
-
})[])[];
|
|
58
|
-
complexIdentifiers: (RegExp | {
|
|
59
|
-
token: string;
|
|
60
|
-
next: string;
|
|
61
|
-
})[][];
|
|
62
|
-
bracketedIdentifier: ((string | RegExp)[] | (RegExp | {
|
|
63
|
-
token: string;
|
|
64
|
-
next: string;
|
|
65
|
-
})[])[];
|
|
66
|
-
quotedIdentifier: ((string | RegExp)[] | (RegExp | {
|
|
67
|
-
token: string;
|
|
68
|
-
next: string;
|
|
69
|
-
})[])[];
|
|
70
|
-
scopes: never[];
|
|
71
|
-
};
|
|
72
|
-
};
|
|
10
|
+
export declare const SQL_LANGUAGE_CONFIGURATION: Monaco.languages.IMonarchLanguage;
|
|
73
11
|
//# sourceMappingURL=duckdb-dialect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duckdb-dialect.d.ts","sourceRoot":"","sources":["../../src/constants/duckdb-dialect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"duckdb-dialect.d.ts","sourceRoot":"","sources":["../../src/constants/duckdb-dialect.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAG7C;;GAEG;AAGH,eAAO,MAAM,eAAe,UAse3B,CAAC;AAGF,eAAO,MAAM,gBAAgB,SAE5B,CAAC;AAGF,eAAO,MAAM,aAAa,UAyBzB,CAAC;AAGF,eAAO,MAAM,aAAa,UAUzB,CAAC;AAGF,eAAO,MAAM,kBAAkB,UAK9B,CAAC;AAGF,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,SAAS,CAAC,gBAsFJ,CAAC"}
|