mindsdb-js-sdk
Advanced tools
Comparing version 0.3.9 to 0.3.10
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).MindsDB=e()}(this,function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};var e=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var n=function(t){if(Array.isArray(t)){for(var e=0,n=[];t.length>e;e++)n[e]=t[e];return n}};var r=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var o=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var a=function(t){return n(t)||r(t)||o()};function i(t,e){return t(e={exports:{}},e.exports),e.exports}var u=i(function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n,r){var o=Object.create((e&&e.prototype instanceof m?e:m).prototype),a=new j(r||[]);return o._invoke=function(t,e,n){var r=f;return function(o,a){if(r===l)throw Error("Generator is already running");if(r===h){if("throw"===o)throw a;return O()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var u=E(i,n);if(u){if(u===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=l;var c=s(t,e,n);if("normal"===c.type){if(r=n.done?h:p,c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=h,n.method="throw",n.arg=c.arg)}}}(t,n,a),o}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f="suspendedStart",p="suspendedYield",l="executing",h="completed",d={};function m(){}function y(){}function v(){}var w={};w[a]=function(){return this};var g=Object.getPrototypeOf,b=g&&g(g(R([])));b&&b!==n&&r.call(b,a)&&(w=b);var x=v.prototype=m.prototype=Object.create(w);function k(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function _(t){var e;this._invoke=function(n,o){function a(){return new Promise(function(e,a){!function e(n,o,a,i){var u=s(t[n],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?Promise.resolve(f.__await).then(function(t){e("next",t,a,i)},function(t){e("throw",t,a,i)}):Promise.resolve(f).then(function(t){c.value=t,a(c)},function(t){return e("throw",t,a,i)})}i(u.arg)}(n,o,e,a)})}return e=e?e.then(a,a):a()}}function E(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,E(t,n),"throw"===n.method))return d;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=s(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function R(t){if(t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:O}}function O(){return{value:e,done:!0}}return y.prototype=x.constructor=v,v.constructor=y,v[u]=y.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},k(_.prototype),_.prototype[i]=function(){return this},t.AsyncIterator=_,t.async=function(e,n,r,o){var a=new _(c(e,n,r,o));return t.isGeneratorFunction(n)?a:a.next().then(function(t){return t.done?t.value:a.next()})},k(x),x[u]="Generator",x[a]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=R,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return o(i.catchLoc,!0);if(i.finallyLoc>this.prev)return o(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var a=o;break}}!a||"break"!==t&&"continue"!==t||a.tryLoc>e||e>a.finallyLoc||(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;S(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}),c=i(function(t){function e(t){return(e="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)}function n(r){return t.exports=n="function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?function(t){return e(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n});function s(t,e,n,r,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}var f=function(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(t){s(a,r,o,i,u,"next",t)}function u(t){s(a,r,o,i,u,"throw",t)}i(void 0)})}},p=function(t,e){return function(){for(var n=[],r=0;n.length>r;r++)n[r]=arguments[r];return t.apply(e,n)}},l=Object.prototype.toString;function h(t){return"[object Array]"===l.call(t)}function d(t){return null!==t&&"object"==typeof t}function m(t){return"[object Function]"===l.call(t)}function y(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),h(t))for(var n=0,r=t.length;r>n;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}var v={isArray:h,isArrayBuffer:function(t){return"[object ArrayBuffer]"===l.call(t)},isBuffer:function(t){return null!=t&&null!=t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:d,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===l.call(t)},isFile:function(t){return"[object File]"===l.call(t)},isBlob:function(t){return"[object Blob]"===l.call(t)},isFunction:m,isStream:function(t){return d(t)&&m(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:y,merge:function t(){var e={};function n(n,r){e[r]="object"==typeof e[r]&&"object"==typeof n?t(e[r],n):n}for(var r=0,o=arguments.length;o>r;r++)y(arguments[r],n);return e},extend:function(t,e,n){return y(e,function(e,r){t[r]=n&&"function"==typeof e?p(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}},w=function(t,e,n,r,o){return function(t,e,n,r,o){return t.config=e,n&&(t.code=n),t.request=r,t.response=o,t}(Error(t),e,n,r,o)};function g(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var b=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],x=v.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=r(window.location.href),function(e){var n=v.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},k=v.isStandardBrowserEnv()?{write:function(t,e,n,r,o,a){var i=[];i.push(t+"="+encodeURIComponent(e)),v.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),v.isString(r)&&i.push("path="+r),v.isString(o)&&i.push("domain="+o),!0===a&&i.push("secure"),document.cookie=i.join("; ")},read:function(t){var e=document.cookie.match(RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},_=function(t){return new Promise(function(e,n){var r=t.data,o=t.headers;v.isFormData(r)&&delete o["Content-Type"];var a=new XMLHttpRequest;t.auth&&(o.Authorization="Basic "+btoa((t.auth.username||"")+":"+(t.auth.password||"")));if(a.open(t.method.toUpperCase(),function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(v.isURLSearchParams(e))r=""+e;else{var o=[];v.forEach(e,function(t,e){null!=t&&(v.isArray(t)?e+="[]":t=[t],v.forEach(t,function(t){v.isDate(t)?t=t.toISOString():v.isObject(t)&&(t=JSON.stringify(t)),o.push(g(e)+"="+g(t))}))}),r=o.join("&")}return r&&(t+=(-1===t.indexOf("?")?"?":"&")+r),t}(t.url,t.params,t.paramsSerializer),!0),a.timeout=t.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var r,o,i,u,c,s="getAllResponseHeaders"in a?(r=a.getAllResponseHeaders(),c={},r?(v.forEach(r.split("\n"),function(t){if(u=t.indexOf(":"),o=v.trim(t.substr(0,u)).toLowerCase(),i=v.trim(t.substr(u+1)),o){if(c[o]&&b.indexOf(o)>=0)return;c[o]="set-cookie"===o?(c[o]?c[o]:[]).concat([i]):c[o]?c[o]+", "+i:i}}),c):c):null;!function(t,e,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(w("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}(e,n,{data:t.responseType&&"text"!==t.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:s,config:t,request:a}),a=null}},a.onerror=function(){n(w("Network Error",t,null,a)),a=null},a.ontimeout=function(){n(w("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",a)),a=null},v.isStandardBrowserEnv()){var i=k,u=(t.withCredentials||x(t.url))&&t.xsrfCookieName?i.read(t.xsrfCookieName):void 0;u&&(o[t.xsrfHeaderName]=u)}if("setRequestHeader"in a&&v.forEach(o,function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete o[e]:a.setRequestHeader(e,t)}),t.withCredentials&&(a.withCredentials=!0),t.responseType)try{a.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&a.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){a&&(a.abort(),n(t),a=null)}),void 0===r&&(r=null),a.send(r)})},E={"Content-Type":"application/x-www-form-urlencoded"};function L(t,e){!v.isUndefined(t)&&v.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var S,j={adapter:("undefined"!=typeof XMLHttpRequest?S=_:"undefined"!=typeof process&&(S=_),S),transformRequest:[function(t,e){return function(t,e){v.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}(e,"Content-Type"),v.isFormData(t)||v.isArrayBuffer(t)||v.isBuffer(t)||v.isStream(t)||v.isFile(t)||v.isBlob(t)?t:v.isArrayBufferView(t)?t.buffer:v.isURLSearchParams(t)?(L(e,"application/x-www-form-urlencoded;charset=utf-8"),""+t):v.isObject(t)?(L(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&300>t}};j.headers={common:{Accept:"application/json, text/plain, */*"}},v.forEach(["delete","get","head"],function(t){j.headers[t]={}}),v.forEach(["post","put","patch"],function(t){j.headers[t]=v.merge(E)});var R=j;function O(){this.handlers=[]}O.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},O.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},O.prototype.forEach=function(t){v.forEach(this.handlers,function(e){null!==e&&t(e)})};var C=O,T=function(t,e,n){return v.forEach(n,function(n){t=n(t,e)}),t},U=function(t){return!(!t||!t.__CANCEL__)};function A(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var P=function(t){var e,n;return A(t),t.baseURL&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t.url)&&(t.url=(e=t.baseURL,(n=t.url)?e.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):e)),t.headers=t.headers||{},t.data=T(t.data,t.headers,t.transformRequest),t.headers=v.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),v.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||R.adapter)(t).then(function(e){return A(t),e.data=T(e.data,e.headers,t.transformResponse),e},function(e){return U(e)||(A(t),e&&e.response&&(e.response.data=T(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})};function N(t){this.defaults=t,this.interceptors={request:new C,response:new C}}N.prototype.request=function(t){"string"==typeof t&&(t=v.merge({url:arguments[0]},arguments[1])),(t=v.merge(R,{method:"get"},this.defaults,t)).method=t.method.toLowerCase();var e=[P,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},v.forEach(["delete","get","head","options"],function(t){N.prototype[t]=function(e,n){return this.request(v.merge(n||{},{method:t,url:e}))}}),v.forEach(["post","put","patch"],function(t){N.prototype[t]=function(e,n,r){return this.request(v.merge(r||{},{method:t,url:e,data:n}))}});var F=N;function B(t){this.message=t}B.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},B.prototype.__CANCEL__=!0;var D=B;function q(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var n=this;t(function(t){n.reason||(n.reason=new D(t),e(n.reason))})}q.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},q.source=function(){var t;return{token:new q(function(e){t=e}),cancel:t}};var I=q;function G(t){var e=new F(t),n=p(F.prototype.request,e);return v.extend(n,F.prototype,e),v.extend(n,e),n}var H=G(R);H.Axios=F,H.create=function(t){return G(v.merge(R,t))},H.Cancel=D,H.CancelToken=I,H.isCancel=U,H.all=function(t){return Promise.all(t)},H.spread=function(t){return function(e){return t.apply(null,e)}};var z=H;z.default=H;var M=z,X=function(t,e){var n="";return t?(t.forEach(function(t,e){if(t.value){var r=encodeURIComponent(t.key)+"="+encodeURIComponent(t.value);n=n.concat(e>0?"&".concat(r):r)}}),n.length>0?e+"?"+n:e):e},V={url:null,api:null,token:{key:"apikey",value:null},version:.2},$=function(t){return new Q(t)},J=function(t){return new Y(t)},K=function(t,e){var n=window.URL.createObjectURL(new Blob([t.data])),r=document.createElement("a");r.href=n;var o=t.headers["content-disposition"],a=null;if(o){var i=o.match(/filename="?(.+)"?/);2===i.length&&(a=i[1])}if(!a&&e){var u=e.split("/"),c=u[u.length-1];u=c.split("\\"),a=c=u[u.length-1]}r.setAttribute("download",a=a||"unknown"),document.body.appendChild(r),r.click(),r.remove(),window.URL.revokeObjectURL(n)},Q=function n(r){var o=this;t(this,n),e(this,"loaded",!1),e(this,"name",""),e(this,"version",""),e(this,"is_active",!1),e(this,"data_source",""),e(this,"predict",null),e(this,"accuracy",0),e(this,"status",""),e(this,"train_end_at",null),e(this,"updated_at",null),e(this,"created_at",null),e(this,"data_preparation",null),e(this,"data_analysis",null),e(this,"model_analysis",null),e(this,"columns",null),e(this,"load",function(){var t=f(u.mark(function t(e){var n,r,i;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r="/predictors}",void 0!==o.name&&""!==o.name&&(r+="/".concat(o.name)),i=X(n,r),t.next=6,V.api.get(i);case 6:return Object.assign(o,t.sent.data),t.abrupt("return",o);case 9:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"rename",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(e.oldName,"/rename?new_name=").concat(e.newName)),t.next=4,V.api.get(r);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadColumns",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(o.name,"/columns")),t.next=4,V.api.get(r);case 4:return o.columns=t.sent.data,t.abrupt("return",o);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"learn",function(){var t=f(u.mark(function t(e,n){var r,i,c,s,f,p;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.dataSourceName,i=e.fromData,s={to_predict:e.toPredict},(c=e.kwargs)&&(s.kwargs=c),r?s.data_source_name=r:i&&(s.from_data=i),f=n?[].concat(a(n),[V.token]):[V.token],p=X(f,"/predictors/".concat(o.name)),t.next=8,V.api.put(p,s);case 8:return t.abrupt("return",t.sent.data);case 10:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()),e(this,"queryPredict",function(){var t=f(u.mark(function t(e,n,r){var i,c;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=n?[].concat(a(n),[V.token]):[V.token],c=X(i,"/predictors/".concat(o.name,"/predict")),t.next=4,V.api.post(c,{when:e,format_flag:r});case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}},t)}));return function(e,n,r){return t.apply(this,arguments)}}()),e(this,"delete",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(o.name)),t.next=4,V.api.delete(r);case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"upload",function(){var t=f(u.mark(function t(e,n,r){var o,i,c,s;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=r?[].concat(a(r),[V.token]):[V.token],(i=new FormData).append("file",e),c={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))}},s=X(o,"/predictors/upload"),t.next=7,V.api.post(s,i,c);case 7:case"end":return t.stop()}},t)}));return function(e,n,r){return t.apply(this,arguments)}}()),e(this,"download",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(o.name,"/download")),t.next=4,V.api.get(r,{responseType:"blob"});case 4:return K(t.sent),t.abrupt("return",o);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"getDownloadUrl",function(){return"".concat(V.url,"/predictors/").concat(o.name,"/download")}),Object.assign(this,r)},Y=function n(r){var o=this;t(this,n),e(this,"loaded",!1),e(this,"source_type","url"),e(this,"name",""),e(this,"source",""),e(this,"missed_files",!1),e(this,"created_at",null),e(this,"updated_at",null),e(this,"row_count",0),e(this,"columns",null),e(this,"data",null),e(this,"missedFileList",null),e(this,"load",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name)),t.next=4,V.api.get(r);case 4:return Object.assign(o,t.sent.data),t.abrupt("return",o);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"upload",function(){var t=f(u.mark(function t(e,n,r){var i,c,s,f;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o.source_type="file",o.source=e.name,i=r?[].concat(a(r),[V.token]):[V.token],(c=new FormData).append("name",o.name),c.append("source_type",o.source_type),c.append("source",o.source),c.append("file",e),s={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))},timeout:6e5},f=X(i,"/datasources/".concat(o.name)),t.next=12,V.api.put(f,c,s);case 12:case"end":return t.stop()}},t)}));return function(e,n,r){return t.apply(this,arguments)}}()),e(this,"uploadFromUrl",function(){var t=f(u.mark(function t(e,n){var r,i,c;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o.source_type="url",o.source=e,r={name:o.name,source_type:o.source_type,source:o.source},i=n?[].concat(a(n),[V.token]):[V.token],c=X(i,"/datasources/".concat(o.name)),t.next=7,V.api.put(c,r);case 7:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()),e(this,"download",function(){var t=f(u.mark(function t(e){var n,r,i;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.getDownloadUrl(),r=e?[].concat(a(e),[V.token]):[V.token],i=X(r,n),t.next=5,V.api.get(i,{responseType:"blob"});case 5:return K(t.sent,o.source),t.abrupt("return",o);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"getDownloadUrl",function(){return"url"===o.source_type?o.source:"".concat(V.url,"/datasources/").concat(o.name,"/download")}),e(this,"delete",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name)),t.next=4,V.api.delete(r);case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadData",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name,"/data")),t.next=4,V.api.get(r);case 4:return o.data=t.sent.data,t.abrupt("return",o.data);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadDataQuality",function(){var t=f(u.mark(function t(e){var n,r,i,c;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name,"/analyze")),t.next=4,V.api.get(r);case 4:i=t.sent;try{c={data_analysis_v1:i.data.data_analysis.input_columns_metadata,data_analysis_v2:i.data.data_analysis_v2}}catch(t){c=null}return o.dataQuality=c,t.abrupt("return",c);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadMissedFileList",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name,"/missed_files")),t.next=4,V.api.get(r);case 4:return o.missedFileList=t.sent.data,t.abrupt("return",o.missedFileList);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"uploadFile",function(){var t=f(u.mark(function t(e,n){var r,i,c,s,f,p,l;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.column,i=e.rowIndex,c=e.extension,s=e.file,(f=new FormData).append("file",s),f.append("extension",c),p=n?[].concat(a(n),[V.token]):[V.token],l=X(p,"/datasources/".concat(o.name,"/files/").concat(r,":").concat(i)),t.next=8,V.api.put(l,f);case 8:return t.abrupt("return",200===t.sent.status);case 10:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()),Object.assign(this,r)};return{connect:function(t,e){V.token.value=e.find(function(t){return"apikey"===t.key}).value,V.url=X([V.token],t),V.api=M.create({baseURL:t,timeout:2e4})},disconnect:function(){V.url=null,V.token={key:"apikey",value:null},V.api=null},ping:function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=X([V.token],"/util/ping"),t.next=3,V.api.get(n);case 3:if(200!==(r=t.sent).status||"object"!==c(r.data)||"ok"!==r.data.status){t.next=6;break}return t.abrupt("return",!0);case 6:return t.abrupt("return",!1);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),predictors:function(){var t=f(u.mark(function t(e){var n,r,o;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/"),t.next=4,V.api.get(r);case 4:return o=(t.sent.data||[]).map($),t.abrupt("return",o);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),dataSources:function(){var t=f(u.mark(function t(e){var n,r,o;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/"),t.next=4,V.api.get(r);case 4:return o=(t.sent.data||[]).map(J),t.abrupt("return",o);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),DataSource:J,Predictor:$}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).MindsDB=e()}(this,function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};var e=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var n=function(t){if(Array.isArray(t)){for(var e=0,n=[];t.length>e;e++)n[e]=t[e];return n}};var r=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var o=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var a=function(t){return n(t)||r(t)||o()};function i(t,e){return t(e={exports:{}},e.exports),e.exports}var u=i(function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n,r){var o=Object.create((e&&e.prototype instanceof m?e:m).prototype),a=new j(r||[]);return o._invoke=function(t,e,n){var r=f;return function(o,a){if(r===l)throw Error("Generator is already running");if(r===h){if("throw"===o)throw a;return O()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var u=E(i,n);if(u){if(u===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===f)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=l;var c=s(t,e,n);if("normal"===c.type){if(r=n.done?h:p,c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=h,n.method="throw",n.arg=c.arg)}}}(t,n,a),o}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f="suspendedStart",p="suspendedYield",l="executing",h="completed",d={};function m(){}function y(){}function v(){}var w={};w[a]=function(){return this};var g=Object.getPrototypeOf,b=g&&g(g(R([])));b&&b!==n&&r.call(b,a)&&(w=b);var x=v.prototype=m.prototype=Object.create(w);function k(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function _(t){var e;this._invoke=function(n,o){function a(){return new Promise(function(e,a){!function e(n,o,a,i){var u=s(t[n],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?Promise.resolve(f.__await).then(function(t){e("next",t,a,i)},function(t){e("throw",t,a,i)}):Promise.resolve(f).then(function(t){c.value=t,a(c)},function(t){return e("throw",t,a,i)})}i(u.arg)}(n,o,e,a)})}return e=e?e.then(a,a):a()}}function E(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,E(t,n),"throw"===n.method))return d;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=s(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,d):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function R(t){if(t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:O}}function O(){return{value:e,done:!0}}return y.prototype=x.constructor=v,v.constructor=y,v[u]=y.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},k(_.prototype),_.prototype[i]=function(){return this},t.AsyncIterator=_,t.async=function(e,n,r,o){var a=new _(c(e,n,r,o));return t.isGeneratorFunction(n)?a:a.next().then(function(t){return t.done?t.value:a.next()})},k(x),x[u]="Generator",x[a]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=R,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(i.catchLoc>this.prev)return o(i.catchLoc,!0);if(i.finallyLoc>this.prev)return o(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return o(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var a=o;break}}!a||"break"!==t&&"continue"!==t||a.tryLoc>e||e>a.finallyLoc||(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;S(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}),c=i(function(t){function e(t){return(e="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)}function n(r){return t.exports=n="function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?function(t){return e(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n});function s(t,e,n,r,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}var f=function(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(t){s(a,r,o,i,u,"next",t)}function u(t){s(a,r,o,i,u,"throw",t)}i(void 0)})}},p=function(t,e){return function(){for(var n=[],r=0;n.length>r;r++)n[r]=arguments[r];return t.apply(e,n)}},l=Object.prototype.toString;function h(t){return"[object Array]"===l.call(t)}function d(t){return null!==t&&"object"==typeof t}function m(t){return"[object Function]"===l.call(t)}function y(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),h(t))for(var n=0,r=t.length;r>n;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}var v={isArray:h,isArrayBuffer:function(t){return"[object ArrayBuffer]"===l.call(t)},isBuffer:function(t){return null!=t&&null!=t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:d,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===l.call(t)},isFile:function(t){return"[object File]"===l.call(t)},isBlob:function(t){return"[object Blob]"===l.call(t)},isFunction:m,isStream:function(t){return d(t)&&m(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:y,merge:function t(){var e={};function n(n,r){e[r]="object"==typeof e[r]&&"object"==typeof n?t(e[r],n):n}for(var r=0,o=arguments.length;o>r;r++)y(arguments[r],n);return e},extend:function(t,e,n){return y(e,function(e,r){t[r]=n&&"function"==typeof e?p(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}},w=function(t,e,n,r,o){return function(t,e,n,r,o){return t.config=e,n&&(t.code=n),t.request=r,t.response=o,t}(Error(t),e,n,r,o)};function g(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var b=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],x=v.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=r(window.location.href),function(e){var n=v.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},k=v.isStandardBrowserEnv()?{write:function(t,e,n,r,o,a){var i=[];i.push(t+"="+encodeURIComponent(e)),v.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),v.isString(r)&&i.push("path="+r),v.isString(o)&&i.push("domain="+o),!0===a&&i.push("secure"),document.cookie=i.join("; ")},read:function(t){var e=document.cookie.match(RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},_=function(t){return new Promise(function(e,n){var r=t.data,o=t.headers;v.isFormData(r)&&delete o["Content-Type"];var a=new XMLHttpRequest;t.auth&&(o.Authorization="Basic "+btoa((t.auth.username||"")+":"+(t.auth.password||"")));if(a.open(t.method.toUpperCase(),function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(v.isURLSearchParams(e))r=""+e;else{var o=[];v.forEach(e,function(t,e){null!=t&&(v.isArray(t)?e+="[]":t=[t],v.forEach(t,function(t){v.isDate(t)?t=t.toISOString():v.isObject(t)&&(t=JSON.stringify(t)),o.push(g(e)+"="+g(t))}))}),r=o.join("&")}return r&&(t+=(-1===t.indexOf("?")?"?":"&")+r),t}(t.url,t.params,t.paramsSerializer),!0),a.timeout=t.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var r,o,i,u,c,s="getAllResponseHeaders"in a?(r=a.getAllResponseHeaders(),c={},r?(v.forEach(r.split("\n"),function(t){if(u=t.indexOf(":"),o=v.trim(t.substr(0,u)).toLowerCase(),i=v.trim(t.substr(u+1)),o){if(c[o]&&b.indexOf(o)>=0)return;c[o]="set-cookie"===o?(c[o]?c[o]:[]).concat([i]):c[o]?c[o]+", "+i:i}}),c):c):null;!function(t,e,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(w("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}(e,n,{data:t.responseType&&"text"!==t.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:s,config:t,request:a}),a=null}},a.onerror=function(){n(w("Network Error",t,null,a)),a=null},a.ontimeout=function(){n(w("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",a)),a=null},v.isStandardBrowserEnv()){var i=k,u=(t.withCredentials||x(t.url))&&t.xsrfCookieName?i.read(t.xsrfCookieName):void 0;u&&(o[t.xsrfHeaderName]=u)}if("setRequestHeader"in a&&v.forEach(o,function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete o[e]:a.setRequestHeader(e,t)}),t.withCredentials&&(a.withCredentials=!0),t.responseType)try{a.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&a.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){a&&(a.abort(),n(t),a=null)}),void 0===r&&(r=null),a.send(r)})},E={"Content-Type":"application/x-www-form-urlencoded"};function L(t,e){!v.isUndefined(t)&&v.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var S,j={adapter:("undefined"!=typeof XMLHttpRequest?S=_:"undefined"!=typeof process&&(S=_),S),transformRequest:[function(t,e){return function(t,e){v.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}(e,"Content-Type"),v.isFormData(t)||v.isArrayBuffer(t)||v.isBuffer(t)||v.isStream(t)||v.isFile(t)||v.isBlob(t)?t:v.isArrayBufferView(t)?t.buffer:v.isURLSearchParams(t)?(L(e,"application/x-www-form-urlencoded;charset=utf-8"),""+t):v.isObject(t)?(L(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&300>t}};j.headers={common:{Accept:"application/json, text/plain, */*"}},v.forEach(["delete","get","head"],function(t){j.headers[t]={}}),v.forEach(["post","put","patch"],function(t){j.headers[t]=v.merge(E)});var R=j;function O(){this.handlers=[]}O.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},O.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},O.prototype.forEach=function(t){v.forEach(this.handlers,function(e){null!==e&&t(e)})};var C=O,T=function(t,e,n){return v.forEach(n,function(n){t=n(t,e)}),t},U=function(t){return!(!t||!t.__CANCEL__)};function A(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var P=function(t){var e,n;return A(t),t.baseURL&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t.url)&&(t.url=(e=t.baseURL,(n=t.url)?e.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):e)),t.headers=t.headers||{},t.data=T(t.data,t.headers,t.transformRequest),t.headers=v.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),v.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||R.adapter)(t).then(function(e){return A(t),e.data=T(e.data,e.headers,t.transformResponse),e},function(e){return U(e)||(A(t),e&&e.response&&(e.response.data=T(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})};function N(t){this.defaults=t,this.interceptors={request:new C,response:new C}}N.prototype.request=function(t){"string"==typeof t&&(t=v.merge({url:arguments[0]},arguments[1])),(t=v.merge(R,{method:"get"},this.defaults,t)).method=t.method.toLowerCase();var e=[P,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},v.forEach(["delete","get","head","options"],function(t){N.prototype[t]=function(e,n){return this.request(v.merge(n||{},{method:t,url:e}))}}),v.forEach(["post","put","patch"],function(t){N.prototype[t]=function(e,n,r){return this.request(v.merge(r||{},{method:t,url:e,data:n}))}});var F=N;function B(t){this.message=t}B.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},B.prototype.__CANCEL__=!0;var D=B;function q(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(t){e=t});var n=this;t(function(t){n.reason||(n.reason=new D(t),e(n.reason))})}q.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},q.source=function(){var t;return{token:new q(function(e){t=e}),cancel:t}};var I=q;function G(t){var e=new F(t),n=p(F.prototype.request,e);return v.extend(n,F.prototype,e),v.extend(n,e),n}var H=G(R);H.Axios=F,H.create=function(t){return G(v.merge(R,t))},H.Cancel=D,H.CancelToken=I,H.isCancel=U,H.all=function(t){return Promise.all(t)},H.spread=function(t){return function(e){return t.apply(null,e)}};var z=H;z.default=H;var M=z,X=function(t,e){var n="";return t?(t.forEach(function(t,e){if(t.value){var r=encodeURIComponent(t.key)+"="+encodeURIComponent(t.value);n=n.concat(e>0?"&".concat(r):r)}}),n.length>0?e+"?"+n:e):e},V={url:null,api:null,token:{key:"apikey",value:null},version:.2},$=function(t){return new Q(t)},J=function(t){return new Y(t)},K=function(t,e){var n=window.URL.createObjectURL(new Blob([t.data])),r=document.createElement("a");r.href=n;var o=t.headers["content-disposition"],a=null;if(o){var i=o.match(/filename="?(.+)"?/);2===i.length&&(a=i[1])}if(!a&&e){var u=e.split("/"),c=u[u.length-1];u=c.split("\\"),a=c=u[u.length-1]}r.setAttribute("download",a=a||"unknown"),document.body.appendChild(r),r.click(),r.remove(),window.URL.revokeObjectURL(n)},Q=function n(r){var o=this;t(this,n),e(this,"loaded",!1),e(this,"name",""),e(this,"version",""),e(this,"is_active",!1),e(this,"data_source",""),e(this,"predict",null),e(this,"accuracy",0),e(this,"status",""),e(this,"train_end_at",null),e(this,"updated_at",null),e(this,"created_at",null),e(this,"data_preparation",null),e(this,"data_analysis",null),e(this,"model_analysis",null),e(this,"columns",null),e(this,"load",function(){var t=f(u.mark(function t(e){var n,r,i;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r="/predictors/",void 0!==o.name&&""!==o.name&&(r+="/".concat(o.name)),i=X(n,r),t.next=6,V.api.get(i);case 6:return Object.assign(o,t.sent.data),t.abrupt("return",o);case 9:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"rename",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(e.oldName,"/rename?new_name=").concat(e.newName)),t.next=4,V.api.get(r);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadColumns",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(o.name,"/columns")),t.next=4,V.api.get(r);case 4:return o.columns=t.sent.data,t.abrupt("return",o);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"learn",function(){var t=f(u.mark(function t(e,n){var r,i,c,s,f,p;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.dataSourceName,i=e.fromData,s={to_predict:e.toPredict},(c=e.kwargs)&&(s.kwargs=c),r?s.data_source_name=r:i&&(s.from_data=i),f=n?[].concat(a(n),[V.token]):[V.token],p=X(f,"/predictors/".concat(o.name)),t.next=8,V.api.put(p,s);case 8:return t.abrupt("return",t.sent.data);case 10:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()),e(this,"queryPredict",function(){var t=f(u.mark(function t(e,n,r){var i,c;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=n?[].concat(a(n),[V.token]):[V.token],c=X(i,"/predictors/".concat(o.name,"/predict")),t.next=4,V.api.post(c,{when:e,format_flag:r});case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}},t)}));return function(e,n,r){return t.apply(this,arguments)}}()),e(this,"delete",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(o.name)),t.next=4,V.api.delete(r);case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"upload",function(){var t=f(u.mark(function t(e,n,r){var o,i,c,s;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=r?[].concat(a(r),[V.token]):[V.token],(i=new FormData).append("file",e),c={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))}},s=X(o,"/predictors/upload"),t.next=7,V.api.post(s,i,c);case 7:case"end":return t.stop()}},t)}));return function(e,n,r){return t.apply(this,arguments)}}()),e(this,"download",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/".concat(o.name,"/download")),t.next=4,V.api.get(r,{responseType:"blob"});case 4:return K(t.sent),t.abrupt("return",o);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"getDownloadUrl",function(){return"".concat(V.url,"/predictors/").concat(o.name,"/download")}),Object.assign(this,r)},Y=function n(r){var o=this;t(this,n),e(this,"loaded",!1),e(this,"source_type","url"),e(this,"name",""),e(this,"source",""),e(this,"missed_files",!1),e(this,"created_at",null),e(this,"updated_at",null),e(this,"row_count",0),e(this,"columns",null),e(this,"data",null),e(this,"missedFileList",null),e(this,"load",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name)),t.next=4,V.api.get(r);case 4:return Object.assign(o,t.sent.data),t.abrupt("return",o);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"upload",function(){var t=f(u.mark(function t(e,n,r){var i,c,s,f;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o.source_type="file",o.source=e.name,i=r?[].concat(a(r),[V.token]):[V.token],(c=new FormData).append("name",o.name),c.append("source_type",o.source_type),c.append("source",o.source),c.append("file",e),s={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))},timeout:6e5},f=X(i,"/datasources/".concat(o.name)),t.next=12,V.api.put(f,c,s);case 12:case"end":return t.stop()}},t)}));return function(e,n,r){return t.apply(this,arguments)}}()),e(this,"uploadFromUrl",function(){var t=f(u.mark(function t(e,n){var r,i,c;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o.source_type="url",o.source=e,r={name:o.name,source_type:o.source_type,source:o.source},i=n?[].concat(a(n),[V.token]):[V.token],c=X(i,"/datasources/".concat(o.name)),t.next=7,V.api.put(c,r);case 7:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()),e(this,"download",function(){var t=f(u.mark(function t(e){var n,r,i;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.getDownloadUrl(),r=e?[].concat(a(e),[V.token]):[V.token],i=X(r,n),t.next=5,V.api.get(i,{responseType:"blob"});case 5:return K(t.sent,o.source),t.abrupt("return",o);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"getDownloadUrl",function(){return"url"===o.source_type?o.source:"".concat(V.url,"/datasources/").concat(o.name,"/download")}),e(this,"delete",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name)),t.next=4,V.api.delete(r);case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadData",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name,"/data")),t.next=4,V.api.get(r);case 4:return o.data=t.sent.data,t.abrupt("return",o.data);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadDataQuality",function(){var t=f(u.mark(function t(e){var n,r,i,c;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name,"/analyze")),t.next=4,V.api.get(r);case 4:i=t.sent;try{c={data_analysis_v1:i.data.data_analysis.input_columns_metadata,data_analysis_v2:i.data.data_analysis_v2}}catch(t){c=null}return o.dataQuality=c,t.abrupt("return",c);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"loadMissedFileList",function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/".concat(o.name,"/missed_files")),t.next=4,V.api.get(r);case 4:return o.missedFileList=t.sent.data,t.abrupt("return",o.missedFileList);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),e(this,"uploadFile",function(){var t=f(u.mark(function t(e,n){var r,i,c,s,f,p,l;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.column,i=e.rowIndex,c=e.extension,s=e.file,(f=new FormData).append("file",s),f.append("extension",c),p=n?[].concat(a(n),[V.token]):[V.token],l=X(p,"/datasources/".concat(o.name,"/files/").concat(r,":").concat(i)),t.next=8,V.api.put(l,f);case 8:return t.abrupt("return",200===t.sent.status);case 10:case"end":return t.stop()}},t)}));return function(e,n){return t.apply(this,arguments)}}()),Object.assign(this,r)};return{connect:function(t,e){V.token.value=e.find(function(t){return"apikey"===t.key}).value,V.url=X([V.token],t),V.api=M.create({baseURL:t,timeout:2e4})},disconnect:function(){V.url=null,V.token={key:"apikey",value:null},V.api=null},ping:function(){var t=f(u.mark(function t(e){var n,r;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=X([V.token],"/util/ping"),t.next=3,V.api.get(n);case 3:if(200!==(r=t.sent).status||"object"!==c(r.data)||"ok"!==r.data.status){t.next=6;break}return t.abrupt("return",!0);case 6:return t.abrupt("return",!1);case 7:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),predictors:function(){var t=f(u.mark(function t(e){var n,r,o;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/predictors/"),t.next=4,V.api.get(r);case 4:return o=(t.sent.data||[]).map($),t.abrupt("return",o);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),dataSources:function(){var t=f(u.mark(function t(e){var n,r,o;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(a(e),[V.token]):[V.token],r=X(n,"/datasources/"),t.next=4,V.api.get(r);case 4:return o=(t.sent.data||[]).map(J),t.abrupt("return",o);case 8:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}(),DataSource:J,Predictor:$}}); |
@@ -339,3 +339,3 @@ import axios from 'axios'; | ||
mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; | ||
url_path = "/predictors}"; | ||
url_path = "/predictors/"; | ||
@@ -342,0 +342,0 @@ if (_this.name !== undefined && _this.name !== "") { |
@@ -258,3 +258,3 @@ 'use strict'; | ||
mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; | ||
url_path = "/predictors}"; | ||
url_path = "/predictors/"; | ||
@@ -261,0 +261,0 @@ if (_this.name !== undefined && _this.name !== "") { |
{ | ||
"name": "mindsdb-js-sdk", | ||
"version": "0.3.9", | ||
"version": "0.3.10", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/mindsdb/mindsdb_js_sdk#readme", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
204331