@mikro-orm/sql 7.2.0-dev.5 → 7.2.0-dev.6

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.
@@ -36,6 +36,13 @@ export declare abstract class AbstractSqlConnection extends Connection {
36
36
  getClient<T = any>(): Kysely<T>;
37
37
  /** Ensures the Kysely client is initialized, creating it asynchronously if needed. */
38
38
  initClient(): Promise<void>;
39
+ /**
40
+ * Guards `getNativeClient()` overrides — drivers only capture their client while building their
41
+ * own dialect, which `driverOptions` carrying a ready-made Kysely instance or dialect skips.
42
+ *
43
+ * @internal
44
+ */
45
+ protected requireNativeClient<T>(client: T | undefined | null): T;
39
46
  /** Executes a callback within a transaction, committing on success and rolling back on error. */
40
47
  transactional<T>(cb: (trx: Transaction<ControlledTransaction<any, any>>) => Promise<T>, options?: {
41
48
  isolationLevel?: IsolationLevel;
@@ -101,6 +101,18 @@ export class AbstractSqlConnection extends Connection {
101
101
  await this.createKysely();
102
102
  }
103
103
  }
104
+ /**
105
+ * Guards `getNativeClient()` overrides — drivers only capture their client while building their
106
+ * own dialect, which `driverOptions` carrying a ready-made Kysely instance or dialect skips.
107
+ *
108
+ * @internal
109
+ */
110
+ requireNativeClient(client) {
111
+ if (client == null) {
112
+ throw new Error('The native client is not available, as it is owned by the Kysely instance or dialect passed via `driverOptions`. Access it through the object you provided there instead.');
113
+ }
114
+ return client;
115
+ }
104
116
  /** Executes a callback within a transaction, committing on success and rolling back on error. */
105
117
  async transactional(cb, options = {}) {
106
118
  const trx = await this.begin(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.2.0-dev.5",
3
+ "version": "7.2.0-dev.6",
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",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^7.1.11"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.2.0-dev.5"
56
+ "@mikro-orm/core": "7.2.0-dev.6"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"