Skip to content

Commit 7a6b39b

Browse files
committed
Breaking: drop 1.4 support; kill getVersion().
Closes #59 by removing our only dependency on version parsing.
1 parent 4caf6a5 commit 7a6b39b

5 files changed

Lines changed: 22 additions & 63 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Unreleased
22

3+
- ***BREAKING:*** This library no longer supports Neo4j 1.4.
4+
5+
- ***BREAKING:*** `GraphDatabase::getVersion()` has been removed.
6+
It was only used internally for Neo4j 1.4 support;
7+
hopefully you had no need for it externally.
8+
39
- New `GraphDatabase` methods to create, read, and delete node and
410
relationship indexes, e.g. `createNodeIndex()`, `getNodeIndexes()`, and
511
`deleteNodeIndex()` respectively for nodes.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This is a client library for accessing [Neo4j][], a graph database, from
44
[Node.js][]. It uses Neo4j's [REST API][neo4j-rest-api].
55

6-
This library supports and has been tested against Neo4j 1.4 through Neo4j 1.9.
6+
This library supports and has been tested against Neo4j 1.5 through Neo4j 1.9.
77

88

99
## Installation

lib/GraphDatabase._coffee

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,6 @@ module.exports = class GraphDatabase
106106
catch error
107107
throw adjustError error
108108

109-
#
110-
# Fetch and "return" (via callback) the Neo4j version as a float.
111-
#
112-
# @note This doesn't preserve "milestone" information, e.g. "M06".
113-
#
114-
# @param callback {Function}
115-
# @return {Number}
116-
#
117-
getVersion: (_) ->
118-
try
119-
services = @getServices _
120-
121-
# Neo4j 1.5 onwards report their version number here;
122-
# if it's not there, assume Neo4j 1.4.
123-
parseFloat services['neo4j_version'] or '1.4'
124-
125-
catch error
126-
throw adjustError
127-
128109
### Nodes: ###
129110

130111
#

lib/Node._coffee

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -127,28 +127,14 @@ module.exports = class Node extends PropertyContainer
127127
throw new Error 'Node must exist before indexing.'
128128

129129
services = @db.getServices _
130-
version = @db.getVersion _
131130

132-
# old API:
133-
if version <= 1.4
134-
encodedKey = encodeURIComponent key
135-
encodedValue = encodeURIComponent value
136-
url = "#{services.node_index}/#{index}/#{encodedKey}/#{encodedValue}"
137-
138-
response = @_request.post
139-
url: url
140-
json: @self
141-
, _
142-
143-
# new API:
144-
else
145-
response = @_request.post
146-
url: "#{services.node_index}/#{index}"
147-
json:
148-
key: key
149-
value: value
150-
uri: @self
151-
, _
131+
response = @_request.post
132+
url: "#{services.node_index}/#{index}"
133+
json:
134+
key: key
135+
value: value
136+
uri: @self
137+
, _
152138

153139
if response.statusCode isnt status.CREATED
154140
# database error

lib/Relationship._coffee

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,14 @@ module.exports = class Relationship extends PropertyContainer
103103
throw new Error 'Relationship must exist before indexing properties'
104104

105105
services = @db.getServices _
106-
version = @db.getVersion _
107-
108-
# old API:
109-
if version <= 1.4
110-
encodedKey = encodeURIComponent key
111-
encodedValue = encodeURIComponent value
112-
url = "#{services.relationship_index}/#{index}/#{encodedKey}/#{encodedValue}"
113-
114-
response = @_request.post
115-
url: url
116-
json: @self
117-
, _
118-
119-
# new API:
120-
else
121-
response = @_request.post
122-
url: "#{services.relationship_index}/#{index}"
123-
json:
124-
key: key
125-
value: value
126-
uri: @self
127-
, _
106+
107+
response = @_request.post
108+
url: "#{services.relationship_index}/#{index}"
109+
json:
110+
key: key
111+
value: value
112+
uri: @self
113+
, _
128114

129115
if response.statusCode isnt status.CREATED
130116
# database error

0 commit comments

Comments
 (0)