@microsoft/windows-admin-center-sdk 2.298.0 → 2.301.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.
Files changed (149) hide show
  1. package/angular/assets/strings/cs-CZ/strings.json +1 -1
  2. package/angular/assets/strings/de-DE/strings.json +1 -1
  3. package/angular/assets/strings/es-ES/strings.json +1 -1
  4. package/angular/assets/strings/fr-FR/strings.json +1 -1
  5. package/angular/assets/strings/hu-HU/strings.json +1 -1
  6. package/angular/assets/strings/it-IT/strings.json +1 -1
  7. package/angular/assets/strings/ja-JP/strings.json +1 -1
  8. package/angular/assets/strings/ko-KR/strings.json +1 -1
  9. package/angular/assets/strings/nl-NL/strings.json +1 -1
  10. package/angular/assets/strings/pl-PL/strings.json +1 -1
  11. package/angular/assets/strings/pt-BR/strings.json +1 -1
  12. package/angular/assets/strings/pt-PT/strings.json +1 -1
  13. package/angular/assets/strings/ru-RU/strings.json +1 -1
  14. package/angular/assets/strings/strings.json +1 -1
  15. package/angular/assets/strings/sv-SE/strings.json +1 -1
  16. package/angular/assets/strings/tr-TR/strings.json +1 -1
  17. package/angular/assets/strings/zh-CN/strings.json +1 -1
  18. package/angular/assets/strings/zh-TW/strings.json +1 -1
  19. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js +239 -568
  20. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js.map +1 -1
  21. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js +2 -2
  22. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js.map +1 -1
  23. package/angular/esm2015/src/controls/actions/containers/action-bar/action-bar.component.js +2 -7
  24. package/angular/esm2015/src/controls/alert-bar/alert-bar.component.js +5 -5
  25. package/angular/esm2015/src/controls/common/base.component.js +1 -8
  26. package/angular/esm2015/src/controls/data-table/data-table.component.js +9 -39
  27. package/angular/esm2015/src/controls/form/form-field/checklist/checklist-form-field.component.js +8 -11
  28. package/angular/esm2015/src/controls/form/form-field/combobox/combobox-form-field.component.js +9 -8
  29. package/angular/esm2015/src/controls/form/form-field/file/file-form-field.component.js +2 -14
  30. package/angular/esm2015/src/controls/form/form-field/form-field.component.js +2 -9
  31. package/angular/esm2015/src/controls/layout/layout-definition.component.js +2 -9
  32. package/angular/esm2015/src/controls/layout/layout.component.js +2 -11
  33. package/angular/esm2015/src/controls/master-view/master-view.component.js +5 -32
  34. package/angular/esm2015/src/controls/page-alert-bar/models/index.js +1 -1
  35. package/angular/esm2015/src/controls/pivot/pivot-tab.component.js +1 -1
  36. package/angular/esm2015/src/controls/pivot/pivot.component.js +4 -21
  37. package/angular/esm2015/src/controls/property-grid/property-grid-item.component.js +2 -50
  38. package/angular/esm2015/src/controls/property-grid/property-grid.component.js +60 -73
  39. package/angular/esm2015/src/controls/property-grid/property-grid.module.js +1 -5
  40. package/angular/esm2015/src/controls/settings/common-settings/common-settings.component.js +70 -151
  41. package/angular/esm2015/src/controls/settings/settings.component.js +8 -48
  42. package/angular/esm2015/src/controls/settings/settings.module.js +9 -21
  43. package/angular/esm2015/src/controls/wizard/wizard.component.js +65 -55
  44. package/angular/esm2015/src/generated/strings.js +1 -1
  45. package/angular/esm2015/src/service/app-context.service.js +1 -3
  46. package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js +239 -545
  47. package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js.map +1 -1
  48. package/angular/package.json +0 -2
  49. package/angular/src/controls/common/base.component.d.ts +0 -5
  50. package/angular/src/controls/data-table/data-table.component.d.ts +0 -15
  51. package/angular/src/controls/form/form-field/checklist/checklist-form-field.component.d.ts +0 -1
  52. package/angular/src/controls/form/form-field/file/file-form-field.component.d.ts +0 -4
  53. package/angular/src/controls/layout/layout-definition.component.d.ts +1 -6
  54. package/angular/src/controls/master-view/master-view.component.d.ts +2 -118
  55. package/angular/src/controls/page-alert-bar/models/index.d.ts +1 -1
  56. package/angular/src/controls/pivot/pivot-tab.component.d.ts +1 -0
  57. package/angular/src/controls/pivot/pivot.component.d.ts +0 -7
  58. package/angular/src/controls/property-grid/property-grid-item.component.d.ts +3 -53
  59. package/angular/src/controls/property-grid/property-grid.component.d.ts +2 -1
  60. package/angular/src/controls/property-grid/property-grid.module.d.ts +3 -4
  61. package/angular/src/controls/settings/common-settings/common-settings.component.d.ts +1 -32
  62. package/angular/src/controls/settings/settings.component.d.ts +1 -18
  63. package/angular/src/controls/settings/settings.module.d.ts +1 -3
  64. package/angular/src/generated/strings.d.ts +0 -3
  65. package/core/base/environment.d.ts +0 -10
  66. package/core/base/environment.js.map +1 -1
  67. package/core/data/gateway-connection.d.ts +0 -34
  68. package/core/data/gateway-connection.js +2 -59
  69. package/core/data/gateway-connection.js.map +1 -1
  70. package/core/data/node-connection.d.ts +0 -4
  71. package/core/data/node-connection.js.map +1 -1
  72. package/core/data/powershell.d.ts +0 -4
  73. package/core/data/powershell.js +0 -1
  74. package/core/data/powershell.js.map +1 -1
  75. package/core/diagnostics/sme-web-telemetry-models.d.ts +3 -20
  76. package/core/diagnostics/sme-web-telemetry-models.js +2 -6
  77. package/core/diagnostics/sme-web-telemetry-models.js.map +1 -1
  78. package/core/diagnostics/sme-web-telemetry.d.ts +1 -13
  79. package/core/diagnostics/sme-web-telemetry.js +11 -51
  80. package/core/diagnostics/sme-web-telemetry.js.map +1 -1
  81. package/core/generated/powershell-scripts.d.ts +0 -4
  82. package/core/generated/powershell-scripts.js +0 -4
  83. package/core/generated/powershell-scripts.js.map +1 -1
  84. package/core/index.d.ts +0 -2
  85. package/core/index.js +0 -1
  86. package/core/index.js.map +1 -1
  87. package/core/manifest/environment-modules.js +0 -10
  88. package/core/manifest/environment-modules.js.map +1 -1
  89. package/core/notification/powershell-notification.js +1 -1
  90. package/core/notification/powershell-notification.js.map +1 -1
  91. package/core/performance/performance-tracker.d.ts +0 -67
  92. package/core/performance/performance-tracker.js +4 -211
  93. package/core/performance/performance-tracker.js.map +1 -1
  94. package/core/rpc/credssp/rpc-credssp-model.d.ts +2 -27
  95. package/core/rpc/credssp/rpc-credssp-model.js +0 -10
  96. package/core/rpc/credssp/rpc-credssp-model.js.map +1 -1
  97. package/core/security/credssp-manager.d.ts +1 -15
  98. package/core/security/credssp-manager.js +0 -28
  99. package/core/security/credssp-manager.js.map +1 -1
  100. package/core/shared/gateway-inventory/gateway-inventory.d.ts +0 -10
  101. package/core/shared/gateway-inventory/gateway-inventory.js +0 -11
  102. package/core/shared/gateway-inventory/gateway-inventory.js.map +1 -1
  103. package/e2e/assets/strings/cs-CZ/strings.json +1 -1
  104. package/e2e/assets/strings/de-DE/strings.json +1 -1
  105. package/e2e/assets/strings/es-ES/strings.json +1 -1
  106. package/e2e/assets/strings/fr-FR/strings.json +1 -1
  107. package/e2e/assets/strings/hu-HU/strings.json +1 -1
  108. package/e2e/assets/strings/it-IT/strings.json +1 -1
  109. package/e2e/assets/strings/ja-JP/strings.json +1 -1
  110. package/e2e/assets/strings/ko-KR/strings.json +1 -1
  111. package/e2e/assets/strings/nl-NL/strings.json +1 -1
  112. package/e2e/assets/strings/pl-PL/strings.json +1 -1
  113. package/e2e/assets/strings/pt-BR/strings.json +1 -1
  114. package/e2e/assets/strings/pt-PT/strings.json +1 -1
  115. package/e2e/assets/strings/ru-RU/strings.json +1 -1
  116. package/e2e/assets/strings/strings.json +1 -1
  117. package/e2e/assets/strings/sv-SE/strings.json +1 -1
  118. package/e2e/assets/strings/tr-TR/strings.json +1 -1
  119. package/e2e/assets/strings/zh-CN/strings.json +1 -1
  120. package/e2e/assets/strings/zh-TW/strings.json +1 -1
  121. package/package.json +3 -5
  122. package/styles/css/main.css +1 -1
  123. package/tools/module-template/gulpfile.ts/index.ts +1 -1
  124. package/tools/package-lock.json +975 -14946
  125. package/tools/wac-cli/src/create/main.d.ts +3 -6
  126. package/tools/wac-cli/src/create/main.js +35 -87
  127. package/tools/wac-cli/src/create/main.js.map +1 -1
  128. package/tools/wac-cli/src/index.js +2 -2
  129. package/tools/wac-cli/src/index.js.map +1 -1
  130. package/tools/wac-cli/templates/{solution/manifest.json → manifest/solution-manifest.json} +0 -19
  131. package/tools/wac-cli/templates/{wac-template/src/manifest.json → manifest/tool-manifest.json} +0 -0
  132. package/tools/wac-cli/templates/wac-template/angular.json +2 -2
  133. package/tools/wac-cli/templates/wac-template/gulpfile.ts/config-data.ts +1 -1
  134. package/tools/wac-cli/templates/wac-template/package.json +8 -0
  135. package/tools/wac-cli/templates/wac-template/src/app/app-routing.module.ts +1 -1
  136. package/tools/wac-cli/templates/wac-template/src/main.ts +0 -2
  137. package/tools/wac-cli/templates/wac-template/src/polyfills.ts +1 -1
  138. package/tools/wac-cli/templates/wac-template/src/test.ts +2 -2
  139. package/core/data/gateway-status.d.ts +0 -24
  140. package/core/data/gateway-status.js +0 -3
  141. package/core/data/gateway-status.js.map +0 -1
  142. package/core/data/wdac-operations.d.ts +0 -123
  143. package/core/data/wdac-operations.js +0 -144
  144. package/core/data/wdac-operations.js.map +0 -1
  145. package/tools/wac-cli/templates/internal/npmrc.txt +0 -6
  146. package/tools/wac-cli/templates/internal/package.json +0 -101
  147. package/tools/wac-cli/templates/solution/strings.resjson +0 -16
  148. package/tools/wac-cli/templates/wac-template/src/version.ts +0 -3
  149. package/tools/wac-cli/templates/wac-template/version.json +0 -5
@@ -1,4 +1,3 @@
1
- import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';
2
1
  import { Logging } from '../diagnostics/logging';
