@flowblade/sqlduck 0.21.0 → 0.22.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/index.d.mts +7 -1
- package/dist/index.mjs +12 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -320,8 +320,14 @@ declare class DuckDatabaseManager {
|
|
|
320
320
|
* Get the currently attached database names
|
|
321
321
|
*/
|
|
322
322
|
showDatabases: () => Promise<Record<string, unknown>[]>;
|
|
323
|
+
/**
|
|
324
|
+
* @throws Error if the database isn't attached
|
|
325
|
+
*/
|
|
323
326
|
detach: (dbAlias: string) => Promise<boolean>;
|
|
324
|
-
|
|
327
|
+
/**
|
|
328
|
+
* @todo DETACH IF EXISTS is not supported in DuckDB as of v1.5.3
|
|
329
|
+
*/
|
|
330
|
+
detachOrIgnore: (dbAlias: string) => Promise<boolean>;
|
|
325
331
|
/**
|
|
326
332
|
* The statistics recomputed by the ANALYZE statement are only used for join order optimization.
|
|
327
333
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -498,14 +498,24 @@ var DuckDatabaseManager = class {
|
|
|
498
498
|
showDatabases = async () => {
|
|
499
499
|
return await this.#executor.getRowObjectsJS("showDatabases()", `SHOW DATABASES`);
|
|
500
500
|
};
|
|
501
|
+
/**
|
|
502
|
+
* @throws Error if the database isn't attached
|
|
503
|
+
*/
|
|
501
504
|
detach = async (dbAlias) => {
|
|
502
505
|
assertValidAliasName(dbAlias);
|
|
503
506
|
await this.#executor.getRowObjectsJS(`detach(${dbAlias})`, `DETACH ${dbAlias}`);
|
|
504
507
|
return true;
|
|
505
508
|
};
|
|
506
|
-
|
|
509
|
+
/**
|
|
510
|
+
* @todo DETACH IF EXISTS is not supported in DuckDB as of v1.5.3
|
|
511
|
+
*/
|
|
512
|
+
detachOrIgnore = async (dbAlias) => {
|
|
507
513
|
assertValidAliasName(dbAlias);
|
|
508
|
-
|
|
514
|
+
try {
|
|
515
|
+
await this.detach(dbAlias);
|
|
516
|
+
} catch {
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
509
519
|
return true;
|
|
510
520
|
};
|
|
511
521
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowblade/sqlduck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@belgattitude/eslint-config-bases": "8.15.0",
|
|
82
|
-
"@dotenvx/dotenvx": "1.
|
|
82
|
+
"@dotenvx/dotenvx": "1.68.0",
|
|
83
83
|
"@duckdb/node-api": "1.5.3-r.2",
|
|
84
84
|
"@faker-js/faker": "10.4.0",
|
|
85
85
|
"@flowblade/source-kysely": "^1.4.1",
|