feat: add repository pattern, service layer architecture, and scheduler management

- Implement repository pattern for data access layer
- Add comprehensive service layer for business logic
- Create scheduler management system with health monitoring
- Add bounded buffer utility for memory management
- Enhance security audit logging with retention policies
This commit is contained in:
2025-07-12 07:00:37 +02:00
parent e1abedb148
commit 041a1cc3ef
54 changed files with 5755 additions and 878 deletions

View File

@ -53,9 +53,9 @@ class PerformanceMonitor {
});
// Monitor CLS (Cumulative Layout Shift)
this.observeMetric("layout-shift", (entries) => {
this.observeMetric("layout-shift", (list) => {
let clsValue = 0;
for (const entry of entries) {
for (const entry of list) {
const entryWithValue = entry as PerformanceEntry & {
value: number;
hadRecentInput: boolean;
@ -180,8 +180,8 @@ class PerformanceMonitor {
private sendToAnalytics(metricName: string, value: number) {
// Placeholder for analytics integration
// You could send this to Google Analytics, Vercel Analytics, etc.
if (typeof gtag !== "undefined") {
gtag("event", "core_web_vital", {
if (typeof window !== "undefined" && "gtag" in window) {
(window as any).gtag("event", "core_web_vital", {
name: metricName,
value: Math.round(value),
metric_rating: this.getRating(metricName, value),
@ -339,11 +339,15 @@ export const ResourceOptimizer = {
const scripts = Array.from(document.querySelectorAll("script[src]"));
const styles = Array.from(document.querySelectorAll("link[href]"));
return [...scripts, ...styles].some(
(element) =>
(element as HTMLScriptElement | HTMLLinkElement).src === url ||
(element as HTMLLinkElement).href === url
);
return [...scripts, ...styles].some((element) => {
if (element.tagName === "SCRIPT") {
return (element as HTMLScriptElement).src === url;
}
if (element.tagName === "LINK") {
return (element as HTMLLinkElement).href === url;
}
return false;
});
},
};