defuss-db 1.0.1 → 1.1.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/README.md CHANGED
@@ -147,6 +147,6 @@ All commands are run from the root of the project, from a terminal:
147
147
 
148
148
  ---
149
149
 
150
- <img src="assets/defuss_comic.png" />
150
+ <img src="https://raw.githubusercontent.com/kyr0/defuss/refs/heads/main/assets/defuss_comic.png" />
151
151
 
152
152
  <caption><i><b>Come visit us on defuss island!</b></i></caption>
package/dist/client.cjs CHANGED
@@ -37,6 +37,13 @@ class DexieProvider {
37
37
  this.isOpen = false;
38
38
  }
39
39
  }
40
+ /**
41
+ * Checks if the provider is currently connected to the database.
42
+ * @returns True if connected, false otherwise.
43
+ */
44
+ isConnected() {
45
+ return this.isOpen;
46
+ }
40
47
  /**
41
48
  * Creates a table if it doesn't exist with dynamic schema support.
42
49
  * @param table - The name of the table.
package/dist/client.d.cts CHANGED
@@ -23,6 +23,11 @@ declare class DexieProvider implements DefussProvider<DexieOptions> {
23
23
  * Disconnects from IndexedDB.
24
24
  */
25
25
  disconnect(): Promise<void>;
26
+ /**
27
+ * Checks if the provider is currently connected to the database.
28
+ * @returns True if connected, false otherwise.
29
+ */
30
+ isConnected(): boolean;
26
31
  /**
27
32
  * Creates a table if it doesn't exist with dynamic schema support.
28
33
  * @param table - The name of the table.
package/dist/client.d.mts CHANGED
@@ -23,6 +23,11 @@ declare class DexieProvider implements DefussProvider<DexieOptions> {
23
23
  * Disconnects from IndexedDB.
24
24
  */
25
25
  disconnect(): Promise<void>;
26
+ /**
27
+ * Checks if the provider is currently connected to the database.
28
+ * @returns True if connected, false otherwise.
29
+ */
30
+ isConnected(): boolean;
26
31
  /**
27
32
  * Creates a table if it doesn't exist with dynamic schema support.
28
33
  * @param table - The name of the table.
package/dist/client.d.ts CHANGED
@@ -23,6 +23,11 @@ declare class DexieProvider implements DefussProvider<DexieOptions> {
23
23
  * Disconnects from IndexedDB.
24
24
  */
25
25
  disconnect(): Promise<void>;
26
+ /**
27
+ * Checks if the provider is currently connected to the database.
28
+ * @returns True if connected, false otherwise.
29
+ */
30
+ isConnected(): boolean;
26
31
  /**
27
32
  * Creates a table if it doesn't exist with dynamic schema support.
28
33
  * @param table - The name of the table.
package/dist/client.mjs CHANGED
@@ -35,6 +35,13 @@ class DexieProvider {
35
35
  this.isOpen = false;
36
36
  }
37
37
  }
38
+ /**
39
+ * Checks if the provider is currently connected to the database.
40
+ * @returns True if connected, false otherwise.
41
+ */
42
+ isConnected() {
43
+ return this.isOpen;
44
+ }
38
45
  /**
39
46
  * Creates a table if it doesn't exist with dynamic schema support.
40
47
  * @param table - The name of the table.
package/dist/index.d.cts CHANGED
@@ -17,6 +17,11 @@ interface DefussProvider<O> {
17
17
  * Disconnects from the database.
18
18
  */
19
19
  disconnect(): void;
20
+ /**
21
+ * Checks if the provider is currently connected to the database.
22
+ * @returns True if connected, false otherwise.
23
+ */
24
+ isConnected(): boolean;
20
25
  /**
21
26
  * Creates a table if it doesn't exist.
22
27
  * @param table - The name of the table.
package/dist/index.d.mts CHANGED
@@ -17,6 +17,11 @@ interface DefussProvider<O> {
17
17
  * Disconnects from the database.
18
18
  */
19
19
  disconnect(): void;
20
+ /**
21
+ * Checks if the provider is currently connected to the database.
22
+ * @returns True if connected, false otherwise.
23
+ */
24
+ isConnected(): boolean;
20
25
  /**
21
26
  * Creates a table if it doesn't exist.
22
27
  * @param table - The name of the table.
package/dist/index.d.ts CHANGED
@@ -17,6 +17,11 @@ interface DefussProvider<O> {
17
17
  * Disconnects from the database.
18
18
  */
19
19
  disconnect(): void;
20
+ /**
21
+ * Checks if the provider is currently connected to the database.
22
+ * @returns True if connected, false otherwise.
23
+ */
24
+ isConnected(): boolean;
20
25
  /**
21
26
  * Creates a table if it doesn't exist.
22
27
  * @param table - The name of the table.
package/dist/server.cjs CHANGED
@@ -19,6 +19,13 @@ class LibsqlProvider {
19
19
  async disconnect() {
20
20
  this.db.close();
21
21
  }
22
+ /**
23
+ * Checks if the provider is currently connected to the database.
24
+ * @returns True if connected, false otherwise.
25
+ */
26
+ isConnected() {
27
+ return this.db?.closed !== true;
28
+ }
22
29
  /**
23
30
  * Creates a table if it doesn't exist.
24
31
  * Sets up the primary key and any initial structure needed.
@@ -467,6 +474,13 @@ class MongoProvider {
467
474
  }
468
475
  }
469
476
  }
477
+ /**
478
+ * Checks if the provider is currently connected to the database.
479
+ * @returns True if connected, false otherwise.
480
+ */
481
+ isConnected() {
482
+ return !!this.client && !!this.db;
483
+ }
470
484
  /**
471
485
  * Creates a collection if it doesn't exist.
472
486
  */
