@microsoft/sp-diagnostics 1.24.0-beta.2 → 1.24.0-beta.3
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/index-internal-beta.d.ts +2 -0
- package/dist/index-internal-public.d.ts +2 -0
- package/dist/index-internal.d.ts +2 -0
- package/dist/sp-diagnostics_none_ebdbca9bc199b51d4466.js +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-commonjs/Diagnostics.js +11 -0
- package/lib-commonjs/DiagnosticsSettingsManager.js +11 -0
- package/lib-dts/Diagnostics.d.ts +11 -0
- package/lib-dts/DiagnosticsSettingsManager.d.ts +4 -0
- package/lib-esm/Diagnostics.js +11 -0
- package/lib-esm/DiagnosticsSettingsManager.js +11 -0
- package/package.json +6 -6
- package/dist/sp-diagnostics_none_1b5b73722b91f3231f63.js +0 -1
|
@@ -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_ebdbca9bc199b51d4466.js",
|
|
17
|
+
"integrity": "sha256-4ad0mVlKDRMvVb77h7yrCepcuYY61DtO+culXrGkq+w="
|
|
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.5.
|
|
33
|
+
"version": "1.5.212"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -170,6 +170,7 @@ declare const ObjectTypes: {
|
|
|
170
170
|
readonly listData: 1;
|
|
171
171
|
readonly itemAction: 1;
|
|
172
172
|
readonly sharing: 1;
|
|
173
|
+
readonly substrate: 1;
|
|
173
174
|
readonly prefetch: 1;
|
|
174
175
|
readonly auth: 1;
|
|
175
176
|
readonly search: 1;
|
|
@@ -218,6 +219,7 @@ declare const ObjectTypes: {
|
|
|
218
219
|
readonly outOfBox: 1;
|
|
219
220
|
readonly Links: 1;
|
|
220
221
|
readonly FromALink: 1;
|
|
222
|
+
readonly Media: 1;
|
|
221
223
|
readonly 'Sharing.getAuthToken': 1;
|
|
222
224
|
readonly Computed: 1;
|
|
223
225
|
readonly LinkTitle: 1;
|
|
@@ -170,6 +170,7 @@ declare const ObjectTypes: {
|
|
|
170
170
|
readonly listData: 1;
|
|
171
171
|
readonly itemAction: 1;
|
|
172
172
|
readonly sharing: 1;
|
|
173
|
+
readonly substrate: 1;
|
|
173
174
|
readonly prefetch: 1;
|
|
174
175
|
readonly auth: 1;
|
|
175
176
|
readonly search: 1;
|
|
@@ -218,6 +219,7 @@ declare const ObjectTypes: {
|
|
|
218
219
|
readonly outOfBox: 1;
|
|
219
220
|
readonly Links: 1;
|
|
220
221
|
readonly FromALink: 1;
|
|
222
|
+
readonly Media: 1;
|
|
221
223
|
readonly 'Sharing.getAuthToken': 1;
|
|
222
224
|
readonly Computed: 1;
|
|
223
225
|
readonly LinkTitle: 1;
|
package/dist/index-internal.d.ts
CHANGED
|
@@ -170,6 +170,7 @@ declare const ObjectTypes: {
|
|
|
170
170
|
readonly listData: 1;
|
|
171
171
|
readonly itemAction: 1;
|
|
172
172
|
readonly sharing: 1;
|
|
173
|
+
readonly substrate: 1;
|
|
173
174
|
readonly prefetch: 1;
|
|
174
175
|
readonly auth: 1;
|
|
175
176
|
readonly search: 1;
|
|
@@ -218,6 +219,7 @@ declare const ObjectTypes: {
|
|
|
218
219
|
readonly outOfBox: 1;
|
|
219
220
|
readonly Links: 1;
|
|
220
221
|
readonly FromALink: 1;
|
|
222
|
+
readonly Media: 1;
|
|
221
223
|
readonly 'Sharing.getAuthToken': 1;
|
|
222
224
|
readonly Computed: 1;
|
|
223
225
|
readonly LinkTitle: 1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.24.0",["@microsoft/sp-core-library","@microsoft/sp-lodash-subset","@msinternal/odsp-core-bundle"],(a,b,c)=>(()=>{"use strict";var d={676(b){b.exports=a},529(a){a.exports=b},277(a){a.exports=c}},e={};function f(a){var b=e[a];if(void 0!==b)return b.exports;var c=e[a]={exports:{}};return d[a](c,c.exports,f),c.exports}f.d=(a,b)=>{for(var c in b)f.o(b,c)&&!f.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:b[c]})},f.o=(a,b)=>Object.prototype.hasOwnProperty.call(a,b),f.r=a=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var g={};return(()=>{f.r(g),f.d(g,{_AutoAlertableMonitorType:()=>F,_AutoAlertableQosMonitor:()=>G,_CircularBuffer:()=>n,_Diagnostics:()=>w,_EngagementLogger:()=>x,_ExecutionQueue:()=>B,_LogEntry:()=>t,_LogEvent:()=>p,_LogFeature:()=>r,_LogHandler:()=>y,_LogLevel:()=>e,_LogManager:()=>o,_LogSource:()=>l,_LogType:()=>s,_PageType:()=>j,_PromotedState:()=>i,_QosLogger:()=>C,_QosMonitor:()=>E,_QosMonitorShareFailureWithCP:()=>H,_QosResultType:()=>A,_TraceLogger:()=>q,_logSourceServiceKey:()=>m});var a,b,c,d,e,h,i,j,k=f(676);class l{static create(a){return new l(a)}get id(){return this._id}isEmpty(){return 0===this._id.length}constructor(a){k.Validate.isNotNullOrUndefined(a,"id"),this._id=a}}let m=k.ServiceKey.createCustom("sp-client-base:LogSource",a=>l.create(""));class n{get count(){return this._count}push(a){this._ensureNotIterating(),this._head++,this._count++,this._head===this._size&&(this._head=0),this._buffer[this._head]=a}forEach(a){if(0!==this._count){this._isIterating=!0;try{let b=this._tail;for(let c=0;c<this._size&&(a(this._buffer[b]),b!==this._head);c++)b=this._getNext(b)}finally{this._isIterating=!1}}}removeAll(){this._ensureNotIterating(),this._head=-1,this._count=0}get _tail(){return this._isNotWrapped()?0:this._getNext(this._head)}_isNotWrapped(){return this._count===this._head+1}_getNext(a){let b=a+1;return b===this._size&&(b=0),b}_ensureNotIterating(){if(this._isIterating)throw Error("Circular buffer cannot be modified during iteration")}constructor(a){if(this._head=-1,this._count=0,this._isIterating=!1,a<=0)throw Error("Size must be positive");this._size=a,this._buffer=Array(a)}}class o{static get _maxVerboseLog(){return 5e3}get events(){return this._events}addHandler(a){this._containsHandler(a)||(this._handlers.push(a),this._shouldLogInRealTime.push(!1))}log(a){Object.freeze(a),this._events.push(a),this._processLogEvent(a)}removeHandler(a){let b=this._handlers.indexOf(a);b>-1&&(this._handlers.splice(b,1),this._shouldLogInRealTime.splice(b,1))}reset(){this._handlers=[],this._shouldLogInRealTime=[],this._events.removeAll()}processAll(a){this._handlers.indexOf(a)>-1&&this._processAllEvents(a)}_containsHandler(a){for(let b of this._handlers)if(b===a)return!0;return!1}_processAllEvents(a){this._events.forEach(b=>{if(b)try{a(b)}catch(a){console.error("failed to handle event:"+a.toString())}}),this._shouldLogInRealTime[this._handlers.indexOf(a)]=!0}_processLogEvent(a){for(let b=0;b<this._handlers.length;b++)if(this._shouldLogInRealTime[b]&&a)try{this._handlers[b](a)}catch(a){console.error("failed to handle event:"+a.toString())}}constructor(a){this._shouldLogInRealTime=[],this._handlers=[],this._events=new n(o._maxVerboseLog),a&&this.addHandler(a)}}class p{static log(a,b,c,d){let e=new p(a,b,c,d);return p.logManager.log(e),e}toString(){let a=`[${this._timestamp}][${this._prefix}]`;return this._message?`${a} ${this._message}`:this._error?`${a} ${this._error.toString()}`:a}get timestamp(){return this._timestamp}get level(){return this._level}get prefix(){return this._prefix}get scope(){return this._scope}get source(){return this._source}get message(){return this._message}get error(){return this._error}get _maxSourceLength(){return 30}get _maxMessageLength(){return 150}_validate(a,b){if(!a)throw Error("source cannot be undefined or null for Logger");if(!b)throw Error("data cannot be undefined or null")}_setData(a){"string"==typeof a?this._message=a.substr(0,this._maxMessageLength):a instanceof Error&&(this._error=a)}_getPrefix(){let a=`${this._source}`;return this._scope&&!this._scope.isEmpty()&&(a=`${this._scope.id.substr(0,this._maxSourceLength)}.${a}`),`${a}`}_getScope(a){let b;return a&&a.whenFinished(()=>{b=a.consume(m)}),b}constructor(a,b,c,d){this._validate(a,b),this._timestamp=new Date().getTime(),this._scope=this._getScope(d),this._source=a.substr(0,this._maxSourceLength),this._setData(b),this._level=c,this._prefix=this._getPrefix()}}p.logManager=new o,(a=e||(e={}))[a.Verbose=1]="Verbose",a[a.Info=2]="Info",a[a.Warning=3]="Warning",a[a.Error=4]="Error";class q{static _addHandler(a){q._logManager.addHandler(a.log),q._logManager.processAll(a.log),q._verboseLogManager.addHandler(a.verbose),q._verboseLogManager.processAll(a.verbose)}static logError(a,b,c,d){k.Validate.isNotNullOrUndefined(b,"error"),this._log(a,b,c,!0,d)}static logErrorData(a){k.Validate.isNotNullOrUndefined(a.error,"error");let b=a.logEntry?a.logEntry.toString():a.error;this._log(a.source,b,a.eventName,!0,a.resultCode,a.serviceScope)}static logVerbose(a,b,c){k.Validate.isNonemptyString(b,"message"),this._log(a,b,c,!1,void 0)}static logVerboseData(a){let b=a.logEntry?a.logEntry.toString():a.message;this._log(a.source,b,a.eventName,!1,void 0,a.serviceScope)}static logErrorWithLogEntry(a,b,c,d){k.Validate.isNotNullOrUndefined(a,"source"),k.Validate.isNotNullOrUndefined(b,"logEntry"),this._log(a,b.toString(),c,!0,d)}static get shouldWriteToConsole(){return q._shouldWriteToConsole}static set shouldWriteToConsole(a){q._shouldWriteToConsole&&!a?(q._logManager.removeHandler(q._defaultLogger.log),q._verboseLogManager.removeHandler(q._defaultLogger.verbose)):!q._shouldWriteToConsole&&a&&(q._logManager.addHandler(q._defaultLogger.log),q._verboseLogManager.addHandler(q._defaultLogger.verbose)),q._shouldWriteToConsole=a}static logVerboseWithLogEntry(a,b,c){k.Validate.isNotNullOrUndefined(b,"LogEntry"),this._log(a,b.toString(),c,!1,void 0)}static _log(a,b,c,d,f,g){let h,i=this._addEventPrefix(a,c);d?(h=p.log(i,b,e.Error,g),q._logManager.log({data:b,eventName:h.prefix,resultCode:f})):(h=p.log(i,b.toString(),e.Verbose,g),q._verboseLogManager.log({data:b,eventName:h.prefix})),q.shouldWriteToConsole&&this._writeToConsole(h,d,f)}static _addEventPrefix(a,b){return b?`${a.id}.${b}`:a.id}static _writeToConsole(a,b,c){let d=a.toString();c&&(d+=`. resultCode: ${c}`),b?console.error(d):console.log(d)}}q._logManager=new o,q._verboseLogManager=new o,q._defaultLogger=new class{log(a){console.log(`Error: ${a.data}, Event Name: ${a.eventName}, Result Code: ${a.resultCode}`)}verbose(a){console.log(`Error: ${a.data}, Event Name: ${a.eventName}`)}},q._shouldWriteToConsole=!1;class r{}r.None="None",(b=h||(h={}))[b.Trace=1]="Trace",b[b.Event=2]="Event",b[b.Error=3]="Error";let s=h,t=class{toString(){let a;if(this.logProperties)try{a=JSON.stringify(this.logProperties)}catch(a){console.log("Error happens in toString():"+a)}return`${this.moduleName} | ${this.logFeature} | ${this.logType} | ${a}`}constructor(a,b=r.None,c=s.Trace,d,e){if(a)this.moduleName=a,this.logFeature=b,this.logType=c,this.logProperties=d,this.isIntentional=e;else throw Error("moduleName is invalid")}};var u=f(529);class v{static initialize(a){this.settings=(0,u.cloneDeep)(a),this._initialized=!0,this._normalizeContextIds()}static updateSettings(a){this.settings=(0,u.merge)(this.settings,a),this._normalizeContextIds()}static updatePageId(a){this.settings.contextInfo&&(this.settings.contextInfo.pageId=this._normalizeId(a))}static updatePageType(a,b){this.settings.contextInfo&&(this.settings.contextInfo.pageType=a,this.settings.contextInfo.promotedState=b)}static clearSettings(a){a.diagnosticSettings&&a.diagnosticSettings.forEach(a=>{delete this.settings[a]}),a.extraDiagnosticInfo&&a.extraDiagnosticInfo.forEach(a=>{this.settings.extraDiagnosticInfo&&this.settings.extraDiagnosticInfo[a]&&delete this.settings.extraDiagnosticInfo[a]})}static get isInitialized(){return this._initialized}static _normalizeId(a){let b=k.Guid.tryParse(a);return b?.toString()||a}static _normalizeContextIds(){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)))}}v._initialized=!1;class w{static initialize(a){w._isInitialized||(v.initialize(a),q.shouldWriteToConsole=a.enableConsoleLog,q._addHandler({log:a=>{k.Log.info(a.eventName,`EventName:${a.data.toString()}, ResultCode: ${a.resultCode}`)},verbose:a=>{k.Log.verbose(a.eventName,a.data.toString())}}),w._isInitialized=!0)}static get isInitialized(){return this._isInitialized}static updateSettings(a){v.updateSettings(a)}static updatePageId(a){v.updatePageId(a)}static updatePageType(a,b){v.updatePageType(a,b)}static getAuthoringSessionClientCountInfo(){return v.settings?.extraDiagnosticInfo?.authoringSessionClientCount}static _getExtraDiagnosticInfo(){return v.settings?.extraDiagnosticInfo}static clearSettings(a){v.clearSettings(a)}}w._isInitialized=!1,(c=i||(i={}))[c.NotPromoted=0]="NotPromoted",c[c.Promoted=2]="Promoted",(d=j||(j={})).News="News",d.Article="Article",d.Home="Home",d.Space="Space",d.NewsDigest="NewsDigest";class x{static _addHandler(a){x._handler=b=>{a.logData(b)},x._logManager.addHandler(x._handler)}static startRealTimeProcessing(){this._shouldProcessInRealTime||(x._logManager.processAll(x._handler),this._shouldProcessInRealTime=!0)}static log(a){x._logEngagementData(a)}static logEvent(a,b){let c={name:a};b&&0!==b.length&&(c.extraData={action:b}),x._logEngagementData(c)}static logEventWithLogEntry(a){let b={isIntentional:a.isIntentional,name:a.moduleName+"."+a.logFeature,extraData:a.logProperties};x._logEngagementData(b,!0)}static _logEngagementData(a,b=!1){if(!a.name||0===a.name.length)throw Error("LogEntry is invalid");x._checkValidTagName(a,b),x._addContextData(a),x._appendExtraData(a),x._logManager.log(a)}static _checkValidTagName(a,b=!1){if(!b&&!1===/(\w+)\.(\w+).(\w+)/gi.test(a.name))throw Error(`${a.name} tagName does not follow AppName.ControlName.ActionName pattern`)}static _addContextData(a){if(v.isInitialized){let{listId:b,listItemUniqueId:c,siteId:d,webId:e}=v.settings;a.siteId=d,a.webId=e,b&&(a.listId=b,c&&(a.docId=c))}}static _appendExtraData(a){if(v.isInitialized){let{settings:{contextInfo:c}}=v;if(c){var b;let d,e,f,g,h;a.extraData||(a.extraData={}),(b=a.extraData).pageId=c.pageId,b.isHub=c.isHubSite,c.isHubSite?(b.hubSiteId=c.hubSiteId,b.isAssociatedSite=!1):!c.isHubSite&&c.hubSiteId?b.isAssociatedSite=!0:b.isAssociatedSite=!1,!b.displayApp&&(k._BrowserUtilities.isTeamsHosted()?(b.displayApp="Teams",c.isEduClass&&(b.isEduClass=!0)):b.displayApp="Sharepoint"),b.userAgent=navigator.userAgent,b.webTemplate=e=c.webTemplate,"1"===e?d="TeamSite":"64"===e?d="GroupSite":"68"===e?d="CommunicationSite":"21"===e&&(d="MySite"),f=c.promotedState,h=g=c.pageType,g===j.Article&&(h=f===i.NotPromoted||void 0===f?j.Article:j.News),b.siteType=d,b.pageType=h,b.isDebug=!!k._BrowserUtilities.safelyAccessSessionStorage("spfx-debug"),b.hasCopilotLicense=!!c.hasCopilotLicense}}}}x._logManager=new o;class y{verbose(a,b,c){p.log(a,b,e.Verbose,c)}info(a,b,c){p.log(a,b,e.Info,c)}warn(a,b,c){p.log(a,b,e.Warning,c)}error(a,b,c){p.log(a,b,e.Error,c)}}var z=f(277);let A={Success:0,Failure:1,ExpectedFailure:2};class B{get shouldExecuteInRealTime(){return this._shouldExecuteInRealTime}set shouldExecuteInRealTime(a){this._shouldExecuteInRealTime=a,this._shouldExecuteInRealTime&&this.flush()}addHandler(a,b){if(this._containsHandler(a,b))return;this._initializeHandlerArrayForKey(a);let c=this._handlers[a];-1===c.indexOf(b)&&c.push(b)}addExecutionEntry(a,...b){Object.freeze(b),this._shouldExecuteInRealTime?this._processExecutionEntry(a,b):this._executionEntries.push({key:a,args:b})}removeHandler(a,b){let c=this._handlers[a].indexOf(b);c>-1&&this._handlers[a].splice(c,1)}reset(){this._handlers={},this._executionEntries=[]}flush(){this._processAllExecutionEntries(),this._executionEntries=[]}_containsHandler(a,b){return null!==this._handlers[a]&&void 0!==this._handlers[a]&&this._handlers[a].indexOf(b)>-1}_initializeHandlerArrayForKey(a){(null===this._handlers[a]||void 0===this._handlers[a])&&(this._handlers[a]=[])}_processAllExecutionEntries(){for(let a of this._executionEntries)if(a&&this._handlers[a.key])try{for(let b of this._handlers[a.key])b.apply(this,a.args)}catch(a){console.error("failed to process execution entry:"+a.toString())}}_processExecutionEntry(a,b){for(let c=0;c<this._handlers[a].length;c++)try{this._handlers[a][c].apply(this,b)}catch(a){console.error("failed to process execution entry:"+a.toString())}}constructor(){this._shouldExecuteInRealTime=!1,this._handlers={},this._executionEntries=[]}}class C{static get instance(){return this._instance||(this._instance=new C),this._instance}get shouldProcessInRealTime(){return this._shouldProcessInRealTime}set shouldProcessInRealTime(a){this._shouldProcessInRealTime=a,this._deferExecutor.shouldExecuteInRealTime=a}setLogger(a){this._qosLogger=a}getQosEvent(a){return this._qosEvents.get(a)}startQosMonitor(a,b){this._qosEvents.has(a)||this._deferExecutor.addExecutionEntry("start",a,b)}writeQosEndResult(a,b){this._deferExecutor.addExecutionEntry("end",a,b)}_startMonitor(a,b){this._qosLogger&&this._qosEvents.set(a,new this._qosLogger(b))}_endMonitor(a,b){let c=this._qosEvents.get(a);c&&(c.end(b),this._qosEvents.delete(a))}_initializeLogger(){let a=(a,b)=>{this._startMonitor(a,b)},b=(a,b)=>{this._endMonitor(a,b)};this._deferExecutor.addHandler("start",a),this._deferExecutor.addHandler("end",b)}constructor(){this._qosEvents=new Map,this._deferExecutor=new B,this._shouldProcessInRealTime=!1,this._initializeLogger()}}let D={id:"QosMonitor"};class E{static startRealTimeProcessing(){C.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)}static _shouldProcessInRealTime(a){C.instance.shouldProcessInRealTime=a}get name(){return this._scenarioName}get shortEventName(){return"Qos"}get resultCode(){return this._endResultCode}get resultType(){return this._endResult}get extraData(){return this._endExtraData}set extraData(a){this._endExtraData=a}get hasEnded(){return this._hasEnded}writeSuccess(a){this._writeQosEnd(A.Success,void 0,void 0,a)}writeUnexpectedFailure(a="DefaultUnexpected",b,c){this._writeQosEnd(A.Failure,a,b,c)}writeExpectedFailure(a="DefaultExpected",b,c){this._writeQosEnd(A.ExpectedFailure,a,b,c)}_writeQosEnd(a,b,c,d){if(this._shouldSkip(a))return;this._ensureCorrelationId(a,d),this._endResultCode=b,this._endResult=a;let e=c?(0,z.getErrorMessage)(c):void 0;if(c instanceof z.CustomError){let a=(0,z.getQosEndSchemaFromError)(c);a&&(a.resultType=this._endResult,a.extraData=(0,u.merge)({},this._endExtraData,a.extraData)),C.instance.writeQosEndResult(this._id,a)}else{let a={resultCode:this._endResultCode,resultType:this._endResult,error:e,extraData:this._endExtraData};C.instance.writeQosEndResult(this._id,a)}this._writeToEngagement()}_ensureCorrelationId(a,b){if(b&&(this._ensureEndExtraData(),Object.keys(b).forEach(a=>this._endExtraData[a]=b[a])),v.isInitialized&&a!==A.Success){let a="CorrelationId",b=this._endExtraData&&(this._endExtraData[a]||this._endExtraData.correlationId)||v.settings.correlationId;b&&(this._endExtraData||(this._endExtraData={}),this._endExtraData[a]=b)}this._logHostType(),this._ensureAuthoringSessionId()}_ensureEndExtraData(){this._endExtraData||(this._endExtraData={})}_logHostType(){if(v.isInitialized){let a=k._BrowserUtilities.getTeamsAppType();if(a){this._ensureEndExtraData();let b="appHostType";this._endExtraData[b]||(this._endExtraData[b]=a)}}}_isDebugSession(){try{if(!k._SPKillSwitch.isActivated("761ccb86-4fa0-4f56-a05b-477bcc09bd9f"))return!1;return!!k._BrowserUtilities.safelyAccessSessionStorage("spfx-debug")}catch{return!1}}_shouldSkip(a){if(!this._hasEnded||void 0===this._endResult)return this._hasEnded=!0,this._isDebugSession();{let b=k.Text.format("QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",this.name,this._qosResultTypeValue[this._endResult],this._qosResultTypeValue[a]);return this._endResult!==a&&q.logError(D,Error(b)),!0}}_writeToEngagement(){if(this._copyToInterana&&x.log({name:this.name,isIntentional:!!(this.extraData||{}).isIntentional,extraData:this.extraData||{}}),this._copyToCosmos){let a={name:"Spfx.Qos.ToEngagement",extraData:this.extraData||{}};a.extraData.qosName=this.name,this.resultType&&(a.extraData.qosResultType=this._qosResultTypeValue[this.resultType]),this.resultCode&&(a.extraData.qosResultCode=this.resultCode),x.log(a)}}constructor(a,b=!1,c=!1){this._qosResultTypeValue={[A.Success]:"Success",[A.Failure]:"Failure",[A.ExpectedFailure]:"ExpectedFailure"},this._ensureAuthoringSessionId=()=>{let a=v.settings?.extraDiagnosticInfo?.authoringSessionId;if(a){this._ensureEndExtraData(),this._endExtraData.AuthoringSessionId=a;let b=v.settings?.extraDiagnosticInfo?.authoringOpSequenceId;b&&(this._endExtraData.AuthoringOpSequenceId=b);let c=w.getAuthoringSessionClientCountInfo();c&&this._endExtraData&&(this._endExtraData.AuthoringSessionClientCount=c)}},k.Validate.isNonemptyString(a,"scenarioName"),this._id=k.Guid.newGuid().toString(),this._isDebugSession()||C.instance.startQosMonitor(this._id,{name:a}),this._scenarioName=a,this._hasEnded=!1,this._copyToCosmos=b,this._copyToInterana=c}}let F={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4",DynamicReliabilityExpectedFailureHighSev4:"DynamicReliabilityExpectedFailureHighSev4"};class G extends E{writeSuccess(a){super.writeSuccess(this._getExtraDataWithAutoAlertableFields(a))}writeUnexpectedFailure(a="DefaultUnexpected",b,c){super.writeUnexpectedFailure(a,b,this._getExtraDataWithAutoAlertableFields(c))}writeExpectedFailure(a="DefaultExpected",b,c){super.writeExpectedFailure(a,b,this._getExtraDataWithAutoAlertableFields(c))}_getExtraDataWithAutoAlertableFields(a){let b=a??{};return b.autoAlertableMonitorType=F[this._autoAlertableMonitorType],b}constructor(a,b,c=!1){super(a,!1,c),this._autoAlertableMonitorType=b}}class H extends E{writeUnexpectedFailure(a="DefaultUnexpected",b,c){super.writeUnexpectedFailure(a,b,c),this._logCustomerPromiseFailure(b?.message||"DefaultErrorMessage",a,A.Failure,c)}writeExpectedFailure(a="DefaultExpected",b,c,d=!1){super.writeExpectedFailure(a,b,c),d||this._logCustomerPromiseFailure(b?.message||"DefaultErrorMessage",a,A.ExpectedFailure,c)}_logCustomerPromiseFailure(a,b,c=A.Failure,d){this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(e=>{let f,{logFailure:g,veto:h}=e,i={errorCode:e.errorModuleName+((f=w._getExtraDiagnosticInfo())&&f.hasAuthoringStarted?f.authoringSessionClientCount?f.authoringSessionClientCount>1?" with Multiple Users":"":f.isAuthoringUsingDDS?" in Legacy Authoring (DDS)":" in Legacy Authoring (no DDS)":"")+(k._SPKillSwitch.isActivated("c125685f-83e7-44c8-b602-5c21f5b748ae")||window.navigator.onLine?"":" (offline)"),errorScenario:b,errorMessage:a,resultType:c,pageType:d?.pageType,errorStack:d?.errorStack,veto:h};g(i)})}constructor(a,b=!1,c,d=!1){super(a,d,b),this._extraDataForCustomerPromise=c}}})(),g})());
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -43,6 +43,17 @@ class Diagnostics {
|
|
|
43
43
|
_DiagnosticsSettingsManager.default.updateSettings(settings);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
+
* Updates the page ID included with engagement telemetry.
|
|
47
|
+
* @param pageId - The unique ID of the current page.
|
|
48
|
+
*/ static updatePageId(pageId) {
|
|
49
|
+
_DiagnosticsSettingsManager.default.updatePageId(pageId);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Updates the page type information included with engagement telemetry.
|
|
53
|
+
*/ static updatePageType(pageType, promotedState) {
|
|
54
|
+
_DiagnosticsSettingsManager.default.updatePageType(pageType, promotedState);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
46
57
|
* Get the authoring session client count info from the extraDiagnosticsInfo from Diagnostics settings
|
|
47
58
|
* @deprecated - Read from @see getExtraDiagnosticInfo
|
|
48
59
|
* @returns the number of clients in the authoring session
|
|
@@ -20,6 +20,17 @@ class DiagnosticsSettingsManager {
|
|
|
20
20
|
this.settings = (0, _splodashsubset.merge)(this.settings, settings);
|
|
21
21
|
this._normalizeContextIds();
|
|
22
22
|
}
|
|
23
|
+
static updatePageId(pageId) {
|
|
24
|
+
if (this.settings.contextInfo) {
|
|
25
|
+
this.settings.contextInfo.pageId = this._normalizeId(pageId);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
static updatePageType(pageType, promotedState) {
|
|
29
|
+
if (this.settings.contextInfo) {
|
|
30
|
+
this.settings.contextInfo.pageType = pageType;
|
|
31
|
+
this.settings.contextInfo.promotedState = promotedState;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
23
34
|
static clearSettings(settings) {
|
|
24
35
|
if (settings.diagnosticSettings) {
|
|
25
36
|
settings.diagnosticSettings.forEach((setting)=>{
|
package/lib-dts/Diagnostics.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type IDiagnosticsSettings from './IDiagnosticsSettings';
|
|
2
|
+
import type { PageType } from './extraData/PageType';
|
|
3
|
+
import type { PromotedState } from './extraData/PromotedState';
|
|
2
4
|
import type { IClearSettingsOptions, IExtraDiagnosticInfo } from './IDiagnosticsSettings';
|
|
3
5
|
/**
|
|
4
6
|
* Diagnostics class initializes the diagnostics pipeline and connect to backend server.
|
|
@@ -24,6 +26,15 @@ export default class Diagnostics {
|
|
|
24
26
|
* @param settings - the subset of the telemetry settings to be updated
|
|
25
27
|
*/
|
|
26
28
|
static updateSettings(settings: Partial<IDiagnosticsSettings>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Updates the page ID included with engagement telemetry.
|
|
31
|
+
* @param pageId - The unique ID of the current page.
|
|
32
|
+
*/
|
|
33
|
+
static updatePageId(pageId: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Updates the page type information included with engagement telemetry.
|
|
36
|
+
*/
|
|
37
|
+
static updatePageType(pageType: PageType, promotedState: PromotedState | undefined): void;
|
|
27
38
|
/**
|
|
28
39
|
* Get the authoring session client count info from the extraDiagnosticsInfo from Diagnostics settings
|
|
29
40
|
* @deprecated - Read from @see getExtraDiagnosticInfo
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type IDiagnosticsSettings from './IDiagnosticsSettings';
|
|
2
2
|
import type { IClearSettingsOptions } from './IDiagnosticsSettings';
|
|
3
|
+
import type { PageType } from './extraData/PageType';
|
|
4
|
+
import type { PromotedState } from './extraData/PromotedState';
|
|
3
5
|
/**
|
|
4
6
|
* TelemetrySettingsManager stores the configuration for Telemetry passed
|
|
5
7
|
* down by the calling application during bootstrapping.
|
|
@@ -11,6 +13,8 @@ export default class DiagnosticsSettingsManager {
|
|
|
11
13
|
private static _initialized;
|
|
12
14
|
static initialize(settings: IDiagnosticsSettings): void;
|
|
13
15
|
static updateSettings(settings: Partial<IDiagnosticsSettings>): void;
|
|
16
|
+
static updatePageId(pageId: string): void;
|
|
17
|
+
static updatePageType(pageType: PageType, promotedState: PromotedState | undefined): void;
|
|
14
18
|
static clearSettings(settings: IClearSettingsOptions): void;
|
|
15
19
|
static get isInitialized(): boolean;
|
|
16
20
|
private static _normalizeId;
|
package/lib-esm/Diagnostics.js
CHANGED
|
@@ -32,6 +32,17 @@ class Diagnostics {
|
|
|
32
32
|
DiagnosticsSettingsManager.updateSettings(settings);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
+
* Updates the page ID included with engagement telemetry.
|
|
36
|
+
* @param pageId - The unique ID of the current page.
|
|
37
|
+
*/ static updatePageId(pageId) {
|
|
38
|
+
DiagnosticsSettingsManager.updatePageId(pageId);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Updates the page type information included with engagement telemetry.
|
|
42
|
+
*/ static updatePageType(pageType, promotedState) {
|
|
43
|
+
DiagnosticsSettingsManager.updatePageType(pageType, promotedState);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
35
46
|
* Get the authoring session client count info from the extraDiagnosticsInfo from Diagnostics settings
|
|
36
47
|
* @deprecated - Read from @see getExtraDiagnosticInfo
|
|
37
48
|
* @returns the number of clients in the authoring session
|
|
@@ -10,6 +10,17 @@ class DiagnosticsSettingsManager {
|
|
|
10
10
|
this.settings = merge(this.settings, settings);
|
|
11
11
|
this._normalizeContextIds();
|
|
12
12
|
}
|
|
13
|
+
static updatePageId(pageId) {
|
|
14
|
+
if (this.settings.contextInfo) {
|
|
15
|
+
this.settings.contextInfo.pageId = this._normalizeId(pageId);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static updatePageType(pageType, promotedState) {
|
|
19
|
+
if (this.settings.contextInfo) {
|
|
20
|
+
this.settings.contextInfo.pageType = pageType;
|
|
21
|
+
this.settings.contextInfo.promotedState = promotedState;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
13
24
|
static clearSettings(settings) {
|
|
14
25
|
if (settings.diagnosticSettings) {
|
|
15
26
|
settings.diagnosticSettings.forEach((setting)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/sp-diagnostics",
|
|
3
|
-
"version": "1.24.0-beta.
|
|
3
|
+
"version": "1.24.0-beta.3",
|
|
4
4
|
"description": "Diagnostics tools for the SharePoint Framework",
|
|
5
5
|
"homepage": "http://aka.ms/spfx",
|
|
6
6
|
"license": "https://aka.ms/spfx/license",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@microsoft/sp-core-library": "1.24.0-beta.
|
|
42
|
-
"@microsoft/sp-lodash-subset": "1.24.0-beta.
|
|
41
|
+
"@microsoft/sp-core-library": "1.24.0-beta.3",
|
|
42
|
+
"@microsoft/sp-lodash-subset": "1.24.0-beta.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@rushstack/heft": "1.2.
|
|
45
|
+
"@rushstack/heft": "1.2.22",
|
|
46
46
|
"@swc/helpers": "^0.5.12",
|
|
47
47
|
"eslint": "9.37.0",
|
|
48
48
|
"tslib": "2.3.1",
|
|
49
|
-
"@msinternal/
|
|
50
|
-
"@msinternal/
|
|
49
|
+
"@msinternal/odsp-core-bundle": "1.5.212",
|
|
50
|
+
"@msinternal/spfx-internal-web-build-rig": "0.1.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "heft test --clean",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
define("78359e4b-07c2-43c6-8d0b-d060b4d577e8_1.24.0",["@microsoft/sp-core-library","@microsoft/sp-lodash-subset","@msinternal/odsp-core-bundle"],(a,b,c)=>(()=>{"use strict";var d={676(b){b.exports=a},529(a){a.exports=b},277(a){a.exports=c}},e={};function f(a){var b=e[a];if(void 0!==b)return b.exports;var c=e[a]={exports:{}};return d[a](c,c.exports,f),c.exports}f.d=(a,b)=>{for(var c in b)f.o(b,c)&&!f.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:b[c]})},f.o=(a,b)=>Object.prototype.hasOwnProperty.call(a,b),f.r=a=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})};var g={};return(()=>{f.r(g),f.d(g,{_AutoAlertableMonitorType:()=>F,_AutoAlertableQosMonitor:()=>G,_CircularBuffer:()=>n,_Diagnostics:()=>w,_EngagementLogger:()=>x,_ExecutionQueue:()=>B,_LogEntry:()=>t,_LogEvent:()=>p,_LogFeature:()=>r,_LogHandler:()=>y,_LogLevel:()=>e,_LogManager:()=>o,_LogSource:()=>l,_LogType:()=>s,_PageType:()=>j,_PromotedState:()=>i,_QosLogger:()=>C,_QosMonitor:()=>E,_QosMonitorShareFailureWithCP:()=>H,_QosResultType:()=>A,_TraceLogger:()=>q,_logSourceServiceKey:()=>m});var a,b,c,d,e,h,i,j,k=f(676);class l{static create(a){return new l(a)}get id(){return this._id}isEmpty(){return 0===this._id.length}constructor(a){k.Validate.isNotNullOrUndefined(a,"id"),this._id=a}}let m=k.ServiceKey.createCustom("sp-client-base:LogSource",a=>l.create(""));class n{get count(){return this._count}push(a){this._ensureNotIterating(),this._head++,this._count++,this._head===this._size&&(this._head=0),this._buffer[this._head]=a}forEach(a){if(0!==this._count){this._isIterating=!0;try{let b=this._tail;for(let c=0;c<this._size&&(a(this._buffer[b]),b!==this._head);c++)b=this._getNext(b)}finally{this._isIterating=!1}}}removeAll(){this._ensureNotIterating(),this._head=-1,this._count=0}get _tail(){return this._isNotWrapped()?0:this._getNext(this._head)}_isNotWrapped(){return this._count===this._head+1}_getNext(a){let b=a+1;return b===this._size&&(b=0),b}_ensureNotIterating(){if(this._isIterating)throw Error("Circular buffer cannot be modified during iteration")}constructor(a){if(this._head=-1,this._count=0,this._isIterating=!1,a<=0)throw Error("Size must be positive");this._size=a,this._buffer=Array(a)}}class o{static get _maxVerboseLog(){return 5e3}get events(){return this._events}addHandler(a){this._containsHandler(a)||(this._handlers.push(a),this._shouldLogInRealTime.push(!1))}log(a){Object.freeze(a),this._events.push(a),this._processLogEvent(a)}removeHandler(a){let b=this._handlers.indexOf(a);b>-1&&(this._handlers.splice(b,1),this._shouldLogInRealTime.splice(b,1))}reset(){this._handlers=[],this._shouldLogInRealTime=[],this._events.removeAll()}processAll(a){this._handlers.indexOf(a)>-1&&this._processAllEvents(a)}_containsHandler(a){for(let b of this._handlers)if(b===a)return!0;return!1}_processAllEvents(a){this._events.forEach(b=>{if(b)try{a(b)}catch(a){console.error("failed to handle event:"+a.toString())}}),this._shouldLogInRealTime[this._handlers.indexOf(a)]=!0}_processLogEvent(a){for(let b=0;b<this._handlers.length;b++)if(this._shouldLogInRealTime[b]&&a)try{this._handlers[b](a)}catch(a){console.error("failed to handle event:"+a.toString())}}constructor(a){this._shouldLogInRealTime=[],this._handlers=[],this._events=new n(o._maxVerboseLog),a&&this.addHandler(a)}}class p{static log(a,b,c,d){let e=new p(a,b,c,d);return p.logManager.log(e),e}toString(){let a=`[${this._timestamp}][${this._prefix}]`;return this._message?`${a} ${this._message}`:this._error?`${a} ${this._error.toString()}`:a}get timestamp(){return this._timestamp}get level(){return this._level}get prefix(){return this._prefix}get scope(){return this._scope}get source(){return this._source}get message(){return this._message}get error(){return this._error}get _maxSourceLength(){return 30}get _maxMessageLength(){return 150}_validate(a,b){if(!a)throw Error("source cannot be undefined or null for Logger");if(!b)throw Error("data cannot be undefined or null")}_setData(a){"string"==typeof a?this._message=a.substr(0,this._maxMessageLength):a instanceof Error&&(this._error=a)}_getPrefix(){let a=`${this._source}`;return this._scope&&!this._scope.isEmpty()&&(a=`${this._scope.id.substr(0,this._maxSourceLength)}.${a}`),`${a}`}_getScope(a){let b;return a&&a.whenFinished(()=>{b=a.consume(m)}),b}constructor(a,b,c,d){this._validate(a,b),this._timestamp=new Date().getTime(),this._scope=this._getScope(d),this._source=a.substr(0,this._maxSourceLength),this._setData(b),this._level=c,this._prefix=this._getPrefix()}}p.logManager=new o,(a=e||(e={}))[a.Verbose=1]="Verbose",a[a.Info=2]="Info",a[a.Warning=3]="Warning",a[a.Error=4]="Error";class q{static _addHandler(a){q._logManager.addHandler(a.log),q._logManager.processAll(a.log),q._verboseLogManager.addHandler(a.verbose),q._verboseLogManager.processAll(a.verbose)}static logError(a,b,c,d){k.Validate.isNotNullOrUndefined(b,"error"),this._log(a,b,c,!0,d)}static logErrorData(a){k.Validate.isNotNullOrUndefined(a.error,"error");let b=a.logEntry?a.logEntry.toString():a.error;this._log(a.source,b,a.eventName,!0,a.resultCode,a.serviceScope)}static logVerbose(a,b,c){k.Validate.isNonemptyString(b,"message"),this._log(a,b,c,!1,void 0)}static logVerboseData(a){let b=a.logEntry?a.logEntry.toString():a.message;this._log(a.source,b,a.eventName,!1,void 0,a.serviceScope)}static logErrorWithLogEntry(a,b,c,d){k.Validate.isNotNullOrUndefined(a,"source"),k.Validate.isNotNullOrUndefined(b,"logEntry"),this._log(a,b.toString(),c,!0,d)}static get shouldWriteToConsole(){return q._shouldWriteToConsole}static set shouldWriteToConsole(a){q._shouldWriteToConsole&&!a?(q._logManager.removeHandler(q._defaultLogger.log),q._verboseLogManager.removeHandler(q._defaultLogger.verbose)):!q._shouldWriteToConsole&&a&&(q._logManager.addHandler(q._defaultLogger.log),q._verboseLogManager.addHandler(q._defaultLogger.verbose)),q._shouldWriteToConsole=a}static logVerboseWithLogEntry(a,b,c){k.Validate.isNotNullOrUndefined(b,"LogEntry"),this._log(a,b.toString(),c,!1,void 0)}static _log(a,b,c,d,f,g){let h,i=this._addEventPrefix(a,c);d?(h=p.log(i,b,e.Error,g),q._logManager.log({data:b,eventName:h.prefix,resultCode:f})):(h=p.log(i,b.toString(),e.Verbose,g),q._verboseLogManager.log({data:b,eventName:h.prefix})),q.shouldWriteToConsole&&this._writeToConsole(h,d,f)}static _addEventPrefix(a,b){return b?`${a.id}.${b}`:a.id}static _writeToConsole(a,b,c){let d=a.toString();c&&(d+=`. resultCode: ${c}`),b?console.error(d):console.log(d)}}q._logManager=new o,q._verboseLogManager=new o,q._defaultLogger=new class{log(a){console.log(`Error: ${a.data}, Event Name: ${a.eventName}, Result Code: ${a.resultCode}`)}verbose(a){console.log(`Error: ${a.data}, Event Name: ${a.eventName}`)}},q._shouldWriteToConsole=!1;class r{}r.None="None",(b=h||(h={}))[b.Trace=1]="Trace",b[b.Event=2]="Event",b[b.Error=3]="Error";let s=h,t=class{toString(){let a;if(this.logProperties)try{a=JSON.stringify(this.logProperties)}catch(a){console.log("Error happens in toString():"+a)}return`${this.moduleName} | ${this.logFeature} | ${this.logType} | ${a}`}constructor(a,b=r.None,c=s.Trace,d,e){if(a)this.moduleName=a,this.logFeature=b,this.logType=c,this.logProperties=d,this.isIntentional=e;else throw Error("moduleName is invalid")}};var u=f(529);class v{static initialize(a){this.settings=(0,u.cloneDeep)(a),this._initialized=!0,this._normalizeContextIds()}static updateSettings(a){this.settings=(0,u.merge)(this.settings,a),this._normalizeContextIds()}static clearSettings(a){a.diagnosticSettings&&a.diagnosticSettings.forEach(a=>{delete this.settings[a]}),a.extraDiagnosticInfo&&a.extraDiagnosticInfo.forEach(a=>{this.settings.extraDiagnosticInfo&&this.settings.extraDiagnosticInfo[a]&&delete this.settings.extraDiagnosticInfo[a]})}static get isInitialized(){return this._initialized}static _normalizeId(a){let b=k.Guid.tryParse(a);return b?.toString()||a}static _normalizeContextIds(){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)))}}v._initialized=!1;class w{static initialize(a){w._isInitialized||(v.initialize(a),q.shouldWriteToConsole=a.enableConsoleLog,q._addHandler({log:a=>{k.Log.info(a.eventName,`EventName:${a.data.toString()}, ResultCode: ${a.resultCode}`)},verbose:a=>{k.Log.verbose(a.eventName,a.data.toString())}}),w._isInitialized=!0)}static get isInitialized(){return this._isInitialized}static updateSettings(a){v.updateSettings(a)}static getAuthoringSessionClientCountInfo(){return v.settings?.extraDiagnosticInfo?.authoringSessionClientCount}static _getExtraDiagnosticInfo(){return v.settings?.extraDiagnosticInfo}static clearSettings(a){v.clearSettings(a)}}w._isInitialized=!1,(c=i||(i={}))[c.NotPromoted=0]="NotPromoted",c[c.Promoted=2]="Promoted",(d=j||(j={})).News="News",d.Article="Article",d.Home="Home",d.Space="Space",d.NewsDigest="NewsDigest";class x{static _addHandler(a){x._handler=b=>{a.logData(b)},x._logManager.addHandler(x._handler)}static startRealTimeProcessing(){this._shouldProcessInRealTime||(x._logManager.processAll(x._handler),this._shouldProcessInRealTime=!0)}static log(a){x._logEngagementData(a)}static logEvent(a,b){let c={name:a};b&&0!==b.length&&(c.extraData={action:b}),x._logEngagementData(c)}static logEventWithLogEntry(a){let b={isIntentional:a.isIntentional,name:a.moduleName+"."+a.logFeature,extraData:a.logProperties};x._logEngagementData(b,!0)}static _logEngagementData(a,b=!1){if(!a.name||0===a.name.length)throw Error("LogEntry is invalid");x._checkValidTagName(a,b),x._addContextData(a),x._appendExtraData(a),x._logManager.log(a)}static _checkValidTagName(a,b=!1){if(!b&&!1===/(\w+)\.(\w+).(\w+)/gi.test(a.name))throw Error(`${a.name} tagName does not follow AppName.ControlName.ActionName pattern`)}static _addContextData(a){if(v.isInitialized){let{listId:b,listItemUniqueId:c,siteId:d,webId:e}=v.settings;a.siteId=d,a.webId=e,b&&(a.listId=b,c&&(a.docId=c))}}static _appendExtraData(a){if(v.isInitialized){let{settings:{contextInfo:c}}=v;if(c){var b;let d,e,f,g,h;a.extraData||(a.extraData={}),(b=a.extraData).pageId=c.pageId,b.isHub=c.isHubSite,c.isHubSite?(b.hubSiteId=c.hubSiteId,b.isAssociatedSite=!1):!c.isHubSite&&c.hubSiteId?b.isAssociatedSite=!0:b.isAssociatedSite=!1,!b.displayApp&&(k._BrowserUtilities.isTeamsHosted()?(b.displayApp="Teams",c.isEduClass&&(b.isEduClass=!0)):b.displayApp="Sharepoint"),b.userAgent=navigator.userAgent,b.webTemplate=e=c.webTemplate,"1"===e?d="TeamSite":"64"===e?d="GroupSite":"68"===e?d="CommunicationSite":"21"===e&&(d="MySite"),f=c.promotedState,h=g=c.pageType,g===j.Article&&(h=f===i.NotPromoted||void 0===f?j.Article:j.News),b.siteType=d,b.pageType=h,b.isDebug=!!k._BrowserUtilities.safelyAccessSessionStorage("spfx-debug"),b.hasCopilotLicense=!!c.hasCopilotLicense}}}}x._logManager=new o;class y{verbose(a,b,c){p.log(a,b,e.Verbose,c)}info(a,b,c){p.log(a,b,e.Info,c)}warn(a,b,c){p.log(a,b,e.Warning,c)}error(a,b,c){p.log(a,b,e.Error,c)}}var z=f(277);let A={Success:0,Failure:1,ExpectedFailure:2};class B{get shouldExecuteInRealTime(){return this._shouldExecuteInRealTime}set shouldExecuteInRealTime(a){this._shouldExecuteInRealTime=a,this._shouldExecuteInRealTime&&this.flush()}addHandler(a,b){if(this._containsHandler(a,b))return;this._initializeHandlerArrayForKey(a);let c=this._handlers[a];-1===c.indexOf(b)&&c.push(b)}addExecutionEntry(a,...b){Object.freeze(b),this._shouldExecuteInRealTime?this._processExecutionEntry(a,b):this._executionEntries.push({key:a,args:b})}removeHandler(a,b){let c=this._handlers[a].indexOf(b);c>-1&&this._handlers[a].splice(c,1)}reset(){this._handlers={},this._executionEntries=[]}flush(){this._processAllExecutionEntries(),this._executionEntries=[]}_containsHandler(a,b){return null!==this._handlers[a]&&void 0!==this._handlers[a]&&this._handlers[a].indexOf(b)>-1}_initializeHandlerArrayForKey(a){(null===this._handlers[a]||void 0===this._handlers[a])&&(this._handlers[a]=[])}_processAllExecutionEntries(){for(let a of this._executionEntries)if(a&&this._handlers[a.key])try{for(let b of this._handlers[a.key])b.apply(this,a.args)}catch(a){console.error("failed to process execution entry:"+a.toString())}}_processExecutionEntry(a,b){for(let c=0;c<this._handlers[a].length;c++)try{this._handlers[a][c].apply(this,b)}catch(a){console.error("failed to process execution entry:"+a.toString())}}constructor(){this._shouldExecuteInRealTime=!1,this._handlers={},this._executionEntries=[]}}class C{static get instance(){return this._instance||(this._instance=new C),this._instance}get shouldProcessInRealTime(){return this._shouldProcessInRealTime}set shouldProcessInRealTime(a){this._shouldProcessInRealTime=a,this._deferExecutor.shouldExecuteInRealTime=a}setLogger(a){this._qosLogger=a}getQosEvent(a){return this._qosEvents.get(a)}startQosMonitor(a,b){this._qosEvents.has(a)||this._deferExecutor.addExecutionEntry("start",a,b)}writeQosEndResult(a,b){this._deferExecutor.addExecutionEntry("end",a,b)}_startMonitor(a,b){this._qosLogger&&this._qosEvents.set(a,new this._qosLogger(b))}_endMonitor(a,b){let c=this._qosEvents.get(a);c&&(c.end(b),this._qosEvents.delete(a))}_initializeLogger(){let a=(a,b)=>{this._startMonitor(a,b)},b=(a,b)=>{this._endMonitor(a,b)};this._deferExecutor.addHandler("start",a),this._deferExecutor.addHandler("end",b)}constructor(){this._qosEvents=new Map,this._deferExecutor=new B,this._shouldProcessInRealTime=!1,this._initializeLogger()}}let D={id:"QosMonitor"};class E{static startRealTimeProcessing(){C.instance.shouldProcessInRealTime||this._shouldProcessInRealTime(!0)}static _shouldProcessInRealTime(a){C.instance.shouldProcessInRealTime=a}get name(){return this._scenarioName}get shortEventName(){return"Qos"}get resultCode(){return this._endResultCode}get resultType(){return this._endResult}get extraData(){return this._endExtraData}set extraData(a){this._endExtraData=a}get hasEnded(){return this._hasEnded}writeSuccess(a){this._writeQosEnd(A.Success,void 0,void 0,a)}writeUnexpectedFailure(a="DefaultUnexpected",b,c){this._writeQosEnd(A.Failure,a,b,c)}writeExpectedFailure(a="DefaultExpected",b,c){this._writeQosEnd(A.ExpectedFailure,a,b,c)}_writeQosEnd(a,b,c,d){if(this._shouldSkip(a))return;this._ensureCorrelationId(a,d),this._endResultCode=b,this._endResult=a;let e=c?(0,z.getErrorMessage)(c):void 0;if(c instanceof z.CustomError){let a=(0,z.getQosEndSchemaFromError)(c);a&&(a.resultType=this._endResult,a.extraData=(0,u.merge)({},this._endExtraData,a.extraData)),C.instance.writeQosEndResult(this._id,a)}else{let a={resultCode:this._endResultCode,resultType:this._endResult,error:e,extraData:this._endExtraData};C.instance.writeQosEndResult(this._id,a)}this._writeToEngagement()}_ensureCorrelationId(a,b){if(b&&(this._ensureEndExtraData(),Object.keys(b).forEach(a=>this._endExtraData[a]=b[a])),v.isInitialized&&a!==A.Success){let a="CorrelationId",b=this._endExtraData&&(this._endExtraData[a]||this._endExtraData.correlationId)||v.settings.correlationId;b&&(this._endExtraData||(this._endExtraData={}),this._endExtraData[a]=b)}this._logHostType(),this._ensureAuthoringSessionId()}_ensureEndExtraData(){this._endExtraData||(this._endExtraData={})}_logHostType(){if(v.isInitialized){let a=k._BrowserUtilities.getTeamsAppType();if(a){this._ensureEndExtraData();let b="appHostType";this._endExtraData[b]||(this._endExtraData[b]=a)}}}_isDebugSession(){try{if(!k._SPKillSwitch.isActivated("761ccb86-4fa0-4f56-a05b-477bcc09bd9f"))return!1;return!!k._BrowserUtilities.safelyAccessSessionStorage("spfx-debug")}catch{return!1}}_shouldSkip(a){if(!this._hasEnded||void 0===this._endResult)return this._hasEnded=!0,this._isDebugSession();{let b=k.Text.format("QoS monitor '{0}' has ended with '{1}' already. Ignoring '{2}' tag.",this.name,this._qosResultTypeValue[this._endResult],this._qosResultTypeValue[a]);return this._endResult!==a&&q.logError(D,Error(b)),!0}}_writeToEngagement(){if(this._copyToInterana&&x.log({name:this.name,isIntentional:!!(this.extraData||{}).isIntentional,extraData:this.extraData||{}}),this._copyToCosmos){let a={name:"Spfx.Qos.ToEngagement",extraData:this.extraData||{}};a.extraData.qosName=this.name,this.resultType&&(a.extraData.qosResultType=this._qosResultTypeValue[this.resultType]),this.resultCode&&(a.extraData.qosResultCode=this.resultCode),x.log(a)}}constructor(a,b=!1,c=!1){this._qosResultTypeValue={[A.Success]:"Success",[A.Failure]:"Failure",[A.ExpectedFailure]:"ExpectedFailure"},this._ensureAuthoringSessionId=()=>{let a=v.settings?.extraDiagnosticInfo?.authoringSessionId;if(a){this._ensureEndExtraData(),this._endExtraData.AuthoringSessionId=a;let b=v.settings?.extraDiagnosticInfo?.authoringOpSequenceId;b&&(this._endExtraData.AuthoringOpSequenceId=b);let c=w.getAuthoringSessionClientCountInfo();c&&this._endExtraData&&(this._endExtraData.AuthoringSessionClientCount=c)}},k.Validate.isNonemptyString(a,"scenarioName"),this._id=k.Guid.newGuid().toString(),this._isDebugSession()||C.instance.startQosMonitor(this._id,{name:a}),this._scenarioName=a,this._hasEnded=!1,this._copyToCosmos=b,this._copyToInterana=c}}let F={StaticReliabilityQos95Sev4:"StaticReliabilityQos95Sev4",DynamicReliabilityQosMediumSev4:"DynamicReliabilityQosMediumSev4",DynamicReliabilityExpectedFailureHighSev4:"DynamicReliabilityExpectedFailureHighSev4"};class G extends E{writeSuccess(a){super.writeSuccess(this._getExtraDataWithAutoAlertableFields(a))}writeUnexpectedFailure(a="DefaultUnexpected",b,c){super.writeUnexpectedFailure(a,b,this._getExtraDataWithAutoAlertableFields(c))}writeExpectedFailure(a="DefaultExpected",b,c){super.writeExpectedFailure(a,b,this._getExtraDataWithAutoAlertableFields(c))}_getExtraDataWithAutoAlertableFields(a){let b=a??{};return b.autoAlertableMonitorType=F[this._autoAlertableMonitorType],b}constructor(a,b,c=!1){super(a,!1,c),this._autoAlertableMonitorType=b}}class H extends E{writeUnexpectedFailure(a="DefaultUnexpected",b,c){super.writeUnexpectedFailure(a,b,c),this._logCustomerPromiseFailure(b?.message||"DefaultErrorMessage",a,A.Failure,c)}writeExpectedFailure(a="DefaultExpected",b,c,d=!1){super.writeExpectedFailure(a,b,c),d||this._logCustomerPromiseFailure(b?.message||"DefaultErrorMessage",a,A.ExpectedFailure,c)}_logCustomerPromiseFailure(a,b,c=A.Failure,d){this._extraDataForCustomerPromise&&this._extraDataForCustomerPromise.forEach(e=>{let f,{logFailure:g,veto:h}=e,i={errorCode:e.errorModuleName+((f=w._getExtraDiagnosticInfo())&&f.hasAuthoringStarted?f.authoringSessionClientCount?f.authoringSessionClientCount>1?" with Multiple Users":"":f.isAuthoringUsingDDS?" in Legacy Authoring (DDS)":" in Legacy Authoring (no DDS)":"")+(k._SPKillSwitch.isActivated("c125685f-83e7-44c8-b602-5c21f5b748ae")||window.navigator.onLine?"":" (offline)"),errorScenario:b,errorMessage:a,resultType:c,pageType:d?.pageType,errorStack:d?.errorStack,veto:h};g(i)})}constructor(a,b=!1,c,d=!1){super(a,d,b),this._extraDataForCustomerPromise=c}}})(),g})());
|