@mikro-orm/sqlite 7.0.0-dev.33 → 7.0.0-dev.330

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
@@ -2,14 +2,14 @@
2
2
  <a href="https://mikro-orm.io"><img src="https://raw.githubusercontent.com/mikro-orm/mikro-orm/master/docs/static/img/logo-readme.svg?sanitize=true" alt="MikroORM" /></a>
3
3
  </h1>
4
4
 
5
- TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-orm.io/docs/unit-of-work/) and [Identity Map](https://mikro-orm.io/docs/identity-map/) patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite (including libSQL) databases.
5
+ TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-orm.io/docs/unit-of-work/) and [Identity Map](https://mikro-orm.io/docs/identity-map/) patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL, SQLite (including libSQL), MSSQL and Oracle databases.
6
6
 
7
7
  > Heavily inspired by [Doctrine](https://www.doctrine-project.org/) and [Hibernate](https://hibernate.org/).
8
8
 
9
- [![NPM version](https://img.shields.io/npm/v/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
10
- [![NPM dev version](https://img.shields.io/npm/v/@mikro-orm/core/next.svg)](https://www.npmjs.com/package/@mikro-orm/core)
9
+ [![NPM version](https://img.shields.io/npm/v/@mikro-orm/core.svg)](https://npmx.dev/package/@mikro-orm/core)
10
+ [![NPM dev version](https://img.shields.io/npm/v/@mikro-orm/core/next.svg)](https://npmx.dev/package/@mikro-orm/core)
11
11
  [![Chat on discord](https://img.shields.io/discord/1214904142443839538?label=discord&color=blue)](https://discord.gg/w8bjxFHS7X)
12
- [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
12
+ [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://npmx.dev/package/@mikro-orm/core)
13
13
  [![Coverage Status](https://img.shields.io/coveralls/mikro-orm/mikro-orm.svg)](https://coveralls.io/r/mikro-orm/mikro-orm?branch=master)
14
14
  [![Build Status](https://github.com/mikro-orm/mikro-orm/workflows/tests/badge.svg?branch=master)](https://github.com/mikro-orm/mikro-orm/actions?workflow=tests)
15
15
 
@@ -181,6 +181,7 @@ yarn add @mikro-orm/core @mikro-orm/mysql # for mysql/mariadb
181
181
  yarn add @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
182
182
  yarn add @mikro-orm/core @mikro-orm/postgresql # for postgresql
183
183
  yarn add @mikro-orm/core @mikro-orm/mssql # for mssql
184
+ yarn add @mikro-orm/core @mikro-orm/oracledb # for oracle
184
185
  yarn add @mikro-orm/core @mikro-orm/sqlite # for sqlite
185
186
  yarn add @mikro-orm/core @mikro-orm/libsql # for libsql
186
187
  ```
@@ -381,6 +382,8 @@ See also the list of contributors who [participated](https://github.com/mikro-or
381
382
 
382
383
  Please ⭐️ this repository if this project helped you!
383
384
 
385
+ > If you'd like to support my open-source work, consider sponsoring me directly at [github.com/sponsors/b4nan](https://github.com/sponsors/b4nan).
386
+
384
387
  ## 📝 License
385
388
 
386
389
  Copyright © 2018 [Martin Adámek](https://github.com/b4nan).
@@ -1,7 +1,8 @@
1
- import { BaseSqliteConnection, type Dictionary } from '@mikro-orm/knex';
1
+ import { BaseSqliteConnection, type Dictionary } from '@mikro-orm/sql';
2
2
  import { type Dialect } from 'kysely';
3
3
  export declare class SqliteConnection extends BaseSqliteConnection {
4
4
  private database;
5
5
  createKyselyDialect(options: Dictionary): Dialect;
6
- loadFile(path: string): Promise<void>;
6
+ /** @inheritDoc */
7
+ executeDump(dump: string): Promise<void>;
7
8
  }
@@ -1,7 +1,6 @@
1
- import { BaseSqliteConnection } from '@mikro-orm/knex';
1
+ import { BaseSqliteConnection } from '@mikro-orm/sql';
2
2
  import { SqliteDialect } from 'kysely';
3
3
  import Database from 'better-sqlite3';
4
- import { readFile } from 'node:fs/promises';
5
4
  export class SqliteConnection extends BaseSqliteConnection {
6
5
  database;
7
6
  createKyselyDialect(options) {
@@ -12,8 +11,9 @@ export class SqliteConnection extends BaseSqliteConnection {
12
11
  onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
13
12
  });
14
13
  }
15
- async loadFile(path) {
14
+ /** @inheritDoc */
15
+ async executeDump(dump) {
16
16
  await this.ensureConnection();
17
- this.database.exec((await readFile(path)).toString());
17
+ this.database.exec(dump);
18
18
  }
19
19
  }
package/SqliteDriver.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import type { Configuration } from '@mikro-orm/core';
2
- import { AbstractSqlDriver } from '@mikro-orm/knex';
1
+ import type { Configuration, Constructor } from '@mikro-orm/core';
2
+ import { AbstractSqlDriver } from '@mikro-orm/sql';
3
3
  import { SqliteConnection } from './SqliteConnection.js';
4
+ import { SqliteMikroORM } from './SqliteMikroORM.js';
4
5
  export declare class SqliteDriver extends AbstractSqlDriver<SqliteConnection> {
5
6
  constructor(config: Configuration);
7
+ /** @inheritDoc */
8
+ getORMClass(): Constructor<SqliteMikroORM>;
6
9
  }
package/SqliteDriver.js CHANGED
@@ -1,8 +1,12 @@
1
- import { AbstractSqlDriver } from '@mikro-orm/knex';
1
+ import { AbstractSqlDriver, SqlitePlatform } from '@mikro-orm/sql';
2
2
  import { SqliteConnection } from './SqliteConnection.js';
3
- import { SqlitePlatform } from './SqlitePlatform.js';
3
+ import { SqliteMikroORM } from './SqliteMikroORM.js';
4
4
  export class SqliteDriver extends AbstractSqlDriver {
5
5
  constructor(config) {
6
6
  super(config, new SqlitePlatform(), SqliteConnection, ['kysely', 'better-sqlite3']);
7
7
  }
8
+ /** @inheritDoc */
9
+ getORMClass() {
10
+ return SqliteMikroORM;
11
+ }
8
12
  }
@@ -1,19 +1,18 @@
1
- import { MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } 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';
2
+ import type { SqlEntityManager } from '@mikro-orm/sql';
2
3
  import { SqliteDriver } from './SqliteDriver.js';
3
- import type { SqlEntityManager } from '@mikro-orm/knex';
4
+ export type SqliteOptions<EM extends SqlEntityManager<SqliteDriver> = SqlEntityManager<SqliteDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<SqliteDriver, EM, Entities>>;
5
+ 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>>;
4
6
  /**
5
7
  * @inheritDoc
6
8
  */
7
- export declare class SqliteMikroORM<EM extends EntityManager = SqlEntityManager> extends MikroORM<SqliteDriver, EM> {
8
- private static DRIVER;
9
+ 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> {
9
10
  /**
10
11
  * @inheritDoc
11
12
  */
12
- static init<D extends IDatabaseDriver = SqliteDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager>(options?: Options<D, EM>): Promise<MikroORM<D, EM>>;
13
+ 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>>;
13
14
  /**
14
15
  * @inheritDoc
15
16
  */
16
- static initSync<D extends IDatabaseDriver = SqliteDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager>(options: Options<D, EM>): MikroORM<D, EM>;
17
+ constructor(options: Partial<Options<SqliteDriver, EM, Entities>>);
17
18
  }
18
- export type SqliteOptions = Options<SqliteDriver>;
19
- export declare function defineSqliteConfig(options: SqliteOptions): Options<SqliteDriver, SqlEntityManager<SqliteDriver> & EntityManager<IDatabaseDriver<import("@mikro-orm/core").Connection>>>;
package/SqliteMikroORM.js CHANGED
@@ -1,24 +1,22 @@
1
1
  import { defineConfig, MikroORM, } from '@mikro-orm/core';
2
2
  import { SqliteDriver } from './SqliteDriver.js';
3
+ export function defineSqliteConfig(options) {
4
+ return defineConfig({ driver: SqliteDriver, ...options });
5
+ }
3
6
  /**
4
7
  * @inheritDoc
5
8
  */
6
9
  export class SqliteMikroORM extends MikroORM {
7
- static DRIVER = SqliteDriver;
8
10
  /**
9
11
  * @inheritDoc
10
12
  */
11
13
  static async init(options) {
12
- return super.init(options);
14
+ return super.init(defineSqliteConfig(options));
13
15
  }
14
16
  /**
15
17
  * @inheritDoc
16
18
  */
17
- static initSync(options) {
18
- return super.initSync(options);
19
+ constructor(options) {
20
+ super(defineSqliteConfig(options));
19
21
  }
20
22
  }
21
- /* v8 ignore next 3 */
22
- export function defineSqliteConfig(options) {
23
- return defineConfig({ driver: SqliteDriver, ...options });
24
- }
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export * from '@mikro-orm/knex';
1
+ export * from '@mikro-orm/sql';
2
2
  export * from './SqliteConnection.js';
3
- export * from './SqliteDriver.js';
4
- export * from './SqlitePlatform.js';
5
- export { SqliteMikroORM as MikroORM, SqliteOptions as Options, defineSqliteConfig as defineConfig, } from './SqliteMikroORM.js';
3
+ export { SqliteDriver } from './SqliteDriver.js';
4
+ export { SqliteMikroORM as MikroORM, type SqliteOptions as Options, defineSqliteConfig as defineConfig, } from './SqliteMikroORM.js';
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
- export * from '@mikro-orm/knex';
1
+ export * from '@mikro-orm/sql';
2
2
  export * from './SqliteConnection.js';
3
- export * from './SqliteDriver.js';
4
- export * from './SqlitePlatform.js';
3
+ export { SqliteDriver } from './SqliteDriver.js';
5
4
  export { SqliteMikroORM as MikroORM, defineSqliteConfig as defineConfig, } from './SqliteMikroORM.js';
package/package.json CHANGED
@@ -1,69 +1,63 @@
1
1
  {
2
2
  "name": "@mikro-orm/sqlite",
3
- "type": "module",
4
- "version": "7.0.0-dev.33",
3
+ "version": "7.0.0-dev.330",
5
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.",
6
- "typings": "index.d.ts",
7
- "exports": {
8
- "./package.json": "./package.json",
9
- ".": {
10
- "types": "./index.d.ts",
11
- "default": "./index.js"
12
- }
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
17
- },
18
5
  "keywords": [
19
- "orm",
6
+ "data-mapper",
7
+ "ddd",
8
+ "entity",
9
+ "identity-map",
10
+ "javascript",
11
+ "js",
12
+ "mariadb",
13
+ "mikro-orm",
20
14
  "mongo",
21
15
  "mongodb",
22
16
  "mysql",
23
- "mariadb",
17
+ "orm",
24
18
  "postgresql",
25
19
  "sqlite",
26
20
  "sqlite3",
27
21
  "ts",
28
22
  "typescript",
29
- "js",
30
- "javascript",
31
- "entity",
32
- "ddd",
33
- "mikro-orm",
34
- "unit-of-work",
35
- "data-mapper",
36
- "identity-map"
23
+ "unit-of-work"
37
24
  ],
38
- "author": "Martin Adámek",
39
- "license": "MIT",
25
+ "homepage": "https://mikro-orm.io",
40
26
  "bugs": {
41
27
  "url": "https://github.com/mikro-orm/mikro-orm/issues"
42
28
  },
43
- "homepage": "https://mikro-orm.io",
44
- "engines": {
45
- "node": ">= 22.11.0"
29
+ "license": "MIT",
30
+ "author": "Martin Adámek",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
34
+ },
35
+ "type": "module",
36
+ "exports": {
37
+ "./package.json": "./package.json",
38
+ ".": "./index.js"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
46
42
  },
47
43
  "scripts": {
48
- "build": "yarn clean && yarn compile && yarn copy",
44
+ "build": "yarn compile && yarn copy",
49
45
  "clean": "yarn run -T rimraf ./dist",
50
46
  "compile": "yarn run -T tsc -p tsconfig.build.json",
51
47
  "copy": "node ../../scripts/copy.mjs"
52
48
  },
53
- "publishConfig": {
54
- "access": "public"
55
- },
56
49
  "dependencies": {
57
- "@mikro-orm/knex": "7.0.0-dev.33",
58
- "better-sqlite3": "11.8.1",
59
- "sqlstring-sqlite": "0.1.1"
50
+ "@mikro-orm/sql": "7.0.0-dev.330",
51
+ "better-sqlite3": "12.6.2",
52
+ "kysely": "0.28.11"
60
53
  },
61
54
  "devDependencies": {
62
- "@mikro-orm/core": "^6.5.7",
63
- "kysely": "0.28.7"
55
+ "@mikro-orm/core": "^6.6.9"
64
56
  },
65
57
  "peerDependencies": {
66
- "@mikro-orm/core": "7.0.0-dev.33",
67
- "kysely": "*"
58
+ "@mikro-orm/core": "7.0.0-dev.330"
59
+ },
60
+ "engines": {
61
+ "node": ">= 22.17.0"
68
62
  }
69
63
  }
@@ -1,4 +0,0 @@
1
- import { BaseSqlitePlatform } from '@mikro-orm/knex';
2
- export declare class SqlitePlatform extends BaseSqlitePlatform {
3
- escape(value: any): string;
4
- }
package/SqlitePlatform.js DELETED
@@ -1,8 +0,0 @@
1
- // @ts-ignore
2
- import SqlString from 'sqlstring-sqlite';
3
- import { BaseSqlitePlatform } from '@mikro-orm/knex';
4
- export class SqlitePlatform extends BaseSqlitePlatform {
5
- escape(value) {
6
- return SqlString.escape(value, true, this.timezone);
7
- }
8
- }