@mikro-orm/libsql 7.0.0-dev.196 → 7.0.0-dev.198

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.
@@ -3,7 +3,11 @@ import { type Options } from 'libsql';
3
3
  import { LibSqlDialect } from './LibSqlDialect.js';
4
4
  export declare class LibSqlConnection extends BaseSqliteConnection {
5
5
  private database;
6
+ connect(options?: {
7
+ skipOnConnect?: boolean;
8
+ }): Promise<void>;
6
9
  createKyselyDialect(options: Dictionary & Options): LibSqlDialect;
7
10
  /** @inheritDoc */
8
11
  executeDump(source: string): Promise<void>;
12
+ private validateAttachSupport;
9
13
  }
@@ -3,6 +3,10 @@ import Database from 'libsql';
3
3
  import { LibSqlDialect } from './LibSqlDialect.js';
4
4
  export class LibSqlConnection extends BaseSqliteConnection {
5
5
  database;
6
+ async connect(options) {
7
+ this.validateAttachSupport();
8
+ await super.connect(options);
9
+ }
6
10
  createKyselyDialect(options) {
7
11
  const dbName = options.url ?? this.config.get('dbName');
8
12
  options.authToken ??= this.config.get('password');
@@ -18,4 +22,15 @@ export class LibSqlConnection extends BaseSqliteConnection {
18
22
  await this.ensureConnection();
19
23
  this.database.exec(source);
20
24
  }
25
+ validateAttachSupport() {
26
+ const attachDatabases = this.config.get('attachDatabases');
27
+ if (!attachDatabases?.length) {
28
+ return;
29
+ }
30
+ const dbName = this.config.get('dbName');
31
+ if (dbName?.match(/^(https?|libsql):\/\//)) {
32
+ throw new Error('ATTACH DATABASE is not supported for remote libSQL connections. ' +
33
+ 'Use local file-based databases only.');
34
+ }
35
+ }
21
36
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/libsql",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.196",
4
+ "version": "7.0.0-dev.198",
5
5
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
@@ -50,7 +50,7 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@mikro-orm/sql": "7.0.0-dev.196",
53
+ "@mikro-orm/sql": "7.0.0-dev.198",
54
54
  "kysely": "0.28.10",
55
55
  "libsql": "0.5.22",
56
56
  "sqlstring-sqlite": "0.1.1"
@@ -59,6 +59,6 @@
59
59
  "@mikro-orm/core": "^6.6.4"
60
60
  },
61
61
  "peerDependencies": {
62
- "@mikro-orm/core": "7.0.0-dev.196"
62
+ "@mikro-orm/core": "7.0.0-dev.198"
63
63
  }
64
64
  }