@cerbos/embedded
Version:
Client library for interacting with embedded Cerbos policy decision points generated by Cerbos Hub from server-side Node.js and browser-based applications
25 lines • 819 B
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Transport = void 0;
const core_1 = require("@cerbos/core");
class Transport {
bundle;
constructor(bundle) {
this.bundle = bundle;
}
async unary(service, method, request, headers) {
if (service === "cerbos" && method === "checkResources") {
const bundle = await this.bundle();
return (await bundle.checkResources(request, headers));
}
notImplemented(method);
}
serverStream(_, method) {
notImplemented(method);
}
}
exports.Transport = Transport;
function notImplemented(method) {
throw new core_1.NotOK(core_1.Status.UNIMPLEMENTED, `${method} is not implemented in embedded policy decision points`);
}
//# sourceMappingURL=transport.js.map