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) 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,82 +26,64 @@
19
26
 
20
27
  'use strict';
21
28
 
29
+ const SodaCollection = require('./sodaCollection.js');
30
+ const SodaDocument = require('./sodaDocument.js');
31
+ const errors = require('./errors.js');
22
32
  const nodbUtil = require('./util.js');
23
-
24
- //-----------------------------------------------------------------------------
25
- // createCollection()
26
- // Creates a SODA collection.
27
- //-----------------------------------------------------------------------------
28
- async function createCollection(name, a2) {
29
- let options = {};
30
-
31
- nodbUtil.checkArgCount(arguments, 1, 2);
32
- nodbUtil.assert(typeof name === 'string', 'NJS-005', 1);
33
-
34
- if (arguments.length == 2) {
35
- nodbUtil.assert(nodbUtil.isObject(a2), 'NJS-005', 2);
36
- options = a2;
37
- if (options.metaData) {
38
- if (!nodbUtil.isObject(options.metaData)) {
39
- throw new Error(nodbUtil.getErrorMessage('NJS-005', 2));
40
- }
41
- options.metaData = JSON.stringify(options.metaData);
42
- }
43
- }
44
-
45
- return await this._createCollection(name, options);
46
- }
47
-
48
-
49
- //-----------------------------------------------------------------------------
50
- // openCollection()
51
- // Open an existing SODA collection and return it to the caller.
52
- //-----------------------------------------------------------------------------
53
- async function openCollection(name) {
54
- nodbUtil.checkArgCount(arguments, 1, 1);
55
- nodbUtil.assert(typeof name === 'string', 'NJS-005', 1);
56
- return await this._openCollection(name);
57
- }
58
-
59
-
60
- //-----------------------------------------------------------------------------
61
- // getCollectionNames()
62
- // Return an array of the names of the collections in the database.
63
- //-----------------------------------------------------------------------------
64
- async function getCollectionNames(a1) {
65
- let options = {};
66
-
67
- nodbUtil.checkArgCount(arguments, 0, 1);
68
- if (arguments.length == 1) {
69
- nodbUtil.assert(nodbUtil.isObject(a1), 'NJS-005', 1);
70
- options = a1;
71
- }
72
- return await this._getCollectionNames(options);
73
- }
74
-
33
+ const settings = require('./settings.js');
75
34
 
