Skip to content

Commit d92f3ae

Browse files
committed
Merge branch 'develop'
2 parents 1ef399b + 33d340e commit d92f3ae

File tree

444 files changed

+22100
-1471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

444 files changed

+22100
-1471
lines changed

CONTRIBUTING.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# How to contribute
2+
3+
We welcome contributions from the community. If you have a patch that you'd
4+
like us to consider, please do the following:
5+
6+
* Provide a signed
7+
[Contributor License Agreement](http://developer.marklogic.com/products/cla).
8+
9+
* Create an issue for the fix or enhancement.
10+
11+
For a bug, clearly describe the steps to reproduce the problem and the
12+
earliest version that exhibits the problem. For an enhancement, make sure
13+
you have basic agreement about the fix or enhancement.
14+
15+
* [Fork the API repository](https://github.com/marklogic/node-client-api/fork) in your repository on GitHub.
16+
17+
* Create a branch based on the `master` branch or (if you are in the Early
18+
Access program) on the `develop` branch.
19+
20+
* Implement the fix or enhancement.
21+
22+
As with other projects, you should include unit tests using the same test
23+
harness (at present, [Mocha](http://visionmedia.github.io/mocha/) and [should](https://github.com/visionmedia/should.js/)). Follow the same style conventions
24+
as existing code. Run jshint on the changes. Create jsdoc for any new
25+
interfaces. (See the gulp tasks for a convenient way to run jshint.)
26+
Run all of the tests to make sure the change doesn't have side effects.
27+
28+
* Commit in one or more logical units with clear messages.
29+
30+
* Push to the branch in your fork.
31+
32+
* Create a pull request from your fork and add a comment to the issue.
33+
34+
The team will then review the changes and possibly suggest improvements
35+
or alternatives.

README.md

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# MarkLogic Client API for node.js
1+
# MarkLogic Client API for Node.js
22

3-
The MarkLogic Client API for node.js provides access to the MarkLogic database
4-
from node.js.
3+
The MarkLogic Client API for Node.js provides access to the MarkLogic database
4+
from Node.js.
55

66
## Status
77

8-
The MarkLogic node.js API is currently in Early Access Release 2.
8+
This branch provides the work in progress for the Early Access Release 3 of the MarkLogic Node.js API.
99

10-
### Getting started
10+
## Getting started
1111

1212
Please register at the MarkLogic Early Access website and then follow the tutorial instructions:
1313

@@ -19,13 +19,13 @@ The instructions describe:
1919
* cloning this repository to set up the API
2020
* working through some initial examples to get familiar with the API
2121

22-
For more detail about the API, use the documentation login from the Early Access
23-
to view the reference documentation:
22+
For more detail about the API, use the documentation login from the Early Access to view
23+
the reference documentation:
2424

2525
http://docs-ea.marklogic.com/jsdoc/index.html
2626

27-
After installing the dependencies including gulp, you can also build the documentation
28-
locally from the root directory of the marklogic package:
27+
After installing the dependencies including gulp, you can also build the documentation locally
28+
from the root directory of the marklogic package:
2929

3030
gulp doc
3131

@@ -56,7 +56,21 @@ To tear down the test database and REST server, execute
5656

5757
node etc/test-teardown.js
5858

59-
### Capabilities of the node.js Client API in Early Access 2
59+
### Capabilities added to the Node.js Client API in Early Access 3
60+
61+
* quick path for simple CRUD and query on the database client
62+
* values and tuples requests
63+
* server-side transforms on query response summary and result documents in slice() clause
64+
* snippets including custom snippets in slice() clause
65+
* extract from result documents (projection)
66+
* resource service CRUD and invocation
67+
* graph CRUD and SPARQL query
68+
* bitemporal document CRUD and query
69+
* specifying the database when creating a database client
70+
* server-side eval and invoke
71+
* search suggest
72+
73+
### Capabilities of the Node.js Client API in Early Access 2
6074

6175
* createDatabaseClient() including HTTPS
6276
* documents.query()
@@ -93,18 +107,21 @@ To tear down the test database and REST server, execute
93107
* config.extlibs.write()
94108
* optimistic locking
95109

96-
### Limitations in Early Access 2
110+
### Limitations in Early Access 3
97111

98-
The MarkLogic node.js Client API has not yet undergone performance or
99-
stress testing. The API should not be used in production in EA2.
112+
The MarkLogic Node.js Client API has not yet undergone performance or
113+
stress testing. The API should not be used in production in EA3. The
114+
interface may change before the initial release.
100115

101-
### Candidate Features for Early Access 3
116+
## Support
102117

103-
* projection from result documents
104-
* values and tuples lists
105-
* resource service CRUD and invocation
106-
* server-side eval
107-
* graph CRUD
108-
* aggregates on facets
109-
* specifying the database when creating a database client
110-
* pluggable XML conversion
118+
The MarkLogic Node.js Client API is maintained by MarkLogic Engineering.
119+
It is designed for use in production applications with MarkLogic Server.
120+
Everyone is encouraged to file bug reports, feature requests, and pull
121+
requests through GitHub. This input is critical and will be carefully
122+
considered, but we can’t promise a specific resolution or timeframe for
123+
any request. In addition, MarkLogic provides technical support
124+
for [release tags](https://github.com/marklogic/node-client-api/releases)
125+
of the Node Client API to licensed customers under the terms outlined
126+
in the [Support Handbook](http://www.marklogic.com/files/Mark_Logic_Support_Handbook.pdf).
127+
For more information or to sign up for support, visit [help.marklogic.com](help.marklogic.com).

etc/test-config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ var restReaderPassword = 'x';
3030
var restWriterUser = 'rest-writer';
3131
var restWriterPassword = 'x';
3232

33+
var restEvaluatorUser = 'rest-evaluator';
34+
var restEvaluatorPassword = 'x';
35+
3336
var testServerName = 'unittest-nodeapi';
3437

3538
// For SSL without client cert, use rejectUnauthorized: false
@@ -58,11 +61,27 @@ module.exports = {
5861
password: restWriterPassword,
5962
authType: restAuthType
6063
},
64+
restEvaluatorConnection: {
65+
host: testHost,
66+
port: restPort,
67+
user: restEvaluatorUser,
68+
password: restEvaluatorPassword,
69+
authType: restAuthType
70+
},
6171
manageAdminConnection: {
6272
host: testHost,
6373
port: managePort,
6474
user: restAdminUser,
6575
password: restAdminPassword,
6676
authType: manageAuthType
77+
},
78+
restSslConnection: {
79+
host: testHost,
80+
port: restPort,
81+
user: restAdminUser,
82+
password: restAdminPassword,
83+
authType: 'BASIC',
84+
rejectUnauthorized: false,
85+
ssl: true
6786
}
6887
};

etc/test-lib.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ var mlutil = require('../lib/mlutil.js');
2121
//CAUTION: the functions in this module are not part of the supported API and
2222
//may change or may be removed at any time.
2323

24-
function responseOutputTransform(data) {
24+
function responseOutputTransform(headers, data) {
2525
var operation = this;
2626

2727
var response = {
2828
statusCode: operation.responseStatusCode,
29-
headers: operation.responseHeaders
29+
headers: headers
3030
};
3131
if (!valcheck.isNullOrUndefined(data)) {
3232
response.data = data;

etc/test-setup-users.js

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,92 @@ var testconfig = require('./test-config.js');
2121
function setupUsers(manager, done) {
2222
console.log('checking for REST users');
2323
manager.get({
24-
endpoint: '/manage/v2/users'
25-
}).
26-
result(function(response) {
24+
endpoint: '/manage/v2/roles/'+encodeURIComponent('rest-evaluator')
25+
}).result().
26+
then(function(response) {
27+
if (response.statusCode < 400) {
28+
return this;
29+
}
30+
return manager.post({
31+
endpoint: '/manage/v2/roles',
32+
body: {
33+
'role-name': 'rest-evaluator',
34+
description: 'REST writer who can eval, invoke, or set a dynamic databases',
35+
role: [
36+
'rest-writer'
37+
],
38+
privilege: [
39+
{
40+
'privilege-name': 'xdmp-eval',
41+
action: 'http://marklogic.com/xdmp/privileges/xdmp-eval',
42+
kind: 'execute'
43+
},
44+
{
45+
'privilege-name': 'xdmp-eval-in',
46+
action: 'http://marklogic.com/xdmp/privileges/xdmp-eval-in',
47+
kind: 'execute'
48+
},
49+
{
50+
'privilege-name': 'xdmp-invoke',
51+
action: 'http://marklogic.com/xdmp/privileges/xdmp-invoke',
52+
kind: 'execute'
53+
},
54+
{
55+
'privilege-name': 'xdbc-eval',
56+
action: 'http://marklogic.com/xdmp/privileges/xdbc-eval',
57+
kind: 'execute'
58+
},
59+
{
60+
'privilege-name': 'xdbc-eval-in',
61+
action: 'http://marklogic.com/xdmp/privileges/xdbc-eval-in',
62+
kind: 'execute'
63+
},
64+
{
65+
'privilege-name': 'xdbc-invoke',
66+
action: 'http://marklogic.com/xdmp/privileges/xdbc-invoke',
67+
kind: 'execute'
68+
}
69+
]
70+
}
71+
}).result();
72+
}).
73+
then(function(response) {
74+
return manager.get({
75+
endpoint: '/manage/v2/users'
76+
}).result();
77+
}).
78+
then(function(response) {
2779
var userName = null;
2880

2981
var requiredUsers = {};
3082
userName = testconfig.restAdminConnection.user;
3183
requiredUsers[userName] = {
3284
role: 'rest-admin',
33-
name: userName,
85+
'user-name': userName,
3486
description: 'rest-admin user',
3587
password: testconfig.restAdminConnection.password
3688
};
3789
userName = testconfig.restReaderConnection.user;
3890
requiredUsers[userName] = {
3991
role: 'rest-reader',
40-
name: userName,
92+
'user-name': userName,
4193
description: 'rest-reader user',
4294
password: testconfig.restReaderConnection.password
4395
};
4496
userName = testconfig.restWriterConnection.user;
4597
requiredUsers[userName] = {
4698
role: 'rest-writer',
47-
name: userName,
99+
'user-name': userName,
48100
description: 'rest-writer user',
49101
password: testconfig.restWriterConnection.password
50102
};
103+
userName = testconfig.restEvaluatorConnection.user;
104+
requiredUsers[userName] = {
105+
role: 'rest-evaluator',
106+
'user-name': userName,
107+
description: 'rest-writer user with evaluate privileges',
108+
password: testconfig.restEvaluatorConnection.password
109+
};
51110

52111
response.data['user-default-list']['list-items']['list-item'].
53112
forEach(function(user) {
@@ -92,7 +151,7 @@ function addUser(manager, users, next, done) {
92151
manager.post({
93152
endpoint: '/manage/v2/users',
94153
body: {
95-
name: userdef.name,
154+
'user-name': userdef['user-name'],
96155
password: userdef.password,
97156
description: userdef.description,
98157
role: [

0 commit comments

Comments
 (0)