@casoon/auditmysite
Version:
Professional website analysis suite with robust accessibility testing, Core Web Vitals performance monitoring, SEO analysis, and content optimization insights. Features isolated browser contexts, retry mechanisms, and comprehensive API endpoints for profe
74 lines • 2.77 kB
JavaScript
;
/**
* đź”’ STRICT AUDIT TYPES - MANDATORY DATA STRUCTURES
*
* Diese Interfaces erzwingen vollständige Datenstrukturen und verbieten
* undefined/null-Werte fĂĽr kritische Felder.
*
* Wenn Daten fehlen, soll das System explizit fehlschlagen,
* nicht mit leeren/Standard-Werten weiterarbeiten.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MissingAnalysisError = exports.IncompleteAuditDataError = void 0;
exports.isStrictAuditData = isStrictAuditData;
exports.hasCompleteAnalysis = hasCompleteAnalysis;
// ============================================================================
// TYPE GUARDS AND VALIDATION UTILITIES
// ============================================================================
/**
* Type Guard: PrĂĽft ob ein Objekt StrictAuditData ist
*/
function isStrictAuditData(data) {
return (data &&
typeof data === 'object' &&
data.metadata &&
data.summary &&
Array.isArray(data.pages) &&
data.pages.length > 0 &&
data.systemPerformance);
}
/**
* Type Guard: PrĂĽft ob eine Seite alle verpflichtenden Analysen hat
*/
function hasCompleteAnalysis(page) {
return (page &&
page.accessibility &&
page.performance &&
page.seo &&
page.contentWeight &&
page.mobileFriendliness &&
typeof page.accessibility.score === 'number' &&
typeof page.performance.score === 'number' &&
typeof page.seo.score === 'number' &&
typeof page.contentWeight.score === 'number' &&
typeof page.mobileFriendliness.overallScore === 'number');
}
// ============================================================================
// ERROR CLASSES FOR STRICT VALIDATION
// ============================================================================
/**
* Fehler für unvollständige Audit-Daten
*/
class IncompleteAuditDataError extends Error {
constructor(message, missingFields, pageUrl) {
super(`Incomplete audit data: ${message}. Missing fields: ${missingFields.join(', ')}`);
this.missingFields = missingFields;
this.pageUrl = pageUrl;
this.name = 'IncompleteAuditDataError';
}
}
exports.IncompleteAuditDataError = IncompleteAuditDataError;
/**
* Fehler fĂĽr fehlende Analyse-Ergebnisse
*/
class MissingAnalysisError extends Error {
constructor(analysisType, pageUrl, reason) {
super(`Missing ${analysisType} analysis for page: ${pageUrl}${reason ? `. Reason: ${reason}` : ''}`);
this.analysisType = analysisType;
this.pageUrl = pageUrl;
this.reason = reason;
this.name = 'MissingAnalysisError';
}
}
exports.MissingAnalysisError = MissingAnalysisError;
//# sourceMappingURL=strict-audit-types.js.map