76
35
  class SodaDatabase {
77
36
 
78
- _extend() {
79
- this.createCollection = nodbUtil.callbackify(nodbUtil.serialize(createCollection));
80
- this.getCollectionNames = nodbUtil.callbackify(nodbUtil.serialize(getCollectionNames));
81
- this.openCollection = nodbUtil.callbackify(nodbUtil.serialize(openCollection));
82
- }
83
-
84
37
  _getConnection() {
85
38
  return this._connection;
86
39
  }
87
40
 
88
- // To create a SODA document object based content and (optional) other fields
41
+ //---------------------------------------------------------------------------
42
+ // createCollection()
43
+ //
44
+ // Creates a SODA collection.
45
+ //---------------------------------------------------------------------------
46
+ async createCollection(name, a2) {
47
+ const options = {autoCommit: settings.autoCommit};
48
+
49
+ errors.assertArgCount(arguments, 1, 2);
50
+ errors.assertParamValue(typeof name === 'string', 1);
51
+
52
+ if (arguments.length == 2) {
53
+ errors.assertParamValue(nodbUtil.isObject(a2), 2);
54
+ if (a2.mode !== undefined) {
55
+ errors.assertParamPropValue(Number.isInteger(a2.mode) && a2.mode > 0,
56
+ 2, "mode");
57
+ options.mode = a2.mode;
58
+ }
59
+ if (a2.metaData !== undefined) {
60
+ errors.assertParamPropValue(nodbUtil.isObject(a2.metaData), 2,
61
+ "metaData");
62
+ options.metaData = JSON.stringify(a2.metaData);
63
+ }
64
+ }
65
+
66
+ const coll = new SodaCollection();
67
+ coll._impl = await this._impl.createCollection(name, options);
68
+ return coll;
69
+ }
70
+
71
+ //---------------------------------------------------------------------------
72
+ // createDocument()
73
+ //
74
+ // Creates a SODA document.
75
+ //---------------------------------------------------------------------------
89
76
  createDocument(content, a2) {
90
77
  let options = {};
91
78
 
92
- nodbUtil.checkArgCount(arguments, 1, 2);
93
- nodbUtil.assert(Buffer.isBuffer(content) || typeof content === 'string' ||
94
- nodbUtil.isObject(content), 'NJS-005', 1);
79
+ errors.assertArgCount(arguments, 1, 2);
80
+ errors.assertParamValue(Buffer.isBuffer(content) ||
81
+ typeof content === 'string' || nodbUtil.isObject(content), 1);
95
82
  if (arguments.length > 1) {
96
- nodbUtil.assert(nodbUtil.isObject(a2), 'NJS-005', 2);
83
+ errors.assertParamValue(nodbUtil.isObject(a2), 2);
97
84
  options = a2;
85
+ errors.assertParamPropString(options, 2, "key");
86
+ errors.assertParamPropString(options, 2, "mediaType");
98
87
  }
99
88
 
100
89
  if (typeof content === 'string') {
@@ -103,10 +92,57 @@ class SodaDatabase {
103
92
  content = Buffer.from(JSON.stringify(content));
104
93
  }
105
94
 
106
- return this._createDocument(content, options);
95
+ const doc = new SodaDocument();
96
+ doc._impl = this._impl.createDocument(content, options);
97
+ return doc;
98
+ }
99
+
100
+ //---------------------------------------------------------------------------
101
+ // getCollectionNames()
102
+ //
103
+ // Return an array of the names of the collections in the database.
104
+ //---------------------------------------------------------------------------
105
+ async getCollectionNames(a1) {
106
+ let options = {};
107
+
108
+ errors.assertArgCount(arguments, 0, 1);
109
+ if (arguments.length == 1) {
110
+ errors.assertParamValue(nodbUtil.isObject(a1), 1);
111
+ options = a1;
112
+ if (options.startsWith !== undefined) {
113
+ errors.assertParamPropValue(typeof options.startsWith === 'string', 1,
114
+ "startsWith");
115
+ }
116
+ if (options.limit !== undefined) {
117
+ errors.assertParamPropValue(Number.isInteger(options.limit), 1,
118
+ "limit");
119
+ }
120
+ }
121
+ return await this._impl.getCollectionNames(options);
122
+ }
123
+
124
+ //---------------------------------------------------------------------------
125
+ // openCollection()
126
+ //
127
+ // Open an existing SODA collection and return it to the caller.
128
+ //---------------------------------------------------------------------------
129
+ async openCollection(name) {
130
+ errors.assertArgCount(arguments, 1, 1);
131
+ errors.assertParamValue(typeof name === 'string', 1);
132
+ const options = {autoCommit: settings.autoCommit};
133
+ const collImpl = await this._impl.openCollection(name, options);
134
+ if (collImpl) {
135
+ const coll = new SodaCollection();
136
+ coll._impl = collImpl;
137
+ return coll;
138
+ }
107
139
  }
108
140
 
109
141
  }
110
142
 
143
+ nodbUtil.wrapFns(SodaDatabase.prototype,
144
+ "createCollection",
145
+ "getCollectionNames",
146
+ "openCollection");
111
147
 
112
148
  module.exports = SodaDatabase;
@@ -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,39 +26,44 @@
19
26
 
20
27
  'use strict';
21
28
 
29
+ const errors = require('./errors.js');
22
30
  const nodbUtil = require('./util.js');
23
-
24
- //-----------------------------------------------------------------------------
25
- // getNext()
26
- // Return the new document available from the cursor.
27
- //-----------------------------------------------------------------------------
28
- async function getNext() {
29
- nodbUtil.checkArgCount(arguments, 0, 0);
30
- return await this._getNext();
31
- }
32
-
33
-
34
- //-----------------------------------------------------------------------------
35
- // close()
36
- // Close the cursor and make it unusable for further operations.
37
- //----------------------------------------------------------------------------
38
- async function close() {
39
- nodbUtil.checkArgCount(arguments, 0, 0);
40
- await this._close();
41
- }
42
-
31
+ const SodaDocument = require('./sodaDocument.js');
43
32
 
44
33
  class SodaDocCursor {
45
34
 
46
- _extend() {
47
- this.close = nodbUtil.callbackify(nodbUtil.serialize(close));
48
- this.getNext = nodbUtil.callbackify(nodbUtil.serialize(getNext));
35
+ //---------------------------------------------------------------------------
36
+ // close()
37
+ //
38
+ // Close the cursor and make it unusable for further operations.
39
+ //--------------------------------------------------------------------------
40
+ async close() {
41
+ errors.assertArgCount(arguments, 0, 0);
42
+ errors.assert(this._impl, errors.ERR_INVALID_SODA_DOC_CURSOR);
43
+ await this._impl.close();
44
+ delete this._impl;
49
45
  }
50
46
 
51
- _getConnection() {
52
- return this._operation._getConnection();
47
+ //---------------------------------------------------------------------------
48
+ // getNext()
49
+ //
50
+ // Return the next document available from the cursor.
51
+ //---------------------------------------------------------------------------
52
+ async getNext() {
53
+ errors.assertArgCount(arguments, 0, 0);
54
+ errors.assert(this._impl, errors.ERR_INVALID_SODA_DOC_CURSOR);
55
+ const docImpl = await this._impl.getNext();
56
+ if (docImpl) {
57
+ const doc = new SodaDocument();
58
+ doc._impl = docImpl;
59
+ return doc;
60
+ }
53
61
  }
54
62
 
55
63
  }
56
64
 
65
+ nodbUtil.wrapFns(SodaDocCursor.prototype,
66
+ "close",
67
+ "getNext");
68
+
57
69
  module.exports = SodaDocCursor;
@@ -2,16 +2,23 @@
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
  //
@@ -21,25 +28,80 @@
21
28
 
22
29
  class SodaDocument {
23
30
 
24
- _extend() {
25
- this._sodaDocumentMarker = true;
31
+ //---------------------------------------------------------------------------
32
+ // createdOn
33
+ //
34
+ // Property for the created date of the document.
35
+ //---------------------------------------------------------------------------
36
+ get createdOn() {
37
+ return this._impl.getCreatedOn();
26
38
  }
27
39
 
28
- // returns the document content as a Javascript object
40
+ //---------------------------------------------------------------------------
41
+ // getContent()
42
+ //
43
+ // Returns the document content as a Javascript object.
44
+ //---------------------------------------------------------------------------
29
45
  getContent() {
30
- return JSON.parse(this._getContentAsString());
46
+ return JSON.parse(this._impl.getContentAsString());
31
47
  }
32
48
 
33
- // returns the document content as a buffer
49
+ //---------------------------------------------------------------------------
50
+ // getContentAsBuffer()
51
+ //
52
+ // Returns the document content as a buffer.
53
+ //---------------------------------------------------------------------------
34
54
  getContentAsBuffer() {
35
- return this._getContentAsBuffer();
55
+ return this._impl.getContentAsBuffer();
36
56
  }
37
57
 
38
- // returns the document content as a string
58
+ //---------------------------------------------------------------------------
59
+ // getContentAsString()
60
+ //
61
+ // Returns the document content as a string.
62
+ //---------------------------------------------------------------------------
39
63
  getContentAsString() {
40
- return this._getContentAsString();
64
+ return this._impl.getContentAsString();
65
+ }
66
+
67
+ //---------------------------------------------------------------------------
68
+ // key
69
+ //
70
+ // Property for the key of the document.
71
+ //---------------------------------------------------------------------------
72
+ get key() {
73
+ return this._impl.getKey();
74
+ }
75
+
76
+ //---------------------------------------------------------------------------
77
+ // lastModified
78
+ //
79
+ // Property for the last modified date of the document.
80
+ //---------------------------------------------------------------------------
81
+ get lastModified() {
82
+ return this._impl.getLastModified();
83
+ }
84
+
85
+ //---------------------------------------------------------------------------
86
+ // mediaType
87
+ //
88
+ // Property for the media type of the document.
89
+ //---------------------------------------------------------------------------
90
+ get mediaType() {
91
+ return this._impl.getMediaType();
92
+ }
93
+
94
+ //---------------------------------------------------------------------------
95
+ // verison
96
+ //
97
+ // Property for the version of the document.
98
+ //---------------------------------------------------------------------------
99
+ get version() {
100
+ return this._impl.getVersion();
41
101
  }
42
102
 
43
103
  }
44
104
 
105
+ SodaDocument.prototype._sodaDocumentMarker = true;
106
+
45
107
  module.exports = SodaDocument;