its-compiler-js
Version:
JavaScript/TypeScript implementation of the Instruction Template Specification (ITS) compiler
60 lines • 2.23 kB
JavaScript
/**
* Type definitions for ITS Compiler
*/
export var OverrideType;
(function (OverrideType) {
OverrideType["CUSTOM"] = "custom";
OverrideType["SCHEMA_EXTENSION"] = "schema";
OverrideType["STANDARD"] = "standard";
})(OverrideType || (OverrideType = {}));
export class ITSError extends Error {
constructor(message, details, errorCode) {
super(message);
this.name = this.constructor.name;
if (details !== undefined)
this.details = details;
if (errorCode !== undefined)
this.errorCode = errorCode;
}
}
export class ITSValidationError extends ITSError {
constructor(message, path, validationErrors = [], securityIssues = [], details) {
super(message, details, 'VALIDATION_FAILED');
if (path !== undefined)
this.path = path;
this.validationErrors = validationErrors;
this.securityIssues = securityIssues;
}
}
export class ITSCompilationError extends ITSError {
constructor(message, elementId, elementType, compilationStage, details) {
super(message, details, 'COMPILATION_FAILED');
if (elementId !== undefined)
this.elementId = elementId;
if (elementType !== undefined)
this.elementType = elementType;
if (compilationStage !== undefined)
this.compilationStage = compilationStage;
}
}
export class ITSSecurityError extends ITSError {
constructor(message, securityRule, threatType, blockedContent, details) {
super(message, details, 'SECURITY_VIOLATION');
if (securityRule !== undefined)
this.securityRule = securityRule;
if (threatType !== undefined)
this.threatType = threatType;
if (blockedContent !== undefined)
this.blockedContent = blockedContent;
}
}
export class ITSVariableError extends ITSError {
constructor(message, variablePath, availableVariables, details) {
super(message, details, 'VARIABLE_ERROR');
if (variablePath !== undefined)
this.variablePath = variablePath;
if (availableVariables !== undefined)
this.availableVariables = availableVariables;
}
}
//# sourceMappingURL=types.js.map