Skip to content

Commit f13263e

Browse files
committed
Merge branch 'develop'
2 parents d92f3ae + fd87f00 commit f13263e

File tree

197 files changed

+7476
-3028
lines changed

Some content is hidden

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

197 files changed

+7476
-3028
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
benchmarks
12
doc
23
node_modules
34
tmp

README.md

Lines changed: 57 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,81 @@
11
# MarkLogic Client API for Node.js
22

33
The MarkLogic Client API for Node.js provides access to the MarkLogic database
4-
from Node.js.
4+
from Node.js applications.
5+
6+
## Features
7+
8+
* Writing, reading, patching, and deleting documents in JSON, XML, text, or binary formats
9+
* Querying over documents including parsing string queries, extracting properties, and calculating facets
10+
* Projecting tuples (like table rows) out of documents
11+
* Single transactions and multi-statement transactions for database changes
12+
* Writing, reading, and deleting graphs and executing SPARQL queries over graphs
13+
* Extending the built-in services or evaluating or invoking your own JavaScript or XQuery on the server
514

615
## Status
716

8-
This branch provides the work in progress for the Early Access Release 3 of the MarkLogic Node.js API.
17+
Release 1.0.0 of the MarkLogic Node.js API
918

10-
## Getting started
19+
## Sample
1120

12-
Please register at the MarkLogic Early Access website and then follow the tutorial instructions:
21+
The following example creates two documents in a collection using the built-in
22+
REST server for the Documents database:
1323

14-
http://ea.marklogic.com/features/node-js-client-api/
24+
```
25+
var marklogic = require('marklogic');
1526
16-
The instructions describe:
27+
var db = marklogic.createDatabaseClient({
28+
host: 'localhost',
29+
port: '8000',
30+
user: 'admin',
31+
password: 'admin',
32+
authType: 'DIGEST'
33+
});
1734
18-
* installing the MarkLogic database and setting up an admin user
19-
* cloning this repository to set up the API
20-
* working through some initial examples to get familiar with the API
35+
db.createCollection(
36+
'/books',
37+
{author: 'Beryl Markham', ...},
38+
{author: 'WG Sebald', ...}
39+
)
40+
.result(function(response) {
41+
console.log(JSON.stringify(response,null,2));
42+
}, function (error) {
43+
console.log(JSON.stringify(error,null,2));
44+
});
45+
```
2146

22-
For more detail about the API, use the documentation login from the Early Access to view
23-
the reference documentation:
47+
Other calls can create additional documents for the same collection.
2448

25-
http://docs-ea.marklogic.com/jsdoc/index.html
49+
## Getting started
2650

27-
After installing the dependencies including gulp, you can also build the documentation locally
28-
from the root directory of the marklogic package:
51+
Here are some resources that walk you through working with MarkLogic using the Node.js API:
2952

30-
gulp doc
53+
* http://developer.marklogic.com/features/node-api
54+
* http://docs.marklogic.com/guide/node-dev/intro#id_68052
3155

32-
The documentation should be produced in the doc subdirectory.
56+
The instructions describe:
57+
58+
* installing the MarkLogic database and setting up an admin user
59+
* installing the Node.js API using npm
60+
* working through some initial examples to get familiar with the API
3361

3462
### Example setup
3563

36-
To set up the REST users for the examples, execute the following
37-
command in the root directory for the marklogic package:
64+
The Node.js API also distributes with some additional examples to supplement
65+
the examples from the Getting Started introduction.
3866

39-
node etc/users-setup.js
67+
Follow the instructions in the example distribution:
4068

41-
Then, load the sample data:
69+
examples/1readme.txt
4270

43-
node examples/before-load.js
71+
### Documentation setup
4472

45-
You can then execute any of the examples in the examples
46-
subdirectory from the root directory for the marklogic package.
73+
After installing the dependencies including gulp, you can also build the reference
74+
documentation locally from the root directory of the marklogic package:
75+
76+
gulp doc
77+
78+
The documentation should be produced in the doc subdirectory.
4779

4880
### Test setup and teardown
4981

@@ -56,63 +88,6 @@ To tear down the test database and REST server, execute
5688

5789
node etc/test-teardown.js
5890

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
74-
75-
* createDatabaseClient() including HTTPS
76-
* documents.query()
77-
* queryBuilder.where() including structured query builder
78-
* queryBuilder.byExample() for QBE (Query By Example)
79-
* queryBuilder.parsedFrom() for string query
80-
* queryBuilder.orderBy()
81-
* queryBuilder.calculate()
82-
* queryBuilder.slice()
83-
* queryBuilder.withOptions()
84-
* queryBuilder.parsedFrom()
85-
* queryBuilder.copyFrom()
86-
* documents.check()
87-
* documents.remove()
88-
* documents.read()
89-
* documents.createReadStream()
90-
* documents.write()
91-
* documents.createWriteStream()
92-
* documents.removeAll()
93-
* documents.patch()
94-
* transactions.open()
95-
* transactions.read()
96-
* transactions.commit()
97-
* transactions.rollback()
98-
* config.transforms.list()
99-
* config.transforms.read()
100-
* config.transforms.remove()
101-
* config.transforms.write()
102-
* config.properties.read()
103-
* config.properties.write()
104-
* config.extlibs.list()
105-
* config.extlibs.read()
106-
* config.extlibs.remove()
107-
* config.extlibs.write()
108-
* optimistic locking
109-
110-
### Limitations in Early Access 3
111-
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.
115-
11691
## Support
11792

