@altnovatrail/spec 0.6.2 → 0.6.4
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 +14 -5
- package/canvas/index.d.ts +25 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,8 @@ function show(task: open.Task, manifest: open.Manifest) {
|
|
|
29
29
|
A field the object always holds is required, and any other is optional. That includes each field that only some branches of a schema give.
|
|
30
30
|
- **`@altnovatrail/spec/formatv0/open`** holds the open view of each part, which is what the learner's app gets ([the format's text](https://github.com/altnovatrail/spec/blob/main/format/README.md#6-open-fields), section 6). Each type keeps its name from `formatv0` and only the fields marked `x-open`, so an open view has no check, no template and no solver.
|
|
31
31
|
- **`@altnovatrail/spec/canvas`** holds the types of `<novatrail-canvas>`:
|
|
32
|
-
- `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `history` and `filled` and its method `exportWork()`;
|
|
32
|
+
- `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `media`, `history` and `filled` and its method `exportWork()`;
|
|
33
|
+
- `Media`, the function by which the consumer gives the files of the pictures: the canvas goes to no network;
|
|
33
34
|
- the events `toolchange`, `historychange` and `demochange`, with `CanvasEventMap` naming them;
|
|
34
35
|
- the state of a worked example's demo, `DemoState`;
|
|
35
36
|
- the history of writing;
|
|
@@ -47,14 +48,22 @@ The package's version is the tag of the release of `altnovatrail/spec` it comes
|
|
|
47
48
|
|
|
48
49
|
## Checking the archive
|
|
49
50
|
|
|
50
|
-
The archive in npm is the file `altnovatrail-spec-<version>.tgz` of that release, which the release signs with cosign and whose attestation names it.
|
|
51
|
+
The archive in npm is the file `altnovatrail-spec-<version>.tgz` of that release, which the release signs with cosign and whose attestation names it. A NovaTrail repository lets the package into its code only once spec's `release-verify-npm` has accepted its lock file, in CI of the pull request that changes it (decision R77 of spec; [RULES.md](https://github.com/altnovatrail/spec/blob/main/RULES.md), Hard rules). It runs from the repository's `spec` submodule:
|
|
51
52
|
|
|
52
53
|
```sh
|
|
53
|
-
|
|
54
|
-
gh release verify-asset v0.4.0 altnovatrail-spec-0.4.0.tgz -R altnovatrail/spec
|
|
54
|
+
just -f spec/justfile release-verify-npm package-lock.json
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
For each package of `@altnovatrail` in the lock file, it downloads the archive from the registry and checks it against Sigstore's trust root and the cosign bundle of the release file of the same name. This package's must be signed by spec's own `.github/workflows/release.yml` on `main`, in `altnovatrail/spec`. Its certificate names the tip of `main` as the signing run began, so the archive is tied to its tag by the version its `package.json` holds. Last, the lock file's `integrity` must be the hash of the bytes so checked. A single archive, with its bundle beside it, is checked by `just -f spec/justfile release-verify spec v0.6.2 altnovatrail-spec-0.6.2.tgz`.
|
|
58
|
+
|
|
59
|
+
The release's attestation ties the archive to the release, not to a commit, and `gh release verify-asset` checks it apart:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm pack @altnovatrail/spec@0.6.2
|
|
63
|
+
gh release verify-asset v0.6.2 altnovatrail-spec-0.6.2.tgz -R altnovatrail/spec
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The release publishes that file to npm itself, by trusted publishing, and npm gives each version it publishes that way a provenance attestation. The provenance names `.github/workflows/release.yml` of `altnovatrail/spec` and the commit of the run that published it, which is the tip of `main` when the run began rather than always the commit the release was cut from. 0.4.0 was published by hand and has no provenance. Not every release of the line has a version in npm, so take a tag whose version is there.
|
|
58
67
|
|
|
59
68
|
## License
|
|
60
69
|
|
package/canvas/index.d.ts
CHANGED
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The types of the element `<novatrail-canvas>`: the contract of canvas and app (R36). The element
|
|
6
|
-
* takes a task and its module's manifest, and the learner's history of
|
|
7
|
-
* gives the work for checking by a method, and tells what the learner did
|
|
8
|
-
* task it may show a lesson's worked example, whose demo the learner opens
|
|
9
|
-
* buttons, and how far they have gone is a property and an event too. The
|
|
10
|
-
* the worked example and of the manifest are the module format's open views,
|
|
6
|
+
* takes a task and its module's manifest, the files of its pictures and the learner's history of
|
|
7
|
+
* writing, by properties; it gives the work for checking by a method, and tells what the learner did
|
|
8
|
+
* by events. In place of a task it may show a lesson's worked example, whose demo the learner opens
|
|
9
|
+
* part by part with its buttons, and how far they have gone is a property and an event too. The
|
|
10
|
+
* types of the task, of the worked example and of the manifest are the module format's open views,
|
|
11
|
+
* formatv0/open.
|
|
11
12
|
*
|
|
12
13
|
* The tutor's marks — the property `marks` and the types of a mark — wait for the contract of epic
|
|
13
|
-
* E3, and are canvas's own until then. The element's members beyond this contract
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* E3, and are canvas's own until then. The element's members beyond this contract — its commands
|
|
15
|
+
* undo() and clear(), which its own buttons call — and its place in the DOM's maps of tags and
|
|
16
|
+
* events are canvas's too: its package registers the element. The declarations take the DOM's
|
|
17
|
+
* types: Blob, CustomEvent and HTMLElement.
|
|
16
18
|
*
|
|
17
19
|
* @packageDocumentation
|
|
18
20
|
*/
|
|
@@ -271,6 +273,13 @@ export interface CanvasEventMap {
|
|
|
271
273
|
demochange: DemoChangeEvent;
|
|
272
274
|
}
|
|
273
275
|
|
|
276
|
+
/**
|
|
277
|
+
* What gives the file of a picture by its reference, the picture's path from the module's media/
|
|
278
|
+
* folder: the consumer's, for the canvas goes to no network. app takes the files from the device
|
|
279
|
+
* part of the module's package, which api serves.
|
|
280
|
+
*/
|
|
281
|
+
export type Media = (ref: string) => Promise<Blob>;
|
|
282
|
+
|
|
274
283
|
/**
|
|
275
284
|
* The element `<novatrail-canvas>` as its contract with app has it. The language of its buttons is
|
|
276
285
|
* its own attribute `lang`.
|
|
@@ -314,6 +323,14 @@ export interface CanvasElement extends HTMLElement {
|
|
|
314
323
|
* TypeError.
|
|
315
324
|
*/
|
|
316
325
|
manifest: open.Manifest | undefined;
|
|
326
|
+
/**
|
|
327
|
+
* What gives the files of the pictures of the task or of the worked example — its statement's,
|
|
328
|
+
* and every part's of its demo — by their references. A reference is asked for once, however many
|
|
329
|
+
* pictures show it. Until a picture's file comes, or if it never does, its frame shows what it
|
|
330
|
+
* shows in words. A new function serves the references that have no file yet. Anything but a
|
|
331
|
+
* function or `undefined` is a TypeError.
|
|
332
|
+
*/
|
|
333
|
+
media: Media | undefined;
|
|
317
334
|
/**
|
|
318
335
|
* The history of writing: every stroke, erasing, clearing and undo on the sheet, frozen. The
|
|
319
336
|
* consumer keeps it, adding what `historychange` tells, and gives it back to open the sheet as it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altnovatrail/spec",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "The types of NovaTrail's module format for TypeScript, generated from its schemas: the parts of a module and their open views, the canonical view, the inventory, the module index and the test vectors. And the types of the element <novatrail-canvas>, the contract of the canvas and the app.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|