@esri/arcgis-rest-request
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -58,11 +58,13 @@ /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc. | ||
} | ||
if (!Promise) { | ||
if (typeof Promise === "undefined") { | ||
missingGlobals.push("`Promise`"); | ||
recommendedPackages.push("`es6-promise`"); | ||
} | ||
if (!FormData) { | ||
if (typeof FormData === "undefined") { | ||
missingGlobals.push("`FormData`"); | ||
recommendedPackages.push("`isomorphic-form-data`"); | ||
} | ||
if (!options.fetch || !Promise || !FormData) { | ||
if (!options.fetch || | ||
typeof Promise === "undefined" || | ||
typeof FormData === "undefined") { | ||
throw new Error("`arcgis-rest-request` requires global variables for `fetch`, `Promise` and `FormData` to be present in the global scope. You are missing " + missingGlobals.join(", ") + ". We recommend installing the " + recommendedPackages.join(", ") + " modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info."); | ||
@@ -69,0 +71,0 @@ } |
@@ -18,4 +18,9 @@ /* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
if (typeof Blob !== "undefined" && newParams[key] instanceof Blob) { | ||
// Pass on the explicit file name to override default name such as "blob" | ||
formData_1.append(key, newParams[key], newParams[key].name || key); | ||
/* To name the Blob: | ||
1. look to an alternate request parameter called 'fileName' | ||
2. see if 'name' has been tacked onto the Blob manually | ||
3. if all else fails, use the request parameter | ||
*/ | ||
var filename = newParams["fileName"] || newParams[key].name || key; | ||
formData_1.append(key, newParams[key], filename); | ||
} | ||
@@ -22,0 +27,0 @@ else { |
@@ -60,11 +60,13 @@ "use strict"; | ||
} | ||
if (!Promise) { | ||
if (typeof Promise === "undefined") { | ||
missingGlobals.push("`Promise`"); | ||
recommendedPackages.push("`es6-promise`"); | ||
} | ||
if (!FormData) { | ||
if (typeof FormData === "undefined") { | ||
missingGlobals.push("`FormData`"); | ||
recommendedPackages.push("`isomorphic-form-data`"); | ||
} | ||
if (!options.fetch || !Promise || !FormData) { | ||
if (!options.fetch || | ||
typeof Promise === "undefined" || | ||
typeof FormData === "undefined") { | ||
throw new Error("`arcgis-rest-request` requires global variables for `fetch`, `Promise` and `FormData` to be present in the global scope. You are missing " + missingGlobals.join(", ") + ". We recommend installing the " + recommendedPackages.join(", ") + " modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info."); | ||
@@ -71,0 +73,0 @@ } |
@@ -20,4 +20,9 @@ "use strict"; | ||
if (typeof Blob !== "undefined" && newParams[key] instanceof Blob) { | ||
// Pass on the explicit file name to override default name such as "blob" | ||
formData_1.append(key, newParams[key], newParams[key].name || key); | ||
/* To name the Blob: | ||
1. look to an alternate request parameter called 'fileName' | ||
2. see if 'name' has been tacked onto the Blob manually | ||
3. if all else fails, use the request parameter | ||
*/ | ||
var filename = newParams["fileName"] || newParams[key].name || key; | ||
formData_1.append(key, newParams[key], filename); | ||
} | ||
@@ -24,0 +29,0 @@ else { |
@@ -1,2 +0,2 @@ | ||
/* @esri/arcgis-rest-request - v1.1.1 - Mon Mar 05 2018 10:57:50 GMT-0800 (PST) | ||
/* @esri/arcgis-rest-request - v1.1.0 - Mon Mar 05 2018 09:45:26 GMT-0800 (PST) | ||
* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
@@ -225,3 +225,3 @@ * Apache-2.0 */ | ||
var param = params[key]; | ||
if (!param && param !== 0 && typeof param !== "boolean") { | ||
if (!param && param !== 0) { | ||
return; | ||
@@ -228,0 +228,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* @esri/arcgis-rest-request - v1.1.1 - Mon Mar 05 2018 10:57:52 GMT-0800 (PST) | ||
/* @esri/arcgis-rest-request - v1.1.0 - Mon Mar 05 2018 09:45:29 GMT-0800 (PST) | ||
* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
@@ -14,3 +14,3 @@ * Apache-2.0 */ | ||
* Apache-2.0 */ | ||
function c(e){return Object.keys(e).some(function(t){var r=e[t];if(!r)return!1;switch(r.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}})}function i(e){var t={};return Object.keys(e).forEach(function(r){var o=e[r];if(o||0===o||"boolean"==typeof o){var n;switch(o.constructor.name){case"Array":n="Object"===o[0].constructor.name?JSON.stringify(o):o.join(",");break;case"Object":n=JSON.stringify(o);break;case"Date":n=o.valueOf();break;case"Function":n=null;break;case"Boolean":n=o+"";break;default:n=o}(n||0===n)&&(t[r]=n)}}),t} | ||
function c(e){return Object.keys(e).some(function(t){var r=e[t];if(!r)return!1;switch(r.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}})}function i(e){var t={};return Object.keys(e).forEach(function(r){var o=e[r];if(o||0===o){var n;switch(o.constructor.name){case"Array":n="Object"===o[0].constructor.name?JSON.stringify(o):o.join(",");break;case"Object":n=JSON.stringify(o);break;case"Date":n=o.valueOf();break;case"Function":n=null;break;case"Boolean":n=o+"";break;default:n=o}(n||0===n)&&(t[r]=n)}}),t} | ||
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
@@ -17,0 +17,0 @@ * Apache-2.0 */function u(e,t){return encodeURIComponent(e)+"="+encodeURIComponent(t)}function f(e){var t=i(e);return Object.keys(t).map(function(e){return u(e,t[e])}).join("&")} |
/* @preserve | ||
* @esri/arcgis-rest-request - v1.10.0 - Apache-2.0 | ||
* @esri/arcgis-rest-request - v1.11.0 - Apache-2.0 | ||
* Copyright (c) 2017-2018 Esri, Inc. | ||
* Mon Sep 17 2018 13:54:53 GMT-0700 (PDT) | ||
* Wed Sep 19 2018 14:12:54 GMT-0600 (MDT) | ||
*/ | ||
@@ -308,4 +308,9 @@ (function (global, factory) { | ||
if (typeof Blob !== "undefined" && newParams[key] instanceof Blob) { | ||
// Pass on the explicit file name to override default name such as "blob" | ||
formData_1.append(key, newParams[key], newParams[key].name || key); | ||
/* To name the Blob: | ||
1. look to an alternate request parameter called 'fileName' | ||
2. see if 'name' has been tacked onto the Blob manually | ||
3. if all else fails, use the request parameter | ||
*/ | ||
var filename = newParams["fileName"] || newParams[key].name || key; | ||
formData_1.append(key, newParams[key], filename); | ||
} | ||
@@ -374,11 +379,13 @@ else { | ||
} | ||
if (!Promise) { | ||
if (typeof Promise === "undefined") { | ||
missingGlobals.push("`Promise`"); | ||
recommendedPackages.push("`es6-promise`"); | ||
} | ||
if (!FormData) { | ||
if (typeof FormData === "undefined") { | ||
missingGlobals.push("`FormData`"); | ||
recommendedPackages.push("`isomorphic-form-data`"); | ||
} | ||
if (!options.fetch || !Promise || !FormData) { | ||
if (!options.fetch || | ||
typeof Promise === "undefined" || | ||
typeof FormData === "undefined") { | ||
throw new Error("`arcgis-rest-request` requires global variables for `fetch`, `Promise` and `FormData` to be present in the global scope. You are missing " + missingGlobals.join(", ") + ". We recommend installing the " + recommendedPackages.join(", ") + " modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info."); | ||
@@ -385,0 +392,0 @@ } |
/* @preserve | ||
* @esri/arcgis-rest-request - v1.10.0 - Apache-2.0 | ||
* @esri/arcgis-rest-request - v1.11.0 - Apache-2.0 | ||
* Copyright (c) 2017-2018 Esri, Inc. | ||
* Mon Sep 17 2018 13:55:04 GMT-0700 (PDT) | ||
* Wed Sep 19 2018 14:12:57 GMT-0600 (MDT) | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.arcgisRest=e.arcgisRest||{})}(this,function(e){"use strict";var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};var r=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},o=function(){return function(e,t,r,o,n){e=e||"UNKNOWN_ERROR",t=t||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===t?e:t+": "+e,this.originalMessage=e,this.code=t,this.response=r,this.url=o,this.options=n}}();o.prototype=Object.create(Error.prototype),o.prototype.constructor=o;var n,a=function(e){function o(t,r,o,n,a){void 0===t&&(t="AUTHENTICATION_ERROR"),void 0===r&&(r="AUTHENTICATION_ERROR_CODE");var s=e.call(this,t,r,o,n,a)||this;return s.name="ArcGISAuthError",s.message="AUTHENTICATION_ERROR_CODE"===r?t:r+": "+t,s}return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}(o,e),o.prototype.retry=function(e,t){var o=this;void 0===t&&(t=3);var n=0,a=function(s,c){e(o.url,o.options).then(function(e){var t=r({},o.options,{authentication:e});return n+=1,p(o.url,t)}).then(function(e){s(e)}).catch(function(e){"ArcGISAuthError"===e.name&&n<t?a(s,c):"ArcGISAuthError"===e.name&&n>=t?c(o):c(e)})};return new Promise(function(e,t){a(e,t)})},o}(o);function s(e,t,r,n){if(e.code>=400){var s=e.message,c=e.code;throw new o(s,c,e,t,n)}if(e.error){var i=e.error,u=(s=i.message,c=i.code,i.messageCode),f=u||c||"UNKNOWN_ERROR_CODE";if(498===c||499===c||"GWM_0003"===u)throw new a(s,f,e,t,n);throw new o(s,f,e,t,n)}if("failed"===e.status||"failure"===e.status){s=void 0,c="UNKNOWN_ERROR_CODE";try{s=JSON.parse(e.statusMessage).message,c=JSON.parse(e.statusMessage).code}catch(t){s=e.statusMessage||e.message}throw new o(s,c,e,t,n)}return e}function c(e){return Object.keys(e).some(function(t){var r=e[t];if(!r)return!1;switch(r.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}})}function i(e){var t={};return Object.keys(e).forEach(function(r){var o=e[r];if(o||0===o||"boolean"==typeof o||"string"==typeof o){var n;switch(o.constructor.name){case"Array":n=o[0]&&o[0].constructor&&"Object"===o[0].constructor.name?JSON.stringify(o):o.join(",");break;case"Object":n=JSON.stringify(o);break;case"Date":n=o.valueOf();break;case"Function":n=null;break;case"Boolean":n=o+"";break;default:n=o}(n||0===n||"string"==typeof n)&&(t[r]=n)}}),t}function u(e,t){return encodeURIComponent(e)+"="+encodeURIComponent(t)}function f(e){var t=i(e);return Object.keys(t).map(function(e){return u(e,t[e])}).join("&")}function h(e){var t=c(e),r=i(e);if(t){var o=new FormData;return Object.keys(r).forEach(function(e){"undefined"!=typeof Blob&&r[e]instanceof Blob?o.append(e,r[e],r[e].name||e):o.append(e,r[e])}),o}return f(e)}function p(e,t){void 0===t&&(t={params:{f:"json"}});var n=r({httpMethod:"POST"},t),a=[],i=[];if(n.fetch||"undefined"==typeof fetch?(a.push("`fetch`"),i.push("`isomorphic-fetch`")):n.fetch=fetch.bind(Function("return this")()),Promise||(a.push("`Promise`"),i.push("`es6-promise`")),FormData||(a.push("`FormData`"),i.push("`isomorphic-form-data`")),!n.fetch||!Promise||!FormData)throw new Error("`arcgis-rest-request` requires global variables for `fetch`, `Promise` and `FormData` to be present in the global scope. You are missing "+a.join(", ")+". We recommend installing the "+i.join(", ")+" modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info.");var u=n.httpMethod,p=n.authentication,l=r({f:"json"},t.params),m={method:u,credentials:"same-origin"};return(p?p.getToken(e,{fetch:n.fetch}):Promise.resolve("")).then(function(t){if(t.length&&(l.token=t),"GET"===m.method){var r=""===f(l)?e:e+"?"+f(l);n.maxUrlLength&&r.length>n.maxUrlLength?m.method="POST":e=r}return"POST"===m.method&&(m.body=h(l)),c(l)||(m.headers={},m.headers["Content-Type"]="application/x-www-form-urlencoded"),n.fetch(e,m)}).then(function(t){if(!t.ok){var r=t.status,a=t.statusText;throw new o(a,"HTTP "+r,t,e,n)}switch(l.f){case"json":case"geojson":return t.json();case"html":case"text":return t.text();case"image":case"zip":default:return t.blob()}}).then(function(t){return"json"===l.f||"geojson"===l.f?s(t,e,0,n):t})}function l(e){return void 0===e&&(e={}),e.portal?e.portal:e.authentication?e.authentication.portal:"https://www.arcgis.com/sharing/rest"}function m(e,t){var o=e||"self";return p(l(t)+"/portals/"+o,r({httpMethod:"GET"},t))}(n=e.ErrorTypes||(e.ErrorTypes={})).ArcGISRequestError="ArcGISRequestError",n.ArcGISAuthError="ArcGISAuthError",e.request=p,e.encodeFormData=h,e.encodeParam=u,e.encodeQueryString=f,e.checkForErrors=s,e.warn=function(e){console&&console.warn&&console.warn.apply(console,[e])},e.ArcGISRequestError=o,e.ArcGISAuthError=a,e.requiresFormData=c,e.processParams=i,e.getSelf=function(e){return m(null,e)},e.getPortal=m,e.getPortalUrl=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.arcgisRest=e.arcgisRest||{})}(this,function(e){"use strict";var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};var r=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},o=function(){return function(e,t,r,o,n){e=e||"UNKNOWN_ERROR",t=t||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===t?e:t+": "+e,this.originalMessage=e,this.code=t,this.response=r,this.url=o,this.options=n}}();o.prototype=Object.create(Error.prototype),o.prototype.constructor=o;var n,a=function(e){function o(t,r,o,n,a){void 0===t&&(t="AUTHENTICATION_ERROR"),void 0===r&&(r="AUTHENTICATION_ERROR_CODE");var s=e.call(this,t,r,o,n,a)||this;return s.name="ArcGISAuthError",s.message="AUTHENTICATION_ERROR_CODE"===r?t:r+": "+t,s}return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}(o,e),o.prototype.retry=function(e,t){var o=this;void 0===t&&(t=3);var n=0,a=function(s,c){e(o.url,o.options).then(function(e){var t=r({},o.options,{authentication:e});return n+=1,p(o.url,t)}).then(function(e){s(e)}).catch(function(e){"ArcGISAuthError"===e.name&&n<t?a(s,c):"ArcGISAuthError"===e.name&&n>=t?c(o):c(e)})};return new Promise(function(e,t){a(e,t)})},o}(o);function s(e,t,r,n){if(e.code>=400){var s=e.message,c=e.code;throw new o(s,c,e,t,n)}if(e.error){var i=e.error,u=(s=i.message,c=i.code,i.messageCode),f=u||c||"UNKNOWN_ERROR_CODE";if(498===c||499===c||"GWM_0003"===u)throw new a(s,f,e,t,n);throw new o(s,f,e,t,n)}if("failed"===e.status||"failure"===e.status){s=void 0,c="UNKNOWN_ERROR_CODE";try{s=JSON.parse(e.statusMessage).message,c=JSON.parse(e.statusMessage).code}catch(t){s=e.statusMessage||e.message}throw new o(s,c,e,t,n)}return e}function c(e){return Object.keys(e).some(function(t){var r=e[t];if(!r)return!1;switch(r.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}})}function i(e){var t={};return Object.keys(e).forEach(function(r){var o=e[r];if(o||0===o||"boolean"==typeof o||"string"==typeof o){var n;switch(o.constructor.name){case"Array":n=o[0]&&o[0].constructor&&"Object"===o[0].constructor.name?JSON.stringify(o):o.join(",");break;case"Object":n=JSON.stringify(o);break;case"Date":n=o.valueOf();break;case"Function":n=null;break;case"Boolean":n=o+"";break;default:n=o}(n||0===n||"string"==typeof n)&&(t[r]=n)}}),t}function u(e,t){return encodeURIComponent(e)+"="+encodeURIComponent(t)}function f(e){var t=i(e);return Object.keys(t).map(function(e){return u(e,t[e])}).join("&")}function h(e){var t=c(e),r=i(e);if(t){var o=new FormData;return Object.keys(r).forEach(function(e){if("undefined"!=typeof Blob&&r[e]instanceof Blob){var t=r.fileName||r[e].name||e;o.append(e,r[e],t)}else o.append(e,r[e])}),o}return f(e)}function p(e,t){void 0===t&&(t={params:{f:"json"}});var n=r({httpMethod:"POST"},t),a=[],i=[];if(n.fetch||"undefined"==typeof fetch?(a.push("`fetch`"),i.push("`isomorphic-fetch`")):n.fetch=fetch.bind(Function("return this")()),"undefined"==typeof Promise&&(a.push("`Promise`"),i.push("`es6-promise`")),"undefined"==typeof FormData&&(a.push("`FormData`"),i.push("`isomorphic-form-data`")),!n.fetch||"undefined"==typeof Promise||"undefined"==typeof FormData)throw new Error("`arcgis-rest-request` requires global variables for `fetch`, `Promise` and `FormData` to be present in the global scope. You are missing "+a.join(", ")+". We recommend installing the "+i.join(", ")+" modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info.");var u=n.httpMethod,p=n.authentication,l=r({f:"json"},t.params),d={method:u,credentials:"same-origin"};return(p?p.getToken(e,{fetch:n.fetch}):Promise.resolve("")).then(function(t){if(t.length&&(l.token=t),"GET"===d.method){var r=""===f(l)?e:e+"?"+f(l);n.maxUrlLength&&r.length>n.maxUrlLength?d.method="POST":e=r}return"POST"===d.method&&(d.body=h(l)),c(l)||(d.headers={},d.headers["Content-Type"]="application/x-www-form-urlencoded"),n.fetch(e,d)}).then(function(t){if(!t.ok){var r=t.status,a=t.statusText;throw new o(a,"HTTP "+r,t,e,n)}switch(l.f){case"json":case"geojson":return t.json();case"html":case"text":return t.text();case"image":case"zip":default:return t.blob()}}).then(function(t){return"json"===l.f||"geojson"===l.f?s(t,e,0,n):t})}function l(e){return void 0===e&&(e={}),e.portal?e.portal:e.authentication?e.authentication.portal:"https://www.arcgis.com/sharing/rest"}function d(e,t){var o=e||"self";return p(l(t)+"/portals/"+o,r({httpMethod:"GET"},t))}(n=e.ErrorTypes||(e.ErrorTypes={})).ArcGISRequestError="ArcGISRequestError",n.ArcGISAuthError="ArcGISAuthError",e.request=p,e.encodeFormData=h,e.encodeParam=u,e.encodeQueryString=f,e.checkForErrors=s,e.warn=function(e){console&&console.warn&&console.warn.apply(console,[e])},e.ArcGISRequestError=o,e.ArcGISAuthError=a,e.requiresFormData=c,e.processParams=i,e.getSelf=function(e){return d(null,e)},e.getPortal=d,e.getPortalUrl=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=request.umd.min.js.map |
{ | ||
"name": "@esri/arcgis-rest-request", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"description": "Common methods and utilities for @esri/arcgis-rest-* packages.", | ||
@@ -5,0 +5,0 @@ "main": "dist/node/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
17
256580
65
2481