From f02ac052b1343452ab8bc9f28a5b0590eb8612a4 Mon Sep 17 00:00:00 2001 From: setohe0909 Date: Mon, 28 Jun 2021 14:46:17 -0500 Subject: [PATCH] Save integration name as it provided by user --- dist/mindsdb-sdk.js | 6 +++--- dist/mindsdb-sdk.min.js | 2 +- es/mindsdb-sdk.js | 6 +++--- es/mindsdb-sdk.mjs | 2 +- lib/mindsdb-sdk.js | 6 +++--- package.json | 2 +- src/index.js | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dist/mindsdb-sdk.js b/dist/mindsdb-sdk.js index 1876d97..65e7744 100644 --- a/dist/mindsdb-sdk.js +++ b/dist/mindsdb-sdk.js @@ -3412,7 +3412,7 @@ var DataBase = function DataBase(_data3) { switch (_context29.prev = _context29.next) { case 0: _context29.next = 2; - return connection.api.get("/config/integrations/".concat(params.database_name, "/check")); + return connection.api.get("/config/integrations/".concat(params.integrations_name, "/check")); case 2: return _context29.abrupt("return", _context29.sent); @@ -3438,7 +3438,7 @@ var DataBase = function DataBase(_data3) { switch (_context30.prev = _context30.next) { case 0: mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; - request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.database_name)); + request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.integrations_name)); _context30.next = 4; return connection.api.post(request, data); @@ -3467,7 +3467,7 @@ var DataBase = function DataBase(_data3) { switch (_context31.prev = _context31.next) { case 0: mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; - request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.database_name)); + request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.integrations_name)); _context31.next = 4; return connection.api.put(request, data); diff --git a/dist/mindsdb-sdk.min.js b/dist/mindsdb-sdk.min.js index 4f7b853..b8c570a 100644 --- a/dist/mindsdb-sdk.min.js +++ b/dist/mindsdb-sdk.min.js @@ -1 +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";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=t(e((function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0}))),r=t(e((function(t){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.default=t.exports,t.exports.__esModule=!0}))),o=e((function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r},t.exports.default=t.exports,t.exports.__esModule=!0}));t(o);var a=e((function(t){t.exports=function(t){if(Array.isArray(t))return o(t)},t.exports.default=t.exports,t.exports.__esModule=!0}));t(a);var i=e((function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0}));t(i);var s=e((function(t){t.exports=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0}));t(s);var u=e((function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));t(u);var c=t(e((function(t){t.exports=function(t){return a(t)||i(t)||s(t)||u()},t.exports.default=t.exports,t.exports.__esModule=!0}))),f=e((function(t){var e=function(t){var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new _(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return j()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var s=x(i,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=c(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function l(){}function d(){}var h={};h[o]=function(){return this};var m=Object.getPrototypeOf,v=m&&m(m(E([])));v&&v!==e&&n.call(v,o)&&(h=v);var y=d.prototype=p.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var r;this._invoke=function(o,a){function i(){return new e((function(r,i){!function r(o,a,i,s){var u=c(t[o],t,a);if("throw"!==u.type){var f=u.arg,p=f.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,i,s)}),(function(t){r("throw",t,i,s)})):e.resolve(p).then((function(t){f.value=t,i(f)}),(function(t){return r("throw",t,i,s)}))}s(u.arg)}(o,a,r,i)}))}return r=r?r.then(i,i):i()}}function x(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return r("end");if(this.prev>=a.tryLoc){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(a.catchLoc>this.prev)return r(a.catchLoc,!0);if(a.finallyLoc>this.prev)return r(a.finallyLoc)}else if(s){if(a.catchLoc>this.prev)return r(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.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,f):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),f},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),k(n),f}},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;k(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}})),p=t(e((function(t){function e(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=e=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),e(n)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}))),l=t(e((function(t){function e(t,e,n,r,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,o)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(o,a){var i=t.apply(n,r);function s(t){e(i,o,a,s,u,"next",t)}function u(t){e(i,o,a,s,u,"throw",t)}s(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0}))),d=function(t,e){return function(){for(var n=Array(arguments.length),r=0;n.length>r;r++)n[r]=arguments[r];return t.apply(e,n)}},h=Object.prototype.toString;function m(t){return"[object Array]"===h.call(t)}function v(t){return void 0===t}function y(t){return null!==t&&"object"==typeof t}function g(t){if("[object Object]"!==h.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function w(t){return"[object Function]"===h.call(t)}function x(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),m(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 b={isArray:m,isArrayBuffer:function(t){return"[object ArrayBuffer]"===h.call(t)},isBuffer:function(t){return null!==t&&!v(t)&&null!==t.constructor&&!v(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:y,isPlainObject:g,isUndefined:v,isDate:function(t){return"[object Date]"===h.call(t)},isFile:function(t){return"[object File]"===h.call(t)},isBlob:function(t){return"[object Blob]"===h.call(t)},isFunction:w,isStream:function(t){return y(t)&&w(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:x,merge:function t(){var e={};function n(n,r){e[r]=g(e[r])&&g(n)?t(e[r],n):g(n)?t({},n):m(n)?n.slice():n}for(var r=0,o=arguments.length;o>r;r++)x(arguments[r],n);return e},extend:function(t,e,n){return x(e,(function(e,r){t[r]=n&&"function"==typeof e?d(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}};function k(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var _=function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(b.isURLSearchParams(e))r=""+e;else{var o=[];b.forEach(e,(function(t,e){null!=t&&(b.isArray(t)?e+="[]":t=[t],b.forEach(t,(function(t){b.isDate(t)?t=t.toISOString():b.isObject(t)&&(t=JSON.stringify(t)),o.push(k(e)+"="+k(t))})))})),r=o.join("&")}if(r){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t};function E(){this.handlers=[]}E.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},E.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},E.prototype.forEach=function(t){b.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var j=E,O=function(t,e,n){return b.forEach(n,(function(n){t=n(t,e)})),t},L=function(t){return!(!t||!t.__CANCEL__)},S=function(t,e){b.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))},R=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.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}(Error(t),e,n,r,o)},C=b.isStandardBrowserEnv()?{write:function(t,e,n,r,o,a){var i=[];i.push(t+"="+encodeURIComponent(e)),b.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),b.isString(r)&&i.push("path="+r),b.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(){}},A=["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"],U=b.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=b.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},N=function(t){return new Promise((function(e,n){var r=t.data,o=t.headers;b.isFormData(r)&&delete o["Content-Type"];var a=new XMLHttpRequest;t.auth&&(o.Authorization="Basic "+btoa((t.auth.username||"")+":"+(t.auth.password?unescape(encodeURIComponent(t.auth.password)):"")));var i,s,u=(s=t.url,(i=t.baseURL)&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(s)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(i,s):s);if(a.open(t.method.toUpperCase(),_(u,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,s,u,c="getAllResponseHeaders"in a?(r=a.getAllResponseHeaders(),u={},r?(b.forEach(r.split("\n"),(function(t){if(s=t.indexOf(":"),o=b.trim(t.substr(0,s)).toLowerCase(),i=b.trim(t.substr(s+1)),o){if(u[o]&&A.indexOf(o)>=0)return;u[o]="set-cookie"===o?(u[o]?u[o]:[]).concat([i]):u[o]?u[o]+", "+i:i}})),u):u):null;!function(t,e,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(R("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:c,config:t,request:a}),a=null}},a.onabort=function(){a&&(n(R("Request aborted",t,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(R("Network Error",t,null,a)),a=null},a.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(R(e,t,"ECONNABORTED",a)),a=null},b.isStandardBrowserEnv()){var c=(t.withCredentials||U(u))&&t.xsrfCookieName?C.read(t.xsrfCookieName):void 0;c&&(o[t.xsrfHeaderName]=c)}if("setRequestHeader"in a&&b.forEach(o,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete o[e]:a.setRequestHeader(e,t)})),b.isUndefined(t.withCredentials)||(a.withCredentials=!!t.withCredentials),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)})),r||(r=null),a.send(r)}))},P={"Content-Type":"application/x-www-form-urlencoded"};function T(t,e){!b.isUndefined(t)&&b.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var B,D={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(B=N),B),transformRequest:[function(t,e){return S(e,"Accept"),S(e,"Content-Type"),b.isFormData(t)||b.isArrayBuffer(t)||b.isBuffer(t)||b.isStream(t)||b.isFile(t)||b.isBlob(t)?t:b.isArrayBufferView(t)?t.buffer:b.isURLSearchParams(t)?(T(e,"application/x-www-form-urlencoded;charset=utf-8"),""+t):b.isObject(t)?(T(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,maxBodyLength:-1,validateStatus:function(t){return t>=200&&300>t}};D.headers={common:{Accept:"application/json, text/plain, */*"}},b.forEach(["delete","get","head"],(function(t){D.headers[t]={}})),b.forEach(["post","put","patch"],(function(t){D.headers[t]=b.merge(P)}));var F=D;function M(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var q=function(t){return M(t),t.headers=t.headers||{},t.data=O(t.data,t.headers,t.transformRequest),t.headers=b.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),b.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||F.adapter)(t).then((function(e){return M(t),e.data=O(e.data,e.headers,t.transformResponse),e}),(function(e){return L(e)||(M(t),e&&e.response&&(e.response.data=O(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},I=function(t,e){e=e||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function s(t,e){return b.isPlainObject(t)&&b.isPlainObject(e)?b.merge(t,e):b.isPlainObject(e)?b.merge({},e):b.isArray(e)?e.slice():e}function u(r){b.isUndefined(e[r])?b.isUndefined(t[r])||(n[r]=s(void 0,t[r])):n[r]=s(t[r],e[r])}b.forEach(r,(function(t){b.isUndefined(e[t])||(n[t]=s(void 0,e[t]))})),b.forEach(o,u),b.forEach(a,(function(r){b.isUndefined(e[r])?b.isUndefined(t[r])||(n[r]=s(void 0,t[r])):n[r]=s(void 0,e[r])})),b.forEach(i,(function(r){r in e?n[r]=s(t[r],e[r]):r in t&&(n[r]=s(void 0,t[r]))}));var c=r.concat(o).concat(a).concat(i),f=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===c.indexOf(t)}));return b.forEach(f,u),n};function z(t){this.defaults=t,this.interceptors={request:new j,response:new j}}z.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=I(this.defaults,t)).method=t.method?t.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var e=[q,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},z.prototype.getUri=function(t){return t=I(this.defaults,t),_(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},b.forEach(["delete","get","head","options"],(function(t){z.prototype[t]=function(e,n){return this.request(I(n||{},{method:t,url:e,data:(n||{}).data}))}})),b.forEach(["post","put","patch"],(function(t){z.prototype[t]=function(e,n,r){return this.request(I(r||{},{method:t,url:e,data:n}))}}));var G=z;function H(t){this.message=t}H.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},H.prototype.__CANCEL__=!0;var V=H;function X(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 V(t),e(n.reason))}))}X.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},X.source=function(){var t;return{token:new X((function(e){t=e})),cancel:t}};var $=X;function J(t){var e=new G(t),n=d(G.prototype.request,e);return b.extend(n,G.prototype,e),b.extend(n,e),n}var K=J(F);K.Axios=G,K.create=function(t){return J(I(K.defaults,t))},K.Cancel=V,K.CancelToken=$,K.isCancel=L,K.all=function(t){return Promise.all(t)},K.spread=function(t){return function(e){return t.apply(null,e)}},K.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError};var Q=K;Q.default=K;var Y=Q,W=function(t,e){var n="";return t?(t.forEach((function(t,e){if(t.value){var r=encodeURIComponent(t.key)+"="+(t.noEncodeURIComponent?t.value:encodeURIComponent(t.value));n=n.concat(e>0?"&".concat(r):r)}})),n.length>0?e+"?"+n:e):e},Z={url:null,api:null,token:{key:"apikey",value:null},version:.2},tt=function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W([Z.token],"/util/ping"),t.next=3,Z.api.get(n);case 3:if(200!==(r=t.sent).status||"object"!==p(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)}}(),et=function(){var t=l(f.mark((function t(e){var n;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W([].concat(c(e),[Z.token]),"/config/logs"),t.next=3,Z.api.get(n);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),nt=function(){var t=l(f.mark((function t(){var e;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=W([Z.token],"/config/install_options"),t.next=3,Z.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),rt=function(){var t=l(f.mark((function t(){var e;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=W([Z.token],"/config/vars"),t.next=3,Z.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),ot=function(){var t=l(f.mark((function t(e,n){var r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=W([Z.token],"/config/".concat(e,"/").concat(n)),t.next=3,Z.api.get(r);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),at=function(t){return new ut(t)},it=function(t){return new ct(t)},st=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 s=e.split("/"),u=s[s.length-1];s=u.split("\\"),a=u=s[s.length-1]}r.setAttribute("download",a=a||"unknown"),document.body.appendChild(r),r.click(),r.remove(),window.URL.revokeObjectURL(n)},ut=function t(e){var o=this;n(this,t),r(this,"loaded",!1),r(this,"name",""),r(this,"version",""),r(this,"is_active",!1),r(this,"data_source",""),r(this,"predict",null),r(this,"accuracy",0),r(this,"status",""),r(this,"train_end_at",null),r(this,"updated_at",null),r(this,"created_at",null),r(this,"data_preparation",null),r(this,"data_analysis",null),r(this,"model_analysis",null),r(this,"columns",null),r(this,"load",function(){var t=l(f.mark((function t(e){var n,r,a;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r="/predictors/",void 0!==o.name&&""!==o.name&&(r+="".concat(o.name)),a=W(n,r),t.next=6,Z.api.get(a);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)}}()),r(this,"rename",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(e.oldName,"/rename?new_name=").concat(e.newName)),t.next=4,Z.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)}}()),r(this,"loadColumns",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(o.name,"/columns")),t.next=4,Z.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)}}()),r(this,"update",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(c(e),[Z.token]):[Z.token],o=W(r,"/predictors/".concat(n,"/update")),t.next=4,Z.api.get(o);case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"learn",function(){var t=l(f.mark((function t(e,n){var r,a,i,s,u,p;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.dataSourceName,a=e.fromData,s={to_predict:e.toPredict},(i=e.kwargs)&&(s.kwargs=i),r?s.data_source_name=r:a&&(s.from_data=a),u=n?[].concat(c(n),[Z.token]):[Z.token],p=W(u,"/predictors/".concat(o.name)),t.next=8,Z.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)}}()),r(this,"queryPredict",function(){var t=l(f.mark((function t(e,n,r){var a,i;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=n?[].concat(c(n),[Z.token]):[Z.token],i=W(a,"/predictors/".concat(o.name,"/predict")),t.next=4,Z.api.post(i,{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)}}()),r(this,"delete",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(o.name)),t.next=4,Z.api.delete(r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"upload",function(){var t=l(f.mark((function t(e,n,r){var o,a,i,s;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=r?[].concat(c(r),[Z.token]):[Z.token],(a=new FormData).append("file",e),i={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))}},s=W(o,"/predictors/upload"),t.next=7,Z.api.post(s,a,i);case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),r(this,"download",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(o.name,"/download")),t.next=4,Z.api.get(r,{responseType:"blob"});case 4:return st(t.sent),t.abrupt("return",o);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"getDownloadUrl",(function(){return"".concat(Z.url,"/predictors/").concat(o.name,"/download")})),Object.assign(this,e)},ct=function t(e){var o=this;n(this,t),r(this,"loaded",!1),r(this,"source_type","url"),r(this,"name",""),r(this,"source",""),r(this,"missed_files",!1),r(this,"created_at",null),r(this,"updated_at",null),r(this,"row_count",0),r(this,"columns",null),r(this,"data",null),r(this,"missedFileList",null),r(this,"load",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name)),t.next=4,Z.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)}}()),r(this,"upload",function(){var t=l(f.mark((function t(e,n,r){var a,i,s,u;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.source_type="file",o.source=e.name,a=r?[].concat(c(r),[Z.token]):[Z.token],(i=new FormData).append("name",o.name),i.append("source_type",o.source_type),i.append("source",o.source),i.append("file",e),s={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))},timeout:6e5},u=W(a,"/datasources/".concat(o.name)),t.next=12,Z.api.put(u,i,s);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),r(this,"uploadFromUrl",function(){var t=l(f.mark((function t(e,n){var r,a,i;return f.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},a=n?[].concat(c(n),[Z.token]):[Z.token],i=W(a,"/datasources/".concat(o.name)),t.next=7,Z.api.put(i,r);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"download",function(){var t=l(f.mark((function t(e){var n,r,a;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.getDownloadUrl(),r=e?[].concat(c(e),[Z.token]):[Z.token],a=W(r,n),t.next=5,Z.api.get(a,{responseType:"blob"});case 5:return st(t.sent,o.source),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"getDownloadUrl",(function(){return"url"===o.source_type?o.source:"".concat(Z.url,"/datasources/").concat(o.name,"/download")})),r(this,"delete",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name)),t.next=4,Z.api.delete(r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"loadData",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name,"/data/")),t.next=4,Z.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)}}()),r(this,"loadDataQuality",function(){var t=l(f.mark((function t(e){var n,r,a,i;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name,"/analyze")),t.prev=2,t.next=5,Z.api.get(r);case 5:a={data_preparation:(i=t.sent).data.data_preparation,data_analysis_v2:i.data.data_analysis_v2,useable_input_columns:i.data.useable_input_columns,current_phase:i.data.current_phase,versionNative:i.data.version,status:i.data&&i.data.status},t.next=13;break;case 9:t.prev=9,t.t0=t.catch(2),Object.assign(o,{error:t.t0}),console.error(t.t0);case 13:return o.dataQuality=a,t.abrupt("return",a);case 15:case"end":return t.stop()}}),t,null,[[2,9]])})));return function(e){return t.apply(this,arguments)}}()),r(this,"loadMissedFileList",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name,"/missed_files")),t.next=4,Z.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)}}()),r(this,"uploadFile",function(){var t=l(f.mark((function t(e,n){var r,a,i,s,u,p,l;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.column,a=e.rowIndex,i=e.extension,s=e.file,(u=new FormData).append("file",s),u.append("extension",i),p=n?[].concat(c(n),[Z.token]):[Z.token],l=W(p,"/datasources/".concat(o.name,"/files/").concat(r,":").concat(a)),t.next=8,Z.api.put(l,u);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,e)},ft=function t(e){var o=this;n(this,t),r(this,"loaded",!1),r(this,"source_type","url"),r(this,"integration",[]),r(this,"load",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],t.prev=1,r=W(n,"config/all_integrations"),t.next=5,Z.api.get(r);case 5:return Object.assign(o,t.sent),t.abrupt("return",o);case 10:t.prev=10,t.t0=t.catch(1),Object.assign(o,{error:t.t0}),console.error(t.t0);case 14:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e){return t.apply(this,arguments)}}()),r(this,"delete",function(){var t=l(f.mark((function t(e){return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Z.api.delete("/config/integrations/".concat(e.db_name));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"check",function(){var t=l(f.mark((function t(e){return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Z.api.get("/config/integrations/".concat(e.database_name,"/check"));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"edit",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(c(n),[Z.token]):[Z.token],o=W(r,"/config/integrations/".concat(e.params.database_name)),t.next=4,Z.api.post(o,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"create",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(c(n),[Z.token]):[Z.token],o=W(r,"/config/integrations/".concat(e.params.database_name)),t.next=4,Z.api.put(o,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"newDataset",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(c(n),[Z.token]):[Z.token],t.prev=1,o=W(r,"/datasources/".concat(e.name)),t.next=5,Z.api.put(o,e);case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(1),t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e,n){return t.apply(this,arguments)}}()),Object.assign(this,e)};return{connect:function(t,e){Z.token.value=e.find((function(t){return"apikey"===t.key})).value,Z.url=W([Z.token],t),Z.api=Y.create({baseURL:t})},disconnect:function(){Z.url=null,Z.token={key:"apikey",value:null},Z.api=null},ping:tt,logs:et,dependencies:nt,installDependencies:function(){var t=l(f.mark((function t(e){var n;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W([Z.token],"/config/install/".concat(e)),t.next=3,Z.api.get(n);case 3:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),getEnvs:rt,uppdateVar:ot,predictors:function(){var t=l(f.mark((function t(e){var n,r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/"),t.next=4,Z.api.get(r);case 4:return o=(t.sent.data||[]).map(at),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),dataSources:function(){var t=l(f.mark((function t(e){var n,r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/"),t.next=4,Z.api.get(r);case 4:return o=(t.sent.data||[]).map(it),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),DataSource:it,Predictor:at,DataBase:function(t){return new ft(t)}}})); +!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";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=t(e((function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0}))),r=t(e((function(t){t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},t.exports.default=t.exports,t.exports.__esModule=!0}))),o=e((function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r},t.exports.default=t.exports,t.exports.__esModule=!0}));t(o);var a=e((function(t){t.exports=function(t){if(Array.isArray(t))return o(t)},t.exports.default=t.exports,t.exports.__esModule=!0}));t(a);var i=e((function(t){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0}));t(i);var s=e((function(t){t.exports=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0}));t(s);var u=e((function(t){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0}));t(u);var c=t(e((function(t){t.exports=function(t){return a(t)||i(t)||s(t)||u()},t.exports.default=t.exports,t.exports.__esModule=!0}))),f=e((function(t){var e=function(t){var e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o=Object.create((e&&e.prototype instanceof p?e:p).prototype),a=new _(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(o,a){if("executing"===r)throw Error("Generator is already running");if("completed"===r){if("throw"===o)throw a;return j()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var s=x(i,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=c(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function l(){}function d(){}var h={};h[o]=function(){return this};var m=Object.getPrototypeOf,v=m&&m(m(E([])));v&&v!==e&&n.call(v,o)&&(h=v);var y=d.prototype=p.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var r;this._invoke=function(o,a){function i(){return new e((function(r,i){!function r(o,a,i,s){var u=c(t[o],t,a);if("throw"!==u.type){var f=u.arg,p=f.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,i,s)}),(function(t){r("throw",t,i,s)})):e.resolve(p).then((function(t){f.value=t,i(f)}),(function(t){return r("throw",t,i,s)}))}s(u.arg)}(o,a,r,i)}))}return r=r?r.then(i,i):i()}}function x(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function b(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return r("end");if(this.prev>=a.tryLoc){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(a.catchLoc>this.prev)return r(a.catchLoc,!0);if(a.finallyLoc>this.prev)return r(a.finallyLoc)}else if(s){if(a.catchLoc>this.prev)return r(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.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,f):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),f},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),k(n),f}},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;k(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}})),p=t(e((function(t){function e(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=e=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=e=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),e(n)}t.exports=e,t.exports.default=t.exports,t.exports.__esModule=!0}))),l=t(e((function(t){function e(t,e,n,r,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,o)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(o,a){var i=t.apply(n,r);function s(t){e(i,o,a,s,u,"next",t)}function u(t){e(i,o,a,s,u,"throw",t)}s(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0}))),d=function(t,e){return function(){for(var n=Array(arguments.length),r=0;n.length>r;r++)n[r]=arguments[r];return t.apply(e,n)}},h=Object.prototype.toString;function m(t){return"[object Array]"===h.call(t)}function v(t){return void 0===t}function y(t){return null!==t&&"object"==typeof t}function g(t){if("[object Object]"!==h.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function w(t){return"[object Function]"===h.call(t)}function x(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),m(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 b={isArray:m,isArrayBuffer:function(t){return"[object ArrayBuffer]"===h.call(t)},isBuffer:function(t){return null!==t&&!v(t)&&null!==t.constructor&&!v(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:y,isPlainObject:g,isUndefined:v,isDate:function(t){return"[object Date]"===h.call(t)},isFile:function(t){return"[object File]"===h.call(t)},isBlob:function(t){return"[object Blob]"===h.call(t)},isFunction:w,isStream:function(t){return y(t)&&w(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:x,merge:function t(){var e={};function n(n,r){e[r]=g(e[r])&&g(n)?t(e[r],n):g(n)?t({},n):m(n)?n.slice():n}for(var r=0,o=arguments.length;o>r;r++)x(arguments[r],n);return e},extend:function(t,e,n){return x(e,(function(e,r){t[r]=n&&"function"==typeof e?d(e,n):e})),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t}};function k(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var _=function(t,e,n){if(!e)return t;var r;if(n)r=n(e);else if(b.isURLSearchParams(e))r=""+e;else{var o=[];b.forEach(e,(function(t,e){null!=t&&(b.isArray(t)?e+="[]":t=[t],b.forEach(t,(function(t){b.isDate(t)?t=t.toISOString():b.isObject(t)&&(t=JSON.stringify(t)),o.push(k(e)+"="+k(t))})))})),r=o.join("&")}if(r){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t};function E(){this.handlers=[]}E.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},E.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},E.prototype.forEach=function(t){b.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var j=E,O=function(t,e,n){return b.forEach(n,(function(n){t=n(t,e)})),t},L=function(t){return!(!t||!t.__CANCEL__)},S=function(t,e){b.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))},R=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.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},t}(Error(t),e,n,r,o)},C=b.isStandardBrowserEnv()?{write:function(t,e,n,r,o,a){var i=[];i.push(t+"="+encodeURIComponent(e)),b.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),b.isString(r)&&i.push("path="+r),b.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(){}},A=["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"],U=b.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=b.isString(e)?r(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},N=function(t){return new Promise((function(e,n){var r=t.data,o=t.headers;b.isFormData(r)&&delete o["Content-Type"];var a=new XMLHttpRequest;t.auth&&(o.Authorization="Basic "+btoa((t.auth.username||"")+":"+(t.auth.password?unescape(encodeURIComponent(t.auth.password)):"")));var i,s,u=(s=t.url,(i=t.baseURL)&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(s)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(i,s):s);if(a.open(t.method.toUpperCase(),_(u,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,s,u,c="getAllResponseHeaders"in a?(r=a.getAllResponseHeaders(),u={},r?(b.forEach(r.split("\n"),(function(t){if(s=t.indexOf(":"),o=b.trim(t.substr(0,s)).toLowerCase(),i=b.trim(t.substr(s+1)),o){if(u[o]&&A.indexOf(o)>=0)return;u[o]="set-cookie"===o?(u[o]?u[o]:[]).concat([i]):u[o]?u[o]+", "+i:i}})),u):u):null;!function(t,e,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(R("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:c,config:t,request:a}),a=null}},a.onabort=function(){a&&(n(R("Request aborted",t,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(R("Network Error",t,null,a)),a=null},a.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(R(e,t,"ECONNABORTED",a)),a=null},b.isStandardBrowserEnv()){var c=(t.withCredentials||U(u))&&t.xsrfCookieName?C.read(t.xsrfCookieName):void 0;c&&(o[t.xsrfHeaderName]=c)}if("setRequestHeader"in a&&b.forEach(o,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete o[e]:a.setRequestHeader(e,t)})),b.isUndefined(t.withCredentials)||(a.withCredentials=!!t.withCredentials),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)})),r||(r=null),a.send(r)}))},P={"Content-Type":"application/x-www-form-urlencoded"};function T(t,e){!b.isUndefined(t)&&b.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var B,D={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(B=N),B),transformRequest:[function(t,e){return S(e,"Accept"),S(e,"Content-Type"),b.isFormData(t)||b.isArrayBuffer(t)||b.isBuffer(t)||b.isStream(t)||b.isFile(t)||b.isBlob(t)?t:b.isArrayBufferView(t)?t.buffer:b.isURLSearchParams(t)?(T(e,"application/x-www-form-urlencoded;charset=utf-8"),""+t):b.isObject(t)?(T(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,maxBodyLength:-1,validateStatus:function(t){return t>=200&&300>t}};D.headers={common:{Accept:"application/json, text/plain, */*"}},b.forEach(["delete","get","head"],(function(t){D.headers[t]={}})),b.forEach(["post","put","patch"],(function(t){D.headers[t]=b.merge(P)}));var F=D;function M(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var q=function(t){return M(t),t.headers=t.headers||{},t.data=O(t.data,t.headers,t.transformRequest),t.headers=b.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),b.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||F.adapter)(t).then((function(e){return M(t),e.data=O(e.data,e.headers,t.transformResponse),e}),(function(e){return L(e)||(M(t),e&&e.response&&(e.response.data=O(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},I=function(t,e){e=e||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function s(t,e){return b.isPlainObject(t)&&b.isPlainObject(e)?b.merge(t,e):b.isPlainObject(e)?b.merge({},e):b.isArray(e)?e.slice():e}function u(r){b.isUndefined(e[r])?b.isUndefined(t[r])||(n[r]=s(void 0,t[r])):n[r]=s(t[r],e[r])}b.forEach(r,(function(t){b.isUndefined(e[t])||(n[t]=s(void 0,e[t]))})),b.forEach(o,u),b.forEach(a,(function(r){b.isUndefined(e[r])?b.isUndefined(t[r])||(n[r]=s(void 0,t[r])):n[r]=s(void 0,e[r])})),b.forEach(i,(function(r){r in e?n[r]=s(t[r],e[r]):r in t&&(n[r]=s(void 0,t[r]))}));var c=r.concat(o).concat(a).concat(i),f=Object.keys(t).concat(Object.keys(e)).filter((function(t){return-1===c.indexOf(t)}));return b.forEach(f,u),n};function z(t){this.defaults=t,this.interceptors={request:new j,response:new j}}z.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=I(this.defaults,t)).method=t.method?t.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var e=[q,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},z.prototype.getUri=function(t){return t=I(this.defaults,t),_(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},b.forEach(["delete","get","head","options"],(function(t){z.prototype[t]=function(e,n){return this.request(I(n||{},{method:t,url:e,data:(n||{}).data}))}})),b.forEach(["post","put","patch"],(function(t){z.prototype[t]=function(e,n,r){return this.request(I(r||{},{method:t,url:e,data:n}))}}));var G=z;function H(t){this.message=t}H.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},H.prototype.__CANCEL__=!0;var V=H;function X(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 V(t),e(n.reason))}))}X.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},X.source=function(){var t;return{token:new X((function(e){t=e})),cancel:t}};var $=X;function J(t){var e=new G(t),n=d(G.prototype.request,e);return b.extend(n,G.prototype,e),b.extend(n,e),n}var K=J(F);K.Axios=G,K.create=function(t){return J(I(K.defaults,t))},K.Cancel=V,K.CancelToken=$,K.isCancel=L,K.all=function(t){return Promise.all(t)},K.spread=function(t){return function(e){return t.apply(null,e)}},K.isAxiosError=function(t){return"object"==typeof t&&!0===t.isAxiosError};var Q=K;Q.default=K;var Y=Q,W=function(t,e){var n="";return t?(t.forEach((function(t,e){if(t.value){var r=encodeURIComponent(t.key)+"="+(t.noEncodeURIComponent?t.value:encodeURIComponent(t.value));n=n.concat(e>0?"&".concat(r):r)}})),n.length>0?e+"?"+n:e):e},Z={url:null,api:null,token:{key:"apikey",value:null},version:.2},tt=function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W([Z.token],"/util/ping"),t.next=3,Z.api.get(n);case 3:if(200!==(r=t.sent).status||"object"!==p(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)}}(),et=function(){var t=l(f.mark((function t(e){var n;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W([].concat(c(e),[Z.token]),"/config/logs"),t.next=3,Z.api.get(n);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),nt=function(){var t=l(f.mark((function t(){var e;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=W([Z.token],"/config/install_options"),t.next=3,Z.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),rt=function(){var t=l(f.mark((function t(){var e;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=W([Z.token],"/config/vars"),t.next=3,Z.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),ot=function(){var t=l(f.mark((function t(e,n){var r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=W([Z.token],"/config/".concat(e,"/").concat(n)),t.next=3,Z.api.get(r);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),at=function(t){return new ut(t)},it=function(t){return new ct(t)},st=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 s=e.split("/"),u=s[s.length-1];s=u.split("\\"),a=u=s[s.length-1]}r.setAttribute("download",a=a||"unknown"),document.body.appendChild(r),r.click(),r.remove(),window.URL.revokeObjectURL(n)},ut=function t(e){var o=this;n(this,t),r(this,"loaded",!1),r(this,"name",""),r(this,"version",""),r(this,"is_active",!1),r(this,"data_source",""),r(this,"predict",null),r(this,"accuracy",0),r(this,"status",""),r(this,"train_end_at",null),r(this,"updated_at",null),r(this,"created_at",null),r(this,"data_preparation",null),r(this,"data_analysis",null),r(this,"model_analysis",null),r(this,"columns",null),r(this,"load",function(){var t=l(f.mark((function t(e){var n,r,a;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r="/predictors/",void 0!==o.name&&""!==o.name&&(r+="".concat(o.name)),a=W(n,r),t.next=6,Z.api.get(a);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)}}()),r(this,"rename",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(e.oldName,"/rename?new_name=").concat(e.newName)),t.next=4,Z.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)}}()),r(this,"loadColumns",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(o.name,"/columns")),t.next=4,Z.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)}}()),r(this,"update",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(c(e),[Z.token]):[Z.token],o=W(r,"/predictors/".concat(n,"/update")),t.next=4,Z.api.get(o);case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"learn",function(){var t=l(f.mark((function t(e,n){var r,a,i,s,u,p;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.dataSourceName,a=e.fromData,s={to_predict:e.toPredict},(i=e.kwargs)&&(s.kwargs=i),r?s.data_source_name=r:a&&(s.from_data=a),u=n?[].concat(c(n),[Z.token]):[Z.token],p=W(u,"/predictors/".concat(o.name)),t.next=8,Z.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)}}()),r(this,"queryPredict",function(){var t=l(f.mark((function t(e,n,r){var a,i;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=n?[].concat(c(n),[Z.token]):[Z.token],i=W(a,"/predictors/".concat(o.name,"/predict")),t.next=4,Z.api.post(i,{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)}}()),r(this,"delete",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(o.name)),t.next=4,Z.api.delete(r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"upload",function(){var t=l(f.mark((function t(e,n,r){var o,a,i,s;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=r?[].concat(c(r),[Z.token]):[Z.token],(a=new FormData).append("file",e),i={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))}},s=W(o,"/predictors/upload"),t.next=7,Z.api.post(s,a,i);case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),r(this,"download",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/".concat(o.name,"/download")),t.next=4,Z.api.get(r,{responseType:"blob"});case 4:return st(t.sent),t.abrupt("return",o);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"getDownloadUrl",(function(){return"".concat(Z.url,"/predictors/").concat(o.name,"/download")})),Object.assign(this,e)},ct=function t(e){var o=this;n(this,t),r(this,"loaded",!1),r(this,"source_type","url"),r(this,"name",""),r(this,"source",""),r(this,"missed_files",!1),r(this,"created_at",null),r(this,"updated_at",null),r(this,"row_count",0),r(this,"columns",null),r(this,"data",null),r(this,"missedFileList",null),r(this,"load",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name)),t.next=4,Z.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)}}()),r(this,"upload",function(){var t=l(f.mark((function t(e,n,r){var a,i,s,u;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.source_type="file",o.source=e.name,a=r?[].concat(c(r),[Z.token]):[Z.token],(i=new FormData).append("name",o.name),i.append("source_type",o.source_type),i.append("source",o.source),i.append("file",e),s={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))},timeout:6e5},u=W(a,"/datasources/".concat(o.name)),t.next=12,Z.api.put(u,i,s);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),r(this,"uploadFromUrl",function(){var t=l(f.mark((function t(e,n){var r,a,i;return f.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},a=n?[].concat(c(n),[Z.token]):[Z.token],i=W(a,"/datasources/".concat(o.name)),t.next=7,Z.api.put(i,r);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"download",function(){var t=l(f.mark((function t(e){var n,r,a;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.getDownloadUrl(),r=e?[].concat(c(e),[Z.token]):[Z.token],a=W(r,n),t.next=5,Z.api.get(a,{responseType:"blob"});case 5:return st(t.sent,o.source),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"getDownloadUrl",(function(){return"url"===o.source_type?o.source:"".concat(Z.url,"/datasources/").concat(o.name,"/download")})),r(this,"delete",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name)),t.next=4,Z.api.delete(r);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"loadData",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name,"/data/")),t.next=4,Z.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)}}()),r(this,"loadDataQuality",function(){var t=l(f.mark((function t(e){var n,r,a,i;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name,"/analyze")),t.prev=2,t.next=5,Z.api.get(r);case 5:a={data_preparation:(i=t.sent).data.data_preparation,data_analysis_v2:i.data.data_analysis_v2,useable_input_columns:i.data.useable_input_columns,current_phase:i.data.current_phase,versionNative:i.data.version,status:i.data&&i.data.status},t.next=13;break;case 9:t.prev=9,t.t0=t.catch(2),Object.assign(o,{error:t.t0}),console.error(t.t0);case 13:return o.dataQuality=a,t.abrupt("return",a);case 15:case"end":return t.stop()}}),t,null,[[2,9]])})));return function(e){return t.apply(this,arguments)}}()),r(this,"loadMissedFileList",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/".concat(o.name,"/missed_files")),t.next=4,Z.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)}}()),r(this,"uploadFile",function(){var t=l(f.mark((function t(e,n){var r,a,i,s,u,p,l;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.column,a=e.rowIndex,i=e.extension,s=e.file,(u=new FormData).append("file",s),u.append("extension",i),p=n?[].concat(c(n),[Z.token]):[Z.token],l=W(p,"/datasources/".concat(o.name,"/files/").concat(r,":").concat(a)),t.next=8,Z.api.put(l,u);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,e)},ft=function t(e){var o=this;n(this,t),r(this,"loaded",!1),r(this,"source_type","url"),r(this,"integration",[]),r(this,"load",function(){var t=l(f.mark((function t(e){var n,r;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],t.prev=1,r=W(n,"config/all_integrations"),t.next=5,Z.api.get(r);case 5:return Object.assign(o,t.sent),t.abrupt("return",o);case 10:t.prev=10,t.t0=t.catch(1),Object.assign(o,{error:t.t0}),console.error(t.t0);case 14:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e){return t.apply(this,arguments)}}()),r(this,"delete",function(){var t=l(f.mark((function t(e){return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Z.api.delete("/config/integrations/".concat(e.db_name));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"check",function(){var t=l(f.mark((function t(e){return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Z.api.get("/config/integrations/".concat(e.integrations_name,"/check"));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),r(this,"edit",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(c(n),[Z.token]):[Z.token],o=W(r,"/config/integrations/".concat(e.params.integrations_name)),t.next=4,Z.api.post(o,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"create",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(c(n),[Z.token]):[Z.token],o=W(r,"/config/integrations/".concat(e.params.integrations_name)),t.next=4,Z.api.put(o,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),r(this,"newDataset",function(){var t=l(f.mark((function t(e,n){var r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(c(n),[Z.token]):[Z.token],t.prev=1,o=W(r,"/datasources/".concat(e.name)),t.next=5,Z.api.put(o,e);case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(1),t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e,n){return t.apply(this,arguments)}}()),Object.assign(this,e)};return{connect:function(t,e){Z.token.value=e.find((function(t){return"apikey"===t.key})).value,Z.url=W([Z.token],t),Z.api=Y.create({baseURL:t})},disconnect:function(){Z.url=null,Z.token={key:"apikey",value:null},Z.api=null},ping:tt,logs:et,dependencies:nt,installDependencies:function(){var t=l(f.mark((function t(e){var n;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W([Z.token],"/config/install/".concat(e)),t.next=3,Z.api.get(n);case 3:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),getEnvs:rt,uppdateVar:ot,predictors:function(){var t=l(f.mark((function t(e){var n,r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/predictors/"),t.next=4,Z.api.get(r);case 4:return o=(t.sent.data||[]).map(at),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),dataSources:function(){var t=l(f.mark((function t(e){var n,r,o;return f.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(c(e),[Z.token]):[Z.token],r=W(n,"/datasources/"),t.next=4,Z.api.get(r);case 4:return o=(t.sent.data||[]).map(it),t.abrupt("return",o);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),DataSource:it,Predictor:at,DataBase:function(t){return new ft(t)}}})); diff --git a/es/mindsdb-sdk.js b/es/mindsdb-sdk.js index 7f48864..91090c5 100644 --- a/es/mindsdb-sdk.js +++ b/es/mindsdb-sdk.js @@ -1187,7 +1187,7 @@ var DataBase = function DataBase(_data3) { switch (_context29.prev = _context29.next) { case 0: _context29.next = 2; - return connection.api.get("/config/integrations/".concat(params.database_name, "/check")); + return connection.api.get("/config/integrations/".concat(params.integrations_name, "/check")); case 2: return _context29.abrupt("return", _context29.sent); @@ -1213,7 +1213,7 @@ var DataBase = function DataBase(_data3) { switch (_context30.prev = _context30.next) { case 0: mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; - request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.database_name)); + request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.integrations_name)); _context30.next = 4; return connection.api.post(request, data); @@ -1242,7 +1242,7 @@ var DataBase = function DataBase(_data3) { switch (_context31.prev = _context31.next) { case 0: mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; - request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.database_name)); + request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.integrations_name)); _context31.next = 4; return connection.api.put(request, data); diff --git a/es/mindsdb-sdk.mjs b/es/mindsdb-sdk.mjs index 0cc5f90..3d3ff68 100644 --- a/es/mindsdb-sdk.mjs +++ b/es/mindsdb-sdk.mjs @@ -1 +1 @@ -import t from"axios";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(t,e,n,r,a,o,u){try{var c=t[o](u),i=c.value}catch(t){return void n(t)}c.done?e(i):Promise.resolve(i).then(r,a)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(a,o){var u=t.apply(e,r);function c(t){n(u,a,o,c,i,"next",t)}function i(t){n(u,a,o,c,i,"throw",t)}c(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}var i=function(t,e){var n="";return t?(t.forEach((function(t,e){if(t.value){var r=encodeURIComponent(t.key)+"="+(t.noEncodeURIComponent?t.value:encodeURIComponent(t.value));n=n.concat(e>0?"&".concat(r):r)}})),n.length>0?e+"?"+n:e):e},s={url:null,api:null,token:{key:"apikey",value:null},version:.2},p=function(){var t=r(regeneratorRuntime.mark((function t(n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i([s.token],"/util/ping"),t.next=3,s.api.get(r);case 3:if(200!==(a=t.sent).status||"object"!==e(a.data)||"ok"!==a.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)}}(),f=function(){var t=r(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i([].concat(u(e),[s.token]),"/config/logs"),t.next=3,s.api.get(n);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),l=function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i([s.token],"/config/install_options"),t.next=3,s.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),d=function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i([s.token],"/config/vars"),t.next=3,s.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),m=function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i([s.token],"/config/".concat(e,"/").concat(n)),t.next=3,s.api.get(r);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),h=function(t){return new k(t)},v=function(t){return new w(t)},g=function(t,e){var n=window.URL.createObjectURL(new Blob([t.data])),r=document.createElement("a");r.href=n;var a=t.headers["content-disposition"],o=null;if(a){var u=a.match(/filename="?(.+)"?/);2===u.length&&(o=u[1])}if(!o&&e){var c=e.split("/"),i=c[c.length-1];c=i.split("\\"),o=i=c[c.length-1]}r.setAttribute("download",o=o||"unknown"),document.body.appendChild(r),r.click(),r.remove(),window.URL.revokeObjectURL(n)},k=function t(e){var n=this;a(this,t),o(this,"loaded",!1),o(this,"name",""),o(this,"version",""),o(this,"is_active",!1),o(this,"data_source",""),o(this,"predict",null),o(this,"accuracy",0),o(this,"status",""),o(this,"train_end_at",null),o(this,"updated_at",null),o(this,"created_at",null),o(this,"data_preparation",null),o(this,"data_analysis",null),o(this,"model_analysis",null),o(this,"columns",null),o(this,"load",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a="/predictors/",void 0!==n.name&&""!==n.name&&(a+="".concat(n.name)),o=i(r,a),t.next=6,s.api.get(o);case 6:return Object.assign(n,t.sent.data),t.abrupt("return",n);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"rename",function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(u(e),[s.token]):[s.token],r=i(n,"/predictors/".concat(e.oldName,"/rename?new_name=").concat(e.newName)),t.next=4,s.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)}}()),o(this,"loadColumns",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n.name,"/columns")),t.next=4,s.api.get(a);case 4:return n.columns=t.sent.data,t.abrupt("return",n);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"update",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n,"/update")),t.next=4,s.api.get(a);case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"learn",function(){var t=r(regeneratorRuntime.mark((function t(e,r){var a,o,c,p,f,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.dataSourceName,o=e.fromData,p={to_predict:e.toPredict},(c=e.kwargs)&&(p.kwargs=c),a?p.data_source_name=a:o&&(p.from_data=o),f=r?[].concat(u(r),[s.token]):[s.token],l=i(f,"/predictors/".concat(n.name)),t.next=8,s.api.put(l,p);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)}}()),o(this,"queryPredict",function(){var t=r(regeneratorRuntime.mark((function t(e,r,a){var o,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=r?[].concat(u(r),[s.token]):[s.token],c=i(o,"/predictors/".concat(n.name,"/predict")),t.next=4,s.api.post(c,{when:e,format_flag:a});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)}}()),o(this,"delete",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n.name)),t.next=4,s.api.delete(a);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"upload",function(){var t=r(regeneratorRuntime.mark((function t(e,n,r){var a,o,c,p;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=r?[].concat(u(r),[s.token]):[s.token],(o=new FormData).append("file",e),c={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))}},p=i(a,"/predictors/upload"),t.next=7,s.api.post(p,o,c);case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),o(this,"download",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n.name,"/download")),t.next=4,s.api.get(a,{responseType:"blob"});case 4:return g(t.sent),t.abrupt("return",n);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"getDownloadUrl",(function(){return"".concat(s.url,"/predictors/").concat(n.name,"/download")})),Object.assign(this,e)},w=function t(e){var n=this;a(this,t),o(this,"loaded",!1),o(this,"source_type","url"),o(this,"name",""),o(this,"source",""),o(this,"missed_files",!1),o(this,"created_at",null),o(this,"updated_at",null),o(this,"row_count",0),o(this,"columns",null),o(this,"data",null),o(this,"missedFileList",null),o(this,"load",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name)),t.next=4,s.api.get(a);case 4:return Object.assign(n,t.sent.data),t.abrupt("return",n);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"upload",function(){var t=r(regeneratorRuntime.mark((function t(e,r,a){var o,c,p,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.source_type="file",n.source=e.name,o=a?[].concat(u(a),[s.token]):[s.token],(c=new FormData).append("name",n.name),c.append("source_type",n.source_type),c.append("source",n.source),c.append("file",e),p={onUploadProgress:function(t){r&&r(Math.round(100*t.loaded/t.total))},timeout:6e5},f=i(o,"/datasources/".concat(n.name)),t.next=12,s.api.put(f,c,p);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),o(this,"uploadFromUrl",function(){var t=r(regeneratorRuntime.mark((function t(e,r){var a,o,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.source_type="url",n.source=e,a={name:n.name,source_type:n.source_type,source:n.source},o=r?[].concat(u(r),[s.token]):[s.token],c=i(o,"/datasources/".concat(n.name)),t.next=7,s.api.put(c,a);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"download",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.getDownloadUrl(),a=e?[].concat(u(e),[s.token]):[s.token],o=i(a,r),t.next=5,s.api.get(o,{responseType:"blob"});case 5:return g(t.sent,n.source),t.abrupt("return",n);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"getDownloadUrl",(function(){return"url"===n.source_type?n.source:"".concat(s.url,"/datasources/").concat(n.name,"/download")})),o(this,"delete",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name)),t.next=4,s.api.delete(a);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"loadData",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name,"/data/")),t.next=4,s.api.get(a);case 4:return n.data=t.sent.data,t.abrupt("return",n.data);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"loadDataQuality",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a,o,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name,"/analyze")),t.prev=2,t.next=5,s.api.get(a);case 5:o={data_preparation:(c=t.sent).data.data_preparation,data_analysis_v2:c.data.data_analysis_v2,useable_input_columns:c.data.useable_input_columns,current_phase:c.data.current_phase,versionNative:c.data.version,status:c.data&&c.data.status},t.next=13;break;case 9:t.prev=9,t.t0=t.catch(2),Object.assign(n,{error:t.t0}),console.error(t.t0);case 13:return n.dataQuality=o,t.abrupt("return",o);case 15:case"end":return t.stop()}}),t,null,[[2,9]])})));return function(e){return t.apply(this,arguments)}}()),o(this,"loadMissedFileList",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name,"/missed_files")),t.next=4,s.api.get(a);case 4:return n.missedFileList=t.sent.data,t.abrupt("return",n.missedFileList);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"uploadFile",function(){var t=r(regeneratorRuntime.mark((function t(e,r){var a,o,c,p,f,l,d;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.column,o=e.rowIndex,c=e.extension,p=e.file,(f=new FormData).append("file",p),f.append("extension",c),l=r?[].concat(u(r),[s.token]):[s.token],d=i(l,"/datasources/".concat(n.name,"/files/").concat(a,":").concat(o)),t.next=8,s.api.put(d,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,e)},y=function t(e){var n=this;a(this,t),o(this,"loaded",!1),o(this,"source_type","url"),o(this,"integration",[]),o(this,"load",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],t.prev=1,a=i(r,"config/all_integrations"),t.next=5,s.api.get(a);case 5:return Object.assign(n,t.sent),t.abrupt("return",n);case 10:t.prev=10,t.t0=t.catch(1),Object.assign(n,{error:t.t0}),console.error(t.t0);case 14:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e){return t.apply(this,arguments)}}()),o(this,"delete",function(){var t=r(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.api.delete("/config/integrations/".concat(e.db_name));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"check",function(){var t=r(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.api.get("/config/integrations/".concat(e.database_name,"/check"));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"edit",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(u(n),[s.token]):[s.token],a=i(r,"/config/integrations/".concat(e.params.database_name)),t.next=4,s.api.post(a,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"create",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(u(n),[s.token]):[s.token],a=i(r,"/config/integrations/".concat(e.params.database_name)),t.next=4,s.api.put(a,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"newDataset",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(u(n),[s.token]):[s.token],t.prev=1,a=i(r,"/datasources/".concat(e.name)),t.next=5,s.api.put(a,e);case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(1),t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e,n){return t.apply(this,arguments)}}()),Object.assign(this,e)},b={connect:function(e,n){s.token.value=n.find((function(t){return"apikey"===t.key})).value,s.url=i([s.token],e),s.api=t.create({baseURL:e})},disconnect:function(){s.url=null,s.token={key:"apikey",value:null},s.api=null},ping:p,logs:f,dependencies:l,installDependencies:function(){var t=r(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i([s.token],"/config/install/".concat(e)),t.next=3,s.api.get(n);case 3:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),getEnvs:d,uppdateVar:m,predictors:function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(u(e),[s.token]):[s.token],r=i(n,"/predictors/"),t.next=4,s.api.get(r);case 4:return a=(t.sent.data||[]).map(h),t.abrupt("return",a);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),dataSources:function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(u(e),[s.token]):[s.token],r=i(n,"/datasources/"),t.next=4,s.api.get(r);case 4:return a=(t.sent.data||[]).map(v),t.abrupt("return",a);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),DataSource:v,Predictor:h,DataBase:function(t){return new y(t)}};export default b; +import t from"axios";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(t,e,n,r,a,o,u){try{var c=t[o](u),i=c.value}catch(t){return void n(t)}c.done?e(i):Promise.resolve(i).then(r,a)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(a,o){var u=t.apply(e,r);function c(t){n(u,a,o,c,i,"next",t)}function i(t){n(u,a,o,c,i,"throw",t)}c(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}var i=function(t,e){var n="";return t?(t.forEach((function(t,e){if(t.value){var r=encodeURIComponent(t.key)+"="+(t.noEncodeURIComponent?t.value:encodeURIComponent(t.value));n=n.concat(e>0?"&".concat(r):r)}})),n.length>0?e+"?"+n:e):e},s={url:null,api:null,token:{key:"apikey",value:null},version:.2},p=function(){var t=r(regeneratorRuntime.mark((function t(n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i([s.token],"/util/ping"),t.next=3,s.api.get(r);case 3:if(200!==(a=t.sent).status||"object"!==e(a.data)||"ok"!==a.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)}}(),f=function(){var t=r(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i([].concat(u(e),[s.token]),"/config/logs"),t.next=3,s.api.get(n);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),l=function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i([s.token],"/config/install_options"),t.next=3,s.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),d=function(){var t=r(regeneratorRuntime.mark((function t(){var e;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i([s.token],"/config/vars"),t.next=3,s.api.get(e);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),m=function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=i([s.token],"/config/".concat(e,"/").concat(n)),t.next=3,s.api.get(r);case 3:return t.abrupt("return",t.sent.data);case 5:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),h=function(t){return new k(t)},v=function(t){return new w(t)},g=function(t,e){var n=window.URL.createObjectURL(new Blob([t.data])),r=document.createElement("a");r.href=n;var a=t.headers["content-disposition"],o=null;if(a){var u=a.match(/filename="?(.+)"?/);2===u.length&&(o=u[1])}if(!o&&e){var c=e.split("/"),i=c[c.length-1];c=i.split("\\"),o=i=c[c.length-1]}r.setAttribute("download",o=o||"unknown"),document.body.appendChild(r),r.click(),r.remove(),window.URL.revokeObjectURL(n)},k=function t(e){var n=this;a(this,t),o(this,"loaded",!1),o(this,"name",""),o(this,"version",""),o(this,"is_active",!1),o(this,"data_source",""),o(this,"predict",null),o(this,"accuracy",0),o(this,"status",""),o(this,"train_end_at",null),o(this,"updated_at",null),o(this,"created_at",null),o(this,"data_preparation",null),o(this,"data_analysis",null),o(this,"model_analysis",null),o(this,"columns",null),o(this,"load",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a="/predictors/",void 0!==n.name&&""!==n.name&&(a+="".concat(n.name)),o=i(r,a),t.next=6,s.api.get(o);case 6:return Object.assign(n,t.sent.data),t.abrupt("return",n);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"rename",function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(u(e),[s.token]):[s.token],r=i(n,"/predictors/".concat(e.oldName,"/rename?new_name=").concat(e.newName)),t.next=4,s.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)}}()),o(this,"loadColumns",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n.name,"/columns")),t.next=4,s.api.get(a);case 4:return n.columns=t.sent.data,t.abrupt("return",n);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"update",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n,"/update")),t.next=4,s.api.get(a);case 4:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"learn",function(){var t=r(regeneratorRuntime.mark((function t(e,r){var a,o,c,p,f,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.dataSourceName,o=e.fromData,p={to_predict:e.toPredict},(c=e.kwargs)&&(p.kwargs=c),a?p.data_source_name=a:o&&(p.from_data=o),f=r?[].concat(u(r),[s.token]):[s.token],l=i(f,"/predictors/".concat(n.name)),t.next=8,s.api.put(l,p);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)}}()),o(this,"queryPredict",function(){var t=r(regeneratorRuntime.mark((function t(e,r,a){var o,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=r?[].concat(u(r),[s.token]):[s.token],c=i(o,"/predictors/".concat(n.name,"/predict")),t.next=4,s.api.post(c,{when:e,format_flag:a});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)}}()),o(this,"delete",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n.name)),t.next=4,s.api.delete(a);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"upload",function(){var t=r(regeneratorRuntime.mark((function t(e,n,r){var a,o,c,p;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=r?[].concat(u(r),[s.token]):[s.token],(o=new FormData).append("file",e),c={onUploadProgress:function(t){n&&n(Math.round(100*t.loaded/t.total))}},p=i(a,"/predictors/upload"),t.next=7,s.api.post(p,o,c);case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),o(this,"download",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/predictors/".concat(n.name,"/download")),t.next=4,s.api.get(a,{responseType:"blob"});case 4:return g(t.sent),t.abrupt("return",n);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"getDownloadUrl",(function(){return"".concat(s.url,"/predictors/").concat(n.name,"/download")})),Object.assign(this,e)},w=function t(e){var n=this;a(this,t),o(this,"loaded",!1),o(this,"source_type","url"),o(this,"name",""),o(this,"source",""),o(this,"missed_files",!1),o(this,"created_at",null),o(this,"updated_at",null),o(this,"row_count",0),o(this,"columns",null),o(this,"data",null),o(this,"missedFileList",null),o(this,"load",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name)),t.next=4,s.api.get(a);case 4:return Object.assign(n,t.sent.data),t.abrupt("return",n);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"upload",function(){var t=r(regeneratorRuntime.mark((function t(e,r,a){var o,c,p,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.source_type="file",n.source=e.name,o=a?[].concat(u(a),[s.token]):[s.token],(c=new FormData).append("name",n.name),c.append("source_type",n.source_type),c.append("source",n.source),c.append("file",e),p={onUploadProgress:function(t){r&&r(Math.round(100*t.loaded/t.total))},timeout:6e5},f=i(o,"/datasources/".concat(n.name)),t.next=12,s.api.put(f,c,p);case 12:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()),o(this,"uploadFromUrl",function(){var t=r(regeneratorRuntime.mark((function t(e,r){var a,o,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.source_type="url",n.source=e,a={name:n.name,source_type:n.source_type,source:n.source},o=r?[].concat(u(r),[s.token]):[s.token],c=i(o,"/datasources/".concat(n.name)),t.next=7,s.api.put(c,a);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"download",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.getDownloadUrl(),a=e?[].concat(u(e),[s.token]):[s.token],o=i(a,r),t.next=5,s.api.get(o,{responseType:"blob"});case 5:return g(t.sent,n.source),t.abrupt("return",n);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"getDownloadUrl",(function(){return"url"===n.source_type?n.source:"".concat(s.url,"/datasources/").concat(n.name,"/download")})),o(this,"delete",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name)),t.next=4,s.api.delete(a);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"loadData",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name,"/data/")),t.next=4,s.api.get(a);case 4:return n.data=t.sent.data,t.abrupt("return",n.data);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"loadDataQuality",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a,o,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name,"/analyze")),t.prev=2,t.next=5,s.api.get(a);case 5:o={data_preparation:(c=t.sent).data.data_preparation,data_analysis_v2:c.data.data_analysis_v2,useable_input_columns:c.data.useable_input_columns,current_phase:c.data.current_phase,versionNative:c.data.version,status:c.data&&c.data.status},t.next=13;break;case 9:t.prev=9,t.t0=t.catch(2),Object.assign(n,{error:t.t0}),console.error(t.t0);case 13:return n.dataQuality=o,t.abrupt("return",o);case 15:case"end":return t.stop()}}),t,null,[[2,9]])})));return function(e){return t.apply(this,arguments)}}()),o(this,"loadMissedFileList",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],a=i(r,"/datasources/".concat(n.name,"/missed_files")),t.next=4,s.api.get(a);case 4:return n.missedFileList=t.sent.data,t.abrupt("return",n.missedFileList);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"uploadFile",function(){var t=r(regeneratorRuntime.mark((function t(e,r){var a,o,c,p,f,l,d;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.column,o=e.rowIndex,c=e.extension,p=e.file,(f=new FormData).append("file",p),f.append("extension",c),l=r?[].concat(u(r),[s.token]):[s.token],d=i(l,"/datasources/".concat(n.name,"/files/").concat(a,":").concat(o)),t.next=8,s.api.put(d,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,e)},y=function t(e){var n=this;a(this,t),o(this,"loaded",!1),o(this,"source_type","url"),o(this,"integration",[]),o(this,"load",function(){var t=r(regeneratorRuntime.mark((function t(e){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e?[].concat(u(e),[s.token]):[s.token],t.prev=1,a=i(r,"config/all_integrations"),t.next=5,s.api.get(a);case 5:return Object.assign(n,t.sent),t.abrupt("return",n);case 10:t.prev=10,t.t0=t.catch(1),Object.assign(n,{error:t.t0}),console.error(t.t0);case 14:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e){return t.apply(this,arguments)}}()),o(this,"delete",function(){var t=r(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.api.delete("/config/integrations/".concat(e.db_name));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"check",function(){var t=r(regeneratorRuntime.mark((function t(e){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,s.api.get("/config/integrations/".concat(e.integrations_name,"/check"));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),o(this,"edit",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(u(n),[s.token]):[s.token],a=i(r,"/config/integrations/".concat(e.params.integrations_name)),t.next=4,s.api.post(a,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"create",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(u(n),[s.token]):[s.token],a=i(r,"/config/integrations/".concat(e.params.integrations_name)),t.next=4,s.api.put(a,e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),o(this,"newDataset",function(){var t=r(regeneratorRuntime.mark((function t(e,n){var r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n?[].concat(u(n),[s.token]):[s.token],t.prev=1,a=i(r,"/datasources/".concat(e.name)),t.next=5,s.api.put(a,e);case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(1),t.abrupt("return",t.t0);case 11:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e,n){return t.apply(this,arguments)}}()),Object.assign(this,e)},b={connect:function(e,n){s.token.value=n.find((function(t){return"apikey"===t.key})).value,s.url=i([s.token],e),s.api=t.create({baseURL:e})},disconnect:function(){s.url=null,s.token={key:"apikey",value:null},s.api=null},ping:p,logs:f,dependencies:l,installDependencies:function(){var t=r(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i([s.token],"/config/install/".concat(e)),t.next=3,s.api.get(n);case 3:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),getEnvs:d,uppdateVar:m,predictors:function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(u(e),[s.token]):[s.token],r=i(n,"/predictors/"),t.next=4,s.api.get(r);case 4:return a=(t.sent.data||[]).map(h),t.abrupt("return",a);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),dataSources:function(){var t=r(regeneratorRuntime.mark((function t(e){var n,r,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e?[].concat(u(e),[s.token]):[s.token],r=i(n,"/datasources/"),t.next=4,s.api.get(r);case 4:return a=(t.sent.data||[]).map(v),t.abrupt("return",a);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),DataSource:v,Predictor:h,DataBase:function(t){return new y(t)}};export default b; diff --git a/lib/mindsdb-sdk.js b/lib/mindsdb-sdk.js index b8f7782..46b0a5d 100644 --- a/lib/mindsdb-sdk.js +++ b/lib/mindsdb-sdk.js @@ -1091,7 +1091,7 @@ var DataBase = function DataBase(_data3) { switch (_context29.prev = _context29.next) { case 0: _context29.next = 2; - return connection.api.get("/config/integrations/".concat(params.database_name, "/check")); + return connection.api.get("/config/integrations/".concat(params.integrations_name, "/check")); case 2: return _context29.abrupt("return", _context29.sent); @@ -1117,7 +1117,7 @@ var DataBase = function DataBase(_data3) { switch (_context30.prev = _context30.next) { case 0: mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; - request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.database_name)); + request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.integrations_name)); _context30.next = 4; return connection.api.post(request, data); @@ -1146,7 +1146,7 @@ var DataBase = function DataBase(_data3) { switch (_context31.prev = _context31.next) { case 0: mergeParams = params ? [].concat(_toConsumableArray(params), [connection.token]) : [connection.token]; - request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.database_name)); + request = setQueryParams(mergeParams, "/config/integrations/".concat(data.params.integrations_name)); _context31.next = 4; return connection.api.put(request, data); diff --git a/package.json b/package.json index cfc2d32..7e0ff03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mindsdb-js-sdk", - "version": "0.5.19", + "version": "0.5.20", "license": "MIT", "homepage": "https://github.com/mindsdb/mindsdb_js_sdk#readme", "repository": { diff --git a/src/index.js b/src/index.js index 4283d09..4449dc6 100644 --- a/src/index.js +++ b/src/index.js @@ -517,7 +517,7 @@ class DataBase { check = async (params) => { return await connection.api.get( - `/config/integrations/${params.database_name}/check` + `/config/integrations/${params.integrations_name}/check` ); }; @@ -527,7 +527,7 @@ class DataBase { : [connection.token]; const request = setQueryParams( mergeParams, - `/config/integrations/${data.params.database_name}` + `/config/integrations/${data.params.integrations_name}` ); const response = await connection.api.post(request, data); @@ -540,7 +540,7 @@ class DataBase { : [connection.token]; const request = setQueryParams( mergeParams, - `/config/integrations/${data.params.database_name}` + `/config/integrations/${data.params.integrations_name}` ); const response = await connection.api.put(request, data);