oracledb 5.2.0 → 5.5.0

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 (39) hide show
  1. package/CHANGELOG.md +145 -48
  2. package/LICENSE.txt +443 -0
  3. package/NOTICE.txt +1 -0
  4. package/README.md +7 -4
  5. package/THIRD_PARTY_LICENSES.txt +52 -0
  6. package/build/Release/oracledb-5.5.0-darwin-x64.node +0 -0
  7. package/build/Release/oracledb-5.5.0-darwin-x64.node-buildinfo.txt +1 -0
  8. package/build/Release/oracledb-5.5.0-linux-x64.node +0 -0
  9. package/build/Release/oracledb-5.5.0-linux-x64.node-buildinfo.txt +1 -0
  10. package/build/Release/oracledb-5.5.0-win32-x64.node +0 -0
  11. package/build/Release/oracledb-5.5.0-win32-x64.node-buildinfo.txt +1 -0
  12. package/lib/aqDeqOptions.js +1 -1
  13. package/lib/aqEnqOptions.js +1 -1
  14. package/lib/aqMessage.js +1 -1
  15. package/lib/aqQueue.js +1 -1
  16. package/lib/connection.js +173 -2
  17. package/lib/dbObject.js +1 -1
  18. package/lib/lob.js +1 -1
  19. package/lib/oracledb.js +160 -6
  20. package/lib/pool.js +47 -82
  21. package/lib/poolStatistics.js +124 -0
  22. package/lib/queryStream.js +8 -6
  23. package/lib/resultset.js +14 -1
  24. package/lib/sodaCollection.js +1 -1
  25. package/lib/sodaDatabase.js +1 -1
  26. package/lib/sodaDocCursor.js +1 -1
  27. package/lib/sodaDocument.js +1 -1
  28. package/lib/sodaOperation.js +1 -1
  29. package/lib/util.js +25 -4
  30. package/package/install.js +1 -1
  31. package/package/prunebinaries.js +1 -1
  32. package/package.json +2 -2
  33. package/LICENSE.md +0 -2485
  34. package/build/Release/oracledb-5.2.0-darwin-x64.node +0 -0
  35. package/build/Release/oracledb-5.2.0-darwin-x64.node-buildinfo.txt +0 -1
  36. package/build/Release/oracledb-5.2.0-linux-x64.node +0 -0
  37. package/build/Release/oracledb-5.2.0-linux-x64.node-buildinfo.txt +0 -1
  38. package/build/Release/oracledb-5.2.0-win32-x64.node +0 -0
  39. package/build/Release/oracledb-5.2.0-win32-x64.node-buildinfo.txt +0 -1
@@ -0,0 +1,124 @@
1
+ // Copyright (c) 2021, 2022, Oracle and/or its affiliates.
2
+ //-----------------------------------------------------------------------------
3
+ //
4
+ // You may not use the identified files except in compliance with the Apache
5
+ // License, Version 2.0 (the "License.")
6
+ //
7
+ // You may obtain a copy of the License at
8
+ // http://www.apache.org/licenses/LICENSE-2.0.
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ //-----------------------------------------------------------------------------
18
+
19
+ 'use strict';
20
+
21
+ //-----------------------------------------------------------------------------
22
+ // class PoolStatistics
23
+ // collection of statistics metrics for Pool object
24
+ //-----------------------------------------------------------------------------
25
+
26
+ class PoolStatistics {
27
+
28
+ constructor(pool) {
29
+ let averageTimeInQueue = 0;
30
+
31
+ if (pool._totalRequestsEnqueued !== 0) {
32
+ averageTimeInQueue = Math.round(pool._totalTimeInQueue /
33
+ pool._totalRequestsEnqueued);
34
+ }
35
+
36
+ this.gatheredDate = Date.now ();
37
+ this.upTime = this.gatheredDate - pool._createdDate;
38
+ this.upTimeSinceReset = this.gatheredDate - pool._timeOfReset;
39
+ this.connectionRequests = pool._totalConnectionRequests;
40
+ this.requestsEnqueued = pool._totalRequestsEnqueued;
41
+ this.requestsDequeued = pool._totalRequestsDequeued;
42
+ this.failedRequests = pool._totalFailedRequests;
43
+ this.rejectedRequests = pool._totalRequestsRejected;
44
+ this.requestTimeouts = pool._totalRequestTimeouts;
45
+ this.maximumQueueLength = pool._maximumQueueLength;
46
+ this.currentQueueLength = pool._connRequestQueue.length;
47
+ this.timeInQueue = pool._totalTimeInQueue;
48
+ this.minimumTimeInQueue = pool._minTimeInQueue;
49
+ this.maximumTimeInQueue = pool._maxTimeInQueue;
50
+ this.averageTimeInQueue = averageTimeInQueue;
51
+ this.connectionsInUse = pool.connectionsInUse;
52
+ this.connectionsOpen = pool.connectionsOpen;
53
+ this.connectString = pool.connectString;
54
+ this.edition = pool.edition;
55
+ this.events = pool.events;
56
+ this.externalAuth = pool.externalAuth;
57
+ this.homogeneous = pool.homogeneous;
58
+ this.poolAlias = pool.poolAlias;
59
+ this.poolIncrement = pool.poolIncrement;
60
+ this.poolMax = pool.poolMax;
61
+ this.poolMaxPerShard = pool.poolMaxPerShard;
62
+ this.poolMin = pool.poolMin;
63
+ this.poolPingInterval = pool.poolPingInterval;
64
+ this.poolTimeout = pool.poolTimeout;
65
+ this.queueMax = pool.queueMax;
66
+ this.queueTimeout = pool.queueTimeout;
67
+ this.sodaMetaDataCache = pool.sodaMetaDataCache;
68
+ this.stmtCacheSize = pool.stmtCacheSize;
69
+ this.user = pool.user;
70
+ this.threadPoolSize = process.env.UV_THREADPOOL_SIZE;
71
+ }
72
+
73
+ //---------------------------------------------------------------------------
74
+ // logStatistics()
75
+ // To print the statistics metrics of the pool
76
+ //---------------------------------------------------------------------------
77
+ logStatistics() {
78
+ console.log('\nPool statistics:');
79
+ console.log('...gathered at:', new Date(this.gatheredDate).toISOString());
80
+ console.log('...up time (milliseconds):', this.upTime);
81
+ console.log('...up time from last reset (milliseconds)',
82
+ this.upTimeSinceReset);
83
+ console.log('...connection requests:', this.connectionRequests);
84
+ console.log('...requests enqueued:', this.requestsEnqueued);
85
+ console.log('...requests dequeued:', this.requestsDequeued);
86
+ console.log('...requests failed:', this.failedRequests);
87
+ console.log('...requests exceeding queueMax:', this.rejectedRequests);
88
+ console.log('...requests exceeding queueTimeout:', this.requestTimeouts);
89
+ console.log('...current queue length:', this.currentQueueLength);
90
+ console.log('...maximum queue length:', this.maximumQueueLength);
91
+ console.log('...sum of time in queue (milliseconds):', this.timeInQueue);
92
+ console.log('...minimum time in queue (milliseconds):',
93
+ this.minimumTimeInQueue);
94
+ console.log('...maximum time in queue (milliseconds):',
95
+ this.maximumTimeInQueue);
96
+ console.log('...average time in queue (milliseconds):',
97
+ this.averageTimeInQueue);
98
+ console.log('...pool connections in use:', this.connectionsInUse);
99
+ console.log('...pool connections open:', this.connectionsOpen);
100
+ console.log('Pool attributes:');
101
+ console.log('...connectString:', this.connectString);
102
+ console.log('...edition:', this.edition);
103
+ console.log('...events:', this.events);
104
+ console.log('...externalAuth:', this.externalAuth);
105
+ console.log('...homogeneous:', this.homogeneous);
106
+ console.log('...poolAlias:', this.poolAlias);
107
+ console.log('...poolIncrement:', this.poolIncrement);
108
+ console.log('...poolMax:', this.poolMax);
109
+ console.log('...poolMaxPerShard:', this.poolMaxPerShard);
110
+ console.log('...poolMin:', this.poolMin);
111
+ console.log('...poolPingInterval (seconds):', this.poolPingInterval);
112
+ console.log('...poolTimeout (seconds):', this.poolTimeout);
113
+ console.log('...queueMax:', this.queueMax);
114
+ console.log('...queueTimeout (milliseconds):', this.queueTimeout);
115
+ console.log('...sessionCallback:', this.sessionCallback);
116
+ console.log('...sodaMetaDataCache:', this.sodaMetaDataCache);
117
+ console.log('...stmtCacheSize:', this.stmtCacheSize);
118
+ console.log('...user:', this.user);
119
+ console.log('Related environment variables:');
120
+ console.log('...UV_THREADPOOL_SIZE:', this.threadPoolSize);
121
+ }
122
+ }
123
+
124
+ module.exports = PoolStatistics;
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2015, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -89,11 +89,6 @@ class QueryStream extends Readable {
89
89
  this._fetching = true;
90
90
  this._resultSet._allowGetRowCall = true;
91
91
  const row = await this._resultSet.getRow();
92
- this._fetching = false;
93
- if (!this._resultSet) {
94
- this.emit('_doneFetching');
95
- return;
96
- }
97
92
  if (row) {
98
93
  this.push(row);
99
94
  } else {
@@ -101,6 +96,13 @@ class QueryStream extends Readable {
101
96
  }
102
97
  } catch (err) {
103
98
  this.destroy(err);
99
+ } finally {
100
+ this._fetching = false;
101
+ if (this._resultSet) {
102
+ this._resultSet._allowGetRowCall = false;
103
+ } else {
104
+ this.emit('_doneFetching');
105
+ }
104
106
  }
105
107
  }
