@microsoft/sp-diagnostics 1.13.0-beta.15 → 1.13.0-beta.22
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.
- package/dist/78359e4b-07c2-43c6-8d0b-d060b4d577e8.manifest.json +1 -1
- package/dist/index-internal-beta.d.ts +6 -0
- package/dist/index-internal-public.d.ts +6 -0
- package/dist/index-internal.d.ts +6 -0
- package/dist/sp-diagnostics_none_d7d3564bdba72da0b1a7.js +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Api/Engagement/EngagementLogger.js +4 -4
- package/lib-commonjs/Api/ILogEntry.js +4 -4
- package/lib-commonjs/Api/LogFeature.js +4 -4
- package/lib-commonjs/Api/Qos/AutoAlertableQosMonitor.js +8 -2
- package/lib-commonjs/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +3 -0
- package/lib-commonjs/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +3 -0
- package/lib-commonjs/Api/Qos/QosMonitorShareFailureWithCP.js +80 -0
- package/lib-commonjs/Api/Trace/ITraceLogger.js +4 -4
- package/lib-commonjs/index.js +2 -0
- package/package.json +3 -3
- package/dist/sp-diagnostics_none_a2c3f7219b11938e83a0.js +0 -1
|
@@ -28,6 +28,8 @@ import { ServiceScope } from '@microsoft/sp-core-library';
|
|
|
28
28
|
|
|
29
29
|
/* Excluded from this release type: _IABExperiment */
|
|
30
30
|
|
|
31
|
+
/* Excluded from this release type: _ICustomerPromiseErrorDetails */
|
|
32
|
+
|
|
31
33
|
/* Excluded from this release type: _IDiagnosticContextInfo */
|
|
32
34
|
|
|
33
35
|
/* Excluded from this release type: _IDiagnosticsSettings */
|
|
@@ -36,6 +38,8 @@ import { ServiceScope } from '@microsoft/sp-core-library';
|
|
|
36
38
|
|
|
37
39
|
/* Excluded from this release type: _IEngagementHandler */
|
|
38
40
|
|
|
41
|
+
/* Excluded from this release type: _IExtraDataForCustomerPromise */
|
|
42
|
+
|
|
39
43
|
/* Excluded from this release type: _ILogData */
|
|
40
44
|
|
|
41
45
|
/* Excluded from this release type: _ILogEntry */
|
|
@@ -91,6 +95,8 @@ export declare const _logSourceServiceKey: ServiceKey<_LogSource>;
|
|
|
91
95
|
|
|
92
96
|
/* Excluded from this release type: _QosMonitor */
|
|
93
97
|
|
|
98
|
+
/* Excluded from this release type: _QosMonitorShareFailureWithCP */
|
|
99
|
+
|
|
94
100
|
/* Excluded from this release type: _QosResultType */
|
|
95
101
|
|
|
96
102
|
/* Excluded from this release type: _SiteType */
|
|
@@ -28,6 +28,8 @@ import { ServiceScope } from '@microsoft/sp-core-library';
|
|
|
28
28
|
|
|
29
29
|
/* Excluded from this release type: _IABExperiment */
|
|
30
30
|
|
|
31
|
+
/* Excluded from this release type: _ICustomerPromiseErrorDetails */
|
|
32
|
+
|
|
31
33
|
/* Excluded from this release type: _IDiagnosticContextInfo */
|
|
32
34
|
|
|
33
35
|
/* Excluded from this release type: _IDiagnosticsSettings */
|
|
@@ -36,6 +38,8 @@ import { ServiceScope } from '@microsoft/sp-core-library';
|
|
|
36
38
|
|
|
37
39
|
/* Excluded from this release type: _IEngagementHandler */
|
|
38
40
|
|
|
41
|
+
/* Excluded from this release type: _IExtraDataForCustomerPromise */
|
|
42
|
+
|
|
39
43
|
/* Excluded from this release type: _ILogData */
|
|
40
44
|
|
|
41
45
|
/* Excluded from this release type: _ILogEntry */
|
|
@@ -91,6 +95,8 @@ export declare const _logSourceServiceKey: ServiceKey<_LogSource>;
|
|
|
91
95
|
|
|
92
96
|
/* Excluded from this release type: _QosMonitor */
|
|
93
97
|
|
|
98
|
+
/* Excluded from this release type: _QosMonitorShareFailureWithCP */
|
|
99
|
+
|
|
94
100
|
/* Excluded from this release type: _QosResultType */
|
|
95
101
|
|
|
96
102
|
/* Excluded from this release type: _SiteType */
|
package/dist/index-internal.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ import { ServiceScope } from '@microsoft/sp-core-library';
|
|
|
28
28
|
|
|
29
29
|
/* Excluded from this release type: _IABExperiment */
|
|
30
30
|
|
|
31
|
+
/* Excluded from this release type: _ICustomerPromiseErrorDetails */
|
|
32
|
+
|
|
31
33
|
/* Excluded from this release type: _IDiagnosticContextInfo */
|
|
32
34
|
|
|
33
35
|
/* Excluded from this release type: _IDiagnosticsSettings */
|
|
@@ -36,6 +38,8 @@ import { ServiceScope } from '@microsoft/sp-core-library';
|
|
|
36
38
|
|
|
37
39
|
/* Excluded from this release type: _IEngagementHandler */
|
|
38
40
|
|
|
41
|
+
/* Excluded from this release type: _IExtraDataForCustomerPromise */
|
|
42
|
+
|
|
39
43
|
/* Excluded from this release type: _ILogData */
|
|
40
44
|
|
|
41
45
|
/* Excluded from this release type: _ILogEntry */
|
|
@@ -91,6 +95,8 @@ export declare const _logSourceServiceKey: ServiceKey<_LogSource>;
|
|
|
91
95
|
|
|
92
96
|
/* Excluded from this release type: _QosMonitor */
|
|
93
97
|
|
|
98
|
+
/* Excluded from this release type: _QosMonitorShareFailureWithCP */
|
|
99
|
+
|
|
94
100
|
/* Excluded from this release type: _QosResultType */
|
|
95
101
|
|
|
96
102
|
/* Excluded from this release type: _SiteType */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.13.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 w}),n.d(t,"_AutoAlertableQosMonitor",function(){return L}),n.d(t,"_AutoAlertableMonitorType",function(){return A}),n.d(t,"_QosMonitorShareFailureWithCP",function(){return k}),n.d(t,"_QosLogger",function(){return O}),n.d(t,"_QosResultType",function(){return x}),n.d(t,"_ExecutionQueue",function(){return C});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=function(){function e(){this._qosEvents=new Map,this._deferExecutor=new C,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}(),w=function(){function e(e,t){var n;void 0===t&&(t=!1),this._qosResultTypeValue=((n={})[x.Success]="Success",n[x.Failure]="Failure",n[x.ExpectedFailure]="ExpectedFailure",n),i.Validate.isNonemptyString(e,"scenarioName"),this._id=i.Guid.newGuid().toString(),this._isDebugSession()||O.instance.startQosMonitor(this._id,{name:e}),this._scenarioName=e,this._hasEnded=!1,this._copyToEngagement=t}return e.startRealTimeProcessing=function(){O.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)},e._shouldProcessInRealTime=function(e){O.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};O.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=this._endExtraData&&(this._endExtraData.CorrelationId||this._endExtraData.correlationId)||y.settings.correlationId;a&&(this._endExtraData||(this._endExtraData={}),this._endExtraData.CorrelationId=a)}},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(this._shouldWriteToEngagement()){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._shouldWriteToEngagement=function(){return this._copyToEngagement},e.logSource={id:"QosMonitor"},e.qosMonitorHasEndedErrorString="QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",e}(),E=n("17wl"),A={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4",DynamicReliabilityExpectedFailureHighSev4:"DynamicReliabilityExpectedFailureHighSev4"},L=function(e){function t(t,n,a){void 0===a&&(a=!1);var i=e.call(this,t,a)||this;return i._autoAlertableMonitorType=n,i}return Object(E.__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=A[this._autoAlertableMonitorType],t},t}(w),k=function(e){function t(t,n,a){void 0===n&&(n=!1);var i=e.call(this,t,n)||this;return i._extraDataForCustomerPromise=a,i}return Object(E.__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)},t.prototype.writeExpectedFailure=function(t,n,a){void 0===t&&(t="DefaultExpected"),e.prototype.writeUnexpectedFailure.call(this,t,n,a),this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",t,x.ExpectedFailure)},t.prototype._logCustomerPromiseFailure=function(e,t,n){void 0===n&&(n=x.Failure),this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(function(a){var i=a.errorModuleName;(0,a.logFailure)({errorCode:i,errorScenario:t,errorMessage:e,resultType:n})})},t}(w)}})});
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* @copyright Microsoft Corporation.All rights reserved.
|
|
4
|
-
* @file EngagementLogger.ts
|
|
5
|
-
* EngagementLogger logger
|
|
6
|
-
*/
|
|
3
|
+
* @copyright Microsoft Corporation.All rights reserved.
|
|
4
|
+
* @file EngagementLogger.ts
|
|
5
|
+
* EngagementLogger logger
|
|
6
|
+
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var LogManager_1 = tslib_1.__importDefault(require("../LogManager/LogManager"));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* @Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* @file ILogEntry.ts
|
|
5
|
-
* ILogEntry interface
|
|
6
|
-
*/
|
|
3
|
+
* @Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* @file ILogEntry.ts
|
|
5
|
+
* ILogEntry interface
|
|
6
|
+
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
//# sourceMappingURL=ILogEntry.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* @file LogFeature.ts
|
|
4
|
-
* @Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Used for logging so you can filter logs by features.
|
|
6
|
-
*/
|
|
3
|
+
* @file LogFeature.ts
|
|
4
|
+
* @Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Used for logging so you can filter logs by features.
|
|
6
|
+
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
@@ -17,9 +17,15 @@ exports.AutoAlertableMonitorType = {
|
|
|
17
17
|
StaticReliabilityQos95Sev4: 'StaticReliabilityQos95Sev4',
|
|
18
18
|
/**
|
|
19
19
|
* If QoS drops below some dynamic threshold "Medium" sensitivity (as defined by Geneva)
|
|
20
|
-
* calculated from historical monitor data, a sev 4 is fired
|
|
20
|
+
* calculated from historical monitor data, a sev 4 is fired.
|
|
21
21
|
*/
|
|
22
|
-
DynamicReliabilityQosMediumSev4: 'DynamicReliabilityQosMediumSev4'
|
|
22
|
+
DynamicReliabilityQosMediumSev4: 'DynamicReliabilityQosMediumSev4',
|
|
23
|
+
/**
|
|
24
|
+
* If the number of expected errors increases past a "High" dynamic threshold sensitivity
|
|
25
|
+
* (as defined by Geneva) calculated from historical monitor data OR QoS drops below some
|
|
26
|
+
* dynamic threshold "Medium" sensitivity, a sev 4 is fired.
|
|
27
|
+
*/
|
|
28
|
+
DynamicReliabilityExpectedFailureHighSev4: 'DynamicReliabilityExpectedFailureHighSev4'
|
|
23
29
|
};
|
|
24
30
|
/**
|
|
25
31
|
* Qos logger which enforces using an existing altering monitor as determined by the
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QosMonitorShareFailureWithCP = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var QosMonitor_1 = tslib_1.__importDefault(require("./QosMonitor"));
|
|
6
|
+
var QosResultType_1 = require("./QosResultType");
|
|
7
|
+
/**
|
|
8
|
+
* Monitor which handles failures for QosMonitor and also invokes Customer Promise Handlers to record failure
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
var QosMonitorShareFailureWithCP = /** @class */ (function (_super) {
|
|
12
|
+
tslib_1.__extends(QosMonitorShareFailureWithCP, _super);
|
|
13
|
+
/**
|
|
14
|
+
* Creates a QoS monitor and also registers the Customer promise handlers to notify in case of failures
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* @param scenarioName - Unique name of the QoS scenario
|
|
18
|
+
* @param copyToEngagement - indicate whether this data should be used as Engagement as well.
|
|
19
|
+
* @param extraDataForCustomerPromise - Holds extra information about Customer Promise handlers to invoke
|
|
20
|
+
* and error information where failures are logged
|
|
21
|
+
*/
|
|
22
|
+
function QosMonitorShareFailureWithCP(scenarioName, copyToEngagement, extraDataForCustomerPromise) {
|
|
23
|
+
if (copyToEngagement === void 0) { copyToEngagement = false; }
|
|
24
|
+
var _this = _super.call(this, scenarioName, copyToEngagement) || this;
|
|
25
|
+
_this._extraDataForCustomerPromise = extraDataForCustomerPromise;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* QoS monitor ends with failure and invokes the Customer Promise handlers
|
|
30
|
+
* to log a failure
|
|
31
|
+
* @internal
|
|
32
|
+
*
|
|
33
|
+
* You will see failure tag: SPPages.ScenarioName.<failuretag>.Failure.
|
|
34
|
+
* <failuretag> will be filled with param tagName
|
|
35
|
+
*/
|
|
36
|
+
QosMonitorShareFailureWithCP.prototype.writeUnexpectedFailure = function (tagNameSuffix, ex, extraData // tslint:disable-line:no-any
|
|
37
|
+
) {
|
|
38
|
+
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultUnexpected'; }
|
|
39
|
+
_super.prototype.writeUnexpectedFailure.call(this, tagNameSuffix, ex, extraData);
|
|
40
|
+
this._logCustomerPromiseFailure((ex === null || ex === void 0 ? void 0 : ex.message) || 'DefaultErrorMessage', tagNameSuffix);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* QoS monitor ends with expected failure and invokes the Customer Promise handlers
|
|
44
|
+
* to log an expected failure
|
|
45
|
+
* @internal
|
|
46
|
+
*
|
|
47
|
+
* You will see success tag: ModernPublish.RenderPublishPage.<failuretag>.ExpectedFailure.
|
|
48
|
+
* <failuretag> will be filled with param tagName
|
|
49
|
+
*/
|
|
50
|
+
QosMonitorShareFailureWithCP.prototype.writeExpectedFailure = function (tagNameSuffix, ex, extraData // tslint:disable-line:no-any
|
|
51
|
+
) {
|
|
52
|
+
if (tagNameSuffix === void 0) { tagNameSuffix = 'DefaultExpected'; }
|
|
53
|
+
_super.prototype.writeUnexpectedFailure.call(this, tagNameSuffix, ex, extraData);
|
|
54
|
+
this._logCustomerPromiseFailure((ex === null || ex === void 0 ? void 0 : ex.message) || 'DefaultErrorMessage', tagNameSuffix, QosResultType_1.QosResultType.ExpectedFailure);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Invokes the registered Customer Promise Handlers by using the passed in serviceKey
|
|
58
|
+
* @param errorMessage - Information to indicate which scenario failed.
|
|
59
|
+
* @param errorScenario -Additional error details describing the failure from the module.
|
|
60
|
+
* @param resultType - ResultTypeEnum used to indicate expected or unexpected failure.
|
|
61
|
+
*/
|
|
62
|
+
QosMonitorShareFailureWithCP.prototype._logCustomerPromiseFailure = function (errorMessage, errorScenario, resultType) {
|
|
63
|
+
if (resultType === void 0) { resultType = QosResultType_1.QosResultType.Failure; }
|
|
64
|
+
if (this._extraDataForCustomerPromise) {
|
|
65
|
+
this._extraDataForCustomerPromise.forEach(function (extraHandlerInfo) {
|
|
66
|
+
var errorModuleName = extraHandlerInfo.errorModuleName, logFailure = extraHandlerInfo.logFailure;
|
|
67
|
+
var errorDetailsForCP = {
|
|
68
|
+
errorCode: errorModuleName,
|
|
69
|
+
errorScenario: errorScenario,
|
|
70
|
+
errorMessage: errorMessage,
|
|
71
|
+
resultType: resultType
|
|
72
|
+
};
|
|
73
|
+
logFailure(errorDetailsForCP);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return QosMonitorShareFailureWithCP;
|
|
78
|
+
}(QosMonitor_1.default));
|
|
79
|
+
exports.QosMonitorShareFailureWithCP = QosMonitorShareFailureWithCP;
|
|
80
|
+
//# sourceMappingURL=QosMonitorShareFailureWithCP.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* @copyright Microsoft Corporation.All rights reserved.
|
|
4
|
-
* @file ITraceLogger.ts
|
|
5
|
-
* ITraceLogger interface
|
|
6
|
-
*/
|
|
3
|
+
* @copyright Microsoft Corporation.All rights reserved.
|
|
4
|
+
* @file ITraceLogger.ts
|
|
5
|
+
* ITraceLogger interface
|
|
6
|
+
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
//# sourceMappingURL=ITraceLogger.js.map
|
package/lib-commonjs/index.js
CHANGED
|
@@ -40,6 +40,8 @@ Object.defineProperty(exports, "_QosMonitor", { enumerable: true, get: function
|
|
|
40
40
|
var AutoAlertableQosMonitor_1 = require("./Api/Qos/AutoAlertableQosMonitor");
|
|
41
41
|
Object.defineProperty(exports, "_AutoAlertableQosMonitor", { enumerable: true, get: function () { return AutoAlertableQosMonitor_1.AutoAlertableQosMonitor; } });
|
|
42
42
|
Object.defineProperty(exports, "_AutoAlertableMonitorType", { enumerable: true, get: function () { return AutoAlertableQosMonitor_1.AutoAlertableMonitorType; } });
|
|
43
|
+
var QosMonitorShareFailureWithCP_1 = require("./Api/Qos/QosMonitorShareFailureWithCP");
|
|
44
|
+
Object.defineProperty(exports, "_QosMonitorShareFailureWithCP", { enumerable: true, get: function () { return QosMonitorShareFailureWithCP_1.QosMonitorShareFailureWithCP; } });
|
|
43
45
|
var QosLogger_1 = require("./Api/Qos/QosLogger");
|
|
44
46
|
Object.defineProperty(exports, "_QosLogger", { enumerable: true, get: function () { return QosLogger_1.default; } });
|
|
45
47
|
var QosResultType_1 = require("./Api/Qos/QosResultType");
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/sp-diagnostics",
|
|
3
|
-
"version": "1.13.0-beta.
|
|
3
|
+
"version": "1.13.0-beta.22",
|
|
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.13.0-beta.
|
|
11
|
-
"@microsoft/sp-lodash-subset": "1.13.0-beta.
|
|
10
|
+
"@microsoft/sp-core-library": "1.13.0-beta.22",
|
|
11
|
+
"@microsoft/sp-lodash-subset": "1.13.0-beta.22"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {},
|
|
14
14
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.13.0",["tslib","@microsoft/sp-lodash-subset","@microsoft/sp-core-library"],function(e,t,n){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},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(t,n){t.exports=e},Pk8u:function(e,n){e.exports=t},UWqr:function(e,t){e.exports=n},mwqp:function(e,t,n){"use strict";n.r(t),n.d(t,"_TraceLogger",function(){return f}),n.d(t,"_LogEntry",function(){return m}),n.d(t,"_LogFeature",function(){return g}),n.d(t,"_LogSource",function(){return s}),n.d(t,"_logSourceServiceKey",function(){return a}),n.d(t,"_LogType",function(){return y}),n.d(t,"_Diagnostics",function(){return E}),n.d(t,"_PromotedState",function(){return p}),n.d(t,"_PageType",function(){return _}),n.d(t,"_LogEvent",function(){return c}),n.d(t,"_LogLevel",function(){return o}),n.d(t,"_CircularBuffer",function(){return u}),n.d(t,"_LogManager",function(){return l}),n.d(t,"_EngagementLogger",function(){return x}),n.d(t,"_LogHandler",function(){return I}),n.d(t,"_QosMonitor",function(){return P}),n.d(t,"_AutoAlertableQosMonitor",function(){return L}),n.d(t,"_AutoAlertableMonitorType",function(){return D}),n.d(t,"_QosLogger",function(){return w}),n.d(t,"_QosResultType",function(){return S}),n.d(t,"_ExecutionQueue",function(){return T});var o,r=n("UWqr"),i=function(){function e(e){r.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}(),s=i,a=r.ServiceKey.createCustom("sp-client-base:LogSource",function(e){return i.create("")}),u=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}(),l=function(){function e(t){this._shouldLogInRealTime=[],this._handlers=[],this._events=new u(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}(),c=function(){function e(e,t,n,o){this._validate(e,t),this._timestamp=(new Date).getTime(),this._scope=this._getScope(o),this._source=e.substr(0,this._maxSourceLength),this._setData(t),this._level=n,this._prefix=this._getPrefix()}return e.log=function(t,n,o,r){var i=new e(t,n,o,r);return e.logManager.log(i),i},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(a)}),t},e.logManager=new l,e}();!function(e){e[e.Verbose=1]="Verbose",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error"}(o||(o={}));var d,h=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}(),f=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,o){r.Validate.isNotNullOrUndefined(t,"error"),this._log(e,t,n,!0,o)},e.logErrorData=function(e){r.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){r.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,o){r.Validate.isNotNullOrUndefined(e,"source"),r.Validate.isNotNullOrUndefined(t,"logEntry"),this._log(e,t.toString(),n,!0,o)},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){r.Validate.isNotNullOrUndefined(t,"LogEntry"),this._log(e,t.toString(),n,!1,void 0)},e._log=function(t,n,r,i,s,a){var u,l=this._addEventPrefix(t,r);i?(u=c.log(l,n,o.Error,a),e._logManager.log({data:n,eventName:u.prefix,resultCode:s})):(u=c.log(l,n.toString(),o.Verbose,a),e._verboseLogManager.log({data:n,eventName:u.prefix})),e.shouldWriteToConsole&&this._writeToConsole(u,i,s)},e._addEventPrefix=function(e,t){return t?e.id+"."+t:e.id},e._writeToConsole=function(e,t,n){var o=e.toString();n&&(o+=". resultCode: "+n),t?console.error(o):console.log(o)},e._logManager=new l,e._verboseLogManager=new l,e._defaultLogger=new h,e._shouldWriteToConsole=!1,e}(),g=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"}(d||(d={}));var p,_,y=d,m=function(){function e(e,t,n,o,r){if(void 0===t&&(t=g.None),void 0===n&&(n=y.Trace),!e)throw new Error("moduleName is invalid");this.moduleName=e,this.logFeature=t,this.logType=n,this.logProperties=o,this.isIntentional=r}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}(),b=n("Pk8u"),v=function(){function e(){}return e.initialize=function(e){this.settings=Object(b.cloneDeep)(e),this._initialized=!0,this._normalizeContextIds()},e.updateSettings=function(e){this.settings=Object(b.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=r.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}(),E=function(){function e(){}return e.initialize=function(t){e._isInitialized||(v.initialize(t),f.shouldWriteToConsole=t.enableConsoleLog,f._addHandler({log:function(e){r.Log.info(e.eventName,"EventName:"+e.data.toString()+", ResultCode: "+e.resultCode)},verbose:function(e){r.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){v.updateSettings(e)},e._isInitialized=!1,e}();!function(e){e[e.NotPromoted=0]="NotPromoted",e[e.Promoted=2]="Promoted"}(p||(p={})),function(e){e.News="News",e.Article="Article",e.Home="Home",e.Space="Space",e.NewsDigest="NewsDigest"}(_||(_={}));var x=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 o={name:t};n&&0!==n.length&&(o.extraData={action:n}),e._logEngagementData(o)},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(v.isInitialized){var t=v.settings,n=t.listId,o=t.listItemUniqueId,r=t.siteId,i=t.webId;e.siteId=r,e.webId=i,n&&(e.listId=n,o&&(e.docId=o))}},e._appendExtraData=function(e){if(v.isInitialized){var t=v.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,r._BrowserUtilities.isTeamsHosted()?t.displayApp="Teams":t.displayApp="Sharepoint",t.userAgent=navigator.userAgent;var n,o=e.webTemplate;t.webTemplate=o,"1"===o?n="TeamSite":"64"===o?n="GroupSite":"68"===o&&(n="CommunicationSite");var i=e.promotedState,s=e.pageType,a=s;s===_.Article&&(a=i===p.NotPromoted||void 0===i?_.Article:_.News),t.siteType=n,t.pageType=a}(t,e.extraData))}},e._logManager=new l,e}(),I=function(){function e(){}return e.prototype.verbose=function(e,t,n){c.log(e,t,o.Verbose,n)},e.prototype.info=function(e,t,n){c.log(e,t,o.Info,n)},e.prototype.warn=function(e,t,n){c.log(e,t,o.Warning,n)},e.prototype.error=function(e,t,n){c.log(e,t,o.Error,n)},e}(),S={Success:0,Failure:1,ExpectedFailure:2},T=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 o=0,r=this._handlers[n.key];o<r.length;o++)r[o].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}(),w=function(){function e(){this._qosEvents=new Map,this._deferExecutor=new T,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}(),P=function(){function e(e,t){var n;void 0===t&&(t=!1),this._qosResultTypeValue=((n={})[S.Success]="Success",n[S.Failure]="Failure",n[S.ExpectedFailure]="ExpectedFailure",n),r.Validate.isNonemptyString(e,"scenarioName"),this._id=r.Guid.newGuid().toString(),this._isDebugSession()||w.instance.startQosMonitor(this._id,{name:e}),this._scenarioName=e,this._hasEnded=!1,this._copyToEngagement=t}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(S.Success,void 0,void 0,e)},e.prototype.writeUnexpectedFailure=function(e,t,n){void 0===e&&(e="DefaultUnexpected"),this._writeQosEnd(S.Failure,e,t,n)},e.prototype.writeExpectedFailure=function(e,t,n){void 0===e&&(e="DefaultExpected"),this._writeQosEnd(S.ExpectedFailure,e,t,n)},e.prototype._writeQosEnd=function(e,t,n,o){if(!this._shouldSkip(e)){this._ensureCorrelationId(e,o),this._endResultCode=t,this._endResult=e;var r={resultCode:this._endResultCode,resultType:this._endResult,error:n?n.message:void 0,extraData:this._endExtraData};w.instance.writeQosEndResult(this._id,r),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]})),v.isInitialized&&e!==S.Success){var o=this._endExtraData&&(this._endExtraData.CorrelationId||this._endExtraData.correlationId)||v.settings.correlationId;o&&(this._endExtraData||(this._endExtraData={}),this._endExtraData.CorrelationId=o)}},e.prototype._isDebugSession=function(){return!!sessionStorage.getItem("spfx-debug")},e.prototype._shouldSkip=function(t){if(this._hasEnded&&void 0!==this._endResult){var n=r.Text.format(e.qosMonitorHasEndedErrorString,this.name,this._qosResultTypeValue[this._endResult],this._qosResultTypeValue[t]);return this._endResult!==t&&f.logError(e.logSource,new Error(n)),!0}return this._hasEnded=!0,this._isDebugSession()},e.prototype._writeToEngagement=function(){if(this._shouldWriteToEngagement()){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),x.log(e)}},e.prototype._shouldWriteToEngagement=function(){return this._copyToEngagement},e.logSource={id:"QosMonitor"},e.qosMonitorHasEndedErrorString="QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",e}(),N=n("17wl"),D={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4"},L=function(e){function t(t,n,o){void 0===o&&(o=!1);var r=e.call(this,t,o)||this;return r._autoAlertableMonitorType=n,r}return Object(N.__extends)(t,e),t.prototype.writeSuccess=function(t){e.prototype.writeSuccess.call(this,this.getExtraDataWithAutoAlertableFields(t))},t.prototype.writeUnexpectedFailure=function(t,n,o){void 0===t&&(t="DefaultUnexpected"),e.prototype.writeUnexpectedFailure.call(this,t,n,this.getExtraDataWithAutoAlertableFields(o))},t.prototype.writeExpectedFailure=function(t,n,o){void 0===t&&(t="DefaultExpected"),e.prototype.writeExpectedFailure.call(this,t,n,this.getExtraDataWithAutoAlertableFields(o))},t.prototype.getExtraDataWithAutoAlertableFields=function(e){var t=null!=e?e:{};return t.autoAlertableMonitorType=D[this._autoAlertableMonitorType],t},t}(P)}})});
|