Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@superset-ui/connection

Package Overview
Dependencies
Maintainers
6
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@superset-ui/connection - npm Package Compare versions

Comparing version 0.9.0 to 0.9.2

2

esm/SupersetClient.js

@@ -1,1 +0,1 @@

import{SupersetClientClass}from"./SupersetClientClass";var singletonClient;function getInstance(a){if(!a)throw new Error("You must call SupersetClient.configure(...) before calling other methods");return a}var SupersetClient={configure:function b(a){return singletonClient=new SupersetClientClass(a),singletonClient},get:function b(a){return getInstance(singletonClient).get(a)},getInstance:getInstance,init:function b(a){return getInstance(singletonClient).init(a)},isAuthenticated:function a(){return getInstance(singletonClient).isAuthenticated()},post:function b(a){return getInstance(singletonClient).post(a)},reAuthenticate:function a(){return getInstance(singletonClient).init(/* force = */!0)},reset:function a(){singletonClient=void 0}};export default SupersetClient;
import{SupersetClientClass}from"./SupersetClientClass";var singletonClient;function getInstance(a){if(!a)throw new Error("You must call SupersetClient.configure(...) before calling other methods");return a}var SupersetClient={configure:function b(a){return singletonClient=new SupersetClientClass(a),singletonClient},delete:function b(a){return getInstance(singletonClient).delete(a)},get:function b(a){return getInstance(singletonClient).get(a)},getInstance:getInstance,init:function b(a){return getInstance(singletonClient).init(a)},isAuthenticated:function a(){return getInstance(singletonClient).isAuthenticated()},post:function b(a){return getInstance(singletonClient).post(a)},put:function b(a){return getInstance(singletonClient).put(a)},reAuthenticate:function a(){return getInstance(singletonClient).init(/* force = */!0)},request:function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(a){return getInstance(singletonClient).get(a)}),reset:function a(){singletonClient=void 0}};export default SupersetClient;
function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _extends(){return _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:/* force = */!0,configurable:!0,writable:!0}):a[b]=c,a}import callApi from"./callApi";export var SupersetClientClass=/*#__PURE__*/function(){function a(a){var b=void 0===a?{}:a,c=b.protocol,d=void 0===c?"http:":c,e=b.host,f=void 0===e?"localhost":e,g=b.headers,h=void 0===g?{}:g,i=b.mode,j=void 0===i?"same-origin":i,k=b.timeout,l=b.credentials,m=void 0===l?void 0:l,n=b.csrfToken,o=void 0===n?void 0:n;_defineProperty(this,"credentials",void 0),_defineProperty(this,"csrfToken",void 0),_defineProperty(this,"csrfPromise",void 0),_defineProperty(this,"protocol",void 0),_defineProperty(this,"host",void 0),_defineProperty(this,"headers",void 0),_defineProperty(this,"mode",void 0),_defineProperty(this,"timeout",void 0),this.headers=_extends({},h),this.host=f,this.mode=j,this.timeout=k,this.protocol=d,this.credentials=m,this.csrfToken=o,this.csrfPromise=void 0,"string"==typeof this.csrfToken&&(this.headers=_extends({},this.headers,{"X-CSRFToken":this.csrfToken}),this.csrfPromise=Promise.resolve(this.csrfToken))}var b=a.prototype;return b.init=function b(a){return void 0===a&&(a=!1),this.isAuthenticated()&&!a?this.csrfPromise:this.getCSRFToken()},b.isAuthenticated=function a(){// if CSRF protection is disabled in the Superset app, the token may be an empty string
return null!==this.csrfToken&&void 0!==this.csrfToken},b.get=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=b.body,d=b.credentials,e=b.headers,f=b.host,g=b.endpoint,h=b.mode,i=b.parseMethod,j=b.signal,k=b.timeout,l=b.url,a.abrupt("return",this.ensureAuth().then(function(){return callApi({body:c,credentials:d||m.credentials,headers:_extends({},m.headers,e),method:"GET",mode:h||m.mode,parseMethod:i,signal:j,timeout:k||m.timeout,url:m.getUrl({endpoint:g,host:f,url:l})})}));case 2:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.post=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m,n=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=b.credentials,d=b.endpoint,e=b.headers,f=b.host,g=b.mode,h=b.parseMethod,i=b.postPayload,j=b.signal,k=b.stringify,l=b.timeout,m=b.url,a.abrupt("return",this.ensureAuth().then(function(){return callApi({credentials:c||n.credentials,headers:_extends({},n.headers,e),method:"POST",mode:g||n.mode,parseMethod:h,postPayload:i,signal:j,stringify:k,timeout:l||n.timeout,url:n.getUrl({endpoint:d,host:f,url:m})})}));case 2:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.ensureAuth=function a(){return this.csrfPromise||Promise.reject({error:"SupersetClient has no CSRF token, ensure it is initialized or\n try logging into the Superset instance at "+this.getUrl({endpoint:"/login"})})},b.getCSRFToken=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(){var b=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.csrfToken=void 0,this.csrfPromise=callApi({credentials:this.credentials,headers:_extends({},this.headers),method:"GET",mode:this.mode,timeout:this.timeout,url:this.getUrl({endpoint:"superset/csrf_token/"})}).then(function(a){return"object"==typeof a.json&&(b.csrfToken=a.json.csrf_token,"string"==typeof b.csrfToken&&(b.headers=_extends({},b.headers,{"X-CSRFToken":b.csrfToken}))),b.isAuthenticated()?Promise.resolve(b.csrfToken):Promise.reject({error:"Failed to fetch CSRF token"})}),a.abrupt("return",this.csrfPromise);case 3:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.getUrl=function i(a){var b=void 0===a?{}:a,c=b.host,d=b.endpoint,e=void 0===d?"":d,f=b.url;if("string"==typeof f)return f;var g=c||this.host,h="/"===g.slice(-1)?g.slice(0,-1):g;// no backslash
return null!==this.csrfToken&&void 0!==this.csrfToken},b.get=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"GET"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.delete=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"DELETE"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.put=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"PUT"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.post=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"POST"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.request=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=b.body,d=b.credentials,e=b.endpoint,f=b.headers,g=b.host,h=b.method,i=b.mode,j=b.parseMethod,k=b.postPayload,l=b.signal,m=b.stringify,n=b.timeout,o=b.url,a.abrupt("return",this.ensureAuth().then(function(){return callApi({body:c,credentials:d||p.credentials,headers:_extends({},p.headers,f),method:h,mode:i||p.mode,parseMethod:j,postPayload:k,signal:l,stringify:m,timeout:n||p.timeout,url:p.getUrl({endpoint:e,host:g,url:o})})}));case 2:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.ensureAuth=function a(){return this.csrfPromise||Promise.reject({error:"SupersetClient has no CSRF token, ensure it is initialized or\n try logging into the Superset instance at "+this.getUrl({endpoint:"/login"})})},b.getCSRFToken=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(){var b=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.csrfToken=void 0,this.csrfPromise=callApi({credentials:this.credentials,headers:_extends({},this.headers),method:"GET",mode:this.mode,timeout:this.timeout,url:this.getUrl({endpoint:"superset/csrf_token/"})}).then(function(a){return"object"==typeof a.json&&(b.csrfToken=a.json.csrf_token,"string"==typeof b.csrfToken&&(b.headers=_extends({},b.headers,{"X-CSRFToken":b.csrfToken}))),b.isAuthenticated()?Promise.resolve(b.csrfToken):Promise.reject({error:"Failed to fetch CSRF token"})}),a.abrupt("return",this.csrfPromise);case 3:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.getUrl=function i(a){var b=void 0===a?{}:a,c=b.host,d=b.endpoint,e=void 0===d?"":d,f=b.url;if("string"==typeof f)return f;var g=c||this.host,h="/"===g.slice(-1)?g.slice(0,-1):g;// no backslash
return this.protocol+"//"+h+"/"+("/"===e[0]?e.slice(1):e)},a}();

@@ -5,2 +5,3 @@ import { ClientConfig, SupersetClientClass } from './SupersetClientClass';

configure: (config?: ClientConfig) => SupersetClientClass;
delete: (request: RequestConfig) => Promise<SupersetClientResponse>;
get: (request: RequestConfig) => Promise<SupersetClientResponse>;

@@ -11,3 +12,5 @@ getInstance: (maybeClient?: SupersetClientClass) => SupersetClientClass;

post: (request: RequestConfig) => Promise<SupersetClientResponse>;
put: (request: RequestConfig) => Promise<SupersetClientResponse>;
reAuthenticate: () => Promise<string | undefined>;
request: (request: RequestConfig) => Promise<SupersetClientResponse>;
reset: () => void;

@@ -14,0 +17,0 @@ }

@@ -1,1 +0,1 @@

"use strict";exports.__esModule=/* force = */!0,exports.default=void 0;var singletonClient,_SupersetClientClass=require("./SupersetClientClass");function getInstance(a){if(!a)throw new Error("You must call SupersetClient.configure(...) before calling other methods");return a}var SupersetClient={configure:function b(a){return singletonClient=new _SupersetClientClass.SupersetClientClass(a),singletonClient},get:function b(a){return getInstance(singletonClient).get(a)},getInstance:getInstance,init:function b(a){return getInstance(singletonClient).init(a)},isAuthenticated:function a(){return getInstance(singletonClient).isAuthenticated()},post:function b(a){return getInstance(singletonClient).post(a)},reAuthenticate:function a(){return getInstance(singletonClient).init(!0)},reset:function a(){singletonClient=void 0}},_default=SupersetClient;exports.default=_default;
"use strict";exports.__esModule=/* force = */!0,exports.default=void 0;var singletonClient,_SupersetClientClass=require("./SupersetClientClass");function getInstance(a){if(!a)throw new Error("You must call SupersetClient.configure(...) before calling other methods");return a}var SupersetClient={configure:function b(a){return singletonClient=new _SupersetClientClass.SupersetClientClass(a),singletonClient},delete:function b(a){return getInstance(singletonClient).delete(a)},get:function b(a){return getInstance(singletonClient).get(a)},getInstance:getInstance,init:function b(a){return getInstance(singletonClient).init(a)},isAuthenticated:function a(){return getInstance(singletonClient).isAuthenticated()},post:function b(a){return getInstance(singletonClient).post(a)},put:function b(a){return getInstance(singletonClient).put(a)},reAuthenticate:function a(){return getInstance(singletonClient).init(!0)},request:function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(a){return getInstance(singletonClient).get(a)}),reset:function a(){singletonClient=void 0}},_default=SupersetClient;exports.default=_default;

@@ -26,4 +26,7 @@ import { ClientTimeout, Credentials, Headers, Host, Mode, SupersetClientResponse, RequestConfig } from './types';

isAuthenticated(): boolean;
get({ body, credentials, headers, host, endpoint, mode, parseMethod, signal, timeout, url, }: RequestConfig): Promise<SupersetClientResponse>;
post({ credentials, endpoint, headers, host, mode, parseMethod, postPayload, signal, stringify, timeout, url, }: RequestConfig): Promise<SupersetClientResponse>;
get(requestConfig: RequestConfig): Promise<SupersetClientResponse>;
delete(requestConfig: RequestConfig): Promise<SupersetClientResponse>;
put(requestConfig: RequestConfig): Promise<SupersetClientResponse>;
post(requestConfig: RequestConfig): Promise<SupersetClientResponse>;
request({ body, credentials, endpoint, headers, host, method, mode, parseMethod, postPayload, signal, stringify, timeout, url, }: RequestConfig): Promise<SupersetClientResponse>;
ensureAuth(): CsrfPromise;

@@ -30,0 +33,0 @@ getCSRFToken(): CsrfPromise;

"use strict";var _callApi=_interopRequireDefault(require("./callApi"));exports.__esModule=/* force = */!0,exports.SupersetClientClass=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}function _extends(){return _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var SupersetClientClass=/*#__PURE__*/function(){function a(a){var b=void 0===a?{}:a,c=b.protocol,d=void 0===c?"http:":c,e=b.host,f=void 0===e?"localhost":e,g=b.headers,h=void 0===g?{}:g,i=b.mode,j=void 0===i?"same-origin":i,k=b.timeout,l=b.credentials,m=void 0===l?void 0:l,n=b.csrfToken,o=void 0===n?void 0:n;_defineProperty(this,"credentials",void 0),_defineProperty(this,"csrfToken",void 0),_defineProperty(this,"csrfPromise",void 0),_defineProperty(this,"protocol",void 0),_defineProperty(this,"host",void 0),_defineProperty(this,"headers",void 0),_defineProperty(this,"mode",void 0),_defineProperty(this,"timeout",void 0),this.headers=_extends({},h),this.host=f,this.mode=j,this.timeout=k,this.protocol=d,this.credentials=m,this.csrfToken=o,this.csrfPromise=void 0,"string"==typeof this.csrfToken&&(this.headers=_extends({},this.headers,{"X-CSRFToken":this.csrfToken}),this.csrfPromise=Promise.resolve(this.csrfToken))}var b=a.prototype;return b.init=function b(a){return void 0===a&&(a=!1),this.isAuthenticated()&&!a?this.csrfPromise:this.getCSRFToken()},b.isAuthenticated=function a(){// if CSRF protection is disabled in the Superset app, the token may be an empty string
return null!==this.csrfToken&&void 0!==this.csrfToken},b.get=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=b.body,d=b.credentials,e=b.headers,f=b.host,g=b.endpoint,h=b.mode,i=b.parseMethod,j=b.signal,k=b.timeout,l=b.url,a.abrupt("return",this.ensureAuth().then(function(){return(0,_callApi.default)({body:c,credentials:d||m.credentials,headers:_extends({},m.headers,e),method:"GET",mode:h||m.mode,parseMethod:i,signal:j,timeout:k||m.timeout,url:m.getUrl({endpoint:g,host:f,url:l})})}));case 2:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.post=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m,n=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=b.credentials,d=b.endpoint,e=b.headers,f=b.host,g=b.mode,h=b.parseMethod,i=b.postPayload,j=b.signal,k=b.stringify,l=b.timeout,m=b.url,a.abrupt("return",this.ensureAuth().then(function(){return(0,_callApi.default)({credentials:c||n.credentials,headers:_extends({},n.headers,e),method:"POST",mode:g||n.mode,parseMethod:h,postPayload:i,signal:j,stringify:k,timeout:l||n.timeout,url:n.getUrl({endpoint:d,host:f,url:m})})}));case 2:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.ensureAuth=function a(){return this.csrfPromise||Promise.reject({error:"SupersetClient has no CSRF token, ensure it is initialized or\n try logging into the Superset instance at "+this.getUrl({endpoint:"/login"})})},b.getCSRFToken=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(){var b=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.csrfToken=void 0,this.csrfPromise=(0,_callApi.default)({credentials:this.credentials,headers:_extends({},this.headers),method:"GET",mode:this.mode,timeout:this.timeout,url:this.getUrl({endpoint:"superset/csrf_token/"})}).then(function(a){return"object"==typeof a.json&&(b.csrfToken=a.json.csrf_token,"string"==typeof b.csrfToken&&(b.headers=_extends({},b.headers,{"X-CSRFToken":b.csrfToken}))),b.isAuthenticated()?Promise.resolve(b.csrfToken):Promise.reject({error:"Failed to fetch CSRF token"})}),a.abrupt("return",this.csrfPromise);case 3:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.getUrl=function i(a){var b=void 0===a?{}:a,c=b.host,d=b.endpoint,e=void 0===d?"":d,f=b.url;if("string"==typeof f)return f;var g=c||this.host,h="/"===g.slice(-1)?g.slice(0,-1):g;// no backslash
return null!==this.csrfToken&&void 0!==this.csrfToken},b.get=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"GET"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.delete=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"DELETE"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.put=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"PUT"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.post=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",this.request(_extends({},b,{method:"POST"})));case 1:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.request=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=b.body,d=b.credentials,e=b.endpoint,f=b.headers,g=b.host,h=b.method,i=b.mode,j=b.parseMethod,k=b.postPayload,l=b.signal,m=b.stringify,n=b.timeout,o=b.url,a.abrupt("return",this.ensureAuth().then(function(){return(0,_callApi.default)({body:c,credentials:d||p.credentials,headers:_extends({},p.headers,f),method:h,mode:i||p.mode,parseMethod:j,postPayload:k,signal:l,stringify:m,timeout:n||p.timeout,url:p.getUrl({endpoint:e,host:g,url:o})})}));case 2:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.ensureAuth=function a(){return this.csrfPromise||Promise.reject({error:"SupersetClient has no CSRF token, ensure it is initialized or\n try logging into the Superset instance at "+this.getUrl({endpoint:"/login"})})},b.getCSRFToken=/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function a(){var b=this;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.csrfToken=void 0,this.csrfPromise=(0,_callApi.default)({credentials:this.credentials,headers:_extends({},this.headers),method:"GET",mode:this.mode,timeout:this.timeout,url:this.getUrl({endpoint:"superset/csrf_token/"})}).then(function(a){return"object"==typeof a.json&&(b.csrfToken=a.json.csrf_token,"string"==typeof b.csrfToken&&(b.headers=_extends({},b.headers,{"X-CSRFToken":b.csrfToken}))),b.isAuthenticated()?Promise.resolve(b.csrfToken):Promise.reject({error:"Failed to fetch CSRF token"})}),a.abrupt("return",this.csrfPromise);case 3:case"end":return a.stop();}},a,this)}));return function b(){return a.apply(this,arguments)}}(),b.getUrl=function i(a){var b=void 0===a?{}:a,c=b.host,d=b.endpoint,e=void 0===d?"":d,f=b.url;if("string"==typeof f)return f;var g=c||this.host,h="/"===g.slice(-1)?g.slice(0,-1):g;// no backslash
return this.protocol+"//"+h+"/"+("/"===e[0]?e.slice(1):e)},a}();exports.SupersetClientClass=SupersetClientClass;

@@ -42,2 +42,3 @@ export declare type Body = RequestInit['body'];

mode?: Mode;
method?: Method;
parseMethod?: ParseMethod;

@@ -44,0 +45,0 @@ postPayload?: PostPayload;

{
"name": "@superset-ui/connection",
"version": "0.9.0",
"version": "0.9.2",
"description": "Superset UI connection",

@@ -41,3 +41,3 @@ "sideEffects": false,

},
"gitHead": "799b7629af5fd92929d5557af1a14d820fed506a"
"gitHead": "1569f5a417d3d741de5090da6d3941dae63573b5"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc