UNPKG

@clickup/ent-framework

Version:

A PostgreSQL graph-database-alike library with microsharding and row-level security

31 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Rule = void 0; const Predicate_1 = require("../predicates/Predicate"); /** * A base class which can e.g. accept not only a predicate, but also a plain JS * lambda function as a predicate. Also has a logic of "glueing" the rule name * with the predicate name. * * Each Rule must either: * - throw (or return DENY) if it disallows access immediately, * - return ALLOW if the access is granted (so no other rules will run), * - return TOLERATE if it's okay with the row, but wants others' votes too, * - or return SKIP to fully delegate the decision to the next rule. * * See more comments in rules.ts. * * Each rule carries a predicate which it calls and then decides, how to * interpret the result. */ class Rule { constructor(predicate) { this.predicate = predicate instanceof Function ? new Predicate_1.FuncToPredicate(predicate) : predicate; this.name = this.constructor.name + ":" + this.predicate.name; } } exports.Rule = Rule; //# sourceMappingURL=Rule.js.map