@agility/content-fetch 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("agility",[],t):"object"==typeof exports?exports.agility=t():e.agility=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=26)}([function(e,t,r){"use strict";function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function n(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){console.error("%s",e)}function i(e){console.log("%s",e)}function c(e,t){var r=null;return r=!0===e.isPreview||"true"===e.isPreview?"preview":"fetch","".concat(e.baseUrl,"/").concat(r,"/").concat(t)}function a(e,t,r,o,n,s,u,i,c,a){var l="/".concat(e,"/").concat(t,"?contentLinkDepth=").concat(c,"&");if(i=i?" ".concat(i," "):" AND ",n&&(l+="sort=".concat(n,"&"),s&&(l+="direction=".concat(s,"&"))),r&&(l+="skip=".concat(r,"&")),o&&(l+="take=".concat(o,"&")),u&&u.length>0){l+="filter=";for(var d=0;d<u.length;d++){var f=u[d];l+="".concat(f.property,"[").concat(f.operator,"]").concat(f.value)+(d<u.length-1?i:"")}l+="&"}return a&&(l+="expandAllContentLinks=".concat(a,"&")),l}function l(e){var t={APIKey:e.apiKey};return e.requiresGuidInHeaders&&(t.Guid=e.guid),n(n({},t),e.headers)}function d(e){return!!e.toLowerCase().startsWith("https://")}r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return l})),r.d(t,"c",(function(){return c})),r.d(t,"d",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"e",(function(){return i}))},function(e,t,r){"use strict";var o=r(4),n=Object.prototype.toString;function s(e){return"[object Array]"===n.call(e)}function u(e){return void 0===e}function i(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==n.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function a(e){return"[object Function]"===n.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===n.call(e)},isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:i,isPlainObject:c,isUndefined:u,isDate:function(e){return"[object Date]"===n.call(e)},isFile:function(e){return"[object File]"===n.call(e)},isBlob:function(e){return"[object Blob]"===n.call(e)},isFunction:a,isStream:function(e){return i(e)&&a(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:l,merge:function e(){var t={};function r(r,o){c(t[o])&&c(r)?t[o]=e(t[o],r):c(r)?t[o]=e({},r):s(r)?t[o]=r.slice():t[o]=r}for(var o=0,n=arguments.length;o<n;o++)l(arguments[o],r);return t},extend:function(e,t,r){return l(t,(function(t,n){e[n]=r&&"function"==typeof t?o(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t,r){e.exports=r(27)},function(e,t){var r,o,n=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function i(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(e){o=u}}();var c,a=[],l=!1,d=-1;function f(){l&&c&&(l=!1,c.length?a=c.concat(a):d=-1,a.length&&m())}function m(){if(!l){var e=i(f);l=!0;for(var t=a.length;t;){for(c=a,a=[];++d<t;)c&&c[d].run();d=-1,t=a.length}c=null,l=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function j(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new p(e,t)),1!==a.length||l||i(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=j,n.addListener=j,n.once=j,n.off=j,n.removeListener=j,n.removeAllListeners=j,n.emit=j,n.prependListener=j,n.prependOnceListener=j,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),o=0;o<r.length;o++)r[o]=arguments[o];return e.apply(t,r)}}},function(e,t,r){"use strict";var o=r(1);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(o.isURLSearchParams(t))s=t.toString();else{var u=[];o.forEach(t,(function(e,t){null!=e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,(function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),u.push(n(t)+"="+n(e))})))})),s=u.join("&")}if(s){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";(function(t){var o=r(1),n=r(32),s={"Content-Type":"application/x-www-form-urlencoded"};function u(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var i,c={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(i=r(8)),i),transformRequest:[function(e,t){return n(t,"Accept"),n(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(u(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)?(u(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){c.headers[e]=o.merge(s)})),e.exports=c}).call(this,r(3))},function(e,t,r){"use strict";var o=r(1),n=r(33),s=r(35),u=r(5),i=r(36),c=r(39),a=r(40),l=r(9);e.exports=function(e){return new Promise((function(t,r){var d=e.data,f=e.headers;o.isFormData(d)&&delete f["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",j=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(p+":"+j)}var h=i(e.baseURL,e.url);if(m.open(e.method.toUpperCase(),u(h,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,m.onreadystatechange=function(){if(m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))){var o="getAllResponseHeaders"in m?c(m.getAllResponseHeaders()):null,s={data:e.responseType&&"text"!==e.responseType?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:o,config:e,request:m};n(t,r,s),m=null}},m.onabort=function(){m&&(r(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){r(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,"ECONNABORTED",m)),m=null},o.isStandardBrowserEnv()){var y=(e.withCredentials||a(h))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;y&&(f[e.xsrfHeaderName]=y)}if("setRequestHeader"in m&&o.forEach(f,(function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete f[t]:m.setRequestHeader(t,e)})),o.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),e.responseType)try{m.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){m&&(m.abort(),r(e),m=null)})),d||(d=null),m.send(d)}))}},function(e,t,r){"use strict";var o=r(34);e.exports=function(e,t,r,n,s){var u=new Error(e);return o(u,t,r,n,s)}},function(e,t,r){"use strict";var o=r(1);e.exports=function(e,t){t=t||{};var r={},n=["url","method","data"],s=["headers","auth","proxy","params"],u=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function c(e,t){return o.isPlainObject(e)&&o.isPlainObject(t)?o.merge(e,t):o.isPlainObject(t)?o.merge({},t):o.isArray(t)?t.slice():t}function a(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(e[n],t[n])}o.forEach(n,(function(e){o.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),o.forEach(s,a),o.forEach(u,(function(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(void 0,t[n])})),o.forEach(i,(function(o){o in t?r[o]=c(e[o],t[o]):o in e&&(r[o]=c(void 0,e[o]))}));var l=n.concat(s).concat(u).concat(i),d=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return o.forEach(d,a),r}},function(e,t,r){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return k}));var o=r(2),n=r.n(o),s=r(13),u=r(14),i=r(15),c=r(16),a=r(17),l=r(18),d=r(19),f=r(20),m=r(21),p=r(22),j=r(23),h=r(24),y=r(25),g=r(0);function _(e,t,r,o,n,s,u){try{var i=e[s](u),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(o,n)}function b(e){return function(){var t=this,r=arguments;return new Promise((function(o,n){var s=e.apply(t,r);function u(e){_(s,o,n,u,i,"next",e)}function i(e){_(s,o,n,u,i,"throw",e)}u(void 0)}))}}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O={baseUrl:null,isPreview:!1,guid:null,apiKey:null,locale:null,headers:{},requiresGuidInHeaders:!1,debug:!1,caching:{maxAge:0}};function k(t){var r,o,_,v,w=function(){var t={};if(e&&e.env){var r=e.env;r.hasOwnProperty("AGILITY_BASEURL")&&(t.baseUrl=r.AGILITY_BASEURL),r.hasOwnProperty("AGILITY_GUID")&&(t.guid=r.AGILITY_GUID),r.hasOwnProperty("AGILITY_APIKEY")&&(t.apiKey=r.AGILITY_APIKEY),r.hasOwnProperty("AGILITY_ISPREVIEW")&&(t.isPreview=r.AGILITY_ISPREVIEW)}return t}(),k=x(x(x({},O),w),t);k.baseUrl?k.requiresGuidInHeaders=!0:k.baseUrl=(r=k.guid,o={u:"",c:"-ca",e:"-eu",d:"-dev"},_=r.substr(r.length-2,2),v=_.substr(1),_.startsWith("-")&&o.hasOwnProperty(v)?"https://api".concat(o[v],".aglty.io/").concat(r):"https://".concat(r,"-api.agilitycms.cloud"));var S=null;k.caching.maxAge>0&&(S=Object(s.setupCache)({maxAge:k.caching.maxAge,exclude:{query:!1}}).adapter);var E=null;return E=n.a.create({adapter:S}),{config:k,makeRequest:function(e){return k.debug&&Object(g.e)("AgilityCMS Fetch API LOG: ".concat(e.baseURL).concat(e.url)),E(e).then(function(){var e=b(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.data,t.request.fromCache&&(r.fromCache=!0),k.debug&&(r.agilityResponseHeaders=t.headers),e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch(function(){var t=b(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:Object(g.f)("AgilityCMS Fetch API ERROR: Request failed for ".concat(e.baseURL).concat(e.url," ... ").concat(r," ... Does the item exist?"));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},getSitemapFlat:u.a,getSitemapNested:i.a,getContentItem:c.a,getContentList:a.a,getPage:l.a,getGallery:d.a,getSyncContent:m.a,getSyncPages:p.a,getUrlRedirections:f.a,types:{FilterOperators:j.a,FilterLogicOperators:h.a,SortDirections:y.a}}}}).call(this,r(3))},function(e,t,r){var o;window,o=function(e){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="./src/index.js")}({"./node_modules/cache-control-esm/index.js":
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("agility",[],t):"object"==typeof exports?exports.agility=t():e.agility=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=26)}([function(e,t,r){"use strict";function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function n(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){console.error("%s",e)}function i(e){console.log("%s",e)}function c(e,t){var r=null;return r=!0===e.isPreview||"true"===e.isPreview?"preview":"fetch","".concat(e.baseUrl,"/").concat(r,"/").concat(t)}function a(e,t,r,o,n,s,u,i,c,a){var l="/".concat(e,"/").concat(t,"?contentLinkDepth=").concat(c,"&");if(i=i?" ".concat(i," "):" AND ",n&&(l+="sort=".concat(n,"&"),s&&(l+="direction=".concat(s,"&"))),r&&(l+="skip=".concat(r,"&")),o&&(l+="take=".concat(o,"&")),u&&u.length>0){l+="filter=";for(var d=0;d<u.length;d++){var f=u[d];l+="".concat(f.property,"[").concat(f.operator,"]").concat(f.value)+(d<u.length-1?i:"")}l+="&"}return a&&(l+="expandAllContentLinks=".concat(a,"&")),l}function l(e){var t={APIKey:e.apiKey};return e.requiresGuidInHeaders&&(t.Guid=e.guid),n(n({},t),e.headers)}function d(e){return!!e.toLowerCase().startsWith("https://")}r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return l})),r.d(t,"c",(function(){return c})),r.d(t,"d",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"e",(function(){return i}))},function(e,t,r){"use strict";var o=r(4),n=Object.prototype.toString;function s(e){return"[object Array]"===n.call(e)}function u(e){return void 0===e}function i(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==n.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function a(e){return"[object Function]"===n.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===n.call(e)},isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:i,isPlainObject:c,isUndefined:u,isDate:function(e){return"[object Date]"===n.call(e)},isFile:function(e){return"[object File]"===n.call(e)},isBlob:function(e){return"[object Blob]"===n.call(e)},isFunction:a,isStream:function(e){return i(e)&&a(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:l,merge:function e(){var t={};function r(r,o){c(t[o])&&c(r)?t[o]=e(t[o],r):c(r)?t[o]=e({},r):s(r)?t[o]=r.slice():t[o]=r}for(var o=0,n=arguments.length;o<n;o++)l(arguments[o],r);return t},extend:function(e,t,r){return l(t,(function(t,n){e[n]=r&&"function"==typeof t?o(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},function(e,t,r){e.exports=r(27)},function(e,t){var r,o,n=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function i(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(e){o=u}}();var c,a=[],l=!1,d=-1;function f(){l&&c&&(l=!1,c.length?a=c.concat(a):d=-1,a.length&&m())}function m(){if(!l){var e=i(f);l=!0;for(var t=a.length;t;){for(c=a,a=[];++d<t;)c&&c[d].run();d=-1,t=a.length}c=null,l=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function j(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new p(e,t)),1!==a.length||l||i(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=j,n.addListener=j,n.once=j,n.off=j,n.removeListener=j,n.removeAllListeners=j,n.emit=j,n.prependListener=j,n.prependOnceListener=j,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),o=0;o<r.length;o++)r[o]=arguments[o];return e.apply(t,r)}}},function(e,t,r){"use strict";var o=r(1);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(o.isURLSearchParams(t))s=t.toString();else{var u=[];o.forEach(t,(function(e,t){null!=e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,(function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),u.push(n(t)+"="+n(e))})))})),s=u.join("&")}if(s){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";(function(t){var o=r(1),n=r(32),s={"Content-Type":"application/x-www-form-urlencoded"};function u(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var i,c={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(i=r(8)),i),transformRequest:[function(e,t){return n(t,"Accept"),n(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(u(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)?(u(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};c.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){c.headers[e]=o.merge(s)})),e.exports=c}).call(this,r(3))},function(e,t,r){"use strict";var o=r(1),n=r(33),s=r(35),u=r(5),i=r(36),c=r(39),a=r(40),l=r(9);e.exports=function(e){return new Promise((function(t,r){var d=e.data,f=e.headers;o.isFormData(d)&&delete f["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",j=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(p+":"+j)}var h=i(e.baseURL,e.url);if(m.open(e.method.toUpperCase(),u(h,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,m.onreadystatechange=function(){if(m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))){var o="getAllResponseHeaders"in m?c(m.getAllResponseHeaders()):null,s={data:e.responseType&&"text"!==e.responseType?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:o,config:e,request:m};n(t,r,s),m=null}},m.onabort=function(){m&&(r(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){r(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,"ECONNABORTED",m)),m=null},o.isStandardBrowserEnv()){var y=(e.withCredentials||a(h))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;y&&(f[e.xsrfHeaderName]=y)}if("setRequestHeader"in m&&o.forEach(f,(function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete f[t]:m.setRequestHeader(t,e)})),o.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),e.responseType)try{m.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){m&&(m.abort(),r(e),m=null)})),d||(d=null),m.send(d)}))}},function(e,t,r){"use strict";var o=r(34);e.exports=function(e,t,r,n,s){var u=new Error(e);return o(u,t,r,n,s)}},function(e,t,r){"use strict";var o=r(1);e.exports=function(e,t){t=t||{};var r={},n=["url","method","data"],s=["headers","auth","proxy","params"],u=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function c(e,t){return o.isPlainObject(e)&&o.isPlainObject(t)?o.merge(e,t):o.isPlainObject(t)?o.merge({},t):o.isArray(t)?t.slice():t}function a(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(e[n],t[n])}o.forEach(n,(function(e){o.isUndefined(t[e])||(r[e]=c(void 0,t[e]))})),o.forEach(s,a),o.forEach(u,(function(n){o.isUndefined(t[n])?o.isUndefined(e[n])||(r[n]=c(void 0,e[n])):r[n]=c(void 0,t[n])})),o.forEach(i,(function(o){o in t?r[o]=c(e[o],t[o]):o in e&&(r[o]=c(void 0,e[o]))}));var l=n.concat(s).concat(u).concat(i),d=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return o.forEach(d,a),r}},function(e,t,r){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,e.exports=o},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return k}));var o=r(2),n=r.n(o),s=r(13),u=r(14),i=r(15),c=r(16),a=r(17),l=r(18),d=r(19),f=r(20),m=r(21),p=r(22),j=r(23),h=r(24),y=r(25),g=r(0);function _(e,t,r,o,n,s,u){try{var i=e[s](u),c=i.value}catch(e){return void r(e)}i.done?t(c):Promise.resolve(c).then(o,n)}function b(e){return function(){var t=this,r=arguments;return new Promise((function(o,n){var s=e.apply(t,r);function u(e){_(s,o,n,u,i,"next",e)}function i(e){_(s,o,n,u,i,"throw",e)}u(void 0)}))}}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O={baseUrl:null,isPreview:!1,guid:null,apiKey:null,locale:null,headers:{},requiresGuidInHeaders:!1,debug:!1,caching:{maxAge:0}};function k(t){var r,o,_,v,w=function(){var t={};if(e&&e.env){var r=e.env;r.hasOwnProperty("AGILITY_BASEURL")&&(t.baseUrl=r.AGILITY_BASEURL),r.hasOwnProperty("AGILITY_GUID")&&(t.guid=r.AGILITY_GUID),r.hasOwnProperty("AGILITY_APIKEY")&&(t.apiKey=r.AGILITY_APIKEY),r.hasOwnProperty("AGILITY_ISPREVIEW")&&(t.isPreview=r.AGILITY_ISPREVIEW)}return t}(),k=x(x(x({},O),w),t);k.baseUrl?k.requiresGuidInHeaders=!0:k.baseUrl=(r=k.guid,o={u:"",c:"-ca",e:"-eu",a:"-aus",d:"-dev"},_=r.substr(r.length-2,2),v=_.substr(1),_.startsWith("-")&&o.hasOwnProperty(v)?"https://api".concat(o[v],".aglty.io/").concat(r):"https://".concat(r,"-api.agilitycms.cloud"));var S=null;k.caching.maxAge>0&&(S=Object(s.setupCache)({maxAge:k.caching.maxAge,exclude:{query:!1}}).adapter);var E=null;return E=n.a.create({adapter:S}),{config:k,makeRequest:function(e){return k.debug&&Object(g.e)("AgilityCMS Fetch API LOG: ".concat(e.baseURL).concat(e.url)),E(e).then(function(){var e=b(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.data,t.request.fromCache&&(r.fromCache=!0),k.debug&&(r.agilityResponseHeaders=t.headers),e.abrupt("return",r);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch(function(){var t=b(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:Object(g.f)("AgilityCMS Fetch API ERROR: Request failed for ".concat(e.baseURL).concat(e.url," ... ").concat(r," ... Does the item exist?"));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},getSitemapFlat:u.a,getSitemapNested:i.a,getContentItem:c.a,getContentList:a.a,getPage:l.a,getGallery:d.a,getSyncContent:m.a,getSyncPages:p.a,getUrlRedirections:f.a,types:{FilterOperators:j.a,FilterLogicOperators:h.a,SortDirections:y.a}}}}).call(this,r(3))},function(e,t,r){var o;window,o=function(e){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="./src/index.js")}({"./node_modules/cache-control-esm/index.js":
2
2
  /*!*************************************************!*\
3
3
  !*** ./node_modules/cache-control-esm/index.js ***!
4
4
  \*************************************************/
@@ -10780,6 +10780,7 @@ function buildBaseUrl(guid) {
10780
10780
  u: '',
10781
10781
  c: '-ca',
10782
10782
  e: '-eu',
10783
+ a: '-aus',
10783
10784
  d: '-dev' };
10784
10785
 
10785
10786
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/content-fetch",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "JavaScript library for the Agility Fetch API (node and browser)",
5
5
  "main": "dist/agility-content-fetch.node.js",
6
6
  "scripts": {
package/src/api-client.js CHANGED
@@ -58,6 +58,7 @@ function buildBaseUrl(guid) {
58
58
  u: '',
59
59
  c: '-ca',
60
60
  e: '-eu',
61
+ a: '-aus',
61
62
  d: '-dev'
62
63
  }
63
64