11893
The MarkLogic Node.js Client API is maintained by MarkLogic Engineering.
@@ -124,4 +99,5 @@ any request. In addition, MarkLogic provides technical support
12499
for [release tags](https://github.com/marklogic/node-client-api/releases)
125100
of the Node Client API to licensed customers under the terms outlined
126101
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).
102+
For more information or to sign up for support,
103+
visit [help.marklogic.com](http://help.marklogic.com).

etc/test-config-qa-ssl.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright 2014-2015 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
var testHost = 'localhost';
17+
18+
var restPort = '8016';
19+
var restAuthType = 'DIGEST';
20+
21+
var managePort = '8002';
22+
var manageAuthType = 'DIGEST';
23+
24+
var restAdminUser = 'rest-admin';
25+
var restAdminPassword = 'x';
26+
27+
var restReaderUser = 'rest-reader';
28+
var restReaderPassword = 'x';
29+
30+
var restWriterUser = 'rest-writer';
31+
var restWriterPassword = 'x';
32+
33+
var restEvaluatorUser = 'rest-evaluator';
34+
var restEvaluatorPassword = 'x';
35+
36+
var testServerName = 'node-client-api-ssl-server';
37+
38+
// For SSL without client cert, use rejectUnauthorized: false
39+
module.exports = {
40+
testServerName: testServerName,
41+
testHost: testHost,
42+
restPort: restPort,
43+
restAdminConnection: {
44+
host: testHost,
45+
port: restPort,
46+
user: restAdminUser,
47+
password: restAdminPassword,
48+
authType: restAuthType
49+
},
50+
restReaderConnection: {
51+
host: testHost,
52+
port: restPort,
53+
user: restReaderUser,
54+
password: restReaderPassword,
55+
authType: restAuthType
56+
},
57+
restWriterConnection: {
58+
host: testHost,
59+
port: restPort,
60+
user: restWriterUser,
61+
password: restWriterPassword,
62+
authType: restAuthType
63+
},
64+
restEvaluatorConnection: {
65+
host: testHost,
66+
port: restPort,
67+
user: restEvaluatorUser,
68+
password: restEvaluatorPassword,
69+
authType: restAuthType
70+
},
71+
manageAdminConnection: {
72+
host: testHost,
73+
port: managePort,
74+
user: restAdminUser,
75+
password: restAdminPassword,
76+
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
86+
}
87+
};

etc/test-config-qa.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright 2014-2015 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
var testHost = 'localhost';
17+
18+
var restPort = '8015';
19+
var restAuthType = 'DIGEST';
20+
21+
var managePort = '8002';
22+
var manageAuthType = 'DIGEST';
23+
24+
var restAdminUser = 'rest-admin';
25+
var restAdminPassword = 'x';
26+
27+
var restReaderUser = 'rest-reader';
28+
var restReaderPassword = 'x';
29+
30+
var restWriterUser = 'rest-writer';
31+
var restWriterPassword = 'x';
32+
33+
var restEvaluatorUser = 'rest-evaluator';
34+
var restEvaluatorPassword = 'x';
35+
36+
var testServerName = 'node-client-api-rest-server';
37+
38+
// For SSL without client cert, use rejectUnauthorized: false
39+
module.exports = {
40+
testServerName: testServerName,
41+
testHost: testHost,
42+
restPort: restPort,
43+
restAdminConnection: {
44+
host: testHost,
45+
port: restPort,
46+
user: restAdminUser,
47+
password: restAdminPassword,
48+
authType: restAuthType
49+
},
50+
restReaderConnection: {
51+
host: testHost,
52+
port: restPort,
53+
user: restReaderUser,
54+
password: restReaderPassword,
55+
authType: restAuthType
56+
},
57+
restWriterConnection: {
58+
host: testHost,
59+
port: restPort,
60+
user: restWriterUser,
61+
password: restWriterPassword,
62+
authType: restAuthType
63+
},
64+
restEvaluatorConnection: {
65+
host: testHost,
66+
port: restPort,
67+
user: restEvaluatorUser,
68+
password: restEvaluatorPassword,
69+
authType: restAuthType
70+
},
71+
manageAdminConnection: {
72+
host: testHost,
73+
port: managePort,
74+
user: restAdminUser,
75+
password: restAdminPassword,
76+
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
86+
}
87+
};

etc/test-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 MarkLogic Corporation
2+
* Copyright 2014-2015 MarkLogic Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,6 +40,7 @@ module.exports = {
4040
testServerName: testServerName,
4141
testHost: testHost,
4242
restPort: restPort,
43+
authType: restAuthType,
4344
restAdminConnection: {
4445
host: testHost,
4546
port: restPort,

etc/test-lib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 MarkLogic Corporation
2+
* Copyright 2014-2015 MarkLogic Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

etc/test-setup-prompt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 MarkLogic Corporation
2+
* Copyright 2014-2015 MarkLogic Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)