oracledb 5.5.0 → 6.0.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 (107) hide show
  1. package/CHANGELOG.md +1 -1875
  2. package/LICENSE.txt +8 -222
  3. package/NOTICE.txt +1 -1
  4. package/README.md +38 -30
  5. package/SECURITY.md +38 -0
  6. package/build/Release/oracledb-6.0.0-darwin-x64.node +0 -0
  7. package/build/Release/oracledb-6.0.0-darwin-x64.node-buildinfo.txt +1 -0
  8. package/build/Release/oracledb-6.0.0-js-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.0.0-linux-arm64.node +0 -0
  10. package/build/Release/oracledb-6.0.0-linux-arm64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.0.0-linux-x64.node +0 -0
  12. package/build/Release/oracledb-6.0.0-linux-x64.node-buildinfo.txt +1 -0
  13. package/build/Release/oracledb-6.0.0-win32-x64.node +0 -0
  14. package/build/Release/oracledb-6.0.0-win32-x64.node-buildinfo.txt +1 -0
  15. package/examples/README.md +113 -0
  16. package/examples/dbconfig.js +100 -0
  17. package/examples/example.js +156 -0
  18. package/index.js +26 -0
  19. package/lib/aqDeqOptions.js +146 -7
  20. package/lib/aqEnqOptions.js +59 -7
  21. package/lib/aqMessage.js +118 -7
  22. package/lib/aqQueue.js +242 -53
  23. package/lib/connection.js +1324 -465
  24. package/lib/constants.js +203 -0
  25. package/lib/dbObject.js +346 -32
  26. package/lib/errors.js +781 -0
  27. package/lib/impl/aqDeqOptions.js +197 -0
  28. package/lib/impl/aqEnqOptions.js +89 -0
  29. package/lib/impl/aqMessage.js +134 -0
  30. package/lib/impl/aqQueue.js +81 -0
  31. package/lib/impl/connection.js +529 -0
  32. package/lib/impl/dbObject.js +159 -0
  33. package/lib/impl/index.js +59 -0
  34. package/lib/impl/lob.js +85 -0
  35. package/lib/impl/pool.js +195 -0
  36. package/lib/impl/resultset.js +223 -0
  37. package/lib/impl/sodaCollection.js +174 -0
  38. package/lib/impl/sodaDatabase.js +81 -0
  39. package/lib/impl/sodaDocCursor.js +63 -0
  40. package/lib/impl/sodaDocument.js +98 -0
  41. package/lib/impl/sodaOperation.js +109 -0
  42. package/lib/lob.js +156 -68
  43. package/lib/oracledb.js +1047 -345
  44. package/lib/pool.js +654 -465
  45. package/lib/poolStatistics.js +23 -9
  46. package/lib/queryStream.js +14 -7
  47. package/lib/resultset.js +291 -183
  48. package/lib/settings.js +191 -0
  49. package/lib/sodaCollection.js +214 -201
  50. package/lib/sodaDatabase.js +107 -71
  51. package/lib/sodaDocCursor.js +44 -32
  52. package/lib/sodaDocument.js +76 -14
  53. package/lib/sodaOperation.js +131 -118
  54. package/lib/thin/connection.js +1038 -0
  55. package/lib/thin/dbObject.js +629 -0
  56. package/lib/thin/index.js +40 -0
  57. package/lib/thin/lob.js +188 -0
  58. package/lib/thin/pool.js +481 -0
  59. package/lib/thin/protocol/buffer.js +1040 -0
  60. package/lib/thin/protocol/capabilities.js +116 -0
  61. package/lib/thin/protocol/constants.js +764 -0
  62. package/lib/thin/protocol/encryptDecrypt.js +185 -0
  63. package/lib/thin/protocol/messages/auth.js +348 -0
  64. package/lib/thin/protocol/messages/base.js +475 -0
  65. package/lib/thin/protocol/messages/commit.js +56 -0
  66. package/lib/thin/protocol/messages/dataType.js +382 -0
  67. package/lib/thin/protocol/messages/execute.js +312 -0
  68. package/lib/thin/protocol/messages/fetch.js +60 -0
  69. package/lib/thin/protocol/messages/index.js +53 -0
  70. package/lib/thin/protocol/messages/lobOp.js +200 -0
  71. package/lib/thin/protocol/messages/logOff.js +53 -0
  72. package/lib/thin/protocol/messages/ping.js +56 -0
  73. package/lib/thin/protocol/messages/protocol.js +78 -0
  74. package/lib/thin/protocol/messages/rollback.js +56 -0
  75. package/lib/thin/protocol/messages/sessionRelease.js +60 -0
  76. package/lib/thin/protocol/messages/withData.js +811 -0
  77. package/lib/thin/protocol/oson.js +660 -0
  78. package/lib/thin/protocol/packet.js +520 -0
  79. package/lib/thin/protocol/protocol.js +202 -0
  80. package/lib/thin/protocol/utils.js +88 -0
  81. package/lib/thin/resultSet.js +122 -0
  82. package/lib/thin/sqlnet/connStrategy.js +175 -0
  83. package/lib/thin/sqlnet/constants.js +199 -0
  84. package/lib/thin/sqlnet/ezConnectResolver.js +488 -0
  85. package/lib/thin/sqlnet/navNodes.js +870 -0
  86. package/lib/thin/sqlnet/networkSession.js +620 -0
  87. package/lib/thin/sqlnet/ntTcp.js +525 -0
  88. package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
  89. package/lib/thin/sqlnet/packet.js +405 -0
  90. package/lib/thin/sqlnet/paramParser.js +205 -0
  91. package/lib/thin/sqlnet/sessionAtts.js +160 -0
  92. package/lib/thin/statement.js +301 -0
  93. package/lib/thin/util.js +289 -0
  94. package/lib/transformer.js +250 -0
  95. package/lib/types.js +357 -0
  96. package/lib/util.js +194 -110
  97. package/lib/version.js +36 -0
  98. package/package/README.md +33 -30
  99. package/package/install.js +89 -64
  100. package/package/prunebinaries.js +60 -12
  101. package/package.json +3 -3
  102. package/build/Release/oracledb-5.5.0-darwin-x64.node +0 -0
  103. package/build/Release/oracledb-5.5.0-darwin-x64.node-buildinfo.txt +0 -1
  104. package/build/Release/oracledb-5.5.0-linux-x64.node +0 -0
  105. package/build/Release/oracledb-5.5.0-linux-x64.node-buildinfo.txt +0 -1
  106. package/build/Release/oracledb-5.5.0-win32-x64.node +0 -0
  107. package/build/Release/oracledb-5.5.0-win32-x64.node-buildinfo.txt +0 -1
