Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-base.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-base.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-base.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-base.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/auth/mechanisms/sasl-mechanism-base.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/auth/mechanisms/sasl-mechanism-base.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +'use strict'; + +/** @abstract */ +class SaslMechanismBase { + constructor(options) { + this.setopts(options); + } + + /** + * Returns the name of the mechanism + */ + get name() { + return null; + } + + /** + * Set the options for the mechanism + * @param {object} options Options specific to the mechanism + */ + setopts(options) { + this._options = options; + } + + /** + * @abstract + * Evaluates the challenge from the server and returns appropriate response + * @param {String} challenge Challenge string presented by the server + */ + evaluateChallenge(challenge) { + throw new Error("evaluateChallenge should be implemented"); + } +} + +module.exports = SaslMechanismBase; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html>
Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-plain.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-plain.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-plain.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_mechanisms_sasl-mechanism-plain.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,147 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/auth/mechanisms/sasl-mechanism-plain.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/auth/mechanisms/sasl-mechanism-plain.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +'use strict'; + +const SaslMechanismBase = require('./sasl-mechanism-base'); + +class SaslMechanismPlain extends SaslMechanismBase { + /** + * Creates a new instance of SaslMechanismPlain. + * @param {Object} [options] The mechanism options. + * @param {String} [options.authzid] The identity of the client. + * @param {String} [options.username] The identity of user with access to server. + * @param {String} [options.password] The password of user with access to server. + * @constructor + */ + constructor(options) { + super(options); + + if (this._options.username === undefined + || this._options.username === null + || this._options.username.length == 0 + || this._options.password === undefined + || this._options.password === null + || this._options.password.length == 0 + ) { + throw new Error('Missing credentials for SASL PLAIN mechanism'); + } + } + + /** + * Returns the name of the mechanism + */ + get name() { + return 'PLAIN'; + } + + /** + * Evaluates the challenge from the server and returns appropriate response. + * @param {String} challenge Challenge string presented by the server. + * @return {Object} A Promise that resolves to a valid sasl response object. + */ + evaluateChallenge(challenge) { + if (this._hasInitialResponse(challenge)) { + return Promise.resolve({ + 'saslMechanism': this.name, + 'sasl': this._saslArgument(this._options.authzid, this._options.username, this._options.password) + }); + } + + return Promise.resolve({ 'sasl': this._saslArgument(this._options.authzid, this._options.username, this._options.password) }); + } + + /** + * Generates a base64 encoded sasl argument based on the given parameters. + * @param {String} authzid Identitiy of the client. + * @param {String} username The identity of user with access to server. + * @param {String} password The password of user with access to server. + */ + _saslArgument(authzid, username, password) { + if (authzid === undefined || authzid === null) authzid = ''; + if (username === undefined || username === null) username = ''; + if (password === undefined || password.length === null) password = ''; + + return new Buffer(`${authzid}\0${username}\0${password}`).toString('base64'); + } + + /** + * Checks challenge to see if we have the initial sasl response from the server. + * @param {String} challenge The challenge string from the server. + * @return {Boolean} + */ + _hasInitialResponse(challenge) { + if (challenge === undefined || challenge === null) { + return false; + } + return true; + } +} + +module.exports = SaslMechanismPlain; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_plain-text-sasl-authenticator.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_plain-text-sasl-authenticator.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_plain-text-sasl-authenticator.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_plain-text-sasl-authenticator.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,106 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/auth/plain-text-sasl-authenticator.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/auth/plain-text-sasl-authenticator.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict'; + +const Authenticator = require('./authenticator'); +const SaslMechanismPlain = require('./mechanisms/sasl-mechanism-plain'); + +class PlainTextSaslAuthenticator extends Authenticator { + /** + * Creates a new instance of PlainTextSaslAuthenticator. + * @param {string} username Username to log into the server. + * @param {string} password Password for the user. + * @param {string} [authzid] Optional id + * @constructor + */ + constructor(username, password, authzid) { + const options = { + mechanism: new SaslMechanismPlain({ + 'username': username, + 'password': password, + 'authzid': authzid + }) + }; + + super(options); + } + + /** + * Evaluates the challenge from the server and returns appropriate response. + * @param {String} challenge Challenge string presented by the server. + * @return {Object} A Promise that resolves to a valid sasl response object. + */ + evaluateChallenge(challenge) { + return this._options.mechanism.evaluateChallenge(challenge); + } +} + +module.exports = PlainTextSaslAuthenticator; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_sasl-authenticator.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_sasl-authenticator.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_sasl-authenticator.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_auth_sasl-authenticator.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,100 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/auth/sasl-authenticator.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/auth/sasl-authenticator.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +'use strict'; + +const Authenticator = require('./authenticator'); + +class SaslAuthenticator extends Authenticator { + /** + * Creates a new instance of SaslAuthenticator. + * @param {Object} [options] The authentication options. + * @param {Object} [options.mechanism] The mechanism to be used for authentication. + * @constructor + */ + constructor(options) { + super(options); + + if (options.mechanism === null || options.mechanism === undefined) { + throw new Error('No Sasl Mechanism Specified'); + } + } + + /** + * Evaluates the challenge from the server and returns appropriate response. + * @param {String} challenge Challenge string presented by the server. + * @return {Object} A Promise that resolves to a valid sasl response object. + */ + evaluateChallenge(challenge) { + return this._options.mechanism.evaluateChallenge(challenge); + } +} + +module.exports = SaslAuthenticator; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_client.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_client.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_client.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_client.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,142 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/client.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/client.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +'use strict'; + +const Connection = require('./connection'); +const Bytecode = require('../process/bytecode'); + +/** + * A {@link Client} contains methods to send messages to a Gremlin Server. + */ +class Client { + + /** + * Creates a new instance of {@link Client}. + * @param {String} url The resource uri. + * @param {Object} [options] The connection options. + * @param {Array} [options.ca] Trusted certificates. + * @param {String|Array|Buffer} [options.cert] The certificate key. + * @param {String} [options.mimeType] The mime type to use. + * @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs. + * @param {GraphSONReader} [options.reader] The reader to use. + * @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate. + * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'. + * @param {GraphSONWriter} [options.writer] The writer to use. + * @param {Authenticator} [options.authenticator] The authentication handler to use. + * @constructor + */ + constructor(url, options) { + this._options = options; + this._connection = new Connection(url, options); + } + + /** + * Opens the underlying connection to the Gremlin Server, if it's not already opened. + * @returns {Promise} + */ + open() { + return this._connection.open(); + } + + /** + * Send a request to the Gremlin Server, can send a script or bytecode steps. + * @param {Bytecode|string} message The bytecode or script to send + * @param {Object} [bindings] The script bindings, if any. + * @returns {Promise} + */ + submit(message, bindings) { + if (typeof message === 'string') { + const args = { + 'gremlin': message, + 'bindings': bindings, + 'language': 'gremlin-groovy', + 'accept': this._connection.mimeType, + 'aliases': { 'g': this._options.traversalSource || 'g' } + }; + + return this._connection.submit(null, 'eval', args, null, ''); + } + + if (message instanceof Bytecode) { + return this._connection.submit(message); + } + } + + /** + * Closes the underlying connection + * @returns {Promise} + */ + close() { + return this._connection.close(); + } + +} + +module.exports = Client; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_connection.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_connection.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_connection.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_connection.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,317 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/connection.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/connection.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jorge Bay Gondra + */ +'use strict'; + +const WebSocket = require('ws'); +const util = require('util'); +const utils = require('../utils'); +const serializer = require('../structure/io/graph-serializer'); +const ResultSet = require('./result-set'); + +const responseStatusCode = { + success: 200, + noContent: 204, + partialContent: 206, + authenticationChallenge: 407, +}; + +const defaultMimeType = 'application/vnd.gremlin-v3.0+json'; + +/** + * Represents a single connection to a Gremlin Server. + */ +class Connection { + + /** + * Creates a new instance of {@link Connection}. + * @param {String} url The resource uri. + * @param {Object} [options] The connection options. + * @param {Array} [options.ca] Trusted certificates. + * @param {String|Array|Buffer} [options.cert] The certificate key. + * @param {String} [options.mimeType] The mime type to use. + * @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs. + * @param {GraphSONReader} [options.reader] The reader to use. + * @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate. + * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'. + * @param {GraphSONWriter} [options.writer] The writer to use. + * @param {Authenticator} [options.authenticator] The authentication handler to use. + * @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request. + * @constructor + */ + constructor(url, options) { + this.url = url; + options = options || {}; + this._ws = new WebSocket(url, { + headers: options.headers, + ca: options.ca, + cert: options.cert, + pfx: options.pfx, + rejectUnauthorized: options.rejectUnauthorized + }); + + this._ws.on('open', () => { + this.isOpen = true; + if (this._openCallback) { + this._openCallback(); + } + }); + + this._ws.on('message', data => this._handleMessage(data)); + + // A map containing the request id and the handler + this._responseHandlers = {}; + this._reader = options.reader || new serializer.GraphSONReader(); + this._writer = options.writer || new serializer.GraphSONWriter(); + this._openPromise = null; + this._openCallback = null; + this._closePromise = null; + + /** + * Gets the MIME type. + * @type {String} + */ + this.mimeType = options.mimeType || defaultMimeType; + + this._header = String.fromCharCode(this.mimeType.length) + this.mimeType; + this.isOpen = false; + this.traversalSource = options.traversalSource || 'g'; + this._authenticator = options.authenticator; + } + + /** + * Opens the connection, if its not already opened. + * @returns {Promise} + */ + open() { + if (this._closePromise) { + return this._openPromise = Promise.reject(new Error('Connection has been closed')); + } + if (this.isOpen) { + return Promise.resolve(); + } + if (this._openPromise) { + return this._openPromise; + } + return this._openPromise = new Promise((resolve, reject) => { + // Set the callback that will be invoked once the WS is opened + this._openCallback = err => err ? reject(err) : resolve(); + }); + } + + /** @override */ + submit(bytecode, op, args, requestId, processor) { + return this.open().then(() => new Promise((resolve, reject) => { + if (requestId === null || requestId === undefined) { + requestId = utils.getUuid(); + this._responseHandlers[requestId] = { + callback: (err, result) => err ? reject(err) : resolve(result), + result: null + }; + } + + const message = Buffer.from(this._header + JSON.stringify(this._getRequest(requestId, bytecode, op, args, processor))); + this._ws.send(message); + })); + } + + _getRequest(id, bytecode, op, args, processor) { + if (args) { + args = this._adaptArgs(args, true); + } + + return ({ + 'requestId': { '@type': 'g:UUID', '@value': id }, + 'op': op || 'bytecode', + // if using op eval need to ensure processor stays unset if caller didn't set it. + 'processor': (!processor && op !== 'eval') ? 'traversal' : processor, + 'args': args || { + 'gremlin': this._writer.adaptObject(bytecode), + 'aliases': { 'g': this.traversalSource } + } + }); + } + + _handleMessage(data) { + const response = this._reader.read(JSON.parse(data.toString())); + if (response.requestId === null || response.requestId === undefined) { + // There was a serialization issue on the server that prevented the parsing of the request id + // We invoke any of the pending handlers with an error + Object.keys(this._responseHandlers).forEach(requestId => { + const handler = this._responseHandlers[requestId]; + this._clearHandler(requestId); + if (response.status !== undefined && response.status.message) { + return handler.callback( + new Error(util.format( + 'Server error (no request information): %s (%d)', response.status.message, response.status.code))); + } else { + return handler.callback(new Error(util.format('Server error (no request information): %j', response))); + } + }); + return; + } + + const handler = this._responseHandlers[response.requestId]; + + if (!handler) { + // The handler for a given request id was not found + // It was probably invoked earlier due to a serialization issue. + return; + } + + if (response.status.code === responseStatusCode.authenticationChallenge && this._authenticator) { + this._authenticator.evaluateChallenge(response.result.data).then(res => { + return this.submit(null, 'authentication', res, response.requestId); + }).catch(handler.callback); + + return; + } + else if (response.status.code >= 400) { + // callback in error + return handler.callback( + new Error(util.format('Server error: %s (%d)', response.status.message, response.status.code))); + } + switch (response.status.code) { + case responseStatusCode.noContent: + this._clearHandler(response.requestId); + return handler.callback(null, new ResultSet(utils.emptyArray, response.status.attributes)); + case responseStatusCode.partialContent: + handler.result = handler.result || []; + handler.result.push.apply(handler.result, response.result.data); + break; + default: + if (handler.result) { + handler.result.push.apply(handler.result, response.result.data); + } + else { + handler.result = response.result.data; + } + this._clearHandler(response.requestId); + return handler.callback(null, new ResultSet(handler.result, response.status.attributes)); + } + } + + /** + * Clears the internal state containing the callback and result buffer of a given request. + * @param requestId + * @private + */ + _clearHandler(requestId) { + delete this._responseHandlers[requestId]; + } + + /** + * Takes the given args map and ensures all arguments are passed through to _write.adaptObject + * @param {Object} args Map of arguments to process. + * @param {Boolean} protocolLevel Determines whether it's a protocol level binding. + * @returns {Object} + * @private + */ + _adaptArgs(args, protocolLevel) { + if (args instanceof Object) { + let newObj = {}; + Object.keys(args).forEach((key) => { + // bindings key (at the protocol-level needs special handling. without this, it wraps the generated Map + // in another map for types like EnumValue. Could be a nicer way to do this but for now it's solving the + // problem with script submission of non JSON native types + if (protocolLevel && key === 'bindings') + newObj[key] = this._adaptArgs(args[key], false); + else + newObj[key] = this._writer.adaptObject(args[key]); + }); + + return newObj; + } + + return args; + } + + /** + * Closes the Connection. + * @return {Promise} + */ + close() { + if (!this._closePromise) { + this._closePromise = new Promise(resolve => { + this._ws.on('close', function () { + this.isOpen = false; + resolve(); + }); + this._ws.close(); + }); + } + return this._closePromise; + } +} + +module.exports = Connection; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_driver-remote-connection.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_driver-remote-connection.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_driver-remote-connection.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_driver-remote-connection.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,123 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/driver-remote-connection.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/driver-remote-connection.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jorge Bay Gondra + */ +'use strict'; + +const rcModule = require('./remote-connection'); +const RemoteConnection = rcModule.RemoteConnection; +const RemoteTraversal = rcModule.RemoteTraversal; +const Client = require('./client'); + +/** + * Represents the default {@link RemoteConnection} implementation. + */ +class DriverRemoteConnection extends RemoteConnection { + + /** + * Creates a new instance of {@link DriverRemoteConnection}. + * @param {String} url The resource uri. + * @param {Object} [options] The connection options. + * @param {Array} [options.ca] Trusted certificates. + * @param {String|Array|Buffer} [options.cert] The certificate key. + * @param {String} [options.mimeType] The mime type to use. + * @param {String|Buffer} [options.pfx] The private key, certificate, and CA certs. + * @param {GraphSONReader} [options.reader] The reader to use. + * @param {Boolean} [options.rejectUnauthorized] Determines whether to verify or not the server certificate. + * @param {String} [options.traversalSource] The traversal source. Defaults to: 'g'. + * @param {GraphSONWriter} [options.writer] The writer to use. + * @param {Authenticator} [options.authenticator] The authentication handler to use. + * @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request. + * @constructor + */ + constructor(url, options) { + super(url); + this._client = new Client(url, options); + } + + /** @override */ + open() { + return this._client.open(); + } + + /** @override */ + submit(bytecode) { + return this._client.submit(bytecode).then(result => new RemoteTraversal(result.toArray())); + } + + /** @override */ + close() { + return this._client.close(); + } +} + +module.exports = DriverRemoteConnection; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_remote-connection.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_remote-connection.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_remote-connection.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_remote-connection.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,149 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/remote-connection.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/remote-connection.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jorge Bay Gondra + */ +'use strict'; + +const t = require('../process/traversal'); +const TraversalStrategy = require('../process/traversal-strategy').TraversalStrategy; + +/** + * Represents an abstraction of a "connection" to a "server" that is capable of processing a traversal and + * returning results. + */ +class RemoteConnection { + constructor(url) { + this.url = url; + } + + /** + * Opens the connection, if its not already opened. + * @returns {Promise} + */ + open() { + throw new Error('open() must be implemented'); + } + + /** + * Submits the <code>Bytecode</code> provided and returns a <code>RemoteTraversal</code>. + * @abstract + * @param {Bytecode} bytecode + * @returns {Promise} Returns a <code>Promise</code> that resolves to a <code>RemoteTraversal</code>. + */ + submit(bytecode) { + throw new Error('submit() must be implemented'); + }; + + /** + * Closes the connection, if its not already opened. + * @returns {Promise} + */ + close() { + throw new Error('close() must be implemented'); + } +} + +/** + * Represents a traversal as a result of a {@link RemoteConnection} submission. + */ +class RemoteTraversal extends t.Traversal { + constructor(traversers, sideEffects) { + super(null, null, null); + this.traversers = traversers; + this.sideEffects = sideEffects; + } +} + +class RemoteStrategy extends TraversalStrategy { + /** + * Creates a new instance of RemoteStrategy. + * @param {RemoteConnection} connection + */ + constructor(connection) { + super(); + this.connection = connection; + } + + /** @override */ + apply(traversal) { + if (traversal.traversers) { + return Promise.resolve(); + } + + return this.connection.submit(traversal.getBytecode()).then(function (remoteTraversal) { + traversal.sideEffects = remoteTraversal.sideEffects; + traversal.traversers = remoteTraversal.traversers; + }); + } +} + +module.exports = { RemoteConnection, RemoteStrategy, RemoteTraversal }; +</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_result-set.js.html URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_result-set.js.html?rev=1846578&view=auto ============================================================================== --- tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_result-set.js.html (added) +++ tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/driver_result-set.js.html Wed Nov 14 12:33:19 2018 @@ -0,0 +1,143 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>JSDoc: Source: driver/result-set.js</title> + + <script src="scripts/prettify/prettify.js"> </script> + <script src="scripts/prettify/lang-css.js"> </script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> + +<body> + +<div id="main"> + + <h1 class="page-title">Source: driver/result-set.js</h1> + + + + + + + <section> + <article> + <pre class="prettyprint source linenums"><code>/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jorge Bay Gondra + */ +'use strict'; + +const util = require('util'); +const inspect = util.inspect.custom || 'inspect'; +const utils = require('../utils'); +const emptyMap = Object.freeze(new utils.ImmutableMap()); + +/** + * Represents the response returned from the execution of a Gremlin traversal or script. + */ +class ResultSet { + + /** + * Creates a new instance of {@link ResultSet}. + * @param {Array} items + * @param {Map} [attributes] + */ + constructor(items, attributes) { + if (!Array.isArray(items)) { + throw new TypeError('items must be an Array instance'); + } + + this._items = items; + + /** + * Gets a Map representing the attributes of the response. + * @type {Map} + */ + this.attributes = attributes || emptyMap; + + /** + * Gets the amount of items in the result. + * @type {Number} + */ + this.length = items.length; + } + + /** + * Gets the iterator associated with this instance. + * @returns {Iterator} + */ + [Symbol.iterator]() { + return this._items[Symbol.iterator](); + } + + /** + * Provides a representation useful for debug and tracing. + */ + [inspect]() { + return this._items; + } + + /** + * Gets an array of result items. + * @returns {Array} + */ + toArray() { + return this._items; + } + + /** + * Returns the first item. + * @returns {Object|null} + */ + first() { + const item = this._items[0]; + return item !== undefined ? item : null; + } +} + +module.exports = ResultSet;</code></pre> + </article> + </section> + + + + +</div> + +<nav> + <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnonymousTraversalSource.html">AnonymousTraversalSource</a></li><li><a href="Authenticator.html">Authenticator</a></li><li><a href="Bytecode.html">Bytecode</a></li><li><a href="Client.html">Client</a></li><li><a href="Connection.html">Connection</a></li><li><a href="DriverRemoteConnection.html">DriverRemoteConnection</a></li><li><a href="GraphSONReader.html">GraphSONReader</a></li><li><a href="GraphSONWriter.html">GraphSONWriter</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="P.html">P</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="RemoteConnection.html">RemoteConnection</a></li><li><a href="RemoteStrategy.html">RemoteStrategy</a></li><li><a href="RemoteTraversal.html">RemoteTraversal</a></li><li><a href="ResultSet.html"> ResultSet</a></li><li><a href="SaslAuthenticator.html">SaslAuthenticator</a></li><li><a href="SaslMechanismBase.html">SaslMechanismBase</a></li><li><a href="SaslMechanismPlain.html">SaslMechanismPlain</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Translator.html">Translator</a></li><li><a href="TraversalStrategies.html">TraversalStrategies</a></li><li><a href="TraversalStrategy.html">TraversalStrategy</a></li><li><a href="TypeSerializer.html">TypeSerializer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#statics">statics</a></li></ul> +</nav> + +<br class="clear"> + +<footer> + Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Nov 14 2018 07:31:46 GMT-0500 (EST) +</footer> + +<script> prettyPrint(); </script> +<script src="scripts/linenumber.js"> </script> +</body> +</html> Added: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/fonts/OpenSans-Bold-webfont.eot URL: http://svn.apache.org/viewvc/tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/fonts/OpenSans-Bold-webfont.eot?rev=1846578&view=auto ============================================================================== Binary file - no diff available. Propchange: tinkerpop/site/jsdocs/3.4.0-SNAPSHOT/fonts/OpenSans-Bold-webfont.eot ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream