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.5.1 to 2.6.0

docker-compose.yml

5

CHANGELOG.md

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

## 2.6.0
- Add support for SASL authentication (thanks CosmosDB team)
## 2.5.1

@@ -87,2 +90,2 @@ - Push properly built files

## 0.0.0
- initial release with `.stream()`, `.execute()` and support for Groovy flavored scripts
- initial release with `.stream()`, `.execute()` and support for Groovy flavored scripts

46

lib/GremlinClient.js

@@ -27,2 +27,6 @@ 'use strict';

var _utf = require('utf8');
var _utf2 = _interopRequireDefault(_utf);
var _WebSocketGremlinConnection = require('./WebSocketGremlinConnection');

@@ -67,8 +71,12 @@

ssl: false,
rejectUnauthorized: true
rejectUnauthorized: true,
user: '',
password: ''
}, options, {
path: path.length && !path.startsWith('/') ? `/${path}` : path
path: path && path.length && !path.startsWith('/') ? `/${path}` : path
});
this.useSession = this.options.session;
this.user = this.options.user;
this.password = this.options.password;

@@ -96,3 +104,9 @@ if (this.useSession) {

createConnection({ port, host, path, ssl, rejectUnauthorized }) {
const connection = new _WebSocketGremlinConnection2.default({ port, host, path, ssl, rejectUnauthorized });
const connection = new _WebSocketGremlinConnection2.default({
port,
host,
path,
ssl,
rejectUnauthorized
});

@@ -168,2 +182,7 @@ connection.on('open', () => this.onConnectionOpen());

break;
case 407:
// AUTHENTICATE CHALLANGE
const challengeResponse = this.buildChallengeResponse(requestId);
this.sendMessage(challengeResponse);
break;
default:

@@ -258,2 +277,16 @@ delete this.commands[requestId];

buildChallengeResponse(requestId) {
const { processor, op, accept, language, aliases } = this.options;
var args = { SASL: _utf2.default.encode('\0' + this.user + '\0' + this.password) };
const message = {
requestId: requestId,
processor,
op: 'authentication',
args
};
return message;
}
sendMessage(message) {

@@ -373,8 +406,3 @@ let serializedMessage = this.options.accept + JSON.stringify(message);

sendCommand(command) {
const {
message,
message: {
requestId
}
} = command;
const { message, message: { requestId } } = command;

@@ -381,0 +409,0 @@ this.commands[requestId] = command;

@@ -44,3 +44,3 @@ 'use strict';

return new _GremlinClient2.default(port, host, options);
};
}

@@ -47,0 +47,0 @@ /**

@@ -28,6 +28,3 @@ 'use strict';

function buildQueryFromSignature(rawScript = '', rawBindings) {
const {
gremlin = rawScript,
bindings = rawBindings
} = rawScript;
const { gremlin = rawScript, bindings = rawBindings } = rawScript;

@@ -34,0 +31,0 @@ return {

@@ -32,3 +32,3 @@ 'use strict';

this.ws.onclose = event => this.onClose(event);
this.ws.binaryType = "arraybuffer";
this.ws.binaryType = 'arraybuffer';
}

@@ -35,0 +35,0 @@

{
"name": "gremlin",
"version": "2.5.1",
"version": "2.6.0",
"description": "JavaScript client for TinkerPop3 Gremlin Server",

@@ -16,5 +16,13 @@ "main": "lib/index.js",

"examples:node": "babel-node examples/node-example",
"precommit": "lint-staged",
"prettify": "prettier --single-quote --trailing-comma all --write \"src/**/*.js\"",
"test": "NODE_TLS_REJECT_UNAUTHORIZED=0 mocha $(find src -path '*test.js') --compilers js:babel-register --recursive --reporter spec",
"test:watch": "npm run test -- --watch"
},
"lint-staged": {
"*.js": [
"npm run prettify",
"git add"
]
},
"repository": {

@@ -44,3 +52,4 @@ "type": "git",

"ws": "^2.3.1",
"zer": "^0.1.0"
"zer": "^0.1.0",
"utf8": "^2.0.0"
},

@@ -67,2 +76,3 @@ "devDependencies": {

"gulp-uglify": "^0.3.1",
"husky": "^0.13.4",
"istanbul": "^0.4.2",

@@ -77,4 +87,6 @@ "istanbul-coveralls": "^1.0.3",

"karma-safari-launcher": "^0.1.1",
"lint-staged": "^3.6.0",
"mocha": "^1.21.4",
"mocha-lcov-reporter": "^1.2.0",
"prettier": "^1.4.2",
"rimraf": "^2.6.1",

@@ -81,0 +93,0 @@ "serve-static": "^1.5.3",

@@ -94,3 +94,23 @@ [![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)

$ `rejectUnauthorized`: when using ssl, whether to reject self-signed certificates or not (default: `true`). Useful in development mode when using gremlin-server self signed certificates. Do NOT use self-signed certificates with this option in production.
* `user` : username to use for SASL authentication
* `password` : password to use for SASL authentication
## Using SASL Authentication
If you want to use [SASL Authentication] (http://tinkerpop.apache.org/docs/3.2.5/dev/provider/#_authentication) with your gremlin server:
```javascript
import { createClient } from 'gremlin';
const client = Gremlin.createClient(8182, 'localhost', { ssl:true, user:'user', password:'password' });
client.execute('g.V()', { }, (err, results) => {
if (err) {
return console.error(err)
}
console.log(results);
});
```
### Executing Gremlin queries

@@ -97,0 +117,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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