@@ -1,17 +1,24 @@
1
- /* Copyright (c) 2017, 2022, Oracle and/or its affiliates. */
1
+ /* Copyright (c) 2017, 2023, Oracle and/or its affiliates. */
2
2
 
3
3
  /******************************************************************************
4
4
  *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
5
+ * This software is dual-licensed to you under the Universal Permissive License
6
+ * (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ * 2.0 as shown at https://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ * either license.
7
9
  *
10
+ * If you elect to accept the software under the Apache License, Version 2.0,
11
+ * the following applies:
12
+ *
13
+ * Licensed under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License.
8
15
  * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
16
  *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * https://www.apache.org/licenses/LICENSE-2.0
14
18
  *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
22
  * See the License for the specific language governing permissions and
16
23
  * limitations under the License.
17
24
  *
@@ -20,10 +27,12 @@
20
27
  *
21
28
  * DESCRIPTION
22
29
  * This script is included in the npm bundle of node-oracledb. It
23
- * is invoked by package.json during npm install.
30
+ * is invoked by package.json during npm install to check the viability
31
+ * of the installation.
24
32
  *
25
33
  * MAINTENANCE NOTES
26
- * This file should only ever 'require' packages included in core Node.js.
34
+ * This file should only ever 'require' packages included in core Node.js
35
+ * or that are part of node-oracledb.
27
36
  *
28
37
  *****************************************************************************/
29
38
 
@@ -31,6 +40,12 @@
31
40
 
32
41
  const fs = require('fs');
33
42
  const nodbUtil = require('../lib/util.js');
43
+ const errors = require('../lib/errors.js');
44
+ const constants = require('../lib/constants.js');
45
+
46
+ let installUrl = constants.DEFAULT_ERROR_URL;
47
+ let arch;
48
+ let thickModeErrMsg;
34
49
 
