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

@superset-ui/core

Package Overview
Dependencies
Maintainers
1
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@superset-ui/core - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

esm/SupersetClient.js

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

import _Promise from'babel-runtime/core-js/promise';import _extends from'babel-runtime/helpers/extends';import _classCallCheck from'babel-runtime/helpers/classCallCheck';import _createClass from'babel-runtime/helpers/createClass';import callApi from'./callApi';var SupersetClient=function(){function a(b){_classCallCheck(this,a);var c=b.protocol,d=void 0===c?'http':c,e=b.host,f=void 0===e?'':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;this.headers=h,this.host=f,this.mode=j,this.timeout=k,this.protocol=d,this.credentials=l,this.csrfToken=null,this.didAuthSuccessfully=!1,this.csrfPromise=null}return _createClass(a,[{key:'isAuthenticated',value:function isAuthenticated(){return this.didAuthSuccessfully}},{key:'init',value:function init(){return this.getCSRFToken()}},{key:'getCSRFToken',value:function getCSRFToken(){var a=this;return this.csrfToken=null,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/',host:this.host})}).then(function(b){return b.json&&(a.csrfToken=b.json.csrf_token,a.headers=_extends({},a.headers,{"X-CSRFToken":a.csrfToken}),a.didAuthSuccessfully=null!==a.csrfToken&&void 0!==a.csrfPromise),a.didAuthSuccessfully?b:_Promise.reject({error:'Failed to fetch CSRF token'})}),this.csrfPromise}},{key:'getUrl',value:function getUrl(a){var b=a.host,c=void 0===b?'':b,d=a.endpoint,e=void 0===d?'':d,f='/'===c.slice(-1)?c.slice(0,-1):c;return this.protocol+'://'+f+'/'+('/'===e[0]?e.slice(1):e)}},{key:'ensureAuth',value:function ensureAuth(){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('/login')})}},{key:'get',value:function get(a){var b=this,c=a.body,d=a.credentials,e=a.headers,f=a.host,g=a.endpoint,h=a.mode,i=a.parseMethod,j=a.signal,k=a.timeout,l=a.url;return this.ensureAuth().then(function(){return callApi({body:c,credentials:d||b.credentials,headers:_extends({},b.headers,e),method:'GET',mode:h||b.mode,parseMethod:i,signal:j,timeout:k||b.timeout,url:l||b.getUrl({endpoint:g,host:f||b.host})})})}},{key:'post',value:function post(a){var b=this,c=a.credentials,d=a.headers,e=a.host,f=a.endpoint,g=a.mode,h=a.parseMethod,i=a.postPayload,j=a.signal,k=a.stringify,l=a.timeout,m=a.url;return this.ensureAuth().then(function(){return callApi({credentials:c||b.credentials,headers:_extends({},b.headers,d),method:'POST',mode:g||b.mode,parseMethod:h,postPayload:i,signal:j,stringify:k,timeout:l||b.timeout,url:m||b.getUrl({endpoint:f,host:e||b.host})})})}}]),a}(),singletonClient=void 0;function hasInstance(){if(!singletonClient)throw new Error('You must call SupersetClient.configure(...) before calling other methods');return!0}var PublicAPI={configure:function configure(a){return singletonClient=new SupersetClient(a||{}),singletonClient},get:function get(){var a;return hasInstance()&&(a=singletonClient).get.apply(a,arguments)},init:function init(){return hasInstance()&&singletonClient.init()},isAuthenticated:function isAuthenticated(){return hasInstance()&&singletonClient.isAuthenticated()},post:function post(){var a;return hasInstance()&&(a=singletonClient).post.apply(a,arguments)},reAuthenticate:function reAuthenticate(){return hasInstance()&&singletonClient.getCSRFToken()},reset:function reset(){singletonClient=null}};export{SupersetClient};export default PublicAPI;
import _Promise from'babel-runtime/core-js/promise';import _extends from'babel-runtime/helpers/extends';import _classCallCheck from'babel-runtime/helpers/classCallCheck';import _createClass from'babel-runtime/helpers/createClass';import callApi from'./callApi';var SupersetClient=function(){function a(b){_classCallCheck(this,a);var 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;this.headers=h,this.host=f,this.mode=j,this.timeout=k,this.protocol=''+d+(':'===d.slice(-1)?'':':'),this.credentials=l,this.csrfToken=null,this.didAuthSuccessfully=!1,this.csrfPromise=null}return _createClass(a,[{key:'isAuthenticated',value:function isAuthenticated(){return this.didAuthSuccessfully}},{key:'init',value:function init(){return this.getCSRFToken()}},{key:'getCSRFToken',value:function getCSRFToken(){var a=this;return this.csrfToken=null,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/',host:this.host})}).then(function(b){return b.json&&(a.csrfToken=b.json.csrf_token,a.headers=_extends({},a.headers,{"X-CSRFToken":a.csrfToken}),a.didAuthSuccessfully=null!==a.csrfToken&&void 0!==a.csrfPromise),a.didAuthSuccessfully?b:_Promise.reject({error:'Failed to fetch CSRF token'})}),this.csrfPromise}},{key:'getUrl',value:function getUrl(a){var b=a.host,c=void 0===b?'':b,d=a.endpoint,e=void 0===d?'':d,f='/'===c.slice(-1)?c.slice(0,-1):c;return this.protocol+'//'+f+'/'+('/'===e[0]?e.slice(1):e)}},{key:'ensureAuth',value:function ensureAuth(){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('/login')})}},{key:'get',value:function get(a){var b=this,c=a.body,d=a.credentials,e=a.headers,f=a.host,g=a.endpoint,h=a.mode,i=a.parseMethod,j=a.signal,k=a.timeout,l=a.url;return this.ensureAuth().then(function(){return callApi({body:c,credentials:d||b.credentials,headers:_extends({},b.headers,e),method:'GET',mode:h||b.mode,parseMethod:i,signal:j,timeout:k||b.timeout,url:l||b.getUrl({endpoint:g,host:f||b.host})})})}},{key:'post',value:function post(a){var b=this,c=a.credentials,d=a.headers,e=a.host,f=a.endpoint,g=a.mode,h=a.parseMethod,i=a.postPayload,j=a.signal,k=a.stringify,l=a.timeout,m=a.url;return this.ensureAuth().then(function(){return callApi({credentials:c||b.credentials,headers:_extends({},b.headers,d),method:'POST',mode:g||b.mode,parseMethod:h,postPayload:i,signal:j,stringify:k,timeout:l||b.timeout,url:m||b.getUrl({endpoint:f,host:e||b.host})})})}}]),a}(),singletonClient=void 0;function hasInstance(){if(!singletonClient)throw new Error('You must call SupersetClient.configure(...) before calling other methods');return!0}var PublicAPI={configure:function configure(a){return singletonClient=new SupersetClient(a||{}),singletonClient},get:function get(){var a;return hasInstance()&&(a=singletonClient).get.apply(a,arguments)},init:function init(){return hasInstance()&&singletonClient.init()},isAuthenticated:function isAuthenticated(){return hasInstance()&&singletonClient.isAuthenticated()},post:function post(){var a;return hasInstance()&&(a=singletonClient).post.apply(a,arguments)},reAuthenticate:function reAuthenticate(){return hasInstance()&&singletonClient.getCSRFToken()},reset:function reset(){singletonClient=null}};export{SupersetClient};export default PublicAPI;

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

'use strict';var _promise=require('babel-runtime/core-js/promise'),_promise2=_interopRequireDefault(_promise),_extends2=require('babel-runtime/helpers/extends'),_extends3=_interopRequireDefault(_extends2),_classCallCheck2=require('babel-runtime/helpers/classCallCheck'),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require('babel-runtime/helpers/createClass'),_createClass3=_interopRequireDefault(_createClass2),_callApi=require('./callApi'),_callApi2=_interopRequireDefault(_callApi);Object.defineProperty(exports,'__esModule',{value:!0}),exports.SupersetClient=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var SupersetClient=function(){function a(b){(0,_classCallCheck3.default)(this,a);var c=b.protocol,d=void 0===c?'http':c,e=b.host,f=void 0===e?'':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;this.headers=h,this.host=f,this.mode=j,this.timeout=k,this.protocol=d,this.credentials=l,this.csrfToken=null,this.didAuthSuccessfully=!1,this.csrfPromise=null}return(0,_createClass3.default)(a,[{key:'isAuthenticated',value:function isAuthenticated(){return this.didAuthSuccessfully}},{key:'init',value:function init(){return this.getCSRFToken()}},{key:'getCSRFToken',value:function getCSRFToken(){var a=this;return this.csrfToken=null,this.csrfPromise=(0,_callApi2.default)({credentials:this.credentials,headers:(0,_extends3.default)({},this.headers),method:'GET',mode:this.mode,timeout:this.timeout,url:this.getUrl({endpoint:'superset/csrf_token/',host:this.host})}).then(function(b){return b.json&&(a.csrfToken=b.json.csrf_token,a.headers=(0,_extends3.default)({},a.headers,{"X-CSRFToken":a.csrfToken}),a.didAuthSuccessfully=null!==a.csrfToken&&void 0!==a.csrfPromise),a.didAuthSuccessfully?b:_promise2.default.reject({error:'Failed to fetch CSRF token'})}),this.csrfPromise}},{key:'getUrl',value:function getUrl(a){var b=a.host,c=void 0===b?'':b,d=a.endpoint,e=void 0===d?'':d,f='/'===c.slice(-1)?c.slice(0,-1):c;return this.protocol+'://'+f+'/'+('/'===e[0]?e.slice(1):e)}},{key:'ensureAuth',value:function ensureAuth(){return this.csrfPromise||_promise2.default.reject({error:'SupersetClient has no CSRF token, ensure it is initialized or\n try logging into the Superset instance at '+this.getUrl('/login')})}},{key:'get',value:function get(a){var b=this,c=a.body,d=a.credentials,e=a.headers,f=a.host,g=a.endpoint,h=a.mode,i=a.parseMethod,j=a.signal,k=a.timeout,l=a.url;return this.ensureAuth().then(function(){return(0,_callApi2.default)({body:c,credentials:d||b.credentials,headers:(0,_extends3.default)({},b.headers,e),method:'GET',mode:h||b.mode,parseMethod:i,signal:j,timeout:k||b.timeout,url:l||b.getUrl({endpoint:g,host:f||b.host})})})}},{key:'post',value:function post(a){var b=this,c=a.credentials,d=a.headers,e=a.host,f=a.endpoint,g=a.mode,h=a.parseMethod,i=a.postPayload,j=a.signal,k=a.stringify,l=a.timeout,m=a.url;return this.ensureAuth().then(function(){return(0,_callApi2.default)({credentials:c||b.credentials,headers:(0,_extends3.default)({},b.headers,d),method:'POST',mode:g||b.mode,parseMethod:h,postPayload:i,signal:j,stringify:k,timeout:l||b.timeout,url:m||b.getUrl({endpoint:f,host:e||b.host})})})}}]),a}(),singletonClient=void 0;function hasInstance(){if(!singletonClient)throw new Error('You must call SupersetClient.configure(...) before calling other methods');return!0}var PublicAPI={configure:function configure(a){return singletonClient=new SupersetClient(a||{}),singletonClient},get:function get(){var a;return hasInstance()&&(a=singletonClient).get.apply(a,arguments)},init:function init(){return hasInstance()&&singletonClient.init()},isAuthenticated:function isAuthenticated(){return hasInstance()&&singletonClient.isAuthenticated()},post:function post(){var a;return hasInstance()&&(a=singletonClient).post.apply(a,arguments)},reAuthenticate:function reAuthenticate(){return hasInstance()&&singletonClient.getCSRFToken()},reset:function reset(){singletonClient=null}};exports.SupersetClient=SupersetClient,exports.default=PublicAPI;
'use strict';var _promise=require('babel-runtime/core-js/promise'),_promise2=_interopRequireDefault(_promise),_extends2=require('babel-runtime/helpers/extends'),_extends3=_interopRequireDefault(_extends2),_classCallCheck2=require('babel-runtime/helpers/classCallCheck'),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require('babel-runtime/helpers/createClass'),_createClass3=_interopRequireDefault(_createClass2),_callApi=require('./callApi'),_callApi2=_interopRequireDefault(_callApi);Object.defineProperty(exports,'__esModule',{value:!0}),exports.SupersetClient=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var SupersetClient=function(){function a(b){(0,_classCallCheck3.default)(this,a);var 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;this.headers=h,this.host=f,this.mode=j,this.timeout=k,this.protocol=''+d+(':'===d.slice(-1)?'':':'),this.credentials=l,this.csrfToken=null,this.didAuthSuccessfully=!1,this.csrfPromise=null}return(0,_createClass3.default)(a,[{key:'isAuthenticated',value:function isAuthenticated(){return this.didAuthSuccessfully}},{key:'init',value:function init(){return this.getCSRFToken()}},{key:'getCSRFToken',value:function getCSRFToken(){var a=this;return this.csrfToken=null,this.csrfPromise=(0,_callApi2.default)({credentials:this.credentials,headers:(0,_extends3.default)({},this.headers),method:'GET',mode:this.mode,timeout:this.timeout,url:this.getUrl({endpoint:'superset/csrf_token/',host:this.host})}).then(function(b){return b.json&&(a.csrfToken=b.json.csrf_token,a.headers=(0,_extends3.default)({},a.headers,{"X-CSRFToken":a.csrfToken}),a.didAuthSuccessfully=null!==a.csrfToken&&void 0!==a.csrfPromise),a.didAuthSuccessfully?b:_promise2.default.reject({error:'Failed to fetch CSRF token'})}),this.csrfPromise}},{key:'getUrl',value:function getUrl(a){var b=a.host,c=void 0===b?'':b,d=a.endpoint,e=void 0===d?'':d,f='/'===c.slice(-1)?c.slice(0,-1):c;return this.protocol+'//'+f+'/'+('/'===e[0]?e.slice(1):e)}},{key:'ensureAuth',value:function ensureAuth(){return this.csrfPromise||_promise2.default.reject({error:'SupersetClient has no CSRF token, ensure it is initialized or\n try logging into the Superset instance at '+this.getUrl('/login')})}},{key:'get',value:function get(a){var b=this,c=a.body,d=a.credentials,e=a.headers,f=a.host,g=a.endpoint,h=a.mode,i=a.parseMethod,j=a.signal,k=a.timeout,l=a.url;return this.ensureAuth().then(function(){return(0,_callApi2.default)({body:c,credentials:d||b.credentials,headers:(0,_extends3.default)({},b.headers,e),method:'GET',mode:h||b.mode,parseMethod:i,signal:j,timeout:k||b.timeout,url:l||b.getUrl({endpoint:g,host:f||b.host})})})}},{key:'post',value:function post(a){var b=this,c=a.credentials,d=a.headers,e=a.host,f=a.endpoint,g=a.mode,h=a.parseMethod,i=a.postPayload,j=a.signal,k=a.stringify,l=a.timeout,m=a.url;return this.ensureAuth().then(function(){return(0,_callApi2.default)({credentials:c||b.credentials,headers:(0,_extends3.default)({},b.headers,d),method:'POST',mode:g||b.mode,parseMethod:h,postPayload:i,signal:j,stringify:k,timeout:l||b.timeout,url:m||b.getUrl({endpoint:f,host:e||b.host})})})}}]),a}(),singletonClient=void 0;function hasInstance(){if(!singletonClient)throw new Error('You must call SupersetClient.configure(...) before calling other methods');return!0}var PublicAPI={configure:function configure(a){return singletonClient=new SupersetClient(a||{}),singletonClient},get:function get(){var a;return hasInstance()&&(a=singletonClient).get.apply(a,arguments)},init:function init(){return hasInstance()&&singletonClient.init()},isAuthenticated:function isAuthenticated(){return hasInstance()&&singletonClient.isAuthenticated()},post:function post(){var a;return hasInstance()&&(a=singletonClient).post.apply(a,arguments)},reAuthenticate:function reAuthenticate(){return hasInstance()&&singletonClient.getCSRFToken()},reset:function reset(){singletonClient=null}};exports.SupersetClient=SupersetClient,exports.default=PublicAPI;
{
"name": "@superset-ui/core",
"version": "0.0.4",
"version": "0.0.5",
"description": "Superset UI core 🤖",

@@ -70,3 +70,4 @@ "sideEffects": false,

"jest": {}
}
},
"gitHead": "227109c4511d65dc8001d9b8ac6c0af54dabd986"
}
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