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

gremlin-v3

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gremlin-v3 - npm Package Compare versions

Comparing version 0.0.25 to 0.1.0

6

lib/graph-wrapper.js

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

return Q.nbind(txn.vertexIterator, txn)([id])
return Q.nbind(txn.vertexIterator, txn)(id)
.then(function (vertexIterator) {

@@ -318,3 +318,3 @@ return new Q(vertexIterator.hasNextSync() ? gremlin.wrapVertex(vertexIterator.nextSync()) : null);

return Q.nbind(txn.edgeIterator, txn)([id])
return Q.nbind(txn.edgeIterator, txn)(id)
.then(function (edgeIterator) {

@@ -406,3 +406,3 @@ if (edgeIterator.hasNextSync()) {

// We use this with variadic Java calls, so pass the args as a single array.
return this.gremlin.wrapTraversal(txn[op + 'Sync'](args));
return this.gremlin.wrapTraversal(txn[op + 'Sync'].apply(txn, args));
};

@@ -409,0 +409,0 @@ }

@@ -9,2 +9,3 @@ 'use strict';

var Q = require('q');
var dlog = require('debug')('gremlin-v3');

@@ -19,30 +20,54 @@ var GraphWrapper = require('./graph-wrapper');

var java = require('java');
var Gremlin = module.exports = function (opts) {
opts = opts || {};
opts.options = opts.options || [];
opts.classpath = opts.classpath || [];
// Add our own JAR first, so that we can provide alternate implementation of Gremlin classes for debugging.
opts.classpath.push(path.join(__dirname, '..', 'target', 'gremlin-node-*.jar'));
// Add the rest of the JAR's from the Maven package.
opts.classpath.push(path.join(__dirname, '..', 'target', '*', '**', '*.jar'));
// java.onJvmCreated is a property that holds a function that is executed only once when
// the JVM has been created. After creation, the property is made inaccessible.
var jvmCreated = !_.isFunction(java.onJvmCreated);
// initialize java
var java = this.java = require('java');
// add options
java.options.push('-Djava.awt.headless=true');
for (var i = 0; i < opts.options.length; i++) {
java.options.push(opts.options[i]);
if (jvmCreated) {
dlog('Gremlin initialized after JVM already created. Java:', java);
}
else if (opts && opts.java) {
// In this case we assume that java has already been configured by the application.
// The application therefore assumes responsibility for proper configuration of classpath
// and other java options.
// Gremlin-v3 is unable to use the asyncOptions feature of node-java, so the defacto standard
// configuration of sync and async method variants must be used, i.e. syncSuffix='Sync' and
// asyncSuffix=''.
dlog('Gremlin initialized with already configured java:', java);
}
else {
dlog('Gremlin initialized with unconfigured java. Opts:', opts);
opts = opts || {};
opts.options = opts.options || [];
opts.classpath = opts.classpath || [];
// add jar files
for (var i = 0; i < opts.classpath.length; i++) {
var pattern = opts.classpath[i];
var filenames = glob.sync(pattern);
for (var j = 0; j < filenames.length; j++) {
java.classpath.push(filenames[j]);
// Add our own JAR first, so that we can provide alternate implementation of Gremlin classes for debugging.
opts.classpath.push(path.join(__dirname, '..', 'target', 'gremlin-node-*.jar'));
// Add the rest of the JAR's from the Maven package.
opts.classpath.push(path.join(__dirname, '..', 'target', 'dependency', '**', '*.jar'));
// add options
java.options.push('-Djava.awt.headless=true');
for (var i = 0; i < opts.options.length; i++) {
java.options.push(opts.options[i]);
}
// add jar files
_.forEach(opts.classpath, function(pattern) {
var filenames = glob.sync(pattern);
_.forEach(filenames, function(jarPath) {
// We prevent duplicates here, since it is easy to do.
// But duplicates should only happen if class path patterns are somehow redundant.
if (!_.includes(java.classpath, jarPath))
java.classpath.push(jarPath);
});
});
}
dlog('Gremlin configured with classpath:', java.classpath);
this.java = java;
var MIN_VALUE = 0;

@@ -49,0 +74,0 @@ var MAX_VALUE = java.newInstanceSync('java.lang.Long', 2147483647);

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

VertexWrapper.prototype.setProperty = function (key, value, callback) {
return Q.nbind(this.el.singleProperty, this.el)(key, value, this.gremlin.emptyArrayList).nodeify(callback);
return Q.nbind(this.el.singleProperty, this.el)(key, value).nodeify(callback);
};

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

{
"name": "gremlin-v3",
"description": "Gremlin for graph databases which implement the TinkerPop3 property graph data model.",
"version": "0.0.25",
"version": "0.1.0",
"keywords": [

@@ -54,3 +54,3 @@ "gremlin",

"glob": "~4.3.5",
"java": ">=0.4.6",
"java": "git://github.com/RedSeal-co/node-java.git#varargs.r3",
"json-stable-stringify": "^1.0.0",

@@ -57,0 +57,0 @@ "lodash": "^3.2.0",

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

test('inject("daniel")', function (done) {
g.V().has('name', 'josh').out().values('name').inject(['daniel']).toArray(function (err, actual) {
g.V().has('name', 'josh').out().values('name').inject('daniel').toArray(function (err, actual) {
var expected = ['daniel', 'ripple', 'lop'];

@@ -800,0 +800,0 @@ assert.deepEqual(actual, expected);

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