diff --git a/README.md b/README.md
index 2267984..5ca9e59 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# basex - A BaseX client for node.js
===========================
-This is a [BaseX](http://basex.org/) client for Node.js. It is work in progress.
+This is a [BaseX](http://basex.org/) client for Node.js.
It uses the [client interface](http://docs.basex.org/wiki/Server_Protocol)
via a socket connection to the BaseX server.
@@ -11,7 +11,7 @@ BaseX is a very light-weight, high-performance and scalable
Built as a lightweight Java server, BaseX also supports XSLT, Webdav and RestXQ.
## Installing the BaseX Node client
-[![NPM](https://nodei.co/npm/basex.png?stars&downloads)](https://nodei.co/npm/basex/) [![NPM](https://nodei.co/npm-dl/basex.png)](https://nodei.co/npm/basex/)
+[![Npm package monthly downloads](https://badgen.net/npm/dm/basex)](https://npmjs.ccom/package/basex)
To install with npm:
@@ -21,7 +21,7 @@ To install with npm:
$ mkdir myproject
cd myproject
$ npm install basex
- basex@0.9.0 ./node_modules/basex
+ basex@1.0.0 ./node_modules/basex
```
Once BaseX is installed and the BaseX server is running, test it.
@@ -39,7 +39,7 @@ Once BaseX is installed and the BaseX server is running, test it.
## Installing BaseX
1. Java is required
1. [Download](http://basex.org/products/download/all-downloads/) and install BaseX
-(tested against version 8.6)
+(tested against versions 9.6,8.6)
1. Run `basexserver -S`
## API specification
@@ -55,40 +55,76 @@ There is a test suite using [mocha](http://mochajs.org/)
```bash
mocha -R spec test/
+ [auth] password good
+ √ should not error
- Execute info command
- ✓ should not error
- ✓ should have reply
+ [auth] password bad
+ √ should throw error
- Send an valid xquery statement: 2+2
- ✓ It should not error
- ✓ It should equal 4
+ [commands] Execute info command
+ √ should not error
+ √ should have reply
- Send an invalid command: 2+
- ✓ It should error
+ [commands] Send valid xquery statement: 2+2
+ √ It should not error
+ √ It should equal 4
- Create a database
- ✓ It should not error
+ [commands] Send an invalid command: 2+
+ √ It should error
- Add a document
- ✓ It should not error
+ [commands] Create a database testdb using execute
+ √ It should not error
- drop db database
- ✓ It should not error
+ [commands] Add a document
+ √ It should not error
- drop db database
- ✓ It should not error
+ [commands] Add an invalid document
+ √ It should error
- Send a xquery and iterate over the result items
- ✓ It should not error
- ✓ It should return an array
+ [commands] drop db testdb
+ √ It should not error
- create query and bind
- ✓ It should not error
- ✓ It should return a string
+ [commands] create database
+ √ It should not error
- 13 tests complete (408 ms)
+ [commands] drop db database
+ √ It should not error
+ [parser] Parser test?
+ √ should pop abc
+
+ [query] create query and bind
+ √ It should not error
+ √ It should return a string
+
+ [query] create query and bind with type
+ √ It should not error
+ √ It should return a string
+
+ [query] Send a xquery and iterate over the result items
+ √ It should not error
+ √ It should return an array
+
+ [stream] Create a database testdb from stream
+ √ It should not error
+
+ [stream] Add doc from stream
+ √ It should not error
+
+ [stream] drop db testdb
+ √ It should not error
+
+ [stress] Send a xquery and iterate over the 1000000 result items
+ √ should not error
+
+ [stress] return megabyte result from execute
+ √ should not error
+
+ [stress] return megabyte result from query
+ √ should not error
+
+
+ 26 passing (2s)
```
# Tools
@@ -104,8 +140,8 @@ Thanks to:
- [jesseclark](https://github.com/jesseclark)
- [Zearin](https://github.com/Zearin)
-
-
+- [Zearin](https://github.com/Zearin)
+- [salim-dev](https://github.com/salim-dev)
# Todo
* stream i/o
@@ -123,7 +159,3 @@ Parts inspired by [node_redis](https://github.com/mranney/node_redis),
# License
BSD license
-
-
-[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/apb2006/basex-node/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
-
diff --git a/changelog.md b/changelog.md
index 2c3df25..774a8d9 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,12 @@
+# Changelog
+## v1.0.0 - 2021-09-29
+- removed use of Buffer() see #28
+- query bind pass type to server #26
+- update `combined-stream` to "1.0.8"
+- Node version ">=8.0"
+- reworked tests
+- reworked sample `issue22.js`
+
## v0.9.0 - 2017-03-23
- session object now emits socketError events - see #9 #21
- min node version set to 4.0
diff --git a/debug.js b/debug.js
index ae76c2c..3b7104e 100644
--- a/debug.js
+++ b/debug.js
@@ -30,4 +30,4 @@ function printMsg(msg) {
}
};
exports.print = print;
-exports.printMsg = printMsg;
\ No newline at end of file
+exports.printMsg = printMsg;
diff --git a/docs/commands.md b/docs/commands.md
index 7fba66d..01e22c2 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -36,7 +36,7 @@ This allows an application to react to events such as the server doing down.(See
# Session commands
-##execute
+## execute
````
session.execute(command,callback)
````
@@ -45,7 +45,7 @@ Example
````
client.execute("create db test_db", log.print);
````
-##query
+## query
````
var query=session.query(query)
````
@@ -55,7 +55,7 @@ Example
var input = 'for $i in 1 to 100 return Text { $i }';
var query = session.query(input);
````
-##create
+## create
````
session.create(name,in,callback)
````
@@ -65,7 +65,7 @@ Creates a database from an input stream.
client.create("test_db", "Hello World!", log.print);
````
-##add
+## add
````
session.add(name,target,in,callback)
````
@@ -76,13 +76,13 @@ Example
var s=fs.createReadStream(__dirname+ "/books.xml");
client.add("/world/World.xml", s, log.print);
````
-##replace
+## replace
````
session.replace(path,in,callback)
````
Replaces a document with the specified input stream.
-##store
+## store
````
session.store(path,in,callback)
````
@@ -90,43 +90,45 @@ Stores raw data at the specified path.
-##info
+## info
session.info(callback)
Returns process information.
-##close
+## close
session.close(callback)
Closes the session.
# The query object
Create a query object `var q=session.query(query)`, then `bind` any external variables,
finally call `results or `execute`
-##bind
+See [Query](https://docs.basex.org/wiki/Server_Protocol#Query)
+
+## bind
````
query.bind(name,value,type,callback);
````
-Binds a `name` to a `value`. Currently `type` is ignored.
+Binds a `name` to a `value`.
````
query.bind("name", "nodex","",log.print);
````
-##close
+## close
query.close();
-##results
+## results
query.results(callback);
Returns results as an array.
````
query.results(log.print);
````
-##execute
+## execute
````
query.execute(callback);
````
Executes the query and returns all results as a single string.
-##info
+## info
query.info(callback);
-##options
+## options
query.options(callback);
# Debugging
diff --git a/examples/QueryBindExample.js b/examples/QueryBindExample.js
index 376a245..963eda7 100644
--- a/examples/QueryBindExample.js
+++ b/examples/QueryBindExample.js
@@ -6,14 +6,38 @@
var basex = require("../index");
var log = require("../debug");
//basex.debug_mode = true;
-var session = new basex.Session("localhost", 1984, "admin", "admin");
+var session = new basex.Session();
// create query instance
-var input = "declare variable $name external; for $i in 1 to 1000 return element { $name } { $i }";
+var input = `
+declare variable $item external;
+declare variable $str as xs:string external;
+declare variable $int as xs:integer external;
+declare variable $int2 as xs:integer external;
+declare variable $bool as xs:boolean external;
+declare variable $bool2 as xs:boolean external;
+declare variable $what as item() external :="a default value";
+
+declare function local:about($name,$value){($name || " :" || inspect:type($value) ,$value)};
+
+ local:about('$item',$item)
+,local:about('$str',$str)
+,local:about('$int',$int)
+,local:about('$int2',$int2)
+,local:about('$bool',$bool)
+,local:about('$bool2',$bool2)
+,local:about('$what',$what)
+`
var query = session.query(input);
-// bind variable
-query.bind("name", "nodex","",log.print);
+// bind variables
+query.bind("item", "item","",log.print);
+query.bind("str", "a string","",log.print);
+query.bind("int", -1,"xs:integer",log.print);
+query.bind("int2", -2,"",log.print);
+query.bind("bool", true,"",log.print);
+query.bind("bool2", true,"xs:boolean",log.print);
+//query.bind("what", true,"badtype",log.print);
query.info(log.print);
// print results
query.execute(log.print);
diff --git a/examples/RawExample.js b/examples/RawExample.js
index 358d94b..65b9ba4 100644
--- a/examples/RawExample.js
+++ b/examples/RawExample.js
@@ -18,7 +18,7 @@ function print(err, reply) {
} else {
console.log("Reply: ",reply);
var str = reply.result;
- var buf = new Buffer(str.length);
+ var buf = Buffer.alloc(str.length);
for (var i = 0; i < str.length ; i++) {
buf[i] = str.charCodeAt(i);
diff --git a/examples/auth.js b/examples/auth.js
new file mode 100644
index 0000000..aae2809
--- /dev/null
+++ b/examples/auth.js
@@ -0,0 +1,32 @@
+/*
+ * This example has all session options explicitly set.
+ */
+var basex = require("../index");
+basex.debug_mode = false;
+var client = new basex.Session("localhost", 8900,"admin","admin");
+
+/**
+ * Description
+ * @method print
+ * @param {} err
+ * @param {} reply
+ * @return
+ */
+function print(err, reply) {
+ if (err) {
+ console.log("Error: " + err);
+ } else {
+ var t2=new Date();
+ console.log("Execution completed in ",t2-t0," milliseconds.");
+ console.dir(reply);
+ }
+};
+var t0=new Date();
+client.execute("xquery 1 to 10",print);
+client.close(function(){
+ var t2=new Date();
+ console.log("Closed in ",t2-t0," milliseconds.");
+});
+var t1=new Date();
+// time to send commands to server.
+console.log("Commands send in ",t1-t0," milliseconds.");
diff --git a/examples/bxstream.js b/examples/bxstream.js
index 86619d5..34b410d 100644
--- a/examples/bxstream.js
+++ b/examples/bxstream.js
@@ -16,7 +16,7 @@ writeStream.on('close', function () {
console.log('All done!');
});
rs.pipe(writeStream);
-var b=new Buffer("aaaaaaaaaaaaaaaaaaab\x00c\xFF\x00fg\x0099","binary");
+var b= Buffer.from("aaaaaaaaaaaaaaaaaaab\x00c\xFF\x00fg\x0099","binary");
rs.write(b);
console.log("-------------------------")
@@ -24,5 +24,5 @@ var ss=new bxs.SendStream();
ss.on("data",function(data){
console.log(data)
});
-var b=new Buffer("aaaaa\x00bbb\xFFcccc ","binary");
+var b= Buffer.from("aaaaa\x00bbb\xFFcccc ","binary");
ss.write(b);
\ No newline at end of file
diff --git a/examples/issue22.js b/examples/issue22.js
index 375c3da..f6dc794 100644
--- a/examples/issue22.js
+++ b/examples/issue22.js
@@ -1,21 +1,28 @@
/*
* socket errors #22
+ * An example of handling socket errors and reconnecting
*/
const basex = require("../index");
basex.debug_mode = false;
var session;
-
+var queryTimer;
+var BROKEN_SOCKET_CODES= ['ECONNRESET','EPIPE','ERR_STREAM_DESTROYED']; // reconnect required after these
+var reconnect_interval= 10000; // retry after 10 secs
function socketError(e){
console.log("socket trouble detected..",e.code);
+ clearTimeout(queryTimer); // stop sending
if (e.code == 'ECONNREFUSED') {
console.error('connection refused. Check BaseX server is running.');
- } else if(e.code == 'ECONNRESET' || e.code == 'EPIPE'){
- console.log("Restarting client in 10 seconds");
- setTimeout(work, 10000); // 10 seconds pass..
+ console.log("Attempting to reconnect in 10 seconds");
+ setTimeout(work, reconnect_interval); // retry..
+ }else if( BROKEN_SOCKET_CODES.includes(e.code) ) {
+ console.log("Attempting to reconnect in 10 seconds");
+ setTimeout(work, reconnect_interval); // retry..
} else {
console.error("SOCKET ERROR: ", e.code,":", e);
+ throw "SOCKET ERROR: "+ e.code
}
};
function work(){
@@ -23,10 +30,10 @@ function work(){
session = new basex.Session();
session.on("socketError",socketError);
// poll server time every second
- setInterval(serverdateTime,1000);
+ queryTimer=setInterval(serverdateTime,1000);
};
-
+// example server request
function serverdateTime() {
var query = 'fn:current-dateTime()';
var q = session.query(query)
diff --git a/index.js b/index.js
index 4b5d440..640ef54 100644
--- a/index.js
+++ b/index.js
@@ -28,6 +28,13 @@ var states = {
var tagid = 0; // used to give each Session a unique .tag property
+var options_default={
+ host: "127.0.0.1",
+ port: 8900, // typically 1984
+ username: "admin",
+ password: "admin"
+};
+
/**
* Create a session connection
* @constructor Session
@@ -40,10 +47,10 @@ var tagid = 0; // used to give each Session a unique .tag property
var Session = function(host, port, username, password) {
var self = this;
this.options = {
- host: host || "127.0.0.1",
- port: port || 1984,
- username: username || "admin",
- password: password || "admin"
+ host: host || options_default.host,
+ port: port || options_default.port,
+ username: username || options_default.username,
+ password: password || options_default.password
};
this.tag = "S" + (++tagid);
diff --git a/lib/basexstream.js b/lib/basexstream.js
index 02f4839..b58097e 100644
--- a/lib/basexstream.js
+++ b/lib/basexstream.js
@@ -20,7 +20,7 @@ require("util").inherits(SendStream, require("stream"));
SendStream.prototype._transform = function(data) {
var lastpos=0;
// write 0xFF before 00 or FF
- var ef=new Buffer([255])
+ var ef= Buffer.alloc([255])
for ( var i = 0; i < data.length; i++) {
var c = data[i]
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..2d44372
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,830 @@
+{
+ "name": "basex",
+ "version": "0.9.1",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@sinonjs/commons": {
+ "version": "1.8.3",
+ "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz",
+ "integrity": "sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ==",
+ "dev": true,
+ "requires": {
+ "type-detect": "4.0.8"
+ }
+ },
+ "@sinonjs/fake-timers": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz",
+ "integrity": "sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.7.0"
+ }
+ },
+ "@sinonjs/samsam": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.0.2.tgz",
+ "integrity": "sha512-jxPRPp9n93ci7b8hMfJOFDPRLFYadN6FSpeROFTR4UNF4i5b+EK6m4QXPO46BDhFgRy1JuS87zAnFOzCUwMJcQ==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.6.0",
+ "lodash.get": "^4.4.2",
+ "type-detect": "^4.0.8"
+ }
+ },
+ "@sinonjs/text-encoding": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
+ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
+ "dev": true
+ },
+ "@ungap/promise-all-settled": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
+ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
+ "dev": true
+ },
+ "ansi-colors": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
+ "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
+ "dev": true
+ },
+ "ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "anymatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
+ "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "dev": true,
+ "requires": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ }
+ },
+ "argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
+ },
+ "balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true
+ },
+ "binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "dev": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "braces": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
+ "dev": true,
+ "requires": {
+ "fill-range": "^7.0.1"
+ }
+ },
+ "browser-stdout": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
+ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
+ "dev": true
+ },
+ "camelcase": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
+ "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==",
+ "dev": true
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "chokidar": {
+ "version": "3.5.2",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz",
+ "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==",
+ "dev": true,
+ "requires": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "fsevents": "~2.3.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ }
+ },
+ "cliui": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "dev": true,
+ "requires": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^7.0.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "requires": {
+ "delayed-stream": "~1.0.0"
+ }
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
+ },
+ "debug": {
+ "version": "4.3.2",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
+ "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
+ "dev": true,
+ "requires": {
+ "ms": "2.1.2"
+ },
+ "dependencies": {
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
+ "dev": true
+ }
+ }
+ },
+ "decamelize": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
+ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
+ "dev": true
+ },
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
+ },
+ "diff": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
+ "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
+ "dev": true
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+ "dev": true
+ },
+ "escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true
+ },
+ "fill-range": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
+ "dev": true,
+ "requires": {
+ "to-regex-range": "^5.0.1"
+ }
+ },
+ "find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "requires": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ }
+ },
+ "flat": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
+ "dev": true
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
+ },
+ "fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "dev": true,
+ "optional": true
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true
+ },
+ "glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "requires": {
+ "is-glob": "^4.0.1"
+ }
+ },
+ "growl": {
+ "version": "1.10.5",
+ "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
+ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true
+ },
+ "he": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "dev": true
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "requires": {
+ "binary-extensions": "^2.0.0"
+ }
+ },
+ "is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "dev": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true
+ },
+ "is-glob": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.2.tgz",
+ "integrity": "sha512-ZZTOjRcDjuAAAv2cTBQP/lL59ZTArx77+7UzHdWW/XB1mrfp7DEaVpKmZ0XIzx+M7AxfhKcqV+nMetUQmFifwg==",
+ "dev": true,
+ "requires": {
+ "is-extglob": "^2.1.1"
+ }
+ },
+ "is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true
+ },
+ "is-plain-obj": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
+ "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
+ "dev": true
+ },
+ "is-unicode-supported": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
+ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
+ "dev": true
+ },
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
+ "dev": true
+ },
+ "js-yaml": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
+ "requires": {
+ "argparse": "^2.0.1"
+ }
+ },
+ "just-extend": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz",
+ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
+ "dev": true
+ },
+ "locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "requires": {
+ "p-locate": "^5.0.0"
+ }
+ },
+ "lodash.get": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
+ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=",
+ "dev": true
+ },
+ "log-symbols": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
+ "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
+ "dev": true,
+ "requires": {
+ "chalk": "^4.1.0",
+ "is-unicode-supported": "^0.1.0"
+ }
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "mocha": {
+ "version": "9.1.2",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.2.tgz",
+ "integrity": "sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w==",
+ "dev": true,
+ "requires": {
+ "@ungap/promise-all-settled": "1.1.2",
+ "ansi-colors": "4.1.1",
+ "browser-stdout": "1.3.1",
+ "chokidar": "3.5.2",
+ "debug": "4.3.2",
+ "diff": "5.0.0",
+ "escape-string-regexp": "4.0.0",
+ "find-up": "5.0.0",
+ "glob": "7.1.7",
+ "growl": "1.10.5",
+ "he": "1.2.0",
+ "js-yaml": "4.1.0",
+ "log-symbols": "4.1.0",
+ "minimatch": "3.0.4",
+ "ms": "2.1.3",
+ "nanoid": "3.1.25",
+ "serialize-javascript": "6.0.0",
+ "strip-json-comments": "3.1.1",
+ "supports-color": "8.1.1",
+ "which": "2.0.2",
+ "workerpool": "6.1.5",
+ "yargs": "16.2.0",
+ "yargs-parser": "20.2.4",
+ "yargs-unparser": "2.0.0"
+ }
+ },
+ "ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "nanoid": {
+ "version": "3.1.25",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz",
+ "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==",
+ "dev": true
+ },
+ "nise": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.0.tgz",
+ "integrity": "sha512-W5WlHu+wvo3PaKLsJJkgPup2LrsXCcm7AWwyNZkUnn5rwPkuPBi3Iwk5SQtN0mv+K65k7nKKjwNQ30wg3wLAQQ==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.7.0",
+ "@sinonjs/fake-timers": "^7.0.4",
+ "@sinonjs/text-encoding": "^0.7.1",
+ "just-extend": "^4.0.2",
+ "path-to-regexp": "^1.7.0"
+ }
+ },
+ "normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
+ "requires": {
+ "yocto-queue": "^0.1.0"
+ }
+ },
+ "p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "requires": {
+ "p-limit": "^3.0.2"
+ }
+ },
+ "path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
+ },
+ "path-to-regexp": {
+ "version": "1.8.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
+ "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
+ "dev": true,
+ "requires": {
+ "isarray": "0.0.1"
+ }
+ },
+ "picomatch": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
+ "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",
+ "dev": true
+ },
+ "randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
+ "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "requires": {
+ "picomatch": "^2.2.1"
+ }
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true
+ },
+ "serialize-javascript": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
+ "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.1.0"
+ }
+ },
+ "should": {
+ "version": "13.2.3",
+ "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz",
+ "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==",
+ "dev": true,
+ "requires": {
+ "should-equal": "^2.0.0",
+ "should-format": "^3.0.3",
+ "should-type": "^1.4.0",
+ "should-type-adaptors": "^1.0.1",
+ "should-util": "^1.0.0"
+ }
+ },
+ "should-equal": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz",
+ "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==",
+ "dev": true,
+ "requires": {
+ "should-type": "^1.4.0"
+ }
+ },
+ "should-format": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz",
+ "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=",
+ "dev": true,
+ "requires": {
+ "should-type": "^1.3.0",
+ "should-type-adaptors": "^1.0.1"
+ }
+ },
+ "should-type": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz",
+ "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=",
+ "dev": true
+ },
+ "should-type-adaptors": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz",
+ "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==",
+ "dev": true,
+ "requires": {
+ "should-type": "^1.3.0",
+ "should-util": "^1.0.0"
+ }
+ },
+ "should-util": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz",
+ "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==",
+ "dev": true
+ },
+ "sinon": {
+ "version": "11.1.2",
+ "resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz",
+ "integrity": "sha512-59237HChms4kg7/sXhiRcUzdSkKuydDeTiamT/jesUVHshBgL8XAmhgFo0GfK6RruMDM/iRSij1EybmMog9cJw==",
+ "dev": true,
+ "requires": {
+ "@sinonjs/commons": "^1.8.3",
+ "@sinonjs/fake-timers": "^7.1.2",
+ "@sinonjs/samsam": "^6.0.2",
+ "diff": "^5.0.0",
+ "nise": "^5.1.0",
+ "supports-color": "^7.2.0"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ }
+ },
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ },
+ "strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "requires": {
+ "is-number": "^7.0.0"
+ }
+ },
+ "type-detect": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
+ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
+ "dev": true
+ },
+ "which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ },
+ "workerpool": {
+ "version": "6.1.5",
+ "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz",
+ "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true
+ },
+ "yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "dev": true,
+ "requires": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "20.2.4",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
+ "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
+ "dev": true
+ },
+ "yargs-unparser": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
+ "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^6.0.0",
+ "decamelize": "^4.0.0",
+ "flat": "^5.0.2",
+ "is-plain-obj": "^2.1.0"
+ }
+ },
+ "yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true
+ }
+ }
+}
diff --git a/package.json b/package.json
index 2b27a0f..37e2fd2 100644
--- a/package.json
+++ b/package.json
@@ -1,45 +1,33 @@
{
"name": "basex",
- "version": "0.9.0",
+ "version": "1.0.0",
"description": "A BaseX (XML database) client library",
- "keywords":
- [
+ "keywords": [
"xml",
"xquery",
"xslt",
"database",
"basex"
],
-
"author": "Andy Bunce ",
- "contributors":
- [
+ "contributors": [
"Andy Bunce"
],
-
"main": "./index.js",
- "repository":
- {
+ "repository": {
"type": "git",
"url": "git://github.com/apb2006/basex-node.git"
},
-
- "dependencies":
- {
- "combined-stream": "1.0.3"
+ "dependencies": {
+ "combined-stream": "1.0.8"
},
-
- "devDependencies":
- {
+ "devDependencies": {
"mocha": "*",
"should": "*",
"sinon": "*"
},
-
- "engines":
- {
- "node": ">=4.0"
+ "engines": {
+ "node": ">=8.0"
},
-
"license": "BSD-3-Clause"
-}
\ No newline at end of file
+}
diff --git a/test/test-auth.js b/test/test-auth.js
index 149adce..82d711c 100644
--- a/test/test-auth.js
+++ b/test/test-auth.js
@@ -7,10 +7,10 @@ var should = require("should");
-describe('Authorization good', function() {
+describe('[auth] password good', function() {
var reply, err;
before(function(done) {
- var session = new basex.Session("127.0.0.1", 1984, "admin", "admin")
+ var session = new basex.Session()
session.close(function(e, r) {
reply = r;
err = e;
@@ -25,7 +25,7 @@ describe('Authorization good', function() {
});
// http://stackoverflow.com/questions/9025095/how-can-i-test-uncaught-errors-in-mocha
-describe('Authorization failure ', function() {
+describe('[auth] password bad ', function() {
var reply, err, recordedError = null;
it('should throw error', function(done) {
@@ -36,7 +36,7 @@ describe('Authorization failure ', function() {
recordedError = error
done();
})
- var session = new basex.Session("127.0.0.1", 1984, "admin", "wrong-password")
+ var session = new basex.Session(null,null ,null , "wrong-password")
session.close(function(e, r) {
reply = r;
err = e;
diff --git a/test/test-commands.js b/test/test-commands.js
index c08976c..4ba20d9 100644
--- a/test/test-commands.js
+++ b/test/test-commands.js
@@ -7,7 +7,7 @@ var should = require("should");
var session = new basex.Session();
-describe('Execute info command', function() {
+describe('[commands] Execute info command', function() {
var reply, err;
before(function(done) {
session.execute("info", function(e, r) {
@@ -26,7 +26,7 @@ describe('Execute info command', function() {
});
-describe('Send an valid xquery statement: 2+2', function() {
+describe('[commands] Send valid xquery statement: 2+2', function() {
var reply, err;
before(function(done) {
session.execute("xquery 2+2", function(e, r) {
@@ -45,7 +45,7 @@ describe('Send an valid xquery statement: 2+2', function() {
});
-describe('Send an invalid command: 2+', function() {
+describe('[commands] Send an invalid command: 2+', function() {
var reply, err;
before(function(done) {
session.execute("xquery 2+", function(e, r) {
@@ -60,7 +60,7 @@ describe('Send an invalid command: 2+', function() {
});
});
-describe('Create a database testdb using execute', function() {
+describe('[commands] Create a database testdb using execute', function() {
var reply, err;
before(function(done) {
session.execute("create db testdb", function(e, r) {
@@ -75,7 +75,7 @@ describe('Create a database testdb using execute', function() {
});
});
-describe('Add a document', function() {
+describe('[commands] Add a document', function() {
var reply, err;
before(function(done) {
session.add("/world/World.xml", "Hello World!", function(e, r) {
@@ -90,7 +90,7 @@ describe('Add a document', function() {
});
});
-describe('Add an invalid document', function() {
+describe('[commands] Add an invalid document', function() {
var reply, err;
before(function(done) {
session.add("/world/World.xml", "<\"x\">Hello World!", function(e,
@@ -106,7 +106,7 @@ describe('Add an invalid document', function() {
});
});
-describe('drop db testdb', function() {
+describe('[commands] drop db testdb', function() {
var reply, err;
before(function(done) {
session.execute("drop db testdb", function(e, r) {
@@ -121,7 +121,7 @@ describe('drop db testdb', function() {
});
});
-describe('create database', function() {
+describe('[commands] create database', function() {
var reply, err;
before(function(done) {
session.create("testdb", "Hello World!", function(e, r) {
@@ -136,7 +136,7 @@ describe('create database', function() {
});
});
-describe('drop db database', function() {
+describe('[commands] drop db database', function() {
var reply, err;
before(function(done) {
session.execute("drop db testdb", function(e, r) {
@@ -151,53 +151,6 @@ describe('drop db database', function() {
});
});
-describe('Send a xquery and iterate over the result items', function() {
- var reply, err;
- before(function(done) {
- var input = 'for $i in 1 to 10 return Text { $i }';
- var query = session.query(input);
-
- query.results(function(e, r) {
- reply = r;
- err = e;
- done();
- });
- });
-
- it('It should not error', function() {
- should.not.exist(err);
- });
- it('It should return an array', function() {
- reply.result.should.be.an.Array;
- });
-});
-
-describe(
- 'create query and bind ',
- function() {
- var reply, err;
- before(function(done) {
- var input = "declare variable $name external; for $i in 1 to 10 return element { $name } { $i }";
- var query = session.query(input);
-
- // bind variable
- query.bind("name", "nodex");
-
- // print results
- query.execute(function(e, r) {
- reply = r;
- err = e;
- done();
- });
- });
-
- it('It should not error', function() {
- should.not.exist(err);
- });
- it('It should return a string', function() {
- reply.result.should.be.a.String
- });
- });
//-----------------------------
beforeEach(function() {
diff --git a/test/test-parser.js b/test/test-parser.js
index 7c67b06..5869369 100644
--- a/test/test-parser.js
+++ b/test/test-parser.js
@@ -7,8 +7,8 @@ var bxs = require('../lib/basexstream.js');
-describe('Parser test', function() {
- var b= new Buffer("abc\0\0");
+describe('[parser] Parser test?', function() {
+ var b= Buffer.from("abc\0\0");
var s2=new bxs.NopStream()
it("should pop abc",function (){
var p=new parser2.parse(s2)
diff --git a/test/test-query.js b/test/test-query.js
new file mode 100644
index 0000000..20e80ec
--- /dev/null
+++ b/test/test-query.js
@@ -0,0 +1,93 @@
+/*
+ * basex-node test query bind interface using mocha
+ */
+
+var basex = require('../index.js');
+var should = require("should");
+
+var session = new basex.Session();
+
+
+describe(
+ '[query] create query and bind ',
+ function() {
+ var reply, err;
+ before(function(done) {
+ var input = "declare variable $name external; for $i in 1 to 10 return element { $name } { $i }";
+ var query = session.query(input);
+
+ // bind variable
+ query.bind("name", "nodex");
+
+ // print results
+ query.execute(function(e, r) {
+ reply = r;
+ err = e;
+ done();
+ });
+ });
+
+ it('It should not error', function() {
+ should.not.exist(err);
+ });
+ it('It should return a string', function() {
+ reply.result.should.be.a.String
+ });
+ });
+
+describe(
+ '[query] create query and bind with type ',
+ function() {
+ var reply, err;
+ before(function(done) {
+ var input = "declare variable $max external := 20; for $i in 1 to $max return element Number { $i }";
+ var query = session.query(input);
+
+ // bind variable with type
+ query.bind("max", 50, "xs:integer");
+
+ // print results
+ query.execute(function(e, r) {
+ reply = r;
+ err = e;
+ done();
+ });
+ });
+
+ it('It should not error', function() {
+ should.not.exist(err);
+ });
+ it('It should return a string', function() {
+ reply.result.should.be.a.String
+ });
+ });
+
+describe('[query] Send a xquery and iterate over the result items', function() {
+ var reply, err;
+ before(function(done) {
+ var input = 'for $i in 1 to 10 return Text { $i }';
+ var query = session.query(input);
+
+ query.results(function(e, r) {
+ reply = r;
+ err = e;
+ done();
+ });
+ });
+
+ it('It should not error', function() {
+ should.not.exist(err);
+ });
+ it('It should return an array', function() {
+ reply.result.should.be.an.Array;
+ });
+});
+//-----------------------------
+beforeEach(function() {
+ // console.log('before every test')
+});
+
+after(function() {
+ session.close();
+ // console.log('after..');
+});
\ No newline at end of file
diff --git a/test/test-stream.js b/test/test-stream.js
index bdfd0bc..4cbe5bf 100644
--- a/test/test-stream.js
+++ b/test/test-stream.js
@@ -8,7 +8,7 @@ var should = require("should");
var session = new basex.Session();
-describe('Create a database testdb from stream', function() {
+describe('[stream] Create a database testdb from stream', function() {
var reply, err;
before(function(done) {
var str=fs.createReadStream(__dirname+ "/resources/books.xml");
@@ -24,7 +24,7 @@ describe('Create a database testdb from stream', function() {
});
});
-describe('Add doc from stream', function() {
+describe('[stream] Add doc from stream', function() {
var reply, err;
before(function(done) {
var str=fs.createReadStream(__dirname+ "\\resources\\books.xml");
@@ -39,7 +39,7 @@ describe('Add doc from stream', function() {
should.not.exist(err);
});
});
-describe('drop db testdb', function() {
+describe('[stream] drop db testdb', function() {
var reply, err;
before(function(done) {
session.execute("drop db testdb", function(e, r) {
diff --git a/test/test-stress.js b/test/test-stress.js
index 334fe6c..ec96180 100644
--- a/test/test-stress.js
+++ b/test/test-stress.js
@@ -7,7 +7,7 @@ var should = require("should");
var session = new basex.Session();
-describe('Send a xquery and iterate over the 1000000 result items ', function() {
+describe('[stress] Send a xquery and iterate over the 1000000 result items ', function() {
var reply, err;
before(function(done) {
// create query instance
@@ -26,7 +26,7 @@ describe('Send a xquery and iterate over the 1000000 result items ', function()
});
});
-describe('return megabyte result from execute ', function() {
+describe('[stress] return megabyte result from execute ', function() {
var reply, err;
before(function(done) {
// create query instance
@@ -43,7 +43,7 @@ describe('return megabyte result from execute ', function() {
});
});
-describe('return megabyte result from query ', function() {
+describe('[stress] return megabyte result from query ', function() {
var reply, err;
before(function(done) {
// create query instance