@altnovatrail/contracts 0.7.6 → 0.7.8
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 +17 -0
- package/package.json +7 -2
- package/vectors/eval/v1/boxes.json +1440 -0
- package/vectors/eval/v1/crops.json +1065 -0
- package/vectors/eval/v1/groups.json +737 -0
- package/vectors/eval/v1/snaps.json +1060 -0
package/README.md
CHANGED
|
@@ -18,6 +18,23 @@ JSON of a contract names each field by its protobuf name, in snake case, as the
|
|
|
18
18
|
|
|
19
19
|
The package is read through its `exports`, under `"moduleResolution": "nodenext"`, `"node16"` or `"bundler"`. `spec` checks its declarations with TypeScript 7 under both, strictly, and runs its code under Node.
|
|
20
20
|
|
|
21
|
+
## Test vectors
|
|
22
|
+
|
|
23
|
+
The package carries the test vectors of the rules that the device and the eval runner share — how a history of writing folds, the groups of strokes, the crop, which strokes a box of a model snaps to and which box of a workbook a stroke fills ([the contracts' text](https://github.com/altnovatrail/spec/blob/main/contracts/README.md), section 12) — each exported by its path, as JSON:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { fromJson } from "@bufbuild/protobuf";
|
|
27
|
+
import { HistorySchema } from "@altnovatrail/contracts/novatrail/eval/v1/sample_pb.js";
|
|
28
|
+
import groups from "@altnovatrail/contracts/vectors/eval/v1/groups.json" with { type: "json" };
|
|
29
|
+
|
|
30
|
+
for (const one of groups.cases) {
|
|
31
|
+
const history = fromJson(HistorySchema, one.history);
|
|
32
|
+
// fold the history, make its groups, and compare them with one.visible, one.groups, ...
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Their messages are written with the protobuf names and every field, and a reader takes each with the schema of its message from this package's code. Code that follows the rules passes every case. The vectors of the observation are in the Go module alone: TypeScript gives no verdict.
|
|
37
|
+
|
|
21
38
|
## Versions
|
|
22
39
|
|
|
23
40
|
The package's version is the tag of the release of `altnovatrail/spec` it comes from, without its `v`: 0.7.0 is `v0.7.0`. Every release from the line 0.7 on carries one, even when the contracts have not changed. Take it at an exact version, the same tag as the `spec` submodule and the Go modules of `spec` you hold, and move all of them together. Leave it out of Dependabot, as the Go modules: a release of `spec` comes out with each change of its documents. Dependabot's `ignore` matches a dependency by the name the manifest gives it, `@altnovatrail/contracts` here, and `github.com/altnovatrail/spec/contracts` for the Go module.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altnovatrail/contracts",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "The code of NovaTrail's API contracts for TypeScript, which protoc-gen-es generates from their protobuf files: the messages and enums of each contract, with their descriptors, for @bufbuild/protobuf and Connect.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -17,10 +17,15 @@
|
|
|
17
17
|
"types": "./novatrail/observation/v1/observation_pb.d.ts",
|
|
18
18
|
"default": "./novatrail/observation/v1/observation_pb.js"
|
|
19
19
|
},
|
|
20
|
+
"./vectors/eval/v1/boxes.json": "./vectors/eval/v1/boxes.json",
|
|
21
|
+
"./vectors/eval/v1/crops.json": "./vectors/eval/v1/crops.json",
|
|
22
|
+
"./vectors/eval/v1/groups.json": "./vectors/eval/v1/groups.json",
|
|
23
|
+
"./vectors/eval/v1/snaps.json": "./vectors/eval/v1/snaps.json",
|
|
20
24
|
"./package.json": "./package.json"
|
|
21
25
|
},
|
|
22
26
|
"files": [
|
|
23
|
-
"novatrail"
|
|
27
|
+
"novatrail",
|
|
28
|
+
"vectors"
|
|
24
29
|
],
|
|
25
30
|
"sideEffects": false,
|
|
26
31
|
"dependencies": {
|