106
108
 
package/lib/resultset.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2016, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -225,6 +225,19 @@ class ResultSet {
225
225
  return this._connection._getDbObjectClassJS(schema, name);
226
226
  }
227
227
 
228
+ [Symbol.asyncIterator]() {
229
+ const resultSet = this;
230
+ return {
231
+ async next() {
232
+ const row = await resultSet.getRow();
233
+ return {value: row, done: row === undefined};
234
+ },
235
+ return() {
236
+ return {done: true};
237
+ }
238
+ };
239
+ }
240
+
228
241
  toQueryStream() {
229
242
  nodbUtil.checkArgCount(arguments, 0, 0);
230
243
 
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2018, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2018, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2018, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2018, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2018, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
package/lib/util.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved
1
+ // Copyright (c) 2016, 2022, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -66,7 +66,12 @@ const errorMessages = {
66
66
  'NJS-076': 'NJS-076: connection request rejected. Pool queue length queueMax %d reached',
67
67
  'NJS-081': 'NJS-081: concurrent operations on a connection are disabled',
68
68
  'NJS-082': 'NJS-082: connection pool is being reconfigured',
69
- 'NJS-083': 'NJS-083: pool statistics not enabled'
69
+ 'NJS-083': 'NJS-083: pool statistics not enabled',
70
+ 'NJS-084': 'NJS-084: invalid access token',
71
+ 'NJS-085': 'NJS-085: invalid connection pool configuration with token based authentication. The homogeneous and externalAuth attributes must be set to true',
72
+ 'NJS-086': 'NJS-086: invalid standalone configuration with token based authentication. The externalAuth attribute must be set to true',
73
+ 'NJS-087': 'NJS-087: access token has expired',
74
+ 'NJS-088': 'NJS-088: accessTokenCallback cannot be specified when accessToken is a function'
70
75
  };
71
76
 
72
77
  // getInstallURL returns a string with installation URL
@@ -170,12 +175,15 @@ module.exports.checkArgCount = checkArgCount;
170
175
  // is resolved or rejected and the callback invoked; otherwise, the function is
171
176
  // called unchanged and a promise is returned
172
177
  function callbackify(func) {
173
- return function() {
178
+ const wrapper = function() {
174
179
 
175
180
  // if last argument is not a function, simply invoke the function as usual
176
181
  // and a promise will be returned
177
182
  if (typeof arguments[arguments.length - 1] !== 'function') {
178
- return func.apply(this, arguments);
183
+ return func.apply(this, arguments).catch(function stackCapture(e) {
184
+ Error.captureStackTrace(e, stackCapture);
185
+ throw e;
186
+ });
179
187
  }
180
188
 
181
189
  // otherwise, resolve or reject the promise and invoke the callback
@@ -186,6 +194,10 @@ function callbackify(func) {
186
194
  }, cb);
187
195
 
188
196
  };
197
+ if (func.name) {
198
+ Object.defineProperty(wrapper, 'name', { value: func.name });
199
+ }
200
+ return wrapper;
189
201
  }
190
202
 
191
203
  module.exports.callbackify = callbackify;
@@ -245,4 +257,13 @@ function isSodaDocument(value) {
245
257
  return (value != null && value._sodaDocumentMarker);
246
258
  }
247
259
 
260
+ function isXid(value) {
261
+ return (isObject(value) &&
262
+ (value.formatId !== undefined) &&
263
+ (value.globalTransactionId !== undefined) &&
264
+ (value.branchQualifier !== undefined));
265
+ }
266
+
267
+ module.exports.isXid = isXid;
268
+
248
269
  module.exports.isSodaDocument = isSodaDocument;
@@ -1,4 +1,4 @@
1
- /* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */
1
+ /* Copyright (c) 2017, 2022, Oracle and/or its affiliates. */
2
2
 
3
3
  /******************************************************************************
4
4
  *
@@ -1,4 +1,4 @@
1
- /* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. */
1
+ /* Copyright (c) 2019, 2022, Oracle and/or its affiliates. */
2
2
 
3
3
  /******************************************************************************
4
4
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oracledb",
3
- "version": "5.2.0",
4
- "description": "A Node.js module for Oracle Database access",
3
+ "version": "5.5.0",
4
+ "description": "A Node.js module for Oracle Database access from JavaScript and TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "http://oracle.github.io/node-oracledb/",
7
7
  "keywords": [