@superset-ui/connection
Advanced tools
Comparing version 0.10.5 to 0.10.10
@@ -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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
8
97
43323
207
4