Skip to content

Commit f564bb3

Browse files
committed
feat: add experimental extension for CereusDB
1 parent 4f091ca commit f564bb3

9 files changed

Lines changed: 221 additions & 50 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ appLoaderService.registerApp(
4242
'@eclipse-docks/extension-command-palette',
4343
'@eclipse-docks/extension-command-shell',
4444
'@eclipse-docks/extension-catalog',
45-
'@eclipse-docks/extension-cereusdb',
4645
'@eclipse-docks/extension-md-editor',
4746
'@eclipse-docks/extension-plain-editor',
4847
'@eclipse-docks/extension-media-viewer',

packages/extension-cereusdb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eclipse-docks/extension-cereusdb",
3-
"version": "0.0.0",
3+
"version": "0.7.88",
44
"type": "module",
55
"main": "./dist/index.js",
66
"module": "./dist/index.js",

packages/extension-cereusdb/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extensionRegistry.registerExtension({
55
id: pkg.name,
66
name: 'CereusDB',
77
description:
8-
'Spatial SQL in the browser (SedonaDB / Apache DataFusion) — CereusDB minimal WASM build',
8+
'Spatial SQL in the browser (SedonaDB / Apache DataFusion)',
99
loader: () => import('./cereusdb-extension'),
1010
icon: 'database',
1111
dependencies: ['@eclipse-docks/extension-sqleditor'],

packages/extension-duckdb/src/duckdb-sqldatabase.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ class DuckdbSqlDatabase implements SqlDatabase {
137137
this.enabledExtensions.add(id);
138138
}
139139

140+
async readVersion(): Promise<string> {
141+
try {
142+
if (!this.current) return '';
143+
const result = await this.current.runQuery('SELECT version()');
144+
return String((result.rows[0]?.[0] as string) ?? '');
145+
} catch {
146+
return '';
147+
}
148+
}
149+
140150
async close(): Promise<void> {
141151
if (!this.current) return;
142152
await this.current.close();

packages/extension-pglite/src/pglite-sqldatabase.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ class PgliteSqlDatabase implements SqlDatabase {
8080
this.currentId = id;
8181
}
8282

83+
async readVersion(): Promise<string> {
84+
try {
85+
if (!this.db) return '';
86+
const result = await this.runQuery('SELECT version()');
87+
const full = (result.rows[0]?.[0] as string) ?? '';
88+
const short = full.match(/^PostgreSQL \d+\.\d+/)?.[0];
89+
return short ?? full;
90+
} catch {
91+
return '';
92+
}
93+
}
94+
8395
async runQuery(sql: string): Promise<{ columns: string[]; rows: unknown[][] }> {
8496
if (!this.db) {
8597
await this.selectConnection(null);

packages/extension-sqleditor/src/sql-api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ export interface SqlDatabase {
5050
selectConnection(id: string | null): Promise<void>;
5151
runQuery(sql: string): Promise<{ columns: string[]; rows: unknown[][] }>;
5252

53+
/** Optional engine/database version string for toolbar display after a connection is active. */
54+
readVersion?(): Promise<string>;
55+
5356
createConnection?(): Promise<SqlConnectionInfo | null>;
5457
deleteConnection?(id: string): Promise<void>;
5558

0 commit comments

Comments
 (0)