Comparing version 41.0.1 to 41.1.0
@@ -13,2 +13,3 @@ "use strict"; | ||
connectionUri, | ||
dangerouslyAllowForeignConnections: false, | ||
gracefulTerminationTimeout: 5000, | ||
@@ -15,0 +16,0 @@ idleInTransactionSessionTimeout: 60000, |
@@ -14,2 +14,3 @@ "use strict"; | ||
connectionUri: 'postgres://', | ||
dangerouslyAllowForeignConnections: false, | ||
gracefulTerminationTimeout: 5000, | ||
@@ -16,0 +17,0 @@ idleInTransactionSessionTimeout: 60000, |
@@ -10,2 +10,3 @@ "use strict"; | ||
connectionUri: 'postgres://', | ||
dangerouslyAllowForeignConnections: false, | ||
gracefulTerminationTimeout: 5000, | ||
@@ -12,0 +13,0 @@ idleInTransactionSessionTimeout: 60000, |
@@ -42,2 +42,11 @@ "use strict"; | ||
}); | ||
test('does not allow to reference a non-transaction connection inside of a transaction (disabled)', async (t) => { | ||
const pool = await (0, __1.createPool)(t.context.dsn, { | ||
dangerouslyAllowForeignConnections: true, | ||
driverFactory, | ||
}); | ||
await t.notThrowsAsync(pool.transaction(async () => { | ||
await pool.query(__1.sql.unsafe `SELECT 1`); | ||
})); | ||
}); | ||
test('streams data', async (t) => { | ||
@@ -44,0 +53,0 @@ const pool = await (0, __1.createPool)(t.context.dsn, { |
@@ -61,3 +61,4 @@ "use strict"; | ||
const transactionStore = transactionContext_1.transactionContext.getStore(); | ||
if (transactionStore?.transactionId && | ||
if (clientConfiguration.dangerouslyAllowForeignConnections !== true && | ||
transactionStore?.transactionId && | ||
transactionStore.transactionId !== poolClientState.transactionId) { | ||
@@ -64,0 +65,0 @@ throw new errors_1.UnexpectedForeignConnectionError(); |
@@ -76,2 +76,6 @@ /// <reference types="node" /> | ||
/** | ||
* Allow using connections that are not associated with the transaction. (Default: false) | ||
*/ | ||
readonly dangerouslyAllowForeignConnections: boolean; | ||
/** | ||
* Overrides the default DriverFactory. (Default: "pg" driver factory) | ||
@@ -78,0 +82,0 @@ */ |
@@ -95,3 +95,3 @@ { | ||
"types": "./dist/index.d.ts", | ||
"version": "41.0.1" | ||
"version": "41.1.0" | ||
} |
@@ -10,2 +10,3 @@ import { createClientConfiguration } from './createClientConfiguration'; | ||
connectionUri: 'postgres://', | ||
dangerouslyAllowForeignConnections: false, | ||
gracefulTerminationTimeout: 5_000, | ||
@@ -12,0 +13,0 @@ idleInTransactionSessionTimeout: 60_000, |
@@ -20,2 +20,3 @@ import { InvalidConfigurationError } from '../errors'; | ||
connectionUri, | ||
dangerouslyAllowForeignConnections: false, | ||
gracefulTerminationTimeout: 5_000, | ||
@@ -22,0 +23,0 @@ idleInTransactionSessionTimeout: 60_000, |
@@ -9,2 +9,3 @@ import { type ClientConfiguration } from '../types'; | ||
connectionUri: 'postgres://', | ||
dangerouslyAllowForeignConnections: false, | ||
gracefulTerminationTimeout: 5_000, | ||
@@ -11,0 +12,0 @@ idleInTransactionSessionTimeout: 60_000, |
@@ -49,2 +49,15 @@ /* eslint-disable id-length */ | ||
test('does not allow to reference a non-transaction connection inside of a transaction (disabled)', async (t) => { | ||
const pool = await createPool(t.context.dsn, { | ||
dangerouslyAllowForeignConnections: true, | ||
driverFactory, | ||
}); | ||
await t.notThrowsAsync( | ||
pool.transaction(async () => { | ||
await pool.query(sql.unsafe`SELECT 1`); | ||
}), | ||
); | ||
}); | ||
test('streams data', async (t) => { | ||
@@ -51,0 +64,0 @@ const pool = await createPool(t.context.dsn, { |
@@ -146,2 +146,3 @@ import { TRANSACTION_ROLLBACK_ERROR_PREFIX } from '../constants'; | ||
if ( | ||
clientConfiguration.dangerouslyAllowForeignConnections !== true && | ||
transactionStore?.transactionId && | ||
@@ -148,0 +149,0 @@ transactionStore.transactionId !== poolClientState.transactionId |
@@ -109,2 +109,6 @@ import { type SlonikError } from './errors'; | ||
/** | ||
* Allow using connections that are not associated with the transaction. (Default: false) | ||
*/ | ||
readonly dangerouslyAllowForeignConnections: boolean; | ||
/** | ||
* Overrides the default DriverFactory. (Default: "pg" driver factory) | ||
@@ -111,0 +115,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1057960
18875
2808