@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
36 lines • 1.48 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDsCacheCanReadIncomingEdge = exports.IDsCacheDeletable = exports.IDsCacheUpdatable = exports.IDsCacheReadable = exports.FuncToPredicate = void 0;
const IDsCache_1 = require("../IDsCache");
/**
* Sometimes, instead of passing a well-known predicate like OutgoingEdgePointsToVC
* or CanUpdateOutgoingEdge, we want to pass just a function which accepts a row
* and returns true or false. This class represents a Predicate which delegates
* its work to such a function. The name of the function becomes the name of the
* predicate.
*/
class FuncToPredicate {
constructor(func) {
this.func = func;
this.name = this.func.name || "lambda";
}
async check(vc, input) {
return this.func(vc, input);
}
}
exports.FuncToPredicate = FuncToPredicate;
// Ent.ts may populate these caches too when it loads some ent from the DB,
// because often times we then load some dependent Ent.
class IDsCacheReadable extends IDsCache_1.IDsCache {
}
exports.IDsCacheReadable = IDsCacheReadable;
class IDsCacheUpdatable extends IDsCache_1.IDsCache {
}
exports.IDsCacheUpdatable = IDsCacheUpdatable;
class IDsCacheDeletable extends IDsCache_1.IDsCache {
}
exports.IDsCacheDeletable = IDsCacheDeletable;
class IDsCacheCanReadIncomingEdge extends IDsCache_1.IDsCache {
}
exports.IDsCacheCanReadIncomingEdge = IDsCacheCanReadIncomingEdge;
//# sourceMappingURL=Predicate.js.map
;