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

@superset-ui/connection

Package Overview
Dependencies
Maintainers
8
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.10.5 to 0.10.10

esm/constants.js

9

esm/callApi/callApi.js

@@ -1,4 +0,5 @@

import"whatwg-fetch";// This function fetches an API response and returns the corresponding json
export default function callApi(a){var b=a.body,c=a.cache,d=void 0===c?"default":c,e=a.credentials,f=void 0===e?"same-origin":e,g=a.headers,h=a.method,i=void 0===h?"GET":h,j=a.mode,k=void 0===j?"same-origin":j,l=a.postPayload,m=a.redirect,n=void 0===m?"follow":m,o=a.signal,p=a.stringify,q=a.url,r={body:b,cache:d,credentials:f,headers:g,method:i,mode:k,redirect:n,signal:o};if(("POST"===i||"PATCH"===i||"PUT"===i)&&"object"==typeof l){// using FormData has the effect that Content-Type header is set to `multipart/form-data`,
var s=new FormData;Object.keys(l).forEach(function(a){var b=l[a];"undefined"!=typeof b&&s.append(a,!(void 0!==p)||p?JSON.stringify(b):b)}),r.body=s}return fetch(q,r);// eslint-disable-line compat/compat
}
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)}/* eslint compat/compat: 'off' */import"whatwg-fetch";import{CACHE_AVAILABLE,CACHE_KEY,HTTP_STATUS_NOT_MODIFIED,HTTP_STATUS_OK}from"../constants";// This function fetches an API response and returns the corresponding json
export default function callApi(a){var b=a.body,c=a.cache,d=void 0===c?"default":c,e=a.credentials,f=void 0===e?"same-origin":e,g=a.headers,h=a.method,i=void 0===h?"GET":h,j=a.mode,k=void 0===j?"same-origin":j,l=a.postPayload,m=a.redirect,n=void 0===m?"follow":m,o=a.signal,p=a.stringify,q=a.url,r={body:b,cache:d,credentials:f,headers:g,method:i,mode:k,redirect:n,signal:o};if("GET"===i&&CACHE_AVAILABLE)return caches.open(CACHE_KEY).then(function(a){return a.match(q).then(function(a){if(a){// if we have a cached response, send its ETag in the
// `If-None-Match` header in a conditional request
var b=a.headers.get("Etag");r.headers=_extends({},r.headers,{"If-None-Match":b})}return fetch(q,r)}).then(function(b){return b.status===HTTP_STATUS_NOT_MODIFIED?a.match(q).then(function(a){if(a)return a.clone();throw new Error("Received 304 but no content is cached!")}):(b.status===HTTP_STATUS_OK&&b.headers.get("Etag")&&(a.delete(q),a.put(q,b.clone())),b)})});if(("POST"===i||"PATCH"===i||"PUT"===i)&&"object"==typeof l){// using FormData has the effect that Content-Type header is set to `multipart/form-data`,
var s=new FormData;Object.keys(l).forEach(function(a){var b=l[a];"undefined"!=typeof b&&s.append(a,!(void 0!==p)||p?JSON.stringify(b):b)}),r.body=s}return fetch(q,r)}

@@ -1,4 +0,5 @@

"use strict";exports.__esModule=/* force = */!0,exports.default=callApi,require("whatwg-fetch");// This function fetches an API response and returns the corresponding json
function callApi(a){var b=a.body,c=a.cache,d=void 0===c?"default":c,e=a.credentials,f=void 0===e?"same-origin":e,g=a.headers,h=a.method,i=void 0===h?"GET":h,j=a.mode,k=void 0===j?"same-origin":j,l=a.postPayload,m=a.redirect,n=void 0===m?"follow":m,o=a.signal,p=a.stringify,q=a.url,r={body:b,cache:d,credentials:f,headers:g,method:i,mode:k,redirect:n,signal:o};if(("POST"===i||"PATCH"===i||"PUT"===i)&&"object"==typeof l){// using FormData has the effect that Content-Type header is set to `multipart/form-data`,
var s=new FormData;Object.keys(l).forEach(function(a){var b=l[a];"undefined"!=typeof b&&s.append(a,!(void 0!==p)||p?JSON.stringify(b):b)}),r.body=s}return fetch(q,r);// eslint-disable-line compat/compat
}
"use strict";var _constants=require("../constants");exports.__esModule=/* force = */!0,exports.default=callApi,require("whatwg-fetch");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)}// This function fetches an API response and returns the corresponding json
function callApi(a){var b=a.body,c=a.cache,d=void 0===c?"default":c,e=a.credentials,f=void 0===e?"same-origin":e,g=a.headers,h=a.method,i=void 0===h?"GET":h,j=a.mode,k=void 0===j?"same-origin":j,l=a.postPayload,m=a.redirect,n=void 0===m?"follow":m,o=a.signal,p=a.stringify,q=a.url,r={body:b,cache:d,credentials:f,headers:g,method:i,mode:k,redirect:n,signal:o};if("GET"===i&&_constants.CACHE_AVAILABLE)return caches.open(_constants.CACHE_KEY).then(function(a){return a.match(q).then(function(a){if(a){// if we have a cached response, send its ETag in the
// `If-None-Match` header in a conditional request
var b=a.headers.get("Etag");r.headers=_extends({},r.headers,{"If-None-Match":b})}return fetch(q,r)}).then(function(b){return b.status===_constants.HTTP_STATUS_NOT_MODIFIED?a.match(q).then(function(a){if(a)return a.clone();throw new Error("Received 304 but no content is cached!")}):(b.status===_constants.HTTP_STATUS_OK&&b.headers.get("Etag")&&(a.delete(q),a.put(q,b.clone())),b)})});if(("POST"===i||"PATCH"===i||"PUT"===i)&&"object"==typeof l){// using FormData has the effect that Content-Type header is set to `multipart/form-data`,
var s=new FormData;Object.keys(l).forEach(function(a){var b=l[a];"undefined"!=typeof b&&s.append(a,!(void 0!==p)||p?JSON.stringify(b):b)}),r.body=s}return fetch(q,r)}
{
"name": "@superset-ui/connection",
"version": "0.10.5",
"version": "0.10.10",
"description": "Superset UI connection",

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

},
"gitHead": "98308f10ad4f4d920f9b4ef065c4d039eab27658"
"gitHead": "20cf61bc6e03a7fc2ed0845024a987bd40140d18"
}

@@ -26,2 +26,3 @@ ## @superset-ui/connection

- query aborts through the `AbortController` API
- conditional `GET` requests using `If-None-Match` and `ETag` headers

@@ -28,0 +29,0 @@ #### Example usage

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