@flowblade/sqlduck 0.19.1 → 0.21.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 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
@@ -465,6 +465,36 @@ var DuckDatabaseManager = class {
465
465
  attachIfNotExists = async (dbParams) => {
466
466
  return this.attach(dbParams, { behaviour: "IF NOT EXISTS" });
467
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
+ */
468
498
  showDatabases = async () => {
469
499
  return await this.#executor.getRowObjectsJS("showDatabases()", `SHOW DATABASES`);
470
500
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowblade/sqlduck",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@flowblade/core": "^0.2.29",
60
- "@flowblade/source-duckdb": "^0.21.0",
60
+ "@flowblade/source-duckdb": "^0.22.0",
61
61
  "@flowblade/sql-tag": "^0.3.4",
62
62
  "@httpx/assert": "^0.17.1",
63
63
  "@httpx/dsn-parser": "^1.9.11",
@@ -69,7 +69,7 @@
69
69
  "zod": "^4.4.3"
70
70
  },
71
71
  "peerDependencies": {
72
- "@duckdb/node-api": "^1.5.3-r.1",
72
+ "@duckdb/node-api": "^1.5.3-r.2",
73
73
  "valibot": "^1.3.1"
74
74
  },
75
75
  "peerDependenciesMeta": {
@@ -79,20 +79,20 @@
79
79
  },
80
80
  "devDependencies": {
81
81
  "@belgattitude/eslint-config-bases": "8.15.0",
82
- "@dotenvx/dotenvx": "1.66.0",
83
- "@duckdb/node-api": "1.5.3-r.1",
82
+ "@dotenvx/dotenvx": "1.67.0",
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",
86
86
  "@httpx/assert": "0.17.1",
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": "11.14.0",
90
+ "@testcontainers/mssqlserver": "12.0.0",
91
91
  "@total-typescript/ts-reset": "0.6.1",
92
- "@types/node": "25.9.0",
93
- "@typescript-eslint/eslint-plugin": "8.59.4",
94
- "@typescript-eslint/parser": "8.59.4",
95
- "@typescript/native-preview": "7.0.0-dev.20260519.1",
92
+ "@types/node": "25.9.1",
93
+ "@typescript-eslint/eslint-plugin": "8.60.0",
94
+ "@typescript-eslint/parser": "8.60.0",
95
+ "@typescript/native-preview": "7.0.0-dev.20260524.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.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": "11.14.0",
119
+ "testcontainers": "12.0.0",
120
120
  "tsdown": "0.22.0",
121
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.0",
125
+ "valibot": "1.4.1",
126
126
  "vitest": "4.1.7"
127
127
  },
128
128
  "files": [