@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
34 lines • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Embedded = void 0;
const core_1 = require("@cerbos/core");
const loader_1 = require("./loader");
/**
* A client for interacting with an embedded Cerbos policy decision point (PDP).
*
* @remarks
* Embedded PDP bundles are WebAssembly modules downloaded from {@link https://www.cerbos.dev/product-cerbos-hub | Cerbos Hub}.
* Bundle download URLs are available in the "Embedded" section of the "Decision points" page of your Cerbos Hub workspace.
*
* See {@link @cerbos/core#Client | the parent class} for available methods.
*
* @public
*/
class Embedded extends core_1.Client {
/**
* The {@link Loader} used to load the embedded policy decision point bundle.
*/
loader;
constructor(loaderOrSource, options) {
const loader = loaderOrSource instanceof loader_1.Loader
? loaderOrSource
: new loader_1.Loader(loaderOrSource, options);
super(loader._transport, {
headers: loader._options.headers,
userAgent: loader._userAgent,
});
this.loader = loader;
}
}
exports.Embedded = Embedded;
//# sourceMappingURL=client.js.map