@bytebase/dbhub 1.2.1 → 1.2.2
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.
|
@@ -1496,6 +1496,20 @@ function validateSourceConfig(source, configPath) {
|
|
|
1496
1496
|
);
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
|
+
function resolveSqliteDatabasePath(database, configPath) {
|
|
1500
|
+
if (database === ":memory:") {
|
|
1501
|
+
return database;
|
|
1502
|
+
}
|
|
1503
|
+
const expanded = expandHomeDir(database);
|
|
1504
|
+
const absolute = path2.isAbsolute(expanded) ? expanded : path2.resolve(path2.dirname(configPath), expanded);
|
|
1505
|
+
return absolute.replace(/\\/g, "/");
|
|
1506
|
+
}
|
|
1507
|
+
function buildSqliteDSN(database) {
|
|
1508
|
+
if (database === ":memory:") {
|
|
1509
|
+
return "sqlite:///:memory:";
|
|
1510
|
+
}
|
|
1511
|
+
return `sqlite://${database.startsWith("/") ? database : `/${database}`}`;
|
|
1512
|
+
}
|
|
1499
1513
|
function processSourceConfigs(sources, configPath) {
|
|
1500
1514
|
return sources.map((source) => {
|
|
1501
1515
|
const processed = { ...source };
|
|
@@ -1506,7 +1520,7 @@ function processSourceConfigs(sources, configPath) {
|
|
|
1506
1520
|
processed.sslrootcert = expandHomeDir(processed.sslrootcert);
|
|
1507
1521
|
}
|
|
1508
1522
|
if (processed.type === "sqlite" && processed.database) {
|
|
1509
|
-
processed.database =
|
|
1523
|
+
processed.database = resolveSqliteDatabasePath(processed.database, configPath);
|
|
1510
1524
|
}
|
|
1511
1525
|
if (processed.dsn && processed.dsn.startsWith("sqlite:///~")) {
|
|
1512
1526
|
processed.dsn = `sqlite:///${expandHomeDir(processed.dsn.substring(11))}`;
|
|
@@ -1629,7 +1643,7 @@ function buildDSNFromSource(source) {
|
|
|
1629
1643
|
`Source '${source.id}': 'database' field is required for SQLite`
|
|
1630
1644
|
);
|
|
1631
1645
|
}
|
|
1632
|
-
return
|
|
1646
|
+
return buildSqliteDSN(source.database);
|
|
1633
1647
|
}
|
|
1634
1648
|
const isAwsIamPasswordless = source.aws_iam_auth === true && ["postgres", "mysql", "mariadb"].includes(source.type);
|
|
1635
1649
|
const passwordRequired = source.authentication !== "azure-active-directory-access-token" && !isAwsIamPasswordless;
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resolveSourceConfigs,
|
|
19
19
|
resolveTomlConfigPath,
|
|
20
20
|
resolveTransport
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-F5TPYAVO.js";
|
|
22
22
|
import {
|
|
23
23
|
allowedKeywords,
|
|
24
24
|
getFirstKeyword,
|
|
@@ -1913,7 +1913,7 @@ See documentation for more details on configuring database connections.
|
|
|
1913
1913
|
const sources = sourceConfigsData.sources;
|
|
1914
1914
|
console.error(`Configuration source: ${sourceConfigsData.source}`);
|
|
1915
1915
|
await connectorManager.connectWithSources(sources);
|
|
1916
|
-
const { initializeToolRegistry: initializeToolRegistry2 } = await import("./registry-
|
|
1916
|
+
const { initializeToolRegistry: initializeToolRegistry2 } = await import("./registry-6ABK3M6V.js");
|
|
1917
1917
|
initializeToolRegistry2({
|
|
1918
1918
|
sources: sourceConfigsData.sources,
|
|
1919
1919
|
tools: sourceConfigsData.tools
|