@mikro-orm/postgresql 7.2.0-dev.5 → 7.2.0-dev.7

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.
@@ -1,10 +1,13 @@
1
- import { type PoolConfig } from 'pg';
1
+ import { Pool, type PoolConfig } from 'pg';
2
2
  import { PostgresDialect } from 'kysely';
3
3
  import { type Routine, type Transaction } from '@mikro-orm/core';
4
4
  import { AbstractSqlConnection } from '@mikro-orm/sql';
5
5
  /** PostgreSQL database connection using the `pg` driver. */
6
6
  export declare class PostgreSqlConnection extends AbstractSqlConnection {
7
+ #private;
7
8
  createKyselyDialect(overrides: PoolConfig): PostgresDialect;
9
+ /** Returns the `pg` connection pool backing this connection. */
10
+ getNativeClient(): Promise<Pool>;
8
11
  /**
9
12
  * Keeps a connection dropped by the server from taking the process down. `pg` reports such a drop
10
13
  * as an `'error'` event, and an `'error'` event without a listener is a fatal uncaught exception.
@@ -5,10 +5,12 @@ import array from 'postgres-array';
5
5
  import { AbstractSqlConnection, createPostgreSqlTypeParsers, Utils } from '@mikro-orm/sql';
6
6
  /** PostgreSQL database connection using the `pg` driver. */
7
7
  export class PostgreSqlConnection extends AbstractSqlConnection {
8
+ #pool;
8
9
  createKyselyDialect(overrides) {
9
10
  const { onPoolCreated, ...poolOverrides } = (overrides ?? {});
10
11
  const options = this.mapOptions(poolOverrides);
11
12
  const pool = new Pool(options);
13
+ this.#pool = pool;
12
14
  this.handlePoolErrors(pool);
13
15
  void onPoolCreated?.(pool);
14
16
  return new PostgresDialect({
@@ -18,6 +20,11 @@ export class PostgreSqlConnection extends AbstractSqlConnection {
18
20
  onReserveConnection: this.options.onReserveConnection ?? this.config.get('onReserveConnection'),
19
21
  });
20
22
  }
23
+ /** Returns the `pg` connection pool backing this connection. */
24
+ async getNativeClient() {
25
+ await this.ensureConnection();
26
+ return this.requireNativeClient(this.#pool);
27
+ }
21
28
  /**
22
29
  * Keeps a connection dropped by the server from taking the process down. `pg` reports such a drop
23
30
  * as an `'error'` event, and an `'error'` event without a listener is a fatal uncaught exception.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/postgresql",
3
- "version": "7.2.0-dev.5",
3
+ "version": "7.2.0-dev.7",
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,10 +47,10 @@
47
47
  "copy": "node ../../scripts/copy.mjs"
48
48
  },
49
49
  "dependencies": {
50
- "@mikro-orm/sql": "7.2.0-dev.5",
51
- "kysely": "0.29.4",
52
- "pg": "8.22.0",
53
- "pg-cursor": "2.21.0",
50
+ "@mikro-orm/sql": "7.2.0-dev.7",
51
+ "kysely": "0.29.5",
52
+ "pg": "8.23.0",
53
+ "pg-cursor": "2.22.0",
54
54
  "postgres-array": "3.0.4",
55
55
  "postgres-date": "2.1.0",
56
56
  "postgres-interval": "4.1.0"
@@ -59,7 +59,7 @@
59
59
  "@mikro-orm/core": "^7.1.11"
60
60
  },
61
61
  "peerDependencies": {
62
- "@mikro-orm/core": "7.2.0-dev.5"
62
+ "@mikro-orm/core": "7.2.0-dev.7"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">= 22.17.0"