oracledb 5.4.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 (108) hide show
  1. package/CHANGELOG.md +1 -1849
  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/THIRD_PARTY_LICENSES.txt +1 -1
  7. package/build/Release/oracledb-6.0.0-darwin-x64.node +0 -0
  8. package/build/Release/oracledb-6.0.0-darwin-x64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.0.0-js-buildinfo.txt +1 -0
  10. package/build/Release/oracledb-6.0.0-linux-arm64.node +0 -0
  11. package/build/Release/oracledb-6.0.0-linux-arm64.node-buildinfo.txt +1 -0
  12. package/build/Release/oracledb-6.0.0-linux-x64.node +0 -0
  13. package/build/Release/oracledb-6.0.0-linux-x64.node-buildinfo.txt +1 -0
  14. package/build/Release/oracledb-6.0.0-win32-x64.node +0 -0
  15. package/build/Release/oracledb-6.0.0-win32-x64.node-buildinfo.txt +1 -0
  16. package/examples/README.md +113 -0
  17. package/examples/dbconfig.js +100 -0
  18. package/examples/example.js +156 -0
  19. package/index.js +26 -0
  20. package/lib/aqDeqOptions.js +146 -7
  21. package/lib/aqEnqOptions.js +59 -7
  22. package/lib/aqMessage.js +118 -7
  23. package/lib/aqQueue.js +242 -53
  24. package/lib/connection.js +1324 -465
  25. package/lib/constants.js +203 -0
  26. package/lib/dbObject.js +346 -32
  27. package/lib/errors.js +781 -0
  28. package/lib/impl/aqDeqOptions.js +197 -0
  29. package/lib/impl/aqEnqOptions.js +89 -0
  30. package/lib/impl/aqMessage.js +134 -0
  31. package/lib/impl/aqQueue.js +81 -0
  32. package/lib/impl/connection.js +529 -0
  33. package/lib/impl/dbObject.js +159 -0
  34. package/lib/impl/index.js +59 -0
  35. package/lib/impl/lob.js +85 -0
  36. package/lib/impl/pool.js +195 -0
  37. package/lib/impl/resultset.js +223 -0
  38. package/lib/impl/sodaCollection.js +174 -0
  39. package/lib/impl/sodaDatabase.js +81 -0
  40. package/lib/impl/sodaDocCursor.js +63 -0
  41. package/lib/impl/sodaDocument.js +98 -0
  42. package/lib/impl/sodaOperation.js +109 -0
  43. package/lib/lob.js +156 -68
  44. package/lib/oracledb.js +1051 -257
  45. package/lib/pool.js +654 -465
  46. package/lib/poolStatistics.js +23 -9
  47. package/lib/queryStream.js +14 -7
  48. package/lib/resultset.js +292 -171
  49. package/lib/settings.js +191 -0
  50. package/lib/sodaCollection.js +214 -201
  51. package/lib/sodaDatabase.js +107 -71
  52. package/lib/sodaDocCursor.js +44 -32
  53. package/lib/sodaDocument.js +76 -14
  54. package/lib/sodaOperation.js +131 -118
  55. package/lib/thin/connection.js +1038 -0
  56. package/lib/thin/dbObject.js +629 -0
  57. package/lib/thin/index.js +40 -0
  58. package/lib/thin/lob.js +188 -0
  59. package/lib/thin/pool.js +481 -0
  60. package/lib/thin/protocol/buffer.js +1040 -0
  61. package/lib/thin/protocol/capabilities.js +116 -0
  62. package/lib/thin/protocol/constants.js +764 -0
  63. package/lib/thin/protocol/encryptDecrypt.js +185 -0
  64. package/lib/thin/protocol/messages/auth.js +348 -0
  65. package/lib/thin/protocol/messages/base.js +475 -0
  66. package/lib/thin/protocol/messages/commit.js +56 -0
  67. package/lib/thin/protocol/messages/dataType.js +382 -0
  68. package/lib/thin/protocol/messages/execute.js +312 -0
  69. package/lib/thin/protocol/messages/fetch.js +60 -0
  70. package/lib/thin/protocol/messages/index.js +53 -0
  71. package/lib/thin/protocol/messages/lobOp.js +200 -0
  72. package/lib/thin/protocol/messages/logOff.js +53 -0
  73. package/lib/thin/protocol/messages/ping.js +56 -0
  74. package/lib/thin/protocol/messages/protocol.js +78 -0
  75. package/lib/thin/protocol/messages/rollback.js +56 -0
  76. package/lib/thin/protocol/messages/sessionRelease.js +60 -0
  77. package/lib/thin/protocol/messages/withData.js +811 -0
  78. package/lib/thin/protocol/oson.js +660 -0
  79. package/lib/thin/protocol/packet.js +520 -0
  80. package/lib/thin/protocol/protocol.js +202 -0
  81. package/lib/thin/protocol/utils.js +88 -0
  82. package/lib/thin/resultSet.js +122 -0
  83. package/lib/thin/sqlnet/connStrategy.js +175 -0
  84. package/lib/thin/sqlnet/constants.js +199 -0
  85. package/lib/thin/sqlnet/ezConnectResolver.js +488 -0
  86. package/lib/thin/sqlnet/navNodes.js +870 -0
  87. package/lib/thin/sqlnet/networkSession.js +620 -0
  88. package/lib/thin/sqlnet/ntTcp.js +525 -0
  89. package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
  90. package/lib/thin/sqlnet/packet.js +405 -0
  91. package/lib/thin/sqlnet/paramParser.js +205 -0
  92. package/lib/thin/sqlnet/sessionAtts.js +160 -0
  93. package/lib/thin/statement.js +301 -0
  94. package/lib/thin/util.js +289 -0
  95. package/lib/transformer.js +250 -0
  96. package/lib/types.js +357 -0
  97. package/lib/util.js +194 -108
  98. package/lib/version.js +36 -0
  99. package/package/README.md +33 -30
  100. package/package/install.js +89 -64
  101. package/package/prunebinaries.js +60 -12
  102. package/package.json +3 -3
  103. package/build/Release/oracledb-5.4.0-darwin-x64.node +0 -0
  104. package/build/Release/oracledb-5.4.0-darwin-x64.node-buildinfo.txt +0 -1
  105. package/build/Release/oracledb-5.4.0-linux-x64.node +0 -0
  106. package/build/Release/oracledb-5.4.0-linux-x64.node-buildinfo.txt +0 -1
  107. package/build/Release/oracledb-5.4.0-win32-x64.node +0 -0
  108. package/build/Release/oracledb-5.4.0-win32-x64.node-buildinfo.txt +0 -1