3
2
  import { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';
4
3
  /**
@@ -6,196 +5,10 @@ import { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';
6
5
  */
7
6
  export class SmePerformanceSummary {
8
7
  }
9
- /**
10
- * Web Vitals metrics to track. See more details at https://web.dev/vitals/
11
- */
12
- export var WebVitalFields;
13
- (function (WebVitalFields) {
14
- WebVitalFields["CLS"] = "CumulativeLayoutShift";
15
- WebVitalFields["LCP"] = "LargestContentfulPaint";
16
- WebVitalFields["FCP"] = "FirstContentfulPaint";
17
- WebVitalFields["FID"] = "FirstInputDelay";
18
- WebVitalFields["TTFB"] = "TimeToFirstByte";
19
- WebVitalFields["TBT"] = "TotalBlockingTime";
20
- WebVitalFields["TTI"] = "TimeToInteractive";
21
- })(WebVitalFields || (WebVitalFields = {}));
22
- /**
23
- * List performance entry types that are relevant for our metrics.
24
- */
25
- export var PerformanceEntryType;
26
- (function (PerformanceEntryType) {
27
- PerformanceEntryType["LongTask"] = "longtask";
28
- PerformanceEntryType["Resource"] = "resource";
29
- PerformanceEntryType["Mark"] = "mark";
30
- PerformanceEntryType["Navigation"] = "navigation";
31
- })(PerformanceEntryType || (PerformanceEntryType = {}));
32
- /**
33
- * Simplified performance entry type with only a start time, end time, and entryType.
34
- */
35
- export class TaskTiming {
36
- }
37
- /**
38
- * Internal further simplification for a range of time with only start and end time.
39
- */
40
- class TimeWindow {
41
- }
42
- /**
43
- * Performance tracker class handles two things:
44
- * 1) Tracking lighthouse metrics (see https://web.dev/vitals/)
45
- * 2) Providing a wrapper to mark various times in code for performance measurement.
46
- * This is used primarily for shell and various tools to determine load times.
47
- */
48
8
  export class PerformanceTracker {
49
9
  static get smePrefix() {
50
10
  return 'SME:';
51
11
  }
52
- static setLighthouseField(field, value) {
53
- this.lighthouseMetrics[field] = value;
54
- if (this.lighthouseMetrics.TotalBlockingTime !== null) {
55
- // if TBT is calculated, we (should) have all required fields, log this in telemetry.
56
- // It is possible once TBT is calculated other fields can be triggered afterwards (eg CLS or LCP).
57
- // We will simply update those fields within lighthouse object and send the whole thing.
58
- // On telemetry end we can decide how to handle (ie take first or last instance).
59
- SmeWebTelemetry.traceLighthouseData(this.lighthouseMetrics);
60
- }
61
- }
62
- /**
63
- * Calculate Time to Interactive using list of longtask and resource events. Time to Interactive calculation
64
- * method can be found at https://web.dev/tti#what-is-tti
65
- * @param taskList List of all longtask and resource events from current time.
66
- * @returns Returns time to interactive if it exists, TTI_NOT_FOUND if not.
67
- */
68
- static tryFindTti(taskList) {
69
- const timestamps = [];
70
- taskList.forEach((entry) => {
71
- timestamps.push({ entryType: entry.entryType, time: entry.startTime, isStart: true });
72
- timestamps.push({ entryType: entry.entryType, time: entry.endTime });
73
- });
74
- // push an entry for the current timestamp, so that if the quiet window is at the end
75
- // (eg mass entries early on, and emptiness later), we can capture the end of the window with this event.
76
- timestamps.push({ entryType: PerformanceEntryType.LongTask, time: window.performance.now(), isStart: true });
77
- timestamps.sort((a, b) => a.time < b.time ? -1 : 1);
78
- const quietWindows = [];
79
- let startTime = this.fcp;
80
- let longTaskCount = 0;
81
- let networkRequestCount = 0;
82
- // Split ranges into starts and ends, iterate through all timestamps of start/end
83
- // for each start/end, identify and keep track of long tasks and network requests to identify potential windows
84
- // isStart means the timestamp is a startTime of a performance entry (long task or resource).
85
- for (const { entryType, time, isStart } of timestamps) {
86
- if (isStart) {
87
- // check if ends current window
88
- if ((entryType === PerformanceEntryType.LongTask && longTaskCount === 0 && networkRequestCount <= 2) ||
89
- (entryType === PerformanceEntryType.Resource && longTaskCount === 0 && networkRequestCount === 2)) {
90
- const newStartTime = startTime ? Math.max(startTime, this.fcp) : this.fcp;
91
- const endTime = time;
92
- if (endTime > newStartTime) {
93
- quietWindows.push({ start: newStartTime, end: endTime });
94
- }
95
- }
96
- }
97
- else {
98
- if ((entryType === PerformanceEntryType.LongTask && longTaskCount === 1 && networkRequestCount <= 2) ||
99
- (entryType === PerformanceEntryType.Resource && longTaskCount === 0 && networkRequestCount === 3)) {
100
- startTime = time;
101
- }
102
- }
103
- // For both cases, if we just hit an isStart timestamp, we are starting a new task - increment count depending on type.
104
- // if not isStart, we are ending a task, decrement count.
105
- if (entryType === PerformanceEntryType.LongTask) {
106
- longTaskCount += isStart ? 1 : -1;
107
- }
108
- else if (entryType === PerformanceEntryType.Resource) {
109
- networkRequestCount += isStart ? 1 : -1;
110
- }
111
- }
112
- const firstValidWindow = quietWindows.find((window) => (window.end - window.start) >= this.quietWindowLength);
113
- const relevantLongTasks = taskList.filter((task) => firstValidWindow && task.entryType === PerformanceEntryType.LongTask
114
- && task.startTime >= this.fcp && task.endTime <= firstValidWindow.start);
115
- const timeToInteractiveTimestamp = relevantLongTasks.length > 0
116
- ? relevantLongTasks[relevantLongTasks.length - 1].endTime : this.fcp;
117
- // if no valid window found, return timeToInteractiveNotFound
118
- return firstValidWindow ? timeToInteractiveTimestamp : this.timeToInteractiveNotFound;
119
- }
120
- /**
121
- * Initialize interval to calculate time to interactive. TTI will only be calculated if WAC is in non-production mode;
122
- * b/c calculation itself is non-performant. In production, we will use FID as a proxy for TTI.
123
- */
124
- static tryStartCalculatingTimeToInteractive() {
125
- if (SmeWebTelemetry.isProduction) {
126
- return;
127
- }
128
- this.ttiInProgress = true;
129
- let ttiTrackerCount = 0;
130
- this.ttiIntervalCheck = setInterval(() => {
131
- const tti = this.tryFindTti(this.tasks);
132
- if (tti !== this.timeToInteractiveNotFound) {
133
- this.setLighthouseField(WebVitalFields.TTI, tti);
134
- // need to recalculate here because this is dependent on where the TTI is.
135
- const recalculatedTotalBlockingTime = this.tasks.filter((entry) => entry.entryType === PerformanceEntryType.LongTask).reduce((totalBlockTime, nextEntry) => {
136
- const duration = nextEntry.endTime - nextEntry.startTime;
137
- const entrySatisfiesBlockingCriteria = duration > this.totalBlockingTimeThresholdRequirement
138
- && nextEntry.endTime < tti
139
- && nextEntry.startTime > this.fcp;
140
- return totalBlockTime + (entrySatisfiesBlockingCriteria ? duration : 0);
141
- }, 0);
142
- this.setLighthouseField(WebVitalFields.TBT, recalculatedTotalBlockingTime);
143
- clearInterval(this.ttiIntervalCheck);
144
- this.wacPo.disconnect();
145
- }
146
- else if (ttiTrackerCount > this.ttiTimeoutThreshold) {
147
- // if we have gone past threshold and no TTI found,
148
- // give up on TTI and just search for last long task, we will already have bad score
149
- const lastLongTask = this.tasks.filter((entry) => entry.entryType === PerformanceEntryType.LongTask).slice(-1)[0];
150
- this.setLighthouseField(WebVitalFields.TTI, lastLongTask ? lastLongTask.endTime : this.ttiTimeout * this.ttiTimeoutThreshold);
151
- this.setLighthouseField(WebVitalFields.TBT, this.totalBlockingTime);
152
- this.wacPo.disconnect();
153
- clearInterval(this.ttiIntervalCheck);
154
- }
155
- ++ttiTrackerCount;
156
- }, this.ttiTimeout);
157
- }
158
- /**
159
- * Initialize web-vitals trackers for all lighthouse metrics.
160
- */
161
- static initializeLighthouseMetricsTrackers() {
162
- getCLS((item) => this.setLighthouseField(WebVitalFields.CLS, item.value), true);
163
- getFCP((item) => {
164
- this.setLighthouseField(WebVitalFields.FCP, item.value);
165
- this.fcp = item.value;
166
- this.tryStartCalculatingTimeToInteractive();
167
- }, true);
168
- getLCP((item) => this.setLighthouseField(WebVitalFields.LCP, item.value), true);
169
- getFID((item) => {
170
- this.setLighthouseField(WebVitalFields.FID, item.value);
171
- if (!this.ttiInProgress) {
172
- this.setLighthouseField(WebVitalFields.TBT, this.totalBlockingTime);
173
- }
174
- });
175
- getTTFB((item) => this.setLighthouseField(WebVitalFields.TTFB, item.value));
176
- // Set a performance observer to collect all the long task and resource events we need to calculate lighthouse metrics.
177
- this.wacPo = new PerformanceObserver((list) => {
178
- const entries = list.getEntries();
179
- for (let i = 0; i < entries.length; ++i) {
180
- if (entries[i].entryType === PerformanceEntryType.LongTask) {
181
- // measure TBT as we collect long task events - if using FID, we can just send this accumulated value as is,
182
- // otherwise can recalculate this later when we find TTI.
183
- const entrySatisfiesBlockingCriteria = entries[i].duration > this.totalBlockingTimeThresholdRequirement
184
- && entries[i].startTime > this.fcp;
185
- this.totalBlockingTime += entrySatisfiesBlockingCriteria ? entries[i].duration : 0;
186
- this.tasks.push({ startTime: entries[i].startTime,
187
- endTime: entries[i].startTime + entries[i].duration,
188
- entryType: PerformanceEntryType.LongTask });
189
- }
190
- else {
191
- this.tasks.push({ startTime: entries[i].startTime,
192
- endTime: entries[i].startTime + entries[i].duration,
193
- entryType: PerformanceEntryType.Resource });
194
- }
195
- }
196
- });
197
- this.wacPo.observe({ entryTypes: [PerformanceEntryType.LongTask, PerformanceEntryType.Resource] });
198
- }
199
12
  static coreEnvironmentInitStarted() {
200
13
  performance.mark(PerformanceTracker.markCoreEnvironmentInitStarted);
201
14
  }
@@ -228,7 +41,7 @@ export class PerformanceTracker {
228
41
  PerformanceTracker.logAppComponentLoadTime();
229
42
  }
230
43
  static navigationInitialized() {
231
- const navigationMarks = performance.getEntriesByType(PerformanceEntryType.Mark)
44
+ const navigationMarks = performance.getEntriesByType('mark')
232
45
  .filter(e => e.name.startsWith(PerformanceTracker.smePrefix + 'Navigation'));
233
46
  // If we reinitialize navigation, clear all previous navigation marks.
234
47
  navigationMarks.forEach(m => { performance.clearMarks(m.name); });
@@ -334,9 +147,9 @@ export class PerformanceTracker {
334
147
  totalLoadTime: 0
335
148
  };
336
149
  /// dont include sme angular navigation marks in the generic data load
337
- const smeMarks = performance.getEntriesByType(PerformanceEntryType.Mark).filter(e => e.name.startsWith(PerformanceTracker.smePrefix)
150
+ const smeMarks = performance.getEntriesByType('mark').filter(e => e.name.startsWith(PerformanceTracker.smePrefix)
338
151
  && !e.name.startsWith(PerformanceTracker.smePrefix + 'Navigation'));
339
- const resourceMarks = performance.getEntriesByType(PerformanceEntryType.Resource);
152
+ const resourceMarks = performance.getEntriesByType('resource');
340
153
  smeMarks.forEach(m => {
341
154
  data.sme[m.name.replace(PerformanceTracker.smePrefix, '')] = m.startTime;
342
155
  performance.clearMarks(m.name);
@@ -352,7 +165,7 @@ export class PerformanceTracker {
352
165
  performance.clearMarks(m.name);
353
166
  });
354
167
  data.totalLoadTime = data.sme[this.markAppComponentInitialized.replace(PerformanceTracker.smePrefix, '')];
355
- const navigationEntries = performance.getEntriesByType(PerformanceEntryType.Navigation);
168
+ const navigationEntries = performance.getEntriesByType('navigation');
356
169
  if (navigationEntries && navigationEntries.length) {
357
170
  data.navigation = navigationEntries[0];
358
171
  }
@@ -420,25 +233,5 @@ PerformanceTracker.moduleOpening = true;
420
233
  * Used to keep track of various marks when measuring arbitrary timings.
421
234
  */
422
235
  PerformanceTracker.dataLoadMap = {};
423
- /**
424
- * Counter for total blocking time on initial loadup. This should be reset every time a new page is initialized.
425
- */
426
- PerformanceTracker.totalBlockingTime = 0;
427
- // initialize totalBlockingTime as null so we can distinguish when majority of lighthouse metrics are collected
428
- PerformanceTracker.lighthouseMetrics = { TotalBlockingTime: null };
429
- PerformanceTracker.fcp = 0;
430
- PerformanceTracker.tasks = [];
431
- PerformanceTracker.timeToInteractiveNotFound = -1;
432
- // Under TTI guidelines, a quiet window is defined to be a 5 second period where no long tasks run and no more than
433
- // 2 network requests at any given point.
434
- PerformanceTracker.quietWindowLength = 5000;
435
- // Time to interactive has to be calculated retroactively - every 10 seconds, we'll calculate and see if we can find TTI.
436
- // After 20 seconds, cancel and just find current tti (assume a quiet window will appear somewhere in the future)
437
- // These windows were selected arbitrarily - can be tweaked if necessary.
438
- PerformanceTracker.ttiTimeout = 10000;
439
- PerformanceTracker.ttiTimeoutThreshold = 2;
440
- // Long events (events in excess of 50ms) qualify for total blocking time - any duration in excess of 50ms,
441
- // the excess time will be added to total blocking time.
442
- PerformanceTracker.totalBlockingTimeThresholdRequirement = 50;
443
236
 
444
237
  //# sourceMappingURL=performance-tracker.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../packages/core/performance/performance-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE;;GAEG;AACH,MAAM,OAAO,qBAAqB;CAKjC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACtB,+CAA6B,CAAA;IAC7B,gDAA8B,CAAA;IAC9B,8CAA4B,CAAA;IAC5B,yCAAuB,CAAA;IACvB,0CAAwB,CAAA;IACxB,2CAAyB,CAAA;IACz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B,GAAG,kBAAkB,CAAC,SAAS,GAAG,0BAA0B,CAAC;AACzF,gDAA6B,GAAG,kBAAkB,CAAC,SAAS,GAAG,2BAA2B,CAAC;AAC3F,2CAAwB,GAAG,kBAAkB,CAAC,SAAS,GAAG,sBAAsB,CAAC;AACjF,8CAA2B,GAAG,kBAAkB,CAAC,SAAS,GAAG,yBAAyB,CAAC;AAEvF,yCAAsB,GAAG,kBAAkB,CAAC,SAAS,GAAG,oBAAoB,CAAC;AAC7E,4CAAyB,GAAG,kBAAkB,CAAC,SAAS,GAAG,uBAAuB,CAAC;AACnF,wCAAqB,GAAG,kBAAkB,CAAC,SAAS,GAAG,mBAAmB,CAAC;AAC3E,0CAAuB,GAAG,kBAAkB,CAAC,SAAS,GAAG,qBAAqB,CAAC;AAC/E,wCAAqB,GAAG,kBAAkB,CAAC,SAAS,GAAG,mBAAmB,CAAC;AAE3E,gCAAa,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACY,8BAAW,GAA0C,EAAE,CAAC;AAEvE;;GAEG;AACY,oCAAiB,GAAG,CAAC,CAAC;AAErC,+GAA+G;AAChG,oCAAiB,GAAiC,EAAC,iBAAiB,EAAE,IAAI,EAAC,CAAC;AAI5E,sBAAG,GAAG,CAAC,CAAC;AACR,wBAAK,GAAiB,EAAE,CAAC;AAEjB,4CAAyB,GAAG,CAAC,CAAC,CAAC;AAEtD,mHAAmH;AACnH,yCAAyC;AAClB,oCAAiB,GAAG,IAAI,CAAC;AAEhD,yHAAyH;AACzH,iHAAiH;AACjH,yEAAyE;AAClD,6BAAU,GAAG,KAAK,CAAC;AACnB,sCAAmB,GAAG,CAAC,CAAC;AAE/C,2GAA2G;AAC3G,wDAAwD;AACjC,wDAAqC,GAAG,EAAE,CAAC","file":"performance-tracker.js","sourcesContent":["import { getCLS, getFCP, getFID, getLCP, getTTFB } from 'web-vitals';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';\r\nimport { LighthousePerformanceMetrics, SmePerformanceData } from '../diagnostics/sme-web-telemetry-models';\r\n\r\n/**\r\n * Summarizes a sequence of measurements\r\n */\r\nexport class SmePerformanceSummary {\r\n label: string;\r\n startTime: number;\r\n totalLoadTime: number;\r\n timestamps: { [index: string]: number };\r\n}\r\n\r\n/**\r\n * Web Vitals metrics to track. See more details at https://web.dev/vitals/\r\n */\r\nexport enum WebVitalFields {\r\n CLS = 'CumulativeLayoutShift',\r\n LCP = 'LargestContentfulPaint',\r\n FCP = 'FirstContentfulPaint',\r\n FID = 'FirstInputDelay',\r\n TTFB = 'TimeToFirstByte',\r\n TBT = 'TotalBlockingTime',\r\n TTI = 'TimeToInteractive',\r\n}\r\n\r\n/**\r\n * List performance entry types that are relevant for our metrics.\r\n */\r\nexport enum PerformanceEntryType {\r\n LongTask = 'longtask',\r\n Resource = 'resource',\r\n Mark = 'mark',\r\n Navigation = 'navigation'\r\n}\r\n\r\n/**\r\n * Simplified performance entry type with only a start time, end time, and entryType.\r\n */\r\nexport class TaskTiming {\r\n startTime: number;\r\n endTime: number;\r\n entryType: PerformanceEntryType;\r\n}\r\n\r\n/**\r\n * Internal further simplification for a range of time with only start and end time.\r\n */\r\nclass TimeWindow {\r\n start: number;\r\n end: number;\r\n}\r\n\r\n/**\r\n * Performance tracker class handles two things:\r\n * 1) Tracking lighthouse metrics (see https://web.dev/vitals/)\r\n * 2) Providing a wrapper to mark various times in code for performance measurement.\r\n * This is used primarily for shell and various tools to determine load times.\r\n */\r\nexport class PerformanceTracker {\r\n public static get smePrefix(): string {\r\n return 'SME:';\r\n }\r\n\r\n // indexLoaded is logged by each extension when there index.html file starts executing code\r\n // The value itself is used, not the variable. This is kept here to have a complete list of sme marks used.\r\n private static markIndexLoaded = PerformanceTracker.smePrefix + 'IndexLoaded';\r\n private static markCoreEnvironmentInitStarted = PerformanceTracker.smePrefix + 'CoreEnvironmentInitializeStarted';\r\n private static markCoreEnvironmentInitCompleted = PerformanceTracker.smePrefix + 'CoreEnvironmentInitializeCompleted';\r\n private static markManifestLoadStarted = PerformanceTracker.smePrefix + 'ManifestLoadStarted';\r\n private static markLocalizationStarted = PerformanceTracker.smePrefix + 'LocalizationStarted';\r\n private static markAccessibilityManagerStarted = PerformanceTracker.smePrefix + 'AccessibilityManagerStarted';\r\n private static markAppContextServiceStarted = PerformanceTracker.smePrefix + 'AppContextServiceStarted';\r\n private static markAppContextRpcInitStarted = PerformanceTracker.smePrefix + 'AppContextRpcInitStarted';\r\n private static markAppContextRpcInitComplete = PerformanceTracker.smePrefix + 'AppContextRpcInitComplete';\r\n private static markAppModuleInitialized = PerformanceTracker.smePrefix + 'AppModuleInitialized';\r\n private static markAppComponentInitialized = PerformanceTracker.smePrefix + 'AppComponentInitialized';\r\n\r\n private static markCriticalDataLoaded = PerformanceTracker.smePrefix + 'CriticalDataLoaded';\r\n private static markNavigationInitialized = PerformanceTracker.smePrefix + 'NavigationInitialized';\r\n private static markNavigationStarted = PerformanceTracker.smePrefix + 'NavigationStarted';\r\n private static markNavigationCompleted = PerformanceTracker.smePrefix + 'NavigationCompleted';\r\n private static markNavigationMeasure = PerformanceTracker.smePrefix + 'NavigationMeasure';\r\n\r\n private static moduleOpening = true;\r\n\r\n /**\r\n * Used to keep track of various marks when measuring arbitrary timings.\r\n */\r\n private static dataLoadMap: {[index: string]: PerformanceEntry[]} = {};\r\n\r\n /**\r\n * Counter for total blocking time on initial loadup. This should be reset every time a new page is initialized.\r\n */\r\n private static totalBlockingTime = 0;\r\n\r\n // initialize totalBlockingTime as null so we can distinguish when majority of lighthouse metrics are collected\r\n private static lighthouseMetrics: LighthousePerformanceMetrics = {TotalBlockingTime: null};\r\n private static ttiIntervalCheck: NodeJS.Timeout;\r\n private static ttiInProgress: boolean;\r\n private static wacPo: PerformanceObserver;\r\n private static fcp = 0;\r\n private static tasks: TaskTiming[] = [];\r\n\r\n public static readonly timeToInteractiveNotFound = -1;\r\n\r\n // Under TTI guidelines, a quiet window is defined to be a 5 second period where no long tasks run and no more than\r\n // 2 network requests at any given point.\r\n public static readonly quietWindowLength = 5000;\r\n\r\n // Time to interactive has to be calculated retroactively - every 10 seconds, we'll calculate and see if we can find TTI.\r\n // After 20 seconds, cancel and just find current tti (assume a quiet window will appear somewhere in the future)\r\n // These windows were selected arbitrarily - can be tweaked if necessary.\r\n public static readonly ttiTimeout = 10000;\r\n public static readonly ttiTimeoutThreshold = 2;\r\n\r\n // Long events (events in excess of 50ms) qualify for total blocking time - any duration in excess of 50ms,\r\n // the excess time will be added to total blocking time.\r\n public static readonly totalBlockingTimeThresholdRequirement = 50;\r\n\r\n private static setLighthouseField(field: string, value: number) {\r\n this.lighthouseMetrics[field] = value;\r\n if (this.lighthouseMetrics.TotalBlockingTime !== null) {\r\n // if TBT is calculated, we (should) have all required fields, log this in telemetry.\r\n // It is possible once TBT is calculated other fields can be triggered afterwards (eg CLS or LCP).\r\n // We will simply update those fields within lighthouse object and send the whole thing.\r\n // On telemetry end we can decide how to handle (ie take first or last instance).\r\n SmeWebTelemetry.traceLighthouseData(this.lighthouseMetrics);\r\n }\r\n }\r\n\r\n /**\r\n * Calculate Time to Interactive using list of longtask and resource events. Time to Interactive calculation\r\n * method can be found at https://web.dev/tti#what-is-tti\r\n * @param taskList List of all longtask and resource events from current time.\r\n * @returns Returns time to interactive if it exists, TTI_NOT_FOUND if not.\r\n */\r\n public static tryFindTti(taskList: TaskTiming[]): number {\r\n const timestamps: {entryType: PerformanceEntryType, time: number, isStart?: boolean}[] = [];\r\n\r\n taskList.forEach((entry) => {\r\n timestamps.push({entryType: entry.entryType, time: entry.startTime, isStart: true});\r\n timestamps.push({entryType: entry.entryType, time: entry.endTime});\r\n });\r\n // push an entry for the current timestamp, so that if the quiet window is at the end\r\n // (eg mass entries early on, and emptiness later), we can capture the end of the window with this event.\r\n timestamps.push({entryType: PerformanceEntryType.LongTask, time: window.performance.now(), isStart: true});\r\n timestamps.sort((a, b) => a.time < b.time ? -1 : 1);\r\n\r\n const quietWindows: TimeWindow[] = [];\r\n let startTime = this.fcp;\r\n let longTaskCount = 0;\r\n let networkRequestCount = 0;\r\n // Split ranges into starts and ends, iterate through all timestamps of start/end\r\n // for each start/end, identify and keep track of long tasks and network requests to identify potential windows\r\n // isStart means the timestamp is a startTime of a performance entry (long task or resource).\r\n for (const {entryType, time, isStart} of timestamps) {\r\n if (isStart) {\r\n // check if ends current window\r\n if ((entryType === PerformanceEntryType.LongTask && longTaskCount === 0 && networkRequestCount <= 2) ||\r\n (entryType === PerformanceEntryType.Resource && longTaskCount === 0 && networkRequestCount === 2)) {\r\n const newStartTime = startTime ? Math.max(startTime, this.fcp) : this.fcp;\r\n const endTime = time;\r\n if (endTime > newStartTime) { quietWindows.push( {start: newStartTime, end: endTime} ); }\r\n }\r\n } else {\r\n if ((entryType === PerformanceEntryType.LongTask && longTaskCount === 1 && networkRequestCount <= 2) ||\r\n (entryType === PerformanceEntryType.Resource && longTaskCount === 0 && networkRequestCount === 3)) {\r\n startTime = time;\r\n }\r\n }\r\n // For both cases, if we just hit an isStart timestamp, we are starting a new task - increment count depending on type.\r\n // if not isStart, we are ending a task, decrement count.\r\n if (entryType === PerformanceEntryType.LongTask) {\r\n longTaskCount += isStart ? 1 : -1;\r\n } else if (entryType === PerformanceEntryType.Resource) {\r\n networkRequestCount += isStart ? 1 : -1;\r\n }\r\n }\r\n\r\n const firstValidWindow = quietWindows.find((window) => (window.end - window.start) >= this.quietWindowLength);\r\n const relevantLongTasks = taskList.filter((task) => firstValidWindow && task.entryType === PerformanceEntryType.LongTask\r\n && task.startTime >= this.fcp && task.endTime <= firstValidWindow.start);\r\n const timeToInteractiveTimestamp = relevantLongTasks.length > 0\r\n ? relevantLongTasks[relevantLongTasks.length - 1].endTime : this.fcp;\r\n // if no valid window found, return timeToInteractiveNotFound\r\n return firstValidWindow ? timeToInteractiveTimestamp : this.timeToInteractiveNotFound;\r\n }\r\n\r\n /**\r\n * Initialize interval to calculate time to interactive. TTI will only be calculated if WAC is in non-production mode;\r\n * b/c calculation itself is non-performant. In production, we will use FID as a proxy for TTI.\r\n */\r\n public static tryStartCalculatingTimeToInteractive(): void {\r\n if (SmeWebTelemetry.isProduction) {\r\n return;\r\n }\r\n this.ttiInProgress = true;\r\n let ttiTrackerCount = 0;\r\n this.ttiIntervalCheck = setInterval(() => {\r\n const tti = this.tryFindTti(this.tasks);\r\n if (tti !== this.timeToInteractiveNotFound) {\r\n this.setLighthouseField(WebVitalFields.TTI, tti);\r\n // need to recalculate here because this is dependent on where the TTI is.\r\n const recalculatedTotalBlockingTime =\r\n this.tasks.filter((entry) => entry.entryType === PerformanceEntryType.LongTask).reduce((totalBlockTime, nextEntry) => {\r\n const duration = nextEntry.endTime - nextEntry.startTime;\r\n const entrySatisfiesBlockingCriteria = duration > this.totalBlockingTimeThresholdRequirement\r\n && nextEntry.endTime < tti\r\n && nextEntry.startTime > this.fcp;\r\n return totalBlockTime + (entrySatisfiesBlockingCriteria ? duration : 0 );\r\n }, 0);\r\n this.setLighthouseField(WebVitalFields.TBT, recalculatedTotalBlockingTime);\r\n clearInterval(this.ttiIntervalCheck);\r\n this.wacPo.disconnect();\r\n } else if (ttiTrackerCount > this.ttiTimeoutThreshold) {\r\n // if we have gone past threshold and no TTI found,\r\n // give up on TTI and just search for last long task, we will already have bad score\r\n const lastLongTask = this.tasks.filter((entry) => entry.entryType === PerformanceEntryType.LongTask).slice(-1)[0];\r\n this.setLighthouseField(WebVitalFields.TTI,\r\n lastLongTask ? lastLongTask.endTime : this.ttiTimeout * this.ttiTimeoutThreshold);\r\n this.setLighthouseField(WebVitalFields.TBT, this.totalBlockingTime);\r\n this.wacPo.disconnect();\r\n clearInterval(this.ttiIntervalCheck);\r\n }\r\n ++ttiTrackerCount;\r\n }, this.ttiTimeout);\r\n }\r\n\r\n /**\r\n * Initialize web-vitals trackers for all lighthouse metrics.\r\n */\r\n public static initializeLighthouseMetricsTrackers(): void {\r\n getCLS((item) => this.setLighthouseField(WebVitalFields.CLS, item.value), true);\r\n getFCP((item) => {\r\n this.setLighthouseField(WebVitalFields.FCP, item.value);\r\n this.fcp = item.value;\r\n this.tryStartCalculatingTimeToInteractive();\r\n }, true);\r\n getLCP((item) => this.setLighthouseField(WebVitalFields.LCP, item.value), true);\r\n getFID((item) => {\r\n this.setLighthouseField(WebVitalFields.FID, item.value);\r\n if (!this.ttiInProgress) {\r\n this.setLighthouseField(WebVitalFields.TBT, this.totalBlockingTime);\r\n }\r\n });\r\n getTTFB((item) => this.setLighthouseField(WebVitalFields.TTFB, item.value));\r\n\r\n // Set a performance observer to collect all the long task and resource events we need to calculate lighthouse metrics.\r\n this.wacPo = new PerformanceObserver((list) => {\r\n const entries = list.getEntries();\r\n\r\n for (let i = 0; i < entries.length; ++i) {\r\n if (entries[i].entryType === PerformanceEntryType.LongTask) {\r\n // measure TBT as we collect long task events - if using FID, we can just send this accumulated value as is,\r\n // otherwise can recalculate this later when we find TTI.\r\n const entrySatisfiesBlockingCriteria = entries[i].duration > this.totalBlockingTimeThresholdRequirement\r\n && entries[i].startTime > this.fcp;\r\n this.totalBlockingTime += entrySatisfiesBlockingCriteria ? entries[i].duration : 0;\r\n this.tasks.push({startTime: entries[i].startTime,\r\n endTime: entries[i].startTime + entries[i].duration,\r\n entryType: PerformanceEntryType.LongTask} as TaskTiming);\r\n } else {\r\n this.tasks.push({startTime: entries[i].startTime,\r\n endTime: entries[i].startTime + entries[i].duration,\r\n entryType: PerformanceEntryType.Resource} as TaskTiming);\r\n }\r\n }\r\n });\r\n\r\n this.wacPo.observe({entryTypes: [PerformanceEntryType.LongTask, PerformanceEntryType.Resource]});\r\n }\r\n\r\n public static coreEnvironmentInitStarted(): void {\r\n performance.mark(PerformanceTracker.markCoreEnvironmentInitStarted);\r\n }\r\n\r\n public static coreEnvironmentInitCompleted(): void {\r\n performance.mark(PerformanceTracker.markCoreEnvironmentInitCompleted);\r\n }\r\n\r\n public static manifestLoadStarted(): void {\r\n performance.mark(PerformanceTracker.markManifestLoadStarted);\r\n }\r\n\r\n public static localizationStarted(): void {\r\n performance.mark(PerformanceTracker.markLocalizationStarted);\r\n }\r\n\r\n public static accessibilityManagerStarted(): void {\r\n performance.mark(PerformanceTracker.markAccessibilityManagerStarted);\r\n }\r\n\r\n public static appContextServiceStarted(): void {\r\n performance.mark(PerformanceTracker.markAppContextServiceStarted);\r\n }\r\n\r\n public static appContextRpcInitStarted(): void {\r\n performance.mark(PerformanceTracker.markAppContextRpcInitStarted);\r\n }\r\n\r\n public static appContextRpcInitComplete(): void {\r\n performance.mark(PerformanceTracker.markAppContextRpcInitComplete);\r\n }\r\n\r\n public static appModuleInitialized(): void {\r\n performance.mark(PerformanceTracker.markAppModuleInitialized);\r\n }\r\n\r\n public static appComponentInitialized(): void {\r\n performance.mark(PerformanceTracker.markAppComponentInitialized);\r\n PerformanceTracker.logAppComponentLoadTime();\r\n }\r\n\r\n public static navigationInitialized(): void {\r\n const navigationMarks = performance.getEntriesByType(PerformanceEntryType.Mark)\r\n .filter(e => e.name.startsWith(PerformanceTracker.smePrefix + 'Navigation'));\r\n // If we reinitialize navigation, clear all previous navigation marks.\r\n navigationMarks.forEach(m => { performance.clearMarks(m.name); });\r\n performance.mark(PerformanceTracker.markNavigationInitialized);\r\n }\r\n\r\n public static navigationStarted(): void {\r\n // clear previous marks prior to starting new navigation\r\n performance.clearMarks(PerformanceTracker.markNavigationStarted);\r\n performance.clearMarks(PerformanceTracker.markNavigationCompleted);\r\n\r\n performance.mark(PerformanceTracker.markNavigationStarted);\r\n }\r\n\r\n public static navigationCompleted(moduleOpened: boolean): void {\r\n // clear last measure b/c we are replacing.\r\n performance.clearMeasures(PerformanceTracker.markNavigationMeasure);\r\n\r\n // If the navigation via module open, set this flag so we can treat the criticalLoad differently than normal. We want to\r\n // separate this data b/c some modules have pivot tabs that can also trigger critical data loads multiple times.\r\n this.moduleOpening = moduleOpened;\r\n\r\n performance.mark(PerformanceTracker.markNavigationCompleted);\r\n performance.measure(PerformanceTracker.markNavigationMeasure,\r\n PerformanceTracker.markNavigationStarted,\r\n PerformanceTracker.markNavigationCompleted);\r\n\r\n // clear navigation start/end marks after we measure - only maintain one set of start/end to keep simple.\r\n performance.clearMarks(PerformanceTracker.markNavigationCompleted);\r\n performance.clearMarks(PerformanceTracker.markNavigationStarted);\r\n }\r\n\r\n public static criticalDataLoaded(): void {\r\n performance.mark(PerformanceTracker.markCriticalDataLoaded);\r\n PerformanceTracker.logCriticalDataLoadTime();\r\n }\r\n\r\n /**\r\n * Mark an arbitrary measurement with a label. Clear the previous mark(s) prior to starting new one - allow only one at\r\n * all times.\r\n * @param label The label for the mark and the index for the entry in the internal map.\r\n */\r\n public static markDataLoadStart(label: string) {\r\n const smeLabelString = `${PerformanceTracker.smePrefix}${label}`;\r\n\r\n // If we start, overwrite and clear existing entries.\r\n if (smeLabelString in this.dataLoadMap) {\r\n this.dataLoadMap[smeLabelString].forEach((mark) => {performance.clearMarks(mark.name); });\r\n }\r\n performance.mark(smeLabelString);\r\n // get latest one\r\n const startMark = performance.getEntriesByName(smeLabelString).slice(-1)[0];\r\n\r\n this.dataLoadMap[smeLabelString] = [startMark];\r\n }\r\n\r\n /**\r\n * Mark an arbitrary measurement with a label. Intended to be a midpoint between a start and end.\r\n * @param label The label for the entry in the data map.\r\n * @param specificLabel The label for the mark\r\n */\r\n public static markDataIntermediary(label: string, specificLabel?: string) {\r\n const smeLabelString = `${PerformanceTracker.smePrefix}${label}`;\r\n\r\n if (!(smeLabelString in this.dataLoadMap)) {\r\n return;\r\n }\r\n\r\n const intermediaryLabel = specificLabel ? `${PerformanceTracker.smePrefix}${specificLabel}`\r\n : `${PerformanceTracker.smePrefix}${label}-${this.dataLoadMap[smeLabelString].length + 1}`;\r\n\r\n performance.mark(intermediaryLabel);\r\n\r\n // get latest one\r\n const mark = performance.getEntriesByName(intermediaryLabel).slice(-1)[0];\r\n\r\n this.dataLoadMap[smeLabelString].push(mark);\r\n }\r\n\r\n /**\r\n * Get a summary object from the aggregate data points marked previously.\r\n * @param label The label for the entry in the data map dictionary\r\n * @param specificLabel The label for the new measurement\r\n * @returns The performance summary of the multiple marks.\r\n */\r\n public static markDataLoadEnd(label: string, specificLabel?: string): SmePerformanceSummary {\r\n const smeLabelString = `${PerformanceTracker.smePrefix}${label}`;\r\n\r\n if (!(smeLabelString in this.dataLoadMap)) {\r\n return null;\r\n }\r\n const dataEntry = this.dataLoadMap[smeLabelString];\r\n\r\n const intermediaryLabel = specificLabel ? `${PerformanceTracker.smePrefix}${specificLabel}`\r\n : `${PerformanceTracker.smePrefix}${label}-${dataEntry.length + 1}`;\r\n\r\n performance.mark(intermediaryLabel);\r\n // get latest one\r\n const endMark = performance.getEntriesByName(intermediaryLabel).slice(-1)[0];\r\n dataEntry.push(endMark);\r\n\r\n const startEntry = dataEntry[0];\r\n\r\n const totalLoadTime = endMark.startTime - startEntry.startTime;\r\n\r\n // remove SME prefix here\r\n const summary: SmePerformanceSummary = {\r\n label: label,\r\n timestamps: {},\r\n totalLoadTime: totalLoadTime,\r\n startTime: startEntry.startTime\r\n };\r\n\r\n dataEntry.forEach((mark: PerformanceEntry) => {\r\n performance.clearMarks(mark.name);\r\n summary.timestamps[mark.name.replace(PerformanceTracker.smePrefix, '')] = mark.startTime - startEntry.startTime;\r\n });\r\n\r\n delete this.dataLoadMap[smeLabelString];\r\n return summary;\r\n }\r\n\r\n /**\r\n * Log app component load time - this contains timings up to when the appComponent is loaded.\r\n */\r\n private static logAppComponentLoadTime(): void {\r\n const data: SmePerformanceData = {\r\n sme: {},\r\n resources: {},\r\n navigation: {},\r\n totalLoadTime: 0\r\n };\r\n\r\n /// dont include sme angular navigation marks in the generic data load\r\n const smeMarks = performance.getEntriesByType(PerformanceEntryType.Mark).filter(e => e.name.startsWith(PerformanceTracker.smePrefix)\r\n && !e.name.startsWith(PerformanceTracker.smePrefix + 'Navigation'));\r\n const resourceMarks = performance.getEntriesByType(PerformanceEntryType.Resource);\r\n smeMarks.forEach(m => {\r\n data.sme[m.name.replace(PerformanceTracker.smePrefix, '')] = m.startTime;\r\n performance.clearMarks(m.name);\r\n });\r\n resourceMarks.forEach((m: PerformanceResourceTiming) => {\r\n try {\r\n const url = new URL(m.name);\r\n data.resources[url.pathname] = m.duration;\r\n } catch (e) {\r\n data.resources[m.name] = m.duration;\r\n }\r\n performance.clearMarks(m.name);\r\n });\r\n data.totalLoadTime = data.sme[this.markAppComponentInitialized.replace(PerformanceTracker.smePrefix, '')];\r\n const navigationEntries = performance.getEntriesByType(PerformanceEntryType.Navigation);\r\n if (navigationEntries && navigationEntries.length) {\r\n data.navigation = navigationEntries[0];\r\n }\r\n\r\n SmeWebTelemetry.traceModuleOpenPerformance(data);\r\n }\r\n\r\n /**\r\n * Log critical data load time - this measures the time from angular's startNavigation event to a module to the point at\r\n * which criticalDataLoad() is called, usually in the ngInit of a module\r\n */\r\n private static logCriticalDataLoadTime(): void {\r\n const data: SmePerformanceData = {\r\n sme: {}, totalLoadTime: 0\r\n };\r\n\r\n // If there are multiple somehow, take the latest one\r\n const navigationMeasure = performance.getEntriesByName(PerformanceTracker.markNavigationMeasure).slice(-1)[0];\r\n const criticalData = performance.getEntriesByName(PerformanceTracker.markCriticalDataLoaded).slice(-1)[0];\r\n\r\n // clear performance marks either way - if they exist, we clear them. If not, clear b/c it's faulty data.\r\n performance.clearMeasures(PerformanceTracker.markNavigationMeasure);\r\n performance.clearMarks(PerformanceTracker.markCriticalDataLoaded);\r\n\r\n if (!navigationMeasure || !criticalData) {\r\n Logging.logInformational('PerformanceTracker',\r\n 'Critical data loaded without either criticalData call or navigationMeasure call');\r\n return;\r\n }\r\n data.sme.criticalDataLoadTime = criticalData.startTime - navigationMeasure.startTime;\r\n data.sme.navigationTime = navigationMeasure.duration;\r\n data.totalLoadTime = data.sme.criticalDataLoadTime;\r\n\r\n // If there are multiple somehow, take the latest one\r\n const navInitialized = performance.getEntriesByName(PerformanceTracker.markNavigationInitialized).slice(-1)[0];\r\n if (navInitialized) {\r\n data.sme.timeToFirstNavigateInit = navInitialized.startTime;\r\n data.sme.timeToFirstNavigateStart = navigationMeasure.startTime;\r\n data.sme.timeToFirstNavigateEnd = navigationMeasure.startTime + navigationMeasure.duration;\r\n data.sme.timeToFirstCriticalData = criticalData.startTime;\r\n\r\n data.totalLoadTime = criticalData.startTime; // overwrite if navInit is true.\r\n\r\n performance.clearMarks(navInitialized.name);\r\n }\r\n\r\n if (this.moduleOpening) {\r\n SmeWebTelemetry.traceModuleOpenPerformance(data);\r\n } else {\r\n SmeWebTelemetry.tracePerformanceData(data);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"sources":["../../../packages/core/performance/performance-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE;;GAEG;AACH,MAAM,OAAO,qBAAqB;CAKjC;AAED,MAAM,OAAO,kBAAkB;IACpB,MAAM,KAAK,SAAS;QACvB,OAAO,MAAM,CAAC;IAClB,CAAC;IA6BM,MAAM,CAAC,0BAA0B;QACpC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,8BAA8B,CAAC,CAAC;IACxE,CAAC;IAEM,MAAM,CAAC,4BAA4B;QACtC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;IAC1E,CAAC;IAEM,MAAM,CAAC,mBAAmB;QAC7B,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;IACjE,CAAC;IAEM,MAAM,CAAC,mBAAmB;QAC7B,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;IACjE,CAAC;IAEM,MAAM,CAAC,2BAA2B;QACrC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,+BAA+B,CAAC,CAAC;IACzE,CAAC;IAEM,MAAM,CAAC,wBAAwB;QAClC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,4BAA4B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AAkB,CAAC,SAAS,GAAG,sBAAsB,CAAC;AACjF,8CAA2B,GAAG,kBAAkB,CAAC,SAAS,GAAG,yBAAyB,CAAC;AAEvF,yCAAsB,GAAG,kBAAkB,CAAC,SAAS,GAAG,oBAAoB,CAAC;AAC7E,4CAAyB,GAAG,kBAAkB,CAAC,SAAS,GAAG,uBAAuB,CAAC;AACnF,wCAAqB,GAAG,kBAAkB,CAAC,SAAS,GAAG,mBAAmB,CAAC;AAC3E,0CAAuB,GAAG,kBAAkB,CAAC,SAAS,GAAG,qBAAqB,CAAC;AAC/E,wCAAqB,GAAG,kBAAkB,CAAC,SAAS,GAAG,mBAAmB,CAAC;AAE3E,gCAAa,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACY,8BAAW,GAA0C,EAAE,CAAC","file":"performance-tracker.js","sourcesContent":["import { Logging } from '../diagnostics/logging';\r\nimport { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';\r\nimport { SmePerformanceData } from '../diagnostics/sme-web-telemetry-models';\r\n\r\n/**\r\n * Summarizes a sequence of measurements\r\n */\r\nexport class SmePerformanceSummary {\r\n label: string;\r\n startTime: number;\r\n totalLoadTime: number;\r\n timestamps: { [index: string]: number };\r\n}\r\n\r\nexport class PerformanceTracker {\r\n public static get smePrefix(): string {\r\n return 'SME:';\r\n }\r\n // indexLoaded is logged by each extension when there index.html file starts executing code\r\n // The value itself is used, not the variable. This is kept here to have a complete list of sme marks used.\r\n private static markIndexLoaded = PerformanceTracker.smePrefix + 'IndexLoaded';\r\n private static markCoreEnvironmentInitStarted = PerformanceTracker.smePrefix + 'CoreEnvironmentInitializeStarted';\r\n private static markCoreEnvironmentInitCompleted = PerformanceTracker.smePrefix + 'CoreEnvironmentInitializeCompleted';\r\n private static markManifestLoadStarted = PerformanceTracker.smePrefix + 'ManifestLoadStarted';\r\n private static markLocalizationStarted = PerformanceTracker.smePrefix + 'LocalizationStarted';\r\n private static markAccessibilityManagerStarted = PerformanceTracker.smePrefix + 'AccessibilityManagerStarted';\r\n private static markAppContextServiceStarted = PerformanceTracker.smePrefix + 'AppContextServiceStarted';\r\n private static markAppContextRpcInitStarted = PerformanceTracker.smePrefix + 'AppContextRpcInitStarted';\r\n private static markAppContextRpcInitComplete = PerformanceTracker.smePrefix + 'AppContextRpcInitComplete';\r\n private static markAppModuleInitialized = PerformanceTracker.smePrefix + 'AppModuleInitialized';\r\n private static markAppComponentInitialized = PerformanceTracker.smePrefix + 'AppComponentInitialized';\r\n\r\n private static markCriticalDataLoaded = PerformanceTracker.smePrefix + 'CriticalDataLoaded';\r\n private static markNavigationInitialized = PerformanceTracker.smePrefix + 'NavigationInitialized';\r\n private static markNavigationStarted = PerformanceTracker.smePrefix + 'NavigationStarted';\r\n private static markNavigationCompleted = PerformanceTracker.smePrefix + 'NavigationCompleted';\r\n private static markNavigationMeasure = PerformanceTracker.smePrefix + 'NavigationMeasure';\r\n\r\n private static moduleOpening = true;\r\n\r\n /**\r\n * Used to keep track of various marks when measuring arbitrary timings.\r\n */\r\n private static dataLoadMap: {[index: string]: PerformanceEntry[]} = {};\r\n\r\n\r\n public static coreEnvironmentInitStarted(): void {\r\n performance.mark(PerformanceTracker.markCoreEnvironmentInitStarted);\r\n }\r\n\r\n public static coreEnvironmentInitCompleted(): void {\r\n performance.mark(PerformanceTracker.markCoreEnvironmentInitCompleted);\r\n }\r\n\r\n public static manifestLoadStarted(): void {\r\n performance.mark(PerformanceTracker.markManifestLoadStarted);\r\n }\r\n\r\n public static localizationStarted(): void {\r\n performance.mark(PerformanceTracker.markLocalizationStarted);\r\n }\r\n\r\n public static accessibilityManagerStarted(): void {\r\n performance.mark(PerformanceTracker.markAccessibilityManagerStarted);\r\n }\r\n\r\n public static appContextServiceStarted(): void {\r\n performance.mark(PerformanceTracker.markAppContextServiceStarted);\r\n }\r\n\r\n public static appContextRpcInitStarted(): void {\r\n performance.mark(PerformanceTracker.markAppContextRpcInitStarted);\r\n }\r\n\r\n public static appContextRpcInitComplete(): void {\r\n performance.mark(PerformanceTracker.markAppContextRpcInitComplete);\r\n }\r\n\r\n public static appModuleInitialized(): void {\r\n performance.mark(PerformanceTracker.markAppModuleInitialized);\r\n }\r\n\r\n public static appComponentInitialized(): void {\r\n performance.mark(PerformanceTracker.markAppComponentInitialized);\r\n PerformanceTracker.logAppComponentLoadTime();\r\n }\r\n\r\n public static navigationInitialized(): void {\r\n const navigationMarks = performance.getEntriesByType('mark')\r\n .filter(e => e.name.startsWith(PerformanceTracker.smePrefix + 'Navigation'));\r\n // If we reinitialize navigation, clear all previous navigation marks.\r\n navigationMarks.forEach(m => { performance.clearMarks(m.name); });\r\n performance.mark(PerformanceTracker.markNavigationInitialized);\r\n }\r\n\r\n public static navigationStarted(): void {\r\n // clear previous marks prior to starting new navigation\r\n performance.clearMarks(PerformanceTracker.markNavigationStarted);\r\n performance.clearMarks(PerformanceTracker.markNavigationCompleted);\r\n\r\n performance.mark(PerformanceTracker.markNavigationStarted);\r\n }\r\n\r\n public static navigationCompleted(moduleOpened: boolean): void {\r\n // clear last measure b/c we are replacing.\r\n performance.clearMeasures(PerformanceTracker.markNavigationMeasure);\r\n\r\n // If the navigation via module open, set this flag so we can treat the criticalLoad differently than normal. We want to\r\n // separate this data b/c some modules have pivot tabs that can also trigger critical data loads multiple times.\r\n this.moduleOpening = moduleOpened;\r\n\r\n performance.mark(PerformanceTracker.markNavigationCompleted);\r\n performance.measure(PerformanceTracker.markNavigationMeasure,\r\n PerformanceTracker.markNavigationStarted,\r\n PerformanceTracker.markNavigationCompleted);\r\n\r\n // clear navigation start/end marks after we measure - only maintain one set of start/end to keep simple.\r\n performance.clearMarks(PerformanceTracker.markNavigationCompleted);\r\n performance.clearMarks(PerformanceTracker.markNavigationStarted);\r\n }\r\n\r\n public static criticalDataLoaded(): void {\r\n performance.mark(PerformanceTracker.markCriticalDataLoaded);\r\n PerformanceTracker.logCriticalDataLoadTime();\r\n }\r\n\r\n /**\r\n * Mark an arbitrary measurement with a label. Clear the previous mark(s) prior to starting new one - allow only one at\r\n * all times.\r\n * @param label The label for the mark and the index for the entry in the internal map.\r\n */\r\n public static markDataLoadStart(label: string) {\r\n const smeLabelString = `${PerformanceTracker.smePrefix}${label}`;\r\n\r\n // If we start, overwrite and clear existing entries.\r\n if (smeLabelString in this.dataLoadMap) {\r\n this.dataLoadMap[smeLabelString].forEach((mark) => {performance.clearMarks(mark.name); });\r\n }\r\n performance.mark(smeLabelString);\r\n // get latest one\r\n const startMark = performance.getEntriesByName(smeLabelString).slice(-1)[0];\r\n\r\n this.dataLoadMap[smeLabelString] = [startMark];\r\n }\r\n\r\n /**\r\n * Mark an arbitrary measurement with a label. Intended to be a midpoint between a start and end.\r\n * @param label The label for the entry in the data map.\r\n * @param specificLabel The label for the mark\r\n */\r\n public static markDataIntermediary(label: string, specificLabel?: string) {\r\n const smeLabelString = `${PerformanceTracker.smePrefix}${label}`;\r\n\r\n if (!(smeLabelString in this.dataLoadMap)) {\r\n return;\r\n }\r\n\r\n const intermediaryLabel = specificLabel ? `${PerformanceTracker.smePrefix}${specificLabel}`\r\n : `${PerformanceTracker.smePrefix}${label}-${this.dataLoadMap[smeLabelString].length + 1}`;\r\n\r\n performance.mark(intermediaryLabel);\r\n\r\n // get latest one\r\n const mark = performance.getEntriesByName(intermediaryLabel).slice(-1)[0];\r\n\r\n this.dataLoadMap[smeLabelString].push(mark);\r\n }\r\n\r\n /**\r\n * Get a summary object from the aggregate data points marked previously.\r\n * @param label The label for the entry in the data map dictionary\r\n * @param specificLabel The label for the new measurement\r\n * @returns The performance summary of the multiple marks.\r\n */\r\n public static markDataLoadEnd(label: string, specificLabel?: string): SmePerformanceSummary {\r\n const smeLabelString = `${PerformanceTracker.smePrefix}${label}`;\r\n\r\n if (!(smeLabelString in this.dataLoadMap)) {\r\n return null;\r\n }\r\n const dataEntry = this.dataLoadMap[smeLabelString];\r\n\r\n const intermediaryLabel = specificLabel ? `${PerformanceTracker.smePrefix}${specificLabel}`\r\n : `${PerformanceTracker.smePrefix}${label}-${dataEntry.length + 1}`;\r\n\r\n performance.mark(intermediaryLabel);\r\n // get latest one\r\n const endMark = performance.getEntriesByName(intermediaryLabel).slice(-1)[0];\r\n dataEntry.push(endMark);\r\n\r\n const startEntry = dataEntry[0];\r\n\r\n const totalLoadTime = endMark.startTime - startEntry.startTime;\r\n\r\n // remove SME prefix here\r\n const summary: SmePerformanceSummary = {\r\n label: label,\r\n timestamps: {},\r\n totalLoadTime: totalLoadTime,\r\n startTime: startEntry.startTime\r\n };\r\n\r\n dataEntry.forEach((mark: PerformanceEntry) => {\r\n performance.clearMarks(mark.name);\r\n summary.timestamps[mark.name.replace(PerformanceTracker.smePrefix, '')] = mark.startTime - startEntry.startTime;\r\n });\r\n\r\n delete this.dataLoadMap[smeLabelString];\r\n return summary;\r\n }\r\n\r\n /**\r\n * Log app component load time - this contains timings up to when the appComponent is loaded.\r\n */\r\n private static logAppComponentLoadTime(): void {\r\n const data: SmePerformanceData = {\r\n sme: {},\r\n resources: {},\r\n navigation: {},\r\n totalLoadTime: 0\r\n };\r\n\r\n /// dont include sme angular navigation marks in the generic data load\r\n const smeMarks = performance.getEntriesByType('mark').filter(e => e.name.startsWith(PerformanceTracker.smePrefix)\r\n && !e.name.startsWith(PerformanceTracker.smePrefix + 'Navigation'));\r\n const resourceMarks = performance.getEntriesByType('resource');\r\n smeMarks.forEach(m => {\r\n data.sme[m.name.replace(PerformanceTracker.smePrefix, '')] = m.startTime;\r\n performance.clearMarks(m.name);\r\n });\r\n resourceMarks.forEach((m: PerformanceResourceTiming) => {\r\n try {\r\n const url = new URL(m.name);\r\n data.resources[url.pathname] = m.duration;\r\n } catch (e) {\r\n data.resources[m.name] = m.duration;\r\n }\r\n performance.clearMarks(m.name);\r\n });\r\n data.totalLoadTime = data.sme[this.markAppComponentInitialized.replace(PerformanceTracker.smePrefix, '')];\r\n const navigationEntries = performance.getEntriesByType('navigation');\r\n if (navigationEntries && navigationEntries.length) {\r\n data.navigation = navigationEntries[0];\r\n }\r\n\r\n SmeWebTelemetry.traceModuleOpenPerformance(data);\r\n }\r\n\r\n /**\r\n * Log critical data load time - this measures the time from angular's startNavigation event to a module to the point at\r\n * which criticalDataLoad() is called, usually in the ngInit of a module\r\n */\r\n private static logCriticalDataLoadTime(): void {\r\n const data: SmePerformanceData = {\r\n sme: {}, totalLoadTime: 0\r\n };\r\n\r\n // If there are multiple somehow, take the latest one\r\n const navigationMeasure = performance.getEntriesByName(PerformanceTracker.markNavigationMeasure).slice(-1)[0];\r\n const criticalData = performance.getEntriesByName(PerformanceTracker.markCriticalDataLoaded).slice(-1)[0];\r\n\r\n // clear performance marks either way - if they exist, we clear them. If not, clear b/c it's faulty data.\r\n performance.clearMeasures(PerformanceTracker.markNavigationMeasure);\r\n performance.clearMarks(PerformanceTracker.markCriticalDataLoaded);\r\n\r\n if (!navigationMeasure || !criticalData) {\r\n Logging.logInformational('PerformanceTracker',\r\n 'Critical data loaded without either criticalData call or navigationMeasure call');\r\n return;\r\n }\r\n data.sme.criticalDataLoadTime = criticalData.startTime - navigationMeasure.startTime;\r\n data.sme.navigationTime = navigationMeasure.duration;\r\n data.totalLoadTime = data.sme.criticalDataLoadTime;\r\n\r\n // If there are multiple somehow, take the latest one\r\n const navInitialized = performance.getEntriesByName(PerformanceTracker.markNavigationInitialized).slice(-1)[0];\r\n if (navInitialized) {\r\n data.sme.timeToFirstNavigateInit = navInitialized.startTime;\r\n data.sme.timeToFirstNavigateStart = navigationMeasure.startTime;\r\n data.sme.timeToFirstNavigateEnd = navigationMeasure.startTime + navigationMeasure.duration;\r\n data.sme.timeToFirstCriticalData = criticalData.startTime;\r\n\r\n data.totalLoadTime = criticalData.startTime; // overwrite if navInit is true.\r\n\r\n performance.clearMarks(navInitialized.name);\r\n }\r\n\r\n if (this.moduleOpening) {\r\n SmeWebTelemetry.traceModuleOpenPerformance(data);\r\n } else {\r\n SmeWebTelemetry.tracePerformanceData(data);\r\n }\r\n }\r\n}\r\n"]}
@@ -1,4 +1,3 @@
1
- import { NodeRequestOptions } from '../../data/node-connection';
2
1
  import { RpcBaseData } from '../rpc-base';
3
2
  /**
4
3
  * CredSSP request Rpc call name and version.
@@ -30,16 +29,6 @@ export interface ConfigurationStatus {
30
29
  client?: ClientRoleConfiguration;
31
30
  servers?: ServerRoleConfiguration[];
32
31
  }
33
- export interface GatewayLocalPowerShellConfig {
34
- /**
35
- * Server configured for executing cluster operations.
36
- */
37
- configuredServerConnectionString: string;
38
- /**
39
- * PowerShell session options to run with cluster operations.
40
- */
41
- powerShellOptions: NodeRequestOptions;
42
- }
43
32
  /**
44
33
  * Identifies the CredSSP operation type to preform
45
34
  */
@@ -83,13 +72,7 @@ export declare enum RpcCredSSPOperationType {
83
72
  * Confirm the CredSSP client configuration on the gateway, and confirm the CredSSP server
84
73
  * configuration to the managed server.
85
74
  */
86
- ConfirmDelegation = 8,
87
- /**
88
- * Configure CredSSP server role on a given server and enable gateway to delegate to managed server
89
- * if gateway machine is not given. Otherwise, do nothing. Return configured server name and
90
- * PowerShell options needed for proceeding invoke PowerShell calls.
91
- */
92
- TryGatewayLocalPowerShellConfig = 9
75
+ ConfirmDelegation = 8
93
76
  }
94
77
  /**
95
78
  * Explicit credentials i.e username andd password
@@ -151,10 +134,6 @@ export interface RpcCredSSPOperationResult {
151
134
  * Solution to error if any.
152
135
  */
153
136
  solutionMessage?: string;
154
- /**
155
- * Data to return if any.
156
- */
157
- data?: GatewayLocalPowerShellConfig;
158
137
  /**
159
138
  * CredSSP configuration information of the client/server.
160
139
  */
@@ -171,9 +150,5 @@ export declare enum RpcCredSSPOperationResultMember {
171
150
  /**
172
151
  * "configurationData" member of operation result interface.
173
152
  */
174
- ConfigurationStatus = "configurationStatus",
175
- /**
176
- * "data" member of operation result interface.
177
- */
178
- Data = "data"
153
+ ConfigurationStatus = "configurationStatus"
179
154
  }
@@ -57,12 +57,6 @@ export var RpcCredSSPOperationType;
57
57
  * configuration to the managed server.
58
58
  */
59
59
  RpcCredSSPOperationType[RpcCredSSPOperationType["ConfirmDelegation"] = 8] = "ConfirmDelegation";
60
- /**
61
- * Configure CredSSP server role on a given server and enable gateway to delegate to managed server
62
- * if gateway machine is not given. Otherwise, do nothing. Return configured server name and
63
- * PowerShell options needed for proceeding invoke PowerShell calls.
64
- */
65
- RpcCredSSPOperationType[RpcCredSSPOperationType["TryGatewayLocalPowerShellConfig"] = 9] = "TryGatewayLocalPowerShellConfig";
66
60
  })(RpcCredSSPOperationType || (RpcCredSSPOperationType = {}));
67
61
  /**
68
62
  * CredSSP operation result returnable members.
@@ -77,10 +71,6 @@ export var RpcCredSSPOperationResultMember;
77
71
  * "configurationData" member of operation result interface.
78
72
  */
79
73
  RpcCredSSPOperationResultMember["ConfigurationStatus"] = "configurationStatus";
80
- /**
81
- * "data" member of operation result interface.
82
- */
83
- RpcCredSSPOperationResultMember["Data"] = "data";
84
74
  })(RpcCredSSPOperationResultMember || (RpcCredSSPOperationResultMember = {}));
