gremlin 3.4.12 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/doc/AnonymousTraversalSource.html +11 -3
- package/doc/Authenticator.html +6 -2
- package/doc/Bytecode.html +258 -6
- package/doc/Client.html +84 -6
- package/doc/Connection.html +12 -2
- package/doc/DriverRemoteConnection.html +392 -8
- package/doc/EdgeLabelVerificationStrategy.html +5 -3
- package/doc/Graph.html +6 -2
- package/doc/GraphSON2Reader.html +6 -2
- package/doc/GraphSON2Writer.html +8 -2
- package/doc/GraphSON3Reader.html +4 -2
- package/doc/GraphSON3Writer.html +4 -2
- package/doc/GraphTraversal.html +317 -107
- package/doc/GraphTraversalSource.html +164 -19
- package/doc/HaltedTraverserStrategy.html +5 -3
- package/doc/MatchAlgorithmStrategy.html +5 -3
- package/doc/P.html +28 -2
- package/doc/PartitionStrategy.html +5 -3
- package/doc/Path.html +4 -2
- package/doc/PlainTextSaslAuthenticator.html +6 -2
- package/doc/ProductiveByStrategy.html +288 -0
- package/doc/RemoteConnection.html +561 -13
- package/doc/RemoteStrategy.html +8 -4
- package/doc/RemoteTraversal.html +5 -3
- package/doc/ReservedKeysVerificationStrategy.html +5 -3
- package/doc/ResponseError.html +4 -2
- package/doc/ResultSet.html +10 -2
- package/doc/SaslAuthenticator.html +6 -2
- package/doc/SaslMechanismBase.html +8 -2
- package/doc/SaslMechanismPlain.html +10 -2
- package/doc/SeedStrategy.html +288 -0
- package/doc/SubgraphStrategy.html +5 -3
- package/doc/TextP.html +18 -2
- package/doc/Transaction.html +2 -2
- package/doc/Translator.html +202 -4
- package/doc/TraversalStrategies.html +142 -3
- package/doc/TraversalStrategy.html +8 -4
- package/doc/TypeSerializer.html +4 -2
- package/doc/driver_auth_authenticator.js.html +2 -2
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +2 -2
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +2 -2
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +2 -2
- package/doc/driver_auth_sasl-authenticator.js.html +2 -2
- package/doc/driver_client.js.html +20 -8
- package/doc/driver_connection.js.html +2 -2
- package/doc/driver_driver-remote-connection.js.html +38 -4
- package/doc/driver_remote-connection.js.html +55 -5
- package/doc/driver_response-error.js.html +2 -2
- package/doc/driver_result-set.js.html +2 -2
- package/doc/global.html +3 -3
- package/doc/index.html +35 -18
- package/doc/process_anonymous-traversal.js.html +3 -3
- package/doc/process_bytecode.js.html +32 -3
- package/doc/process_graph-traversal.js.html +25 -6
- package/doc/process_transaction.js.html +2 -2
- package/doc/process_translator.js.html +45 -32
- package/doc/process_traversal-strategy.js.html +23 -2
- package/doc/process_traversal.js.html +3 -3
- package/doc/scripts/linenumber.js +9 -9
- package/doc/structure_graph.js.html +2 -2
- package/doc/structure_io_graph-serializer.js.html +2 -2
- package/doc/structure_io_type-serializers.js.html +2 -2
- package/doc/styles/jsdoc-default.css +2 -2
- package/lib/driver/client.js +18 -6
- package/lib/driver/driver-remote-connection.js +36 -2
- package/lib/driver/remote-connection.js +53 -3
- package/lib/process/anonymous-traversal.js +1 -1
- package/lib/process/bytecode.js +30 -1
- package/lib/process/graph-traversal.js +23 -4
- package/lib/process/transaction.js +86 -0
- package/lib/process/translator.js +43 -30
- package/lib/process/traversal-strategy.js +21 -0
- package/lib/process/traversal.js +1 -1
- package/package.json +6 -5
- package/.npmignore +0 -26
- package/package-lock.json +0 -5828
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*global document */
|
|
2
|
-
(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
(() => {
|
|
3
|
+
const source = document.getElementsByClassName('prettyprint source linenums');
|
|
4
|
+
let i = 0;
|
|
5
|
+
let lineNumber = 0;
|
|
6
|
+
let lineId;
|
|
7
|
+
let lines;
|
|
8
|
+
let totalLines;
|
|
9
|
+
let anchorHash;
|
|
10
10
|
|
|
11
11
|
if (source && source[0]) {
|
|
12
12
|
anchorHash = document.location.hash.substring(1);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
for (; i < totalLines; i++) {
|
|
17
17
|
lineNumber++;
|
|
18
|
-
lineId =
|
|
18
|
+
lineId = `line${lineNumber}`;
|
|
19
19
|
lines[i].id = lineId;
|
|
20
20
|
if (lineId === anchorHash) {
|
|
21
21
|
lines[i].className += ' selected';
|
|
@@ -226,13 +226,13 @@ module.exports = {
|
|
|
226
226
|
</div>
|
|
227
227
|
|
|
228
228
|
<nav>
|
|
229
|
-
<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="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</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="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</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="SubgraphStrategy.html">SubgraphStrategy</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>
|
|
229
|
+
<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="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="ProductiveByStrategy.html">ProductiveByStrategy</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="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Transaction.html">Transaction</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>
|
|
230
230
|
</nav>
|
|
231
231
|
|
|
232
232
|
<br class="clear">
|
|
233
233
|
|
|
234
234
|
<footer>
|
|
235
|
-
Documentation generated by <a href="https://github.com/
|
|
235
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
|
|
236
236
|
</footer>
|
|
237
237
|
|
|
238
238
|
<script> prettyPrint(); </script>
|
|
@@ -289,13 +289,13 @@ module.exports = {
|
|
|
289
289
|
</div>
|
|
290
290
|
|
|
291
291
|
<nav>
|
|
292
|
-
<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="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</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="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</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="SubgraphStrategy.html">SubgraphStrategy</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>
|
|
292
|
+
<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="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="ProductiveByStrategy.html">ProductiveByStrategy</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="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Transaction.html">Transaction</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>
|
|
293
293
|
</nav>
|
|
294
294
|
|
|
295
295
|
<br class="clear">
|
|
296
296
|
|
|
297
297
|
<footer>
|
|
298
|
-
Documentation generated by <a href="https://github.com/
|
|
298
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
|
|
299
299
|
</footer>
|
|
300
300
|
|
|
301
301
|
<script> prettyPrint(); </script>
|
|
@@ -543,13 +543,13 @@ module.exports = {
|
|
|
543
543
|
</div>
|
|
544
544
|
|
|
545
545
|
<nav>
|
|
546
|
-
<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="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</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="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</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="SubgraphStrategy.html">SubgraphStrategy</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>
|
|
546
|
+
<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="EdgeLabelVerificationStrategy.html">EdgeLabelVerificationStrategy</a></li><li><a href="Graph.html">Graph</a></li><li><a href="GraphSON2Reader.html">GraphSON2Reader</a></li><li><a href="GraphSON2Writer.html">GraphSON2Writer</a></li><li><a href="GraphSON3Reader.html">GraphSON3Reader</a></li><li><a href="GraphSON3Writer.html">GraphSON3Writer</a></li><li><a href="GraphTraversal.html">GraphTraversal</a></li><li><a href="GraphTraversalSource.html">GraphTraversalSource</a></li><li><a href="HaltedTraverserStrategy.html">HaltedTraverserStrategy</a></li><li><a href="MatchAlgorithmStrategy.html">MatchAlgorithmStrategy</a></li><li><a href="P.html">P</a></li><li><a href="PartitionStrategy.html">PartitionStrategy</a></li><li><a href="Path.html">Path</a></li><li><a href="PlainTextSaslAuthenticator.html">PlainTextSaslAuthenticator</a></li><li><a href="ProductiveByStrategy.html">ProductiveByStrategy</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="ReservedKeysVerificationStrategy.html">ReservedKeysVerificationStrategy</a></li><li><a href="ResponseError.html">ResponseError</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="SubgraphStrategy.html">SubgraphStrategy</a></li><li><a href="TextP.html">TextP</a></li><li><a href="Transaction.html">Transaction</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>
|
|
547
547
|
</nav>
|
|
548
548
|
|
|
549
549
|
<br class="clear">
|
|
550
550
|
|
|
551
551
|
<footer>
|
|
552
|
-
Documentation generated by <a href="https://github.com/
|
|
552
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Fri Jan 14 2022 09:04:29 GMT-0500 (Eastern Standard Time)
|
|
553
553
|
</footer>
|
|
554
554
|
|
|
555
555
|
<script> prettyPrint(); </script>
|
|
@@ -273,7 +273,7 @@ tr > th:last-child { border-right: 1px solid #ddd; }
|
|
|
273
273
|
margin: 0;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
.
|
|
276
|
+
.source
|
|
277
277
|
{
|
|
278
278
|
border: 1px solid #ddd;
|
|
279
279
|
width: 80%;
|
|
@@ -284,7 +284,7 @@ tr > th:last-child { border-right: 1px solid #ddd; }
|
|
|
284
284
|
width: inherit;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
.
|
|
287
|
+
.source code
|
|
288
288
|
{
|
|
289
289
|
font-size: 100%;
|
|
290
290
|
line-height: 18px;
|
package/lib/driver/client.js
CHANGED
|
@@ -48,7 +48,7 @@ class Client {
|
|
|
48
48
|
this._options = options;
|
|
49
49
|
if (this._options.processor === 'session') {
|
|
50
50
|
// compatibility with old 'session' processor setting
|
|
51
|
-
this._options.session = options.session || utils.getUuid()
|
|
51
|
+
this._options.session = options.session || utils.getUuid();
|
|
52
52
|
}
|
|
53
53
|
if (this._options.session) {
|
|
54
54
|
// re-assign processor to 'session' when in session mode
|
|
@@ -65,6 +65,14 @@ class Client {
|
|
|
65
65
|
return this._connection.open();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Returns true if the underlying connection is open
|
|
70
|
+
* @returns {Boolean}
|
|
71
|
+
*/
|
|
72
|
+
get isOpen() {
|
|
73
|
+
return this._connection.isOpen;
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
/**
|
|
69
77
|
* Send a request to the Gremlin Server, can send a script or bytecode steps.
|
|
70
78
|
* @param {Bytecode|string} message The bytecode or script to send
|
|
@@ -85,16 +93,20 @@ class Client {
|
|
|
85
93
|
aliases: { 'g': this._options.traversalSource || 'g' }
|
|
86
94
|
}, requestOptions)
|
|
87
95
|
|
|
96
|
+
if (this._options.session && this._options.processor === 'session') {
|
|
97
|
+
args['session'] = this._options.session;
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
if (message instanceof Bytecode) {
|
|
89
|
-
|
|
101
|
+
if (this._options.session && this._options.processor === 'session') {
|
|
102
|
+
return this._connection.submit('session', 'bytecode', args, requestIdOverride);
|
|
103
|
+
} else {
|
|
104
|
+
return this._connection.submit('traversal', 'bytecode', args, requestIdOverride);
|
|
105
|
+
}
|
|
90
106
|
} else if (typeof message === 'string') {
|
|
91
107
|
args['bindings'] = bindings;
|
|
92
108
|
args['language'] = 'gremlin-groovy';
|
|
93
109
|
args['accept'] = this._connection.mimeType;
|
|
94
|
-
|
|
95
|
-
if (this._options.session && this._options.processor === 'session') {
|
|
96
|
-
args['session'] = this._options.session;
|
|
97
|
-
}
|
|
98
110
|
return this._connection.submit(this._options.processor || '','eval', args, requestIdOverride);
|
|
99
111
|
} else {
|
|
100
112
|
throw new TypeError("message must be of type Bytecode or string");
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
const rcModule = require('./remote-connection');
|
|
26
26
|
const RemoteConnection = rcModule.RemoteConnection;
|
|
27
27
|
const RemoteTraversal = rcModule.RemoteTraversal;
|
|
28
|
+
const utils = require('../utils');
|
|
28
29
|
const Client = require('./client');
|
|
30
|
+
const Bytecode = require('../process/bytecode');
|
|
29
31
|
const OptionsStrategy = require('../process/traversal-strategy').OptionsStrategy;
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -49,8 +51,8 @@ class DriverRemoteConnection extends RemoteConnection {
|
|
|
49
51
|
* @param {Object} [options.headers] An associative array containing the additional header key/values for the initial request.
|
|
50
52
|
* @constructor
|
|
51
53
|
*/
|
|
52
|
-
constructor(url, options) {
|
|
53
|
-
super(url);
|
|
54
|
+
constructor(url, options = {}) {
|
|
55
|
+
super(url, options);
|
|
54
56
|
this._client = new Client(url, options);
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -59,6 +61,11 @@ class DriverRemoteConnection extends RemoteConnection {
|
|
|
59
61
|
return this._client.open();
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
/** @override */
|
|
65
|
+
get isOpen() {
|
|
66
|
+
return this._client.isOpen;
|
|
67
|
+
}
|
|
68
|
+
|
|
62
69
|
/** @override */
|
|
63
70
|
submit(bytecode) {
|
|
64
71
|
let optionsStrategy = bytecode.sourceInstructions.find(
|
|
@@ -75,9 +82,36 @@ class DriverRemoteConnection extends RemoteConnection {
|
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
84
|
}
|
|
85
|
+
|
|
78
86
|
return this._client.submit(bytecode, null, requestOptions).then(result => new RemoteTraversal(result.toArray()));
|
|
79
87
|
}
|
|
80
88
|
|
|
89
|
+
/** @override */
|
|
90
|
+
createSession() {
|
|
91
|
+
if (this.isSessionBound)
|
|
92
|
+
throw new Error("Connection is already bound to a session - child sessions are not allowed");
|
|
93
|
+
|
|
94
|
+
// make sure a fresh session is used when starting a new transaction
|
|
95
|
+
const copiedOptions = Object.assign({}, this.options);
|
|
96
|
+
copiedOptions.session = utils.getUuid();
|
|
97
|
+
return new DriverRemoteConnection(this.url, copiedOptions);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** @override */
|
|
101
|
+
get isSessionBound() {
|
|
102
|
+
return this.options.session;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** @override */
|
|
106
|
+
commit() {
|
|
107
|
+
return this._client.submit(Bytecode.GraphOp.commit, null)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** @override */
|
|
111
|
+
rollback() {
|
|
112
|
+
return this._client.submit(Bytecode.GraphOp.rollback, null)
|
|
113
|
+
}
|
|
114
|
+
|
|
81
115
|
/** @override */
|
|
82
116
|
close() {
|
|
83
117
|
return this._client.close();
|
|
@@ -30,8 +30,14 @@ const TraversalStrategy = require('../process/traversal-strategy').TraversalStra
|
|
|
30
30
|
* returning results.
|
|
31
31
|
*/
|
|
32
32
|
class RemoteConnection {
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {String} url The resource uri.
|
|
36
|
+
* @param {Object} [options] The connection options.
|
|
37
|
+
*/
|
|
38
|
+
constructor(url, options = {}) {
|
|
34
39
|
this.url = url;
|
|
40
|
+
this.options = options;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
/**
|
|
@@ -42,6 +48,23 @@ class RemoteConnection {
|
|
|
42
48
|
throw new Error('open() must be implemented');
|
|
43
49
|
}
|
|
44
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Returns true if connection is open
|
|
53
|
+
* @returns {Boolean}
|
|
54
|
+
*/
|
|
55
|
+
get isOpen() {
|
|
56
|
+
throw new Error('isOpen() must be implemented');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Determines if the connection is already bound to a session. If so, this indicates that the
|
|
61
|
+
* <code>#createSession()</code> cannot be called so as to produce child sessions.
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
get isSessionBound() {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
45
68
|
/**
|
|
46
69
|
* Submits the <code>Bytecode</code> provided and returns a <code>RemoteTraversal</code>.
|
|
47
70
|
* @abstract
|
|
@@ -53,7 +76,31 @@ class RemoteConnection {
|
|
|
53
76
|
};
|
|
54
77
|
|
|
55
78
|
/**
|
|
56
|
-
*
|
|
79
|
+
* Create a new <code>RemoteConnection</code> that is bound to a session using the configuration from this one.
|
|
80
|
+
* If the connection is already session bound then this function should throw an exception.
|
|
81
|
+
* @returns {RemoteConnection}
|
|
82
|
+
*/
|
|
83
|
+
createSession() {
|
|
84
|
+
throw new Error('createSession() must be implemented');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Submits a <code>Bytecode.GraphOp.commit</code> to the server and closes the connection.
|
|
89
|
+
* @returns {Promise}
|
|
90
|
+
*/
|
|
91
|
+
commit() {
|
|
92
|
+
throw new Error('commit() must be implemented');
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Submits a <code>Bytecode.GraphOp.rollback</code> to the server and closes the connection.
|
|
96
|
+
* @returns {Promise}
|
|
97
|
+
*/
|
|
98
|
+
rollback() {
|
|
99
|
+
throw new Error('rollback() must be implemented');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Closes the connection where open transactions will close according to the features of the graph provider.
|
|
57
104
|
* @returns {Promise}
|
|
58
105
|
*/
|
|
59
106
|
close() {
|
|
@@ -78,7 +125,10 @@ class RemoteStrategy extends TraversalStrategy {
|
|
|
78
125
|
* @param {RemoteConnection} connection
|
|
79
126
|
*/
|
|
80
127
|
constructor(connection) {
|
|
81
|
-
|
|
128
|
+
// gave this a fqcn that has a local "js:" prefix since this strategy isn't sent as bytecode to the server.
|
|
129
|
+
// this is a sort of local-only strategy that actually executes client side. not sure if this prefix is the
|
|
130
|
+
// right way to name this or not, but it should have a name to identify it.
|
|
131
|
+
super("js:RemoteStrategy");
|
|
82
132
|
this.connection = connection;
|
|
83
133
|
}
|
|
84
134
|
|
|
@@ -52,7 +52,7 @@ class AnonymousTraversalSource {
|
|
|
52
52
|
/**
|
|
53
53
|
* Creates a {@link GraphTraversalSource} binding a {@link RemoteConnection} to a remote {@link Graph} instances as its
|
|
54
54
|
* reference so that traversals spawned from it will execute over that reference.
|
|
55
|
-
* @param {
|
|
55
|
+
* @param {RemoteConnection} remoteConnection
|
|
56
56
|
* @return {GraphTraversalSource}
|
|
57
57
|
*/
|
|
58
58
|
withRemote(remoteConnection) {
|
package/lib/process/bytecode.js
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
*/
|
|
23
23
|
'use strict';
|
|
24
24
|
|
|
25
|
+
const { Traversal } = require('./traversal');
|
|
26
|
+
|
|
25
27
|
class Bytecode {
|
|
26
28
|
/**
|
|
27
29
|
* Creates a new instance of Bytecode
|
|
@@ -76,7 +78,11 @@ class Bytecode {
|
|
|
76
78
|
const instruction = new Array(length);
|
|
77
79
|
instruction[0] = name;
|
|
78
80
|
for (let i = 1; i < length; i++) {
|
|
79
|
-
|
|
81
|
+
const val = values[i - 1];
|
|
82
|
+
if (val instanceof Traversal && val.graph != null)
|
|
83
|
+
throw new Error(`The child traversal of ${val} was not spawned anonymously - use ` +
|
|
84
|
+
`the __ class rather than a TraversalSource to construct the child traversal`);
|
|
85
|
+
instruction[i] = val;
|
|
80
86
|
}
|
|
81
87
|
return instruction;
|
|
82
88
|
}
|
|
@@ -88,6 +94,29 @@ class Bytecode {
|
|
|
88
94
|
toString() {
|
|
89
95
|
return JSON.stringify([this.sourceInstructions, this.stepInstructions]);
|
|
90
96
|
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Adds a new source instructions
|
|
100
|
+
* @param {String} name
|
|
101
|
+
* @param {Array} values
|
|
102
|
+
* @returns {Bytecode}
|
|
103
|
+
*/
|
|
104
|
+
static _createGraphOp(name, values) {
|
|
105
|
+
const bc = new Bytecode();
|
|
106
|
+
bc.addSource(name, values);
|
|
107
|
+
return bc;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Gets the <code>Bytecode</code> that is meant to be sent as "graph operations" to the server.
|
|
112
|
+
* @returns {{rollback: Bytecode, commit: Bytecode}}
|
|
113
|
+
*/
|
|
114
|
+
static get GraphOp() {
|
|
115
|
+
return {
|
|
116
|
+
commit: Bytecode._createGraphOp("tx", ["commit"]),
|
|
117
|
+
rollback: Bytecode._createGraphOp("tx", ["rollback"])
|
|
118
|
+
};
|
|
119
|
+
}
|
|
91
120
|
}
|
|
92
121
|
|
|
93
122
|
module.exports = Bytecode;
|
|
@@ -23,12 +23,11 @@
|
|
|
23
23
|
'use strict';
|
|
24
24
|
|
|
25
25
|
const { Traversal } = require('./traversal');
|
|
26
|
+
const { Transaction } = require('./transaction');
|
|
26
27
|
const remote = require('../driver/remote-connection');
|
|
27
|
-
const utils = require('../utils');
|
|
28
28
|
const Bytecode = require('./bytecode');
|
|
29
29
|
const { TraversalStrategies, VertexProgramStrategy, OptionsStrategy } = require('./traversal-strategy');
|
|
30
30
|
|
|
31
|
-
|
|
32
31
|
/**
|
|
33
32
|
* Represents the primary DSL of the Gremlin traversal machine.
|
|
34
33
|
*/
|
|
@@ -48,16 +47,36 @@ class GraphTraversalSource {
|
|
|
48
47
|
this.bytecode = bytecode || new Bytecode();
|
|
49
48
|
this.graphTraversalSourceClass = graphTraversalSourceClass || GraphTraversalSource;
|
|
50
49
|
this.graphTraversalClass = graphTraversalClass || GraphTraversal;
|
|
50
|
+
|
|
51
|
+
// in order to keep the constructor unchanged within 3.5.x we can try to pop the RemoteConnection out of the
|
|
52
|
+
// TraversalStrategies. keeping this unchanged will allow user DSLs to not take a break.
|
|
53
|
+
// TODO: refactor this to be nicer in 3.6.0 when we can take a breaking change
|
|
54
|
+
const strat = traversalStrategies.strategies.find(ts => ts.fqcn === "js:RemoteStrategy");
|
|
55
|
+
this.remoteConnection = strat !== undefined ? strat.connection : undefined;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
/**
|
|
54
|
-
* @param remoteConnection
|
|
59
|
+
* @param {RemoteConnection} remoteConnection
|
|
55
60
|
* @returns {GraphTraversalSource}
|
|
56
61
|
*/
|
|
57
62
|
withRemote(remoteConnection) {
|
|
58
63
|
const traversalStrategy = new TraversalStrategies(this.traversalStrategies);
|
|
59
64
|
traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
|
|
60
|
-
return new this.graphTraversalSourceClass(this.graph, traversalStrategy, new Bytecode(this.bytecode),
|
|
65
|
+
return new this.graphTraversalSourceClass(this.graph, traversalStrategy, new Bytecode(this.bytecode),
|
|
66
|
+
this.graphTraversalSourceClass, this.graphTraversalClass);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Spawn a new <code>Transaction</code> object that can then start and stop a transaction.
|
|
71
|
+
* @returns {Transaction}
|
|
72
|
+
*/
|
|
73
|
+
tx() {
|
|
74
|
+
// you can't do g.tx().begin().tx() - no child transactions
|
|
75
|
+
if (this.remoteConnection && this.remoteConnection.isSessionBound) {
|
|
76
|
+
throw new Error("This TraversalSource is already bound to a transaction - child transactions are not supported")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return new Transaction(this);
|
|
61
80
|
}
|
|
62
81
|
|
|
63
82
|
/**
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
const remote = require('../driver/remote-connection');
|
|
22
|
+
const Bytecode = require('./bytecode');
|
|
23
|
+
const { TraversalStrategies } = require('./traversal-strategy');
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A controller for a remote transaction that is constructed from <code>g.tx()</code>. Calling <code>begin()</code>
|
|
27
|
+
* on this object will produce a new <code>GraphTraversalSource</code> that is bound to a remote transaction over which
|
|
28
|
+
* multiple traversals may be executed in that context. Calling <code>commit()</code> or <code>rollback()</code> will
|
|
29
|
+
* then close the transaction and thus, the session. This feature only works with transaction enabled graphs.
|
|
30
|
+
*/
|
|
31
|
+
class Transaction {
|
|
32
|
+
constructor(g) {
|
|
33
|
+
this._g = g;
|
|
34
|
+
this._sessionBasedConnection = undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Spawns a <code>GraphTraversalSource</code> that is bound to a remote session which enables a transaction.
|
|
39
|
+
* @returns {*}
|
|
40
|
+
*/
|
|
41
|
+
begin() {
|
|
42
|
+
if (this._sessionBasedConnection) {
|
|
43
|
+
throw new Error("Transaction already started on this object");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this._sessionBasedConnection = this._g.remoteConnection.createSession();
|
|
47
|
+
const traversalStrategy = new TraversalStrategies();
|
|
48
|
+
traversalStrategy.addStrategy(new remote.RemoteStrategy(this._sessionBasedConnection));
|
|
49
|
+
return new this._g.graphTraversalSourceClass(this._g.graph, traversalStrategy, new Bytecode(this._g.bytecode),
|
|
50
|
+
this._g.graphTraversalSourceClass, this._g.graphTraversalClass);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @returns {Promise}
|
|
55
|
+
*/
|
|
56
|
+
commit() {
|
|
57
|
+
return this._sessionBasedConnection.commit().then(() => this.close());
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @returns {Promise}
|
|
62
|
+
*/
|
|
63
|
+
rollback() {
|
|
64
|
+
return this._sessionBasedConnection.rollback().then(() => this.close());
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns true if transaction is open.
|
|
69
|
+
* @returns {Boolean}
|
|
70
|
+
*/
|
|
71
|
+
get isOpen() {
|
|
72
|
+
this._sessionBasedConnection.isOpen;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @returns {Promise}
|
|
77
|
+
*/
|
|
78
|
+
close() {
|
|
79
|
+
if (this._sessionBasedConnection)
|
|
80
|
+
this._sessionBasedConnection.close();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = {
|
|
85
|
+
Transaction
|
|
86
|
+
};
|
|
@@ -44,6 +44,7 @@ class Translator {
|
|
|
44
44
|
/**
|
|
45
45
|
* Returns a script representation of the given bytecode instructions.
|
|
46
46
|
* @param {Object} bytecodeOrTraversal The traversal or bytecode of a traversal containing step instructions.
|
|
47
|
+
* @param {boolean} child Determines if a traversal object should be treated as an anonymous child or if it is a spawn from "g"
|
|
47
48
|
* @returns {string} Gremlin-Groovy script
|
|
48
49
|
*/
|
|
49
50
|
translate(bytecodeOrTraversal, child = false) {
|
|
@@ -63,36 +64,7 @@ class Translator {
|
|
|
63
64
|
script += ', ';
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
if (params[k] instanceof Traversal) {
|
|
68
|
-
script += this.translate(params[k].getBytecode(), true);
|
|
69
|
-
} else if (params[k].toString() === '[object Object]') {
|
|
70
|
-
Object.keys(params[k]).forEach(function (key, index) {
|
|
71
|
-
if (index > 0) script += ', ';
|
|
72
|
-
script += '(\'' + key + '\', ';
|
|
73
|
-
if (params[k][key] instanceof String || typeof params[k][key] === 'string') {
|
|
74
|
-
script += '\'' + params[k][key] + '\'';
|
|
75
|
-
} else {
|
|
76
|
-
script += params[k][key];
|
|
77
|
-
}
|
|
78
|
-
script += ')';
|
|
79
|
-
});
|
|
80
|
-
} else if (Array.isArray(params[k])) {
|
|
81
|
-
const parts = [];
|
|
82
|
-
for (const param of params[k]) {
|
|
83
|
-
parts.push(translate(param.getBytecode(), true));
|
|
84
|
-
}
|
|
85
|
-
script += parts.join(",");
|
|
86
|
-
} else {
|
|
87
|
-
script += params[k].toString();
|
|
88
|
-
}
|
|
89
|
-
} else if (params[k] === undefined) {
|
|
90
|
-
script += '';
|
|
91
|
-
} else if (typeof params[k] === 'number' || typeof params[k] === 'boolean') {
|
|
92
|
-
script += params[k];
|
|
93
|
-
} else {
|
|
94
|
-
script += '\'' + params[k] + '\'';
|
|
95
|
-
}
|
|
67
|
+
script += this.convert(params[k]);
|
|
96
68
|
}
|
|
97
69
|
}
|
|
98
70
|
|
|
@@ -101,6 +73,47 @@ class Translator {
|
|
|
101
73
|
|
|
102
74
|
return script;
|
|
103
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Converts an object to a Gremlin script representation.
|
|
79
|
+
* @param {Object} anyObject The object to convert to a script representation
|
|
80
|
+
* @returns {string} The Gremlin script representation
|
|
81
|
+
*/
|
|
82
|
+
convert(anyObject) {
|
|
83
|
+
let script = '';
|
|
84
|
+
if (Object(anyObject) === anyObject) {
|
|
85
|
+
if (anyObject instanceof Traversal) {
|
|
86
|
+
script += this.translate(anyObject.getBytecode(), true);
|
|
87
|
+
} else if (anyObject.toString() === '[object Object]') {
|
|
88
|
+
Object.keys(anyObject).forEach(function (key, index) {
|
|
89
|
+
if (index > 0) script += ', ';
|
|
90
|
+
script += '(\'' + key + '\', ';
|
|
91
|
+
if (anyObject[key] instanceof String || typeof anyObject[key] === 'string') {
|
|
92
|
+
script += '\'' + anyObject[key] + '\'';
|
|
93
|
+
} else {
|
|
94
|
+
script += anyObject[key];
|
|
95
|
+
}
|
|
96
|
+
script += ')';
|
|
97
|
+
});
|
|
98
|
+
} else if (Array.isArray(anyObject)) {
|
|
99
|
+
const parts = [];
|
|
100
|
+
for (const item of anyObject) {
|
|
101
|
+
parts.push(this.convert(item));
|
|
102
|
+
}
|
|
103
|
+
script += '[' + parts.join(', ') + ']';
|
|
104
|
+
} else {
|
|
105
|
+
script += anyObject.toString();
|
|
106
|
+
}
|
|
107
|
+
} else if (anyObject === undefined) {
|
|
108
|
+
script += '';
|
|
109
|
+
} else if (typeof anyObject === 'number' || typeof anyObject === 'boolean') {
|
|
110
|
+
script += anyObject;
|
|
111
|
+
} else {
|
|
112
|
+
script += '\'' + anyObject + '\'';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return script;
|
|
116
|
+
}
|
|
104
117
|
}
|
|
105
118
|
|
|
106
119
|
module.exports = Translator;
|