@trevrpc/protovalidate 1.8.0 → 1.9.0
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 +4 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
[protovalidate](https://github.com/bufbuild/protovalidate) request validation for the TrevRPC browser client, [`@trevrpc/trevrpc-js`](https://www.npmjs.com/package/@trevrpc/trevrpc-js): requests that break their [`buf.validate`](https://buf.build/bufbuild/protovalidate) rules fail before they are sent. It is a separate package so that `@trevrpc/trevrpc-js` itself does not depend on protovalidate or CEL.
|
|
4
4
|
|
|
5
5
|
> **Compatibility:** every TrevRPC package shares one version, and packages of the same version are compatible
|
|
6
|
-
> with each other: `trevrpc-rust` 1.
|
|
7
|
-
> 1.
|
|
6
|
+
> with each other: `trevrpc-rust` 1.9.0 works with `trevrpc-go` 1.9.0, `trevrpc-js` 1.9.0, and `trevrpc-kotlin`
|
|
7
|
+
> 1.9.0. Compatibility across different versions isn't guaranteed yet; that's a milestone for 2.0.
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
10
|
npm install @trevrpc/protovalidate @trevrpc/trevrpc-js @bufbuild/protobuf @bufbuild/protovalidate
|
|
@@ -37,6 +37,8 @@ try {
|
|
|
37
37
|
- Methods whose request type has no rules, directly or in a message it holds, are not checked and cost nothing.
|
|
38
38
|
- `createRequestValidator(validator?)` takes a protovalidate validator, by default one from `createValidator()`. Pass `createValidator({ registry })`, with a registry that holds their extensions, to enforce predefined rules, or `createValidator({ failFast: true })` to stop at the first violation.
|
|
39
39
|
|
|
40
|
+
To check one message as the server would, for a test, call the function that `validateFunc` returns for its schema: `createRequestValidator().validateFunc(CreateRequestSchema)?.(message)` throws the error the call would fail with.
|
|
41
|
+
|
|
40
42
|
Checking requests on the client saves a round trip and shows the violations at once. It does not replace checking them on the server, with [`protovalidatetrevrpc`](https://trev.zip/llc/TrevRPC/src/branch/main/trevrpc-go/protovalidatetrevrpc) or [`trevrpc-protovalidate`](https://trev.zip/llc/TrevRPC/src/branch/main/trevrpc-rust/crates/trevrpc-protovalidate), since clients can skip it.
|
|
41
43
|
|
|
42
44
|
See [Request Validation](https://trev.zip/llc/TrevRPC/wiki/JavaScript-Guide#request-validation).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trevrpc/protovalidate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "protovalidate request validation for TrevRPC browser clients",
|
|
5
5
|
"homepage": "https://trev.zip/llc/TrevRPC",
|
|
6
6
|
"bugs": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@bufbuild/protobuf": "^2.17.0",
|
|
50
50
|
"@bufbuild/protovalidate": "^1.3.0",
|
|
51
|
-
"@trevrpc/trevrpc-js": "^1.
|
|
51
|
+
"@trevrpc/trevrpc-js": "^1.9.0"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=24"
|