85
75
 
86
76
  //# sourceMappingURL=rpc-credssp-model.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../packages/core/rpc/credssp/rpc-credssp-model.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,oBAAoB;;AACf,4BAAO,GAAG,gBAAgB,CAAC;AAC3B,4BAAO,GAAG,OAAO,CAAC;AAGpC;;GAEG;AACH,MAAM,OAAO,qBAAqB;;AAChB,6BAAO,GAAG,SAAS,CAAC;AACpB,6BAAO,GAAG,OAAO,CAAC;AAkCpC;;GAEG;AACH,MAAM,CAAN,IAAY,uBAuDX;AAvDD,WAAY,uBAAuB;IAC/B;;OAEG;IACH,mGAAuB,CAAA;IAEvB;;OAEG;IACH,qGAAwB,CAAA;IAExB;;OAEG;IACH,6FAAoB,CAAA;IAEpB;;OAEG;IACH,+FAAqB,CAAA;IAErB;;;OAGG;IACH,6FAAoB,CAAA;IAEpB;;;OAGG;IACH,mFAAe,CAAA;IAEf;;;OAGG;IACH,iHAA8B,CAAA;IAE9B;;OAEG;IACH,+HAAqC,CAAA;IAErC;;;OAGG;IACH,+FAAqB,CAAA;IACrB;;;;OAIG;IACH,2HAAmC,CAAA;AACvC,CAAC,EAvDW,uBAAuB,KAAvB,uBAAuB,QAuDlC;AAoFD;;GAEG;AACH,MAAM,CAAN,IAAY,+BAeX;AAfD,WAAY,+BAA+B;IACvC;;OAEG;IACH,0DAAuB,CAAA;IAEvB;;OAEG;IACH,8EAA2C,CAAA;IAE3C;;OAEG;IACH,gDAAa,CAAA;AACjB,CAAC,EAfW,+BAA+B,KAA/B,+BAA+B,QAe1C","file":"rpc-credssp-model.js","sourcesContent":["import { NodeRequestOptions } from '../../data/node-connection';\r\nimport { RpcBaseData } from '../rpc-base';\r\n\r\n/**\r\n * CredSSP request Rpc call name and version.\r\n */\r\nexport class RpcCredSspRequestKey {\r\n public static command = 'CredSspRequest';\r\n public static version = '0.1.0';\r\n}\r\n\r\n/**\r\n * CredSSP response Rpc call name and version\r\n */\r\nexport class RpcCredSspResponseKey {\r\n public static command = 'CredSsp';\r\n public static version = '0.1.0';\r\n}\r\n\r\nexport interface ServerRoleConfiguration {\r\n ServerName: string;\r\n IsServerConfiguredAsServerRole: boolean;\r\n}\r\n\r\nexport interface ClientRoleConfiguration {\r\n IsGatewayConfiguredAsClientRole: boolean;\r\n AllowFreshCredentialsKeyPresent: boolean;\r\n AllowFreshCredentialsWhenNTLMOnlyKeyPresent: boolean;\r\n AllowFreshCredentialsDelegatableServers: string[];\r\n AllowFreshCredentialsWhenNTLMOnlyDelegatableServers: string[];\r\n NotDelegatableServers: string[];\r\n}\r\n\r\nexport interface ConfigurationStatus {\r\n client?: ClientRoleConfiguration;\r\n servers?: ServerRoleConfiguration[];\r\n}\r\n\r\nexport interface GatewayLocalPowerShellConfig {\r\n /**\r\n * Server configured for executing cluster operations.\r\n */\r\n configuredServerConnectionString: string;\r\n\r\n /**\r\n * PowerShell session options to run with cluster operations.\r\n */\r\n powerShellOptions: NodeRequestOptions;\r\n}\r\n\r\n/**\r\n * Identifies the CredSSP operation type to preform\r\n */\r\nexport enum RpcCredSSPOperationType {\r\n /**\r\n * Enable CredSSP Server role on the managed server.\r\n */\r\n EnableManagedServer = 0,\r\n\r\n /**\r\n * Disable CredSSP Server role on the managed server.\r\n */\r\n DisableManagedServer = 1,\r\n\r\n /**\r\n * Enable CredSSP client role on the gateway and delegate to the list ot servers.\r\n */\r\n EnableClientRole = 2,\r\n\r\n /**\r\n * Disable CredSSP client role on the gateway and remove all delegated servers.\r\n */\r\n DisableClientRole = 3,\r\n\r\n /**\r\n * Enable CredSSP Server role on the managed server, and enable the gateway to\r\n * delegate to the managed server.\r\n */\r\n EnableDelegation = 4,\r\n\r\n /**\r\n * Test that CredSSP connection from gateway to server(s) is enabled. To function as verification mechanism\r\n * that CredSSP is bound to work.\r\n */\r\n TestCredSSP = 5,\r\n\r\n /**\r\n * Confirm the CredSSP client configuration on the gateway machine and the list of servers\r\n * that can be delegated fresh credentials from the gateway.\r\n */\r\n ConfirmClientConfiguration = 6,\r\n\r\n /**\r\n * Confirm the CredSSP server configuration on the managed server.\r\n */\r\n ConfirmManagedServerConfiguration = 7,\r\n\r\n /**\r\n * Confirm the CredSSP client configuration on the gateway, and confirm the CredSSP server\r\n * configuration to the managed server.\r\n */\r\n ConfirmDelegation = 8,\r\n /**\r\n * Configure CredSSP server role on a given server and enable gateway to delegate to managed server\r\n * if gateway machine is not given. Otherwise, do nothing. Return configured server name and\r\n * PowerShell options needed for proceeding invoke PowerShell calls.\r\n */\r\n TryGatewayLocalPowerShellConfig = 9\r\n}\r\n\r\n/**\r\n * Explicit credentials i.e username andd password\r\n */\r\nexport interface Credentials {\r\n username: string;\r\n password: string;\r\n}\r\n\r\n/**\r\n * CredSSP Manager operation/action RPC message.\r\n */\r\nexport interface RpcCredSSPOperation extends RpcBaseData {\r\n /**\r\n * Request specific Id to track completion.\r\n */\r\n requestId: string;\r\n\r\n /**\r\n * Type of CredSSP operation to perform\r\n */\r\n operation: RpcCredSSPOperationType;\r\n\r\n /**\r\n * @deprecated\r\n * The contextual scenario title to be used when showing notifications.\r\n */\r\n notificationTitle: string;\r\n\r\n /**\r\n * The server names to use in this request. Can be a single server for role server\r\n * or a list of servers for role client.\r\n */\r\n serverNames: string[];\r\n\r\n /***\r\n * Authentication options, need the username and password here\r\n */\r\n credentials?: Credentials;\r\n\r\n /**\r\n * @deprecated\r\n * Optional notification Id to be used when showing notifications. This will allow notifications\r\n * from the caller and from CredSSP to be merged in the notification center.\r\n */\r\n notificationId?: string;\r\n}\r\n\r\n/**\r\n * CredSSP Manager operation/action RPC message result.\r\n */\r\nexport interface RpcCredSSPOperationResult {\r\n /**\r\n * Request specific Id to track completion.\r\n */\r\n requestId: string;\r\n\r\n /**\r\n * Did the requested operation succeed or not?\r\n */\r\n succeeded: boolean;\r\n\r\n /**\r\n * Error message if any.\r\n */\r\n error?: string;\r\n\r\n /**\r\n * Solution to error if any.\r\n */\r\n solutionMessage?: string;\r\n\r\n /**\r\n * Data to return if any.\r\n */\r\n data?: GatewayLocalPowerShellConfig;\r\n\r\n /**\r\n * CredSSP configuration information of the client/server.\r\n */\r\n configurationStatus?: ConfigurationStatus;\r\n}\r\n\r\n/**\r\n * CredSSP operation result returnable members.\r\n */\r\nexport enum RpcCredSSPOperationResultMember {\r\n /**\r\n * \"Succeeded\" member of operation result interface.\r\n */\r\n Succeeded = 'succeeded',\r\n\r\n /**\r\n * \"configurationData\" member of operation result interface.\r\n */\r\n ConfigurationStatus = 'configurationStatus',\r\n\r\n /**\r\n * \"data\" member of operation result interface.\r\n */\r\n Data = 'data'\r\n}\r\n"]}
