Package Exports
- @cerbos/files
- @cerbos/files/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@cerbos/files) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@cerbos/files
Load Cerbos policies from YAML or JSON files.
Prerequisites
- Node.js 18+
Installation
$ npm install @cerbos/filesExample usage
import { readDirectory, readPolicy, readSchema } from "@cerbos/files";
const policy = await readPolicy("path/to/policy.yaml");
// => { apiVersion: "api.cerbos.dev/v1", ... }
const schema = await readSchema("_schemas/path/to/schema.json");
// => { id: "path/to/schema.json", definition: "..." }
const { policies, schemas } = await readDirectory("path/to/directory");
// => { policies: [...], schemas: [...] }For more details, see the package documentation.