@openpolicy/core 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@openpolicy/core`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Compilation engine for [OpenPolicy](https://openpolicy.sh) policy documents.
|
|
4
|
+
|
|
5
|
+
This is an internal package used by `@openpolicy/sdk`, `@openpolicy/vite`, and `@openpolicy/astro`. You generally do not need to install or import it directly.
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
- Compiles `PrivacyPolicyConfig` and `TermsOfServiceConfig` definitions to Markdown and HTML
|
|
10
|
+
- Validates policy configs and returns structured warnings and errors
|
|
11
|
+
- Exports section builders, renderers, and all core types
|
|
12
|
+
|
|
13
|
+
## Direct usage
|
|
14
|
+
|
|
15
|
+
If you're building a custom integration (e.g. a framework plugin not covered by the official packages), you can use `compilePolicy` directly:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { compilePolicy } from "@openpolicy/core";
|
|
19
|
+
|
|
20
|
+
const results = compilePolicy(
|
|
21
|
+
{
|
|
22
|
+
type: "privacy",
|
|
23
|
+
effectiveDate: "2026-01-01",
|
|
24
|
+
company: { name: "Acme", legalName: "Acme, Inc.", address: "...", contact: "privacy@acme.com" },
|
|
25
|
+
// ... rest of config
|
|
26
|
+
},
|
|
27
|
+
{ formats: ["markdown", "html"] },
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
for (const result of results) {
|
|
31
|
+
console.log(result.format, result.content);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Links
|
|
36
|
+
|
|
37
|
+
- [GitHub](https://github.com/jamiedavenport/openpolicy)
|
|
38
|
+
- [openpolicy.sh](https://openpolicy.sh)
|
|
39
|
+
- [npm](https://www.npmjs.com/package/@openpolicy/core)
|