first commit

This commit is contained in:
Stefan Hacker
2026-01-29 01:16:54 +01:00
commit e209e9bbca
12105 changed files with 2480672 additions and 0 deletions
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomCondition = void 0;
const base_1 = require("../base");
class CustomCondition {
constructor(condition) {
this.condition = condition;
}
async run(_context, value, meta) {
try {
const result = this.condition(value, meta);
await result;
// if the promise resolved or the result is truthy somehow, then there's no validation halt.
if (!result) {
// the error thrown here is symbolic, it will be re-thrown in the catch clause anyway.
throw new Error();
}
}
catch (e) {
throw new base_1.ValidationHalt();
}
}
}
exports.CustomCondition = CustomCondition;