arangojs
Version:
The official ArangoDB JavaScript driver.
1 lines • 103 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.arangojs=t():e.arangojs=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=9)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return Boolean(e&&e.isArangoError)}Object.defineProperty(t,"__esModule",{value:!0});var u=n(13),s={0:"Network Error",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:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",444:"Connection Closed Without Response",451:"Unavailable For Legal Reasons",499:"Client Closed Request",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",510:"Not Extended",511:"Network Authentication Required",599:"Network Connect Timeout Error"},c=["fileName","lineNumber","columnNumber","stack","description","number"];t.isArangoError=a;var h=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));n.name="ArangoError",n.isArangoError=!0,n.response=e,n.statusCode=e.statusCode,n.message=e.body.errorMessage,n.errorNum=e.body.errorNum,n.code=e.body.code;var i=new Error(n.message);i.name=n.name;var a=!0,u=!1,s=void 0;try{for(var h,l=c[Symbol.iterator]();!(a=(h=l.next()).done);a=!0){var f=h.value;i[f]&&(n[f]=i[f])}}catch(i){u=!0,s=i}finally{try{!a&&l.return&&l.return()}finally{if(u)throw s}}return n}return i(t,e),t}(u.default);t.ArangoError=h;var l=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));n.name="HttpError",n.response=e,n.statusCode=e.statusCode||500,n.message=s[n.statusCode]||s[500],n.code=n.statusCode;var i=new Error(n.message);i.name=n.name;var a=!0,u=!1,h=void 0;try{for(var l,f=c[Symbol.iterator]();!(a=(l=f.next()).done);a=!0){var p=l.value;i[p]&&(n[p]=i[p])}}catch(i){u=!0,h=i}finally{try{!a&&f.return&&f.return()}finally{if(u)throw h}}return n}return i(t,e),t}(u.default);t.HttpError=l},function(e,t,n){"use strict";function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,i){try{var a=t[o](i),u=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(u).then(function(e){r("next",e)},function(e){r("throw",e)});e(u)}return r("next")})}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){return Boolean(e&&e.isArangoCollection)}function c(e,t){return new(t.type===f.EDGE_COLLECTION?m:v)(e,t.name)}var h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();Object.defineProperty(t,"__esModule",{value:!0});var f,p=n(4),d=n(0);!function(e){e[e.DOCUMENT_COLLECTION=2]="DOCUMENT_COLLECTION",e[e.EDGE_COLLECTION=3]="EDGE_COLLECTION"}(f=t.CollectionType||(t.CollectionType={})),t.isArangoCollection=s,t.DOCUMENT_NOT_FOUND=1202,t.COLLECTION_NOT_FOUND=1203;var y=function(){function e(t,n){u(this,e),this.isArangoCollection=!0,this.name=n,this._idPrefix=this.name+"/",this._connection=t,this._connection.arangoMajor>=3&&(this.first=void 0,this.last=void 0,this.createCapConstraint=void 0)}return l(e,[{key:"_documentPath",value:function(e){return"/document/"+this._documentHandle(e)}},{key:"_documentHandle",value:function(e){if("string"!=typeof e){if(e._id)return e._id;if(e._key)return this._idPrefix+e._key;throw new Error("Document handle must be a document or string")}return-1===e.indexOf("/")?this._idPrefix+e:e}},{key:"_indexHandle",value:function(e){if("string"!=typeof e){if(e.id)return e.id;throw new Error("Index handle must be a index or string")}return-1===e.indexOf("/")?this._idPrefix+e:e}},{key:"_get",value:function(e,t){return this._connection.request({path:"/_api/collection/"+this.name+"/"+e,qs:t},function(e){return e.body})}},{key:"_put",value:function(e,t){return this._connection.request({method:"PUT",path:"/_api/collection/"+this.name+"/"+e,body:t},function(e){return e.body})}},{key:"get",value:function(){return this._connection.request({path:"/_api/collection/"+this.name},function(e){return e.body})}},{key:"exists",value:function(){return this.get().then(function(){return!0},function(e){if(d.isArangoError(e)&&e.errorNum===t.COLLECTION_NOT_FOUND)return!1;throw e})}},{key:"create",value:function(e){return this._connection.request({method:"POST",path:"/_api/collection",body:h({},e,{name:this.name,type:this.type})},function(e){return e.body})}},{key:"properties",value:function(){return this._get("properties")}},{key:"count",value:function(){return this._get("count")}},{key:"figures",value:function(){return this._get("figures")}},{key:"revision",value:function(){return this._get("revision")}},{key:"checksum",value:function(e){return this._get("checksum",e)}},{key:"load",value:function(e){return this._put("load","boolean"==typeof e?{count:e}:void 0)}},{key:"unload",value:function(){return this._put("unload",void 0)}},{key:"setProperties",value:function(e){return this._put("properties",e)}},{key:"rename",value:function(){function e(e){return t.apply(this,arguments)}var t=a(regeneratorRuntime.mark(function e(t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._connection.request({method:"PUT",path:"/_api/collection/"+this.name+"/rename",body:{name:t}},function(e){return e.body});case 2:return n=e.sent,this.name=t,this._idPrefix=t+"/",e.abrupt("return",n);case 6:case"end":return e.stop()}},e,this)}));return e}()},{key:"rotate",value:function(){return this._put("rotate",void 0)}},{key:"truncate",value:function(){return this._put("truncate",void 0)}},{key:"drop",value:function(e){return this._connection.request({method:"DELETE",path:"/_api/collection/"+this.name,qs:e},function(e){return e.body})}},{key:"documentExists",value:function(e){return this._connection.request({method:"HEAD",path:"/_api/"+this._documentPath(e)},function(){return!0}).catch(function(e){if(404===e.statusCode)return!1;throw e})}},{key:"document",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this._connection.request({path:"/_api/"+this._documentPath(e)},function(e){return e.body});return n?r.catch(function(e){if(d.isArangoError(e)&&e.errorNum===t.DOCUMENT_NOT_FOUND)return null;throw e}):r}},{key:"replace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={};if("string"==typeof n&&(n={rev:n}),n.rev&&this._connection.arangoMajor>=3){var o=void 0,a=n;o=a.rev,n=i(a,["rev"]),r["if-match"]=o}return this._connection.request({method:"PUT",path:"/_api/"+this._documentPath(e),body:t,qs:n,headers:r},function(e){return e.body})}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={};if("string"==typeof n&&(n={rev:n}),n.rev&&this._connection.arangoMajor>=3){var o=void 0,a=n;o=a.rev,n=i(a,["rev"]),r["if-match"]=o}return this._connection.request({method:"PATCH",path:"/_api/"+this._documentPath(e),body:t,qs:n,headers:r},function(e){return e.body})}},{key:"bulkUpdate",value:function(e,t){return this._connection.request({method:"PATCH",path:"/_api/document/"+this.name,body:e,qs:t},function(e){return e.body})}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};if("string"==typeof t&&(t={rev:t}),t.rev&&this._connection.arangoMajor>=3){var r=void 0,o=t;r=o.rev,t=i(o,["rev"]),n["if-match"]=r}return this._connection.request({method:"DELETE",path:"/_api/"+this._documentPath(e),qs:t,headers:n},function(e){return e.body})}},{key:"list",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return this._connection.arangoMajor<=2?this._connection.request({path:"/_api/document",qs:{type:e,collection:this.name}},function(e){return e.body.documents}):this._connection.request({method:"PUT",path:"/_api/simple/all-keys",body:{type:e,collection:this.name}},function(e){return e.body.result})}},{key:"all",value:function(e){var t=this;return this._connection.request({method:"PUT",path:"/_api/simple/all",body:h({},e,{collection:this.name})},function(e){return new p.ArrayCursor(t._connection,e.body,e.host)})}},{key:"any",value:function(){return this._connection.request({method:"PUT",path:"/_api/simple/any",body:{collection:this.name}},function(e){return e.body.document})}},{key:"first",value:function(e){return"number"==typeof e&&(e={count:e}),this._connection.request({method:"PUT",path:"/_api/simple/first",body:h({},e,{collection:this.name})},function(e){return e.body.result})}},{key:"last",value:function(e){return"number"==typeof e&&(e={count:e}),this._connection.request({method:"PUT",path:"/_api/simple/last",body:h({},e,{collection:this.name})},function(e){return e.body.result})}},{key:"byExample",value:function(e,t){var n=this;return this._connection.request({method:"PUT",path:"/_api/simple/by-example",body:h({},t,{example:e,collection:this.name})},function(e){return new p.ArrayCursor(n._connection,e.body,e.host)})}},{key:"firstExample",value:function(e){return this._connection.request({method:"PUT",path:"/_api/simple/first-example",body:{example:e,collection:this.name}},function(e){return e.body.document})}},{key:"removeByExample",value:function(e,t){return this._connection.request({method:"PUT",path:"/_api/simple/remove-by-example",body:h({},t,{example:e,collection:this.name})},function(e){return e.body})}},{key:"replaceByExample",value:function(e,t,n){return this._connection.request({method:"PUT",path:"/_api/simple/replace-by-example",body:h({},n,{example:e,newValue:t,collection:this.name})},function(e){return e.body})}},{key:"updateByExample",value:function(e,t,n){return this._connection.request({method:"PUT",path:"/_api/simple/update-by-example",body:h({},n,{example:e,newValue:t,collection:this.name})},function(e){return e.body})}},{key:"lookupByKeys",value:function(e){return this._connection.request({method:"PUT",path:"/_api/simple/lookup-by-keys",body:{keys:e,collection:this.name}},function(e){return e.body.documents})}},{key:"removeByKeys",value:function(e,t){return this._connection.request({method:"PUT",path:"/_api/simple/remove-by-keys",body:{options:t,keys:e,collection:this.name}},function(e){return e.body})}},{key:"import",value:function(e,t){return this._connection.request({method:"POST",path:"/_api/import",body:e,isJsonStream:Boolean(!t||"array"!==t.type),qs:h({type:"auto"},t,{collection:this.name})},function(e){return e.body})}},{key:"indexes",value:function(){return this._connection.request({path:"/_api/index",qs:{collection:this.name}},function(e){return e.body.indexes})}},{key:"index",value:function(e){return this._connection.request({path:"/_api/index/"+this._indexHandle(e)},function(e){return e.body})}},{key:"createIndex",value:function(e){return this._connection.request({method:"POST",path:"/_api/index",body:e,qs:{collection:this.name}},function(e){return e.body})}},{key:"dropIndex",value:function(e){return this._connection.request({method:"DELETE",path:"/_api/index/"+this._indexHandle(e)},function(e){return e.body})}},{key:"createCapConstraint",value:function(e){return"number"==typeof e&&(e={size:e}),this._connection.request({method:"POST",path:"/_api/index",body:h({},e,{type:"cap"}),qs:{collection:this.name}},function(e){return e.body})}},{key:"createHashIndex",value:function(e,t){return"string"==typeof e&&(e=[e]),"boolean"==typeof t&&(t={unique:t}),this._connection.request({method:"POST",path:"/_api/index",body:h({unique:!1},t,{type:"hash",fields:e}),qs:{collection:this.name}},function(e){return e.body})}},{key:"createSkipList",value:function(e,t){return"string"==typeof e&&(e=[e]),"boolean"==typeof t&&(t={unique:t}),this._connection.request({method:"POST",path:"/_api/index",body:h({unique:!1},t,{type:"skiplist",fields:e}),qs:{collection:this.name}},function(e){return e.body})}},{key:"createPersistentIndex",value:function(e,t){return"string"==typeof e&&(e=[e]),"boolean"==typeof t&&(t={unique:t}),this._connection.request({method:"POST",path:"/_api/index",body:h({unique:!1},t,{type:"persistent",fields:e}),qs:{collection:this.name}},function(e){return e.body})}},{key:"createGeoIndex",value:function(e,t){return"string"==typeof e&&(e=[e]),this._connection.request({method:"POST",path:"/_api/index",body:h({},t,{fields:e,type:"geo"}),qs:{collection:this.name}},function(e){return e.body})}},{key:"createFulltextIndex",value:function(e,t){return"string"==typeof e&&(e=[e]),this._connection.request({method:"POST",path:"/_api/index",body:{fields:e,minLength:t,type:"fulltext"},qs:{collection:this.name}},function(e){return e.body})}},{key:"fulltext",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.index&&(r.index=this._indexHandle(r.index)),this._connection.request({method:"PUT",path:"/_api/simple/fulltext",body:h({},r,{attribute:e,query:t,collection:this.name})},function(e){return new p.ArrayCursor(n._connection,e.body,e.host)})}}]),e}();t.BaseCollection=y;var v=function(e){function t(e,n){u(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o.type=f.DOCUMENT_COLLECTION,o}return o(t,e),l(t,[{key:"save",value:function(e,t){return"boolean"==typeof t&&(t={returnNew:t}),this._connection.arangoMajor<=2?this._connection.request({method:"POST",path:"/_api/document",body:e,qs:h({},t,{collection:this.name})},function(e){return e.body}):this._connection.request({method:"POST",path:"/_api/document/"+this.name,body:e,qs:t},function(e){return e.body})}}]),t}(y);t.DocumentCollection=v;var m=function(e){function t(e,n){u(this,t);var o=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o.type=f.EDGE_COLLECTION,o}return o(t,e),l(t,[{key:"_documentPath",value:function(e){return this._connection.arangoMajor<3?"edge/"+this._documentHandle(e):"document/"+this._documentHandle(e)}},{key:"edge",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.document(e,t)}},{key:"save",value:function(e,t,n,r){return void 0!==n?(e._from=this._documentHandle(t),e._to=this._documentHandle(n)):void 0!==t&&(r=t),"boolean"==typeof r&&(r={returnNew:r}),this._connection.arangoMajor<=2?this._connection.request({method:"POST",path:"/_api/edge",body:e,qs:h({},r,{collection:this.name,from:e._from,to:e._to})},function(e){return e.body}):this._connection.request({method:"POST",path:"/_api/document",body:e,qs:{collection:this.name}},function(e){return e.body})}},{key:"_edges",value:function(e,t){return this._connection.request({path:"/_api/edges/"+this.name,qs:{direction:t,vertex:this._documentHandle(e)}},function(e){return e.body.edges})}},{key:"edges",value:function(e){return this._edges(e,void 0)}},{key:"inEdges",value:function(e){return this._edges(e,"in")}},{key:"outEdges",value:function(e){return this._edges(e,"out")}},{key:"traversal",value:function(e,t){return this._connection.request({method:"POST",path:"/_api/traversal",body:h({},t,{startVertex:e,edgeCollection:this.name})},function(e){return e.body.result})}}]),t}(y);t.EdgeCollection=m,t.constructCollection=c},function(e,t,n){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e){return Boolean(e&&e.query&&e.bindVars)}function o(e){return Boolean(e&&"function"==typeof e.toAQL)}function i(e){for(var t={},n=[],r=e[0],i=arguments.length,u=Array(i>1?i-1:0),s=1;s<i;s++)u[s-1]=arguments[s];for(var c=0;c<u.length;c++){var h=u[c],l=h;if(o(h))r+=""+h.toAQL()+e[c+1];else{var f=n.indexOf(h),p=-1!==f,d="value"+(p?f:n.length);a.isArangoCollection(h)&&(d="@"+d,l=h.name),p||(n.push(h),t[d]=l),r+="@"+d+e[c+1]}}return{query:r,bindVars:t}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1);t.isAqlQuery=r,t.isAqlLiteral=o,t.aql=i,function(e){e.literal=function(e){return{toAQL:function(){return String(e)}}}}(i=t.aql||(t.aql={}))},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,i){try{var a=t[o](i),u=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(u).then(function(e){r("next",e)},function(e){r("throw",e)});e(u)}return r("next")})}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(t,n,r){i(this,e),this.extra=n.extra,this._connection=t,this._result=n.result,this._hasMore=Boolean(n.hasMore),this._id=n.id,this._host=r,this.count=n.count}return a(e,[{key:"_drain",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._more();case 2:if(this._hasMore){e.next=4;break}return e.abrupt("return",this);case 4:return e.abrupt("return",this._drain());case 5:case"end":return e.stop()}},e,this)}));return e}()},{key:"_more",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._hasMore){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,this._connection.request({method:"PUT",path:"/_api/cursor/"+this._id,host:this._host});case 6:n=e.sent,(t=this._result).push.apply(t,r(n.body.result)),this._hasMore=n.body.hasMore;case 9:case"end":return e.stop()}},e,this)}));return e}()},{key:"all",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._drain();case 2:return t=this._result,this._result=[],e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return e}()},{key:"next",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._result.length||!this._hasMore){e.next=5;break}return e.next=3,this._more();case 3:e.next=0;break;case 5:if(this._result.length){e.next=7;break}return e.abrupt("return",void 0);case 7:return e.abrupt("return",this._result.shift());case 8:case"end":return e.stop()}},e,this)}));return e}()},{key:"hasNext",value:function(){return Boolean(this._hasMore||this._result.length)}},{key:"each",value:function(){function e(e){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(t){var n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!this._result.length&&!this._hasMore){e.next=15;break}r=void 0;case 3:if(!this._result.length){e.next=10;break}if(r=t(this._result.shift(),n,this),n++,!1!==r){e.next=8;break}return e.abrupt("return",r);case 8:e.next=3;break;case 10:if(!this._hasMore){e.next=13;break}return e.next=13,this._more();case 13:e.next=1;break;case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}},e,this)}));return e}()},{key:"every",value:function(){function e(e){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(t){var n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!this._result.length&&!this._hasMore){e.next=15;break}r=void 0;case 3:if(!this._result.length){e.next=10;break}if(r=t(this._result.shift(),n,this),n++,r){e.next=8;break}return e.abrupt("return",!1);case 8:e.next=3;break;case 10:if(!this._hasMore){e.next=13;break}return e.next=13,this._more();case 13:e.next=1;break;case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}},e,this)}));return e}()},{key:"some",value:function(){function e(e){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(t){var n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:if(!this._result.length&&!this._hasMore){e.next=15;break}r=void 0;case 3:if(!this._result.length){e.next=10;break}if(r=t(this._result.shift(),n,this),n++,!r){e.next=8;break}return e.abrupt("return",!0);case 8:e.next=3;break;case 10:if(!this._hasMore){e.next=13;break}return e.next=13,this._more();case 13:e.next=1;break;case 15:return e.abrupt("return",!1);case 16:case"end":return e.stop()}},e,this)}));return e}()},{key:"map",value:function(){function e(e){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(t){var n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=0,r=[];case 2:if(!this._result.length&&!this._hasMore){e.next=9;break}for(;this._result.length;)r.push(t(this._result.shift(),n,this)),n++;if(!this._hasMore){e.next=7;break}return e.next=7,this._more();case 7:e.next=2;break;case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}},e,this)}));return e}()},{key:"reduce",value:function(){function e(e,n){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(t,n){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=0,void 0!==n){e.next=7;break}if(this._result.length||this._hasMore){e.next=5;break}return e.next=5,this._more();case 5:n=this._result.shift(),r+=1;case 7:if(!this._result.length&&!this._hasMore){e.next=14;break}for(;this._result.length;)n=t(n,this._result.shift(),r,this),r++;if(!this._hasMore){e.next=12;break}return e.next=12,this._more();case 12:e.next=7;break;case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}},e,this)}));return e}()}]),e}();t.ArrayCursor=u},function(e,t,n){"use strict";t.decode=t.parse=n(17),t.encode=t.stringify=n(18)},function(e,t,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,i){try{var a=t[o](i),u=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(u).then(function(e){r("next",e)},function(e){r("throw",e)});e(u)}return r("next")})}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();Object.defineProperty(t,"__esModule",{value:!0});var h=n(1),l=n(0),f=function(e){function t(e,n,r){i(this,t);var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o.type=h.CollectionType.DOCUMENT_COLLECTION,o.graph=r,o}return u(t,e),c(t,[{key:"document",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._connection.request({path:"/_api/gharial/"+this.graph.name+"/vertex/"+this._documentHandle(e)},function(e){return e.body.vertex});return t?n.catch(function(e){if(l.isArangoError(e)&&e.errorNum===h.DOCUMENT_NOT_FOUND)return null;throw e}):n}},{key:"vertex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.document(e,t)}},{key:"save",value:function(e,t){return this._connection.request({method:"POST",path:"/_api/gharial/"+this.graph.name+"/vertex/"+this.name,body:e,qs:t},function(e){return e.body.vertex})}},{key:"replace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={};if("string"==typeof n&&(n={rev:n}),n.rev){var i=void 0,a=n;i=a.rev,n=o(a,["rev"]),r["if-match"]=i}return this._connection.request({method:"PUT",path:"/_api/gharial/"+this.graph.name+"/vertex/"+this._documentHandle(e),body:t,qs:n,headers:r},function(e){return e.body.vertex})}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={};if("string"==typeof n&&(n={rev:n}),n.rev){var i=void 0,a=n;i=a.rev,n=o(a,["rev"]),r["if-match"]=i}return this._connection.request({method:"PATCH",path:"/_api/gharial/"+this.graph.name+"/vertex/"+this._documentHandle(e),body:t,qs:n,headers:r},function(e){return e.body.vertex})}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};if("string"==typeof t&&(t={rev:t}),t.rev){var r=void 0,i=t;r=i.rev,t=o(i,["rev"]),n["if-match"]=r}return this._connection.request({method:"DELETE",path:"/_api/gharial/"+this.graph.name+"/vertex/"+this._documentHandle(e),qs:t,headers:n},function(e){return e.body.removed})}}]),t}(h.BaseCollection);t.GraphVertexCollection=f;var p=function(e){function t(e,n,r){i(this,t);var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return o.type=h.CollectionType.EDGE_COLLECTION,o.type=h.CollectionType.EDGE_COLLECTION,o.graph=r,o}return u(t,e),c(t,[{key:"document",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._connection.request({path:"/_api/gharial/"+this.graph.name+"/edge/"+this._documentHandle(e)},function(e){return e.body.edge});return t?n.catch(function(e){if(l.isArangoError(e)&&e.errorNum===h.DOCUMENT_NOT_FOUND)return null;throw e}):n}},{key:"save",value:function(e,t,n,r){return void 0!==t&&(void 0!==n?(e._from=this._documentHandle(t),e._to=this._documentHandle(n)):r=t),this._connection.request({method:"POST",path:"/_api/gharial/"+this.graph.name+"/edge/"+this.name,body:e,qs:r},function(e){return e.body.edge})}},{key:"replace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={};if("string"==typeof n&&(n={rev:n}),n.rev){var i=void 0,a=n;i=a.rev,n=o(a,["rev"]),r["if-match"]=i}return this._connection.request({method:"PUT",path:"/_api/gharial/"+this.graph.name+"/edge/"+this._documentHandle(e),body:t,qs:n,headers:r},function(e){return e.body.edge})}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={};if("string"==typeof n&&(n={rev:n}),n.rev){var i=void 0,a=n;i=a.rev,n=o(a,["rev"]),r["if-match"]=i}return this._connection.request({method:"PATCH",path:"/_api/gharial/"+this.graph.name+"/edge/"+this._documentHandle(e),body:t,qs:n,headers:r},function(e){return e.body.edge})}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};if("string"==typeof t&&(t={rev:t}),t.rev){var r=void 0,i=t;r=i.rev,t=o(i,["rev"]),n["if-match"]=r}return this._connection.request({method:"DELETE",path:"/_api/gharial/"+this.graph.name+"/edge/"+this._documentHandle(e),qs:t,headers:n},function(e){return e.body.removed})}}]),t}(h.EdgeCollection);t.GraphEdgeCollection=p;var d=function(){function e(t,n){i(this,e),this.name=n,this._connection=t}return c(e,[{key:"get",value:function(){return this._connection.request({path:"/_api/gharial/"+this.name},function(e){return e.body.graph})}},{key:"exists",value:function(){return this.get().then(function(){return!0},function(e){if(l.isArangoError(e)&&1924===e.errorNum)return!1;throw e})}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];return this._connection.request({method:"POST",path:"/_api/gharial",body:s({},e,{name:this.name}),qs:t},function(e){return e.body.graph})}},{key:"drop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._connection.request({method:"DELETE",path:"/_api/gharial/"+this.name,qs:{dropCollections:e}},function(e){return e.body.removed})}},{key:"vertexCollection",value:function(e){return new f(this._connection,e,this)}},{key:"listVertexCollections",value:function(e){return this._connection.request({path:"/_api/gharial/"+this.name+"/vertex",qs:e},function(e){return e.body.collections})}},{key:"vertexCollections",value:function(){function e(e){return t.apply(this,arguments)}var t=r(regeneratorRuntime.mark(function e(t){var n,r=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.listVertexCollections(t);case 2:return n=e.sent,e.abrupt("return",n.map(function(e){return new f(r._connection,e,r)}));case 4:case"end":return e.stop()}},e,this)}));return e}()},{key:"addVertexCollection",value:function(e){return h.isArangoCollection(e)&&(e=e.name),this._connection.request({method:"POST",path:"/_api/gharial/"+this.name+"/vertex",body:{collection:e}},function(e){return e.body.graph})}},{key:"removeVertexCollection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return h.isArangoCollection(e)&&(e=e.name),this._connection.request({method:"DELETE",path:"/_api/gharial/"+this.name+"/vertex/"+e,qs:{dropCollection:t}},function(e){return e.body.graph})}},{key:"edgeCollection",value:function(e){return new p(this._connection,e,this)}},{key:"listEdgeCollections",value:function(){return this._connection.request({path:"/_api/gharial/"+this.name+"/edge"},function(e){return e.body.collections})}},{key:"edgeCollections",value:function(){function e(){return t.apply(this,arguments)}var t=r(regeneratorRuntime.mark(function e(){var t,n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.listEdgeCollections();case 2:return t=e.sent,e.abrupt("return",t.map(function(e){return new p(n._connection,e,n)}));case 4:case"end":return e.stop()}},e,this)}));return e}()},{key:"addEdgeDefinition",value:function(e){return this._connection.request({method:"POST",path:"/_api/gharial/"+this.name+"/edge",body:e},function(e){return e.body.graph})}},{key:"replaceEdgeDefinition",value:function(e,t){return this._connection.request({method:"PUT",path:"/_api/gharial/"+this.name+"/edge/"+e,body:t},function(e){return e.body.graph})}},{key:"removeEdgeDefinition",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._connection.request({method:"DELETE",path:"/_api/gharial/"+this.name+"/edge/"+e,qs:{dropCollection:t}},function(e){return e.body.graph})}},{key:"traversal",value:function(e,t){return this._connection.request({method:"POST",path:"/_api/traversal",body:s({},t,{startVertex:e,graphName:this.name})},function(e){return e.body.result})}}]),e}();t.Graph=d},function(e,t,n){n(10),e.exports=n(11)},function(e,t,n){"use strict";(function(e){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(n){function r(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),u=new d(r||[]);return a._invoke=h(e,n,u),a}function o(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function a(){}function u(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function n(r,i,a,u){var s=o(e[r],e,i);if("throw"!==s.type){var c=s.arg,h=c.value;return h&&"object"===(void 0===h?"undefined":t(h))&&_.call(h,"__await")?Promise.resolve(h.__await).then(function(e){n("next",e,a,u)},function(e){n("throw",e,a,u)}):Promise.resolve(h).then(function(e){c.value=e,a(c)},u)}u(s.arg)}function r(e,t){function r(){return new Promise(function(r,o){n(e,t,r,o)})}return i=i?i.then(r,r):r()}var i;this._invoke=r}function h(e,t,n){var r=E;return function(i,a){if(r===S)throw new Error("Generator is already running");if(r===T){if("throw"===i)throw a;return v()}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var s=l(u,n);if(s){if(s===P)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===E)throw r=T,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=S;var c=o(e,t,n);if("normal"===c.type){if(r=n.done?T:j,c.arg===P)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=T,n.method="throw",n.arg=c.arg)}}}function l(e,t){var n=e.iterator[t.method];if(n===m){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=m,l(e,t),"throw"===t.method))return P;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var r=o(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,P;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=m),t.delegate=null,P):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,P)}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function y(e){if(e){var t=e[x];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(_.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=m,t.done=!0,t};return r.next=r}}return{next:v}}function v(){return{value:m,done:!0}}var m,b=Object.prototype,_=b.hasOwnProperty,g="function"==typeof Symbol?Symbol:{},x=g.iterator||"@@iterator",w=g.asyncIterator||"@@asyncIterator",k=g.toStringTag||"@@toStringTag",O="object"===t(e),q=n.regeneratorRuntime;if(q)return void(O&&(e.exports=q));q=n.regeneratorRuntime=O?e.exports:{},q.wrap=r;var E="suspendedStart",j="suspendedYield",S="executing",T="completed",P={},C={};C[x]=function(){return this};var A=Object.getPrototypeOf,R=A&&A(A(y([])));R&&R!==b&&_.call(R,x)&&(C=R);var L=u.prototype=i.prototype=Object.create(C);a.prototype=L.constructor=u,u.constructor=a,u[k]=a.displayName="GeneratorFunction",q.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},q.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(L),e},q.awrap=function(e){return{__await:e}},s(c.prototype),c.prototype[w]=function(){return this},q.AsyncIterator=c,q.async=function(e,t,n,o){var i=new c(r(e,t,n,o));return q.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},s(L),L[k]="Generator",L[x]=function(){return this},L.toString=function(){return"[object Generator]"},q.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},q.values=y,d.prototype={constructor:d,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=m,this.done=!1,this.delegate=null,this.method="next",this.arg=m,this.tryEntries.forEach(p),!e)for(var t in this)"t"===t.charAt(0)&&_.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=m)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return i.type="throw",i.arg=e,n.next=t,r&&(n.method="next",n.arg=m),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=_.call(o,"catchLoc"),u=_.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&_.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,P):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),P},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),p(n),P}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;p(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:y(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=m),P}}}(function(){return this}()||Function("return this")())}).call(t,n(2)(e))},function(e,t,n){"use strict";e.exports=n(12).default,e.exports.default=e.exports,Object.defineProperty(e.exports,"__esModule",{value:!0})},function(e,t,n){"use strict";function r(e){return new a.Database(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3);t.aql=o.aql;var i=n(1),a=n(15);t.Database=a.Database;var u=n(0);t.default=r,Object.assign(r,{CollectionType:i.CollectionType,ArangoError:u.ArangoError,Database:a.Database,aql:o.aql});var s=n(1);t.DocumentCollection=s.DocumentCollection,t.EdgeCollection=s.EdgeCollection;var c=n(8);t.Graph=c.Graph},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14);r=r.default||r,t.default=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":a(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":a(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return Object.defineProperty(n,"message",{configurable:!0,enumerable:!1,value:e,writable:!0}),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:n.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?(Error.captureStackTrace(n,n.constructor),o(n)):(Object.defineProperty(n,"stack",{configurable:!0,enumerable:!1,value:new Error(e).stack,writable:!0}),n)}return i(t,e),t}(function(e){function t(){e.apply(this,arguments)}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error));t.default=u},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,i){try{var a=t[o](i),u=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(u).then(function(e){r("next",e)},function(e){r("throw",e)});e(u)}return r("next")})}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){return l.isArangoCollection(e)?String(e.name):String(e)}var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();Object.defineProperty(t,"__esModule",{value:!0});var h=n(3),l=n(1),f=n(16),p=n(4),d=n(0),y=n(8),v=n(38),m=n(39),b=n(40),_=n(41),g=function(){function e(t){i(this,e),this._connection=new f.Connection(t),this.useBasicAuth()}return c(e,[{key:"route",value:function(e,t){return new v.Route(this._connection,e,t)}},{key:"acquireHostList",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._connection.getDatabaseName()){e.next=2;break}throw new Error("Cannot acquire host list with absolute URL");case 2:return e.next=4,this._connection.request({path:"/_api/cluster/endpoints"},function(e){return e.body.endpoints.map(function(e){return e.endpoint})});case 4:t=e.sent,this._connection.addToHostList(t);case 6:case"end":return e.stop()}},e,this)}));return e}()},{key:"close",value:function(){this._connection.close()}},{key:"useDatabase",value:function(e){return this._connection.setDatabaseName(e),this}},{key:"useBearerAuth",value:function(e){return this._connection.setHeader("authorization","Bearer "+e),this}},{key:"useBasicAuth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"root",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this._connection.setHeader("authorization","Basic "+m.btoa(e+":"+t)),this}},{key:"get",value:function(){return this._connection.request({path:"/_api/database/current"},function(e){return e.body.result})}},{key:"exists",value:function(){return this.get().then(function(){return!0},function(e){if(d.isArangoError(e)&&1228===e.errorNum)return!1;throw e})}},{key:"createDatabase",value:function(e,t){return this._connection.request({method:"POST",path:"/_api/database",body:{users:t,name:e}},function(e){return e.body})}},{key:"listDatabases",value:function(){return this._connection.request({path:"/_api/database"},function(e){return e.body.result})}},{key:"listUserDatabases",value:function(){return this._connection.request({path:"/_api/database/user"},function(e){return e.body.result})}},{key:"dropDatabase",value:function(e){return this._connection.request({method:"DELETE",path:"/_api/database/"+e},function(e){return e.body})}},{key:"collection",value:function(e){return new l.DocumentCollection(this._connection,e)}},{key:"edgeCollection",value:function(e){return new l.EdgeCollection(this._connection,e)}},{key:"listCollections",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._connection.request({path:"/_api/collection",qs:{excludeSystem:t}},function(t){return e._connection.arangoMajor<=2?t.body.collections:t.body.result})}},{key:"collections",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){var t,n=this,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.listCollections(r);case 2:return t=e.sent,e.abrupt("return",t.map(function(e){return l.constructCollection(n._connection,e)}));case 4:case"end":return e.stop()}},e,this)}));return e}()},{key:"truncate",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){var t,n=this,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.listCollections(r);case 2:return t=e.sent,e.next=5,Promise.all(t.map(function(e){return n._connection.request({method:"PUT",path:"/_api/collection/"+e.name+"/truncate"},function(e){return e.body})}));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e,this)}));return e}()},{key:"arangoSearchView",value:function(e){return new _.ArangoSearchView(this._connection,e)}},{key:"listViews",value:function(){return this._connection.request({path:"/_api/view"},function(e){return e.body.result})}},{key:"views",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){var t,n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.listViews();case 2:return t=e.sent,e.abrupt("return",t.map(function(e){return _.constructView(n._connection,e)}));case 4:case"end":return e.stop()}},e,this)}));return e}()},{key:"graph",value:function(e){return new y.Graph(this._connection,e)}},{key:"listGraphs",value:function(){return this._connection.request({path:"/_api/gharial"},function(e){return e.body.graphs})}},{key:"graphs",value:function(){function e(){return t.apply(this,arguments)}var t=o(regeneratorRuntime.mark(function e(){var t,n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.listGraphs();case 2:return t=e.sent,e.abrupt("return",t.map(function(e){return n.graph(e._key)}));case 4:case"end":return e.stop()}},e,this)}));return e}()},{key:"transaction",value:function(e,t,n,r){return"number"==typeof n&&(r=n,n=void 0),"number"==typeof r&&(r={lockTimeout:r}),"string"==typeof e?e={write:[e]}:Array.isArray(e)?e={write:e.map(a)}:l.isArangoCollection(e)?e={write:a(e)}:e&&"object"===(void 0===e?"undefined":s(e))&&(e=u({},e),e.read&&(Array.isArray(e.read)?e.read=e.read.map(a):e.read=a(e.read)),e.write&&(Array.isArray(e.write)?e.write=e.write.map(a):e.write=a(e.write))),this._connection.request({method:"POST",path:"/_api/transactio