@dawans/promptshield
Version:
Secure your LLM stack with enterprise-grade RulePacks for AI safety scanning
44 lines (43 loc) • 1.14 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidationResultBuilder = void 0;
class ValidationResultBuilder {
constructor(target, validationType) {
this.target = target;
this.validationType = validationType;
this.errors = [];
this.warnings = [];
}
addError(field, message, code, line, column) {
this.errors.push({
field,
message,
code,
severity: 'error',
line,
column,
});
return this;
}
addWarning(field, message, code, line, column) {
this.warnings.push({
field,
message,
code,
severity: 'warning',
line,
column,
});
return this;
}
build() {
return {
isValid: this.errors.length === 0,
errors: [...this.errors],
warnings: [...this.warnings],
target: this.target,
validationType: this.validationType,
};
}
}
exports.ValidationResultBuilder = ValidationResultBuilder;