@flowblade/sqlduck 0.19.0 → 0.20.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 +22 -0
- package/dist/index.mjs +33 -0
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -297,6 +297,28 @@ declare class DuckDatabaseManager {
|
|
|
297
297
|
attach: (dbParams: DuckConnectionParams, options?: DuckDatabaseAttachCommandOptions) => Promise<Database>;
|
|
298
298
|
attachOrReplace: (dbParams: DuckConnectionParams) => Promise<Database>;
|
|
299
299
|
attachIfNotExists: (dbParams: DuckConnectionParams) => Promise<Database>;
|
|
300
|
+
/**
|
|
301
|
+
* Check whether a specific database name / alias is currently attached
|
|
302
|
+
*/
|
|
303
|
+
isAttached: (dbAlias: string) => Promise<boolean>;
|
|
304
|
+
/**
|
|
305
|
+
* Return information about attached databases
|
|
306
|
+
*/
|
|
307
|
+
getDatabases: (params?: {
|
|
308
|
+
includeInternal?: boolean;
|
|
309
|
+
}) => Promise<{
|
|
310
|
+
database_name: string;
|
|
311
|
+
database_oid: string;
|
|
312
|
+
path: string | null;
|
|
313
|
+
comment: string | null;
|
|
314
|
+
type: string;
|
|
315
|
+
readonly: boolean;
|
|
316
|
+
internal: boolean;
|
|
317
|
+
encrypted: boolean;
|
|
318
|
+
}[]>;
|
|
319
|
+
/**
|
|
320
|
+
* Get the currently attached database names
|
|
321
|
+
*/
|
|
300
322
|
showDatabases: () => Promise<Record<string, unknown>[]>;
|
|
301
323
|
detach: (dbAlias: string) => Promise<boolean>;
|
|
302
324
|
detachIfExists: (dbAlias: string) => Promise<boolean>;
|
package/dist/index.mjs
CHANGED
|
@@ -411,6 +411,9 @@ var DuckDatabaseAttachCommand = class {
|
|
|
411
411
|
case "encryptionKey":
|
|
412
412
|
options.push(`ENCRYPTION_KEY '${value}'`);
|
|
413
413
|
break;
|
|
414
|
+
case "recoveryMode":
|
|
415
|
+
options.push(`RECOVERY_MODE '${value}'`);
|
|
416
|
+
break;
|
|
414
417
|
default:
|
|
415
418
|
}
|
|
416
419
|
if (options.length > 0) parts.push(`(${options.join(", ")})`);
|
|
@@ -462,6 +465,36 @@ var DuckDatabaseManager = class {
|
|
|
462
465
|
attachIfNotExists = async (dbParams) => {
|
|
463
466
|
return this.attach(dbParams, { behaviour: "IF NOT EXISTS" });
|
|
464
467
|
};
|
|
468
|
+
/**
|
|
469
|
+
* Check whether a specific database name / alias is currently attached
|
|
470
|
+
*/
|
|
471
|
+
isAttached = async (dbAlias) => {
|
|
472
|
+
assertValidAliasName(dbAlias);
|
|
473
|
+
return (await this.#executor.getRowObjectsJS(`isAttached(${dbAlias})`, `SELECT EXISTS (SELECT 1
|
|
474
|
+
FROM duckdb_databases()
|
|
475
|
+
WHERE database_name = '${dbAlias}'
|
|
476
|
+
) AS is_attached;`))[0]?.is_attached ?? false;
|
|
477
|
+
};
|
|
478
|
+
/**
|
|
479
|
+
* Return information about attached databases
|
|
480
|
+
*/
|
|
481
|
+
getDatabases = async (params) => {
|
|
482
|
+
const { includeInternal = false } = params ?? {};
|
|
483
|
+
const internalFilter = includeInternal ? "1=1" : "internal = false";
|
|
484
|
+
return this.#executor.getRowObjectsJS("listDatabases", `select database_name,
|
|
485
|
+
database_oid,
|
|
486
|
+
path,
|
|
487
|
+
comment,
|
|
488
|
+
type,
|
|
489
|
+
readonly,
|
|
490
|
+
internal,
|
|
491
|
+
encrypted
|
|
492
|
+
from duckdb_databases()
|
|
493
|
+
where ${internalFilter}`);
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Get the currently attached database names
|
|
497
|
+
*/
|
|
465
498
|
showDatabases = async () => {
|
|
466
499
|
return await this.#executor.getRowObjectsJS("showDatabases()", `SHOW DATABASES`);
|
|
467
500
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowblade/sqlduck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.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.67.0",
|
|
83
83
|
"@duckdb/node-api": "1.5.3-r.1",
|
|
84
84
|
"@faker-js/faker": "10.4.0",
|
|
85
85
|
"@flowblade/source-kysely": "^1.4.1",
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
"@mitata/counters": "0.0.8",
|
|
88
88
|
"@size-limit/esbuild": "12.1.0",
|
|
89
89
|
"@size-limit/file": "12.1.0",
|
|
90
|
-
"@testcontainers/mssqlserver": "
|
|
90
|
+
"@testcontainers/mssqlserver": "12.0.0",
|
|
91
91
|
"@total-typescript/ts-reset": "0.6.1",
|
|
92
|
-
"@types/node": "25.9.
|
|
92
|
+
"@types/node": "25.9.1",
|
|
93
93
|
"@typescript-eslint/eslint-plugin": "8.59.4",
|
|
94
94
|
"@typescript-eslint/parser": "8.59.4",
|
|
95
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
95
|
+
"@typescript/native-preview": "7.0.0-dev.20260523.1",
|
|
96
96
|
"@vitest/coverage-v8": "4.1.7",
|
|
97
97
|
"@vitest/ui": "4.1.7",
|
|
98
98
|
"ansis": "4.3.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"is-in-ci": "2.0.0",
|
|
108
108
|
"kysely": "0.29.2",
|
|
109
109
|
"mitata": "1.0.34",
|
|
110
|
-
"npm-run-all2": "9.0.
|
|
110
|
+
"npm-run-all2": "9.0.1",
|
|
111
111
|
"prettier": "3.8.3",
|
|
112
112
|
"publint": "0.3.21",
|
|
113
113
|
"regexp.escape": "2.0.1",
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
"sql-formatter": "15.8.0",
|
|
117
117
|
"tarn": "3.0.2",
|
|
118
118
|
"tedious": "19.2.1",
|
|
119
|
-
"testcontainers": "
|
|
119
|
+
"testcontainers": "12.0.0",
|
|
120
120
|
"tsdown": "0.22.0",
|
|
121
|
-
"tsx": "4.22.
|
|
121
|
+
"tsx": "4.22.3",
|
|
122
122
|
"typedoc": "0.28.19",
|
|
123
123
|
"typedoc-plugin-markdown": "4.11.0",
|
|
124
124
|
"typescript": "6.0.3",
|
|
125
|
-
"valibot": "1.4.
|
|
125
|
+
"valibot": "1.4.1",
|
|
126
126
|
"vitest": "4.1.7"
|
|
127
127
|
},
|
|
128
128
|
"files": [
|