1
+ {"version":3,"sources":["../../../packages/core/rpc/credssp/rpc-credssp-model.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,oBAAoB;;AACf,4BAAO,GAAG,gBAAgB,CAAC;AAC3B,4BAAO,GAAG,OAAO,CAAC;AAGpC;;GAEG;AACH,MAAM,OAAO,qBAAqB;;AAChB,6BAAO,GAAG,SAAS,CAAC;AACpB,6BAAO,GAAG,OAAO,CAAC;AAsBpC;;GAEG;AACH,MAAM,CAAN,IAAY,uBAiDX;AAjDD,WAAY,uBAAuB;IAC/B;;OAEG;IACH,mGAAuB,CAAA;IAEvB;;OAEG;IACH,qGAAwB,CAAA;IAExB;;OAEG;IACH,6FAAoB,CAAA;IAEpB;;OAEG;IACH,+FAAqB,CAAA;IAErB;;;OAGG;IACH,6FAAoB,CAAA;IAEpB;;;OAGG;IACH,mFAAe,CAAA;IAEf;;;OAGG;IACH,iHAA8B,CAAA;IAE9B;;OAEG;IACH,+HAAqC,CAAA;IAErC;;;OAGG;IACH,+FAAqB,CAAA;AACzB,CAAC,EAjDW,uBAAuB,KAAvB,uBAAuB,QAiDlC;AA+ED;;GAEG;AACH,MAAM,CAAN,IAAY,+BAUX;AAVD,WAAY,+BAA+B;IACvC;;OAEG;IACH,0DAAuB,CAAA;IAEvB;;OAEG;IACH,8EAA2C,CAAA;AAC/C,CAAC,EAVW,+BAA+B,KAA/B,+BAA+B,QAU1C","file":"rpc-credssp-model.js","sourcesContent":["import { RpcBaseData } from '../rpc-base';\r\n\r\n/**\r\n * CredSSP request Rpc call name and version.\r\n */\r\nexport class RpcCredSspRequestKey {\r\n public static command = 'CredSspRequest';\r\n public static version = '0.1.0';\r\n}\r\n\r\n/**\r\n * CredSSP response Rpc call name and version\r\n */\r\nexport class RpcCredSspResponseKey {\r\n public static command = 'CredSsp';\r\n public static version = '0.1.0';\r\n}\r\n\r\nexport interface ServerRoleConfiguration {\r\n ServerName: string;\r\n IsServerConfiguredAsServerRole: boolean;\r\n}\r\n\r\nexport interface ClientRoleConfiguration {\r\n IsGatewayConfiguredAsClientRole: boolean;\r\n AllowFreshCredentialsKeyPresent: boolean;\r\n AllowFreshCredentialsWhenNTLMOnlyKeyPresent: boolean;\r\n AllowFreshCredentialsDelegatableServers: string[];\r\n AllowFreshCredentialsWhenNTLMOnlyDelegatableServers: string[];\r\n NotDelegatableServers: string[];\r\n}\r\n\r\nexport interface ConfigurationStatus {\r\n client?: ClientRoleConfiguration;\r\n servers?: ServerRoleConfiguration[];\r\n}\r\n\r\n/**\r\n * Identifies the CredSSP operation type to preform\r\n */\r\nexport enum RpcCredSSPOperationType {\r\n /**\r\n * Enable CredSSP Server role on the managed server.\r\n */\r\n EnableManagedServer = 0,\r\n\r\n /**\r\n * Disable CredSSP Server role on the managed server.\r\n */\r\n DisableManagedServer = 1,\r\n\r\n /**\r\n * Enable CredSSP client role on the gateway and delegate to the list ot servers.\r\n */\r\n EnableClientRole = 2,\r\n\r\n /**\r\n * Disable CredSSP client role on the gateway and remove all delegated servers.\r\n */\r\n DisableClientRole = 3,\r\n\r\n /**\r\n * Enable CredSSP Server role on the managed server, and enable the gateway to\r\n * delegate to the managed server.\r\n */\r\n EnableDelegation = 4,\r\n\r\n /**\r\n * Test that CredSSP connection from gateway to server(s) is enabled. To function as verification mechanism\r\n * that CredSSP is bound to work.\r\n */\r\n TestCredSSP = 5,\r\n\r\n /**\r\n * Confirm the CredSSP client configuration on the gateway machine and the list of servers\r\n * that can be delegated fresh credentials from the gateway.\r\n */\r\n ConfirmClientConfiguration = 6,\r\n\r\n /**\r\n * Confirm the CredSSP server configuration on the managed server.\r\n */\r\n ConfirmManagedServerConfiguration = 7,\r\n\r\n /**\r\n * Confirm the CredSSP client configuration on the gateway, and confirm the CredSSP server\r\n * configuration to the managed server.\r\n */\r\n ConfirmDelegation = 8\r\n}\r\n\r\n/**\r\n * Explicit credentials i.e username andd password\r\n */\r\nexport interface Credentials {\r\n username: string;\r\n password: string;\r\n}\r\n\r\n/**\r\n * CredSSP Manager operation/action RPC message.\r\n */\r\nexport interface RpcCredSSPOperation extends RpcBaseData {\r\n /**\r\n * Request specific Id to track completion.\r\n */\r\n requestId: string;\r\n\r\n /**\r\n * Type of CredSSP operation to perform\r\n */\r\n operation: RpcCredSSPOperationType;\r\n\r\n /**\r\n * @deprecated\r\n * The contextual scenario title to be used when showing notifications.\r\n */\r\n notificationTitle: string;\r\n\r\n /**\r\n * The server names to use in this request. Can be a single server for role server\r\n * or a list of servers for role client.\r\n */\r\n serverNames: string[];\r\n\r\n /***\r\n * Authentication options, need the username and password here\r\n */\r\n credentials?: Credentials;\r\n\r\n /**\r\n * @deprecated\r\n * Optional notification Id to be used when showing notifications. This will allow notifications\r\n * from the caller and from CredSSP to be merged in the notification center.\r\n */\r\n notificationId?: string;\r\n}\r\n\r\n/**\r\n * CredSSP Manager operation/action RPC message result.\r\n */\r\nexport interface RpcCredSSPOperationResult {\r\n /**\r\n * Request specific Id to track completion.\r\n */\r\n requestId: string;\r\n\r\n /**\r\n * Did the requested operation succeed or not?\r\n */\r\n succeeded: boolean;\r\n\r\n /**\r\n * Error message if any.\r\n */\r\n error?: string;\r\n\r\n /**\r\n * Solution to error if any.\r\n */\r\n solutionMessage?: string;\r\n\r\n /**\r\n * CredSSP configuration information of the client/server.\r\n */\r\n configurationStatus?: ConfigurationStatus;\r\n}\r\n\r\n/**\r\n * CredSSP operation result returnable members.\r\n */\r\nexport enum RpcCredSSPOperationResultMember {\r\n /**\r\n * \"Succeeded\" member of operation result interface.\r\n */\r\n Succeeded = 'succeeded',\r\n\r\n /**\r\n * \"configurationData\" member of operation result interface.\r\n */\r\n ConfigurationStatus = 'configurationStatus'\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ClientRoleConfiguration, ConfigurationStatus, Credentials, GatewayLocalPowerShellConfig, ServerRoleConfiguration } from '../rpc/credssp/rpc-credssp-model';
2
+ import { ClientRoleConfiguration, ConfigurationStatus, Credentials, ServerRoleConfiguration } from '../rpc/credssp/rpc-credssp-model';
3
3
  import { Rpc } from '../rpc/rpc';
4
4
  /**
5
5
  * CredSPP Manager class. Handles detecting and configuring CredSSP on a set of servers.
@@ -43,26 +43,12 @@ export declare class CredSSPManager {
43
43
  */
44
44
  wsmanDisableClientRole(serverNames: string[], verbose?: boolean): Observable<boolean>;
45
45
  /**
46
- * @deprecated
47
- * Use tryGatewayLocalPowershellConfig instead which will only enable CredSSP when the gateway is making
48
- * a double hop to a remote node. This method will enable CredSSP every time, even in cases where
49
- * it is not needed.
50
- *
51
46
  * New Enable the server as a CredSSP server, and enable the gateway as a CredSSP client of the server.
52
47
  *
53
48
  * @param serverName The server where CredSSP delegation should be enabled
54
49
  * @param verbose (Optional) Specify whether a solution (if any) should be returned if CredSSP errored
55
50
  */
56
51
  wsmanEnableDelegation(serverName: string, verbose?: boolean): Observable<boolean>;
57
- /**
58
- * Check to see if given servers contain the gateway machine. If not, enable CredSSP, otherwise, do nothing.
59
- *
60
- * @param serverNames String array of server names to check for a match with the gateway server name.
61
- * If not found, CredSSP will be enabled between the gateway machine and the server name at index 0.
62
- * @param verbose (Optional) Specify whether a solution (if any) should be returned if CredSSP errored.
63
- * @returns GatewayLocalPowerShellConfig object if success, null otherwise.
64
- */
65
- tryGatewayLocalPowerShellConfig(serverNames: string[], verbose?: boolean): Observable<GatewayLocalPowerShellConfig>;
66
52
  /**
67
53
  * Test WSMan CredSSP connection from gateway to server(s)
68
54
  *
@@ -108,11 +108,6 @@ export class CredSSPManager {
108
108
  }, verbose, RpcCredSSPOperationResultMember.Succeeded);
109
109
  }
110
110
  /**
111
- * @deprecated
112
- * Use tryGatewayLocalPowershellConfig instead which will only enable CredSSP when the gateway is making
113
- * a double hop to a remote node. This method will enable CredSSP every time, even in cases where
114
- * it is not needed.
115
- *
116
111
  * New Enable the server as a CredSSP server, and enable the gateway as a CredSSP client of the server.
117
112
  *
118
113
  * @param serverName The server where CredSSP delegation should be enabled
@@ -133,29 +128,6 @@ export class CredSSPManager {
133
128
  notificationId: null
134
129
  }, verbose, RpcCredSSPOperationResultMember.Succeeded);
135
130
  }
136
- /**
137
- * Check to see if given servers contain the gateway machine. If not, enable CredSSP, otherwise, do nothing.
138
- *
139
- * @param serverNames String array of server names to check for a match with the gateway server name.
140
- * If not found, CredSSP will be enabled between the gateway machine and the server name at index 0.
141
- * @param verbose (Optional) Specify whether a solution (if any) should be returned if CredSSP errored.
142
- * @returns GatewayLocalPowerShellConfig object if success, null otherwise.
143
- */
144
- tryGatewayLocalPowerShellConfig(serverNames, verbose = false) {
145
- if (this.rpc.isShell) {
146
- throw new Error('Not supported on the shell environment.');
147
- }
148
- if (serverNames.length === 0 || serverNames.some(serverName => MsftSme.isNullOrWhiteSpace(serverName))) {
149
- throw new Error('The server name(s) must be provided.');
150
- }
151
- return this.sendRequest({
152
- requestId: MsftSme.getUniqueId(),
153
- operation: RpcCredSSPOperationType.TryGatewayLocalPowerShellConfig,
154
- serverNames: serverNames,
155
- notificationTitle: null,
156
- notificationId: null
157
- }, verbose, RpcCredSSPOperationResultMember.Data);
158
- }
159
131
  /**
160
132
  * Test WSMan CredSSP connection from gateway to server(s)
161
133
  *