gremlin 3.5.1 → 3.5.4
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/.eslintrc.js +155 -0
- package/.prettierrc.js +29 -0
- package/Gruntfile.js +15 -16
- package/doc/AnonymousTraversalSource.html +5 -5
- package/doc/Authenticator.html +2 -2
- package/doc/Bytecode.html +7 -7
- package/doc/Client.html +138 -64
- package/doc/Connection.html +93 -9
- package/doc/DriverRemoteConnection.html +11 -11
- package/doc/EdgeLabelVerificationStrategy.html +3 -3
- package/doc/Graph.html +2 -2
- package/doc/GraphSON2Reader.html +4 -4
- package/doc/GraphSON2Writer.html +3 -3
- package/doc/GraphSON3Reader.html +3 -3
- package/doc/GraphSON3Writer.html +3 -3
- package/doc/GraphTraversal.html +107 -107
- package/doc/GraphTraversalSource.html +19 -19
- package/doc/HaltedTraverserStrategy.html +3 -3
- package/doc/MatchAlgorithmStrategy.html +3 -3
- package/doc/P.html +13 -13
- package/doc/PartitionStrategy.html +3 -3
- package/doc/Path.html +2 -2
- package/doc/PlainTextSaslAuthenticator.html +2 -2
- package/doc/ProductiveByStrategy.html +288 -0
- package/doc/RemoteConnection.html +10 -10
- package/doc/RemoteStrategy.html +4 -4
- package/doc/RemoteTraversal.html +3 -3
- package/doc/ReservedKeysVerificationStrategy.html +3 -3
- package/doc/ResponseError.html +2 -2
- package/doc/ResultSet.html +7 -7
- package/doc/SaslAuthenticator.html +2 -2
- package/doc/SaslMechanismBase.html +2 -2
- package/doc/SaslMechanismPlain.html +6 -6
- package/doc/SeedStrategy.html +288 -0
- package/doc/SubgraphStrategy.html +3 -3
- package/doc/TextP.html +10 -10
- package/doc/Transaction.html +6 -6
- package/doc/Translator.html +198 -4
- package/doc/TraversalStrategies.html +5 -5
- package/doc/TraversalStrategy.html +3 -3
- package/doc/TypeSerializer.html +2 -2
- package/doc/driver_auth_authenticator.js.html +4 -4
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +3 -3
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +26 -17
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +7 -7
- package/doc/driver_auth_sasl-authenticator.js.html +3 -3
- package/doc/driver_client.js.html +73 -23
- package/doc/driver_connection.js.html +134 -92
- package/doc/driver_driver-remote-connection.js.html +12 -11
- package/doc/driver_remote-connection.js.html +4 -5
- package/doc/driver_response-error.js.html +5 -4
- package/doc/driver_result-set.js.html +4 -4
- package/doc/global.html +264 -3
- package/doc/index.html +2 -2
- package/doc/module.exports.html +301 -0
- package/doc/process_anonymous-traversal.js.html +4 -4
- package/doc/process_bytecode.js.html +11 -9
- package/doc/process_graph-traversal.js.html +194 -143
- package/doc/process_transaction.js.html +16 -9
- package/doc/process_translator.js.html +53 -37
- package/doc/process_traversal-strategy.js.html +70 -53
- package/doc/process_traversal.js.html +101 -108
- package/doc/structure_graph.js.html +7 -7
- package/doc/structure_io_binary_internals_DataType.js.html +148 -0
- package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +131 -0
- package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +134 -0
- package/doc/structure_io_graph-serializer.js.html +65 -18
- package/doc/structure_io_type-serializers.js.html +86 -89
- package/index.js +5 -5
- package/lib/driver/auth/authenticator.js +2 -2
- package/lib/driver/auth/mechanisms/sasl-mechanism-base.js +1 -1
- package/lib/driver/auth/mechanisms/sasl-mechanism-plain.js +24 -15
- package/lib/driver/auth/plain-text-sasl-authenticator.js +5 -5
- package/lib/driver/auth/sasl-authenticator.js +1 -1
- package/lib/driver/client.js +71 -21
- package/lib/driver/connection.js +132 -90
- package/lib/driver/driver-remote-connection.js +10 -9
- package/lib/driver/remote-connection.js +2 -3
- package/lib/driver/response-error.js +2 -2
- package/lib/driver/result-set.js +1 -2
- package/lib/process/anonymous-traversal.js +1 -2
- package/lib/process/bytecode.js +9 -7
- package/lib/process/graph-traversal.js +191 -141
- package/lib/process/transaction.js +13 -7
- package/lib/process/translator.js +50 -35
- package/lib/process/traversal-strategy.js +67 -51
- package/lib/process/traversal.js +99 -106
- package/lib/structure/graph.js +5 -5
- package/lib/structure/io/binary/GraphBinary.js +109 -0
- package/lib/structure/io/binary/internals/AnySerializer.js +95 -0
- package/lib/structure/io/binary/internals/ArraySerializer.js +135 -0
- package/lib/structure/io/binary/internals/BigIntegerSerializer.js +151 -0
- package/lib/structure/io/binary/internals/BooleanSerializer.js +103 -0
- package/lib/structure/io/binary/internals/BulkSetSerializer.js +124 -0
- package/lib/structure/io/binary/internals/ByteBufferSerializer.js +124 -0
- package/lib/structure/io/binary/internals/ByteSerializer.js +95 -0
- package/lib/structure/io/binary/internals/BytecodeSerializer.js +249 -0
- package/lib/structure/io/binary/internals/DataType.js +97 -0
- package/lib/structure/io/binary/internals/DateSerializer.js +103 -0
- package/lib/structure/io/binary/internals/DoubleSerializer.js +99 -0
- package/lib/structure/io/binary/internals/EdgeSerializer.js +215 -0
- package/lib/structure/io/binary/internals/EnumSerializer.js +148 -0
- package/lib/structure/io/binary/internals/FloatSerializer.js +99 -0
- package/lib/structure/io/binary/internals/GraphBinaryReader.js +80 -0
- package/lib/structure/io/binary/internals/GraphBinaryWriter.js +83 -0
- package/lib/structure/io/binary/internals/IntSerializer.js +112 -0
- package/lib/structure/io/binary/internals/LambdaSerializer.js +70 -0
- package/lib/structure/io/binary/internals/LongSerializer.js +107 -0
- package/lib/structure/io/binary/internals/LongSerializerNg.js +102 -0
- package/lib/structure/io/binary/internals/MapSerializer.js +153 -0
- package/lib/structure/io/binary/internals/NumberSerializationStrategy.js +68 -0
- package/lib/structure/io/binary/internals/PSerializer.js +151 -0
- package/lib/structure/io/binary/internals/PathSerializer.js +123 -0
- package/lib/structure/io/binary/internals/PropertySerializer.js +141 -0
- package/lib/structure/io/binary/internals/ShortSerializer.js +99 -0
- package/lib/structure/io/binary/internals/StringSerializer.js +114 -0
- package/lib/structure/io/binary/internals/TextPSerializer.js +145 -0
- package/lib/structure/io/binary/internals/TraversalStrategySerializer.js +72 -0
- package/lib/structure/io/binary/internals/TraverserSerializer.js +123 -0
- package/lib/structure/io/binary/internals/UnspecifiedNullSerializer.js +75 -0
- package/lib/structure/io/binary/internals/UuidSerializer.js +119 -0
- package/lib/structure/io/binary/internals/VertexPropertySerializer.js +172 -0
- package/lib/structure/io/binary/internals/VertexSerializer.js +135 -0
- package/lib/structure/io/binary/internals/utils.js +59 -0
- package/lib/structure/io/graph-serializer.js +62 -16
- package/lib/structure/io/type-serializers.js +84 -87
- package/lib/utils.js +15 -10
- package/package.json +21 -8
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @author Igor Ostapenko
|
|
22
|
+
*/
|
|
23
|
+
'use strict';
|
|
24
|
+
|
|
25
|
+
const g = require('../../../graph');
|
|
26
|
+
|
|
27
|
+
module.exports = class VertexSerializer {
|
|
28
|
+
constructor(ioc) {
|
|
29
|
+
this.ioc = ioc;
|
|
30
|
+
this.ioc.serializers[ioc.DataType.VERTEX] = this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
canBeUsedFor(value) {
|
|
34
|
+
return value instanceof g.Vertex;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
serialize(item, fullyQualifiedFormat = true) {
|
|
38
|
+
if (item === undefined || item === null) {
|
|
39
|
+
if (fullyQualifiedFormat) {
|
|
40
|
+
return Buffer.from([this.ioc.DataType.VERTEX, 0x01]);
|
|
41
|
+
}
|
|
42
|
+
const id = [0x03, 0x00, 0x00, 0x00, 0x00, 0x00]; // String ''
|
|
43
|
+
const label = [0x00, 0x00, 0x00, 0x00]; // ''
|
|
44
|
+
const properties = [0xfe, 0x01]; // null
|
|
45
|
+
return Buffer.from([...id, ...label, ...properties]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const bufs = [];
|
|
49
|
+
if (fullyQualifiedFormat) {
|
|
50
|
+
bufs.push(Buffer.from([this.ioc.DataType.VERTEX, 0x00]));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// {id}
|
|
54
|
+
bufs.push(this.ioc.anySerializer.serialize(item.id));
|
|
55
|
+
|
|
56
|
+
// {label}
|
|
57
|
+
bufs.push(this.ioc.stringSerializer.serialize(item.label, false));
|
|
58
|
+
|
|
59
|
+
// {properties}
|
|
60
|
+
bufs.push(this.ioc.anySerializer.serialize(item.properties));
|
|
61
|
+
|
|
62
|
+
return Buffer.concat(bufs);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
deserialize(buffer, fullyQualifiedFormat = true) {
|
|
66
|
+
let len = 0;
|
|
67
|
+
let cursor = buffer;
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
if (buffer === undefined || buffer === null || !(buffer instanceof Buffer)) {
|
|
71
|
+
throw new Error('buffer is missing');
|
|
72
|
+
}
|
|
73
|
+
if (buffer.length < 1) {
|
|
74
|
+
throw new Error('buffer is empty');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (fullyQualifiedFormat) {
|
|
78
|
+
const type_code = cursor.readUInt8();
|
|
79
|
+
len++;
|
|
80
|
+
if (type_code !== this.ioc.DataType.VERTEX) {
|
|
81
|
+
throw new Error('unexpected {type_code}');
|
|
82
|
+
}
|
|
83
|
+
cursor = cursor.slice(1);
|
|
84
|
+
|
|
85
|
+
if (cursor.length < 1) {
|
|
86
|
+
throw new Error('{value_flag} is missing');
|
|
87
|
+
}
|
|
88
|
+
const value_flag = cursor.readUInt8();
|
|
89
|
+
len++;
|
|
90
|
+
if (value_flag === 1) {
|
|
91
|
+
return { v: null, len };
|
|
92
|
+
}
|
|
93
|
+
if (value_flag !== 0) {
|
|
94
|
+
throw new Error('unexpected {value_flag}');
|
|
95
|
+
}
|
|
96
|
+
cursor = cursor.slice(1);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let id, id_len;
|
|
100
|
+
try {
|
|
101
|
+
({ v: id, len: id_len } = this.ioc.anySerializer.deserialize(cursor));
|
|
102
|
+
len += id_len;
|
|
103
|
+
} catch (err) {
|
|
104
|
+
err.message = '{id}: ' + err.message;
|
|
105
|
+
throw err;
|
|
106
|
+
}
|
|
107
|
+
cursor = cursor.slice(id_len);
|
|
108
|
+
|
|
109
|
+
let label, label_len;
|
|
110
|
+
try {
|
|
111
|
+
({ v: label, len: label_len } = this.ioc.stringSerializer.deserialize(cursor, false));
|
|
112
|
+
len += label_len;
|
|
113
|
+
} catch (err) {
|
|
114
|
+
err.message = '{label}: ' + err.message;
|
|
115
|
+
throw err;
|
|
116
|
+
}
|
|
117
|
+
cursor = cursor.slice(label_len);
|
|
118
|
+
|
|
119
|
+
let properties, properties_len;
|
|
120
|
+
try {
|
|
121
|
+
({ v: properties, len: properties_len } = this.ioc.anySerializer.deserialize(cursor));
|
|
122
|
+
len += properties_len;
|
|
123
|
+
} catch (err) {
|
|
124
|
+
err.message = '{properties}: ' + err.message;
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
127
|
+
cursor = cursor.slice(properties_len);
|
|
128
|
+
|
|
129
|
+
const v = new g.Vertex(id, label, properties);
|
|
130
|
+
return { v, len };
|
|
131
|
+
} catch (err) {
|
|
132
|
+
throw this.ioc.utils.des_error({ serializer: this, args: arguments, cursor, err });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @author Igor Ostapenko
|
|
22
|
+
*/
|
|
23
|
+
'use strict';
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Deserialization error general constructor.
|
|
27
|
+
*/
|
|
28
|
+
const des_error = ({ serializer, args, cursor, err }) => {
|
|
29
|
+
if (cursor === undefined) {
|
|
30
|
+
cursor = args[0]; // buffer
|
|
31
|
+
}
|
|
32
|
+
let cursor_tail = '';
|
|
33
|
+
if (cursor instanceof Buffer) {
|
|
34
|
+
if (cursor.length > 32) {
|
|
35
|
+
cursor_tail = '...';
|
|
36
|
+
}
|
|
37
|
+
cursor = cursor.slice(0, 32).toString('hex');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const fullyQualifiedFormat = args[1];
|
|
41
|
+
const nullable = args[2];
|
|
42
|
+
|
|
43
|
+
let m = `${serializer.constructor.name}.deserialize(cursor=${cursor}${cursor_tail}`;
|
|
44
|
+
if (fullyQualifiedFormat !== undefined) {
|
|
45
|
+
m += `, fullyQualifiedFormat=${fullyQualifiedFormat}`;
|
|
46
|
+
}
|
|
47
|
+
if (nullable !== undefined) {
|
|
48
|
+
m += `, nullable=${nullable}`;
|
|
49
|
+
}
|
|
50
|
+
m += `): ${err.message.replace(/\.$/, '')}.`;
|
|
51
|
+
|
|
52
|
+
err.message = m;
|
|
53
|
+
|
|
54
|
+
return err;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
des_error,
|
|
59
|
+
};
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
'use strict';
|
|
24
24
|
|
|
25
25
|
const typeSerializers = require('./type-serializers');
|
|
26
|
+
const Bytecode = require('../../process/bytecode');
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* GraphSON2 writer.
|
|
29
30
|
*/
|
|
30
31
|
class GraphSON2Writer {
|
|
31
|
-
|
|
32
32
|
/**
|
|
33
33
|
* @param {Object} [options]
|
|
34
34
|
* @param {Object} [options.serializers] An object used as an associative array with GraphSON 2 type name as keys and
|
|
@@ -38,7 +38,7 @@ class GraphSON2Writer {
|
|
|
38
38
|
constructor(options) {
|
|
39
39
|
this._options = options || {};
|
|
40
40
|
// Create instance of the default serializers
|
|
41
|
-
this._serializers = this.getDefaultSerializers().map(serializerConstructor => {
|
|
41
|
+
this._serializers = this.getDefaultSerializers().map((serializerConstructor) => {
|
|
42
42
|
const s = new serializerConstructor();
|
|
43
43
|
s.writer = this;
|
|
44
44
|
return s;
|
|
@@ -46,7 +46,7 @@ class GraphSON2Writer {
|
|
|
46
46
|
|
|
47
47
|
const customSerializers = this._options.serializers || {};
|
|
48
48
|
|
|
49
|
-
Object.keys(customSerializers).forEach(key => {
|
|
49
|
+
Object.keys(customSerializers).forEach((key) => {
|
|
50
50
|
const s = customSerializers[key];
|
|
51
51
|
if (!s.serialize) {
|
|
52
52
|
return;
|
|
@@ -83,7 +83,7 @@ class GraphSON2Writer {
|
|
|
83
83
|
if (Array.isArray(value)) {
|
|
84
84
|
// We need to handle arrays when there is no serializer
|
|
85
85
|
// for older versions of GraphSON
|
|
86
|
-
return value.map(item => this.adaptObject(item));
|
|
86
|
+
return value.map((item) => this.adaptObject(item));
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// Default (strings / objects / ...)
|
|
@@ -98,6 +98,48 @@ class GraphSON2Writer {
|
|
|
98
98
|
write(obj) {
|
|
99
99
|
return JSON.stringify(this.adaptObject(obj));
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
writeRequest({ requestId, op, processor, args }) {
|
|
103
|
+
const req = {
|
|
104
|
+
requestId: { '@type': 'g:UUID', '@value': requestId },
|
|
105
|
+
op,
|
|
106
|
+
processor,
|
|
107
|
+
args: this._adaptArgs(args, true),
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
if (req.args['gremlin'] instanceof Bytecode) {
|
|
111
|
+
req.args['gremlin'] = this.adaptObject(req.args['gremlin']);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return Buffer.from(JSON.stringify(req));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Takes the given args map and ensures all arguments are passed through to adaptObject
|
|
119
|
+
* @param {Object} args Map of arguments to process.
|
|
120
|
+
* @param {Boolean} protocolLevel Determines whether it's a protocol level binding.
|
|
121
|
+
* @returns {Object}
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
_adaptArgs(args, protocolLevel) {
|
|
125
|
+
if (args instanceof Object) {
|
|
126
|
+
const newObj = {};
|
|
127
|
+
Object.keys(args).forEach((key) => {
|
|
128
|
+
// bindings key (at the protocol-level needs special handling. without this, it wraps the generated Map
|
|
129
|
+
// in another map for types like EnumValue. Could be a nicer way to do this but for now it's solving the
|
|
130
|
+
// problem with script submission of non JSON native types
|
|
131
|
+
if (protocolLevel && key === 'bindings') {
|
|
132
|
+
newObj[key] = this._adaptArgs(args[key], false);
|
|
133
|
+
} else {
|
|
134
|
+
newObj[key] = this.adaptObject(args[key]);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
return newObj;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return args;
|
|
142
|
+
}
|
|
101
143
|
}
|
|
102
144
|
|
|
103
145
|
/**
|
|
@@ -125,7 +167,7 @@ class GraphSON2Reader {
|
|
|
125
167
|
this._deserializers = {};
|
|
126
168
|
|
|
127
169
|
const defaultDeserializers = this.getDefaultDeserializers();
|
|
128
|
-
Object.keys(defaultDeserializers).forEach(typeName => {
|
|
170
|
+
Object.keys(defaultDeserializers).forEach((typeName) => {
|
|
129
171
|
const serializerConstructor = defaultDeserializers[typeName];
|
|
130
172
|
const s = new serializerConstructor();
|
|
131
173
|
s.reader = this;
|
|
@@ -134,7 +176,7 @@ class GraphSON2Reader {
|
|
|
134
176
|
|
|
135
177
|
if (this._options.serializers) {
|
|
136
178
|
const customSerializers = this._options.serializers || {};
|
|
137
|
-
Object.keys(customSerializers).forEach(key => {
|
|
179
|
+
Object.keys(customSerializers).forEach((key) => {
|
|
138
180
|
const s = customSerializers[key];
|
|
139
181
|
if (!s.deserialize) {
|
|
140
182
|
return;
|
|
@@ -161,7 +203,7 @@ class GraphSON2Reader {
|
|
|
161
203
|
return null;
|
|
162
204
|
}
|
|
163
205
|
if (Array.isArray(obj)) {
|
|
164
|
-
return obj.map(item => this.read(item));
|
|
206
|
+
return obj.map((item) => this.read(item));
|
|
165
207
|
}
|
|
166
208
|
const type = obj[typeSerializers.typeKey];
|
|
167
209
|
if (type) {
|
|
@@ -179,6 +221,10 @@ class GraphSON2Reader {
|
|
|
179
221
|
return obj;
|
|
180
222
|
}
|
|
181
223
|
|
|
224
|
+
readResponse(buffer) {
|
|
225
|
+
return this.read(JSON.parse(buffer.toString()));
|
|
226
|
+
}
|
|
227
|
+
|
|
182
228
|
_deserializeObject(obj) {
|
|
183
229
|
const keys = Object.keys(obj);
|
|
184
230
|
const result = {};
|
|
@@ -201,9 +247,9 @@ class GraphSON3Reader extends GraphSON2Reader {
|
|
|
201
247
|
const graphSON2Deserializers = {
|
|
202
248
|
'g:Traverser': typeSerializers.TraverserSerializer,
|
|
203
249
|
'g:TraversalStrategy': typeSerializers.TraversalStrategySerializer,
|
|
204
|
-
'g:Int32':
|
|
205
|
-
'g:Int64':
|
|
206
|
-
'g:Float':
|
|
250
|
+
'g:Int32': typeSerializers.NumberSerializer,
|
|
251
|
+
'g:Int64': typeSerializers.NumberSerializer,
|
|
252
|
+
'g:Float': typeSerializers.NumberSerializer,
|
|
207
253
|
'g:Double': typeSerializers.NumberSerializer,
|
|
208
254
|
'g:Date': typeSerializers.DateSerializer,
|
|
209
255
|
'g:Direction': typeSerializers.DirectionSerializer,
|
|
@@ -214,13 +260,13 @@ const graphSON2Deserializers = {
|
|
|
214
260
|
'g:Path': typeSerializers.Path3Serializer,
|
|
215
261
|
'g:TextP': typeSerializers.TextPSerializer,
|
|
216
262
|
'g:T': typeSerializers.TSerializer,
|
|
217
|
-
'g:BulkSet': typeSerializers.BulkSetSerializer
|
|
263
|
+
'g:BulkSet': typeSerializers.BulkSetSerializer,
|
|
218
264
|
};
|
|
219
265
|
|
|
220
266
|
const graphSON3Deserializers = Object.assign({}, graphSON2Deserializers, {
|
|
221
267
|
'g:List': typeSerializers.ListSerializer,
|
|
222
268
|
'g:Set': typeSerializers.SetSerializer,
|
|
223
|
-
'g:Map': typeSerializers.MapSerializer
|
|
269
|
+
'g:Map': typeSerializers.MapSerializer,
|
|
224
270
|
});
|
|
225
271
|
|
|
226
272
|
const graphSON2Serializers = [
|
|
@@ -235,13 +281,13 @@ const graphSON2Serializers = [
|
|
|
235
281
|
typeSerializers.EnumSerializer,
|
|
236
282
|
typeSerializers.VertexSerializer,
|
|
237
283
|
typeSerializers.EdgeSerializer,
|
|
238
|
-
typeSerializers.LongSerializer
|
|
284
|
+
typeSerializers.LongSerializer,
|
|
239
285
|
];
|
|
240
286
|
|
|
241
287
|
const graphSON3Serializers = graphSON2Serializers.concat([
|
|
242
288
|
typeSerializers.ListSerializer,
|
|
243
289
|
typeSerializers.SetSerializer,
|
|
244
|
-
typeSerializers.MapSerializer
|
|
290
|
+
typeSerializers.MapSerializer,
|
|
245
291
|
]);
|
|
246
292
|
|
|
247
293
|
module.exports = {
|
|
@@ -250,5 +296,5 @@ module.exports = {
|
|
|
250
296
|
GraphSON2Writer,
|
|
251
297
|
GraphSON2Reader,
|
|
252
298
|
GraphSONWriter: GraphSON3Writer,
|
|
253
|
-
GraphSONReader: GraphSON3Reader
|
|
254
|
-
};
|
|
299
|
+
GraphSONReader: GraphSON3Reader,
|
|
300
|
+
};
|