postgrejs 3.1.2 → 3.1.3

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/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ## Changelog
2
2
 
3
- ### [v3.1.2](https://github.com/panates/postgrejs/compare/v3.1.1...v3.1.2) -
3
+ ### [v3.1.3](https://github.com/panates/postgrejs/compare/v3.1.2...v3.1.3) -
4
+
5
+ #### 🪲 Fixes
6
+
7
+ - fix: reset transaction depth after prepareTransaction() @Eray Hanoğlu
8
+
9
+ ### [v3.1.2](https://github.com/panates/postgrejs/compare/v3.1.1...v3.1.2) - 11 September 2026
4
10
 
5
11
  #### 💬 General Changes
6
12
 
@@ -101,6 +101,13 @@ export declare class IntlConnection extends SafeEventEmitter {
101
101
  *
102
102
  * Requires `max_prepared_transactions` above zero on the server, which is
103
103
  * not the default; the server's own error says so if it is not.
104
+ *
105
+ * Resets `_transactionDepth` like commit()/rollback() do: PREPARE
106
+ * TRANSACTION ends the session's transaction on the wire regardless of
107
+ * how many nested startTransaction() calls led up to it, so a stale,
108
+ * nonzero depth left behind here would make a later, unrelated commit()
109
+ * on this same connection treat itself as still nested and silently skip
110
+ * sending COMMIT.
104
111
  */
105
112
  prepareTransaction(name: string): Promise<void>;
106
113
  /** Commits a transaction left waiting by prepareTransaction(). */
@@ -293,9 +293,17 @@ export class IntlConnection extends SafeEventEmitter {
293
293
  *
294
294
  * Requires `max_prepared_transactions` above zero on the server, which is
295
295
  * not the default; the server's own error says so if it is not.
296
+ *
297
+ * Resets `_transactionDepth` like commit()/rollback() do: PREPARE
298
+ * TRANSACTION ends the session's transaction on the wire regardless of
299
+ * how many nested startTransaction() calls led up to it, so a stale,
300
+ * nonzero depth left behind here would make a later, unrelated commit()
301
+ * on this same connection treat itself as still nested and silently skip
302
+ * sending COMMIT.
296
303
  */
297
304
  async prepareTransaction(name) {
298
305
  await this._execute('PREPARE TRANSACTION ' + escapeLiteral(name));
306
+ this._transactionDepth = 0;
299
307
  }
300
308
  /** Commits a transaction left waiting by prepareTransaction(). */
301
309
  async commitPrepared(name) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "postgrejs",
3
3
  "description": "Professional PostgreSQL client NodeJS",
4
- "version": "3.1.2",
4
+ "version": "3.1.3",
5
5
  "author": "Panates",
6
6
  "license": "BSD-3-Clause",
7
7
  "dependencies": {