@tontoko/fast-playwright-mcp 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +1047 -0
- package/cli.js +18 -0
- package/config.d.ts +124 -0
- package/index.d.ts +25 -0
- package/index.js +18 -0
- package/lib/actions.d.js +0 -0
- package/lib/batch/batch-executor.js +137 -0
- package/lib/browser-context-factory.js +252 -0
- package/lib/browser-server-backend.js +139 -0
- package/lib/config/constants.js +80 -0
- package/lib/config.js +405 -0
- package/lib/context.js +274 -0
- package/lib/diagnostics/common/diagnostic-base.js +63 -0
- package/lib/diagnostics/common/error-enrichment-utils.js +212 -0
- package/lib/diagnostics/common/index.js +56 -0
- package/lib/diagnostics/common/initialization-manager.js +210 -0
- package/lib/diagnostics/common/performance-tracker.js +132 -0
- package/lib/diagnostics/diagnostic-error.js +140 -0
- package/lib/diagnostics/diagnostic-level.js +123 -0
- package/lib/diagnostics/diagnostic-thresholds.js +347 -0
- package/lib/diagnostics/element-discovery.js +441 -0
- package/lib/diagnostics/enhanced-error-handler.js +376 -0
- package/lib/diagnostics/error-enrichment.js +157 -0
- package/lib/diagnostics/frame-reference-manager.js +179 -0
- package/lib/diagnostics/page-analyzer.js +639 -0
- package/lib/diagnostics/parallel-page-analyzer.js +129 -0
- package/lib/diagnostics/resource-manager.js +134 -0
- package/lib/diagnostics/smart-config.js +482 -0
- package/lib/diagnostics/smart-handle.js +118 -0
- package/lib/diagnostics/unified-system.js +717 -0
- package/lib/extension/cdp-relay.js +486 -0
- package/lib/extension/extension-context-factory.js +74 -0
- package/lib/extension/main.js +41 -0
- package/lib/file-utils.js +42 -0
- package/lib/generate-keys.js +75 -0
- package/lib/http-server.js +50 -0
- package/lib/in-process-client.js +64 -0
- package/lib/index.js +48 -0
- package/lib/javascript.js +90 -0
- package/lib/log.js +33 -0
- package/lib/loop/loop-claude.js +247 -0
- package/lib/loop/loop-open-ai.js +222 -0
- package/lib/loop/loop.js +174 -0
- package/lib/loop/main.js +46 -0
- package/lib/loopTools/context.js +76 -0
- package/lib/loopTools/main.js +65 -0
- package/lib/loopTools/perform.js +40 -0
- package/lib/loopTools/snapshot.js +37 -0
- package/lib/loopTools/tool.js +26 -0
- package/lib/manual-promise.js +125 -0
- package/lib/mcp/in-process-transport.js +91 -0
- package/lib/mcp/proxy-backend.js +127 -0
- package/lib/mcp/server.js +123 -0
- package/lib/mcp/transport.js +159 -0
- package/lib/package.js +28 -0
- package/lib/program.js +82 -0
- package/lib/response.js +493 -0
- package/lib/schemas/expectation.js +152 -0
- package/lib/session-log.js +210 -0
- package/lib/tab.js +417 -0
- package/lib/tools/base-tool-handler.js +141 -0
- package/lib/tools/batch-execute.js +150 -0
- package/lib/tools/common.js +65 -0
- package/lib/tools/console.js +60 -0
- package/lib/tools/diagnose/diagnose-analysis-runner.js +101 -0
- package/lib/tools/diagnose/diagnose-config-handler.js +130 -0
- package/lib/tools/diagnose/diagnose-report-builder.js +394 -0
- package/lib/tools/diagnose.js +147 -0
- package/lib/tools/dialogs.js +57 -0
- package/lib/tools/evaluate.js +67 -0
- package/lib/tools/files.js +53 -0
- package/lib/tools/find-elements.js +307 -0
- package/lib/tools/install.js +60 -0
- package/lib/tools/keyboard.js +93 -0
- package/lib/tools/mouse.js +110 -0
- package/lib/tools/navigate.js +82 -0
- package/lib/tools/network.js +50 -0
- package/lib/tools/pdf.js +46 -0
- package/lib/tools/screenshot.js +113 -0
- package/lib/tools/snapshot.js +158 -0
- package/lib/tools/tabs.js +97 -0
- package/lib/tools/tool.js +47 -0
- package/lib/tools/utils.js +131 -0
- package/lib/tools/wait.js +64 -0
- package/lib/tools.js +65 -0
- package/lib/types/batch.js +47 -0
- package/lib/types/diff.js +0 -0
- package/lib/types/performance.js +0 -0
- package/lib/types/threshold-base.js +0 -0
- package/lib/utils/array-utils.js +44 -0
- package/lib/utils/code-deduplication-utils.js +141 -0
- package/lib/utils/common-formatters.js +252 -0
- package/lib/utils/console-filter.js +64 -0
- package/lib/utils/diagnostic-report-utils.js +178 -0
- package/lib/utils/diff-formatter.js +126 -0
- package/lib/utils/disposable-manager.js +135 -0
- package/lib/utils/error-handler-middleware.js +77 -0
- package/lib/utils/image-processor.js +137 -0
- package/lib/utils/index.js +92 -0
- package/lib/utils/report-builder.js +189 -0
- package/lib/utils/request-logger.js +82 -0
- package/lib/utils/response-diff-detector.js +150 -0
- package/lib/utils/section-builder.js +62 -0
- package/lib/utils/tool-patterns.js +153 -0
- package/lib/utils.js +46 -0
- package/package.json +77 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
19
|
+
|
|
20
|
+
// src/diagnostics/diagnostic-thresholds.ts
|
|
21
|
+
import { THRESHOLDS, TIMEOUTS } from "../config/constants.js";
|
|
22
|
+
var DEFAULT_THRESHOLDS = {
|
|
23
|
+
executionTime: {
|
|
24
|
+
pageAnalysis: TIMEOUTS.PAGE_ANALYSIS_TIMEOUT,
|
|
25
|
+
elementDiscovery: TIMEOUTS.ELEMENT_DISCOVERY_TIMEOUT,
|
|
26
|
+
resourceMonitoring: 200,
|
|
27
|
+
parallelAnalysis: TIMEOUTS.PARALLEL_ANALYSIS_TIMEOUT
|
|
28
|
+
},
|
|
29
|
+
memory: {
|
|
30
|
+
maxMemoryUsage: 100 * 1024 * 1024,
|
|
31
|
+
memoryLeakThreshold: 50 * 1024 * 1024,
|
|
32
|
+
gcTriggerThreshold: 80 * 1024 * 1024
|
|
33
|
+
},
|
|
34
|
+
performance: {
|
|
35
|
+
domElementLimit: 1e4,
|
|
36
|
+
maxDepthLimit: 50,
|
|
37
|
+
largeSubtreeThreshold: THRESHOLDS.LARGE_SUBTREE_ELEMENTS
|
|
38
|
+
},
|
|
39
|
+
dom: {
|
|
40
|
+
totalElements: 1e4,
|
|
41
|
+
maxDepth: 50,
|
|
42
|
+
largeSubtrees: 10,
|
|
43
|
+
elementsWarning: THRESHOLDS.ELEMENTS_WARNING,
|
|
44
|
+
elementsDanger: THRESHOLDS.ELEMENTS_DANGER,
|
|
45
|
+
depthWarning: 15,
|
|
46
|
+
depthDanger: 20,
|
|
47
|
+
largeSubtreeThreshold: THRESHOLDS.SMALL_SUBTREE_ELEMENTS
|
|
48
|
+
},
|
|
49
|
+
interaction: {
|
|
50
|
+
clickableElements: 100,
|
|
51
|
+
formElements: 50,
|
|
52
|
+
clickableHigh: 100
|
|
53
|
+
},
|
|
54
|
+
layout: {
|
|
55
|
+
fixedElements: 10,
|
|
56
|
+
highZIndexElements: 5,
|
|
57
|
+
highZIndexThreshold: THRESHOLDS.HIGH_Z_INDEX,
|
|
58
|
+
excessiveZIndexThreshold: 9999
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function createPositiveNumberRule(fieldName, getValue) {
|
|
62
|
+
return (obj, errors) => {
|
|
63
|
+
if (getValue(obj) <= 0) {
|
|
64
|
+
errors.push(`${fieldName} must be positive`);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createComparisonRule(getValue1, getValue2, message) {
|
|
69
|
+
return (obj, errors) => {
|
|
70
|
+
if (getValue2(obj) <= getValue1(obj)) {
|
|
71
|
+
errors.push(message);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
class DiagnosticThresholds {
|
|
76
|
+
static instance = null;
|
|
77
|
+
currentThresholds;
|
|
78
|
+
constructor(initialConfig) {
|
|
79
|
+
this.currentThresholds = this.mergeWithDefaults(initialConfig ?? {});
|
|
80
|
+
this.validateThresholds(this.currentThresholds);
|
|
81
|
+
}
|
|
82
|
+
static getInstance(config) {
|
|
83
|
+
if (!DiagnosticThresholds.instance) {
|
|
84
|
+
DiagnosticThresholds.instance = new DiagnosticThresholds(config);
|
|
85
|
+
} else if (config) {
|
|
86
|
+
DiagnosticThresholds.instance.updateThresholds(config);
|
|
87
|
+
}
|
|
88
|
+
return DiagnosticThresholds.instance;
|
|
89
|
+
}
|
|
90
|
+
static reset() {
|
|
91
|
+
DiagnosticThresholds.instance = null;
|
|
92
|
+
}
|
|
93
|
+
getMetricsThresholds() {
|
|
94
|
+
const thresholds = this.currentThresholds;
|
|
95
|
+
return {
|
|
96
|
+
executionTime: {
|
|
97
|
+
pageAnalysis: thresholds.executionTime.pageAnalysis,
|
|
98
|
+
elementDiscovery: thresholds.executionTime.elementDiscovery,
|
|
99
|
+
resourceMonitoring: thresholds.executionTime.resourceMonitoring,
|
|
100
|
+
parallelAnalysis: thresholds.executionTime.parallelAnalysis
|
|
101
|
+
},
|
|
102
|
+
memory: {
|
|
103
|
+
maxMemoryUsage: thresholds.memory.maxMemoryUsage,
|
|
104
|
+
memoryLeakThreshold: thresholds.memory.memoryLeakThreshold,
|
|
105
|
+
gcTriggerThreshold: thresholds.memory.gcTriggerThreshold
|
|
106
|
+
},
|
|
107
|
+
performance: {
|
|
108
|
+
domElementLimit: thresholds.performance.domElementLimit,
|
|
109
|
+
maxDepthLimit: thresholds.performance.maxDepthLimit,
|
|
110
|
+
largeSubtreeThreshold: thresholds.performance.largeSubtreeThreshold
|
|
111
|
+
},
|
|
112
|
+
dom: {
|
|
113
|
+
totalElements: thresholds.dom.totalElements,
|
|
114
|
+
maxDepth: thresholds.dom.maxDepth,
|
|
115
|
+
largeSubtrees: thresholds.dom.largeSubtrees,
|
|
116
|
+
elementsWarning: thresholds.dom.elementsWarning,
|
|
117
|
+
elementsDanger: thresholds.dom.elementsDanger,
|
|
118
|
+
depthWarning: thresholds.dom.depthWarning,
|
|
119
|
+
depthDanger: thresholds.dom.depthDanger,
|
|
120
|
+
largeSubtreeThreshold: thresholds.dom.largeSubtreeThreshold
|
|
121
|
+
},
|
|
122
|
+
interaction: {
|
|
123
|
+
clickableElements: thresholds.interaction.clickableElements,
|
|
124
|
+
formElements: thresholds.interaction.formElements,
|
|
125
|
+
clickableHigh: thresholds.interaction.clickableHigh
|
|
126
|
+
},
|
|
127
|
+
layout: {
|
|
128
|
+
fixedElements: thresholds.layout.fixedElements,
|
|
129
|
+
highZIndexElements: thresholds.layout.highZIndexElements,
|
|
130
|
+
highZIndexThreshold: thresholds.layout.highZIndexThreshold,
|
|
131
|
+
excessiveZIndexThreshold: thresholds.layout.excessiveZIndexThreshold
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
getDomThresholds() {
|
|
136
|
+
return this.currentThresholds.dom;
|
|
137
|
+
}
|
|
138
|
+
getPerformanceThresholds() {
|
|
139
|
+
return this.currentThresholds.performance;
|
|
140
|
+
}
|
|
141
|
+
getInteractionThresholds() {
|
|
142
|
+
return this.currentThresholds.interaction;
|
|
143
|
+
}
|
|
144
|
+
getLayoutThresholds() {
|
|
145
|
+
return this.currentThresholds.layout;
|
|
146
|
+
}
|
|
147
|
+
getExecutionTimeThresholds() {
|
|
148
|
+
return this.currentThresholds.executionTime;
|
|
149
|
+
}
|
|
150
|
+
getMemoryThresholds() {
|
|
151
|
+
return this.currentThresholds.memory;
|
|
152
|
+
}
|
|
153
|
+
updateThresholds(partialConfig) {
|
|
154
|
+
const previousThresholds = { ...this.currentThresholds };
|
|
155
|
+
try {
|
|
156
|
+
const newThresholds = this.mergeWithCurrentThresholds(partialConfig);
|
|
157
|
+
this.validateThresholds(newThresholds);
|
|
158
|
+
this.currentThresholds = newThresholds;
|
|
159
|
+
} catch (error) {
|
|
160
|
+
this.currentThresholds = previousThresholds;
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
mergeWithDefaults(config) {
|
|
165
|
+
const result = JSON.parse(JSON.stringify(DEFAULT_THRESHOLDS));
|
|
166
|
+
if (config.executionTime) {
|
|
167
|
+
Object.assign(result.executionTime, config.executionTime);
|
|
168
|
+
}
|
|
169
|
+
if (config.memory) {
|
|
170
|
+
Object.assign(result.memory, config.memory);
|
|
171
|
+
}
|
|
172
|
+
if (config.performance) {
|
|
173
|
+
Object.assign(result.performance, config.performance);
|
|
174
|
+
}
|
|
175
|
+
if (config.dom) {
|
|
176
|
+
Object.assign(result.dom, config.dom);
|
|
177
|
+
}
|
|
178
|
+
if (config.interaction) {
|
|
179
|
+
Object.assign(result.interaction, config.interaction);
|
|
180
|
+
}
|
|
181
|
+
if (config.layout) {
|
|
182
|
+
Object.assign(result.layout, config.layout);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
mergeWithCurrentThresholds(config) {
|
|
187
|
+
const result = JSON.parse(JSON.stringify(this.currentThresholds));
|
|
188
|
+
if (config.executionTime) {
|
|
189
|
+
Object.assign(result.executionTime, config.executionTime);
|
|
190
|
+
}
|
|
191
|
+
if (config.memory) {
|
|
192
|
+
Object.assign(result.memory, config.memory);
|
|
193
|
+
}
|
|
194
|
+
if (config.performance) {
|
|
195
|
+
Object.assign(result.performance, config.performance);
|
|
196
|
+
}
|
|
197
|
+
if (config.dom) {
|
|
198
|
+
Object.assign(result.dom, config.dom);
|
|
199
|
+
}
|
|
200
|
+
if (config.interaction) {
|
|
201
|
+
Object.assign(result.interaction, config.interaction);
|
|
202
|
+
}
|
|
203
|
+
if (config.layout) {
|
|
204
|
+
Object.assign(result.layout, config.layout);
|
|
205
|
+
}
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
validateThresholds(thresholds) {
|
|
209
|
+
const errors = [];
|
|
210
|
+
const executionTimeRules = [
|
|
211
|
+
createPositiveNumberRule("pageAnalysis execution time", (exec) => exec.pageAnalysis),
|
|
212
|
+
createPositiveNumberRule("elementDiscovery execution time", (exec) => exec.elementDiscovery),
|
|
213
|
+
createPositiveNumberRule("resourceMonitoring execution time", (exec) => exec.resourceMonitoring),
|
|
214
|
+
createPositiveNumberRule("parallelAnalysis execution time", (exec) => exec.parallelAnalysis)
|
|
215
|
+
];
|
|
216
|
+
const memoryRules = [
|
|
217
|
+
createPositiveNumberRule("maxMemoryUsage", (mem) => mem.maxMemoryUsage),
|
|
218
|
+
createPositiveNumberRule("memoryLeakThreshold", (mem) => mem.memoryLeakThreshold),
|
|
219
|
+
createPositiveNumberRule("gcTriggerThreshold", (mem) => mem.gcTriggerThreshold),
|
|
220
|
+
createComparisonRule((mem) => mem.memoryLeakThreshold, (mem) => mem.maxMemoryUsage, "memoryLeakThreshold should be less than maxMemoryUsage")
|
|
221
|
+
];
|
|
222
|
+
const domRules = [
|
|
223
|
+
createPositiveNumberRule("elementsWarning", (dom) => dom.elementsWarning),
|
|
224
|
+
createPositiveNumberRule("depthWarning", (dom) => dom.depthWarning),
|
|
225
|
+
createPositiveNumberRule("largeSubtreeThreshold", (dom) => dom.largeSubtreeThreshold),
|
|
226
|
+
createComparisonRule((dom) => dom.elementsWarning, (dom) => dom.elementsDanger, "elementsDanger must be greater than elementsWarning"),
|
|
227
|
+
createComparisonRule((dom) => dom.depthWarning, (dom) => dom.depthDanger, "depthDanger must be greater than depthWarning")
|
|
228
|
+
];
|
|
229
|
+
const interactionRules = [
|
|
230
|
+
createPositiveNumberRule("clickableElements threshold", (inter) => inter.clickableElements),
|
|
231
|
+
createPositiveNumberRule("formElements threshold", (inter) => inter.formElements)
|
|
232
|
+
];
|
|
233
|
+
const layoutRules = [
|
|
234
|
+
createPositiveNumberRule("highZIndexThreshold", (layout) => layout.highZIndexThreshold),
|
|
235
|
+
createComparisonRule((layout) => layout.highZIndexThreshold, (layout) => layout.excessiveZIndexThreshold, "excessiveZIndexThreshold must be greater than highZIndexThreshold")
|
|
236
|
+
];
|
|
237
|
+
this.applyValidationRules(thresholds.executionTime, executionTimeRules, errors);
|
|
238
|
+
this.applyValidationRules(thresholds.memory, memoryRules, errors);
|
|
239
|
+
this.applyValidationRules(thresholds.dom, domRules, errors);
|
|
240
|
+
this.applyValidationRules(thresholds.interaction, interactionRules, errors);
|
|
241
|
+
this.applyValidationRules(thresholds.layout, layoutRules, errors);
|
|
242
|
+
if (errors.length > 0) {
|
|
243
|
+
throw new Error(`Invalid threshold configuration: ${errors.join(", ")}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
applyValidationRules(section, rules, errors) {
|
|
247
|
+
for (const rule of rules) {
|
|
248
|
+
rule(section, errors);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
getConfigDiagnostics() {
|
|
252
|
+
const customizations = [];
|
|
253
|
+
const warnings = [];
|
|
254
|
+
const defaultsUsed = [];
|
|
255
|
+
const defaults = DEFAULT_THRESHOLDS;
|
|
256
|
+
const current = this.currentThresholds;
|
|
257
|
+
const currentDom = current.dom;
|
|
258
|
+
const defaultsDom = defaults.dom;
|
|
259
|
+
const currentLayout = current.layout;
|
|
260
|
+
const defaultsLayout = defaults.layout;
|
|
261
|
+
if (currentDom.elementsWarning !== defaultsDom.elementsWarning) {
|
|
262
|
+
customizations.push(`DOM elements warning: ${currentDom.elementsWarning} (default: ${defaultsDom.elementsWarning})`);
|
|
263
|
+
}
|
|
264
|
+
if (currentDom.elementsDanger !== defaultsDom.elementsDanger) {
|
|
265
|
+
customizations.push(`DOM elements danger: ${currentDom.elementsDanger} (default: ${defaultsDom.elementsDanger})`);
|
|
266
|
+
}
|
|
267
|
+
if (currentDom.depthWarning !== defaultsDom.depthWarning) {
|
|
268
|
+
customizations.push(`DOM depth warning: ${currentDom.depthWarning} (default: ${defaultsDom.depthWarning})`);
|
|
269
|
+
}
|
|
270
|
+
if (currentDom.depthDanger !== defaultsDom.depthDanger) {
|
|
271
|
+
customizations.push(`DOM depth danger: ${currentDom.depthDanger} (default: ${defaultsDom.depthDanger})`);
|
|
272
|
+
}
|
|
273
|
+
if (currentLayout.excessiveZIndexThreshold !== defaultsLayout.excessiveZIndexThreshold) {
|
|
274
|
+
customizations.push(`Z-index excessive: ${currentLayout.excessiveZIndexThreshold} (default: ${defaultsLayout.excessiveZIndexThreshold})`);
|
|
275
|
+
}
|
|
276
|
+
if (currentDom.elementsWarning > 2000) {
|
|
277
|
+
warnings.push("DOM elements warning threshold is very high - may not catch performance issues early");
|
|
278
|
+
}
|
|
279
|
+
if (currentDom.depthWarning > 25) {
|
|
280
|
+
warnings.push("DOM depth warning threshold is very high - deeply nested structures may cause performance issues");
|
|
281
|
+
}
|
|
282
|
+
if (currentLayout.excessiveZIndexThreshold < 1000) {
|
|
283
|
+
warnings.push("Excessive z-index threshold is low - may generate false positives");
|
|
284
|
+
}
|
|
285
|
+
if (customizations.length === 0) {
|
|
286
|
+
defaultsUsed.push("All thresholds using default values");
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
status: "valid",
|
|
290
|
+
customizations,
|
|
291
|
+
warnings,
|
|
292
|
+
defaultsUsed
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
resetToDefaults() {
|
|
296
|
+
this.currentThresholds = { ...DEFAULT_THRESHOLDS };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function getCurrentThresholds() {
|
|
300
|
+
return DiagnosticThresholds.getInstance();
|
|
301
|
+
}
|
|
302
|
+
function getMetricsThresholds() {
|
|
303
|
+
return getCurrentThresholds().getMetricsThresholds();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
class ThresholdConfigBuilder {
|
|
307
|
+
config = {};
|
|
308
|
+
executionTime(config) {
|
|
309
|
+
this.config.executionTime = { ...this.config.executionTime, ...config };
|
|
310
|
+
return this;
|
|
311
|
+
}
|
|
312
|
+
memory(config) {
|
|
313
|
+
this.config.memory = { ...this.config.memory, ...config };
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
performance(config) {
|
|
317
|
+
this.config.performance = { ...this.config.performance, ...config };
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
dom(config) {
|
|
321
|
+
this.config.dom = { ...this.config.dom, ...config };
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
interaction(config) {
|
|
325
|
+
this.config.interaction = { ...this.config.interaction, ...config };
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
layout(config) {
|
|
329
|
+
this.config.layout = { ...this.config.layout, ...config };
|
|
330
|
+
return this;
|
|
331
|
+
}
|
|
332
|
+
build() {
|
|
333
|
+
return { ...this.config };
|
|
334
|
+
}
|
|
335
|
+
create() {
|
|
336
|
+
return DiagnosticThresholds.getInstance(this.build());
|
|
337
|
+
}
|
|
338
|
+
static create() {
|
|
339
|
+
return new ThresholdConfigBuilder;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
export {
|
|
343
|
+
getMetricsThresholds,
|
|
344
|
+
getCurrentThresholds,
|
|
345
|
+
ThresholdConfigBuilder,
|
|
346
|
+
DiagnosticThresholds
|
|
347
|
+
};
|