@@ -1,17 +1,24 @@
1
- // Copyright (c) 2018, 2022, Oracle and/or its affiliates.
1
+ // Copyright (c) 2018, 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 http://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
  //
@@ -19,144 +26,142 @@
19
26
 
20
27
  'use strict';
21
28
 
29
+ const SodaDocCursor = require('./sodaDocCursor.js');
30
+ const SodaDocument = require('./sodaDocument.js');
31
+ const errors = require('./errors.js');
22
32
  const nodbUtil = require('./util.js');
33
+ const settings = require('./settings.js');
23
34
 
24
- //-----------------------------------------------------------------------------
25
- // count()
26
- // Return a count of the number of documents that match the search criteria.
27
- //-----------------------------------------------------------------------------
28
- async function count() {
29
- nodbUtil.checkArgCount(arguments, 0, 0);
30
- return await this._count(this._options);
31
- }
32
-
33
-
34
- //-----------------------------------------------------------------------------
35
- // getOne()
36
- // Return the first document that matches the search criteria.
37
- //-----------------------------------------------------------------------------
38
- async function getOne() {
39
- nodbUtil.checkArgCount(arguments, 0, 0);
40
- return await this._getOne(this._options);
41
- }
42
-
43
-
44
- //-----------------------------------------------------------------------------
45
- // replaceOne()
46
- // Replace the first document that matches the search criteria with the
47
- // specified document.
48
- //-----------------------------------------------------------------------------
49
- async function replaceOne(content) {
50
- nodbUtil.checkArgCount(arguments, 1, 1);
51
- nodbUtil.assert(nodbUtil.isObject(content) ||
52
- nodbUtil.isSodaDocument(content), 'NJS-005', 1);
35
+ class SodaOperation {
53
36
 
54
- if (!nodbUtil.isSodaDocument(content)) {
55
- content = Buffer.from(JSON.stringify(content));
37
+ constructor() {
38
+ this._options = {
39
+ autoCommit: settings.autoCommit,
40
+ fetchArraySize: settings.fetchArraySize
41
+ };
56
42
  }
57
43
 
58
- return await this._replaceOne(this._options, content);
59
- }
60
-
61
-
62
- //-----------------------------------------------------------------------------
63
- // replaceOneAndGet()
64
- // Replace the first document that matches the search criteria with the
65
- // specified document and then return a result document containing metadata.
66
- //-----------------------------------------------------------------------------
67
- async function replaceOneAndGet(content) {
68
- nodbUtil.checkArgCount(arguments, 1, 1);
69
- nodbUtil.assert(nodbUtil.isObject(content) ||
70
- nodbUtil.isSodaDocument(content), 'NJS-005', 1);
71
-
72
- if (!nodbUtil.isSodaDocument(content)) {
73
- content = Buffer.from(JSON.stringify(content));
44
+ //---------------------------------------------------------------------------
45
+ // count()
46
+ //
47
+ // Return a count of the number of documents that match the search criteria.
48
+ //---------------------------------------------------------------------------
49
+ async count() {
50
+ errors.assertArgCount(arguments, 0, 0);
51
+ return await this._impl.count(this._options);
74
52
  }
75
53
 
76
- return await this._replaceOneAndGet(this._options, content);
77
- }
78
-
79
-
80
- //-----------------------------------------------------------------------------
81
- // remove()
82
- // Remove the documents that match the search criteria from the collection
83
- // and return information about the operation to the caller.
84
- //-----------------------------------------------------------------------------
85
- async function remove() {
86
- nodbUtil.checkArgCount(arguments, 0, 0);
87
- return await this._remove(this._options);
88
- }
89
-
90
-
91
- //-----------------------------------------------------------------------------
92
- // getCursor()
93
- // Return a cursor which will return the documents that match the search
94
- // criteria.
95
- //-----------------------------------------------------------------------------
96
- async function getCursor() {
97
- nodbUtil.checkArgCount(arguments, 0, 0);
98
- return await this._getCursor(this._options);
99
- }
100
-
101
-
102
- //-----------------------------------------------------------------------------
103
- // getDocuments()
104
- // Return an array of documents that match the search criteria.
105
- //-----------------------------------------------------------------------------
106
- async function getDocuments() {
107
- nodbUtil.checkArgCount(arguments, 0, 0);
108
- return await this._getDocuments(this._options);
109
- }
54
+ //---------------------------------------------------------------------------
55
+ // getCursor()
56
+ //
57
+ // Return a cursor which will return the documents that match the search
58
+ // criteria.
59
+ //---------------------------------------------------------------------------
60
+ async getCursor() {
61
+ errors.assertArgCount(arguments, 0, 0);
62
+ const cursor = new SodaDocCursor();
63
+ cursor._impl = await this._impl.getCursor(this._options);
64
+ return cursor;
65
+ }
110
66
 
67
+ //---------------------------------------------------------------------------
68
+ // getDocuments()
69
+ // Return an array of documents that match the search criteria.
70
+ //---------------------------------------------------------------------------
71
+ async getDocuments() {
72
+ errors.assertArgCount(arguments, 0, 0);
73
+ const docImpls = await this._impl.getDocuments(this._options);
74
+ const returnVal = new Array(docImpls.length);
75
+ for (let i = 0; i < docImpls.length; i++) {
76
+ returnVal[i] = new SodaDocument();
77
+ returnVal[i]._impl = docImpls[i];
78
+ }
79
+ return returnVal;
80
+ }
111
81
 
112
- class SodaOperation {
82
+ //---------------------------------------------------------------------------
83
+ // getOne()
84
+ //
85
+ // Return the first document that matches the search criteria.
86
+ //---------------------------------------------------------------------------
87
+ async getOne() {
88
+ errors.assertArgCount(arguments, 0, 0);
89
+ const docImpl = await this._impl.getOne(this._options);
90
+ if (docImpl) {
91
+ const doc = new SodaDocument;
92
+ doc._impl = docImpl;
93
+ return doc;
94
+ }
95
+ }
113
96
 
114
- constructor() {
115
- this._options = {};
97
+ //---------------------------------------------------------------------------
98
+ // replaceOne()
99
+ //
100
+ // Replace the first document that matches the search criteria with the
101
+ // specified document.
102
+ //---------------------------------------------------------------------------
103
+ async replaceOne(content) {
104
+ errors.assertArgCount(arguments, 1, 1);
105
+ content = nodbUtil.verifySodaDoc(content);
106
+ return await this._impl.replaceOne(this._options, content);
116
107
  }
117
108
 
118
- _extend() {
119
- this.count = nodbUtil.callbackify(nodbUtil.serialize(count));
120
- this.getCursor = nodbUtil.callbackify(nodbUtil.serialize(getCursor));
121
- this.getDocuments = nodbUtil.callbackify(nodbUtil.serialize(getDocuments));
122
- this.getOne = nodbUtil.callbackify(nodbUtil.serialize(getOne));
123
- this.remove = nodbUtil.callbackify(nodbUtil.serialize(remove));
124
- this.replaceOne = nodbUtil.callbackify(nodbUtil.serialize(replaceOne));
125
- this.replaceOneAndGet = nodbUtil.callbackify(nodbUtil.serialize(replaceOneAndGet));
109
+ //---------------------------------------------------------------------------
110
+ // replaceOneAndGet()
111
+ //
112
+ // Replace the first document that matches the search criteria with the
113
+ // specified document and then return a result document containing metadata.
114
+ //---------------------------------------------------------------------------
115
+ async replaceOneAndGet(content) {
116
+ errors.assertArgCount(arguments, 1, 1);
117
+ content = nodbUtil.verifySodaDoc(content);
118
+ const docImpl = await this._impl.replaceOneAndGet(this._options, content);
119
+ if (docImpl) {
120
+ const doc = new SodaDocument();
121
+ doc._impl = docImpl;
122
+ return doc;
123
+ }
126
124
  }
127
125
 
128
- _getConnection() {
129
- return this._collection._database._connection;
126
+ //---------------------------------------------------------------------------
127
+ // remove()
128
+ //
129
+ // Remove the documents that match the search criteria from the collection
130
+ // and return information about the operation to the caller.
131
+ //---------------------------------------------------------------------------
132
+ async remove() {
133
+ errors.assertArgCount(arguments, 0, 0);
134
+ return await this._impl.remove(this._options);
130
135
  }
131
136
 
132
137
  // fetchArraySize - a non-terminal function that can chain further
133
138
  fetchArraySize(n) {
134
- nodbUtil.checkArgCount(arguments, 1, 1);
135
- nodbUtil.assert(typeof n === 'number', 'NJS-005', 1);
139
+ errors.assertArgCount(arguments, 1, 1);
140
+ errors.assertParamValue(Number.isInteger(n) && n >= 0, 1);
136
141
  this._options.fetchArraySize = n;
137
142
  return this;
138
143
  }
139
144
 
140
145
  // filter property - a non-terminal function and can chain further
141
146
  filter(f) {
142
- nodbUtil.checkArgCount (arguments, 1, 1);
143
- nodbUtil.assert(nodbUtil.isObject(f), 'NJS-005', 1);
147
+ errors.assertArgCount (arguments, 1, 1);
148
+ errors.assertParamValue(nodbUtil.isObject(f), 1);
144
149
  this._options.filter = JSON.stringify(f);
145
150
  return this;
146
151
  }
147
152
 
148
153
  // hint - a non-terminal function and can chain further
149
154
  hint(val) {
150
- nodbUtil.checkArgCount(arguments, 1, 1);
151
- nodbUtil.assert(typeof val === 'string', 'NJS-005', 1);
155
+ errors.assertArgCount(arguments, 1, 1);
156
+ errors.assertParamValue(typeof val === 'string', 1);
152
157
  this._options.hint = val;
153
158
  return this;
154
159
  }
155
160
 
156
161
  // key - a non-terminal function and can chain further
157
162
  key(k) {
158
- nodbUtil.checkArgCount(arguments, 1, 1);
159
- nodbUtil.assert(typeof k === 'string', 'NJS-005', 1);
163
+ errors.assertArgCount(arguments, 1, 1);
164
+ errors.assertParamValue(typeof k === 'string', 1);
160
165
  this._options.key = k;
161
166
  this._options.keys = undefined;
162
167
  return this;
@@ -164,11 +169,11 @@ class SodaOperation {
164
169
 
165
170
  // keys - a non-terminal function and can chain further
166
171
  keys(arr) {
167
- nodbUtil.checkArgCount(arguments, 1, 1);
168
- nodbUtil.assert(Array.isArray(arr), 'NJS-005', 1);
172
+ errors.assertArgCount(arguments, 1, 1);
173
+ errors.assertParamValue(Array.isArray(arr), 1);
169
174
 
170
175
  for (let i = 0; i < arr.length; i++) {
171
- nodbUtil.assert(typeof arr[i] === 'string', 'NJS-005', 1);
176
+ errors.assertParamValue(typeof arr[i] === 'string', 1);
172
177
  }
173
178
 
174
179
  this._options.keys = arr;
@@ -178,29 +183,37 @@ class SodaOperation {
178
183
 
179
184
  // limit property - a non-terminal function and can chain further
180
185
  limit(n) {
181
- nodbUtil.checkArgCount(arguments, 1, 1);
182
- nodbUtil.assert(typeof n === 'number', 'NJS-005', 1);
186
+ errors.assertArgCount(arguments, 1, 1);
187
+ errors.assertParamValue(typeof n === 'number', 1);
183
188
  this._options.limit = n;
184
189
  return this;
185
190
  }
186
191
 
187
192
  // skip property - a non-terminal function and can chain further
188
193
  skip(n) {
189
- nodbUtil.checkArgCount(arguments, 1, 1);
190
- nodbUtil.assert(typeof n === 'number', 'NJS-005', 1);
194
+ errors.assertArgCount(arguments, 1, 1);
195
+ errors.assertParamValue(typeof n === 'number', 1);
191
196
  this._options.skip = n;
192
197
  return this;
193
198
  }
194
199
 
195
200
  // version property - a non-terminal function and can chain further
196
201
  version(v) {
197
- nodbUtil.checkArgCount(arguments, 1, 1);
198
- nodbUtil.assert(typeof v === 'string', 'NJS-005', 1);
202
+ errors.assertArgCount(arguments, 1, 1);
203
+ errors.assertParamValue(typeof v === 'string', 1);
199
204
  this._options.version = v;
200
205
  return this;
201
206
  }
202
207
 
203
208
  }
204
209
 
210
+ nodbUtil.wrapFns(SodaOperation.prototype,
211
+ "count",
212
+ "getCursor",
213
+ "getDocuments",
214
+ "getOne",
215
+ "remove",
216
+ "replaceOne",
217
+ "replaceOneAndGet");
205
218
 
206
219
  module.exports = SodaOperation;