Skip to content

Commit a28d95b

Browse files
authored
Merge pull request #397 from wooldridge/issues/303-compatibility
fix(#303): Update README with compatibility info
2 parents 92433a4 + 84a8bed commit a28d95b

15 files changed

+273
-16
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ from Node.js applications.
1515

1616
## Status
1717

18-
Release 2.0.1 of the MarkLogic Node.js Client API
18+
Release 2.0.1 of the MarkLogic Node.js Client API, tested to work with MarkLogic
19+
versions 8.0-6.3 and 9.0-1. To use the new features available in release 2.0.1,
20+
you will need to run MarkLogic version 9.
1921

2022
## New Features in Release 2.0.1
2123

lib/documents.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function wipeOutputTransform(/*headers, data*/) {
131131
* {@link https://www.promisejs.org/|Promises} object for chaining
132132
* actions with then() functions.
133133
* @name ResultProvider#result
134+
* @since 1.0
134135
* @function
135136
* @param {function} [success] - a callback invoked when the request succeeds
136137
* @param {function} [failure] - a callback invoked when the request fails
@@ -140,6 +141,7 @@ function wipeOutputTransform(/*headers, data*/) {
140141
* Returns a ReadableStream object in object mode for receiving results as
141142
* complete objects.
142143
* @name ResultProvider#stream
144+
* @since 1.0
143145
* @function
144146
* @returns {object} a {@link http://nodejs.org/api/stream.html#stream_class_stream_readable|ReadableStream}
145147
* object
@@ -150,6 +152,7 @@ function wipeOutputTransform(/*headers, data*/) {
150152
* from the server, or for another document operation. The descriptor may have
151153
* more or fewer properties depending on the operation.
152154
* @typedef {object} documents.DocumentDescriptor
155+
* @since 1.0
153156
* @property {string} uri - the identifier for the document in the database
154157
* @property {object|string|Buffer|ReadableStream} [content] - the content
155158
* of the document; when writing a ReadableStream for the content, first pause
@@ -172,12 +175,14 @@ function wipeOutputTransform(/*headers, data*/) {
172175
* content|collections|permissions|properties|quality|metadataValues|metadata where
173176
* metadata is an alias for all of the categories other than content.
174177
* @typedef {enum} documents.categories
178+
* @since 1.0
175179
*/
176180

177181
/**
178182
* A success callback for {@link ResultProvider} that receives the result from
179183
* the {@link documents#probe}.
180184
* @callback documents#probeResult
185+
* @since 1.0
181186
* @param {documents.DocumentDescriptor} document - a sparse document descriptor with an exists
182187
* property that identifies whether the document exists
183188
*/
@@ -186,6 +191,7 @@ function wipeOutputTransform(/*headers, data*/) {
186191
* object with the following named parameters or, as a shortcut,
187192
* a uri string.
188193
* @method documents#probe
194+
* @since 1.0
189195
* @param {string} uri - the uri for the database document
190196
* @param {string|transactions.Transaction} [txid] - a string
191197
* transaction id or Transaction object identifying an open
@@ -251,13 +257,15 @@ function probeDocumentsImpl(contentOnly, args) {
251257
* A success callback for {@link ResultProvider} that receives the result from
252258
* the {@link documents#protect}.
253259
* @callback documents#protectResult
260+
* @since 2.0.1
254261
* @param {documents.DocumentDescriptor} document - a sparse document descriptor
255262
* for the protected document
256263
*/
257264
/**
258265
* Protects a temporal document from temporal operations for a
259266
* period of time.
260267
* @method documents#protect
268+
* @since 2.0.1
261269
* @param {string} uri - the uri for the temporal document to protect
262270
* @param {string} temporalCollection - the temporal collection for the document
263271
* @param {string} [duration] - a protection duration; either a duration or an
@@ -375,12 +383,14 @@ Documents.prototype.protect = function protectDocument() {
375383
* A success callback for {@link ResultProvider} that receives the result from
376384
* the {@link documents#wipe}.
377385
* @callback documents#wipeResult
386+
* @since 2.0.1
378387
* @param {documents.DocumentDescriptor} document - a sparse document descriptor
379388
* for the wipe command
380389
*/
381390
/**
382391
* Deletes all versions of a temporal document.
383392
* @method documents#wipe
393+
* @since 2.0.1
384394
* @param {string} uri - the uri for the temporal document to wipe
385395
* @param {string} temporalCollection - the name of the temporal collection
386396
* @returns {ResultProvider} an object whose result() function takes
@@ -500,6 +510,7 @@ function singleReadOutputTransform(headers, data) {
500510
* A success callback for {@link ResultProvider} that receives the result from
501511
* the {@link documents#read}.
502512
* @callback documents#resultList
513+
* @since 1.0
503514
* @param {documents.DocumentDescriptor[]} documents - an array of
504515
* {@link documents.DocumentDescriptor} objects with the requested
505516
* metadata and/or content for the documents
@@ -509,6 +520,7 @@ function singleReadOutputTransform(headers, data) {
509520
* the following named parameters or, as a shortcut, one or more
510521
* uri strings or an array of uri strings.
511522
* @method documents#read
523+
* @since 1.0
512524
* @param {string|string[]} uris - the uri string or an array of uri strings
513525
* for the database documents
514526
* @param {documents.categories|documents.categories[]} [categories] - the categories of information
@@ -681,6 +693,7 @@ function readDocumentsImpl(contentOnly, args) {
681693
* a stream; takes a {@link documents.DocumentDescriptor} object with the
682694
* following properties (but not a content property).
683695
* @method documents#createWriteStream
696+
* @since 1.0
684697
* @param {string} uri - the identifier for the document to write to the database
685698
* @param {string[]} [collections] - the collections to which the document should belong
686699
* @param {object[]} [permissions] - the permissions controlling which users can read or
@@ -826,6 +839,7 @@ function writeListOutputTransform(headers, data) {
826839
* the {@link documents#write} or the {@link documents#createWriteStream}
827840
* functions.
828841
* @callback documents#writeResult
842+
* @since 1.0
829843
* @param {object} response - a response with a documents property providing
830844
* a sparse array of array of {@link documents.DocumentDescriptor} objects
831845
* providing the uris of the written documents.
@@ -834,6 +848,7 @@ function writeListOutputTransform(headers, data) {
834848
* Writes one or more documents; takes a configuration object with
835849
* the following named parameters or, as a shortcut, a document descriptor.
836850
* @method documents#write
851+
* @since 1.0
837852
* @param {DocumentDescriptor|DocumentDescriptor[]} documents - one descriptor
838853
* or an array of document descriptors to write
839854
* @param {documents.categories|documents.categories[]} [categories] - the categories of information
@@ -1387,6 +1402,7 @@ function removeOutputTransform(headers/*, data*/) {
13871402
* A success callback for {@link ResultProvider} that receives the result from
13881403
* the {@link documents#remove}.
13891404
* @callback documents#removeResult
1405+
* @since 1.0
13901406
* @param {documents.DocumentDescriptor} document - a sparse document descriptor
13911407
* for the removed document
13921408
*/
@@ -1395,6 +1411,7 @@ function removeOutputTransform(headers/*, data*/) {
13951411
* object with the following named parameters or, as a shortcut, one or more
13961412
* uri strings or an array of uri strings.
13971413
* @method documents#remove
1414+
* @since 1.0
13981415
* @param {string|string[]} uris - the uri string or an array of uri strings
13991416
* identifying the database documents
14001417
* @param {string|transactions.Transaction} [txid] - a string
@@ -1519,6 +1536,7 @@ function removeAllOutputTransform(/*headers, data*/) {
15191536
* have the rest-admin role to to delete all documents and the rest-writer
15201537
* role otherwise.
15211538
* @method documents#removeAll
1539+
* @since 1.0
15221540
* @param {string} [collection] - the collection whose documents should be
15231541
* deleted
15241542
* @param {string} [directory] - a directory whose documents should be
@@ -1607,6 +1625,7 @@ function listOutputTransform(headers, data) {
16071625
/**
16081626
* Defines a query in the structure accepted by the REST API.
16091627
* @typedef {object} documents.CombinedQueryDefinition
1628+
* @since 1.0
16101629
* @property {object} search - a combined query, which can have properties
16111630
* for a structured query, a string query, and query options
16121631
* @property {documents.categories|documents.categories[]} [categories] - the categories
@@ -1632,6 +1651,7 @@ function listOutputTransform(headers, data) {
16321651
* Executes a query built by a {@link queryBuilder} to match one or more
16331652
* documents.
16341653
* @method documents#query
1654+
* @since 1.0
16351655
* @param {object} query - a query built by a {@link queryBuilder} or
16361656
* a {@link documents.CombinedQueryDefinition}
16371657
* @returns {ResultProvider} an object whose result() function takes
@@ -1791,6 +1811,7 @@ function patchOutputTransform(/*headers, data*/) {
17911811
* A success callback for {@link ResultProvider} that receives the result from
17921812
* the {@link documents#patch} function.
17931813
* @callback documents#patchResult
1814+
* @since 1.0
17941815
* @param {object} document - a sparse {@link documents.DocumentDescriptor} object
17951816
* providing the uri of the patched document.
17961817
*/
@@ -1799,6 +1820,7 @@ function patchOutputTransform(/*headers, data*/) {
17991820
* the following named parameters or, as a shortcut, a uri string and
18001821
* one or more patch operations produced by a {@link patchBuilder}.
18011822
* @method documents#patch
1823+
* @since 1.0
18021824
* @param {string} uri - the uri
18031825
* @param {patchOperation|patchOperation[]} operations - delete, insert,
18041826
* or replace operations produced by a {@link patchBuilder} to apply
@@ -1968,6 +1990,7 @@ Documents.prototype.patch = function patchDocuments() {
19681990
* You may pass a configuration object with the following named parameters or,
19691991
* as a shortcut, the partial textual search, the query, and optionally bindings.
19701992
* @method documents#suggest
1993+
* @since 1.0
19711994
* @param {string} partial - the partial search string to complete
19721995
* @param {object} query - a query built by a {@link queryBuilder} or
19731996
* a {@link documents.CombinedQueryDefinition} that defines bindings in

lib/extlibs.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function pathErrorTransform(message) {
3131
/**
3232
* Provides functions to maintain extension libraries on the REST server
3333
* for the client. The client must have been created for a user with the
34-
* rest-admin role.
34+
* rest-admin role.
3535
* @namespace config.extlibs
3636
*/
3737

@@ -56,6 +56,7 @@ function ExtLibs(client) {
5656
/**
5757
* Reads a library resource installed on the server.
5858
* @method config.extlibs#read
59+
* @since 1.0
5960
* @param {string} path - the location of an installed library resource
6061
* @returns {ResultProvider} an object whose result() function takes
6162
* a success callback that receives the resource
@@ -85,6 +86,7 @@ ExtLibs.prototype.read = function readExtensionLibrary(path) {
8586
/**
8687
* Installs a library resource on the server.
8788
* @method config.extlibs#write
89+
* @since 1.0
8890
* @param {string} path - the location for installing the library resource
8991
* @param {object[]} [permissions] - the permissions controlling which users can read, update, or
9092
* execute the library resource
@@ -111,16 +113,16 @@ ExtLibs.prototype.write = function writeExtensionLibrary() {
111113
path = params.path;
112114
permissions = params.permissions;
113115
contentType = params.contentType;
114-
source = params.source;
116+
source = params.source;
115117
} else {
116118
var argMax = Math.min(argLen,4);
117119
for (;i < argMax; i++) {
118120
arg = args[i];
119121
if (typeof arg === 'string' || arg instanceof String) {
120122
if (path === null) {
121-
path = arg;
123+
path = arg;
122124
} else if (contentType === null) {
123-
contentType = arg;
125+
contentType = arg;
124126
}
125127
} else if (Array.isArray(arg)) {
126128
permissions = arg;
@@ -137,7 +139,7 @@ ExtLibs.prototype.write = function writeExtensionLibrary() {
137139
throw new Error('must specify the path, content type, and source when writing a extension library');
138140
}
139141

140-
var endpoint =
142+
var endpoint =
141143
(path.substr(0,5) === '/ext/') ? ('/v1'+path) :
142144
(path.substr(0,1) === '/') ? ('/v1/ext'+path) :
143145
('/v1/ext/'+path);
@@ -151,7 +153,7 @@ ExtLibs.prototype.write = function writeExtensionLibrary() {
151153
role = arg['role-name'];
152154
capabilities = arg.capabilities;
153155
if ((role === void 0) || !Array.isArray(capabilities) || capabilities.length < 1) {
154-
throw new Error('cannot set permissions from '+JSON.stringify(arg));
156+
throw new Error('cannot set permissions from '+JSON.stringify(arg));
155157
}
156158
for (j=0; j < capabilities.length; j++) {
157159
endpoint += ((i === 0 && j=== 0) ? '?' : '&') + 'perm:'+role+'='+capabilities[j];
@@ -180,6 +182,7 @@ ExtLibs.prototype.write = function writeExtensionLibrary() {
180182
/**
181183
* Deletes a library resource from the server.
182184
* @method config.extlibs#remove
185+
* @since 1.0
183186
* @param {string} path - the location of the library resource
184187
*/
185188
ExtLibs.prototype.remove = function removeExtensionLibrary(path) {
@@ -208,6 +211,7 @@ ExtLibs.prototype.remove = function removeExtensionLibrary(path) {
208211
/**
209212
* Lists the library resources installed under the directory on the server.
210213
* @method config.extlibs#list
214+
* @since 1.0
211215
* @param {string} [directory] - a directory containing library resources;
212216
* by default, all library resources installed on the server are returned
213217
* @returns {ResultProvider} an object whose result() function takes
@@ -222,10 +226,10 @@ ExtLibs.prototype.list = function listExtensionLibraries(directory) {
222226
};
223227

224228
if (typeof directory !== 'string' && !(directory instanceof String)) {
225-
requestOptions.path = '/v1/ext';
229+
requestOptions.path = '/v1/ext';
226230
} else if (directory.substr(0,5) === '/ext/') {
227231
if (directory.substr(-1,1) === '/') {
228-
requestOptions.path = encodeURI(directory);
232+
requestOptions.path = encodeURI(directory);
229233
} else {
230234
requestOptions.path = encodeURI(directory+'/');
231235
}

lib/graphs.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ function Graphs(client) {
113113
/**
114114
* Reads the triples for a graph from the server in the specified format.
115115
* @method graphs#read
116+
* @since 1.0
116117
* @param {string} [uri] - a graph name, which can be ommitted for the default graph
117118
* @param {string} contentType - the format for the graph such as application/n-quads,
118119
* application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle,
@@ -195,6 +196,7 @@ Graphs.prototype.read = function readGraph() {
195196
/**
196197
* Creates or replaces the triples for the specified graph.
197198
* @method graphs#write
199+
* @since 1.0
198200
* @param {string} [uri] - a graph name, which can be ommitted for the default graph
199201
* @param {string} contentType - the format for the graph such as application/n-quads,
200202
* application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle,
@@ -213,6 +215,7 @@ Graphs.prototype.write = function writeGraph() {
213215
/**
214216
* Adds the triples for the specified graph.
215217
* @method graphs#merge
218+
* @since 1.0
216219
* @param {string} [uri] - a graph name, which can be ommitted for the default graph
217220
* @param {string} contentType - the format for the graph such as application/n-quads,
218221
* application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle,
@@ -232,6 +235,7 @@ Graphs.prototype.merge = function mergeGraph() {
232235
* Creates or replaces the triples for the specified graph in incremental chunks with
233236
* a stream; takes the following parameters (but not a data parameter).
234237
* @method graphs#createWriteStream
238+
* @since 1.0
235239
* @param {string} [uri] - a graph name, which can be ommitted for the default graph
236240
* @param {string} contentType - the format for the graph such as application/n-quads,
237241
* application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle,
@@ -249,6 +253,7 @@ Graphs.prototype.createWriteStream = function createGraphWriteStream() {
249253
* Adds the triples for the specified graph in incremental chunks with
250254
* a stream; takes the following parameters (but not a data parameter).
251255
* @method graphs#createMergeStream
256+
* @since 1.0
252257
* @param {string} [uri] - a graph name, which can be omitted for the default graph
253258
* @param {string} contentType - the format for the graph such as application/n-quads,
254259
* application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle,
@@ -387,6 +392,7 @@ function changeGraph(action, isStreaming, args) {
387392
/**
388393
* Removes the specified graph.
389394
* @method graphs#remove
395+
* @since 1.0
390396
* @param {string} [uri] - a graph name, which can be omitted for the default graph
391397
* @param {string|transactions.Transaction} [txid] - a string
392398
* transaction id or Transaction object identifying an open
@@ -402,6 +408,7 @@ Graphs.prototype.remove = function removeGraph() {
402408
/**
403409
* Check whether the specified graph exists.
404410
* @method graphs#probe
411+
* @since 1.0
405412
* @param {string} [uri] - a graph name, which can be omitted for the default graph
406413
* @param {string|transactions.Transaction} [txid] - a string
407414
* transaction id or Transaction object identifying an open
@@ -489,6 +496,7 @@ function applyGraph(action, args) {
489496
/**
490497
* Lists the graphs stored on the server.
491498
* @method graphs#list
499+
* @since 1.0
492500
* @param {string} contentType - the format for the list of graphs
493501
* @param {string|transactions.Transaction} [txid] - a string
494502
* transaction id or Transaction object identifying an open
@@ -552,6 +560,7 @@ Graphs.prototype.list = function listGraphs() {
552560
* configuration object with the following named parameters or, as a shortcut,
553561
* a contentType string, any number of default graph URIs, and a SPARQL query.
554562
* @method graphs#sparql
563+
* @since 1.0
555564
* @param {string} contentType - the format for the query response
556565
* @param {string|string[]} [defaultGraphs] - the default graphs for the SPARQL query
557566
* @param {string|string[]} [namedGraphs] - the named graphs for the SPARQL query
@@ -735,6 +744,7 @@ Graphs.prototype.sparql = function queryGraphSPARQL() {
735744
* Executes a SPARQL update against the graphs; takes a configuration object with
736745
* the following named parameters or, as a shortcut, the SPARQL update data.
737746
* @method graphs#sparqlUpdate
747+
* @since 1.0
738748
* @param {string|ReadableStream} data - the SPARQL update
739749
* @param {object[]} [permissions] - the permissions controlling which users can read or
740750
* write the documents with the updated triples

0 commit comments

Comments
 (0)