oracledb 6.0.1 → 6.0.2

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.
Files changed (28) hide show
  1. package/README.md +8 -7
  2. package/build/Release/oracledb-6.0.2-darwin-x64.node +0 -0
  3. package/build/Release/oracledb-6.0.2-darwin-x64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-6.0.2-js-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-6.0.2-linux-arm64.node +0 -0
  6. package/build/Release/oracledb-6.0.2-linux-arm64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.0.2-linux-x64.node-buildinfo.txt +1 -0
  8. package/build/Release/{oracledb-6.0.1-win32-x64.node → oracledb-6.0.2-win32-x64.node} +0 -0
  9. package/build/Release/oracledb-6.0.2-win32-x64.node-buildinfo.txt +1 -0
  10. package/lib/connection.js +1 -0
  11. package/lib/thin/dbObject.js +15 -3
  12. package/lib/thin/pool.js +10 -9
  13. package/lib/thin/protocol/buffer.js +4 -4
  14. package/lib/thin/protocol/encryptDecrypt.js +24 -12
  15. package/lib/thin/protocol/messages/withData.js +8 -7
  16. package/lib/thin/protocol/packet.js +11 -9
  17. package/lib/thin/sqlnet/ntTcp.js +1 -7
  18. package/lib/thin/sqlnet/paramParser.js +5 -8
  19. package/lib/version.js +1 -1
  20. package/package.json +1 -1
  21. package/build/Release/oracledb-6.0.1-darwin-x64.node +0 -0
  22. package/build/Release/oracledb-6.0.1-darwin-x64.node-buildinfo.txt +0 -1
  23. package/build/Release/oracledb-6.0.1-js-buildinfo.txt +0 -1
  24. package/build/Release/oracledb-6.0.1-linux-arm64.node +0 -0
  25. package/build/Release/oracledb-6.0.1-linux-arm64.node-buildinfo.txt +0 -1
  26. package/build/Release/oracledb-6.0.1-linux-x64.node-buildinfo.txt +0 -1
  27. package/build/Release/oracledb-6.0.1-win32-x64.node-buildinfo.txt +0 -1
  28. /package/build/Release/{oracledb-6.0.1-linux-x64.node → oracledb-6.0.2-linux-x64.node} +0 -0
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # node-oracledb version 6.0.1
1
+ # node-oracledb version 6.0.2
2
2
 
3
3
  The node-oracledb add-on for Node.js powers high performance Oracle Database
4
4
  applications. Applications can be written in TypeScript, or directly in
5
5
  JavaScript.
6
6
 
7
- Use node-oracledb 6.0.1 to connect Node.js 14.6, or later, to Oracle
7
+ Use node-oracledb 6.0.2 to connect Node.js 14.6, or later, to Oracle
8
8
  Database. Older versions of node-oracledb may work with older versions of
9
9
  Node.js.
10
10
 
