@microsoft/sp-diagnostics 1.22.0-beta.2 → 1.22.0-beta.4
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 +3 -3
- package/dist/{sp-diagnostics_none_a5c0c2a17bce8b457f0d.js → sp-diagnostics_none_f723633aa801623e45a1.js} +1 -1
- package/lib/Api/Engagement/EngagementLogger.d.ts +75 -0
- package/lib/Api/Engagement/EngagementLogger.d.ts.map +1 -0
- package/lib/Api/Engagement/EngagementLogger.js +143 -0
- package/lib/Api/Engagement/IEngagementHandler.d.ts +87 -0
- package/lib/Api/Engagement/IEngagementHandler.d.ts.map +1 -0
- package/lib/Api/Engagement/IEngagementHandler.js +2 -0
- package/lib/Api/ExecutionQueue.d.ts +55 -0
- package/lib/Api/ExecutionQueue.d.ts.map +1 -0
- package/lib/Api/ExecutionQueue.js +133 -0
- package/lib/Api/ILogData.d.ts +36 -0
- package/lib/Api/ILogData.d.ts.map +1 -0
- package/lib/Api/ILogData.js +3 -0
- package/lib/Api/ILogEntry.d.ts +29 -0
- package/lib/Api/ILogEntry.d.ts.map +1 -0
- package/lib/Api/ILogEntry.js +2 -0
- package/lib/Api/ILogErrorData.d.ts +21 -0
- package/lib/Api/ILogErrorData.d.ts.map +1 -0
- package/lib/Api/ILogErrorData.js +3 -0
- package/lib/Api/ILogSource.d.ts +10 -0
- package/lib/Api/ILogSource.d.ts.map +1 -0
- package/lib/Api/ILogSource.js +3 -0
- package/lib/Api/ILogVerboseData.d.ts +12 -0
- package/lib/Api/ILogVerboseData.d.ts.map +1 -0
- package/lib/Api/ILogVerboseData.js +3 -0
- package/lib/Api/Log/LogHandler.d.ts +12 -0
- package/lib/Api/Log/LogHandler.d.ts.map +1 -0
- package/lib/Api/Log/LogHandler.js +41 -0
- package/lib/Api/LogEntry.d.ts +29 -0
- package/lib/Api/LogEntry.d.ts.map +1 -0
- package/lib/Api/LogEntry.js +51 -0
- package/lib/Api/LogFeature.d.ts +7 -0
- package/lib/Api/LogFeature.d.ts.map +1 -0
- package/lib/Api/LogFeature.js +11 -0
- package/lib/Api/LogLevel.d.ts +23 -0
- package/lib/Api/LogLevel.d.ts.map +1 -0
- package/lib/Api/LogLevel.js +24 -0
- package/lib/Api/LogManager/CircularBuffer.d.ts +36 -0
- package/lib/Api/LogManager/CircularBuffer.d.ts.map +1 -0
- package/lib/Api/LogManager/CircularBuffer.js +98 -0
- package/lib/Api/LogManager/LogManager.d.ts +47 -0
- package/lib/Api/LogManager/LogManager.d.ts.map +1 -0
- package/lib/Api/LogManager/LogManager.js +121 -0
- package/lib/Api/LogSource.d.ts +24 -0
- package/lib/Api/LogSource.d.ts.map +1 -0
- package/lib/Api/LogSource.js +40 -0
- package/lib/Api/LogType.d.ts +21 -0
- package/lib/Api/LogType.d.ts.map +1 -0
- package/lib/Api/LogType.js +23 -0
- package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts +72 -0
- package/lib/Api/Qos/AutoAlertableQosMonitor.d.ts.map +1 -0
- package/lib/Api/Qos/AutoAlertableQosMonitor.js +93 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts +39 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.d.ts.map +1 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/ICustomerPromiseErrorDetails.js +2 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts +12 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.d.ts.map +1 -0
- package/lib/Api/Qos/CustomerPromiseInterfaces/IExtraDataForCustomerPromise.js +2 -0
- package/lib/Api/Qos/IQos.d.ts +17 -0
- package/lib/Api/Qos/IQos.d.ts.map +1 -0
- package/lib/Api/Qos/IQos.js +2 -0
- package/lib/Api/Qos/IQosEndEvent.d.ts +13 -0
- package/lib/Api/Qos/IQosEndEvent.d.ts.map +1 -0
- package/lib/Api/Qos/IQosEndEvent.js +2 -0
- package/lib/Api/Qos/IQosExtraData.d.ts +50 -0
- package/lib/Api/Qos/IQosExtraData.d.ts.map +1 -0
- package/lib/Api/Qos/IQosExtraData.js +2 -0
- package/lib/Api/Qos/IQosStartEvent.d.ts +8 -0
- package/lib/Api/Qos/IQosStartEvent.d.ts.map +1 -0
- package/lib/Api/Qos/IQosStartEvent.js +2 -0
- package/lib/Api/Qos/QosLogger.d.ts +27 -0
- package/lib/Api/Qos/QosLogger.d.ts.map +1 -0
- package/lib/Api/Qos/QosLogger.js +74 -0
- package/lib/Api/Qos/QosMonitor.d.ts +74 -0
- package/lib/Api/Qos/QosMonitor.d.ts.map +1 -0
- package/lib/Api/Qos/QosMonitor.js +304 -0
- package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts +50 -0
- package/lib/Api/Qos/QosMonitorShareFailureWithCP.d.ts.map +1 -0
- package/lib/Api/Qos/QosMonitorShareFailureWithCP.js +114 -0
- package/lib/Api/Qos/QosResultType.d.ts +15 -0
- package/lib/Api/Qos/QosResultType.d.ts.map +1 -0
- package/lib/Api/Qos/QosResultType.js +11 -0
- package/lib/Api/Trace/DefaultTraceHandler.d.ts +15 -0
- package/lib/Api/Trace/DefaultTraceHandler.d.ts.map +1 -0
- package/lib/Api/Trace/DefaultTraceHandler.js +30 -0
- package/lib/Api/Trace/ITraceHandler.d.ts +29 -0
- package/lib/Api/Trace/ITraceHandler.d.ts.map +1 -0
- package/lib/Api/Trace/ITraceHandler.js +2 -0
- package/lib/Api/Trace/ITraceLogger.d.ts +13 -0
- package/lib/Api/Trace/ITraceLogger.d.ts.map +1 -0
- package/lib/Api/Trace/ITraceLogger.js +2 -0
- package/lib/Api/Trace/LogEvent.d.ts +49 -0
- package/lib/Api/Trace/LogEvent.d.ts.map +1 -0
- package/lib/Api/Trace/LogEvent.js +147 -0
- package/lib/Api/Trace/TraceLogger.d.ts +102 -0
- package/lib/Api/Trace/TraceLogger.d.ts.map +1 -0
- package/lib/Api/Trace/TraceLogger.js +197 -0
- package/lib/Diagnostics.d.ts +47 -0
- package/lib/Diagnostics.d.ts.map +1 -0
- package/lib/Diagnostics.js +82 -0
- package/lib/DiagnosticsSettingsManager.d.ts +19 -0
- package/lib/DiagnosticsSettingsManager.d.ts.map +1 -0
- package/lib/DiagnosticsSettingsManager.js +62 -0
- package/lib/IDiagnosticsSettings.d.ts +87 -0
- package/lib/IDiagnosticsSettings.d.ts.map +1 -0
- package/lib/IDiagnosticsSettings.js +2 -0
- package/lib/common/Killswitches.d.ts +3 -0
- package/lib/common/Killswitches.d.ts.map +1 -0
- package/lib/common/Killswitches.js +14 -0
- package/lib/extraData/DisplayApp.d.ts +6 -0
- package/lib/extraData/DisplayApp.d.ts.map +1 -0
- package/lib/extraData/DisplayApp.js +6 -0
- package/lib/extraData/IDiagnosticContextInfo.d.ts +18 -0
- package/lib/extraData/IDiagnosticContextInfo.d.ts.map +1 -0
- package/lib/extraData/IDiagnosticContextInfo.js +2 -0
- package/lib/extraData/IPageExtraData.d.ts +16 -0
- package/lib/extraData/IPageExtraData.d.ts.map +1 -0
- package/lib/extraData/IPageExtraData.js +2 -0
- package/lib/extraData/PageType.d.ts +13 -0
- package/lib/extraData/PageType.d.ts.map +1 -0
- package/lib/extraData/PageType.js +16 -0
- package/lib/extraData/PromotedState.d.ts +16 -0
- package/lib/extraData/PromotedState.d.ts.map +1 -0
- package/lib/extraData/PromotedState.js +17 -0
- package/lib/extraData/WebTemplateId.d.ts +8 -0
- package/lib/extraData/WebTemplateId.d.ts.map +1 -0
- package/lib/extraData/WebTemplateId.js +10 -0
- package/lib/extraData/setPageExtraData.d.ts +5 -0
- package/lib/extraData/setPageExtraData.d.ts.map +1 -0
- package/lib/extraData/setPageExtraData.js +66 -0
- package/lib/index.d.ts +42 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +27 -0
- package/lib/sp-diagnostics.manifest.json +8 -0
- package/lib-commonjs/common/Killswitches.js +8 -1
- package/lib-commonjs/extraData/setPageExtraData.js +4 -0
- package/package.json +6 -6
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"sp-diagnostics": {
|
|
14
14
|
"type": "path",
|
|
15
15
|
"path": {
|
|
16
|
-
"path": "sp-
|
|
17
|
-
"integrity": "sha256-
|
|
16
|
+
"path": "sp-diagnostics_none_f723633aa801623e45a1.js",
|
|
17
|
+
"integrity": "sha256-6YLH0G0/BsfmNM9qWu/4i8pp1fl5/UnkgbpP0+3ArqA="
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"@microsoft/sp-core-library": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@msinternal/odsp-core-bundle": {
|
|
31
31
|
"type": "component",
|
|
32
32
|
"id": "2e09fb9b-13bb-48f2-859f-97d6fff71176",
|
|
33
|
-
"version": "1.4.
|
|
33
|
+
"version": "1.4.514"
|
|
34
34
|
},
|
|
35
35
|
"tslib": {
|
|
36
36
|
"type": "component",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.22.0",["@microsoft/sp-core-library","@microsoft/sp-lodash-subset","@msinternal/odsp-core-bundle","tslib"],(e,t,n,a)=>(()=>{"use strict";var i={676:t=>{t.exports=e},529:e=>{e.exports=t},277:e=>{e.exports=n},280:e=>{e.exports=a}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{o.r(s),o.d(s,{_AutoAlertableMonitorType:()=>L,_AutoAlertableQosMonitor:()=>k,_CircularBuffer:()=>i,_Diagnostics:()=>g,_EngagementLogger:()=>S,_ExecutionQueue:()=>C,_LogEntry:()=>_,_LogEvent:()=>c,_LogFeature:()=>f,_LogHandler:()=>D,_LogLevel:()=>d,_LogManager:()=>r,_LogSource:()=>n,_LogType:()=>m,_PageType:()=>y,_PromotedState:()=>v,_QosLogger:()=>O,_QosMonitor:()=>E,_QosMonitorShareFailureWithCP:()=>M,_QosResultType:()=>x,_TraceLogger:()=>u,_logSourceServiceKey:()=>a});var e=o(676),t=function(){function t(t){e.Validate.isNotNullOrUndefined(t,"id"),this._id=t}return t.create=function(e){return new t(e)},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return 0===this._id.length},t}();const n=t;var a=e.ServiceKey.createCustom("sp-client-base:LogSource",function(e){return t.create("")});const i=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}(),r=function(){function e(t){this._shouldLogInRealTime=[],this._handlers=[],this._events=new i(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,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(a)}),t},e.logManager=new r,e}();var d;!function(e){e[e.Verbose=1]="Verbose",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error"}(d||(d={}));const l=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}(),u=function(){function t(){}return t._addHandler=function(e){t._logManager.addHandler(e.log),t._logManager.processAll(e.log),t._verboseLogManager.addHandler(e.verbose),t._verboseLogManager.processAll(e.verbose)},t.logError=function(t,n,a,i){e.Validate.isNotNullOrUndefined(n,"error"),this._log(t,n,a,!0,i)},t.logErrorData=function(t){e.Validate.isNotNullOrUndefined(t.error,"error");var n=t.logEntry?t.logEntry.toString():t.error;this._log(t.source,n,t.eventName,!0,t.resultCode,t.serviceScope)},t.logVerbose=function(t,n,a){e.Validate.isNonemptyString(n,"message"),this._log(t,n,a,!1,void 0)},t.logVerboseData=function(e){var t=e.logEntry?e.logEntry.toString():e.message;this._log(e.source,t,e.eventName,!1,void 0,e.serviceScope)},t.logErrorWithLogEntry=function(t,n,a,i){e.Validate.isNotNullOrUndefined(t,"source"),e.Validate.isNotNullOrUndefined(n,"logEntry"),this._log(t,n.toString(),a,!0,i)},Object.defineProperty(t,"shouldWriteToConsole",{get:function(){return t._shouldWriteToConsole},set:function(e){t._shouldWriteToConsole&&!e?(t._logManager.removeHandler(t._defaultLogger.log),t._verboseLogManager.removeHandler(t._defaultLogger.verbose)):!t._shouldWriteToConsole&&e&&(t._logManager.addHandler(t._defaultLogger.log),t._verboseLogManager.addHandler(t._defaultLogger.verbose)),t._shouldWriteToConsole=e},enumerable:!1,configurable:!0}),t.logVerboseWithLogEntry=function(t,n,a){e.Validate.isNotNullOrUndefined(n,"LogEntry"),this._log(t,n.toString(),a,!1,void 0)},t._log=function(e,n,a,i,r,o){var s,l=this._addEventPrefix(e,a);i?(s=c.log(l,n,d.Error,o),t._logManager.log({data:n,eventName:s.prefix,resultCode:r})):(s=c.log(l,n.toString(),d.Verbose,o),t._verboseLogManager.log({data:n,eventName:s.prefix})),t.shouldWriteToConsole&&this._writeToConsole(s,i,r)},t._addEventPrefix=function(e,t){return t?"".concat(e.id,".").concat(t):e.id},t._writeToConsole=function(e,t,n){var a=e.toString();n&&(a+=". resultCode: ".concat(n)),t?console.error(a):console.log(a)},t._logManager=new r,t._verboseLogManager=new r,t._defaultLogger=new l,t._shouldWriteToConsole=!1,t}(),f=function(){function e(){}return e.None="None",e}();var p;!function(e){e[e.Trace=1]="Trace",e[e.Event=2]="Event",e[e.Error=3]="Error"}(p||(p={}));const m=p,_=function(){function e(e,t,n,a,i){if(void 0===t&&(t=f.None),void 0===n&&(n=m.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}();var h=o(529);const b=function(){function t(){}return t.initialize=function(e){this.settings=(0,h.cloneDeep)(e),this._initialized=!0,this._normalizeContextIds()},t.updateSettings=function(e){this.settings=(0,h.merge)(this.settings,e),this._normalizeContextIds()},t.clearSettings=function(e){var t=this;e.diagnosticSettings&&e.diagnosticSettings.forEach(function(e){delete t.settings[e]}),e.extraDiagnosticInfo&&e.extraDiagnosticInfo.forEach(function(e){t.settings.extraDiagnosticInfo&&t.settings.extraDiagnosticInfo[e]&&delete t.settings.extraDiagnosticInfo[e]})},Object.defineProperty(t,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),t._normalizeId=function(t){var n=e.Guid.tryParse(t);return(null==n?void 0:n.toString())||t},t._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)))},t._initialized=!1,t}(),g=function(){function t(){}return t.initialize=function(n){t._isInitialized||(b.initialize(n),u.shouldWriteToConsole=n.enableConsoleLog,u._addHandler({log:function(t){e.Log.info(t.eventName,"EventName:".concat(t.data.toString(),", ResultCode: ").concat(t.resultCode))},verbose:function(t){e.Log.verbose(t.eventName,t.data.toString())}}),t._isInitialized=!0)},Object.defineProperty(t,"isInitialized",{get:function(){return this._isInitialized},enumerable:!1,configurable:!0}),t.updateSettings=function(e){b.updateSettings(e)},t.getAuthoringSessionClientCountInfo=function(){var e,t;return null===(t=null===(e=b.settings)||void 0===e?void 0:e.extraDiagnosticInfo)||void 0===t?void 0:t.authoringSessionClientCount},t._getExtraDiagnosticInfo=function(){var e;return null===(e=b.settings)||void 0===e?void 0:e.extraDiagnosticInfo},t.clearSettings=function(e){b.clearSettings(e)},t._isInitialized=!1,t}();var v,y;!function(e){e[e.NotPromoted=0]="NotPromoted",e[e.Promoted=2]="Promoted"}(v||(v={})),function(e){e.News="News",e.Article="Article",e.Home="Home",e.Space="Space",e.NewsDigest="NewsDigest"}(y||(y={}));const S=function(){function t(){}return t._addHandler=function(e){t._handler=function(t){e.logData(t)},t._logManager.addHandler(t._handler)},t.startRealTimeProcessing=function(){this._shouldProcessInRealTime||(t._logManager.processAll(t._handler),this._shouldProcessInRealTime=!0)},t.log=function(e){t._logEngagementData(e)},t.logEvent=function(e,n){var a={name:e};n&&0!==n.length&&(a.extraData={action:n}),t._logEngagementData(a)},t.logEventWithLogEntry=function(e){var n={isIntentional:e.isIntentional,name:e.moduleName+"."+e.logFeature,extraData:e.logProperties};t._logEngagementData(n,!0)},t._logEngagementData=function(e,n){if(void 0===n&&(n=!1),!e.name||0===e.name.length)throw new Error("LogEntry is invalid");t._checkValidTagName(e,n),t._addContextData(e),t._appendExtraData(e),t._logManager.log(e)},t._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"))},t._addContextData=function(e){if(b.isInitialized){var t=b.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))}},t._appendExtraData=function(t){if(b.isInitialized){var n=b.settings.contextInfo;n&&(t.extraData||(t.extraData={}),function(t,n){n.pageId=t.pageId,n.isHub=t.isHubSite,t.isHubSite?(n.hubSiteId=t.hubSiteId,n.isAssociatedSite=!1):!t.isHubSite&&t.hubSiteId?n.isAssociatedSite=!0:n.isAssociatedSite=!1,n.displayApp||(e._BrowserUtilities.isTeamsHosted()?(n.displayApp="Teams",t.isEduClass&&(n.isEduClass=!0)):n.displayApp="Sharepoint"),n.userAgent=navigator.userAgent;var a,i=t.webTemplate;n.webTemplate=i,"1"===i?a="TeamSite":"64"===i?a="GroupSite":"68"===i?a="CommunicationSite":"21"===i&&(a="MySite");var r=t.promotedState,o=t.pageType,s=o;o===y.Article&&(s=r===v.NotPromoted||void 0===r?y.Article:y.News),n.siteType=a,n.pageType=s,n.isDebug=!!e._BrowserUtilities.safelyAccessSessionStorage("spfx-debug")}(n,t.extraData))}},t._logManager=new r,t}(),D=function(){function e(){}return e.prototype.verbose=function(e,t,n){c.log(e,t,d.Verbose,n)},e.prototype.info=function(e,t,n){c.log(e,t,d.Info,n)},e.prototype.warn=function(e,t,n){c.log(e,t,d.Warning,n)},e.prototype.error=function(e,t,n){c.log(e,t,d.Error,n)},e}();var I=o(277),x={Success:0,Failure:1,ExpectedFailure:2};const 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}();var w={id:"QosMonitor"};const E=function(){function t(t,n,a){var i;void 0===n&&(n=!1),void 0===a&&(a=!1);var r=this;this._qosResultTypeValue=((i={})[x.Success]="Success",i[x.Failure]="Failure",i[x.ExpectedFailure]="ExpectedFailure",i),this._ensureAuthoringSessionId=function(){var e,t,n,a,i=null===(t=null===(e=b.settings)||void 0===e?void 0:e.extraDiagnosticInfo)||void 0===t?void 0:t.authoringSessionId;if(i){r._ensureEndExtraData(),r._endExtraData.AuthoringSessionId=i;var o=null===(a=null===(n=b.settings)||void 0===n?void 0:n.extraDiagnosticInfo)||void 0===a?void 0:a.authoringOpSequenceId;o&&(r._endExtraData.AuthoringOpSequenceId=o);var s=g.getAuthoringSessionClientCountInfo();s&&r._endExtraData&&(r._endExtraData.AuthoringSessionClientCount=s)}},e.Validate.isNonemptyString(t,"scenarioName"),this._id=e.Guid.newGuid().toString(),this._isDebugSession()||O.instance.startQosMonitor(this._id,{name:t}),this._scenarioName=t,this._hasEnded=!1,this._copyToCosmos=n,this._copyToInterana=a}return t.startRealTimeProcessing=function(){O.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)},t._shouldProcessInRealTime=function(e){O.instance.shouldProcessInRealTime=e},Object.defineProperty(t.prototype,"name",{get:function(){return this._scenarioName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shortEventName",{get:function(){return"Qos"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resultCode",{get:function(){return this._endResultCode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resultType",{get:function(){return this._endResult},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"extraData",{get:function(){return this._endExtraData},set:function(e){this._endExtraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasEnded",{get:function(){return this._hasEnded},enumerable:!1,configurable:!0}),t.prototype.writeSuccess=function(e){this._writeQosEnd(x.Success,void 0,void 0,e)},t.prototype.writeUnexpectedFailure=function(e,t,n){void 0===e&&(e="DefaultUnexpected"),this._writeQosEnd(x.Failure,e,t,n)},t.prototype.writeExpectedFailure=function(e,t,n){void 0===e&&(e="DefaultExpected"),this._writeQosEnd(x.ExpectedFailure,e,t,n)},t.prototype._writeQosEnd=function(e,t,n,a){if(!this._shouldSkip(e)){this._ensureCorrelationId(e,a),this._endResultCode=t,this._endResult=e;var i=n?(0,I.getErrorMessage)(n):void 0;if(n instanceof I.CustomError){var r=(0,I.getQosEndSchemaFromError)(n);r&&(r.resultType=this._endResult,r.extraData=(0,h.merge)({},this._endExtraData,r.extraData)),O.instance.writeQosEndResult(this._id,r)}else{var o={resultCode:this._endResultCode,resultType:this._endResult,error:i,extraData:this._endExtraData};O.instance.writeQosEndResult(this._id,o)}this._writeToEngagement()}},t.prototype._ensureCorrelationId=function(e,t){var n=this;if(t&&(this._ensureEndExtraData(),Object.keys(t).forEach(function(e){return n._endExtraData[e]=t[e]})),b.isInitialized&&e!==x.Success){var a="CorrelationId",i=this._endExtraData&&(this._endExtraData[a]||this._endExtraData.correlationId)||b.settings.correlationId;i&&(this._endExtraData||(this._endExtraData={}),this._endExtraData[a]=i)}this._logHostType(),this._ensureAuthoringSessionId()},t.prototype._ensureEndExtraData=function(){this._endExtraData||(this._endExtraData={})},t.prototype._logHostType=function(){if(b.isInitialized){var t=e._BrowserUtilities.getTeamsAppType();if(t){this._ensureEndExtraData();var n="appHostType";this._endExtraData[n]||(this._endExtraData[n]=t)}}},t.prototype._isDebugSession=function(){try{return!!e._SPKillSwitch.isActivated("761ccb86-4fa0-4f56-a05b-477bcc09bd9f")&&!!e._BrowserUtilities.safelyAccessSessionStorage("spfx-debug")}catch(e){return!1}},t.prototype._shouldSkip=function(t){if(this._hasEnded&&void 0!==this._endResult){var n=e.Text.format("QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",this.name,this._qosResultTypeValue[this._endResult],this._qosResultTypeValue[t]);return this._endResult!==t&&u.logError(w,new Error(n)),!0}return this._hasEnded=!0,this._isDebugSession()},t.prototype._writeToEngagement=function(){if(this._copyToInterana&&S.log({name:this.name,isIntentional:!!(this.extraData||{}).isIntentional,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),S.log(e)}},t}();var A=o(280),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(0,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(t){function n(e,n,a,i){void 0===n&&(n=!1),void 0===i&&(i=!1);var r=t.call(this,e,i,n)||this;return r._extraDataForCustomerPromise=a,r}return(0,A.__extends)(n,t),n.prototype.writeUnexpectedFailure=function(e,n,a){void 0===e&&(e="DefaultUnexpected"),t.prototype.writeUnexpectedFailure.call(this,e,n,a),this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",e,x.Failure,a)},n.prototype.writeExpectedFailure=function(e,n,a,i){void 0===e&&(e="DefaultExpected"),void 0===i&&(i=!1),t.prototype.writeExpectedFailure.call(this,e,n,a),i||this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",e,x.ExpectedFailure,a)},n.prototype._logCustomerPromiseFailure=function(t,n,a,i){void 0===a&&(a=x.Failure),this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(function(r){var o,s=r.logFailure,c=r.veto;s({errorCode:r.errorModuleName+((o=g._getExtraDiagnosticInfo())&&o.hasAuthoringStarted?o.authoringSessionClientCount?o.authoringSessionClientCount>1?" with Multiple Users":"":o.isAuthoringUsingDDS?" in Legacy Authoring (DDS)":" in Legacy Authoring (no DDS)":"")+(e._SPKillSwitch.isActivated("c125685f-83e7-44c8-b602-5c21f5b748ae")||window.navigator.onLine?"":" (offline)"),errorScenario:n,errorMessage:t,resultType:a,pageType:null==i?void 0:i.pageType,errorStack:null==i?void 0:i.errorStack,veto:c})})},n}(E)})(),s})());
|
|
1
|
+
define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.22.0",["@microsoft/sp-core-library","@microsoft/sp-lodash-subset","@msinternal/odsp-core-bundle","tslib"],(e,t,n,a)=>(()=>{"use strict";var i={676:t=>{t.exports=e},529:e=>{e.exports=t},277:e=>{e.exports=n},280:e=>{e.exports=a}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{o.r(s),o.d(s,{_AutoAlertableMonitorType:()=>L,_AutoAlertableQosMonitor:()=>k,_CircularBuffer:()=>i,_Diagnostics:()=>g,_EngagementLogger:()=>S,_ExecutionQueue:()=>C,_LogEntry:()=>_,_LogEvent:()=>c,_LogFeature:()=>f,_LogHandler:()=>D,_LogLevel:()=>d,_LogManager:()=>r,_LogSource:()=>n,_LogType:()=>m,_PageType:()=>y,_PromotedState:()=>v,_QosLogger:()=>O,_QosMonitor:()=>E,_QosMonitorShareFailureWithCP:()=>M,_QosResultType:()=>x,_TraceLogger:()=>u,_logSourceServiceKey:()=>a});var e=o(676),t=function(){function t(t){e.Validate.isNotNullOrUndefined(t,"id"),this._id=t}return t.create=function(e){return new t(e)},Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return 0===this._id.length},t}();const n=t;var a=e.ServiceKey.createCustom("sp-client-base:LogSource",function(e){return t.create("")});const i=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}(),r=function(){function e(t){this._shouldLogInRealTime=[],this._handlers=[],this._events=new i(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,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(a)}),t},e.logManager=new r,e}();var d;!function(e){e[e.Verbose=1]="Verbose",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error"}(d||(d={}));const l=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}(),u=function(){function t(){}return t._addHandler=function(e){t._logManager.addHandler(e.log),t._logManager.processAll(e.log),t._verboseLogManager.addHandler(e.verbose),t._verboseLogManager.processAll(e.verbose)},t.logError=function(t,n,a,i){e.Validate.isNotNullOrUndefined(n,"error"),this._log(t,n,a,!0,i)},t.logErrorData=function(t){e.Validate.isNotNullOrUndefined(t.error,"error");var n=t.logEntry?t.logEntry.toString():t.error;this._log(t.source,n,t.eventName,!0,t.resultCode,t.serviceScope)},t.logVerbose=function(t,n,a){e.Validate.isNonemptyString(n,"message"),this._log(t,n,a,!1,void 0)},t.logVerboseData=function(e){var t=e.logEntry?e.logEntry.toString():e.message;this._log(e.source,t,e.eventName,!1,void 0,e.serviceScope)},t.logErrorWithLogEntry=function(t,n,a,i){e.Validate.isNotNullOrUndefined(t,"source"),e.Validate.isNotNullOrUndefined(n,"logEntry"),this._log(t,n.toString(),a,!0,i)},Object.defineProperty(t,"shouldWriteToConsole",{get:function(){return t._shouldWriteToConsole},set:function(e){t._shouldWriteToConsole&&!e?(t._logManager.removeHandler(t._defaultLogger.log),t._verboseLogManager.removeHandler(t._defaultLogger.verbose)):!t._shouldWriteToConsole&&e&&(t._logManager.addHandler(t._defaultLogger.log),t._verboseLogManager.addHandler(t._defaultLogger.verbose)),t._shouldWriteToConsole=e},enumerable:!1,configurable:!0}),t.logVerboseWithLogEntry=function(t,n,a){e.Validate.isNotNullOrUndefined(n,"LogEntry"),this._log(t,n.toString(),a,!1,void 0)},t._log=function(e,n,a,i,r,o){var s,l=this._addEventPrefix(e,a);i?(s=c.log(l,n,d.Error,o),t._logManager.log({data:n,eventName:s.prefix,resultCode:r})):(s=c.log(l,n.toString(),d.Verbose,o),t._verboseLogManager.log({data:n,eventName:s.prefix})),t.shouldWriteToConsole&&this._writeToConsole(s,i,r)},t._addEventPrefix=function(e,t){return t?"".concat(e.id,".").concat(t):e.id},t._writeToConsole=function(e,t,n){var a=e.toString();n&&(a+=". resultCode: ".concat(n)),t?console.error(a):console.log(a)},t._logManager=new r,t._verboseLogManager=new r,t._defaultLogger=new l,t._shouldWriteToConsole=!1,t}(),f=function(){function e(){}return e.None="None",e}();var p;!function(e){e[e.Trace=1]="Trace",e[e.Event=2]="Event",e[e.Error=3]="Error"}(p||(p={}));const m=p,_=function(){function e(e,t,n,a,i){if(void 0===t&&(t=f.None),void 0===n&&(n=m.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}();var h=o(529);const b=function(){function t(){}return t.initialize=function(e){this.settings=(0,h.cloneDeep)(e),this._initialized=!0,this._normalizeContextIds()},t.updateSettings=function(e){this.settings=(0,h.merge)(this.settings,e),this._normalizeContextIds()},t.clearSettings=function(e){var t=this;e.diagnosticSettings&&e.diagnosticSettings.forEach(function(e){delete t.settings[e]}),e.extraDiagnosticInfo&&e.extraDiagnosticInfo.forEach(function(e){t.settings.extraDiagnosticInfo&&t.settings.extraDiagnosticInfo[e]&&delete t.settings.extraDiagnosticInfo[e]})},Object.defineProperty(t,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),t._normalizeId=function(t){var n=e.Guid.tryParse(t);return(null==n?void 0:n.toString())||t},t._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)))},t._initialized=!1,t}(),g=function(){function t(){}return t.initialize=function(n){t._isInitialized||(b.initialize(n),u.shouldWriteToConsole=n.enableConsoleLog,u._addHandler({log:function(t){e.Log.info(t.eventName,"EventName:".concat(t.data.toString(),", ResultCode: ").concat(t.resultCode))},verbose:function(t){e.Log.verbose(t.eventName,t.data.toString())}}),t._isInitialized=!0)},Object.defineProperty(t,"isInitialized",{get:function(){return this._isInitialized},enumerable:!1,configurable:!0}),t.updateSettings=function(e){b.updateSettings(e)},t.getAuthoringSessionClientCountInfo=function(){var e,t;return null===(t=null===(e=b.settings)||void 0===e?void 0:e.extraDiagnosticInfo)||void 0===t?void 0:t.authoringSessionClientCount},t._getExtraDiagnosticInfo=function(){var e;return null===(e=b.settings)||void 0===e?void 0:e.extraDiagnosticInfo},t.clearSettings=function(e){b.clearSettings(e)},t._isInitialized=!1,t}();var v,y;!function(e){e[e.NotPromoted=0]="NotPromoted",e[e.Promoted=2]="Promoted"}(v||(v={})),function(e){e.News="News",e.Article="Article",e.Home="Home",e.Space="Space",e.NewsDigest="NewsDigest"}(y||(y={}));const S=function(){function t(){}return t._addHandler=function(e){t._handler=function(t){e.logData(t)},t._logManager.addHandler(t._handler)},t.startRealTimeProcessing=function(){this._shouldProcessInRealTime||(t._logManager.processAll(t._handler),this._shouldProcessInRealTime=!0)},t.log=function(e){t._logEngagementData(e)},t.logEvent=function(e,n){var a={name:e};n&&0!==n.length&&(a.extraData={action:n}),t._logEngagementData(a)},t.logEventWithLogEntry=function(e){var n={isIntentional:e.isIntentional,name:e.moduleName+"."+e.logFeature,extraData:e.logProperties};t._logEngagementData(n,!0)},t._logEngagementData=function(e,n){if(void 0===n&&(n=!1),!e.name||0===e.name.length)throw new Error("LogEntry is invalid");t._checkValidTagName(e,n),t._addContextData(e),t._appendExtraData(e),t._logManager.log(e)},t._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"))},t._addContextData=function(e){if(b.isInitialized){var t=b.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))}},t._appendExtraData=function(t){if(b.isInitialized){var n=b.settings.contextInfo;n&&(t.extraData||(t.extraData={}),function(t,n){n.pageId=t.pageId,n.isHub=t.isHubSite,t.isHubSite?(n.hubSiteId=t.hubSiteId,n.isAssociatedSite=!1):!t.isHubSite&&t.hubSiteId?n.isAssociatedSite=!0:n.isAssociatedSite=!1,n.displayApp||(e._BrowserUtilities.isTeamsHosted()?(n.displayApp="Teams",t.isEduClass&&(n.isEduClass=!0)):n.displayApp="Sharepoint"),n.userAgent=navigator.userAgent;var a,i=t.webTemplate;n.webTemplate=i,"1"===i?a="TeamSite":"64"===i?a="GroupSite":"68"===i?a="CommunicationSite":"21"===i&&(a="MySite");var r=t.promotedState,o=t.pageType,s=o;o===y.Article&&(s=r===v.NotPromoted||void 0===r?y.Article:y.News),n.siteType=a,n.pageType=s,n.isDebug=!!e._BrowserUtilities.safelyAccessSessionStorage("spfx-debug"),n.hasCopilotLicense=e._SPKillSwitch.isActivated("2f310bfc-1afe-4707-88eb-b7e51292a330")?void 0:!!t.hasCopilotLicense}(n,t.extraData))}},t._logManager=new r,t}(),D=function(){function e(){}return e.prototype.verbose=function(e,t,n){c.log(e,t,d.Verbose,n)},e.prototype.info=function(e,t,n){c.log(e,t,d.Info,n)},e.prototype.warn=function(e,t,n){c.log(e,t,d.Warning,n)},e.prototype.error=function(e,t,n){c.log(e,t,d.Error,n)},e}();var I=o(277),x={Success:0,Failure:1,ExpectedFailure:2};const 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}();var w={id:"QosMonitor"};const E=function(){function t(t,n,a){var i;void 0===n&&(n=!1),void 0===a&&(a=!1);var r=this;this._qosResultTypeValue=((i={})[x.Success]="Success",i[x.Failure]="Failure",i[x.ExpectedFailure]="ExpectedFailure",i),this._ensureAuthoringSessionId=function(){var e,t,n,a,i=null===(t=null===(e=b.settings)||void 0===e?void 0:e.extraDiagnosticInfo)||void 0===t?void 0:t.authoringSessionId;if(i){r._ensureEndExtraData(),r._endExtraData.AuthoringSessionId=i;var o=null===(a=null===(n=b.settings)||void 0===n?void 0:n.extraDiagnosticInfo)||void 0===a?void 0:a.authoringOpSequenceId;o&&(r._endExtraData.AuthoringOpSequenceId=o);var s=g.getAuthoringSessionClientCountInfo();s&&r._endExtraData&&(r._endExtraData.AuthoringSessionClientCount=s)}},e.Validate.isNonemptyString(t,"scenarioName"),this._id=e.Guid.newGuid().toString(),this._isDebugSession()||O.instance.startQosMonitor(this._id,{name:t}),this._scenarioName=t,this._hasEnded=!1,this._copyToCosmos=n,this._copyToInterana=a}return t.startRealTimeProcessing=function(){O.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)},t._shouldProcessInRealTime=function(e){O.instance.shouldProcessInRealTime=e},Object.defineProperty(t.prototype,"name",{get:function(){return this._scenarioName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shortEventName",{get:function(){return"Qos"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resultCode",{get:function(){return this._endResultCode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"resultType",{get:function(){return this._endResult},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"extraData",{get:function(){return this._endExtraData},set:function(e){this._endExtraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasEnded",{get:function(){return this._hasEnded},enumerable:!1,configurable:!0}),t.prototype.writeSuccess=function(e){this._writeQosEnd(x.Success,void 0,void 0,e)},t.prototype.writeUnexpectedFailure=function(e,t,n){void 0===e&&(e="DefaultUnexpected"),this._writeQosEnd(x.Failure,e,t,n)},t.prototype.writeExpectedFailure=function(e,t,n){void 0===e&&(e="DefaultExpected"),this._writeQosEnd(x.ExpectedFailure,e,t,n)},t.prototype._writeQosEnd=function(e,t,n,a){if(!this._shouldSkip(e)){this._ensureCorrelationId(e,a),this._endResultCode=t,this._endResult=e;var i=n?(0,I.getErrorMessage)(n):void 0;if(n instanceof I.CustomError){var r=(0,I.getQosEndSchemaFromError)(n);r&&(r.resultType=this._endResult,r.extraData=(0,h.merge)({},this._endExtraData,r.extraData)),O.instance.writeQosEndResult(this._id,r)}else{var o={resultCode:this._endResultCode,resultType:this._endResult,error:i,extraData:this._endExtraData};O.instance.writeQosEndResult(this._id,o)}this._writeToEngagement()}},t.prototype._ensureCorrelationId=function(e,t){var n=this;if(t&&(this._ensureEndExtraData(),Object.keys(t).forEach(function(e){return n._endExtraData[e]=t[e]})),b.isInitialized&&e!==x.Success){var a="CorrelationId",i=this._endExtraData&&(this._endExtraData[a]||this._endExtraData.correlationId)||b.settings.correlationId;i&&(this._endExtraData||(this._endExtraData={}),this._endExtraData[a]=i)}this._logHostType(),this._ensureAuthoringSessionId()},t.prototype._ensureEndExtraData=function(){this._endExtraData||(this._endExtraData={})},t.prototype._logHostType=function(){if(b.isInitialized){var t=e._BrowserUtilities.getTeamsAppType();if(t){this._ensureEndExtraData();var n="appHostType";this._endExtraData[n]||(this._endExtraData[n]=t)}}},t.prototype._isDebugSession=function(){try{return!!e._SPKillSwitch.isActivated("761ccb86-4fa0-4f56-a05b-477bcc09bd9f")&&!!e._BrowserUtilities.safelyAccessSessionStorage("spfx-debug")}catch(e){return!1}},t.prototype._shouldSkip=function(t){if(this._hasEnded&&void 0!==this._endResult){var n=e.Text.format("QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",this.name,this._qosResultTypeValue[this._endResult],this._qosResultTypeValue[t]);return this._endResult!==t&&u.logError(w,new Error(n)),!0}return this._hasEnded=!0,this._isDebugSession()},t.prototype._writeToEngagement=function(){if(this._copyToInterana&&S.log({name:this.name,isIntentional:!!(this.extraData||{}).isIntentional,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),S.log(e)}},t}();var A=o(280),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(0,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(t){function n(e,n,a,i){void 0===n&&(n=!1),void 0===i&&(i=!1);var r=t.call(this,e,i,n)||this;return r._extraDataForCustomerPromise=a,r}return(0,A.__extends)(n,t),n.prototype.writeUnexpectedFailure=function(e,n,a){void 0===e&&(e="DefaultUnexpected"),t.prototype.writeUnexpectedFailure.call(this,e,n,a),this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",e,x.Failure,a)},n.prototype.writeExpectedFailure=function(e,n,a,i){void 0===e&&(e="DefaultExpected"),void 0===i&&(i=!1),t.prototype.writeExpectedFailure.call(this,e,n,a),i||this._logCustomerPromiseFailure((null==n?void 0:n.message)||"DefaultErrorMessage",e,x.ExpectedFailure,a)},n.prototype._logCustomerPromiseFailure=function(t,n,a,i){void 0===a&&(a=x.Failure),this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(function(r){var o,s=r.logFailure,c=r.veto;s({errorCode:r.errorModuleName+((o=g._getExtraDiagnosticInfo())&&o.hasAuthoringStarted?o.authoringSessionClientCount?o.authoringSessionClientCount>1?" with Multiple Users":"":o.isAuthoringUsingDDS?" in Legacy Authoring (DDS)":" in Legacy Authoring (no DDS)":"")+(e._SPKillSwitch.isActivated("c125685f-83e7-44c8-b602-5c21f5b748ae")||window.navigator.onLine?"":" (offline)"),errorScenario:n,errorMessage:t,resultType:a,pageType:null==i?void 0:i.pageType,errorStack:null==i?void 0:i.errorStack,veto:c})})},n}(E)})(),s})());
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { IEngagementData, IEngagementHandler } from './IEngagementHandler';
|
|
2
|
+
import type ILogEntry from '../ILogEntry';
|
|
3
|
+
/**
|
|
4
|
+
* Engagement logging
|
|
5
|
+
* use *.Click for all the actions triggered by mouse, keyboard, or touch.
|
|
6
|
+
* if you want to add more data or the action is not click but keydown.
|
|
7
|
+
* Use extraData to log the type of action or use extraData to log details wrapped in LogEntry
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export default class EngagementLogger {
|
|
11
|
+
private static _logManager;
|
|
12
|
+
private static _shouldProcessInRealTime;
|
|
13
|
+
private static _handler;
|
|
14
|
+
/**
|
|
15
|
+
* Init function for the passed logger object
|
|
16
|
+
*/
|
|
17
|
+
static _addHandler(logger: IEngagementHandler): void;
|
|
18
|
+
/**
|
|
19
|
+
* Starts processing logs in real time
|
|
20
|
+
*/
|
|
21
|
+
static startRealTimeProcessing(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Engagement logging
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Use *.Click for all the actions triggered by mouse, keyboard, or touch.
|
|
27
|
+
* tagName follows `<Workload>.controlName.actionName` pattern
|
|
28
|
+
* For example, `{ name = "AddButton.Click" }`,
|
|
29
|
+
* this logs `"<Workload>.AddButton.Click"` with default action triggered by mouse, keyboard, or touch.
|
|
30
|
+
* `<Workload>` is set in Telemetry settings
|
|
31
|
+
* `IEngagementData` interface is mapped to a set of enums for standardization of mapping.
|
|
32
|
+
* Add new items to enum in order to register a new item specification.
|
|
33
|
+
* SiteType is defined in SiteType enum
|
|
34
|
+
* CurrentPage is defined in CurrentPage enum
|
|
35
|
+
* Component is defined in Component enum
|
|
36
|
+
* Feature is defined in Feature enum.
|
|
37
|
+
*/
|
|
38
|
+
static log(engagementData: IEngagementData): void;
|
|
39
|
+
/**
|
|
40
|
+
* Engagement logging
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Use *.Click for all the actions triggered by mouse, keyboard, or touch.
|
|
44
|
+
* tagName follows `<Workload>.controlName.actionName` pattern
|
|
45
|
+
* For example, `tagName = "AddButton.Click"`,
|
|
46
|
+
* this logs `"<Workload>.AddButton.Click"` with default action triggered by mouse, keyboard, or touch.
|
|
47
|
+
* `<Workload>` is set in Telemetry settings
|
|
48
|
+
* Use extraData to log the type of action.
|
|
49
|
+
* For example, `actionName = "Keydown"` and `tagName = "ModernPublish.AddButton.Click"`
|
|
50
|
+
* this logs `"<Workload>.AddButton.Click"` with the extraData that it was selected using the Keydown
|
|
51
|
+
*/
|
|
52
|
+
static logEvent(tagName: string, actionName?: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Engagement logging with LogEntry
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* Here is an example:
|
|
58
|
+
* ```
|
|
59
|
+
* {"EngagementName":"SPPage.NavigationAction.SPPageQuickLaunchUpdate"`,
|
|
60
|
+
* "Properties":"{\"message\":\"[NavigationAction] | SPPageQuickLaunchUpdate | 2 | null\"}",
|
|
61
|
+
* "Duration":0,"LogType":0,
|
|
62
|
+
* "ClientTime":1459357627444,"Source":"ClientV2Engagement"}
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* NavigationAction is moduleName in LogEntry, SPPageQuickLaunchUpdate is log feature name
|
|
66
|
+
* In this example, SPPage is workload name which is set in Telemetry settings.
|
|
67
|
+
* Do NOT add PII data!
|
|
68
|
+
*/
|
|
69
|
+
static logEventWithLogEntry(logEntry: ILogEntry): void;
|
|
70
|
+
private static _logEngagementData;
|
|
71
|
+
private static _checkValidTagName;
|
|
72
|
+
private static _addContextData;
|
|
73
|
+
private static _appendExtraData;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=EngagementLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EngagementLogger.d.ts","sourceRoot":"","sources":["../../../src/Api/Engagement/EngagementLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAM1C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAkE;IAC5F,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAU;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IAEtD;;OAEG;WACW,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAO3D;;OAEG;WACW,uBAAuB,IAAI,IAAI;IAO7C;;;;;;;;;;;;;;;OAeG;WACW,GAAG,CAAC,cAAc,EAAE,eAAe,GAAG,IAAI;IAIxD;;;;;;;;;;;;OAYG;WACW,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI;IAUlE;;;;;;;;;;;;;;;OAeG;WACW,oBAAoB,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAU7D,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAajC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAWjC,OAAO,CAAC,MAAM,CAAC,eAAe;IAc9B,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAchC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import LogManager from '../LogManager/LogManager';
|
|
2
|
+
import DiagnosticsSettingsManager from '../../DiagnosticsSettingsManager';
|
|
3
|
+
import { setPageExtraData } from '../../extraData/setPageExtraData';
|
|
4
|
+
/**
|
|
5
|
+
* Engagement logging
|
|
6
|
+
* use *.Click for all the actions triggered by mouse, keyboard, or touch.
|
|
7
|
+
* if you want to add more data or the action is not click but keydown.
|
|
8
|
+
* Use extraData to log the type of action or use extraData to log details wrapped in LogEntry
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
var EngagementLogger = /** @class */ (function () {
|
|
12
|
+
function EngagementLogger() {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Init function for the passed logger object
|
|
16
|
+
*/
|
|
17
|
+
EngagementLogger._addHandler = function (logger) {
|
|
18
|
+
EngagementLogger._handler = function (e) {
|
|
19
|
+
logger.logData(e);
|
|
20
|
+
};
|
|
21
|
+
EngagementLogger._logManager.addHandler(EngagementLogger._handler);
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Starts processing logs in real time
|
|
25
|
+
*/
|
|
26
|
+
EngagementLogger.startRealTimeProcessing = function () {
|
|
27
|
+
if (!this._shouldProcessInRealTime) {
|
|
28
|
+
EngagementLogger._logManager.processAll(EngagementLogger._handler);
|
|
29
|
+
this._shouldProcessInRealTime = true;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Engagement logging
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Use *.Click for all the actions triggered by mouse, keyboard, or touch.
|
|
37
|
+
* tagName follows `<Workload>.controlName.actionName` pattern
|
|
38
|
+
* For example, `{ name = "AddButton.Click" }`,
|
|
39
|
+
* this logs `"<Workload>.AddButton.Click"` with default action triggered by mouse, keyboard, or touch.
|
|
40
|
+
* `<Workload>` is set in Telemetry settings
|
|
41
|
+
* `IEngagementData` interface is mapped to a set of enums for standardization of mapping.
|
|
42
|
+
* Add new items to enum in order to register a new item specification.
|
|
43
|
+
* SiteType is defined in SiteType enum
|
|
44
|
+
* CurrentPage is defined in CurrentPage enum
|
|
45
|
+
* Component is defined in Component enum
|
|
46
|
+
* Feature is defined in Feature enum.
|
|
47
|
+
*/
|
|
48
|
+
EngagementLogger.log = function (engagementData) {
|
|
49
|
+
EngagementLogger._logEngagementData(engagementData);
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Engagement logging
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Use *.Click for all the actions triggered by mouse, keyboard, or touch.
|
|
56
|
+
* tagName follows `<Workload>.controlName.actionName` pattern
|
|
57
|
+
* For example, `tagName = "AddButton.Click"`,
|
|
58
|
+
* this logs `"<Workload>.AddButton.Click"` with default action triggered by mouse, keyboard, or touch.
|
|
59
|
+
* `<Workload>` is set in Telemetry settings
|
|
60
|
+
* Use extraData to log the type of action.
|
|
61
|
+
* For example, `actionName = "Keydown"` and `tagName = "ModernPublish.AddButton.Click"`
|
|
62
|
+
* this logs `"<Workload>.AddButton.Click"` with the extraData that it was selected using the Keydown
|
|
63
|
+
*/
|
|
64
|
+
EngagementLogger.logEvent = function (tagName, actionName) {
|
|
65
|
+
var logData = { name: tagName };
|
|
66
|
+
if (actionName && actionName.length !== 0) {
|
|
67
|
+
logData.extraData = { action: actionName };
|
|
68
|
+
}
|
|
69
|
+
EngagementLogger._logEngagementData(logData);
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Engagement logging with LogEntry
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* Here is an example:
|
|
76
|
+
* ```
|
|
77
|
+
* {"EngagementName":"SPPage.NavigationAction.SPPageQuickLaunchUpdate"`,
|
|
78
|
+
* "Properties":"{\"message\":\"[NavigationAction] | SPPageQuickLaunchUpdate | 2 | null\"}",
|
|
79
|
+
* "Duration":0,"LogType":0,
|
|
80
|
+
* "ClientTime":1459357627444,"Source":"ClientV2Engagement"}
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* NavigationAction is moduleName in LogEntry, SPPageQuickLaunchUpdate is log feature name
|
|
84
|
+
* In this example, SPPage is workload name which is set in Telemetry settings.
|
|
85
|
+
* Do NOT add PII data!
|
|
86
|
+
*/
|
|
87
|
+
EngagementLogger.logEventWithLogEntry = function (logEntry) {
|
|
88
|
+
var logData = {
|
|
89
|
+
isIntentional: logEntry.isIntentional,
|
|
90
|
+
name: logEntry.moduleName + '.' + logEntry.logFeature,
|
|
91
|
+
extraData: logEntry.logProperties
|
|
92
|
+
};
|
|
93
|
+
EngagementLogger._logEngagementData(logData, true);
|
|
94
|
+
};
|
|
95
|
+
EngagementLogger._logEngagementData = function (engagementData, isLogEntry) {
|
|
96
|
+
if (isLogEntry === void 0) { isLogEntry = false; }
|
|
97
|
+
if (!engagementData.name || engagementData.name.length === 0) {
|
|
98
|
+
throw new Error('LogEntry is invalid');
|
|
99
|
+
}
|
|
100
|
+
EngagementLogger._checkValidTagName(engagementData, isLogEntry);
|
|
101
|
+
EngagementLogger._addContextData(engagementData);
|
|
102
|
+
EngagementLogger._appendExtraData(engagementData);
|
|
103
|
+
EngagementLogger._logManager.log(engagementData);
|
|
104
|
+
};
|
|
105
|
+
// tagName should follow AppName.ControlName.ActionName pattern
|
|
106
|
+
EngagementLogger._checkValidTagName = function (engagementData, isLogEntry) {
|
|
107
|
+
if (isLogEntry === void 0) { isLogEntry = false; }
|
|
108
|
+
if (!isLogEntry) {
|
|
109
|
+
var tagNameRegex = /(\w+)\.(\w+).(\w+)/gi;
|
|
110
|
+
if (tagNameRegex.test(engagementData.name) === false) {
|
|
111
|
+
throw new Error("".concat(engagementData.name, " tagName does not follow AppName.ControlName.ActionName pattern"));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
EngagementLogger._addContextData = function (data) {
|
|
116
|
+
if (DiagnosticsSettingsManager.isInitialized) {
|
|
117
|
+
var _a = DiagnosticsSettingsManager.settings, listId = _a.listId, listItemUniqueId = _a.listItemUniqueId, siteId = _a.siteId, webId = _a.webId;
|
|
118
|
+
data.siteId = siteId;
|
|
119
|
+
data.webId = webId;
|
|
120
|
+
if (listId) {
|
|
121
|
+
data.listId = listId;
|
|
122
|
+
if (listItemUniqueId) {
|
|
123
|
+
data.docId = listItemUniqueId;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
EngagementLogger._appendExtraData = function (data) {
|
|
129
|
+
if (DiagnosticsSettingsManager.isInitialized) {
|
|
130
|
+
var contextInfo = DiagnosticsSettingsManager.settings.contextInfo;
|
|
131
|
+
if (contextInfo) {
|
|
132
|
+
if (!data.extraData) {
|
|
133
|
+
data.extraData = {};
|
|
134
|
+
}
|
|
135
|
+
setPageExtraData(contextInfo, data.extraData);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
EngagementLogger._logManager = new LogManager();
|
|
140
|
+
return EngagementLogger;
|
|
141
|
+
}());
|
|
142
|
+
export default EngagementLogger;
|
|
143
|
+
//# sourceMappingURL=EngagementLogger.js.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engagement logger log data interface
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export interface IEngagementHandler {
|
|
6
|
+
/** Engagement user action logging operation **/
|
|
7
|
+
logData(data: IEngagementData): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Engagement handler log data action interface
|
|
11
|
+
* Represents a subset of Engagement Event Stream fields.
|
|
12
|
+
* Full list can be located at: `\odsp-utilities\src\local\logging\events\Engagement.event.json`
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export interface IEngagementData {
|
|
16
|
+
/** name should follow `AppName.ControlName.ActionName` pattern **/
|
|
17
|
+
name: string;
|
|
18
|
+
/** extraData is used to specify additional details regarding the action **/
|
|
19
|
+
extraData?: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
/** used for tracking the site the user was on when the log was made **/
|
|
23
|
+
siteId?: string;
|
|
24
|
+
/** used for tracking the web the user was on when the log was made **/
|
|
25
|
+
webId?: string;
|
|
26
|
+
/** ABExperiment object used by experiments **/
|
|
27
|
+
experiment?: IABExperiment;
|
|
28
|
+
/** Site Type name of the relevant SharePoint web **/
|
|
29
|
+
siteType?: SiteType;
|
|
30
|
+
/** Component name of the relevant engagement event **/
|
|
31
|
+
component?: Component;
|
|
32
|
+
/** Feature name of the relevant recorded action **/
|
|
33
|
+
currentPage?: CurrentPage;
|
|
34
|
+
/** Feature name of the relevant recorded action **/
|
|
35
|
+
feature?: Feature;
|
|
36
|
+
/** Feature name of the relevant recorded action **/
|
|
37
|
+
usageType?: UsageType;
|
|
38
|
+
/** This indicates whether it is an intentional action by the user.
|
|
39
|
+
* Setting isIntentional to true
|
|
40
|
+
* will automatically publish engagement specific data to Interana
|
|
41
|
+
*/
|
|
42
|
+
isIntentional?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The Id of the relevant SharePoint list
|
|
45
|
+
*/
|
|
46
|
+
listId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The Id of the relevant SharePoint document
|
|
49
|
+
*/
|
|
50
|
+
docId?: string;
|
|
51
|
+
/** used for tracking the item the user was on when the log was made **/
|
|
52
|
+
listItemUniqueId?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* ABExperiment interface.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export interface IABExperiment {
|
|
59
|
+
/** Checks if the current specified target is being selected to be part of the experiment **/
|
|
60
|
+
IsExperimentOn?: () => boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Syte Type Classification for the syteType field in Engagement Event stream.
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export type SiteType = 'GroupSite' | 'TeamSite' | 'CommunicationSite' | 'PublishingSite' | 'MySite';
|
|
67
|
+
/**
|
|
68
|
+
* CurrentPage Classification for the currentPage field in Engagement Event stream.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export type CurrentPage = 'HomePage' | 'NewsArticlePage' | 'ArticlePage' | 'TopicPage' | 'ModernPage' | 'ClassicPage' | 'NewsPage' | 'NewsDigestPage' | 'Space' | 'VideoNewsLink' | 'Dashboard' | 'SearchPage';
|
|
72
|
+
/**
|
|
73
|
+
* Component list for the component field in Engagement Event stream.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
export type Component = 'View' | 'Button' | 'CommentDeleteCancelAction' | 'CommentDeleteConfirmAction' | 'CommentDeleteOpenAction' | 'CommentReplyAction' | 'CommentReplyPostButton' | 'CommentShowMoreButton' | 'CommentsDisable' | 'CommentsEnable' | 'LoadMoreCommentReplies' | 'LoadMoreComments' | 'DiscardButton' | 'DiscardOKButton' | 'EditButton' | 'NewApp' | 'NewButton' | 'NewDocLib' | 'NewList' | 'NewPlan' | 'NewsAdd' | 'NewsSeeAll' | 'NewsArticleTitle' | 'NewsSiteTitle' | 'NewsImageArea' | 'NewsItemPinned' | 'NewsPinnedItemRemoved' | 'NewsPinnedItemSorted' | 'NewsSocialAction' | 'NewsWebPart' | 'SelectNewsToPin' | 'CreateNewsLinkFromHome' | 'CreateVideoNewsLinkFromHome' | 'CreateTopicPageFromHome' | 'CreateNewsPostFromHome' | 'CreateNewsPostFromArticle' | 'NewsDraft' | 'PostPublishAddToNav' | 'PostPublishCopyAddress' | 'PostPublishEmail' | 'PostShareToTeams' | 'PostPublishPostAsNews' | 'PromoteButton' | 'PublishButton' | 'PostAndSendButton' | 'SaveButton' | 'CreateNewsDigest' | 'ContinueNewsDigest' | 'SendNewsDigest' | 'CancelNewsDigest' | 'ShareButton' | 'ShareToTeamsButton' | 'StartCoAuth' | 'StartWithPageCopy' | 'StartWithNewsPostCopy' | 'StartWithTemplate' | 'ScrollBar' | 'Header' | 'Component' | 'Extension' | 'PageSettingsButton' | 'SaveAsTemplateButton' | 'SubmitButtonClick' | 'ReviewApprovalsButtonClick' | 'SubmitDone' | 'ApproveDone' | 'RejectDone' | 'CheckedOutButton' | 'BaseWPSelectedLayout' | 'NewsRollup' | 'SaveAsDraftByInactivity' | 'DiscardByInactivity' | 'BoostButton' | 'NewAppToModernStore' | 'CopyLinkButton' | 'PostShareToYammer' | 'PostPublishShare' | 'PostPublishSend' | 'PostPublishCopyLink' | 'PageSettingsPanelCopyLink' | 'ShareLinkButton' | 'SendEmailButton' | 'CustomGPTButton' | 'MFEWarningMessageBar' | 'VersionHistoryButton' | 'RestoreVersionButton' | 'DeleteVersionButton' | 'UnpublishVersionButton' | 'CompareVersionButton' | 'HighlightChangesButton';
|
|
77
|
+
/**
|
|
78
|
+
* UsageType list for the usageType field in Engagement Event stream.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export type UsageType = 'Click' | 'Scroll' | 'ScrollUp' | 'ScrollDown' | 'Hover' | 'Load' | 'PageLoad' | 'Render' | 'Drag' | 'Drop' | 'Tap' | 'KeyDown' | 'KeyPress' | 'RightClick' | 'Swipe';
|
|
82
|
+
/**
|
|
83
|
+
* Feature list for the feature field in Engagement Event stream.
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
export type Feature = 'News' | 'NewsDigest' | 'WebPart' | 'ScrollBar' | 'Header' | 'Canvas' | 'Leftnav' | 'TopNav';
|
|
87
|
+
//# sourceMappingURL=IEngagementHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEngagementHandler.d.ts","sourceRoot":"","sources":["../../../src/Api/Engagement/IEngagementHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,OAAO,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;CACtC;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAE7E,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACnC,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,qDAAqD;IACrD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,uDAAuD;IACvD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,oDAAoD;IACpD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oDAAoD;IACpD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAEpG;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,iBAAiB,GACjB,aAAa,GACb,WAAW,GACX,YAAY,GACZ,aAAa,GACb,UAAU,GACV,gBAAgB,GAChB,OAAO,GACP,eAAe,GACf,WAAW,GACX,YAAY,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,QAAQ,GACR,2BAA2B,GAC3B,4BAA4B,GAC5B,yBAAyB,GACzB,oBAAoB,GACpB,wBAAwB,GACxB,uBAAuB,GACvB,iBAAiB,GACjB,gBAAgB,GAChB,wBAAwB,GACxB,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,SAAS,GACT,YAAY,GACZ,kBAAkB,GAClB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,uBAAuB,GACvB,sBAAsB,GACtB,kBAAkB,GAClB,aAAa,GACb,iBAAiB,GACjB,wBAAwB,GACxB,6BAA6B,GAC7B,yBAAyB,GACzB,wBAAwB,GACxB,2BAA2B,GAC3B,WAAW,GACX,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,GAClB,kBAAkB,GAClB,uBAAuB,GACvB,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,YAAY,GACZ,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,GAChB,kBAAkB,GAClB,aAAa,GACb,oBAAoB,GACpB,aAAa,GACb,mBAAmB,GACnB,uBAAuB,GACvB,mBAAmB,GACnB,WAAW,GACX,QAAQ,GACR,WAAW,GACX,WAAW,GACX,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,GACnB,4BAA4B,GAC5B,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,kBAAkB,GAClB,sBAAsB,GACtB,YAAY,GACZ,yBAAyB,GACzB,qBAAqB,GACrB,aAAa,GACb,qBAAqB,GACrB,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,2BAA2B,GAC3B,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,sBAAsB,GACtB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,wBAAwB,GACxB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,QAAQ,GACR,UAAU,GACV,YAAY,GACZ,OAAO,GACP,MAAM,GACN,UAAU,GACV,QAAQ,GACR,MAAM,GACN,MAAM,GACN,KAAK,GACL,SAAS,GACT,UAAU,GACV,YAAY,GACZ,OAAO,CAAC;AAEZ;;;GAGG;AACH,MAAM,MAAM,OAAO,GACf,MAAM,GACN,YAAY,GACZ,SAAS,GACT,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface IExecutionEntry {
|
|
2
|
+
key: string;
|
|
3
|
+
args: unknown[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* ExecutionQueue allows multiple handlers to be processed in real time or deferred.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export default class ExecutionQueue {
|
|
10
|
+
private _shouldExecuteInRealTime;
|
|
11
|
+
private _handlers;
|
|
12
|
+
private _executionEntries;
|
|
13
|
+
/**
|
|
14
|
+
* Determines if the added execution entries should be processed in real time.
|
|
15
|
+
* If this is set to true, a stack with entries will not be saved.
|
|
16
|
+
*/
|
|
17
|
+
get shouldExecuteInRealTime(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Sets the behavior for this execution stack.
|
|
20
|
+
* When set to true, all entries on stack will be processed and future entries
|
|
21
|
+
* will be executed in real time.
|
|
22
|
+
* When set to false, future entries will be saved in the execution stack for
|
|
23
|
+
* later processing.
|
|
24
|
+
*/
|
|
25
|
+
set shouldExecuteInRealTime(executeInRealTime: boolean);
|
|
26
|
+
/**
|
|
27
|
+
* Registers an external handler to collection for delayed asynchronous processing.
|
|
28
|
+
* Handlers are registered once. If handler is already registered, it does nothing.
|
|
29
|
+
*/
|
|
30
|
+
addHandler(key: string, handler: (...args: unknown[]) => void): void;
|
|
31
|
+
/**
|
|
32
|
+
* Execution Entry registration for delayed asynchronous processing.
|
|
33
|
+
*/
|
|
34
|
+
addExecutionEntry(key: string, ...args: unknown[]): void;
|
|
35
|
+
/**
|
|
36
|
+
* Removes an external executionEntry handler from collection for asynchronous event logging.
|
|
37
|
+
* Logger is registered once.
|
|
38
|
+
*/
|
|
39
|
+
removeHandler(key: string, handler: (...args: unknown[]) => void): void;
|
|
40
|
+
/**
|
|
41
|
+
* Reset function clears executionEntry handler collection for asynchronous event logging.
|
|
42
|
+
* All recorded execution entries and handlers are purged.
|
|
43
|
+
*/
|
|
44
|
+
reset(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Flushes all the buffered execution entries.
|
|
47
|
+
* All recorded execution entries are purged.
|
|
48
|
+
*/
|
|
49
|
+
flush(): void;
|
|
50
|
+
private _containsHandler;
|
|
51
|
+
private _initializeHandlerArrayForKey;
|
|
52
|
+
private _processAllExecutionEntries;
|
|
53
|
+
private _processExecutionEntry;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=ExecutionQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionQueue.d.ts","sourceRoot":"","sources":["../../src/Api/ExecutionQueue.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,wBAAwB,CAAkB;IAClD,OAAO,CAAC,SAAS,CAA8D;IAC/E,OAAO,CAAC,iBAAiB,CAA8B;IAEvD;;;OAGG;IACH,IAAW,uBAAuB,IAAI,OAAO,CAE5C;IAED;;;;;;OAMG;IACH,IAAW,uBAAuB,CAAC,iBAAiB,EAAE,OAAO,EAM5D;IAED;;;OAGG;IACI,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI;IAY3E;;OAEG;IACI,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAU/D;;;OAGG;IACI,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI;IAO9E;;;OAGG;IACI,KAAK,IAAI,IAAI;IAKpB;;;OAGG;IACI,KAAK,IAAI,IAAI;IAKpB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,6BAA6B;IAMrC,OAAO,CAAC,2BAA2B;IAenC,OAAO,CAAC,sBAAsB;CAU/B"}
|