Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gremlin

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gremlin - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## 2.5.0
- Support secure WebSockets
## 2.4.0

@@ -2,0 +5,0 @@ - Partial support for Gremlin-JavaScript language variant

15

lib/executeHandler.js

@@ -18,6 +18,6 @@ 'use strict';

function defaultExecuteHandler(messageStream, callback) {
var errored = false;
var objectMode = false;
let errored = false;
let objectMode = false;
(0, _highland2.default)(messageStream).stopOnError(function (err) {
(0, _highland2.default)(messageStream).stopOnError(err => {
// TODO: this does not seem to halt the stream properly, and make

@@ -28,9 +28,7 @@ // the callback being fired twice. We need to get rid of the ugly

callback(err);
}).map(function (_ref) {
var data = _ref.result.data;
}).map(({ result: { data } }) => {
objectMode = !_lodash2.default.isArray(data);
return data;
}).sequence().toArray(function (results) {
}).sequence().toArray(results => {
if (!errored) {

@@ -42,3 +40,2 @@ callback(null, objectMode ? results[0] : results);

exports.default = defaultExecuteHandler;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9leGVjdXRlSGFuZGxlci5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0RXhlY3V0ZUhhbmRsZXIiLCJtZXNzYWdlU3RyZWFtIiwiY2FsbGJhY2siLCJlcnJvcmVkIiwib2JqZWN0TW9kZSIsInN0b3BPbkVycm9yIiwiZXJyIiwibWFwIiwiZGF0YSIsInJlc3VsdCIsImlzQXJyYXkiLCJzZXF1ZW5jZSIsInRvQXJyYXkiLCJyZXN1bHRzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQTs7OztBQUNBOzs7Ozs7QUFHQSxTQUFTQSxxQkFBVCxDQUErQkMsYUFBL0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aGUgc3RyZWFtIHByb3Blcmx5LCBhbmQgbWFrZVxuICAgICAgLy8gdGhlIGNhbGxiYWNrIGJlaW5nIGZpcmVkIHR3aWNlLiBXZSBuZWVkIHRvIGdldCByaWQgb2YgdGhlIHVnbHlcbiAgICAgIC8vIGVycm9yZWQgdmFyaWFibGUgY2hlY2suXG4gICAgICBlcnJvcmVkID0gdHJ1ZTtcbiAgICAgIGNhbGxiYWNrKGVycik7XG4gICAgfSlcbiAgICAubWFwKCh7IHJlc3VsdDoge8KgZGF0YSB9IH0pID0+IHtcbiAgICAgIG9iamVjdE1vZGUgPSAhXy5pc0FycmF5KGRhdGEpO1xuXG4gICAgICByZXR1cm4gZGF0YTtcbiAgICB9KVxuICAgIC5zZXF1ZW5jZSgpXG4gICAgLnRvQXJyYXkoKHJlc3VsdHMpID0+IHtcbiAgICAgIGlmICghZXJyb3JlZCkge1xuICAgICAgICBjYWxsYmFjayhudWxsLCBvYmplY3RNb2RlID8gcmVzdWx0c1swXSA6IHJlc3VsdHMpO1xuICAgICAgfVxuICAgIH0pO1xufVxuXG5leHBvcnQgZGVmYXVsdCBkZWZhdWx0RXhlY3V0ZUhhbmRsZXI7XG4iXX0=
exports.default = defaultExecuteHandler;

@@ -7,5 +7,5 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /*jslint -W079 */
/*jslint node: true */
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -48,32 +48,14 @@ var _events = require('events');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class GremlinClient extends _events.EventEmitter {
constructor(port = 8182, host = 'localhost', options = {}) {
super();
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
this.port = port;
this.host = host;
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*jslint -W079 */
/*jslint node: true */
var GremlinClient = function (_EventEmitter) {
_inherits(GremlinClient, _EventEmitter);
function GremlinClient() {
var port = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 8182;
var host = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'localhost';
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
_classCallCheck(this, GremlinClient);
var _this = _possibleConstructorReturn(this, (GremlinClient.__proto__ || Object.getPrototypeOf(GremlinClient)).call(this));
_this.port = port;
_this.host = host;
// Breaking change in v3.2.2, connect to /gremlin rather than /
// See: https://groups.google.com/d/topic/gremlin-users/x4hiHsmTsHM/discussion
var _options$path = options.path,
path = _options$path === undefined ? '/gremlin' : _options$path;
const { path = '/gremlin' } = options;
_this.options = _extends({
this.options = _extends({
language: 'gremlin-groovy',

@@ -84,446 +66,361 @@ session: false,

accept: 'application/json',
executeHandler: _executeHandler2.default
executeHandler: _executeHandler2.default,
ssl: false,
rejectUnauthorized: true
}, options, {
path: path.length && !path.startsWith('/') ? '/' + path : path
path: path.length && !path.startsWith('/') ? `/${path}` : path
});
_this.useSession = _this.options.session;
this.useSession = this.options.session;
if (_this.useSession) {
_this.sessionId = _nodeUuid2.default.v1();
if (this.useSession) {
this.sessionId = _nodeUuid2.default.v1();
}
_this.connected = false;
_this.queue = [];
this.connected = false;
this.queue = [];
_this.commands = {};
this.commands = {};
_this.connection = _this.createConnection({
port: port,
host: host,
path: _this.options.path
const { ssl, rejectUnauthorized } = this.options;
this.connection = this.createConnection({
port,
host,
path: this.options.path,
ssl,
rejectUnauthorized
});
return _this;
}
_createClass(GremlinClient, [{
key: 'createConnection',
value: function createConnection(_ref) {
var _this2 = this;
createConnection({ port, host, path, ssl, rejectUnauthorized }) {
const connection = new _WebSocketGremlinConnection2.default({ port, host, path, ssl, rejectUnauthorized });
var port = _ref.port,
host = _ref.host,
path = _ref.path;
connection.on('open', () => this.onConnectionOpen());
connection.on('error', error => this.handleError(error));
connection.on('message', message => this.handleProtocolMessage(message));
connection.on('close', event => this.handleDisconnection(event));
var connection = new _WebSocketGremlinConnection2.default({ port: port, host: host, path: path });
return connection;
}
connection.on('open', function () {
return _this2.onConnectionOpen();
});
connection.on('error', function (error) {
return _this2.handleError(error);
});
connection.on('message', function (message) {
return _this2.handleProtocolMessage(message);
});
connection.on('close', function (event) {
return _this2.handleDisconnection(event);
});
closeConnection() {
this.connection.close();
}
return connection;
}
}, {
key: 'closeConnection',
value: function closeConnection() {
this.connection.close();
}
}, {
key: 'handleError',
value: function handleError(err) {
this.connected = false;
this.emit('error', err);
}
}, {
key: 'warn',
value: function warn(code, message) {
this.emit('warning', {
code: code,
message: message
});
}
handleError(err) {
this.connected = false;
this.emit('error', err);
}
/**
* Process all incoming raw message events sent by Gremlin Server, and dispatch
* to the appropriate command.
*
* @param {MessageEvent} event
*/
warn(code, message) {
this.emit('warning', {
code,
message
});
}
}, {
key: 'handleProtocolMessage',
value: function handleProtocolMessage(message) {
var rawMessage = void 0,
requestId = void 0,
statusCode = void 0,
statusMessage = void 0;
try {
var data = message.data;
var buffer = new Buffer(data, 'binary');
rawMessage = JSON.parse(buffer.toString('utf-8'));
requestId = rawMessage.requestId;
statusCode = rawMessage.status.code;
statusMessage = rawMessage.status.message;
} catch (e) {
this.warn('MalformedResponse', 'Received malformed response message');
return;
}
// If we didn't find a stream for this response, emit a warning on the
// client
if (!this.commands[requestId]) {
this.warn('OrphanedResponse', 'Received response for missing or closed request: ' + requestId);
return;
}
var _commands$requestId$m = this.commands[requestId].messageStream,
messageStream = _commands$requestId$m === undefined ? null : _commands$requestId$m;
switch (statusCode) {
case 200:
// SUCCESS
delete this.commands[requestId]; // TODO: optimize performance
messageStream.push(rawMessage);
messageStream.push(null);
break;
case 204:
// NO_CONTENT
delete this.commands[requestId];
messageStream.push(null);
break;
case 206:
// PARTIAL_CONTENT
messageStream.push(rawMessage);
break;
default:
delete this.commands[requestId];
messageStream.emit('error', new Error(statusMessage + ' (Error ' + statusCode + ')'));
break;
}
/**
* Process all incoming raw message events sent by Gremlin Server, and dispatch
* to the appropriate command.
*
* @param {MessageEvent} event
*/
handleProtocolMessage(message) {
let rawMessage, requestId, statusCode, statusMessage;
try {
const { data } = message;
const buffer = new Buffer(data, 'binary');
rawMessage = JSON.parse(buffer.toString('utf-8'));
requestId = rawMessage.requestId;
statusCode = rawMessage.status.code;
statusMessage = rawMessage.status.message;
} catch (e) {
this.warn('MalformedResponse', 'Received malformed response message');
return;
}
/**
* Handle the WebSocket onOpen event, flag the client as connected and
* process command queue.
*/
}, {
key: 'onConnectionOpen',
value: function onConnectionOpen() {
this.connected = true;
this.emit('connect');
this.executeQueue();
// If we didn't find a stream for this response, emit a warning on the
// client
if (!this.commands[requestId]) {
this.warn('OrphanedResponse', `Received response for missing or closed request: ${requestId}`);
return;
}
}, {
key: 'handleDisconnection',
const { messageStream = null } = this.commands[requestId];
/**
* @param {CloseEvent} event
*/
value: function handleDisconnection(event) {
this.cancelPendingCommands({
message: 'WebSocket closed',
details: event
});
switch (statusCode) {
case 200:
// SUCCESS
delete this.commands[requestId]; // TODO: optimize performance
messageStream.push(rawMessage);
messageStream.push(null);
break;
case 204:
// NO_CONTENT
delete this.commands[requestId];
messageStream.push(null);
break;
case 206:
// PARTIAL_CONTENT
messageStream.push(rawMessage);
break;
default:
delete this.commands[requestId];
messageStream.emit('error', new Error(statusMessage + ' (Error ' + statusCode + ')'));
break;
}
}, {
key: 'executeQueue',
}
/**
* Handle the WebSocket onOpen event, flag the client as connected and
* process command queue.
*/
onConnectionOpen() {
this.connected = true;
this.emit('connect');
/**
* Process the current command queue, sending commands to Gremlin Server
* (First In, First Out).
*/
value: function executeQueue() {
while (this.queue.length > 0) {
var _queue$shift = this.queue.shift(),
message = _queue$shift.message;
this.executeQueue();
}
this.sendMessage(message);
}
}
}, {
key: 'cancelPendingCommands',
/**
* @param {CloseEvent} event
*/
handleDisconnection(event) {
this.cancelPendingCommands({
message: 'WebSocket closed',
details: event
});
}
/**
* @param {Object} reason
*/
value: function cancelPendingCommands(_ref2) {
var message = _ref2.message,
details = _ref2.details;
var commands = this.commands;
var command = void 0;
var error = new Error(message);
error.details = details;
// Empty queue
this.queue.length = 0;
this.commands = {};
Object.keys(commands).forEach(function (key) {
command = commands[key];
command.messageStream.emit('error', error);
});
/**
* Process the current command queue, sending commands to Gremlin Server
* (First In, First Out).
*/
executeQueue() {
while (this.queue.length > 0) {
let { message } = this.queue.shift();
this.sendMessage(message);
}
}, {
key: 'buildMessage',
}
/**
* @param {Object} reason
*/
cancelPendingCommands({ message, details }) {
const commands = this.commands;
let command;
const error = new Error(message);
error.details = details;
/**
* For a given script string and optional bound parameters, build a protocol
* message object to be sent to Gremlin Server.
*
* @param {String|Function} script
* @param {Object} bindings
* @param {Object} message
*/
value: function buildMessage(rawScript) {
var rawBindings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var baseMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
// Empty queue
this.queue.length = 0;
this.commands = {};
var _Utils$buildQueryFrom = Utils.buildQueryFromSignature(rawScript, rawBindings),
gremlin = _Utils$buildQueryFrom.gremlin,
bindings = _Utils$buildQueryFrom.bindings;
Object.keys(commands).forEach(key => {
command = commands[key];
command.messageStream.emit('error', error);
});
}
var _options = this.options,
processor = _options.processor,
op = _options.op,
accept = _options.accept,
language = _options.language,
aliases = _options.aliases;
/**
* For a given script string and optional bound parameters, build a protocol
* message object to be sent to Gremlin Server.
*
* @param {String|Function} script
* @param {Object} bindings
* @param {Object} message
*/
buildMessage(rawScript, rawBindings = {}, baseMessage = {}) {
let { gremlin, bindings } = Utils.buildQueryFromSignature(rawScript, rawBindings);
const { processor, op, accept, language, aliases } = this.options;
const baseArgs = { gremlin, bindings, accept, language, aliases };
const args = _lodash2.default.defaults(baseMessage.args || {}, baseArgs);
var baseArgs = { gremlin: gremlin, bindings: bindings, accept: accept, language: language, aliases: aliases };
var args = _lodash2.default.defaults(baseMessage.args || {}, baseArgs);
const message = _extends({
requestId: _nodeUuid2.default.v1(),
processor,
op,
args
}, baseMessage);
var message = _extends({
requestId: _nodeUuid2.default.v1(),
processor: processor,
op: op,
args: args
}, baseMessage);
if (this.useSession) {
// Assume that people want to use the 'session' processor unless specified
message.processor = message.processor || processor || 'session';
message.args.session = this.sessionId;
}
if (this.useSession) {
// Assume that people want to use the 'session' processor unless specified
message.processor = message.processor || processor || 'session';
message.args.session = this.sessionId;
}
return message;
}
return message;
}
}, {
key: 'sendMessage',
value: function sendMessage(message) {
var serializedMessage = this.options.accept + JSON.stringify(message);
serializedMessage = unescape(encodeURIComponent(serializedMessage));
sendMessage(message) {
let serializedMessage = this.options.accept + JSON.stringify(message);
serializedMessage = unescape(encodeURIComponent(serializedMessage));
// Let's start packing the message into binary
// mimeLength(1) + mimeType Length + serializedMessage Length
var binaryMessage = new Uint8Array(1 + serializedMessage.length);
binaryMessage[0] = this.options.accept.length;
// Let's start packing the message into binary
// mimeLength(1) + mimeType Length + serializedMessage Length
let binaryMessage = new Uint8Array(1 + serializedMessage.length);
binaryMessage[0] = this.options.accept.length;
for (var i = 0; i < serializedMessage.length; i++) {
binaryMessage[i + 1] = serializedMessage.charCodeAt(i);
}
this.connection.sendMessage(binaryMessage);
for (let i = 0; i < serializedMessage.length; i++) {
binaryMessage[i + 1] = serializedMessage.charCodeAt(i);
}
}, {
key: 'execute',
this.connection.sendMessage(binaryMessage);
}
/**
* Asynchronously send a script to Gremlin Server for execution and fire
* the provided callback when all results have been fetched.
*
* This method internally uses a stream to handle the potential concatenation
* of results.
*
* Callback signature: (Error, Array<result>)
*
* @public
* @param {String|Function} script
* @param {Object} bindings
* @param {Object} message
* @param {Function} callback
*/
value: function execute(script) {
var bindings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
/**
* Asynchronously send a script to Gremlin Server for execution and fire
* the provided callback when all results have been fetched.
*
* This method internally uses a stream to handle the potential concatenation
* of results.
*
* Callback signature: (Error, Array<result>)
*
* @public
* @param {String|Function} script
* @param {Object} bindings
* @param {Object} message
* @param {Function} callback
*/
execute(script, bindings = {}, message = {}) {
let callback = arguments[arguments.length - 1];
var callback = arguments[arguments.length - 1];
if (typeof message === 'function') {
callback = message;
message = {};
}
var messageStream = this.messageStream(script, bindings, message);
// TO CHECK: errors handling could be improved
// See https://groups.google.com/d/msg/nodejs/lJYT9hZxFu0/L59CFbqWGyYJ
// for an example using domains
var executeHandler = this.options.executeHandler;
executeHandler(messageStream, callback);
if (typeof message === 'function') {
callback = message;
message = {};
}
/**
* Execute the script and return a stream of distinct/single results.
* This method reemits a distinct data event for each returned result, which
* makes the stream behave as if `resultIterationBatchSize` was set to 1.
*
* If you do not wish this behavior, please use client.messageStream() instead.
*
* Even though this method uses Highland.js internally, it does not return
* a high level Highland readable stream so we do not risk having to deal
* with unexpected API breaking changes as Highland.js evolves.
*
* @return {ReadableStream} A Node.js Stream2
*/
const messageStream = this.messageStream(script, bindings, message);
}, {
key: 'stream',
value: function stream(script, bindings, message) {
var messageStream = this.messageStream(script, bindings, message);
var _ = _highland2.default; // override lo-dash locally
// TO CHECK: errors handling could be improved
// See https://groups.google.com/d/msg/nodejs/lJYT9hZxFu0/L59CFbqWGyYJ
// for an example using domains
const { executeHandler } = this.options;
// Create a local highland 'through' pipeline so we don't expose
// a Highland stream to the end user, but a standard Node.js Stream2
var through = _.pipeline(_.map(function (_ref3) {
var data = _ref3.result.data;
return data;
}), _.sequence());
executeHandler(messageStream, callback);
}
var rawStream = messageStream.pipe(through);
/**
* Execute the script and return a stream of distinct/single results.
* This method reemits a distinct data event for each returned result, which
* makes the stream behave as if `resultIterationBatchSize` was set to 1.
*
* If you do not wish this behavior, please use client.messageStream() instead.
*
* Even though this method uses Highland.js internally, it does not return
* a high level Highland readable stream so we do not risk having to deal
* with unexpected API breaking changes as Highland.js evolves.
*
* @return {ReadableStream} A Node.js Stream2
*/
stream(script, bindings, message) {
const messageStream = this.messageStream(script, bindings, message);
const _ = _highland2.default; // override lo-dash locally
messageStream.on('error', function (e) {
rawStream.emit('error', new Error(e));
});
// Create a local highland 'through' pipeline so we don't expose
// a Highland stream to the end user, but a standard Node.js Stream2
const through = _.pipeline(_.map(({ result: { data } }) => data), _.sequence());
return rawStream;
}
}, {
key: 'messageStream',
let rawStream = messageStream.pipe(through);
messageStream.on('error', e => {
rawStream.emit('error', new Error(e));
});
/**
* Execute the script and return a stream of raw messages returned by Gremlin
* Server.
* This method does not reemit one distinct data event per result. It directly
* emits the raw messages returned by Gremlin Server as they are received.
*
* Although public, this is a low level method intended to be used for
* advanced usages.
*
* @public
* @param {String|Function} script
* @param {Object} bindings
* @param {Object} message
* @return {MessageStream}
*/
value: function messageStream(script, bindings, rawMessage) {
var stream = new _MessageStream2.default({ objectMode: true });
return rawStream;
}
var command = {
message: this.buildMessage(script, bindings, rawMessage),
messageStream: stream
};
/**
* Execute the script and return a stream of raw messages returned by Gremlin
* Server.
* This method does not reemit one distinct data event per result. It directly
* emits the raw messages returned by Gremlin Server as they are received.
*
* Although public, this is a low level method intended to be used for
* advanced usages.
*
* @public
* @param {String|Function} script
* @param {Object} bindings
* @param {Object} message
* @return {MessageStream}
*/
messageStream(script, bindings, rawMessage) {
let stream = new _MessageStream2.default({ objectMode: true });
this.sendCommand(command); //todo improve for streams
const command = {
message: this.buildMessage(script, bindings, rawMessage),
messageStream: stream
};
return stream;
}
}, {
key: 'sendCommand',
this.sendCommand(command); //todo improve for streams
return stream;
}
/**
* Send a command to Gremlin Server, or add it to queue if the connection
* is not established.
*
* @param {Object} command
*/
value: function sendCommand(command) {
var message = command.message,
requestId = command.message.requestId;
/**
* Send a command to Gremlin Server, or add it to queue if the connection
* is not established.
*
* @param {Object} command
*/
sendCommand(command) {
const {
message,
message: {
requestId
}
} = command;
this.commands[requestId] = command;
this.commands[requestId] = command;
if (this.connected) {
this.sendMessage(message);
} else {
this.queue.push(command);
}
if (this.connected) {
this.sendMessage(message);
} else {
this.queue.push(command);
}
}, {
key: 'traversalSource',
value: function traversalSource() {
var _this3 = this;
}
var g = _zer.gremlin.g;
traversalSource() {
const { g } = _zer.gremlin;
let chain = g;
var chain = g;
const awaitable = new Proxy(g, {
get: (traversal, name, receiver) => {
if (name === 'toPromise') {
return () => new Promise((resolve, reject) => {
const { query, params } = (0, _zer.renderChain)(chain);
this.execute(query, params, (err, result) => {
if (err) {
return reject(err);
}
resolve(result);
});
});
}
var awaitable = new Proxy(g, {
get: function get(traversal, name, receiver) {
if (name === 'toPromise') {
return function () {
return new Promise(function (resolve, reject) {
var _renderChain = (0, _zer.renderChain)(chain),
query = _renderChain.query,
params = _renderChain.params;
chain = chain[name];
_this3.execute(query, params, function (err, result) {
if (err) {
return reject(err);
}
resolve(result);
});
});
};
return new Proxy(traversal, {
get(target2, name2, receiver2) {
target2 = target2[name];
return awaitable;
}
})[name];
},
apply(traversal, thisArg, args) {
Reflect.apply(chain, null, args);
chain = chain[name];
return awaitable;
}
});
return new Proxy(traversal, {
get: function get(target2, name2, receiver2) {
target2 = target2[name];
return awaitable;
}
})[name];
},
apply: function apply(traversal, thisArg, args) {
Reflect.apply(chain, null, args);
return awaitable;
}
}
return awaitable;
}
});
return awaitable;
}
}]);
return GremlinClient;
}(_events.EventEmitter);
exports.default = GremlinClient;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9HcmVtbGluQ2xpZW50LmpzIl0sIm5hbWVzIjpbIlV0aWxzIiwiR3JlbWxpbkNsaWVudCIsInBvcnQiLCJob3N0Iiwib3B0aW9ucyIsInBhdGgiLCJsYW5ndWFnZSIsInNlc3Npb24iLCJvcCIsInByb2Nlc3NvciIsImFjY2VwdCIsImV4ZWN1dGVIYW5kbGVyIiwibGVuZ3RoIiwic3RhcnRzV2l0aCIsInVzZVNlc3Npb24iLCJzZXNzaW9uSWQiLCJ2MSIsImNvbm5lY3RlZCIsInF1ZXVlIiwiY29tbWFuZHMiLCJjb25uZWN0aW9uIiwiY3JlYXRlQ29ubmVjdGlvbiIsIm9uIiwib25Db25uZWN0aW9uT3BlbiIsImVycm9yIiwiaGFuZGxlRXJyb3IiLCJtZXNzYWdlIiwiaGFuZGxlUHJvdG9jb2xNZXNzYWdlIiwiZXZlbnQiLCJoYW5kbGVEaXNjb25uZWN0aW9uIiwiY2xvc2UiLCJlcnIiLCJlbWl0IiwiY29kZSIsInJhd01lc3NhZ2UiLCJyZXF1ZXN0SWQiLCJzdGF0dXNDb2RlIiwic3RhdHVzTWVzc2FnZSIsImRhdGEiLCJidWZmZXIiLCJCdWZmZXIiLCJKU09OIiwicGFyc2UiLCJ0b1N0cmluZyIsInN0YXR1cyIsImUiLCJ3YXJuIiwibWVzc2FnZVN0cmVhbSIsInB1c2giLCJFcnJvciIsImV4ZWN1dGVRdWV1ZSIsImNhbmNlbFBlbmRpbmdDb21tYW5kcyIsImRldGFpbHMiLCJzaGlmdCIsInNlbmRNZXNzYWdlIiwiY29tbWFuZCIsIk9iamVjdCIsImtleXMiLCJmb3JFYWNoIi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geyBxdWVyeSwgcGFyYW1zIH0gPSByZW5kZXJDaGFpbihjaGFpbik7XG4gICAgICAgICAgICB0aGlzLmV4ZWN1dGUocXVlcnksIHBhcmFtcywgKGVyciwgcmVzdWx0KSA9PiB7XG4gICAgICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVqZWN0KGVycik7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmVzb2x2ZShyZXN1bHQpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICBjaGFpbiA9IGNoYWluW25hbWVdO1xuXG4gICAgICAgIHJldHVybiBuZXcgUHJveHkodHJhdmVyc2FsLCB7XG4gICAgICAgICAgZ2V0KHRhcmdldDIsIG5hbWUyLCByZWNlaXZlcjIpIHtcbiAgICAgICAgICAgIHRhcmdldDIgPSB0YXJnZXQyW25hbWVdO1xuICAgICAgICAgICAgcmV0dXJuIGF3YWl0YWJsZTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pW25hbWVdO1xuICAgICAgfSxcbiAgICAgIGFwcGx5KHRyYXZlcnNhbCwgdGhpc0FyZywgYXJncykge1xuICAgICAgICBSZWZsZWN0LmFwcGx5KGNoYWluLCBudWxsLCBhcmdzKTtcblxuICAgICAgICByZXR1cm4gYXdhaXRhYmxlO1xuICAgICAgfVxuICAgIH0pO1xuXG4gICAgcmV0dXJuIGF3YWl0YWJsZTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBHcmVtbGluQ2xpZW50O1xuIl19
exports.default = GremlinClient;

@@ -8,4 +8,2 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _zer = require('zer');

@@ -15,3 +13,3 @@

enumerable: true,
get: function get() {
get: function () {
return _zer.gremlin;

@@ -37,3 +35,3 @@ }

function createClient(port, host, options) {
if ((typeof port === 'undefined' ? 'undefined' : _typeof(port)) === 'object') {
if (typeof port === 'object') {
options = port;

@@ -43,3 +41,3 @@ port = undefined;

if ((typeof host === 'undefined' ? 'undefined' : _typeof(host)) === 'object') {
if (typeof host === 'object') {
options = host;

@@ -59,8 +57,4 @@ host = undefined;

*/
var makePromise = function makePromise(client, query) {
var promise = new Promise(function (resolve, reject) {
return client.execute(query, function (err, results) {
return err ? reject(err) : resolve(results);
});
});
const makePromise = (client, query) => {
const promise = new Promise((resolve, reject) => client.execute(query, (err, results) => err ? reject(err) : resolve(results)));
// Let's attach the query for easier debugging

@@ -72,7 +66,3 @@ promise.query = query;

var makeTemplateTag = exports.makeTemplateTag = function makeTemplateTag(client) {
return function () {
return makePromise(client, _gremlinTemplateString2.default.apply(undefined, arguments));
};
};
const makeTemplateTag = exports.makeTemplateTag = client => (...gremlinChunks) => makePromise(client, (0, _gremlinTemplateString2.default)(...gremlinChunks));

@@ -88,15 +78,8 @@ /**

*/
var bindForClient = exports.bindForClient = function bindForClient(client, functions) {
return (0, _lodash2.default)(functions).mapValues(function (fn) {
return function () {
return makePromise(client, fn.apply(undefined, arguments));
};
}).value();
};
const bindForClient = exports.bindForClient = (client, functions) => (0, _lodash2.default)(functions).mapValues(fn => (...args) => makePromise(client, fn(...args))).value();
exports.default = {
createClient: createClient,
makeTemplateTag: makeTemplateTag,
bindForClient: bindForClient
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJncmVtbGluIiwiY3JlYXRlQ2xpZW50IiwicG9ydCIsImhvc3QiLCJvcHRpb25zIiwidW5kZWZpbmVkIiwibWFrZVByb21pc2UiLCJjbGllbnQiLCJxdWVyeSIsInByb21pc2UiLCJQcm9taXNlIiwicmVzb2x2ZSIsInJlamVjdCIsImV4ZWN1dGUiLCJ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dGUoLi4uZ3JlbWxpbkNodW5rcykpO1xuXG4vKipcbiAqIEdpdmVuIGEgbWFwIG9mIGZ1bmN0aW9ucyByZXR1cm5pbmcgcXVlcnkgb2JqZWN0cywgcmV0dXJucyBhIG1hcFxuICogb2YgZnVuY3Rpb24gcHJvbWlzaW5nIGV4ZWN1dGlvbiBvZiB0aGVzZSBxdWVyaWVzIHdpdGggdGhlIGdpdmVuIEdyZW1saW5cbiAqIGNsaWVudC5cbiAqXG4gKiBAcGFyYW0gIHtHcmVtbGluQ2xpZW50fSBjbGllbnQgR3JlbWxpbiBjbGllbnQgdG8gZXhlY3V0ZSBxdWVyaWVzIHdpdGhcbiAqIEBwYXJhbSAge09iamVjdDxTdHJpbmcsIEZ1bmN0aW9uPE9iamVjdD4+fSBmdW5jdGlvbnNcbiAqIEByZXR1cm4ge09iamVjdDxTdHJpbmcsIEZ1bmN0aW9uPFByb21pc2U8UmVzdWx0cz4+Pn1cbiAqL1xuZXhwb3J0IGNvbnN0IGJpbmRGb3JDbGllbnQgPSAoY2xpZW50LCBmdW5jdGlvbnMpID0+IF8oZnVuY3Rpb25zKVxuICAubWFwVmFsdWVzKChmbikgPT4gKC4uLmFyZ3MpID0+IG1ha2VQcm9taXNlKGNsaWVudCwgZm4oLi4uYXJncykpKVxuICAudmFsdWUoKTtcblxuXG5leHBvcnQgZGVmYXVsdCB7XG4gIGNyZWF0ZUNsaWVudCxcbiAgbWFrZVRlbXBsYXRlVGFnLFxuICBiaW5kRm9yQ2xpZW50XG59XG4iXX0=
createClient,
makeTemplateTag,
bindForClient
};

@@ -7,4 +7,2 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _readableStream = require('readable-stream');

@@ -16,34 +14,12 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class MessageStream extends _readableStream2.default {
constructor(...args) {
super(...args);
}
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var MessageStream = function (_ReadableStream) {
_inherits(MessageStream, _ReadableStream);
function MessageStream() {
var _ref;
_classCallCheck(this, MessageStream);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _possibleConstructorReturn(this, (_ref = MessageStream.__proto__ || Object.getPrototypeOf(MessageStream)).call.apply(_ref, [this].concat(args)));
_read() {
this._paused = false;
}
}
_createClass(MessageStream, [{
key: '_read',
value: function _read() {
this._paused = false;
}
}]);
return MessageStream;
}(_readableStream2.default);
exports.default = MessageStream;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NZXNzYWdlU3RyZWFtLmpzIl0sIm5hbWVzIjpbIk1lc3NhZ2VTdHJlYW0iLCJhcmdzIiwiX3BhdXNlZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFBQTs7Ozs7Ozs7Ozs7O0lBR01BLGE7OztBQUNKLDJCQUFxQjtBQUFBOztBQUFBOztBQUFBLHNDQUFOQyxJQUFNO0FBQU5BLFVBQU07QUFBQTs7QUFBQSxvSkFDVkEsSUFEVTtBQUVwQjs7Ozs0QkFFTztBQUNOLFdBQUtDLE9BQUwsR0FBZSxLQUFmO0FBQ0Q7Ozs7OztrQkFHWUYsYSIsImZpbGUiOiJNZXNzYWdlU3RyZWFtLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWRhYmxlU3RyZWFtIGZyb20gJ3JlYWRhYmxlLXN0cmVhbSc7XG5cblxuY2xhc3MgTWVzc2FnZVN0cmVhbSBleHRlbmRzIFJlYWRhYmxlU3RyZWFtIHtcbiAgY29uc3RydWN0b3IoLi4uYXJncykge1xuICAgIHN1cGVyKC4uLmFyZ3MpXG4gIH1cblxuICBfcmVhZCgpIHtcbiAgICB0aGlzLl9wYXVzZWQgPSBmYWxzZTtcbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBNZXNzYWdlU3RyZWFtO1xuIl19
exports.default = MessageStream;

@@ -27,21 +27,15 @@ 'use strict';

*/
function buildQueryFromSignature() {
var rawScript = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var rawBindings = arguments[1];
var _rawScript$gremlin = rawScript.gremlin,
gremlin = _rawScript$gremlin === undefined ? rawScript : _rawScript$gremlin,
_rawScript$bindings = rawScript.bindings,
bindings = _rawScript$bindings === undefined ? rawBindings : _rawScript$bindings;
function buildQueryFromSignature(rawScript = '', rawBindings) {
const {
gremlin = rawScript,
bindings = rawBindings
} = rawScript;
return {
gremlin: gremlin,
gremlin,
// Remap 'undefined' bindings as 'null' values that would otherwise
// result in missing/unbound variables in the Gremlin script execution
// context.
bindings: _lodash2.default.mapValues(_extends({}, bindings, rawBindings), function (value) {
return _lodash2.default.isUndefined(value) ? null : value;
})
bindings: _lodash2.default.mapValues(_extends({}, bindings, rawBindings), value => _lodash2.default.isUndefined(value) ? null : value)
};
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlscy5qcyJdLCJuYW1lcyI6WyJidWlsZFF1ZXJ5RnJ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1ldGVyLCBhbnkgYmluZGluZ3Mgc3VwcGxpZWRcbiAqIGFzIHRoZSBsYXN0IHBhcmFtZXRlciB3aWxsIGJlIHNoYWxsb3ctbWVyZ2VkLlxuICpcbiAqIEBwYXJhbSB7U3RyaW5nfE9iamVjdHxGdW5jdGlvbn0gcmF3U2NyaXB0XG4gKiBAcGFyYW0ge09iamVjdH0gcmF3QmluZGluZ3NcbiAqIEByZXR1cm4ge09iamVjdH06IHsgZ3JlbWxpbjxTdHJpbmc+LCBiaW5kaW5nczxPYmplY3Q+IH1cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGJ1aWxkUXVlcnlGcm9tU2lnbmF0dXJlKHJhd1NjcmlwdCA9ICcnLCByYXdCaW5kaW5ncykge1xuICBjb25zdCB7XG4gICAgZ3JlbWxpbiA9IHJhd1NjcmlwdCxcbiAgICBiaW5kaW5ncyA9IHJhd0JpbmRpbmdzXG4gIH0gPSByYXdTY3JpcHQ7XG5cbiAgcmV0dXJuIHtcbiAgICBncmVtbGluLFxuICAgIC8vIFJlbWFwICd1bmRlZmluZWQnIGJpbmRpbmdzIGFzICdudWxsJyB2YWx1ZXMgdGhhdCB3b3VsZCBvdGhlcndpc2VcbiAgICAvLyByZXN1bHQgaW4gbWlzc2luZy91bmJvdW5kIHZhcmlhYmxlcyBpbiB0aGUgR3JlbWxpbiBzY3JpcHQgZXhlY3V0aW9uXG4gICAgLy8gY29udGV4dC5cbiAgICBiaW5kaW5nczogXy5tYXBWYWx1ZXMoeyAuLi5iaW5kaW5ncywgLi4ucmF3QmluZGluZ3MgfSwgKHZhbHVlKSA9PiBfLmlzVW5kZWZpbmVkKHZhbHVlKSA/IG51bGwgOiB2YWx1ZSlcbiAgfTtcbn1cbiJdfQ==
}

@@ -7,4 +7,2 @@ 'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _events = require('events');

@@ -18,79 +16,48 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
class WebSocketGremlinConnection extends _events.EventEmitter {
constructor({ port, host, path, ssl, rejectUnauthorized }) {
super();
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
this.open = false;
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
const address = `ws${ssl ? 's' : ''}://${host}:${port}${path}`;
const options = {
rejectUnauthorized
};
var WebSocketGremlinConnection = function (_EventEmitter) {
_inherits(WebSocketGremlinConnection, _EventEmitter);
this.ws = new _ws2.default(address, null, options);
function WebSocketGremlinConnection(_ref) {
var port = _ref.port,
host = _ref.host,
path = _ref.path;
this.ws.onopen = () => this.onOpen();
this.ws.onerror = err => this.handleError(err);
this.ws.onmessage = message => this.handleMessage(message);
this.ws.onclose = event => this.onClose(event);
this.ws.binaryType = "arraybuffer";
}
_classCallCheck(this, WebSocketGremlinConnection);
onOpen() {
this.open = true;
this.emit('open');
}
var _this = _possibleConstructorReturn(this, (WebSocketGremlinConnection.__proto__ || Object.getPrototypeOf(WebSocketGremlinConnection)).call(this));
handleError(err) {
this.emit('error', err);
}
_this.open = false;
handleMessage(message) {
this.emit('message', message);
}
_this.ws = new _ws2.default('ws://' + host + ':' + port + path);
onClose(event) {
this.open = false;
this.emit('close', event);
}
_this.ws.onopen = function () {
return _this.onOpen();
};
_this.ws.onerror = function (err) {
return _this.handleError(err);
};
_this.ws.onmessage = function (message) {
return _this.handleMessage(message);
};
_this.ws.onclose = function (event) {
return _this.onClose(event);
};
_this.ws.binaryType = "arraybuffer";
return _this;
sendMessage(message) {
this.ws.send(message, { mask: true, binary: true }, err => {
if (err) {
this.handleError(err);
}
});
}
_createClass(WebSocketGremlinConnection, [{
key: 'onOpen',
value: function onOpen() {
this.open = true;
this.emit('open');
}
}, {
key: 'handleError',
value: function handleError(err) {
this.emit('error', err);
}
}, {
key: 'handleMessage',
value: function handleMessage(message) {
this.emit('message', message);
}
}, {
key: 'onClose',
value: function onClose(event) {
this.open = false;
this.emit('close', event);
}
}, {
key: 'sendMessage',
value: function sendMessage(message) {
var _this2 = this;
this.ws.send(message, { mask: true, binary: true }, function (err) {
if (err) {
_this2.handleError(err);
}
});
}
}]);
return WebSocketGremlinConnection;
}(_events.EventEmitter);
exports.default = WebSocketGremlinConnection;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9XZWJTb2NrZXRHcmVtbGluQ29ubmVjdGlvbi5qcyJdLCJuYW1lcyI6WyJXZWJTb2NrZXRHcmVtbGluQ29ubmVjdGlvbiIsInBvcnQiLCJob3N0IiwicGF0aCIsIm9wZW4iLCJ3cyIsIm9ub3BlbiIsIm9uT3BlbiIsIm9uZXJyb3IiLCJlcnIiLCJoYW5kbGVFcnJvciIsIm9ubWVzc2FnZSIsIm1lc3NhZ2UiLCJoYW5kbGVNZXNzYWdlIiwib25jbG9zZSIsImV2ZW50Iiwib25DbG9zZSIsImJpbmFyeVR5cGUiLCJlbWl0Iiwic2VuZCIsIm1hc2siLCJiaW5hcnkiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUE7O0FBRUE7Ozs7Ozs7Ozs7OztJQUdxQkEsMEI7OztBQUNuQiw0Q0FBa0M7QUFBQSxRQUFwQkM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ShtZXNzYWdlKTtcbiAgICB0aGlzLndzLm9uY2xvc2UgPSAoZXZlbnQpID0+IHRoaXMub25DbG9zZShldmVudCk7XG4gICAgdGhpcy53cy5iaW5hcnlUeXBlID0gXCJhcnJheWJ1ZmZlclwiO1xuICB9XG5cbiAgb25PcGVuKCkge1xuICAgIHRoaXMub3BlbiA9IHRydWU7XG4gICAgdGhpcy5lbWl0KCdvcGVuJyk7XG4gIH1cblxuICBoYW5kbGVFcnJvcihlcnIpIHtcbiAgICB0aGlzLmVtaXQoJ2Vycm9yJywgZXJyKTtcbiAgfVxuXG4gIGhhbmRsZU1lc3NhZ2UobWVzc2FnZSkge1xuICAgIHRoaXMuZW1pdCgnbWVzc2FnZScsIG1lc3NhZ2UpO1xuICB9XG5cbiAgb25DbG9zZShldmVudCkge1xuICAgIHRoaXMub3BlbiA9IGZhbHNlO1xuICAgIHRoaXMuZW1pdCgnY2xvc2UnLCBldmVudCk7XG4gIH1cblxuICBzZW5kTWVzc2FnZShtZXNzYWdlKSB7XG4gICAgdGhpcy53cy5zZW5kKG1lc3NhZ2UsIHsgbWFzazogdHJ1ZSwgYmluYXJ5OiB0cnVlIH0sIChlcnIpID0+IHtcbiAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgdGhpcy5oYW5kbGVFcnJvcihlcnIpO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG59XG4iXX0=
}
exports.default = WebSocketGremlinConnection;
{
"name": "gremlin",
"version": "2.4.0",
"version": "2.5.0",
"description": "JavaScript client for TinkerPop3 Gremlin Server",

@@ -15,3 +15,3 @@ "main": "lib/index.js",

"examples:node": "babel-node examples/node-example",
"test:node": "mocha ./test --compilers js:babel-register --recursive --reporter spec",
"test:node": "NODE_TLS_REJECT_UNAUTHORIZED=0 mocha ./test --compilers js:babel-register --recursive --reporter spec",
"test:node:watch": "npm run test:node -- --watch"

@@ -50,2 +50,3 @@ },

"babel-plugin-transform-async-to-module-method": "^6.5.2",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-runtime": "^6.5.2",

@@ -52,0 +53,0 @@ "babel-preset-env": "^1.4.0",

@@ -51,3 +51,3 @@ [![Build Status](https://travis-ci.org/jbmusso/gremlin-javascript.svg?branch=master)](https://travis-ci.org/jbmusso/gremlin-javascript) [![Coverage Status](https://coveralls.io/repos/github/jbmusso/gremlin-javascript/badge.svg?branch=master)](https://coveralls.io/github/jbmusso/gremlin-javascript?branch=master) [![npm](https://img.shields.io/npm/dt/gremlin.svg)](https://www.npmjs.com/package/gremlin)

The following works with a recent version of Node.js (tested with v7.6.0):
```
```javascript
import { createClient, statics } from 'gremlin';

@@ -54,0 +54,0 @@

@@ -34,2 +34,4 @@ /*jslint -W079 */

executeHandler,
ssl: false,
rejectUnauthorized: true,
...options,

@@ -50,11 +52,15 @@ path: path.length && !path.startsWith('/') ? `/${path}` : path

const { ssl, rejectUnauthorized } = this.options;
this.connection = this.createConnection({
port,
host,
path: this.options.path
path: this.options.path,
ssl,
rejectUnauthorized,
});
}
createConnection({ port, host, path }) {
const connection = new WebSocketGremlinConnection({ port, host, path });
createConnection({ port, host, path, ssl, rejectUnauthorized }) {
const connection = new WebSocketGremlinConnection({ port, host, path, ssl, rejectUnauthorized });

@@ -61,0 +67,0 @@ connection.on('open', () => this.onConnectionOpen());

@@ -7,3 +7,3 @@ import { EventEmitter } from 'events';

export default class WebSocketGremlinConnection extends EventEmitter {
constructor({ port, host, path }) {
constructor({ port, host, path, ssl, rejectUnauthorized }) {
super();

@@ -13,4 +13,9 @@

this.ws = new WebSocket(`ws://${host}:${port}${path}`);
const address = `ws${ssl ? 's' : ''}://${host}:${port}${path}`;
const options = {
rejectUnauthorized
};
this.ws = new WebSocket(address, null, options);
this.ws.onopen = () => this.onOpen();

@@ -17,0 +22,0 @@ this.ws.onerror = (err) => this.handleError(err);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc