@peac/policy-kit 0.12.12 → 0.12.14

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/dist/loader.d.ts CHANGED
@@ -22,6 +22,28 @@ export declare class PolicyValidationError extends PolicyLoadError {
22
22
  readonly issues: ZodError['issues'];
23
23
  constructor(message: string, issues: ZodError['issues']);
24
24
  }
25
+ /**
26
+ * Parse a `peac-policy/0.1` document from raw bytes and validate against the
27
+ * normative schema. Accepts the document format referenced from `peac.txt`
28
+ * (via `policy_doc.url` or `policy_doc.inline`) or the inline payload of a
29
+ * `docs/specs/PEAC-TXT.md`-conformant policy document fetched separately.
30
+ *
31
+ * Auto-detects JSON vs YAML. Throws `PolicyValidationError` when the document
32
+ * is well-formed but does not satisfy `peac-policy/0.1` (e.g. missing
33
+ * `version`, unknown `defaults.decision`, malformed `rules`). Throws
34
+ * `PolicyLoadError` when the text cannot be parsed as either JSON or YAML.
35
+ *
36
+ * This function is network-free and accepts pre-fetched bytes. Callers are
37
+ * responsible for fetching the document (typically via the URL returned by
38
+ * `@peac/disc.parse(...).data.policy_doc.url`) and passing the bytes here.
39
+ *
40
+ * @param text - Raw UTF-8 bytes of a `peac-policy/0.1` document (YAML or JSON)
41
+ * @returns Validated `PolicyDocument`
42
+ * @throws PolicyLoadError on parse failure
43
+ * @throws PolicyValidationError on schema validation failure
44
+ * @see docs/specs/PEAC-TXT.md
45
+ */
46
+ export declare function parsePolicyDocument(text: string): PolicyDocument;
25
47
  /**
26
48
  * Parse policy from string content
27
49
  *
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAwC,MAAM,SAAS,CAAC;AAE/E;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;aAGtB,KAAK,CAA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AAA;CAK3C;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,eAAe;aAGtC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC;gBAD1C,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC;CAK7C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAEhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,CAwBrF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAa3D;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAqB3D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAO1D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CA0CpD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAMlE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,UAAO,GAAG,MAAM,CAEjF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peac/policy-kit",
3
- "version": "0.12.12",
3
+ "version": "0.12.14",
4
4
  "description": "PEAC Policy Kit - deterministic policy evaluation for CAL semantics",
5
5
  "main": "dist/index.cjs",
6
6
  "types": "dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "yaml": "^2.3.4",
27
27
  "zod": "^4.3.6",
28
- "@peac/schema": "0.12.12"
28
+ "@peac/schema": "0.12.14"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.19.11",