+
+ {
+ if (!sql) {
+ return
+ }
+ await process(sql)
+ }}
+ />
+
+
+
+
+
+
+ {httpRequest}
+
+
+
+
+ {curlRequest}
+
+
+
+
+ {jsCode}
+
+
+
+ {errorMessage &&
{errorMessage}
}
+
+
+ )
+}
+
+// TODO: this was copied from studio - find a way to share it between sites
+export const getTheme = (theme: string): editor.IStandaloneThemeData => {
+ const isDarkMode = theme.includes('dark')
+ // [TODO] Probably need better theming for light mode
+ return {
+ base: isDarkMode ? 'vs-dark' : 'vs', // can also be vs-dark or hc-black
+ inherit: true, // can also be false to completely replace the builtin rules
+ rules: [
+ {
+ token: '',
+ background: isDarkMode ? '1f1f1f' : 'f0f0f0',
+ foreground: isDarkMode ? 'd4d4d4' : '444444',
+ },
+ { token: 'string.sql', foreground: '24b47e' },
+ { token: 'comment', foreground: '666666' },
+ { token: 'predefined.sql', foreground: isDarkMode ? 'D4D4D4' : '444444' },
+ ],
+ colors: { 'editor.background': isDarkMode ? '#1f1f1f' : '#f0f0f0' },
+ }
+}
diff --git a/packages/ui-patterns/index.tsx b/packages/ui-patterns/index.tsx
index b87f8d0b5a4..4de370e84c1 100644
--- a/packages/ui-patterns/index.tsx
+++ b/packages/ui-patterns/index.tsx
@@ -18,3 +18,4 @@ export * from './Dialogs/ConfirmDialog'
export * from './Dialogs/ConfirmationModal'
export * from './AssistantChat/AssistantChatForm'
export * from './AssistantChat/AssistantCommandsPopover'
+export * from './SqlToRest'
diff --git a/packages/ui-patterns/package.json b/packages/ui-patterns/package.json
index 8992bac23c4..b806a785f1e 100644
--- a/packages/ui-patterns/package.json
+++ b/packages/ui-patterns/package.json
@@ -8,15 +8,18 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
+ "@monaco-editor/react": "^4.6.0",
"cmdk": "^0.2.1",
"common": "*",
"lodash": "*",
"lucide-react": "*",
+ "monaco-editor": "*",
"next-themes": "*",
"react-error-boundary": "^4.0.12",
"react-hot-toast": "*",
"react-tooltip": "*",
"reactflow": "*",
+ "sql-to-rest": "*",
"tsconfig": "*",
"ui": "*"
},
@@ -28,4 +31,4 @@
"react": "*",
"react-dom": "*"
}
-}
+}
\ No newline at end of file