diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..80549706f --- /dev/null +++ b/.eslintrc @@ -0,0 +1,11 @@ +{ + "env": { + "node": true, + "es6": true + }, + "extends": ["eslint:recommended", "prettier"], + "parser": "babel-eslint", + "rules": { + "no-console": "warn" + } +} diff --git a/arangojs.min.js b/arangojs.min.js index b4166c54f..36ac2a055 100644 --- a/arangojs.min.js +++ b/arangojs.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.arangojs=e():t.arangojs=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=7)}([function(t,e,n){"use strict";var o,r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};o=function(){return this}();try{o=o||Function("return this")()||(0,eval)("this")}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(o=window)}t.exports=o},function(t,e,n){"use strict";function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){return new(e.type===f.EDGE_COLLECTION?y:h)(t,e.name)}Object.defineProperty(e,"__esModule",{value:!0}),e._types=e._BaseCollection=e.DocumentCollection=e.EdgeCollection=e.types=void 0;var u=Object.assign||function(t){for(var e=1;e=3&&(this.first=void 0,this.last=void 0,this.createCapConstraint=void 0)}return s(t,[{key:"_documentHandle",value:function(t){if("string"!=typeof t){if(t._id)return t._id;if(t._key)return this._idPrefix+t._key;throw new Error("Document handle must be a document or string")}return-1===t.indexOf("/")?this._idPrefix+t:t}},{key:"_indexHandle",value:function(t){if("string"!=typeof t){if(t.id)return t.id;throw new Error("Document handle must be a document or string")}return-1===t.indexOf("/")?this._idPrefix+t:t}},{key:"_get",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.get(this._urlPrefix+t,e,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"_put",value:function(t,e,n){var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.put(this._urlPrefix+t,e,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"get",value:function(t){var e=this._connection.promisify(t),n=e.promise,o=e.callback;return this._api.get("/collection/"+this.name,function(t,e){return t?o(t):o(null,e.body)}),n}},{key:"create",value:function(t,e){"function"==typeof t&&(e=t,t=void 0);var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.post("/collection",u({},t,{name:this.name,type:this.type}),function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"properties",value:function(t){return this._get("properties",t)}},{key:"count",value:function(t){return this._get("count",t)}},{key:"figures",value:function(t){return this._get("figures",t)}},{key:"revision",value:function(t){return this._get("revision",t)}},{key:"checksum",value:function(t,e){return this._get("checksum",t,e)}},{key:"load",value:function(t,e){return"function"==typeof t&&(e=t,t=void 0),this._put("load","boolean"==typeof t?{count:t}:void 0,e)}},{key:"unload",value:function(t){return this._put("unload",void 0,t)}},{key:"setProperties",value:function(t,e){return this._put("properties",t,e)}},{key:"rename",value:function(t,e){var n=this,o=this._connection.promisify(e),r=o.promise,i=o.callback;return this._api.put(this._urlPrefix+"rename",{name:t},function(e,o){e?i(e):(n.name=t,n._idPrefix=t+"/",n._urlPrefix="/collection/"+t+"/",i(null,o.body))}),r}},{key:"rotate",value:function(t){return this._put("rotate",void 0,t)}},{key:"truncate",value:function(t){return this._put("truncate",void 0,t)}},{key:"drop",value:function(t,e){"function"==typeof t&&(e=t,t=void 0);var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.delete("/collection/"+this.name,t,function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"replace",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0),"string"==typeof n&&(n={rev:n});var r=this._connection.promisify(o),i=r.promise,a=r.callback,u=n&&n.rev,s=u&&this._connection.arangoMajor>=3?{"if-match":u}:void 0;return this._api.put(this._documentPath(t),e,n,s,function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"update",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0),"string"==typeof n&&(n={rev:n});var r=this._connection.promisify(o),i=r.promise,a=r.callback,u=n&&n.rev,s=u&&this._connection.arangoMajor>=3?{"if-match":u}:void 0;return this._api.patch(this._documentPath(t),e,n,s,function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"bulkUpdate",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof e&&(e={rev:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.patch("/document/"+this.name,t,e,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"remove",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof e&&(e={rev:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback,a=e&&e.rev,u=a&&this._connection.arangoMajor>=3?{"if-match":a}:void 0;return this._api.delete(this._documentPath(t),e,u,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"list",value:function(t,e){"function"==typeof t&&(e=t,t=void 0),t||(t="id");var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._connection.arangoMajor<3?this._api.get("/document",{type:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.documents)}):this._api.put("/simple/all-keys",{type:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.result)}),o}},{key:"all",value:function(t,e){var n=this;"function"==typeof t&&(e=t,t=void 0);var o=this._connection.promisify(e),r=o.promise,i=o.callback;return this._api.put("/simple/all",u({},t,{collection:this.name}),function(t,e){return t?i(t):i(null,new l.default(n._connection,e.body))}),r}},{key:"any",value:function(t){var e=this._connection.promisify(t),n=e.promise,o=e.callback;return this._api.put("/simple/any",{collection:this.name},function(t,e){return t?o(t):o(null,e.body.document)}),n}},{key:"first",value:function(t,e){"function"==typeof t&&(e=t,t=void 0),"number"==typeof t&&(t={count:t});var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/first",u({},t,{collection:this.name}),function(t,e){return t?r(t):r(null,e.body.result)}),o}},{key:"last",value:function(t,e){"function"==typeof t&&(e=t,t=void 0),"number"==typeof t&&(t={count:t});var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/last",u({},t,{collection:this.name}),function(t,e){return t?r(t):r(null,e.body.result)}),o}},{key:"byExample",value:function(t,e,n){var o=this;"function"==typeof e&&(n=e,e=void 0);var r=this._connection.promisify(n),i=r.promise,a=r.callback;return this._api.put("/simple/by-example",u({},e,{example:t,collection:this.name}),function(t,e){return t?a(t):a(null,new l.default(o._connection,e.body))}),i}},{key:"firstExample",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/first-example",{example:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.document)}),o}},{key:"removeByExample",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.put("/simple/remove-by-example",u({},e,{example:t,collection:this.name}),function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"replaceByExample",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0);var r=this._connection.promisify(o),i=r.promise,a=r.callback;return this._api.put("/simple/replace-by-example",u({},n,{example:t,newValue:e,collection:this.name}),function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"updateByExample",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0);var r=this._connection.promisify(o),i=r.promise,a=r.callback;return this._api.put("/simple/update-by-example",u({},n,{example:t,newValue:e,collection:this.name}),function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"lookupByKeys",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/lookup-by-keys",{keys:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.documents)}),o}},{key:"removeByKeys",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.put("/simple/remove-by-keys",{options:e,keys:t,collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"import",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.request({method:"POST",path:"/import",body:t,ld:Boolean(!e||"array"!==e.type),qs:u({type:"auto"},e,{collection:this.name})},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"indexes",value:function(t){var e=this._connection.promisify(t),n=e.promise,o=e.callback;return this._api.get("/index",{collection:this.name},function(t,e){return t?o(t):o(null,e.body.indexes)}),n}},{key:"index",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.get("/index/"+this._indexHandle(t),function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"createIndex",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.post("/index",t,{collection:this.name},function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"dropIndex",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.delete("/index/"+this._indexHandle(t),function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"createCapConstraint",value:function(t,e){"number"==typeof t&&(t={size:t});var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.post("/index",u({},t,{type:"cap"}),{collection:this.name},function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"createHashIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),"boolean"==typeof e&&(e={unique:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({unique:!1},e,{type:"hash",fields:t}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createSkipList",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),"boolean"==typeof e&&(e={unique:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({unique:!1},e,{type:"skiplist",fields:t}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createPersistentIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),"boolean"==typeof e&&(e={unique:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({unique:!1},e,{type:"persistent",fields:t}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createGeoIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({},e,{fields:t,type:"geo"}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createFulltextIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),e&&(e=Number(e));var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",{fields:t,minLength:e,type:"fulltext"},{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"fulltext",value:function(t,e,n,o){var r=this;"function"==typeof n&&(o=n,n=void 0),n||(n={}),n.index&&(n.index=this._indexHandle(n.index));var i=this._connection.promisify(o),a=i.promise,s=i.callback;return this._api.put("/simple/fulltext",u({},n,{attribute:t,query:e,collection:this.name}),function(t,e){return t?s(t):s(null,new l.default(r._connection,e.body))}),a}}]),t}();p.prototype.isArangoCollection=!0;var h=function(t){function e(){var t;i(this,e);for(var n=arguments.length,r=Array(n),a=0;a=3?this._api.post("/document/"+this.name,t,e,function(t,e){return t?i(t):i(null,e.body)}):(e||(e={}),e.collection=this.name,this._api.post("/document",t,e,function(t,e){return t?i(t):i(null,e.body)})),r}}]),e}(p),y=function(t){function e(){var t;i(this,e);for(var n=arguments.length,r=Array(n),a=0;a1?(e=this._result.shift(),r=1,s()):this._more(function(t){t?u(t):(e=o._result.shift(),r=1,s())}),a}}]),t}();e.default=a},function(t,e,n){"use strict";e.decode=e.parse=n(16),e.encode=e.stringify=n(17)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=window.btoa},function(t,e,n){"use strict";function o(t){var e=r.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}t.exports=o;var r=Object.prototype.toString},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}var r=n(8),i=o(r),a=n(44),u=o(a);t.exports=function(){for(var t=arguments.length,e=Array(t),n=0;n=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e=400){if(t=(0,c.default)(n.statusCode),t.response=n,1===e&&500===n.statusCode&&g.retry(t))return;r(t)}else a&&(n.body=o),r(null,n)}})}),o}}]),t}();e.default=T,T.defaults={url:"http://localhost:8529",databaseName:"_system",arangoVersion:3e4,retryConnection:!1},T.agentDefaults={maxSockets:3,keepAlive:!0,keepAliveMsecs:1e3}},function(t,e,n){"use strict";function o(t){return Number(String(t).charAt(0)+"00")}function r(){for(var t,e,n=500,i={},a=0;a=600)&&c("non-error status code; use only 4xx or 5xx status codes"),("number"!=typeof n||!f[n]&&(n<400||n>=600))&&(n=500);var l=r[n]||r[o(n)];t||(t=l?new l(e):new Error(e||f[n]),Error.captureStackTrace(t,r)),l&&t instanceof l&&t.status===n||(t.expose=n<500,t.status=t.statusCode=n);for(var p in i)"status"!==p&&"statusCode"!==p&&(t[p]=i[p]);return t}function i(t,e,n){function o(t){var e=null!=t?t:f[n],i=new Error(e);return Error.captureStackTrace(i,o),l(i,o.prototype),Object.defineProperty(i,"message",{enumerable:!0,configurable:!0,value:e,writable:!0}),Object.defineProperty(i,"name",{enumerable:!1,configurable:!0,value:r,writable:!0}),i}var r=e.match(/Error$/)?e:e+"Error";return p(o,t),o.prototype.status=n,o.prototype.statusCode=n,o.prototype.expose=!0,o}function a(t,e,n){function o(t){var e=null!=t?t:f[n],i=new Error(e);return Error.captureStackTrace(i,o),l(i,o.prototype),Object.defineProperty(i,"message",{enumerable:!0,configurable:!0,value:e,writable:!0}),Object.defineProperty(i,"name",{enumerable:!1,configurable:!0,value:r,writable:!0}),i}var r=e.match(/Error$/)?e:e+"Error";return p(o,t),o.prototype.status=n,o.prototype.statusCode=n,o.prototype.expose=!1,o}function u(t){return t.split(" ").map(function(t){return t.slice(0,1).toUpperCase()+t.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=n(11)("http-errors"),l=n(12),f=n(13),p=n(15);t.exports=r,t.exports.HttpError=function(){function t(){throw new TypeError("cannot construct abstract class")}return p(t,Error),t}(),function(t,e,n){e.forEach(function(e){var r,s=u(f[e]);switch(o(e)){case 400:r=i(n,s,e);break;case 500:r=a(n,s,e)}r&&(t[e]=r,t[s]=r)}),t["I'mateapot"]=c.function(t.ImATeapot,'"I\'mateapot"; use "ImATeapot" instead')}(t.exports,f.codes,t.exports.HttpError)},function(t,e,n){"use strict";function o(t){function e(t){}if(!t)throw new TypeError("argument namespace is required");return e._file=void 0,e._ignored=!0,e._namespace=t,e._traced=!1,e._warned=Object.create(null),e.function=r,e.property=i,e}function r(t,e){if("function"!=typeof t)throw new TypeError("argument fn must be a function");return t}function i(t,e,n){if(!t||"object"!==(void 0===t?"undefined":a(t))&&"function"!=typeof t)throw new TypeError("argument obj must be object");var o=Object.getOwnPropertyDescriptor(t,e);if(!o)throw new TypeError("must call property on owner object");if(!o.configurable)throw new TypeError("property must be configurable")}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=o},function(t,e,n){"use strict";function o(t,e){return t.__proto__=e,t}function r(t,e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n]);return t}t.exports=Object.setPrototypeOf||({__proto__:[]}instanceof Array?o:r)},function(t,e,n){"use strict";function o(t){if("number"==typeof t){if(!o[t])throw new Error("invalid status code: "+t);return t}if("string"!=typeof t)throw new TypeError("code must be a number or string");var e=parseInt(t,10);if(!isNaN(e)){if(!o[e])throw new Error("invalid status code: "+e);return e}if(!(e=o[t.toLowerCase()]))throw new Error('invalid status message: "'+t+'"');return e}var r=n(14);t.exports=o,o.STATUS_CODES=r,o.codes=function(t,e){var n=[];return Object.keys(e).forEach(function(o){var r=e[o],i=Number(o);t[i]=r,t[r]=i,t[r.toLowerCase()]=i,n.push(i)}),n}(o,r),o.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},o.empty={204:!0,205:!0,304:!0},o.retry={502:!0,503:!0,504:!0}},function(t,e){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"(Unused)",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(t,e,n){"use strict";"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";function o(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,i){e=e||"&",n=n||"=";var a={};if("string"!=typeof t||0===t.length)return a;var u=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var c=t.length;s>0&&c>s&&(c=s);for(var l=0;l=0?(f=d.substr(0,m),p=d.substr(m+1)):(f=d,p=""),h=decodeURIComponent(f),y=decodeURIComponent(p),o(a,h)?r(a[h])?a[h].push(y):a[h]=[a[h],y]:a[h]=y}return a};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function o(t,e){if(t.map)return t.map(e);for(var n=[],o=0;o=l)){var t=s.shift();f+=1,t(function(){f-=1,n()})}}function o(t,o){var l=t.method,f=t.url,p=t.headers,h=t.body,y=t.expectBinary,d=r({},i,{pathname:f.pathname?i.pathname?(0,c.default)(i.pathname,f.pathname):f.pathname:i.pathname,search:f.search?i.search?i.search+"&"+f.search.slice(1):f.search:i.search});s.push(function(t){var n=function(e,r){n=function(){},t(),o(e,r)},i=(0,a.default)(r({responseType:y?"blob":"text"},e,{url:(0,u.format)(d),withCredentials:!0,useXDR:!0,body:h,method:l,headers:p}),function(t,e){t?(t.request=i,n(t)):n(null,e)})}),n()}e||(e={});var i=(0,u.parse)(t),s=[],l="number"==typeof e.maxSockets?2*e.maxSockets:1/0,f=0,p=i.auth;return delete i.auth,{request:o,auth:p,url:i}};var i=n(22),a=o(i),u=n(28),s=n(32),c=o(s);e.isBrowser=!0},function(t,e,n){"use strict";function o(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function r(t,e,n){var o=t;return l(e)?(n=e,"string"==typeof t&&(o={uri:t})):o=p(e,{uri:t}),o.callback=n,o}function i(t,e,n){return e=r(t,e,n),a(e)}function a(t){function e(){4===l.readyState&&setTimeout(a,0)}function n(){var t=void 0;if(t=l.response?l.response:l.responseText||u(l),g)try{t=JSON.parse(t)}catch(t){}return t}function r(t){return clearTimeout(y),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,c(t,k)}function a(){if(!h){var e;clearTimeout(y),e=t.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var o=k,r=null;return 0!==e?(o={body:n(),statusCode:e,method:m,headers:{},url:d,rawRequest:l},l.getAllResponseHeaders&&(o.headers=f(l.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),c(r,o,o.body)}}if(void 0===t.callback)throw new Error("callback argument missing");var s=!1,c=function(e,n,o){s||(s=!0,t.callback(e,n,o))},l=t.xhr||null;l||(l=t.cors||t.useXDR?new i.XDomainRequest:new i.XMLHttpRequest);var p,h,y,d=l.url=t.uri||t.url,m=l.method=t.method||"GET",v=t.body||t.data,b=l.headers=t.headers||{},_=!!t.sync,g=!1,k={body:void 0,headers:{},statusCode:0,method:m,url:d,rawRequest:l};if("json"in t&&!1!==t.json&&(g=!0,b.accept||b.Accept||(b.Accept="application/json"),"GET"!==m&&"HEAD"!==m&&(b["content-type"]||b["Content-Type"]||(b["Content-Type"]="application/json"),v=JSON.stringify(!0===t.json?v:t.json))),l.onreadystatechange=e,l.onload=a,l.onerror=r,l.onprogress=function(){},l.onabort=function(){h=!0},l.ontimeout=r,l.open(m,d,!_,t.username,t.password),_||(l.withCredentials=!!t.withCredentials),!_&&t.timeout>0&&(y=setTimeout(function(){if(!h){h=!0,l.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),l.setRequestHeader)for(p in b)b.hasOwnProperty(p)&&l.setRequestHeader(p,b[p]);else if(t.headers&&!o(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(l.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(l),l.send(v||null),l}function u(t){if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}function s(){}var c=n(23),l=n(5),f=n(24),p=n(27);t.exports=i,i.XMLHttpRequest=c.XMLHttpRequest||s,i.XDomainRequest="withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:c.XDomainRequest,function(t,e){for(var n=0;n",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(y),m=["'"].concat(d),v=["%","/","?",";","#"].concat(m),b=["/","?","#"],_=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,k={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},O=n(3);o.prototype.parse=function(t,e,n){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===t?"undefined":s(t)));var o=t.indexOf("?"),r=-1!==o&&o127?R+="x":R+=N[L];if(!R.match(_)){var D=A.slice(0,T),U=A.slice(T+1),H=N.match(g);H&&(D.push(H[1]),U.unshift(H[2])),U.length&&(u="/"+U.join(".")+u),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),q||(this.hostname=c.toASCII(this.hostname));var B=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+B,this.href+=this.host,q&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!k[d])for(var T=0,M=m.length;T0)&&n.host.split("@");j&&(n.auth=j.shift(),n.host=n.hostname=j.shift())}return n.search=t.search,n.query=t.query,l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!k.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=k.slice(-1)[0],T=(n.host||t.host||k.length>1)&&("."===S||".."===S)||""===S,E=0,P=k.length;P>=0;P--)S=k[P],"."===S?k.splice(P,1):".."===S?(k.splice(P,1),E++):E&&(k.splice(P,1),E--);if(!_&&!g)for(;E--;E)k.unshift("..");!_||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),T&&"/"!==k.join("/").substr(-1)&&k.push("");var C=""===k[0]||k[0]&&"/"===k[0].charAt(0);if(O){n.hostname=n.host=C?"":k.length?k.shift():"";var j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");j&&(n.auth=j.shift(),n.host=n.hostname=j.shift())}return _=_||n.host&&k.length,_&&!C&&k.unshift(""),k.length?n.pathname=k.join("/"):(n.pathname=null,n.path=null),l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=p.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){"use strict";(function(t,o){var r,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(a){function u(t){throw new RangeError(L[t])}function s(t,e){for(var n=t.length,o=[];n--;)o[n]=e(t[n]);return o}function c(t,e){var n=t.split("@"),o="";return n.length>1&&(o=n[0]+"@",t=n[1]),t=t.replace(R,"."),o+s(t.split("."),e).join(".")}function l(t){for(var e,n,o=[],r=0,i=t.length;r=55296&&e<=56319&&r65535&&(t-=65536,e+=U(t>>>10&1023|55296),t=56320|1023&t),e+=U(t)}).join("")}function p(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:j}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function y(t,e,n){var o=0;for(t=n?D(t/P):t>>1,t+=D(t/e);t>I*T>>1;o+=j)t=D(t/I);return D(o+(I+1)*t/(t+E))}function d(t){var e,n,o,r,i,a,s,c,l,h,d=[],m=t.length,v=0,b=q,_=C;for(n=t.lastIndexOf(A),n<0&&(n=0),o=0;o=128&&u("not-basic"),d.push(t.charCodeAt(o));for(r=n>0?n+1:0;r=m&&u("invalid-input"),c=p(t.charCodeAt(r++)),(c>=j||c>D((O-v)/a))&&u("overflow"),v+=c*a,l=s<=_?S:s>=_+T?T:s-_,!(cD(O/h)&&u("overflow"),a*=h;e=d.length+1,_=y(v-i,e,0==i),D(v/e)>O-b&&u("overflow"),b+=D(v/e),v%=e,d.splice(v++,0,b)}return f(d)}function m(t){var e,n,o,r,i,a,s,c,f,p,d,m,v,b,_,g=[];for(t=l(t),m=t.length,e=q,n=0,i=C,a=0;a=e&&dD((O-n)/v)&&u("overflow"),n+=(s-e)*v,e=s,a=0;aO&&u("overflow"),d==e){for(c=n,f=j;p=f<=i?S:f>=i+T?T:f-i,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=j-S,D=Math.floor,U=String.fromCharCode;if(w={version:"1.4.1",ucs2:{decode:l,encode:f},decode:d,encode:m,toASCII:b,toUnicode:v},"object"==i(n(6))&&n(6))void 0!==(r=function(){return w}.call(e,n,e,t))&&(t.exports=r);else if(_&&g)if(t.exports==_)g.exports=w;else for(x in w)w.hasOwnProperty(x)&&(_[x]=w[x]);else a.punycode=w}(void 0)}).call(e,n(30)(t),n(0))},function(t,e,n){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===(void 0===t?"undefined":o(t))&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(33),r=function(t){return t&&t.__esModule?t:{default:t}}(o),i=r.default.posix||r.default;e.default=i.join},function(t,e,n){"use strict";(function(t){function n(t,e){for(var n=0,o=t.length-1;o>=0;o--){var r=t[o];"."===r?t.splice(o,1):".."===r?(t.splice(o,1),n++):n&&(t.splice(o,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function o(t,e){if(t.filter)return t.filter(e);for(var n=[],o=0;o=-1&&!r;i--){var a=i>=0?arguments[i]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,r="/"===a.charAt(0))}return e=n(o(e.split("/"),function(t){return!!t}),!r).join("/"),(r?"/":"")+e||"."},e.normalize=function(t){var r=e.isAbsolute(t),i="/"===a(t,-1);return t=n(o(t.split("/"),function(t){return!!t}),!r).join("/"),t||r||(t="."),t&&i&&(t+="/"),(r?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(o(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function o(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var r=o(t.split("/")),i=o(n.split("/")),a=Math.min(r.length,i.length),u=a,s=0;s1)for(var n=1;n0&&void 0!==arguments[0]?arguments[0]:"";o(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.defineProperty(n,"message",{configurable:!0,enumerable:!1,value:t,writable:!0}),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:n.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?(Error.captureStackTrace(n,n.constructor),r(n)):(Object.defineProperty(n,"stack",{configurable:!0,enumerable:!1,value:new Error(t).stack,writable:!0}),n)}return i(e,t),e}(function(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Error));e.default=u,t.exports=e.default},function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;ee.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r=n&&(e=r,n=a)}return e}},function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.EdgeCollection=e.VertexCollection=void 0;var a=Object.assign||function(t){for(var e=1;e1?r-1:0),a=1;a=3&&(this.first=void 0,this.last=void 0,this.createCapConstraint=void 0)}return s(t,[{key:"_documentHandle",value:function(t){if("string"!=typeof t){if(t._id)return t._id;if(t._key)return this._idPrefix+t._key;throw new Error("Document handle must be a document or string")}return-1===t.indexOf("/")?this._idPrefix+t:t}},{key:"_indexHandle",value:function(t){if("string"!=typeof t){if(t.id)return t.id;throw new Error("Document handle must be a document or string")}return-1===t.indexOf("/")?this._idPrefix+t:t}},{key:"_get",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.get(this._urlPrefix+t,e,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"_put",value:function(t,e,n){var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.put(this._urlPrefix+t,e,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"get",value:function(t){var e=this._connection.promisify(t),n=e.promise,o=e.callback;return this._api.get("/collection/"+this.name,function(t,e){return t?o(t):o(null,e.body)}),n}},{key:"create",value:function(t,e){"function"==typeof t&&(e=t,t=void 0);var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.post("/collection",u({},t,{name:this.name,type:this.type}),function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"properties",value:function(t){return this._get("properties",t)}},{key:"count",value:function(t){return this._get("count",t)}},{key:"figures",value:function(t){return this._get("figures",t)}},{key:"revision",value:function(t){return this._get("revision",t)}},{key:"checksum",value:function(t,e){return this._get("checksum",t,e)}},{key:"load",value:function(t,e){return"function"==typeof t&&(e=t,t=void 0),this._put("load","boolean"==typeof t?{count:t}:void 0,e)}},{key:"unload",value:function(t){return this._put("unload",void 0,t)}},{key:"setProperties",value:function(t,e){return this._put("properties",t,e)}},{key:"rename",value:function(t,e){var n=this,o=this._connection.promisify(e),r=o.promise,i=o.callback;return this._api.put(this._urlPrefix+"rename",{name:t},function(e,o){e?i(e):(n.name=t,n._idPrefix=t+"/",n._urlPrefix="/collection/"+t+"/",i(null,o.body))}),r}},{key:"rotate",value:function(t){return this._put("rotate",void 0,t)}},{key:"truncate",value:function(t){return this._put("truncate",void 0,t)}},{key:"drop",value:function(t,e){"function"==typeof t&&(e=t,t=void 0);var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.delete("/collection/"+this.name,t,function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"replace",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0),"string"==typeof n&&(n={rev:n});var r=this._connection.promisify(o),i=r.promise,a=r.callback,u=n&&n.rev,s=u&&this._connection.arangoMajor>=3?{"if-match":u}:void 0;return this._api.put(this._documentPath(t),e,n,s,function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"update",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0),"string"==typeof n&&(n={rev:n});var r=this._connection.promisify(o),i=r.promise,a=r.callback,u=n&&n.rev,s=u&&this._connection.arangoMajor>=3?{"if-match":u}:void 0;return this._api.patch(this._documentPath(t),e,n,s,function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"bulkUpdate",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof e&&(e={rev:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.patch("/document/"+this.name,t,e,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"remove",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof e&&(e={rev:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback,a=e&&e.rev,u=a&&this._connection.arangoMajor>=3?{"if-match":a}:void 0;return this._api.delete(this._documentPath(t),e,u,function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"list",value:function(t,e){"function"==typeof t&&(e=t,t=void 0),t||(t="id");var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._connection.arangoMajor<3?this._api.get("/document",{type:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.documents)}):this._api.put("/simple/all-keys",{type:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.result)}),o}},{key:"all",value:function(t,e){var n=this;"function"==typeof t&&(e=t,t=void 0);var o=this._connection.promisify(e),r=o.promise,i=o.callback;return this._api.put("/simple/all",u({},t,{collection:this.name}),function(t,e){return t?i(t):i(null,new l.default(n._connection,e.body))}),r}},{key:"any",value:function(t){var e=this._connection.promisify(t),n=e.promise,o=e.callback;return this._api.put("/simple/any",{collection:this.name},function(t,e){return t?o(t):o(null,e.body.document)}),n}},{key:"first",value:function(t,e){"function"==typeof t&&(e=t,t=void 0),"number"==typeof t&&(t={count:t});var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/first",u({},t,{collection:this.name}),function(t,e){return t?r(t):r(null,e.body.result)}),o}},{key:"last",value:function(t,e){"function"==typeof t&&(e=t,t=void 0),"number"==typeof t&&(t={count:t});var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/last",u({},t,{collection:this.name}),function(t,e){return t?r(t):r(null,e.body.result)}),o}},{key:"byExample",value:function(t,e,n){var o=this;"function"==typeof e&&(n=e,e=void 0);var r=this._connection.promisify(n),i=r.promise,a=r.callback;return this._api.put("/simple/by-example",u({},e,{example:t,collection:this.name}),function(t,e){return t?a(t):a(null,new l.default(o._connection,e.body))}),i}},{key:"firstExample",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/first-example",{example:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.document)}),o}},{key:"removeByExample",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.put("/simple/remove-by-example",u({},e,{example:t,collection:this.name}),function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"replaceByExample",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0);var r=this._connection.promisify(o),i=r.promise,a=r.callback;return this._api.put("/simple/replace-by-example",u({},n,{example:t,newValue:e,collection:this.name}),function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"updateByExample",value:function(t,e,n,o){"function"==typeof n&&(o=n,n=void 0);var r=this._connection.promisify(o),i=r.promise,a=r.callback;return this._api.put("/simple/update-by-example",u({},n,{example:t,newValue:e,collection:this.name}),function(t,e){return t?a(t):a(null,e.body)}),i}},{key:"lookupByKeys",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.put("/simple/lookup-by-keys",{keys:t,collection:this.name},function(t,e){return t?r(t):r(null,e.body.documents)}),o}},{key:"removeByKeys",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.put("/simple/remove-by-keys",{options:e,keys:t,collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"import",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.request({method:"POST",path:"/import",body:t,ld:Boolean(!e||"array"!==e.type),qs:u({type:"auto"},e,{collection:this.name})},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"indexes",value:function(t){var e=this._connection.promisify(t),n=e.promise,o=e.callback;return this._api.get("/index",{collection:this.name},function(t,e){return t?o(t):o(null,e.body.indexes)}),n}},{key:"index",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.get("/index/"+this._indexHandle(t),function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"createIndex",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.post("/index",t,{collection:this.name},function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"dropIndex",value:function(t,e){var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.delete("/index/"+this._indexHandle(t),function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"createCapConstraint",value:function(t,e){"number"==typeof t&&(t={size:t});var n=this._connection.promisify(e),o=n.promise,r=n.callback;return this._api.post("/index",u({},t,{type:"cap"}),{collection:this.name},function(t,e){return t?r(t):r(null,e.body)}),o}},{key:"createHashIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),"boolean"==typeof e&&(e={unique:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({unique:!1},e,{type:"hash",fields:t}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createSkipList",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),"boolean"==typeof e&&(e={unique:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({unique:!1},e,{type:"skiplist",fields:t}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createPersistentIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),"boolean"==typeof e&&(e={unique:e});var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({unique:!1},e,{type:"persistent",fields:t}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createGeoIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]);var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",u({},e,{fields:t,type:"geo"}),{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"createFulltextIndex",value:function(t,e,n){"function"==typeof e&&(n=e,e=void 0),"string"==typeof t&&(t=[t]),e&&(e=Number(e));var o=this._connection.promisify(n),r=o.promise,i=o.callback;return this._api.post("/index",{fields:t,minLength:e,type:"fulltext"},{collection:this.name},function(t,e){return t?i(t):i(null,e.body)}),r}},{key:"fulltext",value:function(t,e,n,o){var r=this;"function"==typeof n&&(o=n,n=void 0),n||(n={}),n.index&&(n.index=this._indexHandle(n.index));var i=this._connection.promisify(o),a=i.promise,s=i.callback;return this._api.put("/simple/fulltext",u({},n,{attribute:t,query:e,collection:this.name}),function(t,e){return t?s(t):s(null,new l.default(r._connection,e.body))}),a}}]),t}();p.prototype.isArangoCollection=!0;var h=function(t){function e(){var t;i(this,e);for(var n=arguments.length,r=Array(n),a=0;a=3?this._api.post("/document/"+this.name,t,e,function(t,e){return t?i(t):i(null,e.body)}):(e||(e={}),e.collection=this.name,this._api.post("/document",t,e,function(t,e){return t?i(t):i(null,e.body)})),r}}]),e}(p),y=function(t){function e(){var t;i(this,e);for(var n=arguments.length,r=Array(n),a=0;a1?(e=this._result.shift(),r=1,s()):this._more(function(t){t?u(t):(e=o._result.shift(),r=1,s())}),a}}]),t}();e.default=a},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e,n){"use strict";e.decode=e.parse=n(15),e.encode=e.stringify=n(16)},function(t,e,n){"use strict";function o(t){var e=r.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}t.exports=o;var r=Object.prototype.toString},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=window.btoa},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}var r=n(8),i=o(r),a=n(44),u=o(a);t.exports=function(){for(var t=arguments.length,e=Array(t),n=0;n=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=Object.assign||function(t){for(var e=1;e=400){if(t=(0,_.default)(n.statusCode),t.response=n,1===e&&500===n.statusCode&&k.retry(t))return;r(t)}else a&&(n.body=o),r(null,n)}})}),o}}]),t}();e.default=T,T.defaults={url:"http://localhost:8529",databaseName:"_system",arangoVersion:3e4,retryConnection:!1},T.agentDefaults={maxSockets:3,keepAlive:!0,keepAliveMsecs:1e3}},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=void 0;var r=Object.assign||function(t){for(var e=1;e=l)){var t=s.shift();f+=1,t(function(){f-=1,n()})}}function o(t,o){var l=t.method,f=t.url,p=t.headers,h=t.body,y=t.expectBinary,d=r({},a,{pathname:f.pathname?a.pathname?(0,u.default)(a.pathname,f.pathname):f.pathname:a.pathname,search:f.search?a.search?a.search+"&"+f.search.slice(1):f.search:a.search});s.push(function(t){var n=function(e,r){n=function(){},t(),o(e,r)},a=(0,c.default)(r({responseType:y?"blob":"text"},e,{url:(0,i.format)(d),withCredentials:!0,useXDR:!0,body:h,method:l,headers:p}),function(t,e){t?(t.request=a,n(t)):n(null,e)})}),n()}e||(e={});var a=(0,i.parse)(t),s=[],l="number"==typeof e.maxSockets?2*e.maxSockets:1/0,f=0,p=a.auth;return delete a.auth,{request:o,auth:p,url:a}};var i=n(11),a=n(17),u=o(a),s=n(20),c=o(s);e.isBrowser=!0},function(t,e,n){"use strict";function o(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function r(t,e,n){if(t&&l.isObject(t)&&t instanceof o)return t;var r=new o;return r.parse(t,e,n),r}function i(t){return l.isString(t)&&(t=r(t)),t instanceof o?t.format():o.prototype.format.call(t)}function a(t,e){return r(t,!1,!0).resolve(e)}function u(t,e){return t?r(t,!1,!0).resolveObject(e):e}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=n(12),l=n(14);e.parse=r,e.resolve=a,e.resolveObject=u,e.format=i,e.Url=o;var f=/^([a-z0-9.+-]+:)/i,p=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,y=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(y),m=["'"].concat(d),v=["%","/","?",";","#"].concat(m),b=["/","?","#"],_=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,k={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},O=n(4);o.prototype.parse=function(t,e,n){if(!l.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===t?"undefined":s(t)));var o=t.indexOf("?"),r=-1!==o&&o127?R+="x":R+=N[L];if(!R.match(_)){var D=A.slice(0,T),U=A.slice(T+1),H=N.match(g);H&&(D.push(H[1]),U.unshift(H[2])),U.length&&(u="/"+U.join(".")+u),this.hostname=D.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),q||(this.hostname=c.toASCII(this.hostname));var B=this.port?":"+this.port:"",F=this.hostname||"";this.host=F+B,this.href+=this.host,q&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!k[d])for(var T=0,M=m.length;T0)&&n.host.split("@");j&&(n.auth=j.shift(),n.host=n.hostname=j.shift())}return n.search=t.search,n.query=t.query,l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!k.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=k.slice(-1)[0],T=(n.host||t.host||k.length>1)&&("."===S||".."===S)||""===S,E=0,P=k.length;P>=0;P--)S=k[P],"."===S?k.splice(P,1):".."===S?(k.splice(P,1),E++):E&&(k.splice(P,1),E--);if(!_&&!g)for(;E--;E)k.unshift("..");!_||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),T&&"/"!==k.join("/").substr(-1)&&k.push("");var C=""===k[0]||k[0]&&"/"===k[0].charAt(0);if(O){n.hostname=n.host=C?"":k.length?k.shift():"";var j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");j&&(n.auth=j.shift(),n.host=n.hostname=j.shift())}return _=_||n.host&&k.length,_&&!C&&k.unshift(""),k.length?n.pathname=k.join("/"):(n.pathname=null,n.path=null),l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var t=this.host,e=p.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){"use strict";(function(t,o){var r,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(a){function u(t){throw new RangeError(L[t])}function s(t,e){for(var n=t.length,o=[];n--;)o[n]=e(t[n]);return o}function c(t,e){var n=t.split("@"),o="";return n.length>1&&(o=n[0]+"@",t=n[1]),t=t.replace(R,"."),o+s(t.split("."),e).join(".")}function l(t){for(var e,n,o=[],r=0,i=t.length;r=55296&&e<=56319&&r65535&&(t-=65536,e+=U(t>>>10&1023|55296),t=56320|1023&t),e+=U(t)}).join("")}function p(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:j}function h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function y(t,e,n){var o=0;for(t=n?D(t/P):t>>1,t+=D(t/e);t>I*T>>1;o+=j)t=D(t/I);return D(o+(I+1)*t/(t+E))}function d(t){var e,n,o,r,i,a,s,c,l,h,d=[],m=t.length,v=0,b=q,_=C;for(n=t.lastIndexOf(A),n<0&&(n=0),o=0;o=128&&u("not-basic"),d.push(t.charCodeAt(o));for(r=n>0?n+1:0;r=m&&u("invalid-input"),c=p(t.charCodeAt(r++)),(c>=j||c>D((O-v)/a))&&u("overflow"),v+=c*a,l=s<=_?S:s>=_+T?T:s-_,!(cD(O/h)&&u("overflow"),a*=h;e=d.length+1,_=y(v-i,e,0==i),D(v/e)>O-b&&u("overflow"),b+=D(v/e),v%=e,d.splice(v++,0,b)}return f(d)}function m(t){var e,n,o,r,i,a,s,c,f,p,d,m,v,b,_,g=[];for(t=l(t),m=t.length,e=q,n=0,i=C,a=0;a=e&&dD((O-n)/v)&&u("overflow"),n+=(s-e)*v,e=s,a=0;aO&&u("overflow"),d==e){for(c=n,f=j;p=f<=i?S:f>=i+T?T:f-i,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=j-S,D=Math.floor,U=String.fromCharCode;if(w={version:"1.4.1",ucs2:{decode:l,encode:f},decode:d,encode:m,toASCII:b,toUnicode:v},"object"==i(n(3))&&n(3))void 0!==(r=function(){return w}.call(e,n,e,t))&&(t.exports=r);else if(_&&g)if(t.exports==_)g.exports=w;else for(x in w)w.hasOwnProperty(x)&&(_[x]=w[x]);else a.punycode=w}(void 0)}).call(e,n(13)(t),n(0))},function(t,e,n){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===(void 0===t?"undefined":o(t))&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,n){"use strict";function o(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,i){e=e||"&",n=n||"=";var a={};if("string"!=typeof t||0===t.length)return a;var u=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var c=t.length;s>0&&c>s&&(c=s);for(var l=0;l=0?(f=d.substr(0,m),p=d.substr(m+1)):(f=d,p=""),h=decodeURIComponent(f),y=decodeURIComponent(p),o(a,h)?r(a[h])?a[h].push(y):a[h]=[a[h],y]:a[h]=y}return a};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";function o(t,e){if(t.map)return t.map(e);for(var n=[],o=0;o=0;o--){var r=t[o];"."===r?t.splice(o,1):".."===r?(t.splice(o,1),n++):n&&(t.splice(o,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function o(t,e){if(t.filter)return t.filter(e);for(var n=[],o=0;o=-1&&!r;i--){var a=i>=0?arguments[i]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,r="/"===a.charAt(0))}return e=n(o(e.split("/"),function(t){return!!t}),!r).join("/"),(r?"/":"")+e||"."},e.normalize=function(t){var r=e.isAbsolute(t),i="/"===a(t,-1);return t=n(o(t.split("/"),function(t){return!!t}),!r).join("/"),t||r||(t="."),t&&i&&(t+="/"),(r?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(o(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function o(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var r=o(t.split("/")),i=o(n.split("/")),a=Math.min(r.length,i.length),u=a,s=0;s1)for(var n=1;n0&&(y=setTimeout(function(){if(!h){h=!0,l.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),l.setRequestHeader)for(p in b)b.hasOwnProperty(p)&&l.setRequestHeader(p,b[p]);else if(t.headers&&!o(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(l.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(l),l.send(v||null),l}function u(t){if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;return""!==t.responseType||e?null:t.responseXML}function s(){}var c=n(21),l=n(5),f=n(22),p=n(25);t.exports=i,i.XMLHttpRequest=c.XMLHttpRequest||s,i.XDomainRequest="withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:c.XDomainRequest,function(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"";o(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.defineProperty(n,"message",{configurable:!0,enumerable:!1,value:t,writable:!0}),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:n.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?(Error.captureStackTrace(n,n.constructor),r(n)):(Object.defineProperty(n,"stack",{configurable:!0,enumerable:!1,value:new Error(t).stack,writable:!0}),n)}return i(e,t),e}(function(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Error));e.default=u,t.exports=e.default},function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(t){for(var e=1;e=600)&&c("non-error status code; use only 4xx or 5xx status codes"),("number"!=typeof n||!f[n]&&(n<400||n>=600))&&(n=500);var l=r[n]||r[o(n)];t||(t=l?new l(e):new Error(e||f[n]),Error.captureStackTrace(t,r)),l&&t instanceof l&&t.status===n||(t.expose=n<500,t.status=t.statusCode=n);for(var p in i)"status"!==p&&"statusCode"!==p&&(t[p]=i[p]);return t}function i(t,e,n){function o(t){var e=null!=t?t:f[n],i=new Error(e);return Error.captureStackTrace(i,o),l(i,o.prototype),Object.defineProperty(i,"message",{enumerable:!0,configurable:!0,value:e,writable:!0}),Object.defineProperty(i,"name",{enumerable:!1,configurable:!0,value:r,writable:!0}),i}var r=e.match(/Error$/)?e:e+"Error";return p(o,t),o.prototype.status=n,o.prototype.statusCode=n,o.prototype.expose=!0,o}function a(t,e,n){function o(t){var e=null!=t?t:f[n],i=new Error(e);return Error.captureStackTrace(i,o),l(i,o.prototype),Object.defineProperty(i,"message",{enumerable:!0,configurable:!0,value:e,writable:!0}),Object.defineProperty(i,"name",{enumerable:!1,configurable:!0,value:r,writable:!0}),i}var r=e.match(/Error$/)?e:e+"Error";return p(o,t),o.prototype.status=n,o.prototype.statusCode=n,o.prototype.expose=!1,o}function u(t){return t.split(" ").map(function(t){return t.slice(0,1).toUpperCase()+t.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=n(32)("http-errors"),l=n(33),f=n(34),p=n(36);t.exports=r,t.exports.HttpError=function(){function t(){throw new TypeError("cannot construct abstract class")}return p(t,Error),t}(),function(t,e,n){e.forEach(function(e){var r,s=u(f[e]);switch(o(e)){case 400:r=i(n,s,e);break;case 500:r=a(n,s,e)}r&&(t[e]=r,t[s]=r)}),t["I'mateapot"]=c.function(t.ImATeapot,'"I\'mateapot"; use "ImATeapot" instead')}(t.exports,f.codes,t.exports.HttpError)},function(t,e,n){"use strict";function o(t){function e(t){}if(!t)throw new TypeError("argument namespace is required");return e._file=void 0,e._ignored=!0,e._namespace=t,e._traced=!1,e._warned=Object.create(null),e.function=r,e.property=i,e}function r(t,e){if("function"!=typeof t)throw new TypeError("argument fn must be a function");return t}function i(t,e,n){if(!t||"object"!==(void 0===t?"undefined":a(t))&&"function"!=typeof t)throw new TypeError("argument obj must be object");var o=Object.getOwnPropertyDescriptor(t,e);if(!o)throw new TypeError("must call property on owner object");if(!o.configurable)throw new TypeError("property must be configurable")}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=o},function(t,e,n){"use strict";function o(t,e){return t.__proto__=e,t}function r(t,e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n]);return t}t.exports=Object.setPrototypeOf||({__proto__:[]}instanceof Array?o:r)},function(t,e,n){"use strict";function o(t){if("number"==typeof t){if(!o[t])throw new Error("invalid status code: "+t);return t}if("string"!=typeof t)throw new TypeError("code must be a number or string");var e=parseInt(t,10);if(!isNaN(e)){if(!o[e])throw new Error("invalid status code: "+e);return e}if(!(e=o[t.toLowerCase()]))throw new Error('invalid status message: "'+t+'"');return e}var r=n(35);t.exports=o,o.STATUS_CODES=r,o.codes=function(t,e){var n=[];return Object.keys(e).forEach(function(o){var r=e[o],i=Number(o);t[i]=r,t[r]=i,t[r.toLowerCase()]=i,n.push(i)}),n}(o,r),o.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},o.empty={204:!0,205:!0,304:!0},o.retry={502:!0,503:!0,504:!0}},function(t,e){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"(Unused)",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},function(t,e,n){"use strict";"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";(function(t){function n(e){return!1===e?function(t){return{callback:t||o}}:function(n){var r=e||t.Promise;if(n||!r)return{callback:n||o};var i=void 0,a=new r(function(t,e){i=function(n,o){n?e(n):t(o)}});return{callback:i,promise:a}}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;var o=function(){}}).call(e,n(0))},function(t,e,n){"use strict";t.exports=n(39)},function(t,e,n){"use strict";var o=n(40);e.operation=function(t){var n=e.timeouts(t);return new o(n,{forever:t&&t.forever,unref:t&&t.unref})},e.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in t)e[n]=t[n];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],r=0;r=n&&(e=r,n=a)}return e}},function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.EdgeCollection=e.VertexCollection=void 0;var a=Object.assign||function(t){for(var e=1;e1?r-1:0),a=1;a= 3) { - this.first = undefined - this.last = undefined - this.createCapConstraint = undefined + this.first = undefined; + this.last = undefined; + this.createCapConstraint = undefined; } } - _documentHandle (documentHandle) { - if (typeof documentHandle !== 'string') { + _documentHandle(documentHandle) { + if (typeof documentHandle !== "string") { if (documentHandle._id) { - return documentHandle._id + return documentHandle._id; } if (documentHandle._key) { - return this._idPrefix + documentHandle._key + return this._idPrefix + documentHandle._key; } - throw new Error('Document handle must be a document or string') + throw new Error("Document handle must be a document or string"); } - if (documentHandle.indexOf('/') === -1) { - return this._idPrefix + documentHandle + if (documentHandle.indexOf("/") === -1) { + return this._idPrefix + documentHandle; } - return documentHandle + return documentHandle; } - _indexHandle (indexHandle) { - if (typeof indexHandle !== 'string') { + _indexHandle(indexHandle) { + if (typeof indexHandle !== "string") { if (indexHandle.id) { - return indexHandle.id + return indexHandle.id; } - throw new Error('Document handle must be a document or string') + throw new Error("Document handle must be a document or string"); } - if (indexHandle.indexOf('/') === -1) { - return this._idPrefix + indexHandle + if (indexHandle.indexOf("/") === -1) { + return this._idPrefix + indexHandle; } - return indexHandle + return indexHandle; } - _get (path, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + _get(path, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.get( this._urlPrefix + path, opts, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - _put (path, data, cb) { - const {promise, callback} = this._connection.promisify(cb) + _put(path, data, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.put( this._urlPrefix + path, data, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - get (cb) { - const {promise, callback} = this._connection.promisify(cb) + get(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( `/collection/${this.name}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - create (properties, cb) { - if (typeof properties === 'function') { - cb = properties - properties = undefined + create(properties, cb) { + if (typeof properties === "function") { + cb = properties; + properties = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/collection', - {...properties, name: this.name, type: this.type}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/collection", + { ...properties, name: this.name, type: this.type }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - properties (cb) { - return this._get('properties', cb) + properties(cb) { + return this._get("properties", cb); } - count (cb) { - return this._get('count', cb) + count(cb) { + return this._get("count", cb); } - figures (cb) { - return this._get('figures', cb) + figures(cb) { + return this._get("figures", cb); } - revision (cb) { - return this._get('revision', cb) + revision(cb) { + return this._get("revision", cb); } - checksum (opts, cb) { - return this._get('checksum', opts, cb) + checksum(opts, cb) { + return this._get("checksum", opts, cb); } - load (count, cb) { - if (typeof count === 'function') { - cb = count - count = undefined + load(count, cb) { + if (typeof count === "function") { + cb = count; + count = undefined; } - return this._put('load', ( - typeof count === 'boolean' ? {count: count} : undefined - ), cb) + return this._put( + "load", + typeof count === "boolean" ? { count: count } : undefined, + cb + ); } - unload (cb) { - return this._put('unload', undefined, cb) + unload(cb) { + return this._put("unload", undefined, cb); } - setProperties (properties, cb) { - return this._put('properties', properties, cb) + setProperties(properties, cb) { + return this._put("properties", properties, cb); } - rename (name, cb) { - const {promise, callback} = this._connection.promisify(cb) - this._api.put( - this._urlPrefix + 'rename', - {name}, - (err, res) => { - if (err) callback(err) - else { - this.name = name - this._idPrefix = `${name}/` - this._urlPrefix = `/collection/${name}/` - callback(null, res.body) - } + rename(name, cb) { + const { promise, callback } = this._connection.promisify(cb); + this._api.put(this._urlPrefix + "rename", { name }, (err, res) => { + if (err) callback(err); + else { + this.name = name; + this._idPrefix = `${name}/`; + this._urlPrefix = `/collection/${name}/`; + callback(null, res.body); } - ) - return promise + }); + return promise; } - rotate (cb) { - return this._put('rotate', undefined, cb) + rotate(cb) { + return this._put("rotate", undefined, cb); } - truncate (cb) { - return this._put('truncate', undefined, cb) + truncate(cb) { + return this._put("truncate", undefined, cb); } - drop (opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + drop(opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.delete( `/collection/${this.name}`, opts, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - replace (documentHandle, newValue, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + replace(documentHandle, newValue, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof opts === 'string') { - opts = {rev: opts} + if (typeof opts === "string") { + opts = { rev: opts }; } - const {promise, callback} = this._connection.promisify(cb) - const rev = opts && opts.rev - const headers = ( + const { promise, callback } = this._connection.promisify(cb); + const rev = opts && opts.rev; + const headers = rev && this._connection.arangoMajor >= 3 - ? {'if-match': rev} - : undefined - ) + ? { "if-match": rev } + : undefined; this._api.put( this._documentPath(documentHandle), newValue, opts, headers, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - update (documentHandle, newValue, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + update(documentHandle, newValue, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof opts === 'string') { - opts = {rev: opts} + if (typeof opts === "string") { + opts = { rev: opts }; } - const {promise, callback} = this._connection.promisify(cb) - const rev = opts && opts.rev - const headers = ( + const { promise, callback } = this._connection.promisify(cb); + const rev = opts && opts.rev; + const headers = rev && this._connection.arangoMajor >= 3 - ? {'if-match': rev} - : undefined - ) + ? { "if-match": rev } + : undefined; this._api.patch( this._documentPath(documentHandle), newValue, opts, headers, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - bulkUpdate (newValues, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + bulkUpdate(newValues, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof opts === 'string') { - opts = {rev: opts} + if (typeof opts === "string") { + opts = { rev: opts }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.patch( `/document/${this.name}`, newValues, opts, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - remove (documentHandle, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + remove(documentHandle, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof opts === 'string') { - opts = {rev: opts} + if (typeof opts === "string") { + opts = { rev: opts }; } - const {promise, callback} = this._connection.promisify(cb) - const rev = opts && opts.rev - const headers = ( + const { promise, callback } = this._connection.promisify(cb); + const rev = opts && opts.rev; + const headers = rev && this._connection.arangoMajor >= 3 - ? {'if-match': rev} - : undefined - ) + ? { "if-match": rev } + : undefined; this._api.delete( this._documentPath(documentHandle), opts, headers, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - list (type, cb) { - if (typeof type === 'function') { - cb = type - type = undefined + list(type, cb) { + if (typeof type === "function") { + cb = type; + type = undefined; } - if (!type) type = 'id' - const {promise, callback} = this._connection.promisify(cb) + if (!type) type = "id"; + const { promise, callback } = this._connection.promisify(cb); if (this._connection.arangoMajor < 3) { this._api.get( - '/document', - {type, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.documents) - ) + "/document", + { type, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.documents)) + ); } else { this._api.put( - '/simple/all-keys', - {type, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) + "/simple/all-keys", + { type, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); } - return promise + return promise; } - all (opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + all(opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/all', - {...opts, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, new ArrayCursor(this._connection, res.body)) - ) - return promise - } - - any (cb) { - const {promise, callback} = this._connection.promisify(cb) + "/simple/all", + { ...opts, collection: this.name }, + (err, res) => + err + ? callback(err) + : callback(null, new ArrayCursor(this._connection, res.body)) + ); + return promise; + } + + any(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/any', - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.document) - ) - return promise + "/simple/any", + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.document)) + ); + return promise; } - first (opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + first(opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof opts === 'number') { - opts = {count: opts} + if (typeof opts === "number") { + opts = { count: opts }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/first', - {...opts, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/simple/first", + { ...opts, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } - last (opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + last(opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof opts === 'number') { - opts = {count: opts} + if (typeof opts === "number") { + opts = { count: opts }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/last', - {...opts, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/simple/last", + { ...opts, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } - byExample (example, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + byExample(example, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/by-example', - {...opts, example, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, new ArrayCursor(this._connection, res.body)) - ) - return promise - } - - firstExample (example, cb) { - const {promise, callback} = this._connection.promisify(cb) + "/simple/by-example", + { ...opts, example, collection: this.name }, + (err, res) => + err + ? callback(err) + : callback(null, new ArrayCursor(this._connection, res.body)) + ); + return promise; + } + + firstExample(example, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/first-example', - {example, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.document) - ) - return promise + "/simple/first-example", + { example, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.document)) + ); + return promise; } - removeByExample (example, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + removeByExample(example, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/remove-by-example', - {...opts, example, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/simple/remove-by-example", + { ...opts, example, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - replaceByExample (example, newValue, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + replaceByExample(example, newValue, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/replace-by-example', - {...opts, example, newValue, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/simple/replace-by-example", + { ...opts, example, newValue, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - updateByExample (example, newValue, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + updateByExample(example, newValue, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/update-by-example', - {...opts, example, newValue, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/simple/update-by-example", + { ...opts, example, newValue, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - lookupByKeys (keys, cb) { - const {promise, callback} = this._connection.promisify(cb) + lookupByKeys(keys, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/lookup-by-keys', - {keys, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.documents) - ) - return promise + "/simple/lookup-by-keys", + { keys, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.documents)) + ); + return promise; } - removeByKeys (keys, options, cb) { - if (typeof options === 'function') { - cb = options - options = undefined + removeByKeys(keys, options, cb) { + if (typeof options === "function") { + cb = options; + options = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/remove-by-keys', - {options, keys, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/simple/remove-by-keys", + { options, keys, collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - import (data, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + import(data, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.request( { - method: 'POST', - path: '/import', + method: "POST", + path: "/import", body: data, - ld: Boolean(!opts || opts.type !== 'array'), - qs: {type: 'auto', ...opts, collection: this.name} + ld: Boolean(!opts || opts.type !== "array"), + qs: { type: "auto", ...opts, collection: this.name } }, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - indexes (cb) { - const {promise, callback} = this._connection.promisify(cb) + indexes(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/index', - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.indexes) - ) - return promise + "/index", + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.indexes)) + ); + return promise; } - index (indexHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + index(indexHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( `/index/${this._indexHandle(indexHandle)}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createIndex (details, cb) { - const {promise, callback} = this._connection.promisify(cb) + createIndex(details, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/index', + "/index", details, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - dropIndex (indexHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + dropIndex(indexHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.delete( `/index/${this._indexHandle(indexHandle)}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createCapConstraint (size, cb) { - if (typeof size === 'number') { - size = {size: size} + createCapConstraint(size, cb) { + if (typeof size === "number") { + size = { size: size }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/index', - {...size, type: 'cap'}, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/index", + { ...size, type: "cap" }, + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createHashIndex (fields, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + createHashIndex(fields, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof fields === 'string') { - fields = [fields] + if (typeof fields === "string") { + fields = [fields]; } - if (typeof opts === 'boolean') { - opts = {unique: opts} + if (typeof opts === "boolean") { + opts = { unique: opts }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/index', - {unique: false, ...opts, type: 'hash', fields: fields}, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/index", + { unique: false, ...opts, type: "hash", fields: fields }, + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createSkipList (fields, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + createSkipList(fields, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof fields === 'string') { - fields = [fields] + if (typeof fields === "string") { + fields = [fields]; } - if (typeof opts === 'boolean') { - opts = {unique: opts} + if (typeof opts === "boolean") { + opts = { unique: opts }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/index', - {unique: false, ...opts, type: 'skiplist', fields: fields}, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/index", + { unique: false, ...opts, type: "skiplist", fields: fields }, + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createPersistentIndex (fields, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + createPersistentIndex(fields, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof fields === 'string') { - fields = [fields] + if (typeof fields === "string") { + fields = [fields]; } - if (typeof opts === 'boolean') { - opts = {unique: opts} + if (typeof opts === "boolean") { + opts = { unique: opts }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/index', - {unique: false, ...opts, type: 'persistent', fields: fields}, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/index", + { unique: false, ...opts, type: "persistent", fields: fields }, + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createGeoIndex (fields, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + createGeoIndex(fields, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof fields === 'string') { - fields = [fields] + if (typeof fields === "string") { + fields = [fields]; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/index', - {...opts, fields, type: 'geo'}, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/index", + { ...opts, fields, type: "geo" }, + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createFulltextIndex (fields, minLength, cb) { - if (typeof minLength === 'function') { - cb = minLength - minLength = undefined + createFulltextIndex(fields, minLength, cb) { + if (typeof minLength === "function") { + cb = minLength; + minLength = undefined; } - if (typeof fields === 'string') { - fields = [fields] + if (typeof fields === "string") { + fields = [fields]; } - if (minLength) minLength = Number(minLength) - const {promise, callback} = this._connection.promisify(cb) + if (minLength) minLength = Number(minLength); + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/index', - {fields, minLength, type: 'fulltext'}, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise - } - - fulltext (attribute, query, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined - } - if (!opts) opts = {} - if (opts.index) opts.index = this._indexHandle(opts.index) - const {promise, callback} = this._connection.promisify(cb) + "/index", + { fields, minLength, type: "fulltext" }, + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; + } + + fulltext(attribute, query, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; + } + if (!opts) opts = {}; + if (opts.index) opts.index = this._indexHandle(opts.index); + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/simple/fulltext', - {...opts, attribute, query, collection: this.name}, - (err, res) => err ? callback(err) : callback(null, new ArrayCursor(this._connection, res.body)) - ) - return promise + "/simple/fulltext", + { ...opts, attribute, query, collection: this.name }, + (err, res) => + err + ? callback(err) + : callback(null, new ArrayCursor(this._connection, res.body)) + ); + return promise; } } -BaseCollection.prototype.isArangoCollection = true +BaseCollection.prototype.isArangoCollection = true; class DocumentCollection extends BaseCollection { - constructor (...args) { - super(...args) - this.type = types.DOCUMENT_COLLECTION + constructor(...args) { + super(...args); + this.type = types.DOCUMENT_COLLECTION; } - _documentPath (documentHandle) { - return `/document/${this._documentHandle(documentHandle)}` + _documentPath(documentHandle) { + return `/document/${this._documentHandle(documentHandle)}`; } - document (documentHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + document(documentHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( this._documentPath(documentHandle), - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - save (data, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + save(data, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof opts === 'boolean') { - opts = {returnNew: opts} + if (typeof opts === "boolean") { + opts = { returnNew: opts }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); if (this._connection.arangoMajor >= 3) { this._api.post( `/document/${this.name}`, data, opts, - (err, res) => err ? callback(err) : callback(null, res.body) - ) + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); } else { - if (!opts) opts = {} - opts.collection = this.name + if (!opts) opts = {}; + opts.collection = this.name; this._api.post( `/document`, data, opts, - (err, res) => err ? callback(err) : callback(null, res.body) - ) + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); } - return promise + return promise; } } class EdgeCollection extends BaseCollection { - constructor (...args) { - super(...args) - this.type = types.EDGE_COLLECTION + constructor(...args) { + super(...args); + this.type = types.EDGE_COLLECTION; } - _documentPath (documentHandle) { + _documentPath(documentHandle) { if (this._connection.arangoMajor < 3) { - return `edge/${this._documentHandle(documentHandle)}` + return `edge/${this._documentHandle(documentHandle)}`; } - return `document/${this._documentHandle(documentHandle)}` + return `document/${this._documentHandle(documentHandle)}`; } - edge (documentHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + edge(documentHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( this._documentPath(documentHandle), - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - save (data, fromId, toId, cb) { - if (typeof fromId === 'function') { - cb = fromId - fromId = undefined + save(data, fromId, toId, cb) { + if (typeof fromId === "function") { + cb = fromId; + fromId = undefined; } else if (fromId) { - data._from = this._documentHandle(fromId) - data._to = this._documentHandle(toId) + data._from = this._documentHandle(fromId); + data._to = this._documentHandle(toId); } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); if (this._connection.arangoMajor < 3) { this._api.post( - '/edge', + "/edge", data, { collection: this.name, from: data._from, to: data._to }, - (err, res) => err ? callback(err) : callback(null, res.body) - ) + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); } else { this._api.post( - '/document', + "/document", data, - {collection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) + { collection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); } - return promise + return promise; } - _edges (documentHandle, direction, cb) { - const {promise, callback} = this._connection.promisify(cb) + _edges(documentHandle, direction, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( `/edges/${this.name}`, - {direction, vertex: this._documentHandle(documentHandle)}, - (err, res) => err ? callback(err) : callback(null, res.body.edges) - ) - return promise + { direction, vertex: this._documentHandle(documentHandle) }, + (err, res) => (err ? callback(err) : callback(null, res.body.edges)) + ); + return promise; } - edges (vertex, cb) { - return this._edges(vertex, undefined, cb) + edges(vertex, cb) { + return this._edges(vertex, undefined, cb); } - inEdges (vertex, cb) { - return this._edges(vertex, 'in', cb) + inEdges(vertex, cb) { + return this._edges(vertex, "in", cb); } - outEdges (vertex, cb) { - return this._edges(vertex, 'out', cb) + outEdges(vertex, cb) { + return this._edges(vertex, "out", cb); } - traversal (startVertex, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + traversal(startVertex, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/traversal', - {...opts, startVertex, edgeCollection: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/traversal", + { ...opts, startVertex, edgeCollection: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } } -export default function construct (connection, body) { - const Collection = ( - body.type === types.EDGE_COLLECTION - ? EdgeCollection - : DocumentCollection - ) - return new Collection(connection, body.name) +export default function construct(connection, body) { + const Collection = + body.type === types.EDGE_COLLECTION ? EdgeCollection : DocumentCollection; + return new Collection(connection, body.name); } export { @@ -783,4 +784,4 @@ export { DocumentCollection, BaseCollection as _BaseCollection, types as _types -} +}; diff --git a/src/connection.js b/src/connection.js index 1d0290168..13dc3aff7 100644 --- a/src/connection.js +++ b/src/connection.js @@ -1,168 +1,185 @@ -import httperr from 'http-errors' -import qs from 'querystring' -import btoa from './util/btoa' -import byteLength from './util/bytelength' -import promisify from './util/promisify' -import createRequest, {isBrowser} from './util/request' -import ArangoError from './error' -import Route from './route' -import retry from 'retry' +import createRequest, { isBrowser } from "./util/request"; -const MIME_JSON = /\/(json|javascript)(\W|$)/ +import ArangoError from "./error"; +import Route from "./route"; +import btoa from "./util/btoa"; +import byteLength from "./util/bytelength"; +import httperr from "http-errors"; +import promisify from "./util/promisify"; +import qs from "querystring"; +import retry from "retry"; + +const MIME_JSON = /\/(json|javascript)(\W|$)/; export default class Connection { - constructor (config) { - if (typeof config === 'string') { - config = {url: config} + constructor(config) { + if (typeof config === "string") { + config = { url: config }; } - this.config = {...Connection.defaults, ...config} - this.config.agentOptions = {...Connection.agentDefaults, ...this.config.agentOptions} - if (!this.config.headers) this.config.headers = {} - if (!this.config.headers['x-arango-version']) { - this.config.headers['x-arango-version'] = this.config.arangoVersion + this.config = { ...Connection.defaults, ...config }; + this.config.agentOptions = { + ...Connection.agentDefaults, + ...this.config.agentOptions + }; + if (!this.config.headers) this.config.headers = {}; + if (!this.config.headers["x-arango-version"]) { + this.config.headers["x-arango-version"] = this.config.arangoVersion; } - this.arangoMajor = Math.floor(this.config.arangoVersion / 10000) - const {request, auth, url} = createRequest( + this.arangoMajor = Math.floor(this.config.arangoVersion / 10000); + const { request, auth, url } = createRequest( this.config.url, this.config.agentOptions, this.config.agent - ) - this._baseUrl = url - this._request = request - if (auth && !this.config.headers['authorization']) { - this.config.headers['authorization'] = `Basic ${btoa(auth)}` + ); + this._baseUrl = url; + this._request = request; + if (auth && !this.config.headers["authorization"]) { + this.config.headers["authorization"] = `Basic ${btoa(auth)}`; } if (this.config.databaseName === false) { - this._databasePath = '' + this._databasePath = ""; } else { - this._databasePath = `/_db/${this.config.databaseName}` + this._databasePath = `/_db/${this.config.databaseName}`; } - this.promisify = promisify(this.config.promise) + this.promisify = promisify(this.config.promise); this.retryOptions = { forever: this.config.retryConnection, retries: 0, minTimeout: 5000, randomize: true - } + }; } - _buildUrl (opts) { - let pathname = '' - let search + _buildUrl(opts) { + let pathname = ""; + let search; if (!opts.absolutePath) { - pathname = this._databasePath - if (opts.basePath) pathname += opts.basePath + pathname = this._databasePath; + if (opts.basePath) pathname += opts.basePath; } - if (opts.path) pathname += opts.path + if (opts.path) pathname += opts.path; if (opts.qs) { - if (typeof opts.qs === 'string') search = `?${opts.qs}` - else search = `?${qs.stringify(opts.qs)}` + if (typeof opts.qs === "string") search = `?${opts.qs}`; + else search = `?${qs.stringify(opts.qs)}`; } - return search ? {pathname, search} : {pathname} + return search ? { pathname, search } : { pathname }; } - route (path, headers) { - return new Route(this, path, headers) + route(path, headers) { + return new Route(this, path, headers); } - request (opts, cb) { - const {promise, callback} = this.promisify(cb) - const expectBinary = opts.expectBinary || false - let contentType = 'text/plain' - let body = opts.body + request(opts, cb) { + const { promise, callback } = this.promisify(cb); + const expectBinary = opts.expectBinary || false; + let contentType = "text/plain"; + let body = opts.body; if (body) { - if (typeof body === 'object') { + if (typeof body === "object") { if (opts.ld) { - body = body.map((obj) => JSON.stringify(obj)).join('\r\n') + '\r\n' - contentType = 'application/x-ldjson' + body = body.map(obj => JSON.stringify(obj)).join("\r\n") + "\r\n"; + contentType = "application/x-ldjson"; } else { - body = JSON.stringify(body) - contentType = 'application/json' + body = JSON.stringify(body); + contentType = "application/json"; } } else { - body = String(body) + body = String(body); } } else { - body = opts.rawBody + body = opts.rawBody; } - if (!opts.headers.hasOwnProperty('content-type')) { - opts.headers['content-type'] = contentType + if (!opts.headers.hasOwnProperty("content-type")) { + opts.headers["content-type"] = contentType; } - if (!isBrowser && !opts.headers.hasOwnProperty('content-length')) { + if (!isBrowser && !opts.headers.hasOwnProperty("content-length")) { // Can't override content-length in browser but ArangoDB needs it to be set - opts.headers['content-length'] = body ? byteLength(body, 'utf-8') : 0 + opts.headers["content-length"] = body ? byteLength(body, "utf-8") : 0; } for (const key of Object.keys(this.config.headers)) { if (!opts.headers.hasOwnProperty(key)) { - opts.headers[key] = this.config.headers[key] + opts.headers[key] = this.config.headers[key]; } } - const url = this._buildUrl(opts) - const doRequest = this._request - const operation = retry.operation(this.retryOptions) - operation.attempt(function (currentAttempt) { - doRequest({ - url, - headers: opts.headers, - method: opts.method, - expectBinary, - body - }, (err, res) => { - if (operation.retry(err)) return - if (err) callback(err) - else { - const rawBody = res.body - if (res.headers['content-type'].match(MIME_JSON)) { - try { - if (expectBinary) res.body = res.body.toString('utf-8') - res.body = res.body ? JSON.parse(res.body) : undefined - } catch (e) { - res.body = rawBody - e.response = res - return callback(e) + const url = this._buildUrl(opts); + const doRequest = this._request; + const operation = retry.operation(this.retryOptions); + operation.attempt(function(currentAttempt) { + doRequest( + { + url, + headers: opts.headers, + method: opts.method, + expectBinary, + body + }, + (err, res) => { + if (operation.retry(err)) return; + if (err) callback(err); + else { + const rawBody = res.body; + if (res.headers["content-type"].match(MIME_JSON)) { + try { + if (expectBinary) res.body = res.body.toString("utf-8"); + res.body = res.body ? JSON.parse(res.body) : undefined; + } catch (e) { + res.body = rawBody; + e.response = res; + return callback(e); + } + } + if ( + res.body && + res.body.error && + res.body.hasOwnProperty("code") && + res.body.hasOwnProperty("errorMessage") && + res.body.hasOwnProperty("errorNum") + ) { + err = new ArangoError(res.body); + err.response = res; + if ( + currentAttempt === 1 && + err.errorNum === 21 && + operation.retry(err) + ) + return; + callback(err); + } else if (res.statusCode >= 400) { + err = httperr(res.statusCode); + err.response = res; + if ( + currentAttempt === 1 && + res.statusCode === 500 && + operation.retry(err) + ) + return; + callback(err); + } else { + if (expectBinary) res.body = rawBody; + callback(null, res); } - } - if ( - res.body && - res.body.error && - res.body.hasOwnProperty('code') && - res.body.hasOwnProperty('errorMessage') && - res.body.hasOwnProperty('errorNum') - ) { - err = new ArangoError(res.body) - err.response = res - if (currentAttempt === 1 && err.errorNum === 21 && operation.retry(err)) return - callback(err) - } else if (res.statusCode >= 400) { - err = httperr(res.statusCode) - err.response = res - if (currentAttempt === 1 && res.statusCode === 500 && operation.retry(err)) return - callback(err) - } else { - if (expectBinary) res.body = rawBody - callback(null, res) } } - }) - }) - return promise + ); + }); + return promise; } } Connection.defaults = { - url: 'http://localhost:8529', - databaseName: '_system', + url: "http://localhost:8529", + databaseName: "_system", arangoVersion: 30000, retryConnection: false -} +}; Connection.agentDefaults = { maxSockets: 3, keepAlive: true, keepAliveMsecs: 1000 -} +}; diff --git a/src/cursor.js b/src/cursor.js index 3b8f73d9f..18ae23527 100644 --- a/src/cursor.js +++ b/src/cursor.js @@ -1,204 +1,200 @@ export default class ArrayCursor { - constructor (connection, body) { - this.extra = body.extra - this._connection = connection - this._api = this._connection.route('/_api') - this._result = body.result - this._hasMore = Boolean(body.hasMore) - this._id = body.id - this.count = body.count + constructor(connection, body) { + this.extra = body.extra; + this._connection = connection; + this._api = this._connection.route("/_api"); + this._result = body.result; + this._hasMore = Boolean(body.hasMore); + this._id = body.id; + this.count = body.count; } - _drain (cb) { - const {promise, callback} = this._connection.promisify(cb) - this._more((err) => ( - err ? callback(err) : ( - !this._hasMore - ? callback(null, this) - : this._drain(cb) - ) - )) - return promise + _drain(cb) { + const { promise, callback } = this._connection.promisify(cb); + this._more( + err => + err + ? callback(err) + : !this._hasMore ? callback(null, this) : this._drain(cb) + ); + return promise; } - _more (callback) { - if (!this._hasMore) callback(null, this) + _more(callback) { + if (!this._hasMore) callback(null, this); else { - this._api.put( - `/cursor/${this._id}`, - (err, res) => { - if (err) callback(err) - else { - this._result.push(...res.body.result) - this._hasMore = res.body.hasMore - callback(null, this) - } + this._api.put(`/cursor/${this._id}`, (err, res) => { + if (err) callback(err); + else { + this._result.push(...res.body.result); + this._hasMore = res.body.hasMore; + callback(null, this); } - ) + }); } } - all (cb) { - const {promise, callback} = this._connection.promisify(cb) - this._drain((err) => { - if (err) callback(err) + all(cb) { + const { promise, callback } = this._connection.promisify(cb); + this._drain(err => { + if (err) callback(err); else { - let result = this._result - this._result = [] - callback(null, result) + let result = this._result; + this._result = []; + callback(null, result); } - }) - return promise + }); + return promise; } - next (cb) { - const {promise, callback} = this._connection.promisify(cb) + next(cb) { + const { promise, callback } = this._connection.promisify(cb); const next = () => { - const value = this._result.shift() - callback(null, value) - } - if (this._result.length) next() + const value = this._result.shift(); + callback(null, value); + }; + if (this._result.length) next(); else { - if (!this._hasMore) callback(null) + if (!this._hasMore) callback(null); else { - this._more((err) => err ? callback(err) : next()) + this._more(err => (err ? callback(err) : next())); } } - return promise + return promise; } - hasNext () { - return Boolean(this._hasMore || this._result.length) + hasNext() { + return Boolean(this._hasMore || this._result.length); } - each (fn, cb) { - const {promise, callback} = this._connection.promisify(cb) - let index = 0 + each(fn, cb) { + const { promise, callback } = this._connection.promisify(cb); + let index = 0; const loop = () => { try { - let result + let result; while (this._result.length) { - result = fn(this._result.shift(), index, this) - index++ - if (result === false) break + result = fn(this._result.shift(), index, this); + index++; + if (result === false) break; } - if (!this._hasMore || result === false) callback(null, result) + if (!this._hasMore || result === false) callback(null, result); else { - this._more((err) => err ? callback(err) : loop()) + this._more(err => (err ? callback(err) : loop())); } } catch (e) { - callback(e) + callback(e); } - } - loop() - return promise + }; + loop(); + return promise; } - every (fn, cb) { - const {promise, callback} = this._connection.promisify(cb) - let index = 0 + every(fn, cb) { + const { promise, callback } = this._connection.promisify(cb); + let index = 0; const loop = () => { try { - let result = true + let result = true; while (this._result.length) { - result = fn(this._result.shift(), index, this) - index++ - if (!result) break + result = fn(this._result.shift(), index, this); + index++; + if (!result) break; } - if (!this._hasMore || !result) callback(null, Boolean(result)) + if (!this._hasMore || !result) callback(null, Boolean(result)); else { - this._more((err) => err ? callback(err) : loop()) + this._more(err => (err ? callback(err) : loop())); } } catch (e) { - callback(e) + callback(e); } - } - loop() - return promise + }; + loop(); + return promise; } - some (fn, cb) { - const {promise, callback} = this._connection.promisify(cb) - let index = 0 + some(fn, cb) { + const { promise, callback } = this._connection.promisify(cb); + let index = 0; const loop = () => { try { - let result = false + let result = false; while (this._result.length) { - result = fn(this._result.shift(), index, this) - index++ - if (result) break + result = fn(this._result.shift(), index, this); + index++; + if (result) break; } - if (!this._hasMore || result) callback(null, Boolean(result)) + if (!this._hasMore || result) callback(null, Boolean(result)); else { - this._more((err) => err ? callback(err) : loop()) + this._more(err => (err ? callback(err) : loop())); } } catch (e) { - callback(e) + callback(e); } - } - loop() - return promise + }; + loop(); + return promise; } - map (fn, cb) { - const {promise, callback} = this._connection.promisify(cb) - let index = 0 - const result = [] + map(fn, cb) { + const { promise, callback } = this._connection.promisify(cb); + let index = 0; + const result = []; const loop = () => { try { while (this._result.length) { - result.push(fn(this._result.shift(), index, this)) - index++ + result.push(fn(this._result.shift(), index, this)); + index++; } - if (!this._hasMore) callback(null, result) + if (!this._hasMore) callback(null, result); else { - this._more((err) => err ? callback(err) : loop()) + this._more(err => (err ? callback(err) : loop())); } } catch (e) { - callback(e) + callback(e); } - } - loop() - return promise + }; + loop(); + return promise; } - reduce (fn, accu, cb) { - if (typeof accu === 'function') { - cb = accu - accu = undefined + reduce(fn, accu, cb) { + if (typeof accu === "function") { + cb = accu; + accu = undefined; } - let index = 0 - const {promise, callback} = this._connection.promisify(cb) + let index = 0; + const { promise, callback } = this._connection.promisify(cb); const loop = () => { try { while (this._result.length) { - accu = fn(accu, this._result.shift(), index, this) - index++ + accu = fn(accu, this._result.shift(), index, this); + index++; } - if (!this._hasMore) callback(null, accu) + if (!this._hasMore) callback(null, accu); else { - this._more((err) => err ? callback(err) : loop()) + this._more(err => (err ? callback(err) : loop())); } } catch (e) { - callback(e) + callback(e); } - } + }; if (accu !== undefined) { - loop() + loop(); } else if (this._result.length > 1) { - accu = this._result.shift() - index = 1 - loop() + accu = this._result.shift(); + index = 1; + loop(); } else { - this._more((err) => { - if (err) callback(err) + this._more(err => { + if (err) callback(err); else { - accu = this._result.shift() - index = 1 - loop() + accu = this._result.shift(); + index = 1; + loop(); } - }) + }); } - return promise + return promise; } } diff --git a/src/database.js b/src/database.js index 3c4377b4b..53cf8ede8 100644 --- a/src/database.js +++ b/src/database.js @@ -1,419 +1,450 @@ import constructCollection, { DocumentCollection, EdgeCollection -} from './collection' +} from "./collection"; -import ArrayCursor from './cursor' -import Connection from './connection' -import Graph from './graph' -import all from './util/all' -import btoa from './util/btoa' -import toForm from './util/multipart' +import ArrayCursor from "./cursor"; +import Connection from "./connection"; +import Graph from "./graph"; +import all from "./util/all"; +import btoa from "./util/btoa"; +import toForm from "./util/multipart"; export default class Database { - constructor (config) { - this._connection = new Connection(config) - this._api = this._connection.route('/_api') - this.name = this._connection.config.databaseName + constructor(config) { + this._connection = new Connection(config); + this._api = this._connection.route("/_api"); + this.name = this._connection.config.databaseName; } - route (path, headers) { - return this._connection.route(path, headers) + route(path, headers) { + return this._connection.route(path, headers); } // Database manipulation - useDatabase (databaseName) { + useDatabase(databaseName) { if (this._connection.config.databaseName === false) { - throw new Error('Can not change database from absolute URL') + throw new Error("Can not change database from absolute URL"); } - this._connection.config.databaseName = databaseName - this._connection._databasePath = `/_db/${databaseName}` - this.name = databaseName - return this + this._connection.config.databaseName = databaseName; + this._connection._databasePath = `/_db/${databaseName}`; + this.name = databaseName; + return this; } - useBearerAuth (token) { - this._connection.config.headers['authorization'] = `Bearer ${token}` - return this + useBearerAuth(token) { + this._connection.config.headers["authorization"] = `Bearer ${token}`; + return this; } - useBasicAuth (username, password) { - this._connection.config.headers['authorization'] = `Basic ${btoa(`${username || 'root'}:${password || ''}`)}` - return this + useBasicAuth(username, password) { + this._connection.config.headers["authorization"] = `Basic ${btoa( + `${username || "root"}:${password || ""}` + )}`; + return this; } - get (cb) { - const {promise, callback} = this._connection.promisify(cb) + get(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/database/current', - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/database/current", + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } - createDatabase (databaseName, users, cb) { - if (typeof users === 'function') { - cb = users - users = undefined + createDatabase(databaseName, users, cb) { + if (typeof users === "function") { + cb = users; + users = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/database', - {users, name: databaseName}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/database", + { users, name: databaseName }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - listDatabases (cb) { - const {promise, callback} = this._connection.promisify(cb) + listDatabases(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/database', - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/database", + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } - listUserDatabases (cb) { - const {promise, callback} = this._connection.promisify(cb) + listUserDatabases(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/database/user', - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/database/user", + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } - dropDatabase (databaseName, cb) { - const {promise, callback} = this._connection.promisify(cb) + dropDatabase(databaseName, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.delete( `/database/${databaseName}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } // Collection manipulation - collection (collectionName) { - return new DocumentCollection(this._connection, collectionName) + collection(collectionName) { + return new DocumentCollection(this._connection, collectionName); } - edgeCollection (collectionName) { - return new EdgeCollection(this._connection, collectionName) + edgeCollection(collectionName) { + return new EdgeCollection(this._connection, collectionName); } - listCollections (excludeSystem, cb) { - if (typeof excludeSystem === 'function') { - cb = excludeSystem - excludeSystem = undefined + listCollections(excludeSystem, cb) { + if (typeof excludeSystem === "function") { + cb = excludeSystem; + excludeSystem = undefined; } - const {promise, callback} = this._connection.promisify(cb) - if (typeof excludeSystem !== 'boolean') excludeSystem = true - const resultField = ( - this._connection.arangoMajor < 3 - ? 'collections' - : 'result' - ) + const { promise, callback } = this._connection.promisify(cb); + if (typeof excludeSystem !== "boolean") excludeSystem = true; + const resultField = + this._connection.arangoMajor < 3 ? "collections" : "result"; this._api.get( - '/collection', - {excludeSystem}, - (err, res) => err ? callback(err) : callback(null, res.body[resultField]) - ) - return promise + "/collection", + { excludeSystem }, + (err, res) => + err ? callback(err) : callback(null, res.body[resultField]) + ); + return promise; } - collections (excludeSystem, cb) { - if (typeof excludeSystem === 'function') { - cb = excludeSystem - excludeSystem = undefined + collections(excludeSystem, cb) { + if (typeof excludeSystem === "function") { + cb = excludeSystem; + excludeSystem = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this.listCollections( excludeSystem, - (err, collections) => ( + (err, collections) => err - ? callback(err) - : callback(null, collections.map((info) => constructCollection(this._connection, info))) - ) - ) - return promise - } - - truncate (excludeSystem, cb) { - if (typeof excludeSystem === 'function') { - cb = excludeSystem - } - const {promise, callback} = this._connection.promisify(cb) + ? callback(err) + : callback( + null, + collections.map(info => + constructCollection(this._connection, info) + ) + ) + ); + return promise; + } + + truncate(excludeSystem, cb) { + if (typeof excludeSystem === "function") { + cb = excludeSystem; + } + const { promise, callback } = this._connection.promisify(cb); this.listCollections( true, - (err, collections) => ( + (err, collections) => err - ? callback(err) - : all(collections.map((data) => (cb) => this._api.put( - `/collection/${data.name}/truncate`, - (err, res) => err ? cb(err) : cb(null, res.body) - )), callback) - ) - ) - return promise + ? callback(err) + : all( + collections.map(data => cb => + this._api.put( + `/collection/${data.name}/truncate`, + (err, res) => (err ? cb(err) : cb(null, res.body)) + ) + ), + callback + ) + ); + return promise; } // Graph manipulation - graph (graphName) { - return new Graph(this._connection, graphName) + graph(graphName) { + return new Graph(this._connection, graphName); } - listGraphs (cb) { - const {promise, callback} = this._connection.promisify(cb) + listGraphs(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/gharial', - (err, res) => err ? callback(err) : callback(null, res.body.graphs) - ) - return promise + "/gharial", + (err, res) => (err ? callback(err) : callback(null, res.body.graphs)) + ); + return promise; } - graphs (cb) { - const {promise, callback} = this._connection.promisify(cb) + graphs(cb) { + const { promise, callback } = this._connection.promisify(cb); this.listGraphs( - (err, graphs) => err ? callback(err) : callback(null, graphs.map((info) => this.graph(info._key))) - ) - return promise + (err, graphs) => + err + ? callback(err) + : callback(null, graphs.map(info => this.graph(info._key))) + ); + return promise; } // Queries - transaction (collections, action, params, lockTimeout, cb) { - if (typeof lockTimeout === 'function') { - cb = lockTimeout - lockTimeout = undefined + transaction(collections, action, params, lockTimeout, cb) { + if (typeof lockTimeout === "function") { + cb = lockTimeout; + lockTimeout = undefined; } - if (typeof params === 'function') { - cb = params - params = undefined + if (typeof params === "function") { + cb = params; + params = undefined; } - if (typeof params === 'number') { - lockTimeout = params - params = undefined + if (typeof params === "number") { + lockTimeout = params; + params = undefined; } - if (typeof collections === 'string' || Array.isArray(collections)) { - collections = {write: collections} + if (typeof collections === "string" || Array.isArray(collections)) { + collections = { write: collections }; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/transaction', - {collections, action, params, lockTimeout}, - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/transaction", + { collections, action, params, lockTimeout }, + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } - query (query, bindVars, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + query(query, bindVars, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - if (typeof bindVars === 'function') { - cb = bindVars - bindVars = undefined + if (typeof bindVars === "function") { + cb = bindVars; + bindVars = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); if (query && query.query) { - if (!opts) opts = bindVars - bindVars = query.bindVars - query = query.query + if (!opts) opts = bindVars; + bindVars = query.bindVars; + query = query.query; } - if (query && typeof query.toAQL === 'function') { - query = query.toAQL() + if (query && typeof query.toAQL === "function") { + query = query.toAQL(); } this._api.post( - '/cursor', - {...opts, query, bindVars}, - (err, res) => err ? callback(err) : callback(null, new ArrayCursor(this._connection, res.body)) - ) - return promise + "/cursor", + { ...opts, query, bindVars }, + (err, res) => + err + ? callback(err) + : callback(null, new ArrayCursor(this._connection, res.body)) + ); + return promise; } // Function management - listFunctions (cb) { - const {promise, callback} = this._connection.promisify(cb) + listFunctions(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/aqlfunction', - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/aqlfunction", + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - createFunction (name, code, cb) { - const {promise, callback} = this._connection.promisify(cb) + createFunction(name, code, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/aqlfunction', - {name, code}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/aqlfunction", + { name, code }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - dropFunction (name, group, cb) { - if (typeof group === 'function') { - cb = group - group = undefined + dropFunction(name, group, cb) { + if (typeof group === "function") { + cb = group; + group = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.delete( `/aqlfunction/${name}`, - {group: Boolean(group)}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + { group: Boolean(group) }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } // Service management - listServices (cb) { - const {promise, callback} = this._connection.promisify(cb) + listServices(cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/foxx', - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise - } - - installService (mount, source, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined - } - const {configuration, dependencies, ...qs} = opts || {} - const {promise, callback} = this._connection.promisify(cb) - toForm({ - configuration, - dependencies, - source - }, (err, req) => err ? callback(err) : ( - this._api.request({ - method: 'POST', - path: '/foxx', - rawBody: req.body, - qs: {...qs, mount}, - headers: req.headers - }, (err, res) => err ? callback(err) : callback(null, res.body)) - )) - return promise - } - - upgradeService (mount, source, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined - } - const {configuration, dependencies, ...qs} = opts || {} - const {promise, callback} = this._connection.promisify(cb) - toForm({ - configuration, - dependencies, - source - }, (err, req) => err ? callback(err) : ( - this._api.request({ - method: 'PATCH', - path: '/foxx/service', - rawBody: req.body, - qs: {...qs, mount}, - headers: req.headers - }, (err, res) => err ? callback(err) : callback(null, res.body)) - )) - return promise - } - - replaceService (mount, source, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined - } - const {configuration, dependencies, ...qs} = opts || {} - const {promise, callback} = this._connection.promisify(cb) - toForm({ - configuration, - dependencies, - source - }, (err, req) => err ? callback(err) : ( - this._api.request({ - method: 'PUT', - path: '/foxx/service', - rawBody: req.body, - qs: {...qs, mount}, - headers: req.headers - }, (err, res) => err ? callback(err) : callback(null, res.body)) - )) - return promise - } - - uninstallService (mount, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined - } - const {promise, callback} = this._connection.promisify(cb) + "/foxx", + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; + } + + installService(mount, source, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; + } + const { configuration, dependencies, ...qs } = opts || {}; + const { promise, callback } = this._connection.promisify(cb); + toForm( + { + configuration, + dependencies, + source + }, + (err, req) => + err + ? callback(err) + : this._api.request( + { + method: "POST", + path: "/foxx", + rawBody: req.body, + qs: { ...qs, mount }, + headers: req.headers + }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ) + ); + return promise; + } + + upgradeService(mount, source, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; + } + const { configuration, dependencies, ...qs } = opts || {}; + const { promise, callback } = this._connection.promisify(cb); + toForm( + { + configuration, + dependencies, + source + }, + (err, req) => + err + ? callback(err) + : this._api.request( + { + method: "PATCH", + path: "/foxx/service", + rawBody: req.body, + qs: { ...qs, mount }, + headers: req.headers + }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ) + ); + return promise; + } + + replaceService(mount, source, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; + } + const { configuration, dependencies, ...qs } = opts || {}; + const { promise, callback } = this._connection.promisify(cb); + toForm( + { + configuration, + dependencies, + source + }, + (err, req) => + err + ? callback(err) + : this._api.request( + { + method: "PUT", + path: "/foxx/service", + rawBody: req.body, + qs: { ...qs, mount }, + headers: req.headers + }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ) + ); + return promise; + } + + uninstallService(mount, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; + } + const { promise, callback } = this._connection.promisify(cb); this._api.delete( - '/foxx/service', - {...opts, mount}, - (err) => err ? callback(err) : callback(null) - ) - return promise + "/foxx/service", + { ...opts, mount }, + err => (err ? callback(err) : callback(null)) + ); + return promise; } - getService (mount, cb) { - const {promise, callback} = this._connection.promisify(cb) + getService(mount, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/foxx/service', - {mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/foxx/service", + { mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - getServiceConfiguration (mount, minimal, cb) { - if (typeof minimal === 'function') { - cb = minimal - minimal = undefined + getServiceConfiguration(mount, minimal, cb) { + if (typeof minimal === "function") { + cb = minimal; + minimal = undefined; } - if (typeof minimal !== 'boolean') { + if (typeof minimal !== "boolean") { minimal = false; } - const {promise, callback} = this._connection.promisify(cb) - this._api.get( - '/foxx/configuration', - {mount, minimal}, - (err, res) => { - if (err) return callback(err); - if (minimal) { - const values = {}; - for (const key of Object.keys(res.body)) { - values[key] = res.body[key].current; - } - res.body = {values}; + const { promise, callback } = this._connection.promisify(cb); + this._api.get("/foxx/configuration", { mount, minimal }, (err, res) => { + if (err) return callback(err); + if (minimal) { + const values = {}; + for (const key of Object.keys(res.body)) { + values[key] = res.body[key].current; } - callback(null, res.body); + res.body = { values }; } - ) - return promise + callback(null, res.body); + }); + return promise; } - updateServiceConfiguration (mount, cfg, minimal, cb) { - if (typeof minimal === 'function') { - cb = minimal - minimal = undefined + updateServiceConfiguration(mount, cfg, minimal, cb) { + if (typeof minimal === "function") { + cb = minimal; + minimal = undefined; } - if (typeof minimal !== 'boolean') { + if (typeof minimal !== "boolean") { minimal = false; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.patch( - '/foxx/configuration', + "/foxx/configuration", cfg, - {mount, minimal}, + { mount, minimal }, (err, res) => { if (err) return callback(err); let body = res.body; @@ -421,7 +452,7 @@ export default class Database { return callback(null, body); } this.getServiceConfiguration(mount, minimal, (err, res) => { - if (err) return callback(err) + if (err) return callback(err); if (body.warnings) { for (const key of Object.keys(res)) { res.body[key].warning = body.warnings[key]; @@ -430,23 +461,23 @@ export default class Database { callback(null, res.body); }); } - ) - return promise + ); + return promise; } - replaceServiceConfiguration (mount, cfg, minimal, cb) { - if (typeof minimal === 'function') { - cb = minimal - minimal = undefined + replaceServiceConfiguration(mount, cfg, minimal, cb) { + if (typeof minimal === "function") { + cb = minimal; + minimal = undefined; } - if (typeof minimal !== 'boolean') { + if (typeof minimal !== "boolean") { minimal = false; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.put( - '/foxx/configuration', + "/foxx/configuration", cfg, - {mount, minimal}, + { mount, minimal }, (err, res) => { if (err) return callback(err); let body = res.body; @@ -454,7 +485,7 @@ export default class Database { return callback(null, body); } this.getServiceConfiguration(mount, minimal, (err, res) => { - if (err) return callback(err) + if (err) return callback(err); if (body.warnings) { for (const key of Object.keys(res)) { res.body[key].warning = body.warnings[key]; @@ -463,50 +494,46 @@ export default class Database { callback(null, res.body); }); } - ) - return promise + ); + return promise; } - getServiceDependencies (mount, minimal, cb) { - if (typeof minimal === 'function') { - cb = minimal - minimal = undefined + getServiceDependencies(mount, minimal, cb) { + if (typeof minimal === "function") { + cb = minimal; + minimal = undefined; } - if (typeof minimal !== 'boolean') { + if (typeof minimal !== "boolean") { minimal = false; } - const {promise, callback} = this._connection.promisify(cb) - this._api.get( - '/foxx/dependencies', - {mount, minimal}, - (err, res) => { - if (err) return callback(err); - if (minimal) { - const values = {}; - for (const key of Object.keys(res.body)) { - values[key] = res.body[key].current; - } - res.body = {values}; + const { promise, callback } = this._connection.promisify(cb); + this._api.get("/foxx/dependencies", { mount, minimal }, (err, res) => { + if (err) return callback(err); + if (minimal) { + const values = {}; + for (const key of Object.keys(res.body)) { + values[key] = res.body[key].current; } - callback(null, res.body); + res.body = { values }; } - ) - return promise + callback(null, res.body); + }); + return promise; } - updateServiceDependencies (mount, cfg, minimal, cb) { - if (typeof minimal === 'function') { - cb = minimal - minimal = undefined + updateServiceDependencies(mount, cfg, minimal, cb) { + if (typeof minimal === "function") { + cb = minimal; + minimal = undefined; } - if (typeof minimal !== 'boolean') { + if (typeof minimal !== "boolean") { minimal = false; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.patch( - '/foxx/dependencies', + "/foxx/dependencies", cfg, - {mount, minimal}, + { mount, minimal }, (err, res) => { if (err) return callback(err); let body = res.body; @@ -514,7 +541,7 @@ export default class Database { return callback(null, body); } this.getServiceDependencies(mount, minimal, (err, res) => { - if (err) return callback(err) + if (err) return callback(err); if (body.warnings) { for (const key of Object.keys(res)) { res.body[key].warning = body.warnings[key]; @@ -523,145 +550,145 @@ export default class Database { callback(null, res.body); }); } - ) - return promise + ); + return promise; } - replaceServiceDependencies (mount, cfg, minimal, cb) { - if (typeof minimal === 'function') { - cb = minimal - minimal = undefined + replaceServiceDependencies(mount, cfg, minimal, cb) { + if (typeof minimal === "function") { + cb = minimal; + minimal = undefined; } - if (typeof minimal !== 'boolean') { + if (typeof minimal !== "boolean") { minimal = false; } - const {promise, callback} = this._connection.promisify(cb) - this._api.put( - '/foxx/dependencies', - cfg, - {mount, minimal}, - (err, res) => { + const { promise, callback } = this._connection.promisify(cb); + this._api.put("/foxx/dependencies", cfg, { mount, minimal }, (err, res) => { + if (err) return callback(err); + let body = res.body; + if (minimal || !body.values || !body.values.title) { + return callback(null, body); + } + this.getServiceDependencies(mount, minimal, (err, res) => { if (err) return callback(err); - let body = res.body; - if (minimal || !body.values || !body.values.title) { - return callback(null, body); - } - this.getServiceDependencies(mount, minimal, (err, res) => { - if (err) return callback(err) - if (body.warnings) { - for (const key of Object.keys(res)) { - res.body[key].warning = body.warnings[key]; - } + if (body.warnings) { + for (const key of Object.keys(res)) { + res.body[key].warning = body.warnings[key]; } - callback(null, res.body); - }); - } - ) - return promise + } + callback(null, res.body); + }); + }); + return promise; } - enableServiceDevelopmentMode (mount, cb) { - const {promise, callback} = this._connection.promisify(cb) + enableServiceDevelopmentMode(mount, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/foxx/development', + "/foxx/development", undefined, - {mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + { mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - disableServiceDevelopmentMode (mount, cb) { - const {promise, callback} = this._connection.promisify(cb) + disableServiceDevelopmentMode(mount, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.delete( - '/foxx/development', - {mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/foxx/development", + { mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - listServiceScripts (mount, cb) { - const {promise, callback} = this._connection.promisify(cb) + listServiceScripts(mount, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/foxx/scripts', - {mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/foxx/scripts", + { mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - runServiceScript (mount, name, args, cb) { - if (typeof args === 'function') { - cb = args - args = undefined + runServiceScript(mount, name, args, cb) { + if (typeof args === "function") { + cb = args; + args = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( `/foxx/scripts/${name}`, args, - {mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + { mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - runServiceTests (mount, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + runServiceTests(mount, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/foxx/tests', + "/foxx/tests", undefined, - {...opts, mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + { ...opts, mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - getServiceReadme (mount, cb) { - const {promise, callback} = this._connection.promisify(cb) + getServiceReadme(mount, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/foxx/readme', - {mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/foxx/readme", + { mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - getServiceDocumentation (mount, cb) { - const {promise, callback} = this._connection.promisify(cb) + getServiceDocumentation(mount, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.get( - '/foxx/swagger', - {mount}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + "/foxx/swagger", + { mount }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - downloadService (mount, cb) { - const {promise, callback} = this._connection.promisify(cb) + downloadService(mount, cb) { + const { promise, callback } = this._connection.promisify(cb); this._api.request( - {method: 'POST', path: '/foxx/download', qs: {mount}, expectBinary: true}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise - } - - commitLocalServiceState (replace, cb) { - if (typeof replace === 'function') { - cb = replace - replace = undefined - } - const {promise, callback} = this._connection.promisify(cb) + { + method: "POST", + path: "/foxx/download", + qs: { mount }, + expectBinary: true + }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; + } + + commitLocalServiceState(replace, cb) { + if (typeof replace === "function") { + cb = replace; + replace = undefined; + } + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/foxx/commit', + "/foxx/commit", undefined, - {replace}, - (err, res) => err ? callback(err) : callback(null) - ) - return promise + { replace }, + (err, res) => (err ? callback(err) : callback(null)) + ); + return promise; } } diff --git a/src/error.js b/src/error.js index 719768567..aca7c6d66 100644 --- a/src/error.js +++ b/src/error.js @@ -1,21 +1,21 @@ -import ExtendableError from 'es6-error' +import ExtendableError from "es6-error"; export default class ArangoError extends ExtendableError { - constructor (obj) { - super() - this.message = obj.errorMessage - this.errorNum = obj.errorNum - this.code = obj.code - const err = new Error(this.message) - err.name = this.name - if (err.fileName) this.fileName = err.fileName - if (err.lineNumber) this.lineNumber = err.lineNumber - if (err.columnNumber) this.columnNumber = err.columnNumber - if (err.stack) this.stack = err.stack - if (err.description) this.description = err.description - if (err.number) this.number = err.number + constructor(obj) { + super(); + this.message = obj.errorMessage; + this.errorNum = obj.errorNum; + this.code = obj.code; + const err = new Error(this.message); + err.name = this.name; + if (err.fileName) this.fileName = err.fileName; + if (err.lineNumber) this.lineNumber = err.lineNumber; + if (err.columnNumber) this.columnNumber = err.columnNumber; + if (err.stack) this.stack = err.stack; + if (err.description) this.description = err.description; + if (err.number) this.number = err.number; } } -ArangoError.prototype.name = 'ArangoError' -ArangoError.prototype.isArangoError = true +ArangoError.prototype.name = "ArangoError"; +ArangoError.prototype.isArangoError = true; diff --git a/src/graph.js b/src/graph.js index f4d82a452..e2a36ba21 100644 --- a/src/graph.js +++ b/src/graph.js @@ -1,222 +1,222 @@ import { - EdgeCollection, _BaseCollection as BaseCollection, + EdgeCollection, _types as types -} from './collection' +} from "./collection"; class GraphVertexCollection extends BaseCollection { - constructor (connection, name, graph) { - super(connection, name) - this.type = types.DOCUMENT_COLLECTION - this.graph = graph - this._gharial = this._api.route(`/gharial/${this.graph.name}/vertex`) + constructor(connection, name, graph) { + super(connection, name); + this.type = types.DOCUMENT_COLLECTION; + this.graph = graph; + this._gharial = this._api.route(`/gharial/${this.graph.name}/vertex`); } - _documentPath (documentHandle) { - return `/document/${this._documentHandle(documentHandle)}` + _documentPath(documentHandle) { + return `/document/${this._documentHandle(documentHandle)}`; } - remove (documentHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + remove(documentHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.delete( `/${this._documentHandle(documentHandle)}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - vertex (documentHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + vertex(documentHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.get( `/${this._documentHandle(documentHandle)}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - save (data, cb) { - const {promise, callback} = this._connection.promisify(cb) + save(data, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.post( this.name, data, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } } class GraphEdgeCollection extends EdgeCollection { - constructor (connection, name, graph) { - super(connection, name) - this.type = types.EDGE_COLLECTION - this.graph = graph - this._gharial = this._api.route(`/gharial/${this.graph.name}/edge`) + constructor(connection, name, graph) { + super(connection, name); + this.type = types.EDGE_COLLECTION; + this.graph = graph; + this._gharial = this._api.route(`/gharial/${this.graph.name}/edge`); } - remove (documentHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + remove(documentHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.delete( `/${this._documentHandle(documentHandle)}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - edge (documentHandle, cb) { - const {promise, callback} = this._connection.promisify(cb) + edge(documentHandle, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.get( `/${this._documentHandle(documentHandle)}`, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - save (data, fromId, toId, cb) { - if (typeof fromId === 'function') { - cb = fromId - fromId = undefined + save(data, fromId, toId, cb) { + if (typeof fromId === "function") { + cb = fromId; + fromId = undefined; } else if (fromId) { - data._from = this._documentHandle(fromId) - data._to = this._documentHandle(toId) + data._from = this._documentHandle(fromId); + data._to = this._documentHandle(toId); } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._gharial.post( this.name, data, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } } export default class Graph { - constructor (connection, name) { - this.name = name - this._connection = connection - this._api = this._connection.route('/_api') - this._gharial = this._api.route(`/gharial/${this.name}`) + constructor(connection, name) { + this.name = name; + this._connection = connection; + this._api = this._connection.route("/_api"); + this._gharial = this._api.route(`/gharial/${this.name}`); } - get (cb) { - const {promise, callback} = this._connection.promisify(cb) + get(cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.get( - (err, res) => err ? callback(err) : callback(null, res.body.graph) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body.graph)) + ); + return promise; } - create (properties, cb) { - if (typeof properties === 'function') { - cb = properties - properties = undefined + create(properties, cb) { + if (typeof properties === "function") { + cb = properties; + properties = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/gharial', - {...properties, name: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.graph) - ) - return promise + "/gharial", + { ...properties, name: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.graph)) + ); + return promise; } - drop (dropCollections, cb) { - if (typeof dropCollections === 'function') { - cb = dropCollections - dropCollections = undefined + drop(dropCollections, cb) { + if (typeof dropCollections === "function") { + cb = dropCollections; + dropCollections = undefined; } - if (typeof dropCollections !== 'boolean') dropCollections = false - const {promise, callback} = this._connection.promisify(cb) + if (typeof dropCollections !== "boolean") dropCollections = false; + const { promise, callback } = this._connection.promisify(cb); this._gharial.delete( - {dropCollections}, - (err, res) => err ? callback(err) : callback(null, res.body) - ) - return promise + { dropCollections }, + (err, res) => (err ? callback(err) : callback(null, res.body)) + ); + return promise; } - vertexCollection (collectionName) { - return new GraphVertexCollection(this._connection, collectionName, this) + vertexCollection(collectionName) { + return new GraphVertexCollection(this._connection, collectionName, this); } - addVertexCollection (collectionName, cb) { - const {promise, callback} = this._connection.promisify(cb) + addVertexCollection(collectionName, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.post( - '/vertex', - {collection: collectionName}, - (err, res) => err ? callback(err) : callback(null, res.body.graph) - ) - return promise + "/vertex", + { collection: collectionName }, + (err, res) => (err ? callback(err) : callback(null, res.body.graph)) + ); + return promise; } - removeVertexCollection (collectionName, dropCollection, cb) { - if (typeof dropCollection === 'function') { - cb = dropCollection - dropCollection = undefined + removeVertexCollection(collectionName, dropCollection, cb) { + if (typeof dropCollection === "function") { + cb = dropCollection; + dropCollection = undefined; } - const {promise, callback} = this._connection.promisify(cb) - if (typeof dropCollection !== 'boolean') dropCollection = false + const { promise, callback } = this._connection.promisify(cb); + if (typeof dropCollection !== "boolean") dropCollection = false; this._gharial.delete( `/vertex/${collectionName}`, - {dropCollection}, - (err, res) => err ? callback(err) : callback(null, res.body.graph) - ) - return promise + { dropCollection }, + (err, res) => (err ? callback(err) : callback(null, res.body.graph)) + ); + return promise; } - edgeCollection (collectionName) { - return new GraphEdgeCollection(this._connection, collectionName, this) + edgeCollection(collectionName) { + return new GraphEdgeCollection(this._connection, collectionName, this); } - addEdgeDefinition (definition, cb) { - const {promise, callback} = this._connection.promisify(cb) + addEdgeDefinition(definition, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.post( - '/edge', + "/edge", definition, - (err, res) => err ? callback(err) : callback(null, res.body.graph) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body.graph)) + ); + return promise; } - replaceEdgeDefinition (definitionName, definition, cb) { - const {promise, callback} = this._connection.promisify(cb) + replaceEdgeDefinition(definitionName, definition, cb) { + const { promise, callback } = this._connection.promisify(cb); this._gharial.put( `/edge/${definitionName}`, definition, - (err, res) => err ? callback(err) : callback(null, res.body.graph) - ) - return promise + (err, res) => (err ? callback(err) : callback(null, res.body.graph)) + ); + return promise; } - removeEdgeDefinition (definitionName, dropCollection, cb) { - if (typeof dropCollection === 'function') { - cb = dropCollection - dropCollection = undefined + removeEdgeDefinition(definitionName, dropCollection, cb) { + if (typeof dropCollection === "function") { + cb = dropCollection; + dropCollection = undefined; } - const {promise, callback} = this._connection.promisify(cb) - if (typeof dropCollection !== 'boolean') dropCollection = false + const { promise, callback } = this._connection.promisify(cb); + if (typeof dropCollection !== "boolean") dropCollection = false; this._gharial.delete( `edge/${definitionName}`, - {dropCollection}, - (err, res) => err ? callback(err) : callback(null, res.body.graph) - ) - return promise + { dropCollection }, + (err, res) => (err ? callback(err) : callback(null, res.body.graph)) + ); + return promise; } - traversal (startVertex, opts, cb) { - if (typeof opts === 'function') { - cb = opts - opts = undefined + traversal(startVertex, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = undefined; } - const {promise, callback} = this._connection.promisify(cb) + const { promise, callback } = this._connection.promisify(cb); this._api.post( - '/traversal', - {...opts, startVertex, graphName: this.name}, - (err, res) => err ? callback(err) : callback(null, res.body.result) - ) - return promise + "/traversal", + { ...opts, startVertex, graphName: this.name }, + (err, res) => (err ? callback(err) : callback(null, res.body.result)) + ); + return promise; } } export { GraphVertexCollection as VertexCollection, GraphEdgeCollection as EdgeCollection -} +}; diff --git a/src/index.js b/src/index.js index 8ca8cc427..ed1dcdad7 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,6 @@ -import Database from './database' -import aqlQuery from './aql-query' +import Database from "./database"; +import aqlQuery from "./aql-query"; -module.exports = (...args) => new Database(...args) -module.exports.Database = Database -module.exports.aqlQuery = -module.exports.aql = aqlQuery +module.exports = (...args) => new Database(...args); +module.exports.Database = Database; +module.exports.aqlQuery = module.exports.aql = aqlQuery; diff --git a/src/route.js b/src/route.js index 58b101f56..7847798f9 100644 --- a/src/route.js +++ b/src/route.js @@ -1,201 +1,218 @@ export default class Route { - constructor (connection, path, headers) { - if (!path) path = '' - else if (path.charAt(0) !== '/') path = `/${path}` - this._connection = connection - this._path = path - this._headers = headers + constructor(connection, path, headers) { + if (!path) path = ""; + else if (path.charAt(0) !== "/") path = `/${path}`; + this._connection = connection; + this._path = path; + this._headers = headers; } - route (path, headers) { - if (!path) path = '' - else if (path.charAt(0) !== '/') path = `/${path}` - return new Route( - this._connection, - this._path + path, - {...this._headers, ...headers} - ) + route(path, headers) { + if (!path) path = ""; + else if (path.charAt(0) !== "/") path = `/${path}`; + return new Route(this._connection, this._path + path, { + ...this._headers, + ...headers + }); } - request (opts, callback) { - opts = {...opts} - opts.basePath = this._path - opts.headers = {...this._headers, ...opts.headers} - opts.method = opts.method ? opts.method.toUpperCase() : 'GET' - return this._connection.request(opts, callback) + request(opts, callback) { + opts = { ...opts }; + opts.basePath = this._path; + opts.headers = { ...this._headers, ...opts.headers }; + opts.method = opts.method ? opts.method.toUpperCase() : "GET"; + return this._connection.request(opts, callback); } - get (path, qs, headers, callback) { - if (typeof path !== 'string') { - callback = qs - qs = path - path = undefined - } - if (typeof qs === 'function') { - callback = qs - qs = undefined - } - if (typeof headers === 'function') { - callback = headers - headers = undefined - } - if (!path) path = '' - else if (this._path && path.charAt(0) !== '/') path = `/${path}` - headers = headers ? {...this._headers, ...headers} : {...this._headers} - return this._connection.request({ - basePath: this._path, - path, - qs, - headers, - method: 'GET' - }, callback) + get(path, qs, headers, callback) { + if (typeof path !== "string") { + callback = qs; + qs = path; + path = undefined; + } + if (typeof qs === "function") { + callback = qs; + qs = undefined; + } + if (typeof headers === "function") { + callback = headers; + headers = undefined; + } + if (!path) path = ""; + else if (this._path && path.charAt(0) !== "/") path = `/${path}`; + headers = headers ? { ...this._headers, ...headers } : { ...this._headers }; + return this._connection.request( + { + basePath: this._path, + path, + qs, + headers, + method: "GET" + }, + callback + ); } - post (path, body, qs, headers, callback) { - if (typeof path !== 'string') { - callback = qs - qs = body - body = path - path = undefined - } - if (typeof qs === 'function') { - callback = qs - qs = undefined - } - if (typeof body === 'function') { - callback = body - body = undefined - } - if (typeof headers === 'function') { - callback = headers - headers = undefined - } - if (!path) path = '' - else if (this._path && path.charAt(0) !== '/') path = `/${path}` - headers = headers ? {...this._headers, ...headers} : {...this._headers} - return this._connection.request({ - basePath: this._path, - path, - body, - qs, - headers, - method: 'POST' - }, callback) + post(path, body, qs, headers, callback) { + if (typeof path !== "string") { + callback = qs; + qs = body; + body = path; + path = undefined; + } + if (typeof qs === "function") { + callback = qs; + qs = undefined; + } + if (typeof body === "function") { + callback = body; + body = undefined; + } + if (typeof headers === "function") { + callback = headers; + headers = undefined; + } + if (!path) path = ""; + else if (this._path && path.charAt(0) !== "/") path = `/${path}`; + headers = headers ? { ...this._headers, ...headers } : { ...this._headers }; + return this._connection.request( + { + basePath: this._path, + path, + body, + qs, + headers, + method: "POST" + }, + callback + ); } - put (path, body, qs, headers, callback) { - if (typeof path !== 'string') { - callback = body - body = qs - qs = path - path = undefined - } - if (typeof qs === 'function') { - callback = qs - qs = undefined - } - if (typeof body === 'function') { - callback = body - body = undefined - } - if (typeof headers === 'function') { - callback = headers - headers = undefined - } - if (!path) path = '' - else if (this._path && path.charAt(0) !== '/') path = `/${path}` - headers = headers ? {...this._headers, ...headers} : {...this._headers} - return this._connection.request({ - basePath: this._path, - path, - body, - qs, - headers, - method: 'PUT' - }, callback) + put(path, body, qs, headers, callback) { + if (typeof path !== "string") { + callback = body; + body = qs; + qs = path; + path = undefined; + } + if (typeof qs === "function") { + callback = qs; + qs = undefined; + } + if (typeof body === "function") { + callback = body; + body = undefined; + } + if (typeof headers === "function") { + callback = headers; + headers = undefined; + } + if (!path) path = ""; + else if (this._path && path.charAt(0) !== "/") path = `/${path}`; + headers = headers ? { ...this._headers, ...headers } : { ...this._headers }; + return this._connection.request( + { + basePath: this._path, + path, + body, + qs, + headers, + method: "PUT" + }, + callback + ); } - patch (path, body, qs, headers, callback) { - if (typeof path !== 'string') { - callback = body - body = qs - qs = path - path = undefined - } - if (typeof qs === 'function') { - callback = qs - qs = undefined - } - if (typeof body === 'function') { - callback = body - body = undefined - } - if (typeof headers === 'function') { - callback = headers - headers = undefined - } - if (!path) path = '' - else if (this._path && path.charAt(0) !== '/') path = `/${path}` - headers = headers ? {...this._headers, ...headers} : {...this._headers} - return this._connection.request({ - basePath: this._path, - path, - body, - qs, - headers, - method: 'PATCH' - }, callback) + patch(path, body, qs, headers, callback) { + if (typeof path !== "string") { + callback = body; + body = qs; + qs = path; + path = undefined; + } + if (typeof qs === "function") { + callback = qs; + qs = undefined; + } + if (typeof body === "function") { + callback = body; + body = undefined; + } + if (typeof headers === "function") { + callback = headers; + headers = undefined; + } + if (!path) path = ""; + else if (this._path && path.charAt(0) !== "/") path = `/${path}`; + headers = headers ? { ...this._headers, ...headers } : { ...this._headers }; + return this._connection.request( + { + basePath: this._path, + path, + body, + qs, + headers, + method: "PATCH" + }, + callback + ); } - delete (path, qs, headers, callback) { - if (typeof path !== 'string') { - callback = qs - qs = path - path = undefined - } - if (typeof qs === 'function') { - callback = qs - qs = undefined - } - if (typeof headers === 'function') { - callback = headers - headers = undefined - } - if (!path) path = '' - else if (this._path && path.charAt(0) !== '/') path = `/${path}` - headers = headers ? {...this._headers, ...headers} : {...this._headers} - return this._connection.request({ - basePath: this._path, - path, - qs, - headers, - method: 'DELETE' - }, callback) + delete(path, qs, headers, callback) { + if (typeof path !== "string") { + callback = qs; + qs = path; + path = undefined; + } + if (typeof qs === "function") { + callback = qs; + qs = undefined; + } + if (typeof headers === "function") { + callback = headers; + headers = undefined; + } + if (!path) path = ""; + else if (this._path && path.charAt(0) !== "/") path = `/${path}`; + headers = headers ? { ...this._headers, ...headers } : { ...this._headers }; + return this._connection.request( + { + basePath: this._path, + path, + qs, + headers, + method: "DELETE" + }, + callback + ); } - head (path, qs, headers, callback) { - if (typeof path !== 'string') { - callback = qs - qs = path - path = undefined - } - if (typeof qs === 'function') { - callback = qs - qs = undefined - } - if (typeof headers === 'function') { - callback = headers - headers = undefined - } - if (!path) path = '' - else if (this._path && path.charAt(0) !== '/') path = `/${path}` - headers = headers ? {...this._headers, ...headers} : {...this._headers} - return this._connection.request({ - basePath: this._path, - path, - qs, - headers, - method: 'HEAD' - }, callback) + head(path, qs, headers, callback) { + if (typeof path !== "string") { + callback = qs; + qs = path; + path = undefined; + } + if (typeof qs === "function") { + callback = qs; + qs = undefined; + } + if (typeof headers === "function") { + callback = headers; + headers = undefined; + } + if (!path) path = ""; + else if (this._path && path.charAt(0) !== "/") path = `/${path}`; + headers = headers ? { ...this._headers, ...headers } : { ...this._headers }; + return this._connection.request( + { + basePath: this._path, + path, + qs, + headers, + method: "HEAD" + }, + callback + ); } } diff --git a/src/util/all.js b/src/util/all.js index 4c3b39f59..3642079b8 100644 --- a/src/util/all.js +++ b/src/util/all.js @@ -1,22 +1,22 @@ -export default function all (arr, callback) { - const result = [] - let pending = arr.length - let called = false +export default function all(arr, callback) { + const result = []; + let pending = arr.length; + let called = false; - if (arr.length === 0) return callback(null, result) + if (arr.length === 0) return callback(null, result); - const step = (i) => (err, res) => { - pending -= 1 - if (!err) result[i] = res + const step = i => (err, res) => { + pending -= 1; + if (!err) result[i] = res; if (!called) { - if (err) callback(err) + if (err) callback(err); else if (pending === 0) { - if (result.every((r) => r === undefined)) callback(null) - else callback(null, result) - } else return - called = true + if (result.every(r => r === undefined)) callback(null); + else callback(null, result); + } else return; + called = true; } - } + }; - arr.forEach((fn, i) => fn(step(i))) + arr.forEach((fn, i) => fn(step(i))); } diff --git a/src/util/btoa.js b/src/util/btoa.js index ab62cfafd..e171b88ec 100644 --- a/src/util/btoa.js +++ b/src/util/btoa.js @@ -1,3 +1,3 @@ -export default function (str) { - return Buffer.from(str).toString('base64') +export default function(str) { + return Buffer.from(str).toString("base64"); } diff --git a/src/util/btoa.web.js b/src/util/btoa.web.js index 8ce0e78f0..473717e25 100644 --- a/src/util/btoa.web.js +++ b/src/util/btoa.web.js @@ -1 +1,2 @@ -export default window.btoa +/*eslint-env browser */ +export default window.btoa; diff --git a/src/util/bytelength.js b/src/util/bytelength.js index 53b0003c4..fab1b5afa 100644 --- a/src/util/bytelength.js +++ b/src/util/bytelength.js @@ -1 +1 @@ -export default Buffer.byteLength +export default Buffer.byteLength; diff --git a/src/util/bytelength.web.js b/src/util/bytelength.web.js index d3fc8d78b..91e725a03 100644 --- a/src/util/bytelength.web.js +++ b/src/util/bytelength.web.js @@ -1 +1,2 @@ -module.exports = require('utf8-length') +/*eslint-env browser */ +module.exports = require("utf8-length"); diff --git a/src/util/joinPath.js b/src/util/joinPath.js index 7310fa3e1..e2596159c 100644 --- a/src/util/joinPath.js +++ b/src/util/joinPath.js @@ -1,3 +1,3 @@ -import path from 'path' -const posix = path.posix || path -export default posix.join +import path from "path"; +const posix = path.posix || path; +export default posix.join; diff --git a/src/util/multipart.js b/src/util/multipart.js index 93e812775..137f820c8 100644 --- a/src/util/multipart.js +++ b/src/util/multipart.js @@ -1,45 +1,45 @@ -import Multipart from 'multi-part' -import {Readable} from 'stream' +import Multipart from "multi-part"; +import { Readable } from "stream"; -export default function toForm (fields, callback) { - let called = false +export default function toForm(fields, callback) { + let called = false; try { - const form = new Multipart() + const form = new Multipart(); for (const key of Object.keys(fields)) { - let value = fields[key] - if (value === undefined) continue + let value = fields[key]; + if (value === undefined) continue; if ( !(value instanceof Readable) && !(value instanceof global.Buffer) && - (typeof value === 'object' || typeof value === 'function') + (typeof value === "object" || typeof value === "function") ) { - value = JSON.stringify(value) + value = JSON.stringify(value); } - form.append(key, value) + form.append(key, value); } - const stream = form.getStream() - const bufs = [] - stream.on('data', (buf) => bufs.push(buf)) - stream.on('end', () => { - if (called) return - bufs.push(Buffer.from('\r\n')) - const body = Buffer.concat(bufs) - const boundary = form.getBoundary() + const stream = form.getStream(); + const bufs = []; + stream.on("data", buf => bufs.push(buf)); + stream.on("end", () => { + if (called) return; + bufs.push(Buffer.from("\r\n")); + const body = Buffer.concat(bufs); + const boundary = form.getBoundary(); const headers = { - 'content-type': `multipart/form-data; boundary=${boundary}`, - 'content-length': String(body.length) - } - called = true - callback(null, {body, headers}) - }) - stream.on('error', (e) => { - if (called) return - called = true - callback(e) - }) + "content-type": `multipart/form-data; boundary=${boundary}`, + "content-length": String(body.length) + }; + called = true; + callback(null, { body, headers }); + }); + stream.on("error", e => { + if (called) return; + called = true; + callback(e); + }); } catch (e) { - if (called) return - called = true - callback(e) + if (called) return; + called = true; + callback(e); } } diff --git a/src/util/multipart.web.js b/src/util/multipart.web.js index 34ae2c6fe..3143d8f0d 100644 --- a/src/util/multipart.web.js +++ b/src/util/multipart.web.js @@ -1,21 +1,22 @@ -export default function toForm (fields, callback) { - let form +/*eslint-env browser */ +export default function toForm(fields, callback) { + let form; try { - form = new global.FormData() + form = new global.FormData(); for (const key of Object.keys(fields)) { - let value = fields[key] - if (value === undefined) continue + let value = fields[key]; + if (value === undefined) continue; if ( !(value instanceof global.Blob) && - (typeof value === 'object' || typeof value === 'function') + (typeof value === "object" || typeof value === "function") ) { - value = JSON.stringify(value) + value = JSON.stringify(value); } - form.append(key, value) + form.append(key, value); } } catch (e) { - callback(e) - return + callback(e); + return; } - callback(null, {body: form}) + callback(null, { body: form }); } diff --git a/src/util/promisify.js b/src/util/promisify.js index 63d8fdf31..33570e25a 100644 --- a/src/util/promisify.js +++ b/src/util/promisify.js @@ -1,27 +1,27 @@ -const noop = () => undefined +const noop = () => undefined; -export default function promisify (promiseClass) { +export default function promisify(promiseClass) { if (promiseClass === false) { - return function (cb) { - return {callback: cb || noop} - } + return function(cb) { + return { callback: cb || noop }; + }; } - return function (cb) { - const Promise = promiseClass || global.Promise + return function(cb) { + const Promise = promiseClass || global.Promise; if (cb || !Promise) { - return {callback: cb || noop} + return { callback: cb || noop }; } - let callback + let callback; const promise = new Promise((resolve, reject) => { callback = (err, res) => { - if (err) reject(err) - else resolve(res) - } - }) + if (err) reject(err); + else resolve(res); + }; + }); - return {callback, promise} - } + return { callback, promise }; + }; } diff --git a/src/util/request.js b/src/util/request.js index db5a4441b..70bdad3e3 100644 --- a/src/util/request.js +++ b/src/util/request.js @@ -1 +1 @@ -module.exports = require('./request.node') +module.exports = require("./request.node"); diff --git a/src/util/request.node.js b/src/util/request.node.js index e37118244..971dfda29 100644 --- a/src/util/request.node.js +++ b/src/util/request.node.js @@ -1,77 +1,80 @@ -import http from 'http' -import https from 'https' -import {parse as parseUrl} from 'url' -import LinkedList from 'linkedlist' -import joinPath from './joinPath' +import LinkedList from "linkedlist"; +import http from "http"; +import https from "https"; +import joinPath from "./joinPath"; +import { parse as parseUrl } from "url"; -export const isBrowser = false +export const isBrowser = false; -export default function (baseUrl, agentOptions, agent) { - const baseUrlParts = parseUrl(baseUrl) - const isTls = baseUrlParts.protocol === 'https:' +export default function(baseUrl, agentOptions, agent) { + const baseUrlParts = parseUrl(baseUrl); + const isTls = baseUrlParts.protocol === "https:"; if (!agent) { - const Agent = (isTls ? https : http).Agent - agent = new Agent(agentOptions) + const Agent = (isTls ? https : http).Agent; + agent = new Agent(agentOptions); } - const queue = new LinkedList() - const maxTasks = typeof agent.maxSockets === 'number' ? agent.maxSockets * 2 : Infinity - let activeTasks = 0 + const queue = new LinkedList(); + const maxTasks = + typeof agent.maxSockets === "number" ? agent.maxSockets * 2 : Infinity; + let activeTasks = 0; - function drainQueue () { - if (!queue.length || activeTasks >= maxTasks) return - const task = queue.shift() - activeTasks += 1 + function drainQueue() { + if (!queue.length || activeTasks >= maxTasks) return; + const task = queue.shift(); + activeTasks += 1; task(() => { - activeTasks -= 1 - drainQueue() - }) + activeTasks -= 1; + drainQueue(); + }); } - function request ({method, url, headers, body, expectBinary}, cb) { - let path = baseUrlParts.pathname ? ( - url.pathname ? joinPath(baseUrlParts.pathname, url.pathname) : baseUrlParts.pathname - ) : url.pathname - const search = url.search ? ( - baseUrlParts.search ? `${baseUrlParts.search}&${url.search.slice(1)}` : url.search - ) : baseUrlParts.search - if (search) path += search - const options = {path, method, headers, agent} - options.hostname = baseUrlParts.hostname - options.port = baseUrlParts.port - options.auth = baseUrlParts.auth + function request({ method, url, headers, body, expectBinary }, cb) { + let path = baseUrlParts.pathname + ? url.pathname + ? joinPath(baseUrlParts.pathname, url.pathname) + : baseUrlParts.pathname + : url.pathname; + const search = url.search + ? baseUrlParts.search + ? `${baseUrlParts.search}&${url.search.slice(1)}` + : url.search + : baseUrlParts.search; + if (search) path += search; + const options = { path, method, headers, agent }; + options.hostname = baseUrlParts.hostname; + options.port = baseUrlParts.port; + options.auth = baseUrlParts.auth; - queue.push((next) => { + queue.push(next => { let callback = (err, res) => { - callback = () => undefined - next() - cb(err, res) - } - const req = (isTls ? https : http).request(options, (res) => { - const data = [] - res - .on('data', (chunk) => data.push(chunk)) - .on('end', () => { - res.body = Buffer.concat(data) + callback = () => undefined; + next(); + cb(err, res); + }; + const req = (isTls ? https : http).request(options, res => { + const data = []; + res.on("data", chunk => data.push(chunk)).on("end", () => { + res.body = Buffer.concat(data); if (!expectBinary) { - res.body = res.body.toString('utf-8') + res.body = res.body.toString("utf-8"); } - callback(null, res) - }) - }) - req.on('error', (err) => { - err.request = req - callback(err) - }) - if (body) req.write(body) - req.end() - }) + callback(null, res); + }); + }); + req.on("error", err => { + err.request = req; + callback(err); + }); + if (body) req.write(body); + req.end(); + }); - drainQueue() + drainQueue(); } - const auth = baseUrlParts.auth - delete baseUrlParts.auth - return {request, auth, url: baseUrlParts} + const auth = baseUrlParts.auth; + delete baseUrlParts.auth; + return { request, auth, url: baseUrlParts }; } diff --git a/src/util/request.web.js b/src/util/request.web.js index 17118dd70..dc9f24f14 100644 --- a/src/util/request.web.js +++ b/src/util/request.web.js @@ -1,66 +1,76 @@ -import xhr from 'xhr' -import {parse as parseUrl, format as formatUrl} from 'url' -import joinPath from './joinPath' +/*eslint-env browser */ +import { format as formatUrl, parse as parseUrl } from "url"; -export const isBrowser = true +import joinPath from "./joinPath"; +import xhr from "xhr"; -export default function (baseUrl, options) { - if (!options) options = {} - const baseUrlParts = parseUrl(baseUrl) +export const isBrowser = true; - const queue = [] - const maxTasks = typeof options.maxSockets === 'number' ? options.maxSockets * 2 : Infinity - let activeTasks = 0 +export default function(baseUrl, options) { + if (!options) options = {}; + const baseUrlParts = parseUrl(baseUrl); - function drainQueue () { - if (!queue.length || activeTasks >= maxTasks) return - const task = queue.shift() - activeTasks += 1 + const queue = []; + const maxTasks = + typeof options.maxSockets === "number" ? options.maxSockets * 2 : Infinity; + let activeTasks = 0; + + function drainQueue() { + if (!queue.length || activeTasks >= maxTasks) return; + const task = queue.shift(); + activeTasks += 1; task(() => { - activeTasks -= 1 - drainQueue() - }) + activeTasks -= 1; + drainQueue(); + }); } - function request ({method, url, headers, body, expectBinary}, cb) { + function request({ method, url, headers, body, expectBinary }, cb) { const urlParts = { ...baseUrlParts, - pathname: url.pathname ? ( - baseUrlParts.pathname ? joinPath(baseUrlParts.pathname, url.pathname) : url.pathname - ) : baseUrlParts.pathname, - search: url.search ? ( - baseUrlParts.search ? `${baseUrlParts.search}&${url.search.slice(1)}` : url.search - ) : baseUrlParts.search - } + pathname: url.pathname + ? baseUrlParts.pathname + ? joinPath(baseUrlParts.pathname, url.pathname) + : url.pathname + : baseUrlParts.pathname, + search: url.search + ? baseUrlParts.search + ? `${baseUrlParts.search}&${url.search.slice(1)}` + : url.search + : baseUrlParts.search + }; - queue.push((next) => { + queue.push(next => { let callback = (err, res) => { - callback = () => undefined - next() - cb(err, res) - } - const req = xhr({ - responseType: expectBinary ? 'blob' : 'text', - ...options, - url: formatUrl(urlParts), - withCredentials: true, - useXDR: true, - body, - method, - headers - }, (err, res) => { - if (!err) callback(null, res) - else { - err.request = req - callback(err) + callback = () => undefined; + next(); + cb(err, res); + }; + const req = xhr( + { + responseType: expectBinary ? "blob" : "text", + ...options, + url: formatUrl(urlParts), + withCredentials: true, + useXDR: true, + body, + method, + headers + }, + (err, res) => { + if (!err) callback(null, res); + else { + err.request = req; + callback(err); + } } - }) - }) + ); + }); - drainQueue() + drainQueue(); } - const auth = baseUrlParts.auth - delete baseUrlParts.auth - return {request, auth, url: baseUrlParts} + const auth = baseUrlParts.auth; + delete baseUrlParts.auth; + return { request, auth, url: baseUrlParts }; } diff --git a/test/00-basics.js b/test/00-basics.js index 7d703327a..6f61411fc 100644 --- a/test/00-basics.js +++ b/test/00-basics.js @@ -1,168 +1,169 @@ -import {describe, it, before, after, beforeEach} from 'mocha' -import {expect} from 'chai' -import arangojs, {Database} from '../src' -import Connection from '../src/connection' -import https from 'https' -import http from 'http' +import { after, before, beforeEach, describe, it } from "mocha"; +import arangojs, { Database } from "../src"; -describe('Creating a Database', () => { - describe('using the factory', () => { - const db = arangojs({potato: 'potato'}) - it('returns a Database instance', () => { - expect(db).to.be.an.instanceof(Database) - }) - it('passes any configs to the connection', () => { - expect(db._connection.config).to.have.a.property('potato', 'potato') - }) - }) - describe('using the constructor', () => { - const db = new Database({banana: 'banana'}) - it('returns a Database instance', () => { - expect(db).to.be.an.instanceof(Database) - }) - it('passes any configs to the connection', () => { - expect(db._connection.config).to.have.a.property('banana', 'banana') - }) - }) -}) +import Connection from "../src/connection"; +import { expect } from "chai"; +import http from "http"; +import https from "https"; -describe('Configuring the driver', () => { - describe('with a string', () => { - it('sets the url', () => { - const url = 'https://example.com:9000' - const conn = new Connection(url) - expect(conn.config).to.have.a.property('url', url) - }) - }) - describe('with headers', () => { - it('applies the headers', (done) => { +describe("Creating a Database", () => { + describe("using the factory", () => { + const db = arangojs({ potato: "potato" }); + it("returns a Database instance", () => { + expect(db).to.be.an.instanceof(Database); + }); + it("passes any configs to the connection", () => { + expect(db._connection.config).to.have.a.property("potato", "potato"); + }); + }); + describe("using the constructor", () => { + const db = new Database({ banana: "banana" }); + it("returns a Database instance", () => { + expect(db).to.be.an.instanceof(Database); + }); + it("passes any configs to the connection", () => { + expect(db._connection.config).to.have.a.property("banana", "banana"); + }); + }); +}); + +describe("Configuring the driver", () => { + describe("with a string", () => { + it("sets the url", () => { + const url = "https://example.com:9000"; + const conn = new Connection(url); + expect(conn.config).to.have.a.property("url", url); + }); + }); + describe("with headers", () => { + it("applies the headers", done => { const conn = new Connection({ headers: { - 'x-one': '1', - 'x-two': '2' + "x-one": "1", + "x-two": "2" } - }) - conn._request = ({headers}) => { - expect(headers).to.have.a.property('x-one', '1') - expect(headers).to.have.a.property('x-two', '2') - done() - } - conn.request({headers: {}}) - }) - }) - describe('with an arangoVersion', () => { - it('sets the x-arango-version header', (done) => { - const conn = new Connection({arangoVersion: 99999}) - conn._request = ({headers}) => { - expect(headers).to.have.a.property('x-arango-version', 99999) - done() - } - conn.request({headers: {}}) - }) - it('does not overwrite explicit headers', (done) => { + }); + conn._request = ({ headers }) => { + expect(headers).to.have.a.property("x-one", "1"); + expect(headers).to.have.a.property("x-two", "2"); + done(); + }; + conn.request({ headers: {} }); + }); + }); + describe("with an arangoVersion", () => { + it("sets the x-arango-version header", done => { + const conn = new Connection({ arangoVersion: 99999 }); + conn._request = ({ headers }) => { + expect(headers).to.have.a.property("x-arango-version", 99999); + done(); + }; + conn.request({ headers: {} }); + }); + it("does not overwrite explicit headers", done => { const conn = new Connection({ arangoVersion: 99999, - headers: {'x-arango-version': 66666} - }) - conn._request = ({headers}) => { - expect(headers).to.have.a.property('x-arango-version', 66666) - done() - } - conn.request({headers: {}}) - }) - }) - describe('with agentOptions', () => { - const _httpAgent = http.Agent - const _httpsAgent = https.Agent - let protocol - let options + headers: { "x-arango-version": 66666 } + }); + conn._request = ({ headers }) => { + expect(headers).to.have.a.property("x-arango-version", 66666); + done(); + }; + conn.request({ headers: {} }); + }); + }); + describe("with agentOptions", () => { + const _httpAgent = http.Agent; + const _httpsAgent = https.Agent; + let protocol; + let options; beforeEach(() => { - protocol = undefined - options = undefined - }) + protocol = undefined; + options = undefined; + }); before(() => { - let Agent = (ptcl) => (opts) => { - protocol = ptcl - options = opts - return () => null - } - http.Agent = Agent('http') - https.Agent = Agent('https') - }) + let Agent = ptcl => opts => { + protocol = ptcl; + options = opts; + return () => null; + }; + http.Agent = Agent("http"); + https.Agent = Agent("https"); + }); after(() => { - http.Agent = _httpAgent - https.Agent = _httpsAgent - }) - it('passes the agentOptions to the agent', () => { - new Connection({agentOptions: {hello: 'world'}}) // eslint-disable-line no-new - expect(options).to.have.a.property('hello', 'world') - }) - it('uses the built-in agent for the protocol', () => { + http.Agent = _httpAgent; + https.Agent = _httpsAgent; + }); + it("passes the agentOptions to the agent", () => { + new Connection({ agentOptions: { hello: "world" } }); // eslint-disable-line no-new + expect(options).to.have.a.property("hello", "world"); + }); + it("uses the built-in agent for the protocol", () => { // default: http - new Connection() // eslint-disable-line no-new - expect(protocol).to.equal('http') - new Connection('https://localhost:8529') // eslint-disable-line no-new - expect(protocol).to.equal('https') - new Connection('http://localhost:8529') // eslint-disable-line no-new - expect(protocol).to.equal('http') - }) - }) - describe('with agent', () => { - const _httpRequest = http.request - const _httpsRequest = https.request - let protocol - let options + new Connection(); // eslint-disable-line no-new + expect(protocol).to.equal("http"); + new Connection("https://localhost:8529"); // eslint-disable-line no-new + expect(protocol).to.equal("https"); + new Connection("http://localhost:8529"); // eslint-disable-line no-new + expect(protocol).to.equal("http"); + }); + }); + describe("with agent", () => { + const _httpRequest = http.request; + const _httpsRequest = https.request; + let protocol; + let options; beforeEach(() => { - protocol = undefined - options = undefined - }) + protocol = undefined; + options = undefined; + }); before(() => { - let Request = (ptcl) => (opts) => { - protocol = ptcl - options = opts + let Request = ptcl => opts => { + protocol = ptcl; + options = opts; return { - on () { - return this + on() { + return this; }, - end () { - return this + end() { + return this; } - } - } - http.request = Request('http') - https.request = Request('https') - }) + }; + }; + http.request = Request("http"); + https.request = Request("https"); + }); after(() => { - http.request = _httpRequest - https.request = _httpsRequest - }) - it('passes the agent to the request function', () => { - let agent = 1 - let conn - conn = new Connection({agent}) // default: http - conn.request({headers: {}}) - expect(options).to.have.a.property('agent', agent) - agent++ - conn = new Connection({agent, url: 'https://localhost:8529'}) - conn.request({headers: {}}) - expect(options).to.have.a.property('agent', agent) - agent++ - conn = new Connection({agent, url: 'http://localhost:8529'}) - conn.request({headers: {}}) - expect(options).to.have.a.property('agent', agent) - }) - it('uses the request function for the protocol', () => { - const agent = 1 - let conn - conn = new Connection({agent}) // default: http - conn.request({headers: {}}) - expect(protocol).to.equal('http') - conn = new Connection({agent, url: 'https://localhost:8529'}) - conn.request({headers: {}}) - expect(protocol).to.equal('https') - conn = new Connection({agent, url: 'http://localhost:8529'}) - conn.request({headers: {}}) - expect(protocol).to.equal('http') - }) - }) -}) + http.request = _httpRequest; + https.request = _httpsRequest; + }); + it("passes the agent to the request function", () => { + let agent = 1; + let conn; + conn = new Connection({ agent }); // default: http + conn.request({ headers: {} }); + expect(options).to.have.a.property("agent", agent); + agent++; + conn = new Connection({ agent, url: "https://localhost:8529" }); + conn.request({ headers: {} }); + expect(options).to.have.a.property("agent", agent); + agent++; + conn = new Connection({ agent, url: "http://localhost:8529" }); + conn.request({ headers: {} }); + expect(options).to.have.a.property("agent", agent); + }); + it("uses the request function for the protocol", () => { + const agent = 1; + let conn; + conn = new Connection({ agent }); // default: http + conn.request({ headers: {} }); + expect(protocol).to.equal("http"); + conn = new Connection({ agent, url: "https://localhost:8529" }); + conn.request({ headers: {} }); + expect(protocol).to.equal("https"); + conn = new Connection({ agent, url: "http://localhost:8529" }); + conn.request({ headers: {} }); + expect(protocol).to.equal("http"); + }); + }); +}); diff --git a/test/01-manipulating-databases.js b/test/01-manipulating-databases.js index e237ceb41..1e01ab2d7 100644 --- a/test/01-manipulating-databases.js +++ b/test/01-manipulating-databases.js @@ -1,170 +1,193 @@ -import {describe, it, beforeEach, afterEach} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' -import ArangoError from '../src/error' +import { afterEach, beforeEach, describe, it } from "mocha"; -const range = (n) => Array.from(Array(n).keys()) +import ArangoError from "../src/error"; +import { Database } from "../src"; +import { expect } from "chai"; -describe('Manipulating databases', () => { - let db +const range = n => Array.from(Array(n).keys()); + +describe("Manipulating databases", () => { + let db; beforeEach(() => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - }) - describe('database.useDatabase', () => { - it('updates the database name', () => { - const name = 'example' - expect(db.name).to.equal('_system') // default - db.useDatabase(name) - expect(db._connection.config).to.have.a.property('databaseName', name) - expect(db.name).to.equal(name) - }) - it('returns itself', () => { - const db2 = db.useDatabase('nope') - expect(db).to.equal(db2) - }) - }) - describe('database.createDatabase', () => { - let name = `testdb_${Date.now()}` - afterEach((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + }); + }); + describe("database.useDatabase", () => { + it("updates the database name", () => { + const name = "example"; + expect(db.name).to.equal("_system"); // default + db.useDatabase(name); + expect(db._connection.config).to.have.a.property("databaseName", name); + expect(db.name).to.equal(name); + }); + it("returns itself", () => { + const db2 = db.useDatabase("nope"); + expect(db).to.equal(db2); + }); + }); + describe("database.createDatabase", () => { + let name = `testdb_${Date.now()}`; + afterEach(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - it('creates a database with the given name', (done) => { - db.createDatabase(name) + .catch(done); + }); + it("creates a database with the given name", done => { + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - return db.get() + db.useDatabase(name); + return db.get(); }) - .then((info) => { - expect(info.name).to.equal(name) - done() + .then(info => { + expect(info.name).to.equal(name); + done(); }) - .catch(done) - }) - it('adds the given users to the database') - }) - describe('database.get', () => { - it('fetches the database description if the database exists', (done) => { - db.get() - .then((info) => { - expect(info.name).to.equal(db.name) - expect(db.name).to.equal('_system') - done() + .catch(done); + }); + it("adds the given users to the database"); + }); + describe("database.get", () => { + it("fetches the database description if the database exists", done => { + db + .get() + .then(info => { + expect(info.name).to.equal(db.name); + expect(db.name).to.equal("_system"); + done(); }) - .catch(done) - }) - it('fails if the database does not exist', (done) => { - db.useDatabase('__does_not_exist__') - db.get() + .catch(done); + }); + it("fails if the database does not exist", done => { + db.useDatabase("__does_not_exist__"); + db + .get() .then( - () => Promise.reject(new Error('Should not succeed')), - (err) => { - expect(err).to.be.an.instanceof(ArangoError) - done() + () => Promise.reject(new Error("Should not succeed")), + err => { + expect(err).to.be.an.instanceof(ArangoError); + done(); } - ) - .catch(done) - }) - }) - describe('database.listDatabases', () => { - it('returns a list of all databases', (done) => { - db.listDatabases() - .then((databases) => { - expect(databases).to.be.an.instanceof(Array) - expect(databases.indexOf('_system')).to.be.greaterThan(-1) - done() + ) + .catch(done); + }); + }); + describe("database.listDatabases", () => { + it("returns a list of all databases", done => { + db + .listDatabases() + .then(databases => { + expect(databases).to.be.an.instanceof(Array); + expect(databases.indexOf("_system")).to.be.greaterThan(-1); + done(); }) - .catch(done) - }) - }) - describe('database.listUserDatabases', () => { - it('returns a list of databases accessible to the active user') - }) - describe('database.dropDatabase', () => { - let name = `testdb_${Date.now()}` - beforeEach((done) => { - db.createDatabase(name) + .catch(done); + }); + }); + describe("database.listUserDatabases", () => { + it("returns a list of databases accessible to the active user"); + }); + describe("database.dropDatabase", () => { + let name = `testdb_${Date.now()}`; + beforeEach(done => { + db + .createDatabase(name) .then(() => void done()) - .catch(done) - }) - it('deletes the given database from the server', (done) => { - db.dropDatabase(name) - .then(() => new Database({databaseName: name}).get()) - .then( - () => Promise.reject(new Error('Should not succeed')), - () => null - ) + .catch(done); + }); + it("deletes the given database from the server", done => { + db + .dropDatabase(name) + .then(() => new Database({ databaseName: name }).get()) + .then(() => Promise.reject(new Error("Should not succeed")), () => null) .then(() => void done()) - .catch(done) - }) - }) - describe('database.truncate', () => { - let name = `testdb_${Date.now()}` - let nonSystemCollections = range(4).map((i) => `c_${Date.now()}_${i}`) - let systemCollections = range(4).map((i) => `_c_${Date.now()}_${i}`) - beforeEach((done) => { - db.createDatabase(name) + .catch(done); + }); + }); + describe("database.truncate", () => { + let name = `testdb_${Date.now()}`; + let nonSystemCollections = range(4).map(i => `c_${Date.now()}_${i}`); + let systemCollections = range(4).map(i => `_c_${Date.now()}_${i}`); + beforeEach(done => { + db + .createDatabase(name) .then(() => { - db.useDatabase(name) + db.useDatabase(name); return Promise.all([ - ...nonSystemCollections.map((name) => { - let collection = db.collection(name) - return collection.create() - .then(() => collection.save({_key: 'example'})) + ...nonSystemCollections.map(name => { + let collection = db.collection(name); + return collection + .create() + .then(() => collection.save({ _key: "example" })); }), - ...systemCollections.map((name) => { - let collection = db.collection(name) - return collection.create({isSystem: true}) - .then(() => collection.save({_key: 'example'})) + ...systemCollections.map(name => { + let collection = db.collection(name); + return collection + .create({ isSystem: true }) + .then(() => collection.save({ _key: "example" })); }) - ]) + ]); }) .then(() => void done()) - .catch(done) - }) - afterEach((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + afterEach(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - it('removes all documents from all non-system collections in the database', (done) => { - db.truncate() + .catch(done); + }); + it("removes all documents from all non-system collections in the database", done => { + db + .truncate() .then(() => { return Promise.all([ - ...nonSystemCollections.map( - (name) => db.collection(name).document('example') + ...nonSystemCollections.map(name => + db + .collection(name) + .document("example") .then( - (doc) => Promise.reject(new Error(`Expected document to be destroyed: ${doc._id}`)), - (err) => expect(err).to.be.an.instanceof(ArangoError) - ) + doc => + Promise.reject( + new Error(`Expected document to be destroyed: ${doc._id}`) + ), + err => expect(err).to.be.an.instanceof(ArangoError) + ) ), - ...systemCollections.map( - (name) => db.collection(name).document('example') + ...systemCollections.map(name => + db.collection(name).document("example") ) - ]) + ]); }) .then(() => void done()) - .catch(done) - }) - it('additionally truncates system collections if explicitly passed false', (done) => { - db.truncate(false) + .catch(done); + }); + it("additionally truncates system collections if explicitly passed false", done => { + db + .truncate(false) .then(() => { - return Promise.all(nonSystemCollections.map( - (name) => db.collection(name).document('example') - .then( - (doc) => Promise.reject(new Error(`Expected document to be destroyed: ${doc._id}`)), - (err) => expect(err).to.be.an.instanceof(ArangoError) + return Promise.all( + nonSystemCollections.map(name => + db + .collection(name) + .document("example") + .then( + doc => + Promise.reject( + new Error(`Expected document to be destroyed: ${doc._id}`) + ), + err => expect(err).to.be.an.instanceof(ArangoError) + ) ) - )) + ); }) .then(() => void done()) - .catch(done) - }) - }) -}) + .catch(done); + }); + }); +}); diff --git a/test/02-accessing-collections.js b/test/02-accessing-collections.js index 9898a6c96..11037898f 100644 --- a/test/02-accessing-collections.js +++ b/test/02-accessing-collections.js @@ -1,134 +1,183 @@ -import {describe, it, before, after} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' -import {DocumentCollection, EdgeCollection} from '../src/collection' +import { DocumentCollection, EdgeCollection } from "../src/collection"; +import { after, before, describe, it } from "mocha"; -const range = (n) => Array.from(Array(n).keys()) +import { Database } from "../src"; +import { expect } from "chai"; -describe('Accessing collections', () => { - let name = `testdb_${Date.now()}` - let db - before((done) => { +const range = n => Array.from(Array(n).keys()); + +describe("Accessing collections", () => { + let name = `testdb_${Date.now()}`; + let db; + before(done => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - db.createDatabase(name) + }); + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - done() + db.useDatabase(name); + done(); }) - .catch(done) - }) - after((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + after(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - describe('database.collection', () => { - it('returns a DocumentCollection instance for the collection', () => { - let name = 'potato' - let collection = db.collection(name) - expect(collection).to.be.an.instanceof(DocumentCollection) - expect(collection).to.have.a.property('name').that.equals(name) - }) - }) - describe('database.edgeCollection', () => { - it('returns an EdgeCollection instance for the collection', () => { - let name = 'tomato' - let collection = db.edgeCollection(name) - expect(collection).to.be.an.instanceof(EdgeCollection) - expect(collection).to.have.a.property('name').that.equals(name) - }) - }) - describe('database.listCollections', () => { - let nonSystemCollectionNames = range(4).map((i) => `c_${Date.now()}_${i}`) - let systemCollectionNames = range(4).map((i) => `_c_${Date.now()}_${i}`) - before((done) => { + .catch(done); + }); + describe("database.collection", () => { + it("returns a DocumentCollection instance for the collection", () => { + let name = "potato"; + let collection = db.collection(name); + expect(collection).to.be.an.instanceof(DocumentCollection); + expect(collection) + .to.have.a.property("name") + .that.equals(name); + }); + }); + describe("database.edgeCollection", () => { + it("returns an EdgeCollection instance for the collection", () => { + let name = "tomato"; + let collection = db.edgeCollection(name); + expect(collection).to.be.an.instanceof(EdgeCollection); + expect(collection) + .to.have.a.property("name") + .that.equals(name); + }); + }); + describe("database.listCollections", () => { + let nonSystemCollectionNames = range(4).map(i => `c_${Date.now()}_${i}`); + let systemCollectionNames = range(4).map(i => `_c_${Date.now()}_${i}`); + before(done => { Promise.all([ - ...nonSystemCollectionNames.map((name) => db.collection(name).create()), - ...systemCollectionNames.map((name) => db.collection(name).create({isSystem: true})) + ...nonSystemCollectionNames.map(name => db.collection(name).create()), + ...systemCollectionNames.map(name => + db.collection(name).create({ isSystem: true }) + ) ]) .then(() => void done()) - .catch(done) - }) - after((done) => { + .catch(done); + }); + after(done => { Promise.all([ - ...nonSystemCollectionNames.map((name) => db.collection(name).drop()), - ...systemCollectionNames.map((name) => db.collection(name).drop({isSystem: true})) + ...nonSystemCollectionNames.map(name => db.collection(name).drop()), + ...systemCollectionNames.map(name => + db.collection(name).drop({ isSystem: true }) + ) ]) .then(() => void done()) - .catch(done) - }) - it('fetches information about all non-system collections', (done) => { - db.listCollections() - .then((collections) => { - expect(collections.length).to.equal(nonSystemCollectionNames.length) - expect(collections.map((c) => c.name)).to.include.all.members(nonSystemCollectionNames) - done() + .catch(done); + }); + it("fetches information about all non-system collections", done => { + db + .listCollections() + .then(collections => { + expect(collections.length).to.equal(nonSystemCollectionNames.length); + expect(collections.map(c => c.name)).to.include.all.members( + nonSystemCollectionNames + ); + done(); }) - .catch(done) - }) - it('includes system collections if explicitly passed false', (done) => { - db.listCollections(false) - .then((collections) => { - let allCollectionNames = nonSystemCollectionNames.concat(systemCollectionNames) - expect(collections.length).to.be.at.least(allCollectionNames.length) - expect(collections.map((c) => c.name)).to.include.all.members(allCollectionNames) - done() + .catch(done); + }); + it("includes system collections if explicitly passed false", done => { + db + .listCollections(false) + .then(collections => { + let allCollectionNames = nonSystemCollectionNames.concat( + systemCollectionNames + ); + expect(collections.length).to.be.at.least(allCollectionNames.length); + expect(collections.map(c => c.name)).to.include.all.members( + allCollectionNames + ); + done(); }) - .catch(done) - }) - }) - describe('database.collections', () => { - let documentCollectionNames = range(4).map((i) => `dc_${Date.now()}_${i}`) - let edgeCollectionNames = range(4).map((i) => `ec_${Date.now()}_${i}`) - let systemCollectionNames = range(4).map((i) => `_c_${Date.now()}_${i}`) - before((done) => { + .catch(done); + }); + }); + describe("database.collections", () => { + let documentCollectionNames = range(4).map(i => `dc_${Date.now()}_${i}`); + let edgeCollectionNames = range(4).map(i => `ec_${Date.now()}_${i}`); + let systemCollectionNames = range(4).map(i => `_c_${Date.now()}_${i}`); + before(done => { Promise.all([ - ...documentCollectionNames.map((name) => db.collection(name).create()), - ...edgeCollectionNames.map((name) => db.edgeCollection(name).create()), - ...systemCollectionNames.map((name) => db.collection(name).create({isSystem: true})) + ...documentCollectionNames.map(name => db.collection(name).create()), + ...edgeCollectionNames.map(name => db.edgeCollection(name).create()), + ...systemCollectionNames.map(name => + db.collection(name).create({ isSystem: true }) + ) ]) .then(() => void done()) - .catch(done) - }) - after((done) => { + .catch(done); + }); + after(done => { Promise.all([ - ...documentCollectionNames.map((name) => db.collection(name).drop()), - ...edgeCollectionNames.map((name) => db.edgeCollection(name).drop()), - ...systemCollectionNames.map((name) => db.collection(name).drop({isSystem: true})) + ...documentCollectionNames.map(name => db.collection(name).drop()), + ...edgeCollectionNames.map(name => db.edgeCollection(name).drop()), + ...systemCollectionNames.map(name => + db.collection(name).drop({ isSystem: true }) + ) ]) .then(() => void done()) - .catch(done) - }) - it('creates DocumentCollection and EdgeCollection instances', (done) => { - db.collections() - .then((collections) => { - let documentCollections = collections.filter((c) => c instanceof DocumentCollection) - let edgeCollections = collections.filter((c) => c instanceof EdgeCollection) - expect(documentCollections.length).to.equal(documentCollectionNames.length) - expect(documentCollections.map((c) => c.name)).to.include.all.members(documentCollectionNames) - expect(edgeCollections.length).to.equal(edgeCollectionNames.length) - expect(edgeCollections.map((c) => c.name)).to.include.all.members(edgeCollectionNames) - done() + .catch(done); + }); + it("creates DocumentCollection and EdgeCollection instances", done => { + db + .collections() + .then(collections => { + let documentCollections = collections.filter( + c => c instanceof DocumentCollection + ); + let edgeCollections = collections.filter( + c => c instanceof EdgeCollection + ); + expect(documentCollections.length).to.equal( + documentCollectionNames.length + ); + expect(documentCollections.map(c => c.name)).to.include.all.members( + documentCollectionNames + ); + expect(edgeCollections.length).to.equal(edgeCollectionNames.length); + expect(edgeCollections.map(c => c.name)).to.include.all.members( + edgeCollectionNames + ); + done(); }) - .catch(done) - }) - it('includes system collections if explicitly passed false', (done) => { - db.collections(false) - .then((collections) => { - let documentCollections = collections.filter((c) => c instanceof DocumentCollection) - let edgeCollections = collections.filter((c) => c instanceof EdgeCollection) - let allDocumentCollectionNames = documentCollectionNames.concat(systemCollectionNames) - expect(documentCollections.length).to.be.at.least(allDocumentCollectionNames.length) - expect(documentCollections.map((c) => c.name)).to.include.all.members(allDocumentCollectionNames) - expect(edgeCollections.length).to.be.at.least(edgeCollectionNames.length) - expect(edgeCollections.map((c) => c.name)).to.include.all.members(edgeCollectionNames) - done() + .catch(done); + }); + it("includes system collections if explicitly passed false", done => { + db + .collections(false) + .then(collections => { + let documentCollections = collections.filter( + c => c instanceof DocumentCollection + ); + let edgeCollections = collections.filter( + c => c instanceof EdgeCollection + ); + let allDocumentCollectionNames = documentCollectionNames.concat( + systemCollectionNames + ); + expect(documentCollections.length).to.be.at.least( + allDocumentCollectionNames.length + ); + expect(documentCollections.map(c => c.name)).to.include.all.members( + allDocumentCollectionNames + ); + expect(edgeCollections.length).to.be.at.least( + edgeCollectionNames.length + ); + expect(edgeCollections.map(c => c.name)).to.include.all.members( + edgeCollectionNames + ); + done(); }) - .catch(done) - }) - }) -}) + .catch(done); + }); + }); +}); diff --git a/test/03-accessing-graphs.js b/test/03-accessing-graphs.js index 5942f491d..54e2dd84e 100644 --- a/test/03-accessing-graphs.js +++ b/test/03-accessing-graphs.js @@ -1,116 +1,139 @@ -import {describe, it, before, after} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' -import Graph from '../src/graph' +import { after, before, describe, it } from "mocha"; -const range = (n) => Array.from(Array(n).keys()) +import { Database } from "../src"; +import Graph from "../src/graph"; +import { expect } from "chai"; -describe('Accessing graphs', () => { - let name = `testdb_${Date.now()}` - let db - before((done) => { +const range = n => Array.from(Array(n).keys()); + +describe("Accessing graphs", () => { + let name = `testdb_${Date.now()}`; + let db; + before(done => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - db.createDatabase(name) + }); + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - done() + db.useDatabase(name); + done(); }) - .catch(done) - }) - after((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + after(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - describe('database.graph', () => { - it('returns a Graph instance', () => { - let name = 'potato' - let graph = db.graph(name) - expect(graph).to.be.an.instanceof(Graph) - expect(graph).to.have.a.property('name').that.equals(name) - }) - }) - describe('database.listGraphs', () => { - let vertexCollectionNames = range(2).map((i) => `vc_${Date.now()}_${i}`) - let edgeCollectionNames = range(2).map((i) => `ec_${Date.now()}_${i}`) - let graphNames = range(4).map((i) => `g_${Date.now()}_${i}`) - before((done) => { + .catch(done); + }); + describe("database.graph", () => { + it("returns a Graph instance", () => { + let name = "potato"; + let graph = db.graph(name); + expect(graph).to.be.an.instanceof(Graph); + expect(graph) + .to.have.a.property("name") + .that.equals(name); + }); + }); + describe("database.listGraphs", () => { + let vertexCollectionNames = range(2).map(i => `vc_${Date.now()}_${i}`); + let edgeCollectionNames = range(2).map(i => `ec_${Date.now()}_${i}`); + let graphNames = range(4).map(i => `g_${Date.now()}_${i}`); + before(done => { Promise.all([ - ...vertexCollectionNames.map((name) => db.collection(name).create()), - ...edgeCollectionNames.map((name) => db.edgeCollection(name).create()) + ...vertexCollectionNames.map(name => db.collection(name).create()), + ...edgeCollectionNames.map(name => db.edgeCollection(name).create()) ]) - .then(() => Promise.all([ - ...graphNames.map((name) => db.graph(name).create({ - edgeDefinitions: edgeCollectionNames.map((name) => ({ - collection: name, - from: vertexCollectionNames, - to: vertexCollectionNames - })) - })) - ])) + .then(() => + Promise.all([ + ...graphNames.map(name => + db.graph(name).create({ + edgeDefinitions: edgeCollectionNames.map(name => ({ + collection: name, + from: vertexCollectionNames, + to: vertexCollectionNames + })) + }) + ) + ]) + ) .then(() => void done()) - .catch(done) - }) - after((done) => { - Promise.all(graphNames.map((name) => db.graph(name).drop())) - .then(() => Promise.all(vertexCollectionNames.concat(edgeCollectionNames).map( - (name) => db.collection(name).drop() - ))) + .catch(done); + }); + after(done => { + Promise.all(graphNames.map(name => db.graph(name).drop())) + .then(() => + Promise.all( + vertexCollectionNames + .concat(edgeCollectionNames) + .map(name => db.collection(name).drop()) + ) + ) .then(() => void done()) - .catch(done) - }) - it('fetches information about all graphs', (done) => { - db.listGraphs() - .then((graphs) => { - expect(graphs.length).to.equal(graphNames.length) - expect(graphs.map((g) => g._key)).to.include.all.members(graphNames) - done() + .catch(done); + }); + it("fetches information about all graphs", done => { + db + .listGraphs() + .then(graphs => { + expect(graphs.length).to.equal(graphNames.length); + expect(graphs.map(g => g._key)).to.include.all.members(graphNames); + done(); }) - .catch(done) - }) - }) - describe('database.graphs', () => { - let vertexCollectionNames = range(2).map((i) => `vc_${Date.now()}_${i}`) - let edgeCollectionNames = range(2).map((i) => `ec_${Date.now()}_${i}`) - let graphNames = range(4).map((i) => `g_${Date.now()}_${i}`) - before((done) => { + .catch(done); + }); + }); + describe("database.graphs", () => { + let vertexCollectionNames = range(2).map(i => `vc_${Date.now()}_${i}`); + let edgeCollectionNames = range(2).map(i => `ec_${Date.now()}_${i}`); + let graphNames = range(4).map(i => `g_${Date.now()}_${i}`); + before(done => { Promise.all([ - ...vertexCollectionNames.map((name) => db.collection(name).create()), - ...edgeCollectionNames.map((name) => db.edgeCollection(name).create()) + ...vertexCollectionNames.map(name => db.collection(name).create()), + ...edgeCollectionNames.map(name => db.edgeCollection(name).create()) ]) - .then(() => Promise.all([ - ...graphNames.map((name) => db.graph(name).create({ - edgeDefinitions: edgeCollectionNames.map((name) => ({ - collection: name, - from: vertexCollectionNames, - to: vertexCollectionNames - })) - })) - ])) + .then(() => + Promise.all([ + ...graphNames.map(name => + db.graph(name).create({ + edgeDefinitions: edgeCollectionNames.map(name => ({ + collection: name, + from: vertexCollectionNames, + to: vertexCollectionNames + })) + }) + ) + ]) + ) .then(() => void done()) - .catch(done) - }) - after((done) => { - Promise.all(graphNames.map((name) => db.graph(name).drop())) - .then(() => Promise.all(vertexCollectionNames.concat(edgeCollectionNames).map( - (name) => db.collection(name).drop() - ))) + .catch(done); + }); + after(done => { + Promise.all(graphNames.map(name => db.graph(name).drop())) + .then(() => + Promise.all( + vertexCollectionNames + .concat(edgeCollectionNames) + .map(name => db.collection(name).drop()) + ) + ) .then(() => void done()) - .catch(done) - }) - it('creates Graph instances', (done) => { - db.graphs() - .then((graphs) => { - expect(graphs.length).to.equal(graphNames.length) - expect(graphs.map((g) => g.name)).to.include.all.members(graphNames) - graphs.forEach((graph) => expect(graph).to.be.an.instanceof(Graph)) - done() + .catch(done); + }); + it("creates Graph instances", done => { + db + .graphs() + .then(graphs => { + expect(graphs.length).to.equal(graphNames.length); + expect(graphs.map(g => g.name)).to.include.all.members(graphNames); + graphs.forEach(graph => expect(graph).to.be.an.instanceof(Graph)); + done(); }) - .catch(done) - }) - }) -}) + .catch(done); + }); + }); +}); diff --git a/test/04-transactions.js b/test/04-transactions.js index 736ef3314..5324aeaf1 100644 --- a/test/04-transactions.js +++ b/test/04-transactions.js @@ -1,7 +1,7 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('Transactions', () => { - describe('database.transaction', () => { - it('is missing tests') - }) -}) +describe("Transactions", () => { + describe("database.transaction", () => { + it("is missing tests"); + }); +}); diff --git a/test/05-aql-queries.js b/test/05-aql-queries.js index c62fa186c..5d78a759f 100644 --- a/test/05-aql-queries.js +++ b/test/05-aql-queries.js @@ -1,131 +1,174 @@ -import {describe, it, before, after} from 'mocha' -import {expect} from 'chai' -import {aqlQuery, Database} from '../src' -import Cursor from '../src/cursor' +import { Database, aqlQuery } from "../src"; +import { after, before, describe, it } from "mocha"; -describe('AQL queries', () => { - let name = `testdb_${Date.now()}` - let db - before((done) => { +import Cursor from "../src/cursor"; +import { expect } from "chai"; + +describe("AQL queries", () => { + let name = `testdb_${Date.now()}`; + let db; + before(done => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - db.createDatabase(name) + }); + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - done() + db.useDatabase(name); + done(); }) - .catch(done) - }) - after((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + after(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - describe('database.query', () => { - it('returns a cursor for the query result', (done) => { - db.query('RETURN 23') - .then((cursor) => { - expect(cursor).to.be.an.instanceof(Cursor) - done() + .catch(done); + }); + describe("database.query", () => { + it("returns a cursor for the query result", done => { + db + .query("RETURN 23") + .then(cursor => { + expect(cursor).to.be.an.instanceof(Cursor); + done(); + }) + .catch(done); + }); + it("supports bindVars", done => { + db + .query("RETURN @x", { x: 5 }) + .then(cursor => cursor.next()) + .then(value => { + expect(value).to.equal(5); + done(); }) - .catch(done) - }) - it('supports bindVars', (done) => { - db.query('RETURN @x', {x: 5}) - .then((cursor) => cursor.next()) - .then((value) => { - expect(value).to.equal(5) - done() + .catch(done); + }); + it("supports options", done => { + db + .query("FOR x IN 1..10 RETURN x", undefined, { + batchSize: 2, + count: true }) - .catch(done) - }) - it('supports options', (done) => { - db.query('FOR x IN 1..10 RETURN x', undefined, {batchSize: 2, count: true}) - .then((cursor) => { - expect(cursor.count).to.equal(10) - expect(cursor._hasMore).to.equal(true) - done() + .then(cursor => { + expect(cursor.count).to.equal(10); + expect(cursor._hasMore).to.equal(true); + done(); }) - .catch(done) - }) - it('supports AQB queries', (done) => { - db.query({toAQL: () => 'RETURN 42'}) - .then((cursor) => cursor.next()) - .then((value) => { - expect(value).to.equal(42) - done() + .catch(done); + }); + it("supports AQB queries", done => { + db + .query({ toAQL: () => "RETURN 42" }) + .then(cursor => cursor.next()) + .then(value => { + expect(value).to.equal(42); + done(); }) - .catch(done) - }) - it('supports query objects', (done) => { - db.query({query: 'RETURN 1337'}) - .then((cursor) => cursor.next()) - .then((value) => { - expect(value).to.equal(1337) - done() + .catch(done); + }); + it("supports query objects", done => { + db + .query({ query: "RETURN 1337" }) + .then(cursor => cursor.next()) + .then(value => { + expect(value).to.equal(1337); + done(); }) - .catch(done) - }) - it('supports compact queries', (done) => { - db.query({query: 'RETURN @potato', bindVars: {potato: 'tomato'}}) - .then((cursor) => cursor.next()) - .then((value) => { - expect(value).to.equal('tomato') - done() + .catch(done); + }); + it("supports compact queries", done => { + db + .query({ query: "RETURN @potato", bindVars: { potato: "tomato" } }) + .then(cursor => cursor.next()) + .then(value => { + expect(value).to.equal("tomato"); + done(); }) - .catch(done) - }) - it('supports compact queries with options', (done) => { - let aql = {query: 'FOR x IN RANGE(1, @max) RETURN x', bindVars: {max: 10}} - db.query(aql, {batchSize: 2, count: true}) - .then((cursor) => { - expect(cursor.count).to.equal(10) - expect(cursor._hasMore).to.equal(true) - done() + .catch(done); + }); + it("supports compact queries with options", done => { + let aql = { + query: "FOR x IN RANGE(1, @max) RETURN x", + bindVars: { max: 10 } + }; + db + .query(aql, { batchSize: 2, count: true }) + .then(cursor => { + expect(cursor.count).to.equal(10); + expect(cursor._hasMore).to.equal(true); + done(); }) - .catch(done) - }) - }) - describe('aqlQuery', () => { - it('correctly handles simple parameters', () => { - let values = [0, 42, -1, null, undefined, true, false, '', 'string', [1, 2, 3], {a: 'b'}] + .catch(done); + }); + }); + describe("aqlQuery", () => { + it("correctly handles simple parameters", () => { + let values = [ + 0, + 42, + -1, + null, + undefined, + true, + false, + "", + "string", + [1, 2, 3], + { a: "b" } + ]; let aql = aqlQuery` - A ${values[0]} B ${values[1]} C ${values[2]} D ${values[3]} E ${values[4]} F ${values[5]} - G ${values[6]} H ${values[7]} I ${values[8]} J ${values[9]} K ${values[10]} EOF - ` + A ${values[0]} B ${values[1]} C ${values[2]} D ${values[3]} E ${ + values[4] + } F ${values[5]} + G ${values[6]} H ${values[7]} I ${values[8]} J ${values[9]} K ${ + values[10] + } EOF + `; expect(aql.query).to.equal(` A @value0 B @value1 C @value2 D @value3 E @value4 F @value5 G @value6 H @value7 I @value8 J @value9 K @value10 EOF - `) - let bindVarNames = Object.keys(aql.bindVars).sort((a, b) => +a.substr(5) > +b.substr(5) ? 1 : -1) + `); + let bindVarNames = Object.keys(aql.bindVars).sort( + (a, b) => (+a.substr(5) > +b.substr(5) ? 1 : -1) + ); expect(bindVarNames).to.eql([ - 'value0', 'value1', 'value2', 'value3', 'value4', 'value5', - 'value6', 'value7', 'value8', 'value9', 'value10' - ]) - expect(bindVarNames.map((k) => aql.bindVars[k])).to.eql(values) - }) - it('correctly handles arangojs collection parameters', () => { - let collection = db.collection('potato') - let aql = aqlQuery`${collection}` - expect(aql.query).to.equal('@@value0') - expect(Object.keys(aql.bindVars)).to.eql(['@value0']) - expect(aql.bindVars['@value0']).to.equal('potato') - }) - it('correctly handles ArangoDB collection parameters', () => { + "value0", + "value1", + "value2", + "value3", + "value4", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10" + ]); + expect(bindVarNames.map(k => aql.bindVars[k])).to.eql(values); + }); + it("correctly handles arangojs collection parameters", () => { + let collection = db.collection("potato"); + let aql = aqlQuery`${collection}`; + expect(aql.query).to.equal("@@value0"); + expect(Object.keys(aql.bindVars)).to.eql(["@value0"]); + expect(aql.bindVars["@value0"]).to.equal("potato"); + }); + it("correctly handles ArangoDB collection parameters", () => { class ArangoCollection { - constructor () { - this.name = 'tomato' + constructor() { + this.name = "tomato"; } } - ArangoCollection.prototype.isArangoCollection = true - let collection = new ArangoCollection() - let aql = aqlQuery`${collection}` - expect(aql.query).to.equal('@@value0') - expect(Object.keys(aql.bindVars)).to.eql(['@value0']) - expect(aql.bindVars['@value0']).to.equal('tomato') - }) - }) -}) + ArangoCollection.prototype.isArangoCollection = true; + let collection = new ArangoCollection(); + let aql = aqlQuery`${collection}`; + expect(aql.query).to.equal("@@value0"); + expect(Object.keys(aql.bindVars)).to.eql(["@value0"]); + expect(aql.bindVars["@value0"]).to.equal("tomato"); + }); + }); +}); diff --git a/test/06-managing-functions.js b/test/06-managing-functions.js index d883e42b6..002663451 100644 --- a/test/06-managing-functions.js +++ b/test/06-managing-functions.js @@ -1,13 +1,13 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('Managing functions', () => { - describe('database.listFunctions', () => { - it('is missing tests') - }) - describe('database.createFunction', () => { - it('is missing tests') - }) - describe('database.dropFunction', () => { - it('is missing tests') - }) -}) +describe("Managing functions", () => { + describe("database.listFunctions", () => { + it("is missing tests"); + }); + describe("database.createFunction", () => { + it("is missing tests"); + }); + describe("database.dropFunction", () => { + it("is missing tests"); + }); +}); diff --git a/test/07-routes.js b/test/07-routes.js index b2e4a02b9..2a81e3e3b 100644 --- a/test/07-routes.js +++ b/test/07-routes.js @@ -1,53 +1,54 @@ -import {describe, it} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' -import Route from '../src/route' +import { describe, it } from "mocha"; -describe('Arbitrary HTTP routes', () => { +import { Database } from "../src"; +import Route from "../src/route"; +import { expect } from "chai"; + +describe("Arbitrary HTTP routes", () => { const db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - describe('database.route', () => { - it('returns a Route instance', () => { - let route = db.route() - expect(route).to.be.an.instanceof(Route) - }) - it('creates a route for the given path', () => { - let path = '/hi' - let route = db.route(path) - expect(route._path).to.equal(path) - }) - it('passes the given headers to the new route', () => { - let route = db.route('/hello', {'x-magic': 'awesome'}) - expect(route._headers).to.have.a.property('x-magic', 'awesome') - }) - }) -}) + }); + describe("database.route", () => { + it("returns a Route instance", () => { + let route = db.route(); + expect(route).to.be.an.instanceof(Route); + }); + it("creates a route for the given path", () => { + let path = "/hi"; + let route = db.route(path); + expect(route._path).to.equal(path); + }); + it("passes the given headers to the new route", () => { + let route = db.route("/hello", { "x-magic": "awesome" }); + expect(route._headers).to.have.a.property("x-magic", "awesome"); + }); + }); +}); -describe('Route API', () => { - describe('route.route', () => { - it('is missing tests') - }) - describe('route.get', () => { - it('is missing tests') - }) - describe('route.post', () => { - it('is missing tests') - }) - describe('route.put', () => { - it('is missing tests') - }) - describe('route.patch', () => { - it('is missing tests') - }) - describe('route.delete', () => { - it('is missing tests') - }) - describe('route.head', () => { - it('is missing tests') - }) - describe('route.request', () => { - it('is missing tests') - }) -}) +describe("Route API", () => { + describe("route.route", () => { + it("is missing tests"); + }); + describe("route.get", () => { + it("is missing tests"); + }); + describe("route.post", () => { + it("is missing tests"); + }); + describe("route.put", () => { + it("is missing tests"); + }); + describe("route.patch", () => { + it("is missing tests"); + }); + describe("route.delete", () => { + it("is missing tests"); + }); + describe("route.head", () => { + it("is missing tests"); + }); + describe("route.request", () => { + it("is missing tests"); + }); +}); diff --git a/test/08-cursors.js b/test/08-cursors.js index fc33216d6..b5f0778c2 100644 --- a/test/08-cursors.js +++ b/test/08-cursors.js @@ -1,261 +1,294 @@ -import {describe, it, before, beforeEach} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' +import { before, beforeEach, describe, it } from "mocha"; -const aqlQuery = 'FOR i In 0..10 RETURN i' -const aqlResult = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +import { Database } from "../src"; +import { expect } from "chai"; -function sleep (ms) { - var date = Date.now() - var curDate = null +const aqlQuery = "FOR i In 0..10 RETURN i"; +const aqlResult = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +function sleep(ms) { + var date = Date.now(); + var curDate = null; do { - curDate = Date.now() - } while (curDate - date < ms) + curDate = Date.now(); + } while (curDate - date < ms); } -describe('Cursor API', () => { - let db - let cursor +describe("Cursor API", () => { + let db; + let cursor; before(() => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - }) - beforeEach((done) => { - db.query(aqlQuery) - .then((c) => { - cursor = c - done() + }); + }); + beforeEach(done => { + db + .query(aqlQuery) + .then(c => { + cursor = c; + done(); }) - .catch(done) - }) - describe('cursor.all', () => { - it('returns an Array of all results', (done) => { - cursor.all() - .then((vals) => { - expect(vals).to.eql(aqlResult) - done() + .catch(done); + }); + describe("cursor.all", () => { + it("returns an Array of all results", done => { + cursor + .all() + .then(vals => { + expect(vals).to.eql(aqlResult); + done(); }) - .catch(done) - }) - }) - describe('cursor.next', () => { - it('returns the next result of the Cursor', (done) => { - cursor.next() - .then((val) => { - expect(val).to.equal(0) - return cursor.next() + .catch(done); + }); + }); + describe("cursor.next", () => { + it("returns the next result of the Cursor", done => { + cursor + .next() + .then(val => { + expect(val).to.equal(0); + return cursor.next(); }) - .then((val) => { - expect(val).to.equal(1) - done() + .then(val => { + expect(val).to.equal(1); + done(); }) - .catch(done) - }) - }) - describe('cursor.hasNext', () => { - it('returns true if the Cursor has more results', (done) => { - expect(cursor.hasNext()).to.equal(true) - cursor.next() - .then((val) => { - expect(val).to.be.a('number') - done() + .catch(done); + }); + }); + describe("cursor.hasNext", () => { + it("returns true if the Cursor has more results", done => { + expect(cursor.hasNext()).to.equal(true); + cursor + .next() + .then(val => { + expect(val).to.be.a("number"); + done(); }) - .catch(done) - }) - it('returns false if the Cursor is empty', (done) => { - cursor.all() + .catch(done); + }); + it("returns false if the Cursor is empty", done => { + cursor + .all() .then(() => { - expect(cursor.hasNext()).to.equal(false) - done() + expect(cursor.hasNext()).to.equal(false); + done(); }) - .catch(done) - }) - it('returns true after first batch is consumed', (done) => { - db.query(aqlQuery, {}, {batchSize: 1}) - .then((cursor) => { - expect(cursor._result.length).to.equal(1) - cursor.next() - expect(cursor._result.length).to.equal(0) - expect(cursor.hasNext()).to.equal(true) - done() - }) - .catch(done) - }) - it('returns false after last batch is consumed', (done) => { - db.query('FOR i In 0..1 RETURN i', {}, {batchSize: 1}) - .then((cursor) => { - expect(cursor.hasNext()).to.equal(true) - expect(cursor._result.length).to.equal(1) - cursor.next().then((val) => { - expect(val).to.equal(0) - expect(cursor.hasNext()).to.equal(true) - expect(cursor._result.length).to.equal(0) - return cursor.next() - }).then((val) => { - expect(val).to.equal(1) - expect(cursor.hasNext()).to.equal(false) - expect(cursor._result.length).to.equal(0) - done() + .catch(done); + }); + it("returns true after first batch is consumed", done => { + db + .query(aqlQuery, {}, { batchSize: 1 }) + .then(cursor => { + expect(cursor._result.length).to.equal(1); + cursor.next(); + expect(cursor._result.length).to.equal(0); + expect(cursor.hasNext()).to.equal(true); + done(); }) - }) - .catch(done) - }) - it('returns false after last result is consumed', (done) => { - db.query('FOR i In 0..1 RETURN i') - .then((cursor) => { - expect(cursor.hasNext()).to.equal(true) - expect(cursor._result.length).to.equal(2) - cursor.next().then((val) => { - expect(val).to.equal(0) - expect(cursor.hasNext()).to.equal(true) - expect(cursor._result.length).to.equal(1) - return cursor.next() - }).then((val) => { - expect(val).to.equal(1) - expect(cursor.hasNext()).to.equal(false) - expect(cursor._result.length).to.equal(0) - done() + .catch(done); + }); + it("returns false after last batch is consumed", done => { + db + .query("FOR i In 0..1 RETURN i", {}, { batchSize: 1 }) + .then(cursor => { + expect(cursor.hasNext()).to.equal(true); + expect(cursor._result.length).to.equal(1); + cursor + .next() + .then(val => { + expect(val).to.equal(0); + expect(cursor.hasNext()).to.equal(true); + expect(cursor._result.length).to.equal(0); + return cursor.next(); + }) + .then(val => { + expect(val).to.equal(1); + expect(cursor.hasNext()).to.equal(false); + expect(cursor._result.length).to.equal(0); + done(); + }); }) - }) - .catch(done) - }) - it.skip('returns 404 after timeout', (done) => { - db.query('FOR i In 0..1 RETURN i', {}, {batchSize: 1, ttl: 1}) - .then((cursor) => { - expect(cursor.hasNext()).to.equal(true) - expect(cursor._result.length).to.equal(1) - cursor.next().then((val) => { - expect(val).to.equal(0) - expect(cursor.hasNext()).to.equal(true) - expect(cursor._result.length).to.equal(0) - sleep(3000) - return cursor.next() - }).catch((err) => { - expect(err.code).to.equal(404) - done() + .catch(done); + }); + it("returns false after last result is consumed", done => { + db + .query("FOR i In 0..1 RETURN i") + .then(cursor => { + expect(cursor.hasNext()).to.equal(true); + expect(cursor._result.length).to.equal(2); + cursor + .next() + .then(val => { + expect(val).to.equal(0); + expect(cursor.hasNext()).to.equal(true); + expect(cursor._result.length).to.equal(1); + return cursor.next(); + }) + .then(val => { + expect(val).to.equal(1); + expect(cursor.hasNext()).to.equal(false); + expect(cursor._result.length).to.equal(0); + done(); + }); + }) + .catch(done); + }); + it.skip("returns 404 after timeout", done => { + db + .query("FOR i In 0..1 RETURN i", {}, { batchSize: 1, ttl: 1 }) + .then(cursor => { + expect(cursor.hasNext()).to.equal(true); + expect(cursor._result.length).to.equal(1); + cursor + .next() + .then(val => { + expect(val).to.equal(0); + expect(cursor.hasNext()).to.equal(true); + expect(cursor._result.length).to.equal(0); + sleep(3000); + return cursor.next(); + }) + .catch(err => { + expect(err.code).to.equal(404); + done(); + }); + }) + .catch(done); + }); + it("returns false after last result is consumed (with large amount of results)", done => { + const EXPECTED_LENGTH = 100000; + const loadMore = function(cursor, totalLength) { + cursor + .next() + .then(() => { + totalLength++; + expect(cursor.hasNext()).to.equal(totalLength !== EXPECTED_LENGTH); + if (cursor.hasNext()) { + loadMore(cursor, totalLength); + } else { + done(); + } + }) + .catch(done); + }; + db + .query(`FOR i In 1..${EXPECTED_LENGTH} RETURN i`) + .then(cursor => loadMore(cursor, 0)) + .catch(done); + }); + }); + describe("cursor.each", () => { + it("invokes the callback for each value", done => { + let results = []; + cursor + .each(value => { + results.push(value); }) - }) - .catch(done) - }) - it('returns false after last result is consumed (with large amount of results)', (done) => { - const EXPECTED_LENGTH = 100000 - const loadMore = function (cursor, totalLength) { - cursor.next().then(() => { - totalLength++ - expect(cursor.hasNext()).to.equal(totalLength !== EXPECTED_LENGTH) - if (cursor.hasNext()) { - loadMore(cursor, totalLength) - } else { - done() - } - }).catch(done) - } - db.query(`FOR i In 1..${EXPECTED_LENGTH} RETURN i`).then((cursor) => loadMore(cursor, 0)).catch(done) - }) - }) - describe('cursor.each', () => { - it('invokes the callback for each value', (done) => { - let results = [] - cursor.each((value) => { - results.push(value) - }) .then(() => { - expect(results).to.eql(aqlResult) - done() + expect(results).to.eql(aqlResult); + done(); + }) + .catch(done); + }); + it("aborts if the callback returns false", done => { + let results = []; + cursor + .each(value => { + results.push(value); + if (value === 5) return false; }) - .catch(done) - }) - it('aborts if the callback returns false', (done) => { - let results = [] - cursor.each((value) => { - results.push(value) - if (value === 5) return false - }) .then(() => { - expect(results).to.eql([0, 1, 2, 3, 4, 5]) - done() + expect(results).to.eql([0, 1, 2, 3, 4, 5]); + done(); }) - .catch(done) - }) - }) - describe('cursor.every', () => { - it('returns true if the callback returns a truthy value for every item', (done) => { - let results = [] - cursor.every((value) => { - if (results.indexOf(value) !== -1) return false - results.push(value) - return true - }) - .then((result) => { - expect(results).to.eql(aqlResult) - expect(result).to.equal(true) - done() + .catch(done); + }); + }); + describe("cursor.every", () => { + it("returns true if the callback returns a truthy value for every item", done => { + let results = []; + cursor + .every(value => { + if (results.indexOf(value) !== -1) return false; + results.push(value); + return true; }) - .catch(done) - }) - it('returns false if the callback returns a non-truthy value for any item', (done) => { - let results = [] - cursor.every((value) => { - results.push(value) - if (value < 5) return true - }) - .then((result) => { - expect(results).to.eql([0, 1, 2, 3, 4, 5]) - expect(result).to.equal(false) - done() + .then(result => { + expect(results).to.eql(aqlResult); + expect(result).to.equal(true); + done(); }) - .catch(done) - }) - }) - describe('cursor.some', () => { - it('returns false if the callback returns a non-truthy value for every item', (done) => { - let results = [] - cursor.some((value) => { - if (results.indexOf(value) !== -1) return true - results.push(value) - return false - }) - .then((result) => { - expect(results).to.eql(aqlResult) - expect(result).to.equal(false) - done() + .catch(done); + }); + it("returns false if the callback returns a non-truthy value for any item", done => { + let results = []; + cursor + .every(value => { + results.push(value); + if (value < 5) return true; }) - .catch(done) - }) - it('returns true if the callback returns a truthy value for any item', (done) => { - let results = [] - cursor.some((value) => { - results.push(value) - if (value >= 5) return true - }) - .then((result) => { - expect(results).to.eql([0, 1, 2, 3, 4, 5]) - expect(result).to.equal(true) - done() + .then(result => { + expect(results).to.eql([0, 1, 2, 3, 4, 5]); + expect(result).to.equal(false); + done(); + }) + .catch(done); + }); + }); + describe("cursor.some", () => { + it("returns false if the callback returns a non-truthy value for every item", done => { + let results = []; + cursor + .some(value => { + if (results.indexOf(value) !== -1) return true; + results.push(value); + return false; + }) + .then(result => { + expect(results).to.eql(aqlResult); + expect(result).to.equal(false); + done(); + }) + .catch(done); + }); + it("returns true if the callback returns a truthy value for any item", done => { + let results = []; + cursor + .some(value => { + results.push(value); + if (value >= 5) return true; + }) + .then(result => { + expect(results).to.eql([0, 1, 2, 3, 4, 5]); + expect(result).to.equal(true); + done(); }) - .catch(done) - }) - }) - describe('cursor.map', () => { - it('maps all result values over the callback', (done) => { - cursor.map((value) => value * 2) - .then((results) => { - expect(results).to.eql(aqlResult.map((value) => value * 2)) - done() + .catch(done); + }); + }); + describe("cursor.map", () => { + it("maps all result values over the callback", done => { + cursor + .map(value => value * 2) + .then(results => { + expect(results).to.eql(aqlResult.map(value => value * 2)); + done(); }) - .catch(done) - }) - }) - describe('cursor.reduce', () => { - it('reduces the result values with the callback', (done) => { - cursor.reduce((a, b) => a + b) - .then((result) => { - expect(result).to.eql(aqlResult.reduce((a, b) => a + b)) - done() + .catch(done); + }); + }); + describe("cursor.reduce", () => { + it("reduces the result values with the callback", done => { + cursor + .reduce((a, b) => a + b) + .then(result => { + expect(result).to.eql(aqlResult.reduce((a, b) => a + b)); + done(); }) - .catch(done) - }) - }) -}) + .catch(done); + }); + }); +}); diff --git a/test/09-collection-metadata.js b/test/09-collection-metadata.js index acf3013d9..c1da9916f 100644 --- a/test/09-collection-metadata.js +++ b/test/09-collection-metadata.js @@ -1,22 +1,22 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('Collection metadata', () => { - describe('collection.get', () => { - it('is missing tests') - }) - describe('collection.properties', () => { - it('is missing tests') - }) - describe('collection.count', () => { - it('is missing tests') - }) - describe('collection.figures', () => { - it('is missing tests') - }) - describe('collection.revision', () => { - it('is missing tests') - }) - describe('collection.checksum', () => { - it('is missing tests') - }) -}) +describe("Collection metadata", () => { + describe("collection.get", () => { + it("is missing tests"); + }); + describe("collection.properties", () => { + it("is missing tests"); + }); + describe("collection.count", () => { + it("is missing tests"); + }); + describe("collection.figures", () => { + it("is missing tests"); + }); + describe("collection.revision", () => { + it("is missing tests"); + }); + describe("collection.checksum", () => { + it("is missing tests"); + }); +}); diff --git a/test/10-manipulating-collections.js b/test/10-manipulating-collections.js index 5f4c81564..3678c066f 100644 --- a/test/10-manipulating-collections.js +++ b/test/10-manipulating-collections.js @@ -1,28 +1,28 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('Manipulating collections', () => { - describe('collection.create', () => { - it('is missing tests') - }) - describe('collection.load', () => { - it('is missing tests') - }) - describe('collection.unload', () => { - it('is missing tests') - }) - describe('collection.setProperties', () => { - it('is missing tests') - }) - describe('collection.rename', () => { - it('is missing tests') - }) - describe('collection.rotate', () => { - it('is missing tests') - }) - describe('collection.truncate', () => { - it('is missing tests') - }) - describe('collection.drop', () => { - it('is missing tests') - }) -}) +describe("Manipulating collections", () => { + describe("collection.create", () => { + it("is missing tests"); + }); + describe("collection.load", () => { + it("is missing tests"); + }); + describe("collection.unload", () => { + it("is missing tests"); + }); + describe("collection.setProperties", () => { + it("is missing tests"); + }); + describe("collection.rename", () => { + it("is missing tests"); + }); + describe("collection.rotate", () => { + it("is missing tests"); + }); + describe("collection.truncate", () => { + it("is missing tests"); + }); + describe("collection.drop", () => { + it("is missing tests"); + }); +}); diff --git a/test/11-managing-indexes.js b/test/11-managing-indexes.js index 4fa8bbcf4..2483ee711 100644 --- a/test/11-managing-indexes.js +++ b/test/11-managing-indexes.js @@ -1,34 +1,34 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('Managing indexes', () => { - describe('collection.createIndex', () => { - it('is missing tests') - }) - describe('collection.createCapConstraint', () => { - it('is missing tests') - }) - describe('collection.createHashIndex', () => { - it('is missing tests') - }) - describe('collection.createSkipList', () => { - it('is missing tests') - }) - describe('collection.createPersistentIndex', () => { - it('is missing tests') - }) - describe('collection.createGeoIndex', () => { - it('is missing tests') - }) - describe('collection.createFulltextIndex', () => { - it('is missing tests') - }) - describe('collection.index', () => { - it('is missing tests') - }) - describe('collection.indexes', () => { - it('is missing tests') - }) - describe('collection.dropIndex', () => { - it('is missing tests') - }) -}) +describe("Managing indexes", () => { + describe("collection.createIndex", () => { + it("is missing tests"); + }); + describe("collection.createCapConstraint", () => { + it("is missing tests"); + }); + describe("collection.createHashIndex", () => { + it("is missing tests"); + }); + describe("collection.createSkipList", () => { + it("is missing tests"); + }); + describe("collection.createPersistentIndex", () => { + it("is missing tests"); + }); + describe("collection.createGeoIndex", () => { + it("is missing tests"); + }); + describe("collection.createFulltextIndex", () => { + it("is missing tests"); + }); + describe("collection.index", () => { + it("is missing tests"); + }); + describe("collection.indexes", () => { + it("is missing tests"); + }); + describe("collection.dropIndex", () => { + it("is missing tests"); + }); +}); diff --git a/test/12-simple-queries.js b/test/12-simple-queries.js index 87fb45686..721fc155c 100644 --- a/test/12-simple-queries.js +++ b/test/12-simple-queries.js @@ -1,178 +1,206 @@ -import {describe, it, before, after, beforeEach, afterEach} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' -import Cursor from '../src/cursor' +import { after, afterEach, before, beforeEach, describe, it } from "mocha"; -const range = (n) => Array.from(Array(n).keys()) -const alpha = (i) => String.fromCharCode('a'.charCodeAt(0) + i) -const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000) -const describe2x = ARANGO_VERSION < 30000 ? describe : describe.skip +import Cursor from "../src/cursor"; +import { Database } from "../src"; +import { expect } from "chai"; -describe('Simple queries', () => { - let name = `testdb_${Date.now()}` - let db - let collection - before((done) => { +const range = n => Array.from(Array(n).keys()); +const alpha = i => String.fromCharCode("a".charCodeAt(0) + i); +const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000); +const describe2x = ARANGO_VERSION < 30000 ? describe : describe.skip; + +describe("Simple queries", () => { + let name = `testdb_${Date.now()}`; + let db; + let collection; + before(done => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: ARANGO_VERSION - }) - db.createDatabase(name) + }); + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - done() + db.useDatabase(name); + done(); }) - .catch(done) - }) - after((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + after(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - beforeEach((done) => { - collection = db.collection(`c_${Date.now()}`) - collection.create() - .then(() => range(10).reduce((p, v) => p.then(() => collection.save({ - _key: alpha(v), - value: v + 1, - group: Math.floor(v / 2) + 1 - })), Promise.resolve())) + .catch(done); + }); + beforeEach(done => { + collection = db.collection(`c_${Date.now()}`); + collection + .create() + .then(() => + range(10).reduce( + (p, v) => + p.then(() => + collection.save({ + _key: alpha(v), + value: v + 1, + group: Math.floor(v / 2) + 1 + }) + ), + Promise.resolve() + ) + ) .then(() => void done()) - .catch(done) - }) - afterEach(function (done) { - this.timeout(10000) - collection.drop() + .catch(done); + }); + afterEach(function(done) { + this.timeout(10000); + collection + .drop() .then(() => void done()) - .catch(done) - }) - describe('collection.all', () => { - it('returns a cursor for all documents in the collection', (done) => { - collection.all() - .then((cursor) => { - expect(cursor).to.be.an.instanceof(Cursor) - expect(cursor.count).to.equal(10) - return cursor.all() + .catch(done); + }); + describe("collection.all", () => { + it("returns a cursor for all documents in the collection", done => { + collection + .all() + .then(cursor => { + expect(cursor).to.be.an.instanceof(Cursor); + expect(cursor.count).to.equal(10); + return cursor.all(); }) - .then((arr) => { - expect(arr).to.have.length(10) - arr.forEach((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'value', 'group') - expect(doc._id).to.equal(`${collection.name}/${doc._key}`) - expect(doc.group).to.equal(Math.floor((doc.value - 1) / 2) + 1) - }) - expect(arr.map((d) => d.value).sort()).to.eql(range(10).map((i) => i + 1).sort()) - expect(arr.map((d) => d._key).sort()).to.eql(range(10).map(alpha).sort()) - done() + .then(arr => { + expect(arr).to.have.length(10); + arr.forEach(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "value", "group"); + expect(doc._id).to.equal(`${collection.name}/${doc._key}`); + expect(doc.group).to.equal(Math.floor((doc.value - 1) / 2) + 1); + }); + expect(arr.map(d => d.value).sort()).to.eql( + range(10) + .map(i => i + 1) + .sort() + ); + expect(arr.map(d => d._key).sort()).to.eql( + range(10) + .map(alpha) + .sort() + ); + done(); }) - .catch(done) - }) - }) - describe('collection.any', () => { - it('returns a random document from the collection', (done) => { - collection.any() - .then((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'value', 'group') - expect(doc._key).to.equal(alpha(doc.value - 1)) - expect(doc._id).to.equal(`${collection.name}/${doc._key}`) - expect(doc.value).to.be.within(1, 10) - expect(doc.group).to.equal(Math.floor((doc.value - 1) / 2) + 1) - done() + .catch(done); + }); + }); + describe("collection.any", () => { + it("returns a random document from the collection", done => { + collection + .any() + .then(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "value", "group"); + expect(doc._key).to.equal(alpha(doc.value - 1)); + expect(doc._id).to.equal(`${collection.name}/${doc._key}`); + expect(doc.value).to.be.within(1, 10); + expect(doc.group).to.equal(Math.floor((doc.value - 1) / 2) + 1); + done(); }) - .catch(done) - }) - }) - describe2x('collection.first', () => { - it('returns the first document in the collection', (done) => { - collection.first() - .then((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'value', 'group') - expect(doc._key).to.equal('a') - expect(doc._id).to.equal(`${collection.name}/${doc._key}`) - expect(doc.value).to.equal(1) - expect(doc.group).to.equal(1) - done() + .catch(done); + }); + }); + describe2x("collection.first", () => { + it("returns the first document in the collection", done => { + collection + .first() + .then(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "value", "group"); + expect(doc._key).to.equal("a"); + expect(doc._id).to.equal(`${collection.name}/${doc._key}`); + expect(doc.value).to.equal(1); + expect(doc.group).to.equal(1); + done(); }) - .catch(done) - }) - }) - describe2x('collection.last', () => { - it('returns the last document in the collection', (done) => { - collection.last() - .then((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'value', 'group') - expect(doc._key).to.equal(alpha(9)) - expect(doc._id).to.equal(`${collection.name}/${doc._key}`) - expect(doc.value).to.equal(10) - expect(doc.group).to.equal(5) - done() + .catch(done); + }); + }); + describe2x("collection.last", () => { + it("returns the last document in the collection", done => { + collection + .last() + .then(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "value", "group"); + expect(doc._key).to.equal(alpha(9)); + expect(doc._id).to.equal(`${collection.name}/${doc._key}`); + expect(doc.value).to.equal(10); + expect(doc.group).to.equal(5); + done(); }) - .catch(done) - }) - }) - describe('collection.byExample', () => { - it('returns all documents matching the example', (done) => { - collection.byExample({group: 2}) - .then((cursor) => { - expect(cursor).to.be.an.instanceof(Cursor) - return cursor.all() + .catch(done); + }); + }); + describe("collection.byExample", () => { + it("returns all documents matching the example", done => { + collection + .byExample({ group: 2 }) + .then(cursor => { + expect(cursor).to.be.an.instanceof(Cursor); + return cursor.all(); }) - .then((arr) => { - expect(arr).to.have.length(2) - arr.forEach((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'value', 'group') - expect(doc._id).to.equal(`${collection.name}/${doc._key}`) - expect(doc.group).to.equal(2) - }) - expect(arr.map((d) => d._key).sort()).to.eql(['c', 'd']) - expect(arr.map((d) => d.value).sort()).to.eql([3, 4]) - done() + .then(arr => { + expect(arr).to.have.length(2); + arr.forEach(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "value", "group"); + expect(doc._id).to.equal(`${collection.name}/${doc._key}`); + expect(doc.group).to.equal(2); + }); + expect(arr.map(d => d._key).sort()).to.eql(["c", "d"]); + expect(arr.map(d => d.value).sort()).to.eql([3, 4]); + done(); }) - .catch(done) - }) - }) - describe('collection.firstExample', () => { - it('returns the first document matching the example', (done) => { - collection.firstExample({group: 2}) - .then((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'value', 'group') - expect(doc._key).to.match(/^[cd]$/) - expect(doc._id).to.equal(`${collection.name}/${doc._key}`) - expect(doc.group).to.equal(2) - done() + .catch(done); + }); + }); + describe("collection.firstExample", () => { + it("returns the first document matching the example", done => { + collection + .firstExample({ group: 2 }) + .then(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "value", "group"); + expect(doc._key).to.match(/^[cd]$/); + expect(doc._id).to.equal(`${collection.name}/${doc._key}`); + expect(doc.group).to.equal(2); + done(); }) - .catch(done) - }) - }) - describe('collection.removeByExample', () => { - it('is missing tests') - }) - describe('collection.replaceByExample', () => { - it('is missing tests') - }) - describe('collection.updateByExample', () => { - it('is missing tests') - }) + .catch(done); + }); + }); + describe("collection.removeByExample", () => { + it("is missing tests"); + }); + describe("collection.replaceByExample", () => { + it("is missing tests"); + }); + describe("collection.updateByExample", () => { + it("is missing tests"); + }); if (ARANGO_VERSION >= 20600) { - describe2x('collection.lookupByKeys', () => { - it('returns the documents with the given keys', (done) => { - collection.lookupByKeys(['b', 'c', 'd']) - .then((arr) => { - expect(arr).to.have.length(3) - arr.forEach((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'value', 'group') - expect(doc._id).to.equal(`${collection.name}/${doc._key}`) - expect(doc.group).to.equal(Math.floor((doc.value - 1) / 2) + 1) - }) - expect(arr.map((d) => d._key)).to.eql(['b', 'c', 'd']) - done() + describe2x("collection.lookupByKeys", () => { + it("returns the documents with the given keys", done => { + collection + .lookupByKeys(["b", "c", "d"]) + .then(arr => { + expect(arr).to.have.length(3); + arr.forEach(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "value", "group"); + expect(doc._id).to.equal(`${collection.name}/${doc._key}`); + expect(doc.group).to.equal(Math.floor((doc.value - 1) / 2) + 1); + }); + expect(arr.map(d => d._key)).to.eql(["b", "c", "d"]); + done(); }) - .catch(done) - }) - }) + .catch(done); + }); + }); } - describe('collection.removeByKeys', () => { - it('is missing tests') - }) -}) + describe("collection.removeByKeys", () => { + it("is missing tests"); + }); +}); diff --git a/test/13-bulk-imports.js b/test/13-bulk-imports.js index c83220062..706ed8cd9 100644 --- a/test/13-bulk-imports.js +++ b/test/13-bulk-imports.js @@ -1,7 +1,7 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('Bulk imports', () => { - describe('collection.import', () => { - it('is missing tests') - }) -}) +describe("Bulk imports", () => { + describe("collection.import", () => { + it("is missing tests"); + }); +}); diff --git a/test/14-document-collections.js b/test/14-document-collections.js index b58785fe3..4873abe59 100644 --- a/test/14-document-collections.js +++ b/test/14-document-collections.js @@ -1,196 +1,260 @@ -import {describe, it, before, after, beforeEach, afterEach} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' +import { after, afterEach, before, beforeEach, describe, it } from "mocha"; -const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000) -const it3x = ARANGO_VERSION >= 30000 ? it : it.skip +import { Database } from "../src"; +import { expect } from "chai"; -describe('DocumentCollection API', () => { - let name = `testdb_${Date.now()}` - let db - let collection - before((done) => { +const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30000); +const it3x = ARANGO_VERSION >= 30000 ? it : it.skip; + +describe("DocumentCollection API", () => { + let name = `testdb_${Date.now()}`; + let db; + let collection; + before(done => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: ARANGO_VERSION - }) - db.createDatabase(name) + }); + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - done() + db.useDatabase(name); + done(); }) - .catch(done) - }) - after((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + after(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - beforeEach((done) => { - collection = db.collection(`c_${Date.now()}`) - collection.create() + .catch(done); + }); + beforeEach(done => { + collection = db.collection(`c_${Date.now()}`); + collection + .create() .then(() => void done()) - .catch(done) - }) - afterEach((done) => { - collection.drop() + .catch(done); + }); + afterEach(done => { + collection + .drop() .then(() => void done()) - .catch(done) - }) - describe('documentCollection.document', () => { - it('is missing tests') - }) - describe('documentCollection.save', () => { - it('creates a document in the collection', (done) => { - let data = {foo: 'bar'} - collection.save(data) - .then((meta) => { - expect(meta).to.be.an('object') - expect(meta).to.have.a.property('_id').that.is.a('string') - expect(meta).to.have.a.property('_rev').that.is.a('string') - expect(meta).to.have.a.property('_key').that.is.a('string') - return collection.document(meta._id) - .then((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'foo') - expect(doc._id).to.equal(meta._id) - expect(doc._key).to.equal(meta._key) - expect(doc._rev).to.equal(meta._rev) - expect(doc.foo).to.equal(data.foo) - }) + .catch(done); + }); + describe("documentCollection.document", () => { + it("is missing tests"); + }); + describe("documentCollection.save", () => { + it("creates a document in the collection", done => { + let data = { foo: "bar" }; + collection + .save(data) + .then(meta => { + expect(meta).to.be.an("object"); + expect(meta) + .to.have.a.property("_id") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_rev") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_key") + .that.is.a("string"); + return collection.document(meta._id).then(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "foo"); + expect(doc._id).to.equal(meta._id); + expect(doc._key).to.equal(meta._key); + expect(doc._rev).to.equal(meta._rev); + expect(doc.foo).to.equal(data.foo); + }); }) .then(() => void done()) - .catch(done) - }) - it('uses the given _key if provided', (done) => { - let data = {potato: 'tomato', _key: 'banana'} - collection.save(data) - .then((meta) => { - expect(meta).to.be.an('object') - expect(meta).to.have.a.property('_id').that.is.a('string') - expect(meta).to.have.a.property('_rev').that.is.a('string') - expect(meta).to.have.a.property('_key').that.equals(data._key) - return collection.document(meta._id) - .then((doc) => { - expect(doc).to.have.keys('_key', '_id', '_rev', 'potato') - expect(doc._id).to.equal(meta._id) - expect(doc._rev).to.equal(meta._rev) - expect(doc._key).to.equal(data._key) - expect(doc.potato).to.equal(data.potato) - }) + .catch(done); + }); + it("uses the given _key if provided", done => { + let data = { potato: "tomato", _key: "banana" }; + collection + .save(data) + .then(meta => { + expect(meta).to.be.an("object"); + expect(meta) + .to.have.a.property("_id") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_rev") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_key") + .that.equals(data._key); + return collection.document(meta._id).then(doc => { + expect(doc).to.have.keys("_key", "_id", "_rev", "potato"); + expect(doc._id).to.equal(meta._id); + expect(doc._rev).to.equal(meta._rev); + expect(doc._key).to.equal(data._key); + expect(doc.potato).to.equal(data.potato); + }); }) .then(() => void done()) - .catch(done) - }) - it3x('returns the document if opts.returnNew is set', (done) => { - let data = {potato: 'tomato'} - let opts = {returnNew: true} - collection.save(data, opts) - .then((meta) => { - expect(meta).to.be.an('object') - expect(meta).to.have.a.property('_id').that.is.a('string') - expect(meta).to.have.a.property('_rev').that.is.a('string') - expect(meta).to.have.a.property('_key').that.is.a('string') - expect(meta.new).to.be.an('object') - expect(meta.new).to.have.a.property('_id').that.is.a('string') - expect(meta.new).to.have.a.property('_rev').that.is.a('string') - expect(meta.new).to.have.a.property('_key').that.is.a('string') - expect(meta.new.potato).to.equal(data.potato) + .catch(done); + }); + it3x("returns the document if opts.returnNew is set", done => { + let data = { potato: "tomato" }; + let opts = { returnNew: true }; + collection + .save(data, opts) + .then(meta => { + expect(meta).to.be.an("object"); + expect(meta) + .to.have.a.property("_id") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_rev") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_key") + .that.is.a("string"); + expect(meta.new).to.be.an("object"); + expect(meta.new) + .to.have.a.property("_id") + .that.is.a("string"); + expect(meta.new) + .to.have.a.property("_rev") + .that.is.a("string"); + expect(meta.new) + .to.have.a.property("_key") + .that.is.a("string"); + expect(meta.new.potato).to.equal(data.potato); }) .then(() => void done()) - .catch(done) - }) - it3x('interprets opts as returnNew if it is a boolean', (done) => { - let data = {potato: 'tomato'} - let opts = true - collection.save(data, opts) - .then((meta) => { - expect(meta).to.be.an('object') - expect(meta).to.have.a.property('_id').that.is.a('string') - expect(meta).to.have.a.property('_rev').that.is.a('string') - expect(meta).to.have.a.property('_key').that.is.a('string') - expect(meta.new).to.be.an('object') - expect(meta.new).to.have.a.property('_id').that.is.a('string') - expect(meta.new).to.have.a.property('_rev').that.is.a('string') - expect(meta.new).to.have.a.property('_key').that.is.a('string') - expect(meta.new.potato).to.equal(data.potato) + .catch(done); + }); + it3x("interprets opts as returnNew if it is a boolean", done => { + let data = { potato: "tomato" }; + let opts = true; + collection + .save(data, opts) + .then(meta => { + expect(meta).to.be.an("object"); + expect(meta) + .to.have.a.property("_id") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_rev") + .that.is.a("string"); + expect(meta) + .to.have.a.property("_key") + .that.is.a("string"); + expect(meta.new).to.be.an("object"); + expect(meta.new) + .to.have.a.property("_id") + .that.is.a("string"); + expect(meta.new) + .to.have.a.property("_rev") + .that.is.a("string"); + expect(meta.new) + .to.have.a.property("_key") + .that.is.a("string"); + expect(meta.new.potato).to.equal(data.potato); }) .then(() => void done()) - .catch(done) - }) - }) - describe('documentCollection.replace', () => { - it('replaces the given document', (done) => { - let doc = {potato: 'tomato'} - collection.save(doc) - .then((meta) => { - delete meta.error - Object.assign(doc, meta) - return collection.replace(doc, {sup: 'dawg'}) + .catch(done); + }); + }); + describe("documentCollection.replace", () => { + it("replaces the given document", done => { + let doc = { potato: "tomato" }; + collection + .save(doc) + .then(meta => { + delete meta.error; + Object.assign(doc, meta); + return collection.replace(doc, { sup: "dawg" }); }) .then(() => collection.document(doc._key)) - .then((data) => { - expect(data).not.to.have.a.property('potato') - expect(data).to.have.a.property('sup').that.equals('dawg') - done() + .then(data => { + expect(data).not.to.have.a.property("potato"); + expect(data) + .to.have.a.property("sup") + .that.equals("dawg"); + done(); }) - .catch(done) - }) - }) - describe('documentCollection.update', () => { - it('updates the given document', (done) => { - let doc = {potato: 'tomato', empty: false} - collection.save(doc) - .then((meta) => { - delete meta.error - Object.assign(doc, meta) - return collection.update(doc, {sup: 'dawg', empty: null}) + .catch(done); + }); + }); + describe("documentCollection.update", () => { + it("updates the given document", done => { + let doc = { potato: "tomato", empty: false }; + collection + .save(doc) + .then(meta => { + delete meta.error; + Object.assign(doc, meta); + return collection.update(doc, { sup: "dawg", empty: null }); }) .then(() => collection.document(doc._key)) - .then((data) => { - expect(data).to.have.a.property('potato').that.equals(doc.potato) - expect(data).to.have.a.property('sup').that.equals('dawg') - expect(data).to.have.a.property('empty').that.equals(null) - done() + .then(data => { + expect(data) + .to.have.a.property("potato") + .that.equals(doc.potato); + expect(data) + .to.have.a.property("sup") + .that.equals("dawg"); + expect(data) + .to.have.a.property("empty") + .that.equals(null); + done(); }) - .catch(done) - }) - it('removes null values if keepNull is explicitly set to false', (done) => { - let doc = {potato: 'tomato', empty: false} - collection.save(doc) - .then((meta) => { - delete meta.error - Object.assign(doc, meta) - return collection.update(doc, {sup: 'dawg', empty: null}, {keepNull: false}) + .catch(done); + }); + it("removes null values if keepNull is explicitly set to false", done => { + let doc = { potato: "tomato", empty: false }; + collection + .save(doc) + .then(meta => { + delete meta.error; + Object.assign(doc, meta); + return collection.update( + doc, + { sup: "dawg", empty: null }, + { keepNull: false } + ); }) .then(() => collection.document(doc._key)) - .then((data) => { - expect(data).to.have.a.property('potato').that.equals(doc.potato) - expect(data).to.have.a.property('sup').that.equals('dawg') - expect(data).not.to.have.a.property('empty') - done() + .then(data => { + expect(data) + .to.have.a.property("potato") + .that.equals(doc.potato); + expect(data) + .to.have.a.property("sup") + .that.equals("dawg"); + expect(data).not.to.have.a.property("empty"); + done(); }) - .catch(done) - }) - }) - describe('documentCollection.remove', () => { - let key = `d_${Date.now()}` - beforeEach((done) => { - collection.save({_key: key}) + .catch(done); + }); + }); + describe("documentCollection.remove", () => { + let key = `d_${Date.now()}`; + beforeEach(done => { + collection + .save({ _key: key }) .then(() => void done()) - .catch(done) - }) - it('deletes the given document', (done) => { - collection.remove(key) + .catch(done); + }); + it("deletes the given document", done => { + collection + .remove(key) .then(() => collection.document(key)) .then( - () => Promise.reject(new Error('Should not succeed')), + () => Promise.reject(new Error("Should not succeed")), () => void done() - ) - .catch(done) - }) - }) - describe('documentCollection.list', () => { - it('is missing tests') - }) -}) + ) + .catch(done); + }); + }); + describe("documentCollection.list", () => { + it("is missing tests"); + }); +}); diff --git a/test/15-edge-collections.js b/test/15-edge-collections.js index 0e1415d1d..a8c3eb74d 100644 --- a/test/15-edge-collections.js +++ b/test/15-edge-collections.js @@ -1,34 +1,34 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('EdgeCollection API', () => { - describe('edgeCollection.edge', () => { - it('is missing tests') - }) - describe('edgeCollection.save', () => { - it('is missing tests') - }) - describe('edgeCollection.edges', () => { - it('is missing tests') - }) - describe('edgeCollection.inEdges', () => { - it('is missing tests') - }) - describe('edgeCollection.outEdges', () => { - it('is missing tests') - }) - describe('edgeCollection.traversal', () => { - it('is missing tests') - }) - describe('edgeCollection.replace', () => { - it('is missing tests') - }) - describe('edgeCollection.update', () => { - it('is missing tests') - }) - describe('edgeCollection.remove', () => { - it('is missing tests') - }) - describe('edgeCollection.list', () => { - it('is missing tests') - }) -}) +describe("EdgeCollection API", () => { + describe("edgeCollection.edge", () => { + it("is missing tests"); + }); + describe("edgeCollection.save", () => { + it("is missing tests"); + }); + describe("edgeCollection.edges", () => { + it("is missing tests"); + }); + describe("edgeCollection.inEdges", () => { + it("is missing tests"); + }); + describe("edgeCollection.outEdges", () => { + it("is missing tests"); + }); + describe("edgeCollection.traversal", () => { + it("is missing tests"); + }); + describe("edgeCollection.replace", () => { + it("is missing tests"); + }); + describe("edgeCollection.update", () => { + it("is missing tests"); + }); + describe("edgeCollection.remove", () => { + it("is missing tests"); + }); + describe("edgeCollection.list", () => { + it("is missing tests"); + }); +}); diff --git a/test/16-graphs.js b/test/16-graphs.js index f865017f1..1d499de50 100644 --- a/test/16-graphs.js +++ b/test/16-graphs.js @@ -1,176 +1,189 @@ -import {describe, it, before, after, beforeEach, afterEach} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' +import { after, afterEach, before, beforeEach, describe, it } from "mocha"; -const range = (n) => Array.from(Array(n).keys()) +import { Database } from "../src"; +import { expect } from "chai"; -function createCollections (db) { - let vertexCollectionNames = range(2).map((i) => `vc_${Date.now()}_${i}`) - let edgeCollectionNames = range(2).map((i) => `ec_${Date.now()}_${i}`) +const range = n => Array.from(Array(n).keys()); + +function createCollections(db) { + let vertexCollectionNames = range(2).map(i => `vc_${Date.now()}_${i}`); + let edgeCollectionNames = range(2).map(i => `ec_${Date.now()}_${i}`); return Promise.all([ - ...vertexCollectionNames.map((name) => db.collection(name).create()), - ...edgeCollectionNames.map((name) => db.edgeCollection(name).create()) - ]) - .then(() => [ - vertexCollectionNames, - edgeCollectionNames - ]) + ...vertexCollectionNames.map(name => db.collection(name).create()), + ...edgeCollectionNames.map(name => db.edgeCollection(name).create()) + ]).then(() => [vertexCollectionNames, edgeCollectionNames]); } -function createGraph (graph, vertexCollectionNames, edgeCollectionNames) { +function createGraph(graph, vertexCollectionNames, edgeCollectionNames) { return graph.create({ - edgeDefinitions: edgeCollectionNames.map((name) => ({ + edgeDefinitions: edgeCollectionNames.map(name => ({ collection: name, from: vertexCollectionNames, to: vertexCollectionNames })) - }) + }); } -describe('Graph API', () => { - let db - let name = `testdb_${Date.now()}` - before((done) => { +describe("Graph API", () => { + let db; + let name = `testdb_${Date.now()}`; + before(done => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - db.createDatabase(name) + }); + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - done() + db.useDatabase(name); + done(); }) - .catch(done) - }) - after((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + after(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - describe('graph.get', () => { - let graph - let collectionNames - before((done) => { - graph = db.graph(`g_${Date.now()}`) + .catch(done); + }); + describe("graph.get", () => { + let graph; + let collectionNames; + before(done => { + graph = db.graph(`g_${Date.now()}`); createCollections(db) - .then((names) => { - collectionNames = names.reduce((a, b) => a.concat(b)) - return createGraph(graph, ...names) + .then(names => { + collectionNames = names.reduce((a, b) => a.concat(b)); + return createGraph(graph, ...names); }) .then(() => void done()) - .catch(done) - }) - after((done) => { - graph.drop() - .then(() => Promise.all( - collectionNames.map((name) => db.collection(name).drop()) - )) + .catch(done); + }); + after(done => { + graph + .drop() + .then(() => + Promise.all(collectionNames.map(name => db.collection(name).drop())) + ) .then(() => void done()) - .catch(done) - }) - it('fetches information about the graph', (done) => { - graph.get() - .then((data) => { - expect(data).to.have.a.property('name', graph.name) - done() + .catch(done); + }); + it("fetches information about the graph", done => { + graph + .get() + .then(data => { + expect(data).to.have.a.property("name", graph.name); + done(); }) - .catch(done) - }) - }) - describe('graph.create', () => { - let edgeCollectionNames - let vertexCollectionNames - before((done) => { + .catch(done); + }); + }); + describe("graph.create", () => { + let edgeCollectionNames; + let vertexCollectionNames; + before(done => { createCollections(db) - .then((names) => { - [vertexCollectionNames, edgeCollectionNames] = names - done() + .then(names => { + [vertexCollectionNames, edgeCollectionNames] = names; + done(); }) - .catch(done) - }) - after((done) => { + .catch(done); + }); + after(done => { Promise.all( - [...edgeCollectionNames, ...vertexCollectionNames] - .map((name) => db.collection(name).drop()) + [...edgeCollectionNames, ...vertexCollectionNames].map(name => + db.collection(name).drop() + ) ) .then(() => void done()) - .catch(done) - }) - it('creates the graph', (done) => { - let graph = db.graph(`g_${Date.now()}`) - graph.create({ - edgeDefinitions: edgeCollectionNames.map((name) => ({ - collection: name, - from: vertexCollectionNames, - to: vertexCollectionNames - })) - }) + .catch(done); + }); + it("creates the graph", done => { + let graph = db.graph(`g_${Date.now()}`); + graph + .create({ + edgeDefinitions: edgeCollectionNames.map(name => ({ + collection: name, + from: vertexCollectionNames, + to: vertexCollectionNames + })) + }) .then(() => graph.get()) - .then((data) => { - expect(data).to.have.a.property('name', graph.name) - done() + .then(data => { + expect(data).to.have.a.property("name", graph.name); + done(); }) - .catch(done) - }) - }) - describe('graph.drop', () => { - let graph - let edgeCollectionNames - let vertexCollectionNames - beforeEach((done) => { - graph = db.graph(`g_${Date.now()}`) + .catch(done); + }); + }); + describe("graph.drop", () => { + let graph; + let edgeCollectionNames; + let vertexCollectionNames; + beforeEach(done => { + graph = db.graph(`g_${Date.now()}`); createCollections(db) - .then((names) => { - [vertexCollectionNames, edgeCollectionNames] = names - return createGraph(graph, ...names) + .then(names => { + [vertexCollectionNames, edgeCollectionNames] = names; + return createGraph(graph, ...names); }) .then(() => void done()) - .catch(done) - }) - afterEach((done) => { + .catch(done); + }); + afterEach(done => { Promise.all( - [...edgeCollectionNames, ...vertexCollectionNames] - .map((name) => db.collection(name).drop().catch(() => null)) + [...edgeCollectionNames, ...vertexCollectionNames].map(name => + db + .collection(name) + .drop() + .catch(() => null) + ) ) .then(() => void done()) - .catch(done) - }) - it('destroys the graph if not passed true', (done) => { - graph.drop() - .then(() => graph.get() - .then( - () => Promise.reject(new Error('Should not succeed')), - () => undefined + .catch(done); + }); + it("destroys the graph if not passed true", done => { + graph + .drop() + .then(() => + graph + .get() + .then( + () => Promise.reject(new Error("Should not succeed")), + () => undefined + ) ) - ) .then(() => db.listCollections()) - .then((collections) => { - expect(collections.map((c) => c.name)).to.include.members([ + .then(collections => { + expect(collections.map(c => c.name)).to.include.members([ ...edgeCollectionNames, ...vertexCollectionNames - ]) - done() + ]); + done(); }) - .catch(done) - }) - it('additionally drops all of its collections if passed true', (done) => { - graph.drop(true) - .then(() => graph.get() - .then( - () => Promise.reject(new Error('Should not succeed')), - () => undefined + .catch(done); + }); + it("additionally drops all of its collections if passed true", done => { + graph + .drop(true) + .then(() => + graph + .get() + .then( + () => Promise.reject(new Error("Should not succeed")), + () => undefined + ) ) - ) .then(() => db.listCollections()) - .then((collections) => { - expect(collections.map((c) => c.name)).not.to.include.members([ + .then(collections => { + expect(collections.map(c => c.name)).not.to.include.members([ ...edgeCollectionNames, ...vertexCollectionNames - ]) - done() + ]); + done(); }) - .catch(done) - }) - }) -}) + .catch(done); + }); + }); +}); diff --git a/test/17-graph-vertices.js b/test/17-graph-vertices.js index 380f41ce7..65a05db39 100644 --- a/test/17-graph-vertices.js +++ b/test/17-graph-vertices.js @@ -1,137 +1,145 @@ -import {describe, it, before, after, beforeEach, afterEach} from 'mocha' -import {expect} from 'chai' -import {Database} from '../src' -import {VertexCollection} from '../src/graph' -import ArangoError from '../src/error' +import { after, afterEach, before, beforeEach, describe, it } from "mocha"; -const range = (n) => Array.from(Array(n).keys()) +import ArangoError from "../src/error"; +import { Database } from "../src"; +import { VertexCollection } from "../src/graph"; +import { expect } from "chai"; -function createCollections (db) { - let vertexCollectionNames = range(2).map((i) => `vc_${Date.now()}_${i}`) - let edgeCollectionNames = range(2).map((i) => `ec_${Date.now()}_${i}`) +const range = n => Array.from(Array(n).keys()); + +function createCollections(db) { + let vertexCollectionNames = range(2).map(i => `vc_${Date.now()}_${i}`); + let edgeCollectionNames = range(2).map(i => `ec_${Date.now()}_${i}`); return Promise.all([ - ...vertexCollectionNames.map((name) => db.collection(name).create()), - ...edgeCollectionNames.map((name) => db.edgeCollection(name).create()) - ]) - .then(() => [ - vertexCollectionNames, - edgeCollectionNames - ]) + ...vertexCollectionNames.map(name => db.collection(name).create()), + ...edgeCollectionNames.map(name => db.edgeCollection(name).create()) + ]).then(() => [vertexCollectionNames, edgeCollectionNames]); } -function createGraph (graph, vertexCollectionNames, edgeCollectionNames) { +function createGraph(graph, vertexCollectionNames, edgeCollectionNames) { return graph.create({ - edgeDefinitions: edgeCollectionNames.map((name) => ({ + edgeDefinitions: edgeCollectionNames.map(name => ({ collection: name, from: vertexCollectionNames, to: vertexCollectionNames })) - }) + }); } -describe('Manipulating graph vertices', () => { - let db - let name = `testdb_${Date.now()}` - let graph - let collectionNames - before((done) => { +describe("Manipulating graph vertices", () => { + let db; + let name = `testdb_${Date.now()}`; + let graph; + let collectionNames; + before(done => { db = new Database({ - url: (process.env.TEST_ARANGODB_URL || 'http://root:@localhost:8529'), + url: process.env.TEST_ARANGODB_URL || "http://root:@localhost:8529", arangoVersion: Number(process.env.ARANGO_VERSION || 30000) - }) - db.createDatabase(name) + }); + db + .createDatabase(name) .then(() => { - db.useDatabase(name) - done() + db.useDatabase(name); + done(); }) - .catch(done) - }) - after((done) => { - db.useDatabase('_system') - db.dropDatabase(name) + .catch(done); + }); + after(done => { + db.useDatabase("_system"); + db + .dropDatabase(name) .then(() => void done()) - .catch(done) - }) - beforeEach((done) => { - graph = db.graph(`g_${Date.now()}`) + .catch(done); + }); + beforeEach(done => { + graph = db.graph(`g_${Date.now()}`); createCollections(db) - .then((names) => { - collectionNames = names.reduce((a, b) => a.concat(b)) - return createGraph(graph, ...names) + .then(names => { + collectionNames = names.reduce((a, b) => a.concat(b)); + return createGraph(graph, ...names); }) .then(() => void done()) - .catch(done) - }) - afterEach((done) => { - graph.drop() - .then(() => Promise.all( - collectionNames.map((name) => db.collection(name).drop()) - )) + .catch(done); + }); + afterEach(done => { + graph + .drop() + .then(() => + Promise.all(collectionNames.map(name => db.collection(name).drop())) + ) .then(() => void done()) - .catch(done) - }) - describe('graph.vertexCollection', () => { - it('returns a VertexCollection instance for the collection', () => { - let name = 'potato' - let collection = graph.vertexCollection(name) - expect(collection).to.be.an.instanceof(VertexCollection) - expect(collection).to.have.a.property('name').that.equals(name) - }) - }) - describe('graph.addVertexCollection', () => { - let vertexCollection - beforeEach((done) => { - vertexCollection = db.collection(`xc_${Date.now()}`) - vertexCollection.create() + .catch(done); + }); + describe("graph.vertexCollection", () => { + it("returns a VertexCollection instance for the collection", () => { + let name = "potato"; + let collection = graph.vertexCollection(name); + expect(collection).to.be.an.instanceof(VertexCollection); + expect(collection) + .to.have.a.property("name") + .that.equals(name); + }); + }); + describe("graph.addVertexCollection", () => { + let vertexCollection; + beforeEach(done => { + vertexCollection = db.collection(`xc_${Date.now()}`); + vertexCollection + .create() .then(() => void done()) - .catch(done) - }) - afterEach((done) => { - vertexCollection.drop() + .catch(done); + }); + afterEach(done => { + vertexCollection + .drop() .then(() => void done()) - .catch(done) - }) - it('adds the given vertex collection to the graph', (done) => { - graph.addVertexCollection(vertexCollection.name) - .then((data) => { - expect(data.orphanCollections).to.contain(vertexCollection.name) - done() + .catch(done); + }); + it("adds the given vertex collection to the graph", done => { + graph + .addVertexCollection(vertexCollection.name) + .then(data => { + expect(data.orphanCollections).to.contain(vertexCollection.name); + done(); }) - .catch(done) - }) - }) - describe('graph.removeVertexCollection', () => { - let vertexCollection - beforeEach((done) => { - vertexCollection = db.collection(`xc_${Date.now()}`) - vertexCollection.create() + .catch(done); + }); + }); + describe("graph.removeVertexCollection", () => { + let vertexCollection; + beforeEach(done => { + vertexCollection = db.collection(`xc_${Date.now()}`); + vertexCollection + .create() .then(() => graph.addVertexCollection(vertexCollection.name)) .then(() => void done()) - .catch(done) - }) - it('removes the given vertex collection from the graph', (done) => { - graph.removeVertexCollection(vertexCollection.name) - .then((data) => { - expect(data.orphanCollections).not.to.contain(vertexCollection.name) - return vertexCollection.get() + .catch(done); + }); + it("removes the given vertex collection from the graph", done => { + graph + .removeVertexCollection(vertexCollection.name) + .then(data => { + expect(data.orphanCollections).not.to.contain(vertexCollection.name); + return vertexCollection.get(); }) .then(() => done()) - .catch(done) - }) - it('destroys the collection if explicitly passed true', (done) => { - graph.removeVertexCollection(vertexCollection.name, true) - .then((data) => { - expect(data.orphanCollections).not.to.contain(vertexCollection.name) - return vertexCollection.get() + .catch(done); + }); + it("destroys the collection if explicitly passed true", done => { + graph + .removeVertexCollection(vertexCollection.name, true) + .then(data => { + expect(data.orphanCollections).not.to.contain(vertexCollection.name); + return vertexCollection.get(); }) .then( - () => Promise.reject(new Error('Should not succeed')), - (err) => { - expect(err).to.be.an.instanceof(ArangoError) - done() + () => Promise.reject(new Error("Should not succeed")), + err => { + expect(err).to.be.an.instanceof(ArangoError); + done(); } - ) - .catch(done) - }) - }) -}) + ) + .catch(done); + }); + }); +}); diff --git a/test/18-graph-edges.js b/test/18-graph-edges.js index 013ebdb41..3a864664f 100644 --- a/test/18-graph-edges.js +++ b/test/18-graph-edges.js @@ -1,19 +1,19 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('Manipulating graph edges', () => { - describe('graph.edgeCollection', () => { - it('is missing tests') - }) - describe('graph.addEdgeDefinition', () => { - it('is missing tests') - }) - describe('graph.replaceEdgeDefinition', () => { - it('is missing tests') - }) - describe('graph.removeEdgeDefinition', () => { - it('is missing tests') - }) - describe('graph.traversal', () => { - it('is missing tests') - }) -}) +describe("Manipulating graph edges", () => { + describe("graph.edgeCollection", () => { + it("is missing tests"); + }); + describe("graph.addEdgeDefinition", () => { + it("is missing tests"); + }); + describe("graph.replaceEdgeDefinition", () => { + it("is missing tests"); + }); + describe("graph.removeEdgeDefinition", () => { + it("is missing tests"); + }); + describe("graph.traversal", () => { + it("is missing tests"); + }); +}); diff --git a/test/19-graph-vertex-collections.js b/test/19-graph-vertex-collections.js index c42feea48..027150641 100644 --- a/test/19-graph-vertex-collections.js +++ b/test/19-graph-vertex-collections.js @@ -1,13 +1,13 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('GraphVertexCollection API', () => { - describe('graphVertexCollection.remove', () => { - it('is missing tests') - }) - describe('graphVertexCollection.vertex', () => { - it('is missing tests') - }) - describe('graphVertexCollection.save', () => { - it('is missing tests') - }) -}) +describe("GraphVertexCollection API", () => { + describe("graphVertexCollection.remove", () => { + it("is missing tests"); + }); + describe("graphVertexCollection.vertex", () => { + it("is missing tests"); + }); + describe("graphVertexCollection.save", () => { + it("is missing tests"); + }); +}); diff --git a/test/20-graph-edge-collections.js b/test/20-graph-edge-collections.js index 820700d05..8d2bf345b 100644 --- a/test/20-graph-edge-collections.js +++ b/test/20-graph-edge-collections.js @@ -1,37 +1,37 @@ -import {describe, it} from 'mocha' +import { describe, it } from "mocha"; -describe('GraphEdgeCollection API', () => { - describe('graphEdgeCollection.remove', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.edge', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.save', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.edges', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.inEdges', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.outEdges', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.traversal', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.replace', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.update', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.remove', () => { - it('is missing tests') - }) - describe('graphEdgeCollection.list', () => { - it('is missing tests') - }) -}) +describe("GraphEdgeCollection API", () => { + describe("graphEdgeCollection.remove", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.edge", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.save", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.edges", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.inEdges", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.outEdges", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.traversal", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.replace", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.update", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.remove", () => { + it("is missing tests"); + }); + describe("graphEdgeCollection.list", () => { + it("is missing tests"); + }); +}); diff --git a/test/21-util-joinpath.js b/test/21-util-joinpath.js index 24d14dff3..fa7158642 100644 --- a/test/21-util-joinpath.js +++ b/test/21-util-joinpath.js @@ -1,21 +1,24 @@ -import {describe, it} from 'mocha' -import {expect} from 'chai' -import joinPath from '../src/util/joinPath' +import { describe, it } from "mocha"; -describe('Join Path', () => { - it('joinPath 1', () => { - var baseUrl = '../../u1/u2' - var path = '/security/authenticate' - expect(joinPath(baseUrl, path)).to.equal('../../u1/u2/security/authenticate') - }) - it('joinPath 2', () => { - var baseUrl = '/u1/u2' - var path = '../security/authenticate' - expect(joinPath(baseUrl, path)).to.equal('/u1/security/authenticate') - }) - it('joinPath 3', () => { - var baseUrl = '/u1/u2' - var path = '../../security/authenticate' - expect(joinPath(baseUrl, path)).to.equal('/security/authenticate') - }) -}) +import { expect } from "chai"; +import joinPath from "../src/util/joinPath"; + +describe("Join Path", () => { + it("joinPath 1", () => { + var baseUrl = "../../u1/u2"; + var path = "/security/authenticate"; + expect(joinPath(baseUrl, path)).to.equal( + "../../u1/u2/security/authenticate" + ); + }); + it("joinPath 2", () => { + var baseUrl = "/u1/u2"; + var path = "../security/authenticate"; + expect(joinPath(baseUrl, path)).to.equal("/u1/security/authenticate"); + }); + it("joinPath 3", () => { + var baseUrl = "/u1/u2"; + var path = "../../security/authenticate"; + expect(joinPath(baseUrl, path)).to.equal("/security/authenticate"); + }); +}); diff --git a/yarn.lock b/yarn.lock index 70b53facf..d15cde982 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,59 @@ # yarn lockfile v1 +"@babel/code-frame@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.31.tgz#473d021ecc573a2cce1c07d5b509d5215f46ba35" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +"@babel/helper-function-name@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.31.tgz#afe63ad799209989348b1109b44feb66aa245f57" + dependencies: + "@babel/helper-get-function-arity" "7.0.0-beta.31" + "@babel/template" "7.0.0-beta.31" + "@babel/traverse" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.31" + +"@babel/helper-get-function-arity@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.31.tgz#1176d79252741218e0aec872ada07efb2b37a493" + dependencies: + "@babel/types" "7.0.0-beta.31" + +"@babel/template@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.31.tgz#577bb29389f6c497c3e7d014617e7d6713f68bda" + dependencies: + "@babel/code-frame" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.31" + babylon "7.0.0-beta.31" + lodash "^4.2.0" + +"@babel/traverse@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.31.tgz#db399499ad74aefda014f0c10321ab255134b1df" + dependencies: + "@babel/code-frame" "7.0.0-beta.31" + "@babel/helper-function-name" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.31" + babylon "7.0.0-beta.31" + debug "^3.0.1" + globals "^10.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +"@babel/types@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.31.tgz#42c9c86784f674c173fb21882ca9643334029de4" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -12,7 +65,7 @@ acorn-dynamic-import@^2.0.0: dependencies: acorn "^4.0.3" -acorn-jsx@^3.0.0, acorn-jsx@^3.0.1: +acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" dependencies: @@ -26,29 +79,14 @@ acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" -acorn@^5.0.0: +acorn@^5.0.0, acorn@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" -acorn@^5.0.1: - version "5.0.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d" - -ajv-keywords@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.1.1.tgz#02550bc605a3e576041565628af972e06c549d50" - -ajv-keywords@^2.0.0: +ajv-keywords@^2.0.0, ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" -ajv@^4.7.0: - version "4.9.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.9.0.tgz#5a358085747b134eb567d6d15e015f1d7802f45c" - dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" - ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" @@ -65,6 +103,15 @@ ajv@^5.1.5: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" +ajv@^5.2.3, ajv@^5.3.0: + version "5.5.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.1.tgz#b38bb8876d9e86bee994956a04e721e88b248eb2" + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -73,18 +120,28 @@ align-text@^0.1.1, align-text@^0.1.3: longest "^1.0.1" repeat-string "^1.5.2" -ansi-escapes@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" +ansi-escapes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + anymatch@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" @@ -137,13 +194,6 @@ array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" -array.prototype.find@^2.0.1: - version "2.0.4" - resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.0.4.tgz#556a5c5362c08648323ddaeb9de9d14bc1864c90" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.7.0" - arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -242,14 +292,6 @@ babel-cli@^6.24.1: optionalDependencies: chokidar "^1.6.1" -babel-code-frame@^6.16.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" - dependencies: - chalk "^1.1.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -321,6 +363,15 @@ babel-env@^2.4.1: babel-preset-react "^6.23.0" babel-preset-stage-0 "^6.22.0" +babel-eslint@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.0.3.tgz#f29ecf02336be438195325cd47c468da81ee4e98" + dependencies: + "@babel/code-frame" "7.0.0-beta.31" + "@babel/traverse" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.31" + babylon "7.0.0-beta.31" + babel-generator@^6.25.0, babel-generator@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" @@ -1032,6 +1083,10 @@ babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.25.0, babel-types@^6.26 lodash "^4.17.4" to-fast-properties "^1.0.3" +babylon@7.0.0-beta.31: + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.31.tgz#7ec10f81e0e456fd0f855ad60fa30c2ac454283f" + babylon@^6.17.2, babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" @@ -1074,7 +1129,7 @@ boom@2.x.x: dependencies: hoek "2.x.x" -brace-expansion@^1.0.0, brace-expansion@^1.1.7: +brace-expansion@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" dependencies: @@ -1172,7 +1227,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: +builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -1235,7 +1290,7 @@ chai@^4.0.2: pathval "^1.0.0" type-detect "^4.0.0" -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -1245,6 +1300,18 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.0.0, chalk@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + check-error@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" @@ -1271,19 +1338,19 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: inherits "^2.0.1" safe-buffer "^5.0.1" -circular-json@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" -cli-cursor@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" dependencies: - restore-cursor "^1.0.1" + restore-cursor "^2.0.0" cli-width@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" cliui@^2.1.0: version "2.1.0" @@ -1309,6 +1376,16 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +color-convert@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" @@ -1333,13 +1410,13 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.5.0, concat-stream@^1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266" +concat-stream@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: - inherits "~2.0.1" - readable-stream "~2.0.0" - typedarray "~0.0.5" + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" console-browserify@^1.1.0: version "1.1.0" @@ -1355,10 +1432,6 @@ constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" -contains-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" - convert-source-map@^1.1.0, convert-source-map@^1.5.0: version "1.5.1" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" @@ -1398,7 +1471,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-spawn@^5.0.1: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -1457,16 +1530,6 @@ dateformat@^1.0.12: get-stdin "^4.0.1" meow "^3.3.0" -debug-log@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" - -debug@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" - dependencies: - ms "0.7.1" - debug@2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" @@ -1479,6 +1542,12 @@ debug@^2.1.1, debug@^2.2.0, debug@^2.6.8: dependencies: ms "2.0.0" +debug@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1497,24 +1566,6 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" -define-properties@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" - dependencies: - foreach "^2.0.5" - object-keys "^1.0.8" - -deglob@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/deglob/-/deglob-2.1.0.tgz#4d44abe16ef32c779b4972bd141a80325029a14a" - dependencies: - find-root "^1.0.0" - glob "^7.0.5" - ignore "^3.0.9" - pkg-config "^1.1.0" - run-parallel "^1.1.2" - uniq "^1.0.1" - del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" @@ -1568,19 +1619,11 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -doctrine@1.5.0, doctrine@^1.2.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" - dependencies: - esutils "^2.0.2" - isarray "^1.0.0" - -doctrine@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" +doctrine@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" dependencies: esutils "^2.0.2" - isarray "^1.0.0" dom-walk@^0.1.0: version "0.1.1" @@ -1637,23 +1680,6 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c" - dependencies: - es-to-primitive "^1.1.1" - function-bind "^1.1.0" - is-callable "^1.1.3" - is-regex "^1.0.3" - -es-to-primitive@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" - dependencies: - is-callable "^1.1.1" - is-date-object "^1.0.1" - is-symbol "^1.0.1" - es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.9, es5-ext@~0.10.14: version "0.10.37" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.37.tgz#0ee741d148b80069ba27d020393756af257defc3" @@ -1723,122 +1749,78 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-standard-jsx@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/eslint-config-standard-jsx/-/eslint-config-standard-jsx-4.0.1.tgz#cd4e463d0268e2d9e707f61f42f73f5b3333c642" - -eslint-config-standard@10.2.1: - version "10.2.1" - resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-10.2.1.tgz#c061e4d066f379dc17cd562c64e819b4dd454591" - -eslint-import-resolver-node@^0.2.0: - version "0.2.3" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz#5add8106e8c928db2cba232bcd9efa846e3da16c" +eslint-config-prettier@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz#5ecd65174d486c22dff389fe036febf502d468a3" dependencies: - debug "^2.2.0" - object-assign "^4.0.1" - resolve "^1.1.6" + get-stdin "^5.0.1" -eslint-module-utils@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.0.0.tgz#a6f8c21d901358759cdc35dbac1982ae1ee58bce" +eslint-plugin-prettier@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.3.1.tgz#e7a746c67e716f335274b88295a9ead9f544e44d" dependencies: - debug "2.2.0" - pkg-dir "^1.0.0" + fast-diff "^1.1.1" + jest-docblock "^21.0.0" -eslint-plugin-import@~2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.2.0.tgz#72ba306fad305d67c4816348a4699a4229ac8b4e" +eslint-scope@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: - builtin-modules "^1.1.1" - contains-path "^0.1.0" - debug "^2.2.0" - doctrine "1.5.0" - eslint-import-resolver-node "^0.2.0" - eslint-module-utils "^2.0.0" - has "^1.0.1" - lodash.cond "^4.3.0" - minimatch "^3.0.3" - pkg-up "^1.0.0" - -eslint-plugin-node@~4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-4.2.2.tgz#82959ca9aed79fcbd28bb1b188d05cac04fb3363" - dependencies: - ignore "^3.0.11" - minimatch "^3.0.2" - object-assign "^4.0.1" - resolve "^1.1.7" - semver "5.3.0" - -eslint-plugin-promise@~3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.5.0.tgz#78fbb6ffe047201627569e85a6c5373af2a68fca" - -eslint-plugin-react@~6.10.0: - version "6.10.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz#c5435beb06774e12c7db2f6abaddcbf900cd3f78" - dependencies: - array.prototype.find "^2.0.1" - doctrine "^1.2.2" - has "^1.0.1" - jsx-ast-utils "^1.3.4" - object.assign "^4.0.4" - -eslint-plugin-standard@~3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2" + esrecurse "^4.1.0" + estraverse "^4.1.1" -eslint@~3.19.0: - version "3.19.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" +eslint@^4.13.0: + version "4.13.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.0.tgz#1991aa359586af83877bde59de9d41f53e20826d" dependencies: - babel-code-frame "^6.16.0" - chalk "^1.1.3" - concat-stream "^1.5.2" - debug "^2.1.1" - doctrine "^2.0.0" - escope "^3.6.0" - espree "^3.4.0" + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.0.1" + doctrine "^2.0.2" + eslint-scope "^3.7.1" + espree "^3.5.2" esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" - glob "^7.0.3" - globals "^9.14.0" - ignore "^3.2.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" imurmurhash "^0.1.4" - inquirer "^0.12.0" - is-my-json-valid "^2.10.0" + inquirer "^3.0.6" is-resolvable "^1.0.0" - js-yaml "^3.5.1" - json-stable-stringify "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.0.0" - mkdirp "^0.5.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" - path-is-inside "^1.0.1" - pluralize "^1.2.1" - progress "^1.1.8" - require-uncached "^1.0.2" - shelljs "^0.7.5" - strip-bom "^3.0.0" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" strip-json-comments "~2.0.1" - table "^3.7.8" + table "^4.0.1" text-table "~0.2.0" - user-home "^2.0.0" -espree@^3.4.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.1.tgz#28a83ab4aaed71ed8fe0f5efe61b76a05c13c4d2" +espree@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" dependencies: - acorn "^5.0.1" + acorn "^5.2.1" acorn-jsx "^3.0.0" -esprima@^2.6.0: - version "2.7.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" esquery@^1.0.0: version "1.0.0" @@ -1891,10 +1873,6 @@ execa@^0.7.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -exit-hook@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" - expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" @@ -1911,6 +1889,14 @@ extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +external-editor@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -1925,20 +1911,23 @@ fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-diff@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" fast-levenshtein@~2.0.4: - version "2.0.5" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.5.tgz#bd33145744519ab1c36c3ee9f31f08e9079b67f2" + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" -figures@^1.3.5: - version "1.7.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" dependencies: escape-string-regexp "^1.0.5" - object-assign "^4.1.0" file-entry-cache@^2.0.0: version "2.0.0" @@ -1973,10 +1962,6 @@ find-cache-dir@^1.0.0: make-dir "^1.0.0" pkg-dir "^2.0.0" -find-root@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.0.0.tgz#962ff211aab25c6520feeeb8d6287f8f6e95807a" - find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -1991,10 +1976,10 @@ find-up@^2.0.0, find-up@^2.1.0: locate-path "^2.0.0" flat-cache@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.1.tgz#6c837d6225a7de5659323740b36d5361f71691ff" + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" dependencies: - circular-json "^0.3.0" + circular-json "^0.3.1" del "^2.0.2" graceful-fs "^4.1.2" write "^0.2.1" @@ -2015,10 +2000,6 @@ for-own@^0.1.4: dependencies: for-in "^1.0.1" -foreach@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" - forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" @@ -2063,9 +2044,9 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: mkdirp ">=0.5 0" rimraf "2" -function-bind@^1.0.2, function-bind@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" gauge@~2.7.3: version "2.7.4" @@ -2080,16 +2061,6 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -generate-function@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" - -generate-object-property@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" - dependencies: - is-property "^1.0.0" - get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" @@ -2129,7 +2100,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@7.1.1, glob@^7.0.3: +glob@7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -2140,7 +2111,7 @@ glob@7.1.1, glob@^7.0.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.5, glob@^7.1.2: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -2158,9 +2129,13 @@ global@~4.3.0: min-document "^2.19.0" process "~0.5.1" -globals@^9.14.0: - version "9.14.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034" +globals@^10.0.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-10.4.0.tgz#5c477388b128a9e4c5c5d01c7a2aca68c68b2da7" + +globals@^11.0.1: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.1.0.tgz#632644457f5f0e3ae711807183700ebf2e4633e4" globals@^9.18.0: version "9.18.0" @@ -2218,12 +2193,6 @@ has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" -has@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" - dependencies: - function-bind "^1.0.2" - hash-base@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1" @@ -2297,13 +2266,17 @@ https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" +iconv-lite@^0.4.17: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + ieee754@^1.1.4: version "1.1.8" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" -ignore@^3.0.11, ignore@^3.0.9, ignore@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.0.tgz#8d88f03c3002a0ac52114db25d2c673b0bf1e435" +ignore@^3.3.3: + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" imurmurhash@^0.1.4: version "0.1.4" @@ -2338,29 +2311,30 @@ ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" -inquirer@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" dependencies: - ansi-escapes "^1.1.0" - ansi-regex "^2.0.0" - chalk "^1.0.0" - cli-cursor "^1.0.1" + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" cli-width "^2.0.0" - figures "^1.3.5" + external-editor "^2.0.4" + figures "^2.0.0" lodash "^4.3.0" - readline2 "^1.0.1" - run-async "^0.1.0" - rx-lite "^3.1.2" - string-width "^1.0.1" - strip-ansi "^3.0.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" through "^2.3.6" interpret@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" -invariant@^2.2.2: +invariant@^2.2.0, invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -2390,14 +2364,6 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" -is-callable@^1.1.1, is-callable@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" - -is-date-object@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" - is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" @@ -2442,15 +2408,6 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" -is-my-json-valid@^2.10.0: - version "2.15.0" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b" - dependencies: - generate-function "^2.0.0" - generate-object-property "^1.1.0" - jsonpointer "^4.0.0" - xtend "^4.0.0" - is-number@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" @@ -2474,8 +2431,8 @@ is-path-in-cwd@^1.0.0: is-path-inside "^1.0.0" is-path-inside@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" dependencies: path-is-inside "^1.0.1" @@ -2487,13 +2444,9 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" -is-property@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" - -is-regex@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.3.tgz#0d55182bddf9f2fde278220aec3a75642c908637" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" is-resolvable@^1.0.0: version "1.0.0" @@ -2505,10 +2458,6 @@ is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" -is-symbol@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" - is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -2535,16 +2484,20 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-yaml@^3.5.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" +js-yaml@^3.9.1: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: argparse "^1.0.7" - esprima "^2.6.0" + esprima "^4.0.0" jsbn@~0.1.0: version "0.1.1" @@ -2570,7 +2523,11 @@ json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" -json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + +json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" dependencies: @@ -2592,10 +2549,6 @@ jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" -jsonpointer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" - jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -2605,13 +2558,6 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.3.4.tgz#0257ed1cc4b1e65b39d7d9940f9fb4f20f7ba0a9" - dependencies: - acorn-jsx "^3.0.1" - object-assign "^4.1.0" - kind-of@^3.0.2: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -2706,10 +2652,6 @@ lodash._isiterateecall@^3.0.0: version "3.0.9" resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" -lodash.cond@^4.3.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" - lodash.create@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" @@ -2734,11 +2676,7 @@ lodash.keys@^3.0.0: lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" -lodash@^4.0.0, lodash@^4.3.0: - version "4.17.2" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42" - -lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0: +lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -2877,21 +2815,15 @@ minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimatch@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" - dependencies: - brace-expansion "^1.0.0" - minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: +minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.1, mkdirp@~0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -2913,10 +2845,6 @@ mocha@3.4.2: mkdirp "0.5.1" supports-color "3.1.2" -ms@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" - ms@0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" @@ -2931,9 +2859,9 @@ multi-part@^2.0.0: dependencies: mime-kind "^2.0.1" -mute-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" nan@^2.3.0: version "2.8.0" @@ -3045,18 +2973,6 @@ object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" -object-keys@^1.0.10, object-keys@^1.0.8: - version "1.0.11" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" - -object.assign@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.0.4.tgz#b1c9cc044ef1b9fe63606fc141abbb32e14730cc" - dependencies: - define-properties "^1.1.2" - function-bind "^1.1.0" - object-keys "^1.0.10" - object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -3070,9 +2986,11 @@ once@^1.3.0, once@^1.3.3: dependencies: wrappy "1" -onetime@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" optionator@^0.8.2: version "0.8.2" @@ -3101,7 +3019,7 @@ os-locale@^2.0.0: lcid "^1.0.0" mem "^1.1.0" -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1: +os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -3188,7 +3106,7 @@ path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" -path-is-inside@^1.0.1: +path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" @@ -3246,42 +3164,15 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pkg-conf@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-2.0.0.tgz#071c87650403bccfb9c627f58751bfe47c067279" - dependencies: - find-up "^2.0.0" - load-json-file "^2.0.0" - -pkg-config@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pkg-config/-/pkg-config-1.1.1.tgz#557ef22d73da3c8837107766c52eadabde298fe4" - dependencies: - debug-log "^1.0.0" - find-root "^1.0.0" - xtend "^4.0.1" - -pkg-dir@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" - dependencies: - find-up "^1.0.0" - pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" dependencies: find-up "^2.1.0" -pkg-up@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-1.0.0.tgz#3e08fb461525c4421624a33b9f7e6d0af5b05a26" - dependencies: - find-up "^1.0.0" - -pluralize@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" prelude-ls@~1.1.2: version "1.1.2" @@ -3291,6 +3182,10 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@^1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.9.1.tgz#41638a0d47c1efbd1b7d5a742aaa5548eab86d70" + private@^0.1.6, private@^0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -3307,9 +3202,9 @@ process@~0.5.1: version "0.5.2" resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" -progress@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" prr@~0.0.0: version "0.0.0" @@ -3408,7 +3303,7 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.4, readable-stream@^2.2.6, readable-stream@^2.3.3: +readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.4, readable-stream@^2.2.2, readable-stream@^2.2.6, readable-stream@^2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" dependencies: @@ -3432,17 +3327,6 @@ readable-stream@^2.0.6: string_decoder "~1.0.0" util-deprecate "~1.0.1" -readable-stream@~2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" - util-deprecate "~1.0.1" - readdirp@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" @@ -3452,20 +3336,6 @@ readdirp@^2.0.0: readable-stream "^2.0.2" set-immediate-shim "^1.0.1" -readline2@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - mute-stream "0.0.5" - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - dependencies: - resolve "^1.1.6" - redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -3570,7 +3440,7 @@ require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" -require-uncached@^1.0.2: +require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" dependencies: @@ -3581,16 +3451,12 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" -resolve@^1.1.6, resolve@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" - -restore-cursor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" dependencies: - exit-hook "^1.0.0" - onetime "^1.0.0" + onetime "^2.0.0" + signal-exit "^3.0.2" retry@^0.10.0: version "0.10.1" @@ -3602,18 +3468,12 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1: +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" -rimraf@^2.2.8: - version "2.5.4" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" - dependencies: - glob "^7.0.5" - ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" @@ -3621,19 +3481,21 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^2.0.0" inherits "^2.0.1" -run-async@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" dependencies: - once "^1.3.0" + is-promise "^2.1.0" -run-parallel@^1.1.2: - version "1.1.6" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.6.tgz#29003c9a2163e01e2d2dfc90575f2c6c1d61a039" +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" -rx-lite@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" @@ -3643,10 +3505,6 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@~5.1.0, version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" -semver@5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -3680,15 +3538,7 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -shelljs@^0.7.5: - version "0.7.7" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -signal-exit@^3.0.0: +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -3696,20 +3546,11 @@ slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" -slice-ansi@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" - -snazzy@7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/snazzy/-/snazzy-7.0.0.tgz#95edaccc4a8d6f80f4ac5cc7b520e8f8f9ac2325" +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" dependencies: - chalk "^1.1.0" - inherits "^2.0.1" - minimist "^1.1.1" - readable-stream "^2.0.6" - standard-json "^1.0.0" - text-table "^0.2.0" + is-fullwidth-code-point "^2.0.0" sntp@1.x.x: version "1.0.9" @@ -3767,35 +3608,6 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" -standard-engine@~7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/standard-engine/-/standard-engine-7.0.0.tgz#ebb77b9c8fc2c8165ffa353bd91ba0dff41af690" - dependencies: - deglob "^2.1.0" - get-stdin "^5.0.1" - minimist "^1.1.0" - pkg-conf "^2.0.0" - -standard-json@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/standard-json/-/standard-json-1.0.1.tgz#75dd5952c59bb6cb358b136af0633ae3d7f35b6b" - dependencies: - concat-stream "^1.5.0" - -standard@10.0.2: - version "10.0.2" - resolved "https://registry.yarnpkg.com/standard/-/standard-10.0.2.tgz#974c1c53cc865b075a4b576e78441e1695daaf7b" - dependencies: - eslint "~3.19.0" - eslint-config-standard "10.2.1" - eslint-config-standard-jsx "4.0.1" - eslint-plugin-import "~2.2.0" - eslint-plugin-node "~4.2.2" - eslint-plugin-promise "~3.5.0" - eslint-plugin-react "~6.10.0" - eslint-plugin-standard "~3.0.1" - standard-engine "~7.0.0" - "statuses@>= 1.3.1 < 2": version "1.4.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" @@ -3832,16 +3644,19 @@ string-width@^2.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" +string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + string_decoder@^1.0.0, string_decoder@~1.0.0, string_decoder@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" dependencies: safe-buffer "~5.1.0" -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -3852,6 +3667,12 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -3886,22 +3707,22 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^4.2.1: +supports-color@^4.0.0, supports-color@^4.2.1: version "4.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" dependencies: has-flag "^2.0.0" -table@^3.7.8: - version "3.8.3" - resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" +table@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: - ajv "^4.7.0" - ajv-keywords "^1.0.0" - chalk "^1.1.1" - lodash "^4.0.0" - slice-ansi "0.0.4" - string-width "^2.0.0" + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" tapable@^0.2.7: version "0.2.8" @@ -3928,7 +3749,7 @@ tar@^2.2.1: fstream "^1.0.2" inherits "2" -text-table@^0.2.0, text-table@~0.2.0: +text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -3942,6 +3763,12 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + dependencies: + os-tmpdir "~1.0.2" + to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" @@ -3950,6 +3777,10 @@ to-fast-properties@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + tough-cookie@~2.3.0: version "2.3.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" @@ -3996,7 +3827,7 @@ type-detect@^4.0.0: version "4.0.5" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.5.tgz#d70e5bc81db6de2a381bcaca0c6e0cbdc7635de2" -typedarray@~0.0.5: +typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -4025,10 +3856,6 @@ uid-number@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" -uniq@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" - url@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" @@ -4040,12 +3867,6 @@ user-home@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" -user-home@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" - dependencies: - os-homedir "^1.0.0" - utf8-length@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/utf8-length/-/utf8-length-0.0.1.tgz#d315c4bed529c977f18dd35c73d72628327d9ada" @@ -4187,7 +4008,7 @@ xhr@^2.3.1: parse-headers "^2.0.0" xtend "^4.0.0" -xtend@^4.0.0, xtend@^4.0.1: +xtend@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"