@microsoft/sp-diagnostics 1.19.0 → 1.20.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  "id": "78359e4b-07c2-43c6-8d0b-d060b4d577e8",
4
4
  "alias": "SPDiagnostics",
5
5
  "componentType": "Library",
6
- "version": "1.19.0",
6
+ "version": "1.20.0",
7
7
  "loaderConfig": {
8
8
  "internalModuleBaseUrls": [
9
9
  "https://localhost:4321/dist/"
@@ -13,19 +13,24 @@
13
13
  "sp-diagnostics": {
14
14
  "type": "path",
15
15
  "path": {
16
- "path": "sp-diagnostics_none_aed64128d853ed8c6736.js",
17
- "integrity": "sha256-fNfhq8pf/GpKn8swQovPPdYPyRc+NHjNC1LUIOALNO8="
16
+ "path": "sp-diagnostics_none_40bc261076b5c65e783c.js",
17
+ "integrity": "sha256-AmRdUCY8TGhe7DrYUaARfm94JgPhU+BzTBRr4HFvTb8="
18
18
  }
19
19
  },
20
20
  "@microsoft/sp-core-library": {
21
21
  "type": "component",
22
22
  "id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b",
23
- "version": "1.19.0"
23
+ "version": "1.20.0"
24
24
  },
25
25
  "@microsoft/sp-lodash-subset": {
26
26
  "type": "component",
27
27
  "id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a",
28
- "version": "1.19.0"
28
+ "version": "1.20.0"
29
+ },
30
+ "@ms/odsp-core-bundle": {
31
+ "type": "component",
32
+ "id": "2e09fb9b-13bb-48f2-859f-97d6fff71176",
33
+ "version": "1.4.195"
29
34
  },
30
35
  "tslib": {
31
36
  "type": "component",
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { ILogHandler } from '@microsoft/sp-core-library';
9
+ import type { IQosEndSchema } from '@ms/odsp-core-bundle';
9
10
  import { ServiceKey } from '@microsoft/sp-core-library';
10
11
  import type { ServiceScope } from '@microsoft/sp-core-library';
11
12
  import type { _VetoValues } from '@microsoft/sp-core-library';
@@ -30,6 +31,14 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
30
31
 
31
32
  /* Excluded from this release type: _IABExperiment */
32
33
 
34
+ /**
35
+ * Options for clearing telemetry settings including top level and nested properties
36
+ */
37
+ declare interface IClearSettingsOptions {
38
+ diagnosticSettings?: (keyof _IDiagnosticsSettings)[];
39
+ extraDiagnosticInfo?: (keyof IExtraDiagnosticInfo)[];
40
+ }
41
+
33
42
  /* Excluded from this release type: _ICustomerPromiseErrorDetails */
34
43
 
35
44
  /* Excluded from this release type: _IDiagnosticContextInfo */
@@ -42,6 +51,30 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
42
51
 
43
52
  /* Excluded from this release type: _IExtraDataForCustomerPromise */
44
53
 
54
+ /**
55
+ * Extra diagnostic information not related to core configuration
56
+ */
57
+ declare interface IExtraDiagnosticInfo {
58
+ /**
59
+ * The id of the authoring session if user is currently editing the page.
60
+ * Session id is same across all users collaborating on the same page.
61
+ * Example: `"{b29e6452-fe31-4967-872b-ea5d23dbfe07}"`
62
+ */
63
+ authoringSessionId?: string;
64
+ /**
65
+ * Only valid in authoring session, the id of the last op that has been received by the current client.
66
+ * This id is unique and is incremented globally across the authoring session so this can be used to align
67
+ * the timing of multiple users rather than relying on browser time from different devices.
68
+ * Example: `5`
69
+ */
70
+ authoringOpSequenceId?: number;
71
+ /**
72
+ * Only valid in authoring session. This represents the number of concurrent clients in an authoring session.
73
+ * It will be updated as and when users join and leave a page edit session.
74
+ */
75
+ authoringSessionClientCount?: number;
76
+ }
77
+
45
78
  /* Excluded from this release type: _ILogData */
46
79
 
47
80
  /* Excluded from this release type: _ILogEntry */
@@ -56,8 +89,6 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
56
89
 
57
90
  /* Excluded from this release type: _IQos */
58
91
 
59
- /* Excluded from this release type: _IQosEndEvent */
60
-
61
92
  /* Excluded from this release type: _IQosExtraData */
62
93
 
63
94
  /* Excluded from this release type: _IQosStartEvent */
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { ILogHandler } from '@microsoft/sp-core-library';
9
+ import type { IQosEndSchema } from '@ms/odsp-core-bundle';
9
10
  import { ServiceKey } from '@microsoft/sp-core-library';
10
11
  import type { ServiceScope } from '@microsoft/sp-core-library';
11
12
  import type { _VetoValues } from '@microsoft/sp-core-library';
@@ -30,6 +31,14 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
30
31
 
31
32
  /* Excluded from this release type: _IABExperiment */
32
33
 
34
+ /**
35
+ * Options for clearing telemetry settings including top level and nested properties
36
+ */
37
+ declare interface IClearSettingsOptions {
38
+ diagnosticSettings?: (keyof _IDiagnosticsSettings)[];
39
+ extraDiagnosticInfo?: (keyof IExtraDiagnosticInfo)[];
40
+ }
41
+
33
42
  /* Excluded from this release type: _ICustomerPromiseErrorDetails */
34
43
 
35
44
  /* Excluded from this release type: _IDiagnosticContextInfo */
@@ -42,6 +51,30 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
42
51
 
43
52
  /* Excluded from this release type: _IExtraDataForCustomerPromise */
44
53
 
54
+ /**
55
+ * Extra diagnostic information not related to core configuration
56
+ */
57
+ declare interface IExtraDiagnosticInfo {
58
+ /**
59
+ * The id of the authoring session if user is currently editing the page.
60
+ * Session id is same across all users collaborating on the same page.
61
+ * Example: `"{b29e6452-fe31-4967-872b-ea5d23dbfe07}"`
62
+ */
63
+ authoringSessionId?: string;
64
+ /**
65
+ * Only valid in authoring session, the id of the last op that has been received by the current client.
66
+ * This id is unique and is incremented globally across the authoring session so this can be used to align
67
+ * the timing of multiple users rather than relying on browser time from different devices.
68
+ * Example: `5`
69
+ */
70
+ authoringOpSequenceId?: number;
71
+ /**
72
+ * Only valid in authoring session. This represents the number of concurrent clients in an authoring session.
73
+ * It will be updated as and when users join and leave a page edit session.
74
+ */
75
+ authoringSessionClientCount?: number;
76
+ }
77
+
45
78
  /* Excluded from this release type: _ILogData */
46
79
 
47
80
  /* Excluded from this release type: _ILogEntry */
@@ -56,8 +89,6 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
56
89
 
57
90
  /* Excluded from this release type: _IQos */
58
91
 
59
- /* Excluded from this release type: _IQosEndEvent */
60
-
61
92
  /* Excluded from this release type: _IQosExtraData */
62
93
 
63
94
  /* Excluded from this release type: _IQosStartEvent */
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { ILogHandler } from '@microsoft/sp-core-library';
9
+ import type { IQosEndSchema } from '@ms/odsp-core-bundle';
9
10
  import { ServiceKey } from '@microsoft/sp-core-library';
10
11
  import type { ServiceScope } from '@microsoft/sp-core-library';
11
12
  import type { _VetoValues } from '@microsoft/sp-core-library';
@@ -30,6 +31,14 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
30
31
 
31
32
  /* Excluded from this release type: _IABExperiment */
32
33
 
34
+ /**
35
+ * Options for clearing telemetry settings including top level and nested properties
36
+ */
37
+ declare interface IClearSettingsOptions {
38
+ diagnosticSettings?: (keyof _IDiagnosticsSettings)[];
39
+ extraDiagnosticInfo?: (keyof IExtraDiagnosticInfo)[];
40
+ }
41
+
33
42
  /* Excluded from this release type: _ICustomerPromiseErrorDetails */
34
43
 
35
44
  /* Excluded from this release type: _IDiagnosticContextInfo */
@@ -42,6 +51,30 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
42
51
 
43
52
  /* Excluded from this release type: _IExtraDataForCustomerPromise */
44
53
 
54
+ /**
55
+ * Extra diagnostic information not related to core configuration
56
+ */
57
+ declare interface IExtraDiagnosticInfo {
58
+ /**
59
+ * The id of the authoring session if user is currently editing the page.
60
+ * Session id is same across all users collaborating on the same page.
61
+ * Example: `"{b29e6452-fe31-4967-872b-ea5d23dbfe07}"`
62
+ */
63
+ authoringSessionId?: string;
64
+ /**
65
+ * Only valid in authoring session, the id of the last op that has been received by the current client.
66
+ * This id is unique and is incremented globally across the authoring session so this can be used to align
67
+ * the timing of multiple users rather than relying on browser time from different devices.
68
+ * Example: `5`
69
+ */
70
+ authoringOpSequenceId?: number;
71
+ /**
72
+ * Only valid in authoring session. This represents the number of concurrent clients in an authoring session.
73
+ * It will be updated as and when users join and leave a page edit session.
74
+ */
75
+ authoringSessionClientCount?: number;
76
+ }
77
+
45
78
  /* Excluded from this release type: _ILogData */
46
79
 
47
80
  /* Excluded from this release type: _ILogEntry */
@@ -56,8 +89,6 @@ import type { _VetoValues } from '@microsoft/sp-core-library';
56
89
 
57
90
  /* Excluded from this release type: _IQos */
58
91
 
59
- /* Excluded from this release type: _IQosEndEvent */
60
-
61
92
  /* Excluded from this release type: _IQosExtraData */
62
93
 
63
94
  /* Excluded from this release type: _IQosStartEvent */
@@ -0,0 +1 @@
1
+ define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.20.0",["@microsoft/sp-core-library","@microsoft/sp-lodash-subset","@ms/odsp-core-bundle","tslib"],(e,t,n,a)=>(()=>{"use strict";var i={878:t=>{t.exports=e},348:e=>{e.exports=t},362:e=>{e.exports=n},553: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:()=>k,_AutoAlertableQosMonitor:()=>M,_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:()=>A,_QosMonitorShareFailureWithCP:()=>P,_QosResultType:()=>x,_TraceLogger:()=>u,_logSourceServiceKey:()=>a});var e=o(878),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(348);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.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(362),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}();function w(){return e._SPKillSwitch.isActivated("f215a9d1-26ca-4398-b7b1-2600b0e3b1a6")}var E={id:"QosMonitor"};const A=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;if(o&&(r._endExtraData.AuthoringOpSequenceId=o),!w()){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(t,n,a,i){if(!this._shouldSkip(t)){this._ensureCorrelationId(t,i),this._endResultCode=n,this._endResult=t;var r=a?function(){try{return e._SPKillSwitch.isActivated("d953c006-7eeb-48b7-ab00-ee9bb15488c3")}catch(t){if(e._BrowserUtilities.safelyAccessSessionStorage("spfx-debug"))return!1;throw t}}()?a.message:(0,I.getErrorMessage)(a):void 0;if(a instanceof I.CustomError){var o=(0,I.getQosEndSchemaFromError)(a);o&&(o.resultType=this._endResult,o.extraData=(0,h.merge)({},this._endExtraData,o.extraData)),O.instance.writeQosEndResult(this._id,o)}else{var s={resultCode:this._endResultCode,resultType:this._endResult,error:r,extraData:this._endExtraData};O.instance.writeQosEndResult(this._id,s)}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(E,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 L=o(553),k={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4",DynamicReliabilityExpectedFailureHighSev4:"DynamicReliabilityExpectedFailureHighSev4"},M=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,L.__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=k[this._autoAlertableMonitorType],t},t}(A),P=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,L.__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(n,a,i,r){void 0===n&&(n="DefaultExpected"),void 0===r&&(r=!1),t.prototype.writeExpectedFailure.call(this,n,a,i),!e._SPKillSwitch.isActivated("874c8d5e-155b-4d4a-a163-f4a4402438ce")&&r||this._logCustomerPromiseFailure((null==a?void 0:a.message)||"DefaultErrorMessage",n,x.ExpectedFailure,i)},n.prototype._logCustomerPromiseFailure=function(t,n,a,i){void 0===a&&(a=x.Failure),this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(function(r){var o=r.logFailure,s=r.veto,c=r.errorModuleName;if(!w()){var d=g.getAuthoringSessionClientCountInfo();d&&d>1?c+=" with Multiple Users":e._SPKillSwitch.isActivated("a49471f3-bb8b-40e2-a3f1-a8dfac9529cb")||d||(c+=" in Legacy Authoring")}o({errorCode:c,errorScenario:n,errorMessage:t,resultType:a,pageType:null==i?void 0:i.pageType,errorStack:null==i?void 0:i.errorStack,veto:s})})},n}(A)})(),s})());
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.42.3"
8
+ "packageVersion": "7.47.7"
9
9
  }
