GitHub user jorgebay opened a pull request:
https://github.com/apache/tinkerpop/pull/626
Update Javascript GLV
Address feedback and provide maven integration:
- Reorganize gremlin-javascript into node.js project
- Simplify javascript code generators
- Generate package.json to match project version
- Introduce Promise factory for third-party promise library integration
(ie: bluebird)
- Use toList() and next() traversal methods
- Include Remote connection implementation
- Fix enum casing
- Use Maven nodejs plugin
- .gitignore and .npmignore at gremlin-javascript level
- Run integration tests using a gremlin-server instance
- Add gremlin-javascript doc in gremlin-variants.asciidoc
Only supports Node.js, as it's basically the only server side js runtime.
Browser support can be added in the future. I've encapsulated third party
(node.js only for now) dependencies in the module `utils.js`. I've dropped
support for Nashorn runtime as it has no immediate practical use.
It includes versioning and packaging with nodejs toolchain (ie: publish new
versions on the Node.js package manager repo) and uses com.github.eirslett
frontend-maven-plugin for maven integration (used `skipIntegrationTests` flag).
As it isn't possible to provide blocking IO on Node.js / JavaScript,
`next()` and `toList()` provide the same functionality as the Java equivalents
but wrapped in a `Promise`.
`next()` traversal method is part of the [async iterator
protocol](https://github.com/tc39/proposal-async-iteration) implementation, as
proposed by @jbmusso.
A traversal can be iterated using `for await` on modern runtimes:
```javascript
for await (const vertex of g.V()) {
console.log(vertex.label);
}
```
`toList()` returns a `Promise` that can be awaited upon:
```javascript
const vertices = await g.V().toList();
```
Promises are created using built-in Promise constructor by default. The
user can provide a promise factory to integrate a third-party promise libraries
(like bluebird, Q, ...).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jorgebay/tinkerpop TINKERPOP-1489-reorg
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/626.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #626
----
commit 392c1f9c45b822c3fa7977b436f1ba4be25993df
Author: Jorge Bay Gondra <[email protected]>
Date: 2017-06-06T13:05:14Z
Update Javascript GLV
Address feedback and provide maven integration:
- Reorganize gremlin-javascript into node.js project
- Simplify javascript code generators
- Generate package.json to match project version
- Introduce Promise factory for third-party promise library integration
(ie: bluebird)
- Use toList() and next() traversal methods
- Include Remote connection implementation
- Fix enum casing
- Use Maven nodejs plugin
- .gitignore and .npmignore at gremlin-javascript level
- Run integration tests using a gremlin-server instance
- Add gremlin-javascript doc in gremlin-variants.asciidoc
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---