@pantheon-systems/p1-content-validator 2.1.0 → 2.1.2
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 +37 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @pantheon-systems/p1-content-validator
|
|
2
|
+
|
|
3
|
+
Validates Puck component edit operations against a Collaborative State System (CSS) component
|
|
4
|
+
registry, so writes that don't match a component's registered prop shape are rejected before
|
|
5
|
+
they reach a document.
|
|
6
|
+
|
|
7
|
+
> Part of Pantheon's **P1** platform. It is published publicly so P1 services can install it,
|
|
8
|
+
> but it validates against Pantheon's registry format and has no standalone use.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @pantheon-systems/p1-content-validator
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
No peer dependencies.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { validateOps } from "@pantheon-systems/p1-content-validator";
|
|
22
|
+
|
|
23
|
+
const result = validateOps(ops, registry);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Operations are checked against the registry entry for each component — unknown components,
|
|
27
|
+
unknown props, and type mismatches are reported rather than silently written. This is the same
|
|
28
|
+
validation the CSS backend applies to AI-assisted and API-driven edits.
|
|
29
|
+
|
|
30
|
+
Also exported:
|
|
31
|
+
|
|
32
|
+
- `validateDocumentStructure` — structural validation of a whole document
|
|
33
|
+
- `validateTranslationAuthority` — enforces which source may write translated content
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantheon-systems/p1-content-validator",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Validates Puck component edit operations against the CSS component registry",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/pantheon-systems/
|
|
7
|
+
"url": "git+https://github.com/pantheon-systems/p1-platform.git",
|
|
8
8
|
"directory": "packages/p1-content-validator"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"registry": "https://registry.npmjs.org/",
|
|
34
34
|
"provenance": false
|
|
35
35
|
},
|
|
36
|
-
"license": "
|
|
36
|
+
"license": "UNLICENSED",
|
|
37
|
+
"homepage": "https://github.com/pantheon-systems/p1-platform/tree/main/packages/p1-content-validator",
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build": "tsc",
|
|
39
40
|
"clean": "rm -rf dist *.tsbuildinfo",
|