10
10
  ]
11
11
  }
@@ -23,5 +23,5 @@ var LogLevel;
23
23
  * An error
24
24
  */
25
25
  LogLevel[LogLevel["Error"] = 4] = "Error";
26
- })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
26
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
27
27
  //# sourceMappingURL=LogLevel.js.map
@@ -4,18 +4,22 @@ var tslib_1 = require("tslib");
4
4
  var sp_core_library_1 = require("@microsoft/sp-core-library");
5
5
  // Copyright (c) Microsoft. All rights reserved.
6
6
  var sp_core_library_2 = require("@microsoft/sp-core-library");
7
+ var odsp_core_bundle_1 = require("@ms/odsp-core-bundle");
7
8
  var TraceLogger_1 = tslib_1.__importDefault(require("../Trace/TraceLogger"));
8
9
  var QosResultType_1 = require("./QosResultType");
9
10
  var QosLogger_1 = tslib_1.__importDefault(require("./QosLogger"));
10
11
  var EngagementLogger_1 = tslib_1.__importDefault(require("../Engagement/EngagementLogger"));
12
+ var Diagnostics_1 = tslib_1.__importDefault(require("../../Diagnostics"));
11
13
  var DiagnosticsSettingsManager_1 = tslib_1.__importDefault(require("../../DiagnosticsSettingsManager"));
