genesys-cloud-client-logger
Advanced tools
Comparing version 4.0.1 to 4.0.2-develop.4
@@ -8,2 +8,4 @@ import { ILoggerConfig, ILogger } from './interfaces'; | ||
private secondaryLogger; | ||
static VERSION: string; | ||
get VERSION(): string; | ||
constructor(config: ILoggerConfig); | ||
@@ -10,0 +12,0 @@ setAccessToken(token: string): void; |
@@ -5,2 +5,3 @@ import { v4 } from 'uuid'; | ||
export class Logger { | ||
/* eslint-enable @typescript-eslint/naming-convention */ | ||
constructor(config) { | ||
@@ -65,2 +66,5 @@ this.defaultFormatter = (logLevel, message, details, messageOptions, next) => { | ||
} | ||
get VERSION() { | ||
return Logger.VERSION; | ||
} | ||
setAccessToken(token) { | ||
@@ -124,1 +128,3 @@ this.config.accessToken = token; | ||
} | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
Logger.VERSION = '4.0.2'; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GenesysCloudClientLogger=t():e.GenesysCloudClientLogger=t()}(window,(function(){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=6)}([function(e,t){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);e.exports=function(){return r(n),n}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,o=r;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},function(e,t){var r=Object.prototype.hasOwnProperty;function n(e){return"[Throws: "+(e?e.message:"?")+"]"}function o(e){var t=[];return function e(o){if(null===o||"object"!=typeof o)return o;if(-1!==t.indexOf(o))return"[Circular]";if(t.push(o),"function"==typeof o.toJSON)try{var i=e(o.toJSON());return t.pop(),i}catch(e){return n(e)}if(Array.isArray(o)){var s=o.map(e);return t.pop(),s}var a=Object.keys(o).reduce((function(t,i){return t[i]=e(function(e,t){if(r.call(e,t))try{return e[t]}catch(e){return n(e)}return e[t]}(o,i)),t}),{});return t.pop(),a}(e)}e.exports=function(e,t,r){return JSON.stringify(o(e),t,r)},e.exports.ensureProperties=o},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.calculateLogBufferSize=function(e){return e.reduce((function(e,r){return e+t.calculateLogMessageSize(r)}),0)},t.calculateLogMessageSize=function(e){var t=JSON.stringify(e),r=encodeURIComponent(t).match(/%[89ABab]/g);return t.length+(r?r.length:0)},t.getDeferred=function(){var e,t;return{promise:new Promise((function(r,n){e=r,t=n})),resolve:e,reject:t}},t.deepClone=function e(t){if(t){if(Array.isArray(t)){for(var r=[],o=0;o<t.length;o++)r[o]=e(t[o]);return r}if("object"==typeof t){var i=n({},t);for(var s in t)i[s]=e(t[s]);return i}}return t}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return null!==e&&"object"===n(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(24),o=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return n.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,r=this.numOfDelayedAttempts,n=e*Math.pow(t,r);return Math.min(n,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.Logger=n.Logger,t.default=n.Logger},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=r(8),a=i(r(2)),u=r(11),c=function(){function e(e){var t=this;this.defaultFormatter=function(e,r,n,o,i){if(o.skipDefaultFormatter)return i();r instanceof Error&&(n=n||r,r=r.message),i(e,r=""+(t.config.appName?"["+t.config.appName+"] ":"")+r,n,o)},this.logMessage=function(e,r,n,o){if(!o.skipSecondaryLogger)try{var i=[r];void 0!==n&&i.push(t.config.stringify?a.default(n):n),t.secondaryLogger[e].apply(t.secondaryLogger,i)}catch(e){console.error("Error logging using custom logger passed into `genesys-cloud-client-logger`",{error:e,secondaryLogger:t.secondaryLogger,message:r,details:n,messageOptions:o})}!o.skipServer&&t.serverLogger&&t.logRank(e)>=t.logRank(t.config.logLevel)&&t.serverLogger.addLogToSend(e,r,n)},Object.defineProperty(this,"clientId",{value:s.v4(),writable:!1}),this.config=n({},e),this.secondaryLogger=this.config.logger||console,delete this.config.logger,-1===this.logRank(this.config.logLevel)&&(e.logLevel&&this.warn('Invalid log level: "'+e.logLevel+'". Default "info" will be used instead.',null,{skipServer:!0}),this.config.logLevel="info"),!e.appName&&e.logTopic&&(this.warn("`logTopic` has been renamed to `appName`. Please use `appName`",null,{skipServer:!0}),this.config.appName=e.logTopic),!1!==this.config.initializeServerLogging&&(this.serverLogger=new u.ServerLogger(this))}return e.prototype.setAccessToken=function(e){this.config.accessToken=e},e.prototype.log=function(e,t,r){this.formatMessage("log",e,t,r)},e.prototype.debug=function(e,t,r){this.formatMessage("debug",e,t,r)},e.prototype.info=function(e,t,r){this.formatMessage("info",e,t,r)},e.prototype.warn=function(e,t,r){this.formatMessage("warn",e,t,r)},e.prototype.error=function(e,t,r){this.formatMessage("error",e,t,r)},e.prototype.formatMessage=function(e,t,r,n){var i=[this.defaultFormatter.bind(this)];this.config.formatters&&(i=o(this.config.formatters,[this.defaultFormatter.bind(this)])),this.callNextFormatter(i,e,t,r,n)},e.prototype.callNextFormatter=function(e,t,r,n,o){var i=this;void 0===o&&(o={});var s=e[0],a=e.slice(1);if(!s)return this.logMessage(t,r,n,o);s(t,r,n,o,(function(e,s,u,c){void 0!==e?i.callNextFormatter(a,e,s,u,c):i.callNextFormatter(a,t,r,n,o)}))},e.prototype.logRank=function(e){switch(e){case"log":return 0;case"debug":return 1;case"info":return 2;case"warn":return 3;case"error":return 4;default:return-1}},e}();t.Logger=c},function(e,t,r){var n=r(9),o=r(10),i=o;i.v1=n,i.v4=o,e.exports=i},function(e,t,r){var n,o,i=r(0),s=r(1),a=0,u=0;e.exports=function(e,t,r){var c=t&&r||0,l=t||[],p=(e=e||{}).node||n,f=void 0!==e.clockseq?e.clockseq:o;if(null==p||null==f){var h=i();null==p&&(p=n=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==f&&(f=o=16383&(h[6]<<8|h[7]))}var d=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,g=d-a+(y-u)/1e4;if(g<0&&void 0===e.clockseq&&(f=f+1&16383),(g<0||d>a)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=d,u=y,o=f;var m=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;l[c++]=m>>>24&255,l[c++]=m>>>16&255,l[c++]=m>>>8&255,l[c++]=255&m;var v=d/4294967296*1e4&268435455;l[c++]=v>>>8&255,l[c++]=255&v,l[c++]=v>>>24&15|16,l[c++]=v>>>16&255,l[c++]=f>>>8|128,l[c++]=255&f;for(var b=0;b<6;++b)l[c+b]=p[b];return t||s(l)}},function(e,t,r){var n=r(0),o=r(1);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||n)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[i+a]=s[a];return t||o(s)}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(2)),a=r(3),u=r(12),c=function(){function e(e){if(this.isInitialized=!1,this.logBuffer=[],this.debounceTimer=null,this.logger=e,!e.config.url||!e.config.appVersion){var t="Missing `url` and/or `appVersion` config options to set up server logging. Not sending logs to server for this logger instance";throw this.logger.error(t,{providedConfig:e.config},{skipServer:!0}),new Error(t)}this.isInitialized=!0,this.debounceLogUploadTime=e.config.uploadDebounceTime||4e3,this.logUploader=u.getOrCreateLogUploader(e.config.url,e.config.debugMode),window.addEventListener("unload",this.sendAllLogsInstantly.bind(this))}return e.prototype.addLogToSend=function(e,t,r){if(this.isInitialized){var n=this.convertToLogMessage(t,r),o=this.convertToTrace(e,n),i=a.calculateLogMessageSize(o);if(i>14500){var s=this.truncateLog(e,n);if(null===s)return void this.logger.error("truncated message is too large to send to server. not sending message",{originalTrace:o,originalTraceSize:a.calculateLogMessageSize(o),truncatedTrace:s,truncatedTraceSize:a.calculateLogMessageSize(s)},{skipServer:!0});i=a.calculateLogMessageSize(s),o=s}var u,c=!this.logBuffer.length;if((u=c?{size:0,traces:[]}:this.logBuffer[this.logBuffer.length-1]).size+i>14500)return this.debug("`exceedsMaxLogSize` was `true`",{logBuffer:this.logBuffer,bufferItem:u,incomingTrace:o,incomingTraceSize:i,maxAllowedTraceSize:14500}),this.logBuffer.push({size:i,traces:[o]}),this.debug("calling sendLogsToServer(true)",{logBuffer:this.logBuffer}),void this.sendLogsToServer(!0);u.size+=i,u.traces.push(o),c&&(this.debug("`this.logBuffer` was empty. pushing new buffer item",{logBuffer:this.logBuffer,bufferItem:u}),this.logBuffer.push(u)),this.debug("calling sendLogsToServer()",{logBuffer:this.logBuffer}),this.sendLogsToServer()}},e.prototype.sendLogsToServer=function(e){return void 0===e&&(e=!1),n(this,void 0,void 0,(function(){var t,r,n=this;return o(this,(function(o){switch(o.label){case 0:if(!this.logBuffer.length)return clearTimeout(this.debounceTimer),this.debounceTimer=null,this.debug("buffer empty, not sending http request"),[2];if(!e)return this.debounceTimer?this.debug("sendLogsToServer() 'immediate' is false. 'debounceTimer' is already running"):(this.debug("sendLogsToServer() 'immediate' is false. setting up 'debounceTimer' to "+this.debounceLogUploadTime+"ms"),this.debounceTimer=setTimeout((function(){return n.sendLogsToServer(!0)}),this.debounceLogUploadTime)),[2];clearTimeout(this.debounceTimer),this.debounceTimer=null,t=this.logBuffer.splice(0,1)[0],o.label=1;case 1:return o.trys.push([1,3,4,5]),this.debug("calling logUploader.postLogsToEndpoint() with",{bufferItem:t,newLogBuffer:this.logBuffer}),[4,this.logUploader.postLogsToEndpoint(this.convertToRequestParams(t.traces.reverse()))];case 2:return o.sent(),[3,5];case 3:return r=o.sent(),this.logger.error("Error sending logs to server",r,{skipServer:!0}),[3,5];case 4:return this.sendLogsToServer(),[7];case 5:return[2]}}))}))},e.prototype.sendAllLogsInstantly=function(){var e=this;return this.logBuffer.forEach((function(t){e.logUploader.postLogsToEndpointInstantly(e.convertToRequestParams(t.traces.reverse()))})),this.logUploader.sendEntireQueue()},e.prototype.truncateLog=function(e,t){var r,n,o=a.calculateLogMessageSize(this.convertToTrace(e,t)),i=a.deepClone(t);return i.details="[[TRUNCATED]]",r=this.convertToTrace(e,i),(n=a.calculateLogMessageSize(r))<=14500?(this.logger.warn("message too large to send to server. truncated log details",{originalLog:t,truncatedLog:i,originalTraceSize:o,truncatedTraceSize:n,maxAllowedTraceSize:14500},{skipServer:!0}),r):(i.message=i.message.substr(0,150)+"... [[TRUNCATED]]",r=this.convertToTrace(e,i),(n=a.calculateLogMessageSize(r))<=14500?(this.logger.warn("message too large to send to server. truncated log details & log message",{originalLog:t,truncatedLog:i,originalTraceSize:o,truncatedTraceSize:n,maxAllowedTraceSize:14500},{skipServer:!0}),r):null)},e.prototype.convertToLogMessage=function(e,t){var r={clientTime:(new Date).toISOString(),clientId:this.logger.clientId,message:e,details:t},n=this.logger.config,o=n.originAppName,i=n.originAppVersion,s=n.originAppId;return o&&(r.originAppName=o,r.originAppVersion=i,r.originAppId=s),r},e.prototype.convertToTrace=function(e,t){return{topic:this.logger.config.appName,level:e.toUpperCase(),message:s.default(t)}},e.prototype.convertToRequestParams=function(e){return{accessToken:this.logger.config.accessToken,app:{appId:this.logger.config.appName,appVersion:this.logger.config.appVersion},traces:e}},e.prototype.debug=function(e,t){this.logger.config.debugMode&&console.log("%c [DEBUG:"+this.logger.config.appName+"] "+e,"color: #32a852",a.deepClone(t))},e}();t.ServerLogger=c},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(13)),a=r(20),u=r(3),c=new Map;t.getOrCreateLogUploader=function(e,t){void 0===t&&(t=!1);var r=c.get(e);return r||(r=new l(e,t),c.set(e,r)),r};var l=function(){function e(e,t){void 0===t&&(t=!1),this.url=e,this.debugMode=t,this.hasPendingRequest=!1,this.sendQueue=[]}return e.prototype.postLogsToEndpoint=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=u.getDeferred(),this.sendQueue.push({requestParams:e,deferred:t}),this.sendNextQueuedLogToServer(),this.debug("adding requestParams to sendQueue",{requestParams:e,updatedSendQueue:this.sendQueue.map((function(e){return e.requestParams})),hasPendingRequest:this.hasPendingRequest}),[2,t.promise]}))}))},e.prototype.postLogsToEndpointInstantly=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return this.debug("sending request instantly",{requestParams:e,sendQueue:this.sendQueue.map((function(e){return e.requestParams}))}),[2,this.sendPostRequest(e)]}))}))},e.prototype.sendEntireQueue=function(){var e;for(this.debug("sending all queued requests instantly to clear out sendQueue",{sendQueue:this.sendQueue.map((function(e){return e.requestParams}))});e=this.sendQueue.shift();)this.postLogsToEndpoint(e.requestParams)},e.prototype.sendNextQueuedLogToServer=function(){return n(this,void 0,void 0,(function(){var e,t=this;return o(this,(function(r){return this.hasPendingRequest||0===this.sendQueue.length?(this.debug("sendNextQueuedLogToServer() but not sending request",{hasPendingRequest:this.hasPendingRequest,sendQueueLength:this.sendQueue.length}),[2]):((e=this.sendQueue.shift()).deferred.promise.finally((function(){t.debug("queue item completed. removing from queue and resetting send queue",{queueItemRequestParams:e.requestParams,updatedSendQueue:t.sendQueue.map((function(e){return e.requestParams}))}),t.hasPendingRequest=!1,t.sendNextQueuedLogToServer()})),this.hasPendingRequest=!0,this.debug("sending logs to server",{queueItem:e.requestParams,sendQueue:this.sendQueue.map((function(e){return e.requestParams}))}),[2,a.backOff((function(){return t.sendPostRequest(e.requestParams)}),{retry:function(e){return e&&429===e.status},numOfAttempts:10,startingDelay:0,delayFirstAttempt:!1,maxDelay:15e3}).then((function(r){t.debug("successfully sent logs to server",{requestParams:e.requestParams,response:r}),e.deferred.resolve(r)})).catch((function(r){return t.debug("ERROR sending logs to server",{requestParams:e.requestParams,error:r}),e.deferred.reject(r)}))])}))}))},e.prototype.sendPostRequest=function(e){return this.debug("issuing POST request",{requestParams:e}),s.default.post(this.url).set("Authorization","Bearer "+e.accessToken).type("application/json; charset=UTF-8").send(e)},e.prototype.debug=function(e,t){this.debugMode&&console.log("%c [DEBUG:log-uploader] "+e,"color: #32a0a8",u.deepClone(t))},e}();t.LogUploader=l},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o;"undefined"!=typeof window?o=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),o=void 0):o=self;var i=r(14),s=r(15),a=r(16),u=r(4),c=r(17),l=r(19);function p(){}e.exports=function(e,r){return"function"==typeof r?new t.Request("GET",e).end(r):1===arguments.length?new t.Request("GET",e):new t.Request(e,r)};var f=t=e.exports;t.Request=b,f.getXHR=function(){if(o.XMLHttpRequest&&(!o.location||"file:"!==o.location.protocol||!o.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("Browser-only version of superagent could not find XHR")};var h="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function d(e){if(!u(e))return e;var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&y(t,r,e[r]);return t.join("&")}function y(e,t,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))r.forEach((function(r){y(e,t,r)}));else if(u(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&y(e,"".concat(t,"[").concat(n,"]"),r[n]);else e.push(encodeURI(t)+"="+encodeURIComponent(r));else e.push(encodeURI(t))}function g(e){for(var t,r,n={},o=e.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(t=o[i]).indexOf("="))?n[decodeURIComponent(t)]="":n[decodeURIComponent(t.slice(0,r))]=decodeURIComponent(t.slice(r+1));return n}function m(e){return/[/+]json($|[^-\w])/.test(e)}function v(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){for(var t,r,n,o,i=e.split(/\r?\n/),s={},a=0,u=i.length;a<u;++a)-1!==(t=(r=i[a]).indexOf(":"))&&(n=r.slice(0,t).toLowerCase(),o=h(r.slice(t+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function b(e,t){var r=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,n=null;try{n=new v(r)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,r.xhr?(t.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,t.status=r.xhr.status?r.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),r.callback(t)}r.emit("response",n);try{r._isResponseOK(n)||(e=new Error(n.statusText||n.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=n,e.status=n.status,r.callback(e,n)):r.callback(null,n)}))}function _(e,t,r){var n=f("DELETE",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}f.serializeObject=d,f.parseString=g,f.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},f.serialize={"application/x-www-form-urlencoded":d,"application/json":s},f.parse={"application/x-www-form-urlencoded":g,"application/json":JSON.parse},c(v.prototype),v.prototype._parseBody=function(e){var t=f.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&m(this.type)&&(t=f.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},v.prototype.toError=function(){var e=this.req,t=e.method,r=e.url,n="cannot ".concat(t," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=t,o.url=r,o},f.Response=v,i(b.prototype),a(b.prototype),b.prototype.type=function(e){return this.set("Content-Type",f.types[e]||e),this},b.prototype.accept=function(e){return this.set("Accept",f.types[e]||e),this},b.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===n(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,o)},b.prototype.query=function(e){return"string"!=typeof e&&(e=d(e)),e&&this._query.push(e),this},b.prototype.attach=function(e,t,r){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,r||t.name)}return this},b.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},b.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var r=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),r(e,t)},b.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},b.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},b.prototype.ca=b.prototype.agent,b.prototype.buffer=b.prototype.ca,b.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},b.prototype.pipe=b.prototype.write,b.prototype._isHost=function(e){return e&&"object"===n(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},b.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||p,this._finalizeQueryString(),this._end()},b.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},b.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=f.getXHR();var t=this.xhr,r=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var r=t.readyState;if(r>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(e._uploadTimeoutTimer)),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.addEventListener("progress",n.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",n.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||f.serialize[o?o.split(";")[0]:""];!i&&m(o)&&(i=f.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===r?null:r)},f.agent=function(){return new l},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){l.prototype[e.toLowerCase()]=function(t,r){var n=new f.Request(e,t);return this._setDefaults(n),r&&n.end(r),n}})),l.prototype.del=l.prototype.delete,f.get=function(e,t,r){var n=f("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},f.head=function(e,t,r){var n=f("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},f.options=function(e,t,r){var n=f("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},f.del=_,f.delete=_,f.patch=function(e,t,r){var n=f("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},f.post=function(e,t,r){var n=f("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},f.put=function(e,t,r){var n=f("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},function(e,t,r){function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<n.length;o++)if((r=n[o])===t||r.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t){e.exports=o,o.default=o,o.stable=s,o.stableStringify=s;var r=[],n=[];function o(e,t,o){var i;for(!function e(t,o,i,s){var a;if("object"==typeof t&&null!==t){for(a=0;a<i.length;a++)if(i[a]===t){var u=Object.getOwnPropertyDescriptor(s,o);return void(void 0!==u.get?u.configurable?(Object.defineProperty(s,o,{value:"[Circular]"}),r.push([s,o,t,u])):n.push([t,o]):(s[o]="[Circular]",r.push([s,o,t])))}if(i.push(t),Array.isArray(t))for(a=0;a<t.length;a++)e(t[a],a,i,t);else{var c=Object.keys(t);for(a=0;a<c.length;a++){var l=c[a];e(t[l],l,i,t)}}i.pop()}}(e,"",[],void 0),i=0===n.length?JSON.stringify(e,t,o):JSON.stringify(e,a(t),o);0!==r.length;){var s=r.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}return i}function i(e,t){return e<t?-1:e>t?1:0}function s(e,t,o){var s,u=function e(t,o,s,a){var u;if("object"==typeof t&&null!==t){for(u=0;u<s.length;u++)if(s[u]===t){var c=Object.getOwnPropertyDescriptor(a,o);return void(void 0!==c.get?c.configurable?(Object.defineProperty(a,o,{value:"[Circular]"}),r.push([a,o,t,c])):n.push([t,o]):(a[o]="[Circular]",r.push([a,o,t])))}if("function"==typeof t.toJSON)return;if(s.push(t),Array.isArray(t))for(u=0;u<t.length;u++)e(t[u],u,s,t);else{var l={},p=Object.keys(t).sort(i);for(u=0;u<p.length;u++){var f=p[u];e(t[f],f,s,t),l[f]=t[f]}if(void 0===a)return l;r.push([a,o,t]),a[o]=l}s.pop()}}(e,"",[],void 0)||e;for(s=0===n.length?JSON.stringify(u,t,o):JSON.stringify(u,a(t),o);0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}return s}function a(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var o=0;o<n.length;o++){var i=n[o];if(i[1]===t&&i[0]===r){r="[Circular]",n.splice(o,1);break}}return e.call(this,t,r)}}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=r(4);function i(e){if(e)return function(e){for(var t in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,t)&&(e[t]=i.prototype[t]);return e}(e)}e.exports=i,i.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},i.prototype.parse=function(e){return this._parser=e,this},i.prototype.responseType=function(e){return this._responseType=e,this},i.prototype.serialize=function(e){return this._serializer=e,this},i.prototype.timeout=function(e){if(!e||"object"!==n(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},i.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var s=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];i.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(e,t);if(!0===r)return!0;if(!1===r)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!==t.status)return!0;if(e){if(e.code&&s.includes(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},i.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},i.prototype.then=function(e,t){var r=this;if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){n.on("abort",(function(){if(r.timedout&&r.timedoutError)t(r.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=r.status,e.method=r.method,e.url=r.url,t(e)}})),n.end((function(r,n){r?t(r):e(n)}))}))}return this._fullfilledPromise.then(e,t)},i.prototype.catch=function(e){return this.then(void 0,e)},i.prototype.use=function(e){return e(this),this},i.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},i.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},i.prototype.get=function(e){return this._header[e.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(e,t){if(o(e)){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},i.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},i.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(o(e)){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.field(r,e[r]);return this}if(Array.isArray(t)){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&this.field(e,t[n]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),this._getFormData().append(e,t),this},i.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},i.prototype._auth=function(e,t,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},i.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},i.prototype.redirects=function(e){return this._maxRedirects=e,this},i.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(e){var t=o(e),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&o(this._data))for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._data[n]=e[n]);else"string"==typeof e?(r||this.type("form"),r=this._header["content-type"],this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||r||this.type("json"),this},i.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},i.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.slice(t+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.slice(0,t)+"?"+r.join("&")}}},i.prototype._appendQueryString=function(){console.warn("Unsupported")},i.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error("".concat(e+t,"ms exceeded"));n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.timedoutError=n,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},function(e,t,r){"use strict";var n=r(18);function o(e){if(e)return function(e){for(var t in o.prototype)Object.prototype.hasOwnProperty.call(o.prototype,t)&&(e[t]=o.prototype[t]);return e}(e)}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=n.type(t);var r=n.params(t);for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(this[o]=r[o]);this.links={};try{e.link&&(this.links=n.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){var t=e/100|0;this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},function(e,t,r){"use strict";t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce((function(e,t){var r=t.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(e[n]=o),e}),{})},t.parseLinks=function(e){return e.split(/ *, */).reduce((function(e,t){var r=t.split(/ *; */),n=r[0].slice(1,-1);return e[r[1].split(/ *= */)[1].slice(1,-1)]=n,e}),{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},function(e,t,r){"use strict";function n(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach((function(e){o.prototype[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return this._defaults.push({fn:e,args:r}),this}})),o.prototype._setDefaults=function(e){this._defaults.forEach((function(t){e[t.fn].apply(e,n(t.args))}))},e.exports=o},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(21),s=r(22);t.backOff=function(e,t){return void 0===t&&(t={}),n(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=i.getSanitizedOptions(t),[4,new a(e,r).execute()];case 1:return[2,n.sent()]}}))}))};var a=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,s.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=n(n({},o),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(23),o=r(27);t.DelayFactory=function(e,t){var r=function(e){if(!e.delayFirstAttempt)return new n.SkipFirstDelay(e);return new o.AlwaysDelay(e)}(e);return r.setAttemptNumber(t),r}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.apply=function(){return i(this,void 0,void 0,(function(){return s(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(r(5).Delay);t.SkipFirstDelay=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25),o=r(26);t.JitterFactory=function(e){switch(e.jitter){case"full":return n.fullJitter;case"none":default:return o.noJitter}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t}(r(5).Delay);t.AlwaysDelay=i}]).default})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GenesysCloudClientLogger=t():e.GenesysCloudClientLogger=t()}(window,(function(){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=6)}([function(e,t){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);e.exports=function(){return r(n),n}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,o=r;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},function(e,t){var r=Object.prototype.hasOwnProperty;function n(e){return"[Throws: "+(e?e.message:"?")+"]"}function o(e){var t=[];return function e(o){if(null===o||"object"!=typeof o)return o;if(-1!==t.indexOf(o))return"[Circular]";if(t.push(o),"function"==typeof o.toJSON)try{var i=e(o.toJSON());return t.pop(),i}catch(e){return n(e)}if(Array.isArray(o)){var s=o.map(e);return t.pop(),s}var a=Object.keys(o).reduce((function(t,i){return t[i]=e(function(e,t){if(r.call(e,t))try{return e[t]}catch(e){return n(e)}return e[t]}(o,i)),t}),{});return t.pop(),a}(e)}e.exports=function(e,t,r){return JSON.stringify(o(e),t,r)},e.exports.ensureProperties=o},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.calculateLogBufferSize=function(e){return e.reduce((function(e,r){return e+t.calculateLogMessageSize(r)}),0)},t.calculateLogMessageSize=function(e){var t=JSON.stringify(e),r=encodeURIComponent(t).match(/%[89ABab]/g);return t.length+(r?r.length:0)},t.getDeferred=function(){var e,t;return{promise:new Promise((function(r,n){e=r,t=n})),resolve:e,reject:t}},t.deepClone=function e(t){if(t){if(Array.isArray(t)){for(var r=[],o=0;o<t.length;o++)r[o]=e(t[o]);return r}if("object"==typeof t){var i=n({},t);for(var s in t)i[s]=e(t[s]);return i}}return t}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e.exports=function(e){return null!==e&&"object"===n(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(24),o=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return n.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,r=this.numOfDelayedAttempts,n=e*Math.pow(t,r);return Math.min(n,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);t.Logger=n.Logger,t.default=n.Logger},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=r(8),a=i(r(2)),u=r(11),c=function(){function e(e){var t=this;this.defaultFormatter=function(e,r,n,o,i){if(o.skipDefaultFormatter)return i();r instanceof Error&&(n=n||r,r=r.message),i(e,r=""+(t.config.appName?"["+t.config.appName+"] ":"")+r,n,o)},this.logMessage=function(e,r,n,o){if(!o.skipSecondaryLogger)try{var i=[r];void 0!==n&&i.push(t.config.stringify?a.default(n):n),t.secondaryLogger[e].apply(t.secondaryLogger,i)}catch(e){console.error("Error logging using custom logger passed into `genesys-cloud-client-logger`",{error:e,secondaryLogger:t.secondaryLogger,message:r,details:n,messageOptions:o})}!o.skipServer&&t.serverLogger&&t.logRank(e)>=t.logRank(t.config.logLevel)&&t.serverLogger.addLogToSend(e,r,n)},Object.defineProperty(this,"clientId",{value:s.v4(),writable:!1}),this.config=n({},e),this.secondaryLogger=this.config.logger||console,delete this.config.logger,-1===this.logRank(this.config.logLevel)&&(e.logLevel&&this.warn('Invalid log level: "'+e.logLevel+'". Default "info" will be used instead.',null,{skipServer:!0}),this.config.logLevel="info"),!e.appName&&e.logTopic&&(this.warn("`logTopic` has been renamed to `appName`. Please use `appName`",null,{skipServer:!0}),this.config.appName=e.logTopic),!1!==this.config.initializeServerLogging&&(this.serverLogger=new u.ServerLogger(this))}return Object.defineProperty(e.prototype,"VERSION",{get:function(){return e.VERSION},enumerable:!0,configurable:!0}),e.prototype.setAccessToken=function(e){this.config.accessToken=e},e.prototype.log=function(e,t,r){this.formatMessage("log",e,t,r)},e.prototype.debug=function(e,t,r){this.formatMessage("debug",e,t,r)},e.prototype.info=function(e,t,r){this.formatMessage("info",e,t,r)},e.prototype.warn=function(e,t,r){this.formatMessage("warn",e,t,r)},e.prototype.error=function(e,t,r){this.formatMessage("error",e,t,r)},e.prototype.formatMessage=function(e,t,r,n){var i=[this.defaultFormatter.bind(this)];this.config.formatters&&(i=o(this.config.formatters,[this.defaultFormatter.bind(this)])),this.callNextFormatter(i,e,t,r,n)},e.prototype.callNextFormatter=function(e,t,r,n,o){var i=this;void 0===o&&(o={});var s=e[0],a=e.slice(1);if(!s)return this.logMessage(t,r,n,o);s(t,r,n,o,(function(e,s,u,c){void 0!==e?i.callNextFormatter(a,e,s,u,c):i.callNextFormatter(a,t,r,n,o)}))},e.prototype.logRank=function(e){switch(e){case"log":return 0;case"debug":return 1;case"info":return 2;case"warn":return 3;case"error":return 4;default:return-1}},e.VERSION="4.0.2",e}();t.Logger=c},function(e,t,r){var n=r(9),o=r(10),i=o;i.v1=n,i.v4=o,e.exports=i},function(e,t,r){var n,o,i=r(0),s=r(1),a=0,u=0;e.exports=function(e,t,r){var c=t&&r||0,l=t||[],p=(e=e||{}).node||n,f=void 0!==e.clockseq?e.clockseq:o;if(null==p||null==f){var h=i();null==p&&(p=n=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==f&&(f=o=16383&(h[6]<<8|h[7]))}var d=void 0!==e.msecs?e.msecs:(new Date).getTime(),y=void 0!==e.nsecs?e.nsecs:u+1,g=d-a+(y-u)/1e4;if(g<0&&void 0===e.clockseq&&(f=f+1&16383),(g<0||d>a)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=d,u=y,o=f;var m=(1e4*(268435455&(d+=122192928e5))+y)%4294967296;l[c++]=m>>>24&255,l[c++]=m>>>16&255,l[c++]=m>>>8&255,l[c++]=255&m;var v=d/4294967296*1e4&268435455;l[c++]=v>>>8&255,l[c++]=255&v,l[c++]=v>>>24&15|16,l[c++]=v>>>16&255,l[c++]=f>>>8|128,l[c++]=255&f;for(var b=0;b<6;++b)l[c+b]=p[b];return t||s(l)}},function(e,t,r){var n=r(0),o=r(1);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||n)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;++a)t[i+a]=s[a];return t||o(s)}},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(2)),a=r(3),u=r(12),c=function(){function e(e){if(this.isInitialized=!1,this.logBuffer=[],this.debounceTimer=null,this.logger=e,!e.config.url||!e.config.appVersion){var t="Missing `url` and/or `appVersion` config options to set up server logging. Not sending logs to server for this logger instance";throw this.logger.error(t,{providedConfig:e.config},{skipServer:!0}),new Error(t)}this.isInitialized=!0,this.debounceLogUploadTime=e.config.uploadDebounceTime||4e3,this.logUploader=u.getOrCreateLogUploader(e.config.url,e.config.debugMode),window.addEventListener("unload",this.sendAllLogsInstantly.bind(this))}return e.prototype.addLogToSend=function(e,t,r){if(this.isInitialized){var n=this.convertToLogMessage(t,r),o=this.convertToTrace(e,n),i=a.calculateLogMessageSize(o);if(i>14500){var s=this.truncateLog(e,n);if(null===s)return void this.logger.error("truncated message is too large to send to server. not sending message",{originalTrace:o,originalTraceSize:a.calculateLogMessageSize(o),truncatedTrace:s,truncatedTraceSize:a.calculateLogMessageSize(s)},{skipServer:!0});i=a.calculateLogMessageSize(s),o=s}var u,c=!this.logBuffer.length;if((u=c?{size:0,traces:[]}:this.logBuffer[this.logBuffer.length-1]).size+i>14500)return this.debug("`exceedsMaxLogSize` was `true`",{logBuffer:this.logBuffer,bufferItem:u,incomingTrace:o,incomingTraceSize:i,maxAllowedTraceSize:14500}),this.logBuffer.push({size:i,traces:[o]}),this.debug("calling sendLogsToServer(true)",{logBuffer:this.logBuffer}),void this.sendLogsToServer(!0);u.size+=i,u.traces.push(o),c&&(this.debug("`this.logBuffer` was empty. pushing new buffer item",{logBuffer:this.logBuffer,bufferItem:u}),this.logBuffer.push(u)),this.debug("calling sendLogsToServer()",{logBuffer:this.logBuffer}),this.sendLogsToServer()}},e.prototype.sendLogsToServer=function(e){return void 0===e&&(e=!1),n(this,void 0,void 0,(function(){var t,r,n=this;return o(this,(function(o){switch(o.label){case 0:if(!this.logBuffer.length)return clearTimeout(this.debounceTimer),this.debounceTimer=null,this.debug("buffer empty, not sending http request"),[2];if(!e)return this.debounceTimer?this.debug("sendLogsToServer() 'immediate' is false. 'debounceTimer' is already running"):(this.debug("sendLogsToServer() 'immediate' is false. setting up 'debounceTimer' to "+this.debounceLogUploadTime+"ms"),this.debounceTimer=setTimeout((function(){return n.sendLogsToServer(!0)}),this.debounceLogUploadTime)),[2];clearTimeout(this.debounceTimer),this.debounceTimer=null,t=this.logBuffer.splice(0,1)[0],o.label=1;case 1:return o.trys.push([1,3,4,5]),this.debug("calling logUploader.postLogsToEndpoint() with",{bufferItem:t,newLogBuffer:this.logBuffer}),[4,this.logUploader.postLogsToEndpoint(this.convertToRequestParams(t.traces.reverse()))];case 2:return o.sent(),[3,5];case 3:return r=o.sent(),this.logger.error("Error sending logs to server",r,{skipServer:!0}),[3,5];case 4:return this.sendLogsToServer(),[7];case 5:return[2]}}))}))},e.prototype.sendAllLogsInstantly=function(){var e=this;return this.logBuffer.forEach((function(t){e.logUploader.postLogsToEndpointInstantly(e.convertToRequestParams(t.traces.reverse()))})),this.logUploader.sendEntireQueue()},e.prototype.truncateLog=function(e,t){var r,n,o=a.calculateLogMessageSize(this.convertToTrace(e,t)),i=a.deepClone(t);return i.details="[[TRUNCATED]]",r=this.convertToTrace(e,i),(n=a.calculateLogMessageSize(r))<=14500?(this.logger.warn("message too large to send to server. truncated log details",{originalLog:t,truncatedLog:i,originalTraceSize:o,truncatedTraceSize:n,maxAllowedTraceSize:14500},{skipServer:!0}),r):(i.message=i.message.substr(0,150)+"... [[TRUNCATED]]",r=this.convertToTrace(e,i),(n=a.calculateLogMessageSize(r))<=14500?(this.logger.warn("message too large to send to server. truncated log details & log message",{originalLog:t,truncatedLog:i,originalTraceSize:o,truncatedTraceSize:n,maxAllowedTraceSize:14500},{skipServer:!0}),r):null)},e.prototype.convertToLogMessage=function(e,t){var r={clientTime:(new Date).toISOString(),clientId:this.logger.clientId,message:e,details:t},n=this.logger.config,o=n.originAppName,i=n.originAppVersion,s=n.originAppId;return o&&(r.originAppName=o,r.originAppVersion=i,r.originAppId=s),r},e.prototype.convertToTrace=function(e,t){return{topic:this.logger.config.appName,level:e.toUpperCase(),message:s.default(t)}},e.prototype.convertToRequestParams=function(e){return{accessToken:this.logger.config.accessToken,app:{appId:this.logger.config.appName,appVersion:this.logger.config.appVersion},traces:e}},e.prototype.debug=function(e,t){this.logger.config.debugMode&&console.log("%c [DEBUG:"+this.logger.config.appName+"] "+e,"color: #32a852",a.deepClone(t))},e}();t.ServerLogger=c},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(r(13)),a=r(20),u=r(3),c=new Map;t.getOrCreateLogUploader=function(e,t){void 0===t&&(t=!1);var r=c.get(e);return r||(r=new l(e,t),c.set(e,r)),r};var l=function(){function e(e,t){void 0===t&&(t=!1),this.url=e,this.debugMode=t,this.hasPendingRequest=!1,this.sendQueue=[]}return e.prototype.postLogsToEndpoint=function(e){return n(this,void 0,void 0,(function(){var t;return o(this,(function(r){return t=u.getDeferred(),this.sendQueue.push({requestParams:e,deferred:t}),this.sendNextQueuedLogToServer(),this.debug("adding requestParams to sendQueue",{requestParams:e,updatedSendQueue:this.sendQueue.map((function(e){return e.requestParams})),hasPendingRequest:this.hasPendingRequest}),[2,t.promise]}))}))},e.prototype.postLogsToEndpointInstantly=function(e){return n(this,void 0,void 0,(function(){return o(this,(function(t){return this.debug("sending request instantly",{requestParams:e,sendQueue:this.sendQueue.map((function(e){return e.requestParams}))}),[2,this.sendPostRequest(e)]}))}))},e.prototype.sendEntireQueue=function(){var e;for(this.debug("sending all queued requests instantly to clear out sendQueue",{sendQueue:this.sendQueue.map((function(e){return e.requestParams}))});e=this.sendQueue.shift();)this.postLogsToEndpoint(e.requestParams)},e.prototype.sendNextQueuedLogToServer=function(){return n(this,void 0,void 0,(function(){var e,t=this;return o(this,(function(r){return this.hasPendingRequest||0===this.sendQueue.length?(this.debug("sendNextQueuedLogToServer() but not sending request",{hasPendingRequest:this.hasPendingRequest,sendQueueLength:this.sendQueue.length}),[2]):((e=this.sendQueue.shift()).deferred.promise.finally((function(){t.debug("queue item completed. removing from queue and resetting send queue",{queueItemRequestParams:e.requestParams,updatedSendQueue:t.sendQueue.map((function(e){return e.requestParams}))}),t.hasPendingRequest=!1,t.sendNextQueuedLogToServer()})),this.hasPendingRequest=!0,this.debug("sending logs to server",{queueItem:e.requestParams,sendQueue:this.sendQueue.map((function(e){return e.requestParams}))}),[2,a.backOff((function(){return t.sendPostRequest(e.requestParams)}),{retry:function(e){return e&&429===e.status},numOfAttempts:10,startingDelay:0,delayFirstAttempt:!1,maxDelay:15e3}).then((function(r){t.debug("successfully sent logs to server",{requestParams:e.requestParams,response:r}),e.deferred.resolve(r)})).catch((function(r){return t.debug("ERROR sending logs to server",{requestParams:e.requestParams,error:r}),e.deferred.reject(r)}))])}))}))},e.prototype.sendPostRequest=function(e){return this.debug("issuing POST request",{requestParams:e}),s.default.post(this.url).set("Authorization","Bearer "+e.accessToken).type("application/json; charset=UTF-8").send(e)},e.prototype.debug=function(e,t){this.debugMode&&console.log("%c [DEBUG:log-uploader] "+e,"color: #32a0a8",u.deepClone(t))},e}();t.LogUploader=l},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o;"undefined"!=typeof window?o=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),o=void 0):o=self;var i=r(14),s=r(15),a=r(16),u=r(4),c=r(17),l=r(19);function p(){}e.exports=function(e,r){return"function"==typeof r?new t.Request("GET",e).end(r):1===arguments.length?new t.Request("GET",e):new t.Request(e,r)};var f=t=e.exports;t.Request=b,f.getXHR=function(){if(o.XMLHttpRequest&&(!o.location||"file:"!==o.location.protocol||!o.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("Browser-only version of superagent could not find XHR")};var h="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function d(e){if(!u(e))return e;var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&y(t,r,e[r]);return t.join("&")}function y(e,t,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))r.forEach((function(r){y(e,t,r)}));else if(u(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&y(e,"".concat(t,"[").concat(n,"]"),r[n]);else e.push(encodeURI(t)+"="+encodeURIComponent(r));else e.push(encodeURI(t))}function g(e){for(var t,r,n={},o=e.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(t=o[i]).indexOf("="))?n[decodeURIComponent(t)]="":n[decodeURIComponent(t.slice(0,r))]=decodeURIComponent(t.slice(r+1));return n}function m(e){return/[/+]json($|[^-\w])/.test(e)}function v(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){for(var t,r,n,o,i=e.split(/\r?\n/),s={},a=0,u=i.length;a<u;++a)-1!==(t=(r=i[a]).indexOf(":"))&&(n=r.slice(0,t).toLowerCase(),o=h(r.slice(t+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function b(e,t){var r=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,n=null;try{n=new v(r)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,r.xhr?(t.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,t.status=r.xhr.status?r.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),r.callback(t)}r.emit("response",n);try{r._isResponseOK(n)||(e=new Error(n.statusText||n.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=n,e.status=n.status,r.callback(e,n)):r.callback(null,n)}))}function _(e,t,r){var n=f("DELETE",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}f.serializeObject=d,f.parseString=g,f.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},f.serialize={"application/x-www-form-urlencoded":d,"application/json":s},f.parse={"application/x-www-form-urlencoded":g,"application/json":JSON.parse},c(v.prototype),v.prototype._parseBody=function(e){var t=f.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&m(this.type)&&(t=f.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},v.prototype.toError=function(){var e=this.req,t=e.method,r=e.url,n="cannot ".concat(t," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=t,o.url=r,o},f.Response=v,i(b.prototype),a(b.prototype),b.prototype.type=function(e){return this.set("Content-Type",f.types[e]||e),this},b.prototype.accept=function(e){return this.set("Accept",f.types[e]||e),this},b.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===n(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,o)},b.prototype.query=function(e){return"string"!=typeof e&&(e=d(e)),e&&this._query.push(e),this},b.prototype.attach=function(e,t,r){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,r||t.name)}return this},b.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},b.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var r=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),r(e,t)},b.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},b.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},b.prototype.ca=b.prototype.agent,b.prototype.buffer=b.prototype.ca,b.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},b.prototype.pipe=b.prototype.write,b.prototype._isHost=function(e){return e&&"object"===n(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},b.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||p,this._finalizeQueryString(),this._end()},b.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},b.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=f.getXHR();var t=this.xhr,r=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var r=t.readyState;if(r>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(e._uploadTimeoutTimer)),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.addEventListener("progress",n.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",n.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||f.serialize[o?o.split(";")[0]:""];!i&&m(o)&&(i=f.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===r?null:r)},f.agent=function(){return new l},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){l.prototype[e.toLowerCase()]=function(t,r){var n=new f.Request(e,t);return this._setDefaults(n),r&&n.end(r),n}})),l.prototype.del=l.prototype.delete,f.get=function(e,t,r){var n=f("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},f.head=function(e,t,r){var n=f("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},f.options=function(e,t,r){var n=f("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},f.del=_,f.delete=_,f.patch=function(e,t,r){var n=f("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},f.post=function(e,t,r){var n=f("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},f.put=function(e,t,r){var n=f("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},function(e,t,r){function n(e){if(e)return function(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}(e)}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<n.length;o++)if((r=n[o])===t||r.fn===t){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t){e.exports=o,o.default=o,o.stable=s,o.stableStringify=s;var r=[],n=[];function o(e,t,o){var i;for(!function e(t,o,i,s){var a;if("object"==typeof t&&null!==t){for(a=0;a<i.length;a++)if(i[a]===t){var u=Object.getOwnPropertyDescriptor(s,o);return void(void 0!==u.get?u.configurable?(Object.defineProperty(s,o,{value:"[Circular]"}),r.push([s,o,t,u])):n.push([t,o]):(s[o]="[Circular]",r.push([s,o,t])))}if(i.push(t),Array.isArray(t))for(a=0;a<t.length;a++)e(t[a],a,i,t);else{var c=Object.keys(t);for(a=0;a<c.length;a++){var l=c[a];e(t[l],l,i,t)}}i.pop()}}(e,"",[],void 0),i=0===n.length?JSON.stringify(e,t,o):JSON.stringify(e,a(t),o);0!==r.length;){var s=r.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}return i}function i(e,t){return e<t?-1:e>t?1:0}function s(e,t,o){var s,u=function e(t,o,s,a){var u;if("object"==typeof t&&null!==t){for(u=0;u<s.length;u++)if(s[u]===t){var c=Object.getOwnPropertyDescriptor(a,o);return void(void 0!==c.get?c.configurable?(Object.defineProperty(a,o,{value:"[Circular]"}),r.push([a,o,t,c])):n.push([t,o]):(a[o]="[Circular]",r.push([a,o,t])))}if("function"==typeof t.toJSON)return;if(s.push(t),Array.isArray(t))for(u=0;u<t.length;u++)e(t[u],u,s,t);else{var l={},p=Object.keys(t).sort(i);for(u=0;u<p.length;u++){var f=p[u];e(t[f],f,s,t),l[f]=t[f]}if(void 0===a)return l;r.push([a,o,t]),a[o]=l}s.pop()}}(e,"",[],void 0)||e;for(s=0===n.length?JSON.stringify(u,t,o):JSON.stringify(u,a(t),o);0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}return s}function a(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var o=0;o<n.length;o++){var i=n[o];if(i[1]===t&&i[0]===r){r="[Circular]",n.splice(o,1);break}}return e.call(this,t,r)}}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=r(4);function i(e){if(e)return function(e){for(var t in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,t)&&(e[t]=i.prototype[t]);return e}(e)}e.exports=i,i.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},i.prototype.parse=function(e){return this._parser=e,this},i.prototype.responseType=function(e){return this._responseType=e,this},i.prototype.serialize=function(e){return this._serializer=e,this},i.prototype.timeout=function(e){if(!e||"object"!==n(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},i.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var s=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];i.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(e,t);if(!0===r)return!0;if(!1===r)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!==t.status)return!0;if(e){if(e.code&&s.includes(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},i.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},i.prototype.then=function(e,t){var r=this;if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){n.on("abort",(function(){if(r.timedout&&r.timedoutError)t(r.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=r.status,e.method=r.method,e.url=r.url,t(e)}})),n.end((function(r,n){r?t(r):e(n)}))}))}return this._fullfilledPromise.then(e,t)},i.prototype.catch=function(e){return this.then(void 0,e)},i.prototype.use=function(e){return e(this),this},i.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},i.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},i.prototype.get=function(e){return this._header[e.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(e,t){if(o(e)){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},i.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},i.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(o(e)){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.field(r,e[r]);return this}if(Array.isArray(t)){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&this.field(e,t[n]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),this._getFormData().append(e,t),this},i.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},i.prototype._auth=function(e,t,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},i.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},i.prototype.redirects=function(e){return this._maxRedirects=e,this},i.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(e){var t=o(e),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&o(this._data))for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._data[n]=e[n]);else"string"==typeof e?(r||this.type("form"),r=this._header["content-type"],this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||r||this.type("json"),this},i.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},i.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.slice(t+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.slice(0,t)+"?"+r.join("&")}}},i.prototype._appendQueryString=function(){console.warn("Unsupported")},i.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error("".concat(e+t,"ms exceeded"));n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.timedoutError=n,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))}},function(e,t,r){"use strict";var n=r(18);function o(e){if(e)return function(e){for(var t in o.prototype)Object.prototype.hasOwnProperty.call(o.prototype,t)&&(e[t]=o.prototype[t]);return e}(e)}e.exports=o,o.prototype.get=function(e){return this.header[e.toLowerCase()]},o.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=n.type(t);var r=n.params(t);for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(this[o]=r[o]);this.links={};try{e.link&&(this.links=n.parseLinks(e.link))}catch(e){}},o.prototype._setStatusProperties=function(e){var t=e/100|0;this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e}},function(e,t,r){"use strict";t.type=function(e){return e.split(/ *; */).shift()},t.params=function(e){return e.split(/ *; */).reduce((function(e,t){var r=t.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(e[n]=o),e}),{})},t.parseLinks=function(e){return e.split(/ *, */).reduce((function(e,t){var r=t.split(/ *; */),n=r[0].slice(1,-1);return e[r[1].split(/ *= */)[1].slice(1,-1)]=n,e}),{})},t.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e}},function(e,t,r){"use strict";function n(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach((function(e){o.prototype[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return this._defaults.push({fn:e,args:r}),this}})),o.prototype._setDefaults=function(e){this._defaults.forEach((function(t){e[t.fn].apply(e,n(t.args))}))},e.exports=o},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(21),s=r(22);t.backOff=function(e,t){return void 0===t&&(t={}),n(this,void 0,void 0,(function(){var r;return o(this,(function(n){switch(n.label){case 0:return r=i.getSanitizedOptions(t),[4,new a(e,r).execute()];case 1:return[2,n.sent()]}}))}))};var a=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return n(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return n(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,s.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=n(n({},o),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(23),o=r(27);t.DelayFactory=function(e,t){var r=function(e){if(!e.delayFirstAttempt)return new n.SkipFirstDelay(e);return new o.AlwaysDelay(e)}(e);return r.setAttemptNumber(t),r}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.apply=function(){return i(this,void 0,void 0,(function(){return s(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(r(5).Delay);t.SkipFirstDelay=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25),o=r(26);t.JitterFactory=function(e){switch(e.jitter){case"full":return n.fullJitter;case"none":default:return o.noJitter}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t}(r(5).Delay);t.AlwaysDelay=i}]).default})); | ||
//# sourceMappingURL=genesys-cloud-client-logger.min.js.map |
@@ -8,2 +8,4 @@ import { ILoggerConfig, ILogger } from './interfaces'; | ||
private secondaryLogger; | ||
static VERSION: string; | ||
get VERSION(): string; | ||
constructor(config: ILoggerConfig); | ||
@@ -10,0 +12,0 @@ setAccessToken(token: string): void; |
@@ -28,2 +28,3 @@ "use strict"; | ||
var Logger = /** @class */ (function () { | ||
/* eslint-enable @typescript-eslint/naming-convention */ | ||
function Logger(config) { | ||
@@ -89,2 +90,9 @@ var _this = this; | ||
} | ||
Object.defineProperty(Logger.prototype, "VERSION", { | ||
get: function () { | ||
return Logger.VERSION; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Logger.prototype.setAccessToken = function (token) { | ||
@@ -149,4 +157,6 @@ this.config.accessToken = token; | ||
}; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
Logger.VERSION = '4.0.2'; | ||
return Logger; | ||
}()); | ||
exports.Logger = Logger; |
134
package.json
{ | ||
"name": "genesys-cloud-client-logger", | ||
"version":"4.0.1", | ||
"description": "Common logger for genesys cloud client application to upload logs server", | ||
"main": "dist/src/index.js", | ||
"module": "dist/es/index.js", | ||
"web": "dist/genesys-cloud-client-logger.min.js", | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf dist", | ||
"start": "npm run build:dev && npm run test:server", | ||
"build": "npm run clean && npm run build:es && npm run build:cjs && npm run build:web", | ||
"build:es": "tsc -p . --outDir ./dist/es --target es2015 --module es2015", | ||
"build:cjs": "tsc -p .", | ||
"build:web": "webpack --env.production", | ||
"build:dev": "npm run clean && tsc -p . && webpack", | ||
"lint": "eslint -c .eslintrc.js --ext .ts src", | ||
"lint:fix": "npm run lint -- --fix", | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "jest --collectCoverage", | ||
"test:watch": "jest --watch --collectCoverage=false --runInBand", | ||
"test:server": "stupid-server -s" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"pre-push": [ | ||
"test" | ||
], | ||
"author": "garrett.jensen@genesys.com", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-transform-runtime": "^7.9.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"@types/jest": "^25.2.1", | ||
"@types/safe-json-stringify": "^1.1.0", | ||
"@types/superagent": "^4.1.7", | ||
"@types/uuid": "^7.0.3", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"babel-loader": "^8.1.0", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-jsdoc": "^36.1.0", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"jest": "^25.4.0", | ||
"nock": "^13.0.11", | ||
"pre-push": "^0.1.1", | ||
"rimraf": "^3.0.2", | ||
"stupid-server": "^0.2.5", | ||
"ts-jest": "^25.4.0", | ||
"ts-loader": "^7.0.1", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.46.0", | ||
"webpack-cli": "^3.3.11" | ||
}, | ||
"dependencies": { | ||
"@babel/preset-typescript": "^7.9.0", | ||
"@babel/runtime": "^7.9.2", | ||
"exponential-backoff": "^3.1.0", | ||
"safe-json-stringify": "^1.2.0", | ||
"superagent": "^5.2.2", | ||
"uuid": "^3.4.0" | ||
} | ||
} | ||
"name": "genesys-cloud-client-logger", | ||
"version": "4.0.2-develop.4", | ||
"description": "Common logger for genesys cloud client application to upload logs server", | ||
"main": "dist/src/index.js", | ||
"module": "dist/es/index.js", | ||
"web": "dist/genesys-cloud-client-logger.min.js", | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf dist", | ||
"start": "npm run build:dev && npm run test:server", | ||
"build": "ts-node scripts/build.ts", | ||
"build:es": "tsc -p . --outDir ./dist/es --target es2015 --module es2015", | ||
"build:cjs": "tsc -p .", | ||
"build:dev": "npm run clean && tsc -p . && webpack", | ||
"build:cdn": "webpack --env.development && webpack --env.production", | ||
"build:manifest": "ts-node scripts/build-cdn-with-manifest.ts", | ||
"lint": "eslint -c .eslintrc.js --ext .ts src", | ||
"lint:fix": "npm run lint -- --fix", | ||
"test": "npm run lint && npm run test:unit", | ||
"test:unit": "jest --collectCoverage", | ||
"test:watch": "jest --watch --collectCoverage=false --runInBand", | ||
"test:server": "stupid-server -s" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"pre-push": [ | ||
"test" | ||
], | ||
"author": "garrett.jensen@genesys.com", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@babel/core": "^7.9.0", | ||
"@babel/plugin-transform-runtime": "^7.9.0", | ||
"@babel/preset-env": "^7.9.5", | ||
"@types/jest": "^25.2.1", | ||
"@types/safe-json-stringify": "^1.1.0", | ||
"@types/superagent": "^4.1.7", | ||
"@types/uuid": "^7.0.3", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"babel-loader": "^8.1.0", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-jsdoc": "^36.1.0", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
"jest": "^25.4.0", | ||
"nock": "^13.0.11", | ||
"pre-push": "^0.1.1", | ||
"rimraf": "^3.0.2", | ||
"stupid-server": "^0.2.5", | ||
"ts-jest": "^25.4.0", | ||
"ts-loader": "^7.0.1", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^3.8.3", | ||
"webpack": "^4.46.0", | ||
"webpack-cli": "^3.3.11" | ||
}, | ||
"dependencies": { | ||
"@babel/preset-typescript": "^7.9.0", | ||
"@babel/runtime": "^7.9.2", | ||
"exponential-backoff": "^3.1.0", | ||
"safe-json-stringify": "^1.2.0", | ||
"superagent": "^5.2.2", | ||
"uuid": "^3.4.0" | ||
} | ||
} |
@@ -8,6 +8,21 @@ # Genesys Cloud Client Logger | ||
Using a package manager: | ||
``` sh | ||
npm install genesys-cloud-client-logger | ||
# Or via yarn | ||
yarn add genesys-cloud-client-logger | ||
``` | ||
Or directly from the CDN: | ||
``` html | ||
<!-- specify desired major version to receive minor and patch version updates --> | ||
<script src="https://apps.mypurecloud.com/genesys-cloud-client-logger/v4/genesys-cloud-client-logger.min.js"></script> | ||
<!-- OR, specify an exact version --> | ||
<script src="https://apps.mypurecloud.com/genesys-cloud-client-logger/v4.0.1/genesys-cloud-client-logger.min.js"></script> | ||
``` | ||
> Note: the **major** and **exact** versions were added in `v4.0.2`. The version hosted at `.../genesys-cloud-client-logger/genesys-cloud-client-logger.min.js` | ||
> will always remain as `v4.0.1` to avoid breaking changes. However, it is strongly recommended that you upgrade to use a major version URL. | ||
### Basic Concept | ||
@@ -155,4 +170,4 @@ Each Logger instance will have it's own configuration meaning you can have multiple apps using their own individual loggers. One thing to note is the loggers | ||
you have an error that has the potential to expose or send information that is unfit to | ||
be exposed. In a formatter, you can choose to manipulate the message or details, do | ||
nothing, or skip logging the message entirely. A formatter will be provided a `next` | ||
be exposed. In a formatter, you can choose to manipulate the message or details, do | ||
nothing, or skip logging the message entirely. A formatter will be provided a `next` | ||
function in addition to the log message. If next is not called, the log will not be forwarded | ||
@@ -169,3 +184,3 @@ to downstream formatters and will not make it to the actual logger. Example: | ||
) { | ||
// we want to only log this to the secondary logger (usually the console) and not send this | ||
// we want to only log this to the secondary logger (usually the console) and not send this | ||
// specific log to the server | ||
@@ -172,0 +187,0 @@ if (message.includes('[confidential]')) { |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2633846
41
14117
216
24
2
1