@mikro-orm/sqlite 7.0.6 → 7.0.7-dev.1

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
@@ -133,7 +133,7 @@ const author = await em.findOneOrFail(Author, 1, {
133
133
  populate: ['books'],
134
134
  });
135
135
  author.name = 'Jon Snow II';
136
- author.books.getItems().forEach(book => (book.title += ' (2nd ed.)'));
136
+ author.books.getItems().forEach(book => book.title += ' (2nd ed.)');
137
137
  author.books.add(orm.em.create(Book, { title: 'New Book', author }));
138
138
 
139
139
  // Flush computes change sets and executes them in a single transaction
@@ -2,8 +2,8 @@ import { BaseSqliteConnection, type Dictionary } from '@mikro-orm/sql';
2
2
  import { type Dialect } from 'kysely';
3
3
  /** SQLite database connection using the `better-sqlite3` driver. */
4
4
  export declare class SqliteConnection extends BaseSqliteConnection {
5
- private database;
6
- createKyselyDialect(options: Dictionary): Dialect;
7
- /** @inheritDoc */
8
- executeDump(dump: string): Promise<void>;
5
+ private database;
6
+ createKyselyDialect(options: Dictionary): Dialect;
7
+ /** @inheritDoc */
8
+ executeDump(dump: string): Promise<void>;
9
9
  }
@@ -3,18 +3,18 @@ import { SqliteDialect } from 'kysely';
3
3
  import Database from 'better-sqlite3';
4
4
  /** SQLite database connection using the `better-sqlite3` driver. */
5
5
  export class SqliteConnection extends BaseSqliteConnection {
6
- database;
7
- createKyselyDialect(options) {
8
- const dbName = options.dbName ?? this.config.get('dbName');
9
- this.database = new Database(dbName, options);
10
- return new SqliteDialect({
11
- database: this.database,
12
- onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
13
- });
14
- }
15
- /** @inheritDoc */
16
- async executeDump(dump) {
17
- await this.ensureConnection();
18
- this.database.exec(dump);
19
- }
6
+ database;
7
+ createKyselyDialect(options) {
8
+ const dbName = options.dbName ?? this.config.get('dbName');
9
+ this.database = new Database(dbName, options);
10
+ return new SqliteDialect({
11
+ database: this.database,
12
+ onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
13
+ });
14
+ }
15
+ /** @inheritDoc */
16
+ async executeDump(dump) {
17
+ await this.ensureConnection();
18
+ this.database.exec(dump);
19
+ }
20
20
  }
package/SqliteDriver.d.ts CHANGED
@@ -4,7 +4,7 @@ import { SqliteConnection } from './SqliteConnection.js';
4
4
  import { SqliteMikroORM } from './SqliteMikroORM.js';
5
5
  /** Database driver for SQLite using better-sqlite3. */
6
6
  export declare class SqliteDriver extends AbstractSqlDriver<SqliteConnection> {
7
- constructor(config: Configuration);
8
- /** @inheritDoc */
9
- getORMClass(): Constructor<SqliteMikroORM>;
7
+ constructor(config: Configuration);
8
+ /** @inheritDoc */
9
+ getORMClass(): Constructor<SqliteMikroORM>;
10
10
  }
package/SqliteDriver.js CHANGED
@@ -3,11 +3,11 @@ import { SqliteConnection } from './SqliteConnection.js';
3
3
  import { SqliteMikroORM } from './SqliteMikroORM.js';
4
4
  /** Database driver for SQLite using better-sqlite3. */
5
5
  export class SqliteDriver extends AbstractSqlDriver {
6
- constructor(config) {
7
- super(config, new SqlitePlatform(), SqliteConnection, ['kysely', 'better-sqlite3']);
8
- }
9
- /** @inheritDoc */
10
- getORMClass() {
11
- return SqliteMikroORM;
12
- }
6
+ constructor(config) {
7
+ super(config, new SqlitePlatform(), SqliteConnection, ['kysely', 'better-sqlite3']);
8
+ }
9
+ /** @inheritDoc */
10
+ getORMClass() {
11
+ return SqliteMikroORM;
12
+ }
13
13
  }
@@ -1,58 +1,20 @@
1
- import {
2
- type AnyEntity,
3
- type EntityClass,
4
- type EntitySchema,
5
- MikroORM,
6
- type Options,
7
- type IDatabaseDriver,
8
- type EntityManager,
9
- type EntityManagerType,
10
- } from '@mikro-orm/core';
1
+ import { type AnyEntity, type EntityClass, type EntitySchema, MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
11
2
  import type { SqlEntityManager } from '@mikro-orm/sql';
12
3
  import { SqliteDriver } from './SqliteDriver.js';
13
4
  /** Configuration options for the SQLite driver. */
14
- export type SqliteOptions<
15
- EM extends SqlEntityManager<SqliteDriver> = SqlEntityManager<SqliteDriver>,
16
- Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
17
- | string
18
- | EntityClass<AnyEntity>
19
- | EntitySchema
20
- )[],
21
- > = Partial<Options<SqliteDriver, EM, Entities>>;
5
+ export type SqliteOptions<EM extends SqlEntityManager<SqliteDriver> = SqlEntityManager<SqliteDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<SqliteDriver, EM, Entities>>;
22
6
  /** Creates a type-safe configuration object for the SQLite driver. */
