@kentico/kontent-core
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -1,2 +0,2 @@ | ||
import { IBaseResponseError, IHttpQueryOptions, IRetryStrategyOptions } from './http.models'; | ||
import { IHttpQueryOptions, IRetryStrategyOptions } from './http.models'; | ||
export declare class RetryService { | ||
@@ -15,4 +15,5 @@ private readonly retryAfterHeaderName; | ||
canRetryStatusCode(statusCode: number, useRetryForResponseCodes: number[]): boolean; | ||
getStatusCodeFromError(error: IBaseResponseError<any>): number; | ||
tryGetRetryAfterInMsFromError(error: IBaseResponseError<any>): number | undefined; | ||
getStatusCodeFromError(error: any): number; | ||
tryGetRetryAfterInMsFromError(error: any): number | undefined; | ||
private tryGetAxiosError; | ||
private getBoolOrDefault; | ||
@@ -19,0 +20,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("kontentCore",["rxjs","rxjs/operators"],t):"object"==typeof exports?exports.kontentCore=t(require("rxjs"),require("rxjs/operators")):e.kontentCore=t(e.rxjs,e.rxjs.operators)}(window,(function(e,t){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},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=18)}([function(e,t,r){"use strict";var n=r(7),o=r(29),s=Object.prototype.toString;function i(e){return"[object Array]"===s.call(e)}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===s.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===s.call(e)},isBuffer:o,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:a,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(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:c,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,o=arguments.length;n<o;n++)c(arguments[n],r);return t},deepMerge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]="object"==typeof r?e({},r):r}for(var n=0,o=arguments.length;n<o;n++)c(arguments[n],r);return t},extend:function(e,t,r){return c(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),o=function(){function e(){this.retryAfterHeaderName="Retry-After",this.defaultRetryPolicy={addJitter:!0,useRetryForResponseCodes:[408,429,500,502,503,504],deltaBackoffMs:1e3,maxCumulativeWaitTimeMs:3e4}}return e.prototype.getRetryStrategyFromStrategyOptions=function(e){return e?{addJitter:this.getBoolOrDefault(e.addJitter,this.defaultRetryPolicy.addJitter),deltaBackoffMs:e.deltaBackoffMs?e.deltaBackoffMs:this.defaultRetryPolicy.deltaBackoffMs,maxCumulativeWaitTimeMs:e.maxCumulativeWaitTimeMs?e.maxCumulativeWaitTimeMs:this.defaultRetryPolicy.maxCumulativeWaitTimeMs,useRetryForResponseCodes:e.useRetryForResponseCodes?e.useRetryForResponseCodes:this.defaultRetryPolicy.useRetryForResponseCodes}:this.defaultRetryPolicy},e.prototype.getRetryStrategyFromHttpQueryOptions=function(e){return e?{addJitter:this.getBoolOrDefault(e.addJitterToRetryAttempts,this.defaultRetryPolicy.addJitter),deltaBackoffMs:e.deltaBackoffMs?e.deltaBackoffMs:this.defaultRetryPolicy.deltaBackoffMs,maxCumulativeWaitTimeMs:e.maxCumulativeWaitTimeMs?e.maxCumulativeWaitTimeMs:this.defaultRetryPolicy.maxCumulativeWaitTimeMs,useRetryForResponseCodes:e.useRetryForResponseCodes?e.useRetryForResponseCodes:this.defaultRetryPolicy.useRetryForResponseCodes}:this.defaultRetryPolicy},e.prototype.canRetry=function(e,t){var r=e.getTime();return(new Date).getTime()-r<t},e.prototype.debugLogAttempt=function(e,t){console.warn("Attempt "+e+": retrying in "+t+"ms")},e.prototype.getNextWaitTimeMs=function(e,t,r,n){if(n)return n;if(!e)return t*Math.pow(2,r);var o=.8*t,s=1.2*t*Math.pow(2,r);return this.randomNumberFromInterval(o,s)},e.prototype.canRetryStatusCode=function(e,t){return t.includes(e)},e.prototype.getStatusCodeFromError=function(e){var t=e.originalError;if(!t||!t.isAxiosError)return 0;var r=t;return r.response?r.response.status:0},e.prototype.tryGetRetryAfterInMsFromError=function(e){var t=this,r=e.originalError;if(r&&r.isAxiosError){var o=r;if(o.response&&o.response.headers){var s=n.extractHeadersFromAxiosResponse(o.response).find((function(e){return e.header.toLowerCase()===t.retryAfterHeaderName.toLowerCase()}));if(s){var i=s.value;return isNaN(+i)?new Date(i).getTime()-(new Date).getTime():1e3*+i}}}},e.prototype.getBoolOrDefault=function(e,t){return void 0===e?t:e},e.prototype.randomNumberFromInterval=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},e}();t.RetryService=o,t.retryService=new o},function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(4),s=r(1),i=function(){this.strategy=function(e,t){return function(r){return r.pipe(o.mergeMap((function(r,o){var i=o+1,a=s.retryService.getStatusCodeFromError(r),u=s.retryService.tryGetRetryAfterInMsFromError(r);if(!s.retryService.canRetryStatusCode(a,e.useRetryForResponseCodes))return n.throwError(r);if(!s.retryService.canRetry(t.startTime,e.maxCumulativeWaitTimeMs))return n.throwError(r);var c=s.retryService.getNextWaitTimeMs(e.addJitter,e.deltaBackoffMs,i,u);return s.retryService.debugLogAttempt(i,c),n.timer(c)})))}}};t.ObservableRetryStrategy=i,t.observableRetryStrategy=new i},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractHeadersFromAxiosResponse=function(e){for(var t=[],r=0,n=Object.keys(e.headers);r<n.length;r++){var o=n[r];t.push({header:o,value:e.headers[o]})}return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(){}return e.prototype.getPromiseWithRetryStrategy=function(e,t,r){var o=this;return new Promise((function(s,i){return e.then((function(e){s(e)})).catch((function(a){try{r.retryAttempt++;var u=r.retryAttempt,c=n.retryService.getStatusCodeFromError(a),f=n.retryService.tryGetRetryAfterInMsFromError(a);if(!n.retryService.canRetryStatusCode(c,t.useRetryForResponseCodes))return i(a);if(!n.retryService.canRetry(r.startTime,t.maxCumulativeWaitTimeMs))return i(a);var p=n.retryService.getNextWaitTimeMs(t.addJitter,t.deltaBackoffMs,u,f);return n.retryService.debugLogAttempt(u,p),o.promiseRetryWait(p).then((function(){return o.getPromiseWithRetryStrategy(e,t,{retryAttempt:u,startTime:r.startTime})})).then((function(e){return s(e)})).catch((function(e){return i(e)}))}catch(e){i(e)}}))}))},e.prototype.promiseRetryWait=function(e){return new Promise((function(t){return setTimeout(t,e)}))},e}();t.PromiseRetryStrategy=o,t.promiseRetryStrategy=new o},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t,r){"use strict";var n=r(0);function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").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(n.isURLSearchParams(t))s=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(o(t)+"="+o(e))})))})),s=i.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),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 n=r(0),o=r(35),s={"Content-Type":"application/x-www-form-urlencoded"};function i(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,u={adapter:(void 0!==t&&"[object process]"===Object.prototype.toString.call(t)?a=r(11):"undefined"!=typeof XMLHttpRequest&&(a=r(11)),a),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(i(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(i(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,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(s)})),e.exports=u}).call(this,r(34))},function(e,t,r){"use strict";var n=r(0),o=r(36),s=r(8),i=r(38),a=r(39),u=r(12);e.exports=function(e){return new Promise((function(t,c){var f=e.data,p=e.headers;n.isFormData(f)&&delete p["Content-Type"];var d=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",h=e.auth.password||"";p.Authorization="Basic "+btoa(l+":"+h)}if(d.open(e.method.toUpperCase(),s(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in d?i(d.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:r,config:e,request:d};o(t,c,n),d=null}},d.onabort=function(){d&&(c(u("Request aborted",e,"ECONNABORTED",d)),d=null)},d.onerror=function(){c(u("Network Error",e,null,d)),d=null},d.ontimeout=function(){c(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",d)),d=null},n.isStandardBrowserEnv()){var y=r(40),m=(e.withCredentials||a(e.url))&&e.xsrfCookieName?y.read(e.xsrfCookieName):void 0;m&&(p[e.xsrfHeaderName]=m)}if("setRequestHeader"in d&&n.forEach(p,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete p[t]:d.setRequestHeader(t,e)})),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){d&&(d.abort(),c(e),d=null)})),void 0===f&&(f=null),d.send(f)}))}},function(e,t,r){"use strict";var n=r(37);e.exports=function(e,t,r,o,s){var i=new Error(e);return n(i,t,r,o,s)}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t){t=t||{};var r={};return n.forEach(["url","method","params","data"],(function(e){void 0!==t[e]&&(r[e]=t[e])})),n.forEach(["headers","auth","proxy"],(function(o){n.isObject(t[o])?r[o]=n.deepMerge(e[o],t[o]):void 0!==t[o]?r[o]=t[o]:n.isObject(e[o])?r[o]=n.deepMerge(e[o]):void 0!==e[o]&&(r[o]=e[o])})),n.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(16);function o(e,t){var r={};(e.forEach((function(e){r[e.header]=e.value})),t)&&(e.find((function(e){return e.header.toLowerCase()==="Content-Type".toLowerCase()}))||(r["Content-Type"]="application/json"));return r}t.registerResponseInterceptor=function(e,t){e.interceptors.response.use((function(e){return t(e)}),(function(e){return Promise.reject(e)}))},t.registerRequestInterceptor=function(e,t){e.interceptors.request.use((function(e){return t(e)}),(function(e){return Promise.reject(e)}))},t.getCallback=function(e,t,r,s){n.httpDebugger.debugStartHttpRequest(),e.get(t.url,{headers:o(r&&r.headers?r.headers:[],!1),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){n.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){n.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.putCallback=function(e,t,r,s){n.httpDebugger.debugStartHttpRequest(),e.put(t.url,t.body,{headers:o(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){n.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){n.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.patchCallback=function(e,t,r,s){n.httpDebugger.debugStartHttpRequest(),e.patch(t.url,t.body,{headers:o(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){n.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){n.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.deleteCallback=function(e,t,r,s){n.httpDebugger.debugStartHttpRequest(),e.delete(t.url,{headers:o(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){n.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){n.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.postCallback=function(e,t,r,s){n.httpDebugger.debugStartHttpRequest(),e.post(t.url,t.body,{headers:o(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){n.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){n.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.getHeadersJson=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.debugStartHttpRequest=function(){},e.prototype.debugResolveHttpRequest=function(){},e.prototype.debugFailedHttpRequest=function(){},e}();t.HttpDebugger=n,t.httpDebugger=new n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){Object.assign(this,e)};t.BaseKontentError=n},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(19)),n(r(23)),n(r(25)),n(r(47))},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(20)),n(r(21)),n(r(22))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.addOptionsToUrl=function(e,t){return t&&t.forEach((function(t){e=e.indexOf("?")>-1?e+"&"+t.getParam()+"="+t.getParamValue():e+"?"+t.getParam()+"="+t.getParamValue()})),e},e}();t.UrlHelper=n,t.urlHelper=new n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.sdkVersionHeader="X-KC-SDKID"}return e.prototype.getSdkIdHeader=function(e){return{header:this.sdkVersionHeader,value:e.host+";"+e.name+";"+e.version}},e}();t.HeaderHelper=n,t.headerHelper=new n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.getAllNames=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(r);return t},e.prototype.getAllValues=function(e){return Object.keys(e).map((function(t){return e[t]}))},e.prototype.getEnumFromValue=function(e,t){try{if(!t)return;if(this.isNumeric(t))return e[t];var r=this.getAllValues(e).find((function(e){return e.toLowerCase()===t.toString().toLowerCase()}));if(!r)return;return r}catch(e){return}},e.prototype.getEnumFromName=function(e,t){for(var r=0,n=this.getAllNames(e);r<n.length;r++){var o=n[r];if(o.toLowerCase()===t.toLowerCase())return e[o]}},e.prototype.isNumeric=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},e}();t.EnumHelper=n,t.enumHelper=new n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(24))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){var t=function(){function e(e,t){if(this.name=e,this.value=t,!e)throw Error("Name of the custom parameter is not specified")}return e.prototype.getParam=function(){return this.name},e.prototype.getParamValue=function(){return this.value},e}();e.CustomParameter=t}(t.Parameters||(t.Parameters={}))},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(3)),n(r(6)),n(r(26)),n(r(45)),n(r(15)),n(r(16)),n(r(46)),n(r(1))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(27),o=r(2),s=r(4),i=r(5),a=r(15),u=r(3),c=r(6),f=r(1),p=function(){function e(e){this.axiosInstance=n.default.create(e&&e.axiosRequestConfig?e.axiosRequestConfig:void 0),e&&(e.requestInterceptor&&a.registerRequestInterceptor(this.axiosInstance,e.requestInterceptor),e.responseInterceptor&&a.registerResponseInterceptor(this.axiosInstance,e.responseInterceptor))}return e.prototype.retryPromise=function(e,t){return c.promiseRetryStrategy.getPromiseWithRetryStrategy(e,f.retryService.getRetryStrategyFromStrategyOptions(t),{retryAttempt:0,startTime:new Date})},e.prototype.get=function(e,t){var r=o.bindCallback(a.getCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.post=function(e,t){var r=o.bindCallback(a.postCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.put=function(e,t){var r=o.bindCallback(a.putCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.patch=function(e,t){var r=o.bindCallback(a.putCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.delete=function(e,t){var r=o.bindCallback(a.deleteCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.mapAxiosObservable=function(e,t,r,n){var i=this;return t(e,r,n).pipe(s.retryWhen(u.observableRetryStrategy.strategy(f.retryService.getRetryStrategyFromHttpQueryOptions(n),{startTime:new Date})),s.map((function(e){return i.mapResult(e)})),s.catchError((function(e){return n&&n.logErrorToConsole&&console.error("Kentico Kontent Core SDK encountered an error: ",e),o.throwError({originalError:e,mappedError:r.mapError(e)})})))},e.prototype.mapResult=function(e){if(e.error)throw e.error;if(!e.response)throw Error("Response is not set and no error was thrown");return{data:e.response.data,response:e.response,headers:i.extractHeadersFromAxiosResponse(e.response),status:e.response.status}},e}();t.HttpService=p},function(e,t,r){e.exports=r(28)},function(e,t,r){"use strict";var n=r(0),o=r(7),s=r(30),i=r(13);function a(e){var t=new s(e),r=o(s.prototype.request,t);return n.extend(r,s.prototype,t),n.extend(r,t),r}var u=a(r(10));u.Axios=s,u.create=function(e){return a(i(u.defaults,e))},u.Cancel=r(14),u.CancelToken=r(43),u.isCancel=r(9),u.all=function(e){return Promise.all(e)},u.spread=r(44),e.exports=u,e.exports.default=u},function(e,t){ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("kontentCore",["rxjs","rxjs/operators"],t):"object"==typeof exports?exports.kontentCore=t(require("rxjs"),require("rxjs/operators")):e.kontentCore=t(e.rxjs,e.rxjs.operators)}(window,(function(e,t){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=18)}([function(e,t,r){"use strict";var o=r(7),n=r(29),s=Object.prototype.toString;function i(e){return"[object Array]"===s.call(e)}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===s.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(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:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===s.call(e)},isBuffer:n,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:a,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(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:c,merge:function e(){var t={};function r(r,o){"object"==typeof t[o]&&"object"==typeof r?t[o]=e(t[o],r):t[o]=r}for(var o=0,n=arguments.length;o<n;o++)c(arguments[o],r);return t},deepMerge:function e(){var t={};function r(r,o){"object"==typeof t[o]&&"object"==typeof r?t[o]=e(t[o],r):t[o]="object"==typeof r?e({},r):r}for(var o=0,n=arguments.length;o<n;o++)c(arguments[o],r);return t},extend:function(e,t,r){return c(t,(function(t,n){e[n]=r&&"function"==typeof t?o(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),n=function(){function e(){this.retryAfterHeaderName="Retry-After",this.defaultRetryPolicy={addJitter:!0,useRetryForResponseCodes:[408,429,500,502,503,504],deltaBackoffMs:1e3,maxCumulativeWaitTimeMs:3e4}}return e.prototype.getRetryStrategyFromStrategyOptions=function(e){return e?{addJitter:this.getBoolOrDefault(e.addJitter,this.defaultRetryPolicy.addJitter),deltaBackoffMs:e.deltaBackoffMs?e.deltaBackoffMs:this.defaultRetryPolicy.deltaBackoffMs,maxCumulativeWaitTimeMs:e.maxCumulativeWaitTimeMs?e.maxCumulativeWaitTimeMs:this.defaultRetryPolicy.maxCumulativeWaitTimeMs,useRetryForResponseCodes:e.useRetryForResponseCodes?e.useRetryForResponseCodes:this.defaultRetryPolicy.useRetryForResponseCodes}:this.defaultRetryPolicy},e.prototype.getRetryStrategyFromHttpQueryOptions=function(e){return e?{addJitter:this.getBoolOrDefault(e.addJitterToRetryAttempts,this.defaultRetryPolicy.addJitter),deltaBackoffMs:e.deltaBackoffMs?e.deltaBackoffMs:this.defaultRetryPolicy.deltaBackoffMs,maxCumulativeWaitTimeMs:e.maxCumulativeWaitTimeMs?e.maxCumulativeWaitTimeMs:this.defaultRetryPolicy.maxCumulativeWaitTimeMs,useRetryForResponseCodes:e.useRetryForResponseCodes?e.useRetryForResponseCodes:this.defaultRetryPolicy.useRetryForResponseCodes}:this.defaultRetryPolicy},e.prototype.canRetry=function(e,t){var r=e.getTime();return(new Date).getTime()-r<t},e.prototype.debugLogAttempt=function(e,t){console.warn("Attempt "+e+": retrying in "+t+"ms")},e.prototype.getNextWaitTimeMs=function(e,t,r,o){if(o)return o;if(!e)return t*Math.pow(2,r);var n=.8*t,s=1.2*t*Math.pow(2,r);return this.randomNumberFromInterval(n,s)},e.prototype.canRetryStatusCode=function(e,t){return t.includes(e)},e.prototype.getStatusCodeFromError=function(e){var t=this.tryGetAxiosError(e);return t&&t.response?t.response.status:0},e.prototype.tryGetRetryAfterInMsFromError=function(e){var t=this,r=this.tryGetAxiosError(e);if(r&&r.response){var n=o.extractHeadersFromAxiosResponse(r.response).find((function(e){return e.header.toLowerCase()===t.retryAfterHeaderName.toLowerCase()}));if(n){var s=n.value;return isNaN(+s)?new Date(s).getTime()-(new Date).getTime():1e3*+s}}},e.prototype.tryGetAxiosError=function(e){if(console.warn("try get axios",e),e){if(e.isAxiosError)return e;var t=e.originalError;return t&&t.isAxiosError?t:void 0}},e.prototype.getBoolOrDefault=function(e,t){return void 0===e?t:e},e.prototype.randomNumberFromInterval=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},e}();t.RetryService=n,t.retryService=new n},function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),n=r(4),s=r(1),i=function(){this.strategy=function(e,t){return function(r){return console.log("get retry strategy",r),r.pipe(n.mergeMap((function(r,n){console.log("attempt",n);var i=n+1,a=s.retryService.getStatusCodeFromError(r),u=s.retryService.tryGetRetryAfterInMsFromError(r);if(console.log(a,u),!s.retryService.canRetryStatusCode(a,e.useRetryForResponseCodes))return console.log("no retry 1"),o.throwError(r);if(!s.retryService.canRetry(t.startTime,e.maxCumulativeWaitTimeMs))return console.log("no retry 1"),o.throwError(r);var c=s.retryService.getNextWaitTimeMs(e.addJitter,e.deltaBackoffMs,i,u);return s.retryService.debugLogAttempt(i,c),console.log("wait",c),o.timer(c)})))}}};t.ObservableRetryStrategy=i,t.observableRetryStrategy=new i},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractHeadersFromAxiosResponse=function(e){for(var t=[],r=0,o=Object.keys(e.headers);r<o.length;r++){var n=o[r];t.push({header:n,value:e.headers[n]})}return t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),n=function(){function e(){}return e.prototype.getPromiseWithRetryStrategy=function(e,t,r){var n=this;return new Promise((function(s,i){return e.then((function(e){s(e)})).catch((function(a){try{r.retryAttempt++;var u=r.retryAttempt,c=o.retryService.getStatusCodeFromError(a),f=o.retryService.tryGetRetryAfterInMsFromError(a);if(!o.retryService.canRetryStatusCode(c,t.useRetryForResponseCodes))return i(a);if(!o.retryService.canRetry(r.startTime,t.maxCumulativeWaitTimeMs))return i(a);var p=o.retryService.getNextWaitTimeMs(t.addJitter,t.deltaBackoffMs,u,f);return o.retryService.debugLogAttempt(u,p),n.promiseRetryWait(p).then((function(){return n.getPromiseWithRetryStrategy(e,t,{retryAttempt:u,startTime:r.startTime})})).then((function(e){return s(e)})).catch((function(e){return i(e)}))}catch(e){i(e)}}))}))},e.prototype.promiseRetryWait=function(e){return new Promise((function(t){return setTimeout(t,e)}))},e}();t.PromiseRetryStrategy=n,t.promiseRetryStrategy=new n},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(0);function n(e){return encodeURIComponent(e).replace(/%40/gi,"@").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 i=[];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)),i.push(n(t)+"="+n(e))})))})),s=i.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),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(0),n=r(35),s={"Content-Type":"application/x-www-form-urlencoded"};function i(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,u={adapter:(void 0!==t&&"[object process]"===Object.prototype.toString.call(t)?a=r(11):"undefined"!=typeof XMLHttpRequest&&(a=r(11)),a),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)?(i(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)?(i(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,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),o.forEach(["post","put","patch"],(function(e){u.headers[e]=o.merge(s)})),e.exports=u}).call(this,r(34))},function(e,t,r){"use strict";var o=r(0),n=r(36),s=r(8),i=r(38),a=r(39),u=r(12);e.exports=function(e){return new Promise((function(t,c){var f=e.data,p=e.headers;o.isFormData(f)&&delete p["Content-Type"];var d=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",h=e.auth.password||"";p.Authorization="Basic "+btoa(l+":"+h)}if(d.open(e.method.toUpperCase(),s(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in d?i(d.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:r,config:e,request:d};n(t,c,o),d=null}},d.onabort=function(){d&&(c(u("Request aborted",e,"ECONNABORTED",d)),d=null)},d.onerror=function(){c(u("Network Error",e,null,d)),d=null},d.ontimeout=function(){c(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",d)),d=null},o.isStandardBrowserEnv()){var y=r(40),m=(e.withCredentials||a(e.url))&&e.xsrfCookieName?y.read(e.xsrfCookieName):void 0;m&&(p[e.xsrfHeaderName]=m)}if("setRequestHeader"in d&&o.forEach(p,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete p[t]:d.setRequestHeader(t,e)})),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){d&&(d.abort(),c(e),d=null)})),void 0===f&&(f=null),d.send(f)}))}},function(e,t,r){"use strict";var o=r(37);e.exports=function(e,t,r,n,s){var i=new Error(e);return o(i,t,r,n,s)}},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t){t=t||{};var r={};return o.forEach(["url","method","params","data"],(function(e){void 0!==t[e]&&(r[e]=t[e])})),o.forEach(["headers","auth","proxy"],(function(n){o.isObject(t[n])?r[n]=o.deepMerge(e[n],t[n]):void 0!==t[n]?r[n]=t[n]:o.isObject(e[n])?r[n]=o.deepMerge(e[n]):void 0!==e[n]&&(r[n]=e[n])})),o.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],(function(o){void 0!==t[o]?r[o]=t[o]:void 0!==e[o]&&(r[o]=e[o])})),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";Object.defineProperty(t,"__esModule",{value:!0});var o=r(16);function n(e,t){var r={};(e.forEach((function(e){r[e.header]=e.value})),t)&&(e.find((function(e){return e.header.toLowerCase()==="Content-Type".toLowerCase()}))||(r["Content-Type"]="application/json"));return r}t.registerResponseInterceptor=function(e,t){e.interceptors.response.use((function(e){return t(e)}),(function(e){return Promise.reject(e)}))},t.registerRequestInterceptor=function(e,t){e.interceptors.request.use((function(e){return t(e)}),(function(e){return Promise.reject(e)}))},t.getCallback=function(e,t,r,s){o.httpDebugger.debugStartHttpRequest(),e.get(t.url,{headers:n(r&&r.headers?r.headers:[],!1),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){o.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){o.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.putCallback=function(e,t,r,s){o.httpDebugger.debugStartHttpRequest(),e.put(t.url,t.body,{headers:n(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){o.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){o.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.patchCallback=function(e,t,r,s){o.httpDebugger.debugStartHttpRequest(),e.patch(t.url,t.body,{headers:n(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){o.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){o.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.deleteCallback=function(e,t,r,s){o.httpDebugger.debugStartHttpRequest(),e.delete(t.url,{headers:n(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){o.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){o.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.postCallback=function(e,t,r,s){o.httpDebugger.debugStartHttpRequest(),e.post(t.url,t.body,{headers:n(r&&r.headers?r.headers:[],!0),responseType:r&&r.responseType?r.responseType:void 0}).then((function(e){o.httpDebugger.debugResolveHttpRequest(),s({response:e})}),(function(e){o.httpDebugger.debugFailedHttpRequest(),s({error:e})}))},t.getHeadersJson=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){}return e.prototype.debugStartHttpRequest=function(){},e.prototype.debugResolveHttpRequest=function(){},e.prototype.debugFailedHttpRequest=function(){},e}();t.HttpDebugger=o,t.httpDebugger=new o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){Object.assign(this,e)};t.BaseKontentError=o},function(e,t,r){"use strict";function o(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),o(r(19)),o(r(23)),o(r(25)),o(r(47))},function(e,t,r){"use strict";function o(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),o(r(20)),o(r(21)),o(r(22))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){}return e.prototype.addOptionsToUrl=function(e,t){return t&&t.forEach((function(t){e=e.indexOf("?")>-1?e+"&"+t.getParam()+"="+t.getParamValue():e+"?"+t.getParam()+"="+t.getParamValue()})),e},e}();t.UrlHelper=o,t.urlHelper=new o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){this.sdkVersionHeader="X-KC-SDKID"}return e.prototype.getSdkIdHeader=function(e){return{header:this.sdkVersionHeader,value:e.host+";"+e.name+";"+e.version}},e}();t.HeaderHelper=o,t.headerHelper=new o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){}return e.prototype.getAllNames=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(r);return t},e.prototype.getAllValues=function(e){return Object.keys(e).map((function(t){return e[t]}))},e.prototype.getEnumFromValue=function(e,t){try{if(!t)return;if(this.isNumeric(t))return e[t];var r=this.getAllValues(e).find((function(e){return e.toLowerCase()===t.toString().toLowerCase()}));if(!r)return;return r}catch(e){return}},e.prototype.getEnumFromName=function(e,t){for(var r=0,o=this.getAllNames(e);r<o.length;r++){var n=o[r];if(n.toLowerCase()===t.toLowerCase())return e[n]}},e.prototype.isNumeric=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},e}();t.EnumHelper=o,t.enumHelper=new o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(24))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){var t=function(){function e(e,t){if(this.name=e,this.value=t,!e)throw Error("Name of the custom parameter is not specified")}return e.prototype.getParam=function(){return this.name},e.prototype.getParamValue=function(){return this.value},e}();e.CustomParameter=t}(t.Parameters||(t.Parameters={}))},function(e,t,r){"use strict";function o(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),o(r(3)),o(r(6)),o(r(26)),o(r(45)),o(r(15)),o(r(16)),o(r(46)),o(r(1))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(27),n=r(2),s=r(4),i=r(5),a=r(15),u=r(3),c=r(6),f=r(1),p=function(){function e(e){this.axiosInstance=o.default.create(e&&e.axiosRequestConfig?e.axiosRequestConfig:void 0),e&&(e.requestInterceptor&&a.registerRequestInterceptor(this.axiosInstance,e.requestInterceptor),e.responseInterceptor&&a.registerResponseInterceptor(this.axiosInstance,e.responseInterceptor))}return e.prototype.retryPromise=function(e,t){return c.promiseRetryStrategy.getPromiseWithRetryStrategy(e,f.retryService.getRetryStrategyFromStrategyOptions(t),{retryAttempt:0,startTime:new Date})},e.prototype.get=function(e,t){var r=n.bindCallback(a.getCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.post=function(e,t){var r=n.bindCallback(a.postCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.put=function(e,t){var r=n.bindCallback(a.putCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.patch=function(e,t){var r=n.bindCallback(a.putCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.delete=function(e,t){var r=n.bindCallback(a.deleteCallback);return this.mapAxiosObservable(this.axiosInstance,r,e,t)},e.prototype.mapAxiosObservable=function(e,t,r,o){var i=this;return t(e,r,o).pipe(s.map((function(e){return i.mapResult(e)})),s.retryWhen(u.observableRetryStrategy.strategy(f.retryService.getRetryStrategyFromHttpQueryOptions(o),{startTime:new Date})),s.catchError((function(e){return o&&o.logErrorToConsole&&console.error("Kentico Kontent Core SDK encountered an error: ",e),n.throwError({originalError:e,mappedError:r.mapError(e)})})))},e.prototype.mapResult=function(e){if(e.error)throw e.error;if(!e.response)throw Error("Response is not set and no error was thrown");return{data:e.response.data,response:e.response,headers:i.extractHeadersFromAxiosResponse(e.response),status:e.response.status}},e}();t.HttpService=p},function(e,t,r){e.exports=r(28)},function(e,t,r){"use strict";var o=r(0),n=r(7),s=r(30),i=r(13);function a(e){var t=new s(e),r=n(s.prototype.request,t);return o.extend(r,s.prototype,t),o.extend(r,t),r}var u=a(r(10));u.Axios=s,u.create=function(e){return a(i(u.defaults,e))},u.Cancel=r(14),u.CancelToken=r(43),u.isCancel=r(9),u.all=function(e){return Promise.all(e)},u.spread=r(44),e.exports=u,e.exports.default=u},function(e,t){ | ||
/*! | ||
@@ -8,3 +8,3 @@ * Determine if an object is a Buffer | ||
*/ | ||
e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(0),o=r(8),s=r(31),i=r(32),a=r(13);function u(e){this.defaults=e,this.interceptors={request:new s,response:new s}}u.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[i,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},u.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,r){return this.request(n.merge(r||{},{method:e,url:t}))}})),n.forEach(["post","put","patch"],(function(e){u.prototype[e]=function(t,r,o){return this.request(n.merge(o||{},{method:e,url:t,data:r}))}})),e.exports=u},function(e,t,r){"use strict";var n=r(0);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},function(e,t,r){"use strict";var n=r(0),o=r(33),s=r(9),i=r(10),a=r(41),u=r(42);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!a(e.url)&&(e.url=u(e.baseURL,e.url)),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(c(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t){var r,n,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(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{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var u,c=[],f=!1,p=-1;function d(){f&&u&&(f=!1,u.length?c=u.concat(c):p=-1,c.length&&l())}function l(){if(!f){var e=a(d);f=!0;for(var t=c.length;t;){for(u=c,c=[];++p<t;)u&&u[p].run();p=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function y(){}o.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];c.push(new h(e,t)),1!==c.length||f||a(l)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},function(e,t,r){"use strict";var n=r(12);e.exports=function(e,t,r){var o=r.config.validateStatus;!o||o(r.status)?e(r):t(n("Request failed with status code "+r.status,r.config,null,r.request,r))}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var n=r(0),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,i={};return e?(n.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=n.trim(e.substr(0,s)).toLowerCase(),r=n.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(0);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(14);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){this.response=e,this.error=t};t.IHttpRequestResult=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=function(){function e(e){this.throwError=!1,this.fakeResponseJson=void 0,this.errorJson=void 0,this.fakeHeaders=[],this.fakeStatusCode=200,Object.assign(this,e)}return e.prototype.retryPromise=function(e,t){return console.log("Retry is not implemented in test service. Returning original Promise"),e},e.prototype.get=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return n.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return n.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e.prototype.post=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return n.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return n.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e.prototype.put=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return n.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return n.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e.prototype.patch=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return n.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return n.of({data:this.fakeResponseJson,response:void 0,headers:[],status:this.fakeStatusCode})},e.prototype.delete=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return n.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return n.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e}();t.TestHttpService=o},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(17)),n(r(48))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(17),o={errorCode:"error_code",message:"message",requestId:"request_id",specificCode:"specific_code"};t.mapBaseKontentError=function(e){if(e.response&&e.response.data&&e.response.data[o.requestId]){var t=e.response.data;return new n.BaseKontentError({requestId:t[o.requestId],message:t[o.message]?t[o.message]:"",errorCode:t[o.errorCode]?t[o.errorCode]:0,specificCode:t[o.specificCode]?t[o.specificCode]:0,originalError:e})}return e.request,e}}])})); | ||
e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var o=r(0),n=r(8),s=r(31),i=r(32),a=r(13);function u(e){this.defaults=e,this.interceptors={request:new s,response:new s}}u.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[i,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},u.prototype.getUri=function(e){return e=a(this.defaults,e),n(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,r){return this.request(o.merge(r||{},{method:e,url:t}))}})),o.forEach(["post","put","patch"],(function(e){u.prototype[e]=function(t,r,n){return this.request(o.merge(n||{},{method:e,url:t,data:r}))}})),e.exports=u},function(e,t,r){"use strict";var o=r(0);function n(){this.handlers=[]}n.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){o.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},function(e,t,r){"use strict";var o=r(0),n=r(33),s=r(9),i=r(10),a=r(41),u=r(42);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!a(e.url)&&(e.url=u(e.baseURL,e.url)),e.headers=e.headers||{},e.data=n(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return c(e),t.data=n(t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(c(e),t&&t.response&&(t.response.data=n(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,r){"use strict";var o=r(0);e.exports=function(e,t,r){return o.forEach(r,(function(r){e=r(e,t)})),e}},function(e,t){var r,o,n=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(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:i}catch(e){o=i}}();var u,c=[],f=!1,p=-1;function d(){f&&u&&(f=!1,u.length?c=u.concat(c):p=-1,c.length&&l())}function l(){if(!f){var e=a(d);f=!0;for(var t=c.length;t;){for(u=c,c=[];++p<t;)u&&u[p].run();p=-1,t=c.length}u=null,f=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===i||!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 h(e,t){this.fun=e,this.array=t}function y(){}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];c.push(new h(e,t)),1!==c.length||f||a(l)},h.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=y,n.addListener=y,n.once=y,n.off=y,n.removeListener=y,n.removeAllListeners=y,n.emit=y,n.prependListener=y,n.prependOnceListener=y,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";var o=r(0);e.exports=function(e,t){o.forEach(e,(function(r,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[o])}))}},function(e,t,r){"use strict";var o=r(12);e.exports=function(e,t,r){var n=r.config.validateStatus;!n||n(r.status)?e(r):t(o("Request failed with status code "+r.status,r.config,null,r.request,r))}},function(e,t,r){"use strict";e.exports=function(e,t,r,o,n){return e.config=t,r&&(e.code=r),e.request=o,e.response=n,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,r){"use strict";var o=r(0),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,i={};return e?(o.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=o.trim(e.substr(0,s)).toLowerCase(),r=o.trim(e.substr(s+1)),t){if(i[t]&&n.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},function(e,t,r){"use strict";var o=r(0);e.exports=o.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var o=e;return t&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=o.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var o=r(0);e.exports=o.isStandardBrowserEnv()?{write:function(e,t,r,n,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),o.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),o.isString(n)&&a.push("path="+n),o.isString(s)&&a.push("domain="+s),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var o=r(14);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new o(e),t(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){this.response=e,this.error=t};t.IHttpRequestResult=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),n=function(){function e(e){this.throwError=!1,this.fakeResponseJson=void 0,this.errorJson=void 0,this.fakeHeaders=[],this.fakeStatusCode=200,Object.assign(this,e)}return e.prototype.retryPromise=function(e,t){return console.log("Retry is not implemented in test service. Returning original Promise"),e},e.prototype.get=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return o.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return o.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e.prototype.post=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return o.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return o.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e.prototype.put=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return o.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return o.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e.prototype.patch=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return o.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return o.of({data:this.fakeResponseJson,response:void 0,headers:[],status:this.fakeStatusCode})},e.prototype.delete=function(e,t){if(this.throwError){var r={response:{data:this.errorJson}};return o.throwError({originalError:r,mappedError:e.mapError(r),headers:this.fakeHeaders,status:this.fakeStatusCode})}return o.of({data:this.fakeResponseJson,response:void 0,headers:this.fakeHeaders,status:this.fakeStatusCode})},e}();t.TestHttpService=n},function(e,t,r){"use strict";function o(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),o(r(17)),o(r(48))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(17),n={errorCode:"error_code",message:"message",requestId:"request_id",specificCode:"specific_code"};t.mapBaseKontentError=function(e){if(e.response&&e.response.data&&e.response.data[n.requestId]){var t=e.response.data;return new o.BaseKontentError({requestId:t[n.requestId],message:t[n.message]?t[n.message]:"",errorCode:t[n.errorCode]?t[n.errorCode]:0,specificCode:t[n.specificCode]?t[n.specificCode]:0,originalError:e})}return e.request,e}}])})); | ||
//# sourceMappingURL=kontent-core.umd.min.js.map |
@@ -66,5 +66,5 @@ "use strict"; | ||
var _this = this; | ||
return axiosObservable(axiosInstance, call, options).pipe(operators_1.retryWhen(observable_retry_strategy_1.observableRetryStrategy.strategy(retry_service_1.retryService.getRetryStrategyFromHttpQueryOptions(options), { | ||
return axiosObservable(axiosInstance, call, options).pipe(operators_1.map(function (result) { return _this.mapResult(result); }), operators_1.retryWhen(observable_retry_strategy_1.observableRetryStrategy.strategy(retry_service_1.retryService.getRetryStrategyFromHttpQueryOptions(options), { | ||
startTime: new Date() | ||
})), operators_1.map(function (result) { return _this.mapResult(result); }), operators_1.catchError(function (error) { | ||
})), operators_1.catchError(function (error) { | ||
// Handling errors: https://github.com/axios/axios#handling-errors | ||
@@ -71,0 +71,0 @@ if (options && options.logErrorToConsole) { |
@@ -9,8 +9,12 @@ "use strict"; | ||
this.strategy = function (options, internal) { return function (attempts) { | ||
console.log('get retry strategy', attempts); | ||
return attempts.pipe(operators_1.mergeMap(function (error, i) { | ||
console.log('attempt', i); | ||
var retryAttempt = i + 1; | ||
var statusCode = retry_service_1.retryService.getStatusCodeFromError(error); | ||
var retryAfter = retry_service_1.retryService.tryGetRetryAfterInMsFromError(error); | ||
console.log(statusCode, retryAfter); | ||
if (!retry_service_1.retryService.canRetryStatusCode(statusCode, options.useRetryForResponseCodes)) { | ||
// request with given status code cannot be retried | ||
console.log('no retry 1'); | ||
return rxjs_1.throwError(error); | ||
@@ -20,2 +24,3 @@ } | ||
// request should not be retried anymore | ||
console.log('no retry 1'); | ||
return rxjs_1.throwError(error); | ||
@@ -27,2 +32,3 @@ } | ||
retry_service_1.retryService.debugLogAttempt(retryAttempt, waitTime); | ||
console.log('wait', waitTime); | ||
return rxjs_1.timer(waitTime); | ||
@@ -29,0 +35,0 @@ })); |
@@ -1,2 +0,2 @@ | ||
import { IBaseResponseError, IHttpQueryOptions, IRetryStrategyOptions } from './http.models'; | ||
import { IHttpQueryOptions, IRetryStrategyOptions } from './http.models'; | ||
export declare class RetryService { | ||
@@ -15,4 +15,5 @@ private readonly retryAfterHeaderName; | ||
canRetryStatusCode(statusCode: number, useRetryForResponseCodes: number[]): boolean; | ||
getStatusCodeFromError(error: IBaseResponseError<any>): number; | ||
tryGetRetryAfterInMsFromError(error: IBaseResponseError<any>): number | undefined; | ||
getStatusCodeFromError(error: any): number; | ||
tryGetRetryAfterInMsFromError(error: any): number | undefined; | ||
private tryGetAxiosError; | ||
private getBoolOrDefault; | ||
@@ -19,0 +20,0 @@ /** |
@@ -76,10 +76,6 @@ "use strict"; | ||
RetryService.prototype.getStatusCodeFromError = function (error) { | ||
var originalError = error.originalError; | ||
if (!originalError || !originalError.isAxiosError) { | ||
var axiosError = this.tryGetAxiosError(error); | ||
if (!axiosError || !axiosError.response) { | ||
return 0; | ||
} | ||
var axiosError = originalError; | ||
if (!axiosError.response) { | ||
return 0; | ||
} | ||
return axiosError.response.status; | ||
@@ -89,10 +85,6 @@ }; | ||
var _this = this; | ||
var originalError = error.originalError; | ||
if (!originalError || !originalError.isAxiosError) { | ||
var axiosError = this.tryGetAxiosError(error); | ||
if (!axiosError || !axiosError.response) { | ||
return undefined; | ||
} | ||
var axiosError = originalError; | ||
if (!axiosError.response || !axiosError.response.headers) { | ||
return undefined; | ||
} | ||
var headers = headers_helper_1.extractHeadersFromAxiosResponse(axiosError.response); | ||
@@ -113,6 +105,20 @@ var retryValueHeader = headers.find(function (m) { return m.header.toLowerCase() === _this.retryAfterHeaderName.toLowerCase(); }); | ||
// header is number | ||
var retryValueInMs = (+retryValue) * 1000; | ||
var retryValueInMs = +retryValue * 1000; | ||
return retryValueInMs; | ||
} | ||
}; | ||
RetryService.prototype.tryGetAxiosError = function (error) { | ||
console.warn('try get axios', error); | ||
if (!error) { | ||
return undefined; | ||
} | ||
if (error.isAxiosError) { | ||
return error; | ||
} | ||
var originalError = error.originalError; | ||
if (originalError && originalError.isAxiosError) { | ||
return originalError; | ||
} | ||
return undefined; | ||
}; | ||
RetryService.prototype.getBoolOrDefault = function (value, defaultValue) { | ||
@@ -119,0 +125,0 @@ if (typeof value === 'undefined') { |
@@ -5,5 +5,5 @@ "use strict"; | ||
host: 'npmjs.com', | ||
version: '4.0.1', | ||
version: '4.0.2', | ||
name: '@kentico/kontent-core' | ||
}; | ||
//# sourceMappingURL=sdk-info.generated.js.map |
@@ -64,5 +64,5 @@ import axios from 'axios'; | ||
var _this = this; | ||
return axiosObservable(axiosInstance, call, options).pipe(retryWhen(observableRetryStrategy.strategy(retryService.getRetryStrategyFromHttpQueryOptions(options), { | ||
return axiosObservable(axiosInstance, call, options).pipe(map(function (result) { return _this.mapResult(result); }), retryWhen(observableRetryStrategy.strategy(retryService.getRetryStrategyFromHttpQueryOptions(options), { | ||
startTime: new Date() | ||
})), map(function (result) { return _this.mapResult(result); }), catchError(function (error) { | ||
})), catchError(function (error) { | ||
// Handling errors: https://github.com/axios/axios#handling-errors | ||
@@ -69,0 +69,0 @@ if (options && options.logErrorToConsole) { |
@@ -7,8 +7,12 @@ import { throwError, timer } from 'rxjs'; | ||
this.strategy = function (options, internal) { return function (attempts) { | ||
console.log('get retry strategy', attempts); | ||
return attempts.pipe(mergeMap(function (error, i) { | ||
console.log('attempt', i); | ||
var retryAttempt = i + 1; | ||
var statusCode = retryService.getStatusCodeFromError(error); | ||
var retryAfter = retryService.tryGetRetryAfterInMsFromError(error); | ||
console.log(statusCode, retryAfter); | ||
if (!retryService.canRetryStatusCode(statusCode, options.useRetryForResponseCodes)) { | ||
// request with given status code cannot be retried | ||
console.log('no retry 1'); | ||
return throwError(error); | ||
@@ -18,2 +22,3 @@ } | ||
// request should not be retried anymore | ||
console.log('no retry 1'); | ||
return throwError(error); | ||
@@ -25,2 +30,3 @@ } | ||
retryService.debugLogAttempt(retryAttempt, waitTime); | ||
console.log('wait', waitTime); | ||
return timer(waitTime); | ||
@@ -27,0 +33,0 @@ })); |
@@ -1,2 +0,2 @@ | ||
import { IBaseResponseError, IHttpQueryOptions, IRetryStrategyOptions } from './http.models'; | ||
import { IHttpQueryOptions, IRetryStrategyOptions } from './http.models'; | ||
export declare class RetryService { | ||
@@ -15,4 +15,5 @@ private readonly retryAfterHeaderName; | ||
canRetryStatusCode(statusCode: number, useRetryForResponseCodes: number[]): boolean; | ||
getStatusCodeFromError(error: IBaseResponseError<any>): number; | ||
tryGetRetryAfterInMsFromError(error: IBaseResponseError<any>): number | undefined; | ||
getStatusCodeFromError(error: any): number; | ||
tryGetRetryAfterInMsFromError(error: any): number | undefined; | ||
private tryGetAxiosError; | ||
private getBoolOrDefault; | ||
@@ -19,0 +20,0 @@ /** |
@@ -74,10 +74,6 @@ import { extractHeadersFromAxiosResponse } from './headers-helper'; | ||
RetryService.prototype.getStatusCodeFromError = function (error) { | ||
var originalError = error.originalError; | ||
if (!originalError || !originalError.isAxiosError) { | ||
var axiosError = this.tryGetAxiosError(error); | ||
if (!axiosError || !axiosError.response) { | ||
return 0; | ||
} | ||
var axiosError = originalError; | ||
if (!axiosError.response) { | ||
return 0; | ||
} | ||
return axiosError.response.status; | ||
@@ -87,10 +83,6 @@ }; | ||
var _this = this; | ||
var originalError = error.originalError; | ||
if (!originalError || !originalError.isAxiosError) { | ||
var axiosError = this.tryGetAxiosError(error); | ||
if (!axiosError || !axiosError.response) { | ||
return undefined; | ||
} | ||
var axiosError = originalError; | ||
if (!axiosError.response || !axiosError.response.headers) { | ||
return undefined; | ||
} | ||
var headers = extractHeadersFromAxiosResponse(axiosError.response); | ||
@@ -111,6 +103,20 @@ var retryValueHeader = headers.find(function (m) { return m.header.toLowerCase() === _this.retryAfterHeaderName.toLowerCase(); }); | ||
// header is number | ||
var retryValueInMs = (+retryValue) * 1000; | ||
var retryValueInMs = +retryValue * 1000; | ||
return retryValueInMs; | ||
} | ||
}; | ||
RetryService.prototype.tryGetAxiosError = function (error) { | ||
console.warn('try get axios', error); | ||
if (!error) { | ||
return undefined; | ||
} | ||
if (error.isAxiosError) { | ||
return error; | ||
} | ||
var originalError = error.originalError; | ||
if (originalError && originalError.isAxiosError) { | ||
return originalError; | ||
} | ||
return undefined; | ||
}; | ||
RetryService.prototype.getBoolOrDefault = function (value, defaultValue) { | ||
@@ -117,0 +123,0 @@ if (typeof value === 'undefined') { |
export var sdkInfo = { | ||
host: 'npmjs.com', | ||
version: '4.0.1', | ||
version: '4.0.2', | ||
name: '@kentico/kontent-core' | ||
}; | ||
//# sourceMappingURL=sdk-info.generated.js.map |
@@ -5,2 +5,9 @@ # Changelog | ||
### [4.0.2](https://github.com///compare/v4.0.1...v4.0.2) (2019-10-24) | ||
### Bug Fixes | ||
* fixes retry policy for observables executed through http service, makes error handling more robust ([4696831](https://github.com///commit/469683196094cc789be18f68a809247a993966ca)) | ||
### [4.0.1](https://github.com///compare/v4.0.0...v4.0.1) (2019-10-24) | ||
@@ -7,0 +14,0 @@ |
{ | ||
"name": "@kentico/kontent-core", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
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 too big to display
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
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
992514
13211