@microsoft/sp-diagnostics 1.15.0-beta.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,12 +12,12 @@
12
12
  "scriptResources": {
13
13
  "sp-diagnostics": {
14
14
  "type": "path",
15
- "path": "sp-diagnostics_none_40a2332c665dadede372.js"
15
+ "path": "sp-diagnostics_none_28238f56cca56eec8ea9.js"
16
16
  },
17
17
  "tslib": {
18
18
  "type": "component",
19
19
  "id": "01c4df03-e775-48cb-aa14-171ee5199a15",
20
- "version": "1.10.0"
20
+ "version": "2.3.1"
21
21
  },
22
22
  "@microsoft/sp-lodash-subset": {
23
23
  "type": "component",
@@ -0,0 +1 @@
1
+ define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.15.0",["tslib","@microsoft/sp-lodash-subset","@microsoft/sp-core-library"],function(n,a,i){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="mwqp")}({"17wl":function(e,t){e.exports=n},Pk8u:function(e,t){e.exports=a},UWqr:function(e,t){e.exports=i},mwqp:function(e,t,n){"use strict";n.r(t),n.d(t,"_TraceLogger",function(){return p}),n.d(t,"_LogEntry",function(){return g}),n.d(t,"_LogFeature",function(){return m}),n.d(t,"_LogSource",function(){return o}),n.d(t,"_logSourceServiceKey",function(){return s}),n.d(t,"_LogType",function(){return b}),n.d(t,"_Diagnostics",function(){return S}),n.d(t,"_PromotedState",function(){return _}),n.d(t,"_PageType",function(){return h}),n.d(t,"_LogEvent",function(){return l}),n.d(t,"_LogLevel",function(){return a}),n.d(t,"_CircularBuffer",function(){return c}),n.d(t,"_LogManager",function(){return d}),n.d(t,"_EngagementLogger",function(){return D}),n.d(t,"_LogHandler",function(){return I}),n.d(t,"_QosMonitor",function(){return E}),n.d(t,"_AutoAlertableQosMonitor",function(){return k}),n.d(t,"_AutoAlertableMonitorType",function(){return L}),n.d(t,"_QosMonitorShareFailureWithCP",function(){return M}),n.d(t,"_QosLogger",function(){return w}),n.d(t,"_QosResultType",function(){return x}),n.d(t,"_ExecutionQueue",function(){return O});var a,i=n("UWqr"),r=function(){function e(e){i.Validate.isNotNullOrUndefined(e,"id"),this._id=e}return e.create=function(t){return new e(t)},Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._id.length},e}(),o=r,s=i.ServiceKey.createCustom("sp-client-base:LogSource",function(e){return r.create("")}),c=function(){function e(e){if(this._head=-1,this._count=0,this._isIterating=!1,e<=0)throw new Error("Size must be positive");this._size=e,this._buffer=new Array(e)}return Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),e.prototype.push=function(e){this._ensureNotIterating(),this._head++,this._count++,this._head===this._size&&(this._head=0),this._buffer[this._head]=e},e.prototype.forEach=function(e){if(0!==this._count){this._isIterating=!0;try{for(var t=this._tail,n=0;n<this._size&&(e(this._buffer[t]),t!==this._head);n++)t=this._getNext(t)}finally{this._isIterating=!1}}},e.prototype.removeAll=function(){this._ensureNotIterating(),this._head=-1,this._count=0},Object.defineProperty(e.prototype,"_tail",{get:function(){return this._isNotWrapped()?0:this._getNext(this._head)},enumerable:!1,configurable:!0}),e.prototype._isNotWrapped=function(){return this._count===this._head+1},e.prototype._getNext=function(e){var t=e+1;return t===this._size&&(t=0),t},e.prototype._ensureNotIterating=function(){if(this._isIterating)throw new Error("Circular buffer cannot be modified during iteration")},e}(),d=function(){function e(t){this._shouldLogInRealTime=[],this._handlers=[],this._events=new c(e._maxVerboseLog),t&&this.addHandler(t)}return Object.defineProperty(e,"_maxVerboseLog",{get:function(){return 5e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){return this._events},enumerable:!1,configurable:!0}),e.prototype.addHandler=function(e){this._containsHandler(e)||(this._handlers.push(e),this._shouldLogInRealTime.push(!1))},e.prototype.log=function(e){Object.freeze(e),this._events.push(e),this._processLogEvent(e)},e.prototype.removeHandler=function(e){var t=this._handlers.indexOf(e);t>-1&&(this._handlers.splice(t,1),this._shouldLogInRealTime.splice(t,1))},e.prototype.reset=function(){this._handlers=[],this._shouldLogInRealTime=[],this._events.removeAll()},e.prototype.processAll=function(e){this._handlers.indexOf(e)>-1&&this._processAllEvents(e)},e.prototype._containsHandler=function(e){for(var t=0,n=this._handlers;t<n.length;t++)if(n[t]===e)return!0;return!1},e.prototype._processAllEvents=function(e){this._events.forEach(function(t){if(t)try{e(t)}catch(e){console.error("failed to handle event:"+e.toString())}}),this._shouldLogInRealTime[this._handlers.indexOf(e)]=!0},e.prototype._processLogEvent=function(e){for(var t=0;t<this._handlers.length;t++)if(this._shouldLogInRealTime[t]&&e)try{this._handlers[t](e)}catch(e){console.error("failed to handle event:"+e.toString())}},e}(),l=function(){function e(e,t,n,a){this._validate(e,t),this._timestamp=(new Date).getTime(),this._scope=this._getScope(a),this._source=e.substr(0,this._maxSourceLength),this._setData(t),this._level=n,this._prefix=this._getPrefix()}return e.log=function(t,n,a,i){var r=new e(t,n,a,i);return e.logManager.log(r),r},e.prototype.toString=function(){var e="[".concat(this._timestamp,"][").concat(this._prefix,"]");return this._message?"".concat(e," ").concat(this._message):this._error?"".concat(e," ").concat(this._error.toString()):e},Object.defineProperty(e.prototype,"timestamp",{get:function(){return this._timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this._level},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"prefix",{get:function(){return this._prefix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scope",{get:function(){return this._scope},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"source",{get:function(){return this._source},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_maxSourceLength",{get:function(){return 30},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_maxMessageLength",{get:function(){return 150},enumerable:!1,configurable:!0}),e.prototype._validate=function(e,t){if(!e)throw new Error("source cannot be undefined or null for Logger");if(!t)throw new Error("data cannot be undefined or null")},e.prototype._setData=function(e){"string"==typeof e?this._message=e.substr(0,this._maxMessageLength):e instanceof Error&&(this._error=e)},e.prototype._getPrefix=function(){var e="".concat(this._source);return this._scope&&!this._scope.isEmpty()&&(e="".concat(this._scope.id.substr(0,this._maxSourceLength),".").concat(e)),"".concat(e)},e.prototype._getScope=function(e){var t;return e&&e.whenFinished(function(){t=e.consume(s)}),t},e.logManager=new d,e}();!function(e){e[e.Verbose=1]="Verbose",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error"}(a||(a={}));var u,f=function(){function e(){}return e.prototype.log=function(e){console.log("Error: ".concat(e.data,", ")+"Event Name: ".concat(e.eventName,", ")+"Result Code: ".concat(e.resultCode))},e.prototype.verbose=function(e){console.log("Error: ".concat(e.data,", Event Name: ").concat(e.eventName))},e}(),p=function(){function e(){}return e._addHandler=function(t){e._logManager.addHandler(t.log),e._logManager.processAll(t.log),e._verboseLogManager.addHandler(t.verbose),e._verboseLogManager.processAll(t.verbose)},e.logError=function(e,t,n,a){i.Validate.isNotNullOrUndefined(t,"error"),this._log(e,t,n,!0,a)},e.logErrorData=function(e){i.Validate.isNotNullOrUndefined(e.error,"error");var t=e.logEntry?e.logEntry.toString():e.error;this._log(e.source,t,e.eventName,!0,e.resultCode,e.serviceScope)},e.logVerbose=function(e,t,n){i.Validate.isNonemptyString(t,"message"),this._log(e,t,n,!1,void 0)},e.logVerboseData=function(e){var t=e.logEntry?e.logEntry.toString():e.message;this._log(e.source,t,e.eventName,!1,void 0,e.serviceScope)},e.logErrorWithLogEntry=function(e,t,n,a){i.Validate.isNotNullOrUndefined(e,"source"),i.Validate.isNotNullOrUndefined(t,"logEntry"),this._log(e,t.toString(),n,!0,a)},Object.defineProperty(e,"shouldWriteToConsole",{get:function(){return e._shouldWriteToConsole},set:function(t){e._shouldWriteToConsole&&!t?(e._logManager.removeHandler(e._defaultLogger.log),e._verboseLogManager.removeHandler(e._defaultLogger.verbose)):!e._shouldWriteToConsole&&t&&(e._logManager.addHandler(e._defaultLogger.log),e._verboseLogManager.addHandler(e._defaultLogger.verbose)),e._shouldWriteToConsole=t},enumerable:!1,configurable:!0}),e.logVerboseWithLogEntry=function(e,t,n){i.Validate.isNotNullOrUndefined(t,"LogEntry"),this._log(e,t.toString(),n,!1,void 0)},e._log=function(t,n,i,r,o,s){var c,d=this._addEventPrefix(t,i);r?(c=l.log(d,n,a.Error,s),e._logManager.log({data:n,eventName:c.prefix,resultCode:o})):(c=l.log(d,n.toString(),a.Verbose,s),e._verboseLogManager.log({data:n,eventName:c.prefix})),e.shouldWriteToConsole&&this._writeToConsole(c,r,o)},e._addEventPrefix=function(e,t){return t?"".concat(e.id,".").concat(t):e.id},e._writeToConsole=function(e,t,n){var a=e.toString();n&&(a+=". resultCode: ".concat(n)),t?console.error(a):console.log(a)},e._logManager=new d,e._verboseLogManager=new d,e._defaultLogger=new f,e._shouldWriteToConsole=!1,e}(),m=function(){function e(){}return e.None="None",e}();!function(e){e[e.Trace=1]="Trace",e[e.Event=2]="Event",e[e.Error=3]="Error"}(u||(u={}));var _,h,b=u,g=function(){function e(e,t,n,a,i){if(void 0===t&&(t=m.None),void 0===n&&(n=b.Trace),!e)throw new Error("moduleName is invalid");this.moduleName=e,this.logFeature=t,this.logType=n,this.logProperties=a,this.isIntentional=i}return e.prototype.toString=function(){var e=void 0;if(this.logProperties)try{e=JSON.stringify(this.logProperties)}catch(e){console.log("Error happens in toString():"+e)}return"".concat(this.moduleName," | ").concat(this.logFeature," | ").concat(this.logType," | ").concat(e)},e}(),v=n("Pk8u"),y=function(){function e(){}return e.initialize=function(e){this.settings=Object(v.cloneDeep)(e),this._initialized=!0,this._normalizeContextIds()},e.updateSettings=function(e){this.settings=Object(v.merge)(this.settings,e),this._normalizeContextIds()},Object.defineProperty(e,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),e._normalizeId=function(e){var t=i.Guid.tryParse(e);return(null==t?void 0:t.toString())||e},e._normalizeContextIds=function(){this.settings.siteId=this._normalizeId(this.settings.siteId),this.settings.webId=this._normalizeId(this.settings.webId),this.settings.correlationId=this._normalizeId(this.settings.correlationId),this.settings.listId&&(this.settings.listId=this._normalizeId(this.settings.listId),this.settings.listItemUniqueId&&(this.settings.listItemUniqueId=this._normalizeId(this.settings.listItemUniqueId)))},e._initialized=!1,e}(),S=function(){function e(){}return e.initialize=function(t){e._isInitialized||(y.initialize(t),p.shouldWriteToConsole=t.enableConsoleLog,p._addHandler({log:function(e){i.Log.info(e.eventName,"EventName:".concat(e.data.toString(),", ResultCode: ").concat(e.resultCode))},verbose:function(e){i.Log.verbose(e.eventName,e.data.toString())}}),e._isInitialized=!0)},Object.defineProperty(e,"isInitialized",{get:function(){return this._isInitialized},enumerable:!1,configurable:!0}),e.updateSettings=function(e){y.updateSettings(e)},e._isInitialized=!1,e}();!function(e){e[e.NotPromoted=0]="NotPromoted",e[e.Promoted=2]="Promoted"}(_||(_={})),function(e){e.News="News",e.Article="Article",e.Home="Home",e.Space="Space",e.NewsDigest="NewsDigest"}(h||(h={}));var D=function(){function e(){}return e._addHandler=function(t){e._handler=function(e){t.logData(e)},e._logManager.addHandler(e._handler)},e.startRealTimeProcessing=function(){this._shouldProcessInRealTime||(e._logManager.processAll(e._handler),this._shouldProcessInRealTime=!0)},e.log=function(t){e._logEngagementData(t)},e.logEvent=function(t,n){var a={name:t};n&&0!==n.length&&(a.extraData={action:n}),e._logEngagementData(a)},e.logEventWithLogEntry=function(t){var n={isIntentional:t.isIntentional,name:t.moduleName+"."+t.logFeature,extraData:t.logProperties};e._logEngagementData(n,!0)},e._logEngagementData=function(t,n){if(void 0===n&&(n=!1),!t.name||0===t.name.length)throw new Error("LogEntry is invalid");e._checkValidTagName(t,n),e._addContextData(t),e._appendExtraData(t),e._logManager.log(t)},e._checkValidTagName=function(e,t){if(void 0===t&&(t=!1),!t&&!1===/(\w+)\.(\w+).(\w+)/gi.test(e.name))throw new Error("".concat(e.name," tagName does not follow AppName.ControlName.ActionName pattern"))},e._addContextData=function(e){if(y.isInitialized){var t=y.settings,n=t.listId,a=t.listItemUniqueId,i=t.siteId,r=t.webId;e.siteId=i,e.webId=r,n&&(e.listId=n,a&&(e.docId=a))}},e._appendExtraData=function(e){if(y.isInitialized){var t=y.settings.contextInfo;t&&(e.extraData||(e.extraData={}),function(e,t){t.pageId=e.pageId,t.isHub=e.isHubSite,e.isHubSite?(t.hubSiteId=e.hubSiteId,t.isAssociatedSite=!1):!e.isHubSite&&e.hubSiteId?t.isAssociatedSite=!0:t.isAssociatedSite=!1,i._BrowserUtilities.isTeamsHosted()?(t.displayApp="Teams",!i._SPKillSwitch.isActivated("6529d10e-5177-40ef-9c95-4b3b947e8795")&&e.isEduClass&&(t.isEduClass=!0)):t.displayApp="Sharepoint",t.userAgent=navigator.userAgent;var n,a=e.webTemplate;t.webTemplate=a,"1"===a?n="TeamSite":"64"===a?n="GroupSite":"68"===a&&(n="CommunicationSite");var r=e.promotedState,o=e.pageType,s=o;o===h.Article&&(s=r===_.NotPromoted||void 0===r?h.Article:h.News),t.siteType=n,t.pageType=s}(t,e.extraData))}},e._logManager=new d,e}(),I=function(){function e(){}return e.prototype.verbose=function(e,t,n){l.log(e,t,a.Verbose,n)},e.prototype.info=function(e,t,n){l.log(e,t,a.Info,n)},e.prototype.warn=function(e,t,n){l.log(e,t,a.Warning,n)},e.prototype.error=function(e,t,n){l.log(e,t,a.Error,n)},e}(),x={Success:0,Failure:1,ExpectedFailure:2},C=function(){function e(){this._shouldExecuteInRealTime=!1,this._handlers={},this._executionEntries=[]}return Object.defineProperty(e.prototype,"shouldExecuteInRealTime",{get:function(){return this._shouldExecuteInRealTime},set:function(e){this._shouldExecuteInRealTime=e,this._shouldExecuteInRealTime&&this.flush()},enumerable:!1,configurable:!0}),e.prototype.addHandler=function(e,t){if(!this._containsHandler(e,t)){this._initializeHandlerArrayForKey(e);var n=this._handlers[e];-1===n.indexOf(t)&&n.push(t)}},e.prototype.addExecutionEntry=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Object.freeze(t),this._shouldExecuteInRealTime?this._processExecutionEntry(e,t):this._executionEntries.push({key:e,args:t})},e.prototype.removeHandler=function(e,t){var n=this._handlers[e].indexOf(t);n>-1&&this._handlers[e].splice(n,1)},e.prototype.reset=function(){this._handlers={},this._executionEntries=[]},e.prototype.flush=function(){this._processAllExecutionEntries(),this._executionEntries=[]},e.prototype._containsHandler=function(e,t){return null!==this._handlers[e]&&void 0!==this._handlers[e]&&this._handlers[e].indexOf(t)>-1},e.prototype._initializeHandlerArrayForKey=function(e){null!==this._handlers[e]&&void 0!==this._handlers[e]||(this._handlers[e]=[])},e.prototype._processAllExecutionEntries=function(){for(var e=0,t=this._executionEntries;e<t.length;e++){var n=t[e];if(n&&this._handlers[n.key])try{for(var a=0,i=this._handlers[n.key];a<i.length;a++)i[a].apply(this,n.args)}catch(e){console.error("failed to process execution entry:"+e.toString())}}},e.prototype._processExecutionEntry=function(e,t){for(var n=0;n<this._handlers[e].length;n++)try{this._handlers[e][n].apply(this,t)}catch(e){console.error("failed to process execution entry:"+e.toString())}},e}(),O=C,w=function(){function e(){this._qosEvents=new Map,this._deferExecutor=new O,this._shouldProcessInRealTime=!1,this.initializeLogger()}return Object.defineProperty(e,"instance",{get:function(){return this._instance||(this._instance=new e),this._instance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shouldProcessInRealTime",{get:function(){return this._shouldProcessInRealTime},set:function(e){this._shouldProcessInRealTime=e,this._deferExecutor.shouldExecuteInRealTime=e},enumerable:!1,configurable:!0}),e.prototype.setLogger=function(e){this._qosLogger=e},e.prototype.getQosEvent=function(e){return this._qosEvents.get(e)},e.prototype.startQosMonitor=function(e,t){this._qosEvents.has(e)||this._deferExecutor.addExecutionEntry("start",e,t)},e.prototype.writeQosEndResult=function(e,t){this._deferExecutor.addExecutionEntry("end",e,t)},e.prototype._startMonitor=function(e,t){this._qosLogger&&this._qosEvents.set(e,new this._qosLogger(t))},e.prototype._endMonitor=function(e,t){var n=this._qosEvents.get(e);n&&(n.end(t),this._qosEvents.delete(e))},e.prototype.initializeLogger=function(){var e=this;this._deferExecutor.addHandler("start",function(t,n){e._startMonitor(t,n)}),this._deferExecutor.addHandler("end",function(t,n){e._endMonitor(t,n)})},e}(),E=function(){function e(e,t,n){var a;void 0===t&&(t=!1),void 0===n&&(n=!1),this._qosResultTypeValue=((a={})[x.Success]="Success",a[x.Failure]="Failure",a[x.ExpectedFailure]="ExpectedFailure",a),i.Validate.isNonemptyString(e,"scenarioName"),this._id=i.Guid.newGuid().toString(),this._isDebugSession()||w.instance.startQosMonitor(this._id,{name:e}),this._scenarioName=e,this._hasEnded=!1,this._copyToCosmos=t,this._copyToInterana=n}return e.startRealTimeProcessing=function(){w.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)},e._shouldProcessInRealTime=function(e){w.instance.shouldProcessInRealTime=e},Object.defineProperty(e.prototype,"name",{get:function(){return this._scenarioName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shortEventName",{get:function(){return"Qos"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resultCode",{get:function(){return this._endResultCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resultType",{get:function(){return this._endResult},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._endExtraData},set:function(e){this._endExtraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasEnded",{get:function(){return this._hasEnded},enumerable:!1,configurable:!0}),e.prototype.writeSuccess=function(e){this._writeQosEnd(x.Success,void 0,void 0,e)},e.prototype.writeUnexpectedFailure=function(e,t,n){void 0===e&&(e="DefaultUnexpected"),this._writeQosEnd(x.Failure,e,t,n)},e.prototype.writeExpectedFailure=function(e,t,n){void 0===e&&(e="DefaultExpected"),this._writeQosEnd(x.ExpectedFailure,e,t,n)},e.prototype._writeQosEnd=function(e,t,n,a){if(!this._shouldSkip(e)){this._ensureCorrelationId(e,a),this._endResultCode=t,this._endResult=e;var i={resultCode:this._endResultCode,resultType:this._endResult,error:n?n.message:void 0,extraData:this._endExtraData};w.instance.writeQosEndResult(this._id,i),this._writeToEngagement()}},e.prototype._ensureCorrelationId=function(e,t){var n=this;if(t&&(this._ensureEndExtraData(),Object.keys(t).forEach(function(e){return n._endExtraData[e]=t[e]})),y.isInitialized&&e!==x.Success){var a="CorrelationId",i=this._endExtraData&&(this._endExtraData[a]||this._endExtraData.correlationId)||y.settings.correlationId;i&&(this._endExtraData||(this._endExtraData={}),this._endExtraData[a]=i)}this._logHostType()},e.prototype._ensureEndExtraData=function(){this._endExtraData||(this._endExtraData={})},e.prototype._logHostType=function(){var e;if(!i._SPKillSwitch.isActivated("4d1e88a3-938f-478b-acc9-d4021ef40c53")&&y.isInitialized){var t=void 0;if((null===(e=y.settings.contextInfo)||void 0===e?void 0:e.isEduClass)?t="TeamsEdu":this._isViva1pApp()?t="viva1p":i._BrowserUtilities.isTeamsHosted()&&(t="TeamsCommercial"),t){this._ensureEndExtraData();var n="appHostType";this._endExtraData[n]||(this._endExtraData[n]=t)}}},e.prototype._isDebugSession=function(){return!!sessionStorage.getItem("spfx-debug")},e.prototype._shouldSkip=function(t){if(this._hasEnded&&void 0!==this._endResult){var n=i.Text.format(e.qosMonitorHasEndedErrorString,this.name,this._qosResultTypeValue[this._endResult],this._qosResultTypeValue[t]);return this._endResult!==t&&p.logError(e.logSource,new Error(n)),!0}return this._hasEnded=!0,this._isDebugSession()},e.prototype._writeToEngagement=function(){if(!i._SPKillSwitch.isActivated("e562a19e-01fa-4707-ae9c-f6a4968e061e")&&this._copyToInterana&&D.log({name:this.name,extraData:this.extraData||{}}),this._copyToCosmos){var e={name:"Spfx.Qos.ToEngagement",extraData:this.extraData||{}};e.extraData.qosName=this.name,this.resultType&&(e.extraData.qosResultType=this._qosResultTypeValue[this.resultType]),this.resultCode&&(e.extraData.qosResultCode=this.resultCode),D.log(e)}},e.prototype._isViva1pApp=function(){if(i._SPKillSwitch.isActivated("74a07914-666d-4657-abed-237ad633ad7e"))return!1;try{return"VivaConnections"===(null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("TeamsAppType"))||"sharepointportal_d2c6f111-ffad-42a0-b65e-ee00425598aa"===(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("TeamsAppEntityId"))||"viva1p"===(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("hostedApp"))}catch(e){return!1}},e.logSource={id:"QosMonitor"},e.qosMonitorHasEndedErrorString="QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",e}(),A=n("17wl"),L={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4",DynamicReliabilityExpectedFailureHighSev4:"DynamicReliabilityExpectedFailureHighSev4"},k=function(e){function t(t,n,a){void 0===a&&(a=!1);var i=e.call(this,t,!1,a)||this;return i._autoAlertableMonitorType=n,i}return Object(A.__extends)(t,e),t.prototype.writeSuccess=function(t){e.prototype.writeSuccess.call(this,this.getExtraDataWithAutoAlertableFields(t))},t.prototype.writeUnexpectedFailure=function(t,n,a){void 0===t&&(t="DefaultUnexpected"),e.prototype.writeUnexpectedFailure.call(this,t,n,this.getExtraDataWithAutoAlertableFields(a))},t.prototype.writeExpectedFailure=function(t,n,a){void 0===t&&(t="DefaultExpected"),e.prototype.writeExpectedFailure.call(this,t,n,this.getExtraDataWithAutoAlertableFields(a))},t.prototype.getExtraDataWithAutoAlertableFields=function(e){var t=null!=e?e:{};return t.autoAlertableMonitorType=L[this._autoAlertableMonitorType],t},t}(E),M=function(e){function t(t,n,a){void 0===n&&(n=!1);var i=e.call(this,t,!1,n)||this;return i._extraDataForCustomerPromise=a,i}return Object(A.__extends)(t,e),t.prototype.writeUnexpectedFailure=function(t,n,a){void 0===t&&(t="DefaultUnexpected"),e.prototype.writeUnexpectedFailure.call(this,t,n,a),this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",t,x.Failure,(null==a?void 0:a.pageType)?a.pageType:void 0)},t.prototype.writeExpectedFailure=function(t,n,a){void 0===t&&(t="DefaultExpected"),e.prototype.writeExpectedFailure.call(this,t,n,a),this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",t,x.ExpectedFailure,(null==a?void 0:a.pageType)?a.pageType:void 0)},t.prototype._logCustomerPromiseFailure=function(e,t,n,a){void 0===n&&(n=x.Failure),this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(function(i){var r=i.errorModuleName;(0,i.logFailure)({errorCode:r,errorScenario:t,errorMessage:e,resultType:n,pageType:a||void 0})})},t}(E)}})});
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.19.4"
8
+ "packageVersion": "7.24.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -10,7 +10,7 @@ var DefaultEngagementHandler = /** @class */ (function () {
10
10
  * Default implementation for logData function.
11
11
  */
12
12
  DefaultEngagementHandler.prototype.logData = function (data) {
13
- console.log("TagName: " + data.name + ", Action Name: " + data.extraData);
13
+ console.log("TagName: ".concat(data.name, ", Action Name: ").concat(data.extraData));
14
14
  };
15
15
  return DefaultEngagementHandler;
16
16
  }());
@@ -116,7 +116,7 @@ var EngagementLogger = /** @class */ (function () {
116
116
  if (!isLogEntry) {
117
117
  var tagNameRegex = /(\w+)\.(\w+).(\w+)/gi;
118
118
  if (tagNameRegex.test(engagementData.name) === false) {
119
- throw new Error(engagementData.name + " tagName does not follow AppName.ControlName.ActionName pattern");
119
+ throw new Error("".concat(engagementData.name, " tagName does not follow AppName.ControlName.ActionName pattern"));
120
120
  }
121
121
  }
122
122
  };
@@ -140,7 +140,7 @@ var EngagementLogger = /** @class */ (function () {
140
140
  if (!data.extraData) {
141
141
  data.extraData = {};
142
142
  }
143
- setPageExtraData_1.setPageExtraData(contextInfo, data.extraData);
143
+ (0, setPageExtraData_1.setPageExtraData)(contextInfo, data.extraData);
144
144
  }
145
145
  }
146
146
  };
@@ -45,7 +45,7 @@ var LogEntry = /** @class */ (function () {
45
45
  console.log('Error happens in toString():' + e);
46
46
  }
47
47
  }
48
- return this.moduleName + " | " + this.logFeature + " | " + this.logType + " | " + serializedLogProps;
48
+ return "".concat(this.moduleName, " | ").concat(this.logFeature, " | ").concat(this.logType, " | ").concat(serializedLogProps);
49
49
  };
50
50
  return LogEntry;
51
51
  }());
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
- // Copyright (c) Microsoft. All rights reserved.
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  var tslib_1 = require("tslib");
5
4
  var sp_core_library_1 = require("@microsoft/sp-core-library");