35
50
  // Log standard output with an 'oracledb' prefix
36
51
  function log(message) { // eslint-disable-line
@@ -46,67 +61,77 @@ function error(message) { // eslint-disable-line
46
61
  console.error.apply(console, args);
47
62
  }
48
63
 
49
- // Print concluding messages and quit
50
- function done(err) {
51
- let installUrl = 'https://oracle.github.io/node-oracledb/INSTALL.html';
64
+ // Log warnings. It combines 'oracledb' with a stylized 'WARN' prefix
65
+ function warn(message) { // eslint-disable-line
66
+ const args = Array.from(arguments);
67
+ args.unshift('oracledb \x1b[31mWARN!\x1b[0m');
68
+ console.error.apply(console, args);
69
+ }
52
70
 
53
- if (err) { // Couldn't install the binary
54
- error(err.message);
55
- if (err.message.match(/^NJS-067/)) {
56
- error('Try compiling node-oracledb source code using ' + installUrl + '#github');
57
- } else if (err.message.match(/^NJS-069/)) {
58
- error('An older node-oracledb version may work with Node.js ' + process.version);
59
- }
60
- process.exit(87);
61
- } else { // Successfully installed
62
- let arch;
71
+ // This version of node-oracledb works with Node.js 14.6 or later.
72
+ // Note: the checked version is the minimum required for Node-API
73
+ // compatibility. When new Node.js versions are released, older Node.js
74
+ // versions are dropped from the node-oracledb test plan.
75
+ //
76
+ // Keep this code in sync with lib/oracledb.js
77
+ function checkVersion() {
78
+ const vs = process.version.substring(1).split(".").map(Number);
79
+ errors.assert(vs[0] > 14 || (vs[0] === 14 && vs[1] >= 6),
80
+ errors.ERR_NODE_TOO_OLD, nodbUtil.PACKAGE_JSON_VERSION, "14.6");
81
+ }
63
82
 
64
- if (process.arch === 'x64') {
65
- arch = '64-bit';
66
- } else {
67
- arch = '32-bit';
68
- }
83
+ // Check for the binary node-oracledb module needed for "Thick mode".
84
+ // If one isn't available, only Thin mode can be used.
85
+ function checkThickMode() {
86
+ try {
87
+ fs.statSync(nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE);
88
+ } catch (err) {
89
+ errors.throwErr(errors.ERR_NO_BINARY_AVAILABLE, process.platform + ' ' + process.arch);
90
+ }
91
+ }
69
92
 
70
- if (process.platform === 'linux') {
71
- installUrl += '#linuxinstall';
72
- } else if (process.platform === 'darwin') {
73
- installUrl += '#instosx';
74
- } else if (process.platform === 'win32') {
75
- installUrl += '#windowsinstallation';
76
- }
93
+ try {
94
+ checkVersion();
95
+ } catch (err) {
96
+ // This version of Node.js is too old
97
+ error(err.message);
98
+ error('An older node-oracledb version may work with Node.js ' + process.version);
99
+ process.exit(87);
100
+ }
77
101
 
78
- log('********************************************************************************');
79
- log('** Node-oracledb ' + nodbUtil.PACKAGE_JSON_VERSION + ' installed in Node.js ' + process.versions.node + ' (' + process.platform + ', ' + process.arch + ')');
80
- log('**');
81
- log('** To use node-oracledb:');
82
- log('** - Oracle Client libraries (' + arch + ') must be available.');
83
- log('** - Follow the installation instructions:');
84
- log('** ' + installUrl);
85
- log('********************************************************************************\n');
86
- }
102
+ try {
103
+ checkThickMode();
104
+ } catch (err) {
105
+ // No Thick mode binary was found for this platform
106
+ thickModeErrMsg = err.message;
87
107
  }
88
108
 
89
- // Check for a usable binary file for the node-oracledb module. Node.js 8.16
90
- // and 10.16 (and 12.0) contain an important Node-API performance regression fix.
91
- // Note that the checked versions are the minimum required for Node-API
92
- // compatibility; as new Node.js versions are released, older Node.js versions
93
- // are dropped from the node-oracledb test plan. For example, the obsolete
94
- // Node.js 9 and 11 versions are not tested.
109
+ // Successfully installed
95
110
 
96
- function checkAvailable(cb) {
97
- let vs = process.version.substring(1).split(".").map(Number);
98
- if (vs[0] < 8 || (vs[0] === 8 && vs[1] < 16)) {
99
- cb(new Error(nodbUtil.getErrorMessage('NJS-069', nodbUtil.PACKAGE_JSON_VERSION, "8.16")));
100
- } else if (vs[0] === 10 && vs[1] < 16) {
101
- cb(new Error(nodbUtil.getErrorMessage('NJS-069', nodbUtil.PACKAGE_JSON_VERSION, "10.16")));
102
- } else {
103
- try {
104
- fs.statSync(nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE);
105
- cb();
106
- } catch (err) {
107
- cb(new Error(nodbUtil.getErrorMessage('NJS-067', process.platform + ' ' + process.arch)));
108
- }
109
- }
111
+ if (process.arch === 'x64' || process.arch === 'arm64') {
112
+ arch = '64-bit';
113
+ } else {
114
+ arch = '32-bit';
115
+ }
116
+
117
+ if (process.platform === 'linux') {
118
+ installUrl += '#node-oracledb-installation-on-linux';
119
+ } else if (process.platform === 'darwin') {
120
+ installUrl += '#node-oracledb-installation-on-apple-macos-intel-x86';
121
+ } else if (process.platform === 'win32') {
122
+ installUrl += '#node-oracledb-installation-on-microsoft-windowsstallation';
110
123
  }
111
124
 
112
- checkAvailable(done);
125
+ log('********************************************************************************');
126
+ log('** Node-oracledb ' + nodbUtil.PACKAGE_JSON_VERSION + ' installed in Node.js ' + process.versions.node + ' (' + process.platform + ', ' + process.arch + ')');
127
+ log('** To use node-oracledb in Thin mode, no additional steps are needed.');
128
+ if (thickModeErrMsg) {
129
+ warn(thickModeErrMsg);
130
+ warn('If you want to use the optional Thick mode, compile node-oracledb code using');
131
+ warn(installUrl + '#github');
132
+ } else {
133
+ log('** To use the optional Thick mode, the Oracle Client libraries (' + arch + ')');
134
+ log('** must be available, see the installation instructions:');
135
+ log('** ' + installUrl);
136
+ }
137
+ log('********************************************************************************\n');
@@ -1,17 +1,24 @@
1
- /* Copyright (c) 2019, 2022, Oracle and/or its affiliates. */
1
+ /* Copyright (c) 2019, 2023, Oracle and/or its affiliates. */
2
2
 
3
3
  /******************************************************************************
4
4
  *
5
- * You may not use the identified files except in compliance with the Apache
6
- * License, Version 2.0 (the "License.")
5
+ * This software is dual-licensed to you under the Universal Permissive License
6
+ * (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ * 2.0 as shown at https://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ * either license.
7
9
  *
10
+ * If you elect to accept the software under the Apache License, Version 2.0,
11
+ * the following applies:
12
+ *
13
+ * Licensed under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License.
8
15
  * You may obtain a copy of the License at
9
- * http://www.apache.org/licenses/LICENSE-2.0.
10
16
  *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * https://www.apache.org/licenses/LICENSE-2.0
14
18
  *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
22
  * See the License for the specific language governing permissions and
16
23
  * limitations under the License.
17
24
  *
@@ -25,7 +32,11 @@
25
32
  * USAGE
26
33
  * Invoke this from the top level directory.
27
34
  * After an 'npm install oracledb' installs pre-built binaries, this file
28
- * can be run with 'npm run prune'.
35
+ * can be run with 'npm run prune [all]'.
36
+ * 'npm run prune' will keep only the binary files for the platform where
37
+ * the application using node-oracledb is being run.
38
+ * Passing the optional 'all' parameter deletes all binary files, so that
39
+ * only Thin mode will be available.
29
40
  *
30
41
  *****************************************************************************/
31
42
 
@@ -34,17 +45,54 @@
34
45
  const fs = require('fs');
35
46
  const nodbUtil = require('../lib/util.js');
36
47
 
37
- const dir = nodbUtil.RELEASE_DIR;
48
+ const dir = nodbUtil.RELEASE_DIR; // contains the binaries
38
49
 
39
50
  let re = new RegExp(nodbUtil.BINARY_FILE);
40
51
 
41
52
  try {
42
53
  let f = fs.readdirSync(dir);
43
- for (let i = 0; i < f.length; i++) {
44
- if (!f[i].match(re) && (f[i].match(/oracledb.*\.node(-buildinfo.txt)*/))) {
45
- fs.unlinkSync(dir + '/' + f[i]);
54
+ let opt = process.argv[2];
55
+
56
+ if (opt) {
57
+ // 'npm run prune <option>' is called
58
+ if (opt.toLowerCase() === 'all') {
59
+ // Remove all the binaries in nodbUtil.RELEASE_DIR
60
+ for (let i = 0; i < f.length; i++) {
61
+ removeFileorDir(dir + '/' + f[i]);
62
+ }
63
+ } else {
64
+ // Invalid option
65
+ throw new Error('Invalid Command option: ' + `'${opt}'. Usage 'npm run prune [all]'`);
66
+ }
67
+ } else {
68
+ // 'npm run prune' is called
69
+ for (let i = 0; i < f.length; i++) {
70
+ if (!f[i].match(re) && (f[i].match(/oracledb.*\.node(-buildinfo.txt)*/))) {
71
+ fs.unlinkSync(dir + '/' + f[i]);
72
+ }
46
73
  }
47
74
  }
48
75
  } catch (err) {
49
76
  console.error(err.message);
50
77
  }
78
+
79
+ async function removeFileorDir(fileOrDirPath) {
80
+ try {
81
+ const isDir = fs.statSync(fileOrDirPath).isDirectory();
82
+ if (isDir) {
83
+ // Remove the directory and its files recursively
84
+ // Use fs.promises for Node.js versions 14.6-14.13,
85
+ // which do not support fs.rmSync()
86
+ const vs = process.version.substring(1).split(".").map(Number);
87
+ if (vs[0] > 14 || (vs[0] === 14 && vs[1] >= 14))
88
+ fs.rmSync(fileOrDirPath, { recursive: true, force: true });
89
+ else
90
+ await fs.promises.rmdir(fileOrDirPath, { recursive: true, force: true });
91
+ } else {
92
+ // Remove the file or the symlink synchronously
93
+ fs.unlinkSync(fileOrDirPath);
94
+ }
95
+ } catch (err) {
96
+ throw new Error('Invalid File or Directory: ' + `'${fileOrDirPath}'`);
97
+ }
98
+ }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "oracledb",
3
- "version": "5.5.0",
3
+ "version": "6.0.0",
4
4
  "description": "A Node.js module for Oracle Database access from JavaScript and TypeScript",
5
- "license": "Apache-2.0",
5
+ "license": "(Apache-2.0 OR UPL-1.0)",
6
6
  "homepage": "http://oracle.github.io/node-oracledb/",
7
7
  "keywords": [
8
8
  "Oracle",
@@ -34,7 +34,7 @@
34
34
  "prune": "node package/prunebinaries.js"
35
35
  },
36
36
  "engines": {
37
- "node": ">=10.16"
37
+ "node": ">=14.6"
38
38
  },
39
39
  "maintainers": [
40
40
  {
@@ -1 +0,0 @@
1
- oracledb-5.5.0-darwin-x64.node v18.8.0 6bbe60772e67967e524cedb23c8e501fd8d18cf0 1b40d66d5375522445b9a05a2243317057ef11c3 Wed, 07 Sep 2022 08:36:54 GMT
@@ -1 +0,0 @@
1
- oracledb-5.5.0-linux-x64.node v10.23.1 6bbe60772e67967e524cedb23c8e501fd8d18cf0 1b40d66d5375522445b9a05a2243317057ef11c3 Wed, 07 Sep 2022 08:40:30 GMT
@@ -1 +0,0 @@
1
- oracledb-5.5.0-win32-x64.node v18.8.0 77dd8c6c2822588ae3996f1c810f97bcab25b954 1b40d66d5375522445b9a05a2243317057ef11c3 Wed, 07 Sep 2022 07:01:17 GMT