openredaction 1.0.0 → 1.0.8
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/README.md +57 -1
- package/dist/index.d.ts +112 -22
- package/dist/index.js +650 -223
- package/dist/index.mjs +592 -180
- package/package.json +12 -27
- package/dist/HealthCheck-A5OD4ATR.mjs +0 -12
- package/dist/HealthCheck-A5OD4ATR.mjs.map +0 -1
- package/dist/chunk-7OGNW2MU.mjs +0 -1701
- package/dist/chunk-7OGNW2MU.mjs.map +0 -1
- package/dist/chunk-MYYLGNXS.mjs +0 -149
- package/dist/chunk-MYYLGNXS.mjs.map +0 -1
- package/dist/chunk-WMJKH4XE.mjs +0 -34
- package/dist/chunk-WMJKH4XE.mjs.map +0 -1
- package/dist/chunk-ZRHGDEPC.mjs +0 -297
- package/dist/chunk-ZRHGDEPC.mjs.map +0 -1
- package/dist/cli/test-pattern.js +0 -430
- package/dist/document-AOMZP7UR.mjs +0 -26
- package/dist/document-AOMZP7UR.mjs.map +0 -1
- package/dist/index.cli.js +0 -15093
- package/dist/index.d.mts +0 -4111
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/workers-RMN5POM6.mjs +0 -10
- package/dist/workers-RMN5POM6.mjs.map +0 -1
package/dist/chunk-ZRHGDEPC.mjs
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
// src/health/HealthCheck.ts
|
|
2
|
-
var HealthChecker = class {
|
|
3
|
-
constructor(detector) {
|
|
4
|
-
this.detector = detector;
|
|
5
|
-
this.initTime = Date.now();
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Run complete health check
|
|
9
|
-
*/
|
|
10
|
-
async check(options = {}) {
|
|
11
|
-
const result = {
|
|
12
|
-
status: "healthy",
|
|
13
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14
|
-
checks: {
|
|
15
|
-
detector: { status: "pass", message: "Detector initialized" },
|
|
16
|
-
patterns: { status: "pass", message: "Patterns loaded" },
|
|
17
|
-
performance: { status: "pass", message: "Performance acceptable" },
|
|
18
|
-
memory: { status: "pass", message: "Memory usage normal" }
|
|
19
|
-
},
|
|
20
|
-
metrics: {
|
|
21
|
-
totalPatterns: 0,
|
|
22
|
-
compiledPatterns: 0,
|
|
23
|
-
cacheEnabled: false,
|
|
24
|
-
uptime: Date.now() - this.initTime
|
|
25
|
-
},
|
|
26
|
-
errors: [],
|
|
27
|
-
warnings: []
|
|
28
|
-
};
|
|
29
|
-
try {
|
|
30
|
-
result.checks.detector = await this.checkDetector(options);
|
|
31
|
-
result.checks.patterns = await this.checkPatterns();
|
|
32
|
-
if (options.checkPerformance !== false) {
|
|
33
|
-
result.checks.performance = await this.checkPerformance(
|
|
34
|
-
options.performanceThreshold
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
result.checks.memory = await this.checkMemory(options.memoryThreshold);
|
|
38
|
-
result.metrics = this.collectMetrics();
|
|
39
|
-
result.status = this.determineOverallStatus(result.checks);
|
|
40
|
-
for (const check of Object.values(result.checks)) {
|
|
41
|
-
if (check.status === "fail") {
|
|
42
|
-
result.errors.push(check.message);
|
|
43
|
-
} else if (check.status === "warn") {
|
|
44
|
-
result.warnings.push(check.message);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
} catch (error) {
|
|
48
|
-
result.status = "unhealthy";
|
|
49
|
-
result.errors.push(`Health check failed: ${error.message}`);
|
|
50
|
-
}
|
|
51
|
-
return result;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Check detector functionality
|
|
55
|
-
*/
|
|
56
|
-
async checkDetector(options) {
|
|
57
|
-
try {
|
|
58
|
-
if (options.testDetection !== false) {
|
|
59
|
-
const testText = "Test email: test@example.com";
|
|
60
|
-
const result = this.detector.detect(testText);
|
|
61
|
-
if (!result || !result.detections) {
|
|
62
|
-
return {
|
|
63
|
-
status: "fail",
|
|
64
|
-
message: "Detector returned invalid result"
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
if (result.detections.length === 0) {
|
|
68
|
-
return {
|
|
69
|
-
status: "warn",
|
|
70
|
-
message: "Test detection found no PII (expected at least 1)"
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
status: "pass",
|
|
76
|
-
message: "Detector functioning correctly"
|
|
77
|
-
};
|
|
78
|
-
} catch (error) {
|
|
79
|
-
return {
|
|
80
|
-
status: "fail",
|
|
81
|
-
message: `Detector check failed: ${error.message}`
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Check patterns are loaded
|
|
87
|
-
*/
|
|
88
|
-
async checkPatterns() {
|
|
89
|
-
try {
|
|
90
|
-
const patterns = this.detector.getPatterns();
|
|
91
|
-
if (!patterns || patterns.length === 0) {
|
|
92
|
-
return {
|
|
93
|
-
status: "fail",
|
|
94
|
-
message: "No patterns loaded",
|
|
95
|
-
value: 0,
|
|
96
|
-
threshold: 1
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (patterns.length < 10) {
|
|
100
|
-
return {
|
|
101
|
-
status: "warn",
|
|
102
|
-
message: "Very few patterns loaded (expected more)",
|
|
103
|
-
value: patterns.length,
|
|
104
|
-
threshold: 10
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
status: "pass",
|
|
109
|
-
message: `${patterns.length} patterns loaded`,
|
|
110
|
-
value: patterns.length
|
|
111
|
-
};
|
|
112
|
-
} catch (error) {
|
|
113
|
-
return {
|
|
114
|
-
status: "fail",
|
|
115
|
-
message: `Pattern check failed: ${error.message}`
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Check performance
|
|
121
|
-
*/
|
|
122
|
-
async checkPerformance(threshold = 100) {
|
|
123
|
-
try {
|
|
124
|
-
const testText = "Test: john@example.com, phone: 555-123-4567, IP: 192.168.1.1";
|
|
125
|
-
const start = performance.now();
|
|
126
|
-
this.detector.detect(testText);
|
|
127
|
-
const duration = performance.now() - start;
|
|
128
|
-
if (duration > threshold * 2) {
|
|
129
|
-
return {
|
|
130
|
-
status: "fail",
|
|
131
|
-
message: `Performance degraded: ${duration.toFixed(2)}ms`,
|
|
132
|
-
value: duration,
|
|
133
|
-
threshold
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
if (duration > threshold) {
|
|
137
|
-
return {
|
|
138
|
-
status: "warn",
|
|
139
|
-
message: `Performance slower than expected: ${duration.toFixed(2)}ms`,
|
|
140
|
-
value: duration,
|
|
141
|
-
threshold
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
status: "pass",
|
|
146
|
-
message: `Performance good: ${duration.toFixed(2)}ms`,
|
|
147
|
-
value: duration,
|
|
148
|
-
threshold
|
|
149
|
-
};
|
|
150
|
-
} catch (error) {
|
|
151
|
-
return {
|
|
152
|
-
status: "fail",
|
|
153
|
-
message: `Performance check failed: ${error.message}`
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Check memory usage
|
|
159
|
-
*/
|
|
160
|
-
async checkMemory(threshold = 100) {
|
|
161
|
-
try {
|
|
162
|
-
if (typeof process === "undefined" || !process.memoryUsage) {
|
|
163
|
-
return {
|
|
164
|
-
status: "pass",
|
|
165
|
-
message: "Memory check skipped (not in Node.js)"
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
const usage = process.memoryUsage();
|
|
169
|
-
const heapUsedMB = usage.heapUsed / 1024 / 1024;
|
|
170
|
-
if (heapUsedMB > threshold * 2) {
|
|
171
|
-
return {
|
|
172
|
-
status: "fail",
|
|
173
|
-
message: `High memory usage: ${heapUsedMB.toFixed(2)}MB`,
|
|
174
|
-
value: heapUsedMB,
|
|
175
|
-
threshold
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
if (heapUsedMB > threshold) {
|
|
179
|
-
return {
|
|
180
|
-
status: "warn",
|
|
181
|
-
message: `Elevated memory usage: ${heapUsedMB.toFixed(2)}MB`,
|
|
182
|
-
value: heapUsedMB,
|
|
183
|
-
threshold
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
status: "pass",
|
|
188
|
-
message: `Memory usage normal: ${heapUsedMB.toFixed(2)}MB`,
|
|
189
|
-
value: heapUsedMB,
|
|
190
|
-
threshold
|
|
191
|
-
};
|
|
192
|
-
} catch (error) {
|
|
193
|
-
return {
|
|
194
|
-
status: "warn",
|
|
195
|
-
message: `Memory check skipped: ${error.message}`
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Collect metrics
|
|
201
|
-
*/
|
|
202
|
-
collectMetrics() {
|
|
203
|
-
const patterns = this.detector.getPatterns();
|
|
204
|
-
const cacheStats = this.detector.getCacheStats();
|
|
205
|
-
return {
|
|
206
|
-
totalPatterns: patterns.length,
|
|
207
|
-
compiledPatterns: patterns.length,
|
|
208
|
-
// All patterns are pre-compiled
|
|
209
|
-
cacheSize: cacheStats.size,
|
|
210
|
-
cacheEnabled: cacheStats.enabled,
|
|
211
|
-
uptime: Date.now() - this.initTime
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Determine overall status
|
|
216
|
-
*/
|
|
217
|
-
determineOverallStatus(checks) {
|
|
218
|
-
const statuses = Object.values(checks).map((c) => c.status);
|
|
219
|
-
if (statuses.includes("fail")) {
|
|
220
|
-
return "unhealthy";
|
|
221
|
-
}
|
|
222
|
-
if (statuses.includes("warn")) {
|
|
223
|
-
return "degraded";
|
|
224
|
-
}
|
|
225
|
-
return "healthy";
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Quick health check (minimal overhead)
|
|
229
|
-
*/
|
|
230
|
-
async quickCheck() {
|
|
231
|
-
try {
|
|
232
|
-
const patterns = this.detector.getPatterns();
|
|
233
|
-
if (patterns.length === 0) {
|
|
234
|
-
return { status: "unhealthy", message: "No patterns loaded" };
|
|
235
|
-
}
|
|
236
|
-
return { status: "healthy", message: "OK" };
|
|
237
|
-
} catch (error) {
|
|
238
|
-
return {
|
|
239
|
-
status: "unhealthy",
|
|
240
|
-
message: `Error: ${error.message}`
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Get system info for debugging
|
|
246
|
-
*/
|
|
247
|
-
getSystemInfo() {
|
|
248
|
-
const patterns = this.detector.getPatterns();
|
|
249
|
-
const cacheStats = this.detector.getCacheStats();
|
|
250
|
-
return {
|
|
251
|
-
version: "1.0.0",
|
|
252
|
-
// Should come from package.json
|
|
253
|
-
patterns: {
|
|
254
|
-
total: patterns.length,
|
|
255
|
-
types: [...new Set(patterns.map((p) => p.type.split("_")[0]))].length
|
|
256
|
-
},
|
|
257
|
-
cache: {
|
|
258
|
-
enabled: cacheStats.enabled,
|
|
259
|
-
size: cacheStats.size,
|
|
260
|
-
maxSize: cacheStats.maxSize
|
|
261
|
-
},
|
|
262
|
-
uptime: Date.now() - this.initTime,
|
|
263
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
function createHealthChecker(detector) {
|
|
268
|
-
return new HealthChecker(detector);
|
|
269
|
-
}
|
|
270
|
-
function healthCheckMiddleware(detector) {
|
|
271
|
-
const checker = new HealthChecker(detector);
|
|
272
|
-
return async (_req, res) => {
|
|
273
|
-
try {
|
|
274
|
-
const result = await checker.check({
|
|
275
|
-
testDetection: true,
|
|
276
|
-
checkPerformance: true,
|
|
277
|
-
performanceThreshold: 100,
|
|
278
|
-
memoryThreshold: 100
|
|
279
|
-
});
|
|
280
|
-
const statusCode = result.status === "healthy" ? 200 : result.status === "degraded" ? 200 : 503;
|
|
281
|
-
res.status(statusCode).json(result);
|
|
282
|
-
} catch (error) {
|
|
283
|
-
res.status(503).json({
|
|
284
|
-
status: "unhealthy",
|
|
285
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
286
|
-
error: error.message
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export {
|
|
293
|
-
HealthChecker,
|
|
294
|
-
createHealthChecker,
|
|
295
|
-
healthCheckMiddleware
|
|
296
|
-
};
|
|
297
|
-
//# sourceMappingURL=chunk-ZRHGDEPC.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/health/HealthCheck.ts"],"sourcesContent":["/**\n * Health check API for production monitoring\n * Verify detector is working correctly and get system status\n */\n\nimport type { OpenRedaction } from '../detector';\n\nexport interface HealthCheckResult {\n status: 'healthy' | 'degraded' | 'unhealthy';\n timestamp: string;\n checks: {\n detector: HealthCheckStatus;\n patterns: HealthCheckStatus;\n performance: HealthCheckStatus;\n memory: HealthCheckStatus;\n };\n metrics: {\n totalPatterns: number;\n compiledPatterns: number;\n cacheSize?: number;\n cacheEnabled: boolean;\n uptime: number; // milliseconds since initialization\n };\n errors: string[];\n warnings: string[];\n}\n\nexport interface HealthCheckStatus {\n status: 'pass' | 'warn' | 'fail';\n message: string;\n value?: any;\n threshold?: any;\n}\n\nexport interface HealthCheckOptions {\n testDetection?: boolean; // Run a test detection\n checkPerformance?: boolean; // Run performance benchmark\n performanceThreshold?: number; // Max acceptable detection time (ms)\n memoryThreshold?: number; // Max acceptable memory usage (MB)\n}\n\nexport class HealthChecker {\n private detector: OpenRedaction;\n private initTime: number;\n\n constructor(detector: OpenRedaction) {\n this.detector = detector;\n this.initTime = Date.now();\n }\n\n /**\n * Run complete health check\n */\n async check(options: HealthCheckOptions = {}): Promise<HealthCheckResult> {\n const result: HealthCheckResult = {\n status: 'healthy',\n timestamp: new Date().toISOString(),\n checks: {\n detector: { status: 'pass', message: 'Detector initialized' },\n patterns: { status: 'pass', message: 'Patterns loaded' },\n performance: { status: 'pass', message: 'Performance acceptable' },\n memory: { status: 'pass', message: 'Memory usage normal' }\n },\n metrics: {\n totalPatterns: 0,\n compiledPatterns: 0,\n cacheEnabled: false,\n uptime: Date.now() - this.initTime\n },\n errors: [],\n warnings: []\n };\n\n try {\n // Check 1: Detector status\n result.checks.detector = await this.checkDetector(options);\n\n // Check 2: Patterns status\n result.checks.patterns = await this.checkPatterns();\n\n // Check 3: Performance\n if (options.checkPerformance !== false) {\n result.checks.performance = await this.checkPerformance(\n options.performanceThreshold\n );\n }\n\n // Check 4: Memory\n result.checks.memory = await this.checkMemory(options.memoryThreshold);\n\n // Collect metrics\n result.metrics = this.collectMetrics();\n\n // Determine overall status\n result.status = this.determineOverallStatus(result.checks);\n\n // Collect errors and warnings\n for (const check of Object.values(result.checks)) {\n if (check.status === 'fail') {\n result.errors.push(check.message);\n } else if (check.status === 'warn') {\n result.warnings.push(check.message);\n }\n }\n } catch (error) {\n result.status = 'unhealthy';\n result.errors.push(`Health check failed: ${(error as Error).message}`);\n }\n\n return result;\n }\n\n /**\n * Check detector functionality\n */\n private async checkDetector(options: HealthCheckOptions): Promise<HealthCheckStatus> {\n try {\n // Run test detection if enabled\n if (options.testDetection !== false) {\n const testText = 'Test email: test@example.com';\n const result = this.detector.detect(testText);\n\n if (!result || !result.detections) {\n return {\n status: 'fail',\n message: 'Detector returned invalid result'\n };\n }\n\n // Verify detection worked\n if (result.detections.length === 0) {\n return {\n status: 'warn',\n message: 'Test detection found no PII (expected at least 1)'\n };\n }\n }\n\n return {\n status: 'pass',\n message: 'Detector functioning correctly'\n };\n } catch (error) {\n return {\n status: 'fail',\n message: `Detector check failed: ${(error as Error).message}`\n };\n }\n }\n\n /**\n * Check patterns are loaded\n */\n private async checkPatterns(): Promise<HealthCheckStatus> {\n try {\n const patterns = this.detector.getPatterns();\n\n if (!patterns || patterns.length === 0) {\n return {\n status: 'fail',\n message: 'No patterns loaded',\n value: 0,\n threshold: 1\n };\n }\n\n if (patterns.length < 10) {\n return {\n status: 'warn',\n message: 'Very few patterns loaded (expected more)',\n value: patterns.length,\n threshold: 10\n };\n }\n\n return {\n status: 'pass',\n message: `${patterns.length} patterns loaded`,\n value: patterns.length\n };\n } catch (error) {\n return {\n status: 'fail',\n message: `Pattern check failed: ${(error as Error).message}`\n };\n }\n }\n\n /**\n * Check performance\n */\n private async checkPerformance(\n threshold: number = 100\n ): Promise<HealthCheckStatus> {\n try {\n const testText = 'Test: john@example.com, phone: 555-123-4567, IP: 192.168.1.1';\n const start = performance.now();\n this.detector.detect(testText);\n const duration = performance.now() - start;\n\n if (duration > threshold * 2) {\n return {\n status: 'fail',\n message: `Performance degraded: ${duration.toFixed(2)}ms`,\n value: duration,\n threshold\n };\n }\n\n if (duration > threshold) {\n return {\n status: 'warn',\n message: `Performance slower than expected: ${duration.toFixed(2)}ms`,\n value: duration,\n threshold\n };\n }\n\n return {\n status: 'pass',\n message: `Performance good: ${duration.toFixed(2)}ms`,\n value: duration,\n threshold\n };\n } catch (error) {\n return {\n status: 'fail',\n message: `Performance check failed: ${(error as Error).message}`\n };\n }\n }\n\n /**\n * Check memory usage\n */\n private async checkMemory(threshold: number = 100): Promise<HealthCheckStatus> {\n try {\n if (typeof process === 'undefined' || !process.memoryUsage) {\n return {\n status: 'pass',\n message: 'Memory check skipped (not in Node.js)'\n };\n }\n\n const usage = process.memoryUsage();\n const heapUsedMB = usage.heapUsed / 1024 / 1024;\n\n if (heapUsedMB > threshold * 2) {\n return {\n status: 'fail',\n message: `High memory usage: ${heapUsedMB.toFixed(2)}MB`,\n value: heapUsedMB,\n threshold\n };\n }\n\n if (heapUsedMB > threshold) {\n return {\n status: 'warn',\n message: `Elevated memory usage: ${heapUsedMB.toFixed(2)}MB`,\n value: heapUsedMB,\n threshold\n };\n }\n\n return {\n status: 'pass',\n message: `Memory usage normal: ${heapUsedMB.toFixed(2)}MB`,\n value: heapUsedMB,\n threshold\n };\n } catch (error) {\n return {\n status: 'warn',\n message: `Memory check skipped: ${(error as Error).message}`\n };\n }\n }\n\n /**\n * Collect metrics\n */\n private collectMetrics() {\n const patterns = this.detector.getPatterns();\n const cacheStats = this.detector.getCacheStats();\n\n return {\n totalPatterns: patterns.length,\n compiledPatterns: patterns.length, // All patterns are pre-compiled\n cacheSize: cacheStats.size,\n cacheEnabled: cacheStats.enabled,\n uptime: Date.now() - this.initTime\n };\n }\n\n /**\n * Determine overall status\n */\n private determineOverallStatus(checks: HealthCheckResult['checks']): 'healthy' | 'degraded' | 'unhealthy' {\n const statuses = Object.values(checks).map(c => c.status);\n\n if (statuses.includes('fail')) {\n return 'unhealthy';\n }\n\n if (statuses.includes('warn')) {\n return 'degraded';\n }\n\n return 'healthy';\n }\n\n /**\n * Quick health check (minimal overhead)\n */\n async quickCheck(): Promise<{ status: 'healthy' | 'unhealthy'; message: string }> {\n try {\n // Just verify basic functionality\n const patterns = this.detector.getPatterns();\n if (patterns.length === 0) {\n return { status: 'unhealthy', message: 'No patterns loaded' };\n }\n\n return { status: 'healthy', message: 'OK' };\n } catch (error) {\n return {\n status: 'unhealthy',\n message: `Error: ${(error as Error).message}`\n };\n }\n }\n\n /**\n * Get system info for debugging\n */\n getSystemInfo() {\n const patterns = this.detector.getPatterns();\n const cacheStats = this.detector.getCacheStats();\n\n return {\n version: '1.0.0', // Should come from package.json\n patterns: {\n total: patterns.length,\n types: [...new Set(patterns.map(p => p.type.split('_')[0]))].length\n },\n cache: {\n enabled: cacheStats.enabled,\n size: cacheStats.size,\n maxSize: cacheStats.maxSize\n },\n uptime: Date.now() - this.initTime,\n timestamp: new Date().toISOString()\n };\n }\n}\n\n/**\n * Create health checker for a detector\n */\nexport function createHealthChecker(detector: OpenRedaction): HealthChecker {\n return new HealthChecker(detector);\n}\n\n/**\n * Express middleware for health check endpoint\n */\nexport function healthCheckMiddleware(detector: OpenRedaction) {\n const checker = new HealthChecker(detector);\n\n return async (_req: any, res: any) => {\n try {\n const result = await checker.check({\n testDetection: true,\n checkPerformance: true,\n performanceThreshold: 100,\n memoryThreshold: 100\n });\n\n const statusCode = result.status === 'healthy' ? 200 :\n result.status === 'degraded' ? 200 : 503;\n\n res.status(statusCode).json(result);\n } catch (error) {\n res.status(503).json({\n status: 'unhealthy',\n timestamp: new Date().toISOString(),\n error: (error as Error).message\n });\n }\n };\n}\n"],"mappings":";AAyCO,IAAM,gBAAN,MAAoB;AAAA,EAIzB,YAAY,UAAyB;AACnC,SAAK,WAAW;AAChB,SAAK,WAAW,KAAK,IAAI;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,MAAM,UAA8B,CAAC,GAA+B;AACxE,UAAM,SAA4B;AAAA,MAChC,QAAQ;AAAA,MACR,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,MAClC,QAAQ;AAAA,QACN,UAAU,EAAE,QAAQ,QAAQ,SAAS,uBAAuB;AAAA,QAC5D,UAAU,EAAE,QAAQ,QAAQ,SAAS,kBAAkB;AAAA,QACvD,aAAa,EAAE,QAAQ,QAAQ,SAAS,yBAAyB;AAAA,QACjE,QAAQ,EAAE,QAAQ,QAAQ,SAAS,sBAAsB;AAAA,MAC3D;AAAA,MACA,SAAS;AAAA,QACP,eAAe;AAAA,QACf,kBAAkB;AAAA,QAClB,cAAc;AAAA,QACd,QAAQ,KAAK,IAAI,IAAI,KAAK;AAAA,MAC5B;AAAA,MACA,QAAQ,CAAC;AAAA,MACT,UAAU,CAAC;AAAA,IACb;AAEA,QAAI;AAEF,aAAO,OAAO,WAAW,MAAM,KAAK,cAAc,OAAO;AAGzD,aAAO,OAAO,WAAW,MAAM,KAAK,cAAc;AAGlD,UAAI,QAAQ,qBAAqB,OAAO;AACtC,eAAO,OAAO,cAAc,MAAM,KAAK;AAAA,UACrC,QAAQ;AAAA,QACV;AAAA,MACF;AAGA,aAAO,OAAO,SAAS,MAAM,KAAK,YAAY,QAAQ,eAAe;AAGrE,aAAO,UAAU,KAAK,eAAe;AAGrC,aAAO,SAAS,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