Socket
Socket
Sign inDemoInstall

neo4j-driver

Package Overview
Dependencies
Maintainers
2
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neo4j-driver - npm Package Compare versions

Comparing version 1.0.0-M04 to 1.0.0-RC1

docs/build/ast/source/v1/record.js.json

918

docs/build/ast/source/v1/index.js.json

@@ -172,9 +172,9 @@ {

{
"type": "ImportDefaultSpecifier",
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "Driver",
"name": "driver",
"range": [
759,
765
760,
766
],

@@ -184,98 +184,25 @@ "loc": {

"line": 21,
"column": 7
"column": 8
},
"end": {
"line": 21,
"column": 13
"column": 14
}
}
},
"range": [
759,
765
],
"loc": {
"start": {
"line": 21,
"column": 7
},
"end": {
"line": 21,
"column": 13
}
}
}
],
"source": {
"type": "Literal",
"value": "./driver",
"raw": "'./driver'",
"range": [
771,
781
],
"loc": {
"start": {
"line": 21,
"column": 19
},
"end": {
"line": 21,
"column": 29
}
}
},
"range": [
752,
782
],
"loc": {
"start": {
"line": 21,
"column": 0
},
"end": {
"line": 21,
"column": 30
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "VERSION",
"range": [
791,
798
],
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 15
}
}
},
"imported": {
"type": "Identifier",
"name": "VERSION",
"name": "driver",
"range": [
791,
798
760,
766
],
"loc": {
"start": {
"line": 22,
"line": 21,
"column": 8
},
"end": {
"line": 22,
"column": 15
"line": 21,
"column": 14
}

@@ -285,13 +212,13 @@ }

"range": [
791,
798
760,
766
],
"loc": {
"start": {
"line": 22,
"line": 21,
"column": 8
},
"end": {
"line": 22,
"column": 15
"line": 21,
"column": 14
}

@@ -303,16 +230,16 @@ }

"type": "Literal",
"value": "../version",
"raw": "'../version'",
"value": "./driver",
"raw": "'./driver'",
"range": [
805,
817
773,
783
],
"loc": {
"start": {
"line": 22,
"column": 22
"line": 21,
"column": 21
},
"end": {
"line": 22,
"column": 34
"line": 21,
"column": 31
}

@@ -322,13 +249,13 @@ }

"range": [
783,
818
752,
784
],
"loc": {
"start": {
"line": 22,
"line": 21,
"column": 0
},
"end": {
"line": 22,
"column": 35
"line": 21,
"column": 32
}

@@ -346,12 +273,12 @@ }

"range": [
827,
831
793,
797
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 8
},
"end": {
"line": 23,
"line": 22,
"column": 12

@@ -365,12 +292,12 @@ }

"range": [
827,
831
793,
797
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 8
},
"end": {
"line": 23,
"line": 22,
"column": 12

@@ -381,12 +308,12 @@ }

"range": [
827,
831
793,
797
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 8
},
"end": {
"line": 23,
"line": 22,
"column": 12

@@ -402,12 +329,12 @@ }

"range": [
833,
845
799,
811
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 14
},
"end": {
"line": 23,
"line": 22,
"column": 26

@@ -421,12 +348,12 @@ }

"range": [
833,
845
799,
811
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 14
},
"end": {
"line": 23,
"line": 22,
"column": 26

@@ -437,12 +364,12 @@ }

"range": [
833,
845
799,
811
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 14
},
"end": {
"line": 23,
"line": 22,
"column": 26

@@ -458,12 +385,12 @@ }

"range": [
847,
866
813,
832
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 28
},
"end": {
"line": 23,
"line": 22,
"column": 47

@@ -477,12 +404,12 @@ }

"range": [
847,
866
813,
832
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 28
},
"end": {
"line": 23,
"line": 22,
"column": 47

@@ -493,12 +420,12 @@ }

"range": [
847,
866
813,
832
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 28
},
"end": {
"line": 23,
"line": 22,
"column": 47

@@ -514,12 +441,12 @@ }

"range": [
868,
879
834,
845
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 49
},
"end": {
"line": 23,
"line": 22,
"column": 60

@@ -533,12 +460,12 @@ }

"range": [
868,
879
834,
845
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 49
},
"end": {
"line": 23,
"line": 22,
"column": 60

@@ -549,12 +476,12 @@ }

"range": [
868,
879
834,
845
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 49
},
"end": {
"line": 23,
"line": 22,
"column": 60

@@ -570,12 +497,12 @@ }

"range": [
881,
885
847,
851
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 62
},
"end": {
"line": 23,
"line": 22,
"column": 66

@@ -589,12 +516,12 @@ }

"range": [
881,
885
847,
851
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 62
},
"end": {
"line": 23,
"line": 22,
"column": 66

@@ -605,12 +532,12 @@ }

"range": [
881,
885
847,
851
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 62
},
"end": {
"line": 23,
"line": 22,
"column": 66

@@ -626,12 +553,12 @@ }

"range": [
892,
907
858,
873
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 73
},
"end": {
"line": 23,
"line": 22,
"column": 88

@@ -642,12 +569,12 @@ }

"range": [
819,
909
785,
875
],
"loc": {
"start": {
"line": 23,
"line": 22,
"column": 0
},
"end": {
"line": 25,
"line": 24,
"column": 0

@@ -658,112 +585,2 @@ }

{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "USER_AGENT",
"range": [
913,
923
],
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 14
}
}
},
"init": {
"type": "BinaryExpression",
"operator": "+",
"left": {
"type": "Literal",
"value": "neo4j-javascript/",
"raw": "\"neo4j-javascript/\"",
"range": [
926,
945
],
"loc": {
"start": {
"line": 25,
"column": 17
},
"end": {
"line": 25,
"column": 36
}
}
},
"right": {
"type": "Identifier",
"name": "VERSION",
"range": [
948,
955
],
"loc": {
"start": {
"line": 25,
"column": 39
},
"end": {
"line": 25,
"column": 46
}
}
},
"range": [
926,
955
],
"loc": {
"start": {
"line": 25,
"column": 17
},
"end": {
"line": 25,
"column": 46
}
}
},
"range": [
913,
955
],
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 46
}
}
}
],
"kind": "let",
"range": [
909,
956
],
"loc": {
"start": {
"line": 25,
"column": 0
},
"end": {
"line": 25,
"column": 47
}
}
},
{
"type": "ExportDefaultDeclaration",

@@ -779,12 +596,12 @@ "declaration": {

"range": [
977,
983
894,
900
],
"loc": {
"start": {
"line": 28,
"line": 25,
"column": 2
},
"end": {
"line": 28,
"line": 25,
"column": 8

@@ -795,147 +612,16 @@ }

"value": {
"type": "ArrowFunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "url",
"range": [
986,
989
],
"loc": {
"start": {
"line": 28,
"column": 11
},
"end": {
"line": 28,
"column": 14
}
}
},
{
"type": "Identifier",
"name": "token",
"range": [
991,
996
],
"loc": {
"start": {
"line": 28,
"column": 16
},
"end": {
"line": 28,
"column": 21
}
}
}
],
"body": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "Driver",
"range": [
1005,
1011
],
"loc": {
"start": {
"line": 28,
"column": 30
},
"end": {
"line": 28,
"column": 36
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "url",
"range": [
1012,
1015
],
"loc": {
"start": {
"line": 28,
"column": 37
},
"end": {
"line": 28,
"column": 40
}
}
},
{
"type": "Identifier",
"name": "USER_AGENT",
"range": [
1017,
1027
],
"loc": {
"start": {
"line": 28,
"column": 42
},
"end": {
"line": 28,
"column": 52
}
}
},
{
"type": "Identifier",
"name": "token",
"range": [
1029,
1034
],
"loc": {
"start": {
"line": 28,
"column": 54
},
"end": {
"line": 28,
"column": 59
}
}
}
],
"range": [
1001,
1035
],
"loc": {
"start": {
"line": 28,
"column": 26
},
"end": {
"line": 28,
"column": 60
}
}
},
"generator": false,
"expression": true,
"type": "Identifier",
"name": "driver",
"range": [
985,
1035
894,
900
],
"loc": {
"start": {
"line": 28,
"column": 10
"line": 25,
"column": 2
},
"end": {
"line": 28,
"column": 60
"line": 25,
"column": 8
}

@@ -946,16 +632,16 @@ }

"method": false,
"shorthand": false,
"shorthand": true,
"computed": false,
"range": [
977,
1035
894,
900
],
"loc": {
"start": {
"line": 28,
"line": 25,
"column": 2
},
"end": {
"line": 28,
"column": 60
"line": 25,
"column": 8
}

@@ -970,12 +656,12 @@ }

"range": [
1039,
1042
904,
907
],
"loc": {
"start": {
"line": 29,
"line": 26,
"column": 2
},
"end": {
"line": 29,
"line": 26,
"column": 5

@@ -989,12 +675,12 @@ }

"range": [
1039,
1042
904,
907
],
"loc": {
"start": {
"line": 29,
"line": 26,
"column": 2
},
"end": {
"line": 29,
"line": 26,
"column": 5

@@ -1009,12 +695,12 @@ }

"range": [
1039,
1042
904,
907
],
"loc": {
"start": {
"line": 29,
"line": 26,
"column": 2
},
"end": {
"line": 29,
"line": 26,
"column": 5

@@ -1030,12 +716,12 @@ }

"range": [
1046,
1051
911,
916
],
"loc": {
"start": {
"line": 30,
"line": 27,
"column": 2
},
"end": {
"line": 30,
"line": 27,
"column": 7

@@ -1049,12 +735,12 @@ }

"range": [
1046,
1051
911,
916
],
"loc": {
"start": {
"line": 30,
"line": 27,
"column": 2
},
"end": {
"line": 30,
"line": 27,
"column": 7

@@ -1069,12 +755,12 @@ }

"range": [
1046,
1051
911,
916
],
"loc": {
"start": {
"line": 30,
"line": 27,
"column": 2
},
"end": {
"line": 30,
"line": 27,
"column": 7

@@ -1090,12 +776,12 @@ }

"range": [
1055,
1059
920,
924
],
"loc": {
"start": {
"line": 31,
"line": 28,
"column": 2
},
"end": {
"line": 31,
"line": 28,
"column": 6

@@ -1114,12 +800,12 @@ }

"range": [
1067,
1072
932,
937
],
"loc": {
"start": {
"line": 32,
"line": 29,
"column": 4
},
"end": {
"line": 32,
"line": 29,
"column": 9

@@ -1137,12 +823,12 @@ }

"range": [
1075,
1083
940,
948
],
"loc": {
"start": {
"line": 32,
"line": 29,
"column": 12
},
"end": {
"line": 32,
"line": 29,
"column": 20

@@ -1156,12 +842,12 @@ }

"range": [
1085,
1093
950,
958
],
"loc": {
"start": {
"line": 32,
"line": 29,
"column": 22
},
"end": {
"line": 32,
"line": 29,
"column": 30

@@ -1186,12 +872,12 @@ }

"range": [
1114,
1120
979,
985
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 14
},
"end": {
"line": 33,
"line": 30,
"column": 20

@@ -1206,12 +892,12 @@ }

"range": [
1122,
1129
987,
994
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 22
},
"end": {
"line": 33,
"line": 30,
"column": 29

@@ -1226,12 +912,12 @@ }

"range": [
1114,
1129
979,
994
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 14
},
"end": {
"line": 33,
"line": 30,
"column": 29

@@ -1247,12 +933,12 @@ }

"range": [
1131,
1140
996,
1005
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 31
},
"end": {
"line": 33,
"line": 30,
"column": 40

@@ -1266,12 +952,12 @@ }

"range": [
1142,
1150
1007,
1015
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 42
},
"end": {
"line": 33,
"line": 30,
"column": 50

@@ -1286,12 +972,12 @@ }

"range": [
1131,
1150
996,
1015
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 31
},
"end": {
"line": 33,
"line": 30,
"column": 50

@@ -1307,12 +993,12 @@ }

"range": [
1152,
1163
1017,
1028
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 52
},
"end": {
"line": 33,
"line": 30,
"column": 63

@@ -1326,12 +1012,12 @@ }

"range": [
1165,
1173
1030,
1038
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 65
},
"end": {
"line": 33,
"line": 30,
"column": 73

@@ -1346,12 +1032,12 @@ }

"range": [
1152,
1173
1017,
1038
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 52
},
"end": {
"line": 33,
"line": 30,
"column": 73

@@ -1363,12 +1049,12 @@ }

"range": [
1113,
1174
978,
1039
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 13
},
"end": {
"line": 33,
"line": 30,
"column": 74

@@ -1379,12 +1065,12 @@ }

"range": [
1106,
1175
971,
1040
],
"loc": {
"start": {
"line": 33,
"line": 30,
"column": 6
},
"end": {
"line": 33,
"line": 30,
"column": 75

@@ -1396,12 +1082,12 @@ }

"range": [
1098,
1181
963,
1046
],
"loc": {
"start": {
"line": 32,
"line": 29,
"column": 35
},
"end": {
"line": 34,
"line": 31,
"column": 5

@@ -1414,12 +1100,12 @@ }

"range": [
1074,
1181
939,
1046
],
"loc": {
"start": {
"line": 32,
"line": 29,
"column": 11
},
"end": {
"line": 34,
"line": 31,
"column": 5

@@ -1434,12 +1120,12 @@ }

"range": [
1067,
1181
932,
1046
],
"loc": {
"start": {
"line": 32,
"line": 29,
"column": 4
},
"end": {
"line": 34,
"line": 31,
"column": 5

@@ -1451,12 +1137,12 @@ }

"range": [
1061,
1185
926,
1050
],
"loc": {
"start": {
"line": 31,
"line": 28,
"column": 8
},
"end": {
"line": 35,
"line": 32,
"column": 3

@@ -1471,12 +1157,12 @@ }

"range": [
1055,
1185
920,
1050
],
"loc": {
"start": {
"line": 31,
"line": 28,
"column": 2
},
"end": {
"line": 35,
"line": 32,
"column": 3

@@ -1492,12 +1178,12 @@ }

"range": [
1189,
1194
1054,
1059
],
"loc": {
"start": {
"line": 36,
"line": 33,
"column": 2
},
"end": {
"line": 36,
"line": 33,
"column": 7

@@ -1516,12 +1202,12 @@ }

"range": [
1202,
1206
1067,
1071
],
"loc": {
"start": {
"line": 37,
"line": 34,
"column": 4
},
"end": {
"line": 37,
"line": 34,
"column": 8

@@ -1535,12 +1221,12 @@ }

"range": [
1202,
1206
1067,
1071
],
"loc": {
"start": {
"line": 37,
"line": 34,
"column": 4
},
"end": {
"line": 37,
"line": 34,
"column": 8

@@ -1555,12 +1241,12 @@ }

"range": [
1202,
1206
1067,
1071
],
"loc": {
"start": {
"line": 37,
"line": 34,
"column": 4
},
"end": {
"line": 37,
"line": 34,
"column": 8

@@ -1576,12 +1262,12 @@ }

"range": [
1212,
1224
1077,
1089
],
"loc": {
"start": {
"line": 38,
"line": 35,
"column": 4
},
"end": {
"line": 38,
"line": 35,
"column": 16

@@ -1595,12 +1281,12 @@ }

"range": [
1212,
1224
1077,
1089
],
"loc": {
"start": {
"line": 38,
"line": 35,
"column": 4
},
"end": {
"line": 38,
"line": 35,
"column": 16

@@ -1615,12 +1301,12 @@ }

"range": [
1212,
1224
1077,
1089
],
"loc": {
"start": {
"line": 38,
"line": 35,
"column": 4
},
"end": {
"line": 38,
"line": 35,
"column": 16

@@ -1636,12 +1322,12 @@ }

"range": [
1230,
1249
1095,
1114
],
"loc": {
"start": {
"line": 39,
"line": 36,
"column": 4
},
"end": {
"line": 39,
"line": 36,
"column": 23

@@ -1655,12 +1341,12 @@ }

"range": [
1230,
1249
1095,
1114
],
"loc": {
"start": {
"line": 39,
"line": 36,
"column": 4
},
"end": {
"line": 39,
"line": 36,
"column": 23

@@ -1675,12 +1361,12 @@ }

"range": [
1230,
1249
1095,
1114
],
"loc": {
"start": {
"line": 39,
"line": 36,
"column": 4
},
"end": {
"line": 39,
"line": 36,
"column": 23

@@ -1696,12 +1382,12 @@ }

"range": [
1255,
1266
1120,
1131
],
"loc": {
"start": {
"line": 40,
"line": 37,
"column": 4
},
"end": {
"line": 40,
"line": 37,
"column": 15

@@ -1715,12 +1401,12 @@ }

"range": [
1255,
1266
1120,
1131
],
"loc": {
"start": {
"line": 40,
"line": 37,
"column": 4
},
"end": {
"line": 40,
"line": 37,
"column": 15

@@ -1735,12 +1421,12 @@ }

"range": [
1255,
1266
1120,
1131
],
"loc": {
"start": {
"line": 40,
"line": 37,
"column": 4
},
"end": {
"line": 40,
"line": 37,
"column": 15

@@ -1756,12 +1442,12 @@ }

"range": [
1272,
1276
1137,
1141
],
"loc": {
"start": {
"line": 41,
"line": 38,
"column": 4
},
"end": {
"line": 41,
"line": 38,
"column": 8

@@ -1775,12 +1461,12 @@ }

"range": [
1272,
1276
1137,
1141
],
"loc": {
"start": {
"line": 41,
"line": 38,
"column": 4
},
"end": {
"line": 41,
"line": 38,
"column": 8

@@ -1795,12 +1481,12 @@ }

"range": [
1272,
1276
1137,
1141
],
"loc": {
"start": {
"line": 41,
"line": 38,
"column": 4
},
"end": {
"line": 41,
"line": 38,
"column": 8

@@ -1812,12 +1498,12 @@ }

"range": [
1196,
1280
1061,
1145
],
"loc": {
"start": {
"line": 36,
"line": 33,
"column": 9
},
"end": {
"line": 42,
"line": 39,
"column": 3

@@ -1832,12 +1518,12 @@ }

"range": [
1189,
1280
1054,
1145
],
"loc": {
"start": {
"line": 36,
"line": 33,
"column": 2
},
"end": {
"line": 42,
"line": 39,
"column": 3

@@ -1849,12 +1535,12 @@ }

"range": [
973,
1282
890,
1147
],
"loc": {
"start": {
"line": 27,
"line": 24,
"column": 15
},
"end": {
"line": 43,
"line": 40,
"column": 1

@@ -1867,12 +1553,12 @@ }

"range": [
958,
1283
875,
1148
],
"loc": {
"start": {
"line": 27,
"line": 24,
"column": 0
},
"end": {
"line": 44,
"line": 41,
"column": 0

@@ -1886,3 +1572,3 @@ }

714,
1283
1148
],

@@ -1895,3 +1581,3 @@ "loc": {

"end": {
"line": 44,
"line": 41,
"column": 0

@@ -1898,0 +1584,0 @@ }

@@ -26,10 +26,10 @@ {

},
"src/v1/internal/pool.js": {
"expectCount": 2,
"actualCount": 2,
"src/v1/record.js": {
"expectCount": 3,
"actualCount": 3,
"undocumentLines": []
},
"src/v1/result.js": {
"expectCount": 5,
"actualCount": 5,
"expectCount": 4,
"actualCount": 4,
"undocumentLines": []

@@ -36,0 +36,0 @@ },

{
"name": "neo4j-driver",
"version": "1.0.0-M04",
"version": "1.0.0-RC1",
"description": "Connect to Neo4j 3.0.0 and up from JavaScript",

@@ -24,2 +24,3 @@ "author": "Neo Technology Inc.",

"esdoc": "^0.4.0",
"esdoc-importpath-plugin": "0.0.1",
"glob": "^5.0.14",

@@ -26,0 +27,0 @@ "gulp": "^3.9.0",

@@ -45,8 +45,2 @@ window.esdocSearchIndex = [

[
"neo4j-driver/src/v1/internal/pool.js~pool",
"class/src/v1/internal/pool.js~Pool.html",
"<span>Pool</span> <span class=\"search-result-import-path\">neo4j-driver/src/v1/internal/pool.js</span>",
"class"
],
[
"neo4j-driver/src/v1/result-summary.js~profiledplan",

@@ -58,2 +52,8 @@ "class/src/v1/result-summary.js~ProfiledPlan.html",

[
"neo4j-driver/src/v1/record.js~record",
"class/src/v1/record.js~Record.html",
"<span>Record</span> <span class=\"search-result-import-path\">neo4j-driver/src/v1/record.js</span>",
"class"
],
[
"neo4j-driver/src/v1/graph-types.js~relationship",

@@ -95,2 +95,8 @@ "class/src/v1/graph-types.js~Relationship.html",

[
"neo4j-driver/src/v1/driver.js~driver",
"function/index.html#static-function-driver",
"<span>driver</span> <span class=\"search-result-import-path\">neo4j-driver/src/v1/driver.js</span>",
"function"
],
[
"neo4j-driver/src/v1/integer.js~int",

@@ -456,8 +462,2 @@ "variable/index.html#static-variable-int",

[
"src/v1/driver.js~driver#constructor",
"class/src/v1/driver.js~Driver.html#instance-constructor-constructor",
"src/v1/driver.js~Driver#constructor",
"method"
],
[
"src/v1/driver.js~driver#session",

@@ -703,74 +703,20 @@ "class/src/v1/driver.js~Driver.html#instance-method-session",

[
"src/v1/internal/buf.js",
"file/src/v1/internal/buf.js.html",
"src/v1/internal/buf.js",
"src/v1/record.js",
"file/src/v1/record.js.html",
"src/v1/record.js",
"file"
],
[
"src/v1/internal/ch-dummy.js",
"file/src/v1/internal/ch-dummy.js.html",
"src/v1/internal/ch-dummy.js",
"file"
"src/v1/record.js~record#foreach",
"class/src/v1/record.js~Record.html#instance-method-forEach",
"src/v1/record.js~Record#forEach",
"method"
],
[
"src/v1/internal/ch-node.js",
"file/src/v1/internal/ch-node.js.html",
"src/v1/internal/ch-node.js",
"file"
],
[
"src/v1/internal/ch-websocket.js",
"file/src/v1/internal/ch-websocket.js.html",
"src/v1/internal/ch-websocket.js",
"file"
],
[
"src/v1/internal/chunking.js",
"file/src/v1/internal/chunking.js.html",
"src/v1/internal/chunking.js",
"file"
],
[
"src/v1/internal/connector.js",
"file/src/v1/internal/connector.js.html",
"src/v1/internal/connector.js",
"file"
],
[
"src/v1/internal/log.js",
"file/src/v1/internal/log.js.html",
"src/v1/internal/log.js",
"file"
],
[
"src/v1/internal/packstream.js",
"file/src/v1/internal/packstream.js.html",
"src/v1/internal/packstream.js",
"file"
],
[
"src/v1/internal/pool.js",
"file/src/v1/internal/pool.js.html",
"src/v1/internal/pool.js",
"file"
],
[
"src/v1/internal/pool.js~pool#constructor",
"class/src/v1/internal/pool.js~Pool.html#instance-constructor-constructor",
"src/v1/internal/pool.js~Pool#constructor",
"src/v1/record.js~record#get",
"class/src/v1/record.js~Record.html#instance-method-get",
"src/v1/record.js~Record#get",
"method"
],
[
"src/v1/internal/stream-observer.js",
"file/src/v1/internal/stream-observer.js.html",
"src/v1/internal/stream-observer.js",
"file"
],
[
"src/v1/internal/utf8.js",
"file/src/v1/internal/utf8.js.html",
"src/v1/internal/utf8.js",
"file"
],
[
"src/v1/result-summary.js",

@@ -908,8 +854,2 @@ "file/src/v1/result-summary.js.html",

[
"src/v1/result.js~result#constructor",
"class/src/v1/result.js~Result.html#instance-constructor-constructor",
"src/v1/result.js~Result#constructor",
"method"
],
[
"src/v1/result.js~result#subscribe",

@@ -916,0 +856,0 @@ "class/src/v1/result.js~Result.html#instance-method-subscribe",

@@ -5,3 +5,3 @@ {

"includes": ["\\.js$"],
"excludes": ["external"],
"excludes": ["external", "internal"],
"package": "./package.json",

@@ -8,0 +8,0 @@ "title": "Neo4j Bolt Driver for Javascript",

@@ -207,3 +207,3 @@ /**

'steps': 'test/v1/tck/steps/*.js',
'format': 'pretty',
'format': 'summary',
'tags' : ['~@in_dev', '~@db']

@@ -210,0 +210,0 @@ }));

@@ -26,3 +26,3 @@ /**

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _get = function get(_x5, _x6, _x7) { var _again = true; _function: while (_again) { var object = _x5, property = _x6, receiver = _x7; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x5 = parent; _x6 = property; _x7 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -49,9 +49,18 @@ var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _version = require('../version');
/**
* A Driver instance is used for mananging {@link Session}s.
* @access public
*/
* A driver maintains one or more {@link Session sessions} with a remote
* Neo4j instance. Through the {@link Session sessions} you can send statements
* and retrieve results from the database.
*
* Drivers are reasonably expensive to create - you should strive to keep one
* driver instance around per Neo4j Instance you connect to.
*
* @access public
*/
var Driver = (function () {
/**
* You should not be calling this directly, instead use {@link driver}.
* @constructor

@@ -61,12 +70,19 @@ * @param {string} url

* @param {Object} token
* @param {Object} config
* @access private
*/
function Driver(url, userAgent, token) {
function Driver(url) {
var userAgent = arguments.length <= 1 || arguments[1] === undefined ? 'neo4j-javascript/0.0' : arguments[1];
var token = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
var config = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
_classCallCheck(this, Driver);
this._url = url;
this._userAgent = userAgent || 'neo4j-javascript/0.0';
this._userAgent = userAgent;
this._openSessions = {};
this._sessionIdGenerator = 0;
this._token = token || {};
this._token = token;
this._config = config;
this._pool = new _internalPool.Pool(this._createConnection.bind(this), this._destroyConnection.bind(this), this._validateConnection.bind(this));

@@ -88,3 +104,3 @@ }

var streamObserver = new _ConnectionStreamObserver(this);
var conn = (0, _internalConnector.connect)(this._url);
var conn = (0, _internalConnector.connect)(this._url, this._config);
conn.initialize(this._userAgent, this._token, streamObserver);

@@ -124,3 +140,12 @@ conn._id = sessionId;

/**
* Create and return new session
* Acquire a session to communicate with the database. The driver maintains
* a pool of sessions, so calling this method is normally cheap because you
* will be pulling a session out of the common pool.
*
* This comes with some responsibility - make sure you always call
* {@link Session#close()} when you are done using a session, and likewise,
* make sure you don't close your session before you are done using it. Once
* it is returned to the pool, the session will be reset to a clean state and
* made available for others to use.
*
* @return {Session} new session.

@@ -157,4 +182,5 @@ */

/**
* Close sessions connections
* @return
* Close all open sessions and other associated resources. You should
* make sure to use this when you are done with this driver instance.
* @return undefined
*/

@@ -202,3 +228,64 @@ }, {

exports['default'] = Driver;
module.exports = exports['default'];
var USER_AGENT = "neo4j-javascript/" + _version.VERSION;
/**
* Construct a new Neo4j Driver. This is your main entry point for this
* library.
*
* ## Configuration
*
* This function optionally takes a configuration argument. Available configuration
* options are as follows:
*
* {
* // Enable TLS encryption. This is on by default in modern NodeJS installs,
* // but off by default in the Web Bundle and old (<=1.0.0) NodeJS installs
* // due to technical limitations on those platforms.
* encrypted: true|false,
*
* // Trust strategy to use if encryption is enabled. There is no mode to disable
* // trust other than disabling encryption altogether. The reason for
* // this is that if you don't know who you are talking to, it is easy for an
* // attacker to hijack your encrypted connection, rendering encryption pointless.
* //
* // TRUST_ON_FIRST_USE is the default for modern NodeJS deployments, and works
* // similarly to how `ssl` works - the first time we connect to a new host,
* // we remember the certificate they use. If the certificate ever changes, we
* // assume it is an attempt to hijack the connection and require manual intervention.
* // This means that by default, connections "just work" while still giving you
* // good encrypted protection.
* //
* // TRUST_SIGNED_CERTIFICATES is the classic approach to trust verification -
* // whenever we establish an encrypted connection, we ensure the host is using
* // an encryption certificate that is in, or is signed by, a certificate listed
* // as trusted. In the web bundle, this list of trusted certificates is maintained
* // by the web browser. In NodeJS, you configure the list with the next config option.
* trust: "TRUST_ON_FIRST_USE" | "TRUST_SIGNED_CERTIFICATES",
*
* // List of one or more paths to trusted encryption certificates. This only
* // works in the NodeJS bundle, and only matters if you use "TRUST_SIGNED_CERTIFICATES".
* // The certificate files should be in regular X.509 PEM format.
* // For instance, ['./trusted.pem']
* trustedCertificates: [],
*
* // Path to a file where the driver saves hosts it has seen in the past, this is
* // very similar to the ssl tool's known_hosts file. Each time we connect to a
* // new host, a hash of their certificate is stored along with the domain name and
* // port, and this is then used to verify the host certificate does not change.
* // This setting has no effect unless TRUST_ON_FIRST_USE is enabled.
* knownHosts:"~/.neo4j/known_hosts",
* }
*
* @param {string} url The URL for the Neo4j database, for instance "bolt://localhost"
* @param {Map<String,String>} authToken Authentication credentials. See {@link auth} for helpers.
* @param {Object} config Configuration object. See the configuration section above for details.
* @returns {Driver}
*/
function driver(url, authToken) {
var config = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
return new Driver(url, USER_AGENT, authToken, config);
}
exports.Driver = Driver;
exports.driver = driver;

@@ -105,3 +105,3 @@ /**

value: function toString() {
var s = "(" + this.start.split('/')[1] + ")-[:" + this.type;
var s = "(" + this.start + ")-[:" + this.type;
var keys = Object.keys(this.properties);

@@ -116,3 +116,3 @@ if (keys.length > 0) {

}
s += "]->(" + this.end.split('/')[1] + ")";
s += "]->(" + this.end + ")";
return s;

@@ -119,0 +119,0 @@ }

@@ -26,4 +26,2 @@ /**

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _integer = require('./integer');

@@ -33,14 +31,6 @@

var _driver2 = _interopRequireDefault(_driver);
var _version = require('../version');
var _graphTypes = require('./graph-types');
var USER_AGENT = "neo4j-javascript/" + _version.VERSION;
exports['default'] = {
driver: function driver(url, token) {
return new _driver2['default'](url, USER_AGENT, token);
},
driver: _driver.driver,
int: _integer.int,

@@ -47,0 +37,0 @@ isInt: _integer.isInt,

@@ -447,3 +447,3 @@ /**

/**
* Represents a view of slice of another buffer.
* Represents a view as slice of another buffer.
* @access private

@@ -494,3 +494,3 @@ */

copy.putUInt8(i, this.getUInt8(i + start));
};
}
return copy;

@@ -610,3 +610,3 @@ }

}
};
}
}

@@ -701,8 +701,8 @@ }, {

/**
* Allocate a new buffer using whatever mechanism is most sensible for the
* current platform
* @access private
* @param {Integer} size
* @return new buffer
*/
* Allocate a new buffer using whatever mechanism is most sensible for the
* current platform
* @access private
* @param {Integer} size
* @return new buffer
*/
function alloc(size) {

@@ -709,0 +709,0 @@ return new _DefaultBuffer(size);

@@ -36,11 +36,134 @@ /**

var _tls = require('tls');
var _tls2 = _interopRequireDefault(_tls);
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _os = require('os');
var _buf = require('./buf');
var _error = require('./error');
var _CONNECTION_IDGEN = 0;
function userHome() {
// For some reason, Browserify chokes on shimming `process`. This code
// will never get executed on the browser anyway, to just hack around it
var getOutOfHereBrowserifyYoureDrunk = require;
var process = getOutOfHereBrowserifyYoureDrunk('process');
return process.env[process.platform == 'win32' ? 'USERPROFILE' : 'HOME'];
}
function loadFingerprint(serverId, knownHostsPath, cb) {
if (!_fs2['default'].existsSync(knownHostsPath)) {
cb(null);
return;
}
var found = false;
require('readline').createInterface({
input: _fs2['default'].createReadStream(knownHostsPath)
}).on('line', function (line) {
if (line.startsWith(serverId)) {
found = true;
cb(line.split(" ")[1]);
}
}).on('close', function () {
if (!found) {
cb(null);
}
});
}
function storeFingerprint(serverId, knownHostsPath, fingerprint) {
_fs2['default'].appendFile(knownHostsPath, serverId + " " + fingerprint + _os.EOL, "utf8");
}
var TrustStrategy = {
TRUST_SIGNED_CERTIFICATES: function TRUST_SIGNED_CERTIFICATES(opts, onSuccess, onFailure) {
if (!opts.trustedCertificates || opts.trustedCertificates.length == 0) {
onFailure((0, _error.newError)("You are using TRUST_SIGNED_CERTIFICATES as the method " + "to verify trust for encrypted connections, but have not configured any " + "trustedCertificates. You must specify the path to at least one trusted " + "X.509 certificate for this to work. Two other alternatives is to use " + "TRUST_ON_FIRST_USE or to disable encryption by setting encrypted=false " + "in your driver configuration."));
return;
}
var tlsOpts = {
ca: opts.trustedCertificates.map(_fs2['default'].readFileSync),
// Because we manually check for this in the connect callback, to give
// a more helpful error to the user
rejectUnauthorized: false
};
var socket = _tls2['default'].connect(opts.port, opts.host, tlsOpts, function () {
if (!socket.authorized) {
onFailure((0, _error.newError)("Server certificate is not trusted. If you trust the database you are connecting to, add" + " the signing certificate, or the server certificate, to the list of certificates trusted by this driver" + " using `neo4j.v1.driver(.., { trustedCertificates:['path/to/certificate.crt']}). This " + " is a security measure to protect against man-in-the-middle attacks. If you are just trying " + " Neo4j out and are not concerned about encryption, simply disable it using `encrypted=false` in the driver" + " options."));
} else {
onSuccess();
}
});
return socket;
},
TRUST_ON_FIRST_USE: function TRUST_ON_FIRST_USE(opts, onSuccess, onFailure) {
var tlsOpts = {
// Because we manually verify the certificate against known_hosts
rejectUnauthorized: false
};
var socket = _tls2['default'].connect(opts.port, opts.host, tlsOpts, function () {
var serverCert = socket.getPeerCertificate( /*raw=*/true);
if (!serverCert.raw) {
// If `raw` is not available, we're on an old version of NodeJS, and
// the raw cert cannot be accessed (or, at least I couldn't find a way to)
// therefore, we can't generate a SHA512 fingerprint, meaning we can't
// do TOFU, and the safe approach is to fail.
onFailure((0, _error.newError)("You are using a version of NodeJS that does not " + "support trust-on-first use encryption. You can either upgrade NodeJS to " + "a newer version, use `trust:TRUST_SIGNED_CERTIFICATES` in your driver " + "config instead, or disable encryption using `encrypted:false`."));
return;
}
var serverFingerprint = require('crypto').createHash('sha512').update(serverCert.raw).digest("hex");
var knownHostsPath = opts.knownHosts || _path2['default'].join(userHome(), ".neo4j", "known_hosts");
var serverId = opts.host + ":" + opts.port;
loadFingerprint(serverId, knownHostsPath, function (knownFingerprint) {
if (knownFingerprint === serverFingerprint) {
onSuccess();
} else if (knownFingerprint == null) {
storeFingerprint(serverId, knownHostsPath, serverFingerprint);
onSuccess();
} else {
onFailure((0, _error.newError)("Database encryption certificate has changed, and no longer " + "matches the certificate stored for " + serverId + " in `" + knownHostsPath + "`. As a security precaution, this driver will not automatically trust the new " + "certificate, because doing so would allow an attacker to pretend to be the Neo4j " + "instance we want to connect to. The certificate provided by the server looks like: " + serverCert + ". If you trust that this certificate is valid, simply remove the line " + "starting with " + serverId + " in `" + knownHostsPath + "`, and the driver will " + "update the file with the new certificate. You can configure which file the driver " + "should use to store this information by setting `knownHosts` to another path in " + "your driver configuration - and you can disable encryption there as well using " + "`encrypted:false`."));
}
});
});
return socket;
}
};
function connect(opts, onSuccess) {
var onFailure = arguments.length <= 2 || arguments[2] === undefined ? function () {
return null;
} : arguments[2];
if (opts.encrypted === false) {
return _net2['default'].connect(opts.port, opts.host, onSuccess);
} else if (TrustStrategy[opts.trust]) {
return TrustStrategy[opts.trust](opts, onSuccess, onFailure);
} else {
onFailure((0, _error.newError)("Unknown trust strategy: " + opts.trust + ". Please use either " + "trust:'TRUST_SIGNED_CERTIFICATES' or trust:'TRUST_ON_FIRST_USE' in your driver " + "configuration. Alternatively, you can disable encryption by setting " + "`encrypted:false`. There is no mechanism to use encryption without trust verification, " + "because this incurs the overhead of encryption without improving security. If " + "the driver does not verify that the peer it is connected to is really Neo4j, it " + "is very easy for an attacker to bypass the encryption by pretending to be Neo4j."));
}
}
/**
* In a Node.js environment the 'net' module is used
* as transport.
* @access private
*/
* In a Node.js environment the 'net' module is used
* as transport.
* @access private
*/

@@ -59,3 +182,3 @@ var NodeChannel = (function () {

var _self = this;
var self = this;

@@ -66,33 +189,41 @@ this.id = _CONNECTION_IDGEN++;

this._open = true;
this._conn = _net2['default'].connect(opts.port || 7687, opts.host, function () {
if (!_self._open) {
this._error = null;
this._handleConnectionError = this._handleConnectionError.bind(this);
this._conn = connect(opts, function () {
if (!self._open) {
return;
}
self._conn.on('data', function (buffer) {
if (self.onmessage) {
self.onmessage(new _buf.NodeBuffer(buffer));
}
});
self._conn.on('error', self._handleConnectionError);
// Drain all pending messages
var pending = _self._pending;
_self._pending = null;
var pending = self._pending;
self._pending = null;
for (var i = 0; i < pending.length; i++) {
_self.write(pending[i]);
self.write(pending[i]);
}
});
}, this._handleConnectionError);
}
this._conn.on('data', function (buffer) {
if (_self.onmessage) {
_self.onmessage(new _buf.NodeBuffer(buffer));
_createClass(NodeChannel, [{
key: '_handleConnectionError',
value: function _handleConnectionError(err) {
this._error = err;
if (this.onerror) {
this.onerror(err);
}
});
}
this._conn.on('error', function (err) {
if (_self.onerror) {
_self.onerror(err);
}
});
}
/**
* Write the passed in buffer to connection
* @param {NodeBuffer} buffer - Buffer to write
*/
_createClass(NodeChannel, [{
/**
* Write the passed in buffer to connection
* @param {NodeBuffer} buffer - Buffer to write
*/
}, {
key: 'write',

@@ -118,8 +249,14 @@ value: function write(buffer) {

key: 'close',
value: function close(cb) {
if (cb) {
value: function close() {
var cb = arguments.length <= 0 || arguments[0] === undefined ? function () {
return null;
} : arguments[0];
this._open = false;
if (this._conn) {
this._conn.end();
this._conn.on('end', cb);
} else {
cb();
}
this._open = false;
this._conn.end();
}

@@ -126,0 +263,0 @@ }]);

@@ -34,2 +34,4 @@ /**

var _error = require('./error');
/**

@@ -52,8 +54,20 @@ * Create a new WebSocketChannel to be used in web browsers.

this._url = "ws:" + opts.host + ":" + (opts.port || 7687);
this._ws = new WebSocket(this._url);
this._ws.binaryType = "arraybuffer";
this._open = true;
this._pending = [];
this._error = null;
this._handleConnectionError = this._handleConnectionError.bind(this);
var scheme = "ws";
if (opts.encrypted) {
if (!opts.trust || opts.trust === "TRUST_SIGNED_CERTIFICATES") {
scheme = "wss";
} else {
this._error = (0, _error.newError)("The browser version of this driver only supports one trust " + "strategy, 'TRUST_SIGNED_CERTIFICATES'. " + opts.trust + " is not supported. Please " + "either use TRUST_SIGNED_CERTIFICATES or disable encryption by setting " + "`encrypted:false` in the driver configuration.");
return;
}
}
this._url = scheme + ":" + opts.host + ":" + opts.port;
this._ws = new WebSocket(this._url);
this._ws.binaryType = "arraybuffer";
var self = this;

@@ -75,15 +89,23 @@ this._ws.onopen = function () {

this._ws.onerror = function (err) {
if (self.onerror) {
self.onerror(err);
}
};
this._ws.onerror = this._handleConnectionError;
}
/**
* Write the passed in buffer to connection
* @param {HeapBuffer} buffer - Buffer to write
*/
_createClass(WebSocketChannel, [{
key: "_handleConnectionError",
value: function _handleConnectionError() {
// onerror triggers on websocket close as well.. don't get me started.
if (this._open) {
// http://stackoverflow.com/questions/25779831/how-to-catch-websocket-connection-to-ws-xxxnn-failed-connection-closed-be
this._error = (0, _error.newError)("WebSocket connection failure. Due to security " + "constraints in your web browser, the reason for the failure is not available " + "to this Neo4j Driver. Please use your browsers development console to determine " + "the root cause of the failure. Common reasons include the database being " + "unavailable, using the wrong connection URL or temporary network problems. " + "If you have enabled encryption, ensure your browser is configured to trust the " + "certificate Neo4j is configured to use. WebSocket `readyState` is: " + this._ws.readyState);
if (this.onerror) {
this.onerror(this._error);
}
}
}
_createClass(WebSocketChannel, [{
/**
* Write the passed in buffer to connection
* @param {HeapBuffer} buffer - Buffer to write
*/
}, {
key: "write",

@@ -108,8 +130,10 @@ value: function write(buffer) {

key: "close",
value: function close(cb) {
if (cb) {
this._ws.onclose(cb);
}
value: function close() {
var cb = arguments.length <= 0 || arguments[0] === undefined ? function () {
return null;
} : arguments[0];
this._open = false;
this._ws.close();
this._ws.onclose = cb;
}

@@ -116,0 +140,0 @@ }]);

@@ -44,2 +44,6 @@ /**

var _features = require("./features");
var _features2 = _interopRequireDefault(_features);
var _packstream = require("./packstream");

@@ -57,2 +61,4 @@

var _error = require('./error');
var Channel = undefined;

@@ -112,8 +118,4 @@ if (_chWebsocket2["default"].available) {

function NO_OP() {};
function NO_OP() {}
function LOG(err) {
console.log(err);
};
var NO_OP_OBSERVER = {

@@ -204,4 +206,2 @@ onNext: NO_OP,

function Connection(channel) {
var _this = this;
_classCallCheck(this, Connection);

@@ -233,2 +233,5 @@

var self = this;
// TODO: Using `onmessage` and `onerror` came from the WebSocket API,
// it reads poorly and has several annoying drawbacks. Swap to having
// Channel extend EventEmitter instead, then we can use `on('data',..)`
this._ch.onmessage = function (buf) {

@@ -247,13 +250,17 @@ var proposed = buf.readInt32();

} else {
_this._isBroken = true;
console.log("FATAL, unknown protocol version:", proposed);
self._handleFatalError((0, _error.newError)("Unknown Bolt protocol version: " + proposed));
}
};
this._ch.onerror = function (error) {
self._isBroken = true;
if (_this._currentObserver.onError) {
_this._currentObserver.onError(error);
}
};
// Listen to connection errors. Important note though;
// In some cases we will get a channel that is already broken (for instance,
// if the user passes invalid configuration options). In this case, onerror
// will have "already triggered" before we add out listener here. So the line
// below also checks that the channel is not already failed. This could be nicely
// encapsulated into Channel if we used `on('error', ..)` rather than `onerror=..`
// as outlined in the comment about `onmessage` further up in this file.
this._ch.onerror = this._handleFatalError.bind(this);
if (this._ch._error) {
this._handleFatalError(this._ch._error);
}

@@ -280,10 +287,34 @@ this._dechunker.onmessage = function (buf) {

* @param {string} url - 'neo4j'-prefixed URL to Neo4j Bolt endpoint
* @param {Channel} channel - Optionally inject Channel to be used.
* @param {object} config
* @return {Connection} - New connection
*/
/**
* "Fatal" means the connection is dead. Only call this if something
* happens that cannot be recovered from. This will lead to all subscribers
* failing, and the connection getting ejected from the session pool.
*
* @param err an error object, forwarded to all current and future subscribers
* @private
*/
_createClass(Connection, [{
key: "_handleFatalError",
value: function _handleFatalError(err) {
this._isBroken = true;
this._error = err;
if (this._currentObserver && this._currentObserver.onError) {
this._currentObserver.onError(err);
}
while (this._pendingObservers.length > 0) {
var observer = this._pendingObservers.shift();
if (observer && observer.onError) {
observer.onError(err);
}
}
}
}, {
key: "_handleMessage",
value: function _handleMessage(msg) {
var _this2 = this;
var _this = this;

@@ -311,4 +342,4 @@ switch (msg.signature) {

(function () {
_this2._isHandlingFailure = true;
var self = _this2;
_this._isHandlingFailure = true;
var self = _this;

@@ -320,3 +351,3 @@ // isHandlingFailure was false, meaning this is the first failure message

// this _isHandlingFailure thing.
_this2._ackFailure({
_this._ackFailure({
onNext: NO_OP,

@@ -340,4 +371,3 @@ onError: NO_OP,

default:
this._isBroken = true;
console.log("UNKNOWN MESSAGE: ", msg);
this._handleFatalError((0, _error.newError)("Unknown Bolt protocol message: " + msg));
}

@@ -402,3 +432,12 @@ }

value: function _queueObserver(observer) {
if (this._isBroken) {
if (observer && observer.onError) {
observer.onError(this._error);
}
return;
}
observer = observer || NO_OP_OBSERVER;
observer.onCompleted = observer.onCompleted || NO_OP;
observer.onError = observer.onError || NO_OP;
observer.onNext = observer.onNext || NO_OP;
if (this._currentObserver === undefined) {

@@ -443,8 +482,14 @@ this._currentObserver = observer;

function connect(url) {
var channel = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var config = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
channel = channel || Channel;
return new Connection(new channel({
var Ch = config.channel || Channel;
return new Connection(new Ch({
host: host(url),
port: port(url)
port: port(url) || 7687,
// Default to using encryption if trust-on-first-use is available
encrypted: config.encrypted || (0, _features2["default"])("trust_on_first_use"),
// Default to using trust-on-first-use if it is available
trust: config.trust || ((0, _features2["default"])("trust_on_first_use") ? "TRUST_ON_FIRST_USE" : "TRUST_SIGNED_CERTIFICATES"),
trustedCertificates: config.trustedCertificates || [],
knownHosts: config.knownHosts
}));

@@ -451,0 +496,0 @@ }

@@ -20,2 +20,14 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _record = require("../record");
/**

@@ -31,12 +43,3 @@ * Handles a RUN/PULL_ALL, or RUN/DISCARD_ALL requests, maps the responses

*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var StreamObserver = (function () {

@@ -50,3 +53,4 @@ /**

this._head = null;
this._fieldKeys = null;
this._fieldLookup = null;
this._queuedRecords = [];

@@ -67,6 +71,3 @@ this._tail = null;

value: function onNext(rawRecord) {
var record = {};
for (var i = 0; i < this._head.length; i++) {
record[this._head[i]] = rawRecord[i];
}
var record = new _record.Record(this._fieldKeys, rawRecord, this._fieldLookup);
if (this._observer) {

@@ -78,12 +79,18 @@ this._observer.onNext(record);

}
/**
* TODO
*/
}, {
key: "onCompleted",
value: function onCompleted(meta) {
if (this._head === null) {
// Stream header
this._head = meta.fields;
if (this._fieldKeys === null) {
// Stream header, build a name->index field lookup table
// to be used by records. This is an optimization to make it
// faster to look up fields in a record by name, rather than by index.
// Since the records we get back via Bolt are just arrays of values.
this._fieldKeys = [];
this._fieldLookup = {};
if (meta.fields && meta.fields.length > 0) {
this._fieldKeys = meta.fields;
for (var i = 0; i < meta.fields.length; i++) {
this._fieldLookup[meta.fields[i]] = i;
}
}
} else {

@@ -90,0 +97,0 @@ // End of stream

@@ -39,3 +39,3 @@ /**

/**
* A Result instance is used for retrieving request response.
* A stream of {@link Record} representing the result of a statement.
* @access public

@@ -48,2 +48,3 @@ */

* @constructor
* @access private
* @param {StreamObserver} streamObserver

@@ -66,2 +67,3 @@ * @param {mixed} statement - Cypher statement to execute

* @return {Promise} new Promise.
* @access private
*/

@@ -94,7 +96,7 @@

/**
* Waits for all results and calls the passed in function
* with the results.
* Cannot be used with the subscribe function.
* @param {function(error: Object)} onFulfilled - Function to be called when finished.
* @param {function(error: Object)} onRejected - Function to be called upon errors.
* Waits for all results and calls the passed in function with the results.
* Cannot be combined with the {@link #subscribe} function.
*
* @param {function(result: {records:Array<Record>})} onFulfilled - Function to be called when finished.
* @param {function(error: {message:string, code:string})} onRejected - Function to be called upon errors.
* @return {Promise} promise.

@@ -106,4 +108,3 @@ */

this._createPromise();
this._p.then(onFulfilled, onRejected);
return this._p;
return this._p.then(onFulfilled, onRejected);
}

@@ -114,3 +115,3 @@

* Cannot be used with the subscribe function.
* @param {function(error: Object)} onRejected - Function to be called upon errors.
* @param {function(error: {message:string, code:string})} onRejected - Function to be called upon errors.
* @return {Promise} promise.

@@ -122,12 +123,13 @@ */

this._createPromise();
this._p['catch'](onRejected);
return this._p;
return this._p['catch'](onRejected);
}
/**
* Stream results to observer as they come in.
* Stream records to observer as they come in, this is a more efficient method
* of handling the results, and allows you to handle arbitrarily large results.
*
* @param {Object} observer - Observer object
* @param {function(record: Object)} observer.onNext - Handle records, one by one.
* @param {function(metadata: Object)} observer.onComplete - Handle stream tail, the metadata.
* @param {function(error: Object)} observer.onError - Handle errors.
* @param {function(record: Record)} observer.onNext - Handle records, one by one.
* @param {function(metadata: Object)} observer.onCompleted - Handle stream tail, the metadata.
* @param {function(error: {message:string, code:string})} observer.onError - Handle errors.
* @return

@@ -146,2 +148,5 @@ */

observer.onCompleted = onCompletedWrapper;
observer.onError = observer.onError || function (err) {
console.log("Uncaught error when processing result: " + err);
};
this._streamObserver.subscribe(observer);

@@ -148,0 +153,0 @@ }

@@ -118,3 +118,3 @@ /**

/**
* Close this session
* Close this session.
* @param {function()} cb - Function to be called after the session has been closed

@@ -121,0 +121,0 @@ * @return

{
"name": "neo4j-driver",
"version": "1.0.0-M04",
"version": "1.0.0-RC1",
"description": "Connect to Neo4j 3.0.0 and up from JavaScript",

@@ -24,2 +24,3 @@ "author": "Neo Technology Inc.",

"esdoc": "^0.4.0",
"esdoc-importpath-plugin": "0.0.1",
"glob": "^5.0.14",

@@ -26,0 +27,0 @@ "gulp": "^3.9.0",

@@ -66,3 +66,3 @@ /**

var observer = DummyChannel.observer;
var conn = connect("bolt://localhost", DummyChannel.channel)
var conn = connect("bolt://localhost", {channel:DummyChannel.channel});

@@ -69,0 +69,0 @@ // When

@@ -53,3 +53,3 @@ /**

.then( function( result ) {
console.log( "Neo is " + result.records[0]["p.age"].toInt() + " years old." );
console.log( "Neo is " + result.records[0].get("p.age").toInt() + " years old." );

@@ -118,18 +118,37 @@ session.close();

// tag::tls-require-encryption[]
// Unfortunately, this feature is not yet implemented for JavaScript
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"), {
// In NodeJS, encryption is on by default. In the web bundle, it is off.
encrypted:true
});
// end::tls-require-encryption[]
driver.close();
});
it('should document how to configure trust-on-first-use', function() {
it('should document how to configure trust-on-first-use', function() {
// tag::tls-trust-on-first-use[]
// Unfortunately, this feature is not yet implemented for JavaScript
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"), {
// Note that trust-on-first-use is not available in the browser bundle,
// in NodeJS, trust-on-first-use is the default trust mode. In the browser
// it is TRUST_SIGNED_CERTIFICATES.
trust: "TRUST_ON_FIRST_USE",
encrypted:true
});
// end::tls-trust-on-first-use[]
driver.close();
});
it('should document how to configure a trusted signing certificate', function() {
it('should document how to configure a trusted signing certificate', function() {
// tag::tls-signed[]
// Unfortunately, this feature is not yet implemented for JavaScript
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"), {
trust: "TRUST_SIGNED_CERTIFICATES",
// Configuring which certificates to trust here is only available
// in NodeJS. In the browser bundle the browsers list of trusted
// certificates is used, due to technical limitations in some browsers.
trustedCertificates : ["path/to/ca.crt"],
encrypted:true
});
// end::tls-signed[]
driver.close();
});
});

@@ -49,3 +49,3 @@ /**

expect( records.length ).toBe( 1 );
expect( records[0]['a'] ).toBe( 1 );
expect( records[0].get('a') ).toBe( 1 );
done();

@@ -99,3 +99,3 @@ }

expect( records.length ).toBe( 1 );
expect( records[0]['a'] ).toBe( true );
expect( records[0].get('a') ).toBe( true );
done();

@@ -106,3 +106,3 @@ }

it('should expose basic run/then/then/then ', function(done) {
it('should expose run/then/then/then ', function(done) {
// When & Then

@@ -113,3 +113,4 @@ session.run( "RETURN 1.0 AS a")

expect(result.records.length).toBe( 1 );
expect(result.records[0]['a']).toBe( 1 );
expect(result.records[0].get('a')).toBe( 1 );
return result
}

@@ -119,5 +120,5 @@ ).then(

expect(result.records.length).toBe( 1 );
expect(result.records[0]['a']).toBe( 1 );
expect(result.records[0].get('a')).toBe( 1 );
}
).then( function() { done(); })
).then( done );
});

@@ -124,0 +125,0 @@

@@ -28,3 +28,3 @@ var neo4j = require("../../../../lib/v1");

for (var i = 0 ; i < res.records.length; i++) {
givenResults.push(getTestObject(res.records[i]));
givenResults.push(getTestObject(res.records[i]));
}

@@ -34,3 +34,3 @@ if ( givenResults.length != self.expectedResults.length) {

}
if (!comapareResults(givenResults, self.expectedResults) ) {
if (!compareResults(givenResults, self.expectedResults) ) {
callback(new Error("Given and expected results does not match: " + printable(givenResults) + " Expected " + expectedPrint));

@@ -44,3 +44,3 @@ }

function comapareResults(given, expected) {
function compareResults(given, expected) {
if (! (typeof given === "object" && given instanceof Array) ) {

@@ -85,11 +85,9 @@ throw new Error("Should be type Array")

function getTestObject(rels, func) {
result = {}
for (var key in rels)
{
var rel = rels[key];
function getTestObject(rels) {
result = {};
rels.forEach(function( rel, key ) {
if (typeof rel === "object" && rel instanceof Array) {
var relArray = [];
for (var i in rel) {
relArray.push(getTestValue(rel[i]));
relArray.push(getTestValue(rel[i]));
}

@@ -101,3 +99,3 @@ result[key] = relArray;

}
}
});
return result;

@@ -110,3 +108,3 @@ }

}
var con = val.constructor.name.toLowerCase()
var con = val.constructor.name.toLowerCase();
if (con === NODE) {

@@ -113,0 +111,0 @@ return stripNode(val);

@@ -116,11 +116,11 @@ var neo4j = require("../../../../lib/v1");

var successCallback = function(res) {
if(Object.keys(res.records[0]).length != 1 || Object.keys(res.records[0])[0].length != 1) {
callback(new Error("Expected the statement to return a single row, single field record. Got: " + Object.keys(res.records[0]).length + " records and: " + Object.keys(res.records[0])[0].length + " values"));
if(res.records.length != 1 || res.records[0].length != 1) {
callback(new Error("Expected the statement to return a single record, single field record. Got: " + res.records.length + " records and: " + res.records[0].length + " values"));
}
if (!util.compareValues(res.records[0]['x'], self.expectedValue)) {
callback(new Error("Expected the statement to return same as what was sent. Got: " + res.records[0]['x'] + " Expected: " + self.expectedValue));
if (!util.compareValues(res.records[0].get('x'), self.expectedValue)) {
callback(new Error("Expected the statement to return same as what was sent. Got: " + res.records[0].get('x') + " Expected: " + self.expectedValue));
}
callback();
}
};
this.withParamPromise.then(successCallback).catch(errorCallback);

@@ -136,3 +136,3 @@ this.withLiteralPromise.then(successCallback).catch(errorCallback);

var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return Array(size).join().split(',').map(function() { return chars.charAt(Math.floor(Math.random() * chars.length)); }).join('');
return new Array(size).join().split(',').map(function() { return chars.charAt(Math.floor(Math.random() * chars.length)); }).join('');
}

@@ -139,0 +139,0 @@

@@ -37,3 +37,3 @@ /**

it('should handle simple transaction', function(done) {
it('should commit simple case', function(done) {
// When

@@ -48,5 +48,5 @@ var tx = session.beginTransaction();

expect(result.records.length).toBe(1);
expect(result.records[0]['count(t1)'].toInt())
expect(result.records[0].get('count(t1)').toInt())
.toBe(1);
expect(result.records[0]['count(t2)'].toInt())
expect(result.records[0].get('count(t2)').toInt())
.toBe(1);

@@ -62,3 +62,3 @@ done();

tx.run("RETURN 'foo' AS res").then(function (result) {
tx.run("CREATE ({name: {param}})", {param: result.records[0]['res']});
tx.run("CREATE ({name: {param}})", {param: result.records[0].get('res')});
tx.commit()

@@ -69,3 +69,3 @@ .then(function () {

expect(result.records.length).toBe(1);
expect(result.records[0]['count(a)'].toInt()).toBe(1);
expect(result.records[0].get('count(a)').toInt()).toBe(1);
done();

@@ -156,5 +156,5 @@ });

expect(result.records.length).toBe(1);
expect(result.records[0]['count(t1)'].toInt())
expect(result.records[0].get('count(t1)').toInt())
.toBe(0);
expect(result.records[0]['count(t2)'].toInt())
expect(result.records[0].get('count(t2)').toInt())
.toBe(0);

@@ -161,0 +161,0 @@ done();

@@ -72,3 +72,3 @@ /**

session.run("CREATE (n:User {name:'Lisa'}) RETURN n, id(n)").then(function(result) {
var node = result.records[0]['n'];
var node = result.records[0].get('n');

@@ -93,3 +93,3 @@ expect( node.properties ).toEqual( { name:"Lisa" } );

session.run("CREATE ()-[r:User {name:'Lisa'}]->() RETURN r, id(r)").then(function(result) {
var rel = result.records[0]['r'];
var rel = result.records[0].get('r');

@@ -115,3 +115,3 @@ expect( rel.properties ).toEqual( { name:"Lisa" } );

.then(function(result) {
var path = result.records[0]['p'];
var path = result.records[0].get('p');

@@ -130,6 +130,6 @@ expect( path.start.properties ).toEqual( { name:"Lisa" } );

expect( segment.relationship.properties ).toEqual( { since: 1234 } );
};
}
driver.close();
done();
});
}).catch(function(err) { console.log(err); });
});

@@ -145,7 +145,7 @@ });

.then( function( result ) {
expect( result.records[0]['v'] ).toEqual( val );
expect( result.records[0].get('v') ).toEqual( val );
driver.close();
done();
});
}).catch(function(err) { console.log(err); });
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc