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,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Trace Engine
|
|
4
|
+
// Manages trace lifecycle: create → add steps → end
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RequestTracer = exports.TraceEngine = void 0;
|
|
8
|
+
const events_1 = require("events");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
const Classifier_1 = require("./Classifier");
|
|
11
|
+
const RootCause_1 = require("./RootCause");
|
|
12
|
+
const Timeline_1 = require("./Timeline");
|
|
13
|
+
let idCounter = 0;
|
|
14
|
+
/** Generate a unique trace ID */
|
|
15
|
+
function generateTraceId() {
|
|
16
|
+
const ts = Date.now().toString(36);
|
|
17
|
+
const rand = Math.random().toString(36).substring(2, 8);
|
|
18
|
+
idCounter++;
|
|
19
|
+
return `req_${ts}_${rand}_${idCounter}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Extract file and line number from stack trace for dashboard preview.
|
|
23
|
+
* Example: "at Object.<anonymous> (d:\\project\\auth.service.ts:42:15)"
|
|
24
|
+
* Returns: { file: "auth.service.ts", line: 42 }
|
|
25
|
+
*/
|
|
26
|
+
function extractErrorLocation(stackTrace) {
|
|
27
|
+
if (!stackTrace)
|
|
28
|
+
return {};
|
|
29
|
+
try {
|
|
30
|
+
// Match patterns like:
|
|
31
|
+
// at functionName (file.ts:42:15)
|
|
32
|
+
// at file.ts:42:15
|
|
33
|
+
const match = stackTrace.match(/\(([^)]+):(\d+):\d+\)/) || stackTrace.match(/at\s+([^:]+):(\d+):\d+/);
|
|
34
|
+
if (match) {
|
|
35
|
+
const fullPath = match[1];
|
|
36
|
+
const lineNum = parseInt(match[2], 10);
|
|
37
|
+
// Extract just the filename from full path
|
|
38
|
+
const fileName = fullPath.split(/[/\\]/).pop() || fullPath;
|
|
39
|
+
return { file: fileName, line: lineNum };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (_) {
|
|
43
|
+
// ignore parse errors
|
|
44
|
+
}
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* TraceEngine — manages the lifecycle of a single request trace.
|
|
49
|
+
*
|
|
50
|
+
* Usage:
|
|
51
|
+
* const engine = new TraceEngine(config);
|
|
52
|
+
* const tracer = engine.startTrace('/login', 'POST');
|
|
53
|
+
* await tracer.step('DB find user', async () => User.findOne(), { service: 'mongo' });
|
|
54
|
+
* tracer.end(200);
|
|
55
|
+
*/
|
|
56
|
+
class TraceEngine extends events_1.EventEmitter {
|
|
57
|
+
constructor(config) {
|
|
58
|
+
super();
|
|
59
|
+
this.config = { ...types_1.DEFAULT_CONFIG, ...config };
|
|
60
|
+
}
|
|
61
|
+
/** Update config at runtime */
|
|
62
|
+
updateConfig(patch) {
|
|
63
|
+
Object.assign(this.config, patch);
|
|
64
|
+
}
|
|
65
|
+
getConfig() {
|
|
66
|
+
return { ...this.config };
|
|
67
|
+
}
|
|
68
|
+
/** Start a new request trace */
|
|
69
|
+
startTrace(endpoint, method) {
|
|
70
|
+
const tracer = new RequestTracer(endpoint, method, this.config, this);
|
|
71
|
+
this.safeEmit('trace:start', { traceId: tracer.getTraceId(), endpoint, method });
|
|
72
|
+
return tracer;
|
|
73
|
+
}
|
|
74
|
+
/** Safe emit — never throws */
|
|
75
|
+
safeEmit(event, data) {
|
|
76
|
+
try {
|
|
77
|
+
this.emit(event, data);
|
|
78
|
+
}
|
|
79
|
+
catch (_) {
|
|
80
|
+
// debugger never crashes the app
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.TraceEngine = TraceEngine;
|
|
85
|
+
/**
|
|
86
|
+
* RequestTracer — the object attached to a single request.
|
|
87
|
+
* Provides `step()` for manual instrumentation and `addStep()` for auto-instrumentation.
|
|
88
|
+
*/
|
|
89
|
+
class RequestTracer {
|
|
90
|
+
constructor(endpoint, method, config, engine) {
|
|
91
|
+
this.steps = [];
|
|
92
|
+
this.ended = false;
|
|
93
|
+
this.traceId = generateTraceId();
|
|
94
|
+
this.endpoint = endpoint;
|
|
95
|
+
this.method = method;
|
|
96
|
+
this.startTime = performance.now();
|
|
97
|
+
this.config = config;
|
|
98
|
+
this.engine = engine;
|
|
99
|
+
}
|
|
100
|
+
getTraceId() {
|
|
101
|
+
return this.traceId;
|
|
102
|
+
}
|
|
103
|
+
getSteps() {
|
|
104
|
+
return [...this.steps];
|
|
105
|
+
}
|
|
106
|
+
/** Manually run & trace an async step */
|
|
107
|
+
async step(name, fn, options) {
|
|
108
|
+
const service = options?.service ?? 'internal';
|
|
109
|
+
const timeout = options?.timeout ?? this.config.defaultTimeout;
|
|
110
|
+
const stepStart = performance.now();
|
|
111
|
+
let status = 'success';
|
|
112
|
+
let error;
|
|
113
|
+
let stackTrace;
|
|
114
|
+
let result;
|
|
115
|
+
try {
|
|
116
|
+
// Race the function against a timeout
|
|
117
|
+
result = await Promise.race([
|
|
118
|
+
Promise.resolve(fn()),
|
|
119
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`Step "${name}" timed out after ${timeout}ms`)), timeout)),
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
124
|
+
if (e.message.includes('timed out')) {
|
|
125
|
+
status = 'timeout';
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
status = 'error';
|
|
129
|
+
}
|
|
130
|
+
error = e.message;
|
|
131
|
+
stackTrace = e.stack;
|
|
132
|
+
const { file: errorFile, line: errorLine } = extractErrorLocation(stackTrace);
|
|
133
|
+
// Re-throw so the caller can handle the error
|
|
134
|
+
const stepEnd = performance.now();
|
|
135
|
+
const duration = stepEnd - stepStart;
|
|
136
|
+
const classification = (0, Classifier_1.classify)(duration, status, this.config);
|
|
137
|
+
this.steps.push({
|
|
138
|
+
name,
|
|
139
|
+
service,
|
|
140
|
+
status,
|
|
141
|
+
classification,
|
|
142
|
+
startTime: stepStart - this.startTime,
|
|
143
|
+
endTime: stepEnd - this.startTime,
|
|
144
|
+
duration,
|
|
145
|
+
error,
|
|
146
|
+
stackTrace,
|
|
147
|
+
errorFile,
|
|
148
|
+
errorLine,
|
|
149
|
+
metadata: options?.metadata,
|
|
150
|
+
});
|
|
151
|
+
throw err;
|
|
152
|
+
}
|
|
153
|
+
const stepEnd = performance.now();
|
|
154
|
+
const duration = stepEnd - stepStart;
|
|
155
|
+
const classification = (0, Classifier_1.classify)(duration, status, this.config);
|
|
156
|
+
const { file: errorFile, line: errorLine } = error ? extractErrorLocation(stackTrace) : {};
|
|
157
|
+
this.steps.push({
|
|
158
|
+
name,
|
|
159
|
+
service,
|
|
160
|
+
status,
|
|
161
|
+
classification,
|
|
162
|
+
startTime: stepStart - this.startTime,
|
|
163
|
+
endTime: stepEnd - this.startTime,
|
|
164
|
+
duration,
|
|
165
|
+
error,
|
|
166
|
+
stackTrace,
|
|
167
|
+
errorFile,
|
|
168
|
+
errorLine,
|
|
169
|
+
metadata: options?.metadata,
|
|
170
|
+
});
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
/** Add a pre-recorded step (used by auto-integrations) */
|
|
174
|
+
addStep(step) {
|
|
175
|
+
try {
|
|
176
|
+
this.steps.push(step);
|
|
177
|
+
}
|
|
178
|
+
catch (_) {
|
|
179
|
+
// never crash
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** End the trace and produce the final result */
|
|
183
|
+
end(statusCode) {
|
|
184
|
+
if (this.ended) {
|
|
185
|
+
return this.buildTrace(statusCode);
|
|
186
|
+
}
|
|
187
|
+
this.ended = true;
|
|
188
|
+
const trace = this.buildTrace(statusCode);
|
|
189
|
+
// Render timeline to console
|
|
190
|
+
if (this.config.enableTimeline) {
|
|
191
|
+
try {
|
|
192
|
+
(0, Timeline_1.renderTimeline)(trace, this.config.logger);
|
|
193
|
+
}
|
|
194
|
+
catch (_) {
|
|
195
|
+
// never crash
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
this.engine.safeEmit('trace:end', trace);
|
|
199
|
+
return trace;
|
|
200
|
+
}
|
|
201
|
+
buildTrace(statusCode) {
|
|
202
|
+
const endTime = performance.now();
|
|
203
|
+
const totalDuration = endTime - this.startTime;
|
|
204
|
+
const traceClassification = (0, Classifier_1.classifyTrace)(this.steps, totalDuration, this.config);
|
|
205
|
+
const rootCause = (0, RootCause_1.detectRootCause)(this.steps, statusCode, this.config);
|
|
206
|
+
return {
|
|
207
|
+
traceId: this.traceId,
|
|
208
|
+
endpoint: this.endpoint,
|
|
209
|
+
method: this.method,
|
|
210
|
+
statusCode,
|
|
211
|
+
steps: [...this.steps],
|
|
212
|
+
totalDuration,
|
|
213
|
+
classification: traceClassification,
|
|
214
|
+
rootCause,
|
|
215
|
+
startTime: 0,
|
|
216
|
+
endTime: totalDuration,
|
|
217
|
+
timestamp: new Date(),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.RequestTracer = RequestTracer;
|
|
222
|
+
//# sourceMappingURL=TraceEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TraceEngine.js","sourceRoot":"","sources":["../../../src/core/TraceEngine.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,+BAA+B;AAC/B,oDAAoD;AACpD,gEAAgE;;;AAEhE,mCAAsC;AACtC,mCASiB;AACjB,6CAAuD;AACvD,2CAA8C;AAC9C,yCAA4C;AAE5C,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB,iCAAiC;AACjC,SAAS,eAAe;IACpB,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,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,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAEvE,OAAO;YACH,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU;YACV,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YACtB,aAAa;YACb,cAAc,EAAE,mBAAmB;YACnC,SAAS;YACT,SAAS,EAAE,CAAC;YACZ,OAAO,EAAE,aAAa;YACtB,SAAS,EAAE,IAAI,IAAI,EAAE;SACxB,CAAC;IACN,CAAC;CACJ;AA9JD,sCA8JC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Core Type Definitions
|
|
4
|
+
// ─────────────────────────────────────────────────────────────
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_CONFIG = void 0;
|
|
7
|
+
exports.DEFAULT_CONFIG = {
|
|
8
|
+
enabled: true,
|
|
9
|
+
environment: process.env.NODE_ENV || 'development',
|
|
10
|
+
slowThreshold: 300,
|
|
11
|
+
slowQueryThreshold: 300,
|
|
12
|
+
defaultTimeout: 30000,
|
|
13
|
+
samplingRate: 1,
|
|
14
|
+
alwaysSampleErrors: true,
|
|
15
|
+
maxTraces: 1000,
|
|
16
|
+
enableTimeline: true,
|
|
17
|
+
enableDashboard: true,
|
|
18
|
+
largePayloadThreshold: 1024 * 1024, // 1MB
|
|
19
|
+
logger: console.log,
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,wCAAwC;AACxC,gEAAgE;;;AA0JnD,QAAA,cAAc,GAA6B;IACpD,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa;IAClD,aAAa,EAAE,GAAG;IAClB,kBAAkB,EAAE,GAAG;IACvB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE,CAAC;IACf,kBAAkB,EAAE,IAAI;IACxB,SAAS,EAAE,IAAI;IACf,cAAc,EAAE,IAAI;IACpB,eAAe,EAAE,IAAI;IACrB,qBAAqB,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM;IAC1C,MAAM,EAAE,OAAO,CAAC,GAAG;CACtB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Main Entry Point
|
|
4
|
+
// ─────────────────────────────────────────────────────────────
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.flowDebugger = exports.axiosTracer = exports.removeFetchTracer = exports.fetchTracer = exports.redisTracer = exports.pgTracer = exports.mysqlTracer = exports.removeMongoTracer = exports.mongoTracer = exports.DEFAULT_CONFIG = exports.renderCompact = exports.renderTimeline = exports.Sampler = exports.HealthMonitor = exports.Analytics = exports.detectRootCause = exports.classifyQuery = exports.classifyTrace = exports.classify = exports.RequestTracer = exports.TraceEngine = void 0;
|
|
7
|
+
// Core
|
|
8
|
+
var TraceEngine_1 = require("./core/TraceEngine");
|
|
9
|
+
Object.defineProperty(exports, "TraceEngine", { enumerable: true, get: function () { return TraceEngine_1.TraceEngine; } });
|
|
10
|
+
Object.defineProperty(exports, "RequestTracer", { enumerable: true, get: function () { return TraceEngine_1.RequestTracer; } });
|
|
11
|
+
var Classifier_1 = require("./core/Classifier");
|
|
12
|
+
Object.defineProperty(exports, "classify", { enumerable: true, get: function () { return Classifier_1.classify; } });
|
|
13
|
+
Object.defineProperty(exports, "classifyTrace", { enumerable: true, get: function () { return Classifier_1.classifyTrace; } });
|
|
14
|
+
Object.defineProperty(exports, "classifyQuery", { enumerable: true, get: function () { return Classifier_1.classifyQuery; } });
|
|
15
|
+
var RootCause_1 = require("./core/RootCause");
|
|
16
|
+
Object.defineProperty(exports, "detectRootCause", { enumerable: true, get: function () { return RootCause_1.detectRootCause; } });
|
|
17
|
+
var Analytics_1 = require("./core/Analytics");
|
|
18
|
+
Object.defineProperty(exports, "Analytics", { enumerable: true, get: function () { return Analytics_1.Analytics; } });
|
|
19
|
+
var HealthMonitor_1 = require("./core/HealthMonitor");
|
|
20
|
+
Object.defineProperty(exports, "HealthMonitor", { enumerable: true, get: function () { return HealthMonitor_1.HealthMonitor; } });
|
|
21
|
+
var Sampler_1 = require("./core/Sampler");
|
|
22
|
+
Object.defineProperty(exports, "Sampler", { enumerable: true, get: function () { return Sampler_1.Sampler; } });
|
|
23
|
+
var Timeline_1 = require("./core/Timeline");
|
|
24
|
+
Object.defineProperty(exports, "renderTimeline", { enumerable: true, get: function () { return Timeline_1.renderTimeline; } });
|
|
25
|
+
Object.defineProperty(exports, "renderCompact", { enumerable: true, get: function () { return Timeline_1.renderCompact; } });
|
|
26
|
+
var types_1 = require("./core/types");
|
|
27
|
+
Object.defineProperty(exports, "DEFAULT_CONFIG", { enumerable: true, get: function () { return types_1.DEFAULT_CONFIG; } });
|
|
28
|
+
// Integrations
|
|
29
|
+
var mongo_1 = require("./integrations/mongo");
|
|
30
|
+
Object.defineProperty(exports, "mongoTracer", { enumerable: true, get: function () { return mongo_1.mongoTracer; } });
|
|
31
|
+
Object.defineProperty(exports, "removeMongoTracer", { enumerable: true, get: function () { return mongo_1.removeMongoTracer; } });
|
|
32
|
+
var mysql_1 = require("./integrations/mysql");
|
|
33
|
+
Object.defineProperty(exports, "mysqlTracer", { enumerable: true, get: function () { return mysql_1.mysqlTracer; } });
|
|
34
|
+
var postgres_1 = require("./integrations/postgres");
|
|
35
|
+
Object.defineProperty(exports, "pgTracer", { enumerable: true, get: function () { return postgres_1.pgTracer; } });
|
|
36
|
+
var redis_1 = require("./integrations/redis");
|
|
37
|
+
Object.defineProperty(exports, "redisTracer", { enumerable: true, get: function () { return redis_1.redisTracer; } });
|
|
38
|
+
var fetch_1 = require("./integrations/fetch");
|
|
39
|
+
Object.defineProperty(exports, "fetchTracer", { enumerable: true, get: function () { return fetch_1.fetchTracer; } });
|
|
40
|
+
Object.defineProperty(exports, "removeFetchTracer", { enumerable: true, get: function () { return fetch_1.removeFetchTracer; } });
|
|
41
|
+
var axios_1 = require("./integrations/axios");
|
|
42
|
+
Object.defineProperty(exports, "axiosTracer", { enumerable: true, get: function () { return axios_1.axiosTracer; } });
|
|
43
|
+
// Middleware
|
|
44
|
+
var express_1 = require("./middleware/express");
|
|
45
|
+
Object.defineProperty(exports, "flowDebugger", { enumerable: true, get: function () { return express_1.flowDebugger; } });
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,mCAAmC;AACnC,gEAAgE;;;AAEhE,OAAO;AACP,kDAAgE;AAAvD,0GAAA,WAAW,OAAA;AAAE,4GAAA,aAAa,OAAA;AACnC,gDAA2E;AAAlE,sGAAA,QAAQ,OAAA;AAAE,2GAAA,aAAa,OAAA;AAAE,2GAAA,aAAa,OAAA;AAC/C,8CAAmD;AAA1C,4GAAA,eAAe,OAAA;AACxB,8CAA6C;AAApC,sGAAA,SAAS,OAAA;AAClB,sDAAqD;AAA5C,8GAAA,aAAa,OAAA;AACtB,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAChB,4CAAgE;AAAvD,0GAAA,cAAc,OAAA;AAAE,yGAAA,aAAa,OAAA;AAkBtC,sCAA8C;AAArC,uGAAA,cAAc,OAAA;AAEvB,eAAe;AACf,8CAAsE;AAA7D,oGAAA,WAAW,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AACvC,8CAAmD;AAA1C,oGAAA,WAAW,OAAA;AACpB,oDAAmD;AAA1C,oGAAA,QAAQ,OAAA;AACjB,8CAAmD;AAA1C,oGAAA,WAAW,OAAA;AACpB,8CAAsE;AAA7D,oGAAA,WAAW,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AACvC,8CAAmD;AAA1C,oGAAA,WAAW,OAAA;AAEpB,aAAa;AACb,gDAAoD;AAA3C,uGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Axios Auto-Instrument
|
|
4
|
+
// Uses interceptors to trace all Axios requests
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.axiosTracer = axiosTracer;
|
|
8
|
+
const types_1 = require("../core/types");
|
|
9
|
+
const Classifier_1 = require("../core/Classifier");
|
|
10
|
+
const DEFAULT_SERVICE_MAP = {
|
|
11
|
+
'stripe.com': 'stripe',
|
|
12
|
+
'api.stripe.com': 'stripe',
|
|
13
|
+
'razorpay.com': 'razorpay',
|
|
14
|
+
'api.razorpay.com': 'razorpay',
|
|
15
|
+
'sendgrid.com': 'sendgrid',
|
|
16
|
+
'api.sendgrid.com': 'sendgrid',
|
|
17
|
+
'twilio.com': 'twilio',
|
|
18
|
+
'api.twilio.com': 'twilio',
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Auto-instrument Axios instance to trace all HTTP requests.
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* axiosTracer(axios, { getTracer: () => currentTracer })
|
|
25
|
+
*
|
|
26
|
+
* Output:
|
|
27
|
+
* Axios POST https://api.stripe.com/v1/charges → 234ms ✔ [stripe]
|
|
28
|
+
* Axios GET https://api.razorpay.com/orders → 502 error ❌ [razorpay]
|
|
29
|
+
*/
|
|
30
|
+
function axiosTracer(axiosInstance, options) {
|
|
31
|
+
try {
|
|
32
|
+
if (axiosInstance.__flowDebuggerPatched)
|
|
33
|
+
return;
|
|
34
|
+
axiosInstance.__flowDebuggerPatched = true;
|
|
35
|
+
const config = { ...types_1.DEFAULT_CONFIG, ...options?.config };
|
|
36
|
+
const serviceMap = { ...DEFAULT_SERVICE_MAP, ...options?.serviceMap };
|
|
37
|
+
// Request interceptor — attach start time
|
|
38
|
+
axiosInstance.interceptors.request.use((reqConfig) => {
|
|
39
|
+
reqConfig.__flowDebuggerStartTime = performance.now();
|
|
40
|
+
return reqConfig;
|
|
41
|
+
}, (error) => Promise.reject(error));
|
|
42
|
+
// Response interceptor — record success
|
|
43
|
+
axiosInstance.interceptors.response.use((response) => {
|
|
44
|
+
const tracer = options?.getTracer?.();
|
|
45
|
+
if (!tracer)
|
|
46
|
+
return response;
|
|
47
|
+
const reqConfig = response.config;
|
|
48
|
+
const startTime = reqConfig.__flowDebuggerStartTime || performance.now();
|
|
49
|
+
const endTime = performance.now();
|
|
50
|
+
const duration = endTime - startTime;
|
|
51
|
+
const url = reqConfig.url || 'unknown';
|
|
52
|
+
const method = (reqConfig.method || 'GET').toUpperCase();
|
|
53
|
+
const service = getServiceFromUrl(url, serviceMap);
|
|
54
|
+
const stepName = `Axios ${method} ${getDomain(url)}`;
|
|
55
|
+
const classification = (0, Classifier_1.classifyQuery)(duration, 'success', config);
|
|
56
|
+
tracer.addStep({
|
|
57
|
+
name: stepName,
|
|
58
|
+
service,
|
|
59
|
+
status: 'success',
|
|
60
|
+
classification,
|
|
61
|
+
startTime,
|
|
62
|
+
endTime,
|
|
63
|
+
duration,
|
|
64
|
+
metadata: { url, method, statusCode: response.status },
|
|
65
|
+
});
|
|
66
|
+
return response;
|
|
67
|
+
}, (error) => {
|
|
68
|
+
const tracer = options?.getTracer?.();
|
|
69
|
+
if (!tracer)
|
|
70
|
+
return Promise.reject(error);
|
|
71
|
+
const reqConfig = error.config || {};
|
|
72
|
+
const startTime = reqConfig.__flowDebuggerStartTime || performance.now();
|
|
73
|
+
const endTime = performance.now();
|
|
74
|
+
const duration = endTime - startTime;
|
|
75
|
+
const url = reqConfig.url || 'unknown';
|
|
76
|
+
const method = (reqConfig.method || 'GET').toUpperCase();
|
|
77
|
+
const service = getServiceFromUrl(url, serviceMap);
|
|
78
|
+
const stepName = `Axios ${method} ${getDomain(url)}`;
|
|
79
|
+
let status = 'error';
|
|
80
|
+
let errorMsg = error.message || 'Request failed';
|
|
81
|
+
// Detect timeouts
|
|
82
|
+
if (error.code === 'ECONNABORTED' || error.code === 'ETIMEDOUT' || errorMsg.includes('timeout')) {
|
|
83
|
+
status = 'timeout';
|
|
84
|
+
}
|
|
85
|
+
// HTTP error status
|
|
86
|
+
if (error.response) {
|
|
87
|
+
errorMsg = `HTTP ${error.response.status} ${error.response.statusText || ''}`;
|
|
88
|
+
}
|
|
89
|
+
const classification = (0, Classifier_1.classifyQuery)(duration, status, config);
|
|
90
|
+
tracer.addStep({
|
|
91
|
+
name: stepName,
|
|
92
|
+
service,
|
|
93
|
+
status,
|
|
94
|
+
classification,
|
|
95
|
+
startTime,
|
|
96
|
+
endTime,
|
|
97
|
+
duration,
|
|
98
|
+
error: errorMsg,
|
|
99
|
+
stackTrace: error.stack,
|
|
100
|
+
metadata: { url, method, statusCode: error.response?.status },
|
|
101
|
+
});
|
|
102
|
+
return Promise.reject(error);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (_) {
|
|
106
|
+
// Production-safe: never crash
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Extract service tag from URL */
|
|
110
|
+
function getServiceFromUrl(url, serviceMap) {
|
|
111
|
+
try {
|
|
112
|
+
const urlObj = new URL(url);
|
|
113
|
+
const hostname = urlObj.hostname;
|
|
114
|
+
if (serviceMap[hostname])
|
|
115
|
+
return serviceMap[hostname];
|
|
116
|
+
for (const [pattern, service] of Object.entries(serviceMap)) {
|
|
117
|
+
if (hostname.includes(pattern))
|
|
118
|
+
return service;
|
|
119
|
+
}
|
|
120
|
+
return 'axios';
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return 'axios';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Extract domain from URL for display */
|
|
127
|
+
function getDomain(url) {
|
|
128
|
+
try {
|
|
129
|
+
const urlObj = new URL(url);
|
|
130
|
+
return urlObj.hostname + urlObj.pathname.substring(0, 30);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return url.substring(0, 50);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=axios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../src/integrations/axios.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,wCAAwC;AACxC,gDAAgD;AAChD,gEAAgE;;AAoChE,kCAgGC;AAjID,yCAAkG;AAClG,mDAAmD;AAWnD,MAAM,mBAAmB,GAA+B;IACpD,YAAY,EAAE,QAAQ;IACtB,gBAAgB,EAAE,QAAQ;IAC1B,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,UAAU;IAC9B,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,UAAU;IAC9B,YAAY,EAAE,QAAQ;IACtB,gBAAgB,EAAE,QAAQ;CAC7B,CAAC;AAEF;;;;;;;;;GASG;AACH,SAAgB,WAAW,CAAC,aAAuB,EAAE,OAA4B;IAC7E,IAAI,CAAC;QACD,IAAI,aAAa,CAAC,qBAAqB;YAAE,OAAO;QAChD,aAAa,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAE3C,MAAM,MAAM,GAAG,EAAE,GAAG,sBAAc,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC;QACzD,MAAM,UAAU,GAAG,EAAE,GAAG,mBAAmB,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC;QAEtE,0CAA0C;QAC1C,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAClC,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M,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─────────────────────────────────────────────────────────────
|
|
3
|
+
// flow-debugger — Fetch API Auto-Instrument
|
|
4
|
+
// Wraps global fetch to trace all HTTP requests
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.fetchTracer = fetchTracer;
|
|
8
|
+
exports.removeFetchTracer = removeFetchTracer;
|
|
9
|
+
const types_1 = require("../core/types");
|
|
10
|
+
const Classifier_1 = require("../core/Classifier");
|
|
11
|
+
const DEFAULT_SERVICE_MAP = {
|
|
12
|
+
'stripe.com': 'stripe',
|
|
13
|
+
'api.stripe.com': 'stripe',
|
|
14
|
+
'razorpay.com': 'razorpay',
|
|
15
|
+
'api.razorpay.com': 'razorpay',
|
|
16
|
+
'sendgrid.com': 'sendgrid',
|
|
17
|
+
'api.sendgrid.com': 'sendgrid',
|
|
18
|
+
'twilio.com': 'twilio',
|
|
19
|
+
'api.twilio.com': 'twilio',
|
|
20
|
+
};
|
|
21
|
+
let originalFetch;
|
|
22
|
+
/**
|
|
23
|
+
* Auto-instrument global fetch to trace all HTTP requests.
|
|
24
|
+
*
|
|
25
|
+
* Usage:
|
|
26
|
+
* fetchTracer({ getTracer: () => currentTracer, serviceMap: { 'myapi.com': 'external' } })
|
|
27
|
+
*
|
|
28
|
+
* Output:
|
|
29
|
+
* Fetch POST https://api.stripe.com/v1/charges → 234ms ✔ [stripe]
|
|
30
|
+
* Fetch GET https://api.razorpay.com/orders → timeout ❌ [razorpay]
|
|
31
|
+
*/
|
|
32
|
+
function fetchTracer(options) {
|
|
33
|
+
try {
|
|
34
|
+
if (typeof globalThis.fetch === 'undefined')
|
|
35
|
+
return;
|
|
36
|
+
if (globalThis.fetch.__flowDebuggerPatched)
|
|
37
|
+
return;
|
|
38
|
+
const config = { ...types_1.DEFAULT_CONFIG, ...options?.config };
|
|
39
|
+
const serviceMap = { ...DEFAULT_SERVICE_MAP, ...options?.serviceMap };
|
|
40
|
+
originalFetch = globalThis.fetch;
|
|
41
|
+
globalThis.fetch = async function tracedFetch(input, init) {
|
|
42
|
+
const tracer = options?.getTracer?.();
|
|
43
|
+
if (!tracer) {
|
|
44
|
+
return originalFetch(input, init);
|
|
45
|
+
}
|
|
46
|
+
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
|
|
47
|
+
const method = init?.method || 'GET';
|
|
48
|
+
const service = getServiceFromUrl(url, serviceMap);
|
|
49
|
+
const stepName = `Fetch ${method} ${getDomain(url)}`;
|
|
50
|
+
const startTime = performance.now();
|
|
51
|
+
let status = 'success';
|
|
52
|
+
let error;
|
|
53
|
+
let stackTrace;
|
|
54
|
+
let response;
|
|
55
|
+
try {
|
|
56
|
+
response = await originalFetch(input, init);
|
|
57
|
+
// HTTP errors (4xx, 5xx) are not thrown by fetch, but we should mark them
|
|
58
|
+
if (!response.ok) {
|
|
59
|
+
status = 'error';
|
|
60
|
+
error = `HTTP ${response.status} ${response.statusText}`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
status = 'error';
|
|
65
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
66
|
+
error = e.message;
|
|
67
|
+
stackTrace = e.stack;
|
|
68
|
+
// Detect network errors as timeouts
|
|
69
|
+
if (error.includes('fetch failed') || error.includes('network') || error.includes('ECONNREFUSED')) {
|
|
70
|
+
status = 'timeout';
|
|
71
|
+
}
|
|
72
|
+
const endTime = performance.now();
|
|
73
|
+
const duration = endTime - startTime;
|
|
74
|
+
const classification = (0, Classifier_1.classifyQuery)(duration, status, config);
|
|
75
|
+
tracer.addStep({
|
|
76
|
+
name: stepName,
|
|
77
|
+
service,
|
|
78
|
+
status,
|
|
79
|
+
classification,
|
|
80
|
+
startTime,
|
|
81
|
+
endTime,
|
|
82
|
+
duration,
|
|
83
|
+
error,
|
|
84
|
+
stackTrace,
|
|
85
|
+
metadata: { url, method, service },
|
|
86
|
+
});
|
|
87
|
+
throw err;
|
|
88
|
+
}
|
|
89
|
+
const endTime = performance.now();
|
|
90
|
+
const duration = endTime - startTime;
|
|
91
|
+
const classification = (0, Classifier_1.classifyQuery)(duration, status, config);
|
|
92
|
+
tracer.addStep({
|
|
93
|
+
name: stepName,
|
|
94
|
+
service,
|
|
95
|
+
status,
|
|
96
|
+
classification,
|
|
97
|
+
startTime,
|
|
98
|
+
endTime,
|
|
99
|
+
duration,
|
|
100
|
+
error,
|
|
101
|
+
metadata: { url, method, statusCode: response.status },
|
|
102
|
+
});
|
|
103
|
+
return response;
|
|
104
|
+
};
|
|
105
|
+
globalThis.fetch.__flowDebuggerPatched = true;
|
|
106
|
+
}
|
|
107
|
+
catch (_) {
|
|
108
|
+
// Production-safe: never crash
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Remove fetch tracer (for testing/cleanup)
|
|
113
|
+
*/
|
|
114
|
+
function removeFetchTracer() {
|
|
115
|
+
try {
|
|
116
|
+
if (originalFetch) {
|
|
117
|
+
globalThis.fetch = originalFetch;
|
|
118
|
+
delete globalThis.fetch.__flowDebuggerPatched;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (_) { }
|
|
122
|
+
}
|
|
123
|
+
/** Extract service tag from URL */
|
|
124
|
+
function getServiceFromUrl(url, serviceMap) {
|
|
125
|
+
try {
|
|
126
|
+
const urlObj = new URL(url);
|
|
127
|
+
const hostname = urlObj.hostname;
|
|
128
|
+
// Check exact match
|
|
129
|
+
if (serviceMap[hostname])
|
|
130
|
+
return serviceMap[hostname];
|
|
131
|
+
// Check partial match
|
|
132
|
+
for (const [pattern, service] of Object.entries(serviceMap)) {
|
|
133
|
+
if (hostname.includes(pattern))
|
|
134
|
+
return service;
|
|
135
|
+
}
|
|
136
|
+
// Default to fetch
|
|
137
|
+
return 'fetch';
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return 'fetch';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** Extract domain from URL for display */
|
|
144
|
+
function getDomain(url) {
|
|
145
|
+
try {
|
|
146
|
+
const urlObj = new URL(url);
|
|
147
|
+
return urlObj.hostname + urlObj.pathname.substring(0, 30);
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return url.substring(0, 50);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/integrations/fetch.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,4CAA4C;AAC5C,gDAAgD;AAChD,gEAAgE;;AAoChE,kCAyFC;AAKD,8CAOC;AAtID,yCAAkG;AAClG,mDAAmD;AASnD,MAAM,mBAAmB,GAA+B;IACpD,YAAY,EAAE,QAAQ;IACtB,gBAAgB,EAAE,QAAQ;IAC1B,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,UAAU;IAC9B,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,UAAU;IAC9B,YAAY,EAAE,QAAQ;IACtB,gBAAgB,EAAE,QAAQ;CAC7B,CAAC;AAEF,IAAI,aAA2B,CAAC;AAEhC;;;;;;;;;GASG;AACH,SAAgB,WAAW,CAAC,OAA4B;IACpD,IAAI,CAAC;QACD,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,WAAW;YAAE,OAAO;QACpD,IAAK,UAAU,CAAC,KAAa,CA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