23
- export declare function defineSqliteConfig<
24
- EM extends SqlEntityManager<SqliteDriver> = SqlEntityManager<SqliteDriver>,
25
- Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
26
- | string
27
- | EntityClass<AnyEntity>
28
- | EntitySchema
29
- )[],
30
- >(options: Partial<Options<SqliteDriver, EM, Entities>>): Partial<Options<SqliteDriver, EM, Entities>>;
7
+ export declare function defineSqliteConfig<EM extends SqlEntityManager<SqliteDriver> = SqlEntityManager<SqliteDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<SqliteDriver, EM, Entities>>): Partial<Options<SqliteDriver, EM, Entities>>;
31
8
  /**
32
9
  * @inheritDoc
33
10
  */
34
- export declare class SqliteMikroORM<
35
- EM extends SqlEntityManager<SqliteDriver> = SqlEntityManager<SqliteDriver>,
36
- Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
37
- | string
38
- | EntityClass<AnyEntity>
39
- | EntitySchema
40
- )[],
41
- > extends MikroORM<SqliteDriver, EM, Entities> {
42
- /**
43
- * @inheritDoc
44
- */
45
- static init<
46
- D extends IDatabaseDriver = SqliteDriver,
47
- EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>,
48
- Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
49
- | string
50
- | EntityClass<AnyEntity>
51
- | EntitySchema
52
- )[],
53
- >(options: Partial<Options<D, EM, Entities>>): Promise<MikroORM<D, EM, Entities>>;
54
- /**
55
- * @inheritDoc
56
- */
57
- constructor(options: Partial<Options<SqliteDriver, EM, Entities>>);
11
+ export declare class SqliteMikroORM<EM extends SqlEntityManager<SqliteDriver> = SqlEntityManager<SqliteDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends MikroORM<SqliteDriver, EM, Entities> {
12
+ /**
13
+ * @inheritDoc
14
+ */
15
+ static init<D extends IDatabaseDriver = SqliteDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Promise<MikroORM<D, EM, Entities>>;
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ constructor(options: Partial<Options<SqliteDriver, EM, Entities>>);
58
20
  }
package/SqliteMikroORM.js CHANGED
@@ -1,23 +1,23 @@
1
- import { defineConfig, MikroORM } from '@mikro-orm/core';
1
+ import { defineConfig, MikroORM, } from '@mikro-orm/core';
2
2
  import { SqliteDriver } from './SqliteDriver.js';
3
3
  /** Creates a type-safe configuration object for the SQLite driver. */
4
4
  export function defineSqliteConfig(options) {
5
- return defineConfig({ driver: SqliteDriver, ...options });
5
+ return defineConfig({ driver: SqliteDriver, ...options });
6
6
  }
7
7
  /**
8
8
  * @inheritDoc
9
9
  */
10
10
  export class SqliteMikroORM extends MikroORM {
11
- /**
12
- * @inheritDoc
13
- */
14
- static async init(options) {
15
- return super.init(defineSqliteConfig(options));
16
- }
17
- /**
18
- * @inheritDoc
19
- */
20
- constructor(options) {
21
- super(defineSqliteConfig(options));
22
- }
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ static async init(options) {
15
+ return super.init(defineSqliteConfig(options));
16
+ }
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ constructor(options) {
21
+ super(defineSqliteConfig(options));
22
+ }
23
23
  }
package/index.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  export * from '@mikro-orm/sql';
2
2
  export * from './SqliteConnection.js';
3
3
  export { SqliteDriver } from './SqliteDriver.js';
4
- export {
5
- SqliteMikroORM as MikroORM,
6
- type SqliteOptions as Options,
7
- defineSqliteConfig as defineConfig,
8
- } from './SqliteMikroORM.js';
4
+ export { SqliteMikroORM as MikroORM, type SqliteOptions as Options, defineSqliteConfig as defineConfig, } from './SqliteMikroORM.js';
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from '@mikro-orm/sql';
2
2
  export * from './SqliteConnection.js';
3
3
  export { SqliteDriver } from './SqliteDriver.js';
4
- export { SqliteMikroORM as MikroORM, defineSqliteConfig as defineConfig } from './SqliteMikroORM.js';
4
+ export { SqliteMikroORM as MikroORM, defineSqliteConfig as defineConfig, } from './SqliteMikroORM.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sqlite",
3
- "version": "7.0.6",
3
+ "version": "7.0.7-dev.1",
4
4
  "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.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -47,7 +47,7 @@
47
47
  "copy": "node ../../scripts/copy.mjs"
48
48
  },
49
49
  "dependencies": {
50
- "@mikro-orm/sql": "7.0.6",
50
+ "@mikro-orm/sql": "7.0.7-dev.1",
51
51
  "better-sqlite3": "12.8.0",
52
52
  "kysely": "0.28.14"
53
53
  },
@@ -55,7 +55,7 @@
55
55
  "@mikro-orm/core": "^7.0.6"
56
56
  },
57
57
  "peerDependencies": {
58
- "@mikro-orm/core": "7.0.6"
58
+ "@mikro-orm/core": "7.0.7-dev.1"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">= 22.17.0"