@stonyx/orm 0.3.2-beta.68 → 0.3.2-beta.69

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.
@@ -6,6 +6,7 @@ interface PgConfig {
6
6
  password: string;
7
7
  database: string;
8
8
  connectionLimit: number;
9
+ [key: string]: unknown;
9
10
  }
10
11
  /**
11
12
  * Create or return the singleton pg Pool.
@@ -7,15 +7,17 @@ export async function getPool(pgConfig, extensions = ['vector']) {
7
7
  if (pool)
8
8
  return pool;
9
9
  const { default: pg } = await import('pg');
10
+ const { host, port, user, password, database, connectionLimit, migrationsDir, migrationsTable, ...poolOpts } = pgConfig;
10
11
  pool = new pg.Pool({
11
- host: pgConfig.host,
12
- port: pgConfig.port,
13
- user: pgConfig.user,
14
- password: pgConfig.password,
15
- database: pgConfig.database,
16
- max: pgConfig.connectionLimit,
12
+ host,
13
+ port,
14
+ user,
15
+ password,
16
+ database,
17
+ max: connectionLimit,
17
18
  idleTimeoutMillis: 30000,
18
19
  connectionTimeoutMillis: 10000,
20
+ ...poolOpts,
19
21
  });
20
22
  // Enable requested PostgreSQL extensions
21
23
  for (const ext of extensions) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "stonyx-async",
5
5
  "stonyx-module"
6
6
  ],
7
- "version": "0.3.2-beta.68",
7
+ "version": "0.3.2-beta.69",
8
8
  "description": "",
9
9
  "main": "dist/index.js",
10
10
  "type": "module",
@@ -8,6 +8,7 @@ interface PgConfig {
8
8
  password: string;
9
9
  database: string;
10
10
  connectionLimit: number;
11
+ [key: string]: unknown;
11
12
  }
12
13
 
13
14
  let pool: PgPool | null = null;
@@ -20,15 +21,18 @@ export async function getPool(pgConfig: PgConfig, extensions: string[] = ['vecto
20
21
 
21
22
  const { default: pg } = await import('pg');
22
23
 
24
+ const { host, port, user, password, database, connectionLimit, migrationsDir, migrationsTable, ...poolOpts } = pgConfig;
25
+
23
26
  pool = new pg.Pool({
24
- host: pgConfig.host,
25
- port: pgConfig.port,
26
- user: pgConfig.user,
27
- password: pgConfig.password,
28
- database: pgConfig.database,
29
- max: pgConfig.connectionLimit,
27
+ host,
28
+ port,
29
+ user,
30
+ password,
31
+ database,
32
+ max: connectionLimit,
30
33
  idleTimeoutMillis: 30000,
31
34
  connectionTimeoutMillis: 10000,
35
+ ...poolOpts,
32
36
  });
33
37
 
34
38
  // Enable requested PostgreSQL extensions