Skip to content

Commit 5fcc7d7

Browse files
BrandonNoaddhensby
authored andcommitted
feat!: remove config object cloning to fix TokenCredential issues
BREAKING CHANGE: Config objects are not longer cloned by the library. The objects are intended to be readonly and that no modification happens to them during the lifetime of the process, changing these values will result in undefined behaviour.
1 parent 25cc5ff commit 5fcc7d7

File tree

4 files changed

+1
-25
lines changed

4 files changed

+1
-25
lines changed

lib/base/connection-pool.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const tarn = require('tarn')
77
const { IDS } = require('../utils')
88
const ConnectionError = require('../error/connection-error')
99
const shared = require('../shared')
10-
const clone = require('rfdc/default')
1110
const { MSSQLError } = require('../error')
1211

1312
/**
@@ -53,7 +52,7 @@ class ConnectionPool extends EventEmitter {
5352
throw ex
5453
}
5554
} else {
56-
this.config = clone(config)
55+
this.config = config
5756
}
5857

5958
// set defaults

package-lock.json

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"@tediousjs/connection-string": "^0.6.0",
3838
"commander": "^11.0.0",
3939
"debug": "^4.3.3",
40-
"rfdc": "^1.3.0",
4140
"tarn": "^3.0.2",
4241
"tedious": "^19.0.0"
4342
},

test/common/unit.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,17 +343,6 @@ describe('Geography Parsing', () => {
343343
})
344344
})
345345

346-
describe('config cloning', () => {
347-
it('deeply clones configs', () => {
348-
const options = {}
349-
const pool = new BasePool({
350-
server: 'Instance\\Name',
351-
options
352-
})
353-
assert.notDeepStrictEqual(options, pool.config.options)
354-
})
355-
})
356-
357346
describe('value handlers', () => {
358347
afterEach('reset valueHandler', () => {
359348
sql.valueHandler.clear()

0 commit comments

Comments
 (0)