Skip to content

Commit 56050cf

Browse files
committed
Experimental HTTP support via transactional Cypher endpoint
Commit adds a driver implementation that use REST API. It now only supports `Session#run()`, not explicit transactions or routing. Driver will only expose native numbers because it receives JSON which can't represent large integers. Behaviour is similar to Bolt driver configured with `{disableLosslessIntegers: true}`. This is an experimental feature and should under no circumstances be used in production environment!
1 parent 7cc68d8 commit 56050cf

File tree

8 files changed

+889
-4
lines changed

8 files changed

+889
-4
lines changed

package-lock.json

+68-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"run-tck": "gulp run-tck",
1818
"run-ts-declaration-tests": "gulp run-ts-declaration-tests",
1919
"docs": "esdoc -c esdoc.json",
20-
"versionRelease": "gulp set --version $VERSION && npm version $VERSION --no-git-tag-version"
20+
"versionRelease": "gulp set --version $VERSION && npm version $VERSION --no-git-tag-version",
21+
"browser": "gulp browser && gulp test-browser"
2122
},
2223
"main": "lib/index.js",
2324
"types": "types/index.d.ts",
@@ -70,6 +71,7 @@
7071
},
7172
"dependencies": {
7273
"babel-runtime": "^6.18.0",
73-
"url-parse": "^1.2.0"
74+
"url-parse": "^1.2.0",
75+
"xhr": "^2.4.1"
7476
}
7577
}

src/v1/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import RoutingDriver from './routing-driver';
2828
import VERSION from '../version';
2929
import {assertString, isEmptyObjectOrNull} from './internal/util';
3030
import urlUtil from './internal/url-util';
31+
import HttpDriver from './internal/http/http-driver';
3132

3233
/**
3334
* @property {function(username: string, password: string, realm: ?string)} basic the function to create a
@@ -186,6 +187,8 @@ function driver(url, authToken, config = {}) {
186187
throw new Error(`Parameters are not supported with scheme 'bolt'. Given URL: '${url}'`);
187188
}
188189
return new Driver(parsedUrl.hostAndPort, USER_AGENT, authToken, config);
190+
} else if (parsedUrl.scheme === 'http') {
191+
return new HttpDriver(parsedUrl, USER_AGENT, authToken, config);
189192
} else {
190193
throw new Error(`Unknown scheme: ${parsedUrl.scheme}`);
191194
}

0 commit comments

Comments
 (0)