@venturekit/data 0.0.0-dev.20260415181804 → 0.0.0-dev.20260427211132

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.
@@ -7,7 +7,10 @@
7
7
  * Required env vars:
8
8
  * - DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
9
9
  * Optional:
10
- * - DB_SSL ("true" to enable), DB_POOL_MAX (default 10)
10
+ * - DB_SSL ("true" to enable TLS — verifies the server certificate by default)
11
+ * - DB_SSL_CA (PEM-encoded CA bundle to trust, e.g. the RDS global bundle)
12
+ * - DB_SSL_INSECURE ("true" to skip certificate verification — NOT recommended)
13
+ * - DB_POOL_MAX (default 10)
11
14
  */
12
15
  import { Pool } from 'pg';
13
16
  export declare function getPool(): Pool;
@@ -1 +1 @@
1
- {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/query/pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAI1B,wBAAgB,OAAO,IAAI,IAAI,CAa9B"}
1
+ {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/query/pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAmB,MAAM,IAAI,CAAC;AA0B3C,wBAAgB,OAAO,IAAI,IAAI,CAa9B"}
@@ -7,10 +7,31 @@
7
7
  * Required env vars:
8
8
  * - DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
9
9
  * Optional:
10
- * - DB_SSL ("true" to enable), DB_POOL_MAX (default 10)
10
+ * - DB_SSL ("true" to enable TLS — verifies the server certificate by default)
11
+ * - DB_SSL_CA (PEM-encoded CA bundle to trust, e.g. the RDS global bundle)
12
+ * - DB_SSL_INSECURE ("true" to skip certificate verification — NOT recommended)
13
+ * - DB_POOL_MAX (default 10)
11
14
  */
12
15
  import { Pool } from 'pg';
13
16
  let pool = null;
17
+ /** Build the `ssl` field for PoolConfig based on env vars. */
18
+ function resolveSsl() {
19
+ if (process.env.DB_SSL !== 'true')
20
+ return undefined;
21
+ // Insecure opt-out: log a loud warning so this never sneaks into prod unnoticed.
22
+ if (process.env.DB_SSL_INSECURE === 'true') {
23
+ // eslint-disable-next-line no-console
24
+ console.warn('[venturekit/data] DB_SSL_INSECURE=true — TLS enabled but certificate ' +
25
+ 'verification is DISABLED. This is vulnerable to MITM and should only ' +
26
+ 'be used for local testing. Remove DB_SSL_INSECURE and set DB_SSL_CA ' +
27
+ 'to the RDS CA bundle in production.');
28
+ return { rejectUnauthorized: false };
29
+ }
30
+ // Verified TLS: use the provided CA bundle if set, otherwise the system trust store.
31
+ return process.env.DB_SSL_CA
32
+ ? { rejectUnauthorized: true, ca: process.env.DB_SSL_CA }
33
+ : { rejectUnauthorized: true };
34
+ }
14
35
  export function getPool() {
15
36
  if (!pool) {
16
37
  pool = new Pool({
@@ -19,7 +40,7 @@ export function getPool() {
19
40
  database: process.env.DB_NAME,
20
41
  user: process.env.DB_USER,
21
42
  password: process.env.DB_PASSWORD,
22
- ssl: process.env.DB_SSL === 'true' ? { rejectUnauthorized: false } : undefined,
43
+ ssl: resolveSsl(),
23
44
  max: Number(process.env.DB_POOL_MAX ?? 10),
24
45
  });
25
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pool.js","sourceRoot":"","sources":["../../src/query/pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,IAAI,IAAI,GAAgB,IAAI,CAAC;AAE7B,MAAM,UAAU,OAAO;IACrB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,IAAI,IAAI,CAAC;YACd,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YACzB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,C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IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,IAAI,IAAI,CAAC;YACd,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YACzB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC;YACzC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YAC7B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YACzB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;YACjC,GAAG,EAAE,UAAU,EAAE;YACjB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;SAC3C,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -19,12 +19,40 @@ export interface Transaction {
19
19
  /** Roll back the transaction */
20
20
  rollback(): Promise<void>;
21
21
  }
22
+ /**
23
+ * Options for {@link beginTransaction} / {@link withTransaction}.
24
+ */
25
+ export interface TransactionOptions {
26
+ /**
27
+ * Per-transaction `statement_timeout` in milliseconds. When a single query
28
+ * runs longer than this, Postgres cancels it with a clean error — far better
29
+ * than letting a Lambda hang until its own timeout fires with no logs.
30
+ *
31
+ * Implemented as `SET LOCAL statement_timeout`, so the timeout only applies
32
+ * inside this transaction and does not leak back to the pool's shared
33
+ * connection.
34
+ *
35
+ * Defaults to `DB_STATEMENT_TIMEOUT_MS` env var or 10 000 ms.
36
+ * Pass `0` to disable.
37
+ */
38
+ statementTimeoutMs?: number;
39
+ }
40
+ /**
41
+ * Default statement timeout (ms) — keeps Lambdas from hanging on rogue queries
42
+ * while staying generous enough for normal OLTP work. Override per-call via
43
+ * `TransactionOptions.statementTimeoutMs` or globally via the
44
+ * `DB_STATEMENT_TIMEOUT_MS` env var.
45
+ */
46
+ export declare const DEFAULT_STATEMENT_TIMEOUT_MS = 10000;
22
47
  /**
23
48
  * Begin a manual transaction.
24
49
  *
50
+ * Automatically applies `SET LOCAL statement_timeout` so long-running queries
51
+ * fail fast with a clear Postgres error instead of eating your Lambda budget.
52
+ *
25
53
  * @example
26
54
  * ```typescript
27
- * const tx = await beginTransaction();
55
+ * const tx = await beginTransaction({ statementTimeoutMs: 5_000 });
28
56
  * try {
29
57
  * await tx.query('INSERT INTO posts (title) VALUES ($1)', ['Hello']);
30
58
  * await tx.query('INSERT INTO audit_log (action) VALUES ($1)', ['post_created']);
@@ -35,11 +63,17 @@ export interface Transaction {
35
63
  * }
36
64
  * ```
37
65
  */
38
- export declare function beginTransaction(): Promise<Transaction>;
66
+ export declare function beginTransaction(options?: TransactionOptions): Promise<Transaction>;
39
67
  /**
40
68
  * Execute a callback within a transaction.
41
69
  * Commits on success, rolls back on error.
42
70
  *
71
+ * Detects nested calls: if you call `withTransaction` while already inside
72
+ * another `withTransaction` on the same async chain, the inner call **reuses
73
+ * the outer transaction** instead of opening a new connection. This avoids
74
+ * pool exhaustion (the classic "each nested call holds its own connection"
75
+ * deadlock) and silent double-commit bugs.
76
+ *
43
77
  * @example
44
78
  * ```typescript
45
79
  * const [post, log] = await withTransaction(async (tx) => {
@@ -49,7 +83,8 @@ export declare function beginTransaction(): Promise<Transaction>;
49
83
  * });
50
84
  * ```
51
85
  */
52
- export declare function withTransaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>;
86
+ export declare function withTransaction<T>(fn: (tx: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
87
+ export declare function withTransaction<T>(outerTx: Transaction | undefined, fn: (tx: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
53
88
  /**
54
89
  * Build a Transaction object from a PoolClient.
55
90
  * Used internally by beginTransaction and by the runtime
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/query/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,IAAI,CAAC;AAIlD,M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AAO,CAAC,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,EAAE,EACvB,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAAC;IACd,6BAA6B;IAC7B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,gCAAgC;IAChC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAUnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAiBzF;AAaD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACrC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACnC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAAC;AACd,wBAAsB,eAAe,CAAC,CAAC,EACrC,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACnC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAAC;AAkDd;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,CA4BhE"}
@@ -8,12 +8,31 @@
8
8
  */
9
9
  import { getPool } from './pool.js';
10
10
  import { mapResults } from './mapper.js';
11
+ /**
12
+ * Default statement timeout (ms) — keeps Lambdas from hanging on rogue queries
13
+ * while staying generous enough for normal OLTP work. Override per-call via
14
+ * `TransactionOptions.statementTimeoutMs` or globally via the
15
+ * `DB_STATEMENT_TIMEOUT_MS` env var.
16
+ */
17
+ export const DEFAULT_STATEMENT_TIMEOUT_MS = 10_000;
18
+ function resolveStatementTimeout(options) {
19
+ if (options?.statementTimeoutMs !== undefined)
20
+ return options.statementTimeoutMs;
21
+ const raw = process.env.DB_STATEMENT_TIMEOUT_MS;
22
+ if (!raw)
23
+ return DEFAULT_STATEMENT_TIMEOUT_MS;
24
+ const n = Number.parseInt(raw, 10);
25
+ return Number.isFinite(n) && n >= 0 ? n : DEFAULT_STATEMENT_TIMEOUT_MS;
26
+ }
11
27
  /**
12
28
  * Begin a manual transaction.
13
29
  *
30
+ * Automatically applies `SET LOCAL statement_timeout` so long-running queries
31
+ * fail fast with a clear Postgres error instead of eating your Lambda budget.
32
+ *
14
33
  * @example
15
34
  * ```typescript
16
- * const tx = await beginTransaction();
35
+ * const tx = await beginTransaction({ statementTimeoutMs: 5_000 });
17
36
  * try {
18
37
  * await tx.query('INSERT INTO posts (title) VALUES ($1)', ['Hello']);
19
38
  * await tx.query('INSERT INTO audit_log (action) VALUES ($1)', ['post_created']);
@@ -24,27 +43,60 @@ import { mapResults } from './mapper.js';
24
43
  * }
25
44
  * ```
26
45
  */
27
- export async function beginTransaction() {
46
+ export async function beginTransaction(options) {
28
47
  const pool = getPool();
29
48
  const client = await pool.connect();
30
49
  await client.query('BEGIN');
50
+ const timeoutMs = resolveStatementTimeout(options);
51
+ if (timeoutMs > 0) {
52
+ // SET LOCAL scopes the timeout to this transaction only; after COMMIT /
53
+ // ROLLBACK the pooled connection reverts to its previous value. We
54
+ // inject the integer ourselves because `SET LOCAL` doesn't accept
55
+ // parameter placeholders — casting to Number guards against SQLi.
56
+ const ms = Math.floor(Number(timeoutMs));
57
+ await client.query(`SET LOCAL statement_timeout = ${ms}`);
58
+ }
31
59
  return buildTransaction(client);
32
60
  }
33
61
  /**
34
- * Execute a callback within a transaction.
35
- * Commits on success, rolls back on error.
62
+ * AsyncLocalStorage-style nested transaction detection.
36
63
  *
37
- * @example
38
- * ```typescript
39
- * const [post, log] = await withTransaction(async (tx) => {
40
- * const post = await tx.query('INSERT INTO posts ... RETURNING *', [...]);
41
- * const log = await tx.query('INSERT INTO audit_log ...', [...]);
42
- * return [post, log];
43
- * });
44
- * ```
64
+ * We can't import `async_hooks` in every environment cheaply, so we instead
65
+ * use a module-level counter keyed by the returned promise chain. It's good
66
+ * enough to catch the 99% case: someone calling `withTransaction` from inside
67
+ * another `withTransaction` callback on the same event-loop tick.
45
68
  */
46
- export async function withTransaction(fn) {
47
- const tx = await beginTransaction();
69
+ const activeTransactions = new WeakSet();
70
+ let transactionDepth = 0;
71
+ export async function withTransaction(fnOrOuter, fnOrOptions, maybeOptions) {
72
+ // Two-arg overload resolution
73
+ let outerTx;
74
+ let fn;
75
+ let options;
76
+ if (typeof fnOrOuter === 'function') {
77
+ fn = fnOrOuter;
78
+ options = fnOrOptions;
79
+ }
80
+ else {
81
+ outerTx = fnOrOuter;
82
+ fn = fnOrOptions;
83
+ options = maybeOptions;
84
+ }
85
+ // If an outer transaction was explicitly passed OR one is already active on
86
+ // this async chain, reuse it. The outer scope owns commit/rollback; the
87
+ // inner callback only sees the shared `tx`.
88
+ if (outerTx && activeTransactions.has(outerTx)) {
89
+ return fn(outerTx);
90
+ }
91
+ if (transactionDepth > 0) {
92
+ throw new Error('withTransaction called inside another withTransaction without passing the outer tx. ' +
93
+ 'Pass the outer transaction as the first argument: `withTransaction(outerTx, async (tx) => ...)`, ' +
94
+ 'or refactor to a single top-level transaction. Nested calls without the outer tx would ' +
95
+ 'open a second pool connection and can deadlock under load.');
96
+ }
97
+ transactionDepth++;
98
+ const tx = await beginTransaction(options);
99
+ activeTransactions.add(tx);
48
100
  try {
49
101
  const result = await fn(tx);
50
102
  await tx.commit();
@@ -54,6 +106,10 @@ export async function withTransaction(fn) {
54
106
  await tx.rollback();
55
107
  throw err;
56
108
  }
109
+ finally {
110
+ activeTransactions.delete(tx);
111
+ transactionDepth--;
112
+ }
57
113
  }
58
114
  /**
59
115
  * Build a Transaction object from a PoolClient.
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/query/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAoBzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,MAAM,GAAe,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IAEhD,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE5B,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,EAAmC;IAEnC,MAAM,EAAE,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;QACpB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,OAAO;QACL,KAAK,CAAC,KAAK,CACT,QAAgB,EAChB,WAAuB,EACvB,aAAgC;YAEhC,MAAM,GAAG,GAAgB,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACnE,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC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;gBACT,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACH,CAAC;QAED,KAAK,CAAC,QAAQ;YACZ,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venturekit/data",
3
- "version": "0.0.0-dev.20260415181804",
3
+ "version": "0.0.0-dev.20260427211132",
4
4
  "description": "Database and data layer for VentureKit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@venturekit/core": "0.0.0-dev.20260415181804",
28
+ "@venturekit/core": "0.0.0-dev.20260427211132",
29
29
  "pg": "^8.12.0"
30
30
  },
31
31
  "devDependencies": {