@microsoft/applicationinsights-core-js
Advanced tools
Comparing version 1.0.0-beta.4 to 1.0.0-beta.5
/*! | ||
* Application Insights JavaScript SDK - Core, 1.0.0-beta.4 | ||
* Application Insights JavaScript SDK - Core, 1.0.0-beta.5 | ||
* Copyright (c) Microsoft and contributors. All rights reserved. | ||
@@ -515,5 +515,5 @@ */ | ||
} | ||
if (!telemetryItem.ikey) { | ||
// setup default ikey if not passed in | ||
telemetryItem.ikey = this.config.instrumentationKey; | ||
if (!telemetryItem.iKey) { | ||
// setup default iKey if not passed in | ||
telemetryItem.iKey = this.config.instrumentationKey; | ||
} | ||
@@ -570,3 +570,3 @@ if (!telemetryItem.time) { | ||
name: "InternalMessageId: " + logMessage.messageId, | ||
ikey: _this.config.instrumentationKey, | ||
iKey: _this.config.instrumentationKey, | ||
time: new Date().toISOString(), | ||
@@ -590,3 +590,3 @@ baseType: _InternalLogMessage.dataType, | ||
} | ||
if (CoreUtils.isNullOrUndefined(telemetryItem.ikey)) { | ||
if (CoreUtils.isNullOrUndefined(telemetryItem.iKey)) { | ||
this._notifiyInvalidEvent(telemetryItem); | ||
@@ -593,0 +593,0 @@ throw Error("telemetry instrumentationKey required"); |
/*! | ||
* Application Insights JavaScript SDK - Core, 1.0.0-beta.4 | ||
* Application Insights JavaScript SDK - Core, 1.0.0-beta.5 | ||
* Copyright (c) Microsoft and contributors. All rights reserved. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).aicore={})}(this,function(a){"use strict";var e,t={Unknown:0,NonRetryableStatus:1,InvalidEvent:2,SizeLimitExceeded:3,KillSwitch:4,QueueFull:5},c=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g,f=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,o=0;o<this.listeners.length;++o)e(o)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){o.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},o=this,r=0;r<this.listeners.length;++r)e(r)},e}();(e=a.LoggingSeverity||(a.LoggingSeverity={}))[e.CRITICAL=1]="CRITICAL",e[e.WARNING=2]="WARNING";var s={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69},l=function(){function r(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(i?" props:"+r.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),u=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,o){void 0===o&&(o=!1);var r=new l(t,n,o,i);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var s=+r.messageId;(!this._messageLogged[s]||this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[s]=!0)}else this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new l(s.MessageLimitPerPVExceeded,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),i=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new o}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||c.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new f,this.config.extensions=c.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=c.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new u(e),t.forEach(function(e){if(c.isNullOrUndefined(e.initialize))throw Error(g)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){c.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(g)}(r=this._extensions).push.apply(r,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,o=typeof n.processTelemetry,r=typeof i.processTelemetry;return"function"===o&&"function"===r?n.priority-i.priority:"function"===o&&"function"!==r?1:"function"!==o&&"function"===r?-1:void 0});var o={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(c.isNullOrUndefined(o[t.priority])?o[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+o[t.priority]+", "+t.identifier))});for(var r,s=-1,a=0;a<this._extensions.length-1;a++){var l=this._extensions[a];if(!l||"function"==typeof l.processTelemetry){if(l.priority===h){s=a+1;break}this._extensions[a].setNextPlugin(this._extensions[a+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<h&&e.initialize(n.config,n,n._extensions)}),s<this._extensions.length&&this._extensions.splice(s),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.ikey||(e.ikey=this.config.instrumentationKey),e.time||(e.time=(new Date).toISOString()),c.isNullOrUndefined(e.ver)&&(e.ver="4.0"),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this,e=this.config.diagnosticLogInterval;return 0<e||(e=1e4),setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,ikey:n.config.instrumentationKey,time:(new Date).toISOString(),baseType:l.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},e)},e.prototype._validateTelmetryItem=function(e){if(c.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(c.isNullOrUndefined(e.time))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(c.isNullOrUndefined(e.ikey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],t.InvalidEvent)},e}(),o=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=h}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,o){var r=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<o.length;t++){var s=o[t];s.priority>h&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),g="Extensions must provide callback to initialize",h=200;a.MinChannelPriorty=100,a.EventsDiscardedReason=t,a.AppInsightsCore=i,a.CoreUtils=c,a.NotificationManager=f,a.DiagnosticLogger=u,a._InternalLogMessage=l,a._InternalMessageId=s,Object.defineProperty(a,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).aicore={})}(this,function(a){"use strict";var e,t={Unknown:0,NonRetryableStatus:1,InvalidEvent:2,SizeLimitExceeded:3,KillSwitch:4,QueueFull:5},c=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g,f=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,o=0;o<this.listeners.length;++o)e(o)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){o.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},o=this,r=0;r<this.listeners.length;++r)e(r)},e}();(e=a.LoggingSeverity||(a.LoggingSeverity={}))[e.CRITICAL=1]="CRITICAL",e[e.WARNING=2]="WARNING";var s={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69},l=function(){function r(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(i?" props:"+r.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),u=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,o){void 0===o&&(o=!1);var r=new l(t,n,o,i);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var s=+r.messageId;(!this._messageLogged[s]||this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[s]=!0)}else this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new l(s.MessageLimitPerPVExceeded,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),i=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new o}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||c.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new f,this.config.extensions=c.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=c.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new u(e),t.forEach(function(e){if(c.isNullOrUndefined(e.initialize))throw Error(g)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){c.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(g)}(r=this._extensions).push.apply(r,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,o=typeof n.processTelemetry,r=typeof i.processTelemetry;return"function"===o&&"function"===r?n.priority-i.priority:"function"===o&&"function"!==r?1:"function"!==o&&"function"===r?-1:void 0});var o={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(c.isNullOrUndefined(o[t.priority])?o[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+o[t.priority]+", "+t.identifier))});for(var r,s=-1,a=0;a<this._extensions.length-1;a++){var l=this._extensions[a];if(!l||"function"==typeof l.processTelemetry){if(l.priority===h){s=a+1;break}this._extensions[a].setNextPlugin(this._extensions[a+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<h&&e.initialize(n.config,n,n._extensions)}),s<this._extensions.length&&this._extensions.splice(s),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.iKey||(e.iKey=this.config.instrumentationKey),e.time||(e.time=(new Date).toISOString()),c.isNullOrUndefined(e.ver)&&(e.ver="4.0"),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this,e=this.config.diagnosticLogInterval;return 0<e||(e=1e4),setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,iKey:n.config.instrumentationKey,time:(new Date).toISOString(),baseType:l.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},e)},e.prototype._validateTelmetryItem=function(e){if(c.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(c.isNullOrUndefined(e.time))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(c.isNullOrUndefined(e.iKey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],t.InvalidEvent)},e}(),o=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=h}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,o){var r=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<o.length;t++){var s=o[t];s.priority>h&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),g="Extensions must provide callback to initialize",h=200;a.MinChannelPriorty=100,a.EventsDiscardedReason=t,a.AppInsightsCore=i,a.CoreUtils=c,a.NotificationManager=f,a.DiagnosticLogger=u,a._InternalLogMessage=l,a._InternalMessageId=s,Object.defineProperty(a,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-core-js.min.js.map |
@@ -128,5 +128,5 @@ import { EventsDiscardedReason } from "../JavaScriptSDK.Enums/EventsDiscardedReason"; | ||
} | ||
if (!telemetryItem.ikey) { | ||
// setup default ikey if not passed in | ||
telemetryItem.ikey = this.config.instrumentationKey; | ||
if (!telemetryItem.iKey) { | ||
// setup default iKey if not passed in | ||
telemetryItem.iKey = this.config.instrumentationKey; | ||
} | ||
@@ -183,3 +183,3 @@ if (!telemetryItem.time) { | ||
name: "InternalMessageId: " + logMessage.messageId, | ||
ikey: _this.config.instrumentationKey, | ||
iKey: _this.config.instrumentationKey, | ||
time: new Date().toISOString(), | ||
@@ -203,3 +203,3 @@ baseType: _InternalLogMessage.dataType, | ||
} | ||
if (CoreUtils.isNullOrUndefined(telemetryItem.ikey)) { | ||
if (CoreUtils.isNullOrUndefined(telemetryItem.iKey)) { | ||
this._notifiyInvalidEvent(telemetryItem); | ||
@@ -206,0 +206,0 @@ throw Error("telemetry instrumentationKey required"); |
/*! | ||
* Application Insights JavaScript SDK - Core, 1.0.0-beta.4 | ||
* Application Insights JavaScript SDK - Core, 1.0.0-beta.5 | ||
* Copyright (c) Microsoft and contributors. All rights reserved. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).aicore={})}(this,function(a){"use strict";var e,t={Unknown:0,NonRetryableStatus:1,InvalidEvent:2,SizeLimitExceeded:3,KillSwitch:4,QueueFull:5},c=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g,f=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,o=0;o<this.listeners.length;++o)e(o)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){o.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},o=this,r=0;r<this.listeners.length;++r)e(r)},e}();(e=a.LoggingSeverity||(a.LoggingSeverity={}))[e.CRITICAL=1]="CRITICAL",e[e.WARNING=2]="WARNING";var s={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69},l=function(){function r(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(i?" props:"+r.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),u=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,o){void 0===o&&(o=!1);var r=new l(t,n,o,i);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var s=+r.messageId;(!this._messageLogged[s]||this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[s]=!0)}else this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new l(s.MessageLimitPerPVExceeded,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),i=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new o}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||c.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new f,this.config.extensions=c.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=c.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new u(e),t.forEach(function(e){if(c.isNullOrUndefined(e.initialize))throw Error(g)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){c.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(g)}(r=this._extensions).push.apply(r,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,o=typeof n.processTelemetry,r=typeof i.processTelemetry;return"function"===o&&"function"===r?n.priority-i.priority:"function"===o&&"function"!==r?1:"function"!==o&&"function"===r?-1:void 0});var o={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(c.isNullOrUndefined(o[t.priority])?o[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+o[t.priority]+", "+t.identifier))});for(var r,s=-1,a=0;a<this._extensions.length-1;a++){var l=this._extensions[a];if(!l||"function"==typeof l.processTelemetry){if(l.priority===h){s=a+1;break}this._extensions[a].setNextPlugin(this._extensions[a+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<h&&e.initialize(n.config,n,n._extensions)}),s<this._extensions.length&&this._extensions.splice(s),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.ikey||(e.ikey=this.config.instrumentationKey),e.time||(e.time=(new Date).toISOString()),c.isNullOrUndefined(e.ver)&&(e.ver="4.0"),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this,e=this.config.diagnosticLogInterval;return 0<e||(e=1e4),setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,ikey:n.config.instrumentationKey,time:(new Date).toISOString(),baseType:l.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},e)},e.prototype._validateTelmetryItem=function(e){if(c.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(c.isNullOrUndefined(e.time))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(c.isNullOrUndefined(e.ikey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],t.InvalidEvent)},e}(),o=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=h}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,o){var r=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<o.length;t++){var s=o[t];s.priority>h&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),g="Extensions must provide callback to initialize",h=200;a.MinChannelPriorty=100,a.EventsDiscardedReason=t,a.AppInsightsCore=i,a.CoreUtils=c,a.NotificationManager=f,a.DiagnosticLogger=u,a._InternalLogMessage=l,a._InternalMessageId=s,Object.defineProperty(a,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).aicore={})}(this,function(a){"use strict";var e,t={Unknown:0,NonRetryableStatus:1,InvalidEvent:2,SizeLimitExceeded:3,KillSwitch:4,QueueFull:5},c=function(){function e(){}return e.isNullOrUndefined=function(e){return null==e},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(n,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},e}(),n=/[xy]/g,f=function(){function e(){this.listeners=[]}return e.prototype.addNotificationListener=function(e){this.listeners.push(e)},e.prototype.removeNotificationListener=function(e){for(var t=this.listeners.indexOf(e);-1<t;)this.listeners.splice(t,1),t=this.listeners.indexOf(e)},e.prototype.eventsSent=function(t){for(var n=this,e=function(e){i.listeners[e].eventsSent&&setTimeout(function(){return n.listeners[e].eventsSent(t)},0)},i=this,o=0;o<this.listeners.length;++o)e(o)},e.prototype.eventsDiscarded=function(t,n){for(var i=this,e=function(e){o.listeners[e].eventsDiscarded&&setTimeout(function(){return i.listeners[e].eventsDiscarded(t,n)},0)},o=this,r=0;r<this.listeners.length;++r)e(r)},e}();(e=a.LoggingSeverity||(a.LoggingSeverity={}))[e.CRITICAL=1]="CRITICAL",e[e.WARNING=2]="WARNING";var s={BrowserDoesNotSupportLocalStorage:0,BrowserCannotReadLocalStorage:1,BrowserCannotReadSessionStorage:2,BrowserCannotWriteLocalStorage:3,BrowserCannotWriteSessionStorage:4,BrowserFailedRemovalFromLocalStorage:5,BrowserFailedRemovalFromSessionStorage:6,CannotSendEmptyTelemetry:7,ClientPerformanceMathError:8,ErrorParsingAISessionCookie:9,ErrorPVCalc:10,ExceptionWhileLoggingError:11,FailedAddingTelemetryToBuffer:12,FailedMonitorAjaxAbort:13,FailedMonitorAjaxDur:14,FailedMonitorAjaxOpen:15,FailedMonitorAjaxRSC:16,FailedMonitorAjaxSend:17,FailedMonitorAjaxGetCorrelationHeader:18,FailedToAddHandlerForOnBeforeUnload:19,FailedToSendQueuedTelemetry:20,FailedToReportDataLoss:21,FlushFailed:22,MessageLimitPerPVExceeded:23,MissingRequiredFieldSpecification:24,NavigationTimingNotSupported:25,OnError:26,SessionRenewalDateIsZero:27,SenderNotInitialized:28,StartTrackEventFailed:29,StopTrackEventFailed:30,StartTrackFailed:31,StopTrackFailed:32,TelemetrySampledAndNotSent:33,TrackEventFailed:34,TrackExceptionFailed:35,TrackMetricFailed:36,TrackPVFailed:37,TrackPVFailedCalc:38,TrackTraceFailed:39,TransmissionFailed:40,FailedToSetStorageBuffer:41,FailedToRestoreStorageBuffer:42,InvalidBackendResponse:43,FailedToFixDepricatedValues:44,InvalidDurationValue:45,TelemetryEnvelopeInvalid:46,CreateEnvelopeError:47,CannotSerializeObject:48,CannotSerializeObjectNonSerializable:49,CircularReferenceDetected:50,ClearAuthContextFailed:51,ExceptionTruncated:52,IllegalCharsInName:53,ItemNotInArray:54,MaxAjaxPerPVExceeded:55,MessageTruncated:56,NameTooLong:57,SampleRateOutOfRange:58,SetAuthContextFailed:59,SetAuthContextFailedAccountName:60,StringValueTooLong:61,StartCalledMoreThanOnce:62,StopCalledWithoutStart:63,TelemetryInitializerFailed:64,TrackArgumentsNotSpecified:65,UrlTooLong:66,SessionStorageBufferFull:67,CannotAccessCookie:68,IdTooLong:69},l=function(){function r(e,t,n,i){void 0===n&&(n=!1),this.messageId=e,this.message=(n?r.AiUserActionablePrefix:r.AiNonUserActionablePrefix)+e;var o=(t?" message:"+r.sanitizeDiagnosticText(t):"")+(i?" props:"+r.sanitizeDiagnosticText(JSON.stringify(i)):"");this.message+=o}return r.sanitizeDiagnosticText=function(e){return'"'+e.replace(/\"/g,"")+'"'},r.dataType="MessageData",r.AiNonUserActionablePrefix="AI (Internal): ",r.AiUserActionablePrefix="AI: ",r}(),u=function(){function e(e){this.AIInternalMessagePrefix="AITR_",this.enableDebugExceptions=function(){return!1},this.consoleLoggingLevel=function(){return 1},this.telemetryLoggingLevel=function(){return 0},this.maxInternalMessageLimit=function(){return 25},this.queue=[],this._messageCount=0,this._messageLogged={},c.isNullOrUndefined(e)||(c.isNullOrUndefined(e.loggingLevelConsole)||(this.consoleLoggingLevel=function(){return e.loggingLevelConsole}),c.isNullOrUndefined(e.loggingLevelTelemetry)||(this.telemetryLoggingLevel=function(){return e.loggingLevelTelemetry}),c.isNullOrUndefined(e.maxMessageLimit)||(this.maxInternalMessageLimit=function(){return e.maxMessageLimit}),c.isNullOrUndefined(e.enableDebugExceptions)||(this.enableDebugExceptions=function(){return e.enableDebugExceptions}))}return e.prototype.throwInternal=function(e,t,n,i,o){void 0===o&&(o=!1);var r=new l(t,n,o,i);if(this.enableDebugExceptions())throw r;if(void 0!==r&&r&&void 0!==r.message){if(o){var s=+r.messageId;(!this._messageLogged[s]||this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING)&&(this.warnToConsole(r.message),this._messageLogged[s]=!0)}else this.consoleLoggingLevel()>=a.LoggingSeverity.WARNING&&this.warnToConsole(r.message);this.logInternalMessage(e,r)}},e.prototype.warnToConsole=function(e){"undefined"!=typeof console&&console&&("function"==typeof console.warn?console.warn(e):"function"==typeof console.log&&console.log(e))},e.prototype.resetInternalMessageCount=function(){this._messageCount=0,this._messageLogged={}},e.prototype.logInternalMessage=function(e,t){if(!this._areInternalMessagesThrottled()){var n=!0,i=this.AIInternalMessagePrefix+t.messageId;if(this._messageLogged[i]?n=!1:this._messageLogged[i]=!0,n&&(e<=this.telemetryLoggingLevel()&&(this.queue.push(t),this._messageCount++),this._messageCount==this.maxInternalMessageLimit())){var o="Internal events throttle limit per PageView reached for this app.",r=new l(s.MessageLimitPerPVExceeded,o,!1);this.queue.push(r),this.warnToConsole(o)}}},e.prototype._areInternalMessagesThrottled=function(){return this._messageCount>=this.maxInternalMessageLimit()},e}(),i=function(){function e(){this._isInitialized=!1,this._extensions=new Array,this._channelController=new o}return e.prototype.initialize=function(e,t){var n=this;if(this._isInitialized)throw Error("Core should not be initialized more than once");if(!e||c.isNullOrUndefined(e.instrumentationKey))throw Error("Please provide instrumentation key");if(this.config=e,this._notificationManager=new f,this.config.extensions=c.isNullOrUndefined(this.config.extensions)?[]:this.config.extensions,this.config.extensionConfig=c.isNullOrUndefined(this.config.extensionConfig)?{}:this.config.extensionConfig,this.config.extensionConfig.NotificationManager=this._notificationManager,this.logger=new u(e),t.forEach(function(e){if(c.isNullOrUndefined(e.initialize))throw Error(g)}),0<this.config.extensions.length){var i=!0;if(this.config.extensions.forEach(function(e){c.isNullOrUndefined(e)&&(i=!1)}),!i)throw Error(g)}(r=this._extensions).push.apply(r,[this._channelController].concat(t,this.config.extensions)),this._extensions=this._extensions.sort(function(e,t){var n=e,i=t,o=typeof n.processTelemetry,r=typeof i.processTelemetry;return"function"===o&&"function"===r?n.priority-i.priority:"function"===o&&"function"!==r?1:"function"!==o&&"function"===r?-1:void 0});var o={};this._extensions.forEach(function(e){var t=e;t&&t.priority&&(c.isNullOrUndefined(o[t.priority])?o[t.priority]=t.identifier:n.logger.warnToConsole("Two extensions have same priority"+o[t.priority]+", "+t.identifier))});for(var r,s=-1,a=0;a<this._extensions.length-1;a++){var l=this._extensions[a];if(!l||"function"==typeof l.processTelemetry){if(l.priority===h){s=a+1;break}this._extensions[a].setNextPlugin(this._extensions[a+1])}}if(this._channelController.initialize(this.config,this,this._extensions),this._extensions.forEach(function(e){e&&e.priority<h&&e.initialize(n.config,n,n._extensions)}),s<this._extensions.length&&this._extensions.splice(s),0===this.getTransmissionControls().length)throw new Error("No channels available");this._isInitialized=!0},e.prototype.getTransmissionControls=function(){return this._channelController.ChannelControls},e.prototype.track=function(e){if(null===e)throw this._notifiyInvalidEvent(e),Error("Invalid telemetry item");if(e.baseData&&!e.baseType)throw this._notifiyInvalidEvent(e),Error("Provide data.baseType for data.baseData");e.baseType||(e.baseType="EventData"),e.iKey||(e.iKey=this.config.instrumentationKey),e.time||(e.time=(new Date).toISOString()),c.isNullOrUndefined(e.ver)&&(e.ver="4.0"),this._validateTelmetryItem(e);for(var t=0;t<this._extensions.length;){if(this._extensions[t].processTelemetry){this._extensions[t].processTelemetry(e);break}t++}},e.prototype.addNotificationListener=function(e){this._notificationManager.addNotificationListener(e)},e.prototype.removeNotificationListener=function(e){this._notificationManager.removeNotificationListener(e)},e.prototype.pollInternalLogs=function(){var n=this,e=this.config.diagnosticLogInterval;return 0<e||(e=1e4),setInterval(function(){var e=n.logger.queue;e.forEach(function(e){var t={name:"InternalMessageId: "+e.messageId,iKey:n.config.instrumentationKey,time:(new Date).toISOString(),baseType:l.dataType,baseData:{message:e.message}};n.track(t)}),e.length=0},e)},e.prototype._validateTelmetryItem=function(e){if(c.isNullOrUndefined(e.name))throw this._notifiyInvalidEvent(e),Error("telemetry name required");if(c.isNullOrUndefined(e.time))throw this._notifiyInvalidEvent(e),Error("telemetry timestamp required");if(c.isNullOrUndefined(e.iKey))throw this._notifiyInvalidEvent(e),Error("telemetry instrumentationKey required")},e.prototype._notifiyInvalidEvent=function(e){this._notificationManager.eventsDiscarded([e],t.InvalidEvent)},e}(),o=function(){function e(){this.identifier="ChannelControllerPlugin",this.priority=h}return e.prototype.processTelemetry=function(t){this.channelQueue.forEach(function(e){0<e.length&&e[0].processTelemetry(t)})},Object.defineProperty(e.prototype,"ChannelControls",{get:function(){return this.channelQueue},enumerable:!0,configurable:!0}),e.prototype.initialize=function(n,i,o){var r=this;if(this.channelQueue=new Array,n.channels)n.channels.forEach(function(e){if(e&&0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(var t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);r.channelQueue.push(e)}});else{for(var e=new Array,t=0;t<o.length;t++){var s=o[t];s.priority>h&&e.push(s)}if(0<e.length){(e=e.sort(function(e,t){return e.priority-t.priority})).forEach(function(e){return e.initialize(n,i,o)});for(t=1;t<e.length;t++)e[t-1].setNextPlugin(e[t]);this.channelQueue.push(e)}}},e}(),g="Extensions must provide callback to initialize",h=200;a.MinChannelPriorty=100,a.EventsDiscardedReason=t,a.AppInsightsCore=i,a.CoreUtils=c,a.NotificationManager=f,a.DiagnosticLogger=u,a._InternalLogMessage=l,a._InternalMessageId=s,Object.defineProperty(a,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=applicationinsights-core-js.min.js.map |
{ | ||
"name": "@microsoft/applicationinsights-core-js", | ||
"author": "Microsoft Corporation", | ||
"version": "1.0.0-beta.4", | ||
"version": "1.0.0-beta.5", | ||
"description": "Microsoft Application Insights Core Javascript SDK", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -27,3 +27,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
*/ | ||
ikey?: string; | ||
iKey?: string; | ||
@@ -30,0 +30,0 @@ /** |
@@ -172,5 +172,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
if (!telemetryItem.ikey) { | ||
// setup default ikey if not passed in | ||
telemetryItem.ikey = this.config.instrumentationKey; | ||
if (!telemetryItem.iKey) { | ||
// setup default iKey if not passed in | ||
telemetryItem.iKey = this.config.instrumentationKey; | ||
} | ||
@@ -234,3 +234,3 @@ if (!telemetryItem.time) { | ||
name: "InternalMessageId: " + logMessage.messageId, | ||
ikey: this.config.instrumentationKey, | ||
iKey: this.config.instrumentationKey, | ||
time: new Date().toISOString(), | ||
@@ -259,3 +259,3 @@ baseType: _InternalLogMessage.dataType, | ||
if (CoreUtils.isNullOrUndefined(telemetryItem.ikey)) { | ||
if (CoreUtils.isNullOrUndefined(telemetryItem.iKey)) { | ||
this._notifiyInvalidEvent(telemetryItem); | ||
@@ -262,0 +262,0 @@ throw Error("telemetry instrumentationKey required"); |
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
ikey?: string; | ||
iKey?: string; | ||
/** | ||
@@ -23,0 +23,0 @@ * System context properties of the telemetry item, example: ip address, city etc |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package