Skip to content

Commit c2db4ae

Browse files
committed
Release 5.4.0
1 parent 2aadf73 commit c2db4ae

21 files changed

+138
-28
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
# node-oracledb-prebuilt-for-lambda
22

33
- This module is forked from the currently un-maintained [node-oracledb-for-lambda](https://github.com/nalbion/node-oracledb-for-lambda).
4-
- Core oracledb libraries are derived from [node-oracledb](https://github.com/oracle/node-oracledb) v5.3.0
5-
- 5.3.0: Prebuilt for use with AWS Lambda nodejs12.x Runtime (Built using nodejsv12.18.3)
4+
- Core oracledb libraries are derived from [node-oracledb](https://github.com/oracle/node-oracledb) v5.4.0
5+
- 5.4.0: Prebuilt for use with AWS Lambda nodejs12.x Runtime (Built using nodejsv12.18.3)
66
- Also tested to work with AWS Lambda nodejs14.x Runtime
77

88
The scripts to reproduce the build process can be found at [node-oracledb-lambda-test](https://github.com/romanbalayan/node-oracledb-lambda-test).
99

1010
# Usage
1111

1212
```bash
13-
npm install --save oracledb-prebuilt-for-lambda@5.3.0
13+
npm install --save oracledb-prebuilt-for-lambda@5.4.0
1414
```
1515

1616
# Versioning
1717
- Changed release version to match that of underlying node-oracledb version.
18-
- i.e. for release based on oracledb 5.3.0, release will be oracledb-prebuilt-for-lambda@5.3.0
18+
- i.e. for release based on oracledb 5.4.0, release will be oracledb-prebuilt-for-lambda@5.4.0
1919

2020

2121
# Releases
2222
| node-oracledb | oracledb-prebuilt-for-lambda |
2323
| ------------------- | ---------- |
24+
| 5.4.0 | 5.4.0 |
2425
| 5.3.0 | 5.3.0 |
2526
| 5.2.0 | 5.2.0 |
2627
| 5.1.0 | 5.1.0 |
@@ -31,6 +32,7 @@ npm install --save oracledb-prebuilt-for-lambda@5.3.0
3132

3233

3334
# Changelog
35+
- v5.4.0: [node-oracledb v5.4.0 changelog](https://github.com/oracle/node-oracledb/blob/main/CHANGELOG.md#node-oracledb-v540-9-jun-2022)
3436
- v5.3.0: [node-oracledb v5.3.0 changelog](https://github.com/oracle/node-oracledb/blob/main/CHANGELOG.md#node-oracledb-v530-22-oct-2021)
3537
- v5.2.0: [node-oracledb v5.2.0 changelog](https://github.com/oracle/node-oracledb/blob/main/CHANGELOG.md#node-oracledb-v520-7-jun-2021)
3638
- v5.1.0: [node-oracledb v5.1.0 changelog](https://github.com/oracle/node-oracledb/blob/master/CHANGELOG.md#node-oracledb-v510-8-dec-2020)

build/Release/oracledb.node

9.47 KB
Binary file not shown.

lib/aqDeqOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2019, 2022, Oracle and/or its affiliates.
22

33
//-----------------------------------------------------------------------------
44
//

lib/aqEnqOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2019, 2022, Oracle and/or its affiliates.
22

33
//-----------------------------------------------------------------------------
44
//

lib/aqMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2019, 2022, Oracle and/or its affiliates.
22

33
//-----------------------------------------------------------------------------
44
//

lib/aqQueue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2019, 2022, Oracle and/or its affiliates.
22

33
//-----------------------------------------------------------------------------
44
//

lib/connection.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2016, 2022, Oracle and/or its affiliates.
22

33
//-----------------------------------------------------------------------------
44
//
@@ -172,7 +172,20 @@ async function close(a1) {
172172
nodbUtil.assert(nodbUtil.isObject(a1), 'NJS-005', 1);
173173
options = a1;
174174
}
175-
await this._close(options);
175+
176+
// If already in the process of closing, throw an error instead of doing
177+
// a roundtrip
178+
if (this._closing) {
179+
throw new Error (nodbUtil.getErrorMessage('NJS-003'));
180+
}
181+
182+
this._closing = true;
183+
try {
184+
await this._close(options);
185+
} finally {
186+
this._closing = false;
187+
}
188+
176189
for (const cls of Object.values(this._dbObjectClasses)) {
177190
cls.prototype.constructor = Object;
178191
cls.prototype = null;
@@ -453,7 +466,6 @@ async function tpcRollback(xid) {
453466
}
454467

455468

456-
457469
// define class
458470
class Connection extends EventEmitter {
459471

@@ -462,6 +474,7 @@ class Connection extends EventEmitter {
462474
this._dbObjectClasses = {};
463475
this._requestQueue = [];
464476
this._inProgress = false;
477+
this._closing = false;
465478
}
466479

467480
// extend class with promisified functions
@@ -541,6 +554,18 @@ class Connection extends EventEmitter {
541554
return (this._getSodaDatabase());
542555
}
543556

557+
//--------------------------------------------------------------------------
558+
// isHealthy()
559+
// To get the health status of the connection.
560+
// NOTE: if this function returns false, the application must close the
561+
// connection obect.
562+
// This is a synchronous call.
563+
//---------------------------------------------------------------------------
564+
isHealthy() {
565+
return (!this._closing && this._isHealthy());
566+
}
567+
568+
544569
// The queryStream function is similar to execute except that it immediately
545570
// returns a QueryStream.
546571
queryStream(sql, binding, options) {

lib/dbObject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
1+
// Copyright (c) 2019, 2022, Oracle and/or its affiliates.
22
//
33
//----------------------------------------------------------------------------
44
//

lib/lob.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2016, 2022, Oracle and/or its affiliates.
22

33
//-----------------------------------------------------------------------------
44
//

lib/oracledb.js

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2015, 2022, Oracle and/or its affiliates.
22

33
//-----------------------------------------------------------------------------
44
//
@@ -105,6 +105,7 @@ class OracleDb {
105105
this.createPool = nodbUtil.callbackify(createPool).bind(_oracledb);
106106
this.shutdown = nodbUtil.callbackify(shutdown).bind(_oracledb);
107107
this.startup = nodbUtil.callbackify(startup).bind(_oracledb);
108+
this.initOracleClient = this.initOracleClient.bind(_oracledb);
108109
}
109110

110111
// temporary method for determining if an object is a date until
@@ -198,6 +199,39 @@ async function createPool(poolAttrs) {
198199
tempUsedPoolAliases[poolAlias] = true;
199200
}
200201

202+
if (adjustedPoolAttrs.accessToken !== undefined) {
203+
// token and privateKey must be set for token based
204+
// authentication
205+
if (adjustedPoolAttrs.accessToken.token === undefined ||
206+
adjustedPoolAttrs.accessToken.token === '' ||
207+
adjustedPoolAttrs.accessToken.privateKey === undefined ||
208+
adjustedPoolAttrs.accessToken.privateKey === '') {
209+
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
210+
}
211+
212+
// cannot set username or password for token based authentication
213+
if (adjustedPoolAttrs.user !== undefined ||
214+
adjustedPoolAttrs.password !== undefined) {
215+
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
216+
}
217+
218+
// homogeneous and externalAuth must be set to true for token based
219+
// authentication
220+
if (adjustedPoolAttrs.homogeneous === false ||
221+
adjustedPoolAttrs.externalAuth === false) {
222+
throw new Error(nodbUtil.getErrorMessage('NJS-085'));
223+
}
224+
225+
adjustedPoolAttrs.token = adjustedPoolAttrs.accessToken.token;
226+
adjustedPoolAttrs.privateKey =
227+
adjustedPoolAttrs.accessToken.privateKey;
228+
}
229+
230+
if (adjustedPoolAttrs.accessToken === undefined &&
231+
adjustedPoolAttrs.accessTokenCallback !== undefined) {
232+
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
233+
}
234+
201235
try {
202236
const pool = await this._createPool(adjustedPoolAttrs);
203237

@@ -270,6 +304,32 @@ async function getConnection(a1) {
270304

271305
// otherwise, create a new standalone connection
272306
} else {
307+
if (connAttrs.accessToken !== undefined) {
308+
// token and privateKey must be set for token based
309+
// authentication
310+
if (connAttrs.accessToken.token === undefined ||
311+
connAttrs.accessToken.token === '' ||
312+
connAttrs.accessToken.privateKey === undefined ||
313+
connAttrs.accessToken.privateKey === '') {
314+
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
315+
}
316+
317+
// cannot set username or password for token based authentication
318+
if (connAttrs.user !== undefined ||
319+
connAttrs.password !== undefined) {
320+
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
321+
}
322+
323+
// externalAuth must be set to true for token based authentication
324+
if (connAttrs.externalAuth === false) {
325+
throw new Error(nodbUtil.getErrorMessage('NJS-086'));
326+
}
327+
328+
connAttrs.token = connAttrs.accessToken.token;
329+
connAttrs.privateKey =
330+
connAttrs.accessToken.privateKey;
331+
}
332+
273333
try {
274334
return await this._getConnection(connAttrs);
275335
} catch (err) {

0 commit comments

Comments
 (0)