Skip to content

Commit 85eb960

Browse files
committed
upgrade packages
1 parent 9d065bc commit 85eb960

File tree

6 files changed

+3003
-2721
lines changed

6 files changed

+3003
-2721
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
TEST_HOST = 'your-neptune-host'
2+
TEST_PORT = '8182'
3+
TEST_ACCESS_KEY_ID = 'access-key-id'
4+
TEST_SECRET_ACCESS_KEY = 'secret-access-key'
5+
TEST_REGION = 'aws-region-1'
6+
TEST_SECURE = 'false'

jest.setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('dotenv').config();

lib/driver/aws-sigv4-driver-remote-connection.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ class AwsSigV4DriverRemoteConnection extends gremlin.driver.RemoteConnection {
2020
this.try = 0;
2121
this.maxRetry = this.options.maxRetry || 10;
2222

23-
this.clientOptions = Object.assign({
23+
this.clientOptions = {
2424
connectOnStartup: true,
2525
mimeType: 'application/vnd.gremlin-v2.0+json',
2626
pingEnabled: true,
2727
pingInterval: 1000,
2828
pongTimeout: 2000,
29-
}, this.options);
29+
...this.options,
30+
};
3031

3132
this._rejections = {};
3233
this._connect();
@@ -65,10 +66,10 @@ class AwsSigV4DriverRemoteConnection extends gremlin.driver.RemoteConnection {
6566
_connectSocket() {
6667
const { url, headers } = getUrlAndHeaders(this.host, this.port, this.options, '/gremlin', this.secure ? 'wss' : 'ws');
6768
debug(`connect: ${JSON.stringify(url, headers)} (try #${this.try})`);
68-
this._client = new gremlin.driver.Client(url, Object.assign({ headers }, this.clientOptions));
69-
this._client._connection.on('log', log => this._logHandler(log));
69+
this._client = new gremlin.driver.Client(url, ({ headers, ...this.clientOptions }));
70+
this._client._connection.on('log', (log) => this._logHandler(log));
7071
this._client._connection.on('close', (code, message) => this._closeHandler(code, message));
71-
this._client._connection.on('error', error => this._errorHandler(error));
72+
this._client._connection.on('error', (error) => this._errorHandler(error));
7273
this._client._connection._ws.on('open', () => this._connectHandler());
7374
}
7475

@@ -111,7 +112,7 @@ class AwsSigV4DriverRemoteConnection extends gremlin.driver.RemoteConnection {
111112
}
112113

113114
_cancelPendingQueries(error) {
114-
Object.values(this._rejections).forEach(reject => reject(error));
115+
Object.values(this._rejections).forEach((reject) => reject(error));
115116
this._rejections = {};
116117
}
117118

@@ -134,7 +135,7 @@ class AwsSigV4DriverRemoteConnection extends gremlin.driver.RemoteConnection {
134135
})
135136
.catch(reject);
136137
})
137-
.then(result => result);
138+
.then((result) => result);
138139
}
139140

140141
/** @override */

lib/utils.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,14 @@ const getUrlAndHeaders = (host, port, credentials, canonicalUri, protocol) => {
3535
|| process.env.AWS_ACCESS_KEY_ID;
3636
const secretAccessKey = credentials.secretKey || credentials.secretAccessKey
3737
|| process.env.AWS_SECRET_ACCESS_KEY;
38-
const sessionToken = credentials.sessionToken || credentials.sessionToken
39-
|| process.env.AWS_SESSION_TOKEN;
38+
const sessionToken = credentials.sessionToken || process.env.AWS_SESSION_TOKEN;
4039
const region = credentials.region || process.env.AWS_DEFAULT_REGION;
4140

4241
if (!accessKeyId || !secretAccessKey) {
4342
throw new Error('Access key and secret key are required');
4443
}
4544

46-
const awsCreds = {
47-
accessKeyId, secretAccessKey, sessionToken,
48-
};
45+
const awsCreds = { accessKeyId, secretAccessKey, sessionToken };
4946
const sigOptions = {
5047
host: `${host}:${port}`,
5148
region,

0 commit comments

Comments
 (0)