5
+ // Copyright (c) Microsoft. All rights reserved.
6
+ var sp_core_library_2 = require("@microsoft/sp-core-library");
6
7
  var TraceLogger_1 = tslib_1.__importDefault(require("../Trace/TraceLogger"));
7
8
  var QosResultType_1 = require("./QosResultType");
8
9
  var QosLogger_1 = tslib_1.__importDefault(require("./QosLogger"));
9
10
  var EngagementLogger_1 = tslib_1.__importDefault(require("../Engagement/EngagementLogger"));
10
11
  var DiagnosticsSettingsManager_1 = tslib_1.__importDefault(require("../../DiagnosticsSettingsManager"));
11
12
  var Killswitches_1 = require("../../common/Killswitches");
13
+ var VIVA_CONNECTIONS_1P_APPID = 'sharepointportal_d2c6f111-ffad-42a0-b65e-ee00425598aa';
12
14
  /**
13
15
  * Qos logger
14
16
  * This class represents the Qos monitor APIs
@@ -32,8 +34,8 @@ var QosMonitor = /** @class */ (function () {
32
34
  _a[QosResultType_1.QosResultType.Failure] = 'Failure',
33
35
  _a[QosResultType_1.QosResultType.ExpectedFailure] = 'ExpectedFailure',
34
36
  _a);
35
- sp_core_library_1.Validate.isNonemptyString(scenarioName, 'scenarioName');
36
- this._id = sp_core_library_1.Guid.newGuid().toString();
37
+ sp_core_library_2.Validate.isNonemptyString(scenarioName, 'scenarioName');
38
+ this._id = sp_core_library_2.Guid.newGuid().toString();
37
39
  if (!this._isDebugSession()) {
38
40
  QosLogger_1.default.instance.startQosMonitor(this._id, { name: scenarioName });
39
41
  }
@@ -148,9 +150,7 @@ var QosMonitor = /** @class */ (function () {
148
150
  ) {
149
151
  var _this = this;
150
152
  if (extraData) {
151
- if (!this._endExtraData) {
152
- this._endExtraData = {};
153
- }
153
+ this._ensureEndExtraData();
154
154
  // Instead of slower ...[spread], copy over the incoming values manually
155
155
  Object.keys(extraData).forEach(function (k) { return (_this._endExtraData[k] = extraData[k]); });
156
156
  }
@@ -167,13 +167,43 @@ var QosMonitor = /** @class */ (function () {
167
167
  this._endExtraData[capitalKey] = correlationId;
168
168
  }
169
169
  }
170
+ this._logHostType();
171
+ };
172
+ QosMonitor.prototype._ensureEndExtraData = function () {
173
+ if (!this._endExtraData) {
174
+ this._endExtraData = {};
175
+ }
176
+ };
177
+ QosMonitor.prototype._logHostType = function () {
178
+ var _a;
179
+ if (!(0, Killswitches_1.isAddHostTypeKSActivated)() && DiagnosticsSettingsManager_1.default.isInitialized) {
180
+ var appHostType = void 0;
181
+ if ((_a = DiagnosticsSettingsManager_1.default.settings.contextInfo) === null || _a === void 0 ? void 0 : _a.isEduClass) {
182
+ appHostType = 'TeamsEdu';
183
+ }
184
+ else if (this._isViva1pApp()) {
185
+ appHostType = 'viva1p';
186
+ }
187
+ else if (sp_core_library_1._BrowserUtilities.isTeamsHosted()) {
188
+ appHostType = 'TeamsCommercial';
189
+ }
190
+ // Skip logging for default SPO path for now to limit quota impact
191
+ if (appHostType) {
192
+ this._ensureEndExtraData();
193
+ var hostKey = 'appHostType';
194
+ // Unlikely, but avoid overwriting matching key value
195
+ if (!this._endExtraData[hostKey]) {
196
+ this._endExtraData[hostKey] = appHostType;
197
+ }
198
+ }
199
+ }
170
200
  };
171
201
  QosMonitor.prototype._isDebugSession = function () {
172
202
  return !!sessionStorage.getItem('spfx-debug');
173
203
  };
174
204
  QosMonitor.prototype._shouldSkip = function (result) {
175
205
  if (this._hasEnded && this._endResult !== undefined) {
176
- var message = sp_core_library_1.Text.format(QosMonitor.qosMonitorHasEndedErrorString, this.name, this._qosResultTypeValue[this._endResult], this._qosResultTypeValue[result]);
206
+ var message = sp_core_library_2.Text.format(QosMonitor.qosMonitorHasEndedErrorString, this.name, this._qosResultTypeValue[this._endResult], this._qosResultTypeValue[result]);
177
207
  if (this._endResult !== result) {
178
208
  TraceLogger_1.default.logError(QosMonitor.logSource, new Error(message));
179
209
  }
@@ -188,7 +218,7 @@ var QosMonitor = /** @class */ (function () {
188
218
  }
189
219
  };
190
220
  QosMonitor.prototype._writeToEngagement = function () {
191
- if (!Killswitches_1.isLogToInteranaKSActivated() && this._copyToInterana) {
221
+ if (!(0, Killswitches_1.isLogToInteranaKSActivated)() && this._copyToInterana) {
192
222
  EngagementLogger_1.default.log({
193
223
  name: this.name,
194
224
  extraData: this.extraData || {}
@@ -215,6 +245,19 @@ var QosMonitor = /** @class */ (function () {
215
245
  EngagementLogger_1.default.log(engagementData);
216
246
  }
217
247
  };
248
+ QosMonitor.prototype._isViva1pApp = function () {
249
+ if ((0, Killswitches_1.isViva1QoSKillSwitchActivated)()) {
250
+ return false;
251
+ }
252
+ try {
253
+ return ((sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('TeamsAppType')) === 'VivaConnections' ||
254
+ (localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem('TeamsAppEntityId')) === VIVA_CONNECTIONS_1P_APPID ||
255
+ (localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem('hostedApp')) === 'viva1p');
256
+ }
257
+ catch (_a) {
258
+ return false;
259
+ }
260
+ };
218
261
  QosMonitor.logSource = {
219
262
  id: 'QosMonitor'
220
263
  };
@@ -15,9 +15,9 @@ var DefaultTraceHandler = /** @class */ (function () {
15
15
  */
16
16
  DefaultTraceHandler.prototype.log = function (traceLogEvent) {
17
17
  if (!DEPRECATED_UNIT_TEST) {
18
- console.log("Error: " + traceLogEvent.data + ", " +
19
- ("Event Name: " + traceLogEvent.eventName + ", ") +
20
- ("Result Code: " + traceLogEvent.resultCode));
18
+ console.log("Error: ".concat(traceLogEvent.data, ", ") +
19
+ "Event Name: ".concat(traceLogEvent.eventName, ", ") +
20
+ "Result Code: ".concat(traceLogEvent.resultCode));
21
21
  }
22
22
  };
23
23
  /**
@@ -25,7 +25,7 @@ var DefaultTraceHandler = /** @class */ (function () {
25
25
  */
26
26
  DefaultTraceHandler.prototype.verbose = function (verboseTraceEvent) {
27
27
  if (!DEPRECATED_UNIT_TEST) {
28
- console.log("Error: " + verboseTraceEvent.data + ", Event Name: " + verboseTraceEvent.eventName);
28
+ console.log("Error: ".concat(verboseTraceEvent.data, ", Event Name: ").concat(verboseTraceEvent.eventName));
29
29
  }
30
30
  };
31
31
  return DefaultTraceHandler;
@@ -34,12 +34,12 @@ var LogEvent = /** @class */ (function () {
34
34
  return event;
35
35
  };
36
36
  LogEvent.prototype.toString = function () {
37
- var timedPrefix = "[" + this._timestamp + "][" + this._prefix + "]";
37
+ var timedPrefix = "[".concat(this._timestamp, "][").concat(this._prefix, "]");
38
38
  if (this._message) {
39
- return timedPrefix + " " + this._message;
39
+ return "".concat(timedPrefix, " ").concat(this._message);
40
40
  }
41
41
  else if (this._error) {
42
- return timedPrefix + " " + this._error.toString();
42
+ return "".concat(timedPrefix, " ").concat(this._error.toString());
43
43
  }
44
44
  else {
45
45
  return timedPrefix;
@@ -125,11 +125,11 @@ var LogEvent = /** @class */ (function () {
125
125
  }
126
126
  };
127
127
  LogEvent.prototype._getPrefix = function () {
128
- var prefix = "" + this._source;
128
+ var prefix = "".concat(this._source);
129
129
  if (this._scope && !this._scope.isEmpty()) {
130
- prefix = this._scope.id.substr(0, this._maxSourceLength) + "." + prefix;
130
+ prefix = "".concat(this._scope.id.substr(0, this._maxSourceLength), ".").concat(prefix);
131
131
  }
132
- return "" + prefix;
132
+ return "".concat(prefix);
133
133
  };
134
134
  LogEvent.prototype._getScope = function (serviceScope) {
135
135
  var parentSource;
@@ -161,7 +161,7 @@ var TraceLogger = /** @class */ (function () {
161
161
  return source.id;
162
162
  }
163
163
  else {
164
- return source.id + "." + eventName;
164
+ return "".concat(source.id, ".").concat(eventName);
165
165
  }
166
166
  };
167
167
  /*
@@ -172,7 +172,7 @@ var TraceLogger = /** @class */ (function () {
172
172
  // @todo (SPPPLAT VSO#250083): This date should be a part of the logEvent.
173
173
  var errorString = logEvent.toString();
174
174
  if (resultCode) {
175
- errorString += ". resultCode: " + resultCode;
175
+ errorString += ". resultCode: ".concat(resultCode);
176
176
  }
177
177
  // Task 191596: only write to console when a condition is satisfied (e.g., a query parameter provided).
178
178
  if (isError) {
@@ -27,7 +27,7 @@ var Diagnostics = /** @class */ (function () {
27
27
  TraceLogger_1.default.shouldWriteToConsole = settings.enableConsoleLog;
28
28
  TraceLogger_1.default._addHandler({
29
29
  log: function (traceEvent) {
30
- sp_core_library_1.Log.info(traceEvent.eventName, "EventName:" + traceEvent.data.toString() + ", ResultCode: " + traceEvent.resultCode);
30
+ sp_core_library_1.Log.info(traceEvent.eventName, "EventName:".concat(traceEvent.data.toString(), ", ResultCode: ").concat(traceEvent.resultCode));
31
31
  },
32
32
  verbose: function (traceEvent) {
33
33
  sp_core_library_1.Log.verbose(traceEvent.eventName, traceEvent.data.toString());
@@ -15,12 +15,12 @@ var DiagnosticsSettingsManager = /** @class */ (function () {
15
15
  function DiagnosticsSettingsManager() {
16
16
  }
17
17
  DiagnosticsSettingsManager.initialize = function (settings) {
18
- this.settings = sp_lodash_subset_1.cloneDeep(settings);
18
+ this.settings = (0, sp_lodash_subset_1.cloneDeep)(settings);
19
19
  this._initialized = true;
20
20
  this._normalizeContextIds();
21
21
  };
22
22
  DiagnosticsSettingsManager.updateSettings = function (settings) {
23
- this.settings = sp_lodash_subset_1.merge(this.settings, settings);
23
+ this.settings = (0, sp_lodash_subset_1.merge)(this.settings, settings);
24
24
  this._normalizeContextIds();
25
25
  };
26
26
  Object.defineProperty(DiagnosticsSettingsManager, "isInitialized", {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLogToInteranaKSActivated = void 0;
3
+ exports.isViva1QoSKillSwitchActivated = exports.isAddHostTypeKSActivated = exports.isAddEduClassToEngagementKSActivated = exports.isLogToInteranaKSActivated = void 0;
4
4
  var sp_core_library_1 = require("@microsoft/sp-core-library");
5
5
  function isLogToInteranaKSActivated() {
6
6
  return sp_core_library_1._SPKillSwitch.isActivated('e562a19e-01fa-4707-ae9c-f6a4968e061e'
@@ -8,4 +8,25 @@ function isLogToInteranaKSActivated() {
8
8
  );
9
9
  }
10
10
  exports.isLogToInteranaKSActivated = isLogToInteranaKSActivated;
11
+ function isAddEduClassToEngagementKSActivated() {
12
+ return sp_core_library_1._SPKillSwitch.isActivated('6529d10e-5177-40ef-9c95-4b3b947e8795'
13
+ /* '05/06/2022',
14
+ 'Add edu class to engagement'*/
15
+ );
16
+ }
17
+ exports.isAddEduClassToEngagementKSActivated = isAddEduClassToEngagementKSActivated;
18
+ function isAddHostTypeKSActivated() {
19
+ return sp_core_library_1._SPKillSwitch.isActivated('4d1e88a3-938f-478b-acc9-d4021ef40c53'
20
+ /* '05/12/2022',
21
+ 'Add host type to reliability extra data'*/
22
+ );
23
+ }
24
+ exports.isAddHostTypeKSActivated = isAddHostTypeKSActivated;
25
+ function isViva1QoSKillSwitchActivated() {
26
+ return sp_core_library_1._SPKillSwitch.isActivated('74a07914-666d-4657-abed-237ad633ad7e'
27
+ /* '2022-05-23',
28
+ 'Logs Viva1p App context' */
29
+ );
30
+ }
31
+ exports.isViva1QoSKillSwitchActivated = isViva1QoSKillSwitchActivated;
11
32
  //# sourceMappingURL=Killswitches.js.map
@@ -4,6 +4,7 @@ exports.setPageExtraData = void 0;
4
4
  var sp_core_library_1 = require("@microsoft/sp-core-library");
5
5
  var PromotedState_1 = require("./PromotedState");
6
6
  var PageType_1 = require("./PageType");
7
+ var Killswitches_1 = require("../common/Killswitches");
7
8
  function setPageExtraData(contextInfo, extraData) {
8
9
  extraData.pageId = contextInfo.pageId;
9
10
  extraData.isHub = contextInfo.isHubSite;
@@ -20,6 +21,9 @@ function setPageExtraData(contextInfo, extraData) {
20
21
  }
21
22
  if (sp_core_library_1._BrowserUtilities.isTeamsHosted()) {
22
23
  extraData.displayApp = "Teams" /* Teams */;
24
+ if (!(0, Killswitches_1.isAddEduClassToEngagementKSActivated)() && contextInfo.isEduClass) {
25
+ extraData.isEduClass = true;
26
+ }
23
27
  }
24
28
  else {
25
29
  extraData.displayApp = "Sharepoint" /* Sharepoint */;
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports._ExecutionQueue = exports._QosResultType = exports._QosLogger = exports._QosMonitorShareFailureWithCP = exports._AutoAlertableMonitorType = exports._AutoAlertableQosMonitor = exports._QosMonitor = exports._LogHandler = exports._EngagementLogger = exports._LogManager = exports._CircularBuffer = exports._LogLevel = exports._LogEvent = exports._PageType = exports._PromotedState = exports._Diagnostics = exports._LogType = exports._logSourceServiceKey = exports._LogSource = exports._LogFeature = exports._LogEntry = exports._TraceLogger = void 0;
3
7
  /**
4
8
  * This package defines the internal diagnostics tools for the SharePoint Framework,
5
9
  * including monitoring, trace, user engagement and performance logging.
@@ -7,45 +11,45 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
11
  * @packagedocumentation
8
12
  */
9
13
  var TraceLogger_1 = require("./Api/Trace/TraceLogger");
10
- Object.defineProperty(exports, "_TraceLogger", { enumerable: true, get: function () { return TraceLogger_1.default; } });
14
+ Object.defineProperty(exports, "_TraceLogger", { enumerable: true, get: function () { return __importDefault(TraceLogger_1).default; } });
11
15
  var LogEntry_1 = require("./Api/LogEntry");
12
- Object.defineProperty(exports, "_LogEntry", { enumerable: true, get: function () { return LogEntry_1.default; } });
16
+ Object.defineProperty(exports, "_LogEntry", { enumerable: true, get: function () { return __importDefault(LogEntry_1).default; } });
13
17
  var LogFeature_1 = require("./Api/LogFeature");
14
- Object.defineProperty(exports, "_LogFeature", { enumerable: true, get: function () { return LogFeature_1.default; } });
18
+ Object.defineProperty(exports, "_LogFeature", { enumerable: true, get: function () { return __importDefault(LogFeature_1).default; } });
15
19
  var LogSource_1 = require("./Api/LogSource");
16
- Object.defineProperty(exports, "_LogSource", { enumerable: true, get: function () { return LogSource_1.default; } });
20
+ Object.defineProperty(exports, "_LogSource", { enumerable: true, get: function () { return __importDefault(LogSource_1).default; } });
17
21
  Object.defineProperty(exports, "_logSourceServiceKey", { enumerable: true, get: function () { return LogSource_1.logSourceServiceKey; } });
18
22
  var LogType_1 = require("./Api/LogType");
19
- Object.defineProperty(exports, "_LogType", { enumerable: true, get: function () { return LogType_1.default; } });
23
+ Object.defineProperty(exports, "_LogType", { enumerable: true, get: function () { return __importDefault(LogType_1).default; } });
20
24
  var Diagnostics_1 = require("./Diagnostics");
21
- Object.defineProperty(exports, "_Diagnostics", { enumerable: true, get: function () { return Diagnostics_1.default; } });
25
+ Object.defineProperty(exports, "_Diagnostics", { enumerable: true, get: function () { return __importDefault(Diagnostics_1).default; } });
22
26
  var PromotedState_1 = require("./extraData/PromotedState");
23
27
  Object.defineProperty(exports, "_PromotedState", { enumerable: true, get: function () { return PromotedState_1.PromotedState; } });
24
28
  var PageType_1 = require("./extraData/PageType");
25
29
  Object.defineProperty(exports, "_PageType", { enumerable: true, get: function () { return PageType_1.PageType; } });
26
30
  var LogEvent_1 = require("./Api/Trace/LogEvent");
27
- Object.defineProperty(exports, "_LogEvent", { enumerable: true, get: function () { return LogEvent_1.default; } });
31
+ Object.defineProperty(exports, "_LogEvent", { enumerable: true, get: function () { return __importDefault(LogEvent_1).default; } });
28
32
  var LogLevel_1 = require("./Api/LogLevel");
29
33
  Object.defineProperty(exports, "_LogLevel", { enumerable: true, get: function () { return LogLevel_1.LogLevel; } });
30
34
  var CircularBuffer_1 = require("./Api/LogManager/CircularBuffer");
31
- Object.defineProperty(exports, "_CircularBuffer", { enumerable: true, get: function () { return CircularBuffer_1.default; } });
35
+ Object.defineProperty(exports, "_CircularBuffer", { enumerable: true, get: function () { return __importDefault(CircularBuffer_1).default; } });
32
36
  var LogManager_1 = require("./Api/LogManager/LogManager");
33
- Object.defineProperty(exports, "_LogManager", { enumerable: true, get: function () { return LogManager_1.default; } });
37
+ Object.defineProperty(exports, "_LogManager", { enumerable: true, get: function () { return __importDefault(LogManager_1).default; } });
34
38
  var EngagementLogger_1 = require("./Api/Engagement/EngagementLogger");
35
- Object.defineProperty(exports, "_EngagementLogger", { enumerable: true, get: function () { return EngagementLogger_1.default; } });
39
+ Object.defineProperty(exports, "_EngagementLogger", { enumerable: true, get: function () { return __importDefault(EngagementLogger_1).default; } });
36
40
  var LogHandler_1 = require("./Api/Log/LogHandler");
37
- Object.defineProperty(exports, "_LogHandler", { enumerable: true, get: function () { return LogHandler_1.default; } });
41
+ Object.defineProperty(exports, "_LogHandler", { enumerable: true, get: function () { return __importDefault(LogHandler_1).default; } });
38
42
  var QosMonitor_1 = require("./Api/Qos/QosMonitor");
39
- Object.defineProperty(exports, "_QosMonitor", { enumerable: true, get: function () { return QosMonitor_1.default; } });
43
+ Object.defineProperty(exports, "_QosMonitor", { enumerable: true, get: function () { return __importDefault(QosMonitor_1).default; } });
40
44
  var AutoAlertableQosMonitor_1 = require("./Api/Qos/AutoAlertableQosMonitor");
41
45
  Object.defineProperty(exports, "_AutoAlertableQosMonitor", { enumerable: true, get: function () { return AutoAlertableQosMonitor_1.AutoAlertableQosMonitor; } });
42
46
  Object.defineProperty(exports, "_AutoAlertableMonitorType", { enumerable: true, get: function () { return AutoAlertableQosMonitor_1.AutoAlertableMonitorType; } });
43
47
  var QosMonitorShareFailureWithCP_1 = require("./Api/Qos/QosMonitorShareFailureWithCP");
44
48
  Object.defineProperty(exports, "_QosMonitorShareFailureWithCP", { enumerable: true, get: function () { return QosMonitorShareFailureWithCP_1.QosMonitorShareFailureWithCP; } });
45
49
  var QosLogger_1 = require("./Api/Qos/QosLogger");
46
- Object.defineProperty(exports, "_QosLogger", { enumerable: true, get: function () { return QosLogger_1.default; } });
50
+ Object.defineProperty(exports, "_QosLogger", { enumerable: true, get: function () { return __importDefault(QosLogger_1).default; } });
47
51
  var QosResultType_1 = require("./Api/Qos/QosResultType");
48
52
  Object.defineProperty(exports, "_QosResultType", { enumerable: true, get: function () { return QosResultType_1.QosResultType; } });
49
53
  var ExecutionQueue_1 = require("./Api/ExecutionQueue");
50
- Object.defineProperty(exports, "_ExecutionQueue", { enumerable: true, get: function () { return ExecutionQueue_1.default; } });
54
+ Object.defineProperty(exports, "_ExecutionQueue", { enumerable: true, get: function () { return __importDefault(ExecutionQueue_1).default; } });
51
55
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@microsoft/sp-diagnostics",
3
- "version": "1.15.0-beta.1",
3
+ "version": "1.15.0",
4
4
  "description": "Diagnostics tools for the SharePoint Framework",
5
5
  "license": "SEE LICENSE IN \"EULA\" FOLDER",
6
6
  "main": "lib-commonjs/index.js",
7
7
  "module": "lib/index.js",
8
8
  "typings": "dist/index-internal.d.ts",
9
9
  "dependencies": {
10
- "@microsoft/sp-core-library": "1.15.0-beta.1",
11
- "@microsoft/sp-lodash-subset": "1.15.0-beta.1"
10
+ "@microsoft/sp-core-library": "1.15.0",
11
+ "@microsoft/sp-lodash-subset": "1.15.0"
12
12
  },
13
13
  "scripts": {},
14
14
  "engines": {
@@ -1 +0,0 @@
1
- define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.15.0",["tslib","@microsoft/sp-lodash-subset","@microsoft/sp-core-library"],function(n,a,i){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="mwqp")}({"17wl":function(e,t){e.exports=n},Pk8u:function(e,t){e.exports=a},UWqr:function(e,t){e.exports=i},mwqp:function(e,t,n){"use strict";n.r(t),n.d(t,"_TraceLogger",function(){return p}),n.d(t,"_LogEntry",function(){return g}),n.d(t,"_LogFeature",function(){return m}),n.d(t,"_LogSource",function(){return o}),n.d(t,"_logSourceServiceKey",function(){return s}),n.d(t,"_LogType",function(){return b}),n.d(t,"_Diagnostics",function(){return S}),n.d(t,"_PromotedState",function(){return _}),n.d(t,"_PageType",function(){return h}),n.d(t,"_LogEvent",function(){return l}),n.d(t,"_LogLevel",function(){return a}),n.d(t,"_CircularBuffer",function(){return c}),n.d(t,"_LogManager",function(){return d}),n.d(t,"_EngagementLogger",function(){return D}),n.d(t,"_LogHandler",function(){return I}),n.d(t,"_QosMonitor",function(){return E}),n.d(t,"_AutoAlertableQosMonitor",function(){return k}),n.d(t,"_AutoAlertableMonitorType",function(){return L}),n.d(t,"_QosMonitorShareFailureWithCP",function(){return M}),n.d(t,"_QosLogger",function(){return w}),n.d(t,"_QosResultType",function(){return x}),n.d(t,"_ExecutionQueue",function(){return O});var a,i=n("UWqr"),r=function(){function e(e){i.Validate.isNotNullOrUndefined(e,"id"),this._id=e}return e.create=function(t){return new e(t)},Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._id.length},e}(),o=r,s=i.ServiceKey.createCustom("sp-client-base:LogSource",function(e){return r.create("")}),c=function(){function e(e){if(this._head=-1,this._count=0,this._isIterating=!1,e<=0)throw new Error("Size must be positive");this._size=e,this._buffer=new Array(e)}return Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),e.prototype.push=function(e){this._ensureNotIterating(),this._head++,this._count++,this._head===this._size&&(this._head=0),this._buffer[this._head]=e},e.prototype.forEach=function(e){if(0!==this._count){this._isIterating=!0;try{for(var t=this._tail,n=0;n<this._size&&(e(this._buffer[t]),t!==this._head);n++)t=this._getNext(t)}finally{this._isIterating=!1}}},e.prototype.removeAll=function(){this._ensureNotIterating(),this._head=-1,this._count=0},Object.defineProperty(e.prototype,"_tail",{get:function(){return this._isNotWrapped()?0:this._getNext(this._head)},enumerable:!1,configurable:!0}),e.prototype._isNotWrapped=function(){return this._count===this._head+1},e.prototype._getNext=function(e){var t=e+1;return t===this._size&&(t=0),t},e.prototype._ensureNotIterating=function(){if(this._isIterating)throw new Error("Circular buffer cannot be modified during iteration")},e}(),d=function(){function e(t){this._shouldLogInRealTime=[],this._handlers=[],this._events=new c(e._maxVerboseLog),t&&this.addHandler(t)}return Object.defineProperty(e,"_maxVerboseLog",{get:function(){return 5e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){return this._events},enumerable:!1,configurable:!0}),e.prototype.addHandler=function(e){this._containsHandler(e)||(this._handlers.push(e),this._shouldLogInRealTime.push(!1))},e.prototype.log=function(e){Object.freeze(e),this._events.push(e),this._processLogEvent(e)},e.prototype.removeHandler=function(e){var t=this._handlers.indexOf(e);t>-1&&(this._handlers.splice(t,1),this._shouldLogInRealTime.splice(t,1))},e.prototype.reset=function(){this._handlers=[],this._shouldLogInRealTime=[],this._events.removeAll()},e.prototype.processAll=function(e){this._handlers.indexOf(e)>-1&&this._processAllEvents(e)},e.prototype._containsHandler=function(e){for(var t=0,n=this._handlers;t<n.length;t++)if(n[t]===e)return!0;return!1},e.prototype._processAllEvents=function(e){this._events.forEach(function(t){if(t)try{e(t)}catch(e){console.error("failed to handle event:"+e.toString())}}),this._shouldLogInRealTime[this._handlers.indexOf(e)]=!0},e.prototype._processLogEvent=function(e){for(var t=0;t<this._handlers.length;t++)if(this._shouldLogInRealTime[t]&&e)try{this._handlers[t](e)}catch(e){console.error("failed to handle event:"+e.toString())}},e}(),l=function(){function e(e,t,n,a){this._validate(e,t),this._timestamp=(new Date).getTime(),this._scope=this._getScope(a),this._source=e.substr(0,this._maxSourceLength),this._setData(t),this._level=n,this._prefix=this._getPrefix()}return e.log=function(t,n,a,i){var r=new e(t,n,a,i);return e.logManager.log(r),r},e.prototype.toString=function(){var e="["+this._timestamp+"]["+this._prefix+"]";return this._message?e+" "+this._message:this._error?e+" "+this._error.toString():e},Object.defineProperty(e.prototype,"timestamp",{get:function(){return this._timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this._level},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"prefix",{get:function(){return this._prefix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scope",{get:function(){return this._scope},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"source",{get:function(){return this._source},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"error",{get:function(){return this._error},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_maxSourceLength",{get:function(){return 30},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_maxMessageLength",{get:function(){return 150},enumerable:!1,configurable:!0}),e.prototype._validate=function(e,t){if(!e)throw new Error("source cannot be undefined or null for Logger");if(!t)throw new Error("data cannot be undefined or null")},e.prototype._setData=function(e){"string"==typeof e?this._message=e.substr(0,this._maxMessageLength):e instanceof Error&&(this._error=e)},e.prototype._getPrefix=function(){var e=""+this._source;return this._scope&&!this._scope.isEmpty()&&(e=this._scope.id.substr(0,this._maxSourceLength)+"."+e),""+e},e.prototype._getScope=function(e){var t;return e&&e.whenFinished(function(){t=e.consume(s)}),t},e.logManager=new d,e}();!function(e){e[e.Verbose=1]="Verbose",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error"}(a||(a={}));var u,f=function(){function e(){}return e.prototype.log=function(e){console.log("Error: "+e.data+", Event Name: "+e.eventName+", Result Code: "+e.resultCode)},e.prototype.verbose=function(e){console.log("Error: "+e.data+", Event Name: "+e.eventName)},e}(),p=function(){function e(){}return e._addHandler=function(t){e._logManager.addHandler(t.log),e._logManager.processAll(t.log),e._verboseLogManager.addHandler(t.verbose),e._verboseLogManager.processAll(t.verbose)},e.logError=function(e,t,n,a){i.Validate.isNotNullOrUndefined(t,"error"),this._log(e,t,n,!0,a)},e.logErrorData=function(e){i.Validate.isNotNullOrUndefined(e.error,"error");var t=e.logEntry?e.logEntry.toString():e.error;this._log(e.source,t,e.eventName,!0,e.resultCode,e.serviceScope)},e.logVerbose=function(e,t,n){i.Validate.isNonemptyString(t,"message"),this._log(e,t,n,!1,void 0)},e.logVerboseData=function(e){var t=e.logEntry?e.logEntry.toString():e.message;this._log(e.source,t,e.eventName,!1,void 0,e.serviceScope)},e.logErrorWithLogEntry=function(e,t,n,a){i.Validate.isNotNullOrUndefined(e,"source"),i.Validate.isNotNullOrUndefined(t,"logEntry"),this._log(e,t.toString(),n,!0,a)},Object.defineProperty(e,"shouldWriteToConsole",{get:function(){return e._shouldWriteToConsole},set:function(t){e._shouldWriteToConsole&&!t?(e._logManager.removeHandler(e._defaultLogger.log),e._verboseLogManager.removeHandler(e._defaultLogger.verbose)):!e._shouldWriteToConsole&&t&&(e._logManager.addHandler(e._defaultLogger.log),e._verboseLogManager.addHandler(e._defaultLogger.verbose)),e._shouldWriteToConsole=t},enumerable:!1,configurable:!0}),e.logVerboseWithLogEntry=function(e,t,n){i.Validate.isNotNullOrUndefined(t,"LogEntry"),this._log(e,t.toString(),n,!1,void 0)},e._log=function(t,n,i,r,o,s){var c,d=this._addEventPrefix(t,i);r?(c=l.log(d,n,a.Error,s),e._logManager.log({data:n,eventName:c.prefix,resultCode:o})):(c=l.log(d,n.toString(),a.Verbose,s),e._verboseLogManager.log({data:n,eventName:c.prefix})),e.shouldWriteToConsole&&this._writeToConsole(c,r,o)},e._addEventPrefix=function(e,t){return t?e.id+"."+t:e.id},e._writeToConsole=function(e,t,n){var a=e.toString();n&&(a+=". resultCode: "+n),t?console.error(a):console.log(a)},e._logManager=new d,e._verboseLogManager=new d,e._defaultLogger=new f,e._shouldWriteToConsole=!1,e}(),m=function(){function e(){}return e.None="None",e}();!function(e){e[e.Trace=1]="Trace",e[e.Event=2]="Event",e[e.Error=3]="Error"}(u||(u={}));var _,h,b=u,g=function(){function e(e,t,n,a,i){if(void 0===t&&(t=m.None),void 0===n&&(n=b.Trace),!e)throw new Error("moduleName is invalid");this.moduleName=e,this.logFeature=t,this.logType=n,this.logProperties=a,this.isIntentional=i}return e.prototype.toString=function(){var e=void 0;if(this.logProperties)try{e=JSON.stringify(this.logProperties)}catch(e){console.log("Error happens in toString():"+e)}return this.moduleName+" | "+this.logFeature+" | "+this.logType+" | "+e},e}(),v=n("Pk8u"),y=function(){function e(){}return e.initialize=function(e){this.settings=Object(v.cloneDeep)(e),this._initialized=!0,this._normalizeContextIds()},e.updateSettings=function(e){this.settings=Object(v.merge)(this.settings,e),this._normalizeContextIds()},Object.defineProperty(e,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),e._normalizeId=function(e){var t=i.Guid.tryParse(e);return(null==t?void 0:t.toString())||e},e._normalizeContextIds=function(){this.settings.siteId=this._normalizeId(this.settings.siteId),this.settings.webId=this._normalizeId(this.settings.webId),this.settings.correlationId=this._normalizeId(this.settings.correlationId),this.settings.listId&&(this.settings.listId=this._normalizeId(this.settings.listId),this.settings.listItemUniqueId&&(this.settings.listItemUniqueId=this._normalizeId(this.settings.listItemUniqueId)))},e._initialized=!1,e}(),S=function(){function e(){}return e.initialize=function(t){e._isInitialized||(y.initialize(t),p.shouldWriteToConsole=t.enableConsoleLog,p._addHandler({log:function(e){i.Log.info(e.eventName,"EventName:"+e.data.toString()+", ResultCode: "+e.resultCode)},verbose:function(e){i.Log.verbose(e.eventName,e.data.toString())}}),e._isInitialized=!0)},Object.defineProperty(e,"isInitialized",{get:function(){return this._isInitialized},enumerable:!1,configurable:!0}),e.updateSettings=function(e){y.updateSettings(e)},e._isInitialized=!1,e}();!function(e){e[e.NotPromoted=0]="NotPromoted",e[e.Promoted=2]="Promoted"}(_||(_={})),function(e){e.News="News",e.Article="Article",e.Home="Home",e.Space="Space",e.NewsDigest="NewsDigest"}(h||(h={}));var D=function(){function e(){}return e._addHandler=function(t){e._handler=function(e){t.logData(e)},e._logManager.addHandler(e._handler)},e.startRealTimeProcessing=function(){this._shouldProcessInRealTime||(e._logManager.processAll(e._handler),this._shouldProcessInRealTime=!0)},e.log=function(t){e._logEngagementData(t)},e.logEvent=function(t,n){var a={name:t};n&&0!==n.length&&(a.extraData={action:n}),e._logEngagementData(a)},e.logEventWithLogEntry=function(t){var n={isIntentional:t.isIntentional,name:t.moduleName+"."+t.logFeature,extraData:t.logProperties};e._logEngagementData(n,!0)},e._logEngagementData=function(t,n){if(void 0===n&&(n=!1),!t.name||0===t.name.length)throw new Error("LogEntry is invalid");e._checkValidTagName(t,n),e._addContextData(t),e._appendExtraData(t),e._logManager.log(t)},e._checkValidTagName=function(e,t){if(void 0===t&&(t=!1),!t&&!1===/(\w+)\.(\w+).(\w+)/gi.test(e.name))throw new Error(e.name+" tagName does not follow AppName.ControlName.ActionName pattern")},e._addContextData=function(e){if(y.isInitialized){var t=y.settings,n=t.listId,a=t.listItemUniqueId,i=t.siteId,r=t.webId;e.siteId=i,e.webId=r,n&&(e.listId=n,a&&(e.docId=a))}},e._appendExtraData=function(e){if(y.isInitialized){var t=y.settings.contextInfo;t&&(e.extraData||(e.extraData={}),function(e,t){t.pageId=e.pageId,t.isHub=e.isHubSite,e.isHubSite?(t.hubSiteId=e.hubSiteId,t.isAssociatedSite=!1):!e.isHubSite&&e.hubSiteId?t.isAssociatedSite=!0:t.isAssociatedSite=!1,i._BrowserUtilities.isTeamsHosted()?t.displayApp="Teams":t.displayApp="Sharepoint",t.userAgent=navigator.userAgent;var n,a=e.webTemplate;t.webTemplate=a,"1"===a?n="TeamSite":"64"===a?n="GroupSite":"68"===a&&(n="CommunicationSite");var r=e.promotedState,o=e.pageType,s=o;o===h.Article&&(s=r===_.NotPromoted||void 0===r?h.Article:h.News),t.siteType=n,t.pageType=s}(t,e.extraData))}},e._logManager=new d,e}(),I=function(){function e(){}return e.prototype.verbose=function(e,t,n){l.log(e,t,a.Verbose,n)},e.prototype.info=function(e,t,n){l.log(e,t,a.Info,n)},e.prototype.warn=function(e,t,n){l.log(e,t,a.Warning,n)},e.prototype.error=function(e,t,n){l.log(e,t,a.Error,n)},e}(),x={Success:0,Failure:1,ExpectedFailure:2},C=function(){function e(){this._shouldExecuteInRealTime=!1,this._handlers={},this._executionEntries=[]}return Object.defineProperty(e.prototype,"shouldExecuteInRealTime",{get:function(){return this._shouldExecuteInRealTime},set:function(e){this._shouldExecuteInRealTime=e,this._shouldExecuteInRealTime&&this.flush()},enumerable:!1,configurable:!0}),e.prototype.addHandler=function(e,t){if(!this._containsHandler(e,t)){this._initializeHandlerArrayForKey(e);var n=this._handlers[e];-1===n.indexOf(t)&&n.push(t)}},e.prototype.addExecutionEntry=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Object.freeze(t),this._shouldExecuteInRealTime?this._processExecutionEntry(e,t):this._executionEntries.push({key:e,args:t})},e.prototype.removeHandler=function(e,t){var n=this._handlers[e].indexOf(t);n>-1&&this._handlers[e].splice(n,1)},e.prototype.reset=function(){this._handlers={},this._executionEntries=[]},e.prototype.flush=function(){this._processAllExecutionEntries(),this._executionEntries=[]},e.prototype._containsHandler=function(e,t){return null!==this._handlers[e]&&void 0!==this._handlers[e]&&this._handlers[e].indexOf(t)>-1},e.prototype._initializeHandlerArrayForKey=function(e){null!==this._handlers[e]&&void 0!==this._handlers[e]||(this._handlers[e]=[])},e.prototype._processAllExecutionEntries=function(){for(var e=0,t=this._executionEntries;e<t.length;e++){var n=t[e];if(n&&this._handlers[n.key])try{for(var a=0,i=this._handlers[n.key];a<i.length;a++)i[a].apply(this,n.args)}catch(e){console.error("failed to process execution entry:"+e.toString())}}},e.prototype._processExecutionEntry=function(e,t){for(var n=0;n<this._handlers[e].length;n++)try{this._handlers[e][n].apply(this,t)}catch(e){console.error("failed to process execution entry:"+e.toString())}},e}(),O=C,w=function(){function e(){this._qosEvents=new Map,this._deferExecutor=new O,this._shouldProcessInRealTime=!1,this.initializeLogger()}return Object.defineProperty(e,"instance",{get:function(){return this._instance||(this._instance=new e),this._instance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shouldProcessInRealTime",{get:function(){return this._shouldProcessInRealTime},set:function(e){this._shouldProcessInRealTime=e,this._deferExecutor.shouldExecuteInRealTime=e},enumerable:!1,configurable:!0}),e.prototype.setLogger=function(e){this._qosLogger=e},e.prototype.getQosEvent=function(e){return this._qosEvents.get(e)},e.prototype.startQosMonitor=function(e,t){this._qosEvents.has(e)||this._deferExecutor.addExecutionEntry("start",e,t)},e.prototype.writeQosEndResult=function(e,t){this._deferExecutor.addExecutionEntry("end",e,t)},e.prototype._startMonitor=function(e,t){this._qosLogger&&this._qosEvents.set(e,new this._qosLogger(t))},e.prototype._endMonitor=function(e,t){var n=this._qosEvents.get(e);n&&(n.end(t),this._qosEvents.delete(e))},e.prototype.initializeLogger=function(){var e=this;this._deferExecutor.addHandler("start",function(t,n){e._startMonitor(t,n)}),this._deferExecutor.addHandler("end",function(t,n){e._endMonitor(t,n)})},e}(),E=function(){function e(e,t,n){var a;void 0===t&&(t=!1),void 0===n&&(n=!1),this._qosResultTypeValue=((a={})[x.Success]="Success",a[x.Failure]="Failure",a[x.ExpectedFailure]="ExpectedFailure",a),i.Validate.isNonemptyString(e,"scenarioName"),this._id=i.Guid.newGuid().toString(),this._isDebugSession()||w.instance.startQosMonitor(this._id,{name:e}),this._scenarioName=e,this._hasEnded=!1,this._copyToCosmos=t,this._copyToInterana=n}return e.startRealTimeProcessing=function(){w.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)},e._shouldProcessInRealTime=function(e){w.instance.shouldProcessInRealTime=e},Object.defineProperty(e.prototype,"name",{get:function(){return this._scenarioName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shortEventName",{get:function(){return"Qos"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resultCode",{get:function(){return this._endResultCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resultType",{get:function(){return this._endResult},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._endExtraData},set:function(e){this._endExtraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasEnded",{get:function(){return this._hasEnded},enumerable:!1,configurable:!0}),e.prototype.writeSuccess=function(e){this._writeQosEnd(x.Success,void 0,void 0,e)},e.prototype.writeUnexpectedFailure=function(e,t,n){void 0===e&&(e="DefaultUnexpected"),this._writeQosEnd(x.Failure,e,t,n)},e.prototype.writeExpectedFailure=function(e,t,n){void 0===e&&(e="DefaultExpected"),this._writeQosEnd(x.ExpectedFailure,e,t,n)},e.prototype._writeQosEnd=function(e,t,n,a){if(!this._shouldSkip(e)){this._ensureCorrelationId(e,a),this._endResultCode=t,this._endResult=e;var i={resultCode:this._endResultCode,resultType:this._endResult,error:n?n.message:void 0,extraData:this._endExtraData};w.instance.writeQosEndResult(this._id,i),this._writeToEngagement()}},e.prototype._ensureCorrelationId=function(e,t){var n=this;if(t&&(this._endExtraData||(this._endExtraData={}),Object.keys(t).forEach(function(e){return n._endExtraData[e]=t[e]})),y.isInitialized&&e!==x.Success){var a="CorrelationId",i=this._endExtraData&&(this._endExtraData[a]||this._endExtraData.correlationId)||y.settings.correlationId;i&&(this._endExtraData||(this._endExtraData={}),this._endExtraData[a]=i)}},e.prototype._isDebugSession=function(){return!!sessionStorage.getItem("spfx-debug")},e.prototype._shouldSkip=function(t){if(this._hasEnded&&void 0!==this._endResult){var n=i.Text.format(e.qosMonitorHasEndedErrorString,this.name,this._qosResultTypeValue[this._endResult],this._qosResultTypeValue[t]);return this._endResult!==t&&p.logError(e.logSource,new Error(n)),!0}return this._hasEnded=!0,this._isDebugSession()},e.prototype._writeToEngagement=function(){if(!i._SPKillSwitch.isActivated("e562a19e-01fa-4707-ae9c-f6a4968e061e")&&this._copyToInterana&&D.log({name:this.name,extraData:this.extraData||{}}),this._copyToCosmos){var e={name:"Spfx.Qos.ToEngagement",extraData:this.extraData||{}};e.extraData.qosName=this.name,this.resultType&&(e.extraData.qosResultType=this._qosResultTypeValue[this.resultType]),this.resultCode&&(e.extraData.qosResultCode=this.resultCode),D.log(e)}},e.logSource={id:"QosMonitor"},e.qosMonitorHasEndedErrorString="QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",e}(),A=n("17wl"),L={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4",DynamicReliabilityExpectedFailureHighSev4:"DynamicReliabilityExpectedFailureHighSev4"},k=function(e){function t(t,n,a){void 0===a&&(a=!1);var i=e.call(this,t,!1,a)||this;return i._autoAlertableMonitorType=n,i}return Object(A.__extends)(t,e),t.prototype.writeSuccess=function(t){e.prototype.writeSuccess.call(this,this.getExtraDataWithAutoAlertableFields(t))},t.prototype.writeUnexpectedFailure=function(t,n,a){void 0===t&&(t="DefaultUnexpected"),e.prototype.writeUnexpectedFailure.call(this,t,n,this.getExtraDataWithAutoAlertableFields(a))},t.prototype.writeExpectedFailure=function(t,n,a){void 0===t&&(t="DefaultExpected"),e.prototype.writeExpectedFailure.call(this,t,n,this.getExtraDataWithAutoAlertableFields(a))},t.prototype.getExtraDataWithAutoAlertableFields=function(e){var t=null!=e?e:{};return t.autoAlertableMonitorType=L[this._autoAlertableMonitorType],t},t}(E),M=function(e){function t(t,n,a){void 0===n&&(n=!1);var i=e.call(this,t,!1,n)||this;return i._extraDataForCustomerPromise=a,i}return Object(A.__extends)(t,e),t.prototype.writeUnexpectedFailure=function(t,n,a){void 0===t&&(t="DefaultUnexpected"),e.prototype.writeUnexpectedFailure.call(this,t,n,a),this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",t,x.Failure,(null==a?void 0:a.pageType)?a.pageType:void 0)},t.prototype.writeExpectedFailure=function(t,n,a){void 0===t&&(t="DefaultExpected"),e.prototype.writeExpectedFailure.call(this,t,n,a),this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",t,x.ExpectedFailure,(null==a?void 0:a.pageType)?a.pageType:void 0)},t.prototype._logCustomerPromiseFailure=function(e,t,n,a){void 0===n&&(n=x.Failure),this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(function(i){var r=i.errorModuleName;(0,i.logFailure)({errorCode:r,errorScenario:t,errorMessage:e,resultType:n,pageType:a||void 0})})},t}(E)}})});