@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
38 lines • 1.31 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntValidationError = void 0;
const EntAccessError_1 = require("./EntAccessError");
/**
* Error: thrown after all validators are executed, and some of them think that
* the row is invalid.
*/
class EntValidationError extends EntAccessError_1.EntAccessError {
constructor(entName, errors) {
super(entName,
// The below string is just for debugging purposes.
`${entName}: ` +
errors
.map((error) => error.field + ": " + JSON.stringify(error.message))
.join(", "));
this.errors = errors;
}
/**
* Converts the payload to a Standard Schema V1 compatible error result. See
* https://standardschema.dev.
*/
toStandardSchemaV1() {
return {
issues: this.errors.map(({ field, message }) => ({
message,
path: this.entName || field !== null
? [
...(this.entName ? [this.entName] : []),
...(field !== null ? [field] : []),
]
: undefined,
})),
};
}
}
exports.EntValidationError = EntValidationError;
//# sourceMappingURL=EntValidationError.js.map
;