@byline/db-postgres 2.2.3 → 2.2.5

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/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface PgAdapter extends IDbAdapter {
24
24
  /** The pg connection pool — exposed for housekeeping and teardown. */
25
25
  pool: pg.Pool;
26
26
  }
27
- export declare const pgAdapter: ({ connectionString, collections, defaultContentLocale, }: {
27
+ export declare const pgAdapter: ({ connectionString, collections, defaultContentLocale, max, idleTimeoutMillis, connectionTimeoutMillis, }: {
28
28
  connectionString: string;
29
29
  collections: CollectionDefinition[];
30
30
  /**
@@ -35,4 +35,21 @@ export declare const pgAdapter: ({ connectionString, collections, defaultContent
35
35
  * functions tag default-locale path rows with this value.
36
36
  */
37
37
  defaultContentLocale: string;
38
+ /**
39
+ * Maximum number of clients in the pg connection pool. Defaults to 20.
40
+ * Tune via `BYLINE_DB_POSTGRES_MAX_POOL` in the host app.
41
+ */
42
+ max?: number;
43
+ /**
44
+ * Milliseconds an idle client remains in the pool before being closed.
45
+ * Defaults to 2000. Tune via `BYLINE_DB_POSTGRES_IDLE_TIMEOUT_MILLIS`.
46
+ */
47
+ idleTimeoutMillis?: number;
48
+ /**
49
+ * Milliseconds to wait for a new connection before erroring. Defaults
50
+ * to 30000 — long enough to absorb cold starts on serverless Postgres
51
+ * providers like Neon. Tune via
52
+ * `BYLINE_DB_POSTGRES_CONNECTION_TIMEOUT_MILLIS`.
53
+ */
54
+ connectionTimeoutMillis?: number;
38
55
  }) => PgAdapter;
package/dist/index.js CHANGED
@@ -11,12 +11,12 @@ import * as schema from './database/schema/index.js';
11
11
  import { createCounterCommands } from './modules/counters/counters-commands.js';
12
12
  import { createCommandBuilders } from './modules/storage/storage-commands.js';
13
13
  import { createQueryBuilders } from './modules/storage/storage-queries.js';
14
- export const pgAdapter = ({ connectionString, collections, defaultContentLocale, }) => {
14
+ export const pgAdapter = ({ connectionString, collections, defaultContentLocale, max = 20, idleTimeoutMillis = 2000, connectionTimeoutMillis = 30000, }) => {
15
15
  const pool = new pg.Pool({
16
16
  connectionString: connectionString,
17
- max: 20,
18
- idleTimeoutMillis: 2000,
19
- connectionTimeoutMillis: 1000,
17
+ max,
18
+ idleTimeoutMillis,
19
+ connectionTimeoutMillis,
20
20
  });
21
21
  const db = drizzle(pool, { schema });
22
22
  const commandBuilders = createCommandBuilders(db, defaultContentLocale);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/db-postgres",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "2.2.3",
5
+ "version": "2.2.5",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },
@@ -57,9 +57,9 @@
57
57
  "pg": "^8.20.0",
58
58
  "uuid": "^14.0.0",
59
59
  "zod": "^4.4.3",
60
- "@byline/admin": "2.2.3",
61
- "@byline/core": "2.2.3",
62
- "@byline/auth": "2.2.3"
60
+ "@byline/admin": "2.2.5",
61
+ "@byline/core": "2.2.5",
62
+ "@byline/auth": "2.2.5"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@biomejs/biome": "2.4.15",