flow-debugger 1.0.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.
- package/PORTFOLIO_README_SECTION.md +177 -0
- package/README.md +251 -0
- package/dashboard/app.js +339 -0
- package/dashboard/index.html +168 -0
- package/dashboard/style.css +846 -0
- package/dist/cjs/core/Analytics.js +174 -0
- package/dist/cjs/core/Analytics.js.map +1 -0
- package/dist/cjs/core/Classifier.js +66 -0
- package/dist/cjs/core/Classifier.js.map +1 -0
- package/dist/cjs/core/HealthMonitor.js +79 -0
- package/dist/cjs/core/HealthMonitor.js.map +1 -0
- package/dist/cjs/core/RootCause.js +89 -0
- package/dist/cjs/core/RootCause.js.map +1 -0
- package/dist/cjs/core/Sampler.js +34 -0
- package/dist/cjs/core/Sampler.js.map +1 -0
- package/dist/cjs/core/Timeline.js +90 -0
- package/dist/cjs/core/Timeline.js.map +1 -0
- package/dist/cjs/core/TraceEngine.js +222 -0
- package/dist/cjs/core/TraceEngine.js.map +1 -0
- package/dist/cjs/core/types.js +21 -0
- package/dist/cjs/core/types.js.map +1 -0
- package/dist/cjs/index.js +46 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/integrations/axios.js +136 -0
- package/dist/cjs/integrations/axios.js.map +1 -0
- package/dist/cjs/integrations/fetch.js +153 -0
- package/dist/cjs/integrations/fetch.js.map +1 -0
- package/dist/cjs/integrations/mongo.js +111 -0
- package/dist/cjs/integrations/mongo.js.map +1 -0
- package/dist/cjs/integrations/mysql.js +212 -0
- package/dist/cjs/integrations/mysql.js.map +1 -0
- package/dist/cjs/integrations/postgres.js +182 -0
- package/dist/cjs/integrations/postgres.js.map +1 -0
- package/dist/cjs/integrations/redis.js +105 -0
- package/dist/cjs/integrations/redis.js.map +1 -0
- package/dist/cjs/middleware/express.js +255 -0
- package/dist/cjs/middleware/express.js.map +1 -0
- package/dist/esm/core/Analytics.js +170 -0
- package/dist/esm/core/Analytics.js.map +1 -0
- package/dist/esm/core/Classifier.js +61 -0
- package/dist/esm/core/Classifier.js.map +1 -0
- package/dist/esm/core/HealthMonitor.js +75 -0
- package/dist/esm/core/HealthMonitor.js.map +1 -0
- package/dist/esm/core/RootCause.js +86 -0
- package/dist/esm/core/RootCause.js.map +1 -0
- package/dist/esm/core/Sampler.js +30 -0
- package/dist/esm/core/Sampler.js.map +1 -0
- package/dist/esm/core/Timeline.js +86 -0
- package/dist/esm/core/Timeline.js.map +1 -0
- package/dist/esm/core/TraceEngine.js +217 -0
- package/dist/esm/core/TraceEngine.js.map +1 -0
- package/dist/esm/core/types.js +18 -0
- package/dist/esm/core/types.js.map +1 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/integrations/axios.js +133 -0
- package/dist/esm/integrations/axios.js.map +1 -0
- package/dist/esm/integrations/fetch.js +149 -0
- package/dist/esm/integrations/fetch.js.map +1 -0
- package/dist/esm/integrations/mongo.js +107 -0
- package/dist/esm/integrations/mongo.js.map +1 -0
- package/dist/esm/integrations/mysql.js +209 -0
- package/dist/esm/integrations/mysql.js.map +1 -0
- package/dist/esm/integrations/postgres.js +179 -0
- package/dist/esm/integrations/postgres.js.map +1 -0
- package/dist/esm/integrations/redis.js +102 -0
- package/dist/esm/integrations/redis.js.map +1 -0
- package/dist/esm/middleware/express.js +219 -0
- package/dist/esm/middleware/express.js.map +1 -0
- package/dist/types/core/Analytics.d.ts +35 -0
- package/dist/types/core/Analytics.d.ts.map +1 -0
- package/dist/types/core/Classifier.d.ts +21 -0
- package/dist/types/core/Classifier.d.ts.map +1 -0
- package/dist/types/core/HealthMonitor.d.ts +14 -0
- package/dist/types/core/HealthMonitor.d.ts.map +1 -0
- package/dist/types/core/RootCause.d.ts +12 -0
- package/dist/types/core/RootCause.d.ts.map +1 -0
- package/dist/types/core/Sampler.d.ts +13 -0
- package/dist/types/core/Sampler.d.ts.map +1 -0
- package/dist/types/core/Timeline.d.ts +22 -0
- package/dist/types/core/Timeline.d.ts.map +1 -0
- package/dist/types/core/TraceEngine.d.ts +47 -0
- package/dist/types/core/TraceEngine.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +118 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/integrations/axios.d.ts +22 -0
- package/dist/types/integrations/axios.d.ts.map +1 -0
- package/dist/types/integrations/fetch.d.ts +25 -0
- package/dist/types/integrations/fetch.d.ts.map +1 -0
- package/dist/types/integrations/mongo.d.ts +26 -0
- package/dist/types/integrations/mongo.d.ts.map +1 -0
- package/dist/types/integrations/mysql.d.ts +20 -0
- package/dist/types/integrations/mysql.d.ts.map +1 -0
- package/dist/types/integrations/postgres.d.ts +20 -0
- package/dist/types/integrations/postgres.d.ts.map +1 -0
- package/dist/types/integrations/redis.d.ts +20 -0
- package/dist/types/integrations/redis.d.ts.map +1 -0
- package/dist/types/middleware/express.d.ts +39 -0
- package/dist/types/middleware/express.d.ts.map +1 -0
- package/example/server.ts +234 -0
- package/jest.config.js +8 -0
- package/package.json +110 -0
- package/portfolio-repo/APIRESPONSE DASH.png +0 -0
- package/portfolio-repo/PAYLOAD.png +0 -0
- package/portfolio-repo/README.md +182 -0
- package/src/core/Analytics.ts +209 -0
- package/src/core/Classifier.ts +82 -0
- package/src/core/HealthMonitor.ts +92 -0
- package/src/core/RootCause.ts +105 -0
- package/src/core/Sampler.ts +35 -0
- package/src/core/Timeline.ts +108 -0
- package/src/core/TraceEngine.ts +266 -0
- package/src/core/types.ts +170 -0
- package/src/index.ts +42 -0
- package/src/integrations/axios.ts +164 -0
- package/src/integrations/fetch.ts +172 -0
- package/src/integrations/mongo.ts +130 -0
- package/src/integrations/mysql.ts +239 -0
- package/src/integrations/postgres.ts +217 -0
- package/src/integrations/redis.ts +122 -0
- package/src/middleware/express.ts +264 -0
- package/tests/Analytics.test.ts +136 -0
- package/tests/Classifier.test.ts +57 -0
- package/tests/RootCause.test.ts +69 -0
- package/tests/TraceEngine.test.ts +110 -0
- package/tsconfig.cjs.json +9 -0
- package/tsconfig.esm.json +9 -0
- package/tsconfig.json +31 -0
- package/tsconfig.types.json +8 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Analytics Engine
|
|
4
|
+
// Per-endpoint aggregation + service failure grouping
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Analytics = void 0;
|
|
8
|
+
const HealthMonitor_1 = require("./HealthMonitor");
|
|
9
|
+
class Analytics {
|
|
10
|
+
constructor(maxTraces = 1000) {
|
|
11
|
+
this.traces = [];
|
|
12
|
+
this.maxTraces = maxTraces;
|
|
13
|
+
this.startTime = new Date();
|
|
14
|
+
this.healthMonitor = new HealthMonitor_1.HealthMonitor();
|
|
15
|
+
}
|
|
16
|
+
/** Record a completed trace */
|
|
17
|
+
record(trace) {
|
|
18
|
+
try {
|
|
19
|
+
this.traces.push(trace);
|
|
20
|
+
// Trim if over limit (keep most recent)
|
|
21
|
+
if (this.traces.length > this.maxTraces) {
|
|
22
|
+
this.traces = this.traces.slice(-this.maxTraces);
|
|
23
|
+
}
|
|
24
|
+
// Update health monitor with step results
|
|
25
|
+
for (const step of trace.steps) {
|
|
26
|
+
this.healthMonitor.recordStep(step);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (_) {
|
|
30
|
+
// never crash
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** Get full analytics report */
|
|
34
|
+
getReport() {
|
|
35
|
+
const endpoints = this.getEndpointStats();
|
|
36
|
+
const totalRequests = this.traces.length;
|
|
37
|
+
const totalErrors = this.traces.filter(t => t.classification === 'ERROR' || t.classification === 'CRITICAL').length;
|
|
38
|
+
const totalSlow = this.traces.filter(t => t.classification === 'WARN').length;
|
|
39
|
+
const uptime = Date.now() - this.startTime.getTime();
|
|
40
|
+
return {
|
|
41
|
+
totalRequests,
|
|
42
|
+
totalErrors,
|
|
43
|
+
totalSlow,
|
|
44
|
+
uptime,
|
|
45
|
+
endpoints,
|
|
46
|
+
serviceHealth: this.healthMonitor.getAllHealth(),
|
|
47
|
+
topFailures: this.getTopFailures(),
|
|
48
|
+
recentTraces: this.traces.slice(-20).reverse(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Get stats for a specific endpoint */
|
|
52
|
+
getEndpointReport(path) {
|
|
53
|
+
const stats = this.getEndpointStats();
|
|
54
|
+
return stats.find(s => s.path === path) || null;
|
|
55
|
+
}
|
|
56
|
+
/** Get aggregated stats per endpoint */
|
|
57
|
+
getEndpointStats() {
|
|
58
|
+
const grouped = new Map();
|
|
59
|
+
for (const trace of this.traces) {
|
|
60
|
+
const key = `${trace.method}:${trace.endpoint}`;
|
|
61
|
+
if (!grouped.has(key))
|
|
62
|
+
grouped.set(key, []);
|
|
63
|
+
grouped.get(key).push(trace);
|
|
64
|
+
}
|
|
65
|
+
const stats = [];
|
|
66
|
+
for (const [key, traces] of grouped) {
|
|
67
|
+
const [method, path] = key.split(':');
|
|
68
|
+
const durations = traces.map(t => t.totalDuration).sort((a, b) => a - b);
|
|
69
|
+
const errorCount = traces.filter(t => t.classification === 'ERROR' || t.classification === 'CRITICAL').length;
|
|
70
|
+
const slowCount = traces.filter(t => t.classification === 'WARN').length;
|
|
71
|
+
// Common issues
|
|
72
|
+
const issues = new Map();
|
|
73
|
+
for (const t of traces) {
|
|
74
|
+
if (t.rootCause) {
|
|
75
|
+
const key = t.rootCause.cause;
|
|
76
|
+
issues.set(key, (issues.get(key) || 0) + 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const commonIssues = [...issues.entries()]
|
|
80
|
+
.sort((a, b) => b[1] - a[1])
|
|
81
|
+
.slice(0, 5)
|
|
82
|
+
.map(([issue, count]) => `${issue} (${count}x)`);
|
|
83
|
+
// Service failure breakdown
|
|
84
|
+
const serviceFailures = this.getServiceFailures(traces);
|
|
85
|
+
stats.push({
|
|
86
|
+
path,
|
|
87
|
+
method,
|
|
88
|
+
totalRequests: traces.length,
|
|
89
|
+
errorCount,
|
|
90
|
+
slowCount,
|
|
91
|
+
avgDuration: durations.reduce((a, b) => a + b, 0) / durations.length,
|
|
92
|
+
p95Duration: durations[Math.floor(durations.length * 0.95)] || 0,
|
|
93
|
+
maxDuration: durations[durations.length - 1] || 0,
|
|
94
|
+
commonIssues,
|
|
95
|
+
serviceFailures,
|
|
96
|
+
recentTraces: traces.slice(-5).reverse(),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return stats.sort((a, b) => b.totalRequests - a.totalRequests);
|
|
100
|
+
}
|
|
101
|
+
/** Get service failure breakdown across all traces */
|
|
102
|
+
getTopFailures() {
|
|
103
|
+
return this.getServiceFailures(this.traces);
|
|
104
|
+
}
|
|
105
|
+
/** Calculate service failure stats from a set of traces */
|
|
106
|
+
getServiceFailures(traces) {
|
|
107
|
+
const failures = new Map();
|
|
108
|
+
let totalFailures = 0;
|
|
109
|
+
for (const trace of traces) {
|
|
110
|
+
for (const step of trace.steps) {
|
|
111
|
+
if (step.status === 'error' || step.status === 'timeout') {
|
|
112
|
+
failures.set(step.service, (failures.get(step.service) || 0) + 1);
|
|
113
|
+
totalFailures++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return [...failures.entries()]
|
|
118
|
+
.map(([service, count]) => ({
|
|
119
|
+
service,
|
|
120
|
+
count,
|
|
121
|
+
percentage: totalFailures > 0 ? Math.round((count / totalFailures) * 100) : 0,
|
|
122
|
+
}))
|
|
123
|
+
.sort((a, b) => b.count - a.count);
|
|
124
|
+
}
|
|
125
|
+
/** Clear all stored traces */
|
|
126
|
+
clear() {
|
|
127
|
+
this.traces = [];
|
|
128
|
+
}
|
|
129
|
+
/** Get raw trace count */
|
|
130
|
+
getTraceCount() {
|
|
131
|
+
return this.traces.length;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Search traces by traceId, endpoint, or error message.
|
|
135
|
+
* Returns matching traces sorted by most recent first.
|
|
136
|
+
*/
|
|
137
|
+
searchTraces(query, options) {
|
|
138
|
+
if (!query)
|
|
139
|
+
return [];
|
|
140
|
+
const lowerQuery = query.toLowerCase();
|
|
141
|
+
const limit = options?.limit || 50;
|
|
142
|
+
const matches = this.traces.filter(trace => {
|
|
143
|
+
// Filter by environment if specified
|
|
144
|
+
if (options?.env && trace.environment !== options.env) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
// Match traceId
|
|
148
|
+
if (trace.traceId.toLowerCase().includes(lowerQuery)) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
// Match endpoint
|
|
152
|
+
if (trace.endpoint.toLowerCase().includes(lowerQuery)) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
// Match error message in steps
|
|
156
|
+
for (const step of trace.steps) {
|
|
157
|
+
if (step.error && step.error.toLowerCase().includes(lowerQuery)) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Match root cause
|
|
162
|
+
if (trace.rootCause && trace.rootCause.cause.toLowerCase().includes(lowerQuery)) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
});
|
|
167
|
+
return matches.slice(-limit).reverse();
|
|
168
|
+
}
|
|
169
|
+
getHealthMonitor() {
|
|
170
|
+
return this.healthMonitor;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.Analytics = Analytics;
|
|
174
|
+
//# sourceMappingURL=Analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Analytics.js","sourceRoot":"","sources":["../../../src/core/Analytics.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,mCAAmC;AACnC,sDAAsD;AACtD,gEAAgE;;;AAUhE,mDAA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KAAK,CAAC;YACjB,CAAC;YAED,gBAAgB;YAChB,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBACnD,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,iBAAiB;YACjB,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBACpD,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,+BAA+B;YAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBAC7B,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC9D,OAAO,IAAI,CAAC;gBAChB,CAAC;YACL,CAAC;YAED,mBAAmB;YACnB,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC9E,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC;IAED,gBAAgB;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;CACJ;AAjMD,8BAiMC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Classifier
|
|
4
|
+
// Classifies steps and traces into severity levels
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.classify = classify;
|
|
8
|
+
exports.classifyTrace = classifyTrace;
|
|
9
|
+
exports.classifyQuery = classifyQuery;
|
|
10
|
+
/**
|
|
11
|
+
* Classify a single step based on its duration and status.
|
|
12
|
+
*
|
|
13
|
+
* INFO → normal, <slowThreshold ms
|
|
14
|
+
* WARN → slow (>slowThreshold ms)
|
|
15
|
+
* ERROR → step failed
|
|
16
|
+
* CRITICAL → dependency down / timeout
|
|
17
|
+
*/
|
|
18
|
+
function classify(duration, status, config) {
|
|
19
|
+
const threshold = config.slowThreshold ?? 300;
|
|
20
|
+
if (status === 'timeout')
|
|
21
|
+
return 'CRITICAL';
|
|
22
|
+
if (status === 'error')
|
|
23
|
+
return 'ERROR';
|
|
24
|
+
if (duration > threshold)
|
|
25
|
+
return 'WARN';
|
|
26
|
+
return 'INFO';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Classify an entire trace based on its steps.
|
|
30
|
+
* The trace gets the highest severity from any of its steps.
|
|
31
|
+
*/
|
|
32
|
+
function classifyTrace(steps, _totalDuration, config) {
|
|
33
|
+
const threshold = config.slowThreshold ?? 300;
|
|
34
|
+
let maxLevel = 'INFO';
|
|
35
|
+
const priority = {
|
|
36
|
+
INFO: 0,
|
|
37
|
+
WARN: 1,
|
|
38
|
+
ERROR: 2,
|
|
39
|
+
CRITICAL: 3,
|
|
40
|
+
};
|
|
41
|
+
for (const step of steps) {
|
|
42
|
+
if (priority[step.classification] > priority[maxLevel]) {
|
|
43
|
+
maxLevel = step.classification;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Also check total duration
|
|
47
|
+
if (maxLevel === 'INFO' && _totalDuration > threshold) {
|
|
48
|
+
maxLevel = 'WARN';
|
|
49
|
+
}
|
|
50
|
+
return maxLevel;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Classify a database query specifically — used by integrations
|
|
54
|
+
* to detect slow queries with a dedicated threshold.
|
|
55
|
+
*/
|
|
56
|
+
function classifyQuery(duration, status, config) {
|
|
57
|
+
const threshold = config.slowQueryThreshold ?? 300;
|
|
58
|
+
if (status === 'timeout')
|
|
59
|
+
return 'CRITICAL';
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
return 'ERROR';
|
|
62
|
+
if (duration > threshold)
|
|
63
|
+
return 'WARN';
|
|
64
|
+
return 'INFO';
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=Classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Classifier.js","sourceRoot":"","sources":["../../../src/core/Classifier.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,6BAA6B;AAC7B,mDAAmD;AACnD,gEAAgE;;AAiBhE,4BAWC;AAMD,sCA2BC;AAMD,sCAWC;AArED;;;;;;;GAOG;AACH,SAAgB,QAAQ,CACpB,QAAgB,EAChB,MAAkB,EAClB,MAA6C;IAE7C,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,IAAI,GAAG,CAAC;IAE9C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,UAAU,CAAC;IAC5C,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACvC,IAAI,QAAQ,GAAG,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CACzB,KAAkB,EAClB,cAAsB,EACtB,MAA6C;IAE7C,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,IAAI,GAAG,CAAC;IAC9C,IAAI,QAAQ,GAAwB,MAAM,CAAC;IAE3C,MAAM,QAAQ,GAAwC;QAClD,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,CAAC;KACd,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrD,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;QACnC,CAAC;IACL,CAAC;IAED,4BAA4B;IAC5B,IAAI,QAAQ,KAAK,MAAM,IAAI,cAAc,GAAG,SAAS,EAAE,CAAC;QACpD,QAAQ,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CACzB,QAAgB,EAChB,MAAkB,EAClB,MAAkD;IAElD,MAAM,SAAS,GAAG,MAAM,CAAC,kBAAkB,IAAI,GAAG,CAAC;IAEnD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,UAAU,CAAC;IAC5C,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACvC,IAAI,QAAQ,GAAG,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Health Monitor
|
|
4
|
+
// Tracks dependency health from step results
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.HealthMonitor = void 0;
|
|
8
|
+
class HealthMonitor {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.records = new Map();
|
|
11
|
+
}
|
|
12
|
+
/** Record a step result to update health tracking */
|
|
13
|
+
recordStep(step) {
|
|
14
|
+
try {
|
|
15
|
+
const key = step.service;
|
|
16
|
+
if (key === 'internal' || key === 'unknown')
|
|
17
|
+
return;
|
|
18
|
+
if (!this.records.has(key)) {
|
|
19
|
+
this.records.set(key, {
|
|
20
|
+
service: step.service,
|
|
21
|
+
name: key,
|
|
22
|
+
successes: 0,
|
|
23
|
+
failures: 0,
|
|
24
|
+
lastCheck: new Date(),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const record = this.records.get(key);
|
|
28
|
+
record.lastCheck = new Date();
|
|
29
|
+
if (step.status === 'success') {
|
|
30
|
+
record.successes++;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
record.failures++;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (_) {
|
|
37
|
+
// never crash
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Get health status for a specific service */
|
|
41
|
+
getHealth(service) {
|
|
42
|
+
const record = this.records.get(service);
|
|
43
|
+
if (!record)
|
|
44
|
+
return null;
|
|
45
|
+
return this.toHealthStatus(record);
|
|
46
|
+
}
|
|
47
|
+
/** Get health status for all tracked services */
|
|
48
|
+
getAllHealth() {
|
|
49
|
+
return [...this.records.values()].map(r => this.toHealthStatus(r));
|
|
50
|
+
}
|
|
51
|
+
toHealthStatus(record) {
|
|
52
|
+
const total = record.successes + record.failures;
|
|
53
|
+
const successRate = total > 0 ? record.successes / total : 1;
|
|
54
|
+
let status;
|
|
55
|
+
if (successRate >= 0.95) {
|
|
56
|
+
status = 'healthy';
|
|
57
|
+
}
|
|
58
|
+
else if (successRate >= 0.7) {
|
|
59
|
+
status = 'degraded';
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
status = 'down';
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
service: record.service,
|
|
66
|
+
name: record.name,
|
|
67
|
+
status,
|
|
68
|
+
lastCheck: record.lastCheck,
|
|
69
|
+
successRate: Math.round(successRate * 100),
|
|
70
|
+
totalChecks: total,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Reset all health records */
|
|
74
|
+
reset() {
|
|
75
|
+
this.records.clear();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.HealthMonitor = HealthMonitor;
|
|
79
|
+
//# sourceMappingURL=HealthMonitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HealthMonitor.js","sourceRoot":"","sources":["../../../src/core/HealthMonitor.ts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AC,CAAC;IACvC,CAAC;IAED,iDAAiD;IACjD,YAAY;QACR,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IAEO,cAAc,CAAC,MAAoB;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;QACjD,MAAM,WAAW,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAE7D,IAAI,MAAmB,CAAC;QACxB,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACtB,MAAM,GAAG,SAAS,CAAC;QACvB,CAAC;aAAM,IAAI,WAAW,IAAI,GAAG,EAAE,CAAC;YAC5B,MAAM,GAAG,UAAU,CAAC;QACxB,CAAC;aAAM,CAAC;YACJ,MAAM,GAAG,MAAM,CAAC;QACpB,CAAC;QAED,OAAO;YACH,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM;YACN,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,GAAG,CAAC;YAC1C,WAAW,EAAE,KAAK;SACrB,CAAC;IACN,CAAC;IAED,+BAA+B;IAC/B,KAAK;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACJ;AAvED,sCAuEC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Root Cause Detection
|
|
4
|
+
// Analyzes trace steps to identify the most likely failure origin
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.detectRootCause = detectRootCause;
|
|
8
|
+
/**
|
|
9
|
+
* Detect the root cause of a trace failure or slowness.
|
|
10
|
+
*
|
|
11
|
+
* Algorithm:
|
|
12
|
+
* 1. If response is 500 and a step failed → root cause = first failed step
|
|
13
|
+
* 2. If a step timed out → root cause = timeout step (CRITICAL)
|
|
14
|
+
* 3. If DB/Redis slow and total latency high → root cause = slow dependency
|
|
15
|
+
* 4. If no failures but overall slow → root cause = slowest step
|
|
16
|
+
*/
|
|
17
|
+
function detectRootCause(steps, statusCode, config) {
|
|
18
|
+
if (steps.length === 0)
|
|
19
|
+
return null;
|
|
20
|
+
const slowThreshold = config.slowThreshold ?? 300;
|
|
21
|
+
// 1. Look for timed-out steps (highest priority)
|
|
22
|
+
const timedOut = steps.find(s => s.status === 'timeout');
|
|
23
|
+
if (timedOut) {
|
|
24
|
+
return {
|
|
25
|
+
cause: `${timedOut.name} timed out`,
|
|
26
|
+
step: timedOut.name,
|
|
27
|
+
service: timedOut.service,
|
|
28
|
+
confidence: 'high',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// 2. Look for failed steps when response is 5xx
|
|
32
|
+
if (statusCode && statusCode >= 500) {
|
|
33
|
+
const failedSteps = steps.filter(s => s.status === 'error');
|
|
34
|
+
if (failedSteps.length > 0) {
|
|
35
|
+
// First failure is most likely root cause
|
|
36
|
+
const first = failedSteps[0];
|
|
37
|
+
return {
|
|
38
|
+
cause: `${first.name} failed: ${first.error || 'unknown error'}`,
|
|
39
|
+
step: first.name,
|
|
40
|
+
service: first.service,
|
|
41
|
+
confidence: 'high',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// 3. Look for any failed step (even if response isn't 500)
|
|
46
|
+
const failedStep = steps.find(s => s.status === 'error');
|
|
47
|
+
if (failedStep) {
|
|
48
|
+
return {
|
|
49
|
+
cause: `${failedStep.name} failed: ${failedStep.error || 'unknown error'}`,
|
|
50
|
+
step: failedStep.name,
|
|
51
|
+
service: failedStep.service,
|
|
52
|
+
confidence: statusCode && statusCode >= 400 ? 'high' : 'medium',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// 4. Look for slow steps
|
|
56
|
+
const slowSteps = steps.filter(s => s.duration > slowThreshold);
|
|
57
|
+
if (slowSteps.length > 0) {
|
|
58
|
+
// Slowest step is the most likely bottleneck
|
|
59
|
+
const slowest = slowSteps.reduce((a, b) => (a.duration > b.duration ? a : b));
|
|
60
|
+
const totalDuration = steps.reduce((sum, s) => sum + s.duration, 0);
|
|
61
|
+
const ratio = slowest.duration / totalDuration;
|
|
62
|
+
return {
|
|
63
|
+
cause: `Slow ${getServiceLabel(slowest.service)} query: ${slowest.name} (${Math.round(slowest.duration)}ms)`,
|
|
64
|
+
step: slowest.name,
|
|
65
|
+
service: slowest.service,
|
|
66
|
+
confidence: ratio > 0.5 ? 'high' : 'medium',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
function getServiceLabel(service) {
|
|
72
|
+
const labels = {
|
|
73
|
+
mongo: 'MongoDB',
|
|
74
|
+
mysql: 'MySQL',
|
|
75
|
+
postgres: 'PostgreSQL',
|
|
76
|
+
redis: 'Redis',
|
|
77
|
+
axios: 'HTTP',
|
|
78
|
+
fetch: 'HTTP',
|
|
79
|
+
stripe: 'Stripe',
|
|
80
|
+
razorpay: 'Razorpay',
|
|
81
|
+
sendgrid: 'SendGrid',
|
|
82
|
+
twilio: 'Twilio',
|
|
83
|
+
external: 'External',
|
|
84
|
+
internal: 'Internal',
|
|
85
|
+
unknown: 'Unknown',
|
|
86
|
+
};
|
|
87
|
+
return labels[service] || service;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=RootCause.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootCause.js","sourceRoot":"","sources":["../../../src/core/RootCause.ts"],"names":[],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;YACxB,UAAU,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;SAC9C,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAC,OAAmB;IACxC,MAAM,MAAM,GAA+B;QACvC,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,YAAY;QACtB,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,SAAS;KACrB,CAAC;IACF,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Sampler
|
|
4
|
+
// Probabilistic sampling for high-traffic environments
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Sampler = void 0;
|
|
8
|
+
class Sampler {
|
|
9
|
+
constructor(rate = 1, alwaysSampleErrors = true) {
|
|
10
|
+
this.rate = Math.max(0, Math.min(1, rate));
|
|
11
|
+
this.alwaysSampleErrors = alwaysSampleErrors;
|
|
12
|
+
}
|
|
13
|
+
/** Should this request be sampled? */
|
|
14
|
+
shouldSample() {
|
|
15
|
+
if (this.rate >= 1)
|
|
16
|
+
return true;
|
|
17
|
+
if (this.rate <= 0)
|
|
18
|
+
return false;
|
|
19
|
+
return Math.random() < this.rate;
|
|
20
|
+
}
|
|
21
|
+
/** Force sample if it's an error (if alwaysSampleErrors is true) */
|
|
22
|
+
shouldSampleError() {
|
|
23
|
+
return this.alwaysSampleErrors;
|
|
24
|
+
}
|
|
25
|
+
/** Update sampling rate at runtime */
|
|
26
|
+
setRate(rate) {
|
|
27
|
+
this.rate = Math.max(0, Math.min(1, rate));
|
|
28
|
+
}
|
|
29
|
+
getRate() {
|
|
30
|
+
return this.rate;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Sampler = Sampler;
|
|
34
|
+
//# sourceMappingURL=Sampler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sampler.js","sourceRoot":"","sources":["../../../src/core/Sampler.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,0BAA0B;AAC1B,uDAAuD;AACvD,gEAAgE;;;AAEhE,MAAa,OAAO;IAIhB,YAAY,IAAI,GAAG,CAAC,EAAE,kBAAkB,GAAG,IAAI;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3C,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC;IAED,sCAAsC;IACtC,YAAY;QACR,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAChC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QACjC,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;IACrC,CAAC;IAED,oEAAoE;IACpE,iBAAiB;QACb,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,sCAAsC;IACtC,OAAO,CAAC,IAAY;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AA7BD,0BA6BC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Timeline Renderer
|
|
4
|
+
// Prints a visual timeline of a trace to the console
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.renderTimeline = renderTimeline;
|
|
8
|
+
exports.renderCompact = renderCompact;
|
|
9
|
+
const ICONS = {
|
|
10
|
+
success: '✔',
|
|
11
|
+
error: '❌',
|
|
12
|
+
timeout: '⏱ TIMEOUT',
|
|
13
|
+
};
|
|
14
|
+
const LEVEL_COLORS = {
|
|
15
|
+
INFO: '\x1b[32m', // green
|
|
16
|
+
WARN: '\x1b[33m', // yellow
|
|
17
|
+
ERROR: '\x1b[31m', // red
|
|
18
|
+
CRITICAL: '\x1b[35m', // magenta
|
|
19
|
+
};
|
|
20
|
+
const RESET = '\x1b[0m';
|
|
21
|
+
const DIM = '\x1b[2m';
|
|
22
|
+
const BOLD = '\x1b[1m';
|
|
23
|
+
const CYAN = '\x1b[36m';
|
|
24
|
+
/**
|
|
25
|
+
* Render a trace timeline to the console.
|
|
26
|
+
*
|
|
27
|
+
* Output example:
|
|
28
|
+
* ┌─── flow-debugger ── req_abc123 ── POST /login ───
|
|
29
|
+
* │ [0ms] Request start
|
|
30
|
+
* │ [2ms] DB find user ✔ (14ms) [mongo]
|
|
31
|
+
* │ [16ms] Redis cache ❌ (3ms) [redis]
|
|
32
|
+
* │ [20ms] Response 200
|
|
33
|
+
* │
|
|
34
|
+
* │ ⚠ Root cause: Redis cache failed: connection refused
|
|
35
|
+
* │ Classification: ERROR
|
|
36
|
+
* │ Total: 20ms
|
|
37
|
+
* └────────────────────────────────────────────────────
|
|
38
|
+
*/
|
|
39
|
+
function renderTimeline(trace, logger = console.log) {
|
|
40
|
+
const lines = [];
|
|
41
|
+
const divider = '─'.repeat(50);
|
|
42
|
+
lines.push('');
|
|
43
|
+
lines.push(`${CYAN}┌─── flow-debugger ── ${trace.traceId} ── ${trace.method} ${trace.endpoint} ───${RESET}`);
|
|
44
|
+
lines.push(`${DIM}│ [0ms] Request start${RESET}`);
|
|
45
|
+
for (const step of trace.steps) {
|
|
46
|
+
const offset = Math.round(step.startTime);
|
|
47
|
+
const dur = Math.round(step.duration);
|
|
48
|
+
const icon = ICONS[step.status] || '?';
|
|
49
|
+
const levelColor = LEVEL_COLORS[step.classification] || '';
|
|
50
|
+
const serviceTag = step.service !== 'internal' ? ` ${DIM}[${step.service}]${RESET}` : '';
|
|
51
|
+
const line = `│ [${offset}ms]${' '.repeat(Math.max(1, 5 - String(offset).length))}` +
|
|
52
|
+
`${levelColor}${step.name} ${icon} (${dur}ms)${RESET}${serviceTag}`;
|
|
53
|
+
lines.push(line);
|
|
54
|
+
if (step.error) {
|
|
55
|
+
lines.push(`│ ${DIM}└─ ${step.error}${RESET}`);
|
|
56
|
+
}
|
|
57
|
+
// Slow query warning
|
|
58
|
+
if (step.classification === 'WARN' && step.duration > 300) {
|
|
59
|
+
lines.push(`│ ${LEVEL_COLORS.WARN}⚠ Slow ${step.service} query detected (${dur}ms)${RESET}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Response line
|
|
63
|
+
lines.push(`${DIM}│ [${Math.round(trace.totalDuration)}ms]${' '.repeat(Math.max(1, 5 - String(Math.round(trace.totalDuration)).length))}Response ${trace.statusCode || '—'}${RESET}`);
|
|
64
|
+
lines.push('│');
|
|
65
|
+
// Root cause
|
|
66
|
+
if (trace.rootCause) {
|
|
67
|
+
const rcColor = LEVEL_COLORS.ERROR;
|
|
68
|
+
lines.push(`${rcColor}│ 🔍 Root cause: ${trace.rootCause.cause}${RESET}`);
|
|
69
|
+
lines.push(`${DIM}│ Service: ${trace.rootCause.service} | Confidence: ${trace.rootCause.confidence}${RESET}`);
|
|
70
|
+
}
|
|
71
|
+
// Classification
|
|
72
|
+
const clsColor = LEVEL_COLORS[trace.classification];
|
|
73
|
+
lines.push(`${clsColor}│ Classification: ${trace.classification}${RESET}`);
|
|
74
|
+
lines.push(`${DIM}│ Total: ${Math.round(trace.totalDuration)}ms${RESET}`);
|
|
75
|
+
lines.push(`${CYAN}└${divider}${RESET}`);
|
|
76
|
+
lines.push('');
|
|
77
|
+
logger(lines.join('\n'));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Render a compact one-line summary for high-traffic mode.
|
|
81
|
+
*/
|
|
82
|
+
function renderCompact(trace, logger = console.log) {
|
|
83
|
+
const icon = trace.classification === 'INFO' ? '✔' :
|
|
84
|
+
trace.classification === 'WARN' ? '⚠' :
|
|
85
|
+
trace.classification === 'ERROR' ? '❌' :
|
|
86
|
+
'🔴';
|
|
87
|
+
const rc = trace.rootCause ? ` → ${trace.rootCause.cause}` : '';
|
|
88
|
+
logger(`${icon} ${trace.method} ${trace.endpoint} ${Math.round(trace.totalDuration)}ms [${trace.classification}]${rc}`);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=Timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeline.js","sourceRoot":"","sources":["../../../src/core/Timeline.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,oCAAoC;AACpC,qDAAqD;AACrD,gEAAgE;;AAqChE,wCAoDC;AAKD,sCAUC;AApGD,MAAM,KAAK,GAA2B;IAClC,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,WAAW;CACvB,CAAC;AAEF,MAAM,YAAY,GAAwC;IACtD,IAAI,EAAE,UAAU,EAAM,QAAQ;IAC9B,IAAI,EAAE,UAAU,EAAM,SAAS;IAC/B,KAAK,EAAE,UAAU,EAAK,MAAM;IAC5B,QAAQ,EAAE,UAAU,EAAE,UAAU;CACnC,CAAC;AAEF,MAAM,KAA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