@@ -20,7 +20,8 @@ See [Getting Started with Node-oracledb][1] and [Quick Start Node-oracledb Insta
20
20
 
21
21
  ## Documentation
22
22
 
23
- See [Documentation for the Oracle Database Node.js Add-on][32] and the [CHANGELOG][33].
23
+ See [Documentation for the Oracle Database Node.js Add-on][32] and the [release
24
+ notes][33].
24
25
 
25
26
  ## Examples
26
27
 
@@ -28,8 +29,8 @@ See the [examples][30] directory. Start with [examples/example.js][31].
28
29
 
29
30
  ## Help
30
31
 
31
- Issues and questions about node-oracledb can be posted on [GitHub][3] or
32
- [Slack][5] ([link to join Slack][6]).
32
+ Questions about node-oracledb can be posted on [GitHub][3] or [Slack][5] ([link
33
+ to join Slack][6]).
33
34
 
34
35
  ## <a name="testing"></a> Tests
35
36
 
@@ -74,13 +75,13 @@ limitations under the License.
74
75
 
75
76
  [1]: https://node-oracledb.readthedocs.io/en/latest/user_guide/introduction.html#getstarted
76
77
  [2]: https://node-oracledb.readthedocs.io/en/latest/user_guide/installation.html#quickstart
77
- [3]: https://github.com/oracle/node-oracledb/issues
78
+ [3]: https://github.com/oracle/node-oracledb/discussions
78
79
  [4]: https://oracle.github.io/node-oracledb
79
80
  [5]: https://node-oracledb.slack.com/
80
81
  [6]: https://join.slack.com/t/node-oracledb/shared_invite/enQtNDU4Mjc2NzM5OTA2LWMzY2ZlZDY5MDdlMGZiMGRkY2IzYjI5OGU4YTEzZWM5YjQ3ODUzMjcxNWQyNzE4MzM5YjNkYjVmNDk5OWU5NDM
81
82
  [30]: https://github.com/oracle/node-oracledb/blob/main/examples
82
83
  [31]: https://github.com/oracle/node-oracledb/blob/main/examples/example.js
83
84
  [32]: https://node-oracledb.readthedocs.io/en/latest/
84
- [33]: https://github.com/oracle/node-oracledb/blob/main/CHANGELOG.md
85
+ [33]: https://node-oracledb.readthedocs.io/en/latest/release_notes.html
85
86
  [34]: https://github.com/oracle/node-oracledb/blob/main/test/README.md
86
87
  [35]: https://github.com/oracle/node-oracledb/blob/main/CONTRIBUTING.md
@@ -0,0 +1 @@
1
+ oracledb-6.0.2-darwin-x64.node v18.16.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 15:14:06 GMT
@@ -0,0 +1 @@
1
+ 5caec79c2095133bc3d39b0e08d0d7a7952a4352
@@ -0,0 +1 @@
1
+ oracledb-6.0.2-linux-arm64.node v14.16.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 16:56:30 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.0.2-linux-x64.node v16.20.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 15:29:14 GMT
@@ -0,0 +1 @@
1
+ oracledb-6.0.2-win32-x64.node v16.19.0 5caec79c2095133bc3d39b0e08d0d7a7952a4352 ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Tue, 20 Jun 2023 15:13:50 GMT
package/lib/connection.js CHANGED
@@ -146,6 +146,7 @@ class Connection extends EventEmitter {
146
146
  cls = this._buildDbObjectClass(objType);
147
147
  cls._connection = this;
148
148
  cls._objType = objType;
149
+ objType._connection = this._impl;
149
150
  this._dbObjectClasses.set(objType, cls);
150
151
  }
151
152
  return (cls);
@@ -35,6 +35,19 @@ const { GrowableBuffer } = require('./protocol/buffer.js');
35
35
 
36
36
  class DbObjectPickleBuffer extends GrowableBuffer {
37
37
 
38
+ //---------------------------------------------------------------------------
39
+ // _readBytesWithLength()
40
+ //
41
+ // Helper function that processes the number of bytes (if needed) and then
42
+ // acquires the specified number of bytes from the buffer.
43
+ //---------------------------------------------------------------------------
44
+ _readBytesWithLength(numBytes) {
45
+ if (numBytes === constants.TNS_LONG_LENGTH_INDICATOR) {
46
+ numBytes = this.readUInt32BE();
47
+ }
48
+ return this.readBytes(numBytes);
49
+ }
50
+
38
51
  //---------------------------------------------------------------------------
39
52
  // getIsAtomicNull()
40
53
  //
@@ -354,7 +367,7 @@ class ThinDbObjectImpl extends DbObjectImpl {
354
367
  case types.DB_TYPE_NCHAR:
355
368
  return buf.readStr(constants.TNS_CS_NCHAR);
356
369
  case types.DB_TYPE_RAW:
357
- return buf.readBytesWithLength();
370
+ return Buffer.from(buf.readBytesWithLength());
358
371
  case types.DB_TYPE_BINARY_DOUBLE:
359
372
  return buf.readBinaryDouble();
360
373
  case types.DB_TYPE_BINARY_FLOAT:
@@ -365,7 +378,6 @@ class ThinDbObjectImpl extends DbObjectImpl {
365
378
  case types.DB_TYPE_TIMESTAMP_LTZ:
366
379
  case types.DB_TYPE_TIMESTAMP_TZ:
367
380
  return buf.readOracleDate(false);
368
- case types.DB_TYPE_BLOB:
369
381
  case types.DB_TYPE_BOOLEAN:
370
382
  return buf.readBool();
371
383
  case types.DB_TYPE_OBJECT:
@@ -374,7 +386,7 @@ class ThinDbObjectImpl extends DbObjectImpl {
374
386
  return null;
375
387
  obj = new ThinDbObjectImpl(typeClass);
376
388
  if (obj._objType.isCollection || this._objType.isCollection) {
377
- obj.packedData = buf.readBytesWithLength();
389
+ obj.packedData = Buffer.from(buf.readBytesWithLength());
378
390
  } else {
379
391
  obj._unpackDataFromBuf(buf);
380
392
  }
package/lib/thin/pool.js CHANGED
@@ -144,13 +144,13 @@ class ThinPoolImpl extends PoolImpl {
144
144
  }
145
145
 
146
146
  //---------------------------------------------------------------------------
147
- // get connection from pool
147
+ // credentials are obfuscated and stored in an object(userConfig) during
148
+ // pool creation. _getConnAttrs() method is used to deobfuscate encrypted
149
+ // credentials for creating new connections
148
150
  //---------------------------------------------------------------------------
149
- async _connect(connAttrs) {
151
+ async _getConnAttrs() {
150
152
  let accessToken;
151
- const conn = new ThinConnectionImpl();
152
- conn._pool = this;
153
- let clonedAttrs = Object.assign({}, connAttrs);
153
+ const clonedAttrs = Object.assign({}, this._userConfig);
154
154
  if (clonedAttrs.password === null) {
155
155
  clonedAttrs.password = protocolUtil.getDeobfuscatedValue(this._password,
156
156
  this._obfuscatedPassword);
@@ -204,9 +204,7 @@ class ThinPoolImpl extends PoolImpl {
204
204
  protocolUtil.getDeobfuscatedValue(this._privateKey,
205
205
  this._obfuscatedPrivateKey);
206
206
  }
207
- await conn.connect(clonedAttrs);
208
- clonedAttrs = null;
209
- return conn;
207
+ return clonedAttrs;
210
208
  }
211
209
 
212
210
  //---------------------------------------------------------------------------
@@ -318,8 +316,11 @@ class ThinPoolImpl extends PoolImpl {
318
316
  // Grows the pool to include the specified number of connections.
319
317
  //---------------------------------------------------------------------------
320
318
  async _growPool(numConns) {
319
+ const clonedAttrs = await this._getConnAttrs();
321
320
  while (numConns > 0) {
322
- let conn = await this._connect(this._userConfig);
321
+ const conn = new ThinConnectionImpl();
322
+ conn._pool = this;
323
+ await conn.connect(clonedAttrs);
323
324
  conn._newSession = true;
324
325
  conn._dropSess = false;
325
326
  conn._lastTimeUsed = Date.now();
@@ -375,18 +375,18 @@ class BaseBuffer {
375
375
  const obj = {};
376
376
  let numBytes = this.readUB4();
377
377
  if (numBytes > 0)
378
- obj.toid = this.readBytesWithLength();
378
+ obj.toid = Buffer.from(this.readBytesWithLength());
379
379
  numBytes = this.readUB4();
380
380
  if (numBytes > 0)
381
- obj.oid = this.readBytesWithLength();
381
+ obj.oid = Buffer.from(this.readBytesWithLength());
382
382
  numBytes = this.readUB4();
383
383
  if (numBytes > 0)
384
- obj.snapshot = this.readBytesWithLength();
384
+ obj.snapshot = Buffer.from(this.readBytesWithLength());
385
385
  this.skipUB2(); // version
386
386
  numBytes = this.readUB4();
387
387
  this.skipUB2(); // flags
388
388
  if (numBytes > 0)
389
- obj.packedData = this.readBytesWithLength();
389
+ obj.packedData = Buffer.from(this.readBytesWithLength());
390
390
  return obj;
391
391
  }
392
392
 
@@ -138,18 +138,30 @@ class EncryptDecrypt {
138
138
  if (newPassword) {
139
139
  newPasswordBytes = Buffer.from(newPassword, 'utf8');
140
140
  }
141
- let sessionKeyParta = this._decrypt(passwordHash, encodedServerKey);
142
- let sessionKeyPartb = Buffer.alloc(32);
143
- crypto.randomFillSync(sessionKeyPartb, 0, 32);
144
- let encodedClientKey = this._encrypt(passwordHash, sessionKeyPartb);
145
- authObj.sessionKey = encodedClientKey.slice().toString('hex').toUpperCase().slice(0, 64);
146
-
147
- iterations = Number(sessionData['AUTH_PBKDF2_SDER_COUNT']);
148
- let mixingSalt = Buffer.from(sessionData['AUTH_PBKDF2_CSK_SALT'], 'hex');
149
- let partABKey = Buffer.concat([sessionKeyPartb.slice(0, keyLen), sessionKeyParta.slice(0, keyLen)]);
150
- let partABKeyStr = partABKey.toString('hex').toUpperCase();
151
- let partABKeyBuffer = Buffer.from(partABKeyStr, 'utf8');
152
- authObj.comboKey = crypto.pbkdf2Sync(partABKeyBuffer, mixingSalt, iterations, keyLen, 'sha512');
141
+ const sessionKeyParta = this._decrypt(passwordHash, encodedServerKey);
142
+ const sessionKeyPartb = Buffer.alloc(sessionKeyParta.length);
143
+ crypto.randomFillSync(sessionKeyPartb);
144
+ const encodedClientKey = this._encrypt(passwordHash, sessionKeyPartb);
145
+
146
+ if (sessionKeyParta.length === 48) {
147
+ authObj.sessionKey = encodedClientKey.slice().toString('hex').toUpperCase().slice(0, 96);
148
+ const buf = Buffer.alloc(24);
149
+ for (let i = 16; i <= 40; i++) {
150
+ buf[i - 16] = sessionKeyParta[i] ^ sessionKeyPartb[i];
151
+ }
152
+ const part1 = crypto.createHash("md5").update(buf.subarray(0, 16)).digest();
153
+ const part2 = crypto.createHash("md5").update(buf.subarray(16)).digest();
154
+ authObj.comboKey = Buffer.concat([part1, part2]).slice(0, keyLen);
155
+ } else {
156
+ authObj.sessionKey = encodedClientKey.slice().toString('hex').toUpperCase().slice(0, 64);
157
+ const mixingSalt = Buffer.from(sessionData['AUTH_PBKDF2_CSK_SALT'], 'hex');
158
+ iterations = Number(sessionData['AUTH_PBKDF2_SDER_COUNT']);
159
+ const partABKey = Buffer.concat([sessionKeyPartb.slice(0, keyLen), sessionKeyParta.slice(0, keyLen)]);
160
+ const partABKeyStr = partABKey.toString('hex').toUpperCase();
161
+ const partABKeyBuffer = Buffer.from(partABKeyStr, 'utf8');
162
+ authObj.comboKey = crypto.pbkdf2Sync(partABKeyBuffer, mixingSalt,
163
+ iterations, keyLen, 'sha512');
164
+ }
153
165
 
154
166
  let salt = Buffer.alloc(16);
155
167
  if (!verifier11G) {
@@ -173,7 +173,7 @@ class MessageWithData extends Message {
173
173
  let oid;
174
174
  let numBytes = buf.readUB4(); // OID
175
175
  if (numBytes > 0) {
176
- oid = buf.readBytesWithLength();
176
+ oid = Buffer.from(buf.readBytesWithLength());
177
177
  }
178
178
  buf.skipUB2(); // version
179
179
  buf.skipUB2(); // character set id
@@ -316,10 +316,11 @@ class MessageWithData extends Message {
316
316
  processIOVector(buf) {
317
317
  let numBytes;
318
318
  buf.skipUB1(); // flag
319
- const numBinds = buf.readUB2(); // num requests
320
- this.rowIndex = buf.readUB4(); // iter num
319
+ const temp16 = buf.readUB2(); // num requests
320
+ const temp32 = buf.readUB4(); // iter num
321
+ const numBinds = temp32 * 256 + temp16;
321
322
  buf.skipUB4(); // num iters this time
322
- buf.readUB2(); // uac buffer length
323
+ buf.skipUB2(); // uac buffer length
323
324
  numBytes = buf.readUB2(); // bit vector for fast fetch
324
325
  if (numBytes > 0) {
325
326
  buf.skipBytes(numBytes);
@@ -378,7 +379,7 @@ class MessageWithData extends Message {
378
379
  const useLocalTime = (oraTypeNum === constants.TNS_DATA_TYPE_DATE ||
379
380
  oraTypeNum === constants.TNS_DATA_TYPE_TIMESTAMP);
380
381
  colValue = buf.readOracleDate(useLocalTime);
381
- } else if (oraTypeNum === constants.TNS_DATA_TYPE_ROWID) {
382
+ } else if (oraTypeNum === constants.TNS_DATA_TYPE_ROWID) {
382
383
  if (!this.inFetch) {
383
384
  colValue = buf.readStr(constants.TNS_CS_IMPLICIT);
384
385
  } else {
@@ -563,7 +564,7 @@ class MessageWithData extends Message {
563
564
 
564
565
  if (this.statement.isQuery) {
565
566
  this.inFetch = true;
566
- if (this.statement.queryVars) {
567
+ if (this.statement.queryVars) {
567
568
  this.outVariables = [];
568
569
  for (let i = 0; i < this.statement.queryVars.length; i++) {
569
570
  this.outVariables.push(this.statement.queryVars[i]);
@@ -582,7 +583,7 @@ class MessageWithData extends Message {
582
583
  }
583
584
 
584
585
  getBitVector(buf, numBytes) {
585
- this.bitVector = buf.readBytes(numBytes);
586
+ this.bitVector = Buffer.from(buf.readBytes(numBytes));
586
587
  }
587
588
 
588
589
  processBindParams(buf, params) {
@@ -220,12 +220,17 @@ class ReadPacket extends BaseBuffer {
220
220
  }
221
221
 
222
222
  // the requested bytes are split across multiple packets; if a chunked read
223
- // is not in progress one is implicitly started; copy the bytes from the
224
- // end of this packet
225
- if (!inChunkedRead) {
226
- this.chunkedBytesBuf.startChunkedRead();
223
+ // is in progress, a chunk is acquired that will accommodate the requested
224
+ // bytes; otherwise, a separate buffer will be allocated to accommodate the
225
+ // requested bytes
226
+ let buf;
227
+ if (inChunkedRead) {
228
+ buf = this.chunkedBytesBuf.getBuf(numBytes);
229
+ } else {
230
+ buf = Buffer.alloc(numBytes);
227
231
  }
228
- const buf = this.chunkedBytesBuf.getBuf(numBytes);
232
+
233
+ // copy the bytes to the buffer from the remainder of this packet
229
234
  let offset = 0;
230
235
  this.buf.copy(buf, offset, this.pos, this.pos + numBytesLeft);
231
236
  offset += numBytesLeft;
@@ -241,10 +246,7 @@ class ReadPacket extends BaseBuffer {
241
246
  numBytes -= numSplitBytes;
242
247
  }
243
248
 
244
- // if not in a chunked bytes read, return the buffer directly
245
- if (!inChunkedRead) {
246
- return this.chunkedBytesBuf.endChunkedRead();
247
- }
249
+ return buf;
248
250
 
249
251
  }
250
252
 
@@ -352,13 +352,7 @@ class NTTCP {
352
352
  async pauseWrite() {
353
353
  this.checkErr();
354
354
  if (this.needsDrain) {
355
- await new Promise((resolve) => {
356
- this.waiter = resolve;
357
- this.stream.once('drain', () => {
358
- resolve();
359
- this.waiter = null;
360
- });
361
- });
355
+ await new Promise((resolve) => this.stream.once('drain', resolve));
362
356
  this.checkErr();
363
357
  } else {
364
358
  await new Promise((resolve) => Timers.setImmediate(resolve));
@@ -163,22 +163,19 @@ class NLParamParser {
163
163
  let res = ibuf.split(/\r?\n/).filter(element => element);
164
164
  for (let i = 0; i < res.length; i++) {
165
165
  if (res[i].charAt(0) != '(') {
166
- res[i] = '(' + res[i];
167
- }
168
- if (res[i].charAt(res[i].length - 1 != ')')) {
169
- res[i] = res[i] + ')';
166
+ res[i] = '(' + res[i] + ')';
170
167
  }
171
168
  let nvp = createNVPair(res[i]);
172
169
  let name = nvp.name;
173
170
  let uname = name.toUpperCase();
174
171
  nvp.name = uname;
175
- this.add_NLPListElement(uname, nvp);
172
+ const unames = uname.split(","); //multiple aliases (alias1, alias2, alias3)
173
+ for (let i = 0; i < unames.length; i++) {
174
+ this.ht.set(unames[i], nvp);
175
+ }
176
176
  }
177
177
  }
178
178
 
179
- add_NLPListElement(name, value) {
180
- this.ht.set(name, value);
181
- }
182
179
 
183
180
  toString() {
184
181
  let out = "";
package/lib/version.js CHANGED
@@ -31,6 +31,6 @@
31
31
  module.exports = {
32
32
  VERSION_MAJOR: 6,
33
33
  VERSION_MINOR: 0,
34
- VERSION_PATCH: 1,
34
+ VERSION_PATCH: 2,
35
35
  VERSION_SUFFIX: ''
36
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oracledb",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "A Node.js module for Oracle Database access from JavaScript and TypeScript",
5
5
  "license": "(Apache-2.0 OR UPL-1.0)",
6
6
  "homepage": "http://oracle.github.io/node-oracledb/",
@@ -1 +0,0 @@
1
- oracledb-6.0.1-darwin-x64.node v16.20.0 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Fri, 02 Jun 2023 22:13:14 GMT
@@ -1 +0,0 @@
1
- 628884c63240a6680e2dd5a9ff5006cbf373348f
@@ -1 +0,0 @@
1
- oracledb-6.0.1-linux-arm64.node v16.19.1 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Fri, 02 Jun 2023 16:31:07 GMT
@@ -1 +0,0 @@
1
- oracledb-6.0.1-linux-x64.node v16.20.0 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Sat, 03 Jun 2023 06:55:38 GMT
@@ -1 +0,0 @@
1
- oracledb-6.0.1-win32-x64.node v16.19.0 628884c63240a6680e2dd5a9ff5006cbf373348f ccbaddf0256153ecfa6702c6ae1a4e5003e3775e Fri, 02 Jun 2023 16:39:59 GMT