12
14
  var Killswitches_1 = require("../../common/Killswitches");
15
+ var sp_lodash_subset_1 = require("@microsoft/sp-lodash-subset");
13
16
  var LOG_SOURCE = {
14
17
  id: 'QosMonitor'
15
18
  };
16
19
  var QOS_MONISTOR_HAS_ENDED_ERROR_STRING = "QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.";
17
20
  var AUTHORING_SESSION_ID_KEY = 'AuthoringSessionId';
18
21
  var AUTHORING_OP_SEQUENCE_ID_KEY = 'AuthoringOpSequenceId';
22
+ var AUTHORING_SESSION_CLIENT_COUNT = 'AuthoringSessionClientCount';
19
23
  /**
20
24
  * Qos logger
21
25
  * This class represents the Qos monitor APIs
@@ -45,11 +49,19 @@ var QosMonitor = /** @class */ (function () {
45
49
  var authoringSessionId = (_b = (_a = DiagnosticsSettingsManager_1.default.settings) === null || _a === void 0 ? void 0 : _a.extraDiagnosticInfo) === null || _b === void 0 ? void 0 : _b.authoringSessionId;
46
50
  if (authoringSessionId) {
47
51
  _this._ensureEndExtraData();
52
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
48
53
  _this._endExtraData[AUTHORING_SESSION_ID_KEY] = authoringSessionId;
49
54
  var authoringOpSequenceId = (_d = (_c = DiagnosticsSettingsManager_1.default.settings) === null || _c === void 0 ? void 0 : _c.extraDiagnosticInfo) === null || _d === void 0 ? void 0 : _d.authoringOpSequenceId;
50
55
  if (authoringOpSequenceId) {
56
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51
57
  _this._endExtraData[AUTHORING_OP_SEQUENCE_ID_KEY] = authoringOpSequenceId;
52
58
  }
59
+ if (!(0, Killswitches_1.isDifferentiateMultiUserSessionFailureKSActive)()) {
60
+ var authoringSessionClientCount = Diagnostics_1.default.getAuthoringSessionClientCountInfo();
61
+ if (authoringSessionClientCount && _this._endExtraData) {
62
+ _this._endExtraData[AUTHORING_SESSION_CLIENT_COUNT] = authoringSessionClientCount;
63
+ }
64
+ }
53
65
  }
54
66
  };
55
67
  sp_core_library_2.Validate.isNonemptyString(scenarioName, 'scenarioName');
@@ -158,13 +170,31 @@ var QosMonitor = /** @class */ (function () {
158
170
  this._ensureCorrelationId(resultType, extraData);
159
171
  this._endResultCode = tagNameSuffix;
160
172
  this._endResult = resultType;
161
- var endData = {
162
- resultCode: this._endResultCode,
163
- resultType: this._endResult,
164
- error: ex ? ex.message : undefined,
165
- extraData: this._endExtraData
166
- };
167
- QosLogger_1.default.instance.writeQosEndResult(this._id, endData);
173
+ var errorString = !ex
174
+ ? undefined
175
+ : !(0, Killswitches_1.isMarkPrivacyDataKSActive)()
176
+ ? (0, odsp_core_bundle_1.getErrorMessage)(ex)
177
+ : ex.message;
178
+ if (ex instanceof odsp_core_bundle_1.CustomError) {
179
+ var endSchema = (0, odsp_core_bundle_1.getQosEndSchemaFromError)(ex);
180
+ if (endSchema) {
181
+ endSchema.resultType = this._endResult;
182
+ // Make sure the extraData from `endSchema` takes priority so that
183
+ // extra data like correlation id from the error object is logged
184
+ // instead of the generic extra data from `_endExtraData`.
185
+ endSchema.extraData = (0, sp_lodash_subset_1.merge)({}, this._endExtraData, endSchema.extraData);
186
+ }
187
+ QosLogger_1.default.instance.writeQosEndResult(this._id, endSchema);
188
+ }
189
+ else {
190
+ var endData = {
191
+ resultCode: this._endResultCode,
192
+ resultType: this._endResult,
193
+ error: errorString,
194
+ extraData: this._endExtraData
195
+ };
196
+ QosLogger_1.default.instance.writeQosEndResult(this._id, endData);
197
+ }
168
198
  this._writeToEngagement();
169
199
  };
170
200
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -173,6 +203,7 @@ var QosMonitor = /** @class */ (function () {
173
203
  if (extraData) {
174
204
  this._ensureEndExtraData();
175
205
  // Instead of slower ...[spread], copy over the incoming values manually
206
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
176
207
  Object.keys(extraData).forEach(function (k) { return (_this._endExtraData[k] = extraData[k]); });
177
208
  }
178
209
  if (DiagnosticsSettingsManager_1.default.isInitialized && resultType !== QosResultType_1.QosResultType.Success) {
@@ -205,42 +236,35 @@ var QosMonitor = /** @class */ (function () {
205
236
  * ClassHome-TeamsWeb: ClassHome app loaded through Teams Web browser, not including mobile
206
237
  */
207
238
  QosMonitor.prototype._logHostType = function () {
208
- var _a;
209
239
  if (DiagnosticsSettingsManager_1.default.isInitialized) {
210
- var appHostType = void 0;
211
- if ((0, Killswitches_1.isLogTeamsAppTypeKSActivated)()) {
212
- var isMEEBridgeApplicationHosted = !(0, Killswitches_1.isLogVivaConnectionMobileAsAppHostTypeKSActivated)() &&
213
- sp_core_library_1._BrowserUtilities.isMEEBridgeApplicationHosted();
214
- if (isMEEBridgeApplicationHosted || sp_core_library_1._BrowserUtilities.isTeamsHosted()) {
215
- if (isMEEBridgeApplicationHosted) {
216
- appHostType = 'MEEBridge';
217
- }
218
- else if (sp_core_library_1._BrowserUtilities.isViva1PHosted()) {
219
- appHostType = 'Viva1p';
220
- }
221
- else if ((_a = DiagnosticsSettingsManager_1.default.settings.contextInfo) === null || _a === void 0 ? void 0 : _a.isEduClass) {
222
- appHostType = 'ClassHome';
223
- }
224
- var teamsHostType = sp_core_library_1._BrowserUtilities.isTeamsBrowserHosted() ? 'TeamsWeb' : 'TeamsNative';
225
- appHostType = appHostType ? "".concat(appHostType, "_").concat(teamsHostType) : teamsHostType;
226
- }
227
- }
228
- else {
229
- appHostType = sp_core_library_1._BrowserUtilities.getTeamsAppType();
230
- }
240
+ var appHostType = sp_core_library_1._BrowserUtilities.getTeamsAppType();
231
241
  // Skip logging for default SPO path for now to limit quota impact
232
242
  if (appHostType) {
233
243
  this._ensureEndExtraData();
234
244
  var hostKey = 'appHostType';
235
245
  // Unlikely, but avoid overwriting matching key value
246
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
236
247
  if (!this._endExtraData[hostKey]) {
248
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
237
249
  this._endExtraData[hostKey] = appHostType;
238
250
  }
239
251
  }
240
252
  }
241
253
  };
242
254
  QosMonitor.prototype._isDebugSession = function () {
243
- return !!sp_core_library_1._BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
255
+ try {
256
+ if (!sp_core_library_1._SPKillSwitch.isActivated('761ccb86-4fa0-4f56-a05b-477bcc09bd9f' /* '08/01/2024', 'finnnavin: Let QoSMonitor run in debug, uploading is blocked at SDK-level.' */)) {
257
+ return false;
258
+ }
259
+ else {
260
+ return !!sp_core_library_1._BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
261
+ }
262
+ }
263
+ catch (_a) {
264
+ // KillSwitches throw exceptions when not initialized.
265
+ // Currently this only happens when spfx-debug is present, so telemetry isn't being logged by the handler, and we can return false.
266
+ return false;
267
+ }
244
268
  };
245
269
  QosMonitor.prototype._shouldSkip = function (result) {
246
270
  if (this._hasEnded && this._endResult !== undefined) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QosMonitorShareFailureWithCP = void 0;
4
4
  var tslib_1 = require("tslib");
5
+ var Diagnostics_1 = tslib_1.__importDefault(require("../../Diagnostics"));
5
6
  var Killswitches_1 = require("../../common/Killswitches");
6
7
  var QosMonitor_1 = tslib_1.__importDefault(require("./QosMonitor"));
7
8
  var QosResultType_1 = require("./QosResultType");
@@ -20,9 +21,10 @@ var QosMonitorShareFailureWithCP = /** @class */ (function (_super) {
20
21
  * @param extraDataForCustomerPromise - Holds extra information about Customer Promise handlers to invoke
21
22
  * and error information where failures are logged
22
23
  */
23
- function QosMonitorShareFailureWithCP(scenarioName, copyToEngagement, extraDataForCustomerPromise) {
24
+ function QosMonitorShareFailureWithCP(scenarioName, copyToEngagement, extraDataForCustomerPromise, copyToCosmos) {
24
25
  if (copyToEngagement === void 0) { copyToEngagement = false; }
25
- var _this = _super.call(this, scenarioName, /* copyToCosmos */ false, /* copyToInterana */ copyToEngagement) || this;
26
+ if (copyToCosmos === void 0) { copyToCosmos = false; }
27
+ var _this = _super.call(this, scenarioName, /* copyToCosmos */ copyToCosmos, /* copyToInterana */ copyToEngagement) || this;
26
28
  _this._extraDataForCustomerPromise = extraDataForCustomerPromise;
27
29
  return _this;
28
30
  }
@@ -72,7 +74,17 @@ var QosMonitorShareFailureWithCP = /** @class */ (function (_super) {
72
74
  if (resultType === void 0) { resultType = QosResultType_1.QosResultType.Failure; }
73
75
  if (this._extraDataForCustomerPromise) {
74
76
  this._extraDataForCustomerPromise.forEach(function (extraHandlerInfo) {
75
- var errorModuleName = extraHandlerInfo.errorModuleName, logFailure = extraHandlerInfo.logFailure, veto = extraHandlerInfo.veto;
77
+ var logFailure = extraHandlerInfo.logFailure, veto = extraHandlerInfo.veto;
78
+ var errorModuleName = extraHandlerInfo.errorModuleName;
79
+ if (!(0, Killswitches_1.isDifferentiateMultiUserSessionFailureKSActive)()) {
80
+ var authoringSessionClientCount = Diagnostics_1.default.getAuthoringSessionClientCountInfo();
81
+ if (authoringSessionClientCount && authoringSessionClientCount > 1) {
82
+ errorModuleName += " with Multiple Users";
83
+ }
84
+ else if (!(0, Killswitches_1.isLogLegacyInCustomerPromiseKSActive)() && !authoringSessionClientCount) {
85
+ errorModuleName += " in Legacy Authoring";
86
+ }
87
+ }
76
88
  var errorDetailsForCP = {
77
89
  errorCode: errorModuleName,
78
90
  errorScenario: errorScenario,
@@ -51,6 +51,23 @@ var Diagnostics = /** @class */ (function () {
51
51
  Diagnostics.updateSettings = function (settings) {
52
52
  DiagnosticsSettingsManager_1.default.updateSettings(settings);
53
53
  };
54
+ /**
55
+ * Get the authoring session client count info from the extraDiagnosticsInfo from Diagnostics settings
56
+ * @returns the number of clients in the authoring session
57
+ */
58
+ Diagnostics.getAuthoringSessionClientCountInfo = function () {
59
+ var _a, _b;
60
+ return (_b = (_a = DiagnosticsSettingsManager_1.default.settings) === null || _a === void 0 ? void 0 : _a.extraDiagnosticInfo) === null || _b === void 0 ? void 0 : _b.authoringSessionClientCount;
61
+ };
62
+ /**
63
+ * Used to delete telemetry settings when they are no longer needed or need to be reset.
64
+ * The current updateSettings implementation does not support un-setting previously
65
+ * set settings values.
66
+ * @param settings - the subset of the telemetry settings to be cleared.
67
+ */
68
+ Diagnostics.clearSettings = function (settings) {
69
+ DiagnosticsSettingsManager_1.default.clearSettings(settings);
70
+ };
54
71
  Diagnostics._isInitialized = false;
55
72
  return Diagnostics;
56
73
  }());
@@ -20,6 +20,21 @@ var DiagnosticsSettingsManager = /** @class */ (function () {
20
20
  this.settings = (0, sp_lodash_subset_1.merge)(this.settings, settings);
21
21
  this._normalizeContextIds();
22
22
  };
23
+ DiagnosticsSettingsManager.clearSettings = function (settings) {
24
+ var _this = this;
25
+ if (settings.diagnosticSettings) {
26
+ settings.diagnosticSettings.forEach(function (setting) {
27
+ delete _this.settings[setting];
28
+ });
29
+ }
30
+ if (settings.extraDiagnosticInfo) {
31
+ settings.extraDiagnosticInfo.forEach(function (info) {
32
+ if (_this.settings.extraDiagnosticInfo && _this.settings.extraDiagnosticInfo[info]) {
33
+ delete _this.settings.extraDiagnosticInfo[info];
34
+ }
35
+ });
36
+ }
37
+ };
23
38
  Object.defineProperty(DiagnosticsSettingsManager, "isInitialized", {
24
39
  get: function () {
25
40
  return this._initialized;
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAllowSkippingCPErrorKSActive = exports.isAddingDebugFlagToEngagementExtraDataKSActive = exports.isLogTeamsAppTypeKSActivated = exports.isLogVivaConnectionMobileAsAppHostTypeKSActivated = void 0;
3
+ exports.isLogLegacyInCustomerPromiseKSActive = exports.isDifferentiateMultiUserSessionFailureKSActive = exports.isAllowSkippingCPErrorKSActive = exports.isMarkPrivacyDataKSActive = void 0;
4
4
  var sp_core_library_1 = require("@microsoft/sp-core-library");
5
- function isLogVivaConnectionMobileAsAppHostTypeKSActivated() {
6
- return sp_core_library_1._SPKillSwitch.isActivated('134e389a-67d1-4cf2-8516-d592c1079276'
7
- /* '2022-07-28', 'Enables QosMonitor to log Viva Connections as an appHostType' */
8
- );
9
- }
10
- exports.isLogVivaConnectionMobileAsAppHostTypeKSActivated = isLogVivaConnectionMobileAsAppHostTypeKSActivated;
11
- function isLogTeamsAppTypeKSActivated() {
12
- return sp_core_library_1._SPKillSwitch.isActivated('337aabd0-f050-467c-9728-dff6b2562cb0'
13
- /* '2022-08-31', 'Log appHostType for teams scenario' */
14
- );
15
- }
16
- exports.isLogTeamsAppTypeKSActivated = isLogTeamsAppTypeKSActivated;
17
- function isAddingDebugFlagToEngagementExtraDataKSActive() {
18
- return sp_core_library_1._SPKillSwitch.isActivated('76672562-f587-4362-a7ad-a1b397102c9a'
19
- /* '08/23/2023', 'Log isDebug in EngagementLogger extra data' */
20
- );
5
+ function isMarkPrivacyDataKSActive() {
6
+ // This as a KillSwitch may run in debug mode, as it occurs in paths that are triggered before KSes are loaded.
7
+ // In this case, we ensure we're in debug and then safely ignore the check..
8
+ try {
9
+ return sp_core_library_1._SPKillSwitch.isActivated('d953c006-7eeb-48b7-ab00-ee9bb15488c3'
10
+ /* '07/30/2024', 'liaye - Support marking privacy data in QosMonitor' */
11
+ );
12
+ }
13
+ catch (e) {
14
+ if (sp_core_library_1._BrowserUtilities.safelyAccessSessionStorage('spfx-debug')) {
15
+ return false;
16
+ }
17
+ else {
18
+ throw e;
19
+ }
20
+ }
21
21
  }
22
- exports.isAddingDebugFlagToEngagementExtraDataKSActive = isAddingDebugFlagToEngagementExtraDataKSActive;
22
+ exports.isMarkPrivacyDataKSActive = isMarkPrivacyDataKSActive;
23
23
  // cross-projects
24
24
  function isAllowSkippingCPErrorKSActive() {
25
25
  return sp_core_library_1._SPKillSwitch.isActivated('874c8d5e-155b-4d4a-a163-f4a4402438ce'
@@ -27,4 +27,18 @@ function isAllowSkippingCPErrorKSActive() {
27
27
  );
28
28
  }
29
29
  exports.isAllowSkippingCPErrorKSActive = isAllowSkippingCPErrorKSActive;
30
+ // cross-project: also in sp-edit-customer-promise and sp-pages-fluid
31
+ function isDifferentiateMultiUserSessionFailureKSActive() {
32
+ return sp_core_library_1._SPKillSwitch.isActivated('f215a9d1-26ca-4398-b7b1-2600b0e3b1a6'
33
+ /* '06/14/2024', 'dhivyavk - Differentiate single and multiple user session and failures for coauth' */
34
+ );
35
+ }
36
+ exports.isDifferentiateMultiUserSessionFailureKSActive = isDifferentiateMultiUserSessionFailureKSActive;
37
+ // cross-projects
38
+ function isLogLegacyInCustomerPromiseKSActive() {
39
+ return sp_core_library_1._SPKillSwitch.isActivated('a49471f3-bb8b-40e2-a3f1-a8dfac9529cb'
40
+ /* '08/22/2024', 'liaye - Logging legacy code in CP' */
41
+ );
42
+ }
43
+ exports.isLogLegacyInCustomerPromiseKSActive = isLogLegacyInCustomerPromiseKSActive;
30
44
  //# sourceMappingURL=Killswitches.js.map
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DisplayApp = void 0;
4
- var DisplayApp;
5
- (function (DisplayApp) {
6
- DisplayApp["Sharepoint"] = "Sharepoint";
7
- DisplayApp["Teams"] = "Teams";
8
- })(DisplayApp = exports.DisplayApp || (exports.DisplayApp = {}));
4
+ // eslint-disable-next-line @typescript-eslint/typedef
5
+ exports.DisplayApp = {
6
+ Sharepoint: 'Sharepoint',
7
+ Teams: 'Teams'
8
+ };
9
9
  //# sourceMappingURL=DisplayApp.js.map
@@ -15,5 +15,5 @@ var PageType;
15
15
  PageType["Home"] = "Home";
16
16
  PageType["Space"] = "Space";
17
17
  PageType["NewsDigest"] = "NewsDigest";
18
- })(PageType = exports.PageType || (exports.PageType = {}));
18
+ })(PageType || (exports.PageType = PageType = {}));
19
19
  //# sourceMappingURL=PageType.js.map
@@ -16,5 +16,5 @@ var PromotedState;
16
16
  * News post (a page with special notifications sent out upon publishing)
17
17
  */
18
18
  PromotedState[PromotedState["Promoted"] = 2] = "Promoted";
19
- })(PromotedState = exports.PromotedState || (exports.PromotedState = {}));
19
+ })(PromotedState || (exports.PromotedState = PromotedState = {}));
20
20
  //# sourceMappingURL=PromotedState.js.map
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebTemplateId = void 0;
4
4
  // One place to find the list is at
5
5
  // https://onedrive.visualstudio.com/SPIN/_git/FFTScripts?path=%2Fsrc%2FCreateDBScripts%2FFFTDashboard-WebTemplateNames.sql&version=GBmaster
6
- var WebTemplateId;
7
- (function (WebTemplateId) {
8
- WebTemplateId["TeamSite"] = "1";
9
- WebTemplateId["MySite"] = "21";
10
- WebTemplateId["GroupSite"] = "64";
11
- WebTemplateId["SitePagePublishing"] = "68";
12
- })(WebTemplateId = exports.WebTemplateId || (exports.WebTemplateId = {}));
6
+ // eslint-disable-next-line @typescript-eslint/typedef
7
+ exports.WebTemplateId = {
8
+ TeamSite: '1',
9
+ MySite: '21',
10
+ GroupSite: '64',
11
+ SitePagePublishing: '68'
12
+ };
13
13
  //# sourceMappingURL=WebTemplateId.js.map
@@ -6,7 +6,6 @@ var DisplayApp_1 = require("./DisplayApp");
6
6
  var WebTemplateId_1 = require("./WebTemplateId");
7
7
  var PromotedState_1 = require("./PromotedState");
8
8
  var PageType_1 = require("./PageType");
9
- var Killswitches_1 = require("../common/Killswitches");
10
9
  function setPageExtraData(contextInfo, extraData) {
11
10
  extraData.pageId = contextInfo.pageId;
12
11
  extraData.isHub = contextInfo.isHubSite;
@@ -61,9 +60,7 @@ function setPageExtraData(contextInfo, extraData) {
61
60
  }
62
61
  extraData.siteType = siteType;
63
62
  extraData.pageType = pageType;
64
- if (!(0, Killswitches_1.isAddingDebugFlagToEngagementExtraDataKSActive)()) {
65
- extraData.isDebug = !!sp_core_library_1._BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
66
- }
63
+ extraData.isDebug = !!sp_core_library_1._BrowserUtilities.safelyAccessSessionStorage('spfx-debug');
67
64
  }
68
65
  exports.setPageExtraData = setPageExtraData;
69
66
  //# sourceMappingURL=setPageExtraData.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/sp-diagnostics",
3
- "version": "1.19.0",
3
+ "version": "1.20.0-rc.0",
4
4
  "description": "Diagnostics tools for the SharePoint Framework",
5
5
  "license": "https://aka.ms/spfx/license",
6
6
  "homepage": "http://aka.ms/spfx",
@@ -8,14 +8,15 @@
8
8
  "module": "lib/index.js",
9
9
  "typings": "dist/index-internal.d.ts",
10
10
  "devDependencies": {
11
- "@rushstack/heft": "0.66.0",
12
- "eslint": "8.7.0",
11
+ "@rushstack/heft": "0.67.0",
12
+ "eslint": "8.57.0",
13
13
  "tslib": "2.3.1",
14
+ "@ms/odsp-core-bundle": "1.4.195",
14
15
  "@ms/spfx-internal-web-build-rig": "0.1.0"
15
16
  },
16
17
  "dependencies": {
17
- "@microsoft/sp-lodash-subset": "1.19.0",
18
- "@microsoft/sp-core-library": "1.19.0"
18
+ "@microsoft/sp-core-library": "1.20.0-rc.0",
19
+ "@microsoft/sp-lodash-subset": "1.20.0-rc.0"
19
20
  },
20
21
  "engines": {
21
22
  "node": ">=18.17.1 <19.0.0"
@@ -1 +0,0 @@
1
- define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.19.0",["@microsoft/sp-core-library","@microsoft/sp-lodash-subset","tslib"],(e,t,n)=>(()=>{"use strict";var a={878:t=>{t.exports=e},348:e=>{e.exports=t},553:e=>{e.exports=n}},i={};function r(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return a[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{_AutoAlertableMonitorType:()=>k,_AutoAlertableQosMonitor:()=>M,_CircularBuffer:()=>i,_Diagnostics:()=>g,_EngagementLogger:()=>I,_ExecutionQueue:()=>O,_LogEntry:()=>_,_LogEvent:()=>c,_LogFeature:()=>f,_LogHandler:()=>x,_LogLevel:()=>d,_LogManager:()=>s,_LogSource:()=>n,_LogType:()=>m,_PageType:()=>y,_PromotedState:()=>v,_QosLogger:()=>w,_QosMonitor:()=>A,_QosMonitorShareFailureWithCP:()=>P,_QosResultType:()=>C,_TraceLogger:()=>u,_logSourceServiceKey:()=>a});var e=r(878),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}(),s=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 s,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 s,t._verboseLogManager=new s,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=r(348);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()},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._isInitialized=!1,t}();var v,y,S,D;!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={})),function(e){e.Sharepoint="Sharepoint",e.Teams="Teams"}(S||(S={})),function(e){e.TeamSite="1",e.MySite="21",e.GroupSite="64",e.SitePagePublishing="68"}(D||(D={}));const I=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=S.Teams,t.isEduClass&&(n.isEduClass=!0)):n.displayApp=S.Sharepoint),n.userAgent=navigator.userAgent;var a,i=t.webTemplate;n.webTemplate=i,i===D.TeamSite?a="TeamSite":i===D.GroupSite?a="GroupSite":i===D.SitePagePublishing?a="CommunicationSite":i===D.MySite&&(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,e._SPKillSwitch.isActivated("76672562-f587-4362-a7ad-a1b397102c9a")||(n.isDebug=!!e._BrowserUtilities.safelyAccessSessionStorage("spfx-debug"))}(n,t.extraData))}},t._logManager=new s,t}(),x=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 C={Success:0,Failure:1,ExpectedFailure:2};const O=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}(),w=function(){function e(){this._qosEvents=new Map,this._deferExecutor=new O,this._shouldProcessInRealTime=!1,this._initializeLogger()}return Object.defineProperty(e,"instance",{get:function(){return this._instance||(this._instance=new e),this._instance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shouldProcessInRealTime",{get:function(){return this._shouldProcessInRealTime},set:function(e){this._shouldProcessInRealTime=e,this._deferExecutor.shouldExecuteInRealTime=e},enumerable:!1,configurable:!0}),e.prototype.setLogger=function(e){this._qosLogger=e},e.prototype.getQosEvent=function(e){return this._qosEvents.get(e)},e.prototype.startQosMonitor=function(e,t){this._qosEvents.has(e)||this._deferExecutor.addExecutionEntry("start",e,t)},e.prototype.writeQosEndResult=function(e,t){this._deferExecutor.addExecutionEntry("end",e,t)},e.prototype._startMonitor=function(e,t){this._qosLogger&&this._qosEvents.set(e,new this._qosLogger(t))},e.prototype._endMonitor=function(e,t){var n=this._qosEvents.get(e);n&&(n.end(t),this._qosEvents.delete(e))},e.prototype._initializeLogger=function(){var e=this;this._deferExecutor.addHandler("start",function(t,n){e._startMonitor(t,n)}),this._deferExecutor.addHandler("end",function(t,n){e._endMonitor(t,n)})},e}();var E={id:"QosMonitor"};const A=function(){function t(t,n,a){var i;void 0===n&&(n=!1),void 0===a&&(a=!1);var r=this;this._qosResultTypeValue=((i={})[C.Success]="Success",i[C.Failure]="Failure",i[C.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)}},e.Validate.isNonemptyString(t,"scenarioName"),this._id=e.Guid.newGuid().toString(),this._isDebugSession()||w.instance.startQosMonitor(this._id,{name:t}),this._scenarioName=t,this._hasEnded=!1,this._copyToCosmos=n,this._copyToInterana=a}return t.startRealTimeProcessing=function(){w.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)},t._shouldProcessInRealTime=function(e){w.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(C.Success,void 0,void 0,e)},t.prototype.writeUnexpectedFailure=function(e,t,n){void 0===e&&(e="DefaultUnexpected"),this._writeQosEnd(C.Failure,e,t,n)},t.prototype.writeExpectedFailure=function(e,t,n){void 0===e&&(e="DefaultExpected"),this._writeQosEnd(C.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={resultCode:this._endResultCode,resultType:this._endResult,error:n?n.message:void 0,extraData:this._endExtraData};w.instance.writeQosEndResult(this._id,i),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!==C.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(){var t;if(b.isInitialized){var n=void 0;if(e._SPKillSwitch.isActivated("337aabd0-f050-467c-9728-dff6b2562cb0")){var a=!e._SPKillSwitch.isActivated("134e389a-67d1-4cf2-8516-d592c1079276")&&e._BrowserUtilities.isMEEBridgeApplicationHosted();if(a||e._BrowserUtilities.isTeamsHosted()){a?n="MEEBridge":e._BrowserUtilities.isViva1PHosted()?n="Viva1p":(null===(t=b.settings.contextInfo)||void 0===t?void 0:t.isEduClass)&&(n="ClassHome");var i=e._BrowserUtilities.isTeamsBrowserHosted()?"TeamsWeb":"TeamsNative";n=n?"".concat(n,"_").concat(i):i}}else n=e._BrowserUtilities.getTeamsAppType();if(n){this._ensureEndExtraData();var r="appHostType";this._endExtraData[r]||(this._endExtraData[r]=n)}}},t.prototype._isDebugSession=function(){return!!e._BrowserUtilities.safelyAccessSessionStorage("spfx-debug")},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(E,new Error(n)),!0}return this._hasEnded=!0,this._isDebugSession()},t.prototype._writeToEngagement=function(){if(this._copyToInterana&&I.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),I.log(e)}},t}();var L=r(553),k={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4",DynamicReliabilityExpectedFailureHighSev4:"DynamicReliabilityExpectedFailureHighSev4"},M=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,L.__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=k[this._autoAlertableMonitorType],t},t}(A),P=function(t){function n(e,n,a){void 0===n&&(n=!1);var i=t.call(this,e,!1,n)||this;return i._extraDataForCustomerPromise=a,i}return(0,L.__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,C.Failure,a)},n.prototype.writeExpectedFailure=function(n,a,i,r){void 0===n&&(n="DefaultExpected"),void 0===r&&(r=!1),t.prototype.writeExpectedFailure.call(this,n,a,i),!e._SPKillSwitch.isActivated("874c8d5e-155b-4d4a-a163-f4a4402438ce")&&r||this._logCustomerPromiseFailure((null==a?void 0:a.message)||"DefaultErrorMessage",n,C.ExpectedFailure,i)},n.prototype._logCustomerPromiseFailure=function(e,t,n,a){void 0===n&&(n=C.Failure),this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(function(i){var r=i.errorModuleName,o=i.logFailure,s=i.veto;o({errorCode:r,errorScenario:t,errorMessage:e,resultType:n,pageType:null==a?void 0:a.pageType,errorStack:null==a?void 0:a.errorStack,veto:s})})},n}(A)})(),o})());