package/dist/server.d.cts CHANGED
@@ -18,6 +18,11 @@ declare class LibsqlProvider implements DefussProvider<Config> {
18
18
  * Disconnects from the SQLite database.
19
19
  */
20
20
  disconnect(): Promise<void>;
21
+ /**
22
+ * Checks if the provider is currently connected to the database.
23
+ * @returns True if connected, false otherwise.
24
+ */
25
+ isConnected(): boolean;
21
26
  /**
22
27
  * Creates a table if it doesn't exist.
23
28
  * Sets up the primary key and any initial structure needed.
@@ -169,6 +174,11 @@ declare class MongoProvider implements DefussProvider<MongoProviderOptions> {
169
174
  * Disconnects from MongoDB.
170
175
  */
171
176
  disconnect(): Promise<void>;
177
+ /**
178
+ * Checks if the provider is currently connected to the database.
179
+ * @returns True if connected, false otherwise.
180
+ */
181
+ isConnected(): boolean;
172
182
  /**
173
183
  * Creates a collection if it doesn't exist.
174
184
  */
package/dist/server.d.mts CHANGED
@@ -18,6 +18,11 @@ declare class LibsqlProvider implements DefussProvider<Config> {
18
18
  * Disconnects from the SQLite database.
19
19
  */
20
20
  disconnect(): Promise<void>;
21
+ /**
22
+ * Checks if the provider is currently connected to the database.
23
+ * @returns True if connected, false otherwise.
24
+ */
25
+ isConnected(): boolean;
21
26
  /**
22
27
  * Creates a table if it doesn't exist.
23
28
  * Sets up the primary key and any initial structure needed.
@@ -169,6 +174,11 @@ declare class MongoProvider implements DefussProvider<MongoProviderOptions> {
169
174
  * Disconnects from MongoDB.
170
175
  */
171
176
  disconnect(): Promise<void>;
177
+ /**
178
+ * Checks if the provider is currently connected to the database.
179
+ * @returns True if connected, false otherwise.
180
+ */
181
+ isConnected(): boolean;
172
182
  /**
173
183
  * Creates a collection if it doesn't exist.
174
184
  */
package/dist/server.d.ts CHANGED
@@ -18,6 +18,11 @@ declare class LibsqlProvider implements DefussProvider<Config> {
18
18
  * Disconnects from the SQLite database.
19
19
  */
20
20
  disconnect(): Promise<void>;
21
+ /**
22
+ * Checks if the provider is currently connected to the database.
23
+ * @returns True if connected, false otherwise.
24
+ */
25
+ isConnected(): boolean;
21
26
  /**
22
27
  * Creates a table if it doesn't exist.
23
28
  * Sets up the primary key and any initial structure needed.
@@ -169,6 +174,11 @@ declare class MongoProvider implements DefussProvider<MongoProviderOptions> {
169
174
  * Disconnects from MongoDB.
170
175
  */
171
176
  disconnect(): Promise<void>;
177
+ /**
178
+ * Checks if the provider is currently connected to the database.
179
+ * @returns True if connected, false otherwise.
180
+ */
181
+ isConnected(): boolean;
172
182
  /**
173
183
  * Creates a collection if it doesn't exist.
174
184
  */
package/dist/server.mjs CHANGED
@@ -17,6 +17,13 @@ class LibsqlProvider {
17
17
  async disconnect() {
18
18
  this.db.close();
19
19
  }
20
+ /**
21
+ * Checks if the provider is currently connected to the database.
22
+ * @returns True if connected, false otherwise.
23
+ */
24
+ isConnected() {
25
+ return this.db?.closed !== true;
26
+ }
20
27
  /**
21
28
  * Creates a table if it doesn't exist.
22
29
  * Sets up the primary key and any initial structure needed.
@@ -465,6 +472,13 @@ class MongoProvider {
465
472
  }
466
473
  }
467
474
  }
475
+ /**
476
+ * Checks if the provider is currently connected to the database.
477
+ * @returns True if connected, false otherwise.
478
+ */
479
+ isConnected() {
480
+ return !!this.client && !!this.db;
481
+ }
468
482
  /**
469
483
  * Creates a collection if it doesn't exist.
470
484
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defuss-db",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -63,7 +63,7 @@
63
63
  "node": "^18.17.1 || ^20.3.0 || >=21.0.0"
64
64
  },
65
65
  "dependencies": {
66
- "@libsql/client": "^0.15.6",
66
+ "@libsql/client": "^0.15.7",
67
67
  "dexie": "^4.0.11",
68
68
  "dotenv": "^16.5.0",
69
69
  "fake-indexeddb": "^6.0.1",
@@ -84,6 +84,6 @@
84
84
  "build": "pkgroll",
85
85
  "mongodb:start": "tsx scripts/mongo-start.ts",
86
86
  "mongodb:stop": "tsx scripts/mongo-stop.ts",
87
- "test:integration": "vitest --run --coverage"
87
+ "test": "vitest --run --coverage"
88
88
  }
89
89
  }