gremlin-aws-sigv4
Advanced tools
Comparing version 3.5.2 to 3.6.1
@@ -8,4 +8,10 @@ { | ||
"rules": { | ||
"no-underscore-dangle": 0 | ||
"no-underscore-dangle": 0, | ||
"max-len": [ | ||
"error", | ||
{ | ||
"code": 160 | ||
} | ||
] | ||
} | ||
} | ||
} |
@@ -23,3 +23,2 @@ const debug = require('debug')('gremlin-aws-sigv4:driver'); | ||
this.clientOptions = { | ||
connectOnStartup: true, | ||
mimeType: 'application/vnd.gremlin-v2.0+json', | ||
@@ -33,3 +32,8 @@ pingEnabled: true, | ||
this._rejections = {}; | ||
this._connect(); | ||
if (options.connectOnStartup != null) { | ||
delete this.clientOptions.connectOnStartup; | ||
} | ||
if (options.connectOnStartup !== false) { | ||
this._connect(); | ||
} | ||
} | ||
@@ -76,2 +80,3 @@ | ||
this._client._connection.on('error', (error) => this._errorHandler(error)); | ||
this._client.open(); | ||
this._client._connection._ws.on('open', () => this._connectHandler()); | ||
@@ -126,3 +131,3 @@ } | ||
debug('open'); | ||
return this._client.open(); | ||
this._connectSocket(); | ||
} | ||
@@ -129,0 +134,0 @@ |
{ | ||
"name": "gremlin-aws-sigv4", | ||
"version": "3.5.2", | ||
"version": "3.6.1", | ||
"main": "index.js", | ||
@@ -10,4 +10,8 @@ "scripts": { | ||
"test:unit": "jest test/unit", | ||
"test:e2e": "jest test/e2e" | ||
"test:e2e": "jest test/e2e", | ||
"prepare": "is-ci || husky install" | ||
}, | ||
"lint-staged": { | ||
"*.js": "eslint --fix" | ||
}, | ||
"repository": { | ||
@@ -29,12 +33,15 @@ "type": "git", | ||
"aws4": "^1.11.0", | ||
"debug": "^4.2.0", | ||
"gremlin": "^3.5.1" | ||
"debug": "^4.3.4", | ||
"gremlin": "^3.6.1" | ||
}, | ||
"devDependencies": { | ||
"dotenv": "^8.6.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-plugin-import": "^2.25.3", | ||
"jest": "^26.6.3", | ||
"nock": "^13.2.1" | ||
"dotenv": "^16.0.2", | ||
"eslint": "^8.23.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"husky": "^8.0.1", | ||
"is-ci": "^3.0.1", | ||
"jest": "^29.0.2", | ||
"lint-staged": "^13.0.3", | ||
"nock": "^13.2.9" | ||
}, | ||
@@ -41,0 +48,0 @@ "jest": { |
@@ -6,3 +6,5 @@ const gremlin = require('../..'); | ||
const connection = new gremlin.driver.AwsSigV4DriverRemoteConnection( | ||
host, port, opts, | ||
host, | ||
port, | ||
opts, | ||
() => { resolve({ connection, g: graph.traversal().withRemote(connection) }); }, | ||
@@ -9,0 +11,0 @@ (code, message) => { reject(new Error({ code, message })); }, |
@@ -28,3 +28,3 @@ /* eslint-disable-line no-new */ | ||
_ws: { | ||
on: jest.fn(), | ||
on: jest.fn((event, cb) => { if (event === 'open') { cb(); } }), | ||
}, | ||
@@ -207,8 +207,5 @@ }, | ||
describe('open', () => { | ||
it('should open the client connection', () => { | ||
const connection = new AwsSigV4DriverRemoteConnection(HOST, PORT, OPTS); | ||
const open = jest.fn(); | ||
connection._client = { open }; | ||
it('should open the client connection', (done) => { | ||
const connection = new AwsSigV4DriverRemoteConnection(HOST, PORT, { ...OPTS, openOnStartup: false }, () => { expect(1).toEqual(1); done(); }); | ||
connection.open(); | ||
expect(open).toHaveBeenCalled(); | ||
}); | ||
@@ -226,5 +223,3 @@ }); | ||
it('should reopen the connection and submit the query if autoReconnect is true', () => { | ||
const connection = new AwsSigV4DriverRemoteConnection( | ||
HOST, PORT, { ...OPTS, autoReconnect: true }, | ||
); | ||
const connection = new AwsSigV4DriverRemoteConnection(HOST, PORT, { ...OPTS, autoReconnect: true }); | ||
connection._client = null; | ||
@@ -235,5 +230,3 @@ connection.submit(null); | ||
it('should fail if autoReconnect is false', () => { | ||
const connection = new AwsSigV4DriverRemoteConnection( | ||
HOST, PORT, { ...OPTS, autoReconnect: false }, | ||
); | ||
const connection = new AwsSigV4DriverRemoteConnection(HOST, PORT, { ...OPTS, autoReconnect: false }); | ||
connection._client = null; | ||
@@ -240,0 +233,0 @@ connection.submit(null).catch((error) => { |
const nock = require('nock'); | ||
const http = require('http'); | ||
const https = require('https'); | ||
const httpGetSpy = jest.spyOn(http, 'get'); | ||
const httpsGetSpy = jest.spyOn(https, 'get'); | ||
const utils = require('../../lib/utils'); | ||
@@ -49,3 +44,3 @@ | ||
expect(url).toContain(host); | ||
expect(url).toContain(port); | ||
expect(url).toContain(`${port}`); | ||
expect(url).toEqual(`ws://${host}:${port}/gremlin`); | ||
@@ -58,3 +53,3 @@ | ||
expect(headers.Host).toContain(host); | ||
expect(headers.Host).toContain(port); | ||
expect(headers.Host).toContain(`${port}`); | ||
expect(headers.Authorization) | ||
@@ -79,3 +74,3 @@ .toContain('AWS4-HMAC-SHA256 ' | ||
expect(url).toContain(host); | ||
expect(url).toContain(port); | ||
expect(url).toContain(`${port}`); | ||
expect(url).toEqual(`ws://${host}:${port}/gremlin`); | ||
@@ -89,3 +84,3 @@ | ||
expect(headers.Host).toContain(host); | ||
expect(headers.Host).toContain(port); | ||
expect(headers.Host).toContain(`${port}`); | ||
expect(headers.Authorization) | ||
@@ -92,0 +87,0 @@ .toContain('AWS4-HMAC-SHA256 ' |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29631
18
603
2
9
Updateddebug@^4.3.4
Updatedgremlin@^3.6.1