oracledb 6.6.0 → 6.7.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.
- package/README.md +2 -2
- package/build/Release/oracledb-6.7.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.7.0-darwin-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.7.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.7.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.7.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.7.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.7.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.7.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.7.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.7.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.7.0-win32-x64.node-buildinfo.txt +1 -0
- package/examples/README.md +2 -0
- package/lib/configProviders/azure.js +26 -15
- package/lib/configProviders/base.js +23 -37
- package/lib/configProviders/ociobject.js +53 -45
- package/lib/connection.js +70 -3
- package/lib/errors.js +13 -6
- package/lib/impl/aqQueue.js +2 -1
- package/lib/impl/base.js +45 -0
- package/lib/impl/connection.js +53 -0
- package/lib/impl/lob.js +2 -1
- package/lib/impl/pool.js +15 -0
- package/lib/impl/resultset.js +2 -1
- package/lib/impl/sodaCollection.js +2 -1
- package/lib/impl/sodaDatabase.js +2 -1
- package/lib/impl/sodaDocCursor.js +2 -1
- package/lib/impl/sodaOperation.js +2 -1
- package/lib/lob.js +3 -2
- package/lib/oracledb.js +220 -35
- package/lib/pool.js +14 -5
- package/lib/settings.js +1 -0
- package/lib/thin/connection.js +150 -91
- package/lib/thin/pool.js +3 -0
- package/lib/thin/protocol/messages/auth.js +12 -6
- package/lib/thin/protocol/messages/base.js +3 -0
- package/lib/thin/protocol/messages/sessionRelease.js +1 -0
- package/lib/thin/protocol/messages/withData.js +2 -7
- package/lib/thin/protocol/protocol.js +23 -0
- package/lib/thin/sqlnet/connStrategy.js +9 -1
- package/lib/thin/sqlnet/constants.js +2 -0
- package/lib/thin/sqlnet/navNodes.js +14 -2
- package/lib/thin/sqlnet/networkSession.js +9 -9
- package/lib/thin/sqlnet/ntTcp.js +1 -1
- package/lib/thin/sqlnet/sessionAtts.js +1 -1
- package/lib/thin/util.js +4 -3
- package/lib/traceHandler.js +133 -0
- package/lib/util.js +179 -33
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/build/Release/oracledb-6.6.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.6.0-darwin-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.6.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.6.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.6.0-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.6.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.6.0-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.6.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.6.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.6.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.6.0-win32-x64.node-buildinfo.txt +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# node-oracledb version 6.
|
|
1
|
+
# node-oracledb version 6.7.0
|
|
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.
|
|
7
|
+
Use node-oracledb 6.7.0 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
|
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.7.0-darwin-arm64.node v22.2.0 29e0b9cfc2f22f3df1e6b746323fb5f1f95ba492 3f4e00888d20e313374cfe0fb148de2180eaf93f Thu, 07 Nov 2024 06:28:34 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.7.0-darwin-x64.node v20.11.1 29e0b9cfc2f22f3df1e6b746323fb5f1f95ba492 3f4e00888d20e313374cfe0fb148de2180eaf93f Thu, 07 Nov 2024 06:21:29 GMT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
29e0b9cfc2f22f3df1e6b746323fb5f1f95ba492
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.7.0-linux-arm64.node v18.20.4 29e0b9cfc2f22f3df1e6b746323fb5f1f95ba492 3f4e00888d20e313374cfe0fb148de2180eaf93f Thu, 07 Nov 2024 16:48:12 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.7.0-linux-x64.node v16.20.2 29e0b9cfc2f22f3df1e6b746323fb5f1f95ba492 3f4e00888d20e313374cfe0fb148de2180eaf93f Thu, 07 Nov 2024 16:47:47 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.7.0-win32-x64.node v18.16.0 29e0b9cfc2f22f3df1e6b746323fb5f1f95ba492 3f4e00888d20e313374cfe0fb148de2180eaf93f Thu, 07 Nov 2024 16:23:47 GMT
|
package/examples/README.md
CHANGED
|
@@ -65,6 +65,7 @@ File Name | Description
|
|
|
65
65
|
[`aqraw.js`](aqraw.js) | Basic Oracle Advanced Queuing (AQ) example passing text messages
|
|
66
66
|
[`aqutil.js`](aqutil.js) | Common file to setup the user credentials for all the Advanced Queuing (AQ) examples.
|
|
67
67
|
[`blobhttp.js`](blobhttp.js) | Simple web app that streams an image
|
|
68
|
+
[`azureConfigProvider.js`](azureConfigProvider.js) | Show how to connect to an Oracle Database using Azure Configuration Providers
|
|
68
69
|
[`calltimeout.js`](calltimeout.js) | Shows how to cancel a SQL statement if it doesn't complete in a specified time
|
|
69
70
|
[`connect.js`](connect.js) | Basic example for creating a standalone (non-pooled) connection
|
|
70
71
|
[`connectionpool.js`](connectionpool.js) | Basic example creating a pool of connections
|
|
@@ -101,6 +102,7 @@ File Name | Description
|
|
|
101
102
|
[`lobstream2.js`](lobstream2.js) | Shows using Stream data events to fetch a CLOB
|
|
102
103
|
[`lowercasecolumns.js`](lowercasecolumns.js) | Shows how a type handler can convert column names to lower case
|
|
103
104
|
[`metadata.js`](metadata.js) | Shows the metadata available after executing SELECT statements
|
|
105
|
+
[`ociConfigProvider.js`](ociConfigProvider.js) | Show how to connect to an Oracle Database using OCI Configuration Providers
|
|
104
106
|
[`plsqlarray.js`](plsqlarray.js) | Examples of binding PL/SQL "INDEX BY" tables
|
|
105
107
|
[`plsqlfunc.js`](plsqlfunc.js) | How to call a PL/SQL function
|
|
106
108
|
[`plsqlproc.js`](plsqlproc.js) | How to call a PL/SQL procedure
|
|
@@ -40,11 +40,11 @@ class AzureProvider extends base {
|
|
|
40
40
|
//---------------------------------------------------------------------------
|
|
41
41
|
// init()
|
|
42
42
|
//
|
|
43
|
-
// Require/import modules from
|
|
43
|
+
// Require/import modules from Azure SDK
|
|
44
44
|
//---------------------------------------------------------------------------
|
|
45
45
|
init() {
|
|
46
|
-
({AppConfigurationClient } = require("@azure/app-configuration"));
|
|
47
|
-
({ClientSecretCredential, ClientCertificateCredential, ChainedTokenCredential, ManagedIdentityCredential, EnvironmentCredential} = require("@azure/identity"));
|
|
46
|
+
({ AppConfigurationClient } = require("@azure/app-configuration"));
|
|
47
|
+
({ ClientSecretCredential, ClientCertificateCredential, ChainedTokenCredential, ManagedIdentityCredential, EnvironmentCredential } = require("@azure/identity"));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
//---------------------------------------------------------------------------
|
|
@@ -112,11 +112,11 @@ class AzureProvider extends base {
|
|
|
112
112
|
async returnConfig() {
|
|
113
113
|
const configObject = {};
|
|
114
114
|
const label = this.paramMap.get("label");
|
|
115
|
-
|
|
115
|
+
this.credential = this._returnCredential();
|
|
116
116
|
// azure config store
|
|
117
117
|
const client = new AppConfigurationClient(
|
|
118
118
|
"https://" + this.paramMap.get("appconfigname"), // ex: <https://<your appconfig resource>.azconfig.io>
|
|
119
|
-
credential
|
|
119
|
+
this.credential
|
|
120
120
|
);
|
|
121
121
|
// retrieve connect_description
|
|
122
122
|
configObject.connectString = (await this._getConfigurationSetting(client, this.paramMap.get("key") + 'connect_descriptor', label)).value;
|
|
@@ -139,29 +139,40 @@ class AzureProvider extends base {
|
|
|
139
139
|
configObject.user = null;
|
|
140
140
|
}
|
|
141
141
|
//retrieve password
|
|
142
|
-
|
|
142
|
+
configObject.password = await this.retrieveParamValueFromVault(client, label, 'password');
|
|
143
|
+
// retrieve wallet_location
|
|
144
|
+
configObject.walletContent = await this.retrieveParamValueFromVault(client, label, 'wallet_location');
|
|
145
|
+
if (configObject.walletContent) {
|
|
146
|
+
//only Pem file supported
|
|
147
|
+
if (!this.isPemFile(configObject.walletContent))
|
|
148
|
+
errors.throwErr(errors.ERR_WALLET_TYPE_NOT_SUPPORTED);
|
|
149
|
+
}
|
|
150
|
+
return configObject;
|
|
151
|
+
}
|
|
152
|
+
async retrieveParamValueFromVault(client, label, param) {
|
|
153
|
+
let paramJson = null;
|
|
143
154
|
try {
|
|
144
|
-
|
|
155
|
+
paramJson = await this._getConfigurationSetting(client, this.paramMap.get("key") + param, label);
|
|
145
156
|
} catch {
|
|
146
|
-
|
|
157
|
+
return null;
|
|
147
158
|
}
|
|
148
|
-
if (
|
|
159
|
+
if (paramJson) {
|
|
149
160
|
let obj;
|
|
150
161
|
try {
|
|
151
|
-
obj = JSON.parse(
|
|
162
|
+
obj = JSON.parse(paramJson.value);
|
|
152
163
|
} catch {
|
|
153
|
-
obj =
|
|
164
|
+
obj = paramJson.value;
|
|
154
165
|
}
|
|
155
166
|
if (obj.uri) {
|
|
156
167
|
const { SecretClient } = require("@azure/keyvault-secrets");
|
|
157
168
|
const vault_detail = await this._parsePwd(obj.uri);
|
|
158
|
-
const client1 = new SecretClient(vault_detail[0], credential);
|
|
159
|
-
|
|
169
|
+
const client1 = new SecretClient(vault_detail[0], this.credential);
|
|
170
|
+
return (await client1.getSecret(vault_detail[1])).value;
|
|
160
171
|
} else {
|
|
161
|
-
|
|
172
|
+
return paramJson.value;
|
|
162
173
|
}
|
|
163
174
|
}
|
|
164
|
-
|
|
175
|
+
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
178
|
module.exports = AzureProvider;
|
|
@@ -26,49 +26,35 @@
|
|
|
26
26
|
|
|
27
27
|
'use strict';
|
|
28
28
|
|
|
29
|
+
const pemHeaders = [
|
|
30
|
+
'-----BEGIN CERTIFICATE-----',
|
|
31
|
+
'-----BEGIN PUBLIC KEY-----',
|
|
32
|
+
'-----BEGIN PRIVATE KEY-----',
|
|
33
|
+
'-----BEGIN RSA PRIVATE KEY-----',
|
|
34
|
+
'-----BEGIN DSA PRIVATE KEY-----',
|
|
35
|
+
'-----BEGIN EC PRIVATE KEY-----',
|
|
36
|
+
'-----BEGIN ENCRYPTED PRIVATE KEY-----'
|
|
37
|
+
];
|
|
38
|
+
const pemFooters = [
|
|
39
|
+
'-----END CERTIFICATE-----',
|
|
40
|
+
'-----END PUBLIC KEY-----',
|
|
41
|
+
'-----END PRIVATE KEY-----',
|
|
42
|
+
'-----END RSA PRIVATE KEY-----',
|
|
43
|
+
'-----END DSA PRIVATE KEY-----',
|
|
44
|
+
'-----END EC PRIVATE KEY-----',
|
|
45
|
+
'-----END ENCRYPTED PRIVATE KEY-----'
|
|
46
|
+
];
|
|
29
47
|
class base {
|
|
30
48
|
constructor(url) {
|
|
31
49
|
const params = new URLSearchParams(url);
|
|
32
50
|
this.paramMap = new URLSearchParams([...params].map(([key, value]) => [key.toLowerCase(), value])); //parse the extended part and store parameters in Map
|
|
33
51
|
}
|
|
34
52
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
modifyOptionsPrecedence(cloudConfig, userConfig) {
|
|
41
|
-
// create a copy of userConfig object
|
|
42
|
-
userConfig = { ...userConfig };
|
|
43
|
-
if (!userConfig.user)
|
|
44
|
-
userConfig.user = cloudConfig.user;
|
|
45
|
-
if (!userConfig.password)
|
|
46
|
-
userConfig.password = cloudConfig.password;
|
|
47
|
-
if (cloudConfig.connectString) {
|
|
48
|
-
userConfig.connectString = cloudConfig.connectString;
|
|
49
|
-
userConfig.connectionString = undefined;
|
|
50
|
-
}
|
|
51
|
-
if (cloudConfig.poolMin)
|
|
52
|
-
userConfig.poolMin = cloudConfig.poolMin;
|
|
53
|
-
if (cloudConfig.poolMax)
|
|
54
|
-
userConfig.poolMax = cloudConfig.poolMax;
|
|
55
|
-
if (cloudConfig.poolIncrement)
|
|
56
|
-
userConfig.poolIncrement = cloudConfig.poolIncrement;
|
|
57
|
-
if (cloudConfig.poolTimeout)
|
|
58
|
-
userConfig.poolTimeout = cloudConfig.poolTimeout;
|
|
59
|
-
if (cloudConfig.poolPingInterval)
|
|
60
|
-
userConfig.poolPingInterval = cloudConfig.poolPingInterval;
|
|
61
|
-
if (cloudConfig.poolPingTimeout)
|
|
62
|
-
userConfig.poolPingTimeout = cloudConfig.poolPingTimeout;
|
|
63
|
-
if (cloudConfig.stmtCacheSize)
|
|
64
|
-
userConfig.stmtCacheSize = cloudConfig.stmtCacheSize;
|
|
65
|
-
if (cloudConfig.prefetchRows)
|
|
66
|
-
userConfig.prefetchRows = cloudConfig.prefetchRows;
|
|
67
|
-
if (cloudConfig.lobPrefetch)
|
|
68
|
-
userConfig.lobPrefetch = cloudConfig.lobPrefetch;
|
|
69
|
-
|
|
70
|
-
return userConfig;
|
|
71
|
-
|
|
53
|
+
isPemFile(content) {
|
|
54
|
+
//remove any line breaks at the end of the content
|
|
55
|
+
content = content.trim();
|
|
56
|
+
return pemHeaders.some(header => content.includes(header)) &&
|
|
57
|
+
pemFooters.some(footer => content.endsWith(footer));
|
|
72
58
|
}
|
|
73
59
|
|
|
74
60
|
//---------------------------------------------------------------------------
|
|
@@ -29,10 +29,9 @@ const errors = require("../errors.js");
|
|
|
29
29
|
const { base } = require("./base.js");
|
|
30
30
|
const fs = require('fs');
|
|
31
31
|
|
|
32
|
-
const cloud_net_naming_pattern_oci = new RegExp("(?<objservername>[A-Za-z0-9._-]+)/n/" + "(?<namespace>[A-Za-z0-9._-]+)/b/" + "(?<bucketname>[A-Za-z0-9._-]+)/o/" + "(?<filename>[A-Za-z0-9._-]+)"
|
|
32
|
+
const cloud_net_naming_pattern_oci = new RegExp("(?<objservername>[A-Za-z0-9._-]+)/n/" + "(?<namespace>[A-Za-z0-9._-]+)/b/" + "(?<bucketname>[A-Za-z0-9._-]+)/o/" + "(?<filename>[A-Za-z0-9._-]+)$");
|
|
33
33
|
// object to store module references that will be populated by init()
|
|
34
34
|
const oci = {};
|
|
35
|
-
|
|
36
35
|
class OCIProvider extends base {
|
|
37
36
|
constructor(provider_arg, urlExtendedPart) {
|
|
38
37
|
super(urlExtendedPart);
|
|
@@ -42,8 +41,6 @@ class OCIProvider extends base {
|
|
|
42
41
|
this._addParam("namespace", match.groups.namespace);
|
|
43
42
|
this._addParam("bucketname", match.groups.bucketname);
|
|
44
43
|
this._addParam("filename", match.groups.filename);
|
|
45
|
-
if (match.groups.alias)
|
|
46
|
-
this._addParam("alias", match.groups.alias);
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
|
|
@@ -127,65 +124,41 @@ class OCIProvider extends base {
|
|
|
127
124
|
//---------------------------------------------------------------------------
|
|
128
125
|
async returnConfig() {
|
|
129
126
|
const configObject = {};
|
|
130
|
-
|
|
127
|
+
this.credential = await this._returnCredential();
|
|
131
128
|
// oci object store
|
|
132
129
|
const client_oci = new (oci.objectstorage).ObjectStorageClient({
|
|
133
|
-
authenticationDetailsProvider: credential
|
|
130
|
+
authenticationDetailsProvider: this.credential
|
|
134
131
|
});
|
|
135
132
|
const getObjectRequest = {
|
|
136
133
|
objectName: this.paramMap.get('filename'),
|
|
137
134
|
bucketName: this.paramMap.get('bucketname'),
|
|
138
135
|
namespaceName: this.paramMap.get('namespace')
|
|
139
136
|
};
|
|
140
|
-
let credential1;
|
|
141
137
|
const getObjectResponse = await client_oci.getObject(getObjectRequest);
|
|
142
138
|
const resp = await this._streamToString(getObjectResponse.value);
|
|
143
139
|
// Entire object we get from OCI Object Storage
|
|
144
|
-
|
|
145
|
-
const userAlias = this.paramMap.get('
|
|
140
|
+
this.obj = JSON.parse(resp);
|
|
141
|
+
const userAlias = this.paramMap.get('key'); // alias
|
|
146
142
|
if (userAlias) {
|
|
147
|
-
obj = obj[userAlias];
|
|
143
|
+
this.obj = this.obj[userAlias];
|
|
148
144
|
}
|
|
149
145
|
const pmSection = 'node-oracledb';
|
|
150
|
-
const params = obj[pmSection];
|
|
146
|
+
const params = this.obj[pmSection];
|
|
151
147
|
for (const key in params) {
|
|
152
148
|
var val = params[key];
|
|
153
149
|
configObject[key] = val;
|
|
154
150
|
}
|
|
155
|
-
configObject.connectString = obj.connect_descriptor;
|
|
156
|
-
configObject.user = obj.user;
|
|
157
|
-
if (obj.password) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
else
|
|
167
|
-
errors.throwErr(errors.ERR_AZURE_VAULT_AUTH_FAILED);
|
|
168
|
-
const vault_detail = await this._parsePwd(obj.password.value);
|
|
169
|
-
const client1 = new SecretClient(vault_detail[0], credential1);
|
|
170
|
-
configObject.password = (await client1.getSecret(vault_detail[1])).value;
|
|
171
|
-
} else {
|
|
172
|
-
errors.throwErr(errors.ERR_AZURE_VAULT_AUTH_FAILED);
|
|
173
|
-
}
|
|
174
|
-
} else if (obj.password.type == "vault-oci") {
|
|
175
|
-
const secrets = require('oci-secrets');
|
|
176
|
-
const secretClientOci = new secrets.SecretsClient({
|
|
177
|
-
authenticationDetailsProvider: credential
|
|
178
|
-
});
|
|
179
|
-
const getSecretBundleRequest = {
|
|
180
|
-
secretId: obj.password.value
|
|
181
|
-
};
|
|
182
|
-
const getSecretBundleResponse = await secretClientOci.getSecretBundle(getSecretBundleRequest);
|
|
183
|
-
configObject.password = getSecretBundleResponse.secretBundle.secretBundleContent.content;
|
|
184
|
-
} else if (obj.password) {
|
|
185
|
-
configObject.password = obj.password;
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
configObject.password = null;
|
|
151
|
+
configObject.connectString = this.obj.connect_descriptor;
|
|
152
|
+
configObject.user = this.obj.user;
|
|
153
|
+
if (this.obj.password) {
|
|
154
|
+
configObject.password = await this.retrieveParamValueFromVault('password');
|
|
155
|
+
}
|
|
156
|
+
if (this.obj.wallet_location) {
|
|
157
|
+
// retrieve wallet_location
|
|
158
|
+
configObject.walletContent = await this.retrieveParamValueFromVault('wallet_location');
|
|
159
|
+
//only Pem file supported
|
|
160
|
+
if (!this.isPemFile(configObject.walletContent))
|
|
161
|
+
errors.throwErr(errors.ERR_WALLET_TYPE_NOT_SUPPORTED);
|
|
189
162
|
}
|
|
190
163
|
return configObject;
|
|
191
164
|
}
|
|
@@ -199,5 +172,40 @@ class OCIProvider extends base {
|
|
|
199
172
|
const arr = objservername.split(".");
|
|
200
173
|
return arr[1].toUpperCase().replaceAll('-', '_');
|
|
201
174
|
}
|
|
175
|
+
|
|
176
|
+
async retrieveParamValueFromVault(param) {
|
|
177
|
+
if (this.obj[param].type == "azurevault") {
|
|
178
|
+
if (this.obj[param].authentication) {
|
|
179
|
+
const { SecretClient } = require("@azure/keyvault-secrets");
|
|
180
|
+
const {ClientSecretCredential, ClientCertificateCredential} = require("@azure/identity");
|
|
181
|
+
if (this.obj[param].authentication.azure_client_secret)
|
|
182
|
+
this.credential = new ClientSecretCredential(this.obj[param].authentication.azure_tenant_id, this.obj[param].authentication.azure_client_id, this.obj[param].authentication.azure_client_secret);
|
|
183
|
+
else if (this.obj[param].authentication.azure_client_certificate_path)
|
|
184
|
+
this.credential = new ClientCertificateCredential(this.obj[param].authentication.azure_tenant_id, this.obj[param].authentication.azure_client_id, this.obj[param].authentication.azure_client_certificate_path);
|
|
185
|
+
else
|
|
186
|
+
errors.throwErr(errors.ERR_AZURE_VAULT_AUTH_FAILED);
|
|
187
|
+
const vault_detail = await this._parsePwd(this.obj[param].value);
|
|
188
|
+
const client1 = new SecretClient(vault_detail[0], this.credential);
|
|
189
|
+
return (await client1.getSecret(vault_detail[1])).value;
|
|
190
|
+
} else {
|
|
191
|
+
errors.throwErr(errors.ERR_AZURE_VAULT_AUTH_FAILED);
|
|
192
|
+
}
|
|
193
|
+
} else if (this.obj[param].type == "ocivault") {
|
|
194
|
+
const secrets = require('oci-secrets');
|
|
195
|
+
const secretClientOci = new secrets.SecretsClient({
|
|
196
|
+
authenticationDetailsProvider: this.credential
|
|
197
|
+
});
|
|
198
|
+
const getSecretBundleRequest = {
|
|
199
|
+
secretId: this.obj[param].value
|
|
200
|
+
};
|
|
201
|
+
const getSecretBundleResponse = await secretClientOci.getSecretBundle(getSecretBundleRequest);
|
|
202
|
+
const base64content = getSecretBundleResponse.secretBundle.secretBundleContent.content;
|
|
203
|
+
// decode base64 content
|
|
204
|
+
const returnVal = Buffer.from(base64content, "base64").toString("utf-8");
|
|
205
|
+
return returnVal;
|
|
206
|
+
} else {
|
|
207
|
+
return this.obj[param];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
202
210
|
}
|
|
203
211
|
module.exports = OCIProvider;
|
package/lib/connection.js
CHANGED
|
@@ -869,10 +869,15 @@ class Connection extends EventEmitter {
|
|
|
869
869
|
let binds = [];
|
|
870
870
|
let options = {};
|
|
871
871
|
|
|
872
|
+
errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
|
|
873
|
+
|
|
872
874
|
// process arguments
|
|
873
875
|
if (nodbUtil.isObject(sql) && typeof sql.statement === 'string') {
|
|
874
876
|
errors.assertArgCount(arguments, 1, 2);
|
|
875
877
|
if (sql.values) {
|
|
878
|
+
if (this._impl._callLevelTraceData) {
|
|
879
|
+
this._impl._callLevelTraceData.values = sql.values;
|
|
880
|
+
}
|
|
876
881
|
binds = await this._processExecuteBinds(sql.values);
|
|
877
882
|
}
|
|
878
883
|
sql = sql.statement;
|
|
@@ -883,6 +888,9 @@ class Connection extends EventEmitter {
|
|
|
883
888
|
errors.assertArgCount(arguments, 1, 3);
|
|
884
889
|
errors.assertParamValue(typeof sql === 'string', 1);
|
|
885
890
|
if (arguments.length >= 2) {
|
|
891
|
+
if (this._impl._callLevelTraceData) {
|
|
892
|
+
this._impl._callLevelTraceData.values = a2;
|
|
893
|
+
}
|
|
886
894
|
binds = await this._processExecuteBinds(a2);
|
|
887
895
|
}
|
|
888
896
|
if (arguments.length == 3) {
|
|
@@ -890,11 +898,13 @@ class Connection extends EventEmitter {
|
|
|
890
898
|
}
|
|
891
899
|
}
|
|
892
900
|
this._addDefaultsToExecOpts(options);
|
|
893
|
-
errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
|
|
894
901
|
|
|
895
902
|
// perform actual execute
|
|
896
903
|
let result;
|
|
897
904
|
try {
|
|
905
|
+
if (this._impl._callLevelTraceData) {
|
|
906
|
+
this._impl._callLevelTraceData.statement = sql;
|
|
907
|
+
}
|
|
898
908
|
result = await this._impl.execute(sql, numIters, binds, options, false);
|
|
899
909
|
} catch (err) {
|
|
900
910
|
if (err.errorNum === 1406)
|
|
@@ -1035,6 +1045,63 @@ class Connection extends EventEmitter {
|
|
|
1035
1045
|
return this._impl && this._impl.getDbName();
|
|
1036
1046
|
}
|
|
1037
1047
|
|
|
1048
|
+
//---------------------------------------------------------------------------
|
|
1049
|
+
// hostName (READONLY)
|
|
1050
|
+
//
|
|
1051
|
+
// Property for identifying the hostName of the Oracle Database.
|
|
1052
|
+
//---------------------------------------------------------------------------
|
|
1053
|
+
get hostName() {
|
|
1054
|
+
return this._impl && this._impl.getHostName();
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
//---------------------------------------------------------------------------
|
|
1058
|
+
// port (READONLY)
|
|
1059
|
+
//
|
|
1060
|
+
// Property for identifying the port to which client is connected.
|
|
1061
|
+
//---------------------------------------------------------------------------
|
|
1062
|
+
get port() {
|
|
1063
|
+
return this._impl && this._impl.getPort();
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
//---------------------------------------------------------------------------
|
|
1067
|
+
// protocol (READONLY)
|
|
1068
|
+
//
|
|
1069
|
+
// Property for identifying the protocol used to connect to Oracle Database.
|
|
1070
|
+
//---------------------------------------------------------------------------
|
|
1071
|
+
get protocol() {
|
|
1072
|
+
return this._impl && this._impl.getProtocol();
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
//---------------------------------------------------------------------------
|
|
1076
|
+
// connectString (READONLY)
|
|
1077
|
+
//
|
|
1078
|
+
// User provided connectString to connect to Oracle Database.
|
|
1079
|
+
//---------------------------------------------------------------------------
|
|
1080
|
+
get connectString() {
|
|
1081
|
+
return this._impl && this._impl._connectString;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
//---------------------------------------------------------------------------
|
|
1085
|
+
// user
|
|
1086
|
+
//
|
|
1087
|
+
// User property provided to connect to Oracle Database.
|
|
1088
|
+
//---------------------------------------------------------------------------
|
|
1089
|
+
get user() {
|
|
1090
|
+
if (this.currentSchema.length) {
|
|
1091
|
+
return this.currentSchema;
|
|
1092
|
+
}
|
|
1093
|
+
return this._impl && this._impl._user;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
//---------------------------------------------------------------------------
|
|
1097
|
+
// connectTraceConfig
|
|
1098
|
+
//
|
|
1099
|
+
// Property for getting the connection related config.
|
|
1100
|
+
//---------------------------------------------------------------------------
|
|
1101
|
+
get connectTraceConfig() {
|
|
1102
|
+
return this._impl && this._impl._getConnectTraceConfig();
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1038
1105
|
//---------------------------------------------------------------------------
|
|
1039
1106
|
// getDbObjectClass()
|
|
1040
1107
|
//
|
|
@@ -1584,9 +1651,9 @@ class Connection extends EventEmitter {
|
|
|
1584
1651
|
// that cannot take place concurrently
|
|
1585
1652
|
// NOTE: breakExecution() should not be serialized
|
|
1586
1653
|
Connection.prototype.break =
|
|
1587
|
-
nodbUtil.callbackify(Connection.prototype.breakExecution);
|
|
1654
|
+
nodbUtil.callbackify(nodbUtil.wrapFn(Connection.prototype.breakExecution));
|
|
1588
1655
|
Connection.prototype.tpcRecover =
|
|
1589
|
-
nodbUtil.callbackify(Connection.prototype.tpcRecover);
|
|
1656
|
+
nodbUtil.callbackify(nodbUtil.wrapFn(Connection.prototype.tpcRecover));
|
|
1590
1657
|
nodbUtil.wrapFns(Connection.prototype,
|
|
1591
1658
|
"changePassword",
|
|
1592
1659
|
"close",
|
package/lib/errors.js
CHANGED
|
@@ -108,7 +108,7 @@ const ERR_MISSING_FILE = 91;
|
|
|
108
108
|
const ERR_INVALID_NUMBER_OF_CONNECTIONS = 92;
|
|
109
109
|
const ERR_EXEC_MODE_ONLY_FOR_DML = 95;
|
|
110
110
|
const ERR_INVALID_BIND_NAME = 97;
|
|
111
|
-
const
|
|
111
|
+
const ERR_WRONG_NUMBER_OF_BINDS = 98;
|
|
112
112
|
const ERR_BUFFER_LENGTH_INSUFFICIENT = 99;
|
|
113
113
|
const ERR_NCHAR_CS_NOT_SUPPORTED = 100;
|
|
114
114
|
const ERR_MISSING_CREDENTIALS = 101;
|
|
@@ -163,6 +163,7 @@ const ERR_INVALID_TRANSACTION_SIZE = 153;
|
|
|
163
163
|
const ERR_INVALID_BRANCH_SIZE = 154;
|
|
164
164
|
const ERR_OPERATION_NOT_SUPPORTED_ON_BFILE = 155;
|
|
165
165
|
const ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE = 156;
|
|
166
|
+
const ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES = 157;
|
|
166
167
|
|
|
167
168
|
// Oracle Net layer errors start from 500
|
|
168
169
|
const ERR_CONNECTION_CLOSED = 500;
|
|
@@ -193,6 +194,7 @@ const ERR_CONFIG_PROVIDER_LOAD_FAILED = 525;
|
|
|
193
194
|
const ERR_OCIOBJECT_CONFIG_PROVIDER_AUTH_FAILED = 526;
|
|
194
195
|
const ERR_AZURE_VAULT_AUTH_FAILED = 527;
|
|
195
196
|
const ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED = 528;
|
|
197
|
+
const ERR_WALLET_TYPE_NOT_SUPPORTED = 529;
|
|
196
198
|
|
|
197
199
|
// Oracle SUCCESS_WITH_INFO warning start from 700
|
|
198
200
|
const WRN_COMPILATION_CREATE = 700;
|
|
@@ -352,8 +354,8 @@ messages.set(ERR_EXEC_MODE_ONLY_FOR_DML, // NJS-095
|
|
|
352
354
|
'setting "batchErrors" or "dmlRowCounts" to true is only permitted for DML statements');
|
|
353
355
|
messages.set(ERR_INVALID_BIND_NAME, // NJS-097
|
|
354
356
|
'no bind placeholder named ":%s" was found in the statement text');
|
|
355
|
-
messages.set(
|
|
356
|
-
'%s
|
|
357
|
+
messages.set(ERR_WRONG_NUMBER_OF_BINDS, // NJS-098
|
|
358
|
+
'%s bind placeholders were used in the SQL statement but %s bind values were provided');
|
|
357
359
|
messages.set(ERR_BUFFER_LENGTH_INSUFFICIENT, // NJS-099
|
|
358
360
|
'internal error: buffer of length %s insufficient to hold %s bytes');
|
|
359
361
|
messages.set(ERR_NCHAR_CS_NOT_SUPPORTED, // NJS-100
|
|
@@ -456,12 +458,14 @@ messages.set(ERR_UNKNOWN_TRANSACTION_STATE, // NJS-152
|
|
|
456
458
|
'internal error: unknown transaction state {state} in Two Phase Commit');
|
|
457
459
|
messages.set(ERR_INVALID_TRANSACTION_SIZE, // NJS-153
|
|
458
460
|
'size of the transaction ID is %d and cannot exceed 64');
|
|
459
|
-
messages.set(ERR_INVALID_BRANCH_SIZE,
|
|
461
|
+
messages.set(ERR_INVALID_BRANCH_SIZE, // NJS-154
|
|
460
462
|
'size of the branch ID is %d and cannot exceed 64');
|
|
461
463
|
messages.set(ERR_OPERATION_NOT_SUPPORTED_ON_BFILE, // NJS-155
|
|
462
464
|
'operation is not supported on BFILE LOBs');
|
|
463
465
|
messages.set(ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE, // NJS-156
|
|
464
466
|
'operation is only supported on BFILE LOBs');
|
|
467
|
+
messages.set(ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES, // NJS-157
|
|
468
|
+
'executeMany() cannot be used with SELECT statement or WITH SQL clause');
|
|
465
469
|
|
|
466
470
|
// Oracle Net layer errors
|
|
467
471
|
|
|
@@ -474,7 +478,7 @@ messages.set(ERR_CONNECTION_INCOMPLETE, // NJS-503
|
|
|
474
478
|
messages.set(ERR_PROXY_CONNECTION_FAILURE, // NJS-504
|
|
475
479
|
'connection establishment through a web proxy at host %s port %d failed. (CONNECTION_ID=%s)\n%s');
|
|
476
480
|
messages.set(ERR_TLS_INIT_FAILURE, // NJS-505
|
|
477
|
-
'unable to initiate TLS connection. Please check if wallet credentials are valid');
|
|
481
|
+
'unable to initiate TLS connection. Please check if wallet credentials are valid\n%s');
|
|
478
482
|
messages.set(ERR_TLS_AUTH_FAILURE, // NJS-506
|
|
479
483
|
'connection to host %s port %d encountered TLS handshake failure. (CONNECTION_ID=%s)\n%s');
|
|
480
484
|
messages.set(ERR_TLS_DNMATCH_FAILURE, // NJS-507
|
|
@@ -521,6 +525,7 @@ messages.set(ERR_AZURE_VAULT_AUTH_FAILED, // NJS-527
|
|
|
521
525
|
'Azure Vault: Provide correct azure vault authentication details');
|
|
522
526
|
messages.set(ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED, // NJS-528
|
|
523
527
|
'Azure service principal authentication requires either a client certificate path or a client secret string');
|
|
528
|
+
messages.set(ERR_WALLET_TYPE_NOT_SUPPORTED, 'Invalid wallet content format. Supported format is PEM');// NJS-529
|
|
524
529
|
// Oracle SUCCESS_WITH_INFO warning
|
|
525
530
|
|
|
526
531
|
messages.set(WRN_COMPILATION_CREATE, // NJS-700
|
|
@@ -837,8 +842,9 @@ module.exports = {
|
|
|
837
842
|
ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG,
|
|
838
843
|
ERR_CONFIG_PROVIDER_NOT_SUPPORTED,
|
|
839
844
|
ERR_CONFIG_PROVIDER_LOAD_FAILED,
|
|
845
|
+
ERR_WALLET_TYPE_NOT_SUPPORTED,
|
|
840
846
|
ERR_INVALID_BIND_NAME,
|
|
841
|
-
|
|
847
|
+
ERR_WRONG_NUMBER_OF_BINDS,
|
|
842
848
|
ERR_BUFFER_LENGTH_INSUFFICIENT,
|
|
843
849
|
ERR_NCHAR_CS_NOT_SUPPORTED,
|
|
844
850
|
ERR_MISSING_CREDENTIALS,
|
|
@@ -897,6 +903,7 @@ module.exports = {
|
|
|
897
903
|
ERR_CONNECTION_CLOSED_CODE: `${ERR_PREFIX}-${ERR_CONNECTION_CLOSED}`,
|
|
898
904
|
ERR_OPERATION_NOT_SUPPORTED_ON_BFILE,
|
|
899
905
|
ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE,
|
|
906
|
+
ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES,
|
|
900
907
|
WRN_COMPILATION_CREATE,
|
|
901
908
|
assert,
|
|
902
909
|
assertArgCount,
|
package/lib/impl/aqQueue.js
CHANGED
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
'use strict';
|
|
28
28
|
|
|
29
29
|
const errors = require('../errors.js');
|
|
30
|
+
const BaseImpl = require('./base.js');
|
|
30
31
|
|
|
31
|
-
class AqQueueImpl {
|
|
32
|
+
class AqQueueImpl extends BaseImpl {
|
|
32
33
|
|
|
33
34
|
//---------------------------------------------------------------------------
|
|
34
35
|
// _getConnImpl()
|
package/lib/impl/base.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) 2024, Oracle and/or its affiliates.
|
|
2
|
+
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
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.
|
|
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.
|
|
15
|
+
// You may obtain a copy of the License at
|
|
16
|
+
//
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
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.
|
|
22
|
+
// See the License for the specific language governing permissions and
|
|
23
|
+
// limitations under the License.
|
|
24
|
+
//
|
|
25
|
+
//-----------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
'use strict';
|
|
28
|
+
|
|
29
|
+
class BaseImpl {
|
|
30
|
+
|
|
31
|
+
//---------------------------------------------------------------------------
|
|
32
|
+
// _getConnectTraceConfig()
|
|
33
|
+
//
|
|
34
|
+
// Retrieves connect trace config from connection object.
|
|
35
|
+
//---------------------------------------------------------------------------
|
|
36
|
+
_getConnectTraceConfig() {
|
|
37
|
+
const connImpl = this._getConnImpl();
|
|
38
|
+
if (connImpl) {
|
|
39
|
+
return connImpl._getConnectTraceConfig();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = BaseImpl;
|